@sensinum/strapi-plugin-multi-domain 5.2.1 → 5.3.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/dist/{_chunks/About-CrezKPYG.js → admin/About-Cqb0Poxw.js} +2 -2
- package/dist/{_chunks/About-DD6q90XE.mjs → admin/About-DaHQ_Yhm.mjs} +5 -5
- package/dist/admin/QueryProvider-CCX1cgmZ.js +1 -0
- package/dist/{_chunks/QueryProvider-DLzv0qqi.mjs → admin/QueryProvider-oO97LaUB.mjs} +2 -2
- package/dist/{_chunks/Settings-82rkWMJ-.js → admin/Settings-CDBzsWbm.js} +1 -1
- package/dist/{_chunks/Settings-DVTWa7UL.mjs → admin/Settings-CyMoV2x8.mjs} +3 -3
- package/dist/{_chunks/TenantCustomField-aaNqlkBO.js → admin/TenantCustomField-BVJXtOh1.js} +1 -1
- package/dist/{_chunks/TenantCustomField-MX6zdr0Y.mjs → admin/TenantCustomField-ZM7ZfiGu.mjs} +24 -24
- package/dist/admin/TenantEdit-DBJoQv4w.mjs +490 -0
- package/dist/admin/TenantEdit-GAMHwYkP.js +1 -0
- package/dist/{_chunks/TenantList-Dw1EqqA7.mjs → admin/TenantList-C6xsvthy.mjs} +43 -45
- package/dist/admin/TenantList-D8hgcBHM.js +1 -0
- package/dist/admin/index-BwgjJmHR.js +1 -0
- package/dist/{_chunks/index-DFrXw6xt.mjs → admin/index-CQxsvheX.mjs} +80 -80
- package/dist/admin/index-CwsztY3K.mjs +187 -0
- package/dist/admin/index-eSOlzCRc.js +1 -0
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/{_chunks/useGetMessage-BQOJqwKY.mjs → admin/useGetMessage-Ck4TSmSw.mjs} +1 -1
- package/dist/admin/useGetMessage-gI6hxpcF.js +1 -0
- package/dist/admin/useSettings-CkTWZxdH.js +1 -0
- package/dist/{_chunks/useSettings-HNeo0XZx.mjs → admin/useSettings-DY1d6P_T.mjs} +2 -2
- package/dist/admin/useTenants-Ck1OOTGx.js +1 -0
- package/dist/{_chunks/useTenants-D2d36FHf.mjs → admin/useTenants-sy0FweCJ.mjs} +4 -4
- package/dist/server/index.js +3 -3
- package/dist/server/index.mjs +3317 -6503
- package/package.json +20 -21
- package/dist/_chunks/QueryProvider-DUoM4JhC.js +0 -1
- package/dist/_chunks/TenantEdit-BA2xZHAl.js +0 -1
- package/dist/_chunks/TenantEdit-QroPNoOH.mjs +0 -494
- package/dist/_chunks/TenantList-BOEyqzpU.js +0 -1
- package/dist/_chunks/index-B6P81dIL.js +0 -1
- package/dist/_chunks/index-DVqQk-cu.mjs +0 -182
- package/dist/_chunks/index-lkcweU9g.js +0 -1
- package/dist/_chunks/useGetMessage-CkNMUbYX.js +0 -1
- package/dist/_chunks/useSettings-DArWTfyj.js +0 -1
- package/dist/_chunks/useTenants-DA6GxylQ.js +0 -1
- package/dist/shared/config.d.ts +0 -7
- package/dist/shared/config.d.ts.map +0 -1
- package/dist/shared/permissions.d.ts +0 -35
- package/dist/shared/permissions.d.ts.map +0 -1
- package/dist/shared/pluginIds.d.ts +0 -9
- package/dist/shared/pluginIds.d.ts.map +0 -1
- package/dist/shared/schemas/admin.d.ts +0 -26
- package/dist/shared/schemas/admin.d.ts.map +0 -1
- package/dist/shared/schemas/index.d.ts +0 -8
- package/dist/shared/schemas/index.d.ts.map +0 -1
- package/dist/shared/schemas/permision.schema.d.ts +0 -28
- package/dist/shared/schemas/permision.schema.d.ts.map +0 -1
- package/dist/shared/schemas/query-params.schema.d.ts +0 -19
- package/dist/shared/schemas/query-params.schema.d.ts.map +0 -1
- package/dist/shared/schemas/role.schema.d.ts +0 -101
- package/dist/shared/schemas/role.schema.d.ts.map +0 -1
- package/dist/shared/schemas/tenant.schema.d.ts +0 -428
- package/dist/shared/schemas/tenant.schema.d.ts.map +0 -1
- package/dist/shared/schemas/token.schema.d.ts +0 -13
- package/dist/shared/schemas/token.schema.d.ts.map +0 -1
- package/dist/shared/schemas/uniq-validation.schema.d.ts +0 -18
- package/dist/shared/schemas/uniq-validation.schema.d.ts.map +0 -1
- package/dist/shared/schemas/utils.d.ts +0 -3
- package/dist/shared/schemas/utils.d.ts.map +0 -1
- /package/dist/{_chunks → admin}/en-Cf69p5po.mjs +0 -0
- /package/dist/{_chunks → admin}/en-hAVH8fH0.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var B=Object.defineProperty;var G=(n,o,i)=>o in n?B(n,o,{enumerable:!0,configurable:!0,writable:!0,value:i}):n[o]=i;var L=(n,o,i)=>G(n,typeof o!="symbol"?o+"":o,i);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("@strapi/design-system"),p=require("@strapi/strapi/admin"),v=require("react"),M=require("react-router-dom"),N=require("remeda"),h=require("./index-BwgjJmHR.js"),j=require("./useGetMessage-gI6hxpcF.js"),R=require("./useTenants-Ck1OOTGx.js"),q=require("@strapi/icons"),w=require("@tanstack/react-query"),I=require("./index-eSOlzCRc.js"),H=n=>n&&n.__esModule?n:{default:n},P=H(v),O=({isEditing:n,isSaving:o,onCancel:i})=>{const s=j.useGetMessage();return e.jsx(t.Flex,{justifyContent:"flex-start",gap:2,direction:"column",height:"100%",width:"100%",children:e.jsxs(t.Box,{background:"neutral0",padding:8,shadow:"filterShadow",hasRadius:!0,width:"100%",children:[e.jsx(t.Typography,{variant:"sigma",textTransform:"uppercase",textColor:"neutral600",tag:"h2",marginBottom:4,children:s("domain.edit.actions.entry")}),e.jsxs(t.Flex,{direction:"column",gap:2,children:[e.jsx(R.CheckPermissions,{permissions:n?h.permissions.admin.edit:h.permissions.admin.create,children:e.jsx(t.Button,{type:"submit",loading:o,width:"100%",children:s(n?"domain.edit.actions.update":"domain.edit.actions.create")})}),e.jsx(t.Button,{variant:"secondary",onClick:i,width:"100%",children:s("common.cancel")})]})]})})},A=({isEditing:n,tenantName:o})=>{const i=j.useGetMessage(),s=n?o||i("domain.edit.title.edit",{values:{name:h.modelId}}):i("domain.edit.title.create");return e.jsx(p.Layouts.Header,{title:typeof s=="string"?s:String(s),navigationAction:e.jsx(t.Link,{tag:M.NavLink,startIcon:e.jsx(q.ArrowLeft,{}),to:`/settings/${h.pluginId}/${h.modelRoute}`,children:i("common.back")})})},$=({disabled:n=!1,error:o})=>{const i=j.useGetMessage(),s=p.useStrapiApp("CustomMediaInput",a=>a.fields?.media||{});return s?e.jsxs(t.Field.Root,{name:"logo",hint:i("domain.edit.form.logo.hint"),error:o,children:[e.jsx(s,{label:"Logo",name:"logo",disabled:n,attribute:{allowedTypes:["images"],multiple:!1}}),e.jsx(t.Field.Hint,{}),e.jsx(t.Field.Error,{})]}):null},C={all:["roles"],lists:()=>[...C.all,"list"]},J=()=>w.useQuery({queryKey:C.lists(),queryFn:()=>I.api.getRoles(),staleTime:600*1e3}),W=({value:n,onChange:o,disabled:i=!1,error:s,onLoadMore:a,onSearch:l})=>{const{data:d=[],isLoading:u}=J(),x=j.useGetMessage(),f=()=>{o({target:{name:"role",value:""}})},F=g=>{o({target:{name:"role",value:g}})},b=v.useCallback(g=>{const S=g.target.value;l&&l(S)},[l]),k=v.useCallback(()=>{a&&!u&&a()},[a,u]);return e.jsxs(t.Field.Root,{name:"role",hint:x("domain.edit.form.role.hint"),error:s,children:[e.jsx(t.Field.Label,{children:x("domain.edit.form.role.label")}),e.jsx(t.Combobox,{loading:u,hasMoreItems:!u,name:"role",disabled:i,value:n,onChange:F,placeholder:x("domain.edit.form.role.placeholder"),onInputChange:b,onLoadMore:k,children:d.map(g=>e.jsx(t.ComboboxOption,{value:g.id.toString(),children:g.name},g.id))}),n&&d.length>0&&e.jsxs(t.Flex,{paddingTop:2,paddingBottom:2,paddingLeft:4,paddingRight:4,hasRadius:!0,borderColor:"neutral200",background:"neutral0",justifyContent:"space-between",children:[e.jsx(t.Typography,{textColor:"neutral800",fontWeight:"bold",children:d.find(g=>g.id.toString()===n)?.name}),i?null:e.jsx(t.Box,{children:e.jsx(t.IconButton,{onClick:f,label:x("domain.edit.form.role.remove"),variant:"ghost",size:"S",children:e.jsx(q.Cross,{})})})]}),e.jsx(t.Field.Hint,{})]})},D={all:["tokens"],lists:()=>[...D.all,"list"]},_=()=>w.useQuery({queryKey:D.lists(),queryFn:()=>I.api.getTokens(),staleTime:600*1e3}),K=({value:n=[],onChange:o,disabled:i=!1,error:s})=>{const{data:a=[]}=_(),l=j.useGetMessage(),d=u=>{const x=u.map(f=>Number(f));o({target:{name:"tokens",value:x}})};return e.jsxs(t.Field.Root,{name:"tokens",hint:l("domain.edit.form.tokens.hint"),error:s,children:[e.jsx(t.Field.Label,{children:l("domain.edit.form.tokens.label")}),e.jsx(t.MultiSelect,{withTags:!0,name:"tokens",disabled:i,value:n.map(u=>u.toString()),onChange:d,placeholder:l("domain.edit.form.tokens.placeholder"),children:a.map(u=>e.jsx(t.MultiSelectOption,{value:u.id.toString(),children:u.name},u.id.toString()))}),e.jsx(t.Field.Hint,{})]})},T=n=>{if(typeof n=="string")return n;if(n&&typeof n=="object"&&"defaultMessage"in n){const o=n.defaultMessage;return typeof o=="string"?o:void 0}},V=({values:n,onChange:o,disabled:i,errors:s})=>{const a=j.useGetMessage(),l=d=>{o({target:{name:"customFields",value:d}})};return e.jsx(t.Box,{background:"neutral0",padding:8,shadow:"filterShadow",hasRadius:!0,width:"100%",children:e.jsxs(t.Flex,{direction:"column",alignItems:"stretch",gap:6,children:[e.jsxs(t.Flex,{gap:4,wrap:"wrap",children:[e.jsx(t.Box,{flex:"1",minWidth:"300px",children:e.jsxs(t.Field.Root,{name:"name",required:!0,hint:a("domain.edit.form.name.hint"),error:T(s.name),children:[e.jsx(t.Field.Label,{children:a("domain.edit.form.name.label")}),e.jsx(t.TextInput,{disabled:i,name:"name",value:n.name,onChange:o,placeholder:a("domain.edit.form.name.placeholder"),required:!0}),e.jsx(t.Field.Hint,{}),e.jsx(t.Field.Error,{})]})}),e.jsx(t.Box,{flex:"1",minWidth:"300px",children:e.jsxs(t.Field.Root,{name:"code",required:!0,hint:a("domain.edit.form.code.hint"),error:T(s.code),children:[e.jsx(t.Field.Label,{children:a("domain.edit.form.code.label")}),e.jsx(t.TextInput,{disabled:i,name:"code",value:n.code,onChange:o,placeholder:a("domain.edit.form.code.placeholder"),required:!0}),e.jsx(t.Field.Hint,{}),e.jsx(t.Field.Error,{})]})})]}),e.jsx($,{value:n.logo,onChange:o,disabled:i,error:s.logo?.toString()}),e.jsxs(t.Flex,{gap:4,wrap:"wrap",children:[e.jsx(t.Box,{flex:"1",minWidth:"300px",children:e.jsx(W,{value:n.role,onChange:o,disabled:i,error:s.role?.toString()})}),e.jsx(t.Box,{flex:"1",minWidth:"300px",children:e.jsx(K,{value:n.tokens||[],onChange:o,disabled:i,error:s.tokens?.toString()})})]}),e.jsxs(t.Field.Root,{name:"damRootDirectory",hint:a("domain.edit.form.damRootDirectory.hint"),error:T(s.damRootDirectory),children:[e.jsx(t.Field.Label,{children:a("domain.edit.form.damRootDirectory.label")}),e.jsx(t.TextInput,{disabled:i,name:"damRootDirectory",value:n.damRootDirectory,onChange:o,placeholder:a("domain.edit.form.damRootDirectory.placeholder")}),e.jsx(t.Field.Hint,{}),e.jsx(t.Field.Error,{})]}),e.jsxs(t.Field.Root,{name:"customFields",hint:a("domain.edit.form.customFields.hint"),error:T(s.customFields),children:[e.jsx(t.Field.Label,{children:a("domain.edit.form.customFields.label")}),e.jsx(t.JSONInput,{value:n.customFields,onChange:l,minHeight:"200px"}),e.jsx(t.Field.Hint,{})]})]})})},Q=({message:n="Loading..."})=>e.jsx(t.Box,{padding:8,textAlign:"center",children:e.jsx(t.Loader,{children:n})}),z=()=>w.useMutation({mutationFn:n=>I.api.validateTenant(n),onError:n=>{console.error("Tenant validation failed:",n)}});class U{constructor(o){L(this,"name");this.inner=o,this.name="ValidationError"}}const X=()=>{const n=M.useNavigate(),{id:o}=M.useParams(),i=o!=="new",s=i?parseInt(o):void 0,{toggleNotification:a}=p.useNotification(),l=j.useGetMessage(),{data:d,isLoading:u}=R.useTenant(s),x=z(),f=R.useCreateTenant(),F=R.useUpdateTenant(),b=P.default.useMemo(()=>({name:d?.name||"",code:d?.code||"",role:d?.role?.id?.toString()||"",tokens:d?.tokens?.map(r=>r.id),damRootDirectory:d?.damRootDirectory||"",customFields:JSON.stringify(d?.customFields||{},null,2),logo:d?.logo||null}),[d]),k=d?.code==="strapi-super-admin",g=async r=>{try{let m={};try{m=JSON.parse(r.customFields||"{}")}catch{a({type:"danger",message:l("domain.edit.notifications.invalidJson")});return}if(i&&s){const c={...r,role:r.role?parseInt(r.role):void 0,tokens:r.tokens||[],customFields:m,logo:r.logo||null};await F.mutateAsync({id:s,data:c}),a({type:"success",message:l("domain.edit.notifications.updated")})}else{const c={...r,role:r.role?parseInt(r.role):void 0,tokens:r.tokens||[],customFields:m,logo:r.logo||null},y=await f.mutateAsync(c);a({type:"success",message:l("domain.edit.notifications.created")}),n(`/settings/${h.pluginId}/${h.modelRoute}/${y.id}`)}}catch(m){a({type:"danger",message:m instanceof Error?m.message:l("domain.edit.notifications.saveError")})}},S=async r=>{const m={};if(r.customFields)try{JSON.parse(r.customFields)}catch{m.customFields=l("domain.edit.validation.invalidJson")}if(r.name||r.code)try{const c={excludeId:s};r.name&&(c.name=r.name),r.code&&(c.code=r.code);const y=await x.mutateAsync(c);y.name&&(m.name=y.name||"Name is not available"),y.code&&(m.code=y.code||"Code is not available")}catch(c){a({type:"danger",message:c instanceof Error?c.message:c?.toString()})}if(!N.isEmpty(m))throw new U(Object.keys(m).map(c=>({path:c,message:m[c]})));return r},E=f.isPending||F.isPending;return u?e.jsx(Q,{message:l("domain.edit.loading")}):e.jsxs(e.Fragment,{children:[e.jsx(p.Page.Title,{children:i?l("domain.edit.title.edit",{values:{name:d?.name||h.modelId}}):l("domain.edit.title.create")}),e.jsx(p.Page.Main,{children:e.jsx(p.Form,{onSubmit:g,initialValues:b,validate:S,method:"POST",width:"auto",height:"auto",children:({values:r,onChange:m,errors:c})=>e.jsxs(e.Fragment,{children:[e.jsx(A,{isEditing:i,tenantName:d?.name}),e.jsx(p.Layouts.Content,{children:e.jsxs(t.Grid.Root,{gap:4,children:[e.jsx(t.Grid.Item,{col:9,children:e.jsx(V,{values:r,onChange:m,disabled:k,errors:c})}),e.jsx(t.Grid.Item,{col:3,children:e.jsx(O,{isEditing:i,isSaving:E,onCancel:()=>n(`/settings/${h.pluginId}/${h.modelRoute}`)})})]})})]})})})]})};exports.default=X;
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { jsx as e, jsxs as a, Fragment as A } from "react/jsx-runtime";
|
|
2
|
-
import { Dialog as u, Flex as q, Button as L, Typography as d, Td as f, Checkbox as I, Badge as
|
|
2
|
+
import { Dialog as u, Flex as q, Button as L, Typography as d, Td as f, Checkbox as I, Badge as te, IconButton as R, Tr as E, Loader as ne, EmptyStateLayout as ie, Table as oe, Thead as ae, Th as C, Tbody as re, Box as le } from "@strapi/design-system";
|
|
3
3
|
import { WarningCircle as se, Trash as W, ArrowUp as ce, ArrowDown as de, Pencil as he, Plus as me, Search as ge } from "@strapi/icons";
|
|
4
4
|
import { useNotification as ue, useQueryParams as pe, Page as D, Layouts as b, SearchInput as fe, Pagination as w } from "@strapi/strapi/admin";
|
|
5
5
|
import Ce, { useState as $ } from "react";
|
|
6
6
|
import { useNavigate as N } from "react-router-dom";
|
|
7
|
-
import { b as M, p as _, m as H, c as ye } from "./index-
|
|
8
|
-
import { C as z, u as Se, a as Te } from "./useTenants-
|
|
7
|
+
import { b as M, p as _, m as H, c as ye } from "./index-CQxsvheX.mjs";
|
|
8
|
+
import { C as z, u as Se, a as Te } from "./useTenants-sy0FweCJ.mjs";
|
|
9
9
|
import be from "styled-components";
|
|
10
|
-
import { u as j } from "./useGetMessage-
|
|
11
|
-
import { u as ve } from "./useSettings-
|
|
10
|
+
import { u as j } from "./useGetMessage-Ck4TSmSw.mjs";
|
|
11
|
+
import { u as ve } from "./useSettings-DY1d6P_T.mjs";
|
|
12
12
|
const ke = ({
|
|
13
|
-
isOpen:
|
|
13
|
+
isOpen: t,
|
|
14
14
|
onClose: i,
|
|
15
15
|
onConfirm: l,
|
|
16
16
|
target: r
|
|
17
|
-
}) => /* @__PURE__ */ e(u.Root, { open:
|
|
17
|
+
}) => /* @__PURE__ */ e(u.Root, { open: t, onOpenChange: i, children: /* @__PURE__ */ a(u.Content, { children: [
|
|
18
18
|
/* @__PURE__ */ e(u.Header, { children: "Confirmation" }),
|
|
19
19
|
/* @__PURE__ */ e(u.Body, { icon: /* @__PURE__ */ e(W, {}), children: /* @__PURE__ */ e(u.Description, { textAlign: "center", children: /* @__PURE__ */ a(q, { gap: 2, direction: "column", children: [
|
|
20
20
|
/* @__PURE__ */ e(se, { fill: "danger600", width: "24", height: "24" }),
|
|
@@ -29,10 +29,10 @@ const ke = ({
|
|
|
29
29
|
/* @__PURE__ */ e(u.Action, { children: /* @__PURE__ */ e(L, { fullWidth: !0, onClick: l, variant: "danger", size: "S", children: /* @__PURE__ */ e(d, { variant: "omega", children: "Confirm" }) }) })
|
|
30
30
|
] })
|
|
31
31
|
] }) }), xe = ({
|
|
32
|
-
isDisplayed:
|
|
32
|
+
isDisplayed: t,
|
|
33
33
|
direction: i
|
|
34
|
-
}) =>
|
|
35
|
-
label:
|
|
34
|
+
}) => t ? i === "asc" ? /* @__PURE__ */ e(ce, {}) : /* @__PURE__ */ e(de, {}) : null, P = ({
|
|
35
|
+
label: t,
|
|
36
36
|
field: i,
|
|
37
37
|
sort: l,
|
|
38
38
|
onSort: r
|
|
@@ -44,7 +44,7 @@ const ke = ({
|
|
|
44
44
|
style: { display: "flex", alignItems: "center", cursor: "pointer" },
|
|
45
45
|
onClick: () => r(i)(h === "asc" ? "desc" : "asc"),
|
|
46
46
|
children: [
|
|
47
|
-
/* @__PURE__ */ e(d, { variant: "sigma", textColor: "neutral600", children:
|
|
47
|
+
/* @__PURE__ */ e(d, { variant: "sigma", textColor: "neutral600", children: t }),
|
|
48
48
|
/* @__PURE__ */ e("span", { style: { marginLeft: 4 }, children: /* @__PURE__ */ e(xe, { isDisplayed: i === s, direction: h }) })
|
|
49
49
|
]
|
|
50
50
|
}
|
|
@@ -52,39 +52,39 @@ const ke = ({
|
|
|
52
52
|
}, Ae = be(E)(() => ({
|
|
53
53
|
cursor: "pointer"
|
|
54
54
|
})), De = ({
|
|
55
|
-
tenant:
|
|
55
|
+
tenant: t,
|
|
56
56
|
selectedTenants: i,
|
|
57
57
|
handleSelectTenant: l,
|
|
58
58
|
onDeleteTenant: r,
|
|
59
59
|
isDeletePending: s = !1
|
|
60
60
|
}) => {
|
|
61
|
-
const h = N(),
|
|
62
|
-
return /* @__PURE__ */ a(Ae, { onClick: y(
|
|
61
|
+
const h = N(), n = j(), y = (m) => () => h(`/settings/${_}/${H}/${m.id}`);
|
|
62
|
+
return /* @__PURE__ */ a(Ae, { onClick: y(t), children: [
|
|
63
63
|
/* @__PURE__ */ e(f, { children: /* @__PURE__ */ e(
|
|
64
64
|
I,
|
|
65
65
|
{
|
|
66
|
-
checked: i.includes(
|
|
67
|
-
onCheckedChange: (m) => l(
|
|
66
|
+
checked: i.includes(t.id),
|
|
67
|
+
onCheckedChange: (m) => l(t.id, m)
|
|
68
68
|
}
|
|
69
69
|
) }),
|
|
70
|
-
/* @__PURE__ */ e(f, { children: /* @__PURE__ */ e(d, { fontWeight: "semiBold", textColor: "neutral800", children:
|
|
71
|
-
/* @__PURE__ */ e(f, { children: /* @__PURE__ */ e(d, { fontWeight: "semiBold", textColor: "neutral800", children:
|
|
72
|
-
/* @__PURE__ */ e(f, { children: /* @__PURE__ */ e(d, { textColor: "neutral800", children:
|
|
73
|
-
/* @__PURE__ */ e(f, { children:
|
|
70
|
+
/* @__PURE__ */ e(f, { children: /* @__PURE__ */ e(d, { fontWeight: "semiBold", textColor: "neutral800", children: t.id }) }),
|
|
71
|
+
/* @__PURE__ */ e(f, { children: /* @__PURE__ */ e(d, { fontWeight: "semiBold", textColor: "neutral800", children: t.name }) }),
|
|
72
|
+
/* @__PURE__ */ e(f, { children: /* @__PURE__ */ e(d, { textColor: "neutral800", children: t.code }) }),
|
|
73
|
+
/* @__PURE__ */ e(f, { children: t.role ? /* @__PURE__ */ e(te, { textColor: "neutral800", backgroundColor: "neutral100", children: t.role.name }) : /* @__PURE__ */ e(d, { textColor: "neutral600", children: "-" }) }),
|
|
74
74
|
/* @__PURE__ */ e(f, { children: /* @__PURE__ */ a(q, { gap: 1, children: [
|
|
75
75
|
/* @__PURE__ */ e(z, { permissions: M.admin.edit, children: /* @__PURE__ */ e(
|
|
76
76
|
R,
|
|
77
77
|
{
|
|
78
|
-
onClick: y(
|
|
79
|
-
label:
|
|
78
|
+
onClick: y(t),
|
|
79
|
+
label: n("common.edit"),
|
|
80
80
|
children: /* @__PURE__ */ e(he, {})
|
|
81
81
|
}
|
|
82
82
|
) }),
|
|
83
83
|
/* @__PURE__ */ e(z, { permissions: M.admin.delete, children: /* @__PURE__ */ e(
|
|
84
84
|
R,
|
|
85
85
|
{
|
|
86
|
-
onClick: r(
|
|
87
|
-
label:
|
|
86
|
+
onClick: r(t),
|
|
87
|
+
label: n("common.delete"),
|
|
88
88
|
disabled: s,
|
|
89
89
|
children: /* @__PURE__ */ e(W, {})
|
|
90
90
|
}
|
|
@@ -92,7 +92,7 @@ const ke = ({
|
|
|
92
92
|
] }) })
|
|
93
93
|
] });
|
|
94
94
|
}, We = () => {
|
|
95
|
-
const
|
|
95
|
+
const t = N(), { toggleNotification: i } = ue(), [l, r] = $([]), [s, h] = $(), n = j(), y = Se(), { data: m, isLoading: F } = ve(), [{ query: p }, O] = pe({
|
|
96
96
|
sort: "name:asc",
|
|
97
97
|
_q: "",
|
|
98
98
|
page: 1,
|
|
@@ -111,7 +111,7 @@ const ke = ({
|
|
|
111
111
|
});
|
|
112
112
|
}, [T, i]);
|
|
113
113
|
const K = (o) => {
|
|
114
|
-
r(o ? g.map((c) => c.id) : []);
|
|
114
|
+
r(o === !0 ? g.map((c) => c.id) : []);
|
|
115
115
|
}, V = (o, c) => {
|
|
116
116
|
r(c ? (x) => [...x, o] : (x) => x.filter((ee) => ee !== o));
|
|
117
117
|
}, k = (o) => (c) => {
|
|
@@ -126,30 +126,29 @@ const ke = ({
|
|
|
126
126
|
try {
|
|
127
127
|
await y.mutateAsync(s.id), i({
|
|
128
128
|
type: "success",
|
|
129
|
-
message:
|
|
129
|
+
message: n("domain.notifications.deleted", {
|
|
130
130
|
values: { name: s.name }
|
|
131
131
|
})
|
|
132
132
|
}), h(void 0), r((o) => o.filter((c) => c !== s.id));
|
|
133
133
|
} catch {
|
|
134
134
|
i({
|
|
135
135
|
type: "danger",
|
|
136
|
-
message:
|
|
136
|
+
message: n("domain.notifications.deleteError")
|
|
137
137
|
});
|
|
138
138
|
}
|
|
139
139
|
}, Z = () => {
|
|
140
140
|
h(void 0);
|
|
141
141
|
};
|
|
142
|
-
return J || F ? /* @__PURE__ */ e(D.Main, { children: /* @__PURE__ */ e(b.Content, { children: /* @__PURE__ */ e(
|
|
142
|
+
return J || F ? /* @__PURE__ */ e(D.Main, { children: /* @__PURE__ */ e(b.Content, { children: /* @__PURE__ */ e(ne, { children: n("domain.list.loading") }) }) }) : /* @__PURE__ */ a(A, { children: [
|
|
143
143
|
/* @__PURE__ */ e(D.Title, { children: "Tenants" }),
|
|
144
144
|
/* @__PURE__ */ a(D.Main, { children: [
|
|
145
145
|
/* @__PURE__ */ e(
|
|
146
146
|
b.Header,
|
|
147
147
|
{
|
|
148
|
-
title:
|
|
149
|
-
subtitle:
|
|
148
|
+
title: n("domain.list.title"),
|
|
149
|
+
subtitle: n("domain.list.subtitle", {
|
|
150
150
|
values: { count: g.length }
|
|
151
|
-
})
|
|
152
|
-
as: "h2"
|
|
151
|
+
})
|
|
153
152
|
}
|
|
154
153
|
),
|
|
155
154
|
/* @__PURE__ */ e(
|
|
@@ -158,7 +157,7 @@ const ke = ({
|
|
|
158
157
|
startActions: /* @__PURE__ */ e(A, { children: /* @__PURE__ */ e(
|
|
159
158
|
fe,
|
|
160
159
|
{
|
|
161
|
-
label:
|
|
160
|
+
label: n("domain.list.search", {
|
|
162
161
|
defaultMessage: "Search domains"
|
|
163
162
|
})
|
|
164
163
|
}
|
|
@@ -171,15 +170,15 @@ const ke = ({
|
|
|
171
170
|
if (!m?.features?.unlimited && m?.features?.domains != null && m?.features?.domains <= v.total)
|
|
172
171
|
return i({
|
|
173
172
|
type: "warning",
|
|
174
|
-
message:
|
|
173
|
+
message: n("domain.list.limitReached", {
|
|
175
174
|
values: {
|
|
176
175
|
limit: m?.features.domains || 0
|
|
177
176
|
}
|
|
178
177
|
})
|
|
179
178
|
});
|
|
180
|
-
|
|
179
|
+
t(`/settings/${_}/${H}/new`);
|
|
181
180
|
},
|
|
182
|
-
children:
|
|
181
|
+
children: n("common.create")
|
|
183
182
|
}
|
|
184
183
|
) })
|
|
185
184
|
}
|
|
@@ -188,7 +187,7 @@ const ke = ({
|
|
|
188
187
|
ie,
|
|
189
188
|
{
|
|
190
189
|
icon: /* @__PURE__ */ e(ge, {}),
|
|
191
|
-
content:
|
|
190
|
+
content: n("domain.list.emptyState", {
|
|
192
191
|
defaultMessage: "No domains found matching your search criteria"
|
|
193
192
|
})
|
|
194
193
|
}
|
|
@@ -198,15 +197,14 @@ const ke = ({
|
|
|
198
197
|
/* @__PURE__ */ e(C, { children: /* @__PURE__ */ e(
|
|
199
198
|
I,
|
|
200
199
|
{
|
|
201
|
-
checked: l.length === g.length && g.length > 0,
|
|
202
|
-
indeterminate: l.length > 0 ? l.length < g.length : void 0,
|
|
200
|
+
checked: l.length > 0 && l.length < g.length ? "indeterminate" : l.length === g.length && g.length > 0,
|
|
203
201
|
onCheckedChange: K
|
|
204
202
|
}
|
|
205
203
|
) }),
|
|
206
204
|
/* @__PURE__ */ e(C, { children: /* @__PURE__ */ e(
|
|
207
205
|
P,
|
|
208
206
|
{
|
|
209
|
-
label:
|
|
207
|
+
label: n("domain.list.table.headers.id"),
|
|
210
208
|
field: "id",
|
|
211
209
|
sort: S,
|
|
212
210
|
onSort: k
|
|
@@ -215,7 +213,7 @@ const ke = ({
|
|
|
215
213
|
/* @__PURE__ */ e(C, { children: /* @__PURE__ */ e(
|
|
216
214
|
P,
|
|
217
215
|
{
|
|
218
|
-
label:
|
|
216
|
+
label: n("domain.list.table.headers.name"),
|
|
219
217
|
field: "name",
|
|
220
218
|
sort: S,
|
|
221
219
|
onSort: k
|
|
@@ -224,14 +222,14 @@ const ke = ({
|
|
|
224
222
|
/* @__PURE__ */ e(C, { children: /* @__PURE__ */ e(
|
|
225
223
|
P,
|
|
226
224
|
{
|
|
227
|
-
label:
|
|
225
|
+
label: n("domain.list.table.headers.code"),
|
|
228
226
|
field: "code",
|
|
229
227
|
sort: S,
|
|
230
228
|
onSort: k
|
|
231
229
|
}
|
|
232
230
|
) }),
|
|
233
|
-
/* @__PURE__ */ e(C, { children: /* @__PURE__ */ e(d, { variant: "sigma", textColor: "neutral600", children:
|
|
234
|
-
/* @__PURE__ */ e(C, { children: /* @__PURE__ */ e(d, { variant: "sigma", textColor: "neutral600", children:
|
|
231
|
+
/* @__PURE__ */ e(C, { children: /* @__PURE__ */ e(d, { variant: "sigma", textColor: "neutral600", children: n("domain.list.table.headers.role") }) }),
|
|
232
|
+
/* @__PURE__ */ e(C, { children: /* @__PURE__ */ e(d, { variant: "sigma", textColor: "neutral600", children: n("domain.list.table.headers.actions") }) })
|
|
235
233
|
] }) }),
|
|
236
234
|
/* @__PURE__ */ e(re, { children: g.map((o) => /* @__PURE__ */ e(
|
|
237
235
|
De,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("@strapi/design-system"),m=require("@strapi/icons"),a=require("@strapi/strapi/admin"),k=require("react"),q=require("react-router-dom"),x=require("./index-BwgjJmHR.js"),p=require("./useTenants-Ck1OOTGx.js"),W=require("styled-components"),P=require("./useGetMessage-gI6hxpcF.js"),G=require("./useSettings-CkTWZxdH.js"),A=n=>n&&n.__esModule?n:{default:n},H=A(k),O=A(W),Q=({isOpen:n,onClose:i,onConfirm:l,target:r})=>e.jsx(t.Dialog.Root,{open:n,onOpenChange:i,children:e.jsxs(t.Dialog.Content,{children:[e.jsx(t.Dialog.Header,{children:"Confirmation"}),e.jsx(t.Dialog.Body,{icon:e.jsx(m.Trash,{}),children:e.jsx(t.Dialog.Description,{textAlign:"center",children:e.jsxs(t.Flex,{gap:2,direction:"column",children:[e.jsx(m.WarningCircle,{fill:"danger600",width:"24",height:"24"}),"Are you sure you want to delete this ",r,"?",e.jsx("br",{}),"All your modifications will be lost"]})})}),e.jsxs(t.Dialog.Footer,{children:[e.jsx(t.Dialog.Action,{children:e.jsx(t.Button,{fullWidth:!0,onClick:i,variant:"tertiary",size:"S",children:e.jsx(t.Typography,{variant:"omega",children:"Cancel"})})}),e.jsx(t.Dialog.Action,{children:e.jsx(t.Button,{fullWidth:!0,onClick:l,variant:"danger",size:"S",children:e.jsx(t.Typography,{variant:"omega",children:"Confirm"})})})]})]})}),U=({isDisplayed:n,direction:i})=>n?i==="asc"?e.jsx(m.ArrowUp,{}):e.jsx(m.ArrowDown,{}):null,D=({label:n,field:i,sort:l,onSort:r})=>{const[c,h]=l.split(":");return e.jsxs("div",{style:{display:"flex",alignItems:"center",cursor:"pointer"},onClick:()=>r(i)(h==="asc"?"desc":"asc"),children:[e.jsx(t.Typography,{variant:"sigma",textColor:"neutral600",children:n}),e.jsx("span",{style:{marginLeft:4},children:e.jsx(U,{isDisplayed:i===c,direction:h})})]})},J=O.default(t.Tr)(()=>({cursor:"pointer"})),K=({tenant:n,selectedTenants:i,handleSelectTenant:l,onDeleteTenant:r,isDeletePending:c=!1})=>{const h=q.useNavigate(),s=P.useGetMessage(),y=u=>()=>h(`/settings/${x.pluginId}/${x.modelRoute}/${u.id}`);return e.jsxs(J,{onClick:y(n),children:[e.jsx(t.Td,{children:e.jsx(t.Checkbox,{checked:i.includes(n.id),onCheckedChange:u=>l(n.id,u)})}),e.jsx(t.Td,{children:e.jsx(t.Typography,{fontWeight:"semiBold",textColor:"neutral800",children:n.id})}),e.jsx(t.Td,{children:e.jsx(t.Typography,{fontWeight:"semiBold",textColor:"neutral800",children:n.name})}),e.jsx(t.Td,{children:e.jsx(t.Typography,{textColor:"neutral800",children:n.code})}),e.jsx(t.Td,{children:n.role?e.jsx(t.Badge,{textColor:"neutral800",backgroundColor:"neutral100",children:n.role.name}):e.jsx(t.Typography,{textColor:"neutral600",children:"-"})}),e.jsx(t.Td,{children:e.jsxs(t.Flex,{gap:1,children:[e.jsx(p.CheckPermissions,{permissions:x.permissions.admin.edit,children:e.jsx(t.IconButton,{onClick:y(n),label:s("common.edit"),children:e.jsx(m.Pencil,{})})}),e.jsx(p.CheckPermissions,{permissions:x.permissions.admin.delete,children:e.jsx(t.IconButton,{onClick:r(n),label:s("common.delete"),disabled:c,children:e.jsx(m.Trash,{})})})]})})]})},V=()=>{const n=q.useNavigate(),{toggleNotification:i}=a.useNotification(),[l,r]=k.useState([]),[c,h]=k.useState(),s=P.useGetMessage(),y=p.useDeleteTenant(),{data:u,isLoading:w}=G.useSettings(),[{query:j},L]=a.useQueryParams({sort:"name:asc",_q:"",page:1,pageSize:10}),{sort:f,_q:M,page:R,pageSize:_}={...j,sort:j.sort||"name:asc",_q:j._q||"",page:j.page||1,pageSize:j.pageSize||10},{data:v,isLoading:B,error:T}=p.useTenants({sort:f,search:M,page:R,pageSize:_}),g=v?.results||[],C=v?.pagination||{pageCount:1,total:0};H.default.useEffect(()=>{T&&i({type:"danger",message:T instanceof Error?T.message:"An error occurred while fetching tenants"})},[T,i]);const I=o=>{r(o===!0?g.map(d=>d.id):[])},z=(o,d)=>{r(d?b=>[...b,o]:b=>b.filter(N=>N!==o))},S=o=>d=>{L({...j,sort:`${o}:${d}`})},$=o=>async d=>{d.stopPropagation(),h(o)},E=async()=>{if(c)try{await y.mutateAsync(c.id),i({type:"success",message:s("domain.notifications.deleted",{values:{name:c.name}})}),h(void 0),r(o=>o.filter(d=>d!==c.id))}catch{i({type:"danger",message:s("domain.notifications.deleteError")})}},F=()=>{h(void 0)};return B||w?e.jsx(a.Page.Main,{children:e.jsx(a.Layouts.Content,{children:e.jsx(t.Loader,{children:s("domain.list.loading")})})}):e.jsxs(e.Fragment,{children:[e.jsx(a.Page.Title,{children:"Tenants"}),e.jsxs(a.Page.Main,{children:[e.jsx(a.Layouts.Header,{title:s("domain.list.title"),subtitle:s("domain.list.subtitle",{values:{count:g.length}})}),e.jsx(a.Layouts.Action,{startActions:e.jsx(e.Fragment,{children:e.jsx(a.SearchInput,{label:s("domain.list.search",{defaultMessage:"Search domains"})})}),endActions:e.jsx(p.CheckPermissions,{permissions:x.permissions.admin.create,children:e.jsx(t.Button,{startIcon:e.jsx(m.Plus,{}),onClick:()=>{if(!u?.features?.unlimited&&u?.features?.domains!=null&&u?.features?.domains<=C.total)return i({type:"warning",message:s("domain.list.limitReached",{values:{limit:u?.features.domains||0}})});n(`/settings/${x.pluginId}/${x.modelRoute}/new`)},children:s("common.create")})})}),e.jsx(a.Layouts.Content,{children:g.length===0?e.jsx(t.EmptyStateLayout,{icon:e.jsx(m.Search,{}),content:s("domain.list.emptyState",{defaultMessage:"No domains found matching your search criteria"})}):e.jsxs(e.Fragment,{children:[e.jsxs(t.Table,{colCount:6,rowCount:g.length+1,children:[e.jsx(t.Thead,{children:e.jsxs(t.Tr,{children:[e.jsx(t.Th,{children:e.jsx(t.Checkbox,{checked:l.length>0&&l.length<g.length?"indeterminate":l.length===g.length&&g.length>0,onCheckedChange:I})}),e.jsx(t.Th,{children:e.jsx(D,{label:s("domain.list.table.headers.id"),field:"id",sort:f,onSort:S})}),e.jsx(t.Th,{children:e.jsx(D,{label:s("domain.list.table.headers.name"),field:"name",sort:f,onSort:S})}),e.jsx(t.Th,{children:e.jsx(D,{label:s("domain.list.table.headers.code"),field:"code",sort:f,onSort:S})}),e.jsx(t.Th,{children:e.jsx(t.Typography,{variant:"sigma",textColor:"neutral600",children:s("domain.list.table.headers.role")})}),e.jsx(t.Th,{children:e.jsx(t.Typography,{variant:"sigma",textColor:"neutral600",children:s("domain.list.table.headers.actions")})})]})}),e.jsx(t.Tbody,{children:g.map(o=>e.jsx(K,{tenant:o,selectedTenants:l,handleSelectTenant:z,onDeleteTenant:$},o.id))})]}),e.jsx(t.Box,{paddingTop:4,children:e.jsxs(a.Pagination.Root,{pageCount:C.pageCount,total:C.total,children:[e.jsx(a.Pagination.PageSize,{}),e.jsx(a.Pagination.Links,{})]})})]})})]}),e.jsx(Q,{isOpen:!!c,onClose:F,onConfirm:E,target:c?.name||x.modelId})]})};exports.default=V;
|
|
@@ -0,0 +1 @@
|
|
|
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;
|