@mxenabled/connect-widget 2.14.2 → 2.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js CHANGED
@@ -9005,7 +9005,7 @@ const COMBO_JOB_DATA_TYPES = {
9005
9005
  TRANSACTIONS: "transactions",
9006
9006
  REWARDS: "rewards"};
9007
9007
 
9008
- const initialState$6 = {
9008
+ const initialState$7 = {
9009
9009
  _initialValues: "",
9010
9010
  is_mobile_webview: false,
9011
9011
  target_origin_referrer: null,
@@ -9034,7 +9034,7 @@ const initialState$6 = {
9034
9034
  };
9035
9035
  const configSlice = createSlice({
9036
9036
  name: "config",
9037
- initialState: initialState$6,
9037
+ initialState: initialState$7,
9038
9038
  reducers: {
9039
9039
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
9040
9040
  addVerificationData: (state, _) => {
@@ -9174,9 +9174,9 @@ function _additionalProductReset(state) {
9174
9174
  const initialValuesObject = convertInitialValuesToObject(state._initialValues);
9175
9175
  return {
9176
9176
  ...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
9177
+ include_transactions: initialValuesObject?.include_transactions ?? initialState$7.include_transactions,
9178
+ mode: initialValuesObject?.mode ?? initialState$7.mode,
9179
+ use_cases: initialValuesObject?.use_cases ?? initialState$7.use_cases
9180
9180
  };
9181
9181
  }
9182
9182
  const { addVerificationData, addAggregationData, additionalProductReset } = configSlice.actions;
@@ -9234,6 +9234,79 @@ function institutionIsBlockedForCostReasons(institution) {
9234
9234
  return isChase && institution?.is_disabled_by_client === true;
9235
9235
  }
9236
9236
 
9237
+ const initialState$6 = {
9238
+ unavailableInstitutions: []
9239
+ };
9240
+ const experimentalFeaturesSlice = createSlice({
9241
+ name: "experimentalFeatures",
9242
+ initialState: initialState$6,
9243
+ reducers: {
9244
+ loadExperimentalFeatures(state, action) {
9245
+ state.unavailableInstitutions = action.payload?.unavailableInstitutions || [];
9246
+ }
9247
+ }
9248
+ });
9249
+ const getExperimentalFeatures = (state) => state.experimentalFeatures;
9250
+ const { loadExperimentalFeatures } = experimentalFeaturesSlice.actions;
9251
+ const experimentalFeaturesSlice$1 = experimentalFeaturesSlice.reducer;
9252
+
9253
+ const InstitutionStatus = {
9254
+ CLIENT_BLOCKED_FOR_FEES: "CLIENT_BLOCKED_FOR_FEES",
9255
+ OPERATIONAL: "OPERATIONAL",
9256
+ UNAVAILABLE: "UNAVAILABLE"
9257
+ };
9258
+ function useInstitutionStatusMessage(institution) {
9259
+ const { unavailableInstitutions } = useSelector(getExperimentalFeatures);
9260
+ const status = useInstitutionStatus(institution);
9261
+ if (!institution || !institution.name || !institution.guid) {
9262
+ throw new Error("Selected institution is not defined or missing name and guid");
9263
+ }
9264
+ if (!unavailableInstitutions || !Array.isArray(unavailableInstitutions)) {
9265
+ throw new Error("Experimental feature unavailableInstitutions is not defined or not an array");
9266
+ }
9267
+ switch (status) {
9268
+ case InstitutionStatus.CLIENT_BLOCKED_FOR_FEES:
9269
+ return {
9270
+ title: __("Free %1 Connections Are No Longer Available", institution.name),
9271
+ body: __(
9272
+ "%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.",
9273
+ institution.name
9274
+ )
9275
+ };
9276
+ case InstitutionStatus.UNAVAILABLE:
9277
+ return {
9278
+ title: __("Connection not supported by %1", institution.name),
9279
+ body: __(
9280
+ "%1 currently limits how your data can be shared. We'll enable this connection once %1 opens access.",
9281
+ institution.name
9282
+ )
9283
+ };
9284
+ default:
9285
+ return {
9286
+ title: "",
9287
+ body: ""
9288
+ };
9289
+ }
9290
+ }
9291
+ function useInstitutionStatus(institution) {
9292
+ const { unavailableInstitutions } = useSelector(getExperimentalFeatures);
9293
+ return getInstitutionStatus(institution, unavailableInstitutions || []);
9294
+ }
9295
+ function getInstitutionStatus(institution, unavailableInstitutions) {
9296
+ if (!institution || !Array.isArray(unavailableInstitutions)) {
9297
+ return InstitutionStatus.OPERATIONAL;
9298
+ }
9299
+ if (institutionIsBlockedForCostReasons(institution)) {
9300
+ return InstitutionStatus.CLIENT_BLOCKED_FOR_FEES;
9301
+ }
9302
+ if (unavailableInstitutions.some(
9303
+ (unavailable) => institution?.name === unavailable.name || institution?.guid === unavailable.guid
9304
+ )) {
9305
+ return InstitutionStatus.UNAVAILABLE;
9306
+ }
9307
+ return InstitutionStatus.OPERATIONAL;
9308
+ }
9309
+
9237
9310
  const defaultState$1 = {
9238
9311
  error: null,
9239
9312
  // The most recent job request error, if any
@@ -9442,7 +9515,7 @@ const selectInstitutionSuccess = (state, action) => {
9442
9515
  let nextStep = STEPS.ENTER_CREDENTIALS;
9443
9516
  const canOfferVerification = action.payload.institution?.account_verification_is_enabled && action.payload.additionalProductOption === COMBO_JOB_DATA_TYPES.ACCOUNT_NUMBER;
9444
9517
  const canOfferAggregation = action.payload.additionalProductOption === COMBO_JOB_DATA_TYPES.TRANSACTIONS;
9445
- if (action.payload.institution && institutionIsBlockedForCostReasons(action.payload.institution)) {
9518
+ if (action.payload.institution && (institutionIsBlockedForCostReasons(action.payload.institution) || action.payload.institutionStatus === InstitutionStatus.UNAVAILABLE)) {
9446
9519
  nextStep = STEPS.INSTITUTION_STATUS_DETAILS;
9447
9520
  } else if (canOfferVerification || canOfferAggregation) {
9448
9521
  nextStep = STEPS.ADDITIONAL_PRODUCT;
@@ -13241,6 +13314,7 @@ const rootReducer = combineReducers({
13241
13314
  browser,
13242
13315
  config: configSlice$1,
13243
13316
  connect,
13317
+ experimentalFeatures: experimentalFeaturesSlice$1,
13244
13318
  localizedContent: localizedContentSlice$1,
13245
13319
  profiles: profilesSlice$1,
13246
13320
  userFeatures: userFeaturesSlice$1
@@ -70129,6 +70203,7 @@ const useApi = () => {
70129
70203
  const useSelectInstitution = () => {
70130
70204
  const { api } = useApi();
70131
70205
  const [institution, setInstitution] = useState(null);
70206
+ const institutionStatus = useInstitutionStatus(institution);
70132
70207
  const dispatch = useDispatch();
70133
70208
  const consentIsEnabled = useSelector((state) => isConsentEnabled(state));
70134
70209
  const connectConfig = useSelector(selectConnectConfig);
@@ -70151,6 +70226,7 @@ const useSelectInstitution = () => {
70151
70226
  is_disabled_by_client: institutionIsBlockedForCostReasons(institution)
70152
70227
  // Temporary workaround till backend/core is fixed
70153
70228
  },
70229
+ institutionStatus,
70154
70230
  consentIsEnabled: consentIsEnabled || false,
70155
70231
  additionalProductOption: connectConfig?.additional_product_option || null
70156
70232
  }
@@ -70443,6 +70519,7 @@ const formatUrl = (url) => {
70443
70519
 
70444
70520
  const InstitutionTile = (props) => {
70445
70521
  const { institution, selectInstitution, size } = props;
70522
+ const status = useInstitutionStatus(institution);
70446
70523
  const tokens = useTokens();
70447
70524
  const styles = getStyles$1p(tokens);
70448
70525
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
@@ -70497,7 +70574,8 @@ const InstitutionTile = (props) => {
70497
70574
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: styles.name, children: institution.name }),
70498
70575
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: styles.url, children: formatUrl(institution.url) })
70499
70576
  ] }),
70500
- institution.is_disabled_by_client && /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "secondary", label: __("DISABLED"), size: "small", sx: styles.chip })
70577
+ institution.is_disabled_by_client && /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "secondary", label: __("DISABLED"), size: "small", sx: styles.chip }),
70578
+ !institution.is_disabled_by_client && status === InstitutionStatus.UNAVAILABLE && /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "secondary", label: __("UNAVAILABLE"), size: "small", sx: styles.chip })
70501
70579
  ]
70502
70580
  }
70503
70581
  );
@@ -70559,7 +70637,8 @@ const getStyles$1p = (tokens) => {
70559
70637
  padding: `${tokens.Spacing.XTiny}px 0`,
70560
70638
  background: "#ECECEC",
70561
70639
  color: "#494949",
70562
- height: tokens.Spacing.Medium
70640
+ height: tokens.Spacing.Medium,
70641
+ fontSize: "9px"
70563
70642
  }
70564
70643
  };
70565
70644
  };
@@ -73276,6 +73355,8 @@ const Search$2 = React__default.forwardRef((_, navigationRef) => {
73276
73355
  const client = state2.profiles.client || {};
73277
73356
  return (clientProfile.uses_custom_popular_institution_list ?? false) || (client.has_limited_institutions ?? false);
73278
73357
  });
73358
+ const experimentalFeatures = useSelector(getExperimentalFeatures);
73359
+ const unavailableInstitutions = experimentalFeatures?.unavailableInstitutions || [];
73279
73360
  const MINIMUM_SEARCH_LENGTH = 2;
73280
73361
  const isFirstTimeUser = connectedMembers.length === 0;
73281
73362
  useImperativeHandle(navigationRef, () => {
@@ -73326,9 +73407,18 @@ const Search$2 = React__default.forwardRef((_, navigationRef) => {
73326
73407
  analyticType: INSTITUTION_TYPES.DISCOVERED
73327
73408
  };
73328
73409
  });
73410
+ const filteredPopularInstitutions = updatedPopularInstitutions.filter(
73411
+ (popular) => getInstitutionStatus(popular, unavailableInstitutions) !== InstitutionStatus.UNAVAILABLE
73412
+ );
73413
+ const filteredDiscoveredInstitutions = updatedDiscoveredInstitutions.filter(
73414
+ (discovered) => getInstitutionStatus(discovered, unavailableInstitutions) !== InstitutionStatus.UNAVAILABLE
73415
+ );
73329
73416
  return dispatch({
73330
73417
  type: SEARCH_ACTIONS.LOAD_SUCCESS,
73331
- payload: { updatedPopularInstitutions, updatedDiscoveredInstitutions }
73418
+ payload: {
73419
+ updatedPopularInstitutions: filteredPopularInstitutions,
73420
+ updatedDiscoveredInstitutions: filteredDiscoveredInstitutions
73421
+ }
73332
73422
  });
73333
73423
  },
73334
73424
  (error) => {
@@ -74823,6 +74913,7 @@ const InstitutionStatusDetails = React__default.forwardRef(
74823
74913
  const containerRef = React__default.useRef(null);
74824
74914
  const postMessageFunctions = useContext(PostMessageContext);
74825
74915
  const institution = useSelector(getSelectedInstitution);
74916
+ const message = useInstitutionStatusMessage(institution);
74826
74917
  const initialConfig = useSelector(selectInitialConfig);
74827
74918
  const dispatch = useDispatch();
74828
74919
  const styles = getStyles$_();
@@ -74860,11 +74951,8 @@ const InstitutionStatusDetails = React__default.forwardRef(
74860
74951
  ),
74861
74952
  /* @__PURE__ */ jsxRuntimeExports.jsx(M, { color: "error", fill: true, name: "error", size: 32, sx: styles.icon })
74862
74953
  ] }),
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
- ) }),
74954
+ /* @__PURE__ */ jsxRuntimeExports.jsx(G0, { sx: styles.title, truncate: false, children: message.title }),
74955
+ /* @__PURE__ */ jsxRuntimeExports.jsx(U0, { sx: styles.body, truncate: false, children: message.body }),
74868
74956
  /* @__PURE__ */ jsxRuntimeExports.jsx(
74869
74957
  Button$2,
74870
74958
  {
@@ -87688,6 +87776,7 @@ const Connect$2 = ({
87688
87776
  loadConnect(props.clientConfig);
87689
87777
  dispatch(loadProfiles(props.profiles));
87690
87778
  dispatch(loadUserFeatures(props.userFeatures));
87779
+ dispatch(loadExperimentalFeatures(props?.experimentalFeatures || {}));
87691
87780
  if (hasAtriumAPI && isMobileWebview && uiMessageVersion < 4) {
87692
87781
  window.location = "atrium://mxConnectLoaded";
87693
87782
  } else if (hasAtriumAPI && uiMessageVersion < 4) {