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

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 +242 -17
  4. package/dist/server/index.mjs +245 -17
  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,19 +1,244 @@
1
- 'use strict';
2
-
3
- var index$3 = require('./controllers/index.js');
4
- var index$2 = require('./routes/index.js');
5
- var index$1 = require('./services/index.js');
6
- var register = require('./register.js');
7
- var bootstrap = require('./bootstrap.js');
8
-
9
- var index = {
10
- register,
11
- controllers: index$3.controllers,
12
- routes: index$2.routes,
13
- services: index$1.services,
14
- middlewares: {},
15
- bootstrap
1
+ "use strict";
2
+ const productSeries = ({
3
+ strapi
4
+ }) => ({
5
+ async createProducts(ctx) {
6
+ try {
7
+ const { id, count = 1 } = ctx.request.body;
8
+ const products = await strapi.plugin("primershop-product-actions").service("productSeries").createProductsFromSeries(id, count);
9
+ return { data: products };
10
+ } catch (error) {
11
+ ctx.throw(500, error);
12
+ }
13
+ },
14
+ async updateProducts(ctx) {
15
+ try {
16
+ const { seriesId, fieldsToUpdate } = ctx.request.body;
17
+ await strapi.plugin("primershop-product-actions").service("productSeries").updateSeriesProducts(seriesId, fieldsToUpdate);
18
+ return { success: true };
19
+ } catch (error) {
20
+ ctx.throw(500, error);
21
+ }
22
+ }
23
+ });
24
+ const controllers = {
25
+ productSeries
26
+ };
27
+ const admin = {
28
+ type: "admin",
29
+ routes: [
30
+ {
31
+ method: "POST",
32
+ path: "/create-products",
33
+ handler: "productSeries.createProducts",
34
+ config: {
35
+ policies: [
36
+ {
37
+ name: "admin::hasPermissions",
38
+ config: {
39
+ actions: [
40
+ "plugin::primershop-product-actions.product-series.create"
41
+ ]
42
+ }
43
+ }
44
+ ]
45
+ }
46
+ },
47
+ {
48
+ method: "PUT",
49
+ path: "/update-products",
50
+ handler: "productSeries.updateProducts",
51
+ config: {
52
+ policies: [
53
+ {
54
+ name: "admin::hasPermissions",
55
+ config: {
56
+ actions: [
57
+ "plugin::primershop-product-actions.product-series.update"
58
+ ]
59
+ }
60
+ }
61
+ ]
62
+ }
63
+ }
64
+ ]
65
+ };
66
+ const routes = { admin };
67
+ const productSeriesService = ({ strapi }) => ({
68
+ async createProductsFromSeries(seriesId, count = 1) {
69
+ const series = await getSeries(strapi, seriesId);
70
+ const products = [];
71
+ const startIndex = series.products?.length || 0;
72
+ for (let i = 0; i < count; i++) {
73
+ const index2 = startIndex + i;
74
+ const product = await strapi.documents("api::product.product").create({
75
+ data: {
76
+ name: `${series.name} #${index2 + 1}`,
77
+ slug: `${series.slug}-${index2 + 1}`,
78
+ series: {
79
+ set: seriesId
80
+ },
81
+ seriesIndex: index2,
82
+ category: series.category ? {
83
+ set: series.category.documentId
84
+ } : null,
85
+ creator: series.creator ? {
86
+ set: series.creator?.documentId
87
+ } : null,
88
+ publishedAt: void 0,
89
+ // Copy all required fields from series
90
+ description: series.description,
91
+ shortDescription: series.shortDescription,
92
+ media: series.media,
93
+ coverImage: series.coverImage,
94
+ seo: series.seo,
95
+ totalCost: series.totalCost,
96
+ wholesalePrice: series.wholesalePrice,
97
+ retailPrice: series.retailPrice
98
+ }
99
+ });
100
+ products.push(product);
101
+ }
102
+ return products;
103
+ },
104
+ async updateSeriesProducts(seriesId, fieldsToUpdate) {
105
+ const series = await getSeries(strapi, seriesId);
106
+ const dataToUpdate = {};
107
+ if (fieldsToUpdate.includes("description")) {
108
+ dataToUpdate.description = series.description;
109
+ }
110
+ if (fieldsToUpdate.includes("shortDescription")) {
111
+ dataToUpdate.shortDescription = series.shortDescription;
112
+ }
113
+ if (fieldsToUpdate.includes("media")) {
114
+ dataToUpdate.media = series.media;
115
+ }
116
+ if (fieldsToUpdate.includes("coverImage")) {
117
+ dataToUpdate.coverImage = series.coverImage;
118
+ }
119
+ if (fieldsToUpdate.includes("seo")) {
120
+ dataToUpdate.seo = series.seo;
121
+ }
122
+ if (fieldsToUpdate.includes("totalCost")) {
123
+ dataToUpdate.totalCost = series.totalCost;
124
+ }
125
+ if (fieldsToUpdate.includes("wholesalePrice")) {
126
+ dataToUpdate.wholesalePrice = series.wholesalePrice;
127
+ }
128
+ if (fieldsToUpdate.includes("retailPrice")) {
129
+ dataToUpdate.retailPrice = series.retailPrice;
130
+ }
131
+ if (fieldsToUpdate.includes("category")) {
132
+ dataToUpdate.category = {
133
+ set: [series.category?.documentId]
134
+ };
135
+ }
136
+ if (fieldsToUpdate.includes("creator")) {
137
+ dataToUpdate.creator = {
138
+ set: [series.creator?.documentId]
139
+ };
140
+ }
141
+ const updatePromises = series.products?.map(
142
+ (product) => strapi.documents("api::product.product").update({
143
+ documentId: product.documentId,
144
+ data: {
145
+ ...dataToUpdate
146
+ }
147
+ })
148
+ );
149
+ if (updatePromises) {
150
+ await Promise.all(updatePromises);
151
+ }
152
+ return true;
153
+ }
154
+ });
155
+ async function getSeries(strapi, seriesId) {
156
+ const series = await strapi.documents("api::product-series.product-series").findOne({
157
+ documentId: seriesId,
158
+ populate: [
159
+ "products",
160
+ "category",
161
+ "creator",
162
+ "media",
163
+ "coverImage",
164
+ "seo"
165
+ ]
166
+ });
167
+ if (!series) {
168
+ throw new Error("Series not found");
169
+ }
170
+ return series;
171
+ }
172
+ const services = {
173
+ productSeries: productSeriesService
174
+ };
175
+ const register = ({ strapi: _strapi }) => {
176
+ };
177
+ const permissions = {
178
+ actions: [
179
+ {
180
+ section: "plugins",
181
+ displayName: "Use product actions",
182
+ uid: "use",
183
+ pluginName: "primershop-product-actions"
184
+ },
185
+ {
186
+ section: "plugins",
187
+ displayName: "Create",
188
+ uid: "product-series.create",
189
+ subCategory: "product-series",
190
+ pluginName: "primershop-product-actions"
191
+ },
192
+ {
193
+ section: "plugins",
194
+ displayName: "Read",
195
+ uid: "product-series.read",
196
+ subCategory: "product-series",
197
+ pluginName: "primershop-product-actions",
198
+ aliases: [
199
+ {
200
+ actionId: "plugin::content-manager.explorer.read",
201
+ subjects: ["api::product-series.product-series"]
202
+ }
203
+ ]
204
+ },
205
+ {
206
+ section: "plugins",
207
+ displayName: "Update",
208
+ uid: "product-series.update",
209
+ subCategory: "product-series",
210
+ pluginName: "primershop-product-actions"
211
+ },
212
+ {
213
+ section: "plugins",
214
+ displayName: "Delete",
215
+ uid: "product-series.delete",
216
+ subCategory: "product-series",
217
+ pluginName: "primershop-product-actions"
218
+ }
219
+ ]
220
+ };
221
+ const bootstrap = async ({ strapi }) => {
222
+ try {
223
+ strapi.admin.services.permission.actionProvider.registerMany(
224
+ permissions.actions
225
+ );
226
+ strapi.log.info(
227
+ `[primershop-product-actions] Registered ${permissions.actions.length} permission actions`
228
+ );
229
+ } catch (error) {
230
+ strapi.log.error(
231
+ "[primershop-product-actions] Failed to register permissions:",
232
+ error
233
+ );
234
+ throw error;
235
+ }
236
+ };
237
+ const index = {
238
+ register,
239
+ controllers,
240
+ routes,
241
+ services,
242
+ bootstrap
16
243
  };
17
-
18
244
  module.exports = index;
19
- //# sourceMappingURL=index.js.map
@@ -1,17 +1,245 @@
1
- import { controllers } from './controllers/index.mjs';
2
- import { routes } from './routes/index.mjs';
3
- import { services } from './services/index.mjs';
4
- import register from './register.mjs';
5
- import bootstrap from './bootstrap.mjs';
6
-
7
- var index = {
8
- register,
9
- controllers,
10
- routes,
11
- services,
12
- middlewares: {},
13
- bootstrap
14
- };
15
-
16
- export { index as default };
17
- //# sourceMappingURL=index.mjs.map
1
+ const productSeries = ({
2
+ strapi
3
+ }) => ({
4
+ async createProducts(ctx) {
5
+ try {
6
+ const { id, count = 1 } = ctx.request.body;
7
+ const products = await strapi.plugin("primershop-product-actions").service("productSeries").createProductsFromSeries(id, count);
8
+ return { data: products };
9
+ } catch (error) {
10
+ ctx.throw(500, error);
11
+ }
12
+ },
13
+ async updateProducts(ctx) {
14
+ try {
15
+ const { seriesId, fieldsToUpdate } = ctx.request.body;
16
+ await strapi.plugin("primershop-product-actions").service("productSeries").updateSeriesProducts(seriesId, fieldsToUpdate);
17
+ return { success: true };
18
+ } catch (error) {
19
+ ctx.throw(500, error);
20
+ }
21
+ }
22
+ });
23
+ const controllers = {
24
+ productSeries
25
+ };
26
+ const admin = {
27
+ type: "admin",
28
+ routes: [
29
+ {
30
+ method: "POST",
31
+ path: "/create-products",
32
+ handler: "productSeries.createProducts",
33
+ config: {
34
+ policies: [
35
+ {
36
+ name: "admin::hasPermissions",
37
+ config: {
38
+ actions: [
39
+ "plugin::primershop-product-actions.product-series.create"
40
+ ]
41
+ }
42
+ }
43
+ ]
44
+ }
45
+ },
46
+ {
47
+ method: "PUT",
48
+ path: "/update-products",
49
+ handler: "productSeries.updateProducts",
50
+ config: {
51
+ policies: [
52
+ {
53
+ name: "admin::hasPermissions",
54
+ config: {
55
+ actions: [
56
+ "plugin::primershop-product-actions.product-series.update"
57
+ ]
58
+ }
59
+ }
60
+ ]
61
+ }
62
+ }
63
+ ]
64
+ };
65
+ const routes = { admin };
66
+ const productSeriesService = ({ strapi }) => ({
67
+ async createProductsFromSeries(seriesId, count = 1) {
68
+ const series = await getSeries(strapi, seriesId);
69
+ const products = [];
70
+ const startIndex = series.products?.length || 0;
71
+ for (let i = 0; i < count; i++) {
72
+ const index2 = startIndex + i;
73
+ const product = await strapi.documents("api::product.product").create({
74
+ data: {
75
+ name: `${series.name} #${index2 + 1}`,
76
+ slug: `${series.slug}-${index2 + 1}`,
77
+ series: {
78
+ set: seriesId
79
+ },
80
+ seriesIndex: index2,
81
+ category: series.category ? {
82
+ set: series.category.documentId
83
+ } : null,
84
+ creator: series.creator ? {
85
+ set: series.creator?.documentId
86
+ } : null,
87
+ publishedAt: void 0,
88
+ // Copy all required fields from series
89
+ description: series.description,
90
+ shortDescription: series.shortDescription,
91
+ media: series.media,
92
+ coverImage: series.coverImage,
93
+ seo: series.seo,
94
+ totalCost: series.totalCost,
95
+ wholesalePrice: series.wholesalePrice,
96
+ retailPrice: series.retailPrice
97
+ }
98
+ });
99
+ products.push(product);
100
+ }
101
+ return products;
102
+ },
103
+ async updateSeriesProducts(seriesId, fieldsToUpdate) {
104
+ const series = await getSeries(strapi, seriesId);
105
+ const dataToUpdate = {};
106
+ if (fieldsToUpdate.includes("description")) {
107
+ dataToUpdate.description = series.description;
108
+ }
109
+ if (fieldsToUpdate.includes("shortDescription")) {
110
+ dataToUpdate.shortDescription = series.shortDescription;
111
+ }
112
+ if (fieldsToUpdate.includes("media")) {
113
+ dataToUpdate.media = series.media;
114
+ }
115
+ if (fieldsToUpdate.includes("coverImage")) {
116
+ dataToUpdate.coverImage = series.coverImage;
117
+ }
118
+ if (fieldsToUpdate.includes("seo")) {
119
+ dataToUpdate.seo = series.seo;
120
+ }
121
+ if (fieldsToUpdate.includes("totalCost")) {
122
+ dataToUpdate.totalCost = series.totalCost;
123
+ }
124
+ if (fieldsToUpdate.includes("wholesalePrice")) {
125
+ dataToUpdate.wholesalePrice = series.wholesalePrice;
126
+ }
127
+ if (fieldsToUpdate.includes("retailPrice")) {
128
+ dataToUpdate.retailPrice = series.retailPrice;
129
+ }
130
+ if (fieldsToUpdate.includes("category")) {
131
+ dataToUpdate.category = {
132
+ set: [series.category?.documentId]
133
+ };
134
+ }
135
+ if (fieldsToUpdate.includes("creator")) {
136
+ dataToUpdate.creator = {
137
+ set: [series.creator?.documentId]
138
+ };
139
+ }
140
+ const updatePromises = series.products?.map(
141
+ (product) => strapi.documents("api::product.product").update({
142
+ documentId: product.documentId,
143
+ data: {
144
+ ...dataToUpdate
145
+ }
146
+ })
147
+ );
148
+ if (updatePromises) {
149
+ await Promise.all(updatePromises);
150
+ }
151
+ return true;
152
+ }
153
+ });
154
+ async function getSeries(strapi, seriesId) {
155
+ const series = await strapi.documents("api::product-series.product-series").findOne({
156
+ documentId: seriesId,
157
+ populate: [
158
+ "products",
159
+ "category",
160
+ "creator",
161
+ "media",
162
+ "coverImage",
163
+ "seo"
164
+ ]
165
+ });
166
+ if (!series) {
167
+ throw new Error("Series not found");
168
+ }
169
+ return series;
170
+ }
171
+ const services = {
172
+ productSeries: productSeriesService
173
+ };
174
+ const register = ({ strapi: _strapi }) => {
175
+ };
176
+ const permissions = {
177
+ actions: [
178
+ {
179
+ section: "plugins",
180
+ displayName: "Use product actions",
181
+ uid: "use",
182
+ pluginName: "primershop-product-actions"
183
+ },
184
+ {
185
+ section: "plugins",
186
+ displayName: "Create",
187
+ uid: "product-series.create",
188
+ subCategory: "product-series",
189
+ pluginName: "primershop-product-actions"
190
+ },
191
+ {
192
+ section: "plugins",
193
+ displayName: "Read",
194
+ uid: "product-series.read",
195
+ subCategory: "product-series",
196
+ pluginName: "primershop-product-actions",
197
+ aliases: [
198
+ {
199
+ actionId: "plugin::content-manager.explorer.read",
200
+ subjects: ["api::product-series.product-series"]
201
+ }
202
+ ]
203
+ },
204
+ {
205
+ section: "plugins",
206
+ displayName: "Update",
207
+ uid: "product-series.update",
208
+ subCategory: "product-series",
209
+ pluginName: "primershop-product-actions"
210
+ },
211
+ {
212
+ section: "plugins",
213
+ displayName: "Delete",
214
+ uid: "product-series.delete",
215
+ subCategory: "product-series",
216
+ pluginName: "primershop-product-actions"
217
+ }
218
+ ]
219
+ };
220
+ const bootstrap = async ({ strapi }) => {
221
+ try {
222
+ strapi.admin.services.permission.actionProvider.registerMany(
223
+ permissions.actions
224
+ );
225
+ strapi.log.info(
226
+ `[primershop-product-actions] Registered ${permissions.actions.length} permission actions`
227
+ );
228
+ } catch (error) {
229
+ strapi.log.error(
230
+ "[primershop-product-actions] Failed to register permissions:",
231
+ error
232
+ );
233
+ throw error;
234
+ }
235
+ };
236
+ const index = {
237
+ register,
238
+ controllers,
239
+ routes,
240
+ services,
241
+ bootstrap
242
+ };
243
+ export {
244
+ index as default
245
+ };
package/package.json CHANGED
@@ -1,36 +1,36 @@
1
1
  {
2
2
  "name": "@primershop/strapi-plugin-product-actions",
3
- "version": "0.0.12",
4
- "description": "Enables product actions for Strapi (v0.0.12)",
3
+ "version": "0.0.14",
4
+ "description": "Enables product actions for Strapi (v0.0.14)",
5
5
  "exports": {
6
6
  "./strapi-admin": {
7
7
  "import": "./dist/admin/index.mjs",
8
8
  "require": "./dist/admin/index.js",
9
+ "source": "./admin/src/index.ts",
9
10
  "default": "./dist/admin/index.js"
10
11
  },
11
12
  "./strapi-server": {
12
13
  "import": "./dist/server/index.mjs",
14
+ "source": "./server/src/index.ts",
13
15
  "require": "./dist/server/index.js",
14
16
  "default": "./dist/server/index.js"
15
17
  },
16
18
  "./package.json": "./package.json"
17
19
  },
18
20
  "files": [
19
- "dist/"
21
+ "dist"
20
22
  ],
21
23
  "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 ",
24
+ "build": "strapi-plugin build",
25
+ "watch": "strapi-plugin watch",
26
+ "watch:link": "strapi-plugin watch:link",
27
+ "verify": "strapi-plugin verify",
27
28
  "clean": "rimraf ./dist",
28
29
  "lint": "eslint .",
29
30
  "test:front": "cross-env IS_EE=true jest --config ./jest.config.front.js",
30
31
  "test:ts:front": "tsc -p admin/tsconfig.json",
31
32
  "test:unit": "jest",
32
33
  "test:unit:watch": "jest --watch",
33
- "watch": "rollup -c -w",
34
34
  "deploy": "node ../../scripts/plugin-deploy.js strapi-plugin-product-actions",
35
35
  "deploy:patch": "node ../../scripts/plugin-deploy.js strapi-plugin-product-actions patch",
36
36
  "deploy:minor": "node ../../scripts/plugin-deploy.js strapi-plugin-product-actions minor",
@@ -69,6 +69,7 @@
69
69
  "@rollup/plugin-swc": "^0.4.0",
70
70
  "@strapi/admin": "^5.29.0",
71
71
  "@strapi/content-manager": "^5.29.0",
72
+ "@strapi/sdk-plugin": "^5.4.0",
72
73
  "@strapi/types": "^5.29.0",
73
74
  "@types/node": "^25.0.2",
74
75
  "@types/react": "^18.3.1",
@@ -89,7 +90,7 @@
89
90
  "kind": "plugin",
90
91
  "name": "primershop-product-actions",
91
92
  "displayName": "Product Actions",
92
- "description": "Enables product actions (v0.0.12)"
93
+ "description": "Enables product actions (v0.0.14)"
93
94
  },
94
95
  "dependencies": {
95
96
  "@strapi/design-system": "^2.0.0-rc.27",
@@ -1,17 +0,0 @@
1
- 'use strict';
2
-
3
- var react = require('react');
4
- var pluginId = require('../../pluginId.js');
5
-
6
- /**
7
- * @type {import('react').FC<{ setPlugin: (id: string) => void }>}
8
- */ const Initializer = ({ setPlugin })=>{
9
- const ref = react.useRef(setPlugin);
10
- react.useEffect(()=>{
11
- ref.current(pluginId.PLUGIN_ID);
12
- }, []);
13
- return null;
14
- };
15
-
16
- exports.Initializer = Initializer;
17
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":["../../../../admin/src/components/Initializer/index.tsx"],"sourcesContent":["import { useEffect, useRef } from \"react\";\r\n\r\nimport { PLUGIN_ID } from \"../../pluginId\";\r\n\r\n/**\r\n * @type {import('react').FC<{ setPlugin: (id: string) => void }>}\r\n */\r\nconst Initializer = ({ setPlugin }: { setPlugin: (id: string) => void }) => {\r\n const ref = useRef(setPlugin);\r\n\r\n useEffect(() => {\r\n ref.current(PLUGIN_ID);\r\n }, []);\r\n\r\n return null;\r\n};\r\n\r\nexport { Initializer };\r\n"],"names":["Initializer","setPlugin","ref","useRef","useEffect","current","PLUGIN_ID"],"mappings":";;;;;AAIA;;AAEC,IACD,MAAMA,WAAAA,GAAc,CAAC,EAAEC,SAAS,EAAuC,GAAA;AACrE,IAAA,MAAMC,MAAMC,YAAAA,CAAOF,SAAAA,CAAAA;IAEnBG,eAAAA,CAAU,IAAA;AACRF,QAAAA,GAAAA,CAAIG,OAAO,CAACC,kBAAAA,CAAAA;AACd,IAAA,CAAA,EAAG,EAAE,CAAA;IAEL,OAAO,IAAA;AACT;;;;"}
@@ -1,15 +0,0 @@
1
- import { useRef, useEffect } from 'react';
2
- import { PLUGIN_ID } from '../../pluginId.mjs';
3
-
4
- /**
5
- * @type {import('react').FC<{ setPlugin: (id: string) => void }>}
6
- */ const Initializer = ({ setPlugin })=>{
7
- const ref = useRef(setPlugin);
8
- useEffect(()=>{
9
- ref.current(PLUGIN_ID);
10
- }, []);
11
- return null;
12
- };
13
-
14
- export { Initializer };
15
- //# sourceMappingURL=index.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.mjs","sources":["../../../../admin/src/components/Initializer/index.tsx"],"sourcesContent":["import { useEffect, useRef } from \"react\";\r\n\r\nimport { PLUGIN_ID } from \"../../pluginId\";\r\n\r\n/**\r\n * @type {import('react').FC<{ setPlugin: (id: string) => void }>}\r\n */\r\nconst Initializer = ({ setPlugin }: { setPlugin: (id: string) => void }) => {\r\n const ref = useRef(setPlugin);\r\n\r\n useEffect(() => {\r\n ref.current(PLUGIN_ID);\r\n }, []);\r\n\r\n return null;\r\n};\r\n\r\nexport { Initializer };\r\n"],"names":["Initializer","setPlugin","ref","useRef","useEffect","current","PLUGIN_ID"],"mappings":";;;AAIA;;AAEC,IACD,MAAMA,WAAAA,GAAc,CAAC,EAAEC,SAAS,EAAuC,GAAA;AACrE,IAAA,MAAMC,MAAMC,MAAAA,CAAOF,SAAAA,CAAAA;IAEnBG,SAAAA,CAAU,IAAA;AACRF,QAAAA,GAAAA,CAAIG,OAAO,CAACC,SAAAA,CAAAA;AACd,IAAA,CAAA,EAAG,EAAE,CAAA;IAEL,OAAO,IAAA;AACT;;;;"}