@mxenabled/connect-widget 2.14.2 → 2.15.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,23 +5099,39 @@ function baseFindIndex$2(array, predicate, fromIndex, fromRight) {
5099
5099
  }
5100
5100
  var _baseFindIndex = baseFindIndex$2;
5101
5101
 
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;
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;
5108
5117
  }
5109
- var _trimmedEndIndex = trimmedEndIndex$1;
5110
5118
 
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;
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;
5115
5132
  }
5116
- var _baseTrim = baseTrim$1;
5117
5133
 
5118
- var baseTrim = _baseTrim, isObject$7 = isObject_1, isSymbol$1 = isSymbol_1;
5134
+ var baseTrim = require_baseTrim(), isObject$7 = isObject_1, isSymbol$1 = isSymbol_1;
5119
5135
  var NAN = 0 / 0;
5120
5136
  var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
5121
5137
  var reIsBinary = /^0b[01]+$/i;
@@ -8597,7 +8613,7 @@ var hasRequiredTrim;
8597
8613
  function requireTrim () {
8598
8614
  if (hasRequiredTrim) return trim_1;
8599
8615
  hasRequiredTrim = 1;
8600
- var baseToString = _baseToString, baseTrim = _baseTrim, castSlice = require_castSlice(), charsEndIndex = require_charsEndIndex(), charsStartIndex = require_charsStartIndex(), stringToArray = require_stringToArray(), toString = toString_1;
8616
+ var baseToString = _baseToString, baseTrim = require_baseTrim(), castSlice = require_castSlice(), charsEndIndex = require_charsEndIndex(), charsStartIndex = require_charsStartIndex(), stringToArray = require_stringToArray(), toString = toString_1;
8601
8617
  function trim(string, chars, guard) {
8602
8618
  string = toString(string);
8603
8619
  if (string && (guard || chars === void 0)) {
@@ -9005,7 +9021,7 @@ const COMBO_JOB_DATA_TYPES = {
9005
9021
  TRANSACTIONS: "transactions",
9006
9022
  REWARDS: "rewards"};
9007
9023
 
9008
- const initialState$6 = {
9024
+ const initialState$7 = {
9009
9025
  _initialValues: "",
9010
9026
  is_mobile_webview: false,
9011
9027
  target_origin_referrer: null,
@@ -9034,7 +9050,7 @@ const initialState$6 = {
9034
9050
  };
9035
9051
  const configSlice = createSlice({
9036
9052
  name: "config",
9037
- initialState: initialState$6,
9053
+ initialState: initialState$7,
9038
9054
  reducers: {
9039
9055
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
9040
9056
  addVerificationData: (state, _) => {
@@ -9174,9 +9190,9 @@ function _additionalProductReset(state) {
9174
9190
  const initialValuesObject = convertInitialValuesToObject(state._initialValues);
9175
9191
  return {
9176
9192
  ...state,
9177
- include_transactions: initialValuesObject?.include_transactions ?? initialState$6.include_transactions,
9178
- mode: initialValuesObject?.mode ?? initialState$6.mode,
9179
- use_cases: initialValuesObject?.use_cases ?? initialState$6.use_cases
9193
+ include_transactions: initialValuesObject?.include_transactions ?? initialState$7.include_transactions,
9194
+ mode: initialValuesObject?.mode ?? initialState$7.mode,
9195
+ use_cases: initialValuesObject?.use_cases ?? initialState$7.use_cases
9180
9196
  };
9181
9197
  }
9182
9198
  const { addVerificationData, addAggregationData, additionalProductReset } = configSlice.actions;
@@ -9234,6 +9250,79 @@ function institutionIsBlockedForCostReasons(institution) {
9234
9250
  return isChase && institution?.is_disabled_by_client === true;
9235
9251
  }
9236
9252
 
9253
+ const initialState$6 = {
9254
+ unavailableInstitutions: []
9255
+ };
9256
+ const experimentalFeaturesSlice = createSlice({
9257
+ name: "experimentalFeatures",
9258
+ initialState: initialState$6,
9259
+ reducers: {
9260
+ loadExperimentalFeatures(state, action) {
9261
+ state.unavailableInstitutions = action.payload?.unavailableInstitutions || [];
9262
+ }
9263
+ }
9264
+ });
9265
+ const getExperimentalFeatures = (state) => state.experimentalFeatures;
9266
+ const { loadExperimentalFeatures } = experimentalFeaturesSlice.actions;
9267
+ const experimentalFeaturesSlice$1 = experimentalFeaturesSlice.reducer;
9268
+
9269
+ const InstitutionStatus = {
9270
+ CLIENT_BLOCKED_FOR_FEES: "CLIENT_BLOCKED_FOR_FEES",
9271
+ OPERATIONAL: "OPERATIONAL",
9272
+ UNAVAILABLE: "UNAVAILABLE"
9273
+ };
9274
+ function useInstitutionStatusMessage(institution) {
9275
+ const { unavailableInstitutions } = useSelector(getExperimentalFeatures);
9276
+ const status = useInstitutionStatus(institution);
9277
+ if (!institution || !institution.name || !institution.guid) {
9278
+ throw new Error("Selected institution is not defined or missing name and guid");
9279
+ }
9280
+ if (!unavailableInstitutions || !Array.isArray(unavailableInstitutions)) {
9281
+ throw new Error("Experimental feature unavailableInstitutions is not defined or not an array");
9282
+ }
9283
+ switch (status) {
9284
+ case InstitutionStatus.CLIENT_BLOCKED_FOR_FEES:
9285
+ return {
9286
+ title: __("Free %1 Connections Are No Longer Available", institution.name),
9287
+ body: __(
9288
+ "%1 now charges a fee for us to access your account data. To avoid passing that cost on to you, we no longer support %1 connections.",
9289
+ institution.name
9290
+ )
9291
+ };
9292
+ case InstitutionStatus.UNAVAILABLE:
9293
+ return {
9294
+ title: __("Connection not supported by %1", institution.name),
9295
+ body: __(
9296
+ "%1 currently limits how your data can be shared. We'll enable this connection once %1 opens access.",
9297
+ institution.name
9298
+ )
9299
+ };
9300
+ default:
9301
+ return {
9302
+ title: "",
9303
+ body: ""
9304
+ };
9305
+ }
9306
+ }
9307
+ function useInstitutionStatus(institution) {
9308
+ const { unavailableInstitutions } = useSelector(getExperimentalFeatures);
9309
+ return getInstitutionStatus(institution, unavailableInstitutions || []);
9310
+ }
9311
+ function getInstitutionStatus(institution, unavailableInstitutions) {
9312
+ if (!institution || !Array.isArray(unavailableInstitutions)) {
9313
+ return InstitutionStatus.OPERATIONAL;
9314
+ }
9315
+ if (institutionIsBlockedForCostReasons(institution)) {
9316
+ return InstitutionStatus.CLIENT_BLOCKED_FOR_FEES;
9317
+ }
9318
+ if (unavailableInstitutions.some(
9319
+ (unavailable) => institution?.name === unavailable.name || institution?.guid === unavailable.guid
9320
+ )) {
9321
+ return InstitutionStatus.UNAVAILABLE;
9322
+ }
9323
+ return InstitutionStatus.OPERATIONAL;
9324
+ }
9325
+
9237
9326
  const defaultState$1 = {
9238
9327
  error: null,
9239
9328
  // The most recent job request error, if any
@@ -9442,7 +9531,7 @@ const selectInstitutionSuccess = (state, action) => {
9442
9531
  let nextStep = STEPS.ENTER_CREDENTIALS;
9443
9532
  const canOfferVerification = action.payload.institution?.account_verification_is_enabled && action.payload.additionalProductOption === COMBO_JOB_DATA_TYPES.ACCOUNT_NUMBER;
9444
9533
  const canOfferAggregation = action.payload.additionalProductOption === COMBO_JOB_DATA_TYPES.TRANSACTIONS;
9445
- if (action.payload.institution && institutionIsBlockedForCostReasons(action.payload.institution)) {
9534
+ if (action.payload.institution && (institutionIsBlockedForCostReasons(action.payload.institution) || action.payload.institutionStatus === InstitutionStatus.UNAVAILABLE)) {
9446
9535
  nextStep = STEPS.INSTITUTION_STATUS_DETAILS;
9447
9536
  } else if (canOfferVerification || canOfferAggregation) {
9448
9537
  nextStep = STEPS.ADDITIONAL_PRODUCT;
@@ -13241,6 +13330,7 @@ const rootReducer = combineReducers({
13241
13330
  browser,
13242
13331
  config: configSlice$1,
13243
13332
  connect,
13333
+ experimentalFeatures: experimentalFeaturesSlice$1,
13244
13334
  localizedContent: localizedContentSlice$1,
13245
13335
  profiles: profilesSlice$1,
13246
13336
  userFeatures: userFeaturesSlice$1
@@ -70129,6 +70219,7 @@ const useApi = () => {
70129
70219
  const useSelectInstitution = () => {
70130
70220
  const { api } = useApi();
70131
70221
  const [institution, setInstitution] = useState(null);
70222
+ const institutionStatus = useInstitutionStatus(institution);
70132
70223
  const dispatch = useDispatch();
70133
70224
  const consentIsEnabled = useSelector((state) => isConsentEnabled(state));
70134
70225
  const connectConfig = useSelector(selectConnectConfig);
@@ -70151,6 +70242,7 @@ const useSelectInstitution = () => {
70151
70242
  is_disabled_by_client: institutionIsBlockedForCostReasons(institution)
70152
70243
  // Temporary workaround till backend/core is fixed
70153
70244
  },
70245
+ institutionStatus,
70154
70246
  consentIsEnabled: consentIsEnabled || false,
70155
70247
  additionalProductOption: connectConfig?.additional_product_option || null
70156
70248
  }
@@ -70443,6 +70535,7 @@ const formatUrl = (url) => {
70443
70535
 
70444
70536
  const InstitutionTile = (props) => {
70445
70537
  const { institution, selectInstitution, size } = props;
70538
+ const status = useInstitutionStatus(institution);
70446
70539
  const tokens = useTokens();
70447
70540
  const styles = getStyles$1p(tokens);
70448
70541
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
@@ -70497,7 +70590,8 @@ const InstitutionTile = (props) => {
70497
70590
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: styles.name, children: institution.name }),
70498
70591
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: styles.url, children: formatUrl(institution.url) })
70499
70592
  ] }),
70500
- institution.is_disabled_by_client && /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "secondary", label: __("DISABLED"), size: "small", sx: styles.chip })
70593
+ institution.is_disabled_by_client && /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "secondary", label: __("DISABLED"), size: "small", sx: styles.chip }),
70594
+ !institution.is_disabled_by_client && status === InstitutionStatus.UNAVAILABLE && /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "secondary", label: __("UNAVAILABLE"), size: "small", sx: styles.chip })
70501
70595
  ]
70502
70596
  }
70503
70597
  );
@@ -70559,7 +70653,8 @@ const getStyles$1p = (tokens) => {
70559
70653
  padding: `${tokens.Spacing.XTiny}px 0`,
70560
70654
  background: "#ECECEC",
70561
70655
  color: "#494949",
70562
- height: tokens.Spacing.Medium
70656
+ height: tokens.Spacing.Medium,
70657
+ fontSize: "9px"
70563
70658
  }
70564
70659
  };
70565
70660
  };
@@ -73276,6 +73371,8 @@ const Search$2 = React__default.forwardRef((_, navigationRef) => {
73276
73371
  const client = state2.profiles.client || {};
73277
73372
  return (clientProfile.uses_custom_popular_institution_list ?? false) || (client.has_limited_institutions ?? false);
73278
73373
  });
73374
+ const experimentalFeatures = useSelector(getExperimentalFeatures);
73375
+ const unavailableInstitutions = experimentalFeatures?.unavailableInstitutions || [];
73279
73376
  const MINIMUM_SEARCH_LENGTH = 2;
73280
73377
  const isFirstTimeUser = connectedMembers.length === 0;
73281
73378
  useImperativeHandle(navigationRef, () => {
@@ -73326,9 +73423,18 @@ const Search$2 = React__default.forwardRef((_, navigationRef) => {
73326
73423
  analyticType: INSTITUTION_TYPES.DISCOVERED
73327
73424
  };
73328
73425
  });
73426
+ const filteredPopularInstitutions = updatedPopularInstitutions.filter(
73427
+ (popular) => getInstitutionStatus(popular, unavailableInstitutions) !== InstitutionStatus.UNAVAILABLE
73428
+ );
73429
+ const filteredDiscoveredInstitutions = updatedDiscoveredInstitutions.filter(
73430
+ (discovered) => getInstitutionStatus(discovered, unavailableInstitutions) !== InstitutionStatus.UNAVAILABLE
73431
+ );
73329
73432
  return dispatch({
73330
73433
  type: SEARCH_ACTIONS.LOAD_SUCCESS,
73331
- payload: { updatedPopularInstitutions, updatedDiscoveredInstitutions }
73434
+ payload: {
73435
+ updatedPopularInstitutions: filteredPopularInstitutions,
73436
+ updatedDiscoveredInstitutions: filteredDiscoveredInstitutions
73437
+ }
73332
73438
  });
73333
73439
  },
73334
73440
  (error) => {
@@ -74823,6 +74929,7 @@ const InstitutionStatusDetails = React__default.forwardRef(
74823
74929
  const containerRef = React__default.useRef(null);
74824
74930
  const postMessageFunctions = useContext(PostMessageContext);
74825
74931
  const institution = useSelector(getSelectedInstitution);
74932
+ const message = useInstitutionStatusMessage(institution);
74826
74933
  const initialConfig = useSelector(selectInitialConfig);
74827
74934
  const dispatch = useDispatch();
74828
74935
  const styles = getStyles$_();
@@ -74860,11 +74967,8 @@ const InstitutionStatusDetails = React__default.forwardRef(
74860
74967
  ),
74861
74968
  /* @__PURE__ */ jsxRuntimeExports.jsx(M, { color: "error", fill: true, name: "error", size: 32, sx: styles.icon })
74862
74969
  ] }),
74863
- /* @__PURE__ */ jsxRuntimeExports.jsx(G0, { sx: styles.title, truncate: false, children: __("Free %1 Connections Are No Longer Available", institution.name) }),
74864
- /* @__PURE__ */ jsxRuntimeExports.jsx(U0, { sx: styles.body, truncate: false, children: __(
74865
- "%1 now charges a fee for us to access your account data. To avoid passing that cost on to you, we no longer support %1 connections.",
74866
- institution.name
74867
- ) }),
74970
+ /* @__PURE__ */ jsxRuntimeExports.jsx(G0, { sx: styles.title, truncate: false, children: message.title }),
74971
+ /* @__PURE__ */ jsxRuntimeExports.jsx(U0, { sx: styles.body, truncate: false, children: message.body }),
74868
74972
  /* @__PURE__ */ jsxRuntimeExports.jsx(
74869
74973
  Button$2,
74870
74974
  {
@@ -79967,13 +80071,13 @@ LoginError.displayName = "LoginError";
79967
80071
 
79968
80072
  const useActionableErrorMap = (jobDetailCode, setShowSupport) => {
79969
80073
  const postMessageFunctions = useContext(PostMessageContext);
79970
- const initialConfig = useSelector((state) => state.connect.initialConfig);
80074
+ const initialConfig = useSelector(selectInitialConfig);
79971
80075
  const dispatch = useDispatch();
79972
80076
  const goToSearch = () => {
79973
80077
  postMessageFunctions.onPostMessage("connect/backToSearch");
79974
80078
  dispatch({
79975
80079
  type: ActionTypes$2.ACTIONABLE_ERROR_CONNECT_DIFFERENT_INSTITUTION,
79976
- payload: initialConfig.mode
80080
+ payload: initialConfig.mode || AGG_MODE
79977
80081
  });
79978
80082
  };
79979
80083
  const goToSupport = () => setShowSupport(true);
@@ -87688,6 +87792,7 @@ const Connect$2 = ({
87688
87792
  loadConnect(props.clientConfig);
87689
87793
  dispatch(loadProfiles(props.profiles));
87690
87794
  dispatch(loadUserFeatures(props.userFeatures));
87795
+ dispatch(loadExperimentalFeatures(props?.experimentalFeatures || {}));
87691
87796
  if (hasAtriumAPI && isMobileWebview && uiMessageVersion < 4) {
87692
87797
  window.location = "atrium://mxConnectLoaded";
87693
87798
  } else if (hasAtriumAPI && uiMessageVersion < 4) {