@tesouro/embedded-components-react 0.2.264 → 0.2.266

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 (25) hide show
  1. package/README.md +8 -6
  2. package/dist/experimental/WidgetSuite.d.ts +93 -2
  3. package/dist/experimental/WidgetSuite.js +5 -5
  4. package/dist/experimental/index.d.ts +93 -2
  5. package/dist/experimental/index.js +5 -5
  6. package/dist/index.d.ts +29 -9
  7. package/dist/index.js +1 -1
  8. package/dist/lib/AcceptDisclosuresWidget.d.ts +17 -5
  9. package/dist/lib/AcceptDisclosuresWidget.js +1 -1
  10. package/dist/lib/WidgetProvider.d.ts +12 -4
  11. package/dist/libs/tesouro-embedded-components-react/accept-disclosures-widget/data-access/dist/index2.js +3 -3
  12. package/dist/libs/tesouro-embedded-components-react/accept-disclosures-widget/feature/dist/index3.js +1 -1
  13. package/dist/libs/tesouro-embedded-components-react/accept-disclosures-widget/feature/dist/index4.js +36 -34
  14. package/dist/libs/tesouro-embedded-components-react/accept-disclosures-widget/ui/dist/index.js +2 -2
  15. package/dist/libs/tesouro-embedded-components-react/accept-disclosures-widget/ui/dist/{index3.js → lib/AcceptDisclosuresWidget/AcceptDisclosuresWidget.js} +3 -3
  16. package/dist/libs/tesouro-embedded-components-react/accept-disclosures-widget/ui/dist/{index2.js → lib/AcceptDisclosuresWidget/labels.js} +1 -1
  17. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  18. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index.js +5 -5
  19. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index3.js +4 -15
  20. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index4.js +26 -91
  21. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index5.js +87 -74
  22. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index6.js +142 -0
  23. package/dist/libs/tesouro-embedded-components-react/widget-suite/ui/dist/index2.js +1 -0
  24. package/dist/libs/tesouro-embedded-components-react/widget-suite/ui/dist/index3.js +49 -33
  25. package/package.json +1 -1
@@ -3,8 +3,8 @@
3
3
  "use client";
4
4
  "use client";
5
5
  import { AcceptDisclosuresWidgetAnalyticsEvent as e, WIDGET_NAME as t } from "./index2.js";
6
- import { ACCEPT_DISCLOSURES_WIDGET_LABELS_EN as n } from "../../ui/dist/index2.js";
7
- import { AcceptDisclosuresWidget as r } from "../../ui/dist/index3.js";
6
+ import { ACCEPT_DISCLOSURES_WIDGET_LABELS_EN as n } from "../../ui/dist/lib/AcceptDisclosuresWidget/labels.js";
7
+ import { AcceptDisclosuresWidget as r } from "../../ui/dist/lib/AcceptDisclosuresWidget/AcceptDisclosuresWidget.js";
8
8
  import "../../ui/dist/index.js";
9
9
  import { resolveAcceptDisclosuresContent as i } from "./index3.js";
10
10
  import { useAcceptWidgetDisclosures as a } from "../../data-access/dist/index2.js";
@@ -12,12 +12,12 @@ 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
14
  import { extractApiErrorMessage as c } from "../../../shared/util/dist/lib/apiErrors.js";
15
- import { useRefetchWidget as l, useWidgetConfig as u } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
15
+ import { useRefetchWidget as l, useWidgetConfig as u, useWidgetInitStaleForToken as d } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
16
16
  import "../../../shared/feature/dist/index.js";
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";
17
+ import { useCallback as f, useEffect as p, useRef as m, useState as h } from "react";
18
+ import { Fragment as g, jsx as _, jsxs as v } from "react/jsx-runtime";
19
19
  //#region ../../libs/tesouro-embedded-components-react/accept-disclosures-widget/feature/dist/index4.js
20
- function v(e) {
20
+ function y(e) {
21
21
  return {
22
22
  ...n,
23
23
  ...e,
@@ -27,43 +27,45 @@ function v(e) {
27
27
  }
28
28
  };
29
29
  }
30
- function y(e, t, n) {
31
- return /* @__PURE__ */ _(h, { children: [
30
+ function b(e, t, n) {
31
+ return /* @__PURE__ */ v(g, { children: [
32
32
  n.providerAttributionPrefix,
33
- /* @__PURE__ */ g("strong", { children: e }),
33
+ /* @__PURE__ */ _("strong", { children: e }),
34
34
  n.providerAttributionMiddle,
35
35
  t,
36
36
  n.providerAttributionSuffix
37
37
  ] });
38
38
  }
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(() => {
39
+ function x({ invitationToken: t, userId: n, disclosureLinks: r, labels: a, onAccepted: s }) {
40
+ let c = o(), { initResponse: l } = u(), f = d(), m = y(a);
41
+ p(() => {
42
42
  c(e.Mounted);
43
43
  }, [c]);
44
- let p = i({
44
+ let h = i({
45
45
  disclosureLinks: r,
46
46
  vspName: l?.vspName,
47
47
  bankName: l?.bankName,
48
48
  labels: a
49
49
  });
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, {
50
+ if (!h) return null;
51
+ let g = !!(t && n);
52
+ if (!g && f) return null;
53
+ let v = `${g ? `invite:${t}:${n}` : `user:${l?.userId ?? ""}`}:${h.vspName}:${h.bankName}:${h.agreementText}:${h.disclosureLinks.map((e) => e.href).join("|")}`;
54
+ return /* @__PURE__ */ _(S, {
53
55
  invitationToken: t,
54
56
  userId: n,
55
57
  labelOverrides: a,
56
- content: p,
57
- labels: d,
58
+ content: h,
59
+ labels: m,
58
60
  onAccepted: s
59
- }, m);
61
+ }, v);
60
62
  }
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 () => {
63
+ function S({ invitationToken: e, userId: t, labelOverrides: n, content: i, labels: o, onAccepted: s }) {
64
+ let [u, d] = h(!1), [p, g] = h(), [v, y] = h(!1), [x, S] = h(!1), C = m(!1), { mutateAsync: w } = a(), T = l(), E = f((e) => {
65
+ g(void 0), d(e);
66
+ }, []), D = f(async () => {
65
67
  if (!(!u || v || x)) {
66
- _(void 0), b(!0);
68
+ g(void 0), y(!0);
67
69
  try {
68
70
  if (!C.current) try {
69
71
  await w({
@@ -71,18 +73,18 @@ function x({ invitationToken: e, userId: t, labelOverrides: n, content: i, label
71
73
  userId: t
72
74
  }), C.current = !0;
73
75
  } catch (e) {
74
- _(c(e) ?? o.acceptErrorFallback);
76
+ g(c(e) ?? o.acceptErrorFallback);
75
77
  return;
76
78
  }
77
79
  try {
78
80
  await s?.();
79
81
  } catch (e) {
80
- _(c(e) ?? o.acceptErrorFallback);
82
+ g(c(e) ?? o.acceptErrorFallback);
81
83
  return;
82
84
  }
83
85
  T(), S(!0);
84
86
  } finally {
85
- b(!1);
87
+ y(!1);
86
88
  }
87
89
  }
88
90
  }, [
@@ -96,9 +98,9 @@ function x({ invitationToken: e, userId: t, labelOverrides: n, content: i, label
96
98
  T,
97
99
  t
98
100
  ]);
99
- return /* @__PURE__ */ g(r, {
101
+ return /* @__PURE__ */ _(r, {
100
102
  labels: n,
101
- providerAttribution: y(i.vspName, i.bankName, o),
103
+ providerAttribution: b(i.vspName, i.bankName, o),
102
104
  agreementText: i.agreementText,
103
105
  disclosureLinks: i.disclosureLinks,
104
106
  isAgreed: u,
@@ -108,11 +110,11 @@ function x({ invitationToken: e, userId: t, labelOverrides: n, content: i, label
108
110
  },
109
111
  isSubmitting: v,
110
112
  isAccepted: x,
111
- errorMessage: h
113
+ errorMessage: p
112
114
  });
113
115
  }
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, {
116
+ function C({ baseUrl: e, widgetToken: n, organizationId: r, configClient: i, linkComponent: a, implementation: o, uiFramework: c, errorFallback: l, onError: u, analytics: d, ...f }) {
117
+ return /* @__PURE__ */ _(s, {
116
118
  widgetName: t,
117
119
  baseUrl: e,
118
120
  widgetToken: n,
@@ -124,8 +126,8 @@ function S({ baseUrl: e, widgetToken: n, organizationId: r, configClient: i, lin
124
126
  errorFallback: l,
125
127
  onError: u,
126
128
  analytics: d,
127
- children: /* @__PURE__ */ g(b, { ...f })
129
+ children: /* @__PURE__ */ _(x, { ...f })
128
130
  });
129
131
  }
130
132
  //#endregion
131
- export { S as AcceptDisclosuresWidget };
133
+ export { C as AcceptDisclosuresWidget };
@@ -1,3 +1,3 @@
1
- import { ACCEPT_DISCLOSURES_WIDGET_LABELS_EN as e } from "./index2.js";
2
- import { AcceptDisclosuresWidget as t } from "./index3.js";
1
+ import { ACCEPT_DISCLOSURES_WIDGET_LABELS_EN as e } from "./lib/AcceptDisclosuresWidget/labels.js";
2
+ import { AcceptDisclosuresWidget as t } from "./lib/AcceptDisclosuresWidget/AcceptDisclosuresWidget.js";
3
3
  export { e as ACCEPT_DISCLOSURES_WIDGET_LABELS_EN, t as AcceptDisclosuresWidget };
@@ -1,8 +1,8 @@
1
- import { ACCEPT_DISCLOSURES_WIDGET_LABELS_EN as e } from "./index2.js";
2
- import { Button as t, Checkbox as n } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
1
+ import { ACCEPT_DISCLOSURES_WIDGET_LABELS_EN as e } from "./labels.js";
2
+ import { Button as t, Checkbox as n } from "../../../../../../../packages/shared-ui-shadcn/dist/index.js";
3
3
  import { useId as r } from "react";
4
4
  import { jsx as i, jsxs as a } from "react/jsx-runtime";
5
- //#region ../../libs/tesouro-embedded-components-react/accept-disclosures-widget/ui/dist/index3.js
5
+ //#region ../../libs/tesouro-embedded-components-react/accept-disclosures-widget/ui/dist/lib/AcceptDisclosuresWidget/AcceptDisclosuresWidget.js
6
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
7
  let g = f || p, _ = {
8
8
  ...e,
@@ -1,4 +1,4 @@
1
- //#region ../../libs/tesouro-embedded-components-react/accept-disclosures-widget/ui/dist/index2.js
1
+ //#region ../../libs/tesouro-embedded-components-react/accept-disclosures-widget/ui/dist/lib/AcceptDisclosuresWidget/labels.js
2
2
  var e = {
3
3
  title: "Review and accept these banking disclosures",
4
4
  acceptButton: "Accept",
@@ -1,5 +1,5 @@
1
1
  //#region ../../libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js
2
- var e = "@tesouro/embedded-components-react", t = "0.2.264", n = "f1aed67e741ee746ed85f5931b6b93de3508e38e", r = Object.freeze({
2
+ var e = "@tesouro/embedded-components-react", t = "0.2.266", n = "156a33c6913a844493fc8f31e8c4483f45f2853b", r = Object.freeze({
3
3
  library_name: e,
4
4
  library_version: t,
5
5
  library_sha: n
@@ -1,6 +1,6 @@
1
- import { WIDGET_SUITE_CONTENT_LABELS_EN as e, WIDGET_SUITE_SECTION_LABELS_EN as t, WIDGET_SUITE_SECTION_TITLE_LABELS_EN as n } from "./index3.js";
2
- import { WIDGET_SUITE_DEFAULT_SECTIONS as r, WidgetSuiteSectionId as i } from "./index4.js";
3
- import { WIDGET_SUITE_SHELL_LABELS_EN as a } from "../../ui/dist/index2.js";
1
+ import { WIDGET_SUITE_CONTENT_LABELS_EN as e, WIDGET_SUITE_DISCLOSURE_LABELS_EN as t, WIDGET_SUITE_SECTION_LABELS_EN as n, WIDGET_SUITE_SECTION_TITLE_LABELS_EN as r } from "./index4.js";
2
+ import { WIDGET_SUITE_DEFAULT_SECTIONS as i, WidgetSuiteSectionId as a } from "./index5.js";
3
+ import { WIDGET_SUITE_SHELL_LABELS_EN as o } from "../../ui/dist/index2.js";
4
4
  import "../../ui/dist/index.js";
5
- import { WidgetSuite as o } from "./index5.js";
6
- export { e as WIDGET_SUITE_CONTENT_LABELS_EN, r as WIDGET_SUITE_DEFAULT_SECTIONS, t as WIDGET_SUITE_SECTION_LABELS_EN, n as WIDGET_SUITE_SECTION_TITLE_LABELS_EN, a as WIDGET_SUITE_SHELL_LABELS_EN, o as WidgetSuite, i as WidgetSuiteSectionId };
5
+ import { WidgetSuite as s } from "./index6.js";
6
+ export { e as WIDGET_SUITE_CONTENT_LABELS_EN, i as WIDGET_SUITE_DEFAULT_SECTIONS, t as WIDGET_SUITE_DISCLOSURE_LABELS_EN, n as WIDGET_SUITE_SECTION_LABELS_EN, r as WIDGET_SUITE_SECTION_TITLE_LABELS_EN, o as WIDGET_SUITE_SHELL_LABELS_EN, s as WidgetSuite, a as WidgetSuiteSectionId };
@@ -1,17 +1,6 @@
1
1
  //#region ../../libs/tesouro-embedded-components-react/widget-suite/feature/dist/index3.js
2
- var e = {
3
- dashboard: "Dashboard",
4
- accounts: "Accounts",
5
- cards: "Cards",
6
- transfers: "Transfers",
7
- "bill-pay": "Bill Pay",
8
- invoicing: "Invoicing",
9
- expenses: "Expenses",
10
- settings: "Settings"
11
- }, t = { bankTagline: "Business Banking provided by {bankName}" }, n = {
12
- creditCards: { title: "Credit cards" },
13
- debitCards: { title: "Debit cards" },
14
- expensePlaceholders: { expensesUnavailable: "Expenses are not available in this suite yet." }
15
- };
2
+ function e(e) {
3
+ return e ? e.disclosuresRequired === "REQUIRED" && !e.disclosuresAccepted : !1;
4
+ }
16
5
  //#endregion
17
- export { n as WIDGET_SUITE_CONTENT_LABELS_EN, e as WIDGET_SUITE_SECTION_LABELS_EN, t as WIDGET_SUITE_SECTION_TITLE_LABELS_EN };
6
+ export { e as needsDisclosureAcceptance };
@@ -1,97 +1,32 @@
1
- "use client";
2
- "use client";
3
- "use client";
4
- "use client";
5
- import { hasAnyScope as e } from "../../../shared/data-access/dist/lib/hasAnyScope.js";
6
- import { Scope as t } from "../../../shared/data-access/dist/lib/scopes.js";
7
- import "../../../shared/data-access/dist/index.js";
8
- import { CardProgram as n } from "../../../shared/feature/dist/lib/card/cardProgram.js";
9
- import "../../../shared/feature/dist/index.js";
10
- import { BankAccountsWidget as r } from "../../../bank-accounts-widget/feature/dist/index8.js";
11
- import "../../../bank-accounts-widget/feature/dist/index.js";
12
- import { BillPayWidget as i } from "../../../bill-pay-widget/feature/dist/index28.js";
13
- import "../../../bill-pay-widget/feature/dist/index.js";
14
- import { CardsWidget as a } from "../../../cards-widget/feature/dist/index8.js";
15
- import "../../../cards-widget/feature/dist/index.js";
16
- import { BalancesWidget as o } from "../../../balances-widget/feature/dist/index5.js";
17
- import "../../../balances-widget/feature/dist/index.js";
18
- import { InsightsWidget as s } from "../../../insights-widget/feature/dist/index11.js";
19
- import "../../../insights-widget/feature/dist/index.js";
20
- import { InvoicingWidget as c } from "../../../invoicing-widget/feature/dist/index3.js";
21
- import "../../../invoicing-widget/feature/dist/index.js";
22
- import { SettingsWidget as l } from "../../../settings-widget/feature/dist/index6.js";
23
- import "../../../settings-widget/feature/dist/index.js";
24
- import { TransfersWidget as u } from "../../../transfers-widget/feature/dist/index6.js";
25
- import "../../../transfers-widget/feature/dist/index.js";
26
- import { jsx as d, jsxs as f } from "react/jsx-runtime";
27
1
  //#region ../../libs/tesouro-embedded-components-react/widget-suite/feature/dist/index4.js
28
- var p = ({ children: e }) => /* @__PURE__ */ d("div", {
29
- className: "ttw:rounded-md ttw:border ttw:border-dashed ttw:border-border ttw:p-8 ttw:text-sm ttw:text-muted-foreground",
30
- children: e
31
- }), m = {
32
- Dashboard: "dashboard",
33
- Accounts: "accounts",
34
- Cards: "cards",
35
- Transfers: "transfers",
36
- BillPay: "bill-pay",
37
- Invoicing: "invoicing",
38
- Expenses: "expenses",
39
- Settings: "settings"
40
- }, h = [
41
- m.Dashboard,
42
- m.Accounts,
43
- m.Cards,
44
- m.Transfers,
45
- m.BillPay,
46
- m.Invoicing,
47
- m.Expenses,
48
- m.Settings
49
- ], g = {
50
- [m.Dashboard]: { render: ({ grantedScopes: n }) => {
51
- let r = e(n, [t.BankAccountReadOrg]);
52
- return /* @__PURE__ */ f("div", {
53
- className: r ? "ttw:grid ttw:gap-4 ttw:md:grid-cols-2" : "ttw:grid ttw:gap-4",
54
- children: [r && /* @__PURE__ */ d(o, {}), /* @__PURE__ */ d(s, {})]
55
- });
56
- } },
57
- [m.Accounts]: {
58
- anyOfScopes: [t.BankAccountReadOrg, t.ExternalBankAccountReadOrg],
59
- rendersOwnTitle: !0,
60
- render: () => /* @__PURE__ */ d(r, {})
2
+ var e = {
3
+ dashboard: "Dashboard",
4
+ accounts: "Accounts",
5
+ cards: "Cards",
6
+ transfers: "Transfers",
7
+ "bill-pay": "Bill Pay",
8
+ invoicing: "Invoicing",
9
+ expenses: "Expenses",
10
+ settings: "Settings"
11
+ }, t = { bankTagline: "Business Banking provided by {bankName}" }, n = {
12
+ creditCards: { title: "Credit cards" },
13
+ debitCards: { title: "Debit cards" },
14
+ expensePlaceholders: { expensesUnavailable: "Expenses are not available in this suite yet." }
15
+ }, r = {
16
+ initFailedState: {
17
+ title: "We couldn't load this page",
18
+ body: "Please try again.",
19
+ retryButton: "Try again"
61
20
  },
62
- [m.Cards]: {
63
- anyOfScopes: [t.CreditCardReadOrg, t.DebitCardReadOrg],
64
- render: ({ grantedScopes: r, labels: i }) => /* @__PURE__ */ f("div", {
65
- className: "ttw:grid ttw:gap-8",
66
- children: [e(r, [t.CreditCardReadOrg]) && /* @__PURE__ */ d(a, {
67
- cardProgram: n.Credit,
68
- labels: i.creditCards
69
- }), e(r, [t.DebitCardReadOrg]) && /* @__PURE__ */ d(a, {
70
- cardProgram: n.Debit,
71
- labels: i.debitCards
72
- })]
73
- })
21
+ refreshFailedState: {
22
+ title: "We couldn't finish loading this page",
23
+ body: "Your disclosure acceptance was saved, so you won't need to accept again.",
24
+ retryButton: "Try again"
74
25
  },
75
- [m.Transfers]: {
76
- anyOfScopes: [t.BankAccountReadOrg],
77
- render: () => /* @__PURE__ */ d(u, {})
78
- },
79
- [m.BillPay]: {
80
- anyOfScopes: [t.PayableReadOrg],
81
- render: () => /* @__PURE__ */ d(i, {})
82
- },
83
- [m.Invoicing]: {
84
- anyOfScopes: [t.InvoiceReadOrg],
85
- render: () => /* @__PURE__ */ d(c, {})
86
- },
87
- [m.Expenses]: {
88
- anyOfScopes: [t.ExpenseReadOrg, t.ExpenseReadSelf],
89
- render: ({ labels: e }) => /* @__PURE__ */ d(p, { children: e.expensePlaceholders.expensesUnavailable })
90
- },
91
- [m.Settings]: {
92
- rendersOwnTitle: !0,
93
- render: () => /* @__PURE__ */ d(l, {})
26
+ unavailableState: {
27
+ title: "This account needs to accept disclosures",
28
+ body: "The documents are not available right now. Please contact support to continue."
94
29
  }
95
30
  };
96
31
  //#endregion
97
- export { h as WIDGET_SUITE_DEFAULT_SECTIONS, g as WIDGET_SUITE_SECTIONS, m as WidgetSuiteSectionId };
32
+ export { n as WIDGET_SUITE_CONTENT_LABELS_EN, r as WIDGET_SUITE_DISCLOSURE_LABELS_EN, e as WIDGET_SUITE_SECTION_LABELS_EN, t as WIDGET_SUITE_SECTION_TITLE_LABELS_EN };
@@ -3,82 +3,95 @@
3
3
  "use client";
4
4
  "use client";
5
5
  import { hasAnyScope as e } from "../../../shared/data-access/dist/lib/hasAnyScope.js";
6
+ import { Scope as t } from "../../../shared/data-access/dist/lib/scopes.js";
6
7
  import "../../../shared/data-access/dist/index.js";
7
- import { useAnalyticsTrack as t } from "../../../shared/feature/dist/lib/analytics/hooks.js";
8
- import { WidgetProvider as n } from "../../../shared/feature/dist/lib/WidgetProvider/WidgetProvider.js";
9
- import { useWidgetConfig as r } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
8
+ import { CardProgram as n } from "../../../shared/feature/dist/lib/card/cardProgram.js";
10
9
  import "../../../shared/feature/dist/index.js";
11
- import { WIDGET_SUITE_CONTENT_LABELS_EN as i, WIDGET_SUITE_SECTION_LABELS_EN as a, WIDGET_SUITE_SECTION_TITLE_LABELS_EN as o } from "./index3.js";
12
- import { WIDGET_SUITE_SECTIONS as s } from "./index4.js";
13
- import { WIDGET_NAME as c, WidgetSuiteAnalyticsEvent as l } from "./index2.js";
14
- import { WidgetSuiteShell as u } from "../../ui/dist/index3.js";
15
- import { SectionPageTitle as d } from "../../ui/dist/index4.js";
16
- import "../../ui/dist/index.js";
17
- import { useEffect as f, useMemo as p, useState as m } from "react";
18
- import { Fragment as h, jsx as g, jsxs as _ } from "react/jsx-runtime";
10
+ import { BankAccountsWidget as r } from "../../../bank-accounts-widget/feature/dist/index8.js";
11
+ import "../../../bank-accounts-widget/feature/dist/index.js";
12
+ import { BillPayWidget as i } from "../../../bill-pay-widget/feature/dist/index28.js";
13
+ import "../../../bill-pay-widget/feature/dist/index.js";
14
+ import { CardsWidget as a } from "../../../cards-widget/feature/dist/index8.js";
15
+ import "../../../cards-widget/feature/dist/index.js";
16
+ import { BalancesWidget as o } from "../../../balances-widget/feature/dist/index5.js";
17
+ import "../../../balances-widget/feature/dist/index.js";
18
+ import { InsightsWidget as s } from "../../../insights-widget/feature/dist/index11.js";
19
+ import "../../../insights-widget/feature/dist/index.js";
20
+ import { InvoicingWidget as c } from "../../../invoicing-widget/feature/dist/index3.js";
21
+ import "../../../invoicing-widget/feature/dist/index.js";
22
+ import { SettingsWidget as l } from "../../../settings-widget/feature/dist/index6.js";
23
+ import "../../../settings-widget/feature/dist/index.js";
24
+ import { TransfersWidget as u } from "../../../transfers-widget/feature/dist/index6.js";
25
+ import "../../../transfers-widget/feature/dist/index.js";
26
+ import { jsx as d, jsxs as f } from "react/jsx-runtime";
19
27
  //#region ../../libs/tesouro-embedded-components-react/widget-suite/feature/dist/index5.js
20
- function v({ sections: n, labels: c, sectionLabels: v, sectionTitleLabels: y, contentLabels: b, showSectionTitle: x = !0 }) {
21
- let S = t();
22
- f(() => {
23
- S(l.Mounted);
24
- }, [S]);
25
- let C = {
26
- ...a,
27
- ...v
28
- }, { initResponse: w } = r(), T = w?.scopes, E = p(() => ({
29
- creditCards: {
30
- ...i.creditCards,
31
- ...b?.creditCards
32
- },
33
- debitCards: {
34
- ...i.debitCards,
35
- ...b?.debitCards
36
- },
37
- expensePlaceholders: {
38
- ...i.expensePlaceholders,
39
- ...b?.expensePlaceholders
40
- }
41
- }), [b]), D = w?.bankName?.trim(), O = D ? {
42
- ...o,
43
- ...y
44
- }.bankTagline.replaceAll("{bankName}", D) : void 0, k = n.flatMap((t) => {
45
- let n = s[t];
46
- if (!n || n.anyOfScopes && !e(T, n.anyOfScopes)) return [];
47
- let r = C[t], i = n.render({
48
- grantedScopes: T,
49
- labels: E
28
+ var p = ({ children: e }) => /* @__PURE__ */ d("div", {
29
+ className: "ttw:rounded-md ttw:border ttw:border-dashed ttw:border-border ttw:p-8 ttw:text-sm ttw:text-muted-foreground",
30
+ children: e
31
+ }), m = {
32
+ Dashboard: "dashboard",
33
+ Accounts: "accounts",
34
+ Cards: "cards",
35
+ Transfers: "transfers",
36
+ BillPay: "bill-pay",
37
+ Invoicing: "invoicing",
38
+ Expenses: "expenses",
39
+ Settings: "settings"
40
+ }, h = [
41
+ m.Dashboard,
42
+ m.Accounts,
43
+ m.Cards,
44
+ m.Transfers,
45
+ m.BillPay,
46
+ m.Invoicing,
47
+ m.Expenses,
48
+ m.Settings
49
+ ], g = {
50
+ [m.Dashboard]: { render: ({ grantedScopes: n }) => {
51
+ let r = e(n, [t.BankAccountReadOrg]);
52
+ return /* @__PURE__ */ f("div", {
53
+ className: r ? "ttw:grid ttw:gap-4 ttw:md:grid-cols-2" : "ttw:grid ttw:gap-4",
54
+ children: [r && /* @__PURE__ */ d(o, {}), /* @__PURE__ */ d(s, {})]
50
55
  });
51
- return [{
52
- id: t,
53
- label: r,
54
- content: x && !n.rendersOwnTitle ? /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ g(d, {
55
- title: r,
56
- bankTagline: O
57
- }), i] }) : i
58
- }];
59
- }), [A, j] = m(n[0] ?? ""), M = k.some((e) => e.id === A) ? A : k[0]?.id ?? "";
60
- return /* @__PURE__ */ g(u, {
61
- sections: k,
62
- selectedSectionId: M,
63
- onSectionChange: j,
64
- labels: c
65
- });
66
- }
67
- function y({ baseUrl: e, widgetToken: t, organizationId: r, configClient: i, linkComponent: a, implementation: o, uiFramework: s, errorFallback: l, onError: u, analytics: d, ...f }) {
68
- return /* @__PURE__ */ g(n, {
69
- widgetName: c,
70
- baseUrl: e,
71
- widgetToken: t,
72
- organizationId: r,
73
- configClient: i,
74
- linkComponent: a,
75
- implementation: o,
76
- uiFramework: s,
77
- errorFallback: l,
78
- onError: u,
79
- analytics: d,
80
- children: /* @__PURE__ */ g(v, { ...f })
81
- });
82
- }
56
+ } },
57
+ [m.Accounts]: {
58
+ anyOfScopes: [t.BankAccountReadOrg, t.ExternalBankAccountReadOrg],
59
+ rendersOwnTitle: !0,
60
+ render: () => /* @__PURE__ */ d(r, {})
61
+ },
62
+ [m.Cards]: {
63
+ anyOfScopes: [t.CreditCardReadOrg, t.DebitCardReadOrg],
64
+ render: ({ grantedScopes: r, labels: i }) => /* @__PURE__ */ f("div", {
65
+ className: "ttw:grid ttw:gap-8",
66
+ children: [e(r, [t.CreditCardReadOrg]) && /* @__PURE__ */ d(a, {
67
+ cardProgram: n.Credit,
68
+ labels: i.creditCards
69
+ }), e(r, [t.DebitCardReadOrg]) && /* @__PURE__ */ d(a, {
70
+ cardProgram: n.Debit,
71
+ labels: i.debitCards
72
+ })]
73
+ })
74
+ },
75
+ [m.Transfers]: {
76
+ anyOfScopes: [t.BankAccountReadOrg],
77
+ render: () => /* @__PURE__ */ d(u, {})
78
+ },
79
+ [m.BillPay]: {
80
+ anyOfScopes: [t.PayableReadOrg],
81
+ render: () => /* @__PURE__ */ d(i, {})
82
+ },
83
+ [m.Invoicing]: {
84
+ anyOfScopes: [t.InvoiceReadOrg],
85
+ render: () => /* @__PURE__ */ d(c, {})
86
+ },
87
+ [m.Expenses]: {
88
+ anyOfScopes: [t.ExpenseReadOrg, t.ExpenseReadSelf],
89
+ render: ({ labels: e }) => /* @__PURE__ */ d(p, { children: e.expensePlaceholders.expensesUnavailable })
90
+ },
91
+ [m.Settings]: {
92
+ rendersOwnTitle: !0,
93
+ render: () => /* @__PURE__ */ d(l, {})
94
+ }
95
+ };
83
96
  //#endregion
84
- export { y as WidgetSuite, y as default };
97
+ export { h as WIDGET_SUITE_DEFAULT_SECTIONS, g as WIDGET_SUITE_SECTIONS, m as WidgetSuiteSectionId };