@tesouro/embedded-components-react 0.7.70 → 0.7.72
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 +14 -11
- package/dist/index.css +15 -6
- package/dist/index.d.ts +64 -2
- package/dist/lib/LinkedAccountsWidget.d.ts +9 -0
- package/dist/lib/TransfersWidget.d.ts +55 -2
- package/dist/lib/WidgetSuite.d.ts +63 -1
- package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/lib/LinkedAccountsWidget.js +6 -4
- package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/lib/useLinkedAccountsWidget.js +199 -182
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/transfers-widget/feature/dist/lib/TransfersWidget/TransfersWidgetFeature.js +4 -3
- package/dist/libs/tesouro-embedded-components-react/transfers-widget/feature/dist/lib/TransfersWidget/TransfersWidgetInner.js +99 -108
- package/dist/libs/tesouro-embedded-components-react/transfers-widget/feature/dist/lib/TransfersWidget/testIds.js +2 -0
- package/dist/libs/tesouro-embedded-components-react/transfers-widget/feature/dist/lib/TransfersWidget/transferViews.js +135 -0
- package/dist/libs/tesouro-embedded-components-react/transfers-widget/feature/dist/lib/TransfersWidget/useTransferMoneyModalController.js +140 -153
- package/dist/libs/tesouro-embedded-components-react/transfers-widget/ui/dist/lib/TransfersWidget/TransferAccountTile.js +15 -0
- package/dist/libs/tesouro-embedded-components-react/transfers-widget/ui/dist/lib/TransfersWidget/TransferDetailSheet.js +111 -0
- package/dist/libs/tesouro-embedded-components-react/transfers-widget/ui/dist/lib/TransfersWidget/TransferStatusBadge.js +18 -0
- package/dist/libs/tesouro-embedded-components-react/transfers-widget/ui/dist/lib/TransfersWidget/TransfersWidget.js +181 -126
- package/dist/libs/tesouro-embedded-components-react/transfers-widget/ui/dist/lib/TransfersWidget/labels.js +33 -0
- package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/lib/WidgetSuite/sections/TransfersSection.js +16 -8
- package/dist/packages/shared-ui-shadcn/dist/index.js +328 -327
- package/package.json +1 -1
|
@@ -10,15 +10,15 @@ import { parseDecimalAmountToMinorUnits as o } from "../../../../../shared/util/
|
|
|
10
10
|
import "../../../../../shared/ui/dist/index.js";
|
|
11
11
|
import { TRANSFERS_ANALYTICS_EVENTS as s } from "../analytics/events.js";
|
|
12
12
|
import { useCreateBookTransferMutation as c } from "../../../../data-access/dist/index7.js";
|
|
13
|
-
import { useCreateAchMoneyMovementMutation as
|
|
13
|
+
import { useCreateAchMoneyMovementMutation as ee } from "../../../../data-access/dist/index8.js";
|
|
14
14
|
import "../../../../data-access/dist/index.js";
|
|
15
|
-
import { useCallback as
|
|
16
|
-
import { useControllableState as
|
|
15
|
+
import { useCallback as l, useEffect as u, useMemo as d, useState as f } from "react";
|
|
16
|
+
import { useControllableState as p } from "@radix-ui/react-use-controllable-state";
|
|
17
17
|
//#region ../../libs/tesouro-embedded-components-react/transfers-widget/feature/dist/lib/TransfersWidget/useTransferMoneyModalController.js
|
|
18
|
-
function
|
|
18
|
+
function m(e) {
|
|
19
19
|
return e.slice(-4);
|
|
20
20
|
}
|
|
21
|
-
function
|
|
21
|
+
function h(e, t) {
|
|
22
22
|
let r = e.balance;
|
|
23
23
|
if (!r || r.value === void 0 || r.value === null) return;
|
|
24
24
|
let i = r.currencyCode ?? t, o = n({
|
|
@@ -30,14 +30,14 @@ function g(e, t) {
|
|
|
30
30
|
includeSpaceAfterCurrencySymbol: !1
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
|
-
function
|
|
33
|
+
function g(e, t, n, r) {
|
|
34
34
|
let i = n.find((t) => t.id === e);
|
|
35
35
|
if (i?.balance?.currencyCode) return i.balance.currencyCode;
|
|
36
36
|
let a = n.find((e) => e.id === t);
|
|
37
37
|
return a?.balance?.currencyCode ? a.balance.currencyCode : r;
|
|
38
38
|
}
|
|
39
|
-
function
|
|
40
|
-
let r =
|
|
39
|
+
function te(e, t, n) {
|
|
40
|
+
let r = m(e.accountNumber), i = e.nickname?.trim() || t.accountFallbackName, a = h(e, n.defaultCurrencyCode);
|
|
41
41
|
return {
|
|
42
42
|
optionValue: e.id,
|
|
43
43
|
primaryLabel: i,
|
|
@@ -45,15 +45,15 @@ function v(e, t, n) {
|
|
|
45
45
|
balanceLabel: a
|
|
46
46
|
};
|
|
47
47
|
}
|
|
48
|
-
function
|
|
49
|
-
let n =
|
|
48
|
+
function _(e, t) {
|
|
49
|
+
let n = m(e.accountNumber), r = e.nickname?.trim() || e.nameOnAccount;
|
|
50
50
|
return {
|
|
51
51
|
optionValue: e.id,
|
|
52
52
|
primaryLabel: r,
|
|
53
53
|
secondaryLabel: `${t.embeddedAccountMaskPrefix}${n}`
|
|
54
54
|
};
|
|
55
55
|
}
|
|
56
|
-
function
|
|
56
|
+
function v(e, t, n, r, i) {
|
|
57
57
|
return {
|
|
58
58
|
primaryLabel: e?.primaryLabel ?? "",
|
|
59
59
|
accountDetailLabel: t ? `${i} ${t}` : e?.secondaryLabel ?? "",
|
|
@@ -62,175 +62,175 @@ function b(e, t, n, r, i) {
|
|
|
62
62
|
showInstitutionIcon: n
|
|
63
63
|
};
|
|
64
64
|
}
|
|
65
|
-
function
|
|
66
|
-
let
|
|
67
|
-
g,
|
|
65
|
+
function y({ labels: n, featureLabels: m, embeddedBankAccounts: h, verifiedExternalBankAccounts: y, track: b, isTransferMoneyOpen: x, defaultIsTransferMoneyOpen: S, onTransferMoneyOpenChange: C }) {
|
|
66
|
+
let w = c(), T = ee(), E = d(() => new Set(h.map((e) => e.id)), [h]), D = d(() => h.map((e) => te(e, n, m)), [
|
|
68
67
|
h,
|
|
68
|
+
m,
|
|
69
69
|
n.accountFallbackName,
|
|
70
70
|
n.embeddedAccountMaskPrefix
|
|
71
|
-
]),
|
|
72
|
-
prop:
|
|
73
|
-
defaultProp:
|
|
74
|
-
onChange:
|
|
71
|
+
]), O = d(() => y.map((e) => _(e, n)), [n.embeddedAccountMaskPrefix, y]), k = d(() => [...D, ...O], [D, O]), [A, j] = p({
|
|
72
|
+
prop: x,
|
|
73
|
+
defaultProp: S ?? !1,
|
|
74
|
+
onChange: C,
|
|
75
75
|
caller: "TransfersWidget"
|
|
76
|
-
}), [
|
|
77
|
-
|
|
78
|
-
}, []), [W, G] =
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}, [
|
|
82
|
-
let K =
|
|
83
|
-
|
|
84
|
-
}, [
|
|
85
|
-
|
|
86
|
-
}, [
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
]), re =
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
76
|
+
}), [M, N] = f("accounts"), [P, F] = f(""), [I, L] = f(""), [R, z] = f(""), [ne, B] = f(null), [V, H] = f(!1), U = l(() => {
|
|
77
|
+
N("accounts"), F(""), L(""), z(""), B(null), H(!1);
|
|
78
|
+
}, []), [W, G] = f(A);
|
|
79
|
+
A !== W && (G(A), A && U()), u(() => {
|
|
80
|
+
A && b(s.TransferMoneyOpened);
|
|
81
|
+
}, [A, b]);
|
|
82
|
+
let K = l((e) => {
|
|
83
|
+
j(e);
|
|
84
|
+
}, [j]), q = l(() => {
|
|
85
|
+
j(!0);
|
|
86
|
+
}, [j]), J = E.has(P), Y = E.has(I), X = d(() => g(P, I, h, m.defaultCurrencyCode), [
|
|
87
|
+
h,
|
|
88
|
+
m.defaultCurrencyCode,
|
|
89
|
+
P,
|
|
90
|
+
I
|
|
91
|
+
]), re = d(() => i(X), [X]), ie = d(() => I ? Y ? k.filter((e) => e.optionValue !== I) : D.filter((e) => e.optionValue !== I) : k, [
|
|
92
|
+
k,
|
|
93
|
+
D,
|
|
94
|
+
I,
|
|
95
95
|
Y
|
|
96
|
-
]), ae =
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
96
|
+
]), ae = d(() => P ? J ? k.filter((e) => e.optionValue !== P) : D.filter((e) => e.optionValue !== P) : k, [
|
|
97
|
+
k,
|
|
98
|
+
D,
|
|
99
|
+
P,
|
|
100
100
|
J
|
|
101
|
-
]), Z = !!(
|
|
101
|
+
]), Z = !!(P && I && P !== I), oe = d(() => o(R, X) !== null, [R, X]), Q = l((e, r, i) => {
|
|
102
102
|
let a = o(r, i);
|
|
103
103
|
if (a === null) {
|
|
104
|
-
|
|
104
|
+
B(null);
|
|
105
105
|
return;
|
|
106
106
|
}
|
|
107
|
-
if (!
|
|
108
|
-
|
|
107
|
+
if (!E.has(e)) {
|
|
108
|
+
B(null);
|
|
109
109
|
return;
|
|
110
110
|
}
|
|
111
|
-
let s =
|
|
111
|
+
let s = h.find((t) => t.id === e);
|
|
112
112
|
if (!s) {
|
|
113
|
-
|
|
113
|
+
B(null);
|
|
114
114
|
return;
|
|
115
115
|
}
|
|
116
116
|
let c = t(s.balance?.value);
|
|
117
|
-
|
|
117
|
+
B(a > c ? n.modalInsufficientFundsError : null);
|
|
118
118
|
}, [
|
|
119
|
-
|
|
120
|
-
|
|
119
|
+
h,
|
|
120
|
+
E,
|
|
121
121
|
n.modalInsufficientFundsError
|
|
122
|
-
]), se =
|
|
123
|
-
|
|
124
|
-
let t =
|
|
125
|
-
Q(e,
|
|
122
|
+
]), se = l((e) => {
|
|
123
|
+
F(e);
|
|
124
|
+
let t = g(e, I, h, m.defaultCurrencyCode);
|
|
125
|
+
Q(e, R, t);
|
|
126
126
|
}, [
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
127
|
+
R,
|
|
128
|
+
h,
|
|
129
|
+
m.defaultCurrencyCode,
|
|
130
130
|
Q,
|
|
131
|
-
|
|
132
|
-
]), ce =
|
|
133
|
-
|
|
134
|
-
let t =
|
|
135
|
-
Q(
|
|
131
|
+
I
|
|
132
|
+
]), ce = l((e) => {
|
|
133
|
+
L(e);
|
|
134
|
+
let t = g(P, e, h, m.defaultCurrencyCode);
|
|
135
|
+
Q(P, R, t);
|
|
136
136
|
}, [
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
137
|
+
R,
|
|
138
|
+
h,
|
|
139
|
+
m.defaultCurrencyCode,
|
|
140
|
+
P,
|
|
141
141
|
Q
|
|
142
|
-
]),
|
|
143
|
-
|
|
142
|
+
]), le = l((e) => {
|
|
143
|
+
z(e), Q(P, e, X);
|
|
144
144
|
}, [
|
|
145
|
-
|
|
145
|
+
P,
|
|
146
146
|
Q,
|
|
147
147
|
X
|
|
148
|
-
]),
|
|
149
|
-
|
|
150
|
-
}, []),
|
|
151
|
-
let e = o(
|
|
148
|
+
]), ue = l(() => {
|
|
149
|
+
F(""), L(""), z(""), B(null);
|
|
150
|
+
}, []), de = d(() => {
|
|
151
|
+
let e = o(R, X);
|
|
152
152
|
if (e === null) return "";
|
|
153
153
|
let t = r(X);
|
|
154
154
|
return a(e / 10 ** t, {
|
|
155
155
|
currencyCode: X,
|
|
156
156
|
includeSpaceAfterCurrencySymbol: !1
|
|
157
157
|
});
|
|
158
|
-
}, [
|
|
159
|
-
let e =
|
|
160
|
-
return
|
|
158
|
+
}, [R, X]), fe = d(() => {
|
|
159
|
+
let e = k.find((e) => e.optionValue === P), t = h.find((e) => e.id === P), r = y.find((e) => e.id === P);
|
|
160
|
+
return v(e, t?.accountNumber ?? r?.accountNumber, !!r, n.modalAvailableBalanceCaption, n.modalReviewAccountNumberPrefix);
|
|
161
161
|
}, [
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
162
|
+
k,
|
|
163
|
+
h,
|
|
164
|
+
P,
|
|
165
165
|
n.modalAvailableBalanceCaption,
|
|
166
166
|
n.modalReviewAccountNumberPrefix,
|
|
167
|
-
|
|
168
|
-
]),
|
|
169
|
-
let e =
|
|
170
|
-
return
|
|
167
|
+
y
|
|
168
|
+
]), $ = d(() => {
|
|
169
|
+
let e = k.find((e) => e.optionValue === I), t = h.find((e) => e.id === I), r = y.find((e) => e.id === I);
|
|
170
|
+
return v(e, t?.accountNumber ?? r?.accountNumber, !!r, n.modalAvailableBalanceCaption, n.modalReviewAccountNumberPrefix);
|
|
171
171
|
}, [
|
|
172
|
-
|
|
173
|
-
|
|
172
|
+
k,
|
|
173
|
+
h,
|
|
174
174
|
n.modalAvailableBalanceCaption,
|
|
175
175
|
n.modalReviewAccountNumberPrefix,
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
]), pe =
|
|
176
|
+
I,
|
|
177
|
+
y
|
|
178
|
+
]), pe = l(() => {
|
|
179
179
|
if (!Z) return;
|
|
180
|
-
let e = o(
|
|
180
|
+
let e = o(R, X);
|
|
181
181
|
if (e === null) {
|
|
182
|
-
|
|
182
|
+
B(n.modalAmountInvalidError);
|
|
183
183
|
return;
|
|
184
184
|
}
|
|
185
185
|
if (J) {
|
|
186
|
-
let r =
|
|
186
|
+
let r = h.find((e) => e.id === P);
|
|
187
187
|
if (r && e > t(r.balance?.value)) {
|
|
188
|
-
|
|
188
|
+
B(n.modalInsufficientFundsError);
|
|
189
189
|
return;
|
|
190
190
|
}
|
|
191
191
|
}
|
|
192
|
-
|
|
192
|
+
B(null), N("review");
|
|
193
193
|
}, [
|
|
194
|
-
|
|
194
|
+
R,
|
|
195
195
|
Z,
|
|
196
|
-
|
|
196
|
+
h,
|
|
197
197
|
J,
|
|
198
|
-
|
|
198
|
+
P,
|
|
199
199
|
n.modalAmountInvalidError,
|
|
200
200
|
n.modalInsufficientFundsError,
|
|
201
201
|
X
|
|
202
|
-
]), me =
|
|
203
|
-
let e = o(
|
|
202
|
+
]), me = l(() => {
|
|
203
|
+
let e = o(R, X);
|
|
204
204
|
if (e === null) {
|
|
205
|
-
|
|
205
|
+
B(n.modalAmountInvalidError);
|
|
206
206
|
return;
|
|
207
207
|
}
|
|
208
208
|
if (J) {
|
|
209
|
-
let r =
|
|
209
|
+
let r = h.find((e) => e.id === P);
|
|
210
210
|
if (r && e > t(r.balance?.value)) {
|
|
211
|
-
|
|
211
|
+
B(n.modalInsufficientFundsError);
|
|
212
212
|
return;
|
|
213
213
|
}
|
|
214
214
|
}
|
|
215
|
-
|
|
215
|
+
B(null), N("review");
|
|
216
216
|
}, [
|
|
217
|
-
|
|
218
|
-
|
|
217
|
+
R,
|
|
218
|
+
h,
|
|
219
219
|
J,
|
|
220
|
-
|
|
220
|
+
P,
|
|
221
221
|
n.modalAmountInvalidError,
|
|
222
222
|
n.modalInsufficientFundsError,
|
|
223
223
|
X
|
|
224
|
-
]), he =
|
|
225
|
-
if (
|
|
226
|
-
|
|
224
|
+
]), he = l(() => {
|
|
225
|
+
if (M === "amount") {
|
|
226
|
+
N("accounts");
|
|
227
227
|
return;
|
|
228
228
|
}
|
|
229
|
-
|
|
230
|
-
}, [
|
|
231
|
-
let t = o(
|
|
229
|
+
M === "review" && N("accounts");
|
|
230
|
+
}, [M]), ge = l(async () => {
|
|
231
|
+
let t = o(R, X);
|
|
232
232
|
if (t === null) {
|
|
233
|
-
|
|
233
|
+
B(n.modalAmountInvalidError);
|
|
234
234
|
return;
|
|
235
235
|
}
|
|
236
236
|
if (!J && !Y) {
|
|
@@ -240,80 +240,67 @@ function x({ labels: n, featureLabels: h, embeddedBankAccounts: g, verifiedExter
|
|
|
240
240
|
let r;
|
|
241
241
|
r = J && Y ? "INTERNAL_TO_INTERNAL" : J && !Y ? "INTERNAL_TO_EXTERNAL" : "EXTERNAL_TO_INTERNAL";
|
|
242
242
|
try {
|
|
243
|
-
r === "INTERNAL_TO_INTERNAL" ? await
|
|
244
|
-
fromBankAccountId:
|
|
245
|
-
toBankAccountId:
|
|
243
|
+
r === "INTERNAL_TO_INTERNAL" ? await w.mutateAsync({ body: {
|
|
244
|
+
fromBankAccountId: P,
|
|
245
|
+
toBankAccountId: I,
|
|
246
246
|
amount: t,
|
|
247
247
|
currencyCode: X
|
|
248
|
-
} }) : await
|
|
249
|
-
fromBankAccountId:
|
|
250
|
-
toBankAccountId:
|
|
248
|
+
} }) : await T.mutateAsync({ body: {
|
|
249
|
+
fromBankAccountId: P,
|
|
250
|
+
toBankAccountId: I,
|
|
251
251
|
amount: t,
|
|
252
252
|
currencyCode: X,
|
|
253
253
|
type: r,
|
|
254
|
-
secCode:
|
|
255
|
-
} }), H(!0),
|
|
254
|
+
secCode: m.defaultSecCode
|
|
255
|
+
} }), H(!0), N("result"), b(s.TransferSubmitted, { transferType: r });
|
|
256
256
|
} catch {
|
|
257
257
|
e.error(n.modalSubmitFailedError);
|
|
258
258
|
}
|
|
259
259
|
}, [
|
|
260
|
-
|
|
261
|
-
E,
|
|
260
|
+
R,
|
|
262
261
|
T,
|
|
262
|
+
w,
|
|
263
263
|
J,
|
|
264
|
-
|
|
264
|
+
P,
|
|
265
265
|
n.modalSubmitFailedError,
|
|
266
266
|
n.modalUnsupportedPairError,
|
|
267
267
|
n.modalAmountInvalidError,
|
|
268
268
|
Y,
|
|
269
|
-
|
|
270
|
-
|
|
269
|
+
I,
|
|
270
|
+
b,
|
|
271
271
|
X,
|
|
272
|
-
|
|
272
|
+
m.defaultSecCode
|
|
273
273
|
]);
|
|
274
274
|
return {
|
|
275
275
|
modalProps: {
|
|
276
|
-
open:
|
|
276
|
+
open: A,
|
|
277
277
|
onOpenChange: K,
|
|
278
|
-
step:
|
|
278
|
+
step: M,
|
|
279
279
|
fromOptions: ie,
|
|
280
280
|
toOptions: ae,
|
|
281
|
-
fromValue:
|
|
282
|
-
toValue:
|
|
281
|
+
fromValue: P,
|
|
282
|
+
toValue: I,
|
|
283
283
|
onFromValueChange: se,
|
|
284
284
|
onToValueChange: ce,
|
|
285
|
-
amountValue:
|
|
286
|
-
onAmountValueChange:
|
|
287
|
-
amountError:
|
|
285
|
+
amountValue: R,
|
|
286
|
+
onAmountValueChange: le,
|
|
287
|
+
amountError: ne,
|
|
288
288
|
amountInputPrefix: re,
|
|
289
|
-
reviewFromAccount:
|
|
290
|
-
reviewToAccount:
|
|
291
|
-
reviewAmountLabel:
|
|
292
|
-
isSubmitting:
|
|
293
|
-
isSuccess:
|
|
289
|
+
reviewFromAccount: fe,
|
|
290
|
+
reviewToAccount: $,
|
|
291
|
+
reviewAmountLabel: de,
|
|
292
|
+
isSubmitting: w.isPending || T.isPending,
|
|
293
|
+
isSuccess: V,
|
|
294
294
|
canContinueFromAccounts: Z,
|
|
295
295
|
canContinueFromAmount: oe,
|
|
296
296
|
onContinueFromAccounts: pe,
|
|
297
297
|
onContinueFromAmount: me,
|
|
298
298
|
onBack: he,
|
|
299
299
|
onSubmit: () => void ge(),
|
|
300
|
-
onClearSelections:
|
|
300
|
+
onClearSelections: ue
|
|
301
301
|
},
|
|
302
302
|
openModal: q
|
|
303
303
|
};
|
|
304
304
|
}
|
|
305
|
-
function S(e, t, r, i) {
|
|
306
|
-
let o = t.get(e.fromAccount.id) ?? e.fromAccount.nickname ?? r.accountFallbackName, s = t.get(e.toAccount.id) ?? e.toAccount.nickname ?? r.accountFallbackName, c = new Date(e.date), l = Number.isNaN(c.getTime()) ? i.unavailableLabel : new Intl.DateTimeFormat(void 0, { dateStyle: "medium" }).format(c), u = e.amount?.value, d = u == null || !Number.isFinite(Number(u)) ? i.unavailableLabel : a(n(e.amount), {
|
|
307
|
-
currencyCode: e.amount.currencyCode,
|
|
308
|
-
includeSpaceAfterCurrencySymbol: !1
|
|
309
|
-
}), f = e.status === "COMPLETED" ? r.rowStatusCompleted : e.status === "PENDING" ? r.rowStatusPending : r.rowStatusFailed, p = e.type === "INTERNAL_TO_INTERNAL" ? r.rowTypeInternal : e.type === "INTERNAL_TO_EXTERNAL" ? r.rowTypeToExternal : r.rowTypeFromExternal, m = `${o}${r.listAccountsSeparator}${s}`, h = `${f} · ${p}`;
|
|
310
|
-
return {
|
|
311
|
-
rowKey: e.id,
|
|
312
|
-
accountsRouteLabel: m,
|
|
313
|
-
dateLabel: l,
|
|
314
|
-
amountLabel: d,
|
|
315
|
-
detailLabel: h
|
|
316
|
-
};
|
|
317
|
-
}
|
|
318
305
|
//#endregion
|
|
319
|
-
export {
|
|
306
|
+
export { y as useTransferMoneyModalController };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { cn as e } from "../../../../../../../packages/shared-ui-shadcn/dist/index.js";
|
|
2
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
3
|
+
import { Landmark as n } from "lucide-react";
|
|
4
|
+
//#region ../../libs/tesouro-embedded-components-react/transfers-widget/ui/dist/lib/TransfersWidget/TransferAccountTile.js
|
|
5
|
+
function r({ kind: r }) {
|
|
6
|
+
return /* @__PURE__ */ t("span", {
|
|
7
|
+
className: e("ttw:flex ttw:size-7 ttw:shrink-0 ttw:items-center ttw:justify-center ttw:rounded-md", r === "internal" ? "ttw:bg-primary/10 ttw:text-primary" : "ttw:bg-muted ttw:text-muted-foreground"),
|
|
8
|
+
children: /* @__PURE__ */ t(n, {
|
|
9
|
+
className: "ttw:size-4",
|
|
10
|
+
"aria-hidden": !0
|
|
11
|
+
})
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
//#endregion
|
|
15
|
+
export { r as TransferAccountTile };
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { Alert as e, AlertDescription as t, AlertTitle as n, Button as r, Separator as i, Sheet as a, SheetContent as o, SheetHeader as s, SheetTitle as c, Typography as l, cn as u } from "../../../../../../../packages/shared-ui-shadcn/dist/index.js";
|
|
2
|
+
import { TransferStatusBadge as d } from "./TransferStatusBadge.js";
|
|
3
|
+
import { TransferAccountTile as f } from "./TransferAccountTile.js";
|
|
4
|
+
import { jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
5
|
+
//#region ../../libs/tesouro-embedded-components-react/transfers-widget/ui/dist/lib/TransfersWidget/TransferDetailSheet.js
|
|
6
|
+
function h({ label: e, account: t }) {
|
|
7
|
+
return /* @__PURE__ */ m("div", {
|
|
8
|
+
className: "ttw:flex ttw:flex-col ttw:gap-2",
|
|
9
|
+
children: [/* @__PURE__ */ p(l, {
|
|
10
|
+
variant: "body2",
|
|
11
|
+
color: "muted",
|
|
12
|
+
component: "p",
|
|
13
|
+
children: e
|
|
14
|
+
}), /* @__PURE__ */ m("div", {
|
|
15
|
+
className: "ttw:flex ttw:items-center ttw:gap-3",
|
|
16
|
+
children: [/* @__PURE__ */ p(f, { kind: t.kind }), /* @__PURE__ */ m("div", {
|
|
17
|
+
className: "ttw:min-w-0",
|
|
18
|
+
children: [/* @__PURE__ */ m("p", {
|
|
19
|
+
className: "ttw:m-0 ttw:flex ttw:gap-1 ttw:text-sm ttw:font-medium",
|
|
20
|
+
children: [/* @__PURE__ */ p("span", {
|
|
21
|
+
className: "ttw:truncate",
|
|
22
|
+
children: t.name
|
|
23
|
+
}), t.maskLabel ? /* @__PURE__ */ p("span", {
|
|
24
|
+
className: "ttw:shrink-0",
|
|
25
|
+
children: t.maskLabel
|
|
26
|
+
}) : null]
|
|
27
|
+
}), /* @__PURE__ */ p(l, {
|
|
28
|
+
variant: "body2",
|
|
29
|
+
color: "muted",
|
|
30
|
+
component: "p",
|
|
31
|
+
children: t.kindLabel
|
|
32
|
+
})]
|
|
33
|
+
})]
|
|
34
|
+
})]
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
function g({ detail: f, onClose: g, onLinkAccountClick: _, labels: v, testIds: y }) {
|
|
38
|
+
let b = f?.returnedBanner;
|
|
39
|
+
return /* @__PURE__ */ p(a, {
|
|
40
|
+
open: !!f,
|
|
41
|
+
onOpenChange: (e) => {
|
|
42
|
+
e || g?.();
|
|
43
|
+
},
|
|
44
|
+
children: /* @__PURE__ */ m(o, {
|
|
45
|
+
labels: { close: v.detailClose },
|
|
46
|
+
"data-testid": y?.root,
|
|
47
|
+
"aria-describedby": void 0,
|
|
48
|
+
children: [/* @__PURE__ */ p(s, { children: /* @__PURE__ */ p(c, { children: v.detailTitle }) }), f ? /* @__PURE__ */ m("div", {
|
|
49
|
+
className: "ttw:flex ttw:flex-col ttw:gap-6 ttw:overflow-y-auto ttw:px-4 ttw:pb-4",
|
|
50
|
+
children: [
|
|
51
|
+
/* @__PURE__ */ m("div", {
|
|
52
|
+
className: "ttw:flex ttw:flex-wrap ttw:items-center ttw:gap-3",
|
|
53
|
+
children: [/* @__PURE__ */ p(l, {
|
|
54
|
+
variant: "h4",
|
|
55
|
+
component: "p",
|
|
56
|
+
className: u("ttw:font-semibold ttw:tabular-nums", f.isAmountStruckThrough && "ttw:line-through"),
|
|
57
|
+
children: f.amountLabel
|
|
58
|
+
}), /* @__PURE__ */ p(d, {
|
|
59
|
+
label: f.statusLabel,
|
|
60
|
+
tone: f.statusTone
|
|
61
|
+
})]
|
|
62
|
+
}),
|
|
63
|
+
b ? /* @__PURE__ */ m(e, {
|
|
64
|
+
variant: "destructive",
|
|
65
|
+
"data-testid": y?.returnedBanner,
|
|
66
|
+
children: [/* @__PURE__ */ p(n, { children: b.title }), /* @__PURE__ */ m(t, { children: [
|
|
67
|
+
/* @__PURE__ */ p("p", { children: b.description }),
|
|
68
|
+
/* @__PURE__ */ p("p", { children: b.nextStep }),
|
|
69
|
+
_ ? /* @__PURE__ */ p(r, {
|
|
70
|
+
type: "button",
|
|
71
|
+
size: "sm",
|
|
72
|
+
className: "ttw:mt-2",
|
|
73
|
+
onClick: _,
|
|
74
|
+
children: v.returnedLinkAccountCta
|
|
75
|
+
}) : null
|
|
76
|
+
] })]
|
|
77
|
+
}) : null,
|
|
78
|
+
/* @__PURE__ */ m("div", {
|
|
79
|
+
className: "ttw:flex ttw:flex-col ttw:gap-4",
|
|
80
|
+
children: [
|
|
81
|
+
/* @__PURE__ */ p(h, {
|
|
82
|
+
label: v.transferFromLabel,
|
|
83
|
+
account: f.from
|
|
84
|
+
}),
|
|
85
|
+
/* @__PURE__ */ p(i, {}),
|
|
86
|
+
/* @__PURE__ */ p(h, {
|
|
87
|
+
label: v.transferToLabel,
|
|
88
|
+
account: f.to
|
|
89
|
+
})
|
|
90
|
+
]
|
|
91
|
+
}),
|
|
92
|
+
[[v.detailInitiatedByLabel, f.initiatedByLabel], [v.detailInitiatedOnLabel, f.initiatedOnLabel]].map(([e, t]) => /* @__PURE__ */ m("div", {
|
|
93
|
+
className: "ttw:flex ttw:flex-col ttw:gap-1",
|
|
94
|
+
children: [/* @__PURE__ */ p(l, {
|
|
95
|
+
variant: "body2",
|
|
96
|
+
color: "muted",
|
|
97
|
+
component: "p",
|
|
98
|
+
children: e
|
|
99
|
+
}), /* @__PURE__ */ p(l, {
|
|
100
|
+
variant: "body2",
|
|
101
|
+
component: "p",
|
|
102
|
+
children: t
|
|
103
|
+
})]
|
|
104
|
+
}, e))
|
|
105
|
+
]
|
|
106
|
+
}) : null]
|
|
107
|
+
})
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
//#endregion
|
|
111
|
+
export { g as TransferDetailSheet };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Badge as e, cn as t } from "../../../../../../../packages/shared-ui-shadcn/dist/index.js";
|
|
2
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
3
|
+
//#region ../../libs/tesouro-embedded-components-react/transfers-widget/ui/dist/lib/TransfersWidget/TransferStatusBadge.js
|
|
4
|
+
var r = {
|
|
5
|
+
success: "ttw:bg-emerald-100 ttw:text-emerald-700",
|
|
6
|
+
warning: "ttw:bg-amber-100 ttw:text-amber-700",
|
|
7
|
+
destructive: "ttw:bg-destructive/10 ttw:text-destructive",
|
|
8
|
+
returned: "ttw:bg-rose-100 ttw:text-rose-700"
|
|
9
|
+
};
|
|
10
|
+
function i({ label: i, tone: a }) {
|
|
11
|
+
return /* @__PURE__ */ n(e, {
|
|
12
|
+
variant: "secondary",
|
|
13
|
+
className: t(r[a]),
|
|
14
|
+
children: i
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
18
|
+
export { i as TransferStatusBadge };
|