@sensinum/strapi-plugin-multi-domain 5.3.1 → 5.3.2
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/dist/admin/{About-DaHQ_Yhm.mjs → About-DfCon-RP.mjs} +3 -3
- package/dist/admin/{About-Cqb0Poxw.js → About-DfcPwQ3q.js} +1 -1
- package/dist/admin/{Settings-CyMoV2x8.mjs → Settings-Dj3h2ayB.mjs} +2 -2
- package/dist/admin/{Settings-CDBzsWbm.js → Settings-tt-Wetcr.js} +1 -1
- package/dist/admin/{TenantCustomField-BVJXtOh1.js → TenantCustomField-Bf6uUoKE.js} +1 -1
- package/dist/admin/{TenantCustomField-ZM7ZfiGu.mjs → TenantCustomField-CS8x0CkO.mjs} +1 -1
- package/dist/admin/{TenantEdit-GAMHwYkP.js → TenantEdit-BT3-tB_B.js} +1 -1
- package/dist/admin/{TenantEdit-DBJoQv4w.mjs → TenantEdit-BY_7PPAr.mjs} +4 -4
- package/dist/admin/{TenantList-D8hgcBHM.js → TenantList-DrfJNPpi.js} +1 -1
- package/dist/admin/{TenantList-C6xsvthy.mjs → TenantList-dIxGcZPl.mjs} +4 -4
- package/dist/admin/{index-CQxsvheX.mjs → index-7tHbI_K_.mjs} +64 -63
- package/dist/admin/{index-eSOlzCRc.js → index-Cci_046h.js} +1 -1
- package/dist/admin/{index-CwsztY3K.mjs → index-Doprxev-.mjs} +1 -1
- package/dist/admin/index-oNXgzV7S.js +1 -0
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/admin/{useGetMessage-Ck4TSmSw.mjs → useGetMessage-CTdHvgbI.mjs} +1 -1
- package/dist/admin/useGetMessage-DS88gOrN.js +1 -0
- package/dist/admin/{useSettings-CkTWZxdH.js → useSettings-C7vR1hfw.js} +1 -1
- package/dist/admin/{useSettings-DY1d6P_T.mjs → useSettings-bLTyn7Pl.mjs} +1 -1
- package/dist/admin/{useTenants-sy0FweCJ.mjs → useTenants-Da8khjOe.mjs} +2 -2
- package/dist/admin/{useTenants-Ck1OOTGx.js → useTenants-vVkOIEvT.js} +1 -1
- package/dist/server/index.js +4 -3
- package/dist/server/index.mjs +3332 -3282
- package/package.json +1 -1
- package/dist/admin/index-BwgjJmHR.js +0 -1
- package/dist/admin/useGetMessage-gI6hxpcF.js +0 -1
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const q=require("remeda"),D=require("zod"),o=require("react/jsx-runtime"),M=require("@strapi/strapi/admin"),f=require("react"),w=require("react-cookie"),i=require("@strapi/design-system"),H=require("react-dom/client"),U=require("@strapi/icons"),k=require("@tanstack/react-query"),F=e=>e&&e.__esModule?e:{default:e},z=F(f),Q="@sensinum/strapi-plugin-multi-domain",W="5.3.1",J="https://www.sensinum.com/contact",V="hello@sensinum.com",G={name:"multi-domain"},K={name:Q,version:W,homepage:J,email:V},r=D.z.literal("multi-domain").parse(G.name);q.toSnakeCase(r);const h="domain",T="domain",P=`${h}s`,p="domain",L={read:"read",change:"change",create:"create",delete:"delete"},x=e=>`plugin::${r}.${L[e]}`,j={admin:{access:Object.keys(L).map(e=>({action:x(e),subject:null})),create:[{action:x("create"),subject:null}],edit:[{action:x("change"),subject:null}],delete:[{action:x("delete"),subject:null}]}},g=`data-${h}-initialized`,X="strapi-super-admin",I=e=>e?.code===X,Y=e=>{const t=`/admin/content-manager/collection-types/${e}/create`,n=document.querySelector(`a[href*="${t}"]`);n&&(n.style.display="none")},Z=()=>{const[{[p]:e}]=w.useCookies([p]),t=I(e),{slug:n}=M.unstable_useContentManagerContext();return z.default.useEffect(()=>{(t||!e)&&Y(n)},[t,e,n]),null},ee=()=>o.jsx(w.CookiesProvider,{children:o.jsx(Z,{})}),te=({setPlugin:e})=>{const t=f.useRef(e);return f.useEffect(()=>{t.current(r)},[]),null},E={en:()=>Promise.resolve().then(()=>require("./en-hAVH8fH0.js"))},A=(e,t)=>{if(!e)throw new TypeError("Prefix can't be empty");return Object.keys(t).reduce((n,a)=>(n[`${e}.${a}`]=t[a],n),{})},S=(e,t="")=>Object.keys(e).reduce((n,a)=>{const s=t.length?`${t}.`:"";return typeof e[a]=="object"&&e[a]!==null&&!Array.isArray(e[a])?Object.assign(n,S(e[a],s+a)):n[s+a]=e[a],n},{}),ne=({onClose:e,userData:t})=>{const[{[p]:n},a]=w.useCookies([p]),[s,u]=f.useState(""),[l,m]=f.useState(n||null),d=(t[T]||[]).filter(c=>c.name.toLowerCase().includes(s.toLowerCase())),y=c=>{m(l?.id===c.id?null:c)},_=()=>{l&&(a(p,JSON.stringify(l),{path:"/",maxAge:3600*24*30,domain:window.location.hostname}),window.location.reload())};return console.log("Avatar",i.Avatar),o.jsx(i.Modal.Root,{defaultOpen:!0,onOpenChange:e,children:o.jsxs(i.Modal.Content,{children:[o.jsx(i.Modal.Header,{children:o.jsx(i.Modal.Title,{children:"Select Domain"})}),o.jsxs(i.Modal.Body,{children:[o.jsx(i.Box,{paddingBottom:4,children:o.jsxs(i.Field.Root,{name:"tenant-search",children:[o.jsx(i.Field.Label,{children:"Search domains"}),o.jsx(i.Searchbar,{name:"tenant-search",onClear:()=>u(""),value:s,onChange:c=>u(c.target.value),placeholder:"Search domains...",size:"S",clearLabel:"Clear search",children:"Search domains"})]})}),d.length===0?o.jsx(i.EmptyStateLayout,{icon:o.jsx(U.Search,{}),content:"No domains found matching your search criteria"}):o.jsx(i.Box,{maxHeight:"400px",overflow:"auto",children:o.jsxs(i.Table,{colCount:2,rowCount:d.length+1,children:[o.jsx(i.Thead,{children:o.jsxs(i.Tr,{children:[o.jsx(i.Th,{width:"60px",children:o.jsx(i.Typography,{variant:"sigma",textColor:"neutral600",children:"Select"})}),o.jsx(i.Th,{width:"40px",children:null}),o.jsx(i.Th,{children:o.jsx(i.Typography,{variant:"sigma",textColor:"neutral600",children:"Domain name"})})]})}),o.jsx(i.Tbody,{children:d.map(c=>o.jsxs(i.Tr,{children:[o.jsx(i.Td,{width:"60px",children:o.jsx(i.Checkbox,{checked:l?.id===c.id,onCheckedChange:()=>y(c),name:`tenant-${c.id}`})}),o.jsx(i.Td,{width:"40px",children:c.logo?.url&&o.jsx(i.Avatar.Item,{src:c.logo.url,alt:c.name,preview:!1,fallback:c.name[0]})}),o.jsx(i.Td,{children:o.jsx(i.Typography,{fontWeight:"semiBold",textColor:"neutral800",children:c.name})})]},c.id))})]})})]}),o.jsxs(i.Modal.Footer,{children:[o.jsx(i.Modal.Close,{children:o.jsx(i.Button,{onClick:e,variant:"tertiary",children:"Cancel"})}),o.jsx(i.Button,{onClick:_,disabled:!l,children:"Select domain"})]})]})})},oe=new k.QueryClient({defaultOptions:{queries:{retry:!1,refetchOnWindowFocus:!1}}}),ie=(e,t,n,a)=>{const s=H.createRoot(e),u=()=>{document.body.removeAttribute("style"),s.unmount(),setTimeout(()=>{document.body.style.pointerEvents="auto"},0)};return t.remove(),s.render(o.jsx(i.DesignSystemProvider,{theme:a==="light"?i.lightTheme:i.darkTheme,children:o.jsx(k.QueryClientProvider,{client:oe,children:o.jsx(w.CookiesProvider,{children:o.jsx(ne,{onClose:u,userData:n})})})}))},b=(e,t)=>new Promise((n,a)=>{const l=(m=0)=>{if(m>50){a(new Error("Button not found after 50 attempts"));return}const d=(t||document).querySelector(e);if(d){n(d);return}setTimeout(()=>l(m+1),250)};l()}),B=()=>{try{const t=document.cookie.split(";").find(n=>n.trim().startsWith(`${p}=`));if(t){const n=t.split("=").at(1);if(!n)return null;const a=decodeURIComponent(n);return JSON.parse(a)}}catch(e){console.error("Error parsing tenant cookie:",e)}return null},ae=e=>{const t=e.firstChild,n=t?.lastChild?.cloneNode(!0);if(t&&n instanceof HTMLElement){const a=n.firstChild;a&&n.replaceChildren(a);const s=n.querySelector("span");if(s){const u=B();s.innerText=u?`${h.toUpperCase()}: ${u.name}`:`No ${h} selected`}n.style.paddingTop="1rem",t.appendChild(n)}},v=async()=>{try{const e=M.getFetchClient(),{data:{data:t}}=await e.get("/admin/users/me");return t}catch{return null}},R=async()=>{const e=await v(),t=document.createElement("div");document.body.appendChild(t);const n=await b('nav button[aria-haspopup="menu"]'),a="aria-expanded";new MutationObserver(async u=>{if(u.some(l=>l.attributeName===a)&&n.getAttribute(a)==="true"){const l=await b("[data-radix-menu-content]");if(!(l instanceof HTMLElement))return;ae(l);const m=await b('[role="menuitem"]',l),d=m.cloneNode(!0);if(e?.[T]&&e?.[T].length>1){if(!(d instanceof HTMLElement))return;d.querySelector("span").innerText=`Select ${h}`,d.addEventListener("mouseenter",function(){this.setAttribute("data-highlighted","true")}),d.addEventListener("mouseleave",function(){this.removeAttribute("data-highlighted")}),d.addEventListener("click",y=>{y.preventDefault(),y.stopPropagation(),ie(t,l,e,localStorage.getItem("STRAPI_THEME")||"dark")}),m.insertAdjacentElement("afterend",d)}}}).observe(n,{attributes:!0})},N=()=>window.location.pathname==="/admin/auth/login",re=()=>window.location.pathname.startsWith("/admin/plugins/upload"),se=()=>{const e=B(),t=document.querySelector('[data-strapi-header="true"]');if(!e||I(e)){const n=t?.querySelectorAll("button");n&&n.forEach(a=>{a.style.display="none"})}},$=q.funnel(se,{minQuietPeriodMs:250}),O=async()=>{const e=await b('nav ul > li a[href="/admin/plugins/upload"]');e&&e.addEventListener("click",()=>{$.call()}),re()&&$.call()},C=async()=>{if(N()){document.body.removeAttribute(g);return}if(await v()){document.querySelector(`[${g}]`)||(await Promise.all([R(),O()]),document.body.setAttribute(g,"true"));return}document.body.removeAttribute(g)},ce=async()=>{N()||!await v()||(document.body.setAttribute(g,"true"),await Promise.all([R(),O()]))},le={register(e){e.registerPlugin({id:r,initializer:te,isReady:!1,name:r}),e.customFields.register({name:`unique-by-${h}`,pluginId:r,type:"string",intlLabel:{id:`${r}.custom-fields.unique-by-domain.label`,defaultMessage:"Unique by domain"},intlDescription:{id:`${r}.custom-fields.unique-by-tenant.description`,defaultMessage:"Ensures the value is unique within the domain."},components:{Input:()=>Promise.resolve().then(()=>require("./TenantCustomField-BVJXtOh1.js"))}}),e.router.addSettingsLink({id:`${r}.settings`,intlLabel:{id:`${r}.settings.label`,defaultMessage:"Multi-Domain Settings"},links:[{id:`${r}.settings.about`,intlLabel:{id:`${r}.settings.about.label`,defaultMessage:"About"},to:`/settings/${r}/about`,Component:()=>Promise.resolve().then(()=>require("./About-Cqb0Poxw.js")),permissions:j.admin.access},{id:`${r}.settings.general`,intlLabel:{id:`${r}.settings.general.label`,defaultMessage:"General Settings"},to:`/settings/${r}/${P}`,Component:()=>Promise.resolve().then(()=>require("./Settings-CDBzsWbm.js")),permissions:j.admin.access}]})},async registerTrads({locales:e}){return Promise.all(e.map(async t=>t in E?E[t]().then(({default:a})=>({data:A(r,S(a)),locale:t})):{data:A(r,S({})),locale:t}))},async bootstrap(e){e.getPlugin("content-manager").injectComponent("listView","actions",{name:"display-create-button",Component:ee});let t=window.location.pathname;window.addEventListener("popstate",async()=>{t!==window.location.pathname&&(t=window.location.pathname,await C())});const n=history.pushState,a=history.replaceState;history.pushState=function(...s){n.apply(history,s),t!==window.location.pathname&&(t=window.location.pathname,C())},history.replaceState=function(...s){a.apply(history,s),t!==window.location.pathname&&(t=window.location.pathname,C())},await ce()}};exports.modelId=h;exports.modelRoute=P;exports.packageJson=K;exports.permissions=j;exports.plugin=le;exports.pluginId=r;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const r=require("react-intl"),u=require("./index-BwgjJmHR.js"),c=()=>{const{formatMessage:e}=r.useIntl();return(s,{defaultMessage:t,values:n}={})=>e({id:`${u.pluginId}.${s}`,defaultMessage:t},n)};exports.useGetMessage=c;
|