@tesouro/embedded-components-react 0.11.0 → 0.11.1
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/dist/experimental/QuickViewWidget.d.ts +11 -0
- package/dist/experimental/RemoteCheckCapture.d.ts +11 -0
- package/dist/experimental/index.d.ts +11 -0
- package/dist/index.css +15 -50
- package/dist/index.d.ts +54 -13
- package/dist/lib/AcceptDisclosuresWidget.d.ts +11 -0
- package/dist/lib/BalancesWidget.d.ts +11 -0
- package/dist/lib/BankAccountOnboardingWidget.d.ts +11 -0
- package/dist/lib/BankAccountsWidget.d.ts +11 -0
- package/dist/lib/BankingComplianceBannerWidget.d.ts +11 -0
- package/dist/lib/BillPayWidget.d.ts +11 -0
- package/dist/lib/CardDetailsWidget.d.ts +11 -0
- package/dist/lib/CounterpartsWidget.d.ts +11 -0
- package/dist/lib/CounterpartsWidgetPublic.d.ts +11 -0
- package/dist/lib/CreditCardsWidget.d.ts +11 -0
- package/dist/lib/CustomersWidget.d.ts +11 -0
- package/dist/lib/DebitCardsWidget.d.ts +11 -0
- package/dist/lib/ExpenseManagementWidget.d.ts +11 -0
- package/dist/lib/InsightsWidget.d.ts +11 -0
- package/dist/lib/LinkedAccountsWidget.d.ts +11 -0
- package/dist/lib/OfferWidget.d.ts +11 -0
- package/dist/lib/ProductsWidget.d.ts +11 -0
- package/dist/lib/ReceivablesWidget.d.ts +11 -0
- package/dist/lib/SettingsWidget.d.ts +11 -0
- package/dist/lib/TransfersWidget.d.ts +54 -13
- package/dist/lib/WidgetProvider.d.ts +11 -0
- package/dist/lib/WidgetProviderPublic.d.ts +11 -0
- package/dist/lib/WidgetSuite.d.ts +54 -13
- 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/ui/dist/index.js +15 -12
- package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/lib/AmountInput/AmountInput.js +30 -0
- package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/lib/LoadingRegion/LoadingRegion.js +14 -1
- package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/lib/MaskedAccountNumber/MaskedAccountNumber.js +57 -0
- package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/lib/MaskedAccountNumber/labels.js +7 -0
- package/dist/libs/tesouro-embedded-components-react/transfers-widget/feature/dist/lib/TransfersWidget/TransfersWidgetInner.js +4 -2
- package/dist/libs/tesouro-embedded-components-react/transfers-widget/feature/dist/lib/TransfersWidget/testIds.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/transfers-widget/feature/dist/lib/TransfersWidget/transferViews.js +10 -17
- package/dist/libs/tesouro-embedded-components-react/transfers-widget/feature/dist/lib/TransfersWidget/useTransferMoneyModalController.js +159 -218
- package/dist/libs/tesouro-embedded-components-react/transfers-widget/feature/dist/mocks/labels.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/transfers-widget/ui/dist/lib/TransferMoneyModal/ReviewTransferStep.js +37 -88
- package/dist/libs/tesouro-embedded-components-react/transfers-widget/ui/dist/lib/TransferMoneyModal/TransferMoneyModal.js +184 -245
- package/dist/libs/tesouro-embedded-components-react/transfers-widget/ui/dist/lib/TransferMoneyModal/TransferResultStep.js +43 -58
- package/dist/libs/tesouro-embedded-components-react/transfers-widget/ui/dist/lib/TransferMoneyModal/reviewTransferStepLabels.js +6 -5
- package/dist/libs/tesouro-embedded-components-react/transfers-widget/ui/dist/lib/TransferMoneyModal/transferResultStepLabels.js +7 -6
- package/dist/libs/tesouro-embedded-components-react/transfers-widget/ui/dist/lib/TransferMoneyModal/useFocusFirstInvalidField.js +9 -0
- package/dist/libs/tesouro-embedded-components-react/transfers-widget/ui/dist/lib/TransfersWidget/TransferAccountValue.js +32 -0
- package/dist/libs/tesouro-embedded-components-react/transfers-widget/ui/dist/lib/TransfersWidget/TransferDetailSheet.js +68 -101
- package/dist/libs/tesouro-embedded-components-react/transfers-widget/ui/dist/lib/TransfersWidget/TransfersWidget.js +155 -153
- package/dist/libs/tesouro-embedded-components-react/transfers-widget/ui/dist/lib/TransfersWidget/labels.js +20 -11
- package/dist/libs/tesouro-embedded-components-react/transfers-widget/ui/dist/lib/TransfersWidget/maskLabels.js +7 -0
- package/dist/packages/shared-ui-shadcn/dist/index.js +1846 -1603
- package/package.json +1 -1
- package/dist/libs/tesouro-embedded-components-react/transfers-widget/ui/dist/lib/TransferMoneyModal/TransferMoneyModalHeader.js +0 -29
- package/dist/libs/tesouro-embedded-components-react/transfers-widget/ui/dist/lib/TransferMoneyModal/TransferReviewAccountCard.js +0 -64
- package/dist/libs/tesouro-embedded-components-react/transfers-widget/ui/dist/lib/TransfersWidget/TransferAccountTile.js +0 -14
- package/dist/libs/tesouro-embedded-components-react/transfers-widget/ui/dist/lib/TransfersWidget/TransferStatusBadge.js +0 -17
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { Button as e, Tooltip as t, TooltipContent as n, TooltipProvider as r, TooltipTrigger as i, formatLabel as a } from "../../../../../../../packages/shared-ui-shadcn/dist/index.js";
|
|
2
|
+
import { MASKED_ACCOUNT_NUMBER_LABELS_EN as o } from "./labels.js";
|
|
3
|
+
import { useState as s } from "react";
|
|
4
|
+
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
5
|
+
import { Asterisk as u, Eye as d, EyeOff as f } from "lucide-react";
|
|
6
|
+
// ../../libs/tesouro-embedded-components-react/shared/ui/dist/lib/MaskedAccountNumber/MaskedAccountNumber.js
|
|
7
|
+
function p({ last4: p, fullNumber: m, labels: h }) {
|
|
8
|
+
let g = {
|
|
9
|
+
...o,
|
|
10
|
+
...h
|
|
11
|
+
}, [_, v] = s(!1), y = /* @__PURE__ */ l("span", {
|
|
12
|
+
className: "ttw:whitespace-nowrap ttw:tabular-nums",
|
|
13
|
+
children: [/* @__PURE__ */ l("span", {
|
|
14
|
+
"aria-hidden": "true",
|
|
15
|
+
children: [
|
|
16
|
+
/* @__PURE__ */ c("span", {
|
|
17
|
+
className: "ttw:inline-flex",
|
|
18
|
+
children: [
|
|
19
|
+
0,
|
|
20
|
+
1,
|
|
21
|
+
2,
|
|
22
|
+
3
|
|
23
|
+
].map((e) => /* @__PURE__ */ c(u, {
|
|
24
|
+
strokeWidth: 3,
|
|
25
|
+
className: "ttw:-mx-[0.1em] ttw:size-[0.75em]"
|
|
26
|
+
}, e))
|
|
27
|
+
}),
|
|
28
|
+
" ",
|
|
29
|
+
p
|
|
30
|
+
]
|
|
31
|
+
}), /* @__PURE__ */ c("span", {
|
|
32
|
+
className: "ttw:sr-only",
|
|
33
|
+
children: a(g.endingIn, { last4: p })
|
|
34
|
+
})]
|
|
35
|
+
});
|
|
36
|
+
if (!m) return y;
|
|
37
|
+
let b = _ ? g.hideNumber : g.showNumber;
|
|
38
|
+
return /* @__PURE__ */ l("span", {
|
|
39
|
+
className: "ttw:inline-flex ttw:items-center ttw:gap-1",
|
|
40
|
+
children: [_ ? /* @__PURE__ */ c("span", {
|
|
41
|
+
className: "ttw:tabular-nums",
|
|
42
|
+
children: m
|
|
43
|
+
}) : y, /* @__PURE__ */ c(r, { children: /* @__PURE__ */ l(t, { children: [/* @__PURE__ */ c(i, {
|
|
44
|
+
asChild: !0,
|
|
45
|
+
children: /* @__PURE__ */ c(e, {
|
|
46
|
+
type: "button",
|
|
47
|
+
variant: "ghost",
|
|
48
|
+
size: "icon-sm",
|
|
49
|
+
className: "ttw:-my-1.5",
|
|
50
|
+
"aria-label": b,
|
|
51
|
+
onClick: () => v((e) => !e),
|
|
52
|
+
children: c(_ ? f : d, { "aria-hidden": !0 })
|
|
53
|
+
})
|
|
54
|
+
}), /* @__PURE__ */ c(n, { children: b })] }) })]
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
export { p as MaskedAccountNumber };
|
|
@@ -121,7 +121,10 @@ function h({ labels: e, featureLabels: t, isTransferMoneyOpen: h, defaultIsTrans
|
|
|
121
121
|
confirm: c.modalConfirmTransferButton,
|
|
122
122
|
goBack: c.modalGoBackButton
|
|
123
123
|
},
|
|
124
|
-
resultStep: {
|
|
124
|
+
resultStep: {
|
|
125
|
+
title: c.modalResultTitle,
|
|
126
|
+
done: c.modalDoneButton
|
|
127
|
+
}
|
|
125
128
|
}
|
|
126
129
|
},
|
|
127
130
|
labels: e,
|
|
@@ -129,7 +132,6 @@ function h({ labels: e, featureLabels: t, isTransferMoneyOpen: h, defaultIsTrans
|
|
|
129
132
|
transferMoneyButton: c.transferMoneyButton,
|
|
130
133
|
skeleton: c.skeleton,
|
|
131
134
|
error: c.error,
|
|
132
|
-
retry: c.retry,
|
|
133
135
|
empty: c.empty,
|
|
134
136
|
transferRow: c.transferRow,
|
|
135
137
|
transferDetail: {
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
var e = {
|
|
3
3
|
skeleton: "transfers-widget-skeleton",
|
|
4
4
|
error: "transfers-widget-error",
|
|
5
|
-
retry: "transfers-widget-retry",
|
|
6
5
|
empty: "transfers-widget-empty",
|
|
7
6
|
transferRow: "embedded-banking-transfer-row",
|
|
8
7
|
transferDetail: "transfers-widget-transfer-detail",
|
|
@@ -16,6 +15,7 @@ var e = {
|
|
|
16
15
|
modalAmountInput: "embedded-banking-transfer-money-amount-input",
|
|
17
16
|
modalConfirmTransferButton: "embedded-banking-transfer-money-confirm-transfer-button",
|
|
18
17
|
modalGoBackButton: "embedded-banking-transfer-money-go-back-button",
|
|
19
|
-
|
|
18
|
+
modalResultTitle: "embedded-banking-transfer-money-result-success-title",
|
|
19
|
+
modalDoneButton: "embedded-banking-transfer-money-back-to-transfers-button"
|
|
20
20
|
};
|
|
21
21
|
export { e as transfersWidgetTestIds };
|
|
@@ -17,21 +17,20 @@ function r(e, t, n) {
|
|
|
17
17
|
});
|
|
18
18
|
return r;
|
|
19
19
|
}
|
|
20
|
-
function i(t, n
|
|
21
|
-
let
|
|
20
|
+
function i(e, t, n) {
|
|
21
|
+
let r = t.get(e.id), i = r?.kind ?? "external";
|
|
22
22
|
return {
|
|
23
|
-
kind:
|
|
24
|
-
kindLabel:
|
|
25
|
-
name:
|
|
26
|
-
...
|
|
27
|
-
...a === "external" && { badgeLabel: r.externalAccountBadge }
|
|
23
|
+
kind: i,
|
|
24
|
+
kindLabel: i === "internal" ? n.accountKindInternal : n.accountKindExternal,
|
|
25
|
+
name: r?.name ?? (e.nickname?.trim() || n.externalAccountFallbackName),
|
|
26
|
+
...r && { number: { last4: r.last4 } }
|
|
28
27
|
};
|
|
29
28
|
}
|
|
30
|
-
var a = (
|
|
29
|
+
var a = (t, n) => t.number ? `${t.name} ${e(n.accountMaskTemplate, { last4: t.number.last4 })}` : t.name, o = {
|
|
31
30
|
COMPLETED: "success",
|
|
32
31
|
PENDING: "warning",
|
|
33
32
|
FAILED: "destructive",
|
|
34
|
-
RETURNED: "
|
|
33
|
+
RETURNED: "destructive"
|
|
35
34
|
};
|
|
36
35
|
function s(e, t) {
|
|
37
36
|
return {
|
|
@@ -44,27 +43,22 @@ function s(e, t) {
|
|
|
44
43
|
function c(e, t) {
|
|
45
44
|
switch (e) {
|
|
46
45
|
case "ACCOUNT_CLOSED": return {
|
|
47
|
-
short: t.returnShortReasonAccountClosed,
|
|
48
46
|
title: t.returnedTitleAccountClosed,
|
|
49
47
|
explanation: t.returnedExplanationAccountClosed
|
|
50
48
|
};
|
|
51
49
|
case "INVALID_ACCOUNT_DETAILS": return {
|
|
52
|
-
short: t.returnShortReasonInvalidAccountDetails,
|
|
53
50
|
title: t.returnedTitleInvalidAccountDetails,
|
|
54
51
|
explanation: t.returnedExplanationInvalidAccountDetails
|
|
55
52
|
};
|
|
56
53
|
case "ACCOUNT_CANNOT_RECEIVE": return {
|
|
57
|
-
short: t.returnShortReasonAccountCannotReceive,
|
|
58
54
|
title: t.returnedTitleAccountCannotReceive,
|
|
59
55
|
explanation: t.returnedExplanationAccountCannotReceive
|
|
60
56
|
};
|
|
61
57
|
case "REFUSED_BY_RECEIVER": return {
|
|
62
|
-
short: t.returnShortReasonRefusedByReceiver,
|
|
63
58
|
title: t.returnedTitleRefusedByReceiver,
|
|
64
59
|
explanation: t.returnedExplanationRefusedByReceiver
|
|
65
60
|
};
|
|
66
61
|
default: return {
|
|
67
|
-
short: void 0,
|
|
68
62
|
title: t.returnedTitleGeneric,
|
|
69
63
|
explanation: t.returnedExplanationGeneric
|
|
70
64
|
};
|
|
@@ -97,7 +91,6 @@ function f(t, n, r, i) {
|
|
|
97
91
|
...a,
|
|
98
92
|
rowKey: t.id,
|
|
99
93
|
dateLabel: l(t.createdDateTime, { dateStyle: "medium" }, i.unavailableLabel),
|
|
100
|
-
statusReasonLabel: t.status === "RETURNED" ? c(t.returnCategory, r).short : void 0,
|
|
101
94
|
ariaLabel: e(r.rowAriaLabel, {
|
|
102
95
|
amount: a.amountLabel,
|
|
103
96
|
from: a.from.name,
|
|
@@ -121,14 +114,14 @@ function p(t, n, r, i) {
|
|
|
121
114
|
if (t.status !== "RETURNED") return s;
|
|
122
115
|
let u = c(t.returnCategory, r), f = o.from.kind === "external" ? o.from : o.to, p = o.from.kind === "internal" ? ` ${e(r.returnedRefundSentence, {
|
|
123
116
|
amount: o.amountLabel,
|
|
124
|
-
account: a(o.from)
|
|
117
|
+
account: a(o.from, r)
|
|
125
118
|
})}` : "";
|
|
126
119
|
return {
|
|
127
120
|
...s,
|
|
128
121
|
returnedBanner: {
|
|
129
122
|
title: u.title,
|
|
130
123
|
description: `${u.explanation}${p}`,
|
|
131
|
-
nextStep: e(r.returnedPausedSentence, { account: a(f) })
|
|
124
|
+
nextStep: e(r.returnedPausedSentence, { account: a(f, r) })
|
|
132
125
|
}
|
|
133
126
|
};
|
|
134
127
|
}
|
|
@@ -2,31 +2,31 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
"use client";
|
|
4
4
|
"use client";
|
|
5
|
-
import {
|
|
6
|
-
import { coerceAmountValueToMinorUnits as
|
|
7
|
-
import { amountOutputToMajorUnits as
|
|
8
|
-
import { currencySymbolForCode as
|
|
9
|
-
import { parseDecimalAmountToMinorUnits as
|
|
5
|
+
import { formatLabel as e, toast as t } from "../../../../../../../packages/shared-ui-shadcn/dist/index.js";
|
|
6
|
+
import { coerceAmountValueToMinorUnits as n } from "../../../../../shared/util/dist/lib/coerceAmountValueToMinorUnits.js";
|
|
7
|
+
import { amountOutputToMajorUnits as r, minorExponentForCurrency as i } from "../../../../../shared/util/dist/lib/amountOutputToMajorUnits.js";
|
|
8
|
+
import { currencySymbolForCode as a, formatMoneyExact as o } from "../../../../../shared/util/dist/lib/formatMoneyExact.js";
|
|
9
|
+
import { parseDecimalAmountToMinorUnits as s } from "../../../../../shared/util/dist/lib/parseDecimalAmountToMinorUnits.js";
|
|
10
10
|
import "../../../../../shared/util/dist/index.js";
|
|
11
11
|
import "../../../../../shared/ui/dist/index.js";
|
|
12
|
-
import { TRANSFERS_ANALYTICS_EVENTS as
|
|
13
|
-
import { useCreateBookTransferMutation as
|
|
14
|
-
import { useCreateAchMoneyMovementMutation as
|
|
12
|
+
import { TRANSFERS_ANALYTICS_EVENTS as c } from "../analytics/events.js";
|
|
13
|
+
import { useCreateBookTransferMutation as ee } from "../../../../data-access/dist/index7.js";
|
|
14
|
+
import { useCreateAchMoneyMovementMutation as l } from "../../../../data-access/dist/index8.js";
|
|
15
15
|
import "../../../../data-access/dist/index.js";
|
|
16
|
-
import { useCallback as
|
|
17
|
-
import { useControllableState as
|
|
16
|
+
import { useCallback as u, useEffect as d, useMemo as f, useState as p } from "react";
|
|
17
|
+
import { useControllableState as te } from "@radix-ui/react-use-controllable-state";
|
|
18
18
|
// ../../libs/tesouro-embedded-components-react/transfers-widget/feature/dist/lib/TransfersWidget/useTransferMoneyModalController.js
|
|
19
19
|
function m(e) {
|
|
20
20
|
return e.slice(-4);
|
|
21
21
|
}
|
|
22
22
|
function h(e, t) {
|
|
23
|
-
let
|
|
24
|
-
if (!
|
|
25
|
-
let i =
|
|
26
|
-
value:
|
|
23
|
+
let n = e.balance;
|
|
24
|
+
if (!n || n.value === void 0 || n.value === null) return;
|
|
25
|
+
let i = n.currencyCode ?? t, a = r({
|
|
26
|
+
value: n.value,
|
|
27
27
|
currencyCode: i
|
|
28
28
|
});
|
|
29
|
-
return a
|
|
29
|
+
return o(a, {
|
|
30
30
|
currencyCode: i,
|
|
31
31
|
includeSpaceAfterCurrencySymbol: !1
|
|
32
32
|
});
|
|
@@ -37,260 +37,201 @@ function g(e, t, n, r) {
|
|
|
37
37
|
let a = n.find((e) => e.id === t);
|
|
38
38
|
return a?.balance?.currencyCode ? a.balance.currencyCode : r;
|
|
39
39
|
}
|
|
40
|
-
function
|
|
41
|
-
let r =
|
|
40
|
+
function _(e, t, n) {
|
|
41
|
+
let r = e.nickname?.trim() || t.accountFallbackName, i = h(e, n.defaultCurrencyCode);
|
|
42
42
|
return {
|
|
43
43
|
optionValue: e.id,
|
|
44
|
-
primaryLabel:
|
|
45
|
-
|
|
46
|
-
balanceLabel:
|
|
44
|
+
primaryLabel: r,
|
|
45
|
+
number: { last4: m(e.accountNumber) },
|
|
46
|
+
balanceLabel: i
|
|
47
47
|
};
|
|
48
48
|
}
|
|
49
|
-
function
|
|
50
|
-
let
|
|
49
|
+
function v(e) {
|
|
50
|
+
let t = e.nickname?.trim() || e.nameOnAccount;
|
|
51
51
|
return {
|
|
52
52
|
optionValue: e.id,
|
|
53
|
-
primaryLabel:
|
|
54
|
-
|
|
53
|
+
primaryLabel: t,
|
|
54
|
+
number: { last4: m(e.accountNumber) }
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
|
-
function
|
|
57
|
+
function y(e, t) {
|
|
58
58
|
return {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
59
|
+
name: e?.primaryLabel ?? "",
|
|
60
|
+
...t && { number: {
|
|
61
|
+
last4: m(t),
|
|
62
|
+
fullNumber: t
|
|
63
|
+
} }
|
|
64
64
|
};
|
|
65
65
|
}
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
var ne = 2;
|
|
67
|
+
function b({ labels: r, featureLabels: m, embeddedBankAccounts: h, verifiedExternalBankAccounts: b, track: x, isTransferMoneyOpen: re, defaultIsTransferMoneyOpen: ie, onTransferMoneyOpenChange: ae }) {
|
|
68
|
+
let S = ee(), C = l(), w = f(() => new Set(h.map((e) => e.id)), [h]), T = f(() => h.map((e) => _(e, r, m)), [
|
|
68
69
|
h,
|
|
69
70
|
m,
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
onChange: C,
|
|
71
|
+
r.accountFallbackName
|
|
72
|
+
]), E = f(() => b.map((e) => v(e)), [b]), D = f(() => [...T, ...E], [T, E]), [O, k] = te({
|
|
73
|
+
prop: re,
|
|
74
|
+
defaultProp: ie ?? !1,
|
|
75
|
+
onChange: ae,
|
|
76
76
|
caller: "TransfersWidget"
|
|
77
|
-
}), [M, N] =
|
|
78
|
-
N("
|
|
79
|
-
}, []),
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}, [
|
|
77
|
+
}), [A, j] = p("accounts"), [M, N] = p(""), [P, F] = p(""), [I, L] = p(""), [oe, R] = p(null), [z, B] = p(null), [V, H] = p(null), [U, W] = p(!1), [G, K] = p(0), q = u(() => {
|
|
78
|
+
N(""), F(""), L(""), R(null), B(null), H(null), W(!1);
|
|
79
|
+
}, []), se = u(() => {
|
|
80
|
+
j("accounts"), q();
|
|
81
|
+
}, [q]), [ce, le] = p(O);
|
|
82
|
+
O !== ce && (le(O), O && se()), d(() => {
|
|
83
|
+
O && x(c.TransferMoneyOpened);
|
|
84
|
+
}, [O, x]);
|
|
85
|
+
let ue = u((e) => {
|
|
86
|
+
k(e);
|
|
87
|
+
}, [k]), de = u(() => {
|
|
88
|
+
k(!0);
|
|
89
|
+
}, [k]), J = w.has(M), Y = w.has(P), X = f(() => g(M, P, h, m.defaultCurrencyCode), [
|
|
88
90
|
h,
|
|
89
91
|
m.defaultCurrencyCode,
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
]),
|
|
93
|
-
|
|
92
|
+
M,
|
|
93
|
+
P
|
|
94
|
+
]), Z = u((e, t, i) => {
|
|
95
|
+
let a = s(e, g(t, i, h, m.defaultCurrencyCode));
|
|
96
|
+
if (a === null) return r.modalAmountInvalidError;
|
|
97
|
+
let o = h.find((e) => e.id === t);
|
|
98
|
+
return o && a > n(o.balance?.value) ? r.modalInsufficientFundsError : null;
|
|
99
|
+
}, [
|
|
100
|
+
h,
|
|
101
|
+
m.defaultCurrencyCode,
|
|
102
|
+
r.modalAmountInvalidError,
|
|
103
|
+
r.modalInsufficientFundsError
|
|
104
|
+
]), Q = f(() => a(X), [X]), fe = f(() => P ? Y ? D.filter((e) => e.optionValue !== P) : T.filter((e) => e.optionValue !== P) : D, [
|
|
94
105
|
D,
|
|
95
|
-
|
|
106
|
+
T,
|
|
107
|
+
P,
|
|
96
108
|
Y
|
|
97
|
-
]),
|
|
98
|
-
k,
|
|
109
|
+
]), pe = f(() => M ? J ? D.filter((e) => e.optionValue !== M) : T.filter((e) => e.optionValue !== M) : D, [
|
|
99
110
|
D,
|
|
100
|
-
|
|
111
|
+
T,
|
|
112
|
+
M,
|
|
101
113
|
J
|
|
102
|
-
]),
|
|
103
|
-
|
|
104
|
-
if (a === null || !E.has(e)) {
|
|
105
|
-
B(null);
|
|
106
|
-
return;
|
|
107
|
-
}
|
|
108
|
-
let s = h.find((t) => t.id === e);
|
|
109
|
-
if (!s) {
|
|
110
|
-
B(null);
|
|
111
|
-
return;
|
|
112
|
-
}
|
|
113
|
-
let c = t(s.balance?.value);
|
|
114
|
-
B(a > c ? n.modalInsufficientFundsError : null);
|
|
115
|
-
}, [
|
|
116
|
-
h,
|
|
117
|
-
E,
|
|
118
|
-
n.modalInsufficientFundsError
|
|
119
|
-
]), se = l((e) => {
|
|
120
|
-
F(e);
|
|
121
|
-
let t = g(e, I, h, m.defaultCurrencyCode);
|
|
122
|
-
Q(e, R, t);
|
|
123
|
-
}, [
|
|
124
|
-
R,
|
|
125
|
-
h,
|
|
126
|
-
m.defaultCurrencyCode,
|
|
127
|
-
Q,
|
|
128
|
-
I
|
|
129
|
-
]), ce = l((e) => {
|
|
130
|
-
L(e);
|
|
131
|
-
let t = g(P, e, h, m.defaultCurrencyCode);
|
|
132
|
-
Q(P, R, t);
|
|
114
|
+
]), me = u((e) => {
|
|
115
|
+
N(e), R(null), H(U ? Z(I, e, P) : null);
|
|
133
116
|
}, [
|
|
134
|
-
|
|
135
|
-
h,
|
|
136
|
-
m.defaultCurrencyCode,
|
|
117
|
+
I,
|
|
137
118
|
P,
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
119
|
+
Z,
|
|
120
|
+
U
|
|
121
|
+
]), he = u((e) => {
|
|
122
|
+
F(e), B(null), H(U ? Z(I, M, e) : null);
|
|
141
123
|
}, [
|
|
124
|
+
I,
|
|
125
|
+
M,
|
|
126
|
+
Z,
|
|
127
|
+
U
|
|
128
|
+
]), ge = u((e) => {
|
|
129
|
+
L(e), H(U ? Z(e, M, P) : null);
|
|
130
|
+
}, [
|
|
131
|
+
M,
|
|
142
132
|
P,
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
]),
|
|
146
|
-
|
|
147
|
-
}, []), de = d(() => {
|
|
148
|
-
let e = o(R, X);
|
|
133
|
+
Z,
|
|
134
|
+
U
|
|
135
|
+
]), _e = f(() => {
|
|
136
|
+
let e = s(I, X);
|
|
149
137
|
if (e === null) return "";
|
|
150
|
-
let t =
|
|
151
|
-
return
|
|
138
|
+
let t = i(X);
|
|
139
|
+
return o(e / 10 ** t, {
|
|
152
140
|
currencyCode: X,
|
|
153
141
|
includeSpaceAfterCurrencySymbol: !1
|
|
154
142
|
});
|
|
155
|
-
}, [
|
|
156
|
-
|
|
157
|
-
return v(e, t?.accountNumber ?? r?.accountNumber, !!r, n.modalAvailableBalanceCaption, n.modalReviewAccountNumberPrefix);
|
|
158
|
-
}, [
|
|
159
|
-
k,
|
|
143
|
+
}, [I, X]), $ = u((e) => y(D.find((t) => t.optionValue === e), h.find((t) => t.id === e)?.accountNumber ?? b.find((t) => t.id === e)?.accountNumber), [
|
|
144
|
+
D,
|
|
160
145
|
h,
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
]), $ = d(() => {
|
|
166
|
-
let e = k.find((e) => e.optionValue === I), t = h.find((e) => e.id === I), r = y.find((e) => e.id === I);
|
|
167
|
-
return v(e, t?.accountNumber ?? r?.accountNumber, !!r, n.modalAvailableBalanceCaption, n.modalReviewAccountNumberPrefix);
|
|
146
|
+
b
|
|
147
|
+
]), ve = u(() => {
|
|
148
|
+
let e = M ? null : r.modalFromRequiredError, t = P ? null : r.modalToRequiredError, n = Z(I, M, P);
|
|
149
|
+
W(!0), R(e), B(t), H(n), e || t || n ? K((e) => e + 1) : j("review");
|
|
168
150
|
}, [
|
|
169
|
-
k,
|
|
170
|
-
h,
|
|
171
|
-
n.modalAvailableBalanceCaption,
|
|
172
|
-
n.modalReviewAccountNumberPrefix,
|
|
173
151
|
I,
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
let e = o(R, X);
|
|
178
|
-
if (e === null) B(n.modalAmountInvalidError);
|
|
179
|
-
else {
|
|
180
|
-
if (J) {
|
|
181
|
-
let r = h.find((e) => e.id === P);
|
|
182
|
-
if (r && e > t(r.balance?.value)) {
|
|
183
|
-
B(n.modalInsufficientFundsError);
|
|
184
|
-
return;
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
B(null), N("review");
|
|
188
|
-
}
|
|
189
|
-
}, [
|
|
190
|
-
R,
|
|
191
|
-
Z,
|
|
192
|
-
h,
|
|
193
|
-
J,
|
|
194
|
-
P,
|
|
195
|
-
n.modalAmountInvalidError,
|
|
196
|
-
n.modalInsufficientFundsError,
|
|
197
|
-
X
|
|
198
|
-
]), me = l(() => {
|
|
199
|
-
let e = o(R, X);
|
|
200
|
-
if (e === null) B(n.modalAmountInvalidError);
|
|
201
|
-
else {
|
|
202
|
-
if (J) {
|
|
203
|
-
let r = h.find((e) => e.id === P);
|
|
204
|
-
if (r && e > t(r.balance?.value)) {
|
|
205
|
-
B(n.modalInsufficientFundsError);
|
|
206
|
-
return;
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
B(null), N("review");
|
|
210
|
-
}
|
|
211
|
-
}, [
|
|
212
|
-
R,
|
|
213
|
-
h,
|
|
214
|
-
J,
|
|
152
|
+
M,
|
|
153
|
+
r.modalFromRequiredError,
|
|
154
|
+
r.modalToRequiredError,
|
|
215
155
|
P,
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
]),
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
if (t === null) {
|
|
224
|
-
B(n.modalAmountInvalidError);
|
|
156
|
+
Z
|
|
157
|
+
]), ye = u(() => {
|
|
158
|
+
j("accounts");
|
|
159
|
+
}, []), be = u(async () => {
|
|
160
|
+
let e = s(I, X);
|
|
161
|
+
if (e === null) {
|
|
162
|
+
H(r.modalAmountInvalidError);
|
|
225
163
|
return;
|
|
226
164
|
}
|
|
227
165
|
if (!J && !Y) {
|
|
228
|
-
|
|
166
|
+
t.error(r.modalUnsupportedPairError);
|
|
229
167
|
return;
|
|
230
168
|
}
|
|
231
|
-
let
|
|
232
|
-
|
|
169
|
+
let n;
|
|
170
|
+
n = J && Y ? "INTERNAL_TO_INTERNAL" : J && !Y ? "INTERNAL_TO_EXTERNAL" : "EXTERNAL_TO_INTERNAL";
|
|
233
171
|
try {
|
|
234
|
-
|
|
235
|
-
fromBankAccountId:
|
|
236
|
-
toBankAccountId:
|
|
237
|
-
amount:
|
|
172
|
+
n === "INTERNAL_TO_INTERNAL" ? await S.mutateAsync({ body: {
|
|
173
|
+
fromBankAccountId: M,
|
|
174
|
+
toBankAccountId: P,
|
|
175
|
+
amount: e,
|
|
238
176
|
currencyCode: X
|
|
239
|
-
} }) : await
|
|
240
|
-
fromBankAccountId:
|
|
241
|
-
toBankAccountId:
|
|
242
|
-
amount:
|
|
177
|
+
} }) : await C.mutateAsync({ body: {
|
|
178
|
+
fromBankAccountId: M,
|
|
179
|
+
toBankAccountId: P,
|
|
180
|
+
amount: e,
|
|
243
181
|
currencyCode: X,
|
|
244
|
-
type:
|
|
182
|
+
type: n,
|
|
245
183
|
secCode: m.defaultSecCode
|
|
246
|
-
} }),
|
|
184
|
+
} }), j("result"), x(c.TransferSubmitted, { transferType: n });
|
|
247
185
|
} catch {
|
|
248
|
-
|
|
186
|
+
t.error(r.modalSubmitFailedError);
|
|
249
187
|
}
|
|
250
188
|
}, [
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
189
|
+
I,
|
|
190
|
+
C,
|
|
191
|
+
S,
|
|
254
192
|
J,
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
193
|
+
M,
|
|
194
|
+
r.modalSubmitFailedError,
|
|
195
|
+
r.modalUnsupportedPairError,
|
|
196
|
+
r.modalAmountInvalidError,
|
|
259
197
|
Y,
|
|
260
|
-
|
|
261
|
-
|
|
198
|
+
P,
|
|
199
|
+
x,
|
|
262
200
|
X,
|
|
263
201
|
m.defaultSecCode
|
|
264
202
|
]);
|
|
265
203
|
return {
|
|
266
204
|
modalProps: {
|
|
267
|
-
open:
|
|
268
|
-
onOpenChange:
|
|
269
|
-
step:
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
205
|
+
open: O,
|
|
206
|
+
onOpenChange: ue,
|
|
207
|
+
step: A,
|
|
208
|
+
stepLabel: A === "result" ? void 0 : e(r.modalStepLabel, {
|
|
209
|
+
current: String(A === "review" ? 2 : 1),
|
|
210
|
+
total: String(ne)
|
|
211
|
+
}),
|
|
212
|
+
fromOptions: fe,
|
|
213
|
+
toOptions: pe,
|
|
214
|
+
fromValue: M,
|
|
215
|
+
toValue: P,
|
|
216
|
+
onFromValueChange: me,
|
|
217
|
+
onToValueChange: he,
|
|
218
|
+
fromError: oe,
|
|
219
|
+
toError: z,
|
|
220
|
+
amountValue: I,
|
|
221
|
+
onAmountValueChange: ge,
|
|
222
|
+
amountError: V,
|
|
223
|
+
amountInputPrefix: Q,
|
|
224
|
+
reviewFromAccount: $(M),
|
|
225
|
+
reviewToAccount: $(P),
|
|
226
|
+
reviewAmountLabel: _e,
|
|
227
|
+
isSubmitting: S.isPending || C.isPending,
|
|
228
|
+
onContinueFromAccounts: ve,
|
|
229
|
+
onBack: ye,
|
|
230
|
+
onSubmit: () => void be(),
|
|
231
|
+
onClearSelections: q,
|
|
232
|
+
scrollToErrorToken: G
|
|
292
233
|
},
|
|
293
|
-
openModal:
|
|
234
|
+
openModal: de
|
|
294
235
|
};
|
|
295
236
|
}
|
|
296
|
-
export {
|
|
237
|
+
export { b as useTransferMoneyModalController };
|
package/dist/libs/tesouro-embedded-components-react/transfers-widget/feature/dist/mocks/labels.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// ../../libs/tesouro-embedded-components-react/transfers-widget/feature/dist/mocks/labels.js
|
|
2
2
|
var e = {
|
|
3
3
|
blurbs: {
|
|
4
|
-
populated: "Recent transfers across three accounts: completed, pending and failed, internal and to or from an external account.
|
|
4
|
+
populated: "Recent transfers across three accounts: completed, pending and failed, internal and to or from an external account. Each account shows its masked number under it, and every transfer carries a status badge. Transfer money moves money between your accounts or to and from Operating reserve, and the new transfer lands in the list as pending.",
|
|
5
5
|
empty: "Three accounts and no transfers yet. Transfer money is enabled, and a submitted transfer becomes the first row.",
|
|
6
6
|
loading: "The accounts read is held open, so the list skeleton stays on screen.",
|
|
7
7
|
error: "The transfers read fails with a 500. The widget shows its own error with Try again; Transfer money still works, because the accounts themselves loaded.",
|