@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,104 +1,38 @@
1
- "use client";
2
- "use client";
3
- "use client";
4
- "use client";
5
- import { calculateTotal as e, displayLineAmount as t, parseMoneyToMinorUnits as n } from "./index34.js";
6
- import { emptyLineItem as r, mapPayableToBillForm as i } from "./index37.js";
7
- import { useCallback as a, useEffect as o, useMemo as s, useState as c } from "react";
8
1
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index38.js
9
- function l(e, r, i) {
10
- return n(r) === null ? i : t(e, r);
2
+ function e() {
3
+ return {
4
+ id: crypto.randomUUID(),
5
+ description: "",
6
+ glCode: "",
7
+ quantity: "1",
8
+ price: "",
9
+ amount: ""
10
+ };
11
+ }
12
+ function t(e) {
13
+ return typeof e == "number" ? (e / 100).toFixed(2) : "";
11
14
  }
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
- ]);
15
+ function n({ payable: n, lineItems: r }) {
16
+ let i = {
17
+ invoiceNumber: n.document_id ?? "",
18
+ invoiceDate: n.issued_at ?? "",
19
+ dueDate: n.due_date ?? "",
20
+ poNumber: ""
21
+ }, a = r.map((e) => ({
22
+ id: e.id,
23
+ description: e.name ?? "",
24
+ glCode: e.ledger_account_id ?? "",
25
+ quantity: e.quantity == null ? "" : String(e.quantity),
26
+ price: t(e.unit_price),
27
+ amount: t(e.subtotal)
28
+ }));
82
29
  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
30
+ values: i,
31
+ lineItems: a.length ? a : [e()],
32
+ discount: t(n.discount),
33
+ tax: t(n.tax_amount),
34
+ total: t(n.total_amount)
101
35
  };
102
36
  }
103
37
  //#endregion
104
- export { u as useBillForm };
38
+ export { e as emptyLineItem, n as mapPayableToBillForm };
@@ -1,15 +1,104 @@
1
+ "use client";
2
+ "use client";
3
+ "use client";
4
+ "use client";
5
+ import { calculateTotal as e, displayLineAmount as t, parseMoneyToMinorUnits as n } from "./index35.js";
6
+ import { emptyLineItem as r, mapPayableToBillForm as i } from "./index38.js";
7
+ import { useCallback as a, useEffect as o, useMemo as s, useState as c } from "react";
1
8
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index39.js
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"
13
- };
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
+ }
14
103
  //#endregion
15
- export { e as billCreateTestIds };
104
+ export { u as useBillForm };
@@ -1,244 +1,15 @@
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 "./index36.js";
27
- import { useBillForm as me } from "./index38.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 "./index31.js";
37
- import { usePaymentInstructionsForm as Ce } from "./index32.js";
38
- import { billCreateTestIds as i } from "./index39.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
1
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index40.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]), U = he({
83
- payableId: F,
84
- approvalPolicyId: k?.approval_policy_id,
85
- enabled: m,
86
- copy: g.approvalPolicyCopy
87
- }), { actions: Me, decisionDialog: Ne } = _e({
88
- payableId: F,
89
- status: k?.status,
90
- currentApprovalRequestId: I.id,
91
- isPolicyApprover: I.isPolicyApprover,
92
- hasWaitingRequest: I.hasWaitingRequest,
93
- hasScheduledPayment: R.hasScheduledPayment,
94
- scheduledPaymentRecordId: R.scheduledPaymentRecordId,
95
- isScheduledPaymentUnknown: R.isResolving,
96
- pendingApprovers: U.pendingApprovers,
97
- labels: g.actions,
98
- onPayBillSelect: () => Ee(z) || !H ? L.current?.open() : B.open()
99
- }), W = ve({
100
- payableId: T,
101
- status: k?.status,
102
- enabled: !m,
103
- labels: g.deleteDraft,
104
- onDeleted: () => f(!1)
105
- }), G = o(() => (O.data?.data ?? []).map((e) => ({
106
- value: e.id,
107
- label: [e.nominal_code, e.name].filter(Boolean).join(" — ")
108
- })), [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), [
109
- K.data,
110
- q.data,
111
- g.history
112
- ]), Fe = o(() => m && k ? ye({
113
- payable: k,
114
- lineItems: D.lineItems,
115
- glCodeOptions: G,
116
- history: J,
117
- approvalPolicy: U.view,
118
- labels: g.detail,
119
- hasScheduledPayment: R.hasScheduledPayment
120
- }) : void 0, [
121
- R.hasScheduledPayment,
122
- U.view,
123
- g.detail,
124
- G,
125
- J,
126
- D.lineItems,
127
- k,
128
- m
129
- ]), 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(() => {
130
- let e = A.isDirty || M.hasUnsavedVendorChanges || !!N.stagedFile;
131
- !m && e && !window.confirm(g.discardConfirm) || f(!1);
132
- }, [
133
- N.stagedFile,
134
- g.discardConfirm,
135
- A.isDirty,
136
- f,
137
- m,
138
- M.hasUnsavedVendorChanges
139
- ]), Re = a((e) => {
140
- if (!P) return e ? f(!0) : Z();
141
- }, [
142
- Z,
143
- P,
144
- f
145
- ]), Q = !!Oe && !Ae, $ = !m && Y && !ke, ze = Q || $ ? /* @__PURE__ */ u(c, { children: [Q ? /* @__PURE__ */ l(oe, {
146
- onNotADuplicate: m ? void 0 : () => S(!0),
147
- onRemoveBill: m ? void 0 : () => S(!0),
148
- testId: i.duplicateNotice
149
- }) : null, $ ? /* @__PURE__ */ l(se, { onDismiss: () => x(!0) }) : null] }) : void 0;
150
- return /* @__PURE__ */ u(c, { children: [
151
- /* @__PURE__ */ l(ae, {
152
- open: d,
153
- onOpenChange: Re,
154
- title: Ie,
155
- subtitle: Le,
156
- notice: ze,
157
- vendor: {
158
- ...M,
159
- testId: i.vendorSection
160
- },
161
- values: A.values,
162
- errors: A.errors,
163
- onChange: A.onChange,
164
- lineItems: {
165
- items: A.lineItemRows,
166
- glCodeOptions: G,
167
- discount: A.discount,
168
- onDiscountChange: A.onDiscountChange,
169
- tax: A.tax,
170
- onTaxChange: A.onTaxChange,
171
- total: A.total,
172
- onTotalChange: A.onTotalChange,
173
- onAddLineItem: A.onAddLineItem,
174
- errors: A.lineItemErrors,
175
- testId: i.lineItems
176
- },
177
- documentPanel: /* @__PURE__ */ l(xe, {
178
- payableId: T,
179
- readOnly: m,
180
- isDocumentPending: !!T && !k?.file && (E.isLoading || k?.ocr_status === "processing"),
181
- file: k?.file ? {
182
- id: k.file.id,
183
- name: k.file.name,
184
- url: k.file.url,
185
- mimetype: k.file.mimetype
186
- } : void 0,
187
- staging: {
188
- stagedFile: N.stagedFile,
189
- onFileStaged: N.stageFile,
190
- onClearStagedFile: N.clearStagedFile,
191
- isSaving: P
192
- }
193
- }),
194
- menuItems: W.menuItems,
195
- readOnly: m,
196
- detail: m ? {
197
- view: Fe,
198
- actions: Me,
199
- scheduledSummary: R.hasScheduledPayment && R.scheduledDateLabel ? g.scheduledSummary(R.scheduledDateLabel) : void 0,
200
- paymentInstructionsForm: j && H ? {
201
- isOpen: B.isOpen,
202
- values: B.values,
203
- errors: B.errors,
204
- isSaving: B.isSaving,
205
- onOpen: B.open,
206
- onCancel: B.close,
207
- onChange: B.onChange,
208
- onSave: B.save
209
- } : void 0,
210
- isLoading: E.isLoading || D.isResolving || O.isResolving,
211
- isError: E.isError || D.isError || O.isError
212
- } : void 0,
213
- isLineItemsLoading: D.isResolving,
214
- isSaving: P,
215
- isSavingDraft: N.isSavingDraft,
216
- isFinalizing: N.isFinalizing,
217
- onCancel: Z,
218
- onSaveDraft: N.saveDraft,
219
- onFinalize: N.finalize,
220
- testId: i.dialog
221
- }),
222
- /* @__PURE__ */ l(n, {
223
- ...Ne,
224
- labels: { cancelButton: g.actions.decisionDialog.cancelButton },
225
- testId: i.decisionDialog,
226
- confirmTestId: i.decisionConfirm,
227
- reasonTestId: i.decisionReason
228
- }),
229
- /* @__PURE__ */ l(n, {
230
- ...W.dialog,
231
- labels: { cancelButton: g.actions.decisionDialog.cancelButton },
232
- testId: i.deleteDraftDialog,
233
- confirmTestId: i.deleteDraftConfirm
234
- }),
235
- m && k ? /* @__PURE__ */ l(de, {
236
- ref: L,
237
- payable: k,
238
- poweredByBankName: De,
239
- labels: g.payBill
240
- }) : null
241
- ] });
242
- }
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"
13
+ };
243
14
  //#endregion
244
- export { d as BillCreateDialog, d as default };
15
+ export { e as billCreateTestIds };