@tesouro/embedded-components-react 0.5.3 → 0.5.4

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