@primershop/strapi-plugin-product-actions 0.0.10 → 0.0.12

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.
@@ -0,0 +1,17 @@
1
+ 'use strict';
2
+
3
+ var react = require('react');
4
+ var pluginId = require('../../pluginId.js');
5
+
6
+ /**
7
+ * @type {import('react').FC<{ setPlugin: (id: string) => void }>}
8
+ */ const Initializer = ({ setPlugin })=>{
9
+ const ref = react.useRef(setPlugin);
10
+ react.useEffect(()=>{
11
+ ref.current(pluginId.PLUGIN_ID);
12
+ }, []);
13
+ return null;
14
+ };
15
+
16
+ exports.Initializer = Initializer;
17
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../../admin/src/components/Initializer/index.tsx"],"sourcesContent":["import { useEffect, useRef } from \"react\";\r\n\r\nimport { PLUGIN_ID } from \"../../pluginId\";\r\n\r\n/**\r\n * @type {import('react').FC<{ setPlugin: (id: string) => void }>}\r\n */\r\nconst Initializer = ({ setPlugin }: { setPlugin: (id: string) => void }) => {\r\n const ref = useRef(setPlugin);\r\n\r\n useEffect(() => {\r\n ref.current(PLUGIN_ID);\r\n }, []);\r\n\r\n return null;\r\n};\r\n\r\nexport { Initializer };\r\n"],"names":["Initializer","setPlugin","ref","useRef","useEffect","current","PLUGIN_ID"],"mappings":";;;;;AAIA;;AAEC,IACD,MAAMA,WAAAA,GAAc,CAAC,EAAEC,SAAS,EAAuC,GAAA;AACrE,IAAA,MAAMC,MAAMC,YAAAA,CAAOF,SAAAA,CAAAA;IAEnBG,eAAAA,CAAU,IAAA;AACRF,QAAAA,GAAAA,CAAIG,OAAO,CAACC,kBAAAA,CAAAA;AACd,IAAA,CAAA,EAAG,EAAE,CAAA;IAEL,OAAO,IAAA;AACT;;;;"}
@@ -0,0 +1,15 @@
1
+ import { useRef, useEffect } from 'react';
2
+ import { PLUGIN_ID } from '../../pluginId.mjs';
3
+
4
+ /**
5
+ * @type {import('react').FC<{ setPlugin: (id: string) => void }>}
6
+ */ const Initializer = ({ setPlugin })=>{
7
+ const ref = useRef(setPlugin);
8
+ useEffect(()=>{
9
+ ref.current(PLUGIN_ID);
10
+ }, []);
11
+ return null;
12
+ };
13
+
14
+ export { Initializer };
15
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","sources":["../../../../admin/src/components/Initializer/index.tsx"],"sourcesContent":["import { useEffect, useRef } from \"react\";\r\n\r\nimport { PLUGIN_ID } from \"../../pluginId\";\r\n\r\n/**\r\n * @type {import('react').FC<{ setPlugin: (id: string) => void }>}\r\n */\r\nconst Initializer = ({ setPlugin }: { setPlugin: (id: string) => void }) => {\r\n const ref = useRef(setPlugin);\r\n\r\n useEffect(() => {\r\n ref.current(PLUGIN_ID);\r\n }, []);\r\n\r\n return null;\r\n};\r\n\r\nexport { Initializer };\r\n"],"names":["Initializer","setPlugin","ref","useRef","useEffect","current","PLUGIN_ID"],"mappings":";;;AAIA;;AAEC,IACD,MAAMA,WAAAA,GAAc,CAAC,EAAEC,SAAS,EAAuC,GAAA;AACrE,IAAA,MAAMC,MAAMC,MAAAA,CAAOF,SAAAA,CAAAA;IAEnBG,SAAAA,CAAU,IAAA;AACRF,QAAAA,GAAAA,CAAIG,OAAO,CAACC,SAAAA,CAAAA;AACd,IAAA,CAAA,EAAG,EAAE,CAAA;IAEL,OAAO,IAAA;AACT;;;;"}
@@ -0,0 +1,229 @@
1
+ 'use strict';
2
+
3
+ var jsxRuntime = require('react/jsx-runtime');
4
+ var react = require('react');
5
+ var designSystem = require('@strapi/design-system');
6
+ var admin = require('@strapi/strapi/admin');
7
+ var en = require('../../translations/en.js');
8
+
9
+ const formatMessage = (arg)=>{
10
+ return en.en[arg.id];
11
+ };
12
+ const valuesToUpdate = [
13
+ "description",
14
+ "shortDescription",
15
+ "media",
16
+ "coverImage",
17
+ "seo",
18
+ "totalCost",
19
+ "wholesalePrice",
20
+ "retailPrice",
21
+ "category",
22
+ "creator"
23
+ ];
24
+ const SeriesProductActions = ({ document })=>{
25
+ const { model } = admin.unstable_useContentManagerContext();
26
+ const documentId = document?.documentId;
27
+ const [productCount, setProductCount] = react.useState(1);
28
+ const [isLoading, setIsLoading] = react.useState(false);
29
+ const [fieldsToUpdate, setFieldsToUpdate] = react.useState([]);
30
+ const { post, put } = admin.useFetchClient();
31
+ if (model !== "api::product-series.product-series") return null;
32
+ const handleCreateProducts = async ()=>{
33
+ try {
34
+ setIsLoading(true);
35
+ const response = await post(`primershop-product-actions/create-products`, {
36
+ count: productCount,
37
+ id: documentId
38
+ });
39
+ if (!response.data) {
40
+ throw new Error("Failed to create products");
41
+ }
42
+ setProductCount(1);
43
+ } catch (error) {
44
+ console.error("Error creating products:", error);
45
+ } finally{
46
+ setIsLoading(false);
47
+ }
48
+ };
49
+ const handleUpdateProducts = async ()=>{
50
+ try {
51
+ setIsLoading(true);
52
+ const response = await put(`/primershop-product-actions/update-products`, {
53
+ seriesId: documentId,
54
+ fieldsToUpdate
55
+ });
56
+ if (!response.data) {
57
+ throw new Error("Failed to update products");
58
+ }
59
+ } catch (error) {
60
+ console.error("Error updating products:", error);
61
+ } finally{
62
+ setIsLoading(false);
63
+ }
64
+ };
65
+ return {
66
+ title: "Series Product Actions",
67
+ content: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Box, {
68
+ children: /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Box, {
69
+ children: [
70
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Typography, {
71
+ variant: "delta",
72
+ fontWeight: "bold",
73
+ children: formatMessage({
74
+ id: "product-series.actions.label"
75
+ })
76
+ }),
77
+ /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Flex, {
78
+ wrap: "wrap",
79
+ children: [
80
+ !documentId && /*#__PURE__*/ jsxRuntime.jsx(designSystem.Typography, {
81
+ display: "block",
82
+ marginTop: 2,
83
+ marginBottom: 2,
84
+ width: "100%",
85
+ color: "red",
86
+ children: formatMessage({
87
+ id: "product-series.actions.noDocumentId"
88
+ })
89
+ }),
90
+ /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Dialog.Root, {
91
+ children: [
92
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Dialog.Trigger, {
93
+ children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Button, {
94
+ variant: "secondary",
95
+ disabled: isLoading || !documentId,
96
+ children: formatMessage({
97
+ id: "product-series.actions.createProducts"
98
+ })
99
+ })
100
+ }),
101
+ /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Dialog.Content, {
102
+ children: [
103
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Dialog.Body, {
104
+ children: /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Box, {
105
+ children: [
106
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Typography, {
107
+ children: formatMessage({
108
+ id: "product-series.actions.createDialogTitle"
109
+ })
110
+ }),
111
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.NumberInput, {
112
+ value: productCount,
113
+ onValueChange: (value)=>setProductCount(value || 1),
114
+ min: 1,
115
+ max: 100
116
+ })
117
+ ]
118
+ })
119
+ }),
120
+ /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Dialog.Footer, {
121
+ children: [
122
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Dialog.Cancel, {
123
+ children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Button, {
124
+ fullWidth: true,
125
+ variant: "tertiary",
126
+ children: "Cancel"
127
+ })
128
+ }),
129
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Dialog.Action, {
130
+ children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Button, {
131
+ onClick: handleCreateProducts,
132
+ variant: "default",
133
+ loading: isLoading,
134
+ children: formatMessage({
135
+ id: "product-series.actions.create"
136
+ })
137
+ })
138
+ })
139
+ ]
140
+ })
141
+ ]
142
+ })
143
+ ]
144
+ }),
145
+ /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Dialog.Root, {
146
+ children: [
147
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Dialog.Trigger, {
148
+ children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Button, {
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, {
158
+ children: [
159
+ /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Dialog.Body, {
160
+ display: "flex",
161
+ direction: "column",
162
+ gap: 2,
163
+ justifyContent: "center",
164
+ alignItems: "center",
165
+ width: "100%",
166
+ children: [
167
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Typography, {
168
+ variant: "delta",
169
+ fontWeight: "bold",
170
+ children: formatMessage({
171
+ id: "product-series.actions.updateDialogTitle"
172
+ })
173
+ }),
174
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Typography, {
175
+ children: formatMessage({
176
+ id: "product-series.actions.updateDialogDescription"
177
+ })
178
+ }),
179
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.MultiSelect, {
180
+ withTags: true,
181
+ value: fieldsToUpdate,
182
+ onClear: ()=>setFieldsToUpdate([]),
183
+ onChange: (value)=>setFieldsToUpdate(value),
184
+ required: true,
185
+ placeholder: formatMessage({
186
+ id: "product-series.actions.selectFields"
187
+ }),
188
+ children: valuesToUpdate.map((field)=>/*#__PURE__*/ jsxRuntime.jsx(designSystem.MultiSelectOption, {
189
+ value: field,
190
+ children: field
191
+ }, field))
192
+ })
193
+ ]
194
+ }),
195
+ /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Dialog.Footer, {
196
+ children: [
197
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Dialog.Cancel, {
198
+ children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Button, {
199
+ fullWidth: true,
200
+ variant: "tertiary",
201
+ children: "Cancel"
202
+ })
203
+ }),
204
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Dialog.Action, {
205
+ children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Button, {
206
+ onClick: handleUpdateProducts,
207
+ variant: "default",
208
+ loading: isLoading,
209
+ children: formatMessage({
210
+ id: "product-series.actions.update"
211
+ })
212
+ })
213
+ })
214
+ ]
215
+ })
216
+ ]
217
+ })
218
+ ]
219
+ })
220
+ ]
221
+ })
222
+ ]
223
+ })
224
+ })
225
+ };
226
+ };
227
+
228
+ exports.SeriesProductActions = SeriesProductActions;
229
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../../admin/src/components/SeriesProductActions/index.tsx"],"sourcesContent":["import React, { useState } from \"react\";\r\n\r\nimport {\r\n Box,\r\n Button,\r\n Typography,\r\n Dialog,\r\n NumberInput,\r\n Flex,\r\n MultiSelect,\r\n MultiSelectOption,\r\n} from \"@strapi/design-system\";\r\nimport {\r\n useFetchClient,\r\n unstable_useContentManagerContext as useContentManagerContext,\r\n} from \"@strapi/strapi/admin\";\r\n\r\nimport { en } from \"../../translations\";\r\n\r\nconst formatMessage = (arg: { id: string }): string => {\r\n return en[arg.id];\r\n};\r\n\r\nconst valuesToUpdate = [\r\n \"description\",\r\n \"shortDescription\",\r\n \"media\",\r\n \"coverImage\",\r\n \"seo\",\r\n \"totalCost\",\r\n \"wholesalePrice\",\r\n \"retailPrice\",\r\n \"category\",\r\n \"creator\",\r\n];\r\n\r\ninterface Document {\r\n documentId?: string;\r\n}\r\n\r\nconst SeriesProductActions = ({ document }: { document: Document }) => {\r\n const { model } = useContentManagerContext();\r\n const documentId = document?.documentId;\r\n const [productCount, setProductCount] = useState(1);\r\n const [isLoading, setIsLoading] = useState(false);\r\n const [fieldsToUpdate, setFieldsToUpdate] = useState<string[]>([]);\r\n const { post, put } = useFetchClient();\r\n\r\n if (model !== \"api::product-series.product-series\") return null;\r\n\r\n const handleCreateProducts = async () => {\r\n try {\r\n setIsLoading(true);\r\n const response = await post(\r\n `primershop-product-actions/create-products`,\r\n {\r\n count: productCount,\r\n id: documentId,\r\n }\r\n );\r\n\r\n if (!response.data) {\r\n throw new Error(\"Failed to create products\");\r\n }\r\n\r\n setProductCount(1);\r\n } catch (error) {\r\n console.error(\"Error creating products:\", error);\r\n } finally {\r\n setIsLoading(false);\r\n }\r\n };\r\n\r\n const handleUpdateProducts = async () => {\r\n try {\r\n setIsLoading(true);\r\n const response = await put(\r\n `/primershop-product-actions/update-products`,\r\n {\r\n seriesId: documentId,\r\n fieldsToUpdate,\r\n }\r\n );\r\n\r\n if (!response.data) {\r\n throw new Error(\"Failed to update products\");\r\n }\r\n } catch (error) {\r\n console.error(\"Error updating products:\", error);\r\n } finally {\r\n setIsLoading(false);\r\n }\r\n };\r\n return {\r\n title: \"Series Product Actions\",\r\n content: (\r\n <Box>\r\n <Box>\r\n <Typography variant=\"delta\" fontWeight=\"bold\">\r\n {formatMessage({ id: \"product-series.actions.label\" })}\r\n </Typography>\r\n <Flex wrap={\"wrap\"}>\r\n {!documentId && (\r\n <Typography\r\n display={\"block\"}\r\n marginTop={2}\r\n marginBottom={2}\r\n width=\"100%\"\r\n color=\"red\"\r\n >\r\n {formatMessage({ id: \"product-series.actions.noDocumentId\" })}\r\n </Typography>\r\n )}\r\n\r\n <Dialog.Root>\r\n <Dialog.Trigger>\r\n <Button variant=\"secondary\" disabled={isLoading || !documentId}>\r\n {formatMessage({\r\n id: \"product-series.actions.createProducts\",\r\n })}\r\n </Button>\r\n </Dialog.Trigger>\r\n <Dialog.Content>\r\n <Dialog.Body>\r\n <Box>\r\n <Typography>\r\n {formatMessage({\r\n id: \"product-series.actions.createDialogTitle\",\r\n })}\r\n </Typography>\r\n <NumberInput\r\n value={productCount}\r\n onValueChange={(value) => setProductCount(value || 1)}\r\n min={1}\r\n max={100}\r\n ></NumberInput>\r\n </Box>\r\n </Dialog.Body>\r\n <Dialog.Footer>\r\n <Dialog.Cancel>\r\n <Button fullWidth variant=\"tertiary\">\r\n Cancel\r\n </Button>\r\n </Dialog.Cancel>\r\n <Dialog.Action>\r\n <Button\r\n onClick={handleCreateProducts}\r\n variant=\"default\"\r\n loading={isLoading}\r\n >\r\n {formatMessage({ id: \"product-series.actions.create\" })}\r\n </Button>\r\n </Dialog.Action>\r\n </Dialog.Footer>\r\n </Dialog.Content>\r\n </Dialog.Root>\r\n\r\n {/* Update Products Dialog */}\r\n <Dialog.Root>\r\n <Dialog.Trigger>\r\n <Button\r\n marginLeft={2}\r\n variant=\"secondary\"\r\n disabled={isLoading || !documentId}\r\n >\r\n {formatMessage({\r\n id: \"product-series.actions.updateProducts\",\r\n })}\r\n </Button>\r\n </Dialog.Trigger>\r\n <Dialog.Content>\r\n <Dialog.Body\r\n display={\"flex\"}\r\n direction={\"column\"}\r\n gap={2}\r\n justifyContent={\"center\"}\r\n alignItems={\"center\"}\r\n width={\"100%\"}\r\n >\r\n <Typography variant=\"delta\" fontWeight=\"bold\">\r\n {formatMessage({\r\n id: \"product-series.actions.updateDialogTitle\",\r\n })}\r\n </Typography>\r\n <Typography>\r\n {formatMessage({\r\n id: \"product-series.actions.updateDialogDescription\",\r\n })}\r\n </Typography>\r\n <MultiSelect\r\n withTags={true}\r\n value={fieldsToUpdate}\r\n onClear={() => setFieldsToUpdate([])}\r\n onChange={(value: string[]) => setFieldsToUpdate(value)}\r\n required={true}\r\n placeholder={formatMessage({\r\n id: \"product-series.actions.selectFields\",\r\n })}\r\n >\r\n {valuesToUpdate.map((field) => (\r\n <MultiSelectOption key={field} value={field}>\r\n {field}\r\n </MultiSelectOption>\r\n ))}\r\n </MultiSelect>\r\n </Dialog.Body>\r\n <Dialog.Footer>\r\n <Dialog.Cancel>\r\n <Button fullWidth variant=\"tertiary\">\r\n Cancel\r\n </Button>\r\n </Dialog.Cancel>\r\n <Dialog.Action>\r\n <Button\r\n onClick={handleUpdateProducts}\r\n variant=\"default\"\r\n loading={isLoading}\r\n >\r\n {formatMessage({ id: \"product-series.actions.update\" })}\r\n </Button>\r\n </Dialog.Action>\r\n </Dialog.Footer>\r\n </Dialog.Content>\r\n </Dialog.Root>\r\n </Flex>\r\n </Box>\r\n </Box>\r\n ),\r\n };\r\n};\r\n\r\nexport { SeriesProductActions };\r\n"],"names":["formatMessage","arg","en","id","valuesToUpdate","SeriesProductActions","document","model","useContentManagerContext","documentId","productCount","setProductCount","useState","isLoading","setIsLoading","fieldsToUpdate","setFieldsToUpdate","post","put","useFetchClient","handleCreateProducts","response","count","data","Error","error","console","handleUpdateProducts","seriesId","title","content","_jsx","Box","_jsxs","Typography","variant","fontWeight","Flex","wrap","display","marginTop","marginBottom","width","color","Dialog","Root","Trigger","Button","disabled","Content","Body","NumberInput","value","onValueChange","min","max","Footer","Cancel","fullWidth","Action","onClick","loading","marginLeft","direction","gap","justifyContent","alignItems","MultiSelect","withTags","onClear","onChange","required","placeholder","map","field","MultiSelectOption"],"mappings":";;;;;;;;AAmBA,MAAMA,gBAAgB,CAACC,GAAAA,GAAAA;AACrB,IAAA,OAAOC,KAAE,CAACD,GAAAA,CAAIE,EAAE,CAAC;AACnB,CAAA;AAEA,MAAMC,cAAAA,GAAiB;AACrB,IAAA,aAAA;AACA,IAAA,kBAAA;AACA,IAAA,OAAA;AACA,IAAA,YAAA;AACA,IAAA,KAAA;AACA,IAAA,WAAA;AACA,IAAA,gBAAA;AACA,IAAA,aAAA;AACA,IAAA,UAAA;AACA,IAAA;AACD,CAAA;AAMD,MAAMC,oBAAAA,GAAuB,CAAC,EAAEC,QAAQ,EAA0B,GAAA;IAChE,MAAM,EAAEC,KAAK,EAAE,GAAGC,uCAAAA,EAAAA;AAClB,IAAA,MAAMC,aAAaH,QAAAA,EAAUG,UAAAA;AAC7B,IAAA,MAAM,CAACC,YAAAA,EAAcC,eAAAA,CAAgB,GAAGC,cAAAA,CAAS,CAAA,CAAA;AACjD,IAAA,MAAM,CA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AAA;4DACTQ,OAAAA,EAAQ,SAAA;4DACR0B,OAAAA,EAAShD,SAAAA;sEAERb,aAAAA,CAAc;gEAAEG,EAAAA,EAAI;AAAgC,6DAAA;;;;;;;;;;;;;;AAUzE,KAAA;AACF;;;;"}
@@ -0,0 +1,227 @@
1
+ import { jsx, jsxs } from 'react/jsx-runtime';
2
+ import { useState } from 'react';
3
+ import { Box, Typography, Flex, Dialog, Button, NumberInput, MultiSelect, MultiSelectOption } from '@strapi/design-system';
4
+ import { unstable_useContentManagerContext, useFetchClient } from '@strapi/strapi/admin';
5
+ import { en } from '../../translations/en.mjs';
6
+
7
+ const formatMessage = (arg)=>{
8
+ return en[arg.id];
9
+ };
10
+ const valuesToUpdate = [
11
+ "description",
12
+ "shortDescription",
13
+ "media",
14
+ "coverImage",
15
+ "seo",
16
+ "totalCost",
17
+ "wholesalePrice",
18
+ "retailPrice",
19
+ "category",
20
+ "creator"
21
+ ];
22
+ const SeriesProductActions = ({ document })=>{
23
+ const { model } = unstable_useContentManagerContext();
24
+ const documentId = document?.documentId;
25
+ const [productCount, setProductCount] = useState(1);
26
+ const [isLoading, setIsLoading] = useState(false);
27
+ const [fieldsToUpdate, setFieldsToUpdate] = useState([]);
28
+ const { post, put } = useFetchClient();
29
+ if (model !== "api::product-series.product-series") return null;
30
+ const handleCreateProducts = async ()=>{
31
+ try {
32
+ setIsLoading(true);
33
+ const response = await post(`primershop-product-actions/create-products`, {
34
+ count: productCount,
35
+ id: documentId
36
+ });
37
+ if (!response.data) {
38
+ throw new Error("Failed to create products");
39
+ }
40
+ setProductCount(1);
41
+ } catch (error) {
42
+ console.error("Error creating products:", error);
43
+ } finally{
44
+ setIsLoading(false);
45
+ }
46
+ };
47
+ const handleUpdateProducts = async ()=>{
48
+ try {
49
+ setIsLoading(true);
50
+ const response = await put(`/primershop-product-actions/update-products`, {
51
+ seriesId: documentId,
52
+ fieldsToUpdate
53
+ });
54
+ if (!response.data) {
55
+ throw new Error("Failed to update products");
56
+ }
57
+ } catch (error) {
58
+ console.error("Error updating products:", error);
59
+ } finally{
60
+ setIsLoading(false);
61
+ }
62
+ };
63
+ return {
64
+ title: "Series Product Actions",
65
+ content: /*#__PURE__*/ jsx(Box, {
66
+ children: /*#__PURE__*/ jsxs(Box, {
67
+ children: [
68
+ /*#__PURE__*/ jsx(Typography, {
69
+ variant: "delta",
70
+ fontWeight: "bold",
71
+ children: formatMessage({
72
+ id: "product-series.actions.label"
73
+ })
74
+ }),
75
+ /*#__PURE__*/ jsxs(Flex, {
76
+ wrap: "wrap",
77
+ children: [
78
+ !documentId && /*#__PURE__*/ jsx(Typography, {
79
+ display: "block",
80
+ marginTop: 2,
81
+ marginBottom: 2,
82
+ width: "100%",
83
+ color: "red",
84
+ children: formatMessage({
85
+ id: "product-series.actions.noDocumentId"
86
+ })
87
+ }),
88
+ /*#__PURE__*/ jsxs(Dialog.Root, {
89
+ children: [
90
+ /*#__PURE__*/ jsx(Dialog.Trigger, {
91
+ children: /*#__PURE__*/ jsx(Button, {
92
+ variant: "secondary",
93
+ disabled: isLoading || !documentId,
94
+ children: formatMessage({
95
+ id: "product-series.actions.createProducts"
96
+ })
97
+ })
98
+ }),
99
+ /*#__PURE__*/ jsxs(Dialog.Content, {
100
+ children: [
101
+ /*#__PURE__*/ jsx(Dialog.Body, {
102
+ children: /*#__PURE__*/ jsxs(Box, {
103
+ children: [
104
+ /*#__PURE__*/ jsx(Typography, {
105
+ children: formatMessage({
106
+ id: "product-series.actions.createDialogTitle"
107
+ })
108
+ }),
109
+ /*#__PURE__*/ jsx(NumberInput, {
110
+ value: productCount,
111
+ onValueChange: (value)=>setProductCount(value || 1),
112
+ min: 1,
113
+ max: 100
114
+ })
115
+ ]
116
+ })
117
+ }),
118
+ /*#__PURE__*/ jsxs(Dialog.Footer, {
119
+ children: [
120
+ /*#__PURE__*/ jsx(Dialog.Cancel, {
121
+ children: /*#__PURE__*/ jsx(Button, {
122
+ fullWidth: true,
123
+ variant: "tertiary",
124
+ children: "Cancel"
125
+ })
126
+ }),
127
+ /*#__PURE__*/ jsx(Dialog.Action, {
128
+ children: /*#__PURE__*/ jsx(Button, {
129
+ onClick: handleCreateProducts,
130
+ variant: "default",
131
+ loading: isLoading,
132
+ children: formatMessage({
133
+ id: "product-series.actions.create"
134
+ })
135
+ })
136
+ })
137
+ ]
138
+ })
139
+ ]
140
+ })
141
+ ]
142
+ }),
143
+ /*#__PURE__*/ jsxs(Dialog.Root, {
144
+ children: [
145
+ /*#__PURE__*/ jsx(Dialog.Trigger, {
146
+ children: /*#__PURE__*/ jsx(Button, {
147
+ marginLeft: 2,
148
+ variant: "secondary",
149
+ disabled: isLoading || !documentId,
150
+ children: formatMessage({
151
+ id: "product-series.actions.updateProducts"
152
+ })
153
+ })
154
+ }),
155
+ /*#__PURE__*/ jsxs(Dialog.Content, {
156
+ children: [
157
+ /*#__PURE__*/ jsxs(Dialog.Body, {
158
+ display: "flex",
159
+ direction: "column",
160
+ gap: 2,
161
+ justifyContent: "center",
162
+ alignItems: "center",
163
+ width: "100%",
164
+ children: [
165
+ /*#__PURE__*/ jsx(Typography, {
166
+ variant: "delta",
167
+ fontWeight: "bold",
168
+ children: formatMessage({
169
+ id: "product-series.actions.updateDialogTitle"
170
+ })
171
+ }),
172
+ /*#__PURE__*/ jsx(Typography, {
173
+ children: formatMessage({
174
+ id: "product-series.actions.updateDialogDescription"
175
+ })
176
+ }),
177
+ /*#__PURE__*/ jsx(MultiSelect, {
178
+ withTags: true,
179
+ value: fieldsToUpdate,
180
+ onClear: ()=>setFieldsToUpdate([]),
181
+ onChange: (value)=>setFieldsToUpdate(value),
182
+ required: true,
183
+ placeholder: formatMessage({
184
+ id: "product-series.actions.selectFields"
185
+ }),
186
+ children: valuesToUpdate.map((field)=>/*#__PURE__*/ jsx(MultiSelectOption, {
187
+ value: field,
188
+ children: field
189
+ }, field))
190
+ })
191
+ ]
192
+ }),
193
+ /*#__PURE__*/ jsxs(Dialog.Footer, {
194
+ children: [
195
+ /*#__PURE__*/ jsx(Dialog.Cancel, {
196
+ children: /*#__PURE__*/ jsx(Button, {
197
+ fullWidth: true,
198
+ variant: "tertiary",
199
+ children: "Cancel"
200
+ })
201
+ }),
202
+ /*#__PURE__*/ jsx(Dialog.Action, {
203
+ children: /*#__PURE__*/ jsx(Button, {
204
+ onClick: handleUpdateProducts,
205
+ variant: "default",
206
+ loading: isLoading,
207
+ children: formatMessage({
208
+ id: "product-series.actions.update"
209
+ })
210
+ })
211
+ })
212
+ ]
213
+ })
214
+ ]
215
+ })
216
+ ]
217
+ })
218
+ ]
219
+ })
220
+ ]
221
+ })
222
+ })
223
+ };
224
+ };
225
+
226
+ export { SeriesProductActions };
227
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","sources":["../../../../admin/src/components/SeriesProductActions/index.tsx"],"sourcesContent":["import React, { useState } from \"react\";\r\n\r\nimport {\r\n Box,\r\n Button,\r\n Typography,\r\n Dialog,\r\n NumberInput,\r\n Flex,\r\n MultiSelect,\r\n MultiSelectOption,\r\n} from \"@strapi/design-system\";\r\nimport {\r\n useFetchClient,\r\n unstable_useContentManagerContext as useContentManagerContext,\r\n} from \"@strapi/strapi/admin\";\r\n\r\nimport { en } from \"../../translations\";\r\n\r\nconst formatMessage = (arg: { id: string }): string => {\r\n return en[arg.id];\r\n};\r\n\r\nconst valuesToUpdate = [\r\n \"description\",\r\n \"shortDescription\",\r\n \"media\",\r\n \"coverImage\",\r\n \"seo\",\r\n \"totalCost\",\r\n \"wholesalePrice\",\r\n \"retailPrice\",\r\n \"category\",\r\n \"creator\",\r\n];\r\n\r\ninterface Document {\r\n documentId?: string;\r\n}\r\n\r\nconst SeriesProductActions = ({ document }: { document: Document }) => {\r\n const { model } = useContentManagerContext();\r\n const documentId = document?.documentId;\r\n const [productCount, setProductCount] = useState(1);\r\n const [isLoading, setIsLoading] = useState(false);\r\n const [fieldsToUpdate, setFieldsToUpdate] = useState<string[]>([]);\r\n const { post, put } = useFetchClient();\r\n\r\n if (model !== \"api::product-series.product-series\") return null;\r\n\r\n const handleCreateProducts = async () => {\r\n try {\r\n setIsLoading(true);\r\n const response = await post(\r\n `primershop-product-actions/create-products`,\r\n {\r\n count: productCount,\r\n id: documentId,\r\n }\r\n );\r\n\r\n if (!response.data) {\r\n throw new Error(\"Failed to create products\");\r\n }\r\n\r\n setProductCount(1);\r\n } catch (error) {\r\n console.error(\"Error creating products:\", error);\r\n } finally {\r\n setIsLoading(false);\r\n }\r\n };\r\n\r\n const handleUpdateProducts = async () => {\r\n try {\r\n setIsLoading(true);\r\n const response = await put(\r\n `/primershop-product-actions/update-products`,\r\n {\r\n seriesId: documentId,\r\n fieldsToUpdate,\r\n }\r\n );\r\n\r\n if (!response.data) {\r\n throw new Error(\"Failed to update products\");\r\n }\r\n } catch (error) {\r\n console.error(\"Error updating products:\", error);\r\n } finally {\r\n setIsLoading(false);\r\n }\r\n };\r\n return {\r\n title: \"Series Product Actions\",\r\n content: (\r\n <Box>\r\n <Box>\r\n <Typography variant=\"delta\" fontWeight=\"bold\">\r\n {formatMessage({ id: \"product-series.actions.label\" })}\r\n </Typography>\r\n <Flex wrap={\"wrap\"}>\r\n {!documentId && (\r\n <Typography\r\n display={\"block\"}\r\n marginTop={2}\r\n marginBottom={2}\r\n width=\"100%\"\r\n color=\"red\"\r\n >\r\n {formatMessage({ id: \"product-series.actions.noDocumentId\" })}\r\n </Typography>\r\n )}\r\n\r\n <Dialog.Root>\r\n <Dialog.Trigger>\r\n <Button variant=\"secondary\" disabled={isLoading || !documentId}>\r\n {formatMessage({\r\n id: \"product-series.actions.createProducts\",\r\n })}\r\n </Button>\r\n </Dialog.Trigger>\r\n <Dialog.Content>\r\n <Dialog.Body>\r\n <Box>\r\n <Typography>\r\n {formatMessage({\r\n id: \"product-series.actions.createDialogTitle\",\r\n })}\r\n </Typography>\r\n <NumberInput\r\n value={productCount}\r\n onValueChange={(value) => setProductCount(value || 1)}\r\n min={1}\r\n max={100}\r\n ></NumberInput>\r\n </Box>\r\n </Dialog.Body>\r\n <Dialog.Footer>\r\n <Dialog.Cancel>\r\n <Button fullWidth variant=\"tertiary\">\r\n Cancel\r\n </Button>\r\n </Dialog.Cancel>\r\n <Dialog.Action>\r\n <Button\r\n onClick={handleCreateProducts}\r\n variant=\"default\"\r\n loading={isLoading}\r\n >\r\n {formatMessage({ id: \"product-series.actions.create\" })}\r\n </Button>\r\n </Dialog.Action>\r\n </Dialog.Footer>\r\n </Dialog.Content>\r\n </Dialog.Root>\r\n\r\n {/* Update Products Dialog */}\r\n <Dialog.Root>\r\n <Dialog.Trigger>\r\n <Button\r\n marginLeft={2}\r\n variant=\"secondary\"\r\n disabled={isLoading || !documentId}\r\n >\r\n {formatMessage({\r\n id: \"product-series.actions.updateProducts\",\r\n })}\r\n </Button>\r\n </Dialog.Trigger>\r\n <Dialog.Content>\r\n <Dialog.Body\r\n display={\"flex\"}\r\n direction={\"column\"}\r\n gap={2}\r\n justifyContent={\"center\"}\r\n alignItems={\"center\"}\r\n width={\"100%\"}\r\n >\r\n <Typography variant=\"delta\" fontWeight=\"bold\">\r\n {formatMessage({\r\n id: \"product-series.actions.updateDialogTitle\",\r\n })}\r\n </Typography>\r\n <Typography>\r\n {formatMessage({\r\n id: \"product-series.actions.updateDialogDescription\",\r\n })}\r\n </Typography>\r\n <MultiSelect\r\n withTags={true}\r\n value={fieldsToUpdate}\r\n onClear={() => setFieldsToUpdate([])}\r\n onChange={(value: string[]) => setFieldsToUpdate(value)}\r\n required={true}\r\n placeholder={formatMessage({\r\n id: \"product-series.actions.selectFields\",\r\n })}\r\n >\r\n {valuesToUpdate.map((field) => (\r\n <MultiSelectOption key={field} value={field}>\r\n {field}\r\n </MultiSelectOption>\r\n ))}\r\n </MultiSelect>\r\n </Dialog.Body>\r\n <Dialog.Footer>\r\n <Dialog.Cancel>\r\n <Button fullWidth variant=\"tertiary\">\r\n Cancel\r\n </Button>\r\n </Dialog.Cancel>\r\n <Dialog.Action>\r\n <Button\r\n onClick={handleUpdateProducts}\r\n variant=\"default\"\r\n loading={isLoading}\r\n >\r\n {formatMessage({ id: \"product-series.actions.update\" })}\r\n </Button>\r\n </Dialog.Action>\r\n </Dialog.Footer>\r\n </Dialog.Content>\r\n </Dialog.Root>\r\n </Flex>\r\n </Box>\r\n </Box>\r\n ),\r\n };\r\n};\r\n\r\nexport { SeriesProductActions };\r\n"],"names":["formatMessage","arg","en","id","valuesToUpdate","SeriesProductActions","document","model","useContentManagerContext","documentId","productCount","setProductCount","useState","isLoading","setIsLoading","fieldsToUpdate","setFieldsToUpdate","post","put","useFetchClient","handleCreateProducts","response","count","data","Error","error","console","handleUpdateProducts","seriesId","title","content","_jsx","Box","_jsxs","Typography","variant","fontWeight","Flex","wrap","display","marginTop","marginBottom","width","color","Dialog","Root","Trigger","Button","disabled","Content","Body","NumberInput","value","onValueChange","min","max","Footer","Cancel","fullWidth","Action","onClick","loading","marginLeft","direction","gap","justifyContent","alignItems","MultiSelect","withTags","onClear","onChange","required","placeholder","map","field","MultiSelectOption"],"mappings":";;;;;;AAmBA,MAAMA,gBAAgB,CAACC,GAAAA,GAAAA;AACrB,IAAA,OAAOC,EAAE,CAACD,GAAAA,CAAIE,EAAE,CAAC;AACnB,CAAA;AAEA,MAAMC,cAAAA,GAAiB;AACrB,IAAA,aAAA;AACA,IAAA,kBAAA;AACA,IAAA,OAAA;AACA,IAAA,YAAA;AACA,IAAA,KAAA;AACA,IAAA,WAAA;AACA,IAAA,gBAAA;AACA,IAAA,aAAA;AACA,IAAA,UAAA;AACA,IAAA;AACD,CAAA;AAMD,MAAMC,oBAAAA,GAAuB,CAAC,EAAEC,QAAQ,EAA0B,GAAA;IAChE,MAAM,EAAEC,KAAK,EAAE,GAAGC,iCAAAA,EAAAA;AAClB,IAAA,MAAMC,aAAaH,QAAAA,EAAUG,UAAAA;AAC7B,IAAA,MAAM,CAACC,YAAAA,EAAcC,eAAAA,CAAgB,GAAGC,QAAAA,CAAS,CAAA,CAAA;A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