@tesouro/embedded-components-react 0.3.22 → 0.3.24

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 (94) hide show
  1. package/dist/index.js +1 -1
  2. package/dist/lib/BillPayWidget.js +1 -1
  3. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index10.js +10 -10
  4. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index.js +15 -15
  5. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index10.js +31 -32
  6. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index11.js +42 -1
  7. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index12.js +158 -43
  8. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index13.js +33 -4
  9. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index14.js +1 -16
  10. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index15.js +45 -12
  11. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index16.js +4 -64
  12. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index17.js +13 -26
  13. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index18.js +14 -62
  14. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index19.js +56 -123
  15. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index2.js +18 -3
  16. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index20.js +15 -10
  17. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index21.js +61 -40
  18. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index22.js +130 -50
  19. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index23.js +20 -4
  20. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index24.js +38 -69
  21. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index25.js +48 -46
  22. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index26.js +5 -93
  23. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index27.js +71 -34
  24. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index28.js +48 -139
  25. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index29.js +91 -66
  26. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index3.js +22 -5
  27. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index30.js +34 -22
  28. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index31.js +146 -210
  29. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index32.js +72 -209
  30. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index33.js +21 -103
  31. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index34.js +209 -12
  32. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index35.js +211 -44
  33. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index36.js +104 -30
  34. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index37.js +12 -165
  35. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index38.js +47 -35
  36. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index39.js +29 -99
  37. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index4.js +64 -5
  38. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index40.js +181 -12
  39. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index41.js +34 -243
  40. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index42.js +104 -4
  41. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index43.js +12 -27
  42. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index44.js +267 -81
  43. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index45.js +4 -145
  44. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index46.js +33 -3
  45. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index47.js +82 -2
  46. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index48.js +155 -37
  47. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index49.js +2 -0
  48. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index5.js +2 -6
  49. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index50.js +2 -6
  50. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index51.js +43 -9
  51. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index52.js +1 -94
  52. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index53.js +8 -3
  53. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index54.js +7 -5
  54. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index55.js +85 -13
  55. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index56.js +3 -59
  56. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index57.js +9 -3
  57. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index58.js +19 -120
  58. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index59.js +56 -8
  59. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index6.js +3 -32
  60. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index60.js +3 -46
  61. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index61.js +116 -15
  62. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index62.js +8 -28
  63. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index63.js +43 -83
  64. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index64.js +19 -47
  65. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index65.js +27 -249
  66. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index66.js +82 -109
  67. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index67.js +47 -206
  68. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index68.js +253 -4
  69. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index69.js +111 -6
  70. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index7.js +6 -39
  71. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index70.js +197 -102
  72. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index71.js +3 -0
  73. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index72.js +6 -23
  74. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index73.js +114 -0
  75. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index74.js +1 -0
  76. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index75.js +25 -0
  77. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index8.js +5 -24
  78. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index9.js +3 -162
  79. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index.js +9 -6
  80. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index82.js +10 -11
  81. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index83.js +123 -8
  82. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index84.js +2 -170
  83. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index85.js +18 -2
  84. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index86.js +7 -11
  85. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index87.js +163 -82
  86. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index88.js +1 -1
  87. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index89.js +14 -0
  88. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index90.js +108 -0
  89. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index91.js +2 -0
  90. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +2 -2
  91. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/sdk.gen.js +27 -27
  92. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  93. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index7.js +1 -1
  94. package/package.json +1 -1
@@ -1,84 +1,270 @@
1
- import { formatCalendarDate as e } from "../../../shared/util/dist/lib/formatCalendarDate.js";
2
- import { resolveVendor as t, resolveVendorName as n } from "./index3.js";
3
- import { derivePayableStatus as r } from "./index22.js";
4
- import { formatBillMoney as i } from "./index23.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 { resolveAmountDueMinorUnits as ie } from "./index6.js";
14
+ import { resolveVendor as ae } from "./index7.js";
15
+ import { BillCreateScreen as oe } from "../../ui/dist/index41.js";
16
+ import { BillDecisionDialog as n } from "../../ui/dist/index47.js";
17
+ import { BillDuplicateNotice as se } from "../../ui/dist/index57.js";
18
+ import { ExtractionNotice as ce } from "../../ui/dist/index74.js";
19
+ import { MarkAsPaidDialog as le } from "../../ui/dist/index83.js";
20
+ import "../../ui/dist/index.js";
21
+ import { usePayableHistoryQuery as ue } from "../../data-access/dist/index6.js";
22
+ import { useAllPayableLineItemsQuery as de } from "../../data-access/dist/index7.js";
23
+ import { usePayableQuery as fe } from "../../data-access/dist/index13.js";
24
+ import "../../data-access/dist/index.js";
25
+ import { PayBillFlow as pe } from "./index13.js";
26
+ import "./index14.js";
27
+ import { useMarkAsPaidFlow as me } from "./index4.js";
28
+ import "./index5.js";
29
+ import { mergeBillCreateScreenCopy as he } from "./index31.js";
30
+ import { useBillCreateController as ge } from "./index40.js";
31
+ import { useBillForm as _e } from "./index42.js";
32
+ import { useApprovalPolicyCardView as ve } from "./index19.js";
33
+ import { useCurrentApprovalRequestId as ye } from "./index20.js";
34
+ import { usePayableDetailActions as be } from "./index22.js";
35
+ import { useScheduledPayment as xe } from "./index23.js";
36
+ import { useDraftDelete as Se } from "./index24.js";
37
+ import { buildBillDetailView as Ce } from "./index27.js";
38
+ import { buildBillHistory as we } from "./index28.js";
39
+ import { SourceDocumentContainer as Te } from "./index32.js";
40
+ import { useVendorSectionProps as Ee } from "./index35.js";
41
+ import { usePaymentInstructionsForm as De } from "./index36.js";
42
+ import { billCreateTestIds as r } from "./index43.js";
43
+ import { useCallback as i, useEffect as Oe, useMemo as a, useRef as ke, useState as o } from "react";
44
+ import { Fragment as s, jsx as c, jsxs as l } from "react/jsx-runtime";
5
45
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index44.js
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 = r({
8
- apiStatus: a.status,
9
- dueDate: a.due_date,
10
- scheduledPaymentDate: a.scheduled_payment_date,
11
- hasScheduledPayment: l,
12
- now: u
13
- }), m = t(a), h = n(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
38
- }
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
60
- }
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
- payToItems: v,
78
- invoiceItems: b,
79
- lineItems: S,
80
- totals: C
81
- };
46
+ function Ae(e) {
47
+ return !!(e?.bank_account?.account_holder_name && e.bank_account.routing_number && e.bank_account.account_number);
48
+ }
49
+ function u({ open: u, onOpenChange: d, payableId: f, readOnly: p = !1, copy: m, poweredByBankName: je, isPossibleDuplicate: Me }) {
50
+ let h = a(() => he(m), [m]), [g, _] = o(), [v, y] = o(!1), [Ne, b] = o(!1), [Pe, x] = o(!1), [Fe, S] = o(), C = f ?? Fe, w = fe(C, { pollWhileOcrProcessing: !0 }), T = de(C), E = ee(), D = w.data, O = _e({
51
+ payable: D,
52
+ lineItems: T.lineItems
53
+ }), k = D?.counterpart_id;
54
+ Oe(() => {
55
+ v || k && (_(k), y(!0));
56
+ }, [v, k]);
57
+ let Ie = i((e) => {
58
+ y(!0), _(e);
59
+ }, []), A = Ee({
60
+ payableId: p ? void 0 : C,
61
+ counterpartId: p ? void 0 : g,
62
+ payableCounterpartId: k,
63
+ onCounterpartChange: Ie,
64
+ requiredError: O.errors?.vendor,
65
+ payableCounterpartBankAccountId: D?.counterpart_bank_account_id ?? void 0,
66
+ extractedVendor: D?.counterpart_raw_data ?? void 0
67
+ }), j = ge({
68
+ payableId: f,
69
+ form: O,
70
+ counterpartId: g,
71
+ clearCounterpart: !!(C && v) && !g,
72
+ prepareVendorForSave: A.savePaymentInstructions,
73
+ onPayableCreated: S,
74
+ onSaved: S,
75
+ onDraftSaved: () => d(!1),
76
+ onFinalized: () => d(!1)
77
+ }), M = !!(j.isSavingDraft || j.isFinalizing), N = p ? C : void 0, P = ye({
78
+ payableId: N,
79
+ status: D?.status
80
+ }), F = ke(null), I = xe({
81
+ payableId: C,
82
+ scheduledPaymentDate: D?.scheduled_payment_date,
83
+ enabled: p
84
+ }), L = ae(D), R = De({
85
+ payableId: N,
86
+ counterpartId: p ? k : void 0,
87
+ saveErrorMessage: h.detail.paymentInstructionsSaveError,
88
+ linkErrorMessage: h.detail.paymentInstructionsLinkError
89
+ }), { initResponse: z } = re(), B = e(z?.scopes, [t.CounterpartWriteOrg]) && e(z?.scopes, [t.PayableWriteOrg]), V = me({
90
+ payableId: N,
91
+ amountDueMinorUnits: ie(D) ?? 0,
92
+ amountToPayMinorUnits: D?.amount_to_pay ?? void 0,
93
+ currencyCode: D?.currency ?? void 0,
94
+ dueDate: D?.due_date,
95
+ hasScheduledPayment: I.hasScheduledPayment,
96
+ labels: h.markAsPaid
97
+ }), H = ve({
98
+ payableId: N,
99
+ approvalPolicyId: D?.approval_policy_id,
100
+ enabled: p,
101
+ copy: h.approvalPolicyCopy
102
+ }), { actions: Le, decisionDialog: Re } = be({
103
+ payableId: N,
104
+ status: D?.status,
105
+ currentApprovalRequestId: P.id,
106
+ isPolicyApprover: P.isPolicyApprover,
107
+ hasWaitingRequest: P.hasWaitingRequest,
108
+ hasScheduledPayment: I.hasScheduledPayment,
109
+ scheduledPaymentRecordId: I.scheduledPaymentRecordId,
110
+ isScheduledPaymentUnknown: I.isResolving,
111
+ pendingApprovers: H.pendingApprovers,
112
+ labels: h.actions,
113
+ isMarkAsPaidPending: V.isPending,
114
+ onMarkAsPaidSelect: V.open,
115
+ onPayBillSelect: () => Ae(L) || !B ? F.current?.open() : R.open()
116
+ }), U = Se({
117
+ payableId: C,
118
+ status: D?.status,
119
+ enabled: !p,
120
+ labels: h.deleteDraft,
121
+ onDeleted: () => d(!1)
122
+ }), W = a(() => (E.data?.data ?? []).map((e) => ({
123
+ value: e.id,
124
+ label: [e.nominal_code, e.name].filter(Boolean).join(" — ")
125
+ })), [E.data]), G = ue(N), ze = e(z?.scopes, [t.UserReadOrg]), K = te({ enabled: p && ze }), q = a(() => we(G.data?.data ?? [], K.data?.data ?? [], h.history), [
126
+ G.data,
127
+ K.data,
128
+ h.history
129
+ ]), Be = a(() => p && D ? Ce({
130
+ payable: D,
131
+ lineItems: T.lineItems,
132
+ glCodeOptions: W,
133
+ history: q,
134
+ approvalPolicy: H.view,
135
+ labels: h.detail,
136
+ hasScheduledPayment: I.hasScheduledPayment
137
+ }) : void 0, [
138
+ I.hasScheduledPayment,
139
+ H.view,
140
+ h.detail,
141
+ W,
142
+ q,
143
+ T.lineItems,
144
+ D,
145
+ p
146
+ ]), J = D?.source_of_payable_data === "ocr", Y = L?.name, X = p ? Y ? h.viewTitle(Y) : h.readOnlyTitle : J && Y ? h.extractedTitle(Y) : h.newTitle, Ve = p && D?.created_at ? h.addedOn(ne(D.created_at.slice(0, 10))) : void 0, Z = i(() => {
147
+ let e = O.isDirty || A.hasUnsavedVendorChanges || !!j.stagedFile || j.isFileDeletionPending;
148
+ !p && e && !window.confirm(h.discardConfirm) || d(!1);
149
+ }, [
150
+ j.isFileDeletionPending,
151
+ j.stagedFile,
152
+ h.discardConfirm,
153
+ O.isDirty,
154
+ d,
155
+ p,
156
+ A.hasUnsavedVendorChanges
157
+ ]), He = i((e) => {
158
+ if (!M) return e ? d(!0) : Z();
159
+ }, [
160
+ Z,
161
+ M,
162
+ d
163
+ ]), Q = !!Me && !Pe, $ = !p && J && !Ne, Ue = Q || $ ? /* @__PURE__ */ l(s, { children: [Q ? /* @__PURE__ */ c(se, {
164
+ onNotADuplicate: p ? void 0 : () => x(!0),
165
+ onRemoveBill: p ? void 0 : () => x(!0),
166
+ testId: r.duplicateNotice
167
+ }) : null, $ ? /* @__PURE__ */ c(ce, { onDismiss: () => b(!0) }) : null] }) : void 0;
168
+ return /* @__PURE__ */ l(s, { children: [
169
+ /* @__PURE__ */ c(oe, {
170
+ open: u,
171
+ onOpenChange: He,
172
+ title: X,
173
+ subtitle: Ve,
174
+ notice: Ue,
175
+ vendor: {
176
+ ...A,
177
+ testId: r.vendorSection
178
+ },
179
+ values: O.values,
180
+ errors: O.errors,
181
+ onChange: O.onChange,
182
+ lineItems: {
183
+ items: O.lineItemRows,
184
+ glCodeOptions: W,
185
+ discount: O.discount,
186
+ onDiscountChange: O.onDiscountChange,
187
+ tax: O.tax,
188
+ onTaxChange: O.onTaxChange,
189
+ total: O.total,
190
+ onTotalChange: O.onTotalChange,
191
+ onAddLineItem: O.onAddLineItem,
192
+ errors: O.lineItemErrors,
193
+ testId: r.lineItems
194
+ },
195
+ documentPanel: /* @__PURE__ */ c(Te, {
196
+ payableId: C,
197
+ readOnly: p,
198
+ isDocumentPending: !!C && !D?.file && (w.isLoading || D?.ocr_status === "processing"),
199
+ file: D?.file ? {
200
+ id: D.file.id,
201
+ name: D.file.name,
202
+ url: D.file.url,
203
+ mimetype: D.file.mimetype
204
+ } : void 0,
205
+ staging: {
206
+ stagedFile: j.stagedFile,
207
+ onFileStaged: j.stageFile,
208
+ onClearStagedFile: j.clearStagedFile,
209
+ isSaving: M
210
+ },
211
+ deletion: {
212
+ isPending: j.isFileDeletionPending,
213
+ onRequest: j.requestFileDeletion,
214
+ onDetachNow: j.detachFileNow,
215
+ isDeleting: j.isDeletingFile,
216
+ hasFailed: j.hasFileDeletionFailed
217
+ }
218
+ }),
219
+ menuItems: U.menuItems,
220
+ readOnly: p,
221
+ detail: p ? {
222
+ view: Be,
223
+ actions: Le,
224
+ scheduledSummary: I.hasScheduledPayment && I.scheduledDateLabel ? h.scheduledSummary(I.scheduledDateLabel) : void 0,
225
+ paymentInstructionsForm: k && B ? {
226
+ isOpen: R.isOpen,
227
+ values: R.values,
228
+ errors: R.errors,
229
+ isSaving: R.isSaving,
230
+ onOpen: R.open,
231
+ onCancel: R.close,
232
+ onChange: R.onChange,
233
+ onSave: R.save
234
+ } : void 0,
235
+ isLoading: w.isLoading || T.isResolving || E.isResolving,
236
+ isError: w.isError || T.isError || E.isError
237
+ } : void 0,
238
+ isLineItemsLoading: T.isResolving,
239
+ isSaving: M,
240
+ isSavingDraft: j.isSavingDraft,
241
+ isFinalizing: j.isFinalizing,
242
+ onCancel: Z,
243
+ onSaveDraft: j.saveDraft,
244
+ onFinalize: j.finalize,
245
+ testId: r.dialog
246
+ }),
247
+ /* @__PURE__ */ c(n, {
248
+ ...Re,
249
+ labels: { cancelButton: h.actions.decisionDialog.cancelButton },
250
+ testId: r.decisionDialog,
251
+ confirmTestId: r.decisionConfirm,
252
+ reasonTestId: r.decisionReason
253
+ }),
254
+ /* @__PURE__ */ c(n, {
255
+ ...U.dialog,
256
+ labels: { cancelButton: h.actions.decisionDialog.cancelButton },
257
+ testId: r.deleteDraftDialog,
258
+ confirmTestId: r.deleteDraftConfirm
259
+ }),
260
+ /* @__PURE__ */ c(le, { ...V.dialogProps }),
261
+ p && D ? /* @__PURE__ */ c(pe, {
262
+ ref: F,
263
+ payable: D,
264
+ poweredByBankName: je,
265
+ labels: h.payBill
266
+ }) : null
267
+ ] });
82
268
  }
83
269
  //#endregion
84
- export { a as mapPayableToBillDetails };
270
+ export { u as BillCreateDialog, u as default };
@@ -1,145 +1,4 @@
1
- "use client";
2
- "use client";
3
- "use client";
4
- "use client";
5
- import { useAllLedgerAccountsQuery as e } from "../../../shared/data-access/dist/lib/reference-data/useLedgerAccountsQuery.js";
6
- import "../../../shared/data-access/dist/index.js";
7
- import { resolveVendor as t } from "./index3.js";
8
- import { BillDecisionDialog as n } from "../../ui/dist/index47.js";
9
- import { BillDetailsSheet as r } from "../../ui/dist/index53.js";
10
- import { BillDuplicateNotice as i } from "../../ui/dist/index57.js";
11
- import "../../ui/dist/index.js";
12
- import { useAllPayableLineItemsQuery as a } from "../../data-access/dist/index7.js";
13
- import { usePayableQuery as o } from "../../data-access/dist/index13.js";
14
- import "../../data-access/dist/index.js";
15
- import { PayBillFlow as s } from "./index10.js";
16
- import "./index11.js";
17
- import { mergeDecisionDialogCopy as c } from "./index26.js";
18
- import { useApprovalPolicyCardView as l } from "./index16.js";
19
- import { useCurrentApprovalRequestId as u } from "./index17.js";
20
- import { usePayableDetailActions as d } from "./index19.js";
21
- import { useScheduledPayment as f } from "./index20.js";
22
- import { BILL_DETAILS_LABELS_EN as p } from "./index43.js";
23
- import { mapPayableToBillDetails as m } from "./index44.js";
24
- import { useMemo as h, useRef as g } from "react";
25
- import { Fragment as _, jsx as v, jsxs as y } from "react/jsx-runtime";
26
- //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index45.js
27
- function b(e) {
28
- return !!(e?.bank_account?.account_holder_name && e.bank_account.routing_number && e.bank_account.account_number);
29
- }
30
- function x({ open: x, onOpenChange: S, payableId: C, onClose: w, onExpand: T, testId: E, labels: D, poweredByBankName: O, isPossibleDuplicate: k }) {
31
- let A = h(() => ({
32
- ...p,
33
- ...D,
34
- sheet: {
35
- ...p.sheet,
36
- ...D?.sheet,
37
- statusBadge: {
38
- ...p.sheet.statusBadge,
39
- ...D?.sheet?.statusBadge
40
- },
41
- approvalPolicy: {
42
- ...p.sheet.approvalPolicy,
43
- ...D?.sheet?.approvalPolicy
44
- }
45
- },
46
- decisionDialog: c(p.decisionDialog, D?.decisionDialog),
47
- approvalPolicyCopy: {
48
- ...p.approvalPolicyCopy,
49
- ...D?.approvalPolicyCopy
50
- },
51
- actionSuccess: {
52
- ...p.actionSuccess,
53
- ...D?.actionSuccess
54
- }
55
- }), [D]), j = o(C), M = a(C), N = e(), P = j.data, F = g(null), I = u({
56
- payableId: C,
57
- status: P?.status
58
- }), L = l({
59
- payableId: C,
60
- approvalPolicyId: P?.approval_policy_id,
61
- copy: A.approvalPolicyCopy
62
- }), R = f({
63
- payableId: C,
64
- scheduledPaymentDate: P?.scheduled_payment_date
65
- }), { actions: z, decisionDialog: B } = d({
66
- payableId: P ? C : void 0,
67
- status: P?.status,
68
- currentApprovalRequestId: I.id,
69
- isPolicyApprover: I.isPolicyApprover,
70
- hasWaitingRequest: I.hasWaitingRequest,
71
- hasScheduledPayment: R.hasScheduledPayment,
72
- scheduledPaymentRecordId: R.scheduledPaymentRecordId,
73
- isScheduledPaymentUnknown: R.isResolving,
74
- pendingApprovers: L.pendingApprovers,
75
- arePendingApproversUnknown: L.isLoading,
76
- labels: {
77
- payBill: A.sheet.payButton,
78
- markAsPaid: A.sheet.markAsPaidButton,
79
- reject: A.sheet.rejectButton,
80
- approve: A.sheet.approveButton,
81
- cancel: A.sheet.cancelButton,
82
- cancelScheduledPayment: A.sheet.cancelScheduledPaymentButton,
83
- reopen: A.sheet.reopenButton,
84
- forceApprove: A.sheet.forceApproveButton,
85
- forceReject: A.sheet.forceRejectButton,
86
- policyOverridesHeading: A.sheet.policyOverridesGroup,
87
- decisionDialog: A.decisionDialog,
88
- actionError: A.actionError,
89
- actionSuccess: A.actionSuccess
90
- },
91
- onPayBillSelect: () => {
92
- if (!b(t(P)) && T) {
93
- T();
94
- return;
95
- }
96
- F.current?.open();
97
- }
98
- }), V = R.hasScheduledPayment && R.scheduledDateLabel ? /* @__PURE__ */ v("p", {
99
- className: "ttw:text-sm ttw:text-muted-foreground",
100
- children: A.scheduledSummary(R.scheduledDateLabel)
101
- }) : void 0, H = k ? /* @__PURE__ */ v(i, {}) : void 0, U = H || V ? /* @__PURE__ */ y(_, { children: [H, V] }) : void 0, W = h(() => P ? m({
102
- payable: P,
103
- lineItems: M.lineItems,
104
- ledgerAccounts: N.data?.data ?? [],
105
- labels: A,
106
- hasScheduledPayment: R.hasScheduledPayment
107
- }) : void 0, [
108
- P,
109
- M.lineItems,
110
- N.data,
111
- A,
112
- R.hasScheduledPayment
113
- ]), G = j.isLoading || M.isResolving || N.isResolving, K = j.isError || M.isError || N.isError;
114
- return /* @__PURE__ */ y(_, { children: [
115
- /* @__PURE__ */ v(r, {
116
- open: x,
117
- onOpenChange: S,
118
- details: W,
119
- actions: z,
120
- approvalPolicy: L.view,
121
- isLoading: G,
122
- isError: K,
123
- notice: U,
124
- onClose: w,
125
- onExpand: T,
126
- testId: E,
127
- labels: A.sheet
128
- }),
129
- /* @__PURE__ */ v(n, {
130
- ...B,
131
- labels: { cancelButton: A.decisionDialog.cancelButton },
132
- testId: E ? `${E}-decision-dialog` : void 0,
133
- confirmTestId: E ? `${E}-decision-confirm` : void 0,
134
- reasonTestId: E ? `${E}-decision-reason` : void 0,
135
- reasonFieldId: E ? `${E}-decision-reason-field` : void 0
136
- }),
137
- P ? /* @__PURE__ */ v(s, {
138
- ref: F,
139
- payable: P,
140
- poweredByBankName: O
141
- }) : null
142
- ] });
143
- }
144
- //#endregion
145
- export { x as BillDetailsContainer, x as default };
1
+ import "./index31.js";
2
+ import "./index40.js";
3
+ import "./index42.js";
4
+ import "./index44.js";
@@ -1,3 +1,33 @@
1
- import "./index43.js";
2
- import "./index44.js";
3
- import "./index45.js";
1
+ import { BILL_DETAILS_SHEET_LABELS_EN as e } from "../../ui/dist/index52.js";
2
+ import "../../ui/dist/index.js";
3
+ import { MARK_AS_PAID_FLOW_LABELS_EN as t } from "./index2.js";
4
+ import "./index5.js";
5
+ import { APPROVAL_POLICY_RULE_COPY_EN as n } from "./index15.js";
6
+ import { BILL_DETAIL_ACTIONS_LABELS_EN as r, SCHEDULED_SUMMARY_LABEL_EN as i } from "./index29.js";
7
+ //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index46.js
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
31
+ };
32
+ //#endregion
33
+ export { a as BILL_DETAILS_LABELS_EN };
@@ -1,4 +1,84 @@
1
+ import { formatCalendarDate as e } from "../../../shared/util/dist/lib/formatCalendarDate.js";
2
+ import { resolveVendor as t, resolveVendorName as n } from "./index7.js";
3
+ import { derivePayableStatus as r } from "./index25.js";
4
+ import { formatBillMoney as i } from "./index26.js";
1
5
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index47.js
2
- var e = { Mounted: "bill_pay_widget.mounted" }, t = "bill_pay_widget";
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 = r({
8
+ apiStatus: a.status,
9
+ dueDate: a.due_date,
10
+ scheduledPaymentDate: a.scheduled_payment_date,
11
+ hasScheduledPayment: l,
12
+ now: u
13
+ }), m = t(a), h = n(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
38
+ }
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
60
+ }
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
+ payToItems: v,
78
+ invoiceItems: b,
79
+ lineItems: S,
80
+ totals: C
81
+ };
82
+ }
3
83
  //#endregion
4
- export { e as BillPayWidgetAnalyticsEvent, t as WIDGET_NAME };
84
+ export { a as mapPayableToBillDetails };