@tesouro/embedded-components-react 0.5.46 → 0.5.48

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 (58) hide show
  1. package/dist/index.css +56 -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 +8 -8
  5. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index34.js +3 -3
  6. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index45.js +7 -49
  7. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index47.js +46 -36
  8. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index48.js +34 -184
  9. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index49.js +163 -75
  10. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index50.js +75 -21
  11. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index51.js +22 -93
  12. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index52.js +88 -317
  13. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index53.js +322 -12
  14. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index54.js +12 -64
  15. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index55.js +57 -50
  16. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index56.js +52 -214
  17. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index57.js +215 -35
  18. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index58.js +35 -234
  19. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index59.js +240 -21
  20. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index60.js +21 -532
  21. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index61.js +536 -4
  22. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index62.js +4 -42
  23. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index63.js +38 -230
  24. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index64.js +234 -3
  25. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index65.js +3 -4
  26. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index66.js +2 -44
  27. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index67.js +46 -1
  28. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index68.js +1 -8
  29. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index69.js +6 -11
  30. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index70.js +11 -127
  31. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index71.js +129 -3
  32. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index72.js +3 -127
  33. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index73.js +124 -8
  34. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index74.js +8 -7
  35. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index75.js +8 -47
  36. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index76.js +44 -18
  37. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index77.js +20 -28
  38. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index78.js +27 -82
  39. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index79.js +83 -47
  40. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index80.js +47 -250
  41. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index81.js +241 -122
  42. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index82.js +125 -211
  43. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index83.js +219 -3
  44. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index84.js +4 -7
  45. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index85.js +5 -98
  46. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index86.js +100 -1
  47. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index87.js +0 -26
  48. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index88.js +27 -0
  49. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index.js +28 -28
  50. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index3.js +12 -8
  51. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index64.js +1 -0
  52. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index82.js +242 -210
  53. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/index.js +4 -4
  54. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  55. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/user/useOrganizationUserNames.js +13 -1
  56. package/dist/libs/tesouro-embedded-components-react/shared/util/dist/lib/auditHistory/buildPayableAuditHistory.js +137 -0
  57. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index8.js +1 -1
  58. package/package.json +1 -1
@@ -1,80 +1,168 @@
1
- "use client";
2
- "use client";
3
- "use client";
4
- "use client";
5
- import { useAttachPayableFileMutation as e } from "../../data-access/dist/index13.js";
6
- import "../../data-access/dist/index.js";
7
- import { SourceDocumentPanel as t } from "../../ui/dist/index109.js";
1
+ import { ACH_FIELD_GROUP_LABELS_EN as e } from "../../../shared/counterpart-management/ui/dist/index2.js";
2
+ import "../../../shared/counterpart-management/ui/dist/index.js";
3
+ import { DISCARD_CHANGES_DIALOG_LABELS_EN as t } from "../../ui/dist/index66.js";
4
+ import { BILL_REJECTED_BANNER_LABELS_EN as n } from "../../ui/dist/index74.js";
5
+ import { UNSAVED_BILL_DIALOG_LABELS_EN as r } from "../../ui/dist/index111.js";
8
6
  import "../../ui/dist/index.js";
9
- import { createSourceDocumentPreview as n } from "./index47.js";
10
- import { SOURCE_DOCUMENT_CONTAINER_LABELS_EN as r } from "./index48.js";
11
- import { useEffect as i, useState as a } from "react";
12
- import { jsx as o } from "react/jsx-runtime";
7
+ import { PAY_BILL_FLOW_LABELS_EN as i, mergePayBillFlowLabels as a } from "./index25.js";
8
+ import { MARK_AS_PAID_FLOW_LABELS_EN as o, mergeMarkAsPaidFlowLabels as s } from "./index15.js";
9
+ import "./index18.js";
10
+ import { APPROVAL_POLICY_RULE_COPY_EN as c } from "./index29.js";
11
+ import { AWAITING_APPROVAL_LABEL_EN as l, AWAITING_APPROVAL_UNKNOWN_LABEL_EN as u, BILL_DETAIL_ACTIONS_LABELS_EN as d, PAYMENT_HISTORY_LABELS_EN as f, SCHEDULED_STATUS_BADGE_LABEL_EN as p, SCHEDULED_SUMMARY_LABEL_EN as m, mergeBillDetailActionsLabels as h, mergePaymentHistoryMethodLabels as g } from "./index46.js";
12
+ import { PAYABLE_AUDIT_HISTORY_LABELS_EN as _ } from "./index47.js";
13
+ import { SOURCE_DOCUMENT_PREVIEW_LABELS_EN as v } from "./index48.js";
13
14
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index49.js
14
- function s(e) {
15
- let [t, n] = a();
16
- return i(() => {
17
- if (!e) {
18
- n(void 0);
19
- return;
15
+ var y = {
16
+ unmappedValidationError: (e, t) => `${e}: ${t}`,
17
+ unknownValidationField: "(unknown field)",
18
+ requiredField: "This field is required.",
19
+ saveFailed: "We could not save this bill. Try again.",
20
+ discountTaxBlockedByLineItems: "Discount and Tax can't be saved on a bill with line items. Remove them, then save again.",
21
+ finalizeFailed: "We could not submit this bill. Try again.",
22
+ draftSaved: "Bill saved as a draft.",
23
+ submittedSaved: "Bill updated.",
24
+ submittedDemoted: "Bill updated. It moved back to Drafts because some required details are missing.",
25
+ billFinalized: "Bill submitted for approval.",
26
+ numbersOnly: "Enter numbers only.",
27
+ unreadableMoney: "Enter a valid amount.",
28
+ unusableQuantity: "Enter a quantity greater than 0.",
29
+ lineItemsNeedAttention: "Check the highlighted line items before saving.",
30
+ unreadableDiscount: "Enter a valid discount amount.",
31
+ unreadableTax: "Enter a valid tax amount.",
32
+ unreadableTotal: "Enter a valid total amount.",
33
+ totalNotGreaterThanZero: "Total amount must be greater than $0.",
34
+ poNumberTooLong: "PO number must be 255 characters or fewer."
35
+ }, b = {
36
+ paymentInstructionsValue: (e) => `Account ending in ${e}`,
37
+ noMethod: "No payment method on file",
38
+ paymentMethodLoading: "Loading payment method...",
39
+ paymentMethodUnavailable: "We could not load payment methods. Try again.",
40
+ searchFailed: "We could not load vendors. Try again.",
41
+ vendorDetailsFailed: "We could not load this vendor. Try again."
42
+ }, x = {
43
+ attachFailed: "We could not attach that file. Try again.",
44
+ deleteFailed: "We could not remove that document. Try again.",
45
+ noDocument: "No document attached to this bill.",
46
+ pendingDeletionNotice: "This document will be removed when you save this bill.",
47
+ preview: v
48
+ }, S = {
49
+ ...f,
50
+ historyDateTime: (e, t) => `${e}, ${t}`,
51
+ historyWithMeta: (e, t) => `${e} · ${t}`,
52
+ notProvided: "Not provided",
53
+ paymentInstructionsValue: (e) => `Account ending in ${e}`,
54
+ paymentInstructionsNotSet: "Not set",
55
+ invoiceDateRow: "Invoice date",
56
+ dueDateRow: "Due date",
57
+ invoiceNumberRow: "Invoice number",
58
+ glCodeMissing: "GL code not specified",
59
+ glCodeUnavailable: "GL code unavailable",
60
+ qtyPriceValue: (e, t) => `${e} x ${t}`,
61
+ qtyOnlyValue: (e) => e,
62
+ subtotalRow: "Subtotal",
63
+ taxRow: "Tax",
64
+ discountRow: "Discounts",
65
+ totalRow: "Total",
66
+ paidOnLabel: (e) => `Paid on ${e}`,
67
+ paymentInstructionsSaveError: "Couldn't save payment instructions. Try again.",
68
+ paymentInstructionsLinkError: "Payment instructions were saved to the vendor, but couldn't be added to this bill. Try again.",
69
+ rejectedByOn: (e, t) => `Rejected by ${e} on ${t}`,
70
+ rejectedOn: (e) => `Rejected on ${e}`,
71
+ rejectionMessage: (e) => `"${e}"`
72
+ }, C = {
73
+ newTitle: "New bill",
74
+ extractedTitle: (e) => `Bill from ${e}`,
75
+ viewTitle: (e) => `Bill from ${e}`,
76
+ readOnlyTitle: "Bill details",
77
+ addedOn: (e) => `Added on ${e}`,
78
+ unsavedChanges: r,
79
+ discardChanges: t,
80
+ scheduledSummary: m,
81
+ scheduledStatusBadge: p,
82
+ awaitingApprovalNotice: l,
83
+ awaitingApprovalUnknownNotice: u,
84
+ actions: d,
85
+ detail: S,
86
+ history: _,
87
+ payBill: i,
88
+ markAsPaid: o,
89
+ approvalPolicyCopy: c,
90
+ deleteDraft: {
91
+ menuItem: "Delete draft",
92
+ dialog: {
93
+ title: "Delete this draft?",
94
+ description: "The draft and anything entered on it are removed. This can't be undone.",
95
+ confirmButton: "Delete draft"
96
+ },
97
+ error: "Couldn't delete this draft. Try again."
98
+ },
99
+ lineItemsGlCodeUnavailable: {
100
+ loadError: "Couldn't load GL codes",
101
+ noAccess: "You don't have access to GL codes",
102
+ empty: "No GL codes set up yet"
103
+ },
104
+ rejectedBanner: n
105
+ };
106
+ function w(e) {
107
+ return {
108
+ ...C,
109
+ ...e,
110
+ actions: h(e?.actions),
111
+ detail: {
112
+ ...C.detail,
113
+ ...e?.detail,
114
+ paymentHistoryMethodLabels: g(e?.detail?.paymentHistoryMethodLabels)
115
+ },
116
+ history: {
117
+ ...C.history,
118
+ ...e?.history
119
+ },
120
+ payBill: a(e?.payBill),
121
+ markAsPaid: s(e?.markAsPaid),
122
+ lineItemsGlCodeUnavailable: {
123
+ ...C.lineItemsGlCodeUnavailable,
124
+ ...e?.lineItemsGlCodeUnavailable
125
+ },
126
+ unsavedChanges: {
127
+ ...C.unsavedChanges,
128
+ ...e?.unsavedChanges
129
+ },
130
+ discardChanges: {
131
+ ...C.discardChanges,
132
+ ...e?.discardChanges
133
+ },
134
+ rejectedBanner: {
135
+ ...C.rejectedBanner,
136
+ ...e?.rejectedBanner
137
+ },
138
+ approvalPolicyCopy: {
139
+ ...C.approvalPolicyCopy,
140
+ ...e?.approvalPolicyCopy
141
+ },
142
+ deleteDraft: {
143
+ ...C.deleteDraft,
144
+ ...e?.deleteDraft,
145
+ dialog: (() => {
146
+ let t = {
147
+ ...C.deleteDraft.dialog,
148
+ ...e?.deleteDraft?.dialog
149
+ };
150
+ return delete t.reason, t;
151
+ })()
20
152
  }
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
- ...r,
28
- ...p,
29
- preview: {
30
- ...r.preview,
31
- ...p?.preview
32
- }
33
- }, w = e(), T = s(m), E = !!(a && !v || m);
34
- if (!E && (c || w.isPending)) return /* @__PURE__ */ o(t, {
35
- mode: "loading",
36
- fileName: l
37
- });
38
- if (!E && u) return /* @__PURE__ */ o("div", {
39
- className: "ttw:rounded-lg ttw:border ttw:border-border ttw:bg-card ttw:p-4 ttw:text-sm ttw:text-muted-foreground",
40
- children: C.noDocument
41
- });
42
- if (!E) return /* @__PURE__ */ o(t, {
43
- mode: "upload",
44
- uploadStatus: w.isPending || x ? "uploading" : "idle",
45
- uploadErrorMessage: w.isError ? C.attachFailed : S ? C.deleteFailed : void 0,
46
- noticeMessage: v && !S ? C.pendingDeletionNotice : void 0,
47
- onFilesSelected: (e) => {
48
- let [t] = e;
49
- if (t) {
50
- if (i) {
51
- let e = () => w.mutate({
52
- path: { payable_id: i },
53
- file: t
54
- });
55
- if (v && b) {
56
- b().then(e, () => void 0);
57
- return;
58
- }
59
- e();
60
- } else h?.(t);
61
- }
62
- }
63
- });
64
- let D = a?.name ?? m?.name ?? "", O = n(a || {
65
- name: D,
66
- url: T ?? "",
67
- mimetype: m?.type ?? ""
68
- }, C.preview);
69
- return /* @__PURE__ */ o(t, {
70
- mode: "document",
71
- fileName: D,
72
- preview: O,
73
- isDeleting: x,
74
- deleteErrorMessage: S ? C.deleteFailed : void 0,
75
- onDownload: a ? () => window.open(a.url, "_blank", "noopener,noreferrer") : void 0,
76
- onDelete: u ? void 0 : a && i ? y : _ ? void 0 : g
77
- });
153
+ };
78
154
  }
155
+ var T = {
156
+ createTitle: "New vendor",
157
+ editTitle: "Edit vendor",
158
+ switchVendorFieldLabel: "Switch to a different vendor",
159
+ nameLabel: "Name",
160
+ addPaymentInstructions: "Add payment instructions",
161
+ cancelPaymentInstructions: "Cancel",
162
+ ach: e,
163
+ addAddress: "Add address (optional)",
164
+ cancel: "Cancel",
165
+ cancelAriaLabel: "Cancel vendor"
166
+ };
79
167
  //#endregion
80
- export { c as SourceDocumentContainer, c as default };
168
+ export { y as BILL_CREATE_MESSAGE_LABELS_EN, C as BILL_CREATE_SCREEN_LABELS_EN, S as BILL_DETAIL_VIEW_LABELS_EN, x as SOURCE_DOCUMENT_CONTAINER_LABELS_EN, T as VENDOR_INLINE_FORM_LABELS_EN, b as VENDOR_SECTION_PROPS_LABELS_EN, w as mergeBillCreateScreenCopy };
@@ -1,26 +1,80 @@
1
+ "use client";
2
+ "use client";
3
+ "use client";
4
+ "use client";
5
+ import { useAttachPayableFileMutation as e } from "../../data-access/dist/index13.js";
6
+ import "../../data-access/dist/index.js";
7
+ import { SourceDocumentPanel as t } from "../../ui/dist/index109.js";
8
+ import "../../ui/dist/index.js";
9
+ import { createSourceDocumentPreview as n } from "./index48.js";
10
+ import { SOURCE_DOCUMENT_CONTAINER_LABELS_EN as r } from "./index49.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/feature/dist/index50.js
2
- function e(e) {
3
- return e?.trim() ?? "";
4
- }
5
- function t(t) {
6
- let n = e(t);
7
- return n.length === 2 ? n.toUpperCase() : "";
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;
8
24
  }
9
- function n(n) {
10
- if (!n) return;
11
- let r = {
12
- legalName: e(n.name),
13
- email: e(n.email),
14
- phone: e(n.phone),
15
- address: {
16
- line1: e(n.address?.line1),
17
- line2: e(n.address?.line2),
18
- city: e(n.address?.city),
19
- state: t(n.address?.state),
20
- postalCode: e(n.address?.postal_code)
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
+ ...r,
28
+ ...p,
29
+ preview: {
30
+ ...r.preview,
31
+ ...p?.preview
32
+ }
33
+ }, w = e(), T = s(m), E = !!(a && !v || m);
34
+ if (!E && (c || w.isPending)) return /* @__PURE__ */ o(t, {
35
+ mode: "loading",
36
+ fileName: l
37
+ });
38
+ if (!E && u) return /* @__PURE__ */ o("div", {
39
+ className: "ttw:rounded-lg ttw:border ttw:border-border ttw:bg-card ttw:p-4 ttw:text-sm ttw:text-muted-foreground",
40
+ children: C.noDocument
41
+ });
42
+ if (!E) return /* @__PURE__ */ o(t, {
43
+ mode: "upload",
44
+ uploadStatus: w.isPending || x ? "uploading" : "idle",
45
+ uploadErrorMessage: w.isError ? C.attachFailed : S ? C.deleteFailed : void 0,
46
+ noticeMessage: v && !S ? C.pendingDeletionNotice : void 0,
47
+ onFilesSelected: (e) => {
48
+ let [t] = e;
49
+ if (t) {
50
+ if (i) {
51
+ let e = () => w.mutate({
52
+ path: { payable_id: i },
53
+ file: t
54
+ });
55
+ if (v && b) {
56
+ b().then(e, () => void 0);
57
+ return;
58
+ }
59
+ e();
60
+ } else h?.(t);
61
+ }
21
62
  }
22
- };
23
- return r.legalName || r.email || r.phone || Object.values(r.address).some(Boolean) ? r : void 0;
63
+ });
64
+ let D = a?.name ?? m?.name ?? "", O = n(a || {
65
+ name: D,
66
+ url: T ?? "",
67
+ mimetype: m?.type ?? ""
68
+ }, C.preview);
69
+ return /* @__PURE__ */ o(t, {
70
+ mode: "document",
71
+ fileName: D,
72
+ preview: O,
73
+ isDeleting: x,
74
+ deleteErrorMessage: S ? C.deleteFailed : void 0,
75
+ onDownload: a ? () => window.open(a.url, "_blank", "noopener,noreferrer") : void 0,
76
+ onDelete: u ? void 0 : a && i ? y : _ ? void 0 : g
77
+ });
24
78
  }
25
79
  //#endregion
26
- export { n as buildVendorPrefill };
80
+ export { c as SourceDocumentContainer, c as default };
@@ -1,97 +1,26 @@
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, useFocusFirstInvalidField as i } from "../../../shared/counterpart-management/ui/dist/index9.js";
9
- import "../../../shared/counterpart-management/ui/dist/index.js";
10
- import { VendorSearchCombobox as a } from "../../ui/dist/index43.js";
11
- import "../../ui/dist/index.js";
12
- import "../../../shared/counterpart-management/feature/dist/index.js";
13
- import { VENDOR_INLINE_FORM_LABELS_EN as o } from "./index48.js";
14
- import { useMemo as s } from "react";
15
- import { jsx as c, jsxs as l } from "react/jsx-runtime";
16
- import { Plus as u } from "lucide-react";
17
1
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index51.js
18
- function d({ mode: d, values: f, errors: p, onChange: m, onAddressChange: h, sectionsToExpand: g, onAddressExpand: _, onCancel: v, paymentInstructions: y, search: b, labels: x }) {
19
- let S = {
20
- ...o,
21
- ...x,
22
- ach: {
23
- ...o.ach,
24
- ...x?.ach
2
+ function e(e) {
3
+ return e?.trim() ?? "";
4
+ }
5
+ function t(t) {
6
+ let n = e(t);
7
+ return n.length === 2 ? n.toUpperCase() : "";
8
+ }
9
+ function n(n) {
10
+ if (!n) return;
11
+ let r = {
12
+ legalName: e(n.name),
13
+ email: e(n.email),
14
+ phone: e(n.phone),
15
+ address: {
16
+ line1: e(n.address?.line1),
17
+ line2: e(n.address?.line2),
18
+ city: e(n.address?.city),
19
+ state: t(n.address?.state),
20
+ postalCode: e(n.address?.postal_code)
25
21
  }
26
- }, C = s(() => t(), []), w = i(p ?? {});
27
- return /* @__PURE__ */ l("div", {
28
- ref: w,
29
- className: "ttw:flex ttw:flex-col ttw:gap-4 ttw:rounded-lg ttw:border ttw:border-border ttw:bg-card ttw:p-4",
30
- children: [
31
- /* @__PURE__ */ c("p", {
32
- className: "ttw:text-base ttw:font-semibold ttw:text-foreground",
33
- children: d === "edit" ? S.editTitle : S.createTitle
34
- }),
35
- d === "edit" && b ? /* @__PURE__ */ c(a, {
36
- ...b,
37
- labels: { fieldLabel: S.switchVendorFieldLabel }
38
- }) : null,
39
- /* @__PURE__ */ c(r, {
40
- mode: d,
41
- counterpartMode: "vendor",
42
- values: f,
43
- errors: p,
44
- stateOptions: C,
45
- onChange: m,
46
- onAddressChange: h,
47
- sections: {
48
- entityType: !0,
49
- profileHeading: !1,
50
- title: !1,
51
- taxId: !1,
52
- address: "collapsible",
53
- bankAccount: !1
54
- },
55
- sectionsToExpand: g,
56
- onAddressExpand: _,
57
- labels: { businessNameLabel: S.nameLabel }
58
- }),
59
- y ? y.isOpen ? /* @__PURE__ */ l("div", {
60
- className: "ttw:flex ttw:flex-col ttw:gap-3",
61
- children: [/* @__PURE__ */ c(n, {
62
- idPrefix: "vendor-inline-ach",
63
- values: y.values,
64
- errors: y.errors,
65
- onChange: y.onChange,
66
- labels: S.ach
67
- }), /* @__PURE__ */ c("div", {
68
- className: "ttw:flex ttw:justify-end",
69
- children: /* @__PURE__ */ c(e, {
70
- type: "button",
71
- variant: "outline",
72
- onClick: y.onCancel,
73
- children: S.cancelPaymentInstructions
74
- })
75
- })]
76
- }) : /* @__PURE__ */ l(e, {
77
- type: "button",
78
- variant: "link",
79
- className: "ttw:w-fit ttw:px-0",
80
- onClick: y.onOpen,
81
- children: [/* @__PURE__ */ c(u, { className: "ttw:size-4" }), S.addPaymentInstructions]
82
- }) : null,
83
- /* @__PURE__ */ c("div", {
84
- className: "ttw:flex ttw:justify-end",
85
- children: /* @__PURE__ */ c(e, {
86
- type: "button",
87
- variant: "outline",
88
- onClick: v,
89
- "aria-label": S.cancelAriaLabel,
90
- children: S.cancel
91
- })
92
- })
93
- ]
94
- });
22
+ };
23
+ return r.legalName || r.email || r.phone || Object.values(r.address).some(Boolean) ? r : void 0;
95
24
  }
96
25
  //#endregion
97
- export { d as VendorInlineForm, d as default };
26
+ export { n as buildVendorPrefill };