@tesouro/embedded-components-react 0.7.46 → 0.7.47
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.d.ts +4 -0
- package/dist/lib/CounterpartsWidget.d.ts +4 -0
- package/dist/lib/CounterpartsWidgetPublic.d.ts +4 -0
- package/dist/lib/CustomersWidget.d.ts +2 -0
- package/dist/lib/ReceivablesWidget.d.ts +2 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index31.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index32.js +40 -42
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index33.js +1 -3
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index2.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index3.js +44 -44
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/helpers.js +13 -13
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/labels.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/useCounterpartForm.js +85 -84
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index10.js +238 -241
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index11.js +2 -0
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index2.js +6 -5
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index5.js +2 -0
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
- package/package.json +1 -1
package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index10.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { Button as e, Checkbox as t, FieldRequirement as n, Input as r, Label as i, RequiredFieldsLegend as a, Separator as o, Typography as s, mergeRequiredFieldsLegendLabels as c } from "../../../../../../packages/shared-ui-shadcn/dist/index.js";
|
|
2
|
-
import {
|
|
3
|
-
import { FieldError as
|
|
4
|
-
import { AchFieldGroup as
|
|
5
|
-
import { AddressFieldGroup as
|
|
6
|
-
import { CounterpartAddressFields as
|
|
7
|
-
import { CounterpartTypeChooser as
|
|
8
|
-
import { FormSheet as
|
|
9
|
-
import { useEffect as
|
|
10
|
-
import { Fragment as
|
|
11
|
-
import { Plus as
|
|
2
|
+
import { COUNTERPART_FORM_SHEET_LABELS_EN as l } from "./index2.js";
|
|
3
|
+
import { FieldError as u } from "./index4.js";
|
|
4
|
+
import { AchFieldGroup as d } from "./index5.js";
|
|
5
|
+
import { AddressFieldGroup as f } from "./index6.js";
|
|
6
|
+
import { CounterpartAddressFields as p } from "./index7.js";
|
|
7
|
+
import { CounterpartTypeChooser as m } from "./index8.js";
|
|
8
|
+
import { FormSheet as h } from "./index9.js";
|
|
9
|
+
import { useEffect as g, useId as _, useRef as v } from "react";
|
|
10
|
+
import { Fragment as y, jsx as b, jsxs as x } from "react/jsx-runtime";
|
|
11
|
+
import { Plus as S } from "lucide-react";
|
|
12
12
|
//#region ../../libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index10.js
|
|
13
|
-
var
|
|
13
|
+
var C = {
|
|
14
14
|
entityType: !0,
|
|
15
15
|
title: !0,
|
|
16
16
|
profileHeading: !0,
|
|
@@ -19,30 +19,30 @@ var w = {
|
|
|
19
19
|
address: !0,
|
|
20
20
|
bankAccount: !0
|
|
21
21
|
};
|
|
22
|
-
function
|
|
22
|
+
function w({ show: e, sectionsToExpand: t }) {
|
|
23
23
|
return {
|
|
24
24
|
isAddressShown: e.address === !0 || e.address === "collapsible",
|
|
25
25
|
isAddressExpanded: e.address === !0 || t?.address === !0
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
|
-
function
|
|
29
|
-
return typeof e == "string" ? +!!e : !e || typeof e != "object" ? 0 : Object.values(e).reduce((e, t) => e +
|
|
28
|
+
function T(e) {
|
|
29
|
+
return typeof e == "string" ? +!!e : !e || typeof e != "object" ? 0 : Object.values(e).reduce((e, t) => e + T(t), 0);
|
|
30
30
|
}
|
|
31
|
-
function
|
|
32
|
-
let t =
|
|
33
|
-
return
|
|
31
|
+
function E(e) {
|
|
32
|
+
let t = v(null), n = v(e);
|
|
33
|
+
return g(() => {
|
|
34
34
|
if (e === n.current) return;
|
|
35
35
|
let r = n.current;
|
|
36
|
-
n.current = e, !(
|
|
36
|
+
n.current = e, !(T(e) < T(r)) && (t.current?.querySelector("[aria-invalid=\"true\"]"))?.focus();
|
|
37
37
|
}, [e]), t;
|
|
38
38
|
}
|
|
39
|
-
function
|
|
39
|
+
function D(e) {
|
|
40
40
|
let t = {
|
|
41
|
-
...
|
|
41
|
+
...l.fieldMarkers,
|
|
42
42
|
...e?.fieldMarkers
|
|
43
43
|
};
|
|
44
44
|
return {
|
|
45
|
-
...
|
|
45
|
+
...l,
|
|
46
46
|
...e?.createButton !== void 0 && {
|
|
47
47
|
createButtonCustomer: e.createButton,
|
|
48
48
|
createButtonVendor: e.createButton
|
|
@@ -50,7 +50,7 @@ function O(e) {
|
|
|
50
50
|
...e,
|
|
51
51
|
fieldMarkers: t,
|
|
52
52
|
address: {
|
|
53
|
-
...
|
|
53
|
+
...l.address,
|
|
54
54
|
...e?.address,
|
|
55
55
|
fieldMarkers: {
|
|
56
56
|
...t,
|
|
@@ -59,7 +59,7 @@ function O(e) {
|
|
|
59
59
|
},
|
|
60
60
|
requiredFieldsLegend: c(t, e?.requiredFieldsLegend),
|
|
61
61
|
ach: {
|
|
62
|
-
...
|
|
62
|
+
...l.ach,
|
|
63
63
|
...e?.accountHolderNameLabel !== void 0 && { accountHolderName: e.accountHolderNameLabel },
|
|
64
64
|
...e?.routingNumberLabel !== void 0 && { routingNumber: e.routingNumberLabel },
|
|
65
65
|
...e?.accountNumberLabel !== void 0 && { accountNumber: e.accountNumberLabel },
|
|
@@ -71,51 +71,51 @@ function O(e) {
|
|
|
71
71
|
}
|
|
72
72
|
};
|
|
73
73
|
}
|
|
74
|
-
function
|
|
75
|
-
let P =
|
|
74
|
+
function O({ open: e, onOpenChange: c, mode: l, counterpartMode: f = "customer", values: g, errors: v, stateOptions: S, taxIdField: C, inProgress: w, submitDisabled: T, onChange: O, onAddressChange: k, onBankAccountChange: A, onSubmit: j, onCancel: M, labels: N }) {
|
|
75
|
+
let P = D(N), F = _(), I = g.entityType === "organization", L = f === "customer", R = f === "vendor", z = E(v), B = l === "edit" ? L ? P.editTitleCustomer : P.editTitleVendor : L ? P.createTitleCustomer : P.createTitleVendor, V = l === "create" ? L ? P.createDescriptionCustomer : P.createDescriptionVendor : void 0, H = l === "edit" ? P.saveButton : L ? P.createButtonCustomer : P.createButtonVendor, U = L ? P.customerTypeHeading : P.vendorTypeHeading, W = /* @__PURE__ */ x("div", {
|
|
76
76
|
className: "ttw:flex ttw:flex-1 ttw:flex-col ttw:gap-1.5",
|
|
77
77
|
children: [
|
|
78
|
-
/* @__PURE__ */
|
|
78
|
+
/* @__PURE__ */ b(i, {
|
|
79
79
|
htmlFor: `${F}-email`,
|
|
80
80
|
requirement: n.Required,
|
|
81
81
|
labels: P.fieldMarkers,
|
|
82
82
|
children: P.emailLabel
|
|
83
83
|
}),
|
|
84
|
-
/* @__PURE__ */
|
|
84
|
+
/* @__PURE__ */ b(r, {
|
|
85
85
|
id: `${F}-email`,
|
|
86
86
|
type: "email",
|
|
87
|
-
value:
|
|
87
|
+
value: g.email,
|
|
88
88
|
"aria-required": !0,
|
|
89
|
-
"aria-invalid": !!
|
|
90
|
-
onChange: (e) =>
|
|
89
|
+
"aria-invalid": !!v?.email,
|
|
90
|
+
onChange: (e) => O({ email: e.target.value })
|
|
91
91
|
}),
|
|
92
|
-
/* @__PURE__ */
|
|
92
|
+
/* @__PURE__ */ b(u, { message: v?.email })
|
|
93
93
|
]
|
|
94
|
-
}), G = /* @__PURE__ */
|
|
94
|
+
}), G = /* @__PURE__ */ x("div", {
|
|
95
95
|
className: "ttw:flex ttw:flex-1 ttw:flex-col ttw:gap-1.5",
|
|
96
96
|
children: [
|
|
97
|
-
/* @__PURE__ */
|
|
97
|
+
/* @__PURE__ */ b(i, {
|
|
98
98
|
htmlFor: `${F}-phone`,
|
|
99
99
|
requirement: n.Optional,
|
|
100
100
|
labels: P.fieldMarkers,
|
|
101
101
|
children: P.phoneLabel
|
|
102
102
|
}),
|
|
103
|
-
/* @__PURE__ */
|
|
103
|
+
/* @__PURE__ */ b(r, {
|
|
104
104
|
id: `${F}-phone`,
|
|
105
105
|
type: "tel",
|
|
106
|
-
value:
|
|
107
|
-
"aria-invalid": !!
|
|
108
|
-
onChange: (e) =>
|
|
106
|
+
value: g.phone,
|
|
107
|
+
"aria-invalid": !!v?.phone,
|
|
108
|
+
onChange: (e) => O({ phone: e.target.value })
|
|
109
109
|
}),
|
|
110
|
-
/* @__PURE__ */
|
|
110
|
+
/* @__PURE__ */ b(u, { message: v?.phone })
|
|
111
111
|
]
|
|
112
112
|
});
|
|
113
|
-
return /* @__PURE__ */
|
|
113
|
+
return /* @__PURE__ */ b(h, {
|
|
114
114
|
open: e,
|
|
115
115
|
onOpenChange: c,
|
|
116
116
|
title: B,
|
|
117
117
|
description: V,
|
|
118
|
-
formError:
|
|
118
|
+
formError: v?.form,
|
|
119
119
|
inProgress: w,
|
|
120
120
|
submitDisabled: T,
|
|
121
121
|
initialFocusId: I ? `${F}-legal-name` : `${F}-first-name`,
|
|
@@ -123,14 +123,14 @@ function k({ open: e, onOpenChange: c, mode: l, counterpartMode: u = "customer",
|
|
|
123
123
|
cancelLabel: P.cancelButton,
|
|
124
124
|
onSubmit: j,
|
|
125
125
|
onCancel: M,
|
|
126
|
-
children: /* @__PURE__ */
|
|
126
|
+
children: /* @__PURE__ */ x("div", {
|
|
127
127
|
ref: z,
|
|
128
128
|
style: { display: "contents" },
|
|
129
129
|
children: [
|
|
130
|
-
/* @__PURE__ */
|
|
131
|
-
l === "create" && /* @__PURE__ */
|
|
132
|
-
value:
|
|
133
|
-
onChange: (e) =>
|
|
130
|
+
/* @__PURE__ */ b(a, { labels: P.requiredFieldsLegend }),
|
|
131
|
+
l === "create" && /* @__PURE__ */ b(m, {
|
|
132
|
+
value: g.entityType,
|
|
133
|
+
onChange: (e) => O({ entityType: e }),
|
|
134
134
|
variant: "pills",
|
|
135
135
|
labels: {
|
|
136
136
|
heading: U,
|
|
@@ -140,154 +140,154 @@ function k({ open: e, onOpenChange: c, mode: l, counterpartMode: u = "customer",
|
|
|
140
140
|
individualHint: P.personTypeHint
|
|
141
141
|
}
|
|
142
142
|
}),
|
|
143
|
-
I ? /* @__PURE__ */
|
|
143
|
+
I ? /* @__PURE__ */ x("div", {
|
|
144
144
|
className: "ttw:flex ttw:flex-col ttw:gap-1.5",
|
|
145
145
|
children: [
|
|
146
|
-
/* @__PURE__ */
|
|
146
|
+
/* @__PURE__ */ b(i, {
|
|
147
147
|
htmlFor: `${F}-legal-name`,
|
|
148
148
|
requirement: n.Required,
|
|
149
149
|
labels: P.fieldMarkers,
|
|
150
150
|
children: P.businessNameLabel
|
|
151
151
|
}),
|
|
152
|
-
/* @__PURE__ */
|
|
152
|
+
/* @__PURE__ */ b(r, {
|
|
153
153
|
id: `${F}-legal-name`,
|
|
154
|
-
value:
|
|
154
|
+
value: g.legalName,
|
|
155
155
|
"aria-required": !0,
|
|
156
|
-
"aria-invalid": !!
|
|
157
|
-
onChange: (e) =>
|
|
156
|
+
"aria-invalid": !!v?.legalName,
|
|
157
|
+
onChange: (e) => O({ legalName: e.target.value })
|
|
158
158
|
}),
|
|
159
|
-
/* @__PURE__ */
|
|
159
|
+
/* @__PURE__ */ b(u, { message: v?.legalName })
|
|
160
160
|
]
|
|
161
|
-
}) : /* @__PURE__ */
|
|
161
|
+
}) : /* @__PURE__ */ x("div", {
|
|
162
162
|
className: "ttw:grid ttw:grid-cols-2 ttw:gap-4",
|
|
163
|
-
children: [/* @__PURE__ */
|
|
163
|
+
children: [/* @__PURE__ */ x("div", {
|
|
164
164
|
className: "ttw:flex ttw:flex-col ttw:gap-1.5",
|
|
165
165
|
children: [
|
|
166
|
-
/* @__PURE__ */
|
|
166
|
+
/* @__PURE__ */ b(i, {
|
|
167
167
|
htmlFor: `${F}-first-name`,
|
|
168
168
|
requirement: n.Required,
|
|
169
169
|
labels: P.fieldMarkers,
|
|
170
170
|
children: P.firstNameLabel
|
|
171
171
|
}),
|
|
172
|
-
/* @__PURE__ */
|
|
172
|
+
/* @__PURE__ */ b(r, {
|
|
173
173
|
id: `${F}-first-name`,
|
|
174
|
-
value:
|
|
174
|
+
value: g.firstName,
|
|
175
175
|
"aria-required": !0,
|
|
176
|
-
"aria-invalid": !!
|
|
177
|
-
onChange: (e) =>
|
|
176
|
+
"aria-invalid": !!v?.firstName,
|
|
177
|
+
onChange: (e) => O({ firstName: e.target.value })
|
|
178
178
|
}),
|
|
179
|
-
/* @__PURE__ */
|
|
179
|
+
/* @__PURE__ */ b(u, { message: v?.firstName })
|
|
180
180
|
]
|
|
181
|
-
}), /* @__PURE__ */
|
|
181
|
+
}), /* @__PURE__ */ x("div", {
|
|
182
182
|
className: "ttw:flex ttw:flex-col ttw:gap-1.5",
|
|
183
183
|
children: [
|
|
184
|
-
/* @__PURE__ */
|
|
184
|
+
/* @__PURE__ */ b(i, {
|
|
185
185
|
htmlFor: `${F}-last-name`,
|
|
186
186
|
requirement: n.Required,
|
|
187
187
|
labels: P.fieldMarkers,
|
|
188
188
|
children: P.lastNameLabel
|
|
189
189
|
}),
|
|
190
|
-
/* @__PURE__ */
|
|
190
|
+
/* @__PURE__ */ b(r, {
|
|
191
191
|
id: `${F}-last-name`,
|
|
192
|
-
value:
|
|
192
|
+
value: g.lastName,
|
|
193
193
|
"aria-required": !0,
|
|
194
|
-
"aria-invalid": !!
|
|
195
|
-
onChange: (e) =>
|
|
194
|
+
"aria-invalid": !!v?.lastName,
|
|
195
|
+
onChange: (e) => O({ lastName: e.target.value })
|
|
196
196
|
}),
|
|
197
|
-
/* @__PURE__ */
|
|
197
|
+
/* @__PURE__ */ b(u, { message: v?.lastName })
|
|
198
198
|
]
|
|
199
199
|
})]
|
|
200
200
|
}),
|
|
201
|
-
L ? /* @__PURE__ */
|
|
201
|
+
L ? /* @__PURE__ */ x(y, { children: [
|
|
202
202
|
W,
|
|
203
|
-
/* @__PURE__ */
|
|
203
|
+
/* @__PURE__ */ x(i, {
|
|
204
204
|
htmlFor: `${F}-reminders`,
|
|
205
205
|
className: "ttw:flex ttw:items-start ttw:gap-3 ttw:rounded-md ttw:border ttw:border-border ttw:p-3",
|
|
206
|
-
children: [/* @__PURE__ */
|
|
206
|
+
children: [/* @__PURE__ */ b(t, {
|
|
207
207
|
id: `${F}-reminders`,
|
|
208
|
-
checked:
|
|
209
|
-
onCheckedChange: (e) =>
|
|
210
|
-
}), /* @__PURE__ */
|
|
208
|
+
checked: g.remindersEnabled,
|
|
209
|
+
onCheckedChange: (e) => O({ remindersEnabled: e === !0 })
|
|
210
|
+
}), /* @__PURE__ */ x("span", {
|
|
211
211
|
className: "ttw:flex ttw:flex-col ttw:gap-0.5",
|
|
212
|
-
children: [/* @__PURE__ */
|
|
212
|
+
children: [/* @__PURE__ */ b("span", {
|
|
213
213
|
className: "ttw:text-sm ttw:font-medium",
|
|
214
214
|
children: P.paymentRemindersLabel
|
|
215
|
-
}), /* @__PURE__ */
|
|
215
|
+
}), /* @__PURE__ */ b("span", {
|
|
216
216
|
className: "ttw:text-sm ttw:text-muted-foreground",
|
|
217
217
|
children: P.paymentRemindersDescription
|
|
218
218
|
})]
|
|
219
219
|
})]
|
|
220
220
|
}),
|
|
221
221
|
G
|
|
222
|
-
] }) : /* @__PURE__ */
|
|
222
|
+
] }) : /* @__PURE__ */ x("div", {
|
|
223
223
|
className: "ttw:flex ttw:gap-4",
|
|
224
224
|
children: [W, G]
|
|
225
225
|
}),
|
|
226
|
-
/* @__PURE__ */
|
|
226
|
+
/* @__PURE__ */ x("div", {
|
|
227
227
|
className: "ttw:flex ttw:flex-col ttw:gap-1.5",
|
|
228
228
|
children: [
|
|
229
|
-
/* @__PURE__ */
|
|
229
|
+
/* @__PURE__ */ b(i, {
|
|
230
230
|
htmlFor: `${F}-tax-id`,
|
|
231
231
|
requirement: n.Optional,
|
|
232
232
|
labels: P.fieldMarkers,
|
|
233
233
|
children: C.label
|
|
234
234
|
}),
|
|
235
|
-
/* @__PURE__ */
|
|
235
|
+
/* @__PURE__ */ b(r, {
|
|
236
236
|
id: `${F}-tax-id`,
|
|
237
237
|
placeholder: C.placeholder,
|
|
238
|
-
value:
|
|
239
|
-
"aria-invalid": !!
|
|
240
|
-
onChange: (e) =>
|
|
238
|
+
value: g.taxId,
|
|
239
|
+
"aria-invalid": !!v?.taxId,
|
|
240
|
+
onChange: (e) => O({ taxId: e.target.value })
|
|
241
241
|
}),
|
|
242
|
-
/* @__PURE__ */
|
|
243
|
-
/* @__PURE__ */
|
|
242
|
+
/* @__PURE__ */ b(u, { message: v?.taxId }),
|
|
243
|
+
/* @__PURE__ */ b(s, {
|
|
244
244
|
variant: "caption",
|
|
245
245
|
className: "ttw:text-muted-foreground",
|
|
246
246
|
children: C.description
|
|
247
247
|
})
|
|
248
248
|
]
|
|
249
249
|
}),
|
|
250
|
-
L && /* @__PURE__ */
|
|
250
|
+
L && /* @__PURE__ */ b("div", {
|
|
251
251
|
className: "ttw:border-b ttw:border-border ttw:pt-6 ttw:pb-7",
|
|
252
|
-
children: /* @__PURE__ */
|
|
252
|
+
children: /* @__PURE__ */ x(s, {
|
|
253
253
|
variant: "body1",
|
|
254
254
|
className: "ttw:font-medium",
|
|
255
255
|
children: [
|
|
256
256
|
P.addressHeading,
|
|
257
257
|
" ",
|
|
258
|
-
/* @__PURE__ */
|
|
258
|
+
/* @__PURE__ */ b("span", {
|
|
259
259
|
className: "ttw:text-muted-foreground",
|
|
260
260
|
children: P.fieldMarkers.optionalNote
|
|
261
261
|
})
|
|
262
262
|
]
|
|
263
263
|
})
|
|
264
264
|
}),
|
|
265
|
-
/* @__PURE__ */
|
|
265
|
+
/* @__PURE__ */ b(p, {
|
|
266
266
|
idPrefix: `${F}-address`,
|
|
267
|
-
values:
|
|
268
|
-
errors:
|
|
269
|
-
stateOptions:
|
|
267
|
+
values: g.address,
|
|
268
|
+
errors: v?.address,
|
|
269
|
+
stateOptions: S,
|
|
270
270
|
onChange: k,
|
|
271
271
|
labels: P.address
|
|
272
272
|
}),
|
|
273
|
-
R && /* @__PURE__ */
|
|
274
|
-
/* @__PURE__ */
|
|
275
|
-
/* @__PURE__ */
|
|
273
|
+
R && /* @__PURE__ */ x(y, { children: [
|
|
274
|
+
/* @__PURE__ */ b(o, { className: "ttw:my-1" }),
|
|
275
|
+
/* @__PURE__ */ x("div", {
|
|
276
276
|
className: "ttw:flex ttw:flex-col ttw:gap-1",
|
|
277
|
-
children: [/* @__PURE__ */
|
|
277
|
+
children: [/* @__PURE__ */ b(s, {
|
|
278
278
|
variant: "body2",
|
|
279
279
|
className: "ttw:font-semibold",
|
|
280
280
|
children: P.paymentMethodsHeading
|
|
281
|
-
}), /* @__PURE__ */
|
|
281
|
+
}), /* @__PURE__ */ b(s, {
|
|
282
282
|
variant: "body2",
|
|
283
283
|
className: "ttw:text-muted-foreground",
|
|
284
284
|
children: P.paymentMethodsDescription
|
|
285
285
|
})]
|
|
286
286
|
}),
|
|
287
|
-
/* @__PURE__ */
|
|
287
|
+
/* @__PURE__ */ b(d, {
|
|
288
288
|
idPrefix: `${F}-ach`,
|
|
289
|
-
values:
|
|
290
|
-
errors:
|
|
289
|
+
values: g.bankAccount,
|
|
290
|
+
errors: v?.bankAccount,
|
|
291
291
|
onChange: (e) => A?.(e),
|
|
292
292
|
labels: P.ach
|
|
293
293
|
})
|
|
@@ -296,241 +296,238 @@ function k({ open: e, onOpenChange: c, mode: l, counterpartMode: u = "customer",
|
|
|
296
296
|
})
|
|
297
297
|
});
|
|
298
298
|
}
|
|
299
|
-
function
|
|
300
|
-
let
|
|
301
|
-
...
|
|
302
|
-
...
|
|
303
|
-
},
|
|
304
|
-
show:
|
|
305
|
-
sectionsToExpand:
|
|
306
|
-
}),
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
};
|
|
310
|
-
return /* @__PURE__ */ S("div", {
|
|
311
|
-
ref: V,
|
|
299
|
+
function k({ mode: a, counterpartMode: c = "customer", values: l, errors: p, stateOptions: h, onChange: g, onAddressChange: v, onBankAccountChange: T, sections: O, sectionsToExpand: k, onAddressExpand: A, labels: j }) {
|
|
300
|
+
let M = D(j), N = {
|
|
301
|
+
...C,
|
|
302
|
+
...O
|
|
303
|
+
}, P = _(), F = l.entityType === "organization", I = c === "customer", L = c === "vendor", { isAddressShown: R, isAddressExpanded: z } = w({
|
|
304
|
+
show: N,
|
|
305
|
+
sectionsToExpand: k
|
|
306
|
+
}), B = E(p), V = I ? M.customerTypeHeading : M.vendorTypeHeading, H = I ? M.customerTaxIdHelp : M.vendorTaxIdHelp;
|
|
307
|
+
return /* @__PURE__ */ x("div", {
|
|
308
|
+
ref: B,
|
|
312
309
|
style: { display: "contents" },
|
|
313
310
|
children: [
|
|
314
|
-
a === "create" &&
|
|
315
|
-
value:
|
|
316
|
-
onChange: (e) =>
|
|
311
|
+
a === "create" && N.entityType && /* @__PURE__ */ b(m, {
|
|
312
|
+
value: l.entityType,
|
|
313
|
+
onChange: (e) => g({ entityType: e }),
|
|
317
314
|
variant: "pills",
|
|
318
315
|
labels: {
|
|
319
|
-
heading:
|
|
320
|
-
organization:
|
|
321
|
-
organizationHint:
|
|
322
|
-
individual:
|
|
323
|
-
individualHint:
|
|
316
|
+
heading: V,
|
|
317
|
+
organization: M.businessTypeOption,
|
|
318
|
+
organizationHint: M.businessTypeHint,
|
|
319
|
+
individual: M.personTypeOption,
|
|
320
|
+
individualHint: M.personTypeHint
|
|
324
321
|
}
|
|
325
322
|
}),
|
|
326
|
-
|
|
323
|
+
N.profileHeading && /* @__PURE__ */ b(s, {
|
|
327
324
|
variant: "body2",
|
|
328
325
|
className: "ttw:font-semibold",
|
|
329
|
-
children:
|
|
326
|
+
children: M.profileHeading
|
|
330
327
|
}),
|
|
331
|
-
|
|
328
|
+
F ? /* @__PURE__ */ x("div", {
|
|
332
329
|
className: "ttw:flex ttw:flex-col ttw:gap-1.5",
|
|
333
330
|
children: [
|
|
334
|
-
/* @__PURE__ */
|
|
335
|
-
htmlFor: `${
|
|
331
|
+
/* @__PURE__ */ b(i, {
|
|
332
|
+
htmlFor: `${P}-legal-name`,
|
|
336
333
|
requirement: n.Required,
|
|
337
|
-
labels:
|
|
338
|
-
children:
|
|
334
|
+
labels: M.fieldMarkers,
|
|
335
|
+
children: M.businessNameLabel
|
|
339
336
|
}),
|
|
340
|
-
/* @__PURE__ */
|
|
341
|
-
id: `${
|
|
337
|
+
/* @__PURE__ */ b(r, {
|
|
338
|
+
id: `${P}-legal-name`,
|
|
342
339
|
autoFocus: !0,
|
|
343
|
-
value:
|
|
340
|
+
value: l.legalName,
|
|
344
341
|
"aria-required": !0,
|
|
345
|
-
"aria-invalid": !!
|
|
346
|
-
onChange: (e) =>
|
|
342
|
+
"aria-invalid": !!p?.legalName,
|
|
343
|
+
onChange: (e) => g({ legalName: e.target.value })
|
|
347
344
|
}),
|
|
348
|
-
/* @__PURE__ */
|
|
345
|
+
/* @__PURE__ */ b(u, { message: p?.legalName })
|
|
349
346
|
]
|
|
350
|
-
}) : /* @__PURE__ */
|
|
347
|
+
}) : /* @__PURE__ */ x("div", {
|
|
351
348
|
className: "ttw:grid ttw:grid-cols-2 ttw:gap-4",
|
|
352
|
-
children: [/* @__PURE__ */
|
|
349
|
+
children: [/* @__PURE__ */ x("div", {
|
|
353
350
|
className: "ttw:flex ttw:flex-col ttw:gap-1.5",
|
|
354
351
|
children: [
|
|
355
|
-
/* @__PURE__ */
|
|
356
|
-
htmlFor: `${
|
|
352
|
+
/* @__PURE__ */ b(i, {
|
|
353
|
+
htmlFor: `${P}-first-name`,
|
|
357
354
|
requirement: n.Required,
|
|
358
|
-
labels:
|
|
359
|
-
children:
|
|
355
|
+
labels: M.fieldMarkers,
|
|
356
|
+
children: M.firstNameLabel
|
|
360
357
|
}),
|
|
361
|
-
/* @__PURE__ */
|
|
362
|
-
id: `${
|
|
358
|
+
/* @__PURE__ */ b(r, {
|
|
359
|
+
id: `${P}-first-name`,
|
|
363
360
|
autoFocus: !0,
|
|
364
|
-
value:
|
|
361
|
+
value: l.firstName,
|
|
365
362
|
"aria-required": !0,
|
|
366
|
-
"aria-invalid": !!
|
|
367
|
-
onChange: (e) =>
|
|
363
|
+
"aria-invalid": !!p?.firstName,
|
|
364
|
+
onChange: (e) => g({ firstName: e.target.value })
|
|
368
365
|
}),
|
|
369
|
-
/* @__PURE__ */
|
|
366
|
+
/* @__PURE__ */ b(u, { message: p?.firstName })
|
|
370
367
|
]
|
|
371
|
-
}), /* @__PURE__ */
|
|
368
|
+
}), /* @__PURE__ */ x("div", {
|
|
372
369
|
className: "ttw:flex ttw:flex-col ttw:gap-1.5",
|
|
373
370
|
children: [
|
|
374
|
-
/* @__PURE__ */
|
|
375
|
-
htmlFor: `${
|
|
371
|
+
/* @__PURE__ */ b(i, {
|
|
372
|
+
htmlFor: `${P}-last-name`,
|
|
376
373
|
requirement: n.Required,
|
|
377
|
-
labels:
|
|
378
|
-
children:
|
|
374
|
+
labels: M.fieldMarkers,
|
|
375
|
+
children: M.lastNameLabel
|
|
379
376
|
}),
|
|
380
|
-
/* @__PURE__ */
|
|
381
|
-
id: `${
|
|
382
|
-
value:
|
|
377
|
+
/* @__PURE__ */ b(r, {
|
|
378
|
+
id: `${P}-last-name`,
|
|
379
|
+
value: l.lastName,
|
|
383
380
|
"aria-required": !0,
|
|
384
|
-
"aria-invalid": !!
|
|
385
|
-
onChange: (e) =>
|
|
381
|
+
"aria-invalid": !!p?.lastName,
|
|
382
|
+
onChange: (e) => g({ lastName: e.target.value })
|
|
386
383
|
}),
|
|
387
|
-
/* @__PURE__ */
|
|
384
|
+
/* @__PURE__ */ b(u, { message: p?.lastName })
|
|
388
385
|
]
|
|
389
386
|
})]
|
|
390
387
|
}),
|
|
391
|
-
!
|
|
388
|
+
!F && N.title && /* @__PURE__ */ x("div", {
|
|
392
389
|
className: "ttw:flex ttw:flex-col ttw:gap-1.5",
|
|
393
|
-
children: [/* @__PURE__ */
|
|
394
|
-
htmlFor: `${
|
|
390
|
+
children: [/* @__PURE__ */ b(i, {
|
|
391
|
+
htmlFor: `${P}-title`,
|
|
395
392
|
requirement: n.Optional,
|
|
396
|
-
labels:
|
|
397
|
-
children:
|
|
398
|
-
}), /* @__PURE__ */
|
|
399
|
-
id: `${
|
|
400
|
-
value:
|
|
401
|
-
onChange: (e) =>
|
|
393
|
+
labels: M.fieldMarkers,
|
|
394
|
+
children: M.titleLabel
|
|
395
|
+
}), /* @__PURE__ */ b(r, {
|
|
396
|
+
id: `${P}-title`,
|
|
397
|
+
value: l.title,
|
|
398
|
+
onChange: (e) => g({ title: e.target.value })
|
|
402
399
|
})]
|
|
403
400
|
}),
|
|
404
|
-
/* @__PURE__ */
|
|
401
|
+
/* @__PURE__ */ x("div", {
|
|
405
402
|
className: "ttw:grid ttw:grid-cols-2 ttw:gap-4",
|
|
406
|
-
children: [/* @__PURE__ */
|
|
403
|
+
children: [/* @__PURE__ */ x("div", {
|
|
407
404
|
className: "ttw:flex ttw:flex-col ttw:gap-1.5",
|
|
408
405
|
children: [
|
|
409
|
-
/* @__PURE__ */
|
|
410
|
-
htmlFor: `${
|
|
406
|
+
/* @__PURE__ */ b(i, {
|
|
407
|
+
htmlFor: `${P}-email`,
|
|
411
408
|
requirement: n.Required,
|
|
412
|
-
labels:
|
|
413
|
-
children:
|
|
409
|
+
labels: M.fieldMarkers,
|
|
410
|
+
children: M.emailLabel
|
|
414
411
|
}),
|
|
415
|
-
/* @__PURE__ */
|
|
416
|
-
id: `${
|
|
412
|
+
/* @__PURE__ */ b(r, {
|
|
413
|
+
id: `${P}-email`,
|
|
417
414
|
type: "email",
|
|
418
|
-
value:
|
|
415
|
+
value: l.email,
|
|
419
416
|
"aria-required": !0,
|
|
420
|
-
"aria-invalid": !!
|
|
421
|
-
onChange: (e) =>
|
|
417
|
+
"aria-invalid": !!p?.email,
|
|
418
|
+
onChange: (e) => g({ email: e.target.value })
|
|
422
419
|
}),
|
|
423
|
-
/* @__PURE__ */
|
|
420
|
+
/* @__PURE__ */ b(u, { message: p?.email })
|
|
424
421
|
]
|
|
425
|
-
}), /* @__PURE__ */
|
|
422
|
+
}), /* @__PURE__ */ x("div", {
|
|
426
423
|
className: "ttw:flex ttw:flex-col ttw:gap-1.5",
|
|
427
424
|
children: [
|
|
428
|
-
/* @__PURE__ */
|
|
429
|
-
htmlFor: `${
|
|
425
|
+
/* @__PURE__ */ b(i, {
|
|
426
|
+
htmlFor: `${P}-phone`,
|
|
430
427
|
requirement: n.Optional,
|
|
431
|
-
labels:
|
|
432
|
-
children:
|
|
428
|
+
labels: M.fieldMarkers,
|
|
429
|
+
children: M.phoneLabel
|
|
433
430
|
}),
|
|
434
|
-
/* @__PURE__ */
|
|
435
|
-
id: `${
|
|
436
|
-
value:
|
|
437
|
-
"aria-invalid": !!
|
|
438
|
-
onChange: (e) =>
|
|
431
|
+
/* @__PURE__ */ b(r, {
|
|
432
|
+
id: `${P}-phone`,
|
|
433
|
+
value: l.phone,
|
|
434
|
+
"aria-invalid": !!p?.phone,
|
|
435
|
+
onChange: (e) => g({ phone: e.target.value })
|
|
439
436
|
}),
|
|
440
|
-
/* @__PURE__ */
|
|
437
|
+
/* @__PURE__ */ b(u, { message: p?.phone })
|
|
441
438
|
]
|
|
442
439
|
})]
|
|
443
440
|
}),
|
|
444
|
-
|
|
441
|
+
N.taxId && /* @__PURE__ */ x("div", {
|
|
445
442
|
className: "ttw:flex ttw:flex-col ttw:gap-1.5",
|
|
446
443
|
children: [
|
|
447
|
-
/* @__PURE__ */
|
|
448
|
-
htmlFor: `${
|
|
444
|
+
/* @__PURE__ */ b(i, {
|
|
445
|
+
htmlFor: `${P}-tax-id`,
|
|
449
446
|
requirement: n.Optional,
|
|
450
|
-
labels:
|
|
451
|
-
children:
|
|
447
|
+
labels: M.fieldMarkers,
|
|
448
|
+
children: M.taxIdLabel
|
|
452
449
|
}),
|
|
453
|
-
/* @__PURE__ */
|
|
454
|
-
id: `${
|
|
455
|
-
value:
|
|
456
|
-
"aria-invalid": !!
|
|
457
|
-
onChange: (e) =>
|
|
450
|
+
/* @__PURE__ */ b(r, {
|
|
451
|
+
id: `${P}-tax-id`,
|
|
452
|
+
value: l.taxId,
|
|
453
|
+
"aria-invalid": !!p?.taxId,
|
|
454
|
+
onChange: (e) => g({ taxId: e.target.value })
|
|
458
455
|
}),
|
|
459
|
-
/* @__PURE__ */
|
|
460
|
-
/* @__PURE__ */
|
|
456
|
+
/* @__PURE__ */ b(u, { message: p?.taxId }),
|
|
457
|
+
/* @__PURE__ */ b(s, {
|
|
461
458
|
variant: "caption",
|
|
462
459
|
className: "ttw:text-muted-foreground",
|
|
463
|
-
children:
|
|
460
|
+
children: H
|
|
464
461
|
})
|
|
465
462
|
]
|
|
466
463
|
}),
|
|
467
|
-
|
|
468
|
-
htmlFor: `${
|
|
464
|
+
I && /* @__PURE__ */ x(i, {
|
|
465
|
+
htmlFor: `${P}-reminders`,
|
|
469
466
|
className: "ttw:flex ttw:items-start ttw:gap-3 ttw:rounded-md ttw:border ttw:p-3",
|
|
470
|
-
children: [/* @__PURE__ */
|
|
471
|
-
id: `${
|
|
472
|
-
checked:
|
|
473
|
-
onCheckedChange: (e) =>
|
|
474
|
-
}), /* @__PURE__ */
|
|
467
|
+
children: [/* @__PURE__ */ b(t, {
|
|
468
|
+
id: `${P}-reminders`,
|
|
469
|
+
checked: l.remindersEnabled,
|
|
470
|
+
onCheckedChange: (e) => g({ remindersEnabled: e === !0 })
|
|
471
|
+
}), /* @__PURE__ */ x("span", {
|
|
475
472
|
className: "ttw:flex ttw:flex-col ttw:gap-0.5",
|
|
476
|
-
children: [/* @__PURE__ */
|
|
473
|
+
children: [/* @__PURE__ */ b("span", {
|
|
477
474
|
className: "ttw:text-sm ttw:font-medium",
|
|
478
|
-
children:
|
|
479
|
-
}), /* @__PURE__ */
|
|
475
|
+
children: M.paymentRemindersLabel
|
|
476
|
+
}), /* @__PURE__ */ b("span", {
|
|
480
477
|
className: "ttw:text-sm ttw:text-muted-foreground",
|
|
481
|
-
children:
|
|
478
|
+
children: M.paymentRemindersDescription
|
|
482
479
|
})]
|
|
483
480
|
})]
|
|
484
481
|
}),
|
|
485
|
-
|
|
482
|
+
R && /* @__PURE__ */ x(y, { children: [N.addressHeading && /* @__PURE__ */ x(y, { children: [/* @__PURE__ */ b(o, { className: "ttw:my-1" }), /* @__PURE__ */ x("div", {
|
|
486
483
|
className: "ttw:flex ttw:flex-col ttw:gap-1",
|
|
487
|
-
children: [/* @__PURE__ */
|
|
484
|
+
children: [/* @__PURE__ */ b(s, {
|
|
488
485
|
variant: "body2",
|
|
489
486
|
className: "ttw:font-semibold",
|
|
490
|
-
children:
|
|
491
|
-
}),
|
|
487
|
+
children: M.addressHeading
|
|
488
|
+
}), I && /* @__PURE__ */ b(s, {
|
|
492
489
|
variant: "body2",
|
|
493
490
|
className: "ttw:text-muted-foreground",
|
|
494
|
-
children:
|
|
491
|
+
children: M.customerAddressDescription
|
|
495
492
|
})]
|
|
496
|
-
})] }),
|
|
497
|
-
idPrefix: `${
|
|
498
|
-
values:
|
|
499
|
-
errors:
|
|
500
|
-
stateOptions:
|
|
501
|
-
onChange:
|
|
502
|
-
labels:
|
|
503
|
-
}) : /* @__PURE__ */
|
|
493
|
+
})] }), z ? /* @__PURE__ */ b(f, {
|
|
494
|
+
idPrefix: `${P}-address`,
|
|
495
|
+
values: l.address,
|
|
496
|
+
errors: p?.address,
|
|
497
|
+
stateOptions: h,
|
|
498
|
+
onChange: v,
|
|
499
|
+
labels: M.address
|
|
500
|
+
}) : /* @__PURE__ */ x(e, {
|
|
504
501
|
type: "button",
|
|
505
502
|
variant: "link",
|
|
506
503
|
className: "ttw:w-fit ttw:px-0",
|
|
507
|
-
onClick:
|
|
508
|
-
children: [/* @__PURE__ */
|
|
504
|
+
onClick: A,
|
|
505
|
+
children: [/* @__PURE__ */ b(S, { className: "ttw:size-4" }), M.addAddress]
|
|
509
506
|
})] }),
|
|
510
|
-
|
|
511
|
-
/* @__PURE__ */
|
|
512
|
-
/* @__PURE__ */
|
|
507
|
+
L && N.bankAccount && /* @__PURE__ */ x(y, { children: [
|
|
508
|
+
/* @__PURE__ */ b(o, { className: "ttw:my-1" }),
|
|
509
|
+
/* @__PURE__ */ x("div", {
|
|
513
510
|
className: "ttw:flex ttw:flex-col ttw:gap-1",
|
|
514
|
-
children: [/* @__PURE__ */
|
|
511
|
+
children: [/* @__PURE__ */ b(s, {
|
|
515
512
|
variant: "body2",
|
|
516
513
|
className: "ttw:font-semibold",
|
|
517
|
-
children:
|
|
518
|
-
}), /* @__PURE__ */
|
|
514
|
+
children: M.paymentMethodsHeading
|
|
515
|
+
}), /* @__PURE__ */ b(s, {
|
|
519
516
|
variant: "body2",
|
|
520
517
|
className: "ttw:text-muted-foreground",
|
|
521
|
-
children:
|
|
518
|
+
children: M.paymentMethodsDescription
|
|
522
519
|
})]
|
|
523
520
|
}),
|
|
524
|
-
/* @__PURE__ */
|
|
525
|
-
idPrefix: `${
|
|
526
|
-
values:
|
|
527
|
-
errors:
|
|
528
|
-
onChange: (e) =>
|
|
529
|
-
labels:
|
|
521
|
+
/* @__PURE__ */ b(d, {
|
|
522
|
+
idPrefix: `${P}-ach`,
|
|
523
|
+
values: l.bankAccount,
|
|
524
|
+
errors: p?.bankAccount,
|
|
525
|
+
onChange: (e) => T?.(e),
|
|
526
|
+
labels: M.ach
|
|
530
527
|
})
|
|
531
528
|
] })
|
|
532
529
|
]
|
|
533
530
|
});
|
|
534
531
|
}
|
|
535
532
|
//#endregion
|
|
536
|
-
export {
|
|
533
|
+
export { k as CounterpartFormFields, O as CounterpartFormSheet, O as default, T as countErrors, E as useFocusFirstInvalidField };
|