@tesouro/embedded-components-react 0.11.59 → 0.11.60

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 (46) hide show
  1. package/README.md +16 -16
  2. package/dist/index.css +40 -70
  3. package/dist/index.d.ts +19 -6
  4. package/dist/lib/CardDetailsWidget.d.ts +11 -3
  5. package/dist/lib/CreditCardsWidget.d.ts +19 -6
  6. package/dist/lib/DebitCardsWidget.d.ts +19 -6
  7. package/dist/lib/WidgetSuite.d.ts +19 -6
  8. package/dist/libs/tesouro-embedded-components-react/card-details-widget/feature/dist/lib/CardDetailsWidget.js +112 -110
  9. package/dist/libs/tesouro-embedded-components-react/card-details-widget/feature/dist/lib/cardDetailsView.js +1 -0
  10. package/dist/libs/tesouro-embedded-components-react/card-details-widget/ui/dist/index.js +0 -2
  11. package/dist/libs/tesouro-embedded-components-react/card-details-widget/ui/dist/lib/ActivateCardPanel/ActivateCardPanel.js +94 -83
  12. package/dist/libs/tesouro-embedded-components-react/card-details-widget/ui/dist/lib/ActivateCardPanel/ActivateCardSuccessView.js +32 -31
  13. package/dist/libs/tesouro-embedded-components-react/card-details-widget/ui/dist/lib/ActivateCardPanel/labels.js +5 -2
  14. package/dist/libs/tesouro-embedded-components-react/card-details-widget/ui/dist/lib/CardDetailsPanel/CardCredentialRow.js +41 -23
  15. package/dist/libs/tesouro-embedded-components-react/card-details-widget/ui/dist/lib/CardDetailsPanel/CardCredentialsFace.js +3 -0
  16. package/dist/libs/tesouro-embedded-components-react/card-details-widget/ui/dist/lib/CardDetailsPanel/CardDetailsHeader.js +30 -25
  17. package/dist/libs/tesouro-embedded-components-react/card-details-widget/ui/dist/lib/CardDetailsPanel/CardDetailsPanel.js +162 -190
  18. package/dist/libs/tesouro-embedded-components-react/card-details-widget/ui/dist/lib/CardDetailsPanel/CardFace.js +2 -2
  19. package/dist/libs/tesouro-embedded-components-react/card-details-widget/ui/dist/lib/CardDetailsPanel/CopyButton.js +35 -0
  20. package/dist/libs/tesouro-embedded-components-react/card-details-widget/ui/dist/lib/CardDetailsPanel/CopyableValue.js +18 -0
  21. package/dist/libs/tesouro-embedded-components-react/card-details-widget/ui/dist/lib/CardDetailsPanel/NicknameEditor.js +43 -0
  22. package/dist/libs/tesouro-embedded-components-react/card-details-widget/ui/dist/lib/CardDetailsPanel/cardFaceSurface.js +1 -1
  23. package/dist/libs/tesouro-embedded-components-react/card-details-widget/ui/dist/lib/CardDetailsPanel/labels.js +12 -8
  24. package/dist/libs/tesouro-embedded-components-react/cards-widget/create-card/feature/dist/index5.js +3 -3
  25. package/dist/libs/tesouro-embedded-components-react/cards-widget/create-card/feature/dist/index8.js +110 -104
  26. package/dist/libs/tesouro-embedded-components-react/cards-widget/create-card/ui/dist/lib/CreateCardWidget/CreateCardWidget.js +74 -68
  27. package/dist/libs/tesouro-embedded-components-react/cards-widget/create-card/ui/dist/lib/CreateCardWidget/PreparingView.js +19 -18
  28. package/dist/libs/tesouro-embedded-components-react/cards-widget/create-card/ui/dist/lib/CreateCardWidget/SetupView.js +110 -108
  29. package/dist/libs/tesouro-embedded-components-react/cards-widget/create-card/ui/dist/lib/CreateCardWidget/SuccessView.js +33 -42
  30. package/dist/libs/tesouro-embedded-components-react/cards-widget/create-card/ui/dist/lib/CreateCardWidget/labels.js +10 -7
  31. package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/lib/labels.js +1 -0
  32. package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/lib/testIds.js +2 -6
  33. package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/lib/useCardsWidget.js +159 -145
  34. package/dist/libs/tesouro-embedded-components-react/cards-widget/ui/dist/index.js +0 -1
  35. package/dist/libs/tesouro-embedded-components-react/cards-widget/ui/dist/lib/CardsList/CardsList.js +255 -112
  36. package/dist/libs/tesouro-embedded-components-react/cards-widget/ui/dist/lib/CardsList/CardsListDetailsSheet.js +1 -1
  37. package/dist/libs/tesouro-embedded-components-react/cards-widget/ui/dist/lib/CardsList/labels.js +4 -4
  38. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  39. package/package.json +1 -1
  40. package/dist/libs/tesouro-embedded-components-react/card-details-widget/ui/dist/lib/CardDetailsPanel/AddressLine.js +0 -22
  41. package/dist/libs/tesouro-embedded-components-react/card-details-widget/ui/dist/lib/CardDetailsPanel/DetailCopyRow.js +0 -28
  42. package/dist/libs/tesouro-embedded-components-react/card-details-widget/ui/dist/lib/CardDetailsPanel/NicknameRow.js +0 -64
  43. package/dist/libs/tesouro-embedded-components-react/card-details-widget/ui/dist/lib/CardDetailsPanel/statusBadge.js +0 -11
  44. package/dist/libs/tesouro-embedded-components-react/cards-widget/ui/dist/lib/CardsList/CardFaceSwatch.js +0 -11
  45. package/dist/libs/tesouro-embedded-components-react/cards-widget/ui/dist/lib/CardsList/CardsListRow.js +0 -103
  46. package/dist/libs/tesouro-embedded-components-react/cards-widget/ui/dist/lib/CardsList/statusBadge.js +0 -11
@@ -74,57 +74,57 @@ function y({ cardArtSrc: n, labels: s, featureLabels: fe, className: Oe, onClose
74
74
  }, {
75
75
  value: d.Physical,
76
76
  label: w.setup.cardFormatPhysical
77
- }], [w.setup.cardFormatPhysical, w.setup.cardFormatVirtual]), Fe = m(() => t(), []), [Ie, T] = g(l.Setup), [E, Le] = g(null), [D, Re] = g(null), [ze, Be] = g(null), [O, Ve] = g(null), [k, He] = g(Te), [Ue, We] = g(null), [Ge, Ke] = g(null), [A, j] = g(!1), [M, N] = g(""), [P, F] = g(null), [I, L] = g(!1), [R, z] = g(""), [B, V] = g(!1), [H, U] = g([]), qe = () => {
78
- Le(null), Re(null), Be(null), Ve(null), He(Te), We(null), Ke(null), j(!1), N(""), F(null), L(!1), z(""), V(!1), U([]), T(l.Setup);
79
- }, Je = h(x);
80
- x && x !== Je.current && (Je.current = x, qe());
81
- let W = h(!0);
82
- p(() => (W.current = !0, () => {
83
- W.current = !1;
77
+ }], [w.setup.cardFormatPhysical, w.setup.cardFormatVirtual]), Fe = m(() => t(), []), [Ie, T] = g(l.Setup), [E, Le] = g(null), [D, Re] = g(null), [ze, Be] = g(null), [O, k] = g(null), [A, Ve] = g(Te), [He, Ue] = g(null), [We, Ge] = g(null), [Ke, qe] = g(null), [j, M] = g(!1), [N, P] = g(""), [F, I] = g(null), [L, R] = g(!1), [z, B] = g(""), [V, H] = g(!1), [U, W] = g([]), Je = () => {
78
+ Le(null), Re(null), Be(null), k(null), Ve(Te), Ue(null), Ge(null), qe(null), M(!1), P(""), I(null), R(!1), B(""), H(!1), W([]), T(l.Setup);
79
+ }, Ye = h(x);
80
+ x && x !== Ye.current && (Ye.current = x, Je());
81
+ let G = h(!0);
82
+ p(() => (G.current = !0, () => {
83
+ G.current = !1;
84
84
  }), []), p(() => {
85
85
  Me(de.Mounted);
86
86
  }, [Me]);
87
- let { options: Ye, isError: G, refetch: Xe } = _e({ enabled: b && S.canReadUsers }), K = o({
87
+ let { options: Xe, isError: K, refetch: Ze } = _e({ enabled: b && S.canReadUsers }), q = o({
88
88
  enabled: b && S.canReadUsers,
89
89
  permissions: [we]
90
- }), Ze = m(() => !b || !S.canReadUsers || K.isResolving || K.isError ? [] : re(K.data?.data ?? [], x).map((e) => e.id), [
91
- K.data?.data,
92
- K.isError,
93
- K.isResolving,
90
+ }), Qe = m(() => !b || !S.canReadUsers || q.isResolving || q.isError ? [] : re(q.data?.data ?? [], x).map((e) => e.id), [
91
+ q.data?.data,
92
+ q.isError,
93
+ q.isResolving,
94
94
  b,
95
95
  x,
96
96
  S.canReadUsers
97
- ]), q = !!K.isError && b && S.canReadUsers, Qe = b && S.canReadUsers && K.isResolving, J = h(null);
97
+ ]), J = !!q.isError && b && S.canReadUsers, $e = b && S.canReadUsers && q.isResolving, Y = h(null);
98
98
  p(() => {
99
- if (!q) J.current !== null && (e.dismiss(J.current), J.current = null);
100
- else return J.current = e.error(C.toast.debitCardIssuersError, {
99
+ if (!J) Y.current !== null && (e.dismiss(Y.current), Y.current = null);
100
+ else return Y.current = e.error(C.toast.debitCardIssuersError, {
101
101
  duration: Infinity,
102
102
  action: {
103
103
  label: C.toast.retry,
104
104
  onClick: () => {
105
- K.refetch();
105
+ q.refetch();
106
106
  }
107
107
  }
108
108
  }), () => {
109
- J.current !== null && (e.dismiss(J.current), J.current = null);
109
+ Y.current !== null && (e.dismiss(Y.current), Y.current = null);
110
110
  };
111
111
  }, [
112
- K.refetch,
112
+ q.refetch,
113
113
  C.toast.debitCardIssuersError,
114
114
  C.toast.retry,
115
- q
115
+ J
116
116
  ]);
117
- let $e = a({ enabled: b && S.canReadOrganization }), Y = r({ enabled: b && S.canReadFundingAccounts }), et = i({ enabled: b && S.canReadMerchantCategoryGroups }), tt = ye(), nt = be(), rt = xe(), X = !!Y.isError && b && S.canReadFundingAccounts, Z = m(() => X ? [] : (Y.data?.data ?? []).map((e) => ({
117
+ let et = a({ enabled: b && S.canReadOrganization }), X = r({ enabled: b && S.canReadFundingAccounts }), tt = i({ enabled: b && S.canReadMerchantCategoryGroups }), nt = ye(), rt = be(), it = xe(), Z = !!X.isError && b && S.canReadFundingAccounts, Q = m(() => Z ? [] : (X.data?.data ?? []).map((e) => ({
118
118
  value: e.id,
119
119
  label: ke(e, C.untitledFundingAccount)
120
120
  })), [
121
- Y.data?.data,
121
+ X.data?.data,
122
122
  C.untitledFundingAccount,
123
- X
124
- ]), Q = m(() => (et.data?.data ?? []).map((e) => ({
123
+ Z
124
+ ]), $ = m(() => (tt.data?.data ?? []).map((e) => ({
125
125
  value: e.id,
126
126
  label: e.name
127
- })), [et.data?.data]), $ = ze ?? (Z.length === 1 ? Z[0].value : null), it = $e.data?.address, at = se(it), ot = ce(it), st = D === d.Physical, ct = st && O === u.BusinessAddress && !!at, lt = st && O === u.DifferentAddress, ut = X || Z.length > 0, dt = b && S.canWriteAuthorizationControls, ft = m(() => [
127
+ })), [tt.data?.data]), at = ze ?? (Q.length === 1 ? Q[0].value : null), ot = et.data?.address, st = se(ot), ct = ce(ot), lt = D === d.Physical, ut = lt && O === u.BusinessAddress && !!st, dt = lt && O === u.DifferentAddress, ft = Z || Q.length > 0, pt = b && S.canWriteAuthorizationControls, mt = m(() => [
128
128
  {
129
129
  value: f.OneTime,
130
130
  label: C.spendLimit.periodOneTime
@@ -141,7 +141,7 @@ function y({ cardArtSrc: n, labels: s, featureLabels: fe, className: Oe, onClose
141
141
  C.spendLimit.periodDaily,
142
142
  C.spendLimit.periodMonthly,
143
143
  C.spendLimit.periodOneTime
144
- ]), pt = m(() => [
144
+ ]), ht = m(() => [
145
145
  {
146
146
  value: f.OneTime,
147
147
  variant: "warning",
@@ -163,45 +163,45 @@ function y({ cardArtSrc: n, labels: s, featureLabels: fe, className: Oe, onClose
163
163
  C.spendLimit.monthlyResetNotice,
164
164
  C.spendLimit.oneTimeWarningDescription,
165
165
  C.spendLimit.oneTimeWarningTitle
166
- ]), mt = A && (he(M) === null || P === null), ht = I && he(R) === null, gt = B && H.length === 0, _t = Q.length === 0 && !B;
167
- dt || (A && j(!1), M !== "" && N(""), P !== null && F(null), I && L(!1), R !== "" && z(""), B && V(!1), H.length > 0 && U([]));
168
- let vt = m(() => ({
169
- isSpendLimitEnabled: A,
166
+ ]), gt = j && (he(N) === null || F === null), _t = L && he(z) === null, vt = V && U.length === 0, yt = $.length === 0 && !V;
167
+ pt || (j && M(!1), N !== "" && P(""), F !== null && I(null), L && R(!1), z !== "" && B(""), V && H(!1), U.length > 0 && W([]));
168
+ let bt = m(() => ({
169
+ isSpendLimitEnabled: j,
170
170
  onSpendLimitEnabledChange: (e) => {
171
- j(e), e && F((e) => e ?? f.Monthly);
171
+ M(e), e && I((e) => e ?? f.Monthly);
172
172
  },
173
- spendLimitAmount: M,
174
- onSpendLimitAmountChange: N,
175
- spendLimitPeriodOptions: ft,
176
- selectedSpendLimitPeriod: P,
177
- onSpendLimitPeriodSelect: F,
178
- spendLimitPeriodNotices: pt,
179
- isMerchantCategoriesEnabled: B,
180
- onMerchantCategoriesEnabledChange: V,
181
- merchantCategoryOptions: Q,
182
- selectedMerchantCategories: H,
173
+ spendLimitAmount: N,
174
+ onSpendLimitAmountChange: P,
175
+ spendLimitPeriodOptions: mt,
176
+ selectedSpendLimitPeriod: F,
177
+ onSpendLimitPeriodSelect: I,
178
+ spendLimitPeriodNotices: ht,
179
+ isMerchantCategoriesEnabled: V,
180
+ onMerchantCategoriesEnabledChange: H,
181
+ merchantCategoryOptions: $,
182
+ selectedMerchantCategories: U,
183
183
  onMerchantCategoryToggle: (e) => {
184
- U((t) => t.includes(e) ? t.filter((t) => t !== e) : [...t, e]);
184
+ W((t) => t.includes(e) ? t.filter((t) => t !== e) : [...t, e]);
185
185
  },
186
- isMerchantCategoriesToggleDisabled: _t,
187
- isPerTransactionMaximumEnabled: I,
188
- onPerTransactionMaximumEnabledChange: L,
189
- perTransactionMaximumAmount: R,
190
- onPerTransactionMaximumAmountChange: z
186
+ isMerchantCategoriesToggleDisabled: yt,
187
+ isPerTransactionMaximumEnabled: L,
188
+ onPerTransactionMaximumEnabledChange: R,
189
+ perTransactionMaximumAmount: z,
190
+ onPerTransactionMaximumAmountChange: B
191
191
  }), [
192
- B,
193
- _t,
194
- I,
195
- A,
196
- Q,
197
- R,
198
- H,
199
- P,
200
- M,
201
- pt,
202
- ft
203
- ]), yt = !b || !S.canIssue || tt.isPending || nt.isPending || rt.isPending || G || X || q || Qe || !E || !D || !$ || mt || ht || gt || D === d.Physical && (!O || O === u.BusinessAddress && !ot || O === u.DifferentAddress && !le(k)), bt = m(() => {
204
- let e = De(Ge, C);
192
+ V,
193
+ yt,
194
+ L,
195
+ j,
196
+ $,
197
+ z,
198
+ U,
199
+ F,
200
+ N,
201
+ ht,
202
+ mt
203
+ ]), xt = !b || !S.canIssue || nt.isPending || rt.isPending || it.isPending || K || Z || J || $e || !E || !D || !at || gt || _t || vt || D === d.Physical && (!O || O === u.BusinessAddress && !ct || O === u.DifferentAddress && !le(A)), St = m(() => {
204
+ let e = De(We, C);
205
205
  return {
206
206
  ...s,
207
207
  success: {
@@ -210,45 +210,48 @@ function y({ cardArtSrc: n, labels: s, featureLabels: fe, className: Oe, onClose
210
210
  }
211
211
  };
212
212
  }, [
213
- Ge,
213
+ We,
214
214
  C,
215
215
  s
216
- ]), xt = async () => {
216
+ ]), Ct = async () => {
217
217
  if (!b) return;
218
218
  let t = oe(), n = ae({
219
219
  cardholderUserId: E,
220
220
  format: D,
221
- bankAccountId: $,
221
+ bankAccountId: at,
222
222
  reference: t,
223
223
  mailingOption: O,
224
- orgAddress: it,
225
- manualAddress: k
224
+ orgAddress: ot,
225
+ manualAddress: A
226
226
  });
227
227
  if (!n) return;
228
228
  T(l.Preparing);
229
229
  let r = e.loading(C.toast.creating);
230
230
  try {
231
- let t = await tt.mutateAsync({ body: n });
232
- if (!W.current) {
231
+ let t = await nt.mutateAsync({ body: n });
232
+ if (!G.current) {
233
233
  e.dismiss(r);
234
234
  return;
235
235
  }
236
- We(t.id), Ke(t.cardStatus);
236
+ Ue(t.id), Ge(t.cardStatus), qe({
237
+ cardholder: t.cardholderName,
238
+ lastFour: t.lastFourDigits
239
+ });
237
240
  let i = [];
238
- if (A) {
241
+ if (j) {
239
242
  let e = me({
240
243
  cardId: t.id,
241
- amount: M,
242
- period: P,
244
+ amount: N,
245
+ period: F,
243
246
  id: crypto.randomUUID(),
244
247
  name: C.velocityControlNames.spendLimit
245
248
  });
246
249
  e && i.push(e);
247
250
  }
248
- if (I) {
251
+ if (L) {
249
252
  let e = pe({
250
253
  cardId: t.id,
251
- amount: R,
254
+ amount: z,
252
255
  id: crypto.randomUUID(),
253
256
  name: C.velocityControlNames.perTransactionMaximum
254
257
  });
@@ -256,25 +259,25 @@ function y({ cardArtSrc: n, labels: s, featureLabels: fe, className: Oe, onClose
256
259
  }
257
260
  let a = !1;
258
261
  if (i.length > 0) try {
259
- await Promise.all(i.map((e) => nt.mutateAsync({ body: e })));
262
+ await Promise.all(i.map((e) => rt.mutateAsync({ body: e })));
260
263
  } catch {
261
264
  a = !0;
262
265
  }
263
- if (!W.current) {
266
+ if (!G.current) {
264
267
  e.dismiss(r);
265
268
  return;
266
269
  }
267
270
  let o = !1;
268
- if (Ze.length > 0) try {
269
- await rt.mutateAsync({ body: {
271
+ if (Qe.length > 0) try {
272
+ await it.mutateAsync({ body: {
270
273
  debitCardIds: [t.id],
271
274
  type: "GRANT",
272
- userIds: Ze
275
+ userIds: Qe
273
276
  } });
274
277
  } catch {
275
278
  o = !0;
276
279
  }
277
- if (!W.current) {
280
+ if (!G.current) {
278
281
  e.dismiss(r);
279
282
  return;
280
283
  }
@@ -304,7 +307,7 @@ function y({ cardArtSrc: n, labels: s, featureLabels: fe, className: Oe, onClose
304
307
  duration: Ee
305
308
  });
306
309
  } catch {
307
- if (!W.current) {
310
+ if (!G.current) {
308
311
  e.dismiss(r);
309
312
  return;
310
313
  }
@@ -317,51 +320,54 @@ function y({ cardArtSrc: n, labels: s, featureLabels: fe, className: Oe, onClose
317
320
  return /* @__PURE__ */ Ce(Se, { children: [/* @__PURE__ */ _(ee, {}), /* @__PURE__ */ _(ie, {
318
321
  view: Ie,
319
322
  cardArtSrc: n,
320
- labels: bt,
323
+ labels: St,
321
324
  className: Oe,
322
- cardholderOptions: Ye,
325
+ cardholderOptions: Xe,
323
326
  selectedCardholder: E,
324
327
  onCardholderSelect: Le,
325
- isCardholderError: G,
326
- onCardholderRetry: G ? Xe : void 0,
328
+ isCardholderError: K,
329
+ onCardholderRetry: K ? Ze : void 0,
327
330
  cardFormatOptions: Pe,
328
331
  selectedCardFormat: D,
329
332
  onCardFormatSelect: (e) => {
330
- Re(e), Ve(null);
333
+ Re(e), k(null);
331
334
  },
332
- isFundingAccountVisible: ut,
333
- fundingAccountOptions: Z,
334
- selectedFundingAccount: $,
335
+ isFundingAccountVisible: ft,
336
+ fundingAccountOptions: Q,
337
+ selectedFundingAccount: at,
335
338
  onFundingAccountSelect: Be,
336
- isFundingAccountError: X,
337
- onFundingAccountRetry: X ? () => {
338
- Y.refetch();
339
+ isFundingAccountError: Z,
340
+ onFundingAccountRetry: Z ? () => {
341
+ X.refetch();
339
342
  } : void 0,
340
- isMailingSectionVisible: st,
343
+ isMailingSectionVisible: lt,
341
344
  selectedMailingOption: O,
342
- onMailingOptionSelect: Ve,
343
- businessAddress: at,
344
- isBusinessAddressVisible: ct,
345
- isManualAddressVisible: lt,
346
- manualAddress: k,
347
- onManualAddressChange: (e) => He((t) => ({
345
+ onMailingOptionSelect: k,
346
+ businessAddress: st,
347
+ isBusinessAddressVisible: ut,
348
+ isManualAddressVisible: dt,
349
+ manualAddress: A,
350
+ onManualAddressChange: (e) => Ve((t) => ({
348
351
  ...t,
349
352
  ...e
350
353
  })),
351
354
  stateOptions: Fe,
352
- isCardControlsSectionVisible: dt,
353
- cardControls: vt,
354
- isCreateDisabled: yt,
355
+ isCardControlsSectionVisible: pt,
356
+ cardControls: bt,
357
+ isCreateDisabled: xt,
355
358
  onCreateClick: () => {
356
- xt();
359
+ Ct();
357
360
  },
358
361
  onCancelClick: () => {
359
362
  Ae?.(), y?.();
360
363
  },
361
364
  onClose: y,
362
- onCreateAnotherClick: qe,
363
- onViewCardClick: je && Ue ? () => {
364
- je(Ue);
365
+ onDoneClick: y ?? Je,
366
+ createdCardholder: Ke?.cardholder || void 0,
367
+ createdLastFour: Ke?.lastFour || void 0,
368
+ createdFormat: Pe.find((e) => e.value === D)?.label,
369
+ onViewCardClick: je && He ? () => {
370
+ je(He);
365
371
  } : void 0
366
372
  })] });
367
373
  }
@@ -2,100 +2,106 @@
2
2
  "use client";
3
3
  "use client";
4
4
  "use client";
5
- import { Button as e, cn as t } from "../../../../../../../../packages/shared-ui-shadcn/dist/index.js";
6
- import { resolveCreateCardWidgetLabels as n } from "./labels.js";
7
- import { CreateCardView as r } from "./types.js";
8
- import { PreparingView as i } from "./PreparingView.js";
5
+ import { Button as e, Heading as t, cn as n } from "../../../../../../../../packages/shared-ui-shadcn/dist/index.js";
6
+ import { resolveCreateCardWidgetLabels as r } from "./labels.js";
7
+ import { CreateCardView as i } from "./types.js";
8
+ import { PreparingView as a } from "./PreparingView.js";
9
9
  import "./CardControls/CardControls.js";
10
- import { SetupView as a } from "./SetupView.js";
10
+ import { SetupView as ee } from "./SetupView.js";
11
11
  import { SuccessView as o } from "./SuccessView.js";
12
12
  import { Fragment as s, jsx as c, jsxs as l } from "react/jsx-runtime";
13
- import { ChevronRightIcon as u, XIcon as d } from "lucide-react";
13
+ import { XIcon as u } from "lucide-react";
14
14
  // ../../libs/tesouro-embedded-components-react/cards-widget/create-card/ui/dist/lib/CreateCardWidget/CreateCardWidget.js
15
- var f = {
15
+ var d = {
16
16
  street: "",
17
17
  city: "",
18
18
  state: "",
19
19
  zip: ""
20
- }, p = () => void 0;
21
- function m(e) {
22
- return e === r.Setup || e === r.Preparing || e === r.Success ? e : (console.error(`[CreateCardWidget] unexpected view ${JSON.stringify(e)}; falling back to "${r.Setup}"`), r.Setup);
20
+ }, f = () => void 0;
21
+ function p(e) {
22
+ return e === i.Setup || e === i.Preparing || e === i.Success ? e : (console.error(`[CreateCardWidget] unexpected view ${JSON.stringify(e)}; falling back to "${i.Setup}"`), i.Setup);
23
23
  }
24
- function h({ view: h, cardArtSrc: g, labels: _, className: v, cardholderOptions: y = [], selectedCardholder: b = null, onCardholderSelect: x = p, isCardholderError: S = !1, onCardholderRetry: C, cardFormatOptions: w = [], selectedCardFormat: T = null, onCardFormatSelect: E = p, isFundingAccountVisible: D = !1, fundingAccountOptions: O = [], selectedFundingAccount: k = null, onFundingAccountSelect: A = p, isFundingAccountError: j = !1, onFundingAccountRetry: M, isMailingSectionVisible: N = !1, selectedMailingOption: P = null, onMailingOptionSelect: F = p, businessAddress: I = "", isBusinessAddressVisible: L = !1, isManualAddressVisible: R = !1, manualAddress: z = f, onManualAddressChange: B = p, stateOptions: V = [], isCardControlsSectionVisible: H = !1, cardControls: U, isCreateDisabled: W = !1, onCreateClick: G = p, onCancelClick: K = p, onClose: q, onCreateAnotherClick: J = p, onViewCardClick: Y }) {
25
- let X = n(_), Z = m(h), Q = Z === r.Setup;
24
+ function m({ view: m, cardArtSrc: h, labels: g, className: _, cardholderOptions: v = [], selectedCardholder: y = null, onCardholderSelect: b = f, isCardholderError: x = !1, onCardholderRetry: S, cardFormatOptions: C = [], selectedCardFormat: w = null, onCardFormatSelect: T = f, isFundingAccountVisible: E = !1, fundingAccountOptions: D = [], selectedFundingAccount: O = null, onFundingAccountSelect: k = f, isFundingAccountError: A = !1, onFundingAccountRetry: j, isMailingSectionVisible: te = !1, selectedMailingOption: M = null, onMailingOptionSelect: N = f, businessAddress: P = "", isBusinessAddressVisible: F = !1, isManualAddressVisible: I = !1, manualAddress: L = d, onManualAddressChange: R = f, stateOptions: z = [], isCardControlsSectionVisible: B = !1, cardControls: V, isCreateDisabled: H = !1, onCreateClick: U = f, onCancelClick: W = f, onClose: G, onDoneClick: K = f, onViewCardClick: q, createdCardholder: J, createdLastFour: Y, createdFormat: X }) {
25
+ let Z = r(g), Q = p(m), $ = Q === i.Setup;
26
26
  return /* @__PURE__ */ l("div", {
27
- className: t("ttw:relative ttw:flex ttw:h-full ttw:w-full ttw:min-h-0 ttw:flex-col ttw:bg-background", v),
27
+ className: n("ttw:relative ttw:flex ttw:h-full ttw:w-full ttw:min-h-0 ttw:flex-col ttw:bg-background", _),
28
28
  children: [
29
29
  /* @__PURE__ */ l("div", {
30
- className: t("ttw:flex ttw:shrink-0 ttw:items-center ttw:gap-3 ttw:px-6 ttw:pt-4", Q ? "ttw:bg-primary/5 ttw:pb-2" : "ttw:absolute ttw:inset-x-0 ttw:top-0 ttw:z-10 ttw:bg-transparent ttw:pb-0"),
31
- children: [Q ? /* @__PURE__ */ c("h2", {
32
- className: "ttw:min-w-0 ttw:flex-1 ttw:text-lg ttw:font-semibold ttw:text-primary",
33
- children: X.header.title
34
- }) : /* @__PURE__ */ c("span", { className: "ttw:flex-1" }), q ? /* @__PURE__ */ c(e, {
30
+ className: "ttw:flex ttw:shrink-0 ttw:items-start ttw:gap-2 ttw:px-6 ttw:pt-5 ttw:pb-4",
31
+ children: [$ ? /* @__PURE__ */ c(t, {
32
+ variant: "sheet",
33
+ level: 2,
34
+ className: "ttw:min-w-0 ttw:flex-1 ttw:text-foreground",
35
+ children: Z.header.title
36
+ }) : /* @__PURE__ */ c("span", { className: "ttw:flex-1" }), G ? /* @__PURE__ */ c(e, {
35
37
  type: "button",
36
38
  variant: "ghost",
37
- size: "icon",
38
- "aria-label": X.header.closeAriaLabel,
39
- onClick: q,
40
- children: /* @__PURE__ */ c(d, { className: "ttw:size-4" })
39
+ size: "icon-sm",
40
+ className: "ttw:shrink-0 ttw:text-muted-foreground",
41
+ "aria-label": Z.header.closeAriaLabel,
42
+ onClick: G,
43
+ children: /* @__PURE__ */ c(u, { className: "ttw:size-4" })
41
44
  }) : null]
42
45
  }),
43
- Q ? /* @__PURE__ */ l(s, { children: [/* @__PURE__ */ c("div", {
46
+ $ ? /* @__PURE__ */ l(s, { children: [/* @__PURE__ */ c("div", {
44
47
  className: "ttw:min-h-0 ttw:flex-1 ttw:overflow-y-auto",
45
- children: /* @__PURE__ */ c(a, {
46
- cardArtSrc: g,
47
- labels: X,
48
- cardholderOptions: y,
49
- selectedCardholder: b,
50
- onCardholderSelect: x,
51
- isCardholderError: S,
52
- onCardholderRetry: C,
53
- cardFormatOptions: w,
54
- selectedCardFormat: T,
55
- onCardFormatSelect: E,
56
- isFundingAccountVisible: D,
57
- fundingAccountOptions: O,
58
- selectedFundingAccount: k,
59
- onFundingAccountSelect: A,
60
- isFundingAccountError: j,
61
- onFundingAccountRetry: M,
62
- isMailingSectionVisible: N,
63
- selectedMailingOption: P,
64
- onMailingOptionSelect: F,
65
- businessAddress: I,
66
- isBusinessAddressVisible: L,
67
- isManualAddressVisible: R,
68
- manualAddress: z,
69
- onManualAddressChange: B,
70
- stateOptions: V,
71
- isCardControlsSectionVisible: H,
72
- cardControls: U
48
+ children: /* @__PURE__ */ c(ee, {
49
+ cardArtSrc: h,
50
+ labels: Z,
51
+ cardholderOptions: v,
52
+ selectedCardholder: y,
53
+ onCardholderSelect: b,
54
+ isCardholderError: x,
55
+ onCardholderRetry: S,
56
+ cardFormatOptions: C,
57
+ selectedCardFormat: w,
58
+ onCardFormatSelect: T,
59
+ isFundingAccountVisible: E,
60
+ fundingAccountOptions: D,
61
+ selectedFundingAccount: O,
62
+ onFundingAccountSelect: k,
63
+ isFundingAccountError: A,
64
+ onFundingAccountRetry: j,
65
+ isMailingSectionVisible: te,
66
+ selectedMailingOption: M,
67
+ onMailingOptionSelect: N,
68
+ businessAddress: P,
69
+ isBusinessAddressVisible: F,
70
+ isManualAddressVisible: I,
71
+ manualAddress: L,
72
+ onManualAddressChange: R,
73
+ stateOptions: z,
74
+ isCardControlsSectionVisible: B,
75
+ cardControls: V
73
76
  })
74
77
  }), /* @__PURE__ */ l("div", {
75
- className: "ttw:flex ttw:shrink-0 ttw:justify-end ttw:gap-3 ttw:border-t ttw:border-border ttw:bg-muted/40 ttw:px-6 ttw:py-4",
78
+ className: "ttw:flex ttw:shrink-0 ttw:flex-col-reverse ttw:gap-2 ttw:border-t ttw:border-border ttw:px-6 ttw:py-4 ttw:sm:flex-row ttw:sm:justify-end",
76
79
  children: [/* @__PURE__ */ c(e, {
77
80
  type: "button",
78
- variant: "outline",
79
- onClick: K,
80
- children: X.footer.cancel
81
- }), /* @__PURE__ */ l(e, {
81
+ variant: "ghost",
82
+ onClick: W,
83
+ children: Z.footer.cancel
84
+ }), /* @__PURE__ */ c(e, {
82
85
  type: "button",
83
- disabled: W,
84
- onClick: G,
85
- children: [X.footer.createCard, /* @__PURE__ */ c(u, { className: "ttw:size-4" })]
86
+ disabled: H,
87
+ onClick: U,
88
+ children: Z.footer.createCard
86
89
  })]
87
90
  })] }) : null,
88
- Z === r.Preparing ? /* @__PURE__ */ c(i, {
89
- cardArtSrc: g,
90
- labels: X
91
+ Q === i.Preparing ? /* @__PURE__ */ c(a, {
92
+ cardArtSrc: h,
93
+ labels: Z
91
94
  }) : null,
92
- Z === r.Success ? /* @__PURE__ */ c(o, {
93
- cardArtSrc: g,
94
- labels: X,
95
- onCreateAnotherClick: J,
96
- onViewCardClick: Y
95
+ Q === i.Success ? /* @__PURE__ */ c(o, {
96
+ cardArtSrc: h,
97
+ labels: Z,
98
+ cardholder: J,
99
+ lastFour: Y,
100
+ format: X,
101
+ onDoneClick: K,
102
+ onViewCardClick: q
97
103
  }) : null
98
104
  ]
99
105
  });
100
106
  }
101
- export { r as CreateCardView, h as CreateCardWidget, n as resolveCreateCardWidgetLabels };
107
+ export { i as CreateCardView, m as CreateCardWidget, r as resolveCreateCardWidgetLabels };
@@ -1,30 +1,31 @@
1
- import { Spinner as e } from "../../../../../../../../packages/shared-ui-shadcn/dist/index.js";
2
- import { CardArt as t } from "./CardArt.js";
3
- import { jsx as n, jsxs as r } from "react/jsx-runtime";
1
+ import { Heading as e, Spinner as t } from "../../../../../../../../packages/shared-ui-shadcn/dist/index.js";
2
+ import { CardArt as n } from "./CardArt.js";
3
+ import { jsx as r, jsxs as i } from "react/jsx-runtime";
4
4
  // ../../libs/tesouro-embedded-components-react/cards-widget/create-card/ui/dist/lib/CreateCardWidget/PreparingView.js
5
- function i({ cardArtSrc: i, labels: a }) {
6
- return /* @__PURE__ */ r("div", {
7
- className: "ttw:flex ttw:min-h-full ttw:flex-1 ttw:flex-col ttw:items-center ttw:justify-center ttw:gap-6 ttw:bg-gradient-to-b ttw:from-background ttw:to-primary/10 ttw:px-6 ttw:py-12",
5
+ function a({ cardArtSrc: a, labels: o }) {
6
+ return /* @__PURE__ */ i("div", {
7
+ className: "ttw:flex ttw:min-h-full ttw:flex-1 ttw:flex-col ttw:items-center ttw:justify-center ttw:gap-6 ttw:px-6 ttw:py-12",
8
8
  children: [
9
- /* @__PURE__ */ n(t, {
10
- src: i,
11
- alt: a.cardArtAlt
9
+ /* @__PURE__ */ r(n, {
10
+ src: a,
11
+ alt: o.cardArtAlt
12
12
  }),
13
- /* @__PURE__ */ r("div", {
13
+ /* @__PURE__ */ i("div", {
14
14
  className: "ttw:flex ttw:flex-col ttw:items-center ttw:gap-2 ttw:text-center",
15
- children: [/* @__PURE__ */ n("h2", {
16
- className: "ttw:text-xl ttw:font-semibold ttw:text-foreground",
17
- children: a.preparing.title
18
- }), /* @__PURE__ */ n("p", {
15
+ children: [/* @__PURE__ */ r(e, {
16
+ variant: "sheet",
17
+ level: 2,
18
+ children: o.preparing.title
19
+ }), /* @__PURE__ */ r("p", {
19
20
  className: "ttw:text-sm ttw:text-muted-foreground",
20
- children: a.preparing.description
21
+ children: o.preparing.description
21
22
  })]
22
23
  }),
23
- /* @__PURE__ */ n(e, {
24
+ /* @__PURE__ */ r(t, {
24
25
  className: "ttw:size-8 ttw:text-primary",
25
- "aria-label": a.preparing.title
26
+ "aria-label": o.preparing.title
26
27
  })
27
28
  ]
28
29
  });
29
30
  }
30
- export { i as PreparingView };
31
+ export { a as PreparingView };