@tesouro/embedded-components-react 0.3.63 → 0.4.1

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 (82) hide show
  1. package/README.md +1 -70
  2. package/dist/index.d.ts +67 -832
  3. package/dist/index.js +18 -34
  4. package/dist/lib/BillPayWidget.js +1 -1
  5. package/dist/lib/SettingsWidget.d.ts +53 -7
  6. package/dist/lib/SettingsWidget.js +4 -2
  7. package/dist/lib/WidgetSuite.d.ts +38 -0
  8. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index.js +8 -8
  9. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index28.js +8 -14
  10. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index29.js +7 -57
  11. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index30.js +56 -16
  12. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index31.js +18 -126
  13. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index32.js +126 -14
  14. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index33.js +22 -4
  15. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index34.js +4 -41
  16. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index35.js +40 -4
  17. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index36.js +5 -73
  18. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index37.js +72 -48
  19. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index38.js +47 -91
  20. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index39.js +91 -33
  21. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index40.js +33 -167
  22. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index41.js +167 -75
  23. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index42.js +75 -21
  24. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index43.js +23 -210
  25. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index44.js +199 -203
  26. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index45.js +198 -89
  27. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index46.js +105 -13
  28. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index47.js +12 -47
  29. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index48.js +47 -31
  30. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index49.js +27 -198
  31. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index50.js +198 -30
  32. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index51.js +30 -234
  33. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index52.js +240 -18
  34. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index53.js +18 -341
  35. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index54.js +343 -4
  36. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index55.js +4 -33
  37. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index56.js +31 -83
  38. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index57.js +78 -163
  39. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index58.js +170 -3
  40. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index59.js +3 -4
  41. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index60.js +2 -44
  42. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index61.js +46 -1
  43. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index62.js +1 -8
  44. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index63.js +6 -9
  45. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index64.js +9 -92
  46. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index65.js +94 -3
  47. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index66.js +3 -128
  48. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index67.js +125 -8
  49. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index68.js +8 -7
  50. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index69.js +8 -46
  51. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index70.js +43 -18
  52. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index71.js +20 -28
  53. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index72.js +27 -82
  54. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index73.js +83 -47
  55. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index74.js +47 -250
  56. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index75.js +239 -101
  57. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index76.js +107 -202
  58. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index77.js +209 -3
  59. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index78.js +4 -8
  60. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index79.js +6 -113
  61. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index80.js +115 -1
  62. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index81.js +0 -24
  63. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index82.js +25 -0
  64. package/dist/libs/tesouro-embedded-components-react/gl-code-table-widget/feature/dist/index.js +3 -3
  65. package/dist/libs/tesouro-embedded-components-react/gl-code-table-widget/ui/dist/index.js +5 -5
  66. package/dist/libs/tesouro-embedded-components-react/help-widget/feature/dist/index.js +4 -2
  67. package/dist/libs/tesouro-embedded-components-react/help-widget/ui/shadcn/dist/index.js +4 -4
  68. package/dist/libs/tesouro-embedded-components-react/help-widget/ui/shadcn/dist/index4.js +2 -3
  69. package/dist/libs/tesouro-embedded-components-react/settings-widget/feature/dist/index6.js +35 -32
  70. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  71. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index8.js +1 -1
  72. package/package.json +1 -1
  73. package/dist/lib/ChartOfAccountsWidget.d.ts +0 -958
  74. package/dist/lib/ChartOfAccountsWidget.js +0 -9
  75. package/dist/lib/HelpWidget.d.ts +0 -739
  76. package/dist/lib/HelpWidget.js +0 -6
  77. package/dist/lib/ProfileWidget.d.ts +0 -672
  78. package/dist/lib/ProfileWidget.js +0 -3
  79. package/dist/lib/TagsWidget.d.ts +0 -719
  80. package/dist/lib/TagsWidget.js +0 -3
  81. package/dist/lib/TeamWidget.d.ts +0 -878
  82. package/dist/lib/TeamWidget.js +0 -3
@@ -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/index12.js";
6
+ import "../../data-access/dist/index.js";
7
+ import { SourceDocumentPanel as t } from "../../ui/dist/index95.js";
8
+ import "../../ui/dist/index.js";
9
+ import { createSourceDocumentPreview as n } from "./index40.js";
10
+ import { SOURCE_DOCUMENT_CONTAINER_LABELS_EN as r } from "./index41.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/index42.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,213 +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 { COUNTERPART_MESSAGE_LABELS_EN as a } from "../../../shared/counterpart-management/feature/dist/lib/labels.js";
10
- import { useCounterpartForm as o } from "../../../shared/counterpart-management/feature/dist/lib/useCounterpartForm.js";
11
- import "../../../shared/counterpart-management/feature/dist/index.js";
12
- import { VENDOR_INLINE_FORM_LABELS_EN as s } from "./index40.js";
13
- import { useCallback as c, useEffect as l, useMemo as u, useRef as d, useState as f } from "react";
14
- import { Fragment as p, jsx as m, jsxs as h } from "react/jsx-runtime";
15
- import { Landmark as g, Plus as _, X as v } from "lucide-react";
16
1
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index43.js
17
- function y({ mode: y, counterpart: b, primaryAddress: x, bankAccounts: S, isBankAccountsLoading: C, isBankAccountsError: w, initialName: T, initialValues: E, onSaved: D, onCancel: O, onDirtyChange: k, labels: A }) {
18
- let j = {
19
- ...s,
20
- ...A
21
- }, [M, N] = f("none"), [P, F] = f(b?.id), [I, L] = f(!1), [R, z] = f(!1);
22
- l(() => {
23
- k?.(R);
24
- }, [R, k]);
25
- let B = u(() => t(), []), V = d(M), H = d(!1), U = o({
26
- view: M,
27
- setView: N,
28
- selectedId: P,
29
- setSelectedId: F,
30
- messages: a,
31
- counterpartType: "vendor",
32
- counterpart: b,
33
- primaryAddress: x,
34
- bankAccounts: S,
35
- isBankAccountsLoading: C,
36
- isBankAccountsError: w
37
- }), { openCreate: W, openEdit: G, setValues: K, expandAddress: q } = U, J = i(U.errors);
38
- l(() => {
39
- y === "edit" ? G() : W();
40
- }, [
41
- y,
42
- W,
43
- G
44
- ]), l(() => {
45
- V.current !== "none" && M === "none" && P && D(P), V.current = M;
46
- }, [
47
- M,
48
- P,
49
- D
50
- ]), l(() => {
51
- y !== "create" || H.current || (H.current = !0, K((e) => ({
52
- ...e,
53
- entityType: "organization",
54
- legalName: T?.trim() || E?.legalName || e.legalName,
55
- email: E?.email || e.email,
56
- phone: E?.phone || e.phone,
57
- address: E?.address ?? e.address
58
- })), E?.address && Object.values(E.address).some(Boolean) && q());
59
- }, [
60
- y,
61
- T,
62
- E,
63
- K,
64
- q
65
- ]), l(() => {
66
- y === "edit" && (U.values.bankAccount.routingNumber || U.values.bankAccount.accountNumber) && L(!0);
67
- }, [
68
- y,
69
- U.values.bankAccount.accountNumber,
70
- U.values.bankAccount.routingNumber
71
- ]), l(() => {
72
- U.sectionsToExpand.bankAccount && L(!0);
73
- }, [U.sectionsToExpand.bankAccount]);
74
- let Y = c((e) => {
75
- z(!0), K((t) => e.entityType === "individual" && t.entityType !== "individual" ? {
76
- ...t,
77
- ...e,
78
- firstName: t.firstName || t.legalName,
79
- legalName: t.legalName
80
- } : e.entityType === "organization" && t.entityType !== "organization" ? {
81
- ...t,
82
- ...e,
83
- legalName: t.legalName || [t.firstName, t.lastName].filter(Boolean).join(" ")
84
- } : {
85
- ...t,
86
- ...e
87
- });
88
- }, [K]);
89
- return /* @__PURE__ */ h("div", {
90
- ref: J,
91
- className: "ttw:flex ttw:flex-col ttw:gap-4 ttw:rounded-lg ttw:border ttw:border-border ttw:bg-card ttw:p-4",
92
- children: [
93
- /* @__PURE__ */ h("div", {
94
- className: "ttw:flex ttw:items-start ttw:justify-between ttw:gap-2",
95
- children: [/* @__PURE__ */ m("p", {
96
- className: "ttw:text-base ttw:font-semibold ttw:text-foreground",
97
- children: y === "edit" ? j.editTitle : j.createTitle
98
- }), /* @__PURE__ */ m(e, {
99
- type: "button",
100
- variant: "ghost",
101
- size: "icon",
102
- "aria-label": j.close,
103
- onClick: O,
104
- children: /* @__PURE__ */ m(v, { className: "ttw:size-4" })
105
- })]
106
- }),
107
- /* @__PURE__ */ m(r, {
108
- mode: y,
109
- counterpartMode: "vendor",
110
- values: U.values,
111
- errors: U.errors,
112
- stateOptions: B,
113
- onChange: Y,
114
- onAddressChange: (e) => {
115
- z(!0), K((t) => ({
116
- ...t,
117
- address: {
118
- ...t.address,
119
- ...e
120
- }
121
- }));
122
- },
123
- sections: {
124
- entityType: !0,
125
- profileHeading: !1,
126
- title: !1,
127
- taxId: !1,
128
- address: "collapsible",
129
- bankAccount: !1
130
- },
131
- sectionsToExpand: U.sectionsToExpand,
132
- onAddressExpand: U.expandAddress,
133
- labels: { businessNameLabel: j.nameLabel }
134
- }),
135
- /* @__PURE__ */ h("div", {
136
- className: "ttw:flex ttw:flex-col ttw:gap-1",
137
- children: [/* @__PURE__ */ m("p", {
138
- className: "ttw:text-sm ttw:font-semibold ttw:text-foreground",
139
- children: j.paymentMethodsHeading
140
- }), /* @__PURE__ */ m("p", {
141
- className: "ttw:text-sm ttw:text-muted-foreground",
142
- children: j.paymentMethodsDescription
143
- })]
144
- }),
145
- /* @__PURE__ */ h("div", {
146
- className: "ttw:flex ttw:gap-3 ttw:rounded-lg ttw:border ttw:border-border ttw:p-3",
147
- children: [/* @__PURE__ */ m("span", {
148
- className: "ttw:flex ttw:size-8 ttw:shrink-0 ttw:items-center ttw:justify-center ttw:rounded-md ttw:bg-primary",
149
- children: /* @__PURE__ */ m(g, {
150
- "aria-hidden": !0,
151
- className: "ttw:size-4 ttw:text-white"
152
- })
153
- }), /* @__PURE__ */ h("div", {
154
- className: "ttw:flex ttw:flex-1 ttw:flex-col ttw:gap-3",
155
- children: [/* @__PURE__ */ h("div", {
156
- className: "ttw:flex ttw:flex-col ttw:gap-0.5",
157
- children: [/* @__PURE__ */ m("p", {
158
- className: "ttw:text-sm ttw:font-medium ttw:text-foreground",
159
- children: j.achTitle
160
- }), /* @__PURE__ */ m("p", {
161
- className: "ttw:text-sm ttw:text-muted-foreground",
162
- children: j.achDescription
163
- })]
164
- }), I ? /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ m(n, {
165
- idPrefix: "vendor-inline-ach",
166
- values: U.values.bankAccount,
167
- errors: U.errors?.bankAccount,
168
- onChange: (e) => {
169
- z(!0), K((t) => ({
170
- ...t,
171
- bankAccount: {
172
- ...t.bankAccount,
173
- ...e
174
- }
175
- }));
176
- },
177
- labels: {
178
- accountHolderName: j.accountHolderNameLabel,
179
- routingNumber: j.routingNumberLabel,
180
- accountNumber: j.accountNumberLabel
181
- }
182
- }), /* @__PURE__ */ m("p", {
183
- className: "ttw:text-sm ttw:text-muted-foreground",
184
- children: j.achHelp
185
- })] }) : /* @__PURE__ */ h(e, {
186
- type: "button",
187
- variant: "link",
188
- className: "ttw:w-fit ttw:px-0",
189
- onClick: () => L(!0),
190
- children: [/* @__PURE__ */ m(_, { className: "ttw:size-4" }), j.addBankAccount]
191
- })]
192
- })]
193
- }),
194
- /* @__PURE__ */ h("div", {
195
- className: "ttw:flex ttw:justify-end ttw:gap-2",
196
- children: [/* @__PURE__ */ m(e, {
197
- type: "button",
198
- variant: "outline",
199
- onClick: O,
200
- children: j.cancel
201
- }), /* @__PURE__ */ m(e, {
202
- type: "button",
203
- onClick: U.submit,
204
- loading: U.isSubmitting,
205
- disabled: U.isSubmitting,
206
- children: j.save
207
- })]
208
- })
209
- ]
210
- });
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)
21
+ }
22
+ };
23
+ return r.legalName || r.email || r.phone || Object.values(r.address).some(Boolean) ? r : void 0;
211
24
  }
212
25
  //#endregion
213
- export { y as VendorInlineForm, y as default };
26
+ export { n as buildVendorPrefill };