@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
@@ -13,4 +13,6 @@ import { AboutYouPanel as u } from "./index23.js";
13
13
  import { BusinessDisclosuresSection as d } from "./index24.js";
14
14
  import "./index25.js";
15
15
  import { UnsavedApplicationDialog as f } from "./index26.js";
16
- export { l as ABOUT_YOU_PANEL_LABELS_EN, e as ADDITIONAL_OWNERS_LABELS_EN, u as AboutYouPanel, t as AdditionalOwnersForm, n as BUSINESS_DETAILS_LABELS_EN, s as BUSINESS_DETAILS_PANEL_LABELS_EN, c as BusinessDetailsPanel, d as BusinessDisclosuresSection, i as PERSONAL_DETAILS_LABELS_EN, o as RESULT_LABELS_EN, a as ResultStep, f as UnsavedApplicationDialog, r as interpolateBankName };
16
+ import "./index27.js";
17
+ import { DeleteApplicationDialog as p } from "./index28.js";
18
+ export { l as ABOUT_YOU_PANEL_LABELS_EN, e as ADDITIONAL_OWNERS_LABELS_EN, u as AboutYouPanel, t as AdditionalOwnersForm, n as BUSINESS_DETAILS_LABELS_EN, s as BUSINESS_DETAILS_PANEL_LABELS_EN, c as BusinessDetailsPanel, d as BusinessDisclosuresSection, p as DeleteApplicationDialog, i as PERSONAL_DETAILS_LABELS_EN, o as RESULT_LABELS_EN, a as ResultStep, f as UnsavedApplicationDialog, r as interpolateBankName };
@@ -0,0 +1,11 @@
1
+ //#region ../../libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index27.js
2
+ var e = {
3
+ title: "Delete this application?",
4
+ descriptionBeforeEmphasis: "Everything you've entered so far will be permanently removed. If you'd rather come back later, use ",
5
+ descriptionEmphasis: "Save and close",
6
+ descriptionAfterEmphasis: " instead.",
7
+ keepEditingButton: "Keep editing",
8
+ deleteButton: "Delete application"
9
+ };
10
+ //#endregion
11
+ export { e as DELETE_APPLICATION_DIALOG_LABELS_EN };
@@ -0,0 +1,64 @@
1
+ import { AlertDialog as e, AlertDialogContent as t, AlertDialogDescription as n, AlertDialogFooter as r, AlertDialogHeader as i, AlertDialogTitle as a, Button as o } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
2
+ import { DELETE_APPLICATION_DIALOG_LABELS_EN as s } from "./index27.js";
3
+ import { useRef as c } from "react";
4
+ import { jsx as l, jsxs as u } from "react/jsx-runtime";
5
+ import { Trash2Icon as d } from "lucide-react";
6
+ //#region ../../libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index28.js
7
+ function f({ open: f, onConfirm: p, onCancel: m, isDeleting: h = !1, labels: g, testIds: _ }) {
8
+ let v = {
9
+ ...s,
10
+ ...g
11
+ }, y = c(null);
12
+ return /* @__PURE__ */ l(e, {
13
+ open: f,
14
+ onOpenChange: (e) => {
15
+ !e && !h && m();
16
+ },
17
+ children: /* @__PURE__ */ u(t, {
18
+ "data-testid": _?.root,
19
+ onOpenAutoFocus: (e) => {
20
+ e.preventDefault(), y.current?.focus();
21
+ },
22
+ children: [/* @__PURE__ */ u(i, {
23
+ className: "ttw:items-center ttw:text-center ttw:sm:items-center ttw:sm:text-center",
24
+ children: [
25
+ /* @__PURE__ */ l("div", {
26
+ className: "ttw:flex ttw:size-14 ttw:items-center ttw:justify-center ttw:rounded-full ttw:bg-destructive/10",
27
+ "aria-hidden": !0,
28
+ children: /* @__PURE__ */ l(d, { className: "ttw:size-6 ttw:text-destructive" })
29
+ }),
30
+ /* @__PURE__ */ l(a, { children: v.title }),
31
+ /* @__PURE__ */ u(n, { children: [
32
+ v.descriptionBeforeEmphasis,
33
+ /* @__PURE__ */ l("strong", {
34
+ className: "ttw:font-semibold ttw:text-foreground",
35
+ children: v.descriptionEmphasis
36
+ }),
37
+ v.descriptionAfterEmphasis
38
+ ] })
39
+ ]
40
+ }), /* @__PURE__ */ u(r, {
41
+ className: "ttw:sm:justify-center",
42
+ children: [/* @__PURE__ */ l(o, {
43
+ ref: y,
44
+ type: "button",
45
+ variant: "outline",
46
+ onClick: m,
47
+ disabled: h,
48
+ "data-testid": _?.cancel,
49
+ children: v.keepEditingButton
50
+ }), /* @__PURE__ */ l(o, {
51
+ type: "button",
52
+ variant: "destructive",
53
+ loading: h,
54
+ disabled: h,
55
+ onClick: p,
56
+ "data-testid": _?.confirm,
57
+ children: v.deleteButton
58
+ })]
59
+ })]
60
+ })
61
+ });
62
+ }
63
+ //#endregion
64
+ export { s as DELETE_APPLICATION_DIALOG_LABELS_EN, f as DeleteApplicationDialog };
@@ -1,5 +1,5 @@
1
- import "./index4.js";
2
- import "./index6.js";
3
- import { CreditCardsWidget as e } from "./index10.js";
4
- import { DebitCardsWidget as t } from "./index11.js";
1
+ import "./index5.js";
2
+ import "./index7.js";
3
+ import { CreditCardsWidget as e } from "./index11.js";
4
+ import { DebitCardsWidget as t } from "./index12.js";
5
5
  export { e as CreditCardsWidget, t as DebitCardsWidget };
@@ -2,16 +2,95 @@
2
2
  "use client";
3
3
  "use client";
4
4
  "use client";
5
- import { CardProgram as e } from "../../../shared/feature/dist/lib/card/cardProgram.js";
5
+ import { WidgetProvider as e } from "../../../shared/feature/dist/lib/WidgetProvider/WidgetProvider.js";
6
6
  import "../../../shared/feature/dist/index.js";
7
- import { CardsWidget as t } from "./index9.js";
8
- import { jsx as n } from "react/jsx-runtime";
7
+ import { WIDGET_NAME as t } from "./index2.js";
8
+ import { cardsListDetailsSheetTestIds as n, cardsListTestIds as r } from "./index4.js";
9
+ import { resolveCardsListLabels as i } from "../../ui/dist/lib/CardsList/labels.js";
10
+ import { CardsList as a } from "../../ui/dist/lib/CardsList/CardsList.js";
11
+ import { CardsListDetailsSheet as o } from "../../ui/dist/lib/CardsList/CardsListDetailsSheet.js";
12
+ import "../../ui/dist/index.js";
13
+ import { useCardsWidget as s } from "./index9.js";
14
+ import { CardDetailsWidget as c } from "../../../card-details-widget/feature/dist/index13.js";
15
+ import "../../../card-details-widget/feature/dist/index.js";
16
+ import { CreateCardWidget as l } from "../../create-card/feature/dist/index8.js";
17
+ import "../../create-card/feature/dist/index.js";
18
+ import { useCallback as u, useMemo as d, useState as f } from "react";
19
+ import { Fragment as p, jsx as m, jsxs as h } from "react/jsx-runtime";
9
20
  //#region ../../libs/tesouro-embedded-components-react/cards-widget/feature/dist/index10.js
10
- function r(r) {
11
- return /* @__PURE__ */ n(t, {
12
- ...r,
13
- cardProgram: e.Credit
21
+ function g({ cardProgram: e, pagination: t, defaultPagination: g, onPaginationChange: _, labels: v, featureLabels: y, selectedCardId: b, defaultSelectedCardId: x, onSelectedCardIdChange: S, cardDetailsLabels: C, cardDetailsFeatureLabels: w, cardDetailsActivateLabels: T, bankLogoSrc: E, bankLogoAlt: D, cardArtSrc: O, createCardLabels: k, createCardFeatureLabels: A, onCreateCard: j, onActivateCard: M, headerStart: ee }) {
22
+ let { selectedCardId: N, onSelectCard: P, onCreateCardClick: F, canCreateCard: I, canReadCards: L, ...R } = s({
23
+ cardProgram: e,
24
+ pagination: t,
25
+ defaultPagination: g,
26
+ onPaginationChange: _,
27
+ featureLabels: y,
28
+ selectedCardId: b,
29
+ defaultSelectedCardId: x,
30
+ onSelectedCardIdChange: S,
31
+ onCreateCard: j,
32
+ onActivateCard: M
33
+ }), z = d(() => i(v), [v]), [B, V] = f(!1), [H, U] = f(0), [W, G] = f(N), [K, q] = f(null), J = u(() => {
34
+ N !== null && P(null), U((e) => e + 1), V(!0);
35
+ }, [N, P]), Y = u(() => {
36
+ V(!1), N !== null && P(null);
37
+ }, [N, P]), X = u((e) => {
38
+ V(!1), P(e);
39
+ }, [P]), Z = e === "debit" && !!I && F === void 0, Q = B && N === null && Z;
40
+ B && (N !== null || !Z) && V(!1), Q ? K !== "create" && q("create") : N !== null && (K !== "details" && q("details"), N !== W && G(N));
41
+ let $ = K === "create", te = N !== null || Q;
42
+ return /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ m(a, {
43
+ ...R,
44
+ canCreateCard: I,
45
+ onCreateCardClick: F ?? J,
46
+ headerStart: ee,
47
+ labels: z,
48
+ testIds: r
49
+ }), /* @__PURE__ */ m(o, {
50
+ isOpen: te,
51
+ labels: $ ? z.createSheet : z.detailsSheet,
52
+ contentClassName: $ ? "ttw:overflow-hidden ttw:p-0 ttw:min-h-0" : void 0,
53
+ onClose: Y,
54
+ testIds: n,
55
+ children: $ && Z ? /* @__PURE__ */ m(l, {
56
+ cardArtSrc: O ?? "data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='300' height='190' viewBox='0 0 300 190'><rect width='300' height='190' rx='16' fill='%23334155'/><rect x='28' y='64' width='44' height='34' rx='6' fill='%2364748b'/></svg>",
57
+ labels: k,
58
+ featureLabels: A,
59
+ onClose: Y,
60
+ onCancel: Y,
61
+ onViewCard: L ? X : void 0,
62
+ className: "ttw:min-h-0 ttw:flex-1"
63
+ }, H) : W === null ? null : /* @__PURE__ */ m(c, {
64
+ cardId: W,
65
+ cardProgram: e,
66
+ labels: C,
67
+ activateLabels: T,
68
+ featureLabels: w,
69
+ cardArtSrc: O,
70
+ bankLogoSrc: E,
71
+ bankLogoAlt: D,
72
+ onClose: Y
73
+ }, W)
74
+ })] });
75
+ }
76
+ function _({ baseUrl: n, widgetToken: r, organizationId: i, configClient: a, gatewayRouting: o, linkComponent: s, implementation: c, uiFramework: l, errorFallback: u, onError: d, analytics: f, disclosuresAcceptance: p, providerLabels: h, ..._ }) {
77
+ return /* @__PURE__ */ m(e, {
78
+ widgetName: t,
79
+ baseUrl: n,
80
+ widgetToken: r,
81
+ organizationId: i,
82
+ configClient: a,
83
+ gatewayRouting: o,
84
+ linkComponent: s,
85
+ implementation: c,
86
+ uiFramework: l,
87
+ errorFallback: u,
88
+ onError: d,
89
+ analytics: f,
90
+ disclosuresAcceptance: p,
91
+ providerLabels: h,
92
+ children: /* @__PURE__ */ m(g, { ..._ })
14
93
  });
15
94
  }
16
95
  //#endregion
17
- export { r as CreditCardsWidget };
96
+ export { _ as CardsWidget, _ as default };
@@ -4,14 +4,14 @@
4
4
  "use client";
5
5
  import { CardProgram as e } from "../../../shared/feature/dist/lib/card/cardProgram.js";
6
6
  import "../../../shared/feature/dist/index.js";
7
- import { CardsWidget as t } from "./index9.js";
7
+ import { CardsWidget as t } from "./index10.js";
8
8
  import { jsx as n } from "react/jsx-runtime";
9
9
  //#region ../../libs/tesouro-embedded-components-react/cards-widget/feature/dist/index11.js
10
10
  function r(r) {
11
11
  return /* @__PURE__ */ n(t, {
12
12
  ...r,
13
- cardProgram: e.Debit
13
+ cardProgram: e.Credit
14
14
  });
15
15
  }
16
16
  //#endregion
17
- export { r as DebitCardsWidget };
17
+ export { r as CreditCardsWidget };
@@ -0,0 +1,17 @@
1
+ "use client";
2
+ "use client";
3
+ "use client";
4
+ "use client";
5
+ import { CardProgram as e } from "../../../shared/feature/dist/lib/card/cardProgram.js";
6
+ import "../../../shared/feature/dist/index.js";
7
+ import { CardsWidget as t } from "./index10.js";
8
+ import { jsx as n } from "react/jsx-runtime";
9
+ //#region ../../libs/tesouro-embedded-components-react/cards-widget/feature/dist/index12.js
10
+ function r(r) {
11
+ return /* @__PURE__ */ n(t, {
12
+ ...r,
13
+ cardProgram: e.Debit
14
+ });
15
+ }
16
+ //#endregion
17
+ export { r as DebitCardsWidget };
@@ -1,26 +1,19 @@
1
- import { CARD_STATUS_LABELS_EN as e, CARD_TYPE_LABELS_EN as t } from "../../../shared/feature/dist/lib/card/cardPresentation.js";
2
- import "../../../shared/feature/dist/index.js";
3
1
  //#region ../../libs/tesouro-embedded-components-react/cards-widget/feature/dist/index4.js
4
- var n = {
5
- emptyValue: "—",
6
- untitledCard: "Untitled card",
7
- untitledFundingAccount: "Account",
8
- cardStatus: e,
9
- cardType: t
10
- };
11
- function r(e) {
12
- return {
13
- ...n,
14
- ...e,
15
- cardStatus: {
16
- ...n.cardStatus,
17
- ...e?.cardStatus
18
- },
19
- cardType: {
20
- ...n.cardType,
21
- ...e?.cardType
22
- }
23
- };
24
- }
2
+ var e = {
3
+ list: "cards-list",
4
+ cardFaceSwatch: "card-face-swatch",
5
+ rowPrefix: "cards-list-row",
6
+ empty: "cards-list-empty",
7
+ error: "cards-list-error",
8
+ detailsSheet: "cards-list-details-sheet"
9
+ }, t = {
10
+ root: e.list,
11
+ empty: e.empty,
12
+ error: e.error,
13
+ row: {
14
+ rootPrefix: e.rowPrefix,
15
+ cardFaceSwatch: { root: e.cardFaceSwatch }
16
+ }
17
+ }, n = { root: e.detailsSheet };
25
18
  //#endregion
26
- export { n as DEFAULT_CARDS_FEATURE_LABELS, r as resolveCardsFeatureLabels };
19
+ export { n as cardsListDetailsSheetTestIds, t as cardsListTestIds, e as cardsWidgetTestIds };
@@ -1,27 +1,26 @@
1
- import { minorExponentForCurrency as e } from "../../../shared/util/dist/lib/amountOutputToMajorUnits.js";
2
- import { normalizeAmountOutputCurrencyCode as t } from "../../../shared/util/dist/lib/normalizeAmountOutputCurrencyCode.js";
1
+ import { CARD_STATUS_LABELS_EN as e, CARD_TYPE_LABELS_EN as t } from "../../../shared/feature/dist/lib/card/cardPresentation.js";
2
+ import "../../../shared/feature/dist/index.js";
3
3
  //#region ../../libs/tesouro-embedded-components-react/cards-widget/feature/dist/index5.js
4
- function n(e) {
5
- if (e == null || e === "") return;
6
- let t = Number(e);
7
- return Number.isFinite(t) ? t : void 0;
8
- }
9
- function r({ limit: r, currencyCode: i }) {
10
- let a = n(r);
11
- if (a === void 0) return;
12
- let o = t(i);
13
- return new Intl.NumberFormat(void 0, {
14
- style: "currency",
15
- currency: o,
16
- maximumFractionDigits: 0
17
- }).format(a / 10 ** e(o));
18
- }
19
- function i(e) {
20
- let t = e?.trim().slice(-4);
21
- return t ? `••••${t}` : void 0;
22
- }
23
- function a(e, t) {
24
- return e?.trim() || t;
4
+ var n = {
5
+ emptyValue: "—",
6
+ untitledCard: "Untitled card",
7
+ untitledFundingAccount: "Account",
8
+ cardStatus: e,
9
+ cardType: t
10
+ };
11
+ function r(e) {
12
+ return {
13
+ ...n,
14
+ ...e,
15
+ cardStatus: {
16
+ ...n.cardStatus,
17
+ ...e?.cardStatus
18
+ },
19
+ cardType: {
20
+ ...n.cardType,
21
+ ...e?.cardType
22
+ }
23
+ };
25
24
  }
26
25
  //#endregion
27
- export { r as formatCardLimit, i as maskAccountNumber, a as withFallback };
26
+ export { n as DEFAULT_CARDS_FEATURE_LABELS, r as resolveCardsFeatureLabels };
@@ -1,33 +1,27 @@
1
- import { hasAnyScope as e } from "../../../shared/data-access/dist/lib/hasAnyScope.js";
2
- import { Scope as t } from "../../../shared/data-access/dist/lib/scopes.js";
3
- import "../../../shared/data-access/dist/index.js";
4
- import { CardProgram as n } from "../../../shared/feature/dist/lib/card/cardProgram.js";
5
- import "../../../shared/feature/dist/index.js";
1
+ import { minorExponentForCurrency as e } from "../../../shared/util/dist/lib/amountOutputToMajorUnits.js";
2
+ import { normalizeAmountOutputCurrencyCode as t } from "../../../shared/util/dist/lib/normalizeAmountOutputCurrencyCode.js";
6
3
  //#region ../../libs/tesouro-embedded-components-react/cards-widget/feature/dist/index6.js
7
- var r = {
8
- [n.Credit]: {
9
- read: [t.CreditCardReadOrg],
10
- activate: [t.CreditCardActivateOrg],
11
- create: [t.CreditCardIssueOrg]
12
- },
13
- [n.Debit]: {
14
- read: [t.DebitCardReadOrg],
15
- activate: [t.DebitCardActivateOrg],
16
- create: [t.DebitCardIssueOrg]
17
- }
18
- }, i = [t.BankAccountReadOrg], a = {
19
- users: [t.UserReadOrg],
20
- funding: i
21
- };
22
- function o({ cardProgram: t, scopes: o }) {
23
- let s = new Set(o ?? []), c = r[t];
24
- return {
25
- canRead: e(s, c.read),
26
- canActivate: e(s, c.activate),
27
- canCreate: e(s, c.create),
28
- canReadFundingAccounts: t === n.Debit && e(s, i),
29
- canComposeDebitCreate: t === n.Debit && e(s, a.users) && e(s, a.funding)
30
- };
4
+ function n(e) {
5
+ if (e == null || e === "") return;
6
+ let t = Number(e);
7
+ return Number.isFinite(t) ? t : void 0;
8
+ }
9
+ function r({ limit: r, currencyCode: i }) {
10
+ let a = n(r);
11
+ if (a === void 0) return;
12
+ let o = t(i);
13
+ return new Intl.NumberFormat(void 0, {
14
+ style: "currency",
15
+ currency: o,
16
+ maximumFractionDigits: 0
17
+ }).format(a / 10 ** e(o));
18
+ }
19
+ function i(e) {
20
+ let t = e?.trim().slice(-4);
21
+ return t ? `••••${t}` : void 0;
22
+ }
23
+ function a(e, t) {
24
+ return e?.trim() || t;
31
25
  }
32
26
  //#endregion
33
- export { o as getCardsPermissions };
27
+ export { r as formatCardLimit, i as maskAccountNumber, a as withFallback };
@@ -1,60 +1,33 @@
1
- import { CardProgram as e } from "../../../shared/feature/dist/lib/card/cardProgram.js";
2
- import { CARD_STATUS_TONE as t } from "../../../shared/feature/dist/lib/card/cardPresentation.js";
1
+ import { hasAnyScope as e } from "../../../shared/data-access/dist/lib/hasAnyScope.js";
2
+ import { Scope as t } from "../../../shared/data-access/dist/lib/scopes.js";
3
+ import "../../../shared/data-access/dist/index.js";
4
+ import { CardProgram as n } from "../../../shared/feature/dist/lib/card/cardProgram.js";
3
5
  import "../../../shared/feature/dist/index.js";
4
- import { formatCardLimit as n, withFallback as r } from "./index5.js";
5
- import { CARD_COLUMN_KEYS as i } from "../../ui/dist/lib/CardsList/types.js";
6
- import "../../ui/dist/index.js";
7
6
  //#region ../../libs/tesouro-embedded-components-react/cards-widget/feature/dist/index7.js
8
- var a = "PENDING_ACTIVATION", o = {
9
- [e.Credit]: i.filter((e) => e !== "fundingAccount" && e !== "limit"),
10
- [e.Debit]: i.filter((e) => e !== "limit")
7
+ var r = {
8
+ [n.Credit]: {
9
+ read: [t.CreditCardReadOrg],
10
+ activate: [t.CreditCardActivateOrg],
11
+ create: [t.CreditCardIssueOrg]
12
+ },
13
+ [n.Debit]: {
14
+ read: [t.DebitCardReadOrg],
15
+ activate: [t.DebitCardActivateOrg],
16
+ create: [t.DebitCardIssueOrg]
17
+ }
18
+ }, i = [t.BankAccountReadOrg], a = {
19
+ users: [t.UserReadOrg],
20
+ funding: i
11
21
  };
12
- function s(e) {
13
- return e.map((e) => ({
14
- id: e.id,
15
- userId: e.userId,
16
- status: e.cardStatus,
17
- type: e.cardType,
18
- cardholderName: e.cardholderName,
19
- nickname: e.nickname,
20
- lastFourDigits: e.lastFourDigits,
21
- limit: e.cardLimit,
22
- limitCurrencyCode: e.currentBalance?.currencyCode
23
- }));
24
- }
25
- function c(e) {
26
- return e.map((e) => ({
27
- id: e.id,
28
- userId: e.userId,
29
- status: e.cardStatus,
30
- type: e.cardType,
31
- cardholderName: e.cardholderName,
32
- nickname: e.nickname,
33
- lastFourDigits: e.lastFourDigits,
34
- fundingAccountId: e.bankAccountId
35
- }));
36
- }
37
- function l(e, { labels: i, fundingAccountNames: o, canActivate: s, onCardSelect: c, onActivateCard: l }) {
38
- return e.map((e) => {
39
- let u = s && e.status === a, d = e.fundingAccountId ? o?.get(e.fundingAccountId) : void 0;
40
- return {
41
- key: e.id,
42
- nickname: r(e.nickname, i.untitledCard),
43
- lastFour: e.lastFourDigits,
44
- typeLabel: i.cardType[e.type] ?? i.emptyValue,
45
- fundingAccount: d?.name ?? i.emptyValue,
46
- fundingAccountLastFour: d?.lastFour,
47
- cardholder: r(e.cardholderName, i.emptyValue),
48
- statusLabel: i.cardStatus[e.status] ?? i.emptyValue,
49
- statusTone: t[e.status] ?? "neutral",
50
- limit: n({
51
- limit: e.limit,
52
- currencyCode: e.limitCurrencyCode
53
- }),
54
- onSelect: c ? () => c(e.id) : void 0,
55
- onActivate: u && l ? () => l(e.id) : void 0
56
- };
57
- });
22
+ function o({ cardProgram: t, scopes: o }) {
23
+ let s = new Set(o ?? []), c = r[t];
24
+ return {
25
+ canRead: e(s, c.read),
26
+ canActivate: e(s, c.activate),
27
+ canCreate: e(s, c.create),
28
+ canReadFundingAccounts: t === n.Debit && e(s, i),
29
+ canComposeDebitCreate: t === n.Debit && e(s, a.users) && e(s, a.funding)
30
+ };
58
31
  }
59
32
  //#endregion
60
- export { o as CARD_COLUMNS_BY_PROGRAM, l as toCardRows, s as toCreditCardListItems, c as toDebitCardListItems };
33
+ export { o as getCardsPermissions };