@tesouro/embedded-components-react 0.3.11 → 0.3.13
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.d.ts +12 -0
- package/dist/index.js +1 -1
- package/dist/lib/BillPayWidget.js +1 -1
- package/dist/lib/CardsWidget.d.ts +12 -0
- package/dist/lib/CreateCardWidget.d.ts +12 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index.js +8 -8
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index14.js +13 -14
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index15.js +7 -46
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index16.js +54 -16
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index17.js +24 -52
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index18.js +61 -113
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index19.js +123 -13
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index20.js +11 -31
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index21.js +40 -50
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index22.js +51 -5
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index23.js +5 -72
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index24.js +71 -48
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index25.js +48 -79
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index26.js +91 -33
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index27.js +33 -137
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index28.js +138 -67
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index29.js +63 -200
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index30.js +194 -184
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index31.js +180 -50
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index32.js +64 -12
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index33.js +12 -46
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index34.js +46 -30
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index35.js +26 -158
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index36.js +159 -31
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index37.js +32 -98
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index38.js +102 -13
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index39.js +13 -241
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index40.js +244 -4
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index41.js +4 -29
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index42.js +28 -81
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index43.js +77 -130
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index44.js +145 -3
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index45.js +3 -4
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index46.js +2 -43
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index47.js +45 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index48.js +1 -8
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index49.js +6 -9
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index50.js +9 -92
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index51.js +94 -3
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index52.js +3 -9
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index53.js +7 -20
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index54.js +14 -51
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index55.js +59 -3
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index56.js +3 -110
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index57.js +107 -8
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index58.js +8 -40
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index59.js +38 -15
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index60.js +18 -98
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index61.js +92 -173
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index62.js +180 -4
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index63.js +5 -8
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index64.js +6 -112
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index65.js +114 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index66.js +0 -24
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index67.js +25 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index16.js +56 -18
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index46.js +4 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index47.js +75 -46
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index52.js +3 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index53.js +120 -115
- package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/index5.js +1 -2
- package/dist/libs/tesouro-embedded-components-react/create-card-widget/data-access/dist/index.js +3 -2
- package/dist/libs/tesouro-embedded-components-react/create-card-widget/data-access/dist/index5.js +19 -12
- package/dist/libs/tesouro-embedded-components-react/create-card-widget/data-access/dist/index6.js +22 -0
- package/dist/libs/tesouro-embedded-components-react/create-card-widget/feature/dist/index4.js +4 -1
- package/dist/libs/tesouro-embedded-components-react/create-card-widget/feature/dist/index5.js +0 -1
- package/dist/libs/tesouro-embedded-components-react/create-card-widget/feature/dist/index6.js +22 -37
- package/dist/libs/tesouro-embedded-components-react/create-card-widget/feature/dist/index7.js +167 -110
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +18 -18
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js +111 -104
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/sdk.gen.js +144 -128
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/user/useAllOrganizationUsersQuery.js +20 -18
- 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/dist/packages/shared-ui-shadcn/dist/index.js +1998 -1935
- package/package.json +1 -1
|
@@ -2,23 +2,133 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
"use client";
|
|
4
4
|
"use client";
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import "../../../shared/
|
|
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";
|
|
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";
|
|
10
8
|
import "../../../shared/feature/dist/index.js";
|
|
11
|
-
import {
|
|
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, useMarkPayableAsPaidMutation as c, useReopenPayableMutation as l } from "../../data-access/dist/index10.js";
|
|
12
11
|
import "../../data-access/dist/index.js";
|
|
12
|
+
import { getBillDetailActions as u } from "./index18.js";
|
|
13
|
+
import { useState as d } from "react";
|
|
14
|
+
import { HandIcon as f } from "lucide-react";
|
|
13
15
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index19.js
|
|
14
|
-
function
|
|
15
|
-
let { initResponse:
|
|
16
|
+
function p({ payableId: f, status: p, currentApprovalRequestId: h, isPolicyApprover: v, hasWaitingRequest: y, arePendingApproversUnknown: b, hasScheduledPayment: x, scheduledPaymentRecordId: S, isScheduledPaymentUnknown: C, labels: w, pendingApprovers: T, onPayBillSelect: E }) {
|
|
17
|
+
let { initResponse: D } = t(), O = c(), k = r(), A = n(), j = i(), M = a(), N = l(), P = o(), F = s(), I = O.isPending || k.isPending || A.isPending || j.isPending || M.isPending || N.isPending || P.isPending || F.isPending, [L, R] = d(), z = L && (L.id !== "cancelScheduledPayment" || L.scheduledPaymentRecordId === S) ? L : void 0, B = f && p ? u({
|
|
18
|
+
status: p,
|
|
19
|
+
scopes: D?.scopes,
|
|
20
|
+
canDecideApprovalRequest: !!h,
|
|
21
|
+
isPolicyApprover: v,
|
|
22
|
+
hasWaitingRequest: y,
|
|
23
|
+
arePendingApproversUnknown: b,
|
|
24
|
+
hasScheduledPayment: x || C,
|
|
25
|
+
scheduledPaymentRecordId: S,
|
|
26
|
+
labels: w
|
|
27
|
+
}) : [], V = (t) => ({
|
|
28
|
+
onError: () => e.error(w.actionError),
|
|
29
|
+
onSuccess: () => e.success(w.actionSuccess[t])
|
|
30
|
+
}), H = {
|
|
31
|
+
markAsPaid: {
|
|
32
|
+
isPending: O.isPending,
|
|
33
|
+
run: () => f && O.mutate({ path: { payable_id: f } }, V("markAsPaid"))
|
|
34
|
+
},
|
|
35
|
+
reject: {
|
|
36
|
+
isPending: k.isPending,
|
|
37
|
+
run: (e) => h && k.mutate({
|
|
38
|
+
path: { approval_request_id: h },
|
|
39
|
+
body: e ? { reject_reason: e } : void 0
|
|
40
|
+
}, V("reject"))
|
|
41
|
+
},
|
|
42
|
+
approve: {
|
|
43
|
+
isPending: A.isPending,
|
|
44
|
+
run: () => h && A.mutate({ path: { approval_request_id: h } }, V("approve"))
|
|
45
|
+
},
|
|
46
|
+
cancel: {
|
|
47
|
+
isPending: j.isPending,
|
|
48
|
+
run: () => f && j.mutate({ path: { payable_id: f } }, V("cancel"))
|
|
49
|
+
},
|
|
50
|
+
cancelScheduledPayment: {
|
|
51
|
+
isPending: M.isPending,
|
|
52
|
+
run: () => {
|
|
53
|
+
let e = z?.scheduledPaymentRecordId;
|
|
54
|
+
!f || !e || M.mutate({
|
|
55
|
+
path: { payment_record_id: e },
|
|
56
|
+
payableId: f
|
|
57
|
+
}, V("cancelScheduledPayment"));
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
reopen: {
|
|
61
|
+
isPending: N.isPending,
|
|
62
|
+
run: () => f && N.mutate({ path: { payable_id: f } }, V("reopen"))
|
|
63
|
+
},
|
|
64
|
+
forceApprove: {
|
|
65
|
+
isPending: P.isPending,
|
|
66
|
+
run: () => f && P.mutate({ path: { payable_id: f } }, V("forceApprove"))
|
|
67
|
+
},
|
|
68
|
+
forceReject: {
|
|
69
|
+
isPending: F.isPending,
|
|
70
|
+
run: () => f && F.mutate({ path: { payable_id: f } }, V("forceReject"))
|
|
71
|
+
}
|
|
72
|
+
}, U = B.map((e) => ({
|
|
73
|
+
...e,
|
|
74
|
+
disabled: I,
|
|
75
|
+
loading: H[e.id]?.isPending ?? !1,
|
|
76
|
+
onSelect: () => {
|
|
77
|
+
if (!(I || !f)) {
|
|
78
|
+
if (e.id === "payBill") {
|
|
79
|
+
E();
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
if (g(e.id)) {
|
|
83
|
+
R({
|
|
84
|
+
id: e.id,
|
|
85
|
+
scheduledPaymentRecordId: S
|
|
86
|
+
});
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
H[e.id]?.run();
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}));
|
|
16
93
|
return {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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
|
+
...w.decisionDialog[z.id],
|
|
102
|
+
presentation: _(z.id) ? m : void 0,
|
|
103
|
+
pendingApprovers: _(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
|
+
}
|
|
21
113
|
};
|
|
22
114
|
}
|
|
115
|
+
var m = {
|
|
116
|
+
alignment: "center",
|
|
117
|
+
icon: f,
|
|
118
|
+
tone: "destructive",
|
|
119
|
+
actionWidth: "equal"
|
|
120
|
+
}, h = [
|
|
121
|
+
"reject",
|
|
122
|
+
"cancel",
|
|
123
|
+
"cancelScheduledPayment",
|
|
124
|
+
"forceApprove",
|
|
125
|
+
"forceReject"
|
|
126
|
+
];
|
|
127
|
+
function g(e) {
|
|
128
|
+
return h.includes(e);
|
|
129
|
+
}
|
|
130
|
+
function _(e) {
|
|
131
|
+
return e === "forceApprove" || e === "forceReject";
|
|
132
|
+
}
|
|
23
133
|
//#endregion
|
|
24
|
-
export {
|
|
134
|
+
export { p as usePayableDetailActions };
|
|
@@ -2,43 +2,23 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
"use client";
|
|
4
4
|
"use client";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { Scope as n } from "../../../shared/data-access/dist/lib/scopes.js";
|
|
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";
|
|
8
7
|
import "../../../shared/data-access/dist/index.js";
|
|
9
|
-
import "../../../shared/
|
|
8
|
+
import { formatCalendarDate as n } from "../../../shared/util/dist/lib/formatCalendarDate.js";
|
|
10
9
|
import { useWidgetConfig as r } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
|
|
11
10
|
import "../../../shared/feature/dist/index.js";
|
|
12
|
-
import {
|
|
11
|
+
import { usePayablePaymentRecordsQuery as i } from "../../data-access/dist/index8.js";
|
|
13
12
|
import "../../data-access/dist/index.js";
|
|
14
|
-
import { useState as a } from "react";
|
|
15
13
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index20.js
|
|
16
|
-
function
|
|
17
|
-
let { initResponse:
|
|
18
|
-
id: "deleteDraft",
|
|
19
|
-
label: l.menuItem,
|
|
20
|
-
destructive: !0,
|
|
21
|
-
onSelect: () => m(!0)
|
|
22
|
-
}] : [], v = p && g;
|
|
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);
|
|
23
16
|
return {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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
|
-
}
|
|
17
|
+
hasScheduledPayment: f,
|
|
18
|
+
isResolving: u.isResolving,
|
|
19
|
+
scheduledDateLabel: p ? n(p) : void 0,
|
|
20
|
+
scheduledPaymentRecordId: d?.id
|
|
41
21
|
};
|
|
42
22
|
}
|
|
43
23
|
//#endregion
|
|
44
|
-
export {
|
|
24
|
+
export { a as useScheduledPayment };
|
|
@@ -1,54 +1,44 @@
|
|
|
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";
|
|
1
15
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index21.js
|
|
2
|
-
|
|
3
|
-
"
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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
|
+
}
|
|
20
41
|
};
|
|
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"
|
|
34
|
-
};
|
|
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
|
-
}
|
|
52
42
|
}
|
|
53
43
|
//#endregion
|
|
54
|
-
export {
|
|
44
|
+
export { o as useDraftDelete };
|
|
@@ -1,8 +1,54 @@
|
|
|
1
|
-
import { formatMoneyExact as e } from "../../../shared/util/dist/lib/formatMoneyExact.js";
|
|
2
|
-
import "../../data-access/dist/index.js";
|
|
3
1
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index22.js
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
var e = /* @__PURE__ */ new Set([
|
|
3
|
+
"new",
|
|
4
|
+
"approve_in_progress",
|
|
5
|
+
"waiting_to_be_paid",
|
|
6
|
+
"partially_paid"
|
|
7
|
+
]);
|
|
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;
|
|
11
|
+
}
|
|
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"
|
|
34
|
+
};
|
|
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
|
+
}
|
|
6
52
|
}
|
|
7
53
|
//#endregion
|
|
8
|
-
export {
|
|
54
|
+
export { n as derivePayableStatus };
|
|
@@ -1,75 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import { resolveVendor as n } from "./index3.js";
|
|
4
|
-
import { derivePayableStatus as r } from "./index21.js";
|
|
5
|
-
import { formatBillMoney as i } from "./index22.js";
|
|
1
|
+
import { formatMoneyExact as e } from "../../../shared/util/dist/lib/formatMoneyExact.js";
|
|
2
|
+
import "../../data-access/dist/index.js";
|
|
6
3
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index23.js
|
|
7
|
-
function
|
|
8
|
-
|
|
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
|
|
72
|
-
};
|
|
4
|
+
function t(t, n) {
|
|
5
|
+
if (typeof t == "number") return e(t / 100, { currencyCode: n ?? "USD" });
|
|
73
6
|
}
|
|
74
7
|
//#endregion
|
|
75
|
-
export {
|
|
8
|
+
export { t as formatBillMoney };
|
|
@@ -1,52 +1,75 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "
|
|
3
|
-
import {
|
|
1
|
+
import { formatCalendarDate as e } from "../../../shared/util/dist/lib/formatCalendarDate.js";
|
|
2
|
+
import { resolveAmountDueMinorUnits as t } from "./index2.js";
|
|
3
|
+
import { resolveVendor as n } from "./index3.js";
|
|
4
|
+
import { derivePayableStatus as r } from "./index22.js";
|
|
5
|
+
import { formatBillMoney as i } from "./index23.js";
|
|
4
6
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index24.js
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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
|
|
23
25
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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
|
|
72
|
+
};
|
|
50
73
|
}
|
|
51
74
|
//#endregion
|
|
52
|
-
export {
|
|
75
|
+
export { a as buildBillDetailView };
|