@tesouro/embedded-components-react 0.11.55 → 0.11.59
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 +2 -2
- package/dist/index.css +0 -21
- package/dist/index.d.ts +31 -6
- package/dist/lib/ProductsWidget.d.ts +30 -5
- package/dist/lib/ReceivablesWidget.d.ts +27 -5
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index14.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/products-widget/feature/dist/lib/ProductsWidget/ProductsWidget.js +99 -92
- package/dist/libs/tesouro-embedded-components-react/products-widget/feature/dist/lib/ProductsWidget/useProductDelete.js +24 -21
- package/dist/libs/tesouro-embedded-components-react/products-widget/feature/dist/lib/ProductsWidget/useProductsWidget.js +79 -75
- package/dist/libs/tesouro-embedded-components-react/products-widget/feature/dist/mocks/labels.js +5 -5
- package/dist/libs/tesouro-embedded-components-react/products-widget/ui/dist/index2.js +9 -7
- package/dist/libs/tesouro-embedded-components-react/products-widget/ui/dist/index3.js +7 -9
- package/dist/libs/tesouro-embedded-components-react/products-widget/ui/dist/index4.js +103 -118
- package/dist/libs/tesouro-embedded-components-react/products-widget/ui/dist/index5.js +28 -50
- package/dist/libs/tesouro-embedded-components-react/products-widget/ui/dist/index6.js +118 -147
- package/dist/libs/tesouro-embedded-components-react/products-widget/ui/dist/index7.js +24 -27
- 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/feature/dist/index.js +16 -14
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/feature/dist/lib/MeasureUnitCreateDialogContainer.js +38 -0
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/feature/dist/lib/MeasureUnitsManagerContainer.js +73 -123
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/feature/dist/lib/ProductSelector.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/feature/dist/lib/helpers.js +6 -2
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/feature/dist/lib/labels.js +7 -7
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/feature/dist/lib/useMeasureUnitForm.js +83 -0
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/feature/dist/lib/useProductForm.js +17 -4
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/ui/dist/index.js +6 -4
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/ui/dist/index2.js +45 -17
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/ui/dist/index3.js +121 -123
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/ui/dist/index4.js +36 -61
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/ui/dist/index5.js +26 -194
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/ui/dist/index6.js +115 -49
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/ui/dist/index7.js +62 -113
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/ui/dist/index8.js +51 -0
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/ui/dist/index9.js +117 -0
- package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/index.js +14 -14
- package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/lib/StatePanel/NoAccessState.js +10 -2
- package/dist/packages/shared-ui-shadcn/dist/index.js +1648 -1526
- package/package.json +1 -1
|
@@ -1,155 +1,126 @@
|
|
|
1
|
-
import { Button as e,
|
|
2
|
-
import { ErrorState as
|
|
1
|
+
import { Button as e, DescriptionList as t, FormSheet as n, Heading as r, Skeleton as i, Typography as a } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
|
|
2
|
+
import { ErrorState as o } from "../../../shared/ui/dist/lib/ErrorState/ErrorState.js";
|
|
3
|
+
import { LoadingRegion as s } from "../../../shared/ui/dist/lib/LoadingRegion/LoadingRegion.js";
|
|
3
4
|
import "../../../shared/ui/dist/index.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
5
|
+
import { mergeProductFormSheetLabels as c } from "../../../shared/product-catalog/ui/dist/index2.js";
|
|
6
|
+
import { ActionsMenu as l } from "../../../shared/product-catalog/ui/dist/index5.js";
|
|
7
|
+
import "../../../shared/product-catalog/ui/dist/index.js";
|
|
8
|
+
import { PRODUCT_DETAILS_SHEET_LABELS_EN as u } from "./index2.js";
|
|
9
|
+
import { ProductTypeBadge as d } from "./index3.js";
|
|
10
|
+
import { ProductEditForm as f } from "./index5.js";
|
|
11
|
+
import { useId as p } from "react";
|
|
12
|
+
import { jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
10
13
|
// ../../libs/tesouro-embedded-components-react/products-widget/ui/dist/index6.js
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
color: "muted",
|
|
17
|
-
className: "ttw:w-35 ttw:min-w-35 ttw:font-medium",
|
|
18
|
-
children: e
|
|
19
|
-
}), typeof t == "string" ? /* @__PURE__ */ v(p, {
|
|
20
|
-
variant: "body2",
|
|
21
|
-
className: "ttw:min-w-0 ttw:font-medium ttw:wrap-break-word",
|
|
22
|
-
children: t || r
|
|
23
|
-
}) : t]
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
function T({ open: C, onOpenChange: T, product: E, isLoading: D, isError: O, onEdit: k, onDelete: A, canEdit: j = !0, canDelete: M = !0, editForm: N, labels: P }) {
|
|
27
|
-
let F = {
|
|
28
|
-
...h,
|
|
29
|
-
...P,
|
|
14
|
+
var g = 7;
|
|
15
|
+
function _({ open: _, onOpenChange: v, product: y, isLoading: b, isError: x, onEdit: S, onDelete: C, canEdit: w = !0, canDelete: T = !0, editForm: E, labels: D }) {
|
|
16
|
+
let O = {
|
|
17
|
+
...u,
|
|
18
|
+
...D,
|
|
30
19
|
typeBadge: {
|
|
31
|
-
...
|
|
32
|
-
...
|
|
20
|
+
...u.typeBadge,
|
|
21
|
+
...D?.typeBadge
|
|
33
22
|
}
|
|
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
|
-
className: "ttw:p-2 ttw:size-9 ttw:border-none ttw:bg-muted",
|
|
62
|
-
children: /* @__PURE__ */ v(b, { className: "ttw:size-4" })
|
|
63
|
-
})
|
|
64
|
-
}), /* @__PURE__ */ v(n, {
|
|
65
|
-
align: "end",
|
|
66
|
-
children: /* @__PURE__ */ y(r, {
|
|
67
|
-
onClick: A,
|
|
68
|
-
variant: "destructive",
|
|
69
|
-
children: [/* @__PURE__ */ v(x, { className: "ttw:size-4" }), F.deleteProductOption.replace("{type}", L)]
|
|
70
|
-
})
|
|
71
|
-
})] }), /* @__PURE__ */ v(o, {
|
|
72
|
-
"aria-label": F.closeLabel,
|
|
73
|
-
className: "ttw:size-9 ttw:bg-muted ttw:p-2 ttw:flex ttw:items-center ttw:justify-center ttw:rounded-md ttw:cursor-pointer",
|
|
74
|
-
children: /* @__PURE__ */ v(S, { className: "ttw:size-4" })
|
|
75
|
-
})]
|
|
23
|
+
}, k = p(), A = c(E?.labels), j = y?.type !== "service", M = j ? O.typeBadge.product : O.typeBadge.service, N = (e) => e || O.rowEmptyValue, P = x ? /* @__PURE__ */ m(o, {
|
|
24
|
+
title: O.errorTitle,
|
|
25
|
+
description: O.errorDescription
|
|
26
|
+
}) : b || !y ? /* @__PURE__ */ m(s, {
|
|
27
|
+
isLoading: !0,
|
|
28
|
+
loadingLabel: O.loadingLabel,
|
|
29
|
+
className: "ttw:flex ttw:flex-col ttw:gap-4 ttw:py-4",
|
|
30
|
+
children: Array.from({ length: g }, (e, t) => /* @__PURE__ */ m(i, { className: "ttw:h-5 ttw:w-full" }, t))
|
|
31
|
+
}) : E ? /* @__PURE__ */ m("div", {
|
|
32
|
+
className: "ttw:py-4",
|
|
33
|
+
children: /* @__PURE__ */ m(f, {
|
|
34
|
+
form: E,
|
|
35
|
+
formId: k
|
|
36
|
+
})
|
|
37
|
+
}) : /* @__PURE__ */ h("section", {
|
|
38
|
+
className: "ttw:flex ttw:flex-col ttw:gap-2 ttw:py-4",
|
|
39
|
+
children: [/* @__PURE__ */ h("div", {
|
|
40
|
+
className: "ttw:flex ttw:items-start ttw:justify-between ttw:gap-3",
|
|
41
|
+
children: [/* @__PURE__ */ h("div", {
|
|
42
|
+
className: "ttw:flex ttw:flex-col ttw:gap-1",
|
|
43
|
+
children: [/* @__PURE__ */ m(r, {
|
|
44
|
+
variant: "subsection",
|
|
45
|
+
children: O.sectionHeading.replace("{type}", M)
|
|
46
|
+
}), /* @__PURE__ */ m(a, {
|
|
47
|
+
variant: "body2",
|
|
48
|
+
color: "muted",
|
|
49
|
+
children: j ? O.typeProductDescription : O.typeServiceDescription
|
|
76
50
|
})]
|
|
77
|
-
}),
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
children:
|
|
83
|
-
}) : /* @__PURE__ */ v("main", {
|
|
84
|
-
className: "ttw:p-6 ttw:overflow-auto ttw:flex ttw:flex-col ttw:gap-4",
|
|
85
|
-
children: /* @__PURE__ */ y("div", {
|
|
86
|
-
className: "ttw:flex ttw:flex-col ttw:gap-4",
|
|
87
|
-
children: [/* @__PURE__ */ y("div", {
|
|
88
|
-
className: "ttw:flex ttw:items-center ttw:justify-between ttw:gap-3 ttw:pt-6 ttw:pb-7 ttw:border-b ttw:border-border",
|
|
89
|
-
children: [/* @__PURE__ */ y("div", {
|
|
90
|
-
className: "ttw:flex ttw:flex-col ttw:gap-1.5",
|
|
91
|
-
children: [/* @__PURE__ */ v(p, {
|
|
92
|
-
variant: "body1",
|
|
93
|
-
className: "ttw:font-medium",
|
|
94
|
-
children: F.sectionHeading.replace("{type}", L)
|
|
95
|
-
}), /* @__PURE__ */ v(p, {
|
|
96
|
-
variant: "body2",
|
|
97
|
-
color: "muted",
|
|
98
|
-
children: I ? F.typeProductDescription : F.typeServiceDescription
|
|
99
|
-
})]
|
|
100
|
-
}), j && !N && /* @__PURE__ */ v(e, {
|
|
101
|
-
type: "button",
|
|
102
|
-
variant: "ghost",
|
|
103
|
-
className: "ttw:text-primary ttw:hover:text-primary",
|
|
104
|
-
onClick: k,
|
|
105
|
-
children: F.editButton
|
|
106
|
-
})]
|
|
107
|
-
}), N ? /* @__PURE__ */ v(_, { form: N }) : /* @__PURE__ */ y("ul", {
|
|
108
|
-
className: "ttw:list-none ttw:p-0 ttw:m-0",
|
|
109
|
-
children: [
|
|
110
|
-
/* @__PURE__ */ v(w, {
|
|
111
|
-
label: F.rowName.replace("{type}", L),
|
|
112
|
-
value: E.name,
|
|
113
|
-
emptyValue: F.rowEmptyValue
|
|
114
|
-
}),
|
|
115
|
-
/* @__PURE__ */ v(w, {
|
|
116
|
-
label: F.rowPrice,
|
|
117
|
-
value: E.priceLabel,
|
|
118
|
-
emptyValue: F.rowEmptyValue
|
|
119
|
-
}),
|
|
120
|
-
/* @__PURE__ */ v(w, {
|
|
121
|
-
label: F.rowDescription,
|
|
122
|
-
value: E.description,
|
|
123
|
-
emptyValue: F.rowEmptyValue
|
|
124
|
-
}),
|
|
125
|
-
/* @__PURE__ */ v(w, {
|
|
126
|
-
label: F.rowType,
|
|
127
|
-
value: E.type ? /* @__PURE__ */ v(g, {
|
|
128
|
-
type: E.type,
|
|
129
|
-
labels: F.typeBadge
|
|
130
|
-
}) : F.rowEmptyValue
|
|
131
|
-
}),
|
|
132
|
-
/* @__PURE__ */ v(w, {
|
|
133
|
-
label: F.rowUnit,
|
|
134
|
-
value: E.unitLabel,
|
|
135
|
-
emptyValue: F.rowEmptyValue
|
|
136
|
-
}),
|
|
137
|
-
/* @__PURE__ */ v(w, {
|
|
138
|
-
label: F.rowCreatedOn,
|
|
139
|
-
value: E.createdAtLabel,
|
|
140
|
-
emptyValue: F.rowEmptyValue
|
|
141
|
-
}),
|
|
142
|
-
/* @__PURE__ */ v(w, {
|
|
143
|
-
label: F.rowLastUpdate,
|
|
144
|
-
value: E.updatedAtLabel,
|
|
145
|
-
emptyValue: F.rowEmptyValue,
|
|
146
|
-
isLast: !0
|
|
147
|
-
})
|
|
148
|
-
]
|
|
149
|
-
})]
|
|
150
|
-
})
|
|
51
|
+
}), w && /* @__PURE__ */ m(e, {
|
|
52
|
+
type: "button",
|
|
53
|
+
variant: "link",
|
|
54
|
+
size: "sm",
|
|
55
|
+
onClick: S,
|
|
56
|
+
children: O.editButton
|
|
151
57
|
})]
|
|
152
|
-
})
|
|
58
|
+
}), /* @__PURE__ */ m(t, { items: [
|
|
59
|
+
{
|
|
60
|
+
label: O.rowName.replace("{type}", M),
|
|
61
|
+
value: N(y.name)
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
label: O.rowPrice,
|
|
65
|
+
value: N(y.priceLabel)
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
label: O.rowDescription,
|
|
69
|
+
value: N(y.description)
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
label: O.rowType,
|
|
73
|
+
value: y.type ? /* @__PURE__ */ m(d, {
|
|
74
|
+
type: y.type,
|
|
75
|
+
labels: O.typeBadge
|
|
76
|
+
}) : O.rowEmptyValue
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
label: O.rowUnit,
|
|
80
|
+
value: N(y.unitLabel)
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
label: O.rowCreatedOn,
|
|
84
|
+
value: N(y.createdAtLabel)
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
label: O.rowLastUpdate,
|
|
88
|
+
value: N(y.updatedAtLabel)
|
|
89
|
+
}
|
|
90
|
+
] })]
|
|
91
|
+
});
|
|
92
|
+
return /* @__PURE__ */ m(n, {
|
|
93
|
+
open: _,
|
|
94
|
+
onOpenChange: v,
|
|
95
|
+
title: x ? O.unavailableTitle : y?.name ?? O.loadingTitle,
|
|
96
|
+
description: y && !x ? O.subtitle.replace("{type}", M).replace("{createdAt}", y.createdAtLabel) : void 0,
|
|
97
|
+
headerActions: T && !x ? /* @__PURE__ */ m(l, {
|
|
98
|
+
size: "icon",
|
|
99
|
+
label: O.moreActionsLabel,
|
|
100
|
+
disabled: !y,
|
|
101
|
+
items: [{
|
|
102
|
+
key: "delete",
|
|
103
|
+
label: O.deleteProductOption.replace("{type}", M),
|
|
104
|
+
onSelect: C,
|
|
105
|
+
destructive: !0
|
|
106
|
+
}]
|
|
107
|
+
}) : null,
|
|
108
|
+
secondaryAction: E ? /* @__PURE__ */ m(e, {
|
|
109
|
+
type: "button",
|
|
110
|
+
variant: "ghost",
|
|
111
|
+
disabled: E.inProgress,
|
|
112
|
+
onClick: E.onCancel,
|
|
113
|
+
children: A.cancelButton
|
|
114
|
+
}) : void 0,
|
|
115
|
+
primaryAction: E ? /* @__PURE__ */ m(e, {
|
|
116
|
+
type: "submit",
|
|
117
|
+
form: k,
|
|
118
|
+
loading: E.inProgress,
|
|
119
|
+
children: A.saveButton
|
|
120
|
+
}) : void 0,
|
|
121
|
+
submitting: E?.inProgress,
|
|
122
|
+
labels: { close: O.closeLabel },
|
|
123
|
+
children: P
|
|
153
124
|
});
|
|
154
125
|
}
|
|
155
|
-
export {
|
|
126
|
+
export { _ as ProductDetailsSheet, _ as default };
|
|
@@ -1,31 +1,28 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { PRODUCT_DELETE_DIALOG_LABELS_EN as
|
|
3
|
-
import { jsx as
|
|
1
|
+
import { ConfirmDialog as e } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
|
|
2
|
+
import { PRODUCT_DELETE_DIALOG_LABELS_EN as t } from "./index2.js";
|
|
3
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
4
4
|
// ../../libs/tesouro-embedded-components-react/products-widget/ui/dist/index7.js
|
|
5
|
-
function
|
|
6
|
-
let
|
|
7
|
-
...
|
|
8
|
-
...
|
|
5
|
+
function r({ open: r, onOpenChange: i, productName: a, isDeleting: o, onConfirm: s, onCancel: c, labels: l }) {
|
|
6
|
+
let u = {
|
|
7
|
+
...t,
|
|
8
|
+
...l
|
|
9
9
|
};
|
|
10
|
-
return /* @__PURE__ */
|
|
11
|
-
open:
|
|
12
|
-
onOpenChange:
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
children: _.confirmButton
|
|
27
|
-
})] })]
|
|
28
|
-
})
|
|
10
|
+
return /* @__PURE__ */ n(e, {
|
|
11
|
+
open: r,
|
|
12
|
+
onOpenChange: (e) => {
|
|
13
|
+
e || c(), i(e);
|
|
14
|
+
},
|
|
15
|
+
title: u.title.replace("{name}", a),
|
|
16
|
+
description: u.message,
|
|
17
|
+
onConfirm: s,
|
|
18
|
+
destructive: !0,
|
|
19
|
+
confirmDisabled: o,
|
|
20
|
+
loading: o,
|
|
21
|
+
labels: {
|
|
22
|
+
confirm: u.confirmButton,
|
|
23
|
+
cancel: u.cancelButton,
|
|
24
|
+
close: u.close
|
|
25
|
+
}
|
|
29
26
|
});
|
|
30
27
|
}
|
|
31
|
-
export {
|
|
28
|
+
export { r as ProductDeleteDialog, r as default };
|
package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// ../../libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js
|
|
2
|
-
var e = "@tesouro/embedded-components-react", t = "0.11.
|
|
2
|
+
var e = "@tesouro/embedded-components-react", t = "0.11.59", n = "dd2e792f0445acb9ddf3e4d98c8b7a1f8b62db13", r = Object.freeze({
|
|
3
3
|
library_name: e,
|
|
4
4
|
library_version: t,
|
|
5
5
|
library_sha: n
|
package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/feature/dist/index.js
CHANGED
|
@@ -1,27 +1,29 @@
|
|
|
1
1
|
import { extractApiErrorMessage as e } from "../../../util/dist/lib/apiErrors.js";
|
|
2
2
|
import "../../../util/dist/index.js";
|
|
3
3
|
import { PRODUCT_MESSAGE_LABELS_EN as t } from "./lib/labels.js";
|
|
4
|
-
import { buildProductDetailsView as n, buildProductRows as r,
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import "../../ui/dist/
|
|
4
|
+
import { buildProductDetailsView as n, buildProductRows as r, formatDeleteError as i, formatPrice as a, hasSelectedText as o } from "./lib/helpers.js";
|
|
5
|
+
import { toastSuccessWithName as s } from "./lib/toasts.js";
|
|
6
|
+
import { PRODUCT_FORM_SHEET_LABELS_EN as c } from "../../ui/dist/index2.js";
|
|
7
|
+
import { ProductFormSheet as l } from "../../ui/dist/index4.js";
|
|
8
8
|
import "../../ui/dist/index6.js";
|
|
9
|
+
import "../../ui/dist/index8.js";
|
|
9
10
|
import "../../ui/dist/index.js";
|
|
10
|
-
import { useProductsQuery as
|
|
11
|
+
import { useProductsQuery as u } from "../../data-access/dist/index2.js";
|
|
11
12
|
import "../../data-access/dist/index3.js";
|
|
12
|
-
import { useProductQuery as
|
|
13
|
-
import { useCreateProductMutation as
|
|
13
|
+
import { useProductQuery as d } from "../../data-access/dist/index4.js";
|
|
14
|
+
import { useCreateProductMutation as f } from "../../data-access/dist/index6.js";
|
|
14
15
|
import "../../data-access/dist/index7.js";
|
|
15
|
-
import { useDeleteProductMutation as
|
|
16
|
-
import { useMeasureUnitsQuery as
|
|
16
|
+
import { useDeleteProductMutation as p } from "../../data-access/dist/index8.js";
|
|
17
|
+
import { useMeasureUnitsQuery as m } from "../../data-access/dist/index9.js";
|
|
17
18
|
import "../../data-access/dist/index10.js";
|
|
18
19
|
import "../../data-access/dist/index11.js";
|
|
19
20
|
import "../../data-access/dist/index12.js";
|
|
20
21
|
import "../../data-access/dist/index13.js";
|
|
21
22
|
import "../../data-access/dist/index.js";
|
|
22
|
-
import { MeasureUnitsManagerContainer as
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
23
|
+
import { MeasureUnitsManagerContainer as h } from "./lib/MeasureUnitsManagerContainer.js";
|
|
24
|
+
import { MeasureUnitCreateDialogContainer as g } from "./lib/MeasureUnitCreateDialogContainer.js";
|
|
25
|
+
import { useMeasureUnits as _ } from "./lib/useMeasureUnits.js";
|
|
26
|
+
import { useProductForm as v } from "./lib/useProductForm.js";
|
|
25
27
|
import "./lib/useProductSelector.js";
|
|
26
|
-
import { ProductSelector as
|
|
27
|
-
export {
|
|
28
|
+
import { ProductSelector as y } from "./lib/ProductSelector.js";
|
|
29
|
+
export { g as MeasureUnitCreateDialogContainer, h as MeasureUnitsManagerContainer, c as PRODUCT_FORM_SHEET_LABELS_EN, t as PRODUCT_MESSAGE_LABELS_EN, l as ProductFormSheet, y as ProductSelector, n as buildProductDetailsView, r as buildProductRows, e as extractApiErrorMessage, i as formatDeleteError, a as formatPrice, o as hasSelectedText, s as toastSuccessWithName, f as useCreateProductMutation, p as useDeleteProductMutation, _ as useMeasureUnits, m as useMeasureUnitsQuery, v as useProductForm, d as useProductQuery, u as useProductsQuery };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
"use client";
|
|
4
|
+
"use client";
|
|
5
|
+
import { PRODUCT_MESSAGE_LABELS_EN as e } from "./labels.js";
|
|
6
|
+
import { MeasureUnitFormDialog as t, MeasureUnitFormMode as n } from "../../../ui/dist/index7.js";
|
|
7
|
+
import "../../../ui/dist/index.js";
|
|
8
|
+
import { useMeasureUnitForm as r } from "./useMeasureUnitForm.js";
|
|
9
|
+
import { useMemo as i, useState as a } from "react";
|
|
10
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
11
|
+
// ../../libs/tesouro-embedded-components-react/shared/product-catalog/feature/dist/lib/MeasureUnitCreateDialogContainer.js
|
|
12
|
+
function s({ open: s, onClose: c, onCreated: l, suspended: u = !1, labels: d, messageLabels: f }) {
|
|
13
|
+
let p = i(() => ({
|
|
14
|
+
...e,
|
|
15
|
+
...f
|
|
16
|
+
}), [f]), m = r({
|
|
17
|
+
messages: p,
|
|
18
|
+
suspended: u,
|
|
19
|
+
toastOnCreate: !1,
|
|
20
|
+
onCreated: (e) => {
|
|
21
|
+
l(e), c();
|
|
22
|
+
}
|
|
23
|
+
}), [h, g] = a(!1);
|
|
24
|
+
return s !== h && (g(s), s && m.openCreate()), /* @__PURE__ */ o(t, {
|
|
25
|
+
open: s,
|
|
26
|
+
onOpenChange: (e) => {
|
|
27
|
+
e || c();
|
|
28
|
+
},
|
|
29
|
+
mode: n.Create,
|
|
30
|
+
values: m.draft,
|
|
31
|
+
error: m.error,
|
|
32
|
+
submitting: m.isSubmitting || u,
|
|
33
|
+
onChange: m.change,
|
|
34
|
+
onSubmit: m.submit,
|
|
35
|
+
labels: d
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
export { s as MeasureUnitCreateDialogContainer, s as default };
|
|
@@ -7,147 +7,97 @@ import { extractApiErrorMessage as t } from "../../../../util/dist/lib/apiErrors
|
|
|
7
7
|
import "../../../../util/dist/index.js";
|
|
8
8
|
import "../../../../ui/dist/index.js";
|
|
9
9
|
import { PRODUCT_MESSAGE_LABELS_EN as n } from "./labels.js";
|
|
10
|
-
import {
|
|
10
|
+
import { formatDeleteError as r, formatPrice as i } from "./helpers.js";
|
|
11
11
|
import { toastSuccessWithName as a } from "./toasts.js";
|
|
12
|
-
import { MeasureUnitsManager as o } from "../../../ui/dist/
|
|
13
|
-
import {
|
|
12
|
+
import { MeasureUnitsManager as o } from "../../../ui/dist/index6.js";
|
|
13
|
+
import { MeasureUnitFormDialog as s, MeasureUnitFormMode as c } from "../../../ui/dist/index7.js";
|
|
14
|
+
import { MeasureUnitDeleteDialog as l } from "../../../ui/dist/index8.js";
|
|
14
15
|
import "../../../ui/dist/index.js";
|
|
15
|
-
import { useMeasureUnitsQuery as
|
|
16
|
-
import { useProductsByMeasureUnitQuery as
|
|
17
|
-
import { useCreateMeasureUnitMutation as u } from "../../../data-access/dist/index11.js";
|
|
18
|
-
import { useUpdateMeasureUnitMutation as d } from "../../../data-access/dist/index12.js";
|
|
16
|
+
import { useMeasureUnitsQuery as u } from "../../../data-access/dist/index9.js";
|
|
17
|
+
import { useProductsByMeasureUnitQuery as d } from "../../../data-access/dist/index10.js";
|
|
19
18
|
import { useDeleteMeasureUnitMutation as f } from "../../../data-access/dist/index13.js";
|
|
20
19
|
import "../../../data-access/dist/index.js";
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
20
|
+
import { useMeasureUnitForm as p } from "./useMeasureUnitForm.js";
|
|
21
|
+
import { useCallback as m, useMemo as h, useState as g } from "react";
|
|
22
|
+
import { Fragment as _, jsx as v, jsxs as y } from "react/jsx-runtime";
|
|
23
23
|
// ../../libs/tesouro-embedded-components-react/shared/product-catalog/feature/dist/lib/MeasureUnitsManagerContainer.js
|
|
24
|
-
var y = {
|
|
25
|
-
name: "",
|
|
26
|
-
description: ""
|
|
27
|
-
};
|
|
28
24
|
function b({ open: b, onClose: x, suspended: S = !1, managerLabels: C, deleteLabels: w, messageLabels: T }) {
|
|
29
|
-
let E =
|
|
25
|
+
let E = h(() => ({
|
|
30
26
|
...n,
|
|
31
27
|
...T
|
|
32
|
-
}), [T]), D =
|
|
33
|
-
|
|
34
|
-
|
|
28
|
+
}), [T]), D = u({ enabled: b && !S }), O = p({
|
|
29
|
+
messages: E,
|
|
30
|
+
suspended: S
|
|
31
|
+
}), k = f(), [A, j] = g(""), [M, N] = g(), [P, F] = g(b);
|
|
32
|
+
b !== P && (F(b), b || (N(void 0), O.close()));
|
|
33
|
+
let I = h(() => (D.data?.data ?? []).map((e) => ({
|
|
35
34
|
id: e.id,
|
|
36
35
|
name: e.name,
|
|
37
36
|
description: e.description ?? ""
|
|
38
|
-
})), [D.data]),
|
|
39
|
-
let e =
|
|
40
|
-
return e ?
|
|
41
|
-
}, [
|
|
37
|
+
})), [D.data]), L = D.isError && D.data === void 0, R = L && D.isFetching, z = h(() => {
|
|
38
|
+
let e = A.trim().toLowerCase();
|
|
39
|
+
return e ? I.filter((t) => t.name.toLowerCase().includes(e) || t.description.toLowerCase().includes(e)) : I;
|
|
40
|
+
}, [I, A]), B = d(M?.id, { enabled: b && !S }), V = h(() => (B.data?.data ?? []).map((e) => ({
|
|
42
41
|
id: e.id,
|
|
43
42
|
name: e.name,
|
|
44
|
-
priceLabel:
|
|
45
|
-
})), [
|
|
46
|
-
if (S)
|
|
47
|
-
|
|
48
|
-
if (e) I(e);
|
|
49
|
-
else {
|
|
50
|
-
I(void 0);
|
|
51
|
-
try {
|
|
52
|
-
let e = await O.mutateAsync({ body: {
|
|
53
|
-
name: N.name.trim(),
|
|
54
|
-
description: N.description.trim() || void 0
|
|
55
|
-
} });
|
|
56
|
-
a(E.measureUnitCreated, e.name), P(y);
|
|
57
|
-
} catch (e) {
|
|
58
|
-
I(t(e) ?? E.createMeasureUnitError);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}, [
|
|
62
|
-
S,
|
|
63
|
-
N,
|
|
64
|
-
O,
|
|
65
|
-
E
|
|
66
|
-
]), Q = p((e) => {
|
|
67
|
-
R(e.id), B({
|
|
68
|
-
name: e.name,
|
|
69
|
-
description: e.description
|
|
70
|
-
}), H(void 0);
|
|
71
|
-
}, []), $ = p(async () => {
|
|
72
|
-
if (S || !L) return;
|
|
73
|
-
let e = i(z, E);
|
|
74
|
-
if (e) H(e);
|
|
75
|
-
else {
|
|
76
|
-
H(void 0);
|
|
77
|
-
try {
|
|
78
|
-
let e = await k.mutateAsync({
|
|
79
|
-
path: { unit_id: L },
|
|
80
|
-
body: {
|
|
81
|
-
name: z.name.trim(),
|
|
82
|
-
description: z.description.trim() || void 0
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
a(E.measureUnitUpdated, e.name), R(void 0);
|
|
86
|
-
} catch (e) {
|
|
87
|
-
H(t(e) ?? E.updateMeasureUnitError);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}, [
|
|
91
|
-
S,
|
|
92
|
-
L,
|
|
93
|
-
z,
|
|
94
|
-
k,
|
|
95
|
-
E
|
|
96
|
-
]), ee = p(async () => {
|
|
97
|
-
if (!S && U) try {
|
|
98
|
-
await A.mutateAsync({ path: { unit_id: U.id } }), a(E.measureUnitDeleted, U.name), W(void 0);
|
|
43
|
+
priceLabel: i(e.price)
|
|
44
|
+
})), [B.data]), H = m(async () => {
|
|
45
|
+
if (!S && M) try {
|
|
46
|
+
await k.mutateAsync({ path: { unit_id: M.id } }), a(E.measureUnitDeleted, M.name), N(void 0);
|
|
99
47
|
} catch (n) {
|
|
100
|
-
e.error(
|
|
48
|
+
e.error(r(E.deleteMeasureUnitError, M.name, t(n)));
|
|
101
49
|
}
|
|
102
50
|
}, [
|
|
103
51
|
S,
|
|
104
|
-
|
|
105
|
-
|
|
52
|
+
M,
|
|
53
|
+
k,
|
|
106
54
|
E
|
|
107
55
|
]);
|
|
108
|
-
return /* @__PURE__ */
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
e
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
e
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
56
|
+
return /* @__PURE__ */ y(_, { children: [
|
|
57
|
+
/* @__PURE__ */ v(o, {
|
|
58
|
+
open: b,
|
|
59
|
+
onOpenChange: (e) => {
|
|
60
|
+
e || x();
|
|
61
|
+
},
|
|
62
|
+
units: z,
|
|
63
|
+
isLoading: D.isLoading || R,
|
|
64
|
+
isError: L && !R,
|
|
65
|
+
onRetry: S ? void 0 : () => void D.refetch(),
|
|
66
|
+
searchValue: A,
|
|
67
|
+
onSearchChange: j,
|
|
68
|
+
onAddClick: O.openCreate,
|
|
69
|
+
actionsDisabled: S,
|
|
70
|
+
onEditClick: O.openEdit,
|
|
71
|
+
onDeleteClick: N,
|
|
72
|
+
onDone: x,
|
|
73
|
+
labels: C
|
|
74
|
+
}),
|
|
75
|
+
/* @__PURE__ */ v(s, {
|
|
76
|
+
open: b && O.mode !== void 0,
|
|
77
|
+
onOpenChange: (e) => {
|
|
78
|
+
e || O.close();
|
|
79
|
+
},
|
|
80
|
+
mode: O.mode ?? c.Create,
|
|
81
|
+
values: O.draft,
|
|
82
|
+
error: O.error,
|
|
83
|
+
submitting: O.isSubmitting || S,
|
|
84
|
+
onChange: O.change,
|
|
85
|
+
onSubmit: O.submit,
|
|
86
|
+
labels: C
|
|
87
|
+
}),
|
|
88
|
+
/* @__PURE__ */ v(l, {
|
|
89
|
+
open: !!M,
|
|
90
|
+
onOpenChange: (e) => {
|
|
91
|
+
e || N(void 0);
|
|
92
|
+
},
|
|
93
|
+
unitName: M?.name ?? "",
|
|
94
|
+
affectedProducts: V,
|
|
95
|
+
isLoadingProducts: B.isLoading,
|
|
96
|
+
isDeleting: k.isPending || S,
|
|
97
|
+
onConfirm: H,
|
|
98
|
+
onCancel: () => N(void 0),
|
|
99
|
+
labels: w
|
|
100
|
+
})
|
|
101
|
+
] });
|
|
152
102
|
}
|
|
153
103
|
export { b as MeasureUnitsManagerContainer, b as default };
|