@tesouro/embedded-components-react 0.5.76 → 0.5.78

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