@tesouro/embedded-components-react 0.5.217 → 0.5.221

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 (21) hide show
  1. package/dist/index.css +3 -0
  2. package/dist/index.d.ts +1 -0
  3. package/dist/index.js +1 -1
  4. package/dist/lib/ReceivablesWidget.d.ts +1 -0
  5. package/dist/lib/ReceivablesWidget.js +1 -1
  6. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index.js +2 -2
  7. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index12.js +22 -1
  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/index24.js +39 -70
  10. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index25.js +34 -106
  11. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index26.js +75 -307
  12. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index27.js +121 -0
  13. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index28.js +317 -0
  14. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index.js +15 -15
  15. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index13.js +6 -6
  16. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index33.js +50 -335
  17. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index34.js +353 -0
  18. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index4.js +8 -7
  19. package/dist/libs/tesouro-embedded-components-react/settings-widget/feature/dist/index6.js +1 -1
  20. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  21. package/package.json +1 -1
@@ -2,313 +2,81 @@
2
2
  "use client";
3
3
  "use client";
4
4
  "use client";
5
- import { Calendar as e, Skeleton as t } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
6
- import { EmbeddedToaster as n } from "../../../shared/ui/dist/lib/EmbeddedToaster.js";
7
- import "../../../shared/ui/dist/index.js";
8
- import { useAnalyticsTrack as r } from "../../../shared/feature/dist/lib/analytics/hooks.js";
9
- import { WidgetProvider as i } from "../../../shared/feature/dist/lib/WidgetProvider/WidgetProvider.js";
10
- import "../../../shared/feature/dist/index.js";
11
- import { CounterpartFormSheet as a } from "../../../shared/counterpart-management/ui/dist/index9.js";
12
- import { CounterpartSelector as o } from "../../../shared/counterpart-management/feature/dist/lib/CounterpartSelector.js";
13
- import "../../../shared/counterpart-management/feature/dist/index.js";
14
- import { ReceivablesWidgetAnalyticsEvent as s, WIDGET_NAME as c } from "./index2.js";
15
- import { PAGE_SIZE_OPTIONS as l } from "./index4.js";
16
- import { ReceivableActionDialog as u } from "../../ui/dist/index5.js";
17
- import { ReceivableBankAccountSection as d } from "../../ui/dist/index6.js";
18
- import { ReceivableBillingSection as f } from "../../ui/dist/index11.js";
19
- import { ReceivableDetailsSheet as p } from "../../ui/dist/index22.js";
20
- import { ReceivableFormSheet as m } from "../../ui/dist/index25.js";
21
- import { ReceivablePaymentDialog as h } from "../../ui/dist/index26.js";
22
- import { ReceivableRecurrenceEmailDialog as g } from "../../ui/dist/index27.js";
23
- import { ReceivableRecurrenceSection as _ } from "../../ui/dist/index29.js";
24
- import { ReceivableRemindersSection as v } from "../../ui/dist/index31.js";
25
- import { ReceivableSendDialog as y } from "../../ui/dist/index32.js";
26
- import { ReceivablesScreen as b } from "../../ui/dist/index33.js";
27
- import "../../ui/dist/index.js";
28
- import { ReceivableAttachmentsSection as x } from "./index5.js";
29
- import { MeasureUnitsManagerContainer as S } from "../../../shared/product-catalog/feature/dist/lib/MeasureUnitsManagerContainer.js";
30
- import { ProductSelector as C } from "../../../shared/product-catalog/feature/dist/lib/ProductSelector.js";
31
- import "../../../shared/product-catalog/feature/dist/index.js";
32
- import { useReceivablesWidget as w } from "./index25.js";
33
- import { useEffect as T, useId as E, useState as D } from "react";
34
- import { Fragment as O, jsx as k, jsxs as A } from "react/jsx-runtime";
5
+ import { buildReceivableRows as e, statusFilterOptions as t, typeForTab as n } from "./index12.js";
6
+ import { useReceivablesQuery as r } from "../../data-access/dist/index10.js";
7
+ import "../../data-access/dist/index.js";
8
+ import { useReceivableStatusCards as i } from "./index25.js";
9
+ import { useCallback as a, useEffect as o, useMemo as s, useState as c } from "react";
35
10
  //#region ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index26.js
36
- function j({ counterpartFormLabels: i, counterpartMessageLabels: c, defaultTab: j, detailsLabels: M, embeddedBankName: N, enabledTabs: P, formLabels: F, measureUnitDeleteLabels: I, measureUnitsLabels: L, messageLabels: R, onReceivableCreated: z, onReceivableOpened: B, onTemplateSettingsClick: V, pageSizeOptions: H = l, paymentLabels: U, productMessageLabels: W, screenLabels: G, sendLabels: K, actionLabels: q }) {
37
- let J = r();
38
- T(() => {
39
- J(s.Mounted);
40
- }, [J]);
41
- let Y = w({
42
- counterpartMessageLabels: c,
43
- defaultTab: j,
44
- embeddedBankName: N,
45
- enabledTabs: P,
46
- messageLabels: R,
47
- onReceivableCreated: z,
48
- onReceivableOpened: B
49
- }), [X, Z] = D(!1), Q = E(), $ = E(), ee = E(), te = E();
50
- return /* @__PURE__ */ A(O, { children: [
51
- /* @__PURE__ */ k(n, {}),
52
- /* @__PURE__ */ k(b, {
53
- rows: Y.table.rows,
54
- activeTab: Y.activeTab,
55
- enabledTabs: Y.enabledTabs,
56
- onTabChange: Y.setActiveTab,
57
- isLoading: Y.table.isLoading,
58
- isError: Y.table.isError,
59
- sorting: Y.table.sorting,
60
- onSortingChange: Y.table.onSortingChange,
61
- pageSize: Y.table.pageSize,
62
- onPageSizeChange: Y.table.onPageSizeChange,
63
- pageSizeOptions: H,
64
- hasNextPage: Y.table.hasNextPage,
65
- hasPrevPage: Y.table.hasPrevPage,
66
- onNextPage: Y.table.onNextPage,
67
- onPrevPage: Y.table.onPrevPage,
68
- searchValue: Y.table.searchValue,
69
- onSearchChange: Y.table.onSearchChange,
70
- statusFilter: Y.table.statusFilter,
71
- statusOptions: Y.table.statusOptions,
72
- onStatusFilterChange: Y.table.onStatusFilterChange,
73
- isFiltering: Y.table.isFiltering,
74
- onCreateClick: Y.openCreate,
75
- onTemplateSettingsClick: V,
76
- onRowClick: Y.handleRowClick,
77
- onActionClick: Y.handleActionClick,
78
- onRetry: Y.table.onRetry,
79
- labels: G
80
- }),
81
- /* @__PURE__ */ k(m, {
82
- open: Y.form.open,
83
- onOpenChange: (e) => {
84
- e || Y.form.close();
85
- },
86
- mode: Y.form.mode,
87
- values: Y.form.sheetValues,
88
- errors: Y.form.errors,
89
- currencyOptions: Y.form.currencyOptions,
90
- unitOptions: Y.form.lineItemUnitOptions,
91
- currencySymbol: Y.form.currencySymbol,
92
- lineItemControls: Y.form.lineItemControls,
93
- autoFocusLineItemId: Y.form.autoFocusLineItemId,
94
- lineItemsLoading: Y.form.lineItemsLoading,
95
- inProgress: Y.form.isSubmitting,
96
- customerSelector: /* @__PURE__ */ k(o, {
97
- mode: "customer",
98
- value: Y.form.values.customerId || void 0,
99
- onValueChange: (e) => Y.form.updateValues({ customerId: e }),
100
- onCreateClick: Y.form.openCounterpartCreate
101
- }),
102
- renderProductSelector: (e, t) => /* @__PURE__ */ k(C, {
103
- ...t,
104
- inputValue: e.name,
105
- selectedProductId: Y.form.values.lineItems.find((t) => t.id === e.id)?.productId || void 0,
106
- currency: Y.form.values.currency,
107
- maxLength: 100,
108
- onInputValueChange: (t) => Y.form.updateLineItem(e.id, { name: t }),
109
- onProductSelect: (t) => Y.form.selectProduct(e.id, t)
110
- }),
111
- onChange: Y.form.updateValues,
112
- onLineItemChange: Y.form.updateLineItem,
113
- onLineItemCommit: Y.form.commitLineItem,
114
- onLineItemQuantityStep: Y.form.stepLineItem,
115
- onTaxRateCommit: Y.form.commitTaxRate,
116
- onDiscountFocus: Y.form.focusDiscount,
117
- onDiscountCommit: Y.form.commitDiscount,
118
- totals: Y.form.totalsView,
119
- onManageUnits: () => Z(!0),
120
- onAddLineItem: Y.form.addLineItem,
121
- onRemoveLineItem: Y.form.removeLineItem,
122
- showDueDateField: Y.form.showDueDateField,
123
- billingSection: Y.form.showBillingSection && /* @__PURE__ */ k(f, {
124
- idPrefix: Q,
125
- paymentTerms: Y.form.paymentTerms.view,
126
- paymentTermsError: Y.form.errors.paymentTermsId,
127
- disabled: Y.form.isSubmitting,
128
- onPaymentTermsChange: Y.form.paymentTerms.select,
129
- onCustomDatePickerOpenChange: Y.form.paymentTerms.changeCustomDatePickerOpen,
130
- customDateCalendar: /* @__PURE__ */ k(e, {
131
- mode: "single",
132
- captionLayout: "dropdown",
133
- ...Y.form.paymentTerms.calendar,
134
- onSelect: Y.form.paymentTerms.selectCustomDate
135
- }),
136
- recurrenceSection: Y.form.showRecurrenceSection && (Y.form.recurrenceLoading ? /* @__PURE__ */ k(t, { className: "ttw:h-9 ttw:w-full" }) : /* @__PURE__ */ k(_, {
137
- idPrefix: $,
138
- view: Y.form.recurrence.view,
139
- disabled: Y.form.isSubmitting,
140
- onFrequencyChange: Y.form.recurrence.changeFrequency,
141
- onMonthDayChange: Y.form.recurrence.changeMonthDay,
142
- onWeekdayChange: Y.form.recurrence.changeWeekday,
143
- onStartDateChange: Y.form.recurrence.changeStartDate,
144
- onEndModeChange: Y.form.recurrence.changeEndMode,
145
- onEndDateChange: Y.form.recurrence.changeEndDate,
146
- onMaxOccurrencesChange: Y.form.recurrence.changeMaxOccurrences,
147
- onCreationModeChange: Y.form.recurrence.changeCreationMode,
148
- onSetUpEmailClick: Y.form.recurrence.setUpEmail,
149
- emailDialog: /* @__PURE__ */ k(g, {
150
- idPrefix: $,
151
- view: Y.form.recurrence.emailView,
152
- onOpenChange: Y.form.recurrence.changeEmailOpen,
153
- onChange: Y.form.recurrence.changeEmail,
154
- onSave: Y.form.recurrence.saveEmail,
155
- labels: F
156
- }),
157
- labels: F
158
- })),
159
- labels: F
160
- }),
161
- remindersSection: Y.form.reminders.view && /* @__PURE__ */ k(v, {
162
- idPrefix: te,
163
- view: Y.form.reminders.view,
164
- onToggle: Y.form.reminders.toggle,
165
- onPaymentReminderSelect: Y.form.reminders.selectPaymentReminder,
166
- onOverdueReminderSelect: Y.form.reminders.selectOverdueReminder,
167
- onBeforeDueInputChange: Y.form.reminders.changeBeforeDueInput,
168
- onBeforeDueSave: Y.form.reminders.saveBeforeDue,
169
- onOverdueTermChange: Y.form.reminders.changeOverdueTerm,
170
- onOverdueAddTerm: Y.form.reminders.addOverdueTerm,
171
- onOverdueClear: Y.form.reminders.clearOverdueTerms,
172
- onOverdueSave: Y.form.reminders.saveOverdue,
173
- labels: F
174
- }),
175
- bankAccountSection: /* @__PURE__ */ k(d, {
176
- idPrefix: ee,
177
- view: Y.form.bankAccount.view,
178
- disabled: Y.form.isSubmitting,
179
- onAccountSelect: Y.form.bankAccount.selectAccount,
180
- onAddAccountClick: Y.form.bankAccount.openAddAccount,
181
- onFormChange: Y.form.bankAccount.updateAccountForm,
182
- onFormSave: Y.form.bankAccount.saveAccount,
183
- onFormCancel: Y.form.bankAccount.cancelAddAccount,
184
- labels: F
185
- }),
186
- attachmentsSection: Y.form.attachmentsView && /* @__PURE__ */ k(x, {
187
- view: Y.form.attachmentsView,
188
- disabled: Y.form.isSubmitting,
189
- onFilesSelect: Y.form.selectAttachmentFiles,
190
- onIncludeInEmailChange: Y.form.setAttachmentIncludeInEmail,
191
- onRemove: Y.form.removeAttachment,
192
- labels: F
193
- }),
194
- cancelDisabled: Y.form.attachmentsUploading,
195
- saveDisabled: Y.form.saveDisabled,
196
- submitLabel: Y.form.submitLabel,
197
- onSubmit: Y.form.submit,
198
- onCancel: Y.form.close,
199
- labels: F
200
- }),
201
- /* @__PURE__ */ k(p, {
202
- open: Y.detailsOpen,
203
- onOpenChange: (e) => {
204
- e || Y.closeDetails();
205
- },
206
- details: Y.details.detailsView,
207
- isLoading: Y.details.isLoading,
208
- isError: Y.details.isError,
209
- onActionClick: Y.handleDetailsActionClick,
210
- onClose: Y.closeDetails,
211
- labels: M
212
- }),
213
- /* @__PURE__ */ k(y, {
214
- open: Y.actions.sendOpen,
215
- onOpenChange: (e) => {
216
- e || Y.actions.closeSend();
217
- },
218
- values: Y.actions.sendValues,
219
- errors: Y.actions.sendErrors,
220
- inProgress: Y.actions.sendInProgress,
221
- onChange: (e) => Y.actions.setSendValues((t) => ({
222
- ...t,
223
- ...e
224
- })),
225
- onSubmit: Y.actions.submitSend,
226
- onCancel: Y.actions.closeSend,
227
- labels: K
228
- }),
229
- /* @__PURE__ */ k(h, {
230
- open: Y.actions.paymentOpen,
231
- onOpenChange: (e) => {
232
- e || Y.actions.closePayment();
233
- },
234
- values: Y.actions.paymentValues,
235
- errors: Y.actions.paymentErrors,
236
- inProgress: Y.actions.paymentInProgress,
237
- onChange: (e) => Y.actions.setPaymentValues((t) => ({
238
- ...t,
239
- ...e
240
- })),
241
- onSubmit: Y.actions.submitPayment,
242
- onCancel: Y.actions.closePayment,
243
- labels: U
244
- }),
245
- Y.actions.actionDialog && /* @__PURE__ */ k(u, {
246
- open: !!Y.actions.actionTarget,
247
- onOpenChange: (e) => {
248
- e || Y.actions.closeAction();
249
- },
250
- title: Y.actions.actionDialog.title,
251
- description: Y.actions.actionDialog.description,
252
- confirmLabel: Y.actions.actionDialog.confirmLabel,
253
- destructive: Y.actions.actionDialog.destructive,
254
- error: Y.actions.actionError,
255
- inProgress: Y.actions.actionInProgress,
256
- onConfirm: Y.actions.confirmAction,
257
- onCancel: Y.actions.closeAction,
258
- labels: q
259
- }),
260
- /* @__PURE__ */ k(a, {
261
- open: Y.form.counterpartView === "create",
262
- onOpenChange: (e) => {
263
- e || Y.form.counterpartForm.close();
264
- },
265
- mode: "create",
266
- values: Y.form.counterpartForm.values,
267
- errors: Y.form.counterpartForm.errors,
268
- stateOptions: Y.form.stateOptions,
269
- inProgress: Y.form.counterpartForm.isSubmitting,
270
- onChange: (e) => Y.form.counterpartForm.setValues((t) => ({
271
- ...t,
272
- ...e
273
- })),
274
- onAddressChange: (e) => Y.form.counterpartForm.setValues((t) => ({
275
- ...t,
276
- address: {
277
- ...t.address,
278
- ...e
279
- }
280
- })),
281
- onSubmit: Y.form.counterpartForm.submit,
282
- onCancel: Y.form.counterpartForm.close,
283
- labels: i
284
- }),
285
- /* @__PURE__ */ k(S, {
286
- open: X,
287
- onClose: () => Z(!1),
288
- managerLabels: L,
289
- deleteLabels: I,
290
- messageLabels: W
291
- })
292
- ] });
293
- }
294
- function M({ baseUrl: e, widgetToken: t, organizationId: n, configClient: r, gatewayRouting: a, linkComponent: o, implementation: s, uiFramework: l, errorFallback: u, onError: d, analytics: f, disclosuresAcceptance: p, providerLabels: m, ...h }) {
295
- return /* @__PURE__ */ k(i, {
296
- widgetName: c,
297
- baseUrl: e,
298
- widgetToken: t,
299
- organizationId: n,
300
- configClient: r,
301
- gatewayRouting: a,
302
- linkComponent: o,
303
- implementation: s,
304
- uiFramework: l,
305
- errorFallback: u,
306
- onError: d,
307
- analytics: f,
308
- disclosuresAcceptance: p,
309
- providerLabels: m,
310
- children: /* @__PURE__ */ k(j, { ...h })
311
- });
11
+ var l = [];
12
+ function u({ activeTab: u, messages: f, statusLabels: p }) {
13
+ let [m, h] = c([]), [g, _] = c(10), [v, y] = c(), [b, x] = c(""), [S, C] = c(""), [w, T] = c("all");
14
+ o(() => {
15
+ y(void 0), T("all");
16
+ }, [u]), o(() => {
17
+ let e = setTimeout(() => {
18
+ C(b), y(void 0);
19
+ }, 300);
20
+ return () => clearTimeout(e);
21
+ }, [b]);
22
+ let E = m[0]?.id, D = E ? d[E] : void 0, O = m[0] ? m[0].desc ? "desc" : "asc" : void 0, k = r({
23
+ type: n(u),
24
+ limit: g,
25
+ pagination_token: v,
26
+ search_text: S || void 0,
27
+ status: w === "all" ? void 0 : w,
28
+ ...D ? {
29
+ sort: D,
30
+ order: O
31
+ } : {}
32
+ }), A = i({
33
+ enabled: u === "invoices",
34
+ statusFilter: w,
35
+ messages: f,
36
+ statusLabels: p
37
+ }), j = k.data?.data ?? l, M = s(() => new Map(j.map((e) => [e.id, e])), [j]), N = a((e) => M.get(e), [M]), P = s(() => e({
38
+ receivables: j,
39
+ messages: f
40
+ }), [f, j]), F = !!S || w !== "all", I = a((e) => {
41
+ let t = typeof e == "function" ? e(m) : e;
42
+ h(t), y(void 0);
43
+ }, [m]), L = a((e) => {
44
+ _(e), y(void 0);
45
+ }, []), R = a((e) => {
46
+ T(e), y(void 0);
47
+ }, []), z = a(() => y(k.data?.next_pagination_token ?? void 0), [k.data?.next_pagination_token]), B = a(() => y(k.data?.prev_pagination_token ?? void 0), [k.data?.prev_pagination_token]), V = a(() => {
48
+ k.refetch();
49
+ }, [k]);
50
+ return {
51
+ rows: P,
52
+ isLoading: k.isLoading,
53
+ isError: k.isError,
54
+ sorting: m,
55
+ onSortingChange: I,
56
+ pageSize: g,
57
+ onPageSizeChange: L,
58
+ hasNextPage: !!k.data?.next_pagination_token,
59
+ hasPrevPage: !!k.data?.prev_pagination_token,
60
+ onNextPage: z,
61
+ onPrevPage: B,
62
+ searchValue: b,
63
+ onSearchChange: x,
64
+ statusFilter: w,
65
+ statusOptions: t(),
66
+ onStatusFilterChange: R,
67
+ statusCards: A,
68
+ isFiltering: F,
69
+ onRetry: V,
70
+ getReceivableById: N
71
+ };
312
72
  }
73
+ var d = {
74
+ documentLabel: "document_id",
75
+ customerLabel: "counterpart_name",
76
+ status: "status",
77
+ issueDateLabel: "issue_date",
78
+ dueDateLabel: "due_date",
79
+ totalLabel: "total_amount"
80
+ };
313
81
  //#endregion
314
- export { M as ReceivablesWidget, M as default };
82
+ export { u as useReceivablesTable };
@@ -0,0 +1,121 @@
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 { RECEIVABLE_STATUS_BADGE_LABELS_EN as n } from "../../ui/dist/index4.js";
9
+ import "../../ui/dist/index.js";
10
+ import { coerceEnabledTabs as r, resolveInitialTab as i, tabForType as a, typeForTab as o } from "./index12.js";
11
+ import { RECEIVABLE_MESSAGE_LABELS_EN as s } from "./index13.js";
12
+ import { useReceivableActions as c } from "./index15.js";
13
+ import { useReceivableDetails as l } from "./index16.js";
14
+ import { hasSelectedText as u } from "../../../shared/product-catalog/feature/dist/lib/helpers.js";
15
+ import "../../../shared/product-catalog/feature/dist/index.js";
16
+ import { useReceivableForm as d } from "./index23.js";
17
+ import { useReceivablesTable as f } from "./index26.js";
18
+ import { useCallback as p, useEffect as m, useMemo as h, useState as g } from "react";
19
+ //#region ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index27.js
20
+ function _({ counterpartMessageLabels: _, defaultTab: v, embeddedBankName: y, enabledTabs: b, messageLabels: x, onReceivableCreated: S, onReceivableOpened: C, screenLabels: w }) {
21
+ let T = e();
22
+ m(() => {
23
+ T(t.Mounted);
24
+ }, [T]);
25
+ let E = h(() => ({
26
+ ...s,
27
+ ...x
28
+ }), [x]), D = w?.statusBadge, O = h(() => ({
29
+ ...n,
30
+ ...D
31
+ }), [D]), k = h(() => r(b), [b]), [A, j] = g(() => i({
32
+ defaultTab: v,
33
+ enabledTabs: k
34
+ })), [M, N] = g(), [P, F] = g(!1);
35
+ m(() => {
36
+ k.includes(A) || j(i({
37
+ defaultTab: v,
38
+ enabledTabs: k
39
+ }));
40
+ }, [
41
+ A,
42
+ v,
43
+ k
44
+ ]);
45
+ let I = p((e, t) => {
46
+ j(a(t)), N(e), F(!0), S?.(e, t);
47
+ }, [S]), L = f({
48
+ activeTab: A,
49
+ messages: E,
50
+ statusLabels: O
51
+ }), R = l({
52
+ selectedReceivableId: M,
53
+ enabled: P,
54
+ messages: E
55
+ }), z = d({
56
+ messages: E,
57
+ counterpartMessageLabels: _,
58
+ embeddedBankName: y,
59
+ onCreated: I
60
+ }), B = p(() => {
61
+ let e = o(A);
62
+ z.openCreate(e === "quote" ? "quote" : "invoice");
63
+ }, [A, z.openCreate]), V = c({
64
+ selectedReceivable: R.receivable,
65
+ messages: E,
66
+ onCreated: I,
67
+ onDeleted: (e) => {
68
+ e === M && (N(void 0), F(!1));
69
+ }
70
+ }), H = p((e) => {
71
+ u() || (N(e.id), F(!0), C?.(e.id, e.type));
72
+ }, [C]);
73
+ return {
74
+ activeTab: A,
75
+ enabledTabs: k,
76
+ setActiveTab: j,
77
+ table: L,
78
+ details: R,
79
+ detailsOpen: P,
80
+ closeDetails: p(() => {
81
+ F(!1), N(void 0);
82
+ }, []),
83
+ form: z,
84
+ openCreate: B,
85
+ actions: V,
86
+ handleRowClick: H,
87
+ handleActionClick: p((e, t) => {
88
+ let n = L.getReceivableById(t.id);
89
+ if (e === "edit") {
90
+ if (n) {
91
+ z.openEdit(n);
92
+ return;
93
+ }
94
+ N(t.id), F(!0);
95
+ return;
96
+ }
97
+ N(t.id), V.openAction(e, t, n ?? null);
98
+ }, [
99
+ V,
100
+ z.openEdit,
101
+ L.getReceivableById
102
+ ]),
103
+ handleDetailsActionClick: p((e, t) => {
104
+ if (e === "edit") {
105
+ R.receivable && (z.openEdit(R.receivable), F(!1));
106
+ return;
107
+ }
108
+ V.openAction(e, {
109
+ id: t.id,
110
+ title: t.title,
111
+ type: t.type
112
+ }, R.receivable ?? null);
113
+ }, [
114
+ V,
115
+ R.receivable,
116
+ z.openEdit
117
+ ])
118
+ };
119
+ }
120
+ //#endregion
121
+ export { _ as useReceivablesWidget };