@tesouro/embedded-components-react 0.4.28 → 0.4.29
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/index.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index16.js +15 -82
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index17.js +87 -25
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index18.js +36 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index.js +12 -12
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index10.js +5 -70
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index11.js +64 -37
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index12.js +38 -110
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index13.js +104 -73
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index14.js +87 -7
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index15.js +7 -21
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index16.js +17 -22
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index17.js +23 -63
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index18.js +66 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index19.js +2 -77
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index20.js +78 -3
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index21.js +4 -5
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index22.js +5 -4
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index23.js +3 -32
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index24.js +30 -39
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index25.js +37 -166
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index26.js +164 -39
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index27.js +48 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index28.js +1 -50
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index29.js +45 -11
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index30.js +13 -8
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index31.js +8 -14
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index32.js +7 -59
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index33.js +64 -8
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index34.js +8 -24
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index35.js +18 -136
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index36.js +139 -16
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index37.js +24 -4
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index38.js +4 -41
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index39.js +39 -88
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index40.js +79 -85
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index41.js +96 -3
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index42.js +3 -49
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index43.js +47 -119
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index44.js +135 -33
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index45.js +33 -186
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index46.js +186 -75
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index47.js +75 -21
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index48.js +22 -232
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index49.js +223 -210
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index5.js +14 -25
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index50.js +202 -103
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index51.js +121 -13
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index52.js +12 -47
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index53.js +47 -31
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index54.js +27 -198
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index55.js +198 -30
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index56.js +30 -234
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index57.js +240 -19
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index58.js +19 -425
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index59.js +433 -4
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index6.js +25 -24
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index60.js +4 -38
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index61.js +35 -218
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index62.js +224 -3
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index63.js +3 -4
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index64.js +2 -44
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index65.js +46 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index66.js +1 -8
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index67.js +6 -10
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index68.js +10 -110
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index69.js +112 -3
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index7.js +21 -57
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index70.js +3 -127
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index71.js +124 -8
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index72.js +8 -7
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index73.js +8 -46
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index74.js +43 -18
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index75.js +20 -28
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index76.js +27 -82
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index77.js +83 -47
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index78.js +47 -250
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index79.js +239 -101
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index8.js +58 -5
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index80.js +107 -202
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index81.js +209 -3
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index82.js +4 -8
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index83.js +6 -113
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index84.js +115 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index85.js +0 -24
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index86.js +25 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index9.js +5 -4
- 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/index8.js +1 -1
- package/package.json +1 -1
|
@@ -2,146 +2,28 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
"use client";
|
|
4
4
|
"use client";
|
|
5
|
-
import {
|
|
6
|
-
import "../../../shared/
|
|
7
|
-
import {
|
|
5
|
+
import { hasAnyScope as e } from "../../../shared/data-access/dist/lib/hasAnyScope.js";
|
|
6
|
+
import { useCurrentUserQuery as t } from "../../../shared/data-access/dist/lib/useCurrentUserQuery.js";
|
|
7
|
+
import { Scope as n } from "../../../shared/data-access/dist/lib/scopes.js";
|
|
8
|
+
import "../../../shared/data-access/dist/index.js";
|
|
9
|
+
import { useWidgetConfig as r } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
|
|
8
10
|
import "../../../shared/feature/dist/index.js";
|
|
9
|
-
import {
|
|
10
|
-
import { useCancelPayableMutation as i, useCancelScheduledPaymentMutation as a, useForceApprovePayableMutation as o, useForceRejectPayableMutation as s, useReopenPayableMutation as c } from "../../data-access/dist/index13.js";
|
|
11
|
+
import { usePayableApprovalRequestsQuery as i } from "../../data-access/dist/index8.js";
|
|
11
12
|
import "../../data-access/dist/index.js";
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import { BanIcon as d, HandIcon as f } from "lucide-react";
|
|
13
|
+
import { currentApprovalRound as a } from "./index4.js";
|
|
14
|
+
import { usePayableApprovalRoundStart as o } from "./index32.js";
|
|
15
15
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index35.js
|
|
16
|
-
function
|
|
17
|
-
let { initResponse:
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
hasWaitingRequest: m,
|
|
22
|
-
arePendingApproversUnknown: h,
|
|
23
|
-
hasScheduledPayment: _ || x,
|
|
24
|
-
scheduledPaymentIntentId: b,
|
|
25
|
-
isPayabilityUnknown: S,
|
|
26
|
-
labels: C
|
|
27
|
-
}) : [], H = (t) => ({
|
|
28
|
-
onError: () => e.error(C.actionError),
|
|
29
|
-
onSuccess: () => {
|
|
30
|
-
e.success(C.actionSuccess[t]), O?.();
|
|
31
|
-
}
|
|
32
|
-
}), U = {
|
|
33
|
-
reject: {
|
|
34
|
-
isPending: A.isPending,
|
|
35
|
-
run: (e) => p && A.mutate({
|
|
36
|
-
path: { approval_request_id: p },
|
|
37
|
-
body: e ? { reject_reason: e } : void 0
|
|
38
|
-
}, H("reject"))
|
|
39
|
-
},
|
|
40
|
-
approve: {
|
|
41
|
-
isPending: j.isPending,
|
|
42
|
-
run: () => p && j.mutate({ path: { approval_request_id: p } }, H("approve"))
|
|
43
|
-
},
|
|
44
|
-
cancel: {
|
|
45
|
-
isPending: M.isPending,
|
|
46
|
-
run: () => d && M.mutate({ path: { payable_id: d } }, H("cancel"))
|
|
47
|
-
},
|
|
48
|
-
cancelScheduledPayment: {
|
|
49
|
-
isPending: N.isPending,
|
|
50
|
-
run: () => {
|
|
51
|
-
let e = B?.scheduledPaymentIntentId;
|
|
52
|
-
!d || !e || N.mutate({
|
|
53
|
-
path: { payment_intent_id: e },
|
|
54
|
-
payableId: d
|
|
55
|
-
}, H("cancelScheduledPayment"));
|
|
56
|
-
}
|
|
57
|
-
},
|
|
58
|
-
reopen: {
|
|
59
|
-
isPending: P.isPending,
|
|
60
|
-
run: () => d && P.mutate({ path: { payable_id: d } }, H("reopen"))
|
|
61
|
-
},
|
|
62
|
-
forceApprove: {
|
|
63
|
-
isPending: F.isPending,
|
|
64
|
-
run: () => d && F.mutate({ path: { payable_id: d } }, H("forceApprove"))
|
|
65
|
-
},
|
|
66
|
-
forceReject: {
|
|
67
|
-
isPending: I.isPending,
|
|
68
|
-
run: () => d && I.mutate({ path: { payable_id: d } }, H("forceReject"))
|
|
69
|
-
}
|
|
70
|
-
}, W = V.map((e) => ({
|
|
71
|
-
...e,
|
|
72
|
-
disabled: L,
|
|
73
|
-
loading: e.id === "markAsPaid" ? w : U[e.id]?.isPending ?? !1,
|
|
74
|
-
onSelect: () => {
|
|
75
|
-
if (!(L || !d)) {
|
|
76
|
-
if (e.id === "payBill") {
|
|
77
|
-
E();
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
if (e.id === "markAsPaid") {
|
|
81
|
-
D();
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
|
-
if (v(e.id)) {
|
|
85
|
-
z({
|
|
86
|
-
id: e.id,
|
|
87
|
-
scheduledPaymentIntentId: b
|
|
88
|
-
});
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
91
|
-
U[e.id]?.run();
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}));
|
|
16
|
+
function s({ payableId: s, status: c }) {
|
|
17
|
+
let { initResponse: l } = r(), u = e(l?.scopes, [n.ApprovalRequestReadOrg]), d = c === "approve_in_progress" && u, f = i(s, { enabled: d }), p = t({ enabled: d }), { roundStartedAt: m } = o({
|
|
18
|
+
payableId: s,
|
|
19
|
+
enabled: d
|
|
20
|
+
}), h = p.data?.id, g = d ? a(f.data?.data, m) : [], _ = (e) => e.caller_is_policy_approver ?? !!(h && e.user_ids.includes(h)), v = g.some(_), y = g.filter((e) => e.status === "waiting");
|
|
95
21
|
return {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
},
|
|
101
|
-
decisionDialog: {
|
|
102
|
-
open: !!B,
|
|
103
|
-
copy: B ? {
|
|
104
|
-
...C.decisionDialog[B.id],
|
|
105
|
-
presentation: g(B.id),
|
|
106
|
-
pendingApprovers: y(B.id) ? T ?? [] : void 0
|
|
107
|
-
} : void 0,
|
|
108
|
-
isPending: B ? U[B.id]?.isPending ?? !1 : !1,
|
|
109
|
-
onCancel: () => {
|
|
110
|
-
L || z(void 0);
|
|
111
|
-
},
|
|
112
|
-
onConfirm: (e) => {
|
|
113
|
-
!B || L || (U[B.id]?.run(e), z(void 0));
|
|
114
|
-
}
|
|
115
|
-
}
|
|
22
|
+
id: y.filter(_).find((e) => !(h && (e.approved_by ?? []).includes(h)))?.id,
|
|
23
|
+
isPolicyApprover: v,
|
|
24
|
+
hasWaitingRequest: y.length > 0,
|
|
25
|
+
isLoading: f.isLoading || p.isLoading
|
|
116
26
|
};
|
|
117
27
|
}
|
|
118
|
-
var m = {
|
|
119
|
-
alignment: "center",
|
|
120
|
-
icon: f,
|
|
121
|
-
tone: "destructive",
|
|
122
|
-
actionWidth: "equal"
|
|
123
|
-
}, h = {
|
|
124
|
-
alignment: "center",
|
|
125
|
-
icon: d,
|
|
126
|
-
tone: "destructive",
|
|
127
|
-
actionWidth: "equal"
|
|
128
|
-
};
|
|
129
|
-
function g(e) {
|
|
130
|
-
if (y(e)) return m;
|
|
131
|
-
if (e === "reject") return h;
|
|
132
|
-
}
|
|
133
|
-
var _ = [
|
|
134
|
-
"reject",
|
|
135
|
-
"cancel",
|
|
136
|
-
"cancelScheduledPayment",
|
|
137
|
-
"forceApprove",
|
|
138
|
-
"forceReject"
|
|
139
|
-
];
|
|
140
|
-
function v(e) {
|
|
141
|
-
return _.includes(e);
|
|
142
|
-
}
|
|
143
|
-
function y(e) {
|
|
144
|
-
return e === "forceApprove" || e === "forceReject";
|
|
145
|
-
}
|
|
146
28
|
//#endregion
|
|
147
|
-
export {
|
|
29
|
+
export { s as useCurrentApprovalRequestId };
|
|
@@ -2,26 +2,149 @@
|
|
|
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 {
|
|
12
|
-
import {
|
|
9
|
+
import { useApprovePayableApprovalRequestMutation as n, useRejectPayableApprovalRequestMutation as r } from "../../data-access/dist/index8.js";
|
|
10
|
+
import { useCancelPayableMutation as i, useCancelScheduledPaymentMutation as a, useForceApprovePayableMutation as o, useForceRejectPayableMutation as s, useReopenPayableMutation as c } from "../../data-access/dist/index13.js";
|
|
13
11
|
import "../../data-access/dist/index.js";
|
|
12
|
+
import { getBillDetailActions as l } from "./index20.js";
|
|
13
|
+
import { useState as u } from "react";
|
|
14
|
+
import { BanIcon as d, HandIcon as f } from "lucide-react";
|
|
14
15
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index36.js
|
|
15
|
-
function
|
|
16
|
-
let { initResponse:
|
|
16
|
+
function p({ payableId: d, status: f, currentApprovalRequestId: p, arePendingApproversUnknown: m, hasScheduledPayment: h, scheduledPaymentIntentId: _, isScheduledPaymentUnknown: b, isPayabilityUnknown: x, labels: S, isMarkAsPaidPending: C, hasApprovalPolicy: w = !0, hasWaitingRequest: T, pendingApprovers: E, onPayBillSelect: D, onMarkAsPaidSelect: O, onActionSucceeded: k }) {
|
|
17
|
+
let { initResponse: A } = t(), j = r(), M = n(), N = i(), P = a(), F = c(), I = o(), L = s(), R = C || j.isPending || M.isPending || N.isPending || P.isPending || F.isPending || I.isPending || L.isPending, [z, B] = u(), V = z && (z.id !== "cancelScheduledPayment" || z.scheduledPaymentIntentId === _) ? z : void 0, H = d && f ? l({
|
|
18
|
+
status: f,
|
|
19
|
+
scopes: A?.scopes,
|
|
20
|
+
canDecideApprovalRequest: !!p,
|
|
21
|
+
arePendingApproversUnknown: m,
|
|
22
|
+
hasApprovalPolicy: w,
|
|
23
|
+
hasWaitingRequest: T,
|
|
24
|
+
hasScheduledPayment: h || b,
|
|
25
|
+
scheduledPaymentIntentId: _,
|
|
26
|
+
isPayabilityUnknown: x,
|
|
27
|
+
labels: S
|
|
28
|
+
}) : [], U = (t) => ({
|
|
29
|
+
onError: () => e.error(S.actionError),
|
|
30
|
+
onSuccess: () => {
|
|
31
|
+
let n = y(t) && !w ? `${t}NoApprovalPolicy` : t;
|
|
32
|
+
e.success(S.actionSuccess[n]), k?.();
|
|
33
|
+
}
|
|
34
|
+
}), W = {
|
|
35
|
+
reject: {
|
|
36
|
+
isPending: j.isPending,
|
|
37
|
+
run: (e) => p && j.mutate({
|
|
38
|
+
path: { approval_request_id: p },
|
|
39
|
+
body: e ? { reject_reason: e } : void 0
|
|
40
|
+
}, U("reject"))
|
|
41
|
+
},
|
|
42
|
+
approve: {
|
|
43
|
+
isPending: M.isPending,
|
|
44
|
+
run: () => p && M.mutate({ path: { approval_request_id: p } }, U("approve"))
|
|
45
|
+
},
|
|
46
|
+
cancel: {
|
|
47
|
+
isPending: N.isPending,
|
|
48
|
+
run: () => d && N.mutate({ path: { payable_id: d } }, U("cancel"))
|
|
49
|
+
},
|
|
50
|
+
cancelScheduledPayment: {
|
|
51
|
+
isPending: P.isPending,
|
|
52
|
+
run: () => {
|
|
53
|
+
let e = V?.scheduledPaymentIntentId;
|
|
54
|
+
!d || !e || P.mutate({
|
|
55
|
+
path: { payment_intent_id: e },
|
|
56
|
+
payableId: d
|
|
57
|
+
}, U("cancelScheduledPayment"));
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
reopen: {
|
|
61
|
+
isPending: F.isPending,
|
|
62
|
+
run: () => d && F.mutate({ path: { payable_id: d } }, U("reopen"))
|
|
63
|
+
},
|
|
64
|
+
forceApprove: {
|
|
65
|
+
isPending: I.isPending,
|
|
66
|
+
run: () => d && I.mutate({ path: { payable_id: d } }, U("forceApprove"))
|
|
67
|
+
},
|
|
68
|
+
forceReject: {
|
|
69
|
+
isPending: L.isPending,
|
|
70
|
+
run: () => d && L.mutate({ path: { payable_id: d } }, U("forceReject"))
|
|
71
|
+
}
|
|
72
|
+
}, G = H.map((e) => ({
|
|
73
|
+
...e,
|
|
74
|
+
disabled: R,
|
|
75
|
+
loading: e.id === "markAsPaid" ? C : W[e.id]?.isPending ?? !1,
|
|
76
|
+
onSelect: () => {
|
|
77
|
+
if (!(R || !d)) {
|
|
78
|
+
if (e.id === "payBill") {
|
|
79
|
+
D();
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
if (e.id === "markAsPaid") {
|
|
83
|
+
O();
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
if (v(e.id)) {
|
|
87
|
+
B({
|
|
88
|
+
id: e.id,
|
|
89
|
+
scheduledPaymentIntentId: _
|
|
90
|
+
});
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
W[e.id]?.run();
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}));
|
|
17
97
|
return {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
98
|
+
isActionPending: R,
|
|
99
|
+
actions: {
|
|
100
|
+
row: G.filter((e) => e.surface === "row"),
|
|
101
|
+
menu: G.filter((e) => e.surface === "menu")
|
|
102
|
+
},
|
|
103
|
+
decisionDialog: {
|
|
104
|
+
open: !!V,
|
|
105
|
+
copy: V ? {
|
|
106
|
+
...S.decisionDialog[V.id],
|
|
107
|
+
...y(V.id) && !w ? S.decisionDialog[V.id].noApprovalPolicy : void 0,
|
|
108
|
+
presentation: g(V.id),
|
|
109
|
+
pendingApprovers: y(V.id) ? E ?? [] : void 0
|
|
110
|
+
} : void 0,
|
|
111
|
+
isPending: V ? W[V.id]?.isPending ?? !1 : !1,
|
|
112
|
+
onCancel: () => {
|
|
113
|
+
R || B(void 0);
|
|
114
|
+
},
|
|
115
|
+
onConfirm: (e) => {
|
|
116
|
+
!V || R || (W[V.id]?.run(e), B(void 0));
|
|
117
|
+
}
|
|
118
|
+
}
|
|
24
119
|
};
|
|
25
120
|
}
|
|
121
|
+
var m = {
|
|
122
|
+
alignment: "center",
|
|
123
|
+
icon: f,
|
|
124
|
+
tone: "destructive",
|
|
125
|
+
actionWidth: "equal"
|
|
126
|
+
}, h = {
|
|
127
|
+
alignment: "center",
|
|
128
|
+
icon: d,
|
|
129
|
+
tone: "destructive",
|
|
130
|
+
actionWidth: "equal"
|
|
131
|
+
};
|
|
132
|
+
function g(e) {
|
|
133
|
+
if (y(e)) return m;
|
|
134
|
+
if (e === "reject") return h;
|
|
135
|
+
}
|
|
136
|
+
var _ = [
|
|
137
|
+
"reject",
|
|
138
|
+
"cancel",
|
|
139
|
+
"cancelScheduledPayment",
|
|
140
|
+
"forceApprove",
|
|
141
|
+
"forceReject"
|
|
142
|
+
];
|
|
143
|
+
function v(e) {
|
|
144
|
+
return _.includes(e);
|
|
145
|
+
}
|
|
146
|
+
function y(e) {
|
|
147
|
+
return e === "forceApprove" || e === "forceReject";
|
|
148
|
+
}
|
|
26
149
|
//#endregion
|
|
27
|
-
export {
|
|
150
|
+
export { p as usePayableDetailActions };
|
|
@@ -1,7 +1,27 @@
|
|
|
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 { isLiveScheduledPaymentRecord as i } from "../../data-access/dist/index3.js";
|
|
12
|
+
import { usePayablePaymentRecordsQuery as a } from "../../data-access/dist/index11.js";
|
|
13
|
+
import "../../data-access/dist/index.js";
|
|
1
14
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index37.js
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
return
|
|
15
|
+
function o({ payableId: o, scheduledPaymentDate: s, enabled: c = !0 }) {
|
|
16
|
+
let { initResponse: l } = r(), u = e(l?.scopes, [t.PaymentRecordReadOrg]), d = a(c ? o : void 0, { enabled: c && u }), f = d.paymentRecords.find(i), p = !!f || !!s, m = f?.planned_payment_date ?? (p ? s : void 0);
|
|
17
|
+
return {
|
|
18
|
+
hasScheduledPayment: p,
|
|
19
|
+
paymentRecords: d.paymentRecords,
|
|
20
|
+
isError: d.isError,
|
|
21
|
+
isResolving: d.isResolving,
|
|
22
|
+
scheduledDateLabel: m ? n(m) : void 0,
|
|
23
|
+
scheduledPaymentIntentId: f?.payment_intent_id ?? void 0
|
|
24
|
+
};
|
|
5
25
|
}
|
|
6
26
|
//#endregion
|
|
7
|
-
export {
|
|
27
|
+
export { o as useScheduledPayment };
|
|
@@ -1,44 +1,7 @@
|
|
|
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/index13.js";
|
|
13
|
-
import "../../data-access/dist/index.js";
|
|
14
|
-
import { useState as a } from "react";
|
|
15
1
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index38.js
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
|
-
};
|
|
2
|
+
var e = /* @__PURE__ */ new Set(["draft", "new"]);
|
|
3
|
+
function t(t) {
|
|
4
|
+
return !!(t && e.has(t));
|
|
42
5
|
}
|
|
43
6
|
//#endregion
|
|
44
|
-
export {
|
|
7
|
+
export { t as isEditablePayableStatus };
|
|
@@ -1,93 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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/index13.js";
|
|
13
|
+
import "../../data-access/dist/index.js";
|
|
14
|
+
import { useState as a } from "react";
|
|
5
15
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index39.js
|
|
6
|
-
function
|
|
7
|
-
let
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}), g = n(a), _ = r(a), v = e(a.issued_at) || l.notProvided, y = e(a.due_date) || l.notProvided, b = [{
|
|
14
|
-
label: l.vendorRow,
|
|
15
|
-
value: _ || l.notProvided,
|
|
16
|
-
secondaryValue: g?.email ?? void 0
|
|
17
|
-
}], x = g?.bank_account?.account_number;
|
|
18
|
-
x && b.push({
|
|
19
|
-
label: l.bankAccountRow,
|
|
20
|
-
value: l.bankAccountValue(x.slice(-4))
|
|
21
|
-
});
|
|
22
|
-
let S = [
|
|
23
|
-
{
|
|
24
|
-
label: l.invoiceNumberRow,
|
|
25
|
-
value: a.document_id || l.notProvided
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
label: l.issueDateRow,
|
|
29
|
-
value: v
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
label: l.dueDateRow,
|
|
33
|
-
value: y
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
label: l.poNumberRow,
|
|
37
|
-
value: l.notProvided
|
|
38
|
-
}
|
|
39
|
-
], C = new Map(c.map((e) => [e.id, [e.nominal_code, e.name].filter(Boolean).join(" — ")])), w = s.map((e) => {
|
|
40
|
-
let t = m(e.unit_price);
|
|
41
|
-
return {
|
|
42
|
-
id: e.id,
|
|
43
|
-
description: e.name ?? e.description ?? "",
|
|
44
|
-
glCodeLabel: (e.ledger_account_id ? C.get(e.ledger_account_id) : void 0) || l.glCodeMissing,
|
|
45
|
-
quantityLabel: e.quantity != null && t ? l.quantityValue(String(e.quantity), t) : "",
|
|
46
|
-
amountLabel: m(e.subtotal) ?? ""
|
|
47
|
-
};
|
|
48
|
-
}), T = [
|
|
49
|
-
{
|
|
50
|
-
label: l.subtotalRow,
|
|
51
|
-
value: a.subtotal
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
label: l.discountsRow,
|
|
55
|
-
value: a.discount
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
label: l.taxRow,
|
|
59
|
-
value: a.tax_amount
|
|
60
|
-
}
|
|
61
|
-
].map(({ label: e, value: t }) => ({
|
|
62
|
-
label: e,
|
|
63
|
-
value: m(t)
|
|
64
|
-
})).filter((e) => !!e.value), E = m(a.total_amount);
|
|
65
|
-
E && T.push({
|
|
66
|
-
label: l.totalRow,
|
|
67
|
-
value: E,
|
|
68
|
-
emphasis: !0
|
|
69
|
-
});
|
|
70
|
-
let D = o(a);
|
|
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;
|
|
71
23
|
return {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
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
|
+
}
|
|
87
41
|
};
|
|
88
42
|
}
|
|
89
|
-
function o(t) {
|
|
90
|
-
return t.status === "paid" && t.paid_at ? e(t.paid_at.slice(0, 10)) : void 0;
|
|
91
|
-
}
|
|
92
43
|
//#endregion
|
|
93
|
-
export { o as
|
|
44
|
+
export { o as useDraftDelete };
|