@@ -2,7 +2,6 @@ import React, { useContext } from 'react'
22import { useDispatch , useSelector } from 'react-redux'
33import PropTypes from 'prop-types'
44
5- import _pick from 'lodash/pick'
65import _isEmpty from 'lodash/isEmpty'
76
87import { useTokens } from '@kyper/tokenprovider'
@@ -15,8 +14,6 @@ import {
1514 selectConnectConfig ,
1615 selectIsMobileWebView ,
1716 selectUIMessageVersion ,
18- addAggregationData ,
19- addVerificationData ,
2017 selectInitialConfig ,
2118} from 'src/redux/reducers/configSlice'
2219
@@ -46,8 +43,6 @@ import { POST_MESSAGES } from 'src/const/postMessages'
4643import { PostMessageContext } from 'src/ConnectWidget'
4744import useSelectInstitution from 'src/hooks/useSelectInstitution'
4845import { DynamicDisclosure } from 'src/views/consent/DynamicDisclosure'
49- import { COMBO_JOB_DATA_TYPES } from 'src/const/comboJobDataTypes'
50- import { isConsentEnabled } from 'src/redux/reducers/userFeaturesSlice'
5146import { canHandleActionableError } from 'src/views/actionableError/consts'
5247
5348const RenderConnectStep = ( props ) => {
@@ -73,7 +68,6 @@ const RenderConnectStep = (props) => {
7368 const selectedInstitution = useSelector ( getSelectedInstitution )
7469 const updateCredentials = useSelector ( ( state ) => state . connect . updateCredentials )
7570 const verifyMemberError = useSelector ( ( state ) => state . connect . error )
76- const consentIsEnabled = useSelector ( ( state ) => isConsentEnabled ( state ) )
7771
7872 const { handleSelectInstitution } = useSelectInstitution ( )
7973
@@ -91,118 +85,35 @@ const RenderConnectStep = (props) => {
9185
9286 const hasAtriumAPI = client . has_atrium_api
9387
94- /**
95- * To show the add manual accounts option, you have to have the profile enabled,
96- * be in agg mode, and not be an atrium client.
97- */
98- const isManualAccountsEnabled =
99- widgetProfile . enable_manual_accounts && mode === AGG_MODE && ! hasAtriumAPI
100-
10188 const showSupport = widgetProfile . enable_support_requests && mode === AGG_MODE
102- const usePopularOnly =
103- ( clientProfile . uses_custom_popular_institution_list ?? false ) ||
104- ( client . has_limited_institutions ?? false )
10589 const isDeleteInstitutionOptionEnabled = widgetProfile ?. display_delete_option_in_connect ?? true
10690
107- const handleInstitutionSelect = ( institution ) => {
108- postMessageFunctions . onPostMessage (
109- 'connect/selectedInstitution' ,
110- _pick ( institution , [ 'name' , 'guid' , 'url' , 'code' ] ) ,
111- )
112-
113- // The institution doesn't have credentials until we request it again from server
114- handleSelectInstitution ( institution )
115- }
116-
11791 let connectStepView = null
11892
11993 if ( step === STEPS . DISCLOSURE ) {
120- connectStepView = (
121- < Disclosure
122- mode = { mode }
123- onContinue = { ( ) =>
124- dispatch ( { type : connectActions . ActionTypes . ACCEPT_DISCLOSURE , payload : connectConfig } )
125- }
126- ref = { props . navigationRef }
127- size = { size }
128- />
129- )
94+ connectStepView = < Disclosure ref = { props . navigationRef } />
13095 } else if ( step === STEPS . SEARCH ) {
131- connectStepView = (
132- < Search
133- connectConfig = { connectConfig }
134- connectedMembers = { connectedMembers }
135- enableManualAccounts = { isManualAccountsEnabled }
136- enableSupportRequests = { showSupport }
137- isMicrodepositsEnabled = { isMicrodepositsEnabled }
138- onAddManualAccountClick = { props . handleAddManualAccountClick }
139- onInstitutionSelect = { handleInstitutionSelect }
140- ref = { props . navigationRef }
141- size = { size }
142- stepToMicrodeposits = { ( ) => dispatch ( connectActions . stepToMicrodeposits ( ) ) }
143- usePopularOnly = { usePopularOnly }
144- />
145- )
96+ connectStepView = < Search ref = { props . navigationRef } />
14697 } else if ( step === STEPS . INSTITUTION_DISABLED ) {
14798 connectStepView = < InstitutionDisabled ref = { props . navigationRef } />
14899 } else if ( step === STEPS . CONSENT ) {
149100 connectStepView = (
150101 < div >
151102 < DynamicDisclosure
152- onConsentClick = { ( ) => {
153- dispatch ( { type : connectActions . ActionTypes . USER_CONSENTED } )
154- } }
155- onGoBackClick = { ( ) => {
156- props . handleConsentGoBack ( )
157- } }
103+ onGoBackClick = { ( ) => props . handleConsentGoBack ( ) }
158104 ref = { props . navigationRef }
159105 />
160106 </ div >
161107 )
162108 } else if ( step === STEPS . ADDITIONAL_PRODUCT ) {
163- if ( ! ADDITIONAL_PRODUCT_OPTIONS . includes ( connectConfig ?. additional_product_option ) ) {
109+ if ( ! ADDITIONAL_PRODUCT_OPTIONS . includes ( connectConfig ?. additional_product_option ) )
164110 throw new Error ( 'invalid product offer' )
165- }
166-
167- const onNoClick = ( ) => {
168- // Go to the next step in the flow without changing the configuration
169- dispatch ( {
170- type : connectActions . ActionTypes . REJECT_ADDITIONAL_PRODUCT ,
171- payload : {
172- consentIsEnabled,
173- } ,
174- } )
175- }
176-
177- let onYesClick = null
178- if ( connectConfig ?. additional_product_option === COMBO_JOB_DATA_TYPES . ACCOUNT_NUMBER ) {
179- onYesClick = ( ) => {
180- dispatch ( addVerificationData ( { consentIsEnabled } ) )
181- }
182- } else if ( connectConfig ?. additional_product_option === COMBO_JOB_DATA_TYPES . TRANSACTIONS ) {
183- onYesClick = ( ) => {
184- dispatch ( addAggregationData ( { consentIsEnabled } ) )
185- }
186- }
187111
188- connectStepView = (
189- < AdditionalProductStep
190- additionalProductName = { connectConfig . additional_product_option }
191- onNoClick = { onNoClick }
192- onYesClick = { onYesClick }
193- ref = { props . navigationRef }
194- />
195- )
112+ connectStepView = < AdditionalProductStep ref = { props . navigationRef } />
196113 } else if ( step === STEPS . ADD_MANUAL_ACCOUNT ) {
197114 connectStepView = (
198115 < ManualAccountConnect
199116 availableAccountTypes = { props . availableAccountTypes }
200- onClose = { ( ) =>
201- dispatch ( {
202- type : connectActions . ActionTypes . GO_BACK_MANUAL_ACCOUNT ,
203- payload : initialConfig ,
204- } )
205- }
206117 onManualAccountAdded = { props . onManualAccountAdded }
207118 ref = { props . navigationRef }
208119 />
@@ -374,7 +285,6 @@ const RenderConnectStep = (props) => {
374285
375286RenderConnectStep . propTypes = {
376287 availableAccountTypes : PropTypes . array ,
377- handleAddManualAccountClick : PropTypes . func . isRequired ,
378288 handleConsentGoBack : PropTypes . func . isRequired ,
379289 handleCredentialsGoBack : PropTypes . func . isRequired ,
380290 handleOAuthGoBack : PropTypes . func . isRequired ,
0 commit comments