@sensinum/strapi-plugin-xecp 5.0.0-beta.1
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.
- package/LICENSE.md +7 -0
- package/README.md +195 -0
- package/dist/admin/App-BXTR7LbD.js +30 -0
- package/dist/admin/App-CYIDJm4p.mjs +1927 -0
- package/dist/admin/TruncatedTypography-72wp11m4.js +12 -0
- package/dist/admin/TruncatedTypography-Df3hMZdB.mjs +34 -0
- package/dist/admin/de-C25k5cq2.mjs +196 -0
- package/dist/admin/de-bbLKG0Z0.js +1 -0
- package/dist/admin/en-B08MBp2G.mjs +196 -0
- package/dist/admin/en-CN9XhSjy.js +1 -0
- package/dist/admin/fr-C0XfkZIq.mjs +196 -0
- package/dist/admin/fr-CrIyMsIk.js +1 -0
- package/dist/admin/index-CBVgZGlJ.mjs +599 -0
- package/dist/admin/index-Caw23ALP.mjs +445 -0
- package/dist/admin/index-CjbN24vV.js +1 -0
- package/dist/admin/index-D28kb4vd.js +1 -0
- package/dist/admin/index-DdyELWgu.mjs +113 -0
- package/dist/admin/index-Ip5HT7qK.js +37 -0
- package/dist/admin/index.js +1 -0
- package/dist/admin/index.mjs +4 -0
- package/dist/admin/pl-CPolzlPI.mjs +196 -0
- package/dist/admin/pl-DFGTrhGA.js +1 -0
- package/dist/admin/queryKeys-B_GC_f73.js +1 -0
- package/dist/admin/queryKeys-rUHP1d6p.mjs +9 -0
- package/dist/server/index.js +6 -0
- package/dist/server/index.mjs +7786 -0
- package/package.json +113 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const p=require("zod"),c=require("react"),g=require("react/jsx-runtime"),f=require("@strapi/icons"),P=e=>e&&e.__esModule?e:{default:e},b=P(p),R=(e,t,s)=>{const o=e[t];return o?typeof o=="function"?o():Promise.resolve(o):new Promise((M,d)=>{(typeof queueMicrotask=="function"?queueMicrotask:setTimeout)(d.bind(null,new Error("Unknown variable dynamic import: "+t+(t.split("/").length!==s?". Note that variables only represent file names one level deep.":""))))})},v="@sensinum/strapi-plugin-xecp",q="5.0.0-beta.1",I="https://www.sensinum.com/contact",h="hello@sensinum.com",_={name:"content-promotion"},m={name:v,version:q,homepage:I,email:h,strapi:_},n=b.default.literal("content-promotion").parse(m.strapi.name),a="xecp",i={settings:{read:"settings.read",update:"settings.update"},promotion:{read:"promotion.read",execute:"promotion.execute"}},x=e=>`plugin::${n}.${e}`,r=e=>({action:x(e),subject:null}),u={settingsRead:[r(i.settings.read)],settingsUpdate:[r(i.settings.update)],promotionRead:[r(i.promotion.read)],promotionExecute:[r(i.promotion.execute)]},y=({setPlugin:e})=>{const t=c.useRef(e);return c.useEffect(()=>{t.current(n)},[]),null},$=()=>g.jsx(f.Files,{style:{width:24}}),l=e=>`${n}.${e}`,j=e=>Object.keys(e).reduce((t,s)=>(t[`${n}.${s}`]=e[s],t),{}),L={register(e){e.addMenuLink({to:`plugins/${a}`,icon:$,intlLabel:{id:`${n}.plugin.name`,defaultMessage:n},Component:()=>Promise.resolve().then(()=>require("./App-BXTR7LbD.js")),permissions:[...u.promotionRead]}),e.addSettingsLink({id:n,intlLabel:{id:l("settings.section.sectionName"),defaultMessage:"Content Promotion Plugin"}},[{intlLabel:{id:l("settings.section.about"),defaultMessage:"About"},id:"about",to:`${a}/about`,Component:()=>Promise.resolve().then(()=>require("./index-Ip5HT7qK.js")),permissions:[...u.settingsRead]},{intlLabel:{id:l("settings.section.configuration"),defaultMessage:"Configuration"},id:"configuration",to:`${a}/configuration`,Component:()=>Promise.resolve().then(()=>require("./index-D28kb4vd.js")),permissions:[...u.settingsRead]}]),e.registerPlugin({id:n,initializer:y,isReady:!1,name:n})},async registerTrads({locales:e}){return Promise.all(e.map(async t=>{try{const{default:s}=await R(Object.assign({"./translations/de.json":()=>Promise.resolve().then(()=>require("./de-bbLKG0Z0.js")),"./translations/en.json":()=>Promise.resolve().then(()=>require("./en-CN9XhSjy.js")),"./translations/fr.json":()=>Promise.resolve().then(()=>require("./fr-CrIyMsIk.js")),"./translations/pl.json":()=>Promise.resolve().then(()=>require("./pl-DFGTrhGA.js"))}),`./translations/${t}.json`,3);return{data:j(s),locale:t}}catch{return{data:{},locale:t}}}))}};exports.PERMISSIONS=u;exports.PLUGIN_ID=n;exports.URL_PREFIX=a;exports.getTranslation=l;exports.index=L;exports.packageJson=m;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),y=require("@strapi/strapi/admin"),o=require("./index-CjbN24vV.js"),b=require("./queryKeys-B_GC_f73.js"),I=require("react"),x=require("react-intl"),p=require("zod"),j=require("@tanstack/react-query"),n=require("@strapi/design-system"),P=require("@strapi/icons"),V=require("lodash"),A=require("./TruncatedTypography-72wp11m4.js"),B=t=>t&&t.__esModule?t:{default:t},O=B(p),Q=3,v=p.z.enum(["Related","Promotable"]);p.z.object({targetEnvApiKey:p.z.string().optional(),targetEnvApiUrl:p.z.url().optional(),comparisonDepth:p.z.number().positive().optional(),contentTypes:p.z.array(p.z.object({uid:p.z.string(),key:p.z.string(),kind:v})).optional()});const Y=()=>{const{get:t}=y.useFetchClient();return j.useQuery({queryKey:[b.SETTINGS_QUERY_KEY],queryFn:async()=>{const{data:s}=await t(`/${o.URL_PREFIX}/settings`);return s}})},G=[b.SETTINGS_QUERY_KEY,"content-type-options"],H=()=>{const{get:t}=y.useFetchClient();return j.useQuery({queryKey:G,queryFn:async()=>{const{data:s}=await t(`/${o.URL_PREFIX}/settings/content-type-options`);return s}})},W=t=>[b.SETTINGS_QUERY_KEY,"related-content-types",t],X=(t,s)=>j.queryOptions({queryKey:W(s),queryFn:async()=>{const{data:r}=await t(`/${o.URL_PREFIX}/settings/related-content-types`,{params:{allowed:s.join(",")}});return r}}),U=t=>{const{get:s}=y.useFetchClient();return j.useQuery({...X(s,t),enabled:t.length>0})},$=()=>{const{put:t}=y.useFetchClient(),s=j.useQueryClient();return j.useMutation({mutationFn:async r=>t(`/${o.URL_PREFIX}/settings`,r),onSuccess:async()=>{await Promise.all([s.invalidateQueries({queryKey:[b.SETTINGS_QUERY_KEY]}),s.invalidateQueries({queryKey:[b.PROMOTABLE_CONTENT_TYPES_QUERY_KEY]})])}})},Z=(t,s)=>Object.entries(s).reduce((r,[a,i])=>V.isEqual(i,t[a])?r:{...r,[a]:i},{}),_=p.z.object({allowedContentTypes:p.z.array(p.z.string()).min(1,{message:"settings.form.error.minimalArrayLength"}),contentTypeSettings:p.z.record(p.z.string(),p.z.object({key:p.z.string({message:"settings.form.error.required"}).min(1,{message:"settings.form.error.required"}).optional()}).optional()),targetEnvApiKey:p.z.string({message:"settings.form.error.required"}).min(1,{message:"settings.form.error.required"}),targetEnvApiUrl:p.z.url({message:"settings.form.error.validURL"}),comparisonDepth:p.z.number({message:"settings.form.error.required"}).positive({message:"settings.form.error.positive"})}),J=_.extend({relatedContentTypes:p.z.string().array()}),ee=J.refine(t=>[...t.allowedContentTypes,...t.relatedContentTypes].every(r=>!!t.contentTypeSettings[r]?.key),{path:["allowedContentTypes"],message:"settings.form.error.uniqueKeyRequired",when(t){return _.pick({contentTypeSettings:!0}).safeParse(t.value).success}}),te=(t,s)=>{const r=[...t.allowedContentTypes,...s];return{...t,contentTypeSettings:Object.fromEntries(r.map(a=>[a,t.contentTypeSettings[a]]))}},k=t=>t.replace(".",":"),q=t=>t.replace(/:(?!.*:)/,"."),ne=(t,s)=>{const a={...te(s,t),relatedContentTypes:t},i=ee.parse(a);return{contentTypes:[...i.allowedContentTypes,...i.relatedContentTypes].map(g=>({uid:q(g),key:i.contentTypeSettings[g]?.key,kind:i.allowedContentTypes.includes(g)?v.enum.Promotable:v.enum.Related})),targetEnvApiKey:i.targetEnvApiKey,targetEnvApiUrl:i.targetEnvApiUrl,comparisonDepth:i.comparisonDepth}},se={background:"neutral0",hasRadius:!0,shadow:"filterShadow",padding:6,width:"100%"},K=({children:t,marginTop:s})=>e.jsx(n.Box,{...se,marginTop:s,children:t}),ie=({onChange:t,attributes:s,value:r,name:a,error:i,disabled:c=!1})=>{const{formatMessage:g}=x.useIntl(),m=Object.entries(s).filter(([u,l])=>l.type==="uid"||l.unique===!0);return I.useEffect(()=>{!r&&m.length>0&&t("")},[]),e.jsx(e.Fragment,{children:m.length>0?e.jsxs(n.Field.Root,{error:i&&g({id:o.getTranslation(i)}),children:[e.jsx(n.SingleSelect,{name:a,value:r,onChange:t,required:!0,disabled:c,children:m.map(([u,l])=>e.jsx(n.SingleSelectOption,{value:u,children:u},u))}),e.jsx(n.Field.Error,{})]}):e.jsx(n.Field.Root,{error:g({id:o.getTranslation("settings.table.uniqueKeyRequiredWarning")}),children:e.jsx(n.Field.Error,{})})})},D=({label:t,contentTypes:s,setFormValue:r,errors:a,contentTypeSettings:i,shouldShowRequiredBy:c,isReadOnly:g})=>{const{formatMessage:m}=x.useIntl();return e.jsxs(n.Box,{marginTop:4,width:"100%",paddingTop:4,children:[e.jsx(n.Box,{marginBottom:1,children:e.jsx(n.Typography,{variant:"pi",textColor:"neutral800",fontWeight:"bold",children:t})}),e.jsxs(n.Table,{width:"100%",rowCount:s.length,colCount:c?3:2,children:[e.jsx(n.Thead,{children:e.jsxs(n.Tr,{children:[e.jsx(n.Th,{children:e.jsx(n.Typography,{variant:"sigma",children:m({id:o.getTranslation("settings.table.contentType")})})}),c&&e.jsx(n.Th,{children:e.jsx(n.Typography,{variant:"sigma",children:m({id:o.getTranslation("settings.table.requiredBy")})})}),e.jsx(n.Th,{children:e.jsx(n.Typography,{variant:"sigma",children:m({id:o.getTranslation("settings.table.uniqueKey")})})})]})}),e.jsx(n.Tbody,{children:s.map(u=>{const l=`contentTypeSettings.${u.uid}.key`;return e.jsxs(n.Tr,{children:[e.jsx(n.Td,{width:c?"25%":"50%",children:e.jsx(A.TruncatedTypography,{maxCharacters:55,text:u.schema.displayName,textColor:"neutral800"})}),c&&e.jsx(n.Td,{width:"25%",children:e.jsx(A.TruncatedTypography,{maxCharacters:55,text:u.requiredBy,textColor:"neutral800"})}),e.jsx(n.Td,{width:"50%",children:e.jsx(ie,{onChange:d=>{r(l,d)},value:i[u.uid]?.key,attributes:u.schema.attributes,name:l,error:a[l],disabled:g})})]},u.uid)})})]})]})},re=({allowedContentTypes:t,contentTypeSettings:s,setFormValue:r,promotableContentTypes:a,errors:i,isReadOnly:c})=>{const{formatMessage:g}=x.useIntl(),m=t.map(d=>a?.find(T=>T.uid===d)),{data:u,isLoading:l}=U(t);return l?null:e.jsxs(K,{children:[e.jsx(n.Typography,{variant:"delta",children:g({id:o.getTranslation("settings.allowedContentTypes")})}),e.jsx(n.Box,{marginTop:4,width:"100%",children:e.jsxs(n.Field.Root,{width:"100%",error:i.allowedContentTypes&&g({id:o.getTranslation(i.allowedContentTypes)}),children:[e.jsx(n.Field.Label,{children:g({id:o.getTranslation("settings.allowedContentTypes.label")})}),e.jsx(n.MultiSelect,{withTags:!0,name:"allowedContentTypes",value:t,onChange:d=>{r("allowedContentTypes",d)},hasError:!!i.allowedContentTypes,disabled:c,children:a?.map(d=>e.jsx(n.MultiSelectOption,{value:d.uid,children:d.schema.displayName},d.uid))}),e.jsx(n.Field.Error,{})]})}),t?.length>0&&e.jsx(D,{label:g({id:o.getTranslation("settings.table.keyForEligibleContentTypes")}),contentTypes:m,setFormValue:r,errors:i,contentTypeSettings:s,isReadOnly:c}),(u?.length??0)>0&&e.jsx(D,{label:g({id:o.getTranslation("settings.table.keyForRelatedContentTypes")}),contentTypes:u??[],setFormValue:r,errors:i,contentTypeSettings:s,shouldShowRequiredBy:!0,isReadOnly:c})]})},ae=()=>{const{formatMessage:t}=x.useIntl();return e.jsx(n.Box,{marginTop:4,children:e.jsx(A.Alert,{title:t({id:o.getTranslation("settings.alert.comparisonDepthHigh.title")}),variant:"warning",description:t({id:o.getTranslation("settings.alert.comparisonDepthHigh.description")})})})},oe=({comparisonDepth:t,setFormValue:s,errors:r,isReadOnly:a})=>{const{formatMessage:i}=x.useIntl();return e.jsxs(K,{marginTop:4,children:[e.jsxs(n.Flex,{marginBottom:4,gap:1,children:[e.jsx(n.Typography,{variant:"delta",children:i({id:o.getTranslation("settings.comparisonDepth")})}),e.jsx(n.Tooltip,{label:i({id:o.getTranslation("settings.comparisonDepth.tooltip")}),children:e.jsx(P.Information,{})})]}),e.jsx(n.Grid.Root,{gap:4,children:e.jsx(n.Grid.Item,{col:6,alignItems:"start",children:e.jsxs(n.Field.Root,{error:r.comparisonDepth&&i({id:o.getTranslation(r.comparisonDepth)}),width:"100%",children:[e.jsx(n.Field.Label,{children:i({id:o.getTranslation("settings.comparisonDepth.label")})}),e.jsx(n.NumberInput,{value:t,onValueChange:c=>s("comparisonDepth",c),name:"comparisonDepth",disabled:a}),e.jsx(n.Field.Error,{})]})})}),t>5&&e.jsx(ae,{})]})},le=({staleValueMessages:t})=>{const{formatMessage:s}=x.useIntl();return e.jsx(n.Box,{marginBottom:4,children:e.jsxs(A.Alert,{title:s({id:o.getTranslation("settings.alert.staleValuesRemoved.title")}),variant:"danger",children:[s({id:o.getTranslation("settings.alert.staleValuesRemoved.description")}),t.map((r,a)=>e.jsxs("span",{children:[e.jsx("br",{}),a+1,"."," ",s({id:o.getTranslation(r.message)},r.variables)]},a))]})})},de=()=>{const{post:t}=y.useFetchClient();return j.useMutation({mutationFn:async s=>{const{data:r}=await t(`/${o.URL_PREFIX}/settings/testConnection`,s);return r}})},ce=t=>{if(t.isUrlCorrect)return t.isApiKeyCorrect?t.arePermissionsCorrect?void 0:"settings.form.error.badKeyPermissions":"settings.form.error.badApiKey"},ue=({targetEnvApiKey:t,targetEnvApiUrl:s,setFormValue:r,errors:a,isReadOnly:i})=>{const{formatMessage:c}=x.useIntl(),g=de(),{setErrors:m}=y.useForm("TargetEnvConfigurationSection",d=>d),u=async()=>{const d=await g.mutateAsync({targetEnvApiKey:t,targetEnvApiUrl:s});m({...a,targetEnvApiUrl:d.isUrlCorrect?void 0:"settings.form.error.badApiUrl",targetEnvApiKey:ce(d)})},l=g.isSuccess&&!a.targetEnvApiKey&&!a.targetEnvApiUrl;return e.jsxs(K,{marginTop:4,children:[e.jsx(n.Box,{marginBottom:4,children:e.jsx(n.Typography,{variant:"delta",children:c({id:o.getTranslation("settings.targetEnvConfiguration")})})}),e.jsxs(n.Grid.Root,{gap:4,children:[e.jsx(n.Grid.Item,{col:6,alignItems:"start",children:e.jsxs(n.Field.Root,{error:a.targetEnvApiUrl&&c({id:o.getTranslation(a.targetEnvApiUrl)}),width:"100%",children:[e.jsx(n.Field.Label,{children:c({id:o.getTranslation("settings.targetEnvApiUrl.label")})}),e.jsx(n.TextInput,{name:"targetEnvApiUrl",value:s,onChange:r,disabled:i}),e.jsx(n.Field.Error,{})]})}),e.jsx(n.Grid.Item,{col:6,alignItems:"start",children:e.jsxs(n.Field.Root,{error:a.targetEnvApiKey&&c({id:o.getTranslation(a.targetEnvApiKey)}),width:"100%",children:[e.jsx(n.Field.Label,{children:c({id:o.getTranslation("settings.targetEnvApiKey.label")})}),e.jsx(n.TextInput,{name:"targetEnvApiKey",value:t,onChange:r,disabled:i}),e.jsx(n.Field.Error,{})]})}),e.jsxs(n.Grid.Item,{col:6,children:[i?null:e.jsx(n.Button,{onClick:u,disabled:g.isPending,children:c({id:o.getTranslation("settings.form.testConnection")})}),e.jsxs(n.Flex,{marginLeft:1,alignItems:"center",children:[g.isPending&&e.jsx(n.Loader,{small:!0}),l&&e.jsx(P.Check,{color:"#5cb176"})]})]})]})]})},ge=({values:t,onChange:s,errors:r,setErrors:a,modified:i,settings:c,promotableContentTypes:g,staleValuesMessages:m,isReadOnly:u})=>{const{formatMessage:l}=x.useIntl(),{toggleNotification:d}=y.useNotification(),T=$(),{data:f=[],isFetching:F}=U(t.allowedContentTypes),R=async()=>{try{const C=f.map(E=>E.uid),S=ne(C,t),h=Z(c,S);await T.mutateAsync(h,{onSuccess:()=>{a({}),d({type:"success",message:l({id:o.getTranslation("settings.form.savedSuccessfully")})})}})}catch(C){if(C instanceof O.default.ZodError){const S=C.issues.reduce((h,E)=>(h[E.path.join(".")]=E.message,h),{});a(S),d({type:"warning",message:l({id:o.getTranslation("settings.form.error.validationMessage")})})}else d({type:"warning",message:l({id:o.getTranslation("settings.form.error.other")})})}},w=u||!i&&m.length===0||F||T.isPending;return e.jsxs(e.Fragment,{children:[e.jsx(y.Layouts.Header,{title:l({id:o.getTranslation("settings.title")}),subtitle:l({id:o.getTranslation("settings.subtitle")}),primaryAction:u?null:e.jsx(n.Button,{type:"submit",startIcon:e.jsx(P.Check,{}),onClick:R,disabled:w,children:l({id:o.getTranslation("settings.form.submit")})})}),e.jsxs(y.Layouts.Content,{children:[m.length>0&&e.jsx(le,{staleValueMessages:m}),e.jsx(re,{allowedContentTypes:t.allowedContentTypes,contentTypeSettings:t.contentTypeSettings,setFormValue:s,promotableContentTypes:g,errors:r,isReadOnly:u}),e.jsx(oe,{setFormValue:s,errors:r,comparisonDepth:t.comparisonDepth,isReadOnly:u}),e.jsx(ue,{targetEnvApiKey:t.targetEnvApiKey,targetEnvApiUrl:t.targetEnvApiUrl,setFormValue:s,errors:r,isReadOnly:u})]})]})},L=t=>{const s=t.contentTypes??[],r=s.filter(i=>i.kind===v.enum.Promotable).map(i=>i.uid),a=Object.fromEntries(s.map(i=>[i.uid,{key:i.key}]));return{allowedContentTypes:r,contentTypeSettings:a,targetEnvApiKey:t?.targetEnvApiKey??"",targetEnvApiUrl:t?.targetEnvApiUrl??"",comparisonDepth:t?.comparisonDepth??Q}},pe=(t,s,r)=>{if(!t.contentTypes)return[L(t),[]];const a=[],i=t.contentTypes.map(l=>({...l,uid:k(l.uid)})),c=s.map(l=>l.uid),m=i.filter(l=>{const d=!c.includes(l.uid);return d&&a.push({message:"settings.alert.staleValuesRemoved.contentTypeDeleted",variables:{uid:q(l.uid)}}),!d}).filter(l=>{const d=!r.includes(l.uid)&&l.kind===v.enum.Related;return d&&a.push({message:"settings.alert.staleValuesRemoved.relationDeleted",variables:{uid:q(l.uid)}}),!d}).map(l=>{const d=s.find(F=>F.uid===l.uid),T=d?.schema.attributes[l.key],f=T?.type==="uid"||T?.unique===!0;return f||a.push({message:"settings.alert.staleValuesRemoved.keyDeleted",variables:{key:l.key,schemaDisplayName:d?.schema.displayName}}),{...l,key:f?l.key:void 0}});return[L({...t,contentTypes:m}),a]},me=()=>{const{formatMessage:t}=x.useIntl(),s=I.useRef(null),{isLoading:r,allowedActions:{canUpdate:a}}=y.useRBAC([...o.PERMISSIONS.settingsUpdate]),{data:i,isLoading:c}=Y(),{data:g,isLoading:m}=H(),u=I.useMemo(()=>(i?.contentTypes??[]).filter(h=>h.kind===v.enum.Promotable).map(h=>k(h.uid)),[i?.contentTypes]),{data:l=[],isLoading:d,isFetched:T}=U(u),f=u.length===0||T;if(r||c||m||d||!f||!i||!g)return e.jsx(y.Page.Loading,{});const{promotableContentTypes:R,relationLookupContentTypes:w}=g,[C,S]=pe(i,w,l.map(h=>h.uid));return e.jsxs(y.Page.Main,{children:[e.jsx(y.Page.Title,{children:t({id:o.getTranslation("settings.metadata.title")})}),e.jsx(y.Form,{width:"100%",height:"100%",ref:s,method:"PUT",initialValues:C,children:({values:h,onChange:E,errors:M,setErrors:N,modified:z})=>e.jsx(ge,{values:h,onChange:E,errors:M,setErrors:N,modified:z,settings:i,promotableContentTypes:R,staleValuesMessages:S,isReadOnly:!a})})]})},ye=()=>e.jsx(y.Page.Protect,{permissions:[...o.PERMISSIONS.settingsRead],children:e.jsx(b.QueryProvider,{children:e.jsx(me,{})})});exports.default=ye;
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import l from "zod";
|
|
2
|
+
import { useRef as p, useEffect as d } from "react";
|
|
3
|
+
import { jsx as g } from "react/jsx-runtime";
|
|
4
|
+
import { Files as f } from "@strapi/icons";
|
|
5
|
+
const b = (t, e, o) => {
|
|
6
|
+
const s = t[e];
|
|
7
|
+
return s ? typeof s == "function" ? s() : Promise.resolve(s) : new Promise((k, u) => {
|
|
8
|
+
(typeof queueMicrotask == "function" ? queueMicrotask : setTimeout)(
|
|
9
|
+
u.bind(
|
|
10
|
+
null,
|
|
11
|
+
new Error(
|
|
12
|
+
"Unknown variable dynamic import: " + e + (e.split("/").length !== o ? ". Note that variables only represent file names one level deep." : "")
|
|
13
|
+
)
|
|
14
|
+
)
|
|
15
|
+
);
|
|
16
|
+
});
|
|
17
|
+
}, P = "@sensinum/strapi-plugin-xecp", R = "5.0.0-beta.1", y = "https://www.sensinum.com/contact", $ = "hello@sensinum.com", x = { name: "content-promotion" }, j = {
|
|
18
|
+
name: P,
|
|
19
|
+
version: R,
|
|
20
|
+
homepage: y,
|
|
21
|
+
email: $,
|
|
22
|
+
strapi: x
|
|
23
|
+
}, n = l.literal("content-promotion").parse(j.strapi.name), a = "xecp", i = {
|
|
24
|
+
settings: {
|
|
25
|
+
read: "settings.read",
|
|
26
|
+
update: "settings.update"
|
|
27
|
+
},
|
|
28
|
+
promotion: {
|
|
29
|
+
read: "promotion.read",
|
|
30
|
+
execute: "promotion.execute"
|
|
31
|
+
}
|
|
32
|
+
}, w = (t) => `plugin::${n}.${t}`, r = (t) => ({
|
|
33
|
+
action: w(t),
|
|
34
|
+
subject: null
|
|
35
|
+
}), m = {
|
|
36
|
+
settingsRead: [r(i.settings.read)],
|
|
37
|
+
settingsUpdate: [r(i.settings.update)],
|
|
38
|
+
promotionRead: [r(i.promotion.read)],
|
|
39
|
+
promotionExecute: [r(i.promotion.execute)]
|
|
40
|
+
}, I = ({ setPlugin: t }) => {
|
|
41
|
+
const e = p(t);
|
|
42
|
+
return d(() => {
|
|
43
|
+
e.current(n);
|
|
44
|
+
}, []), null;
|
|
45
|
+
}, L = () => /* @__PURE__ */ g(f, { style: { width: 24 } }), c = (t) => `${n}.${t}`, M = (t) => Object.keys(t).reduce((e, o) => (e[`${n}.${o}`] = t[o], e), {}), E = {
|
|
46
|
+
register(t) {
|
|
47
|
+
t.addMenuLink({
|
|
48
|
+
to: `plugins/${a}`,
|
|
49
|
+
icon: L,
|
|
50
|
+
intlLabel: {
|
|
51
|
+
id: `${n}.plugin.name`,
|
|
52
|
+
defaultMessage: n
|
|
53
|
+
},
|
|
54
|
+
Component: () => import("./App-CYIDJm4p.mjs"),
|
|
55
|
+
permissions: [...m.promotionRead]
|
|
56
|
+
}), t.addSettingsLink(
|
|
57
|
+
{
|
|
58
|
+
id: n,
|
|
59
|
+
intlLabel: {
|
|
60
|
+
id: c("settings.section.sectionName"),
|
|
61
|
+
defaultMessage: "Content Promotion Plugin"
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
[
|
|
65
|
+
{
|
|
66
|
+
intlLabel: {
|
|
67
|
+
id: c("settings.section.about"),
|
|
68
|
+
defaultMessage: "About"
|
|
69
|
+
},
|
|
70
|
+
id: "about",
|
|
71
|
+
to: `${a}/about`,
|
|
72
|
+
Component: () => import("./index-Caw23ALP.mjs"),
|
|
73
|
+
permissions: [...m.settingsRead]
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
intlLabel: {
|
|
77
|
+
id: c("settings.section.configuration"),
|
|
78
|
+
defaultMessage: "Configuration"
|
|
79
|
+
},
|
|
80
|
+
id: "configuration",
|
|
81
|
+
to: `${a}/configuration`,
|
|
82
|
+
Component: () => import("./index-CBVgZGlJ.mjs"),
|
|
83
|
+
permissions: [...m.settingsRead]
|
|
84
|
+
}
|
|
85
|
+
]
|
|
86
|
+
), t.registerPlugin({
|
|
87
|
+
id: n,
|
|
88
|
+
initializer: I,
|
|
89
|
+
isReady: !1,
|
|
90
|
+
name: n
|
|
91
|
+
});
|
|
92
|
+
},
|
|
93
|
+
async registerTrads({ locales: t }) {
|
|
94
|
+
return Promise.all(
|
|
95
|
+
t.map(async (e) => {
|
|
96
|
+
try {
|
|
97
|
+
const { default: o } = await b(/* @__PURE__ */ Object.assign({ "./translations/de.json": () => import("./de-C25k5cq2.mjs"), "./translations/en.json": () => import("./en-B08MBp2G.mjs"), "./translations/fr.json": () => import("./fr-C0XfkZIq.mjs"), "./translations/pl.json": () => import("./pl-CPolzlPI.mjs") }), `./translations/${e}.json`, 3);
|
|
98
|
+
return { data: M(o), locale: e };
|
|
99
|
+
} catch {
|
|
100
|
+
return { data: {}, locale: e };
|
|
101
|
+
}
|
|
102
|
+
})
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
export {
|
|
107
|
+
m as P,
|
|
108
|
+
a as U,
|
|
109
|
+
n as a,
|
|
110
|
+
c as g,
|
|
111
|
+
E as i,
|
|
112
|
+
j as p
|
|
113
|
+
};
|