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