@tesouro/embedded-components-react 0.5.181 → 0.5.182
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.
- package/README.md +32 -32
- package/dist/index.d.ts +18 -19
- package/dist/index.js +2 -2
- package/dist/lib/CreditCardsWidget.d.ts +9 -11
- package/dist/lib/CreditCardsWidget.js +1 -1
- package/dist/lib/DebitCardsWidget.d.ts +14 -15
- package/dist/lib/DebitCardsWidget.js +1 -1
- package/dist/lib/WidgetSuite.d.ts +13 -15
- package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/index.js +4 -4
- package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/index10.js +87 -8
- package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/index11.js +3 -3
- package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/index12.js +17 -0
- package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/index4.js +17 -24
- package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/index5.js +23 -24
- package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/index6.js +24 -30
- package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/index7.js +28 -55
- package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/index8.js +53 -222
- package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/index9.js +219 -87
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index9.js +3 -3
- package/package.json +1 -1
- package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/index3.js +0 -19
|
@@ -2,96 +2,228 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
"use client";
|
|
4
4
|
"use client";
|
|
5
|
-
import {
|
|
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 {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import "../../
|
|
13
|
-
import {
|
|
14
|
-
import
|
|
15
|
-
import "
|
|
16
|
-
import {
|
|
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";
|
|
11
|
+
import { resolveCardsFeatureLabels as ne } from "./index5.js";
|
|
12
|
+
import { getCardsPermissions as re } from "./index7.js";
|
|
13
|
+
import { CardsWidgetAnalyticsEvent as ie } from "./index2.js";
|
|
14
|
+
import { maskAccountNumber as ae } from "./index6.js";
|
|
15
|
+
import { CARD_COLUMNS_BY_PROGRAM as oe, toCardRows as se, toCreditCardListItems as ce, toDebitCardListItems as le } from "./index8.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";
|
|
20
21
|
//#region ../../libs/tesouro-embedded-components-react/cards-widget/feature/dist/index9.js
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
selectedCardId: b,
|
|
29
|
-
defaultSelectedCardId: x,
|
|
30
|
-
onSelectedCardIdChange: S,
|
|
31
|
-
onCreateCard: j,
|
|
32
|
-
onActivateCard: M,
|
|
33
|
-
cardArtSrc: O
|
|
34
|
-
}), z = d(() => i(v), [v]), [B, V] = f(!1), [H, U] = f(0), [W, G] = f(N), [K, q] = f(null), J = u(() => {
|
|
35
|
-
N !== null && P(null), U((e) => e + 1), V(!0);
|
|
36
|
-
}, [N, P]), Y = u(() => {
|
|
37
|
-
V(!1), N !== null && P(null);
|
|
38
|
-
}, [N, P]), X = u((e) => {
|
|
39
|
-
V(!1), P(e);
|
|
40
|
-
}, [P]), Z = e === "debit" && !!O && !!I && F === void 0, Q = B && N === null && Z;
|
|
41
|
-
B && (N !== null || !Z) && V(!1), Q ? K !== "create" && q("create") : N !== null && (K !== "details" && q("details"), N !== W && G(N));
|
|
42
|
-
let $ = K === "create", te = N !== null || Q;
|
|
43
|
-
return /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ m(a, {
|
|
44
|
-
...R,
|
|
45
|
-
canCreateCard: I,
|
|
46
|
-
onCreateCardClick: F ?? J,
|
|
47
|
-
headerStart: ee,
|
|
48
|
-
labels: z,
|
|
49
|
-
testIds: r
|
|
50
|
-
}), /* @__PURE__ */ m(o, {
|
|
51
|
-
isOpen: te,
|
|
52
|
-
labels: $ ? z.createSheet : z.detailsSheet,
|
|
53
|
-
contentClassName: $ ? "ttw:overflow-hidden ttw:p-0 ttw:min-h-0" : void 0,
|
|
54
|
-
onClose: Y,
|
|
55
|
-
testIds: n,
|
|
56
|
-
children: $ && Z && O ? /* @__PURE__ */ m(l, {
|
|
57
|
-
cardArtSrc: O,
|
|
58
|
-
labels: k,
|
|
59
|
-
featureLabels: A,
|
|
60
|
-
onClose: Y,
|
|
61
|
-
onCancel: Y,
|
|
62
|
-
onViewCard: L ? X : void 0,
|
|
63
|
-
className: "ttw:min-h-0 ttw:flex-1"
|
|
64
|
-
}, H) : W === null ? null : /* @__PURE__ */ m(c, {
|
|
65
|
-
cardId: W,
|
|
66
|
-
cardProgram: e,
|
|
67
|
-
labels: C,
|
|
68
|
-
activateLabels: T,
|
|
69
|
-
featureLabels: w,
|
|
70
|
-
cardArtSrc: O,
|
|
71
|
-
bankLogoSrc: E,
|
|
72
|
-
bankLogoAlt: D,
|
|
73
|
-
onClose: Y
|
|
74
|
-
}, W)
|
|
75
|
-
})] });
|
|
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;
|
|
76
29
|
}
|
|
77
|
-
function
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
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: ge, featureLabels: p, selectedCardId: _e, defaultSelectedCardId: ve, onSelectedCardIdChange: ye, onCreateCard: m, onActivateCard: be }) {
|
|
38
|
+
let h = o(() => ne(p), [p]), g = t();
|
|
39
|
+
a(() => {
|
|
40
|
+
g(ie.Mounted);
|
|
41
|
+
}, [g]);
|
|
42
|
+
let { organizationId: _, widgetToken: xe, initResponse: v } = n(), y = v?.userId ?? void 0, Se = te(), b = !!ee(), x = !!(_ && xe), S = o(() => re({
|
|
43
|
+
cardProgram: c,
|
|
44
|
+
scopes: v?.scopes
|
|
45
|
+
}), [c, v?.scopes]), C = x && S.canRead && !!v, Ce = o(() => u(d), [d?.pageSize, d?.paginationToken]), w = o(() => u(f), [f?.pageSize, f?.paginationToken]), [T, we] = s(y);
|
|
46
|
+
y !== void 0 && y !== T && we(y);
|
|
47
|
+
let [E, Te] = s(_);
|
|
48
|
+
_ !== void 0 && _ !== E && Te(_);
|
|
49
|
+
let D = [
|
|
50
|
+
c,
|
|
51
|
+
E === null ? he : E ?? "",
|
|
52
|
+
T ?? ""
|
|
53
|
+
].join("\0"), O = [
|
|
54
|
+
D,
|
|
55
|
+
w.paginationToken ?? "",
|
|
56
|
+
w.pageSize
|
|
57
|
+
].join("\0"), k = d !== void 0, [A, j] = s(() => ({
|
|
58
|
+
resetKey: O,
|
|
59
|
+
paginationToken: w.paginationToken,
|
|
60
|
+
pageSize: w.pageSize
|
|
61
|
+
})), [Ee, M] = s(!1), [De, N] = pe({
|
|
62
|
+
prop: _e,
|
|
63
|
+
defaultProp: ve ?? null,
|
|
64
|
+
onChange: ye,
|
|
65
|
+
caller: "CardsWidget"
|
|
66
|
+
}), P = fe({
|
|
67
|
+
cardProgram: c,
|
|
68
|
+
organizationId: E,
|
|
69
|
+
userId: T
|
|
70
|
+
}), Oe = P.current.cardProgram !== c || l(P.current.organizationId, E) || l(P.current.userId, T);
|
|
71
|
+
a(() => {
|
|
72
|
+
let e = P.current;
|
|
73
|
+
P.current = {
|
|
74
|
+
cardProgram: c,
|
|
75
|
+
organizationId: E,
|
|
76
|
+
userId: T
|
|
77
|
+
}, (e.cardProgram !== c || l(e.organizationId, E) || l(e.userId, T)) && (N(null), M(!1));
|
|
78
|
+
}, [
|
|
79
|
+
c,
|
|
80
|
+
E,
|
|
81
|
+
T,
|
|
82
|
+
N
|
|
83
|
+
]);
|
|
84
|
+
let F = i((e) => {
|
|
85
|
+
N(e);
|
|
86
|
+
}, [N]), I = Ee && !!y, ke = A.resetKey === O;
|
|
87
|
+
a(() => {
|
|
88
|
+
k || j((e) => e.resetKey === O ? e : {
|
|
89
|
+
resetKey: O,
|
|
90
|
+
paginationToken: w.paginationToken,
|
|
91
|
+
pageSize: w.pageSize
|
|
92
|
+
});
|
|
93
|
+
}, [
|
|
94
|
+
w.pageSize,
|
|
95
|
+
w.paginationToken,
|
|
96
|
+
k,
|
|
97
|
+
O
|
|
98
|
+
]);
|
|
99
|
+
let L = k ? Ce : ke ? A : w, Ae = L.paginationToken, R = L.pageSize, z = I ? y : void 0, B = {
|
|
100
|
+
limit: R,
|
|
101
|
+
paginationToken: Ae
|
|
102
|
+
}, V = ue({
|
|
103
|
+
...B,
|
|
104
|
+
userId: z,
|
|
105
|
+
enabled: C && c === r.Credit
|
|
106
|
+
}), H = de({
|
|
107
|
+
...B,
|
|
108
|
+
cardholderUserId: z,
|
|
109
|
+
enabled: C && c === r.Debit
|
|
110
|
+
}), U = c === r.Credit ? V : H, W = C && S.canReadFundingAccounts, G = e({ enabled: W }), K = o(() => {
|
|
111
|
+
let e = /* @__PURE__ */ new Map();
|
|
112
|
+
if (!S.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) ?? h.untitledFundingAccount });
|
|
119
|
+
}
|
|
120
|
+
return e;
|
|
121
|
+
}, [
|
|
122
|
+
G.data?.data,
|
|
123
|
+
h.untitledFundingAccount,
|
|
124
|
+
S.canReadFundingAccounts
|
|
125
|
+
]), q = W && G.isError, je = W && !q && (G.isLoading || G.isFetchingNextPage || !!G.hasNextPage), J = o(() => C ? c === r.Credit ? ce(V.data?.data ?? []) : le(H.data?.data ?? []) : [], [
|
|
126
|
+
C,
|
|
127
|
+
c,
|
|
128
|
+
V.data?.data,
|
|
129
|
+
H.data?.data
|
|
130
|
+
]), Me = o(() => se(J, {
|
|
131
|
+
labels: h,
|
|
132
|
+
fundingAccountNames: K,
|
|
133
|
+
canActivate: S.canActivate,
|
|
134
|
+
onCardSelect: F,
|
|
135
|
+
onActivateCard: be
|
|
136
|
+
}), [
|
|
137
|
+
J,
|
|
138
|
+
K,
|
|
139
|
+
F,
|
|
140
|
+
h,
|
|
141
|
+
be,
|
|
142
|
+
S.canActivate
|
|
143
|
+
]), Y = U.data?.nextPaginationToken ?? void 0, X = U.data?.prevPaginationToken ?? void 0, Z = !!U.data, Ne = C && (U.isError || q), [Q, Pe] = s({
|
|
144
|
+
key: D,
|
|
145
|
+
value: !1
|
|
146
|
+
});
|
|
147
|
+
if (C && !I && Z) {
|
|
148
|
+
let e = Q.key !== D, t = !!y && J.some((e) => e.userId !== y) || !e && Q.value;
|
|
149
|
+
(e || Q.value !== t) && Pe({
|
|
150
|
+
key: D,
|
|
151
|
+
value: t
|
|
152
|
+
});
|
|
153
|
+
} else Q.key !== D && Pe({
|
|
154
|
+
key: D,
|
|
155
|
+
value: !1
|
|
94
156
|
});
|
|
157
|
+
let Fe = Q.value, $ = i((e) => {
|
|
158
|
+
k || j({
|
|
159
|
+
resetKey: O,
|
|
160
|
+
paginationToken: e.paginationToken,
|
|
161
|
+
pageSize: e.pageSize
|
|
162
|
+
}), ge?.(e);
|
|
163
|
+
}, [
|
|
164
|
+
k,
|
|
165
|
+
ge,
|
|
166
|
+
O
|
|
167
|
+
]), Ie = i(() => {
|
|
168
|
+
$({
|
|
169
|
+
paginationToken: void 0,
|
|
170
|
+
pageSize: R
|
|
171
|
+
});
|
|
172
|
+
}, [$, R]), Le = i((e) => {
|
|
173
|
+
$({
|
|
174
|
+
paginationToken: void 0,
|
|
175
|
+
pageSize: e
|
|
176
|
+
});
|
|
177
|
+
}, [$]), Re = i((e) => {
|
|
178
|
+
M(e), Ie();
|
|
179
|
+
}, [Ie]), ze = i(() => {
|
|
180
|
+
$({
|
|
181
|
+
paginationToken: X,
|
|
182
|
+
pageSize: R
|
|
183
|
+
});
|
|
184
|
+
}, [
|
|
185
|
+
$,
|
|
186
|
+
R,
|
|
187
|
+
X
|
|
188
|
+
]), Be = i(() => {
|
|
189
|
+
$({
|
|
190
|
+
paginationToken: Y,
|
|
191
|
+
pageSize: R
|
|
192
|
+
});
|
|
193
|
+
}, [
|
|
194
|
+
$,
|
|
195
|
+
Y,
|
|
196
|
+
R
|
|
197
|
+
]), Ve = U.refetch, He = G.refetch, Ue = i(() => {
|
|
198
|
+
Ve(), W && He();
|
|
199
|
+
}, [
|
|
200
|
+
W,
|
|
201
|
+
Ve,
|
|
202
|
+
He
|
|
203
|
+
]);
|
|
204
|
+
return {
|
|
205
|
+
rows: Me,
|
|
206
|
+
selectedCardId: Oe ? null : De,
|
|
207
|
+
onSelectCard: F,
|
|
208
|
+
canReadCards: S.canRead,
|
|
209
|
+
columns: oe[c],
|
|
210
|
+
isLoading: !b && (!x || Se && !v || C && (U.isLoading || je)),
|
|
211
|
+
isError: b || Ne,
|
|
212
|
+
canToggleShowMyCards: S.canRead && !!y && Fe,
|
|
213
|
+
isShowingMyCards: I,
|
|
214
|
+
onShowMyCardsChange: Re,
|
|
215
|
+
canCreateCard: S.canCreate && (!!m || S.canComposeDebitCreate),
|
|
216
|
+
onCreateCardClick: m,
|
|
217
|
+
onRetry: Ue,
|
|
218
|
+
isPaginationVisible: C && Z && !Ne,
|
|
219
|
+
pageSize: R,
|
|
220
|
+
pageSizeOptions: me,
|
|
221
|
+
isPreviousPageDisabled: !X,
|
|
222
|
+
isNextPageDisabled: !Y,
|
|
223
|
+
onPageSizeChange: Le,
|
|
224
|
+
onPreviousPageClick: ze,
|
|
225
|
+
onNextPageClick: Be
|
|
226
|
+
};
|
|
95
227
|
}
|
|
96
228
|
//#endregion
|
|
97
|
-
export {
|
|
229
|
+
export { d as useCardsWidget };
|
package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region ../../libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js
|
|
2
|
-
var e = "@tesouro/embedded-components-react", t = "0.5.
|
|
2
|
+
var e = "@tesouro/embedded-components-react", t = "0.5.182", n = "d5767c7cda8709eab716afbae3de306710dc6d86", r = Object.freeze({
|
|
3
3
|
library_name: e,
|
|
4
4
|
library_version: t,
|
|
5
5
|
library_sha: n
|
|
@@ -8,8 +8,8 @@ import { Scope as n } from "../../../shared/data-access/dist/lib/scopes.js";
|
|
|
8
8
|
import "../../../shared/data-access/dist/index.js";
|
|
9
9
|
import { SectionHeading as r } from "../../../shared/ui/dist/lib/SectionHeading/SectionHeading.js";
|
|
10
10
|
import "../../../shared/ui/dist/index.js";
|
|
11
|
-
import { CreditCardsWidget as i } from "../../../cards-widget/feature/dist/
|
|
12
|
-
import { DebitCardsWidget as a } from "../../../cards-widget/feature/dist/
|
|
11
|
+
import { CreditCardsWidget as i } from "../../../cards-widget/feature/dist/index11.js";
|
|
12
|
+
import { DebitCardsWidget as a } from "../../../cards-widget/feature/dist/index12.js";
|
|
13
13
|
import "../../../cards-widget/feature/dist/index.js";
|
|
14
14
|
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
15
15
|
//#region ../../libs/tesouro-embedded-components-react/widget-suite/feature/dist/index9.js
|
|
@@ -25,7 +25,7 @@ function c() {
|
|
|
25
25
|
})
|
|
26
26
|
}), t(c, [n.DebitCardReadOrg]) && /* @__PURE__ */ o(a, {
|
|
27
27
|
...d.debitCards,
|
|
28
|
-
cardArtSrc: u
|
|
28
|
+
cardArtSrc: u,
|
|
29
29
|
headerStart: /* @__PURE__ */ o(r, {
|
|
30
30
|
className: "ttw:mb-0",
|
|
31
31
|
children: d.debitCardsTitle
|
package/package.json
CHANGED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
//#region ../../libs/tesouro-embedded-components-react/cards-widget/feature/dist/index3.js
|
|
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 };
|
|
18
|
-
//#endregion
|
|
19
|
-
export { n as cardsListDetailsSheetTestIds, t as cardsListTestIds, e as cardsWidgetTestIds };
|