strapi-plugin-comments
Version:
121 lines (120 loc) • 4.07 kB
JavaScript
import "react";
import { Flex as u } from "@strapi/design-system";
import "@strapi/icons";
import { styled as g } from "styled-components";
import { jsx as o } from "react/jsx-runtime";
const a = (e, n = "") => Object.keys(e).reduce((i, r) => {
const c = n.length ? `${n}.` : "";
return typeof e[r] == "object" && e[r] !== null && !Array.isArray(e[r]) ? Object.assign(i, a(e[r], c + r)) : i[c + r] = e[r], i;
}, {}), m = (e, n) => {
if (!n)
throw new TypeError("pluginId can't be empty");
return Object.keys(e).reduce((i, r) => (i[`${n}.${r}`] = e[r], i), {});
};
g(u)`
&>* {
width: 100%;
}
`;
const f = "strapi-plugin-comments", M = "3.2.4", $ = {
displayName: "Comments"
}, b = 576, h = ({ width: e = 24, height: n = 24 }) => /* @__PURE__ */ o("svg", { viewBox: `0 0 ${e} ${n}`, xmlns: "http://www.w3.org/2000/svg", height: `${n}px`, children: /* @__PURE__ */ o("g", { style: { transform: `scale(${e / b})` }, fill: "currentColor", children: /* @__PURE__ */ o("path", { d: "M416 192c0-88.4-93.1-160-208-160S0 103.6 0 192c0 34.3 14.1 65.9 38 92-13.4 30.2-35.5 54.2-35.8 54.5-2.2 2.3-2.8 5.7-1.5 8.7S4.8 352 8 352c36.6 0 66.9-12.3 88.7-25 32.2 15.7 70.3 25 111.3 25 114.9 0 208-71.6 208-160zm122 220c23.9-26 38-57.7 38-92 0-66.9-53.5-124.2-129.3-148.1.9 6.6 1.3 13.3 1.3 20.1 0 105.9-107.7 192-240 192-10.8 0-21.3-.8-31.7-1.9C207.8 439.6 281.8 480 368 480c41 0 79.1-9.2 111.3-25 21.8 12.7 52.1 25 88.7 25 3.2 0 6.1-1.9 7.3-4.8 1.3-2.9.7-6.3-1.5-8.7-.3-.3-22.4-24.2-35.8-54.5z" }) }) }), w = /* @__PURE__ */ o(h, {}), j = () => w, t = {
render: (e) => `plugin::comments.${e}`,
comments: {
read: "comments-read",
moderate: "comments-moderate"
},
reports: {
read: "reports-read",
review: "reports-review"
},
settings: {
read: "settings-read",
change: "settings-change"
}
}, l = {
access: [
{ action: t.render(t.comments.read), subject: null },
{ action: t.render(t.reports.read), subject: null },
// { action: 'plugin::comments.discover.read', subject: null },
{ action: t.render(t.settings.read), subject: null }
],
// discover: [{ action: 'plugin::comments.discover.read', subject: null }],
moderate: [
{
action: t.render(t.comments.moderate),
subject: null
}
],
reports: [
{ action: t.render(t.reports.read), subject: null }
],
reportsReview: [
{ action: t.render(t.reports.review), subject: null }
],
settings: [
{ action: t.render(t.settings.read), subject: null }
],
settingsChange: [
{ action: t.render(t.settings.change), subject: null }
]
}, s = f.replace(/^strapi-plugin-/i, ""), p = {
en: () => import("./en-CT6Rt2uf.mjs"),
fr: () => import("./fr-CTKzDZoe.mjs"),
"pt-BR": () => import("./pt-BR-ZzKZqryk.mjs"),
tr: () => import("./tr-6Vivmm9L.mjs"),
ru: () => import("./ru-NqAiywiG.mjs"),
"zh-Hans": () => import("./zh-Hans-B3CCaxs8.mjs"),
pl: () => import("./pl-BE9Xc2Tq.mjs")
}, { displayName: d } = $, S = {
register(e) {
e.addMenuLink({
to: `/plugins/${s}`,
badgeContent: 1,
icon: j,
intlLabel: {
id: `${s}.plugin.name`,
defaultMessage: d
},
Component: () => import("./index-CqWqvu-C.mjs"),
permissions: l.access
}), e.createSettingSection(
{
id: s,
intlLabel: {
id: `${s}.plugin.section`,
defaultMessage: `${d} plugin`
}
},
[
{
intlLabel: {
id: `${s}.plugin.section.item`,
defaultMessage: "Configuration"
},
id: "comments",
to: `/settings/${s}`,
Component: () => import("./index-D9B_m9fB.mjs"),
permissions: l.settings
}
]
);
},
registerTrads: async function({ locales: e = [] }) {
return Promise.all(
e.map(async (n) => n in p ? p[n]().then(({ default: r }) => ({
data: m(a(r), s),
locale: n
})) : {
data: m(a({}), s),
locale: n
})
);
}
};
export {
l as a,
S as i,
s as p,
M as v
};