@tesouro/embedded-components-react 0.11.129 → 0.11.131

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 (59) hide show
  1. package/dist/fixtures/index.d.ts +4 -4
  2. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index.js +5 -4
  3. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index21.js +20 -17
  4. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index22.js +14 -37
  5. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index23.js +31 -14
  6. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index24.js +26 -2
  7. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index25.js +2 -0
  8. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index.js +7 -7
  9. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index10.js +35 -12
  10. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index11.js +57 -65
  11. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index12.js +6 -11
  12. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index13.js +20 -8
  13. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index14.js +97 -7
  14. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index15.js +10 -10
  15. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index16.js +10 -29
  16. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index17.js +7 -27
  17. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index18.js +8 -18
  18. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index19.js +24 -139
  19. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index20.js +24 -13
  20. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index21.js +14 -17
  21. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index22.js +130 -27
  22. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index23.js +17 -100
  23. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index24.js +21 -82
  24. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index25.js +41 -3
  25. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index26.js +98 -53
  26. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index27.js +82 -113
  27. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index28.js +3 -193
  28. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index29.js +57 -81
  29. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index30.js +110 -66
  30. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index31.js +190 -111
  31. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index32.js +71 -456
  32. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index33.js +69 -114
  33. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index34.js +113 -8
  34. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index35.js +458 -79
  35. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index36.js +116 -79
  36. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index37.js +10 -256
  37. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index38.js +78 -36
  38. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index39.js +73 -236
  39. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index4.js +1 -1
  40. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index40.js +256 -21
  41. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index41.js +43 -516
  42. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index42.js +245 -4
  43. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index43.js +20 -40
  44. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index44.js +497 -211
  45. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index45.js +3 -2
  46. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index46.js +40 -3
  47. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index47.js +235 -57
  48. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index48.js +2 -0
  49. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index49.js +5 -0
  50. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index50.js +64 -0
  51. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index51.js +1 -0
  52. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index6.js +4 -47
  53. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index7.js +13 -4
  54. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index8.js +8 -13
  55. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index9.js +18 -9
  56. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/ui/dist/index3.js +44 -34
  57. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/lib/BillPayWidget/BillsTab.js +1 -1
  58. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  59. package/package.json +1 -1
@@ -2,238 +2,524 @@
2
2
  "use client";
3
3
  "use client";
4
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";
5
+ import { formatCalendarDate as e } from "../../../../shared/util/dist/lib/formatCalendarDate.js";
6
+ import "../../../../shared/util/dist/index.js";
7
+ import { hasAnyScope as t } from "../../../../shared/data-access/dist/lib/hasAnyScope.js";
8
+ import { Scope as n } from "../../../../shared/data-access/dist/lib/scopes.js";
7
9
  import { useAllLedgerAccountsQuery as ee } from "../../../../shared/data-access/dist/lib/reference-data/useLedgerAccountsQuery.js";
8
10
  import "../../../../shared/data-access/dist/index.js";
9
11
  import { useWidgetConfig as te } from "../../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
10
- import { useOrganizationUserNames as n } from "../../../../shared/feature/dist/lib/user/useOrganizationUserNames.js";
12
+ import { useOrganizationUserNames as ne } from "../../../../shared/feature/dist/lib/user/useOrganizationUserNames.js";
11
13
  import "../../../../shared/feature/dist/index.js";
12
- import { mergeDecisionDialogCopy as r, mergePaymentHistoryMethodLabels as i } from "../../../util/dist/lib/billDetailLabels.js";
13
- import { hasSuspectedPayableDuplicate as a } from "../../../util/dist/lib/payableDuplicates.js";
14
+ import { isEditablePayableStatus as re } from "../../../util/dist/lib/isEditablePayableStatus.js";
15
+ import { resolveVendor as ie } from "../../../util/dist/lib/resolveVendor.js";
14
16
  import "../../../util/dist/index.js";
15
- import { mapPayableToBillDetails as o } from "./index23.js";
16
- import { BillDecisionDialog as s } from "../../../ui/dist/index4.js";
17
+ import { formatGlCodeLabel as ae, resolveGlCodeAvailability as oe } from "./index15.js";
18
+ import { hasUnpaidBalance as se } from "../../../../shared/document-status/util/dist/lib/derivePayableStatus.js";
19
+ import { BillDecisionDialog as r } from "../../../ui/dist/index4.js";
17
20
  import "../../../ui/dist/index.js";
18
- import { BillDetailsSheet as c } from "../../ui/dist/index34.js";
19
- import { BillDuplicateNotice as l } from "../../ui/dist/index37.js";
21
+ import { BillDialogScreen as ce } from "../../ui/dist/index31.js";
22
+ import { BillDuplicateNotice as le } from "../../ui/dist/index37.js";
23
+ import { BillRejectedBanner as ue } from "../../ui/dist/index40.js";
24
+ import { DiscardChangesDialog as de } from "../../ui/dist/index43.js";
25
+ import { ExtractionNotice as fe } from "../../ui/dist/index46.js";
26
+ import { UnsavedBillDialog as pe } from "../../ui/dist/index52.js";
20
27
  import "../../ui/dist/index.js";
21
- import { useAllPayableLineItemsQuery as u } from "../../data-access/dist/index5.js";
22
- import { usePayableQuery as d } from "../../data-access/dist/index22.js";
28
+ import { BILL_CREATE_MESSAGE_LABELS_EN as me, mergeBillDialogCopy as he } from "./index31.js";
29
+ import { useAllPayableLineItemsQuery as ge } from "../../data-access/dist/index5.js";
30
+ import { usePayableQuery as _e } from "../../data-access/dist/index23.js";
23
31
  import "../../data-access/dist/index.js";
24
- import { buildPaymentHistory as f } from "./index2.js";
25
- import { canOverrideApprovalPolicy as p, canReadCounterpartBankAccounts as m } from "./index5.js";
26
- import { useApprovalPolicyCardView as h } from "./index11.js";
27
- import { resolveApprovalNotices as g } from "./index13.js";
28
- import { useBillRejectionNotice as ne } from "./index16.js";
29
- import { useCurrentApprovalRequestId as re } from "./index17.js";
30
- import { usePayableAuditHistory as ie } from "./index18.js";
31
- import { usePayableDetailActions as ae } from "./index19.js";
32
- import { useScheduledDateLabel as oe } from "./index20.js";
33
- import { useScheduledPayment as se } from "./index21.js";
34
- import { usePayableAchInstructions as ce } from "../../../../shared/counterpart-management/feature/dist/lib/usePayableAchInstructions.js";
32
+ import { useBillCreateController as ve } from "./index40.js";
33
+ import { useBillForm as ye } from "./index42.js";
34
+ import { buildPaymentHistory as be } from "./index2.js";
35
+ import { usePayableDuplicateReview as xe } from "./index4.js";
36
+ import { canOverrideApprovalPolicy as Se, canReadCounterpartBankAccounts as Ce } from "./index5.js";
37
+ import { useApprovalPolicyCardView as we } from "./index14.js";
38
+ import { resolveApprovalNotices as Te } from "./index16.js";
39
+ import { resolvePaymentInstructionsGestures as Ee } from "./index17.js";
40
+ import { useBillRejectionNotice as De } from "./index19.js";
41
+ import { useCurrentApprovalRequestId as Oe } from "./index20.js";
42
+ import { usePayableAuditHistory as ke } from "./index21.js";
43
+ import { usePayableDetailActions as Ae } from "./index22.js";
44
+ import { useScheduledDateLabel as je } from "./index23.js";
45
+ import { useScheduledPayment as Me } from "./index24.js";
46
+ import { useDraftDelete as Ne } from "./index25.js";
47
+ import { buildBillDetailView as Pe } from "./index27.js";
48
+ import { resolveEditorDismissal as Fe } from "./index28.js";
49
+ import { SourceDocumentContainer as Ie } from "./index32.js";
50
+ import { usePayableAchInstructions as Le } from "../../../../shared/counterpart-management/feature/dist/lib/usePayableAchInstructions.js";
35
51
  import "../../../../shared/counterpart-management/feature/dist/index.js";
36
- import { BILL_DETAILS_LABELS_EN as _ } from "./index43.js";
37
- import { useMemo as v, useRef as le, useState as ue } from "react";
38
- import { Fragment as y, jsx as b, jsxs as x } from "react/jsx-runtime";
52
+ import { useVendorSectionProps as Re } from "./index35.js";
53
+ import { usePayToSave as ze } from "./index36.js";
54
+ import { billDialogTestIds as i } from "./index43.js";
55
+ import { useCallback as a, useEffect as Be, useMemo as o, useRef as Ve, useState as s } from "react";
56
+ import { Fragment as He, jsx as c, jsxs as Ue } from "react/jsx-runtime";
57
+ import { Trash2Icon as We } from "lucide-react";
39
58
  // ../../libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index44.js
40
- function S({ open: S, onOpenChange: C, payableId: w, onClose: T, onExpand: E, onEdit: D, testId: O, labels: k, renderPaymentFlows: A }) {
41
- let j = v(() => ({
59
+ function l({ open: l, onOpenChange: u, payableId: d, initialCounterpartId: Ge, readOnly: f = !1, copy: p, onCollapse: m, onEdit: Ke, onOpenBill: h, renderPaymentFlows: qe }) {
60
+ let g = o(() => he(p), [p]), _ = p?.messages, v = o(() => ({
61
+ ...me,
62
+ ..._
63
+ }), [_]), Je = d ? void 0 : Ge, [Ye, Xe] = s(Je), [y, Ze] = s(!!Je), [Qe, $e] = s(!1), [b, x] = s(!1), [et, tt] = s(), S = a((e) => {
64
+ tt(() => e);
65
+ }, []), [nt, rt] = s(), C = d ?? nt, w = _e(C, {
66
+ pollWhileOcrProcessing: !0,
67
+ pollWhilePolicyAssignmentUnsettled: !0
68
+ }), T = ge(C), { initResponse: E } = te(), it = !!E, at = t(E?.scopes, [n.AccountingConfigReadOrg]), D = ee({ enabled: at }), O = w.data, k = !C || !!O, A = !f && k && !!C && O?.status !== "draft", ot = !f && !!O && !re(O?.status), j = f || ot, M = ye({
69
+ payable: O,
70
+ lineItems: T.lineItems,
71
+ labels: v
72
+ }), N = O?.counterpart_id ?? void 0;
73
+ Be(() => {
74
+ y || N && (Xe(N), Ze(!0));
75
+ }, [y, N]);
76
+ let st = a((e) => {
77
+ Ze(!0), Xe(e);
78
+ }, []), P = Me({
79
+ payableId: C,
80
+ scheduledPaymentDate: O?.scheduled_payment_date,
81
+ enabled: f || A
82
+ }), F = je({
83
+ hasScheduledPayment: P.hasScheduledPayment,
84
+ scheduledDate: P.scheduledDate,
85
+ labels: g.scheduledRelativeDay
86
+ }), I = Ce(E?.scopes), ct = t(E?.scopes, [n.PayableWriteOrg]), lt = t(E?.scopes, [n.CounterpartWriteOrg]) && ct, L = lt && se(O?.status) && !P.hasScheduledPayment && !P.isResolving, ut = L && I, dt = L || lt && O?.status === "rejected", ft = !f && k && (!C || O?.status === "draft") && !P.hasScheduledPayment && !P.isResolving, R = Re({
87
+ payableId: C,
88
+ counterpartId: f ? N : Ye,
89
+ payableCounterpartId: N,
90
+ isVendorKnown: f ? !!O : k,
91
+ onCounterpartChange: st,
92
+ requiredError: M.errors?.vendor,
93
+ payableCounterpartBankAccountId: O?.counterpart_bank_account_id ?? void 0,
94
+ extractedVendor: O?.counterpart_raw_data ?? void 0,
95
+ readOnly: f,
96
+ canEditVendor: !f || ut,
97
+ canEditPaymentInstructions: !f || L,
98
+ canAddPaymentInstructions: !f || dt,
99
+ confirmDiscard: S,
100
+ labels: p?.vendorSection
101
+ }), pt = R.activePayToOperation === "missingInstructions" ? ft || dt : R.activePayToOperation === "existingInstructions" ? ft || L : R.activePayToOperation === "vendor" && f ? ut : !1, mt = !!(C && y) && !Ye, z = w.refetch, ht = a(async () => {
102
+ let { data: e } = await z();
103
+ return e?.status ?? void 0;
104
+ }, [z]), { vendorWithInlineSave: B, isSavingPayToEdits: gt } = ze({
105
+ vendor: R,
106
+ payableId: C,
107
+ linkedCounterpartId: O?.counterpart_id,
108
+ linkedBankAccountId: O?.counterpart_bank_account_id,
109
+ canSavePayToEdits: pt,
110
+ readOnly: f,
111
+ refreshPayable: z,
112
+ labels: g.detail
113
+ }), _t = o(() => A ? {
42
114
  ..._,
43
- ...k,
44
- sheet: {
45
- ..._.sheet,
46
- ...k?.sheet,
47
- statusBadge: {
48
- ..._.sheet.statusBadge,
49
- ...k?.sheet?.statusBadge
50
- },
51
- approvalPolicy: {
52
- ..._.sheet.approvalPolicy,
53
- ...k?.sheet?.approvalPolicy
54
- },
55
- dueDate: {
56
- ..._.sheet.dueDate,
57
- ...k?.sheet?.dueDate
58
- },
59
- auditHistory: {
60
- ..._.sheet.auditHistory,
61
- ...k?.sheet?.auditHistory
62
- }
63
- },
64
- decisionDialog: r(_.decisionDialog, k?.decisionDialog),
65
- approvalPolicyCopy: {
66
- ..._.approvalPolicyCopy,
67
- ...k?.approvalPolicyCopy
68
- },
69
- history: {
70
- ..._.history,
71
- ...k?.history
72
- },
73
- scheduledRelativeDay: {
74
- ..._.scheduledRelativeDay,
75
- ...k?.scheduledRelativeDay
76
- },
77
- actionSuccess: {
78
- ..._.actionSuccess,
79
- ...k?.actionSuccess
80
- },
81
- paymentHistoryMethodLabels: i(k?.paymentHistoryMethodLabels)
82
- }), [k]), M = d(w), N = u(w), P = ee(), { initResponse: F } = te(), I = M.data, L = le(null), [R, z] = ue(!1), B = re({
83
- payableId: w,
84
- status: I?.status
85
- }), V = I?.status === "rejected", H = e(F?.scopes, [t.ApprovalRequestReadOrg]), de = V && H, U = e(F?.scopes, [t.UserReadOrg]), { userNames: W, isError: fe, isResolving: pe } = n({ enabled: U }), G = ne({
86
- payableId: w,
87
- payableStatus: I?.status,
88
- payableUpdatedAt: I?.updated_at,
89
- enabled: de,
90
- userNames: W,
91
- labels: j
92
- }), K = h({
93
- payableId: w,
94
- approvalPolicyId: I?.approval_policy_id,
95
- copy: j.approvalPolicyCopy
96
- }), me = p({
97
- status: I?.status,
98
- scopes: F?.scopes,
115
+ draftSaved: v.submittedSaved
116
+ } : _, [
117
+ A,
118
+ _,
119
+ v.submittedSaved
120
+ ]), V = ve({
121
+ payableId: d,
122
+ form: M,
123
+ labels: _t,
124
+ counterpartId: Ye,
125
+ isVendorPending: R.mode === "creating" || R.isPendingVendor,
126
+ onVendorIncomplete: R.revealIncompleteVendor,
127
+ clearCounterpart: mt,
128
+ prepareVendorForSave: R.prepareVendorForSave,
129
+ onPayableCreated: rt,
130
+ onSaved: rt,
131
+ onDraftSaved: () => u(!1),
132
+ onFinalized: () => u(!1),
133
+ readSavedStatus: A ? ht : void 0
134
+ }), vt = !!(V.isSavingDraft || V.isFinalizing || R.isVendorSavePending), H = f ? C : void 0, U = Oe({
135
+ payableId: H,
136
+ status: O?.status
137
+ }), W = Ve(null), [yt, bt] = s(!1), xt = ie(O), G = Le({
138
+ counterpartId: f ? N : void 0,
139
+ currency: O?.currency,
140
+ currentBankAccountId: f ? O?.counterpart_bank_account_id ?? void 0 : void 0,
141
+ enabled: I && f
142
+ }), K = we({
143
+ payableId: H,
144
+ approvalPolicyId: O?.approval_policy_id,
145
+ status: O?.status,
146
+ updatedAt: O?.updated_at,
147
+ payableFetchedAt: w.dataUpdatedAt,
148
+ enabled: f,
149
+ copy: g.approvalPolicyCopy
150
+ }), St = Se({
151
+ status: O?.status,
152
+ scopes: E?.scopes,
99
153
  arePendingApproversUnknown: K.isLoading,
100
- hasApprovalPolicy: !!I?.approval_policy_id,
101
- hasWaitingRequest: B.hasWaitingRequest
102
- }), q = g({
103
- isCapabilityUnknown: B.isLoading || K.isLoading,
104
- canApproveNow: !!B.id,
105
- canOverridePolicy: me,
106
- status: I?.status,
107
- hasApprovalPolicy: !!I?.approval_policy_id,
154
+ hasApprovalPolicy: !!O?.approval_policy_id,
155
+ hasWaitingRequest: U.hasWaitingRequest
156
+ }), Ct = Te({
157
+ isCapabilityUnknown: U.isLoading || K.isLoading,
158
+ canApproveNow: !!U.id,
159
+ canOverridePolicy: St,
160
+ status: O?.status,
161
+ hasApprovalPolicy: !!O?.approval_policy_id,
108
162
  pendingApproverNames: K.pendingApprovers.flatMap((e) => e.names),
109
- labels: j
110
- }), J = se({
111
- payableId: w,
112
- scheduledPaymentDate: I?.scheduled_payment_date
113
- }), Y = m(F?.scopes), X = ce({
114
- counterpartId: I?.counterpart_id,
115
- currency: I?.currency,
116
- currentBankAccountId: I?.counterpart_bank_account_id,
117
- enabled: Y
118
- }), { actions: he, decisionDialog: ge } = ae({
119
- payableId: I ? w : void 0,
120
- status: I?.status,
121
- currentApprovalRequestId: B.id,
122
- hasScheduledPayment: J.hasScheduledPayment,
123
- scheduledPaymentIntentId: J.scheduledPaymentIntentId,
124
- isScheduledPaymentUnknown: J.isResolving,
125
- isPayabilityUnknown: X.isLoading,
126
- hasApprovalPolicy: !!I?.approval_policy_id,
127
- hasWaitingRequest: B.hasWaitingRequest,
128
- pendingApprovers: K.pendingApprovers,
163
+ labels: g
164
+ }), wt = f || A ? C : void 0, Tt = f ? Ke : void 0, q = a((e) => {
165
+ let t = () => {
166
+ R.discardPayToEdits(), e?.();
167
+ };
168
+ R.hasUnsavedVendorChanges ? S(t) : t();
169
+ }, [S, R]), { actions: Et, decisionDialog: Dt, isActionPending: Ot } = Ae({
170
+ payableId: wt,
171
+ status: O?.status,
172
+ currentApprovalRequestId: U.id,
129
173
  arePendingApproversUnknown: K.isLoading,
130
- labels: {
131
- edit: j.sheet.editButton,
132
- payBill: j.sheet.payButton,
133
- markAsPaid: j.sheet.markAsPaidButton,
134
- reject: j.sheet.rejectButton,
135
- approve: j.sheet.approveButton,
136
- cancel: j.sheet.cancelButton,
137
- cancelScheduledPayment: j.sheet.cancelScheduledPaymentButton,
138
- reopen: j.sheet.reopenButton,
139
- forceApprove: j.sheet.forceApproveButton,
140
- forceReject: j.sheet.forceRejectButton,
141
- policyOverridesHeading: j.sheet.policyOverridesGroup,
142
- decisionDialog: j.decisionDialog,
143
- actionError: j.actionError,
144
- actionSuccess: j.actionSuccess
145
- },
146
- isMarkAsPaidPending: R,
147
- onMarkAsPaidSelect: () => L.current?.openMarkAsPaid(),
148
- onPayBillSelect: () => L.current?.openPayBill(),
149
- onEditSelect: D,
174
+ hasScheduledPayment: P.hasScheduledPayment,
175
+ scheduledPaymentIntentId: P.scheduledPaymentIntentId,
176
+ isScheduledPaymentUnknown: P.isResolving,
177
+ isPayabilityUnknown: G.isLoading,
178
+ hasApprovalPolicy: !!O?.approval_policy_id,
179
+ hasWaitingRequest: U.hasWaitingRequest,
180
+ pendingApprovers: K.pendingApprovers,
181
+ labels: g.actions,
182
+ isMarkAsPaidPending: yt,
183
+ onMarkAsPaidSelect: () => W.current?.openMarkAsPaid(),
184
+ onPayBillSelect: () => q(() => W.current?.openPayBill()),
185
+ onEditSelect: Tt,
150
186
  onActionSucceeded: (e) => {
151
- e === "reopen" && D?.();
187
+ e === "reopen" ? Tt?.() : A && u(!1);
152
188
  }
153
- }), Z = oe({
154
- hasScheduledPayment: J.hasScheduledPayment,
155
- scheduledDate: J.scheduledDate,
156
- labels: j.scheduledRelativeDay
157
- }), _e = Z ? j.scheduledSummary(Z.label) : void 0, Q = a(I) ? /* @__PURE__ */ b(l, { onOpenFullScreen: E }) : void 0, { historyQuery: $, rows: ve, namesError: ye } = ie({
158
- payableId: w,
159
- userNames: W,
160
- isRosterError: U && fe,
161
- labels: j.history
162
- }), be = v(() => f({
163
- records: J.paymentRecords,
164
- events: $.data?.data ?? [],
165
- currencyCode: I?.currency,
166
- labels: j
189
+ }), kt = Ne({
190
+ payableId: C,
191
+ status: O?.status,
192
+ enabled: !f,
193
+ labels: g.deleteDraft,
194
+ onDeleted: () => u(!1)
195
+ }), At = vt || Ot, jt = O?.ocr_status === "processing", Mt = w.isLoading || T.isResolving || jt, Nt = w.isLoading || T.isResolving || D.isResolving || G.isLoading, Pt = w.isError || T.isError || D.isError, Ft = o(() => [...kt.menuItems, ...A || f && !Nt && !Pt ? Et.menu.map((e) => ({
196
+ id: e.id,
197
+ label: e.label,
198
+ onSelect: e.onSelect,
199
+ disabled: e.disabled,
200
+ icon: e.icon,
201
+ sectionHeading: e.sectionHeading
202
+ })) : []], [
203
+ Et.menu,
204
+ kt.menuItems,
205
+ A,
206
+ f,
207
+ Nt,
208
+ Pt
209
+ ]), J = o(() => (D.data?.data ?? []).map((e) => ({
210
+ value: e.id,
211
+ label: ae(e)
212
+ })), [D.data]), { unavailableMessage: It, disabled: Lt, rosterAvailable: Rt } = oe({
213
+ isInitResolved: it,
214
+ canReadGlCodes: at,
215
+ isResolving: D.isResolving,
216
+ isError: D.isError,
217
+ optionCount: J.length,
218
+ labels: g.lineItemsGlCodeUnavailable
219
+ }), zt = O?.status === "rejected" || !f && A, Bt = t(E?.scopes, [n.ApprovalRequestReadOrg]), Vt = zt && Bt, Ht = t(E?.scopes, [n.UserReadOrg]), { userNames: Ut, isError: Wt, isResolving: Gt } = ne({ enabled: (f || zt) && Ht }), { historyQuery: Y, rows: Kt, namesError: qt } = ke({
220
+ payableId: H,
221
+ userNames: Ut,
222
+ isRosterError: Ht && Wt,
223
+ labels: g.history
224
+ }), X = De({
225
+ payableId: C,
226
+ payableStatus: O?.status,
227
+ payableUpdatedAt: O?.updated_at,
228
+ enabled: Vt,
229
+ userNames: Ut,
230
+ labels: g.detail
231
+ }), Jt = o(() => be({
232
+ records: P.paymentRecords,
233
+ events: Y.data?.data ?? [],
234
+ currencyCode: O?.currency,
235
+ labels: g.detail
167
236
  }), [
168
- J.paymentRecords,
169
- $.data,
170
- I?.currency,
171
- j
172
- ]), xe = v(() => I ? o({
173
- payable: I,
174
- lineItems: N.lineItems,
175
- ledgerAccounts: P.data?.data ?? [],
176
- labels: j,
177
- hasScheduledPayment: J.hasScheduledPayment,
178
- rejection: G,
179
- achInstructions: X.achInstructions,
180
- achInstructionsReadable: Y && !X.isLoading && !X.isError
181
- }) : void 0, [
237
+ P.paymentRecords,
238
+ Y.data,
239
+ O?.currency,
240
+ g.detail
241
+ ]), Yt = o(() => {
242
+ if (!f || !O) return;
243
+ let e = Pe({
244
+ payable: O,
245
+ lineItems: T.lineItems,
246
+ glCodeOptions: J,
247
+ glCodeRosterAvailable: Rt,
248
+ history: Kt,
249
+ paymentHistory: Jt,
250
+ approvalPolicy: K.view,
251
+ labels: g.detail,
252
+ hasScheduledPayment: P.hasScheduledPayment,
253
+ rejection: X,
254
+ payableAchInstructions: G.achInstructions,
255
+ payableAchInstructionsReadable: I && !G.isError
256
+ });
257
+ return R.mode === "resolved" && R.summary ? {
258
+ ...e,
259
+ payTo: R.summary
260
+ } : e;
261
+ }, [
262
+ P.hasScheduledPayment,
263
+ K.view,
182
264
  I,
183
- N.lineItems,
184
- P.data,
265
+ g.detail,
266
+ J,
267
+ Rt,
268
+ Kt,
269
+ T.lineItems,
270
+ O,
271
+ G.achInstructions,
272
+ G.isError,
273
+ Jt,
274
+ f,
275
+ X,
276
+ R.mode,
277
+ R.summary
278
+ ]), Xt = O?.source_of_payable_data === "ocr", Z = xt?.name, Zt = f ? Z ? g.viewTitle(Z) : g.readOnlyTitle : Z && (Xt || A) ? g.extractedTitle(Z) : g.newTitle, Qt = f && O?.created_at ? g.addedOn(e(O.created_at.slice(0, 10))) : void 0, Q = M.isDirty || R.hasUnsavedVendorChanges || !!V.stagedFile || V.isFileDeletionPending, $t = a(() => {
279
+ if (f && R.isEditingPayTo) q(() => u(!1));
280
+ else switch (Fe({
281
+ isUnsavedPromptOpen: b,
282
+ isLocked: j,
283
+ isDirty: Q
284
+ })) {
285
+ case "dismiss-prompt":
286
+ x(!1);
287
+ return;
288
+ case "prompt":
289
+ x(!0);
290
+ return;
291
+ default: u(!1);
292
+ }
293
+ }, [
294
+ Q,
185
295
  j,
186
- J.hasScheduledPayment,
187
- G,
188
- X.achInstructions,
189
- X.isError,
190
- X.isLoading,
191
- Y
192
- ]), Se = M.isLoading || N.isResolving || P.isResolving || X.isLoading, Ce = M.isError || N.isError || P.isError;
193
- return /* @__PURE__ */ x(y, { children: [
194
- /* @__PURE__ */ b(c, {
195
- open: S,
196
- onOpenChange: C,
197
- details: xe,
198
- actions: he,
199
- approvalPolicy: K.view,
200
- showApprovalOverrideNotice: q.showApprovalOverrideNotice,
201
- awaitingApprovalNotice: q.awaitingApprovalNotice,
202
- scheduledSummary: _e,
203
- scheduledSummaryDate: Z?.absoluteLabel,
204
- auditHistory: ve,
205
- auditHistoryError: $.isError,
206
- auditHistoryLoading: $.isLoading || pe,
207
- auditHistoryNamesError: ye,
208
- paymentHistory: be,
209
- paymentHistoryError: J.isError || $.isError,
210
- paymentHistoryLoading: J.isResolving || $.isLoading,
211
- isLoading: Se,
212
- isError: Ce,
213
- notice: Q,
214
- onClose: T,
215
- onExpand: E,
216
- testId: O,
217
- labels: j.sheet
296
+ b,
297
+ q,
298
+ u,
299
+ f,
300
+ R.isEditingPayTo
301
+ ]), en = a((e, t) => {
302
+ if (!h) return;
303
+ let n = () => h(e, t);
304
+ f && R.isEditingPayTo ? q(n) : !j && Q ? S(n) : n();
305
+ }, [
306
+ S,
307
+ Q,
308
+ j,
309
+ q,
310
+ h,
311
+ f,
312
+ R.isEditingPayTo
313
+ ]), tn = a(() => {
314
+ R.isEditingPayTo ? q(m) : m?.();
315
+ }, [
316
+ q,
317
+ m,
318
+ R.isEditingPayTo
319
+ ]), nn = a(() => {
320
+ x(!1), u(!1);
321
+ }, [u]), rn = Mt || R.mode === "creating", an = a(async () => {
322
+ if (rn) return;
323
+ let e = await V.saveDraft();
324
+ x(!1), e && u(!1);
325
+ }, [
326
+ V,
327
+ rn,
328
+ u
329
+ ]), $ = xe({
330
+ payable: O,
331
+ onOpenPayable: h ? en : void 0,
332
+ onRemoved: () => u(!1),
333
+ canManage: ct
334
+ }), on = a((e) => {
335
+ if (!(At || $.isBusy)) return e ? u(!0) : $t();
336
+ }, [
337
+ $.isBusy,
338
+ At,
339
+ $t,
340
+ u
341
+ ]), sn = $.isPossibleDuplicate, cn = !f && Xt && !Qe, ln = !f && !!X, un = ln || sn || cn ? /* @__PURE__ */ Ue(He, { children: [
342
+ ln && X ? /* @__PURE__ */ c(ue, {
343
+ ...X,
344
+ labels: g.rejectedBanner
345
+ }) : null,
346
+ sn ? /* @__PURE__ */ c(le, {
347
+ title: $.title,
348
+ meta: $.meta,
349
+ onNotADuplicate: $.onNotADuplicate,
350
+ onRemoveBill: $.onRemoveBill,
351
+ isActionDisabled: $.isBusy,
352
+ rows: $.rows,
353
+ isLoading: $.isLoadingRows,
354
+ loadingRowCount: $.loadingRowCount,
355
+ collapse: $.collapse,
356
+ labels: $.removeBillLabel ? { removeBillButton: $.removeBillLabel } : void 0,
357
+ testId: i.duplicateNotice
358
+ }) : null,
359
+ cn ? /* @__PURE__ */ c(fe, {
360
+ onDismiss: () => $e(!0),
361
+ labels: p?.extractionNotice
362
+ }) : null
363
+ ] }) : void 0;
364
+ return /* @__PURE__ */ Ue(He, { children: [
365
+ /* @__PURE__ */ c(ce, {
366
+ open: l,
367
+ onOpenChange: on,
368
+ title: Zt,
369
+ subtitle: Qt,
370
+ notice: un,
371
+ vendor: {
372
+ ...B,
373
+ testId: i.vendorSection
374
+ },
375
+ values: M.values,
376
+ errors: M.errors,
377
+ onChange: M.onChange,
378
+ lineItems: {
379
+ items: M.lineItemRows,
380
+ glCodeOptions: J,
381
+ glCodeDisabled: Lt,
382
+ glCodeUnavailableMessage: It,
383
+ discount: M.discount,
384
+ onDiscountChange: M.onDiscountChange,
385
+ onDiscountBlur: M.onDiscountBlur,
386
+ tax: M.tax,
387
+ onTaxChange: M.onTaxChange,
388
+ onTaxBlur: M.onTaxBlur,
389
+ total: M.total,
390
+ onTotalChange: M.onTotalChange,
391
+ onTotalBlur: M.onTotalBlur,
392
+ onAddLineItem: M.onAddLineItem,
393
+ errors: M.lineItemErrors,
394
+ totalsErrors: M.totalsErrors,
395
+ testId: i.lineItems
396
+ },
397
+ documentPanel: /* @__PURE__ */ c(Ie, {
398
+ payableId: C,
399
+ readOnly: j,
400
+ isDocumentPending: !!C && !O?.file && (w.isLoading || O?.ocr_status === "processing"),
401
+ file: O?.file ? {
402
+ id: O.file.id,
403
+ name: O.file.name,
404
+ url: O.file.url,
405
+ mimetype: O.file.mimetype
406
+ } : void 0,
407
+ staging: {
408
+ stagedFile: V.stagedFile,
409
+ onFileStaged: V.stageFile,
410
+ onClearStagedFile: V.clearStagedFile,
411
+ isSaving: vt
412
+ },
413
+ deletion: {
414
+ isPending: V.isFileDeletionPending,
415
+ onRequest: V.requestFileDeletion,
416
+ onDetachNow: V.detachFileNow,
417
+ isDeleting: V.isDeletingFile,
418
+ hasFailed: V.hasFileDeletionFailed
419
+ },
420
+ labels: p?.sourceDocument
421
+ }),
422
+ menuItems: Ft,
423
+ readOnly: j,
424
+ detail: f ? {
425
+ view: Yt,
426
+ actions: Et,
427
+ scheduledSummary: F ? g.scheduledSummary(F.label) : void 0,
428
+ scheduledSummaryDate: F?.absoluteLabel,
429
+ scheduledStatusLabel: F ? g.scheduledStatusBadge(F.label) : void 0,
430
+ ...Ct,
431
+ payTo: {
432
+ onEdit: B.mode === "resolved" ? B.onEdit : void 0,
433
+ paymentInstructions: O?.status === "paid" || O?.status === "canceled" ? void 0 : Ee(B.paymentInstructionsEditor, !!Yt?.payTo.hasPaymentInstructions),
434
+ detailsWarning: B.detailsWarning,
435
+ editForm: B.mode === "creating" ? B.newVendorForm : void 0
436
+ },
437
+ isLoading: Nt,
438
+ isError: Pt,
439
+ paymentHistoryError: P.isError || Y.isError,
440
+ paymentHistoryLoading: P.isResolving || Y.isLoading,
441
+ historyError: Y.isError,
442
+ historyLoading: Y.isLoading || Gt,
443
+ historyNamesError: qt
444
+ } : void 0,
445
+ isLineItemsLoading: Mt,
446
+ isSaving: At || gt,
447
+ isSavingDraft: V.isSavingDraft,
448
+ isSubmitting: V.isFinalizing,
449
+ onCancel: $t,
450
+ onCollapse: f ? tn : void 0,
451
+ onSaveDraft: V.saveDraft,
452
+ onFinalize: V.finalize,
453
+ scrollToErrorToken: V.scrollToErrorToken,
454
+ showSubmit: !j && k,
455
+ testId: i.dialog,
456
+ labels: p?.screen
457
+ }),
458
+ /* @__PURE__ */ c(pe, {
459
+ open: b,
460
+ onSaveDraft: an,
461
+ onDiscard: nn,
462
+ onCancel: () => x(!1),
463
+ isSaving: V.isSavingDraft,
464
+ isSaveDraftDisabled: rn,
465
+ labels: g.unsavedChanges,
466
+ testId: i.unsavedDialog,
467
+ saveDraftTestId: i.unsavedSaveDraft,
468
+ discardTestId: i.unsavedDiscard,
469
+ closeTestId: i.unsavedClose
470
+ }),
471
+ /* @__PURE__ */ c(de, {
472
+ open: !!et,
473
+ onDiscard: () => {
474
+ let e = et;
475
+ tt(void 0), e?.();
476
+ },
477
+ onKeepEditing: () => tt(void 0),
478
+ labels: g.discardChanges,
479
+ testId: i.discardDialog,
480
+ discardTestId: i.discardConfirm
481
+ }),
482
+ /* @__PURE__ */ c(r, {
483
+ ...Dt,
484
+ labels: { cancelButton: g.actions.decisionDialog.cancelButton },
485
+ testId: i.decisionDialog,
486
+ confirmTestId: i.decisionConfirm,
487
+ reasonTestId: i.decisionReason
488
+ }),
489
+ /* @__PURE__ */ c(r, {
490
+ ...kt.dialog,
491
+ labels: { cancelButton: g.actions.decisionDialog.cancelButton },
492
+ testId: i.deleteDraftDialog,
493
+ confirmTestId: i.deleteDraftConfirm
494
+ }),
495
+ /* @__PURE__ */ c(r, {
496
+ open: $.removeConfirmation.open,
497
+ copy: $.removeConfirmation.copy,
498
+ onConfirm: $.removeConfirmation.onConfirm,
499
+ onCancel: $.removeConfirmation.onCancel,
500
+ isPending: $.removeConfirmation.isPending,
501
+ confirmIcon: $.isRemoveBillDestructive ? /* @__PURE__ */ c(We, {}) : void 0,
502
+ labels: { cancelButton: $.removeConfirmation.cancelButtonLabel },
503
+ testId: i.duplicateRemoveDialog,
504
+ confirmTestId: i.duplicateRemoveConfirm
218
505
  }),
219
- /* @__PURE__ */ b(s, {
220
- ...ge,
221
- labels: { cancelButton: j.decisionDialog.cancelButton },
222
- testId: O ? `${O}-decision-dialog` : void 0,
223
- confirmTestId: O ? `${O}-decision-confirm` : void 0,
224
- reasonTestId: O ? `${O}-decision-reason` : void 0,
225
- reasonFieldId: O ? `${O}-decision-reason-field` : void 0
506
+ /* @__PURE__ */ c(r, {
507
+ open: $.keepRowConfirmation.open,
508
+ copy: $.keepRowConfirmation.copy,
509
+ onConfirm: $.keepRowConfirmation.onConfirm,
510
+ onCancel: $.keepRowConfirmation.onCancel,
511
+ isPending: $.keepRowConfirmation.isPending,
512
+ labels: { cancelButton: $.keepRowConfirmation.cancelButtonLabel }
226
513
  }),
227
- A?.({
228
- ref: L,
229
- payable: I,
230
- payableId: w,
231
- isPayBillEnabled: !0,
232
- hasScheduledPayment: J.hasScheduledPayment,
233
- onMissingAchInstructions: E,
234
- onMarkAsPaidPendingChange: z,
235
- testId: O
514
+ qe?.({
515
+ ref: W,
516
+ payable: O,
517
+ payableId: H,
518
+ isPayBillEnabled: f,
519
+ hasScheduledPayment: P.hasScheduledPayment,
520
+ onMissingAchInstructions: lt ? R.openPaymentInstructions : void 0,
521
+ onMarkAsPaidPendingChange: bt
236
522
  })
237
523
  ] });
238
524
  }
239
- export { S as BillDetailsContainer, S as default };
525
+ export { l as BillDialog, l as default };