@tesouro/embedded-components-react 0.9.22 → 0.9.25

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