@tesouro/embedded-components-react 0.5.303 → 0.5.305

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 (52) hide show
  1. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index.js +9 -9
  2. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index12.js +7 -7
  3. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index13.js +10 -9
  4. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index14.js +8 -7
  5. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index15.js +7 -8
  6. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index16.js +8 -28
  7. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index17.js +24 -157
  8. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index18.js +20 -13
  9. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index19.js +13 -34
  10. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index20.js +153 -89
  11. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index21.js +17 -83
  12. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index22.js +23 -3
  13. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index23.js +42 -55
  14. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index24.js +93 -107
  15. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index25.js +77 -185
  16. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index26.js +3 -80
  17. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index27.js +55 -72
  18. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index28.js +111 -113
  19. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index29.js +184 -463
  20. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index3.js +14 -4
  21. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index30.js +78 -11
  22. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index31.js +61 -74
  23. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index32.js +115 -80
  24. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index33.js +449 -216
  25. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index34.js +116 -42
  26. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index35.js +11 -249
  27. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index36.js +85 -23
  28. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index37.js +80 -648
  29. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index38.js +240 -4
  30. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index39.js +44 -40
  31. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index4.js +38 -15
  32. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index40.js +242 -240
  33. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index41.js +25 -3
  34. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index42.js +538 -3
  35. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index43.js +3 -66
  36. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index44.js +42 -1
  37. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index45.js +239 -0
  38. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index46.js +3 -0
  39. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index47.js +5 -0
  40. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index48.js +67 -0
  41. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index49.js +1 -0
  42. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index5.js +227 -38
  43. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index6.js +82 -224
  44. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index7.js +45 -82
  45. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index8.js +4 -47
  46. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index9.js +1 -1
  47. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/ui/dist/index.js +2 -2
  48. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/ui/dist/index29.js +1 -1
  49. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/ui/dist/index31.js +2 -2
  50. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/lib/BillPayWidgetNative/BillsTab.js +6 -6
  51. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  52. package/package.json +1 -1
@@ -1,16 +1,83 @@
1
+ "use client";
2
+ "use client";
3
+ "use client";
4
+ "use client";
5
+ import { createSourceDocumentPreview as e } from "./index28.js";
6
+ import { SourceDocumentPanel as t } from "../../ui/dist/index49.js";
7
+ import "../../ui/dist/index.js";
8
+ import { SOURCE_DOCUMENT_CONTAINER_LABELS_EN as n } from "./index29.js";
9
+ import { useAttachPayableFileMutation as r } from "../../data-access/dist/index5.js";
10
+ import "../../data-access/dist/index.js";
11
+ import { useEffect as i, useState as a } from "react";
12
+ import { jsx as o } from "react/jsx-runtime";
1
13
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index30.js
2
- function e(e) {
3
- return new Promise((t, n) => {
4
- let r = new FileReader();
5
- r.onerror = () => n(r.error ?? /* @__PURE__ */ Error("Failed to read file")), r.onload = () => {
6
- let e = r.result;
7
- if (typeof e != "string") {
8
- n(/* @__PURE__ */ Error("Failed to read file as a data URL"));
9
- return;
14
+ function s(e) {
15
+ let [t, n] = a();
16
+ return i(() => {
17
+ if (!e) {
18
+ n(void 0);
19
+ return;
20
+ }
21
+ let t = URL.createObjectURL(e);
22
+ return n(t), () => URL.revokeObjectURL(t);
23
+ }, [e]), t;
24
+ }
25
+ function c({ payableId: i, file: a, isDocumentPending: c, pendingFileName: l, readOnly: u, staging: d, deletion: f, labels: p }) {
26
+ let { stagedFile: m, onFileStaged: h, onClearStagedFile: g, isSaving: _ } = d ?? {}, { isPending: v, onRequest: y, onDetachNow: b, isDeleting: x, hasFailed: S } = f ?? {}, C = {
27
+ ...n,
28
+ ...p,
29
+ preview: {
30
+ ...n.preview,
31
+ ...p?.preview
32
+ }
33
+ }, w = r(), T = s(m), E = !!(a && !v || m);
34
+ if (!E && (c || w.isPending)) return /* @__PURE__ */ o(t, {
35
+ mode: "loading",
36
+ fileName: l,
37
+ labels: p?.panel
38
+ });
39
+ if (!E && u) return /* @__PURE__ */ o("div", {
40
+ className: "ttw:rounded-lg ttw:border ttw:border-border ttw:bg-card ttw:p-4 ttw:text-sm ttw:text-muted-foreground",
41
+ children: C.noDocument
42
+ });
43
+ if (!E) return /* @__PURE__ */ o(t, {
44
+ mode: "upload",
45
+ labels: p?.panel,
46
+ uploadStatus: w.isPending || x ? "uploading" : "idle",
47
+ uploadErrorMessage: w.isError ? C.attachFailed : S ? C.deleteFailed : void 0,
48
+ noticeMessage: v && !S ? C.pendingDeletionNotice : void 0,
49
+ onFilesSelected: (e) => {
50
+ let [t] = e;
51
+ if (t) {
52
+ if (i) {
53
+ let e = () => w.mutate({
54
+ path: { payable_id: i },
55
+ file: t
56
+ });
57
+ if (v && b) {
58
+ b().then(e, () => void 0);
59
+ return;
60
+ }
61
+ e();
62
+ } else h?.(t);
10
63
  }
11
- t(e.slice(e.indexOf(",") + 1));
12
- }, r.readAsDataURL(e);
64
+ }
65
+ });
66
+ let D = a?.name ?? m?.name ?? "", O = e(a || {
67
+ name: D,
68
+ url: T ?? "",
69
+ mimetype: m?.type ?? ""
70
+ }, C.preview);
71
+ return /* @__PURE__ */ o(t, {
72
+ mode: "document",
73
+ labels: p?.panel,
74
+ fileName: D,
75
+ preview: O,
76
+ isDeleting: x,
77
+ deleteErrorMessage: S ? C.deleteFailed : void 0,
78
+ onDownload: a ? () => window.open(a.url, "_blank", "noopener,noreferrer") : void 0,
79
+ onDelete: u ? void 0 : a && i ? y : _ ? void 0 : g
13
80
  });
14
81
  }
15
82
  //#endregion
16
- export { e as encodeFileToBase64 };
83
+ export { c as SourceDocumentContainer, c as default };
@@ -1,87 +1,74 @@
1
- import { parseDecimalAmountToMinorUnits as e } from "../../../../shared/util/dist/lib/parseDecimalAmountToMinorUnits.js";
1
+ import { isStateValid as e } from "../../../../shared/util/dist/lib/usStates.js";
2
+ import { emptyCounterpartFormValues as t, hasCounterpartFormErrors as n, validateCounterpartForm as r } from "../../../../shared/counterpart-management/feature/dist/lib/helpers.js";
3
+ import "../../../../shared/counterpart-management/feature/dist/index.js";
2
4
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index31.js
3
- var t = "USD";
4
- function n(n) {
5
- return e(n, t);
6
- }
7
- function r(e) {
8
- let t = e.trim();
9
- if (!t) return null;
10
- let n = Number(t);
11
- return Number.isFinite(n) && n > 0 ? n : null;
12
- }
13
5
  function i(e) {
14
- return !!(e.description.trim() || e.glCode.trim() || n(e.price) !== null || n(e.amount) !== null);
6
+ return e?.trim() ?? "";
15
7
  }
16
- function a(e) {
17
- return n(e) ?? 0;
8
+ function a(t) {
9
+ let n = i(t).toUpperCase();
10
+ return e(n) ? n : "";
18
11
  }
19
12
  function o(e) {
20
- let t = Number.parseFloat(e);
21
- return Number.isFinite(t) ? t : 0;
13
+ let t = i(e.bank_account?.account_holder_name), n = i(e.bank_account?.routing_number), r = i(e.bank_account?.account_number);
14
+ if (t || n || r) return {
15
+ accountHolderName: t || i(e.name),
16
+ routingNumber: n,
17
+ accountNumber: r
18
+ };
22
19
  }
23
20
  function s(e) {
24
- let t = n(e);
25
- return t === null ? e : c(t);
21
+ if (!e) return;
22
+ let t = {
23
+ legalName: i(e.name),
24
+ email: i(e.email),
25
+ phone: i(e.phone),
26
+ address: {
27
+ line1: i(e.address?.line1),
28
+ line2: i(e.address?.line2),
29
+ city: i(e.address?.city),
30
+ state: a(e.address?.state),
31
+ postalCode: i(e.address?.postal_code)
32
+ },
33
+ bankAccount: o(e)
34
+ };
35
+ return t.legalName || t.email || t.phone || Object.values(t.address).some(Boolean) || t.bankAccount ? t : void 0;
26
36
  }
27
37
  function c(e) {
28
- return (e / 100).toFixed(2);
29
- }
30
- function l({ values: e, initialLineItems: r, counterpartId: i, clearCounterpart: a, counterpartBankAccountId: o, editedTotals: s, currentTotals: c, lineItems: l, document: f, includeBlankPoNumber: p = !0 }) {
31
- let m = { currency: t };
32
- i ? m.counterpart_id = i : a && (m.counterpart_id = null), i ? m.counterpart_bank_account_id = o ?? null : a && (m.counterpart_bank_account_id = null), e.invoiceNumber && (m.document_id = e.invoiceNumber), e.invoiceDate && (m.issued_at = e.invoiceDate), e.dueDate && (m.due_date = e.dueDate);
33
- let h = e.poNumber.trim();
34
- if ((h || p) && (m.purchase_order_number = h || null), f && (m.base64_encoded_file = f.base64EncodedFile, m.file_name = f.fileName), s && (m.discount = n(s.discount) ?? 0, m.tax_amount = n(s.tax) ?? 0, s.total !== void 0 && (m.total_amount = n(s.total) ?? 0)), c && l) {
35
- let e = d(l), t = n(c.tax) ?? 0, r = n(c.discount) ?? 0, i = c.total === void 0 ? (e ?? 0) - r + t : n(c.total) ?? 0;
36
- e !== void 0 && (m.subtotal = e), m.discount = r, m.tax_amount = t, m.total_amount = i;
37
- } else if (r && !("total_amount" in m)) {
38
- let e = u(r, {
39
- tax: s?.tax,
40
- discount: s?.discount
41
- });
42
- e !== void 0 && (m.total_amount = e);
43
- }
44
- return m;
38
+ let a = s(e);
39
+ if (!a || i(e?.address?.country).toUpperCase() !== "US") return !1;
40
+ let o = t("organization", "vendor");
41
+ return !n(r({
42
+ ...o,
43
+ ...a,
44
+ bankAccount: {
45
+ accountHolderName: i(e?.bank_account?.account_holder_name),
46
+ routingNumber: i(e?.bank_account?.routing_number),
47
+ accountNumber: i(e?.bank_account?.account_number)
48
+ }
49
+ }, "create", void 0, "vendor"));
45
50
  }
46
- function u(e, { tax: t, discount: r }) {
47
- let i = d(e);
48
- if (i !== void 0) return i + (t ? n(t) ?? 0 : 0) - (r ? n(r) ?? 0 : 0);
49
- }
50
- function d(e) {
51
- let t = !1, r = e.reduce((e, r) => {
52
- if (!i(r)) return e;
53
- let a = n(r.amount);
54
- return a === null ? e : (t = !0, e + a);
55
- }, 0);
56
- if (t) return r;
57
- }
58
- function f({ lineItems: e, editedTotals: t }) {
59
- let r = d(e), i = n(t.tax) ?? 0, a = n(t.discount) ?? 0, o = {
60
- discount: a,
61
- tax_amount: i
51
+ function l(e, t, n) {
52
+ let r = (e) => i(e) || void 0, { address: a } = e;
53
+ return {
54
+ ...n,
55
+ name: r(e.entityType === "individual" ? `${e.firstName} ${e.lastName}` : e.legalName),
56
+ email: r(e.email),
57
+ phone: r(e.phone),
58
+ address: {
59
+ ...n?.address,
60
+ line1: r(a.line1),
61
+ line2: r(a.line2),
62
+ city: r(a.city),
63
+ state: r(a.state),
64
+ postal_code: r(a.postalCode)
65
+ },
66
+ bank_account: {
67
+ account_holder_name: r(t.accountHolderName),
68
+ routing_number: r(t.routingNumber),
69
+ account_number: r(t.accountNumber)
70
+ }
62
71
  };
63
- return r !== void 0 && (o.subtotal = r), t.total === void 0 ? r !== void 0 && (o.total_amount = r - a + i) : o.total_amount = n(t.total) ?? 0, o;
64
- }
65
- function p(e) {
66
- return e.filter(i).map((e) => {
67
- let t = n(e.amount), i = r(e.quantity) ?? 1, a = n(e.price) ?? (t === null ? 0 : Math.round(t / i)), o = Math.round(i * a), s = t ?? o;
68
- return {
69
- name: e.description,
70
- quantity: i,
71
- unit_price: a,
72
- tax: 0,
73
- subtotal: s,
74
- tax_amount: 0,
75
- total: s,
76
- ...e.glCode ? { ledger_account_id: e.glCode } : {}
77
- };
78
- });
79
- }
80
- function m(e, t) {
81
- return c(Math.round(o(e) * a(t)));
82
- }
83
- function h(e, t, n) {
84
- return c(e.reduce((e, t) => e + a(t.amount), 0) + a(t) - a(n));
85
72
  }
86
73
  //#endregion
87
- export { h as calculateTotal, m as displayLineAmount, i as isPersistableLineItem, l as mapBillFormToPayload, p as mapLineItemsToPayload, f as mapPayableAmountFieldsToPayload, s as normalizeMoneyOnBlur, n as parseMoneyToMinorUnits, r as parseQuantity };
74
+ export { s as buildVendorPrefill, c as canAutoCreateVendor, l as toCounterpartRawData };
@@ -1,83 +1,118 @@
1
- import { BILL_CREATE_MESSAGE_LABELS_EN as e } from "./index25.js";
2
- import { isPersistableLineItem as t, parseMoneyToMinorUnits as n, parseQuantity as r } from "./index31.js";
1
+ "use client";
2
+ "use client";
3
+ "use client";
4
+ "use client";
5
+ import { Button as e } from "../../../../../../packages/shared-ui-shadcn/dist/index.js";
6
+ import { getStateOptions as t } from "../../../../shared/util/dist/lib/usStates.js";
7
+ import { AchFieldGroup as n } from "../../../../shared/counterpart-management/ui/dist/index5.js";
8
+ import { CounterpartFormFields as r, countErrors as i, useFocusFirstInvalidField as a } from "../../../../shared/counterpart-management/ui/dist/index9.js";
9
+ import "../../../../shared/counterpart-management/ui/dist/index.js";
10
+ import { VendorSearchCombobox as o } from "../../ui/dist/index24.js";
11
+ import "../../ui/dist/index.js";
12
+ import { mergeVendorInlineFormLabels as s } from "./index29.js";
13
+ import "../../../../shared/counterpart-management/feature/dist/index.js";
14
+ import { useMemo as c } from "react";
15
+ import { jsx as l, jsxs as u } from "react/jsx-runtime";
3
16
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index32.js
4
- var i = /^(?:\d{1,3}(?:,\d{3})+(?:\.\d+)?|\d+(?:\.\d+)?|\.\d+)$/, a = 255, o = 10, s = 5, c = 30, l = 864e5;
5
- function u() {
6
- let e = /* @__PURE__ */ new Date();
7
- return Date.UTC(e.getFullYear(), e.getMonth(), e.getDate());
8
- }
9
- function d() {
10
- let e = new Date(u());
11
- return e.setUTCFullYear(e.getUTCFullYear() - o), e;
12
- }
13
- function f(e) {
14
- let t = new Date(e);
15
- if (Number.isNaN(t.getTime())) return !1;
16
- let n = new Date(u() + c * l);
17
- return t < d() || t > n;
18
- }
19
- function p(e) {
20
- let t = new Date(e);
21
- if (Number.isNaN(t.getTime())) return !1;
22
- let n = new Date(u());
23
- return n.setUTCFullYear(n.getUTCFullYear() + s), t < d() || t > n;
24
- }
25
- function m(t, n = e) {
26
- let r = {};
27
- return t.poNumber.length > a && (r.poNumber = n.poNumberTooLong), Object.keys(r).length ? r : void 0;
28
- }
29
- function h(e) {
30
- let t = e.trim();
31
- return !t || n(t) !== null ? !0 : i.test(t) ? Number(t.replaceAll(",", "")) === 0 : !1;
32
- }
33
- function g(t, i = e) {
34
- let a = {};
35
- for (let e of t) {
36
- let t = n(e.price), o = n(e.amount), s = {};
37
- e.price.trim() && t === null && (s.price = i.unreadableMoney), e.amount.trim() && o === null && (s.amount = i.unreadableMoney), r(e.quantity) === null && (e.quantity.trim() || t !== null || o !== null) && (s.quantity = i.unusableQuantity), Object.keys(s).length && (a[e.id] = s);
38
- }
39
- return Object.keys(a).length ? a : void 0;
40
- }
41
- function _(i, a, o, s = e) {
42
- let c = {};
43
- a || (c.vendor = s.requiredField), i.invoiceNumber.trim() || (c.invoiceNumber = s.requiredField);
44
- let l = i.invoiceDate.trim(), u = i.dueDate.trim();
45
- l ? f(l) && (c.invoiceDate = s.implausibleInvoiceDate) : c.invoiceDate = s.requiredField, u ? p(u) ? c.dueDate = s.implausibleDueDate : l && u < l && (c.dueDate = s.dueBeforeInvoiceDate) : c.dueDate = s.requiredField;
46
- let d = {};
47
- return o.forEach((e, i) => {
48
- if (i > 0 && !t(e)) return;
49
- let a = {};
50
- e.description.trim() || (a.description = s.requiredField), r(e.quantity) === null && (a.quantity = s.requiredField), n(e.price) === null && n(e.amount) === null && (a.price = s.requiredField, a.amount = s.requiredField), Object.keys(a).length && (d[e.id] = a);
51
- }), {
52
- formErrors: Object.keys(c).length ? c : void 0,
53
- lineItemErrors: Object.keys(d).length ? d : void 0
54
- };
55
- }
56
- function v(e) {
57
- let t = e.trim();
58
- if (!t) return !0;
59
- let n = t.startsWith("-") ? t.slice(1) : t;
60
- return i.test(n) ? Number(t.replaceAll(",", "")) <= 0 : !1;
61
- }
62
- function y(e, t) {
63
- if (n(e) === null) return v(e) ? t.totalNotGreaterThanZero : t.unreadableTotal;
64
- }
65
- function b(t, n = e) {
66
- let r = y(t, n);
67
- return r ? { total: r } : void 0;
68
- }
69
- function x(t, r = e) {
70
- if (t === void 0) return;
71
- let i = n(t);
72
- if (i !== null) return i > 0 ? void 0 : { total: r.totalNotGreaterThanZero };
73
- }
74
- function S(t, n, r, i = e) {
75
- let a = {};
76
- if (h(t) || (a.discount = i.unreadableDiscount), h(n) || (a.tax = i.unreadableTax), r !== void 0) {
77
- let e = y(r, i);
78
- e && (a.total = e);
79
- }
80
- return Object.keys(a).length ? a : void 0;
17
+ function d({ mode: d, values: f, errors: p, onChange: m, onAddressChange: h, sectionsToExpand: g, onAddressExpand: _, onCancel: v, onSave: y, isSaving: b = !1, search: x, paymentInstructions: S, labels: C }) {
18
+ let w = c(() => s(C), [C]), T = c(() => t(), []), E = a(p ?? {}), D = i({
19
+ ...p,
20
+ form: void 0,
21
+ bankAccount: void 0
22
+ }) + i(S?.errors), O = x?.query.trim() ?? "", k = f.entityType === "individual" ? `${f.firstName} ${f.lastName}`.trim() : f.legalName, A = x && d === "create" ? /* @__PURE__ */ l(o, {
23
+ ...x,
24
+ onAddVendor: O && O !== k.trim() ? x.onAddVendor : void 0,
25
+ selectedLabel: k,
26
+ badge: w.newVendorBadge,
27
+ helperText: w.unmatchedVendorHelper,
28
+ resultsHeading: w.resultsHeading,
29
+ addVendorDescription: w.addAsNewVendorDescription,
30
+ labels: {
31
+ fieldLabel: w.vendorFieldLabel,
32
+ addVendorAction: w.addAsNewVendor(O)
33
+ }
34
+ }) : null;
35
+ return /* @__PURE__ */ u("div", {
36
+ ref: E,
37
+ className: "ttw:flex ttw:flex-col ttw:gap-4",
38
+ children: [A, /* @__PURE__ */ u("div", {
39
+ className: "ttw:flex ttw:flex-col ttw:gap-6 ttw:rounded-lg ttw:border ttw:border-primary ttw:bg-surface-subtle ttw:p-6 ttw:[&_[data-slot=input]]:bg-background ttw:[&_[data-slot=select-trigger]]:bg-background",
40
+ children: [
41
+ /* @__PURE__ */ u("div", {
42
+ className: "ttw:flex ttw:items-baseline ttw:justify-between ttw:gap-2",
43
+ children: [/* @__PURE__ */ l("p", {
44
+ className: "ttw:text-base ttw:font-semibold ttw:text-foreground",
45
+ children: d === "edit" ? w.editTitle : w.createTitle
46
+ }), D > 0 ? /* @__PURE__ */ l("p", {
47
+ className: "ttw:text-sm ttw:text-destructive",
48
+ children: w.fieldsNeedAttention(D)
49
+ }) : null]
50
+ }),
51
+ x && d === "edit" ? /* @__PURE__ */ l(o, {
52
+ ...x,
53
+ labels: { fieldLabel: w.switchVendorFieldLabel }
54
+ }) : null,
55
+ /* @__PURE__ */ l(r, {
56
+ mode: d,
57
+ counterpartMode: "vendor",
58
+ values: f,
59
+ errors: p,
60
+ stateOptions: T,
61
+ onChange: m,
62
+ onAddressChange: h,
63
+ sections: {
64
+ entityType: !0,
65
+ profileHeading: !1,
66
+ addressHeading: !1,
67
+ title: !1,
68
+ taxId: !1,
69
+ address: d !== "edit" || "collapsible",
70
+ bankAccount: !1
71
+ },
72
+ sectionsToExpand: g,
73
+ onAddressExpand: _,
74
+ labels: { businessNameLabel: w.nameLabel }
75
+ }),
76
+ S ? /* @__PURE__ */ u("div", {
77
+ className: "ttw:flex ttw:flex-col ttw:gap-3",
78
+ children: [/* @__PURE__ */ u("div", {
79
+ className: "ttw:flex ttw:flex-col ttw:gap-1",
80
+ children: [/* @__PURE__ */ l("p", {
81
+ className: "ttw:text-sm ttw:font-semibold ttw:text-foreground",
82
+ children: w.paymentInstructionsHeading
83
+ }), /* @__PURE__ */ l("p", {
84
+ className: "ttw:text-sm ttw:text-muted-foreground",
85
+ children: S.isExtracted ? w.paymentInstructionsExtracted : w.paymentInstructionsDescription
86
+ })]
87
+ }), /* @__PURE__ */ l(n, {
88
+ idPrefix: "vendor-inline-ach",
89
+ values: S.values,
90
+ errors: S.errors,
91
+ onChange: S.onChange,
92
+ labels: w.ach
93
+ })]
94
+ }) : null,
95
+ /* @__PURE__ */ u("div", {
96
+ className: "ttw:flex ttw:justify-end ttw:gap-2",
97
+ children: [/* @__PURE__ */ l(e, {
98
+ type: "button",
99
+ variant: "outline",
100
+ onClick: v,
101
+ "aria-label": w.cancelAriaLabel,
102
+ disabled: b,
103
+ children: w.cancel
104
+ }), y ? /* @__PURE__ */ l(e, {
105
+ type: "button",
106
+ onClick: y,
107
+ "aria-label": w.saveAriaLabel,
108
+ loading: b,
109
+ disabled: b,
110
+ children: w.save
111
+ }) : null]
112
+ })
113
+ ]
114
+ })]
115
+ });
81
116
  }
82
117
  //#endregion
83
- export { h as isReadableMoneyOrZero, _ as validateBillCompleteness, b as validateBillTotalIsPayable, S as validateBillTotals, m as validateBillValues, g as validateLineItems, x as validateStoredAmountDue };
118
+ export { d as VendorInlineForm, d as default };