@tesouro/embedded-components-react 0.2.249 → 0.2.253

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.
Files changed (44) hide show
  1. package/README.md +15 -6
  2. package/dist/experimental/WidgetSuite.d.ts +649 -25
  3. package/dist/experimental/WidgetSuite.js +5 -2
  4. package/dist/experimental/index.d.ts +649 -25
  5. package/dist/experimental/index.js +5 -2
  6. package/dist/index.css +22 -2
  7. package/dist/index.d.ts +35 -14
  8. package/dist/lib/AcceptDisclosuresWidget.d.ts +35 -14
  9. package/dist/libs/tesouro-embedded-components-react/accept-disclosures-widget/data-access/dist/index.js +2 -2
  10. package/dist/libs/tesouro-embedded-components-react/accept-disclosures-widget/data-access/dist/index2.js +25 -6
  11. package/dist/libs/tesouro-embedded-components-react/accept-disclosures-widget/feature/dist/index4.js +81 -46
  12. package/dist/libs/tesouro-embedded-components-react/accept-disclosures-widget/ui/dist/index2.js +1 -0
  13. package/dist/libs/tesouro-embedded-components-react/accept-disclosures-widget/ui/dist/index3.js +23 -13
  14. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/feature/dist/index7.js +1 -1
  15. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/feature/dist/index8.js +1 -1
  16. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/ui/dist/index.js +2 -2
  17. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/ui/dist/{index3.js → lib/AccountCard.js} +3 -3
  18. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/ui/dist/{index6.js → lib/BankAccountsWidgetUi.js} +7 -7
  19. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/ui/dist/{index4.js → lib/BankingHeader.js} +2 -2
  20. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/ui/dist/{index5.js → lib/CreateAccountDialog.js} +4 -4
  21. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/ui/dist/{index2.js → lib/labels.js} +1 -1
  22. package/dist/libs/tesouro-embedded-components-react/settings-widget/feature/dist/index5.js +1 -1
  23. package/dist/libs/tesouro-embedded-components-react/settings-widget/ui/dist/index.js +3 -3
  24. package/dist/libs/tesouro-embedded-components-react/settings-widget/ui/dist/{index3.js → lib/SettingsWidgetUi/SettingsWidgetUi.js} +3 -3
  25. package/dist/libs/tesouro-embedded-components-react/settings-widget/ui/dist/lib/SettingsWidgetUi/index.js +2 -0
  26. package/dist/libs/tesouro-embedded-components-react/settings-widget/ui/dist/{index2.js → lib/SettingsWidgetUi/labels.js} +1 -1
  27. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +19 -19
  28. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/EmbedApiContext.js +4 -0
  29. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js +149 -156
  30. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/sdk.gen.js +54 -42
  31. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/WidgetProvider/RootWidgetProvider.js +4 -0
  32. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/WidgetProvider/WidgetProvider.js +4 -0
  33. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  34. package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/lib/UIContext/UIProvider.js +4 -0
  35. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index.js +5 -2
  36. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index2.js +4 -0
  37. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index3.js +8 -0
  38. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index4.js +34 -0
  39. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index5.js +59 -0
  40. package/dist/libs/tesouro-embedded-components-react/widget-suite/ui/dist/index.js +3 -3
  41. package/dist/libs/tesouro-embedded-components-react/widget-suite/ui/dist/index2.js +6 -3
  42. package/dist/libs/tesouro-embedded-components-react/widget-suite/ui/dist/index3.js +70 -18
  43. package/package.json +1 -1
  44. package/dist/libs/tesouro-embedded-components-react/settings-widget/ui/dist/index4.js +0 -2
@@ -1,3 +1,6 @@
1
- import { WidgetSuiteStyleProbe as e } from "../libs/tesouro-embedded-components-react/widget-suite/ui/dist/index3.js";
1
+ import { WIDGET_SUITE_SECTION_LABELS_EN as e } from "../libs/tesouro-embedded-components-react/widget-suite/feature/dist/index3.js";
2
+ import { WidgetSuiteSectionId as t } from "../libs/tesouro-embedded-components-react/widget-suite/feature/dist/index4.js";
3
+ import { WIDGET_SUITE_SHELL_LABELS_EN as n } from "../libs/tesouro-embedded-components-react/widget-suite/ui/dist/index2.js";
4
+ import { WidgetSuite as r } from "../libs/tesouro-embedded-components-react/widget-suite/feature/dist/index5.js";
2
5
  import "./WidgetSuite.js";
3
- export { e as WidgetSuiteStyleProbe };
6
+ export { e as WIDGET_SUITE_SECTION_LABELS_EN, n as WIDGET_SUITE_SHELL_LABELS_EN, r as WidgetSuite, t as WidgetSuiteSectionId };
package/dist/index.css CHANGED
@@ -449,6 +449,9 @@
449
449
  .ttw\:mr-auto {
450
450
  margin-right: auto;
451
451
  }
452
+ .ttw\:-mb-px {
453
+ margin-bottom: -1px;
454
+ }
452
455
  .ttw\:mb-0 {
453
456
  margin-bottom: 0px;
454
457
  }
@@ -916,8 +919,8 @@
916
919
  .ttw\:min-h-\[300px\] {
917
920
  min-height: 300px;
918
921
  }
919
- .ttw\:min-h-\[364px\] {
920
- min-height: 364px;
922
+ .ttw\:min-h-\[432px\] {
923
+ min-height: 432px;
921
924
  }
922
925
  .ttw\:min-h-\[1123px\] {
923
926
  min-height: 1123px;
@@ -2015,6 +2018,10 @@
2015
2018
  border-bottom-style: var(--tw-border-style);
2016
2019
  border-bottom-width: 0px;
2017
2020
  }
2021
+ .ttw\:border-b-2 {
2022
+ border-bottom-style: var(--tw-border-style);
2023
+ border-bottom-width: 2px;
2024
+ }
2018
2025
  .ttw\:border-l {
2019
2026
  border-left-style: var(--tw-border-style);
2020
2027
  border-left-width: 1px;
@@ -2660,6 +2667,9 @@
2660
2667
  .ttw\:p-8 {
2661
2668
  padding: calc(var(--ttw-spacing) * 8);
2662
2669
  }
2670
+ .ttw\:p-10 {
2671
+ padding: calc(var(--ttw-spacing) * 10);
2672
+ }
2663
2673
  .ttw\:p-12 {
2664
2674
  padding: calc(var(--ttw-spacing) * 12);
2665
2675
  }
@@ -4075,6 +4085,9 @@
4075
4085
  .ttw\:hover\:border-\[\#EAECF0\]:hover {
4076
4086
  border-color: #EAECF0;
4077
4087
  }
4088
+ .ttw\:hover\:border-border:hover {
4089
+ border-color: var(--ttw-border);
4090
+ }
4078
4091
  .ttw\:hover\:border-indigo-700:hover {
4079
4092
  border-color: var(--ttw-color-indigo-700);
4080
4093
  }
@@ -4428,6 +4441,13 @@
4428
4441
  outline-style: var(--tw-outline-style);
4429
4442
  outline-width: 1px;
4430
4443
  }
4444
+ .ttw\:focus-visible\:outline-2:focus-visible {
4445
+ outline-style: var(--tw-outline-style);
4446
+ outline-width: 2px;
4447
+ }
4448
+ .ttw\:focus-visible\:outline-offset-2:focus-visible {
4449
+ outline-offset: 2px;
4450
+ }
4431
4451
  .ttw\:focus-visible\:outline-ring:focus-visible {
4432
4452
  outline-color: var(--ttw-ring);
4433
4453
  }
package/dist/index.d.ts CHANGED
@@ -10,6 +10,8 @@ interface AcceptDisclosuresWidgetLabels {
10
10
  title: string;
11
11
  acceptButton: string;
12
12
  agreementCheckboxAriaLabel: string;
13
+ /** Fallback when the accept API fails without a usable message. */
14
+ acceptErrorFallback: string;
13
15
  /** Use `{bankName}` as the bank display-name placeholder. */
14
16
  agreementTextTemplate: string;
15
17
  providerAttributionPrefix: string;
@@ -41,6 +43,15 @@ interface AcceptDisclosuresWidgetProps$1 {
41
43
  isAgreed: boolean;
42
44
  onAgreedChange: (checked: boolean) => void;
43
45
  onAccept: () => void;
46
+ /** Disables the checkbox and Accept control while a submit is in flight. */
47
+ isSubmitting?: boolean;
48
+ /**
49
+ * Keeps the checkbox and Accept control disabled once acceptance is done.
50
+ * Separate from {@link isSubmitting} so `aria-busy` only means "in flight".
51
+ */
52
+ isAccepted?: boolean;
53
+ /** Inline error shown under Accept; omit or empty when there is no error. */
54
+ errorMessage?: string;
44
55
  labels?: PartialDeep$5<AcceptDisclosuresWidgetLabels>;
45
56
  }
46
57
 
@@ -1338,8 +1349,19 @@ interface AcceptDisclosuresLinks {
1338
1349
  usaPatriotActUrl: string;
1339
1350
  }
1340
1351
 
1341
- type UiOwnedProps = 'providerAttribution' | 'agreementText' | 'disclosureLinks' | 'isAgreed' | 'onAgreedChange' | 'onAccept';
1352
+ type UiOwnedProps = 'providerAttribution' | 'agreementText' | 'disclosureLinks' | 'isAgreed' | 'onAgreedChange' | 'onAccept' | 'isSubmitting' | 'isAccepted' | 'errorMessage';
1342
1353
  type InnerProps = Omit<AcceptDisclosuresWidgetProps$1, UiOwnedProps> & {
1354
+ /**
1355
+ * Invitation token from the invite link. Bound into the disclosures lookup
1356
+ * before activation, and used to remount consent state when the invite
1357
+ * changes. This widget does not read URL search params.
1358
+ */
1359
+ invitationToken: string;
1360
+ /**
1361
+ * Invited user id from the invite link. Required with {@link invitationToken}
1362
+ * for the disclosures lookup and remount identity.
1363
+ */
1364
+ userId: string;
1343
1365
  /**
1344
1366
  * URLs of the four bank-issued disclosure documents. Required to render along
1345
1367
  * with a bank name from widget init: the widget carries no document URLs of its
@@ -1348,23 +1370,22 @@ type InnerProps = Omit<AcceptDisclosuresWidgetProps$1, UiOwnedProps> & {
1348
1370
  */
1349
1371
  disclosureLinks?: AcceptDisclosuresLinks;
1350
1372
  /**
1351
- * Records the acceptance instead of the built-in call. Reject to keep the
1352
- * agreement on screen for a retry.
1353
- *
1354
- * Escape hatch for a host that must complete an invitee's acceptance today:
1355
- * the built-in call targets the authenticated-user endpoint, which the gateway
1356
- * refuses for a user who is not active yet ("User must be active to access
1357
- * this resource") — and an invitee is precisely that. Such a host has to go
1358
- * through the invite-token endpoints server-side, which the published package
1359
- * cannot do. Expected to become unnecessary with EMBD-4525, which moves
1360
- * acceptance in-process in the gateway and lifts the active-user gate.
1373
+ * Called after the atomic accept succeeds and before init refresh is kicked.
1374
+ * May return a promise the widget awaits it before locking controls and
1375
+ * refreshing init, so a rejected continuation surfaces as an error and leaves
1376
+ * Accept retryable (and the host gate stays mounted).
1361
1377
  */
1362
- onAccept?: () => Promise<void> | void;
1378
+ onAccepted?: () => void | Promise<void>;
1363
1379
  };
1364
1380
  type AcceptDisclosuresWidgetProps = WidgetProviderProps & InnerProps;
1365
1381
  /**
1366
- * Self-contained AcceptDisclosures widget. Wraps the presentational UI in
1367
- * {@link WidgetProvider}; acceptance mutations land in follow-up work.
1382
+ * Self-contained AcceptDisclosures widget for the pre-auth invite flow.
1383
+ * Posts `POST /api/widget-gateway/disclosure-acceptance` (after reading the
1384
+ * disclosure version in force via the widget-gateway proxy), which activates
1385
+ * the invitee and records acceptance in one transaction, then awaits any
1386
+ * `onAccepted` continuation and kicks a widget-init refresh so host gates
1387
+ * keyed on `INVITED` can clear. Auth uses the normal WidgetToken provider
1388
+ * contract — never an APP/M2M bearer.
1368
1389
  */
1369
1390
  declare function AcceptDisclosuresWidget({ baseUrl, widgetToken, organizationId, configClient, linkComponent, implementation, uiFramework, errorFallback, onError, analytics, ...innerProps }: AcceptDisclosuresWidgetProps): React.JSX.Element;
1370
1391
 
@@ -9,6 +9,8 @@ interface AcceptDisclosuresWidgetLabels {
9
9
  title: string;
10
10
  acceptButton: string;
11
11
  agreementCheckboxAriaLabel: string;
12
+ /** Fallback when the accept API fails without a usable message. */
13
+ acceptErrorFallback: string;
12
14
  /** Use `{bankName}` as the bank display-name placeholder. */
13
15
  agreementTextTemplate: string;
14
16
  providerAttributionPrefix: string;
@@ -40,6 +42,15 @@ interface AcceptDisclosuresWidgetProps$1 {
40
42
  isAgreed: boolean;
41
43
  onAgreedChange: (checked: boolean) => void;
42
44
  onAccept: () => void;
45
+ /** Disables the checkbox and Accept control while a submit is in flight. */
46
+ isSubmitting?: boolean;
47
+ /**
48
+ * Keeps the checkbox and Accept control disabled once acceptance is done.
49
+ * Separate from {@link isSubmitting} so `aria-busy` only means "in flight".
50
+ */
51
+ isAccepted?: boolean;
52
+ /** Inline error shown under Accept; omit or empty when there is no error. */
53
+ errorMessage?: string;
43
54
  labels?: PartialDeep<AcceptDisclosuresWidgetLabels>;
44
55
  }
45
56
 
@@ -624,8 +635,19 @@ interface AcceptDisclosuresLinks {
624
635
  usaPatriotActUrl: string;
625
636
  }
626
637
 
627
- type UiOwnedProps = 'providerAttribution' | 'agreementText' | 'disclosureLinks' | 'isAgreed' | 'onAgreedChange' | 'onAccept';
638
+ type UiOwnedProps = 'providerAttribution' | 'agreementText' | 'disclosureLinks' | 'isAgreed' | 'onAgreedChange' | 'onAccept' | 'isSubmitting' | 'isAccepted' | 'errorMessage';
628
639
  type InnerProps = Omit<AcceptDisclosuresWidgetProps$1, UiOwnedProps> & {
640
+ /**
641
+ * Invitation token from the invite link. Bound into the disclosures lookup
642
+ * before activation, and used to remount consent state when the invite
643
+ * changes. This widget does not read URL search params.
644
+ */
645
+ invitationToken: string;
646
+ /**
647
+ * Invited user id from the invite link. Required with {@link invitationToken}
648
+ * for the disclosures lookup and remount identity.
649
+ */
650
+ userId: string;
629
651
  /**
630
652
  * URLs of the four bank-issued disclosure documents. Required to render along
631
653
  * with a bank name from widget init: the widget carries no document URLs of its
@@ -634,23 +656,22 @@ type InnerProps = Omit<AcceptDisclosuresWidgetProps$1, UiOwnedProps> & {
634
656
  */
635
657
  disclosureLinks?: AcceptDisclosuresLinks;
636
658
  /**
637
- * Records the acceptance instead of the built-in call. Reject to keep the
638
- * agreement on screen for a retry.
639
- *
640
- * Escape hatch for a host that must complete an invitee's acceptance today:
641
- * the built-in call targets the authenticated-user endpoint, which the gateway
642
- * refuses for a user who is not active yet ("User must be active to access
643
- * this resource") — and an invitee is precisely that. Such a host has to go
644
- * through the invite-token endpoints server-side, which the published package
645
- * cannot do. Expected to become unnecessary with EMBD-4525, which moves
646
- * acceptance in-process in the gateway and lifts the active-user gate.
659
+ * Called after the atomic accept succeeds and before init refresh is kicked.
660
+ * May return a promise the widget awaits it before locking controls and
661
+ * refreshing init, so a rejected continuation surfaces as an error and leaves
662
+ * Accept retryable (and the host gate stays mounted).
647
663
  */
648
- onAccept?: () => Promise<void> | void;
664
+ onAccepted?: () => void | Promise<void>;
649
665
  };
650
666
  type AcceptDisclosuresWidgetProps = WidgetProviderProps & InnerProps;
651
667
  /**
652
- * Self-contained AcceptDisclosures widget. Wraps the presentational UI in
653
- * {@link WidgetProvider}; acceptance mutations land in follow-up work.
668
+ * Self-contained AcceptDisclosures widget for the pre-auth invite flow.
669
+ * Posts `POST /api/widget-gateway/disclosure-acceptance` (after reading the
670
+ * disclosure version in force via the widget-gateway proxy), which activates
671
+ * the invitee and records acceptance in one transaction, then awaits any
672
+ * `onAccepted` continuation and kicks a widget-init refresh so host gates
673
+ * keyed on `INVITED` can clear. Auth uses the normal WidgetToken provider
674
+ * contract — never an APP/M2M bearer.
654
675
  */
655
676
  declare function AcceptDisclosuresWidget({ baseUrl, widgetToken, organizationId, configClient, linkComponent, implementation, uiFramework, errorFallback, onError, analytics, ...innerProps }: AcceptDisclosuresWidgetProps): React.JSX.Element;
656
677
 
@@ -1,2 +1,2 @@
1
- import { useAcceptDisclosures as e } from "./index2.js";
2
- export { e as useAcceptDisclosures };
1
+ import { useAcceptWidgetDisclosures as e } from "./index2.js";
2
+ export { e as useAcceptWidgetDisclosures };
@@ -3,13 +3,32 @@
3
3
  "use client";
4
4
  "use client";
5
5
  import { useEmbedApi as e } from "../../../shared/data-access/dist/lib/EmbedApiContext.js";
6
- import { acceptDisclosuresMutation as t } from "../../../shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js";
6
+ import { getDisclosures as t, postApiWidgetGatewayDisclosureAcceptance as n } from "../../../shared/data-access/dist/lib/rest/sdk.gen.js";
7
7
  import "../../../shared/data-access/dist/index.js";
8
- import { useMutation as n } from "@tanstack/react-query";
8
+ import { useMutation as r } from "@tanstack/react-query";
9
9
  //#region ../../libs/tesouro-embedded-components-react/accept-disclosures-widget/data-access/dist/index2.js
10
- function r() {
11
- let { client: r } = e();
12
- return n({ ...t({ client: r }) });
10
+ function i() {
11
+ let { client: i, widgetToken: a } = e();
12
+ return r({ mutationFn: async ({ invitationToken: e, userId: r }) => {
13
+ if (!a) throw Error("Widget token is required to accept disclosures");
14
+ let { data: o } = await t({
15
+ client: i,
16
+ headers: { "X-Widget-Token": a },
17
+ query: {
18
+ invitationToken: e,
19
+ userId: r
20
+ },
21
+ throwOnError: !0
22
+ });
23
+ if (!o) throw Error("Unexpected disclosures response from widget gateway");
24
+ let { data: s } = await n({
25
+ client: i,
26
+ headers: { "X-Widget-Token": a },
27
+ body: { version: o.version },
28
+ throwOnError: !0
29
+ });
30
+ return s;
31
+ } });
13
32
  }
14
33
  //#endregion
15
- export { r as useAcceptDisclosures };
34
+ export { i as useAcceptWidgetDisclosures };
@@ -7,16 +7,17 @@ import { ACCEPT_DISCLOSURES_WIDGET_LABELS_EN as n } from "../../ui/dist/index2.j
7
7
  import { AcceptDisclosuresWidget as r } from "../../ui/dist/index3.js";
8
8
  import "../../ui/dist/index.js";
9
9
  import { resolveAcceptDisclosuresContent as i } from "./index3.js";
10
- import { useAcceptDisclosures as a } from "../../data-access/dist/index2.js";
10
+ import { useAcceptWidgetDisclosures as a } from "../../data-access/dist/index2.js";
11
11
  import "../../data-access/dist/index.js";
12
12
  import { useAnalyticsTrack as o } from "../../../shared/feature/dist/lib/analytics/hooks.js";
13
13
  import { WidgetProvider as s } from "../../../shared/feature/dist/lib/WidgetProvider/WidgetProvider.js";
14
- import { useRefetchWidget as c, useWidgetConfig as l } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
14
+ import { extractApiErrorMessage as c } from "../../../shared/util/dist/index14.js";
15
+ import { useRefetchWidget as l, useWidgetConfig as u } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
15
16
  import "../../../shared/feature/dist/index.js";
16
- import { useEffect as u, useState as d } from "react";
17
- import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
17
+ import { useCallback as d, useEffect as f, useRef as p, useState as m } from "react";
18
+ import { Fragment as h, jsx as g, jsxs as _ } from "react/jsx-runtime";
18
19
  //#region ../../libs/tesouro-embedded-components-react/accept-disclosures-widget/feature/dist/index4.js
19
- function h(e) {
20
+ function v(e) {
20
21
  return {
21
22
  ...n,
22
23
  ...e,
@@ -26,58 +27,92 @@ function h(e) {
26
27
  }
27
28
  };
28
29
  }
29
- function g(e, t, n) {
30
- return /* @__PURE__ */ m(f, { children: [
30
+ function y(e, t, n) {
31
+ return /* @__PURE__ */ _(h, { children: [
31
32
  n.providerAttributionPrefix,
32
- /* @__PURE__ */ p("strong", { children: e }),
33
+ /* @__PURE__ */ g("strong", { children: e }),
33
34
  n.providerAttributionMiddle,
34
35
  t,
35
36
  n.providerAttributionSuffix
36
37
  ] });
37
38
  }
38
- function _({ disclosureLinks: t, labels: n, onAccept: r }) {
39
- let a = o(), { initResponse: s } = l(), c = h(n), [f, m] = d(!1);
40
- u(() => {
41
- a(e.Mounted);
42
- }, [a]);
43
- let g = i({
44
- disclosureLinks: t,
45
- vspName: s?.vspName,
46
- bankName: s?.bankName,
47
- labels: n
39
+ function b({ invitationToken: t, userId: n, disclosureLinks: r, labels: a, onAccepted: s }) {
40
+ let c = o(), { initResponse: l } = u(), d = v(a);
41
+ f(() => {
42
+ c(e.Mounted);
43
+ }, [c]);
44
+ let p = i({
45
+ disclosureLinks: r,
46
+ vspName: l?.vspName,
47
+ bankName: l?.bankName,
48
+ labels: a
48
49
  });
49
- if (f || !g) return null;
50
- let _ = `${g.vspName}:${g.bankName}:${g.agreementText}:${g.disclosureLinks.map((e) => e.href).join("|")}`;
51
- return /* @__PURE__ */ p(v, {
52
- labelOverrides: n,
53
- content: g,
54
- labels: c,
55
- onAccept: r,
56
- onAccepted: () => m(!0)
57
- }, _);
50
+ if (!p) return null;
51
+ let m = `${t}:${n}:${p.vspName}:${p.bankName}:${p.agreementText}:${p.disclosureLinks.map((e) => e.href).join("|")}`;
52
+ return /* @__PURE__ */ g(x, {
53
+ invitationToken: t,
54
+ userId: n,
55
+ labelOverrides: a,
56
+ content: p,
57
+ labels: d,
58
+ onAccepted: s
59
+ }, m);
58
60
  }
59
- function v({ labelOverrides: e, content: t, labels: n, onAccept: i, onAccepted: o }) {
60
- let [s, l] = d(!1), u = a(), f = c();
61
- return /* @__PURE__ */ p(r, {
62
- labels: e,
63
- providerAttribution: g(t.vspName, t.bankName, n),
64
- agreementText: t.agreementText,
65
- disclosureLinks: t.disclosureLinks,
66
- isAgreed: s,
67
- onAgreedChange: l,
68
- onAccept: async () => {
61
+ function x({ invitationToken: e, userId: t, labelOverrides: n, content: i, labels: o, onAccepted: s }) {
62
+ let [u, f] = m(!1), [h, _] = m(), [v, b] = m(!1), [x, S] = m(!1), C = p(!1), { mutateAsync: w } = a(), T = l(), E = d((e) => {
63
+ _(void 0), f(e);
64
+ }, []), D = d(async () => {
65
+ if (!(!u || v || x)) {
66
+ _(void 0), b(!0);
69
67
  try {
70
- i ? await i() : await u.mutateAsync({});
71
- } catch (e) {
72
- console.error("[accept-disclosures] acceptance failed", e);
73
- return;
68
+ if (!C.current) try {
69
+ await w({
70
+ invitationToken: e,
71
+ userId: t
72
+ }), C.current = !0;
73
+ } catch (e) {
74
+ _(c(e) ?? o.acceptErrorFallback);
75
+ return;
76
+ }
77
+ try {
78
+ await s?.();
79
+ } catch (e) {
80
+ _(c(e) ?? o.acceptErrorFallback);
81
+ return;
82
+ }
83
+ T(), S(!0);
84
+ } finally {
85
+ b(!1);
74
86
  }
75
- o(), f();
76
87
  }
88
+ }, [
89
+ w,
90
+ x,
91
+ e,
92
+ u,
93
+ v,
94
+ o.acceptErrorFallback,
95
+ s,
96
+ T,
97
+ t
98
+ ]);
99
+ return /* @__PURE__ */ g(r, {
100
+ labels: n,
101
+ providerAttribution: y(i.vspName, i.bankName, o),
102
+ agreementText: i.agreementText,
103
+ disclosureLinks: i.disclosureLinks,
104
+ isAgreed: u,
105
+ onAgreedChange: E,
106
+ onAccept: () => {
107
+ D();
108
+ },
109
+ isSubmitting: v,
110
+ isAccepted: x,
111
+ errorMessage: h
77
112
  });
78
113
  }
79
- function y({ baseUrl: e, widgetToken: n, organizationId: r, configClient: i, linkComponent: a, implementation: o, uiFramework: c, errorFallback: l, onError: u, analytics: d, ...f }) {
80
- return /* @__PURE__ */ p(s, {
114
+ function S({ baseUrl: e, widgetToken: n, organizationId: r, configClient: i, linkComponent: a, implementation: o, uiFramework: c, errorFallback: l, onError: u, analytics: d, ...f }) {
115
+ return /* @__PURE__ */ g(s, {
81
116
  widgetName: t,
82
117
  baseUrl: e,
83
118
  widgetToken: n,
@@ -89,8 +124,8 @@ function y({ baseUrl: e, widgetToken: n, organizationId: r, configClient: i, lin
89
124
  errorFallback: l,
90
125
  onError: u,
91
126
  analytics: d,
92
- children: /* @__PURE__ */ p(_, { ...f })
127
+ children: /* @__PURE__ */ g(b, { ...f })
93
128
  });
94
129
  }
95
130
  //#endregion
96
- export { y as AcceptDisclosuresWidget };
131
+ export { S as AcceptDisclosuresWidget };
@@ -3,6 +3,7 @@ var e = {
3
3
  title: "Review and accept these banking disclosures",
4
4
  acceptButton: "Accept",
5
5
  agreementCheckboxAriaLabel: "Agree to banking disclosures",
6
+ acceptErrorFallback: "Failed to accept disclosures",
6
7
  agreementTextTemplate: "I agree to {bankName}'s Terms of Use and Privacy Policy, consent to receive electronic communications about my accounts and services, and acknowledge receipt of the USA PATRIOT Act Disclosure.",
7
8
  providerAttributionPrefix: "Banking services for ",
8
9
  providerAttributionMiddle: " are provided by ",
@@ -3,22 +3,22 @@ import { Button as t, Checkbox as n } from "../../../../../packages/shared-ui-sh
3
3
  import { useId as r } from "react";
4
4
  import { jsx as i, jsxs as a } from "react/jsx-runtime";
5
5
  //#region ../../libs/tesouro-embedded-components-react/accept-disclosures-widget/ui/dist/index3.js
6
- function o({ providerAttribution: o, agreementText: s, disclosureLinks: c, isAgreed: l, onAgreedChange: u, onAccept: d, labels: f }) {
7
- let p = {
6
+ function o({ providerAttribution: o, agreementText: s, disclosureLinks: c, isAgreed: l, onAgreedChange: u, onAccept: d, isSubmitting: f = !1, isAccepted: p = !1, errorMessage: m, labels: h }) {
7
+ let g = f || p, _ = {
8
8
  ...e,
9
- ...f,
9
+ ...h,
10
10
  linkLabels: {
11
11
  ...e.linkLabels,
12
- ...f?.linkLabels
12
+ ...h?.linkLabels
13
13
  }
14
- }, m = r(), h = `${m}-agree`, g = `${m}-agree-description`;
14
+ }, v = r(), y = `${v}-agree`, b = `${v}-agree-description`, x = `${v}-accept-error`;
15
15
  return /* @__PURE__ */ a("div", {
16
16
  "data-testid": "accept-disclosures-widget-root",
17
17
  className: "ttw:block ttw:w-full ttw:rounded-lg ttw:border ttw:border-border ttw:bg-background ttw:p-6",
18
18
  children: [
19
19
  /* @__PURE__ */ i("h2", {
20
20
  className: "ttw:mb-2 ttw:text-lg ttw:font-semibold ttw:text-foreground",
21
- children: p.title
21
+ children: _.title
22
22
  }),
23
23
  /* @__PURE__ */ i("p", {
24
24
  "data-testid": "accept-disclosures-provider-attribution",
@@ -42,15 +42,16 @@ function o({ providerAttribution: o, agreementText: s, disclosureLinks: c, isAgr
42
42
  /* @__PURE__ */ a("div", {
43
43
  className: "ttw:mb-4 ttw:flex ttw:items-start ttw:gap-3",
44
44
  children: [/* @__PURE__ */ i(n, {
45
- id: h,
45
+ id: y,
46
46
  "data-testid": "accept-disclosures-agree-checkbox",
47
47
  checked: l,
48
+ disabled: g,
48
49
  onCheckedChange: (e) => u(e === !0),
49
- "aria-label": p.agreementCheckboxAriaLabel,
50
- "aria-describedby": g,
50
+ "aria-label": _.agreementCheckboxAriaLabel,
51
+ "aria-describedby": b,
51
52
  className: "ttw:mt-1 ttw:shrink-0"
52
53
  }), /* @__PURE__ */ i("p", {
53
- id: g,
54
+ id: b,
54
55
  "data-testid": "accept-disclosures-agreement-text",
55
56
  className: "ttw:text-sm ttw:font-normal ttw:leading-relaxed ttw:text-foreground",
56
57
  children: s
@@ -59,10 +60,19 @@ function o({ providerAttribution: o, agreementText: s, disclosureLinks: c, isAgr
59
60
  /* @__PURE__ */ i(t, {
60
61
  type: "button",
61
62
  "data-testid": "accept-disclosures-accept-button",
62
- disabled: !l,
63
+ disabled: !l || g,
64
+ "aria-busy": f || void 0,
65
+ "aria-describedby": m ? x : void 0,
63
66
  onClick: d,
64
- children: p.acceptButton
65
- })
67
+ children: _.acceptButton
68
+ }),
69
+ m ? /* @__PURE__ */ i("p", {
70
+ id: x,
71
+ "data-testid": "accept-disclosures-error",
72
+ role: "alert",
73
+ className: "ttw:mt-3 ttw:text-sm ttw:text-destructive",
74
+ children: m
75
+ }) : null
66
76
  ]
67
77
  });
68
78
  }
@@ -15,7 +15,7 @@ import { copyTextToClipboard as ae, formatAmountLabel as a, formatTotalAvailable
15
15
  import { DEFAULT_FEATURE_LABELS as se } from "./index4.js";
16
16
  import { getBankAccountsPermissions as ce } from "./index5.js";
17
17
  import { toAccessRows as le, toOrganizationRoleOptions as ue, toTeamMembers as de } from "./index6.js";
18
- import { DEFAULT_LABELS as fe } from "../../ui/dist/index2.js";
18
+ import { DEFAULT_LABELS as fe } from "../../ui/dist/lib/labels.js";
19
19
  import "../../ui/dist/index.js";
20
20
  import { useCreateBankAccountMutation as pe } from "../../data-access/dist/index3.js";
21
21
  import { useGrantBankAccountAccessMutation as me } from "../../data-access/dist/index4.js";
@@ -7,7 +7,7 @@ import "../../../shared/ui/dist/index.js";
7
7
  import { WidgetProvider as t } from "../../../shared/feature/dist/lib/WidgetProvider/WidgetProvider.js";
8
8
  import "../../../shared/feature/dist/index.js";
9
9
  import { WIDGET_NAME as n } from "./index2.js";
10
- import { BankAccountsWidgetUi as r } from "../../ui/dist/index6.js";
10
+ import { BankAccountsWidgetUi as r } from "../../ui/dist/lib/BankAccountsWidgetUi.js";
11
11
  import "../../ui/dist/index.js";
12
12
  import { useBankAccountsWidget as i } from "./index7.js";
13
13
  import { AccountDetailsWidget as a } from "../../account-details/feature/dist/index8.js";
@@ -1,3 +1,3 @@
1
- import { DEFAULT_LABELS as e } from "./index2.js";
2
- import { BankAccountsWidgetUi as t } from "./index6.js";
1
+ import { DEFAULT_LABELS as e } from "./lib/labels.js";
2
+ import { BankAccountsWidgetUi as t } from "./lib/BankAccountsWidgetUi.js";
3
3
  export { t as BankAccountsWidgetUi, e as DEFAULT_LABELS };
@@ -2,11 +2,11 @@
2
2
  "use client";
3
3
  "use client";
4
4
  "use client";
5
- import { Button as e } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
6
- import { formatOpenAccountAriaLabel as t } from "./index2.js";
5
+ import { Button as e } from "../../../../../../packages/shared-ui-shadcn/dist/index.js";
6
+ import { formatOpenAccountAriaLabel as t } from "./labels.js";
7
7
  import { jsx as n, jsxs as r } from "react/jsx-runtime";
8
8
  import { CheckCircle2Icon as i, CopyIcon as a, EyeIcon as o, EyeOffIcon as s, PlusIcon as c } from "lucide-react";
9
- //#region ../../libs/tesouro-embedded-components-react/bank-accounts-widget/ui/dist/index3.js
9
+ //#region ../../libs/tesouro-embedded-components-react/bank-accounts-widget/ui/dist/lib/AccountCard.js
10
10
  var l = "ttw:absolute ttw:inset-0 ttw:z-0 ttw:cursor-pointer ttw:rounded-xl ttw:border-0 ttw:bg-transparent ttw:outline-none focus-visible:ttw:ring-2 focus-visible:ttw:ring-ring focus-visible:ttw:ring-offset-2", u = "ttw:pointer-events-auto ttw:relative ttw:z-10 ttw:size-7 ttw:text-primary";
11
11
  function d({ labels: c, card: d, testId: f }) {
12
12
  return /* @__PURE__ */ r("article", {
@@ -2,14 +2,14 @@
2
2
  "use client";
3
3
  "use client";
4
4
  "use client";
5
- import { InlineErrorAlert as e } from "../../../shared/ui/dist/lib/InlineErrorAlert/InlineErrorAlert.js";
6
- import "../../../shared/ui/dist/index.js";
7
- import { DEFAULT_LABELS as t } from "./index2.js";
8
- import { AccountCard as n, AddAccountCard as r } from "./index3.js";
9
- import { AccountCardSkeleton as i, BankingHeader as a } from "./index4.js";
10
- import { CreateAccountDialog as o } from "./index5.js";
5
+ import { InlineErrorAlert as e } from "../../../../shared/ui/dist/lib/InlineErrorAlert/InlineErrorAlert.js";
6
+ import "../../../../shared/ui/dist/index.js";
7
+ import { DEFAULT_LABELS as t } from "./labels.js";
8
+ import { AccountCard as n, AddAccountCard as r } from "./AccountCard.js";
9
+ import { AccountCardSkeleton as i, BankingHeader as a } from "./BankingHeader.js";
10
+ import { CreateAccountDialog as o } from "./CreateAccountDialog.js";
11
11
  import { Fragment as s, jsx as c, jsxs as l } from "react/jsx-runtime";
12
- //#region ../../libs/tesouro-embedded-components-react/bank-accounts-widget/ui/dist/index6.js
12
+ //#region ../../libs/tesouro-embedded-components-react/bank-accounts-widget/ui/dist/lib/BankAccountsWidgetUi.js
13
13
  function u({ labels: u, "data-testid": d, title: f, bankDisplayName: p, bankLogoSrc: m, bankLogoAlt: h, availableBalanceLabel: g, shouldDisplayAvailableBalance: _, isBankingTaglineVisible: v, accountCards: y, accountCardTestId: b, shouldDisplayAddAccountCard: x, isLoading: S, isError: C, isCreateOpen: w, createForm: T, legalCopy: E, accessRows: D, isTeamMembersLoading: O, isTeamMembersError: k, isCreateSubmitDisabled: A, isCreateError: j, hasNicknameError: M, isSubmitting: N, isCreateDisabled: P, onCreateOpenChange: F, onCreateFormChange: I, onCreateSubmit: L, onAddAccountClick: R }) {
14
14
  let z = {
15
15
  ...t,
@@ -2,10 +2,10 @@
2
2
  "use client";
3
3
  "use client";
4
4
  "use client";
5
- import { Skeleton as e, Tooltip as t, TooltipContent as n, TooltipProvider as r, TooltipTrigger as i, Typography as a } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
5
+ import { Skeleton as e, Tooltip as t, TooltipContent as n, TooltipProvider as r, TooltipTrigger as i, Typography as a } from "../../../../../../packages/shared-ui-shadcn/dist/index.js";
6
6
  import { jsx as o, jsxs as s } from "react/jsx-runtime";
7
7
  import { HelpCircleIcon as c } from "lucide-react";
8
- //#region ../../libs/tesouro-embedded-components-react/bank-accounts-widget/ui/dist/index4.js
8
+ //#region ../../libs/tesouro-embedded-components-react/bank-accounts-widget/ui/dist/lib/BankingHeader.js
9
9
  function l({ labels: e, title: l, bankDisplayName: u, bankLogoSrc: d, bankLogoAlt: f, availableBalanceLabel: p, shouldDisplayAvailableBalance: m, isBankingTaglineVisible: h }) {
10
10
  return /* @__PURE__ */ s("header", {
11
11
  className: "ttw:mb-6 ttw:space-y-2",
@@ -2,13 +2,13 @@
2
2
  "use client";
3
3
  "use client";
4
4
  "use client";
5
- import { Button as e, Dialog as t, DialogContent as n, DialogDescription as r, DialogFooter as i, DialogHeader as a, DialogTitle as o, Input as s, Label as c, Skeleton as l, Switch as u, Tooltip as d, TooltipContent as f, TooltipProvider as p, TooltipTrigger as m } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
6
- import { InlineErrorAlert as h } from "../../../shared/ui/dist/lib/InlineErrorAlert/InlineErrorAlert.js";
7
- import "../../../shared/ui/dist/index.js";
5
+ import { Button as e, Dialog as t, DialogContent as n, DialogDescription as r, DialogFooter as i, DialogHeader as a, DialogTitle as o, Input as s, Label as c, Skeleton as l, Switch as u, Tooltip as d, TooltipContent as f, TooltipProvider as p, TooltipTrigger as m } from "../../../../../../packages/shared-ui-shadcn/dist/index.js";
6
+ import { InlineErrorAlert as h } from "../../../../shared/ui/dist/lib/InlineErrorAlert/InlineErrorAlert.js";
7
+ import "../../../../shared/ui/dist/index.js";
8
8
  import { Fragment as g } from "react";
9
9
  import { jsx as _, jsxs as v } from "react/jsx-runtime";
10
10
  import { HelpCircleIcon as y, XIcon as b } from "lucide-react";
11
- //#region ../../libs/tesouro-embedded-components-react/bank-accounts-widget/ui/dist/index5.js
11
+ //#region ../../libs/tesouro-embedded-components-react/bank-accounts-widget/ui/dist/lib/CreateAccountDialog.js
12
12
  function x(e, t, n, r) {
13
13
  return e.split(/(\{bankName\}|\{vspName\}|\{agreementLink\})/g).map((e, i) => e === "{bankName}" ? t : e === "{vspName}" ? n : e === "{agreementLink}" ? /* @__PURE__ */ _(g, { children: r }, i) : e);
14
14
  }