@tesouro/embedded-components-react 0.7.17 → 0.7.19
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/README.md +14 -14
- package/dist/index.css +3 -0
- package/dist/index.d.ts +50 -7
- package/dist/lib/CounterpartsWidget.d.ts +49 -6
- package/dist/lib/CounterpartsWidgetPublic.d.ts +49 -6
- package/dist/lib/CustomersWidget.d.ts +49 -6
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/data-access/dist/index3.js +2 -1
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/CounterpartDetailsContainer.js +18 -13
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/CounterpartsWidget.js +146 -137
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/useCounterpartDetailsSheetView.js +56 -55
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/useCounterpartsWidget.js +108 -77
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/viewModels.js +181 -25
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index2.js +50 -7
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index4.js +127 -596
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index5.js +66 -0
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index6.js +210 -0
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index7.js +520 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/ReceivablesWidget.js +2 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useInvoicesFilter.js +10 -7
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableActionsModal.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivablesTable.js +1 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivablesWidget.js +141 -125
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/index.js +11 -11
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index.js +7 -7
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index2.js +1 -8
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
- package/package.json +1 -1
|
@@ -1,604 +1,135 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { ErrorState as h } from "../../../shared/ui/dist/lib/ErrorState/ErrorState.js";
|
|
4
|
-
import "../../../shared/ui/dist/index.js";
|
|
5
|
-
import { ADDRESS_FORM_SHEET_LABELS_EN as g, COUNTERPART_FORM_SHEET_LABELS_EN as _ } from "../../../shared/counterpart-management/ui/dist/index2.js";
|
|
6
|
-
import { AddressFieldGroup as v } from "../../../shared/counterpart-management/ui/dist/index6.js";
|
|
7
|
-
import { CounterpartFormFields as y } from "../../../shared/counterpart-management/ui/dist/index9.js";
|
|
8
|
-
import "../../../shared/counterpart-management/ui/dist/index.js";
|
|
9
|
-
import { COUNTERPART_DETAILS_SHEET_LABELS_EN as b } from "./index2.js";
|
|
10
|
-
import { useEffect as x, useState as ne } from "react";
|
|
11
|
-
import { Fragment as re, jsx as S, jsxs as C } from "react/jsx-runtime";
|
|
12
|
-
import { EyeIcon as ie, EyeOffIcon as w, MoreVerticalIcon as T, PencilIcon as E, PlusIcon as D, Trash2Icon as O, XIcon as k } from "lucide-react";
|
|
1
|
+
import { Field as e, FieldContent as t, FieldError as n, FieldLabel as r, Input as i, Select as a, SelectContent as o, SelectItem as s, SelectTrigger as c, SelectValue as l } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
|
|
2
|
+
import { Fragment as u, jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
13
3
|
//#region ../../libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index4.js
|
|
14
|
-
var
|
|
15
|
-
function
|
|
16
|
-
return
|
|
4
|
+
var p = "US";
|
|
5
|
+
function m(e) {
|
|
6
|
+
return e ? [{ message: e }] : void 0;
|
|
17
7
|
}
|
|
18
|
-
function
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
className: "ttw:min-w-0 ttw:text-sm",
|
|
27
|
-
children: t
|
|
28
|
-
})]
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
function N({ mode: e, summary: t, labels: n }) {
|
|
32
|
-
let r = e === "customer" ? n.summaryReceived : n.summaryPaid;
|
|
33
|
-
return /* @__PURE__ */ C("div", {
|
|
34
|
-
className: "ttw:flex ttw:flex-col ttw:gap-4 ttw:rounded-md ttw:bg-muted ttw:p-5",
|
|
35
|
-
children: [
|
|
36
|
-
/* @__PURE__ */ S(p, {
|
|
37
|
-
variant: "body2",
|
|
38
|
-
className: "ttw:text-muted-foreground",
|
|
39
|
-
children: e === "customer" ? n.summaryAmountDue : n.summaryBalanceDue
|
|
40
|
-
}),
|
|
41
|
-
t?.isPrimaryAmountLoading ? /* @__PURE__ */ S(j, { className: "ttw:h-9 ttw:w-36" }) : /* @__PURE__ */ S(p, {
|
|
42
|
-
variant: "h3",
|
|
43
|
-
className: "ttw:font-semibold",
|
|
44
|
-
children: t?.primaryAmountLabel ?? A
|
|
45
|
-
}),
|
|
46
|
-
/* @__PURE__ */ C("div", {
|
|
47
|
-
className: "ttw:flex ttw:gap-8",
|
|
48
|
-
children: [
|
|
49
|
-
/* @__PURE__ */ C("div", {
|
|
50
|
-
className: "ttw:flex ttw:flex-col ttw:gap-1",
|
|
51
|
-
children: [/* @__PURE__ */ S(p, {
|
|
52
|
-
variant: "caption",
|
|
53
|
-
className: "ttw:text-muted-foreground",
|
|
54
|
-
children: n.summaryBilled
|
|
55
|
-
}), t?.isBilledAmountLoading ? /* @__PURE__ */ S(j, {}) : /* @__PURE__ */ S(p, {
|
|
56
|
-
variant: "body1",
|
|
57
|
-
className: "ttw:font-semibold",
|
|
58
|
-
children: t?.billedAmountLabel ?? A
|
|
59
|
-
})]
|
|
60
|
-
}),
|
|
61
|
-
/* @__PURE__ */ C("div", {
|
|
62
|
-
className: "ttw:flex ttw:flex-col ttw:gap-1",
|
|
63
|
-
children: [/* @__PURE__ */ S(p, {
|
|
64
|
-
variant: "caption",
|
|
65
|
-
className: "ttw:text-muted-foreground",
|
|
66
|
-
children: r
|
|
67
|
-
}), t?.isReceivedOrPaidAmountLoading ? /* @__PURE__ */ S(j, {}) : /* @__PURE__ */ S(p, {
|
|
68
|
-
variant: "body1",
|
|
69
|
-
className: "ttw:font-semibold ttw:text-green-600",
|
|
70
|
-
children: t?.receivedOrPaidAmountLabel ?? A
|
|
71
|
-
})]
|
|
72
|
-
}),
|
|
73
|
-
e === "vendor" && /* @__PURE__ */ C("div", {
|
|
74
|
-
className: "ttw:flex ttw:flex-col ttw:gap-1",
|
|
75
|
-
children: [/* @__PURE__ */ S(p, {
|
|
76
|
-
variant: "caption",
|
|
77
|
-
className: "ttw:text-muted-foreground",
|
|
78
|
-
children: n.summaryRejected
|
|
79
|
-
}), t?.isRejectedAmountLoading ? /* @__PURE__ */ S(j, {}) : /* @__PURE__ */ S(p, {
|
|
80
|
-
variant: "body1",
|
|
81
|
-
className: "ttw:font-semibold",
|
|
82
|
-
children: t?.rejectedAmountLabel ?? A
|
|
83
|
-
})]
|
|
84
|
-
})
|
|
85
|
-
]
|
|
86
|
-
})
|
|
87
|
-
]
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
function P({ mode: n, documents: r, labels: i, onViewAll: a }) {
|
|
91
|
-
if (!r || r.length === 0) return null;
|
|
92
|
-
let o = n === "vendor";
|
|
93
|
-
return /* @__PURE__ */ C("section", {
|
|
94
|
-
className: "ttw:flex ttw:flex-col ttw:border-t ttw:border-border ttw:pt-6",
|
|
95
|
-
children: [/* @__PURE__ */ C("div", {
|
|
96
|
-
className: "ttw:flex ttw:items-start ttw:justify-between ttw:gap-4 ttw:pb-5",
|
|
97
|
-
children: [/* @__PURE__ */ C("div", {
|
|
98
|
-
className: "ttw:flex ttw:flex-col ttw:gap-1.5",
|
|
99
|
-
children: [/* @__PURE__ */ S(p, {
|
|
100
|
-
variant: "body1",
|
|
101
|
-
className: "ttw:font-medium",
|
|
102
|
-
children: n === "customer" ? i.recentCustomerDocumentsHeading : i.recentVendorDocumentsHeading
|
|
103
|
-
}), /* @__PURE__ */ S(p, {
|
|
104
|
-
variant: "body2",
|
|
105
|
-
className: "ttw:text-muted-foreground",
|
|
106
|
-
children: n === "customer" ? i.recentCustomerDocumentsDescription : i.recentVendorDocumentsDescription
|
|
107
|
-
})]
|
|
108
|
-
}), a && /* @__PURE__ */ S(t, {
|
|
109
|
-
variant: "link",
|
|
110
|
-
className: "ttw:h-auto ttw:p-0",
|
|
111
|
-
onClick: a,
|
|
112
|
-
children: i.viewAllDocumentsAction
|
|
113
|
-
})]
|
|
114
|
-
}), /* @__PURE__ */ S("div", {
|
|
115
|
-
className: "ttw:flex ttw:flex-col ttw:gap-3 ttw:rounded-md ttw:border ttw:border-border ttw:p-4",
|
|
116
|
-
children: r.map((t, n) => {
|
|
117
|
-
let a = o && t.isOverdue;
|
|
118
|
-
return /* @__PURE__ */ C("div", {
|
|
119
|
-
className: "ttw:flex ttw:flex-col ttw:gap-3",
|
|
120
|
-
children: [/* @__PURE__ */ C("div", {
|
|
121
|
-
className: "ttw:flex ttw:items-start ttw:justify-between ttw:gap-4",
|
|
122
|
-
children: [/* @__PURE__ */ C("div", {
|
|
123
|
-
className: "ttw:flex ttw:flex-col ttw:gap-1",
|
|
124
|
-
children: [/* @__PURE__ */ S(p, {
|
|
125
|
-
variant: "h6",
|
|
126
|
-
className: "ttw:font-medium",
|
|
127
|
-
children: t.amountLabel
|
|
128
|
-
}), /* @__PURE__ */ S(p, {
|
|
129
|
-
variant: "body2",
|
|
130
|
-
className: a ? "ttw:text-destructive" : "ttw:text-muted-foreground",
|
|
131
|
-
children: t.dateLabel
|
|
132
|
-
})]
|
|
133
|
-
}), /* @__PURE__ */ C("div", {
|
|
134
|
-
className: "ttw:flex ttw:items-center ttw:gap-2",
|
|
135
|
-
children: [a && /* @__PURE__ */ S(e, {
|
|
136
|
-
variant: "destructive",
|
|
137
|
-
children: i.overdueTag
|
|
138
|
-
}), /* @__PURE__ */ S(e, {
|
|
139
|
-
variant: t.statusTone ?? "outline",
|
|
140
|
-
children: t.statusLabel
|
|
141
|
-
})]
|
|
142
|
-
})]
|
|
143
|
-
}), n < r.length - 1 && /* @__PURE__ */ S(s, {})]
|
|
144
|
-
}, t.id);
|
|
145
|
-
})
|
|
146
|
-
})]
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
function F({ addressForm: e }) {
|
|
150
|
-
let n = {
|
|
151
|
-
...g.fieldMarkers,
|
|
152
|
-
...e.labels?.fieldMarkers
|
|
153
|
-
}, r = {
|
|
154
|
-
...g,
|
|
155
|
-
...e.labels,
|
|
156
|
-
fieldMarkers: n,
|
|
157
|
-
address: {
|
|
158
|
-
...g.address,
|
|
159
|
-
...e.labels?.address,
|
|
160
|
-
fieldMarkers: {
|
|
161
|
-
...n,
|
|
162
|
-
...e.labels?.address?.fieldMarkers
|
|
163
|
-
}
|
|
164
|
-
},
|
|
165
|
-
requiredFieldsLegend: m(n, e.labels?.requiredFieldsLegend)
|
|
8
|
+
function h({ idPrefix: h, values: g, errors: _, stateOptions: v, disabled: y, onChange: b, labels: x, fieldMarkers: S }) {
|
|
9
|
+
let C = {
|
|
10
|
+
line1: `${h}-line1`,
|
|
11
|
+
line2: `${h}-line2`,
|
|
12
|
+
city: `${h}-city`,
|
|
13
|
+
state: `${h}-state`,
|
|
14
|
+
postalCode: `${h}-postal-code`,
|
|
15
|
+
country: `${h}-country`
|
|
166
16
|
};
|
|
167
|
-
return /* @__PURE__ */
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
children: r.title
|
|
177
|
-
}),
|
|
178
|
-
e.formError && /* @__PURE__ */ S("p", {
|
|
179
|
-
role: "alert",
|
|
180
|
-
className: "ttw:rounded-md ttw:bg-destructive/10 ttw:px-3 ttw:py-2 ttw:text-sm ttw:text-destructive",
|
|
181
|
-
children: e.formError
|
|
182
|
-
}),
|
|
183
|
-
/* @__PURE__ */ S(o, { labels: r.requiredFieldsLegend }),
|
|
184
|
-
/* @__PURE__ */ S(v, {
|
|
185
|
-
idPrefix: "address-edit-inline",
|
|
186
|
-
values: e.values,
|
|
187
|
-
errors: e.errors,
|
|
188
|
-
stateOptions: e.stateOptions,
|
|
189
|
-
onChange: e.onChange,
|
|
190
|
-
labels: r.address
|
|
191
|
-
}),
|
|
192
|
-
/* @__PURE__ */ C("div", {
|
|
193
|
-
className: "ttw:flex ttw:justify-end ttw:gap-2",
|
|
194
|
-
children: [/* @__PURE__ */ S(t, {
|
|
195
|
-
type: "button",
|
|
196
|
-
variant: "outline",
|
|
197
|
-
disabled: e.inProgress,
|
|
198
|
-
onClick: e.onCancel,
|
|
199
|
-
children: r.cancelButton
|
|
200
|
-
}), /* @__PURE__ */ S(t, {
|
|
201
|
-
type: "submit",
|
|
202
|
-
disabled: e.inProgress,
|
|
203
|
-
children: r.saveButton
|
|
204
|
-
})]
|
|
205
|
-
})
|
|
206
|
-
]
|
|
207
|
-
});
|
|
208
|
-
}
|
|
209
|
-
function I({ mode: e, addressLines: n, canEdit: r, onEditAddress: i, onAddAddress: a, labels: o, addressForm: s }) {
|
|
210
|
-
let c = n.length > 0;
|
|
211
|
-
return /* @__PURE__ */ C("section", {
|
|
212
|
-
className: e === "customer" ? "ttw:flex ttw:flex-col ttw:gap-3 ttw:border-t ttw:border-border ttw:pt-6" : "ttw:flex ttw:flex-col",
|
|
213
|
-
children: [e === "customer" && !s && /* @__PURE__ */ C("div", {
|
|
214
|
-
className: "ttw:flex ttw:items-center ttw:justify-between ttw:gap-3",
|
|
215
|
-
children: [
|
|
216
|
-
/* @__PURE__ */ C("div", {
|
|
217
|
-
className: "ttw:flex ttw:flex-col ttw:gap-1",
|
|
218
|
-
children: [/* @__PURE__ */ S(p, {
|
|
219
|
-
variant: "body1",
|
|
220
|
-
className: "ttw:font-medium",
|
|
221
|
-
children: o.customerAddressHeading
|
|
222
|
-
}), /* @__PURE__ */ S(p, {
|
|
223
|
-
variant: "body2",
|
|
224
|
-
className: "ttw:text-muted-foreground",
|
|
225
|
-
children: o.customerAddressDescription
|
|
226
|
-
})]
|
|
17
|
+
return /* @__PURE__ */ f(u, { children: [
|
|
18
|
+
/* @__PURE__ */ f("div", {
|
|
19
|
+
className: "ttw:flex ttw:gap-4",
|
|
20
|
+
children: [/* @__PURE__ */ d(e, { children: /* @__PURE__ */ f(t, { children: [
|
|
21
|
+
/* @__PURE__ */ d(r, {
|
|
22
|
+
htmlFor: C.line1,
|
|
23
|
+
requirement: "required",
|
|
24
|
+
labels: S,
|
|
25
|
+
children: x.streetAddressLabel
|
|
227
26
|
}),
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
className: "ttw:
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
27
|
+
/* @__PURE__ */ d(i, {
|
|
28
|
+
id: C.line1,
|
|
29
|
+
"aria-required": !0,
|
|
30
|
+
className: "ttw:bg-background",
|
|
31
|
+
value: g.line1,
|
|
32
|
+
disabled: y,
|
|
33
|
+
"aria-invalid": !!_?.line1 || void 0,
|
|
34
|
+
onChange: (e) => b({ line1: e.target.value })
|
|
235
35
|
}),
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
})
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
}), /* @__PURE__ */ S("span", { children: n.routingNumberLabel || A })]
|
|
332
|
-
})
|
|
333
|
-
]
|
|
334
|
-
})]
|
|
335
|
-
}) : /* @__PURE__ */ S(p, {
|
|
336
|
-
variant: "body2",
|
|
337
|
-
className: "ttw:text-muted-foreground",
|
|
338
|
-
children: s.noPaymentMethods
|
|
339
|
-
})]
|
|
340
|
-
});
|
|
341
|
-
}
|
|
342
|
-
function R({ mode: e, form: n }) {
|
|
343
|
-
let r = {
|
|
344
|
-
..._.fieldMarkers,
|
|
345
|
-
...n.labels?.fieldMarkers
|
|
346
|
-
}, i = m(r, n.labels?.requiredFieldsLegend), a = n.labels?.cancelButton ?? _.cancelButton, s = n.labels?.saveButton ?? _.saveButton;
|
|
347
|
-
return /* @__PURE__ */ C("form", {
|
|
348
|
-
className: "ttw:flex ttw:flex-col ttw:gap-4 ttw:pt-5",
|
|
349
|
-
onSubmit: (e) => {
|
|
350
|
-
e.preventDefault(), n.onSubmit();
|
|
351
|
-
},
|
|
352
|
-
children: [
|
|
353
|
-
n.errors?.form && /* @__PURE__ */ S(p, {
|
|
354
|
-
variant: "body2",
|
|
355
|
-
className: "ttw:text-destructive",
|
|
356
|
-
children: n.errors.form
|
|
357
|
-
}),
|
|
358
|
-
/* @__PURE__ */ S(o, { labels: i }),
|
|
359
|
-
/* @__PURE__ */ S(y, {
|
|
360
|
-
mode: "edit",
|
|
361
|
-
counterpartMode: e,
|
|
362
|
-
values: n.values,
|
|
363
|
-
errors: n.errors,
|
|
364
|
-
stateOptions: n.stateOptions,
|
|
365
|
-
onChange: n.onChange,
|
|
366
|
-
onAddressChange: n.onAddressChange,
|
|
367
|
-
onBankAccountChange: n.onBankAccountChange,
|
|
368
|
-
labels: n.labels
|
|
369
|
-
}),
|
|
370
|
-
/* @__PURE__ */ C("div", {
|
|
371
|
-
className: "ttw:flex ttw:justify-end ttw:gap-2 ttw:border-t ttw:border-border ttw:pt-4",
|
|
372
|
-
children: [/* @__PURE__ */ S(t, {
|
|
373
|
-
type: "button",
|
|
374
|
-
variant: "outline",
|
|
375
|
-
disabled: n.inProgress,
|
|
376
|
-
onClick: n.onCancel,
|
|
377
|
-
children: a
|
|
378
|
-
}), /* @__PURE__ */ S(t, {
|
|
379
|
-
type: "submit",
|
|
380
|
-
disabled: n.inProgress || n.submitDisabled,
|
|
381
|
-
children: s
|
|
382
|
-
})]
|
|
383
|
-
})
|
|
384
|
-
]
|
|
385
|
-
});
|
|
386
|
-
}
|
|
387
|
-
function z({ open: e, onOpenChange: o, privacyResetKey: s, mode: f = "customer", counterpart: m, isLoading: g, isError: _, canEdit: v = !0, canDelete: y = !0, onEdit: E, onDelete: D, onClose: j, onEditAddress: F, onAddAddress: z, onAddBankAccount: B, onEditBankAccount: V, onDeleteBankAccount: H, onViewAllDocuments: U, onCreateDocument: W, editForm: G, addressForm: K, labels: q }) {
|
|
388
|
-
let J = {
|
|
389
|
-
...b,
|
|
390
|
-
...q
|
|
391
|
-
}, [ae, Y] = ne(null), X = [
|
|
392
|
-
s ?? m?.name ?? "",
|
|
393
|
-
m?.taxId ?? "",
|
|
394
|
-
m?.taxIdMasked ?? ""
|
|
395
|
-
].join(":"), Z = e && !!m?.taxId && ae === X;
|
|
396
|
-
x(() => {
|
|
397
|
-
e || Y(null);
|
|
398
|
-
}, [e]);
|
|
399
|
-
let Q = f === "vendor", oe = Z ? m?.taxId ?? A : m?.taxIdMasked || m?.taxId || A, $ = m?.taxIdHelpText ?? (Q ? J.vendorTaxIdHelp : J.customerTaxIdHelp);
|
|
400
|
-
return /* @__PURE__ */ S(c, {
|
|
401
|
-
open: e,
|
|
402
|
-
onOpenChange: (e) => {
|
|
403
|
-
e || Y(null), o(e);
|
|
404
|
-
},
|
|
405
|
-
children: /* @__PURE__ */ C(l, {
|
|
406
|
-
showCloseButton: !1,
|
|
407
|
-
className: "ttw:w-160 ttw:sm:max-w-160 ttw:gap-0 ttw:overflow-y-auto",
|
|
408
|
-
children: [/* @__PURE__ */ C(ee, {
|
|
409
|
-
className: "ttw:flex-row ttw:items-start ttw:justify-between ttw:gap-4 ttw:border-b ttw:border-border ttw:px-6 ttw:py-6",
|
|
410
|
-
children: [/* @__PURE__ */ C("div", {
|
|
411
|
-
className: "ttw:flex ttw:min-w-0 ttw:flex-col ttw:gap-1",
|
|
412
|
-
children: [/* @__PURE__ */ S(d, {
|
|
413
|
-
className: "ttw:truncate ttw:text-2xl",
|
|
414
|
-
children: m?.name ?? J.loadingTitle
|
|
415
|
-
}), /* @__PURE__ */ S(u, { children: m?.subtitle ?? J.hiddenDescription })]
|
|
416
|
-
}), /* @__PURE__ */ C("div", {
|
|
417
|
-
className: "ttw:flex ttw:gap-2",
|
|
418
|
-
children: [y && m && /* @__PURE__ */ C(n, { children: [/* @__PURE__ */ S(a, {
|
|
419
|
-
asChild: !0,
|
|
420
|
-
children: /* @__PURE__ */ S(t, {
|
|
421
|
-
type: "button",
|
|
422
|
-
variant: "outline",
|
|
423
|
-
size: "icon",
|
|
424
|
-
"aria-label": J.openActionsMenu,
|
|
425
|
-
children: /* @__PURE__ */ S(T, { className: "ttw:size-4" })
|
|
426
|
-
})
|
|
427
|
-
}), /* @__PURE__ */ S(r, {
|
|
428
|
-
align: "end",
|
|
429
|
-
children: /* @__PURE__ */ C(i, {
|
|
430
|
-
variant: "destructive",
|
|
431
|
-
onClick: D,
|
|
432
|
-
children: [/* @__PURE__ */ S(O, { className: "ttw:size-4" }), Q ? J.deleteVendorAction : J.deleteCustomerAction]
|
|
433
|
-
})
|
|
434
|
-
})] }), /* @__PURE__ */ S(t, {
|
|
435
|
-
type: "button",
|
|
436
|
-
variant: "outline",
|
|
437
|
-
size: "icon",
|
|
438
|
-
"aria-label": J.closeAction,
|
|
439
|
-
onClick: () => {
|
|
440
|
-
Y(null), j();
|
|
441
|
-
},
|
|
442
|
-
children: /* @__PURE__ */ S(k, { className: "ttw:size-4" })
|
|
443
|
-
})]
|
|
444
|
-
})]
|
|
445
|
-
}), _ ? /* @__PURE__ */ S("div", {
|
|
446
|
-
className: "ttw:p-6",
|
|
447
|
-
children: /* @__PURE__ */ S(h, {
|
|
448
|
-
title: J.errorTitle,
|
|
449
|
-
description: J.errorDescription
|
|
450
|
-
})
|
|
451
|
-
}) : g || !m ? /* @__PURE__ */ S("div", {
|
|
452
|
-
className: "ttw:p-6",
|
|
453
|
-
children: /* @__PURE__ */ S(te, { title: J.loadingTitle })
|
|
454
|
-
}) : /* @__PURE__ */ C("main", {
|
|
455
|
-
className: "ttw:flex ttw:flex-col ttw:gap-6 ttw:p-6",
|
|
456
|
-
children: [
|
|
457
|
-
/* @__PURE__ */ C("div", {
|
|
458
|
-
className: "ttw:flex ttw:flex-col ttw:gap-4",
|
|
459
|
-
children: [/* @__PURE__ */ S(N, {
|
|
460
|
-
mode: f,
|
|
461
|
-
summary: m.summary,
|
|
462
|
-
labels: J
|
|
463
|
-
}), /* @__PURE__ */ S(t, {
|
|
464
|
-
type: "button",
|
|
465
|
-
className: "ttw:w-fit",
|
|
466
|
-
disabled: !W,
|
|
467
|
-
onClick: W,
|
|
468
|
-
children: Q ? J.sendPaymentAction : J.issueInvoiceAction
|
|
469
|
-
})]
|
|
470
|
-
}),
|
|
471
|
-
/* @__PURE__ */ S(P, {
|
|
472
|
-
mode: f,
|
|
473
|
-
documents: m.recentDocuments,
|
|
474
|
-
labels: J,
|
|
475
|
-
onViewAll: U
|
|
476
|
-
}),
|
|
477
|
-
G ? /* @__PURE__ */ C("section", {
|
|
478
|
-
className: "ttw:flex ttw:flex-col",
|
|
479
|
-
children: [/* @__PURE__ */ C("div", {
|
|
480
|
-
className: "ttw:flex ttw:flex-col ttw:gap-1 ttw:border-b ttw:border-border ttw:pb-5",
|
|
481
|
-
children: [/* @__PURE__ */ S(p, {
|
|
482
|
-
variant: "body1",
|
|
483
|
-
className: "ttw:font-medium",
|
|
484
|
-
children: Q ? J.vendorDetailsHeading : J.customerDetailsHeading
|
|
485
|
-
}), /* @__PURE__ */ S(p, {
|
|
486
|
-
variant: "body2",
|
|
487
|
-
className: "ttw:text-muted-foreground",
|
|
488
|
-
children: Q ? J.vendorDetailsDescription : J.customerDetailsDescription
|
|
489
|
-
})]
|
|
490
|
-
}), /* @__PURE__ */ S(R, {
|
|
491
|
-
mode: f,
|
|
492
|
-
form: G
|
|
493
|
-
})]
|
|
494
|
-
}) : /* @__PURE__ */ C(re, { children: [
|
|
495
|
-
/* @__PURE__ */ C("section", {
|
|
496
|
-
className: "ttw:flex ttw:flex-col",
|
|
497
|
-
children: [
|
|
498
|
-
/* @__PURE__ */ C("div", {
|
|
499
|
-
className: "ttw:flex ttw:items-center ttw:justify-between ttw:gap-3 ttw:border-b ttw:border-border ttw:pb-5",
|
|
500
|
-
children: [/* @__PURE__ */ C("div", {
|
|
501
|
-
className: "ttw:flex ttw:flex-col ttw:gap-1",
|
|
502
|
-
children: [/* @__PURE__ */ S(p, {
|
|
503
|
-
variant: "body1",
|
|
504
|
-
className: "ttw:font-medium",
|
|
505
|
-
children: Q ? J.vendorDetailsHeading : J.customerDetailsHeading
|
|
506
|
-
}), /* @__PURE__ */ S(p, {
|
|
507
|
-
variant: "body2",
|
|
508
|
-
className: "ttw:text-muted-foreground",
|
|
509
|
-
children: Q ? J.vendorDetailsDescription : J.customerDetailsDescription
|
|
510
|
-
})]
|
|
511
|
-
}), v && /* @__PURE__ */ S(t, {
|
|
512
|
-
type: "button",
|
|
513
|
-
variant: "link",
|
|
514
|
-
className: "ttw:h-auto ttw:p-0",
|
|
515
|
-
onClick: E,
|
|
516
|
-
children: J.editButton
|
|
517
|
-
})]
|
|
518
|
-
}),
|
|
519
|
-
/* @__PURE__ */ S(M, {
|
|
520
|
-
label: J.rowType,
|
|
521
|
-
children: m.entityTypeLabel ?? A
|
|
522
|
-
}),
|
|
523
|
-
/* @__PURE__ */ S(M, {
|
|
524
|
-
label: J.rowName,
|
|
525
|
-
children: m.name
|
|
526
|
-
}),
|
|
527
|
-
/* @__PURE__ */ S(M, {
|
|
528
|
-
label: J.rowEmail,
|
|
529
|
-
children: m.email || A
|
|
530
|
-
}),
|
|
531
|
-
!Q && /* @__PURE__ */ S(M, {
|
|
532
|
-
label: J.rowPaymentReminders,
|
|
533
|
-
children: m.remindersLabel ?? A
|
|
534
|
-
}),
|
|
535
|
-
/* @__PURE__ */ S(M, {
|
|
536
|
-
label: J.rowPhone,
|
|
537
|
-
children: m.phone || A
|
|
538
|
-
}),
|
|
539
|
-
/* @__PURE__ */ S(M, {
|
|
540
|
-
label: m.entityType === "individual" ? J.rowTaxIdSsn : J.rowTaxIdEin,
|
|
541
|
-
isLast: !Q,
|
|
542
|
-
children: /* @__PURE__ */ C("div", {
|
|
543
|
-
className: "ttw:flex ttw:flex-col ttw:gap-2",
|
|
544
|
-
children: [/* @__PURE__ */ C("div", {
|
|
545
|
-
className: "ttw:flex ttw:items-center ttw:gap-2",
|
|
546
|
-
children: [/* @__PURE__ */ S("span", {
|
|
547
|
-
className: "ttw:font-medium",
|
|
548
|
-
children: oe
|
|
549
|
-
}), m.taxId && /* @__PURE__ */ C(t, {
|
|
550
|
-
type: "button",
|
|
551
|
-
variant: "outline",
|
|
552
|
-
size: "sm",
|
|
553
|
-
onClick: () => {
|
|
554
|
-
Y((e) => e === X ? null : X);
|
|
555
|
-
},
|
|
556
|
-
children: [S(Z ? w : ie, { className: "ttw:size-4" }), Z ? J.hideTaxId : J.showTaxId]
|
|
557
|
-
})]
|
|
558
|
-
}), $ && /* @__PURE__ */ S(p, {
|
|
559
|
-
variant: "body2",
|
|
560
|
-
className: "ttw:text-muted-foreground",
|
|
561
|
-
children: $
|
|
562
|
-
})]
|
|
563
|
-
})
|
|
564
|
-
}),
|
|
565
|
-
Q && /* @__PURE__ */ S(M, {
|
|
566
|
-
label: J.addressHeading,
|
|
567
|
-
isLast: !0,
|
|
568
|
-
children: /* @__PURE__ */ S(I, {
|
|
569
|
-
mode: f,
|
|
570
|
-
addressLines: m.addressLines,
|
|
571
|
-
canEdit: v,
|
|
572
|
-
onEditAddress: F,
|
|
573
|
-
onAddAddress: z,
|
|
574
|
-
labels: J,
|
|
575
|
-
addressForm: K
|
|
576
|
-
})
|
|
577
|
-
})
|
|
578
|
-
]
|
|
579
|
-
}),
|
|
580
|
-
!Q && /* @__PURE__ */ S(I, {
|
|
581
|
-
mode: f,
|
|
582
|
-
addressLines: m.addressLines,
|
|
583
|
-
canEdit: v,
|
|
584
|
-
onEditAddress: F,
|
|
585
|
-
onAddAddress: z,
|
|
586
|
-
labels: J,
|
|
587
|
-
addressForm: K
|
|
588
|
-
}),
|
|
589
|
-
Q && /* @__PURE__ */ S(L, {
|
|
590
|
-
paymentMethod: m.paymentMethod,
|
|
591
|
-
canEdit: v,
|
|
592
|
-
onAddBankAccount: B,
|
|
593
|
-
onEditBankAccount: V,
|
|
594
|
-
onDeleteBankAccount: H,
|
|
595
|
-
labels: J
|
|
596
|
-
})
|
|
597
|
-
] })
|
|
598
|
-
]
|
|
599
|
-
})]
|
|
36
|
+
/* @__PURE__ */ d(n, { errors: m(_?.line1) })
|
|
37
|
+
] }) }), /* @__PURE__ */ d(e, { children: /* @__PURE__ */ f(t, { children: [/* @__PURE__ */ d(r, {
|
|
38
|
+
htmlFor: C.line2,
|
|
39
|
+
requirement: "optional",
|
|
40
|
+
labels: S,
|
|
41
|
+
children: x.addressLine2Label
|
|
42
|
+
}), /* @__PURE__ */ d(i, {
|
|
43
|
+
id: C.line2,
|
|
44
|
+
className: "ttw:bg-background",
|
|
45
|
+
value: g.line2,
|
|
46
|
+
disabled: y,
|
|
47
|
+
onChange: (e) => b({ line2: e.target.value })
|
|
48
|
+
})] }) })]
|
|
49
|
+
}),
|
|
50
|
+
/* @__PURE__ */ f("div", {
|
|
51
|
+
className: "ttw:flex ttw:gap-4",
|
|
52
|
+
children: [/* @__PURE__ */ d(e, { children: /* @__PURE__ */ f(t, { children: [
|
|
53
|
+
/* @__PURE__ */ d(r, {
|
|
54
|
+
htmlFor: C.city,
|
|
55
|
+
requirement: "required",
|
|
56
|
+
labels: S,
|
|
57
|
+
children: x.cityLabel
|
|
58
|
+
}),
|
|
59
|
+
/* @__PURE__ */ d(i, {
|
|
60
|
+
id: C.city,
|
|
61
|
+
"aria-required": !0,
|
|
62
|
+
className: "ttw:bg-background",
|
|
63
|
+
value: g.city,
|
|
64
|
+
disabled: y,
|
|
65
|
+
"aria-invalid": !!_?.city || void 0,
|
|
66
|
+
onChange: (e) => b({ city: e.target.value })
|
|
67
|
+
}),
|
|
68
|
+
/* @__PURE__ */ d(n, { errors: m(_?.city) })
|
|
69
|
+
] }) }), /* @__PURE__ */ d(e, { children: /* @__PURE__ */ f(t, { children: [
|
|
70
|
+
/* @__PURE__ */ d(r, {
|
|
71
|
+
htmlFor: C.state,
|
|
72
|
+
requirement: "required",
|
|
73
|
+
labels: S,
|
|
74
|
+
children: x.stateLabel
|
|
75
|
+
}),
|
|
76
|
+
/* @__PURE__ */ f(a, {
|
|
77
|
+
value: g.state || void 0,
|
|
78
|
+
disabled: y,
|
|
79
|
+
onValueChange: (e) => b({ state: e }),
|
|
80
|
+
children: [/* @__PURE__ */ d(c, {
|
|
81
|
+
id: C.state,
|
|
82
|
+
"aria-required": !0,
|
|
83
|
+
className: "ttw:w-full ttw:bg-background",
|
|
84
|
+
"aria-invalid": !!_?.state || void 0,
|
|
85
|
+
children: /* @__PURE__ */ d(l, { placeholder: x.statePlaceholder })
|
|
86
|
+
}), /* @__PURE__ */ d(o, { children: v.map((e) => /* @__PURE__ */ d(s, {
|
|
87
|
+
value: e.value,
|
|
88
|
+
children: e.label
|
|
89
|
+
}, e.value)) })]
|
|
90
|
+
}),
|
|
91
|
+
/* @__PURE__ */ d(n, { errors: m(_?.state) })
|
|
92
|
+
] }) })]
|
|
93
|
+
}),
|
|
94
|
+
/* @__PURE__ */ f("div", {
|
|
95
|
+
className: "ttw:flex ttw:gap-4",
|
|
96
|
+
children: [/* @__PURE__ */ d(e, { children: /* @__PURE__ */ f(t, { children: [
|
|
97
|
+
/* @__PURE__ */ d(r, {
|
|
98
|
+
htmlFor: C.postalCode,
|
|
99
|
+
requirement: "required",
|
|
100
|
+
labels: S,
|
|
101
|
+
children: x.postalCodeLabel
|
|
102
|
+
}),
|
|
103
|
+
/* @__PURE__ */ d(i, {
|
|
104
|
+
id: C.postalCode,
|
|
105
|
+
"aria-required": !0,
|
|
106
|
+
className: "ttw:bg-background",
|
|
107
|
+
value: g.postalCode,
|
|
108
|
+
disabled: y,
|
|
109
|
+
"aria-invalid": !!_?.postalCode || void 0,
|
|
110
|
+
onChange: (e) => b({ postalCode: e.target.value })
|
|
111
|
+
}),
|
|
112
|
+
/* @__PURE__ */ d(n, { errors: m(_?.postalCode) })
|
|
113
|
+
] }) }), /* @__PURE__ */ d(e, { children: /* @__PURE__ */ f(t, { children: [/* @__PURE__ */ d(r, {
|
|
114
|
+
htmlFor: C.country,
|
|
115
|
+
requirement: "required",
|
|
116
|
+
labels: S,
|
|
117
|
+
children: x.countryLabel
|
|
118
|
+
}), /* @__PURE__ */ f(a, {
|
|
119
|
+
value: p,
|
|
120
|
+
disabled: !0,
|
|
121
|
+
children: [/* @__PURE__ */ d(c, {
|
|
122
|
+
id: C.country,
|
|
123
|
+
"aria-required": !0,
|
|
124
|
+
className: "ttw:w-full ttw:bg-background",
|
|
125
|
+
children: /* @__PURE__ */ d(l, {})
|
|
126
|
+
}), /* @__PURE__ */ d(o, { children: /* @__PURE__ */ d(s, {
|
|
127
|
+
value: p,
|
|
128
|
+
children: x.countryUnitedStates
|
|
129
|
+
}) })]
|
|
130
|
+
})] }) })]
|
|
600
131
|
})
|
|
601
|
-
});
|
|
132
|
+
] });
|
|
602
133
|
}
|
|
603
134
|
//#endregion
|
|
604
|
-
export {
|
|
135
|
+
export { h as CounterpartAddressFields };
|