@mxenabled/connect-widget 2.12.0 → 2.12.2

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
@@ -9051,7 +9051,8 @@ const configSlice = createSlice({
9051
9051
  name: "config",
9052
9052
  initialState: initialState$6,
9053
9053
  reducers: {
9054
- addVerificationData: (state) => {
9054
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
9055
+ addVerificationData: (state, _) => {
9055
9056
  if (state.mode === AGG_MODE) {
9056
9057
  state.include_transactions = true;
9057
9058
  }
@@ -9062,7 +9063,8 @@ const configSlice = createSlice({
9062
9063
  state.use_cases = ["MONEY_MOVEMENT"];
9063
9064
  }
9064
9065
  },
9065
- addAggregationData: (state) => {
9066
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
9067
+ addAggregationData: (state, _) => {
9066
9068
  state.include_transactions = true;
9067
9069
  if (Array.isArray(state.use_cases)) {
9068
9070
  state.use_cases.push("PFM");
@@ -9150,6 +9152,13 @@ const selectConnectConfig = createSelector(selectConfig, (config) => ({
9150
9152
  use_cases: config.use_cases,
9151
9153
  additional_product_option: config.additional_product_option
9152
9154
  }));
9155
+ const selectCurrentMode = createSelector(selectConfig, (config) => ({
9156
+ mode: config.mode,
9157
+ isInAggMode: config.mode === AGG_MODE,
9158
+ isInVerifyMode: config.mode === VERIFY_MODE,
9159
+ isInTaxMode: config.mode === TAX_MODE,
9160
+ isInRewardMode: config.mode === REWARD_MODE
9161
+ }));
9153
9162
  const selectColorScheme = (state) => state.config.color_scheme;
9154
9163
  const getIsLightColorScheme = createSelector(
9155
9164
  selectColorScheme,
@@ -54620,61 +54629,6 @@ GenericError.propTypes = {
54620
54629
  title: PropTypes$1.string.isRequired
54621
54630
  };
54622
54631
 
54623
- var assignValue = _assignValue, castPath$1 = _castPath, isIndex = _isIndex, isObject$1 = isObject_1, toKey = _toKey;
54624
- function baseSet$1(object, path, value, customizer) {
54625
- if (!isObject$1(object)) {
54626
- return object;
54627
- }
54628
- path = castPath$1(path, object);
54629
- var index = -1, length = path.length, lastIndex = length - 1, nested = object;
54630
- while (nested != null && ++index < length) {
54631
- var key = toKey(path[index]), newValue = value;
54632
- if (key === "__proto__" || key === "constructor" || key === "prototype") {
54633
- return object;
54634
- }
54635
- if (index != lastIndex) {
54636
- var objValue = nested[key];
54637
- newValue = customizer ? customizer(objValue, key, nested) : void 0;
54638
- if (newValue === void 0) {
54639
- newValue = isObject$1(objValue) ? objValue : isIndex(path[index + 1]) ? [] : {};
54640
- }
54641
- }
54642
- assignValue(nested, key, newValue);
54643
- nested = nested[key];
54644
- }
54645
- return object;
54646
- }
54647
- var _baseSet = baseSet$1;
54648
-
54649
- var baseGet = _baseGet, baseSet = _baseSet, castPath = _castPath;
54650
- function basePickBy$2(object, paths, predicate) {
54651
- var index = -1, length = paths.length, result = {};
54652
- while (++index < length) {
54653
- var path = paths[index], value = baseGet(object, path);
54654
- if (predicate(value, path)) {
54655
- baseSet(result, castPath(path, object), value);
54656
- }
54657
- }
54658
- return result;
54659
- }
54660
- var _basePickBy = basePickBy$2;
54661
-
54662
- var basePickBy$1 = _basePickBy, hasIn = hasIn_1;
54663
- function basePick$1(object, paths) {
54664
- return basePickBy$1(object, paths, function(value, path) {
54665
- return hasIn(object, path);
54666
- });
54667
- }
54668
- var _basePick = basePick$1;
54669
-
54670
- var basePick = _basePick, flatRest = _flatRest;
54671
- var pick = flatRest(function(object, paths) {
54672
- return object == null ? {} : basePick(object, paths);
54673
- });
54674
- var pick_1 = pick;
54675
-
54676
- const _pick = /*@__PURE__*/getDefaultExportFromCjs(pick_1);
54677
-
54678
54632
  var baseKeys = _baseKeys, getTag = _getTag, isArguments = isArguments_1, isArray$4 = isArray_1, isArrayLike$3 = isArrayLike_1, isBuffer = isBufferExports, isPrototype = _isPrototype, isTypedArray = isTypedArray_1;
54679
54633
  var mapTag = "[object Map]", setTag = "[object Set]";
54680
54634
  var objectProto$1 = Object.prototype;
@@ -62710,17 +62664,18 @@ const scrollToTop = (ref) => {
62710
62664
  return ref.current?.scrollIntoView(true);
62711
62665
  };
62712
62666
 
62713
- const Disclosure = React__default.forwardRef((props, disclosureRef) => {
62714
- const { mode, onContinue, size } = props;
62667
+ const Disclosure = React__default.forwardRef((_, disclosureRef) => {
62715
62668
  const containerRef = useRef(null);
62716
62669
  useAnalyticsPath(...PageviewInfo.CONNECT_DISCLOSURE);
62670
+ size === "small";
62717
62671
  const tokens = useTokens();
62718
62672
  const styles = getStyles$1C(tokens);
62719
62673
  const getNextDelay = getDelay();
62720
62674
  const [showPrivacyPolicy, setShowPrivacyPolicy] = useState(false);
62721
- const IS_IN_AGG_MODE = mode === AGG_MODE;
62722
- const IS_IN_TAX_MODE = mode === TAX_MODE;
62723
- const IS_IN_VERIFY_MODE = mode === VERIFY_MODE;
62675
+ const { isInAggMode, isInTaxMode, isInVerifyMode } = useSelector(selectCurrentMode);
62676
+ const connectConfig = useSelector(selectConnectConfig);
62677
+ const size = useSelector(getSize);
62678
+ const dispatch = useDispatch();
62724
62679
  useImperativeHandle(disclosureRef, () => {
62725
62680
  return {
62726
62681
  handleBackButton() {
@@ -62745,15 +62700,15 @@ const Disclosure = React__default.forwardRef((props, disclosureRef) => {
62745
62700
  "This app will have access to the information below unless you choose to disconnect:"
62746
62701
  ) }),
62747
62702
  /* @__PURE__ */ jsxRuntimeExports.jsxs("ul", { "data-test": "disclosure-list", style: styles.dataList, children: [
62748
- IS_IN_AGG_MODE && /* @__PURE__ */ jsxRuntimeExports.jsxs(Fragment, { children: [
62703
+ isInAggMode && /* @__PURE__ */ jsxRuntimeExports.jsxs(Fragment, { children: [
62749
62704
  /* @__PURE__ */ jsxRuntimeExports.jsx("li", { className: dist.css(styles.listItem), "data-test": "disclosure-agg-mode-list-item1", children: /* @__PURE__ */ jsxRuntimeExports.jsx(D, { truncate: false, variant: "Paragraph", children: __("Account details") }) }),
62750
62705
  /* @__PURE__ */ jsxRuntimeExports.jsx("li", { className: dist.css(styles.listItem), "data-test": "disclosure-agg-mode-list-item2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(D, { truncate: false, variant: "Paragraph", children: __("Account balances and transactions") }) })
62751
62706
  ] }),
62752
- IS_IN_TAX_MODE && /* @__PURE__ */ jsxRuntimeExports.jsxs(Fragment, { children: [
62707
+ isInTaxMode && /* @__PURE__ */ jsxRuntimeExports.jsxs(Fragment, { children: [
62753
62708
  /* @__PURE__ */ jsxRuntimeExports.jsx("li", { className: dist.css(styles.listItem), "data-test": "disclosure-tax-mode-list-item1", children: /* @__PURE__ */ jsxRuntimeExports.jsx(D, { truncate: false, variant: "Paragraph", children: __("Basic account information") }) }),
62754
62709
  /* @__PURE__ */ jsxRuntimeExports.jsx("li", { className: dist.css(styles.listItem), "data-test": "disclosure-tax-mode-list-item2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(D, { truncate: false, variant: "Paragraph", children: __("Tax documents") }) })
62755
62710
  ] }),
62756
- IS_IN_VERIFY_MODE && /* @__PURE__ */ jsxRuntimeExports.jsxs(Fragment, { children: [
62711
+ isInVerifyMode && /* @__PURE__ */ jsxRuntimeExports.jsxs(Fragment, { children: [
62757
62712
  /* @__PURE__ */ jsxRuntimeExports.jsx("li", { className: dist.css(styles.listItem), "data-test": "disclosure-ver-mode-list-item1", children: /* @__PURE__ */ jsxRuntimeExports.jsx(D, { truncate: false, variant: "Paragraph", children: __("Routing and account numbers") }) }),
62758
62713
  /* @__PURE__ */ jsxRuntimeExports.jsx("li", { className: dist.css(styles.listItem), "data-test": "disclosure-ver-mode-list-item2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(D, { truncate: false, variant: "Paragraph", children: __("Account balances") }) })
62759
62714
  ] })
@@ -62810,7 +62765,12 @@ const Disclosure = React__default.forwardRef((props, disclosureRef) => {
62810
62765
  {
62811
62766
  "data-test": "disclosure-continue",
62812
62767
  onClick: () => {
62813
- fadeOut(containerRef.current, "up", 300).then(() => onContinue());
62768
+ fadeOut(containerRef.current, "up", 300).then(
62769
+ () => dispatch({
62770
+ type: ActionTypes$2.ACCEPT_DISCLOSURE,
62771
+ payload: connectConfig
62772
+ })
62773
+ );
62814
62774
  },
62815
62775
  variant: "contained",
62816
62776
  children: _p("connect/disclosure/button", "Continue")
@@ -62874,11 +62834,6 @@ const getStyles$1C = (tokens) => {
62874
62834
  }
62875
62835
  };
62876
62836
  };
62877
- Disclosure.propTypes = {
62878
- mode: PropTypes$1.string.isRequired,
62879
- onContinue: PropTypes$1.func.isRequired,
62880
- size: PropTypes$1.string.isRequired
62881
- };
62882
62837
  Disclosure.displayName = "Disclosure";
62883
62838
 
62884
62839
  /******************************************************************************
@@ -64646,7 +64601,7 @@ var now$1 = function() {
64646
64601
  };
64647
64602
  var now_1 = now$1;
64648
64603
 
64649
- var isObject = isObject_1, now = now_1, toNumber = toNumber_1;
64604
+ var isObject$1 = isObject_1, now = now_1, toNumber = toNumber_1;
64650
64605
  var FUNC_ERROR_TEXT = "Expected a function";
64651
64606
  var nativeMax$2 = Math.max, nativeMin = Math.min;
64652
64607
  function debounce$1(func, wait, options) {
@@ -64655,7 +64610,7 @@ function debounce$1(func, wait, options) {
64655
64610
  throw new TypeError(FUNC_ERROR_TEXT);
64656
64611
  }
64657
64612
  wait = toNumber(wait) || 0;
64658
- if (isObject(options)) {
64613
+ if (isObject$1(options)) {
64659
64614
  leading = !!options.leading;
64660
64615
  maxing = "maxWait" in options;
64661
64616
  maxWait = maxing ? nativeMax$2(toNumber(options.maxWait) || 0, wait) : maxWait;
@@ -69741,6 +69696,153 @@ const INSTITUTION_TYPES = {
69741
69696
  const SEARCH_PER_PAGE_DEFAULT = 25;
69742
69697
  const SEARCH_PAGE_DEFAULT = 1;
69743
69698
 
69699
+ var assignValue = _assignValue, castPath$1 = _castPath, isIndex = _isIndex, isObject = isObject_1, toKey = _toKey;
69700
+ function baseSet$1(object, path, value, customizer) {
69701
+ if (!isObject(object)) {
69702
+ return object;
69703
+ }
69704
+ path = castPath$1(path, object);
69705
+ var index = -1, length = path.length, lastIndex = length - 1, nested = object;
69706
+ while (nested != null && ++index < length) {
69707
+ var key = toKey(path[index]), newValue = value;
69708
+ if (key === "__proto__" || key === "constructor" || key === "prototype") {
69709
+ return object;
69710
+ }
69711
+ if (index != lastIndex) {
69712
+ var objValue = nested[key];
69713
+ newValue = customizer ? customizer(objValue, key, nested) : void 0;
69714
+ if (newValue === void 0) {
69715
+ newValue = isObject(objValue) ? objValue : isIndex(path[index + 1]) ? [] : {};
69716
+ }
69717
+ }
69718
+ assignValue(nested, key, newValue);
69719
+ nested = nested[key];
69720
+ }
69721
+ return object;
69722
+ }
69723
+ var _baseSet = baseSet$1;
69724
+
69725
+ var baseGet = _baseGet, baseSet = _baseSet, castPath = _castPath;
69726
+ function basePickBy$2(object, paths, predicate) {
69727
+ var index = -1, length = paths.length, result = {};
69728
+ while (++index < length) {
69729
+ var path = paths[index], value = baseGet(object, path);
69730
+ if (predicate(value, path)) {
69731
+ baseSet(result, castPath(path, object), value);
69732
+ }
69733
+ }
69734
+ return result;
69735
+ }
69736
+ var _basePickBy = basePickBy$2;
69737
+
69738
+ var basePickBy$1 = _basePickBy, hasIn = hasIn_1;
69739
+ function basePick$1(object, paths) {
69740
+ return basePickBy$1(object, paths, function(value, path) {
69741
+ return hasIn(object, path);
69742
+ });
69743
+ }
69744
+ var _basePick = basePick$1;
69745
+
69746
+ var basePick = _basePick, flatRest = _flatRest;
69747
+ var pick = flatRest(function(object, paths) {
69748
+ return object == null ? {} : basePick(object, paths);
69749
+ });
69750
+ var pick_1 = pick;
69751
+
69752
+ const _pick = /*@__PURE__*/getDefaultExportFromCjs(pick_1);
69753
+
69754
+ const defaultApiValue = {
69755
+ // Accounts
69756
+ createAccount: () => Promise.resolve({}),
69757
+ // Members
69758
+ addMember: () => Promise.resolve({}),
69759
+ deleteMember: () => Promise.resolve(),
69760
+ getMemberCredentials: () => Promise.resolve([]),
69761
+ loadMemberByGuid: () => Promise.resolve({}),
69762
+ loadMembers: () => Promise.resolve([]),
69763
+ // Institutions
69764
+ getInstitutionCredentials: () => Promise.resolve([]),
69765
+ loadDiscoveredInstitutions: () => Promise.resolve([]),
69766
+ loadInstitutionByCode: () => Promise.resolve({}),
69767
+ loadInstitutions: () => Promise.resolve([]),
69768
+ loadInstitutionByGuid: () => Promise.resolve({}),
69769
+ loadPopularInstitutions: () => Promise.resolve([]),
69770
+ // Microdeposits
69771
+ createMicrodeposit: () => Promise.resolve({}),
69772
+ loadMicrodepositByGuid: () => Promise.resolve({}),
69773
+ refreshMicrodepositStatus: () => Promise.resolve(),
69774
+ updateMember: () => Promise.resolve({}),
69775
+ updateMFA: () => Promise.resolve({}),
69776
+ updateMicrodeposit: () => Promise.resolve({}),
69777
+ verifyMicrodeposit: () => Promise.resolve({}),
69778
+ verifyRoutingNumber: () => Promise.resolve({}),
69779
+ //OAuth
69780
+ loadOAuthState: () => Promise.resolve({}),
69781
+ loadOAuthStates: () => Promise.resolve([]),
69782
+ oAuthStart: () => Promise.resolve(),
69783
+ // Support
69784
+ createSupportTicket: () => Promise.resolve(),
69785
+ //Job
69786
+ loadJob: () => Promise.resolve({}),
69787
+ runJob: () => Promise.resolve({}),
69788
+ // User
69789
+ updateUserProfile: () => Promise.resolve({})
69790
+ };
69791
+ const ApiContext = React$1.createContext(defaultApiValue);
69792
+ const ApiProvider = ({ apiValue, children }) => {
69793
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(ApiContext.Provider, { value: { ...defaultApiValue, ...apiValue }, children });
69794
+ };
69795
+ const useApi = () => {
69796
+ const context = React$1.useContext(ApiContext);
69797
+ if (context === void 0) {
69798
+ throw new Error("useApi must be used within a ApiProvider");
69799
+ }
69800
+ return { api: context };
69801
+ };
69802
+
69803
+ const useSelectInstitution = () => {
69804
+ const { api } = useApi();
69805
+ const [institution, setInstitution] = useState(null);
69806
+ const dispatch = useDispatch();
69807
+ const consentIsEnabled = useSelector((state) => isConsentEnabled(state));
69808
+ const connectConfig = useSelector(selectConnectConfig);
69809
+ const handleSelectInstitution = useCallback(
69810
+ (institution2) => {
69811
+ setInstitution(institution2);
69812
+ },
69813
+ [institution]
69814
+ );
69815
+ useEffect(() => {
69816
+ if (!institution) return () => {
69817
+ };
69818
+ const selectInstitution$ = from(api.loadInstitutionByGuid(institution.guid)).pipe(
69819
+ map((insWithCreds) => {
69820
+ return dispatch({
69821
+ type: ActionTypes$2.SELECT_INSTITUTION_SUCCESS,
69822
+ payload: {
69823
+ institution: {
69824
+ ...insWithCreds,
69825
+ is_disabled_by_client: institutionIsBlockedForCostReasons(institution)
69826
+ // Temporary workaround till backend/core is fixed
69827
+ },
69828
+ consentIsEnabled: consentIsEnabled || false,
69829
+ additionalProductOption: connectConfig?.additional_product_option || null
69830
+ }
69831
+ });
69832
+ }),
69833
+ catchError((err) => {
69834
+ setInstitution(null);
69835
+ return of(selectInstitutionError(err));
69836
+ })
69837
+ ).subscribe((action) => {
69838
+ setInstitution(null);
69839
+ dispatch(action);
69840
+ });
69841
+ return () => selectInstitution$.unsubscribe();
69842
+ }, [institution]);
69843
+ return { handleSelectInstitution };
69844
+ };
69845
+
69744
69846
  const InstitutionGridTile = (props) => {
69745
69847
  const { institution, selectInstitution } = props;
69746
69848
  const tokens = useTokens();
@@ -69892,21 +69994,30 @@ InstituionGrid.propTypes = {
69892
69994
 
69893
69995
  const PopularInstitutionsList = (props) => {
69894
69996
  useAnalyticsPath(...PageviewInfo.CONNECT_SEARCH_POPULAR);
69895
- const {
69896
- institutions,
69897
- handleSelectInstitution,
69898
- onAddManualAccountClick,
69899
- onSearchInstitutionClick,
69900
- enableManualAccounts
69901
- } = props;
69997
+ const { handleSelectInstitution } = useSelectInstitution();
69998
+ const postMessage = useContext(PostMessageContext);
69999
+ const { institutions, onSearchInstitutionClick } = props;
69902
70000
  const getNextDelay = getDelay();
69903
70001
  const tokens = useTokens();
69904
70002
  const styles = getStyles$1q(tokens);
70003
+ const dispatch = useDispatch();
70004
+ const enableManualAccounts = useSelector((state) => {
70005
+ const isManualAccountsEnabled = state.profiles.widgetProfile?.enable_manual_accounts;
70006
+ const { isInAggMode } = selectCurrentMode(state);
70007
+ const hasAtriumAPI = state.profiles.client?.has_atrium_api;
70008
+ return isManualAccountsEnabled && isInAggMode && !hasAtriumAPI;
70009
+ });
69905
70010
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { style: styles.listContainer, children: [
69906
70011
  /* @__PURE__ */ jsxRuntimeExports.jsx(SlideDown, { delay: getNextDelay(), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
69907
70012
  InstituionGrid,
69908
70013
  {
69909
- handleSelectInstitution,
70014
+ handleSelectInstitution: (institution) => {
70015
+ postMessage.onPostMessage(
70016
+ "connect/selectedInstitution",
70017
+ _pick(institution, ["name", "guid", "url", "code"])
70018
+ );
70019
+ handleSelectInstitution(institution);
70020
+ },
69910
70021
  institutions: institutions.filter((institution) => !institution.is_disabled_by_client),
69911
70022
  posthogEvent: AnalyticEvents.SELECT_POPULAR_INSTITUTION
69912
70023
  }
@@ -69926,7 +70037,7 @@ const PopularInstitutionsList = (props) => {
69926
70037
  Button$2,
69927
70038
  {
69928
70039
  "data-test": "add-account-manually-button",
69929
- onClick: onAddManualAccountClick,
70040
+ onClick: () => dispatch(stepToAddManualAccount$1()),
69930
70041
  variant: "text",
69931
70042
  children: __("Add account manually")
69932
70043
  }
@@ -69974,10 +70085,7 @@ const getStyles$1q = (tokens) => {
69974
70085
  };
69975
70086
  };
69976
70087
  PopularInstitutionsList.propTypes = {
69977
- enableManualAccounts: PropTypes$1.bool.isRequired,
69978
- handleSelectInstitution: PropTypes$1.func.isRequired,
69979
70088
  institutions: PropTypes$1.array.isRequired,
69980
- onAddManualAccountClick: PropTypes$1.func.isRequired,
69981
70089
  onSearchInstitutionClick: PropTypes$1.func.isRequired
69982
70090
  };
69983
70091
 
@@ -70138,25 +70246,42 @@ InstitutionTile.propTypes = {
70138
70246
  const SearchedInstitutionsList = (props) => {
70139
70247
  useAnalyticsPath(...PageviewInfo.CONNECT_SEARCHED);
70140
70248
  const sendAnalyticsEvent = useAnalyticsEvent();
70249
+ const postMessage = useContext(PostMessageContext);
70141
70250
  const {
70142
70251
  currentSearchResults,
70143
- enableManualAccounts,
70144
- enableSupportRequests,
70145
70252
  institutions,
70146
70253
  institutionSearch,
70147
- isMicrodepositsEnabled,
70148
- handleSelectInstitution,
70149
- onAddManualAccountClick,
70150
70254
  onRequestInstitution,
70151
- onVerifyWithMicrodeposits,
70152
70255
  setAriaLiveRegionMessage
70153
70256
  } = props;
70154
70257
  const tokens = useTokens();
70155
70258
  const styles = getStyles$1o(tokens);
70156
70259
  const getNextDelay = getDelay();
70157
- const clientUsesOauth = useSelector((state) => state.profiles.clientProfile.uses_oauth ?? false);
70158
70260
  const [currentPage, setCurrentPage] = useState(SEARCH_PAGE_DEFAULT);
70159
70261
  const [isLoadingInstitutions, setIsLoadingInstitutions] = useState(false);
70262
+ const dispatch = useDispatch();
70263
+ const clientUsesOauth = useSelector((state) => state.profiles.clientProfile.uses_oauth ?? false);
70264
+ const enableManualAccounts = useSelector((state) => {
70265
+ const isManualAccountsEnabled = state.profiles.widgetProfile?.enable_manual_accounts;
70266
+ const { isInAggMode } = selectCurrentMode(state);
70267
+ const hasAtriumAPI = state.profiles.client?.has_atrium_api;
70268
+ return isManualAccountsEnabled && isInAggMode && !hasAtriumAPI;
70269
+ });
70270
+ const enableSupportRequests = useSelector((state) => {
70271
+ const isSupportEnabled = state.profiles.widgetProfile?.enable_support_requests;
70272
+ const { isInAggMode } = selectCurrentMode(state);
70273
+ return isSupportEnabled && isInAggMode;
70274
+ });
70275
+ const isMicrodepositsEnabled = useSelector((state) => {
70276
+ const { isVerifyMode } = selectCurrentMode(state);
70277
+ const clientProfile = state.profiles.clientProfile || {};
70278
+ const widgetProfile = state.profiles.widgetProfile || {};
70279
+ return isVerifyMode && // Widget is in Verify Mode
70280
+ clientProfile.account_verification_is_enabled && // Client supports verification
70281
+ clientProfile.is_microdeposits_enabled && // Client supports MDV
70282
+ widgetProfile.show_microdeposits_in_connect;
70283
+ });
70284
+ const { handleSelectInstitution } = useSelectInstitution();
70160
70285
  const shouldShowLoadMore = !!currentSearchResults.length && !isLoadingInstitutions;
70161
70286
  useEffect(() => {
70162
70287
  setAriaLiveRegionMessage(
@@ -70194,6 +70319,10 @@ const SearchedInstitutionsList = (props) => {
70194
70319
  institution_guid: institution.guid,
70195
70320
  institution_name: institution.name
70196
70321
  });
70322
+ postMessage.onPostMessage(
70323
+ "connect/selectedInstitution",
70324
+ _pick(institution, ["name", "guid", "url", "code"])
70325
+ );
70197
70326
  handleSelectInstitution(institution);
70198
70327
  },
70199
70328
  size: 48
@@ -70219,7 +70348,7 @@ const SearchedInstitutionsList = (props) => {
70219
70348
  Button$2,
70220
70349
  {
70221
70350
  "data-test": "add-account-manually-button",
70222
- onClick: onAddManualAccountClick,
70351
+ onClick: () => dispatch(stepToAddManualAccount$1()),
70223
70352
  variant: "text",
70224
70353
  children: __("Add account manually")
70225
70354
  }
@@ -70237,7 +70366,7 @@ const SearchedInstitutionsList = (props) => {
70237
70366
  Button$2,
70238
70367
  {
70239
70368
  "data-test": "connect-account-numbers-button",
70240
- onClick: onVerifyWithMicrodeposits,
70369
+ onClick: () => dispatch(stepToMicrodeposits$1()),
70241
70370
  variant: "text",
70242
70371
  children: __("Connect with account numbers")
70243
70372
  }
@@ -70278,32 +70407,39 @@ const getStyles$1o = (tokens) => {
70278
70407
  };
70279
70408
  SearchedInstitutionsList.propTypes = {
70280
70409
  currentSearchResults: PropTypes$1.array.isRequired,
70281
- enableManualAccounts: PropTypes$1.bool.isRequired,
70282
- enableSupportRequests: PropTypes$1.bool.isRequired,
70283
- handleSelectInstitution: PropTypes$1.func.isRequired,
70284
70410
  institutions: PropTypes$1.array.isRequired,
70285
70411
  institutionSearch: PropTypes$1.func.isRequired,
70286
- isMicrodepositsEnabled: PropTypes$1.bool.isRequired,
70287
- onAddManualAccountClick: PropTypes$1.func.isRequired,
70288
70412
  onRequestInstitution: PropTypes$1.func.isRequired,
70289
- onVerifyWithMicrodeposits: PropTypes$1.func.isRequired,
70290
70413
  setAriaLiveRegionMessage: PropTypes$1.func.isRequired
70291
70414
  };
70292
70415
 
70293
70416
  const SearchNoResult = (props) => {
70294
70417
  useAnalyticsPath(...PageviewInfo.CONNECT_SEARCH_NO_RESULTS, { search_term: props.searchTerm });
70295
- const {
70296
- enableManualAccounts,
70297
- enableSupportRequests,
70298
- isMicrodepositsEnabled,
70299
- onAddManualAccountClick,
70300
- onRequestInstitution,
70301
- onVerifyWithMicrodeposits,
70302
- setAriaLiveRegionMessage
70303
- } = props;
70418
+ const { onRequestInstitution, setAriaLiveRegionMessage } = props;
70304
70419
  const timerRef = useRef(null);
70305
70420
  const tokens = useTokens();
70306
70421
  const styles = getStyles$1n(tokens);
70422
+ const dispatch = useDispatch();
70423
+ const enableManualAccounts = useSelector((state) => {
70424
+ const isManualAccountsEnabled = state.profiles.widgetProfile?.enable_manual_accounts;
70425
+ const { isInAggMode } = selectCurrentMode(state);
70426
+ const hasAtriumAPI = state.profiles.client?.has_atrium_api;
70427
+ return isManualAccountsEnabled && isInAggMode && !hasAtriumAPI;
70428
+ });
70429
+ const enableSupportRequests = useSelector((state) => {
70430
+ const isSupportEnabled = state.profiles.widgetProfile?.enable_support_requests;
70431
+ const { isInAggMode } = selectCurrentMode(state);
70432
+ return isSupportEnabled && isInAggMode;
70433
+ });
70434
+ const isMicrodepositsEnabled = useSelector((state) => {
70435
+ const { isVerifyMode } = selectCurrentMode(state);
70436
+ const clientProfile = state.profiles.clientProfile || {};
70437
+ const widgetProfile = state.profiles.widgetProfile || {};
70438
+ return isVerifyMode && // Widget is in Verify Mode
70439
+ clientProfile.account_verification_is_enabled && // Client supports verification
70440
+ clientProfile.is_microdeposits_enabled && // Client supports MDV
70441
+ widgetProfile.show_microdeposits_in_connect;
70442
+ });
70307
70443
  useEffect(() => {
70308
70444
  timerRef.current = setTimeout(() => {
70309
70445
  setAriaLiveRegionMessage(__("No results found for ”%1”", props.searchTerm));
@@ -70342,7 +70478,7 @@ const SearchNoResult = (props) => {
70342
70478
  Button$2,
70343
70479
  {
70344
70480
  "data-test": "add-account-manually-button",
70345
- onClick: onAddManualAccountClick,
70481
+ onClick: () => dispatch(stepToAddManualAccount$1()),
70346
70482
  variant: "text",
70347
70483
  children: __("Add account manually")
70348
70484
  }
@@ -70360,7 +70496,7 @@ const SearchNoResult = (props) => {
70360
70496
  Button$2,
70361
70497
  {
70362
70498
  "data-test": "connect-account-numbers-button",
70363
- onClick: onVerifyWithMicrodeposits,
70499
+ onClick: () => dispatch(stepToMicrodeposits$1()),
70364
70500
  variant: "text",
70365
70501
  children: __("Connect with account numbers")
70366
70502
  }
@@ -70394,12 +70530,7 @@ const getStyles$1n = (tokens) => {
70394
70530
  };
70395
70531
  };
70396
70532
  SearchNoResult.propTypes = {
70397
- enableManualAccounts: PropTypes$1.bool.isRequired,
70398
- enableSupportRequests: PropTypes$1.bool.isRequired,
70399
- isMicrodepositsEnabled: PropTypes$1.bool.isRequired,
70400
- onAddManualAccountClick: PropTypes$1.func.isRequired,
70401
70533
  onRequestInstitution: PropTypes$1.func.isRequired,
70402
- onVerifyWithMicrodeposits: PropTypes$1.func.isRequired,
70403
70534
  searchTerm: PropTypes$1.string.isRequired,
70404
70535
  setAriaLiveRegionMessage: PropTypes$1.func.isRequired
70405
70536
  };
@@ -72103,55 +72234,6 @@ const useForm = (submitCallback, formSchema, initialValues) => {
72103
72234
  };
72104
72235
  };
72105
72236
 
72106
- const defaultApiValue = {
72107
- // Accounts
72108
- createAccount: () => Promise.resolve({}),
72109
- // Members
72110
- addMember: () => Promise.resolve({}),
72111
- deleteMember: () => Promise.resolve(),
72112
- getMemberCredentials: () => Promise.resolve([]),
72113
- loadMemberByGuid: () => Promise.resolve({}),
72114
- loadMembers: () => Promise.resolve([]),
72115
- // Institutions
72116
- getInstitutionCredentials: () => Promise.resolve([]),
72117
- loadDiscoveredInstitutions: () => Promise.resolve([]),
72118
- loadInstitutionByCode: () => Promise.resolve({}),
72119
- loadInstitutions: () => Promise.resolve([]),
72120
- loadInstitutionByGuid: () => Promise.resolve({}),
72121
- loadPopularInstitutions: () => Promise.resolve([]),
72122
- // Microdeposits
72123
- createMicrodeposit: () => Promise.resolve({}),
72124
- loadMicrodepositByGuid: () => Promise.resolve({}),
72125
- refreshMicrodepositStatus: () => Promise.resolve(),
72126
- updateMember: () => Promise.resolve({}),
72127
- updateMFA: () => Promise.resolve({}),
72128
- updateMicrodeposit: () => Promise.resolve({}),
72129
- verifyMicrodeposit: () => Promise.resolve({}),
72130
- verifyRoutingNumber: () => Promise.resolve({}),
72131
- //OAuth
72132
- loadOAuthState: () => Promise.resolve({}),
72133
- loadOAuthStates: () => Promise.resolve([]),
72134
- oAuthStart: () => Promise.resolve(),
72135
- // Support
72136
- createSupportTicket: () => Promise.resolve(),
72137
- //Job
72138
- loadJob: () => Promise.resolve({}),
72139
- runJob: () => Promise.resolve({}),
72140
- // User
72141
- updateUserProfile: () => Promise.resolve({})
72142
- };
72143
- const ApiContext = React$1.createContext(defaultApiValue);
72144
- const ApiProvider = ({ apiValue, children }) => {
72145
- return /* @__PURE__ */ jsxRuntimeExports.jsx(ApiContext.Provider, { value: { ...defaultApiValue, ...apiValue }, children });
72146
- };
72147
- const useApi = () => {
72148
- const context = React$1.useContext(ApiContext);
72149
- if (context === void 0) {
72150
- throw new Error("useApi must be used within a ApiProvider");
72151
- }
72152
- return { api: context };
72153
- };
72154
-
72155
72237
  const RequiredFieldNote = ({ styles }) => {
72156
72238
  const requiredFieldNoteColor = "#666";
72157
72239
  const asteriskColor = "#E32727";
@@ -72849,29 +72931,24 @@ const reducer$4 = (state, action) => {
72849
72931
  return state;
72850
72932
  }
72851
72933
  };
72852
- const Search$2 = React__default.forwardRef((props, navigationRef) => {
72934
+ const Search$2 = React__default.forwardRef((_, navigationRef) => {
72853
72935
  useAnalyticsPath(...PageviewInfo.CONNECT_SEARCH, {}, false);
72854
72936
  const [state, dispatch] = useReducer(reducer$4, initialState$1);
72855
72937
  const [ariaLiveRegionMessage, setAriaLiveRegionMessage] = useState("");
72856
72938
  const searchInput = useRef("");
72857
72939
  const supportNavRef = useRef(null);
72858
- const reduxDispatch = useDispatch();
72859
72940
  const sendAnalyticsEvent = useAnalyticsEvent();
72860
72941
  const postMessageFunctions = useContext(PostMessageContext);
72861
72942
  const { api } = useApi();
72862
- const {
72863
- connectConfig,
72864
- connectedMembers,
72865
- enableManualAccounts,
72866
- enableSupportRequests,
72867
- onAddManualAccountClick,
72868
- onInstitutionSelect,
72869
- usePopularOnly,
72870
- isMicrodepositsEnabled,
72871
- stepToMicrodeposits
72872
- } = props;
72943
+ const reduxDispatch = useDispatch();
72944
+ const connectConfig = useSelector(selectConnectConfig);
72945
+ const connectedMembers = useSelector(getMembers);
72946
+ const usePopularOnly = useSelector((state2) => {
72947
+ const clientProfile = state2.profiles.clientProfile || {};
72948
+ const client = state2.profiles.client || {};
72949
+ return (clientProfile.uses_custom_popular_institution_list ?? false) || (client.has_limited_institutions ?? false);
72950
+ });
72873
72951
  const MINIMUM_SEARCH_LENGTH = 2;
72874
- const mode = connectConfig.mode;
72875
72952
  const isFirstTimeUser = connectedMembers.length === 0;
72876
72953
  useImperativeHandle(navigationRef, () => {
72877
72954
  return {
@@ -72983,7 +73060,7 @@ const Search$2 = React__default.forwardRef((props, navigationRef) => {
72983
73060
  return;
72984
73061
  }
72985
73062
  sendAnalyticsEvent(AnalyticEvents.SEARCH_QUERY, {
72986
- mode,
73063
+ mode: connectConfig.mode,
72987
73064
  search_term: value
72988
73065
  });
72989
73066
  postMessageFunctions.onPostMessage("connect/institutionSearch", { query: value });
@@ -73064,14 +73141,9 @@ const Search$2 = React__default.forwardRef((props, navigationRef) => {
73064
73141
  state.currentView === SEARCH_VIEWS.NO_RESULTS && /* @__PURE__ */ jsxRuntimeExports.jsx(
73065
73142
  SearchNoResult,
73066
73143
  {
73067
- enableManualAccounts,
73068
- enableSupportRequests,
73069
- isMicrodepositsEnabled,
73070
- onAddManualAccountClick,
73071
73144
  onRequestInstitution: () => {
73072
73145
  dispatch({ type: SEARCH_ACTIONS.SHOW_SUPPORT });
73073
73146
  },
73074
- onVerifyWithMicrodeposits: stepToMicrodeposits,
73075
73147
  searchTerm: state.searchTerm,
73076
73148
  setAriaLiveRegionMessage
73077
73149
  }
@@ -73081,31 +73153,22 @@ const Search$2 = React__default.forwardRef((props, navigationRef) => {
73081
73153
  SearchedInstitutionsList,
73082
73154
  {
73083
73155
  currentSearchResults: state.currentSearchResults,
73084
- enableManualAccounts,
73085
- enableSupportRequests,
73086
- handleSelectInstitution: onInstitutionSelect,
73087
73156
  institutionSearch,
73088
73157
  institutions: state.searchedInstitutions,
73089
- isMicrodepositsEnabled,
73090
- onAddManualAccountClick,
73091
73158
  onRequestInstitution: () => {
73092
73159
  dispatch({ type: SEARCH_ACTIONS.SHOW_SUPPORT });
73093
73160
  },
73094
- onVerifyWithMicrodeposits: stepToMicrodeposits,
73095
73161
  setAriaLiveRegionMessage
73096
73162
  }
73097
73163
  ),
73098
73164
  state.currentView === SEARCH_VIEWS.POPULAR && /* @__PURE__ */ jsxRuntimeExports.jsx(
73099
73165
  PopularInstitutionsList,
73100
73166
  {
73101
- enableManualAccounts,
73102
- handleSelectInstitution: onInstitutionSelect,
73103
73167
  institutions: usePopularOnly ? state.popularInstitutions : getSuggestedInstitutions(
73104
73168
  state.popularInstitutions,
73105
73169
  state.discoveredInstitutions,
73106
73170
  connectedMembers
73107
73171
  ),
73108
- onAddManualAccountClick,
73109
73172
  onSearchInstitutionClick: () => searchInput.current.focus()
73110
73173
  }
73111
73174
  ),
@@ -73137,17 +73200,6 @@ const getStyles$19 = (tokens) => {
73137
73200
  }
73138
73201
  };
73139
73202
  };
73140
- Search$2.propTypes = {
73141
- connectConfig: PropTypes$1.object.isRequired,
73142
- connectedMembers: PropTypes$1.array.isRequired,
73143
- enableManualAccounts: PropTypes$1.bool,
73144
- enableSupportRequests: PropTypes$1.bool,
73145
- isMicrodepositsEnabled: PropTypes$1.bool,
73146
- onAddManualAccountClick: PropTypes$1.func.isRequired,
73147
- onInstitutionSelect: PropTypes$1.func.isRequired,
73148
- stepToMicrodeposits: PropTypes$1.func.isRequired,
73149
- usePopularOnly: PropTypes$1.bool
73150
- };
73151
73203
  Search$2.displayName = "Search";
73152
73204
  const applyConnectConfigToSearchQuery = (connectConfig, queryObject) => {
73153
73205
  if (connectConfig.iso_country_code) {
@@ -76186,7 +76238,7 @@ const DEFAULT_POLLING_STATE = {
76186
76238
  initialDataReady: false
76187
76239
  // whether the initial data ready event has been sent
76188
76240
  };
76189
- function pollMember(memberGuid, api, clientLocale) {
76241
+ function pollMember(memberGuid, api, clientLocale, clientGuid = null) {
76190
76242
  return interval(3e3).pipe(
76191
76243
  switchMap(
76192
76244
  () => (
@@ -76217,7 +76269,8 @@ function pollMember(memberGuid, api, clientLocale) {
76217
76269
  // preserve the initialDataReadySent flag
76218
76270
  initialDataReady: acc.initialDataReady
76219
76271
  };
76220
- if (!isError && !acc.initialDataReady && response?.job?.async_account_data_ready) {
76272
+ const excludedClients = ["CLT-64ff7421-a8ef-4ac0-90f1-1636eda1a1fd"];
76273
+ if (!isError && !acc.initialDataReady && response?.job?.async_account_data_ready && !excludedClients.includes(clientGuid)) {
76221
76274
  pollingState.initialDataReady = true;
76222
76275
  }
76223
76276
  const [shouldStopPolling, messageKey] = handlePollingResponse(pollingState);
@@ -78739,6 +78792,7 @@ const Connecting = (props) => {
78739
78792
  onUpsertMember
78740
78793
  } = props;
78741
78794
  const selectedInstitution = useSelector(getSelectedInstitution);
78795
+ const clientGuid = useSelector(getClientGuid);
78742
78796
  const sendAnalyticsEvent = useAnalyticsEvent();
78743
78797
  const clientLocale = useMemo(() => {
78744
78798
  return document.querySelector("html")?.getAttribute("lang") || "en";
@@ -78889,7 +78943,7 @@ const Connecting = (props) => {
78889
78943
  return needsJobStarted ? startJob$ : of(currentMember);
78890
78944
  }).pipe(
78891
78945
  concatMap(
78892
- (member) => pollMember(member.guid, api, clientLocale).pipe(
78946
+ (member) => pollMember(member.guid, api, clientLocale, clientGuid).pipe(
78893
78947
  tap((pollingState) => handleMemberPoll(pollingState)),
78894
78948
  filter((pollingState) => pollingState.pollingIsDone),
78895
78949
  pluck("currentResponse"),
@@ -84303,6 +84357,7 @@ const ManualAccountConnect = React__default.forwardRef((props, ref) => {
84303
84357
  const formRef = useRef(null);
84304
84358
  const menuRef = useRef(null);
84305
84359
  const postMessageFunctions = useContext(PostMessageContext);
84360
+ const reduxDispatch = useDispatch();
84306
84361
  const [showDayPicker, setShowDayPicker] = useState(false);
84307
84362
  const [state, dispatch] = useReducer(reducer$1, {
84308
84363
  showForm: false,
@@ -84311,6 +84366,7 @@ const ManualAccountConnect = React__default.forwardRef((props, ref) => {
84311
84366
  accountType: props.availableAccountTypes?.length === 1 ? props.availableAccountTypes[0] : null,
84312
84367
  validationErrors: {}
84313
84368
  });
84369
+ const initialConfig = useSelector(selectInitialConfig);
84314
84370
  useImperativeHandle(ref, () => {
84315
84371
  return {
84316
84372
  handleBackButton() {
@@ -84335,7 +84391,10 @@ const ManualAccountConnect = React__default.forwardRef((props, ref) => {
84335
84391
  };
84336
84392
  const handleGoBackClick = () => {
84337
84393
  postMessageFunctions.onPostMessage(POST_MESSAGES.BACK_TO_SEARCH);
84338
- props.onClose();
84394
+ reduxDispatch({
84395
+ type: ActionTypes$2.GO_BACK_MANUAL_ACCOUNT,
84396
+ payload: initialConfig
84397
+ });
84339
84398
  };
84340
84399
  if (state.showSuccess) {
84341
84400
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -84343,7 +84402,10 @@ const ManualAccountConnect = React__default.forwardRef((props, ref) => {
84343
84402
  {
84344
84403
  accountType: state.accountType,
84345
84404
  handleDone: () => {
84346
- props.onClose();
84405
+ reduxDispatch({
84406
+ type: ActionTypes$2.GO_BACK_MANUAL_ACCOUNT,
84407
+ payload: initialConfig
84408
+ });
84347
84409
  },
84348
84410
  onManualAccountAdded: props.onManualAccountAdded
84349
84411
  }
@@ -84374,7 +84436,6 @@ const ManualAccountConnect = React__default.forwardRef((props, ref) => {
84374
84436
  });
84375
84437
  ManualAccountConnect.propTypes = {
84376
84438
  availableAccountTypes: PropTypes$1.array,
84377
- onClose: PropTypes$1.func.isRequired,
84378
84439
  onManualAccountAdded: PropTypes$1.func
84379
84440
  };
84380
84441
  ManualAccountConnect.displayName = "ManualAccountConnect";
@@ -84412,129 +84473,86 @@ const ADDITIONAL_PRODUCT_OPTIONS = [
84412
84473
  COMBO_JOB_DATA_TYPES.TRANSACTIONS,
84413
84474
  COMBO_JOB_DATA_TYPES.ACCOUNT_NUMBER
84414
84475
  ];
84415
- const AdditionalProductStep = React__default.forwardRef(
84416
- ({
84417
- additionalProductName,
84418
- onNoClick = () => {
84419
- throw new Error("onNoClick not implemented");
84420
- },
84421
- onYesClick = () => {
84422
- throw new Error("onYesClick not implemented");
84423
- }
84424
- }, navigationRef) => {
84425
- const selectedInstitution = useSelector(getSelectedInstitution);
84426
- const { add_aggregation = {}, add_verification = {} } = useSelector(selectLocalizedContent)?.connect?.additional_product_screen || {};
84427
- useImperativeHandle(navigationRef, () => {
84428
- return {
84429
- showBackButton() {
84430
- return true;
84431
- }
84432
- };
84433
- }, []);
84434
- const getNextDelay = getDelay();
84435
- const addAggregationText = {
84436
- title: add_aggregation?.title || __("Add financial management?"),
84437
- body: add_aggregation?.body || __(
84438
- "You're connecting this account for payments and transfers. Would you like to also enable financial management so you can track your income and spending?"
84439
- ),
84440
- acceptButtonText: add_aggregation?.button_1 || __("Yes, add financial management"),
84441
- rejectButtonText: add_aggregation?.button_2 || __("No, only add transfers and payments")
84442
- };
84443
- const addVerificationText = {
84444
- title: add_verification?.title || __("Add transfers and payments?"),
84445
- body: add_verification?.body || __(
84446
- "You're connecting this account for financial management. Would you like to also enable transfers and payments so you can quickly move money to and from this institution?"
84447
- ),
84448
- acceptButtonText: add_verification?.button_1 || __("Yes, add transfers and payments"),
84449
- rejectButtonText: add_verification?.button_2 || __("No, only add financial management")
84450
- };
84451
- const componentText = additionalProductName === COMBO_JOB_DATA_TYPES.TRANSACTIONS ? addAggregationText : addVerificationText;
84452
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(SlideDown, { delay: getNextDelay(), children: [
84453
- /* @__PURE__ */ jsxRuntimeExports.jsx(InstitutionBlock, { institution: selectedInstitution, style: { marginBottom: 24 } }),
84454
- /* @__PURE__ */ jsxRuntimeExports.jsx(
84455
- D,
84456
- {
84457
- component: "h2",
84458
- "data-test": "additional-product__title-text",
84459
- style: { marginBottom: 12 },
84460
- truncate: false,
84461
- variant: "H2",
84462
- children: componentText.title
84463
- }
84464
- ),
84465
- /* @__PURE__ */ jsxRuntimeExports.jsx(D, { component: "p", style: { marginBottom: 32 }, truncate: false, variant: "Paragraph", children: componentText.body }),
84466
- /* @__PURE__ */ jsxRuntimeExports.jsx(
84467
- Button$2,
84468
- {
84469
- "data-test": "additional-product__accept-button",
84470
- fullWidth: true,
84471
- onClick: () => {
84472
- onYesClick();
84473
- },
84474
- style: { marginBottom: 8 },
84475
- variant: "contained",
84476
- children: componentText.acceptButtonText
84477
- }
84478
- ),
84479
- /* @__PURE__ */ jsxRuntimeExports.jsx(
84480
- Button$2,
84481
- {
84482
- "data-test": "additional-product__reject-button",
84483
- fullWidth: true,
84484
- onClick: () => {
84485
- onNoClick();
84486
- },
84487
- variant: "text",
84488
- children: componentText.rejectButtonText
84489
- }
84490
- )
84491
- ] });
84492
- }
84493
- );
84494
- AdditionalProductStep.displayName = "AdditionalProductStep";
84495
-
84496
- const useSelectInstitution = () => {
84497
- const { api } = useApi();
84498
- const [institution, setInstitution] = useState(null);
84476
+ const AdditionalProductStep = React__default.forwardRef((_, navigationRef) => {
84499
84477
  const dispatch = useDispatch();
84500
- const consentIsEnabled = useSelector((state) => isConsentEnabled(state));
84501
84478
  const connectConfig = useSelector(selectConnectConfig);
84502
- const handleSelectInstitution = useCallback(
84503
- (institution2) => {
84504
- setInstitution(institution2);
84505
- },
84506
- [institution]
84507
- );
84508
- useEffect(() => {
84509
- if (!institution) return () => {
84479
+ const selectedInstitution = useSelector(getSelectedInstitution);
84480
+ const consentIsEnabled = useSelector(isConsentEnabled);
84481
+ const { add_aggregation = {}, add_verification = {} } = useSelector(selectLocalizedContent)?.connect?.additional_product_screen || {};
84482
+ useImperativeHandle(navigationRef, () => {
84483
+ return {
84484
+ showBackButton() {
84485
+ return true;
84486
+ }
84510
84487
  };
84511
- const selectInstitution$ = from(api.loadInstitutionByGuid(institution.guid)).pipe(
84512
- map((insWithCreds) => {
84513
- return dispatch({
84514
- type: ActionTypes$2.SELECT_INSTITUTION_SUCCESS,
84515
- payload: {
84516
- institution: {
84517
- ...insWithCreds,
84518
- is_disabled_by_client: institutionIsBlockedForCostReasons(institution)
84519
- // Temporary workaround till backend/core is fixed
84520
- },
84521
- consentIsEnabled: consentIsEnabled || false,
84522
- additionalProductOption: connectConfig?.additional_product_option || null
84523
- }
84524
- });
84525
- }),
84526
- catchError((err) => {
84527
- setInstitution(null);
84528
- return of(selectInstitutionError(err));
84529
- })
84530
- ).subscribe((action) => {
84531
- setInstitution(null);
84532
- dispatch(action);
84533
- });
84534
- return () => selectInstitution$.unsubscribe();
84535
- }, [institution]);
84536
- return { handleSelectInstitution };
84537
- };
84488
+ }, []);
84489
+ const getNextDelay = getDelay();
84490
+ const addAggregationText = {
84491
+ title: add_aggregation?.title || __("Add financial management?"),
84492
+ body: add_aggregation?.body || __(
84493
+ "You're connecting this account for payments and transfers. Would you like to also enable financial management so you can track your income and spending?"
84494
+ ),
84495
+ acceptButtonText: add_aggregation?.button_1 || __("Yes, add financial management"),
84496
+ rejectButtonText: add_aggregation?.button_2 || __("No, only add transfers and payments")
84497
+ };
84498
+ const addVerificationText = {
84499
+ title: add_verification?.title || __("Add transfers and payments?"),
84500
+ body: add_verification?.body || __(
84501
+ "You're connecting this account for financial management. Would you like to also enable transfers and payments so you can quickly move money to and from this institution?"
84502
+ ),
84503
+ acceptButtonText: add_verification?.button_1 || __("Yes, add transfers and payments"),
84504
+ rejectButtonText: add_verification?.button_2 || __("No, only add financial management")
84505
+ };
84506
+ const componentText = connectConfig.additional_product_option === COMBO_JOB_DATA_TYPES.TRANSACTIONS ? addAggregationText : addVerificationText;
84507
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(SlideDown, { delay: getNextDelay(), children: [
84508
+ /* @__PURE__ */ jsxRuntimeExports.jsx(InstitutionBlock, { institution: selectedInstitution, style: { marginBottom: 24 } }),
84509
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
84510
+ D,
84511
+ {
84512
+ component: "h2",
84513
+ "data-test": "additional-product__title-text",
84514
+ style: { marginBottom: 12 },
84515
+ truncate: false,
84516
+ variant: "H2",
84517
+ children: componentText.title
84518
+ }
84519
+ ),
84520
+ /* @__PURE__ */ jsxRuntimeExports.jsx(D, { component: "p", style: { marginBottom: 32 }, truncate: false, variant: "Paragraph", children: componentText.body }),
84521
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
84522
+ Button$2,
84523
+ {
84524
+ "data-test": "additional-product__accept-button",
84525
+ fullWidth: true,
84526
+ onClick: () => {
84527
+ dispatch(
84528
+ connectConfig?.additional_product_option === COMBO_JOB_DATA_TYPES.ACCOUNT_NUMBER ? addVerificationData({ consentIsEnabled }) : addAggregationData({ consentIsEnabled })
84529
+ );
84530
+ },
84531
+ style: { marginBottom: 8 },
84532
+ variant: "contained",
84533
+ children: componentText.acceptButtonText
84534
+ }
84535
+ ),
84536
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
84537
+ Button$2,
84538
+ {
84539
+ "data-test": "additional-product__reject-button",
84540
+ fullWidth: true,
84541
+ onClick: () => {
84542
+ dispatch({
84543
+ type: ActionTypes$2.REJECT_ADDITIONAL_PRODUCT,
84544
+ payload: {
84545
+ consentIsEnabled
84546
+ }
84547
+ });
84548
+ },
84549
+ variant: "text",
84550
+ children: componentText.rejectButtonText
84551
+ }
84552
+ )
84553
+ ] });
84554
+ });
84555
+ AdditionalProductStep.displayName = "AdditionalProductStep";
84538
84556
 
84539
84557
  const getConsentDataClusters = () => {
84540
84558
  const dataClusters = {
@@ -84714,13 +84732,14 @@ const getStyles$8 = () => {
84714
84732
  };
84715
84733
 
84716
84734
  const DynamicDisclosure = React__default.forwardRef(
84717
- ({ onConsentClick, onGoBackClick }, navigationRef) => {
84735
+ ({ onGoBackClick }, navigationRef) => {
84718
84736
  const [name, path] = PageviewInfo.CONNECT_DYNAMIC_DISCLOSURE;
84719
84737
  useAnalyticsPath(name, path);
84720
84738
  const containerRef = useRef(null);
84721
84739
  const tokens = J0();
84722
84740
  const styles = getStyles$7(tokens);
84723
84741
  const getNextDelay = getDelay();
84742
+ const dispatch = useDispatch();
84724
84743
  const institution = useSelector((state) => state.connect.selectedInstitution);
84725
84744
  const appName = useSelector((state) => state.profiles.client.oauth_app_name || null);
84726
84745
  const [dialogIsOpen, setDialogIsOpen] = React__default.useState(false);
@@ -84794,7 +84813,7 @@ const DynamicDisclosure = React__default.forwardRef(
84794
84813
  if (["es", "fr-ca"].includes(initialLocal) && initialLocal !== getLocale()) {
84795
84814
  setLocale(initialLocal);
84796
84815
  }
84797
- onConsentClick();
84816
+ dispatch({ type: ActionTypes$2.USER_CONSENTED });
84798
84817
  },
84799
84818
  sx: styles.button,
84800
84819
  variant: "contained",
@@ -84953,7 +84972,6 @@ const RenderConnectStep = (props) => {
84953
84972
  const selectedInstitution = useSelector(getSelectedInstitution);
84954
84973
  const updateCredentials = useSelector((state) => state.connect.updateCredentials);
84955
84974
  const verifyMemberError = useSelector((state) => state.connect.error);
84956
- const consentIsEnabled = useSelector((state) => isConsentEnabled(state));
84957
84975
  const { handleSelectInstitution } = useSelectInstitution();
84958
84976
  const dispatch = useDispatch();
84959
84977
  const tokens = useTokens();
@@ -84964,100 +84982,32 @@ const RenderConnectStep = (props) => {
84964
84982
  clientProfile.is_microdeposits_enabled && // Client supports MDV
84965
84983
  widgetProfile.show_microdeposits_in_connect;
84966
84984
  const hasAtriumAPI = client.has_atrium_api;
84967
- const isManualAccountsEnabled = widgetProfile.enable_manual_accounts && mode === AGG_MODE && !hasAtriumAPI;
84968
84985
  const showSupport = widgetProfile.enable_support_requests && mode === AGG_MODE;
84969
- const usePopularOnly = (clientProfile.uses_custom_popular_institution_list ?? false) || (client.has_limited_institutions ?? false);
84970
84986
  const isDeleteInstitutionOptionEnabled = widgetProfile?.display_delete_option_in_connect ?? true;
84971
- const handleInstitutionSelect = (institution) => {
84972
- postMessageFunctions.onPostMessage(
84973
- "connect/selectedInstitution",
84974
- _pick(institution, ["name", "guid", "url", "code"])
84975
- );
84976
- handleSelectInstitution(institution);
84977
- };
84978
84987
  let connectStepView = null;
84979
84988
  if (step === STEPS.DISCLOSURE) {
84980
- connectStepView = /* @__PURE__ */ jsxRuntimeExports.jsx(
84981
- Disclosure,
84982
- {
84983
- mode,
84984
- onContinue: () => dispatch({ type: ActionTypes$2.ACCEPT_DISCLOSURE, payload: connectConfig }),
84985
- ref: props.navigationRef,
84986
- size
84987
- }
84988
- );
84989
+ connectStepView = /* @__PURE__ */ jsxRuntimeExports.jsx(Disclosure, { ref: props.navigationRef });
84989
84990
  } else if (step === STEPS.SEARCH) {
84990
- connectStepView = /* @__PURE__ */ jsxRuntimeExports.jsx(
84991
- Search$2,
84992
- {
84993
- connectConfig,
84994
- connectedMembers,
84995
- enableManualAccounts: isManualAccountsEnabled,
84996
- enableSupportRequests: showSupport,
84997
- isMicrodepositsEnabled,
84998
- onAddManualAccountClick: props.handleAddManualAccountClick,
84999
- onInstitutionSelect: handleInstitutionSelect,
85000
- ref: props.navigationRef,
85001
- size,
85002
- stepToMicrodeposits: () => dispatch(stepToMicrodeposits$1()),
85003
- usePopularOnly
85004
- }
85005
- );
84991
+ connectStepView = /* @__PURE__ */ jsxRuntimeExports.jsx(Search$2, { ref: props.navigationRef });
85006
84992
  } else if (step === STEPS.INSTITUTION_DISABLED) {
85007
84993
  connectStepView = /* @__PURE__ */ jsxRuntimeExports.jsx(InstitutionDisabled, { ref: props.navigationRef });
85008
84994
  } else if (step === STEPS.CONSENT) {
85009
84995
  connectStepView = /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
85010
84996
  DynamicDisclosure,
85011
84997
  {
85012
- onConsentClick: () => {
85013
- dispatch({ type: ActionTypes$2.USER_CONSENTED });
85014
- },
85015
- onGoBackClick: () => {
85016
- props.handleConsentGoBack();
85017
- },
84998
+ onGoBackClick: () => props.handleConsentGoBack(),
85018
84999
  ref: props.navigationRef
85019
85000
  }
85020
85001
  ) });
85021
85002
  } else if (step === STEPS.ADDITIONAL_PRODUCT) {
85022
- if (!ADDITIONAL_PRODUCT_OPTIONS.includes(connectConfig?.additional_product_option)) {
85003
+ if (!ADDITIONAL_PRODUCT_OPTIONS.includes(connectConfig?.additional_product_option))
85023
85004
  throw new Error("invalid product offer");
85024
- }
85025
- const onNoClick = () => {
85026
- dispatch({
85027
- type: ActionTypes$2.REJECT_ADDITIONAL_PRODUCT,
85028
- payload: {
85029
- consentIsEnabled
85030
- }
85031
- });
85032
- };
85033
- let onYesClick = null;
85034
- if (connectConfig?.additional_product_option === COMBO_JOB_DATA_TYPES.ACCOUNT_NUMBER) {
85035
- onYesClick = () => {
85036
- dispatch(addVerificationData({ consentIsEnabled }));
85037
- };
85038
- } else if (connectConfig?.additional_product_option === COMBO_JOB_DATA_TYPES.TRANSACTIONS) {
85039
- onYesClick = () => {
85040
- dispatch(addAggregationData({ consentIsEnabled }));
85041
- };
85042
- }
85043
- connectStepView = /* @__PURE__ */ jsxRuntimeExports.jsx(
85044
- AdditionalProductStep,
85045
- {
85046
- additionalProductName: connectConfig.additional_product_option,
85047
- onNoClick,
85048
- onYesClick,
85049
- ref: props.navigationRef
85050
- }
85051
- );
85005
+ connectStepView = /* @__PURE__ */ jsxRuntimeExports.jsx(AdditionalProductStep, { ref: props.navigationRef });
85052
85006
  } else if (step === STEPS.ADD_MANUAL_ACCOUNT) {
85053
85007
  connectStepView = /* @__PURE__ */ jsxRuntimeExports.jsx(
85054
85008
  ManualAccountConnect,
85055
85009
  {
85056
85010
  availableAccountTypes: props.availableAccountTypes,
85057
- onClose: () => dispatch({
85058
- type: ActionTypes$2.GO_BACK_MANUAL_ACCOUNT,
85059
- payload: initialConfig
85060
- }),
85061
85011
  onManualAccountAdded: props.onManualAccountAdded,
85062
85012
  ref: props.navigationRef
85063
85013
  }
@@ -85220,7 +85170,6 @@ const RenderConnectStep = (props) => {
85220
85170
  };
85221
85171
  RenderConnectStep.propTypes = {
85222
85172
  availableAccountTypes: PropTypes$1.array,
85223
- handleAddManualAccountClick: PropTypes$1.func.isRequired,
85224
85173
  handleConsentGoBack: PropTypes$1.func.isRequired,
85225
85174
  handleCredentialsGoBack: PropTypes$1.func.isRequired,
85226
85175
  handleOAuthGoBack: PropTypes$1.func.isRequired,
@@ -87391,9 +87340,6 @@ const Connect$2 = ({
87391
87340
  loadConnect(props.clientConfig);
87392
87341
  }
87393
87342
  }, [isLoading, step, props.clientConfig]);
87394
- const _handleAddManualAccountClick = () => {
87395
- dispatch(stepToAddManualAccount$1());
87396
- };
87397
87343
  const _handleConsentGoBack = () => {
87398
87344
  if (state.returnToMicrodeposits) {
87399
87345
  dispatch(stepToMicrodeposits$1());
@@ -87486,7 +87432,6 @@ const Connect$2 = ({
87486
87432
  RenderConnectStep,
87487
87433
  {
87488
87434
  availableAccountTypes,
87489
- handleAddManualAccountClick: _handleAddManualAccountClick,
87490
87435
  handleConsentGoBack: _handleConsentGoBack,
87491
87436
  handleCredentialsGoBack: _handleCredentialsGoBack,
87492
87437
  handleOAuthGoBack: _handleOAuthGoBack,