@tesouro/embedded-components-react 0.3.22 → 0.3.23

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 (91) 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/feature/dist/index.js +15 -15
  4. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index10.js +31 -32
  5. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index11.js +42 -1
  6. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index12.js +158 -43
  7. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index13.js +33 -4
  8. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index14.js +1 -16
  9. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index15.js +45 -12
  10. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index16.js +4 -64
  11. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index17.js +13 -26
  12. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index18.js +14 -62
  13. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index19.js +56 -123
  14. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index2.js +18 -3
  15. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index20.js +15 -10
  16. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index21.js +61 -40
  17. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index22.js +130 -50
  18. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index23.js +20 -4
  19. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index24.js +38 -69
  20. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index25.js +48 -46
  21. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index26.js +5 -93
  22. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index27.js +71 -34
  23. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index28.js +48 -139
  24. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index29.js +91 -66
  25. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index3.js +22 -5
  26. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index30.js +34 -22
  27. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index31.js +144 -210
  28. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index32.js +63 -209
  29. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index33.js +21 -103
  30. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index34.js +209 -12
  31. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index35.js +211 -44
  32. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index36.js +104 -30
  33. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index37.js +12 -165
  34. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index38.js +47 -35
  35. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index39.js +29 -99
  36. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index4.js +64 -5
  37. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index40.js +166 -12
  38. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index41.js +34 -243
  39. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index42.js +104 -4
  40. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index43.js +12 -27
  41. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index44.js +259 -81
  42. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index45.js +4 -145
  43. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index46.js +33 -3
  44. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index47.js +82 -2
  45. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index48.js +155 -37
  46. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index49.js +2 -0
  47. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index5.js +2 -6
  48. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index50.js +2 -6
  49. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index51.js +43 -9
  50. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index52.js +1 -94
  51. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index53.js +8 -3
  52. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index54.js +7 -5
  53. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index55.js +85 -13
  54. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index56.js +3 -59
  55. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index57.js +9 -3
  56. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index58.js +19 -120
  57. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index59.js +56 -8
  58. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index6.js +3 -32
  59. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index60.js +3 -46
  60. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index61.js +116 -15
  61. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index62.js +8 -28
  62. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index63.js +43 -83
  63. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index64.js +19 -47
  64. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index65.js +27 -249
  65. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index66.js +82 -109
  66. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index67.js +47 -206
  67. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index68.js +253 -4
  68. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index69.js +111 -6
  69. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index7.js +6 -39
  70. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index70.js +197 -102
  71. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index71.js +3 -0
  72. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index72.js +6 -23
  73. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index73.js +114 -0
  74. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index74.js +1 -0
  75. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index75.js +25 -0
  76. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index8.js +5 -24
  77. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index9.js +3 -162
  78. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index.js +9 -6
  79. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index82.js +10 -11
  80. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index83.js +123 -8
  81. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index84.js +2 -170
  82. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index85.js +18 -2
  83. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index86.js +7 -11
  84. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index87.js +163 -82
  85. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index88.js +1 -1
  86. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index89.js +14 -0
  87. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index90.js +89 -0
  88. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index91.js +2 -0
  89. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  90. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index7.js +1 -1
  91. package/package.json +1 -1
@@ -1,4 +1,104 @@
1
- import "./index28.js";
2
- import "./index37.js";
3
- import "./index39.js";
4
- import "./index41.js";
1
+ "use client";
2
+ "use client";
3
+ "use client";
4
+ "use client";
5
+ import { calculateTotal as e, displayLineAmount as t, parseMoneyToMinorUnits as n } from "./index38.js";
6
+ import { emptyLineItem as r, mapPayableToBillForm as i } from "./index41.js";
7
+ import { useCallback as a, useEffect as o, useMemo as s, useState as c } from "react";
8
+ //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index42.js
9
+ function l(e, r, i) {
10
+ return n(r) === null ? i : t(e, r);
11
+ }
12
+ function u({ payable: t, lineItems: n } = {}) {
13
+ let u = s(() => i({
14
+ payable: t ?? {},
15
+ lineItems: n ?? []
16
+ }), [t, n]), [d, f] = c(u.values), [p, m] = c(u.lineItems), [h, g] = c(u.discount), [_, v] = c(u.tax), [y, b] = c(u.total || void 0), [x, S] = c(), [C, w] = c(), [T, E] = c(!1), [D, O] = c(!1), [k, A] = c(!1);
17
+ o(() => {
18
+ T || f(u.values);
19
+ }, [u]), o(() => {
20
+ D || m(u.lineItems);
21
+ }, [u]), o(() => {
22
+ k || (g(u.discount), v(u.tax), b(u.total || void 0));
23
+ }, [u]);
24
+ let j = a((e) => {
25
+ f((t) => ({
26
+ ...t,
27
+ ...e
28
+ })), E(!0);
29
+ }, []), M = a((e) => {
30
+ w((t) => {
31
+ if (!t?.[e]) return t;
32
+ let n = { ...t };
33
+ return delete n[e], Object.keys(n).length ? n : void 0;
34
+ });
35
+ }, []), N = a((e, t) => {
36
+ M(e), m((n) => n.map((n) => {
37
+ if (n.id !== e) return n;
38
+ let r = {
39
+ ...n,
40
+ ...t
41
+ };
42
+ return "amount" in t ? r : {
43
+ ...r,
44
+ amount: l(r.quantity, r.price, r.amount)
45
+ };
46
+ })), O(!0), b(void 0);
47
+ }, [M]), P = a((e, t) => {
48
+ M(e), m((n) => n.map((n) => {
49
+ if (n.id !== e) return n;
50
+ let r = Number.parseFloat(n.quantity), i = String(Math.max(1, (Number.isFinite(r) ? r : 1) + t));
51
+ return {
52
+ ...n,
53
+ quantity: i,
54
+ amount: l(i, n.price, n.amount)
55
+ };
56
+ })), O(!0), b(void 0);
57
+ }, [M]), F = a((e) => {
58
+ M(e), m((t) => t.length <= 1 ? t : t.filter((t) => t.id !== e)), O(!0), b(void 0);
59
+ }, [M]), I = a(() => {
60
+ m((e) => [...e, r()]), O(!0), b(void 0);
61
+ }, []), L = a((e) => {
62
+ g(e), A(!0), b(void 0);
63
+ }, []), R = a((e) => {
64
+ v(e), A(!0), b(void 0);
65
+ }, []), z = a((e) => {
66
+ b(e), A(!0);
67
+ }, []), B = s(() => p.map((e) => ({
68
+ ...e,
69
+ onChange: (t) => N(e.id, t),
70
+ onQuantityStep: (t) => P(e.id, t),
71
+ onRemove: () => F(e.id)
72
+ })), [
73
+ p,
74
+ N,
75
+ F,
76
+ P
77
+ ]), V = s(() => e(p, _, h), [
78
+ p,
79
+ _,
80
+ h
81
+ ]);
82
+ return {
83
+ values: d,
84
+ errors: x,
85
+ setErrors: S,
86
+ lineItemErrors: C,
87
+ setLineItemErrors: w,
88
+ onChange: j,
89
+ lineItems: p,
90
+ lineItemRows: B,
91
+ discount: h,
92
+ onDiscountChange: L,
93
+ tax: _,
94
+ onTaxChange: R,
95
+ total: y ?? V,
96
+ totalOverride: y,
97
+ onTotalChange: z,
98
+ onAddLineItem: I,
99
+ isTotalsDirty: k,
100
+ isDirty: T || D || k
101
+ };
102
+ }
103
+ //#endregion
104
+ export { u as useBillForm };
@@ -1,30 +1,15 @@
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
1
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index43.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
2
+ var e = {
3
+ dialog: "bill-pay-bill-create-dialog",
4
+ vendorSection: "bill-pay-bill-create-vendor",
5
+ lineItems: "bill-pay-bill-create-line-items",
6
+ documentPanel: "bill-pay-bill-create-document",
7
+ duplicateNotice: "bill-pay-bill-create-duplicate-notice",
8
+ decisionDialog: "bill-pay-bill-decision-dialog",
9
+ decisionConfirm: "bill-pay-bill-decision-confirm",
10
+ decisionReason: "bill-pay-bill-decision-reason",
11
+ deleteDraftDialog: "bill-pay-bill-delete-draft-dialog",
12
+ deleteDraftConfirm: "bill-pay-bill-delete-draft-confirm"
28
13
  };
29
14
  //#endregion
30
- export { i as BILL_DETAILS_LABELS_EN };
15
+ export { e as billCreateTestIds };
@@ -1,84 +1,262 @@
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;
148
+ !p && e && !window.confirm(h.discardConfirm) || d(!1);
149
+ }, [
150
+ j.stagedFile,
151
+ h.discardConfirm,
152
+ O.isDirty,
153
+ d,
154
+ p,
155
+ A.hasUnsavedVendorChanges
156
+ ]), He = i((e) => {
157
+ if (!M) return e ? d(!0) : Z();
158
+ }, [
159
+ Z,
160
+ M,
161
+ d
162
+ ]), Q = !!Me && !Pe, $ = !p && J && !Ne, Ue = Q || $ ? /* @__PURE__ */ l(s, { children: [Q ? /* @__PURE__ */ c(se, {
163
+ onNotADuplicate: p ? void 0 : () => x(!0),
164
+ onRemoveBill: p ? void 0 : () => x(!0),
165
+ testId: r.duplicateNotice
166
+ }) : null, $ ? /* @__PURE__ */ c(ce, { onDismiss: () => b(!0) }) : null] }) : void 0;
167
+ return /* @__PURE__ */ l(s, { children: [
168
+ /* @__PURE__ */ c(oe, {
169
+ open: u,
170
+ onOpenChange: He,
171
+ title: X,
172
+ subtitle: Ve,
173
+ notice: Ue,
174
+ vendor: {
175
+ ...A,
176
+ testId: r.vendorSection
177
+ },
178
+ values: O.values,
179
+ errors: O.errors,
180
+ onChange: O.onChange,
181
+ lineItems: {
182
+ items: O.lineItemRows,
183
+ glCodeOptions: W,
184
+ discount: O.discount,
185
+ onDiscountChange: O.onDiscountChange,
186
+ tax: O.tax,
187
+ onTaxChange: O.onTaxChange,
188
+ total: O.total,
189
+ onTotalChange: O.onTotalChange,
190
+ onAddLineItem: O.onAddLineItem,
191
+ errors: O.lineItemErrors,
192
+ testId: r.lineItems
193
+ },
194
+ documentPanel: /* @__PURE__ */ c(Te, {
195
+ payableId: C,
196
+ readOnly: p,
197
+ isDocumentPending: !!C && !D?.file && (w.isLoading || D?.ocr_status === "processing"),
198
+ file: D?.file ? {
199
+ id: D.file.id,
200
+ name: D.file.name,
201
+ url: D.file.url,
202
+ mimetype: D.file.mimetype
203
+ } : void 0,
204
+ staging: {
205
+ stagedFile: j.stagedFile,
206
+ onFileStaged: j.stageFile,
207
+ onClearStagedFile: j.clearStagedFile,
208
+ isSaving: M
209
+ }
210
+ }),
211
+ menuItems: U.menuItems,
212
+ readOnly: p,
213
+ detail: p ? {
214
+ view: Be,
215
+ actions: Le,
216
+ scheduledSummary: I.hasScheduledPayment && I.scheduledDateLabel ? h.scheduledSummary(I.scheduledDateLabel) : void 0,
217
+ paymentInstructionsForm: k && B ? {
218
+ isOpen: R.isOpen,
219
+ values: R.values,
220
+ errors: R.errors,
221
+ isSaving: R.isSaving,
222
+ onOpen: R.open,
223
+ onCancel: R.close,
224
+ onChange: R.onChange,
225
+ onSave: R.save
226
+ } : void 0,
227
+ isLoading: w.isLoading || T.isResolving || E.isResolving,
228
+ isError: w.isError || T.isError || E.isError
229
+ } : void 0,
230
+ isLineItemsLoading: T.isResolving,
231
+ isSaving: M,
232
+ isSavingDraft: j.isSavingDraft,
233
+ isFinalizing: j.isFinalizing,
234
+ onCancel: Z,
235
+ onSaveDraft: j.saveDraft,
236
+ onFinalize: j.finalize,
237
+ testId: r.dialog
238
+ }),
239
+ /* @__PURE__ */ c(n, {
240
+ ...Re,
241
+ labels: { cancelButton: h.actions.decisionDialog.cancelButton },
242
+ testId: r.decisionDialog,
243
+ confirmTestId: r.decisionConfirm,
244
+ reasonTestId: r.decisionReason
245
+ }),
246
+ /* @__PURE__ */ c(n, {
247
+ ...U.dialog,
248
+ labels: { cancelButton: h.actions.decisionDialog.cancelButton },
249
+ testId: r.deleteDraftDialog,
250
+ confirmTestId: r.deleteDraftConfirm
251
+ }),
252
+ /* @__PURE__ */ c(le, { ...V.dialogProps }),
253
+ p && D ? /* @__PURE__ */ c(pe, {
254
+ ref: F,
255
+ payable: D,
256
+ poweredByBankName: je,
257
+ labels: h.payBill
258
+ }) : null
259
+ ] });
82
260
  }
83
261
  //#endregion
84
- export { a as mapPayableToBillDetails };
262
+ 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";