@mxenabled/connect-widget 2.5.5 → 2.6.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
@@ -9164,8 +9164,27 @@ const { addVerificationData, addAggregationData, additionalProductReset } = conf
9164
9164
  const configSlice$1 = configSlice.reducer;
9165
9165
 
9166
9166
  const ACTIONABLE_ERROR_CODES = {
9167
- NO_ELIGIBLE_ACCOUNTS: 1e3
9168
- };
9167
+ NO_ELIGIBLE_ACCOUNTS: 1e3,
9168
+ NO_ACCOUNTS: 1001,
9169
+ ACCESS_DENIED: 1002,
9170
+ INCORRECT_OTP: 2001,
9171
+ INCORRECT_MFA: 2002,
9172
+ MFA_TIMEOUT: 2003,
9173
+ REAUTHORIZATION_REQUIRED: 2004,
9174
+ INVALID_CREDENTIALS: 2005,
9175
+ INSTITUTION_DOWN: 3e3,
9176
+ INSTITUTION_MAINTENANCE: 3001,
9177
+ INSTITUTION_UNAVAILABLE: 3002
9178
+ };
9179
+ const CODES_REQUIRING_CREDENTIALS = [
9180
+ ACTIONABLE_ERROR_CODES.INVALID_CREDENTIALS,
9181
+ ACTIONABLE_ERROR_CODES.REAUTHORIZATION_REQUIRED
9182
+ ];
9183
+ const CODES_REQUIRING_MFA = [
9184
+ ACTIONABLE_ERROR_CODES.INCORRECT_OTP,
9185
+ ACTIONABLE_ERROR_CODES.INCORRECT_MFA,
9186
+ ACTIONABLE_ERROR_CODES.MFA_TIMEOUT
9187
+ ];
9169
9188
  const ACTIVE_ACTIONABLE_ERROR_CODES = Object.values(ACTIONABLE_ERROR_CODES);
9170
9189
  const canHandleActionableError = (errorCode, mode) => {
9171
9190
  if (errorCode === ACTIONABLE_ERROR_CODES.NO_ELIGIBLE_ACCOUNTS && mode !== VERIFY_MODE) {
@@ -9615,9 +9634,12 @@ function getStepFromMember(member, mode = AGG_MODE) {
9615
9634
  const connection_status = member.connection_status;
9616
9635
  if (member && memberIsBlockedForCostReasons(member)) {
9617
9636
  return STEPS.INSTITUTION_DISABLED;
9618
- } else if (member?.error?.error_code && canHandleActionableError(member?.error?.error_code, mode) || hasNoSingleAccountSelectOptions(member))
9619
- return STEPS.ACTIONABLE_ERROR;
9620
- else if (connection_status === ReadableStatuses$1.CHALLENGED)
9637
+ } else if (member?.error?.error_code && canHandleActionableError(member?.error?.error_code, mode) || hasNoSingleAccountSelectOptions(member)) {
9638
+ const errorCode = member?.error?.error_code;
9639
+ if (CODES_REQUIRING_CREDENTIALS.includes(errorCode)) return STEPS.ENTER_CREDENTIALS;
9640
+ if (CODES_REQUIRING_MFA.includes(errorCode)) return STEPS.MFA;
9641
+ else return STEPS.ACTIONABLE_ERROR;
9642
+ } else if (connection_status === ReadableStatuses$1.CHALLENGED)
9621
9643
  return STEPS.MFA;
9622
9644
  else if (connection_status === ReadableStatuses$1.CONNECTED)
9623
9645
  return STEPS.CONNECTED;
@@ -70375,8 +70397,8 @@ const VIEWS$2 = {
70375
70397
  GENERAL_SUPPORT: "generalSupport",
70376
70398
  SUCCESS: "success"
70377
70399
  };
70378
- const Support = React__default.forwardRef((props, supportNavRef) => {
70379
- const { loadToView, onClose } = props;
70400
+ const Support$1 = React__default.forwardRef((props, supportNavRef) => {
70401
+ const { loadToView = VIEWS$2.MENU, onClose } = props;
70380
70402
  const [currentView, setCurrentView] = useState(loadToView);
70381
70403
  const [email, setEmail] = useState("");
70382
70404
  const [ariaLiveRegionMessage, setAriaLiveRegionMessage] = useState("");
@@ -70469,14 +70491,11 @@ const getStyles$15 = (tokens) => ({
70469
70491
  margin: "0 auto 0 auto"
70470
70492
  }
70471
70493
  });
70472
- Support.propTypes = {
70494
+ Support$1.propTypes = {
70473
70495
  loadToView: PropTypes$1.oneOf([VIEWS$2.MENU, VIEWS$2.REQ_INSTITUTION, VIEWS$2.GENERAL_SUPPORT]),
70474
70496
  onClose: PropTypes$1.func.isRequired
70475
70497
  };
70476
- Support.defaultPops = {
70477
- loadToView: VIEWS$2.MENU
70478
- };
70479
- Support.displayName = "Support";
70498
+ Support$1.displayName = "Support";
70480
70499
 
70481
70500
  const focusElement = (element) => {
70482
70501
  if (element && "focus" in element) {
@@ -70710,7 +70729,7 @@ const Search$2 = React__default.forwardRef((props, navigationRef) => {
70710
70729
  }
70711
70730
  if (state.showSupportView) {
70712
70731
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
70713
- Support,
70732
+ Support$1,
70714
70733
  {
70715
70734
  loadToView: VIEWS$2.REQ_INSTITUTION,
70716
70735
  onClose: () => dispatch({ type: SEARCH_ACTIONS.HIDE_SUPPORT }),
@@ -72070,7 +72089,7 @@ const MFAStep = React__default.forwardRef((props, navigationRef) => {
72070
72089
  }, [isSubmitting]);
72071
72090
  if (showSupportView) {
72072
72091
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
72073
- Support,
72092
+ Support$1,
72074
72093
  {
72075
72094
  loadToView: VIEWS$2.GENERAL_SUPPORT,
72076
72095
  onClose: () => setShowSupportView(false),
@@ -75230,6 +75249,18 @@ const buildFormSchema = (loginFields) => {
75230
75249
  };
75231
75250
  }, {});
75232
75251
  };
75252
+ const shouldShowMessageBox = (error, currentMember, mode = AGG_MODE) => {
75253
+ const noErrors = _isEmpty(error);
75254
+ const isDenied = currentMember.connection_status === ReadableStatuses$1.DENIED;
75255
+ const isErrorCodeCredentialRelated = currentMember?.error?.error_code && canHandleActionableError(currentMember?.error?.error_code, mode);
75256
+ if (noErrors && isDenied) {
75257
+ return true;
75258
+ } else if (isErrorCodeCredentialRelated) {
75259
+ return true;
75260
+ } else {
75261
+ return false;
75262
+ }
75263
+ };
75233
75264
 
75234
75265
  const CREDENTIAL_FIELD_TYPES = {
75235
75266
  PASSWORD: 1};
@@ -75550,7 +75581,7 @@ const Credentials = React__default.forwardRef(
75550
75581
  ]);
75551
75582
  if (showSupportView) {
75552
75583
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
75553
- Support,
75584
+ Support$1,
75554
75585
  {
75555
75586
  loadToView: VIEWS$2.MENU,
75556
75587
  onClose: () => setShowSupportView(false),
@@ -75636,7 +75667,7 @@ const Credentials = React__default.forwardRef(
75636
75667
  }
75637
75668
  ),
75638
75669
  !_isEmpty(error) && /* @__PURE__ */ jsxRuntimeExports.jsx(SlideDown, { delay: getNextDelay(), children: /* @__PURE__ */ jsxRuntimeExports.jsx(MemberError, { error, institution }) }),
75639
- _isEmpty(error) && currentMember.connection_status === ReadableStatuses$1.DENIED && /* @__PURE__ */ jsxRuntimeExports.jsx(SlideDown, { delay: getNextDelay(), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
75670
+ shouldShowMessageBox(error, currentMember, connectConfig.mode) && /* @__PURE__ */ jsxRuntimeExports.jsx(SlideDown, { delay: getNextDelay(), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
75640
75671
  MessageBox,
75641
75672
  {
75642
75673
  "data-test": "credentials-error-message-box",
@@ -77063,7 +77094,7 @@ const LoginError = React__default.forwardRef(
77063
77094
  const statusActions = memberStatusActionsMap[member.connection_status] || defaultMemberStatusAction;
77064
77095
  if (showSupportView) {
77065
77096
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
77066
- Support,
77097
+ Support$1,
77067
77098
  {
77068
77099
  loadToView: VIEWS$2.GENERAL_SUPPORT,
77069
77100
  onClose: () => setShowSupportView(false),
@@ -77118,38 +77149,69 @@ LoginError.propTypes = {
77118
77149
  };
77119
77150
  LoginError.displayName = "LoginError";
77120
77151
 
77121
- const ActionableError = () => {
77152
+ const useActionableErrorMap = (jobDetailCode, setShowSupport) => {
77122
77153
  const postMessageFunctions = useContext(PostMessageContext);
77123
- const institution = useSelector((state) => state.connect.selectedInstitution);
77124
- const currentMember = useSelector(getCurrentMember);
77125
- const initialConfig = useSelector(selectInitialConfig);
77126
- const jobDetailCode = currentMember.error.error_code;
77127
- const tokens = useTokens();
77128
- const styles = getStyles$A(tokens);
77129
- const getNextDelay = getDelay();
77154
+ const initialConfig = useSelector((state) => state.connect.initialConfig);
77130
77155
  const dispatch = useDispatch();
77156
+ const goToSearch = () => {
77157
+ postMessageFunctions.onPostMessage("connect/backToSearch");
77158
+ dispatch({
77159
+ type: ActionTypes$2.ACTIONABLE_ERROR_CONNECT_DIFFERENT_INSTITUTION,
77160
+ payload: initialConfig.mode
77161
+ });
77162
+ };
77163
+ const goToSupport = () => setShowSupport(true);
77164
+ const goToCredentials = () => dispatch({ type: ActionTypes$2.ACTIONABLE_ERROR_LOG_IN_AGAIN });
77131
77165
  const messagingMap = useMemo(
77132
77166
  () => ({
77133
77167
  [ACTIONABLE_ERROR_CODES.NO_ELIGIBLE_ACCOUNTS]: {
77134
77168
  title: __("No eligible accounts"),
77135
- primaryAction: {
77136
- label: __("Log in again"),
77137
- action: () => dispatch({ type: ActionTypes$2.ACTIONABLE_ERROR_LOG_IN_AGAIN })
77138
- },
77139
- secondaryActions: {
77140
- label: __("Connect a different institution"),
77141
- action: () => {
77142
- postMessageFunctions.onPostMessage("connect/backToSearch");
77143
- dispatch({
77144
- type: ActionTypes$2.ACTIONABLE_ERROR_CONNECT_DIFFERENT_INSTITUTION,
77145
- payload: initialConfig.mode
77146
- });
77147
- }
77148
- }
77169
+ primaryAction: { label: __("Log in again"), action: goToCredentials },
77170
+ secondaryActions: { label: __("Connect a different institution"), action: goToSearch }
77171
+ },
77172
+ [ACTIONABLE_ERROR_CODES.NO_ACCOUNTS]: {
77173
+ title: __("No accounts found"),
77174
+ primaryAction: { label: __("Return to institution selection"), action: goToSearch },
77175
+ secondaryActions: { label: __("Get help"), action: goToSupport }
77176
+ },
77177
+ [ACTIONABLE_ERROR_CODES.ACCESS_DENIED]: {
77178
+ title: __("Additional permissions needed"),
77179
+ primaryAction: { label: __("Review instructions"), action: goToCredentials },
77180
+ secondaryActions: { label: __("Get help"), action: goToSupport }
77181
+ },
77182
+ [ACTIONABLE_ERROR_CODES.INSTITUTION_DOWN]: {
77183
+ title: __("Unable to connect"),
77184
+ primaryAction: { label: __("Return to institution selection"), action: goToSearch },
77185
+ secondaryActions: { label: __("Get help"), action: goToSupport }
77186
+ },
77187
+ [ACTIONABLE_ERROR_CODES.INSTITUTION_MAINTENANCE]: {
77188
+ title: __("Maintenance in progress"),
77189
+ primaryAction: { label: __("Return to institution selection"), action: goToSearch },
77190
+ secondaryActions: { label: __("Get help"), action: goToSupport }
77191
+ },
77192
+ [ACTIONABLE_ERROR_CODES.INSTITUTION_UNAVAILABLE]: {
77193
+ title: __("Unable to connect"),
77194
+ primaryAction: { label: __("Return to institution selection"), action: goToSearch },
77195
+ secondaryActions: { label: __("Get help"), action: goToSupport }
77149
77196
  }
77150
77197
  }),
77151
77198
  [dispatch]
77152
77199
  );
77200
+ return messagingMap[jobDetailCode];
77201
+ };
77202
+
77203
+ const Support = Support$1;
77204
+ const ActionableError = () => {
77205
+ const supportNavRef = useRef(null);
77206
+ const postMessageFunctions = useContext(PostMessageContext);
77207
+ const institution = useSelector((state) => state.connect.selectedInstitution);
77208
+ const currentMember = useSelector(getCurrentMember);
77209
+ const jobDetailCode = currentMember.error.error_code;
77210
+ const tokens = useTokens();
77211
+ const styles = getStyles$A(tokens);
77212
+ const getNextDelay = getDelay();
77213
+ const [showSupport, setShowSupport] = React__default.useState(false);
77214
+ const errorDetails = useActionableErrorMap(jobDetailCode, setShowSupport);
77153
77215
  useEffect(() => {
77154
77216
  postMessageFunctions.onPostMessage("connect/invalidData", {
77155
77217
  member: {
@@ -77158,7 +77220,14 @@ const ActionableError = () => {
77158
77220
  }
77159
77221
  });
77160
77222
  }, [jobDetailCode]);
77161
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
77223
+ return showSupport ? /* @__PURE__ */ jsxRuntimeExports.jsx(
77224
+ Support,
77225
+ {
77226
+ loadToView: VIEWS$2.GENERAL_SUPPORT,
77227
+ onClose: () => setShowSupport(false),
77228
+ ref: supportNavRef
77229
+ }
77230
+ ) : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
77162
77231
  /* @__PURE__ */ jsxRuntimeExports.jsx(SlideDown, { delay: getNextDelay(), children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: styles.logoWrapper, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Badge, { badgeContent: "!", color: "error", sx: styles.badge, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
77163
77232
  K0,
77164
77233
  {
@@ -77176,7 +77245,7 @@ const ActionableError = () => {
77176
77245
  style: styles.title,
77177
77246
  truncate: false,
77178
77247
  variant: "H2",
77179
- children: messagingMap[jobDetailCode].title
77248
+ children: errorDetails?.title
77180
77249
  }
77181
77250
  ),
77182
77251
  /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -77197,10 +77266,10 @@ const ActionableError = () => {
77197
77266
  {
77198
77267
  "data-test": "actionable-error-primary-button",
77199
77268
  fullWidth: true,
77200
- onClick: messagingMap[jobDetailCode].primaryAction.action,
77269
+ onClick: errorDetails?.primaryAction.action,
77201
77270
  style: { marginBottom: 8 },
77202
77271
  variant: "contained",
77203
- children: messagingMap[jobDetailCode].primaryAction.label
77272
+ children: errorDetails?.primaryAction.label
77204
77273
  }
77205
77274
  ),
77206
77275
  /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -77208,10 +77277,10 @@ const ActionableError = () => {
77208
77277
  {
77209
77278
  "data-test": "actionable-error-secondary-button",
77210
77279
  fullWidth: true,
77211
- onClick: messagingMap[jobDetailCode].secondaryActions.action,
77280
+ onClick: errorDetails?.secondaryActions.action,
77212
77281
  style: { marginBottom: 8 },
77213
77282
  variant: "text",
77214
- children: messagingMap[jobDetailCode].secondaryActions.label
77283
+ children: errorDetails?.secondaryActions.label
77215
77284
  }
77216
77285
  )
77217
77286
  ] })
@@ -80828,32 +80897,32 @@ const AccountTypes = {
80828
80897
  CHECKING_LINE_OF_CREDIT: 12
80829
80898
  };
80830
80899
  const AccountTypeNames = [
80831
- __("Other"),
80832
- _p("AccountType", "Checking"),
80833
- __("Savings"),
80834
- __("Loan"),
80835
- __("Credit Card"),
80836
- __("Investment"),
80837
- __("Line of Credit"),
80838
- __("Mortgage"),
80839
- __("Property"),
80840
- __("Cash"),
80841
- __("Insurance"),
80842
- __("Prepaid"),
80843
- _p("AccountType", "Checking")
80900
+ () => __("Other"),
80901
+ () => _p("AccountType", "Checking"),
80902
+ () => __("Savings"),
80903
+ () => __("Loan"),
80904
+ () => __("Credit Card"),
80905
+ () => __("Investment"),
80906
+ () => __("Line of Credit"),
80907
+ () => __("Mortgage"),
80908
+ () => __("Property"),
80909
+ () => __("Cash"),
80910
+ () => __("Insurance"),
80911
+ () => __("Prepaid"),
80912
+ () => _p("AccountType", "Checking")
80844
80913
  // Checking line of credit will be referred to as a checking account
80845
80914
  ];
80846
80915
  const PropertyTypeNames = [
80847
- __("Real Estate"),
80848
- __("Vehicle"),
80849
- __("Art"),
80850
- __("Jewelry"),
80851
- __("Furniture"),
80852
- __("Appliances"),
80853
- __("Computer"),
80854
- __("Electronics"),
80855
- __("Sports Equipment"),
80856
- __("Miscellaneous")
80916
+ () => __("Real Estate"),
80917
+ () => __("Vehicle"),
80918
+ () => __("Art"),
80919
+ () => __("Jewelry"),
80920
+ () => __("Furniture"),
80921
+ () => __("Appliances"),
80922
+ () => __("Computer"),
80923
+ () => __("Electronics"),
80924
+ () => __("Sports Equipment"),
80925
+ () => __("Miscellaneous")
80857
80926
  ];
80858
80927
 
80859
80928
  const getFormFields = (accountType) => {
@@ -80950,7 +81019,7 @@ const propertyTypeOptions = () => {
80950
81019
  const types = [];
80951
81020
  PropertyTypeNames.map((name, i) => {
80952
81021
  types.push({
80953
- label: name,
81022
+ label: name(),
80954
81023
  value: i.toString()
80955
81024
  });
80956
81025
  });
@@ -81419,7 +81488,7 @@ const ManualAccountForm = React__default.forwardRef(
81419
81488
  style: styles.icon
81420
81489
  }
81421
81490
  ),
81422
- AccountTypeNames[props.accountType || 0]
81491
+ AccountTypeNames[props.accountType || 0]()
81423
81492
  ]
81424
81493
  }
81425
81494
  ) }),
@@ -81648,13 +81717,13 @@ const ManualAccountMenu = React__default.forwardRef((props, ref) => {
81648
81717
  /* @__PURE__ */ jsxRuntimeExports.jsx(SlideDown, { delay: getNextDelay(), children: typeList.map((account_type, i) => /* @__PURE__ */ jsxRuntimeExports.jsx(
81649
81718
  UtilityRow,
81650
81719
  {
81651
- "aria-label": AccountTypeNames[account_type],
81720
+ "aria-label": AccountTypeNames[account_type](),
81652
81721
  borderType: "inset-left",
81653
- "data-test": `${AccountTypeNames[account_type].replace(/\s+/g, "-")}-button`,
81722
+ "data-test": `${AccountTypeNames[account_type]().replace(/\s+/g, "-")}-button`,
81654
81723
  leftChildren: getIcon[account_type],
81655
81724
  onClick: () => fadeOut(ref.current, "up", 300).then(props.handleAccountTypeSelect(account_type)),
81656
81725
  rightChildren: /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronRight, {}),
81657
- title: AccountTypeNames[account_type]
81726
+ title: AccountTypeNames[account_type]()
81658
81727
  },
81659
81728
  i
81660
81729
  )) })
@@ -81713,7 +81782,7 @@ const ManualAccountSuccess = (props) => {
81713
81782
  style: styles.title,
81714
81783
  truncate: false,
81715
81784
  variant: "H2",
81716
- children: __("%1 added", AccountTypeNames[props.accountType])
81785
+ children: __("%1 added", AccountTypeNames[props.accountType]())
81717
81786
  }
81718
81787
  ),
81719
81788
  /* @__PURE__ */ jsxRuntimeExports.jsx(