@tesouro/embedded-components-react 0.2.337 → 0.2.339

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