@tesouro/embedded-components-react 0.3.16 → 0.3.18

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 (111) hide show
  1. package/dist/index.d.ts +22 -1
  2. package/dist/index.js +10 -10
  3. package/dist/lib/AcceptDisclosuresWidget.d.ts +11 -1
  4. package/dist/lib/AcceptDisclosuresWidget.js +1 -1
  5. package/dist/lib/BalancesWidget.js +1 -1
  6. package/dist/lib/BankAccountOnboardingWidget.d.ts +21 -21
  7. package/dist/lib/BankAccountOnboardingWidget.js +1 -1
  8. package/dist/lib/CardsWidget.js +1 -1
  9. package/dist/lib/ExpenseApprovalPoliciesWidget.js +1 -1
  10. package/dist/lib/ExpenseManagementWidget.js +1 -1
  11. package/dist/lib/InsightsWidget.js +1 -1
  12. package/dist/lib/ReceiptMatchWidget.js +1 -1
  13. package/dist/lib/TransfersWidget.js +1 -1
  14. package/dist/lib/UploadReceiptWidget.js +1 -1
  15. package/dist/libs/tesouro-embedded-components-react/accept-disclosures-widget/feature/dist/index.js +1 -1
  16. package/dist/libs/tesouro-embedded-components-react/accept-disclosures-widget/feature/dist/index4.js +10 -140
  17. package/dist/libs/tesouro-embedded-components-react/accept-disclosures-widget/feature/dist/index5.js +152 -0
  18. package/dist/libs/tesouro-embedded-components-react/accept-disclosures-widget/ui/dist/lib/AcceptDisclosuresWidget/AcceptDisclosuresWidget.js +19 -19
  19. package/dist/libs/tesouro-embedded-components-react/balances-widget/feature/dist/index.js +1 -1
  20. package/dist/libs/tesouro-embedded-components-react/balances-widget/feature/dist/index4.js +10 -11
  21. package/dist/libs/tesouro-embedded-components-react/balances-widget/feature/dist/index5.js +15 -64
  22. package/dist/libs/tesouro-embedded-components-react/balances-widget/feature/dist/index6.js +75 -0
  23. package/dist/libs/tesouro-embedded-components-react/balances-widget/ui/dist/lib/BalancesWidget/BalancesWidget.js +16 -16
  24. package/dist/libs/tesouro-embedded-components-react/balances-widget/ui/dist/lib/BalancesWidget/SingleBalance/SingleBalance.js +7 -7
  25. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index.js +1 -1
  26. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index10.js +109 -169
  27. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index11.js +170 -63
  28. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index12.js +73 -81
  29. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index13.js +77 -101
  30. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index14.js +110 -83
  31. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index15.js +91 -7
  32. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index16.js +7 -28
  33. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index17.js +26 -320
  34. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index18.js +341 -0
  35. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index9.js +29 -100
  36. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index.js +0 -1
  37. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index11.js +3 -3
  38. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index15.js +32 -32
  39. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index16.js +2 -2
  40. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index18.js +14 -10
  41. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index19.js +42 -42
  42. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index2.js +80 -77
  43. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index20.js +2 -2
  44. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index22.js +14 -10
  45. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index23.js +16 -16
  46. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index27.js +5 -5
  47. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index3.js +7 -6
  48. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index5.js +23 -18
  49. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index.js +0 -1
  50. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index63.js +28 -28
  51. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index64.js +0 -1
  52. package/dist/libs/tesouro-embedded-components-react/card-details-widget/ui/dist/index.js +0 -1
  53. package/dist/libs/tesouro-embedded-components-react/card-details-widget/ui/dist/lib/CardDetailsPanel/CardDetailsHeader.js +5 -5
  54. package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/index.js +3 -3
  55. package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/index3.js +4 -23
  56. package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/index4.js +23 -24
  57. package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/index5.js +24 -30
  58. package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/index6.js +28 -55
  59. package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/index7.js +54 -209
  60. package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/index8.js +206 -81
  61. package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/index9.js +95 -0
  62. package/dist/libs/tesouro-embedded-components-react/cards-widget/ui/dist/lib/CardsList/CardFaceSwatch.js +2 -2
  63. package/dist/libs/tesouro-embedded-components-react/cards-widget/ui/dist/lib/CardsList/CardsList.js +31 -30
  64. package/dist/libs/tesouro-embedded-components-react/cards-widget/ui/dist/lib/CardsList/CardsListRow.js +11 -10
  65. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index.js +5 -5
  66. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index10.js +1 -255
  67. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index11.js +253 -2
  68. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index12.js +2 -71
  69. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index13.js +73 -0
  70. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index5.js +7 -218
  71. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index6.js +219 -79
  72. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index7.js +89 -2
  73. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index8.js +2 -47
  74. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index9.js +49 -1
  75. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/ui/dist/lib/ExpenseApprovalPoliciesWidget/lib/ApprovalRuleCard.js +2 -2
  76. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/ui/dist/lib/ExpenseApprovalPoliciesWidget/lib/ApprovalRuleForm.js +32 -32
  77. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/ui/dist/lib/ExpenseApprovalPoliciesWidget/lib/ExpenseApprovalsPage.js +11 -8
  78. package/dist/libs/tesouro-embedded-components-react/insights-widget/feature/dist/index.js +1 -1
  79. package/dist/libs/tesouro-embedded-components-react/insights-widget/feature/dist/index10.js +12 -14
  80. package/dist/libs/tesouro-embedded-components-react/insights-widget/feature/dist/index11.js +21 -62
  81. package/dist/libs/tesouro-embedded-components-react/insights-widget/feature/dist/index12.js +73 -0
  82. package/dist/libs/tesouro-embedded-components-react/insights-widget/ui/dist/lib/InsightsWidget/InsightsWidget.js +6 -6
  83. package/dist/libs/tesouro-embedded-components-react/insights-widget/ui/dist/lib/InsightsWidget/SingleInsight/SingleInsight.js +10 -10
  84. package/dist/libs/tesouro-embedded-components-react/settings-widget/feature/dist/index5.js +1 -1
  85. package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/feature/dist/lib/ApprovalPoliciesSettings.js +67 -46
  86. package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/feature/dist/lib/testIds.js +26 -0
  87. package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/feature/dist/lib/useApprovalPolicyRules.js +151 -135
  88. package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index11.js +11 -11
  89. package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index14.js +17 -17
  90. package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index16.js +17 -15
  91. package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index18.js +9 -9
  92. package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index20.js +16 -13
  93. package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index3.js +13 -13
  94. package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index5.js +11 -11
  95. package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index7.js +5 -5
  96. package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index9.js +6 -6
  97. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  98. package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/lib/OnboardingShell/OnboardingShell.js +21 -20
  99. package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/lib/OnboardingShell/OnboardingShellOverlayPortal.js +10 -10
  100. package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/lib/OnboardingShell/OnboardingShellScrollRegion.js +17 -17
  101. package/dist/libs/tesouro-embedded-components-react/transfers-widget/feature/dist/index.js +1 -1
  102. package/dist/libs/tesouro-embedded-components-react/transfers-widget/feature/dist/index5.js +18 -99
  103. package/dist/libs/tesouro-embedded-components-react/transfers-widget/feature/dist/index6.js +116 -19
  104. package/dist/libs/tesouro-embedded-components-react/transfers-widget/feature/dist/index7.js +28 -0
  105. package/dist/libs/tesouro-embedded-components-react/transfers-widget/ui/dist/lib/TransferMoneyModal/ReviewTransferStep.js +9 -9
  106. package/dist/libs/tesouro-embedded-components-react/transfers-widget/ui/dist/lib/TransferMoneyModal/TransferMoneyModal.js +13 -11
  107. package/dist/libs/tesouro-embedded-components-react/transfers-widget/ui/dist/lib/TransferMoneyModal/TransferResultStep.js +7 -7
  108. package/dist/libs/tesouro-embedded-components-react/transfers-widget/ui/dist/lib/TransfersWidget/TransfersWidget.js +19 -19
  109. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index7.js +4 -4
  110. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index8.js +1 -1
  111. package/package.json +1 -1
@@ -2,89 +2,214 @@
2
2
  "use client";
3
3
  "use client";
4
4
  "use client";
5
- import { WidgetProvider as e } from "../../../shared/feature/dist/lib/WidgetProvider/WidgetProvider.js";
5
+ import { useAllBankAccountsQuery as e } from "../../../shared/data-access/dist/lib/bank-account/useAllBankAccountsQuery.js";
6
+ import "../../../shared/data-access/dist/index.js";
7
+ import { useAnalyticsTrack as t } from "../../../shared/feature/dist/lib/analytics/hooks.js";
8
+ import { useWidgetConfig as n, useWidgetError as ee, useWidgetLoading as te } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
9
+ import { CardProgram as r } from "../../../shared/feature/dist/lib/card/cardProgram.js";
6
10
  import "../../../shared/feature/dist/index.js";
7
- import { WIDGET_NAME as t } from "./index2.js";
8
- import { resolveCardsListLabels as n } from "../../ui/dist/lib/CardsList/labels.js";
9
- import { CardsList as r } from "../../ui/dist/lib/CardsList/CardsList.js";
10
- import { CardsListDetailsSheet as i } from "../../ui/dist/lib/CardsList/CardsListDetailsSheet.js";
11
- import "../../ui/dist/index.js";
12
- import { useCardsWidget as a } from "./index7.js";
13
- import { CardDetailsWidget as o } from "../../../card-details-widget/feature/dist/index6.js";
14
- import "../../../card-details-widget/feature/dist/index.js";
15
- import { CreateCardWidget as s } from "../../../create-card-widget/feature/dist/index7.js";
16
- import "../../../create-card-widget/feature/dist/index.js";
17
- import { useCallback as c, useMemo as l, useState as u } from "react";
18
- import { Fragment as d, jsx as f, jsxs as p } from "react/jsx-runtime";
11
+ import { resolveCardsFeatureLabels as ne } from "./index4.js";
12
+ import { getCardsPermissions as re } from "./index6.js";
13
+ import { CardsWidgetAnalyticsEvent as ie } from "./index2.js";
14
+ import { maskAccountNumber as ae } from "./index5.js";
15
+ import { CARD_COLUMNS_BY_PROGRAM as oe, toCardRows as se, toCreditCardListItems as ce, toDebitCardListItems as le } from "./index7.js";
16
+ import { useCreditCardsQuery as ue } from "../../data-access/dist/index2.js";
17
+ import { useDebitCardsQuery as de } from "../../data-access/dist/index3.js";
18
+ import "../../data-access/dist/index.js";
19
+ import { useCallback as i, useEffect as a, useMemo as o, useRef as fe, useState as s } from "react";
20
+ import { useControllableState as pe } from "@radix-ui/react-use-controllable-state";
19
21
  //#region ../../libs/tesouro-embedded-components-react/cards-widget/feature/dist/index8.js
20
- function m({ cardProgram: e, pagination: t, defaultPagination: m, onPaginationChange: h, labels: g, featureLabels: _, selectedCardId: v, defaultSelectedCardId: y, onSelectedCardIdChange: b, cardDetailsLabels: x, cardDetailsFeatureLabels: S, bankLogoSrc: C, bankLogoAlt: w, cardArtSrc: T, createCardLabels: E, createCardFeatureLabels: D, onCreateCard: O, onActivateCard: k }) {
21
- let { selectedCardId: A, onSelectCard: j, onCreateCardClick: M, canCreateCard: N, canReadCards: P, ...F } = a({
22
- cardProgram: e,
23
- pagination: t,
24
- defaultPagination: m,
25
- onPaginationChange: h,
26
- featureLabels: _,
27
- selectedCardId: v,
28
- defaultSelectedCardId: y,
29
- onSelectedCardIdChange: b,
30
- onCreateCard: O,
31
- onActivateCard: k,
32
- cardArtSrc: T
33
- }), I = l(() => n(g), [g]), [L, R] = u(!1), [z, B] = u(0), [V, H] = u(A), [U, W] = u(null), G = c(() => {
34
- A !== null && j(null), B((e) => e + 1), R(!0);
35
- }, [A, j]), K = c(() => {
36
- R(!1), A !== null && j(null);
37
- }, [A, j]), q = c((e) => {
38
- R(!1), j(e);
39
- }, [j]), J = e === "debit" && !!T && !!N && M === void 0, Y = L && A === null && J;
40
- L && (A !== null || !J) && R(!1), Y ? U !== "create" && W("create") : A !== null && (U !== "details" && W("details"), A !== V && H(A));
41
- let X = U === "create", Z = A !== null || Y;
42
- return /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ f(r, {
43
- ...F,
44
- canCreateCard: N,
45
- onCreateCardClick: M ?? G,
46
- labels: I
47
- }), /* @__PURE__ */ f(i, {
48
- isOpen: Z,
49
- labels: X ? I.createSheet : I.detailsSheet,
50
- contentClassName: X ? "ttw:overflow-hidden ttw:p-0 ttw:min-h-0" : void 0,
51
- onClose: K,
52
- children: X && J && T ? /* @__PURE__ */ f(s, {
53
- cardArtSrc: T,
54
- labels: E,
55
- featureLabels: D,
56
- onClose: K,
57
- onCancel: K,
58
- onViewCard: P ? q : void 0,
59
- className: "ttw:min-h-0 ttw:flex-1"
60
- }, z) : V === null ? null : /* @__PURE__ */ f(o, {
61
- cardId: V,
62
- cardProgram: e,
63
- labels: x,
64
- featureLabels: S,
65
- bankLogoSrc: C,
66
- bankLogoAlt: w,
67
- onClose: K
68
- }, V)
69
- })] });
22
+ var me = [
23
+ 10,
24
+ 25,
25
+ 50
26
+ ], c = 10, he = "<none>";
27
+ function l(e, t) {
28
+ return e !== void 0 && t !== void 0 && e !== t;
70
29
  }
71
- function h({ baseUrl: n, widgetToken: r, organizationId: i, configClient: a, gatewayRouting: o, linkComponent: s, implementation: c, uiFramework: l, errorFallback: u, onError: d, analytics: p, disclosuresAcceptance: h, ...g }) {
72
- return /* @__PURE__ */ f(e, {
73
- widgetName: t,
74
- baseUrl: n,
75
- widgetToken: r,
76
- organizationId: i,
77
- configClient: a,
78
- gatewayRouting: o,
79
- linkComponent: s,
80
- implementation: c,
81
- uiFramework: l,
82
- errorFallback: u,
83
- onError: d,
84
- analytics: p,
85
- disclosuresAcceptance: h,
86
- children: /* @__PURE__ */ f(m, { ...g })
87
- });
30
+ function u(e) {
31
+ let t = Number.isInteger(e?.pageSize) && Number(e?.pageSize) > 0 ? Number(e?.pageSize) : c;
32
+ return {
33
+ paginationToken: e?.paginationToken,
34
+ pageSize: t
35
+ };
36
+ }
37
+ function d({ cardProgram: c, pagination: d, defaultPagination: f, onPaginationChange: p, featureLabels: m, selectedCardId: ge, defaultSelectedCardId: _e, onSelectedCardIdChange: ve, onCreateCard: h, onActivateCard: g, cardArtSrc: ye }) {
38
+ let _ = o(() => ne(m), [m]), v = t();
39
+ a(() => {
40
+ v(ie.Mounted);
41
+ }, [v]);
42
+ let { organizationId: y, widgetToken: be, initResponse: b } = n(), x = b?.userId ?? void 0, xe = te(), S = !!ee(), C = !!(y && be), w = o(() => re({
43
+ cardProgram: c,
44
+ scopes: b?.scopes
45
+ }), [c, b?.scopes]), T = C && w.canRead && !!b, Se = o(() => u(d), [d?.pageSize, d?.paginationToken]), E = o(() => u(f), [f?.pageSize, f?.paginationToken]), [D, Ce] = s(x);
46
+ x !== void 0 && x !== D && Ce(x);
47
+ let [O, we] = s(y);
48
+ y !== void 0 && y !== O && we(y);
49
+ let k = [
50
+ [
51
+ c,
52
+ O === null ? he : O ?? "",
53
+ D ?? ""
54
+ ].join("\0"),
55
+ E.paginationToken ?? "",
56
+ E.pageSize
57
+ ].join("\0"), A = d !== void 0, [j, M] = s(() => ({
58
+ resetKey: k,
59
+ paginationToken: E.paginationToken,
60
+ pageSize: E.pageSize
61
+ })), [Te, Ee] = s(!0), [De, N] = pe({
62
+ prop: ge,
63
+ defaultProp: _e ?? null,
64
+ onChange: ve,
65
+ caller: "CardsWidget"
66
+ }), P = fe({
67
+ cardProgram: c,
68
+ organizationId: O,
69
+ userId: D
70
+ }), Oe = P.current.cardProgram !== c || l(P.current.organizationId, O) || l(P.current.userId, D);
71
+ a(() => {
72
+ let e = P.current;
73
+ P.current = {
74
+ cardProgram: c,
75
+ organizationId: O,
76
+ userId: D
77
+ }, (e.cardProgram !== c || l(e.organizationId, O) || l(e.userId, D)) && N(null);
78
+ }, [
79
+ c,
80
+ O,
81
+ D,
82
+ N
83
+ ]);
84
+ let F = i((e) => {
85
+ N(e);
86
+ }, [N]), I = Te && !!x, ke = j.resetKey === k;
87
+ a(() => {
88
+ A || M((e) => e.resetKey === k ? e : {
89
+ resetKey: k,
90
+ paginationToken: E.paginationToken,
91
+ pageSize: E.pageSize
92
+ });
93
+ }, [
94
+ E.pageSize,
95
+ E.paginationToken,
96
+ A,
97
+ k
98
+ ]);
99
+ let L = A ? Se : ke ? j : E, Ae = L.paginationToken, R = L.pageSize, z = I ? x : void 0, B = {
100
+ limit: R,
101
+ paginationToken: Ae
102
+ }, V = ue({
103
+ ...B,
104
+ userId: z,
105
+ enabled: T && c === r.Credit
106
+ }), H = de({
107
+ ...B,
108
+ cardholderUserId: z,
109
+ enabled: T && c === r.Debit
110
+ }), U = c === r.Credit ? V : H, W = T && w.canReadFundingAccounts, G = e({ enabled: W }), K = o(() => {
111
+ let e = /* @__PURE__ */ new Map();
112
+ if (!w.canReadFundingAccounts) return e;
113
+ for (let t of G.data?.data ?? []) {
114
+ let n = t.nickname?.trim();
115
+ e.set(t.id, n ? {
116
+ name: n,
117
+ lastFour: t.accountNumber?.trim().slice(-4) || void 0
118
+ } : { name: ae(t.accountNumber) ?? _.untitledFundingAccount });
119
+ }
120
+ return e;
121
+ }, [
122
+ G.data?.data,
123
+ _.untitledFundingAccount,
124
+ w.canReadFundingAccounts
125
+ ]), q = W && G.isError, je = W && !q && (G.isLoading || G.isFetchingNextPage || !!G.hasNextPage), J = o(() => T ? c === r.Credit ? ce(V.data?.data ?? []) : le(H.data?.data ?? []) : [], [
126
+ T,
127
+ c,
128
+ V.data?.data,
129
+ H.data?.data
130
+ ]), Me = o(() => se(J, {
131
+ labels: _,
132
+ fundingAccountNames: K,
133
+ canActivate: w.canActivate,
134
+ onCardSelect: F,
135
+ onActivateCard: g
136
+ }), [
137
+ J,
138
+ K,
139
+ F,
140
+ _,
141
+ g,
142
+ w.canActivate
143
+ ]), Y = U.data?.nextPaginationToken ?? void 0, X = U.data?.prevPaginationToken ?? void 0, Ne = !!U.data, Z = T && (U.isError || q), Q = i((e) => {
144
+ A || M({
145
+ resetKey: k,
146
+ paginationToken: e.paginationToken,
147
+ pageSize: e.pageSize
148
+ }), p?.(e);
149
+ }, [
150
+ A,
151
+ p,
152
+ k
153
+ ]), $ = i(() => {
154
+ Q({
155
+ paginationToken: void 0,
156
+ pageSize: R
157
+ });
158
+ }, [Q, R]), Pe = i((e) => {
159
+ Q({
160
+ paginationToken: void 0,
161
+ pageSize: e
162
+ });
163
+ }, [Q]), Fe = i((e) => {
164
+ Ee(e), $();
165
+ }, [$]), Ie = i(() => {
166
+ Q({
167
+ paginationToken: X,
168
+ pageSize: R
169
+ });
170
+ }, [
171
+ Q,
172
+ R,
173
+ X
174
+ ]), Le = i(() => {
175
+ Q({
176
+ paginationToken: Y,
177
+ pageSize: R
178
+ });
179
+ }, [
180
+ Q,
181
+ Y,
182
+ R
183
+ ]), Re = U.refetch, ze = G.refetch, Be = i(() => {
184
+ Re(), W && ze();
185
+ }, [
186
+ W,
187
+ Re,
188
+ ze
189
+ ]);
190
+ return {
191
+ rows: Me,
192
+ selectedCardId: Oe ? null : De,
193
+ onSelectCard: F,
194
+ canReadCards: w.canRead,
195
+ columns: oe[c],
196
+ isLoading: !S && (!C || xe && !b || T && (U.isLoading || je)),
197
+ isError: S || Z,
198
+ canToggleShowMyCards: w.canRead && !!x,
199
+ isShowingMyCards: I,
200
+ onShowMyCardsChange: Fe,
201
+ canCreateCard: w.canCreate && (!!h || !!ye && w.canComposeDebitCreate),
202
+ onCreateCardClick: h,
203
+ onRetry: Be,
204
+ isPaginationVisible: T && Ne && !Z,
205
+ pageSize: R,
206
+ pageSizeOptions: me,
207
+ isPreviousPageDisabled: !X,
208
+ isNextPageDisabled: !Y,
209
+ onPageSizeChange: Pe,
210
+ onPreviousPageClick: Ie,
211
+ onNextPageClick: Le
212
+ };
88
213
  }
89
214
  //#endregion
90
- export { h as CardsWidget, h as default };
215
+ export { d as useCardsWidget };
@@ -0,0 +1,95 @@
1
+ "use client";
2
+ "use client";
3
+ "use client";
4
+ "use client";
5
+ import { WidgetProvider as e } from "../../../shared/feature/dist/lib/WidgetProvider/WidgetProvider.js";
6
+ import "../../../shared/feature/dist/index.js";
7
+ import { WIDGET_NAME as t } from "./index2.js";
8
+ import { cardsWidgetTestIds as n } from "./index3.js";
9
+ import { resolveCardsListLabels as r } from "../../ui/dist/lib/CardsList/labels.js";
10
+ import { CardsList as i } from "../../ui/dist/lib/CardsList/CardsList.js";
11
+ import { CardsListDetailsSheet as a } from "../../ui/dist/lib/CardsList/CardsListDetailsSheet.js";
12
+ import "../../ui/dist/index.js";
13
+ import { useCardsWidget as o } from "./index8.js";
14
+ import { CardDetailsWidget as s } from "../../../card-details-widget/feature/dist/index6.js";
15
+ import "../../../card-details-widget/feature/dist/index.js";
16
+ import { CreateCardWidget as c } from "../../../create-card-widget/feature/dist/index7.js";
17
+ import "../../../create-card-widget/feature/dist/index.js";
18
+ import { useCallback as l, useMemo as u, useState as d } from "react";
19
+ import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
20
+ //#region ../../libs/tesouro-embedded-components-react/cards-widget/feature/dist/index9.js
21
+ function h({ cardProgram: e, pagination: t, defaultPagination: h, onPaginationChange: g, labels: _, featureLabels: v, selectedCardId: y, defaultSelectedCardId: b, onSelectedCardIdChange: x, cardDetailsLabels: S, cardDetailsFeatureLabels: C, bankLogoSrc: w, bankLogoAlt: T, cardArtSrc: E, createCardLabels: D, createCardFeatureLabels: O, onCreateCard: k, onActivateCard: A }) {
22
+ let { selectedCardId: j, onSelectCard: M, onCreateCardClick: N, canCreateCard: P, canReadCards: F, ...I } = o({
23
+ cardProgram: e,
24
+ pagination: t,
25
+ defaultPagination: h,
26
+ onPaginationChange: g,
27
+ featureLabels: v,
28
+ selectedCardId: y,
29
+ defaultSelectedCardId: b,
30
+ onSelectedCardIdChange: x,
31
+ onCreateCard: k,
32
+ onActivateCard: A,
33
+ cardArtSrc: E
34
+ }), L = u(() => r(_), [_]), [R, z] = d(!1), [B, V] = d(0), [H, U] = d(j), [W, G] = d(null), K = l(() => {
35
+ j !== null && M(null), V((e) => e + 1), z(!0);
36
+ }, [j, M]), q = l(() => {
37
+ z(!1), j !== null && M(null);
38
+ }, [j, M]), J = l((e) => {
39
+ z(!1), M(e);
40
+ }, [M]), Y = e === "debit" && !!E && !!P && N === void 0, X = R && j === null && Y;
41
+ R && (j !== null || !Y) && z(!1), X ? W !== "create" && G("create") : j !== null && (W !== "details" && G("details"), j !== H && U(j));
42
+ let Z = W === "create", Q = j !== null || X;
43
+ return /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p(i, {
44
+ ...I,
45
+ canCreateCard: P,
46
+ onCreateCardClick: N ?? K,
47
+ labels: L,
48
+ testIds: {
49
+ root: n.list,
50
+ row: { cardFaceSwatch: { root: n.cardFaceSwatch } }
51
+ }
52
+ }), /* @__PURE__ */ p(a, {
53
+ isOpen: Q,
54
+ labels: Z ? L.createSheet : L.detailsSheet,
55
+ contentClassName: Z ? "ttw:overflow-hidden ttw:p-0 ttw:min-h-0" : void 0,
56
+ onClose: q,
57
+ children: Z && Y && E ? /* @__PURE__ */ p(c, {
58
+ cardArtSrc: E,
59
+ labels: D,
60
+ featureLabels: O,
61
+ onClose: q,
62
+ onCancel: q,
63
+ onViewCard: F ? J : void 0,
64
+ className: "ttw:min-h-0 ttw:flex-1"
65
+ }, B) : H === null ? null : /* @__PURE__ */ p(s, {
66
+ cardId: H,
67
+ cardProgram: e,
68
+ labels: S,
69
+ featureLabels: C,
70
+ bankLogoSrc: w,
71
+ bankLogoAlt: T,
72
+ onClose: q
73
+ }, H)
74
+ })] });
75
+ }
76
+ function g({ baseUrl: n, widgetToken: r, organizationId: i, configClient: a, gatewayRouting: o, linkComponent: s, implementation: c, uiFramework: l, errorFallback: u, onError: d, analytics: f, disclosuresAcceptance: m, ...g }) {
77
+ return /* @__PURE__ */ p(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: m,
91
+ children: /* @__PURE__ */ p(h, { ...g })
92
+ });
93
+ }
94
+ //#endregion
95
+ export { g as CardsWidget, g as default };
@@ -1,9 +1,9 @@
1
1
  import { jsx as e } from "react/jsx-runtime";
2
2
  //#region ../../libs/tesouro-embedded-components-react/cards-widget/ui/dist/lib/CardsList/CardFaceSwatch.js
3
- function t() {
3
+ function t({ testIds: t }) {
4
4
  return /* @__PURE__ */ e("span", {
5
5
  "aria-hidden": !0,
6
- "data-testid": "card-face-swatch",
6
+ "data-testid": t?.root,
7
7
  className: "ttw:flex ttw:h-7 ttw:w-[42px] ttw:shrink-0 ttw:items-end ttw:rounded-[3.5px] ttw:bg-foreground ttw:p-1",
8
8
  children: /* @__PURE__ */ e("span", { className: "ttw:h-1 ttw:w-2.5 ttw:rounded-[1px] ttw:bg-muted-foreground" })
9
9
  });
@@ -24,36 +24,36 @@ function w({ columnCount: e }) {
24
24
  children: Array.from({ length: e }).map((e, n) => /* @__PURE__ */ v(a, { children: /* @__PURE__ */ v(t, { className: "ttw:h-4 ttw:w-24" }) }, n))
25
25
  }, r)) });
26
26
  }
27
- function T({ rows: t, columns: _, isLoading: C = !1, isError: T = !1, canToggleShowMyCards: E = !1, isShowingMyCards: D = !0, onShowMyCardsChange: O, canCreateCard: k = !1, onCreateCardClick: A, onRetry: j, isPaginationVisible: M = !1, pageSize: N = 10, pageSizeOptions: P = S, rangeLabel: F = "", isPreviousPageDisabled: I = !1, isNextPageDisabled: L = !1, onPageSizeChange: R, onPreviousPageClick: z, onNextPageClick: B, labels: V }) {
28
- let H = h(), U = g(() => p(V), [V]), W = !!(k && A), G = R && z && B ? {
27
+ function T({ rows: t, columns: _, isLoading: C = !1, isError: T = !1, canToggleShowMyCards: E = !1, isShowingMyCards: D = !0, onShowMyCardsChange: O, canCreateCard: k = !1, onCreateCardClick: A, onRetry: j, isPaginationVisible: M = !1, pageSize: N = 10, pageSizeOptions: P = S, rangeLabel: F = "", isPreviousPageDisabled: I = !1, isNextPageDisabled: L = !1, onPageSizeChange: R, onPreviousPageClick: z, onNextPageClick: B, labels: V, testIds: H }) {
28
+ let U = h(), W = g(() => p(V), [V]), G = !!(k && A), K = R && z && B ? {
29
29
  onPageSizeChange: R,
30
30
  onPreviousPageClick: z,
31
31
  onNextPageClick: B
32
- } : void 0, K = _.length + 1;
32
+ } : void 0, q = _.length + 1;
33
33
  return /* @__PURE__ */ y("section", {
34
- "aria-label": U.regionLabel,
34
+ "aria-label": W.regionLabel,
35
35
  "aria-busy": C || void 0,
36
- "data-testid": "cards-list",
36
+ "data-testid": H?.root,
37
37
  children: [
38
38
  /* @__PURE__ */ y("header", {
39
39
  className: "ttw:mb-5 ttw:flex ttw:flex-wrap ttw:items-start ttw:justify-between ttw:gap-4",
40
40
  children: [/* @__PURE__ */ v(l, {
41
41
  variant: "h2",
42
- children: U.title
43
- }), W && /* @__PURE__ */ y(e, {
42
+ children: W.title
43
+ }), G && /* @__PURE__ */ y(e, {
44
44
  size: "sm",
45
45
  disabled: C,
46
46
  onClick: A,
47
47
  children: [/* @__PURE__ */ v(x, {
48
48
  "aria-hidden": !0,
49
49
  className: "ttw:size-4"
50
- }), U.createCardButton]
50
+ }), W.createCardButton]
51
51
  })]
52
52
  }),
53
53
  C && /* @__PURE__ */ v("span", {
54
54
  role: "status",
55
55
  className: "ttw:sr-only",
56
- children: U.loadingLabel
56
+ children: W.loadingLabel
57
57
  }),
58
58
  E && O && /* @__PURE__ */ y("div", {
59
59
  className: "ttw:mb-4 ttw:flex ttw:items-center ttw:gap-3",
@@ -61,11 +61,11 @@ function T({ rows: t, columns: _, isLoading: C = !1, isError: T = !1, canToggleS
61
61
  checked: D,
62
62
  disabled: C,
63
63
  onCheckedChange: O,
64
- "aria-labelledby": H
64
+ "aria-labelledby": U
65
65
  }), /* @__PURE__ */ v("span", {
66
- id: H,
66
+ id: U,
67
67
  className: "ttw:text-sm ttw:font-medium ttw:text-foreground",
68
- children: U.showMyCardsToggle
68
+ children: W.showMyCardsToggle
69
69
  })]
70
70
  }),
71
71
  /* @__PURE__ */ y("div", {
@@ -74,58 +74,59 @@ function T({ rows: t, columns: _, isLoading: C = !1, isError: T = !1, canToggleS
74
74
  className: "ttw:hover:bg-transparent",
75
75
  children: [_.map((e) => /* @__PURE__ */ v(o, {
76
76
  className: "ttw:text-sm",
77
- children: U.columnHeaders[e]
77
+ children: W.columnHeaders[e]
78
78
  }, e)), /* @__PURE__ */ v(o, {
79
79
  className: "ttw:w-[90px]",
80
80
  children: /* @__PURE__ */ v("span", {
81
81
  className: "ttw:sr-only",
82
- children: U.rowActionsColumn
82
+ children: W.rowActionsColumn
83
83
  })
84
84
  })]
85
85
  }) }), /* @__PURE__ */ v(i, { children: T ? /* @__PURE__ */ v(c, {
86
86
  className: "ttw:hover:bg-transparent",
87
87
  children: /* @__PURE__ */ v(a, {
88
- colSpan: K,
88
+ colSpan: q,
89
89
  className: "ttw:p-0",
90
90
  children: /* @__PURE__ */ v(d, {
91
- title: U.errorTitle,
92
- description: U.errorDescription,
93
- retryLabel: U.retryButton,
91
+ title: W.errorTitle,
92
+ description: W.errorDescription,
93
+ retryLabel: W.retryButton,
94
94
  onRetry: j
95
95
  })
96
96
  })
97
- }) : C ? /* @__PURE__ */ v(w, { columnCount: K }) : t.length === 0 ? /* @__PURE__ */ v(c, {
97
+ }) : C ? /* @__PURE__ */ v(w, { columnCount: q }) : t.length === 0 ? /* @__PURE__ */ v(c, {
98
98
  className: "ttw:hover:bg-transparent",
99
99
  children: /* @__PURE__ */ v(a, {
100
- colSpan: K,
100
+ colSpan: q,
101
101
  className: "ttw:p-0",
102
102
  children: /* @__PURE__ */ v(u, {
103
103
  icon: /* @__PURE__ */ v(b, { className: "ttw:size-6 ttw:text-muted-foreground" }),
104
- title: U.emptyTitle,
105
- description: U.emptyDescription,
106
- actionLabel: W ? U.createCardButton : void 0,
104
+ title: W.emptyTitle,
105
+ description: W.emptyDescription,
106
+ actionLabel: G ? W.createCardButton : void 0,
107
107
  actionIcon: /* @__PURE__ */ v(x, {
108
108
  "aria-hidden": !0,
109
109
  className: "ttw:size-4"
110
110
  }),
111
- onAction: W ? A : void 0
111
+ onAction: G ? A : void 0
112
112
  })
113
113
  })
114
114
  }) : t.map((e) => /* @__PURE__ */ v(m, {
115
+ testIds: H?.row,
115
116
  row: e,
116
117
  columns: _,
117
- labels: U
118
- }, e.key)) })] }), M && G && /* @__PURE__ */ v(f, {
118
+ labels: W
119
+ }, e.key)) })] }), M && K && /* @__PURE__ */ v(f, {
119
120
  pageSize: N,
120
121
  pageSizeOptions: P,
121
122
  rangeLabel: F,
122
123
  isPreviousDisabled: I,
123
124
  isNextDisabled: L,
124
125
  isDisabled: C,
125
- onPageSizeChange: G.onPageSizeChange,
126
- onPreviousPageClick: G.onPreviousPageClick,
127
- onNextPageClick: G.onNextPageClick,
128
- labels: U.pagination
126
+ onPageSizeChange: K.onPageSizeChange,
127
+ onPreviousPageClick: K.onPreviousPageClick,
128
+ onNextPageClick: K.onNextPageClick,
129
+ labels: W.pagination
129
130
  })]
130
131
  })
131
132
  ]
@@ -7,8 +7,8 @@ import { cardStatusToneClassName as r } from "./statusBadge.js";
7
7
  import { CardFaceSwatch as i } from "./CardFaceSwatch.js";
8
8
  import { Fragment as a, jsx as o, jsxs as s } from "react/jsx-runtime";
9
9
  //#region ../../libs/tesouro-embedded-components-react/cards-widget/ui/dist/lib/CardsList/CardsListRow.js
10
- function c({ row: e, labels: t }) {
11
- return /* @__PURE__ */ s(a, { children: [/* @__PURE__ */ o(i, {}), /* @__PURE__ */ s("span", {
10
+ function c({ row: e, labels: t, testIds: n }) {
11
+ return /* @__PURE__ */ s(a, { children: [/* @__PURE__ */ o(i, { testIds: n?.cardFaceSwatch }), /* @__PURE__ */ s("span", {
12
12
  className: "ttw:flex ttw:min-w-0 ttw:flex-col ttw:gap-1",
13
13
  children: [/* @__PURE__ */ s("span", {
14
14
  className: "ttw:flex ttw:gap-1 ttw:text-sm ttw:leading-none",
@@ -33,13 +33,14 @@ function c({ row: e, labels: t }) {
33
33
  })]
34
34
  })] });
35
35
  }
36
- function l({ row: i, columns: a, labels: l }) {
37
- let u = !!i.onActivate, d = !!i.onSelect, f = {
36
+ function l({ row: i, columns: a, labels: l, testIds: u }) {
37
+ let d = !!i.onActivate, f = !!i.onSelect, p = {
38
38
  cardName: /* @__PURE__ */ o("span", {
39
39
  className: "ttw:flex ttw:w-full ttw:items-center ttw:gap-3",
40
40
  children: /* @__PURE__ */ o(c, {
41
41
  row: i,
42
- labels: l
42
+ labels: l,
43
+ testIds: u
43
44
  })
44
45
  }),
45
46
  fundingAccount: /* @__PURE__ */ s("span", {
@@ -80,15 +81,15 @@ function l({ row: i, columns: a, labels: l }) {
80
81
  };
81
82
  return /* @__PURE__ */ s(n, {
82
83
  "data-testid": `cards-list-row-${i.key}`,
83
- className: d ? "ttw:relative ttw:h-18 ttw:cursor-pointer" : "ttw:h-18",
84
- children: [a.map((e, n) => /* @__PURE__ */ s(t, { children: [n === 0 && d ? /* @__PURE__ */ o("button", {
84
+ className: f ? "ttw:relative ttw:h-18 ttw:cursor-pointer" : "ttw:h-18",
85
+ children: [a.map((e, n) => /* @__PURE__ */ s(t, { children: [n === 0 && f ? /* @__PURE__ */ o("button", {
85
86
  type: "button",
86
87
  "aria-label": `${l.selectCardButton} ${i.nickname} ${i.lastFour} ${i.typeLabel}`,
87
88
  onClick: () => i.onSelect?.(),
88
89
  className: "ttw:absolute ttw:inset-0 ttw:z-10 ttw:cursor-pointer ttw:rounded-md ttw:outline-none ttw:focus-visible:ring-2 ttw:focus-visible:ring-ring ttw:focus-visible:ring-offset-2"
89
- }) : null, f[e]] }, e)), /* @__PURE__ */ o(t, {
90
- className: d ? "ttw:relative ttw:z-20 ttw:text-right" : "ttw:text-right",
91
- children: u && /* @__PURE__ */ o(e, {
90
+ }) : null, p[e]] }, e)), /* @__PURE__ */ o(t, {
91
+ className: f ? "ttw:relative ttw:z-20 ttw:text-right" : "ttw:text-right",
92
+ children: d && /* @__PURE__ */ o(e, {
92
93
  size: "sm",
93
94
  "aria-label": `${l.activateButtonForCard} ${i.nickname}`,
94
95
  onClick: (e) => {
@@ -1,7 +1,7 @@
1
1
  import "./index4.js";
2
- import { ExpenseApprovalPoliciesWidget as e } from "./index5.js";
3
- import { UploadReceiptWidget as t } from "./index6.js";
4
- import { ExpenseManagementWidget as n } from "./index8.js";
5
- import "./index9.js";
6
- import { ReceiptMatchWidget as r } from "./index12.js";
2
+ import { ExpenseApprovalPoliciesWidget as e } from "./index6.js";
3
+ import { UploadReceiptWidget as t } from "./index7.js";
4
+ import { ExpenseManagementWidget as n } from "./index9.js";
5
+ import "./index10.js";
6
+ import { ReceiptMatchWidget as r } from "./index13.js";
7
7
  export { e as ExpenseApprovalPoliciesWidget, n as ExpenseManagementWidget, r as ReceiptMatchWidget, t as UploadReceiptWidget };