tienjs-chartbrew-plugin-strapi 0.1.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,96 @@
1
+ "use strict";
2
+ const react = require("react");
3
+ const jsxRuntime = require("react/jsx-runtime");
4
+ const icons = require("@strapi/icons");
5
+ const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
6
+ const v = glob[path];
7
+ if (v) {
8
+ return typeof v === "function" ? v() : Promise.resolve(v);
9
+ }
10
+ return new Promise((_, reject) => {
11
+ (typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(
12
+ reject.bind(
13
+ null,
14
+ new Error(
15
+ "Unknown variable dynamic import: " + path + (path.split("/").length !== segs ? ". Note that variables only represent file names one level deep." : "")
16
+ )
17
+ )
18
+ );
19
+ });
20
+ };
21
+ const PLUGIN_ID = "chartbrew";
22
+ const getTranslation = (id) => `${PLUGIN_ID}.${id}`;
23
+ const Initializer = ({ setPlugin }) => {
24
+ const ref = react.useRef(setPlugin);
25
+ react.useEffect(() => {
26
+ ref.current(PLUGIN_ID);
27
+ }, []);
28
+ return null;
29
+ };
30
+ const PluginIcon = () => /* @__PURE__ */ jsxRuntime.jsx(icons.PresentationChart, {});
31
+ const index = {
32
+ register(app) {
33
+ app.addMenuLink({
34
+ to: `plugins/${PLUGIN_ID}`,
35
+ icon: PluginIcon,
36
+ intlLabel: {
37
+ id: `${PLUGIN_ID}.plugin.name`,
38
+ defaultMessage: "Chartbrew"
39
+ },
40
+ Component: async () => {
41
+ const { App } = await Promise.resolve().then(() => require("./App-ngsyON1R.js"));
42
+ return App;
43
+ }
44
+ });
45
+ app.createSettingSection(
46
+ {
47
+ id: PLUGIN_ID,
48
+ intlLabel: {
49
+ id: `${PLUGIN_ID}.plugin.name`,
50
+ defaultMessage: "Chartbrew"
51
+ }
52
+ },
53
+ [
54
+ {
55
+ intlLabel: {
56
+ id: `${PLUGIN_ID}.plugin.name`,
57
+ defaultMessage: "Setup settings"
58
+ },
59
+ id: "settings",
60
+ to: `/settings/${PLUGIN_ID}`,
61
+ Component: async () => {
62
+ const { Setup } = await Promise.resolve().then(() => require("./Setup-CL3F4zOi.js"));
63
+ return Setup;
64
+ }
65
+ }
66
+ ]
67
+ );
68
+ app.registerPlugin({
69
+ id: PLUGIN_ID,
70
+ initializer: Initializer,
71
+ isReady: false,
72
+ name: PLUGIN_ID
73
+ });
74
+ },
75
+ async registerTrads(app) {
76
+ const { locales } = app;
77
+ const importedTranslations = await Promise.all(
78
+ locales.map((locale) => {
79
+ return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/en.json": () => Promise.resolve().then(() => require("./en-B4KWt_jN.js")), "./translations/fr.json": () => Promise.resolve().then(() => require("./fr-C8Qw4iPZ.js")) }), `./translations/${locale}.json`, 3).then(({ default: data }) => {
80
+ return {
81
+ data: getTranslation(data),
82
+ locale
83
+ };
84
+ }).catch(() => {
85
+ return {
86
+ data: {},
87
+ locale
88
+ };
89
+ });
90
+ })
91
+ );
92
+ return importedTranslations;
93
+ }
94
+ };
95
+ exports.PLUGIN_ID = PLUGIN_ID;
96
+ exports.index = index;
@@ -0,0 +1,97 @@
1
+ import { useRef, useEffect } from "react";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import { PresentationChart } from "@strapi/icons";
4
+ const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
5
+ const v = glob[path];
6
+ if (v) {
7
+ return typeof v === "function" ? v() : Promise.resolve(v);
8
+ }
9
+ return new Promise((_, reject) => {
10
+ (typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(
11
+ reject.bind(
12
+ null,
13
+ new Error(
14
+ "Unknown variable dynamic import: " + path + (path.split("/").length !== segs ? ". Note that variables only represent file names one level deep." : "")
15
+ )
16
+ )
17
+ );
18
+ });
19
+ };
20
+ const PLUGIN_ID = "chartbrew";
21
+ const getTranslation = (id) => `${PLUGIN_ID}.${id}`;
22
+ const Initializer = ({ setPlugin }) => {
23
+ const ref = useRef(setPlugin);
24
+ useEffect(() => {
25
+ ref.current(PLUGIN_ID);
26
+ }, []);
27
+ return null;
28
+ };
29
+ const PluginIcon = () => /* @__PURE__ */ jsx(PresentationChart, {});
30
+ const index = {
31
+ register(app) {
32
+ app.addMenuLink({
33
+ to: `plugins/${PLUGIN_ID}`,
34
+ icon: PluginIcon,
35
+ intlLabel: {
36
+ id: `${PLUGIN_ID}.plugin.name`,
37
+ defaultMessage: "Chartbrew"
38
+ },
39
+ Component: async () => {
40
+ const { App } = await import("./App-Be1FtvNK.mjs");
41
+ return App;
42
+ }
43
+ });
44
+ app.createSettingSection(
45
+ {
46
+ id: PLUGIN_ID,
47
+ intlLabel: {
48
+ id: `${PLUGIN_ID}.plugin.name`,
49
+ defaultMessage: "Chartbrew"
50
+ }
51
+ },
52
+ [
53
+ {
54
+ intlLabel: {
55
+ id: `${PLUGIN_ID}.plugin.name`,
56
+ defaultMessage: "Setup settings"
57
+ },
58
+ id: "settings",
59
+ to: `/settings/${PLUGIN_ID}`,
60
+ Component: async () => {
61
+ const { Setup } = await import("./Setup-C_xPro4U.mjs");
62
+ return Setup;
63
+ }
64
+ }
65
+ ]
66
+ );
67
+ app.registerPlugin({
68
+ id: PLUGIN_ID,
69
+ initializer: Initializer,
70
+ isReady: false,
71
+ name: PLUGIN_ID
72
+ });
73
+ },
74
+ async registerTrads(app) {
75
+ const { locales } = app;
76
+ const importedTranslations = await Promise.all(
77
+ locales.map((locale) => {
78
+ return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/en.json": () => import("./en-Byx4XI2L.mjs"), "./translations/fr.json": () => import("./fr-hkSxFuzl.mjs") }), `./translations/${locale}.json`, 3).then(({ default: data }) => {
79
+ return {
80
+ data: getTranslation(data),
81
+ locale
82
+ };
83
+ }).catch(() => {
84
+ return {
85
+ data: {},
86
+ locale
87
+ };
88
+ });
89
+ })
90
+ );
91
+ return importedTranslations;
92
+ }
93
+ };
94
+ export {
95
+ PLUGIN_ID as P,
96
+ index as i
97
+ };