@tesouro/embedded-components-react 0.3.61 → 0.3.62
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 +11 -11
- package/dist/index.css +6 -0
- package/dist/index.d.ts +44 -0
- package/dist/index.js +1 -1
- package/dist/lib/CardDetailsWidget.d.ts +44 -0
- package/dist/lib/CardDetailsWidget.js +1 -1
- package/dist/lib/CreditCardsWidget.d.ts +44 -0
- package/dist/lib/DebitCardsWidget.d.ts +44 -0
- package/dist/lib/WidgetSuite.d.ts +44 -0
- package/dist/libs/tesouro-embedded-components-react/card-details-widget/data-access/dist/index.js +4 -2
- package/dist/libs/tesouro-embedded-components-react/card-details-widget/data-access/dist/index10.js +32 -0
- package/dist/libs/tesouro-embedded-components-react/card-details-widget/data-access/dist/index11.js +27 -0
- package/dist/libs/tesouro-embedded-components-react/card-details-widget/data-access/dist/index9.js +17 -12
- package/dist/libs/tesouro-embedded-components-react/card-details-widget/feature/dist/index.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/card-details-widget/feature/dist/index10.js +26 -0
- package/dist/libs/tesouro-embedded-components-react/card-details-widget/feature/dist/index11.js +63 -0
- package/dist/libs/tesouro-embedded-components-react/card-details-widget/feature/dist/index12.js +79 -0
- package/dist/libs/tesouro-embedded-components-react/card-details-widget/feature/dist/index13.js +219 -0
- package/dist/libs/tesouro-embedded-components-react/card-details-widget/feature/dist/index3.js +18 -2
- package/dist/libs/tesouro-embedded-components-react/card-details-widget/feature/dist/index4.js +29 -28
- package/dist/libs/tesouro-embedded-components-react/card-details-widget/feature/dist/index5.js +3 -0
- package/dist/libs/tesouro-embedded-components-react/card-details-widget/feature/dist/index6.js +33 -19
- package/dist/libs/tesouro-embedded-components-react/card-details-widget/feature/dist/index7.js +17 -102
- package/dist/libs/tesouro-embedded-components-react/card-details-widget/feature/dist/index8.js +14 -181
- package/dist/libs/tesouro-embedded-components-react/card-details-widget/feature/dist/index9.js +113 -0
- package/dist/libs/tesouro-embedded-components-react/card-details-widget/ui/dist/lib/ActivateCardPanel/ActivateCardPanel.js +58 -55
- package/dist/libs/tesouro-embedded-components-react/card-details-widget/ui/dist/lib/ActivateCardPanel/ActivateCardSuccessView.js +12 -13
- package/dist/libs/tesouro-embedded-components-react/card-details-widget/ui/dist/lib/CardDetailsPanel/CardCredentialsFace.js +27 -24
- package/dist/libs/tesouro-embedded-components-react/card-details-widget/ui/dist/lib/CardDetailsPanel/CardDetailsHeader.js +26 -27
- package/dist/libs/tesouro-embedded-components-react/card-details-widget/ui/dist/lib/CardDetailsPanel/CardDetailsPanel.js +140 -110
- package/dist/libs/tesouro-embedded-components-react/card-details-widget/ui/dist/lib/CardDetailsPanel/CardFace.js +29 -19
- package/dist/libs/tesouro-embedded-components-react/card-details-widget/ui/dist/lib/CardDetailsPanel/CardFaceFlip.js +16 -17
- package/dist/libs/tesouro-embedded-components-react/card-details-widget/ui/dist/lib/CardDetailsPanel/DetailCopyRow.js +4 -4
- package/dist/libs/tesouro-embedded-components-react/card-details-widget/ui/dist/lib/CardDetailsPanel/NicknameRow.js +65 -0
- package/dist/libs/tesouro-embedded-components-react/card-details-widget/ui/dist/lib/CardDetailsPanel/labels.js +23 -0
- package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/index9.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +22 -22
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js +165 -151
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/sdk.gen.js +164 -132
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
- package/package.json +1 -1
- package/dist/libs/tesouro-embedded-components-react/card-details-widget/ui/dist/lib/CardDetailsPanel/testIds.js +0 -14
package/dist/libs/tesouro-embedded-components-react/card-details-widget/feature/dist/index8.js
CHANGED
|
@@ -2,187 +2,20 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
"use client";
|
|
4
4
|
"use client";
|
|
5
|
-
import {
|
|
6
|
-
import { EmbeddedToaster as t } from "../../../shared/ui/dist/lib/EmbeddedToaster.js";
|
|
7
|
-
import "../../../shared/ui/dist/index.js";
|
|
8
|
-
import { useAnalyticsTrack as n } from "../../../shared/feature/dist/lib/analytics/hooks.js";
|
|
9
|
-
import { WidgetProvider as r } from "../../../shared/feature/dist/lib/WidgetProvider/WidgetProvider.js";
|
|
10
|
-
import { useRefetchWidget as i, useWidgetConfig as a, useWidgetError as o } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
|
|
11
|
-
import { CardProgram as s } from "../../../shared/feature/dist/lib/card/cardProgram.js";
|
|
12
|
-
import "../../../shared/feature/dist/index.js";
|
|
13
|
-
import { resolveCardDetailsFeatureLabels as c } from "./index5.js";
|
|
14
|
-
import { CardDetailsWidgetAnalyticsEvent as l, WIDGET_NAME as u } from "./index2.js";
|
|
15
|
-
import { copyTextToClipboard as d, formatCardNumber as f, formatExpirationDate as p } from "./index3.js";
|
|
16
|
-
import { CardProgramValidity as m, resolveCanRevealCredentials as h, resolveCardDetailsPanelState as ee, resolveCardDetailsPresentation as te, resolveCardDetailsRevealState as ne, resolveCardProgramValidity as re } from "./index4.js";
|
|
17
|
-
import { useCreditCardDetailsQuery as ie } from "../../data-access/dist/index6.js";
|
|
18
|
-
import { useDebitCardCredentialsQuery as g } from "../../data-access/dist/index7.js";
|
|
19
|
-
import { useDebitCardDetailsQuery as _ } from "../../data-access/dist/index8.js";
|
|
20
|
-
import "../../data-access/dist/index.js";
|
|
21
|
-
import { CardDetailsPanel as ae } from "../../ui/dist/lib/CardDetailsPanel/CardDetailsPanel.js";
|
|
22
|
-
import { ActivateCardPanel as v } from "../../ui/dist/lib/ActivateCardPanel/ActivateCardPanel.js";
|
|
23
|
-
import "../../ui/dist/index.js";
|
|
24
|
-
import { useActivateCard as y } from "./index7.js";
|
|
25
|
-
import { useCallback as b, useEffect as x, useMemo as S, useState as C } from "react";
|
|
26
|
-
import { Fragment as w, jsx as T, jsxs as oe } from "react/jsx-runtime";
|
|
5
|
+
import { useCallback as e, useRef as t, useState as n } from "react";
|
|
27
6
|
//#region ../../libs/tesouro-embedded-components-react/card-details-widget/feature/dist/index8.js
|
|
28
|
-
function
|
|
29
|
-
let
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
programValidity: F,
|
|
41
|
-
isNotFound: H,
|
|
42
|
-
isError: !!M || V,
|
|
43
|
-
hasCard: !!B
|
|
44
|
-
});
|
|
45
|
-
x(() => {
|
|
46
|
-
if (F === m.Supported) return;
|
|
47
|
-
let e = `"${s.Credit}" or "${s.Debit}"`;
|
|
48
|
-
console.error(F === m.Missing ? `[CardDetailsWidget] cardProgram is required and was not set. Pass ${e} — it selects which card program to read, so there is no default. No card was fetched.` : `[CardDetailsWidget] cardProgram must be ${e}, received ${JSON.stringify(u)}. No card was fetched.`);
|
|
49
|
-
}, [u, F]);
|
|
50
|
-
let [le, G] = C(), K = le === r;
|
|
51
|
-
x(() => {
|
|
52
|
-
G(void 0);
|
|
53
|
-
}, [r]);
|
|
54
|
-
let q = h({
|
|
55
|
-
panelState: W,
|
|
56
|
-
cardProgram: u,
|
|
57
|
-
cardStatus: B?.cardStatus
|
|
58
|
-
});
|
|
59
|
-
x(() => {
|
|
60
|
-
K && !q && G(void 0);
|
|
61
|
-
}, [K, q]);
|
|
62
|
-
let J = g({
|
|
63
|
-
cardId: r,
|
|
64
|
-
enabled: q && K
|
|
65
|
-
}), Y = ne({
|
|
66
|
-
isRevealRequested: K,
|
|
67
|
-
isError: J.isError,
|
|
68
|
-
hasCredentials: !!J.data
|
|
69
|
-
}), X = S(() => W === "loaded" && B ? te({
|
|
70
|
-
card: B,
|
|
71
|
-
cardProgram: u,
|
|
72
|
-
labels: P
|
|
73
|
-
}) : void 0, [
|
|
74
|
-
B,
|
|
75
|
-
u,
|
|
76
|
-
P,
|
|
77
|
-
W
|
|
78
|
-
]), ue = b(async (t) => {
|
|
79
|
-
await d(t) && (e.success(P.copySuccessToast), j(l.ValueCopied));
|
|
80
|
-
}, [P.copySuccessToast, j]), Z = y({
|
|
81
|
-
cardId: r,
|
|
82
|
-
cardProgram: u,
|
|
83
|
-
card: W === "loaded" ? B : void 0,
|
|
84
|
-
scopes: ce?.scopes,
|
|
85
|
-
conflictToast: P.activationConflictToast
|
|
86
|
-
}), { refetch: Q } = J, de = b(() => {
|
|
87
|
-
if (K) {
|
|
88
|
-
Q();
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
91
|
-
G(r);
|
|
92
|
-
}, [
|
|
93
|
-
r,
|
|
94
|
-
K,
|
|
95
|
-
Q
|
|
96
|
-
]), fe = b(() => {
|
|
97
|
-
G(void 0);
|
|
98
|
-
}, []), pe = b(() => {
|
|
99
|
-
G(void 0), E?.();
|
|
100
|
-
}, [E]), me = S(() => J.isForbidden ? {
|
|
101
|
-
...D,
|
|
102
|
-
credentials: {
|
|
103
|
-
...D?.credentials,
|
|
104
|
-
errorDescription: P.revealNotPermittedDescription
|
|
105
|
-
}
|
|
106
|
-
} : D, [
|
|
107
|
-
J.isForbidden,
|
|
108
|
-
D,
|
|
109
|
-
P.revealNotPermittedDescription
|
|
110
|
-
]), $ = S(() => {
|
|
111
|
-
if (!(Y !== "revealed" || !J.data)) return {
|
|
112
|
-
cardNumber: f(J.data.pan),
|
|
113
|
-
expirationDate: p(J.data.expirationDate),
|
|
114
|
-
securityCode: J.data.cvv
|
|
115
|
-
};
|
|
116
|
-
}, [J.data, Y]), he = b(() => {
|
|
117
|
-
if (M) {
|
|
118
|
-
N();
|
|
119
|
-
return;
|
|
120
|
-
}
|
|
121
|
-
U();
|
|
122
|
-
}, [
|
|
123
|
-
U,
|
|
124
|
-
N,
|
|
125
|
-
M
|
|
126
|
-
]);
|
|
127
|
-
return /* @__PURE__ */ oe(w, { children: [/* @__PURE__ */ T(t, {}), Z.isOpen ? /* @__PURE__ */ T(v, {
|
|
128
|
-
labels: se,
|
|
129
|
-
state: Z.state,
|
|
130
|
-
values: Z.values,
|
|
131
|
-
errors: Z.errors,
|
|
132
|
-
isSubmitDisabled: Z.isSubmitDisabled,
|
|
133
|
-
onValuesChange: Z.onValuesChange,
|
|
134
|
-
onSubmit: Z.onSubmit,
|
|
135
|
-
onClose: Z.close,
|
|
136
|
-
bankLogoSrc: k,
|
|
137
|
-
bankLogoAlt: A,
|
|
138
|
-
cardholderName: X?.cardholderName,
|
|
139
|
-
maskedCardNumber: X?.maskedCardNumber,
|
|
140
|
-
programLabel: X?.programLabel
|
|
141
|
-
}) : /* @__PURE__ */ T(ae, {
|
|
142
|
-
labels: me,
|
|
143
|
-
state: W,
|
|
144
|
-
nickname: X?.nickname,
|
|
145
|
-
statusLabel: X?.statusLabel,
|
|
146
|
-
statusTone: X?.statusTone,
|
|
147
|
-
formFactorLabel: X?.formFactorLabel,
|
|
148
|
-
onClose: E ? pe : void 0,
|
|
149
|
-
bankLogoSrc: k,
|
|
150
|
-
bankLogoAlt: A,
|
|
151
|
-
cardholderName: X?.cardholderName,
|
|
152
|
-
maskedCardNumber: X?.maskedCardNumber,
|
|
153
|
-
programLabel: X?.programLabel,
|
|
154
|
-
allowedCategories: X?.allowedCategories,
|
|
155
|
-
spendLimitLabels: X?.spendLimitLabels,
|
|
156
|
-
perTransactionMaxLabel: X?.perTransactionMaxLabel,
|
|
157
|
-
onCopy: ue,
|
|
158
|
-
onActivate: Z.canActivate ? Z.open : void 0,
|
|
159
|
-
onViewCard: q ? de : void 0,
|
|
160
|
-
onHideCard: q ? fe : void 0,
|
|
161
|
-
revealState: Y,
|
|
162
|
-
revealedCardNumber: $?.cardNumber,
|
|
163
|
-
revealedExpirationDate: $?.expirationDate,
|
|
164
|
-
revealedSecurityCode: $?.securityCode,
|
|
165
|
-
onRetry: F === m.Supported ? he : void 0
|
|
166
|
-
})] });
|
|
167
|
-
}
|
|
168
|
-
function D({ baseUrl: e, widgetToken: t, organizationId: n, configClient: i, gatewayRouting: a, linkComponent: o, implementation: s, uiFramework: c, errorFallback: l, onError: d, analytics: f, disclosuresAcceptance: p, providerLabels: m, ...h }) {
|
|
169
|
-
return /* @__PURE__ */ T(r, {
|
|
170
|
-
widgetName: u,
|
|
171
|
-
baseUrl: e,
|
|
172
|
-
widgetToken: t,
|
|
173
|
-
organizationId: n,
|
|
174
|
-
configClient: i,
|
|
175
|
-
gatewayRouting: a,
|
|
176
|
-
linkComponent: o,
|
|
177
|
-
implementation: s,
|
|
178
|
-
uiFramework: c,
|
|
179
|
-
errorFallback: l,
|
|
180
|
-
onError: d,
|
|
181
|
-
analytics: f,
|
|
182
|
-
disclosuresAcceptance: p,
|
|
183
|
-
providerLabels: m,
|
|
184
|
-
children: /* @__PURE__ */ T(E, { ...h })
|
|
185
|
-
});
|
|
7
|
+
function r({ id: r, reset: i }) {
|
|
8
|
+
let a = t(null), [o, s] = n(r);
|
|
9
|
+
return r !== o && (s(r), a.current = null, i()), {
|
|
10
|
+
claim: e(() => {
|
|
11
|
+
let e = Symbol("card request");
|
|
12
|
+
return a.current = e, e;
|
|
13
|
+
}, []),
|
|
14
|
+
release: e(() => {
|
|
15
|
+
a.current = null;
|
|
16
|
+
}, []),
|
|
17
|
+
isStale: e((e) => a.current !== e, [])
|
|
18
|
+
};
|
|
186
19
|
}
|
|
187
20
|
//#endregion
|
|
188
|
-
export {
|
|
21
|
+
export { r as useIdScopedRequest };
|
package/dist/libs/tesouro-embedded-components-react/card-details-widget/feature/dist/index9.js
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
"use client";
|
|
4
|
+
"use client";
|
|
5
|
+
import { toast as e } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
|
|
6
|
+
import { isApiConflictError as t } from "../../../shared/data-access/dist/lib/isApiConflictError.js";
|
|
7
|
+
import { isApiUnprocessableError as n } from "../../../shared/data-access/dist/lib/isApiUnprocessableError.js";
|
|
8
|
+
import "../../../shared/data-access/dist/index.js";
|
|
9
|
+
import "../../../shared/ui/dist/index.js";
|
|
10
|
+
import { CardProgram as r } from "../../../shared/feature/dist/lib/card/cardProgram.js";
|
|
11
|
+
import "../../../shared/feature/dist/index.js";
|
|
12
|
+
import { canActivateCard as i, toCardFaceExpirationDate as a } from "./index7.js";
|
|
13
|
+
import { useIdScopedRequest as o } from "./index8.js";
|
|
14
|
+
import { useActivateCreditCardMutation as s, useActivateDebitCardMutation as c } from "../../data-access/dist/index4.js";
|
|
15
|
+
import { useVerifyDebitCardMutation as l } from "../../data-access/dist/index11.js";
|
|
16
|
+
import "../../data-access/dist/index.js";
|
|
17
|
+
import { ActivateCardFormError as u, EMPTY_ACTIVATE_CARD_FORM_VALUES as d, validateActivateCardForm as f } from "../../ui/dist/lib/ActivateCardPanel/validation.js";
|
|
18
|
+
import "../../ui/dist/index.js";
|
|
19
|
+
import { useCallback as p, useEffect as m, useMemo as h, useState as g } from "react";
|
|
20
|
+
//#region ../../libs/tesouro-embedded-components-react/card-details-widget/feature/dist/index9.js
|
|
21
|
+
function _({ cardId: _, cardProgram: v, card: y, scopes: b, conflictToast: x }) {
|
|
22
|
+
let [S, C] = g(!1), [w, T] = g(d), [E, D] = g("idle"), [O, k] = g(!1), { claim: A, release: j, isStale: M } = o({
|
|
23
|
+
id: _,
|
|
24
|
+
reset: () => {
|
|
25
|
+
C(!1), T(d), D("idle"), k(!1);
|
|
26
|
+
}
|
|
27
|
+
}), { mutateAsync: N } = l(), { mutateAsync: P } = s(), { mutateAsync: F } = c(), I = i({
|
|
28
|
+
card: y,
|
|
29
|
+
cardProgram: v,
|
|
30
|
+
scopes: b
|
|
31
|
+
}), L = h(() => f(w), [w]), R = h(() => ({
|
|
32
|
+
...L.errors,
|
|
33
|
+
...O ? { form: u.VerificationRejected } : {}
|
|
34
|
+
}), [O, L.errors]), z = p(() => {
|
|
35
|
+
C(!0);
|
|
36
|
+
}, []), B = p(() => {
|
|
37
|
+
C(!1), j(), T(d), D("idle"), k(!1);
|
|
38
|
+
}, [j]), V = p((e) => {
|
|
39
|
+
T((t) => ({
|
|
40
|
+
...t,
|
|
41
|
+
...e
|
|
42
|
+
}));
|
|
43
|
+
}, []);
|
|
44
|
+
m(() => {
|
|
45
|
+
!S || I || E !== "succeeded" && E !== "submitting" && (e.error(x), B());
|
|
46
|
+
}, [
|
|
47
|
+
I,
|
|
48
|
+
B,
|
|
49
|
+
x,
|
|
50
|
+
S,
|
|
51
|
+
E
|
|
52
|
+
]);
|
|
53
|
+
let H = p(async () => {
|
|
54
|
+
if (!I || !f(w).isValid) return;
|
|
55
|
+
let i = v === r.Credit, o = v === r.Debit;
|
|
56
|
+
if (!i && !o) return;
|
|
57
|
+
D("submitting"), k(!1);
|
|
58
|
+
let s = A();
|
|
59
|
+
try {
|
|
60
|
+
if (o) {
|
|
61
|
+
let e = a(w.expirationDate);
|
|
62
|
+
if (!e) {
|
|
63
|
+
D("errored");
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
await N({
|
|
67
|
+
path: { id: _ },
|
|
68
|
+
body: {
|
|
69
|
+
expirationDate: e,
|
|
70
|
+
cvv: w.securityCode
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
if (M(s) || (i ? await P({ path: { id: _ } }) : await F({ path: { id: _ } }), M(s))) return;
|
|
75
|
+
D("succeeded");
|
|
76
|
+
} catch (r) {
|
|
77
|
+
if (M(s)) return;
|
|
78
|
+
if (t(r)) {
|
|
79
|
+
e.error(x), B();
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
n(r) && k(!0), D("errored");
|
|
83
|
+
}
|
|
84
|
+
}, [
|
|
85
|
+
P,
|
|
86
|
+
F,
|
|
87
|
+
I,
|
|
88
|
+
_,
|
|
89
|
+
v,
|
|
90
|
+
A,
|
|
91
|
+
B,
|
|
92
|
+
x,
|
|
93
|
+
M,
|
|
94
|
+
w,
|
|
95
|
+
N
|
|
96
|
+
]), U = p(() => {
|
|
97
|
+
H();
|
|
98
|
+
}, [H]);
|
|
99
|
+
return {
|
|
100
|
+
canActivate: I,
|
|
101
|
+
isOpen: S,
|
|
102
|
+
open: z,
|
|
103
|
+
close: B,
|
|
104
|
+
values: w,
|
|
105
|
+
errors: R,
|
|
106
|
+
state: E,
|
|
107
|
+
isSubmitDisabled: !I || !L.isValid || E === "submitting",
|
|
108
|
+
onValuesChange: V,
|
|
109
|
+
onSubmit: U
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
//#endregion
|
|
113
|
+
export { _ as useActivateCard };
|
|
@@ -5,133 +5,136 @@
|
|
|
5
5
|
import { Button as e, Input as t, Label as n, Separator as r, Spinner as i, Tooltip as a, TooltipContent as o, TooltipProvider as s, TooltipTrigger as c, cn as l } from "../../../../../../../packages/shared-ui-shadcn/dist/index.js";
|
|
6
6
|
import { InlineErrorAlert as u } from "../../../../../shared/ui/dist/lib/InlineErrorAlert/InlineErrorAlert.js";
|
|
7
7
|
import "../../../../../shared/ui/dist/index.js";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import { ChevronRightIcon as T, HelpCircleIcon as E, XIcon as D } from "lucide-react";
|
|
8
|
+
import { CardFace as d } from "../CardDetailsPanel/CardFace.js";
|
|
9
|
+
import { resolveActivateCardPanelLabels as f } from "./labels.js";
|
|
10
|
+
import { ActivateCardFieldError as p, ActivateCardFormError as m, EMPTY_ACTIVATE_CARD_FORM_VALUES as h, formatDigitsInput as g, formatExpirationDateInput as _ } from "./validation.js";
|
|
11
|
+
import { ActivateCardSuccessView as v } from "./ActivateCardSuccessView.js";
|
|
12
|
+
import { FieldError as y } from "./FieldError.js";
|
|
13
|
+
import { useId as b, useMemo as x } from "react";
|
|
14
|
+
import { jsx as S, jsxs as C } from "react/jsx-runtime";
|
|
15
|
+
import { ChevronRightIcon as w, HelpCircleIcon as T, XIcon as E } from "lucide-react";
|
|
17
16
|
//#region ../../libs/tesouro-embedded-components-react/card-details-widget/ui/dist/lib/ActivateCardPanel/ActivateCardPanel.js
|
|
18
|
-
var
|
|
19
|
-
function
|
|
17
|
+
var D = {};
|
|
18
|
+
function O(e, t) {
|
|
20
19
|
switch (e) {
|
|
21
|
-
case
|
|
22
|
-
case
|
|
23
|
-
case
|
|
20
|
+
case p.ImpossibleMonth: return t.impossibleMonth;
|
|
21
|
+
case p.PastExpiration: return t.pastExpiration;
|
|
22
|
+
case m.VerificationRejected: return t.verificationRejected;
|
|
24
23
|
default: return;
|
|
25
24
|
}
|
|
26
25
|
}
|
|
27
|
-
function
|
|
28
|
-
let H =
|
|
29
|
-
return /* @__PURE__ */
|
|
30
|
-
"data-testid":
|
|
26
|
+
function k({ labels: p, state: m = "idle", values: k = h, onValuesChange: A, errors: j = D, isSubmitDisabled: M = !0, onSubmit: N, onClose: P, bankLogoSrc: F, bankLogoAlt: I, cardholderName: L, maskedCardNumber: R, programLabel: z, testIds: B, className: V }) {
|
|
27
|
+
let H = x(() => f(p), [p]), U = b(), W = b(), G = b(), K = b(), q = m === "submitting", J = O(j.expirationDate, H.validation), Y = O(j.form, H.validation);
|
|
28
|
+
return /* @__PURE__ */ C("div", {
|
|
29
|
+
"data-testid": B?.root,
|
|
31
30
|
className: l("ttw:flex ttw:w-full ttw:flex-col", V),
|
|
32
|
-
children: [/* @__PURE__ */
|
|
31
|
+
children: [/* @__PURE__ */ C("div", {
|
|
33
32
|
className: "ttw:flex ttw:items-start ttw:gap-1.5 ttw:px-4 ttw:pt-4 ttw:pb-3",
|
|
34
|
-
children: [/* @__PURE__ */
|
|
33
|
+
children: [/* @__PURE__ */ S("h2", {
|
|
35
34
|
className: "ttw:min-w-0 ttw:flex-1 ttw:text-2xl ttw:font-semibold ttw:tracking-[-0.6px] ttw:text-foreground",
|
|
36
35
|
children: H.header.title
|
|
37
|
-
}),
|
|
36
|
+
}), P ? /* @__PURE__ */ S(e, {
|
|
38
37
|
type: "button",
|
|
39
38
|
variant: "ghost",
|
|
40
39
|
size: "icon",
|
|
41
40
|
className: "ttw:size-8 ttw:shrink-0",
|
|
42
41
|
"aria-label": H.header.closeAriaLabel,
|
|
43
|
-
onClick:
|
|
44
|
-
children: /* @__PURE__ */
|
|
42
|
+
onClick: P,
|
|
43
|
+
children: /* @__PURE__ */ S(E, { className: "ttw:size-4" })
|
|
45
44
|
}) : null]
|
|
46
|
-
}),
|
|
45
|
+
}), m === "succeeded" ? /* @__PURE__ */ S(v, {
|
|
46
|
+
labels: H.status,
|
|
47
|
+
testIds: B?.successView
|
|
48
|
+
}) : /* @__PURE__ */ C("form", {
|
|
47
49
|
noValidate: !0,
|
|
48
50
|
onSubmit: (e) => {
|
|
49
|
-
e.preventDefault(), !(
|
|
51
|
+
e.preventDefault(), !(M || q) && N?.();
|
|
50
52
|
},
|
|
51
53
|
className: "ttw:flex ttw:flex-col ttw:gap-4 ttw:px-4 ttw:pb-4",
|
|
52
54
|
children: [
|
|
53
|
-
/* @__PURE__ */
|
|
55
|
+
/* @__PURE__ */ S("div", {
|
|
54
56
|
className: "ttw:flex ttw:justify-center",
|
|
55
|
-
children: /* @__PURE__ */
|
|
56
|
-
bankLogoSrc:
|
|
57
|
-
bankLogoAlt:
|
|
58
|
-
cardholderName:
|
|
59
|
-
maskedCardNumber:
|
|
60
|
-
programLabel:
|
|
57
|
+
children: /* @__PURE__ */ S(d, {
|
|
58
|
+
bankLogoSrc: F,
|
|
59
|
+
bankLogoAlt: I ?? H.cardFace.bankLogoAlt,
|
|
60
|
+
cardholderName: L ?? "",
|
|
61
|
+
maskedCardNumber: R ?? "",
|
|
62
|
+
programLabel: z ?? "",
|
|
63
|
+
testIds: B?.cardFace
|
|
61
64
|
})
|
|
62
65
|
}),
|
|
63
|
-
/* @__PURE__ */
|
|
66
|
+
/* @__PURE__ */ C("div", {
|
|
64
67
|
className: "ttw:flex ttw:flex-col ttw:gap-1.5",
|
|
65
68
|
children: [
|
|
66
|
-
/* @__PURE__ */
|
|
69
|
+
/* @__PURE__ */ S(n, {
|
|
67
70
|
htmlFor: U,
|
|
68
71
|
className: "ttw:text-sm ttw:font-medium",
|
|
69
72
|
children: H.fields.expirationDate
|
|
70
73
|
}),
|
|
71
|
-
/* @__PURE__ */
|
|
74
|
+
/* @__PURE__ */ S(t, {
|
|
72
75
|
id: U,
|
|
73
|
-
value:
|
|
76
|
+
value: k.expirationDate,
|
|
74
77
|
placeholder: H.fields.expirationDatePlaceholder,
|
|
75
78
|
disabled: q,
|
|
76
79
|
inputMode: "numeric",
|
|
77
80
|
autoComplete: "off",
|
|
78
81
|
"aria-invalid": J ? !0 : void 0,
|
|
79
82
|
"aria-describedby": J ? W : void 0,
|
|
80
|
-
onChange: (e) =>
|
|
83
|
+
onChange: (e) => A?.({ expirationDate: _(e.target.value) })
|
|
81
84
|
}),
|
|
82
|
-
/* @__PURE__ */
|
|
85
|
+
/* @__PURE__ */ S(y, {
|
|
83
86
|
id: W,
|
|
84
87
|
message: J
|
|
85
88
|
})
|
|
86
89
|
]
|
|
87
90
|
}),
|
|
88
|
-
/* @__PURE__ */
|
|
91
|
+
/* @__PURE__ */ C("div", {
|
|
89
92
|
className: "ttw:flex ttw:flex-col ttw:gap-1.5",
|
|
90
93
|
children: [
|
|
91
|
-
/* @__PURE__ */
|
|
94
|
+
/* @__PURE__ */ C("div", {
|
|
92
95
|
className: "ttw:flex ttw:items-center ttw:gap-1.5",
|
|
93
|
-
children: [/* @__PURE__ */
|
|
96
|
+
children: [/* @__PURE__ */ S(n, {
|
|
94
97
|
htmlFor: G,
|
|
95
98
|
className: "ttw:text-sm ttw:font-medium",
|
|
96
99
|
children: H.fields.securityCode
|
|
97
|
-
}), /* @__PURE__ */
|
|
100
|
+
}), /* @__PURE__ */ S(s, { children: /* @__PURE__ */ C(a, { children: [/* @__PURE__ */ S(c, {
|
|
98
101
|
type: "button",
|
|
99
102
|
className: "ttw:inline-flex ttw:shrink-0 ttw:cursor-help ttw:text-muted-foreground",
|
|
100
103
|
"aria-label": H.fields.securityCodeInfoAriaLabel,
|
|
101
|
-
children: /* @__PURE__ */
|
|
102
|
-
}), /* @__PURE__ */
|
|
104
|
+
children: /* @__PURE__ */ S(T, { className: "ttw:size-4" })
|
|
105
|
+
}), /* @__PURE__ */ S(o, {
|
|
103
106
|
className: "ttw:max-w-xs",
|
|
104
107
|
children: H.fields.securityCodeInfo
|
|
105
108
|
})] }) })]
|
|
106
109
|
}),
|
|
107
|
-
/* @__PURE__ */
|
|
110
|
+
/* @__PURE__ */ S(t, {
|
|
108
111
|
id: G,
|
|
109
|
-
value:
|
|
112
|
+
value: k.securityCode,
|
|
110
113
|
placeholder: H.fields.securityCodePlaceholder,
|
|
111
114
|
"aria-describedby": K,
|
|
112
115
|
disabled: q,
|
|
113
116
|
inputMode: "numeric",
|
|
114
117
|
autoComplete: "off",
|
|
115
118
|
maxLength: 4,
|
|
116
|
-
onChange: (e) =>
|
|
119
|
+
onChange: (e) => A?.({ securityCode: g(e.target.value, 4) })
|
|
117
120
|
}),
|
|
118
|
-
/* @__PURE__ */
|
|
121
|
+
/* @__PURE__ */ S("span", {
|
|
119
122
|
id: K,
|
|
120
123
|
className: "ttw:sr-only",
|
|
121
124
|
children: H.fields.securityCodeInfo
|
|
122
125
|
})
|
|
123
126
|
]
|
|
124
127
|
}),
|
|
125
|
-
/* @__PURE__ */
|
|
126
|
-
|
|
127
|
-
/* @__PURE__ */
|
|
128
|
+
/* @__PURE__ */ S(r, {}),
|
|
129
|
+
m === "errored" || Y ? /* @__PURE__ */ S(u, { children: Y ?? H.status.errorDescription }) : null,
|
|
130
|
+
/* @__PURE__ */ C(e, {
|
|
128
131
|
type: "submit",
|
|
129
132
|
className: "ttw:w-full",
|
|
130
|
-
disabled:
|
|
133
|
+
disabled: M || q,
|
|
131
134
|
children: [
|
|
132
|
-
q ? /* @__PURE__ */
|
|
135
|
+
q ? /* @__PURE__ */ S(i, { "aria-label": H.status.submittingAriaLabel }) : null,
|
|
133
136
|
H.status.submit,
|
|
134
|
-
/* @__PURE__ */
|
|
137
|
+
/* @__PURE__ */ S(w, { className: "ttw:size-4" })
|
|
135
138
|
]
|
|
136
139
|
})
|
|
137
140
|
]
|
|
@@ -139,4 +142,4 @@ function A({ labels: m, state: h = "idle", values: A = g, onValuesChange: j, err
|
|
|
139
142
|
});
|
|
140
143
|
}
|
|
141
144
|
//#endregion
|
|
142
|
-
export {
|
|
145
|
+
export { k as ActivateCardPanel };
|
|
@@ -1,27 +1,26 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { CheckIcon as r } from "lucide-react";
|
|
1
|
+
import { jsx as e, jsxs as t } from "react/jsx-runtime";
|
|
2
|
+
import { CheckIcon as n } from "lucide-react";
|
|
4
3
|
//#region ../../libs/tesouro-embedded-components-react/card-details-widget/ui/dist/lib/ActivateCardPanel/ActivateCardSuccessView.js
|
|
5
|
-
function
|
|
6
|
-
return /* @__PURE__ */
|
|
7
|
-
"data-testid":
|
|
4
|
+
function r({ labels: r, testIds: i }) {
|
|
5
|
+
return /* @__PURE__ */ t("div", {
|
|
6
|
+
"data-testid": i?.root,
|
|
8
7
|
className: "ttw:flex ttw:flex-col ttw:items-center ttw:gap-3 ttw:px-4 ttw:py-10 ttw:text-center",
|
|
9
8
|
children: [
|
|
10
|
-
/* @__PURE__ */
|
|
9
|
+
/* @__PURE__ */ e("div", {
|
|
11
10
|
"aria-hidden": "true",
|
|
12
11
|
className: "ttw:flex ttw:size-10 ttw:items-center ttw:justify-center ttw:rounded-lg ttw:bg-emerald-700 ttw:text-white",
|
|
13
|
-
children: /* @__PURE__ */
|
|
12
|
+
children: /* @__PURE__ */ e(n, { className: "ttw:size-5" })
|
|
14
13
|
}),
|
|
15
|
-
/* @__PURE__ */
|
|
14
|
+
/* @__PURE__ */ e("h3", {
|
|
16
15
|
className: "ttw:text-lg ttw:font-semibold ttw:text-foreground",
|
|
17
|
-
children:
|
|
16
|
+
children: r.successTitle
|
|
18
17
|
}),
|
|
19
|
-
/* @__PURE__ */
|
|
18
|
+
/* @__PURE__ */ e("p", {
|
|
20
19
|
className: "ttw:max-w-sm ttw:text-sm ttw:text-muted-foreground",
|
|
21
|
-
children:
|
|
20
|
+
children: r.successDescription
|
|
22
21
|
})
|
|
23
22
|
]
|
|
24
23
|
});
|
|
25
24
|
}
|
|
26
25
|
//#endregion
|
|
27
|
-
export {
|
|
26
|
+
export { r as ActivateCardSuccessView };
|
|
@@ -1,33 +1,36 @@
|
|
|
1
1
|
import { cn as e } from "../../../../../../../packages/shared-ui-shadcn/dist/index.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
2
|
+
import { CARD_FACE_SURFACE_CLASS_NAME as t } from "./cardFaceSurface.js";
|
|
3
|
+
import { CardFaceGlow as n } from "./CardFaceGlow.js";
|
|
4
|
+
import { CardCredentialRow as r } from "./CardCredentialRow.js";
|
|
5
|
+
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
7
6
|
//#region ../../libs/tesouro-embedded-components-react/card-details-widget/ui/dist/lib/CardDetailsPanel/CardCredentialsFace.js
|
|
8
|
-
function
|
|
9
|
-
return /* @__PURE__ */
|
|
10
|
-
"data-testid":
|
|
11
|
-
className: e(
|
|
7
|
+
function o({ labels: o, cardNumber: s, expirationDate: c, securityCode: l, isLocked: u, onCopy: d, testIds: f, className: p }) {
|
|
8
|
+
return /* @__PURE__ */ a("div", {
|
|
9
|
+
"data-testid": f?.root,
|
|
10
|
+
className: e(t, "ttw:justify-center ttw:gap-4", p),
|
|
12
11
|
children: [
|
|
13
|
-
/* @__PURE__ */
|
|
14
|
-
/* @__PURE__ */
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
/* @__PURE__ */ i(n, {}),
|
|
13
|
+
u ? /* @__PURE__ */ i("div", {
|
|
14
|
+
"data-testid": f?.lockedOverlay,
|
|
15
|
+
className: "ttw:pointer-events-none ttw:absolute ttw:inset-0 ttw:bg-black/55"
|
|
16
|
+
}) : null,
|
|
17
|
+
/* @__PURE__ */ i(r, {
|
|
18
|
+
label: o.cardNumber,
|
|
19
|
+
value: s,
|
|
20
|
+
copyAriaLabel: o.copyCardNumberAriaLabel,
|
|
18
21
|
onCopy: d
|
|
19
22
|
}),
|
|
20
|
-
/* @__PURE__ */
|
|
23
|
+
/* @__PURE__ */ a("div", {
|
|
21
24
|
className: "ttw:relative ttw:grid ttw:grid-cols-2 ttw:gap-3",
|
|
22
|
-
children: [/* @__PURE__ */
|
|
23
|
-
label:
|
|
24
|
-
value:
|
|
25
|
-
copyAriaLabel:
|
|
25
|
+
children: [/* @__PURE__ */ i(r, {
|
|
26
|
+
label: o.expirationDate,
|
|
27
|
+
value: c,
|
|
28
|
+
copyAriaLabel: o.copyExpirationDateAriaLabel,
|
|
26
29
|
onCopy: d
|
|
27
|
-
}), /* @__PURE__ */
|
|
28
|
-
label:
|
|
29
|
-
value:
|
|
30
|
-
copyAriaLabel:
|
|
30
|
+
}), /* @__PURE__ */ i(r, {
|
|
31
|
+
label: o.securityCode,
|
|
32
|
+
value: l,
|
|
33
|
+
copyAriaLabel: o.copySecurityCodeAriaLabel,
|
|
31
34
|
onCopy: d
|
|
32
35
|
})]
|
|
33
36
|
})
|
|
@@ -35,4 +38,4 @@ function s({ labels: s, cardNumber: c, expirationDate: l, securityCode: u, onCop
|
|
|
35
38
|
});
|
|
36
39
|
}
|
|
37
40
|
//#endregion
|
|
38
|
-
export {
|
|
41
|
+
export { o as CardCredentialsFace };
|