@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.
Files changed (61) hide show
  1. package/dist/admin/index.js +221 -24
  2. package/dist/admin/index.mjs +223 -23
  3. package/dist/server/index.js +240 -16
  4. package/dist/server/index.mjs +243 -16
  5. package/package.json +11 -10
  6. package/dist/admin/components/Initializer/index.js +0 -17
  7. package/dist/admin/components/Initializer/index.js.map +0 -1
  8. package/dist/admin/components/Initializer/index.mjs +0 -15
  9. package/dist/admin/components/Initializer/index.mjs.map +0 -1
  10. package/dist/admin/components/SeriesProductActions/index.js +0 -229
  11. package/dist/admin/components/SeriesProductActions/index.js.map +0 -1
  12. package/dist/admin/components/SeriesProductActions/index.mjs +0 -227
  13. package/dist/admin/components/SeriesProductActions/index.mjs.map +0 -1
  14. package/dist/admin/index.js.map +0 -1
  15. package/dist/admin/index.mjs.map +0 -1
  16. package/dist/admin/pluginId.js +0 -6
  17. package/dist/admin/pluginId.js.map +0 -1
  18. package/dist/admin/pluginId.mjs +0 -4
  19. package/dist/admin/pluginId.mjs.map +0 -1
  20. package/dist/admin/translations/en.js +0 -25
  21. package/dist/admin/translations/en.js.map +0 -1
  22. package/dist/admin/translations/en.mjs +0 -23
  23. package/dist/admin/translations/en.mjs.map +0 -1
  24. package/dist/server/bootstrap.js +0 -16
  25. package/dist/server/bootstrap.js.map +0 -1
  26. package/dist/server/bootstrap.mjs +0 -14
  27. package/dist/server/bootstrap.mjs.map +0 -1
  28. package/dist/server/controllers/index.js +0 -10
  29. package/dist/server/controllers/index.js.map +0 -1
  30. package/dist/server/controllers/index.mjs +0 -8
  31. package/dist/server/controllers/index.mjs.map +0 -1
  32. package/dist/server/controllers/product-series.js +0 -29
  33. package/dist/server/controllers/product-series.js.map +0 -1
  34. package/dist/server/controllers/product-series.mjs +0 -27
  35. package/dist/server/controllers/product-series.mjs.map +0 -1
  36. package/dist/server/index.js.map +0 -1
  37. package/dist/server/index.mjs.map +0 -1
  38. package/dist/server/permissions.js +0 -51
  39. package/dist/server/permissions.js.map +0 -1
  40. package/dist/server/permissions.mjs +0 -49
  41. package/dist/server/permissions.mjs.map +0 -1
  42. package/dist/server/register.js +0 -7
  43. package/dist/server/register.js.map +0 -1
  44. package/dist/server/register.mjs +0 -5
  45. package/dist/server/register.mjs.map +0 -1
  46. package/dist/server/routes/admin.js +0 -44
  47. package/dist/server/routes/admin.js.map +0 -1
  48. package/dist/server/routes/admin.mjs +0 -42
  49. package/dist/server/routes/admin.mjs.map +0 -1
  50. package/dist/server/routes/index.js +0 -10
  51. package/dist/server/routes/index.js.map +0 -1
  52. package/dist/server/routes/index.mjs +0 -8
  53. package/dist/server/routes/index.mjs.map +0 -1
  54. package/dist/server/services/index.js +0 -10
  55. package/dist/server/services/index.js.map +0 -1
  56. package/dist/server/services/index.mjs +0 -8
  57. package/dist/server/services/index.mjs.map +0 -1
  58. package/dist/server/services/product-series.js +0 -113
  59. package/dist/server/services/product-series.js.map +0 -1
  60. package/dist/server/services/product-series.mjs +0 -111
  61. package/dist/server/services/product-series.mjs.map +0 -1
@@ -1,229 +0,0 @@
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
@@ -1 +0,0 @@
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,CAACC,SAAAA,EAAWC,YAAAA,CAAa,GAAGF,cAAAA,CAAS,KAAA,CAAA;AAC3C,IAAA,MAAM,CAACG,cAAAA,EAAgBC,iBAAAA,CAAkB,GAAGJ,eAAmB,EAAE,CAAA;AACjE,IAAA,MAAM,EAAEK,IAAI,EAAEC,GAAG,EAAE,GAAGC,oBAAAA,EAAAA;IAEtB,IAAIZ,KAAAA,KAAU,sCAAsC,OAAO,IAAA;AAE3D,IAAA,MAAMa,oBAAAA,GAAuB,UAAA;QAC3B,IAAI;YACFN,YAAAA,CAAa,IAAA,CAAA;AACb,YAAA,MAAMO,WAAW,MAAMJ,IAAAA,CACrB,CAAC,0CAA0C,CAAC,EAC5C;gBACEK,KAAAA,EAAOZ,YAAAA;gBAC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ACnCsD,QAAAA,EAAU,CAAClB,QAAoBpC,iBAAAA,CAAkBoC,KAAAA,CAAAA;wDACjDmB,QAAAA,EAAU,IAAA;AACVC,wDAAAA,WAAAA,EAAaxE,aAAAA,CAAc;4DACzBG,EAAAA,EAAI;AACN,yDAAA,CAAA;AAECC,wDAAAA,QAAAA,EAAAA,cAAAA,CAAeqE,GAAG,CAAC,CAACC,KAAAA,iBACnB3C,cAAA,CAAC4C,8BAAAA,EAAAA;gEAA8BvB,KAAAA,EAAOsB,KAAAA;AACnCA,gEAAAA,QAAAA,EAAAA;AADqBA,6DAAAA,EAAAA,KAAAA,CAAAA;;;;AAM9B,0DAAAzC,eAAA,CAACW,oBAAOY,MAAM,EAAA;;AACZ,kEAAAzB,cAAA,CAACa,oBAAOa,MAAM,EAAA;AACZ,wDAAA,QAAA,gBAAA1B,cAAA,CAACgB,mBAAAA,EAAAA;4DAAOW,SAAS,EAAA,IAAA;4DAACvB,OAAAA,EAAQ,UAAA;AAAW,4DAAA,QAAA,EAAA;;;AAIvC,kEAAAJ,cAAA,CAACa,oBAAOe,MAAM,EAAA;AACZ,wDAAA,QAAA,gBAAA5B,cAAA,CAACgB,mBAAAA,EAAAA;4DACCa,OAAAA,EAASjC,oBAAAA;4DACTQ,OAAAA,EAAQ,SAAA;4DACR0B,OAAAA,EAAShD,SAAAA;sEAERb,aAAAA,CAAc;gEAAEG,EAAAA,EAAI;AAAgC,6DAAA;;;;;;;;;;;;;;AAUzE,KAAA;AACF;;;;"}
@@ -1,227 +0,0 @@
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
@@ -1 +0,0 @@
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,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AAAA;gEAA8BvB,KAAAA,EAAOsB,KAAAA;AACnCA,gEAAAA,QAAAA,EAAAA;AADqBA,6DAAAA,EAAAA,KAAAA,CAAAA;;;;AAM9B,0DAAAzC,IAAA,CAACW,OAAOY,MAAM,EAAA;;AACZ,kEAAAzB,GAAA,CAACa,OAAOa,MAAM,EAAA;AACZ,wDAAA,QAAA,gBAAA1B,GAAA,CAACgB,MAAAA,EAAAA;4DAAOW,SAAS,EAAA,IAAA;4DAACvB,OAAAA,EAAQ,UAAA;AAAW,4DAAA,QAAA,EAAA;;;AAIvC,kEAAAJ,GAAA,CAACa,OAAOe,MAAM,EAAA;AACZ,wDAAA,QAAA,gBAAA5B,GAAA,CAACgB,MAAAA,EAAAA;4DACCa,OAAAA,EAASjC,oBAAAA;4DACTQ,OAAAA,EAAQ,SAAA;4DACR0B,OAAAA,EAAShD,SAAAA;sEAERb,aAAAA,CAAc;gEAAEG,EAAAA,EAAI;AAAgC,6DAAA;;;;;;;;;;;;;;AAUzE,KAAA;AACF;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":["../../admin/src/index.ts"],"sourcesContent":["import { Initializer } from \"./components/Initializer\";\r\nimport { SeriesProductActions } from \"./components/SeriesProductActions\";\r\nimport { PLUGIN_ID } from \"./pluginId\";\r\n\r\nimport type { PanelComponent } from \"@strapi/content-manager/strapi-admin\";\r\n\r\nconst plugin = {\r\n register(app: any) {\r\n app.registerPlugin({\r\n id: PLUGIN_ID,\r\n initializer: Initializer,\r\n isReady: false,\r\n name: PLUGIN_ID,\r\n });\r\n },\r\n\r\n bootstrap(app: any) {\r\n app\r\n .getPlugin(\"content-manager\")\r\n .apis.addEditViewSidePanel((panels: any): PanelComponent[] => {\r\n return [...panels, SeriesProductActions];\r\n });\r\n },\r\n};\r\n\r\nexport default plugin;\r\n"],"names":["plugin","register","app","registerPlugin","id","PLUGIN_ID","initializer","Initializer","isReady","name","bootstrap","getPlugin","apis","addEditViewSidePanel","panels","SeriesProductActions"],"mappings":";;;;;;AAMA,MAAMA,MAAAA,GAAS;AACbC,IAAAA,QAAAA,CAAAA,CAASC,GAAQ,EAAA;AACfA,QAAAA,GAAAA,CAAIC,cAAc,CAAC;YACjBC,EAAAA,EAAIC,kBAAAA;YACJC,WAAAA,EAAaC,mBAAAA;YACbC,OAAAA,EAAS,KAAA;YACTC,IAAAA,EAAMJ;AACR,SAAA,CAAA;AACF,IAAA,CAAA;AAEAK,IAAAA,SAAAA,CAAAA,CAAUR,GAAQ,EAAA;AAChBA,QAAAA,GAAAA,CACGS,SAAS,CAAC,iBAAA,CAAA,CACVC,IAAI,CAACC,oBAAoB,CAAC,CAACC,MAAAA,GAAAA;YAC1B,OAAO;AAAIA,gBAAAA,GAAAA,MAAAA;AAAQC,gBAAAA;AAAqB,aAAA;AAC1C,QAAA,CAAA,CAAA;AACJ,IAAA;AACF;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.mjs","sources":["../../admin/src/index.ts"],"sourcesContent":["import { Initializer } from \"./components/Initializer\";\r\nimport { SeriesProductActions } from \"./components/SeriesProductActions\";\r\nimport { PLUGIN_ID } from \"./pluginId\";\r\n\r\nimport type { PanelComponent } from \"@strapi/content-manager/strapi-admin\";\r\n\r\nconst plugin = {\r\n register(app: any) {\r\n app.registerPlugin({\r\n id: PLUGIN_ID,\r\n initializer: Initializer,\r\n isReady: false,\r\n name: PLUGIN_ID,\r\n });\r\n },\r\n\r\n bootstrap(app: any) {\r\n app\r\n .getPlugin(\"content-manager\")\r\n .apis.addEditViewSidePanel((panels: any): PanelComponent[] => {\r\n return [...panels, SeriesProductActions];\r\n });\r\n },\r\n};\r\n\r\nexport default plugin;\r\n"],"names":["plugin","register","app","registerPlugin","id","PLUGIN_ID","initializer","Initializer","isReady","name","bootstrap","getPlugin","apis","addEditViewSidePanel","panels","SeriesProductActions"],"mappings":";;;;AAMA,MAAMA,MAAAA,GAAS;AACbC,IAAAA,QAAAA,CAAAA,CAASC,GAAQ,EAAA;AACfA,QAAAA,GAAAA,CAAIC,cAAc,CAAC;YACjBC,EAAAA,EAAIC,SAAAA;YACJC,WAAAA,EAAaC,WAAAA;YACbC,OAAAA,EAAS,KAAA;YACTC,IAAAA,EAAMJ;AACR,SAAA,CAAA;AACF,IAAA,CAAA;AAEAK,IAAAA,SAAAA,CAAAA,CAAUR,GAAQ,EAAA;AAChBA,QAAAA,GAAAA,CACGS,SAAS,CAAC,iBAAA,CAAA,CACVC,IAAI,CAACC,oBAAoB,CAAC,CAACC,MAAAA,GAAAA;YAC1B,OAAO;AAAIA,gBAAAA,GAAAA,MAAAA;AAAQC,gBAAAA;AAAqB,aAAA;AAC1C,QAAA,CAAA,CAAA;AACJ,IAAA;AACF;;;;"}
@@ -1,6 +0,0 @@
1
- 'use strict';
2
-
3
- const PLUGIN_ID = "primershop-product-actions";
4
-
5
- exports.PLUGIN_ID = PLUGIN_ID;
6
- //# sourceMappingURL=pluginId.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pluginId.js","sources":["../../admin/src/pluginId.ts"],"sourcesContent":["export const PLUGIN_ID = \"primershop-product-actions\";\r\n"],"names":["PLUGIN_ID"],"mappings":";;AAAO,MAAMA,YAAY;;;;"}
@@ -1,4 +0,0 @@
1
- const PLUGIN_ID = "primershop-product-actions";
2
-
3
- export { PLUGIN_ID };
4
- //# sourceMappingURL=pluginId.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pluginId.mjs","sources":["../../admin/src/pluginId.ts"],"sourcesContent":["export const PLUGIN_ID = \"primershop-product-actions\";\r\n"],"names":["PLUGIN_ID"],"mappings":"AAAO,MAAMA,YAAY;;;;"}
@@ -1,25 +0,0 @@
1
- 'use strict';
2
-
3
- const en = {
4
- "plugin.name": "Product Series",
5
- "plugin.description": "Manage product series and their products",
6
- "product-series.actions.label": "Product Actions",
7
- "product-series.actions.createProducts": "Create Products",
8
- "product-series.actions.updateProducts": "Update Products",
9
- "product-series.actions.createDialogTitle": "Create Products from Series",
10
- "product-series.actions.updateDialogTitle": "Update All Products in Series",
11
- "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.",
12
- "product-series.actions.productCount": "Number of Products",
13
- "product-series.actions.create": "Create",
14
- "product-series.actions.update": "Update",
15
- "product-series.actions.cancel": "Cancel",
16
- "product-series.actions.createSuccess": "Products created successfully",
17
- "product-series.actions.createError": "Failed to create products",
18
- "product-series.actions.updateSuccess": "Products updated successfully",
19
- "product-series.actions.updateError": "Failed to update products",
20
- "product-series.actions.selectFields": "Select fields to update",
21
- "product-series.actions.noDocumentId": "Save the series first before creating products"
22
- };
23
-
24
- exports.en = en;
25
- //# sourceMappingURL=en.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"en.js","sources":["../../../admin/src/translations/en.ts"],"sourcesContent":["const en: Record<string, string> = {\r\n \"plugin.name\": \"Product Series\",\r\n \"plugin.description\": \"Manage product series and their products\",\r\n \"product-series.actions.label\": \"Product Actions\",\r\n \"product-series.actions.createProducts\": \"Create Products\",\r\n \"product-series.actions.updateProducts\": \"Update Products\",\r\n \"product-series.actions.createDialogTitle\": \"Create Products from Series\",\r\n \"product-series.actions.updateDialogTitle\": \"Update All Products in Series\",\r\n \"product-series.actions.updateDialogDescription\":\r\n \"This will update all products in the series with the selected fields. Make sure to save the series first before updating the products.\",\r\n \"product-series.actions.productCount\": \"Number of Products\",\r\n \"product-series.actions.create\": \"Create\",\r\n \"product-series.actions.update\": \"Update\",\r\n \"product-series.actions.cancel\": \"Cancel\",\r\n \"product-series.actions.createSuccess\": \"Products created successfully\",\r\n \"product-series.actions.createError\": \"Failed to create products\",\r\n \"product-series.actions.updateSuccess\": \"Products updated successfully\",\r\n \"product-series.actions.updateError\": \"Failed to update products\",\r\n \"product-series.actions.selectFields\": \"Select fields to update\",\r\n \"product-series.actions.noDocumentId\":\r\n \"Save the series first before creating products\",\r\n};\r\n\r\nexport { en };\r\n"],"names":["en"],"mappings":";;AAAA,MAAMA,EAAAA,GAA6B;IACjC,aAAA,EAAe,gBAAA;IACf,oBAAA,EAAsB,0CAAA;IACtB,8BAAA,EAAgC,iBAAA;IAChC,uCAAA,EAAyC,iBAAA;IACzC,uCAAA,EAAyC,iBAAA;IACzC,0CAAA,EAA4C,6BAAA;IAC5C,0CAAA,EAA4C,+BAAA;IAC5C,gDAAA,EACE,wIAAA;IACF,qCAAA,EAAuC,oBAAA;IACvC,+BAAA,EAAiC,QAAA;IACjC,+BAAA,EAAiC,QAAA;IACjC,+BAAA,EAAiC,QAAA;IACjC,sCAAA,EAAwC,+BAAA;IACxC,oCAAA,EAAsC,2BAAA;IACtC,sCAAA,EAAwC,+BAAA;IACxC,oCAAA,EAAsC,2BAAA;IACtC,qCAAA,EAAuC,yBAAA;IACvC,qCAAA,EACE;AACJ;;;;"}
@@ -1,23 +0,0 @@
1
- const en = {
2
- "plugin.name": "Product Series",
3
- "plugin.description": "Manage product series and their products",
4
- "product-series.actions.label": "Product Actions",
5
- "product-series.actions.createProducts": "Create Products",
6
- "product-series.actions.updateProducts": "Update Products",
7
- "product-series.actions.createDialogTitle": "Create Products from Series",
8
- "product-series.actions.updateDialogTitle": "Update All Products in Series",
9
- "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.",
10
- "product-series.actions.productCount": "Number of Products",
11
- "product-series.actions.create": "Create",
12
- "product-series.actions.update": "Update",
13
- "product-series.actions.cancel": "Cancel",
14
- "product-series.actions.createSuccess": "Products created successfully",
15
- "product-series.actions.createError": "Failed to create products",
16
- "product-series.actions.updateSuccess": "Products updated successfully",
17
- "product-series.actions.updateError": "Failed to update products",
18
- "product-series.actions.selectFields": "Select fields to update",
19
- "product-series.actions.noDocumentId": "Save the series first before creating products"
20
- };
21
-
22
- export { en };
23
- //# sourceMappingURL=en.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"en.mjs","sources":["../../../admin/src/translations/en.ts"],"sourcesContent":["const en: Record<string, string> = {\r\n \"plugin.name\": \"Product Series\",\r\n \"plugin.description\": \"Manage product series and their products\",\r\n \"product-series.actions.label\": \"Product Actions\",\r\n \"product-series.actions.createProducts\": \"Create Products\",\r\n \"product-series.actions.updateProducts\": \"Update Products\",\r\n \"product-series.actions.createDialogTitle\": \"Create Products from Series\",\r\n \"product-series.actions.updateDialogTitle\": \"Update All Products in Series\",\r\n \"product-series.actions.updateDialogDescription\":\r\n \"This will update all products in the series with the selected fields. Make sure to save the series first before updating the products.\",\r\n \"product-series.actions.productCount\": \"Number of Products\",\r\n \"product-series.actions.create\": \"Create\",\r\n \"product-series.actions.update\": \"Update\",\r\n \"product-series.actions.cancel\": \"Cancel\",\r\n \"product-series.actions.createSuccess\": \"Products created successfully\",\r\n \"product-series.actions.createError\": \"Failed to create products\",\r\n \"product-series.actions.updateSuccess\": \"Products updated successfully\",\r\n \"product-series.actions.updateError\": \"Failed to update products\",\r\n \"product-series.actions.selectFields\": \"Select fields to update\",\r\n \"product-series.actions.noDocumentId\":\r\n \"Save the series first before creating products\",\r\n};\r\n\r\nexport { en };\r\n"],"names":["en"],"mappings":"AAAA,MAAMA,EAAAA,GAA6B;IACjC,aAAA,EAAe,gBAAA;IACf,oBAAA,EAAsB,0CAAA;IACtB,8BAAA,EAAgC,iBAAA;IAChC,uCAAA,EAAyC,iBAAA;IACzC,uCAAA,EAAyC,iBAAA;IACzC,0CAAA,EAA4C,6BAAA;IAC5C,0CAAA,EAA4C,+BAAA;IAC5C,gDAAA,EACE,wIAAA;IACF,qCAAA,EAAuC,oBAAA;IACvC,+BAAA,EAAiC,QAAA;IACjC,+BAAA,EAAiC,QAAA;IACjC,+BAAA,EAAiC,QAAA;IACjC,sCAAA,EAAwC,+BAAA;IACxC,oCAAA,EAAsC,2BAAA;IACtC,sCAAA,EAAwC,+BAAA;IACxC,oCAAA,EAAsC,2BAAA;IACtC,qCAAA,EAAuC,yBAAA;IACvC,qCAAA,EACE;AACJ;;;;"}