@tesouro/embedded-components-react 0.2.332 → 0.2.336

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