@primershop/strapi-plugin-product-actions 0.0.13 → 0.0.15
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/admin/index.js +221 -24
- package/dist/admin/index.mjs +223 -23
- package/dist/server/index.js +240 -16
- package/dist/server/index.mjs +243 -16
- package/package.json +11 -10
- package/dist/admin/components/Initializer/index.js +0 -17
- package/dist/admin/components/Initializer/index.js.map +0 -1
- package/dist/admin/components/Initializer/index.mjs +0 -15
- package/dist/admin/components/Initializer/index.mjs.map +0 -1
- package/dist/admin/components/SeriesProductActions/index.js +0 -229
- package/dist/admin/components/SeriesProductActions/index.js.map +0 -1
- package/dist/admin/components/SeriesProductActions/index.mjs +0 -227
- package/dist/admin/components/SeriesProductActions/index.mjs.map +0 -1
- package/dist/admin/index.js.map +0 -1
- package/dist/admin/index.mjs.map +0 -1
- package/dist/admin/pluginId.js +0 -6
- package/dist/admin/pluginId.js.map +0 -1
- package/dist/admin/pluginId.mjs +0 -4
- package/dist/admin/pluginId.mjs.map +0 -1
- package/dist/admin/translations/en.js +0 -25
- package/dist/admin/translations/en.js.map +0 -1
- package/dist/admin/translations/en.mjs +0 -23
- package/dist/admin/translations/en.mjs.map +0 -1
- package/dist/server/bootstrap.js +0 -16
- package/dist/server/bootstrap.js.map +0 -1
- package/dist/server/bootstrap.mjs +0 -14
- package/dist/server/bootstrap.mjs.map +0 -1
- package/dist/server/controllers/index.js +0 -10
- package/dist/server/controllers/index.js.map +0 -1
- package/dist/server/controllers/index.mjs +0 -8
- package/dist/server/controllers/index.mjs.map +0 -1
- package/dist/server/controllers/product-series.js +0 -29
- package/dist/server/controllers/product-series.js.map +0 -1
- package/dist/server/controllers/product-series.mjs +0 -27
- package/dist/server/controllers/product-series.mjs.map +0 -1
- package/dist/server/index.js.map +0 -1
- package/dist/server/index.mjs.map +0 -1
- package/dist/server/permissions.js +0 -51
- package/dist/server/permissions.js.map +0 -1
- package/dist/server/permissions.mjs +0 -49
- package/dist/server/permissions.mjs.map +0 -1
- package/dist/server/register.js +0 -7
- package/dist/server/register.js.map +0 -1
- package/dist/server/register.mjs +0 -5
- package/dist/server/register.mjs.map +0 -1
- package/dist/server/routes/admin.js +0 -44
- package/dist/server/routes/admin.js.map +0 -1
- package/dist/server/routes/admin.mjs +0 -42
- package/dist/server/routes/admin.mjs.map +0 -1
- package/dist/server/routes/index.js +0 -10
- package/dist/server/routes/index.js.map +0 -1
- package/dist/server/routes/index.mjs +0 -8
- package/dist/server/routes/index.mjs.map +0 -1
- package/dist/server/services/index.js +0 -10
- package/dist/server/services/index.js.map +0 -1
- package/dist/server/services/index.mjs +0 -8
- package/dist/server/services/index.mjs.map +0 -1
- package/dist/server/services/product-series.js +0 -113
- package/dist/server/services/product-series.js.map +0 -1
- package/dist/server/services/product-series.mjs +0 -111
- package/dist/server/services/product-series.mjs.map +0 -1
package/dist/admin/index.js
CHANGED
|
@@ -1,27 +1,224 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
const react = require("react");
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const designSystem = require("@strapi/design-system");
|
|
5
|
+
const admin = require("@strapi/strapi/admin");
|
|
6
|
+
const PLUGIN_ID = "primershop-product-actions";
|
|
7
|
+
const Initializer = ({ setPlugin }) => {
|
|
8
|
+
const ref = react.useRef(setPlugin);
|
|
9
|
+
react.useEffect(() => {
|
|
10
|
+
ref.current(PLUGIN_ID);
|
|
11
|
+
}, []);
|
|
12
|
+
return null;
|
|
13
|
+
};
|
|
14
|
+
const en = {
|
|
15
|
+
"plugin.name": "Product Series",
|
|
16
|
+
"plugin.description": "Manage product series and their products",
|
|
17
|
+
"product-series.actions.label": "Product Actions",
|
|
18
|
+
"product-series.actions.createProducts": "Create Products",
|
|
19
|
+
"product-series.actions.updateProducts": "Update Products",
|
|
20
|
+
"product-series.actions.createDialogTitle": "Create Products from Series",
|
|
21
|
+
"product-series.actions.updateDialogTitle": "Update All Products in Series",
|
|
22
|
+
"product-series.actions.updateDialogDescription": "This will update all products in the series with the selected fields. Make sure to save the series first before updating the products.",
|
|
23
|
+
"product-series.actions.productCount": "Number of Products",
|
|
24
|
+
"product-series.actions.create": "Create",
|
|
25
|
+
"product-series.actions.update": "Update",
|
|
26
|
+
"product-series.actions.cancel": "Cancel",
|
|
27
|
+
"product-series.actions.createSuccess": "Products created successfully",
|
|
28
|
+
"product-series.actions.createError": "Failed to create products",
|
|
29
|
+
"product-series.actions.updateSuccess": "Products updated successfully",
|
|
30
|
+
"product-series.actions.updateError": "Failed to update products",
|
|
31
|
+
"product-series.actions.selectFields": "Select fields to update",
|
|
32
|
+
"product-series.actions.noDocumentId": "Save the series first before creating products"
|
|
33
|
+
};
|
|
34
|
+
const formatMessage = (arg) => {
|
|
35
|
+
return en[arg.id];
|
|
36
|
+
};
|
|
37
|
+
const valuesToUpdate = [
|
|
38
|
+
"description",
|
|
39
|
+
"shortDescription",
|
|
40
|
+
"media",
|
|
41
|
+
"coverImage",
|
|
42
|
+
"seo",
|
|
43
|
+
"totalCost",
|
|
44
|
+
"wholesalePrice",
|
|
45
|
+
"retailPrice",
|
|
46
|
+
"category",
|
|
47
|
+
"creator"
|
|
48
|
+
];
|
|
49
|
+
const SeriesProductActions = ({ document }) => {
|
|
50
|
+
const { model } = admin.unstable_useContentManagerContext();
|
|
51
|
+
const documentId = document?.documentId;
|
|
52
|
+
const [productCount, setProductCount] = react.useState(1);
|
|
53
|
+
const [isLoading, setIsLoading] = react.useState(false);
|
|
54
|
+
const [fieldsToUpdate, setFieldsToUpdate] = react.useState([]);
|
|
55
|
+
const { post, put } = admin.useFetchClient();
|
|
56
|
+
if (model !== "api::product-series.product-series") return null;
|
|
57
|
+
const handleCreateProducts = async () => {
|
|
58
|
+
try {
|
|
59
|
+
setIsLoading(true);
|
|
60
|
+
const response = await post(
|
|
61
|
+
`primershop-product-actions/create-products`,
|
|
62
|
+
{
|
|
63
|
+
count: productCount,
|
|
64
|
+
id: documentId
|
|
65
|
+
}
|
|
66
|
+
);
|
|
67
|
+
if (!response.data) {
|
|
68
|
+
throw new Error("Failed to create products");
|
|
69
|
+
}
|
|
70
|
+
setProductCount(1);
|
|
71
|
+
} catch (error) {
|
|
72
|
+
console.error("Error creating products:", error);
|
|
73
|
+
} finally {
|
|
74
|
+
setIsLoading(false);
|
|
23
75
|
}
|
|
76
|
+
};
|
|
77
|
+
const handleUpdateProducts = async () => {
|
|
78
|
+
try {
|
|
79
|
+
setIsLoading(true);
|
|
80
|
+
const response = await put(
|
|
81
|
+
`/primershop-product-actions/update-products`,
|
|
82
|
+
{
|
|
83
|
+
seriesId: documentId,
|
|
84
|
+
fieldsToUpdate
|
|
85
|
+
}
|
|
86
|
+
);
|
|
87
|
+
if (!response.data) {
|
|
88
|
+
throw new Error("Failed to update products");
|
|
89
|
+
}
|
|
90
|
+
} catch (error) {
|
|
91
|
+
console.error("Error updating products:", error);
|
|
92
|
+
} finally {
|
|
93
|
+
setIsLoading(false);
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
return {
|
|
97
|
+
title: "Series Product Actions",
|
|
98
|
+
content: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { children: [
|
|
99
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "delta", fontWeight: "bold", children: formatMessage({ id: "product-series.actions.label" }) }),
|
|
100
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { wrap: "wrap", children: [
|
|
101
|
+
!documentId && /* @__PURE__ */ jsxRuntime.jsx(
|
|
102
|
+
designSystem.Typography,
|
|
103
|
+
{
|
|
104
|
+
display: "block",
|
|
105
|
+
marginTop: 2,
|
|
106
|
+
marginBottom: 2,
|
|
107
|
+
width: "100%",
|
|
108
|
+
color: "red",
|
|
109
|
+
children: formatMessage({ id: "product-series.actions.noDocumentId" })
|
|
110
|
+
}
|
|
111
|
+
),
|
|
112
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Dialog.Root, { children: [
|
|
113
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Trigger, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "secondary", disabled: isLoading || !documentId, children: formatMessage({
|
|
114
|
+
id: "product-series.actions.createProducts"
|
|
115
|
+
}) }) }),
|
|
116
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Dialog.Content, { children: [
|
|
117
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Body, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { children: [
|
|
118
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: formatMessage({
|
|
119
|
+
id: "product-series.actions.createDialogTitle"
|
|
120
|
+
}) }),
|
|
121
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
122
|
+
designSystem.NumberInput,
|
|
123
|
+
{
|
|
124
|
+
value: productCount,
|
|
125
|
+
onValueChange: (value) => setProductCount(value || 1),
|
|
126
|
+
min: 1,
|
|
127
|
+
max: 100
|
|
128
|
+
}
|
|
129
|
+
)
|
|
130
|
+
] }) }),
|
|
131
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Dialog.Footer, { children: [
|
|
132
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Cancel, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { fullWidth: true, variant: "tertiary", children: "Cancel" }) }),
|
|
133
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Action, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
134
|
+
designSystem.Button,
|
|
135
|
+
{
|
|
136
|
+
onClick: handleCreateProducts,
|
|
137
|
+
variant: "default",
|
|
138
|
+
loading: isLoading,
|
|
139
|
+
children: formatMessage({ id: "product-series.actions.create" })
|
|
140
|
+
}
|
|
141
|
+
) })
|
|
142
|
+
] })
|
|
143
|
+
] })
|
|
144
|
+
] }),
|
|
145
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Dialog.Root, { children: [
|
|
146
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Trigger, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
147
|
+
designSystem.Button,
|
|
148
|
+
{
|
|
149
|
+
marginLeft: 2,
|
|
150
|
+
variant: "secondary",
|
|
151
|
+
disabled: isLoading || !documentId,
|
|
152
|
+
children: formatMessage({
|
|
153
|
+
id: "product-series.actions.updateProducts"
|
|
154
|
+
})
|
|
155
|
+
}
|
|
156
|
+
) }),
|
|
157
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Dialog.Content, { children: [
|
|
158
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
159
|
+
designSystem.Dialog.Body,
|
|
160
|
+
{
|
|
161
|
+
display: "flex",
|
|
162
|
+
direction: "column",
|
|
163
|
+
gap: 2,
|
|
164
|
+
justifyContent: "center",
|
|
165
|
+
alignItems: "center",
|
|
166
|
+
width: "100%",
|
|
167
|
+
children: [
|
|
168
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "delta", fontWeight: "bold", children: formatMessage({
|
|
169
|
+
id: "product-series.actions.updateDialogTitle"
|
|
170
|
+
}) }),
|
|
171
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: formatMessage({
|
|
172
|
+
id: "product-series.actions.updateDialogDescription"
|
|
173
|
+
}) }),
|
|
174
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
175
|
+
designSystem.MultiSelect,
|
|
176
|
+
{
|
|
177
|
+
withTags: true,
|
|
178
|
+
value: fieldsToUpdate,
|
|
179
|
+
onClear: () => setFieldsToUpdate([]),
|
|
180
|
+
onChange: (value) => setFieldsToUpdate(value),
|
|
181
|
+
required: true,
|
|
182
|
+
placeholder: formatMessage({
|
|
183
|
+
id: "product-series.actions.selectFields"
|
|
184
|
+
}),
|
|
185
|
+
children: valuesToUpdate.map((field) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.MultiSelectOption, { value: field, children: field }, field))
|
|
186
|
+
}
|
|
187
|
+
)
|
|
188
|
+
]
|
|
189
|
+
}
|
|
190
|
+
),
|
|
191
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Dialog.Footer, { children: [
|
|
192
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Cancel, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { fullWidth: true, variant: "tertiary", children: "Cancel" }) }),
|
|
193
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Action, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
194
|
+
designSystem.Button,
|
|
195
|
+
{
|
|
196
|
+
onClick: handleUpdateProducts,
|
|
197
|
+
variant: "default",
|
|
198
|
+
loading: isLoading,
|
|
199
|
+
children: formatMessage({ id: "product-series.actions.update" })
|
|
200
|
+
}
|
|
201
|
+
) })
|
|
202
|
+
] })
|
|
203
|
+
] })
|
|
204
|
+
] })
|
|
205
|
+
] })
|
|
206
|
+
] }) })
|
|
207
|
+
};
|
|
208
|
+
};
|
|
209
|
+
const plugin = {
|
|
210
|
+
register(app) {
|
|
211
|
+
app.registerPlugin({
|
|
212
|
+
id: PLUGIN_ID,
|
|
213
|
+
initializer: Initializer,
|
|
214
|
+
isReady: false,
|
|
215
|
+
name: PLUGIN_ID
|
|
216
|
+
});
|
|
217
|
+
},
|
|
218
|
+
bootstrap(app) {
|
|
219
|
+
app.getPlugin("content-manager").apis.addEditViewSidePanel((panels) => {
|
|
220
|
+
return [...panels, SeriesProductActions];
|
|
221
|
+
});
|
|
222
|
+
}
|
|
24
223
|
};
|
|
25
|
-
|
|
26
224
|
module.exports = plugin;
|
|
27
|
-
//# sourceMappingURL=index.js.map
|
package/dist/admin/index.mjs
CHANGED
|
@@ -1,25 +1,225 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
1
|
+
import { useRef, useEffect, useState } from "react";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Box, Typography, Flex, Dialog, Button, NumberInput, MultiSelect, MultiSelectOption } from "@strapi/design-system";
|
|
4
|
+
import { unstable_useContentManagerContext, useFetchClient } from "@strapi/strapi/admin";
|
|
5
|
+
const PLUGIN_ID = "primershop-product-actions";
|
|
6
|
+
const Initializer = ({ setPlugin }) => {
|
|
7
|
+
const ref = useRef(setPlugin);
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
ref.current(PLUGIN_ID);
|
|
10
|
+
}, []);
|
|
11
|
+
return null;
|
|
12
|
+
};
|
|
13
|
+
const en = {
|
|
14
|
+
"plugin.name": "Product Series",
|
|
15
|
+
"plugin.description": "Manage product series and their products",
|
|
16
|
+
"product-series.actions.label": "Product Actions",
|
|
17
|
+
"product-series.actions.createProducts": "Create Products",
|
|
18
|
+
"product-series.actions.updateProducts": "Update Products",
|
|
19
|
+
"product-series.actions.createDialogTitle": "Create Products from Series",
|
|
20
|
+
"product-series.actions.updateDialogTitle": "Update All Products in Series",
|
|
21
|
+
"product-series.actions.updateDialogDescription": "This will update all products in the series with the selected fields. Make sure to save the series first before updating the products.",
|
|
22
|
+
"product-series.actions.productCount": "Number of Products",
|
|
23
|
+
"product-series.actions.create": "Create",
|
|
24
|
+
"product-series.actions.update": "Update",
|
|
25
|
+
"product-series.actions.cancel": "Cancel",
|
|
26
|
+
"product-series.actions.createSuccess": "Products created successfully",
|
|
27
|
+
"product-series.actions.createError": "Failed to create products",
|
|
28
|
+
"product-series.actions.updateSuccess": "Products updated successfully",
|
|
29
|
+
"product-series.actions.updateError": "Failed to update products",
|
|
30
|
+
"product-series.actions.selectFields": "Select fields to update",
|
|
31
|
+
"product-series.actions.noDocumentId": "Save the series first before creating products"
|
|
32
|
+
};
|
|
33
|
+
const formatMessage = (arg) => {
|
|
34
|
+
return en[arg.id];
|
|
35
|
+
};
|
|
36
|
+
const valuesToUpdate = [
|
|
37
|
+
"description",
|
|
38
|
+
"shortDescription",
|
|
39
|
+
"media",
|
|
40
|
+
"coverImage",
|
|
41
|
+
"seo",
|
|
42
|
+
"totalCost",
|
|
43
|
+
"wholesalePrice",
|
|
44
|
+
"retailPrice",
|
|
45
|
+
"category",
|
|
46
|
+
"creator"
|
|
47
|
+
];
|
|
48
|
+
const SeriesProductActions = ({ document }) => {
|
|
49
|
+
const { model } = unstable_useContentManagerContext();
|
|
50
|
+
const documentId = document?.documentId;
|
|
51
|
+
const [productCount, setProductCount] = useState(1);
|
|
52
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
53
|
+
const [fieldsToUpdate, setFieldsToUpdate] = useState([]);
|
|
54
|
+
const { post, put } = useFetchClient();
|
|
55
|
+
if (model !== "api::product-series.product-series") return null;
|
|
56
|
+
const handleCreateProducts = async () => {
|
|
57
|
+
try {
|
|
58
|
+
setIsLoading(true);
|
|
59
|
+
const response = await post(
|
|
60
|
+
`primershop-product-actions/create-products`,
|
|
61
|
+
{
|
|
62
|
+
count: productCount,
|
|
63
|
+
id: documentId
|
|
64
|
+
}
|
|
65
|
+
);
|
|
66
|
+
if (!response.data) {
|
|
67
|
+
throw new Error("Failed to create products");
|
|
68
|
+
}
|
|
69
|
+
setProductCount(1);
|
|
70
|
+
} catch (error) {
|
|
71
|
+
console.error("Error creating products:", error);
|
|
72
|
+
} finally {
|
|
73
|
+
setIsLoading(false);
|
|
21
74
|
}
|
|
75
|
+
};
|
|
76
|
+
const handleUpdateProducts = async () => {
|
|
77
|
+
try {
|
|
78
|
+
setIsLoading(true);
|
|
79
|
+
const response = await put(
|
|
80
|
+
`/primershop-product-actions/update-products`,
|
|
81
|
+
{
|
|
82
|
+
seriesId: documentId,
|
|
83
|
+
fieldsToUpdate
|
|
84
|
+
}
|
|
85
|
+
);
|
|
86
|
+
if (!response.data) {
|
|
87
|
+
throw new Error("Failed to update products");
|
|
88
|
+
}
|
|
89
|
+
} catch (error) {
|
|
90
|
+
console.error("Error updating products:", error);
|
|
91
|
+
} finally {
|
|
92
|
+
setIsLoading(false);
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
return {
|
|
96
|
+
title: "Series Product Actions",
|
|
97
|
+
content: /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsxs(Box, { children: [
|
|
98
|
+
/* @__PURE__ */ jsx(Typography, { variant: "delta", fontWeight: "bold", children: formatMessage({ id: "product-series.actions.label" }) }),
|
|
99
|
+
/* @__PURE__ */ jsxs(Flex, { wrap: "wrap", children: [
|
|
100
|
+
!documentId && /* @__PURE__ */ jsx(
|
|
101
|
+
Typography,
|
|
102
|
+
{
|
|
103
|
+
display: "block",
|
|
104
|
+
marginTop: 2,
|
|
105
|
+
marginBottom: 2,
|
|
106
|
+
width: "100%",
|
|
107
|
+
color: "red",
|
|
108
|
+
children: formatMessage({ id: "product-series.actions.noDocumentId" })
|
|
109
|
+
}
|
|
110
|
+
),
|
|
111
|
+
/* @__PURE__ */ jsxs(Dialog.Root, { children: [
|
|
112
|
+
/* @__PURE__ */ jsx(Dialog.Trigger, { children: /* @__PURE__ */ jsx(Button, { variant: "secondary", disabled: isLoading || !documentId, children: formatMessage({
|
|
113
|
+
id: "product-series.actions.createProducts"
|
|
114
|
+
}) }) }),
|
|
115
|
+
/* @__PURE__ */ jsxs(Dialog.Content, { children: [
|
|
116
|
+
/* @__PURE__ */ jsx(Dialog.Body, { children: /* @__PURE__ */ jsxs(Box, { children: [
|
|
117
|
+
/* @__PURE__ */ jsx(Typography, { children: formatMessage({
|
|
118
|
+
id: "product-series.actions.createDialogTitle"
|
|
119
|
+
}) }),
|
|
120
|
+
/* @__PURE__ */ jsx(
|
|
121
|
+
NumberInput,
|
|
122
|
+
{
|
|
123
|
+
value: productCount,
|
|
124
|
+
onValueChange: (value) => setProductCount(value || 1),
|
|
125
|
+
min: 1,
|
|
126
|
+
max: 100
|
|
127
|
+
}
|
|
128
|
+
)
|
|
129
|
+
] }) }),
|
|
130
|
+
/* @__PURE__ */ jsxs(Dialog.Footer, { children: [
|
|
131
|
+
/* @__PURE__ */ jsx(Dialog.Cancel, { children: /* @__PURE__ */ jsx(Button, { fullWidth: true, variant: "tertiary", children: "Cancel" }) }),
|
|
132
|
+
/* @__PURE__ */ jsx(Dialog.Action, { children: /* @__PURE__ */ jsx(
|
|
133
|
+
Button,
|
|
134
|
+
{
|
|
135
|
+
onClick: handleCreateProducts,
|
|
136
|
+
variant: "default",
|
|
137
|
+
loading: isLoading,
|
|
138
|
+
children: formatMessage({ id: "product-series.actions.create" })
|
|
139
|
+
}
|
|
140
|
+
) })
|
|
141
|
+
] })
|
|
142
|
+
] })
|
|
143
|
+
] }),
|
|
144
|
+
/* @__PURE__ */ jsxs(Dialog.Root, { children: [
|
|
145
|
+
/* @__PURE__ */ jsx(Dialog.Trigger, { children: /* @__PURE__ */ jsx(
|
|
146
|
+
Button,
|
|
147
|
+
{
|
|
148
|
+
marginLeft: 2,
|
|
149
|
+
variant: "secondary",
|
|
150
|
+
disabled: isLoading || !documentId,
|
|
151
|
+
children: formatMessage({
|
|
152
|
+
id: "product-series.actions.updateProducts"
|
|
153
|
+
})
|
|
154
|
+
}
|
|
155
|
+
) }),
|
|
156
|
+
/* @__PURE__ */ jsxs(Dialog.Content, { children: [
|
|
157
|
+
/* @__PURE__ */ jsxs(
|
|
158
|
+
Dialog.Body,
|
|
159
|
+
{
|
|
160
|
+
display: "flex",
|
|
161
|
+
direction: "column",
|
|
162
|
+
gap: 2,
|
|
163
|
+
justifyContent: "center",
|
|
164
|
+
alignItems: "center",
|
|
165
|
+
width: "100%",
|
|
166
|
+
children: [
|
|
167
|
+
/* @__PURE__ */ jsx(Typography, { variant: "delta", fontWeight: "bold", children: formatMessage({
|
|
168
|
+
id: "product-series.actions.updateDialogTitle"
|
|
169
|
+
}) }),
|
|
170
|
+
/* @__PURE__ */ jsx(Typography, { children: formatMessage({
|
|
171
|
+
id: "product-series.actions.updateDialogDescription"
|
|
172
|
+
}) }),
|
|
173
|
+
/* @__PURE__ */ jsx(
|
|
174
|
+
MultiSelect,
|
|
175
|
+
{
|
|
176
|
+
withTags: true,
|
|
177
|
+
value: fieldsToUpdate,
|
|
178
|
+
onClear: () => setFieldsToUpdate([]),
|
|
179
|
+
onChange: (value) => setFieldsToUpdate(value),
|
|
180
|
+
required: true,
|
|
181
|
+
placeholder: formatMessage({
|
|
182
|
+
id: "product-series.actions.selectFields"
|
|
183
|
+
}),
|
|
184
|
+
children: valuesToUpdate.map((field) => /* @__PURE__ */ jsx(MultiSelectOption, { value: field, children: field }, field))
|
|
185
|
+
}
|
|
186
|
+
)
|
|
187
|
+
]
|
|
188
|
+
}
|
|
189
|
+
),
|
|
190
|
+
/* @__PURE__ */ jsxs(Dialog.Footer, { children: [
|
|
191
|
+
/* @__PURE__ */ jsx(Dialog.Cancel, { children: /* @__PURE__ */ jsx(Button, { fullWidth: true, variant: "tertiary", children: "Cancel" }) }),
|
|
192
|
+
/* @__PURE__ */ jsx(Dialog.Action, { children: /* @__PURE__ */ jsx(
|
|
193
|
+
Button,
|
|
194
|
+
{
|
|
195
|
+
onClick: handleUpdateProducts,
|
|
196
|
+
variant: "default",
|
|
197
|
+
loading: isLoading,
|
|
198
|
+
children: formatMessage({ id: "product-series.actions.update" })
|
|
199
|
+
}
|
|
200
|
+
) })
|
|
201
|
+
] })
|
|
202
|
+
] })
|
|
203
|
+
] })
|
|
204
|
+
] })
|
|
205
|
+
] }) })
|
|
206
|
+
};
|
|
207
|
+
};
|
|
208
|
+
const plugin = {
|
|
209
|
+
register(app) {
|
|
210
|
+
app.registerPlugin({
|
|
211
|
+
id: PLUGIN_ID,
|
|
212
|
+
initializer: Initializer,
|
|
213
|
+
isReady: false,
|
|
214
|
+
name: PLUGIN_ID
|
|
215
|
+
});
|
|
216
|
+
},
|
|
217
|
+
bootstrap(app) {
|
|
218
|
+
app.getPlugin("content-manager").apis.addEditViewSidePanel((panels) => {
|
|
219
|
+
return [...panels, SeriesProductActions];
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
};
|
|
223
|
+
export {
|
|
224
|
+
plugin as default
|
|
22
225
|
};
|
|
23
|
-
|
|
24
|
-
export { plugin as default };
|
|
25
|
-
//# sourceMappingURL=index.mjs.map
|