@tesouro/embedded-components-react 0.2.296 → 0.2.299
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.
- package/dist/index.css +6 -0
- package/dist/index.d.ts +107 -87
- package/dist/lib/CounterpartsWidget.d.ts +24 -4
- package/dist/lib/ReceivablesWidget.d.ts +20 -3
- package/dist/libs/tesouro-embedded-components-react/accept-disclosures-widget/data-access/dist/index.js +3 -2
- package/dist/libs/tesouro-embedded-components-react/accept-disclosures-widget/feature/dist/index4.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index17.js +210 -199
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index12.js +31 -27
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index2.js +2 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index4.js +122 -149
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index5.js +163 -72
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index6.js +3 -3
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index8.js +52 -46
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index18.js +8 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index19.js +98 -67
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index25.js +6 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index28.js +7 -3
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/index7.js +4 -1
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/index8.js +12 -7
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index4.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index12.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/index.js +17 -16
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/CounterpartSelector.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/helpers.js +103 -50
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/labels.js +2 -1
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/useCounterpartDetails.js +2 -0
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/useCounterpartForm.js +126 -76
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index.js +12 -11
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index10.js +6 -173
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index11.js +173 -5
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index12.js +5 -57
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index13.js +51 -22
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index14.js +24 -72
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index15.js +76 -0
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index2.js +13 -7
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index5.js +53 -110
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index6.js +115 -51
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index7.js +53 -47
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index8.js +44 -504
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index9.js +480 -6
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +21 -19
- package/dist/libs/tesouro-embedded-components-react/{accept-disclosures-widget/data-access/dist/index2.js → shared/data-access/dist/lib/disclosures/useAcceptWidgetDisclosures.js} +3 -4
- package/dist/libs/tesouro-embedded-components-react/{accept-disclosures-widget/data-access/dist/index3.js → shared/data-access/dist/lib/disclosures/useDisclosuresQuery.js} +4 -5
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
- package/package.json +1 -1
|
@@ -2,127 +2,139 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
"use client";
|
|
4
4
|
"use client";
|
|
5
|
-
import { Button as e
|
|
6
|
-
import { getStateOptions as
|
|
7
|
-
import { VENDOR_INLINE_FORM_LABELS_EN as
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import "../../../shared/counterpart-management/
|
|
12
|
-
import { useCounterpartForm as c } from "../../../shared/counterpart-management/feature/dist/lib/useCounterpartForm.js";
|
|
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 { VENDOR_INLINE_FORM_LABELS_EN as n } from "./index2.js";
|
|
8
|
+
import { AchFieldGroup as r } from "../../../shared/counterpart-management/ui/dist/index5.js";
|
|
9
|
+
import { CounterpartFormFields as i, useFocusFirstInvalidField as a } from "../../../shared/counterpart-management/ui/dist/index9.js";
|
|
10
|
+
import { COUNTERPART_MESSAGE_LABELS_EN as o } from "../../../shared/counterpart-management/feature/dist/lib/labels.js";
|
|
11
|
+
import { useCounterpartForm as s } from "../../../shared/counterpart-management/feature/dist/lib/useCounterpartForm.js";
|
|
13
12
|
import "../../../shared/counterpart-management/feature/dist/index.js";
|
|
14
|
-
import { useEffect as l, useMemo as u, useRef as d, useState as f } from "react";
|
|
13
|
+
import { useCallback as c, useEffect as l, useMemo as u, useRef as d, useState as f } from "react";
|
|
15
14
|
import { Fragment as p, jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
16
15
|
import { Landmark as g, Plus as _, X as v } from "lucide-react";
|
|
17
16
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index4.js
|
|
18
|
-
function y({ mode: y, counterpart: b, primaryAddress: x,
|
|
19
|
-
let
|
|
20
|
-
...
|
|
21
|
-
...
|
|
22
|
-
}, [
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
17
|
+
function y({ mode: y, counterpart: b, primaryAddress: x, bankAccounts: S, isBankAccountsLoading: C, isBankAccountsError: w, initialName: T, onSaved: E, onCancel: D, onDirtyChange: O, labels: k }) {
|
|
18
|
+
let A = {
|
|
19
|
+
...n,
|
|
20
|
+
...k
|
|
21
|
+
}, [j, M] = f("none"), [N, P] = f(b?.id), [F, I] = f(!1), [L, R] = f(!1);
|
|
22
|
+
l(() => {
|
|
23
|
+
O?.(L);
|
|
24
|
+
}, [L, O]);
|
|
25
|
+
let z = u(() => t(), []), B = d(j), V = d(!1), H = s({
|
|
26
|
+
view: j,
|
|
27
|
+
setView: M,
|
|
28
|
+
selectedId: N,
|
|
29
|
+
setSelectedId: P,
|
|
30
|
+
messages: o,
|
|
28
31
|
counterpartType: "vendor",
|
|
29
32
|
counterpart: b,
|
|
30
33
|
primaryAddress: x,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
34
|
+
bankAccounts: S,
|
|
35
|
+
isBankAccountsLoading: C,
|
|
36
|
+
isBankAccountsError: w
|
|
37
|
+
}), { openCreate: U, openEdit: W, setValues: G } = H, K = a(H.errors);
|
|
38
|
+
l(() => {
|
|
39
|
+
y === "edit" ? W() : U();
|
|
35
40
|
}, [
|
|
36
41
|
y,
|
|
37
|
-
|
|
38
|
-
|
|
42
|
+
U,
|
|
43
|
+
W
|
|
39
44
|
]), l(() => {
|
|
40
|
-
|
|
45
|
+
B.current !== "none" && j === "none" && N && E(N), B.current = j;
|
|
41
46
|
}, [
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
47
|
+
j,
|
|
48
|
+
N,
|
|
49
|
+
E
|
|
45
50
|
]), l(() => {
|
|
46
|
-
y !== "create" ||
|
|
51
|
+
y !== "create" || V.current || (V.current = !0, G((e) => ({
|
|
47
52
|
...e,
|
|
48
53
|
entityType: "organization",
|
|
49
|
-
legalName:
|
|
54
|
+
legalName: T?.trim() || e.legalName
|
|
50
55
|
})));
|
|
51
56
|
}, [
|
|
52
57
|
y,
|
|
53
|
-
|
|
54
|
-
|
|
58
|
+
T,
|
|
59
|
+
G
|
|
55
60
|
]), l(() => {
|
|
56
|
-
y === "edit" &&
|
|
57
|
-
}, [
|
|
61
|
+
y === "edit" && (H.values.bankAccount.routingNumber || H.values.bankAccount.accountNumber) && I(!0);
|
|
62
|
+
}, [
|
|
63
|
+
y,
|
|
64
|
+
H.values.bankAccount.accountNumber,
|
|
65
|
+
H.values.bankAccount.routingNumber
|
|
66
|
+
]), l(() => {
|
|
67
|
+
H.sectionsToExpand.bankAccount && I(!0);
|
|
68
|
+
}, [H.sectionsToExpand.bankAccount]);
|
|
69
|
+
let q = c((e) => {
|
|
70
|
+
R(!0), G((t) => e.entityType === "individual" && t.entityType !== "individual" ? {
|
|
71
|
+
...t,
|
|
72
|
+
...e,
|
|
73
|
+
firstName: t.firstName || t.legalName,
|
|
74
|
+
legalName: t.legalName
|
|
75
|
+
} : e.entityType === "organization" && t.entityType !== "organization" ? {
|
|
76
|
+
...t,
|
|
77
|
+
...e,
|
|
78
|
+
legalName: t.legalName || [t.firstName, t.lastName].filter(Boolean).join(" ")
|
|
79
|
+
} : {
|
|
80
|
+
...t,
|
|
81
|
+
...e
|
|
82
|
+
});
|
|
83
|
+
}, [G]);
|
|
84
|
+
return /* @__PURE__ */ h("div", {
|
|
85
|
+
ref: K,
|
|
58
86
|
className: "ttw:flex ttw:flex-col ttw:gap-4 ttw:rounded-lg ttw:border ttw:border-border ttw:bg-card ttw:p-4",
|
|
59
87
|
children: [
|
|
60
88
|
/* @__PURE__ */ h("div", {
|
|
61
89
|
className: "ttw:flex ttw:items-start ttw:justify-between ttw:gap-2",
|
|
62
90
|
children: [/* @__PURE__ */ m("p", {
|
|
63
91
|
className: "ttw:text-base ttw:font-semibold ttw:text-foreground",
|
|
64
|
-
children: y === "edit" ?
|
|
92
|
+
children: y === "edit" ? A.editTitle : A.createTitle
|
|
65
93
|
}), /* @__PURE__ */ m(e, {
|
|
66
94
|
type: "button",
|
|
67
95
|
variant: "ghost",
|
|
68
96
|
size: "icon",
|
|
69
|
-
"aria-label":
|
|
70
|
-
onClick:
|
|
97
|
+
"aria-label": A.close,
|
|
98
|
+
onClick: D,
|
|
71
99
|
children: /* @__PURE__ */ m(v, { className: "ttw:size-4" })
|
|
72
100
|
})]
|
|
73
101
|
}),
|
|
74
|
-
/* @__PURE__ */ m(
|
|
102
|
+
/* @__PURE__ */ m(i, {
|
|
75
103
|
mode: y,
|
|
76
104
|
counterpartMode: "vendor",
|
|
77
|
-
values:
|
|
78
|
-
errors:
|
|
79
|
-
stateOptions:
|
|
80
|
-
onChange:
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
})),
|
|
105
|
+
values: H.values,
|
|
106
|
+
errors: H.errors,
|
|
107
|
+
stateOptions: z,
|
|
108
|
+
onChange: q,
|
|
109
|
+
onAddressChange: (e) => {
|
|
110
|
+
R(!0), G((t) => ({
|
|
111
|
+
...t,
|
|
112
|
+
address: {
|
|
113
|
+
...t.address,
|
|
114
|
+
...e
|
|
115
|
+
}
|
|
116
|
+
}));
|
|
117
|
+
},
|
|
91
118
|
sections: {
|
|
92
|
-
entityType: !
|
|
119
|
+
entityType: !0,
|
|
93
120
|
profileHeading: !1,
|
|
121
|
+
title: !1,
|
|
94
122
|
taxId: !1,
|
|
95
|
-
address:
|
|
123
|
+
address: "collapsible",
|
|
96
124
|
bankAccount: !1
|
|
97
125
|
},
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
idPrefix: "vendor-inline-address",
|
|
102
|
-
values: R.values.address,
|
|
103
|
-
errors: R.errors?.address,
|
|
104
|
-
stateOptions: F,
|
|
105
|
-
onChange: (e) => V((t) => ({
|
|
106
|
-
...t,
|
|
107
|
-
address: {
|
|
108
|
-
...t.address,
|
|
109
|
-
...e
|
|
110
|
-
}
|
|
111
|
-
}))
|
|
112
|
-
}) : /* @__PURE__ */ h("button", {
|
|
113
|
-
type: "button",
|
|
114
|
-
onClick: () => M(!0),
|
|
115
|
-
className: "ttw:flex ttw:w-fit ttw:items-center ttw:gap-1 ttw:text-sm ttw:font-medium ttw:text-primary ttw:hover:underline",
|
|
116
|
-
children: [/* @__PURE__ */ m(_, { className: "ttw:size-4" }), E.addAddress]
|
|
126
|
+
sectionsToExpand: H.sectionsToExpand,
|
|
127
|
+
onAddressExpand: H.expandAddress,
|
|
128
|
+
labels: { businessNameLabel: A.nameLabel }
|
|
117
129
|
}),
|
|
118
130
|
/* @__PURE__ */ h("div", {
|
|
119
131
|
className: "ttw:flex ttw:flex-col ttw:gap-1",
|
|
120
132
|
children: [/* @__PURE__ */ m("p", {
|
|
121
133
|
className: "ttw:text-sm ttw:font-semibold ttw:text-foreground",
|
|
122
|
-
children:
|
|
134
|
+
children: A.paymentMethodsHeading
|
|
123
135
|
}), /* @__PURE__ */ m("p", {
|
|
124
136
|
className: "ttw:text-sm ttw:text-muted-foreground",
|
|
125
|
-
children:
|
|
137
|
+
children: A.paymentMethodsDescription
|
|
126
138
|
})]
|
|
127
139
|
}),
|
|
128
140
|
/* @__PURE__ */ h("div", {
|
|
@@ -139,77 +151,38 @@ function y({ mode: y, counterpart: b, primaryAddress: x, initialName: S, onSaved
|
|
|
139
151
|
className: "ttw:flex ttw:flex-col ttw:gap-0.5",
|
|
140
152
|
children: [/* @__PURE__ */ m("p", {
|
|
141
153
|
className: "ttw:text-sm ttw:font-medium ttw:text-foreground",
|
|
142
|
-
children:
|
|
154
|
+
children: A.achTitle
|
|
143
155
|
}), /* @__PURE__ */ m("p", {
|
|
144
156
|
className: "ttw:text-sm ttw:text-muted-foreground",
|
|
145
|
-
children:
|
|
157
|
+
children: A.achDescription
|
|
146
158
|
})]
|
|
147
|
-
}),
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
className: "ttw:flex ttw:flex-col ttw:gap-1.5",
|
|
170
|
-
children: [/* @__PURE__ */ m(n, {
|
|
171
|
-
htmlFor: "vendor-inline-routing",
|
|
172
|
-
children: E.routingNumberLabel
|
|
173
|
-
}), /* @__PURE__ */ m(t, {
|
|
174
|
-
id: "vendor-inline-routing",
|
|
175
|
-
value: R.values.bankAccount.routingNumber,
|
|
176
|
-
"aria-invalid": !!R.errors?.bankAccount?.routingNumber,
|
|
177
|
-
onChange: (e) => V((t) => ({
|
|
178
|
-
...t,
|
|
179
|
-
bankAccount: {
|
|
180
|
-
...t.bankAccount,
|
|
181
|
-
routingNumber: e.target.value
|
|
182
|
-
}
|
|
183
|
-
}))
|
|
184
|
-
})]
|
|
185
|
-
}), /* @__PURE__ */ h("div", {
|
|
186
|
-
className: "ttw:flex ttw:flex-col ttw:gap-1.5",
|
|
187
|
-
children: [/* @__PURE__ */ m(n, {
|
|
188
|
-
htmlFor: "vendor-inline-account-number",
|
|
189
|
-
children: E.accountNumberLabel
|
|
190
|
-
}), /* @__PURE__ */ m(t, {
|
|
191
|
-
id: "vendor-inline-account-number",
|
|
192
|
-
value: R.values.bankAccount.accountNumber,
|
|
193
|
-
"aria-invalid": !!R.errors?.bankAccount?.accountNumber,
|
|
194
|
-
onChange: (e) => V((t) => ({
|
|
195
|
-
...t,
|
|
196
|
-
bankAccount: {
|
|
197
|
-
...t.bankAccount,
|
|
198
|
-
accountNumber: e.target.value
|
|
199
|
-
}
|
|
200
|
-
}))
|
|
201
|
-
})]
|
|
202
|
-
})]
|
|
203
|
-
}),
|
|
204
|
-
/* @__PURE__ */ m("p", {
|
|
205
|
-
className: "ttw:text-sm ttw:text-muted-foreground",
|
|
206
|
-
children: E.achHelp
|
|
207
|
-
})
|
|
208
|
-
] }) : /* @__PURE__ */ h("button", {
|
|
159
|
+
}), F ? /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ m(r, {
|
|
160
|
+
idPrefix: "vendor-inline-ach",
|
|
161
|
+
values: H.values.bankAccount,
|
|
162
|
+
errors: H.errors?.bankAccount,
|
|
163
|
+
onChange: (e) => {
|
|
164
|
+
R(!0), G((t) => ({
|
|
165
|
+
...t,
|
|
166
|
+
bankAccount: {
|
|
167
|
+
...t.bankAccount,
|
|
168
|
+
...e
|
|
169
|
+
}
|
|
170
|
+
}));
|
|
171
|
+
},
|
|
172
|
+
labels: {
|
|
173
|
+
accountHolderName: A.accountHolderNameLabel,
|
|
174
|
+
routingNumber: A.routingNumberLabel,
|
|
175
|
+
accountNumber: A.accountNumberLabel
|
|
176
|
+
}
|
|
177
|
+
}), /* @__PURE__ */ m("p", {
|
|
178
|
+
className: "ttw:text-sm ttw:text-muted-foreground",
|
|
179
|
+
children: A.achHelp
|
|
180
|
+
})] }) : /* @__PURE__ */ h(e, {
|
|
209
181
|
type: "button",
|
|
210
|
-
|
|
211
|
-
className: "ttw:
|
|
212
|
-
|
|
182
|
+
variant: "link",
|
|
183
|
+
className: "ttw:w-fit ttw:px-0",
|
|
184
|
+
onClick: () => I(!0),
|
|
185
|
+
children: [/* @__PURE__ */ m(_, { className: "ttw:size-4" }), A.addBankAccount]
|
|
213
186
|
})]
|
|
214
187
|
})]
|
|
215
188
|
}),
|
|
@@ -218,14 +191,14 @@ function y({ mode: y, counterpart: b, primaryAddress: x, initialName: S, onSaved
|
|
|
218
191
|
children: [/* @__PURE__ */ m(e, {
|
|
219
192
|
type: "button",
|
|
220
193
|
variant: "outline",
|
|
221
|
-
onClick:
|
|
222
|
-
children:
|
|
194
|
+
onClick: D,
|
|
195
|
+
children: A.cancel
|
|
223
196
|
}), /* @__PURE__ */ m(e, {
|
|
224
197
|
type: "button",
|
|
225
|
-
onClick:
|
|
226
|
-
loading:
|
|
227
|
-
disabled:
|
|
228
|
-
children:
|
|
198
|
+
onClick: H.submit,
|
|
199
|
+
loading: H.isSubmitting,
|
|
200
|
+
disabled: H.isSubmitting,
|
|
201
|
+
children: A.save
|
|
229
202
|
})]
|
|
230
203
|
})
|
|
231
204
|
]
|
|
@@ -5,105 +5,196 @@
|
|
|
5
5
|
import { VENDOR_SECTION_PROPS_LABELS_EN as e } from "./index2.js";
|
|
6
6
|
import { usePayableSuggestionsQuery as t } from "../../data-access/dist/index11.js";
|
|
7
7
|
import "../../data-access/dist/index.js";
|
|
8
|
-
import {
|
|
9
|
-
import { useCounterpartsQuery as
|
|
10
|
-
import {
|
|
8
|
+
import { counterpartFormBankAccountToCreatePayload as ee, counterpartFormBankAccountToUpdatePayload as te, getAchInstructions as n, getCounterpartEmail as r, getCounterpartName as i, getPayableAchInstructions as ne, hasAchFormValues as a, resolveCounterpartBankAccountWrite as re, validateAchFormValues as ie } from "../../../shared/counterpart-management/feature/dist/lib/helpers.js";
|
|
9
|
+
import { useCounterpartsQuery as ae } from "../../../shared/counterpart-management/data-access/dist/index3.js";
|
|
10
|
+
import { useCreateCounterpartBankAccountMutation as oe, useUpdateCounterpartBankAccountMutation as o } from "../../../shared/counterpart-management/data-access/dist/index5.js";
|
|
11
|
+
import { useCounterpartDetails as s } from "../../../shared/counterpart-management/feature/dist/lib/useCounterpartDetails.js";
|
|
11
12
|
import "../../../shared/counterpart-management/feature/dist/index.js";
|
|
12
|
-
import { VendorInlineForm as
|
|
13
|
-
import { useCallback as
|
|
14
|
-
import { jsx as
|
|
13
|
+
import { VendorInlineForm as se } from "./index4.js";
|
|
14
|
+
import { useCallback as c, useEffect as l, useMemo as u, useRef as d, useState as f } from "react";
|
|
15
|
+
import { jsx as p } from "react/jsx-runtime";
|
|
15
16
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index5.js
|
|
16
|
-
var
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
var m = 10, ce = 300, h = {
|
|
18
|
+
accountHolderName: "",
|
|
19
|
+
routingNumber: "",
|
|
20
|
+
accountNumber: ""
|
|
21
|
+
};
|
|
22
|
+
function le(e) {
|
|
23
|
+
return `••••••••${e.slice(-4)}`;
|
|
24
|
+
}
|
|
25
|
+
function g({ payableId: g, counterpartId: _, payableCounterpartId: v, onCounterpartChange: y, requiredError: b, labels: x }) {
|
|
26
|
+
let S = {
|
|
19
27
|
...e,
|
|
20
|
-
...
|
|
21
|
-
}, [
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
28
|
+
...x
|
|
29
|
+
}, [C, w] = f(""), [T, E] = f(""), [D, O] = f(), [ue, k] = f(!1), [A, j] = f(h), M = d(A);
|
|
30
|
+
M.current = A;
|
|
31
|
+
let [N, P] = f(!1), F = a(A) || N, [I, L] = f(), [R, z] = f(), B = d(_), [V, H] = f(!1), U = c(() => {
|
|
32
|
+
k(!1), j(h), L(void 0), z(void 0);
|
|
33
|
+
}, []), W = c((e) => {
|
|
34
|
+
H(!0), y(e);
|
|
35
|
+
}, [y]), G = t(g, { enabled: !!g && !_ && !v }).data?.suggested_counterpart?.id;
|
|
36
|
+
l(() => {
|
|
37
|
+
!V && !_ && !v && G && W(G);
|
|
26
38
|
}, [
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
]),
|
|
39
|
+
_,
|
|
40
|
+
v,
|
|
41
|
+
V,
|
|
42
|
+
G,
|
|
43
|
+
W
|
|
44
|
+
]), l(() => {
|
|
45
|
+
B.current !== _ && (B.current = _, U());
|
|
46
|
+
}, [_, U]), l(() => {
|
|
33
47
|
let e = setTimeout(() => {
|
|
34
|
-
|
|
35
|
-
},
|
|
48
|
+
E(C.trim());
|
|
49
|
+
}, ce);
|
|
36
50
|
return () => clearTimeout(e);
|
|
37
|
-
}, [
|
|
38
|
-
let
|
|
51
|
+
}, [C]);
|
|
52
|
+
let K = ae({
|
|
39
53
|
sort: "counterpart_name",
|
|
40
54
|
order: "asc",
|
|
41
|
-
limit:
|
|
42
|
-
counterpart_name__icontains:
|
|
55
|
+
limit: m,
|
|
56
|
+
counterpart_name__icontains: T || void 0,
|
|
43
57
|
is_vendor: !0,
|
|
44
|
-
enabled: !!
|
|
45
|
-
}),
|
|
46
|
-
let e =
|
|
58
|
+
enabled: !!T
|
|
59
|
+
}), q = s({ selectedId: _ }), J = oe(), Y = o(), X = u(() => {
|
|
60
|
+
let e = q.counterpart;
|
|
47
61
|
if (!e) return;
|
|
48
|
-
|
|
62
|
+
if (q.isBankAccountsLoading) return {
|
|
63
|
+
name: i(e),
|
|
64
|
+
email: r(e),
|
|
65
|
+
methodLabel: S.paymentMethodLoading,
|
|
66
|
+
fields: []
|
|
67
|
+
};
|
|
68
|
+
if (q.isBankAccountsError) return {
|
|
69
|
+
name: i(e),
|
|
70
|
+
email: r(e),
|
|
71
|
+
methodLabel: S.paymentMethodUnavailable,
|
|
72
|
+
fields: []
|
|
73
|
+
};
|
|
74
|
+
let t = ne(q.bankAccounts);
|
|
49
75
|
return {
|
|
50
|
-
name:
|
|
51
|
-
email:
|
|
52
|
-
methodLabel: t ?
|
|
76
|
+
name: i(e),
|
|
77
|
+
email: r(e),
|
|
78
|
+
methodLabel: t ? S.achMethod : S.noMethod,
|
|
53
79
|
fields: t ? [
|
|
54
80
|
{
|
|
55
|
-
label:
|
|
81
|
+
label: S.accountHolder,
|
|
56
82
|
value: t.account_holder_name ?? ""
|
|
57
83
|
},
|
|
58
84
|
{
|
|
59
|
-
label:
|
|
85
|
+
label: S.routingNumber,
|
|
60
86
|
value: t.routing_number ?? ""
|
|
61
87
|
},
|
|
62
88
|
{
|
|
63
|
-
label:
|
|
64
|
-
value: "",
|
|
65
|
-
maskedValue: t.account_number
|
|
89
|
+
label: S.accountNumber,
|
|
90
|
+
value: t.account_number ?? "",
|
|
91
|
+
maskedValue: t.account_number ? le(t.account_number) : ""
|
|
66
92
|
}
|
|
67
93
|
] : []
|
|
68
94
|
};
|
|
69
95
|
}, [
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
96
|
+
q.bankAccounts,
|
|
97
|
+
q.counterpart,
|
|
98
|
+
q.isBankAccountsError,
|
|
99
|
+
q.isBankAccountsLoading,
|
|
100
|
+
S
|
|
101
|
+
]), Z = u(() => n(q.bankAccounts), [q.bankAccounts]), Q = c(async () => {
|
|
102
|
+
let e = M.current;
|
|
103
|
+
if (!_ || !a(e)) return !0;
|
|
104
|
+
if (q.isBankAccountsLoading || q.isBankAccountsError) return !1;
|
|
105
|
+
let t = ie(e);
|
|
106
|
+
if (Object.keys(t).length > 0) return L(t), k(!0), !1;
|
|
107
|
+
L(void 0);
|
|
108
|
+
let n = re(q.bankAccounts, R ?? Z?.id);
|
|
109
|
+
if (n.kind === "update") return await Y.mutateAsync({
|
|
110
|
+
path: {
|
|
111
|
+
counterpart_id: _,
|
|
112
|
+
bank_account_id: n.bankAccountId
|
|
113
|
+
},
|
|
114
|
+
body: te(e, { includeAchDefaults: n.includeAchDefaults })
|
|
115
|
+
}), z(n.bankAccountId), !0;
|
|
116
|
+
let r = await J.mutateAsync({
|
|
117
|
+
path: { counterpart_id: _ },
|
|
118
|
+
body: ee(e)
|
|
119
|
+
});
|
|
120
|
+
return z(r?.id), !0;
|
|
121
|
+
}, [
|
|
122
|
+
Z,
|
|
123
|
+
_,
|
|
124
|
+
J,
|
|
125
|
+
q.bankAccounts,
|
|
126
|
+
q.isBankAccountsError,
|
|
127
|
+
q.isBankAccountsLoading,
|
|
128
|
+
R,
|
|
129
|
+
Y
|
|
130
|
+
]), de = u(() => (K.data?.data ?? []).map((e) => ({
|
|
131
|
+
name: i(e),
|
|
132
|
+
email: r(e),
|
|
133
|
+
onSelect: () => W(e.id)
|
|
134
|
+
})), [K.data, W]), $ = c(() => {
|
|
135
|
+
O(void 0), P(!1);
|
|
136
|
+
}, []), fe = c((e) => {
|
|
137
|
+
O(void 0), P(!1), W(e);
|
|
138
|
+
}, [W]);
|
|
139
|
+
if (D) return {
|
|
81
140
|
mode: "creating",
|
|
82
|
-
newVendorForm: /* @__PURE__ */
|
|
83
|
-
mode:
|
|
84
|
-
counterpart:
|
|
85
|
-
primaryAddress:
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
141
|
+
newVendorForm: /* @__PURE__ */ p(se, {
|
|
142
|
+
mode: D,
|
|
143
|
+
counterpart: D === "edit" ? q.counterpart : void 0,
|
|
144
|
+
primaryAddress: D === "edit" ? q.primaryAddress : void 0,
|
|
145
|
+
bankAccounts: D === "edit" ? q.bankAccounts : void 0,
|
|
146
|
+
isBankAccountsLoading: D === "edit" ? q.isBankAccountsLoading : void 0,
|
|
147
|
+
isBankAccountsError: D === "edit" ? q.isBankAccountsError : void 0,
|
|
148
|
+
initialName: D === "create" ? C : void 0,
|
|
149
|
+
onSaved: fe,
|
|
150
|
+
onCancel: $,
|
|
151
|
+
onDirtyChange: P
|
|
89
152
|
}),
|
|
90
|
-
onClear:
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
153
|
+
onClear: $,
|
|
154
|
+
hasUnsavedVendorChanges: F
|
|
155
|
+
};
|
|
156
|
+
if (X) {
|
|
157
|
+
let e = q.isBankAccountsLoading || q.isBankAccountsError;
|
|
158
|
+
return {
|
|
159
|
+
mode: "resolved",
|
|
160
|
+
summary: X,
|
|
161
|
+
onEdit: e ? void 0 : () => O("edit"),
|
|
162
|
+
onClear: () => W(void 0),
|
|
163
|
+
paymentInstructions: e ? void 0 : {
|
|
164
|
+
isOpen: ue,
|
|
165
|
+
values: A,
|
|
166
|
+
errors: I,
|
|
167
|
+
onOpen: () => {
|
|
168
|
+
k(!0), Z && (j({
|
|
169
|
+
accountHolderName: Z.account_holder_name ?? "",
|
|
170
|
+
routingNumber: Z.routing_number ?? "",
|
|
171
|
+
accountNumber: Z.account_number ?? ""
|
|
172
|
+
}), z(Z.id));
|
|
173
|
+
},
|
|
174
|
+
onChange: (e) => {
|
|
175
|
+
j((t) => ({
|
|
176
|
+
...t,
|
|
177
|
+
...e
|
|
178
|
+
})), L(void 0);
|
|
179
|
+
}
|
|
180
|
+
},
|
|
181
|
+
savePaymentInstructions: Q,
|
|
182
|
+
hasUnsavedVendorChanges: F
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
return {
|
|
97
186
|
mode: "selecting",
|
|
98
|
-
error:
|
|
187
|
+
error: K.isError ? S.searchFailed : q.isError ? S.vendorDetailsFailed : b,
|
|
99
188
|
search: {
|
|
100
|
-
query:
|
|
101
|
-
onQueryChange:
|
|
102
|
-
isLoading:
|
|
103
|
-
onAddVendor: () =>
|
|
104
|
-
results:
|
|
105
|
-
}
|
|
189
|
+
query: C,
|
|
190
|
+
onQueryChange: w,
|
|
191
|
+
isLoading: K.isLoading,
|
|
192
|
+
onAddVendor: () => O("create"),
|
|
193
|
+
results: de
|
|
194
|
+
},
|
|
195
|
+
savePaymentInstructions: Q,
|
|
196
|
+
hasUnsavedVendorChanges: F
|
|
106
197
|
};
|
|
107
198
|
}
|
|
108
199
|
//#endregion
|
|
109
|
-
export {
|
|
200
|
+
export { g as useVendorSectionProps };
|
|
@@ -24,9 +24,9 @@ function o(e) {
|
|
|
24
24
|
function s(e) {
|
|
25
25
|
return (e / 100).toFixed(2);
|
|
26
26
|
}
|
|
27
|
-
function c({ values: e, counterpartId: r,
|
|
28
|
-
let
|
|
29
|
-
return r && (
|
|
27
|
+
function c({ values: e, counterpartId: r, clearCounterpart: i, editedTotals: a }) {
|
|
28
|
+
let o = { currency: t };
|
|
29
|
+
return r ? o.counterpart_id = r : i && (o.counterpart_id = null), e.invoiceNumber && (o.document_id = e.invoiceNumber), e.invoiceDate && (o.issued_at = e.invoiceDate), e.dueDate && (o.due_date = e.dueDate), a && (o.discount = n(a.discount) ?? 0, o.tax_amount = n(a.tax) ?? 0, a.total !== void 0 && (o.total_amount = n(a.total) ?? 0)), o;
|
|
30
30
|
}
|
|
31
31
|
function l(e) {
|
|
32
32
|
return e.filter(i).map((e) => {
|