@tesouro/embedded-components-react 0.5.18 → 0.5.19
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 +22 -21
- package/dist/index.css +18 -0
- package/dist/index.d.ts +29 -6
- package/dist/lib/CardDetailsWidget.d.ts +20 -2
- package/dist/lib/CreditCardsWidget.d.ts +29 -6
- package/dist/lib/DebitCardsWidget.d.ts +29 -6
- package/dist/lib/WidgetSuite.d.ts +29 -6
- package/dist/libs/tesouro-embedded-components-react/card-details-widget/feature/dist/index13.js +152 -149
- package/dist/libs/tesouro-embedded-components-react/card-details-widget/feature/dist/index3.js +8 -11
- package/dist/libs/tesouro-embedded-components-react/card-details-widget/feature/dist/index4.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/card-details-widget/feature/dist/index6.js +2 -0
- package/dist/libs/tesouro-embedded-components-react/card-details-widget/feature/dist/index7.js +4 -4
- package/dist/libs/tesouro-embedded-components-react/card-details-widget/feature/dist/index9.js +81 -79
- package/dist/libs/tesouro-embedded-components-react/card-details-widget/ui/dist/lib/ActivateCardPanel/ActivateCardPanel.js +39 -38
- package/dist/libs/tesouro-embedded-components-react/card-details-widget/ui/dist/lib/CardDetailsPanel/AddressLine.js +23 -0
- package/dist/libs/tesouro-embedded-components-react/card-details-widget/ui/dist/lib/CardDetailsPanel/CardDetailsPanel.js +142 -118
- package/dist/libs/tesouro-embedded-components-react/card-details-widget/ui/dist/lib/CardDetailsPanel/CardFace.js +24 -14
- package/dist/libs/tesouro-embedded-components-react/card-details-widget/ui/dist/lib/CardDetailsPanel/labels.js +4 -1
- package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/index9.js +1 -0
- package/dist/libs/tesouro-embedded-components-react/create-card-widget/ui/dist/lib/CreateCardWidget/CardControls/PerTransactionMaximumControl.js +17 -16
- package/dist/libs/tesouro-embedded-components-react/create-card-widget/ui/dist/lib/CreateCardWidget/CardControls/SpendLimitControl.js +25 -24
- package/dist/libs/tesouro-embedded-components-react/create-card-widget/ui/dist/lib/CreateCardWidget/CardControls/limitDecimalPlaces.js +7 -0
- package/dist/libs/tesouro-embedded-components-react/create-card-widget/ui/dist/lib/CreateCardWidget/SetupView.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/card/cardPresentation.js +1 -1
- package/package.json +1 -1
package/dist/libs/tesouro-embedded-components-react/card-details-widget/feature/dist/index13.js
CHANGED
|
@@ -7,201 +7,204 @@ import { EmbeddedToaster as t } from "../../../shared/ui/dist/lib/EmbeddedToaste
|
|
|
7
7
|
import "../../../shared/ui/dist/index.js";
|
|
8
8
|
import { useAnalyticsTrack as n } from "../../../shared/feature/dist/lib/analytics/hooks.js";
|
|
9
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
|
|
10
|
+
import { useRefetchWidget as i, useWidgetConfig as a, useWidgetError as o, useWidgetInitStaleForToken as s } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
|
|
11
|
+
import { CardProgram as c } from "../../../shared/feature/dist/lib/card/cardProgram.js";
|
|
12
12
|
import "../../../shared/feature/dist/index.js";
|
|
13
|
-
import { resolveCardDetailsFeatureLabels as
|
|
14
|
-
import { CardDetailsWidgetAnalyticsEvent as
|
|
15
|
-
import { copyTextToClipboard as
|
|
16
|
-
import { CardProgramValidity as
|
|
13
|
+
import { resolveCardDetailsFeatureLabels as l } from "./index5.js";
|
|
14
|
+
import { CardDetailsWidgetAnalyticsEvent as u, WIDGET_NAME as d } from "./index2.js";
|
|
15
|
+
import { copyTextToClipboard as f, formatCardNumber as p, formatExpirationDate as m } from "./index3.js";
|
|
16
|
+
import { CardProgramValidity as h, resolveCanRevealCredentials as ee, resolveCardDetailsPanelState as te, resolveCardDetailsPresentation as g, resolveCardDetailsRevealState as ne, resolveCardProgramValidity as re } from "./index4.js";
|
|
17
17
|
import { activateCardPanelTestIds as ie, cardDetailsPanelTestIds as ae } from "./index6.js";
|
|
18
18
|
import { useCreditCardDetailsQuery as oe } from "../../data-access/dist/index6.js";
|
|
19
19
|
import { useDebitCardCredentialsQuery as se } from "../../data-access/dist/index7.js";
|
|
20
|
-
import { useDebitCardDetailsQuery as
|
|
20
|
+
import { useDebitCardDetailsQuery as ce } from "../../data-access/dist/index8.js";
|
|
21
21
|
import "../../data-access/dist/index.js";
|
|
22
|
-
import { CardDetailsPanel as
|
|
23
|
-
import { ActivateCardPanel as
|
|
22
|
+
import { CardDetailsPanel as le } from "../../ui/dist/lib/CardDetailsPanel/CardDetailsPanel.js";
|
|
23
|
+
import { ActivateCardPanel as ue } from "../../ui/dist/lib/ActivateCardPanel/ActivateCardPanel.js";
|
|
24
24
|
import "../../ui/dist/index.js";
|
|
25
|
-
import { useActivateCard as
|
|
26
|
-
import { useCardLock as
|
|
27
|
-
import { useEditCardNickname as
|
|
28
|
-
import { useCallback as _, useEffect as v, useMemo as y, useState as
|
|
29
|
-
import { Fragment as
|
|
25
|
+
import { useActivateCard as de } from "./index9.js";
|
|
26
|
+
import { useCardLock as fe } from "./index11.js";
|
|
27
|
+
import { useEditCardNickname as pe } from "./index12.js";
|
|
28
|
+
import { useCallback as _, useEffect as v, useMemo as y, useState as b } from "react";
|
|
29
|
+
import { Fragment as me, jsx as x, jsxs as S } from "react/jsx-runtime";
|
|
30
30
|
//#region ../../libs/tesouro-embedded-components-react/card-details-widget/feature/dist/index13.js
|
|
31
|
-
function C({ cardId: r, cardProgram:
|
|
32
|
-
let
|
|
31
|
+
function C({ cardId: r, cardProgram: d, onClose: C, labels: w, activateLabels: he, featureLabels: T, cardArtSrc: E, bankLogoSrc: D, bankLogoAlt: O }) {
|
|
32
|
+
let k = n(), A = o(), j = i(), { initResponse: M } = a(), ge = s();
|
|
33
33
|
v(() => {
|
|
34
|
-
|
|
35
|
-
}, [
|
|
36
|
-
let
|
|
37
|
-
cardId: r,
|
|
38
|
-
enabled: P
|
|
39
|
-
}), L = g({
|
|
34
|
+
k(u.Mounted);
|
|
35
|
+
}, [k]);
|
|
36
|
+
let N = y(() => l(T), [T]), P = re(d), F = d === c.Credit, I = d === c.Debit, _e = oe({
|
|
40
37
|
cardId: r,
|
|
41
38
|
enabled: F
|
|
42
|
-
}),
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
39
|
+
}), ve = ce({
|
|
40
|
+
cardId: r,
|
|
41
|
+
enabled: I
|
|
42
|
+
}), { data: L, isError: ye, isNotFound: be, refetch: R } = F ? _e : ve, z = te({
|
|
43
|
+
programValidity: P,
|
|
44
|
+
isNotFound: be,
|
|
45
|
+
isError: !!A || ye,
|
|
46
|
+
hasCard: !!L
|
|
47
47
|
});
|
|
48
48
|
v(() => {
|
|
49
|
-
if (
|
|
50
|
-
let e = `"${
|
|
51
|
-
console.error(
|
|
52
|
-
}, [
|
|
53
|
-
let [
|
|
49
|
+
if (P === h.Supported) return;
|
|
50
|
+
let e = `"${c.Credit}" or "${c.Debit}"`;
|
|
51
|
+
console.error(P === h.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(d)}. No card was fetched.`);
|
|
52
|
+
}, [d, P]);
|
|
53
|
+
let [xe, B] = b(), V = xe === r;
|
|
54
54
|
v(() => {
|
|
55
|
-
|
|
55
|
+
B(void 0);
|
|
56
56
|
}, [r]);
|
|
57
|
-
let
|
|
58
|
-
panelState:
|
|
59
|
-
cardProgram:
|
|
60
|
-
cardStatus:
|
|
57
|
+
let H = ee({
|
|
58
|
+
panelState: z,
|
|
59
|
+
cardProgram: d,
|
|
60
|
+
cardStatus: L?.cardStatus
|
|
61
61
|
});
|
|
62
62
|
v(() => {
|
|
63
|
-
|
|
64
|
-
}, [
|
|
65
|
-
let
|
|
63
|
+
V && !H && B(void 0);
|
|
64
|
+
}, [V, H]);
|
|
65
|
+
let U = se({
|
|
66
66
|
cardId: r,
|
|
67
|
-
enabled:
|
|
68
|
-
}),
|
|
69
|
-
isRevealRequested:
|
|
70
|
-
isError:
|
|
71
|
-
hasCredentials: !!
|
|
72
|
-
}),
|
|
73
|
-
card:
|
|
74
|
-
cardProgram:
|
|
75
|
-
labels:
|
|
67
|
+
enabled: H && V
|
|
68
|
+
}), W = ne({
|
|
69
|
+
isRevealRequested: V,
|
|
70
|
+
isError: U.isError,
|
|
71
|
+
hasCredentials: !!U.data
|
|
72
|
+
}), G = y(() => z === "loaded" && L ? g({
|
|
73
|
+
card: L,
|
|
74
|
+
cardProgram: d,
|
|
75
|
+
labels: N
|
|
76
76
|
}) : void 0, [
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
]),
|
|
82
|
-
await
|
|
83
|
-
}, [
|
|
77
|
+
L,
|
|
78
|
+
d,
|
|
79
|
+
N,
|
|
80
|
+
z
|
|
81
|
+
]), Se = _(async (t) => {
|
|
82
|
+
await f(t) && (e.success(N.copySuccessToast), k(u.ValueCopied));
|
|
83
|
+
}, [N.copySuccessToast, k]), K = z === "loaded" ? L : void 0, q = de({
|
|
84
84
|
cardId: r,
|
|
85
|
-
cardProgram:
|
|
86
|
-
card:
|
|
87
|
-
scopes:
|
|
88
|
-
|
|
89
|
-
|
|
85
|
+
cardProgram: d,
|
|
86
|
+
card: K,
|
|
87
|
+
scopes: M?.scopes,
|
|
88
|
+
currentUserId: ge ? void 0 : M?.userId ?? void 0,
|
|
89
|
+
conflictToast: N.activationConflictToast
|
|
90
|
+
}), J = fe({
|
|
90
91
|
cardId: r,
|
|
91
|
-
cardProgram:
|
|
92
|
-
card:
|
|
93
|
-
scopes:
|
|
94
|
-
conflictToast:
|
|
95
|
-
}),
|
|
92
|
+
cardProgram: d,
|
|
93
|
+
card: K,
|
|
94
|
+
scopes: M?.scopes,
|
|
95
|
+
conflictToast: N.lockConflictToast
|
|
96
|
+
}), Y = pe({
|
|
96
97
|
cardId: r,
|
|
97
|
-
cardProgram:
|
|
98
|
-
card:
|
|
99
|
-
nickname:
|
|
100
|
-
scopes:
|
|
101
|
-
conflictToast:
|
|
102
|
-
successToast:
|
|
103
|
-
}), { refetch:
|
|
104
|
-
if (
|
|
105
|
-
|
|
98
|
+
cardProgram: d,
|
|
99
|
+
card: K,
|
|
100
|
+
nickname: G?.nickname,
|
|
101
|
+
scopes: M?.scopes,
|
|
102
|
+
conflictToast: N.nicknameConflictToast,
|
|
103
|
+
successToast: N.nicknameUpdatedToast
|
|
104
|
+
}), { refetch: X } = U, Ce = _(() => {
|
|
105
|
+
if (V) {
|
|
106
|
+
X();
|
|
106
107
|
return;
|
|
107
108
|
}
|
|
108
|
-
|
|
109
|
+
B(r);
|
|
109
110
|
}, [
|
|
110
111
|
r,
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
]),
|
|
114
|
-
|
|
112
|
+
V,
|
|
113
|
+
X
|
|
114
|
+
]), Z = _(() => {
|
|
115
|
+
B(void 0);
|
|
115
116
|
}, []), Q = _(() => {
|
|
116
|
-
|
|
117
|
-
}, [C]),
|
|
118
|
-
|
|
119
|
-
}, [
|
|
117
|
+
B(void 0), C?.();
|
|
118
|
+
}, [C]), we = _(() => {
|
|
119
|
+
q.finish(), Q();
|
|
120
|
+
}, [q.finish, Q]), Te = y(() => U.isForbidden ? {
|
|
120
121
|
...w,
|
|
121
122
|
credentials: {
|
|
122
123
|
...w?.credentials,
|
|
123
|
-
errorDescription:
|
|
124
|
+
errorDescription: N.revealNotPermittedDescription
|
|
124
125
|
}
|
|
125
126
|
} : w, [
|
|
126
|
-
|
|
127
|
+
U.isForbidden,
|
|
127
128
|
w,
|
|
128
|
-
|
|
129
|
+
N.revealNotPermittedDescription
|
|
129
130
|
]), $ = y(() => {
|
|
130
|
-
if (!(
|
|
131
|
-
cardNumber:
|
|
132
|
-
expirationDate:
|
|
133
|
-
securityCode:
|
|
131
|
+
if (!(W !== "revealed" || !U.data)) return {
|
|
132
|
+
cardNumber: p(U.data.pan),
|
|
133
|
+
expirationDate: m(U.data.expirationDate),
|
|
134
|
+
securityCode: U.data.cvv
|
|
134
135
|
};
|
|
135
|
-
}, [
|
|
136
|
-
if (
|
|
137
|
-
|
|
136
|
+
}, [U.data, W]), Ee = _(() => {
|
|
137
|
+
if (A) {
|
|
138
|
+
j();
|
|
138
139
|
return;
|
|
139
140
|
}
|
|
140
|
-
|
|
141
|
+
R();
|
|
141
142
|
}, [
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
143
|
+
R,
|
|
144
|
+
j,
|
|
145
|
+
A
|
|
145
146
|
]);
|
|
146
|
-
return /* @__PURE__ */ S(
|
|
147
|
+
return /* @__PURE__ */ S(me, { children: [/* @__PURE__ */ x(t, {}), q.isOpen ? /* @__PURE__ */ x(ue, {
|
|
147
148
|
testIds: ie,
|
|
148
|
-
labels:
|
|
149
|
-
state:
|
|
150
|
-
values:
|
|
151
|
-
errors:
|
|
152
|
-
isSubmitDisabled:
|
|
153
|
-
onValuesChange:
|
|
154
|
-
onSubmit:
|
|
155
|
-
onClose:
|
|
156
|
-
onDone: C ?
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
149
|
+
labels: he,
|
|
150
|
+
state: q.state,
|
|
151
|
+
values: q.values,
|
|
152
|
+
errors: q.errors,
|
|
153
|
+
isSubmitDisabled: q.isSubmitDisabled,
|
|
154
|
+
onValuesChange: q.onValuesChange,
|
|
155
|
+
onSubmit: q.onSubmit,
|
|
156
|
+
onClose: q.close,
|
|
157
|
+
onDone: C ? we : void 0,
|
|
158
|
+
cardArtSrc: E,
|
|
159
|
+
bankLogoSrc: D,
|
|
160
|
+
bankLogoAlt: O,
|
|
161
|
+
cardholderName: G?.cardholderName,
|
|
162
|
+
maskedCardNumber: G?.maskedCardNumber,
|
|
163
|
+
programLabel: G?.programLabel
|
|
164
|
+
}) : /* @__PURE__ */ x(le, {
|
|
163
165
|
testIds: ae,
|
|
164
|
-
labels:
|
|
165
|
-
state:
|
|
166
|
-
nickname:
|
|
167
|
-
statusLabel:
|
|
168
|
-
statusTone:
|
|
169
|
-
formFactorLabel:
|
|
166
|
+
labels: Te,
|
|
167
|
+
state: z,
|
|
168
|
+
nickname: G?.nickname,
|
|
169
|
+
statusLabel: G?.statusLabel,
|
|
170
|
+
statusTone: G?.statusTone,
|
|
171
|
+
formFactorLabel: G?.formFactorLabel,
|
|
170
172
|
onClose: C ? Q : void 0,
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
173
|
+
cardArtSrc: E,
|
|
174
|
+
bankLogoSrc: D,
|
|
175
|
+
bankLogoAlt: O,
|
|
176
|
+
cardholderName: G?.cardholderName,
|
|
177
|
+
maskedCardNumber: G?.maskedCardNumber,
|
|
178
|
+
programLabel: G?.programLabel,
|
|
179
|
+
billingAddress: G?.billingAddress,
|
|
180
|
+
allowedCategories: G?.allowedCategories,
|
|
181
|
+
spendLimitLabels: G?.spendLimitLabels,
|
|
182
|
+
perTransactionMaxLabel: G?.perTransactionMaxLabel,
|
|
183
|
+
onCopy: Se,
|
|
184
|
+
onEditNickname: Y.onEditNickname,
|
|
185
|
+
nicknameEditState: Y.editState,
|
|
186
|
+
nicknameDraft: Y.draft,
|
|
187
|
+
onNicknameDraftChange: Y.onDraftChange,
|
|
188
|
+
onSaveNickname: Y.onSave,
|
|
189
|
+
onCancelNicknameEdit: Y.onCancel,
|
|
190
|
+
isNicknameSaveDisabled: Y.isSaveDisabled,
|
|
191
|
+
onActivate: q.canActivate ? q.open : void 0,
|
|
192
|
+
onViewCard: H ? Ce : void 0,
|
|
193
|
+
onHideCard: H ? Z : void 0,
|
|
194
|
+
revealState: W,
|
|
192
195
|
revealedCardNumber: $?.cardNumber,
|
|
193
196
|
revealedExpirationDate: $?.expirationDate,
|
|
194
197
|
revealedSecurityCode: $?.securityCode,
|
|
195
|
-
isLocked:
|
|
196
|
-
lockState:
|
|
197
|
-
onLockCard:
|
|
198
|
-
onUnlockCard:
|
|
199
|
-
onRetry:
|
|
198
|
+
isLocked: J.isLocked,
|
|
199
|
+
lockState: J.lockState,
|
|
200
|
+
onLockCard: J.onLockCard,
|
|
201
|
+
onUnlockCard: J.onUnlockCard,
|
|
202
|
+
onRetry: P === h.Supported ? Ee : void 0
|
|
200
203
|
})] });
|
|
201
204
|
}
|
|
202
|
-
function w({ baseUrl: e, widgetToken: t, organizationId: n, configClient: i, gatewayRouting: a, linkComponent: o, implementation: s, uiFramework: c, errorFallback: l, onError:
|
|
205
|
+
function w({ baseUrl: e, widgetToken: t, organizationId: n, configClient: i, gatewayRouting: a, linkComponent: o, implementation: s, uiFramework: c, errorFallback: l, onError: u, analytics: f, disclosuresAcceptance: p, providerLabels: m, ...h }) {
|
|
203
206
|
return /* @__PURE__ */ x(r, {
|
|
204
|
-
widgetName:
|
|
207
|
+
widgetName: d,
|
|
205
208
|
baseUrl: e,
|
|
206
209
|
widgetToken: t,
|
|
207
210
|
organizationId: n,
|
|
@@ -211,7 +214,7 @@ function w({ baseUrl: e, widgetToken: t, organizationId: n, configClient: i, gat
|
|
|
211
214
|
implementation: s,
|
|
212
215
|
uiFramework: c,
|
|
213
216
|
errorFallback: l,
|
|
214
|
-
onError:
|
|
217
|
+
onError: u,
|
|
215
218
|
analytics: f,
|
|
216
219
|
disclosuresAcceptance: p,
|
|
217
220
|
providerLabels: m,
|
package/dist/libs/tesouro-embedded-components-react/card-details-widget/feature/dist/index3.js
CHANGED
|
@@ -37,16 +37,13 @@ function o(e) {
|
|
|
37
37
|
}
|
|
38
38
|
function s(e) {
|
|
39
39
|
if (!e) return;
|
|
40
|
-
let t = o([
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
e.city,
|
|
48
|
-
n
|
|
49
|
-
]).join(", ") || void 0;
|
|
40
|
+
let t = e.address1?.trim() || void 0, n = o([e.address2, e.address3]).join(" ") || void 0, r = o([e.city, e.state]).join(", ") || void 0, i = e.postalCode?.trim() || void 0;
|
|
41
|
+
if (!(!t && !n && !r && !i)) return {
|
|
42
|
+
addressLine1: t,
|
|
43
|
+
addressLine2: n,
|
|
44
|
+
cityState: r,
|
|
45
|
+
postalCode: i
|
|
46
|
+
};
|
|
50
47
|
}
|
|
51
48
|
function c({ amountLimit: t, currencyCode: n }) {
|
|
52
49
|
let r = e({
|
|
@@ -59,4 +56,4 @@ function c({ amountLimit: t, currencyCode: n }) {
|
|
|
59
56
|
}).format(r);
|
|
60
57
|
}
|
|
61
58
|
//#endregion
|
|
62
|
-
export { a as copyTextToClipboard, s as
|
|
59
|
+
export { a as copyTextToClipboard, s as formatBillingAddressFields, r as formatCardNumber, i as formatExpirationDate, c as formatVelocityControlAmount, n as maskCardNumber };
|
package/dist/libs/tesouro-embedded-components-react/card-details-widget/feature/dist/index4.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CardProgram as e } from "../../../shared/feature/dist/lib/card/cardProgram.js";
|
|
2
2
|
import { CARD_STATUS_TONE as t } from "../../../shared/feature/dist/lib/card/cardPresentation.js";
|
|
3
3
|
import "../../../shared/feature/dist/index.js";
|
|
4
|
-
import {
|
|
4
|
+
import { formatBillingAddressFields as n, formatVelocityControlAmount as r, maskCardNumber as i } from "./index3.js";
|
|
5
5
|
//#region ../../libs/tesouro-embedded-components-react/card-details-widget/feature/dist/index4.js
|
|
6
6
|
var a = {
|
|
7
7
|
Supported: "supported",
|
package/dist/libs/tesouro-embedded-components-react/card-details-widget/feature/dist/index6.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
var e = {
|
|
3
3
|
panel: "card-details-widget-panel",
|
|
4
4
|
cardFace: "card-details-widget-card-face",
|
|
5
|
+
cardFaceCardArt: "card-details-widget-card-face-card-art",
|
|
5
6
|
cardFaceLockedOverlay: "card-details-widget-card-face-locked-overlay",
|
|
6
7
|
credentialsFaceLockedOverlay: "card-details-widget-credentials-face-locked-overlay",
|
|
7
8
|
cardFaceFlip: "card-details-widget-card-face-flip",
|
|
@@ -13,6 +14,7 @@ var e = {
|
|
|
13
14
|
activateSuccess: "card-details-widget-activate-success"
|
|
14
15
|
}, t = {
|
|
15
16
|
root: e.cardFace,
|
|
17
|
+
cardArt: e.cardFaceCardArt,
|
|
16
18
|
lockedOverlay: e.cardFaceLockedOverlay
|
|
17
19
|
}, n = {
|
|
18
20
|
root: e.panel,
|
package/dist/libs/tesouro-embedded-components-react/card-details-widget/feature/dist/index7.js
CHANGED
|
@@ -8,10 +8,10 @@ var r = {
|
|
|
8
8
|
[n.Credit]: t.CreditCardActivateOrg,
|
|
9
9
|
[n.Debit]: t.DebitCardActivateOrg
|
|
10
10
|
};
|
|
11
|
-
function i({ card: t, cardProgram: n, scopes: i }) {
|
|
12
|
-
if (!t || t.cardType !== "PHYSICAL" || t.cardStatus !== "PENDING_ACTIVATION") return !1;
|
|
13
|
-
let
|
|
14
|
-
return
|
|
11
|
+
function i({ card: t, cardProgram: n, scopes: i, currentUserId: a }) {
|
|
12
|
+
if (!t || t.cardType !== "PHYSICAL" || t.cardStatus !== "PENDING_ACTIVATION" || !a || t.userId !== a) return !1;
|
|
13
|
+
let o = r[n];
|
|
14
|
+
return o ? e(new Set(i ?? []), [o]) : !1;
|
|
15
15
|
}
|
|
16
16
|
var a = 4;
|
|
17
17
|
function o(e) {
|
package/dist/libs/tesouro-embedded-components-react/card-details-widget/feature/dist/index9.js
CHANGED
|
@@ -3,114 +3,116 @@
|
|
|
3
3
|
"use client";
|
|
4
4
|
"use client";
|
|
5
5
|
import { toast as e } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { useEmbedApi as t } from "../../../shared/data-access/dist/lib/EmbedApiContext.js";
|
|
7
|
+
import { isApiConflictError as n } from "../../../shared/data-access/dist/lib/isApiConflictError.js";
|
|
8
|
+
import { isApiUnprocessableError as r } from "../../../shared/data-access/dist/lib/isApiUnprocessableError.js";
|
|
8
9
|
import "../../../shared/data-access/dist/index.js";
|
|
9
10
|
import "../../../shared/ui/dist/index.js";
|
|
10
|
-
import { CardProgram as
|
|
11
|
+
import { CardProgram as i } from "../../../shared/feature/dist/lib/card/cardProgram.js";
|
|
11
12
|
import "../../../shared/feature/dist/index.js";
|
|
12
|
-
import { canActivateCard as
|
|
13
|
-
import { useIdScopedRequest as
|
|
14
|
-
import { useActivateCreditCardMutation as
|
|
15
|
-
import { useVerifyDebitCardMutation as
|
|
13
|
+
import { canActivateCard as a, toCardFaceExpirationDate as o } from "./index7.js";
|
|
14
|
+
import { useIdScopedRequest as s } from "./index8.js";
|
|
15
|
+
import { useActivateCreditCardMutation as c, useActivateDebitCardMutation as l } from "../../data-access/dist/index4.js";
|
|
16
|
+
import { useVerifyDebitCardMutation as u } from "../../data-access/dist/index11.js";
|
|
16
17
|
import "../../data-access/dist/index.js";
|
|
17
|
-
import { ActivateCardFormError as
|
|
18
|
+
import { ActivateCardFormError as d, EMPTY_ACTIVATE_CARD_FORM_VALUES as f, validateActivateCardForm as p } from "../../ui/dist/lib/ActivateCardPanel/validation.js";
|
|
18
19
|
import "../../ui/dist/index.js";
|
|
19
|
-
import { useCallback as
|
|
20
|
+
import { useCallback as m, useEffect as h, useMemo as g, useState as _ } from "react";
|
|
20
21
|
//#region ../../libs/tesouro-embedded-components-react/card-details-widget/feature/dist/index9.js
|
|
21
|
-
function
|
|
22
|
-
let [
|
|
23
|
-
id:
|
|
22
|
+
function v({ cardId: v, cardProgram: y, card: b, scopes: x, currentUserId: S, conflictToast: C }) {
|
|
23
|
+
let [w, T] = _(!1), [E, D] = _(f), [O, k] = _("idle"), [A, j] = _(!1), { authEpoch: M } = t(), { claim: N, release: P, isStale: F } = s({
|
|
24
|
+
id: `${v}:${M}`,
|
|
24
25
|
reset: () => {
|
|
25
|
-
|
|
26
|
+
T(!1), D(f), k("idle"), j(!1);
|
|
26
27
|
}
|
|
27
|
-
}), { mutateAsync:
|
|
28
|
-
card:
|
|
29
|
-
cardProgram:
|
|
30
|
-
scopes:
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
...
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
28
|
+
}), { mutateAsync: I } = u(), { mutateAsync: L } = c(), { mutateAsync: R } = l(), z = a({
|
|
29
|
+
card: b,
|
|
30
|
+
cardProgram: y,
|
|
31
|
+
scopes: x,
|
|
32
|
+
currentUserId: S
|
|
33
|
+
}), B = g(() => p(E), [E]), V = g(() => ({
|
|
34
|
+
...B.errors,
|
|
35
|
+
...A ? { form: d.VerificationRejected } : {}
|
|
36
|
+
}), [A, B.errors]), H = m(() => {
|
|
37
|
+
T(!0);
|
|
38
|
+
}, []), U = m(() => {
|
|
39
|
+
P(), D(f), j(!1);
|
|
40
|
+
}, [P]), W = m(() => {
|
|
41
|
+
T(!1), k("idle"), U();
|
|
42
|
+
}, [U]), G = m((e) => {
|
|
43
|
+
D((t) => ({
|
|
42
44
|
...t,
|
|
43
45
|
...e
|
|
44
46
|
}));
|
|
45
47
|
}, []);
|
|
46
|
-
|
|
47
|
-
!
|
|
48
|
+
h(() => {
|
|
49
|
+
!w || z || O !== "succeeded" && O !== "submitting" && (e.error(C), W());
|
|
48
50
|
}, [
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
z,
|
|
52
|
+
W,
|
|
53
|
+
C,
|
|
54
|
+
w,
|
|
55
|
+
O
|
|
54
56
|
]);
|
|
55
|
-
let
|
|
56
|
-
if (!
|
|
57
|
-
let
|
|
58
|
-
if (!
|
|
59
|
-
|
|
60
|
-
let s =
|
|
57
|
+
let K = m(async () => {
|
|
58
|
+
if (!z || !p(E).isValid) return;
|
|
59
|
+
let t = y === i.Credit, a = y === i.Debit;
|
|
60
|
+
if (!t && !a) return;
|
|
61
|
+
k("submitting"), j(!1);
|
|
62
|
+
let s = N();
|
|
61
63
|
try {
|
|
62
|
-
if (
|
|
63
|
-
let e =
|
|
64
|
+
if (a) {
|
|
65
|
+
let e = o(E.expirationDate);
|
|
64
66
|
if (!e) {
|
|
65
|
-
|
|
67
|
+
k("errored");
|
|
66
68
|
return;
|
|
67
69
|
}
|
|
68
|
-
await
|
|
69
|
-
path: { id:
|
|
70
|
+
await I({
|
|
71
|
+
path: { id: v },
|
|
70
72
|
body: {
|
|
71
73
|
expirationDate: e,
|
|
72
|
-
cvv:
|
|
74
|
+
cvv: E.securityCode
|
|
73
75
|
}
|
|
74
76
|
});
|
|
75
77
|
}
|
|
76
|
-
if (
|
|
77
|
-
|
|
78
|
-
} catch (
|
|
79
|
-
if (
|
|
80
|
-
if (t
|
|
81
|
-
e.error(
|
|
78
|
+
if (F(s) || (t ? await L({ path: { id: v } }) : await R({ path: { id: v } }), F(s))) return;
|
|
79
|
+
k("succeeded");
|
|
80
|
+
} catch (t) {
|
|
81
|
+
if (F(s)) return;
|
|
82
|
+
if (n(t)) {
|
|
83
|
+
e.error(C), W();
|
|
82
84
|
return;
|
|
83
85
|
}
|
|
84
|
-
|
|
86
|
+
r(t) && j(!0), k("errored");
|
|
85
87
|
}
|
|
86
88
|
}, [
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
_,
|
|
89
|
+
L,
|
|
90
|
+
R,
|
|
91
|
+
z,
|
|
91
92
|
v,
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
93
|
+
y,
|
|
94
|
+
N,
|
|
95
|
+
W,
|
|
96
|
+
C,
|
|
97
|
+
F,
|
|
98
|
+
E,
|
|
99
|
+
I
|
|
100
|
+
]), q = m(() => {
|
|
101
|
+
K();
|
|
102
|
+
}, [K]);
|
|
101
103
|
return {
|
|
102
|
-
canActivate:
|
|
103
|
-
isOpen:
|
|
104
|
-
open:
|
|
105
|
-
close:
|
|
106
|
-
finish:
|
|
107
|
-
values:
|
|
108
|
-
errors:
|
|
109
|
-
state:
|
|
110
|
-
isSubmitDisabled: !
|
|
111
|
-
onValuesChange:
|
|
112
|
-
onSubmit:
|
|
104
|
+
canActivate: z,
|
|
105
|
+
isOpen: w,
|
|
106
|
+
open: H,
|
|
107
|
+
close: W,
|
|
108
|
+
finish: U,
|
|
109
|
+
values: E,
|
|
110
|
+
errors: V,
|
|
111
|
+
state: O,
|
|
112
|
+
isSubmitDisabled: !z || !B.isValid || O === "submitting",
|
|
113
|
+
onValuesChange: G,
|
|
114
|
+
onSubmit: q
|
|
113
115
|
};
|
|
114
116
|
}
|
|
115
117
|
//#endregion
|
|
116
|
-
export {
|
|
118
|
+
export { v as useActivateCard };
|