@tesouro/embedded-components-react 0.3.12 → 0.3.14

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.d.ts +42 -30
  2. package/dist/index.js +1 -1
  3. package/dist/lib/BillPayWidget.js +1 -1
  4. package/dist/lib/CardsWidget.d.ts +12 -0
  5. package/dist/lib/CreateCardWidget.d.ts +12 -0
  6. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index.js +6 -6
  7. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index28.js +2 -1
  8. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index30.js +23 -205
  9. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index31.js +200 -185
  10. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index32.js +199 -50
  11. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index33.js +105 -13
  12. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index34.js +12 -46
  13. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index35.js +46 -30
  14. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index36.js +26 -158
  15. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index37.js +162 -31
  16. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index38.js +32 -98
  17. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index39.js +102 -13
  18. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index40.js +13 -242
  19. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index41.js +247 -4
  20. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index42.js +4 -30
  21. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index43.js +28 -82
  22. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index44.js +76 -137
  23. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index45.js +145 -3
  24. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index46.js +3 -4
  25. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index47.js +2 -43
  26. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index48.js +45 -1
  27. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index49.js +1 -8
  28. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index50.js +6 -9
  29. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index51.js +9 -92
  30. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index52.js +94 -3
  31. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index53.js +3 -9
  32. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index54.js +7 -20
  33. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index55.js +14 -51
  34. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index56.js +59 -3
  35. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index57.js +3 -110
  36. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index58.js +107 -8
  37. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index59.js +8 -40
  38. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index60.js +38 -15
  39. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index61.js +18 -98
  40. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index62.js +92 -173
  41. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index63.js +180 -4
  42. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index64.js +5 -8
  43. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index65.js +6 -112
  44. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index66.js +114 -1
  45. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index67.js +0 -24
  46. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index68.js +25 -0
  47. package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/index5.js +1 -2
  48. package/dist/libs/tesouro-embedded-components-react/create-card-widget/data-access/dist/index.js +3 -2
  49. package/dist/libs/tesouro-embedded-components-react/create-card-widget/data-access/dist/index5.js +19 -12
  50. package/dist/libs/tesouro-embedded-components-react/create-card-widget/data-access/dist/index6.js +22 -0
  51. package/dist/libs/tesouro-embedded-components-react/create-card-widget/feature/dist/index4.js +4 -1
  52. package/dist/libs/tesouro-embedded-components-react/create-card-widget/feature/dist/index5.js +0 -1
  53. package/dist/libs/tesouro-embedded-components-react/create-card-widget/feature/dist/index6.js +22 -37
  54. package/dist/libs/tesouro-embedded-components-react/create-card-widget/feature/dist/index7.js +167 -110
  55. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/index.js +9 -9
  56. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/helpers.js +6 -3
  57. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/useCounterpartDetails.js +1 -0
  58. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/useCounterpartForm.js +1 -1
  59. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +18 -18
  60. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js +111 -104
  61. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/sdk.gen.js +144 -128
  62. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/zod.gen.js +1028 -1019
  63. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/user/useAllOrganizationUsersQuery.js +20 -18
  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,247 @@
1
- import "./index28.js";
2
- import "./index36.js";
3
- import "./index38.js";
4
- import "./index40.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 "./index28.js";
26
+ import { useBillCreateController as pe } from "./index37.js";
27
+ import { useBillForm as me } from "./index39.js";
28
+ import { useApprovalPolicyCardView as he } from "./index16.js";
29
+ import { useCurrentApprovalRequestId as ge } from "./index17.js";
30
+ import { usePayableDetailActions as _e } from "./index19.js";
31
+ import { useScheduledPayment as r } from "./index20.js";
32
+ import { useDraftDelete as ve } from "./index21.js";
33
+ import { buildBillDetailView as ye } from "./index24.js";
34
+ import { buildBillHistory as be } from "./index25.js";
35
+ import { SourceDocumentContainer as xe } from "./index29.js";
36
+ import { useVendorSectionProps as Se } from "./index32.js";
37
+ import { usePaymentInstructionsForm as Ce } from "./index33.js";
38
+ import { billCreateTestIds as i } from "./index40.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/index41.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
+ payableCounterpartBankAccountId: k?.counterpart_bank_account_id ?? void 0,
62
+ extractedVendor: k?.counterpart_raw_data ?? void 0
63
+ }), N = pe({
64
+ payableId: p,
65
+ form: A,
66
+ counterpartId: _,
67
+ clearCounterpart: !!(T && y) && !_,
68
+ prepareVendorForSave: M.savePaymentInstructions,
69
+ onPayableCreated: w,
70
+ onSaved: w,
71
+ onDraftSaved: () => f(!1),
72
+ onFinalized: () => f(!1)
73
+ }), P = !!(N.isSavingDraft || N.isFinalizing), F = m ? T : void 0, I = ge({
74
+ payableId: F,
75
+ status: k?.status
76
+ }), L = Te(null), R = r({
77
+ payableId: T,
78
+ scheduledPaymentDate: k?.scheduled_payment_date,
79
+ enabled: m
80
+ }), z = ie(k), B = Ce({
81
+ payableId: F,
82
+ counterpartId: m ? j : void 0,
83
+ saveErrorMessage: g.detail.paymentInstructionsSaveError,
84
+ linkErrorMessage: g.detail.paymentInstructionsLinkError
85
+ }), { initResponse: V } = re(), H = e(V?.scopes, [t.CounterpartWriteOrg]) && e(V?.scopes, [t.PayableWriteOrg]), U = he({
86
+ payableId: F,
87
+ approvalPolicyId: k?.approval_policy_id,
88
+ enabled: m,
89
+ copy: g.approvalPolicyCopy
90
+ }), { actions: Me, decisionDialog: Ne } = _e({
91
+ payableId: F,
92
+ status: k?.status,
93
+ currentApprovalRequestId: I.id,
94
+ isPolicyApprover: I.isPolicyApprover,
95
+ hasWaitingRequest: I.hasWaitingRequest,
96
+ hasScheduledPayment: R.hasScheduledPayment,
97
+ scheduledPaymentRecordId: R.scheduledPaymentRecordId,
98
+ isScheduledPaymentUnknown: R.isResolving,
99
+ pendingApprovers: U.pendingApprovers,
100
+ labels: g.actions,
101
+ onPayBillSelect: () => Ee(z) || !H ? L.current?.open() : B.open()
102
+ }), W = ve({
103
+ payableId: T,
104
+ status: k?.status,
105
+ enabled: !m,
106
+ labels: g.deleteDraft,
107
+ onDeleted: () => f(!1)
108
+ }), G = o(() => (O.data?.data ?? []).map((e) => ({
109
+ value: e.id,
110
+ label: [e.nominal_code, e.name].filter(Boolean).join(" — ")
111
+ })), [O.data]), K = ce(F), Pe = e(V?.scopes, [t.UserReadOrg]), q = te({ enabled: m && Pe }), J = o(() => be(K.data?.data ?? [], q.data?.data ?? [], g.history), [
112
+ K.data,
113
+ q.data,
114
+ g.history
115
+ ]), Fe = o(() => m && k ? ye({
116
+ payable: k,
117
+ lineItems: D.lineItems,
118
+ glCodeOptions: G,
119
+ history: J,
120
+ approvalPolicy: U.view,
121
+ labels: g.detail,
122
+ hasScheduledPayment: R.hasScheduledPayment
123
+ }) : void 0, [
124
+ R.hasScheduledPayment,
125
+ U.view,
126
+ g.detail,
127
+ G,
128
+ J,
129
+ D.lineItems,
130
+ k,
131
+ m
132
+ ]), 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(() => {
133
+ let e = A.isDirty || M.hasUnsavedVendorChanges || !!N.stagedFile;
134
+ !m && e && !window.confirm(g.discardConfirm) || f(!1);
135
+ }, [
136
+ N.stagedFile,
137
+ g.discardConfirm,
138
+ A.isDirty,
139
+ f,
140
+ m,
141
+ M.hasUnsavedVendorChanges
142
+ ]), Re = a((e) => {
143
+ if (!P) return e ? f(!0) : Z();
144
+ }, [
145
+ Z,
146
+ P,
147
+ f
148
+ ]), Q = !!Oe && !Ae, $ = !m && Y && !ke, ze = Q || $ ? /* @__PURE__ */ u(c, { children: [Q ? /* @__PURE__ */ l(oe, {
149
+ onNotADuplicate: m ? void 0 : () => S(!0),
150
+ onRemoveBill: m ? void 0 : () => S(!0),
151
+ testId: i.duplicateNotice
152
+ }) : null, $ ? /* @__PURE__ */ l(se, { onDismiss: () => x(!0) }) : null] }) : void 0;
153
+ return /* @__PURE__ */ u(c, { children: [
154
+ /* @__PURE__ */ l(ae, {
155
+ open: d,
156
+ onOpenChange: Re,
157
+ title: Ie,
158
+ subtitle: Le,
159
+ notice: ze,
160
+ vendor: {
161
+ ...M,
162
+ testId: i.vendorSection
163
+ },
164
+ values: A.values,
165
+ errors: A.errors,
166
+ onChange: A.onChange,
167
+ lineItems: {
168
+ items: A.lineItemRows,
169
+ glCodeOptions: G,
170
+ discount: A.discount,
171
+ onDiscountChange: A.onDiscountChange,
172
+ tax: A.tax,
173
+ onTaxChange: A.onTaxChange,
174
+ total: A.total,
175
+ onTotalChange: A.onTotalChange,
176
+ onAddLineItem: A.onAddLineItem,
177
+ errors: A.lineItemErrors,
178
+ testId: i.lineItems
179
+ },
180
+ documentPanel: /* @__PURE__ */ l(xe, {
181
+ payableId: T,
182
+ readOnly: m,
183
+ isDocumentPending: !!T && !k?.file && (E.isLoading || k?.ocr_status === "processing"),
184
+ file: k?.file ? {
185
+ id: k.file.id,
186
+ name: k.file.name,
187
+ url: k.file.url,
188
+ mimetype: k.file.mimetype
189
+ } : void 0,
190
+ staging: {
191
+ stagedFile: N.stagedFile,
192
+ onFileStaged: N.stageFile,
193
+ onClearStagedFile: N.clearStagedFile,
194
+ isSaving: P
195
+ }
196
+ }),
197
+ menuItems: W.menuItems,
198
+ readOnly: m,
199
+ detail: m ? {
200
+ view: Fe,
201
+ actions: Me,
202
+ scheduledSummary: R.hasScheduledPayment && R.scheduledDateLabel ? g.scheduledSummary(R.scheduledDateLabel) : void 0,
203
+ paymentInstructionsForm: j && H ? {
204
+ isOpen: B.isOpen,
205
+ values: B.values,
206
+ errors: B.errors,
207
+ isSaving: B.isSaving,
208
+ onOpen: B.open,
209
+ onCancel: B.close,
210
+ onChange: B.onChange,
211
+ onSave: B.save
212
+ } : void 0,
213
+ isLoading: E.isLoading || D.isResolving || O.isResolving,
214
+ isError: E.isError || D.isError || O.isError
215
+ } : void 0,
216
+ isLineItemsLoading: D.isResolving,
217
+ isSaving: P,
218
+ isSavingDraft: N.isSavingDraft,
219
+ isFinalizing: N.isFinalizing,
220
+ onCancel: Z,
221
+ onSaveDraft: N.saveDraft,
222
+ onFinalize: N.finalize,
223
+ testId: i.dialog
224
+ }),
225
+ /* @__PURE__ */ l(n, {
226
+ ...Ne,
227
+ labels: { cancelButton: g.actions.decisionDialog.cancelButton },
228
+ testId: i.decisionDialog,
229
+ confirmTestId: i.decisionConfirm,
230
+ reasonTestId: i.decisionReason
231
+ }),
232
+ /* @__PURE__ */ l(n, {
233
+ ...W.dialog,
234
+ labels: { cancelButton: g.actions.decisionDialog.cancelButton },
235
+ testId: i.deleteDraftDialog,
236
+ confirmTestId: i.deleteDraftConfirm
237
+ }),
238
+ m && k ? /* @__PURE__ */ l(de, {
239
+ ref: L,
240
+ payable: k,
241
+ poweredByBankName: De,
242
+ labels: g.payBill
243
+ }) : null
244
+ ] });
245
+ }
246
+ //#endregion
247
+ export { d as BillCreateDialog, d as default };
@@ -1,30 +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 "./index26.js";
5
- //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index42.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
- actionSuccess: n.actionSuccess,
24
- scheduledSummary: r,
25
- sheet: e,
26
- decisionDialog: n.decisionDialog,
27
- approvalPolicyCopy: t
28
- };
29
- //#endregion
30
- export { i as BILL_DETAILS_LABELS_EN };
1
+ import "./index28.js";
2
+ import "./index37.js";
3
+ import "./index39.js";
4
+ import "./index41.js";
@@ -1,84 +1,30 @@
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
+ 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 "./index26.js";
5
5
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index43.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
- };
82
- }
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
+ actionSuccess: n.actionSuccess,
24
+ scheduledSummary: r,
25
+ sheet: e,
26
+ decisionDialog: n.decisionDialog,
27
+ approvalPolicyCopy: t
28
+ };
83
29
  //#endregion
84
- export { a as mapPayableToBillDetails };
30
+ export { i as BILL_DETAILS_LABELS_EN };
@@ -1,145 +1,84 @@
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 "./index42.js";
23
- import { mapPayableToBillDetails as m } from "./index43.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 "./index22.js";
4
+ import { formatBillMoney as i } from "./index23.js";
26
5
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index44.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, 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
45
30
  },
46
- decisionDialog: c(p.decisionDialog, D?.decisionDialog),
47
- approvalPolicyCopy: {
48
- ...p.approvalPolicyCopy,
49
- ...D?.approvalPolicyCopy
31
+ {
32
+ label: c.dueDateRow,
33
+ value: _
50
34
  },
51
- actionSuccess: {
52
- ...p.actionSuccess,
53
- ...D?.actionSuccess
35
+ {
36
+ label: c.poNumberRow,
37
+ value: c.notProvided
54
38
  }
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
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
90
56
  },
91
- onPayBillSelect: () => {
92
- if (!b(t(P)) && T) {
93
- T();
94
- return;
95
- }
96
- F.current?.open();
57
+ {
58
+ label: c.taxRow,
59
+ value: a.tax_amount
97
60
  }
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
- ] });
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
+ };
143
82
  }
144
83
  //#endregion
145
- export { x as BillDetailsContainer, x as default };
84
+ export { a as mapPayableToBillDetails };