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