@tesouro/embedded-components-react 0.5.58 → 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.
Files changed (23) hide show
  1. package/README.md +9 -9
  2. package/dist/index.d.ts +5 -3
  3. package/dist/lib/CounterpartsWidget.d.ts +5 -3
  4. package/dist/lib/ReceivablesWidget.d.ts +3 -2
  5. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index49.js +53 -53
  6. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index52.js +42 -65
  7. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index53.js +288 -226
  8. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index57.js +104 -101
  9. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index61.js +313 -285
  10. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index26.js +12 -4
  11. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index27.js +2 -0
  12. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index28.js +41 -31
  13. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index31.js +8 -1
  14. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index46.js +9 -0
  15. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/index8.js +1 -1
  16. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/helpers.js +1 -1
  17. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/labels.js +2 -2
  18. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/useDeleteController.js +4 -4
  19. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index11.js +121 -115
  20. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index2.js +2 -1
  21. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index6.js +1 -0
  22. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  23. 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 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";
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 Xe(e) {
66
+ function Qe(e) {
67
67
  let t = [...new Set(e)];
68
68
  return t.length > 0 ? t : void 0;
69
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({
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: b.lineItems
75
+ lineItems: y.lineItems
76
76
  }), O = C?.counterpart_id;
77
- Ge(() => {
78
- p || O && (rt(O), it(!0));
77
+ qe(() => {
78
+ p || O && (at(O), ot(!0));
79
79
  }, [p, O]);
80
- let pt = a((e) => {
81
- it(!0), rt(e);
80
+ let ht = a((e) => {
81
+ ot(!0), at(e);
82
82
  }, []), k = Re({
83
- payableId: v,
83
+ payableId: _,
84
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,
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: u ? !!C : w,
91
- onCounterpartChange: pt,
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: 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();
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
- }, [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);
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
- await F();
140
+ })();
141
+ I.current = t;
142
+ try {
143
+ await t;
129
144
  } finally {
130
- xt(!1);
145
+ I.current = void 0;
131
146
  }
132
147
  }, [
133
- P,
134
- d.detail.paymentInstructionsLinkError,
135
- d.detail.paymentInstructionsSaveError,
136
- yt,
148
+ N,
149
+ f.detail.paymentInstructionsLinkError,
150
+ f.detail.paymentInstructionsSaveError,
151
+ Ct,
137
152
  C?.counterpart_bank_account_id,
138
- v,
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
- N
172
+ L,
173
+ M
141
174
  ]);
142
- Ge(() => {
143
- u && N.isEditingPayTo && !P && N.discardPayToEdits();
175
+ qe(() => {
176
+ d && M.isEditingPayTo && !N && M.discardPayToEdits();
144
177
  }, [
145
- P,
146
- u,
147
- N.discardPayToEdits,
148
- N.isEditingPayTo
178
+ N,
179
+ d,
180
+ M.discardPayToEdits,
181
+ M.isEditingPayTo
149
182
  ]);
150
- let Ct = o(() => T ? { draftSaved: De.submittedSaved } : void 0, [T]), I = ke({
151
- payableId: Qe,
183
+ let Tt = o(() => T ? { draftSaved: De.submittedSaved } : void 0, [T]), z = ke({
184
+ payableId: $e,
152
185
  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,
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
- }), Tt = Ke(null), Et = de(C), z = we({
167
- counterpartId: u ? O : void 0,
199
+ }), Dt = Je(null), Ot = de(C), H = we({
200
+ counterpartId: d ? O : void 0,
168
201
  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,
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: d.markAsPaid
179
- }), V = Pe({
180
- payableId: L,
211
+ labels: f.markAsPaid
212
+ }), W = Pe({
213
+ payableId: B,
181
214
  approvalPolicyId: C?.approval_policy_id,
182
- enabled: u,
183
- copy: d.approvalPolicyCopy
184
- }), Dt = xe({
215
+ enabled: d,
216
+ copy: f.approvalPolicyCopy
217
+ }), kt = xe({
185
218
  status: C?.status,
186
- scopes: x?.scopes,
187
- arePendingApproversUnknown: V.isLoading,
219
+ scopes: b?.scopes,
220
+ arePendingApproversUnknown: W.isLoading,
188
221
  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,
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: R.id,
194
- arePendingApproversUnknown: V.isLoading,
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: z.isLoading,
236
+ isPayabilityUnknown: H.isLoading,
199
237
  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,
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
- Mt?.();
247
+ Pt?.();
210
248
  return;
211
249
  }
212
- T && l(!1);
250
+ T && u(!1);
213
251
  }
214
- }), U = ze({
215
- payableId: v,
252
+ }), Lt = ze({
253
+ payableId: _,
216
254
  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) => ({
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
- H.menu,
229
- U.menuItems,
266
+ K.menu,
267
+ Lt.menuItems,
230
268
  T,
231
- u,
232
- G,
233
- Lt
234
- ]), K = o(() => (S.data?.data ?? []).map((e) => ({
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]), 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({
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: Jt,
250
- userNames: Y,
287
+ approvalRequests: $t,
288
+ userNames: X,
251
289
  payableUpdatedAt: C?.updated_at,
252
- labels: d.detail
290
+ labels: f.detail
253
291
  }), [
254
292
  C?.status,
255
293
  C?.updated_at,
256
- Jt,
257
- Y,
258
- d.detail
259
- ]), Yt = o(() => je({
294
+ $t,
295
+ X,
296
+ f.detail
297
+ ]), en = o(() => je({
260
298
  records: k.paymentRecords,
261
- events: J.data?.data ?? [],
299
+ events: Y.data?.data ?? [],
262
300
  currencyCode: C?.currency,
263
- labels: d.detail
301
+ labels: f.detail
264
302
  }), [
265
303
  k.paymentRecords,
266
- J.data,
304
+ Y.data,
267
305
  C?.currency,
268
- d.detail
269
- ]), Xt = o(() => {
270
- if (!u || !C) return;
306
+ f.detail
307
+ ]), tn = o(() => {
308
+ if (!d || !C) return;
271
309
  let e = Be({
272
310
  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,
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: X,
282
- payableAchInstructions: z.achInstructions,
283
- payableAchInstructionsReadable: A && !z.isError
319
+ rejection: Z,
320
+ payableAchInstructions: H.achInstructions,
321
+ payableAchInstructionsReadable: A && !H.isError
284
322
  });
285
- return N.mode === "resolved" && N.summary ? {
323
+ return M.mode === "resolved" && M.summary ? {
286
324
  ...e,
287
- payTo: N.summary
325
+ payTo: M.summary
288
326
  } : e;
289
327
  }, [
290
328
  k.hasScheduledPayment,
291
- V.view,
329
+ W.view,
292
330
  A,
293
- d.detail,
294
- K,
295
- Bt,
331
+ f.detail,
332
+ q,
296
333
  Gt,
297
- b.lineItems,
334
+ Xt,
335
+ y.lineItems,
298
336
  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));
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 || N.hasUnsavedVendorChanges || !!I.stagedFile || I.isFileDeletionPending;
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: l(!1);
361
+ default: u(!1);
329
362
  }
330
363
  }, [
331
- I.isFileDeletionPending,
332
- I.stagedFile,
364
+ z.isFileDeletionPending,
365
+ z.stagedFile,
333
366
  D.isDirty,
334
367
  E,
335
368
  m,
336
- Q,
337
- l,
369
+ G,
338
370
  u,
339
- N.hasUnsavedVendorChanges,
340
- N.isEditingPayTo
341
- ]), tn = a(() => {
342
- if (N.isEditingPayTo) {
343
- Q(et);
371
+ d,
372
+ M.hasUnsavedVendorChanges,
373
+ M.isEditingPayTo
374
+ ]), sn = a(() => {
375
+ if (M.isEditingPayTo) {
376
+ G(tt);
344
377
  return;
345
378
  }
346
- et?.();
379
+ tt?.();
347
380
  }, [
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);
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
- I,
359
- rn,
360
- l
391
+ z,
392
+ ln,
393
+ u
361
394
  ]), $ = ye({
362
395
  payable: C,
363
- onRemoved: () => l(!1),
364
- canManage: mt
365
- }), on = a((e) => {
366
- if (!(W || $.isBusy)) return e ? l(!0) : en();
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
- 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
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
- sn ? /* @__PURE__ */ c(me, {
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
- cn ? /* @__PURE__ */ c(ge, { onDismiss: () => ot(!0) }) : null
417
+ pn ? /* @__PURE__ */ c(ge, { onDismiss: () => ct(!0) }) : null
385
418
  ] }) : void 0;
386
- return /* @__PURE__ */ Je(qe, { children: [
419
+ return /* @__PURE__ */ Xe(Ye, { children: [
387
420
  /* @__PURE__ */ c(fe, {
388
- open: Ze,
389
- onOpenChange: on,
390
- title: Qt,
391
- subtitle: $t,
392
- notice: un,
421
+ open: l,
422
+ onOpenChange: dn,
423
+ title: rn,
424
+ subtitle: an,
425
+ notice: hn,
393
426
  vendor: {
394
- ...N,
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: K,
403
- glCodeDisabled: zt,
404
- glCodeUnavailableMessage: q,
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: v,
450
+ payableId: _,
418
451
  readOnly: E,
419
- isDocumentPending: !!v && !C?.file && (y.isLoading || C?.ocr_status === "processing"),
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: I.stagedFile,
428
- onFileStaged: I.stageFile,
429
- onClearStagedFile: I.clearStagedFile,
430
- isSaving: wt
460
+ stagedFile: z.stagedFile,
461
+ onFileStaged: z.stageFile,
462
+ onClearStagedFile: z.clearStagedFile,
463
+ isSaving: Et
431
464
  },
432
465
  deletion: {
433
- isPending: I.isFileDeletionPending,
434
- onRequest: I.requestFileDeletion,
435
- onDetachNow: I.detachFileNow,
436
- isDeleting: I.isDeletingFile,
437
- hasFailed: I.hasFileDeletionFailed
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: Rt,
473
+ menuItems: Ut,
441
474
  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,
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: 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
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: 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
488
+ isLoading: Vt,
489
+ isError: Ht,
490
+ paymentHistoryError: k.isError || Y.isError,
491
+ paymentHistoryLoading: k.isResolving || Y.isLoading
464
492
  } : 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,
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: an,
480
- onDiscard: nn,
507
+ onSaveDraft: un,
508
+ onDiscard: cn,
481
509
  onCancel: () => h(!1),
482
- isSaving: I.isSavingDraft,
483
- isSaveDraftDisabled: rn,
484
- labels: d.unsavedChanges,
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: !!st,
519
+ open: !!lt,
492
520
  onDiscard: () => {
493
- let e = st;
494
- g(void 0), e?.();
521
+ let e = lt;
522
+ ut(void 0), e?.();
495
523
  },
496
- onKeepEditing: () => g(void 0),
497
- labels: d.discardChanges,
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
- ...Nt,
503
- labels: { cancelButton: d.actions.decisionDialog.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
- ...U.dialog,
510
- labels: { cancelButton: d.actions.decisionDialog.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(Ye, {}),
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, { ...B.dialogProps }),
526
- u && C ? /* @__PURE__ */ c(Te, {
527
- ref: Tt,
553
+ /* @__PURE__ */ c(_e, { ...U.dialogProps }),
554
+ d && C ? /* @__PURE__ */ c(Te, {
555
+ ref: Dt,
528
556
  payable: C,
529
- onMissingAchInstructions: j ? N.openPaymentInstructions : void 0,
530
- poweredByBankName: nt,
531
- labels: d.payBill
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 { Ze as BillCreateDialog, Ze as default };
564
+ export { l as BillCreateDialog, l as default };