@tesouro/embedded-components-react 0.3.31 → 0.3.33

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 (35) hide show
  1. package/README.md +11 -10
  2. package/dist/index.d.ts +38 -0
  3. package/dist/index.js +2 -2
  4. package/dist/lib/CardsWidget.d.ts +36 -0
  5. package/dist/lib/CreateCardWidget.d.ts +38 -0
  6. package/dist/lib/CreateCardWidget.js +2 -2
  7. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index31.js +38 -32
  8. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index40.js +2 -1
  9. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index43.js +4 -1
  10. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index44.js +83 -57
  11. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index.js +4 -1
  12. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index95.js +10 -0
  13. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index96.js +47 -0
  14. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index97.js +2 -0
  15. package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/index9.js +1 -1
  16. package/dist/libs/tesouro-embedded-components-react/create-card-widget/data-access/dist/index.js +4 -3
  17. package/dist/libs/tesouro-embedded-components-react/create-card-widget/data-access/dist/index3.js +9 -3
  18. package/dist/libs/tesouro-embedded-components-react/create-card-widget/data-access/dist/index5.js +3 -3
  19. package/dist/libs/tesouro-embedded-components-react/create-card-widget/data-access/dist/index6.js +19 -12
  20. package/dist/libs/tesouro-embedded-components-react/create-card-widget/data-access/dist/index7.js +22 -0
  21. package/dist/libs/tesouro-embedded-components-react/create-card-widget/feature/dist/index.js +2 -2
  22. package/dist/libs/tesouro-embedded-components-react/create-card-widget/feature/dist/index4.js +35 -30
  23. package/dist/libs/tesouro-embedded-components-react/create-card-widget/feature/dist/index5.js +52 -10
  24. package/dist/libs/tesouro-embedded-components-react/create-card-widget/feature/dist/index6.js +12 -31
  25. package/dist/libs/tesouro-embedded-components-react/create-card-widget/feature/dist/index7.js +25 -248
  26. package/dist/libs/tesouro-embedded-components-react/create-card-widget/feature/dist/index8.js +389 -0
  27. package/dist/libs/tesouro-embedded-components-react/create-card-widget/ui/dist/lib/CreateCardWidget/CardControls/CardControlRow.js +10 -9
  28. package/dist/libs/tesouro-embedded-components-react/create-card-widget/ui/dist/lib/CreateCardWidget/CardControls/CardControls.js +13 -12
  29. package/dist/libs/tesouro-embedded-components-react/create-card-widget/ui/dist/lib/CreateCardWidget/CardControls/MerchantCategoriesControl.js +2 -1
  30. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +19 -18
  31. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/merchant-category-group/useAllMerchantCategoryGroupsQuery.js +53 -0
  32. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js +224 -206
  33. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/sdk.gen.js +174 -146
  34. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  35. package/package.json +1 -1
@@ -17,54 +17,55 @@ import { BillDecisionDialog as n } from "../../ui/dist/index50.js";
17
17
  import { BillDuplicateNotice as se } from "../../ui/dist/index60.js";
18
18
  import { ExtractionNotice as ce } from "../../ui/dist/index77.js";
19
19
  import { MarkAsPaidDialog as le } from "../../ui/dist/index86.js";
20
+ import { UnsavedBillDialog as ue } from "../../ui/dist/index96.js";
20
21
  import "../../ui/dist/index.js";
21
- import { usePayableHistoryQuery as ue } from "../../data-access/dist/index6.js";
22
- import { useAllPayableLineItemsQuery as de } from "../../data-access/dist/index7.js";
23
- import { usePayableQuery as fe } from "../../data-access/dist/index13.js";
22
+ import { usePayableHistoryQuery as de } from "../../data-access/dist/index6.js";
23
+ import { useAllPayableLineItemsQuery as fe } from "../../data-access/dist/index7.js";
24
+ import { usePayableQuery as pe } from "../../data-access/dist/index13.js";
24
25
  import "../../data-access/dist/index.js";
25
- import { PayBillFlow as pe } from "./index13.js";
26
+ import { PayBillFlow as me } from "./index13.js";
26
27
  import "./index14.js";
27
- import { useMarkAsPaidFlow as me } from "./index4.js";
28
+ import { useMarkAsPaidFlow as he } from "./index4.js";
28
29
  import "./index5.js";
29
- import { mergeBillCreateScreenCopy as he } from "./index31.js";
30
- import { useBillCreateController as ge } from "./index40.js";
31
- import { useBillForm as _e } from "./index42.js";
32
- import { useApprovalPolicyCardView as ve } from "./index19.js";
33
- import { useCurrentApprovalRequestId as ye } from "./index20.js";
34
- import { usePayableDetailActions as be } from "./index22.js";
35
- import { useScheduledPayment as xe } from "./index23.js";
36
- import { useDraftDelete as Se } from "./index24.js";
37
- import { buildBillDetailView as Ce } from "./index27.js";
38
- import { buildBillHistory as we } from "./index28.js";
39
- import { SourceDocumentContainer as Te } from "./index32.js";
40
- import { useVendorSectionProps as Ee } from "./index35.js";
41
- import { usePaymentInstructionsForm as De } from "./index36.js";
30
+ import { mergeBillCreateScreenCopy as ge } from "./index31.js";
31
+ import { useBillCreateController as _e } from "./index40.js";
32
+ import { useBillForm as ve } from "./index42.js";
33
+ import { useApprovalPolicyCardView as ye } from "./index19.js";
34
+ import { useCurrentApprovalRequestId as be } from "./index20.js";
35
+ import { usePayableDetailActions as xe } from "./index22.js";
36
+ import { useScheduledPayment as Se } from "./index23.js";
37
+ import { useDraftDelete as Ce } from "./index24.js";
38
+ import { buildBillDetailView as we } from "./index27.js";
39
+ import { buildBillHistory as Te } from "./index28.js";
40
+ import { SourceDocumentContainer as Ee } from "./index32.js";
41
+ import { useVendorSectionProps as De } from "./index35.js";
42
+ import { usePaymentInstructionsForm as Oe } from "./index36.js";
42
43
  import { billCreateTestIds as r } from "./index43.js";
43
- import { useCallback as i, useEffect as Oe, useMemo as a, useRef as ke, useState as o } from "react";
44
+ import { useCallback as i, useEffect as ke, useMemo as a, useRef as Ae, useState as o } from "react";
44
45
  import { Fragment as s, jsx as c, jsxs as l } from "react/jsx-runtime";
45
46
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index44.js
46
- function Ae(e) {
47
+ function je(e) {
47
48
  return !!(e?.bank_account?.account_holder_name && e.bank_account.routing_number && e.bank_account.account_number);
48
49
  }
49
- function u({ open: u, onOpenChange: d, payableId: f, readOnly: p = !1, copy: m, poweredByBankName: je, isPossibleDuplicate: Me }) {
50
- let h = a(() => he(m), [m]), [g, _] = o(), [v, y] = o(!1), [Ne, b] = o(!1), [Pe, x] = o(!1), [Fe, S] = o(), C = f ?? Fe, w = fe(C, { pollWhileOcrProcessing: !0 }), T = de(C), E = ee(), D = w.data, O = _e({
50
+ function u({ open: u, onOpenChange: d, payableId: f, readOnly: p = !1, copy: m, poweredByBankName: Me, isPossibleDuplicate: Ne }) {
51
+ let h = a(() => ge(m), [m]), [g, _] = o(), [v, y] = o(!1), [Pe, Fe] = o(!1), [Ie, b] = o(!1), [Le, x] = o(!1), [Re, S] = o(), C = f ?? Re, w = pe(C, { pollWhileOcrProcessing: !0 }), T = fe(C), E = ee(), D = w.data, O = ve({
51
52
  payable: D,
52
53
  lineItems: T.lineItems
53
54
  }), k = D?.counterpart_id;
54
- Oe(() => {
55
+ ke(() => {
55
56
  v || k && (_(k), y(!0));
56
57
  }, [v, k]);
57
- let Ie = i((e) => {
58
+ let ze = i((e) => {
58
59
  y(!0), _(e);
59
- }, []), A = Ee({
60
+ }, []), A = De({
60
61
  payableId: p ? void 0 : C,
61
62
  counterpartId: p ? void 0 : g,
62
63
  payableCounterpartId: k,
63
- onCounterpartChange: Ie,
64
+ onCounterpartChange: ze,
64
65
  requiredError: O.errors?.vendor,
65
66
  payableCounterpartBankAccountId: D?.counterpart_bank_account_id ?? void 0,
66
67
  extractedVendor: D?.counterpart_raw_data ?? void 0
67
- }), j = ge({
68
+ }), j = _e({
68
69
  payableId: f,
69
70
  form: O,
70
71
  counterpartId: g,
@@ -74,19 +75,19 @@ function u({ open: u, onOpenChange: d, payableId: f, readOnly: p = !1, copy: m,
74
75
  onSaved: S,
75
76
  onDraftSaved: () => d(!1),
76
77
  onFinalized: () => d(!1)
77
- }), M = !!(j.isSavingDraft || j.isFinalizing), N = p ? C : void 0, P = ye({
78
+ }), M = !!(j.isSavingDraft || j.isFinalizing), N = p ? C : void 0, P = be({
78
79
  payableId: N,
79
80
  status: D?.status
80
- }), F = ke(null), I = xe({
81
+ }), F = Ae(null), I = Se({
81
82
  payableId: C,
82
83
  scheduledPaymentDate: D?.scheduled_payment_date,
83
84
  enabled: p
84
- }), L = ae(D), R = De({
85
+ }), L = ae(D), R = Oe({
85
86
  payableId: N,
86
87
  counterpartId: p ? k : void 0,
87
88
  saveErrorMessage: h.detail.paymentInstructionsSaveError,
88
89
  linkErrorMessage: h.detail.paymentInstructionsLinkError
89
- }), { initResponse: z } = re(), B = e(z?.scopes, [t.CounterpartWriteOrg]) && e(z?.scopes, [t.PayableWriteOrg]), V = me({
90
+ }), { initResponse: z } = re(), B = e(z?.scopes, [t.CounterpartWriteOrg]) && e(z?.scopes, [t.PayableWriteOrg]), V = he({
90
91
  payableId: N,
91
92
  amountDueMinorUnits: ie(D) ?? 0,
92
93
  amountToPayMinorUnits: D?.amount_to_pay ?? void 0,
@@ -94,12 +95,12 @@ function u({ open: u, onOpenChange: d, payableId: f, readOnly: p = !1, copy: m,
94
95
  dueDate: D?.due_date,
95
96
  hasScheduledPayment: I.hasScheduledPayment,
96
97
  labels: h.markAsPaid
97
- }), H = ve({
98
+ }), H = ye({
98
99
  payableId: N,
99
100
  approvalPolicyId: D?.approval_policy_id,
100
101
  enabled: p,
101
102
  copy: h.approvalPolicyCopy
102
- }), { actions: Le, decisionDialog: Re } = be({
103
+ }), { actions: Be, decisionDialog: Ve } = xe({
103
104
  payableId: N,
104
105
  status: D?.status,
105
106
  currentApprovalRequestId: P.id,
@@ -112,8 +113,8 @@ function u({ open: u, onOpenChange: d, payableId: f, readOnly: p = !1, copy: m,
112
113
  labels: h.actions,
113
114
  isMarkAsPaidPending: V.isPending,
114
115
  onMarkAsPaidSelect: V.open,
115
- onPayBillSelect: () => Ae(L) || !B ? F.current?.open() : R.open()
116
- }), U = Se({
116
+ onPayBillSelect: () => je(L) || !B ? F.current?.open() : R.open()
117
+ }), U = Ce({
117
118
  payableId: C,
118
119
  status: D?.status,
119
120
  enabled: !p,
@@ -122,11 +123,11 @@ function u({ open: u, onOpenChange: d, payableId: f, readOnly: p = !1, copy: m,
122
123
  }), W = a(() => (E.data?.data ?? []).map((e) => ({
123
124
  value: e.id,
124
125
  label: [e.nominal_code, e.name].filter(Boolean).join(" — ")
125
- })), [E.data]), G = ue(N), ze = e(z?.scopes, [t.UserReadOrg]), K = te({ enabled: p && ze }), q = a(() => we(G.data?.data ?? [], K.data?.data ?? [], h.history), [
126
+ })), [E.data]), G = de(N), He = e(z?.scopes, [t.UserReadOrg]), K = te({ enabled: p && He }), q = a(() => Te(G.data?.data ?? [], K.data?.data ?? [], h.history), [
126
127
  G.data,
127
128
  K.data,
128
129
  h.history
129
- ]), Be = a(() => p && D ? Ce({
130
+ ]), Ue = a(() => p && D ? we({
130
131
  payable: D,
131
132
  lineItems: T.lineItems,
132
133
  glCodeOptions: W,
@@ -143,35 +144,48 @@ function u({ open: u, onOpenChange: d, payableId: f, readOnly: p = !1, copy: m,
143
144
  T.lineItems,
144
145
  D,
145
146
  p
146
- ]), J = D?.source_of_payable_data === "ocr", Y = L?.name, X = p ? Y ? h.viewTitle(Y) : h.readOnlyTitle : J && Y ? h.extractedTitle(Y) : h.newTitle, Ve = p && D?.created_at ? h.addedOn(ne(D.created_at.slice(0, 10))) : void 0, Z = i(() => {
147
+ ]), J = D?.source_of_payable_data === "ocr", Y = L?.name, We = p ? Y ? h.viewTitle(Y) : h.readOnlyTitle : J && Y ? h.extractedTitle(Y) : h.newTitle, Ge = p && D?.created_at ? h.addedOn(ne(D.created_at.slice(0, 10))) : void 0, X = i(() => {
147
148
  let e = O.isDirty || A.hasUnsavedVendorChanges || !!j.stagedFile || j.isFileDeletionPending;
148
- !p && e && !window.confirm(h.discardConfirm) || d(!1);
149
+ if (!p && e) {
150
+ x(!0);
151
+ return;
152
+ }
153
+ d(!1);
149
154
  }, [
150
155
  j.isFileDeletionPending,
151
156
  j.stagedFile,
152
- h.discardConfirm,
153
157
  O.isDirty,
154
158
  d,
155
159
  p,
156
160
  A.hasUnsavedVendorChanges
157
- ]), He = i((e) => {
158
- if (!M) return e ? d(!0) : Z();
161
+ ]), Ke = i(() => {
162
+ x(!1), d(!1);
163
+ }, [d]), Z = T.isResolving || A.mode === "creating", qe = i(async () => {
164
+ if (Z) return;
165
+ let e = await j.saveDraft();
166
+ x(!1), e && d(!1);
159
167
  }, [
168
+ j,
160
169
  Z,
170
+ d
171
+ ]), Je = i((e) => {
172
+ if (!M) return e ? d(!0) : X();
173
+ }, [
174
+ X,
161
175
  M,
162
176
  d
163
- ]), Q = !!Me && !Pe, $ = !p && J && !Ne, Ue = Q || $ ? /* @__PURE__ */ l(s, { children: [Q ? /* @__PURE__ */ c(se, {
164
- onNotADuplicate: p ? void 0 : () => x(!0),
165
- onRemoveBill: p ? void 0 : () => x(!0),
177
+ ]), Q = !!Ne && !Ie, $ = !p && J && !Pe, Ye = Q || $ ? /* @__PURE__ */ l(s, { children: [Q ? /* @__PURE__ */ c(se, {
178
+ onNotADuplicate: p ? void 0 : () => b(!0),
179
+ onRemoveBill: p ? void 0 : () => b(!0),
166
180
  testId: r.duplicateNotice
167
- }) : null, $ ? /* @__PURE__ */ c(ce, { onDismiss: () => b(!0) }) : null] }) : void 0;
181
+ }) : null, $ ? /* @__PURE__ */ c(ce, { onDismiss: () => Fe(!0) }) : null] }) : void 0;
168
182
  return /* @__PURE__ */ l(s, { children: [
169
183
  /* @__PURE__ */ c(oe, {
170
184
  open: u,
171
- onOpenChange: He,
172
- title: X,
173
- subtitle: Ve,
174
- notice: Ue,
185
+ onOpenChange: Je,
186
+ title: We,
187
+ subtitle: Ge,
188
+ notice: Ye,
175
189
  vendor: {
176
190
  ...A,
177
191
  testId: r.vendorSection
@@ -192,7 +206,7 @@ function u({ open: u, onOpenChange: d, payableId: f, readOnly: p = !1, copy: m,
192
206
  errors: O.lineItemErrors,
193
207
  testId: r.lineItems
194
208
  },
195
- documentPanel: /* @__PURE__ */ c(Te, {
209
+ documentPanel: /* @__PURE__ */ c(Ee, {
196
210
  payableId: C,
197
211
  readOnly: p,
198
212
  isDocumentPending: !!C && !D?.file && (w.isLoading || D?.ocr_status === "processing"),
@@ -219,8 +233,8 @@ function u({ open: u, onOpenChange: d, payableId: f, readOnly: p = !1, copy: m,
219
233
  menuItems: U.menuItems,
220
234
  readOnly: p,
221
235
  detail: p ? {
222
- view: Be,
223
- actions: Le,
236
+ view: Ue,
237
+ actions: Be,
224
238
  scheduledSummary: I.hasScheduledPayment && I.scheduledDateLabel ? h.scheduledSummary(I.scheduledDateLabel) : void 0,
225
239
  paymentInstructionsForm: k && B ? {
226
240
  isOpen: R.isOpen,
@@ -239,13 +253,25 @@ function u({ open: u, onOpenChange: d, payableId: f, readOnly: p = !1, copy: m,
239
253
  isSaving: M,
240
254
  isSavingDraft: j.isSavingDraft,
241
255
  isFinalizing: j.isFinalizing,
242
- onCancel: Z,
256
+ onCancel: X,
243
257
  onSaveDraft: j.saveDraft,
244
258
  onFinalize: j.finalize,
245
259
  testId: r.dialog
246
260
  }),
261
+ /* @__PURE__ */ c(ue, {
262
+ open: Le,
263
+ onSaveDraft: qe,
264
+ onDiscard: Ke,
265
+ onCancel: () => x(!1),
266
+ isSaving: j.isSavingDraft,
267
+ isSaveDraftDisabled: Z,
268
+ labels: h.unsavedChanges,
269
+ testId: r.unsavedDialog,
270
+ saveDraftTestId: r.unsavedSaveDraft,
271
+ discardTestId: r.unsavedDiscard
272
+ }),
247
273
  /* @__PURE__ */ c(n, {
248
- ...Re,
274
+ ...Ve,
249
275
  labels: { cancelButton: h.actions.decisionDialog.cancelButton },
250
276
  testId: r.decisionDialog,
251
277
  confirmTestId: r.decisionConfirm,
@@ -258,10 +284,10 @@ function u({ open: u, onOpenChange: d, payableId: f, readOnly: p = !1, copy: m,
258
284
  confirmTestId: r.deleteDraftConfirm
259
285
  }),
260
286
  /* @__PURE__ */ c(le, { ...V.dialogProps }),
261
- p && D ? /* @__PURE__ */ c(pe, {
287
+ p && D ? /* @__PURE__ */ c(me, {
262
288
  ref: F,
263
289
  payable: D,
264
- poweredByBankName: je,
290
+ poweredByBankName: Me,
265
291
  labels: h.payBill
266
292
  }) : null
267
293
  ] });
@@ -82,4 +82,7 @@ import "./index91.js";
82
82
  import "./index92.js";
83
83
  import { SourceDocumentPanel as b } from "./index93.js";
84
84
  import "./index94.js";
85
- export { e as AddBillDialog, a as BILL_DETAILS_SHEET_LABELS_EN, t as BILL_STATUS_BADGE_LABELS_EN, l as BillColumn, n as BillCreateScreen, i as BillDecisionDialog, o as BillDetailsSheet, s as BillDuplicateNotice, r as BillPayWidgetUi, d as BillUploadStatusTray, c as BillsFilterField, u as BillsScreen, f as DuplicateBillsDialog, p as ExtractionNotice, g as MARK_AS_PAID_DIALOG_LABELS_EN, _ as MarkAsPaidDialog, m as REVIEW_TRANSACTION_DIALOG_LABELS_EN, h as ReviewTransactionDialog, v as SCHEDULE_PAYMENT_DIALOG_LABELS_EN, y as SchedulePaymentDialog, b as SourceDocumentPanel };
85
+ import { UNSAVED_BILL_DIALOG_LABELS_EN as x } from "./index95.js";
86
+ import { UnsavedBillDialog as S } from "./index96.js";
87
+ import "./index97.js";
88
+ export { e as AddBillDialog, a as BILL_DETAILS_SHEET_LABELS_EN, t as BILL_STATUS_BADGE_LABELS_EN, l as BillColumn, n as BillCreateScreen, i as BillDecisionDialog, o as BillDetailsSheet, s as BillDuplicateNotice, r as BillPayWidgetUi, d as BillUploadStatusTray, c as BillsFilterField, u as BillsScreen, f as DuplicateBillsDialog, p as ExtractionNotice, g as MARK_AS_PAID_DIALOG_LABELS_EN, _ as MarkAsPaidDialog, m as REVIEW_TRANSACTION_DIALOG_LABELS_EN, h as ReviewTransactionDialog, v as SCHEDULE_PAYMENT_DIALOG_LABELS_EN, y as SchedulePaymentDialog, b as SourceDocumentPanel, x as UNSAVED_BILL_DIALOG_LABELS_EN, S as UnsavedBillDialog };
@@ -0,0 +1,10 @@
1
+ //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index95.js
2
+ var e = {
3
+ title: "Save this bill as a draft?",
4
+ description: "This bill has changes that have not been saved. Save it as a draft to finish later, or discard the changes.",
5
+ saveDraftButton: "Save as draft",
6
+ discardButton: "Discard changes",
7
+ cancelButton: "Keep editing"
8
+ };
9
+ //#endregion
10
+ export { e as UNSAVED_BILL_DIALOG_LABELS_EN };
@@ -0,0 +1,47 @@
1
+ import { AlertDialog as e, AlertDialogContent as t, AlertDialogDescription as n, AlertDialogFooter as r, AlertDialogHeader as i, AlertDialogTitle as a, Button as o } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
2
+ import { UNSAVED_BILL_DIALOG_LABELS_EN as s } from "./index95.js";
3
+ import { jsx as c, jsxs as l } from "react/jsx-runtime";
4
+ //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index96.js
5
+ function u({ open: u, onSaveDraft: d, onDiscard: f, onCancel: p, isSaving: m, isSaveDraftDisabled: h, labels: g, testId: _, saveDraftTestId: v, discardTestId: y }) {
6
+ let b = {
7
+ ...s,
8
+ ...g
9
+ };
10
+ return /* @__PURE__ */ c(e, {
11
+ open: u,
12
+ onOpenChange: (e) => {
13
+ !e && !m && p();
14
+ },
15
+ children: /* @__PURE__ */ l(t, {
16
+ "data-testid": _,
17
+ children: [/* @__PURE__ */ l(i, { children: [/* @__PURE__ */ c(a, { children: b.title }), /* @__PURE__ */ c(n, { children: b.description })] }), /* @__PURE__ */ l(r, { children: [
18
+ /* @__PURE__ */ c(o, {
19
+ type: "button",
20
+ variant: "outline",
21
+ onClick: p,
22
+ disabled: m,
23
+ children: b.cancelButton
24
+ }),
25
+ /* @__PURE__ */ c(o, {
26
+ type: "button",
27
+ variant: "outline",
28
+ onClick: f,
29
+ disabled: m,
30
+ "data-testid": y,
31
+ children: b.discardButton
32
+ }),
33
+ /* @__PURE__ */ c(o, {
34
+ type: "button",
35
+ variant: "default",
36
+ loading: m,
37
+ disabled: m || h,
38
+ onClick: d,
39
+ "data-testid": v,
40
+ children: b.saveDraftButton
41
+ })
42
+ ] })]
43
+ })
44
+ });
45
+ }
46
+ //#endregion
47
+ export { u as UnsavedBillDialog, u as default };
@@ -0,0 +1,2 @@
1
+ import "./index95.js";
2
+ import "./index96.js";
@@ -13,7 +13,7 @@ import "../../ui/dist/index.js";
13
13
  import { useCardsWidget as o } from "./index8.js";
14
14
  import { CardDetailsWidget as s } from "../../../card-details-widget/feature/dist/index6.js";
15
15
  import "../../../card-details-widget/feature/dist/index.js";
16
- import { CreateCardWidget as c } from "../../../create-card-widget/feature/dist/index7.js";
16
+ import { CreateCardWidget as c } from "../../../create-card-widget/feature/dist/index8.js";
17
17
  import "../../../create-card-widget/feature/dist/index.js";
18
18
  import { useCallback as l, useMemo as u, useState as d } from "react";
19
19
  import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
@@ -1,6 +1,7 @@
1
1
  import { useCreateCard as e } from "./index2.js";
2
2
  import "./index3.js";
3
3
  import { useCreateDebitCardMutation as t } from "./index4.js";
4
- import { useManageDebitCardAccessMutation as n } from "./index5.js";
5
- import { useCreateCardOrganizationQuery as r } from "./index6.js";
6
- export { e as useCreateCard, r as useCreateCardOrganizationQuery, t as useCreateDebitCardMutation, n as useManageDebitCardAccessMutation };
4
+ import { useCreateVelocityControlMutation as n } from "./index5.js";
5
+ import { useManageDebitCardAccessMutation as r } from "./index6.js";
6
+ import { useCreateCardOrganizationQuery as i } from "./index7.js";
7
+ export { e as useCreateCard, i as useCreateCardOrganizationQuery, t as useCreateDebitCardMutation, n as useCreateVelocityControlMutation, r as useManageDebitCardAccessMutation };
@@ -1,12 +1,18 @@
1
1
  import { organizationHeaders as e } from "../../../shared/data-access/dist/lib/organizationHeaders.js";
2
- import { getDebitCardsQueryKey as t } from "../../../shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js";
2
+ import { getDebitCardsQueryKey as t, getVelocityControlsQueryKey as n } from "../../../shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js";
3
3
  import "../../../shared/data-access/dist/index.js";
4
4
  //#region ../../libs/tesouro-embedded-components-react/create-card-widget/data-access/dist/index3.js
5
- function n({ client: n, organizationId: r }) {
5
+ function r({ client: n, organizationId: r }) {
6
6
  return t({
7
7
  client: n,
8
8
  headers: e(r)
9
9
  });
10
10
  }
11
+ function i({ client: t, organizationId: r }) {
12
+ return n({
13
+ client: t,
14
+ headers: e(r)
15
+ });
16
+ }
11
17
  //#endregion
12
- export { n as debitCardsInvalidationKey };
18
+ export { r as debitCardsInvalidationKey, i as velocityControlsInvalidationKey };
@@ -5,9 +5,9 @@
5
5
  import { invalidateAllClients as e } from "../../../shared/data-access/dist/lib/clientRegistry.js";
6
6
  import { useEmbedApi as t } from "../../../shared/data-access/dist/lib/EmbedApiContext.js";
7
7
  import { organizationHeaders as n } from "../../../shared/data-access/dist/lib/organizationHeaders.js";
8
- import { manageDebitCardAccessMutation as r } from "../../../shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js";
8
+ import { createVelocityControlMutation as r } from "../../../shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js";
9
9
  import "../../../shared/data-access/dist/index.js";
10
- import { debitCardsInvalidationKey as i } from "./index3.js";
10
+ import { velocityControlsInvalidationKey as i } from "./index3.js";
11
11
  import { useMutation as a } from "@tanstack/react-query";
12
12
  //#region ../../libs/tesouro-embedded-components-react/create-card-widget/data-access/dist/index5.js
13
13
  function o() {
@@ -26,4 +26,4 @@ function o() {
26
26
  });
27
27
  }
28
28
  //#endregion
29
- export { o as useManageDebitCardAccessMutation };
29
+ export { o as useCreateVelocityControlMutation };
@@ -2,21 +2,28 @@
2
2
  "use client";
3
3
  "use client";
4
4
  "use client";
5
- import { useEmbedApi as e } from "../../../shared/data-access/dist/lib/EmbedApiContext.js";
6
- import { getOrganizationOptions as t } from "../../../shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js";
7
- import { withAuthEpoch as n } from "../../../shared/data-access/dist/lib/withAuthEpoch.js";
5
+ import { invalidateAllClients as e } from "../../../shared/data-access/dist/lib/clientRegistry.js";
6
+ import { useEmbedApi as t } from "../../../shared/data-access/dist/lib/EmbedApiContext.js";
7
+ import { organizationHeaders as n } from "../../../shared/data-access/dist/lib/organizationHeaders.js";
8
+ import { manageDebitCardAccessMutation as r } from "../../../shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js";
8
9
  import "../../../shared/data-access/dist/index.js";
9
- import { useQuery as r } from "@tanstack/react-query";
10
+ import { debitCardsInvalidationKey as i } from "./index3.js";
11
+ import { useMutation as a } from "@tanstack/react-query";
10
12
  //#region ../../libs/tesouro-embedded-components-react/create-card-widget/data-access/dist/index6.js
11
- function i({ enabled: i } = {}) {
12
- let { client: a, organizationId: o, widgetToken: s, authEpoch: c } = e(), l = t({
13
- client: a,
14
- path: { organizationId: o ?? "" }
13
+ function o() {
14
+ let { client: o, organizationId: s } = t(), c = n(s), l = r({
15
+ client: o,
16
+ headers: c
15
17
  });
16
- return r({
17
- ...n(l, c),
18
- enabled: !!(o && s) && (i === !0 || i === void 0)
18
+ return a({
19
+ ...l,
20
+ onSuccess: async (...t) => {
21
+ await e(i({
22
+ client: o,
23
+ organizationId: s
24
+ })), await l.onSuccess?.(...t);
25
+ }
19
26
  });
20
27
  }
21
28
  //#endregion
22
- export { i as useCreateCardOrganizationQuery };
29
+ export { o as useManageDebitCardAccessMutation };
@@ -0,0 +1,22 @@
1
+ "use client";
2
+ "use client";
3
+ "use client";
4
+ "use client";
5
+ import { useEmbedApi as e } from "../../../shared/data-access/dist/lib/EmbedApiContext.js";
6
+ import { getOrganizationOptions as t } from "../../../shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js";
7
+ import { withAuthEpoch as n } from "../../../shared/data-access/dist/lib/withAuthEpoch.js";
8
+ import "../../../shared/data-access/dist/index.js";
9
+ import { useQuery as r } from "@tanstack/react-query";
10
+ //#region ../../libs/tesouro-embedded-components-react/create-card-widget/data-access/dist/index7.js
11
+ function i({ enabled: i } = {}) {
12
+ let { client: a, organizationId: o, widgetToken: s, authEpoch: c } = e(), l = t({
13
+ client: a,
14
+ path: { organizationId: o ?? "" }
15
+ });
16
+ return r({
17
+ ...n(l, c),
18
+ enabled: !!(o && s) && (i === !0 || i === void 0)
19
+ });
20
+ }
21
+ //#endregion
22
+ export { i as useCreateCardOrganizationQuery };
@@ -1,4 +1,4 @@
1
1
  import { CardFormatValue as e } from "./index3.js";
2
- import { CREATE_CARD_FEATURE_LABELS_EN as t, resolveCreateCardFeatureLabels as n } from "./index4.js";
3
- import { CreateCardWidget as r } from "./index7.js";
2
+ import { CREATE_CARD_FEATURE_LABELS_EN as t, resolveCreateCardFeatureLabels as n } from "./index5.js";
3
+ import { CreateCardWidget as r } from "./index8.js";
4
4
  export { t as CREATE_CARD_FEATURE_LABELS_EN, e as CardFormatValue, r as CreateCardWidget, n as resolveCreateCardFeatureLabels };
@@ -1,34 +1,39 @@
1
+ import { parseDecimalAmountToMinorUnits as e } from "../../../shared/util/dist/lib/parseDecimalAmountToMinorUnits.js";
1
2
  //#region ../../libs/tesouro-embedded-components-react/create-card-widget/feature/dist/index4.js
2
- var e = {
3
- toast: {
4
- creating: "Creating your card…",
5
- success: "Card created successfully.",
6
- error: "We could not create this card. Please try again.",
7
- companyAdminAccessWarning: "Card created, but some admins could not be granted access to it.",
8
- debitCardIssuersError: "We could not load the list of admins to grant access to this card.",
9
- retry: "Retry"
10
- },
11
- untitledFundingAccount: "Bank account",
12
- success: {
13
- pendingActivationTitle: "Card created",
14
- pendingActivationDescription: "Your card needs to be activated before it can be used.",
15
- createdTitle: "Card created",
16
- createdDescription: "Your card has been created."
17
- }
18
- };
19
- function t(t) {
20
- return {
21
- ...e,
22
- ...t,
23
- toast: {
24
- ...e.toast,
25
- ...t?.toast
26
- },
27
- success: {
28
- ...e.success,
29
- ...t?.success
30
- }
3
+ var t = {
4
+ OneTime: "LIFETIME",
5
+ Daily: "DAY",
6
+ Monthly: "MONTH"
7
+ }, n = new Set(Object.values(t));
8
+ function r(e) {
9
+ return e !== null && n.has(e);
10
+ }
11
+ function i(t) {
12
+ return e(t, "USD");
13
+ }
14
+ function a({ cardId: e, amount: t, period: n, id: a, name: o }) {
15
+ let s = i(t);
16
+ if (!(!s || !r(n))) return {
17
+ id: a,
18
+ name: o,
19
+ amountLimit: s,
20
+ currencyCode: "USD",
21
+ velocityWindow: n,
22
+ cardId: e,
23
+ active: !0
24
+ };
25
+ }
26
+ function o({ cardId: e, amount: t, id: n, name: r }) {
27
+ let a = i(t);
28
+ if (a) return {
29
+ id: n,
30
+ name: r,
31
+ amountLimit: a,
32
+ currencyCode: "USD",
33
+ velocityWindow: "TRANSACTION",
34
+ cardId: e,
35
+ active: !0
31
36
  };
32
37
  }
33
38
  //#endregion
34
- export { e as CREATE_CARD_FEATURE_LABELS_EN, t as resolveCreateCardFeatureLabels };
39
+ export { t as SpendLimitPeriodValue, o as buildPerTransactionMaximumVelocityControlRequest, a as buildSpendLimitVelocityControlRequest, r as isSpendLimitPeriod, i as parseControlAmountToMinorUnits };
@@ -1,15 +1,57 @@
1
- import { hasAnyScope as e } from "../../../shared/data-access/dist/lib/hasAnyScope.js";
2
- import { Scope as t } from "../../../shared/data-access/dist/lib/scopes.js";
3
- import "../../../shared/data-access/dist/index.js";
4
1
  //#region ../../libs/tesouro-embedded-components-react/create-card-widget/feature/dist/index5.js
5
- function n(n) {
6
- let r = new Set(n ?? []);
2
+ var e = {
3
+ toast: {
4
+ creating: "Creating your card…",
5
+ success: "Card created successfully.",
6
+ error: "We could not create this card. Please try again.",
7
+ controlsWarning: "Card created, but spend controls could not be applied.",
8
+ companyAdminAccessWarning: "Card created, but some admins could not be granted access to it.",
9
+ controlsAndAccessWarning: "Card created, but spend controls could not be applied and some admins could not be granted access to it.",
10
+ debitCardIssuersError: "We could not load the list of admins to grant access to this card.",
11
+ retry: "Retry"
12
+ },
13
+ untitledFundingAccount: "Bank account",
14
+ velocityControlNames: {
15
+ spendLimit: "Spend limit",
16
+ perTransactionMaximum: "Per-transaction maximum"
17
+ },
18
+ spendLimit: {
19
+ periodOneTime: "One-time",
20
+ periodDaily: "Daily",
21
+ periodMonthly: "Monthly",
22
+ oneTimeWarningTitle: "Single-use behavior:",
23
+ oneTimeWarningDescription: "once total spend reaches the limit, this card locks automatically and declines all future purchases. Refunds can still be credited to a locked card.",
24
+ dailyResetNotice: "Spend accumulates toward the limit and resets every day at 12:00 AM ET.",
25
+ monthlyResetNotice: "Spend accumulates toward the limit and resets on the 1st of each month at 12:00 AM ET."
26
+ },
27
+ success: {
28
+ pendingActivationTitle: "Card created",
29
+ pendingActivationDescription: "Your card needs to be activated before it can be used.",
30
+ createdTitle: "Card created",
31
+ createdDescription: "Your card has been created."
32
+ }
33
+ };
34
+ function t(t) {
7
35
  return {
8
- canIssue: e(r, [t.DebitCardIssueOrg]),
9
- canReadUsers: e(r, [t.UserReadOrg]),
10
- canReadFundingAccounts: e(r, [t.BankAccountReadOrg]),
11
- canReadOrganization: e(r, [t.OrganizationReadOrg])
36
+ ...e,
37
+ ...t,
38
+ toast: {
39
+ ...e.toast,
40
+ ...t?.toast
41
+ },
42
+ velocityControlNames: {
43
+ ...e.velocityControlNames,
44
+ ...t?.velocityControlNames
45
+ },
46
+ spendLimit: {
47
+ ...e.spendLimit,
48
+ ...t?.spendLimit
49
+ },
50
+ success: {
51
+ ...e.success,
52
+ ...t?.success
53
+ }
12
54
  };
13
55
  }
14
56
  //#endregion
15
- export { n as getCreateCardPermissions };
57
+ export { e as CREATE_CARD_FEATURE_LABELS_EN, t as resolveCreateCardFeatureLabels };