@tesouro/embedded-components-react 0.5.45 → 0.5.47

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