@strapi/admin 4.6.0-alpha.0 → 4.6.0-alpha.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/admin/src/content-manager/components/Inputs/index.js +5 -19
- package/admin/src/content-manager/hooks/useLazyComponents/index.js +44 -0
- package/admin/src/content-manager/pages/CollectionTypeRecursivePath/components/ErrorFallback.js +13 -0
- package/admin/src/content-manager/pages/CollectionTypeRecursivePath/index.js +2 -1
- package/admin/src/content-manager/pages/EditView/GridRow/index.js +62 -0
- package/admin/src/content-manager/pages/EditView/index.js +74 -154
- package/admin/src/content-manager/pages/EditView/selectors.js +14 -0
- package/admin/src/content-manager/pages/EditView/utils/createAttributesLayout.js +11 -6
- package/admin/src/content-manager/pages/EditView/utils/getCustomFieldUidsFromLayout.js +18 -0
- package/admin/src/content-manager/pages/EditView/utils/index.js +1 -0
- package/admin/src/content-manager/pages/EditViewLayoutManager/index.js +1 -1
- package/admin/src/hooks/useSettingsMenu/init.js +7 -0
- package/admin/src/pages/SettingsPage/pages/AuditLogs/ListView/DynamicTable/TableRows/CellValue.js +19 -0
- package/admin/src/pages/SettingsPage/pages/AuditLogs/ListView/DynamicTable/TableRows/index.js +65 -0
- package/admin/src/pages/SettingsPage/pages/AuditLogs/ListView/ModalDialog/ActionItem.js +25 -0
- package/admin/src/pages/SettingsPage/pages/AuditLogs/ListView/ModalDialog/index.js +76 -0
- package/admin/src/pages/SettingsPage/pages/AuditLogs/ListView/hooks/useFormatTimeStamp.js +24 -0
- package/admin/src/pages/SettingsPage/pages/AuditLogs/ListView/index.js +84 -0
- package/admin/src/pages/SettingsPage/pages/AuditLogs/ListView/utils/tableHeaders.js +37 -0
- package/admin/src/pages/SettingsPage/pages/AuditLogs/ProtectedListPage/index.js +12 -0
- package/admin/src/pages/SettingsPage/utils/defaultRoutes.js +11 -0
- package/admin/src/permissions/defaultPermissions.js +4 -0
- package/admin/src/translations/en.json +7 -0
- package/admin/src/translations/ru.json +789 -489
- package/build/{1233.32d6888d.chunk.js → 1233.80b05d66.chunk.js} +11 -11
- package/build/1920.74a262e7.chunk.js +245 -0
- package/build/2438.61291207.chunk.js +2183 -0
- package/build/2517.9b4940f3.chunk.js +117 -0
- package/build/4306.f03c2b46.chunk.js +98 -0
- package/build/{4318.daf31770.chunk.js → 4318.7931eee7.chunk.js} +2 -2
- package/build/{805.a1894307.chunk.js → 805.e991a370.chunk.js} +6 -6
- package/build/9707.a0cc4ad8.chunk.js +70 -0
- package/build/{Admin-authenticatedApp.cfc3b4c9.chunk.js → Admin-authenticatedApp.ac85652e.chunk.js} +2 -2
- package/build/{Admin_homePage.b4db4df8.chunk.js → Admin_homePage.54e33c2d.chunk.js} +1 -1
- package/build/{Admin_marketplace.fa51405b.chunk.js → Admin_marketplace.8219fda6.chunk.js} +1 -1
- package/build/{Admin_pluginsPage.14d2840f.chunk.js → Admin_pluginsPage.3c872de7.chunk.js} +1 -1
- package/build/{Admin_profilePage.6c2c8398.chunk.js → Admin_profilePage.e9fcce92.chunk.js} +1 -1
- package/build/{Admin_settingsPage.5e740514.chunk.js → Admin_settingsPage.d3f48e9e.chunk.js} +15 -15
- package/build/admin-app.77179e07.chunk.js +112 -0
- package/build/admin-audit-logs.334ee871.chunk.js +1 -0
- package/build/admin-edit-roles-page.23f15909.chunk.js +1 -0
- package/build/{admin-edit-users.d254c128.chunk.js → admin-edit-users.283b49ed.chunk.js} +1 -1
- package/build/{admin-users.7c423e41.chunk.js → admin-users.a0748674.chunk.js} +1 -1
- package/build/{api-tokens-create-page.4ca2778d.chunk.js → api-tokens-create-page.93dd0689.chunk.js} +1 -1
- package/build/{api-tokens-edit-page.70a791c2.chunk.js → api-tokens-edit-page.b0adac81.chunk.js} +1 -1
- package/build/{api-tokens-list-page.fe994b6b.chunk.js → api-tokens-list-page.700e575f.chunk.js} +1 -1
- package/build/content-manager.01e04e11.chunk.js +1200 -0
- package/build/content-type-builder-list-view.4412efc3.chunk.js +201 -0
- package/build/content-type-builder.aa4ec633.chunk.js +145 -0
- package/build/email-settings-page.d44a57cb.chunk.js +15 -0
- package/build/en-json.57917cb1.chunk.js +1 -0
- package/build/index.html +1 -1
- package/build/main.f31112a5.js +2034 -0
- package/build/ru-json.8830286f.chunk.js +1 -0
- package/build/runtime~main.81f05721.js +2 -0
- package/build/sso-settings-page.9f091262.chunk.js +1 -0
- package/build/upload-settings.450cab1a.chunk.js +18 -0
- package/build/upload.a73936d9.chunk.js +64 -0
- package/build/users-advanced-settings-page.dc23bc56.chunk.js +13 -0
- package/build/users-email-settings-page.6541d372.chunk.js +28 -0
- package/build/users-providers-settings-page.e11a2f64.chunk.js +33 -0
- package/build/webhook-edit-page.14ad1e6e.chunk.js +75 -0
- package/build/{webhook-list-page.42533b59.chunk.js → webhook-list-page.b87821f2.chunk.js} +1 -1
- package/ee/server/services/passport/provider-registry.js +1 -1
- package/package.json +9 -9
- package/build/2438.afe24949.chunk.js +0 -2525
- package/build/2517.5cc235ba.chunk.js +0 -117
- package/build/4306.53359960.chunk.js +0 -98
- package/build/8881.bfdb6877.chunk.js +0 -245
- package/build/9707.932a3c12.chunk.js +0 -70
- package/build/admin-app.ee1211cb.chunk.js +0 -112
- package/build/admin-edit-roles-page.c7c338b3.chunk.js +0 -1
- package/build/content-manager.794d3373.chunk.js +0 -1200
- package/build/content-type-builder-list-view.95012cf0.chunk.js +0 -201
- package/build/content-type-builder.95b9d6a2.chunk.js +0 -145
- package/build/email-settings-page.4bb3606f.chunk.js +0 -15
- package/build/en-json.7dd57947.chunk.js +0 -1
- package/build/main.a6470578.js +0 -2031
- package/build/ru-json.d7cfc2ff.chunk.js +0 -1
- package/build/runtime~main.6e7d95b9.js +0 -2
- package/build/sso-settings-page.eb30a02e.chunk.js +0 -1
- package/build/upload-settings.3010911f.chunk.js +0 -18
- package/build/upload.9f19f2e8.chunk.js +0 -64
- package/build/users-advanced-settings-page.9df41d67.chunk.js +0 -13
- package/build/users-email-settings-page.56d82eaf.chunk.js +0 -28
- package/build/users-providers-settings-page.96bb7da0.chunk.js +0 -33
- package/build/webhook-edit-page.c5efc08b.chunk.js +0 -75
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_strapi_admin=self.webpackChunk_strapi_admin||[]).push([[5895],{
|
|
1
|
+
"use strict";(self.webpackChunk_strapi_admin=self.webpackChunk_strapi_admin||[]).push([[5895],{50020:(ce,O,n)=>{n.r(O),n.d(O,{SettingsPage:()=>mn,default:()=>pn});var e=n(32735),C=n(88425),r=n(5141),oe=n(96709),Q=n(5636),We=n(99357),_=n(775),Te=n(7602),Ae=n(84968),Re=n(28356),He=n(17e3),V=n(27649),A=n(62345),P=n(15335),Be=n(5803),Y=n(88860),Oe=n(27677),K=n(41415),ze=n(41502),ie=n(47361),x=n(66456),ae=n(60216),f=n.n(ae),et=n(23272),Xe=n(68387),be=n(98779),je=n(50563),Ne=n(19406),Ue=n(44647),Ze=n(97889);const Qe={currentStep:void 0},st=(m=Qe,c)=>(0,Ze.default)(m,l=>{switch(c.type){case"GO_TO":{l.currentStep=c.to;break}default:return l}});var nt=n(85025),rt=n(55225);const ne={localImage:void 0},Ve=(m=ne,c)=>(0,Ze.default)(m,l=>{switch(c.type){case"SET_LOCAL_IMAGE":{l.localImage=c.value;break}default:return l}}),ee=({onChangeLogo:m,customLogo:c,goTo:l,Component:h,modalTitle:u,next:T,prev:M,currentStep:R})=>{const[{localImage:y},D]=(0,e.useReducer)(Ve,ne),{formatMessage:fe}=(0,Q.useIntl)(),ue=pt=>{D({type:"SET_LOCAL_IMAGE",value:pt})},_e=()=>{l(null)};return R?e.createElement(nt.P,{labelledBy:"modal",onClose:_e},e.createElement(rt.x,null,e.createElement(Y.Z,{fontWeight:"bold",as:"h2",id:"modal"},fe(u))),e.createElement(h,{setLocalImage:ue,goTo:l,next:T,prev:M,onClose:_e,asset:y||c,onChangeLogo:m})):null};ee.defaultProps={Component:void 0,currentStep:void 0,customLogo:void 0,modalTitle:void 0,next:null,prev:null},ee.propTypes={Component:f().elementType,currentStep:f().string,customLogo:f().shape({name:f().string,url:f().string,width:f().number,height:f().number,ext:f().string}),goTo:f().func.isRequired,modalTitle:f().shape({id:f().string,defaultMessage:f().string}),next:f().string,onChangeLogo:f().func.isRequired,prev:f().string};const $=ee,G=750,I=100,H=["image/jpeg","image/png","image/svg+xml"];var W=n(35540),X=n(39291),pe=n(3653),De=n(9026),k=n(83292),ge=n(36320),Ye=n(99140),ke=n(11406),F=n(98275),le=n(87107),Z=n(47851),te=n(47284),v=(m,c,l)=>new Promise((h,u)=>{var T=y=>{try{R(l.next(y))}catch(D){u(D)}},M=y=>{try{R(l.throw(y))}catch(D){u(D)}},R=y=>y.done?h(y.value):Promise.resolve(y.value).then(T,M);R((l=l.apply(m,c)).next())});const ye={id:"Settings.application.customization.modal.upload.error-format",defaultMessage:"Wrong format uploaded (accepted formats only: jpeg, jpg, png, svg)."},de={id:"Settings.application.customization.modal.upload.error-size",defaultMessage:"The file uploaded is too large (max dimension: {dimension}x{dimension}, max file size: {size}KB)"},Je=m=>new Promise(c=>{const l=new FileReader;l.onload=()=>{const h=new Image;h.onload=function(){c({width:h.width,height:h.height})},h.src=l.result},l.readAsDataURL(m)}),ot=(m,c)=>({ext:m.name.split(".").pop(),size:m.size/1e3,name:m.name,url:URL.createObjectURL(m),rawFile:m,width:c.width,height:c.height}),Ce=m=>v(void 0,null,function*(){let c;if(!H.includes(m.type))throw c=new Error("File format"),c.displayMessage=ye,c;const h=yield Je(m);if(!(h.width<=G&&h.height<=G))throw c=new Error("File sizing"),c.displayMessage=de,c;const T=ot(m,h);if(!(T.size<=I))throw c=new Error("File sizing"),c.displayMessage=de,c;return T});var J=(m,c,l)=>new Promise((h,u)=>{var T=y=>{try{R(l.next(y))}catch(D){u(D)}},M=y=>{try{R(l.throw(y))}catch(D){u(D)}},R=y=>y.done?h(y.value):Promise.resolve(y.value).then(T,M);R((l=l.apply(m,c)).next())});const xe=(0,k.default)(F._)`
|
|
2
2
|
opacity: 0;
|
|
3
3
|
position: absolute;
|
|
4
4
|
top: 0;
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
left: 0;
|
|
7
7
|
right: 0;
|
|
8
8
|
z-index: 1;
|
|
9
|
-
`,ft=({setLocalImage:m,goTo:c,next:l,onClose:h})=>{const{formatMessage:u}=(0,Q.useIntl)(),[T,M]=(0,e.useState)(!1),[R,y]=(0,e.useState)(void 0),D=(0,e.useRef)(null),fe=()=>M(!0),ue=()=>M(!1),qe=tt=>{tt.preventDefault(),D.current.click()},pt=()=>J(void 0,null,function*(){ue();const tt=D.current.files[0];if(!!tt)try{const lt=yield Ce(tt);m(lt),c(l)}catch(lt){if(lt.displayMessage)y(u(lt.displayMessage,{size:I,dimension:k})),D.current.focus();else throw lt}}),at=()=>T?"primary500":R?"danger600":"neutral300";return e.createElement(e.Fragment,null,e.createElement("form",null,e.createElement(A.x,{paddingLeft:8,paddingRight:8,paddingTop:6,paddingBottom:6},e.createElement(ie.g,{name:"logo-upload",error:R},e.createElement("label",{htmlFor:"logo-upload"},e.createElement(Oe.K,{spacing:2},e.createElement(ge.k,{paddingTop:9,paddingBottom:7,hasRadius:!0,justifyContent:"center",direction:"column",background:T?"primary100":"neutral100",borderColor:at(),borderStyle:"dashed",borderWidth:"1px",position:"relative",onDragEnter:fe,onDragLeave:ue},e.createElement(Ye.J,{color:"primary600",width:`${60/16}rem`,height:`${60/16}rem`,as:te.Z,"aria-hidden":!0}),e.createElement(A.x,{paddingTop:3,paddingBottom:5},e.createElement(Y.Z,{variant:"delta",as:"span"},u({id:"Settings.application.customization.modal.upload.drag-drop",defaultMessage:"Drag and Drop here or"}))),e.createElement(xe,{accept:H,cursor:"pointer",as:"input",type:"file",name:"files",tabIndex:-1,zIndex:1,onChange:pt,ref:D,id:"logo-upload"}),e.createElement(K.z,{type:"button",onClick:qe},u({id:"Settings.application.customization.modal.upload.cta.browse",defaultMessage:"Browse files"})),e.createElement(A.x,{paddingTop:6},e.createElement(Y.Z,{variant:"pi",textColor:"neutral600"},u({id:"Settings.application.customization.modal.upload.file-validation",defaultMessage:"Max dimension: {dimension}x{dimension}, Max size: {size}KB"},{size:I,dimension:k})))),e.createElement(Z.c,null)))))),e.createElement(Ge.m,{startActions:e.createElement(K.z,{onClick:h,variant:"tertiary"},u({id:"Settings.application.customization.modal.cancel",defaultMessage:"Cancel"}))}))};ft.defaultProps={next:null},ft.propTypes={goTo:f().func.isRequired,next:f().string,onClose:f().func.isRequired,setLocalImage:f().func.isRequired};const Nt=ft;var Zt=n(10369),$t=n(43653),Wt=n.n($t),ut=(m,c,l)=>new Promise((h,u)=>{var T=y=>{try{R(l.next(y))}catch(D){u(D)}},M=y=>{try{R(l.throw(y))}catch(D){u(D)}},R=y=>y.done?h(y.value):Promise.resolve(y.value).then(T,M);R((l=l.apply(m,c)).next())});const bt=m=>ut(void 0,null,function*(){try{const c=yield Wt().get(m,{responseType:"blob",timeout:8e3});return new File([c.data],c.config.url,{type:c.headers["content-type"]})}catch(c){throw c.displayMessage={id:"Settings.application.customization.modal.upload.error-network",defaultMessage:"Network error"},c}});var oo=(m,c,l)=>new Promise((h,u)=>{var T=y=>{try{R(l.next(y))}catch(D){u(D)}},M=y=>{try{R(l.throw(y))}catch(D){u(D)}},R=y=>y.done?h(y.value):Promise.resolve(y.value).then(T,M);R((l=l.apply(m,c)).next())});const ht=({goTo:m,next:c,onClose:l,setLocalImage:h})=>{const{formatMessage:u}=(0,Q.useIntl)(),[T,M]=(0,e.useState)(""),[R,y]=(0,e.useState)(null),D=ue=>{M(ue.target.value)},fe=()=>oo(void 0,null,function*(){try{const ue=yield bt(T),qe=yield Ce(ue);h(qe),m(c)}catch(ue){if(ue.displayMessage)y(u(ue.displayMessage,{size:I,dimension:k}));else throw ue}});return e.createElement("form",{onSubmit:ue=>{ue.preventDefault(),fe()}},e.createElement(A.x,{paddingLeft:8,paddingRight:8,paddingTop:6,paddingBottom:6},e.createElement(Zt.o,{label:u({id:"Settings.application.customization.modal.upload.from-url.input-label",defaultMessage:"URL"}),error:R,onChange:D,value:T,name:"logo-url"})),e.createElement(Ge.m,{startActions:e.createElement(K.z,{onClick:l,variant:"tertiary"},u({id:"app.components.Button.cancel",defaultMessage:"Cancel"})),endActions:e.createElement(K.z,{type:"submit"},u({id:"Settings.application.customization.modal.upload.next",defaultMessage:"Next"}))}))};ht.defaultProps={next:null},ht.propTypes={goTo:f().func.isRequired,next:f().string,onClose:f().func.isRequired,setLocalImage:f().func.isRequired};const ao=ht,St=({setLocalImage:m,goTo:c,next:l,onClose:h})=>{const{formatMessage:u}=(0,Q.useIntl)();return e.createElement(W.v,{label:u({id:"Settings.application.customization.modal.tab.label",defaultMessage:"How do you want to upload your assets?"}),variant:"simple"},e.createElement(A.x,{paddingLeft:8,paddingRight:8},e.createElement(X.m,null,e.createElement(X.O,null,u({id:"Settings.application.customization.modal.upload.from-computer",defaultMessage:"From computer"})),e.createElement(X.O,null,u({id:"Settings.application.customization.modal.upload.from-url",defaultMessage:"From url"}))),e.createElement(De.i,null)),e.createElement(pe.n,null,e.createElement(pe.x,null,e.createElement(Nt,{onClose:h,setLocalImage:m,goTo:c,next:l})),e.createElement(pe.x,null,e.createElement(ao,{onClose:h,setLocalImage:m,goTo:c,next:l}))))};St.defaultProps={next:null},St.propTypes={goTo:f().func.isRequired,next:f().string,onClose:f().func.isRequired,setLocalImage:f().func.isRequired};const fn=St;var Ut=n(42466),hn=n(20853),vn=n(2800),Vt=n(26835),yn=n(41048),Pt=n(37083),kt=n(11505);const Dt=({asset:m})=>{const{formatMessage:c}=(0,Q.useIntl)();return e.createElement(Ut.Z,null,e.createElement(hn.O,null,e.createElement(vn.H,{size:"S",src:m.url})),e.createElement(Vt.e,null,e.createElement(yn.a,null,e.createElement(Pt.l,null,m.name),e.createElement(Pt._,null,`${m.ext.toUpperCase()} - ${m.width}\u2715${m.height}`)),e.createElement(kt.E,null,c({id:"Settings.application.customization.modal.pending.card-badge",defaultMessage:"image"}))))};Dt.propTypes={asset:f().shape({name:f().string,url:f().string,width:f().number,height:f().number,ext:f().string}).isRequired};const mt=Dt,Gt=({onClose:m,asset:c,prev:l,next:h,goTo:u,setLocalImage:T,onChangeLogo:M})=>{const{formatMessage:R}=(0,Q.useIntl)(),y=()=>{T(void 0),u(l)},D=()=>{M(c),u(h)};return e.createElement(e.Fragment,null,e.createElement(A.x,{paddingLeft:8,paddingRight:8,paddingTop:6,paddingBottom:6},e.createElement(ge.k,{justifyContent:"space-between",paddingBottom:6},e.createElement(ge.k,{direction:"column",alignItems:"flex-start"},e.createElement(Y.Z,{variant:"pi",fontWeight:"bold"},R({id:"Settings.application.customization.modal.pending.title",defaultMessage:"Logo ready to upload"})),e.createElement(Y.Z,{variant:"pi",textColor:"neutral500"},R({id:"Settings.application.customization.modal.pending.subtitle",defaultMessage:"Manage the chosen logo before uploading it"}))),e.createElement(K.z,{onClick:y,variant:"secondary"},R({id:"Settings.application.customization.modal.pending.choose-another",defaultMessage:"Choose another logo"}))),e.createElement(A.x,{maxWidth:(0,C.pxToRem)(180)},e.createElement(mt,{asset:c}))),e.createElement(Ge.m,{startActions:e.createElement(K.z,{onClick:m,variant:"tertiary"},R({id:"Settings.application.customization.modal.cancel",defaultMessage:"Cancel"})),endActions:e.createElement(K.z,{onClick:D},R({id:"Settings.application.customization.modal.pending.upload",defaultMessage:"Upload logo"}))}))};Gt.defaultProps={next:null,prev:null},Gt.propTypes={goTo:f().func.isRequired,asset:f().shape({name:f().string,url:f().string,width:f().number,height:f().number,ext:f().string}).isRequired,next:f().string,onClose:f().func.isRequired,onChangeLogo:f().func.isRequired,prev:f().string,setLocalImage:f().func.isRequired};const it={upload:{Component:fn,modalTitle:{id:"Settings.application.customization.modal.upload",defaultMessage:"Upload logo"},next:"pending",prev:null},pending:{Component:Gt,modalTitle:{id:"Settings.application.customization.modal.pending",defaultMessage:"Pending logo"},next:null,prev:"upload"}},Ht=({customLogo:m,defaultLogo:c,onChangeLogo:l,onResetMenuLogo:h})=>{const[{currentStep:u},T]=(0,e.useReducer)(st,Qe),{Component:M,next:R,prev:y,modalTitle:D}=it[u]||{},{formatMessage:fe}=(0,Q.useIntl)(),ue=qe=>{T({type:"GO_TO",to:qe})};return e.createElement(e.Fragment,null,e.createElement(_e.F,{label:fe({id:"Settings.application.customization.carousel.title",defaultMessage:"Logo"}),selectedSlide:0,hint:fe({id:"Settings.application.customization.carousel-hint",defaultMessage:"Change the admin panel logo (Max dimension: {dimension}x{dimension}, Max file size: {size}KB)"},{size:I,dimension:k}),previousLabel:"",nextLabel:"",onNext:()=>{},onPrevious:()=>{},secondaryLabel:(m==null?void 0:m.name)||"logo.png",actions:e.createElement(Xe.b,null,e.createElement(je.h,{onClick:()=>ue(m?"pending":"upload"),label:fe({id:"Settings.application.customization.carousel.change-action",defaultMessage:"Change logo"}),icon:e.createElement(Ne.default,null)}),m&&e.createElement(je.h,{onClick:h,label:fe({id:"Settings.application.customization.carousel.reset-action",defaultMessage:"Reset logo"}),icon:e.createElement(Ue.Z,null)}))},e.createElement(be.q,{label:fe({id:"Settings.application.customization.carousel-slide.label",defaultMessage:"Logo slide"})},e.createElement(A.x,{maxHeight:"40%",maxWidth:"40%",as:"img",src:(m==null?void 0:m.url)||c,alt:fe({id:"Settings.application.customization.carousel.title",defaultMessage:"Logo"})}))),e.createElement($,{Component:M,currentStep:u,onChangeLogo:l,customLogo:m,goTo:ue,next:R,prev:y,modalTitle:D}))};Ht.defaultProps={customLogo:null},Ht.propTypes={customLogo:f().shape({url:f().string,name:f().string}),defaultLogo:f().string.isRequired,onChangeLogo:f().func.isRequired,onResetMenuLogo:f().func.isRequired};const Cn=Ht,Mt={menuLogo:{display:null,submit:{rawFile:null,isReset:!1}}},vt=(m=Mt,c)=>(0,Ze.default)(m,l=>{switch(c.type){case"SET_CUSTOM_MENU_LOGO":{l.menuLogo.display=c.value,l.menuLogo.submit.rawFile=c.value.rawFile;break}case"RESET_CUSTOM_MENU_LOGO":{l.menuLogo.display=null,l.menuLogo.submit={rawFile:null,isReset:!0};break}default:return l}});var so=n(86349),yt=n.n(so);const Xt=(m,c)=>yt()(m,{menuLogo:{display:c.menuLogo}}),Tt=(0,e.forwardRef)(({projectSettingsStored:m},c)=>{const{formatMessage:l}=(0,Q.useIntl)(),{trackUsage:h}=(0,C.useTracking)(),{logos:{menu:u}}=(0,_.um)(),[{menuLogo:T},M]=(0,e.useReducer)(vt,Mt,()=>Xt(Mt,m)),R=D=>{M({type:"SET_CUSTOM_MENU_LOGO",value:D})},y=()=>{h("didClickResetLogo"),M({type:"RESET_CUSTOM_MENU_LOGO"})};return(0,e.useImperativeHandle)(c,()=>({getValues:()=>({menuLogo:T.submit})})),e.createElement(A.x,{hasRadius:!0,background:"neutral0",shadow:"tableShadow",paddingTop:6,paddingBottom:6,paddingRight:7,paddingLeft:7},e.createElement(Y.Z,{variant:"delta",as:"h3"},l({id:"Settings.application.customization",defaultMessage:"Customization"})),e.createElement(P.r,{paddingTop:4},e.createElement(Be.P,{col:6,s:12},e.createElement(Cn,{onChangeLogo:R,customLogo:T.display,defaultLogo:u.default,onResetMenuLogo:y}))))});Tt.defaultProps={projectSettingsStored:null},Tt.propTypes={projectSettingsStored:f().shape({menuLogo:f().shape({url:f().string,name:f().string})})};const bn=Tt;var Lt=n(17247),Qt=n(48344),Yt=n.n(Qt),Sn=Object.defineProperty,Jt=Object.defineProperties,Pn=Object.getOwnPropertyDescriptors,Tn=Object.getOwnPropertySymbols,An=Object.prototype.hasOwnProperty,qt=Object.prototype.propertyIsEnumerable,_t=(m,c,l)=>c in m?Sn(m,c,{enumerable:!0,configurable:!0,writable:!0,value:l}):m[c]=l,en=(m,c)=>{for(var l in c||(c={}))An.call(c,l)&&_t(m,l,c[l]);if(Tn)for(var l of Tn(c))qt.call(c,l)&&_t(m,l,c[l]);return m},Rn=(m,c)=>Jt(m,Pn(c));const tn=m=>Yt()(m,(c,l,h)=>{l&&l.url?c[h]=Rn(en({},l),{url:(0,C.prefixFileUrlWithBackendUrl)(l.url)}):c[h]=l},{});var On=(m,c,l)=>new Promise((h,u)=>{var T=y=>{try{R(l.next(y))}catch(D){u(D)}},M=y=>{try{R(l.throw(y))}catch(D){u(D)}},R=y=>y.done?h(y.value):Promise.resolve(y.value).then(T,M);R((l=l.apply(m,c)).next())});const nn=()=>On(void 0,null,function*(){const{data:m}=yield Lt.be.get("/admin/project-settings");return tn(m)}),Dn=m=>On(void 0,null,function*(){const{data:c}=yield Lt.be.post("/admin/project-settings",m);return tn(c)}),Mn=m=>{const c=new FormData;return Object.entries(m).forEach(([l,h])=>{h&&h.rawFile instanceof File&&c.append(l,h.rawFile),h&&h.isReset&&c.append(l,null)}),c};var on=(m,c,l)=>new Promise((h,u)=>{var T=y=>{try{R(l.next(y))}catch(D){u(D)}},M=y=>{try{R(l.throw(y))}catch(D){u(D)}},R=y=>y.done?h(y.value):Promise.resolve(y.value).then(T,M);R((l=l.apply(m,c)).next())});const Ln=[{action:"admin::project-settings.update",subject:null}],an=()=>{const m=(0,e.useRef)(),c=(0,C.useNotification)(),{trackUsage:l}=(0,C.useTracking)(),{formatMessage:h}=(0,Q.useIntl)(),u=(0,Ae.useQueryClient)();(0,C.useFocusWhenNavigate)();const T=(0,C.useAppInfos)(),{shouldUpdateStrapi:M,latestStrapiReleaseTag:R,strapiVersion:y}=T,{updateProjectSettings:D}=(0,_.um)(),{data:fe}=(0,Ae.useQuery)("project-settings",nn),ue=T.communityEdition?"app.components.UpgradePlanModal.text-ce":"app.components.UpgradePlanModal.text-ee",qe=(0,Ae.useMutation)(at=>Dn(at),{onSuccess(at){return on(this,arguments,function*({menuLogo:tt}){yield u.invalidateQueries("project-settings",{refetchActive:!0}),D({menuLogo:tt==null?void 0:tt.url})})}}),pt=()=>{const at=m.current.getValues(),tt=Mn(at);qe.mutate(tt,{onSuccess(){const{menuLogo:lt}=at;lt.rawFile&&l("didChangeLogo")},onError(){c({type:"warning",message:{id:"notification.error",defaultMessage:"An error occurred"}})}})};return e.createElement(oe.A,null,e.createElement(C.SettingsPageTitle,{name:"Application"}),e.createElement(V.o,null,e.createElement(Re.T,{title:h({id:"Settings.application.title",defaultMessage:"Overview"}),subtitle:h({id:"Settings.application.description",defaultMessage:"Administration panel\u2019s global information"}),primaryAction:e.createElement(K.z,{onClick:pt,startIcon:e.createElement(x.Z,null)},h({id:"global.save",defaultMessage:"Save"}))}),e.createElement(He.D,null,e.createElement(Oe.K,{spacing:6},e.createElement(A.x,{hasRadius:!0,background:"neutral0",shadow:"tableShadow",paddingTop:6,paddingBottom:6,paddingRight:7,paddingLeft:7},e.createElement(Oe.K,{spacing:5},e.createElement(Y.Z,{variant:"delta",as:"h3"},h({id:"global.details",defaultMessage:"Details"})),e.createElement(P.r,{paddingTop:1},e.createElement(Be.P,{col:6,s:12},e.createElement(Y.Z,{variant:"sigma",textColor:"neutral600"},h({id:"Settings.application.strapiVersion",defaultMessage:"strapi version"})),e.createElement(Y.Z,{as:"p"},"v",y),e.createElement(ze.r,{href:T.communityEdition?"https://discord.strapi.io":"https://support.strapi.io/support/home",isExternal:!0,endIcon:e.createElement(re.default,null)},h({id:"Settings.application.get-help",defaultMessage:"Get help"}))),e.createElement(Be.P,{col:6,s:12},e.createElement(Y.Z,{variant:"sigma",textColor:"neutral600"},h({id:"Settings.application.edition-title",defaultMessage:"current plan"})),e.createElement(Y.Z,{as:"p"},h({id:ue,defaultMessage:`${T.communityEdition?"Community Edition":"Enterprise Edition"}`})))),e.createElement(P.r,{paddingTop:1},e.createElement(Be.P,{col:6,s:12},M&&e.createElement(ze.r,{href:`https://github.com/strapi/strapi/releases/tag/${R}`,isExternal:!0,endIcon:e.createElement(re.default,null)},h({id:"Settings.application.link-upgrade",defaultMessage:"Upgrade your admin panel"}))),e.createElement(Be.P,{col:6,s:12},e.createElement(ze.r,{href:"https://strapi.io/pricing-self-hosted",isExternal:!0,endIcon:e.createElement(re.default,null)},h({id:"Settings.application.link-pricing",defaultMessage:"See all pricing plans"})))),e.createElement(A.x,{paddingTop:1},e.createElement(Y.Z,{variant:"sigma",textColor:"neutral600"},h({id:"Settings.application.node-version",defaultMessage:"node version"})),e.createElement(Y.Z,{as:"p"},T.nodeVersion)))),fe&&e.createElement(C.CheckPermissions,{permissions:Ln},e.createElement(bn,{ref:m,projectSettingsStored:fe}))))))};var xn=n(3704),In=n.n(xn);const Fn=m=>In()(m,l=>l.links).map(l=>(0,Te.ot)(l.Component,l.to,l.exact||!1)),wn=m=>m.filter(c=>!c.links.every(l=>l.isDisplayed===!1));var It=n(15685),et=n(52136),Bn=n(33997),de=n.n(Bn),sn=function(){return window&&window.strapi&&window.strapi.isEE?n(20178).Z:n(16329).Z}(),jn=function(){return window&&window.strapi&&window.strapi.isEE?n(51899).Z:n(45677).Z}(),Nn=[{Component:function(){return{default:jn}},to:"/settings/roles",exact:!0},{Component:function(){return{default:sn}},to:"/settings/roles/duplicate/:id",exact:!0},{Component:function(){return{default:sn}},to:"/settings/roles/new",exact:!0},{Component:function(){return(0,et.Z)(de().mark(function c(){var l;return de().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return u.next=2,n.e(2544).then(n.bind(n,33778));case 2:return l=u.sent,u.abrupt("return",l);case 4:case"end":return u.stop()}},c)}))()},to:"/settings/roles/:id",exact:!0},{Component:function(){return(0,et.Z)(de().mark(function c(){var l;return de().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return u.next=2,n.e(5199).then(n.bind(n,15519));case 2:return l=u.sent,u.abrupt("return",l);case 4:case"end":return u.stop()}},c)}))()},to:"/settings/users",exact:!0},{Component:function(){return(0,et.Z)(de().mark(function c(){var l;return de().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return u.next=2,n.e(4263).then(n.bind(n,34669));case 2:return l=u.sent,u.abrupt("return",l);case 4:case"end":return u.stop()}},c)}))()},to:"/settings/users/:id",exact:!0},{Component:function(){return(0,et.Z)(de().mark(function c(){var l;return de().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return u.next=2,n.e(5162).then(n.bind(n,33238));case 2:return l=u.sent,u.abrupt("return",l);case 4:case"end":return u.stop()}},c)}))()},to:"/settings/webhooks/create",exact:!0},{Component:function(){return(0,et.Z)(de().mark(function c(){var l;return de().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return u.next=2,n.e(5162).then(n.bind(n,59021));case 2:return l=u.sent,u.abrupt("return",l);case 4:case"end":return u.stop()}},c)}))()},to:"/settings/webhooks/:id",exact:!0},{Component:function(){return(0,et.Z)(de().mark(function c(){var l;return de().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return u.next=2,n.e(4121).then(n.bind(n,74767));case 2:return l=u.sent,u.abrupt("return",l);case 4:case"end":return u.stop()}},c)}))()},to:"/settings/webhooks",exact:!0},{Component:function(){return(0,et.Z)(de().mark(function c(){var l;return de().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return u.next=2,n.e(8056).then(n.bind(n,83782));case 2:return l=u.sent,u.abrupt("return",l);case 4:case"end":return u.stop()}},c)}))()},to:"/settings/api-tokens",exact:!0},{Component:function(){return(0,et.Z)(de().mark(function c(){var l;return de().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return u.next=2,Promise.all([n.e(8633),n.e(4318),n.e(4299)]).then(n.bind(n,3330));case 2:return l=u.sent,u.abrupt("return",l);case 4:case"end":return u.stop()}},c)}))()},to:"/settings/api-tokens/create",exact:!0},{Component:function(){return(0,et.Z)(de().mark(function c(){var l;return de().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return u.next=2,Promise.all([n.e(8633),n.e(4318),n.e(92)]).then(n.bind(n,97841));case 2:return l=u.sent,u.abrupt("return",l);case 4:case"end":return u.stop()}},c)}))()},to:"/settings/api-tokens/:id",exact:!0}];const Ft=Nn;var Zn=function(){return window&&window.strapi&&window.strapi.isEE?n(63775).Z:n(75936).Z}();const rn=[].concat((0,It.Z)(Zn),(0,It.Z)(Ft));var ln=n(90700),$n=n(8598),Wn=n(77013),zn=n(79318),Un=n(66618),Vn=Object.defineProperty,cn=Object.defineProperties,kn=Object.getOwnPropertyDescriptors,dn=Object.getOwnPropertySymbols,co=Object.prototype.hasOwnProperty,Gn=Object.prototype.propertyIsEnumerable,wt=(m,c,l)=>c in m?Vn(m,c,{enumerable:!0,configurable:!0,writable:!0,value:l}):m[c]=l,Bt=(m,c)=>{for(var l in c||(c={}))co.call(c,l)&&wt(m,l,c[l]);if(dn)for(var l of dn(c))Gn.call(c,l)&&wt(m,l,c[l]);return m},un=(m,c)=>cn(m,kn(c));const At=({menu:m})=>{const{formatMessage:c}=(0,Q.useIntl)(),h=wn(m).map(T=>un(Bt({},T),{title:T.intlLabel,links:T.links.map(M=>un(Bt({},M),{title:M.intlLabel,name:M.id}))})),u=c({id:"global.settings",defaultMessage:"Settings"});return e.createElement(ln.m,{ariaLabel:u},e.createElement($n.p,{label:u}),e.createElement(Wn.Z,null,h.map(T=>e.createElement(zn.D,{key:T.id,label:c(T.intlLabel)},T.links.map(M=>e.createElement(Un.E,{as:r.NavLink,withBullet:M.hasNotification,to:M.to,key:M.id},c(M.intlLabel)))))))};At.propTypes={menu:f().array.isRequired};const Kn=At;function mn(){const{settingId:m}=(0,r.useParams)(),{settings:c}=(0,C.useStrapiApp)(),{formatMessage:l}=(0,Q.useIntl)(),{isLoading:h,menu:u}=(0,_.Te)(),T=(0,e.useMemo)(()=>(0,Te.WW)(rn.map(({to:y,Component:D,exact:fe})=>(0,Te.ot)(D,y,fe))),[]),M=Fn(c);if(h)return e.createElement(C.LoadingIndicatorPage,null);if(!m)return e.createElement(r.Redirect,{to:"/settings/application-infos"});const R=l({id:"global.settings",defaultMessage:"Settings"});return e.createElement(oe.A,{sideNav:e.createElement(Kn,{menu:u})},e.createElement(We.Helmet,{title:R}),e.createElement(r.Switch,null,e.createElement(r.Route,{path:"/settings/application-infos",component:an,exact:!0}),T,M))}const pn=(0,e.memo)(mn)},16329:(le,O,n)=>{n.d(O,{Z:()=>oe});var e=n(32735),C=n(5141);const oe=()=>e.createElement(C.Redirect,{to:"/404"})},49466:(le,O,n)=>{n.d(O,{Z:()=>C});const C=!0},35123:(le,O,n)=>{n.d(O,{Z:()=>C});const C=!0},18318:(le,O,n)=>{n.d(O,{Z:()=>C});const C=!0},52124:(le,O,n)=>{n.d(O,{Z:()=>C});const C=!0},61526:(le,O,n)=>{n.d(O,{Z:()=>C});const C=!0},78974:(le,O,n)=>{n.d(O,{Z:()=>rs});var e=n(32735),C=n(60216),r=n.n(C),oe=n(88425),Q=n(35540),We=n(39291),_=n(3653),Te=n(23973),Ae=n.n(Te),Re=n(86834),He=n.n(Re),V=n(5636),A=n(62345),P=n(83292),Be=n(98978),Y=n.n(Be),Oe=n(39515),K=n(96441),ze=n(15974),re=n(44426),x=n(36320),ae=n(33795),f=n.n(ae),_e=n(9086),Xe=n.n(_e),be=n(43257),je=n(45112),Ne=n(41415);const Ue=P.default.div`
|
|
9
|
+
`,ft=({setLocalImage:m,goTo:c,next:l,onClose:h})=>{const{formatMessage:u}=(0,Q.useIntl)(),[T,M]=(0,e.useState)(!1),[R,y]=(0,e.useState)(void 0),D=(0,e.useRef)(null),fe=()=>M(!0),ue=()=>M(!1),_e=tt=>{tt.preventDefault(),D.current.click()},pt=()=>J(void 0,null,function*(){ue();const tt=D.current.files[0];if(!!tt)try{const lt=yield Ce(tt);m(lt),c(l)}catch(lt){if(lt.displayMessage)y(u(lt.displayMessage,{size:I,dimension:G})),D.current.focus();else throw lt}}),at=()=>T?"primary500":R?"danger600":"neutral300";return e.createElement(e.Fragment,null,e.createElement("form",null,e.createElement(A.x,{paddingLeft:8,paddingRight:8,paddingTop:6,paddingBottom:6},e.createElement(le.g,{name:"logo-upload",error:R},e.createElement("label",{htmlFor:"logo-upload"},e.createElement(Oe.K,{spacing:2},e.createElement(ge.k,{paddingTop:9,paddingBottom:7,hasRadius:!0,justifyContent:"center",direction:"column",background:T?"primary100":"neutral100",borderColor:at(),borderStyle:"dashed",borderWidth:"1px",position:"relative",onDragEnter:fe,onDragLeave:ue},e.createElement(Ye.J,{color:"primary600",width:`${60/16}rem`,height:`${60/16}rem`,as:te.Z,"aria-hidden":!0}),e.createElement(A.x,{paddingTop:3,paddingBottom:5},e.createElement(Y.Z,{variant:"delta",as:"span"},u({id:"Settings.application.customization.modal.upload.drag-drop",defaultMessage:"Drag and Drop here or"}))),e.createElement(xe,{accept:H,cursor:"pointer",as:"input",type:"file",name:"files",tabIndex:-1,zIndex:1,onChange:pt,ref:D,id:"logo-upload"}),e.createElement(K.z,{type:"button",onClick:_e},u({id:"Settings.application.customization.modal.upload.cta.browse",defaultMessage:"Browse files"})),e.createElement(A.x,{paddingTop:6},e.createElement(Y.Z,{variant:"pi",textColor:"neutral600"},u({id:"Settings.application.customization.modal.upload.file-validation",defaultMessage:"Max dimension: {dimension}x{dimension}, Max size: {size}KB"},{size:I,dimension:G})))),e.createElement(Z.c,null)))))),e.createElement(ke.m,{startActions:e.createElement(K.z,{onClick:h,variant:"tertiary"},u({id:"Settings.application.customization.modal.cancel",defaultMessage:"Cancel"}))}))};ft.defaultProps={next:null},ft.propTypes={goTo:f().func.isRequired,next:f().string,onClose:f().func.isRequired,setLocalImage:f().func.isRequired};const Nt=ft;var Zt=n(10369),$t=n(43653),Wt=n.n($t),ut=(m,c,l)=>new Promise((h,u)=>{var T=y=>{try{R(l.next(y))}catch(D){u(D)}},M=y=>{try{R(l.throw(y))}catch(D){u(D)}},R=y=>y.done?h(y.value):Promise.resolve(y.value).then(T,M);R((l=l.apply(m,c)).next())});const bt=m=>ut(void 0,null,function*(){try{const c=yield Wt().get(m,{responseType:"blob",timeout:8e3});return new File([c.data],c.config.url,{type:c.headers["content-type"]})}catch(c){throw c.displayMessage={id:"Settings.application.customization.modal.upload.error-network",defaultMessage:"Network error"},c}});var oo=(m,c,l)=>new Promise((h,u)=>{var T=y=>{try{R(l.next(y))}catch(D){u(D)}},M=y=>{try{R(l.throw(y))}catch(D){u(D)}},R=y=>y.done?h(y.value):Promise.resolve(y.value).then(T,M);R((l=l.apply(m,c)).next())});const ht=({goTo:m,next:c,onClose:l,setLocalImage:h})=>{const{formatMessage:u}=(0,Q.useIntl)(),[T,M]=(0,e.useState)(""),[R,y]=(0,e.useState)(null),D=ue=>{M(ue.target.value)},fe=()=>oo(void 0,null,function*(){try{const ue=yield bt(T),_e=yield Ce(ue);h(_e),m(c)}catch(ue){if(ue.displayMessage)y(u(ue.displayMessage,{size:I,dimension:G}));else throw ue}});return e.createElement("form",{onSubmit:ue=>{ue.preventDefault(),fe()}},e.createElement(A.x,{paddingLeft:8,paddingRight:8,paddingTop:6,paddingBottom:6},e.createElement(Zt.o,{label:u({id:"Settings.application.customization.modal.upload.from-url.input-label",defaultMessage:"URL"}),error:R,onChange:D,value:T,name:"logo-url"})),e.createElement(ke.m,{startActions:e.createElement(K.z,{onClick:l,variant:"tertiary"},u({id:"app.components.Button.cancel",defaultMessage:"Cancel"})),endActions:e.createElement(K.z,{type:"submit"},u({id:"Settings.application.customization.modal.upload.next",defaultMessage:"Next"}))}))};ht.defaultProps={next:null},ht.propTypes={goTo:f().func.isRequired,next:f().string,onClose:f().func.isRequired,setLocalImage:f().func.isRequired};const ao=ht,St=({setLocalImage:m,goTo:c,next:l,onClose:h})=>{const{formatMessage:u}=(0,Q.useIntl)();return e.createElement(W.v,{label:u({id:"Settings.application.customization.modal.tab.label",defaultMessage:"How do you want to upload your assets?"}),variant:"simple"},e.createElement(A.x,{paddingLeft:8,paddingRight:8},e.createElement(X.m,null,e.createElement(X.O,null,u({id:"Settings.application.customization.modal.upload.from-computer",defaultMessage:"From computer"})),e.createElement(X.O,null,u({id:"Settings.application.customization.modal.upload.from-url",defaultMessage:"From url"}))),e.createElement(De.i,null)),e.createElement(pe.n,null,e.createElement(pe.x,null,e.createElement(Nt,{onClose:h,setLocalImage:m,goTo:c,next:l})),e.createElement(pe.x,null,e.createElement(ao,{onClose:h,setLocalImage:m,goTo:c,next:l}))))};St.defaultProps={next:null},St.propTypes={goTo:f().func.isRequired,next:f().string,onClose:f().func.isRequired,setLocalImage:f().func.isRequired};const fn=St;var Ut=n(42466),hn=n(20853),vn=n(2800),Vt=n(26835),yn=n(41048),Pt=n(37083),Gt=n(11505);const Dt=({asset:m})=>{const{formatMessage:c}=(0,Q.useIntl)();return e.createElement(Ut.Z,null,e.createElement(hn.O,null,e.createElement(vn.H,{size:"S",src:m.url})),e.createElement(Vt.e,null,e.createElement(yn.a,null,e.createElement(Pt.l,null,m.name),e.createElement(Pt._,null,`${m.ext.toUpperCase()} - ${m.width}\u2715${m.height}`)),e.createElement(Gt.E,null,c({id:"Settings.application.customization.modal.pending.card-badge",defaultMessage:"image"}))))};Dt.propTypes={asset:f().shape({name:f().string,url:f().string,width:f().number,height:f().number,ext:f().string}).isRequired};const mt=Dt,kt=({onClose:m,asset:c,prev:l,next:h,goTo:u,setLocalImage:T,onChangeLogo:M})=>{const{formatMessage:R}=(0,Q.useIntl)(),y=()=>{T(void 0),u(l)},D=()=>{M(c),u(h)};return e.createElement(e.Fragment,null,e.createElement(A.x,{paddingLeft:8,paddingRight:8,paddingTop:6,paddingBottom:6},e.createElement(ge.k,{justifyContent:"space-between",paddingBottom:6},e.createElement(ge.k,{direction:"column",alignItems:"flex-start"},e.createElement(Y.Z,{variant:"pi",fontWeight:"bold"},R({id:"Settings.application.customization.modal.pending.title",defaultMessage:"Logo ready to upload"})),e.createElement(Y.Z,{variant:"pi",textColor:"neutral500"},R({id:"Settings.application.customization.modal.pending.subtitle",defaultMessage:"Manage the chosen logo before uploading it"}))),e.createElement(K.z,{onClick:y,variant:"secondary"},R({id:"Settings.application.customization.modal.pending.choose-another",defaultMessage:"Choose another logo"}))),e.createElement(A.x,{maxWidth:(0,C.pxToRem)(180)},e.createElement(mt,{asset:c}))),e.createElement(ke.m,{startActions:e.createElement(K.z,{onClick:m,variant:"tertiary"},R({id:"Settings.application.customization.modal.cancel",defaultMessage:"Cancel"})),endActions:e.createElement(K.z,{onClick:D},R({id:"Settings.application.customization.modal.pending.upload",defaultMessage:"Upload logo"}))}))};kt.defaultProps={next:null,prev:null},kt.propTypes={goTo:f().func.isRequired,asset:f().shape({name:f().string,url:f().string,width:f().number,height:f().number,ext:f().string}).isRequired,next:f().string,onClose:f().func.isRequired,onChangeLogo:f().func.isRequired,prev:f().string,setLocalImage:f().func.isRequired};const it={upload:{Component:fn,modalTitle:{id:"Settings.application.customization.modal.upload",defaultMessage:"Upload logo"},next:"pending",prev:null},pending:{Component:kt,modalTitle:{id:"Settings.application.customization.modal.pending",defaultMessage:"Pending logo"},next:null,prev:"upload"}},Ht=({customLogo:m,defaultLogo:c,onChangeLogo:l,onResetMenuLogo:h})=>{const[{currentStep:u},T]=(0,e.useReducer)(st,Qe),{Component:M,next:R,prev:y,modalTitle:D}=it[u]||{},{formatMessage:fe}=(0,Q.useIntl)(),ue=_e=>{T({type:"GO_TO",to:_e})};return e.createElement(e.Fragment,null,e.createElement(et.F,{label:fe({id:"Settings.application.customization.carousel.title",defaultMessage:"Logo"}),selectedSlide:0,hint:fe({id:"Settings.application.customization.carousel-hint",defaultMessage:"Change the admin panel logo (Max dimension: {dimension}x{dimension}, Max file size: {size}KB)"},{size:I,dimension:G}),previousLabel:"",nextLabel:"",onNext:()=>{},onPrevious:()=>{},secondaryLabel:(m==null?void 0:m.name)||"logo.png",actions:e.createElement(Xe.b,null,e.createElement(je.h,{onClick:()=>ue(m?"pending":"upload"),label:fe({id:"Settings.application.customization.carousel.change-action",defaultMessage:"Change logo"}),icon:e.createElement(Ne.default,null)}),m&&e.createElement(je.h,{onClick:h,label:fe({id:"Settings.application.customization.carousel.reset-action",defaultMessage:"Reset logo"}),icon:e.createElement(Ue.Z,null)}))},e.createElement(be.q,{label:fe({id:"Settings.application.customization.carousel-slide.label",defaultMessage:"Logo slide"})},e.createElement(A.x,{maxHeight:"40%",maxWidth:"40%",as:"img",src:(m==null?void 0:m.url)||c,alt:fe({id:"Settings.application.customization.carousel.title",defaultMessage:"Logo"})}))),e.createElement($,{Component:M,currentStep:u,onChangeLogo:l,customLogo:m,goTo:ue,next:R,prev:y,modalTitle:D}))};Ht.defaultProps={customLogo:null},Ht.propTypes={customLogo:f().shape({url:f().string,name:f().string}),defaultLogo:f().string.isRequired,onChangeLogo:f().func.isRequired,onResetMenuLogo:f().func.isRequired};const Cn=Ht,Mt={menuLogo:{display:null,submit:{rawFile:null,isReset:!1}}},vt=(m=Mt,c)=>(0,Ze.default)(m,l=>{switch(c.type){case"SET_CUSTOM_MENU_LOGO":{l.menuLogo.display=c.value,l.menuLogo.submit.rawFile=c.value.rawFile;break}case"RESET_CUSTOM_MENU_LOGO":{l.menuLogo.display=null,l.menuLogo.submit={rawFile:null,isReset:!0};break}default:return l}});var so=n(86349),yt=n.n(so);const Xt=(m,c)=>yt()(m,{menuLogo:{display:c.menuLogo}}),Tt=(0,e.forwardRef)(({projectSettingsStored:m},c)=>{const{formatMessage:l}=(0,Q.useIntl)(),{trackUsage:h}=(0,C.useTracking)(),{logos:{menu:u}}=(0,_.um)(),[{menuLogo:T},M]=(0,e.useReducer)(vt,Mt,()=>Xt(Mt,m)),R=D=>{M({type:"SET_CUSTOM_MENU_LOGO",value:D})},y=()=>{h("didClickResetLogo"),M({type:"RESET_CUSTOM_MENU_LOGO"})};return(0,e.useImperativeHandle)(c,()=>({getValues:()=>({menuLogo:T.submit})})),e.createElement(A.x,{hasRadius:!0,background:"neutral0",shadow:"tableShadow",paddingTop:6,paddingBottom:6,paddingRight:7,paddingLeft:7},e.createElement(Y.Z,{variant:"delta",as:"h3"},l({id:"Settings.application.customization",defaultMessage:"Customization"})),e.createElement(P.r,{paddingTop:4},e.createElement(Be.P,{col:6,s:12},e.createElement(Cn,{onChangeLogo:R,customLogo:T.display,defaultLogo:u.default,onResetMenuLogo:y}))))});Tt.defaultProps={projectSettingsStored:null},Tt.propTypes={projectSettingsStored:f().shape({menuLogo:f().shape({url:f().string,name:f().string})})};const bn=Tt;var Lt=n(17247),Qt=n(48344),Yt=n.n(Qt),Sn=Object.defineProperty,Jt=Object.defineProperties,Pn=Object.getOwnPropertyDescriptors,Tn=Object.getOwnPropertySymbols,An=Object.prototype.hasOwnProperty,qt=Object.prototype.propertyIsEnumerable,_t=(m,c,l)=>c in m?Sn(m,c,{enumerable:!0,configurable:!0,writable:!0,value:l}):m[c]=l,en=(m,c)=>{for(var l in c||(c={}))An.call(c,l)&&_t(m,l,c[l]);if(Tn)for(var l of Tn(c))qt.call(c,l)&&_t(m,l,c[l]);return m},Rn=(m,c)=>Jt(m,Pn(c));const tn=m=>Yt()(m,(c,l,h)=>{l&&l.url?c[h]=Rn(en({},l),{url:(0,C.prefixFileUrlWithBackendUrl)(l.url)}):c[h]=l},{});var On=(m,c,l)=>new Promise((h,u)=>{var T=y=>{try{R(l.next(y))}catch(D){u(D)}},M=y=>{try{R(l.throw(y))}catch(D){u(D)}},R=y=>y.done?h(y.value):Promise.resolve(y.value).then(T,M);R((l=l.apply(m,c)).next())});const nn=()=>On(void 0,null,function*(){const{data:m}=yield Lt.be.get("/admin/project-settings");return tn(m)}),Dn=m=>On(void 0,null,function*(){const{data:c}=yield Lt.be.post("/admin/project-settings",m);return tn(c)}),Mn=m=>{const c=new FormData;return Object.entries(m).forEach(([l,h])=>{h&&h.rawFile instanceof File&&c.append(l,h.rawFile),h&&h.isReset&&c.append(l,null)}),c};var on=(m,c,l)=>new Promise((h,u)=>{var T=y=>{try{R(l.next(y))}catch(D){u(D)}},M=y=>{try{R(l.throw(y))}catch(D){u(D)}},R=y=>y.done?h(y.value):Promise.resolve(y.value).then(T,M);R((l=l.apply(m,c)).next())});const Ln=[{action:"admin::project-settings.update",subject:null}],an=()=>{const m=(0,e.useRef)(),c=(0,C.useNotification)(),{trackUsage:l}=(0,C.useTracking)(),{formatMessage:h}=(0,Q.useIntl)(),u=(0,Ae.useQueryClient)();(0,C.useFocusWhenNavigate)();const T=(0,C.useAppInfos)(),{shouldUpdateStrapi:M,latestStrapiReleaseTag:R,strapiVersion:y}=T,{updateProjectSettings:D}=(0,_.um)(),{data:fe}=(0,Ae.useQuery)("project-settings",nn),ue=T.communityEdition?"app.components.UpgradePlanModal.text-ce":"app.components.UpgradePlanModal.text-ee",_e=(0,Ae.useMutation)(at=>Dn(at),{onSuccess(at){return on(this,arguments,function*({menuLogo:tt}){yield u.invalidateQueries("project-settings",{refetchActive:!0}),D({menuLogo:tt==null?void 0:tt.url})})}}),pt=()=>{const at=m.current.getValues(),tt=Mn(at);_e.mutate(tt,{onSuccess(){const{menuLogo:lt}=at;lt.rawFile&&l("didChangeLogo")},onError(){c({type:"warning",message:{id:"notification.error",defaultMessage:"An error occurred"}})}})};return e.createElement(oe.A,null,e.createElement(C.SettingsPageTitle,{name:"Application"}),e.createElement(V.o,null,e.createElement(Re.T,{title:h({id:"Settings.application.title",defaultMessage:"Overview"}),subtitle:h({id:"Settings.application.description",defaultMessage:"Administration panel\u2019s global information"}),primaryAction:e.createElement(K.z,{onClick:pt,startIcon:e.createElement(x.Z,null)},h({id:"global.save",defaultMessage:"Save"}))}),e.createElement(He.D,null,e.createElement(Oe.K,{spacing:6},e.createElement(A.x,{hasRadius:!0,background:"neutral0",shadow:"tableShadow",paddingTop:6,paddingBottom:6,paddingRight:7,paddingLeft:7},e.createElement(Oe.K,{spacing:5},e.createElement(Y.Z,{variant:"delta",as:"h3"},h({id:"global.details",defaultMessage:"Details"})),e.createElement(P.r,{paddingTop:1},e.createElement(Be.P,{col:6,s:12},e.createElement(Y.Z,{variant:"sigma",textColor:"neutral600"},h({id:"Settings.application.strapiVersion",defaultMessage:"strapi version"})),e.createElement(Y.Z,{as:"p"},"v",y),e.createElement(ze.r,{href:T.communityEdition?"https://discord.strapi.io":"https://support.strapi.io/support/home",isExternal:!0,endIcon:e.createElement(ie.default,null)},h({id:"Settings.application.get-help",defaultMessage:"Get help"}))),e.createElement(Be.P,{col:6,s:12},e.createElement(Y.Z,{variant:"sigma",textColor:"neutral600"},h({id:"Settings.application.edition-title",defaultMessage:"current plan"})),e.createElement(Y.Z,{as:"p"},h({id:ue,defaultMessage:`${T.communityEdition?"Community Edition":"Enterprise Edition"}`})))),e.createElement(P.r,{paddingTop:1},e.createElement(Be.P,{col:6,s:12},M&&e.createElement(ze.r,{href:`https://github.com/strapi/strapi/releases/tag/${R}`,isExternal:!0,endIcon:e.createElement(ie.default,null)},h({id:"Settings.application.link-upgrade",defaultMessage:"Upgrade your admin panel"}))),e.createElement(Be.P,{col:6,s:12},e.createElement(ze.r,{href:"https://strapi.io/pricing-self-hosted",isExternal:!0,endIcon:e.createElement(ie.default,null)},h({id:"Settings.application.link-pricing",defaultMessage:"See all pricing plans"})))),e.createElement(A.x,{paddingTop:1},e.createElement(Y.Z,{variant:"sigma",textColor:"neutral600"},h({id:"Settings.application.node-version",defaultMessage:"node version"})),e.createElement(Y.Z,{as:"p"},T.nodeVersion)))),fe&&e.createElement(C.CheckPermissions,{permissions:Ln},e.createElement(bn,{ref:m,projectSettingsStored:fe}))))))};var xn=n(3704),In=n.n(xn);const Fn=m=>In()(m,l=>l.links).map(l=>(0,Te.ot)(l.Component,l.to,l.exact||!1)),wn=m=>m.filter(c=>!c.links.every(l=>l.isDisplayed===!1));var It=n(21930),qe=n(18950),Bn=n(72975),se=n.n(Bn),sn=function(){return window&&window.strapi&&window.strapi.isEE?n(20178).Z:n(16329).Z}(),jn=function(){return window&&window.strapi&&window.strapi.isEE?n(51899).Z:n(45677).Z}(),Nn=[{Component:function(){return{default:jn}},to:"/settings/roles",exact:!0},{Component:function(){return{default:sn}},to:"/settings/roles/duplicate/:id",exact:!0},{Component:function(){return{default:sn}},to:"/settings/roles/new",exact:!0},{Component:function(){return(0,qe.Z)(se().mark(function c(){var l;return se().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return u.next=2,n.e(2544).then(n.bind(n,33778));case 2:return l=u.sent,u.abrupt("return",l);case 4:case"end":return u.stop()}},c)}))()},to:"/settings/roles/:id",exact:!0},{Component:function(){return(0,qe.Z)(se().mark(function c(){var l;return se().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return u.next=2,n.e(5199).then(n.bind(n,31904));case 2:return l=u.sent,u.abrupt("return",l);case 4:case"end":return u.stop()}},c)}))()},to:"/settings/users",exact:!0},{Component:function(){return(0,qe.Z)(se().mark(function c(){var l;return se().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return u.next=2,n.e(4263).then(n.bind(n,40874));case 2:return l=u.sent,u.abrupt("return",l);case 4:case"end":return u.stop()}},c)}))()},to:"/settings/users/:id",exact:!0},{Component:function(){return(0,qe.Z)(se().mark(function c(){var l;return se().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return u.next=2,n.e(4310).then(n.bind(n,62884));case 2:return l=u.sent,u.abrupt("return",l);case 4:case"end":return u.stop()}},c)}))()},to:"/settings/audit-logs",exact:!0},{Component:function(){return(0,qe.Z)(se().mark(function c(){var l;return se().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return u.next=2,n.e(5162).then(n.bind(n,33238));case 2:return l=u.sent,u.abrupt("return",l);case 4:case"end":return u.stop()}},c)}))()},to:"/settings/webhooks/create",exact:!0},{Component:function(){return(0,qe.Z)(se().mark(function c(){var l;return se().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return u.next=2,n.e(5162).then(n.bind(n,59021));case 2:return l=u.sent,u.abrupt("return",l);case 4:case"end":return u.stop()}},c)}))()},to:"/settings/webhooks/:id",exact:!0},{Component:function(){return(0,qe.Z)(se().mark(function c(){var l;return se().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return u.next=2,n.e(4121).then(n.bind(n,74767));case 2:return l=u.sent,u.abrupt("return",l);case 4:case"end":return u.stop()}},c)}))()},to:"/settings/webhooks",exact:!0},{Component:function(){return(0,qe.Z)(se().mark(function c(){var l;return se().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return u.next=2,n.e(8056).then(n.bind(n,83782));case 2:return l=u.sent,u.abrupt("return",l);case 4:case"end":return u.stop()}},c)}))()},to:"/settings/api-tokens",exact:!0},{Component:function(){return(0,qe.Z)(se().mark(function c(){var l;return se().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return u.next=2,Promise.all([n.e(8633),n.e(4318),n.e(4299)]).then(n.bind(n,3330));case 2:return l=u.sent,u.abrupt("return",l);case 4:case"end":return u.stop()}},c)}))()},to:"/settings/api-tokens/create",exact:!0},{Component:function(){return(0,qe.Z)(se().mark(function c(){var l;return se().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return u.next=2,Promise.all([n.e(8633),n.e(4318),n.e(92)]).then(n.bind(n,97841));case 2:return l=u.sent,u.abrupt("return",l);case 4:case"end":return u.stop()}},c)}))()},to:"/settings/api-tokens/:id",exact:!0}];const Ft=Nn;var Zn=function(){return window&&window.strapi&&window.strapi.isEE?n(63775).Z:n(75936).Z}();const rn=[].concat((0,It.Z)(Zn),(0,It.Z)(Ft));var ln=n(90700),$n=n(8598),Wn=n(77013),zn=n(79318),Un=n(66618),Vn=Object.defineProperty,cn=Object.defineProperties,Gn=Object.getOwnPropertyDescriptors,dn=Object.getOwnPropertySymbols,co=Object.prototype.hasOwnProperty,kn=Object.prototype.propertyIsEnumerable,wt=(m,c,l)=>c in m?Vn(m,c,{enumerable:!0,configurable:!0,writable:!0,value:l}):m[c]=l,Bt=(m,c)=>{for(var l in c||(c={}))co.call(c,l)&&wt(m,l,c[l]);if(dn)for(var l of dn(c))kn.call(c,l)&&wt(m,l,c[l]);return m},un=(m,c)=>cn(m,Gn(c));const At=({menu:m})=>{const{formatMessage:c}=(0,Q.useIntl)(),h=wn(m).map(T=>un(Bt({},T),{title:T.intlLabel,links:T.links.map(M=>un(Bt({},M),{title:M.intlLabel,name:M.id}))})),u=c({id:"global.settings",defaultMessage:"Settings"});return e.createElement(ln.m,{ariaLabel:u},e.createElement($n.p,{label:u}),e.createElement(Wn.Z,null,h.map(T=>e.createElement(zn.D,{key:T.id,label:c(T.intlLabel)},T.links.map(M=>e.createElement(Un.E,{as:r.NavLink,withBullet:M.hasNotification,to:M.to,key:M.id},c(M.intlLabel)))))))};At.propTypes={menu:f().array.isRequired};const Kn=At;function mn(){const{settingId:m}=(0,r.useParams)(),{settings:c}=(0,C.useStrapiApp)(),{formatMessage:l}=(0,Q.useIntl)(),{isLoading:h,menu:u}=(0,_.Te)(),T=(0,e.useMemo)(()=>(0,Te.WW)(rn.map(({to:y,Component:D,exact:fe})=>(0,Te.ot)(D,y,fe))),[]),M=Fn(c);if(h)return e.createElement(C.LoadingIndicatorPage,null);if(!m)return e.createElement(r.Redirect,{to:"/settings/application-infos"});const R=l({id:"global.settings",defaultMessage:"Settings"});return e.createElement(oe.A,{sideNav:e.createElement(Kn,{menu:u})},e.createElement(We.Helmet,{title:R}),e.createElement(r.Switch,null,e.createElement(r.Route,{path:"/settings/application-infos",component:an,exact:!0}),T,M))}const pn=(0,e.memo)(mn)},16329:(ce,O,n)=>{n.d(O,{Z:()=>oe});var e=n(32735),C=n(5141);const oe=()=>e.createElement(C.Redirect,{to:"/404"})},49466:(ce,O,n)=>{n.d(O,{Z:()=>C});const C=!0},35123:(ce,O,n)=>{n.d(O,{Z:()=>C});const C=!0},18318:(ce,O,n)=>{n.d(O,{Z:()=>C});const C=!0},52124:(ce,O,n)=>{n.d(O,{Z:()=>C});const C=!0},61526:(ce,O,n)=>{n.d(O,{Z:()=>C});const C=!0},37511:(ce,O,n)=>{n.d(O,{Z:()=>rs});var e=n(32735),C=n(60216),r=n.n(C),oe=n(88425),Q=n(35540),We=n(39291),_=n(3653),Te=n(23973),Ae=n.n(Te),Re=n(86834),He=n.n(Re),V=n(5636),A=n(62345),P=n(83292),Be=n(98978),Y=n.n(Be),Oe=n(92577),K=n(96441),ze=n(15974),ie=n(44426),x=n(36320),ae=n(33795),f=n.n(ae),et=n(9086),Xe=n.n(et),be=n(775),je=n(45112),Ne=n(41415);const Ue=P.default.div`
|
|
10
10
|
position: relative;
|
|
11
11
|
|
|
12
12
|
${({hasConditions:a,disabled:t,theme:o})=>a&&`
|
|
@@ -21,14 +21,14 @@
|
|
|
21
21
|
background: ${t?o.colors.neutral100:o.colors.primary600};
|
|
22
22
|
}
|
|
23
23
|
`}
|
|
24
|
-
`,Ze=({onClick:a,className:t,hasConditions:o,variant:s})=>{const{formatMessage:i}=(0,V.useIntl)();return e.createElement(Ue,{hasConditions:o,className:t},e.createElement(Ne.z,{variant:s,startIcon:e.createElement(je.Z,null),onClick:a},i({id:"global.settings",defaultMessage:"Settings"})))};Ze.defaultProps={className:null,hasConditions:!1,variant:"tertiary"},Ze.propTypes={onClick:r().func.isRequired,className:r().string,hasConditions:r().bool,variant:r().string};const Qe=(0,P.default)(Ze)``;var dt=n(85025),st=n(55225),nt=n(31600),rt=n(11406),ne=n(11299),me=n(88860),Ve=n(97889),ee=n(81346),$=n.n(ee),
|
|
24
|
+
`,Ze=({onClick:a,className:t,hasConditions:o,variant:s})=>{const{formatMessage:i}=(0,V.useIntl)();return e.createElement(Ue,{hasConditions:o,className:t},e.createElement(Ne.z,{variant:s,startIcon:e.createElement(je.Z,null),onClick:a},i({id:"global.settings",defaultMessage:"Settings"})))};Ze.defaultProps={className:null,hasConditions:!1,variant:"tertiary"},Ze.propTypes={onClick:r().func.isRequired,className:r().string,hasConditions:r().bool,variant:r().string};const Qe=(0,P.default)(Ze)``;var dt=n(85025),st=n(55225),nt=n(31600),rt=n(11406),ne=n(11299),me=n(88860),Ve=n(97889),ee=n(81346),$=n.n(ee),G=n(23940),I=n.n(G),H=n(27799),W=Object.defineProperty,X=Object.getOwnPropertySymbols,pe=Object.prototype.hasOwnProperty,De=Object.prototype.propertyIsEnumerable,k=(a,t,o)=>t in a?W(a,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):a[t]=o,ge=(a,t)=>{for(var o in t||(t={}))pe.call(t,o)&&k(a,o,t[o]);if(X)for(var o of X(t))De.call(t,o)&&k(a,o,t[o]);return a};const Ye=a=>Object.values(a).map(t=>Object.entries(t).filter(([,o])=>o).map(([o])=>o)).flat(),ke=a=>a.reduce((t,[o,s])=>(t.push({label:I()(o),children:s.map(i=>({label:i.displayName,value:i.id}))}),t),[]),F=(a,t)=>a.map(([,o])=>o).flat().reduce((o,s)=>ge({[s.id]:t.includes(s.id)},o),{});var le=function(){return window&&window.strapi&&window.strapi.isEE?n(56899).Z:n(49466).Z}(),Z=function(t){var o=t.arrayOfOptionsGroupedByCategory,s=t.isFormDisabled,i=t.isGrey,d=t.label,p=t.name,g=t.onChange,E=t.value,b=(0,V.useIntl)(),S=b.formatMessage,L=function(z){g(p,F(o,z))};return e.createElement(x.k,{as:"li",background:i?"neutral100":"neutral0",paddingBottom:3,paddingTop:3},e.createElement(x.k,{paddingLeft:6,style:{width:180}},e.createElement(me.Z,{variant:"sigma",textColor:"neutral600"},S({id:"Settings.permissions.conditions.can",defaultMessage:"Can"}),"\xA0"),e.createElement(me.Z,{variant:"sigma",title:d,textColor:"primary600",ellipsis:!0},S({id:"Settings.roles.form.permissions.".concat(d.toLowerCase()),defaultMessage:d})),e.createElement(me.Z,{variant:"sigma",textColor:"neutral600"},"\xA0",S({id:"Settings.permissions.conditions.when",defaultMessage:"When"}))),e.createElement(A.x,{style:{maxWidth:430,width:"100%"}},e.createElement(H.Q,{id:p,customizeContent:function(z){return"".concat(z.length," currently selected")},onChange:L,value:Ye(E),options:ke(o),disabled:s||le})))};Z.propTypes={arrayOfOptionsGroupedByCategory:r().array.isRequired,isFormDisabled:r().bool.isRequired,isGrey:r().bool.isRequired,label:r().string.isRequired,name:r().string.isRequired,value:r().object.isRequired,onChange:r().func.isRequired};const te=Z;var v=n(92891);const ye=(a,t)=>a.reduce((o,s)=>(o[s.id]=(0,v.get)(t,s.id,!1),o),{}),de=(a,t)=>a.reduce((o,s)=>{const[i,d]=s,p=ye(d,t);return o[i]=p,o},{}),ot=(a,t,o)=>a.reduce((s,i)=>{const d=(0,v.get)(t,[...i.pathToConditionsObject,"conditions"],{}),p=de(o,d);return s[i.pathToConditionsObject.join("..")]=p,s},{});var Ce=Object.defineProperty,J=Object.getOwnPropertySymbols,xe=Object.prototype.hasOwnProperty,ft=Object.prototype.propertyIsEnumerable,Nt=(a,t,o)=>t in a?Ce(a,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):a[t]=o,Zt=(a,t)=>{for(var o in t||(t={}))xe.call(t,o)&&Nt(a,o,t[o]);if(J)for(var o of J(t))ft.call(t,o)&&Nt(a,o,t[o]);return a};const $t=({actions:a,headerBreadCrumbs:t,isFormDisabled:o,onClosed:s,onToggle:i})=>{const{formatMessage:d}=(0,V.useIntl)(),{availableConditions:p,modifiedData:g,onChangeConditions:E}=(0,be.$_)(),b=(0,e.useMemo)(()=>Object.entries($()(p,"category")),[p]),S=a.filter(({isDisplayed:w,hasSomeActionsSelected:N,hasAllActionsSelected:q})=>w&&(N||q)),L=(0,e.useMemo)(()=>ot(S,g,b),[S,g,b]),[B,z]=(0,e.useState)(L),j=(w,N)=>{z((0,Ve.default)(q=>{q[w]||(q[w]={}),q[w].default||(q[w].default={}),q[w].default=N}))},U=()=>{const w=Object.entries(B).reduce((N,q)=>{const[he,Ke]=q,Me=Object.values(Ke).reduce((Se,Ie)=>Zt(Zt({},Se),Ie),{});return N[he]=Me,N},{});E(w),i()};return e.createElement(dt.P,{labelledBy:"condition-modal-breadcrumbs",onClose:s},e.createElement(st.x,null,e.createElement(ne.O,{id:"condition-modal-breadcrumbs",label:t.join(", ")},t.map(w=>e.createElement(ne.$,{key:w},I()(d({id:w,defaultMessage:w})))))),e.createElement(nt.f,null,S.length===0&&e.createElement(me.Z,null,d({id:"Settings.permissions.conditions.no-actions",defaultMessage:"You first need to select actions (create, read, update, ...) before defining conditions on them."})),e.createElement("ul",null,S.map(({actionId:w,label:N,pathToConditionsObject:q},he)=>{const Ke=q.join("..");return e.createElement(te,{key:w,arrayOfOptionsGroupedByCategory:b,label:N,isFormDisabled:o,isGrey:he%2===0,name:Ke,onChange:j,value:f()(B,Ke,{})})}))),e.createElement(rt.m,{startActions:e.createElement(Ne.z,{variant:"tertiary",onClick:i},d({id:"app.components.Button.cancel",defaultMessage:"Cancel"})),endActions:e.createElement(Ne.z,{onClick:U},d({id:"Settings.permissions.conditions.apply",defaultMessage:"Apply"}))}))};$t.propTypes={actions:r().arrayOf(r().shape({actionId:r().string.isRequired,checkboxName:r().string,hasSomeActionsSelected:r().bool.isRequired,hasAllActionsSelected:r().bool,isDisplayed:r().bool.isRequired,label:r().string})).isRequired,headerBreadCrumbs:r().arrayOf(r().string).isRequired,isFormDisabled:r().bool.isRequired,onClosed:r().func.isRequired,onToggle:r().func.isRequired};const Wt=$t,ut=`${120/16}rem`,zt=`${200/16}rem`,bt=`${53/16}rem`,ht=P.default.div`
|
|
25
25
|
width: ${ut};
|
|
26
26
|
`,St=(0,P.default)(x.k)`
|
|
27
27
|
padding-right: ${({theme:a})=>a.spaces[2]};
|
|
28
28
|
overflow: hidden;
|
|
29
29
|
flex: 1;
|
|
30
30
|
${({isCollapsable:a})=>a&&"cursor: pointer;"}
|
|
31
|
-
`;var fn=Object.defineProperty,Ut=Object.getOwnPropertySymbols,hn=Object.prototype.hasOwnProperty,vn=Object.prototype.propertyIsEnumerable,Vt=(a,t,o)=>t in a?fn(a,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):a[t]=o,yn=(a,t)=>{for(var o in t||(t={}))hn.call(t,o)&&Vt(a,o,t[o]);if(Ut)for(var o of Ut(t))vn.call(t,o)&&Vt(a,o,t[o]);return a};const Pt=({children:a,isCollapsable:t,isActive:o,isFormDisabled:s,label:i,onChange:d,onClick:p,checkboxName:g,someChecked:E,value:b})=>{const{formatMessage:S}=(0,V.useIntl)();return e.createElement(x.k,{alignItems:"center",paddingLeft:6,style:{width:zt,flexShrink:0}},e.createElement(A.x,{paddingRight:2},e.createElement(
|
|
31
|
+
`;var fn=Object.defineProperty,Ut=Object.getOwnPropertySymbols,hn=Object.prototype.hasOwnProperty,vn=Object.prototype.propertyIsEnumerable,Vt=(a,t,o)=>t in a?fn(a,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):a[t]=o,yn=(a,t)=>{for(var o in t||(t={}))hn.call(t,o)&&Vt(a,o,t[o]);if(Ut)for(var o of Ut(t))vn.call(t,o)&&Vt(a,o,t[o]);return a};const Pt=({children:a,isCollapsable:t,isActive:o,isFormDisabled:s,label:i,onChange:d,onClick:p,checkboxName:g,someChecked:E,value:b})=>{const{formatMessage:S}=(0,V.useIntl)();return e.createElement(x.k,{alignItems:"center",paddingLeft:6,style:{width:zt,flexShrink:0}},e.createElement(A.x,{paddingRight:2},e.createElement(ie.C,{name:g,"aria-label":S({id:"Settings.permissions.select-all-by-permission",defaultMessage:"Select all {label} permissions"},{label:i}),disabled:s,onValueChange:L=>d({target:{name:g,value:L}}),indeterminate:E,value:b})),e.createElement(St,yn({title:i,alignItems:"center",isCollapsable:t},t&&{onClick:p,"aria-expanded":o,onKeyDown:({key:L})=>(L==="Enter"||L===" ")&&p(),tabIndex:0,role:"button"}),e.createElement(me.Z,{fontWeight:o?"bold":"",textColor:o?"primary600":"neutral800",ellipsis:!0},I()(i)),a))};Pt.defaultProps={children:null,checkboxName:"",onChange(){},value:!1,someChecked:!1,isCollapsable:!1},Pt.propTypes={checkboxName:r().string,children:r().node,label:r().string.isRequired,isCollapsable:r().bool,isFormDisabled:r().bool.isRequired,onChange:r().func,onClick:r().func.isRequired,someChecked:r().bool,value:r().bool,isActive:r().bool.isRequired};const Gt=(0,e.memo)(Pt),Dt=a=>(0,v.isObject)(a)?(0,v.flattenDeep)(Object.values(a).map(t=>(0,v.isObject)(t)?Dt(t):t)):[],mt=Dt,Kt=a=>a?Object.keys(a).reduce((t,o)=>(o!=="conditions"&&(t[o]=a[o]),t),{}):null,it=a=>{const t=Kt(a),o=mt(t);if(!o.length)return{hasAllActionsSelected:!1,hasSomeActionsSelected:!1};const s=o.every(d=>d),i=o.some(d=>d)&&!s;return{hasAllActionsSelected:s,hasSomeActionsSelected:i}},Cn=(a,t,o)=>a.map(({actionId:s,isDisplayed:i,applyToProperties:d,label:p})=>{if(!i)return{actionId:s,hasSomeActionsSelected:!1,isDisplayed:i};const g=[...o.split(".."),s],E=(0,v.isEmpty)(d)?[...g,"properties","enabled"]:g,b=E.join(".."),S=(0,v.get)(t,[...g,"conditions"],null),L=mt(S).some(U=>U);if((0,v.isEmpty)(d)){const U=(0,v.get)(t,E,!1);return{actionId:s,checkboxName:b,hasAllActionsSelected:U,hasConditions:L,hasSomeActionsSelected:U,isDisplayed:i,isParentCheckbox:!1,label:p,pathToConditionsObject:g}}const B=(0,v.get)(t,E,null),{hasAllActionsSelected:z,hasSomeActionsSelected:j}=it(B);return{actionId:s,checkboxName:b,hasAllActionsSelected:z,hasConditions:L,hasSomeActionsSelected:j,isDisplayed:i,isParentCheckbox:!0,label:p,pathToConditionsObject:g}});var Mt=n(16899);const vt=(0,P.default)(Mt.default)`
|
|
32
32
|
display: none;
|
|
33
33
|
width: ${10/16}rem;
|
|
34
34
|
transform: rotate(${({$isActive:a})=>a?"180":"0"}deg);
|
|
@@ -64,17 +64,17 @@
|
|
|
64
64
|
`).concat(function(s){var i=s.theme,d=s.isActive;return a(i,d)},`
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
`)},Tt=P.default.div.withConfig({displayName:"Collapse__Wrapper",componentId:"sc-132fji1-0"})(["flex:1;display:flex;align-items:center;height:",";background-color:",";border:1px solid transparent;"],bt,function(a){var t=a.isGrey,o=a.theme;return t?o.colors.neutral100:o.colors.neutral0}),bn=P.default.div.withConfig({displayName:"Collapse__BoxWrapper",componentId:"sc-132fji1-1"})(["display:inline-flex;min-width:100%;","{display:none;}"," &:hover{","}"],Qe,function(a){var t=a.isActive,o=a.theme;return t&&Xt(o,t)},function(a){var t=a.theme,o=a.isActive;return Xt(t,o)}),Lt=(0,P.default)(x.k).withConfig({displayName:"Collapse__Cell",componentId:"sc-132fji1-2"})(["width:",";position:relative;"],ut),Qt=(0,P.default)(A.x).withConfig({displayName:"Collapse__Chevron",componentId:"sc-132fji1-3"})(["display:none;svg{width:11px;}*{fill:",";}"],function(a){var t=a.theme;return t.colors.primary600}),Yt=P.default.span.withConfig({displayName:"Collapse__TinyDot",componentId:"sc-132fji1-4"})(["position:absolute;top:-6px;left:37px;width:6px;height:6px;border-radius:20px;background:",";"],function(a){var t=a.theme;return t.colors.primary600}),Sn=(0,P.default)(A.x).withConfig({displayName:"Collapse__AbsoluteBox",componentId:"sc-132fji1-5"})(["position:absolute;right:9px;transform:translateY(10px);"]),Jt=function(t){var o=t.availableActions,s=t.isActive,i=t.isGrey,d=t.isFormDisabled,p=t.label,g=t.onClickToggle,E=t.pathToData,b=(0,e.useState)(!1),S=(0,Oe.Z)(b,2),L=S[0],B=S[1],z=(0,V.useIntl)(),j=z.formatMessage,U=(0,be.$_)(),w=U.modifiedData,N=U.onChangeParentCheckbox,q=U.onChangeSimpleCheckbox,he=function(){B(function(Ee){return!Ee})},Ke=function(){B(!1)},Me=f()(w,E.split(".."),{}),Se=(0,e.useMemo)(function(){return Object.keys(Me).reduce(function(
|
|
67
|
+
`)},Tt=P.default.div.withConfig({displayName:"Collapse__Wrapper",componentId:"sc-132fji1-0"})(["flex:1;display:flex;align-items:center;height:",";background-color:",";border:1px solid transparent;"],bt,function(a){var t=a.isGrey,o=a.theme;return t?o.colors.neutral100:o.colors.neutral0}),bn=P.default.div.withConfig({displayName:"Collapse__BoxWrapper",componentId:"sc-132fji1-1"})(["display:inline-flex;min-width:100%;","{display:none;}"," &:hover{","}"],Qe,function(a){var t=a.isActive,o=a.theme;return t&&Xt(o,t)},function(a){var t=a.theme,o=a.isActive;return Xt(t,o)}),Lt=(0,P.default)(x.k).withConfig({displayName:"Collapse__Cell",componentId:"sc-132fji1-2"})(["width:",";position:relative;"],ut),Qt=(0,P.default)(A.x).withConfig({displayName:"Collapse__Chevron",componentId:"sc-132fji1-3"})(["display:none;svg{width:11px;}*{fill:",";}"],function(a){var t=a.theme;return t.colors.primary600}),Yt=P.default.span.withConfig({displayName:"Collapse__TinyDot",componentId:"sc-132fji1-4"})(["position:absolute;top:-6px;left:37px;width:6px;height:6px;border-radius:20px;background:",";"],function(a){var t=a.theme;return t.colors.primary600}),Sn=(0,P.default)(A.x).withConfig({displayName:"Collapse__AbsoluteBox",componentId:"sc-132fji1-5"})(["position:absolute;right:9px;transform:translateY(10px);"]),Jt=function(t){var o=t.availableActions,s=t.isActive,i=t.isGrey,d=t.isFormDisabled,p=t.label,g=t.onClickToggle,E=t.pathToData,b=(0,e.useState)(!1),S=(0,Oe.Z)(b,2),L=S[0],B=S[1],z=(0,V.useIntl)(),j=z.formatMessage,U=(0,be.$_)(),w=U.modifiedData,N=U.onChangeParentCheckbox,q=U.onChangeSimpleCheckbox,he=function(){B(function(Ee){return!Ee})},Ke=function(){B(!1)},Me=f()(w,E.split(".."),{}),Se=(0,e.useMemo)(function(){return Object.keys(Me).reduce(function(re,Ee){return re[Ee]=Xe()(Me[Ee],"conditions"),re},{})},[Me]),Ie=it(Se),Le=Ie.hasAllActionsSelected,Ct=Ie.hasSomeActionsSelected,ve=(0,e.useMemo)(function(){return Cn(o,w,E)},[o,w,E]),Fe=ve.some(function(re){var Ee=re.hasConditions;return Ee});return e.createElement(bn,{isActive:s},e.createElement(Tt,{isGrey:i},e.createElement(Gt,{isCollapsable:!0,isFormDisabled:d,label:p,checkboxName:E,onChange:N,onClick:g,someChecked:Ct,value:Le,isActive:s},e.createElement(Qt,{paddingLeft:2},s?e.createElement(ze.Z,null):e.createElement(K.Z,null))),e.createElement(x.k,{style:{flex:1}},ve.map(function(re){var Ee=re.actionId,Pe=re.hasConditions,we=re.hasAllActionsSelected,$e=re.hasSomeActionsSelected,gt=re.isDisplayed,Ge=re.isParentCheckbox,ct=re.checkboxName,Rt=re.label;return gt?Ge?e.createElement(Lt,{key:Ee,justifyContent:"center",alignItems:"center"},Pe&&e.createElement(Yt,null),e.createElement(ie.C,{disabled:d||En,name:ct,"aria-label":j({id:"Settings.permissions.select-by-permission",defaultMessage:"Select {label} permission"},{label:"".concat(Rt," ").concat(p)}),onValueChange:function(Et){N({target:{name:ct,value:Et}})},indeterminate:$e,value:we})):e.createElement(Lt,{key:Ee,justifyContent:"center",alignItems:"center"},Pe&&e.createElement(Yt,null),e.createElement(ie.C,{disabled:d||En,indeterminate:Pe,name:ct,onValueChange:function(Et){q({target:{name:ct,value:Et}})},value:we})):e.createElement(ht,{key:Ee})})),L&&e.createElement(Wt,{headerBreadCrumbs:[p,"Settings.permissions.conditions.conditions"],actions:ve,isFormDisabled:d,onClosed:Ke,onToggle:he})),e.createElement(Sn,null,e.createElement(Qe,{onClick:he,hasConditions:Fe})))};Jt.propTypes={availableActions:r().array.isRequired,isActive:r().bool.isRequired,isGrey:r().bool.isRequired,isFormDisabled:r().bool.isRequired,label:r().string.isRequired,onClickToggle:r().func.isRequired,pathToData:r().string.isRequired};const Pn=Jt,An=(a,t)=>a.map(o=>{const s=Array.isArray(o.applyToProperties)&&o.applyToProperties.indexOf(t)!==-1&&o.isDisplayed;return{label:o.label,actionId:o.actionId,isActionRelatedToCurrentProperty:s}}),qt=(0,P.default)(x.k)`
|
|
68
68
|
width: ${ut};
|
|
69
69
|
flex-shrink: 0;
|
|
70
70
|
`,_t=(0,P.default)(x.k)`
|
|
71
71
|
width: ${zt};
|
|
72
72
|
height: ${bt};
|
|
73
73
|
flex-shrink: 0;
|
|
74
|
-
`,en=({headers:a,label:t})=>{const{formatMessage:o}=(0,V.useIntl)(),s=o({id:"Settings.roles.form.permission.property-label",defaultMessage:"{label} permissions"},{label:t});return e.createElement(x.k,null,e.createElement(_t,{alignItems:"center",paddingLeft:6},e.createElement(me.Z,{variant:"sigma",textColor:"neutral500"},s)),a.map(i=>i.isActionRelatedToCurrentProperty?e.createElement(qt,{justifyContent:"center",key:i.label},e.createElement(me.Z,{variant:"sigma",textColor:"neutral500"},o({id:`Settings.roles.form.permissions.${i.label.toLowerCase()}`,defaultMessage:i.label}))):e.createElement(qt,{key:i.label})))};en.propTypes={headers:r().arrayOf(r().shape({label:r().string.isRequired,isActionRelatedToCurrentProperty:r().bool.isRequired})).isRequired,label:r().string.isRequired};const Rn=en;var xt=n(
|
|
74
|
+
`,en=({headers:a,label:t})=>{const{formatMessage:o}=(0,V.useIntl)(),s=o({id:"Settings.roles.form.permission.property-label",defaultMessage:"{label} permissions"},{label:t});return e.createElement(x.k,null,e.createElement(_t,{alignItems:"center",paddingLeft:6},e.createElement(me.Z,{variant:"sigma",textColor:"neutral500"},s)),a.map(i=>i.isActionRelatedToCurrentProperty?e.createElement(qt,{justifyContent:"center",key:i.label},e.createElement(me.Z,{variant:"sigma",textColor:"neutral500"},o({id:`Settings.roles.form.permissions.${i.label.toLowerCase()}`,defaultMessage:i.label}))):e.createElement(qt,{key:i.label})))};en.propTypes={headers:r().arrayOf(r().shape({label:r().string.isRequired,isActionRelatedToCurrentProperty:r().bool.isRequired})).isRequired,label:r().string.isRequired};const Rn=en;var xt=n(21930);const tn=P.default.span`
|
|
75
75
|
color: ${({theme:a})=>a.colors.danger700};
|
|
76
76
|
padding-left: ${({theme:a})=>a.spaces[1]}px;
|
|
77
|
-
`,nn=()=>e.createElement(tn,null,"*");var Dn=Object.defineProperty,ro=Object.defineProperties,Mn=Object.getOwnPropertyDescriptors,on=Object.getOwnPropertySymbols,Ln=Object.prototype.hasOwnProperty,io=Object.prototype.propertyIsEnumerable,an=(a,t,o)=>t in a?Dn(a,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):a[t]=o,xn=(a,t)=>{for(var o in t||(t={}))Ln.call(t,o)&&an(a,o,t[o]);if(on)for(var o of on(t))io.call(t,o)&&an(a,o,t[o]);return a},In=(a,t)=>ro(a,Mn(t));const Fn=(a,t)=>a.map(o=>{const s=Array.isArray(o.subjects)&&o.subjects.indexOf(t)!==-1;return In(xn({},o),{isDisplayed:s})});var lo=n(
|
|
77
|
+
`,nn=()=>e.createElement(tn,null,"*");var Dn=Object.defineProperty,ro=Object.defineProperties,Mn=Object.getOwnPropertyDescriptors,on=Object.getOwnPropertySymbols,Ln=Object.prototype.hasOwnProperty,io=Object.prototype.propertyIsEnumerable,an=(a,t,o)=>t in a?Dn(a,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):a[t]=o,xn=(a,t)=>{for(var o in t||(t={}))Ln.call(t,o)&&an(a,o,t[o]);if(on)for(var o of on(t))io.call(t,o)&&an(a,o,t[o]);return a},In=(a,t)=>ro(a,Mn(t));const Fn=(a,t)=>a.map(o=>{const s=Array.isArray(o.subjects)&&o.subjects.indexOf(t)!==-1;return In(xn({},o),{isDisplayed:s})});var lo=n(20011),wn=Object.defineProperty,It=Object.getOwnPropertySymbols,qe=Object.prototype.hasOwnProperty,Bn=Object.prototype.propertyIsEnumerable,se=(a,t,o)=>t in a?wn(a,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):a[t]=o,sn=(a,t)=>{for(var o in t||(t={}))qe.call(t,o)&&se(a,o,t[o]);if(It)for(var o of It(t))Bn.call(t,o)&&se(a,o,t[o]);return a};const jn=(0,P.default)(A.x)`
|
|
78
78
|
transform: translate(-4px, -12px);
|
|
79
79
|
|
|
80
80
|
&:before {
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
&:hover {
|
|
101
101
|
`).concat(yt(o),`
|
|
102
102
|
}
|
|
103
|
-
`)},function(a){var t=a.isActive,o=a.theme;return t&&yt(o)}),Vn=P.default.div.withConfig({displayName:"SubActionRow__TopTimeline",componentId:"sc-7y8yzq-5"})(["padding-top:",";margin-top:",";width:","rem;background-color:",";border-top-left-radius:2px;border-top-right-radius:2px;"],function(a){var t=a.theme;return t.spaces[2]},function(a){var t=a.theme;return t.spaces[2]},4/16,function(a){var t=a.theme;return t.colors.primary200}),cn=function a(t){var o=t.childrenForm,s=t.isFormDisabled,i=t.recursiveLevel,d=t.pathToDataFromActionRow,p=t.propertyActions,g=t.parentName,E=t.propertyName,b=(0,V.useIntl)(),S=b.formatMessage,L=(0,be.$_)(),B=L.modifiedData,z=L.onChangeParentCheckbox,j=L.onChangeSimpleCheckbox,U=(0,e.useState)(null),w=(0,Oe.Z)(U,2),N=w[0],q=w[1],he=function(Se){q(function(Ie){return Ie===Se?null:Se})},Ke=(0,e.useMemo)(function(){return N?o.find(function(Me){var Se=Me.value;return Se===N}):null},[N,o]);return e.createElement(Wn,null,e.createElement(Vn,null),o.map(function(Me,Se){var Ie=Me.label,Le=Me.value,Ct=Me.required,ve=Me.children,Fe=Se+1<o.length,
|
|
103
|
+
`)},function(a){var t=a.isActive,o=a.theme;return t&&yt(o)}),Vn=P.default.div.withConfig({displayName:"SubActionRow__TopTimeline",componentId:"sc-7y8yzq-5"})(["padding-top:",";margin-top:",";width:","rem;background-color:",";border-top-left-radius:2px;border-top-right-radius:2px;"],function(a){var t=a.theme;return t.spaces[2]},function(a){var t=a.theme;return t.spaces[2]},4/16,function(a){var t=a.theme;return t.colors.primary200}),cn=function a(t){var o=t.childrenForm,s=t.isFormDisabled,i=t.recursiveLevel,d=t.pathToDataFromActionRow,p=t.propertyActions,g=t.parentName,E=t.propertyName,b=(0,V.useIntl)(),S=b.formatMessage,L=(0,be.$_)(),B=L.modifiedData,z=L.onChangeParentCheckbox,j=L.onChangeSimpleCheckbox,U=(0,e.useState)(null),w=(0,Oe.Z)(U,2),N=w[0],q=w[1],he=function(Se){q(function(Ie){return Ie===Se?null:Se})},Ke=(0,e.useMemo)(function(){return N?o.find(function(Me){var Se=Me.value;return Se===N}):null},[N,o]);return e.createElement(Wn,null,e.createElement(Vn,null),o.map(function(Me,Se){var Ie=Me.label,Le=Me.value,Ct=Me.required,ve=Me.children,Fe=Se+1<o.length,re=Array.isArray(ve),Ee=N===Le;return e.createElement(zn,{key:Le,isVisible:Fe},e.createElement($n,null,e.createElement(Zn,{color:"primary200"}),e.createElement(x.k,{style:{flex:1}},e.createElement(Un,{level:i,isActive:Ee,isCollapsable:re},e.createElement(St,(0,lo.Z)({alignItems:"center",isCollapsable:re},re&&{onClick:function(){return he(Le)},"aria-expanded":Ee,onKeyDown:function(we){var $e=we.key;return($e==="Enter"||$e===" ")&&he(Le)},tabIndex:0,role:"button"},{title:Ie}),e.createElement(me.Z,{ellipsis:!0},I()(Ie)),Ct&&e.createElement(nn,null),e.createElement(vt,{$isActive:Ee}))),e.createElement(x.k,{style:{flex:1}},p.map(function(Pe){var we=Pe.actionId,$e=Pe.label,gt=Pe.isActionRelatedToCurrentProperty;if(!gt)return e.createElement(ht,{key:we});var Ge=[].concat((0,xt.Z)(d.split("..")),[we,"properties",E],(0,xt.Z)(g.split("..")),[Le]),ct=f()(B,Ge,!1);if(!ve)return e.createElement(ln,{key:$e,justifyContent:"center",alignItems:"center"},e.createElement(ie.C,{disabled:s||rn,name:Ge.join(".."),"aria-label":S({id:"Settings.permissions.select-by-permission",defaultMessage:"Select {label} permission"},{label:"".concat(g," ").concat(Ie," ").concat($e)}),onValueChange:function(jt){j({target:{name:Ge.join(".."),value:jt}})},value:ct}));var Rt=it(ct),Ot=Rt.hasAllActionsSelected,Et=Rt.hasSomeActionsSelected;return e.createElement(ln,{key:$e,justifyContent:"center",alignItems:"center"},e.createElement(ie.C,{key:$e,disabled:s||rn,name:Ge.join(".."),"aria-label":S({id:"Settings.permissions.select-by-permission",defaultMessage:"Select {label} permission"},{label:"".concat(g," ").concat(Ie," ").concat($e)}),onValueChange:function(jt){z({target:{name:Ge.join(".."),value:jt}})},value:Ot,indeterminate:Et}))})))),Ke&&Ee&&e.createElement(A.x,{paddingBottom:2},e.createElement(a,{isFormDisabled:s,parentName:"".concat(g,"..").concat(Le),pathToDataFromActionRow:d,propertyActions:p,propertyName:E,recursiveLevel:i+1,childrenForm:Ke.children})))}))};cn.propTypes={childrenForm:r().array.isRequired,isFormDisabled:r().bool.isRequired,parentName:r().string.isRequired,pathToDataFromActionRow:r().string.isRequired,propertyActions:r().array.isRequired,propertyName:r().string.isRequired,recursiveLevel:r().number.isRequired};const Gn=(0,e.memo)(cn),dn=a=>a.reduce((o,s)=>(s.isActionRelatedToCurrentProperty&&o.push(s.actionId),o),[]),kn=(a,t,o,s,i)=>{const p=dn(a).reduce((g,E)=>{const b=[...o.split(".."),E,"properties",s,i],S=(0,v.get)(t,b,!1);return g[E]=S,g},{});return it(p)};var wt=function(){return window&&window.strapi&&window.strapi.isEE?n(32741).Z:n(18318).Z}(),Bt=(0,P.default)(x.k).withConfig({displayName:"ActionRow__Cell",componentId:"sc-4agenc-0"})(["width:",";position:relative;"],ut),un=(0,P.default)(x.k).withConfig({displayName:"ActionRow__Wrapper",componentId:"sc-4agenc-1"})(["height:",";flex:1;"," ",";"],bt,function(a){var t=a.isCollapsable,o=a.theme;return t&&`
|
|
104
104
|
`.concat(vt,` {
|
|
105
105
|
display: block;
|
|
106
106
|
color: `).concat(o.colors.neutral100,`;
|
|
@@ -108,7 +108,7 @@
|
|
|
108
108
|
&:hover {
|
|
109
109
|
`).concat(yt(o),`
|
|
110
110
|
}
|
|
111
|
-
`)},function(a){var t=a.isActive,o=a.theme;return t&&yt(o)}),At=function(t){var o=t.childrenForm,s=t.label,i=t.isFormDisabled,d=t.name,p=t.required,g=t.pathToData,E=t.propertyActions,b=t.propertyName,S=t.isOdd,L=(0,V.useIntl)(),B=L.formatMessage,z=(0,e.useState)(null),j=(0,Oe.Z)(z,2),U=j[0],w=j[1],N=(0,be.$_)(),q=N.modifiedData,he=N.onChangeCollectionTypeLeftActionRowCheckbox,Ke=N.onChangeParentCheckbox,Me=N.onChangeSimpleCheckbox,Se=U===d,Ie=(0,e.useMemo)(function(){return Array.isArray(o)?o:[]},[o]),Le=Ie.length>0,Ct=(0,e.useCallback)(function(){Le&&w(function(Pe){return Pe===d?null:d})},[Le,d]),ve=function(we){var $e=we.target.value;he(g,b,d,$e)},Fe=(0,e.useMemo)(function(){return
|
|
111
|
+
`)},function(a){var t=a.isActive,o=a.theme;return t&&yt(o)}),At=function(t){var o=t.childrenForm,s=t.label,i=t.isFormDisabled,d=t.name,p=t.required,g=t.pathToData,E=t.propertyActions,b=t.propertyName,S=t.isOdd,L=(0,V.useIntl)(),B=L.formatMessage,z=(0,e.useState)(null),j=(0,Oe.Z)(z,2),U=j[0],w=j[1],N=(0,be.$_)(),q=N.modifiedData,he=N.onChangeCollectionTypeLeftActionRowCheckbox,Ke=N.onChangeParentCheckbox,Me=N.onChangeSimpleCheckbox,Se=U===d,Ie=(0,e.useMemo)(function(){return Array.isArray(o)?o:[]},[o]),Le=Ie.length>0,Ct=(0,e.useCallback)(function(){Le&&w(function(Pe){return Pe===d?null:d})},[Le,d]),ve=function(we){var $e=we.target.value;he(g,b,d,$e)},Fe=(0,e.useMemo)(function(){return kn(E,q,g,b,d)},[E,q,g,b,d]),re=Fe.hasAllActionsSelected,Ee=Fe.hasSomeActionsSelected;return e.createElement(e.Fragment,null,e.createElement(un,{alignItems:"center",isCollapsable:Le,isActive:Se,background:S?"neutral100":"neutral0"},e.createElement(x.k,null,e.createElement(Gt,{onChange:ve,onClick:Ct,isCollapsable:Le,isFormDisabled:i,label:s,someChecked:Ee,value:re,isActive:Se},p&&e.createElement(nn,null),e.createElement(vt,{$isActive:Se})),e.createElement(x.k,null,E.map(function(Pe){var we=Pe.label,$e=Pe.isActionRelatedToCurrentProperty,gt=Pe.actionId;if(!$e)return e.createElement(ht,{key:we});var Ge=[].concat((0,xt.Z)(g.split("..")),[gt,"properties",b,d]);if(!Le){var ct=f()(q,Ge,!1);return e.createElement(Bt,{key:gt,justifyContent:"center",alignItems:"center"},e.createElement(ie.C,{disabled:i||wt,name:Ge.join(".."),"aria-label":B({id:"Settings.permissions.select-by-permission",defaultMessage:"Select {label} permission"},{label:"".concat(d," ").concat(we)}),onValueChange:function(no){Me({target:{name:Ge.join(".."),value:no}})},value:ct}))}var Rt=f()(q,Ge,{}),Ot=it(Rt),Et=Ot.hasAllActionsSelected,to=Ot.hasSomeActionsSelected;return e.createElement(Bt,{key:we,justifyContent:"center",alignItems:"center"},e.createElement(ie.C,{disabled:i||wt,name:Ge.join(".."),onValueChange:function(no){Ke({target:{name:Ge.join(".."),value:no}})},"aria-label":B({id:"Settings.permissions.select-by-permission",defaultMessage:"Select {label} permission"},{label:"".concat(d," ").concat(we)}),value:Et,indeterminate:to}))})))),Se&&e.createElement(Gn,{childrenForm:Ie,isFormDisabled:i,parentName:d,pathToDataFromActionRow:g,propertyName:b,propertyActions:E,recursiveLevel:0}))};At.defaultProps={childrenForm:[],required:!1},At.propTypes={childrenForm:r().array,label:r().string.isRequired,isFormDisabled:r().bool.isRequired,name:r().string.isRequired,pathToData:r().string.isRequired,propertyActions:r().array.isRequired,propertyName:r().string.isRequired,required:r().bool,isOdd:r().bool.isRequired};const Kn=(0,e.memo)(At),mn=P.default.div`
|
|
112
112
|
display: inline-flex;
|
|
113
113
|
flex-direction: column;
|
|
114
114
|
min-width: 0;
|
|
@@ -117,7 +117,7 @@
|
|
|
117
117
|
display: inline-flex;
|
|
118
118
|
min-width: 100%;
|
|
119
119
|
${({theme:a,isActive:t})=>t&&`border: 1px solid ${a.colors.primary600};`}
|
|
120
|
-
`,l=({allActions:a,contentTypeName:t,label:o,index:s,isActive:i,isFormDisabled:d,onClickToggleCollapse:p,pathToData:g,properties:E})=>{const b=(0,e.useCallback)(()=>{p(t)},[t,p]),S=(0,e.useMemo)(()=>Fn(a,t),[a,t]);return e.createElement(c,{isActive:i},e.createElement(Pn,{availableActions:S,isActive:i,isGrey:s%2===0,isFormDisabled:d,label:o,onClickToggle:b,pathToData:g}),i&&E.map(({label:L,value:B,children:z})=>e.createElement(m,{availableActions:S,childrenForm:z,isFormDisabled:d,label:L,pathToData:g,propertyName:B,key:B})))};l.propTypes={allActions:r().array.isRequired,contentTypeName:r().string.isRequired,index:r().number.isRequired,isActive:r().bool.isRequired,isFormDisabled:r().bool.isRequired,label:r().string.isRequired,onClickToggleCollapse:r().func.isRequired,pathToData:r().string.isRequired,properties:r().array.isRequired};const h=l,u=({actions:a,isFormDisabled:t,pathToData:o,subjects:s})=>{const[i,d]=(0,e.useState)(null),p=g=>{d(i===g?null:g)};return s.map(({uid:g,label:E,properties:b},S)=>e.createElement(h,{allActions:a,key:g,contentTypeName:g,label:E,isActive:i===g,isFormDisabled:t,index:S,onClickToggleCollapse:p,pathToData:`${o}..${g}`,properties:b}))};u.defaultProps={actions:[],subjects:[]},u.propTypes={actions:r().array.isRequired,isFormDisabled:r().bool.isRequired,pathToData:r().string.isRequired,subjects:r().arrayOf(r().shape({uid:r().string.isRequired,label:r().string.isRequired,properties:r().array.isRequired}))};const T=(0,e.memo)(u);var M=n(27677);const y=a=>a.filter(({subjects:t})=>t&&t.length);var D=Object.defineProperty,fe=Object.getOwnPropertySymbols,ue=Object.prototype.hasOwnProperty,
|
|
120
|
+
`,l=({allActions:a,contentTypeName:t,label:o,index:s,isActive:i,isFormDisabled:d,onClickToggleCollapse:p,pathToData:g,properties:E})=>{const b=(0,e.useCallback)(()=>{p(t)},[t,p]),S=(0,e.useMemo)(()=>Fn(a,t),[a,t]);return e.createElement(c,{isActive:i},e.createElement(Pn,{availableActions:S,isActive:i,isGrey:s%2===0,isFormDisabled:d,label:o,onClickToggle:b,pathToData:g}),i&&E.map(({label:L,value:B,children:z})=>e.createElement(m,{availableActions:S,childrenForm:z,isFormDisabled:d,label:L,pathToData:g,propertyName:B,key:B})))};l.propTypes={allActions:r().array.isRequired,contentTypeName:r().string.isRequired,index:r().number.isRequired,isActive:r().bool.isRequired,isFormDisabled:r().bool.isRequired,label:r().string.isRequired,onClickToggleCollapse:r().func.isRequired,pathToData:r().string.isRequired,properties:r().array.isRequired};const h=l,u=({actions:a,isFormDisabled:t,pathToData:o,subjects:s})=>{const[i,d]=(0,e.useState)(null),p=g=>{d(i===g?null:g)};return s.map(({uid:g,label:E,properties:b},S)=>e.createElement(h,{allActions:a,key:g,contentTypeName:g,label:E,isActive:i===g,isFormDisabled:t,index:S,onClickToggleCollapse:p,pathToData:`${o}..${g}`,properties:b}))};u.defaultProps={actions:[],subjects:[]},u.propTypes={actions:r().array.isRequired,isFormDisabled:r().bool.isRequired,pathToData:r().string.isRequired,subjects:r().arrayOf(r().shape({uid:r().string.isRequired,label:r().string.isRequired,properties:r().array.isRequired}))};const T=(0,e.memo)(u);var M=n(27677);const y=a=>a.filter(({subjects:t})=>t&&t.length);var D=Object.defineProperty,fe=Object.getOwnPropertySymbols,ue=Object.prototype.hasOwnProperty,_e=Object.prototype.propertyIsEnumerable,pt=(a,t,o)=>t in a?D(a,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):a[t]=o,at=(a,t)=>{for(var o in t||(t={}))ue.call(t,o)&&pt(a,o,t[o]);if(fe)for(var o of fe(t))_e.call(t,o)&&pt(a,o,t[o]);return a};const tt=a=>a.map(({actionId:t})=>t),lt=(a,t)=>a.reduce((o,s)=>(Object.keys(t).forEach(i=>{const d=(0,v.get)(t,[i,s],{}),p={[i]:Kt(d)};o[s]?o[s]=at(at({},o[s]),p):o[s]=p}),o),{}),Xo=(a,t)=>{const o=tt(a),s=lt(o,t);return Object.keys(s).reduce((d,p)=>(d[p]=it(s[p]),d),{})};var Qo=function(){return window&&window.strapi&&window.strapi.isEE?n(36950).Z:n(61526).Z}(),Yo=(0,P.default)(M.K).withConfig({displayName:"GlobalActions__CenteredStack",componentId:"sc-1vxwsjr-0"})(["align-items:center;justify-content:center;width:",";flex-shrink:0;"],ut),Hn=function(t){var o=t.actions,s=t.isFormDisabled,i=t.kind,d=(0,V.useIntl)(),p=d.formatMessage,g=(0,be.$_)(),E=g.modifiedData,b=g.onChangeCollectionTypeGlobalActionCheckbox,S=(0,e.useMemo)(function(){return y(o)},[o]),L=(0,e.useMemo)(function(){return Xo(S,E[i])},[E,S,i]);return e.createElement(A.x,{paddingBottom:4,paddingTop:6,style:{paddingLeft:zt}},e.createElement(M.K,{horizontal:!0,spacing:0},S.map(function(B){var z=B.label,j=B.actionId;return e.createElement(Yo,{key:j,spacing:3},e.createElement(me.Z,{variant:"sigma",textColor:"neutral500"},p({id:"Settings.roles.form.permissions.".concat(z.toLowerCase()),defaultMessage:z})),e.createElement(ie.C,{disabled:s||Qo,onValueChange:function(w){b(i,j,w)},name:j,"aria-label":p({id:"Settings.permissions.select-all-by-permission",defaultMessage:"Select all {label} permissions"},{label:p({id:"Settings.roles.form.permissions.".concat(z.toLowerCase()),defaultMessage:z})}),value:f()(L,[j,"hasAllActionsSelected"],!1),indeterminate:f()(L,[j,"hasSomeActionsSelected"],!1)}))})))};Hn.defaultProps={actions:[]},Hn.propTypes={actions:r().arrayOf(r().shape({label:r().string.isRequired,actionId:r().string.isRequired,subjects:r().array.isRequired})),isFormDisabled:r().bool.isRequired,kind:r().string.isRequired};const Jo=(0,e.memo)(Hn),qo=(0,P.default)(A.x)`
|
|
121
121
|
overflow-x: auto;
|
|
122
122
|
`,uo=({isFormDisabled:a,kind:t,layout:{actions:o,subjects:s}})=>{const i=Y()([...s],"label");return e.createElement(qo,{background:"neutral0"},e.createElement(Jo,{actions:o,kind:t,isFormDisabled:a}),e.createElement(T,{actions:o,isFormDisabled:a,pathToData:t,subjects:i}))};uo.propTypes={isFormDisabled:r().bool.isRequired,kind:r().string.isRequired,layout:r().shape({actions:r().array,subjects:r().arrayOf(r().shape({uid:r().string.isRequired,label:r().string.isRequired,properties:r().array.isRequired}))}).isRequired};const mo=(0,e.memo)(uo);var _o=n(66694);const po=({children:a,value:t})=>e.createElement(_o.$l.Provider,{value:t},a);po.propTypes={children:r().node.isRequired,value:r().exact({availableConditions:r().array.isRequired,modifiedData:r().object.isRequired,onChangeCollectionTypeLeftActionRowCheckbox:r().func.isRequired,onChangeConditions:r().func.isRequired,onChangeSimpleCheckbox:r().func.isRequired,onChangeParentCheckbox:r().func.isRequired,onChangeCollectionTypeGlobalActionCheckbox:r().func.isRequired}).isRequired};const ea=po;var ta=n(83828),na=n(61762),oa=n(89966),aa=n(15335),sa=n(5803),go=n(8284),ra=Object.defineProperty,ia=Object.defineProperties,la=Object.getOwnPropertyDescriptors,fo=Object.getOwnPropertySymbols,ca=Object.prototype.hasOwnProperty,da=Object.prototype.propertyIsEnumerable,ho=(a,t,o)=>t in a?ra(a,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):a[t]=o,ua=(a,t)=>{for(var o in t||(t={}))ca.call(t,o)&&ho(a,o,t[o]);if(fo)for(var o of fo(t))da.call(t,o)&&ho(a,o,t[o]);return a},ma=(a,t)=>ia(a,la(t));const pa=(a,t,o)=>a.map(s=>{const i=[...o,s.action,"properties","enabled"],d=(0,v.get)(t,i,!1),p=(0,v.get)(t,[...o,s.action,"conditions"],{}),g=mt(p).some(E=>E);return ma(ua({},s),{isDisplayed:d,checkboxName:i.join(".."),hasSomeActionsSelected:d,value:d,hasConditions:g,label:s.displayName,actionId:s.action,pathToConditionsObject:[...o,s.action]})}),ga=a=>{const t=Object.entries(a).reduce((s,i)=>{const[d,{conditions:p}]=i;return s[d]=p,s},{});return mt(t).some(s=>s)};var Xn=function(){return window&&window.strapi&&window.strapi.isEE?n(96556).Z:n(16437).Z}(),fa=P.default.div.withConfig({displayName:"SubCategory__Border",componentId:"sc-akgczm-0"})(["flex:1;align-self:center;border-top:1px solid ",";"],function(a){var t=a.theme;return t.colors.neutral150}),ha=P.default.div.withConfig({displayName:"SubCategory__CheckboxWrapper",componentId:"sc-akgczm-1"})(["position:relative;word-break:keep-all;",""],function(a){var t=a.hasConditions,o=a.disabled,s=a.theme;return t&&`
|
|
123
123
|
&:before {
|
|
@@ -130,7 +130,7 @@
|
|
|
130
130
|
border-radius: `).concat(20/16,`rem;
|
|
131
131
|
background: `).concat(o?s.colors.neutral100:s.colors.primary600,`;
|
|
132
132
|
}
|
|
133
|
-
`)}),vo=function(t){var o=t.categoryName,s=t.isFormDisabled,i=t.subCategoryName,d=t.actions,p=t.pathToData,g=(0,e.useState)(!1),E=(0,Oe.Z)(g,2),b=E[0],S=E[1],L=(0,be.$_)(),B=L.modifiedData,z=L.onChangeParentCheckbox,j=L.onChangeSimpleCheckbox,U=(0,V.useIntl)(),w=U.formatMessage,N=f()(B,p,{}),q=(0,e.useMemo)(function(){return Object.keys(N).reduce(function(ve,Fe){return ve[Fe]=Kt(N[Fe]),ve},{})},[N]),he=it(q),Ke=he.hasAllActionsSelected,Me=he.hasSomeActionsSelected,Se=function(){S(function(Fe){return!Fe})},Ie=function(){S(!1)},Le=pa(d,B,p),Ct=ga(f()(B,(0,xt.Z)(p),{}));return e.createElement(e.Fragment,null,e.createElement(A.x,null,e.createElement(x.k,{justifyContent:"space-between",alignItems:"center"},e.createElement(A.x,{paddingRight:4},e.createElement(me.Z,{variant:"sigma",textColor:"neutral600"},i)),e.createElement(fa,null),e.createElement(A.x,{paddingLeft:4},e.createElement(go.X,{name:p.join(".."),disabled:s||Xn,onValueChange:function(Fe){z({target:{name:p.join(".."),value:Fe}})},indeterminate:Me,value:Ke},w({id:"app.utils.select-all",defaultMessage:"Select all"})))),e.createElement(x.k,{paddingTop:6,paddingBottom:6},e.createElement(aa.r,{gap:2,style:{flex:1}},Le.map(function(ve){var Fe=ve.checkboxName,se=ve.value,Ee=ve.action,Pe=ve.displayName,we=ve.hasConditions;return e.createElement(sa.P,{col:3,key:Ee},e.createElement(ha,{disabled:s||Xn,hasConditions:we},e.createElement(go.X,{name:Fe,disabled:s||Xn,onValueChange:function(gt){j({target:{name:Fe,value:gt}})},value:se},Pe)))})),e.createElement(Qe,{hasConditions:Ct,onClick:Se}))),b&&e.createElement(Wt,{headerBreadCrumbs:[o,i],actions:Le,isFormDisabled:s,onClosed:Ie,onToggle:Se}))};vo.propTypes={actions:r().array.isRequired,categoryName:r().string.isRequired,isFormDisabled:r().bool.isRequired,subCategoryName:r().string.isRequired,pathToData:r().array.isRequired};const va=vo,Qn=({childrenForm:a,kind:t,name:o,isOpen:s,isFormDisabled:i,isWhite:d,onOpenCategory:p,pathToData:g})=>{const{formatMessage:E}=(0,V.useIntl)(),b=()=>{p(o)},S=(0,e.useMemo)(()=>o.split("::").pop(),[o]);return e.createElement(ta.U,{expanded:s,onToggle:b,id:`accordion-${o}`,variant:d?"primary":"secondary"},e.createElement(na.B,{title:I()(S),description:`${E({id:"Settings.permissions.category"},{category:S})} ${t==="plugins"?"plugin":t}`}),e.createElement(oa.v,null,e.createElement(A.x,{padding:6},a.map(({actions:L,subCategoryName:B,subCategoryId:z})=>e.createElement(va,{key:B,actions:L,categoryName:S,isFormDisabled:i,subCategoryName:B,pathToData:[...g,z]})))))};Qn.defaultProps={},Qn.propTypes={childrenForm:r().array.isRequired,isOpen:r().bool.isRequired,isFormDisabled:r().bool.isRequired,isWhite:r().bool.isRequired,kind:r().string.isRequired,name:r().string.isRequired,onOpenCategory:r().func.isRequired,pathToData:r().array.isRequired};const ya=Qn,yo=({isFormDisabled:a,kind:t,layout:o})=>{const[s,i]=(0,e.useState)(null),d=p=>{i(p===s?null:p)};return e.createElement(A.x,{padding:6,background:"neutral0"},o.map(({category:p,categoryId:g,childrenForm:E},b)=>e.createElement(ya,{key:p,childrenForm:E,kind:t,isFormDisabled:a,isOpen:s===p,isWhite:b%2===1,name:p,onOpenCategory:d,pathToData:[t,g]})))};yo.propTypes={isFormDisabled:r().bool.isRequired,kind:r().string.isRequired,layout:r().arrayOf(r().shape({category:r().string.isRequired,categoryId:r().string.isRequired,childrenForm:r().arrayOf(r().shape({actions:r().array.isRequired})).isRequired}).isRequired).isRequired};const Co=yo,Eo=(a,t,o)=>a.find(s=>s.action===t&&s.subject===o);var Ca=Object.defineProperty,Ea=Object.defineProperties,ba=Object.getOwnPropertyDescriptors,bo=Object.getOwnPropertySymbols,Sa=Object.prototype.hasOwnProperty,Pa=Object.prototype.propertyIsEnumerable,So=(a,t,o)=>t in a?Ca(a,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):a[t]=o,Po=(a,t)=>{for(var o in t||(t={}))Sa.call(t,o)&&So(a,o,t[o]);if(bo)for(var o of bo(t))Pa.call(t,o)&&So(a,o,t[o]);return a},To=(a,t)=>Ea(a,ba(t));const Ao=(a,t=[])=>a.reduce((o,s)=>(o[s.id]=t.indexOf(s.id)!==-1,o),{}),Ro=({children:a},t,o="")=>a.reduce((s,i)=>{if(i.children)return To(Po({},s),{[i.value]:Ro(i,t,`${o}${i.value}.`)});const d=t.indexOf(`${o}${i.value}`)!==-1;return s[i.value]=d,s},{}),Ta=(a,t,o)=>a.reduce((s,i)=>{const d=t.properties.find(({value:p})=>p===i);if(d){const p=(0,v.get)(o,["properties",d.value],[]),g=Ro(d,p);s.properties[i]=g}return s},{properties:{}}),Aa=(a,t)=>t.reduce((o,s)=>{const i=a.find(({uid:d})=>d===s)||null;return i&&(o[s]=i),o},{}),Oo=({subjects:a},t,o,s=[])=>t.reduce((i,d)=>{const p=d.subjects,g=Aa(a,p);if((0,v.isEmpty)(g))return i;const E=Object.keys(g).reduce((b,S)=>{const{actionId:L,applyToProperties:B}=d,U=g[S].properties.map(({value:he})=>he).every(he=>(B||[]).indexOf(he)===-1),w=Eo(s,L,S),N=Ao(o,(0,v.get)(w,"conditions",[]));if((0,v.isEmpty)(B)||U)return(0,v.set)(b,[S,L],{properties:{enabled:w!==void 0},conditions:N}),b;const q=Ta(B,g[S],w);return(0,v.set)(b,[S,L],To(Po({},q),{conditions:N})),b},{});return(0,v.merge)(i,E)},{}),Ra=(a,t,o)=>a.reduce((s,i)=>{const d=Eo(o,i.action,null);return s[i.action]={properties:{enabled:d!==void 0},conditions:Ao(t,(0,v.get)(d,"conditions",[]))},s},{}),Oa=(a,t,o)=>a.reduce((s,i)=>(s[i.subCategoryId]=Ra(i.actions,t,o),s),{}),Do=(a,t,o=[])=>a.reduce((s,{categoryId:i,childrenForm:d})=>{const p=Oa(d,t,o);return s[i]=p,s},{}),Mo=a=>a.split(" ").join("-"),Lo=(a,t)=>(0,v.chain)(a).groupBy(t).map((o,s)=>({category:s,categoryId:Mo(s),childrenForm:(0,v.chain)(o).groupBy("subCategory").map((i,d)=>({subCategoryName:d,subCategoryId:Mo(d),actions:i})).value()})).value(),Da=(a,t)=>{const{conditions:o,sections:{collectionTypes:s,singleTypes:i,plugins:d,settings:p}}=a,g={collectionTypes:s,singleTypes:i,plugins:Lo(d,"plugin"),settings:Lo(p,"category")},E={collectionTypes:Oo(s,s.actions||[],o,t),singleTypes:Oo(i,i.actions||[],o,t),plugins:Do(g.plugins,o,t),settings:Do(g.settings,o,t)};return{initialData:E,modifiedData:E,layouts:g}};var Ma=Object.defineProperty,La=Object.defineProperties,xa=Object.getOwnPropertyDescriptors,xo=Object.getOwnPropertySymbols,Ia=Object.prototype.hasOwnProperty,Fa=Object.prototype.propertyIsEnumerable,Io=(a,t,o)=>t in a?Ma(a,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):a[t]=o,Yn=(a,t)=>{for(var o in t||(t={}))Ia.call(t,o)&&Io(a,o,t[o]);if(xo)for(var o of xo(t))Fa.call(t,o)&&Io(a,o,t[o]);return a},Jn=(a,t)=>La(a,xa(t));const Fo=a=>Object.keys(a).reduce((t,o)=>{const s=a[o];if((0,v.isObject)(s)&&!(0,v.has)(s,"conditions"))return Jn(Yn({},t),{[o]:Fo(s)});if((0,v.isObject)(s)&&(0,v.has)(s,"conditions")&&!mt((0,v.omit)(s,"conditions")).some(d=>d)){const d=Object.keys(s.conditions).reduce((p,g)=>(p[g]=!1,p),{});return Jn(Yn({},t),{[o]:Jn(Yn({},s),{conditions:d})})}return t[o]=s,t},{}),qn=Fo;var wa=Object.defineProperty,Ba=Object.defineProperties,ja=Object.getOwnPropertyDescriptors,wo=Object.getOwnPropertySymbols,Na=Object.prototype.hasOwnProperty,Za=Object.prototype.propertyIsEnumerable,Bo=(a,t,o)=>t in a?wa(a,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):a[t]=o,$a=(a,t)=>{for(var o in t||(t={}))Na.call(t,o)&&Bo(a,o,t[o]);if(wo)for(var o of wo(t))Za.call(t,o)&&Bo(a,o,t[o]);return a},Wa=(a,t)=>Ba(a,ja(t));const jo=(a,t)=>Object.keys(a).reduce((o,s)=>{const i=a[s];return s==="conditions"?(o[s]=i,o):(0,v.isObject)(i)?Wa($a({},o),{[s]:jo(i,t)}):(o[s]=t,o)},{}),gn=jo;var za=Object.defineProperty,Ua=Object.defineProperties,Va=Object.getOwnPropertyDescriptors,No=Object.getOwnPropertySymbols,ka=Object.prototype.hasOwnProperty,Ga=Object.prototype.propertyIsEnumerable,Zo=(a,t,o)=>t in a?za(a,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):a[t]=o,Ka=(a,t)=>{for(var o in t||(t={}))ka.call(t,o)&&Zo(a,o,t[o]);if(No)for(var o of No(t))Ga.call(t,o)&&Zo(a,o,t[o]);return a},Ha=(a,t)=>Ua(a,Va(t));const Xa={initialData:{},modifiedData:{},layouts:{}},Qa=(a,t)=>(0,Ve.default)(a,o=>{switch(t.type){case"ON_CHANGE_COLLECTION_TYPE_GLOBAL_ACTION_CHECKBOX":{const{collectionTypeKind:s,actionId:i,value:d}=t,p=["modifiedData",s];Object.keys((0,v.get)(a,p)).forEach(g=>{const E=(0,v.get)(a,[...p,g,i],void 0);if(E){let b=gn(E,d);if(!d&&b.conditions){const S=gn(b.conditions,!1);b=Ha(Ka({},b),{conditions:S})}(0,v.set)(o,[...p,g,i],b)}});break}case"ON_CHANGE_COLLECTION_TYPE_ROW_LEFT_CHECKBOX":{const{pathToCollectionType:s,propertyName:i,rowName:d,value:p}=t;let g=(0,v.cloneDeep)(a.modifiedData);const E=s.split(".."),b=(0,v.get)(g,E,{});Object.keys(b).forEach(S=>{if((0,v.has)(b[S],`properties.${i}`)){const L=(0,v.get)(b,[S,"properties",i,d]),B=[...E,S,"properties",i,d];if(!(0,v.isObject)(L))(0,v.set)(g,B,p);else{const z=gn(L,p);(0,v.set)(g,B,z)}}}),p||(g=qn(g)),(0,v.set)(o,"modifiedData",g);break}case"ON_CHANGE_CONDITIONS":{Object.entries(t.conditions).forEach(s=>{const[i,d]=s;(0,v.set)(o,["modifiedData",...i.split(".."),"conditions"],d)});break}case"ON_CHANGE_SIMPLE_CHECKBOX":{let s=(0,v.cloneDeep)(a.modifiedData);(0,v.set)(s,[...t.keys.split("..")],t.value),t.value||(s=qn(s)),(0,v.set)(o,"modifiedData",s);break}case"ON_CHANGE_TOGGLE_PARENT_CHECKBOX":{const{keys:s,value:i}=t,d=[...s.split("..")];let p=(0,v.cloneDeep)(a.modifiedData);const g=(0,v.get)(p,d,{}),E=gn(g,i);(0,v.set)(p,d,E),i||(p=qn(p)),(0,v.set)(o,["modifiedData"],p);break}case"RESET_FORM":{o.modifiedData=a.initialData;break}case"SET_FORM_AFTER_SUBMIT":{o.initialData=a.modifiedData;break}default:return o}}),_n=a=>Object.entries(a).filter(([,t])=>t).map(([t])=>t),Ya=a=>{const[t,{conditions:o}]=a;return{action:t,subject:null,conditions:_n(o),properties:{}}},Ja=a=>Object.values(a).reduce((t,o)=>{const s=Object.entries(o).reduce((i,d)=>{const[,{properties:{enabled:p}}]=d;if(!p)return i;const g=Ya(d);return i.push(g),i},[]);return[...t,...s]},[]),$o=a=>Object.values(a).reduce((t,o)=>{const s=Ja(o);return[...t,...s]},[]),Wo=(a,t="")=>Object.entries(a).reduce((o,s)=>{const[i,d]=s;return(0,v.isObject)(d)?[...o,...Wo(d,`${t}${i}.`)]:(d&&!(0,v.isObject)(d)&&o.push(`${t}${i}`),o)},[]),qa=(a,t,{conditions:o,properties:s})=>Object.entries(s).reduce((i,d)=>{const[p,g]=d;return i.properties[p]=Wo(g),i},{action:a,subject:t,conditions:_n(o),properties:{}}),_a=(a,t,{conditions:o})=>({action:a,subject:t,properties:{},conditions:_n(o)}),es=(a,t)=>Object.entries(t).reduce((s,i)=>{const[d,p]=i;if(!mt(p).some(b=>b))return s;if(!(0,v.has)(p,"properties.enabled")){const b=qa(d,a,p);return[...s,b]}if(!p.properties.enabled)return s;const E=_a(d,a,p);return s.push(E),s},[]),zo=a=>Object.entries(a).reduce((o,s)=>{const[i,d]=s,p=es(i,d);return[...o,...p]},[]),ts=a=>{const t=$o(a.plugins),o=$o(a.settings),s=zo(a.collectionTypes),i=zo(a.singleTypes);return[...t,...o,...s,...i]},ns=[{labelId:"app.components.LeftMenuLinkContainer.collectionTypes",defaultMessage:"Collection Types",id:"collectionTypes"},{labelId:"app.components.LeftMenuLinkContainer.singleTypes",id:"singleTypes",defaultMessage:"Single Types"},{labelId:"app.components.LeftMenuLinkContainer.plugins",defaultMessage:"Plugins",id:"plugins"},{labelId:"app.components.LeftMenuLinkContainer.settings",defaultMessage:"Settings",id:"settings"}];var os=Object.defineProperty,Uo=Object.getOwnPropertySymbols,as=Object.prototype.hasOwnProperty,ss=Object.prototype.propertyIsEnumerable,Vo=(a,t,o)=>t in a?os(a,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):a[t]=o,ko=(a,t)=>{for(var o in t||(t={}))as.call(t,o)&&Vo(a,o,t[o]);if(Uo)for(var o of Uo(t))ss.call(t,o)&&Vo(a,o,t[o]);return a};const eo=(0,e.forwardRef)(({layout:a,isFormDisabled:t,permissions:o},s)=>{const[{initialData:i,layouts:d,modifiedData:p},g]=(0,e.useReducer)(Qa,Xa,()=>Da(a,o)),{formatMessage:E}=(0,V.useIntl)();(0,e.useImperativeHandle)(s,()=>({getPermissions(){const j=(0,oe.difference)(i.collectionTypes,p.collectionTypes),U=(0,oe.difference)(i.singleTypes,p.singleTypes),w=ko(ko({},j),U);let N;return He()(w)?N=!1:N=Object.values(w).some(q=>Object.values(q).some(he=>Ae()(he,"conditions"))),{permissionsToSend:ts(p),didUpdateConditions:N}},resetForm(){g({type:"RESET_FORM"})},setFormAfterSubmit(){g({type:"SET_FORM_AFTER_SUBMIT"})}}));const b=(j,U,w,N)=>{g({type:"ON_CHANGE_COLLECTION_TYPE_ROW_LEFT_CHECKBOX",pathToCollectionType:j,propertyName:U,rowName:w,value:N})},S=(j,U,w)=>{g({type:"ON_CHANGE_COLLECTION_TYPE_GLOBAL_ACTION_CHECKBOX",collectionTypeKind:j,actionId:U,value:w})},L=j=>{g({type:"ON_CHANGE_CONDITIONS",conditions:j})},B=(0,e.useCallback)(({target:{name:j,value:U}})=>{g({type:"ON_CHANGE_SIMPLE_CHECKBOX",keys:j,value:U})},[]),z=(0,e.useCallback)(({target:{name:j,value:U}})=>{g({type:"ON_CHANGE_TOGGLE_PARENT_CHECKBOX",keys:j,value:U})},[]);return e.createElement(ea,{value:{availableConditions:a.conditions,modifiedData:p,onChangeConditions:L,onChangeSimpleCheckbox:B,onChangeParentCheckbox:z,onChangeCollectionTypeLeftActionRowCheckbox:b,onChangeCollectionTypeGlobalActionCheckbox:S}},e.createElement(Q.v,{id:"tabs",label:E({id:"Settings.permissions.users.tabs.label",defaultMessage:"Tabs Permissions"})},e.createElement(We.m,null,ns.map(j=>e.createElement(We.O,{key:j.id},E({id:j.labelId,defaultMessage:j.defaultMessage})))),e.createElement(_.n,{style:{position:"relative"}},e.createElement(_.x,null,e.createElement(mo,{layout:d.collectionTypes,kind:"collectionTypes",isFormDisabled:t})),e.createElement(_.x,null,e.createElement(mo,{layout:d.singleTypes,kind:"singleTypes",isFormDisabled:t})),e.createElement(_.x,null,e.createElement(Co,{layout:d.plugins,kind:"plugins",isFormDisabled:t})),e.createElement(_.x,null,e.createElement(Co,{layout:d.settings,kind:"settings",isFormDisabled:t})))))});eo.defaultProps={permissions:[],layout:{conditions:[],sections:{collectionTypes:{},singleTypes:{actions:[]},settings:[],plugins:[]}}},eo.propTypes={layout:r().object,isFormDisabled:r().bool.isRequired,permissions:r().array};const rs=(0,e.memo)(eo)},16437:(le,O,n)=>{n.d(O,{Z:()=>C});const C=!0},78522:(le,O,n)=>{n.d(O,{Z:()=>e});const e=()=>"todo empty role"},80779:(le,O,n)=>{n.d(O,{Z:()=>re});var e=n(32735),C=n(60216),r=n.n(C),oe=n(62345),Q=n(36320),We=n(94547),_=n(19786),Te=n(88860),Ae=n(50563),Re=n(88425),He=n.n(Re),V=n(5636),A=Object.defineProperty,P=Object.getOwnPropertySymbols,Be=Object.prototype.hasOwnProperty,Y=Object.prototype.propertyIsEnumerable,Oe=(x,ae,f)=>ae in x?A(x,ae,{enumerable:!0,configurable:!0,writable:!0,value:f}):x[ae]=f,K=(x,ae)=>{for(var f in ae||(ae={}))Be.call(ae,f)&&Oe(x,f,ae[f]);if(P)for(var f of P(ae))Y.call(ae,f)&&Oe(x,f,ae[f]);return x};const ze=({id:x,name:ae,description:f,usersCount:_e,icons:Xe,rowIndex:be})=>{const{formatMessage:je}=(0,V.useIntl)(),Ne=je({id:"Roles.RoleRow.user-count",defaultMessage:"{number, plural, =0 {# user} one {# user} other {# users}}"},{number:_e});return e.createElement(We.Tr,K({"aria-rowindex":be,key:x},(0,Re.onRowClick)({fn:Xe[1].onClick})),e.createElement(_.Td,{maxWidth:(0,Re.pxToRem)(130)},e.createElement(Te.Z,{ellipsis:!0,textColor:"neutral800"},ae)),e.createElement(_.Td,{maxWidth:(0,Re.pxToRem)(250)},e.createElement(Te.Z,{ellipsis:!0,textColor:"neutral800"},f)),e.createElement(_.Td,null,e.createElement(Te.Z,{textColor:"neutral800"},Ne)),e.createElement(_.Td,null,e.createElement(Q.k,K({justifyContent:"flex-end"},Re.stopPropagation),Xe.map((Ue,Ze)=>Ue?e.createElement(oe.x,{key:Ue.label,paddingLeft:Ze===0?0:1},e.createElement(Ae.h,{onClick:Ue.onClick,label:Ue.label,noBorder:!0,icon:Ue.icon})):null))))};ze.propTypes={id:r().number.isRequired,name:r().string.isRequired,description:r().string.isRequired,usersCount:r().number.isRequired,icons:r().array.isRequired,rowIndex:r().number.isRequired};const re=ze},45677:(le,O,n)=>{n.d(O,{Z:()=>Ge});var e=n(32735),C=n(88425),r=n(72041),oe=n(58469),Q=n(19406),We=n(4038),_=n(68625),Te=n(47765),Ae=n(41415),Re=n(28356),He=n(17e3),V=n(56755),A=n(73269),P=n(33827),Be=n(94547),Y=n(19786),Oe=n(35658),K=n(88860),ze=n(27649),re=n(3685),x=n(5636),ae=n(5141),f=n(80779),_e=n(78522),Xe=n(60216),be=n.n(Xe),je=n(83292),Ne=n(71933),Ue=n(67563),Ze=n(50563),Qe=n(95489),dt=n(62345),st=n(36320),nt=n(27677),rt=n(47361),ne=n(35331);const me=n.p+"6d21938306785f176538.png",Ve=n.p+"617f9c948fa79e6d73bd.png",ee=je.default.div`
|
|
133
|
+
`)}),vo=function(t){var o=t.categoryName,s=t.isFormDisabled,i=t.subCategoryName,d=t.actions,p=t.pathToData,g=(0,e.useState)(!1),E=(0,Oe.Z)(g,2),b=E[0],S=E[1],L=(0,be.$_)(),B=L.modifiedData,z=L.onChangeParentCheckbox,j=L.onChangeSimpleCheckbox,U=(0,V.useIntl)(),w=U.formatMessage,N=f()(B,p,{}),q=(0,e.useMemo)(function(){return Object.keys(N).reduce(function(ve,Fe){return ve[Fe]=Kt(N[Fe]),ve},{})},[N]),he=it(q),Ke=he.hasAllActionsSelected,Me=he.hasSomeActionsSelected,Se=function(){S(function(Fe){return!Fe})},Ie=function(){S(!1)},Le=pa(d,B,p),Ct=ga(f()(B,(0,xt.Z)(p),{}));return e.createElement(e.Fragment,null,e.createElement(A.x,null,e.createElement(x.k,{justifyContent:"space-between",alignItems:"center"},e.createElement(A.x,{paddingRight:4},e.createElement(me.Z,{variant:"sigma",textColor:"neutral600"},i)),e.createElement(fa,null),e.createElement(A.x,{paddingLeft:4},e.createElement(go.X,{name:p.join(".."),disabled:s||Xn,onValueChange:function(Fe){z({target:{name:p.join(".."),value:Fe}})},indeterminate:Me,value:Ke},w({id:"app.utils.select-all",defaultMessage:"Select all"})))),e.createElement(x.k,{paddingTop:6,paddingBottom:6},e.createElement(aa.r,{gap:2,style:{flex:1}},Le.map(function(ve){var Fe=ve.checkboxName,re=ve.value,Ee=ve.action,Pe=ve.displayName,we=ve.hasConditions;return e.createElement(sa.P,{col:3,key:Ee},e.createElement(ha,{disabled:s||Xn,hasConditions:we},e.createElement(go.X,{name:Fe,disabled:s||Xn,onValueChange:function(gt){j({target:{name:Fe,value:gt}})},value:re},Pe)))})),e.createElement(Qe,{hasConditions:Ct,onClick:Se}))),b&&e.createElement(Wt,{headerBreadCrumbs:[o,i],actions:Le,isFormDisabled:s,onClosed:Ie,onToggle:Se}))};vo.propTypes={actions:r().array.isRequired,categoryName:r().string.isRequired,isFormDisabled:r().bool.isRequired,subCategoryName:r().string.isRequired,pathToData:r().array.isRequired};const va=vo,Qn=({childrenForm:a,kind:t,name:o,isOpen:s,isFormDisabled:i,isWhite:d,onOpenCategory:p,pathToData:g})=>{const{formatMessage:E}=(0,V.useIntl)(),b=()=>{p(o)},S=(0,e.useMemo)(()=>o.split("::").pop(),[o]);return e.createElement(ta.U,{expanded:s,onToggle:b,id:`accordion-${o}`,variant:d?"primary":"secondary"},e.createElement(na.B,{title:I()(S),description:`${E({id:"Settings.permissions.category"},{category:S})} ${t==="plugins"?"plugin":t}`}),e.createElement(oa.v,null,e.createElement(A.x,{padding:6},a.map(({actions:L,subCategoryName:B,subCategoryId:z})=>e.createElement(va,{key:B,actions:L,categoryName:S,isFormDisabled:i,subCategoryName:B,pathToData:[...g,z]})))))};Qn.defaultProps={},Qn.propTypes={childrenForm:r().array.isRequired,isOpen:r().bool.isRequired,isFormDisabled:r().bool.isRequired,isWhite:r().bool.isRequired,kind:r().string.isRequired,name:r().string.isRequired,onOpenCategory:r().func.isRequired,pathToData:r().array.isRequired};const ya=Qn,yo=({isFormDisabled:a,kind:t,layout:o})=>{const[s,i]=(0,e.useState)(null),d=p=>{i(p===s?null:p)};return e.createElement(A.x,{padding:6,background:"neutral0"},o.map(({category:p,categoryId:g,childrenForm:E},b)=>e.createElement(ya,{key:p,childrenForm:E,kind:t,isFormDisabled:a,isOpen:s===p,isWhite:b%2===1,name:p,onOpenCategory:d,pathToData:[t,g]})))};yo.propTypes={isFormDisabled:r().bool.isRequired,kind:r().string.isRequired,layout:r().arrayOf(r().shape({category:r().string.isRequired,categoryId:r().string.isRequired,childrenForm:r().arrayOf(r().shape({actions:r().array.isRequired})).isRequired}).isRequired).isRequired};const Co=yo,Eo=(a,t,o)=>a.find(s=>s.action===t&&s.subject===o);var Ca=Object.defineProperty,Ea=Object.defineProperties,ba=Object.getOwnPropertyDescriptors,bo=Object.getOwnPropertySymbols,Sa=Object.prototype.hasOwnProperty,Pa=Object.prototype.propertyIsEnumerable,So=(a,t,o)=>t in a?Ca(a,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):a[t]=o,Po=(a,t)=>{for(var o in t||(t={}))Sa.call(t,o)&&So(a,o,t[o]);if(bo)for(var o of bo(t))Pa.call(t,o)&&So(a,o,t[o]);return a},To=(a,t)=>Ea(a,ba(t));const Ao=(a,t=[])=>a.reduce((o,s)=>(o[s.id]=t.indexOf(s.id)!==-1,o),{}),Ro=({children:a},t,o="")=>a.reduce((s,i)=>{if(i.children)return To(Po({},s),{[i.value]:Ro(i,t,`${o}${i.value}.`)});const d=t.indexOf(`${o}${i.value}`)!==-1;return s[i.value]=d,s},{}),Ta=(a,t,o)=>a.reduce((s,i)=>{const d=t.properties.find(({value:p})=>p===i);if(d){const p=(0,v.get)(o,["properties",d.value],[]),g=Ro(d,p);s.properties[i]=g}return s},{properties:{}}),Aa=(a,t)=>t.reduce((o,s)=>{const i=a.find(({uid:d})=>d===s)||null;return i&&(o[s]=i),o},{}),Oo=({subjects:a},t,o,s=[])=>t.reduce((i,d)=>{const p=d.subjects,g=Aa(a,p);if((0,v.isEmpty)(g))return i;const E=Object.keys(g).reduce((b,S)=>{const{actionId:L,applyToProperties:B}=d,U=g[S].properties.map(({value:he})=>he).every(he=>(B||[]).indexOf(he)===-1),w=Eo(s,L,S),N=Ao(o,(0,v.get)(w,"conditions",[]));if((0,v.isEmpty)(B)||U)return(0,v.set)(b,[S,L],{properties:{enabled:w!==void 0},conditions:N}),b;const q=Ta(B,g[S],w);return(0,v.set)(b,[S,L],To(Po({},q),{conditions:N})),b},{});return(0,v.merge)(i,E)},{}),Ra=(a,t,o)=>a.reduce((s,i)=>{const d=Eo(o,i.action,null);return s[i.action]={properties:{enabled:d!==void 0},conditions:Ao(t,(0,v.get)(d,"conditions",[]))},s},{}),Oa=(a,t,o)=>a.reduce((s,i)=>(s[i.subCategoryId]=Ra(i.actions,t,o),s),{}),Do=(a,t,o=[])=>a.reduce((s,{categoryId:i,childrenForm:d})=>{const p=Oa(d,t,o);return s[i]=p,s},{}),Mo=a=>a.split(" ").join("-"),Lo=(a,t)=>(0,v.chain)(a).groupBy(t).map((o,s)=>({category:s,categoryId:Mo(s),childrenForm:(0,v.chain)(o).groupBy("subCategory").map((i,d)=>({subCategoryName:d,subCategoryId:Mo(d),actions:i})).value()})).value(),Da=(a,t)=>{const{conditions:o,sections:{collectionTypes:s,singleTypes:i,plugins:d,settings:p}}=a,g={collectionTypes:s,singleTypes:i,plugins:Lo(d,"plugin"),settings:Lo(p,"category")},E={collectionTypes:Oo(s,s.actions||[],o,t),singleTypes:Oo(i,i.actions||[],o,t),plugins:Do(g.plugins,o,t),settings:Do(g.settings,o,t)};return{initialData:E,modifiedData:E,layouts:g}};var Ma=Object.defineProperty,La=Object.defineProperties,xa=Object.getOwnPropertyDescriptors,xo=Object.getOwnPropertySymbols,Ia=Object.prototype.hasOwnProperty,Fa=Object.prototype.propertyIsEnumerable,Io=(a,t,o)=>t in a?Ma(a,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):a[t]=o,Yn=(a,t)=>{for(var o in t||(t={}))Ia.call(t,o)&&Io(a,o,t[o]);if(xo)for(var o of xo(t))Fa.call(t,o)&&Io(a,o,t[o]);return a},Jn=(a,t)=>La(a,xa(t));const Fo=a=>Object.keys(a).reduce((t,o)=>{const s=a[o];if((0,v.isObject)(s)&&!(0,v.has)(s,"conditions"))return Jn(Yn({},t),{[o]:Fo(s)});if((0,v.isObject)(s)&&(0,v.has)(s,"conditions")&&!mt((0,v.omit)(s,"conditions")).some(d=>d)){const d=Object.keys(s.conditions).reduce((p,g)=>(p[g]=!1,p),{});return Jn(Yn({},t),{[o]:Jn(Yn({},s),{conditions:d})})}return t[o]=s,t},{}),qn=Fo;var wa=Object.defineProperty,Ba=Object.defineProperties,ja=Object.getOwnPropertyDescriptors,wo=Object.getOwnPropertySymbols,Na=Object.prototype.hasOwnProperty,Za=Object.prototype.propertyIsEnumerable,Bo=(a,t,o)=>t in a?wa(a,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):a[t]=o,$a=(a,t)=>{for(var o in t||(t={}))Na.call(t,o)&&Bo(a,o,t[o]);if(wo)for(var o of wo(t))Za.call(t,o)&&Bo(a,o,t[o]);return a},Wa=(a,t)=>Ba(a,ja(t));const jo=(a,t)=>Object.keys(a).reduce((o,s)=>{const i=a[s];return s==="conditions"?(o[s]=i,o):(0,v.isObject)(i)?Wa($a({},o),{[s]:jo(i,t)}):(o[s]=t,o)},{}),gn=jo;var za=Object.defineProperty,Ua=Object.defineProperties,Va=Object.getOwnPropertyDescriptors,No=Object.getOwnPropertySymbols,Ga=Object.prototype.hasOwnProperty,ka=Object.prototype.propertyIsEnumerable,Zo=(a,t,o)=>t in a?za(a,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):a[t]=o,Ka=(a,t)=>{for(var o in t||(t={}))Ga.call(t,o)&&Zo(a,o,t[o]);if(No)for(var o of No(t))ka.call(t,o)&&Zo(a,o,t[o]);return a},Ha=(a,t)=>Ua(a,Va(t));const Xa={initialData:{},modifiedData:{},layouts:{}},Qa=(a,t)=>(0,Ve.default)(a,o=>{switch(t.type){case"ON_CHANGE_COLLECTION_TYPE_GLOBAL_ACTION_CHECKBOX":{const{collectionTypeKind:s,actionId:i,value:d}=t,p=["modifiedData",s];Object.keys((0,v.get)(a,p)).forEach(g=>{const E=(0,v.get)(a,[...p,g,i],void 0);if(E){let b=gn(E,d);if(!d&&b.conditions){const S=gn(b.conditions,!1);b=Ha(Ka({},b),{conditions:S})}(0,v.set)(o,[...p,g,i],b)}});break}case"ON_CHANGE_COLLECTION_TYPE_ROW_LEFT_CHECKBOX":{const{pathToCollectionType:s,propertyName:i,rowName:d,value:p}=t;let g=(0,v.cloneDeep)(a.modifiedData);const E=s.split(".."),b=(0,v.get)(g,E,{});Object.keys(b).forEach(S=>{if((0,v.has)(b[S],`properties.${i}`)){const L=(0,v.get)(b,[S,"properties",i,d]),B=[...E,S,"properties",i,d];if(!(0,v.isObject)(L))(0,v.set)(g,B,p);else{const z=gn(L,p);(0,v.set)(g,B,z)}}}),p||(g=qn(g)),(0,v.set)(o,"modifiedData",g);break}case"ON_CHANGE_CONDITIONS":{Object.entries(t.conditions).forEach(s=>{const[i,d]=s;(0,v.set)(o,["modifiedData",...i.split(".."),"conditions"],d)});break}case"ON_CHANGE_SIMPLE_CHECKBOX":{let s=(0,v.cloneDeep)(a.modifiedData);(0,v.set)(s,[...t.keys.split("..")],t.value),t.value||(s=qn(s)),(0,v.set)(o,"modifiedData",s);break}case"ON_CHANGE_TOGGLE_PARENT_CHECKBOX":{const{keys:s,value:i}=t,d=[...s.split("..")];let p=(0,v.cloneDeep)(a.modifiedData);const g=(0,v.get)(p,d,{}),E=gn(g,i);(0,v.set)(p,d,E),i||(p=qn(p)),(0,v.set)(o,["modifiedData"],p);break}case"RESET_FORM":{o.modifiedData=a.initialData;break}case"SET_FORM_AFTER_SUBMIT":{o.initialData=a.modifiedData;break}default:return o}}),_n=a=>Object.entries(a).filter(([,t])=>t).map(([t])=>t),Ya=a=>{const[t,{conditions:o}]=a;return{action:t,subject:null,conditions:_n(o),properties:{}}},Ja=a=>Object.values(a).reduce((t,o)=>{const s=Object.entries(o).reduce((i,d)=>{const[,{properties:{enabled:p}}]=d;if(!p)return i;const g=Ya(d);return i.push(g),i},[]);return[...t,...s]},[]),$o=a=>Object.values(a).reduce((t,o)=>{const s=Ja(o);return[...t,...s]},[]),Wo=(a,t="")=>Object.entries(a).reduce((o,s)=>{const[i,d]=s;return(0,v.isObject)(d)?[...o,...Wo(d,`${t}${i}.`)]:(d&&!(0,v.isObject)(d)&&o.push(`${t}${i}`),o)},[]),qa=(a,t,{conditions:o,properties:s})=>Object.entries(s).reduce((i,d)=>{const[p,g]=d;return i.properties[p]=Wo(g),i},{action:a,subject:t,conditions:_n(o),properties:{}}),_a=(a,t,{conditions:o})=>({action:a,subject:t,properties:{},conditions:_n(o)}),es=(a,t)=>Object.entries(t).reduce((s,i)=>{const[d,p]=i;if(!mt(p).some(b=>b))return s;if(!(0,v.has)(p,"properties.enabled")){const b=qa(d,a,p);return[...s,b]}if(!p.properties.enabled)return s;const E=_a(d,a,p);return s.push(E),s},[]),zo=a=>Object.entries(a).reduce((o,s)=>{const[i,d]=s,p=es(i,d);return[...o,...p]},[]),ts=a=>{const t=$o(a.plugins),o=$o(a.settings),s=zo(a.collectionTypes),i=zo(a.singleTypes);return[...t,...o,...s,...i]},ns=[{labelId:"app.components.LeftMenuLinkContainer.collectionTypes",defaultMessage:"Collection Types",id:"collectionTypes"},{labelId:"app.components.LeftMenuLinkContainer.singleTypes",id:"singleTypes",defaultMessage:"Single Types"},{labelId:"app.components.LeftMenuLinkContainer.plugins",defaultMessage:"Plugins",id:"plugins"},{labelId:"app.components.LeftMenuLinkContainer.settings",defaultMessage:"Settings",id:"settings"}];var os=Object.defineProperty,Uo=Object.getOwnPropertySymbols,as=Object.prototype.hasOwnProperty,ss=Object.prototype.propertyIsEnumerable,Vo=(a,t,o)=>t in a?os(a,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):a[t]=o,Go=(a,t)=>{for(var o in t||(t={}))as.call(t,o)&&Vo(a,o,t[o]);if(Uo)for(var o of Uo(t))ss.call(t,o)&&Vo(a,o,t[o]);return a};const eo=(0,e.forwardRef)(({layout:a,isFormDisabled:t,permissions:o},s)=>{const[{initialData:i,layouts:d,modifiedData:p},g]=(0,e.useReducer)(Qa,Xa,()=>Da(a,o)),{formatMessage:E}=(0,V.useIntl)();(0,e.useImperativeHandle)(s,()=>({getPermissions(){const j=(0,oe.difference)(i.collectionTypes,p.collectionTypes),U=(0,oe.difference)(i.singleTypes,p.singleTypes),w=Go(Go({},j),U);let N;return He()(w)?N=!1:N=Object.values(w).some(q=>Object.values(q).some(he=>Ae()(he,"conditions"))),{permissionsToSend:ts(p),didUpdateConditions:N}},resetForm(){g({type:"RESET_FORM"})},setFormAfterSubmit(){g({type:"SET_FORM_AFTER_SUBMIT"})}}));const b=(j,U,w,N)=>{g({type:"ON_CHANGE_COLLECTION_TYPE_ROW_LEFT_CHECKBOX",pathToCollectionType:j,propertyName:U,rowName:w,value:N})},S=(j,U,w)=>{g({type:"ON_CHANGE_COLLECTION_TYPE_GLOBAL_ACTION_CHECKBOX",collectionTypeKind:j,actionId:U,value:w})},L=j=>{g({type:"ON_CHANGE_CONDITIONS",conditions:j})},B=(0,e.useCallback)(({target:{name:j,value:U}})=>{g({type:"ON_CHANGE_SIMPLE_CHECKBOX",keys:j,value:U})},[]),z=(0,e.useCallback)(({target:{name:j,value:U}})=>{g({type:"ON_CHANGE_TOGGLE_PARENT_CHECKBOX",keys:j,value:U})},[]);return e.createElement(ea,{value:{availableConditions:a.conditions,modifiedData:p,onChangeConditions:L,onChangeSimpleCheckbox:B,onChangeParentCheckbox:z,onChangeCollectionTypeLeftActionRowCheckbox:b,onChangeCollectionTypeGlobalActionCheckbox:S}},e.createElement(Q.v,{id:"tabs",label:E({id:"Settings.permissions.users.tabs.label",defaultMessage:"Tabs Permissions"})},e.createElement(We.m,null,ns.map(j=>e.createElement(We.O,{key:j.id},E({id:j.labelId,defaultMessage:j.defaultMessage})))),e.createElement(_.n,{style:{position:"relative"}},e.createElement(_.x,null,e.createElement(mo,{layout:d.collectionTypes,kind:"collectionTypes",isFormDisabled:t})),e.createElement(_.x,null,e.createElement(mo,{layout:d.singleTypes,kind:"singleTypes",isFormDisabled:t})),e.createElement(_.x,null,e.createElement(Co,{layout:d.plugins,kind:"plugins",isFormDisabled:t})),e.createElement(_.x,null,e.createElement(Co,{layout:d.settings,kind:"settings",isFormDisabled:t})))))});eo.defaultProps={permissions:[],layout:{conditions:[],sections:{collectionTypes:{},singleTypes:{actions:[]},settings:[],plugins:[]}}},eo.propTypes={layout:r().object,isFormDisabled:r().bool.isRequired,permissions:r().array};const rs=(0,e.memo)(eo)},16437:(ce,O,n)=>{n.d(O,{Z:()=>C});const C=!0},78522:(ce,O,n)=>{n.d(O,{Z:()=>e});const e=()=>"todo empty role"},80779:(ce,O,n)=>{n.d(O,{Z:()=>ie});var e=n(32735),C=n(60216),r=n.n(C),oe=n(62345),Q=n(36320),We=n(94547),_=n(19786),Te=n(88860),Ae=n(50563),Re=n(88425),He=n.n(Re),V=n(5636),A=Object.defineProperty,P=Object.getOwnPropertySymbols,Be=Object.prototype.hasOwnProperty,Y=Object.prototype.propertyIsEnumerable,Oe=(x,ae,f)=>ae in x?A(x,ae,{enumerable:!0,configurable:!0,writable:!0,value:f}):x[ae]=f,K=(x,ae)=>{for(var f in ae||(ae={}))Be.call(ae,f)&&Oe(x,f,ae[f]);if(P)for(var f of P(ae))Y.call(ae,f)&&Oe(x,f,ae[f]);return x};const ze=({id:x,name:ae,description:f,usersCount:et,icons:Xe,rowIndex:be})=>{const{formatMessage:je}=(0,V.useIntl)(),Ne=je({id:"Roles.RoleRow.user-count",defaultMessage:"{number, plural, =0 {# user} one {# user} other {# users}}"},{number:et});return e.createElement(We.Tr,K({"aria-rowindex":be,key:x},(0,Re.onRowClick)({fn:Xe[1].onClick})),e.createElement(_.Td,{maxWidth:(0,Re.pxToRem)(130)},e.createElement(Te.Z,{ellipsis:!0,textColor:"neutral800"},ae)),e.createElement(_.Td,{maxWidth:(0,Re.pxToRem)(250)},e.createElement(Te.Z,{ellipsis:!0,textColor:"neutral800"},f)),e.createElement(_.Td,null,e.createElement(Te.Z,{textColor:"neutral800"},Ne)),e.createElement(_.Td,null,e.createElement(Q.k,K({justifyContent:"flex-end"},Re.stopPropagation),Xe.map((Ue,Ze)=>Ue?e.createElement(oe.x,{key:Ue.label,paddingLeft:Ze===0?0:1},e.createElement(Ae.h,{onClick:Ue.onClick,label:Ue.label,noBorder:!0,icon:Ue.icon})):null))))};ze.propTypes={id:r().number.isRequired,name:r().string.isRequired,description:r().string.isRequired,usersCount:r().number.isRequired,icons:r().array.isRequired,rowIndex:r().number.isRequired};const ie=ze},45677:(ce,O,n)=>{n.d(O,{Z:()=>ke});var e=n(32735),C=n(88425),r=n(83983),oe=n(58469),Q=n(19406),We=n(4038),_=n(68625),Te=n(47765),Ae=n(41415),Re=n(28356),He=n(17e3),V=n(56755),A=n(73269),P=n(33827),Be=n(94547),Y=n(19786),Oe=n(35658),K=n(88860),ze=n(27649),ie=n(3685),x=n(5636),ae=n(5141),f=n(80779),et=n(78522),Xe=n(60216),be=n.n(Xe),je=n(83292),Ne=n(71933),Ue=n(67563),Ze=n(50563),Qe=n(95489),dt=n(62345),st=n(36320),nt=n(27677),rt=n(47361),ne=n(35331);const me=n.p+"6d21938306785f176538.png",Ve=n.p+"617f9c948fa79e6d73bd.png",ee=je.default.div`
|
|
134
134
|
position: absolute;
|
|
135
135
|
z-index: 3;
|
|
136
136
|
inset: 0;
|
|
@@ -158,7 +158,7 @@
|
|
|
158
158
|
margin-right: ${20/16}rem;
|
|
159
159
|
z-index: 0;
|
|
160
160
|
}
|
|
161
|
-
`,
|
|
161
|
+
`,G=(0,je.default)(nt.K)`
|
|
162
162
|
align-items: flex-start;
|
|
163
163
|
max-width: ${400/16}rem;
|
|
164
164
|
z-index: 0;
|
|
@@ -166,7 +166,7 @@
|
|
|
166
166
|
position: absolute;
|
|
167
167
|
right: ${({theme:F})=>F.spaces[4]};
|
|
168
168
|
top: ${({theme:F})=>F.spaces[4]};
|
|
169
|
-
`,H=({onClose:F,isOpen:
|
|
169
|
+
`,H=({onClose:F,isOpen:le})=>{(0,C.useLockScroll)(le);const{formatMessage:Z}=(0,x.useIntl)();return le?e.createElement(Ne.h,null,e.createElement(ee,{onClick:F},e.createElement(Ue.i,{onEscape:F},e.createElement($,{onClick:te=>te.stopPropagation(),"aria-labelledby":"upgrade-plan",background:"neutral0",hasRadius:!0},e.createElement("img",{src:me,alt:"air-balloon"}),e.createElement(I,null,e.createElement(Ze.h,{onClick:F,"aria-label":"Close",icon:e.createElement(ne.default,null)})),e.createElement(G,{spacing:6},e.createElement(K.Z,{fontWeight:"bold",textColor:"primary600"},Z({id:"app.components.UpgradePlanModal.text-ce",defaultMessage:"COMMUNITY EDITION"})),e.createElement(nt.K,{spacing:2},e.createElement(K.Z,{variant:"alpha",as:"h2",id:"upgrade-plan"},Z({id:"app.components.UpgradePlanModal.limit-reached",defaultMessage:"You have reached the limit"})),e.createElement(K.Z,null,Z({id:"app.components.UpgradePlanModal.text-power",defaultMessage:"Unlock the full power of Strapi by upgrading your plan to the Enterprise Edition"}))),e.createElement(Qe.Q,{href:"https://strapi.io/pricing-self-hosted",isExternal:!0,endIcon:e.createElement(rt.default,null)},Z({id:"app.components.UpgradePlanModal.button",defaultMessage:"Learn more"}))),e.createElement("img",{src:Ve,alt:"upgrade-arrow"}))))):null};H.propTypes={onClose:be().func.isRequired,isOpen:be().bool.isRequired};const W=H;var X=n(775);const pe=()=>{const{roles:F,isLoading:le}=(0,X.bF)(),Z=(0,C.useQuery)(),te=decodeURIComponent(Z.get("_q")||""),v=(0,oe.ZP)(F,te,{keys:["name","description"]});return{isLoading:le,sortedRoles:v}},De=()=>{const{formatMessage:F}=(0,x.useIntl)(),[le,Z]=(0,e.useState)(!1),{trackUsage:te}=(0,C.useTracking)(),{push:v}=(0,ae.useHistory)(),ye=(0,e.useCallback)(Ce=>{v(`/settings/roles/${Ce}`)},[v]),de=(0,e.useCallback)(()=>{Z(Ce=>!Ce)},[]),Je=(0,e.useCallback)(()=>{te("didShowRBACUpgradeModal"),Z(!0)},[te]),ot=(0,e.useCallback)(Ce=>[{onClick:de,label:F({id:"app.utils.duplicate",defaultMessage:"Duplicate"}),icon:e.createElement(Te.Z,null)},{onClick:()=>ye(Ce.id),label:F({id:"app.utils.edit",defaultMessage:"Edit"}),icon:e.createElement(_.Z,null)},{onClick:de,label:F({id:"global.delete",defaultMessage:"Delete"}),icon:e.createElement(We.default,null)}],[F,de,ye]);return{isModalOpen:le,handleToggleModalForCreatingRole:Je,handleToggle:de,getIcons:ot}},ge=()=>{const{formatMessage:F}=(0,x.useIntl)();(0,C.useFocusWhenNavigate)();const{sortedRoles:le,isLoading:Z}=pe(),{isModalOpen:te,handleToggle:v,handleToggleModalForCreatingRole:ye,getIcons:de}=De(),Je=le.length+1,ot=5;return e.createElement(ze.o,null,e.createElement(C.SettingsPageTitle,{name:"Roles"}),e.createElement(Re.T,{primaryAction:e.createElement(Ae.z,{onClick:ye,startIcon:e.createElement(Q.default,null),size:"S"},F({id:"Settings.roles.list.button.add",defaultMessage:"Add new role"})),title:F({id:"global.roles",defaultMessage:"roles"}),subtitle:F({id:"Settings.roles.list.description",defaultMessage:"List of roles"})}),e.createElement(He.D,null,e.createElement(V.i,{colCount:ot,rowCount:Je,footer:e.createElement(A.c,{onClick:ye,icon:e.createElement(Q.default,null)},F({id:"Settings.roles.list.button.add",defaultMessage:"Add new role"}))},e.createElement(P.h,null,e.createElement(Be.Tr,null,e.createElement(Y.Th,null,e.createElement(K.Z,{variant:"sigma",textColor:"neutral600"},F({id:"global.name",defaultMessage:"Name"}))),e.createElement(Y.Th,null,e.createElement(K.Z,{variant:"sigma",textColor:"neutral600"},F({id:"global.description",defaultMessage:"Description"}))),e.createElement(Y.Th,null,e.createElement(K.Z,{variant:"sigma",textColor:"neutral600"},F({id:"global.users",defaultMessage:"Users"}))),e.createElement(Y.Th,null,e.createElement(ie.T,null,F({id:"global.actions",defaultMessage:"Actions"}))))),e.createElement(Oe.p,null,le==null?void 0:le.map((Ce,J)=>e.createElement(f.Z,{key:Ce.id,id:Ce.id,name:Ce.name,description:Ce.description,usersCount:Ce.usersCount,icons:de(Ce),rowIndex:J+2})))),!Je&&!Z&&e.createElement(et.Z,null)),e.createElement(W,{isOpen:te,onClose:v}))},ke=()=>e.createElement(C.CheckPagePermissions,{permissions:r.Z.settings.roles.main},e.createElement(ge,null))},75936:(ce,O,n)=>{n.d(O,{Z:()=>C});const C=[]},20178:(ce,O,n)=>{n.d(O,{Z:()=>rt});var e=n(32735),C=n(64213),r=n(88425),oe=n(62345),Q=n(41415),We=n(28356),_=n(17e3),Te=n(15335),Ae=n(5803),Re=n(27649),He=n(36320),V=n(27677),A=n(88860),P=n(10369),Be=n(10508),Y=n(29439),Oe=n(83281),K=n(33795),ze=n.n(K),ie=n(86834),x=n.n(ie),ae=n(5636),f=n(5141),et=n(83292),Xe=n(37511),be=n(775),je=n(83983),Ne=n(5173);const Ze=Ne.Ry().shape({name:Ne.Z_().required(r.translatedErrors.required),description:Ne.Z_().required(r.translatedErrors.required)});var Qe=n(98399),dt=(ne,me,Ve)=>new Promise((ee,$)=>{var G=W=>{try{H(Ve.next(W))}catch(X){$(X)}},I=W=>{try{H(Ve.throw(W))}catch(X){$(X)}},H=W=>W.done?ee(W.value):Promise.resolve(W.value).then(G,I);H((Ve=Ve.apply(ne,me)).next())});const st=et.default.div`
|
|
170
170
|
border: 1px solid ${({theme:ne})=>ne.colors.primary200};
|
|
171
171
|
background: ${({theme:ne})=>ne.colors.primary100};
|
|
172
172
|
padding: ${({theme:ne})=>`${ne.spaces[2]} ${ne.spaces[4]}`};
|
|
@@ -174,5 +174,5 @@
|
|
|
174
174
|
border-radius: ${({theme:ne})=>ne.borderRadius};
|
|
175
175
|
font-size: ${12/16}rem;
|
|
176
176
|
font-weight: bold;
|
|
177
|
-
`,nt=()=>{const ne=(0,r.useNotification)(),{lockApp:me,unlockApp:Ve}=(0,r.useOverlayBlocker)(),{formatMessage:ee}=(0,ae.useIntl)(),[$,
|
|
178
|
-
`);X({type:"warning",message:ft})}else X({type:"warning",message:{id:"notification.error"}})}ye()}),Z=(0,e.useCallback)(J=>{
|
|
177
|
+
`,nt=()=>{const ne=(0,r.useNotification)(),{lockApp:me,unlockApp:Ve}=(0,r.useOverlayBlocker)(),{formatMessage:ee}=(0,ae.useIntl)(),[$,G]=(0,e.useState)(!1),{replace:I}=(0,f.useHistory)(),H=(0,e.useRef)(),{trackUsage:W}=(0,r.useTracking)(),X=(0,f.useRouteMatch)("/settings/roles/duplicate/:id"),pe=ze()(X,"params.id",null),{isLoading:De,data:k}=(0,be.U_)(),{permissions:ge,isLoading:Ye}=(0,be.Dq)(pe),ke=le=>{me(),G(!0),W(pe?"willDuplicateRole":"willCreateNewRole"),Promise.resolve((0,r.request)("/admin/roles",{method:"POST",body:le})).then(Z=>dt(void 0,null,function*(){const{permissionsToSend:te}=H.current.getPermissions();return W(pe?"didDuplicateRole":"didCreateNewRole"),Z.data.id&&!x()(te)&&(yield(0,r.request)(`/admin/roles/${Z.data.id}/permissions`,{method:"PUT",body:{permissions:te}})),Z})).then(Z=>{G(!1),ne({type:"success",message:{id:"Settings.roles.created",defaultMessage:"created"}}),I(`/settings/roles/${Z.data.id}`)}).catch(Z=>{Qe.error(Z),G(!1),ne({type:"warning",message:{id:"notification.error"}})}).finally(()=>{Ve()})},F=`${ee({id:"Settings.roles.form.created",defaultMessage:"Created"})} ${(0,C.format)(new Date,"PPP")}`;return e.createElement(Re.o,null,e.createElement(r.SettingsPageTitle,{name:"Roles"}),e.createElement(Oe.Formik,{initialValues:{name:"",description:F},onSubmit:ke,validationSchema:Ze,validateOnChange:!1},({handleSubmit:le,values:Z,errors:te,handleReset:v,handleChange:ye})=>e.createElement(r.Form,{noValidate:!0},e.createElement(e.Fragment,null,e.createElement(We.T,{primaryAction:e.createElement(V.K,{horizontal:!0,spacing:2},e.createElement(Q.z,{variant:"secondary",onClick:()=>{v(),H.current.resetForm()},size:"L"},ee({id:"app.components.Button.reset",defaultMessage:"Reset"})),e.createElement(Q.z,{onClick:le,loading:$,size:"L"},ee({id:"global.save",defaultMessage:"Save"}))),title:ee({id:"Settings.roles.create.title",defaultMessage:"Create a role"}),subtitle:ee({id:"Settings.roles.create.description",defaultMessage:"Define the rights given to the role"}),navigationAction:e.createElement(r.Link,{startIcon:e.createElement(Y.Z,null),to:"/settings/roles"},ee({id:"global.back",defaultMessage:"Back"}))}),e.createElement(_.D,null,e.createElement(V.K,{spacing:6},e.createElement(oe.x,{background:"neutral0",padding:6,shadow:"filterShadow",hasRadius:!0},e.createElement(V.K,{spacing:4},e.createElement(He.k,{justifyContent:"space-between"},e.createElement(oe.x,null,e.createElement(oe.x,null,e.createElement(A.Z,{fontWeight:"bold"},ee({id:"global.details",defaultMessage:"Details"}))),e.createElement(oe.x,null,e.createElement(A.Z,{variant:"pi",textColor:"neutral600"},ee({id:"Settings.roles.form.description",defaultMessage:"Name and description of the role"})))),e.createElement(st,null,ee({id:"Settings.roles.form.button.users-with-role",defaultMessage:"{number, plural, =0 {# users} one {# user} other {# users}} with this role"},{number:0}))),e.createElement(Te.r,{gap:4},e.createElement(Ae.P,{col:6},e.createElement(P.o,{name:"name",error:te.name&&ee({id:te.name}),label:ee({id:"global.name",defaultMessage:"Name"}),onChange:ye,value:Z.name})),e.createElement(Ae.P,{col:6},e.createElement(Be.g,{label:ee({id:"global.description",defaultMessage:"Description"}),name:"description",error:te.description&&ee({id:te.description}),onChange:ye},Z.description))))),!De&&!Ye?e.createElement(oe.x,{shadow:"filterShadow",hasRadius:!0},e.createElement(Xe.Z,{isFormDisabled:!1,ref:H,permissions:ge,layout:k})):e.createElement(oe.x,{background:"neutral0",padding:6,shadow:"filterShadow",hasRadius:!0},e.createElement(r.LoadingIndicatorPage,null))))))))};function rt(){return e.createElement(r.CheckPagePermissions,{permissions:je.Z.settings.roles.create},e.createElement(nt,null))}},56899:(ce,O,n)=>{n.d(O,{Z:()=>C});const C=!1},68464:(ce,O,n)=>{n.d(O,{Z:()=>C});const C=!1},32741:(ce,O,n)=>{n.d(O,{Z:()=>C});const C=!1},19665:(ce,O,n)=>{n.d(O,{Z:()=>C});const C=!1},36950:(ce,O,n)=>{n.d(O,{Z:()=>C});const C=!1},96556:(ce,O,n)=>{n.d(O,{Z:()=>C});const C=!1},51899:(ce,O,n)=>{n.d(O,{Z:()=>ee});var e=n(32735),C=n(88425),r=n(83983),oe=n(19406),Q=n(4038),We=n(47765),_=n(68625),Te=n(41415),Ae=n(28356),Re=n(99223),He=n(17e3),V=n(3685),A=n(27649),P=n(56755),Be=n(73269),Y=n(33827),Oe=n(94547),K=n(19786),ze=n(35658),ie=n(88860),x=n(92891),ae=n(58469),f=n(5636),et=n(5141),Xe=n(17247),be=n(775),je=n(78522),Ne=n(80779),Ue=n(97889);const Ze={roleToDelete:null,showModalConfirmButtonLoading:!1,shouldRefetchData:!1},dt=($,G)=>(0,Ue.default)($,I=>{switch(G.type){case"ON_REMOVE_ROLES":{I.showModalConfirmButtonLoading=!0;break}case"ON_REMOVE_ROLES_SUCCEEDED":{I.shouldRefetchData=!0,I.roleToDelete=null;break}case"RESET_DATA_TO_DELETE":{I.shouldRefetchData=!1,I.roleToDelete=null,I.showModalConfirmButtonLoading=!1;break}case"SET_ROLE_TO_DELETE":{I.roleToDelete=G.id;break}default:return I}});var st=($,G,I)=>new Promise((H,W)=>{var X=k=>{try{De(I.next(k))}catch(ge){W(ge)}},pe=k=>{try{De(I.throw(k))}catch(ge){W(ge)}},De=k=>k.done?H(k.value):Promise.resolve(k.value).then(X,pe);De((I=I.apply($,G)).next())});const nt=()=>{(0,C.useFocusWhenNavigate)();const{isLoading:$,allowedActions:{canCreate:G,canDelete:I,canRead:H,canUpdate:W}}=(0,C.useRBAC)(r.Z.settings.roles),{getData:X,roles:pe,isLoading:De}=(0,be.bF)(!1),[{query:k}]=(0,C.useQueryParams)(),ge=(k==null?void 0:k._q)||"",Ye=(0,ae.ZP)(pe,ge,{keys:["name","description"]});return(0,e.useEffect)(()=>{!$&&H&&X()},[$,H,X]),{isLoadingForPermissions:$,canCreate:G,canDelete:I,canRead:H,canUpdate:W,isLoading:De,getData:X,sortedRoles:Ye,roles:pe}},rt=({getData:$,canCreate:G,canDelete:I,canUpdate:H})=>{const{formatMessage:W}=(0,f.useIntl)(),X=(0,C.useNotification)(),[pe,De]=(0,e.useState)(!1),{push:k}=(0,et.useHistory)(),[{selectedRoles:ge,showModalConfirmButtonLoading:Ye,roleToDelete:ke},F]=(0,e.useReducer)(dt,Ze),le=()=>st(void 0,null,function*(){try{F({type:"ON_REMOVE_ROLES"}),yield Xe.be.post("/admin/roles/batch-delete",{ids:[ke]}),yield $(),F({type:"RESET_DATA_TO_DELETE"})}catch(J){const xe=(0,x.get)(J,["response","payload","data","ids"],null);if(xe&&Array.isArray(xe)){const ft=xe.join(`
|
|
178
|
+
`);X({type:"warning",message:ft})}else X({type:"warning",message:{id:"notification.error"}})}ye()}),Z=(0,e.useCallback)(J=>{k(`/settings/roles/duplicate/${J}`)},[k]),te=()=>k("/settings/roles/new"),v=(0,e.useCallback)(J=>{F({type:"SET_ROLE_TO_DELETE",id:J}),ye()},[]),ye=()=>De(J=>!J),de=(0,e.useCallback)(J=>{k(`/settings/roles/${J}`)},[k]),Je=(0,e.useCallback)((J,xe)=>{J.preventDefault(),J.stopPropagation(),xe.usersCount?X({type:"info",message:{id:"Roles.ListPage.notification.delete-not-allowed"}}):v(xe.id)},[X,v]),ot=(0,e.useCallback)((J,xe)=>{J.preventDefault(),J.stopPropagation(),Z(xe.id)},[Z]),Ce=(0,e.useCallback)(J=>[...G?[{onClick:xe=>ot(xe,J),label:W({id:"app.utils.duplicate",defaultMessage:"Duplicate"}),icon:e.createElement(We.Z,null)}]:[],...H?[{onClick:()=>de(J.id),label:W({id:"app.utils.edit",defaultMessage:"Edit"}),icon:e.createElement(_.Z,null)}]:[],...I?[{onClick:xe=>Je(xe,J),label:W({id:"global.delete",defaultMessage:"Delete"}),icon:e.createElement(Q.default,null)}]:[]],[W,Je,ot,de,G,H,I]);return{handleNewRoleClick:te,getIcons:Ce,selectedRoles:ge,isWarningDeleteAllOpened:pe,showModalConfirmButtonLoading:Ye,handleToggleModal:ye,handleDeleteData:le}},me=()=>{const{formatMessage:$}=(0,f.useIntl)(),{isLoadingForPermissions:G,canCreate:I,canRead:H,canDelete:W,canUpdate:X,isLoading:pe,getData:De,sortedRoles:k}=nt(),{handleNewRoleClick:ge,getIcons:Ye,isWarningDeleteAllOpened:ke,showModalConfirmButtonLoading:F,handleToggleModal:le,handleDeleteData:Z}=rt({getData:De,canCreate:I,canDelete:W,canUpdate:X}),te=k.length+1,v=6;if(G)return e.createElement(A.o,null,e.createElement(C.LoadingIndicatorPage,null));const ye=$({id:"global.roles",defaultMessage:"roles"});return e.createElement(A.o,null,e.createElement(C.SettingsPageTitle,{name:"Roles"}),e.createElement(Ae.T,{primaryAction:I?e.createElement(Te.z,{onClick:ge,startIcon:e.createElement(oe.default,null),size:"S"},$({id:"Settings.roles.list.button.add",defaultMessage:"Add new role"})):null,title:ye,subtitle:$({id:"Settings.roles.list.description",defaultMessage:"List of roles"}),as:"h2"}),H&&e.createElement(Re.Z,{startActions:e.createElement(C.SearchURLQuery,{label:$({id:"app.component.search.label",defaultMessage:"Search for {target}"},{target:ye})})}),H&&e.createElement(He.D,null,e.createElement(P.i,{colCount:v,rowCount:te,footer:I?e.createElement(Be.c,{onClick:ge,icon:e.createElement(oe.default,null)},$({id:"Settings.roles.list.button.add",defaultMessage:"Add new role"})):null},e.createElement(Y.h,null,e.createElement(Oe.Tr,{"aria-rowindex":1},e.createElement(K.Th,null,e.createElement(ie.Z,{variant:"sigma",textColor:"neutral600"},$({id:"global.name",defaultMessage:"Name"}))),e.createElement(K.Th,null,e.createElement(ie.Z,{variant:"sigma",textColor:"neutral600"},$({id:"global.description",defaultMessage:"Description"}))),e.createElement(K.Th,null,e.createElement(ie.Z,{variant:"sigma",textColor:"neutral600"},$({id:"global.users",defaultMessage:"Users"}))),e.createElement(K.Th,null,e.createElement(V.T,null,$({id:"global.actions",defaultMessage:"Actions"}))))),e.createElement(ze.p,null,k==null?void 0:k.map((de,Je)=>e.createElement(Ne.Z,{key:de.id,id:de.id,name:de.name,description:de.description,usersCount:de.usersCount,icons:Ye(de),rowIndex:Je+2})))),!te&&!pe&&e.createElement(je.Z,null)),e.createElement(C.ConfirmDialog,{isOpen:ke,onConfirm:Z,isConfirmButtonLoading:F,onToggleDialog:le}))},ee=()=>e.createElement(C.CheckPagePermissions,{permissions:r.Z.settings.roles.main},e.createElement(me,null))},63775:(ce,O,n)=>{n.d(O,{Z:()=>oe});var e=(Q,We,_)=>new Promise((Te,Ae)=>{var Re=A=>{try{V(_.next(A))}catch(P){Ae(P)}},He=A=>{try{V(_.throw(A))}catch(P){Ae(P)}},V=A=>A.done?Te(A.value):Promise.resolve(A.value).then(Re,He);V((_=_.apply(Q,We)).next())});const oe=[...strapi.features.isEnabled(strapi.features.SSO)?[{Component(){return e(this,null,function*(){return yield n.e(302).then(n.bind(n,49851))})},to:"/settings/single-sign-on",exact:!0}]:[]]}}]);
|