@tesouro/embedded-components-react 0.5.286 → 0.5.288

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 (16) hide show
  1. package/dist/index.css +6 -0
  2. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index25.js +9 -2
  3. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index27.js +39 -22
  4. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index28.js +102 -77
  5. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index29.js +267 -248
  6. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index33.js +20 -19
  7. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index37.js +1 -0
  8. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/ui/dist/index24.js +119 -88
  9. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/index.js +11 -11
  10. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/useCounterpartForm.js +62 -55
  11. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index.js +4 -4
  12. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index7.js +2 -2
  13. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index9.js +27 -22
  14. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  15. package/dist/libs/tesouro-embedded-components-react/shared/util/dist/lib/usStates.js +4 -1
  16. package/package.json +1 -1
package/dist/index.css CHANGED
@@ -6482,6 +6482,12 @@
6482
6482
  .ttw\:\[\&_\[cmdk-item\]_svg\]\:w-5 [cmdk-item] svg {
6483
6483
  width: calc(var(--ttw-spacing) * 5);
6484
6484
  }
6485
+ .ttw\:\[\&_\[data-slot\=input\]\]\:bg-background [data-slot=input] {
6486
+ background-color: var(--ttw-background);
6487
+ }
6488
+ .ttw\:\[\&_\[data-slot\=select-trigger\]\]\:bg-background [data-slot=select-trigger] {
6489
+ background-color: var(--ttw-background);
6490
+ }
6485
6491
  .ttw\:\[\&_li\]\:pb-2 li {
6486
6492
  padding-bottom: calc(var(--ttw-spacing) * 2);
6487
6493
  }
@@ -41,6 +41,7 @@ var g = {
41
41
  searchFailed: "We could not load vendors. Try again.",
42
42
  vendorDetailsFailed: "We could not load this vendor. Try again.",
43
43
  pendingVendorDescription: "Will be created when submitted",
44
+ pendingVendorIncompleteDescription: "Add the missing vendor details before submitting",
44
45
  bankAccountSaveFailed: "We could not save these payment instructions. Try again."
45
46
  }, v = {
46
47
  attachFailed: "We could not attach that file. Try again.",
@@ -155,11 +156,17 @@ function x(e) {
155
156
  };
156
157
  }
157
158
  var S = {
158
- createTitle: "New vendor",
159
+ createTitle: "New vendor details",
159
160
  editTitle: "Edit vendor",
160
161
  switchVendorFieldLabel: "Switch to a different vendor",
162
+ vendorFieldLabel: "Vendor",
163
+ newVendorBadge: "New vendor",
164
+ unmatchedVendorHelper: "We couldn't match this vendor to your list. Search to choose an existing vendor, or finish adding a new one below.",
165
+ resultsHeading: "Your vendors",
166
+ addAsNewVendor: (e) => `Add "${e}" as a new vendor`,
167
+ addAsNewVendorDescription: "Uses the details extracted from this bill",
168
+ fieldsNeedAttention: (e) => `${e} ${e === 1 ? "field needs" : "fields need"} attention`,
161
169
  nameLabel: "Business name",
162
- addAddress: "Add address (optional)",
163
170
  cancel: "Cancel",
164
171
  save: "Save",
165
172
  cancelAriaLabel: "Cancel vendor",
@@ -1,35 +1,52 @@
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";
1
4
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index27.js
2
- function e(e) {
5
+ function i(e) {
3
6
  return e?.trim() ?? "";
4
7
  }
5
- function t(t) {
6
- let n = e(t);
7
- return n.length === 2 ? n.toUpperCase() : "";
8
+ function a(t) {
9
+ let n = i(t).toUpperCase();
10
+ return e(n) ? n : "";
8
11
  }
9
- function n(t) {
10
- let n = e(t.bank_account?.routing_number), r = e(t.bank_account?.account_number);
11
- if (n || r) return {
12
- accountHolderName: e(t.bank_account?.account_holder_name) || e(t.name),
12
+ function o(e) {
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),
13
16
  routingNumber: n,
14
17
  accountNumber: r
15
18
  };
16
19
  }
17
- function r(r) {
18
- if (!r) return;
19
- let i = {
20
- legalName: e(r.name),
21
- email: e(r.email),
22
- phone: e(r.phone),
20
+ function s(e) {
21
+ if (!e) return;
22
+ let t = {
23
+ legalName: i(e.name),
24
+ email: i(e.email),
25
+ phone: i(e.phone),
23
26
  address: {
24
- line1: e(r.address?.line1),
25
- line2: e(r.address?.line2),
26
- city: e(r.address?.city),
27
- state: t(r.address?.state),
28
- postalCode: e(r.address?.postal_code)
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)
29
32
  },
30
- bankAccount: n(r)
33
+ bankAccount: o(e)
31
34
  };
32
- return i.legalName || i.email || i.phone || Object.values(i.address).some(Boolean) || i.bankAccount ? i : void 0;
35
+ return t.legalName || t.email || t.phone || Object.values(t.address).some(Boolean) || t.bankAccount ? t : void 0;
36
+ }
37
+ function c(e) {
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"));
33
50
  }
34
51
  //#endregion
35
- export { r as buildVendorPrefill };
52
+ export { s as buildVendorPrefill, c as canAutoCreateVendor };
@@ -5,88 +5,113 @@
5
5
  import { Button as e } from "../../../../../../packages/shared-ui-shadcn/dist/index.js";
6
6
  import { getStateOptions as t } from "../../../../shared/util/dist/lib/usStates.js";
7
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";
8
+ import { CounterpartFormFields as r, countErrors as i, useFocusFirstInvalidField as a } from "../../../../shared/counterpart-management/ui/dist/index9.js";
9
9
  import "../../../../shared/counterpart-management/ui/dist/index.js";
10
- import { VendorSearchCombobox as a } from "../../ui/dist/index24.js";
10
+ import { VendorSearchCombobox as o } from "../../ui/dist/index24.js";
11
11
  import "../../ui/dist/index.js";
12
- import { mergeVendorInlineFormLabels as o } from "./index25.js";
12
+ import { mergeVendorInlineFormLabels as s } from "./index25.js";
13
13
  import "../../../../shared/counterpart-management/feature/dist/index.js";
14
- import { useMemo as s } from "react";
15
- import { jsx as c, jsxs as l } from "react/jsx-runtime";
14
+ import { useMemo as c } from "react";
15
+ import { jsx as l, jsxs as u } from "react/jsx-runtime";
16
16
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index28.js
17
- function u({ mode: u, values: d, errors: f, onChange: p, onAddressChange: m, sectionsToExpand: h, onAddressExpand: g, onCancel: _, onSave: v, isSaving: y = !1, search: b, paymentInstructions: x, labels: S }) {
18
- let C = s(() => o(S), [S]), w = s(() => t(), []), T = i(f ?? {});
19
- return /* @__PURE__ */ l("div", {
20
- ref: T,
21
- className: "ttw:flex ttw:flex-col ttw:gap-4 ttw:rounded-lg ttw:border ttw:border-border ttw:bg-card ttw:p-4",
22
- children: [
23
- /* @__PURE__ */ c("p", {
24
- className: "ttw:text-base ttw:font-semibold ttw:text-foreground",
25
- children: u === "edit" ? C.editTitle : C.createTitle
26
- }),
27
- u === "edit" && b ? /* @__PURE__ */ c(a, {
28
- ...b,
29
- labels: { fieldLabel: C.switchVendorFieldLabel }
30
- }) : null,
31
- /* @__PURE__ */ c(r, {
32
- mode: u,
33
- counterpartMode: "vendor",
34
- values: d,
35
- errors: f,
36
- stateOptions: w,
37
- onChange: p,
38
- onAddressChange: m,
39
- sections: {
40
- entityType: !0,
41
- profileHeading: !1,
42
- title: !1,
43
- taxId: !1,
44
- address: "collapsible",
45
- bankAccount: !1
46
- },
47
- sectionsToExpand: h,
48
- onAddressExpand: g,
49
- labels: { businessNameLabel: C.nameLabel }
50
- }),
51
- x ? /* @__PURE__ */ l("div", {
52
- className: "ttw:flex ttw:flex-col ttw:gap-3",
53
- children: [/* @__PURE__ */ l("div", {
54
- className: "ttw:flex ttw:flex-col ttw:gap-1",
55
- children: [/* @__PURE__ */ c("p", {
56
- className: "ttw:text-sm ttw:font-semibold ttw:text-foreground",
57
- children: C.paymentInstructionsHeading
58
- }), /* @__PURE__ */ c("p", {
59
- className: "ttw:text-sm ttw:text-muted-foreground",
60
- children: x.isExtracted ? C.paymentInstructionsExtracted : C.paymentInstructionsDescription
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
+ selectedLabel: k,
25
+ badge: w.newVendorBadge,
26
+ helperText: w.unmatchedVendorHelper,
27
+ resultsHeading: w.resultsHeading,
28
+ addVendorDescription: w.addAsNewVendorDescription,
29
+ labels: {
30
+ fieldLabel: w.vendorFieldLabel,
31
+ addVendorAction: w.addAsNewVendor(O || k)
32
+ }
33
+ }) : null;
34
+ return /* @__PURE__ */ u("div", {
35
+ ref: E,
36
+ className: "ttw:flex ttw:flex-col ttw:gap-4",
37
+ children: [A, /* @__PURE__ */ u("div", {
38
+ 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",
39
+ children: [
40
+ /* @__PURE__ */ u("div", {
41
+ className: "ttw:flex ttw:items-baseline ttw:justify-between ttw:gap-2",
42
+ children: [/* @__PURE__ */ l("p", {
43
+ className: "ttw:text-base ttw:font-semibold ttw:text-foreground",
44
+ children: d === "edit" ? w.editTitle : w.createTitle
45
+ }), D > 0 ? /* @__PURE__ */ l("p", {
46
+ className: "ttw:text-sm ttw:text-destructive",
47
+ children: w.fieldsNeedAttention(D)
48
+ }) : null]
49
+ }),
50
+ x && d === "edit" ? /* @__PURE__ */ l(o, {
51
+ ...x,
52
+ labels: { fieldLabel: w.switchVendorFieldLabel }
53
+ }) : null,
54
+ /* @__PURE__ */ l(r, {
55
+ mode: d,
56
+ counterpartMode: "vendor",
57
+ values: f,
58
+ errors: p,
59
+ stateOptions: T,
60
+ onChange: m,
61
+ onAddressChange: h,
62
+ sections: {
63
+ entityType: !0,
64
+ profileHeading: !1,
65
+ addressHeading: !1,
66
+ title: !1,
67
+ taxId: !1,
68
+ address: d !== "edit" || "collapsible",
69
+ bankAccount: !1
70
+ },
71
+ sectionsToExpand: g,
72
+ onAddressExpand: _,
73
+ labels: { businessNameLabel: w.nameLabel }
74
+ }),
75
+ S ? /* @__PURE__ */ u("div", {
76
+ className: "ttw:flex ttw:flex-col ttw:gap-3",
77
+ children: [/* @__PURE__ */ u("div", {
78
+ className: "ttw:flex ttw:flex-col ttw:gap-1",
79
+ children: [/* @__PURE__ */ l("p", {
80
+ className: "ttw:text-sm ttw:font-semibold ttw:text-foreground",
81
+ children: w.paymentInstructionsHeading
82
+ }), /* @__PURE__ */ l("p", {
83
+ className: "ttw:text-sm ttw:text-muted-foreground",
84
+ children: S.isExtracted ? w.paymentInstructionsExtracted : w.paymentInstructionsDescription
85
+ })]
86
+ }), /* @__PURE__ */ l(n, {
87
+ idPrefix: "vendor-inline-ach",
88
+ values: S.values,
89
+ errors: S.errors,
90
+ onChange: S.onChange,
91
+ labels: w.ach
61
92
  })]
62
- }), /* @__PURE__ */ c(n, {
63
- idPrefix: "vendor-inline-ach",
64
- values: x.values,
65
- errors: x.errors,
66
- onChange: x.onChange,
67
- labels: C.ach
68
- })]
69
- }) : null,
70
- /* @__PURE__ */ l("div", {
71
- className: "ttw:flex ttw:justify-end ttw:gap-2",
72
- children: [/* @__PURE__ */ c(e, {
73
- type: "button",
74
- variant: "outline",
75
- onClick: _,
76
- "aria-label": C.cancelAriaLabel,
77
- disabled: y,
78
- children: C.cancel
79
- }), v ? /* @__PURE__ */ c(e, {
80
- type: "button",
81
- onClick: v,
82
- "aria-label": C.saveAriaLabel,
83
- loading: y,
84
- disabled: y,
85
- children: C.save
86
- }) : null]
87
- })
88
- ]
93
+ }) : null,
94
+ /* @__PURE__ */ u("div", {
95
+ className: "ttw:flex ttw:justify-end ttw:gap-2",
96
+ children: [/* @__PURE__ */ l(e, {
97
+ type: "button",
98
+ variant: "outline",
99
+ onClick: v,
100
+ "aria-label": w.cancelAriaLabel,
101
+ disabled: b,
102
+ children: w.cancel
103
+ }), y ? /* @__PURE__ */ l(e, {
104
+ type: "button",
105
+ onClick: y,
106
+ "aria-label": w.saveAriaLabel,
107
+ loading: b,
108
+ disabled: b,
109
+ children: w.save
110
+ }) : null]
111
+ })
112
+ ]
113
+ })]
89
114
  });
90
115
  }
91
116
  //#endregion
92
- export { u as VendorInlineForm, u as default };
117
+ export { d as VendorInlineForm, d as default };