@primershop/strapi-plugin-product-actions 0.0.7 → 0.0.9

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.
@@ -267,7 +267,6 @@ const plugin = {
267
267
  });
268
268
  },
269
269
  bootstrap (app) {
270
- console.log("🚀 ~ bootstrap ~ app:", app);
271
270
  app.getPlugin("content-manager").apis.addEditViewSidePanel((panels)=>{
272
271
  return [
273
272
  ...panels,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../admin/src/pluginId.ts","../../admin/src/components/Initializer/index.tsx","../../admin/src/translations/en.ts","../../admin/src/components/SeriesProductActions/index.tsx","../../admin/src/index.ts"],"sourcesContent":["export const PLUGIN_ID = \"primershop-product-actions\";\r\n","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","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","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","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 console.log(\"🚀 ~ bootstrap ~ app:\", app);\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_ID","Initializer","setPlugin","ref","useRef","useEffect","current","en","formatMessage","arg","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","plugin","register","app","registerPlugin","initializer","isReady","name","bootstrap","log","getPlugin","apis","addEditViewSidePanel","panels"],"mappings":";;;;;;;AAAO,MAAMA,YAAY,4BAAA;;ACIzB;;AAEC,IACD,MAAMC,WAAAA,GAAc,CAAC,EAAEC,SAAS,EAAuC,GAAA;AACrE,IAAA,MAAMC,MAAMC,YAAAA,CAAOF,SAAAA,CAAAA;IAEnBG,eAAAA,CAAU,IAAA;AACRF,QAAAA,GAAAA,CAAIG,OAAO,CAACN,SAAAA,CAAAA;AACd,IAAA,CAAA,EAAG,EAAE,CAAA;IAEL,OAAO,IAAA;AACT,CAAA;;ACfA,MAAMO,EAAA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AUzE,KAAA;AACF,CAAA;;AC/NA,MAAMyE,MAAAA,GAAS;AACbC,IAAAA,QAAAA,CAAAA,CAASC,GAAQ,EAAA;AACfA,QAAAA,GAAAA,CAAIC,cAAc,CAAC;YACjB5E,EAAAA,EAAIV,SAAAA;YACJuF,WAAAA,EAAatF,WAAAA;YACbuF,OAAAA,EAAS,KAAA;YACTC,IAAAA,EAAMzF;AACR,SAAA,CAAA;AACF,IAAA,CAAA;AAEA0F,IAAAA,SAAAA,CAAAA,CAAUL,GAAQ,EAAA;QAChBpD,OAAAA,CAAQ0D,GAAG,CAAC,uBAAA,EAAyBN,GAAAA,CAAAA;AACrCA,QAAAA,GAAAA,CACGO,SAAS,CAAC,iBAAA,CAAA,CACVC,IAAI,CAACC,oBAAoB,CAAC,CAACC,MAAAA,GAAAA;YAC1B,OAAO;AAAIA,gBAAAA,GAAAA,MAAAA;AAAQnF,gBAAAA;AAAqB,aAAA;AAC1C,QAAA,CAAA,CAAA;AACJ,IAAA;AACF;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../admin/src/pluginId.ts","../../admin/src/components/Initializer/index.tsx","../../admin/src/translations/en.ts","../../admin/src/components/SeriesProductActions/index.tsx","../../admin/src/index.ts"],"sourcesContent":["export const PLUGIN_ID = \"primershop-product-actions\";\r\n","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","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","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","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_ID","Initializer","setPlugin","ref","useRef","useEffect","current","en","formatMessage","arg","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","plugin","register","app","registerPlugin","initializer","isReady","name","bootstrap","getPlugin","apis","addEditViewSidePanel","panels"],"mappings":";;;;;;;AAAO,MAAMA,YAAY,4BAAA;;ACIzB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,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;sEAERZ,aAAAA,CAAc;gEAAEE,EAAAA,EAAI;AAAgC,6DAAA;;;;;;;;;;;;;;AAUzE,KAAA;AACF,CAAA;;AC/NA,MAAMyE,MAAAA,GAAS;AACbC,IAAAA,QAAAA,CAAAA,CAASC,GAAQ,EAAA;AACfA,QAAAA,GAAAA,CAAIC,cAAc,CAAC;YACjB5E,EAAAA,EAAIV,SAAAA;YACJuF,WAAAA,EAAatF,WAAAA;YACbuF,OAAAA,EAAS,KAAA;YACTC,IAAAA,EAAMzF;AACR,SAAA,CAAA;AACF,IAAA,CAAA;AAEA0F,IAAAA,SAAAA,CAAAA,CAAUL,GAAQ,EAAA;AAChBA,QAAAA,GAAAA,CACGM,SAAS,CAAC,iBAAA,CAAA,CACVC,IAAI,CAACC,oBAAoB,CAAC,CAACC,MAAAA,GAAAA;YAC1B,OAAO;AAAIA,gBAAAA,GAAAA,MAAAA;AAAQlF,gBAAAA;AAAqB,aAAA;AAC1C,QAAA,CAAA,CAAA;AACJ,IAAA;AACF;;;;"}
@@ -265,7 +265,6 @@ const plugin = {
265
265
  });
266
266
  },
267
267
  bootstrap (app) {
268
- console.log("🚀 ~ bootstrap ~ app:", app);
269
268
  app.getPlugin("content-manager").apis.addEditViewSidePanel((panels)=>{
270
269
  return [
271
270
  ...panels,
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../../admin/src/pluginId.ts","../../admin/src/components/Initializer/index.tsx","../../admin/src/translations/en.ts","../../admin/src/components/SeriesProductActions/index.tsx","../../admin/src/index.ts"],"sourcesContent":["export const PLUGIN_ID = \"primershop-product-actions\";\r\n","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","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","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","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 console.log(\"🚀 ~ bootstrap ~ app:\", app);\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_ID","Initializer","setPlugin","ref","useRef","useEffect","current","en","formatMessage","arg","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","plugin","register","app","registerPlugin","initializer","isReady","name","bootstrap","log","getPlugin","apis","addEditViewSidePanel","panels"],"mappings":";;;;;AAAO,MAAMA,YAAY,4BAAA;;ACIzB;;AAEC,IACD,MAAMC,WAAAA,GAAc,CAAC,EAAEC,SAAS,EAAuC,GAAA;AACrE,IAAA,MAAMC,MAAMC,MAAAA,CAAOF,SAAAA,CAAAA;IAEnBG,SAAAA,CAAU,IAAA;AACRF,QAAAA,GAAAA,CAAIG,OAAO,CAACN,SAAAA,CAAAA;AACd,IAAA,CAAA,EAAG,EAAE,CAAA;IAEL,OAAO,IAAA;AACT,CAAA;;ACfA,MAAMO,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,CAAA;;ACFA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;AAAQnF,gBAAAA;AAAqB,aAAA;AAC1C,QAAA,CAAA,CAAA;AACJ,IAAA;AACF;;;;"}
1
+ {"version":3,"file":"index.mjs","sources":["../../admin/src/pluginId.ts","../../admin/src/components/Initializer/index.tsx","../../admin/src/translations/en.ts","../../admin/src/components/SeriesProductActions/index.tsx","../../admin/src/index.ts"],"sourcesContent":["export const PLUGIN_ID = \"primershop-product-actions\";\r\n","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","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","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","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_ID","Initializer","setPlugin","ref","useRef","useEffect","current","en","formatMessage","arg","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","plugin","register","app","registerPlugin","initializer","isReady","name","bootstrap","getPlugin","apis","addEditViewSidePanel","panels"],"mappings":";;;;;AAAO,MAAMA,YAAY,4BAAA;;ACIzB;;AAEC,IACD,MAAMC,WAAAA,GAAc,CAAC,EAAEC,SAAS,EAAuC,GAAA;AACrE,IAAA,MAAMC,MAAMC,MAAAA,CAAOF,SAAAA,CAAAA;IAEnBG,SAAAA,CAAU,IAAA;AACRF,QAAAA,GAAAA,CAAIG,OAAO,CAACN,SAAAA,CAAAA;AACd,IAAA,CAAA,EAAG,EAAE,CAAA;IAEL,OAAO,IAAA;AACT,CAAA;;ACfA,MAAMO,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,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AAA,CAAAA,CAAUL,GAAQ,EAAA;AAChBA,QAAAA,GAAAA,CACGM,SAAS,CAAC,iBAAA,CAAA,CACVC,IAAI,CAACC,oBAAoB,CAAC,CAACC,MAAAA,GAAAA;YAC1B,OAAO;AAAIA,gBAAAA,GAAAA,MAAAA;AAAQlF,gBAAAA;AAAqB,aAAA;AAC1C,QAAA,CAAA,CAAA;AACJ,IAAA;AACF;;;;"}
@@ -3,13 +3,14 @@
3
3
  var permissions = require('./permissions.js');
4
4
 
5
5
  const bootstrap = async ({ strapi })=>{
6
- // Register permissions for the plugin
7
6
  try {
7
+ strapi.admin.services.permission.actionProvider.registerMany(permissions.permissions.actions);
8
8
  await strapi.service("admin::permission").actionProvider.registerMany(permissions.permissions.actions);
9
9
  } catch (error) {
10
- // Handle error silently or log to proper logging service
10
+ strapi.log.error("[primershop-product-actions] Failed to register permissions:", error);
11
+ throw error;
11
12
  }
12
13
  };
13
14
 
14
- exports.bootstrap = bootstrap;
15
+ module.exports = bootstrap;
15
16
  //# sourceMappingURL=bootstrap.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"bootstrap.js","sources":["../../server/src/bootstrap.ts"],"sourcesContent":["import { permissions } from \"./permissions\";\r\n\r\ninterface StrapiInstance {\r\n db?: unknown;\r\n contentTypes?: Record<string, unknown>;\r\n service: (name: string) => {\r\n actionProvider: { registerMany: (actions: unknown) => Promise<void> };\r\n };\r\n}\r\n\r\nexport const bootstrap = async ({ strapi }: { strapi: StrapiInstance }) => {\r\n // Register permissions for the plugin\r\n try {\r\n await strapi\r\n .service(\"admin::permission\")\r\n .actionProvider.registerMany(permissions.actions);\r\n } catch (error) {\r\n // Handle error silently or log to proper logging service\r\n }\r\n};\r\n"],"names":["bootstrap","strapi","service","actionProvider","registerMany","permissions","actions","error"],"mappings":";;;;AAUO,MAAMA,SAAAA,GAAY,OAAO,EAAEC,MAAM,EAA8B,GAAA;;IAEpE,IAAI;QACF,MAAMA,MAAAA,CACHC,OAAO,CAAC,mBAAA,CAAA,CACRC,cAAc,CAACC,YAAY,CAACC,uBAAAA,CAAYC,OAAO,CAAA;AACpD,IAAA,CAAA,CAAE,OAAOC,KAAAA,EAAO;;AAEhB,IAAA;AACF;;;;"}
1
+ {"version":3,"file":"bootstrap.js","sources":["../../server/src/bootstrap.ts"],"sourcesContent":["import { permissions } from \"./permissions\";\r\nimport type { Core } from \"@strapi/strapi\";\r\n\r\nconst bootstrap = async ({ strapi }: { strapi: Core.Strapi }) => {\r\n try {\r\n strapi.admin.services.permission.actionProvider.registerMany(permissions.actions);\r\n await strapi\r\n .service(\"admin::permission\")\r\n .actionProvider.registerMany(permissions.actions);\r\n } catch (error) {\r\n strapi.log.error(\r\n \"[primershop-product-actions] Failed to register permissions:\",\r\n error\r\n );\r\n throw error;\r\n }\r\n};\r\n\r\nexport default bootstrap;\r\n"],"names":["bootstrap","strapi","admin","services","permission","actionProvider","registerMany","permissions","actions","service","error","log"],"mappings":";;;;AAGA,MAAMA,SAAAA,GAAY,OAAO,EAAEC,MAAM,EAA2B,GAAA;IAC1D,IAAI;QACFA,MAAAA,CAAOC,KAAK,CAACC,QAAQ,CAACC,UAAU,CAACC,cAAc,CAACC,YAAY,CAACC,uBAAAA,CAAYC,OAAO,CAAA;QAChF,MAAMP,MAAAA,CACHQ,OAAO,CAAC,mBAAA,CAAA,CACRJ,cAAc,CAACC,YAAY,CAACC,uBAAAA,CAAYC,OAAO,CAAA;AACpD,IAAA,CAAA,CAAE,OAAOE,KAAAA,EAAO;AACdT,QAAAA,MAAAA,CAAOU,GAAG,CAACD,KAAK,CACd,8DAAA,EACAA,KAAAA,CAAAA;QAEF,MAAMA,KAAAA;AACR,IAAA;AACF;;;;"}
@@ -1,13 +1,14 @@
1
1
  import { permissions } from './permissions.mjs';
2
2
 
3
3
  const bootstrap = async ({ strapi })=>{
4
- // Register permissions for the plugin
5
4
  try {
5
+ strapi.admin.services.permission.actionProvider.registerMany(permissions.actions);
6
6
  await strapi.service("admin::permission").actionProvider.registerMany(permissions.actions);
7
7
  } catch (error) {
8
- // Handle error silently or log to proper logging service
8
+ strapi.log.error("[primershop-product-actions] Failed to register permissions:", error);
9
+ throw error;
9
10
  }
10
11
  };
11
12
 
12
- export { bootstrap };
13
+ export { bootstrap as default };
13
14
  //# sourceMappingURL=bootstrap.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"bootstrap.mjs","sources":["../../server/src/bootstrap.ts"],"sourcesContent":["import { permissions } from \"./permissions\";\r\n\r\ninterface StrapiInstance {\r\n db?: unknown;\r\n contentTypes?: Record<string, unknown>;\r\n service: (name: string) => {\r\n actionProvider: { registerMany: (actions: unknown) => Promise<void> };\r\n };\r\n}\r\n\r\nexport const bootstrap = async ({ strapi }: { strapi: StrapiInstance }) => {\r\n // Register permissions for the plugin\r\n try {\r\n await strapi\r\n .service(\"admin::permission\")\r\n .actionProvider.registerMany(permissions.actions);\r\n } catch (error) {\r\n // Handle error silently or log to proper logging service\r\n }\r\n};\r\n"],"names":["bootstrap","strapi","service","actionProvider","registerMany","permissions","actions","error"],"mappings":";;AAUO,MAAMA,SAAAA,GAAY,OAAO,EAAEC,MAAM,EAA8B,GAAA;;IAEpE,IAAI;QACF,MAAMA,MAAAA,CACHC,OAAO,CAAC,mBAAA,CAAA,CACRC,cAAc,CAACC,YAAY,CAACC,WAAAA,CAAYC,OAAO,CAAA;AACpD,IAAA,CAAA,CAAE,OAAOC,KAAAA,EAAO;;AAEhB,IAAA;AACF;;;;"}
1
+ {"version":3,"file":"bootstrap.mjs","sources":["../../server/src/bootstrap.ts"],"sourcesContent":["import { permissions } from \"./permissions\";\r\nimport type { Core } from \"@strapi/strapi\";\r\n\r\nconst bootstrap = async ({ strapi }: { strapi: Core.Strapi }) => {\r\n try {\r\n strapi.admin.services.permission.actionProvider.registerMany(permissions.actions);\r\n await strapi\r\n .service(\"admin::permission\")\r\n .actionProvider.registerMany(permissions.actions);\r\n } catch (error) {\r\n strapi.log.error(\r\n \"[primershop-product-actions] Failed to register permissions:\",\r\n error\r\n );\r\n throw error;\r\n }\r\n};\r\n\r\nexport default bootstrap;\r\n"],"names":["bootstrap","strapi","admin","services","permission","actionProvider","registerMany","permissions","actions","service","error","log"],"mappings":";;AAGA,MAAMA,SAAAA,GAAY,OAAO,EAAEC,MAAM,EAA2B,GAAA;IAC1D,IAAI;QACFA,MAAAA,CAAOC,KAAK,CAACC,QAAQ,CAACC,UAAU,CAACC,cAAc,CAACC,YAAY,CAACC,WAAAA,CAAYC,OAAO,CAAA;QAChF,MAAMP,MAAAA,CACHQ,OAAO,CAAC,mBAAA,CAAA,CACRJ,cAAc,CAACC,YAAY,CAACC,WAAAA,CAAYC,OAAO,CAAA;AACpD,IAAA,CAAA,CAAE,OAAOE,KAAAA,EAAO;AACdT,QAAAA,MAAAA,CAAOU,GAAG,CAACD,KAAK,CACd,8DAAA,EACAA,KAAAA,CAAAA;QAEF,MAAMA,KAAAA;AACR,IAAA;AACF;;;;"}
@@ -8,12 +8,12 @@ var bootstrap = require('./bootstrap.js');
8
8
 
9
9
  const plugin = ()=>{
10
10
  return {
11
- register: register.register,
11
+ register,
12
12
  controllers: index$2.controllers,
13
13
  routes: index$1.routes,
14
14
  services: index.services,
15
15
  middlewares: {},
16
- bootstrap: bootstrap.bootstrap
16
+ bootstrap
17
17
  };
18
18
  };
19
19
 
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../server/src/index.ts"],"sourcesContent":["import { controllers } from \"./controllers\";\r\nimport { routes } from \"./routes\";\r\nimport { services } from \"./services\";\r\nimport { register } from \"./register\";\r\nimport { bootstrap } from \"./bootstrap\";\r\n\r\nconst plugin = () => {\r\n return {\r\n register,\r\n\r\n controllers,\r\n routes,\r\n services,\r\n middlewares: {},\r\n bootstrap,\r\n };\r\n};\r\n\r\nexport default plugin;\r\n"],"names":["plugin","register","controllers","routes","services","middlewares","bootstrap"],"mappings":";;;;;;;;AAMA,MAAMA,MAAAA,GAAS,IAAA;IACb,OAAO;AACLC,kBAAAA,iBAAAA;AAEAC,qBAAAA,mBAAAA;AACAC,gBAAAA,cAAAA;AACAC,kBAAAA,cAAAA;AACAC,QAAAA,WAAAA,EAAa,EAAC;AACdC,mBAAAA;AACF,KAAA;AACF;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../server/src/index.ts"],"sourcesContent":["import { controllers } from \"./controllers\";\r\nimport { routes } from \"./routes\";\r\nimport { services } from \"./services\";\r\nimport register from \"./register\";\r\nimport bootstrap from \"./bootstrap\";\r\n\r\nconst plugin = () => {\r\n return {\r\n register,\r\n\r\n controllers,\r\n routes,\r\n services,\r\n middlewares: {},\r\n bootstrap,\r\n };\r\n};\r\n\r\nexport default plugin;\r\n"],"names":["plugin","register","controllers","routes","services","middlewares","bootstrap"],"mappings":";;;;;;;;AAMA,MAAMA,MAAAA,GAAS,IAAA;IACb,OAAO;AACLC,QAAAA,QAAAA;AAEAC,qBAAAA,mBAAAA;AACAC,gBAAAA,cAAAA;AACAC,kBAAAA,cAAAA;AACAC,QAAAA,WAAAA,EAAa,EAAC;AACdC,QAAAA;AACF,KAAA;AACF;;;;"}
@@ -1,8 +1,8 @@
1
1
  import { controllers } from './controllers/index.mjs';
2
2
  import { routes } from './routes/index.mjs';
3
3
  import { services } from './services/index.mjs';
4
- import { register } from './register.mjs';
5
- import { bootstrap } from './bootstrap.mjs';
4
+ import register from './register.mjs';
5
+ import bootstrap from './bootstrap.mjs';
6
6
 
7
7
  const plugin = ()=>{
8
8
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../../server/src/index.ts"],"sourcesContent":["import { controllers } from \"./controllers\";\r\nimport { routes } from \"./routes\";\r\nimport { services } from \"./services\";\r\nimport { register } from \"./register\";\r\nimport { bootstrap } from \"./bootstrap\";\r\n\r\nconst plugin = () => {\r\n return {\r\n register,\r\n\r\n controllers,\r\n routes,\r\n services,\r\n middlewares: {},\r\n bootstrap,\r\n };\r\n};\r\n\r\nexport default plugin;\r\n"],"names":["plugin","register","controllers","routes","services","middlewares","bootstrap"],"mappings":";;;;;;AAMA,MAAMA,MAAAA,GAAS,IAAA;IACb,OAAO;AACLC,QAAAA,QAAAA;AAEAC,QAAAA,WAAAA;AACAC,QAAAA,MAAAA;AACAC,QAAAA,QAAAA;AACAC,QAAAA,WAAAA,EAAa,EAAC;AACdC,QAAAA;AACF,KAAA;AACF;;;;"}
1
+ {"version":3,"file":"index.mjs","sources":["../../server/src/index.ts"],"sourcesContent":["import { controllers } from \"./controllers\";\r\nimport { routes } from \"./routes\";\r\nimport { services } from \"./services\";\r\nimport register from \"./register\";\r\nimport bootstrap from \"./bootstrap\";\r\n\r\nconst plugin = () => {\r\n return {\r\n register,\r\n\r\n controllers,\r\n routes,\r\n services,\r\n middlewares: {},\r\n bootstrap,\r\n };\r\n};\r\n\r\nexport default plugin;\r\n"],"names":["plugin","register","controllers","routes","services","middlewares","bootstrap"],"mappings":";;;;;;AAMA,MAAMA,MAAAA,GAAS,IAAA;IACb,OAAO;AACLC,QAAAA,QAAAA;AAEAC,QAAAA,WAAAA;AACAC,QAAAA,MAAAA;AACAC,QAAAA,QAAAA;AACAC,QAAAA,WAAAA,EAAa,EAAC;AACdC,QAAAA;AACF,KAAA;AACF;;;;"}
@@ -3,7 +3,12 @@
3
3
  const permissions = {
4
4
  actions: [
5
5
  {
6
- // Roles
6
+ section: "plugins",
7
+ displayName: "Use product actions",
8
+ uid: "use",
9
+ pluginName: "primershop-product-actions"
10
+ },
11
+ {
7
12
  section: "plugins",
8
13
  displayName: "Create",
9
14
  uid: "product-series.create",
@@ -1 +1 @@
1
- {"version":3,"file":"permissions.js","sources":["../../server/src/permissions.ts"],"sourcesContent":["export const permissions = {\r\n actions: [\r\n {\r\n // Roles\r\n section: \"plugins\",\r\n displayName: \"Create\",\r\n uid: \"product-series.create\",\r\n subCategory: \"product-series\",\r\n pluginName: \"primershop-product-actions\",\r\n },\r\n {\r\n section: \"plugins\",\r\n displayName: \"Read\",\r\n uid: \"product-series.read\",\r\n subCategory: \"product-series\",\r\n pluginName: \"primershop-product-actions\",\r\n aliases: [\r\n {\r\n actionId: \"plugin::content-manager.explorer.read\",\r\n subjects: [\"api::product-series.product-series\"],\r\n },\r\n ],\r\n },\r\n {\r\n section: \"plugins\",\r\n displayName: \"Update\",\r\n uid: \"product-series.update\",\r\n subCategory: \"product-series\",\r\n pluginName: \"primershop-product-actions\",\r\n },\r\n {\r\n section: \"plugins\",\r\n displayName: \"Delete\",\r\n uid: \"product-series.delete\",\r\n subCategory: \"product-series\",\r\n pluginName: \"primershop-product-actions\",\r\n },\r\n ],\r\n};\r\n"],"names":["permissions","actions","section","displayName","uid","subCategory","pluginName","aliases","actionId","subjects"],"mappings":";;MAAaA,WAAAA,GAAc;IACzBC,OAAAA,EAAS;AACP,QAAA;;YAEEC,OAAAA,EAAS,SAAA;YACTC,WAAAA,EAAa,QAAA;YACbC,GAAAA,EAAK,uBAAA;YACLC,WAAAA,EAAa,gBAAA;YACbC,UAAAA,EAAY;AACd,SAAA;AACA,QAAA;YACEJ,OAAAA,EAAS,SAAA;YACTC,WAAAA,EAAa,MAAA;YACbC,GAAAA,EAAK,qBAAA;YACLC,WAAAA,EAAa,gBAAA;YACbC,UAAAA,EAAY,4BAAA;YACZC,OAAAA,EAAS;AACP,gBAAA;oBACEC,QAAAA,EAAU,uCAAA;oBACVC,QAAAA,EAAU;AAAC,wBAAA;AAAqC;AAClD;AACD;AACH,SAAA;AACA,QAAA;YACEP,OAAAA,EAAS,SAAA;YACTC,WAAAA,EAAa,QAAA;YACbC,GAAAA,EAAK,uBAAA;YACLC,WAAAA,EAAa,gBAAA;YACbC,UAAAA,EAAY;AACd,SAAA;AACA,QAAA;YACEJ,OAAAA,EAAS,SAAA;YACTC,WAAAA,EAAa,QAAA;YACbC,GAAAA,EAAK,uBAAA;YACLC,WAAAA,EAAa,gBAAA;YACbC,UAAAA,EAAY;AACd;AACD;AACH;;;;"}
1
+ {"version":3,"file":"permissions.js","sources":["../../server/src/permissions.ts"],"sourcesContent":["export const permissions = {\r\n actions: [\r\n {\r\n section: \"plugins\",\r\n displayName: \"Use product actions\",\r\n uid: \"use\",\r\n pluginName: \"primershop-product-actions\",\r\n },\r\n {\r\n section: \"plugins\",\r\n displayName: \"Create\",\r\n uid: \"product-series.create\",\r\n subCategory: \"product-series\",\r\n pluginName: \"primershop-product-actions\",\r\n },\r\n {\r\n section: \"plugins\",\r\n displayName: \"Read\",\r\n uid: \"product-series.read\",\r\n subCategory: \"product-series\",\r\n pluginName: \"primershop-product-actions\",\r\n aliases: [\r\n {\r\n actionId: \"plugin::content-manager.explorer.read\",\r\n subjects: [\"api::product-series.product-series\"],\r\n },\r\n ],\r\n },\r\n {\r\n section: \"plugins\",\r\n displayName: \"Update\",\r\n uid: \"product-series.update\",\r\n subCategory: \"product-series\",\r\n pluginName: \"primershop-product-actions\",\r\n },\r\n {\r\n section: \"plugins\",\r\n displayName: \"Delete\",\r\n uid: \"product-series.delete\",\r\n subCategory: \"product-series\",\r\n pluginName: \"primershop-product-actions\",\r\n },\r\n ],\r\n};\r\n"],"names":["permissions","actions","section","displayName","uid","pluginName","subCategory","aliases","actionId","subjects"],"mappings":";;MAAaA,WAAAA,GAAc;IACzBC,OAAAA,EAAS;AACP,QAAA;YACEC,OAAAA,EAAS,SAAA;YACTC,WAAAA,EAAa,qBAAA;YACbC,GAAAA,EAAK,KAAA;YACLC,UAAAA,EAAY;AACd,SAAA;AACA,QAAA;YACEH,OAAAA,EAAS,SAAA;YACTC,WAAAA,EAAa,QAAA;YACbC,GAAAA,EAAK,uBAAA;YACLE,WAAAA,EAAa,gBAAA;YACbD,UAAAA,EAAY;AACd,SAAA;AACA,QAAA;YACEH,OAAAA,EAAS,SAAA;YACTC,WAAAA,EAAa,MAAA;YACbC,GAAAA,EAAK,qBAAA;YACLE,WAAAA,EAAa,gBAAA;YACbD,UAAAA,EAAY,4BAAA;YACZE,OAAAA,EAAS;AACP,gBAAA;oBACEC,QAAAA,EAAU,uCAAA;oBACVC,QAAAA,EAAU;AAAC,wBAAA;AAAqC;AAClD;AACD;AACH,SAAA;AACA,QAAA;YACEP,OAAAA,EAAS,SAAA;YACTC,WAAAA,EAAa,QAAA;YACbC,GAAAA,EAAK,uBAAA;YACLE,WAAAA,EAAa,gBAAA;YACbD,UAAAA,EAAY;AACd,SAAA;AACA,QAAA;YACEH,OAAAA,EAAS,SAAA;YACTC,WAAAA,EAAa,QAAA;YACbC,GAAAA,EAAK,uBAAA;YACLE,WAAAA,EAAa,gBAAA;YACbD,UAAAA,EAAY;AACd;AACD;AACH;;;;"}
@@ -1,7 +1,12 @@
1
1
  const permissions = {
2
2
  actions: [
3
3
  {
4
- // Roles
4
+ section: "plugins",
5
+ displayName: "Use product actions",
6
+ uid: "use",
7
+ pluginName: "primershop-product-actions"
8
+ },
9
+ {
5
10
  section: "plugins",
6
11
  displayName: "Create",
7
12
  uid: "product-series.create",
@@ -1 +1 @@
1
- {"version":3,"file":"permissions.mjs","sources":["../../server/src/permissions.ts"],"sourcesContent":["export const permissions = {\r\n actions: [\r\n {\r\n // Roles\r\n section: \"plugins\",\r\n displayName: \"Create\",\r\n uid: \"product-series.create\",\r\n subCategory: \"product-series\",\r\n pluginName: \"primershop-product-actions\",\r\n },\r\n {\r\n section: \"plugins\",\r\n displayName: \"Read\",\r\n uid: \"product-series.read\",\r\n subCategory: \"product-series\",\r\n pluginName: \"primershop-product-actions\",\r\n aliases: [\r\n {\r\n actionId: \"plugin::content-manager.explorer.read\",\r\n subjects: [\"api::product-series.product-series\"],\r\n },\r\n ],\r\n },\r\n {\r\n section: \"plugins\",\r\n displayName: \"Update\",\r\n uid: \"product-series.update\",\r\n subCategory: \"product-series\",\r\n pluginName: \"primershop-product-actions\",\r\n },\r\n {\r\n section: \"plugins\",\r\n displayName: \"Delete\",\r\n uid: \"product-series.delete\",\r\n subCategory: \"product-series\",\r\n pluginName: \"primershop-product-actions\",\r\n },\r\n ],\r\n};\r\n"],"names":["permissions","actions","section","displayName","uid","subCategory","pluginName","aliases","actionId","subjects"],"mappings":"MAAaA,WAAAA,GAAc;IACzBC,OAAAA,EAAS;AACP,QAAA;;YAEEC,OAAAA,EAAS,SAAA;YACTC,WAAAA,EAAa,QAAA;YACbC,GAAAA,EAAK,uBAAA;YACLC,WAAAA,EAAa,gBAAA;YACbC,UAAAA,EAAY;AACd,SAAA;AACA,QAAA;YACEJ,OAAAA,EAAS,SAAA;YACTC,WAAAA,EAAa,MAAA;YACbC,GAAAA,EAAK,qBAAA;YACLC,WAAAA,EAAa,gBAAA;YACbC,UAAAA,EAAY,4BAAA;YACZC,OAAAA,EAAS;AACP,gBAAA;oBACEC,QAAAA,EAAU,uCAAA;oBACVC,QAAAA,EAAU;AAAC,wBAAA;AAAqC;AAClD;AACD;AACH,SAAA;AACA,QAAA;YACEP,OAAAA,EAAS,SAAA;YACTC,WAAAA,EAAa,QAAA;YACbC,GAAAA,EAAK,uBAAA;YACLC,WAAAA,EAAa,gBAAA;YACbC,UAAAA,EAAY;AACd,SAAA;AACA,QAAA;YACEJ,OAAAA,EAAS,SAAA;YACTC,WAAAA,EAAa,QAAA;YACbC,GAAAA,EAAK,uBAAA;YACLC,WAAAA,EAAa,gBAAA;YACbC,UAAAA,EAAY;AACd;AACD;AACH;;;;"}
1
+ {"version":3,"file":"permissions.mjs","sources":["../../server/src/permissions.ts"],"sourcesContent":["export const permissions = {\r\n actions: [\r\n {\r\n section: \"plugins\",\r\n displayName: \"Use product actions\",\r\n uid: \"use\",\r\n pluginName: \"primershop-product-actions\",\r\n },\r\n {\r\n section: \"plugins\",\r\n displayName: \"Create\",\r\n uid: \"product-series.create\",\r\n subCategory: \"product-series\",\r\n pluginName: \"primershop-product-actions\",\r\n },\r\n {\r\n section: \"plugins\",\r\n displayName: \"Read\",\r\n uid: \"product-series.read\",\r\n subCategory: \"product-series\",\r\n pluginName: \"primershop-product-actions\",\r\n aliases: [\r\n {\r\n actionId: \"plugin::content-manager.explorer.read\",\r\n subjects: [\"api::product-series.product-series\"],\r\n },\r\n ],\r\n },\r\n {\r\n section: \"plugins\",\r\n displayName: \"Update\",\r\n uid: \"product-series.update\",\r\n subCategory: \"product-series\",\r\n pluginName: \"primershop-product-actions\",\r\n },\r\n {\r\n section: \"plugins\",\r\n displayName: \"Delete\",\r\n uid: \"product-series.delete\",\r\n subCategory: \"product-series\",\r\n pluginName: \"primershop-product-actions\",\r\n },\r\n ],\r\n};\r\n"],"names":["permissions","actions","section","displayName","uid","pluginName","subCategory","aliases","actionId","subjects"],"mappings":"MAAaA,WAAAA,GAAc;IACzBC,OAAAA,EAAS;AACP,QAAA;YACEC,OAAAA,EAAS,SAAA;YACTC,WAAAA,EAAa,qBAAA;YACbC,GAAAA,EAAK,KAAA;YACLC,UAAAA,EAAY;AACd,SAAA;AACA,QAAA;YACEH,OAAAA,EAAS,SAAA;YACTC,WAAAA,EAAa,QAAA;YACbC,GAAAA,EAAK,uBAAA;YACLE,WAAAA,EAAa,gBAAA;YACbD,UAAAA,EAAY;AACd,SAAA;AACA,QAAA;YACEH,OAAAA,EAAS,SAAA;YACTC,WAAAA,EAAa,MAAA;YACbC,GAAAA,EAAK,qBAAA;YACLE,WAAAA,EAAa,gBAAA;YACbD,UAAAA,EAAY,4BAAA;YACZE,OAAAA,EAAS;AACP,gBAAA;oBACEC,QAAAA,EAAU,uCAAA;oBACVC,QAAAA,EAAU;AAAC,wBAAA;AAAqC;AAClD;AACD;AACH,SAAA;AACA,QAAA;YACEP,OAAAA,EAAS,SAAA;YACTC,WAAAA,EAAa,QAAA;YACbC,GAAAA,EAAK,uBAAA;YACLE,WAAAA,EAAa,gBAAA;YACbD,UAAAA,EAAY;AACd,SAAA;AACA,QAAA;YACEH,OAAAA,EAAS,SAAA;YACTC,WAAAA,EAAa,QAAA;YACbC,GAAAA,EAAK,uBAAA;YACLE,WAAAA,EAAa,gBAAA;YACbD,UAAAA,EAAY;AACd;AACD;AACH;;;;"}
@@ -12,5 +12,5 @@ const register = ({ strapi })=>{
12
12
  });
13
13
  };
14
14
 
15
- exports.register = register;
15
+ module.exports = register;
16
16
  //# sourceMappingURL=register.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"register.js","sources":["../../server/src/register.ts"],"sourcesContent":["import { PLUGIN_ID } from \"./pluginId\";\r\nimport type { Core } from \"@strapi/strapi\";\r\n\r\nexport const register = ({ strapi }: { strapi: Core.Strapi }): void => {\r\n // Register permissions\r\n strapi.admin.services.permission.actionProvider.register({\r\n section: \"plugins\",\r\n displayName: \"Product Actions\",\r\n uid: PLUGIN_ID,\r\n pluginName: PLUGIN_ID,\r\n });\r\n};\r\n"],"names":["register","strapi","admin","services","permission","actionProvider","section","displayName","uid","PLUGIN_ID","pluginName"],"mappings":";;;;AAGO,MAAMA,QAAAA,GAAW,CAAC,EAAEC,MAAM,EAA2B,GAAA;;IAE1DA,MAAAA,CAAOC,KAAK,CAACC,QAAQ,CAACC,UAAU,CAACC,cAAc,CAACL,QAAQ,CAAC;QACvDM,OAAAA,EAAS,SAAA;QACTC,WAAAA,EAAa,iBAAA;QACbC,GAAAA,EAAKC,kBAAAA;QACLC,UAAAA,EAAYD;AACd,KAAA,CAAA;AACF;;;;"}
1
+ {"version":3,"file":"register.js","sources":["../../server/src/register.ts"],"sourcesContent":["import { PLUGIN_ID } from \"./pluginId\";\r\nimport type { Core } from \"@strapi/strapi\";\r\n\r\nconst register = ({ strapi }: { strapi: Core.Strapi }): void => {\r\n // Register permissions\r\n strapi.admin.services.permission.actionProvider.register({\r\n section: \"plugins\",\r\n displayName: \"Product Actions\",\r\n uid: PLUGIN_ID,\r\n pluginName: PLUGIN_ID,\r\n });\r\n};\r\n\r\nexport default register;"],"names":["register","strapi","admin","services","permission","actionProvider","section","displayName","uid","PLUGIN_ID","pluginName"],"mappings":";;;;AAGA,MAAMA,QAAAA,GAAW,CAAC,EAAEC,MAAM,EAA2B,GAAA;;IAEnDA,MAAAA,CAAOC,KAAK,CAACC,QAAQ,CAACC,UAAU,CAACC,cAAc,CAACL,QAAQ,CAAC;QACvDM,OAAAA,EAAS,SAAA;QACTC,WAAAA,EAAa,iBAAA;QACbC,GAAAA,EAAKC,kBAAAA;QACLC,UAAAA,EAAYD;AACd,KAAA,CAAA;AACF;;;;"}
@@ -10,5 +10,5 @@ const register = ({ strapi })=>{
10
10
  });
11
11
  };
12
12
 
13
- export { register };
13
+ export { register as default };
14
14
  //# sourceMappingURL=register.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"register.mjs","sources":["../../server/src/register.ts"],"sourcesContent":["import { PLUGIN_ID } from \"./pluginId\";\r\nimport type { Core } from \"@strapi/strapi\";\r\n\r\nexport const register = ({ strapi }: { strapi: Core.Strapi }): void => {\r\n // Register permissions\r\n strapi.admin.services.permission.actionProvider.register({\r\n section: \"plugins\",\r\n displayName: \"Product Actions\",\r\n uid: PLUGIN_ID,\r\n pluginName: PLUGIN_ID,\r\n });\r\n};\r\n"],"names":["register","strapi","admin","services","permission","actionProvider","section","displayName","uid","PLUGIN_ID","pluginName"],"mappings":";;AAGO,MAAMA,QAAAA,GAAW,CAAC,EAAEC,MAAM,EAA2B,GAAA;;IAE1DA,MAAAA,CAAOC,KAAK,CAACC,QAAQ,CAACC,UAAU,CAACC,cAAc,CAACL,QAAQ,CAAC;QACvDM,OAAAA,EAAS,SAAA;QACTC,WAAAA,EAAa,iBAAA;QACbC,GAAAA,EAAKC,SAAAA;QACLC,UAAAA,EAAYD;AACd,KAAA,CAAA;AACF;;;;"}
1
+ {"version":3,"file":"register.mjs","sources":["../../server/src/register.ts"],"sourcesContent":["import { PLUGIN_ID } from \"./pluginId\";\r\nimport type { Core } from \"@strapi/strapi\";\r\n\r\nconst register = ({ strapi }: { strapi: Core.Strapi }): void => {\r\n // Register permissions\r\n strapi.admin.services.permission.actionProvider.register({\r\n section: \"plugins\",\r\n displayName: \"Product Actions\",\r\n uid: PLUGIN_ID,\r\n pluginName: PLUGIN_ID,\r\n });\r\n};\r\n\r\nexport default register;"],"names":["register","strapi","admin","services","permission","actionProvider","section","displayName","uid","PLUGIN_ID","pluginName"],"mappings":";;AAGA,MAAMA,QAAAA,GAAW,CAAC,EAAEC,MAAM,EAA2B,GAAA;;IAEnDA,MAAAA,CAAOC,KAAK,CAACC,QAAQ,CAACC,UAAU,CAACC,cAAc,CAACL,QAAQ,CAAC;QACvDM,OAAAA,EAAS,SAAA;QACTC,WAAAA,EAAa,iBAAA;QACbC,GAAAA,EAAKC,SAAAA;QACLC,UAAAA,EAAYD;AACd,KAAA,CAAA;AACF;;;;"}
package/package.json CHANGED
@@ -1,99 +1,103 @@
1
- {
2
- "name": "@primershop/strapi-plugin-product-actions",
3
- "version": "0.0.7",
4
- "description": "Enables product actions for Strapi",
5
- "exports": {
6
- "./strapi-admin": {
7
- "import": "./dist/admin/index.mjs",
8
- "require": "./dist/admin/index.js",
9
- "default": "./dist/admin/index.js"
10
- },
11
- "./strapi-server": {
12
- "import": "./dist/server/index.mjs",
13
- "require": "./dist/server/index.js",
14
- "default": "./dist/server/index.js"
15
- },
16
- "./package.json": "./package.json"
17
- },
18
- "files": [
19
- "dist/"
20
- ],
21
- "scripts": {
22
- "build": "npm-run-all clean --parallel build:code",
23
- "build:code": "rollup -c",
24
- "build:types": "run-p build:types:server build:types:admin",
25
- "build:types:server": "tsc -p server/tsconfig.build.json ",
26
- "build:types:admin": "tsc -p admin/tsconfig.build.json ",
27
- "clean": "rimraf ./dist",
28
- "lint": "eslint .",
29
- "test:front": "cross-env IS_EE=true jest --config ./jest.config.front.js",
30
- "test:ts:front": "tsc -p admin/tsconfig.json",
31
- "test:unit": "jest",
32
- "test:unit:watch": "jest --watch",
33
- "watch": "rollup -c -w"
34
- },
35
- "keywords": [
36
- "strapi",
37
- "plugin",
38
- "strapi-plugin",
39
- "product",
40
- "actions"
41
- ],
42
- "author": "Magda Odrowaz-Zelezik <magda.zelezik@gmail.com>",
43
- "license": "MIT",
44
- "repository": {
45
- "type": "git",
46
- "url": "https://github.com/magdazelena/primer.git",
47
- "directory": "packages/strapi-plugin-product-actions"
48
- },
49
- "bugs": {
50
- "url": "https://github.com/magdazelena/primer/issues"
51
- },
52
- "homepage": "https://github.com/magdazelena/primer/tree/main/packages/strapi-plugin-product-actions#readme",
53
- "peerDependencies": {
54
- "@strapi/strapi": "^5.29.0"
55
- },
56
- "devDependencies": {
57
- "@atlaskit/pragmatic-drag-and-drop": "^1.7.7",
58
- "@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.0.3",
59
- "@eslint/eslintrc": "^3.3.1",
60
- "@eslint/js": "^9.35.0",
61
- "@rollup/plugin-commonjs": "^29.0.0",
62
- "@rollup/plugin-dynamic-import-vars": "^2.1.5",
63
- "@rollup/plugin-json": "^6.1.0",
64
- "@rollup/plugin-node-resolve": "^16.0.1",
65
- "@rollup/plugin-swc": "^0.4.0",
66
- "@strapi/admin": "^5.29.0",
67
- "@strapi/content-manager": "^5.29.0",
68
- "@strapi/types": "^5.29.0",
69
- "@types/node": "^25.0.2",
70
- "@types/react": "^18.3.1",
71
- "@types/react-dom": "^18.3.1",
72
- "cross-env": "^10.0.0",
73
- "eslint": "9.39.2",
74
- "jest": "^30.2.0",
75
- "npm-run-all": "^4.1.5",
76
- "rimraf": "^6.0.1",
77
- "rollup": "^4.52.4",
78
- "typescript": "^5.3.3"
79
- },
80
- "engines": {
81
- "node": ">=18.0.0",
82
- "npm": ">=6.0.0"
83
- },
84
- "strapi": {
85
- "kind": "plugin",
86
- "name": "primershop-product-actions",
87
- "displayName": "Product Actions",
88
- "description": "Enables product actions"
89
- },
90
- "dependencies": {
91
- "@strapi/design-system": "^2.0.0-rc.27",
92
- "@strapi/icons": "^2.0.0-rc.27",
93
- "@strapi/utils": "^5.29.0",
94
- "react": "18.3.1",
95
- "react-dom": "18.3.1",
96
- "react-router-dom": "6.22.3",
97
- "styled-components": "^6.1.19"
98
- }
99
- }
1
+ {
2
+ "name": "@primershop/strapi-plugin-product-actions",
3
+ "version": "0.0.9",
4
+ "description": "Enables product actions for Strapi (v0.0.9)",
5
+ "exports": {
6
+ "./strapi-admin": {
7
+ "import": "./dist/admin/index.mjs",
8
+ "require": "./dist/admin/index.js",
9
+ "default": "./dist/admin/index.js"
10
+ },
11
+ "./strapi-server": {
12
+ "import": "./dist/server/index.mjs",
13
+ "require": "./dist/server/index.js",
14
+ "default": "./dist/server/index.js"
15
+ },
16
+ "./package.json": "./package.json"
17
+ },
18
+ "files": [
19
+ "dist/"
20
+ ],
21
+ "scripts": {
22
+ "build": "npm-run-all clean --parallel build:code",
23
+ "build:code": "rollup -c",
24
+ "build:types": "run-p build:types:server build:types:admin",
25
+ "build:types:server": "tsc -p server/tsconfig.build.json ",
26
+ "build:types:admin": "tsc -p admin/tsconfig.build.json ",
27
+ "clean": "rimraf ./dist",
28
+ "lint": "eslint .",
29
+ "test:front": "cross-env IS_EE=true jest --config ./jest.config.front.js",
30
+ "test:ts:front": "tsc -p admin/tsconfig.json",
31
+ "test:unit": "jest",
32
+ "test:unit:watch": "jest --watch",
33
+ "watch": "rollup -c -w",
34
+ "deploy": "node ../../scripts/plugin-deploy.js strapi-plugin-product-actions",
35
+ "deploy:patch": "node ../../scripts/plugin-deploy.js strapi-plugin-product-actions patch",
36
+ "deploy:minor": "node ../../scripts/plugin-deploy.js strapi-plugin-product-actions minor",
37
+ "deploy:major": "node ../../scripts/plugin-deploy.js strapi-plugin-product-actions major"
38
+ },
39
+ "keywords": [
40
+ "strapi",
41
+ "plugin",
42
+ "strapi-plugin",
43
+ "product",
44
+ "actions"
45
+ ],
46
+ "author": "Magda Odrowaz-Zelezik <magda.zelezik@gmail.com>",
47
+ "license": "MIT",
48
+ "repository": {
49
+ "type": "git",
50
+ "url": "https://github.com/magdazelena/primer.git",
51
+ "directory": "packages/strapi-plugin-product-actions"
52
+ },
53
+ "bugs": {
54
+ "url": "https://github.com/magdazelena/primer/issues"
55
+ },
56
+ "homepage": "https://github.com/magdazelena/primer/tree/main/packages/strapi-plugin-product-actions#readme",
57
+ "peerDependencies": {
58
+ "@strapi/strapi": "^5.29.0"
59
+ },
60
+ "devDependencies": {
61
+ "@atlaskit/pragmatic-drag-and-drop": "^1.7.7",
62
+ "@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.0.3",
63
+ "@eslint/eslintrc": "^3.3.1",
64
+ "@eslint/js": "^9.35.0",
65
+ "@rollup/plugin-commonjs": "^29.0.0",
66
+ "@rollup/plugin-dynamic-import-vars": "^2.1.5",
67
+ "@rollup/plugin-json": "^6.1.0",
68
+ "@rollup/plugin-node-resolve": "^16.0.1",
69
+ "@rollup/plugin-swc": "^0.4.0",
70
+ "@strapi/admin": "^5.29.0",
71
+ "@strapi/content-manager": "^5.29.0",
72
+ "@strapi/types": "^5.29.0",
73
+ "@types/node": "^25.0.2",
74
+ "@types/react": "^18.3.1",
75
+ "@types/react-dom": "^18.3.1",
76
+ "cross-env": "^10.0.0",
77
+ "eslint": "9.39.2",
78
+ "jest": "^30.2.0",
79
+ "npm-run-all": "^4.1.5",
80
+ "rimraf": "^6.0.1",
81
+ "rollup": "^4.52.4",
82
+ "typescript": "^5.3.3"
83
+ },
84
+ "engines": {
85
+ "node": ">=18.0.0",
86
+ "npm": ">=6.0.0"
87
+ },
88
+ "strapi": {
89
+ "kind": "plugin",
90
+ "name": "primershop-product-actions",
91
+ "displayName": "Product Actions",
92
+ "description": "Enables product actions (v0.0.9)"
93
+ },
94
+ "dependencies": {
95
+ "@strapi/design-system": "^2.0.0-rc.27",
96
+ "@strapi/icons": "^2.0.0-rc.27",
97
+ "@strapi/utils": "^5.29.0",
98
+ "react": "18.3.1",
99
+ "react-dom": "18.3.1",
100
+ "react-router-dom": "6.22.3",
101
+ "styled-components": "^6.1.19"
102
+ }
103
+ }