Skip to content

Commit fe9043e

Browse files
committed
feat: update RuxPhoneNumber and ReturnUserExperience components for improved layout and analytics tracking
1 parent 36f2d36 commit fe9043e

4 files changed

Lines changed: 71 additions & 26 deletions

File tree

src/ReturnUserExperience/ReturnUserExperience.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,14 @@ export const ReturnUserExperience = React.forwardRef(() => {
3232
<div className={styles.pageContainer}>
3333
{view !== RUXViews.LIST && (
3434
<Stack className={styles.logoHeaders} direction="row" spacing="8px">
35-
<div className={styles.clientLogo}>
36-
<ClientLogo alt="Client logo" clientGuid={clientGuid} size={64} />
37-
</div>
38-
<Icon name="add" size={20} />
35+
{view === RUXViews.INFO && (
36+
<>
37+
<div className={styles.clientLogo}>
38+
<ClientLogo alt="Client logo" clientGuid={clientGuid} size={64} />
39+
</div>
40+
<Icon name="add" size={20} />
41+
</>
42+
)}
3943
<div className={styles.mxLogo}>
4044
<MXLogoFilledIcon size={64} />
4145
</div>
Lines changed: 60 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
import React from 'react'
2-
import { useSelector } from 'react-redux'
32

3+
import { useTheme } from '@mui/material'
44
import InputAdornment from '@mui/material/InputAdornment'
55
import Stack from '@mui/material/Stack'
66
import Button from '@mui/material/Button'
77
import { Text } from '@mxenabled/mxui'
88
import { Link } from '@mui/material'
99

10-
import { RootState } from 'src/redux/Store'
1110
import { __ } from 'src/utilities/Intl'
11+
import useAnalyticsPath from 'src/hooks/useAnalyticsPath'
1212
import { TextField } from 'src/privacy/input'
13+
import { PageviewInfo } from 'src/const/Analytics'
1314
import styles from './returnUserExperience.module.css'
1415

1516
export const RuxPhoneNumber = ({
@@ -19,21 +20,27 @@ export const RuxPhoneNumber = ({
1920
userEnteredPhone: string
2021
setUserEnteredPhone: (phone: string) => void
2122
}) => {
22-
const appName = useSelector(
23-
(state: RootState) => state.profiles.client.oauth_app_name || 'This app',
24-
)
23+
useAnalyticsPath(...PageviewInfo.CONNECT_RUX_PHONE_NUMBER)
24+
const { palette } = useTheme()
2525

2626
return (
2727
<>
2828
<Stack className={styles.titleContainer} spacing="6px">
2929
<Text bold={true} className={styles.centerText} truncate={false} variant="h2">
30-
{__('Connect your accounts')}
30+
{__('Connect faster with your phone number')}
3131
</Text>
3232
<Text className={styles.centerText} truncate={false} variant="subtitle1">
33-
{__('%1 uses MX to connect your accounts.', appName)}
33+
{__('Login or sign up with MX to securely access your saved accounts. ')}
3434
<Link
35+
className={styles.primaryLink}
3536
href="https://mx.com/learn-more"
36-
sx={{ color: 'tokens.TextColor.ButtonLink', marginLeft: 0 }}
37+
sx={{
38+
color: palette.primary.main,
39+
fontWeight: 'normal',
40+
marginLeft: 0,
41+
textDecoration: 'underline',
42+
}}
43+
target="_blank"
3744
underline="always"
3845
variant="subtitle1"
3946
>
@@ -46,34 +53,58 @@ export const RuxPhoneNumber = ({
4653
InputProps={{
4754
startAdornment: (
4855
<InputAdornment position="start">
49-
<div>
50-
<Text variant="body1">Phone</Text>
51-
<Text bold={true} variant="h2">
56+
<div style={{ display: 'flex', alignItems: 'center' }}>
57+
<Text style={{ paddingLeft: '10px', paddingRight: '16px' }} variant="body1">
58+
Phone
59+
</Text>
60+
<Text sx={{ fontWeight: 400 }} variant="h2">
5261
+1
5362
</Text>
5463
</div>
5564
</InputAdornment>
5665
),
66+
style: {
67+
paddingRight: '14px',
68+
margin: '40px 0',
69+
fontSize: '23px',
70+
fontWeight: '400',
71+
height: 'auto',
72+
maxHeight: '60px',
73+
},
5774
}}
58-
onChange={(e: React.ChangeEvent<HTMLInputElement>) => setUserEnteredPhone(e.target.value)}
75+
fullWidth={true}
76+
name="phoneNumber"
77+
onChange={(e: React.ChangeEvent<HTMLInputElement>) =>
78+
setUserEnteredPhone(e.target.value.replace(/\D/g, '').slice(0, 10))
79+
}
5980
required={true}
60-
value={userEnteredPhone}
81+
value={formatPhone(userEnteredPhone)}
6182
/>
6283

63-
<Stack className={styles.buttonContainer} spacing="8px">
64-
<Text variant="caption">
84+
<Stack spacing="8px">
85+
<Text truncate={false} variant="caption">
6586
{/* --TR: Full string 'By selecting "Get code", you agree to MX's Terms & Conditions' */}
66-
{__('By selecting "Get code", you agree to')}
67-
<Link href="https://www.mx.com/terms/" variant="caption">
87+
{__('By selecting "Continue", you agree to ')}
88+
<Link
89+
href="https://www.mx.com/terms/"
90+
sx={{
91+
fontWeight: 'normal',
92+
marginLeft: 0,
93+
marginRight: 0,
94+
textDecoration: 'underline',
95+
}}
96+
target="_blank"
97+
underline="always"
98+
variant="caption"
99+
>
68100
{/* TODO: Do we translate this below? */}
69101
{__("MX's Terms & Conditions")}
70102
</Link>
71-
.
72103
</Text>
73-
<Button fullWidth={true} onClick={() => {}}>
104+
<Button onClick={() => {}} variant="contained">
74105
{__('Continue')}
75106
</Button>
76-
<Button fullWidth={true} onClick={() => {}} variant="outlined">
107+
<Button onClick={() => {}} variant="text">
77108
{__('Continue without phone number')}
78109
</Button>
79110
</Stack>
@@ -82,3 +113,12 @@ export const RuxPhoneNumber = ({
82113
}
83114

84115
export default RuxPhoneNumber
116+
117+
const formatPhone = (value: string) => {
118+
const digits = value.replace(/\D/g, '').slice(0, 10)
119+
120+
if (digits.length === 0) return digits
121+
if (digits.length <= 3) return `(${digits}`
122+
if (digits.length <= 6) return `(${digits.slice(0, 3)}) ${digits.slice(3)}`
123+
return `(${digits.slice(0, 3)}) ${digits.slice(3, 6)} - ${digits.slice(6)}`
124+
}

src/ReturnUserExperience/returnUserExperience.module.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,6 @@
7171

7272
.titleContainer {
7373
padding-top: 16px;
74-
padding-right: 16px;
75-
padding-left: 16px;
74+
margin-right: -8px;
75+
margin-left: -8px;
7676
}

src/const/Analytics.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ export const PageviewInfo = {
117117
CONNECT_OAUTH_ERROR: ['Connect Oauth Error', '/oauth_error'],
118118
CONNECT_NO_ELIGIBLE_ACCOUNTS: ['Connect No Eligible Accounts', '/no_eligible_accounts'],
119119
CONNECT_RUX_INFO: ['Connect RUX Info', '/rux_info'],
120+
CONNECT_RUX_PHONE_NUMBER: ['Connect RUX Phone Number', '/rux_phone_number'],
120121
CONNECT_SEARCH: ['Connect Search', '/search'],
121122
CONNECT_SEARCH_FAILED: ['Connect Search Failed', '/search_failed'],
122123
CONNECT_SEARCH_NO_RESULTS: ['Connect Search No Results', '/no_results'],

0 commit comments

Comments
 (0)