@mxenabled/connect-widget 2.5.1 → 2.5.3

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
@@ -73878,12 +73878,14 @@ const DEFAULT_POLLING_STATE = {
73878
73878
  // previous response from last poll
73879
73879
  currentResponse: {},
73880
73880
  // current response
73881
- jobIsDone: false,
73881
+ pollingIsDone: false,
73882
73882
  // whether or not we should stop polling
73883
- userMessage: CONNECTING_MESSAGES.STARTING
73883
+ userMessage: CONNECTING_MESSAGES.STARTING,
73884
73884
  // message to show the end user
73885
+ initialDataReady: false
73886
+ // whether the initial data ready event has been sent
73885
73887
  };
73886
- function pollMember(memberGuid, api, onPostMessage, sendAnalyticsEvent, clientLocale) {
73888
+ function pollMember(memberGuid, api, clientLocale) {
73887
73889
  return interval(3e3).pipe(
73888
73890
  switchMap(
73889
73891
  () => (
@@ -73892,13 +73894,7 @@ function pollMember(memberGuid, api, onPostMessage, sendAnalyticsEvent, clientLo
73892
73894
  defer(() => api.loadMemberByGuid(memberGuid, clientLocale)).pipe(
73893
73895
  mergeMap(
73894
73896
  (member) => defer(() => api.loadJob(member.most_recent_job_guid)).pipe(
73895
- map((job) => {
73896
- if (job.async_account_data_ready) {
73897
- onPostMessage("connect/initialDataReady", { member_guid: member.guid });
73898
- sendAnalyticsEvent(AnalyticEvents.INITIAL_DATA_READY, { member_guid: member.guid });
73899
- }
73900
- return member;
73901
- })
73897
+ map((job) => ({ member, job }))
73902
73898
  )
73903
73899
  ),
73904
73900
  catchError((error) => of(error))
@@ -73916,13 +73912,18 @@ function pollMember(memberGuid, api, onPostMessage, sendAnalyticsEvent, clientLo
73916
73912
  // dont update previous response if this is an error
73917
73913
  previousResponse: isError ? acc.previousResponse : acc.currentResponse,
73918
73914
  // dont update current response if this is an error
73919
- currentResponse: isError ? acc.currentResponse : response
73915
+ currentResponse: isError ? acc.currentResponse : response,
73916
+ // preserve the initialDataReadySent flag
73917
+ initialDataReady: acc.initialDataReady
73920
73918
  };
73919
+ if (!isError && !acc.initialDataReady && response?.job?.async_account_data_ready) {
73920
+ pollingState.initialDataReady = true;
73921
+ }
73921
73922
  const [shouldStopPolling, messageKey] = handlePollingResponse(pollingState);
73922
73923
  return {
73923
73924
  ...pollingState,
73924
73925
  // we should keep polling based on the member
73925
- jobIsDone: isError ? false : shouldStopPolling,
73926
+ pollingIsDone: isError ? false : shouldStopPolling,
73926
73927
  userMessage: messageKey
73927
73928
  };
73928
73929
  },
@@ -73931,8 +73932,9 @@ function pollMember(memberGuid, api, onPostMessage, sendAnalyticsEvent, clientLo
73931
73932
  );
73932
73933
  }
73933
73934
  function handlePollingResponse(pollingState) {
73934
- const polledMember = pollingState.currentResponse;
73935
- const previousMember = pollingState.previousResponse;
73935
+ const polledMember = pollingState.currentResponse?.member || {};
73936
+ const previousMember = pollingState.previousResponse?.member || {};
73937
+ const polledJob = pollingState.currentResponse?.job || {};
73936
73938
  const justFinishedAggregating = previousMember.is_being_aggregated === true && polledMember.is_being_aggregated === false;
73937
73939
  const isNotAggregatingAtAll = previousMember.is_being_aggregated === false && polledMember.is_being_aggregated === false;
73938
73940
  if (polledMember.connection_status === ReadableStatuses$1.CHALLENGED) {
@@ -73941,6 +73943,9 @@ function handlePollingResponse(pollingState) {
73941
73943
  if (ProcessingStatuses.indexOf(polledMember.connection_status) !== -1) {
73942
73944
  return [false, CONNECTING_MESSAGES.VERIFYING];
73943
73945
  }
73946
+ if (polledJob.async_account_data_ready) {
73947
+ return [true, CONNECTING_MESSAGES.FINISHING];
73948
+ }
73944
73949
  if (polledMember.connection_status === ReadableStatuses$1.CONNECTED) {
73945
73950
  if (polledMember.is_being_aggregated) {
73946
73951
  return [false, CONNECTING_MESSAGES.SYNCING];
@@ -76367,25 +76372,33 @@ const Connecting = (props) => {
76367
76372
  const activeJob = getActiveJob(jobSchedule);
76368
76373
  const needsToInitializeJobSchedule = jobSchedule.isInitialized === false;
76369
76374
  function handleMemberPoll(pollingState) {
76370
- if (pollingState.pollingCount > 15 && pollingState.currentResponse?.connection_status !== ReadableStatuses$1.PENDING) {
76375
+ if (pollingState.pollingCount > 15 && pollingState.currentResponse?.member?.connection_status !== ReadableStatuses$1.PENDING) {
76371
76376
  setTimedOut(true);
76372
76377
  }
76373
76378
  const overrideStatusChanged = postMessageEventOverrides?.memberStatusUpdate?.getHasStatusChanged({
76374
- currentMember: pollingState.currentResponse,
76375
- previousMember: pollingState.previousResponse
76379
+ currentMember: pollingState.currentResponse?.member,
76380
+ previousMember: pollingState.previousResponse?.member
76376
76381
  });
76377
76382
  const overrideEventData = postMessageEventOverrides?.memberStatusUpdate?.createEventData?.({
76378
76383
  institution: selectedInstitution,
76379
- member: pollingState.currentResponse
76384
+ member: pollingState.currentResponse?.member
76380
76385
  });
76381
- const statusChanged = pollingState.previousResponse?.connection_status !== pollingState.currentResponse?.connection_status;
76386
+ const statusChanged = pollingState.previousResponse?.member?.connection_status !== pollingState.currentResponse?.member?.connection_status;
76382
76387
  const eventData = overrideEventData || {
76383
- member_guid: pollingState.currentResponse.guid,
76384
- connection_status: pollingState.currentResponse.connection_status
76388
+ member_guid: pollingState.currentResponse?.member?.guid,
76389
+ connection_status: pollingState.currentResponse?.member?.connection_status
76385
76390
  };
76386
76391
  if (pollingState.previousResponse != null && (statusChanged || overrideStatusChanged)) {
76387
76392
  onPostMessage("connect/memberStatusUpdate", eventData);
76388
76393
  }
76394
+ if (pollingState.initialDataReady) {
76395
+ onPostMessage("connect/initialDataReady", {
76396
+ member_guid: pollingState.currentResponse?.member?.guid
76397
+ });
76398
+ sendAnalyticsEvent(AnalyticEvents.INITIAL_DATA_READY, {
76399
+ member_guid: pollingState.currentResponse?.member?.guid
76400
+ });
76401
+ }
76389
76402
  setMessage(pollingState.userMessage);
76390
76403
  }
76391
76404
  useEffect(() => {
@@ -76485,14 +76498,14 @@ const Connecting = (props) => {
76485
76498
  return needsJobStarted ? startJob$ : of(currentMember);
76486
76499
  }).pipe(
76487
76500
  concatMap(
76488
- (member) => pollMember(member.guid, api, onPostMessage, sendAnalyticsEvent, clientLocale).pipe(
76501
+ (member) => pollMember(member.guid, api, clientLocale).pipe(
76489
76502
  tap((pollingState) => handleMemberPoll(pollingState)),
76490
- filter((pollingState) => pollingState.jobIsDone),
76503
+ filter((pollingState) => pollingState.pollingIsDone),
76491
76504
  pluck("currentResponse"),
76492
76505
  take(1),
76493
- mergeMap((polledMember) => {
76506
+ mergeMap((polledResponse) => {
76494
76507
  const loadLatestJob$ = defer(() => api.loadJob(member.most_recent_job_guid)).pipe(
76495
- map((job) => ({ member: polledMember, job }))
76508
+ map((job) => ({ member: polledResponse.member, job }))
76496
76509
  );
76497
76510
  return loadLatestJob$;
76498
76511
  })
@@ -78876,7 +78889,7 @@ const HowItWorks = ({ onContinue }) => {
78876
78889
  const getNextDelay = getDelay();
78877
78890
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ref: containerRef, children: [
78878
78891
  /* @__PURE__ */ jsxRuntimeExports.jsx(SlideDown, { delay: getNextDelay(), children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { style: styles.body, children: [
78879
- /* @__PURE__ */ jsxRuntimeExports.jsx(D, { "data-test": "title-header", truncate: false, variant: "H2", children: __("Connect your institution with account numbers") }),
78892
+ /* @__PURE__ */ jsxRuntimeExports.jsx(D, { component: "h2", "data-test": "title-header", truncate: false, variant: "H2", children: __("Connect your institution with account numbers") }),
78880
78893
  /* @__PURE__ */ jsxRuntimeExports.jsx(
78881
78894
  InstructionList,
78882
78895
  {
@@ -78962,7 +78975,17 @@ const PersonalInfoForm = ({ accountDetails, onContinue }) => {
78962
78975
  }, [isSubmitting]);
78963
78976
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ref: containerRef, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("form", { onSubmit: (e) => e.preventDefault(), children: [
78964
78977
  /* @__PURE__ */ jsxRuntimeExports.jsx(SlideDown, { delay: getNextDelay(), children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { style: styles.header, children: [
78965
- /* @__PURE__ */ jsxRuntimeExports.jsx(D, { "data-test": "title-header", style: styles.title, truncate: false, variant: "H2", children: __("Enter account holder information") }),
78978
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
78979
+ D,
78980
+ {
78981
+ component: "h2",
78982
+ "data-test": "title-header",
78983
+ style: styles.title,
78984
+ truncate: false,
78985
+ variant: "H2",
78986
+ children: __("Enter account holder information")
78987
+ }
78988
+ ),
78966
78989
  /* @__PURE__ */ jsxRuntimeExports.jsx(
78967
78990
  D,
78968
78991
  {
@@ -79103,7 +79126,17 @@ const AccountInfo = (props) => {
79103
79126
  return /* @__PURE__ */ jsxRuntimeExports.jsx(FindAccountInfo, { onClose: () => setShowFindDetails(false), step: "accountInfo" });
79104
79127
  }
79105
79128
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ref: containerRef, children: [
79106
- /* @__PURE__ */ jsxRuntimeExports.jsx(SlideDown, { delay: getNextDelay(), children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: styles.header, children: /* @__PURE__ */ jsxRuntimeExports.jsx(D, { "data-test": "title-header", style: styles.title, truncate: false, variant: "H2", children: __("Enter account information") }) }) }),
79129
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SlideDown, { delay: getNextDelay(), children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: styles.header, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
79130
+ D,
79131
+ {
79132
+ component: "h2",
79133
+ "data-test": "title-header",
79134
+ style: styles.title,
79135
+ truncate: false,
79136
+ variant: "H2",
79137
+ children: __("Enter account information")
79138
+ }
79139
+ ) }) }),
79107
79140
  /* @__PURE__ */ jsxRuntimeExports.jsxs("form", { onSubmit: (e) => e.preventDefault(), children: [
79108
79141
  /* @__PURE__ */ jsxRuntimeExports.jsx(SlideDown, { delay: getNextDelay(), children: /* @__PURE__ */ jsxRuntimeExports.jsxs(FormControl$1, { component: "fieldset", sx: { width: "100%" }, children: [
79109
79142
  /* @__PURE__ */ jsxRuntimeExports.jsx(FormLabel$1, { component: "legend", children: __("Account type") }),
@@ -79114,7 +79147,7 @@ const AccountInfo = (props) => {
79114
79147
  row: true,
79115
79148
  sx: {
79116
79149
  justifyContent: "space-between",
79117
- padding: "0 0 32px 0",
79150
+ padding: "0 0 16px 0",
79118
79151
  marginTop: tokens.Spacing.XSmall,
79119
79152
  "& > .ph-no-capture": {
79120
79153
  width: "48%"
@@ -79423,7 +79456,17 @@ const ConfirmDetails = (props) => {
79423
79456
  }, [containerRef]);
79424
79457
  const handleEdit = (focus) => fadeOut(containerRef.current, "up", 300).then(() => onEditForm(focus));
79425
79458
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ref: containerRef, children: [
79426
- /* @__PURE__ */ jsxRuntimeExports.jsx(SlideDown, { delay: getNextDelay(), children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: styles.header, children: /* @__PURE__ */ jsxRuntimeExports.jsx(D, { "data-test": "title-header", style: styles.title, truncate: false, variant: "H2", children: __("Review your information") }) }) }),
79459
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SlideDown, { delay: getNextDelay(), children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: styles.header, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
79460
+ D,
79461
+ {
79462
+ component: "h2",
79463
+ "data-test": "title-header",
79464
+ style: styles.title,
79465
+ truncate: false,
79466
+ variant: "H2",
79467
+ children: __("Review your information")
79468
+ }
79469
+ ) }) }),
79427
79470
  props.shouldShowUserDetails && /* @__PURE__ */ jsxRuntimeExports.jsxs(SlideDown, { delay: getNextDelay(), children: [
79428
79471
  /* @__PURE__ */ jsxRuntimeExports.jsx(
79429
79472
  DetailReviewItem,
@@ -79562,7 +79605,17 @@ const ComeBack = ({ microdeposit, onDone }) => {
79562
79605
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ref: containerRef, children: [
79563
79606
  /* @__PURE__ */ jsxRuntimeExports.jsx(SlideDown, { delay: 100, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { "aria-hidden": true, "data-test": "svg-header", style: styles.svg, children: /* @__PURE__ */ jsxRuntimeExports.jsx(SvgComeBackGraphic, {}) }) }),
79564
79607
  /* @__PURE__ */ jsxRuntimeExports.jsx(SlideDown, { delay: 100, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { style: styles.header, children: [
79565
- /* @__PURE__ */ jsxRuntimeExports.jsx(D, { "data-test": "title-header", style: styles.title, truncate: false, variant: "H2", children: __("Check back soon") }),
79608
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
79609
+ D,
79610
+ {
79611
+ component: "h2",
79612
+ "data-test": "title-header",
79613
+ style: styles.title,
79614
+ truncate: false,
79615
+ variant: "H2",
79616
+ children: __("Check back soon")
79617
+ }
79618
+ ),
79566
79619
  /* @__PURE__ */ jsxRuntimeExports.jsx(
79567
79620
  ProtectedText,
79568
79621
  {
@@ -79688,7 +79741,17 @@ const VerifyDeposits = ({ microdeposit, onSuccess }) => {
79688
79741
  }, [errors]);
79689
79742
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ref: containerRef, children: [
79690
79743
  /* @__PURE__ */ jsxRuntimeExports.jsx(SlideDown, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { style: styles.header, children: [
79691
- /* @__PURE__ */ jsxRuntimeExports.jsx(D, { "data-test": "title-header", style: styles.title, truncate: false, variant: "H2", children: __("Enter deposit amounts") }),
79744
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
79745
+ D,
79746
+ {
79747
+ component: "h2",
79748
+ "data-test": "title-header",
79749
+ style: styles.title,
79750
+ truncate: false,
79751
+ variant: "H2",
79752
+ children: __("Enter deposit amounts")
79753
+ }
79754
+ ),
79692
79755
  /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
79693
79756
  /* @__PURE__ */ jsxRuntimeExports.jsx(
79694
79757
  ProtectedText,
@@ -79780,7 +79843,8 @@ const VerifyDeposits = ({ microdeposit, onSuccess }) => {
79780
79843
  const getStyles$k = (tokens) => ({
79781
79844
  header: {
79782
79845
  display: "flex",
79783
- flexDirection: "column"
79846
+ flexDirection: "column",
79847
+ marginBottom: tokens.Spacing.Large
79784
79848
  },
79785
79849
  title: {
79786
79850
  marginBottom: tokens.Spacing.XSmall
@@ -79867,7 +79931,7 @@ const MicrodepositErrors = ({
79867
79931
  };
79868
79932
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ref: containerRef, children: [
79869
79933
  /* @__PURE__ */ jsxRuntimeExports.jsxs(SlideDown, { children: [
79870
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: styles.header, children: /* @__PURE__ */ jsxRuntimeExports.jsx(D, { style: styles.title, truncate: false, variant: "H2", children: getTitle() }) }),
79934
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: styles.header, children: /* @__PURE__ */ jsxRuntimeExports.jsx(D, { component: "h2", style: styles.title, truncate: false, variant: "H2", children: getTitle() }) }),
79871
79935
  /* @__PURE__ */ jsxRuntimeExports.jsx(MessageBox, { style: styles.messageBox, variant: "error", children: /* @__PURE__ */ jsxRuntimeExports.jsx(D, { component: "p", role: "alert", truncate: false, variant: "ParagraphSmall", children: getMessage() }) })
79872
79936
  ] }),
79873
79937
  /* @__PURE__ */ jsxRuntimeExports.jsxs(SlideDown, { delay: 100, children: [
@@ -79986,7 +80050,17 @@ const Verifying = ({ microdeposit, onError, onSuccess }) => {
79986
80050
  }, [microdeposit.guid]);
79987
80051
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ref: containerRef, children: [
79988
80052
  /* @__PURE__ */ jsxRuntimeExports.jsx(SlideDown, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { style: styles.header, children: [
79989
- /* @__PURE__ */ jsxRuntimeExports.jsx(D, { "data-test": "header-title", style: styles.title, truncate: false, variant: "H2", children: __("Verifying ...") }),
80053
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
80054
+ D,
80055
+ {
80056
+ component: "h2",
80057
+ "data-test": "header-title",
80058
+ style: styles.title,
80059
+ truncate: false,
80060
+ variant: "H2",
80061
+ children: __("Verifying ...")
80062
+ }
80063
+ ),
79990
80064
  /* @__PURE__ */ jsxRuntimeExports.jsx(
79991
80065
  D,
79992
80066
  {
@@ -80043,7 +80117,17 @@ const Verified = ({ microdeposit, onDone }) => {
80043
80117
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ref: containerRef, style: styles.container, children: [
80044
80118
  /* @__PURE__ */ jsxRuntimeExports.jsx(SlideDown, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { "aria-hidden": true, "data-test": "svg-header", style: styles.svg, children: /* @__PURE__ */ jsxRuntimeExports.jsx(SvgVerifiedGraphic, {}) }) }),
80045
80119
  /* @__PURE__ */ jsxRuntimeExports.jsx(SlideDown, { delay: 100, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { style: styles.header, children: [
80046
- /* @__PURE__ */ jsxRuntimeExports.jsx(D, { "data-test": "title-header", style: styles.title, truncate: false, variant: "H2", children: __("Deposits verified") }),
80120
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
80121
+ D,
80122
+ {
80123
+ component: "h2",
80124
+ "data-test": "title-header",
80125
+ style: styles.title,
80126
+ truncate: false,
80127
+ variant: "H2",
80128
+ children: __("Deposits verified")
80129
+ }
80130
+ ),
80047
80131
  /* @__PURE__ */ jsxRuntimeExports.jsx(D, { "data-test": "verified-paragraph", truncate: false, variant: "Paragraph", children: __("You're almost done setting things up. Continue to your institution.") })
80048
80132
  ] }) }),
80049
80133
  /* @__PURE__ */ jsxRuntimeExports.jsx(SlideDown, { delay: 200, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -80562,6 +80646,7 @@ const VerifyExistingMember = (props) => {
80562
80646
  /* @__PURE__ */ jsxRuntimeExports.jsx(
80563
80647
  D,
80564
80648
  {
80649
+ component: "h3",
80565
80650
  "data-test": "connected-institutions-text",
80566
80651
  sx: { marginBottom: tokens.Spacing.XSmall, fontWeight: 600 },
80567
80652
  truncate: false,