@tesouro/embedded-components-react 0.5.76 → 0.5.78
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/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index48.js +67 -47
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index50.js +23 -14
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index51.js +58 -40
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index52.js +251 -222
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index60.js +206 -202
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index63.js +124 -124
- package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/util/dist/lib/policyScript.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
- package/package.json +1 -1
|
@@ -5,101 +5,101 @@
|
|
|
5
5
|
import { toast as e } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
|
|
6
6
|
import { hasAnyScope as t } from "../../../shared/data-access/dist/lib/hasAnyScope.js";
|
|
7
7
|
import { Scope as n } from "../../../shared/data-access/dist/lib/scopes.js";
|
|
8
|
-
import { useAllLedgerAccountsQuery as
|
|
8
|
+
import { useAllLedgerAccountsQuery as r } from "../../../shared/data-access/dist/lib/reference-data/useLedgerAccountsQuery.js";
|
|
9
9
|
import "../../../shared/data-access/dist/index.js";
|
|
10
10
|
import "../../../shared/ui/dist/index.js";
|
|
11
|
-
import { formatCalendarDate as
|
|
12
|
-
import { buildPayableAuditHistory as
|
|
13
|
-
import { useWidgetConfig as
|
|
14
|
-
import { useOrganizationUserNames as
|
|
11
|
+
import { formatCalendarDate as ee } from "../../../shared/util/dist/lib/formatCalendarDate.js";
|
|
12
|
+
import { buildPayableAuditHistory as te, hasUnattributedAuditRows as ne } from "../../../shared/util/dist/lib/auditHistory/buildPayableAuditHistory.js";
|
|
13
|
+
import { useWidgetConfig as re } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
|
|
14
|
+
import { useOrganizationUserNames as ie } from "../../../shared/feature/dist/lib/user/useOrganizationUserNames.js";
|
|
15
15
|
import "../../../shared/feature/dist/index.js";
|
|
16
|
-
import { usePayableApprovalRequestsQuery as
|
|
17
|
-
import { usePayableHistoryQuery as
|
|
18
|
-
import { useAllPayableLineItemsQuery as
|
|
19
|
-
import { useUpdatePayableMutation as
|
|
20
|
-
import { usePayableQuery as
|
|
16
|
+
import { usePayableApprovalRequestsQuery as ae } from "../../data-access/dist/index8.js";
|
|
17
|
+
import { usePayableHistoryQuery as oe } from "../../data-access/dist/index9.js";
|
|
18
|
+
import { useAllPayableLineItemsQuery as se } from "../../data-access/dist/index10.js";
|
|
19
|
+
import { useUpdatePayableMutation as ce } from "../../data-access/dist/index13.js";
|
|
20
|
+
import { usePayableQuery as le } from "../../data-access/dist/index17.js";
|
|
21
21
|
import "../../data-access/dist/index.js";
|
|
22
|
-
import { hasUnpaidBalance as
|
|
23
|
-
import { resolveVendor as
|
|
24
|
-
import { BillCreateScreen as
|
|
25
|
-
import { BillDecisionDialog as
|
|
26
|
-
import { DiscardChangesDialog as
|
|
27
|
-
import { BillDuplicateNotice as
|
|
28
|
-
import { BillRejectedBanner as
|
|
29
|
-
import { ExtractionNotice as
|
|
30
|
-
import { MarkAsPaidDialog as
|
|
31
|
-
import { UnsavedBillDialog as
|
|
22
|
+
import { hasUnpaidBalance as ue } from "./index7.js";
|
|
23
|
+
import { resolveVendor as de } from "./index8.js";
|
|
24
|
+
import { BillCreateScreen as fe } from "../../ui/dist/index57.js";
|
|
25
|
+
import { BillDecisionDialog as pe } from "../../ui/dist/index63.js";
|
|
26
|
+
import { DiscardChangesDialog as me } from "../../ui/dist/index67.js";
|
|
27
|
+
import { BillDuplicateNotice as he } from "../../ui/dist/index72.js";
|
|
28
|
+
import { BillRejectedBanner as ge } from "../../ui/dist/index75.js";
|
|
29
|
+
import { ExtractionNotice as _e } from "../../ui/dist/index93.js";
|
|
30
|
+
import { MarkAsPaidDialog as ve } from "../../ui/dist/index102.js";
|
|
31
|
+
import { UnsavedBillDialog as ye } from "../../ui/dist/index112.js";
|
|
32
32
|
import "../../ui/dist/index.js";
|
|
33
|
-
import { usePayableDuplicateReview as
|
|
33
|
+
import { usePayableDuplicateReview as be } from "./index13.js";
|
|
34
34
|
import "./index14.js";
|
|
35
|
-
import { isEditablePayableStatus as
|
|
36
|
-
import { canOverrideApprovalPolicy as
|
|
37
|
-
import { resolveAmountDueMinorUnits as
|
|
38
|
-
import { usePayableAchInstructions as
|
|
35
|
+
import { isEditablePayableStatus as xe } from "./index19.js";
|
|
36
|
+
import { canOverrideApprovalPolicy as Se, canReadCounterpartBankAccounts as Ce } from "./index20.js";
|
|
37
|
+
import { resolveAmountDueMinorUnits as we } from "./index21.js";
|
|
38
|
+
import { usePayableAchInstructions as Te } from "../../../shared/counterpart-management/feature/dist/lib/usePayableAchInstructions.js";
|
|
39
39
|
import "../../../shared/counterpart-management/feature/dist/index.js";
|
|
40
|
-
import { PayBillFlow as
|
|
40
|
+
import { PayBillFlow as Ee } from "./index27.js";
|
|
41
41
|
import "./index28.js";
|
|
42
|
-
import { useMarkAsPaidFlow as
|
|
42
|
+
import { useMarkAsPaidFlow as De } from "./index17.js";
|
|
43
43
|
import "./index18.js";
|
|
44
|
-
import { BILL_CREATE_MESSAGE_LABELS_EN as
|
|
45
|
-
import { useBillCreateController as
|
|
46
|
-
import { useBillForm as
|
|
47
|
-
import { buildPaymentHistory as
|
|
48
|
-
import { currentApprovalRound as
|
|
49
|
-
import { usePayableApprovalRoundStart as
|
|
50
|
-
import { useApprovalPolicyCardView as
|
|
51
|
-
import { resolveBillRejectionNotice as
|
|
52
|
-
import { useCurrentApprovalRequestId as
|
|
53
|
-
import { usePayableDetailActions as
|
|
54
|
-
import { useScheduledPayment as
|
|
55
|
-
import { useDraftDelete as
|
|
56
|
-
import { buildBillDetailView as
|
|
57
|
-
import { resolveEditorDismissal as
|
|
58
|
-
import { SourceDocumentContainer as
|
|
59
|
-
import { useVendorSectionProps as
|
|
60
|
-
import { billCreateTestIds as
|
|
61
|
-
import { cloneElement as
|
|
62
|
-
import { Fragment as
|
|
63
|
-
import { Trash2Icon as
|
|
44
|
+
import { BILL_CREATE_MESSAGE_LABELS_EN as Oe, mergeBillCreateScreenCopy as ke } from "./index48.js";
|
|
45
|
+
import { useBillCreateController as Ae } from "./index56.js";
|
|
46
|
+
import { useBillForm as je } from "./index58.js";
|
|
47
|
+
import { buildPaymentHistory as Me } from "./index3.js";
|
|
48
|
+
import { currentApprovalRound as Ne } from "./index4.js";
|
|
49
|
+
import { usePayableApprovalRoundStart as Pe } from "./index32.js";
|
|
50
|
+
import { useApprovalPolicyCardView as Fe } from "./index33.js";
|
|
51
|
+
import { resolveBillRejectionNotice as Ie } from "./index34.js";
|
|
52
|
+
import { useCurrentApprovalRequestId as Le } from "./index35.js";
|
|
53
|
+
import { usePayableDetailActions as Re } from "./index36.js";
|
|
54
|
+
import { useScheduledPayment as ze } from "./index37.js";
|
|
55
|
+
import { useDraftDelete as Be } from "./index38.js";
|
|
56
|
+
import { buildBillDetailView as Ve } from "./index43.js";
|
|
57
|
+
import { resolveEditorDismissal as He } from "./index44.js";
|
|
58
|
+
import { SourceDocumentContainer as Ue } from "./index49.js";
|
|
59
|
+
import { useVendorSectionProps as We } from "./index52.js";
|
|
60
|
+
import { billCreateTestIds as i } from "./index59.js";
|
|
61
|
+
import { cloneElement as Ge, isValidElement as Ke, useCallback as a, useEffect as qe, useMemo as o, useRef as Je, useState as s } from "react";
|
|
62
|
+
import { Fragment as Ye, jsx as c, jsxs as Xe } from "react/jsx-runtime";
|
|
63
|
+
import { Trash2Icon as Ze } from "lucide-react";
|
|
64
64
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index60.js
|
|
65
|
-
function
|
|
65
|
+
function Qe(e) {
|
|
66
66
|
let t = [...new Set(e)];
|
|
67
67
|
return t.length > 0 ? t : void 0;
|
|
68
68
|
}
|
|
69
|
-
function
|
|
70
|
-
let
|
|
71
|
-
|
|
72
|
-
}, []), [lt, ut] =
|
|
69
|
+
function l({ open: l, onOpenChange: u, payableId: $e, readOnly: d = !1, copy: et, onCollapse: f, onEdit: tt, poweredByBankName: nt }) {
|
|
70
|
+
let p = o(() => ke(et), [et]), [m, rt] = s(), [h, it] = s(!1), [at, ot] = s(!1), [g, _] = s(!1), [st, v] = s(), ct = a((e) => {
|
|
71
|
+
v(() => e);
|
|
72
|
+
}, []), [lt, ut] = s(), y = $e ?? lt, b = le(y, { pollWhileOcrProcessing: !0 }), x = se(y), { initResponse: S } = re(), dt = !!S, ft = t(S?.scopes, [n.AccountingConfigReadOrg]), C = r({ enabled: ft }), w = b.data, T = !y || !!w, E = !d && T && !!y && w?.status !== "draft", pt = !d && !!w && !xe(w?.status), D = d || pt, O = je({
|
|
73
73
|
payable: w,
|
|
74
74
|
lineItems: x.lineItems
|
|
75
75
|
}), k = w?.counterpart_id;
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}, [
|
|
79
|
-
let mt =
|
|
80
|
-
|
|
81
|
-
}, []), A =
|
|
76
|
+
qe(() => {
|
|
77
|
+
h || k && (rt(k), it(!0));
|
|
78
|
+
}, [h, k]);
|
|
79
|
+
let mt = a((e) => {
|
|
80
|
+
it(!0), rt(e);
|
|
81
|
+
}, []), A = ze({
|
|
82
82
|
payableId: y,
|
|
83
83
|
scheduledPaymentDate: w?.scheduled_payment_date,
|
|
84
|
-
enabled:
|
|
85
|
-
}), j =
|
|
84
|
+
enabled: d || E
|
|
85
|
+
}), j = Ce(S?.scopes), ht = t(S?.scopes, [n.PayableWriteOrg]), M = t(S?.scopes, [n.CounterpartWriteOrg]) && ht, N = M && ue(w?.status) && !A.hasScheduledPayment && !A.isResolving, gt = N && j, _t = N || M && w?.status === "rejected", vt = !d && T && (!y || w?.status === "draft") && !A.hasScheduledPayment && !A.isResolving, P = We({
|
|
86
86
|
payableId: y,
|
|
87
|
-
counterpartId:
|
|
87
|
+
counterpartId: d ? k : m,
|
|
88
88
|
payableCounterpartId: k,
|
|
89
|
-
isVendorKnown:
|
|
89
|
+
isVendorKnown: d ? !!w : T,
|
|
90
90
|
onCounterpartChange: mt,
|
|
91
91
|
requiredError: O.errors?.vendor,
|
|
92
92
|
payableCounterpartBankAccountId: w?.counterpart_bank_account_id ?? void 0,
|
|
93
93
|
extractedVendor: w?.counterpart_raw_data ?? void 0,
|
|
94
|
-
readOnly:
|
|
95
|
-
canEditVendor: !
|
|
96
|
-
canEditPaymentInstructions: !
|
|
97
|
-
canAddPaymentInstructions: !
|
|
98
|
-
confirmDiscard:
|
|
99
|
-
}), F = P.activePayToOperation === "missingInstructions" ? vt || _t : P.activePayToOperation === "existingInstructions" ? vt || N : P.activePayToOperation === "vendor" &&
|
|
94
|
+
readOnly: d,
|
|
95
|
+
canEditVendor: !d || gt,
|
|
96
|
+
canEditPaymentInstructions: !d || N,
|
|
97
|
+
canAddPaymentInstructions: !d || _t,
|
|
98
|
+
confirmDiscard: ct
|
|
99
|
+
}), F = P.activePayToOperation === "missingInstructions" ? vt || _t : P.activePayToOperation === "existingInstructions" ? vt || N : P.activePayToOperation === "vendor" && d ? gt : !1, yt = !!(y && h) && !m, I = b.refetch, bt = a(async () => {
|
|
100
100
|
let { data: e } = await I();
|
|
101
101
|
return e?.status ?? void 0;
|
|
102
|
-
}, [I]), xt =
|
|
102
|
+
}, [I]), xt = ce(), [L, St] = s(!1), R = Je(void 0), Ct = a(async () => {
|
|
103
103
|
if (R.current) return R.current;
|
|
104
104
|
let t = (async () => {
|
|
105
105
|
if (F) {
|
|
@@ -109,7 +109,7 @@ function c({ open: c, onOpenChange: l, payableId: et, readOnly: u = !1, copy: tt
|
|
|
109
109
|
try {
|
|
110
110
|
t = await P.prepareVendorForSave({ closeOnSuccess: !1 });
|
|
111
111
|
} catch {
|
|
112
|
-
e.error(
|
|
112
|
+
e.error(p.detail.paymentInstructionsSaveError);
|
|
113
113
|
return;
|
|
114
114
|
}
|
|
115
115
|
if (!t.ok) return;
|
|
@@ -117,11 +117,14 @@ function c({ open: c, onOpenChange: l, payableId: et, readOnly: u = !1, copy: tt
|
|
|
117
117
|
P.finalizePayToSave();
|
|
118
118
|
return;
|
|
119
119
|
}
|
|
120
|
-
let n = t.counterpartBankAccountId;
|
|
121
|
-
if (n
|
|
120
|
+
let n = t.counterpartId && t.counterpartId !== w?.counterpart_id ? t.counterpartId : void 0, r = t.counterpartBankAccountId && t.counterpartBankAccountId !== w?.counterpart_bank_account_id ? t.counterpartBankAccountId : void 0;
|
|
121
|
+
if (n || r) {
|
|
122
122
|
let t = {
|
|
123
123
|
path: { payable_id: y },
|
|
124
|
-
body: {
|
|
124
|
+
body: {
|
|
125
|
+
...n ? { counterpart_id: n } : {},
|
|
126
|
+
...r ? { counterpart_bank_account_id: r } : {}
|
|
127
|
+
}
|
|
125
128
|
};
|
|
126
129
|
try {
|
|
127
130
|
await xt.mutateAsync(t);
|
|
@@ -129,7 +132,7 @@ function c({ open: c, onOpenChange: l, payableId: et, readOnly: u = !1, copy: tt
|
|
|
129
132
|
try {
|
|
130
133
|
await xt.mutateAsync(t);
|
|
131
134
|
} catch {
|
|
132
|
-
e.error(
|
|
135
|
+
e.error(p.detail.paymentInstructionsLinkError);
|
|
133
136
|
return;
|
|
134
137
|
}
|
|
135
138
|
}
|
|
@@ -150,16 +153,17 @@ function c({ open: c, onOpenChange: l, payableId: et, readOnly: u = !1, copy: tt
|
|
|
150
153
|
}
|
|
151
154
|
}, [
|
|
152
155
|
F,
|
|
153
|
-
|
|
154
|
-
|
|
156
|
+
p.detail.paymentInstructionsLinkError,
|
|
157
|
+
p.detail.paymentInstructionsSaveError,
|
|
155
158
|
xt,
|
|
156
159
|
w?.counterpart_bank_account_id,
|
|
160
|
+
w?.counterpart_id,
|
|
157
161
|
y,
|
|
158
162
|
I,
|
|
159
163
|
P
|
|
160
|
-
]), z =
|
|
164
|
+
]), z = o(() => F ? P.mode === "creating" && Ke(P.newVendorForm) ? {
|
|
161
165
|
...P,
|
|
162
|
-
newVendorForm:
|
|
166
|
+
newVendorForm: Ge(P.newVendorForm, {
|
|
163
167
|
onSave: Ct,
|
|
164
168
|
isSaving: L
|
|
165
169
|
})
|
|
@@ -176,60 +180,60 @@ function c({ open: c, onOpenChange: l, payableId: et, readOnly: u = !1, copy: tt
|
|
|
176
180
|
Ct,
|
|
177
181
|
P
|
|
178
182
|
]);
|
|
179
|
-
|
|
180
|
-
|
|
183
|
+
qe(() => {
|
|
184
|
+
d && P.isEditingPayTo && !F && P.discardPayToEdits();
|
|
181
185
|
}, [
|
|
182
186
|
F,
|
|
183
|
-
|
|
187
|
+
d,
|
|
184
188
|
P.discardPayToEdits,
|
|
185
189
|
P.isEditingPayTo
|
|
186
190
|
]);
|
|
187
|
-
let wt =
|
|
188
|
-
payableId:
|
|
191
|
+
let wt = o(() => E ? { draftSaved: Oe.submittedSaved } : void 0, [E]), B = Ae({
|
|
192
|
+
payableId: $e,
|
|
189
193
|
form: O,
|
|
190
194
|
labels: wt,
|
|
191
|
-
counterpartId:
|
|
195
|
+
counterpartId: m,
|
|
192
196
|
isVendorPending: P.mode === "creating" || P.isPendingVendor,
|
|
193
197
|
clearCounterpart: yt,
|
|
194
198
|
prepareVendorForSave: P.prepareVendorForSave,
|
|
195
199
|
onPayableCreated: ut,
|
|
196
200
|
onSaved: ut,
|
|
197
|
-
onDraftSaved: () =>
|
|
198
|
-
onFinalized: () =>
|
|
201
|
+
onDraftSaved: () => u(!1),
|
|
202
|
+
onFinalized: () => u(!1),
|
|
199
203
|
readSavedStatus: E ? bt : void 0
|
|
200
|
-
}), Tt = !!(B.isSavingDraft || B.isFinalizing || P.isVendorSavePending), V =
|
|
204
|
+
}), Tt = !!(B.isSavingDraft || B.isFinalizing || P.isVendorSavePending), V = d ? y : void 0, H = Le({
|
|
201
205
|
payableId: V,
|
|
202
206
|
status: w?.status
|
|
203
|
-
}), Et =
|
|
204
|
-
counterpartId:
|
|
207
|
+
}), Et = Je(null), Dt = de(w), U = Te({
|
|
208
|
+
counterpartId: d ? k : void 0,
|
|
205
209
|
currency: w?.currency,
|
|
206
|
-
currentBankAccountId:
|
|
207
|
-
enabled: j &&
|
|
208
|
-
}), Ot =
|
|
210
|
+
currentBankAccountId: d ? w?.counterpart_bank_account_id ?? void 0 : void 0,
|
|
211
|
+
enabled: j && d
|
|
212
|
+
}), Ot = De({
|
|
209
213
|
payableId: V,
|
|
210
|
-
amountDueMinorUnits:
|
|
214
|
+
amountDueMinorUnits: we(w) ?? 0,
|
|
211
215
|
amountToPayMinorUnits: w?.amount_to_pay ?? void 0,
|
|
212
216
|
currencyCode: w?.currency ?? void 0,
|
|
213
217
|
dueDate: w?.due_date,
|
|
214
218
|
hasScheduledPayment: A.hasScheduledPayment,
|
|
215
|
-
labels:
|
|
216
|
-
}), W =
|
|
219
|
+
labels: p.markAsPaid
|
|
220
|
+
}), W = Fe({
|
|
217
221
|
payableId: V,
|
|
218
222
|
approvalPolicyId: w?.approval_policy_id,
|
|
219
|
-
enabled:
|
|
220
|
-
copy:
|
|
221
|
-
}), kt =
|
|
223
|
+
enabled: d,
|
|
224
|
+
copy: p.approvalPolicyCopy
|
|
225
|
+
}), kt = Se({
|
|
222
226
|
status: w?.status,
|
|
223
227
|
scopes: S?.scopes,
|
|
224
228
|
arePendingApproversUnknown: W.isLoading,
|
|
225
229
|
hasApprovalPolicy: !!w?.approval_policy_id,
|
|
226
230
|
hasWaitingRequest: H.hasWaitingRequest
|
|
227
|
-
}), At = !!H.id, jt = H.isLoading || W.isLoading, Mt =
|
|
231
|
+
}), At = !!H.id, jt = H.isLoading || W.isLoading, Mt = o(() => Qe(W.pendingApprovers.flatMap((e) => e.names)), [W.pendingApprovers]), Nt = d || E ? y : void 0, Pt = d ? tt : void 0, G = a((e) => {
|
|
228
232
|
let t = () => {
|
|
229
233
|
P.discardPayToEdits(), e?.();
|
|
230
234
|
};
|
|
231
|
-
P.hasUnsavedVendorChanges ?
|
|
232
|
-
}, [
|
|
235
|
+
P.hasUnsavedVendorChanges ? ct(t) : t();
|
|
236
|
+
}, [ct, P]), { actions: Ft, decisionDialog: It, isActionPending: Lt } = Re({
|
|
233
237
|
payableId: Nt,
|
|
234
238
|
status: w?.status,
|
|
235
239
|
currentApprovalRequestId: H.id,
|
|
@@ -241,7 +245,7 @@ function c({ open: c, onOpenChange: l, payableId: et, readOnly: u = !1, copy: tt
|
|
|
241
245
|
hasApprovalPolicy: !!w?.approval_policy_id,
|
|
242
246
|
hasWaitingRequest: H.hasWaitingRequest,
|
|
243
247
|
pendingApprovers: W.pendingApprovers,
|
|
244
|
-
labels:
|
|
248
|
+
labels: p.actions,
|
|
245
249
|
isMarkAsPaidPending: Ot.isPending,
|
|
246
250
|
onMarkAsPaidSelect: Ot.open,
|
|
247
251
|
onPayBillSelect: () => G(() => Et.current?.open()),
|
|
@@ -251,15 +255,15 @@ function c({ open: c, onOpenChange: l, payableId: et, readOnly: u = !1, copy: tt
|
|
|
251
255
|
Pt?.();
|
|
252
256
|
return;
|
|
253
257
|
}
|
|
254
|
-
E &&
|
|
258
|
+
E && u(!1);
|
|
255
259
|
}
|
|
256
|
-
}), Rt =
|
|
260
|
+
}), Rt = Be({
|
|
257
261
|
payableId: y,
|
|
258
262
|
status: w?.status,
|
|
259
|
-
enabled: !
|
|
260
|
-
labels:
|
|
261
|
-
onDeleted: () =>
|
|
262
|
-
}), zt = Tt || Lt, Bt = w?.ocr_status === "processing", Vt = b.isLoading || x.isResolving || Bt, Ht = b.isLoading || x.isResolving || C.isResolving || U.isLoading, Ut = b.isError || x.isError || C.isError, Wt =
|
|
263
|
+
enabled: !d,
|
|
264
|
+
labels: p.deleteDraft,
|
|
265
|
+
onDeleted: () => u(!1)
|
|
266
|
+
}), zt = Tt || Lt, Bt = w?.ocr_status === "processing", Vt = b.isLoading || x.isResolving || Bt, Ht = b.isLoading || x.isResolving || C.isResolving || U.isLoading, Ut = b.isError || x.isError || C.isError, Wt = o(() => [...Rt.menuItems, ...E || d && !Ht && !Ut ? Ft.menu.map((e) => ({
|
|
263
267
|
id: e.id,
|
|
264
268
|
label: e.label,
|
|
265
269
|
onSelect: e.onSelect,
|
|
@@ -270,46 +274,46 @@ function c({ open: c, onOpenChange: l, payableId: et, readOnly: u = !1, copy: tt
|
|
|
270
274
|
Ft.menu,
|
|
271
275
|
Rt.menuItems,
|
|
272
276
|
E,
|
|
273
|
-
|
|
277
|
+
d,
|
|
274
278
|
Ht,
|
|
275
279
|
Ut
|
|
276
|
-
]), K =
|
|
280
|
+
]), K = o(() => (C.data?.data ?? []).map((e) => ({
|
|
277
281
|
value: e.id,
|
|
278
282
|
label: [e.nominal_code, e.name].filter(Boolean).join(" — ")
|
|
279
283
|
})), [C.data]), q;
|
|
280
|
-
dt && (ft ? C.isError ? q =
|
|
281
|
-
let Gt = !dt || !!q || C.isResolving, Kt = ft && !C.isResolving && !C.isError, J =
|
|
284
|
+
dt && (ft ? C.isError ? q = p.lineItemsGlCodeUnavailable.loadError : !C.isResolving && K.length === 0 && (q = p.lineItemsGlCodeUnavailable.empty) : q = p.lineItemsGlCodeUnavailable.noAccess);
|
|
285
|
+
let Gt = !dt || !!q || C.isResolving, Kt = ft && !C.isResolving && !C.isError, J = oe(V), qt = w?.status === "rejected" || !d && E, Jt = t(S?.scopes, [n.ApprovalRequestReadOrg]), Yt = qt && Jt, Xt = t(S?.scopes, [n.UserReadOrg]), { userNames: Y, isError: Zt, isResolving: Qt } = ie({ enabled: (d || qt) && Xt }), $t = o(() => te(J.data?.data ?? [], Y, p.history), [
|
|
282
286
|
J.data,
|
|
283
287
|
Y,
|
|
284
|
-
|
|
285
|
-
]), en = Xt && Zt &&
|
|
288
|
+
p.history
|
|
289
|
+
]), en = Xt && Zt && ne(J.data?.data ?? [], $t, Y), tn = Pe({
|
|
286
290
|
payableId: y,
|
|
287
291
|
enabled: Yt
|
|
288
|
-
}), nn =
|
|
292
|
+
}), nn = ae(y, { enabled: Yt }), rn = o(() => Ne(nn.data?.data, tn.roundStartedAt), [nn.data, tn.roundStartedAt]), X = o(() => Ie({
|
|
289
293
|
payableStatus: w?.status,
|
|
290
294
|
approvalRequests: rn,
|
|
291
295
|
userNames: Y,
|
|
292
296
|
payableUpdatedAt: w?.updated_at,
|
|
293
|
-
labels:
|
|
297
|
+
labels: p.detail
|
|
294
298
|
}), [
|
|
295
299
|
w?.status,
|
|
296
300
|
w?.updated_at,
|
|
297
301
|
rn,
|
|
298
302
|
Y,
|
|
299
|
-
|
|
300
|
-
]), an =
|
|
303
|
+
p.detail
|
|
304
|
+
]), an = o(() => Me({
|
|
301
305
|
records: A.paymentRecords,
|
|
302
306
|
events: J.data?.data ?? [],
|
|
303
307
|
currencyCode: w?.currency,
|
|
304
|
-
labels:
|
|
308
|
+
labels: p.detail
|
|
305
309
|
}), [
|
|
306
310
|
A.paymentRecords,
|
|
307
311
|
J.data,
|
|
308
312
|
w?.currency,
|
|
309
|
-
|
|
310
|
-
]), on =
|
|
311
|
-
if (!
|
|
312
|
-
let e =
|
|
313
|
+
p.detail
|
|
314
|
+
]), on = o(() => {
|
|
315
|
+
if (!d || !w) return;
|
|
316
|
+
let e = Ve({
|
|
313
317
|
payable: w,
|
|
314
318
|
lineItems: x.lineItems,
|
|
315
319
|
glCodeOptions: K,
|
|
@@ -317,7 +321,7 @@ function c({ open: c, onOpenChange: l, payableId: et, readOnly: u = !1, copy: tt
|
|
|
317
321
|
history: $t,
|
|
318
322
|
paymentHistory: an,
|
|
319
323
|
approvalPolicy: W.view,
|
|
320
|
-
labels:
|
|
324
|
+
labels: p.detail,
|
|
321
325
|
hasScheduledPayment: A.hasScheduledPayment,
|
|
322
326
|
rejection: X,
|
|
323
327
|
payableAchInstructions: U.achInstructions,
|
|
@@ -331,7 +335,7 @@ function c({ open: c, onOpenChange: l, payableId: et, readOnly: u = !1, copy: tt
|
|
|
331
335
|
A.hasScheduledPayment,
|
|
332
336
|
W.view,
|
|
333
337
|
j,
|
|
334
|
-
|
|
338
|
+
p.detail,
|
|
335
339
|
K,
|
|
336
340
|
Kt,
|
|
337
341
|
$t,
|
|
@@ -340,95 +344,95 @@ function c({ open: c, onOpenChange: l, payableId: et, readOnly: u = !1, copy: tt
|
|
|
340
344
|
U.achInstructions,
|
|
341
345
|
U.isError,
|
|
342
346
|
an,
|
|
343
|
-
|
|
347
|
+
d,
|
|
344
348
|
X,
|
|
345
349
|
P.mode,
|
|
346
350
|
P.summary
|
|
347
|
-
]), sn = w?.source_of_payable_data === "ocr", Z = Dt?.name, cn =
|
|
348
|
-
if (
|
|
349
|
-
G(() =>
|
|
351
|
+
]), sn = w?.source_of_payable_data === "ocr", Z = Dt?.name, cn = d ? Z ? p.viewTitle(Z) : p.readOnlyTitle : Z && (sn || E) ? p.extractedTitle(Z) : p.newTitle, ln = d && w?.created_at ? p.addedOn(ee(w.created_at.slice(0, 10))) : void 0, un = a(() => {
|
|
352
|
+
if (d && P.isEditingPayTo) {
|
|
353
|
+
G(() => u(!1));
|
|
350
354
|
return;
|
|
351
355
|
}
|
|
352
356
|
let e = O.isDirty || P.hasUnsavedVendorChanges || !!B.stagedFile || B.isFileDeletionPending;
|
|
353
|
-
switch (
|
|
354
|
-
isUnsavedPromptOpen:
|
|
357
|
+
switch (He({
|
|
358
|
+
isUnsavedPromptOpen: g,
|
|
355
359
|
isLocked: D,
|
|
356
360
|
isDirty: e
|
|
357
361
|
})) {
|
|
358
362
|
case "dismiss-prompt":
|
|
359
|
-
|
|
363
|
+
_(!1);
|
|
360
364
|
return;
|
|
361
365
|
case "prompt":
|
|
362
|
-
|
|
366
|
+
_(!0);
|
|
363
367
|
return;
|
|
364
|
-
default:
|
|
368
|
+
default: u(!1);
|
|
365
369
|
}
|
|
366
370
|
}, [
|
|
367
371
|
B.isFileDeletionPending,
|
|
368
372
|
B.stagedFile,
|
|
369
373
|
O.isDirty,
|
|
370
374
|
D,
|
|
371
|
-
|
|
375
|
+
g,
|
|
372
376
|
G,
|
|
373
|
-
l,
|
|
374
377
|
u,
|
|
378
|
+
d,
|
|
375
379
|
P.hasUnsavedVendorChanges,
|
|
376
380
|
P.isEditingPayTo
|
|
377
|
-
]), dn =
|
|
381
|
+
]), dn = a(() => {
|
|
378
382
|
if (P.isEditingPayTo) {
|
|
379
|
-
G(
|
|
383
|
+
G(f);
|
|
380
384
|
return;
|
|
381
385
|
}
|
|
382
|
-
|
|
386
|
+
f?.();
|
|
383
387
|
}, [
|
|
384
388
|
G,
|
|
385
|
-
|
|
389
|
+
f,
|
|
386
390
|
P.isEditingPayTo
|
|
387
|
-
]), fn =
|
|
388
|
-
|
|
389
|
-
}, [
|
|
391
|
+
]), fn = a(() => {
|
|
392
|
+
_(!1), u(!1);
|
|
393
|
+
}, [u]), Q = Vt || P.mode === "creating", pn = a(async () => {
|
|
390
394
|
if (Q) return;
|
|
391
395
|
let e = await B.saveDraft();
|
|
392
|
-
|
|
396
|
+
_(!1), e && u(!1);
|
|
393
397
|
}, [
|
|
394
398
|
B,
|
|
395
399
|
Q,
|
|
396
|
-
|
|
397
|
-
]), $ =
|
|
400
|
+
u
|
|
401
|
+
]), $ = be({
|
|
398
402
|
payable: w,
|
|
399
|
-
onRemoved: () =>
|
|
403
|
+
onRemoved: () => u(!1),
|
|
400
404
|
canManage: ht
|
|
401
|
-
}), mn =
|
|
402
|
-
if (!(zt || $.isBusy)) return e ?
|
|
405
|
+
}), mn = a((e) => {
|
|
406
|
+
if (!(zt || $.isBusy)) return e ? u(!0) : un();
|
|
403
407
|
}, [
|
|
404
408
|
$.isBusy,
|
|
405
409
|
zt,
|
|
406
410
|
un,
|
|
407
|
-
|
|
408
|
-
]), hn = $.isPossibleDuplicate, gn = !
|
|
409
|
-
_n && X ? /* @__PURE__ */
|
|
411
|
+
u
|
|
412
|
+
]), hn = $.isPossibleDuplicate, gn = !d && sn && !at, _n = !d && !!X, vn = _n || hn || gn ? /* @__PURE__ */ Xe(Ye, { children: [
|
|
413
|
+
_n && X ? /* @__PURE__ */ c(ge, {
|
|
410
414
|
...X,
|
|
411
|
-
labels:
|
|
415
|
+
labels: p.rejectedBanner
|
|
412
416
|
}) : null,
|
|
413
|
-
hn ? /* @__PURE__ */
|
|
417
|
+
hn ? /* @__PURE__ */ c(he, {
|
|
414
418
|
onNotADuplicate: $.onNotADuplicate,
|
|
415
419
|
onRemoveBill: $.onRemoveBill,
|
|
416
420
|
isActionDisabled: $.isBusy,
|
|
417
421
|
labels: $.removeBillLabel ? { removeBillButton: $.removeBillLabel } : void 0,
|
|
418
|
-
testId:
|
|
422
|
+
testId: i.duplicateNotice
|
|
419
423
|
}) : null,
|
|
420
|
-
gn ? /* @__PURE__ */
|
|
424
|
+
gn ? /* @__PURE__ */ c(_e, { onDismiss: () => ot(!0) }) : null
|
|
421
425
|
] }) : void 0;
|
|
422
|
-
return /* @__PURE__ */
|
|
423
|
-
/* @__PURE__ */
|
|
424
|
-
open:
|
|
426
|
+
return /* @__PURE__ */ Xe(Ye, { children: [
|
|
427
|
+
/* @__PURE__ */ c(fe, {
|
|
428
|
+
open: l,
|
|
425
429
|
onOpenChange: mn,
|
|
426
430
|
title: cn,
|
|
427
431
|
subtitle: ln,
|
|
428
432
|
notice: vn,
|
|
429
433
|
vendor: {
|
|
430
434
|
...z,
|
|
431
|
-
testId:
|
|
435
|
+
testId: i.vendorSection
|
|
432
436
|
},
|
|
433
437
|
values: O.values,
|
|
434
438
|
errors: O.errors,
|
|
@@ -450,9 +454,9 @@ function c({ open: c, onOpenChange: l, payableId: et, readOnly: u = !1, copy: tt
|
|
|
450
454
|
onAddLineItem: O.onAddLineItem,
|
|
451
455
|
errors: O.lineItemErrors,
|
|
452
456
|
totalsErrors: O.totalsErrors,
|
|
453
|
-
testId:
|
|
457
|
+
testId: i.lineItems
|
|
454
458
|
},
|
|
455
|
-
documentPanel: /* @__PURE__ */
|
|
459
|
+
documentPanel: /* @__PURE__ */ c(Ue, {
|
|
456
460
|
payableId: y,
|
|
457
461
|
readOnly: D,
|
|
458
462
|
isDocumentPending: !!y && !w?.file && (b.isLoading || w?.ocr_status === "processing"),
|
|
@@ -478,13 +482,13 @@ function c({ open: c, onOpenChange: l, payableId: et, readOnly: u = !1, copy: tt
|
|
|
478
482
|
}),
|
|
479
483
|
menuItems: Wt,
|
|
480
484
|
readOnly: D,
|
|
481
|
-
detail:
|
|
485
|
+
detail: d ? {
|
|
482
486
|
view: on,
|
|
483
487
|
actions: Ft,
|
|
484
|
-
scheduledSummary: A.hasScheduledPayment && A.scheduledDateLabel ?
|
|
485
|
-
scheduledStatusLabel: A.hasScheduledPayment && A.scheduledDateLabel ?
|
|
488
|
+
scheduledSummary: A.hasScheduledPayment && A.scheduledDateLabel ? p.scheduledSummary(A.scheduledDateLabel) : void 0,
|
|
489
|
+
scheduledStatusLabel: A.hasScheduledPayment && A.scheduledDateLabel ? p.scheduledStatusBadge(A.scheduledDateLabel) : void 0,
|
|
486
490
|
showApprovalOverrideNotice: !jt && kt,
|
|
487
|
-
awaitingApprovalNotice: !jt && !At && !kt && w?.status === "approve_in_progress" && w?.approval_policy_id ? Mt ?
|
|
491
|
+
awaitingApprovalNotice: !jt && !At && !kt && w?.status === "approve_in_progress" && w?.approval_policy_id ? Mt ? p.awaitingApprovalNotice(Mt) : p.awaitingApprovalUnknownNotice : void 0,
|
|
488
492
|
payTo: {
|
|
489
493
|
onEdit: z.mode === "resolved" ? z.onEdit : void 0,
|
|
490
494
|
paymentInstructions: z.paymentInstructions,
|
|
@@ -504,70 +508,70 @@ function c({ open: c, onOpenChange: l, payableId: et, readOnly: u = !1, copy: tt
|
|
|
504
508
|
isSavingDraft: B.isSavingDraft,
|
|
505
509
|
isSubmitting: B.isFinalizing,
|
|
506
510
|
onCancel: un,
|
|
507
|
-
onCollapse:
|
|
511
|
+
onCollapse: d ? dn : void 0,
|
|
508
512
|
onSaveDraft: B.saveDraft,
|
|
509
513
|
onFinalize: B.finalize,
|
|
510
514
|
scrollToErrorToken: B.scrollToErrorToken,
|
|
511
515
|
showSubmit: !D && T,
|
|
512
|
-
testId:
|
|
516
|
+
testId: i.dialog
|
|
513
517
|
}),
|
|
514
|
-
/* @__PURE__ */
|
|
515
|
-
open:
|
|
518
|
+
/* @__PURE__ */ c(ye, {
|
|
519
|
+
open: g,
|
|
516
520
|
onSaveDraft: pn,
|
|
517
521
|
onDiscard: fn,
|
|
518
|
-
onCancel: () =>
|
|
522
|
+
onCancel: () => _(!1),
|
|
519
523
|
isSaving: B.isSavingDraft,
|
|
520
524
|
isSaveDraftDisabled: Q,
|
|
521
|
-
labels:
|
|
522
|
-
testId:
|
|
523
|
-
saveDraftTestId:
|
|
524
|
-
discardTestId:
|
|
525
|
-
closeTestId:
|
|
525
|
+
labels: p.unsavedChanges,
|
|
526
|
+
testId: i.unsavedDialog,
|
|
527
|
+
saveDraftTestId: i.unsavedSaveDraft,
|
|
528
|
+
discardTestId: i.unsavedDiscard,
|
|
529
|
+
closeTestId: i.unsavedClose
|
|
526
530
|
}),
|
|
527
|
-
/* @__PURE__ */
|
|
528
|
-
open: !!
|
|
531
|
+
/* @__PURE__ */ c(me, {
|
|
532
|
+
open: !!st,
|
|
529
533
|
onDiscard: () => {
|
|
530
|
-
let e =
|
|
531
|
-
|
|
534
|
+
let e = st;
|
|
535
|
+
v(void 0), e?.();
|
|
532
536
|
},
|
|
533
|
-
onKeepEditing: () =>
|
|
534
|
-
labels:
|
|
535
|
-
testId:
|
|
536
|
-
discardTestId:
|
|
537
|
+
onKeepEditing: () => v(void 0),
|
|
538
|
+
labels: p.discardChanges,
|
|
539
|
+
testId: i.discardDialog,
|
|
540
|
+
discardTestId: i.discardConfirm
|
|
537
541
|
}),
|
|
538
|
-
/* @__PURE__ */
|
|
542
|
+
/* @__PURE__ */ c(pe, {
|
|
539
543
|
...It,
|
|
540
|
-
labels: { cancelButton:
|
|
541
|
-
testId:
|
|
542
|
-
confirmTestId:
|
|
543
|
-
reasonTestId:
|
|
544
|
+
labels: { cancelButton: p.actions.decisionDialog.cancelButton },
|
|
545
|
+
testId: i.decisionDialog,
|
|
546
|
+
confirmTestId: i.decisionConfirm,
|
|
547
|
+
reasonTestId: i.decisionReason
|
|
544
548
|
}),
|
|
545
|
-
/* @__PURE__ */
|
|
549
|
+
/* @__PURE__ */ c(pe, {
|
|
546
550
|
...Rt.dialog,
|
|
547
|
-
labels: { cancelButton:
|
|
548
|
-
testId:
|
|
549
|
-
confirmTestId:
|
|
551
|
+
labels: { cancelButton: p.actions.decisionDialog.cancelButton },
|
|
552
|
+
testId: i.deleteDraftDialog,
|
|
553
|
+
confirmTestId: i.deleteDraftConfirm
|
|
550
554
|
}),
|
|
551
|
-
/* @__PURE__ */
|
|
555
|
+
/* @__PURE__ */ c(pe, {
|
|
552
556
|
open: $.removeConfirmation.open,
|
|
553
557
|
copy: $.removeConfirmation.copy,
|
|
554
558
|
onConfirm: $.removeConfirmation.onConfirm,
|
|
555
559
|
onCancel: $.removeConfirmation.onCancel,
|
|
556
560
|
isPending: $.removeConfirmation.isPending,
|
|
557
|
-
confirmIcon: /* @__PURE__ */
|
|
561
|
+
confirmIcon: /* @__PURE__ */ c(Ze, {}),
|
|
558
562
|
labels: { cancelButton: $.removeConfirmation.cancelButtonLabel },
|
|
559
|
-
testId:
|
|
560
|
-
confirmTestId:
|
|
563
|
+
testId: i.duplicateRemoveDialog,
|
|
564
|
+
confirmTestId: i.duplicateRemoveConfirm
|
|
561
565
|
}),
|
|
562
|
-
/* @__PURE__ */
|
|
563
|
-
|
|
566
|
+
/* @__PURE__ */ c(ve, { ...Ot.dialogProps }),
|
|
567
|
+
d && w ? /* @__PURE__ */ c(Ee, {
|
|
564
568
|
ref: Et,
|
|
565
569
|
payable: w,
|
|
566
570
|
onMissingAchInstructions: M ? P.openPaymentInstructions : void 0,
|
|
567
|
-
poweredByBankName:
|
|
568
|
-
labels:
|
|
571
|
+
poweredByBankName: nt,
|
|
572
|
+
labels: p.payBill
|
|
569
573
|
}) : null
|
|
570
574
|
] });
|
|
571
575
|
}
|
|
572
576
|
//#endregion
|
|
573
|
-
export {
|
|
577
|
+
export { l as BillCreateDialog, l as default };
|