UNPKG

strapi-google-analytics-dashboard

Version:

A plug-and-play Google Analytics 4 dashboard for Strapi 5.x. No code required — just install, configure your credentials, and instantly start tracking GA metrics directly in your admin panel.

78 lines (77 loc) 2.46 kB
"use strict"; const react = require("react"); const jsxRuntime = require("react/jsx-runtime"); const icons = require("@strapi/icons"); 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 = "strapi-google-analytics-dashboard"; const Initializer = ({ setPlugin }) => { const ref = react.useRef(setPlugin); react.useEffect(() => { ref.current(PLUGIN_ID); }, []); return null; }; const PluginIcon = () => /* @__PURE__ */ jsxRuntime.jsx(icons.PresentationChart, { style: { width: 24, height: 24 } }); const index = { register(app) { app.addMenuLink({ to: `plugins/${PLUGIN_ID}`, icon: PluginIcon, intlLabel: { id: `${PLUGIN_ID}.plugin.name`, defaultMessage: "Google Analytics" }, Component: async () => { const Home = await Promise.resolve().then(() => require("../_chunks/HomePage-DzENaCXK.js")); return Home; } }); app.addSettingsLink("global", { id: PLUGIN_ID, intlLabel: { id: `${PLUGIN_ID}.plugin.name`, defaultMessage: "Google Analytics" }, to: `/settings/${PLUGIN_ID}`, icon: PluginIcon, Component: async () => { const Settings = await Promise.resolve().then(() => require("../_chunks/Settings-X23_MvqN.js")); return Settings; } }); app.registerPlugin({ id: PLUGIN_ID, initializer: Initializer, isReady: false, name: "Google Analytics" }); }, async registerTrads({ locales }) { return Promise.all( locales.map(async (locale) => { try { const { default: data } = await __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/en.json": () => Promise.resolve().then(() => require("../_chunks/en-B4KWt_jN.js")) }), `./translations/${locale}.json`, 3); return { data, locale }; } catch { return { data: {}, locale }; } }) ); } }; module.exports = index;