@tesouro/embedded-components-react 0.5.303 → 0.5.305

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 (52) hide show
  1. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index.js +9 -9
  2. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index12.js +7 -7
  3. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index13.js +10 -9
  4. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index14.js +8 -7
  5. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index15.js +7 -8
  6. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index16.js +8 -28
  7. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index17.js +24 -157
  8. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index18.js +20 -13
  9. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index19.js +13 -34
  10. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index20.js +153 -89
  11. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index21.js +17 -83
  12. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index22.js +23 -3
  13. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index23.js +42 -55
  14. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index24.js +93 -107
  15. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index25.js +77 -185
  16. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index26.js +3 -80
  17. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index27.js +55 -72
  18. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index28.js +111 -113
  19. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index29.js +184 -463
  20. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index3.js +14 -4
  21. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index30.js +78 -11
  22. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index31.js +61 -74
  23. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index32.js +115 -80
  24. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index33.js +449 -216
  25. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index34.js +116 -42
  26. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index35.js +11 -249
  27. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index36.js +85 -23
  28. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index37.js +80 -648
  29. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index38.js +240 -4
  30. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index39.js +44 -40
  31. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index4.js +38 -15
  32. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index40.js +242 -240
  33. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index41.js +25 -3
  34. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index42.js +538 -3
  35. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index43.js +3 -66
  36. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index44.js +42 -1
  37. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index45.js +239 -0
  38. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index46.js +3 -0
  39. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index47.js +5 -0
  40. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index48.js +67 -0
  41. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index49.js +1 -0
  42. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index5.js +227 -38
  43. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index6.js +82 -224
  44. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index7.js +45 -82
  45. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index8.js +4 -47
  46. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index9.js +1 -1
  47. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/ui/dist/index.js +2 -2
  48. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/ui/dist/index29.js +1 -1
  49. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/ui/dist/index31.js +2 -2
  50. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/lib/BillPayWidgetNative/BillsTab.js +6 -6
  51. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  52. package/package.json +1 -1
@@ -1,101 +1,165 @@
1
- import { formatCalendarDate as e } from "../../../../shared/util/dist/lib/formatCalendarDate.js";
2
- import { derivePayableStatus as t } from "../../../util/dist/lib/derivePayableStatus.js";
3
- import { formatBillMoney as n } from "../../../util/dist/lib/formatBillMoney.js";
4
- import { resolveLineItemAmountMinorUnits as r } from "../../../util/dist/lib/resolveLineItemAmount.js";
5
- import { resolveLineItemQuantity as i } from "../../../util/dist/lib/resolveLineItemQuantity.js";
6
- import { resolveVendor as a, resolveVendorName as o } from "../../../util/dist/lib/resolveVendor.js";
1
+ "use client";
2
+ "use client";
3
+ "use client";
4
+ "use client";
5
+ import { toast as e } from "../../../../../../packages/shared-ui-shadcn/dist/index.js";
6
+ import "../../../../shared/ui/dist/index.js";
7
+ import { useWidgetConfig as t } from "../../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
8
+ import "../../../../shared/feature/dist/index.js";
9
+ import { useApprovePayableApprovalRequestMutation as n, useRejectPayableApprovalRequestMutation as r } from "../../data-access/dist/index2.js";
10
+ import { useCancelPayableMutation as i } from "../../data-access/dist/index6.js";
11
+ import { useCancelScheduledPaymentMutation as a } from "../../data-access/dist/index7.js";
12
+ import { useForceApprovePayableMutation as o } from "../../data-access/dist/index11.js";
13
+ import { useForceRejectPayableMutation as s } from "../../data-access/dist/index12.js";
14
+ import { useReopenPayableMutation as c } from "../../data-access/dist/index13.js";
15
+ import "../../data-access/dist/index.js";
16
+ import { getBillDetailActions as l } from "./index6.js";
17
+ import { useState as u } from "react";
18
+ import { BanIcon as d, HandIcon as f } from "lucide-react";
7
19
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index20.js
8
- function s(e) {
9
- return e.total_amount ?? e.amount_due ?? void 0;
10
- }
11
- function c(e) {
12
- return typeof e == "string" ? e : "";
13
- }
14
- function l({ payable: l, lineItems: d, ledgerAccounts: f, labels: p, hasScheduledPayment: m, now: h, rejection: g, achInstructions: _, achInstructionsReadable: v = !1 }) {
15
- let y = l.currency, b = (e) => n(e, y), x = t({
16
- apiStatus: l.status,
17
- dueDate: l.due_date,
18
- scheduledPaymentDate: l.scheduled_payment_date,
19
- hasScheduledPayment: m,
20
- now: h
21
- }), S = a(l), C = o(l), w = e(l.issued_at) || p.notProvided, T = e(l.due_date) || p.notProvided, E = [{
22
- label: p.vendorRow,
23
- value: C || p.notProvided,
24
- secondaryValue: S?.email ?? void 0
25
- }], D = v ? _?.account_number : void 0;
26
- D && E.push({
27
- label: p.bankAccountRow,
28
- value: p.bankAccountValue(D.slice(-4))
29
- });
30
- let O = [
31
- {
32
- label: p.invoiceNumberRow,
33
- value: l.document_id || p.notProvided
20
+ function p({ payableId: d, status: f, currentApprovalRequestId: p, arePendingApproversUnknown: m, hasScheduledPayment: h, scheduledPaymentIntentId: g, isScheduledPaymentUnknown: v, isPayabilityUnknown: x, labels: S, isMarkAsPaidPending: C, hasApprovalPolicy: w = !0, hasWaitingRequest: T, pendingApprovers: E, onPayBillSelect: D, onMarkAsPaidSelect: O, onEditSelect: k, onActionSucceeded: A }) {
21
+ let { initResponse: j } = t(), M = r(), N = n(), P = i(), F = a(), I = c(), L = o(), R = s(), z = C || M.isPending || N.isPending || P.isPending || F.isPending || I.isPending || L.isPending || R.isPending, [B, V] = u(), H = B && (B.id !== "cancelScheduledPayment" || B.scheduledPaymentIntentId === g) ? B : void 0, U = d && f ? l({
22
+ status: f,
23
+ scopes: j?.scopes,
24
+ canDecideApprovalRequest: !!p,
25
+ arePendingApproversUnknown: m,
26
+ hasApprovalPolicy: w,
27
+ hasWaitingRequest: T,
28
+ hasScheduledPayment: h || v,
29
+ scheduledPaymentIntentId: g,
30
+ isPayabilityUnknown: x,
31
+ canEdit: !!k,
32
+ labels: S
33
+ }) : [], W = (t) => ({
34
+ onError: () => e.error(S.actionError),
35
+ onSuccess: () => {
36
+ let n = b(t) && !w ? `${t}NoApprovalPolicy` : t;
37
+ e.success(S.actionSuccess[n]), A?.(t);
38
+ }
39
+ }), G = {
40
+ reject: {
41
+ isPending: M.isPending,
42
+ run: (e) => p && M.mutate({
43
+ path: { approval_request_id: p },
44
+ body: e ? { reject_reason: e } : void 0
45
+ }, W("reject"))
34
46
  },
35
- {
36
- label: p.issueDateRow,
37
- value: w
47
+ approve: {
48
+ isPending: N.isPending,
49
+ run: () => p && N.mutate({ path: { approval_request_id: p } }, W("approve"))
38
50
  },
39
- {
40
- label: p.dueDateRow,
41
- value: T
51
+ cancel: {
52
+ isPending: P.isPending,
53
+ run: () => d && P.mutate({ path: { payable_id: d } }, W("cancel"))
42
54
  },
43
- {
44
- label: p.poNumberRow,
45
- value: c(l.purchase_order_number) || p.notProvided
46
- }
47
- ], k = new Map(f.map((e) => [e.id, [e.nominal_code, e.name].filter(Boolean).join(" — ")])), A = d.map((e) => {
48
- let t = b(e.unit_price), n = String(i(e));
49
- return {
50
- id: e.id,
51
- description: e.name ?? e.description ?? "",
52
- glCodeLabel: (e.ledger_account_id ? k.get(e.ledger_account_id) : void 0) || p.glCodeMissing,
53
- quantityLabel: t ? p.quantityValue(n, t) : p.quantityOnlyValue(n),
54
- amountLabel: b(r(e)) ?? ""
55
- };
56
- }), j = [
57
- {
58
- label: p.subtotalRow,
59
- value: l.subtotal
55
+ cancelScheduledPayment: {
56
+ isPending: F.isPending,
57
+ run: () => {
58
+ let e = H?.scheduledPaymentIntentId;
59
+ d && e && F.mutate({
60
+ path: { payment_intent_id: e },
61
+ payableId: d
62
+ }, W("cancelScheduledPayment"));
63
+ }
64
+ },
65
+ reopen: {
66
+ isPending: I.isPending,
67
+ run: () => d && I.mutate({ path: { payable_id: d } }, W("reopen"))
60
68
  },
61
- {
62
- label: p.discountsRow,
63
- value: l.discount
69
+ forceApprove: {
70
+ isPending: L.isPending,
71
+ run: () => d && L.mutate({ path: { payable_id: d } }, W("forceApprove"))
64
72
  },
65
- {
66
- label: p.taxRow,
67
- value: l.tax_amount
73
+ forceReject: {
74
+ isPending: R.isPending,
75
+ run: () => d && R.mutate({ path: { payable_id: d } }, W("forceReject"))
68
76
  }
69
- ].map(({ label: e, value: t }) => ({
70
- label: e,
71
- value: b(t)
72
- })).filter((e) => !!e.value), M = b(s(l));
73
- M && j.push({
74
- label: p.totalRow,
75
- value: M,
76
- emphasis: !0
77
- });
78
- let N = u(l);
77
+ }, K = U.map((e) => ({
78
+ ...e,
79
+ disabled: z,
80
+ loading: e.id === "markAsPaid" ? C : G[e.id]?.isPending ?? !1,
81
+ onSelect: () => {
82
+ if (!z && d) {
83
+ if (e.id === "payBill") {
84
+ D();
85
+ return;
86
+ }
87
+ if (e.id === "markAsPaid") {
88
+ O();
89
+ return;
90
+ }
91
+ if (e.id === "edit") {
92
+ k?.();
93
+ return;
94
+ }
95
+ if (y(e.id)) {
96
+ V({
97
+ id: e.id,
98
+ scheduledPaymentIntentId: g
99
+ });
100
+ return;
101
+ }
102
+ G[e.id]?.run();
103
+ }
104
+ }
105
+ }));
79
106
  return {
80
- title: C,
81
- subtitle: p.subtitle,
82
- status: x.status,
83
- statusTone: x.tone,
84
- amountDueLabel: b(l.amount_due) ?? b(l.total_amount) ?? "",
85
- amountPaidLabel: N ? b(l.amount_paid) : void 0,
86
- paidOnLabel: N ? p.paidOnLabel(N) : void 0,
87
- invoiceDateLabel: w,
88
- dueDateLabel: T,
89
- dueDateTone: x.isOverdue ? "danger" : "default",
90
- payToItems: E,
91
- invoiceItems: O,
92
- lineItems: A,
93
- totals: j,
94
- rejection: g
107
+ isActionPending: z,
108
+ actions: {
109
+ row: K.filter((e) => e.surface === "row"),
110
+ menu: K.filter((e) => e.surface === "menu")
111
+ },
112
+ decisionDialog: {
113
+ open: !!H,
114
+ copy: H ? {
115
+ ...S.decisionDialog[H.id],
116
+ ...b(H.id) && !w ? S.decisionDialog[H.id].noApprovalPolicy : void 0,
117
+ presentation: _(H.id),
118
+ pendingApprovers: b(H.id) ? E ?? [] : void 0
119
+ } : void 0,
120
+ isPending: H ? G[H.id]?.isPending ?? !1 : !1,
121
+ onCancel: () => {
122
+ z || V(void 0);
123
+ },
124
+ onConfirm: (e) => {
125
+ H && !z && (G[H.id]?.run(e), V(void 0));
126
+ }
127
+ }
95
128
  };
96
129
  }
97
- function u(t) {
98
- return t.status === "paid" && t.paid_at ? e(t.paid_at.slice(0, 10)) : void 0;
130
+ var m = {
131
+ alignment: "center",
132
+ icon: f,
133
+ tone: "destructive",
134
+ actionWidth: "equal"
135
+ }, h = {
136
+ alignment: "center",
137
+ icon: d,
138
+ tone: "destructive",
139
+ actionWidth: "equal"
140
+ }, g = {
141
+ alignment: "center",
142
+ icon: d,
143
+ tone: "destructive",
144
+ actionWidth: "equal"
145
+ };
146
+ function _(e) {
147
+ if (b(e)) return m;
148
+ if (e === "reject") return h;
149
+ if (e === "cancel") return g;
150
+ }
151
+ var v = [
152
+ "reject",
153
+ "cancel",
154
+ "cancelScheduledPayment",
155
+ "forceApprove",
156
+ "forceReject"
157
+ ];
158
+ function y(e) {
159
+ return v.includes(e);
160
+ }
161
+ function b(e) {
162
+ return e === "forceApprove" || e === "forceReject";
99
163
  }
100
164
  //#endregion
101
- export { u as getPaidAtLabel, l as mapPayableToBillDetails, s as resolveInvoiceTotalMinorUnits };
165
+ export { p as usePayableDetailActions };
@@ -1,86 +1,20 @@
1
- import { formatCalendarDate as e } from "../../../../shared/util/dist/lib/formatCalendarDate.js";
2
- import { derivePayableStatus as t } from "../../../util/dist/lib/derivePayableStatus.js";
3
- import { formatBillMoney as n } from "../../../util/dist/lib/formatBillMoney.js";
4
- import { resolveAmountDueMinorUnits as r } from "../../../util/dist/lib/resolveAmountDue.js";
5
- import { resolveLineItemAmountMinorUnits as i } from "../../../util/dist/lib/resolveLineItemAmount.js";
6
- import { resolveLineItemQuantity as a } from "../../../util/dist/lib/resolveLineItemQuantity.js";
7
- import { resolveVendor as o } from "../../../util/dist/lib/resolveVendor.js";
8
- import { getPaidAtLabel as s, resolveInvoiceTotalMinorUnits as c } from "./index20.js";
1
+ "use client";
2
+ "use client";
3
+ "use client";
4
+ "use client";
5
+ import { useLocalCalendarDay as e } from "../../../../shared/feature/dist/lib/calendar/useLocalCalendarDay.js";
6
+ import "../../../../shared/feature/dist/index.js";
7
+ import { formatScheduledDateLabel as t } from "../../../util/dist/lib/formatScheduledDateLabel.js";
8
+ import { useMemo as n } from "react";
9
9
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index21.js
10
- function l({ payable: l, lineItems: u, glCodeOptions: d, glCodeRosterAvailable: f = !0, history: p, paymentHistory: m, approvalPolicy: h, labels: g, hasScheduledPayment: _, rejection: v, payableAchInstructions: y, payableAchInstructionsReadable: b = !1 }) {
11
- let x = l.currency, S = t({
12
- apiStatus: l.status,
13
- dueDate: l.due_date,
14
- scheduledPaymentDate: l.scheduled_payment_date,
15
- hasScheduledPayment: _
16
- }), C = o(l), w = b ? y : void 0, T = w?.account_number, E = !!(w?.account_holder_name && w.routing_number && w.account_number), D = e(l.issued_at) || g.notProvided, O = e(l.due_date) || g.notProvided, k = new Map(d.map((e) => [e.value, e.label])), A = [
17
- {
18
- label: g.subtotalRow,
19
- minorUnits: l.subtotal
20
- },
21
- {
22
- label: g.discountRow,
23
- minorUnits: l.discount
24
- },
25
- {
26
- label: g.taxRow,
27
- minorUnits: l.tax_amount
28
- }
29
- ].map((e) => ({
30
- label: e.label,
31
- value: n(e.minorUnits, x)
32
- })).filter((e) => !!e.value), j = n(c(l), x);
33
- j && A.push({
34
- label: g.totalRow,
35
- value: j,
36
- emphasis: !0
37
- });
38
- let M = s(l);
39
- return {
40
- amountDue: n(r(l), x) ?? "",
41
- amountPaid: M ? n(l.amount_paid, x) : void 0,
42
- paidOnLabel: M ? g.paidOnLabel(M) : void 0,
43
- invoiceDateLabel: D,
44
- dueDateLabel: O,
45
- dueDateTone: S.isOverdue ? "danger" : "default",
46
- status: S.status,
47
- statusTone: S.tone,
48
- payTo: {
49
- name: C?.name || g.notProvided,
50
- email: C?.email ?? "",
51
- methodLabel: E ? g.paymentInstructionsValue(T?.slice(-4) ?? "") : g.paymentInstructionsNotSet,
52
- hasPaymentInstructions: E
53
- },
54
- invoiceFields: [
55
- {
56
- label: g.invoiceDateRow,
57
- value: D
58
- },
59
- {
60
- label: g.dueDateRow,
61
- value: O
62
- },
63
- {
64
- label: g.invoiceNumberRow,
65
- value: l.document_id || g.notProvided
66
- }
67
- ],
68
- lineItems: u.map((e) => {
69
- let t = n(e.unit_price, x), r = String(a(e));
70
- return {
71
- id: e.id,
72
- description: e.name ?? e.description ?? "",
73
- glCodeLabel: e.ledger_account_id ? k.get(e.ledger_account_id) ?? (f ? g.glCodeMissing : g.glCodeUnavailable) : g.glCodeMissing,
74
- qtyPriceLabel: t ? g.qtyPriceValue(r, t) : g.qtyOnlyValue(r),
75
- amount: n(i(e), x) ?? ""
76
- };
77
- }),
78
- amountRows: A,
79
- approvalPolicy: h,
80
- paymentHistory: m,
81
- history: p,
82
- rejection: v
83
- };
10
+ function r({ hasScheduledPayment: r, scheduledDate: i, labels: a }) {
11
+ let o = e();
12
+ return n(() => r && i ? t(i, a, o) : void 0, [
13
+ r,
14
+ i,
15
+ a,
16
+ o
17
+ ]);
84
18
  }
85
19
  //#endregion
86
- export { l as buildBillDetailView };
20
+ export { r as useScheduledDateLabel };
@@ -1,6 +1,26 @@
1
+ "use client";
2
+ "use client";
3
+ "use client";
4
+ "use client";
5
+ import { hasAnyScope as e } from "../../../../shared/data-access/dist/lib/hasAnyScope.js";
6
+ import { Scope as t } from "../../../../shared/data-access/dist/lib/scopes.js";
7
+ import "../../../../shared/data-access/dist/index.js";
8
+ import { useWidgetConfig as n } from "../../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
9
+ import "../../../../shared/feature/dist/index.js";
10
+ import { isLiveScheduledPaymentRecord as r } from "../../../util/dist/lib/isLiveScheduledPaymentRecord.js";
11
+ import { usePayablePaymentRecordsQuery as i } from "../../data-access/dist/index18.js";
12
+ import "../../data-access/dist/index.js";
1
13
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index22.js
2
- function e({ isUnsavedPromptOpen: e, isLocked: t, isDirty: n }) {
3
- return e ? "dismiss-prompt" : !t && n ? "prompt" : "close";
14
+ function a({ payableId: a, scheduledPaymentDate: o, enabled: s = !0 }) {
15
+ let { initResponse: c } = n(), l = e(c?.scopes, [t.PaymentRecordReadOrg]), u = i(s ? a : void 0, { enabled: s && l }), d = u.paymentRecords.find(r), f = !!d || !!o, p = d?.planned_payment_date ?? (f ? o : void 0);
16
+ return {
17
+ hasScheduledPayment: f,
18
+ paymentRecords: u.paymentRecords,
19
+ isError: u.isError,
20
+ isResolving: u.isResolving,
21
+ scheduledDate: p ?? void 0,
22
+ scheduledPaymentIntentId: d?.payment_intent_id ?? void 0
23
+ };
4
24
  }
5
25
  //#endregion
6
- export { e as resolveEditorDismissal };
26
+ export { a as useScheduledPayment };
@@ -1,57 +1,44 @@
1
- import { formatCalendarDate as e } from "../../../../shared/util/dist/lib/formatCalendarDate.js";
2
- import { formatBillMoney as t } from "../../../util/dist/lib/formatBillMoney.js";
1
+ "use client";
2
+ "use client";
3
+ "use client";
4
+ "use client";
5
+ import { toast as e } from "../../../../../../packages/shared-ui-shadcn/dist/index.js";
6
+ import { hasAnyScope as t } from "../../../../shared/data-access/dist/lib/hasAnyScope.js";
7
+ import { Scope as n } from "../../../../shared/data-access/dist/lib/scopes.js";
8
+ import "../../../../shared/data-access/dist/index.js";
9
+ import "../../../../shared/ui/dist/index.js";
10
+ import { useWidgetConfig as r } from "../../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
11
+ import "../../../../shared/feature/dist/index.js";
12
+ import { useDeletePayableMutation as i } from "../../data-access/dist/index10.js";
13
+ import "../../data-access/dist/index.js";
14
+ import { useState as a } from "react";
3
15
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index23.js
4
- var n = {
5
- dateLabel: (e) => new Date(e).toLocaleDateString("en-US", {
6
- month: "short",
7
- day: "numeric",
8
- year: "numeric"
9
- }),
10
- timeLabel: (e) => new Date(e).toLocaleTimeString(void 0, {
11
- hour: "numeric",
12
- minute: "2-digit",
13
- timeZoneName: "short"
14
- }),
15
- byActor: (e, t) => `${e} by ${t}`,
16
- formatAmount: (e) => t(e) ?? "",
17
- billCreated: "Bill created",
18
- createdManually: "Data entered manually",
19
- createdFromUpload: "File uploaded and scanned automatically",
20
- billCreatedByEmail: "Bill created by email",
21
- sentFrom: (e) => `Sent from ${e}`,
22
- billDetailsUpdated: "Bill details updated",
23
- filledInFromFile: "Filled in from the attached file",
24
- submittedForReview: "Finalized and submitted for review",
25
- approvalRequested: "Approval requested",
26
- approved: "Approved",
27
- approvedAutomatically: "Auto-approved",
28
- rejected: "Rejected",
29
- policyOverrideApproved: "Policy override: Approved",
30
- policyOverrideRejected: "Policy override: Rejected",
31
- quotedReason: (e) => `"${e}"`,
32
- cancelled: "Cancelled",
33
- reopened: "Re-opened",
34
- paymentReleased: "Payment released",
35
- paid: (e) => `Paid ${e}`,
36
- paymentReverted: "Payment reverted",
37
- calendarDateLabel: (t) => e(t),
38
- paymentScheduled: "Payment scheduled",
39
- scheduledFor: (e) => `Scheduled for ${e}`,
40
- scheduledPaymentCancelled: "Scheduled payment cancelled",
41
- cancelledAsBillChanged: "The bill was changed",
42
- cancelledAsBillDeleted: "The bill was deleted",
43
- paymentFailed: "Payment failed",
44
- billMarkedAsFullyPaid: "Bill marked as fully paid",
45
- billMarkedAsPartiallyPaid: "Bill marked as partially paid",
46
- draftDeleted: "Draft deleted",
47
- fileAttached: "File attached",
48
- fileRemoved: "File removed",
49
- creditNoteLinked: "Credit note linked",
50
- creditNoteUnlinked: "Credit note unlinked",
51
- lineItemsUpdated: "Line items updated",
52
- lineItemAdded: "Line item added",
53
- lineItemUpdated: "Line item updated",
54
- lineItemRemoved: "Line item removed"
55
- };
16
+ function o({ payableId: o, status: s, enabled: c = !0, labels: l, onDeleted: u }) {
17
+ let { initResponse: d } = r(), f = i(), [p, m] = a(!1), h = t(d?.scopes, [n.PayableWriteOrg]), g = !!(c && o && s === "draft" && h), _ = g ? [{
18
+ id: "deleteDraft",
19
+ label: l.menuItem,
20
+ destructive: !0,
21
+ onSelect: () => m(!0)
22
+ }] : [], v = p && g;
23
+ return {
24
+ menuItems: _,
25
+ dialog: {
26
+ open: v,
27
+ copy: v ? l.dialog : void 0,
28
+ isPending: f.isPending,
29
+ onCancel: () => {
30
+ f.isPending || m(!1);
31
+ },
32
+ onConfirm: () => {
33
+ g && o && !f.isPending && f.mutate({ path: { payable_id: o } }, {
34
+ onError: () => e.error(l.error),
35
+ onSuccess: () => {
36
+ m(!1), u();
37
+ }
38
+ });
39
+ }
40
+ }
41
+ };
42
+ }
56
43
  //#endregion
57
- export { n as PAYABLE_AUDIT_HISTORY_LABELS_EN };
44
+ export { o as useDraftDelete };