strapi-plugin-email-designer-v5
Version:
Strapi Email Designer (v5)
83 lines (82 loc) • 2.75 kB
JavaScript
;
const react = require("react");
const jsxRuntime = require("react/jsx-runtime");
const bs = require("react-icons/bs");
const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
const v = glob[path];
if (v) {
return typeof v === "function" ? v() : Promise.resolve(v);
}
return new Promise((_, reject) => {
(typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(
reject.bind(
null,
new Error(
"Unknown variable dynamic import: " + path + (path.split("/").length !== segs ? ". Note that variables only represent file names one level deep." : "")
)
)
);
});
};
const PLUGIN_ID = "email-designer-v5";
const pluginName = "email-designer-v5";
const Initializer = ({ setPlugin }) => {
const ref = react.useRef(setPlugin);
react.useEffect(() => {
ref.current(PLUGIN_ID);
}, []);
return null;
};
const PluginIcon = () => /* @__PURE__ */ jsxRuntime.jsx(bs.BsEnvelopeHeartFill, { size: 18 });
const APP_PERMISSIONS = {
"menu-link": [{ action: `plugin::${pluginName}.menu-link`, subject: null }]
};
const prefixPluginTranslations = (trad, pluginId) => {
return Object.keys(trad).reduce((acc, current) => {
acc[`${pluginId}.${current}`] = trad[current];
return acc;
}, {});
};
const index = {
register(app) {
app.addMenuLink({
to: `plugins/${PLUGIN_ID}`,
icon: PluginIcon,
intlLabel: {
id: `${PLUGIN_ID}.plugin.name`,
defaultMessage: PLUGIN_ID
},
Component: () => Promise.resolve().then(() => require("./App-XzoV3sJj.js")).then((mod) => ({
default: mod.App
})),
permissions: APP_PERMISSIONS["menu-link"]
});
app.registerPlugin({
id: PLUGIN_ID,
initializer: Initializer,
isReady: false,
name: PLUGIN_ID
});
},
async registerTrads({ locales }) {
const importedTrads = await Promise.all(
locales.map((locale) => {
return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/en.json": () => Promise.resolve().then(() => require("./en-mOU2uyR3.js")), "./translations/es.json": () => Promise.resolve().then(() => require("./es-DhAVf70R.js")), "./translations/fr.json": () => Promise.resolve().then(() => require("./fr-CZ_KxzVZ.js")) }), `./translations/${locale}.json`, 3).then(({ default: data }) => {
return {
data: prefixPluginTranslations(data, PLUGIN_ID),
locale
};
}).catch(() => {
return {
data: {},
locale
};
});
})
);
return Promise.resolve(importedTrads);
}
};
exports.PLUGIN_ID = PLUGIN_ID;
exports.index = index;
exports.pluginName = pluginName;