@tesouro/embedded-components-react 0.2.263 → 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
@@ -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.263",
3
+ "version": "0.2.266",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "packageDepSync": {