@tesouro/embedded-components-react 0.5.181 → 0.5.183

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 (41) hide show
  1. package/README.md +32 -32
  2. package/dist/index.css +6 -0
  3. package/dist/index.d.ts +48 -20
  4. package/dist/index.js +2 -2
  5. package/dist/lib/BankAccountOnboardingWidget.d.ts +30 -1
  6. package/dist/lib/CreditCardsWidget.d.ts +9 -11
  7. package/dist/lib/CreditCardsWidget.js +1 -1
  8. package/dist/lib/DebitCardsWidget.d.ts +14 -15
  9. package/dist/lib/DebitCardsWidget.js +1 -1
  10. package/dist/lib/WidgetSuite.d.ts +43 -16
  11. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/data-access/dist/index.js +5 -4
  12. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/data-access/dist/index10.js +3 -32
  13. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/data-access/dist/index11.js +24 -33
  14. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/data-access/dist/index12.js +44 -0
  15. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/data-access/dist/index8.js +13 -36
  16. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/data-access/dist/index9.js +43 -3
  17. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index12.js +4 -0
  18. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index23.js +3 -0
  19. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index25.js +339 -301
  20. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index.js +3 -1
  21. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index27.js +11 -0
  22. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index28.js +64 -0
  23. package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/index.js +4 -4
  24. package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/index10.js +87 -8
  25. package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/index11.js +3 -3
  26. package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/index12.js +17 -0
  27. package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/index4.js +17 -24
  28. package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/index5.js +23 -24
  29. package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/index6.js +24 -30
  30. package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/index7.js +28 -55
  31. package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/index8.js +53 -222
  32. package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/index9.js +219 -87
  33. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +34 -34
  34. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js +188 -181
  35. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/sdk.gen.js +162 -154
  36. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  37. package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/lib/OnboardingShell/OnboardingShell.js +67 -55
  38. package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/lib/OnboardingShell/labels.js +1 -0
  39. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index9.js +3 -3
  40. package/package.json +1 -1
  41. package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/index3.js +0 -19
@@ -2,43 +2,34 @@
2
2
  "use client";
3
3
  "use client";
4
4
  "use client";
5
- import { getBankAccountApplicationOptions as e } from "../../../shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js";
6
- import { withAuthEpoch as t } from "../../../shared/data-access/dist/lib/withAuthEpoch.js";
7
- import { useEmbedApi as n } from "../../../shared/data-access/dist/lib/EmbedApiContext.js";
8
- import { optionalOrganizationHeaders as r } from "../../../shared/data-access/dist/lib/organizationHeaders.js";
5
+ import { applicationStatusQueryOptions as e } from "../../../shared/data-access/dist/lib/applicationStatusQueryOptions.js";
6
+ import { useEmbedApi as t } from "../../../shared/data-access/dist/lib/EmbedApiContext.js";
9
7
  import "../../../shared/data-access/dist/index.js";
10
- import { useInstallApplicationClientSecret as i } from "./index3.js";
11
- import { hasFreshAnswer as a } from "./index9.js";
12
- import { useMemo as o } from "react";
13
- import { useQuery as s } from "@tanstack/react-query";
8
+ import { hasFreshAnswer as n } from "./index10.js";
9
+ import { useQuery as r } from "@tanstack/react-query";
14
10
  //#region ../../libs/tesouro-embedded-components-react/bank-account-onboarding-widget/data-access/dist/index11.js
15
- var c = (e, t) => (n, r) => {
16
- if (n === void 0 || r === void 0) return;
17
- let [i] = r.queryKey;
18
- if (i !== void 0 && i.baseUrl === e && i.path?.id === t) return n;
19
- };
20
- function l(l, u) {
21
- let { client: d, organizationId: f, widgetToken: p, authEpoch: m, organizationPending: h } = n();
22
- i(l, u);
23
- let g = !!(p && l && u), _ = d.getConfig().baseUrl, v = o(() => c(_, l), [_, l]), y = s({
24
- ...t(e({
25
- client: d,
26
- path: { id: l ?? "" },
27
- headers: r(f)
28
- }), {
29
- authEpoch: m,
30
- organizationPending: h
11
+ var i = "DRAFT", a = "BANK_ACCOUNT", o = "STARTED_BY_YOU";
12
+ function s(e) {
13
+ return e.find((e) => e.product === a && e.ownership === o && e.status === i && !!e.applicationId && !!e.clientSecret);
14
+ }
15
+ function c(e) {
16
+ return e.filter((e) => e.product === a && e.ownership === o).map((e) => e.applicationId).filter((e) => !!e);
17
+ }
18
+ function l() {
19
+ let { client: i, widgetToken: a, authEpoch: o } = t(), l = !!a, u = r({
20
+ ...e({
21
+ client: i,
22
+ widgetToken: a,
23
+ authEpoch: o
31
24
  }),
32
- placeholderData: v,
33
- enabled: g,
34
- retry: 2,
35
- retryDelay: 300
36
- });
25
+ enabled: l
26
+ }), d = l && n(u), f = d && !u.isError ? u.data?.applications ?? null : null, p = f ? s(f) : void 0;
37
27
  return {
38
- application: y.data ?? null,
39
- isResolved: !g || a(y),
40
- isUnavailable: g && y.isError
28
+ applicationId: p?.applicationId ?? null,
29
+ clientSecret: p?.clientSecret ?? null,
30
+ isResolved: d,
31
+ ownApplicationIds: f ? c(f) : null
41
32
  };
42
33
  }
43
34
  //#endregion
44
- export { l as useStartedBankAccountApplication };
35
+ export { l as useResumableBankAccountApplication };
@@ -0,0 +1,44 @@
1
+ "use client";
2
+ "use client";
3
+ "use client";
4
+ "use client";
5
+ import { getBankAccountApplicationOptions as e } from "../../../shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js";
6
+ import { withAuthEpoch as t } from "../../../shared/data-access/dist/lib/withAuthEpoch.js";
7
+ import { useEmbedApi as n } from "../../../shared/data-access/dist/lib/EmbedApiContext.js";
8
+ import { optionalOrganizationHeaders as r } from "../../../shared/data-access/dist/lib/organizationHeaders.js";
9
+ import "../../../shared/data-access/dist/index.js";
10
+ import { useInstallApplicationClientSecret as i } from "./index3.js";
11
+ import { hasFreshAnswer as a } from "./index10.js";
12
+ import { useMemo as o } from "react";
13
+ import { useQuery as s } from "@tanstack/react-query";
14
+ //#region ../../libs/tesouro-embedded-components-react/bank-account-onboarding-widget/data-access/dist/index12.js
15
+ var c = (e, t) => (n, r) => {
16
+ if (n === void 0 || r === void 0) return;
17
+ let [i] = r.queryKey;
18
+ if (i !== void 0 && i.baseUrl === e && i.path?.id === t) return n;
19
+ };
20
+ function l(l, u) {
21
+ let { client: d, organizationId: f, widgetToken: p, authEpoch: m, organizationPending: h } = n();
22
+ i(l, u);
23
+ let g = !!(p && l && u), _ = d.getConfig().baseUrl, v = o(() => c(_, l), [_, l]), y = s({
24
+ ...t(e({
25
+ client: d,
26
+ path: { id: l ?? "" },
27
+ headers: r(f)
28
+ }), {
29
+ authEpoch: m,
30
+ organizationPending: h
31
+ }),
32
+ placeholderData: v,
33
+ enabled: g,
34
+ retry: 2,
35
+ retryDelay: 300
36
+ });
37
+ return {
38
+ application: y.data ?? null,
39
+ isResolved: !g || a(y),
40
+ isUnavailable: g && y.isError
41
+ };
42
+ }
43
+ //#endregion
44
+ export { l as useStartedBankAccountApplication };
@@ -2,45 +2,22 @@
2
2
  "use client";
3
3
  "use client";
4
4
  "use client";
5
- import { getApplicationStatus as e } from "../../../shared/data-access/dist/lib/rest/sdk.gen.js";
5
+ import { deleteBankAccountApplicationMutation as e } from "../../../shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js";
6
6
  import { useEmbedApi as t } from "../../../shared/data-access/dist/lib/EmbedApiContext.js";
7
+ import { optionalOrganizationHeaders as n } from "../../../shared/data-access/dist/lib/organizationHeaders.js";
7
8
  import "../../../shared/data-access/dist/index.js";
8
- import { useCallback as n } from "react";
9
+ import { refreshApplicationStatus as r } from "./index4.js";
10
+ import { useMutation as i } from "@tanstack/react-query";
9
11
  //#region ../../libs/tesouro-embedded-components-react/bank-account-onboarding-widget/data-access/dist/index8.js
10
- var r = 1e3, i = 6, a = "COMPLETE", o = "BANK_ACCOUNT";
11
- function s(e, t) {
12
- return new Promise((n, r) => {
13
- if (t?.aborted) {
14
- r(new DOMException("Aborted", "AbortError"));
15
- return;
16
- }
17
- let i = () => {
18
- clearTimeout(a), r(new DOMException("Aborted", "AbortError"));
19
- }, a = setTimeout(() => {
20
- t?.removeEventListener("abort", i), n();
21
- }, e);
22
- t?.addEventListener("abort", i, { once: !0 });
12
+ function a() {
13
+ let { client: a, organizationId: o } = t();
14
+ return i({
15
+ ...e({
16
+ client: a,
17
+ headers: n(o)
18
+ }),
19
+ onSuccess: () => r(a)
23
20
  });
24
21
  }
25
- function c() {
26
- let { client: c } = t();
27
- return n(async (t, n = {}) => {
28
- let { signal: l } = n, u = !1;
29
- for (let n = 0; n < i; n++) {
30
- if (l?.aborted) throw new DOMException("Aborted", "AbortError");
31
- try {
32
- let n = await e({
33
- client: c,
34
- signal: l
35
- });
36
- if (u = !0, n.data?.applications.some((e) => e.product === o && e.applicationId === t && e.status === a)) return { status: "complete" };
37
- } catch (e) {
38
- if (e instanceof DOMException && e.name === "AbortError") throw e;
39
- }
40
- n < 5 && await s(r, l);
41
- }
42
- return u ? { status: "timeout" } : { status: "error" };
43
- }, [c]);
44
- }
45
22
  //#endregion
46
- export { c as usePollApplicationCompletion };
23
+ export { a as useDeleteApplication };
@@ -1,6 +1,46 @@
1
+ "use client";
2
+ "use client";
3
+ "use client";
4
+ "use client";
5
+ import { getApplicationStatus as e } from "../../../shared/data-access/dist/lib/rest/sdk.gen.js";
6
+ import { useEmbedApi as t } from "../../../shared/data-access/dist/lib/EmbedApiContext.js";
7
+ import "../../../shared/data-access/dist/index.js";
8
+ import { useCallback as n } from "react";
1
9
  //#region ../../libs/tesouro-embedded-components-react/bank-account-onboarding-widget/data-access/dist/index9.js
2
- function e(e) {
3
- return (e.isSuccess || e.isError) && !e.isFetching;
10
+ var r = 1e3, i = 6, a = "COMPLETE", o = "BANK_ACCOUNT";
11
+ function s(e, t) {
12
+ return new Promise((n, r) => {
13
+ if (t?.aborted) {
14
+ r(new DOMException("Aborted", "AbortError"));
15
+ return;
16
+ }
17
+ let i = () => {
18
+ clearTimeout(a), r(new DOMException("Aborted", "AbortError"));
19
+ }, a = setTimeout(() => {
20
+ t?.removeEventListener("abort", i), n();
21
+ }, e);
22
+ t?.addEventListener("abort", i, { once: !0 });
23
+ });
24
+ }
25
+ function c() {
26
+ let { client: c } = t();
27
+ return n(async (t, n = {}) => {
28
+ let { signal: l } = n, u = !1;
29
+ for (let n = 0; n < i; n++) {
30
+ if (l?.aborted) throw new DOMException("Aborted", "AbortError");
31
+ try {
32
+ let n = await e({
33
+ client: c,
34
+ signal: l
35
+ });
36
+ if (u = !0, n.data?.applications.some((e) => e.product === o && e.applicationId === t && e.status === a)) return { status: "complete" };
37
+ } catch (e) {
38
+ if (e instanceof DOMException && e.name === "AbortError") throw e;
39
+ }
40
+ n < 5 && await s(r, l);
41
+ }
42
+ return u ? { status: "timeout" } : { status: "error" };
43
+ }, [c]);
4
44
  }
5
45
  //#endregion
6
- export { e as hasFreshAnswer };
46
+ export { c as usePollApplicationCompletion };
@@ -5,6 +5,7 @@ var e = {
5
5
  shellBack: "onboarding-shell-back",
6
6
  shellCancel: "onboarding-shell-cancel",
7
7
  shellSaveAndClose: "onboarding-shell-save-and-close",
8
+ shellDelete: "onboarding-shell-delete",
8
9
  shellNext: "onboarding-shell-next",
9
10
  shellScrollRegion: "onboarding-shell-scroll-region",
10
11
  shellScrollFade: "onboarding-shell-scroll-fade",
@@ -14,6 +15,9 @@ var e = {
14
15
  unsavedDialogSaveDraft: "unsaved-application-dialog-save-draft",
15
16
  unsavedDialogDiscard: "unsaved-application-dialog-discard",
16
17
  unsavedDialogClose: "unsaved-application-dialog-close",
18
+ deleteDialog: "delete-application-dialog",
19
+ deleteDialogConfirm: "delete-application-dialog-confirm",
20
+ deleteDialogCancel: "delete-application-dialog-cancel",
17
21
  businessDetailsPanel: "business-details-panel",
18
22
  businessDetailsEditButton: "business-details-edit-button",
19
23
  businessDetailsSummary: "business-details-summary",
@@ -13,11 +13,14 @@ var t = {
13
13
  additionalOwners: {},
14
14
  result: e,
15
15
  unsavedApplicationDialog: {},
16
+ deleteApplicationDialog: {},
16
17
  back: "Back",
17
18
  cancel: "Cancel",
18
19
  next: "Next",
19
20
  submit: "Submit application",
20
21
  saveAndClose: "Save and close",
22
+ deleteApplication: "Cancel and delete application",
23
+ applicationDeletedToast: "Application deleted.",
21
24
  applicationSavedToast: "Application saved. You can continue later.",
22
25
  businessReviewTitle: "Review your business details",
23
26
  businessReviewSubtitle: "Take a moment to make sure your business information is correct.",