@mxenabled/connect-widget 0.19.5 → 0.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js CHANGED
@@ -5236,7 +5236,8 @@ const ActionTypes$2 = {
5236
5236
  MFA_CONNECT_SUBMIT_ERROR: "connect/mfa_connect_submit_error",
5237
5237
  MFA_CONNECT_SUBMIT_SUCCESS: "connect/mfa_connect_submit_success",
5238
5238
  LOGIN_ERROR_START_OVER: "connect/login_error_start_over",
5239
- CONNECT_GO_BACK: "connect/go_back"
5239
+ CONNECT_GO_BACK: "connect/go_back",
5240
+ REJECT_ADDITIONAL_PRODUCT: "connect/reject_additional_product"
5240
5241
  };
5241
5242
  const loadConnect$1 = (config = {}) => ({ type: ActionTypes$2.LOAD_CONNECT, payload: config });
5242
5243
  const loadConnectSuccess$1 = (dependencies = {}) => ({
@@ -5328,6 +5329,7 @@ const TAX_MODE = "tax";
5328
5329
  const STEPS = {
5329
5330
  ACTIONABLE_ERROR: "actionableError",
5330
5331
  ADD_MANUAL_ACCOUNT: "addManualAccount",
5332
+ ADDITIONAL_PRODUCT: "additionalProduct",
5331
5333
  CONNECTED: "connected",
5332
5334
  CONNECTING: "connecting",
5333
5335
  CONSENT: "consent",
@@ -8973,6 +8975,177 @@ const hasNoSingleAccountSelectOptions = (member) => {
8973
8975
  return false;
8974
8976
  };
8975
8977
 
8978
+ const COMBO_JOB_DATA_TYPES = {
8979
+ ACCOUNT_NUMBER: "account_verification",
8980
+ // verification mode
8981
+ ACCOUNT_OWNER: "identity_verification",
8982
+ // include_identity
8983
+ TRANSACTIONS: "transactions",
8984
+ REWARDS: "rewards"};
8985
+
8986
+ const initialState$5 = {
8987
+ _initialValues: "",
8988
+ is_mobile_webview: false,
8989
+ target_origin_referrer: null,
8990
+ ui_message_protocol: "post_message",
8991
+ ui_message_version: 1,
8992
+ ui_message_webview_url_scheme: "mx",
8993
+ color_scheme: "light",
8994
+ mode: AGG_MODE,
8995
+ current_institution_code: null,
8996
+ current_institution_guid: null,
8997
+ current_member_guid: null,
8998
+ current_microdeposit_guid: null,
8999
+ enable_app2app: true,
9000
+ disable_background_agg: null,
9001
+ disable_institution_search: false,
9002
+ include_identity: null,
9003
+ include_transactions: null,
9004
+ iso_country_code: null,
9005
+ oauth_referral_source: REFERRAL_SOURCES.BROWSER,
9006
+ update_credentials: false,
9007
+ wait_for_full_aggregation: false,
9008
+ data_request: null,
9009
+ use_cases: null,
9010
+ additional_product_option: null
9011
+ };
9012
+ const configSlice = createSlice({
9013
+ name: "config",
9014
+ initialState: initialState$5,
9015
+ reducers: {
9016
+ addVerificationData: (state) => {
9017
+ if (state.mode === AGG_MODE) {
9018
+ state.include_transactions = true;
9019
+ }
9020
+ state.mode = VERIFY_MODE;
9021
+ if (Array.isArray(state.use_cases)) {
9022
+ state.use_cases.push("MONEY_MOVEMENT");
9023
+ } else {
9024
+ state.use_cases = ["MONEY_MOVEMENT"];
9025
+ }
9026
+ },
9027
+ addAggregationData: (state) => {
9028
+ state.include_transactions = true;
9029
+ if (Array.isArray(state.use_cases)) {
9030
+ state.use_cases.push("PFM");
9031
+ } else {
9032
+ state.use_cases = ["PFM"];
9033
+ }
9034
+ },
9035
+ additionalProductReset: _additionalProductReset
9036
+ },
9037
+ extraReducers(builder) {
9038
+ builder.addCase(
9039
+ ActionTypes$2.LOAD_CONNECT,
9040
+ (state, action) => {
9041
+ const productDetermineMode = getProductDeterminedMode(action.payload);
9042
+ const ui_message_version = typeof action.payload.ui_message_version === "string" ? parseInt(action.payload.ui_message_version, 10) : action.payload.ui_message_version || state.ui_message_version;
9043
+ const loadedState = {
9044
+ ...state,
9045
+ ...action.payload,
9046
+ ui_message_version,
9047
+ mode: productDetermineMode !== null ? productDetermineMode : action.payload.mode || state.mode
9048
+ };
9049
+ const { _initialValues, ...stateWithoutInitialValues } = loadedState;
9050
+ return {
9051
+ ...stateWithoutInitialValues,
9052
+ // _initialValues is a reference to the values that were used to load the widget initially.
9053
+ // It is meant to be set, and then READ ONLY after that.
9054
+ // Example:
9055
+ // When a user dynamically changes the mode, use_cases, or data for a connection we need to
9056
+ // reset the mode, use_cases, and data to the initial state for the next connection attempt.
9057
+ // JSON is used here to deeply copy the object, use a selector to get the values.
9058
+ _initialValues: JSON.stringify(stateWithoutInitialValues)
9059
+ };
9060
+ }
9061
+ );
9062
+ builder.addCase(
9063
+ ActionTypes$2.CONNECT_GO_BACK,
9064
+ (state, action) => {
9065
+ const resetSteps = [STEPS.SEARCH, STEPS.VERIFY_EXISTING_MEMBER, STEPS.ADDITIONAL_PRODUCT];
9066
+ if (resetSteps.includes(action.payload?.previousStep)) {
9067
+ return _additionalProductReset(state);
9068
+ }
9069
+ return state;
9070
+ }
9071
+ );
9072
+ builder.addCase(ActionTypes$2.RESET_WIDGET_CONNECTED, (state) => {
9073
+ return _additionalProductReset(state);
9074
+ });
9075
+ builder.addCase(ActionTypes$2.ACTIONABLE_ERROR_CONNECT_DIFFERENT_INSTITUTION, (state) => {
9076
+ return _additionalProductReset(state);
9077
+ });
9078
+ builder.addCase(ActionTypes$2.LOGIN_ERROR_START_OVER, (state) => {
9079
+ return _additionalProductReset(state);
9080
+ });
9081
+ builder.addCase(ActionTypes$2.DELETE_MEMBER_SUCCESS_RESET, (state) => {
9082
+ return _additionalProductReset(state);
9083
+ });
9084
+ builder.addCase(ActionTypes$2.RESET_WIDGET_MFA_STEP, (state) => {
9085
+ return _additionalProductReset(state);
9086
+ });
9087
+ }
9088
+ });
9089
+ const selectInitialConfig = createSelector(
9090
+ (state) => state.config._initialValues,
9091
+ (initialValues) => convertInitialValuesToObject(initialValues)
9092
+ );
9093
+ const selectConfig = (state) => state.config;
9094
+ const selectIsMobileWebView = (state) => state.config.is_mobile_webview;
9095
+ const selectUIMessageVersion = (state) => state.config.ui_message_version;
9096
+ const selectConnectConfig = createSelector(selectConfig, (config) => ({
9097
+ mode: config.mode,
9098
+ current_institution_code: config.current_institution_code,
9099
+ current_institution_guid: config.current_institution_guid,
9100
+ current_member_guid: config.current_member_guid,
9101
+ current_microdeposit_guid: config.current_microdeposit_guid,
9102
+ enable_app2app: config.enable_app2app,
9103
+ disable_background_agg: config.disable_background_agg,
9104
+ disable_institution_search: config.disable_institution_search,
9105
+ include_identity: config.include_identity,
9106
+ include_transactions: config.include_transactions,
9107
+ iso_country_code: config.iso_country_code,
9108
+ oauth_referral_source: config.oauth_referral_source,
9109
+ update_credentials: config.update_credentials,
9110
+ wait_for_full_aggregation: config.wait_for_full_aggregation,
9111
+ data_request: config.data_request,
9112
+ use_cases: config.use_cases,
9113
+ additional_product_option: config.additional_product_option
9114
+ }));
9115
+ const selectColorScheme = (state) => state.config.color_scheme;
9116
+ const getProductDeterminedMode = (config) => {
9117
+ const products = config?.data_request?.products;
9118
+ if (Array.isArray(products)) {
9119
+ if (products.includes(COMBO_JOB_DATA_TYPES.ACCOUNT_NUMBER)) {
9120
+ return VERIFY_MODE;
9121
+ } else if (products.includes(COMBO_JOB_DATA_TYPES.REWARDS)) {
9122
+ return REWARD_MODE;
9123
+ } else {
9124
+ return AGG_MODE;
9125
+ }
9126
+ } else {
9127
+ return null;
9128
+ }
9129
+ };
9130
+ const convertInitialValuesToObject = (initialValues) => {
9131
+ try {
9132
+ return JSON.parse(initialValues);
9133
+ } catch (error) {
9134
+ return {};
9135
+ }
9136
+ };
9137
+ function _additionalProductReset(state) {
9138
+ const initialValuesObject = convertInitialValuesToObject(state._initialValues);
9139
+ return {
9140
+ ...state,
9141
+ include_transactions: initialValuesObject?.include_transactions ?? initialState$5.include_transactions,
9142
+ mode: initialValuesObject?.mode ?? initialState$5.mode,
9143
+ use_cases: initialValuesObject?.use_cases ?? initialState$5.use_cases
9144
+ };
9145
+ }
9146
+ const { addVerificationData, addAggregationData, additionalProductReset } = configSlice.actions;
9147
+ const configSlice$1 = configSlice.reducer;
9148
+
8976
9149
  const defaultState$1 = {
8977
9150
  error: null,
8978
9151
  // The most recent job request error, if any
@@ -9165,13 +9338,33 @@ const acceptDisclosure = (state, { payload }) => {
9165
9338
  return { ...state, location: pushLocation(state.location, nextStep) };
9166
9339
  };
9167
9340
  const selectInstitutionSuccess = (state, action) => {
9341
+ let nextStep = STEPS.ENTER_CREDENTIALS;
9342
+ const canOfferVerification = action.payload.institution?.account_verification_is_enabled && action.payload.additionalProductOption === COMBO_JOB_DATA_TYPES.ACCOUNT_NUMBER;
9343
+ const canOfferAggregation = action.payload.additionalProductOption === COMBO_JOB_DATA_TYPES.TRANSACTIONS;
9344
+ if (canOfferVerification || canOfferAggregation) {
9345
+ nextStep = STEPS.ADDITIONAL_PRODUCT;
9346
+ } else if (action.payload.consentIsEnabled) {
9347
+ nextStep = STEPS.CONSENT;
9348
+ }
9349
+ if (state.location.length > 0 && state.location[state.location.length - 1].step === nextStep) {
9350
+ return {
9351
+ ...state,
9352
+ selectedInstitution: action.payload.institution
9353
+ };
9354
+ }
9355
+ return {
9356
+ ...state,
9357
+ location: pushLocation(state.location, nextStep),
9358
+ selectedInstitution: action.payload.institution
9359
+ };
9360
+ };
9361
+ const continueAfterAdditionalProduct = (state, action) => {
9168
9362
  return {
9169
9363
  ...state,
9170
9364
  location: pushLocation(
9171
9365
  state.location,
9172
- action.payload.consentFlag ? STEPS.CONSENT : STEPS.ENTER_CREDENTIALS
9173
- ),
9174
- selectedInstitution: action.payload.institution
9366
+ action.payload.consentIsEnabled ? STEPS.CONSENT : STEPS.ENTER_CREDENTIALS
9367
+ )
9175
9368
  };
9176
9369
  };
9177
9370
  const startOauth = (state, action) => ({
@@ -9281,9 +9474,24 @@ const addManualAccount = (state, { payload }) => {
9281
9474
  return state;
9282
9475
  };
9283
9476
  const connectGoBack = (state) => {
9477
+ const stepsWhichResetValues = [STEPS.SEARCH, STEPS.VERIFY_EXISTING_MEMBER];
9478
+ const newLocationValues = popLocation(state);
9479
+ if (stepsWhichResetValues.includes(newLocationValues[newLocationValues.length - 1]?.step)) {
9480
+ return {
9481
+ ...state,
9482
+ location: newLocationValues,
9483
+ currentMemberGuid: defaultState$1.currentMemberGuid,
9484
+ error: defaultState$1.error,
9485
+ updateCredentials: defaultState$1.updateCredentials,
9486
+ oauthURL: defaultState$1.oauthURL,
9487
+ oauthErrorReason: defaultState$1.oauthErrorReason,
9488
+ jobSchedule: UNINITIALIZED$2,
9489
+ selectedInstitution: defaultState$1.selectedInstitution
9490
+ };
9491
+ }
9284
9492
  return {
9285
9493
  ...state,
9286
- location: popLocation(state)
9494
+ location: newLocationValues
9287
9495
  };
9288
9496
  };
9289
9497
  const actionableErrorConnectDifferentInstitution = (state, action) => {
@@ -9429,148 +9637,15 @@ const connect = createReducer(defaultState$1, {
9429
9637
  [ActionTypes$2.MFA_CONNECT_SUBMIT_ERROR]: mfaConnectSubmitError,
9430
9638
  [ActionTypes$2.ADD_MANUAL_ACCOUNT_SUCCESS]: addManualAccount,
9431
9639
  [ActionTypes$2.LOGIN_ERROR_START_OVER]: loginErrorStartOver,
9432
- [ActionTypes$2.CONNECT_GO_BACK]: connectGoBack
9640
+ [ActionTypes$2.CONNECT_GO_BACK]: connectGoBack,
9641
+ // Addtional product offer / step up reducers
9642
+ // These are here to manage changing the location/step of the widget
9643
+ [ActionTypes$2.REJECT_ADDITIONAL_PRODUCT]: continueAfterAdditionalProduct,
9644
+ // Listening to the step up actions from the configSlice
9645
+ [addVerificationData().type]: continueAfterAdditionalProduct,
9646
+ [addAggregationData().type]: continueAfterAdditionalProduct
9433
9647
  });
9434
9648
 
9435
- const COMBO_JOB_DATA_TYPES = {
9436
- ACCOUNT_NUMBER: "account_verification",
9437
- // verification mode
9438
- ACCOUNT_OWNER: "identity_verification",
9439
- // include_identity
9440
- TRANSACTIONS: "transactions",
9441
- REWARDS: "rewards"};
9442
-
9443
- const initialState$5 = {
9444
- _initialValues: "",
9445
- is_mobile_webview: false,
9446
- target_origin_referrer: null,
9447
- ui_message_protocol: "post_message",
9448
- ui_message_version: 1,
9449
- ui_message_webview_url_scheme: "mx",
9450
- color_scheme: "light",
9451
- mode: AGG_MODE,
9452
- current_institution_code: null,
9453
- current_institution_guid: null,
9454
- current_member_guid: null,
9455
- current_microdeposit_guid: null,
9456
- enable_app2app: true,
9457
- disable_background_agg: null,
9458
- disable_institution_search: false,
9459
- include_identity: null,
9460
- include_transactions: null,
9461
- iso_country_code: null,
9462
- oauth_referral_source: REFERRAL_SOURCES.BROWSER,
9463
- update_credentials: false,
9464
- wait_for_full_aggregation: false,
9465
- data_request: null,
9466
- use_cases: null
9467
- };
9468
- const configSlice = createSlice({
9469
- name: "config",
9470
- initialState: initialState$5,
9471
- reducers: {
9472
- stepUpToVerification: (state) => {
9473
- if (state.mode === AGG_MODE) {
9474
- state.include_transactions = true;
9475
- }
9476
- state.mode = VERIFY_MODE;
9477
- if (Array.isArray(state.use_cases)) {
9478
- state.use_cases.push("MONEY_MOVEMENT");
9479
- } else {
9480
- state.use_cases = ["MONEY_MOVEMENT"];
9481
- }
9482
- },
9483
- stepUpToAggregation: (state) => {
9484
- state.include_transactions = true;
9485
- if (Array.isArray(state.use_cases)) {
9486
- state.use_cases.push("PFM");
9487
- } else {
9488
- state.use_cases = ["PFM"];
9489
- }
9490
- },
9491
- stepUpReset: (state) => {
9492
- const initialValuesObject = convertInitialValuesToObject(state._initialValues);
9493
- return {
9494
- ...state,
9495
- include_transactions: initialValuesObject?.include_transactions ?? initialState$5.include_transactions,
9496
- mode: initialValuesObject?.mode ?? initialState$5.mode,
9497
- use_cases: initialValuesObject?.use_cases ?? initialState$5.use_cases
9498
- };
9499
- }
9500
- },
9501
- extraReducers(builder) {
9502
- builder.addCase(
9503
- ActionTypes$2.LOAD_CONNECT,
9504
- (state, action) => {
9505
- const productDetermineMode = getProductDeterminedMode(action.payload);
9506
- const ui_message_version = typeof action.payload.ui_message_version === "string" ? parseInt(action.payload.ui_message_version, 10) : action.payload.ui_message_version || state.ui_message_version;
9507
- const loadedState = {
9508
- ...state,
9509
- ...action.payload,
9510
- ui_message_version,
9511
- mode: productDetermineMode !== null ? productDetermineMode : action.payload.mode || state.mode
9512
- };
9513
- const { _initialValues, ...stateWithoutInitialValues } = loadedState;
9514
- return {
9515
- ...stateWithoutInitialValues,
9516
- // _initialValues is a reference to the values that were used to load the widget initially.
9517
- // It is meant to be set, and then READ ONLY after that.
9518
- // Example:
9519
- // When a user dynamically changes the mode, use_cases, or data for a connection we need to
9520
- // reset the mode, use_cases, and data to the initial state for the next connection attempt.
9521
- // JSON is used here to deeply copy the object, use a selector to get the values.
9522
- _initialValues: JSON.stringify(stateWithoutInitialValues)
9523
- };
9524
- }
9525
- );
9526
- }
9527
- });
9528
- const selectConfig = (state) => state.config;
9529
- const selectIsMobileWebView = (state) => state.config.is_mobile_webview;
9530
- const selectUIMessageVersion = (state) => state.config.ui_message_version;
9531
- const selectConnectConfig = createSelector(selectConfig, (config) => ({
9532
- mode: config.mode,
9533
- current_institution_code: config.current_institution_code,
9534
- current_institution_guid: config.current_institution_guid,
9535
- current_member_guid: config.current_member_guid,
9536
- current_microdeposit_guid: config.current_microdeposit_guid,
9537
- enable_app2app: config.enable_app2app,
9538
- disable_background_agg: config.disable_background_agg,
9539
- disable_institution_search: config.disable_institution_search,
9540
- include_identity: config.include_identity,
9541
- include_transactions: config.include_transactions,
9542
- iso_country_code: config.iso_country_code,
9543
- oauth_referral_source: config.oauth_referral_source,
9544
- update_credentials: config.update_credentials,
9545
- wait_for_full_aggregation: config.wait_for_full_aggregation,
9546
- data_request: config.data_request,
9547
- use_cases: config.use_cases
9548
- }));
9549
- const selectColorScheme = (state) => state.config.color_scheme;
9550
- const getProductDeterminedMode = (config) => {
9551
- const products = config?.data_request?.products;
9552
- if (Array.isArray(products)) {
9553
- if (products.includes(COMBO_JOB_DATA_TYPES.ACCOUNT_NUMBER)) {
9554
- return VERIFY_MODE;
9555
- } else if (products.includes(COMBO_JOB_DATA_TYPES.REWARDS)) {
9556
- return REWARD_MODE;
9557
- } else {
9558
- return AGG_MODE;
9559
- }
9560
- } else {
9561
- return null;
9562
- }
9563
- };
9564
- const convertInitialValuesToObject = (initialValues) => {
9565
- try {
9566
- return JSON.parse(initialValues);
9567
- } catch (error) {
9568
- return {};
9569
- }
9570
- };
9571
- const { stepUpToVerification, stepUpToAggregation, stepUpReset } = configSlice.actions;
9572
- const configSlice$1 = configSlice.reducer;
9573
-
9574
9649
  const initialState$4 = {
9575
9650
  loading: true,
9576
9651
  client: {},
@@ -71757,6 +71832,7 @@ const LoginError = React__default.forwardRef(
71757
71832
  const postMessageFunctions = useContext(PostMessageContext);
71758
71833
  const dispatch = useDispatch();
71759
71834
  const connectConfig = useSelector(selectConnectConfig);
71835
+ const initialConfig = useSelector(selectInitialConfig);
71760
71836
  const pageViewInfo = PageviewInfo.CONNECT_LOGIN_ERROR;
71761
71837
  useAnalyticsPath(...pageViewInfo);
71762
71838
  const [isLeaving, setIsLeaving] = useState(false);
@@ -71785,7 +71861,10 @@ const LoginError = React__default.forwardRef(
71785
71861
  }
71786
71862
  });
71787
71863
  }, [member]);
71788
- const loginErrorStartOver = () => dispatch({ type: ActionTypes$2.LOGIN_ERROR_START_OVER, payload: { mode: connectConfig.mode } });
71864
+ const loginErrorStartOver = () => dispatch({
71865
+ type: ActionTypes$2.LOGIN_ERROR_START_OVER,
71866
+ payload: { mode: initialConfig.mode }
71867
+ });
71789
71868
  const handleOkPrimaryActionClick = () => {
71790
71869
  postMessageFunctions.onPostMessage("connect/memberError/primaryAction", {
71791
71870
  member: {
@@ -72000,6 +72079,7 @@ const ActionableError = () => {
72000
72079
  const postMessageFunctions = useContext(PostMessageContext);
72001
72080
  const institution = useSelector((state) => state.connect.selectedInstitution);
72002
72081
  const currentMember = useSelector(getCurrentMember);
72082
+ const initialConfig = useSelector(selectInitialConfig);
72003
72083
  const jobDetailCode = currentMember.most_recent_job_detail_code;
72004
72084
  const tokens = useTokens();
72005
72085
  const styles = getStyles$A(tokens);
@@ -72021,7 +72101,10 @@ const ActionableError = () => {
72021
72101
  label: __("Connect a different institution"),
72022
72102
  action: () => {
72023
72103
  postMessageFunctions.onPostMessage("connect/backToSearch");
72024
- dispatch({ type: ActionTypes$2.ACTIONABLE_ERROR_CONNECT_DIFFERENT_INSTITUTION });
72104
+ dispatch({
72105
+ type: ActionTypes$2.ACTIONABLE_ERROR_CONNECT_DIFFERENT_INSTITUTION,
72106
+ payload: initialConfig.mode
72107
+ });
72025
72108
  }
72026
72109
  }
72027
72110
  }
@@ -76674,11 +76757,96 @@ const Actions = {
76674
76757
  HANDLE_SUCCESS: "manualAccount/handleSuccess"
76675
76758
  };
76676
76759
 
76760
+ const ADDITIONAL_PRODUCT_OPTIONS = [
76761
+ COMBO_JOB_DATA_TYPES.TRANSACTIONS,
76762
+ COMBO_JOB_DATA_TYPES.ACCOUNT_NUMBER
76763
+ ];
76764
+ const AdditionalProductStep = React__default.forwardRef(
76765
+ ({
76766
+ additionalProductName,
76767
+ onNoClick = () => {
76768
+ throw new Error("onNoClick not implemented");
76769
+ },
76770
+ onYesClick = () => {
76771
+ throw new Error("onYesClick not implemented");
76772
+ }
76773
+ }, navigationRef) => {
76774
+ const selectedInstitution = useSelector(getSelectedInstitution);
76775
+ useImperativeHandle(navigationRef, () => {
76776
+ return {
76777
+ showBackButton() {
76778
+ return true;
76779
+ }
76780
+ };
76781
+ }, []);
76782
+ const getNextDelay = getDelay();
76783
+ const addAggregationText = {
76784
+ title: __("Add financial management?"),
76785
+ body: __(
76786
+ "You are connecting this account for payments and transfers. Would you also like to connect it for financial management to track income and spending?"
76787
+ ),
76788
+ acceptButtonText: __("Yes, add financial management"),
76789
+ rejectButtonText: __("No, just transfers and payments")
76790
+ };
76791
+ const addVerificationText = {
76792
+ title: __("Add transfers and payments?"),
76793
+ body: __(
76794
+ "You are connecting this account for financial management. Would you also like to connect it for transfers and payments to quickly move money to and from this institution?"
76795
+ ),
76796
+ acceptButtonText: __("Yes, add transfers and payments"),
76797
+ rejectButtonText: __("No, just financial management")
76798
+ };
76799
+ const componentText = additionalProductName === COMBO_JOB_DATA_TYPES.TRANSACTIONS ? addAggregationText : addVerificationText;
76800
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(SlideDown, { delay: getNextDelay(), children: [
76801
+ /* @__PURE__ */ jsxRuntimeExports.jsx(InstitutionBlock, { institution: selectedInstitution, style: { marginBottom: 24 } }),
76802
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
76803
+ x,
76804
+ {
76805
+ component: "h2",
76806
+ "data-test": "additional-product__title-text",
76807
+ style: { marginBottom: 12 },
76808
+ truncate: false,
76809
+ variant: "H2",
76810
+ children: componentText.title
76811
+ }
76812
+ ),
76813
+ /* @__PURE__ */ jsxRuntimeExports.jsx(x, { component: "p", style: { marginBottom: 32 }, truncate: false, variant: "Paragraph", children: componentText.body }),
76814
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
76815
+ Button$2,
76816
+ {
76817
+ "data-test": "additional-product__accept-button",
76818
+ fullWidth: true,
76819
+ onClick: () => {
76820
+ onYesClick();
76821
+ },
76822
+ style: { marginBottom: 8 },
76823
+ variant: "contained",
76824
+ children: componentText.acceptButtonText
76825
+ }
76826
+ ),
76827
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
76828
+ Button$2,
76829
+ {
76830
+ "data-test": "additional-product__reject-button",
76831
+ fullWidth: true,
76832
+ onClick: () => {
76833
+ onNoClick();
76834
+ },
76835
+ variant: "text",
76836
+ children: componentText.rejectButtonText
76837
+ }
76838
+ )
76839
+ ] });
76840
+ }
76841
+ );
76842
+ AdditionalProductStep.displayName = "AdditionalProductStep";
76843
+
76677
76844
  const useSelectInstitution = () => {
76678
76845
  const { api } = useApi();
76679
76846
  const [institutionGuid, setInstitutionGuid] = useState("");
76680
76847
  const dispatch = useDispatch();
76681
76848
  const consentIsEnabled = useSelector((state) => isConsentEnabled(state));
76849
+ const connectConfig = useSelector(selectConnectConfig);
76682
76850
  const handleSelectInstitution = useCallback(
76683
76851
  (institutionGuid2) => {
76684
76852
  setInstitutionGuid(institutionGuid2);
@@ -76692,7 +76860,11 @@ const useSelectInstitution = () => {
76692
76860
  map((institution) => {
76693
76861
  return dispatch({
76694
76862
  type: ActionTypes$2.SELECT_INSTITUTION_SUCCESS,
76695
- payload: { institution, consentFlag: consentIsEnabled || false }
76863
+ payload: {
76864
+ institution,
76865
+ consentIsEnabled: consentIsEnabled || false,
76866
+ additionalProductOption: connectConfig?.additional_product_option || null
76867
+ }
76696
76868
  });
76697
76869
  }),
76698
76870
  catchError((err) => {
@@ -77102,6 +77274,7 @@ DynamicDisclosure.displayName = "DynamicDisclosure";
77102
77274
  const RenderConnectStep = (props) => {
77103
77275
  const postMessageFunctions = useContext(PostMessageContext);
77104
77276
  const connectConfig = useSelector(selectConnectConfig);
77277
+ const initialConfig = useSelector(selectInitialConfig);
77105
77278
  const uiMessageVersion = useSelector(selectUIMessageVersion);
77106
77279
  const isMobileWebview = useSelector(selectIsMobileWebView);
77107
77280
  const client = useSelector((state) => state.profiles.client);
@@ -77119,6 +77292,7 @@ const RenderConnectStep = (props) => {
77119
77292
  const selectedInstitution = useSelector(getSelectedInstitution);
77120
77293
  const updateCredentials = useSelector((state) => state.connect.updateCredentials);
77121
77294
  const verifyMemberError = useSelector((state) => state.connect.error);
77295
+ const consentIsEnabled = useSelector((state) => isConsentEnabled(state));
77122
77296
  const { handleSelectInstitution } = useSelectInstitution();
77123
77297
  const dispatch = useDispatch();
77124
77298
  const tokens = useTokens();
@@ -77181,6 +77355,37 @@ const RenderConnectStep = (props) => {
77181
77355
  ref: props.navigationRef
77182
77356
  }
77183
77357
  ) });
77358
+ } else if (step === STEPS.ADDITIONAL_PRODUCT) {
77359
+ if (!ADDITIONAL_PRODUCT_OPTIONS.includes(connectConfig?.additional_product_option)) {
77360
+ throw new Error("invalid product offer");
77361
+ }
77362
+ const onNoClick = () => {
77363
+ dispatch({
77364
+ type: ActionTypes$2.REJECT_ADDITIONAL_PRODUCT,
77365
+ payload: {
77366
+ consentIsEnabled
77367
+ }
77368
+ });
77369
+ };
77370
+ let onYesClick = null;
77371
+ if (connectConfig?.additional_product_option === COMBO_JOB_DATA_TYPES.ACCOUNT_NUMBER) {
77372
+ onYesClick = () => {
77373
+ dispatch(addVerificationData({ consentIsEnabled }));
77374
+ };
77375
+ } else if (connectConfig?.additional_product_option === COMBO_JOB_DATA_TYPES.TRANSACTIONS) {
77376
+ onYesClick = () => {
77377
+ dispatch(addAggregationData({ consentIsEnabled }));
77378
+ };
77379
+ }
77380
+ connectStepView = /* @__PURE__ */ jsxRuntimeExports.jsx(
77381
+ AdditionalProductStep,
77382
+ {
77383
+ additionalProductName: connectConfig.additional_product_option,
77384
+ onNoClick,
77385
+ onYesClick,
77386
+ ref: props.navigationRef
77387
+ }
77388
+ );
77184
77389
  } else if (step === STEPS.ADD_MANUAL_ACCOUNT) {
77185
77390
  connectStepView = /* @__PURE__ */ jsxRuntimeExports.jsx(
77186
77391
  ManualAccountConnect,
@@ -77188,7 +77393,7 @@ const RenderConnectStep = (props) => {
77188
77393
  availableAccountTypes: props.availableAccountTypes,
77189
77394
  onClose: () => dispatch({
77190
77395
  type: ActionTypes$2.GO_BACK_MANUAL_ACCOUNT,
77191
- payload: connectConfig
77396
+ payload: initialConfig
77192
77397
  }),
77193
77398
  onManualAccountAdded: props.onManualAccountAdded,
77194
77399
  ref: props.navigationRef
@@ -77332,7 +77537,7 @@ const RenderConnectStep = (props) => {
77332
77537
  postMessageFunctions.onPostMessage(POST_MESSAGES.BACK_TO_SEARCH);
77333
77538
  dispatch({
77334
77539
  type: ActionTypes$2.DELETE_MEMBER_SUCCESS_RESET,
77335
- payload: connectConfig
77540
+ payload: initialConfig
77336
77541
  });
77337
77542
  }
77338
77543
  }
@@ -79373,6 +79578,7 @@ const Connect$2 = ({
79373
79578
  ...props
79374
79579
  }) => {
79375
79580
  const connectConfig = useSelector(selectConnectConfig);
79581
+ const initialConfig = useSelector(selectInitialConfig);
79376
79582
  const loadError = useSelector((state2) => state2.connect.loadError);
79377
79583
  const hasAtriumAPI = useSelector((state2) => state2.profiles.client.has_atrium_api);
79378
79584
  const isLoading = useSelector((state2) => state2.connect.isComponentLoading);
@@ -79380,6 +79586,10 @@ const Connect$2 = ({
79380
79586
  const step = useSelector(
79381
79587
  (state2) => state2.connect.location[state2.connect.location.length - 1]?.step ?? STEPS.SEARCH
79382
79588
  );
79589
+ const previousStep = useSelector((state2) => {
79590
+ if (state2.connect.location.length < 2) return null;
79591
+ return state2.connect.location[state2.connect.location.length - 2]?.step ?? null;
79592
+ });
79383
79593
  const uiMessageVersion = useSelector(selectUIMessageVersion);
79384
79594
  const prevProps = usePrevious({ isLoading, step, clientConfig: props.clientConfig });
79385
79595
  const { loadConnect } = useLoadConnect();
@@ -79393,6 +79603,16 @@ const Connect$2 = ({
79393
79603
  // This holds a reference to the current step component.
79394
79604
  });
79395
79605
  const consentIsEnabled = useSelector((state2) => isConsentEnabled(state2));
79606
+ const handleGoBackWithSideEffects = () => {
79607
+ const BACK_ACTION_WITH_PREV_STEP = {
79608
+ type: ActionTypes$2.CONNECT_GO_BACK,
79609
+ payload: { previousStep }
79610
+ };
79611
+ if (step === STEPS.SEARCH || step === STEPS.VERIFY_EXISTING_MEMBER) {
79612
+ postMessageFunctions.onPostMessage(POST_MESSAGES.BACK_TO_SEARCH, {});
79613
+ }
79614
+ return BACK_ACTION_WITH_PREV_STEP;
79615
+ };
79396
79616
  const dispatch = useDispatch();
79397
79617
  useEffect(() => {
79398
79618
  const [name, path] = PageviewInfo.CONNECT;
@@ -79469,7 +79689,7 @@ const Connect$2 = ({
79469
79689
  } else {
79470
79690
  dispatch({
79471
79691
  type: ActionTypes$2.GO_BACK_POST_MESSAGE,
79472
- payload: connectConfig
79692
+ payload: initialConfig
79473
79693
  });
79474
79694
  postMessageFunctions.onPostMessage("navigation", { did_go_back: true });
79475
79695
  }
@@ -79483,31 +79703,33 @@ const Connect$2 = ({
79483
79703
  if (state.returnToMicrodeposits) {
79484
79704
  dispatch(stepToMicrodeposits$1());
79485
79705
  setState({ ...state, returnToMicrodeposits: false });
79706
+ } else if (connectConfig.additional_product_option) {
79707
+ dispatch(handleGoBackWithSideEffects());
79486
79708
  } else {
79487
79709
  postMessageFunctions.onPostMessage(POST_MESSAGES.BACK_TO_SEARCH, {});
79488
- dispatch({ type: ActionTypes$2.GO_BACK_CONSENT, payload: connectConfig });
79710
+ dispatch({ type: ActionTypes$2.GO_BACK_CONSENT, payload: initialConfig });
79489
79711
  }
79490
79712
  };
79491
79713
  const _handleCredentialsGoBack = () => {
79492
79714
  if (state.returnToMicrodeposits) {
79493
79715
  dispatch(stepToMicrodeposits$1());
79494
79716
  setState({ ...state, returnToMicrodeposits: false });
79495
- } else if (consentIsEnabled) {
79496
- dispatch({ type: ActionTypes$2.CONNECT_GO_BACK });
79717
+ } else if (consentIsEnabled || connectConfig.additional_product_option) {
79718
+ dispatch(handleGoBackWithSideEffects());
79497
79719
  } else {
79498
79720
  postMessageFunctions.onPostMessage(POST_MESSAGES.BACK_TO_SEARCH, {});
79499
- dispatch({ type: ActionTypes$2.GO_BACK_CREDENTIALS, payload: connectConfig });
79721
+ dispatch({ type: ActionTypes$2.GO_BACK_CREDENTIALS, payload: initialConfig });
79500
79722
  }
79501
79723
  };
79502
79724
  const _handleOAuthGoBack = () => {
79503
79725
  if (state.returnToMicrodeposits) {
79504
79726
  dispatch(stepToMicrodeposits$1());
79505
79727
  setState({ ...state, returnToMicrodeposits: false });
79506
- } else if (consentIsEnabled) {
79507
- dispatch({ type: ActionTypes$2.CONNECT_GO_BACK });
79728
+ } else if (consentIsEnabled || connectConfig.additional_product_option) {
79729
+ dispatch(handleGoBackWithSideEffects());
79508
79730
  } else {
79509
79731
  postMessageFunctions.onPostMessage(POST_MESSAGES.BACK_TO_SEARCH, {});
79510
- dispatch({ type: ActionTypes$2.GO_BACK_OAUTH, payload: connectConfig });
79732
+ dispatch({ type: ActionTypes$2.GO_BACK_OAUTH, payload: initialConfig });
79511
79733
  }
79512
79734
  };
79513
79735
  const _handleStepDOMChange = useCallback((ref) => {
@@ -79563,7 +79785,7 @@ const Connect$2 = ({
79563
79785
  /* @__PURE__ */ jsxRuntimeExports.jsx(
79564
79786
  ConnectNavigationHeader,
79565
79787
  {
79566
- connectGoBack: () => dispatch({ type: ActionTypes$2.CONNECT_GO_BACK }),
79788
+ connectGoBack: () => dispatch(handleGoBackWithSideEffects()),
79567
79789
  stepComponentRef: state.stepComponentRef
79568
79790
  }
79569
79791
  ),
@@ -80072,6 +80294,15 @@ const frCa = {
80072
80294
  "No eligible accounts": "Aucun compte admissible",
80073
80295
  "Only checking or savings accounts can be used for transfers. If you have one at %1, make sure to select it when connecting. Otherwise, try connecting a different institution.": "Seuls les comptes chèques ou d’épargne peuvent être utilisés pour les transferts. Si vous en avez un à %1, assurez-vous de le sélectionner lors de la connexion. Sinon, essayez de connecter une autre institution.",
80074
80296
  Required: Required$1,
80297
+ "Add financial management?": "Ajouter la gestion financière ?",
80298
+ "You are connecting this account for payments and transfers. Would you also like to connect it for financial management to track income and spending?": "Vous connectez ce compte pour les paiements et les virements. Souhaitez-vous également le connecter pour la gestion financière afin de suivre vos revenus et vos dépenses ?",
80299
+ "Yes, add financial management": "Oui, ajoutez la gestion financière",
80300
+ "No, just transfers and payment": "Non, juste des virements et des paiements",
80301
+ "Add transfers and payments?": "Ajouter des transferts et des paiements ?",
80302
+ "You are connecting this account for financial management. Would you also like to connect it for transfers and payments to quickly move money to and from this institution?": "Vous connectez ce compte pour la gestion financière. Souhaitez-vous également le connecter pour effectuer des virements et des paiements afin de transférer rapidement des fonds vers et depuis cette institution ?",
80303
+ "Yes, add transfers and payments": "Oui, ajouter des transferts et des paiements",
80304
+ "No, just financial management": "Non, juste la gestion financière",
80305
+ "Select an account to connect": "Sélectionnez un compte pour vous connecter",
80075
80306
  "connect/disclosure/policy/text\u0004By clicking Continue, you agree to the ": "En cliquant sur Continuer, vous acceptez la ",
80076
80307
  "connect/disclosure/policy/link\u0004MX Privacy Policy.": "Politique de confidentialité de MX.",
80077
80308
  "connect/disclosure/policy/link\u0004MX Privacy Policy": "Politique de confidentialité de MX.",
@@ -80559,6 +80790,15 @@ const es = {
80559
80790
  "No eligible accounts": "No hay cuentas elegibles",
80560
80791
  "Only checking or savings accounts can be used for transfers. If you have one at %1, make sure to select it when connecting. Otherwise, try connecting a different institution.": "Solo se pueden usar cuentas de control o ahorro para transferencias. Si tiene uno en %1, asegúrese de seleccionarlo al conectarlo. De lo contrario, intente conectar una institución diferente.",
80561
80792
  Required: Required,
80793
+ "Add financial management?": "¿Añadir gestión financiera?",
80794
+ "You are connecting this account for payments and transfers. Would you also like to connect it for financial management to track income and spending?": "Estás conectando esta cuenta para pagos y transferencias. ¿Te gustaría conectarla también para la gestión financiera y el seguimiento de ingresos y gastos?",
80795
+ "Yes, add financial management": "Sí, añadir gestión financiera",
80796
+ "No, just transfers and payments": "No, solo transferencias y pagos",
80797
+ "Add transfers and payments?": "¿Añadir transferencias y pagos?",
80798
+ "You are connecting this account for financial management. Would you also like to connect it for transfers and payments to quickly move money to and from this institution?": "Estás conectando esta cuenta para la gestión financiera. ¿Te gustaría conectarla también para transferencias y pagos para transferir dinero rápidamente desde y hacia esta institución?",
80799
+ "Yes, add transfers and payments": "Sí, añadir transferencias y pagos",
80800
+ "No, just financial management": "No, sólo gestión financiera",
80801
+ "Select an account to connect": "Seleccione una cuenta para conectarse",
80562
80802
  "connect/disclosure/button\u0004Continue": "Continuar",
80563
80803
  "connect/disclosure/policy/text\u0004By clicking Continue, you agree to the ": "Al hacer clic en Continuar, tu aceptas la ",
80564
80804
  "connect/disclosure/policy/link\u0004MX Privacy Policy.": "Política de privacidad de Money Experience.",