@tesouro/embedded-components-react 0.7.70 → 0.7.73
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 +15 -12
- package/dist/index.css +24 -6
- package/dist/index.d.ts +76 -8
- package/dist/lib/LinkedAccountsWidget.d.ts +9 -0
- package/dist/lib/ProductsWidget.d.ts +12 -6
- package/dist/lib/ReceivablesWidget.d.ts +1 -5
- 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/products-widget/feature/dist/lib/ProductsWidget/ProductsWidget.js +23 -24
- package/dist/libs/tesouro-embedded-components-react/products-widget/feature/dist/lib/ProductsWidget/constants.js +6 -2
- package/dist/libs/tesouro-embedded-components-react/products-widget/feature/dist/lib/ProductsWidget/useProductsTable.js +112 -51
- package/dist/libs/tesouro-embedded-components-react/products-widget/feature/dist/lib/ProductsWidget/useProductsWidget.js +80 -56
- package/dist/libs/tesouro-embedded-components-react/products-widget/ui/dist/index.js +6 -5
- package/dist/libs/tesouro-embedded-components-react/products-widget/ui/dist/index2.js +15 -6
- package/dist/libs/tesouro-embedded-components-react/products-widget/ui/dist/index4.js +170 -135
- package/dist/libs/tesouro-embedded-components-react/products-widget/ui/dist/index5.js +49 -150
- package/dist/libs/tesouro-embedded-components-react/products-widget/ui/dist/index6.js +152 -24
- package/dist/libs/tesouro-embedded-components-react/products-widget/ui/dist/index7.js +28 -0
- 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/product-catalog/feature/dist/index.js +13 -12
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/feature/dist/lib/MeasureUnitsManagerContainer.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/feature/dist/lib/ProductSelector.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/feature/dist/lib/helpers.js +41 -27
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/feature/dist/lib/useProductForm.js +70 -52
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/ui/dist/index.js +7 -6
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/ui/dist/index2.js +19 -8
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/ui/dist/index3.js +171 -218
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/ui/dist/index4.js +52 -180
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/ui/dist/index5.js +188 -46
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/ui/dist/index6.js +47 -124
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/ui/dist/index7.js +128 -0
- 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
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { formatLabel as e } from "../../../../../../../packages/shared-ui-shadcn/dist/index.js";
|
|
2
|
+
import { amountOutputToMajorUnits as t } from "../../../../../shared/util/dist/lib/amountOutputToMajorUnits.js";
|
|
3
|
+
import { formatMoneyExact as n } from "../../../../../shared/util/dist/lib/formatMoneyExact.js";
|
|
4
|
+
//#region ../../libs/tesouro-embedded-components-react/transfers-widget/feature/dist/lib/TransfersWidget/transferViews.js
|
|
5
|
+
function r(e, t, n) {
|
|
6
|
+
let r = /* @__PURE__ */ new Map();
|
|
7
|
+
for (let t of e) r.set(t.id, {
|
|
8
|
+
kind: "internal",
|
|
9
|
+
name: t.nickname?.trim() || n.accountFallbackName,
|
|
10
|
+
last4: t.accountNumber.slice(-4)
|
|
11
|
+
});
|
|
12
|
+
for (let e of t) r.set(e.id, {
|
|
13
|
+
kind: "external",
|
|
14
|
+
name: e.nickname?.trim() || n.externalAccountFallbackName,
|
|
15
|
+
last4: e.accountNumber.slice(-4)
|
|
16
|
+
});
|
|
17
|
+
return r;
|
|
18
|
+
}
|
|
19
|
+
function i(t, n, r) {
|
|
20
|
+
let i = n.get(t.id), a = i?.kind ?? "external";
|
|
21
|
+
return {
|
|
22
|
+
kind: a,
|
|
23
|
+
kindLabel: a === "internal" ? r.accountKindInternal : r.accountKindExternal,
|
|
24
|
+
name: i?.name ?? (t.nickname?.trim() || r.externalAccountFallbackName),
|
|
25
|
+
...i && { maskLabel: e(r.accountMaskTemplate, { last4: i.last4 }) },
|
|
26
|
+
...a === "external" && { badgeLabel: r.externalAccountBadge }
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
var a = (e) => e.maskLabel ? `${e.name} ${e.maskLabel}` : e.name, o = {
|
|
30
|
+
COMPLETED: "success",
|
|
31
|
+
PENDING: "warning",
|
|
32
|
+
FAILED: "destructive",
|
|
33
|
+
RETURNED: "returned"
|
|
34
|
+
};
|
|
35
|
+
function s(e, t) {
|
|
36
|
+
return {
|
|
37
|
+
COMPLETED: t.rowStatusCompleted,
|
|
38
|
+
PENDING: t.rowStatusPending,
|
|
39
|
+
FAILED: t.rowStatusFailed,
|
|
40
|
+
RETURNED: t.rowStatusReturned
|
|
41
|
+
}[e] ?? t.rowStatusPending;
|
|
42
|
+
}
|
|
43
|
+
function c(e, t) {
|
|
44
|
+
switch (e) {
|
|
45
|
+
case "ACCOUNT_CLOSED": return {
|
|
46
|
+
short: t.returnShortReasonAccountClosed,
|
|
47
|
+
title: t.returnedTitleAccountClosed,
|
|
48
|
+
explanation: t.returnedExplanationAccountClosed
|
|
49
|
+
};
|
|
50
|
+
case "INVALID_ACCOUNT_DETAILS": return {
|
|
51
|
+
short: t.returnShortReasonInvalidAccountDetails,
|
|
52
|
+
title: t.returnedTitleInvalidAccountDetails,
|
|
53
|
+
explanation: t.returnedExplanationInvalidAccountDetails
|
|
54
|
+
};
|
|
55
|
+
case "ACCOUNT_CANNOT_RECEIVE": return {
|
|
56
|
+
short: t.returnShortReasonAccountCannotReceive,
|
|
57
|
+
title: t.returnedTitleAccountCannotReceive,
|
|
58
|
+
explanation: t.returnedExplanationAccountCannotReceive
|
|
59
|
+
};
|
|
60
|
+
case "REFUSED_BY_RECEIVER": return {
|
|
61
|
+
short: t.returnShortReasonRefusedByReceiver,
|
|
62
|
+
title: t.returnedTitleRefusedByReceiver,
|
|
63
|
+
explanation: t.returnedExplanationRefusedByReceiver
|
|
64
|
+
};
|
|
65
|
+
default: return {
|
|
66
|
+
short: void 0,
|
|
67
|
+
title: t.returnedTitleGeneric,
|
|
68
|
+
explanation: t.returnedExplanationGeneric
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
function l(e, t, n) {
|
|
73
|
+
let r = new Date(e);
|
|
74
|
+
return Number.isNaN(r.getTime()) ? n : new Intl.DateTimeFormat(void 0, t).format(r);
|
|
75
|
+
}
|
|
76
|
+
function u(e, r) {
|
|
77
|
+
let i = e.amount?.value;
|
|
78
|
+
return i == null || !Number.isFinite(Number(i)) ? r.unavailableLabel : n(t(e.amount), {
|
|
79
|
+
currencyCode: e.amount.currencyCode,
|
|
80
|
+
includeSpaceAfterCurrencySymbol: !1
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
function d(e, t, n, r) {
|
|
84
|
+
return {
|
|
85
|
+
from: i(e.fromAccount, t, n),
|
|
86
|
+
to: i(e.toAccount, t, n),
|
|
87
|
+
statusLabel: s(e.status, n),
|
|
88
|
+
statusTone: o[e.status] ?? "warning",
|
|
89
|
+
amountLabel: u(e, r),
|
|
90
|
+
isAmountStruckThrough: e.status === "FAILED"
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
function f(t, n, r, i) {
|
|
94
|
+
let a = d(t, n, r, i);
|
|
95
|
+
return {
|
|
96
|
+
...a,
|
|
97
|
+
rowKey: t.id,
|
|
98
|
+
dateLabel: l(t.createdDateTime, { dateStyle: "medium" }, i.unavailableLabel),
|
|
99
|
+
statusReasonLabel: t.status === "RETURNED" ? c(t.returnCategory, r).short : void 0,
|
|
100
|
+
ariaLabel: e(r.rowAriaLabel, {
|
|
101
|
+
amount: a.amountLabel,
|
|
102
|
+
from: a.from.name,
|
|
103
|
+
to: a.to.name
|
|
104
|
+
})
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
function p(t, n, r, i) {
|
|
108
|
+
let o = d(t, n, r, i), s = {
|
|
109
|
+
...o,
|
|
110
|
+
initiatedByLabel: t.initiatedBy,
|
|
111
|
+
initiatedOnLabel: l(t.createdDateTime, {
|
|
112
|
+
month: "short",
|
|
113
|
+
day: "numeric",
|
|
114
|
+
year: "numeric",
|
|
115
|
+
hour: "numeric",
|
|
116
|
+
minute: "2-digit",
|
|
117
|
+
timeZoneName: "short"
|
|
118
|
+
}, i.unavailableLabel)
|
|
119
|
+
};
|
|
120
|
+
if (t.status !== "RETURNED") return s;
|
|
121
|
+
let u = c(t.returnCategory, r), f = o.from.kind === "external" ? o.from : o.to, p = o.from.kind === "internal" ? ` ${e(r.returnedRefundSentence, {
|
|
122
|
+
amount: o.amountLabel,
|
|
123
|
+
account: a(o.from)
|
|
124
|
+
})}` : "";
|
|
125
|
+
return {
|
|
126
|
+
...s,
|
|
127
|
+
returnedBanner: {
|
|
128
|
+
title: u.title,
|
|
129
|
+
description: `${u.explanation}${p}`,
|
|
130
|
+
nextStep: e(r.returnedPausedSentence, { account: a(f) })
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
//#endregion
|
|
135
|
+
export { r as buildAccountDirectory, p as mapTransferToDetailView, f as mapTransferToRowView };
|
|
@@ -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 };
|