@tesouro/embedded-components-react 0.7.22 → 0.7.25

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 (41) hide show
  1. package/dist/index.css +0 -3
  2. package/dist/index.d.ts +20 -20
  3. package/dist/lib/CounterpartsWidget.d.ts +10 -2
  4. package/dist/lib/CounterpartsWidgetPublic.d.ts +10 -2
  5. package/dist/lib/CustomersWidget.d.ts +19 -19
  6. package/dist/lib/ExpenseManagementWidget.d.ts +1 -1
  7. package/dist/lib/ReceivablesWidget.d.ts +9 -1
  8. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index32.js +1 -1
  9. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/CounterpartDetailsContainer.js +1 -1
  10. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/CounterpartsWidget.js +50 -51
  11. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/viewModels.js +4 -2
  12. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index.js +1 -1
  13. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index2.js +1 -1
  14. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index4.js +72 -128
  15. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index5.js +183 -38
  16. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index6.js +503 -193
  17. package/dist/libs/tesouro-embedded-components-react/customers-widget/feature/dist/lib/CustomersWidget/CustomersWidget.js +33 -18
  18. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/ReceivablesWidget.js +57 -55
  19. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/index.js +14 -14
  20. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/helpers.js +114 -102
  21. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index.js +12 -11
  22. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index10.js +534 -7
  23. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index11.js +7 -179
  24. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index12.js +179 -6
  25. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index13.js +3 -1
  26. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index14.js +4 -28
  27. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index15.js +28 -4
  28. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index16.js +4 -0
  29. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index2.js +10 -2
  30. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index7.js +140 -55
  31. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index8.js +53 -47
  32. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index9.js +51 -539
  33. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  34. package/package.json +1 -1
  35. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index7.js +0 -520
  36. package/dist/libs/tesouro-embedded-components-react/customers-widget/feature/dist/lib/CustomersWidgetMonite/CustomersWidgetMonite.js +0 -45
  37. package/dist/libs/tesouro-embedded-components-react/customers-widget/feature/dist/lib/CustomersWidgetNative/CustomersWidgetNative.js +0 -42
  38. package/dist/libs/tesouro-embedded-components-react/shared/monite-wrapper/feature/dist/index.js +0 -4
  39. package/dist/libs/tesouro-embedded-components-react/shared/monite-wrapper/feature/dist/lib/MoniteRegionProvider.js +0 -21
  40. package/dist/libs/tesouro-embedded-components-react/shared/monite-wrapper/feature/dist/lib/MoniteWrapper.js +0 -134
  41. package/dist/libs/tesouro-embedded-components-react/shared/monite-wrapper/feature/dist/lib/RefreshingMoniteWidgetProvider.js +0 -7
@@ -1,210 +1,520 @@
1
- import { Button as e, Checkbox as t, Field as n, FieldContent as r, FieldDescription as i, FieldError as a, FieldLabel as o, Input as s, LABEL_LABELS_EN as c, Label as l, RequiredFieldsLegend as u, Spinner as d, Typography as f, cn as p, mergeRequiredFieldsLegendLabels as m } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
2
- import { CounterpartAddressFields as h } from "./index4.js";
3
- import { jsx as g, jsxs as _ } from "react/jsx-runtime";
1
+ import { Badge as e, Button as t, DropdownMenu as n, DropdownMenuContent as r, DropdownMenuItem as i, DropdownMenuTrigger as a, Separator as o, Sheet as s, SheetContent as c, SheetDescription as l, SheetHeader as u, SheetTitle as d, Skeleton as f, Spinner as ee, Typography as p, cn as te } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
2
+ import { COUNTERPART_DETAILS_SHEET_LABELS_EN as ne } from "./index2.js";
3
+ import { CounterpartAddressForm as m } from "./index4.js";
4
+ import { CounterpartEditForm as h } from "./index5.js";
5
+ import { useEffect as re, useState as ie } from "react";
6
+ import { Fragment as g, jsx as _, jsxs as v } from "react/jsx-runtime";
7
+ import { EyeIcon as y, EyeOffIcon as b, MoreVerticalIcon as x, PencilIcon as S, PlusIcon as C, SearchXIcon as ae, Trash2Icon as w, XIcon as T } from "lucide-react";
4
8
  //#region ../../libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index6.js
5
- function v(e) {
6
- return e ? [{ message: e }] : void 0;
9
+ var E = "-", D = {
10
+ billNeutral: "ttw:border-border ttw:bg-muted ttw:text-foreground ttw:hover:bg-muted",
11
+ billAccent: "ttw:border-violet-100 ttw:bg-violet-100 ttw:text-violet-700 ttw:hover:bg-violet-100",
12
+ billInfo: "ttw:border-blue-100 ttw:bg-blue-100 ttw:text-blue-700 ttw:hover:bg-blue-100",
13
+ billSuccess: "ttw:border-green-100 ttw:bg-green-100 ttw:text-green-700 ttw:hover:bg-green-100",
14
+ billSettled: "ttw:border-border ttw:bg-background ttw:text-green-900 ttw:hover:bg-background",
15
+ billDanger: "ttw:border-destructive/20 ttw:bg-destructive/20 ttw:text-destructive ttw:hover:bg-destructive/20",
16
+ invoiceNeutral: "ttw:border-transparent ttw:bg-muted ttw:text-muted-foreground",
17
+ invoiceCyan: "ttw:border-transparent ttw:bg-cyan-100 ttw:text-cyan-700",
18
+ invoiceSuccess: "ttw:border-transparent ttw:bg-green-100 ttw:text-green-700",
19
+ invoicePurple: "ttw:border-transparent ttw:bg-purple-100 ttw:text-purple-700",
20
+ invoiceOrange: "ttw:border-transparent ttw:bg-orange-100 ttw:text-orange-700",
21
+ invoiceDanger: "ttw:border-transparent ttw:bg-destructive/10 ttw:text-destructive"
22
+ };
23
+ function O({ label: t, tone: n }) {
24
+ return /* @__PURE__ */ _(e, {
25
+ variant: "outline",
26
+ className: D[n],
27
+ children: t
28
+ });
7
29
  }
8
- function y({ form: y, labels: b }) {
9
- let { name: x, email: S, phone: C, taxId: w, reminders: T, address: E, inProgress: D } = y, O = {
10
- ...b,
11
- ...y.labels
12
- }, k = {
13
- ...c,
14
- ...y.fieldMarkers
15
- };
16
- return /* @__PURE__ */ _("form", {
17
- className: "ttw:flex ttw:flex-col ttw:gap-4 ttw:rounded-[10px] ttw:border ttw:border-border ttw:bg-muted ttw:p-4",
18
- onSubmit: (e) => {
19
- e.preventDefault(), y.onSubmit();
20
- },
21
- children: [/* @__PURE__ */ _("div", {
22
- className: "ttw:flex ttw:flex-col ttw:gap-4",
23
- children: [
24
- /* @__PURE__ */ g("div", {
25
- className: "ttw:flex ttw:flex-col ttw:gap-1.5 ttw:border-b ttw:border-border ttw:pt-6 ttw:pb-7",
26
- children: /* @__PURE__ */ g(f, {
27
- variant: "body1",
28
- className: "ttw:font-medium",
29
- children: y.heading
30
+ function k({ className: e }) {
31
+ return /* @__PURE__ */ _(f, { className: e ?? "ttw:h-5 ttw:w-24" });
32
+ }
33
+ function A({ label: e, children: t, isLast: n }) {
34
+ return /* @__PURE__ */ v("div", {
35
+ className: ["ttw:grid ttw:grid-cols-[180px_1fr] ttw:gap-4 ttw:py-3", n ? "" : "ttw:border-b ttw:border-border"].join(" "),
36
+ children: [/* @__PURE__ */ _(p, {
37
+ variant: "body2",
38
+ className: "ttw:text-muted-foreground",
39
+ children: e
40
+ }), /* @__PURE__ */ _("div", {
41
+ className: "ttw:min-w-0 ttw:text-sm",
42
+ children: t
43
+ })]
44
+ });
45
+ }
46
+ function j({ mode: e, summary: t, labels: n }) {
47
+ let r = e === "customer" ? n.summaryReceived : n.summaryPaid;
48
+ return /* @__PURE__ */ v("div", {
49
+ className: "ttw:flex ttw:flex-col ttw:gap-4 ttw:rounded-md ttw:bg-muted ttw:p-5",
50
+ children: [
51
+ /* @__PURE__ */ _(p, {
52
+ variant: "body2",
53
+ className: "ttw:text-muted-foreground",
54
+ children: e === "customer" ? n.summaryAmountDue : n.summaryBalanceDue
55
+ }),
56
+ t?.isPrimaryAmountLoading ? /* @__PURE__ */ _(k, { className: "ttw:h-9 ttw:w-36" }) : /* @__PURE__ */ _("p", {
57
+ className: "ttw:text-[2rem] ttw:leading-tight ttw:font-semibold ttw:tracking-tight",
58
+ children: t?.primaryAmountLabel ?? E
59
+ }),
60
+ /* @__PURE__ */ v("div", {
61
+ className: "ttw:flex ttw:gap-8",
62
+ children: [
63
+ /* @__PURE__ */ v("div", {
64
+ className: "ttw:flex ttw:flex-col ttw:gap-1",
65
+ children: [/* @__PURE__ */ _(p, {
66
+ variant: "caption",
67
+ className: "ttw:text-muted-foreground",
68
+ children: n.summaryBilled
69
+ }), t?.isBilledAmountLoading ? /* @__PURE__ */ _(k, {}) : /* @__PURE__ */ _(p, {
70
+ variant: "body1",
71
+ className: "ttw:font-semibold",
72
+ children: t?.billedAmountLabel ?? E
73
+ })]
74
+ }),
75
+ /* @__PURE__ */ v("div", {
76
+ className: "ttw:flex ttw:flex-col ttw:gap-1",
77
+ children: [/* @__PURE__ */ _(p, {
78
+ variant: "caption",
79
+ className: "ttw:text-muted-foreground",
80
+ children: r
81
+ }), t?.isReceivedOrPaidAmountLoading ? /* @__PURE__ */ _(k, {}) : /* @__PURE__ */ _(p, {
82
+ variant: "body1",
83
+ className: "ttw:font-semibold ttw:text-green-600",
84
+ children: t?.receivedOrPaidAmountLabel ?? E
85
+ })]
86
+ }),
87
+ e === "vendor" && /* @__PURE__ */ v("div", {
88
+ className: "ttw:flex ttw:flex-col ttw:gap-1",
89
+ children: [/* @__PURE__ */ _(p, {
90
+ variant: "caption",
91
+ className: "ttw:text-muted-foreground",
92
+ children: n.summaryRejected
93
+ }), t?.isRejectedAmountLoading ? /* @__PURE__ */ _(k, {}) : /* @__PURE__ */ _(p, {
94
+ variant: "body1",
95
+ className: "ttw:font-semibold",
96
+ children: t?.rejectedAmountLabel ?? E
97
+ })]
30
98
  })
31
- }),
32
- /* @__PURE__ */ g(u, { labels: m(k, y.requiredFieldsLegend) }),
33
- y.formError && /* @__PURE__ */ g(f, {
99
+ ]
100
+ })
101
+ ]
102
+ });
103
+ }
104
+ function oe({ mode: e, documents: n, labels: r, onViewAll: i }) {
105
+ if (!n || n.length === 0) return null;
106
+ let a = e === "vendor";
107
+ return /* @__PURE__ */ v("section", {
108
+ className: "ttw:flex ttw:flex-col ttw:border-t ttw:border-border ttw:pt-6",
109
+ children: [/* @__PURE__ */ v("div", {
110
+ className: "ttw:flex ttw:items-start ttw:justify-between ttw:gap-4 ttw:pb-5",
111
+ children: [/* @__PURE__ */ v("div", {
112
+ className: "ttw:flex ttw:flex-col ttw:gap-1.5",
113
+ children: [/* @__PURE__ */ _(p, {
114
+ variant: "body1",
115
+ className: "ttw:font-medium",
116
+ children: e === "customer" ? r.recentCustomerDocumentsHeading : r.recentVendorDocumentsHeading
117
+ }), /* @__PURE__ */ _(p, {
34
118
  variant: "body2",
35
- color: "destructive",
36
- role: "alert",
37
- children: y.formError
119
+ className: "ttw:text-muted-foreground",
120
+ children: e === "customer" ? r.recentCustomerDocumentsDescription : r.recentVendorDocumentsDescription
121
+ })]
122
+ }), i && /* @__PURE__ */ _(t, {
123
+ variant: "link",
124
+ className: "ttw:h-auto ttw:p-0",
125
+ onClick: i,
126
+ children: r.viewAllDocumentsAction
127
+ })]
128
+ }), /* @__PURE__ */ _("div", {
129
+ className: "ttw:flex ttw:flex-col ttw:gap-3 ttw:rounded-md ttw:border ttw:border-border ttw:p-4",
130
+ children: n.map((e, t) => {
131
+ let i = a && e.isOverdue;
132
+ return /* @__PURE__ */ v("div", {
133
+ className: "ttw:flex ttw:flex-col ttw:gap-3",
134
+ children: [/* @__PURE__ */ v("div", {
135
+ className: "ttw:flex ttw:items-start ttw:justify-between ttw:gap-4",
136
+ children: [/* @__PURE__ */ v("div", {
137
+ className: "ttw:flex ttw:flex-col ttw:gap-1",
138
+ children: [/* @__PURE__ */ _(p, {
139
+ variant: "h6",
140
+ className: "ttw:font-medium",
141
+ children: e.amountLabel
142
+ }), /* @__PURE__ */ _(p, {
143
+ variant: "body2",
144
+ className: i ? "ttw:text-destructive" : "ttw:text-muted-foreground",
145
+ children: e.dateLabel
146
+ })]
147
+ }), /* @__PURE__ */ v("div", {
148
+ className: "ttw:flex ttw:items-center ttw:gap-2",
149
+ children: [i && /* @__PURE__ */ _(O, {
150
+ label: r.overdueTag,
151
+ tone: "billDanger"
152
+ }), /* @__PURE__ */ _(O, {
153
+ label: e.statusLabel,
154
+ tone: e.statusTone
155
+ })]
156
+ })]
157
+ }), t < n.length - 1 && /* @__PURE__ */ _(o, {})]
158
+ }, e.id);
159
+ })
160
+ })]
161
+ });
162
+ }
163
+ function M({ mode: e, addressLines: n, canEdit: r, onEditAddress: i, onAddAddress: a, labels: o, addressForm: s }) {
164
+ let c = n.length > 0;
165
+ return /* @__PURE__ */ v("section", {
166
+ className: e === "customer" ? "ttw:flex ttw:flex-col ttw:gap-3" : "ttw:flex ttw:flex-col",
167
+ children: [e === "customer" && !s && /* @__PURE__ */ v("div", {
168
+ className: "ttw:flex ttw:items-center ttw:justify-between ttw:gap-3",
169
+ children: [
170
+ /* @__PURE__ */ v(p, {
171
+ variant: "body1",
172
+ className: "ttw:font-medium",
173
+ children: [
174
+ o.customerAddressHeading,
175
+ " ",
176
+ /* @__PURE__ */ _("span", {
177
+ className: "ttw:text-muted-foreground",
178
+ children: o.optionalSuffix
179
+ })
180
+ ]
38
181
  }),
39
- x.kind === "person" ? /* @__PURE__ */ _("div", {
40
- className: "ttw:flex ttw:gap-4",
41
- children: [/* @__PURE__ */ g(n, { children: /* @__PURE__ */ _(r, { children: [
42
- /* @__PURE__ */ g(o, {
43
- htmlFor: "counterpart-edit-first-name",
44
- requirement: "required",
45
- labels: k,
46
- children: O.firstNameLabel
47
- }),
48
- /* @__PURE__ */ g(s, {
49
- id: "counterpart-edit-first-name",
50
- "aria-required": !0,
51
- className: "ttw:bg-background",
52
- value: x.firstName.value,
53
- disabled: D,
54
- "aria-invalid": !!x.firstName.error || void 0,
55
- onChange: (e) => y.onFieldChange("firstName", e.target.value)
56
- }),
57
- /* @__PURE__ */ g(a, { errors: v(x.firstName.error) })
58
- ] }) }), /* @__PURE__ */ g(n, { children: /* @__PURE__ */ _(r, { children: [
59
- /* @__PURE__ */ g(o, {
60
- htmlFor: "counterpart-edit-last-name",
61
- requirement: "required",
62
- labels: k,
63
- children: O.lastNameLabel
182
+ r && c && /* @__PURE__ */ _(t, {
183
+ type: "button",
184
+ variant: "link",
185
+ className: "ttw:h-auto ttw:p-0",
186
+ "aria-label": o.editAddressAction,
187
+ onClick: i,
188
+ children: o.editButton
189
+ }),
190
+ r && !c && /* @__PURE__ */ v(t, {
191
+ type: "button",
192
+ variant: "link",
193
+ className: "ttw:h-auto ttw:p-0",
194
+ onClick: a,
195
+ children: [/* @__PURE__ */ _(C, { className: "ttw:size-4" }), o.addAddressAction]
196
+ })
197
+ ]
198
+ }), s ? /* @__PURE__ */ _(m, {
199
+ form: s,
200
+ labels: o
201
+ }) : c ? /* @__PURE__ */ _("address", {
202
+ className: "ttw:flex ttw:flex-col ttw:gap-1 ttw:not-italic ttw:text-sm",
203
+ children: n.map((e) => /* @__PURE__ */ _("span", { children: e }, e))
204
+ }) : /* @__PURE__ */ _(p, {
205
+ variant: "body2",
206
+ className: "ttw:text-muted-foreground",
207
+ children: o.noAddress
208
+ })]
209
+ });
210
+ }
211
+ function se({ paymentMethod: n, canEdit: r, onAddBankAccount: i, onEditBankAccount: a, onDeleteBankAccount: o, labels: s }) {
212
+ return /* @__PURE__ */ v("section", {
213
+ className: "ttw:flex ttw:flex-col ttw:gap-4 ttw:border-t ttw:border-border ttw:pt-6",
214
+ children: [/* @__PURE__ */ v("div", {
215
+ className: "ttw:flex ttw:items-center ttw:justify-between ttw:gap-3",
216
+ children: [/* @__PURE__ */ v("div", {
217
+ className: "ttw:flex ttw:flex-col ttw:gap-1",
218
+ children: [/* @__PURE__ */ _(p, {
219
+ variant: "body1",
220
+ className: "ttw:font-medium",
221
+ children: s.paymentMethodsHeading
222
+ }), /* @__PURE__ */ _(p, {
223
+ variant: "body2",
224
+ className: "ttw:text-muted-foreground",
225
+ children: s.paymentMethodsDescription
226
+ })]
227
+ }), r && !n && /* @__PURE__ */ v(t, {
228
+ type: "button",
229
+ variant: "ghost",
230
+ size: "sm",
231
+ onClick: i,
232
+ children: [/* @__PURE__ */ _(C, { className: "ttw:size-4" }), s.addPaymentMethodAction]
233
+ })]
234
+ }), n ? /* @__PURE__ */ v("div", {
235
+ className: "ttw:flex ttw:flex-col ttw:gap-3 ttw:rounded-md ttw:border ttw:border-border ttw:p-4",
236
+ children: [/* @__PURE__ */ v("div", {
237
+ className: "ttw:flex ttw:items-start ttw:justify-between ttw:gap-3",
238
+ children: [/* @__PURE__ */ v("div", {
239
+ className: "ttw:flex ttw:flex-col ttw:gap-1",
240
+ children: [/* @__PURE__ */ _(p, {
241
+ variant: "body2",
242
+ className: "ttw:font-medium",
243
+ children: n.title
244
+ }), n.isIncomplete && /* @__PURE__ */ _(e, {
245
+ variant: "outline",
246
+ children: s.incompletePaymentMethod
247
+ })]
248
+ }), r && /* @__PURE__ */ v("div", {
249
+ className: "ttw:flex ttw:gap-1",
250
+ children: [/* @__PURE__ */ _(t, {
251
+ type: "button",
252
+ variant: "ghost",
253
+ size: "icon-sm",
254
+ "aria-label": s.editPaymentMethodAction,
255
+ onClick: () => a?.(n.id),
256
+ children: /* @__PURE__ */ _(S, { className: "ttw:size-4" })
257
+ }), /* @__PURE__ */ _(t, {
258
+ type: "button",
259
+ variant: "ghost",
260
+ size: "icon-sm",
261
+ "aria-label": s.deletePaymentMethodAction,
262
+ onClick: () => o?.(n.id),
263
+ children: /* @__PURE__ */ _(w, { className: "ttw:size-4" })
264
+ })]
265
+ })]
266
+ }), /* @__PURE__ */ v("div", {
267
+ className: "ttw:grid ttw:grid-cols-3 ttw:gap-3 ttw:text-sm",
268
+ children: [
269
+ /* @__PURE__ */ v("div", {
270
+ className: "ttw:flex ttw:flex-col ttw:gap-1",
271
+ children: [/* @__PURE__ */ _("span", {
272
+ className: "ttw:text-muted-foreground",
273
+ children: s.accountHolderLabel
274
+ }), /* @__PURE__ */ _("span", { children: n.accountHolderLabel || E })]
275
+ }),
276
+ /* @__PURE__ */ v("div", {
277
+ className: "ttw:flex ttw:flex-col ttw:gap-1",
278
+ children: [/* @__PURE__ */ _("span", {
279
+ className: "ttw:text-muted-foreground",
280
+ children: s.accountNumberLabel
281
+ }), /* @__PURE__ */ _("span", { children: n.accountNumberLabel || E })]
282
+ }),
283
+ /* @__PURE__ */ v("div", {
284
+ className: "ttw:flex ttw:flex-col ttw:gap-1",
285
+ children: [/* @__PURE__ */ _("span", {
286
+ className: "ttw:text-muted-foreground",
287
+ children: s.routingNumberLabel
288
+ }), /* @__PURE__ */ _("span", { children: n.routingNumberLabel || E })]
289
+ })
290
+ ]
291
+ })]
292
+ }) : /* @__PURE__ */ _(p, {
293
+ variant: "body2",
294
+ className: "ttw:text-muted-foreground",
295
+ children: s.noPaymentMethods
296
+ })]
297
+ });
298
+ }
299
+ function N({ open: e, onOpenChange: o, privacyResetKey: m, mode: S = "customer", counterpart: C, isLoading: D, isError: O, canEdit: k = !0, canDelete: N = !0, onEdit: P, onDelete: F, onClose: I, onEditAddress: L, onAddAddress: R, onAddBankAccount: z, onEditBankAccount: B, onDeleteBankAccount: V, onViewAllDocuments: H, onCreateDocument: U, editForm: W, addressForm: G, labels: ce }) {
300
+ let K = {
301
+ ...ne,
302
+ ...ce
303
+ }, [le, q] = ie(null), J = [
304
+ m ?? C?.name ?? "",
305
+ C?.taxId ?? "",
306
+ C?.taxIdMasked ?? ""
307
+ ].join(":"), Y = e && !!C?.taxId && le === J;
308
+ re(() => {
309
+ e || q(null);
310
+ }, [e]);
311
+ let X = S === "vendor", ue = Y ? C?.taxId ?? E : C?.taxIdMasked || C?.taxId || E, Z = C?.taxIdHelpText ?? (X ? K.vendorTaxIdHelp : K.customerTaxIdHelp), Q = (e) => {
312
+ e || q(null), o(e);
313
+ };
314
+ if (O) return /* @__PURE__ */ _(s, {
315
+ open: e,
316
+ onOpenChange: Q,
317
+ children: /* @__PURE__ */ _(c, {
318
+ className: "ttw:w-160 ttw:sm:max-w-160 ttw:gap-0",
319
+ children: /* @__PURE__ */ v("div", {
320
+ className: "ttw:m-auto ttw:flex ttw:w-3/4 ttw:flex-col ttw:items-center ttw:gap-4 ttw:p-4",
321
+ children: [/* @__PURE__ */ _(ae, { className: "ttw:size-8 ttw:text-destructive" }), /* @__PURE__ */ v("div", {
322
+ className: "ttw:flex ttw:flex-col ttw:items-center ttw:gap-2",
323
+ children: [/* @__PURE__ */ _(d, {
324
+ className: "ttw:text-xl ttw:font-semibold ttw:tracking-tight",
325
+ children: X ? K.notFoundVendorTitle : K.notFoundCustomerTitle
326
+ }), /* @__PURE__ */ _(l, {
327
+ className: "ttw:text-center ttw:text-base ttw:text-foreground",
328
+ children: X ? K.notFoundVendorDescription : K.notFoundCustomerDescription
329
+ })]
330
+ })]
331
+ })
332
+ })
333
+ });
334
+ let $ = D || !C;
335
+ return /* @__PURE__ */ _(s, {
336
+ open: e,
337
+ onOpenChange: Q,
338
+ children: /* @__PURE__ */ v(c, {
339
+ showCloseButton: !1,
340
+ className: "ttw:w-160 ttw:sm:max-w-160 ttw:gap-0 ttw:overflow-y-auto",
341
+ children: [/* @__PURE__ */ v(u, {
342
+ 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",
343
+ children: [/* @__PURE__ */ _("div", {
344
+ className: "ttw:flex ttw:min-w-0 ttw:flex-col ttw:gap-1",
345
+ children: $ ? /* @__PURE__ */ v(g, { children: [
346
+ /* @__PURE__ */ _(d, {
347
+ className: "ttw:sr-only",
348
+ children: K.loadingTitle
64
349
  }),
65
- /* @__PURE__ */ g(s, {
66
- id: "counterpart-edit-last-name",
67
- "aria-required": !0,
68
- className: "ttw:bg-background",
69
- value: x.lastName.value,
70
- disabled: D,
71
- "aria-invalid": !!x.lastName.error || void 0,
72
- onChange: (e) => y.onFieldChange("lastName", e.target.value)
350
+ /* @__PURE__ */ _(f, { className: "ttw:h-8 ttw:w-40" }),
351
+ /* @__PURE__ */ _(l, {
352
+ className: "ttw:sr-only",
353
+ children: K.hiddenDescription
73
354
  }),
74
- /* @__PURE__ */ g(a, { errors: v(x.lastName.error) })
75
- ] }) })]
76
- }) : /* @__PURE__ */ g(n, { children: /* @__PURE__ */ _(r, { children: [
77
- /* @__PURE__ */ g(o, {
78
- htmlFor: "counterpart-edit-business-name",
79
- requirement: "required",
80
- labels: k,
81
- children: O.businessNameLabel
355
+ /* @__PURE__ */ _(f, { className: "ttw:h-5 ttw:w-60" })
356
+ ] }) : /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _(d, {
357
+ className: "ttw:truncate ttw:text-2xl",
358
+ children: C.name
359
+ }), /* @__PURE__ */ _(l, { children: C.subtitle ?? K.hiddenDescription })] })
360
+ }), /* @__PURE__ */ v("div", {
361
+ className: "ttw:flex ttw:gap-2",
362
+ children: [N && C && /* @__PURE__ */ v(n, { children: [/* @__PURE__ */ _(a, {
363
+ asChild: !0,
364
+ children: /* @__PURE__ */ _(t, {
365
+ type: "button",
366
+ variant: "outline",
367
+ size: "icon",
368
+ "aria-label": K.openActionsMenu,
369
+ children: /* @__PURE__ */ _(x, { className: "ttw:size-4" })
370
+ })
371
+ }), /* @__PURE__ */ _(r, {
372
+ align: "end",
373
+ children: /* @__PURE__ */ v(i, {
374
+ variant: "destructive",
375
+ onClick: F,
376
+ children: [/* @__PURE__ */ _(w, { className: "ttw:size-4" }), X ? K.deleteVendorAction : K.deleteCustomerAction]
377
+ })
378
+ })] }), /* @__PURE__ */ _(t, {
379
+ type: "button",
380
+ variant: "outline",
381
+ size: "icon",
382
+ "aria-label": K.closeAction,
383
+ onClick: () => {
384
+ q(null), I();
385
+ },
386
+ children: /* @__PURE__ */ _(T, { className: "ttw:size-4" })
387
+ })]
388
+ })]
389
+ }), $ ? /* @__PURE__ */ _("div", {
390
+ className: "ttw:flex ttw:flex-1 ttw:items-center ttw:justify-center ttw:p-6",
391
+ children: /* @__PURE__ */ _(ee, {})
392
+ }) : /* @__PURE__ */ v("main", {
393
+ className: "ttw:flex ttw:flex-col ttw:gap-6 ttw:p-6",
394
+ children: [
395
+ /* @__PURE__ */ v("div", {
396
+ className: "ttw:flex ttw:flex-col ttw:gap-4",
397
+ children: [/* @__PURE__ */ _(j, {
398
+ mode: S,
399
+ summary: C.summary,
400
+ labels: K
401
+ }), U && /* @__PURE__ */ _(t, {
402
+ type: "button",
403
+ className: "ttw:w-fit",
404
+ onClick: U,
405
+ children: X ? K.sendPaymentAction : K.issueInvoiceAction
406
+ })]
82
407
  }),
83
- /* @__PURE__ */ g(s, {
84
- id: "counterpart-edit-business-name",
85
- "aria-required": !0,
86
- className: "ttw:bg-background",
87
- value: x.businessName.value,
88
- disabled: D,
89
- "aria-invalid": !!x.businessName.error || void 0,
90
- onChange: (e) => y.onFieldChange("businessName", e.target.value)
408
+ /* @__PURE__ */ _(oe, {
409
+ mode: S,
410
+ documents: C.recentDocuments,
411
+ labels: K,
412
+ onViewAll: H
91
413
  }),
92
- /* @__PURE__ */ g(a, { errors: v(x.businessName.error) })
93
- ] }) }),
94
- /* @__PURE__ */ _("div", {
95
- className: p("ttw:flex ttw:gap-4", y.contactLayout === "inline" ? "ttw:flex-row" : "ttw:flex-col"),
96
- children: [
97
- /* @__PURE__ */ g(n, { children: /* @__PURE__ */ _(r, { children: [
98
- /* @__PURE__ */ g(o, {
99
- htmlFor: "counterpart-edit-email",
100
- requirement: "required",
101
- labels: k,
102
- children: O.rowEmail
103
- }),
104
- /* @__PURE__ */ g(s, {
105
- id: "counterpart-edit-email",
106
- "aria-required": !0,
107
- type: "email",
108
- className: "ttw:bg-background",
109
- value: S.value,
110
- disabled: D,
111
- "aria-invalid": !!S.error || void 0,
112
- onChange: (e) => y.onFieldChange("email", e.target.value)
113
- }),
114
- /* @__PURE__ */ g(a, { errors: v(S.error) })
115
- ] }) }),
116
- T && /* @__PURE__ */ _(l, {
117
- htmlFor: "counterpart-edit-reminders",
118
- className: "ttw:flex ttw:items-start ttw:gap-3 ttw:rounded-md ttw:border ttw:border-border ttw:bg-background ttw:p-3",
119
- children: [/* @__PURE__ */ g(t, {
120
- id: "counterpart-edit-reminders",
121
- checked: T.checked,
122
- disabled: D,
123
- onCheckedChange: (e) => y.onRemindersChange(e === !0)
124
- }), /* @__PURE__ */ _("span", {
125
- className: "ttw:flex ttw:flex-col ttw:gap-0.5",
126
- children: [/* @__PURE__ */ g("span", {
127
- className: "ttw:text-sm ttw:font-medium",
128
- children: O.remindersCheckboxLabel
129
- }), /* @__PURE__ */ g("span", {
130
- className: "ttw:text-sm ttw:text-muted-foreground",
131
- children: O.remindersCheckboxDescription
132
- })]
414
+ /* @__PURE__ */ v("section", {
415
+ className: "ttw:flex ttw:flex-col",
416
+ children: [/* @__PURE__ */ v("div", {
417
+ className: "ttw:flex ttw:items-center ttw:justify-between ttw:gap-3 ttw:pb-5",
418
+ children: [/* @__PURE__ */ _(p, {
419
+ variant: "body1",
420
+ className: "ttw:font-medium",
421
+ children: X ? K.vendorDetailsHeading : K.customerDetailsHeading
422
+ }), k && !W && /* @__PURE__ */ _(t, {
423
+ type: "button",
424
+ variant: "link",
425
+ className: "ttw:h-auto ttw:p-0",
426
+ onClick: P,
427
+ children: K.editButton
133
428
  })]
134
- }),
135
- /* @__PURE__ */ g(n, { children: /* @__PURE__ */ _(r, { children: [
136
- /* @__PURE__ */ g(o, {
137
- htmlFor: "counterpart-edit-phone",
138
- requirement: "optional",
139
- labels: k,
140
- children: O.rowPhone
141
- }),
142
- /* @__PURE__ */ g(s, {
143
- id: "counterpart-edit-phone",
144
- type: "tel",
145
- className: "ttw:bg-background",
146
- value: C.value,
147
- disabled: D,
148
- "aria-invalid": !!C.error || void 0,
149
- onChange: (e) => y.onFieldChange("phone", e.target.value)
150
- }),
151
- /* @__PURE__ */ g(a, { errors: v(C.error) })
152
- ] }) })
153
- ]
154
- }),
155
- /* @__PURE__ */ g(n, { children: /* @__PURE__ */ _(r, { children: [
156
- /* @__PURE__ */ g(o, {
157
- htmlFor: "counterpart-edit-tax-id",
158
- requirement: "optional",
159
- labels: k,
160
- children: w.label
429
+ }), W ? /* @__PURE__ */ _(h, {
430
+ form: W,
431
+ labels: K
432
+ }) : /* @__PURE__ */ v("div", {
433
+ className: te("ttw:border-t ttw:border-border", !X && "ttw:border-b"),
434
+ children: [
435
+ /* @__PURE__ */ _(A, {
436
+ label: K.rowType,
437
+ children: C.entityTypeLabel ?? E
438
+ }),
439
+ /* @__PURE__ */ _(A, {
440
+ label: K.rowName,
441
+ children: C.name
442
+ }),
443
+ /* @__PURE__ */ _(A, {
444
+ label: K.rowEmail,
445
+ children: C.email || E
446
+ }),
447
+ !X && /* @__PURE__ */ _(A, {
448
+ label: K.rowPaymentReminders,
449
+ children: C.remindersLabel ?? E
450
+ }),
451
+ /* @__PURE__ */ _(A, {
452
+ label: K.rowPhone,
453
+ children: C.phone || E
454
+ }),
455
+ /* @__PURE__ */ _(A, {
456
+ label: C.entityType === "individual" ? K.rowTaxIdSsn : K.rowTaxIdEin,
457
+ isLast: !X,
458
+ children: /* @__PURE__ */ v("div", {
459
+ className: "ttw:flex ttw:flex-col ttw:gap-2",
460
+ children: [/* @__PURE__ */ v("div", {
461
+ className: "ttw:flex ttw:items-center ttw:gap-2",
462
+ children: [/* @__PURE__ */ _("span", {
463
+ className: "ttw:font-medium",
464
+ children: ue
465
+ }), C.taxId && /* @__PURE__ */ v(t, {
466
+ type: "button",
467
+ variant: "outline",
468
+ size: "sm",
469
+ onClick: () => {
470
+ q((e) => e === J ? null : J);
471
+ },
472
+ children: [_(Y ? b : y, { className: "ttw:size-4" }), Y ? K.hideTaxId : K.showTaxId]
473
+ })]
474
+ }), Z && /* @__PURE__ */ _(p, {
475
+ variant: "body2",
476
+ className: "ttw:text-muted-foreground",
477
+ children: Z
478
+ })]
479
+ })
480
+ }),
481
+ X && /* @__PURE__ */ _(A, {
482
+ label: K.addressHeading,
483
+ isLast: !0,
484
+ children: /* @__PURE__ */ _(M, {
485
+ mode: S,
486
+ addressLines: C.addressLines,
487
+ canEdit: k,
488
+ onEditAddress: L,
489
+ onAddAddress: R,
490
+ labels: K,
491
+ addressForm: G
492
+ })
493
+ })
494
+ ]
495
+ })]
161
496
  }),
162
- /* @__PURE__ */ g(s, {
163
- id: "counterpart-edit-tax-id",
164
- className: "ttw:bg-background",
165
- placeholder: w.placeholder,
166
- value: w.value,
167
- disabled: D,
168
- "aria-invalid": !!w.error || void 0,
169
- onChange: (e) => y.onFieldChange("taxId", e.target.value)
497
+ !X && /* @__PURE__ */ _(M, {
498
+ mode: S,
499
+ addressLines: C.addressLines,
500
+ canEdit: k,
501
+ onEditAddress: L,
502
+ onAddAddress: R,
503
+ labels: K,
504
+ addressForm: G
170
505
  }),
171
- /* @__PURE__ */ g(i, { children: w.description }),
172
- /* @__PURE__ */ g(a, { errors: v(w.error) })
173
- ] }) }),
174
- E && /* @__PURE__ */ g("div", {
175
- className: "ttw:flex ttw:flex-col ttw:gap-4",
176
- children: /* @__PURE__ */ g(h, {
177
- idPrefix: "counterpart-edit-address",
178
- values: E.values,
179
- errors: E.errors,
180
- stateOptions: y.stateOptions,
181
- disabled: D,
182
- onChange: y.onAddressChange,
183
- labels: O,
184
- fieldMarkers: {
185
- ...k,
186
- ...y.addressFieldMarkers
187
- }
506
+ X && /* @__PURE__ */ _(se, {
507
+ paymentMethod: C.paymentMethod,
508
+ canEdit: k,
509
+ onAddBankAccount: z,
510
+ onEditBankAccount: B,
511
+ onDeleteBankAccount: V,
512
+ labels: K
188
513
  })
189
- })
190
- ]
191
- }), /* @__PURE__ */ _("div", {
192
- className: "ttw:flex ttw:justify-end ttw:gap-4 ttw:pt-6",
193
- children: [/* @__PURE__ */ g(e, {
194
- type: "button",
195
- variant: "outline",
196
- className: "ttw:w-fit ttw:border-border",
197
- disabled: D,
198
- onClick: y.onCancel,
199
- children: O.cancelButton
200
- }), /* @__PURE__ */ _(e, {
201
- type: "submit",
202
- className: "ttw:w-fit",
203
- disabled: D || y.submitDisabled,
204
- children: [D && /* @__PURE__ */ g(d, {}), O.saveButton]
514
+ ]
205
515
  })]
206
- })]
516
+ })
207
517
  });
208
518
  }
209
519
  //#endregion
210
- export { y as CounterpartEditForm };
520
+ export { N as CounterpartDetailsSheet, N as default };