@tesouro/embedded-components-react 0.5.200 → 0.5.202

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 (45) hide show
  1. package/dist/index.d.ts +20 -0
  2. package/dist/index.js +1 -1
  3. package/dist/lib/ReceivablesWidget.d.ts +20 -0
  4. package/dist/lib/ReceivablesWidget.js +1 -1
  5. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index.js +6 -6
  6. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index2.js +24 -18
  7. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index4.js +65 -2
  8. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index.js +1 -1
  9. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index10.js +174 -234
  10. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index11.js +32 -65
  11. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index12.js +143 -102
  12. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index13.js +48 -221
  13. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index14.js +303 -0
  14. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index15.js +75 -0
  15. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index16.js +114 -0
  16. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index17.js +237 -0
  17. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index4.js +14 -1
  18. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index5.js +30 -215
  19. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index6.js +211 -370
  20. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index7.js +64 -62
  21. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index8.js +409 -187
  22. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index9.js +73 -40
  23. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index.js +10 -9
  24. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index10.js +0 -9
  25. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index11.js +4 -1
  26. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index12.js +10 -263
  27. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index13.js +1 -72
  28. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index14.js +241 -363
  29. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index15.js +66 -100
  30. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index16.js +406 -76
  31. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index17.js +92 -330
  32. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index18.js +93 -0
  33. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index19.js +344 -0
  34. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index2.js +10 -1
  35. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index4.js +157 -20
  36. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index5.js +24 -1
  37. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index6.js +1 -3
  38. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index7.js +3 -18
  39. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index8.js +2 -0
  40. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index9.js +18 -4
  41. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +37 -37
  42. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js +54 -54
  43. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/sdk.gen.js +115 -94
  44. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  45. package/package.json +1 -1
@@ -0,0 +1,303 @@
1
+ "use client";
2
+ "use client";
3
+ "use client";
4
+ "use client";
5
+ import { getStateOptions as e } from "../../../shared/util/dist/lib/usStates.js";
6
+ import { extractApiErrorMessage as t } from "../../../shared/util/dist/lib/apiErrors.js";
7
+ import { usePaymentTermsQuery as n } from "../../../shared/data-access/dist/lib/reference-data/usePaymentTermsQuery.js";
8
+ import { COUNTERPART_MESSAGE_LABELS_EN as r } from "../../../shared/counterpart-management/feature/dist/lib/labels.js";
9
+ import { useCounterpartAddressesQuery as i } from "../../../shared/counterpart-management/data-access/dist/index7.js";
10
+ import { useCounterpartForm as a } from "../../../shared/counterpart-management/feature/dist/lib/useCounterpartForm.js";
11
+ import "../../../shared/counterpart-management/feature/dist/index.js";
12
+ import { buildLineItemControls as ee, commitLineItemField as te, commitTaxRateInput as ne, convertPriceInput as re, createLineItem as o, getCurrencySymbol as ie, isBlankLineItem as ae, lineItemFromProduct as oe, reconcileMeasureUnits as se, sanitizeLineItemPatch as ce, sanitizeTaxRateInput as le, stepLineItemQuantity as ue, stripBlankLineItems as de, summarizeLineItemErrors as fe, toSheetLineItem as pe, validateLineItems as me } from "./index6.js";
13
+ import { buildReceivableAttachmentsView as he } from "./index7.js";
14
+ import { createEmptyReceivableFormValues as s, getPaymentTermOptions as ge, hasReceivableFormErrors as _e, receivableFormValuesToCreatePayload as ve, receivableFormValuesToLineItemChanges as ye, receivableFormValuesToUpdatePayload as be, receivableToFormValues as xe, validateReceivableForm as Se } from "./index8.js";
15
+ import { useCreateReceivableMutation as c, useUpdateReceivableMutation as Ce } from "../../data-access/dist/index6.js";
16
+ import "../../data-access/dist/index.js";
17
+ import { useReceivableAttachmentUploads as we } from "./index12.js";
18
+ import { calculateInvoiceTotals as Te } from "./index13.js";
19
+ import { getCurrencyOptions as Ee } from "../../../shared/product-catalog/feature/dist/lib/helpers.js";
20
+ import { useMeasureUnitsQuery as De } from "../../../shared/product-catalog/data-access/dist/index9.js";
21
+ import { useMeasureUnits as l } from "../../../shared/product-catalog/feature/dist/lib/useMeasureUnits.js";
22
+ import "../../../shared/product-catalog/feature/dist/index.js";
23
+ import { useCallback as u, useEffect as d, useMemo as f, useRef as p, useState as m } from "react";
24
+ //#region ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index14.js
25
+ function h({ messages: h, counterpartMessageLabels: g, onCreated: _ }) {
26
+ let v = c(), y = Ce(), b = p([]), x = p(""), S = n(), [C, w] = m(!1), [T, E] = m("create"), [D, O] = m(), [k, A] = m(() => s()), [Oe, j] = m({}), [M, ke] = m("none"), N = l(), P = De(), F = P.data?.data, { unitNamesById: I } = N, [Ae, L] = m(), [R, z] = m(!1), B = p(!1), V = f(() => e(), []), je = f(() => ({
27
+ ...r,
28
+ ...g
29
+ }), [g]), H = i(k.customerId), Me = H.data?.data?.[0], U = H.data?.data?.[0]?.id, Ne = u((e) => {
30
+ A((t) => ({
31
+ ...t,
32
+ attachments: e(t.attachments)
33
+ }));
34
+ }, []), W = we({
35
+ attachments: k.attachments,
36
+ setAttachments: Ne,
37
+ receivableId: D
38
+ }), { reset: G, discardUploads: K, commitRemovals: q } = W, Pe = k.type === "invoice" ? he({
39
+ attachments: k.attachments,
40
+ pendingUploads: W.pendingUploads,
41
+ isCountLimitReached: W.isCountLimitReached,
42
+ isRecurring: !1,
43
+ messages: h
44
+ }) : void 0, Fe = u((e) => {
45
+ A((t) => ({
46
+ ...t,
47
+ customerId: e ?? ""
48
+ }));
49
+ }, []), J = a({
50
+ view: M,
51
+ setView: ke,
52
+ selectedId: k.customerId || void 0,
53
+ setSelectedId: Fe,
54
+ messages: je,
55
+ counterpartType: "customer",
56
+ counterpart: void 0,
57
+ primaryAddress: Me
58
+ }), Y = u(() => {
59
+ b.current = [], L(void 0), E("create"), O(void 0), A(s()), j({}), z(!1), G();
60
+ }, [G]), Ie = u((e = "invoice") => {
61
+ b.current = [], L(void 0), E("create"), O(void 0), A({
62
+ ...s(),
63
+ type: e
64
+ }), j({}), G(), z(!1), w(!0);
65
+ }, [G]), Le = u((e) => {
66
+ e.type !== "credit_note" && (b.current = e.line_items, x.current = e.currency, L(void 0), E("edit"), O(e.id), A(xe(e, F)), j({}), z(!1), G(), w(!0));
67
+ }, [G, F]);
68
+ d(() => {
69
+ F?.length && A((e) => {
70
+ let t = se(e.lineItems, F);
71
+ return t === e.lineItems ? e : {
72
+ ...e,
73
+ lineItems: t
74
+ };
75
+ });
76
+ }, [F]);
77
+ let X = W.isUploading, Re = u(() => {
78
+ X || (K(), w(!1), j({}));
79
+ }, [K, X]), ze = u((e) => {
80
+ let t = e.taxRate === void 0 ? e : {
81
+ ...e,
82
+ taxRate: le(e.taxRate)
83
+ }, { currency: n, type: r } = t;
84
+ if (r !== void 0 && r !== "invoice" && K(), n === void 0) {
85
+ A((e) => ({
86
+ ...e,
87
+ ...t
88
+ }));
89
+ return;
90
+ }
91
+ B.current = !0, A((e) => e.currency === n ? {
92
+ ...e,
93
+ ...t
94
+ } : {
95
+ ...e,
96
+ ...t,
97
+ lineItems: e.lineItems.map((t) => ({
98
+ ...t,
99
+ price: re(t.price, e.currency, n)
100
+ }))
101
+ });
102
+ }, [K]), Be = u(() => {
103
+ A((e) => {
104
+ let t = ne(e.taxRate);
105
+ return t === e.taxRate ? e : {
106
+ ...e,
107
+ taxRate: t
108
+ };
109
+ });
110
+ }, []), Z = u((e, t) => {
111
+ let n = me(e, {
112
+ currency: t,
113
+ messages: h
114
+ });
115
+ j((e) => ({
116
+ ...e,
117
+ lineItems: n,
118
+ lineItemsSummary: fe(n)
119
+ }));
120
+ }, [h]), Q = u((e, { validate: t }) => {
121
+ t && (B.current = !0), A((t) => ({
122
+ ...t,
123
+ lineItems: e(t.lineItems)
124
+ }));
125
+ }, []);
126
+ d(() => {
127
+ B.current && (B.current = !1, Z(k.lineItems, k.currency));
128
+ }, [
129
+ Z,
130
+ k.currency,
131
+ k.lineItems
132
+ ]);
133
+ let Ve = u((e, t) => {
134
+ let { unit: n, ...r } = t, i = ce(r);
135
+ i.name !== void 0 && (i.productId = ""), n !== void 0 && (i.measureUnitId = n, i.measureUnitName = ""), Q((t) => t.map((t) => t.id === e ? {
136
+ ...t,
137
+ ...i
138
+ } : t), { validate: R });
139
+ }, [Q, R]), He = u((e, t) => {
140
+ Q((n) => n.map((n) => n.id === e ? {
141
+ ...n,
142
+ ...oe({
143
+ product: t,
144
+ currency: k.currency,
145
+ unitNamesById: I
146
+ })
147
+ } : n), { validate: !0 });
148
+ }, [
149
+ Q,
150
+ I,
151
+ k.currency
152
+ ]), $ = u((e, t) => {
153
+ t && Q((n) => t.kind === "remove" ? n.filter((t) => t.id !== e) : n.map((n) => n.id === e ? {
154
+ ...n,
155
+ ...t.patch
156
+ } : n), { validate: !0 });
157
+ }, [Q]), Ue = u((e, t) => {
158
+ let n = k.lineItems.find((t) => t.id === e);
159
+ n && $(e, te({
160
+ lineItem: n,
161
+ field: t,
162
+ rowCount: k.lineItems.length,
163
+ currency: k.currency
164
+ }));
165
+ }, [
166
+ $,
167
+ k.currency,
168
+ k.lineItems
169
+ ]), We = u((e, t) => {
170
+ let n = k.lineItems.find((t) => t.id === e);
171
+ n && $(e, ue({
172
+ lineItem: n,
173
+ step: t,
174
+ rowCount: k.lineItems.length
175
+ }));
176
+ }, [$, k.lineItems]), Ge = u(() => {
177
+ let e = o(k.currency);
178
+ L(e.id), A((t) => ({
179
+ ...t,
180
+ lineItems: [...t.lineItems, e]
181
+ }));
182
+ }, [k.currency]), Ke = u((e) => {
183
+ Q((t) => t.length <= 1 ? t : t.filter((t) => t.id !== e), { validate: !0 });
184
+ }, [Q]), qe = u(async () => {
185
+ if (X) return;
186
+ if (P.isLoading) {
187
+ j({ form: h.lineItemsLoading });
188
+ return;
189
+ }
190
+ let e = de(k.lineItems), n = e.length === k.lineItems.length ? k : {
191
+ ...k,
192
+ lineItems: e
193
+ };
194
+ n !== k && A(n);
195
+ let r = Se({
196
+ values: n,
197
+ billingAddressId: U,
198
+ messages: h
199
+ });
200
+ if (_e(r)) {
201
+ j(r), z(!0);
202
+ return;
203
+ }
204
+ j({});
205
+ try {
206
+ if (T === "edit" && D) {
207
+ let e = { receivable_id: D };
208
+ await y.mutateAsync({
209
+ path: e,
210
+ body: be({
211
+ values: n,
212
+ billingAddressId: U ?? "",
213
+ lineItemChanges: ye({
214
+ values: n,
215
+ originalLineItems: b.current,
216
+ originalCurrency: x.current,
217
+ unitNamesById: I,
218
+ units: F
219
+ })
220
+ })
221
+ }), q(), w(!1), Y();
222
+ return;
223
+ }
224
+ let e = await v.mutateAsync({ body: ve({
225
+ values: n,
226
+ billingAddressId: U ?? "",
227
+ unitNamesById: I
228
+ }) });
229
+ w(!1), Y(), e?.id && _?.(e.id, e.type);
230
+ } catch (e) {
231
+ j({ form: t(e) ?? h.genericError });
232
+ }
233
+ }, [
234
+ U,
235
+ q,
236
+ v,
237
+ D,
238
+ X,
239
+ h,
240
+ T,
241
+ _,
242
+ Y,
243
+ F,
244
+ I,
245
+ P.isLoading,
246
+ y,
247
+ k
248
+ ]), Je = f(() => ({
249
+ ...k,
250
+ lineItems: k.lineItems.map(pe)
251
+ }), [k]), Ye = f(() => ee(k.lineItems), [k.lineItems]), Xe = f(() => Te({
252
+ lineItems: k.lineItems.filter((e) => !ae(e)),
253
+ currency: k.currency,
254
+ taxRate: Number(k.taxRate) || void 0
255
+ }), [
256
+ k.currency,
257
+ k.lineItems,
258
+ k.taxRate
259
+ ]);
260
+ return {
261
+ open: C,
262
+ setOpen: w,
263
+ mode: T,
264
+ values: k,
265
+ sheetValues: Je,
266
+ errors: Oe,
267
+ setValues: A,
268
+ updateValues: ze,
269
+ commitTaxRate: Be,
270
+ updateLineItem: Ve,
271
+ selectProduct: He,
272
+ commitLineItem: Ue,
273
+ stepLineItem: We,
274
+ addLineItem: Ge,
275
+ removeLineItem: Ke,
276
+ attachmentsView: Pe,
277
+ attachmentsUploading: W.isUploading,
278
+ saveDisabled: P.isLoading || W.isUploading,
279
+ selectAttachmentFiles: W.selectFiles,
280
+ setAttachmentIncludeInEmail: W.setIncludeInEmail,
281
+ removeAttachment: W.remove,
282
+ autoFocusLineItemId: Ae,
283
+ lineItemUnitOptions: N.unitOptions,
284
+ lineItemsLoading: P.isLoading,
285
+ lineItemControls: Ye,
286
+ totals: Xe,
287
+ currencySymbol: ie(k.currency),
288
+ isSubmitting: v.isPending || y.isPending,
289
+ currencyOptions: Ee(k.currency),
290
+ paymentTermsOptions: ge(S.data?.data),
291
+ openCreate: Ie,
292
+ openEdit: Le,
293
+ close: Re,
294
+ submit: qe,
295
+ units: N,
296
+ counterpartView: M,
297
+ counterpartForm: J,
298
+ stateOptions: V,
299
+ openCounterpartCreate: J.openCreate
300
+ };
301
+ }
302
+ //#endregion
303
+ export { h as useReceivableForm };
@@ -0,0 +1,75 @@
1
+ "use client";
2
+ "use client";
3
+ "use client";
4
+ "use client";
5
+ import { buildReceivableRows as e, statusFilterOptions as t, typeForTab as n } from "./index8.js";
6
+ import { useReceivablesQuery as r } from "../../data-access/dist/index9.js";
7
+ import "../../data-access/dist/index.js";
8
+ import { useCallback as i, useEffect as a, useMemo as o, useState as s } from "react";
9
+ //#region ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index15.js
10
+ var c = [];
11
+ function l({ activeTab: l, messages: d }) {
12
+ let [f, p] = s([]), [m, h] = s(10), [g, _] = s(), [v, y] = s(""), [b, x] = s(""), [S, C] = s("all");
13
+ a(() => {
14
+ _(void 0), C("all");
15
+ }, [l]), a(() => {
16
+ let e = setTimeout(() => {
17
+ x(v), _(void 0);
18
+ }, 300);
19
+ return () => clearTimeout(e);
20
+ }, [v]);
21
+ let w = f[0]?.id, T = w ? u[w] : void 0, E = f[0] ? f[0].desc ? "desc" : "asc" : void 0, D = r({
22
+ type: n(l),
23
+ limit: m,
24
+ pagination_token: g,
25
+ search_text: b || void 0,
26
+ status: S === "all" ? void 0 : S,
27
+ ...T ? {
28
+ sort: T,
29
+ order: E
30
+ } : {}
31
+ }), O = D.data?.data ?? c, k = o(() => new Map(O.map((e) => [e.id, e])), [O]), A = i((e) => k.get(e), [k]), j = o(() => e({
32
+ receivables: O,
33
+ messages: d
34
+ }), [d, O]), M = !!b || S !== "all", N = i((e) => {
35
+ let t = typeof e == "function" ? e(f) : e;
36
+ p(t), _(void 0);
37
+ }, [f]), P = i((e) => {
38
+ h(e), _(void 0);
39
+ }, []), F = i((e) => {
40
+ C(e), _(void 0);
41
+ }, []), I = i(() => _(D.data?.next_pagination_token ?? void 0), [D.data?.next_pagination_token]), L = i(() => _(D.data?.prev_pagination_token ?? void 0), [D.data?.prev_pagination_token]), R = i(() => {
42
+ D.refetch();
43
+ }, [D]);
44
+ return {
45
+ rows: j,
46
+ isLoading: D.isLoading,
47
+ isError: D.isError,
48
+ sorting: f,
49
+ onSortingChange: N,
50
+ pageSize: m,
51
+ onPageSizeChange: P,
52
+ hasNextPage: !!D.data?.next_pagination_token,
53
+ hasPrevPage: !!D.data?.prev_pagination_token,
54
+ onNextPage: I,
55
+ onPrevPage: L,
56
+ searchValue: v,
57
+ onSearchChange: y,
58
+ statusFilter: S,
59
+ statusOptions: t(),
60
+ onStatusFilterChange: F,
61
+ isFiltering: M,
62
+ onRetry: R,
63
+ getReceivableById: A
64
+ };
65
+ }
66
+ var u = {
67
+ documentLabel: "document_id",
68
+ customerLabel: "counterpart_name",
69
+ status: "status",
70
+ issueDateLabel: "issue_date",
71
+ dueDateLabel: "due_date",
72
+ totalLabel: "total_amount"
73
+ };
74
+ //#endregion
75
+ export { l as useReceivablesTable };
@@ -0,0 +1,114 @@
1
+ "use client";
2
+ "use client";
3
+ "use client";
4
+ "use client";
5
+ import { useAnalyticsTrack as e } from "../../../shared/feature/dist/lib/analytics/hooks.js";
6
+ import "../../../shared/feature/dist/index.js";
7
+ import { ReceivablesWidgetAnalyticsEvent as t } from "./index2.js";
8
+ import { coerceEnabledTabs as n, resolveInitialTab as r, tabForType as i, typeForTab as a } from "./index8.js";
9
+ import { RECEIVABLE_MESSAGE_LABELS_EN as o } from "./index9.js";
10
+ import { useReceivableActions as s } from "./index10.js";
11
+ import { useReceivableDetails as c } from "./index11.js";
12
+ import { hasSelectedText as l } from "../../../shared/product-catalog/feature/dist/lib/helpers.js";
13
+ import "../../../shared/product-catalog/feature/dist/index.js";
14
+ import { useReceivableForm as u } from "./index14.js";
15
+ import { useReceivablesTable as d } from "./index15.js";
16
+ import { useCallback as f, useEffect as p, useMemo as m, useState as h } from "react";
17
+ //#region ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index16.js
18
+ function g({ counterpartMessageLabels: g, defaultTab: _, enabledTabs: v, messageLabels: y, onReceivableCreated: b, onReceivableOpened: x }) {
19
+ let S = e();
20
+ p(() => {
21
+ S(t.Mounted);
22
+ }, [S]);
23
+ let C = m(() => ({
24
+ ...o,
25
+ ...y
26
+ }), [y]), w = m(() => n(v), [v]), [T, E] = h(() => r({
27
+ defaultTab: _,
28
+ enabledTabs: w
29
+ })), [D, O] = h(), [k, A] = h(!1);
30
+ p(() => {
31
+ w.includes(T) || E(r({
32
+ defaultTab: _,
33
+ enabledTabs: w
34
+ }));
35
+ }, [
36
+ T,
37
+ _,
38
+ w
39
+ ]);
40
+ let j = f((e, t) => {
41
+ E(i(t)), O(e), A(!0), b?.(e, t);
42
+ }, [b]), M = d({
43
+ activeTab: T,
44
+ messages: C
45
+ }), N = c({
46
+ selectedReceivableId: D,
47
+ enabled: k,
48
+ messages: C
49
+ }), P = u({
50
+ messages: C,
51
+ counterpartMessageLabels: g,
52
+ onCreated: j
53
+ }), F = f(() => {
54
+ let e = a(T);
55
+ P.openCreate(e === "quote" ? "quote" : "invoice");
56
+ }, [T, P.openCreate]), I = s({
57
+ selectedReceivable: N.receivable,
58
+ messages: C,
59
+ onCreated: j,
60
+ onDeleted: (e) => {
61
+ e === D && (O(void 0), A(!1));
62
+ }
63
+ }), L = f((e) => {
64
+ l() || (O(e.id), A(!0), x?.(e.id, e.type));
65
+ }, [x]);
66
+ return {
67
+ activeTab: T,
68
+ enabledTabs: w,
69
+ setActiveTab: E,
70
+ table: M,
71
+ details: N,
72
+ detailsOpen: k,
73
+ closeDetails: f(() => {
74
+ A(!1), O(void 0);
75
+ }, []),
76
+ form: P,
77
+ openCreate: F,
78
+ actions: I,
79
+ handleRowClick: L,
80
+ handleActionClick: f((e, t) => {
81
+ let n = M.getReceivableById(t.id);
82
+ if (e === "edit") {
83
+ if (n) {
84
+ P.openEdit(n);
85
+ return;
86
+ }
87
+ O(t.id), A(!0);
88
+ return;
89
+ }
90
+ O(t.id), I.openAction(e, t, n ?? null);
91
+ }, [
92
+ I,
93
+ P.openEdit,
94
+ M.getReceivableById
95
+ ]),
96
+ handleDetailsActionClick: f((e, t) => {
97
+ if (e === "edit") {
98
+ N.receivable && (P.openEdit(N.receivable), A(!1));
99
+ return;
100
+ }
101
+ I.openAction(e, {
102
+ id: t.id,
103
+ title: t.title,
104
+ type: t.type
105
+ }, N.receivable ?? null);
106
+ }, [
107
+ I,
108
+ N.receivable,
109
+ P.openEdit
110
+ ])
111
+ };
112
+ }
113
+ //#endregion
114
+ export { g as useReceivablesWidget };