@tunghtml/strapi-plugin-export-import-clsx 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,88 @@
1
+ import React from 'react';
2
+ import pluginPkg from './package.json';
3
+ import pluginId from './admin/src/pluginId';
4
+ import Initializer from './admin/src/components/Initializer';
5
+ import ExportImportButtons from './admin/src/components/ExportImportButtons';
6
+
7
+ const name = pluginPkg.strapi.name;
8
+
9
+ export default {
10
+ register(app) {
11
+ const plugin = {
12
+ id: pluginId,
13
+ initializer: Initializer,
14
+ isReady: false,
15
+ name,
16
+ };
17
+
18
+ app.registerPlugin(plugin);
19
+ },
20
+
21
+ bootstrap(app) {
22
+ // Try different injection methods for Strapi v5
23
+ try {
24
+ // Method 1: Direct injection
25
+ if (app.injectContentManagerComponent) {
26
+ app.injectContentManagerComponent('listView', 'actions', {
27
+ name: 'export-import-buttons',
28
+ Component: ExportImportButtons,
29
+ });
30
+ }
31
+ // Method 2: Plugin-based injection
32
+ else if (app.getPlugin) {
33
+ const contentManager = app.getPlugin('content-manager');
34
+ if (contentManager && contentManager.injectComponent) {
35
+ contentManager.injectComponent('listView', 'actions', {
36
+ name: 'export-import-buttons',
37
+ Component: ExportImportButtons,
38
+ });
39
+ }
40
+ }
41
+ // Method 3: Global injection
42
+ else if (app.addComponent) {
43
+ app.addComponent('content-manager.listView.actions', ExportImportButtons);
44
+ }
45
+ } catch (error) {
46
+ console.warn('Failed to inject export-import buttons:', error);
47
+
48
+ // Fallback: Add as menu item if injection fails
49
+ app.addMenuLink({
50
+ to: `/plugins/${pluginId}`,
51
+ icon: () => React.createElement('span', null, '📊'),
52
+ intlLabel: {
53
+ id: `${pluginId}.plugin.name`,
54
+ defaultMessage: 'Export Import',
55
+ },
56
+ Component: async () => {
57
+ const component = await import('./admin/src/pages/App');
58
+ return component;
59
+ },
60
+ permissions: [],
61
+ });
62
+ }
63
+ },
64
+
65
+ async registerTrads(app) {
66
+ const { locales } = app;
67
+
68
+ const importedTrads = await Promise.all(
69
+ locales.map((locale) => {
70
+ return import(`./admin/src/translations/${locale}.json`)
71
+ .then(({ default: data }) => {
72
+ return {
73
+ data: data,
74
+ locale,
75
+ };
76
+ })
77
+ .catch(() => {
78
+ return {
79
+ data: {},
80
+ locale,
81
+ };
82
+ });
83
+ })
84
+ );
85
+
86
+ return Promise.resolve(importedTrads);
87
+ },
88
+ };
@@ -0,0 +1,34 @@
1
+ module.exports = {
2
+ register({ strapi }) {
3
+ // Register phase
4
+ },
5
+
6
+ bootstrap({ strapi }) {
7
+ // Bootstrap phase
8
+ },
9
+
10
+ destroy({ strapi }) {
11
+ // Destroy phase
12
+ },
13
+
14
+ config: {
15
+ default: {},
16
+ validator() {},
17
+ },
18
+
19
+ controllers: {
20
+ 'export-controller': require('./server/controllers/export-controller'),
21
+ 'import-controller': require('./server/controllers/import-controller'),
22
+ },
23
+
24
+ routes: require('./server/routes'),
25
+
26
+ services: {
27
+ 'export-service': require('./server/services/export-service'),
28
+ 'import-service': require('./server/services/import-service'),
29
+ },
30
+
31
+ contentTypes: {},
32
+ policies: {},
33
+ middlewares: {},
34
+ };