@tesouro/embedded-components-react 0.5.203 → 0.5.204
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/dist/index.css +9 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +1 -1
- package/dist/lib/ProductsWidget.d.ts +4 -0
- package/dist/lib/ProductsWidget.js +1 -1
- package/dist/lib/ReceivablesWidget.d.ts +2 -0
- package/dist/libs/tesouro-embedded-components-react/products-widget/feature/dist/index.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/products-widget/feature/dist/index10.js +136 -0
- package/dist/libs/tesouro-embedded-components-react/products-widget/feature/dist/index4.js +5 -30
- package/dist/libs/tesouro-embedded-components-react/products-widget/feature/dist/index5.js +9 -19
- package/dist/libs/tesouro-embedded-components-react/products-widget/feature/dist/index6.js +22 -54
- package/dist/libs/tesouro-embedded-components-react/products-widget/feature/dist/index7.js +14 -40
- package/dist/libs/tesouro-embedded-components-react/products-widget/feature/dist/index8.js +57 -118
- package/dist/libs/tesouro-embedded-components-react/products-widget/feature/dist/index9.js +72 -0
- package/dist/libs/tesouro-embedded-components-react/products-widget/ui/dist/index2.js +2 -0
- package/dist/libs/tesouro-embedded-components-react/products-widget/ui/dist/index4.js +97 -93
- package/dist/libs/tesouro-embedded-components-react/products-widget/ui/dist/index5.js +35 -32
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/data-access/dist/index10.js +8 -8
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/data-access/dist/index4.js +8 -8
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/data-access/dist/index9.js +8 -8
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/feature/dist/lib/MeasureUnitsManagerContainer.js +79 -70
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/feature/dist/lib/useMeasureUnits.js +4 -4
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/ui/dist/index2.js +1 -0
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/ui/dist/index4.js +109 -107
- package/package.json +1 -1
package/dist/index.css
CHANGED
|
@@ -1245,6 +1245,9 @@
|
|
|
1245
1245
|
.ttw\:w-\[15\%\] {
|
|
1246
1246
|
width: 15%;
|
|
1247
1247
|
}
|
|
1248
|
+
.ttw\:w-\[20\%\] {
|
|
1249
|
+
width: 20%;
|
|
1250
|
+
}
|
|
1248
1251
|
.ttw\:w-\[20rem\] {
|
|
1249
1252
|
width: 20rem;
|
|
1250
1253
|
}
|
|
@@ -1254,6 +1257,9 @@
|
|
|
1254
1257
|
.ttw\:w-\[27\.5rem\] {
|
|
1255
1258
|
width: 27.5rem;
|
|
1256
1259
|
}
|
|
1260
|
+
.ttw\:w-\[30\%\] {
|
|
1261
|
+
width: 30%;
|
|
1262
|
+
}
|
|
1257
1263
|
.ttw\:w-\[32rem\] {
|
|
1258
1264
|
width: 32rem;
|
|
1259
1265
|
}
|
|
@@ -1263,6 +1269,9 @@
|
|
|
1263
1269
|
.ttw\:w-\[42px\] {
|
|
1264
1270
|
width: 42px;
|
|
1265
1271
|
}
|
|
1272
|
+
.ttw\:w-\[50\%\] {
|
|
1273
|
+
width: 50%;
|
|
1274
|
+
}
|
|
1266
1275
|
.ttw\:w-\[55\%\] {
|
|
1267
1276
|
width: 55%;
|
|
1268
1277
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -4784,6 +4784,8 @@ interface MeasureUnitsManagerLabels {
|
|
|
4784
4784
|
saveAction: string;
|
|
4785
4785
|
cancelAction: string;
|
|
4786
4786
|
emptyText: string;
|
|
4787
|
+
/** Accessible label for the per-row actions-menu trigger button. */
|
|
4788
|
+
moreActionsLabel: string;
|
|
4787
4789
|
}
|
|
4788
4790
|
interface MeasureUnitDeleteDialogLabels {
|
|
4789
4791
|
/** `{name}` is replaced with the unit name. */
|
|
@@ -5271,6 +5273,8 @@ interface ProductsScreenLabels {
|
|
|
5271
5273
|
errorTitle: string;
|
|
5272
5274
|
errorDescription: string;
|
|
5273
5275
|
errorRetry: string;
|
|
5276
|
+
accessRestrictedTitle: string;
|
|
5277
|
+
accessRestrictedDescription: string;
|
|
5274
5278
|
/**
|
|
5275
5279
|
* A focused row's accessible name. The row itself is the control that
|
|
5276
5280
|
* opens it, so the name says what Enter does. A template so locales own the
|
package/dist/index.js
CHANGED
|
@@ -66,7 +66,7 @@ import { MARKETING_WIDGET_LABELS_EN as oe } from "./libs/tesouro-embedded-compon
|
|
|
66
66
|
import { MarketingBenefitIcon as se } from "./libs/tesouro-embedded-components-react/marketing-widget/ui/dist/index3.js";
|
|
67
67
|
import { MarketingWidget as ce } from "./libs/tesouro-embedded-components-react/marketing-widget/feature/dist/index7.js";
|
|
68
68
|
import "./lib/MarketingWidget.js";
|
|
69
|
-
import { ProductsWidget as le } from "./libs/tesouro-embedded-components-react/products-widget/feature/dist/
|
|
69
|
+
import { ProductsWidget as le } from "./libs/tesouro-embedded-components-react/products-widget/feature/dist/index10.js";
|
|
70
70
|
import "./lib/ProductsWidget.js";
|
|
71
71
|
import "./lib/ReceivablesWidget.js";
|
|
72
72
|
import "./lib/SettingsWidget.js";
|
|
@@ -676,6 +676,8 @@ interface MeasureUnitsManagerLabels {
|
|
|
676
676
|
saveAction: string;
|
|
677
677
|
cancelAction: string;
|
|
678
678
|
emptyText: string;
|
|
679
|
+
/** Accessible label for the per-row actions-menu trigger button. */
|
|
680
|
+
moreActionsLabel: string;
|
|
679
681
|
}
|
|
680
682
|
interface MeasureUnitDeleteDialogLabels {
|
|
681
683
|
/** `{name}` is replaced with the unit name. */
|
|
@@ -744,6 +746,8 @@ interface ProductsScreenLabels {
|
|
|
744
746
|
errorTitle: string;
|
|
745
747
|
errorDescription: string;
|
|
746
748
|
errorRetry: string;
|
|
749
|
+
accessRestrictedTitle: string;
|
|
750
|
+
accessRestrictedDescription: string;
|
|
747
751
|
/**
|
|
748
752
|
* A focused row's accessible name. The row itself is the control that
|
|
749
753
|
* opens it, so the name says what Enter does. A template so locales own the
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { ProductsWidget as e } from "../libs/tesouro-embedded-components-react/products-widget/feature/dist/
|
|
1
|
+
import { ProductsWidget as e } from "../libs/tesouro-embedded-components-react/products-widget/feature/dist/index10.js";
|
|
2
2
|
import "../libs/tesouro-embedded-components-react/products-widget/feature/dist/index.js";
|
|
3
3
|
export { e as ProductsWidget };
|
|
@@ -828,6 +828,8 @@ interface MeasureUnitsManagerLabels {
|
|
|
828
828
|
saveAction: string;
|
|
829
829
|
cancelAction: string;
|
|
830
830
|
emptyText: string;
|
|
831
|
+
/** Accessible label for the per-row actions-menu trigger button. */
|
|
832
|
+
moreActionsLabel: string;
|
|
831
833
|
}
|
|
832
834
|
interface MeasureUnitDeleteDialogLabels {
|
|
833
835
|
/** `{name}` is replaced with the unit name. */
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ProductsWidget as e } from "./
|
|
1
|
+
import { ProductsWidget as e } from "./index10.js";
|
|
2
2
|
export { e as ProductsWidget };
|
|
@@ -0,0 +1,136 @@
|
|
|
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 { WidgetProvider as t } from "../../../shared/feature/dist/lib/WidgetProvider/WidgetProvider.js";
|
|
7
|
+
import "../../../shared/feature/dist/index.js";
|
|
8
|
+
import { ProductFormSheet as n } from "../../../shared/product-catalog/ui/dist/index3.js";
|
|
9
|
+
import { MeasureUnitsManagerContainer as r } from "../../../shared/product-catalog/feature/dist/lib/MeasureUnitsManagerContainer.js";
|
|
10
|
+
import "../../../shared/product-catalog/feature/dist/index.js";
|
|
11
|
+
import { ProductsWidgetAnalyticsEvent as i, WIDGET_NAME as a } from "./index2.js";
|
|
12
|
+
import { PAGE_SIZE_OPTIONS as o } from "./index3.js";
|
|
13
|
+
import { productsWidgetTestIds as s } from "./index4.js";
|
|
14
|
+
import { useProductsWidget as c } from "./index9.js";
|
|
15
|
+
import { ProductsScreen as l } from "../../ui/dist/index4.js";
|
|
16
|
+
import { ProductDetailsSheet as u } from "../../ui/dist/index5.js";
|
|
17
|
+
import { ProductDeleteDialog as d } from "../../ui/dist/index6.js";
|
|
18
|
+
import "../../ui/dist/index.js";
|
|
19
|
+
import { useEffect as f } from "react";
|
|
20
|
+
import { Fragment as p, jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
21
|
+
//#region ../../libs/tesouro-embedded-components-react/products-widget/feature/dist/index10.js
|
|
22
|
+
function g({ pageSizeOptions: t = o, screenLabels: a, formLabels: g, detailsLabels: _, deleteLabels: v, measureUnitsLabels: y, measureUnitDeleteLabels: b, messageLabels: x }) {
|
|
23
|
+
let S = e();
|
|
24
|
+
f(() => {
|
|
25
|
+
S(i.Mounted);
|
|
26
|
+
}, [S]);
|
|
27
|
+
let { view: C, units: w, table: T, details: E, form: D, del: O, permissions: k, isPermissionLoading: A, isTableLoading: j, hasInitError: M, refetchWidgetInit: N, measureUnitsOpen: P, actionsSuspended: F, handleRowClick: I, openMeasureUnits: L, closeMeasureUnits: R, submitForm: z, confirmDelete: B } = c({ messageLabels: x });
|
|
28
|
+
return /* @__PURE__ */ h(p, { children: [
|
|
29
|
+
/* @__PURE__ */ m(l, {
|
|
30
|
+
products: T.rows,
|
|
31
|
+
isLoading: j,
|
|
32
|
+
isError: M || T.isError,
|
|
33
|
+
sorting: T.sorting,
|
|
34
|
+
onSortingChange: T.onSortingChange,
|
|
35
|
+
pageSize: T.pageSize,
|
|
36
|
+
onPageSizeChange: T.onPageSizeChange,
|
|
37
|
+
pageSizeOptions: t,
|
|
38
|
+
hasNextPage: T.hasNextPage,
|
|
39
|
+
hasPrevPage: T.hasPrevPage,
|
|
40
|
+
onNextPage: T.onNextPage,
|
|
41
|
+
onPrevPage: T.onPrevPage,
|
|
42
|
+
searchValue: T.searchValue,
|
|
43
|
+
onSearchChange: T.onSearchChange,
|
|
44
|
+
typeFilter: T.typeFilter,
|
|
45
|
+
onTypeFilterChange: T.onTypeFilterChange,
|
|
46
|
+
unitFilter: T.unitFilter,
|
|
47
|
+
onUnitFilterChange: T.onUnitFilterChange,
|
|
48
|
+
unitOptions: w.unitOptions,
|
|
49
|
+
isFiltering: T.isFiltering,
|
|
50
|
+
canCreate: k.canCreate,
|
|
51
|
+
canManageUnits: k.canCreate,
|
|
52
|
+
isAccessRestricted: !A && !M && !k.canRead,
|
|
53
|
+
onCreateClick: D.openCreate,
|
|
54
|
+
onManageUnitsClick: L,
|
|
55
|
+
onRowClick: I,
|
|
56
|
+
onRetry: M ? N : T.onRetry,
|
|
57
|
+
labels: a,
|
|
58
|
+
testIds: {
|
|
59
|
+
empty: s.empty,
|
|
60
|
+
accessRestricted: s.accessRestricted
|
|
61
|
+
}
|
|
62
|
+
}),
|
|
63
|
+
/* @__PURE__ */ m(n, {
|
|
64
|
+
open: C === "create" || C === "edit",
|
|
65
|
+
onOpenChange: (e) => {
|
|
66
|
+
e || D.close();
|
|
67
|
+
},
|
|
68
|
+
mode: C === "edit" ? "edit" : "create",
|
|
69
|
+
values: D.values,
|
|
70
|
+
errors: D.errors,
|
|
71
|
+
unitOptions: w.unitOptions,
|
|
72
|
+
currencyOptions: D.currencyOptions,
|
|
73
|
+
inProgress: D.isSubmitting || F,
|
|
74
|
+
onChange: (e) => D.setValues((t) => ({
|
|
75
|
+
...t,
|
|
76
|
+
...e
|
|
77
|
+
})),
|
|
78
|
+
onManageUnits: L,
|
|
79
|
+
onSubmit: z,
|
|
80
|
+
onCancel: D.close,
|
|
81
|
+
labels: g
|
|
82
|
+
}),
|
|
83
|
+
/* @__PURE__ */ m(u, {
|
|
84
|
+
open: C === "details",
|
|
85
|
+
onOpenChange: (e) => {
|
|
86
|
+
e || D.close();
|
|
87
|
+
},
|
|
88
|
+
product: E.detailsView,
|
|
89
|
+
isLoading: E.isLoading,
|
|
90
|
+
isError: E.isError,
|
|
91
|
+
onEdit: D.openEdit,
|
|
92
|
+
onDelete: O.requestDelete,
|
|
93
|
+
canEdit: k.canUpdate,
|
|
94
|
+
canDelete: k.canDelete,
|
|
95
|
+
labels: _
|
|
96
|
+
}),
|
|
97
|
+
/* @__PURE__ */ m(d, {
|
|
98
|
+
open: O.open,
|
|
99
|
+
onOpenChange: O.onOpenChange,
|
|
100
|
+
productName: E.productName,
|
|
101
|
+
isDeleting: O.isDeleting || F,
|
|
102
|
+
onConfirm: B,
|
|
103
|
+
onCancel: O.cancel,
|
|
104
|
+
labels: v
|
|
105
|
+
}),
|
|
106
|
+
/* @__PURE__ */ m(r, {
|
|
107
|
+
open: P,
|
|
108
|
+
onClose: R,
|
|
109
|
+
suspended: F,
|
|
110
|
+
managerLabels: y,
|
|
111
|
+
deleteLabels: b,
|
|
112
|
+
messageLabels: x
|
|
113
|
+
})
|
|
114
|
+
] });
|
|
115
|
+
}
|
|
116
|
+
function _({ baseUrl: e, widgetToken: n, organizationId: r, configClient: i, gatewayRouting: o, linkComponent: s, implementation: c, uiFramework: l, errorFallback: u, onError: d, analytics: f, disclosuresAcceptance: p, providerLabels: h, ..._ }) {
|
|
117
|
+
return /* @__PURE__ */ m(t, {
|
|
118
|
+
widgetName: a,
|
|
119
|
+
baseUrl: e,
|
|
120
|
+
widgetToken: n,
|
|
121
|
+
organizationId: r,
|
|
122
|
+
configClient: i,
|
|
123
|
+
gatewayRouting: o,
|
|
124
|
+
linkComponent: s,
|
|
125
|
+
implementation: c,
|
|
126
|
+
uiFramework: l,
|
|
127
|
+
errorFallback: u,
|
|
128
|
+
onError: d,
|
|
129
|
+
analytics: f,
|
|
130
|
+
disclosuresAcceptance: p,
|
|
131
|
+
providerLabels: h,
|
|
132
|
+
children: /* @__PURE__ */ m(g, { ..._ })
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
//#endregion
|
|
136
|
+
export { _ as ProductsWidget, _ as default };
|
|
@@ -1,32 +1,7 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
"use client";
|
|
3
|
-
"use client";
|
|
4
|
-
"use client";
|
|
5
|
-
import { useDeleteProductMutation as e } from "../../../shared/product-catalog/data-access/dist/index8.js";
|
|
6
|
-
import "../../../shared/product-catalog/feature/dist/index.js";
|
|
7
|
-
import { useCallback as t, useState as n } from "react";
|
|
8
1
|
//#region ../../libs/tesouro-embedded-components-react/products-widget/feature/dist/index4.js
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
return {
|
|
14
|
-
open: s,
|
|
15
|
-
requestDelete: l,
|
|
16
|
-
onOpenChange: u,
|
|
17
|
-
confirm: t(async () => {
|
|
18
|
-
if (r) try {
|
|
19
|
-
await o.mutateAsync({ path: { product_id: r } }), c(!1), a("none"), i(void 0);
|
|
20
|
-
} catch {}
|
|
21
|
-
}, [
|
|
22
|
-
r,
|
|
23
|
-
o,
|
|
24
|
-
a,
|
|
25
|
-
i
|
|
26
|
-
]),
|
|
27
|
-
cancel: d,
|
|
28
|
-
isDeleting: o.isPending
|
|
29
|
-
};
|
|
30
|
-
}
|
|
2
|
+
var e = {
|
|
3
|
+
empty: "products-widget-empty-state",
|
|
4
|
+
accessRestricted: "products-widget-access-restricted"
|
|
5
|
+
};
|
|
31
6
|
//#endregion
|
|
32
|
-
export {
|
|
7
|
+
export { e as productsWidgetTestIds };
|
|
@@ -1,24 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
"use client";
|
|
4
|
-
"use client";
|
|
5
|
-
import { buildProductDetailsView as e } from "../../../shared/product-catalog/feature/dist/lib/helpers.js";
|
|
6
|
-
import { useProductQuery as t } from "../../../shared/product-catalog/data-access/dist/index4.js";
|
|
7
|
-
import "../../../shared/product-catalog/feature/dist/index.js";
|
|
8
|
-
import { useMemo as n } from "react";
|
|
1
|
+
import { Scope as e } from "../../../shared/data-access/dist/lib/scopes.js";
|
|
2
|
+
import "../../../shared/data-access/dist/index.js";
|
|
9
3
|
//#region ../../libs/tesouro-embedded-components-react/products-widget/feature/dist/index5.js
|
|
10
|
-
function
|
|
11
|
-
let
|
|
12
|
-
product: a.data,
|
|
13
|
-
unitNamesById: i
|
|
14
|
-
}) : void 0, [a.data, i]);
|
|
4
|
+
function t(t) {
|
|
5
|
+
let n = new Set(t ?? []), r = n.has(e.InvoiceReadOrg), i = n.has(e.InvoiceWriteOrg);
|
|
15
6
|
return {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
productName: a.data?.name ?? ""
|
|
7
|
+
canRead: r,
|
|
8
|
+
canCreate: i,
|
|
9
|
+
canUpdate: i,
|
|
10
|
+
canDelete: i
|
|
21
11
|
};
|
|
22
12
|
}
|
|
23
13
|
//#endregion
|
|
24
|
-
export {
|
|
14
|
+
export { t as getProductPermissions };
|
|
@@ -2,63 +2,31 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
"use client";
|
|
4
4
|
"use client";
|
|
5
|
-
import {
|
|
6
|
-
import { useProductsQuery as t } from "../../../shared/product-catalog/data-access/dist/index2.js";
|
|
5
|
+
import { useDeleteProductMutation as e } from "../../../shared/product-catalog/data-access/dist/index8.js";
|
|
7
6
|
import "../../../shared/product-catalog/feature/dist/index.js";
|
|
8
|
-
import { useCallback as
|
|
7
|
+
import { useCallback as t, useState as n } from "react";
|
|
9
8
|
//#region ../../libs/tesouro-embedded-components-react/products-widget/feature/dist/index6.js
|
|
10
|
-
function
|
|
11
|
-
let
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
g(p), f(void 0);
|
|
15
|
-
}, 400);
|
|
16
|
-
return () => clearTimeout(e);
|
|
17
|
-
}, [p]);
|
|
18
|
-
let x = s[0]?.id === "name" ? "name" : void 0, S = s[0] ? s[0].desc ? "desc" : "asc" : void 0, C = t({
|
|
19
|
-
...x ? {
|
|
20
|
-
sort: x,
|
|
21
|
-
order: S
|
|
22
|
-
} : {},
|
|
23
|
-
limit: l,
|
|
24
|
-
pagination_token: d,
|
|
25
|
-
name__icontains: h || void 0,
|
|
26
|
-
type: _ === "all" ? void 0 : _,
|
|
27
|
-
measure_unit_id: y === "all" ? void 0 : y
|
|
28
|
-
}), w = i(() => e({
|
|
29
|
-
products: C.data?.data ?? [],
|
|
30
|
-
unitNamesById: o
|
|
31
|
-
}), [C.data, o]), T = !!h || _ !== "all" || y !== "all", E = n((e) => {
|
|
32
|
-
let t = typeof e == "function" ? e(s) : e;
|
|
33
|
-
c(t), f(void 0);
|
|
34
|
-
}, [s]), D = n((e) => {
|
|
35
|
-
u(e), f(void 0);
|
|
36
|
-
}, []), O = n(() => f(C.data?.next_pagination_token ?? void 0), [C.data?.next_pagination_token]), k = n(() => f(C.data?.prev_pagination_token ?? void 0), [C.data?.prev_pagination_token]), A = n(() => {
|
|
37
|
-
C.refetch();
|
|
38
|
-
}, [C]), j = n((e) => (t) => {
|
|
39
|
-
e(t), f(void 0);
|
|
40
|
-
}, []);
|
|
9
|
+
function r({ selectedProductId: r, setSelectedProductId: i, setView: a }) {
|
|
10
|
+
let o = e(), [s, c] = n(!1), l = t(() => c(!0), []), u = t((e) => {
|
|
11
|
+
e || c(!1);
|
|
12
|
+
}, []), d = t(() => c(!1), []);
|
|
41
13
|
return {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
unitFilter: y,
|
|
58
|
-
onUnitFilterChange: j(b),
|
|
59
|
-
isFiltering: T,
|
|
60
|
-
onRetry: A
|
|
14
|
+
open: s,
|
|
15
|
+
requestDelete: l,
|
|
16
|
+
onOpenChange: u,
|
|
17
|
+
confirm: t(async () => {
|
|
18
|
+
if (r) try {
|
|
19
|
+
await o.mutateAsync({ path: { product_id: r } }), c(!1), a("none"), i(void 0);
|
|
20
|
+
} catch {}
|
|
21
|
+
}, [
|
|
22
|
+
r,
|
|
23
|
+
o,
|
|
24
|
+
a,
|
|
25
|
+
i
|
|
26
|
+
]),
|
|
27
|
+
cancel: d,
|
|
28
|
+
isDeleting: o.isPending
|
|
61
29
|
};
|
|
62
30
|
}
|
|
63
31
|
//#endregion
|
|
64
|
-
export {
|
|
32
|
+
export { r as useProductDelete };
|
|
@@ -2,49 +2,23 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
"use client";
|
|
4
4
|
"use client";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { useMeasureUnits as n } from "../../../shared/product-catalog/feature/dist/lib/useMeasureUnits.js";
|
|
8
|
-
import { useProductForm as r } from "../../../shared/product-catalog/feature/dist/lib/useProductForm.js";
|
|
5
|
+
import { buildProductDetailsView as e } from "../../../shared/product-catalog/feature/dist/lib/helpers.js";
|
|
6
|
+
import { useProductQuery as t } from "../../../shared/product-catalog/data-access/dist/index4.js";
|
|
9
7
|
import "../../../shared/product-catalog/feature/dist/index.js";
|
|
10
|
-
import {
|
|
11
|
-
import { useProductDetails as a } from "./index5.js";
|
|
12
|
-
import { useProductsTable as o } from "./index6.js";
|
|
13
|
-
import { useCallback as s, useMemo as c, useState as l } from "react";
|
|
8
|
+
import { useMemo as n } from "react";
|
|
14
9
|
//#region ../../libs/tesouro-embedded-components-react/products-widget/feature/dist/index7.js
|
|
15
|
-
function
|
|
16
|
-
let
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
})
|
|
20
|
-
selectedProductId: m,
|
|
21
|
-
unitNamesById: v.unitNamesById
|
|
22
|
-
});
|
|
10
|
+
function r({ selectedProductId: r, unitNamesById: i, enabled: a = !0 }) {
|
|
11
|
+
let o = t(r, { enabled: a }), s = n(() => o.data ? e({
|
|
12
|
+
product: o.data,
|
|
13
|
+
unitNamesById: i
|
|
14
|
+
}) : void 0, [o.data, i]);
|
|
23
15
|
return {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
view: f,
|
|
30
|
-
setView: p,
|
|
31
|
-
selectedProductId: m,
|
|
32
|
-
setSelectedProductId: h,
|
|
33
|
-
product: b.product,
|
|
34
|
-
messages: d
|
|
35
|
-
}),
|
|
36
|
-
del: i({
|
|
37
|
-
selectedProductId: m,
|
|
38
|
-
setSelectedProductId: h,
|
|
39
|
-
setView: p
|
|
40
|
-
}),
|
|
41
|
-
measureUnitsOpen: g,
|
|
42
|
-
handleRowClick: s((e) => {
|
|
43
|
-
t() || (h(e.id), p("details"));
|
|
44
|
-
}, []),
|
|
45
|
-
openMeasureUnits: s(() => _(!0), []),
|
|
46
|
-
closeMeasureUnits: s(() => _(!1), [])
|
|
16
|
+
product: o.data,
|
|
17
|
+
detailsView: s,
|
|
18
|
+
isLoading: o.isLoading,
|
|
19
|
+
isError: o.isError,
|
|
20
|
+
productName: o.data?.name ?? ""
|
|
47
21
|
};
|
|
48
22
|
}
|
|
49
23
|
//#endregion
|
|
50
|
-
export {
|
|
24
|
+
export { r as useProductDetails };
|
|
@@ -2,125 +2,64 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
"use client";
|
|
4
4
|
"use client";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import "../../../shared/feature/dist/index.js";
|
|
8
|
-
import { ProductFormSheet as n } from "../../../shared/product-catalog/ui/dist/index3.js";
|
|
9
|
-
import { MeasureUnitsManagerContainer as r } from "../../../shared/product-catalog/feature/dist/lib/MeasureUnitsManagerContainer.js";
|
|
5
|
+
import { buildProductRows as e } from "../../../shared/product-catalog/feature/dist/lib/helpers.js";
|
|
6
|
+
import { useProductsQuery as t } from "../../../shared/product-catalog/data-access/dist/index2.js";
|
|
10
7
|
import "../../../shared/product-catalog/feature/dist/index.js";
|
|
11
|
-
import {
|
|
12
|
-
import { PAGE_SIZE_OPTIONS as o } from "./index3.js";
|
|
13
|
-
import { useProductsWidget as s } from "./index7.js";
|
|
14
|
-
import { ProductsScreen as c } from "../../ui/dist/index4.js";
|
|
15
|
-
import { ProductDetailsSheet as l } from "../../ui/dist/index5.js";
|
|
16
|
-
import { ProductDeleteDialog as u } from "../../ui/dist/index6.js";
|
|
17
|
-
import "../../ui/dist/index.js";
|
|
18
|
-
import { useEffect as d } from "react";
|
|
19
|
-
import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
8
|
+
import { useCallback as n, useEffect as r, useMemo as i, useState as a } from "react";
|
|
20
9
|
//#region ../../libs/tesouro-embedded-components-react/products-widget/feature/dist/index8.js
|
|
21
|
-
function
|
|
22
|
-
let x =
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
labels: h
|
|
75
|
-
}),
|
|
76
|
-
/* @__PURE__ */ p(l, {
|
|
77
|
-
open: S === "details",
|
|
78
|
-
onOpenChange: (e) => {
|
|
79
|
-
e || E.close();
|
|
80
|
-
},
|
|
81
|
-
product: T.detailsView,
|
|
82
|
-
isLoading: T.isLoading,
|
|
83
|
-
isError: T.isError,
|
|
84
|
-
onEdit: E.openEdit,
|
|
85
|
-
onDelete: D.requestDelete,
|
|
86
|
-
labels: g
|
|
87
|
-
}),
|
|
88
|
-
/* @__PURE__ */ p(u, {
|
|
89
|
-
open: D.open,
|
|
90
|
-
onOpenChange: D.onOpenChange,
|
|
91
|
-
productName: T.productName,
|
|
92
|
-
isDeleting: D.isDeleting,
|
|
93
|
-
onConfirm: D.confirm,
|
|
94
|
-
onCancel: D.cancel,
|
|
95
|
-
labels: _
|
|
96
|
-
}),
|
|
97
|
-
/* @__PURE__ */ p(r, {
|
|
98
|
-
open: O,
|
|
99
|
-
onClose: j,
|
|
100
|
-
managerLabels: v,
|
|
101
|
-
deleteLabels: y,
|
|
102
|
-
messageLabels: b
|
|
103
|
-
})
|
|
104
|
-
] });
|
|
105
|
-
}
|
|
106
|
-
function g({ baseUrl: e, widgetToken: n, organizationId: r, configClient: i, gatewayRouting: o, linkComponent: s, implementation: c, uiFramework: l, errorFallback: u, onError: d, analytics: f, disclosuresAcceptance: m, providerLabels: g, ..._ }) {
|
|
107
|
-
return /* @__PURE__ */ p(t, {
|
|
108
|
-
widgetName: a,
|
|
109
|
-
baseUrl: e,
|
|
110
|
-
widgetToken: n,
|
|
111
|
-
organizationId: r,
|
|
112
|
-
configClient: i,
|
|
113
|
-
gatewayRouting: o,
|
|
114
|
-
linkComponent: s,
|
|
115
|
-
implementation: c,
|
|
116
|
-
uiFramework: l,
|
|
117
|
-
errorFallback: u,
|
|
118
|
-
onError: d,
|
|
119
|
-
analytics: f,
|
|
120
|
-
disclosuresAcceptance: m,
|
|
121
|
-
providerLabels: g,
|
|
122
|
-
children: /* @__PURE__ */ p(h, { ..._ })
|
|
123
|
-
});
|
|
10
|
+
function o({ unitNamesById: o, enabled: s = !0 }) {
|
|
11
|
+
let [c, l] = a([]), [u, d] = a(10), [f, p] = a(), [m, h] = a(""), [g, _] = a(""), [v, y] = a("all"), [b, x] = a("all");
|
|
12
|
+
r(() => {
|
|
13
|
+
let e = setTimeout(() => {
|
|
14
|
+
_(m), p(void 0);
|
|
15
|
+
}, 400);
|
|
16
|
+
return () => clearTimeout(e);
|
|
17
|
+
}, [m]);
|
|
18
|
+
let S = c[0]?.id === "name" ? "name" : void 0, C = c[0] ? c[0].desc ? "desc" : "asc" : void 0, w = t({
|
|
19
|
+
...S ? {
|
|
20
|
+
sort: S,
|
|
21
|
+
order: C
|
|
22
|
+
} : {},
|
|
23
|
+
limit: u,
|
|
24
|
+
pagination_token: f,
|
|
25
|
+
name__icontains: g || void 0,
|
|
26
|
+
type: v === "all" ? void 0 : v,
|
|
27
|
+
measure_unit_id: b === "all" ? void 0 : b,
|
|
28
|
+
enabled: s
|
|
29
|
+
}), T = i(() => e({
|
|
30
|
+
products: w.data?.data ?? [],
|
|
31
|
+
unitNamesById: o
|
|
32
|
+
}), [w.data, o]), E = !!g || v !== "all" || b !== "all", D = n((e) => {
|
|
33
|
+
let t = typeof e == "function" ? e(c) : e;
|
|
34
|
+
l(t), p(void 0);
|
|
35
|
+
}, [c]), O = n((e) => {
|
|
36
|
+
d(e), p(void 0);
|
|
37
|
+
}, []), k = n(() => p(w.data?.next_pagination_token ?? void 0), [w.data?.next_pagination_token]), A = n(() => p(w.data?.prev_pagination_token ?? void 0), [w.data?.prev_pagination_token]), j = n(() => {
|
|
38
|
+
w.refetch();
|
|
39
|
+
}, [w]), M = n((e) => (t) => {
|
|
40
|
+
e(t), p(void 0);
|
|
41
|
+
}, []);
|
|
42
|
+
return {
|
|
43
|
+
rows: T,
|
|
44
|
+
isLoading: w.isLoading,
|
|
45
|
+
isError: w.isError,
|
|
46
|
+
sorting: c,
|
|
47
|
+
onSortingChange: D,
|
|
48
|
+
pageSize: u,
|
|
49
|
+
onPageSizeChange: O,
|
|
50
|
+
hasNextPage: !!w.data?.next_pagination_token,
|
|
51
|
+
hasPrevPage: !!w.data?.prev_pagination_token,
|
|
52
|
+
onNextPage: k,
|
|
53
|
+
onPrevPage: A,
|
|
54
|
+
searchValue: m,
|
|
55
|
+
onSearchChange: h,
|
|
56
|
+
typeFilter: v,
|
|
57
|
+
onTypeFilterChange: M(y),
|
|
58
|
+
unitFilter: b,
|
|
59
|
+
onUnitFilterChange: M(x),
|
|
60
|
+
isFiltering: E,
|
|
61
|
+
onRetry: j
|
|
62
|
+
};
|
|
124
63
|
}
|
|
125
64
|
//#endregion
|
|
126
|
-
export {
|
|
65
|
+
export { o as useProductsTable };
|