@tesouro/embedded-components-react 0.3.22 → 0.3.24
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.
- package/dist/index.js +1 -1
- package/dist/lib/BillPayWidget.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index10.js +10 -10
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index.js +15 -15
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index10.js +31 -32
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index11.js +42 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index12.js +158 -43
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index13.js +33 -4
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index14.js +1 -16
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index15.js +45 -12
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index16.js +4 -64
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index17.js +13 -26
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index18.js +14 -62
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index19.js +56 -123
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index2.js +18 -3
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index20.js +15 -10
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index21.js +61 -40
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index22.js +130 -50
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index23.js +20 -4
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index24.js +38 -69
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index25.js +48 -46
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index26.js +5 -93
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index27.js +71 -34
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index28.js +48 -139
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index29.js +91 -66
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index3.js +22 -5
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index30.js +34 -22
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index31.js +146 -210
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index32.js +72 -209
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index33.js +21 -103
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index34.js +209 -12
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index35.js +211 -44
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index36.js +104 -30
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index37.js +12 -165
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index38.js +47 -35
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index39.js +29 -99
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index4.js +64 -5
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index40.js +181 -12
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index41.js +34 -243
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index42.js +104 -4
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index43.js +12 -27
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index44.js +267 -81
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index45.js +4 -145
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index46.js +33 -3
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index47.js +82 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index48.js +155 -37
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index49.js +2 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index5.js +2 -6
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index50.js +2 -6
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index51.js +43 -9
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index52.js +1 -94
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index53.js +8 -3
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index54.js +7 -5
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index55.js +85 -13
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index56.js +3 -59
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index57.js +9 -3
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index58.js +19 -120
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index59.js +56 -8
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index6.js +3 -32
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index60.js +3 -46
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index61.js +116 -15
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index62.js +8 -28
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index63.js +43 -83
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index64.js +19 -47
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index65.js +27 -249
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index66.js +82 -109
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index67.js +47 -206
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index68.js +253 -4
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index69.js +111 -6
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index7.js +6 -39
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index70.js +197 -102
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index71.js +3 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index72.js +6 -23
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index73.js +114 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index74.js +1 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index75.js +25 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index8.js +5 -24
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index9.js +3 -162
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index.js +9 -6
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index82.js +10 -11
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index83.js +123 -8
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index84.js +2 -170
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index85.js +18 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index86.js +7 -11
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index87.js +163 -82
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index88.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index89.js +14 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index90.js +108 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index91.js +2 -0
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/sdk.gen.js +27 -27
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index7.js +1 -1
- package/package.json +1 -1
|
@@ -1,54 +1,134 @@
|
|
|
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/index5.js";
|
|
10
|
+
import { useCancelPayableMutation as i, useCancelPaymentRecordMutation as a, useForceApprovePayableMutation as o, useForceRejectPayableMutation as s, useReopenPayableMutation as c } from "../../data-access/dist/index10.js";
|
|
11
|
+
import "../../data-access/dist/index.js";
|
|
12
|
+
import { getBillDetailActions as l } from "./index21.js";
|
|
13
|
+
import { useState as u } from "react";
|
|
14
|
+
import { HandIcon as d } from "lucide-react";
|
|
1
15
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index22.js
|
|
2
|
-
|
|
3
|
-
"
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
function f({ payableId: d, status: f, currentApprovalRequestId: m, isPolicyApprover: _, hasWaitingRequest: v, arePendingApproversUnknown: y, hasScheduledPayment: b, scheduledPaymentRecordId: x, isScheduledPaymentUnknown: S, labels: C, isMarkAsPaidPending: w, pendingApprovers: T, onPayBillSelect: E, onMarkAsPaidSelect: D }) {
|
|
17
|
+
let { initResponse: O } = t(), k = r(), A = n(), j = i(), M = a(), N = c(), P = o(), F = s(), I = w || k.isPending || A.isPending || j.isPending || M.isPending || N.isPending || P.isPending || F.isPending, [L, R] = u(), z = L && (L.id !== "cancelScheduledPayment" || L.scheduledPaymentRecordId === x) ? L : void 0, B = d && f ? l({
|
|
18
|
+
status: f,
|
|
19
|
+
scopes: O?.scopes,
|
|
20
|
+
canDecideApprovalRequest: !!m,
|
|
21
|
+
isPolicyApprover: _,
|
|
22
|
+
hasWaitingRequest: v,
|
|
23
|
+
arePendingApproversUnknown: y,
|
|
24
|
+
hasScheduledPayment: b || S,
|
|
25
|
+
scheduledPaymentRecordId: x,
|
|
26
|
+
labels: C
|
|
27
|
+
}) : [], V = (t) => ({
|
|
28
|
+
onError: () => e.error(C.actionError),
|
|
29
|
+
onSuccess: () => e.success(C.actionSuccess[t])
|
|
30
|
+
}), H = {
|
|
31
|
+
reject: {
|
|
32
|
+
isPending: k.isPending,
|
|
33
|
+
run: (e) => m && k.mutate({
|
|
34
|
+
path: { approval_request_id: m },
|
|
35
|
+
body: e ? { reject_reason: e } : void 0
|
|
36
|
+
}, V("reject"))
|
|
37
|
+
},
|
|
38
|
+
approve: {
|
|
39
|
+
isPending: A.isPending,
|
|
40
|
+
run: () => m && A.mutate({ path: { approval_request_id: m } }, V("approve"))
|
|
41
|
+
},
|
|
42
|
+
cancel: {
|
|
43
|
+
isPending: j.isPending,
|
|
44
|
+
run: () => d && j.mutate({ path: { payable_id: d } }, V("cancel"))
|
|
45
|
+
},
|
|
46
|
+
cancelScheduledPayment: {
|
|
47
|
+
isPending: M.isPending,
|
|
48
|
+
run: () => {
|
|
49
|
+
let e = z?.scheduledPaymentRecordId;
|
|
50
|
+
!d || !e || M.mutate({
|
|
51
|
+
path: { payment_record_id: e },
|
|
52
|
+
payableId: d
|
|
53
|
+
}, V("cancelScheduledPayment"));
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
reopen: {
|
|
57
|
+
isPending: N.isPending,
|
|
58
|
+
run: () => d && N.mutate({ path: { payable_id: d } }, V("reopen"))
|
|
59
|
+
},
|
|
60
|
+
forceApprove: {
|
|
61
|
+
isPending: P.isPending,
|
|
62
|
+
run: () => d && P.mutate({ path: { payable_id: d } }, V("forceApprove"))
|
|
63
|
+
},
|
|
64
|
+
forceReject: {
|
|
65
|
+
isPending: F.isPending,
|
|
66
|
+
run: () => d && F.mutate({ path: { payable_id: d } }, V("forceReject"))
|
|
67
|
+
}
|
|
68
|
+
}, U = B.map((e) => ({
|
|
69
|
+
...e,
|
|
70
|
+
disabled: I,
|
|
71
|
+
loading: e.id === "markAsPaid" ? w : H[e.id]?.isPending ?? !1,
|
|
72
|
+
onSelect: () => {
|
|
73
|
+
if (!(I || !d)) {
|
|
74
|
+
if (e.id === "payBill") {
|
|
75
|
+
E();
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
if (e.id === "markAsPaid") {
|
|
79
|
+
D();
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
if (h(e.id)) {
|
|
83
|
+
R({
|
|
84
|
+
id: e.id,
|
|
85
|
+
scheduledPaymentRecordId: x
|
|
86
|
+
});
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
H[e.id]?.run();
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}));
|
|
93
|
+
return {
|
|
94
|
+
actions: {
|
|
95
|
+
row: U.filter((e) => e.surface === "row"),
|
|
96
|
+
menu: U.filter((e) => e.surface === "menu")
|
|
97
|
+
},
|
|
98
|
+
decisionDialog: {
|
|
99
|
+
open: !!z,
|
|
100
|
+
copy: z ? {
|
|
101
|
+
...C.decisionDialog[z.id],
|
|
102
|
+
presentation: g(z.id) ? p : void 0,
|
|
103
|
+
pendingApprovers: g(z.id) ? T ?? [] : void 0
|
|
104
|
+
} : void 0,
|
|
105
|
+
isPending: z ? H[z.id]?.isPending ?? !1 : !1,
|
|
106
|
+
onCancel: () => {
|
|
107
|
+
I || R(void 0);
|
|
108
|
+
},
|
|
109
|
+
onConfirm: (e) => {
|
|
110
|
+
!z || I || (H[z.id]?.run(e), R(void 0));
|
|
111
|
+
}
|
|
112
|
+
}
|
|
20
113
|
};
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
case "paid": return {
|
|
40
|
-
status: "paid",
|
|
41
|
-
tone: "success"
|
|
42
|
-
};
|
|
43
|
-
case "canceled": return {
|
|
44
|
-
status: "canceled",
|
|
45
|
-
tone: "muted"
|
|
46
|
-
};
|
|
47
|
-
case "rejected": return {
|
|
48
|
-
status: "rejected",
|
|
49
|
-
tone: "danger"
|
|
50
|
-
};
|
|
51
|
-
}
|
|
114
|
+
}
|
|
115
|
+
var p = {
|
|
116
|
+
alignment: "center",
|
|
117
|
+
icon: d,
|
|
118
|
+
tone: "destructive",
|
|
119
|
+
actionWidth: "equal"
|
|
120
|
+
}, m = [
|
|
121
|
+
"reject",
|
|
122
|
+
"cancel",
|
|
123
|
+
"cancelScheduledPayment",
|
|
124
|
+
"forceApprove",
|
|
125
|
+
"forceReject"
|
|
126
|
+
];
|
|
127
|
+
function h(e) {
|
|
128
|
+
return m.includes(e);
|
|
129
|
+
}
|
|
130
|
+
function g(e) {
|
|
131
|
+
return e === "forceApprove" || e === "forceReject";
|
|
52
132
|
}
|
|
53
133
|
//#endregion
|
|
54
|
-
export {
|
|
134
|
+
export { f as usePayableDetailActions };
|
|
@@ -1,8 +1,24 @@
|
|
|
1
|
-
|
|
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 { formatCalendarDate as n } from "../../../shared/util/dist/lib/formatCalendarDate.js";
|
|
9
|
+
import { useWidgetConfig as r } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
|
|
10
|
+
import "../../../shared/feature/dist/index.js";
|
|
11
|
+
import { usePayablePaymentRecordsQuery as i } from "../../data-access/dist/index8.js";
|
|
2
12
|
import "../../data-access/dist/index.js";
|
|
3
13
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index23.js
|
|
4
|
-
function
|
|
5
|
-
|
|
14
|
+
function a({ payableId: a, scheduledPaymentDate: o, enabled: s = !0 }) {
|
|
15
|
+
let { initResponse: c } = r(), l = e(c?.scopes, [t.PaymentRecordReadOrg]), u = i(s ? a : void 0, { enabled: s && l }), d = u.paymentRecords.find((e) => e.status === "created" || e.status === "processing"), f = !!d || !!o, p = d?.planned_payment_date ?? (f ? o : void 0);
|
|
16
|
+
return {
|
|
17
|
+
hasScheduledPayment: f,
|
|
18
|
+
isResolving: u.isResolving,
|
|
19
|
+
scheduledDateLabel: p ? n(p) : void 0,
|
|
20
|
+
scheduledPaymentRecordId: d?.id
|
|
21
|
+
};
|
|
6
22
|
}
|
|
7
23
|
//#endregion
|
|
8
|
-
export {
|
|
24
|
+
export { a as useScheduledPayment };
|
|
@@ -1,75 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import {
|
|
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";
|
|
6
15
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index24.js
|
|
7
|
-
function
|
|
8
|
-
let f = a.
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
{
|
|
23
|
-
label: u.taxRow,
|
|
24
|
-
minorUnits: a.tax_amount
|
|
25
|
-
}
|
|
26
|
-
].map((e) => ({
|
|
27
|
-
label: e.label,
|
|
28
|
-
value: i(e.minorUnits, f)
|
|
29
|
-
})).filter((e) => !!e.value), b = i(a.total_amount, f);
|
|
30
|
-
return b && y.push({
|
|
31
|
-
label: u.totalRow,
|
|
32
|
-
value: b,
|
|
33
|
-
emphasis: !0
|
|
34
|
-
}), {
|
|
35
|
-
amountDue: i(t(a), f) ?? "",
|
|
36
|
-
invoiceDateLabel: g,
|
|
37
|
-
dueDateLabel: _,
|
|
38
|
-
status: p.status,
|
|
39
|
-
statusTone: p.tone,
|
|
40
|
-
payTo: {
|
|
41
|
-
name: m?.name || u.notProvided,
|
|
42
|
-
email: m?.email ?? void 0,
|
|
43
|
-
paymentInstructionsLabel: h ? u.paymentInstructionsValue(h.slice(-4)) : void 0
|
|
44
|
-
},
|
|
45
|
-
invoiceFields: [
|
|
46
|
-
{
|
|
47
|
-
label: u.invoiceDateRow,
|
|
48
|
-
value: g
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
label: u.dueDateRow,
|
|
52
|
-
value: _
|
|
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);
|
|
53
31
|
},
|
|
54
|
-
{
|
|
55
|
-
|
|
56
|
-
|
|
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
|
+
});
|
|
57
39
|
}
|
|
58
|
-
|
|
59
|
-
lineItems: o.map((e) => {
|
|
60
|
-
let t = i(e.unit_price, f);
|
|
61
|
-
return {
|
|
62
|
-
id: e.id,
|
|
63
|
-
description: e.name ?? e.description ?? "",
|
|
64
|
-
glCodeLabel: (e.ledger_account_id ? v.get(e.ledger_account_id) : void 0) || u.glCodeMissing,
|
|
65
|
-
qtyPriceLabel: e.quantity != null && t ? u.qtyPriceValue(String(e.quantity), t) : "",
|
|
66
|
-
amount: i(e.subtotal, f) ?? ""
|
|
67
|
-
};
|
|
68
|
-
}),
|
|
69
|
-
amountRows: y,
|
|
70
|
-
approvalPolicy: l,
|
|
71
|
-
history: c
|
|
40
|
+
}
|
|
72
41
|
};
|
|
73
42
|
}
|
|
74
43
|
//#endregion
|
|
75
|
-
export {
|
|
44
|
+
export { o as useDraftDelete };
|
|
@@ -1,52 +1,54 @@
|
|
|
1
|
-
import { BILL_STATUS_BADGE_LABELS_EN as e } from "../../ui/dist/index18.js";
|
|
2
|
-
import "../../ui/dist/index.js";
|
|
3
|
-
import { derivePayableStatus as t } from "./index22.js";
|
|
4
1
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index25.js
|
|
5
|
-
var
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"line_item_removed",
|
|
11
|
-
"deleted"
|
|
2
|
+
var e = /* @__PURE__ */ new Set([
|
|
3
|
+
"new",
|
|
4
|
+
"approve_in_progress",
|
|
5
|
+
"waiting_to_be_paid",
|
|
6
|
+
"partially_paid"
|
|
12
7
|
]);
|
|
13
|
-
function
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
case "payable_updated": return i.billUpdated;
|
|
17
|
-
case "file_attached": return i.attachmentAdded;
|
|
18
|
-
case "submitted_for_approval": return i.submittedForApproval;
|
|
19
|
-
case "approval_requested": return i.approvalRequested;
|
|
20
|
-
case "approval_action": {
|
|
21
|
-
let e = r?.action, t = r?.reject_reason;
|
|
22
|
-
return e === "approve" ? i.approved : e === "reject" ? typeof t == "string" && t ? i.rejectedWithReason(t) : i.rejected : void 0;
|
|
23
|
-
}
|
|
24
|
-
case "auto_approved": return i.autoApproved;
|
|
25
|
-
case "reopened": return i.reopened;
|
|
26
|
-
case "marked_as_paid": return i.markedAsPaid;
|
|
27
|
-
case "marked_as_partially_paid": return i.markedAsPartiallyPaid;
|
|
28
|
-
case "payment_reverted": return i.paymentReverted;
|
|
29
|
-
case "status_changed": {
|
|
30
|
-
let n = r?.new_status;
|
|
31
|
-
if (typeof n != "string") return;
|
|
32
|
-
let a = t({ apiStatus: n }).status;
|
|
33
|
-
return i.statusChanged(e[a] ?? e.unknown);
|
|
34
|
-
}
|
|
35
|
-
default: return;
|
|
36
|
-
}
|
|
8
|
+
function t(e, t) {
|
|
9
|
+
let n = /* @__PURE__ */ new Date(`${e.slice(0, 10)}T00:00:00Z`), r = Date.UTC(t.getUTCFullYear(), t.getUTCMonth(), t.getUTCDate());
|
|
10
|
+
return n.getTime() < r;
|
|
37
11
|
}
|
|
38
|
-
function
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
12
|
+
function n({ apiStatus: n, dueDate: r, scheduledPaymentDate: i, hasScheduledPayment: a = !!i, now: o = /* @__PURE__ */ new Date() }) {
|
|
13
|
+
if (e.has(n) && a) return {
|
|
14
|
+
status: "scheduled",
|
|
15
|
+
tone: "accent"
|
|
16
|
+
};
|
|
17
|
+
if (e.has(n) && r && t(r, o)) return {
|
|
18
|
+
status: "overdue",
|
|
19
|
+
tone: "danger"
|
|
20
|
+
};
|
|
21
|
+
switch (n) {
|
|
22
|
+
case "draft": return {
|
|
23
|
+
status: "draft",
|
|
24
|
+
tone: "neutral"
|
|
25
|
+
};
|
|
26
|
+
case "new":
|
|
27
|
+
case "approve_in_progress": return {
|
|
28
|
+
status: "pending_approval",
|
|
29
|
+
tone: "warning"
|
|
30
|
+
};
|
|
31
|
+
case "waiting_to_be_paid": return {
|
|
32
|
+
status: "ready_to_pay",
|
|
33
|
+
tone: "info"
|
|
48
34
|
};
|
|
49
|
-
|
|
35
|
+
case "partially_paid": return {
|
|
36
|
+
status: "partially_paid",
|
|
37
|
+
tone: "success"
|
|
38
|
+
};
|
|
39
|
+
case "paid": return {
|
|
40
|
+
status: "paid",
|
|
41
|
+
tone: "success"
|
|
42
|
+
};
|
|
43
|
+
case "canceled": return {
|
|
44
|
+
status: "canceled",
|
|
45
|
+
tone: "muted"
|
|
46
|
+
};
|
|
47
|
+
case "rejected": return {
|
|
48
|
+
status: "rejected",
|
|
49
|
+
tone: "danger"
|
|
50
|
+
};
|
|
51
|
+
}
|
|
50
52
|
}
|
|
51
53
|
//#endregion
|
|
52
|
-
export {
|
|
54
|
+
export { n as derivePayableStatus };
|
|
@@ -1,96 +1,8 @@
|
|
|
1
|
+
import { formatMoneyExact as e } from "../../../shared/util/dist/lib/formatMoneyExact.js";
|
|
2
|
+
import "../../data-access/dist/index.js";
|
|
1
3
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index26.js
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
markAsPaid: "Mark as paid",
|
|
5
|
-
reject: "Reject",
|
|
6
|
-
approve: "Approve",
|
|
7
|
-
cancel: "Cancel bill",
|
|
8
|
-
cancelScheduledPayment: "Cancel scheduled payment",
|
|
9
|
-
reopen: "Reopen bill",
|
|
10
|
-
forceApprove: "Approve",
|
|
11
|
-
forceReject: "Reject",
|
|
12
|
-
policyOverridesHeading: "Policy overrides",
|
|
13
|
-
decisionDialog: {
|
|
14
|
-
reject: {
|
|
15
|
-
title: "Reject this bill?",
|
|
16
|
-
description: "The bill goes back as rejected and nobody else is asked to approve it.",
|
|
17
|
-
confirmButton: "Reject bill",
|
|
18
|
-
reason: {
|
|
19
|
-
label: "Reason",
|
|
20
|
-
placeholder: "Tell the submitter what needs to change",
|
|
21
|
-
optionalHint: "Optional"
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
cancel: {
|
|
25
|
-
title: "Cancel this bill?",
|
|
26
|
-
description: "Cancelling is permanent. The bill can't be reopened, edited, or paid afterwards.",
|
|
27
|
-
confirmButton: "Cancel bill"
|
|
28
|
-
},
|
|
29
|
-
cancelScheduledPayment: {
|
|
30
|
-
title: "Cancel this scheduled payment?",
|
|
31
|
-
description: "The payment will not be sent. The bill stays ready to pay, so you can schedule it again for another date.",
|
|
32
|
-
confirmButton: "Cancel payment"
|
|
33
|
-
},
|
|
34
|
-
forceApprove: {
|
|
35
|
-
title: "Override approval policy?",
|
|
36
|
-
description: "The below people haven't approved this bill yet. Approving now will bypass their required review. This will be recorded in the audit history and can't be undone.",
|
|
37
|
-
confirmButton: "Override and approve"
|
|
38
|
-
},
|
|
39
|
-
forceReject: {
|
|
40
|
-
title: "Override approval policy?",
|
|
41
|
-
description: "The below people haven't approved this bill yet. Rejecting now will bypass their required review. This will be recorded in the audit history and can't be undone.",
|
|
42
|
-
confirmButton: "Override and reject"
|
|
43
|
-
},
|
|
44
|
-
cancelButton: "Cancel"
|
|
45
|
-
},
|
|
46
|
-
actionError: "Couldn't update this bill. Try again.",
|
|
47
|
-
actionSuccess: {
|
|
48
|
-
approve: "Bill approved.",
|
|
49
|
-
reject: "Bill rejected.",
|
|
50
|
-
markAsPaid: "Bill marked as paid.",
|
|
51
|
-
cancel: "Bill canceled.",
|
|
52
|
-
cancelScheduledPayment: "Scheduled payment canceled.",
|
|
53
|
-
reopen: "Bill reopened.",
|
|
54
|
-
forceApprove: "Bill approved, overriding the approval policy.",
|
|
55
|
-
forceReject: "Bill rejected, overriding the approval policy."
|
|
56
|
-
}
|
|
57
|
-
}, t = (e) => `Payment scheduled for ${e}`, n = [
|
|
58
|
-
"reject",
|
|
59
|
-
"cancel",
|
|
60
|
-
"cancelScheduledPayment",
|
|
61
|
-
"forceApprove",
|
|
62
|
-
"forceReject"
|
|
63
|
-
];
|
|
64
|
-
function r(e, t) {
|
|
65
|
-
let n = e.reason ? {
|
|
66
|
-
...e.reason,
|
|
67
|
-
...t?.reason
|
|
68
|
-
} : void 0, r = {
|
|
69
|
-
...e,
|
|
70
|
-
...t,
|
|
71
|
-
reason: n
|
|
72
|
-
};
|
|
73
|
-
return n || delete r.reason, r;
|
|
74
|
-
}
|
|
75
|
-
function i(e, t) {
|
|
76
|
-
let i = {
|
|
77
|
-
...e,
|
|
78
|
-
...t
|
|
79
|
-
};
|
|
80
|
-
for (let a of n) i[a] = r(e[a], t?.[a]);
|
|
81
|
-
return i;
|
|
82
|
-
}
|
|
83
|
-
function a(t) {
|
|
84
|
-
let n = e;
|
|
85
|
-
return {
|
|
86
|
-
...n,
|
|
87
|
-
...t,
|
|
88
|
-
decisionDialog: i(n.decisionDialog, t?.decisionDialog),
|
|
89
|
-
actionSuccess: {
|
|
90
|
-
...n.actionSuccess,
|
|
91
|
-
...t?.actionSuccess
|
|
92
|
-
}
|
|
93
|
-
};
|
|
4
|
+
function t(t, n) {
|
|
5
|
+
if (typeof t == "number") return e(t / 100, { currencyCode: n ?? "USD" });
|
|
94
6
|
}
|
|
95
7
|
//#endregion
|
|
96
|
-
export {
|
|
8
|
+
export { t as formatBillMoney };
|
|
@@ -1,38 +1,75 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { formatCalendarDate as e } from "../../../shared/util/dist/lib/formatCalendarDate.js";
|
|
2
|
+
import { resolveAmountDueMinorUnits as t } from "./index6.js";
|
|
3
|
+
import { resolveVendor as n } from "./index7.js";
|
|
4
|
+
import { derivePayableStatus as r } from "./index25.js";
|
|
5
|
+
import { formatBillMoney as i } from "./index26.js";
|
|
2
6
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index27.js
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
7
|
+
function a({ payable: a, lineItems: o, glCodeOptions: s, history: c, approvalPolicy: l, labels: u, hasScheduledPayment: d }) {
|
|
8
|
+
let f = a.currency, p = r({
|
|
9
|
+
apiStatus: a.status,
|
|
10
|
+
dueDate: a.due_date,
|
|
11
|
+
scheduledPaymentDate: a.scheduled_payment_date,
|
|
12
|
+
hasScheduledPayment: d
|
|
13
|
+
}), m = n(a), h = m?.bank_account?.account_number, g = e(a.issued_at) || u.notProvided, _ = e(a.due_date) || u.notProvided, v = new Map(s.map((e) => [e.value, e.label])), y = [
|
|
14
|
+
{
|
|
15
|
+
label: u.subtotalRow,
|
|
16
|
+
minorUnits: a.subtotal
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
label: u.discountRow,
|
|
20
|
+
minorUnits: a.discount
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
label: u.taxRow,
|
|
24
|
+
minorUnits: a.tax_amount
|
|
25
|
+
}
|
|
26
|
+
].map((e) => ({
|
|
27
|
+
label: e.label,
|
|
28
|
+
value: i(e.minorUnits, f)
|
|
29
|
+
})).filter((e) => !!e.value), b = i(a.total_amount, f);
|
|
30
|
+
return b && y.push({
|
|
31
|
+
label: u.totalRow,
|
|
32
|
+
value: b,
|
|
33
|
+
emphasis: !0
|
|
34
|
+
}), {
|
|
35
|
+
amountDue: i(t(a), f) ?? "",
|
|
36
|
+
invoiceDateLabel: g,
|
|
37
|
+
dueDateLabel: _,
|
|
38
|
+
status: p.status,
|
|
39
|
+
statusTone: p.tone,
|
|
40
|
+
payTo: {
|
|
41
|
+
name: m?.name || u.notProvided,
|
|
42
|
+
email: m?.email ?? void 0,
|
|
43
|
+
paymentInstructionsLabel: h ? u.paymentInstructionsValue(h.slice(-4)) : void 0
|
|
44
|
+
},
|
|
45
|
+
invoiceFields: [
|
|
46
|
+
{
|
|
47
|
+
label: u.invoiceDateRow,
|
|
48
|
+
value: g
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
label: u.dueDateRow,
|
|
52
|
+
value: _
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
label: u.invoiceNumberRow,
|
|
56
|
+
value: a.document_id || u.notProvided
|
|
57
|
+
}
|
|
58
|
+
],
|
|
59
|
+
lineItems: o.map((e) => {
|
|
60
|
+
let t = i(e.unit_price, f);
|
|
61
|
+
return {
|
|
62
|
+
id: e.id,
|
|
63
|
+
description: e.name ?? e.description ?? "",
|
|
64
|
+
glCodeLabel: (e.ledger_account_id ? v.get(e.ledger_account_id) : void 0) || u.glCodeMissing,
|
|
65
|
+
qtyPriceLabel: e.quantity != null && t ? u.qtyPriceValue(String(e.quantity), t) : "",
|
|
66
|
+
amount: i(e.subtotal, f) ?? ""
|
|
67
|
+
};
|
|
68
|
+
}),
|
|
69
|
+
amountRows: y,
|
|
70
|
+
approvalPolicy: l,
|
|
71
|
+
history: c
|
|
22
72
|
};
|
|
23
|
-
return /* @__PURE__ */ t("div", {
|
|
24
|
-
className: "ttw:flex ttw:h-full ttw:w-full ttw:flex-col ttw:items-center ttw:justify-center ttw:gap-2 ttw:p-4 ttw:text-center",
|
|
25
|
-
children: [/* @__PURE__ */ e("p", {
|
|
26
|
-
className: "ttw:text-sm ttw:text-muted-foreground",
|
|
27
|
-
children: a.previewUnavailable
|
|
28
|
-
}), /* @__PURE__ */ e("a", {
|
|
29
|
-
href: r.url,
|
|
30
|
-
target: "_blank",
|
|
31
|
-
rel: "noreferrer",
|
|
32
|
-
className: "ttw:text-sm ttw:font-medium ttw:text-primary ttw:underline ttw:underline-offset-2",
|
|
33
|
-
children: a.openFile
|
|
34
|
-
})]
|
|
35
|
-
});
|
|
36
73
|
}
|
|
37
74
|
//#endregion
|
|
38
|
-
export {
|
|
75
|
+
export { a as buildBillDetailView };
|