@tesouro/embedded-components-react 0.5.107 → 0.5.108

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