@tesouro/embedded-components-react 0.11.65 → 0.11.66
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 +6 -24
- package/dist/index.d.ts +27 -39
- package/dist/lib/CounterpartsWidget.d.ts +26 -39
- package/dist/lib/CounterpartsWidgetPublic.d.ts +26 -39
- package/dist/lib/CustomersWidget.d.ts +26 -39
- package/dist/lib/ReceivablesWidget.d.ts +14 -4
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/CounterpartDetailsContainer.js +8 -12
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/CounterpartDetailsPanel.js +93 -110
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/CounterpartsWidget.js +52 -52
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/useCounterpartDetailsActions.js +72 -107
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/useCounterpartDetailsSheetView.js +27 -27
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/useCounterpartsTable.js +112 -145
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/useCounterpartsWidget.js +13 -16
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/viewModels.js +3 -122
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/mocks/labels.js +5 -5
- 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 +44 -65
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index3.js +157 -134
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index4.js +18 -14
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index5.js +362 -55
- 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/feature/dist/lib/helpers.js +7 -7
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/labels.js +16 -9
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/useAddressForm.js +2 -66
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/useDeleteController.js +48 -46
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index.js +5 -5
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index10.js +138 -149
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index11.js +19 -20
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index12.js +1 -0
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index13.js +21 -27
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index2.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index3.js +0 -1
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index8.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index9.js +30 -63
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
- package/package.json +1 -1
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index6.js +0 -211
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index7.js +0 -509
|
@@ -1,66 +1,373 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import "../../../shared/
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
1
|
+
import { Badge as e, Button as t, DescriptionList as n, DisplayAmount as r, DropdownMenu as i, DropdownMenuContent as a, DropdownMenuItem as o, DropdownMenuTrigger as s, FormSheet as c, Heading as l, Separator as u, Skeleton as d, Tooltip as f, TooltipContent as p, TooltipProvider as m, TooltipTrigger as h } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
|
|
2
|
+
import { ErrorState as g } from "../../../shared/ui/dist/lib/ErrorState/ErrorState.js";
|
|
3
|
+
import { LoadingRegion as _ } from "../../../shared/ui/dist/lib/LoadingRegion/LoadingRegion.js";
|
|
4
|
+
import "../../../shared/ui/dist/index.js";
|
|
5
|
+
import { COUNTERPART_DETAILS_SHEET_LABELS_EN as v } from "./index2.js";
|
|
6
|
+
import { BILL_STATUS_BADGE_COLOR as y, INVOICE_STATUS_BADGE_COLOR as b } from "./index4.js";
|
|
7
|
+
import { useEffect as x, useState as S } from "react";
|
|
8
|
+
import { Fragment as C, jsx as w, jsxs as T } from "react/jsx-runtime";
|
|
9
|
+
import { EyeIcon as E, EyeOffIcon as D, MoreVerticalIcon as O } from "lucide-react";
|
|
6
10
|
// ../../libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index5.js
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
e
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
11
|
+
var k = "—";
|
|
12
|
+
function A({ label: e, children: n, onClick: r }) {
|
|
13
|
+
return /* @__PURE__ */ T(f, { children: [/* @__PURE__ */ w(h, {
|
|
14
|
+
asChild: !0,
|
|
15
|
+
children: /* @__PURE__ */ w(t, {
|
|
16
|
+
type: "button",
|
|
17
|
+
variant: "ghost",
|
|
18
|
+
size: "icon-sm",
|
|
19
|
+
"aria-label": e,
|
|
20
|
+
onClick: r,
|
|
21
|
+
children: n
|
|
22
|
+
})
|
|
23
|
+
}), /* @__PURE__ */ w(p, { children: e })] });
|
|
24
|
+
}
|
|
25
|
+
function j({ label: e, itemLabel: n, onSelect: r }) {
|
|
26
|
+
return /* @__PURE__ */ T(i, { children: [/* @__PURE__ */ T(f, { children: [/* @__PURE__ */ w(h, {
|
|
27
|
+
asChild: !0,
|
|
28
|
+
children: /* @__PURE__ */ w(s, {
|
|
29
|
+
asChild: !0,
|
|
30
|
+
children: /* @__PURE__ */ w(t, {
|
|
31
|
+
type: "button",
|
|
32
|
+
variant: "ghost",
|
|
33
|
+
size: "icon-sm",
|
|
34
|
+
"aria-label": e,
|
|
35
|
+
children: /* @__PURE__ */ w(O, {})
|
|
36
|
+
})
|
|
37
|
+
})
|
|
38
|
+
}), /* @__PURE__ */ w(p, { children: e })] }), /* @__PURE__ */ w(a, {
|
|
39
|
+
align: "end",
|
|
40
|
+
children: /* @__PURE__ */ w(o, {
|
|
41
|
+
variant: "destructive",
|
|
42
|
+
onClick: r,
|
|
43
|
+
children: n
|
|
44
|
+
})
|
|
45
|
+
})] });
|
|
46
|
+
}
|
|
47
|
+
function M({ label: e, value: t, isLoading: n }) {
|
|
48
|
+
return /* @__PURE__ */ T("div", {
|
|
49
|
+
className: "ttw:flex ttw:flex-col ttw:gap-1",
|
|
50
|
+
children: [/* @__PURE__ */ w("span", {
|
|
51
|
+
className: "ttw:text-sm ttw:text-muted-foreground",
|
|
52
|
+
children: e
|
|
53
|
+
}), n ? /* @__PURE__ */ w(d, { className: "ttw:h-5 ttw:w-24" }) : /* @__PURE__ */ w("span", {
|
|
54
|
+
className: "ttw:text-sm ttw:font-medium ttw:tabular-nums",
|
|
55
|
+
children: t ?? k
|
|
56
|
+
})]
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
function N({ mode: e, summary: t, labels: n }) {
|
|
60
|
+
return /* @__PURE__ */ T("div", {
|
|
61
|
+
className: "ttw:flex ttw:flex-col ttw:gap-4 ttw:rounded-lg ttw:bg-muted ttw:p-4",
|
|
62
|
+
children: [/* @__PURE__ */ T("div", {
|
|
63
|
+
className: "ttw:flex ttw:flex-col ttw:gap-1",
|
|
64
|
+
children: [/* @__PURE__ */ w("span", {
|
|
65
|
+
className: "ttw:text-sm ttw:text-muted-foreground",
|
|
66
|
+
children: e === "customer" ? n.summaryAmountDue : n.summaryBalanceDue
|
|
67
|
+
}), t?.isPrimaryAmountLoading ? /* @__PURE__ */ w(d, { className: "ttw:h-9 ttw:w-36" }) : /* @__PURE__ */ w(r, { children: t?.primaryAmountLabel ?? k })]
|
|
68
|
+
}), /* @__PURE__ */ T("div", {
|
|
69
|
+
className: "ttw:flex ttw:flex-wrap ttw:gap-x-8 ttw:gap-y-4",
|
|
19
70
|
children: [
|
|
20
|
-
/* @__PURE__ */
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
className: "ttw:font-medium",
|
|
25
|
-
children: u.hasExistingAddress ? d.editingAddressHeading : d.addingAddressHeading
|
|
26
|
-
})
|
|
71
|
+
/* @__PURE__ */ w(M, {
|
|
72
|
+
label: e === "customer" ? n.summaryInvoiced : n.summaryBilled,
|
|
73
|
+
value: t?.billedAmountLabel,
|
|
74
|
+
isLoading: t?.isBilledAmountLoading
|
|
27
75
|
}),
|
|
28
|
-
/* @__PURE__ */
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
role: "alert",
|
|
33
|
-
children: u.formError
|
|
76
|
+
/* @__PURE__ */ w(M, {
|
|
77
|
+
label: e === "customer" ? n.summaryReceived : n.summaryPaid,
|
|
78
|
+
value: t?.receivedOrPaidAmountLabel,
|
|
79
|
+
isLoading: t?.isReceivedOrPaidAmountLoading
|
|
34
80
|
}),
|
|
35
|
-
/* @__PURE__ */
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
stateOptions: u.stateOptions,
|
|
40
|
-
disabled: u.inProgress,
|
|
41
|
-
onChange: u.onChange,
|
|
42
|
-
labels: s(d, {
|
|
43
|
-
...f,
|
|
44
|
-
...u.addressFieldMarkers
|
|
45
|
-
})
|
|
81
|
+
e === "vendor" && /* @__PURE__ */ w(M, {
|
|
82
|
+
label: n.summaryRejected,
|
|
83
|
+
value: t?.rejectedAmountLabel,
|
|
84
|
+
isLoading: t?.isRejectedAmountLoading
|
|
46
85
|
})
|
|
47
86
|
]
|
|
48
|
-
})
|
|
49
|
-
|
|
50
|
-
|
|
87
|
+
})]
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
function P({ status: t }) {
|
|
91
|
+
let n = t.kind === "bill" ? y[t.tone] : b[t.tone];
|
|
92
|
+
return "tone" in n ? /* @__PURE__ */ w(e, {
|
|
93
|
+
tone: n.tone,
|
|
94
|
+
children: t.label
|
|
95
|
+
}) : /* @__PURE__ */ w(e, {
|
|
96
|
+
accent: n.accent,
|
|
97
|
+
children: t.label
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
function F({ mode: n, documents: r, labels: i, onViewAll: a }) {
|
|
101
|
+
if (!r || r.length === 0) return null;
|
|
102
|
+
let o = n === "vendor";
|
|
103
|
+
return /* @__PURE__ */ T("section", {
|
|
104
|
+
className: "ttw:flex ttw:flex-col ttw:gap-3",
|
|
105
|
+
children: [/* @__PURE__ */ T("div", {
|
|
106
|
+
className: "ttw:flex ttw:items-start ttw:justify-between ttw:gap-4",
|
|
107
|
+
children: [/* @__PURE__ */ T("div", {
|
|
108
|
+
className: "ttw:flex ttw:flex-col ttw:gap-1",
|
|
109
|
+
children: [/* @__PURE__ */ w(l, {
|
|
110
|
+
variant: "subsection",
|
|
111
|
+
level: 3,
|
|
112
|
+
children: o ? i.recentVendorDocumentsHeading : i.recentCustomerDocumentsHeading
|
|
113
|
+
}), /* @__PURE__ */ w("p", {
|
|
114
|
+
className: "ttw:text-sm ttw:text-muted-foreground",
|
|
115
|
+
children: o ? i.recentVendorDocumentsDescription : i.recentCustomerDocumentsDescription
|
|
116
|
+
})]
|
|
117
|
+
}), a && /* @__PURE__ */ w(t, {
|
|
51
118
|
type: "button",
|
|
52
|
-
variant: "
|
|
53
|
-
className: "ttw:
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
children: d.cancelButton
|
|
57
|
-
}), /* @__PURE__ */ l(e, {
|
|
58
|
-
type: "submit",
|
|
59
|
-
className: "ttw:w-fit",
|
|
60
|
-
disabled: u.inProgress || u.submitDisabled,
|
|
61
|
-
children: [u.inProgress && /* @__PURE__ */ c(r, {}), d.saveButton]
|
|
119
|
+
variant: "link",
|
|
120
|
+
className: "ttw:h-auto ttw:p-0",
|
|
121
|
+
onClick: a,
|
|
122
|
+
children: i.viewAllDocumentsAction
|
|
62
123
|
})]
|
|
124
|
+
}), /* @__PURE__ */ w("ul", {
|
|
125
|
+
className: "ttw:flex ttw:flex-col ttw:gap-3",
|
|
126
|
+
children: r.map((t, n) => {
|
|
127
|
+
let a = o && t.isOverdue;
|
|
128
|
+
return /* @__PURE__ */ T("li", {
|
|
129
|
+
className: "ttw:flex ttw:flex-col ttw:gap-3",
|
|
130
|
+
children: [/* @__PURE__ */ T("div", {
|
|
131
|
+
className: "ttw:flex ttw:items-start ttw:justify-between ttw:gap-4",
|
|
132
|
+
children: [/* @__PURE__ */ T("div", {
|
|
133
|
+
className: "ttw:flex ttw:flex-col ttw:gap-1",
|
|
134
|
+
children: [/* @__PURE__ */ w("span", {
|
|
135
|
+
className: "ttw:text-sm ttw:font-medium ttw:tabular-nums",
|
|
136
|
+
children: t.amountLabel
|
|
137
|
+
}), /* @__PURE__ */ T("span", {
|
|
138
|
+
className: "ttw:flex ttw:flex-wrap ttw:gap-x-2 ttw:text-sm ttw:text-muted-foreground",
|
|
139
|
+
children: [t.documentNumberLabel && /* @__PURE__ */ T(C, { children: [/* @__PURE__ */ w("span", { children: t.documentNumberLabel }), /* @__PURE__ */ w("span", {
|
|
140
|
+
"aria-hidden": "true",
|
|
141
|
+
children: "·"
|
|
142
|
+
})] }), /* @__PURE__ */ w("span", { children: t.dateLabel })]
|
|
143
|
+
})]
|
|
144
|
+
}), /* @__PURE__ */ T("div", {
|
|
145
|
+
className: "ttw:flex ttw:flex-wrap ttw:items-center ttw:justify-end ttw:gap-2",
|
|
146
|
+
children: [a && /* @__PURE__ */ w(e, {
|
|
147
|
+
tone: "destructive",
|
|
148
|
+
children: i.overdueTag
|
|
149
|
+
}), /* @__PURE__ */ w(P, { status: t.status })]
|
|
150
|
+
})]
|
|
151
|
+
}), n < r.length - 1 && /* @__PURE__ */ w(u, {})]
|
|
152
|
+
}, t.id);
|
|
153
|
+
})
|
|
63
154
|
})]
|
|
64
155
|
});
|
|
65
156
|
}
|
|
66
|
-
|
|
157
|
+
function I({ paymentMethod: r, canEdit: i, onAddBankAccount: a, onEditBankAccount: o, onDeleteBankAccount: s, labels: c }) {
|
|
158
|
+
return /* @__PURE__ */ T("section", {
|
|
159
|
+
className: "ttw:flex ttw:flex-col ttw:gap-3",
|
|
160
|
+
children: [/* @__PURE__ */ T("div", {
|
|
161
|
+
className: "ttw:flex ttw:items-start ttw:justify-between ttw:gap-4",
|
|
162
|
+
children: [/* @__PURE__ */ T("div", {
|
|
163
|
+
className: "ttw:flex ttw:flex-col ttw:gap-1",
|
|
164
|
+
children: [/* @__PURE__ */ w(l, {
|
|
165
|
+
variant: "subsection",
|
|
166
|
+
level: 3,
|
|
167
|
+
children: c.paymentMethodsHeading
|
|
168
|
+
}), /* @__PURE__ */ w("p", {
|
|
169
|
+
className: "ttw:text-sm ttw:text-muted-foreground",
|
|
170
|
+
children: c.paymentMethodsDescription
|
|
171
|
+
})]
|
|
172
|
+
}), i && !r && /* @__PURE__ */ w(t, {
|
|
173
|
+
type: "button",
|
|
174
|
+
variant: "link",
|
|
175
|
+
className: "ttw:h-auto ttw:p-0",
|
|
176
|
+
onClick: a,
|
|
177
|
+
children: c.addPaymentMethodAction
|
|
178
|
+
})]
|
|
179
|
+
}), r ? /* @__PURE__ */ T("div", {
|
|
180
|
+
className: "ttw:flex ttw:flex-col ttw:gap-2 ttw:rounded-lg ttw:bg-muted ttw:p-4",
|
|
181
|
+
children: [/* @__PURE__ */ T("div", {
|
|
182
|
+
className: "ttw:flex ttw:items-center ttw:justify-between ttw:gap-3",
|
|
183
|
+
children: [/* @__PURE__ */ T("div", {
|
|
184
|
+
className: "ttw:flex ttw:flex-wrap ttw:items-center ttw:gap-2",
|
|
185
|
+
children: [/* @__PURE__ */ w("span", {
|
|
186
|
+
className: "ttw:text-sm ttw:font-medium",
|
|
187
|
+
children: r.title
|
|
188
|
+
}), r.isIncomplete && /* @__PURE__ */ w(e, {
|
|
189
|
+
tone: "warning",
|
|
190
|
+
children: c.incompletePaymentMethod
|
|
191
|
+
})]
|
|
192
|
+
}), i && /* @__PURE__ */ T("div", {
|
|
193
|
+
className: "ttw:flex ttw:items-center ttw:gap-1",
|
|
194
|
+
children: [/* @__PURE__ */ w(t, {
|
|
195
|
+
type: "button",
|
|
196
|
+
variant: "link",
|
|
197
|
+
className: "ttw:h-auto ttw:px-2 ttw:py-0",
|
|
198
|
+
"aria-label": c.editPaymentMethodAction,
|
|
199
|
+
onClick: () => o?.(r.id),
|
|
200
|
+
children: c.editButton
|
|
201
|
+
}), /* @__PURE__ */ w(j, {
|
|
202
|
+
label: c.paymentMethodActionsMenu,
|
|
203
|
+
itemLabel: c.deletePaymentMethodAction,
|
|
204
|
+
onSelect: () => s?.(r.id)
|
|
205
|
+
})]
|
|
206
|
+
})]
|
|
207
|
+
}), /* @__PURE__ */ w(n, { items: [
|
|
208
|
+
{
|
|
209
|
+
label: c.accountHolderLabel,
|
|
210
|
+
value: r.accountHolderLabel || k
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
label: c.accountNumberLabel,
|
|
214
|
+
value: r.accountNumberLabel || k
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
label: c.routingNumberLabel,
|
|
218
|
+
value: r.routingNumberLabel || k
|
|
219
|
+
}
|
|
220
|
+
] })]
|
|
221
|
+
}) : /* @__PURE__ */ w("p", {
|
|
222
|
+
className: "ttw:text-sm ttw:text-muted-foreground",
|
|
223
|
+
children: c.noPaymentMethods
|
|
224
|
+
})]
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
function L({ label: e }) {
|
|
228
|
+
return /* @__PURE__ */ T(_, {
|
|
229
|
+
isLoading: !0,
|
|
230
|
+
loadingLabel: e,
|
|
231
|
+
className: "ttw:flex ttw:flex-col ttw:gap-6 ttw:py-5",
|
|
232
|
+
children: [/* @__PURE__ */ w(d, { className: "ttw:h-32 ttw:w-full" }), /* @__PURE__ */ T("div", {
|
|
233
|
+
className: "ttw:flex ttw:flex-col ttw:gap-3",
|
|
234
|
+
children: [
|
|
235
|
+
/* @__PURE__ */ w(d, { className: "ttw:h-5 ttw:w-40" }),
|
|
236
|
+
/* @__PURE__ */ w(d, { className: "ttw:h-5 ttw:w-full" }),
|
|
237
|
+
/* @__PURE__ */ w(d, { className: "ttw:h-5 ttw:w-full" }),
|
|
238
|
+
/* @__PURE__ */ w(d, { className: "ttw:h-5 ttw:w-full" })
|
|
239
|
+
]
|
|
240
|
+
})]
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
function R({ open: e, onOpenChange: r, privacyResetKey: i, mode: a = "customer", counterpart: o, isLoading: s, isError: u, canEdit: d = !0, canEditProfile: f = d, canEditPaymentMethod: p = d, canDelete: h = !0, onEdit: _, onDelete: y, onAddBankAccount: b, onEditBankAccount: O, onDeleteBankAccount: M, onViewAllDocuments: P, onCreateDocument: R, labels: z }) {
|
|
244
|
+
let B = {
|
|
245
|
+
...v,
|
|
246
|
+
...z
|
|
247
|
+
}, [V, H] = S(null), U = [
|
|
248
|
+
i ?? o?.name ?? "",
|
|
249
|
+
o?.taxId ?? "",
|
|
250
|
+
o?.taxIdMasked ?? ""
|
|
251
|
+
].join(":"), W = e && !!o?.taxId && V === U;
|
|
252
|
+
x(() => {
|
|
253
|
+
e || H(null);
|
|
254
|
+
}, [e]);
|
|
255
|
+
let G = a === "vendor", K = G ? B.vendorDetailsHeading : B.customerDetailsHeading, q = (e) => {
|
|
256
|
+
e || H(null), r(e);
|
|
257
|
+
};
|
|
258
|
+
if (u) return /* @__PURE__ */ w(c, {
|
|
259
|
+
open: e,
|
|
260
|
+
onOpenChange: q,
|
|
261
|
+
title: K,
|
|
262
|
+
labels: { close: B.closeAction },
|
|
263
|
+
children: /* @__PURE__ */ w(g, {
|
|
264
|
+
title: G ? B.notFoundVendorTitle : B.notFoundCustomerTitle,
|
|
265
|
+
description: G ? B.notFoundVendorDescription : B.notFoundCustomerDescription
|
|
266
|
+
})
|
|
267
|
+
});
|
|
268
|
+
let J = s || !o, Y = W ? o?.taxId ?? k : o?.taxIdMasked || o?.taxId || k, X = o?.taxIdHelpText ?? (G ? B.vendorTaxIdHelp : B.customerTaxIdHelp), Z = o ? [
|
|
269
|
+
{
|
|
270
|
+
label: B.rowType,
|
|
271
|
+
value: o.entityTypeLabel ?? k
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
label: B.rowName,
|
|
275
|
+
value: o.name
|
|
276
|
+
},
|
|
277
|
+
{
|
|
278
|
+
label: B.rowEmail,
|
|
279
|
+
value: o.email || k
|
|
280
|
+
},
|
|
281
|
+
...G ? [] : [{
|
|
282
|
+
label: B.rowPaymentReminders,
|
|
283
|
+
value: o.remindersLabel ?? k
|
|
284
|
+
}],
|
|
285
|
+
{
|
|
286
|
+
label: B.rowPhone,
|
|
287
|
+
value: o.phone || k
|
|
288
|
+
},
|
|
289
|
+
{
|
|
290
|
+
label: o.entityType === "individual" ? B.rowTaxIdSsn : B.rowTaxIdEin,
|
|
291
|
+
value: /* @__PURE__ */ T("div", {
|
|
292
|
+
className: "ttw:flex ttw:flex-col ttw:gap-1",
|
|
293
|
+
children: [/* @__PURE__ */ T("div", {
|
|
294
|
+
className: "ttw:flex ttw:items-center ttw:gap-1",
|
|
295
|
+
children: [/* @__PURE__ */ w("span", { children: Y }), o.taxId && /* @__PURE__ */ w(A, {
|
|
296
|
+
label: W ? B.hideTaxId : B.showTaxId,
|
|
297
|
+
onClick: () => H((e) => e === U ? null : U),
|
|
298
|
+
children: w(W ? D : E, {})
|
|
299
|
+
})]
|
|
300
|
+
}), X && /* @__PURE__ */ w("span", {
|
|
301
|
+
className: "ttw:text-sm ttw:font-normal ttw:text-muted-foreground",
|
|
302
|
+
children: X
|
|
303
|
+
})]
|
|
304
|
+
})
|
|
305
|
+
},
|
|
306
|
+
{
|
|
307
|
+
label: B.addressHeading,
|
|
308
|
+
value: o.addressLines.length > 0 ? /* @__PURE__ */ w("address", {
|
|
309
|
+
className: "ttw:flex ttw:flex-col ttw:not-italic",
|
|
310
|
+
children: o.addressLines.map((e) => /* @__PURE__ */ w("span", { children: e }, e))
|
|
311
|
+
}) : /* @__PURE__ */ w("span", {
|
|
312
|
+
className: "ttw:font-normal ttw:text-muted-foreground",
|
|
313
|
+
children: B.noAddress
|
|
314
|
+
})
|
|
315
|
+
}
|
|
316
|
+
] : [];
|
|
317
|
+
return /* @__PURE__ */ w(m, { children: /* @__PURE__ */ w(c, {
|
|
318
|
+
open: e,
|
|
319
|
+
onOpenChange: q,
|
|
320
|
+
title: J ? K : o.name,
|
|
321
|
+
description: J ? void 0 : o.subtitle,
|
|
322
|
+
labels: { close: B.closeAction },
|
|
323
|
+
headerActions: J ? void 0 : /* @__PURE__ */ T(C, { children: [f && /* @__PURE__ */ w(t, {
|
|
324
|
+
type: "button",
|
|
325
|
+
variant: "ghost",
|
|
326
|
+
size: "sm",
|
|
327
|
+
onClick: _,
|
|
328
|
+
children: B.editButton
|
|
329
|
+
}), h && /* @__PURE__ */ w(j, {
|
|
330
|
+
label: B.openActionsMenu,
|
|
331
|
+
itemLabel: G ? B.deleteVendorAction : B.deleteCustomerAction,
|
|
332
|
+
onSelect: y
|
|
333
|
+
})] }),
|
|
334
|
+
primaryAction: R && !J ? /* @__PURE__ */ w(t, {
|
|
335
|
+
type: "button",
|
|
336
|
+
onClick: R,
|
|
337
|
+
children: G ? B.sendPaymentAction : B.issueInvoiceAction
|
|
338
|
+
}) : void 0,
|
|
339
|
+
children: J ? /* @__PURE__ */ w(L, { label: B.loadingTitle }) : /* @__PURE__ */ T("div", {
|
|
340
|
+
className: "ttw:flex ttw:flex-col ttw:gap-6 ttw:py-5",
|
|
341
|
+
children: [
|
|
342
|
+
/* @__PURE__ */ w(N, {
|
|
343
|
+
mode: a,
|
|
344
|
+
summary: o.summary,
|
|
345
|
+
labels: B
|
|
346
|
+
}),
|
|
347
|
+
/* @__PURE__ */ w(F, {
|
|
348
|
+
mode: a,
|
|
349
|
+
documents: o.recentDocuments,
|
|
350
|
+
labels: B,
|
|
351
|
+
onViewAll: P
|
|
352
|
+
}),
|
|
353
|
+
/* @__PURE__ */ T("section", {
|
|
354
|
+
className: "ttw:flex ttw:flex-col ttw:gap-1",
|
|
355
|
+
children: [/* @__PURE__ */ w(l, {
|
|
356
|
+
variant: "subsection",
|
|
357
|
+
level: 3,
|
|
358
|
+
children: K
|
|
359
|
+
}), /* @__PURE__ */ w(n, { items: Z })]
|
|
360
|
+
}),
|
|
361
|
+
G && /* @__PURE__ */ w(I, {
|
|
362
|
+
paymentMethod: o.paymentMethod,
|
|
363
|
+
canEdit: p,
|
|
364
|
+
onAddBankAccount: b,
|
|
365
|
+
onEditBankAccount: O,
|
|
366
|
+
onDeleteBankAccount: M,
|
|
367
|
+
labels: B
|
|
368
|
+
})
|
|
369
|
+
]
|
|
370
|
+
})
|
|
371
|
+
}) });
|
|
372
|
+
}
|
|
373
|
+
export { R as CounterpartDetailsSheet, R as default };
|
|
@@ -6,16 +6,16 @@ import { BankAccountFormSheet as r } from "../../ui/dist/index11.js";
|
|
|
6
6
|
import { ConfirmDeleteDialog as i } from "../../ui/dist/index13.js";
|
|
7
7
|
import "../../ui/dist/index.js";
|
|
8
8
|
import { COUNTERPART_MESSAGE_LABELS_EN as a } from "./lib/labels.js";
|
|
9
|
-
import {
|
|
10
|
-
import { useCounterpartQuery as
|
|
11
|
-
import { useCreateCounterpartBankAccountMutation as
|
|
12
|
-
import { useCounterpartAddressesForRowsQuery as
|
|
9
|
+
import { bankAccountToAchFormValues as o, buildAnalyticsMap as s, buildCounterpartFormTaxIdField as c, buildCounterpartRows as l, counterpartFormBankAccountToCreatePayload as u, counterpartFormBankAccountToUpdatePayload as d, counterpartToFormValues as f, emptyCounterpartFormValues as p, formatMoney as m, getAchInstructions as h, getCounterpartEmail as g, getCounterpartName as _, getPayableAchInstructions as v, hasCounterpartFormErrors as y, hasSelectedText as b, isAchCompatibleBankAccount as x, resolveCounterpartBankAccountWrite as S, validateAchFormValues as C, validateCounterpartForm as w } from "./lib/helpers.js";
|
|
10
|
+
import { useCounterpartQuery as T, useCounterpartsByIdsQuery as E, useCounterpartsQuery as D, useCreateCounterpartMutation as O } from "../../data-access/dist/index3.js";
|
|
11
|
+
import { useCreateCounterpartBankAccountMutation as k, useUpdateCounterpartBankAccountMutation as A } from "../../data-access/dist/index4.js";
|
|
12
|
+
import { useCounterpartAddressesForRowsQuery as j, useCounterpartAddressesQuery as M } from "../../data-access/dist/index5.js";
|
|
13
13
|
import "../../data-access/dist/index.js";
|
|
14
|
-
import
|
|
15
|
-
import { useCounterpartDetails as
|
|
16
|
-
import { usePayableAchInstructions as
|
|
17
|
-
import { useCounterpartForm as
|
|
18
|
-
import { useDeleteController as
|
|
14
|
+
import "./lib/useAddressForm.js";
|
|
15
|
+
import { useCounterpartDetails as N } from "./lib/useCounterpartDetails.js";
|
|
16
|
+
import { usePayableAchInstructions as P } from "./lib/usePayableAchInstructions.js";
|
|
17
|
+
import { useCounterpartForm as F } from "./lib/useCounterpartForm.js";
|
|
18
|
+
import { useDeleteController as I } from "./lib/useDeleteController.js";
|
|
19
19
|
import "./lib/useSubEntityForm.js";
|
|
20
|
-
import { useBankAccountForm as
|
|
21
|
-
export { r as BankAccountFormSheet, a as COUNTERPART_MESSAGE_LABELS_EN, i as ConfirmDeleteDialog, e as CounterpartFormFields, t as CounterpartFormSheet, o as
|
|
20
|
+
import { useBankAccountForm as L } from "./lib/subEntityForms.js";
|
|
21
|
+
export { r as BankAccountFormSheet, a as COUNTERPART_MESSAGE_LABELS_EN, i as ConfirmDeleteDialog, e as CounterpartFormFields, t as CounterpartFormSheet, o as bankAccountToAchFormValues, s as buildAnalyticsMap, c as buildCounterpartFormTaxIdField, l as buildCounterpartRows, u as counterpartFormBankAccountToCreatePayload, d as counterpartFormBankAccountToUpdatePayload, f as counterpartToFormValues, p as emptyCounterpartFormValues, m as formatMoney, h as getAchInstructions, g as getCounterpartEmail, _ as getCounterpartName, v as getPayableAchInstructions, y as hasCounterpartFormErrors, b as hasSelectedText, x as isAchCompatibleBankAccount, S as resolveCounterpartBankAccountWrite, L as useBankAccountForm, j as useCounterpartAddressesForRowsQuery, M as useCounterpartAddressesQuery, N as useCounterpartDetails, F as useCounterpartForm, T as useCounterpartQuery, E as useCounterpartsByIdsQuery, D as useCounterpartsQuery, k as useCreateCounterpartBankAccountMutation, O as useCreateCounterpartMutation, I as useDeleteController, n as useFocusFirstInvalidField, P as usePayableAchInstructions, A as useUpdateCounterpartBankAccountMutation, C as validateAchFormValues, w as validateCounterpartForm };
|
|
@@ -20,7 +20,10 @@ function o(e, t) {
|
|
|
20
20
|
return e / 10 ** a(t);
|
|
21
21
|
}
|
|
22
22
|
function s(t, n = "USD") {
|
|
23
|
-
return e(o(t, n), {
|
|
23
|
+
return e(o(t, n), {
|
|
24
|
+
currencyCode: n,
|
|
25
|
+
includeSpaceAfterCurrencySymbol: !1
|
|
26
|
+
});
|
|
24
27
|
}
|
|
25
28
|
var c = new Intl.DateTimeFormat(void 0, {
|
|
26
29
|
year: "numeric",
|
|
@@ -48,7 +51,7 @@ function p(e) {
|
|
|
48
51
|
for (let n of e ?? []) n.dimension_value && t.set(n.dimension_value, Math.round(n.metric_value));
|
|
49
52
|
return t;
|
|
50
53
|
}
|
|
51
|
-
var m = "
|
|
54
|
+
var m = "—";
|
|
52
55
|
function h({ counterparts: e, addresses: t, billedAmounts: n, dueOrOwedAmounts: r, isBilledAmountLoading: i = !1, isDueOrOwedAmountLoading: a = !1, isBilledAmountError: o = !1, isDueOrOwedAmountError: c = !1 }) {
|
|
53
56
|
return e.map((e) => {
|
|
54
57
|
let l = n?.get(e.id) ?? 0, d = r?.get(e.id) ?? 0, f = l - d, p = i || a, h = o || c, g = u(e);
|
|
@@ -382,11 +385,8 @@ function $(e) {
|
|
|
382
385
|
function ee(e) {
|
|
383
386
|
return K(e);
|
|
384
387
|
}
|
|
385
|
-
function te(
|
|
386
|
-
return G(e, t);
|
|
387
|
-
}
|
|
388
|
-
function ne() {
|
|
388
|
+
function te() {
|
|
389
389
|
let e = globalThis.getSelection?.();
|
|
390
390
|
return !!(e && e.toString().length > 0);
|
|
391
391
|
}
|
|
392
|
-
export { T as addressFormToCreatePayload, E as addressFormToUpdatePayload, w as addressResponseToFormValues, U as bankAccountToAchFormValues, p as buildAnalyticsMap, b as buildBankAccountItems, v as buildCounterpartDetailsView, N as buildCounterpartFormTaxIdField, h as buildCounterpartRows, L as counterpartFormBankAccountToCreatePayload, R as counterpartFormBankAccountToUpdatePayload, j as counterpartFormToCreatePayload, M as counterpartFormToUpdatePayload, O as counterpartToFormValues, H as emptyAchFormValues, D as emptyCounterpartFormValues, l as formatCounterpartDate, s as formatMoney, o as fromMinorUnits, x as getAchInstructions, d as getCounterpartEmail, u as getCounterpartName, S as getPayableAchInstructions, ee as hasAchFormErrors, F as hasAchFormValues, P as hasCounterpartFormAddressValues, I as hasCounterpartFormBankAccountValues, $ as hasCounterpartFormErrors,
|
|
392
|
+
export { T as addressFormToCreatePayload, E as addressFormToUpdatePayload, w as addressResponseToFormValues, U as bankAccountToAchFormValues, p as buildAnalyticsMap, b as buildBankAccountItems, v as buildCounterpartDetailsView, N as buildCounterpartFormTaxIdField, h as buildCounterpartRows, L as counterpartFormBankAccountToCreatePayload, R as counterpartFormBankAccountToUpdatePayload, j as counterpartFormToCreatePayload, M as counterpartFormToUpdatePayload, O as counterpartToFormValues, H as emptyAchFormValues, D as emptyCounterpartFormValues, l as formatCounterpartDate, s as formatMoney, o as fromMinorUnits, x as getAchInstructions, d as getCounterpartEmail, u as getCounterpartName, S as getPayableAchInstructions, ee as hasAchFormErrors, F as hasAchFormValues, P as hasCounterpartFormAddressValues, I as hasCounterpartFormBankAccountValues, $ as hasCounterpartFormErrors, te as hasSelectedText, B as isAchCompatibleBankAccount, V as resolveCounterpartBankAccountWrite, J as validateAchFormValues, Z as validateCounterpartForm, Q as withoutUnchangedContactErrors };
|
|
@@ -14,21 +14,28 @@ var e = {
|
|
|
14
14
|
accountHolderNameRequired: "Account holder name is required",
|
|
15
15
|
routingNumberInvalid: "Enter a valid 9-digit ABA routing number",
|
|
16
16
|
accountNumberInvalid: "Enter a valid account number",
|
|
17
|
-
genericError: "
|
|
18
|
-
amountsUnavailable: "
|
|
17
|
+
genericError: "Couldn't save changes. Try again.",
|
|
18
|
+
amountsUnavailable: "Couldn't load amounts.",
|
|
19
19
|
deleteTitle: "Delete {name}?",
|
|
20
|
-
deleteBankAccountTitle: "
|
|
20
|
+
deleteBankAccountTitle: "Remove payment method “{account}”?",
|
|
21
|
+
deleteBankAccountConfirm: "Remove",
|
|
21
22
|
deleteCounterpartMessage: "This record and its contacts, bank accounts, and tax ID will be permanently removed. You can't undo this action.",
|
|
22
23
|
deleteBankAccountMessage: "This removes these payment instructions from the vendor. The vendor will not be deleted. You can't undo this action.",
|
|
23
24
|
createSucceeded: "{name} has been added to the list.",
|
|
24
25
|
updateSucceeded: "{name} has been updated.",
|
|
26
|
+
customerAdded: "Customer added.",
|
|
27
|
+
vendorAdded: "Vendor added.",
|
|
28
|
+
customerUpdated: "Customer updated.",
|
|
29
|
+
vendorUpdated: "Vendor updated.",
|
|
25
30
|
addressAdded: "Address has been added.",
|
|
26
31
|
addressUpdated: "Address has been updated.",
|
|
27
|
-
bankAccountAdded: "
|
|
28
|
-
bankAccountUpdated: "
|
|
29
|
-
counterpartDeleted: "
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
32
|
+
bankAccountAdded: "Payment method added.",
|
|
33
|
+
bankAccountUpdated: "Payment method updated.",
|
|
34
|
+
counterpartDeleted: "Deleted.",
|
|
35
|
+
customerDeleted: "Customer deleted.",
|
|
36
|
+
vendorDeleted: "Vendor deleted.",
|
|
37
|
+
bankAccountDeleted: "Payment method removed.",
|
|
38
|
+
deleteCounterpartFailed: "Couldn't delete. Try again.",
|
|
39
|
+
deleteBankAccountFailed: "Couldn't remove payment method."
|
|
33
40
|
};
|
|
34
41
|
export { e as COUNTERPART_MESSAGE_LABELS_EN };
|
|
@@ -2,72 +2,8 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
"use client";
|
|
4
4
|
"use client";
|
|
5
|
-
import { toast as e } from "../../../../../../../packages/shared-ui-shadcn/dist/index.js";
|
|
6
|
-
import { extractApiErrorMessage as t } from "../../../../util/dist/lib/apiErrors.js";
|
|
7
5
|
import "../../../../util/dist/index.js";
|
|
8
6
|
import "../../../../ui/dist/index.js";
|
|
9
|
-
import
|
|
10
|
-
import { useCreateCounterpartAddressMutation as o, useUpdateCounterpartAddressMutation as s } from "../../../data-access/dist/index5.js";
|
|
7
|
+
import "./helpers.js";
|
|
11
8
|
import "../../../data-access/dist/index.js";
|
|
12
|
-
import
|
|
13
|
-
// ../../libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/useAddressForm.js
|
|
14
|
-
function u({ selectedId: u, primaryAddress: d, messages: f }) {
|
|
15
|
-
let p = o(), m = s(), [h, g] = l(!1), [_, v] = l(() => ({
|
|
16
|
-
line1: "",
|
|
17
|
-
line2: "",
|
|
18
|
-
city: "",
|
|
19
|
-
state: "",
|
|
20
|
-
postalCode: ""
|
|
21
|
-
})), [y, b] = l({}), [x, S] = l(), C = c(() => {
|
|
22
|
-
d && (v(i(d)), b({}), S(void 0), g(!0));
|
|
23
|
-
}, [d]), w = c(() => {
|
|
24
|
-
v({
|
|
25
|
-
line1: "",
|
|
26
|
-
line2: "",
|
|
27
|
-
city: "",
|
|
28
|
-
state: "",
|
|
29
|
-
postalCode: ""
|
|
30
|
-
}), b({}), S(void 0), g(!0);
|
|
31
|
-
}, []), T = c(() => g(!1), []), E = c(async () => {
|
|
32
|
-
if (!u) return;
|
|
33
|
-
let i = a(_, f);
|
|
34
|
-
if (Object.values(i).some(Boolean)) b(i);
|
|
35
|
-
else {
|
|
36
|
-
b({});
|
|
37
|
-
try {
|
|
38
|
-
d ? (await m.mutateAsync({
|
|
39
|
-
path: {
|
|
40
|
-
counterpart_id: u,
|
|
41
|
-
address_id: d.id
|
|
42
|
-
},
|
|
43
|
-
body: r(_)
|
|
44
|
-
}), e.success(f.addressUpdated)) : (await p.mutateAsync({
|
|
45
|
-
path: { counterpart_id: u },
|
|
46
|
-
body: n(_)
|
|
47
|
-
}), e.success(f.addressAdded)), g(!1);
|
|
48
|
-
} catch (e) {
|
|
49
|
-
S(t(e) ?? f.genericError);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}, [
|
|
53
|
-
u,
|
|
54
|
-
d,
|
|
55
|
-
_,
|
|
56
|
-
f,
|
|
57
|
-
p,
|
|
58
|
-
m
|
|
59
|
-
]);
|
|
60
|
-
return {
|
|
61
|
-
open: h,
|
|
62
|
-
values: _,
|
|
63
|
-
setValues: v,
|
|
64
|
-
errors: y,
|
|
65
|
-
formError: x,
|
|
66
|
-
isPending: p.isPending || m.isPending,
|
|
67
|
-
openCreate: w,
|
|
68
|
-
openEdit: C,
|
|
69
|
-
close: T,
|
|
70
|
-
submit: E
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
export { u as useAddressForm };
|
|
9
|
+
import "react";
|