@tesouro/embedded-components-react 0.5.46 → 0.5.48

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