@filerobot-strapi/content-plugin
Version:
Scaleflex DAM normalizes, resizes, optimizes and distributes your images rocket fast around the world.
73 lines (72 loc) • 2.27 kB
JavaScript
import { useRef, useEffect } from "react";
import { jsx } from "react/jsx-runtime";
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 = "scaleflex-dam";
const Initializer = ({ setPlugin }) => {
const ref = useRef(setPlugin);
useEffect(() => {
ref.current(PLUGIN_ID);
}, []);
return null;
};
const PluginIcon = () => /* @__PURE__ */ jsx("img", { src: "https://assets.scaleflex.com/Marketing/Logos/Filerobot%20Logos/Logo%20Icon/icon.png?vh=23f160", width: "20", height: "20" });
const getTranslation = (data) => {
return Object.keys(data).reduce((acc, key) => {
acc[`${PLUGIN_ID}.${key}`] = data[key];
return acc;
}, {});
};
const index = {
register(app) {
app.addMenuLink({
to: `plugins/${PLUGIN_ID}`,
icon: PluginIcon,
intlLabel: {
id: `${PLUGIN_ID}.plugin.name`,
defaultMessage: "Scaleflex DAM"
},
Component: async () => {
const { App } = await import("./App-L2UYctiL.mjs");
return App;
}
});
app.registerPlugin({
id: PLUGIN_ID,
initializer: Initializer,
isReady: false,
name: PLUGIN_ID
});
},
async registerTrads({ locales }) {
const importedTranslations = await Promise.all(
locales.map(async (locale) => {
try {
const { default: data } = await __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/en.json": () => import("./en-r7lu9xMg.mjs"), "./translations/fr.json": () => import("./fr-Ge-jvwxL.mjs") }), `./translations/${locale}.json`, 3);
return { data: getTranslation(data), locale };
} catch {
return { data: {}, locale };
}
})
);
return importedTranslations;
}
};
export {
PLUGIN_ID as P,
index as i
};