strapi-plugin-navigation 3.3.1 → 3.3.3-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/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +153 -149
- package/package.json +2 -2
package/dist/admin/index.js
CHANGED
|
@@ -181,4 +181,4 @@
|
|
|
181
181
|
[role='status'] {
|
|
182
182
|
flex-direction: column;
|
|
183
183
|
}
|
|
184
|
-
`,wo=({setIsReloading:e})=>{const{formatMessage:n}=E.useIntl(),a=St(),{restartStatus:i,setRestartStatus:s}=le(),r=async()=>{a.mutate(void 0,{onSuccess(){e(!0),Tt(!0).then(u=>{u&&window.location.reload()})},onError(){s({required:!1})}})},c=()=>s({required:!1});return i.required?t.jsx(o.Box,{...Ie,width:"100%",children:t.jsx(Fo,{closeLabel:n(l("pages.settings.actions.restart.alert.cancel")),title:n(l("pages.settings.actions.restart.alert.title")),action:t.jsx(o.Box,{children:t.jsx(o.Button,{onClick:r,startIcon:t.jsx(R.Play,{}),children:n(l("pages.settings.actions.restart.label"))})}),onClose:c,children:t.jsxs(t.Fragment,{children:[t.jsx(o.Box,{paddingBottom:1,children:n(l("pages.settings.actions.restart.alert.description"))}),i.reasons?.map((u,g)=>t.jsx(o.Box,{paddingBottom:1,children:n(l(`pages.settings.actions.restart.alert.reason.${u}`))},g))]})})}):null},Eo=()=>{const e=_e(),{formatMessage:n}=E.useIntl(),{values:a,onChange:i,handleChange:s,restartStatus:r}=le();return t.jsx(o.Box,{...Ie,width:"100%",children:t.jsxs(o.Flex,{direction:"column",alignItems:"flex-start",gap:2,children:[t.jsx(o.Typography,{variant:"delta",as:"h2",children:n(l("pages.settings.additional.title"))}),t.jsxs(o.Grid.Root,{gap:4,width:"100%",children:[t.jsx(o.Grid.Item,{col:4,s:12,xs:12,children:t.jsx(o.Box,{width:"100%",children:t.jsx(N.Field,{name:"allowedLevels",label:n(l("pages.settings.form.allowedLevels.label")),hint:n(l("pages.settings.form.allowedLevels.hint")),children:t.jsx(o.NumberInput,{width:"100%",name:"allowedLevels",type:"number",placeholder:n(l("pages.settings.form.allowedLevels.placeholder")),onChange:(c,u)=>{if(S.isObject(c)){const g=parseInt(c.target.value);return s(c.target.name,isNaN(g)?0:g,i)}return s(c,u,i)},value:a.allowedLevels,disabled:r.required})})})}),t.jsx(o.Grid.Item,{col:4,s:12,xs:12,children:t.jsx(N.Field,{name:"cascadeMenuAttached",label:n(l("pages.settings.form.cascadeMenuAttached.label")),hint:n(l("pages.settings.form.cascadeMenuAttached.hint")),children:t.jsx(o.Toggle,{width:"100%",name:"cascadeMenuAttached",checked:a.cascadeMenuAttached,onChange:c=>s(c,!a.cascadeMenuAttached,i),onLabel:n(l("components.toggle.enabled")),offLabel:n(l("components.toggle.disabled")),disabled:r.required})})}),t.jsx(o.Grid.Item,{col:4,s:12,xs:12,children:t.jsx(N.Field,{name:"audienceFieldChecked",label:n(l("pages.settings.form.audience.label")),hint:n(l("pages.settings.form.audience.hint")),children:t.jsx(o.Toggle,{name:"audienceFieldChecked",checked:a.audienceFieldChecked,onChange:c=>s(c,!a.audienceFieldChecked,i),onLabel:n(l("components.toggle.enabled")),offLabel:n(l("components.toggle.disabled")),disabled:r.required,width:"100%"})})}),e.data?.isCachePluginEnabled&&t.jsx(o.Grid.Item,{col:12,s:12,xs:12,children:t.jsx(N.Field,{name:"isCacheEnabled",label:n(l("pages.settings.form.cache.label")),hint:n(l("pages.settings.form.cache.hint")),children:t.jsx(o.Toggle,{name:"isCacheEnabled",checked:a.isCacheEnabled,onChange:c=>s(c,!a.isCacheEnabled,i),onLabel:n(l("components.toggle.enabled")),offLabel:n(l("components.toggle.disabled")),disabled:r.required,width:"100%"})})})]})]})})},No=()=>{const{formatMessage:e}=E.useIntl(),{values:n,onChange:a,handleChange:i,restartStatus:s}=le();return t.jsx(o.Grid.Item,{col:4,s:12,xs:12,children:t.jsx(N.Field,{name:"preferCustomContentTypes",label:e(l("pages.settings.form.preferCustomContentTypes.label")),hint:e(l("pages.settings.form.preferCustomContentTypes.hint")),children:t.jsx(o.Toggle,{name:"preferCustomContentTypes",checked:n.preferCustomContentTypes,onChange:r=>i(r,!n.preferCustomContentTypes,a),onLabel:e(l("components.toggle.enabled")),offLabel:e(l("components.toggle.disabled")),disabled:s.required,width:"100%"})})})},Ao=()=>{const e=_e(),n=we(),{formatMessage:a}=E.useIntl(),{values:i,onChange:s,handleChange:r,restartStatus:c,setFormValueItem:u,renderError:g}=le(),{contentTypes:m,preferCustomContentTypes:p}=i,C=S.sortBy(Object.values(n.data??[]).filter(({uid:b})=>bo(b,{allowedContentTypes:e.data?.allowedContentTypes,restrictedContentTypes:e.data?.restrictedContentTypes,preferCustomContentTypes:p,contentTypes:m})).map(b=>{const v=n.data?.find(x=>x.uid===b.uid);if(v){const{isDisplayed:x,kind:y}=v;return{...b,available:x,isSingle:y==="singleType"}}return b}),b=>b.info.displayName);return t.jsx(o.Grid.Item,{col:4,s:12,xs:12,children:t.jsx(N.Field,{name:"contentTypes",label:a(l("pages.settings.form.contentTypes.label")),hint:a(l("pages.settings.form.contentTypes.hint")),children:t.jsx(o.MultiSelect,{name:"contentTypes",label:a(l("pages.settings.form.contentTypes.label")),"aria-label":a(l("pages.settings.form.contentTypes.label")),placeholder:a(l("pages.settings.form.contentTypes.placeholder")),value:i.contentTypes,onChange:b=>{r("contentTypes",b,s);const{contentTypesNameFields:v=[],contentTypesPopulate:x=[],pathDefaultFields:y=[]}=i,I=b.filter(T=>!v.find(L=>L.key===T))??[],f=v.filter(T=>!b.includes(T.key)||T.key==="default").map(({key:T})=>T)??[];u("contentTypesNameFields",[...v.filter(({key:T})=>!f.includes(T)||T==="default")??[],...I.map(T=>({key:T,fields:[]}))]),u("contentTypesPopulate",[...x.filter(({key:T})=>!f.includes(T)||T==="default")??[],...I.map(T=>({key:T,fields:[]}))]),u("pathDefaultFields",[...y.filter(({key:T})=>!f.includes(T)||T==="default")??[],...I.map(T=>({key:T,fields:[]}))])},disabled:c.required,error:g("contentTypes"),withTags:!0,width:"100%",children:C.map(b=>t.jsx(o.MultiSelectOption,{value:b.uid,children:b.info.displayName},b.uid))})})})},Ro=()=>{const e=we(),{formatMessage:n}=E.useIntl(),{values:a,onChange:i,handleChange:s,restartStatus:r,renderError:c}=le(),u=j.useMemo(()=>a.contentTypes?.map(g=>e.data?.find(({uid:m})=>m===g)).filter(g=>g!==void 0)||[],[a.contentTypes,e.data]);return j.useEffect(()=>{a.defaultContentType&&(a.contentTypes.includes(a.defaultContentType)||s("defaultContentType",void 0,i))},[a.contentTypes]),t.jsx(o.Grid.Item,{col:4,s:12,xs:12,children:t.jsx(N.Field,{name:"defaultContentType",label:n(l("pages.settings.form.defaultContentType.label")),hint:n(l("pages.settings.form.defaultContentType.hint")),children:t.jsx(o.SingleSelect,{name:"defaultContentType",label:n(l("pages.settings.form.defaultContentType.label")),"aria-label":n(l("pages.settings.form.defaultContentType.label")),placeholder:n(l("pages.settings.form.defaultContentType.placeholder")),value:a.defaultContentType,onChange:g=>s("defaultContentType",g,i),onClear:()=>s("defaultContentType",void 0,i),disabled:r.required,error:c("defaultContentType"),withTags:!0,width:"100%",children:u.map(g=>t.jsx(o.SingleSelectOption,{value:g.uid,children:g.info.displayName},g.uid))})})})},Lo=["relation","media","component","dynamiczone"],$o=()=>{const e=we(),{formatMessage:n}=E.useIntl(),{values:a,onChange:i,handleChange:s,restartStatus:r,renderError:c}=le(),{contentTypes:u,contentTypesNameFields:g}=a;return t.jsx(o.Grid.Item,{col:12,s:12,xs:12,children:u?.length?t.jsx(o.Accordion.Root,{style:{width:"100%"},children:g.map((m,p)=>{const C=e.data?.find(({uid:y})=>y===m.key),b=C?.attributes??{},v=Object.keys(b).sort(),x=v.filter(y=>Lo.includes(b[y]?.type));return C?t.jsxs(o.Accordion.Item,{value:m.key,children:[t.jsx(o.Accordion.Header,{children:t.jsx(o.Accordion.Trigger,{children:C?.info.displayName??n(l("pages.settings.form.nameField.default"))})}),t.jsx(o.Accordion.Content,{children:t.jsxs(o.Grid.Root,{gap:4,padding:2,children:[t.jsx(o.Grid.Item,{col:12,s:12,xs:12,children:t.jsx(N.Field,{name:`contentTypesNameFields[${p}]`,label:n(l("pages.settings.form.nameField.label")),hint:n(l(`pages.settings.form.nameField.${S.isEmpty(S.get(a,`contentTypesNameFields[${p}].fields`,[]))?"empty":"hint"}`)),children:t.jsx(o.MultiSelect,{name:`contentTypesNameFields[${p}]`,placeholder:n(l("pages.settings.form.nameField.placeholder")),value:S.get(a,`contentTypesNameFields[${p}].fields`),onChange:y=>{const I=S.get(a,"contentTypesNameFields",[]).map((f,T)=>T===p?{...f,fields:y}:f);return s("contentTypesNameFields",I,i)},disabled:r.required,error:c(`contentTypesNameFields[${p}]`),withTags:!0,children:v.map(y=>t.jsx(o.MultiSelectOption,{value:y,children:y},y))})})}),t.jsx(o.Grid.Item,{col:12,s:12,xs:12,children:t.jsx(N.Field,{name:`contentTypesPopulate[${p-1}]`,label:n(l("pages.settings.form.populate.label")),hint:n(l(`pages.settings.form.populate.${S.isEmpty(S.get(a,`contentTypesPopulate[${p-1}]fields`,[]))?"empty":"hint"}`)),children:t.jsx(o.MultiSelect,{width:"100%",name:`contentTypesPopulate[${p-1}]`,placeholder:n(l("pages.settings.form.populate.placeholder")),value:S.get(a,`contentTypesPopulate[${p-1}].fields`,[]),onChange:y=>{const I=S.get(a,"contentTypesPopulate",[]).map((f,T)=>T===p-1?{...f,fields:y}:f);return s("contentTypesPopulate",I,i)},disabled:r.required,error:c(`contentTypesPopulate[${p-1}]`),withTags:!0,children:x.map(y=>t.jsx(o.MultiSelectOption,{value:y,children:y},y))})})}),t.jsx(o.Grid.Item,{col:12,s:12,xs:12,children:t.jsx(N.Field,{name:`pathDefaultFields[${p-1}]`,label:n(l("pages.settings.form.pathDefaultFields.label")),hint:n(l(`pages.settings.form.pathDefaultFields.${S.isEmpty(S.get(a,`pathDefaultFields[${p-1}].fields`,[]))?"empty":"hint"}`)),children:t.jsx(o.MultiSelect,{name:`pathDefaultFields[${p-1}]`,width:"100%",placeholder:n(l("pages.settings.form.pathDefaultFields.placeholder")),value:S.get(a,`pathDefaultFields[${p-1}].fields`,[]),onChange:y=>{const I=S.get(a,"pathDefaultFields",[]).map((f,T)=>T===p-1?{...f,fields:y}:f);return s("pathDefaultFields",I,i)},disabled:r.required,error:c(`pathDefaultFields[${p-1}]`),withTags:!0,children:v.map(y=>t.jsx(o.MultiSelectOption,{value:y,children:y},y))})})})]})})]},m.key):null})}):null})},Mo=()=>{const{formatMessage:e}=E.useIntl();return t.jsx(o.Box,{...Ie,width:"100%",children:t.jsxs(o.Flex,{direction:"column",alignItems:"flex-start",gap:2,children:[t.jsx(o.Typography,{variant:"delta",as:"h2",children:e(l("pages.settings.general.title"))}),t.jsx(o.Grid.Root,{gap:4,width:"100%",children:t.jsx(o.Grid.Item,{col:12,s:12,xs:12,children:t.jsxs(o.Grid.Root,{gap:4,width:"100%",children:[t.jsx(No,{}),t.jsx(Ao,{}),t.jsx(Ro,{}),t.jsx($o,{})]})})})]})})},it=t.jsx(R.PriceTag,{}),Po=t.jsx(R.Plus,{}),H="pages.settings.form.customFields.table.",ko=({data:e=[],onOpenModal:n,onRemoveCustomField:a,onToggleCustomField:i})=>{const[s,r]=j.useState(!1),[c,u]=j.useState(null),{toggleNotification:g}=F.useNotification(),m=j.useMemo(()=>S.sortBy(e,"name"),[e]),{formatMessage:p}=E.useIntl(),C=j.useCallback(x=>{u(x),r(!0)},[u,r]),b=j.useCallback(()=>{u(null),r(!1)},[u,r]),v=j.useCallback(()=>{c===null?g({type:"warning",message:p(l(`${H}confirmation.error`))}):a(c),b()},[b,c,qe,a,g]);return t.jsxs(t.Fragment,{children:[t.jsx(Se,{isVisible:s,header:p(l(`${H}confirmation.header`)),children:p(l(`${H}confirmation.message`)),labelConfirm:p(l(`${H}confirmation.confirm`)),iconConfirm:it,mainIcon:it,onConfirm:v,onCancel:b}),t.jsxs(o.Table,{width:"100%",colCount:4,rowCount:e.length+1,footer:t.jsx(o.TFooter,{onClick:x=>{x.preventDefault(),n(null)},icon:Po,children:p(l(`${H}footer`))}),children:[t.jsx(o.Thead,{children:t.jsxs(o.Tr,{children:[t.jsx(o.Th,{width:"20%",children:t.jsx(o.Typography,{variant:"sigma",textColor:"neutral600",children:p(l(`${H}header.name`))})}),t.jsx(o.Th,{width:"60%",children:t.jsx(o.Typography,{variant:"sigma",textColor:"neutral600",children:p(l(`${H}header.label`))})}),t.jsx(o.Th,{width:"15%",children:t.jsx(o.Typography,{variant:"sigma",textColor:"neutral600",children:p(l(`${H}header.type`))})}),t.jsx(o.Th,{width:"5%",children:t.jsx(o.Typography,{variant:"sigma",textColor:"neutral600",children:p(l(`${H}header.required`))})}),t.jsx(o.Th,{children:t.jsx(o.VisuallyHidden,{})})]})}),t.jsx(o.Tbody,{children:m.map(x=>typeof x!="string"?t.jsxs(o.Tr,{children:[t.jsx(o.Td,{width:"20%",children:t.jsx(o.Typography,{fontWeight:"semiBold",textColor:"neutral800",children:x.name})}),t.jsx(o.Td,{width:"60%",children:t.jsx(o.Typography,{textColor:"neutral800",children:x.label})}),t.jsx(o.Td,{width:"15%",children:t.jsx(o.Typography,{textColor:"neutral800",children:x.type})}),t.jsx(o.Td,{width:"5%",children:t.jsx(o.Tooltip,{description:p(l(`${H}${x.required?"required":"notRequired"}`)),children:t.jsx(o.Typography,{textColor:"neutral800",children:x.required?t.jsx(R.Check,{}):t.jsx(R.Minus,{})})})}),t.jsx(o.Td,{children:t.jsx(o.Flex,{width:"100%",justifyContent:"flex-end",alignItems:"center",children:t.jsxs(o.IconButtonGroup,{children:[t.jsx(o.IconButton,{onClick:()=>i(x),label:p(l(`${H}${x.enabled?"disable":"enable"}`)),variant:x.enabled?"success-light":"tertiary",children:x.enabled?t.jsx(R.Eye,{}):t.jsx(R.EyeStriked,{}),style:{minWidth:50}}),t.jsx(o.IconButton,{onClick:()=>n(x),label:p(l(`${H}edit`)),children:t.jsx(R.Pencil,{}),style:{minWidth:50}}),t.jsx(o.IconButton,{onClick:()=>C(x),label:p(l(`${H}remove`)),children:t.jsx(R.Trash,{}),style:{minWidth:50}})]})})})]},x.name):null)})]})]})},zo=({onChange:e,initialValue:n,...a})=>{const[i,s]=j.useState(S.isArray(n)?n.reduce((c,u)=>`${c}${u}; `,""):""),r=c=>{const u=c?.target.value??"",g=u.split(";").map(m=>m.trim()).filter(m=>!!m.length);s(u??""),e(g)};return t.jsx(o.TextInput,{...a,onChange:r,value:i})},q="pages.settings.form.customFields.popup.",qo=e=>e.map((n,a)=>({key:`${n}-${a}`,metadatas:{intlLabel:{id:n,defaultMessage:n},hidden:!1,disabled:!1},value:n,label:n})),Bo=({isEditForm:e,customField:n,onSubmit:a,onClose:i})=>{const s=qo(To),{formatMessage:r}=E.useIntl(),[c,u]=j.useState({name:"",label:"",type:"string",required:!1,multi:!1,enabled:!0}),[g,m]=j.useState(),{type:p}=c;j.useEffect(()=>{n&&u({...n})},[n]);const C=(y,I,f)=>{if(f){let T=y,L=I;if(S.isObject(y)){const{name:B,value:P}=y.target;T=B,L=S.isNil(L)?P:L}return S.isString(T)&&b(T,L),f(y,L)}},b=(y,I)=>{u(S.set({...c},y,I))},v=y=>{const I=S.get(g,y);if(I)return r(l(`${q}${y}.${I}`))},x=(y,I)=>{const{success:f,data:T,error:L}=ct.safeParse(I);f?a(T):L&&m(L.issues.reduce((B,P)=>({...B,[P.path.join(".")]:P.message}),{}))};return t.jsxs(t.Fragment,{children:[t.jsx(o.Modal.Body,{children:t.jsx(F.Form,{method:"POST",width:"auto",height:"auto",initialValues:c,children:({values:y,onChange:I})=>t.jsxs(o.Grid.Root,{gap:5,children:[t.jsx(o.Grid.Item,{col:12,children:t.jsx(N.Field,{name:"name",label:r(l(`${q}name.label`)),hint:r(l(`${q}name.description`)),error:v("name"),required:!0,children:t.jsx(o.TextInput,{name:"name",value:y.name,onChange:(f,T)=>C(f,T,I),placeholder:r(l(`${q}name.placeholder`)),type:"string",disabled:e,width:"100%"})})},"name"),t.jsx(o.Grid.Item,{col:12,children:t.jsx(N.Field,{name:"label",label:r(l(`${q}label.label`)),hint:r(l(`${q}label.description`)),error:v("label"),required:!0,children:t.jsx(o.TextInput,{name:"label",value:y.label,onChange:(f,T)=>C(f,T,I),placeholder:r(l(`${q}label.placeholder`)),type:"string",width:"100%"})})},"label"),t.jsx(o.Grid.Item,{col:12,children:t.jsx(N.Field,{name:"description",label:r(l(`${q}description.label`)),hint:r(l(`${q}description.description`)),error:v("description"),children:t.jsx(o.TextInput,{name:"description",value:y.description,onChange:(f,T)=>C(f,T,I),placeholder:r(l(`${q}description.placeholder`)),type:"string",width:"100%"})})},"description"),t.jsx(o.Grid.Item,{col:12,children:t.jsx(N.Field,{name:"placeholder",label:r(l(`${q}placeholder.label`)),hint:r(l(`${q}placeholder.description`)),error:v("placeholder"),children:t.jsx(o.TextInput,{name:"placeholder",value:y.placeholder,onChange:(f,T)=>C(f,T,I),placeholder:r(l(`${q}placeholder.placeholder`)),type:"string",width:"100%"})})},"placeholder"),t.jsx(o.Grid.Item,{col:12,children:t.jsx(N.Field,{name:"type",label:r(l(`${q}type.label`)),hint:r(l(`${q}type.description`)),required:!0,children:t.jsx(o.SingleSelect,{name:"type",value:y.type,onChange:f=>C("type",f,I),disabled:e,width:"100%",children:s.map(({key:f,label:T,value:L})=>t.jsx(o.SingleSelectOption,{value:L,children:T},f))})})},"type"),p==="select"&&t.jsxs(t.Fragment,{children:[t.jsx(o.Grid.Item,{col:12,children:t.jsx(N.Field,{name:"multi",label:r(l(`${q}multi.label`)),hint:r(l(`${q}multi.description`)),error:v("multi"),children:t.jsx(o.Toggle,{name:"multi",checked:y.multi,onChange:f=>C(f,!y.multi,I),onLabel:"true",offLabel:"false",width:"100%"})})},"multi"),t.jsx(o.Grid.Item,{col:12,children:t.jsx(N.Field,{name:"options",label:r(l(`${q}options.label`)),hint:r(l(`${q}options.description`)),error:v("options"),children:t.jsx(zo,{name:"options",onChange:f=>C("options",f,I),initialValue:y.options})})},"options")]}),t.jsx(o.Grid.Item,{col:12,children:t.jsx(N.Field,{name:"required",label:r(l(`${q}required.label`)),hint:r(l(`${q}required.description`)),error:v("required"),children:t.jsx(o.Toggle,{name:"required",placeholder:r(l(`${q}required.placeholder`)),checked:y.required,onChange:f=>C(f,!y.required,I),onLabel:"true",offLabel:"false",width:"100%"})})},"required")]})})}),t.jsxs(o.Modal.Footer,{children:[t.jsx(o.Modal.Close,{children:t.jsx(o.Button,{onClick:i,variant:"tertiary",children:r(l("popup.item.form.button.cancel"))})}),t.jsx(o.Button,{onClick:y=>x(y,c),children:r(l("popup.item.form.button.save"))})]})]})},Do=({isOpen:e,onClose:n,onSubmit:a,data:i})=>{const s=!!i,{formatMessage:r}=E.useIntl();return t.jsx(o.Modal.Root,{onOpenChange:c=>{c||n()},open:e,labelledBy:"custom-field-modal",children:t.jsxs(o.Modal.Content,{children:[t.jsx(o.Modal.Header,{children:t.jsx(o.Typography,{variant:"omega",fontWeight:"bold",textColor:"neutral800",as:"h2",id:"asset-dialog-title",children:r(l(`pages.settings.form.customFields.popup.header.${s?"edit":"new"}`))})}),t.jsx(Bo,{isEditForm:s,customField:i,onSubmit:a,onClose:n})]})})},Oo=()=>{const{formatMessage:e}=E.useIntl(),{values:{additionalFields:n},setFormValueItem:a}=le(),[i,s]=j.useState(!1),[r,c]=j.useState(null),u=C=>{c(C),s(!0)},g=C=>{const b=n.filter(v=>typeof v!="string"?v.name!==C.name:!0);a("additionalFields",b),c(null),s(!1)},m=C=>{const b={...C,enabled:!C.enabled},v=n.map(x=>typeof x!="string"&&C.name===x.name?b:x);a("additionalFields",v)},p=C=>{const v=!!n.find(x=>typeof x!="string"?x.name===C.name:!1)?n.map(x=>typeof x!="string"&&C.name===x.name?C:x):[...n,C];a("additionalFields",v),c(null),s(!1)};return t.jsxs(o.Box,{...Ie,width:"100%",children:[t.jsx(o.Typography,{variant:"delta",as:"h2",children:e(l("pages.settings.customFields.title"))}),t.jsx(o.Box,{padding:1}),t.jsx(ko,{data:n,onOpenModal:u,onRemoveCustomField:g,onToggleCustomField:m}),i&&t.jsx(Do,{onClose:()=>s(!1),onSubmit:p,isOpen:i,data:r})]})},Go=Kt.omit({contentTypesNameFields:!0}).extend({audienceFieldChecked:h.z.boolean(),contentTypesNameFields:h.z.object({key:h.z.string(),fields:h.z.string().array()}).array(),contentTypesPopulate:h.z.object({key:h.z.string(),fields:h.z.string().array()}).array(),pathDefaultFields:h.z.object({key:h.z.string(),fields:h.z.string().array()}).array()}),st=new $.QueryClient,Vo=()=>{const e=_e(),n=we(),a=Co(),i=Ft(),s=St(),{formatMessage:r}=E.useIntl(),[c,u]=j.useState({required:!1}),[g,m]=j.useState(!1),p=F.useAuth("SettingsPage",w=>w.permissions),C=j.useMemo(()=>!!p.find(({action:w})=>w===ue.settings[0].action),[p]),b=j.useMemo(()=>!!p.find(({action:w})=>w===ue.access[0].action),[p]),v=e.isPending||n.isPending||a.isPending||s.isPending||i.isPending,[x,y]=j.useState({}),[I,f]=j.useState(),T=(w,M,D)=>{if(D){let Z=w,O=M;if(S.isObject(w)){const{name:J,value:ae}=w.target;Z=J,O=S.isNil(O)?ae:O}return S.isString(Z)&&L(Z,O),D(w,O)}},L=(w,M)=>{y(D=>S.set({...D},w,M))},B=w=>{if(S.get(I,w))return r(l(w))},P=(w,M)=>{const{success:D,data:Z,error:O}=Go.safeParse(M);D?a.mutate(Z,{onSuccess(){u({required:!0}),a.reset()}}):O&&(f(O.issues.reduce((J,ae)=>({...J,[ae.path.join(".")]:ae.message}),{})),console.warn("Invalid form data",O))};return vo({config:e.data,setFormValue:y}),C?v||g?t.jsx(F.Page.Loading,{}):t.jsx(F.Layouts.Root,{children:t.jsxs(F.Page.Main,{children:[t.jsx(F.Page.Title,{children:r(l("pages.settings.header.title"))}),t.jsx(F.Layouts.Header,{title:r(l("pages.settings.header.title")),subtitle:r(l("pages.settings.header.description")),primaryAction:b?t.jsx(o.Button,{startIcon:t.jsx(R.Check,{}),disabled:c.required,onClick:w=>P(w,x),children:r(l("pages.settings.actions.submit"))}):null}),t.jsx(F.Layouts.Content,{children:t.jsx(F.Form,{method:"POST",width:"auto",height:"auto",initialValues:x,children:({values:w,onChange:M})=>t.jsx(wt.Provider,{value:{values:w,onChange:M,handleChange:T,restartStatus:c,setRestartStatus:u,renderError:B,setFormValueItem:L},children:t.jsxs(o.Flex,{direction:"column",gap:4,children:[t.jsx(wo,{setIsReloading:m}),t.jsx(Mo,{}),t.jsx(Eo,{}),t.jsx(Oo,{}),t.jsx(So,{hasSettingsReadPermissions:b})]})})})})]})}):t.jsx(F.Page.NoPermissions,{})};function Qo(){st.invalidateQueries();const e=N.usePluginTheme();return t.jsx($.QueryClientProvider,{client:st,children:t.jsx(o.DesignSystemProvider,{theme:e,children:t.jsx(Vo,{})})})}const _o="navigation",rt="Navigation",Uo={register(e){e.createSettingSection({id:ee,intlLabel:{id:`${ee}.plugin.section.name`,defaultMessage:`${rt} plugin`}},[{intlLabel:{id:`${ee}.plugin.section.item`,defaultMessage:"Configuration"},id:"navigation",to:ee,Component(){return Qo},permissions:ue.settings}]),e.addMenuLink({to:`plugins/${ee}`,icon:Gt,intlLabel:{id:`${ee}.plugin.name`,defaultMessage:rt},Component(){return yo},permissions:ue.access,position:1}),e.registerPlugin({id:ee,initializer:qt,isReady:!1,name:_o})},registerTrads:async function({locales:e=[]}){return Promise.all(e.map(async n=>n in We?We[n]().then(({default:i})=>({data:N.prefixPluginTranslations(N.flattenObject(i),ee),locale:n})):{data:N.prefixPluginTranslations(N.flattenObject({}),ee),locale:n}))}};module.exports=Uo;
|
|
184
|
+
`,wo=({setIsReloading:e})=>{const{formatMessage:n}=E.useIntl(),a=St(),{restartStatus:i,setRestartStatus:s}=le(),r=async()=>{a.mutate(void 0,{onSuccess(){e(!0),Tt(!0).then(u=>{u&&window.location.reload()})},onError(){s({required:!1})}})},c=()=>s({required:!1});return i.required?t.jsx(o.Box,{...Ie,width:"100%",children:t.jsx(Fo,{closeLabel:n(l("pages.settings.actions.restart.alert.cancel")),title:n(l("pages.settings.actions.restart.alert.title")),action:t.jsx(o.Box,{children:t.jsx(o.Button,{onClick:r,startIcon:t.jsx(R.Play,{}),children:n(l("pages.settings.actions.restart.label"))})}),onClose:c,children:t.jsxs(t.Fragment,{children:[t.jsx(o.Box,{paddingBottom:1,children:n(l("pages.settings.actions.restart.alert.description"))}),i.reasons?.map((u,g)=>t.jsx(o.Box,{paddingBottom:1,children:n(l(`pages.settings.actions.restart.alert.reason.${u}`))},g))]})})}):null},Eo=()=>{const e=_e(),{formatMessage:n}=E.useIntl(),{values:a,onChange:i,handleChange:s,restartStatus:r}=le();return t.jsx(o.Box,{...Ie,width:"100%",children:t.jsxs(o.Flex,{direction:"column",alignItems:"flex-start",gap:2,children:[t.jsx(o.Typography,{variant:"delta",as:"h2",children:n(l("pages.settings.additional.title"))}),t.jsxs(o.Grid.Root,{gap:4,width:"100%",children:[t.jsx(o.Grid.Item,{col:4,s:12,xs:12,children:t.jsx(o.Box,{width:"100%",children:t.jsx(N.Field,{name:"allowedLevels",label:n(l("pages.settings.form.allowedLevels.label")),hint:n(l("pages.settings.form.allowedLevels.hint")),children:t.jsx(o.NumberInput,{width:"100%",name:"allowedLevels",type:"number",placeholder:n(l("pages.settings.form.allowedLevels.placeholder")),onChange:(c,u)=>{if(S.isObject(c)){const g=parseInt(c.target.value);return s(c.target.name,isNaN(g)?0:g,i)}return s(c,u,i)},value:a.allowedLevels,disabled:r.required})})})}),t.jsx(o.Grid.Item,{col:4,s:12,xs:12,children:t.jsx(N.Field,{name:"cascadeMenuAttached",label:n(l("pages.settings.form.cascadeMenuAttached.label")),hint:n(l("pages.settings.form.cascadeMenuAttached.hint")),children:t.jsx(o.Toggle,{width:"100%",name:"cascadeMenuAttached",checked:a.cascadeMenuAttached,onChange:c=>s(c,!a.cascadeMenuAttached,i),onLabel:n(l("components.toggle.enabled")),offLabel:n(l("components.toggle.disabled")),disabled:r.required})})}),t.jsx(o.Grid.Item,{col:4,s:12,xs:12,children:t.jsx(N.Field,{name:"audienceFieldChecked",label:n(l("pages.settings.form.audience.label")),hint:n(l("pages.settings.form.audience.hint")),children:t.jsx(o.Toggle,{name:"audienceFieldChecked",checked:a.audienceFieldChecked,onChange:c=>s(c,!a.audienceFieldChecked,i),onLabel:n(l("components.toggle.enabled")),offLabel:n(l("components.toggle.disabled")),disabled:r.required,width:"100%"})})}),e.data?.isCachePluginEnabled&&t.jsx(o.Grid.Item,{col:12,s:12,xs:12,children:t.jsx(N.Field,{name:"isCacheEnabled",label:n(l("pages.settings.form.cache.label")),hint:n(l("pages.settings.form.cache.hint")),children:t.jsx(o.Toggle,{name:"isCacheEnabled",checked:a.isCacheEnabled,onChange:c=>s(c,!a.isCacheEnabled,i),onLabel:n(l("components.toggle.enabled")),offLabel:n(l("components.toggle.disabled")),disabled:r.required,width:"100%"})})})]})]})})},No=()=>{const{formatMessage:e}=E.useIntl(),{values:n,onChange:a,handleChange:i,restartStatus:s}=le();return t.jsx(o.Grid.Item,{col:4,s:12,xs:12,children:t.jsx(N.Field,{name:"preferCustomContentTypes",label:e(l("pages.settings.form.preferCustomContentTypes.label")),hint:e(l("pages.settings.form.preferCustomContentTypes.hint")),children:t.jsx(o.Toggle,{name:"preferCustomContentTypes",checked:n.preferCustomContentTypes,onChange:r=>i(r,!n.preferCustomContentTypes,a),onLabel:e(l("components.toggle.enabled")),offLabel:e(l("components.toggle.disabled")),disabled:s.required,width:"100%"})})})},Ao=()=>{const e=_e(),n=we(),{formatMessage:a}=E.useIntl(),{values:i,onChange:s,handleChange:r,restartStatus:c,setFormValueItem:u,renderError:g}=le(),{contentTypes:m,preferCustomContentTypes:p}=i,C=S.sortBy(Object.values(n.data??[]).filter(({uid:b})=>bo(b,{allowedContentTypes:e.data?.allowedContentTypes,restrictedContentTypes:e.data?.restrictedContentTypes,preferCustomContentTypes:p,contentTypes:m})).map(b=>{const v=n.data?.find(x=>x.uid===b.uid);if(v){const{isDisplayed:x,kind:y}=v;return{...b,available:x,isSingle:y==="singleType"}}return b}),b=>b.info.displayName);return t.jsx(o.Grid.Item,{col:4,s:12,xs:12,children:t.jsx(N.Field,{name:"contentTypes",label:a(l("pages.settings.form.contentTypes.label")),hint:a(l("pages.settings.form.contentTypes.hint")),children:t.jsx(o.MultiSelect,{name:"contentTypes",label:a(l("pages.settings.form.contentTypes.label")),"aria-label":a(l("pages.settings.form.contentTypes.label")),placeholder:a(l("pages.settings.form.contentTypes.placeholder")),value:i.contentTypes,onChange:b=>{r("contentTypes",b,s);const{contentTypesNameFields:v=[],contentTypesPopulate:x=[],pathDefaultFields:y=[]}=i,I=b.filter(T=>!v.find(L=>L.key===T))??[],f=v.filter(T=>!b.includes(T.key)||T.key==="default").map(({key:T})=>T)??[];u("contentTypesNameFields",[...v.filter(({key:T})=>!f.includes(T)||T==="default")??[],...I.map(T=>({key:T,fields:[]}))]),u("contentTypesPopulate",[...x.filter(({key:T})=>!f.includes(T)||T==="default")??[],...I.map(T=>({key:T,fields:[]}))]),u("pathDefaultFields",[...y.filter(({key:T})=>!f.includes(T)||T==="default")??[],...I.map(T=>({key:T,fields:[]}))])},disabled:c.required,error:g("contentTypes"),withTags:!0,width:"100%",children:C.map(b=>t.jsx(o.MultiSelectOption,{value:b.uid,children:b.info.displayName},b.uid))})})})},Ro=()=>{const e=we(),{formatMessage:n}=E.useIntl(),{values:a,onChange:i,handleChange:s,restartStatus:r,renderError:c}=le(),u=j.useMemo(()=>a.contentTypes?.map(g=>e.data?.find(({uid:m})=>m===g)).filter(g=>g!==void 0)||[],[a.contentTypes,e.data]);return j.useEffect(()=>{a.defaultContentType&&(a.contentTypes.includes(a.defaultContentType)||s("defaultContentType",void 0,i))},[a.contentTypes]),t.jsx(o.Grid.Item,{col:4,s:12,xs:12,children:t.jsx(N.Field,{name:"defaultContentType",label:n(l("pages.settings.form.defaultContentType.label")),hint:n(l("pages.settings.form.defaultContentType.hint")),children:t.jsx(o.SingleSelect,{name:"defaultContentType",label:n(l("pages.settings.form.defaultContentType.label")),"aria-label":n(l("pages.settings.form.defaultContentType.label")),placeholder:n(l("pages.settings.form.defaultContentType.placeholder")),value:a.defaultContentType,onChange:g=>s("defaultContentType",g,i),onClear:()=>s("defaultContentType",void 0,i),disabled:r.required,error:c("defaultContentType"),withTags:!0,width:"100%",children:u.map(g=>t.jsx(o.SingleSelectOption,{value:g.uid,children:g.info.displayName},g.uid))})})})},Lo=["relation","media","component","dynamiczone"],$o=()=>{const e=we(),{formatMessage:n}=E.useIntl(),{values:a,onChange:i,handleChange:s,restartStatus:r,renderError:c}=le(),{contentTypes:u,contentTypesNameFields:g}=a;return t.jsx(o.Grid.Item,{col:12,s:12,xs:12,children:u?.length?t.jsx(o.Accordion.Root,{style:{width:"100%"},children:g.map((m,p)=>{const C=e.data?.find(({uid:y})=>y===m.key),b=C?.attributes??{},v=Object.keys(b).sort(),x=v.filter(y=>Lo.includes(b[y]?.type));return C?t.jsxs(o.Accordion.Item,{value:m.key,children:[t.jsx(o.Accordion.Header,{children:t.jsx(o.Accordion.Trigger,{children:C?.info.displayName??n(l("pages.settings.form.nameField.default"))})}),t.jsx(o.Accordion.Content,{children:t.jsxs(o.Grid.Root,{gap:4,padding:2,children:[t.jsx(o.Grid.Item,{col:12,s:12,xs:12,children:t.jsx(N.Field,{name:`contentTypesNameFields[${p}]`,label:n(l("pages.settings.form.nameField.label")),hint:n(l(`pages.settings.form.nameField.${S.isEmpty(S.get(a,`contentTypesNameFields[${p}].fields`,[]))?"empty":"hint"}`)),children:t.jsx(o.MultiSelect,{name:`contentTypesNameFields[${p}]`,placeholder:n(l("pages.settings.form.nameField.placeholder")),value:S.get(a,`contentTypesNameFields[${p}].fields`),onChange:y=>{const I=S.get(a,"contentTypesNameFields",[]).map((f,T)=>T===p?{...f,fields:y}:f);return s("contentTypesNameFields",I,i)},disabled:r.required,error:c(`contentTypesNameFields[${p}]`),withTags:!0,children:v.map(y=>t.jsx(o.MultiSelectOption,{value:y,children:y},y))})})}),t.jsx(o.Grid.Item,{col:12,s:12,xs:12,children:t.jsx(N.Field,{name:`contentTypesPopulate[${p-1}]`,label:n(l("pages.settings.form.populate.label")),hint:n(l(`pages.settings.form.populate.${S.isEmpty(S.get(a,`contentTypesPopulate[${p-1}]fields`,[]))?"empty":"hint"}`)),children:t.jsx(o.MultiSelect,{width:"100%",name:`contentTypesPopulate[${p-1}]`,placeholder:n(l("pages.settings.form.populate.placeholder")),value:S.get(a,`contentTypesPopulate[${p-1}].fields`,[]),onChange:y=>{const I=S.get(a,"contentTypesPopulate",[]).map((f,T)=>T===p-1?{...f,fields:y}:f);return s("contentTypesPopulate",I,i)},disabled:r.required,error:c(`contentTypesPopulate[${p-1}]`),withTags:!0,children:x.map(y=>t.jsx(o.MultiSelectOption,{value:y,children:y},y))})})}),t.jsx(o.Grid.Item,{col:12,s:12,xs:12,children:t.jsx(N.Field,{name:`pathDefaultFields[${p-1}]`,label:n(l("pages.settings.form.pathDefaultFields.label")),hint:n(l(`pages.settings.form.pathDefaultFields.${S.isEmpty(S.get(a,`pathDefaultFields[${p-1}].fields`,[]))?"empty":"hint"}`)),children:t.jsx(o.MultiSelect,{name:`pathDefaultFields[${p-1}]`,width:"100%",placeholder:n(l("pages.settings.form.pathDefaultFields.placeholder")),value:S.get(a,`pathDefaultFields[${p-1}].fields`,[]),onChange:y=>{const I=S.get(a,"pathDefaultFields",[]).map((f,T)=>T===p-1?{...f,fields:y}:f);return s("pathDefaultFields",I,i)},disabled:r.required,error:c(`pathDefaultFields[${p-1}]`),withTags:!0,children:v.map(y=>t.jsx(o.MultiSelectOption,{value:y,children:y},y))})})})]})})]},m.key):null})}):null})},Mo=()=>{const{formatMessage:e}=E.useIntl();return t.jsx(o.Box,{...Ie,width:"100%",children:t.jsxs(o.Flex,{direction:"column",alignItems:"flex-start",gap:2,children:[t.jsx(o.Typography,{variant:"delta",as:"h2",children:e(l("pages.settings.general.title"))}),t.jsx(o.Grid.Root,{gap:4,width:"100%",children:t.jsx(o.Grid.Item,{col:12,s:12,xs:12,children:t.jsxs(o.Grid.Root,{gap:4,width:"100%",children:[t.jsx(No,{}),t.jsx(Ao,{}),t.jsx(Ro,{}),t.jsx($o,{})]})})})]})})},it=t.jsx(R.PriceTag,{}),Po=t.jsx(R.Plus,{}),H="pages.settings.form.customFields.table.",ko=({data:e=[],onOpenModal:n,onRemoveCustomField:a,onToggleCustomField:i})=>{const[s,r]=j.useState(!1),[c,u]=j.useState(null),{toggleNotification:g}=F.useNotification(),m=j.useMemo(()=>S.sortBy(e,"name"),[e]),{formatMessage:p}=E.useIntl(),C=j.useCallback(x=>{u(x),r(!0)},[u,r]),b=j.useCallback(()=>{u(null),r(!1)},[u,r]),v=j.useCallback(()=>{c===null?g({type:"warning",message:p(l(`${H}confirmation.error`))}):a(c),b()},[b,c,qe,a,g]);return t.jsxs(t.Fragment,{children:[t.jsx(Se,{isVisible:s,header:p(l(`${H}confirmation.header`)),children:p(l(`${H}confirmation.message`)),labelConfirm:p(l(`${H}confirmation.confirm`)),iconConfirm:it,mainIcon:it,onConfirm:v,onCancel:b}),t.jsxs(o.Table,{width:"100%",colCount:4,rowCount:e.length+1,footer:t.jsx(o.TFooter,{onClick:x=>{x.preventDefault(),n(null)},icon:Po,children:p(l(`${H}footer`))}),children:[t.jsx(o.Thead,{children:t.jsxs(o.Tr,{children:[t.jsx(o.Th,{width:"20%",children:t.jsx(o.Typography,{variant:"sigma",textColor:"neutral600",children:p(l(`${H}header.name`))})}),t.jsx(o.Th,{width:"60%",children:t.jsx(o.Typography,{variant:"sigma",textColor:"neutral600",children:p(l(`${H}header.label`))})}),t.jsx(o.Th,{width:"15%",children:t.jsx(o.Typography,{variant:"sigma",textColor:"neutral600",children:p(l(`${H}header.type`))})}),t.jsx(o.Th,{width:"5%",children:t.jsx(o.Typography,{variant:"sigma",textColor:"neutral600",children:p(l(`${H}header.required`))})}),t.jsx(o.Th,{children:t.jsx(o.VisuallyHidden,{})})]})}),t.jsx(o.Tbody,{children:m.map(x=>typeof x!="string"?t.jsxs(o.Tr,{children:[t.jsx(o.Td,{width:"20%",children:t.jsx(o.Typography,{fontWeight:"semiBold",textColor:"neutral800",children:x.name})}),t.jsx(o.Td,{width:"60%",children:t.jsx(o.Typography,{textColor:"neutral800",children:x.label})}),t.jsx(o.Td,{width:"15%",children:t.jsx(o.Typography,{textColor:"neutral800",children:x.type})}),t.jsx(o.Td,{width:"5%",children:t.jsx(o.Tooltip,{description:p(l(`${H}${x.required?"required":"notRequired"}`)),children:t.jsx(o.Typography,{textColor:"neutral800",children:x.required?t.jsx(R.Check,{}):t.jsx(R.Minus,{})})})}),t.jsx(o.Td,{children:t.jsx(o.Flex,{width:"100%",justifyContent:"flex-end",alignItems:"center",children:t.jsxs(o.IconButtonGroup,{children:[t.jsx(o.IconButton,{onClick:()=>i(x),label:p(l(`${H}${x.enabled?"disable":"enable"}`)),variant:x.enabled?"success-light":"tertiary",children:x.enabled?t.jsx(R.Eye,{}):t.jsx(R.EyeStriked,{}),style:{minWidth:50}}),t.jsx(o.IconButton,{onClick:()=>n(x),label:p(l(`${H}edit`)),children:t.jsx(R.Pencil,{}),style:{minWidth:50}}),t.jsx(o.IconButton,{onClick:()=>C(x),label:p(l(`${H}remove`)),children:t.jsx(R.Trash,{}),style:{minWidth:50}})]})})})]},x.name):null)})]})]})},zo=({onChange:e,initialValue:n,...a})=>{const[i,s]=j.useState(S.isArray(n)?n.join(";"):""),r=c=>{const u=c?.target.value??"",g=u.split(";").map(m=>m.trim()).filter(m=>!!m.length);s(u??""),e(g)};return t.jsx(o.TextInput,{...a,onChange:r,value:i})},q="pages.settings.form.customFields.popup.",qo=e=>e.map((n,a)=>({key:`${n}-${a}`,metadatas:{intlLabel:{id:n,defaultMessage:n},hidden:!1,disabled:!1},value:n,label:n})),Bo=({isEditForm:e,customField:n,onSubmit:a,onClose:i})=>{const s=qo(To),{formatMessage:r}=E.useIntl(),[c,u]=j.useState(n?{...n}:{name:"",label:"",type:"string",required:!1,multi:!1,enabled:!0}),[g,m]=j.useState(),{type:p}=c;j.useEffect(()=>{n&&u({...n})},[n]);const C=(y,I,f)=>{if(f){let T=y,L=I;if(S.isObject(y)){const{name:B,value:P}=y.target;T=B,L=S.isNil(L)?P:L}return S.isString(T)&&b(T,L),f(y,L)}},b=(y,I)=>{u(S.set({...c},y,I))},v=y=>{const I=S.get(g,y);if(I)return r(l(`${q}${y}.${I}`))},x=(y,I)=>{const{success:f,data:T,error:L}=ct.safeParse(I);f?a(T):L&&m(L.issues.reduce((B,P)=>({...B,[P.path.join(".")]:P.message}),{}))};return t.jsxs(t.Fragment,{children:[t.jsx(o.Modal.Body,{children:t.jsx(F.Form,{method:"POST",width:"auto",height:"auto",initialValues:c,children:({values:y,onChange:I})=>t.jsxs(o.Grid.Root,{gap:5,children:[t.jsx(o.Grid.Item,{col:12,children:t.jsx(N.Field,{name:"name",label:r(l(`${q}name.label`)),hint:r(l(`${q}name.description`)),error:v("name"),required:!0,children:t.jsx(o.TextInput,{name:"name",value:y.name,onChange:(f,T)=>C(f,T,I),placeholder:r(l(`${q}name.placeholder`)),type:"string",disabled:e,width:"100%"})})},"name"),t.jsx(o.Grid.Item,{col:12,children:t.jsx(N.Field,{name:"label",label:r(l(`${q}label.label`)),hint:r(l(`${q}label.description`)),error:v("label"),required:!0,children:t.jsx(o.TextInput,{name:"label",value:y.label,onChange:(f,T)=>C(f,T,I),placeholder:r(l(`${q}label.placeholder`)),type:"string",width:"100%"})})},"label"),t.jsx(o.Grid.Item,{col:12,children:t.jsx(N.Field,{name:"description",label:r(l(`${q}description.label`)),hint:r(l(`${q}description.description`)),error:v("description"),children:t.jsx(o.TextInput,{name:"description",value:y.description,onChange:(f,T)=>C(f,T,I),placeholder:r(l(`${q}description.placeholder`)),type:"string",width:"100%"})})},"description"),t.jsx(o.Grid.Item,{col:12,children:t.jsx(N.Field,{name:"placeholder",label:r(l(`${q}placeholder.label`)),hint:r(l(`${q}placeholder.description`)),error:v("placeholder"),children:t.jsx(o.TextInput,{name:"placeholder",value:y.placeholder,onChange:(f,T)=>C(f,T,I),placeholder:r(l(`${q}placeholder.placeholder`)),type:"string",width:"100%"})})},"placeholder"),t.jsx(o.Grid.Item,{col:12,children:t.jsx(N.Field,{name:"type",label:r(l(`${q}type.label`)),hint:r(l(`${q}type.description`)),required:!0,children:t.jsx(o.SingleSelect,{name:"type",value:y.type,onChange:f=>C("type",f,I),disabled:e,width:"100%",children:s.map(({key:f,label:T,value:L})=>t.jsx(o.SingleSelectOption,{value:L,children:T},f))})})},"type"),p==="select"&&t.jsxs(t.Fragment,{children:[t.jsx(o.Grid.Item,{col:12,children:t.jsx(N.Field,{name:"multi",label:r(l(`${q}multi.label`)),hint:r(l(`${q}multi.description`)),error:v("multi"),children:t.jsx(o.Toggle,{name:"multi",checked:y.multi,onChange:f=>C(f,!y.multi,I),onLabel:"true",offLabel:"false",width:"100%"})})},"multi"),t.jsx(o.Grid.Item,{col:12,children:t.jsx(N.Field,{name:"options",label:r(l(`${q}options.label`)),hint:r(l(`${q}options.description`)),error:v("options"),children:t.jsx(zo,{name:"options",onChange:f=>C("options",f,I),initialValue:y.options})})},"options")]}),t.jsx(o.Grid.Item,{col:12,children:t.jsx(N.Field,{name:"required",label:r(l(`${q}required.label`)),hint:r(l(`${q}required.description`)),error:v("required"),children:t.jsx(o.Toggle,{name:"required",placeholder:r(l(`${q}required.placeholder`)),checked:y.required,onChange:f=>C(f,!y.required,I),onLabel:"true",offLabel:"false",width:"100%"})})},"required")]})})}),t.jsxs(o.Modal.Footer,{children:[t.jsx(o.Modal.Close,{children:t.jsx(o.Button,{onClick:i,variant:"tertiary",children:r(l("popup.item.form.button.cancel"))})}),t.jsx(o.Button,{onClick:y=>x(y,c),children:r(l("popup.item.form.button.save"))})]})]})},Do=({isOpen:e,onClose:n,onSubmit:a,data:i})=>{const s=!!i,{formatMessage:r}=E.useIntl();return t.jsx(o.Modal.Root,{onOpenChange:c=>{c||n()},open:e,labelledBy:"custom-field-modal",children:t.jsxs(o.Modal.Content,{children:[t.jsx(o.Modal.Header,{children:t.jsx(o.Typography,{variant:"omega",fontWeight:"bold",textColor:"neutral800",as:"h2",id:"asset-dialog-title",children:r(l(`pages.settings.form.customFields.popup.header.${s?"edit":"new"}`))})}),t.jsx(Bo,{isEditForm:s,customField:i,onSubmit:a,onClose:n})]})})},Oo=()=>{const{formatMessage:e}=E.useIntl(),{values:{additionalFields:n},setFormValueItem:a}=le(),[i,s]=j.useState(!1),[r,c]=j.useState(null),u=C=>{c(C),s(!0)},g=C=>{const b=n.filter(v=>typeof v!="string"?v.name!==C.name:!0);a("additionalFields",b),c(null),s(!1)},m=C=>{const b={...C,enabled:!C.enabled},v=n.map(x=>typeof x!="string"&&C.name===x.name?b:x);a("additionalFields",v)},p=C=>{const v=!!n.find(x=>typeof x!="string"?x.name===C.name:!1)?n.map(x=>typeof x!="string"&&C.name===x.name?C:x):[...n,C];a("additionalFields",v),c(null),s(!1)};return t.jsxs(o.Box,{...Ie,width:"100%",children:[t.jsx(o.Typography,{variant:"delta",as:"h2",children:e(l("pages.settings.customFields.title"))}),t.jsx(o.Box,{padding:1}),t.jsx(ko,{data:n,onOpenModal:u,onRemoveCustomField:g,onToggleCustomField:m}),i&&t.jsx(Do,{onClose:()=>s(!1),onSubmit:p,isOpen:i,data:r})]})},Go=Kt.omit({contentTypesNameFields:!0}).extend({audienceFieldChecked:h.z.boolean(),contentTypesNameFields:h.z.object({key:h.z.string(),fields:h.z.string().array()}).array(),contentTypesPopulate:h.z.object({key:h.z.string(),fields:h.z.string().array()}).array(),pathDefaultFields:h.z.object({key:h.z.string(),fields:h.z.string().array()}).array()}),st=new $.QueryClient,Vo=()=>{const e=_e(),n=we(),a=Co(),i=Ft(),s=St(),{formatMessage:r}=E.useIntl(),[c,u]=j.useState({required:!1}),[g,m]=j.useState(!1),p=F.useAuth("SettingsPage",w=>w.permissions),C=j.useMemo(()=>!!p.find(({action:w})=>w===ue.settings[0].action),[p]),b=j.useMemo(()=>!!p.find(({action:w})=>w===ue.access[0].action),[p]),v=e.isPending||n.isPending||a.isPending||s.isPending||i.isPending,[x,y]=j.useState({}),[I,f]=j.useState(),T=(w,M,D)=>{if(D){let Z=w,O=M;if(S.isObject(w)){const{name:J,value:ae}=w.target;Z=J,O=S.isNil(O)?ae:O}return S.isString(Z)&&L(Z,O),D(w,O)}},L=(w,M)=>{y(D=>S.set({...D},w,M))},B=w=>{if(S.get(I,w))return r(l(w))},P=(w,M)=>{const{success:D,data:Z,error:O}=Go.safeParse(M);D?a.mutate(Z,{onSuccess(){u({required:!0}),a.reset()}}):O&&(f(O.issues.reduce((J,ae)=>({...J,[ae.path.join(".")]:ae.message}),{})),console.warn("Invalid form data",O))};return vo({config:e.data,setFormValue:y}),C?v||g?t.jsx(F.Page.Loading,{}):t.jsx(F.Layouts.Root,{children:t.jsxs(F.Page.Main,{children:[t.jsx(F.Page.Title,{children:r(l("pages.settings.header.title"))}),t.jsx(F.Layouts.Header,{title:r(l("pages.settings.header.title")),subtitle:r(l("pages.settings.header.description")),primaryAction:b?t.jsx(o.Button,{startIcon:t.jsx(R.Check,{}),disabled:c.required,onClick:w=>P(w,x),children:r(l("pages.settings.actions.submit"))}):null}),t.jsx(F.Layouts.Content,{children:t.jsx(F.Form,{method:"POST",width:"auto",height:"auto",initialValues:x,children:({values:w,onChange:M})=>t.jsx(wt.Provider,{value:{values:w,onChange:M,handleChange:T,restartStatus:c,setRestartStatus:u,renderError:B,setFormValueItem:L},children:t.jsxs(o.Flex,{direction:"column",gap:4,children:[t.jsx(wo,{setIsReloading:m}),t.jsx(Mo,{}),t.jsx(Eo,{}),t.jsx(Oo,{}),t.jsx(So,{hasSettingsReadPermissions:b})]})})})})]})}):t.jsx(F.Page.NoPermissions,{})};function Qo(){st.invalidateQueries();const e=N.usePluginTheme();return t.jsx($.QueryClientProvider,{client:st,children:t.jsx(o.DesignSystemProvider,{theme:e,children:t.jsx(Vo,{})})})}const _o="navigation",rt="Navigation",Uo={register(e){e.createSettingSection({id:ee,intlLabel:{id:`${ee}.plugin.section.name`,defaultMessage:`${rt} plugin`}},[{intlLabel:{id:`${ee}.plugin.section.item`,defaultMessage:"Configuration"},id:"navigation",to:ee,Component(){return Qo},permissions:ue.settings}]),e.addMenuLink({to:`plugins/${ee}`,icon:Gt,intlLabel:{id:`${ee}.plugin.name`,defaultMessage:rt},Component(){return yo},permissions:ue.access,position:1}),e.registerPlugin({id:ee,initializer:qt,isReady:!1,name:_o})},registerTrads:async function({locales:e=[]}){return Promise.all(e.map(async n=>n in We?We[n]().then(({default:i})=>({data:N.prefixPluginTranslations(N.flattenObject(i),ee),locale:n})):{data:N.prefixPluginTranslations(N.flattenObject({}),ee),locale:n}))}};module.exports=Uo;
|
package/dist/admin/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import On, { useRef as We, useEffect as V, useCallback as
|
|
1
|
+
import On, { useRef as We, useEffect as V, useCallback as $, useState as N, useMemo as X, createContext as nn, useContext as an } from "react";
|
|
2
2
|
import { jsx as n, jsxs as w, Fragment as ie } from "react/jsx-runtime";
|
|
3
3
|
import oe, { useTheme as zn } from "styled-components";
|
|
4
4
|
import { getFetchClient as j, useRBAC as _n, useMediaQuery as Mt, useIsMobile as on, useIsTablet as Qn, useIsDesktop as Un, Form as at, useNotification as Oe, Layouts as qe, useStrapiApp as Kn, Page as Te, useAuth as Wn } from "@strapi/strapi/admin";
|
|
@@ -9,10 +9,10 @@ import { useQuery as xe, useMutation as ge, useQueryClient as be, QueryClient as
|
|
|
9
9
|
import { once as Yn, isEmpty as Y, capitalize as sn, get as J, first as vt, orderBy as ea, isObject as He, isNil as Be, isString as ot, set as it, sortBy as Xe, isNumber as qt, isBoolean as ta, isNull as na, isArray as aa } from "lodash";
|
|
10
10
|
import { useIntl as A } from "react-intl";
|
|
11
11
|
import { Dialog as Qe, Flex as P, Typography as x, Button as K, Modal as H, Grid as S, TextInput as we, Toggle as me, Box as D, Table as dn, Thead as cn, Tr as et, Th as ce, Checkbox as Dt, IconButton as ye, Tbody as un, Td as ue, Loader as bt, Tag as oa, Field as Vt, SingleSelect as Fe, SingleSelectOption as Ae, Badge as ia, CardTitle as ra, IconButtonGroup as pn, Card as la, CardBody as jt, Divider as tt, TextButton as sa, Link as da, MultiSelect as De, MultiSelectOption as Ve, Textarea as ca, Combobox as mn, ComboboxOption as ua, Searchbar as pa, DesignSystemProvider as gn, Alert as ma, NumberInput as ga, Accordion as Ue, VisuallyHidden as ha, Tooltip as fa, TFooter as ya } from "@strapi/design-system";
|
|
12
|
-
import { Check as Ge, WarningCircle as ba, Feather as Ia, Pencil as Ct, Trash as Tt, Information as va, CaretDown as Ca, CaretUp as Ta, Drag as wa, Eye as hn, ArrowClockwise as Sa, Earth as Fa, Cog as Aa, Link as xa, Plus as wt, ArrowRight as Na, Search as Ra, ListPlus as
|
|
12
|
+
import { Check as Ge, WarningCircle as ba, Feather as Ia, Pencil as Ct, Trash as Tt, Information as va, CaretDown as Ca, CaretUp as Ta, Drag as wa, Eye as hn, ArrowClockwise as Sa, Earth as Fa, Cog as Aa, Link as xa, Plus as wt, ArrowRight as Na, Search as Ra, ListPlus as Ea, Typhoon as La, Play as $a, Minus as Pa, EyeStriked as Ma, PriceTag as ka } from "@strapi/icons";
|
|
13
13
|
import * as s from "zod";
|
|
14
14
|
import { z as g } from "zod";
|
|
15
|
-
import { usePluginTheme as St, Field as
|
|
15
|
+
import { usePluginTheme as St, Field as L, prefixPluginTranslations as Bt, flattenObject as Ot } from "@sensinum/strapi-utils";
|
|
16
16
|
import { prop as nt } from "lodash/fp";
|
|
17
17
|
const de = "navigation", qa = ({ setPlugin: e }) => {
|
|
18
18
|
const t = We(e);
|
|
@@ -509,7 +509,7 @@ const fo = s.object({
|
|
|
509
509
|
});
|
|
510
510
|
}, Fo = () => {
|
|
511
511
|
const e = be(), t = j(), a = B(t);
|
|
512
|
-
return
|
|
512
|
+
return $(() => {
|
|
513
513
|
e.invalidateQueries({
|
|
514
514
|
queryKey: a.getIndexPrefix()
|
|
515
515
|
});
|
|
@@ -575,7 +575,7 @@ const fo = s.object({
|
|
|
575
575
|
queryKey: t.readConfigIndex(),
|
|
576
576
|
queryFn: t.readConfig
|
|
577
577
|
});
|
|
578
|
-
},
|
|
578
|
+
}, Eo = /* @__PURE__ */ n(ba, {}), lt = ({
|
|
579
579
|
isVisible: e = !1,
|
|
580
580
|
isActionAsync: t = !1,
|
|
581
581
|
children: a,
|
|
@@ -585,7 +585,7 @@ const fo = s.object({
|
|
|
585
585
|
labelCancel: d,
|
|
586
586
|
labelConfirm: c,
|
|
587
587
|
iconConfirm: m,
|
|
588
|
-
mainIcon: p =
|
|
588
|
+
mainIcon: p = Eo
|
|
589
589
|
}) => {
|
|
590
590
|
const { formatMessage: u } = A();
|
|
591
591
|
return e ? /* @__PURE__ */ n(
|
|
@@ -615,7 +615,7 @@ const fo = s.object({
|
|
|
615
615
|
] })
|
|
616
616
|
}
|
|
617
617
|
) : null;
|
|
618
|
-
}, Ut = /* @__PURE__ */ n(ie, {}),
|
|
618
|
+
}, Ut = /* @__PURE__ */ n(ie, {}), Lo = ({ onConfirm: e, onCancel: t }) => {
|
|
619
619
|
const { formatMessage: a } = A();
|
|
620
620
|
return /* @__PURE__ */ n(
|
|
621
621
|
lt,
|
|
@@ -630,13 +630,13 @@ const fo = s.object({
|
|
|
630
630
|
children: a(l("pages.view.actions.i18nCopyItems.confirmation.content"))
|
|
631
631
|
}
|
|
632
632
|
);
|
|
633
|
-
},
|
|
634
|
-
const [t, a] = N(!1), [o, i] = N(void 0), r =
|
|
633
|
+
}, $o = (e) => {
|
|
634
|
+
const [t, a] = N(!1), [o, i] = N(void 0), r = $(() => {
|
|
635
635
|
a(!1);
|
|
636
|
-
}, [a]), d =
|
|
636
|
+
}, [a]), d = $(() => {
|
|
637
637
|
o && (e(o), a(!1));
|
|
638
638
|
}, [e, o]), c = X(
|
|
639
|
-
() => t ? /* @__PURE__ */ n(
|
|
639
|
+
() => t ? /* @__PURE__ */ n(Lo, { onConfirm: d, onCancel: r }) : null,
|
|
640
640
|
[t, d, r]
|
|
641
641
|
);
|
|
642
642
|
return X(
|
|
@@ -689,14 +689,14 @@ const fo = s.object({
|
|
|
689
689
|
availableLocales: m
|
|
690
690
|
};
|
|
691
691
|
}, qo = (e) => {
|
|
692
|
-
const [t, a] = N(), [o, i] = N(!1), r =
|
|
692
|
+
const [t, a] = N(), [o, i] = N(!1), r = $(
|
|
693
693
|
(p, u = {}) => {
|
|
694
694
|
a(u), i(p);
|
|
695
695
|
},
|
|
696
696
|
[i]
|
|
697
|
-
), d =
|
|
697
|
+
), d = $(() => {
|
|
698
698
|
r(!1);
|
|
699
|
-
}, [r]), c =
|
|
699
|
+
}, [r]), c = $(
|
|
700
700
|
(p, u, v = !0, b = "", C = !0, y = "0", f = 0) => {
|
|
701
701
|
e && (p.preventDefault(), p.stopPropagation(), r(!0, {
|
|
702
702
|
viewParentId: u,
|
|
@@ -709,7 +709,7 @@ const fo = s.object({
|
|
|
709
709
|
}));
|
|
710
710
|
},
|
|
711
711
|
[r, e]
|
|
712
|
-
), m =
|
|
712
|
+
), m = $(
|
|
713
713
|
({
|
|
714
714
|
item: p,
|
|
715
715
|
levelPath: u = "",
|
|
@@ -759,15 +759,15 @@ const fo = s.object({
|
|
|
759
759
|
read: "read",
|
|
760
760
|
update: "update",
|
|
761
761
|
settings: "settings"
|
|
762
|
-
},
|
|
762
|
+
}, Le = {
|
|
763
763
|
access: [{ action: mt(gt.read), subject: null }],
|
|
764
764
|
update: [{ action: mt(gt.update), subject: null }],
|
|
765
765
|
settings: [{ action: mt(gt.settings), subject: null }]
|
|
766
766
|
}, Vo = () => {
|
|
767
767
|
const e = X(
|
|
768
768
|
() => ({
|
|
769
|
-
access:
|
|
770
|
-
update:
|
|
769
|
+
access: Le.access || Le.update,
|
|
770
|
+
update: Le.update
|
|
771
771
|
}),
|
|
772
772
|
[]
|
|
773
773
|
), {
|
|
@@ -999,8 +999,8 @@ const fo = s.object({
|
|
|
999
999
|
if (I) {
|
|
1000
1000
|
let h = y, T = f;
|
|
1001
1001
|
if (He(y)) {
|
|
1002
|
-
const { name:
|
|
1003
|
-
h =
|
|
1002
|
+
const { name: E, value: z } = y.target;
|
|
1003
|
+
h = E, T = Be(T) ? z : T;
|
|
1004
1004
|
}
|
|
1005
1005
|
return ot(h) && b(h, T), I(y, T);
|
|
1006
1006
|
}
|
|
@@ -1047,7 +1047,7 @@ const fo = s.object({
|
|
|
1047
1047
|
}
|
|
1048
1048
|
}, [p, u]), /* @__PURE__ */ n(at, { width: "auto", height: "auto", method: "POST", initialValues: i, children: ({ values: y, onChange: f }) => /* @__PURE__ */ w(S.Root, { gap: 5, children: [
|
|
1049
1049
|
/* @__PURE__ */ n(S.Item, { m: 6, xs: 12, children: /* @__PURE__ */ n(
|
|
1050
|
-
|
|
1050
|
+
L,
|
|
1051
1051
|
{
|
|
1052
1052
|
name: "name",
|
|
1053
1053
|
label: m(l("popup.navigation.form.name.label", "Name")),
|
|
@@ -1068,7 +1068,7 @@ const fo = s.object({
|
|
|
1068
1068
|
}
|
|
1069
1069
|
) }),
|
|
1070
1070
|
/* @__PURE__ */ n(S.Item, { m: 6, xs: 12, children: /* @__PURE__ */ n(
|
|
1071
|
-
|
|
1071
|
+
L,
|
|
1072
1072
|
{
|
|
1073
1073
|
name: "visible",
|
|
1074
1074
|
label: m(l("popup.navigation.form.visible.label", "Visibility")),
|
|
@@ -1093,7 +1093,7 @@ const fo = s.object({
|
|
|
1093
1093
|
items: [],
|
|
1094
1094
|
visible: !1
|
|
1095
1095
|
}, zo = ({ setState: e, current: t, isLoading: a, alreadyUsedNames: o }) => {
|
|
1096
|
-
const i =
|
|
1096
|
+
const i = $(
|
|
1097
1097
|
({ disabled: r, ...d }) => {
|
|
1098
1098
|
e({
|
|
1099
1099
|
view: "CREATE",
|
|
@@ -1133,7 +1133,7 @@ const fo = s.object({
|
|
|
1133
1133
|
}
|
|
1134
1134
|
);
|
|
1135
1135
|
}, Qo = /* @__PURE__ */ n(Ct, {}), Uo = /* @__PURE__ */ n(Tt, {}), Wt = /* @__PURE__ */ n(Ia, {}), Ko = ({ navigations: e, selected: t, setState: a }) => {
|
|
1136
|
-
const o = ne(), i = !!t.length, { formatMessage: r } = A(), d = xt(), c =
|
|
1136
|
+
const o = ne(), i = !!t.length, { formatMessage: r } = A(), d = xt(), c = $(
|
|
1137
1137
|
() => a({
|
|
1138
1138
|
navigations: e,
|
|
1139
1139
|
selected: i ? [] : e.map((I) => I),
|
|
@@ -1166,7 +1166,7 @@ const fo = s.object({
|
|
|
1166
1166
|
view: "CACHE_PURGE",
|
|
1167
1167
|
navigations: I
|
|
1168
1168
|
});
|
|
1169
|
-
}, C =
|
|
1169
|
+
}, C = $(v(t), [v]), y = $(b(t), [b]), f = (I) => [I].concat(
|
|
1170
1170
|
e.filter(
|
|
1171
1171
|
(h) => h.documentId === I.documentId && h.locale !== I.locale
|
|
1172
1172
|
)
|
|
@@ -1326,7 +1326,7 @@ const fo = s.object({
|
|
|
1326
1326
|
navigation: o,
|
|
1327
1327
|
setState: i
|
|
1328
1328
|
}) => {
|
|
1329
|
-
const r = X(() => t ?? o, [t]), d =
|
|
1329
|
+
const r = X(() => t ?? o, [t]), d = $(
|
|
1330
1330
|
({ disabled: c, ...m }) => {
|
|
1331
1331
|
i({
|
|
1332
1332
|
view: "EDIT",
|
|
@@ -1402,7 +1402,7 @@ const fo = s.object({
|
|
|
1402
1402
|
u,
|
|
1403
1403
|
v,
|
|
1404
1404
|
C
|
|
1405
|
-
]), I =
|
|
1405
|
+
]), I = $(() => r({ view: "INITIAL" }), [r]), h = $(async () => {
|
|
1406
1406
|
const k = i.view === "DELETE" ? () => {
|
|
1407
1407
|
m.mutate(
|
|
1408
1408
|
i.navigations.reduce((F, M) => (M.documentId && F.push(M.documentId), F), []),
|
|
@@ -1480,7 +1480,7 @@ const fo = s.object({
|
|
|
1480
1480
|
selected: []
|
|
1481
1481
|
});
|
|
1482
1482
|
}, [i.view, y]);
|
|
1483
|
-
const T = ii(i, o, !!f),
|
|
1483
|
+
const T = ii(i, o, !!f), E = ri(i, r, !!f), z = li({
|
|
1484
1484
|
state: i,
|
|
1485
1485
|
setState: r,
|
|
1486
1486
|
onClose: a,
|
|
@@ -1499,7 +1499,7 @@ const fo = s.object({
|
|
|
1499
1499
|
open: t,
|
|
1500
1500
|
children: /* @__PURE__ */ w(H.Content, { children: [
|
|
1501
1501
|
/* @__PURE__ */ n(H.Header, { children: /* @__PURE__ */ n(x, { variant: "omega", fontWeight: "bold", textColor: "neutral800", as: "h2", children: T }) }),
|
|
1502
|
-
/* @__PURE__ */ n(H.Body, { children:
|
|
1502
|
+
/* @__PURE__ */ n(H.Body, { children: E }),
|
|
1503
1503
|
z
|
|
1504
1504
|
] })
|
|
1505
1505
|
}
|
|
@@ -1570,7 +1570,7 @@ const fo = s.object({
|
|
|
1570
1570
|
return Rt(e.state);
|
|
1571
1571
|
}
|
|
1572
1572
|
}, Rt = (e) => (console.warn(`Unknown state "${e?.view}". (${JSON.stringify(e)})`), null), si = () => {
|
|
1573
|
-
const [e, t] = N(!1), a =
|
|
1573
|
+
const [e, t] = N(!1), a = $(() => t(!0), [t]), o = $(() => t(!1), [t]), i = X(
|
|
1574
1574
|
() => e ? /* @__PURE__ */ n(oi, { initialState: { view: "INITIAL" }, isOpened: !0, onClose: o }) : null,
|
|
1575
1575
|
[e, o]
|
|
1576
1576
|
);
|
|
@@ -1606,7 +1606,7 @@ const fo = s.object({
|
|
|
1606
1606
|
locale: u,
|
|
1607
1607
|
currentLocale: v
|
|
1608
1608
|
}) => {
|
|
1609
|
-
const { formatMessage: b } = A(), { openNavigationManagerModal: C, navigationManagerModal: y } = si(), f = ne(), I = !!u.restLocale?.length, h = f.data?.isCacheEnabled, { canUpdate: T } = p, { isDesktop:
|
|
1609
|
+
const { formatMessage: b } = A(), { openNavigationManagerModal: C, navigationManagerModal: y } = si(), f = ne(), I = !!u.restLocale?.length, h = f.data?.isCacheEnabled, { canUpdate: T } = p, { isDesktop: E, isMobile: z, isLargeDesktop: k } = Ze();
|
|
1610
1610
|
return /* @__PURE__ */ n(ie, { children: /* @__PURE__ */ n(
|
|
1611
1611
|
qe.Header,
|
|
1612
1612
|
{
|
|
@@ -1714,7 +1714,7 @@ const fo = s.object({
|
|
|
1714
1714
|
}
|
|
1715
1715
|
),
|
|
1716
1716
|
h && /* @__PURE__ */ w(ie, { children: [
|
|
1717
|
-
|
|
1717
|
+
E && /* @__PURE__ */ n(Me, { m: 9, orderInitial: 5, orderSmall: 5, orderMedium: 5 }),
|
|
1718
1718
|
/* @__PURE__ */ n(Me, { m: 3, xs: 4, orderInitial: 6, orderSmall: 6, orderMedium: 6, children: /* @__PURE__ */ n(
|
|
1719
1719
|
K,
|
|
1720
1720
|
{
|
|
@@ -2037,7 +2037,7 @@ const fo = s.object({
|
|
|
2037
2037
|
viewParentId: f,
|
|
2038
2038
|
locale: I
|
|
2039
2039
|
}) => {
|
|
2040
|
-
const h = Se(e, !0), { formatMessage: T } = A(),
|
|
2040
|
+
const h = Se(e, !0), { formatMessage: T } = A(), E = ne(), z = on(), k = h.type === "EXTERNAL", F = h.type === "WRAPPER", M = qt(E.data?.allowedLevels) ? a < E.data.allowedLevels - 1 : !0, _ = qt(E.data?.allowedLevels) ? a < E.data.allowedLevels : !0, re = !Y(e.items) && !b, Q = k ? void 0 : `${o === "/" ? "" : o}/${h.path === "/" ? "" : h.path}`.replace(
|
|
2041
2041
|
"//",
|
|
2042
2042
|
"/"
|
|
2043
2043
|
), le = vn({
|
|
@@ -2047,13 +2047,13 @@ const fo = s.object({
|
|
|
2047
2047
|
(W) => h.type === "INTERNAL" ? W.uid === h.relatedType : !1
|
|
2048
2048
|
), _e = ee?.uid.includes("api::"), pe = le.data?.find(
|
|
2049
2049
|
(W) => h.type === "INTERNAL" ? W.documentId === h.related : !1
|
|
2050
|
-
) ?? { documentId: "", id: 0 }, Re = !!pe?.publishedAt, G = k ? "" : st(pe,
|
|
2050
|
+
) ?? { documentId: "", id: 0 }, Re = !!pe?.publishedAt, G = k ? "" : st(pe, E.data), R = ee?.info.displayName ?? "", Z = Re ? "success" : "secondary", se = C.canUpdate, U = We(null), Ee = We(null), Ie = We(null), [, ve] = Hn({
|
|
2051
2051
|
accept: `navigation-item_${o}`,
|
|
2052
2052
|
hover(W, Ce) {
|
|
2053
2053
|
const te = W.order ?? 0, Pe = e.order ?? 0;
|
|
2054
2054
|
if (te === Pe)
|
|
2055
2055
|
return;
|
|
2056
|
-
const ct =
|
|
2056
|
+
const ct = Ee.current.getBoundingClientRect(), ut = (ct.bottom - ct.top) / 2, Pt = Ce.getClientOffset();
|
|
2057
2057
|
if (!Pt)
|
|
2058
2058
|
return;
|
|
2059
2059
|
const pt = Pt.y - ct.top, Bn = pt > ut ? (e.order ?? 0) + 0.5 : (e.order ?? 0) - 0.5;
|
|
@@ -2071,14 +2071,14 @@ const fo = s.object({
|
|
|
2071
2071
|
collect: (W) => ({
|
|
2072
2072
|
isDragging: W.isDragging()
|
|
2073
2073
|
})
|
|
2074
|
-
}),
|
|
2074
|
+
}), $e = {
|
|
2075
2075
|
dragRef: kn(U),
|
|
2076
|
-
dropRef: ve(
|
|
2076
|
+
dropRef: ve(Ee),
|
|
2077
2077
|
previewRef: qn(Ie)
|
|
2078
2078
|
}, Dn = (W) => {
|
|
2079
2079
|
const Ce = ee?.kind === "singleType", te = W?.locale ? `?plugins[i18n][locale]=${W?.locale}` : "";
|
|
2080
2080
|
return `/admin/content-manager/${Ce ? "single-types" : "collection-types"}/${ee?.uid}${Ce ? "" : "/" + W?.documentId}${te}`;
|
|
2081
|
-
}, Vn =
|
|
2081
|
+
}, Vn = $(
|
|
2082
2082
|
(W) => {
|
|
2083
2083
|
if (!se)
|
|
2084
2084
|
return;
|
|
@@ -2104,12 +2104,12 @@ const fo = s.object({
|
|
|
2104
2104
|
]
|
|
2105
2105
|
);
|
|
2106
2106
|
V(() => {
|
|
2107
|
-
h.isSearchActive &&
|
|
2107
|
+
h.isSearchActive && $e.dropRef?.current?.scrollIntoView?.({
|
|
2108
2108
|
behavior: "smooth",
|
|
2109
2109
|
block: "center",
|
|
2110
2110
|
inline: "center"
|
|
2111
2111
|
});
|
|
2112
|
-
}, [h.isSearchActive,
|
|
2112
|
+
}, [h.isSearchActive, $e.dropRef.current]);
|
|
2113
2113
|
const jn = To({
|
|
2114
2114
|
uid: h.type === "INTERNAL" ? h.relatedType ?? "" : "",
|
|
2115
2115
|
locale: I
|
|
@@ -2117,14 +2117,14 @@ const fo = s.object({
|
|
|
2117
2117
|
V(() => {
|
|
2118
2118
|
jn();
|
|
2119
2119
|
}, []);
|
|
2120
|
-
const
|
|
2120
|
+
const $t = zn();
|
|
2121
2121
|
return /* @__PURE__ */ w(
|
|
2122
2122
|
Fi,
|
|
2123
2123
|
{
|
|
2124
2124
|
level: a,
|
|
2125
2125
|
isLast: t,
|
|
2126
2126
|
style: { opacity: Mn ? 0.2 : 1 },
|
|
2127
|
-
ref:
|
|
2127
|
+
ref: $e ? $e.dropRef : void 0,
|
|
2128
2128
|
children: [
|
|
2129
2129
|
/* @__PURE__ */ w(
|
|
2130
2130
|
la,
|
|
@@ -2134,13 +2134,13 @@ const fo = s.object({
|
|
|
2134
2134
|
zIndex: 1,
|
|
2135
2135
|
position: "relative",
|
|
2136
2136
|
overflow: "hidden",
|
|
2137
|
-
backgroundColor: h.isSearchActive ?
|
|
2138
|
-
borderColor: h.isSearchActive ?
|
|
2137
|
+
backgroundColor: h.isSearchActive ? $t.colors.secondary100 : void 0,
|
|
2138
|
+
borderColor: h.isSearchActive ? $t.colors.secondary200 : void 0,
|
|
2139
2139
|
transition: "background-color 0.3s ease-in"
|
|
2140
2140
|
},
|
|
2141
2141
|
children: [
|
|
2142
2142
|
h.removed && /* @__PURE__ */ n(Si, {}),
|
|
2143
|
-
/* @__PURE__ */ w("div", { ref:
|
|
2143
|
+
/* @__PURE__ */ w("div", { ref: $e.previewRef, children: [
|
|
2144
2144
|
/* @__PURE__ */ n(jt, { children: /* @__PURE__ */ n(
|
|
2145
2145
|
wi,
|
|
2146
2146
|
{
|
|
@@ -2196,7 +2196,7 @@ const fo = s.object({
|
|
|
2196
2196
|
});
|
|
2197
2197
|
},
|
|
2198
2198
|
onItemRestore: () => c({ ...e, viewParentId: f }),
|
|
2199
|
-
dragRef:
|
|
2199
|
+
dragRef: $e.dragRef,
|
|
2200
2200
|
removed: h.removed,
|
|
2201
2201
|
canUpdate: se,
|
|
2202
2202
|
isSearchActive: h.isSearchActive
|
|
@@ -2447,7 +2447,7 @@ const fo = s.object({
|
|
|
2447
2447
|
/^#.*/,
|
|
2448
2448
|
/(https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|www\.[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9]+\.[^\s]{2,}|www\.[a-zA-Z0-9]+\.[^\s]{2,})/,
|
|
2449
2449
|
/(\/[a-z0-9\-._~%!$&'()*+,;=:@]+)+\/?/
|
|
2450
|
-
],
|
|
2450
|
+
], Et = ({ additionalFields: e }) => g.object({
|
|
2451
2451
|
title: g.string(),
|
|
2452
2452
|
autoSync: g.boolean().optional(),
|
|
2453
2453
|
removed: g.boolean().optional(),
|
|
@@ -2487,10 +2487,10 @@ const fo = s.object({
|
|
|
2487
2487
|
return t;
|
|
2488
2488
|
}, {})
|
|
2489
2489
|
)
|
|
2490
|
-
}),
|
|
2490
|
+
}), Ei = ({
|
|
2491
2491
|
additionalFields: e,
|
|
2492
2492
|
isSingleSelected: t
|
|
2493
|
-
}) =>
|
|
2493
|
+
}) => Et({
|
|
2494
2494
|
additionalFields: e
|
|
2495
2495
|
}).extend({
|
|
2496
2496
|
type: g.literal("INTERNAL"),
|
|
@@ -2498,10 +2498,10 @@ const fo = s.object({
|
|
|
2498
2498
|
externalPath: g.string().nullish(),
|
|
2499
2499
|
relatedType: g.string(),
|
|
2500
2500
|
related: t ? g.string().optional() : g.string()
|
|
2501
|
-
}),
|
|
2501
|
+
}), Li = ({
|
|
2502
2502
|
isSingleSelected: e,
|
|
2503
2503
|
additionalFields: t
|
|
2504
|
-
}) =>
|
|
2504
|
+
}) => Et({
|
|
2505
2505
|
additionalFields: t
|
|
2506
2506
|
}).extend({
|
|
2507
2507
|
type: g.literal("EXTERNAL"),
|
|
@@ -2509,18 +2509,18 @@ const fo = s.object({
|
|
|
2509
2509
|
externalPath: g.string().min(1).refine((a) => Ri.some((o) => o.test(a))),
|
|
2510
2510
|
relatedType: g.string().optional(),
|
|
2511
2511
|
related: g.string().optional()
|
|
2512
|
-
}),
|
|
2512
|
+
}), $i = ({
|
|
2513
2513
|
isSingleSelected: e,
|
|
2514
2514
|
additionalFields: t
|
|
2515
|
-
}) =>
|
|
2515
|
+
}) => Et({
|
|
2516
2516
|
additionalFields: t
|
|
2517
2517
|
}).extend({
|
|
2518
2518
|
type: g.literal("WRAPPER"),
|
|
2519
2519
|
path: g.string().or(g.null()).optional()
|
|
2520
2520
|
}), Pi = (e) => g.discriminatedUnion("type", [
|
|
2521
|
+
Li(e),
|
|
2521
2522
|
Ei(e),
|
|
2522
|
-
$i(e)
|
|
2523
|
-
Li(e)
|
|
2523
|
+
$i(e)
|
|
2524
2524
|
]), Gt = {
|
|
2525
2525
|
autoSync: !0,
|
|
2526
2526
|
type: "INTERNAL",
|
|
@@ -2701,7 +2701,7 @@ const fo = s.object({
|
|
|
2701
2701
|
label: e(l(`popup.item.form.type.${p.toLowerCase()}.label`))
|
|
2702
2702
|
}));
|
|
2703
2703
|
return /* @__PURE__ */ n(S.Item, { alignItems: "flex-start", m: 8, xs: 12, children: /* @__PURE__ */ n(
|
|
2704
|
-
|
|
2704
|
+
L,
|
|
2705
2705
|
{
|
|
2706
2706
|
name: "type",
|
|
2707
2707
|
label: e(l("popup.item.form.type.label", "Internal link")),
|
|
@@ -2723,7 +2723,7 @@ const fo = s.object({
|
|
|
2723
2723
|
}, Oi = ({ current: e }) => {
|
|
2724
2724
|
const { formatMessage: t } = A(), a = ne(), { values: o, onChange: i, handleChange: r, renderError: d, canUpdate: c } = he();
|
|
2725
2725
|
return /* @__PURE__ */ n(S.Item, { alignItems: "flex-start", m: 4, xs: 12, children: /* @__PURE__ */ n(
|
|
2726
|
-
|
|
2726
|
+
L,
|
|
2727
2727
|
{
|
|
2728
2728
|
name: "menuAttached",
|
|
2729
2729
|
label: t(l("popup.item.form.menuAttached.label", "MenuAttached")),
|
|
@@ -2764,7 +2764,7 @@ const fo = s.object({
|
|
|
2764
2764
|
orderInitial: 2,
|
|
2765
2765
|
orderMedium: 1,
|
|
2766
2766
|
children: /* @__PURE__ */ n(
|
|
2767
|
-
|
|
2767
|
+
L,
|
|
2768
2768
|
{
|
|
2769
2769
|
name: "title",
|
|
2770
2770
|
label: e(l("popup.item.form.title.label", "Title")),
|
|
@@ -2803,7 +2803,7 @@ const fo = s.object({
|
|
|
2803
2803
|
orderInitial: 1,
|
|
2804
2804
|
orderMedium: 2,
|
|
2805
2805
|
children: /* @__PURE__ */ n(
|
|
2806
|
-
|
|
2806
|
+
L,
|
|
2807
2807
|
{
|
|
2808
2808
|
name: "autoSync",
|
|
2809
2809
|
label: e(l("popup.item.form.autoSync.label", "Read fields from related")),
|
|
@@ -2846,7 +2846,7 @@ const fo = s.object({
|
|
|
2846
2846
|
({ documentId: h }) => h === v.related
|
|
2847
2847
|
), I = y.find((h) => f?.[h]);
|
|
2848
2848
|
return /* @__PURE__ */ n(S.Item, { alignItems: "flex-start", col: 12, children: /* @__PURE__ */ n(
|
|
2849
|
-
|
|
2849
|
+
L,
|
|
2850
2850
|
{
|
|
2851
2851
|
name: u,
|
|
2852
2852
|
label: o(l(`popup.item.form.${u}.label`, "Path")),
|
|
@@ -2962,7 +2962,7 @@ const fo = s.object({
|
|
|
2962
2962
|
}, Gi = ({ additionalField: e }) => {
|
|
2963
2963
|
const { canUpdate: t, isLoading: a, onChange: o, handleChange: i, renderError: r, values: d } = he();
|
|
2964
2964
|
return /* @__PURE__ */ n(S.Item, { alignItems: "flex-start", s: 6, xs: 12, children: /* @__PURE__ */ n(
|
|
2965
|
-
|
|
2965
|
+
L,
|
|
2966
2966
|
{
|
|
2967
2967
|
name: `additionalFields.${e.name}`,
|
|
2968
2968
|
label: e.label,
|
|
@@ -2992,7 +2992,7 @@ const fo = s.object({
|
|
|
2992
2992
|
[a]
|
|
2993
2993
|
), { isLoading: i, renderError: r, onChange: d, handleChange: c, values: m } = he();
|
|
2994
2994
|
return /* @__PURE__ */ n(S.Item, { alignItems: "flex-start", col: 12, children: /* @__PURE__ */ n(
|
|
2995
|
-
|
|
2995
|
+
L,
|
|
2996
2996
|
{
|
|
2997
2997
|
name: "audience",
|
|
2998
2998
|
label: e(l("popup.item.form.audience.label")),
|
|
@@ -3039,7 +3039,7 @@ const fo = s.object({
|
|
|
3039
3039
|
label: y
|
|
3040
3040
|
})),
|
|
3041
3041
|
[e]
|
|
3042
|
-
), C =
|
|
3042
|
+
), C = $(
|
|
3043
3043
|
async (y) => {
|
|
3044
3044
|
y.preventDefault(), y.stopPropagation();
|
|
3045
3045
|
const f = p.data?.find(({ locale: I }) => I === d);
|
|
@@ -3052,11 +3052,11 @@ const fo = s.object({
|
|
|
3052
3052
|
{
|
|
3053
3053
|
onSuccess(I) {
|
|
3054
3054
|
m.reset();
|
|
3055
|
-
const { type: h, externalPath: T, path:
|
|
3055
|
+
const { type: h, externalPath: T, path: E, related: z, title: k, uiRouterKey: F } = I;
|
|
3056
3056
|
i({
|
|
3057
3057
|
type: h,
|
|
3058
3058
|
externalPath: T,
|
|
3059
|
-
path:
|
|
3059
|
+
path: E,
|
|
3060
3060
|
title: k,
|
|
3061
3061
|
uiRouterKey: F,
|
|
3062
3062
|
related: z
|
|
@@ -3074,7 +3074,7 @@ const fo = s.object({
|
|
|
3074
3074
|
/* @__PURE__ */ n(tt, { marginTop: 5, marginBottom: 5 }),
|
|
3075
3075
|
/* @__PURE__ */ w(S.Root, { gap: 5, children: [
|
|
3076
3076
|
/* @__PURE__ */ n(S.Item, { alignItems: "flex-start", col: 6, lg: 12, children: /* @__PURE__ */ n(
|
|
3077
|
-
|
|
3077
|
+
L,
|
|
3078
3078
|
{
|
|
3079
3079
|
name: "i18n.locale",
|
|
3080
3080
|
label: r(
|
|
@@ -3171,7 +3171,7 @@ const fo = s.object({
|
|
|
3171
3171
|
}, [a, c.data, e]), V(() => {
|
|
3172
3172
|
a === "" && v("relatedType", c.data?.defaultContentType);
|
|
3173
3173
|
}, [c.data?.defaultContentType, b.type, a]), /* @__PURE__ */ n(S.Item, { alignItems: "flex-start", m: a && !o ? 6 : 12, xs: 12, children: /* @__PURE__ */ n(
|
|
3174
|
-
|
|
3174
|
+
L,
|
|
3175
3175
|
{
|
|
3176
3176
|
name: "relatedType",
|
|
3177
3177
|
label: d(l("popup.item.form.relatedType.label", "Related Type")),
|
|
@@ -3243,7 +3243,7 @@ const fo = s.object({
|
|
|
3243
3243
|
(y) => y.label
|
|
3244
3244
|
), C = Y(b);
|
|
3245
3245
|
return tr(o, t, i), !o.relatedType || a ? null : /* @__PURE__ */ n(S.Item, { alignItems: "flex-start", m: 6, xs: 12, children: /* @__PURE__ */ n(
|
|
3246
|
-
|
|
3246
|
+
L,
|
|
3247
3247
|
{
|
|
3248
3248
|
name: "related",
|
|
3249
3249
|
label: r(l("popup.item.form.related.label", "Related")),
|
|
@@ -3278,7 +3278,7 @@ const fo = s.object({
|
|
|
3278
3278
|
}) => {
|
|
3279
3279
|
const { formatMessage: p } = A(), [u, v] = N(t), { canUpdate: b } = c, [C, y] = N(!1), f = ne(), I = f.data?.contentTypes ?? [], { toggleNotification: h } = Oe(), {
|
|
3280
3280
|
formValue: T,
|
|
3281
|
-
renderError:
|
|
3281
|
+
renderError: E,
|
|
3282
3282
|
setFormError: z,
|
|
3283
3283
|
handleChange: k,
|
|
3284
3284
|
setFormValue: F,
|
|
@@ -3292,7 +3292,7 @@ const fo = s.object({
|
|
|
3292
3292
|
const Z = re(R), {
|
|
3293
3293
|
success: se,
|
|
3294
3294
|
data: U,
|
|
3295
|
-
error:
|
|
3295
|
+
error: Ee
|
|
3296
3296
|
} = Pi({
|
|
3297
3297
|
isSingleSelected: C,
|
|
3298
3298
|
additionalFields: f.data?.additionalFields ?? ar
|
|
@@ -3326,13 +3326,13 @@ const fo = s.object({
|
|
|
3326
3326
|
uiRouterKey: ve
|
|
3327
3327
|
}
|
|
3328
3328
|
);
|
|
3329
|
-
} else
|
|
3330
|
-
|
|
3329
|
+
} else Ee && z(
|
|
3330
|
+
Ee.issues.reduce((Ie, ve) => ({
|
|
3331
3331
|
...Ie,
|
|
3332
3332
|
[ve.path.join(".")]: ve.message
|
|
3333
3333
|
}), {})
|
|
3334
3334
|
);
|
|
3335
|
-
}, pe = Mi(), Re =
|
|
3335
|
+
}, pe = Mi(), Re = $(
|
|
3336
3336
|
(G, R, Z) => {
|
|
3337
3337
|
let se;
|
|
3338
3338
|
if (Z) {
|
|
@@ -3342,7 +3342,7 @@ const fo = s.object({
|
|
|
3342
3342
|
return I.find((U) => U.uid === R)?.contentTypeName;
|
|
3343
3343
|
} else
|
|
3344
3344
|
se = {
|
|
3345
|
-
...ee.data?.find(({ documentId:
|
|
3345
|
+
...ee.data?.find(({ documentId: Ee }) => Ee === G) || {
|
|
3346
3346
|
documentId: null
|
|
3347
3347
|
},
|
|
3348
3348
|
__collectionUid: R
|
|
@@ -3366,7 +3366,7 @@ const fo = s.object({
|
|
|
3366
3366
|
values: G,
|
|
3367
3367
|
onChange: R,
|
|
3368
3368
|
handleChange: k,
|
|
3369
|
-
renderError:
|
|
3369
|
+
renderError: E,
|
|
3370
3370
|
setFormValueItem: M,
|
|
3371
3371
|
canUpdate: b,
|
|
3372
3372
|
isLoading: u
|
|
@@ -3522,14 +3522,14 @@ const fo = s.object({
|
|
|
3522
3522
|
index: ft
|
|
3523
3523
|
}));
|
|
3524
3524
|
}, [o, r]);
|
|
3525
|
-
const y =
|
|
3525
|
+
const y = $((h) => {
|
|
3526
3526
|
h.code.toLowerCase() === "enter" && m((T) => T + 1);
|
|
3527
|
-
}, []), f =
|
|
3527
|
+
}, []), f = $(
|
|
3528
3528
|
(h) => {
|
|
3529
3529
|
i(h.target.value);
|
|
3530
3530
|
},
|
|
3531
3531
|
[i]
|
|
3532
|
-
), I =
|
|
3532
|
+
), I = $(() => {
|
|
3533
3533
|
i(""), v(!1);
|
|
3534
3534
|
}, [i, v]);
|
|
3535
3535
|
return u ? /* @__PURE__ */ w("div", { ref: b, style: { width: "100%" }, children: [
|
|
@@ -3568,17 +3568,17 @@ const fo = s.object({
|
|
|
3568
3568
|
canUpdate: a,
|
|
3569
3569
|
addNewNavigationItem: o
|
|
3570
3570
|
}) => {
|
|
3571
|
-
const { formatMessage: i } = A(), r =
|
|
3571
|
+
const { formatMessage: i } = A(), r = $(() => {
|
|
3572
3572
|
e && t({
|
|
3573
3573
|
...e,
|
|
3574
3574
|
items: e.items.map((p) => ke(p, !1))
|
|
3575
3575
|
});
|
|
3576
|
-
}, [t, e, ke]), d =
|
|
3576
|
+
}, [t, e, ke]), d = $(() => {
|
|
3577
3577
|
e && t({
|
|
3578
3578
|
...e,
|
|
3579
3579
|
items: e.items.map((p) => ke(p, !0))
|
|
3580
3580
|
});
|
|
3581
|
-
}, [t, e, ke]), c =
|
|
3581
|
+
}, [t, e, ke]), c = $(
|
|
3582
3582
|
(p) => {
|
|
3583
3583
|
const u = (e?.items ?? []).reduce(
|
|
3584
3584
|
(v, { order: b }) => Math.max(v, b),
|
|
@@ -3636,8 +3636,8 @@ const fo = s.object({
|
|
|
3636
3636
|
i18nCopySourceLocale: v,
|
|
3637
3637
|
setI18nCopyModalOpened: b,
|
|
3638
3638
|
setI18nCopySourceLocale: C
|
|
3639
|
-
} =
|
|
3640
|
-
|
|
3639
|
+
} = $o(
|
|
3640
|
+
$(
|
|
3641
3641
|
(f) => {
|
|
3642
3642
|
const I = o.find(
|
|
3643
3643
|
({ locale: h, documentId: T }) => h === f && T === i?.documentId
|
|
@@ -3660,7 +3660,7 @@ const fo = s.object({
|
|
|
3660
3660
|
},
|
|
3661
3661
|
[i]
|
|
3662
3662
|
)
|
|
3663
|
-
), y =
|
|
3663
|
+
), y = $(() => {
|
|
3664
3664
|
v && b(!0);
|
|
3665
3665
|
}, [b, v]);
|
|
3666
3666
|
return /* @__PURE__ */ w(P, { direction: "column", minHeight: "400px", justifyContent: "center", children: [
|
|
@@ -3669,7 +3669,7 @@ const fo = s.object({
|
|
|
3669
3669
|
K,
|
|
3670
3670
|
{
|
|
3671
3671
|
variant: "secondary",
|
|
3672
|
-
startIcon: /* @__PURE__ */ n(
|
|
3672
|
+
startIcon: /* @__PURE__ */ n(Ea, {}),
|
|
3673
3673
|
label: c(l("empty.cta")),
|
|
3674
3674
|
onClick: t,
|
|
3675
3675
|
children: c(l("empty.cta"))
|
|
@@ -3708,7 +3708,7 @@ const fo = s.object({
|
|
|
3708
3708
|
isChangeLanguageVisible: I,
|
|
3709
3709
|
changeCurrentLocaleAction: h,
|
|
3710
3710
|
availableLocales: T
|
|
3711
|
-
} = ko(t.data, u), { searchValue:
|
|
3711
|
+
} = ko(t.data, u), { searchValue: E, setSearchValue: z, isSearchEmpty: k, filteredList: F } = Do(c), {
|
|
3712
3712
|
activeNavigationItem: M,
|
|
3713
3713
|
addNewNavigationItem: _,
|
|
3714
3714
|
editNavigationItem: re,
|
|
@@ -3789,7 +3789,7 @@ const fo = s.object({
|
|
|
3789
3789
|
/* @__PURE__ */ n(
|
|
3790
3790
|
ui,
|
|
3791
3791
|
{
|
|
3792
|
-
startActions: /* @__PURE__ */ n(sr, { value:
|
|
3792
|
+
startActions: /* @__PURE__ */ n(sr, { value: E, setValue: z }),
|
|
3793
3793
|
endActions: /* @__PURE__ */ n(
|
|
3794
3794
|
dr,
|
|
3795
3795
|
{
|
|
@@ -3868,7 +3868,7 @@ const gr = () => /* @__PURE__ */ n(Gn, { backend: Zn, children: /* @__PURE__ */
|
|
|
3868
3868
|
}, yr = (e = "") => {
|
|
3869
3869
|
const t = (r) => r.split("-").map((d) => sn(d)).join(""), [a, o, i] = br(e);
|
|
3870
3870
|
return a === "api" ? t(i) : `${t(o)}${t(i)}`;
|
|
3871
|
-
}, br = (e = "") => e.split(hr).filter((t) => t && t.length > 0), Jt = "SERVER OFFLINE",
|
|
3871
|
+
}, br = (e = "") => e.split(hr).filter((t) => t && t.length > 0), Jt = "SERVER OFFLINE", En = (e, t) => new Promise((a) => {
|
|
3872
3872
|
fetch(`${window.strapi.backendURL}/_health`, {
|
|
3873
3873
|
method: "HEAD",
|
|
3874
3874
|
mode: "no-cors",
|
|
@@ -3883,11 +3883,11 @@ const gr = () => /* @__PURE__ */ n(Gn, { backend: Zn, children: /* @__PURE__ */
|
|
|
3883
3883
|
throw new Error(Jt);
|
|
3884
3884
|
a(e);
|
|
3885
3885
|
}).catch((o) => {
|
|
3886
|
-
setTimeout(() =>
|
|
3886
|
+
setTimeout(() => En(e, o.message !== Jt).then(
|
|
3887
3887
|
a
|
|
3888
3888
|
), 100);
|
|
3889
3889
|
});
|
|
3890
|
-
}),
|
|
3890
|
+
}), Lt = () => {
|
|
3891
3891
|
const e = j(), t = B(e);
|
|
3892
3892
|
return xe({
|
|
3893
3893
|
queryKey: t.readSettingsConfigIndex(),
|
|
@@ -3896,7 +3896,7 @@ const gr = () => /* @__PURE__ */ n(Gn, { backend: Zn, children: /* @__PURE__ */
|
|
|
3896
3896
|
},
|
|
3897
3897
|
staleTime: 1e3 * 60 * 5
|
|
3898
3898
|
});
|
|
3899
|
-
},
|
|
3899
|
+
}, Ln = () => {
|
|
3900
3900
|
const e = j(), t = B(e), a = xe({
|
|
3901
3901
|
queryKey: t.healthCheckIndex(),
|
|
3902
3902
|
queryFn: () => t.healthCheck(),
|
|
@@ -3907,7 +3907,7 @@ const gr = () => /* @__PURE__ */ n(Gn, { backend: Zn, children: /* @__PURE__ */
|
|
|
3907
3907
|
return ge({
|
|
3908
3908
|
mutationFn: () => t.restart().then(() => a.refetch())
|
|
3909
3909
|
});
|
|
3910
|
-
},
|
|
3910
|
+
}, $n = () => {
|
|
3911
3911
|
const e = j(), t = B(e);
|
|
3912
3912
|
return ge({
|
|
3913
3913
|
mutationFn: () => t.restoreConfig()
|
|
@@ -3984,7 +3984,7 @@ const gr = () => /* @__PURE__ */ n(Gn, { backend: Zn, children: /* @__PURE__ */
|
|
|
3984
3984
|
renderError: () => "",
|
|
3985
3985
|
setFormValueItem: () => null
|
|
3986
3986
|
}), Ne = () => an(Pn), Tr = ({ hasSettingsReadPermissions: e }) => {
|
|
3987
|
-
const { formatMessage: t } = A(), a =
|
|
3987
|
+
const { formatMessage: t } = A(), a = $n(), { setRestartStatus: o } = Ne(), [i, r] = N(!1), d = async (c) => {
|
|
3988
3988
|
r(!1), c && (a.mutate(), o({ required: !0 }));
|
|
3989
3989
|
};
|
|
3990
3990
|
return /* @__PURE__ */ n(D, { ...Je, width: "100%", children: /* @__PURE__ */ w(P, { direction: "column", alignItems: "flex-start", gap: 2, children: [
|
|
@@ -4009,7 +4009,7 @@ const gr = () => /* @__PURE__ */ n(Gn, { backend: Zn, children: /* @__PURE__ */
|
|
|
4009
4009
|
labelConfirm: t(
|
|
4010
4010
|
l("pages.settings.actions.restore.confirmation.confirm")
|
|
4011
4011
|
),
|
|
4012
|
-
iconConfirm: /* @__PURE__ */ n(
|
|
4012
|
+
iconConfirm: /* @__PURE__ */ n(La, {}),
|
|
4013
4013
|
onConfirm: () => d(!0),
|
|
4014
4014
|
onCancel: () => d(!1),
|
|
4015
4015
|
children: t(l("pages.settings.actions.restore.confirmation.description"))
|
|
@@ -4023,10 +4023,10 @@ const gr = () => /* @__PURE__ */ n(Gn, { backend: Zn, children: /* @__PURE__ */
|
|
|
4023
4023
|
flex-direction: column;
|
|
4024
4024
|
}
|
|
4025
4025
|
`, Sr = ({ setIsReloading: e }) => {
|
|
4026
|
-
const { formatMessage: t } = A(), a =
|
|
4026
|
+
const { formatMessage: t } = A(), a = Ln(), { restartStatus: o, setRestartStatus: i } = Ne(), r = async () => {
|
|
4027
4027
|
a.mutate(void 0, {
|
|
4028
4028
|
onSuccess() {
|
|
4029
|
-
e(!0),
|
|
4029
|
+
e(!0), En(!0).then((c) => {
|
|
4030
4030
|
c && window.location.reload();
|
|
4031
4031
|
});
|
|
4032
4032
|
},
|
|
@@ -4040,7 +4040,7 @@ const gr = () => /* @__PURE__ */ n(Gn, { backend: Zn, children: /* @__PURE__ */
|
|
|
4040
4040
|
{
|
|
4041
4041
|
closeLabel: t(l("pages.settings.actions.restart.alert.cancel")),
|
|
4042
4042
|
title: t(l("pages.settings.actions.restart.alert.title")),
|
|
4043
|
-
action: /* @__PURE__ */ n(D, { children: /* @__PURE__ */ n(K, { onClick: r, startIcon: /* @__PURE__ */ n(
|
|
4043
|
+
action: /* @__PURE__ */ n(D, { children: /* @__PURE__ */ n(K, { onClick: r, startIcon: /* @__PURE__ */ n($a, {}), children: t(l("pages.settings.actions.restart.label")) }) }),
|
|
4044
4044
|
onClose: d,
|
|
4045
4045
|
children: /* @__PURE__ */ w(ie, { children: [
|
|
4046
4046
|
/* @__PURE__ */ n(D, { paddingBottom: 1, children: t(l("pages.settings.actions.restart.alert.description")) }),
|
|
@@ -4058,12 +4058,12 @@ const gr = () => /* @__PURE__ */ n(Gn, { backend: Zn, children: /* @__PURE__ */
|
|
|
4058
4058
|
}
|
|
4059
4059
|
) }) : null;
|
|
4060
4060
|
}, Fr = () => {
|
|
4061
|
-
const e =
|
|
4061
|
+
const e = Lt(), { formatMessage: t } = A(), { values: a, onChange: o, handleChange: i, restartStatus: r } = Ne();
|
|
4062
4062
|
return /* @__PURE__ */ n(D, { ...Je, width: "100%", children: /* @__PURE__ */ w(P, { direction: "column", alignItems: "flex-start", gap: 2, children: [
|
|
4063
4063
|
/* @__PURE__ */ n(x, { variant: "delta", as: "h2", children: t(l("pages.settings.additional.title")) }),
|
|
4064
4064
|
/* @__PURE__ */ w(S.Root, { gap: 4, width: "100%", children: [
|
|
4065
4065
|
/* @__PURE__ */ n(S.Item, { col: 4, s: 12, xs: 12, children: /* @__PURE__ */ n(D, { width: "100%", children: /* @__PURE__ */ n(
|
|
4066
|
-
|
|
4066
|
+
L,
|
|
4067
4067
|
{
|
|
4068
4068
|
name: "allowedLevels",
|
|
4069
4069
|
label: t(l("pages.settings.form.allowedLevels.label")),
|
|
@@ -4095,7 +4095,7 @@ const gr = () => /* @__PURE__ */ n(Gn, { backend: Zn, children: /* @__PURE__ */
|
|
|
4095
4095
|
}
|
|
4096
4096
|
) }) }),
|
|
4097
4097
|
/* @__PURE__ */ n(S.Item, { col: 4, s: 12, xs: 12, children: /* @__PURE__ */ n(
|
|
4098
|
-
|
|
4098
|
+
L,
|
|
4099
4099
|
{
|
|
4100
4100
|
name: "cascadeMenuAttached",
|
|
4101
4101
|
label: t(l("pages.settings.form.cascadeMenuAttached.label")),
|
|
@@ -4115,7 +4115,7 @@ const gr = () => /* @__PURE__ */ n(Gn, { backend: Zn, children: /* @__PURE__ */
|
|
|
4115
4115
|
}
|
|
4116
4116
|
) }),
|
|
4117
4117
|
/* @__PURE__ */ n(S.Item, { col: 4, s: 12, xs: 12, children: /* @__PURE__ */ n(
|
|
4118
|
-
|
|
4118
|
+
L,
|
|
4119
4119
|
{
|
|
4120
4120
|
name: "audienceFieldChecked",
|
|
4121
4121
|
label: t(l("pages.settings.form.audience.label")),
|
|
@@ -4135,7 +4135,7 @@ const gr = () => /* @__PURE__ */ n(Gn, { backend: Zn, children: /* @__PURE__ */
|
|
|
4135
4135
|
}
|
|
4136
4136
|
) }),
|
|
4137
4137
|
e.data?.isCachePluginEnabled && /* @__PURE__ */ n(S.Item, { col: 12, s: 12, xs: 12, children: /* @__PURE__ */ n(
|
|
4138
|
-
|
|
4138
|
+
L,
|
|
4139
4139
|
{
|
|
4140
4140
|
name: "isCacheEnabled",
|
|
4141
4141
|
label: t(l("pages.settings.form.cache.label")),
|
|
@@ -4159,7 +4159,7 @@ const gr = () => /* @__PURE__ */ n(Gn, { backend: Zn, children: /* @__PURE__ */
|
|
|
4159
4159
|
}, Ar = () => {
|
|
4160
4160
|
const { formatMessage: e } = A(), { values: t, onChange: a, handleChange: o, restartStatus: i } = Ne();
|
|
4161
4161
|
return /* @__PURE__ */ n(S.Item, { col: 4, s: 12, xs: 12, children: /* @__PURE__ */ n(
|
|
4162
|
-
|
|
4162
|
+
L,
|
|
4163
4163
|
{
|
|
4164
4164
|
name: "preferCustomContentTypes",
|
|
4165
4165
|
label: e(l("pages.settings.form.preferCustomContentTypes.label")),
|
|
@@ -4179,7 +4179,7 @@ const gr = () => /* @__PURE__ */ n(Gn, { backend: Zn, children: /* @__PURE__ */
|
|
|
4179
4179
|
}
|
|
4180
4180
|
) });
|
|
4181
4181
|
}, xr = () => {
|
|
4182
|
-
const e =
|
|
4182
|
+
const e = Lt(), t = dt(), { formatMessage: a } = A(), { values: o, onChange: i, handleChange: r, restartStatus: d, setFormValueItem: c, renderError: m } = Ne(), { contentTypes: p, preferCustomContentTypes: u } = o, v = Xe(
|
|
4183
4183
|
Object.values(t.data ?? []).filter(
|
|
4184
4184
|
({ uid: b }) => fr(b, {
|
|
4185
4185
|
allowedContentTypes: e.data?.allowedContentTypes,
|
|
@@ -4202,7 +4202,7 @@ const gr = () => /* @__PURE__ */ n(Gn, { backend: Zn, children: /* @__PURE__ */
|
|
|
4202
4202
|
(b) => b.info.displayName
|
|
4203
4203
|
);
|
|
4204
4204
|
return /* @__PURE__ */ n(S.Item, { col: 4, s: 12, xs: 12, children: /* @__PURE__ */ n(
|
|
4205
|
-
|
|
4205
|
+
L,
|
|
4206
4206
|
{
|
|
4207
4207
|
name: "contentTypes",
|
|
4208
4208
|
label: a(l("pages.settings.form.contentTypes.label")),
|
|
@@ -4222,7 +4222,7 @@ const gr = () => /* @__PURE__ */ n(Gn, { backend: Zn, children: /* @__PURE__ */
|
|
|
4222
4222
|
contentTypesPopulate: y = [],
|
|
4223
4223
|
pathDefaultFields: f = []
|
|
4224
4224
|
} = o, I = b.filter(
|
|
4225
|
-
(T) => !C.find((
|
|
4225
|
+
(T) => !C.find((E) => E.key === T)
|
|
4226
4226
|
) ?? [], h = C.filter(
|
|
4227
4227
|
(T) => !b.includes(T.key) || T.key === "default"
|
|
4228
4228
|
).map(({ key: T }) => T) ?? [];
|
|
@@ -4262,7 +4262,7 @@ const gr = () => /* @__PURE__ */ n(Gn, { backend: Zn, children: /* @__PURE__ */
|
|
|
4262
4262
|
return V(() => {
|
|
4263
4263
|
a.defaultContentType && (a.contentTypes.includes(a.defaultContentType) || i("defaultContentType", void 0, o));
|
|
4264
4264
|
}, [a.contentTypes]), /* @__PURE__ */ n(S.Item, { col: 4, s: 12, xs: 12, children: /* @__PURE__ */ n(
|
|
4265
|
-
|
|
4265
|
+
L,
|
|
4266
4266
|
{
|
|
4267
4267
|
name: "defaultContentType",
|
|
4268
4268
|
label: t(l("pages.settings.form.defaultContentType.label")),
|
|
@@ -4286,7 +4286,7 @@ const gr = () => /* @__PURE__ */ n(Gn, { backend: Zn, children: /* @__PURE__ */
|
|
|
4286
4286
|
)
|
|
4287
4287
|
}
|
|
4288
4288
|
) });
|
|
4289
|
-
}, Rr = ["relation", "media", "component", "dynamiczone"],
|
|
4289
|
+
}, Rr = ["relation", "media", "component", "dynamiczone"], Er = () => {
|
|
4290
4290
|
const e = dt(), { formatMessage: t } = A(), { values: a, onChange: o, handleChange: i, restartStatus: r, renderError: d } = Ne(), {
|
|
4291
4291
|
contentTypes: c,
|
|
4292
4292
|
contentTypesNameFields: m
|
|
@@ -4299,7 +4299,7 @@ const gr = () => /* @__PURE__ */ n(Gn, { backend: Zn, children: /* @__PURE__ */
|
|
|
4299
4299
|
/* @__PURE__ */ n(Ue.Header, { children: /* @__PURE__ */ n(Ue.Trigger, { children: v?.info.displayName ?? t(l("pages.settings.form.nameField.default")) }) }),
|
|
4300
4300
|
/* @__PURE__ */ n(Ue.Content, { children: /* @__PURE__ */ w(S.Root, { gap: 4, padding: 2, children: [
|
|
4301
4301
|
/* @__PURE__ */ n(S.Item, { col: 12, s: 12, xs: 12, children: /* @__PURE__ */ n(
|
|
4302
|
-
|
|
4302
|
+
L,
|
|
4303
4303
|
{
|
|
4304
4304
|
name: `contentTypesNameFields[${u}]`,
|
|
4305
4305
|
label: t(l("pages.settings.form.nameField.label")),
|
|
@@ -4334,7 +4334,7 @@ const gr = () => /* @__PURE__ */ n(Gn, { backend: Zn, children: /* @__PURE__ */
|
|
|
4334
4334
|
}
|
|
4335
4335
|
) }),
|
|
4336
4336
|
/* @__PURE__ */ n(S.Item, { col: 12, s: 12, xs: 12, children: /* @__PURE__ */ n(
|
|
4337
|
-
|
|
4337
|
+
L,
|
|
4338
4338
|
{
|
|
4339
4339
|
name: `contentTypesPopulate[${u - 1}]`,
|
|
4340
4340
|
label: t(l("pages.settings.form.populate.label")),
|
|
@@ -4370,7 +4370,7 @@ const gr = () => /* @__PURE__ */ n(Gn, { backend: Zn, children: /* @__PURE__ */
|
|
|
4370
4370
|
}
|
|
4371
4371
|
) }),
|
|
4372
4372
|
/* @__PURE__ */ n(S.Item, { col: 12, s: 12, xs: 12, children: /* @__PURE__ */ n(
|
|
4373
|
-
|
|
4373
|
+
L,
|
|
4374
4374
|
{
|
|
4375
4375
|
name: `pathDefaultFields[${u - 1}]`,
|
|
4376
4376
|
label: t(
|
|
@@ -4408,7 +4408,7 @@ const gr = () => /* @__PURE__ */ n(Gn, { backend: Zn, children: /* @__PURE__ */
|
|
|
4408
4408
|
] }) })
|
|
4409
4409
|
] }, p.key) : null;
|
|
4410
4410
|
}) }) : null });
|
|
4411
|
-
},
|
|
4411
|
+
}, Lr = () => {
|
|
4412
4412
|
const { formatMessage: e } = A();
|
|
4413
4413
|
return /* @__PURE__ */ n(D, { ...Je, width: "100%", children: /* @__PURE__ */ w(P, { direction: "column", alignItems: "flex-start", gap: 2, children: [
|
|
4414
4414
|
/* @__PURE__ */ n(x, { variant: "delta", as: "h2", children: e(l("pages.settings.general.title")) }),
|
|
@@ -4416,23 +4416,23 @@ const gr = () => /* @__PURE__ */ n(Gn, { backend: Zn, children: /* @__PURE__ */
|
|
|
4416
4416
|
/* @__PURE__ */ n(Ar, {}),
|
|
4417
4417
|
/* @__PURE__ */ n(xr, {}),
|
|
4418
4418
|
/* @__PURE__ */ n(Nr, {}),
|
|
4419
|
-
/* @__PURE__ */ n(
|
|
4419
|
+
/* @__PURE__ */ n(Er, {})
|
|
4420
4420
|
] }) }) })
|
|
4421
4421
|
] }) });
|
|
4422
|
-
}, Yt = /* @__PURE__ */ n(ka, {}),
|
|
4422
|
+
}, Yt = /* @__PURE__ */ n(ka, {}), $r = /* @__PURE__ */ n(wt, {}), ae = "pages.settings.form.customFields.table.", Pr = ({
|
|
4423
4423
|
data: e = [],
|
|
4424
4424
|
onOpenModal: t,
|
|
4425
4425
|
onRemoveCustomField: a,
|
|
4426
4426
|
onToggleCustomField: o
|
|
4427
4427
|
}) => {
|
|
4428
|
-
const [i, r] = N(!1), [d, c] = N(null), { toggleNotification: m } = Oe(), p = X(() => Xe(e, "name"), [e]), { formatMessage: u } = A(), v =
|
|
4428
|
+
const [i, r] = N(!1), [d, c] = N(null), { toggleNotification: m } = Oe(), p = X(() => Xe(e, "name"), [e]), { formatMessage: u } = A(), v = $(
|
|
4429
4429
|
(y) => {
|
|
4430
4430
|
c(y), r(!0);
|
|
4431
4431
|
},
|
|
4432
4432
|
[c, r]
|
|
4433
|
-
), b =
|
|
4433
|
+
), b = $(() => {
|
|
4434
4434
|
c(null), r(!1);
|
|
4435
|
-
}, [c, r]), C =
|
|
4435
|
+
}, [c, r]), C = $(() => {
|
|
4436
4436
|
d === null ? m({
|
|
4437
4437
|
type: "warning",
|
|
4438
4438
|
message: u(l(`${ae}confirmation.error`))
|
|
@@ -4464,7 +4464,7 @@ const gr = () => /* @__PURE__ */ n(Gn, { backend: Zn, children: /* @__PURE__ */
|
|
|
4464
4464
|
onClick: (y) => {
|
|
4465
4465
|
y.preventDefault(), t(null);
|
|
4466
4466
|
},
|
|
4467
|
-
icon:
|
|
4467
|
+
icon: $r,
|
|
4468
4468
|
children: u(l(`${ae}footer`))
|
|
4469
4469
|
}
|
|
4470
4470
|
),
|
|
@@ -4530,7 +4530,7 @@ const gr = () => /* @__PURE__ */ n(Gn, { backend: Zn, children: /* @__PURE__ */
|
|
|
4530
4530
|
] });
|
|
4531
4531
|
}, Mr = ({ onChange: e, initialValue: t, ...a }) => {
|
|
4532
4532
|
const [o, i] = N(
|
|
4533
|
-
aa(t) ? t.
|
|
4533
|
+
aa(t) ? t.join(";") : ""
|
|
4534
4534
|
);
|
|
4535
4535
|
return /* @__PURE__ */ n(we, { ...a, onChange: (d) => {
|
|
4536
4536
|
const c = d?.target.value ?? "", m = c.split(";").map((p) => p.trim()).filter((p) => !!p.length);
|
|
@@ -4554,14 +4554,18 @@ const gr = () => /* @__PURE__ */ n(Gn, { backend: Zn, children: /* @__PURE__ */
|
|
|
4554
4554
|
onSubmit: a,
|
|
4555
4555
|
onClose: o
|
|
4556
4556
|
}) => {
|
|
4557
|
-
const i = kr(Cr), { formatMessage: r } = A(), [d, c] = N(
|
|
4558
|
-
|
|
4559
|
-
|
|
4560
|
-
|
|
4561
|
-
|
|
4562
|
-
|
|
4563
|
-
|
|
4564
|
-
|
|
4557
|
+
const i = kr(Cr), { formatMessage: r } = A(), [d, c] = N(
|
|
4558
|
+
t ? {
|
|
4559
|
+
...t
|
|
4560
|
+
} : {
|
|
4561
|
+
name: "",
|
|
4562
|
+
label: "",
|
|
4563
|
+
type: "string",
|
|
4564
|
+
required: !1,
|
|
4565
|
+
multi: !1,
|
|
4566
|
+
enabled: !0
|
|
4567
|
+
}
|
|
4568
|
+
), [m, p] = N(), { type: u } = d;
|
|
4565
4569
|
V(() => {
|
|
4566
4570
|
t && c({
|
|
4567
4571
|
...t
|
|
@@ -4569,12 +4573,12 @@ const gr = () => /* @__PURE__ */ n(Gn, { backend: Zn, children: /* @__PURE__ */
|
|
|
4569
4573
|
}, [t]);
|
|
4570
4574
|
const v = (f, I, h) => {
|
|
4571
4575
|
if (h) {
|
|
4572
|
-
let T = f,
|
|
4576
|
+
let T = f, E = I;
|
|
4573
4577
|
if (He(f)) {
|
|
4574
4578
|
const { name: z, value: k } = f.target;
|
|
4575
|
-
T = z,
|
|
4579
|
+
T = z, E = Be(E) ? k : E;
|
|
4576
4580
|
}
|
|
4577
|
-
return ot(T) && b(T,
|
|
4581
|
+
return ot(T) && b(T, E), h(f, E);
|
|
4578
4582
|
}
|
|
4579
4583
|
}, b = (f, I) => {
|
|
4580
4584
|
c(
|
|
@@ -4591,9 +4595,9 @@ const gr = () => /* @__PURE__ */ n(Gn, { backend: Zn, children: /* @__PURE__ */
|
|
|
4591
4595
|
if (I)
|
|
4592
4596
|
return r(l(`${O}${f}.${I}`));
|
|
4593
4597
|
}, y = (f, I) => {
|
|
4594
|
-
const { success: h, data: T, error:
|
|
4595
|
-
h ? a(T) :
|
|
4596
|
-
|
|
4598
|
+
const { success: h, data: T, error: E } = fn.safeParse(I);
|
|
4599
|
+
h ? a(T) : E && p(
|
|
4600
|
+
E.issues.reduce((z, k) => ({
|
|
4597
4601
|
...z,
|
|
4598
4602
|
[k.path.join(".")]: k.message
|
|
4599
4603
|
}), {})
|
|
@@ -4602,7 +4606,7 @@ const gr = () => /* @__PURE__ */ n(Gn, { backend: Zn, children: /* @__PURE__ */
|
|
|
4602
4606
|
return /* @__PURE__ */ w(ie, { children: [
|
|
4603
4607
|
/* @__PURE__ */ n(H.Body, { children: /* @__PURE__ */ n(at, { method: "POST", width: "auto", height: "auto", initialValues: d, children: ({ values: f, onChange: I }) => /* @__PURE__ */ w(S.Root, { gap: 5, children: [
|
|
4604
4608
|
/* @__PURE__ */ n(S.Item, { col: 12, children: /* @__PURE__ */ n(
|
|
4605
|
-
|
|
4609
|
+
L,
|
|
4606
4610
|
{
|
|
4607
4611
|
name: "name",
|
|
4608
4612
|
label: r(l(`${O}name.label`)),
|
|
@@ -4624,7 +4628,7 @@ const gr = () => /* @__PURE__ */ n(Gn, { backend: Zn, children: /* @__PURE__ */
|
|
|
4624
4628
|
}
|
|
4625
4629
|
) }, "name"),
|
|
4626
4630
|
/* @__PURE__ */ n(S.Item, { col: 12, children: /* @__PURE__ */ n(
|
|
4627
|
-
|
|
4631
|
+
L,
|
|
4628
4632
|
{
|
|
4629
4633
|
name: "label",
|
|
4630
4634
|
label: r(l(`${O}label.label`)),
|
|
@@ -4645,7 +4649,7 @@ const gr = () => /* @__PURE__ */ n(Gn, { backend: Zn, children: /* @__PURE__ */
|
|
|
4645
4649
|
}
|
|
4646
4650
|
) }, "label"),
|
|
4647
4651
|
/* @__PURE__ */ n(S.Item, { col: 12, children: /* @__PURE__ */ n(
|
|
4648
|
-
|
|
4652
|
+
L,
|
|
4649
4653
|
{
|
|
4650
4654
|
name: "description",
|
|
4651
4655
|
label: r(l(`${O}description.label`)),
|
|
@@ -4665,7 +4669,7 @@ const gr = () => /* @__PURE__ */ n(Gn, { backend: Zn, children: /* @__PURE__ */
|
|
|
4665
4669
|
}
|
|
4666
4670
|
) }, "description"),
|
|
4667
4671
|
/* @__PURE__ */ n(S.Item, { col: 12, children: /* @__PURE__ */ n(
|
|
4668
|
-
|
|
4672
|
+
L,
|
|
4669
4673
|
{
|
|
4670
4674
|
name: "placeholder",
|
|
4671
4675
|
label: r(l(`${O}placeholder.label`)),
|
|
@@ -4685,7 +4689,7 @@ const gr = () => /* @__PURE__ */ n(Gn, { backend: Zn, children: /* @__PURE__ */
|
|
|
4685
4689
|
}
|
|
4686
4690
|
) }, "placeholder"),
|
|
4687
4691
|
/* @__PURE__ */ n(S.Item, { col: 12, children: /* @__PURE__ */ n(
|
|
4688
|
-
|
|
4692
|
+
L,
|
|
4689
4693
|
{
|
|
4690
4694
|
name: "type",
|
|
4691
4695
|
label: r(l(`${O}type.label`)),
|
|
@@ -4699,14 +4703,14 @@ const gr = () => /* @__PURE__ */ n(Gn, { backend: Zn, children: /* @__PURE__ */
|
|
|
4699
4703
|
onChange: (h) => v("type", h, I),
|
|
4700
4704
|
disabled: e,
|
|
4701
4705
|
width: "100%",
|
|
4702
|
-
children: i.map(({ key: h, label: T, value:
|
|
4706
|
+
children: i.map(({ key: h, label: T, value: E }) => /* @__PURE__ */ n(Ae, { value: E, children: T }, h))
|
|
4703
4707
|
}
|
|
4704
4708
|
)
|
|
4705
4709
|
}
|
|
4706
4710
|
) }, "type"),
|
|
4707
4711
|
u === "select" && /* @__PURE__ */ w(ie, { children: [
|
|
4708
4712
|
/* @__PURE__ */ n(S.Item, { col: 12, children: /* @__PURE__ */ n(
|
|
4709
|
-
|
|
4713
|
+
L,
|
|
4710
4714
|
{
|
|
4711
4715
|
name: "multi",
|
|
4712
4716
|
label: r(l(`${O}multi.label`)),
|
|
@@ -4726,7 +4730,7 @@ const gr = () => /* @__PURE__ */ n(Gn, { backend: Zn, children: /* @__PURE__ */
|
|
|
4726
4730
|
}
|
|
4727
4731
|
) }, "multi"),
|
|
4728
4732
|
/* @__PURE__ */ n(S.Item, { col: 12, children: /* @__PURE__ */ n(
|
|
4729
|
-
|
|
4733
|
+
L,
|
|
4730
4734
|
{
|
|
4731
4735
|
name: "options",
|
|
4732
4736
|
label: r(l(`${O}options.label`)),
|
|
@@ -4744,7 +4748,7 @@ const gr = () => /* @__PURE__ */ n(Gn, { backend: Zn, children: /* @__PURE__ */
|
|
|
4744
4748
|
) }, "options")
|
|
4745
4749
|
] }),
|
|
4746
4750
|
/* @__PURE__ */ n(S.Item, { col: 12, children: /* @__PURE__ */ n(
|
|
4747
|
-
|
|
4751
|
+
L,
|
|
4748
4752
|
{
|
|
4749
4753
|
name: "required",
|
|
4750
4754
|
label: r(l(`${O}required.label`)),
|
|
@@ -4876,16 +4880,16 @@ const gr = () => /* @__PURE__ */ n(Gn, { backend: Zn, children: /* @__PURE__ */
|
|
|
4876
4880
|
fields: g.string().array()
|
|
4877
4881
|
}).array()
|
|
4878
4882
|
}), en = new rn(), Br = () => {
|
|
4879
|
-
const e =
|
|
4883
|
+
const e = Lt(), t = dt(), a = Ir(), o = $n(), i = Ln(), { formatMessage: r } = A(), [d, c] = N({ required: !1 }), [m, p] = N(!1), u = Wn("SettingsPage", (F) => F.permissions), v = X(() => !!u.find(({ action: F }) => F === Le.settings[0].action), [u]), b = X(() => !!u.find(({ action: F }) => F === Le.access[0].action), [u]), C = e.isPending || t.isPending || a.isPending || i.isPending || o.isPending, [y, f] = N({}), [I, h] = N(), T = (F, M, _) => {
|
|
4880
4884
|
if (_) {
|
|
4881
4885
|
let re = F, Q = M;
|
|
4882
4886
|
if (He(F)) {
|
|
4883
4887
|
const { name: le, value: fe } = F.target;
|
|
4884
4888
|
re = le, Q = Be(Q) ? fe : Q;
|
|
4885
4889
|
}
|
|
4886
|
-
return ot(re) &&
|
|
4890
|
+
return ot(re) && E(re, Q), _(F, Q);
|
|
4887
4891
|
}
|
|
4888
|
-
},
|
|
4892
|
+
}, E = (F, M) => {
|
|
4889
4893
|
f(
|
|
4890
4894
|
(_) => it(
|
|
4891
4895
|
{
|
|
@@ -4939,11 +4943,11 @@ const gr = () => /* @__PURE__ */ n(Gn, { backend: Zn, children: /* @__PURE__ */
|
|
|
4939
4943
|
restartStatus: d,
|
|
4940
4944
|
setRestartStatus: c,
|
|
4941
4945
|
renderError: z,
|
|
4942
|
-
setFormValueItem:
|
|
4946
|
+
setFormValueItem: E
|
|
4943
4947
|
},
|
|
4944
4948
|
children: /* @__PURE__ */ w(P, { direction: "column", gap: 4, children: [
|
|
4945
4949
|
/* @__PURE__ */ n(Sr, { setIsReloading: p }),
|
|
4946
|
-
/* @__PURE__ */ n(
|
|
4950
|
+
/* @__PURE__ */ n(Lr, {}),
|
|
4947
4951
|
/* @__PURE__ */ n(Fr, {}),
|
|
4948
4952
|
/* @__PURE__ */ n(Vr, {}),
|
|
4949
4953
|
/* @__PURE__ */ n(Tr, { hasSettingsReadPermissions: b })
|
|
@@ -4978,7 +4982,7 @@ const zr = "navigation", tn = "Navigation", il = {
|
|
|
4978
4982
|
Component() {
|
|
4979
4983
|
return Or;
|
|
4980
4984
|
},
|
|
4981
|
-
permissions:
|
|
4985
|
+
permissions: Le.settings
|
|
4982
4986
|
}
|
|
4983
4987
|
]
|
|
4984
4988
|
), e.addMenuLink({
|
|
@@ -4991,7 +4995,7 @@ const zr = "navigation", tn = "Navigation", il = {
|
|
|
4991
4995
|
Component() {
|
|
4992
4996
|
return gr;
|
|
4993
4997
|
},
|
|
4994
|
-
permissions:
|
|
4998
|
+
permissions: Le.access,
|
|
4995
4999
|
position: 1
|
|
4996
5000
|
}), e.registerPlugin({
|
|
4997
5001
|
id: de,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "strapi-plugin-navigation",
|
|
3
|
-
"version": "3.3.1",
|
|
3
|
+
"version": "3.3.3-beta.1",
|
|
4
4
|
"description": "Strapi - Navigation plugin",
|
|
5
5
|
"strapi": {
|
|
6
6
|
"name": "navigation",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
}
|
|
46
46
|
],
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@sensinum/strapi-utils": "^1.0.
|
|
48
|
+
"@sensinum/strapi-utils": "^1.0.11",
|
|
49
49
|
"@sindresorhus/slugify": "1.1.0",
|
|
50
50
|
"@tanstack/react-query": "^5.40.0",
|
|
51
51
|
"pluralize": "8.0.0",
|