Skip to content

Commit f3bb39d

Browse files
committed
fix: remove wells fargo images and replace them with an html and css solution
1 parent 561148d commit f3bb39d

17 files changed

+456
-223
lines changed

src/components/ExampleCheckbox.tsx

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
import React from 'react'
2+
import PropTypes from 'prop-types'
3+
import { useTheme } from '@mui/material'
4+
import { TouchIndicator } from 'src/components/TouchIndicator'
5+
6+
export const ExampleCheckbox: React.FC<
7+
React.HTMLAttributes<HTMLInputElement> & {
8+
pseudoFocusColor: string
9+
showTouchIndicator?: boolean
10+
}
11+
> = ({ id, showTouchIndicator, pseudoFocusColor }) => {
12+
const theme = useTheme()
13+
const checkboxSize = '1em'
14+
15+
return (
16+
<div aria-hidden="true" style={{ position: 'relative' }}>
17+
<input
18+
aria-hidden={true}
19+
className="example-checkbox"
20+
defaultChecked={true}
21+
id={'example-' + id}
22+
name={'example-name-' + id}
23+
style={{
24+
accentColor: theme.palette.text.primary,
25+
marginTop: '8px',
26+
marginBottom: '8px',
27+
marginRight: '12px',
28+
width: checkboxSize,
29+
height: checkboxSize,
30+
}}
31+
tabIndex={-1}
32+
type="checkbox"
33+
/>
34+
{/* Position the touch indicator to be centered over the checkbox */}
35+
{showTouchIndicator && <TouchIndicator style={{ left: '-9px', top: '-4px' }} />}
36+
{/* If we are showing the psuedo touch indicator, also show the pseudo-focus for the checkbox */}
37+
{showTouchIndicator && (
38+
<div
39+
aria-hidden="true"
40+
style={{
41+
display: 'inline-block',
42+
height: `calc(${checkboxSize} + 2px)`,
43+
width: `calc(${checkboxSize} + 2px)`,
44+
border: `1px solid ${pseudoFocusColor}`,
45+
borderRadius: '3px',
46+
position: 'absolute',
47+
top: '6px',
48+
left: '2px',
49+
}}
50+
/>
51+
)}
52+
</div>
53+
)
54+
}
55+
56+
ExampleCheckbox.propTypes = {
57+
id: PropTypes.string,
58+
}

src/components/TouchIndicator.tsx

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import React from 'react'
2+
import { useTheme } from '@mui/material'
3+
4+
// The expectation is that this component renders a circular touch indicator
5+
// and it should be positioned absolutely where needed by the parent component.
6+
export const TouchIndicator: React.FC<React.HTMLAttributes<HTMLDivElement>> = ({
7+
style,
8+
...props
9+
}) => {
10+
const theme = useTheme()
11+
const { hover, selected } = theme.palette.action
12+
13+
const styles: React.CSSProperties = {
14+
position: 'absolute',
15+
height: '36px',
16+
width: '36px',
17+
background: `radial-gradient(circle, ${hover} 0%, ${selected} 100%)`,
18+
stroke: theme.palette.divider,
19+
filter: 'drop-shadow(0 2px 8px rgba(0, 0, 0, 0.12))',
20+
strokeWidth: '1px',
21+
border: `1px solid ${theme.palette.divider}`,
22+
borderRadius: '50%',
23+
...style,
24+
}
25+
26+
return <div aria-hidden="true" className="touch-indicator" style={styles} {...props} />
27+
}

src/const/language/es.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,9 @@
418418
"I don't want this account connected here": "No quiero esta cuenta conectada aquí",
419419
"We're working on it. Stick around!": "Estamos trabajando en ello. ¡Quedarse!",
420420
"We're getting closer. Hang tight!": "Nos estamos acercando. ¡Aguanta!",
421+
"Information to select on the %1 site": "Información para seleccionar en el sitio %1",
422+
"Checking or savings account": "Cuenta corriente o de ahorros",
423+
"Profile information": "Información del perfil",
421424
"connect/disclosure/button\u0004Continue": "Continuar",
422425
"connect/disclosure/policy/text\u0004By clicking Continue, you agree to the ": "Al hacer clic en Continuar, tu aceptas la ",
423426
"connect/disclosure/policy/link\u0004MX Privacy Policy.": "Política de privacidad de Money Experience.",

src/const/language/es.po

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1324,7 +1324,7 @@ msgid "Load more institutions"
13241324
msgstr "Cargar más instituciones"
13251325

13261326
#: src/views/oauth/OAuthDefault.js
1327-
#: src/views/oauth/experiments/WellsFargoInstructions.tsx
1327+
#: src/views/oauth/experiments/PredirectInstructions.tsx
13281328
msgid "Log in at %1"
13291329
msgstr "Iniciar sesión en %1"
13301330

@@ -2036,14 +2036,14 @@ msgstr ""
20362036
"Depósitos verificados. Ya casi terminas de configurar todo. Continúa con tu "
20372037
"institución."
20382038

2039-
#: src/views/oauth/experiments/WellsFargoInstructions.tsx
2039+
#: src/views/oauth/experiments/PredirectInstructions.tsx
20402040
msgid ""
20412041
"After logging in, share at least one account and %1profile information%2."
20422042
msgstr ""
20432043
"Después de iniciar sesión, comparta al menos una cuenta y %1información de "
20442044
"perfil%2."
20452045

2046-
#: src/views/oauth/experiments/WellsFargoInstructions.tsx
2046+
#: src/views/oauth/experiments/PredirectInstructions.tsx
20472047
msgid "After logging in, share at least one account."
20482048
msgstr "Después de iniciar sesión, comparta al menos una cuenta."
20492049

@@ -2090,3 +2090,15 @@ msgstr "Estamos trabajando en ello. ¡Quedarse!"
20902090
#: src/views/connecting/progress/ProgressMessage.js
20912091
msgid "We're getting closer. Hang tight!"
20922092
msgstr "Nos estamos acercando. ¡Aguanta!"
2093+
2094+
#: src/views/oauth/experiments/PredirectInstructions.tsx
2095+
msgid "Information to select on the %1 site"
2096+
msgstr "Información para seleccionar en el sitio %1"
2097+
2098+
#: src/views/oauth/experiments/PredirectInstructions.tsx
2099+
msgid "Checking or savings account"
2100+
msgstr "Cuenta corriente o de ahorros"
2101+
2102+
#: src/views/oauth/experiments/PredirectInstructions.tsx
2103+
msgid "Profile information"
2104+
msgstr "Información del perfil"

src/const/language/frCa.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,9 @@
419419
"I don't want this account connected here": "Je ne veux pas ce compte connecté ici",
420420
"We're working on it. Stick around!": "Nous y travaillons. Rester dans les parages!",
421421
"We're getting closer. Hang tight!": "Nous nous rapprochons. Tenir fermement!",
422+
"Information to select on the %1 site": "Informations à sélectionner sur le site %1.",
423+
"Checking or savings account": "Compte courant ou compte d'épargne",
424+
"Profile information": "Informations de profil",
422425
"connect/disclosure/policy/text\u0004By clicking Continue, you agree to the ": "En cliquant sur Continuer, vous acceptez la ",
423426
"connect/disclosure/policy/link\u0004MX Privacy Policy.": "Politique de confidentialité de MX.",
424427
"connect/disclosure/policy/link\u0004MX Privacy Policy": "Politique de confidentialité de MX.",

src/const/language/frCa.po

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1417,7 +1417,7 @@ msgid "Load more institutions"
14171417
msgstr "Charger plus d'institutions"
14181418

14191419
#: src/views/oauth/OAuthDefault.js
1420-
#: src/views/oauth/experiments/WellsFargoInstructions.tsx
1420+
#: src/views/oauth/experiments/PredirectInstructions.tsx
14211421
msgid "Log in at %1"
14221422
msgstr "Connectez-vous à %1"
14231423

@@ -2114,14 +2114,14 @@ msgstr ""
21142114
"Dépôts vérifiés. Vous avez presque terminé la configuration. Rendez-vous "
21152115
"dans votre établissement."
21162116

2117-
#: src/views/oauth/experiments/WellsFargoInstructions.tsx
2117+
#: src/views/oauth/experiments/PredirectInstructions.tsx
21182118
msgid ""
21192119
"After logging in, share at least one account and %1profile information%2."
21202120
msgstr ""
21212121
"Après vous être connecté, partagez au moins un compte et %1informations de "
21222122
"profil%2."
21232123

2124-
#: src/views/oauth/experiments/WellsFargoInstructions.tsx
2124+
#: src/views/oauth/experiments/PredirectInstructions.tsx
21252125
msgid "After logging in, share at least one account."
21262126
msgstr "Après vous être connecté, partagez au moins un compte."
21272127

@@ -2168,3 +2168,15 @@ msgstr "Nous y travaillons. Rester dans les parages!"
21682168
#: src/views/connecting/progress/ProgressMessage.js
21692169
msgid "We're getting closer. Hang tight!"
21702170
msgstr "Nous nous rapprochons. Tenir fermement!"
2171+
2172+
#: src/views/oauth/experiments/PredirectInstructions.tsx
2173+
msgid "Information to select on the %1 site"
2174+
msgstr "Informations à sélectionner sur le site %1."
2175+
2176+
#: src/views/oauth/experiments/PredirectInstructions.tsx
2177+
msgid "Checking or savings account"
2178+
msgstr "Compte courant ou compte d'épargne"
2179+
2180+
#: src/views/oauth/experiments/PredirectInstructions.tsx
2181+
msgid "Profile information"
2182+
msgstr "Informations de profil"

src/redux/reducers/userFeaturesSlice.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { CONNECT_COMBO_JOBS, CONNECT_CONSENT } from 'src/const/UserFeatures'
44
import { RootState } from 'src/redux/Store'
55

66
type UserFeaturesSlice = {
7-
items: { feature_name: string; is_enabled: boolean }[]
7+
items: { feature_name: string; is_enabled: boolean | string }[]
88
}
99

1010
export const initialState: UserFeaturesSlice = {

src/views/oauth/OAuthDefault.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ import { AnalyticEvents, PageviewInfo } from 'src/const/Analytics'
2222
import { useApi } from 'src/context/ApiContext'
2323
import { getUserFeatures } from 'src/redux/reducers/userFeaturesSlice'
2424
import {
25+
PredirectInstructions,
2526
WELLS_FARGO_INSTRUCTIONS_FEATURE_NAME,
26-
WellsFargoInstructions,
27-
} from 'src/views/oauth/experiments/WellsFargoInstructions'
27+
} from 'src/views/oauth/experiments/PredirectInstructions'
2828

2929
export const OAuthDefault = (props) => {
3030
// Experiment code - Remove after experiment is over
@@ -62,7 +62,7 @@ export const OAuthDefault = (props) => {
6262
<>
6363
{/* // This experiment removes the institution block and completely changes the instructional
6464
text */}
65-
<WellsFargoInstructions institutionName={props?.institution?.name} />
65+
<PredirectInstructions institutionName={props?.institution?.name} />
6666
</>
6767
) : (
6868
<>
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
.institution-panel-wrapper {
2+
position: relative;
3+
display: flex;
4+
justify-content: center;
5+
padding-top: 32px;
6+
padding-bottom: 8px;
7+
border-bottom-right-radius: 8px;
8+
border-bottom-left-radius: 8px;
9+
}
10+
11+
.institution-panel-wrapper div.MuiPaper-root {
12+
box-shadow: 0px 2px 8px rgba(0, 0, 0, 0.12);
13+
}
14+
15+
.institution-panel {
16+
width: 300px;
17+
pointer-events: none;
18+
}
19+
.institution-panel-header {
20+
font-weight: 600;
21+
border-radius: 8px 8px 0 0;
22+
font-size: 18px;
23+
height: 34px;
24+
display: flex;
25+
justify-content: center;
26+
align-items: center;
27+
color: white;
28+
padding-left: 20px;
29+
padding-right: 20px;
30+
}
31+
.institution-panel-body {
32+
position: relative;
33+
padding: 0 16px;
34+
font-size: 13px;
35+
}
36+
.institution-panel-body ul {
37+
list-style-type: none;
38+
padding: 0;
39+
margin: 0;
40+
}
41+
.institution-panel-body li {
42+
display: flex;
43+
align-items: center;
44+
padding-top: 8px;
45+
padding-bottom: 8px;
46+
}
47+
48+
li span.MuiCheckbox-root {
49+
padding-left: 0px;
50+
}
51+
52+
.predirect-instruction-text-wrapper {
53+
position: relative;
54+
}
55+
56+
.predirect-instruction-text-wrapper .MuiSvgIcon-root {
57+
position: absolute;
58+
bottom: 2px;
59+
}
60+
.predirect-instruction-text {
61+
display: inline;
62+
}
63+
64+
.psuedo-checkbox-label {
65+
padding-top: 10px;
66+
padding-bottom: 10px;
67+
}
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
import React from 'react'
2+
import { useSelector } from 'react-redux'
3+
4+
import 'src/views/oauth/experiments/PredirectInstructions.css'
5+
6+
import { selectConnectConfig } from 'src/redux/reducers/configSlice'
7+
8+
import { Icon, IconWeight, Text } from '@mxenabled/mxui'
9+
import { __ } from 'src/utilities/Intl'
10+
import { Divider, Paper } from '@mui/material'
11+
import { ExampleCheckbox } from 'src/components/ExampleCheckbox'
12+
13+
export const WELLS_FARGO_INSTRUCTIONS_FEATURE_NAME = 'WELLS_FARGO_INSTRUCTIONS'
14+
15+
function PredirectInstructions(props: React.FunctionComponent & { institutionName: string }) {
16+
const config = useSelector(selectConnectConfig)
17+
const products = config?.data_request?.products || []
18+
const showProfileSelection =
19+
products.includes('account_verification') || products.includes('identity_verification')
20+
21+
const institutionColor = '#d9181f' // Wells Fargo red
22+
23+
const uiElementTypes = {
24+
CHECKING_OR_SAVINGS_ACCOUNT: 'checking-or-savings-account',
25+
DIVIDER: 'divider',
26+
PROFILE_INFORMATION: 'profile',
27+
}
28+
const checkboxItems = [uiElementTypes.CHECKING_OR_SAVINGS_ACCOUNT]
29+
30+
if (showProfileSelection) {
31+
checkboxItems.push(uiElementTypes.DIVIDER)
32+
checkboxItems.push(uiElementTypes.PROFILE_INFORMATION)
33+
}
34+
35+
/* Bold text is needed. The styles applied to this text prevent server-provided styles from ruining strong elements */
36+
const instructionText = showProfileSelection
37+
? __(
38+
'After logging in, share at least one account and %1profile information%2.',
39+
"<strong style='font-weight: bold;'>",
40+
'</strong>',
41+
)
42+
: __('After logging in, share at least one account.')
43+
44+
return (
45+
<>
46+
<Text bold={true} component="h2" sx={{ mb: 12 }} truncate={false} variant="H2">
47+
{__('Log in at %1', props.institutionName)}
48+
</Text>
49+
<div className="predirect-instruction-text-wrapper">
50+
<Text
51+
className="predirect-instruction-text"
52+
color="textSecondary"
53+
dangerouslySetInnerHTML={{
54+
__html: instructionText,
55+
}}
56+
truncate={false}
57+
variant="body1"
58+
/>
59+
{showProfileSelection && (
60+
<Icon color="secondary" name="info" size={20} weight={IconWeight.Dark} />
61+
)}
62+
</div>
63+
64+
<div className="institution-panel-wrapper">
65+
<Paper className="institution-panel" elevation={2}>
66+
{/* Inline color and font styles on the header and text because this is a dynamic area */}
67+
<div className="institution-panel-header" style={{ backgroundColor: institutionColor }}>
68+
<Text aria-hidden="true" sx={{ fontWeight: 600, color: 'white' }} uppercase={true}>
69+
{props.institutionName}
70+
</Text>
71+
</div>
72+
<div className="institution-panel-body">
73+
<ul aria-label={__('Information to select on the %1 site', props.institutionName)}>
74+
{checkboxItems.map((item, index) => {
75+
if (item === uiElementTypes.DIVIDER) {
76+
return <Divider key={`divider-${index}`} />
77+
} else {
78+
let text = ''
79+
if (item === uiElementTypes.CHECKING_OR_SAVINGS_ACCOUNT) {
80+
text = __('Checking or savings account')
81+
} else if (item === uiElementTypes.PROFILE_INFORMATION) {
82+
text = __('Profile information')
83+
}
84+
85+
const isLastItem = index === checkboxItems.length - 1
86+
87+
return (
88+
<li key={item}>
89+
<ExampleCheckbox
90+
id={item}
91+
pseudoFocusColor={institutionColor}
92+
showTouchIndicator={isLastItem}
93+
/>
94+
<Text className="psuedo-checkbox-label" variant="body1">
95+
{text}
96+
</Text>
97+
</li>
98+
)
99+
}
100+
})}
101+
</ul>
102+
</div>
103+
</Paper>
104+
</div>
105+
</>
106+
)
107+
}
108+
109+
export { PredirectInstructions }

0 commit comments

Comments
 (0)