@mxenabled/connect-widget 2.12.0 → 2.12.1

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
@@ -5099,39 +5099,23 @@ function baseFindIndex$2(array, predicate, fromIndex, fromRight) {
5099
5099
  }
5100
5100
  var _baseFindIndex = baseFindIndex$2;
5101
5101
 
5102
- var _trimmedEndIndex;
5103
- var hasRequired_trimmedEndIndex;
5104
-
5105
- function require_trimmedEndIndex () {
5106
- if (hasRequired_trimmedEndIndex) return _trimmedEndIndex;
5107
- hasRequired_trimmedEndIndex = 1;
5108
- var reWhitespace = /\s/;
5109
- function trimmedEndIndex(string) {
5110
- var index = string.length;
5111
- while (index-- && reWhitespace.test(string.charAt(index))) {
5112
- }
5113
- return index;
5114
- }
5115
- _trimmedEndIndex = trimmedEndIndex;
5116
- return _trimmedEndIndex;
5102
+ var reWhitespace = /\s/;
5103
+ function trimmedEndIndex$1(string) {
5104
+ var index = string.length;
5105
+ while (index-- && reWhitespace.test(string.charAt(index))) {
5106
+ }
5107
+ return index;
5117
5108
  }
5109
+ var _trimmedEndIndex = trimmedEndIndex$1;
5118
5110
 
5119
- var _baseTrim;
5120
- var hasRequired_baseTrim;
5121
-
5122
- function require_baseTrim () {
5123
- if (hasRequired_baseTrim) return _baseTrim;
5124
- hasRequired_baseTrim = 1;
5125
- var trimmedEndIndex = require_trimmedEndIndex();
5126
- var reTrimStart = /^\s+/;
5127
- function baseTrim(string) {
5128
- return string ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, "") : string;
5129
- }
5130
- _baseTrim = baseTrim;
5131
- return _baseTrim;
5111
+ var trimmedEndIndex = _trimmedEndIndex;
5112
+ var reTrimStart = /^\s+/;
5113
+ function baseTrim$1(string) {
5114
+ return string ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, "") : string;
5132
5115
  }
5116
+ var _baseTrim = baseTrim$1;
5133
5117
 
5134
- var baseTrim = require_baseTrim(), isObject$7 = isObject_1, isSymbol$1 = isSymbol_1;
5118
+ var baseTrim = _baseTrim, isObject$7 = isObject_1, isSymbol$1 = isSymbol_1;
5135
5119
  var NAN = 0 / 0;
5136
5120
  var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
5137
5121
  var reIsBinary = /^0b[01]+$/i;
@@ -8613,7 +8597,7 @@ var hasRequiredTrim;
8613
8597
  function requireTrim () {
8614
8598
  if (hasRequiredTrim) return trim_1;
8615
8599
  hasRequiredTrim = 1;
8616
- var baseToString = _baseToString, baseTrim = require_baseTrim(), castSlice = require_castSlice(), charsEndIndex = require_charsEndIndex(), charsStartIndex = require_charsStartIndex(), stringToArray = require_stringToArray(), toString = toString_1;
8600
+ var baseToString = _baseToString, baseTrim = _baseTrim, castSlice = require_castSlice(), charsEndIndex = require_charsEndIndex(), charsStartIndex = require_charsStartIndex(), stringToArray = require_stringToArray(), toString = toString_1;
8617
8601
  function trim(string, chars, guard) {
8618
8602
  string = toString(string);
8619
8603
  if (string && (guard || chars === void 0)) {
@@ -9051,7 +9035,8 @@ const configSlice = createSlice({
9051
9035
  name: "config",
9052
9036
  initialState: initialState$6,
9053
9037
  reducers: {
9054
- addVerificationData: (state) => {
9038
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
9039
+ addVerificationData: (state, _) => {
9055
9040
  if (state.mode === AGG_MODE) {
9056
9041
  state.include_transactions = true;
9057
9042
  }
@@ -9062,7 +9047,8 @@ const configSlice = createSlice({
9062
9047
  state.use_cases = ["MONEY_MOVEMENT"];
9063
9048
  }
9064
9049
  },
9065
- addAggregationData: (state) => {
9050
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
9051
+ addAggregationData: (state, _) => {
9066
9052
  state.include_transactions = true;
9067
9053
  if (Array.isArray(state.use_cases)) {
9068
9054
  state.use_cases.push("PFM");
@@ -9150,6 +9136,13 @@ const selectConnectConfig = createSelector(selectConfig, (config) => ({
9150
9136
  use_cases: config.use_cases,
9151
9137
  additional_product_option: config.additional_product_option
9152
9138
  }));
9139
+ const selectCurrentMode = createSelector(selectConfig, (config) => ({
9140
+ mode: config.mode,
9141
+ isInAggMode: config.mode === AGG_MODE,
9142
+ isInVerifyMode: config.mode === VERIFY_MODE,
9143
+ isInTaxMode: config.mode === TAX_MODE,
9144
+ isInRewardMode: config.mode === REWARD_MODE
9145
+ }));
9153
9146
  const selectColorScheme = (state) => state.config.color_scheme;
9154
9147
  const getIsLightColorScheme = createSelector(
9155
9148
  selectColorScheme,
@@ -54620,61 +54613,6 @@ GenericError.propTypes = {
54620
54613
  title: PropTypes$1.string.isRequired
54621
54614
  };
54622
54615
 
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
54616
  var baseKeys = _baseKeys, getTag = _getTag, isArguments = isArguments_1, isArray$4 = isArray_1, isArrayLike$3 = isArrayLike_1, isBuffer = isBufferExports, isPrototype = _isPrototype, isTypedArray = isTypedArray_1;
54679
54617
  var mapTag = "[object Map]", setTag = "[object Set]";
54680
54618
  var objectProto$1 = Object.prototype;
@@ -62710,17 +62648,18 @@ const scrollToTop = (ref) => {
62710
62648
  return ref.current?.scrollIntoView(true);
62711
62649
  };
62712
62650
 
62713
- const Disclosure = React__default.forwardRef((props, disclosureRef) => {
62714
- const { mode, onContinue, size } = props;
62651
+ const Disclosure = React__default.forwardRef((_, disclosureRef) => {
62715
62652
  const containerRef = useRef(null);
62716
62653
  useAnalyticsPath(...PageviewInfo.CONNECT_DISCLOSURE);
62654
+ size === "small";
62717
62655
  const tokens = useTokens();
62718
62656
  const styles = getStyles$1C(tokens);
62719
62657
  const getNextDelay = getDelay();
62720
62658
  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;
62659
+ const { isInAggMode, isInTaxMode, isInVerifyMode } = useSelector(selectCurrentMode);
62660
+ const connectConfig = useSelector(selectConnectConfig);
62661
+ const size = useSelector(getSize);
62662
+ const dispatch = useDispatch();
62724
62663
  useImperativeHandle(disclosureRef, () => {
62725
62664
  return {
62726
62665
  handleBackButton() {
@@ -62745,15 +62684,15 @@ const Disclosure = React__default.forwardRef((props, disclosureRef) => {
62745
62684
  "This app will have access to the information below unless you choose to disconnect:"
62746
62685
  ) }),
62747
62686
  /* @__PURE__ */ jsxRuntimeExports.jsxs("ul", { "data-test": "disclosure-list", style: styles.dataList, children: [
62748
- IS_IN_AGG_MODE && /* @__PURE__ */ jsxRuntimeExports.jsxs(Fragment, { children: [
62687
+ isInAggMode && /* @__PURE__ */ jsxRuntimeExports.jsxs(Fragment, { children: [
62749
62688
  /* @__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
62689
  /* @__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
62690
  ] }),
62752
- IS_IN_TAX_MODE && /* @__PURE__ */ jsxRuntimeExports.jsxs(Fragment, { children: [
62691
+ isInTaxMode && /* @__PURE__ */ jsxRuntimeExports.jsxs(Fragment, { children: [
62753
62692
  /* @__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
62693
  /* @__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
62694
  ] }),
62756
- IS_IN_VERIFY_MODE && /* @__PURE__ */ jsxRuntimeExports.jsxs(Fragment, { children: [
62695
+ isInVerifyMode && /* @__PURE__ */ jsxRuntimeExports.jsxs(Fragment, { children: [
62757
62696
  /* @__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
62697
  /* @__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
62698
  ] })
@@ -62810,7 +62749,12 @@ const Disclosure = React__default.forwardRef((props, disclosureRef) => {
62810
62749
  {
62811
62750
  "data-test": "disclosure-continue",
62812
62751
  onClick: () => {
62813
- fadeOut(containerRef.current, "up", 300).then(() => onContinue());
62752
+ fadeOut(containerRef.current, "up", 300).then(
62753
+ () => dispatch({
62754
+ type: ActionTypes$2.ACCEPT_DISCLOSURE,
62755
+ payload: connectConfig
62756
+ })
62757
+ );
62814
62758
  },
62815
62759
  variant: "contained",
62816
62760
  children: _p("connect/disclosure/button", "Continue")
@@ -62874,11 +62818,6 @@ const getStyles$1C = (tokens) => {
62874
62818
  }
62875
62819
  };
62876
62820
  };
62877
- Disclosure.propTypes = {
62878
- mode: PropTypes$1.string.isRequired,
62879
- onContinue: PropTypes$1.func.isRequired,
62880
- size: PropTypes$1.string.isRequired
62881
- };
62882
62821
  Disclosure.displayName = "Disclosure";
62883
62822
 
62884
62823
  /******************************************************************************
@@ -64646,7 +64585,7 @@ var now$1 = function() {
64646
64585
  };
64647
64586
  var now_1 = now$1;
64648
64587
 
64649
- var isObject = isObject_1, now = now_1, toNumber = toNumber_1;
64588
+ var isObject$1 = isObject_1, now = now_1, toNumber = toNumber_1;
64650
64589
  var FUNC_ERROR_TEXT = "Expected a function";
64651
64590
  var nativeMax$2 = Math.max, nativeMin = Math.min;
64652
64591
  function debounce$1(func, wait, options) {
@@ -64655,7 +64594,7 @@ function debounce$1(func, wait, options) {
64655
64594
  throw new TypeError(FUNC_ERROR_TEXT);
64656
64595
  }
64657
64596
  wait = toNumber(wait) || 0;
64658
- if (isObject(options)) {
64597
+ if (isObject$1(options)) {
64659
64598
  leading = !!options.leading;
64660
64599
  maxing = "maxWait" in options;
64661
64600
  maxWait = maxing ? nativeMax$2(toNumber(options.maxWait) || 0, wait) : maxWait;
@@ -69741,6 +69680,153 @@ const INSTITUTION_TYPES = {
69741
69680
  const SEARCH_PER_PAGE_DEFAULT = 25;
69742
69681
  const SEARCH_PAGE_DEFAULT = 1;
69743
69682
 
69683
+ var assignValue = _assignValue, castPath$1 = _castPath, isIndex = _isIndex, isObject = isObject_1, toKey = _toKey;
69684
+ function baseSet$1(object, path, value, customizer) {
69685
+ if (!isObject(object)) {
69686
+ return object;
69687
+ }
69688
+ path = castPath$1(path, object);
69689
+ var index = -1, length = path.length, lastIndex = length - 1, nested = object;
69690
+ while (nested != null && ++index < length) {
69691
+ var key = toKey(path[index]), newValue = value;
69692
+ if (key === "__proto__" || key === "constructor" || key === "prototype") {
69693
+ return object;
69694
+ }
69695
+ if (index != lastIndex) {
69696
+ var objValue = nested[key];
69697
+ newValue = customizer ? customizer(objValue, key, nested) : void 0;
69698
+ if (newValue === void 0) {
69699
+ newValue = isObject(objValue) ? objValue : isIndex(path[index + 1]) ? [] : {};
69700
+ }
69701
+ }
69702
+ assignValue(nested, key, newValue);
69703
+ nested = nested[key];
69704
+ }
69705
+ return object;
69706
+ }
69707
+ var _baseSet = baseSet$1;
69708
+
69709
+ var baseGet = _baseGet, baseSet = _baseSet, castPath = _castPath;
69710
+ function basePickBy$2(object, paths, predicate) {
69711
+ var index = -1, length = paths.length, result = {};
69712
+ while (++index < length) {
69713
+ var path = paths[index], value = baseGet(object, path);
69714
+ if (predicate(value, path)) {
69715
+ baseSet(result, castPath(path, object), value);
69716
+ }
69717
+ }
69718
+ return result;
69719
+ }
69720
+ var _basePickBy = basePickBy$2;
69721
+
69722
+ var basePickBy$1 = _basePickBy, hasIn = hasIn_1;
69723
+ function basePick$1(object, paths) {
69724
+ return basePickBy$1(object, paths, function(value, path) {
69725
+ return hasIn(object, path);
69726
+ });
69727
+ }
69728
+ var _basePick = basePick$1;
69729
+
69730
+ var basePick = _basePick, flatRest = _flatRest;
69731
+ var pick = flatRest(function(object, paths) {
69732
+ return object == null ? {} : basePick(object, paths);
69733
+ });
69734
+ var pick_1 = pick;
69735
+
69736
+ const _pick = /*@__PURE__*/getDefaultExportFromCjs(pick_1);
69737
+
69738
+ const defaultApiValue = {
69739
+ // Accounts
69740
+ createAccount: () => Promise.resolve({}),
69741
+ // Members
69742
+ addMember: () => Promise.resolve({}),
69743
+ deleteMember: () => Promise.resolve(),
69744
+ getMemberCredentials: () => Promise.resolve([]),
69745
+ loadMemberByGuid: () => Promise.resolve({}),
69746
+ loadMembers: () => Promise.resolve([]),
69747
+ // Institutions
69748
+ getInstitutionCredentials: () => Promise.resolve([]),
69749
+ loadDiscoveredInstitutions: () => Promise.resolve([]),
69750
+ loadInstitutionByCode: () => Promise.resolve({}),
69751
+ loadInstitutions: () => Promise.resolve([]),
69752
+ loadInstitutionByGuid: () => Promise.resolve({}),
69753
+ loadPopularInstitutions: () => Promise.resolve([]),
69754
+ // Microdeposits
69755
+ createMicrodeposit: () => Promise.resolve({}),
69756
+ loadMicrodepositByGuid: () => Promise.resolve({}),
69757
+ refreshMicrodepositStatus: () => Promise.resolve(),
69758
+ updateMember: () => Promise.resolve({}),
69759
+ updateMFA: () => Promise.resolve({}),
69760
+ updateMicrodeposit: () => Promise.resolve({}),
69761
+ verifyMicrodeposit: () => Promise.resolve({}),
69762
+ verifyRoutingNumber: () => Promise.resolve({}),
69763
+ //OAuth
69764
+ loadOAuthState: () => Promise.resolve({}),
69765
+ loadOAuthStates: () => Promise.resolve([]),
69766
+ oAuthStart: () => Promise.resolve(),
69767
+ // Support
69768
+ createSupportTicket: () => Promise.resolve(),
69769
+ //Job
69770
+ loadJob: () => Promise.resolve({}),
69771
+ runJob: () => Promise.resolve({}),
69772
+ // User
69773
+ updateUserProfile: () => Promise.resolve({})
69774
+ };
69775
+ const ApiContext = React$1.createContext(defaultApiValue);
69776
+ const ApiProvider = ({ apiValue, children }) => {
69777
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(ApiContext.Provider, { value: { ...defaultApiValue, ...apiValue }, children });
69778
+ };
69779
+ const useApi = () => {
69780
+ const context = React$1.useContext(ApiContext);
69781
+ if (context === void 0) {
69782
+ throw new Error("useApi must be used within a ApiProvider");
69783
+ }
69784
+ return { api: context };
69785
+ };
69786
+
69787
+ const useSelectInstitution = () => {
69788
+ const { api } = useApi();
69789
+ const [institution, setInstitution] = useState(null);
69790
+ const dispatch = useDispatch();
69791
+ const consentIsEnabled = useSelector((state) => isConsentEnabled(state));
69792
+ const connectConfig = useSelector(selectConnectConfig);
69793
+ const handleSelectInstitution = useCallback(
69794
+ (institution2) => {
69795
+ setInstitution(institution2);
69796
+ },
69797
+ [institution]
69798
+ );
69799
+ useEffect(() => {
69800
+ if (!institution) return () => {
69801
+ };
69802
+ const selectInstitution$ = from(api.loadInstitutionByGuid(institution.guid)).pipe(
69803
+ map((insWithCreds) => {
69804
+ return dispatch({
69805
+ type: ActionTypes$2.SELECT_INSTITUTION_SUCCESS,
69806
+ payload: {
69807
+ institution: {
69808
+ ...insWithCreds,
69809
+ is_disabled_by_client: institutionIsBlockedForCostReasons(institution)
69810
+ // Temporary workaround till backend/core is fixed
69811
+ },
69812
+ consentIsEnabled: consentIsEnabled || false,
69813
+ additionalProductOption: connectConfig?.additional_product_option || null
69814
+ }
69815
+ });
69816
+ }),
69817
+ catchError((err) => {
69818
+ setInstitution(null);
69819
+ return of(selectInstitutionError(err));
69820
+ })
69821
+ ).subscribe((action) => {
69822
+ setInstitution(null);
69823
+ dispatch(action);
69824
+ });
69825
+ return () => selectInstitution$.unsubscribe();
69826
+ }, [institution]);
69827
+ return { handleSelectInstitution };
69828
+ };
69829
+
69744
69830
  const InstitutionGridTile = (props) => {
69745
69831
  const { institution, selectInstitution } = props;
69746
69832
  const tokens = useTokens();
@@ -69892,21 +69978,30 @@ InstituionGrid.propTypes = {
69892
69978
 
69893
69979
  const PopularInstitutionsList = (props) => {
69894
69980
  useAnalyticsPath(...PageviewInfo.CONNECT_SEARCH_POPULAR);
69895
- const {
69896
- institutions,
69897
- handleSelectInstitution,
69898
- onAddManualAccountClick,
69899
- onSearchInstitutionClick,
69900
- enableManualAccounts
69901
- } = props;
69981
+ const { handleSelectInstitution } = useSelectInstitution();
69982
+ const postMessage = useContext(PostMessageContext);
69983
+ const { institutions, onSearchInstitutionClick } = props;
69902
69984
  const getNextDelay = getDelay();
69903
69985
  const tokens = useTokens();
69904
69986
  const styles = getStyles$1q(tokens);
69987
+ const dispatch = useDispatch();
69988
+ const enableManualAccounts = useSelector((state) => {
69989
+ const isManualAccountsEnabled = state.profiles.widgetProfile?.enable_manual_accounts;
69990
+ const { isInAggMode } = selectCurrentMode(state);
69991
+ const hasAtriumAPI = state.profiles.client?.has_atrium_api;
69992
+ return isManualAccountsEnabled && isInAggMode && !hasAtriumAPI;
69993
+ });
69905
69994
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { style: styles.listContainer, children: [
69906
69995
  /* @__PURE__ */ jsxRuntimeExports.jsx(SlideDown, { delay: getNextDelay(), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
69907
69996
  InstituionGrid,
69908
69997
  {
69909
- handleSelectInstitution,
69998
+ handleSelectInstitution: (institution) => {
69999
+ postMessage.onPostMessage(
70000
+ "connect/selectedInstitution",
70001
+ _pick(institution, ["name", "guid", "url", "code"])
70002
+ );
70003
+ handleSelectInstitution(institution);
70004
+ },
69910
70005
  institutions: institutions.filter((institution) => !institution.is_disabled_by_client),
69911
70006
  posthogEvent: AnalyticEvents.SELECT_POPULAR_INSTITUTION
69912
70007
  }
@@ -69926,7 +70021,7 @@ const PopularInstitutionsList = (props) => {
69926
70021
  Button$2,
69927
70022
  {
69928
70023
  "data-test": "add-account-manually-button",
69929
- onClick: onAddManualAccountClick,
70024
+ onClick: () => dispatch(stepToAddManualAccount$1()),
69930
70025
  variant: "text",
69931
70026
  children: __("Add account manually")
69932
70027
  }
@@ -69974,10 +70069,7 @@ const getStyles$1q = (tokens) => {
69974
70069
  };
69975
70070
  };
69976
70071
  PopularInstitutionsList.propTypes = {
69977
- enableManualAccounts: PropTypes$1.bool.isRequired,
69978
- handleSelectInstitution: PropTypes$1.func.isRequired,
69979
70072
  institutions: PropTypes$1.array.isRequired,
69980
- onAddManualAccountClick: PropTypes$1.func.isRequired,
69981
70073
  onSearchInstitutionClick: PropTypes$1.func.isRequired
69982
70074
  };
69983
70075
 
@@ -70138,25 +70230,42 @@ InstitutionTile.propTypes = {
70138
70230
  const SearchedInstitutionsList = (props) => {
70139
70231
  useAnalyticsPath(...PageviewInfo.CONNECT_SEARCHED);
70140
70232
  const sendAnalyticsEvent = useAnalyticsEvent();
70233
+ const postMessage = useContext(PostMessageContext);
70141
70234
  const {
70142
70235
  currentSearchResults,
70143
- enableManualAccounts,
70144
- enableSupportRequests,
70145
70236
  institutions,
70146
70237
  institutionSearch,
70147
- isMicrodepositsEnabled,
70148
- handleSelectInstitution,
70149
- onAddManualAccountClick,
70150
70238
  onRequestInstitution,
70151
- onVerifyWithMicrodeposits,
70152
70239
  setAriaLiveRegionMessage
70153
70240
  } = props;
70154
70241
  const tokens = useTokens();
70155
70242
  const styles = getStyles$1o(tokens);
70156
70243
  const getNextDelay = getDelay();
70157
- const clientUsesOauth = useSelector((state) => state.profiles.clientProfile.uses_oauth ?? false);
70158
70244
  const [currentPage, setCurrentPage] = useState(SEARCH_PAGE_DEFAULT);
70159
70245
  const [isLoadingInstitutions, setIsLoadingInstitutions] = useState(false);
70246
+ const dispatch = useDispatch();
70247
+ const clientUsesOauth = useSelector((state) => state.profiles.clientProfile.uses_oauth ?? false);
70248
+ const enableManualAccounts = useSelector((state) => {
70249
+ const isManualAccountsEnabled = state.profiles.widgetProfile?.enable_manual_accounts;
70250
+ const { isInAggMode } = selectCurrentMode(state);
70251
+ const hasAtriumAPI = state.profiles.client?.has_atrium_api;
70252
+ return isManualAccountsEnabled && isInAggMode && !hasAtriumAPI;
70253
+ });
70254
+ const enableSupportRequests = useSelector((state) => {
70255
+ const isSupportEnabled = state.profiles.widgetProfile?.enable_support_requests;
70256
+ const { isInAggMode } = selectCurrentMode(state);
70257
+ return isSupportEnabled && isInAggMode;
70258
+ });
70259
+ const isMicrodepositsEnabled = useSelector((state) => {
70260
+ const { isVerifyMode } = selectCurrentMode(state);
70261
+ const clientProfile = state.profiles.clientProfile || {};
70262
+ const widgetProfile = state.profiles.widgetProfile || {};
70263
+ return isVerifyMode && // Widget is in Verify Mode
70264
+ clientProfile.account_verification_is_enabled && // Client supports verification
70265
+ clientProfile.is_microdeposits_enabled && // Client supports MDV
70266
+ widgetProfile.show_microdeposits_in_connect;
70267
+ });
70268
+ const { handleSelectInstitution } = useSelectInstitution();
70160
70269
  const shouldShowLoadMore = !!currentSearchResults.length && !isLoadingInstitutions;
70161
70270
  useEffect(() => {
70162
70271
  setAriaLiveRegionMessage(
@@ -70194,6 +70303,10 @@ const SearchedInstitutionsList = (props) => {
70194
70303
  institution_guid: institution.guid,
70195
70304
  institution_name: institution.name
70196
70305
  });
70306
+ postMessage.onPostMessage(
70307
+ "connect/selectedInstitution",
70308
+ _pick(institution, ["name", "guid", "url", "code"])
70309
+ );
70197
70310
  handleSelectInstitution(institution);
70198
70311
  },
70199
70312
  size: 48
@@ -70219,7 +70332,7 @@ const SearchedInstitutionsList = (props) => {
70219
70332
  Button$2,
70220
70333
  {
70221
70334
  "data-test": "add-account-manually-button",
70222
- onClick: onAddManualAccountClick,
70335
+ onClick: () => dispatch(stepToAddManualAccount$1()),
70223
70336
  variant: "text",
70224
70337
  children: __("Add account manually")
70225
70338
  }
@@ -70237,7 +70350,7 @@ const SearchedInstitutionsList = (props) => {
70237
70350
  Button$2,
70238
70351
  {
70239
70352
  "data-test": "connect-account-numbers-button",
70240
- onClick: onVerifyWithMicrodeposits,
70353
+ onClick: () => dispatch(stepToMicrodeposits$1()),
70241
70354
  variant: "text",
70242
70355
  children: __("Connect with account numbers")
70243
70356
  }
@@ -70278,32 +70391,39 @@ const getStyles$1o = (tokens) => {
70278
70391
  };
70279
70392
  SearchedInstitutionsList.propTypes = {
70280
70393
  currentSearchResults: PropTypes$1.array.isRequired,
70281
- enableManualAccounts: PropTypes$1.bool.isRequired,
70282
- enableSupportRequests: PropTypes$1.bool.isRequired,
70283
- handleSelectInstitution: PropTypes$1.func.isRequired,
70284
70394
  institutions: PropTypes$1.array.isRequired,
70285
70395
  institutionSearch: PropTypes$1.func.isRequired,
70286
- isMicrodepositsEnabled: PropTypes$1.bool.isRequired,
70287
- onAddManualAccountClick: PropTypes$1.func.isRequired,
70288
70396
  onRequestInstitution: PropTypes$1.func.isRequired,
70289
- onVerifyWithMicrodeposits: PropTypes$1.func.isRequired,
70290
70397
  setAriaLiveRegionMessage: PropTypes$1.func.isRequired
70291
70398
  };
70292
70399
 
70293
70400
  const SearchNoResult = (props) => {
70294
70401
  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;
70402
+ const { onRequestInstitution, setAriaLiveRegionMessage } = props;
70304
70403
  const timerRef = useRef(null);
70305
70404
  const tokens = useTokens();
70306
70405
  const styles = getStyles$1n(tokens);
70406
+ const dispatch = useDispatch();
70407
+ const enableManualAccounts = useSelector((state) => {
70408
+ const isManualAccountsEnabled = state.profiles.widgetProfile?.enable_manual_accounts;
70409
+ const { isInAggMode } = selectCurrentMode(state);
70410
+ const hasAtriumAPI = state.profiles.client?.has_atrium_api;
70411
+ return isManualAccountsEnabled && isInAggMode && !hasAtriumAPI;
70412
+ });
70413
+ const enableSupportRequests = useSelector((state) => {
70414
+ const isSupportEnabled = state.profiles.widgetProfile?.enable_support_requests;
70415
+ const { isInAggMode } = selectCurrentMode(state);
70416
+ return isSupportEnabled && isInAggMode;
70417
+ });
70418
+ const isMicrodepositsEnabled = useSelector((state) => {
70419
+ const { isVerifyMode } = selectCurrentMode(state);
70420
+ const clientProfile = state.profiles.clientProfile || {};
70421
+ const widgetProfile = state.profiles.widgetProfile || {};
70422
+ return isVerifyMode && // Widget is in Verify Mode
70423
+ clientProfile.account_verification_is_enabled && // Client supports verification
70424
+ clientProfile.is_microdeposits_enabled && // Client supports MDV
70425
+ widgetProfile.show_microdeposits_in_connect;
70426
+ });
70307
70427
  useEffect(() => {
70308
70428
  timerRef.current = setTimeout(() => {
70309
70429
  setAriaLiveRegionMessage(__("No results found for ”%1”", props.searchTerm));
@@ -70342,7 +70462,7 @@ const SearchNoResult = (props) => {
70342
70462
  Button$2,
70343
70463
  {
70344
70464
  "data-test": "add-account-manually-button",
70345
- onClick: onAddManualAccountClick,
70465
+ onClick: () => dispatch(stepToAddManualAccount$1()),
70346
70466
  variant: "text",
70347
70467
  children: __("Add account manually")
70348
70468
  }
@@ -70360,7 +70480,7 @@ const SearchNoResult = (props) => {
70360
70480
  Button$2,
70361
70481
  {
70362
70482
  "data-test": "connect-account-numbers-button",
70363
- onClick: onVerifyWithMicrodeposits,
70483
+ onClick: () => dispatch(stepToMicrodeposits$1()),
70364
70484
  variant: "text",
70365
70485
  children: __("Connect with account numbers")
70366
70486
  }
@@ -70394,12 +70514,7 @@ const getStyles$1n = (tokens) => {
70394
70514
  };
70395
70515
  };
70396
70516
  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
70517
  onRequestInstitution: PropTypes$1.func.isRequired,
70402
- onVerifyWithMicrodeposits: PropTypes$1.func.isRequired,
70403
70518
  searchTerm: PropTypes$1.string.isRequired,
70404
70519
  setAriaLiveRegionMessage: PropTypes$1.func.isRequired
70405
70520
  };
@@ -72103,55 +72218,6 @@ const useForm = (submitCallback, formSchema, initialValues) => {
72103
72218
  };
72104
72219
  };
72105
72220
 
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
72221
  const RequiredFieldNote = ({ styles }) => {
72156
72222
  const requiredFieldNoteColor = "#666";
72157
72223
  const asteriskColor = "#E32727";
@@ -72849,29 +72915,24 @@ const reducer$4 = (state, action) => {
72849
72915
  return state;
72850
72916
  }
72851
72917
  };
72852
- const Search$2 = React__default.forwardRef((props, navigationRef) => {
72918
+ const Search$2 = React__default.forwardRef((_, navigationRef) => {
72853
72919
  useAnalyticsPath(...PageviewInfo.CONNECT_SEARCH, {}, false);
72854
72920
  const [state, dispatch] = useReducer(reducer$4, initialState$1);
72855
72921
  const [ariaLiveRegionMessage, setAriaLiveRegionMessage] = useState("");
72856
72922
  const searchInput = useRef("");
72857
72923
  const supportNavRef = useRef(null);
72858
- const reduxDispatch = useDispatch();
72859
72924
  const sendAnalyticsEvent = useAnalyticsEvent();
72860
72925
  const postMessageFunctions = useContext(PostMessageContext);
72861
72926
  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;
72927
+ const reduxDispatch = useDispatch();
72928
+ const connectConfig = useSelector(selectConnectConfig);
72929
+ const connectedMembers = useSelector(getMembers);
72930
+ const usePopularOnly = useSelector((state2) => {
72931
+ const clientProfile = state2.profiles.clientProfile || {};
72932
+ const client = state2.profiles.client || {};
72933
+ return (clientProfile.uses_custom_popular_institution_list ?? false) || (client.has_limited_institutions ?? false);
72934
+ });
72873
72935
  const MINIMUM_SEARCH_LENGTH = 2;
72874
- const mode = connectConfig.mode;
72875
72936
  const isFirstTimeUser = connectedMembers.length === 0;
72876
72937
  useImperativeHandle(navigationRef, () => {
72877
72938
  return {
@@ -72983,7 +73044,7 @@ const Search$2 = React__default.forwardRef((props, navigationRef) => {
72983
73044
  return;
72984
73045
  }
72985
73046
  sendAnalyticsEvent(AnalyticEvents.SEARCH_QUERY, {
72986
- mode,
73047
+ mode: connectConfig.mode,
72987
73048
  search_term: value
72988
73049
  });
72989
73050
  postMessageFunctions.onPostMessage("connect/institutionSearch", { query: value });
@@ -73064,14 +73125,9 @@ const Search$2 = React__default.forwardRef((props, navigationRef) => {
73064
73125
  state.currentView === SEARCH_VIEWS.NO_RESULTS && /* @__PURE__ */ jsxRuntimeExports.jsx(
73065
73126
  SearchNoResult,
73066
73127
  {
73067
- enableManualAccounts,
73068
- enableSupportRequests,
73069
- isMicrodepositsEnabled,
73070
- onAddManualAccountClick,
73071
73128
  onRequestInstitution: () => {
73072
73129
  dispatch({ type: SEARCH_ACTIONS.SHOW_SUPPORT });
73073
73130
  },
73074
- onVerifyWithMicrodeposits: stepToMicrodeposits,
73075
73131
  searchTerm: state.searchTerm,
73076
73132
  setAriaLiveRegionMessage
73077
73133
  }
@@ -73081,31 +73137,22 @@ const Search$2 = React__default.forwardRef((props, navigationRef) => {
73081
73137
  SearchedInstitutionsList,
73082
73138
  {
73083
73139
  currentSearchResults: state.currentSearchResults,
73084
- enableManualAccounts,
73085
- enableSupportRequests,
73086
- handleSelectInstitution: onInstitutionSelect,
73087
73140
  institutionSearch,
73088
73141
  institutions: state.searchedInstitutions,
73089
- isMicrodepositsEnabled,
73090
- onAddManualAccountClick,
73091
73142
  onRequestInstitution: () => {
73092
73143
  dispatch({ type: SEARCH_ACTIONS.SHOW_SUPPORT });
73093
73144
  },
73094
- onVerifyWithMicrodeposits: stepToMicrodeposits,
73095
73145
  setAriaLiveRegionMessage
73096
73146
  }
73097
73147
  ),
73098
73148
  state.currentView === SEARCH_VIEWS.POPULAR && /* @__PURE__ */ jsxRuntimeExports.jsx(
73099
73149
  PopularInstitutionsList,
73100
73150
  {
73101
- enableManualAccounts,
73102
- handleSelectInstitution: onInstitutionSelect,
73103
73151
  institutions: usePopularOnly ? state.popularInstitutions : getSuggestedInstitutions(
73104
73152
  state.popularInstitutions,
73105
73153
  state.discoveredInstitutions,
73106
73154
  connectedMembers
73107
73155
  ),
73108
- onAddManualAccountClick,
73109
73156
  onSearchInstitutionClick: () => searchInput.current.focus()
73110
73157
  }
73111
73158
  ),
@@ -73137,17 +73184,6 @@ const getStyles$19 = (tokens) => {
73137
73184
  }
73138
73185
  };
73139
73186
  };
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
73187
  Search$2.displayName = "Search";
73152
73188
  const applyConnectConfigToSearchQuery = (connectConfig, queryObject) => {
73153
73189
  if (connectConfig.iso_country_code) {
@@ -84303,6 +84339,7 @@ const ManualAccountConnect = React__default.forwardRef((props, ref) => {
84303
84339
  const formRef = useRef(null);
84304
84340
  const menuRef = useRef(null);
84305
84341
  const postMessageFunctions = useContext(PostMessageContext);
84342
+ const reduxDispatch = useDispatch();
84306
84343
  const [showDayPicker, setShowDayPicker] = useState(false);
84307
84344
  const [state, dispatch] = useReducer(reducer$1, {
84308
84345
  showForm: false,
@@ -84311,6 +84348,7 @@ const ManualAccountConnect = React__default.forwardRef((props, ref) => {
84311
84348
  accountType: props.availableAccountTypes?.length === 1 ? props.availableAccountTypes[0] : null,
84312
84349
  validationErrors: {}
84313
84350
  });
84351
+ const initialConfig = useSelector(selectInitialConfig);
84314
84352
  useImperativeHandle(ref, () => {
84315
84353
  return {
84316
84354
  handleBackButton() {
@@ -84335,7 +84373,10 @@ const ManualAccountConnect = React__default.forwardRef((props, ref) => {
84335
84373
  };
84336
84374
  const handleGoBackClick = () => {
84337
84375
  postMessageFunctions.onPostMessage(POST_MESSAGES.BACK_TO_SEARCH);
84338
- props.onClose();
84376
+ reduxDispatch({
84377
+ type: ActionTypes$2.GO_BACK_MANUAL_ACCOUNT,
84378
+ payload: initialConfig
84379
+ });
84339
84380
  };
84340
84381
  if (state.showSuccess) {
84341
84382
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -84343,7 +84384,10 @@ const ManualAccountConnect = React__default.forwardRef((props, ref) => {
84343
84384
  {
84344
84385
  accountType: state.accountType,
84345
84386
  handleDone: () => {
84346
- props.onClose();
84387
+ reduxDispatch({
84388
+ type: ActionTypes$2.GO_BACK_MANUAL_ACCOUNT,
84389
+ payload: initialConfig
84390
+ });
84347
84391
  },
84348
84392
  onManualAccountAdded: props.onManualAccountAdded
84349
84393
  }
@@ -84374,7 +84418,6 @@ const ManualAccountConnect = React__default.forwardRef((props, ref) => {
84374
84418
  });
84375
84419
  ManualAccountConnect.propTypes = {
84376
84420
  availableAccountTypes: PropTypes$1.array,
84377
- onClose: PropTypes$1.func.isRequired,
84378
84421
  onManualAccountAdded: PropTypes$1.func
84379
84422
  };
84380
84423
  ManualAccountConnect.displayName = "ManualAccountConnect";
@@ -84412,129 +84455,86 @@ const ADDITIONAL_PRODUCT_OPTIONS = [
84412
84455
  COMBO_JOB_DATA_TYPES.TRANSACTIONS,
84413
84456
  COMBO_JOB_DATA_TYPES.ACCOUNT_NUMBER
84414
84457
  ];
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);
84458
+ const AdditionalProductStep = React__default.forwardRef((_, navigationRef) => {
84499
84459
  const dispatch = useDispatch();
84500
- const consentIsEnabled = useSelector((state) => isConsentEnabled(state));
84501
84460
  const connectConfig = useSelector(selectConnectConfig);
84502
- const handleSelectInstitution = useCallback(
84503
- (institution2) => {
84504
- setInstitution(institution2);
84505
- },
84506
- [institution]
84507
- );
84508
- useEffect(() => {
84509
- if (!institution) return () => {
84461
+ const selectedInstitution = useSelector(getSelectedInstitution);
84462
+ const consentIsEnabled = useSelector(isConsentEnabled);
84463
+ const { add_aggregation = {}, add_verification = {} } = useSelector(selectLocalizedContent)?.connect?.additional_product_screen || {};
84464
+ useImperativeHandle(navigationRef, () => {
84465
+ return {
84466
+ showBackButton() {
84467
+ return true;
84468
+ }
84510
84469
  };
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
- };
84470
+ }, []);
84471
+ const getNextDelay = getDelay();
84472
+ const addAggregationText = {
84473
+ title: add_aggregation?.title || __("Add financial management?"),
84474
+ body: add_aggregation?.body || __(
84475
+ "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?"
84476
+ ),
84477
+ acceptButtonText: add_aggregation?.button_1 || __("Yes, add financial management"),
84478
+ rejectButtonText: add_aggregation?.button_2 || __("No, only add transfers and payments")
84479
+ };
84480
+ const addVerificationText = {
84481
+ title: add_verification?.title || __("Add transfers and payments?"),
84482
+ body: add_verification?.body || __(
84483
+ "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?"
84484
+ ),
84485
+ acceptButtonText: add_verification?.button_1 || __("Yes, add transfers and payments"),
84486
+ rejectButtonText: add_verification?.button_2 || __("No, only add financial management")
84487
+ };
84488
+ const componentText = connectConfig.additional_product_option === COMBO_JOB_DATA_TYPES.TRANSACTIONS ? addAggregationText : addVerificationText;
84489
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(SlideDown, { delay: getNextDelay(), children: [
84490
+ /* @__PURE__ */ jsxRuntimeExports.jsx(InstitutionBlock, { institution: selectedInstitution, style: { marginBottom: 24 } }),
84491
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
84492
+ D,
84493
+ {
84494
+ component: "h2",
84495
+ "data-test": "additional-product__title-text",
84496
+ style: { marginBottom: 12 },
84497
+ truncate: false,
84498
+ variant: "H2",
84499
+ children: componentText.title
84500
+ }
84501
+ ),
84502
+ /* @__PURE__ */ jsxRuntimeExports.jsx(D, { component: "p", style: { marginBottom: 32 }, truncate: false, variant: "Paragraph", children: componentText.body }),
84503
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
84504
+ Button$2,
84505
+ {
84506
+ "data-test": "additional-product__accept-button",
84507
+ fullWidth: true,
84508
+ onClick: () => {
84509
+ dispatch(
84510
+ connectConfig?.additional_product_option === COMBO_JOB_DATA_TYPES.ACCOUNT_NUMBER ? addVerificationData({ consentIsEnabled }) : addAggregationData({ consentIsEnabled })
84511
+ );
84512
+ },
84513
+ style: { marginBottom: 8 },
84514
+ variant: "contained",
84515
+ children: componentText.acceptButtonText
84516
+ }
84517
+ ),
84518
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
84519
+ Button$2,
84520
+ {
84521
+ "data-test": "additional-product__reject-button",
84522
+ fullWidth: true,
84523
+ onClick: () => {
84524
+ dispatch({
84525
+ type: ActionTypes$2.REJECT_ADDITIONAL_PRODUCT,
84526
+ payload: {
84527
+ consentIsEnabled
84528
+ }
84529
+ });
84530
+ },
84531
+ variant: "text",
84532
+ children: componentText.rejectButtonText
84533
+ }
84534
+ )
84535
+ ] });
84536
+ });
84537
+ AdditionalProductStep.displayName = "AdditionalProductStep";
84538
84538
 
84539
84539
  const getConsentDataClusters = () => {
84540
84540
  const dataClusters = {
@@ -84714,13 +84714,14 @@ const getStyles$8 = () => {
84714
84714
  };
84715
84715
 
84716
84716
  const DynamicDisclosure = React__default.forwardRef(
84717
- ({ onConsentClick, onGoBackClick }, navigationRef) => {
84717
+ ({ onGoBackClick }, navigationRef) => {
84718
84718
  const [name, path] = PageviewInfo.CONNECT_DYNAMIC_DISCLOSURE;
84719
84719
  useAnalyticsPath(name, path);
84720
84720
  const containerRef = useRef(null);
84721
84721
  const tokens = J0();
84722
84722
  const styles = getStyles$7(tokens);
84723
84723
  const getNextDelay = getDelay();
84724
+ const dispatch = useDispatch();
84724
84725
  const institution = useSelector((state) => state.connect.selectedInstitution);
84725
84726
  const appName = useSelector((state) => state.profiles.client.oauth_app_name || null);
84726
84727
  const [dialogIsOpen, setDialogIsOpen] = React__default.useState(false);
@@ -84794,7 +84795,7 @@ const DynamicDisclosure = React__default.forwardRef(
84794
84795
  if (["es", "fr-ca"].includes(initialLocal) && initialLocal !== getLocale()) {
84795
84796
  setLocale(initialLocal);
84796
84797
  }
84797
- onConsentClick();
84798
+ dispatch({ type: ActionTypes$2.USER_CONSENTED });
84798
84799
  },
84799
84800
  sx: styles.button,
84800
84801
  variant: "contained",
@@ -84953,7 +84954,6 @@ const RenderConnectStep = (props) => {
84953
84954
  const selectedInstitution = useSelector(getSelectedInstitution);
84954
84955
  const updateCredentials = useSelector((state) => state.connect.updateCredentials);
84955
84956
  const verifyMemberError = useSelector((state) => state.connect.error);
84956
- const consentIsEnabled = useSelector((state) => isConsentEnabled(state));
84957
84957
  const { handleSelectInstitution } = useSelectInstitution();
84958
84958
  const dispatch = useDispatch();
84959
84959
  const tokens = useTokens();
@@ -84964,100 +84964,32 @@ const RenderConnectStep = (props) => {
84964
84964
  clientProfile.is_microdeposits_enabled && // Client supports MDV
84965
84965
  widgetProfile.show_microdeposits_in_connect;
84966
84966
  const hasAtriumAPI = client.has_atrium_api;
84967
- const isManualAccountsEnabled = widgetProfile.enable_manual_accounts && mode === AGG_MODE && !hasAtriumAPI;
84968
84967
  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
84968
  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
84969
  let connectStepView = null;
84979
84970
  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
- );
84971
+ connectStepView = /* @__PURE__ */ jsxRuntimeExports.jsx(Disclosure, { ref: props.navigationRef });
84989
84972
  } 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
- );
84973
+ connectStepView = /* @__PURE__ */ jsxRuntimeExports.jsx(Search$2, { ref: props.navigationRef });
85006
84974
  } else if (step === STEPS.INSTITUTION_DISABLED) {
85007
84975
  connectStepView = /* @__PURE__ */ jsxRuntimeExports.jsx(InstitutionDisabled, { ref: props.navigationRef });
85008
84976
  } else if (step === STEPS.CONSENT) {
85009
84977
  connectStepView = /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
85010
84978
  DynamicDisclosure,
85011
84979
  {
85012
- onConsentClick: () => {
85013
- dispatch({ type: ActionTypes$2.USER_CONSENTED });
85014
- },
85015
- onGoBackClick: () => {
85016
- props.handleConsentGoBack();
85017
- },
84980
+ onGoBackClick: () => props.handleConsentGoBack(),
85018
84981
  ref: props.navigationRef
85019
84982
  }
85020
84983
  ) });
85021
84984
  } else if (step === STEPS.ADDITIONAL_PRODUCT) {
85022
- if (!ADDITIONAL_PRODUCT_OPTIONS.includes(connectConfig?.additional_product_option)) {
84985
+ if (!ADDITIONAL_PRODUCT_OPTIONS.includes(connectConfig?.additional_product_option))
85023
84986
  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
- );
84987
+ connectStepView = /* @__PURE__ */ jsxRuntimeExports.jsx(AdditionalProductStep, { ref: props.navigationRef });
85052
84988
  } else if (step === STEPS.ADD_MANUAL_ACCOUNT) {
85053
84989
  connectStepView = /* @__PURE__ */ jsxRuntimeExports.jsx(
85054
84990
  ManualAccountConnect,
85055
84991
  {
85056
84992
  availableAccountTypes: props.availableAccountTypes,
85057
- onClose: () => dispatch({
85058
- type: ActionTypes$2.GO_BACK_MANUAL_ACCOUNT,
85059
- payload: initialConfig
85060
- }),
85061
84993
  onManualAccountAdded: props.onManualAccountAdded,
85062
84994
  ref: props.navigationRef
85063
84995
  }
@@ -85220,7 +85152,6 @@ const RenderConnectStep = (props) => {
85220
85152
  };
85221
85153
  RenderConnectStep.propTypes = {
85222
85154
  availableAccountTypes: PropTypes$1.array,
85223
- handleAddManualAccountClick: PropTypes$1.func.isRequired,
85224
85155
  handleConsentGoBack: PropTypes$1.func.isRequired,
85225
85156
  handleCredentialsGoBack: PropTypes$1.func.isRequired,
85226
85157
  handleOAuthGoBack: PropTypes$1.func.isRequired,
@@ -87391,9 +87322,6 @@ const Connect$2 = ({
87391
87322
  loadConnect(props.clientConfig);
87392
87323
  }
87393
87324
  }, [isLoading, step, props.clientConfig]);
87394
- const _handleAddManualAccountClick = () => {
87395
- dispatch(stepToAddManualAccount$1());
87396
- };
87397
87325
  const _handleConsentGoBack = () => {
87398
87326
  if (state.returnToMicrodeposits) {
87399
87327
  dispatch(stepToMicrodeposits$1());
@@ -87486,7 +87414,6 @@ const Connect$2 = ({
87486
87414
  RenderConnectStep,
87487
87415
  {
87488
87416
  availableAccountTypes,
87489
- handleAddManualAccountClick: _handleAddManualAccountClick,
87490
87417
  handleConsentGoBack: _handleConsentGoBack,
87491
87418
  handleCredentialsGoBack: _handleCredentialsGoBack,
87492
87419
  handleOAuthGoBack: _handleOAuthGoBack,