@tesouro/embedded-components-react 0.11.127 → 0.11.131

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 (61) hide show
  1. package/dist/fixtures/index.d.ts +4 -4
  2. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index.js +5 -4
  3. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index21.js +20 -17
  4. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index22.js +14 -37
  5. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index23.js +31 -14
  6. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index24.js +26 -2
  7. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index25.js +2 -0
  8. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index.js +7 -7
  9. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index10.js +35 -12
  10. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index11.js +57 -65
  11. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index12.js +6 -11
  12. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index13.js +20 -8
  13. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index14.js +97 -7
  14. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index15.js +10 -10
  15. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index16.js +10 -29
  16. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index17.js +7 -27
  17. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index18.js +8 -18
  18. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index19.js +24 -139
  19. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index20.js +24 -13
  20. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index21.js +14 -17
  21. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index22.js +130 -27
  22. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index23.js +17 -100
  23. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index24.js +21 -82
  24. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index25.js +41 -3
  25. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index26.js +98 -53
  26. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index27.js +82 -113
  27. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index28.js +3 -193
  28. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index29.js +57 -81
  29. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index30.js +110 -66
  30. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index31.js +190 -111
  31. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index32.js +71 -456
  32. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index33.js +69 -114
  33. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index34.js +113 -8
  34. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index35.js +458 -79
  35. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index36.js +116 -79
  36. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index37.js +10 -256
  37. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index38.js +78 -36
  38. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index39.js +73 -236
  39. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index4.js +1 -1
  40. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index40.js +256 -21
  41. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index41.js +43 -516
  42. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index42.js +245 -4
  43. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index43.js +20 -40
  44. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index44.js +497 -211
  45. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index45.js +3 -2
  46. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index46.js +40 -3
  47. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index47.js +235 -57
  48. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index48.js +2 -0
  49. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index49.js +5 -0
  50. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index50.js +64 -0
  51. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index51.js +1 -0
  52. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index6.js +4 -47
  53. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index7.js +13 -4
  54. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index8.js +8 -13
  55. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index9.js +18 -9
  56. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/ui/dist/index3.js +44 -34
  57. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/lib/BillPayWidget/BillsTab.js +1 -1
  58. package/dist/libs/tesouro-embedded-components-react/products-widget/ui/dist/index4.js +10 -10
  59. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  60. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/lib/WidgetSuite/sections/InvoicingSection.js +3 -3
  61. package/package.json +1 -1
@@ -1,119 +1,74 @@
1
- "use client";
2
- "use client";
3
- "use client";
4
- "use client";
5
- import { toast as e } from "../../../../../../packages/shared-ui-shadcn/dist/index.js";
6
- import "../../../../shared/ui/dist/index.js";
7
- import { useUpdatePayableMutation as t } from "../../data-access/dist/index16.js";
8
- import "../../data-access/dist/index.js";
9
- import { cloneElement as n, isValidElement as r, useCallback as i, useEffect as a, useMemo as o, useRef as s, useState as c } from "react";
1
+ import { isStateValid as e } from "../../../../shared/util/dist/lib/usStates.js";
2
+ import "../../../../shared/util/dist/index.js";
3
+ import { emptyCounterpartFormValues as t, hasCounterpartFormErrors as n, validateCounterpartForm as r } from "../../../../shared/counterpart-management/feature/dist/lib/helpers.js";
4
+ import "../../../../shared/counterpart-management/feature/dist/index.js";
10
5
  // ../../libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index33.js
11
- function l({ vendor: l, payableId: u, linkedCounterpartId: d, linkedBankAccountId: f, canSavePayToEdits: p, readOnly: m, refreshPayable: h, labels: g }) {
12
- let _ = t(), [v, y] = c(!1), b = s(void 0), x = i(async () => {
13
- if (b.current) return b.current;
14
- let t = (async () => {
15
- if (p) {
16
- y(!0);
17
- try {
18
- let t;
19
- try {
20
- t = await l.prepareVendorForSave({ closeOnSuccess: !1 });
21
- } catch {
22
- e.error(g.paymentInstructionsSaveError);
23
- return;
24
- }
25
- if (!t.ok) return;
26
- if (!u) {
27
- l.finalizePayToSave();
28
- return;
29
- }
30
- let n = t.counterpartId && t.counterpartId !== d ? t.counterpartId : void 0, r = t.counterpartBankAccountId && t.counterpartBankAccountId !== f ? t.counterpartBankAccountId : void 0;
31
- if (n || r) {
32
- let t = {
33
- path: { payable_id: u },
34
- body: {
35
- ...n ? { counterpart_id: n } : {},
36
- ...r ? { counterpart_bank_account_id: r } : {}
37
- }
38
- };
39
- try {
40
- await _.mutateAsync(t);
41
- } catch {
42
- try {
43
- await _.mutateAsync(t);
44
- } catch {
45
- e.error(g.paymentInstructionsLinkError);
46
- return;
47
- }
48
- }
49
- l.finalizePayToSave();
50
- return;
51
- }
52
- l.finalizePayToSave(), await h();
53
- } finally {
54
- y(!1);
55
- }
56
- }
57
- })();
58
- b.current = t;
59
- try {
60
- await t;
61
- } finally {
62
- b.current = void 0;
6
+ function i(e) {
7
+ return e?.trim() ?? "";
8
+ }
9
+ function a(t) {
10
+ let n = i(t).toUpperCase();
11
+ return e(n) ? n : "";
12
+ }
13
+ function o(e) {
14
+ let t = i(e.bank_account?.account_holder_name), n = i(e.bank_account?.routing_number), r = i(e.bank_account?.account_number);
15
+ if (t || n || r) return {
16
+ accountHolderName: t || i(e.name),
17
+ routingNumber: n,
18
+ accountNumber: r
19
+ };
20
+ }
21
+ function s(e) {
22
+ if (!e) return;
23
+ let t = {
24
+ legalName: i(e.name),
25
+ email: i(e.email),
26
+ phone: i(e.phone),
27
+ address: {
28
+ line1: i(e.address?.line1),
29
+ line2: i(e.address?.line2),
30
+ city: i(e.address?.city),
31
+ state: a(e.address?.state),
32
+ postalCode: i(e.address?.postal_code)
33
+ },
34
+ bankAccount: o(e)
35
+ };
36
+ return t.legalName || t.email || t.phone || Object.values(t.address).some(Boolean) || t.bankAccount ? t : void 0;
37
+ }
38
+ function c(e) {
39
+ let a = s(e);
40
+ if (!a || i(e?.address?.country).toUpperCase() !== "US") return !1;
41
+ let o = t("organization", "vendor");
42
+ return !n(r({
43
+ ...o,
44
+ ...a,
45
+ bankAccount: {
46
+ accountHolderName: i(e?.bank_account?.account_holder_name),
47
+ routingNumber: i(e?.bank_account?.routing_number),
48
+ accountNumber: i(e?.bank_account?.account_number)
63
49
  }
64
- }, [
65
- p,
66
- g.paymentInstructionsLinkError,
67
- g.paymentInstructionsSaveError,
68
- _,
69
- f,
70
- d,
71
- u,
72
- h,
73
- l
74
- ]), S = o(() => {
75
- if (!p) return l;
76
- if (l.mode === "creating" && r(l.newVendorForm)) return {
77
- ...l,
78
- newVendorForm: n(l.newVendorForm, {
79
- onSave: x,
80
- isSaving: v
81
- })
82
- };
83
- if (l.mode === "resolved" && l.paymentInstructions) {
84
- let e = {
85
- onSave: x,
86
- isSaving: v
87
- };
88
- return {
89
- ...l,
90
- paymentInstructions: {
91
- ...l.paymentInstructions,
92
- ...e
93
- },
94
- paymentInstructionsEditor: l.paymentInstructionsEditor && {
95
- ...l.paymentInstructionsEditor,
96
- ...e
97
- }
98
- };
50
+ }, void 0, "vendor"));
51
+ }
52
+ function l(e, t, n) {
53
+ let r = (e) => i(e) || void 0, { address: a } = e;
54
+ return {
55
+ ...n,
56
+ name: r(e.entityType === "individual" ? `${e.firstName} ${e.lastName}` : e.legalName),
57
+ email: r(e.email),
58
+ phone: r(e.phone),
59
+ address: {
60
+ ...n?.address,
61
+ line1: r(a.line1),
62
+ line2: r(a.line2),
63
+ city: r(a.city),
64
+ state: r(a.state),
65
+ postal_code: r(a.postalCode)
66
+ },
67
+ bank_account: {
68
+ account_holder_name: r(t.accountHolderName),
69
+ routing_number: r(t.routingNumber),
70
+ account_number: r(t.accountNumber)
99
71
  }
100
- return l;
101
- }, [
102
- p,
103
- v,
104
- x,
105
- l
106
- ]);
107
- return a(() => {
108
- m && l.isEditingPayTo && !p && l.discardPayToEdits();
109
- }, [
110
- p,
111
- m,
112
- l.discardPayToEdits,
113
- l.isEditingPayTo
114
- ]), {
115
- vendorWithInlineSave: S,
116
- isSavingPayToEdits: v
117
72
  };
118
73
  }
119
- export { l as usePayToSave };
74
+ export { s as buildVendorPrefill, c as canAutoCreateVendor, l as toCounterpartRawData };
@@ -1,11 +1,116 @@
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 "../../../../shared/util/dist/index.js";
8
+ import { AchFieldGroup as n } from "../../../../shared/counterpart-management/ui/dist/index5.js";
9
+ import { CounterpartFormFields as r, countErrors as i, useFocusFirstInvalidField as a } from "../../../../shared/counterpart-management/ui/dist/index10.js";
10
+ import "../../../../shared/counterpart-management/ui/dist/index.js";
11
+ import { VendorSearchCombobox as o } from "../../ui/dist/index24.js";
12
+ import "../../ui/dist/index.js";
13
+ import { mergeVendorInlineFormLabels as s } from "./index31.js";
14
+ import "../../../../shared/counterpart-management/feature/dist/index.js";
15
+ import { useMemo as c } from "react";
16
+ import { jsx as l, jsxs as u } from "react/jsx-runtime";
1
17
  // ../../libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index34.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
- typeof e == "string" ? t(e.slice(e.indexOf(",") + 1)) : n(/* @__PURE__ */ Error("Failed to read file as a data URL"));
8
- }, r.readAsDataURL(e);
18
+ function d({ mode: d, values: f, errors: p, onChange: m, onAddressChange: h, onCancel: g, onSave: _, isSaving: v = !1, search: y, paymentInstructions: b, labels: x }) {
19
+ let S = c(() => s(x), [x]), C = c(() => t(), []), w = a(p ?? {}), T = i({
20
+ ...p,
21
+ form: void 0,
22
+ bankAccount: void 0
23
+ }) + i(b?.errors), E = y?.query.trim() ?? "", D = f.entityType === "individual" ? `${f.firstName} ${f.lastName}`.trim() : f.legalName, O = y && d === "create" ? /* @__PURE__ */ l(o, {
24
+ ...y,
25
+ onAddVendor: E && E !== D.trim() ? y.onAddVendor : void 0,
26
+ selectedLabel: D,
27
+ badge: S.newVendorBadge,
28
+ helperText: S.unmatchedVendorHelper,
29
+ resultsHeading: S.resultsHeading,
30
+ addVendorDescription: S.addAsNewVendorDescription,
31
+ labels: {
32
+ fieldLabel: S.vendorFieldLabel,
33
+ addVendorAction: S.addAsNewVendor(E)
34
+ }
35
+ }) : null;
36
+ return /* @__PURE__ */ u("div", {
37
+ ref: w,
38
+ className: "ttw:flex ttw:flex-col ttw:gap-4",
39
+ children: [O, /* @__PURE__ */ u("div", {
40
+ 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",
41
+ children: [
42
+ /* @__PURE__ */ u("div", {
43
+ className: "ttw:flex ttw:items-baseline ttw:justify-between ttw:gap-2",
44
+ children: [/* @__PURE__ */ l("p", {
45
+ className: "ttw:text-base ttw:font-semibold ttw:text-foreground",
46
+ children: d === "edit" ? S.editTitle : S.createTitle
47
+ }), T > 0 ? /* @__PURE__ */ l("p", {
48
+ className: "ttw:text-sm ttw:text-destructive",
49
+ children: S.fieldsNeedAttention(T)
50
+ }) : null]
51
+ }),
52
+ y && d === "edit" ? /* @__PURE__ */ l(o, {
53
+ ...y,
54
+ labels: { fieldLabel: S.switchVendorFieldLabel }
55
+ }) : null,
56
+ /* @__PURE__ */ l(r, {
57
+ mode: d,
58
+ counterpartMode: "vendor",
59
+ values: f,
60
+ errors: p,
61
+ stateOptions: C,
62
+ onChange: m,
63
+ onAddressChange: h,
64
+ sections: {
65
+ entityType: !0,
66
+ profileHeading: !1,
67
+ addressHeading: !1,
68
+ title: !1,
69
+ taxId: !1,
70
+ address: !0,
71
+ bankAccount: !1
72
+ },
73
+ labels: { businessNameLabel: S.nameLabel }
74
+ }),
75
+ b ? /* @__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: S.paymentInstructionsHeading
82
+ }), /* @__PURE__ */ l("p", {
83
+ className: "ttw:text-sm ttw:text-muted-foreground",
84
+ children: b.isExtracted ? S.paymentInstructionsExtracted : S.paymentInstructionsDescription
85
+ })]
86
+ }), /* @__PURE__ */ l(n, {
87
+ idPrefix: "vendor-inline-ach",
88
+ values: b.values,
89
+ errors: b.errors,
90
+ onChange: b.onChange,
91
+ labels: S.ach
92
+ })]
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: g,
100
+ "aria-label": S.cancelAriaLabel,
101
+ disabled: v,
102
+ children: S.cancel
103
+ }), _ ? /* @__PURE__ */ l(e, {
104
+ type: "button",
105
+ onClick: _,
106
+ "aria-label": S.saveAriaLabel,
107
+ loading: v,
108
+ disabled: v,
109
+ children: S.save
110
+ }) : null]
111
+ })
112
+ ]
113
+ })]
9
114
  });
10
115
  }
11
- export { e as encodeFileToBase64 };
116
+ export { d as VendorInlineForm, d as default };