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