@tesouro/embedded-components-react 0.7.68 → 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.
Files changed (22) hide show
  1. package/README.md +14 -11
  2. package/dist/index.css +15 -6
  3. package/dist/index.d.ts +64 -2
  4. package/dist/lib/LinkedAccountsWidget.d.ts +9 -0
  5. package/dist/lib/TransfersWidget.d.ts +55 -2
  6. package/dist/lib/WidgetSuite.d.ts +63 -1
  7. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/lib/LinkedAccountsWidget.js +6 -4
  8. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/lib/useLinkedAccountsWidget.js +199 -182
  9. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  10. package/dist/libs/tesouro-embedded-components-react/transfers-widget/feature/dist/lib/TransfersWidget/TransfersWidgetFeature.js +4 -3
  11. package/dist/libs/tesouro-embedded-components-react/transfers-widget/feature/dist/lib/TransfersWidget/TransfersWidgetInner.js +99 -108
  12. package/dist/libs/tesouro-embedded-components-react/transfers-widget/feature/dist/lib/TransfersWidget/testIds.js +2 -0
  13. package/dist/libs/tesouro-embedded-components-react/transfers-widget/feature/dist/lib/TransfersWidget/transferViews.js +135 -0
  14. package/dist/libs/tesouro-embedded-components-react/transfers-widget/feature/dist/lib/TransfersWidget/useTransferMoneyModalController.js +140 -153
  15. package/dist/libs/tesouro-embedded-components-react/transfers-widget/ui/dist/lib/TransfersWidget/TransferAccountTile.js +15 -0
  16. package/dist/libs/tesouro-embedded-components-react/transfers-widget/ui/dist/lib/TransfersWidget/TransferDetailSheet.js +111 -0
  17. package/dist/libs/tesouro-embedded-components-react/transfers-widget/ui/dist/lib/TransfersWidget/TransferStatusBadge.js +18 -0
  18. package/dist/libs/tesouro-embedded-components-react/transfers-widget/ui/dist/lib/TransfersWidget/TransfersWidget.js +181 -126
  19. package/dist/libs/tesouro-embedded-components-react/transfers-widget/ui/dist/lib/TransfersWidget/labels.js +33 -0
  20. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/lib/WidgetSuite/sections/TransfersSection.js +16 -8
  21. package/dist/packages/shared-ui-shadcn/dist/index.js +328 -327
  22. 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 l } from "../../../../data-access/dist/index8.js";
13
+ import { useCreateAchMoneyMovementMutation as ee } from "../../../../data-access/dist/index8.js";
14
14
  import "../../../../data-access/dist/index.js";
15
- import { useCallback as u, useEffect as d, useMemo as f, useState as p } from "react";
16
- import { useControllableState as m } from "@radix-ui/react-use-controllable-state";
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 h(e) {
18
+ function m(e) {
19
19
  return e.slice(-4);
20
20
  }
21
- function g(e, t) {
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 _(e, t, n, r) {
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 v(e, t, n) {
40
- let r = h(e.accountNumber), i = e.nickname?.trim() || t.accountFallbackName, a = g(e, n.defaultCurrencyCode);
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 y(e, t) {
49
- let n = h(e.accountNumber), r = e.nickname?.trim() || e.nameOnAccount;
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 b(e, t, n, r, i) {
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 x({ labels: n, featureLabels: h, embeddedBankAccounts: g, verifiedExternalBankAccounts: x, track: S, isTransferMoneyOpen: C, defaultIsTransferMoneyOpen: ee, onTransferMoneyOpenChange: w }) {
66
- let T = c(), E = l(), D = f(() => new Set(g.map((e) => e.id)), [g]), O = f(() => g.map((e) => v(e, n, h)), [
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
- ]), k = f(() => x.map((e) => y(e, n)), [n.embeddedAccountMaskPrefix, x]), A = f(() => [...O, ...k], [O, k]), [j, M] = m({
72
- prop: C,
73
- defaultProp: ee ?? !1,
74
- onChange: w,
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
- }), [N, P] = p("accounts"), [F, I] = p(""), [L, R] = p(""), [z, B] = p(""), [te, V] = p(null), [ne, H] = p(!1), U = u(() => {
77
- P("accounts"), I(""), R(""), B(""), V(null), H(!1);
78
- }, []), [W, G] = p(j);
79
- j !== W && (G(j), j && U()), d(() => {
80
- j && S(s.TransferMoneyOpened);
81
- }, [j, S]);
82
- let K = u((e) => {
83
- M(e);
84
- }, [M]), q = u(() => {
85
- M(!0);
86
- }, [M]), J = D.has(F), Y = D.has(L), X = f(() => _(F, L, g, h.defaultCurrencyCode), [
87
- g,
88
- h.defaultCurrencyCode,
89
- F,
90
- L
91
- ]), re = f(() => i(X), [X]), ie = f(() => L ? Y ? A.filter((e) => e.optionValue !== L) : O.filter((e) => e.optionValue !== L) : A, [
92
- A,
93
- O,
94
- L,
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 = f(() => F ? J ? A.filter((e) => e.optionValue !== F) : O.filter((e) => e.optionValue !== F) : A, [
97
- A,
98
- O,
99
- F,
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 = !!(F && L && F !== L), oe = f(() => o(z, X) !== null, [z, X]), Q = u((e, r, i) => {
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
- V(null);
104
+ B(null);
105
105
  return;
106
106
  }
107
- if (!D.has(e)) {
108
- V(null);
107
+ if (!E.has(e)) {
108
+ B(null);
109
109
  return;
110
110
  }
111
- let s = g.find((t) => t.id === e);
111
+ let s = h.find((t) => t.id === e);
112
112
  if (!s) {
113
- V(null);
113
+ B(null);
114
114
  return;
115
115
  }
116
116
  let c = t(s.balance?.value);
117
- V(a > c ? n.modalInsufficientFundsError : null);
117
+ B(a > c ? n.modalInsufficientFundsError : null);
118
118
  }, [
119
- g,
120
- D,
119
+ h,
120
+ E,
121
121
  n.modalInsufficientFundsError
122
- ]), se = u((e) => {
123
- I(e);
124
- let t = _(e, L, g, h.defaultCurrencyCode);
125
- Q(e, z, t);
122
+ ]), se = l((e) => {
123
+ F(e);
124
+ let t = g(e, I, h, m.defaultCurrencyCode);
125
+ Q(e, R, t);
126
126
  }, [
127
- z,
128
- g,
129
- h.defaultCurrencyCode,
127
+ R,
128
+ h,
129
+ m.defaultCurrencyCode,
130
130
  Q,
131
- L
132
- ]), ce = u((e) => {
133
- R(e);
134
- let t = _(F, e, g, h.defaultCurrencyCode);
135
- Q(F, z, t);
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
- z,
138
- g,
139
- h.defaultCurrencyCode,
140
- F,
137
+ R,
138
+ h,
139
+ m.defaultCurrencyCode,
140
+ P,
141
141
  Q
142
- ]), $ = u((e) => {
143
- B(e), Q(F, e, X);
142
+ ]), le = l((e) => {
143
+ z(e), Q(P, e, X);
144
144
  }, [
145
- F,
145
+ P,
146
146
  Q,
147
147
  X
148
- ]), le = u(() => {
149
- I(""), R(""), B(""), V(null);
150
- }, []), ue = f(() => {
151
- let e = o(z, X);
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
- }, [z, X]), de = f(() => {
159
- let e = A.find((e) => e.optionValue === F), t = g.find((e) => e.id === F), r = x.find((e) => e.id === F);
160
- return b(e, t?.accountNumber ?? r?.accountNumber, !!r, n.modalAvailableBalanceCaption, n.modalReviewAccountNumberPrefix);
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
- A,
163
- g,
164
- F,
162
+ k,
163
+ h,
164
+ P,
165
165
  n.modalAvailableBalanceCaption,
166
166
  n.modalReviewAccountNumberPrefix,
167
- x
168
- ]), fe = f(() => {
169
- let e = A.find((e) => e.optionValue === L), t = g.find((e) => e.id === L), r = x.find((e) => e.id === L);
170
- return b(e, t?.accountNumber ?? r?.accountNumber, !!r, n.modalAvailableBalanceCaption, n.modalReviewAccountNumberPrefix);
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
- A,
173
- g,
172
+ k,
173
+ h,
174
174
  n.modalAvailableBalanceCaption,
175
175
  n.modalReviewAccountNumberPrefix,
176
- L,
177
- x
178
- ]), pe = u(() => {
176
+ I,
177
+ y
178
+ ]), pe = l(() => {
179
179
  if (!Z) return;
180
- let e = o(z, X);
180
+ let e = o(R, X);
181
181
  if (e === null) {
182
- V(n.modalAmountInvalidError);
182
+ B(n.modalAmountInvalidError);
183
183
  return;
184
184
  }
185
185
  if (J) {
186
- let r = g.find((e) => e.id === F);
186
+ let r = h.find((e) => e.id === P);
187
187
  if (r && e > t(r.balance?.value)) {
188
- V(n.modalInsufficientFundsError);
188
+ B(n.modalInsufficientFundsError);
189
189
  return;
190
190
  }
191
191
  }
192
- V(null), P("review");
192
+ B(null), N("review");
193
193
  }, [
194
- z,
194
+ R,
195
195
  Z,
196
- g,
196
+ h,
197
197
  J,
198
- F,
198
+ P,
199
199
  n.modalAmountInvalidError,
200
200
  n.modalInsufficientFundsError,
201
201
  X
202
- ]), me = u(() => {
203
- let e = o(z, X);
202
+ ]), me = l(() => {
203
+ let e = o(R, X);
204
204
  if (e === null) {
205
- V(n.modalAmountInvalidError);
205
+ B(n.modalAmountInvalidError);
206
206
  return;
207
207
  }
208
208
  if (J) {
209
- let r = g.find((e) => e.id === F);
209
+ let r = h.find((e) => e.id === P);
210
210
  if (r && e > t(r.balance?.value)) {
211
- V(n.modalInsufficientFundsError);
211
+ B(n.modalInsufficientFundsError);
212
212
  return;
213
213
  }
214
214
  }
215
- V(null), P("review");
215
+ B(null), N("review");
216
216
  }, [
217
- z,
218
- g,
217
+ R,
218
+ h,
219
219
  J,
220
- F,
220
+ P,
221
221
  n.modalAmountInvalidError,
222
222
  n.modalInsufficientFundsError,
223
223
  X
224
- ]), he = u(() => {
225
- if (N === "amount") {
226
- P("accounts");
224
+ ]), he = l(() => {
225
+ if (M === "amount") {
226
+ N("accounts");
227
227
  return;
228
228
  }
229
- N === "review" && P("accounts");
230
- }, [N]), ge = u(async () => {
231
- let t = o(z, X);
229
+ M === "review" && N("accounts");
230
+ }, [M]), ge = l(async () => {
231
+ let t = o(R, X);
232
232
  if (t === null) {
233
- V(n.modalAmountInvalidError);
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 T.mutateAsync({ body: {
244
- fromBankAccountId: F,
245
- toBankAccountId: L,
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 E.mutateAsync({ body: {
249
- fromBankAccountId: F,
250
- toBankAccountId: L,
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: h.defaultSecCode
255
- } }), H(!0), P("result"), S(s.TransferSubmitted, { transferType: r });
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
- z,
261
- E,
260
+ R,
262
261
  T,
262
+ w,
263
263
  J,
264
- F,
264
+ P,
265
265
  n.modalSubmitFailedError,
266
266
  n.modalUnsupportedPairError,
267
267
  n.modalAmountInvalidError,
268
268
  Y,
269
- L,
270
- S,
269
+ I,
270
+ b,
271
271
  X,
272
- h.defaultSecCode
272
+ m.defaultSecCode
273
273
  ]);
274
274
  return {
275
275
  modalProps: {
276
- open: j,
276
+ open: A,
277
277
  onOpenChange: K,
278
- step: N,
278
+ step: M,
279
279
  fromOptions: ie,
280
280
  toOptions: ae,
281
- fromValue: F,
282
- toValue: L,
281
+ fromValue: P,
282
+ toValue: I,
283
283
  onFromValueChange: se,
284
284
  onToValueChange: ce,
285
- amountValue: z,
286
- onAmountValueChange: $,
287
- amountError: te,
285
+ amountValue: R,
286
+ onAmountValueChange: le,
287
+ amountError: ne,
288
288
  amountInputPrefix: re,
289
- reviewFromAccount: de,
290
- reviewToAccount: fe,
291
- reviewAmountLabel: ue,
292
- isSubmitting: T.isPending || E.isPending,
293
- isSuccess: ne,
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: le
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 { S as mapTransferToRowView, x as useTransferMoneyModalController };
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 };