@tesouro/embedded-components-react 0.2.264 → 0.2.267

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 (60) 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.css +45 -9
  7. package/dist/index.d.ts +29 -9
  8. package/dist/index.js +2 -2
  9. package/dist/lib/AcceptDisclosuresWidget.d.ts +17 -5
  10. package/dist/lib/AcceptDisclosuresWidget.js +1 -1
  11. package/dist/lib/BillPayWidget.js +1 -1
  12. package/dist/lib/WidgetProvider.d.ts +12 -4
  13. package/dist/libs/tesouro-embedded-components-react/accept-disclosures-widget/data-access/dist/index2.js +3 -3
  14. package/dist/libs/tesouro-embedded-components-react/accept-disclosures-widget/feature/dist/index3.js +1 -1
  15. package/dist/libs/tesouro-embedded-components-react/accept-disclosures-widget/feature/dist/index4.js +36 -34
  16. package/dist/libs/tesouro-embedded-components-react/accept-disclosures-widget/ui/dist/index.js +2 -2
  17. package/dist/libs/tesouro-embedded-components-react/accept-disclosures-widget/ui/dist/{index3.js → lib/AcceptDisclosuresWidget/AcceptDisclosuresWidget.js} +3 -3
  18. package/dist/libs/tesouro-embedded-components-react/accept-disclosures-widget/ui/dist/{index2.js → lib/AcceptDisclosuresWidget/labels.js} +1 -1
  19. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index.js +6 -6
  20. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index10.js +99 -7
  21. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index11.js +7 -97
  22. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index12.js +99 -4
  23. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index13.js +4 -4
  24. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index14.js +2 -41
  25. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index15.js +43 -1
  26. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index16.js +1 -50
  27. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index17.js +48 -6
  28. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index18.js +9 -5
  29. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index19.js +8 -91
  30. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index2.js +6 -2
  31. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index20.js +7 -3
  32. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index21.js +100 -6
  33. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index22.js +3 -9
  34. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index23.js +6 -83
  35. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index24.js +9 -3
  36. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index25.js +83 -6
  37. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index26.js +2 -111
  38. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index27.js +8 -1
  39. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index28.js +103 -16
  40. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index29.js +1 -0
  41. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index30.js +25 -0
  42. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index6.js +37 -27
  43. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index7.js +15 -116
  44. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index8.js +126 -31
  45. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index9.js +32 -69
  46. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index12.js +0 -3
  47. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index13.js +34 -69
  48. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index15.js +4 -0
  49. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index16.js +261 -181
  50. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index28.js +32 -33
  51. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index7.js +2 -2
  52. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  53. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index.js +5 -5
  54. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index3.js +4 -15
  55. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index4.js +26 -91
  56. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index5.js +87 -74
  57. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index6.js +142 -0
  58. package/dist/libs/tesouro-embedded-components-react/widget-suite/ui/dist/index2.js +1 -0
  59. package/dist/libs/tesouro-embedded-components-react/widget-suite/ui/dist/index3.js +49 -33
  60. package/package.json +1 -1
@@ -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/index30.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 };
@@ -0,0 +1,142 @@
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 "../../../shared/data-access/dist/index.js";
7
+ import { ErrorState as t } from "../../../shared/ui/dist/lib/ErrorState/ErrorState.js";
8
+ import "../../../shared/ui/dist/index.js";
9
+ import { useAnalyticsTrack as n } from "../../../shared/feature/dist/lib/analytics/hooks.js";
10
+ import { WidgetProvider as r } from "../../../shared/feature/dist/lib/WidgetProvider/WidgetProvider.js";
11
+ import { useRefetchWidget as i, useWidgetConfig as a, useWidgetError as o, useWidgetInitStaleForToken as s } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
12
+ import "../../../shared/feature/dist/index.js";
13
+ import { AcceptDisclosuresWidget as c } from "../../../accept-disclosures-widget/feature/dist/index4.js";
14
+ import "../../../accept-disclosures-widget/feature/dist/index.js";
15
+ import { WIDGET_SUITE_CONTENT_LABELS_EN as l, WIDGET_SUITE_DISCLOSURE_LABELS_EN as u, WIDGET_SUITE_SECTION_LABELS_EN as d, WIDGET_SUITE_SECTION_TITLE_LABELS_EN as f } from "./index4.js";
16
+ import { WIDGET_SUITE_SECTIONS as p } from "./index5.js";
17
+ import { WIDGET_NAME as m, WidgetSuiteAnalyticsEvent as h } from "./index2.js";
18
+ import { needsDisclosureAcceptance as g } from "./index3.js";
19
+ import { WidgetSuiteShell as _ } from "../../ui/dist/index3.js";
20
+ import { SectionPageTitle as v } from "../../ui/dist/index4.js";
21
+ import "../../ui/dist/index.js";
22
+ import { useCallback as y, useEffect as b, useMemo as x, useState as S } from "react";
23
+ import { Fragment as C, jsx as w, jsxs as T } from "react/jsx-runtime";
24
+ //#region ../../libs/tesouro-embedded-components-react/widget-suite/feature/dist/index6.js
25
+ var E = {
26
+ initFailed: "widget-suite-init-failed",
27
+ disclosuresRefreshFailed: "widget-suite-disclosures-refresh-failed",
28
+ disclosuresUnavailable: "widget-suite-disclosures-unavailable"
29
+ };
30
+ function D({ sections: r, disclosureLinks: m, labels: D, sectionLabels: O, sectionTitleLabels: k, contentLabels: A, disclosureLabels: j, showSectionTitle: M = !0 }) {
31
+ let N = n();
32
+ b(() => {
33
+ N(h.Mounted);
34
+ }, [N]);
35
+ let P = {
36
+ ...d,
37
+ ...O
38
+ }, { initResponse: F } = a(), I = o(), L = s(), R = F?.scopes, z = x(() => ({
39
+ creditCards: {
40
+ ...l.creditCards,
41
+ ...A?.creditCards
42
+ },
43
+ debitCards: {
44
+ ...l.debitCards,
45
+ ...A?.debitCards
46
+ },
47
+ expensePlaceholders: {
48
+ ...l.expensePlaceholders,
49
+ ...A?.expensePlaceholders
50
+ }
51
+ }), [A]), [B, V] = S(r[0] ?? ""), H = i(), [U, W] = S(!1), G = y(() => W(!0), []), K = g(F), q = {
52
+ ...u,
53
+ ...j,
54
+ initFailedState: {
55
+ ...u.initFailedState,
56
+ ...j?.initFailedState
57
+ },
58
+ refreshFailedState: {
59
+ ...u.refreshFailedState,
60
+ ...j?.refreshFailedState
61
+ },
62
+ unavailableState: {
63
+ ...u.unavailableState,
64
+ ...j?.unavailableState
65
+ }
66
+ };
67
+ b(() => {
68
+ !K && U && W(!1);
69
+ }, [U, K]);
70
+ let J = !!(F && L);
71
+ if (!F && !I || J && !I) return /* @__PURE__ */ w(_, {
72
+ isLoading: !0,
73
+ sections: [],
74
+ selectedSectionId: "",
75
+ onSectionChange: V,
76
+ labels: D
77
+ });
78
+ if ((!F || J) && I) return /* @__PURE__ */ w(t, {
79
+ title: q.initFailedState.title,
80
+ description: q.initFailedState.body,
81
+ retryLabel: q.initFailedState.retryButton,
82
+ onRetry: H,
83
+ testId: E.initFailed
84
+ });
85
+ if (K) return U && I ? /* @__PURE__ */ w(t, {
86
+ title: q.refreshFailedState.title,
87
+ description: q.refreshFailedState.body,
88
+ retryLabel: q.refreshFailedState.retryButton,
89
+ onRetry: H,
90
+ testId: E.disclosuresRefreshFailed
91
+ }) : m ? /* @__PURE__ */ w(c, {
92
+ disclosureLinks: m,
93
+ onAccepted: G
94
+ }) : /* @__PURE__ */ w(t, {
95
+ title: q.unavailableState.title,
96
+ description: q.unavailableState.body,
97
+ testId: E.disclosuresUnavailable
98
+ });
99
+ let Y = F?.bankName?.trim(), X = Y ? {
100
+ ...f,
101
+ ...k
102
+ }.bankTagline.replaceAll("{bankName}", Y) : void 0, Z = r.flatMap((t) => {
103
+ let n = p[t];
104
+ if (!n || n.anyOfScopes && !e(R, n.anyOfScopes)) return [];
105
+ let r = P[t], i = n.render({
106
+ grantedScopes: R,
107
+ labels: z
108
+ });
109
+ return [{
110
+ id: t,
111
+ label: r,
112
+ content: M && !n.rendersOwnTitle ? /* @__PURE__ */ T(C, { children: [/* @__PURE__ */ w(v, {
113
+ title: r,
114
+ bankTagline: X
115
+ }), i] }) : i
116
+ }];
117
+ }), Q = Z.some((e) => e.id === B) ? B : Z[0]?.id ?? "";
118
+ return /* @__PURE__ */ w(_, {
119
+ sections: Z,
120
+ selectedSectionId: Q,
121
+ onSectionChange: V,
122
+ labels: D
123
+ });
124
+ }
125
+ function O({ baseUrl: e, widgetToken: t, organizationId: n, configClient: i, linkComponent: a, implementation: o, uiFramework: s, errorFallback: c, onError: l, analytics: u, ...d }) {
126
+ return /* @__PURE__ */ w(r, {
127
+ widgetName: m,
128
+ baseUrl: e,
129
+ widgetToken: t,
130
+ organizationId: n,
131
+ configClient: i,
132
+ linkComponent: a,
133
+ implementation: o,
134
+ uiFramework: s,
135
+ errorFallback: c,
136
+ onError: l,
137
+ analytics: u,
138
+ children: /* @__PURE__ */ w(D, { ...d })
139
+ });
140
+ }
141
+ //#endregion
142
+ export { E as WIDGET_SUITE_TEST_IDS, O as WidgetSuite, O as default };
@@ -1,6 +1,7 @@
1
1
  //#region ../../libs/tesouro-embedded-components-react/widget-suite/ui/dist/index2.js
2
2
  var e = {
3
3
  navAriaLabel: "Sections",
4
+ loadingAriaLabel: "Loading sections",
4
5
  emptyState: {
5
6
  title: "Nothing available here",
6
7
  body: "This account doesn't have access to any of this page's sections."
@@ -2,21 +2,26 @@
2
2
  "use client";
3
3
  "use client";
4
4
  "use client";
5
- import { Typography as e, cn as t } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
6
- import { WIDGET_SUITE_SHELL_LABELS_EN as n } from "./index2.js";
7
- import { useRef as r } from "react";
8
- import { jsx as i, jsxs as a } from "react/jsx-runtime";
5
+ import { Skeleton as e, Typography as t, cn as n } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
6
+ import { WIDGET_SUITE_SHELL_LABELS_EN as r } from "./index2.js";
7
+ import { useRef as i } from "react";
8
+ import { jsx as a, jsxs as o } from "react/jsx-runtime";
9
9
  //#region ../../libs/tesouro-embedded-components-react/widget-suite/ui/dist/index3.js
10
- function o({ sections: o, selectedSectionId: s, onSectionChange: c, labels: l }) {
11
- let u = {
12
- ...n,
13
- ...l,
10
+ var s = [
11
+ "first",
12
+ "second",
13
+ "third"
14
+ ];
15
+ function c({ sections: c, selectedSectionId: l, onSectionChange: u, isLoading: d = !1, labels: f }) {
16
+ let p = {
17
+ ...r,
18
+ ...f,
14
19
  emptyState: {
15
- ...n.emptyState,
16
- ...l?.emptyState
20
+ ...r.emptyState,
21
+ ...f?.emptyState
17
22
  }
18
- }, d = r([]), f = o.find((e) => e.id === s), p = (e, t) => {
19
- let n = o.length - 1, r;
23
+ }, m = i([]), h = c.find((e) => e.id === l), g = (e, t) => {
24
+ let n = c.length - 1, r;
20
25
  switch (e.key) {
21
26
  case "ArrowRight":
22
27
  r = t === n ? 0 : t + 1;
@@ -32,46 +37,57 @@ function o({ sections: o, selectedSectionId: s, onSectionChange: c, labels: l })
32
37
  break;
33
38
  default: return;
34
39
  }
35
- e.preventDefault(), d.current[r]?.focus();
40
+ e.preventDefault(), m.current[r]?.focus();
36
41
  };
37
- return o.length === 0 ? /* @__PURE__ */ a("section", {
42
+ return d ? /* @__PURE__ */ o("section", {
43
+ "aria-busy": "true",
44
+ "aria-label": p.loadingAriaLabel,
45
+ className: "ttw:flex ttw:w-full ttw:flex-col ttw:gap-6",
46
+ children: [/* @__PURE__ */ a("div", {
47
+ className: "ttw:flex ttw:flex-wrap ttw:items-center ttw:gap-1 ttw:border-b ttw:border-border",
48
+ children: s.map((t) => /* @__PURE__ */ a("div", {
49
+ className: "ttw:px-4 ttw:py-2.5",
50
+ children: /* @__PURE__ */ a(e, { className: "ttw:h-5 ttw:w-20" })
51
+ }, t))
52
+ }), /* @__PURE__ */ a("div", { className: "ttw:min-h-[432px] ttw:min-w-0" })]
53
+ }) : c.length === 0 ? /* @__PURE__ */ o("section", {
38
54
  className: "ttw:flex ttw:w-full ttw:flex-col ttw:items-center ttw:justify-center ttw:gap-2 ttw:rounded-lg ttw:border ttw:border-border ttw:p-10 ttw:text-center",
39
- children: [/* @__PURE__ */ i(e, {
55
+ children: [/* @__PURE__ */ a(t, {
40
56
  variant: "h5",
41
- children: u.emptyState.title
42
- }), /* @__PURE__ */ i(e, {
57
+ children: p.emptyState.title
58
+ }), /* @__PURE__ */ a(t, {
43
59
  variant: "body2",
44
60
  color: "muted",
45
- children: u.emptyState.body
61
+ children: p.emptyState.body
46
62
  })]
47
- }) : /* @__PURE__ */ a("section", {
63
+ }) : /* @__PURE__ */ o("section", {
48
64
  className: "ttw:flex ttw:w-full ttw:flex-col ttw:gap-6",
49
- children: [/* @__PURE__ */ i("nav", {
50
- "aria-label": u.navAriaLabel,
51
- children: /* @__PURE__ */ i("ul", {
65
+ children: [/* @__PURE__ */ a("nav", {
66
+ "aria-label": p.navAriaLabel,
67
+ children: /* @__PURE__ */ a("ul", {
52
68
  className: "ttw:flex ttw:flex-wrap ttw:items-center ttw:gap-1 ttw:border-b ttw:border-border",
53
- children: o.map((e, n) => {
54
- let r = e.id === s;
55
- return /* @__PURE__ */ i("li", { children: /* @__PURE__ */ i("button", {
69
+ children: c.map((e, t) => {
70
+ let r = e.id === l;
71
+ return /* @__PURE__ */ a("li", { children: /* @__PURE__ */ a("button", {
56
72
  type: "button",
57
73
  ref: (e) => {
58
- d.current[n] = e;
74
+ m.current[t] = e;
59
75
  },
60
76
  "aria-current": r ? "page" : void 0,
61
- onClick: () => c(e.id),
62
- onKeyDown: (e) => p(e, n),
63
- className: t("ttw:-mb-px ttw:cursor-pointer ttw:border-b-2 ttw:px-4 ttw:py-2.5 ttw:text-sm ttw:font-medium ttw:whitespace-nowrap ttw:focus-visible:outline-2 ttw:focus-visible:outline-offset-2 ttw:focus-visible:outline-ring", r ? "ttw:border-primary ttw:text-primary" : "ttw:border-transparent ttw:text-muted-foreground ttw:hover:border-border ttw:hover:text-foreground"),
77
+ onClick: () => u(e.id),
78
+ onKeyDown: (e) => g(e, t),
79
+ className: n("ttw:-mb-px ttw:cursor-pointer ttw:border-b-2 ttw:px-4 ttw:py-2.5 ttw:text-sm ttw:font-medium ttw:whitespace-nowrap ttw:focus-visible:outline-2 ttw:focus-visible:outline-offset-2 ttw:focus-visible:outline-ring", r ? "ttw:border-primary ttw:text-primary" : "ttw:border-transparent ttw:text-muted-foreground ttw:hover:border-border ttw:hover:text-foreground"),
64
80
  children: e.label
65
81
  }) }, e.id);
66
82
  })
67
83
  })
68
- }), /* @__PURE__ */ i("div", {
84
+ }), /* @__PURE__ */ a("div", {
69
85
  role: "region",
70
- "aria-label": f?.label,
86
+ "aria-label": h?.label,
71
87
  className: "ttw:min-h-[432px] ttw:min-w-0",
72
- children: f?.content
88
+ children: h?.content
73
89
  })]
74
90
  });
75
91
  }
76
92
  //#endregion
77
- export { o as WidgetSuiteShell };
93
+ export { c as WidgetSuiteShell };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tesouro/embedded-components-react",
3
- "version": "0.2.264",
3
+ "version": "0.2.267",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "packageDepSync": {