@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.
Files changed (56) hide show
  1. package/dist/experimental/QuickViewWidget.d.ts +11 -0
  2. package/dist/experimental/RemoteCheckCapture.d.ts +11 -0
  3. package/dist/experimental/index.d.ts +11 -0
  4. package/dist/index.css +15 -50
  5. package/dist/index.d.ts +54 -13
  6. package/dist/lib/AcceptDisclosuresWidget.d.ts +11 -0
  7. package/dist/lib/BalancesWidget.d.ts +11 -0
  8. package/dist/lib/BankAccountOnboardingWidget.d.ts +11 -0
  9. package/dist/lib/BankAccountsWidget.d.ts +11 -0
  10. package/dist/lib/BankingComplianceBannerWidget.d.ts +11 -0
  11. package/dist/lib/BillPayWidget.d.ts +11 -0
  12. package/dist/lib/CardDetailsWidget.d.ts +11 -0
  13. package/dist/lib/CounterpartsWidget.d.ts +11 -0
  14. package/dist/lib/CounterpartsWidgetPublic.d.ts +11 -0
  15. package/dist/lib/CreditCardsWidget.d.ts +11 -0
  16. package/dist/lib/CustomersWidget.d.ts +11 -0
  17. package/dist/lib/DebitCardsWidget.d.ts +11 -0
  18. package/dist/lib/ExpenseManagementWidget.d.ts +11 -0
  19. package/dist/lib/InsightsWidget.d.ts +11 -0
  20. package/dist/lib/LinkedAccountsWidget.d.ts +11 -0
  21. package/dist/lib/OfferWidget.d.ts +11 -0
  22. package/dist/lib/ProductsWidget.d.ts +11 -0
  23. package/dist/lib/ReceivablesWidget.d.ts +11 -0
  24. package/dist/lib/SettingsWidget.d.ts +11 -0
  25. package/dist/lib/TransfersWidget.d.ts +54 -13
  26. package/dist/lib/WidgetProvider.d.ts +11 -0
  27. package/dist/lib/WidgetProviderPublic.d.ts +11 -0
  28. package/dist/lib/WidgetSuite.d.ts +54 -13
  29. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  30. package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/index.js +15 -12
  31. package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/lib/AmountInput/AmountInput.js +30 -0
  32. package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/lib/LoadingRegion/LoadingRegion.js +14 -1
  33. package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/lib/MaskedAccountNumber/MaskedAccountNumber.js +57 -0
  34. package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/lib/MaskedAccountNumber/labels.js +7 -0
  35. package/dist/libs/tesouro-embedded-components-react/transfers-widget/feature/dist/lib/TransfersWidget/TransfersWidgetInner.js +4 -2
  36. package/dist/libs/tesouro-embedded-components-react/transfers-widget/feature/dist/lib/TransfersWidget/testIds.js +2 -2
  37. package/dist/libs/tesouro-embedded-components-react/transfers-widget/feature/dist/lib/TransfersWidget/transferViews.js +10 -17
  38. package/dist/libs/tesouro-embedded-components-react/transfers-widget/feature/dist/lib/TransfersWidget/useTransferMoneyModalController.js +159 -218
  39. package/dist/libs/tesouro-embedded-components-react/transfers-widget/feature/dist/mocks/labels.js +1 -1
  40. package/dist/libs/tesouro-embedded-components-react/transfers-widget/ui/dist/lib/TransferMoneyModal/ReviewTransferStep.js +37 -88
  41. package/dist/libs/tesouro-embedded-components-react/transfers-widget/ui/dist/lib/TransferMoneyModal/TransferMoneyModal.js +184 -245
  42. package/dist/libs/tesouro-embedded-components-react/transfers-widget/ui/dist/lib/TransferMoneyModal/TransferResultStep.js +43 -58
  43. package/dist/libs/tesouro-embedded-components-react/transfers-widget/ui/dist/lib/TransferMoneyModal/reviewTransferStepLabels.js +6 -5
  44. package/dist/libs/tesouro-embedded-components-react/transfers-widget/ui/dist/lib/TransferMoneyModal/transferResultStepLabels.js +7 -6
  45. package/dist/libs/tesouro-embedded-components-react/transfers-widget/ui/dist/lib/TransferMoneyModal/useFocusFirstInvalidField.js +9 -0
  46. package/dist/libs/tesouro-embedded-components-react/transfers-widget/ui/dist/lib/TransfersWidget/TransferAccountValue.js +32 -0
  47. package/dist/libs/tesouro-embedded-components-react/transfers-widget/ui/dist/lib/TransfersWidget/TransferDetailSheet.js +68 -101
  48. package/dist/libs/tesouro-embedded-components-react/transfers-widget/ui/dist/lib/TransfersWidget/TransfersWidget.js +155 -153
  49. package/dist/libs/tesouro-embedded-components-react/transfers-widget/ui/dist/lib/TransfersWidget/labels.js +20 -11
  50. package/dist/libs/tesouro-embedded-components-react/transfers-widget/ui/dist/lib/TransfersWidget/maskLabels.js +7 -0
  51. package/dist/packages/shared-ui-shadcn/dist/index.js +1846 -1603
  52. package/package.json +1 -1
  53. package/dist/libs/tesouro-embedded-components-react/transfers-widget/ui/dist/lib/TransferMoneyModal/TransferMoneyModalHeader.js +0 -29
  54. package/dist/libs/tesouro-embedded-components-react/transfers-widget/ui/dist/lib/TransferMoneyModal/TransferReviewAccountCard.js +0 -64
  55. package/dist/libs/tesouro-embedded-components-react/transfers-widget/ui/dist/lib/TransfersWidget/TransferAccountTile.js +0 -14
  56. 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 };
@@ -0,0 +1,7 @@
1
+ // ../../libs/tesouro-embedded-components-react/shared/ui/dist/lib/MaskedAccountNumber/labels.js
2
+ var e = {
3
+ endingIn: "ending in {last4}",
4
+ showNumber: "Show number",
5
+ hideNumber: "Hide number"
6
+ };
7
+ export { e as MASKED_ACCOUNT_NUMBER_LABELS_EN };
@@ -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: { backToTransfers: c.modalBackToTransfersButton }
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
- modalBackToTransfersButton: "embedded-banking-transfer-money-back-to-transfers-button"
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, r) {
21
- let i = n.get(t.id), a = i?.kind ?? "external";
20
+ function i(e, t, n) {
21
+ let r = t.get(e.id), i = r?.kind ?? "external";
22
22
  return {
23
- kind: a,
24
- kindLabel: a === "internal" ? r.accountKindInternal : r.accountKindExternal,
25
- name: i?.name ?? (t.nickname?.trim() || r.externalAccountFallbackName),
26
- ...i && { maskLabel: e(r.accountMaskTemplate, { last4: i.last4 }) },
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 = (e) => e.maskLabel ? `${e.name} ${e.maskLabel}` : e.name, o = {
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: "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 { toast as e } from "../../../../../../../packages/shared-ui-shadcn/dist/index.js";
6
- import { coerceAmountValueToMinorUnits as t } from "../../../../../shared/util/dist/lib/coerceAmountValueToMinorUnits.js";
7
- import { amountOutputToMajorUnits as n, minorExponentForCurrency as r } from "../../../../../shared/util/dist/lib/amountOutputToMajorUnits.js";
8
- import { currencySymbolForCode as i, formatMoneyExact as a } from "../../../../../shared/util/dist/lib/formatMoneyExact.js";
9
- import { parseDecimalAmountToMinorUnits as o } from "../../../../../shared/util/dist/lib/parseDecimalAmountToMinorUnits.js";
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 s } from "../analytics/events.js";
13
- import { useCreateBookTransferMutation as c } from "../../../../data-access/dist/index7.js";
14
- import { useCreateAchMoneyMovementMutation as ee } from "../../../../data-access/dist/index8.js";
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 l, useEffect as u, useMemo as d, useState as f } from "react";
17
- import { useControllableState as p } from "@radix-ui/react-use-controllable-state";
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 r = e.balance;
24
- if (!r || r.value === void 0 || r.value === null) return;
25
- let i = r.currencyCode ?? t, o = n({
26
- value: r.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(o, {
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 te(e, t, n) {
41
- let r = m(e.accountNumber), i = e.nickname?.trim() || t.accountFallbackName, a = h(e, n.defaultCurrencyCode);
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: i,
45
- secondaryLabel: `${t.embeddedAccountMaskPrefix}${r}`,
46
- balanceLabel: a
44
+ primaryLabel: r,
45
+ number: { last4: m(e.accountNumber) },
46
+ balanceLabel: i
47
47
  };
48
48
  }
49
- function _(e, t) {
50
- let n = m(e.accountNumber), r = e.nickname?.trim() || e.nameOnAccount;
49
+ function v(e) {
50
+ let t = e.nickname?.trim() || e.nameOnAccount;
51
51
  return {
52
52
  optionValue: e.id,
53
- primaryLabel: r,
54
- secondaryLabel: `${t.embeddedAccountMaskPrefix}${n}`
53
+ primaryLabel: t,
54
+ number: { last4: m(e.accountNumber) }
55
55
  };
56
56
  }
57
- function v(e, t, n, r, i) {
57
+ function y(e, t) {
58
58
  return {
59
- primaryLabel: e?.primaryLabel ?? "",
60
- accountDetailLabel: t ? `${i} ${t}` : e?.secondaryLabel ?? "",
61
- balanceLabel: e?.balanceLabel,
62
- availableBalanceCaption: e?.balanceLabel ? r : void 0,
63
- showInstitutionIcon: n
59
+ name: e?.primaryLabel ?? "",
60
+ ...t && { number: {
61
+ last4: m(t),
62
+ fullNumber: t
63
+ } }
64
64
  };
65
65
  }
66
- function y({ labels: n, featureLabels: m, embeddedBankAccounts: h, verifiedExternalBankAccounts: y, track: b, isTransferMoneyOpen: x, defaultIsTransferMoneyOpen: S, onTransferMoneyOpenChange: C }) {
67
- let w = c(), T = ee(), E = d(() => new Set(h.map((e) => e.id)), [h]), D = d(() => h.map((e) => te(e, n, m)), [
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
- n.accountFallbackName,
71
- n.embeddedAccountMaskPrefix
72
- ]), O = d(() => y.map((e) => _(e, n)), [n.embeddedAccountMaskPrefix, y]), k = d(() => [...D, ...O], [D, O]), [A, j] = p({
73
- prop: x,
74
- defaultProp: S ?? !1,
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] = f("accounts"), [P, F] = f(""), [I, L] = f(""), [R, z] = f(""), [ne, B] = f(null), [V, H] = f(!1), U = l(() => {
78
- N("accounts"), F(""), L(""), z(""), B(null), H(!1);
79
- }, []), [W, G] = f(A);
80
- A !== W && (G(A), A && U()), u(() => {
81
- A && b(s.TransferMoneyOpened);
82
- }, [A, b]);
83
- let K = l((e) => {
84
- j(e);
85
- }, [j]), q = l(() => {
86
- j(!0);
87
- }, [j]), J = E.has(P), Y = E.has(I), X = d(() => g(P, I, h, m.defaultCurrencyCode), [
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
- P,
91
- I
92
- ]), re = d(() => i(X), [X]), ie = d(() => I ? Y ? k.filter((e) => e.optionValue !== I) : D.filter((e) => e.optionValue !== I) : k, [
93
- k,
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
- I,
106
+ T,
107
+ P,
96
108
  Y
97
- ]), ae = d(() => P ? J ? k.filter((e) => e.optionValue !== P) : D.filter((e) => e.optionValue !== P) : k, [
98
- k,
109
+ ]), pe = f(() => M ? J ? D.filter((e) => e.optionValue !== M) : T.filter((e) => e.optionValue !== M) : D, [
99
110
  D,
100
- P,
111
+ T,
112
+ M,
101
113
  J
102
- ]), Z = !!(P && I && P !== I), oe = d(() => o(R, X) !== null, [R, X]), Q = l((e, r, i) => {
103
- let a = o(r, i);
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
- R,
135
- h,
136
- m.defaultCurrencyCode,
117
+ I,
137
118
  P,
138
- Q
139
- ]), le = l((e) => {
140
- z(e), Q(P, e, X);
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
- Q,
144
- X
145
- ]), ue = l(() => {
146
- F(""), L(""), z(""), B(null);
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 = r(X);
151
- return a(e / 10 ** t, {
138
+ let t = i(X);
139
+ return o(e / 10 ** t, {
152
140
  currencyCode: X,
153
141
  includeSpaceAfterCurrencySymbol: !1
154
142
  });
155
- }, [R, X]), fe = d(() => {
156
- let e = k.find((e) => e.optionValue === P), t = h.find((e) => e.id === P), r = y.find((e) => e.id === P);
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
- P,
162
- n.modalAvailableBalanceCaption,
163
- n.modalReviewAccountNumberPrefix,
164
- y
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
- y
175
- ]), pe = l(() => {
176
- if (!Z) return;
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
- n.modalAmountInvalidError,
217
- n.modalInsufficientFundsError,
218
- X
219
- ]), he = l(() => {
220
- (M === "amount" || M === "review") && N("accounts");
221
- }, [M]), ge = l(async () => {
222
- let t = o(R, X);
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
- e.error(n.modalUnsupportedPairError);
166
+ t.error(r.modalUnsupportedPairError);
229
167
  return;
230
168
  }
231
- let r;
232
- r = J && Y ? "INTERNAL_TO_INTERNAL" : J && !Y ? "INTERNAL_TO_EXTERNAL" : "EXTERNAL_TO_INTERNAL";
169
+ let n;
170
+ n = J && Y ? "INTERNAL_TO_INTERNAL" : J && !Y ? "INTERNAL_TO_EXTERNAL" : "EXTERNAL_TO_INTERNAL";
233
171
  try {
234
- r === "INTERNAL_TO_INTERNAL" ? await w.mutateAsync({ body: {
235
- fromBankAccountId: P,
236
- toBankAccountId: I,
237
- amount: t,
172
+ n === "INTERNAL_TO_INTERNAL" ? await S.mutateAsync({ body: {
173
+ fromBankAccountId: M,
174
+ toBankAccountId: P,
175
+ amount: e,
238
176
  currencyCode: X
239
- } }) : await T.mutateAsync({ body: {
240
- fromBankAccountId: P,
241
- toBankAccountId: I,
242
- amount: t,
177
+ } }) : await C.mutateAsync({ body: {
178
+ fromBankAccountId: M,
179
+ toBankAccountId: P,
180
+ amount: e,
243
181
  currencyCode: X,
244
- type: r,
182
+ type: n,
245
183
  secCode: m.defaultSecCode
246
- } }), H(!0), N("result"), b(s.TransferSubmitted, { transferType: r });
184
+ } }), j("result"), x(c.TransferSubmitted, { transferType: n });
247
185
  } catch {
248
- e.error(n.modalSubmitFailedError);
186
+ t.error(r.modalSubmitFailedError);
249
187
  }
250
188
  }, [
251
- R,
252
- T,
253
- w,
189
+ I,
190
+ C,
191
+ S,
254
192
  J,
255
- P,
256
- n.modalSubmitFailedError,
257
- n.modalUnsupportedPairError,
258
- n.modalAmountInvalidError,
193
+ M,
194
+ r.modalSubmitFailedError,
195
+ r.modalUnsupportedPairError,
196
+ r.modalAmountInvalidError,
259
197
  Y,
260
- I,
261
- b,
198
+ P,
199
+ x,
262
200
  X,
263
201
  m.defaultSecCode
264
202
  ]);
265
203
  return {
266
204
  modalProps: {
267
- open: A,
268
- onOpenChange: K,
269
- step: M,
270
- fromOptions: ie,
271
- toOptions: ae,
272
- fromValue: P,
273
- toValue: I,
274
- onFromValueChange: se,
275
- onToValueChange: ce,
276
- amountValue: R,
277
- onAmountValueChange: le,
278
- amountError: ne,
279
- amountInputPrefix: re,
280
- reviewFromAccount: fe,
281
- reviewToAccount: $,
282
- reviewAmountLabel: de,
283
- isSubmitting: w.isPending || T.isPending,
284
- isSuccess: V,
285
- canContinueFromAccounts: Z,
286
- canContinueFromAmount: oe,
287
- onContinueFromAccounts: pe,
288
- onContinueFromAmount: me,
289
- onBack: he,
290
- onSubmit: () => void ge(),
291
- onClearSelections: ue
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: q
234
+ openModal: de
294
235
  };
295
236
  }
296
- export { y as useTransferMoneyModalController };
237
+ export { b as useTransferMoneyModalController };
@@ -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. Hover a row for its status and type. Transfer money moves money between your accounts or to and from Operating reserve, and the new transfer lands in the list as pending.",
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.",