@mxenabled/connect-widget 0.20.6 → 1.0.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
@@ -9191,7 +9191,7 @@ const loadConnect = (state, { payload }) => {
9191
9191
  };
9192
9192
  const loadConnectSuccess = (state, action) => {
9193
9193
  const {
9194
- members,
9194
+ members = [],
9195
9195
  member,
9196
9196
  microdeposit,
9197
9197
  config = {},
@@ -9560,7 +9560,7 @@ function getStartingStep(members, member, microdeposit, config, institution, wid
9560
9560
  }
9561
9561
  function getStepFromMember(member) {
9562
9562
  const connection_status = member.connection_status;
9563
- if (member?.most_recent_job_detail_code && canHandleActionableError(member?.most_recent_job_detail_code) || hasNoSingleAccountSelectOptions(member))
9563
+ if (member?.error?.error_code && canHandleActionableError(member?.error?.error_code) || hasNoSingleAccountSelectOptions(member))
9564
9564
  return STEPS.ACTIONABLE_ERROR;
9565
9565
  else if (connection_status === ReadableStatuses$1.CHALLENGED)
9566
9566
  return STEPS.MFA;
@@ -66683,11 +66683,23 @@ const MFAOptions = (props) => {
66683
66683
  );
66684
66684
  });
66685
66685
  }),
66686
- /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { style: { color: "#666", fontSize: 13, marginBottom: 12 }, children: [
66687
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { style: { color: "#E32727", fontSize: 13 }, children: "*" }),
66688
- " ",
66689
- __("Required")
66690
- ] }),
66686
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(
66687
+ "span",
66688
+ {
66689
+ style: {
66690
+ color: "#666",
66691
+ fontSize: tokens.FontSize.Small,
66692
+ marginBottom: tokens.Spacing.XSmall,
66693
+ display: "inline-block",
66694
+ marginTop: tokens.Spacing.Tiny
66695
+ },
66696
+ children: [
66697
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { style: { color: "#E32727", fontSize: 13 }, children: "*" }),
66698
+ " ",
66699
+ __("Required")
66700
+ ]
66701
+ }
66702
+ ),
66691
66703
  isSubmitted && _isEmpty(selectedOption) && /* @__PURE__ */ jsxRuntimeExports.jsxs("section", { role: "alert", style: styles.errorContent, children: [
66692
66704
  /* @__PURE__ */ jsxRuntimeExports.jsx(AttentionFilled, { color: tokens.Color.Error300 }),
66693
66705
  /* @__PURE__ */ jsxRuntimeExports.jsx("p", { style: styles.errorMessage, children: isSAS ? __("Account selection is required.") : __("Choose an option") })
@@ -66708,7 +66720,7 @@ const MFAOptions = (props) => {
66708
66720
  const getStyles$Z = (tokens) => {
66709
66721
  return {
66710
66722
  label: {
66711
- marginBottom: tokens.Spacing.Medium
66723
+ marginBottom: tokens.Spacing.Small
66712
66724
  },
66713
66725
  optionLabel: {
66714
66726
  textAlign: "left",
@@ -67064,7 +67076,7 @@ const MFAForm = (props) => {
67064
67076
  const mfaCredentials = _get(currentMember, "mfa.credentials", []);
67065
67077
  const mfaType = getMFAFieldType(mfaCredentials);
67066
67078
  const isSAS = mfaCredentials[0].external_id === "single_account_select";
67067
- const styles = getStyles$W(tokens, isSAS);
67079
+ const styles = getStyles$W(tokens);
67068
67080
  const handleSubmit = (credentials) => {
67069
67081
  const posthogEventMetadata = {
67070
67082
  institution_guid: institution.guid,
@@ -67114,11 +67126,11 @@ const MFAForm = (props) => {
67114
67126
  );
67115
67127
  }
67116
67128
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles.container, children: [
67117
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: styles.title, children: /* @__PURE__ */ jsxRuntimeExports.jsx(ViewTitle, { title: isSAS ? __("Select an account") : __("Verify identity") }) }),
67129
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: styles.title, children: /* @__PURE__ */ jsxRuntimeExports.jsx(ViewTitle, { title: isSAS ? __("Account selection") : __("Verify identity") }) }),
67118
67130
  /* @__PURE__ */ jsxRuntimeExports.jsx("form", { onSubmit: (e) => e.preventDefault(), children: Form })
67119
67131
  ] });
67120
67132
  };
67121
- const getStyles$W = (tokens, isSAS) => {
67133
+ const getStyles$W = (tokens) => {
67122
67134
  return {
67123
67135
  container: {
67124
67136
  display: "flex",
@@ -67127,7 +67139,7 @@ const getStyles$W = (tokens, isSAS) => {
67127
67139
  height: "100%"
67128
67140
  },
67129
67141
  title: {
67130
- marginBottom: isSAS ? tokens.Spacing.Medium : tokens.Spacing.Tiny
67142
+ marginBottom: tokens.Spacing.XLarge
67131
67143
  },
67132
67144
  credentialLabel: {
67133
67145
  lineHeight: tokens.LineHeight.Paragraph,
@@ -68910,13 +68922,13 @@ const DEFAULT_POLLING_STATE = {
68910
68922
  userMessage: CONNECTING_MESSAGES.STARTING
68911
68923
  // message to show the end user
68912
68924
  };
68913
- function pollMember(memberGuid, api, onPostMessage, sendPosthogEvent) {
68925
+ function pollMember(memberGuid, api, onPostMessage, sendPosthogEvent, clientLocale) {
68914
68926
  return interval(3e3).pipe(
68915
68927
  switchMap(
68916
68928
  () => (
68917
68929
  // Poll the currentMember. Catch errors but don't handle it here
68918
68930
  // the scan will handle it below
68919
- defer(() => api.loadMemberByGuid(memberGuid)).pipe(
68931
+ defer(() => api.loadMemberByGuid(memberGuid, clientLocale)).pipe(
68920
68932
  mergeMap(
68921
68933
  (member) => defer(() => api.loadJob(member.most_recent_job_guid)).pipe(
68922
68934
  map((job) => {
@@ -70912,6 +70924,9 @@ const CreateMemberForm = (props) => {
70912
70924
  const config = useSelector(selectConfig);
70913
70925
  const isHuman = useSelector((state2) => state2.app.humanEvent);
70914
70926
  const currentMembers = useSelector((state2) => state2.connect.members);
70927
+ const clientLocale = useMemo(() => {
70928
+ return document.querySelector("html")?.getAttribute("lang") || "en";
70929
+ }, [document.querySelector("html")?.getAttribute("lang")]);
70915
70930
  const [isCreatingMember, setIsCreatingMember] = useState(false);
70916
70931
  const [memberCreateError, setMemberCreateError] = useState(null);
70917
70932
  const [userCredentials, setUserCredentials] = useState(null);
@@ -70994,7 +71009,7 @@ const CreateMemberForm = (props) => {
70994
71009
  };
70995
71010
  })
70996
71011
  );
70997
- return defer(() => api.loadMemberByGuid(memberGuid)).pipe(
71012
+ return defer(() => api.loadMemberByGuid(memberGuid, clientLocale)).pipe(
70998
71013
  mergeMap((member) => {
70999
71014
  const shouldStepToMFA = member.connection_status === ReadableStatuses$1.CHALLENGED;
71000
71015
  return shouldStepToMFA ? stepToMFA$(member) : updateMember$;
@@ -71358,6 +71373,9 @@ const Connecting = (props) => {
71358
71373
  } = props;
71359
71374
  const selectedInstitution = useSelector(getSelectedInstitution);
71360
71375
  const sendPosthogEvent = useAnalyticsEvent();
71376
+ const clientLocale = useMemo(() => {
71377
+ return document.querySelector("html")?.getAttribute("lang") || "en";
71378
+ }, [document.querySelector("html")?.getAttribute("lang")]);
71361
71379
  const currentMember = useSelector(getCurrentMember);
71362
71380
  const isComboJobsEnabled = useSelector(isConnectComboJobsEnabled);
71363
71381
  const jobSchedule = useSelector((state) => state.connect.jobSchedule);
@@ -71483,7 +71501,7 @@ const Connecting = (props) => {
71483
71501
  const startJob$ = defer(
71484
71502
  () => api.runJob(activeJob?.type, currentMember.guid, connectConfig, true)
71485
71503
  ).pipe(
71486
- mergeMap(() => api.loadMemberByGuid(currentMember.guid)),
71504
+ mergeMap(() => api.loadMemberByGuid(currentMember.guid, clientLocale)),
71487
71505
  catchError((error) => {
71488
71506
  const isSafeConflictError = error?.response?.status === 409;
71489
71507
  if (isSafeConflictError) {
@@ -71496,7 +71514,7 @@ const Connecting = (props) => {
71496
71514
  return needsJobStarted ? startJob$ : of(currentMember);
71497
71515
  }).pipe(
71498
71516
  concatMap(
71499
- (member) => pollMember(member.guid, api, onPostMessage, sendPosthogEvent).pipe(
71517
+ (member) => pollMember(member.guid, api, onPostMessage, sendPosthogEvent, clientLocale).pipe(
71500
71518
  tap((pollingState) => handleMemberPoll(pollingState)),
71501
71519
  filter((pollingState) => pollingState.jobIsDone),
71502
71520
  pluck("currentResponse"),
@@ -72122,7 +72140,7 @@ const ActionableError = () => {
72122
72140
  const institution = useSelector((state) => state.connect.selectedInstitution);
72123
72141
  const currentMember = useSelector(getCurrentMember);
72124
72142
  const initialConfig = useSelector(selectInitialConfig);
72125
- const jobDetailCode = currentMember.most_recent_job_detail_code;
72143
+ const jobDetailCode = currentMember.error.error_code;
72126
72144
  const tokens = useTokens();
72127
72145
  const styles = getStyles$A(tokens);
72128
72146
  const getNextDelay = getDelay();
@@ -72131,10 +72149,6 @@ const ActionableError = () => {
72131
72149
  () => ({
72132
72150
  [ACTIONABLE_ERROR_CODES.NO_ELIGIBLE_ACCOUNTS]: {
72133
72151
  title: __("No eligible accounts"),
72134
- userMessage: (institution2) => __(
72135
- "Only checking or savings accounts can be used for transfers. If you have one at %1, make sure to select it when connecting. Otherwise, try connecting a different institution.",
72136
- institution2.name
72137
- ),
72138
72152
  primaryAction: {
72139
72153
  label: __("Log in again"),
72140
72154
  action: () => dispatch({ type: ActionTypes$2.ACTIONABLE_ERROR_LOG_IN_AGAIN })
@@ -72190,7 +72204,7 @@ const ActionableError = () => {
72190
72204
  style: styles.paragraph,
72191
72205
  truncate: false,
72192
72206
  variant: "Paragraph",
72193
- children: messagingMap[jobDetailCode].userMessage(institution)
72207
+ children: currentMember.error.user_message
72194
72208
  }
72195
72209
  )
72196
72210
  ] }),
@@ -76179,6 +76193,9 @@ const ManualAccountForm = React__default.forwardRef(
76179
76193
  useAnalyticsPath(name, path);
76180
76194
  const { api } = useApi();
76181
76195
  const members = useSelector(getMembers);
76196
+ const clientLocale = useMemo(() => {
76197
+ return document.querySelector("html")?.getAttribute("lang") || "en";
76198
+ }, [document.querySelector("html")?.getAttribute("lang")]);
76182
76199
  const [saving, setSaving] = useState(false);
76183
76200
  const [isPersonal, setIsPersonal] = useState(true);
76184
76201
  const [returnField, setReturnField] = useState(null);
@@ -76266,7 +76283,7 @@ const ManualAccountForm = React__default.forwardRef(
76266
76283
  return of(addManualAccountSuccess(savedAccount));
76267
76284
  }
76268
76285
  return zip(
76269
- from(api.loadMemberByGuid(savedAccount.member_guid)),
76286
+ from(api.loadMemberByGuid(savedAccount.member_guid, clientLocale)),
76270
76287
  from(api.loadInstitutionByGuid(savedAccount.institution_guid))
76271
76288
  ).pipe(
76272
76289
  map(([loadedMember, loadedInstitution]) => {
@@ -77519,8 +77536,8 @@ const RenderConnectStep = (props) => {
77519
77536
  }
77520
77537
  );
77521
77538
  } else if (step === STEPS.ACTIONABLE_ERROR) {
77522
- const jobDetailCode = currentMember?.most_recent_job_detail_code ?? null;
77523
- connectStepView = canHandleActionableError(jobDetailCode) ? /* @__PURE__ */ jsxRuntimeExports.jsx(ActionableError, {}) : /* @__PURE__ */ jsxRuntimeExports.jsx(
77539
+ const errorCode = currentMember?.error?.error_code ?? null;
77540
+ connectStepView = canHandleActionableError(errorCode) ? /* @__PURE__ */ jsxRuntimeExports.jsx(ActionableError, {}) : /* @__PURE__ */ jsxRuntimeExports.jsx(
77524
77541
  LoginError,
77525
77542
  {
77526
77543
  institution: selectedInstitution,
@@ -79436,6 +79453,9 @@ const getErrorResource = (err) => {
79436
79453
  const useLoadConnect = () => {
79437
79454
  const { api } = useApi();
79438
79455
  const profiles = useSelector((state) => state.profiles);
79456
+ const clientLocale = useMemo(() => {
79457
+ return document.querySelector("html")?.getAttribute("lang") || "en";
79458
+ }, [document.querySelector("html")?.getAttribute("lang")]);
79439
79459
  const [config, setConfig] = useState({});
79440
79460
  const dispatch = useDispatch();
79441
79461
  const loadConnect = useCallback((config2) => setConfig(config2), [config]);
@@ -79445,7 +79465,7 @@ const useLoadConnect = () => {
79445
79465
  dispatch(loadConnect$1(config));
79446
79466
  let request$;
79447
79467
  if (config.current_member_guid) {
79448
- request$ = loadConnectFromMemberConfig(config, api);
79468
+ request$ = loadConnectFromMemberConfig(config, api, clientLocale);
79449
79469
  } else if (config.current_institution_guid || config.current_institution_code) {
79450
79470
  request$ = loadConnectFromInstitutionConfig(config, api);
79451
79471
  } else if (config.mode === VERIFY_MODE && config.current_microdeposit_guid) {
@@ -79456,9 +79476,9 @@ const useLoadConnect = () => {
79456
79476
  const requestSubscription$ = request$.pipe(
79457
79477
  mergeMap((dependencies) => {
79458
79478
  if (clientSupportRequestedProducts(config, profiles.clientProfile)) {
79459
- return from(api.loadMembers()).pipe(
79479
+ return from(api.loadMembers(clientLocale)).pipe(
79460
79480
  map(
79461
- (members) => loadConnectSuccess$1({
79481
+ (members = []) => loadConnectSuccess$1({
79462
79482
  members,
79463
79483
  widgetProfile: profiles.widgetProfile,
79464
79484
  ...dependencies
@@ -79511,8 +79531,8 @@ const useLoadConnect = () => {
79511
79531
  }, [config]);
79512
79532
  return { loadConnect };
79513
79533
  };
79514
- function loadConnectFromMemberConfig(config, api) {
79515
- return from(api.loadMemberByGuid(config.current_member_guid)).pipe(
79534
+ function loadConnectFromMemberConfig(config, api, clientLocale) {
79535
+ return from(api.loadMemberByGuid(config.current_member_guid, clientLocale)).pipe(
79516
79536
  mergeMap((member) => {
79517
79537
  return defer(() => api.loadInstitutionByGuid(member.institution_guid)).pipe(
79518
79538
  map((institution) => {
@@ -80208,7 +80228,7 @@ const frCa = {
80208
80228
  "Enter account number": "Entrer le numéro de compte",
80209
80229
  Recommended: Recommended$1,
80210
80230
  Manual: Manual$1,
80211
- "Select an account": "Sélectionner un compte",
80231
+ "Account selection": "Sélection du compte",
80212
80232
  "Loading …": "Chargement …",
80213
80233
  "Load more institutions": "Charger plus d'institutions",
80214
80234
  "Log in at %1": "Connectez-vous à %1",
@@ -80328,11 +80348,9 @@ const frCa = {
80328
80348
  "Log in again": "Connectez-vous à nouveau",
80329
80349
  "Connect a different institution": "Mettre en relation un autre établissement",
80330
80350
  "No eligible accounts": "Aucun compte admissible",
80331
- "Only checking or savings accounts can be used for transfers. If you have one at %1, make sure to select it when connecting. Otherwise, try connecting a different institution.": "Seuls les comptes chèques ou d’épargne peuvent être utilisés pour les transferts. Si vous en avez un à %1, assurez-vous de le sélectionner lors de la connexion. Sinon, essayez de connecter une autre institution.",
80332
80351
  Required: Required$1,
80333
80352
  "Add financial management?": "Ajouter la gestion financière ?",
80334
80353
  "Yes, add financial management": "Oui, ajoutez la gestion financière",
80335
- "No, just transfers and payment": "Non, juste des virements et des paiements",
80336
80354
  "Add transfers and payments?": "Ajouter des transferts et des paiements ?",
80337
80355
  "Yes, add transfers and payments": "Oui, ajouter des transferts et des paiements",
80338
80356
  "Select an account to connect": "Sélectionnez un compte pour vous connecter",
@@ -80703,7 +80721,7 @@ const es = {
80703
80721
  "Enter account number": "Ingrese el número de cuenta",
80704
80722
  Recommended: Recommended,
80705
80723
  Manual: Manual,
80706
- "Select an account": "Seleccione una cuenta",
80724
+ "Account selection": "Selección de cuenta",
80707
80725
  "Loading …": "Cargando …",
80708
80726
  "Load more institutions": "Cargar más instituciones",
80709
80727
  "Log in at %1": "Iniciar sesión en %1",
@@ -80825,7 +80843,6 @@ const es = {
80825
80843
  "Log in again": "Inicie sesión nuevamente",
80826
80844
  "Connect a different institution": "Conecte una institución diferente",
80827
80845
  "No eligible accounts": "No hay cuentas elegibles",
80828
- "Only checking or savings accounts can be used for transfers. If you have one at %1, make sure to select it when connecting. Otherwise, try connecting a different institution.": "Solo se pueden usar cuentas de control o ahorro para transferencias. Si tiene uno en %1, asegúrese de seleccionarlo al conectarlo. De lo contrario, intente conectar una institución diferente.",
80829
80846
  Required: Required,
80830
80847
  "Add financial management?": "¿Añadir gestión financiera?",
80831
80848
  "Yes, add financial management": "Sí, añadir gestión financiera",