@tesouro/embedded-components-react 0.5.168 → 0.5.170

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