@tesouro/embedded-components-react 0.3.48 → 0.3.50

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 (134) hide show
  1. package/dist/index.css +8 -2
  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 -10
  5. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index10.js +39 -30
  6. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index11.js +26 -311
  7. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index12.js +325 -12
  8. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index13.js +13 -26
  9. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index14.js +20 -40
  10. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index15.js +75 -24
  11. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index16.js +36 -0
  12. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index5.js +80 -68
  13. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index6.js +86 -73
  14. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index7.js +77 -14
  15. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index8.js +18 -63
  16. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index9.js +50 -29
  17. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index.js +22 -18
  18. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index10.js +82 -30
  19. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index11.js +7 -42
  20. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index12.js +15 -159
  21. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index13.js +23 -33
  22. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index14.js +66 -1
  23. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index15.js +2 -50
  24. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index16.js +3 -4
  25. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index17.js +5 -14
  26. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index18.js +3 -14
  27. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index19.js +31 -63
  28. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index2.js +23 -18
  29. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index20.js +37 -24
  30. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index21.js +161 -61
  31. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index22.js +29 -130
  32. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index23.js +1 -25
  33. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index24.js +47 -4
  34. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index25.js +4 -41
  35. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index26.js +12 -55
  36. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index27.js +13 -4
  37. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index28.js +63 -72
  38. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index29.js +26 -49
  39. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index3.js +23 -23
  40. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index30.js +62 -93
  41. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index31.js +133 -34
  42. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index32.js +20 -163
  43. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index33.js +4 -77
  44. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index34.js +39 -21
  45. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index35.js +5 -210
  46. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index36.js +70 -211
  47. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index37.js +47 -103
  48. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index38.js +92 -12
  49. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index39.js +34 -47
  50. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index4.js +59 -62
  51. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index40.js +163 -29
  52. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index41.js +67 -181
  53. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index42.js +20 -32
  54. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index43.js +203 -94
  55. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index44.js +214 -15
  56. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index45.js +98 -312
  57. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index46.js +16 -4
  58. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index47.js +49 -31
  59. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index48.js +29 -80
  60. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index49.js +183 -156
  61. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index5.js +9 -2
  62. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index50.js +38 -3
  63. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index51.js +102 -2
  64. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index52.js +18 -44
  65. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index53.js +343 -1
  66. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index54.js +4 -8
  67. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index55.js +30 -8
  68. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index56.js +79 -88
  69. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index57.js +179 -3
  70. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index58.js +3 -9
  71. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index59.js +2 -20
  72. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index6.js +4 -2
  73. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index60.js +38 -51
  74. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index61.js +0 -2
  75. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index62.js +6 -126
  76. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index63.js +9 -9
  77. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index64.js +92 -44
  78. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index65.js +3 -23
  79. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index66.js +123 -26
  80. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index67.js +7 -82
  81. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index68.js +8 -48
  82. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index69.js +45 -250
  83. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index7.js +69 -5
  84. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index70.js +21 -113
  85. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index71.js +27 -208
  86. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index72.js +86 -4
  87. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index73.js +47 -5
  88. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index74.js +244 -106
  89. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index75.js +115 -1
  90. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index76.js +201 -16
  91. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index77.js +4 -0
  92. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index78.js +8 -0
  93. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index79.js +115 -0
  94. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index8.js +44 -5
  95. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index80.js +1 -0
  96. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index81.js +25 -0
  97. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index9.js +94 -3
  98. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index.js +19 -19
  99. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index18.js +1 -0
  100. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index50.js +28 -28
  101. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index59.js +1 -3
  102. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index60.js +6 -16
  103. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index73.js +119 -16
  104. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index74.js +24 -111
  105. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index75.js +89 -2
  106. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index76.js +2 -7
  107. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index77.js +5 -28
  108. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index78.js +30 -2
  109. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index79.js +2 -7
  110. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index80.js +5 -32
  111. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index81.js +34 -2
  112. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index82.js +2 -12
  113. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index83.js +10 -104
  114. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index84.js +105 -1
  115. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index85.js +2 -17
  116. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index86.js +15 -123
  117. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index87.js +125 -2
  118. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index88.js +2 -18
  119. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index89.js +14 -6
  120. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index90.js +7 -167
  121. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index91.js +170 -2
  122. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index92.js +2 -14
  123. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index93.js +11 -105
  124. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index94.js +108 -2
  125. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index95.js +2 -10
  126. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index96.js +8 -45
  127. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index97.js +47 -2
  128. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index98.js +2 -0
  129. package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/index8.js +144 -130
  130. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +23 -23
  131. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/sdk.gen.js +87 -71
  132. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  133. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index8.js +1 -1
  134. package/package.json +1 -1
@@ -1 +1,343 @@
1
- import "./index52.js";
1
+ "use client";
2
+ "use client";
3
+ "use client";
4
+ "use client";
5
+ import { hasAnyScope as e } from "../../../shared/data-access/dist/lib/hasAnyScope.js";
6
+ import { Scope as t } from "../../../shared/data-access/dist/lib/scopes.js";
7
+ import { useAllLedgerAccountsQuery as ee } from "../../../shared/data-access/dist/lib/reference-data/useLedgerAccountsQuery.js";
8
+ import { useAllOrganizationUsersQuery as te } from "../../../shared/data-access/dist/lib/user/useAllOrganizationUsersQuery.js";
9
+ import "../../../shared/data-access/dist/index.js";
10
+ import { formatCalendarDate as ne } from "../../../shared/util/dist/lib/formatCalendarDate.js";
11
+ import { useWidgetConfig as re } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
12
+ import "../../../shared/feature/dist/index.js";
13
+ import { usePayableHistoryQuery as ie } from "../../data-access/dist/index8.js";
14
+ import { useAllPayableLineItemsQuery as ae } from "../../data-access/dist/index9.js";
15
+ import { usePayableQuery as oe } from "../../data-access/dist/index15.js";
16
+ import "../../data-access/dist/index.js";
17
+ import { resolveVendor as se } from "./index5.js";
18
+ import { BillCreateScreen as ce } from "../../ui/dist/index44.js";
19
+ import { BillDecisionDialog as n } from "../../ui/dist/index50.js";
20
+ import { BillDuplicateNotice as le } from "../../ui/dist/index60.js";
21
+ import { ExtractionNotice as ue } from "../../ui/dist/index78.js";
22
+ import { MarkAsPaidDialog as de } from "../../ui/dist/index87.js";
23
+ import { UnsavedBillDialog as fe } from "../../ui/dist/index97.js";
24
+ import "../../ui/dist/index.js";
25
+ import { usePayableDuplicateReview as pe } from "./index10.js";
26
+ import "./index11.js";
27
+ import { resolveAmountDueMinorUnits as me } from "./index16.js";
28
+ import { PayBillFlow as he } from "./index22.js";
29
+ import "./index23.js";
30
+ import { useMarkAsPaidFlow as ge } from "./index14.js";
31
+ import "./index15.js";
32
+ import { BILL_CREATE_MESSAGE_LABELS_EN as _e, mergeBillCreateScreenCopy as ve } from "./index40.js";
33
+ import { useBillCreateController as ye } from "./index49.js";
34
+ import { useBillForm as be } from "./index51.js";
35
+ import { useApprovalPolicyCardView as xe } from "./index28.js";
36
+ import { useCurrentApprovalRequestId as Se } from "./index29.js";
37
+ import { usePayableDetailActions as Ce } from "./index31.js";
38
+ import { useScheduledPayment as we } from "./index32.js";
39
+ import { isEditablePayableStatus as Te } from "./index33.js";
40
+ import { useDraftDelete as Ee } from "./index34.js";
41
+ import { buildBillDetailView as De } from "./index36.js";
42
+ import { buildBillHistory as Oe } from "./index37.js";
43
+ import { SourceDocumentContainer as ke } from "./index41.js";
44
+ import { useVendorSectionProps as Ae } from "./index44.js";
45
+ import { usePaymentInstructionsForm as je } from "./index45.js";
46
+ import { billCreateTestIds as r } from "./index52.js";
47
+ import { useCallback as i, useEffect as Me, useMemo as a, useRef as Ne, useState as o } from "react";
48
+ import { Fragment as Pe, jsx as s, jsxs as Fe } from "react/jsx-runtime";
49
+ import { Trash2Icon as Ie } from "lucide-react";
50
+ //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index53.js
51
+ function Le(e) {
52
+ return !!(e?.bank_account?.account_holder_name && e.bank_account.routing_number && e.bank_account.account_number);
53
+ }
54
+ function c({ open: c, onOpenChange: l, payableId: u, readOnly: d = !1, copy: f, onCollapse: Re, poweredByBankName: ze }) {
55
+ let p = a(() => ve(f), [f]), [m, h] = o(), [g, _] = o(!1), [Be, Ve] = o(!1), [He, v] = o(!1), [Ue, y] = o(), b = u ?? Ue, x = oe(b, { pollWhileOcrProcessing: !0 }), S = ae(b), { initResponse: C } = re(), w = !!C, T = e(C?.scopes, [t.AccountingConfigReadOrg]), E = ee({ enabled: T }), D = x.data, O = !b || !!D, k = !d && O && !!b && D?.status !== "draft", We = !d && !!D && !Te(D?.status), A = d || We, j = be({
56
+ payable: D,
57
+ lineItems: S.lineItems
58
+ }), M = D?.counterpart_id;
59
+ Me(() => {
60
+ g || M && (h(M), _(!0));
61
+ }, [g, M]);
62
+ let Ge = i((e) => {
63
+ _(!0), h(e);
64
+ }, []), N = Ae({
65
+ payableId: d ? void 0 : b,
66
+ counterpartId: d ? void 0 : m,
67
+ payableCounterpartId: M,
68
+ onCounterpartChange: Ge,
69
+ requiredError: j.errors?.vendor,
70
+ payableCounterpartBankAccountId: D?.counterpart_bank_account_id ?? void 0,
71
+ extractedVendor: D?.counterpart_raw_data ?? void 0
72
+ }), Ke = !!(b && g) && !m, qe = a(() => k ? { saveDraftButton: p.submittedSaveButton } : void 0, [p.submittedSaveButton, k]), Je = a(() => k ? { draftSaved: _e.submittedSaved } : void 0, [k]), P = x.refetch, Ye = i(async () => {
73
+ let { data: e } = await P();
74
+ return e?.status ?? void 0;
75
+ }, [P]), F = ye({
76
+ payableId: u,
77
+ form: j,
78
+ labels: Je,
79
+ counterpartId: m,
80
+ clearCounterpart: Ke,
81
+ prepareVendorForSave: N.savePaymentInstructions,
82
+ onPayableCreated: y,
83
+ onSaved: y,
84
+ onDraftSaved: () => l(!1),
85
+ onFinalized: () => l(!1),
86
+ readSavedStatus: k ? Ye : void 0
87
+ }), I = !!(F.isSavingDraft || F.isFinalizing), L = d ? b : void 0, R = Se({
88
+ payableId: L,
89
+ status: D?.status
90
+ }), Xe = Ne(null), z = we({
91
+ payableId: b,
92
+ scheduledPaymentDate: D?.scheduled_payment_date,
93
+ enabled: d || k
94
+ }), Ze = se(D), B = je({
95
+ payableId: L,
96
+ counterpartId: d ? M : void 0,
97
+ saveErrorMessage: p.detail.paymentInstructionsSaveError,
98
+ linkErrorMessage: p.detail.paymentInstructionsLinkError
99
+ }), Qe = e(C?.scopes, [t.PayableWriteOrg]), $e = e(C?.scopes, [t.CounterpartWriteOrg]) && Qe, V = ge({
100
+ payableId: L,
101
+ amountDueMinorUnits: me(D) ?? 0,
102
+ amountToPayMinorUnits: D?.amount_to_pay ?? void 0,
103
+ currencyCode: D?.currency ?? void 0,
104
+ dueDate: D?.due_date,
105
+ hasScheduledPayment: z.hasScheduledPayment,
106
+ labels: p.markAsPaid
107
+ }), H = xe({
108
+ payableId: L,
109
+ approvalPolicyId: D?.approval_policy_id,
110
+ enabled: d,
111
+ copy: p.approvalPolicyCopy
112
+ }), { actions: U, decisionDialog: et, isActionPending: tt } = Ce({
113
+ payableId: d || k ? b : void 0,
114
+ status: D?.status,
115
+ currentApprovalRequestId: R.id,
116
+ isPolicyApprover: R.isPolicyApprover,
117
+ hasWaitingRequest: R.hasWaitingRequest,
118
+ arePendingApproversUnknown: H.isLoading,
119
+ hasScheduledPayment: z.hasScheduledPayment,
120
+ scheduledPaymentIntentId: z.scheduledPaymentIntentId,
121
+ isScheduledPaymentUnknown: z.isResolving,
122
+ pendingApprovers: H.pendingApprovers,
123
+ labels: p.actions,
124
+ isMarkAsPaidPending: V.isPending,
125
+ onMarkAsPaidSelect: V.open,
126
+ onPayBillSelect: () => Le(Ze) || !$e ? Xe.current?.open() : B.open(),
127
+ onActionSucceeded: k ? () => l(!1) : void 0
128
+ }), W = Ee({
129
+ payableId: b,
130
+ status: D?.status,
131
+ enabled: !d,
132
+ labels: p.deleteDraft,
133
+ onDeleted: () => l(!1)
134
+ }), G = I || tt, nt = a(() => [...W.menuItems, ...k ? U.menu.map((e) => ({
135
+ id: e.id,
136
+ label: e.label,
137
+ onSelect: e.onSelect,
138
+ disabled: e.disabled
139
+ })) : []], [
140
+ U.menu,
141
+ W.menuItems,
142
+ k
143
+ ]), K = a(() => (E.data?.data ?? []).map((e) => ({
144
+ value: e.id,
145
+ label: [e.nominal_code, e.name].filter(Boolean).join(" — ")
146
+ })), [E.data]), q;
147
+ w && (T ? E.isError ? q = p.lineItemsGlCodeUnavailable.loadError : !E.isResolving && K.length === 0 && (q = p.lineItemsGlCodeUnavailable.empty) : q = p.lineItemsGlCodeUnavailable.noAccess);
148
+ let rt = !w || !!q || E.isResolving, it = T && !E.isResolving && !E.isError, at = ie(L), ot = e(C?.scopes, [t.UserReadOrg]), J = te({ enabled: d && ot }), st = a(() => Oe(at.data?.data ?? [], J.data?.data ?? [], p.history), [
149
+ at.data,
150
+ J.data,
151
+ p.history
152
+ ]), ct = a(() => d && D ? De({
153
+ payable: D,
154
+ lineItems: S.lineItems,
155
+ glCodeOptions: K,
156
+ glCodeRosterAvailable: it,
157
+ history: st,
158
+ approvalPolicy: H.view,
159
+ labels: p.detail,
160
+ hasScheduledPayment: z.hasScheduledPayment
161
+ }) : void 0, [
162
+ z.hasScheduledPayment,
163
+ H.view,
164
+ p.detail,
165
+ K,
166
+ it,
167
+ st,
168
+ S.lineItems,
169
+ D,
170
+ d
171
+ ]), lt = D?.source_of_payable_data === "ocr", Y = Ze?.name, ut = d ? Y ? p.viewTitle(Y) : p.readOnlyTitle : Y && (lt || k) ? p.extractedTitle(Y) : p.newTitle, dt = d && D?.created_at ? p.addedOn(ne(D.created_at.slice(0, 10))) : void 0, X = i(() => {
172
+ let e = j.isDirty || N.hasUnsavedVendorChanges || !!F.stagedFile || F.isFileDeletionPending;
173
+ if (!A && e) {
174
+ v(!0);
175
+ return;
176
+ }
177
+ l(!1);
178
+ }, [
179
+ F.isFileDeletionPending,
180
+ F.stagedFile,
181
+ j.isDirty,
182
+ A,
183
+ l,
184
+ N.hasUnsavedVendorChanges
185
+ ]), ft = i(() => {
186
+ v(!1), l(!1);
187
+ }, [l]), Z = S.isResolving || N.mode === "creating", pt = i(async () => {
188
+ if (Z) return;
189
+ let e = await F.saveDraft();
190
+ v(!1), e && l(!1);
191
+ }, [
192
+ F,
193
+ Z,
194
+ l
195
+ ]), Q = pe({
196
+ payable: D,
197
+ onRemoved: () => l(!1),
198
+ canManage: Qe
199
+ }), mt = i((e) => {
200
+ if (!(G || Q.isBusy)) return e ? l(!0) : X();
201
+ }, [
202
+ Q.isBusy,
203
+ G,
204
+ X,
205
+ l
206
+ ]), ht = Q.isPossibleDuplicate, $ = !d && lt && !Be, gt = ht || $ ? /* @__PURE__ */ Fe(Pe, { children: [ht ? /* @__PURE__ */ s(le, {
207
+ onNotADuplicate: Q.onNotADuplicate,
208
+ onRemoveBill: Q.onRemoveBill,
209
+ isActionDisabled: Q.isBusy,
210
+ labels: Q.removeBillLabel ? { removeBillButton: Q.removeBillLabel } : void 0,
211
+ testId: r.duplicateNotice
212
+ }) : null, $ ? /* @__PURE__ */ s(ue, { onDismiss: () => Ve(!0) }) : null] }) : void 0;
213
+ return /* @__PURE__ */ Fe(Pe, { children: [
214
+ /* @__PURE__ */ s(ce, {
215
+ open: c,
216
+ onOpenChange: mt,
217
+ title: ut,
218
+ subtitle: dt,
219
+ notice: gt,
220
+ vendor: {
221
+ ...N,
222
+ testId: r.vendorSection
223
+ },
224
+ values: j.values,
225
+ errors: j.errors,
226
+ onChange: j.onChange,
227
+ lineItems: {
228
+ items: j.lineItemRows,
229
+ glCodeOptions: K,
230
+ glCodeDisabled: rt,
231
+ glCodeUnavailableMessage: q,
232
+ discount: j.discount,
233
+ onDiscountChange: j.onDiscountChange,
234
+ tax: j.tax,
235
+ onTaxChange: j.onTaxChange,
236
+ total: j.total,
237
+ onTotalChange: j.onTotalChange,
238
+ onAddLineItem: j.onAddLineItem,
239
+ errors: j.lineItemErrors,
240
+ testId: r.lineItems
241
+ },
242
+ documentPanel: /* @__PURE__ */ s(ke, {
243
+ payableId: b,
244
+ readOnly: A,
245
+ isDocumentPending: !!b && !D?.file && (x.isLoading || D?.ocr_status === "processing"),
246
+ file: D?.file ? {
247
+ id: D.file.id,
248
+ name: D.file.name,
249
+ url: D.file.url,
250
+ mimetype: D.file.mimetype
251
+ } : void 0,
252
+ staging: {
253
+ stagedFile: F.stagedFile,
254
+ onFileStaged: F.stageFile,
255
+ onClearStagedFile: F.clearStagedFile,
256
+ isSaving: I
257
+ },
258
+ deletion: {
259
+ isPending: F.isFileDeletionPending,
260
+ onRequest: F.requestFileDeletion,
261
+ onDetachNow: F.detachFileNow,
262
+ isDeleting: F.isDeletingFile,
263
+ hasFailed: F.hasFileDeletionFailed
264
+ }
265
+ }),
266
+ menuItems: nt,
267
+ readOnly: A,
268
+ detail: d ? {
269
+ view: ct,
270
+ actions: U,
271
+ scheduledSummary: z.hasScheduledPayment && z.scheduledDateLabel ? p.scheduledSummary(z.scheduledDateLabel) : void 0,
272
+ paymentInstructionsForm: M && $e ? {
273
+ isOpen: B.isOpen,
274
+ values: B.values,
275
+ errors: B.errors,
276
+ isSaving: B.isSaving,
277
+ onOpen: B.open,
278
+ onCancel: B.close,
279
+ onChange: B.onChange,
280
+ onSave: B.save
281
+ } : void 0,
282
+ isLoading: x.isLoading || S.isResolving || E.isResolving,
283
+ isError: x.isError || S.isError || E.isError
284
+ } : void 0,
285
+ isLineItemsLoading: S.isResolving,
286
+ isSaving: G,
287
+ isSavingDraft: F.isSavingDraft,
288
+ isFinalizing: F.isFinalizing,
289
+ onCancel: X,
290
+ onCollapse: d ? Re : void 0,
291
+ onSaveDraft: F.saveDraft,
292
+ onFinalize: F.finalize,
293
+ showFinalize: !k && O,
294
+ labels: qe,
295
+ testId: r.dialog
296
+ }),
297
+ /* @__PURE__ */ s(fe, {
298
+ open: He,
299
+ onSaveDraft: pt,
300
+ onDiscard: ft,
301
+ onCancel: () => v(!1),
302
+ isSaving: F.isSavingDraft,
303
+ isSaveDraftDisabled: Z,
304
+ labels: p.unsavedChanges,
305
+ testId: r.unsavedDialog,
306
+ saveDraftTestId: r.unsavedSaveDraft,
307
+ discardTestId: r.unsavedDiscard
308
+ }),
309
+ /* @__PURE__ */ s(n, {
310
+ ...et,
311
+ labels: { cancelButton: p.actions.decisionDialog.cancelButton },
312
+ testId: r.decisionDialog,
313
+ confirmTestId: r.decisionConfirm,
314
+ reasonTestId: r.decisionReason
315
+ }),
316
+ /* @__PURE__ */ s(n, {
317
+ ...W.dialog,
318
+ labels: { cancelButton: p.actions.decisionDialog.cancelButton },
319
+ testId: r.deleteDraftDialog,
320
+ confirmTestId: r.deleteDraftConfirm
321
+ }),
322
+ /* @__PURE__ */ s(n, {
323
+ open: Q.removeConfirmation.open,
324
+ copy: Q.removeConfirmation.copy,
325
+ onConfirm: Q.removeConfirmation.onConfirm,
326
+ onCancel: Q.removeConfirmation.onCancel,
327
+ isPending: Q.removeConfirmation.isPending,
328
+ confirmIcon: /* @__PURE__ */ s(Ie, {}),
329
+ labels: { cancelButton: Q.removeConfirmation.cancelButtonLabel },
330
+ testId: r.duplicateRemoveDialog,
331
+ confirmTestId: r.duplicateRemoveConfirm
332
+ }),
333
+ /* @__PURE__ */ s(de, { ...V.dialogProps }),
334
+ d && D ? /* @__PURE__ */ s(he, {
335
+ ref: Xe,
336
+ payable: D,
337
+ poweredByBankName: ze,
338
+ labels: p.payBill
339
+ }) : null
340
+ ] });
341
+ }
342
+ //#endregion
343
+ export { c as BillCreateDialog, c as default };
@@ -1,8 +1,4 @@
1
- //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index54.js
2
- var e = (e) => [
3
- "bill-pay",
4
- "upload-queue",
5
- e ?? ""
6
- ];
7
- //#endregion
8
- export { e as billPayUploadQueueKey };
1
+ import "./index40.js";
2
+ import "./index49.js";
3
+ import "./index51.js";
4
+ import "./index53.js";
@@ -1,11 +1,33 @@
1
+ import { BILL_DETAILS_SHEET_LABELS_EN as e } from "../../ui/dist/index55.js";
2
+ import "../../ui/dist/index.js";
3
+ import { MARK_AS_PAID_FLOW_LABELS_EN as t } from "./index12.js";
4
+ import "./index15.js";
5
+ import { APPROVAL_POLICY_RULE_COPY_EN as n } from "./index24.js";
6
+ import { BILL_DETAIL_ACTIONS_LABELS_EN as r, SCHEDULED_SUMMARY_LABEL_EN as i } from "./index38.js";
1
7
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index55.js
2
- var e = {
3
- uploadingSummary: (e) => `Uploading and scanning ${e} ${e === 1 ? "file" : "files"}`,
4
- completeSummary: (e) => `${e} ${e === 1 ? "upload" : "uploads"} complete`,
5
- readyCaption: (e) => `${e} new ${e === 1 ? "bill" : "bills"} ready`,
6
- failedCaption: (e) => `${e} failed to upload`,
7
- tooManyFilesError: (e) => `You can only upload up to ${e} files at a time`,
8
- remainingCapacityError: (e) => e === 0 ? "Wait for the current uploads to finish before adding more files" : `You can upload ${e} more ${e === 1 ? "file" : "files"} right now`
8
+ var a = {
9
+ subtitle: "Accounts payable",
10
+ vendorRow: "Vendor",
11
+ bankAccountRow: "ACH bank account",
12
+ bankAccountValue: (e) => `Account ending in ${e}`,
13
+ invoiceNumberRow: "Number",
14
+ issueDateRow: "Issue date",
15
+ dueDateRow: "Due date",
16
+ poNumberRow: "PO number",
17
+ notProvided: "Not provided",
18
+ glCodeMissing: "GL code not specified",
19
+ quantityValue: (e, t) => `${e} x ${t}`,
20
+ subtotalRow: "Subtotal",
21
+ discountsRow: "Discounts",
22
+ taxRow: "Tax",
23
+ totalRow: "Total",
24
+ actionError: r.actionError,
25
+ actionSuccess: r.actionSuccess,
26
+ scheduledSummary: i,
27
+ sheet: e,
28
+ decisionDialog: r.decisionDialog,
29
+ approvalPolicyCopy: n,
30
+ markAsPaid: t
9
31
  };
10
32
  //#endregion
11
- export { e as BILL_UPLOAD_QUEUE_LABELS_EN };
33
+ export { a as BILL_DETAILS_LABELS_EN };
@@ -1,94 +1,85 @@
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 { useEmbedApi as t } from "../../../shared/data-access/dist/lib/EmbedApiContext.js";
7
- import "../../../shared/ui/dist/index.js";
8
- import { useUploadPayableFromFileMutation as n } from "../../data-access/dist/index11.js";
9
- import { usePayableOcrQueries as r } from "../../data-access/dist/index13.js";
10
- import "../../data-access/dist/index.js";
11
- import { billPayUploadQueueKey as i } from "./index54.js";
12
- import { BILL_UPLOAD_QUEUE_LABELS_EN as a } from "./index55.js";
13
- import { useCallback as o, useEffect as s, useMemo as c, useState as l } from "react";
14
- import { useQuery as u, useQueryClient as d } from "@tanstack/react-query";
1
+ import { formatCalendarDate as e } from "../../../shared/util/dist/lib/formatCalendarDate.js";
2
+ import { derivePayableStatus as t } from "./index4.js";
3
+ import { resolveVendor as n, resolveVendorName as r } from "./index5.js";
4
+ import { formatBillMoney as i } from "./index35.js";
15
5
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index56.js
16
- function f({ onOpenBill: f, labels: p } = {}) {
17
- let m = {
18
- ...a,
19
- ...p
20
- }, h = p?.tooManyFilesError ?? a.tooManyFilesError, g = p?.remainingCapacityError ?? a.remainingCapacityError, { organizationId: _ } = t(), v = d(), y = c(() => i(_), [_]), b = n(), [x, S] = l(!1), { data: C = [] } = u({
21
- queryKey: y,
22
- queryFn: () => v.getQueryData(y) ?? [],
23
- staleTime: Infinity,
24
- gcTime: Infinity,
25
- initialData: []
26
- }), w = o((e, t) => {
27
- v.setQueryData(y, (n) => (n ?? []).map((n) => n.localId === e ? {
28
- ...n,
29
- ...t
30
- } : n));
31
- }, [v, y]), T = o((t) => {
32
- let n = (v.getQueryData(y) ?? []).filter((e) => e.status === "uploading").length;
33
- if (t.length + n > 10) {
34
- e.error(n > 0 ? g(10 - n) : h(10));
35
- return;
6
+ function a({ payable: a, lineItems: o, ledgerAccounts: s, labels: c, hasScheduledPayment: l, now: u }) {
7
+ let d = a.currency, f = (e) => i(e, d), p = t({
8
+ apiStatus: a.status,
9
+ dueDate: a.due_date,
10
+ scheduledPaymentDate: a.scheduled_payment_date,
11
+ hasScheduledPayment: l,
12
+ now: u
13
+ }), m = n(a), h = r(a), g = e(a.issued_at) || c.notProvided, _ = e(a.due_date) || c.notProvided, v = [{
14
+ label: c.vendorRow,
15
+ value: h || c.notProvided,
16
+ secondaryValue: m?.email ?? void 0
17
+ }], y = m?.bank_account?.account_number;
18
+ y && v.push({
19
+ label: c.bankAccountRow,
20
+ value: c.bankAccountValue(y.slice(-4))
21
+ });
22
+ let b = [
23
+ {
24
+ label: c.invoiceNumberRow,
25
+ value: a.document_id || c.notProvided
26
+ },
27
+ {
28
+ label: c.issueDateRow,
29
+ value: g
30
+ },
31
+ {
32
+ label: c.dueDateRow,
33
+ value: _
34
+ },
35
+ {
36
+ label: c.poNumberRow,
37
+ value: c.notProvided
36
38
  }
37
- S(!1);
38
- for (let e of t) {
39
- let t = crypto.randomUUID();
40
- v.setQueryData(y, (n) => [...n ?? [], {
41
- localId: t,
42
- fileName: e.name,
43
- status: "uploading"
44
- }]), b.mutateAsync({ file: e }).then((e) => w(t, { payableId: e?.id })).catch(() => w(t, { status: "failed" }));
39
+ ], x = new Map(s.map((e) => [e.id, [e.nominal_code, e.name].filter(Boolean).join(" — ")])), S = o.map((e) => {
40
+ let t = f(e.unit_price);
41
+ return {
42
+ id: e.id,
43
+ description: e.name ?? e.description ?? "",
44
+ glCodeLabel: (e.ledger_account_id ? x.get(e.ledger_account_id) : void 0) || c.glCodeMissing,
45
+ quantityLabel: e.quantity != null && t ? c.quantityValue(String(e.quantity), t) : "",
46
+ amountLabel: f(e.subtotal) ?? ""
47
+ };
48
+ }), C = [
49
+ {
50
+ label: c.subtotalRow,
51
+ value: a.subtotal
52
+ },
53
+ {
54
+ label: c.discountsRow,
55
+ value: a.discount
56
+ },
57
+ {
58
+ label: c.taxRow,
59
+ value: a.tax_amount
45
60
  }
46
- }, [
47
- w,
48
- v,
49
- y,
50
- g,
51
- h,
52
- b
53
- ]), E = r({ payableIds: C.filter((e) => e.status === "uploading" && e.payableId).map((e) => e.payableId) });
54
- s(() => {
55
- for (let { payableId: e, ocrStatus: t, isError: n } of E) {
56
- let r = C.find((t) => t.payableId === e && t.status === "uploading");
57
- r && (t === "success" ? w(r.localId, { status: "ready" }) : (n || t === "error" || t === "canceled") && w(r.localId, { status: "failed" }));
58
- }
59
- }, [
60
- C,
61
- E,
62
- w
63
- ]);
64
- let D = C.filter((e) => e.status === "uploading"), O = C.filter((e) => e.status === "ready"), k = C.filter((e) => e.status === "failed"), A = (e) => ({
65
- id: e.localId,
66
- fileName: e.fileName,
67
- status: e.status,
68
- onOpen: e.status === "ready" && e.payableId && f ? () => f(e.payableId) : void 0
69
- }), j = D.length ? [{
70
- id: "in-progress",
71
- items: C.map(A)
72
- }] : [...O.length ? [{
73
- id: "ready",
74
- caption: m.readyCaption(O.length),
75
- items: O.map(A)
76
- }] : [], ...k.length ? [{
77
- id: "failed",
78
- caption: m.failedCaption(k.length),
79
- items: k.map(A)
80
- }] : []], M = D.length ? m.uploadingSummary(C.length) : O.length ? m.completeSummary(O.length) : m.failedCaption(k.length), N = o(() => {
81
- v.setQueryData(y, []);
82
- }, [v, y]);
83
- return {
84
- enqueue: T,
85
- sections: j,
86
- summaryLabel: M,
87
- collapsed: x,
88
- onToggleCollapsed: o(() => S((e) => !e), []),
89
- onClose: N,
90
- isVisible: C.length > 0
61
+ ].map(({ label: e, value: t }) => ({
62
+ label: e,
63
+ value: f(t)
64
+ })).filter((e) => !!e.value), w = f(a.total_amount);
65
+ return w && C.push({
66
+ label: c.totalRow,
67
+ value: w,
68
+ emphasis: !0
69
+ }), {
70
+ title: h,
71
+ subtitle: c.subtitle,
72
+ status: p.status,
73
+ statusTone: p.tone,
74
+ amountDueLabel: f(a.amount_due) ?? f(a.total_amount) ?? "",
75
+ invoiceDateLabel: g,
76
+ dueDateLabel: _,
77
+ dueDateTone: p.isOverdue ? "danger" : "default",
78
+ payToItems: v,
79
+ invoiceItems: b,
80
+ lineItems: S,
81
+ totals: C
91
82
  };
92
83
  }
93
84
  //#endregion
94
- export { f as useBillUploadQueue };
85
+ export { a as mapPayableToBillDetails };