@tesouro/embedded-components-react 0.11.187 → 0.11.189

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 (28) hide show
  1. package/dist/fixtures/index.d.ts +13 -46
  2. package/dist/index.css +6 -0
  3. package/dist/index.d.ts +2 -0
  4. package/dist/lib/BankAccountsWidget.d.ts +2 -0
  5. package/dist/lib/WidgetSuite.d.ts +2 -0
  6. package/dist/libs/tesouro-embedded-components-react/balance-history-widget/feature/dist/lib/BalanceHistoryWidget/BalanceHistoryWidgetFeature.js +2 -2
  7. package/dist/libs/tesouro-embedded-components-react/balances-widget/feature/dist/lib/BalancesWidget/BalancesWidgetContext.js +2 -2
  8. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/ui/dist/index2.js +17 -14
  9. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/feature/dist/lib/formatters.js +1 -1
  10. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/feature/dist/lib/labels.js +2 -0
  11. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/feature/dist/lib/useBankAccountsWidget.js +9 -3
  12. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/ui/dist/lib/AccountCard.js +76 -58
  13. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/pay-bill/feature/dist/index8.js +1 -1
  14. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js +20 -20
  15. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/sdk.gen.js +17 -17
  16. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/index.js +1 -0
  17. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  18. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/layout/useAnchoredOverlayLayout.js +5 -0
  19. package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/index.js +4 -0
  20. package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/lib/CopyAddress/CopyAddress.js +30 -46
  21. package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/lib/CopyButton/CopyButton.js +36 -0
  22. package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/lib/CopyButton/labels.js +3 -0
  23. package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/lib/UploadEmailOption/UploadEmailOption.js +2 -0
  24. package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/lib/UploadPopover/UploadPopover.js +8 -0
  25. package/dist/libs/tesouro-embedded-components-react/transfers-widget/feature/dist/lib/TransfersWidget/TransfersWidgetInner.js +77 -77
  26. package/dist/libs/tesouro-embedded-components-react/transfers-widget/feature/dist/lib/TransfersWidget/transferViews.js +2 -2
  27. package/dist/libs/tesouro-embedded-components-react/transfers-widget/feature/dist/lib/TransfersWidget/useTransferMoneyModalController.js +129 -122
  28. package/package.json +1 -1
@@ -12,15 +12,15 @@ import "../../../../../shared/util/dist/index.js";
12
12
  import "../../../../../shared/ui/dist/index.js";
13
13
  import { TRANSFERS_ANALYTICS_EVENTS as c } from "../analytics/events.js";
14
14
  import { useCreateBookTransferMutation as ee } from "../../../../data-access/dist/index7.js";
15
- import { useCreateAchMoneyMovementMutation as l } from "../../../../data-access/dist/index8.js";
15
+ import { useCreateAchMoneyMovementMutation as te } from "../../../../data-access/dist/index8.js";
16
16
  import "../../../../data-access/dist/index.js";
17
- import { useCallback as u, useEffect as d, useMemo as f, useState as p } from "react";
18
- import { useControllableState as te } from "@radix-ui/react-use-controllable-state";
17
+ import { useCallback as l, useEffect as ne, useMemo as u, useState as d } from "react";
18
+ import { useControllableState as f } from "@radix-ui/react-use-controllable-state";
19
19
  // ../../libs/tesouro-embedded-components-react/transfers-widget/feature/dist/lib/TransfersWidget/useTransferMoneyModalController.js
20
- function m(e) {
20
+ function p(e) {
21
21
  return e.slice(-4);
22
22
  }
23
- function h(e, t) {
23
+ function m(e, t) {
24
24
  let n = e.balance;
25
25
  if (!n || n.value === void 0 || n.value === null) return;
26
26
  let i = n.currencyCode ?? t, a = r({
@@ -32,135 +32,140 @@ function h(e, t) {
32
32
  includeSpaceAfterCurrencySymbol: !1
33
33
  });
34
34
  }
35
- function g(e, t, n, r) {
35
+ function h(e, t, n, r) {
36
36
  let i = n.find((t) => t.id === e);
37
37
  if (i?.balance?.currencyCode) return i.balance.currencyCode;
38
38
  let a = n.find((e) => e.id === t);
39
39
  return a?.balance?.currencyCode ? a.balance.currencyCode : r;
40
40
  }
41
- function _(e, t, n) {
42
- let r = e.nickname?.trim() || t.accountFallbackName, i = h(e, n.defaultCurrencyCode);
41
+ function g(e, t, n) {
42
+ let r = e.nickname?.trim() || t.accountFallbackName, i = m(e, n.defaultCurrencyCode);
43
43
  return {
44
44
  optionValue: e.id,
45
45
  primaryLabel: r,
46
- number: { last4: m(e.accountNumber) },
46
+ ...e.accountNumber && { number: { last4: p(e.accountNumber) } },
47
47
  balanceLabel: i
48
48
  };
49
49
  }
50
- function v(e) {
50
+ function _(e) {
51
51
  let t = e.nickname?.trim() || e.nameOnAccount;
52
52
  return {
53
53
  optionValue: e.id,
54
54
  primaryLabel: t,
55
- number: { last4: m(e.accountNumber) }
55
+ number: { last4: p(e.accountNumber) }
56
56
  };
57
57
  }
58
- function y(e, t) {
58
+ function v(e, t) {
59
59
  return {
60
60
  name: e?.primaryLabel ?? "",
61
61
  ...t && { number: {
62
- last4: m(t),
62
+ last4: p(t),
63
63
  fullNumber: t
64
64
  } }
65
65
  };
66
66
  }
67
- var ne = 2;
68
- function b({ labels: r, featureLabels: m, embeddedBankAccounts: h, verifiedExternalBankAccounts: b, track: x, isTransferMoneyOpen: re, defaultIsTransferMoneyOpen: ie, onTransferMoneyOpenChange: ae }) {
69
- let S = ee(), C = l(), w = f(() => new Set(h.map((e) => e.id)), [h]), T = f(() => h.map((e) => _(e, r, m)), [
70
- h,
71
- m,
67
+ var re = 2;
68
+ function y({ labels: r, featureLabels: p, embeddedBankAccounts: m, verifiedExternalBankAccounts: y, track: b, isTransferMoneyOpen: ie, defaultIsTransferMoneyOpen: x, onTransferMoneyOpenChange: S }) {
69
+ let C = ee(), w = te(), T = u(() => m.filter((e) => e.status === "ACTIVE" && !!e.accountNumber), [m]), E = u(() => new Set(T.map((e) => e.id)), [T]), D = u(() => T.map((e) => g(e, r, p)), [
70
+ T,
71
+ p,
72
72
  r.accountFallbackName
73
- ]), E = f(() => b.map((e) => v(e)), [b]), D = f(() => [...T, ...E], [T, E]), [O, k] = te({
74
- prop: re,
75
- defaultProp: ie ?? !1,
76
- onChange: ae,
73
+ ]), O = u(() => y.map((e) => _(e)), [y]), k = u(() => [...D, ...O], [D, O]), [A, j] = f({
74
+ prop: ie,
75
+ defaultProp: x ?? !1,
76
+ onChange: S,
77
77
  caller: "TransfersWidget"
78
- }), [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(() => {
79
- N(""), F(""), L(""), R(null), B(null), H(null), W(!1);
80
- }, []), se = u(() => {
81
- j("accounts"), q();
82
- }, [q]), [ce, le] = p(O);
83
- O !== ce && (le(O), O && se()), d(() => {
84
- O && x(c.TransferMoneyOpened);
85
- }, [O, x]);
86
- let ue = u((e) => {
87
- k(e);
88
- }, [k]), de = u(() => {
89
- k(!0);
90
- }, [k]), J = w.has(M), Y = w.has(P), X = f(() => g(M, P, h, m.defaultCurrencyCode), [
91
- h,
92
- m.defaultCurrencyCode,
93
- M,
94
- P
95
- ]), Z = u((e, t, i) => {
96
- let a = s(e, g(t, i, h, m.defaultCurrencyCode));
78
+ }), [M, N] = d("accounts"), [P, F] = d(""), [I, L] = d(""), [R, z] = d(""), [ae, B] = d(null), [oe, V] = d(null), [H, U] = d(null), [W, G] = d(!1), [K, se] = d(0), q = l(() => {
79
+ F(""), L(""), z(""), B(null), V(null), U(null), G(!1);
80
+ }, []), ce = l(() => {
81
+ N("accounts"), q();
82
+ }, [q]), [le, ue] = d(A);
83
+ A !== le && (ue(A), A && ce()), ne(() => {
84
+ A && b(c.TransferMoneyOpened);
85
+ }, [A, b]);
86
+ let de = l((e) => {
87
+ j(e);
88
+ }, [j]), fe = l(() => {
89
+ j(!0);
90
+ }, [j]), J = E.has(P), Y = E.has(I), X = u(() => h(P, I, T, p.defaultCurrencyCode), [
91
+ T,
92
+ p.defaultCurrencyCode,
93
+ P,
94
+ I
95
+ ]), Z = l((e, t, i) => {
96
+ let a = s(e, h(t, i, T, p.defaultCurrencyCode));
97
97
  if (a === null) return r.modalAmountInvalidError;
98
- let o = h.find((e) => e.id === t);
98
+ let o = T.find((e) => e.id === t);
99
99
  return o && a > n(o.balance?.value) ? r.modalInsufficientFundsError : null;
100
100
  }, [
101
- h,
102
- m.defaultCurrencyCode,
101
+ T,
102
+ p.defaultCurrencyCode,
103
103
  r.modalAmountInvalidError,
104
104
  r.modalInsufficientFundsError
105
- ]), Q = f(() => a(X), [X]), fe = f(() => P ? Y ? D.filter((e) => e.optionValue !== P) : T.filter((e) => e.optionValue !== P) : D, [
105
+ ]), pe = u(() => a(X), [X]), me = u(() => I ? Y ? k.filter((e) => e.optionValue !== I) : D.filter((e) => e.optionValue !== I) : k, [
106
+ k,
106
107
  D,
107
- T,
108
- P,
108
+ I,
109
109
  Y
110
- ]), pe = f(() => M ? J ? D.filter((e) => e.optionValue !== M) : T.filter((e) => e.optionValue !== M) : D, [
110
+ ]), he = u(() => P ? J ? k.filter((e) => e.optionValue !== P) : D.filter((e) => e.optionValue !== P) : k, [
111
+ k,
111
112
  D,
112
- T,
113
- M,
113
+ P,
114
114
  J
115
- ]), me = u((e) => {
116
- N(e), R(null), H(U ? Z(I, e, P) : null);
115
+ ]), ge = l((e) => {
116
+ F(e), B(null), U(W ? Z(R, e, I) : null);
117
117
  }, [
118
+ R,
118
119
  I,
119
- P,
120
120
  Z,
121
- U
122
- ]), he = u((e) => {
123
- F(e), B(null), H(U ? Z(I, M, e) : null);
121
+ W
122
+ ]), _e = l((e) => {
123
+ L(e), V(null), U(W ? Z(R, P, e) : null);
124
124
  }, [
125
- I,
126
- M,
125
+ R,
126
+ P,
127
127
  Z,
128
- U
129
- ]), ge = u((e) => {
130
- L(e), H(U ? Z(e, M, P) : null);
128
+ W
129
+ ]), ve = l((e) => {
130
+ z(e), U(W ? Z(e, P, I) : null);
131
131
  }, [
132
- M,
133
132
  P,
133
+ I,
134
134
  Z,
135
- U
136
- ]), _e = f(() => {
137
- let e = s(I, X);
135
+ W
136
+ ]), ye = u(() => {
137
+ let e = s(R, X);
138
138
  if (e === null) return "";
139
139
  let t = i(X);
140
140
  return o(e / 10 ** t, {
141
141
  currencyCode: X,
142
142
  includeSpaceAfterCurrencySymbol: !1
143
143
  });
144
- }, [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), [
145
- D,
146
- h,
147
- b
148
- ]), ve = u(() => {
149
- let e = M ? null : r.modalFromRequiredError, t = P ? null : r.modalToRequiredError, n = Z(I, M, P);
150
- W(!0), R(e), B(t), H(n), e || t || n ? K((e) => e + 1) : j("review");
144
+ }, [R, X]), Q = l((e) => v(k.find((t) => t.optionValue === e), T.find((t) => t.id === e)?.accountNumber ?? y.find((t) => t.id === e)?.accountNumber), [
145
+ k,
146
+ T,
147
+ y
148
+ ]), $ = l(() => {
149
+ let e = k.some((e) => e.optionValue === P) ? null : r.modalFromRequiredError, t = k.some((e) => e.optionValue === I) ? null : r.modalToRequiredError, n = Z(R, P, I);
150
+ G(!0), B(e), V(t), U(n), e || t || n ? se((e) => e + 1) : N("review");
151
151
  }, [
152
- I,
153
- M,
152
+ k,
153
+ R,
154
+ P,
154
155
  r.modalFromRequiredError,
155
156
  r.modalToRequiredError,
156
- P,
157
+ I,
157
158
  Z
158
- ]), ye = u(() => {
159
- j("accounts");
160
- }, []), be = u(async () => {
161
- let t = s(I, X);
159
+ ]), be = l(() => {
160
+ N("accounts");
161
+ }, []), xe = l(async () => {
162
+ if (!k.some((e) => e.optionValue === P) || !k.some((e) => e.optionValue === I)) {
163
+ $(), N("accounts");
164
+ return;
165
+ }
166
+ let t = s(R, X);
162
167
  if (t === null) {
163
- H(r.modalAmountInvalidError);
168
+ U(r.modalAmountInvalidError);
164
169
  return;
165
170
  }
166
171
  if (!J && !Y) {
@@ -170,69 +175,71 @@ function b({ labels: r, featureLabels: m, embeddedBankAccounts: h, verifiedExter
170
175
  let n;
171
176
  n = J && Y ? "INTERNAL_TO_INTERNAL" : J && !Y ? "INTERNAL_TO_EXTERNAL" : "EXTERNAL_TO_INTERNAL";
172
177
  try {
173
- n === "INTERNAL_TO_INTERNAL" ? await S.mutateAsync({ body: {
174
- fromBankAccountId: M,
175
- toBankAccountId: P,
178
+ n === "INTERNAL_TO_INTERNAL" ? await C.mutateAsync({ body: {
179
+ fromBankAccountId: P,
180
+ toBankAccountId: I,
176
181
  amount: t,
177
182
  currencyCode: X
178
- } }) : await C.mutateAsync({ body: {
179
- fromBankAccountId: M,
180
- toBankAccountId: P,
183
+ } }) : await w.mutateAsync({ body: {
184
+ fromBankAccountId: P,
185
+ toBankAccountId: I,
181
186
  amount: t,
182
187
  currencyCode: X,
183
188
  type: n,
184
- secCode: m.defaultSecCode
185
- } }), j("result"), x(c.TransferSubmitted, { transferType: n });
189
+ secCode: p.defaultSecCode
190
+ } }), N("result"), b(c.TransferSubmitted, { transferType: n });
186
191
  } catch {
187
192
  e.error(r.modalSubmitFailedError);
188
193
  }
189
194
  }, [
190
- I,
195
+ R,
196
+ w,
197
+ k,
191
198
  C,
192
- S,
199
+ $,
193
200
  J,
194
- M,
201
+ P,
195
202
  r.modalSubmitFailedError,
196
203
  r.modalUnsupportedPairError,
197
204
  r.modalAmountInvalidError,
198
205
  Y,
199
- P,
200
- x,
206
+ I,
207
+ b,
201
208
  X,
202
- m.defaultSecCode
209
+ p.defaultSecCode
203
210
  ]);
204
211
  return {
205
212
  modalProps: {
206
- open: O,
207
- onOpenChange: ue,
208
- step: A,
209
- stepLabel: A === "result" ? void 0 : t(r.modalStepLabel, {
210
- current: String(A === "review" ? 2 : 1),
211
- total: String(ne)
213
+ open: A,
214
+ onOpenChange: de,
215
+ step: M,
216
+ stepLabel: M === "result" ? void 0 : t(r.modalStepLabel, {
217
+ current: String(M === "review" ? 2 : 1),
218
+ total: String(re)
212
219
  }),
213
- fromOptions: fe,
214
- toOptions: pe,
215
- fromValue: M,
216
- toValue: P,
217
- onFromValueChange: me,
218
- onToValueChange: he,
219
- fromError: oe,
220
- toError: z,
221
- amountValue: I,
222
- onAmountValueChange: ge,
223
- amountError: V,
224
- amountInputPrefix: Q,
225
- reviewFromAccount: $(M),
226
- reviewToAccount: $(P),
227
- reviewAmountLabel: _e,
228
- isSubmitting: S.isPending || C.isPending,
229
- onContinueFromAccounts: ve,
230
- onBack: ye,
231
- onSubmit: () => void be(),
220
+ fromOptions: me,
221
+ toOptions: he,
222
+ fromValue: P,
223
+ toValue: I,
224
+ onFromValueChange: ge,
225
+ onToValueChange: _e,
226
+ fromError: ae,
227
+ toError: oe,
228
+ amountValue: R,
229
+ onAmountValueChange: ve,
230
+ amountError: H,
231
+ amountInputPrefix: pe,
232
+ reviewFromAccount: Q(P),
233
+ reviewToAccount: Q(I),
234
+ reviewAmountLabel: ye,
235
+ isSubmitting: C.isPending || w.isPending,
236
+ onContinueFromAccounts: $,
237
+ onBack: be,
238
+ onSubmit: () => void xe(),
232
239
  onClearSelections: q,
233
- scrollToErrorToken: G
240
+ scrollToErrorToken: K
234
241
  },
235
- openModal: de
242
+ openModal: fe
236
243
  };
237
244
  }
238
- export { b as useTransferMoneyModalController };
245
+ export { y as useTransferMoneyModalController };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tesouro/embedded-components-react",
3
- "version": "0.11.187",
3
+ "version": "0.11.189",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "sideEffects": [