@strapi/admin 4.9.0 → 4.10.0-beta.0
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/DynamicTable/CellContent/PublicationState/PublicationState.js +26 -0
- package/admin/src/content-manager/components/DynamicTable/CellContent/PublicationState/index.js +1 -0
- package/admin/src/content-manager/components/DynamicTable/CellContent/ReviewWorkflowsStage/ReviewWorkflowsStage.js +15 -0
- package/admin/src/content-manager/components/DynamicTable/CellContent/ReviewWorkflowsStage/index.js +1 -0
- package/admin/src/content-manager/components/DynamicTable/index.js +43 -49
- package/admin/src/content-manager/components/DynamicZone/components/DynamicComponent.js +2 -0
- package/admin/src/content-manager/components/EditViewDataManagerProvider/reducer.js +1 -3
- package/admin/src/content-manager/components/EditViewDataManagerProvider/utils/findAllAndReplace.js +3 -10
- package/admin/src/content-manager/components/InputUID/endActionStyle.js +13 -4
- package/admin/src/content-manager/components/InputUID/index.js +71 -94
- package/admin/src/content-manager/pages/EditView/Information/index.js +77 -53
- package/admin/src/content-manager/pages/EditView/InformationBox/InformationBoxCE.js +13 -0
- package/admin/src/content-manager/pages/EditView/InformationBox/index.js +3 -0
- package/admin/src/content-manager/pages/EditView/index.js +3 -4
- package/admin/src/content-manager/pages/ListView/index.js +6 -9
- package/admin/src/hooks/useRegenerate/index.js +7 -12
- package/admin/src/index.js +1 -0
- package/admin/src/pages/AuthPage/components/Register/index.js +38 -46
- package/admin/src/pages/SettingsPage/components/Tokens/FormHead/index.js +0 -4
- package/admin/src/pages/SettingsPage/components/Tokens/Regenerate/index.js +3 -5
- package/admin/src/pages/SettingsPage/components/Tokens/TokenTypeSelect/index.js +5 -7
- package/admin/src/pages/SettingsPage/pages/TransferTokens/EditView/components/FormTransferTokenContainer/index.js +0 -41
- package/admin/src/pages/SettingsPage/pages/TransferTokens/EditView/index.js +9 -53
- package/admin/src/pages/SettingsPage/pages/TransferTokens/EditView/utils/schema.js +0 -1
- package/admin/src/pages/SettingsPage/pages/TransferTokens/ListView/index.js +5 -27
- package/admin/src/translations/en.json +6 -1
- package/build/2263.4c5916f9.chunk.js +98 -0
- package/build/4049.64715f20.chunk.js +1 -0
- package/build/4649.213b8a3b.chunk.js +30 -0
- package/build/6985.66cca29c.chunk.js +1 -0
- package/build/7259.aefb51e8.chunk.js +1 -0
- package/build/8469.853c822b.chunk.js +1 -0
- package/build/9505.dbe702ab.chunk.js +14 -0
- package/build/9816.01ee964f.chunk.js +2 -0
- package/build/Admin-authenticatedApp.f50ad423.chunk.js +79 -0
- package/build/Admin_InternalErrorPage.4ad8b0df.chunk.js +1 -0
- package/build/Admin_homePage.1411fb7c.chunk.js +68 -0
- package/build/Admin_marketplace.02608d56.chunk.js +22 -0
- package/build/Admin_pluginsPage.15e3b0fd.chunk.js +1 -0
- package/build/Admin_profilePage.76afeca0.chunk.js +15 -0
- package/build/Admin_settingsPage.147755cd.chunk.js +9 -0
- package/build/Upload_ConfigureTheView.34dde278.chunk.js +1 -0
- package/build/admin-app.55dd7921.chunk.js +112 -0
- package/build/admin-edit-roles-page.cf543488.chunk.js +216 -0
- package/build/admin-edit-users.31c20712.chunk.js +10 -0
- package/build/admin-roles-list.489c501f.chunk.js +2 -0
- package/build/admin-users.3e111a7d.chunk.js +11 -0
- package/build/api-tokens-create-page.4328b852.chunk.js +1 -0
- package/build/api-tokens-edit-page.bce5050f.chunk.js +1 -0
- package/build/api-tokens-list-page.93f24348.chunk.js +16 -0
- package/build/audit-logs-settings-page.7be97e82.chunk.js +1 -0
- package/build/content-manager.4480ae88.chunk.js +1137 -0
- package/build/content-type-builder-list-view.cf38fe2f.chunk.js +191 -0
- package/build/content-type-builder-translation-en-json.7961593e.chunk.js +1 -0
- package/build/content-type-builder.af9abf1e.chunk.js +126 -0
- package/build/email-settings-page.4bdbef9a.chunk.js +3 -0
- package/build/en-json.697b4bcf.chunk.js +1 -0
- package/build/{highlight.js.28a1547e.chunk.js → highlight.js.26ef649f.chunk.js} +2 -2
- package/build/i18n-settings-page.2bb5be96.chunk.js +1 -0
- package/build/index.html +1 -1
- package/build/main.af8c0f31.js +3790 -0
- package/build/review-workflows-settings.7a7dc773.chunk.js +57 -0
- package/build/runtime~main.5a95bee6.js +2 -0
- package/build/sso-settings-page.272b87c8.chunk.js +1 -0
- package/build/transfer-tokens-create-page.a1f14bb1.chunk.js +1 -0
- package/build/transfer-tokens-edit-page.00ee1c74.chunk.js +1 -0
- package/build/transfer-tokens-list-page.ce37354b.chunk.js +16 -0
- package/build/upload-settings.0875e973.chunk.js +1 -0
- package/build/{upload-translation-th-json.98d35574.chunk.js → upload-translation-th-json.3847dae0.chunk.js} +1 -1
- package/build/upload.c7da1611.chunk.js +13 -0
- package/build/users-advanced-settings-page.1d3c14c7.chunk.js +1 -0
- package/build/users-email-settings-page.e8db68c4.chunk.js +1 -0
- package/build/users-providers-settings-page.14cac425.chunk.js +1 -0
- package/build/users-roles-settings-page.2ea4de84.chunk.js +30 -0
- package/build/webhook-edit-page.329141a5.chunk.js +23 -0
- package/build/webhook-list-page.029957a4.chunk.js +1 -0
- package/ee/admin/content-manager/pages/EditView/InformationBox/InformationBoxEE.js +92 -0
- package/ee/admin/content-manager/pages/EditView/InformationBox/index.js +3 -0
- package/ee/admin/hooks/useSettingsMenu/utils/customAdminLinks.js +12 -12
- package/ee/admin/hooks/useSettingsMenu/utils/customGlobalLinks.js +21 -13
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/ReviewWorkflows.js +195 -0
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/actions/index.js +42 -0
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/components/AddStage/AddStage.js +87 -0
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/components/AddStage/index.js +1 -0
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/components/Stages/Stage/Stage.js +90 -0
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/components/Stages/Stage/index.js +1 -0
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/components/Stages/Stages.js +92 -0
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/components/Stages/index.js +1 -0
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/constants.js +6 -0
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/hooks/useReviewWorkflows.js +35 -0
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/index.js +3 -0
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/reducer/index.js +121 -0
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/utils/getWorkflowValidationSchema.js +25 -0
- package/ee/admin/pages/SettingsPage/utils/customRoutes.js +16 -2
- package/ee/admin/permissions/customPermissions.js +3 -0
- package/ee/server/bootstrap.js +13 -0
- package/ee/server/config/admin-actions.js +10 -0
- package/ee/server/constants/default-stages.json +14 -0
- package/ee/server/constants/default-workflow.json +1 -0
- package/ee/server/constants/workflows.js +8 -0
- package/ee/server/content-types/index.js +9 -0
- package/ee/server/content-types/workflow/index.js +34 -0
- package/ee/server/content-types/workflow-stage/index.js +41 -0
- package/ee/server/controllers/index.js +2 -0
- package/ee/server/controllers/workflows/index.js +36 -0
- package/ee/server/controllers/workflows/stages/index.js +95 -0
- package/ee/server/index.js +1 -0
- package/ee/server/middlewares/review-workflows.js +40 -0
- package/ee/server/migrations/review-workflows.js +39 -0
- package/ee/server/register.js +9 -3
- package/ee/server/routes/index.js +104 -0
- package/ee/server/services/audit-logs.js +16 -75
- package/ee/server/services/index.js +4 -0
- package/ee/server/services/review-workflows/entity-service-decorator.js +42 -0
- package/ee/server/services/review-workflows/review-workflows.js +175 -0
- package/ee/server/services/review-workflows/stages.js +148 -0
- package/ee/server/services/review-workflows/workflows.js +25 -0
- package/ee/server/utils/index.js +8 -0
- package/ee/server/utils/review-workflows.js +25 -0
- package/ee/server/utils/test.js +11 -0
- package/ee/server/validation/review-workflows.js +24 -0
- package/jest.config.front.js +6 -1
- package/package.json +15 -17
- package/server/controllers/transfer/runner.js +2 -4
- package/server/middlewares/data-transfer.js +1 -4
- package/server/routes/transfer.js +4 -13
- package/server/services/constants.js +0 -4
- package/server/services/transfer/permission.js +1 -1
- package/server/services/transfer/token.js +31 -33
- package/server/validation/transfer/token.js +2 -10
- package/webpack.config.js +1 -1
- package/.eslintignore +0 -4
- package/.eslintrc.js +0 -14
- package/admin/src/components/LocalesProvider/__mocks__/useLocalesProvider.js +0 -7
- package/admin/src/hooks/useConfigurations/__mocks__/index.js +0 -7
- package/build/1387.84b454d3.chunk.js +0 -1
- package/build/1657.45231968.chunk.js +0 -168
- package/build/3081.bcf9a12f.chunk.js +0 -108
- package/build/462.8fff7f3b.chunk.js +0 -71
- package/build/4628.20631dd1.chunk.js +0 -1
- package/build/5542.b8240e3f.chunk.js +0 -70
- package/build/5563.905daa13.chunk.js +0 -79
- package/build/6404.68405699.chunk.js +0 -100
- package/build/7259.b7d00cea.chunk.js +0 -1
- package/build/8694.6522968d.chunk.js +0 -247
- package/build/9347.058ddb22.chunk.js +0 -1
- package/build/Admin-authenticatedApp.31bf88ef.chunk.js +0 -79
- package/build/Admin_InternalErrorPage.15c6bf07.chunk.js +0 -1
- package/build/Admin_homePage.da2181fe.chunk.js +0 -73
- package/build/Admin_marketplace.d99044eb.chunk.js +0 -31
- package/build/Admin_pluginsPage.f6b52ee9.chunk.js +0 -6
- package/build/Admin_profilePage.9112cffc.chunk.js +0 -15
- package/build/Admin_settingsPage.cb63220f.chunk.js +0 -79
- package/build/Upload_ConfigureTheView.eaaec495.chunk.js +0 -1
- package/build/admin-app.8cde5b22.chunk.js +0 -110
- package/build/admin-edit-roles-page.4f1858e9.chunk.js +0 -280
- package/build/admin-edit-users.7e14d85f.chunk.js +0 -10
- package/build/admin-roles-list.97e198f9.chunk.js +0 -31
- package/build/admin-users.d02de059.chunk.js +0 -34
- package/build/api-tokens-create-page.97595e12.chunk.js +0 -1
- package/build/api-tokens-edit-page.cd36e30e.chunk.js +0 -1
- package/build/api-tokens-list-page.6757c7b9.chunk.js +0 -16
- package/build/audit-logs-settings-page.ca9a3c46.chunk.js +0 -76
- package/build/content-manager.de0ee3e5.chunk.js +0 -1132
- package/build/content-type-builder-list-view.9c2c020c.chunk.js +0 -214
- package/build/content-type-builder-translation-en-json.e577d595.chunk.js +0 -1
- package/build/content-type-builder.ec5ac7ab.chunk.js +0 -126
- package/build/email-settings-page.1095e1ab.chunk.js +0 -10
- package/build/en-json.b052667a.chunk.js +0 -1
- package/build/i18n-settings-page.7d80aae0.chunk.js +0 -60
- package/build/main.d40f9ca1.js +0 -2280
- package/build/runtime~main.7cdc9956.js +0 -2
- package/build/sso-settings-page.1dd4886e.chunk.js +0 -1
- package/build/transfer-tokens-create-page.ec2ca215.chunk.js +0 -1
- package/build/transfer-tokens-edit-page.22bf28e5.chunk.js +0 -1
- package/build/transfer-tokens-list-page.cf8c77f2.chunk.js +0 -16
- package/build/upload-settings.945fdcfa.chunk.js +0 -13
- package/build/upload.a86b1054.chunk.js +0 -33
- package/build/users-advanced-settings-page.5b5a9baa.chunk.js +0 -8
- package/build/users-email-settings-page.e5506eb4.chunk.js +0 -23
- package/build/users-providers-settings-page.e32089c2.chunk.js +0 -28
- package/build/users-roles-settings-page.a5c5b0df.chunk.js +0 -30
- package/build/webhook-edit-page.213f0075.chunk.js +0 -75
- package/build/webhook-list-page.5beb2a5c.chunk.js +0 -71
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
(self.webpackChunk_strapi_admin=self.webpackChunk_strapi_admin||[]).push([[5538],{90597:function(O,E,t){"use strict";t.r(E),t.d(E,{default:function(){return Rs}});var e=t(32735),r=t(5141),n=t(39161),f=t(86349),m=t.n(f),g=t(88423),c=t.n(g),B=t(93839),R=t.n(B),j=t(56784),v=t.n(j),x=t(99357),T=t(463),Z=()=>{const u=[];return{register(s){u.push(s)},delete(s){u.splice(u.indexOf(s),1)},runWaterfall(s,o){return u.reduce((i,d)=>d(i,o),s)},async runWaterfallAsync(s,o){let i=s;for(const d of u)i=await d(i,o);return i},runSeries(...s){return u.map(o=>o(...s))},async runSeriesAsync(...s){const o=[];for(const i of u)o.push(await i(...s));return o},runParallel(...s){return Promise.all(u.map(o=>o(...s)))}}},L=t(13055);const U=(u,s)=>{let o=L.compose;const i=[];u.forEach(y=>{i.push(y())});const d=(0,L.createStore)($(s,{}),{},o((0,L.applyMiddleware)(...i)));return d.asyncReducers={},d.injectReducer=(y,C)=>{d.asyncReducers[y]=C,d.replaceReducer($(s,d.asyncReducers))},d},$=(u,s)=>(0,L.combineReducers)({...u,...s});var z=U,ae=t(20284),P=t(13478),M=t(84306),A=t(5636),W=t(60216),a=t.n(W);const ie=({component:u,path:s,...o})=>{const{pathname:i,search:d}=(0,r.useLocation)();return e.createElement(r.Route,{path:s,render:y=>P.auth.getToken()!==null?e.createElement(u,{...o,...y}):e.createElement(r.Redirect,{to:{pathname:"/auth/login",search:i!=="/"&&`?redirectTo=${encodeURIComponent(`${i}${d}`)}`}})})};ie.propTypes={component:a().any.isRequired,path:a().string.isRequired};var Le=(0,e.memo)(ie),Be=t(8997),Ge=t(20011),_e=t(39935),ve=t.n(_e),Ne=t(33795),me=t.n(Ne),Xe=t(9086),qe=t.n(Xe);const Ke="GUIDED_TOUR_CURRENT_STEP",_="GUIDED_TOUR_COMPLETED_STEPS",Te="GUIDED_TOUR_SKIPPED",te=JSON.parse,Pe=JSON.stringify;var le={clear(){localStorage.removeItem(Ke),localStorage.removeItem(_)},addCompletedStep(u){const s=te(localStorage.getItem(_))?.slice()||[];s.includes(u)||(s.push(u),localStorage.setItem(_,Pe(s)))},addCurrentStep(u){localStorage.setItem(Ke,Pe(u))},setSkipped(u){localStorage.setItem(Te,Pe(u))},get(u){return te(localStorage.getItem(u))}},re=t(20139),je=t(41832),Oe=u=>u,fe=t(97889),Re=t(3040),He=t.n(Re);const Fe={formErrors:{},modifiedData:{},requestError:null},et=(u,s)=>(0,fe.default)(u,o=>{switch(s.type){case"ON_CHANGE":{He()(o.modifiedData,s.keys.split("."),s.value);break}case"RESET_PROPS":return Fe;case"SET_DATA":{o.modifiedData=s.data;break}case"SET_ERRORS":{o.formErrors=s.errors;break}case"SET_REQUEST_ERROR":{o.requestError={errorMessage:s.errorMessage,errorStatus:s.errorStatus};break}default:return o}}),$e=(()=>window&&window.strapi&&window.strapi.isEE?t(7277).Z:t(56355).Z)(),V=u=>{let{hasAdmin:s,setHasAdmin:o}=u;const{push:i,location:{search:d}}=(0,r.useHistory)(),{changeLocale:y}=(0,re.Z)(),{setSkipped:C}=(0,P.useGuidedTour)(),{trackUsage:I}=(0,P.useTracking)(),{params:{authType:w}}=(0,r.useRouteMatch)("/auth/:authType"),Q=(0,P.useQuery)(),{Component:K,endPoint:b,fieldsToDisable:Y,fieldsToOmit:H,inputsPrefix:ee,schema:F,...ce}=me()($e,w,{}),[{formErrors:Ce,modifiedData:it,requestError:lt},Qe]=(0,e.useReducer)(et,Fe,Oe),Ze=M.Z.CancelToken.source();(0,e.useEffect)(()=>()=>{Ze.cancel("Component unmounted")},[]),(0,e.useEffect)(()=>{Qe({type:"RESET_PROPS"})},[w]);const Cs=ne=>{let{target:{name:ye,value:ge}}=ne;Qe({type:"ON_CHANGE",keys:ye,value:ge})},As=async(ne,ye)=>{let{setSubmitting:ge,setErrors:Ae}=ye;ge(!0);const Ue=qe()(ne,H),q=`/admin/${b}`;w==="login"&&await Ms(ne,q,{setSubmitting:ge,setErrors:Ae}),(w==="register"||w==="register-admin")&&await Ss(ne,q,{setSubmitting:ge,setErrors:Ae}),w==="forgot-password"&&await Ls(Ue,q,{setSubmitting:ge,setErrors:Ae}),w==="reset-password"&&await Ds(Ue,q,{setSubmitting:ge,setErrors:Ae})},Ls=async(ne,ye,ge)=>{let{setSubmitting:Ae,setErrors:Ue}=ge;try{await(0,M.Z)({method:"POST",url:`${strapi.backendURL}${ye}`,data:ne,cancelToken:Ze.token}),i("/auth/forgot-password-success")}catch(q){console.error(q),Ue({errorMessage:"notification.error"})}finally{Ae(!1)}},Ms=async(ne,ye,ge)=>{let{setSubmitting:Ae,setErrors:Ue}=ge;try{const{data:{data:{token:q,user:de}}}=await(0,M.Z)({method:"POST",url:`${strapi.backendURL}${ye}`,data:qe()(ne,H),cancelToken:Ze.token});de.preferedLanguage&&y(de.preferedLanguage),P.auth.setToken(q,ne.rememberMe),P.auth.setUserInfo(de,ne.rememberMe),Jt()}catch(q){if(q.response){const de=me()(q,["response","data","error","message"],"Something went wrong");if(ve()(de).toLowerCase()==="usernotactive"){i("/auth/oops"),Qe({type:"RESET_PROPS"});return}Ue({errorMessage:de})}}finally{Ae(!1)}},Ss=async(ne,ye,ge)=>{let{setSubmitting:Ae,setErrors:Ue}=ge;try{I("willCreateFirstAdmin");const{data:{data:{token:q,user:de}}}=await(0,M.Z)({method:"POST",url:`${strapi.backendURL}${ye}`,data:qe()(ne,H),cancelToken:Ze.token});P.auth.setToken(q,!1),P.auth.setUserInfo(de,!1),Ae(!1),o(!0);const{roles:Je}=de;if(Je&&Je.find(Is=>{let{code:Os}=Is;return Os==="strapi-super-admin"})&&(le.setSkipped(!1),C(!1),I("didLaunchGuidedtour")),w==="register"&&ne.userInfo.news===!0||w==="register-admin"&&ne.news===!0){i({pathname:"/usecase",search:`?hasAdmin=${s}`});return}Jt()}catch(q){if(I("didNotCreateFirstAdmin"),q.response){const{data:de}=q.response,Je=(0,je.Z)(de);Ue({apiErrors:Je})}}},Ds=async(ne,ye,ge)=>{let{setErrors:Ae,setSubmitting:Ue}=ge;try{const{data:{data:{token:q,user:de}}}=await(0,M.Z)({method:"POST",url:`${strapi.backendURL}${ye}`,data:{...ne,resetPasswordToken:Q.get("code")},cancelToken:Ze.token});P.auth.setToken(q,!1),P.auth.setUserInfo(de,!1),i("/")}catch(q){if(q.response){const de=me()(q,["response","data","message"],"Something went wrong"),Je=me()(q,["response","data","statusCode"],400);Qe({type:"SET_REQUEST_ERROR",errorMessage:de,errorStatus:Je}),Ae({errorMessage:de})}}finally{Ue(!1)}},Jt=()=>{if(w==="login"){const ne=Q.get("redirectTo"),ye=ne?decodeURIComponent(ne):"/";i(ye)}else i("/")};return!$e[w]||s&&w==="register-admin"||P.auth.getToken()?e.createElement(r.Redirect,{to:"/"}):!s&&w!=="register-admin"?e.createElement(r.Redirect,{to:{pathname:"/auth/register-admin",search:d}}):e.createElement(K,(0,Ge.Z)({},ce,{authType:w,fieldsToDisable:Y,formErrors:Ce,inputsPrefix:ee,modifiedData:it,onChange:Cs,onSubmit:As,requestError:lt,schema:F}))};V.defaultProps={hasAdmin:!1},V.propTypes={hasAdmin:a().bool,setHasAdmin:a().func.isRequired};var ut=V,xe=t(53951),J=t(83292),se=t(33348),pe=t(10190),Se=t(954);const ze=[{intlLabel:{id:"Usecase.front-end",defaultMessage:"Front-end developer"},value:"front_end_developer"},{intlLabel:{id:"Usecase.back-end",defaultMessage:"Back-end developer"},value:"back_end_developer"},{intlLabel:{id:"Usecase.full-stack",defaultMessage:"Full-stack developer"},value:"full_stack_developer"},{intlLabel:{id:"global.content-manager",defaultMessage:"Content Manager"},value:"content_manager"},{intlLabel:{id:"Usecase.content-creator",defaultMessage:"Content Creator"},value:"content_creator"},{intlLabel:{id:"Usecase.other",defaultMessage:"Other"},value:"other"}],Ut=(0,J.default)(n.Typography)`
|
|
2
|
+
text-align: center;
|
|
3
|
+
`;var xt=()=>{const u=(0,P.useNotification)(),{push:s,location:o}=(0,r.useHistory)(),{formatMessage:i}=(0,A.useIntl)(),[d,y]=(0,e.useState)(),[C,I]=(0,e.useState)(""),{firstname:w,email:Q}=P.auth.getUserInfo(),{hasAdmin:K}=(0,se.parse)(o?.search,{ignoreQueryPrefix:!0}),b=d==="other",Y=H=>{try{(0,M.Z)({method:"POST",url:"https://analytics.strapi.io/register",data:{email:Q,username:w,firstAdmin:Boolean(!K),persona:{role:H?void 0:d,otherRole:H?void 0:C}}}),u({type:"success",message:{id:"Usecase.notification.success.project-created",defaultMessage:"Project has been successfully created"}}),s("/")}catch{}};return e.createElement(Se.ZP,null,e.createElement(n.Main,{labelledBy:"usecase-title"},e.createElement(Se.bU,null,e.createElement("form",{onSubmit:()=>Y(!1)},e.createElement(n.Flex,{direction:"column",paddingBottom:7},e.createElement(pe.Z,null),e.createElement(n.Box,{paddingTop:6,paddingBottom:1,width:(0,P.pxToRem)(250)},e.createElement(Ut,{variant:"alpha",as:"h1",id:"usecase-title"},i({id:"Usecase.title",defaultMessage:"Tell us a bit more about yourself"})))),e.createElement(n.Flex,{direction:"column",alignItems:"stretch",gap:6},e.createElement(n.Select,{id:"usecase","data-testid":"usecase",label:i({id:"Usecase.input.work-type",defaultMessage:"What type of work do you do?"}),onChange:y,value:d},ze.map(({intlLabel:H,value:ee})=>e.createElement(n.Option,{key:ee,value:ee},i(H)))),b&&e.createElement(n.TextInput,{name:"other",label:i({id:"Usecase.other",defaultMessage:"Other"}),value:C,onChange:H=>I(H.target.value),"data-testid":"other"}),e.createElement(n.Button,{type:"submit",size:"L",fullWidth:!0,disabled:!d},i({id:"global.finish",defaultMessage:"Finish"}))))),e.createElement(n.Flex,{justifyContent:"center"},e.createElement(n.Box,{paddingTop:4},e.createElement(n.TextButton,{onClick:()=>Y(!0)},i({id:"Usecase.button.skip",defaultMessage:"Skip this question"}))))))},yt=t(61605),vt=async()=>`web-fingerprint-${(await(await yt.ZP.load()).get()).visitorId}`,Tt=[],Pt=[...(()=>window&&window.strapi&&window.strapi.isEE?t(68944).Z:t(56761).Z)(),...Tt],tt=t(8888);const Rt=(0,e.lazy)(()=>Promise.all([t.e(9816),t.e(801)]).then(t.bind(t,29761)));function Ye(){const u=(0,P.useNotification)(),{updateProjectSettings:s}=(0,tt.um)(),{formatMessage:o}=(0,A.useIntl)(),[{isLoading:i,hasAdmin:d,uuid:y,deviceId:C},I]=(0,e.useState)({isLoading:!0,hasAdmin:!1}),w=(0,P.useAppInfos)(),{get:Q}=(0,P.useFetchClient)(),K=(0,e.useMemo)(()=>(0,Be.WW)(Pt.map(({to:F,Component:ce,exact:Ce})=>(0,Be.ot)(ce,F,Ce))),[]),[b,Y]=(0,e.useState)(null);(0,e.useEffect)(()=>{const F=P.auth.getToken();F&&(async()=>{try{const{data:{token:Ce}}=await(0,P.request)("/admin/renew-token",{method:"POST",body:{token:F}});P.auth.updateToken(Ce)}catch{P.auth.clearAppStorage(),window.location.reload()}})()},[]),(0,e.useEffect)(()=>{(async()=>{try{const{data:{data:{hasAdmin:ce,uuid:Ce,menuLogo:it,authLogo:lt}}}=await M.Z.get(`${strapi.backendURL}/admin/init`);s({menuLogo:(0,P.prefixFileUrlWithBackendUrl)(it),authLogo:(0,P.prefixFileUrlWithBackendUrl)(lt)});const Qe=await vt();if(Ce){const{data:{data:wt}}=await Q("/admin/telemetry-properties",{validateStatus:Ze=>Ze<500});Y(wt);try{await fetch("https://analytics.strapi.io/api/v2/track",{method:"POST",body:JSON.stringify({event:"didInitializeAdministration",userId:"",deviceId:Qe,eventPropeties:{},userProperties:{environment:w.currentEnvironment},groupProperties:{...wt,projectId:Ce}}),headers:{"Content-Type":"application/json"}})}catch{}}I({isLoading:!1,hasAdmin:ce,uuid:Ce,deviceId:Qe})}catch{u({type:"warning",message:{id:"app.containers.App.notification.error.init"}})}})()},[u,s]);const H=F=>I(ce=>({...ce,hasAdmin:F})),ee=(0,e.useMemo)(()=>({uuid:y,telemetryProperties:b,deviceId:C}),[y,b,C]);return i?e.createElement(P.LoadingIndicatorPage,null):e.createElement(e.Suspense,{fallback:e.createElement(P.LoadingIndicatorPage,null)},e.createElement(n.SkipToContent,null,o({id:"skipToContent"})),e.createElement(P.TrackingProvider,{value:ee},e.createElement(r.Switch,null,K,e.createElement(r.Route,{path:"/auth/:authType",render:F=>e.createElement(ut,{...F,setHasAdmin:H,hasAdmin:d}),exact:!0}),e.createElement(Le,{path:"/usecase",component:xt}),e.createElement(Le,{path:"/",component:Rt}),e.createElement(r.Route,{path:"",component:xe.default}))))}var Ct=Ye,ct=t(47750),st=t(84968),At=t(4409),dt=t(66694);const mt={menuLogo:null,authLogo:null};var Lt=(u=mt,s)=>(0,fe.default)(u,o=>{switch(s.type){case"UPDATE_PROJECT_SETTINGS":{Object.assign(o,s.values);break}default:return o}});const Mt=({children:u,authLogo:s,menuLogo:o,showReleaseNotification:i,showTutorials:d})=>{const[{menuLogo:y,authLogo:C},I]=(0,e.useReducer)(Lt,mt),w=(0,e.useCallback)(({menuLogo:K,authLogo:b})=>I({type:"UPDATE_PROJECT_SETTINGS",values:{menuLogo:K||o,authLogo:b||s}}),[s,o]),Q=(0,e.useMemo)(()=>({logos:{menu:{custom:y,default:o},auth:{custom:C,default:s}},updateProjectSettings:w,showReleaseNotification:i,showTutorials:d}),[y,o,C,s,w,i,d]);return e.createElement(dt._5.Provider,{value:Q},u)};Mt.propTypes={authLogo:a().string.isRequired,children:a().element.isRequired,menuLogo:a().string.isRequired,showReleaseNotification:a().bool.isRequired,showTutorials:a().bool.isRequired};var St=Mt,Dt=t(58732),_t=t.n(Dt),Nt=t(5985);const It=({changeLocale:u,children:s,localeNames:o,messages:i})=>e.createElement(Nt.Z.Provider,{value:{changeLocale:u,localeNames:o,messages:i}},s);It.propTypes={changeLocale:a().func.isRequired,children:a().element.isRequired,localeNames:a().object.isRequired,messages:a().object.isRequired};var Ot=It,nt="strapi-admin-language",p=u=>{const s=window.localStorage.getItem(nt);return{locale:u[s]?s:"en",localeNames:u}};const l={localeNames:{en:"English"},locale:"en"};var k=(u=l,s)=>{switch(s.type){case"CHANGE_LOCALE":{const{locale:o}=s;return u.localeNames[o]?{...u,locale:o}:u}default:return u}};const N=({children:u,localeNames:s,messages:o})=>{const[{locale:i},d]=(0,e.useReducer)(k,l,()=>p(s));(0,e.useEffect)(()=>{window.localStorage.setItem(nt,i),document.documentElement.setAttribute("lang",i)},[i]);const y=I=>{d({type:"CHANGE_LOCALE",locale:I})},C=_t()(o[i],o.en);return e.createElement(A.IntlProvider,{locale:i,defaultLocale:"en",messages:C,textComponent:"span"},e.createElement(Ot,{changeLocale:y,localeNames:s,messages:C},u))};N.propTypes={children:a().element.isRequired,localeNames:a().objectOf(a().string).isRequired,messages:a().object.isRequired};var G=N,oe=(u,s)=>{const o=Object.entries(s),i=o.findIndex(([y])=>y===u);return o.slice(0,i).every(([,y])=>Object.values(y).every(Boolean))},he=(u,s)=>{const o=u.split("."),i=o[1],d=Object.entries(s[o[0]]),y=d.findIndex(([I])=>I===i);return d.slice(0,y).every(([,I])=>I)};const De={currentStep:null,guidedTourState:{contentTypeBuilder:{create:!1,success:!1},contentManager:{create:!1,success:!1},apiTokens:{create:!1,success:!1}},isGuidedTourVisible:!1,isSkipped:!0};var Ve=(u=De,s)=>(0,fe.default)(u,o=>{switch(s.type){case"SET_CURRENT_STEP":{o.currentStep=s.step;break}case"SET_STEP_STATE":{const[i,d]=s.currentStep.split(".");o.guidedTourState[i][d]=s.value;break}case"SET_SKIPPED":{o.isSkipped=s.value;break}case"SET_GUIDED_TOUR_VISIBILITY":{o.isGuidedTourVisible=s.value;break}default:return o}}),gt=u=>{const s={...u},o=le.get(_),i=le.get(Ke),d=le.get(Te);if(o&&o.forEach(y=>{const[C,I]=y.split(".");He()(s,["guidedTourState",C,I],!0)}),i){const[y,C]=i.split(".");He()(s,["guidedTourState",y,C],!0),le.addCompletedStep(i),le.addCurrentStep(null)}return d!==null&&He()(s,"isSkipped",d),s};const ot=({children:u})=>{const[{currentStep:s,guidedTourState:o,isGuidedTourVisible:i,isSkipped:d},y]=(0,e.useReducer)(Ve,De,gt),C=b=>{if(b!==null){const Y=me()(o,b),H=he(b,o);if(Y||d||!H)return null}return le.addCurrentStep(b),y({type:"SET_CURRENT_STEP",step:b})},I=b=>{y({type:"SET_GUIDED_TOUR_VISIBILITY",value:b})},w=(b,Y)=>{le.addCompletedStep(b),y({type:"SET_STEP_STATE",currentStep:b,value:Y})},Q=b=>{const Y=o[b];if(Y){const H=oe(b,o),ee=Object.keys(Y)[0],F=Y[ee];if(H&&!s&&!F)return C(`${b}.${ee}`)}return null},K=b=>{le.setSkipped(b),y({type:"SET_SKIPPED",value:b})};return e.createElement(P.GuidedTourProvider,{guidedTourState:o,currentStep:s,setCurrentStep:C,setGuidedTourVisibility:I,setSkipped:K,setStepState:w,startSection:Q,isGuidedTourVisible:i,isSkipped:d},u)};ot.propTypes={children:a().element.isRequired};var at=ot,ke=t(12788),ue=t(57269),Ie=t(41502);const we=(0,J.default)(n.Box)`
|
|
4
|
+
position: fixed;
|
|
5
|
+
top: 0;
|
|
6
|
+
right: 0;
|
|
7
|
+
bottom: 0;
|
|
8
|
+
left: 0;
|
|
9
|
+
z-index: 1140;
|
|
10
|
+
&:before {
|
|
11
|
+
content: '';
|
|
12
|
+
position: fixed;
|
|
13
|
+
top: 0;
|
|
14
|
+
right: 0;
|
|
15
|
+
bottom: 0;
|
|
16
|
+
left: 0;
|
|
17
|
+
background: ${({theme:u})=>u.colors.neutral0};
|
|
18
|
+
opacity: 0.9;
|
|
19
|
+
}
|
|
20
|
+
`,rt=(0,J.default)(n.Flex)`
|
|
21
|
+
position: fixed;
|
|
22
|
+
top: 0;
|
|
23
|
+
right: 0;
|
|
24
|
+
bottom: 0;
|
|
25
|
+
left: 0;
|
|
26
|
+
padding-top: ${(0,P.pxToRem)(160)};
|
|
27
|
+
`,Ft=(0,J.default)(n.Box)`
|
|
28
|
+
border-radius: 50%;
|
|
29
|
+
svg {
|
|
30
|
+
> path {
|
|
31
|
+
fill: ${({theme:u})=>u.colors.primary600} !important;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
`,ft=document.createElement("div"),ss="autoReloadOverlayBlocker";ft.setAttribute("id",ss);const ns=J.keyframes`
|
|
35
|
+
from {
|
|
36
|
+
transform: rotate(0deg);
|
|
37
|
+
}
|
|
38
|
+
to {
|
|
39
|
+
transform: rotate(359deg);
|
|
40
|
+
}
|
|
41
|
+
`,os=(0,J.default)(ue.Refresh)`
|
|
42
|
+
animation: ${ns} 1s infinite linear;
|
|
43
|
+
`,Wt=({displayedIcon:u,description:s,title:o,isOpen:i})=>{const{formatMessage:d}=(0,A.useIntl)();return(0,e.useEffect)(()=>(document.body.appendChild(ft),()=>{document.body.removeChild(ft)}),[]),i?ke.createPortal(e.createElement(we,null,e.createElement(rt,{direction:"column",alignItems:"stretch",gap:6},e.createElement(n.Flex,{direction:"column",alignItems:"stretch",gap:2},e.createElement(n.Flex,{justifyContent:"center"},e.createElement(n.Typography,{as:"h1",variant:"alpha"},d(o))),e.createElement(n.Flex,{justifyContent:"center"},e.createElement(n.Typography,{as:"h2",textColor:"neutral600",fontSize:4,fontWeight:"regular"},d(s)))),e.createElement(n.Flex,{justifyContent:"center"},u==="reload"&&e.createElement(Ft,{padding:6,background:"primary100",borderColor:"primary200"},e.createElement(os,{width:(0,P.pxToRem)(36),height:(0,P.pxToRem)(36)})),u==="time"&&e.createElement(Ft,{padding:6,background:"primary100",borderColor:"primary200"},e.createElement(ue.Clock,{width:(0,P.pxToRem)(40),height:(0,P.pxToRem)(40)}))),e.createElement(n.Flex,{justifyContent:"center"},e.createElement(n.Box,{paddingTop:2},e.createElement(Ie.r,{href:"https://docs.strapi.io",isExternal:!0},d({id:"global.documentation",defaultMessage:"Read the documentation"})))))),ft):null};Wt.propTypes={displayedIcon:a().oneOfType([a().string,a().array]).isRequired,description:a().object.isRequired,isOpen:a().bool.isRequired,title:a().object.isRequired};var as=Wt;const Zt=30,Gt=({children:u})=>{const[s,o]=(0,e.useState)(!1),[{elapsed:i},d]=(0,e.useState)({elapsed:0,start:0}),[y,C]=(0,e.useState)(void 0),I=(F=void 0)=>{o(!0),C(F),d(ce=>({...ce,start:Date.now()}))},w=()=>{o(!1),d({start:0,elapsed:0}),C(void 0)},Q=(0,e.useRef)(I),K=(0,e.useRef)(w);(0,e.useEffect)(()=>{let F=null;return s?F=setInterval(()=>i>Zt?(clearInterval(F),null):(d(ce=>({...ce,elapsed:Math.round(Date.now()-ce.start)/1e3})),null),1e3):clearInterval(F),()=>{clearInterval(F)}},[s,i]);let b=y?.icon||"reload",Y={id:y?.description||"components.OverlayBlocker.description",defaultMessage:"You're using a feature that needs the server to restart. Please wait until the server is up."},H={id:y?.title||"components.OverlayBlocker.title",defaultMessage:"Waiting for restart"};i>Zt&&(b="time",Y={id:"components.OverlayBlocker.description.serverError",defaultMessage:"The server should have restarted, please check your logs in the terminal."},H={id:"components.OverlayBlocker.title.serverError",defaultMessage:"The restart is taking longer than expected"});const ee=(0,e.useMemo)(()=>({lockApp:Q.current,unlockApp:K.current}),[Q,K]);return e.createElement(P.AutoReloadOverlayBockerContext.Provider,{value:ee},e.createElement(as,{displayedIcon:b,isOpen:s,description:Y,title:H}),u)};Gt.propTypes={children:a().element.isRequired};var rs=Gt;const bt=({dispatch:u,notification:s})=>{const{formatMessage:o}=(0,A.useIntl)(),{message:i,link:d,type:y,id:C,onClose:I,timeout:w,blockTransition:Q,title:K}=s,b=F=>typeof F=="string"?F:o(F,F.values),Y=(0,e.useCallback)(()=>{I&&I(),u({type:"HIDE_NOTIFICATION",id:C})},[C]);(0,e.useEffect)(()=>{let F;return Q||(F=setTimeout(()=>{Y()},w||2500)),()=>clearTimeout(F)},[Q,Y,w]);let H,ee;return y==="info"?(H="default",ee=o({id:"notification.default.title",defaultMessage:"Information:"})):y==="warning"?(H="danger",ee=o({id:"notification.warning.title",defaultMessage:"Warning:"})):y==="softWarning"?(H="warning",ee=o({id:"notification.warning.title",defaultMessage:"Warning:"})):(H="success",ee=o({id:"notification.success.title",defaultMessage:"Success:"})),K&&(ee=typeof K=="string"?K:b({id:K?.id||K,defaultMessage:K?.defaultMessage||K?.id||K,values:K?.values})),e.createElement(n.Alert,{action:d?e.createElement(Ie.r,{href:d.url,isExternal:!0},o({id:d.label?.id||d.label,defaultMessage:d.label?.defaultMessage||d.label?.id||d.label})):void 0,onClose:Y,closeLabel:"Close",title:ee,variant:H},b({id:i?.id||i,defaultMessage:i?.defaultMessage||i?.id||i,values:i?.values}))};bt.defaultProps={notification:{id:1,type:"success",message:{id:"notification.success.saved",defaultMessage:"Saved"},onClose:()=>null,timeout:2500,blockTransition:!1}},bt.propTypes={dispatch:a().func.isRequired,notification:a().shape({id:a().number,message:a().oneOfType([a().string,a().shape({id:a().string.isRequired,defaultMessage:a().string,values:a().object})]),link:a().shape({target:a().string,url:a().string.isRequired,label:a().oneOfType([a().string,a().shape({id:a().string.isRequired,defaultMessage:a().string,values:a().object})]).isRequired}),type:a().string,onClose:a().func,timeout:a().number,blockTransition:a().bool,title:a().oneOfType([a().string,a().shape({id:a().string.isRequired,defaultMessage:a().string,values:a().object})])})};var is=bt;const Kt={notifId:0,notifications:[]};var ls=(u=Kt,s)=>(0,fe.default)(u,o=>{switch(s.type){case"SHOW_NOTIFICATION":{o.notifications.push({id:u.notifId,type:me()(s,["config","type"],"success"),message:me()(s,["config","message"],{id:"notification.success.saved",defaultMessage:"Saved"}),link:me()(s,["config","link"],null),timeout:me()(s,["config","timeout"],2500),blockTransition:me()(s,["config","blockTransition"],!1),onClose:me()(s,["config","onClose"],null),title:me()(s,["config","title"],null)}),o.notifId=u.notifId+1;break}case"HIDE_NOTIFICATION":{const i=u.notifications.findIndex(d=>d.id===s.id);i!==-1&&o.notifications.splice(i,1);break}default:return o}});const Ht=({children:u})=>{const[{notifications:s},o]=(0,e.useReducer)(ls,Kt),i=d=>{o({type:"SHOW_NOTIFICATION",config:d})};return e.createElement(P.NotificationsProvider,{toggleNotification:i},e.createElement(n.Flex,{left:"50%",marginLeft:"-250px",position:"fixed",direction:"column",alignItems:"stretch",gap:2,top:`${46/16}rem`,width:`${500/16}rem`,zIndex:10},s.map(d=>e.createElement(is,{key:d.id,dispatch:o,notification:d}))),u)};Ht.propTypes={children:a().element.isRequired};var us=Ht;const ht=document.createElement("div");ht.setAttribute("id","overlayBlocker");const cs=J.default.div`
|
|
44
|
+
position: fixed;
|
|
45
|
+
top: 0;
|
|
46
|
+
right: 0;
|
|
47
|
+
bottom: 0;
|
|
48
|
+
left: 0;
|
|
49
|
+
z-index: 1140;
|
|
50
|
+
`,$t=({isOpen:u})=>((0,e.useEffect)(()=>(document.body.appendChild(ht),()=>{document.body.removeChild(ht)}),[]),u?ke.createPortal(e.createElement(cs,null),ht):null);$t.propTypes={isOpen:a().bool.isRequired};const zt=({children:u})=>{const[s,o]=(0,e.useState)(!1),i=()=>{o(!0)},d=()=>{o(!1)};return e.createElement(P.OverlayBlockerContext.Provider,{value:{lockApp:i,unlockApp:d}},u,e.createElement($t,{isOpen:s}))};zt.propTypes={children:a().node.isRequired};var ds=zt;const kt="STRAPI_THEME",ms=()=>{const u=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",s=localStorage.getItem(kt);return s||localStorage.setItem(kt,u),s||u},Vt=({children:u,themes:s})=>{const[o,i]=(0,e.useState)(ms()),d=(0,e.useCallback)(C=>{i(C),localStorage.setItem(kt,C)},[i]),y=(0,e.useMemo)(()=>({currentTheme:o,onChangeTheme:d,themes:s}),[o,d,s]);return e.createElement(dt.Rj.Provider,{value:y},u)};Vt.propTypes={children:a().node.isRequired,themes:a().shape({light:a().shape({colors:a().object.isRequired,shadows:a().object.isRequired,sizes:a().object.isRequired,zIndices:a().array.isRequired,spaces:a().array.isRequired,borderRadius:a().string.isRequired,mediaQueries:a().object.isRequired,fontSizes:a().array.isRequired,lineHeights:a().array.isRequired,fontWeights:a().object.isRequired}).isRequired,dark:a().shape({colors:a().object.isRequired,shadows:a().object.isRequired,sizes:a().object.isRequired,zIndices:a().array.isRequired,spaces:a().array.isRequired,borderRadius:a().string.isRequired,mediaQueries:a().object.isRequired,fontSizes:a().array.isRequired,lineHeights:a().array.isRequired,fontWeights:a().object.isRequired}).isRequired,custom:a().object}).isRequired};var ps=Vt,gs=J.createGlobalStyle`
|
|
51
|
+
body {
|
|
52
|
+
background: ${({theme:u})=>u.colors.neutral100};
|
|
53
|
+
}
|
|
54
|
+
`;const Qt=({children:u})=>{const{currentTheme:s,themes:o}=(0,tt.M1)();return e.createElement(n.ThemeProvider,{theme:o[s]||o.light},u,e.createElement(gs,null))};Qt.propTypes={children:a().element.isRequired};var fs=Qt;const hs=new st.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1}}}),Yt=({authLogo:u,children:s,components:o,customFields:i,fields:d,getAdminInjectedComponents:y,getPlugin:C,localeNames:I,menu:w,menuLogo:Q,messages:K,plugins:b,runHookParallel:Y,runHookSeries:H,runHookWaterfall:ee,settings:F,showReleaseNotification:ce,showTutorials:Ce,store:it,themes:lt})=>e.createElement(ps,{themes:lt},e.createElement(fs,null,e.createElement(st.QueryClientProvider,{client:hs},e.createElement(At.Provider,{store:it},e.createElement(dt.ux.Provider,{value:{getAdminInjectedComponents:y}},e.createElement(St,{authLogo:u,menuLogo:Q,showReleaseNotification:ce,showTutorials:Ce},e.createElement(P.StrapiAppProvider,{getPlugin:C,menu:w,plugins:b,runHookParallel:Y,runHookWaterfall:ee,runHookSeries:H,settings:F},e.createElement(P.LibraryProvider,{components:o,fields:d},e.createElement(P.CustomFieldsProvider,{customFields:i},e.createElement(G,{messages:K,localeNames:I},e.createElement(rs,null,e.createElement(ds,null,e.createElement(at,null,e.createElement(us,null,s))))))))))))));Yt.propTypes={authLogo:a().oneOfType([a().string,a().any]).isRequired,children:a().element.isRequired,components:a().object.isRequired,customFields:a().object.isRequired,fields:a().object.isRequired,getAdminInjectedComponents:a().func.isRequired,getPlugin:a().func.isRequired,localeNames:a().objectOf(a().string).isRequired,menu:a().arrayOf(a().shape({to:a().string.isRequired,icon:a().func.isRequired,intlLabel:a().shape({id:a().string.isRequired,defaultMessage:a().string.isRequired}).isRequired,permissions:a().array,Component:a().func})).isRequired,menuLogo:a().oneOfType([a().string,a().any]).isRequired,messages:a().object.isRequired,plugins:a().object.isRequired,runHookParallel:a().func.isRequired,runHookWaterfall:a().func.isRequired,runHookSeries:a().func.isRequired,settings:a().object.isRequired,showReleaseNotification:a().bool.isRequired,showTutorials:a().bool.isRequired,store:a().object.isRequired,themes:a().shape({light:a().shape({colors:a().object.isRequired,shadows:a().object.isRequired,sizes:a().object.isRequired,zIndices:a().array.isRequired,spaces:a().array.isRequired,borderRadius:a().string.isRequired,mediaQueries:a().object.isRequired,fontSizes:a().array.isRequired,lineHeights:a().array.isRequired,fontWeights:a().object.isRequired}).isRequired,dark:a().shape({colors:a().object.isRequired,shadows:a().object.isRequired,sizes:a().object.isRequired,zIndices:a().array.isRequired,spaces:a().array.isRequired,borderRadius:a().string.isRequired,mediaQueries:a().object.isRequired,fontSizes:a().array.isRequired,lineHeights:a().array.isRequired,fontWeights:a().object.isRequired}).isRequired,custom:a().object}).isRequired};var Es=Yt,ys={ar:"\u0627\u0644\u0639\u0631\u0628\u064A\u0629",ca:"Catal\xE0",cs:"\u010Ce\u0161tina",de:"Deutsch",dk:"Dansk",en:"English",es:"Espa\xF1ol",eu:"Euskara",fr:"Fran\xE7ais",gu:"Gujarati",he:"\u05E2\u05D1\u05E8\u05D9\u05EA",hu:"Magyar",id:"Indonesian",it:"Italiano",ja:"\u65E5\u672C\u8A9E",ko:"\uD55C\uAD6D\uC5B4",ml:"Malayalam",ms:"Melayu",nl:"Nederlands",no:"Norwegian",pl:"Polski","pt-BR":"Portugu\xEAs (Brasil)",pt:"Portugu\xEAs (Portugal)",ru:"\u0420\u0443\u0441\u0441\u043A\u0438\u0439",sk:"Sloven\u010Dina",sv:"Swedish",th:"\u0E44\u0E17\u0E22",tr:"T\xFCrk\xE7e",uk:"\u0423\u043A\u0440\u0430\u0457\u043D\u0441\u044C\u043A\u0430",vi:"Ti\u1EBFng Vi\u1EC7t","zh-Hans":"\u4E2D\u6587 (\u7B80\u4F53)",zh:"\u4E2D\u6587 (\u7E41\u9AD4)",sa:"\u0938\u0902\u0938\u094D\u0915\u0943\u0924",hi:"\u0939\u093F\u0928\u094D\u0926\u0940"},Et=t(70836),vs={admin:{tutorials:{links:[]}},contentManager:{editView:{informations:[],"right-links":[]},listView:{actions:[],deleteModalAdditionalInfos:[]}}},Ts="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAAAXVBMVEUAAABIRP9IRP9IRP9IRP9IRP9IRP9IRP9IRP9IRP9IRP9IRP9IRP9IRP9IRP9JRf9IRf9IRP5IRP5JRP9JRf////+Vk/+zsv++vf9mY/9taf9/fP+Jh//c3P9RTf/Ibar2AAAAFHRSTlMA/MJX+fPt48cahaff1dMaGqcahSpTPmAAAAEvSURBVFjD7dfNTsMwEATgXcf5cdKEtixtcYH3f0xEibIguba1g8Slc+58iqUedmhNaMbJzX3Xema5G2bfdv3iprE50s80g7Yqw0Oz1Z+cmOL2a38nxuy+BSfmuNv7BUhDRAMCDESBEYCDvsD6hmcMGGnCgIkcBjhaMGCmHgN66jCgoxYDWvIY4IkxgHFAkrmeU7kmfpkG4uUllXMtEE82QPs2QPs2QPs2QPs2QPsAoH0DoH0LoH0QeN3ydtnyXg38ok76MQ/gAfwf8JH8V18LQOljomBAFAyIkga4CGT7XAtEuQf4IpDri6e2BoiZA6OrAGLuxOnLQMweWXMRyPVlwQ/NAwZMNGLACJ/76ODYo5MHHl3o7EOHZ6BbjtbpG/5kfOv8P7ilbv7PX/M/rMVPqrI3XI3nd3sAAAAASUVORK5CYII=";class Ps{constructor({adminConfig:s,appPlugins:o,library:i,middlewares:d,reducers:y}){this.customConfigurations=s.config,this.customBootstrapConfiguration=s.bootstrap,this.configurations={authLogo:ct,head:{favicon:Ts},locales:["en"],menuLogo:ct,notifications:{releases:!0},themes:{light:n.lightTheme,dark:n.darkTheme},translations:{},tutorials:!0},this.appPlugins=o||{},this.library=i,this.middlewares=d,this.plugins={},this.reducers=y,this.translations={},this.hooksDict={},this.admin={injectionZones:vs},this.customFields=ae.rh,this.menu=[],this.settings={global:{id:"global",intlLabel:{id:"Settings.global",defaultMessage:"Global Settings"},links:[]}}}addComponents=s=>{Array.isArray(s)?s.map(o=>this.library.components.add(o)):this.library.components.add(s)};addCorePluginMenuLink=s=>{const o=JSON.stringify(s);v()(s.to,`link.to should be defined for ${o}`),v()(typeof s.to=="string",`Expected link.to to be a string instead received ${typeof s.to}`),v()(["/plugins/content-type-builder","/plugins/upload"].includes(s.to),"This method is not available for your plugin"),v()(s.intlLabel?.id&&s.intlLabel?.defaultMessage,`link.intlLabel.id & link.intlLabel.defaultMessage for ${o}`),this.menu.push(s)};addFields=s=>{Array.isArray(s)?s.map(o=>this.library.fields.add(o)):this.library.fields.add(s)};addMenuLink=s=>{const o=JSON.stringify(s);v()(s.to,`link.to should be defined for ${o}`),v()(typeof s.to=="string",`Expected link.to to be a string instead received ${typeof s.to}`),v()(s.intlLabel?.id&&s.intlLabel?.defaultMessage,`link.intlLabel.id & link.intlLabel.defaultMessage for ${o}`),v()(s.Component&&typeof s.Component=="function","link.Component should be a valid React Component"),v()(s.icon&&typeof s.icon=="function","link.Icon should be a valid React Component"),this.menu.push(s)};addMiddlewares=s=>{s.forEach(o=>{this.middlewares.add(o)})};addReducers=s=>{Object.keys(s).forEach(o=>{this.reducers.add(o,s[o])})};addSettingsLink=(s,o)=>{v()(this.settings[s],"The section does not exist");const i=JSON.stringify(o);v()(o.id,`link.id should be defined for ${i}`),v()(o.intlLabel?.id&&o.intlLabel?.defaultMessage,`link.intlLabel.id & link.intlLabel.defaultMessage for ${i}`),v()(o.to,`link.to should be defined for ${i}`),v()(o.Component&&typeof o.Component=="function","link.Component should be a valid React Component"),this.settings[s].links.push(o)};addSettingsLinks=(s,o)=>{v()(this.settings[s],"The section does not exist"),v()(Array.isArray(o),"TypeError expected links to be an array"),o.forEach(i=>{this.addSettingsLink(s,i)})};async bootstrap(){Object.keys(this.appPlugins).forEach(s=>{const o=this.appPlugins[s].bootstrap;o&&o({addSettingsLink:this.addSettingsLink,addSettingsLinks:this.addSettingsLinks,getPlugin:this.getPlugin,injectContentManagerComponent:this.injectContentManagerComponent,injectAdminComponent:this.injectAdminComponent,registerHook:this.registerHook})}),R()(this.customBootstrapConfiguration)&&this.customBootstrapConfiguration({addComponents:this.addComponents,addFields:this.addFields,addMenuLink:this.addMenuLink,addReducers:this.addReducers,addSettingsLink:this.addSettingsLink,addSettingsLinks:this.addSettingsLinks,getPlugin:this.getPlugin,injectContentManagerComponent:this.injectContentManagerComponent,injectAdminComponent:this.injectAdminComponent,registerHook:this.registerHook})}bootstrapAdmin=async()=>(await this.createCustomConfigurations(),this.createHook(Et.No),this.createHook(Et.LK),this.createHook(Et.dV),this.createHook(Et.Eo),Promise.resolve());createCustomConfigurations=async()=>{if(this.customConfigurations?.locales&&(this.configurations.locales=["en",...this.customConfigurations.locales?.filter(s=>s!=="en")||[]]),this.customConfigurations?.auth?.logo&&(this.configurations.authLogo=this.customConfigurations.auth.logo),this.customConfigurations?.menu?.logo&&(this.configurations.menuLogo=this.customConfigurations.menu.logo),this.customConfigurations?.head?.favicon&&(this.configurations.head.favicon=this.customConfigurations.head.favicon),this.customConfigurations?.theme){const s=this.customConfigurations.theme.dark,o=this.customConfigurations.theme.light;!s&&!o&&(console.warn("[deprecated] In future versions, Strapi will stop supporting this theme customization syntax. The theme configuration accepts a light and a dark key to customize each theme separately. See https://docs.strapi.io/developer-docs/latest/development/admin-customization.html#theme-extension."),m()(this.configurations.themes.light,this.customConfigurations.theme)),o&&m()(this.configurations.themes.light,o),s&&m()(this.configurations.themes.dark,s)}this.customConfigurations?.notifications?.releases!==void 0&&(this.configurations.notifications.releases=this.customConfigurations.notifications.releases),this.customConfigurations?.tutorials!==void 0&&(this.configurations.tutorials=this.customConfigurations.tutorials)};createHook=s=>{this.hooksDict[s]=Z()};createSettingSection=(s,o)=>{v()(s.id,"section.id should be defined"),v()(s.intlLabel?.id&&s.intlLabel?.defaultMessage,"section.intlLabel should be defined"),v()(Array.isArray(o),"TypeError expected links to be an array"),v()(this.settings[s.id]===void 0,"A similar section already exists"),this.settings[s.id]={...s,links:[]},o.forEach(i=>{this.addSettingsLink(s.id,i)})};createStore=()=>z(this.middlewares.middlewares,this.reducers.reducers);getAdminInjectedComponents=(s,o,i)=>{try{return this.admin.injectionZones[s][o][i]||[]}catch(d){return console.error("Cannot get injected component",d),d}};getPlugin=s=>this.plugins[s];async initialize(){Object.keys(this.appPlugins).forEach(s=>{this.appPlugins[s].register(this)})}injectContentManagerComponent=(s,o,i)=>{v()(this.admin.injectionZones.contentManager[s]?.[o],`The ${s} ${o} zone is not defined in the content manager`),v()(i,"A Component must be provided"),this.admin.injectionZones.contentManager[s][o].push(i)};injectAdminComponent=(s,o,i)=>{v()(this.admin.injectionZones.admin[s]?.[o],`The ${s} ${o} zone is not defined in the admin`),v()(i,"A Component must be provided"),this.admin.injectionZones.admin[s][o].push(i)};async loadAdminTrads(){const s=this.configurations.locales.map(d=>t(48224)(`./${d}.json`).then(({default:y})=>({data:y,locale:d})).catch(()=>({data:null,locale:d})));return(await Promise.all(s)).reduce((d,y)=>(y.data&&(d[y.locale]=y.data),d),{})}async loadTrads(){const s=await this.loadAdminTrads(),o=Object.keys(this.appPlugins).map(C=>{const I=this.appPlugins[C].registerTrads;return I?I({locales:this.configurations.locales}):null}).filter(C=>C),d=(await Promise.all(o)).reduce((C,I)=>{const w=I.reduce((Q,K)=>(Q[K.locale]=K.data,Q),{});return Object.keys(w).forEach(Q=>{C[Q]={...C[Q],...w[Q]}}),C},{}),y=this.configurations.locales.reduce((C,I)=>(C[I]={...s[I],...d[I]||{},...this.customConfigurations?.translations?.[I]},C),{});return this.configurations.translations=y,Promise.resolve()}registerHook=(s,o)=>{v()(this.hooksDict[s],`The hook ${s} is not defined. You are trying to register a hook that does not exist in the application.`),this.hooksDict[s].register(o)};registerPlugin=s=>{const o=(0,ae.Sy)(s);this.plugins[o.pluginId]=o};runHookSeries=(s,o=!1)=>o?this.hooksDict[s].runSeriesAsync():this.hooksDict[s].runSeries();runHookWaterfall=(s,o,i=!1,d)=>i?this.hooksDict[s].runWaterfallAsync(o,d):this.hooksDict[s].runWaterfall(o,d);runHookParallel=s=>this.hooksDict[s].runParallel();render(){const s=this.createStore(),o=c()(ys,this.configurations.locales||[]),{components:{components:i},fields:{fields:d}}=this.library;return e.createElement(Es,{authLogo:this.configurations.authLogo,components:i,fields:d,customFields:this.customFields,localeNames:o,getAdminInjectedComponents:this.getAdminInjectedComponents,getPlugin:this.getPlugin,messages:this.configurations.translations,menu:this.menu,menuLogo:this.configurations.menuLogo,plugins:this.plugins,runHookParallel:this.runHookParallel,runHookWaterfall:(y,C,I=!1)=>this.runHookWaterfall(y,C,I,s),runHookSeries:this.runHookSeries,themes:this.configurations.themes,settings:this.settings,showTutorials:this.configurations.tutorials,showReleaseNotification:this.configurations.notifications.releases,store:s},e.createElement(e.Fragment,null,e.createElement(x.Helmet,{link:[{rel:"icon",type:"image/png",href:this.configurations.head.favicon}],htmlAttributes:{lang:localStorage.getItem(nt)||"en"}}),e.createElement(r.BrowserRouter,{basename:T.Z},e.createElement(Ct,{store:s}))))}}var Rs=({adminConfig:u={},appPlugins:s,library:o,middlewares:i,reducers:d})=>new Ps({adminConfig:u,appPlugins:s,library:o,middlewares:i,reducers:d})},5985:function(O,E,t){"use strict";var e=t(32735);const r=(0,e.createContext)();E.Z=r},20139:function(O,E,t){"use strict";var e=t(32735),r=t(5985);const n=()=>{const{changeLocale:f,localeNames:m,messages:g}=(0,e.useContext)(r.Z);return{changeLocale:f,localeNames:m,messages:g}};E.Z=n},10190:function(O,E,t){"use strict";var e=t(32735),r=t(83292),n=t(8888);const f=r.default.img`
|
|
55
|
+
height: ${72/16}rem;
|
|
56
|
+
`,m=()=>{const{logos:{auth:g}}=(0,n.um)();return e.createElement(f,{src:g?.custom??g.default,"aria-hidden":!0,alt:""})};E.Z=m},66694:function(O,E,t){"use strict";t.d(E,{ux:function(){return n},_5:function(){return m},$l:function(){return c},Rj:function(){return R}});var e=t(32735),n=(0,e.createContext)({}),m=(0,e.createContext)({}),c=(0,e.createContext)({}),R=(0,e.createContext)({})},463:function(O,E){"use strict";const t="/admin/".replace(window.location.origin,"");E.Z=t},70836:function(O,E,t){"use strict";t.d(E,{Eo:function(){return n},LK:function(){return r},No:function(){return e},dV:function(){return f}});const e="Admin/CM/pages/ListView/inject-column-in-table",r="Admin/CM/pages/App/mutate-collection-types-links",n="Admin/CM/pages/EditView/mutate-edit-view-layout",f="Admin/CM/pages/App/mutate-single-types-links"},8888:function(O,E,t){"use strict";t.d(E,{um:function(){return f},U_:function(){return L},Dq:function(){return P},H9:function(){return Ke},bP:function(){return v},$_:function(){return St},rW:function(){return nt},bF:function(){return Me},G4:function(){return Lt},Te:function(){return Pt},M1:function(){return Ot}});var e=t(32735),r=t(66694),f=()=>(0,e.useContext)(r._5),m=t(13478),g=t(97889);const c={collectionTypes:[],components:[],isLoading:!0,singleTypes:[]};var R=(h,p)=>(0,g.default)(h,l=>{switch(p.type){case"GET_MODELS":{l.collectionTypes=c.collectionTypes,l.singleTypes=c.singleTypes,l.components=c.components,l.isLoading=!0;break}case"GET_MODELS_ERROR":{l.collectionTypes=c.collectionTypes,l.singleTypes=c.singleTypes,l.components=c.components,l.isLoading=!1;break}case"GET_MODELS_SUCCEDED":{const S=k=>p.contentTypes.filter(N=>N.isDisplayed&&N.kind===k);l.isLoading=!1,l.collectionTypes=S("collectionType"),l.singleTypes=S("singleType"),l.components=p.components;break}default:return l}}),v=()=>{const h=(0,m.useNotification)(),[p,l]=(0,e.useReducer)(R,c);(0,e.useEffect)(()=>{S()},[]);const S=async()=>{l({type:"GET_MODELS"});try{const[{data:k},{data:N}]=await Promise.all(["components","content-types"].map(G=>(0,m.request)(`/content-manager/${G}`,{method:"GET"})));l({type:"GET_MODELS_SUCCEDED",contentTypes:N,components:k})}catch{l({type:"GET_MODELS_ERROR"}),h({type:"warning",message:{id:"notification.error"}})}};return{...p,getData:S}};const x={data:{},error:null,isLoading:!0};var D=(h,p)=>(0,g.default)(h,l=>{switch(p.type){case"GET_DATA":{l.isLoading=!0,l.data={},l.error=null;break}case"GET_DATA_SUCCEEDED":{l.data=p.data,l.isLoading=!1,l.error=null;break}case"GET_DATA_ERROR":{l.isLoading=!1,l.error=p.error;break}default:return l}}),L=h=>{const[{data:p,error:l,isLoading:S},k]=(0,e.useReducer)(D,x);return(0,e.useEffect)(()=>{(async()=>{k({type:"GET_DATA"});const{data:G}=await(0,m.request)("/admin/permissions",{method:"GET",params:{role:h}});k({type:"GET_DATA_SUCCEEDED",data:G})})()},[h]),{data:p,error:l,isLoading:S}};const U={role:{},permissions:{},isLoading:!0};var z=(h,p)=>(0,g.default)(h,l=>{switch(p.type){case"GET_DATA_SUCCEEDED":{l.role=p.role,l.permissions=p.permissions,l.isLoading=!1;break}case"GET_DATA_ERROR":{l.isLoading=!1;break}case"ON_SUBMIT_SUCCEEDED":{l.role.name=p.name,l.role.description=p.description;break}default:return l}}),P=h=>{const p=(0,m.useNotification)(),[l,S]=(0,e.useReducer)(z,U);(0,e.useEffect)(()=>{h?k(h):S({type:"GET_DATA_SUCCEEDED",role:{},permissions:[]})},[h]);const k=async G=>{try{const[{data:X},{data:oe}]=await Promise.all([`roles/${G}`,`roles/${G}/permissions`].map(be=>(0,m.request)(`/admin/${be}`,{method:"GET"})));S({type:"GET_DATA_SUCCEEDED",role:X,permissions:oe})}catch(X){console.error(X),S({type:"GET_DATA_ERROR"}),p({type:"warning",message:{id:"notification.error"}})}},N=(0,e.useCallback)(G=>{S({type:"ON_SUBMIT_SUCCEEDED",...G})},[]);return{...l,onSubmitSucceeded:N}},A=(h,p)=>p.map(({permissions:l})=>(0,m.hasPermissions)(h,l)),a=async(h,p)=>{const l=A(h,p),S=await Promise.all(l);return p.filter((N,G)=>S[G])},ie=t(99381),Le=t.n(ie),Ge=async(h,p,l)=>{const S=A(h,p),k=await Promise.all(S),N=p.filter((oe,be)=>k[be]),G=N.findIndex(oe=>oe.to==="/settings");if(G===-1)return[];const X=Le()(N);return X[G].notificationsCount=l?1:0,X},_e=t(57269),ve=t(72041);const Ne={generalSectionLinks:[{icon:_e.Puzzle,intlLabel:{id:"global.plugins",defaultMessage:"Plugins"},to:"/list-plugins",permissions:ve.Z.marketplace.main},{icon:_e.ShoppingCart,intlLabel:{id:"global.marketplace",defaultMessage:"Marketplace"},to:"/marketplace",permissions:ve.Z.marketplace.main},{icon:_e.Cog,intlLabel:{id:"global.settings",defaultMessage:"Settings"},to:"/settings",permissions:[],notificationsCount:0}],pluginsSectionLinks:[],isLoading:!0};var Xe=(h=Ne,p)=>(0,g.default)(h,l=>{switch(p.type){case"SET_SECTION_LINKS":{const{authorizedGeneralSectionLinks:S,authorizedPluginSectionLinks:k}=p.data;l.generalSectionLinks=S,l.pluginsSectionLinks=k;break}case"UNSET_IS_LOADING":{l.isLoading=!1;break}default:return l}}),Ke=()=>{const[h,p]=(0,e.useReducer)(Xe,Ne),{allPermissions:l}=(0,m.useRBACProvider)(),{shouldUpdateStrapi:S}=(0,m.useAppInfos)(),{menu:k}=(0,m.useStrapiApp)(),N=(0,e.useRef)(h.generalSectionLinks),G=(0,e.useRef)(S),X=async(be=l)=>{const De=await a(be,k),We=await Ge(be,N.current,G.current);p({type:"SET_SECTION_LINKS",data:{authorizedGeneralSectionLinks:We,authorizedPluginSectionLinks:De}}),p({type:"UNSET_IS_LOADING"})},oe=(0,e.useRef)(X);return(0,e.useEffect)(()=>{oe.current(l)},[l,p]),h},_=t(33795),Te=t.n(_),Pe=(h,p)=>({...h,isLoading:p});const Ee={roles:[],isLoading:!0};var re=(h,p)=>(0,g.default)(h,l=>{switch(p.type){case"GET_DATA":{l.isLoading=!0,l.roles=[];break}case"GET_DATA_SUCCEEDED":{l.roles=p.data,l.isLoading=!1;break}case"GET_DATA_ERROR":{l.isLoading=!1;break}default:return l}}),Me=(h=!0)=>{const p=(0,m.useNotification)(),[{roles:l,isLoading:S},k]=(0,e.useReducer)(re,Ee,()=>Pe(Ee,h));(0,e.useEffect)(()=>{h&&N()},[h]);const N=(0,e.useCallback)(async()=>{const G=(0,m.getFetchClient)();try{k({type:"GET_DATA"});const{data:{data:X}}=await G.get("/admin/roles");k({type:"GET_DATA_SUCCEEDED",data:X})}catch(X){const oe=Te()(X,["response","payload","message"],"An error occured");k({type:"GET_DATA_ERROR"}),oe!=="Forbidden"&&p({type:"warning",message:oe})}},[p]);return{roles:l,isLoading:S,getData:N}},Oe=t(3040),fe=t.n(Oe);const Re={menu:[],isLoading:!0};var Fe=(h,p)=>(0,g.default)(h,l=>{switch(p.type){case"CHECK_PERMISSIONS_SUCCEEDED":{p.data.forEach(S=>{S.hasPermission&&fe()(l,["menu",...S.path.split("."),"isDisplayed"],S.hasPermission)}),l.menu.forEach((S,k)=>{l.menu[k].links=S.links.filter(N=>N.isDisplayed===!0)}),l.isLoading=!1;break}default:return l}}),et=t(9086),$e=t.n(et),V=t(98978),ut=t.n(V),J=h=>ut()(h,p=>p.id),pe=h=>h.map(p=>{const l=p.links.map(S=>({...S,isDisplayed:!1}));return{...p,links:l}}),ze=[{intlLabel:{id:"global.roles",defaultMessage:"Roles"},to:"/settings/roles",id:"roles",isDisplayed:!1,permissions:ve.Z.settings.roles.main},{intlLabel:{id:"global.users"},to:"/settings/users?pageSize=10&page=1&sort=firstname",id:"users",isDisplayed:!1,permissions:ve.Z.settings.users.main}],jt=[...(()=>window&&window.strapi&&window.strapi.isEE?t(66334).Z:t(47950).Z)(),...ze],yt=[{intlLabel:{id:"Settings.application.title",defaultMessage:"Overview"},to:"/settings/application-infos",id:"000-application-infos",isDisplayed:!1,permissions:[]},{intlLabel:{id:"Settings.webhooks.title",defaultMessage:"Webhooks"},to:"/settings/webhooks",id:"webhooks",isDisplayed:!1,permissions:ve.Z.settings.webhooks.main},{intlLabel:{id:"Settings.apiTokens.title",defaultMessage:"API Tokens"},to:"/settings/api-tokens?sort=name:ASC",id:"api-tokens",isDisplayed:!1,permissions:ve.Z.settings["api-tokens"].main},{intlLabel:{id:"Settings.transferTokens.title",defaultMessage:"Transfer Tokens"},to:"/settings/transfer-tokens?sort=name:ASC",id:"transfer-tokens",isDisplayed:!1,permissions:ve.Z.settings["transfer-tokens"].main}];const Bt=(()=>window&&window.strapi&&window.strapi.isEE?t(11545).Z:t(73086).Z)();var vt=[...yt,...Bt],Tt=(h,{settings:p,shouldUpdateStrapi:l})=>{const S=p.global.links,k=J([...S,...vt]).map(X=>({...X,hasNotification:X.id==="000-application-infos"&&l})),N=Object.values($e()(p,"global")),G=[{...p.global,links:k},{id:"permissions",intlLabel:{id:"Settings.permissions",defaultMessage:"Administration Panel"},links:jt},...N];return{...h,menu:pe(G)}},Pt=(h=!1)=>{const{allPermissions:p}=(0,m.useRBACProvider)(),{shouldUpdateStrapi:l}=(0,m.useAppInfos)(),{settings:S}=(0,m.useStrapiApp)(),[{isLoading:k,menu:N},G]=(0,e.useReducer)(Fe,Re,()=>Tt(Re,{settings:S,shouldUpdateStrapi:l}));return(0,e.useEffect)(()=>{h||(async()=>{const oe=async(We,Ve)=>({hasPermission:await(0,m.hasPermissions)(p,We),path:Ve}),he=(We=>We.reduce((Ve,pt,gt)=>{const ot=at=>at.map((ke,ue)=>oe(at[ue].permissions,`${gt}.links.${ue}`));return[...Ve,...ot(pt.links)]},[]))(N),De=await Promise.all(he);G({type:"CHECK_PERMISSIONS_SUCCEEDED",data:De})})()},[p,h]),{isLoading:k,menu:N}},tt=t(8997),Rt=t(88423),Ye=t.n(Rt),Ct=t(56236),ct=t.n(Ct);const st={fieldsToPick:[],formErrors:{},initialData:{},isLoading:!0,modifiedData:{},showHeaderButtonLoader:!1,showHeaderLoader:!0},At=(h,p)=>(0,g.default)(h,l=>{switch(p.type){case"GET_DATA_SUCCEEDED":{l.isLoading=!1,l.showHeaderLoader=!1,l.initialData=Ye()(p.data,h.fieldsToPick),l.modifiedData=Ye()(p.data,h.fieldsToPick);break}case"ON_CANCEL":{l.modifiedData=h.initialData,l.formErrors={};break}case"ON_CHANGE":{p.inputType==="password"&&!p.value?ct()(l.modifiedData,p.keys.split(".")):p.keys.includes("username")&&!p.value?fe()(l.modifiedData,p.keys.split("."),null):fe()(l.modifiedData,p.keys.split("."),p.value);break}case"ON_SUBMIT":{l.showHeaderButtonLoader=!0;break}case"ON_SUBMIT_SUCCEEDED":{l.initialData=Ye()(p.data,h.fieldsToPick),l.modifiedData=Ye()(p.data,h.fieldsToPick),l.showHeaderButtonLoader=!1;break}case"SET_ERRORS":{l.formErrors=p.errors,l.showHeaderButtonLoader=!1;break}default:return l}});var mt=(h,p)=>({...h,fieldsToPick:p}),Lt=(h,p,l,S)=>{const[{formErrors:k,initialData:N,isLoading:G,modifiedData:X,showHeaderButtonLoader:oe,showHeaderLoader:be},he]=(0,e.useReducer)(At,st,()=>mt(st,S)),De=(0,m.useNotification)(),{lockApp:We,unlockApp:Ve}=(0,m.useOverlayBlocker)();return(0,e.useEffect)(()=>{h&&(async()=>{try{const{data:ue}=await(0,m.request)(h,{method:"GET"});he({type:"GET_DATA_SUCCEEDED",data:ue,fieldsToPick:S})}catch(ue){console.error(ue.response),De({type:"warning",message:{id:"notification.error"}})}})()},[h]),[{formErrors:k,initialData:N,isLoading:G,modifiedData:X,showHeaderButtonLoader:oe,showHeaderLoader:be},he,{handleCancel:()=>{he({type:"ON_CANCEL"})},handleChange:({target:{name:ke,value:ue,type:Ie}})=>{he({type:"ON_CHANGE",inputType:Ie,keys:ke,value:ue})},handleSubmit:async ke=>{ke.preventDefault();const ue=await(0,tt.R6)(X,p);if(he({type:"SET_ERRORS",errors:ue||{}}),!ue)try{We(),he({type:"ON_SUBMIT"});const Ie=$e()(X,["confirmPassword","registrationToken"]);Ie.roles&&(Ie.roles=Ie.roles.map(rt=>rt.id));const{data:we}=await(0,m.request)(h,{method:"PUT",body:Ie});l(we),he({type:"ON_SUBMIT_SUCCEEDED",data:we}),De({type:"success",message:{id:"notification.success.saved"}})}catch(Ie){const we=Ie?.response?.payload??{data:{}};we?.data&&typeof we.data=="string"?De({type:"warning",message:we.data}):De({type:"warning",message:we.message});const rt=(0,tt.Iz)(we);he({type:"SET_ERRORS",errors:rt})}finally{Ve()}},setField:(ke,ue)=>{he({type:"ON_CHANGE",keys:ke,value:ue})}}]},St=()=>(0,e.useContext)(r.$l);const Dt=!JSON.parse(localStorage.getItem("STRAPI_UPDATE_NOTIF")),_t=()=>{const{latestStrapiReleaseTag:h,shouldUpdateStrapi:p}=useAppInfos(),l=useNotification();return useEffect(()=>{p&&Dt&&l({type:"info",message:{id:"notification.version.update.message"},link:{url:`https://github.com/strapi/strapi/releases/tag/${h}`,label:{id:"global.see-more"}},blockTransition:!0,onClose:()=>localStorage.setItem("STRAPI_UPDATE_NOTIF",!0)})},[h,p,l]),null};var Nt=null,Ot=()=>(0,e.useContext)(r.Rj),nt=(h,p,l)=>{const[S,k]=(0,e.useState)(!1),N=(0,m.useNotification)(),{post:G}=(0,m.useFetchClient)();return{regenerateData:async()=>{try{const{data:{data:{accessKey:oe}}}=await G(`${h}${p}/regenerate`);k(!1),l(oe)}catch(oe){k(!1),N({type:"warning",message:Te()(oe,"response.data.message","notification.error")})}},isLoadingConfirmation:S}}},47950:function(O,E){"use strict";E.Z=[]},73086:function(O,E){"use strict";E.Z=[]},954:function(O,E,t){"use strict";t.d(E,{sg:function(){return v},bU:function(){return x},ZP:function(){return D}});var e=t(32735),r=t(83292),n=t(60216),f=t.n(n),m=t(39161),g=t(5636),c=t(20139),R=()=>{const{changeLocale:Z,localeNames:L}=(0,c.Z)(),{locale:U}=(0,g.useIntl)();return e.createElement(m.SimpleMenu,{label:L[U]},Object.keys(L).map($=>e.createElement(m.MenuItem,{onClick:()=>Z($),key:$},L[$])))};const j=(0,r.default)(m.Box)`
|
|
57
|
+
margin: 0 auto;
|
|
58
|
+
width: 552px;
|
|
59
|
+
`,v=(0,r.default)(m.Flex)`
|
|
60
|
+
flex-direction: column;
|
|
61
|
+
`,x=({children:Z})=>e.createElement(j,{shadow:"tableShadow",hasRadius:!0,paddingTop:9,paddingBottom:9,paddingLeft:10,paddingRight:10,background:"neutral0",justifyContent:"center"},Z);x.propTypes={children:f().node.isRequired};const T=({children:Z})=>e.createElement("div",null,e.createElement(m.Flex,{as:"header",justifyContent:"flex-end"},e.createElement(m.Box,{paddingTop:6,paddingRight:8},e.createElement(R,null))),e.createElement(m.Box,{paddingTop:2,paddingBottom:11},Z));T.propTypes={children:f().node.isRequired};var D=T},56761:function(O,E){"use strict";const t=[];E.Z=t},72218:function(O,E,t){"use strict";var e=t(83292),r=t(39161),n=t.n(r);const f=(0,e.default)(r.FieldAction)`
|
|
62
|
+
svg {
|
|
63
|
+
height: 1rem;
|
|
64
|
+
width: 1rem;
|
|
65
|
+
path {
|
|
66
|
+
fill: ${({theme:m})=>m.colors.neutral600};
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
`;E.Z=f},1115:function(O,E,t){"use strict";var e=t(32735),r=t(13478),n=t.n(r),f=t(57269),m=t.n(f),g=t(39161),c=t.n(g),B=t(60216),R=t.n(B),j=t(5636),v=t(83292),x=t(83281),T=t(954),D=t(10190),Z=t(72218);const L=(0,v.default)(g.TextInput)`
|
|
70
|
+
::-ms-reveal {
|
|
71
|
+
display: none;
|
|
72
|
+
}
|
|
73
|
+
`,U=({onSubmit:$,schema:z,children:ae})=>{const[P,M]=(0,e.useState)(!1),{formatMessage:A}=(0,j.useIntl)();return e.createElement(g.Main,null,e.createElement(T.bU,null,e.createElement(x.Formik,{enableReinitialize:!0,initialValues:{email:"",password:"",rememberMe:!1},onSubmit:$,validationSchema:z,validateOnChange:!1},({values:W,errors:a,handleChange:ie})=>e.createElement(r.Form,{noValidate:!0},e.createElement(T.sg,null,e.createElement(D.Z,null),e.createElement(g.Box,{paddingTop:6,paddingBottom:1},e.createElement(g.Typography,{variant:"alpha",as:"h1"},A({id:"Auth.form.welcome.title",defaultMessage:"Welcome!"}))),e.createElement(g.Box,{paddingBottom:7},e.createElement(g.Typography,{variant:"epsilon",textColor:"neutral600"},A({id:"Auth.form.welcome.subtitle",defaultMessage:"Log in to your Strapi account"}))),a.errorMessage&&e.createElement(g.Typography,{id:"global-form-error",role:"alert",tabIndex:-1,textColor:"danger600"},a.errorMessage)),e.createElement(g.Flex,{direction:"column",alignItems:"stretch",gap:6},e.createElement(g.TextInput,{error:a.email?A({id:a.email,defaultMessage:"This value is required."}):"",value:W.email,onChange:ie,label:A({id:"Auth.form.email.label",defaultMessage:"Email"}),placeholder:A({id:"Auth.form.email.placeholder",defaultMessage:"kai@doe.com"}),name:"email",required:!0}),e.createElement(L,{error:a.password?A({id:a.password,defaultMessage:"This value is required."}):"",onChange:ie,value:W.password,label:A({id:"global.password",defaultMessage:"Password"}),name:"password",type:P?"text":"password",endAction:e.createElement(Z.Z,{onClick:Le=>{Le.stopPropagation(),M(Be=>!Be)},label:A(P?{id:"Auth.form.password.show-password",defaultMessage:"Show password"}:{id:"Auth.form.password.hide-password",defaultMessage:"Hide password"})},P?e.createElement(f.Eye,null):e.createElement(f.EyeStriked,null)),required:!0}),e.createElement(g.Checkbox,{onValueChange:Le=>{ie({target:{value:Le,name:"rememberMe"}})},value:W.rememberMe,"aria-label":"rememberMe",name:"rememberMe"},A({id:"Auth.form.rememberMe.label",defaultMessage:"Remember me"})),e.createElement(g.Button,{fullWidth:!0,type:"submit"},A({id:"Auth.form.button.login",defaultMessage:"Login"}))))),ae),e.createElement(g.Flex,{justifyContent:"center"},e.createElement(g.Box,{paddingTop:4},e.createElement(r.Link,{to:"/auth/forgot-password"},A({id:"Auth.link.forgot-password",defaultMessage:"Forgot your password?"})))))};U.defaultProps={children:null,onSubmit(){}},U.propTypes={children:R().node,onSubmit:R().func,schema:R().shape({type:R().string.isRequired}).isRequired},E.Z=U},5365:function(O,E,t){"use strict";var e=t(32735),r=t(60216),n=t.n(r),f=t(1115),m=t(954);const g=c=>e.createElement(m.ZP,null,e.createElement(f.Z,{...c}));g.defaultProps={onSubmit:c=>c.preventDefault()},g.propTypes={onSubmit:n().func},E.Z=g},53951:function(O,E,t){"use strict";t.r(E);var e=t(32735),r=t(13478),n=t.n(r),f=t(39161),m=t.n(f),g=t(57269),c=t.n(g),B=t(5636);const R=()=>{const{formatMessage:j}=(0,B.useIntl)();return(0,r.useFocusWhenNavigate)(),e.createElement(f.Main,{labelledBy:"title"},e.createElement(f.HeaderLayout,{id:"title",title:j({id:"content-manager.pageNotFound",defaultMessage:"Page not found"})}),e.createElement(f.ContentLayout,null,e.createElement(f.EmptyStateLayout,{action:e.createElement(r.LinkButton,{variant:"secondary",endIcon:e.createElement(g.ArrowRight,null),to:"/"},j({id:"app.components.NotFoundPage.back",defaultMessage:"Back to homepage"})),content:j({id:"app.page.not.found",defaultMessage:"Oops! We can't seem to find the page you're looging for..."}),hasRadius:!0,icon:e.createElement(g.EmptyPictures,{width:"10rem"}),shadow:"tableShadow"})))};E.default=R},26123:function(O,E){"use strict";E.Z={}},41832:function(O,E){"use strict";const t=({data:e})=>{try{return Object.keys(e).reduce((r,n)=>{const f=e[n][0];return r[n]={id:f,defaultMessage:f},r},{})}catch{return{}}};E.Z=t},8997:function(O,E,t){"use strict";t.d(E,{R6:function(){return n},ot:function(){return j},Iz:function(){return v.Z},Pp:function(){return z},IF:function(){return $},Qy:function(){return P},WW:function(){return T}});var e=t(13478),n=async(M,A)=>{let W=null;try{await A.validate(M,{abortEarly:!1})}catch(a){W=(0,e.getYupInnerErrors)(a)}return W},f=t(32735),m=t(60216),g=t.n(m),c=t(5141);const B=({loadComponent:M})=>{const[A,W]=(0,f.useState)(null);return(0,f.useEffect)(()=>{(async()=>{try{const ie=await M();W(()=>ie.default)}catch(ie){console.log(ie)}})()},[M]),A?f.createElement(A,null):f.createElement(e.LoadingIndicatorPage,null)},R=(M,A,W)=>f.createElement(c.Route,{render:()=>f.createElement(B,{loadComponent:M}),key:A,path:A,exact:W||!1});B.propTypes={loadComponent:g().func.isRequired};var j=R,v=t(41832),T=M=>M.filter((A,W,a)=>a.findIndex(ie=>ie.key===A.key)===W),D=t(98978);const Z=M=>sortBy(M,A=>A.name);var L=null,$=M=>`/admin/${M}`,z=(M,A="")=>[M,A].filter(W=>W).join(" ");const ae={bufferToHex(M){return[...new Uint8Array(M)].map(A=>A.toString(16).padStart(2,"0")).join("")},async digestMessage(M){const A=new TextEncoder().encode(M),W=await crypto.subtle.digest("SHA-256",A);return this.bufferToHex(W)}};async function P(M){if(!M)return null;try{return await ae.digestMessage(M.email)}catch{return null}}},58414:function(O,E,t){"use strict";t.d(E,{pl:function(){return R},q5:function(){return v.Z}});var e=t(32735),r=t(13478),n=t(8997),f=t(97889);const m={data:[],isLoading:!0};var c=(x,T)=>(0,f.default)(x,D=>{switch(T.type){case"GET_DATA_SUCCEEDED":{D.data=T.data,D.isLoading=!1;break}case"GET_DATA_ERROR":{D.isLoading=!1;break}default:return D}}),R=({ssoEnabled:x})=>{const[T,D]=(0,e.useReducer)(c,m),Z=(0,r.useNotification)();(0,e.useEffect)(()=>{L()},[]);const L=async()=>{try{if(!x){D({type:"GET_DATA_SUCCEEDED",data:[]});return}const U=(0,n.IF)("providers"),$=await(0,r.request)(U,{method:"GET"});D({type:"GET_DATA_SUCCEEDED",data:$})}catch(U){console.error(U),D({type:"GET_DATA_ERROR"}),Z({type:"warning",message:{id:"notification.error"}})}};return T},j=t(21306),v=t(2690)},21306:function(O,E,t){"use strict";var e=t(32735),r=t(5636),n=t(44096),f=t(13478),m=t.n(f),g=t(36866),c=t.n(g),B=t(2690);const R="strapi-notification-seat-limit",j="https://cloud.strapi.io/profile/billing",v="https://strapi.io/billing/request-seats",x=()=>{const{formatMessage:T}=(0,r.useIntl)();let{license:D}=(0,B.Z)();const Z=(0,f.useNotification)(),{pathname:L}=(0,n.useLocation)();(0,e.useEffect)(()=>{if(!D?.data)return;const{enforcementUserCount:U,permittedSeats:$,licenseLimitStatus:z,isHostedOnStrapiCloud:ae}=D?.data??{},P=!c()($)&&!window.sessionStorage.getItem(`${R}-${L}`)&&(z==="AT_LIMIT"||z==="OVER_LIMIT");let M;z==="OVER_LIMIT"?M="warning":z==="AT_LIMIT"&&(M="softWarning"),P&&Z({type:M,message:T({id:"notification.ee.warning.over-.message",defaultMessage:"Add seats to {licenseLimitStatus, select, OVER_LIMIT {invite} other {re-enable}} Users. If you already did it but it's not reflected in Strapi yet, make sure to restart your app."},{licenseLimitStatus:z}),title:T({id:"notification.ee.warning.at-seat-limit.title",defaultMessage:"{licenseLimitStatus, select, OVER_LIMIT {Over} other {At}} seat limit ({enforcementUserCount}/{permittedSeats})"},{licenseLimitStatus:z,enforcementUserCount:U,permittedSeats:$}),link:{url:ae?j:v,label:T({id:"notification.ee.warning.seat-limit.link",defaultMessage:"{isHostedOnStrapiCloud, select, true {ADD SEATS} other {CONTACT SALES}}"},{isHostedOnStrapiCloud:ae})},blockTransition:!0,onClose(){window.sessionStorage.setItem(`${R}-${L}`,!0)}})},[Z,D.data,L,T])};E.Z=x},2690:function(O,E,t){"use strict";var e=t(13478),r=t.n(e),n=t(84968),f=t.n(n),m=t(72041);const g=()=>{const c=(0,e.useRBAC)(m.Z.settings.users),{isLoading:B,allowedActions:{canRead:R,canCreate:j,canUpdate:v,canDelete:x}}=c,T=R&&j&&v&&x,{get:D}=(0,e.useFetchClient)(),Z=async()=>{const{data:{data:U}}=await D("/admin/license-limit-information");return U};return{license:(0,n.useQuery)(["ee","license-limit-info"],Z,{enabled:!B&&T})}};E.Z=g},66334:function(O,E,t){"use strict";var e=t(72041);const r=[];window.strapi.features.isEnabled(window.strapi.features.AUDIT_LOGS)&&r.push({intlLabel:{id:"global.auditLogs",defaultMessage:"Audit Logs"},to:"/settings/audit-logs?pageSize=50&page=1&sort=date:DESC",id:"auditLogs",isDisplayed:!1,permissions:e.Z.settings.auditLogs.main});const n=r;E.Z=n},11545:function(O,E,t){"use strict";var e=t(72041);const r=[];window.strapi.features.isEnabled(window.strapi.features.SSO)&&r.push({intlLabel:{id:"Settings.sso.title",defaultMessage:"Single Sign-On"},to:"/settings/single-sign-on",id:"sso",isDisplayed:!1,permissions:e.Z.settings.sso.main}),window.strapi.features.isEnabled(window.strapi.features.REVIEW_WORKFLOWS)&&r.push({intlLabel:{id:"Settings.review-workflows.page.title",defaultMessage:"Review Workflows"},to:"/settings/review-workflows",id:"review-workflows",isDisplayed:!1,permissions:e.Z.settings["review-workflows"].main}),E.Z=r},68944:function(O,E,t){"use strict";t.d(E,{Z:function(){return v}});var e=t(32735),r=t(5141),n=t(5636),f=t(49189),m=t.n(f),g=t(13478),c=t(8997),R=()=>{const{params:{authResponse:x}}=(0,r.useRouteMatch)("/auth/login/:authResponse"),{formatMessage:T}=(0,n.useIntl)(),{push:D}=(0,r.useHistory)(),Z=(0,e.useRef)(T);let L=(0,e.useCallback)(()=>{D(`/auth/oops?info=${encodeURIComponent(Z.current({id:"Auth.form.button.login.providers.error",defaultMessage:"We cannot connect you through the selected provider."}))}`)},[D]);const U=(0,e.useCallback)(async()=>{try{const $=m().get("jwtToken");if(g.auth.clearAppStorage(),$){g.auth.setToken($,!0);const z=(0,c.IF)("users/me"),{data:ae}=await(0,g.request)(z,{method:"GET"});g.auth.setUserInfo(ae,!0),m().remove("jwtToken"),D("/auth/login")}}catch{L()}},[D,L]);return(0,e.useEffect)(()=>{x==="error"&&L(),x==="success"&&U()},[x,U,L]),e.createElement(g.LoadingIndicatorPage,null)},v=[{Component:()=>({default:R}),to:"/auth/login/:authResponse",exact:!0}]},98768:function(O,E,t){"use strict";var e=t(32735),r=t(60216),n=t.n(r),f=t(83292),m=t(39161),g=t.n(m),c=t(5636),B=t(1115),R=t(58414),j=t(954),v=t(33205);const x=(0,f.default)(m.Divider)`
|
|
74
|
+
flex: 1;
|
|
75
|
+
`,T=D=>{const Z=strapi.features.isEnabled(strapi.features.SSO),{isLoading:L,data:U}=(0,R.pl)({ssoEnabled:Z}),{formatMessage:$}=(0,c.useIntl)();return!Z||!L&&U.length===0?e.createElement(j.ZP,null,e.createElement(B.Z,{...D})):e.createElement(j.ZP,null,e.createElement(B.Z,{...D},e.createElement(m.Box,{paddingTop:7},e.createElement(m.Flex,{direction:"column",alignItems:"stretch",gap:7},e.createElement(m.Flex,null,e.createElement(x,null),e.createElement(m.Box,{paddingLeft:3,paddingRight:3},e.createElement(m.Typography,{variant:"sigma",textColor:"neutral600"},$({id:"Auth.login.sso.divider"}))),e.createElement(x,null)),e.createElement(v.Z,{providers:U,displayAllProviders:!1})))))};T.defaultProps={onSubmit:D=>D.preventDefault(),requestError:null},T.propTypes={formErrors:n().object.isRequired,modifiedData:n().object.isRequired,onChange:n().func.isRequired,onSubmit:n().func,requestError:n().object},E.Z=T},33205:function(O,E,t){"use strict";var e=t(32735),r=t(60216),n=t.n(r),f=t(39161),m=t.n(f),g=t(83292),c=t(5636),B=t(5141);const R=g.default.a`
|
|
76
|
+
width: ${136/16}rem;
|
|
77
|
+
display: flex;
|
|
78
|
+
justify-content: center;
|
|
79
|
+
align-items: center;
|
|
80
|
+
height: ${48/16}rem;
|
|
81
|
+
border: 1px solid ${({theme:T})=>T.colors.neutral150};
|
|
82
|
+
border-radius: ${({theme:T})=>T.borderRadius};
|
|
83
|
+
text-decoration: inherit;
|
|
84
|
+
&:link {
|
|
85
|
+
text-decoration: none;
|
|
86
|
+
}
|
|
87
|
+
color: ${({theme:T})=>T.colors.neutral600};
|
|
88
|
+
`,j=(0,g.default)(f.Flex)`
|
|
89
|
+
& a:not(:first-child):not(:last-child) {
|
|
90
|
+
margin: 0 ${({theme:T})=>T.spaces[2]};
|
|
91
|
+
}
|
|
92
|
+
& a:first-child {
|
|
93
|
+
margin-right: ${({theme:T})=>T.spaces[2]};
|
|
94
|
+
}
|
|
95
|
+
& a:last-child {
|
|
96
|
+
margin-left: ${({theme:T})=>T.spaces[2]};
|
|
97
|
+
}
|
|
98
|
+
`,v=({provider:T})=>e.createElement(f.Tooltip,{label:T.displayName},e.createElement(R,{href:`${strapi.backendURL}/admin/connect/${T.uid}`},T.icon?e.createElement("img",{src:T.icon,"aria-hidden":!0,alt:"",height:"32px"}):e.createElement(f.Typography,null,T.displayName)));v.propTypes={provider:n().shape({icon:n().string,displayName:n().string.isRequired,uid:n().string.isRequired}).isRequired};const x=({providers:T,displayAllProviders:D})=>{const{formatMessage:Z}=(0,c.useIntl)();return D?e.createElement(f.Grid,{gap:4},T.map(L=>e.createElement(f.GridItem,{key:L.uid,col:4},e.createElement(v,{provider:L})))):T.length>2&&!D?e.createElement(f.Grid,{gap:4},T.slice(0,2).map(L=>e.createElement(f.GridItem,{key:L.uid,col:4},e.createElement(v,{provider:L}))),e.createElement(f.GridItem,{col:4},e.createElement(f.Tooltip,{label:Z({id:"global.see-more"})},e.createElement(R,{as:B.Link,to:"/auth/providers"},e.createElement("span",{"aria-hidden":!0},"\u2022\u2022\u2022"))))):e.createElement(j,{justifyContent:"center"},T.map(L=>e.createElement(v,{key:L.uid,provider:L})))};x.defaultProps={displayAllProviders:!0},x.propTypes={providers:n().arrayOf(n().object).isRequired,displayAllProviders:n().bool},E.Z=x},7277:function(O,E,t){"use strict";t.d(E,{Z:function(){return L}});var e=t(32735),r=t(5141),n=t(83292),f=t(13478),m=t(39161),g=t(5636),c=t(58414),B=t(954),R=t(33205),j=t(10190);const v=(0,n.default)(m.Divider)`
|
|
99
|
+
flex: 1;
|
|
100
|
+
`;var T=()=>{const U=strapi.features.isEnabled(strapi.features.SSO),{push:$}=(0,r.useHistory)(),{formatMessage:z}=(0,g.useIntl)(),{isLoading:ae,data:P}=(0,c.pl)({ssoEnabled:U}),M=()=>{$("/auth/login")};return!U||!ae&&P.length===0?e.createElement(r.Redirect,{to:"/auth/login"}):e.createElement(B.ZP,null,e.createElement(m.Main,null,e.createElement(B.bU,null,e.createElement(B.sg,null,e.createElement(j.Z,null),e.createElement(m.Box,{paddingTop:6,paddingBottom:1},e.createElement(m.Typography,{as:"h1",variant:"alpha"},z({id:"Auth.form.welcome.title"}))),e.createElement(m.Box,{paddingBottom:7},e.createElement(m.Typography,{variant:"epsilon",textColor:"neutral600"},z({id:"Auth.login.sso.subtitle"})))),e.createElement(m.Flex,{direction:"column",alignItems:"stretch",gap:7},ae?e.createElement(m.Flex,{justifyContent:"center"},e.createElement(m.Loader,null,z({id:"Auth.login.sso.loading"}))):e.createElement(R.Z,{providers:P}),e.createElement(m.Flex,null,e.createElement(v,null),e.createElement(m.Box,{paddingLeft:3,paddingRight:3},e.createElement(m.Typography,{variant:"sigma",textColor:"neutral600"},z({id:"or"}))),e.createElement(v,null)),e.createElement(m.Button,{fullWidth:!0,size:"L",onClick:M},z({id:"Auth.form.button.login.strapi"})))),e.createElement(m.Flex,{justifyContent:"center"},e.createElement(m.Box,{paddingTop:4},e.createElement(f.Link,{to:"/auth/forgot-password"},e.createElement(m.Typography,{variant:"pi"},z({id:"Auth.link.forgot-password"})))))))},D=t(56355),L={...D.Z,providers:{Component:T,endPoint:null,fieldsToDisable:[],fieldsToOmit:[],schema:null,inputsPrefix:""}}},99568:function(O,E){"use strict";const t={settings:{auditLogs:{main:[{action:"admin::audit-logs.read",subject:null}],read:[{action:"admin::audit-logs.read",subject:null}]},"review-workflows":{main:[{action:"admin::review-workflows.read",subject:null}]},sso:{main:[{action:"admin::provider-login.read",subject:null}],read:[{action:"admin::provider-login.read",subject:null}],update:[{action:"admin::provider-login.update",subject:null}]}}};E.Z=t},48224:function(O,E,t){var e={"./ar.json":[38677,7958],"./ca.json":[90169,3516],"./cs.json":[43186,7519],"./de.json":[8343,6901],"./dk.json":[65668,7898],"./en.json":[10329,320],"./es.json":[45445,8367],"./eu.json":[69511,8360],"./fr.json":[8399,8006],"./gu.json":[10182,2248],"./he.json":[21757,830],"./hi.json":[43206,6332],"./hu.json":[72320,5894],"./id.json":[74221,8897],"./it.json":[90685,6817],"./ja.json":[21727,1312],"./ko.json":[30986,1377],"./ml.json":[11309,9903],"./ms.json":[75973,3025],"./nl.json":[80381,2671],"./no.json":[82446,562],"./pl.json":[84008,7846],"./pt-BR.json":[91417,9647],"./pt.json":[41830,3340],"./ru.json":[57098,123],"./sa.json":[92900,9726],"./sk.json":[52204,606],"./sv.json":[43211,9303],"./th.json":[49582,749],"./tr.json":[99154,395],"./uk.json":[2987,7403],"./vi.json":[50576,3278],"./zh-Hans.json":[35964,2553],"./zh.json":[91999,1011]};function r(n){if(!t.o(e,n))return Promise.resolve().then(function(){var g=new Error("Cannot find module '"+n+"'");throw g.code="MODULE_NOT_FOUND",g});var f=e[n],m=f[0];return t.e(f[1]).then(function(){return t.t(m,19)})}r.keys=function(){return Object.keys(e)},r.id=48224,O.exports=r},56355:function(O,E,t){"use strict";t.d(E,{Z:function(){return Ke}});var e=t(5173),r=t(13478),n=t(32735),f=t(5636),m=t(60216),g=t.n(m),c=t(39161),B=t(83281),R=t(954),j=t(10190);const v=({onSubmit:_,schema:Te})=>{const{formatMessage:te}=(0,f.useIntl)();return n.createElement(R.ZP,null,n.createElement(c.Main,null,n.createElement(R.bU,null,n.createElement(B.Formik,{enableReinitialize:!0,initialValues:{email:""},onSubmit:_,validationSchema:Te,validateOnChange:!1},({values:Pe,errors:Ee,handleChange:le})=>n.createElement(r.Form,{noValidate:!0},n.createElement(R.sg,null,n.createElement(j.Z,null),n.createElement(c.Box,{paddingTop:6,paddingBottom:7},n.createElement(c.Typography,{as:"h1",variant:"alpha"},te({id:"Auth.form.button.password-recovery",defaultMessage:"Password Recovery"}))),Ee.errorMessage&&n.createElement(c.Typography,{id:"global-form-error",role:"alert",tabIndex:-1,textColor:"danger600"},te({id:Ee.errorMessage,defaultMessage:"An error occurred"}))),n.createElement(c.Flex,{direction:"column",alignItems:"stretch",gap:6},n.createElement(c.TextInput,{error:Ee.email?te({id:Ee.email,defaultMessage:"This email is invalid."}):"",value:Pe.email,onChange:le,label:te({id:"Auth.form.email.label",defaultMessage:"Email"}),placeholder:te({id:"Auth.form.email.placeholder",defaultMessage:"kai@doe.com"}),name:"email",required:!0}),n.createElement(c.Button,{type:"submit",fullWidth:!0},te({id:"Auth.form.button.forgot-password",defaultMessage:"Send Email"})))))),n.createElement(c.Flex,{justifyContent:"center"},n.createElement(c.Box,{paddingTop:4},n.createElement(r.Link,{to:"/auth/login"},te({id:"Auth.link.ready",defaultMessage:"Ready to sign in?"}))))))};v.defaultProps={onSubmit:_=>_.preventDefault()},v.propTypes={onSubmit:g().func,schema:g().shape({type:g().string.isRequired}).isRequired};var x=v,D=()=>{const{formatMessage:_}=(0,f.useIntl)();return n.createElement(R.ZP,null,n.createElement(c.Main,null,n.createElement(R.bU,null,n.createElement(R.sg,null,n.createElement(j.Z,null),n.createElement(c.Box,{paddingTop:6,paddingBottom:7},n.createElement(c.Typography,{as:"h1",variant:"alpha"},_({id:"app.containers.AuthPage.ForgotPasswordSuccess.title",defaultMessage:"Email sent"}))),n.createElement(c.Typography,null,_({id:"app.containers.AuthPage.ForgotPasswordSuccess.text.email",defaultMessage:"It can take a few minutes to receive your password recovery link."})),n.createElement(c.Box,{paddingTop:4},n.createElement(c.Typography,null,_({id:"app.containers.AuthPage.ForgotPasswordSuccess.text.contact-admin",defaultMessage:"If you do not receive this link, please contact your administrator."}))))),n.createElement(c.Flex,{justifyContent:"center"},n.createElement(c.Box,{paddingTop:4},n.createElement(r.Link,{to:"/auth/login"},_({id:"Auth.link.signin",defaultMessage:"Sign in"}))))))},L=()=>{const{formatMessage:_}=(0,f.useIntl)(),te=(0,r.useQuery)().get("info")||_({id:"Auth.components.Oops.text",defaultMessage:"Your account has been suspended."});return n.createElement(R.ZP,null,n.createElement(c.Main,null,n.createElement(R.bU,null,n.createElement(R.sg,null,n.createElement(j.Z,null),n.createElement(c.Box,{paddingTop:6,paddingBottom:7},n.createElement(c.Typography,{as:"h1",variant:"alpha"},_({id:"Auth.components.Oops.title",defaultMessage:"Oops..."}))),n.createElement(c.Typography,null,te),n.createElement(c.Box,{paddingTop:4},n.createElement(c.Typography,null,_({id:"Auth.components.Oops.text.admin",defaultMessage:"If this is a mistake, please contact your administrator."}))))),n.createElement(c.Flex,{justifyContent:"center"},n.createElement(c.Box,{paddingTop:4},n.createElement(r.Link,{to:"/auth/login"},_({id:"Auth.link.signin",defaultMessage:"Sign in"}))))))},U=t(83292),$=t(33795),z=t.n($),ae=t(9086),P=t.n(ae),M=t(5141),A=t(84306),W=t(57269),a=t(72218);const ie=(0,U.default)(c.Box)`
|
|
101
|
+
text-align: center;
|
|
102
|
+
`,Le=U.default.a`
|
|
103
|
+
color: ${({theme:_})=>_.colors.primary600};
|
|
104
|
+
`,Be=(0,U.default)(c.TextInput)`
|
|
105
|
+
::-ms-reveal {
|
|
106
|
+
display: none;
|
|
107
|
+
}
|
|
108
|
+
`,Ge=({authType:_,fieldsToDisable:Te,noSignin:te,onSubmit:Pe,schema:Ee})=>{const le=(0,r.useNotification)(),{push:re}=(0,M.useHistory)(),[je,Me]=(0,n.useState)(!1),[Oe,fe]=(0,n.useState)(!1),[Re,He]=(0,n.useState)(0),[Fe,et]=(0,n.useState)({}),{trackUsage:$e}=(0,r.useTracking)(),{formatMessage:V}=(0,f.useIntl)(),xe=(0,r.useQuery)().get("registrationToken");return(0,n.useEffect)(()=>{xe&&(async()=>{try{const{data:{data:se}}=await A.Z.get(`${strapi.backendURL}/admin/registration-info?registrationToken=${xe}`);se&&et(se)}catch(se){const pe=z()(se,["response","data","message"],"An error occurred");le({type:"warning",message:pe}),re(`/auth/oops?info=${encodeURIComponent(pe)}`)}})()},[xe]),n.createElement(R.ZP,null,n.createElement(R.bU,null,n.createElement(B.Formik,{enableReinitialize:!0,initialValues:{firstname:Fe.firstname||"",lastname:Fe.lastname||"",email:Fe.email||"",password:"",confirmPassword:"",registrationToken:xe||void 0,news:!1},onSubmit:async(J,se)=>{try{await Ee.validate(J,{abortEarly:!1}),Re>0&&_==="register-admin"&&$e("didSubmitWithErrorsFirstAdmin",{count:Re.toString()}),Pe(xe?{userInfo:P()(J,["registrationToken"]),registrationToken:xe}:J,se)}catch(pe){const Se=(0,r.getYupInnerErrors)(pe);He(Re+1),se.setErrors(Se)}},validateOnChange:!1},({values:J,errors:se,handleChange:pe})=>n.createElement(r.Form,{noValidate:!0},n.createElement(c.Main,null,n.createElement(R.sg,null,n.createElement(j.Z,null),n.createElement(c.Box,{paddingTop:6,paddingBottom:1},n.createElement(c.Typography,{as:"h1",variant:"alpha"},V({id:"Auth.form.welcome.title",defaultMessage:"Welcome to Strapi!"}))),n.createElement(ie,{paddingBottom:7},n.createElement(c.Typography,{variant:"epsilon",textColor:"neutral600"},V({id:"Auth.form.register.subtitle",defaultMessage:"Credentials are only used to authenticate in Strapi. All saved data will be stored in your database."})))),n.createElement(c.Flex,{direction:"column",alignItems:"stretch",gap:6},n.createElement(c.Grid,{gap:4},n.createElement(c.GridItem,{col:6},n.createElement(c.TextInput,{name:"firstname",required:!0,value:J.firstname,error:se.firstname?V(se.firstname):void 0,onChange:pe,label:V({id:"Auth.form.firstname.label",defaultMessage:"Firstname"})})),n.createElement(c.GridItem,{col:6},n.createElement(c.TextInput,{name:"lastname",value:J.lastname,onChange:pe,label:V({id:"Auth.form.lastname.label",defaultMessage:"Lastname"})}))),n.createElement(c.TextInput,{name:"email",disabled:Te.includes("email"),value:J.email,onChange:pe,error:se.email?V(se.email):void 0,required:!0,label:V({id:"Auth.form.email.label",defaultMessage:"Email"}),type:"email"}),n.createElement(Be,{name:"password",onChange:pe,value:J.password,error:se.password?V(se.password):void 0,endAction:n.createElement(a.Z,{onClick:Se=>{Se.preventDefault(),Me(ze=>!ze)},label:V(je?{id:"Auth.form.password.show-password",defaultMessage:"Show password"}:{id:"Auth.form.password.hide-password",defaultMessage:"Hide password"})},je?n.createElement(W.Eye,null):n.createElement(W.EyeStriked,null)),hint:V({id:"Auth.form.password.hint",defaultMessage:"Must be at least 8 characters, 1 uppercase, 1 lowercase & 1 number"}),required:!0,label:V({id:"global.password",defaultMessage:"Password"}),type:je?"text":"password"}),n.createElement(Be,{name:"confirmPassword",onChange:pe,value:J.confirmPassword,error:se.confirmPassword?V(se.confirmPassword):void 0,endAction:n.createElement(a.Z,{onClick:Se=>{Se.preventDefault(),fe(ze=>!ze)},label:V(Oe?{id:"Auth.form.password.show-password",defaultMessage:"Show password"}:{id:"Auth.form.password.hide-password",defaultMessage:"Hide password"})},Oe?n.createElement(W.Eye,null):n.createElement(W.EyeStriked,null)),required:!0,label:V({id:"Auth.form.confirmPassword.label",defaultMessage:"Confirm Password"}),type:Oe?"text":"password"}),n.createElement(c.Checkbox,{onValueChange:Se=>{pe({target:{value:Se,name:"news"}})},value:J.news,name:"news","aria-label":"news"},V({id:"Auth.form.register.news.label",defaultMessage:"Keep me updated about new features & upcoming improvements (by doing this you accept the {terms} and the {policy})."},{terms:n.createElement(Le,{target:"_blank",href:"https://strapi.io/terms",rel:"noreferrer"},V({id:"Auth.privacy-policy-agreement.terms",defaultMessage:"terms"})),policy:n.createElement(Le,{target:"_blank",href:"https://strapi.io/privacy",rel:"noreferrer"},V({id:"Auth.privacy-policy-agreement.policy",defaultMessage:"policy"}))})),n.createElement(c.Button,{fullWidth:!0,size:"L",type:"submit"},V({id:"Auth.form.button.register",defaultMessage:"Let's start"})))))),!te&&n.createElement(c.Box,{paddingTop:4},n.createElement(c.Flex,{justifyContent:"center"},n.createElement(r.Link,{label:"Auth.link.signin",to:"/auth/login"},V({id:"Auth.link.signin.account",defaultMessage:"Already have an account?"}))))))};Ge.defaultProps={fieldsToDisable:[],noSignin:!1,onSubmit:_=>_.preventDefault()},Ge.propTypes={authType:g().string.isRequired,fieldsToDisable:g().array,noSignin:g().bool,onSubmit:g().func,schema:g().shape({validate:g().func.isRequired,type:g().string.isRequired}).isRequired};var _e=Ge;const ve=(0,U.default)(c.TextInput)`
|
|
109
|
+
::-ms-reveal {
|
|
110
|
+
display: none;
|
|
111
|
+
}
|
|
112
|
+
`,Ne=({onSubmit:_,schema:Te})=>{const[te,Pe]=(0,n.useState)(!1),[Ee,le]=(0,n.useState)(!1),{formatMessage:re}=(0,f.useIntl)();return n.createElement(R.ZP,null,n.createElement(c.Main,null,n.createElement(R.bU,null,n.createElement(B.Formik,{enableReinitialize:!0,initialValues:{password:"",confirmPassword:""},onSubmit:_,validationSchema:Te,validateOnChange:!1},({values:je,errors:Me,handleChange:Oe})=>n.createElement(r.Form,{noValidate:!0},n.createElement(R.sg,null,n.createElement(j.Z,null),n.createElement(c.Box,{paddingTop:6,paddingBottom:7},n.createElement(c.Typography,{as:"h1",variant:"alpha"},re({id:"global.reset-password",defaultMessage:"Reset password"}))),Me.errorMessage&&n.createElement(c.Typography,{id:"global-form-error",role:"alert",tabIndex:-1,textColor:"danger600"},re({id:Me.errorMessage,defaultMessage:"An error occurred"}))),n.createElement(c.Flex,{direction:"column",alignItems:"stretch",gap:6},n.createElement(ve,{name:"password",onChange:Oe,value:je.password,error:Me.password?re({id:Me.password,defaultMessage:"This field is required."}):void 0,endAction:n.createElement(a.Z,{onClick:fe=>{fe.preventDefault(),Pe(Re=>!Re)},label:re(te?{id:"Auth.form.password.show-password",defaultMessage:"Show password"}:{id:"Auth.form.password.hide-password",defaultMessage:"Hide password"})},te?n.createElement(W.Eye,null):n.createElement(W.EyeStriked,null)),hint:re({id:"Auth.form.password.hint",defaultMessage:"Password must contain at least 8 characters, 1 uppercase, 1 lowercase and 1 number"}),required:!0,label:re({id:"global.password",defaultMessage:"Password"}),type:te?"text":"password"}),n.createElement(ve,{name:"confirmPassword",onChange:Oe,value:je.confirmPassword,error:Me.confirmPassword?re({id:Me.confirmPassword,defaultMessage:"This value is required."}):void 0,endAction:n.createElement(a.Z,{onClick:fe=>{fe.preventDefault(),le(Re=>!Re)},label:re(te?{id:"Auth.form.password.show-password",defaultMessage:"Show password"}:{id:"Auth.form.password.hide-password",defaultMessage:"Hide password"})},Ee?n.createElement(W.Eye,null):n.createElement(W.EyeStriked,null)),required:!0,label:re({id:"Auth.form.confirmPassword.label",defaultMessage:"Confirm Password"}),type:Ee?"text":"password"}),n.createElement(c.Button,{fullwidth:!0,type:"submit"},re({id:"global.change-password",defaultMessage:"Change password"})))))),n.createElement(c.Flex,{justifyContent:"center"},n.createElement(c.Box,{paddingTop:4},n.createElement(r.Link,{to:"/auth/login"},re({id:"Auth.link.ready",defaultMessage:"Ready to sign in?"}))))))};Ne.defaultProps={onSubmit:_=>_.preventDefault()},Ne.propTypes={onSubmit:g().func,schema:g().shape({type:g().string.isRequired}).isRequired};var me=Ne;const Xe=(()=>window&&window.strapi&&window.strapi.isEE?t(98768).Z:t(5365).Z)();var Ke={"forgot-password":{Component:x,endPoint:"forgot-password",fieldsToDisable:[],fieldsToOmit:[],schema:e.Ry().shape({email:e.Z_().email(r.translatedErrors.email).required(r.translatedErrors.required)}),inputsPrefix:""},"forgot-password-success":{Component:D,endPoint:"",fieldsToDisable:[],fieldsToOmit:[],schema:null,inputsPrefix:""},login:{Component:Xe,endPoint:"login",fieldsToDisable:[],fieldsToOmit:["rememberMe"],schema:e.Ry().shape({email:e.Z_().email(r.translatedErrors.email).required(r.translatedErrors.required),password:e.Z_().required(r.translatedErrors.required),rememberMe:e.Xg().nullable()}),inputsPrefix:""},oops:{Component:L,endPoint:null,fieldsToDisable:[],fieldsToOmit:[],schema:null,inputsPrefix:""},register:{Component:_e,endPoint:"register",fieldsToDisable:["email"],fieldsToOmit:["userInfo.confirmPassword","userInfo.news","userInfo.email"],schema:e.Ry().shape({firstname:e.Z_().trim().required(r.translatedErrors.required),lastname:e.Z_(),password:e.Z_().min(8,r.translatedErrors.minLength).matches(/[a-z]/,"components.Input.error.contain.lowercase").matches(/[A-Z]/,"components.Input.error.contain.uppercase").matches(/\d/,"components.Input.error.contain.number").required(r.translatedErrors.required),confirmPassword:e.Z_().oneOf([e.iH("password"),null],"components.Input.error.password.noMatch").required(r.translatedErrors.required),registrationToken:e.Z_().required(r.translatedErrors.required)}),inputsPrefix:"userInfo."},"register-admin":{Component:_e,endPoint:"register-admin",noSignin:!0,fieldsToDisable:[],fieldsToOmit:["confirmPassword","news"],schema:e.Ry().shape({firstname:e.Z_().trim().required(r.translatedErrors.required),lastname:e.Z_(),password:e.Z_().min(8,r.translatedErrors.minLength).matches(/[a-z]/,"components.Input.error.contain.lowercase").matches(/[A-Z]/,"components.Input.error.contain.uppercase").matches(/\d/,"components.Input.error.contain.number").required(r.translatedErrors.required),email:e.Z_().email(r.translatedErrors.email).strict().lowercase(r.translatedErrors.lowercase).required(r.translatedErrors.required),confirmPassword:e.Z_().oneOf([e.iH("password"),null],"components.Input.error.password.noMatch").required(r.translatedErrors.required)}),inputsPrefix:""},"reset-password":{Component:me,endPoint:"reset-password",fieldsToDisable:[],fieldsToOmit:["confirmPassword"],schema:e.Ry().shape({password:e.Z_().min(8,r.translatedErrors.minLength).matches(/[a-z]/,"components.Input.error.contain.lowercase").matches(/[A-Z]/,"components.Input.error.contain.uppercase").matches(/\d/,"components.Input.error.contain.number").required(r.translatedErrors.required),confirmPassword:e.Z_().oneOf([e.iH("password"),null],"components.Input.error.password.noMatch").required(r.translatedErrors.required)})}}},72041:function(O,E,t){"use strict";t.d(E,{Z:function(){return c}});var e=t(86349),r=t.n(e),f={contentManager:{main:[],collectionTypesConfigurations:[{action:"plugin::content-manager.collection-types.configure-view",subject:null}],componentsConfigurations:[{action:"plugin::content-manager.components.configure-layout",subject:null}],singleTypesConfigurations:[{action:"plugin::content-manager.single-types.configure-view",subject:null}]},marketplace:{main:[{action:"admin::marketplace.read",subject:null}],read:[{action:"admin::marketplace.read",subject:null}]},settings:{roles:{main:[{action:"admin::roles.create",subject:null},{action:"admin::roles.update",subject:null},{action:"admin::roles.read",subject:null},{action:"admin::roles.delete",subject:null}],create:[{action:"admin::roles.create",subject:null}],delete:[{action:"admin::roles.delete",subject:null}],read:[{action:"admin::roles.read",subject:null}],update:[{action:"admin::roles.update",subject:null}]},users:{main:[{action:"admin::users.create",subject:null},{action:"admin::users.read",subject:null},{action:"admin::users.update",subject:null},{action:"admin::users.delete",subject:null}],create:[{action:"admin::users.create",subject:null}],delete:[{action:"admin::users.delete",subject:null}],read:[{action:"admin::users.read",subject:null}],update:[{action:"admin::users.update",subject:null}]},webhooks:{main:[{action:"admin::webhooks.create",subject:null},{action:"admin::webhooks.read",subject:null},{action:"admin::webhooks.update",subject:null},{action:"admin::webhooks.delete",subject:null}],create:[{action:"admin::webhooks.create",subject:null}],delete:[{action:"admin::webhooks.delete",subject:null}],read:[{action:"admin::webhooks.read",subject:null},{action:"admin::webhooks.update",subject:null},{action:"admin::webhooks.delete",subject:null}],update:[{action:"admin::webhooks.update",subject:null}]},"api-tokens":{main:[{action:"admin::api-tokens.access",subject:null}],create:[{action:"admin::api-tokens.create",subject:null}],delete:[{action:"admin::api-tokens.delete",subject:null}],read:[{action:"admin::api-tokens.read",subject:null}],update:[{action:"admin::api-tokens.update",subject:null}],regenerate:[{action:"admin::api-tokens.regenerate",subject:null}]},"transfer-tokens":{main:[{action:"admin::transfer.tokens.access",subject:null}],create:[{action:"admin::transfer.tokens.create",subject:null}],delete:[{action:"admin::transfer.tokens.delete",subject:null}],read:[{action:"admin::transfer.tokens.read",subject:null}],update:[{action:"admin::transfer.tokens.update",subject:null}],regenerate:[{action:"admin::transfer.tokens.regenerate",subject:null}]},"project-settings":{read:[{action:"admin::project-settings.read",subject:null}],update:[{action:"admin::project-settings.update",subject:null}]}}};const m=(()=>window&&window.strapi&&window.strapi.isEE?t(99568).Z:t(26123).Z)();var c=r()(f,m)},47750:function(O,E,t){"use strict";O.exports=t.p+"70674f63fc3904c20de0.svg"}}]);
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
(self.webpackChunk_strapi_admin=self.webpackChunk_strapi_admin||[]).push([[2544],{92034:function(U,W,u){"use strict";u.r(W),u.d(W,{CreatePage:function(){return le},default:function(){return de}});var e=u(32735),A=u(64213),r=u(13478),y=u(39161),i=u(57269),I=u(83281),D=u(33795),K=u.n(D),G=u(86834),F=u.n(G),b=u(5636),he=u(5141),Q=u(83292),_=u(7247),Ce=u(8888),E=u(72041),ie=u(5173),ee=ie.Ry().shape({name:ie.Z_().required(r.translatedErrors.required),description:ie.Z_().required(r.translatedErrors.required)});const Oe=Q.default.div`
|
|
2
|
+
border: 1px solid ${({theme:L})=>L.colors.primary200};
|
|
3
|
+
background: ${({theme:L})=>L.colors.primary100};
|
|
4
|
+
padding: ${({theme:L})=>`${L.spaces[2]} ${L.spaces[4]}`};
|
|
5
|
+
color: ${({theme:L})=>L.colors.primary600};
|
|
6
|
+
border-radius: ${({theme:L})=>L.borderRadius};
|
|
7
|
+
font-size: ${12/16}rem;
|
|
8
|
+
font-weight: bold;
|
|
9
|
+
`,le=()=>{const L=(0,r.useNotification)(),{lockApp:Z,unlockApp:B}=(0,r.useOverlayBlocker)(),{formatMessage:P}=(0,b.useIntl)(),[N,X]=(0,e.useState)(!1),{replace:te}=(0,he.useHistory)(),w=(0,e.useRef)(),{trackUsage:oe}=(0,r.useTracking)(),xe=(0,he.useRouteMatch)("/settings/roles/duplicate/:id"),ue=K()(xe,"params.id",null),{isLoading:Re,data:re}=(0,Ce.U_)(),{permissions:Te,isLoading:me}=(0,Ce.Dq)(ue),be=se=>{Z(),X(!0),oe(ue?"willDuplicateRole":"willCreateNewRole"),Promise.resolve((0,r.request)("/admin/roles",{method:"POST",body:se})).then(async $=>{const{permissionsToSend:q}=w.current.getPermissions();return oe(ue?"didDuplicateRole":"didCreateNewRole"),$.data.id&&!F()(q)&&await(0,r.request)(`/admin/roles/${$.data.id}/permissions`,{method:"PUT",body:{permissions:q}}),$}).then($=>{X(!1),L({type:"success",message:{id:"Settings.roles.created",defaultMessage:"created"}}),te(`/settings/roles/${$.data.id}`)}).catch($=>{console.error($),X(!1),L({type:"warning",message:{id:"notification.error"}})}).finally(()=>{B()})},ne=`${P({id:"Settings.roles.form.created",defaultMessage:"Created"})} ${(0,A.format)(new Date,"PPP")}`;return e.createElement(y.Main,null,e.createElement(r.SettingsPageTitle,{name:"Roles"}),e.createElement(I.Formik,{initialValues:{name:"",description:ne},onSubmit:be,validationSchema:ee,validateOnChange:!1},({handleSubmit:se,values:$,errors:q,handleReset:Y,handleChange:pe})=>e.createElement(r.Form,{noValidate:!0},e.createElement(e.Fragment,null,e.createElement(y.HeaderLayout,{primaryAction:e.createElement(y.Flex,{gap:2},e.createElement(y.Button,{variant:"secondary",onClick:()=>{Y(),w.current.resetForm()},size:"L"},P({id:"app.components.Button.reset",defaultMessage:"Reset"})),e.createElement(y.Button,{onClick:se,loading:N,size:"L"},P({id:"global.save",defaultMessage:"Save"}))),title:P({id:"Settings.roles.create.title",defaultMessage:"Create a role"}),subtitle:P({id:"Settings.roles.create.description",defaultMessage:"Define the rights given to the role"}),navigationAction:e.createElement(r.Link,{startIcon:e.createElement(i.ArrowLeft,null),to:"/settings/roles"},P({id:"global.back",defaultMessage:"Back"}))}),e.createElement(y.ContentLayout,null,e.createElement(y.Flex,{direction:"column",alignItems:"stretch",gap:6},e.createElement(y.Box,{background:"neutral0",padding:6,shadow:"filterShadow",hasRadius:!0},e.createElement(y.Flex,{direction:"column",alignItems:"stretch",gap:4},e.createElement(y.Flex,{justifyContent:"space-between"},e.createElement(y.Box,null,e.createElement(y.Box,null,e.createElement(y.Typography,{fontWeight:"bold"},P({id:"global.details",defaultMessage:"Details"}))),e.createElement(y.Box,null,e.createElement(y.Typography,{variant:"pi",textColor:"neutral600"},P({id:"Settings.roles.form.description",defaultMessage:"Name and description of the role"})))),e.createElement(Oe,null,P({id:"Settings.roles.form.button.users-with-role",defaultMessage:"{number, plural, =0 {# users} one {# user} other {# users}} with this role"},{number:0}))),e.createElement(y.Grid,{gap:4},e.createElement(y.GridItem,{col:6},e.createElement(y.TextInput,{name:"name",error:q.name&&P({id:q.name}),label:P({id:"global.name",defaultMessage:"Name"}),onChange:pe,value:$.name})),e.createElement(y.GridItem,{col:6},e.createElement(y.Textarea,{label:P({id:"global.description",defaultMessage:"Description"}),name:"description",error:q.description&&P({id:q.description}),onChange:pe},$.description))))),!Re&&!me?e.createElement(y.Box,{shadow:"filterShadow",hasRadius:!0},e.createElement(_.Z,{isFormDisabled:!1,ref:w,permissions:Te,layout:re})):e.createElement(y.Box,{background:"neutral0",padding:6,shadow:"filterShadow",hasRadius:!0},e.createElement(r.LoadingIndicatorPage,null))))))))};function de(){return e.createElement(r.CheckPagePermissions,{permissions:E.Z.settings.roles.create},e.createElement(le,null))}},7247:function(U,W,u){"use strict";u.d(W,{Z:function(){return Ln}});var e=u(32735),A=u(60216),r=u.n(A),y=u(13478),i=u(39161),I=u(23973),D=u.n(I),K=u(86834),G=u.n(K),F=u(5636),b=u(83292),he=u(98978),Q=u.n(he),_=u(57269),Ce=u(33795),E=u.n(Ce),ie=u(9086),$e=u.n(ie),ee=u(8888);const Oe=b.default.div`
|
|
10
|
+
position: relative;
|
|
11
|
+
|
|
12
|
+
${({hasConditions:t,disabled:n,theme:o})=>t&&`
|
|
13
|
+
&:before {
|
|
14
|
+
content: '';
|
|
15
|
+
position: absolute;
|
|
16
|
+
top: -3px;
|
|
17
|
+
left: -10px;
|
|
18
|
+
width: 6px;
|
|
19
|
+
height: 6px;
|
|
20
|
+
border-radius: ${20/16}rem;;
|
|
21
|
+
background: ${n?o.colors.neutral100:o.colors.primary600};
|
|
22
|
+
}
|
|
23
|
+
`}
|
|
24
|
+
`,le=({onClick:t,className:n,hasConditions:o,variant:s})=>{const{formatMessage:a}=(0,F.useIntl)();return e.createElement(Oe,{hasConditions:o,className:n},e.createElement(i.Button,{variant:s,startIcon:e.createElement(_.Cog,null),onClick:t},a({id:"global.settings",defaultMessage:"Settings"})))};le.defaultProps={className:null,hasConditions:!1,variant:"tertiary"},le.propTypes={onClick:r().func.isRequired,className:r().string,hasConditions:r().bool,variant:r().string};var de=(0,b.default)(le)``,L=u(97889),Z=u(81346),B=u.n(Z),P=u(23940),N=u.n(P);const X=t=>Object.values(t).map(n=>Object.entries(n).filter(([,o])=>o).map(([o])=>o)).flat(),te=t=>t.reduce((n,[o,s])=>(n.push({label:N()(o),children:s.map(a=>({label:a.displayName,value:a.id}))}),n),[]),w=(t,n)=>t.map(([,o])=>o).flat().reduce((o,s)=>({[s.id]:n.includes(s.id),...o}),{}),oe=({arrayOfOptionsGroupedByCategory:t,isFormDisabled:n,isGrey:o,label:s,name:a,onChange:l,value:c})=>{const{formatMessage:d}=(0,F.useIntl)(),p=m=>{l(a,w(t,m))};return e.createElement(i.Flex,{as:"li",background:o?"neutral100":"neutral0",paddingBottom:3,paddingTop:3},e.createElement(i.Flex,{paddingLeft:6,style:{width:180}},e.createElement(i.Typography,{variant:"sigma",textColor:"neutral600"},d({id:"Settings.permissions.conditions.can",defaultMessage:"Can"}),"\xA0"),e.createElement(i.Typography,{variant:"sigma",title:s,textColor:"primary600",ellipsis:!0},d({id:`Settings.roles.form.permissions.${s.toLowerCase()}`,defaultMessage:s})),e.createElement(i.Typography,{variant:"sigma",textColor:"neutral600"},"\xA0",d({id:"Settings.permissions.conditions.when",defaultMessage:"When"}))),e.createElement(i.Box,{style:{maxWidth:430,width:"100%"}},e.createElement(i.MultiSelectNested,{id:a,customizeContent:m=>`${m.length} currently selected`,onChange:p,value:X(c),options:te(t),disabled:n})))};oe.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};var xe=oe;const ue=(t,n)=>t.reduce((o,s)=>(o[s.id]=E()(n,s.id,!1),o),{}),Re=(t,n)=>t.reduce((o,s)=>{const[a,l]=s,c=ue(l,n);return o[a]=c,o},{});var Te=(t,n,o)=>t.reduce((s,a)=>{const l=E()(n,[...a.pathToConditionsObject,"conditions"],{}),c=Re(o,l);return s[a.pathToConditionsObject.join("..")]=c,s},{});const me=({actions:t,headerBreadCrumbs:n,isFormDisabled:o,onClosed:s,onToggle:a})=>{const{formatMessage:l}=(0,F.useIntl)(),{availableConditions:c,modifiedData:d,onChangeConditions:p}=(0,ee.$_)(),m=(0,e.useMemo)(()=>Object.entries(B()(c,"category")),[c]),g=t.filter(({isDisplayed:f,hasSomeActionsSelected:T,hasAllActionsSelected:R})=>f&&(T||R)),h=(0,e.useMemo)(()=>Te(g,d,m),[g,d,m]),[v,O]=(0,e.useState)(h),x=(f,T)=>{O((0,L.default)(R=>{R[f]||(R[f]={}),R[f].default||(R[f].default={}),R[f].default=T}))},C=()=>{const f=Object.entries(v).reduce((T,R)=>{const[S,V]=R,M=Object.values(V).reduce((j,k)=>({...j,...k}),{});return T[S]=M,T},{});p(f),a()};return e.createElement(i.ModalLayout,{labelledBy:"condition-modal-breadcrumbs",onClose:s},e.createElement(i.ModalHeader,null,e.createElement(i.Breadcrumbs,{id:"condition-modal-breadcrumbs",label:n.join(", ")},n.map(f=>e.createElement(i.Crumb,{key:f},N()(l({id:f,defaultMessage:f})))))),e.createElement(i.ModalBody,null,g.length===0&&e.createElement(i.Typography,null,l({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,g.map(({actionId:f,label:T,pathToConditionsObject:R},S)=>{const V=R.join("..");return e.createElement(xe,{key:f,arrayOfOptionsGroupedByCategory:m,label:T,isFormDisabled:o,isGrey:S%2===0,name:V,onChange:x,value:E()(v,V,{})})}))),e.createElement(i.ModalFooter,{startActions:e.createElement(i.Button,{variant:"tertiary",onClick:a},l({id:"app.components.Button.cancel",defaultMessage:"Cancel"})),endActions:e.createElement(i.Button,{onClick:C},l({id:"Settings.permissions.conditions.apply",defaultMessage:"Apply"}))}))};me.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};var be=me;const ne=`${120/16}rem`,se=`${200/16}rem`,$=`${53/16}rem`;var Y=b.default.div`
|
|
25
|
+
width: ${ne};
|
|
26
|
+
`,ke=(0,b.default)(i.Flex)`
|
|
27
|
+
padding-right: ${({theme:t})=>t.spaces[2]};
|
|
28
|
+
overflow: hidden;
|
|
29
|
+
flex: 1;
|
|
30
|
+
${({isCollapsable:t})=>t&&"cursor: pointer;"}
|
|
31
|
+
`;const Fe=({children:t,isCollapsable:n,isActive:o,isFormDisabled:s,label:a,onChange:l,onClick:c,checkboxName:d,someChecked:p,value:m})=>{const{formatMessage:g}=(0,F.useIntl)();return e.createElement(i.Flex,{alignItems:"center",paddingLeft:6,style:{width:se,flexShrink:0}},e.createElement(i.Box,{paddingRight:2},e.createElement(i.BaseCheckbox,{name:d,"aria-label":g({id:"Settings.permissions.select-all-by-permission",defaultMessage:"Select all {label} permissions"},{label:a}),disabled:s,onValueChange:h=>l({target:{name:d,value:h}}),indeterminate:p,value:m})),e.createElement(ke,{title:a,alignItems:"center",isCollapsable:n,...n&&{onClick:c,"aria-expanded":o,onKeyDown:({key:h})=>(h==="Enter"||h===" ")&&c(),tabIndex:0,role:"button"}},e.createElement(i.Typography,{fontWeight:o?"bold":"",textColor:o?"primary600":"neutral800",ellipsis:!0},N()(a)),t))};Fe.defaultProps={children:null,checkboxName:"",onChange(){},value:!1,someChecked:!1,isCollapsable:!1},Fe.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};var Ke=(0,e.memo)(Fe),Rt=u(72091),Tt=u.n(Rt),St=u(85973),ce=u.n(St);const Ue=t=>ce()(t)?Tt()(Object.values(t).map(n=>ce()(n)?Ue(n):n)):[];var Ee=Ue,Le=t=>t?Object.keys(t).reduce((n,o)=>(o!=="conditions"&&(n[o]=t[o]),n),{}):null,ge=t=>{const n=Le(t),o=Ee(n);if(!o.length)return{hasAllActionsSelected:!1,hasSomeActionsSelected:!1};const s=o.every(l=>l),a=o.some(l=>l)&&!s;return{hasAllActionsSelected:s,hasSomeActionsSelected:a}},At=(t,n,o)=>t.map(({actionId:s,isDisplayed:a,applyToProperties:l,label:c})=>{if(!a)return{actionId:s,hasSomeActionsSelected:!1,isDisplayed:a};const d=[...o.split(".."),s],p=G()(l)?[...d,"properties","enabled"]:d,m=p.join(".."),g=E()(n,[...d,"conditions"],null),h=Ee(g).some(C=>C);if(G()(l)){const C=E()(n,p,!1);return{actionId:s,checkboxName:m,hasAllActionsSelected:C,hasConditions:h,hasSomeActionsSelected:C,isDisplayed:a,isParentCheckbox:!1,label:c,pathToConditionsObject:d}}const v=E()(n,p,null),{hasAllActionsSelected:O,hasSomeActionsSelected:x}=ge(v);return{actionId:s,checkboxName:m,hasAllActionsSelected:O,hasConditions:h,hasSomeActionsSelected:x,isDisplayed:a,isParentCheckbox:!0,label:c,pathToConditionsObject:d}}),Se=(0,b.default)(_.CarretDown)`
|
|
32
|
+
display: none;
|
|
33
|
+
width: ${10/16}rem;
|
|
34
|
+
transform: rotate(${({$isActive:t})=>t?"180":"0"}deg);
|
|
35
|
+
margin-left: ${({theme:t})=>t.spaces[2]};
|
|
36
|
+
`,Ae=t=>`
|
|
37
|
+
${i.Typography} {
|
|
38
|
+
color: ${t.colors.primary600};
|
|
39
|
+
font-weight: ${t.fontWeights.bold}
|
|
40
|
+
}
|
|
41
|
+
${Se} {
|
|
42
|
+
display: block;
|
|
43
|
+
path {
|
|
44
|
+
fill: ${t.colors.primary600}
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
`;const Be=(t,n)=>`
|
|
48
|
+
${Ze} {
|
|
49
|
+
background-color: ${t.colors.primary100};
|
|
50
|
+
color: ${t.colors.primary600};
|
|
51
|
+
border-radius: ${n?"2px 2px 0 0":"2px"};
|
|
52
|
+
}
|
|
53
|
+
${Ye} {
|
|
54
|
+
display: flex;
|
|
55
|
+
}
|
|
56
|
+
${de} {
|
|
57
|
+
display: block;
|
|
58
|
+
}
|
|
59
|
+
&:hover {
|
|
60
|
+
${Ae(t)}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
&:focus-within {
|
|
64
|
+
${({theme:o,isActive:s})=>Be(o,s)}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
`,Ze=b.default.div`
|
|
68
|
+
flex: 1;
|
|
69
|
+
display: flex;
|
|
70
|
+
align-items: center;
|
|
71
|
+
height: ${$};
|
|
72
|
+
background-color: ${({isGrey:t,theme:n})=>t?n.colors.neutral100:n.colors.neutral0};
|
|
73
|
+
border: 1px solid transparent;
|
|
74
|
+
`,Pt=b.default.div`
|
|
75
|
+
display: inline-flex;
|
|
76
|
+
min-width: 100%;
|
|
77
|
+
|
|
78
|
+
${de} {
|
|
79
|
+
display: none;
|
|
80
|
+
}
|
|
81
|
+
${({isActive:t,theme:n})=>t&&Be(n,t)}
|
|
82
|
+
&:hover {
|
|
83
|
+
${({theme:t,isActive:n})=>Be(t,n)}
|
|
84
|
+
}
|
|
85
|
+
`,Xe=(0,b.default)(i.Flex)`
|
|
86
|
+
width: ${ne};
|
|
87
|
+
position: relative;
|
|
88
|
+
`,Ye=(0,b.default)(i.Box)`
|
|
89
|
+
display: none;
|
|
90
|
+
svg {
|
|
91
|
+
width: 11px;
|
|
92
|
+
}
|
|
93
|
+
* {
|
|
94
|
+
fill: ${({theme:t})=>t.colors.primary600};
|
|
95
|
+
}
|
|
96
|
+
`,ze=b.default.span`
|
|
97
|
+
position: absolute;
|
|
98
|
+
top: -6px;
|
|
99
|
+
left: 37px;
|
|
100
|
+
width: 6px;
|
|
101
|
+
height: 6px;
|
|
102
|
+
border-radius: 20px;
|
|
103
|
+
background: ${({theme:t})=>t.colors.primary600};
|
|
104
|
+
`,$t=(0,b.default)(i.Box)`
|
|
105
|
+
position: absolute;
|
|
106
|
+
right: 9px;
|
|
107
|
+
transform: translateY(10px);
|
|
108
|
+
`,Je=({availableActions:t,isActive:n,isGrey:o,isFormDisabled:s,label:a,onClickToggle:l,pathToData:c})=>{const[d,p]=(0,e.useState)(!1),{formatMessage:m}=(0,F.useIntl)(),{modifiedData:g,onChangeParentCheckbox:h,onChangeSimpleCheckbox:v}=(0,ee.$_)(),O=()=>{p(M=>!M)},x=()=>{p(!1)},C=E()(g,c.split(".."),{}),f=(0,e.useMemo)(()=>Object.keys(C).reduce((M,j)=>(M[j]=$e()(C[j],"conditions"),M),{}),[C]),{hasAllActionsSelected:T,hasSomeActionsSelected:R}=ge(f),S=(0,e.useMemo)(()=>At(t,g,c),[t,g,c]),V=S.some(({hasConditions:M})=>M);return e.createElement(Pt,{isActive:n},e.createElement(Ze,{isGrey:o},e.createElement(Ke,{isCollapsable:!0,isFormDisabled:s,label:a,checkboxName:c,onChange:h,onClick:l,someChecked:R,value:T,isActive:n},e.createElement(Ye,{paddingLeft:2},n?e.createElement(_.ChevronUp,null):e.createElement(_.ChevronDown,null))),e.createElement(i.Flex,{style:{flex:1}},S.map(({actionId:M,hasConditions:j,hasAllActionsSelected:k,hasSomeActionsSelected:J,isDisplayed:ve,isParentCheckbox:H,checkboxName:ae,label:Pe})=>ve?H?e.createElement(Xe,{key:M,justifyContent:"center",alignItems:"center"},j&&e.createElement(ze,null),e.createElement(i.BaseCheckbox,{disabled:s,name:ae,"aria-label":m({id:"Settings.permissions.select-by-permission",defaultMessage:"Select {label} permission"},{label:`${Pe} ${a}`}),onValueChange:fe=>{h({target:{name:ae,value:fe}})},indeterminate:J,value:k})):e.createElement(Xe,{key:M,justifyContent:"center",alignItems:"center"},j&&e.createElement(ze,null),e.createElement(i.BaseCheckbox,{disabled:s,indeterminate:j,name:ae,onValueChange:fe=>{v({target:{name:ae,value:fe}})},value:k})):e.createElement(Y,{key:M}))),d&&e.createElement(be,{headerBreadCrumbs:[a,"Settings.permissions.conditions.conditions"],actions:S,isFormDisabled:s,onClosed:x,onToggle:O})),e.createElement($t,null,e.createElement(de,{onClick:O,hasConditions:V})))};Je.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};var Ot=Je,kt=(t,n)=>t.map(o=>{const s=Array.isArray(o.applyToProperties)&&o.applyToProperties.indexOf(n)!==-1&&o.isDisplayed;return{label:o.label,actionId:o.actionId,isActionRelatedToCurrentProperty:s}});const Qe=(0,b.default)(i.Flex)`
|
|
109
|
+
width: ${ne};
|
|
110
|
+
flex-shrink: 0;
|
|
111
|
+
`,Mt=(0,b.default)(i.Flex)`
|
|
112
|
+
width: ${se};
|
|
113
|
+
height: ${$};
|
|
114
|
+
flex-shrink: 0;
|
|
115
|
+
`,_e=({headers:t,label:n})=>{const{formatMessage:o}=(0,F.useIntl)(),s=o({id:"Settings.roles.form.permission.property-label",defaultMessage:"{label} permissions"},{label:n});return e.createElement(i.Flex,null,e.createElement(Mt,{alignItems:"center",paddingLeft:6},e.createElement(i.Typography,{variant:"sigma",textColor:"neutral500"},s)),t.map(a=>a.isActionRelatedToCurrentProperty?e.createElement(Qe,{justifyContent:"center",key:a.label},e.createElement(i.Typography,{variant:"sigma",textColor:"neutral500"},o({id:`Settings.roles.form.permissions.${a.label.toLowerCase()}`,defaultMessage:a.label}))):e.createElement(Qe,{key:a.label})))};_e.propTypes={headers:r().arrayOf(r().shape({label:r().string.isRequired,isActionRelatedToCurrentProperty:r().bool.isRequired})).isRequired,label:r().string.isRequired};var Ft=_e;const Lt=b.default.span`
|
|
116
|
+
color: ${({theme:t})=>t.colors.danger700};
|
|
117
|
+
padding-left: ${({theme:t})=>t.spaces[1]}px;
|
|
118
|
+
`;var et=()=>e.createElement(Lt,null,"*"),Bt=(t,n)=>t.map(o=>{const s=Array.isArray(o.subjects)&&o.subjects.indexOf(n)!==-1;return{...o,isDisplayed:s}});const It=(0,b.default)(i.Box)`
|
|
119
|
+
transform: translate(-4px, -12px);
|
|
120
|
+
|
|
121
|
+
&:before {
|
|
122
|
+
content: '';
|
|
123
|
+
width: ${4/16}rem;
|
|
124
|
+
height: ${12/16}rem;
|
|
125
|
+
background: ${({theme:t})=>t.colors.primary200};
|
|
126
|
+
display: block;
|
|
127
|
+
}
|
|
128
|
+
`,Dt=b.default.svg`
|
|
129
|
+
position: relative;
|
|
130
|
+
flex-shrink: 0;
|
|
131
|
+
transform: translate(-0.5px, -1px);
|
|
132
|
+
|
|
133
|
+
* {
|
|
134
|
+
fill: ${({theme:t,color:n})=>t.colors[n]};
|
|
135
|
+
}
|
|
136
|
+
`,Ie=t=>e.createElement(It,null,e.createElement(Dt,{width:"20",height:"23",viewBox:"0 0 20 23",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},e.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7.02477 14.7513C8.65865 17.0594 11.6046 18.6059 17.5596 18.8856C18.6836 18.9384 19.5976 19.8435 19.5976 20.9688V20.9688C19.5976 22.0941 18.6841 23.0125 17.5599 22.9643C10.9409 22.6805 6.454 20.9387 3.75496 17.1258C0.937988 13.1464 0.486328 7.39309 0.486328 0.593262H4.50974C4.50974 7.54693 5.06394 11.9813 7.02477 14.7513Z",fill:"#D9D8FF"})));Ie.defaultProps={fill:"primary200"},Ie.propTypes={fill:r().string};var jt=(0,e.memo)(Ie);const tt=(0,b.default)(i.Flex)`
|
|
137
|
+
width: ${ne};
|
|
138
|
+
position: relative;
|
|
139
|
+
`,Nt=(0,b.default)(i.Flex)`
|
|
140
|
+
height: ${$};
|
|
141
|
+
`,qt=(0,b.default)(i.Box)`
|
|
142
|
+
padding-left: ${31/16}rem;
|
|
143
|
+
`,wt=(0,b.default)(i.Box)`
|
|
144
|
+
border-left: ${({isVisible:t,theme:n})=>t?`4px solid ${n.colors.primary200}`:"4px solid transparent"};
|
|
145
|
+
`,Vt=(0,b.default)(i.Flex)`
|
|
146
|
+
padding-left: ${({theme:t})=>t.spaces[4]};
|
|
147
|
+
width: ${({level:t})=>145-t*36}px;
|
|
148
|
+
|
|
149
|
+
${({isCollapsable:t,theme:n})=>t&&`
|
|
150
|
+
${Se} {
|
|
151
|
+
display: block;
|
|
152
|
+
color: ${n.colors.neutral100};
|
|
153
|
+
}
|
|
154
|
+
&:hover {
|
|
155
|
+
${Ae(n)}
|
|
156
|
+
}
|
|
157
|
+
`}
|
|
158
|
+
${({isActive:t,theme:n})=>t&&Ae(n)};
|
|
159
|
+
`,Gt=b.default.div`
|
|
160
|
+
padding-top: ${({theme:t})=>t.spaces[2]};
|
|
161
|
+
margin-top: ${({theme:t})=>t.spaces[2]};
|
|
162
|
+
width: ${4/16}rem;
|
|
163
|
+
background-color: ${({theme:t})=>t.colors.primary200};
|
|
164
|
+
border-top-left-radius: 2px;
|
|
165
|
+
border-top-right-radius: 2px;
|
|
166
|
+
`,De=({childrenForm:t,isFormDisabled:n,recursiveLevel:o,pathToDataFromActionRow:s,propertyActions:a,parentName:l,propertyName:c})=>{const{formatMessage:d}=(0,F.useIntl)(),{modifiedData:p,onChangeParentCheckbox:m,onChangeSimpleCheckbox:g}=(0,ee.$_)(),[h,v]=(0,e.useState)(null),O=C=>{v(f=>f===C?null:C)},x=(0,e.useMemo)(()=>h?t.find(({value:C})=>C===h):null,[h,t]);return e.createElement(qt,null,e.createElement(Gt,null),t.map(({label:C,value:f,required:T,children:R},S)=>{const V=S+1<t.length,M=Array.isArray(R),j=h===f;return e.createElement(wt,{key:f,isVisible:V},e.createElement(Nt,null,e.createElement(jt,{color:"primary200"}),e.createElement(i.Flex,{style:{flex:1}},e.createElement(Vt,{level:o,isActive:j,isCollapsable:M},e.createElement(ke,{alignItems:"center",isCollapsable:M,...M&&{onClick:()=>O(f),"aria-expanded":j,onKeyDown:({key:k})=>(k==="Enter"||k===" ")&&O(f),tabIndex:0,role:"button"},title:C},e.createElement(i.Typography,{ellipsis:!0},N()(C)),T&&e.createElement(et,null),e.createElement(Se,{$isActive:j}))),e.createElement(i.Flex,{style:{flex:1}},a.map(({actionId:k,label:J,isActionRelatedToCurrentProperty:ve})=>{if(!ve)return e.createElement(Y,{key:k});const H=[...s.split(".."),k,"properties",c,...l.split(".."),f],ae=E()(p,H,!1);if(!R)return e.createElement(tt,{key:J,justifyContent:"center",alignItems:"center"},e.createElement(i.BaseCheckbox,{disabled:n,name:H.join(".."),"aria-label":d({id:"Settings.permissions.select-by-permission",defaultMessage:"Select {label} permission"},{label:`${l} ${C} ${J}`}),onValueChange:ye=>{g({target:{name:H.join(".."),value:ye}})},value:ae}));const{hasAllActionsSelected:Pe,hasSomeActionsSelected:fe}=ge(ae);return e.createElement(tt,{key:J,justifyContent:"center",alignItems:"center"},e.createElement(i.BaseCheckbox,{key:J,disabled:n,name:H.join(".."),"aria-label":d({id:"Settings.permissions.select-by-permission",defaultMessage:"Select {label} permission"},{label:`${l} ${C} ${J}`}),onValueChange:ye=>{m({target:{name:H.join(".."),value:ye}})},value:Pe,indeterminate:fe}))})))),x&&j&&e.createElement(i.Box,{paddingBottom:2},e.createElement(De,{isFormDisabled:n,parentName:`${l}..${f}`,pathToDataFromActionRow:s,propertyActions:a,propertyName:c,recursiveLevel:o+1,childrenForm:x.children})))}))};De.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};var Ht=(0,e.memo)(De);const Wt=t=>t.reduce((o,s)=>(s.isActionRelatedToCurrentProperty&&o.push(s.actionId),o),[]);var Kt=(t,n,o,s,a)=>{const c=Wt(t).reduce((d,p)=>{const m=[...o.split(".."),p,"properties",s,a],g=E()(n,m,!1);return d[p]=g,d},{});return ge(c)};const nt=(0,b.default)(i.Flex)`
|
|
167
|
+
width: ${ne};
|
|
168
|
+
position: relative;
|
|
169
|
+
`,Ut=(0,b.default)(i.Flex)`
|
|
170
|
+
height: ${$};
|
|
171
|
+
flex: 1;
|
|
172
|
+
|
|
173
|
+
${({isCollapsable:t,theme:n})=>t&&`
|
|
174
|
+
${Se} {
|
|
175
|
+
display: block;
|
|
176
|
+
color: ${n.colors.neutral100};
|
|
177
|
+
}
|
|
178
|
+
&:hover {
|
|
179
|
+
${Ae(n)}
|
|
180
|
+
}
|
|
181
|
+
`}
|
|
182
|
+
${({isActive:t,theme:n})=>t&&Ae(n)};
|
|
183
|
+
`,je=({childrenForm:t,label:n,isFormDisabled:o,name:s,required:a,pathToData:l,propertyActions:c,propertyName:d,isOdd:p})=>{const{formatMessage:m}=(0,F.useIntl)(),[g,h]=(0,e.useState)(null),{modifiedData:v,onChangeCollectionTypeLeftActionRowCheckbox:O,onChangeParentCheckbox:x,onChangeSimpleCheckbox:C}=(0,ee.$_)(),f=g===s,T=(0,e.useMemo)(()=>Array.isArray(t)?t:[],[t]),R=T.length>0,S=(0,e.useCallback)(()=>{R&&h(k=>k===s?null:s)},[R,s]),V=({target:{value:k}})=>{O(l,d,s,k)},{hasAllActionsSelected:M,hasSomeActionsSelected:j}=(0,e.useMemo)(()=>Kt(c,v,l,d,s),[c,v,l,d,s]);return e.createElement(e.Fragment,null,e.createElement(Ut,{alignItems:"center",isCollapsable:R,isActive:f,background:p?"neutral100":"neutral0"},e.createElement(i.Flex,null,e.createElement(Ke,{onChange:V,onClick:S,isCollapsable:R,isFormDisabled:o,label:n,someChecked:j,value:M,isActive:f},a&&e.createElement(et,null),e.createElement(Se,{$isActive:f})),e.createElement(i.Flex,null,c.map(({label:k,isActionRelatedToCurrentProperty:J,actionId:ve})=>{if(!J)return e.createElement(Y,{key:k});const H=[...l.split(".."),ve,"properties",d,s];if(!R){const ye=E()(v,H,!1);return e.createElement(nt,{key:ve,justifyContent:"center",alignItems:"center"},e.createElement(i.BaseCheckbox,{disabled:o,name:H.join(".."),"aria-label":m({id:"Settings.permissions.select-by-permission",defaultMessage:"Select {label} permission"},{label:`${s} ${k}`}),onValueChange:Bn=>{C({target:{name:H.join(".."),value:Bn}})},value:ye}))}const ae=E()(v,H,{}),{hasAllActionsSelected:Pe,hasSomeActionsSelected:fe}=ge(ae);return e.createElement(nt,{key:k,justifyContent:"center",alignItems:"center"},e.createElement(i.BaseCheckbox,{disabled:o,name:H.join(".."),onValueChange:ye=>{x({target:{name:H.join(".."),value:ye}})},"aria-label":m({id:"Settings.permissions.select-by-permission",defaultMessage:"Select {label} permission"},{label:`${s} ${k}`}),value:Pe,indeterminate:fe}))})))),f&&e.createElement(Ht,{childrenForm:T,isFormDisabled:o,parentName:s,pathToDataFromActionRow:l,propertyName:d,propertyActions:c,recursiveLevel:0}))};je.defaultProps={childrenForm:[],required:!1},je.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};var Zt=(0,e.memo)(je);const Xt=b.default.div`
|
|
184
|
+
display: inline-flex;
|
|
185
|
+
flex-direction: column;
|
|
186
|
+
min-width: 0;
|
|
187
|
+
`,st=({availableActions:t,childrenForm:n,isFormDisabled:o,label:s,pathToData:a,propertyName:l})=>{const c=(0,e.useMemo)(()=>kt(t,l),[t,l]);return e.createElement(Xt,null,e.createElement(Ft,{label:s,headers:c}),e.createElement(i.Box,null,n.map(({children:d,label:p,value:m,required:g},h)=>e.createElement(Zt,{childrenForm:d,key:m,label:p,isFormDisabled:o,name:m,required:g,propertyActions:c,pathToData:a,propertyName:l,isOdd:h%2===0}))))};st.propTypes={childrenForm:r().array.isRequired,availableActions:r().array.isRequired,isFormDisabled:r().bool.isRequired,label:r().string.isRequired,pathToData:r().string.isRequired,propertyName:r().string.isRequired};var Yt=st;const zt=b.default.div`
|
|
188
|
+
flex-direction: column;
|
|
189
|
+
display: inline-flex;
|
|
190
|
+
min-width: 100%;
|
|
191
|
+
${({theme:t,isActive:n})=>n&&`border: 1px solid ${t.colors.primary600};`}
|
|
192
|
+
`,ot=({allActions:t,contentTypeName:n,label:o,index:s,isActive:a,isFormDisabled:l,onClickToggleCollapse:c,pathToData:d,properties:p})=>{const m=(0,e.useCallback)(()=>{c(n)},[n,c]),g=(0,e.useMemo)(()=>Bt(t,n),[t,n]);return e.createElement(zt,{isActive:a},e.createElement(Ot,{availableActions:g,isActive:a,isGrey:s%2===0,isFormDisabled:l,label:o,onClickToggle:m,pathToData:d}),a&&p.map(({label:h,value:v,children:O})=>e.createElement(Yt,{availableActions:g,childrenForm:O,isFormDisabled:l,label:h,pathToData:d,propertyName:v,key:v})))};ot.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};var Jt=ot;const Ne=({actions:t,isFormDisabled:n,pathToData:o,subjects:s})=>{const[a,l]=(0,e.useState)(null),c=d=>{l(a===d?null:d)};return s.map(({uid:d,label:p,properties:m},g)=>e.createElement(Jt,{allActions:t,key:d,contentTypeName:d,label:p,isActive:a===d,isFormDisabled:n,index:g,onClickToggleCollapse:c,pathToData:`${o}..${d}`,properties:m}))};Ne.defaultProps={actions:[],subjects:[]},Ne.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}))};var Qt=(0,e.memo)(Ne),_t=t=>t.filter(({subjects:n})=>n&&n.length);const en=t=>t.map(({actionId:n})=>n),tn=(t,n)=>t.reduce((o,s)=>(Object.keys(n).forEach(a=>{const l=E()(n,[a,s],{}),c={[a]:Le(l)};o[s]?o[s]={...o[s],...c}:o[s]=c}),o),{});var nn=(t,n)=>{const o=en(t),s=tn(o,n);return Object.keys(s).reduce((l,c)=>(l[c]=ge(s[c]),l),{})};const sn=(0,b.default)(i.Flex)`
|
|
193
|
+
width: ${ne};
|
|
194
|
+
flex-shrink: 0;
|
|
195
|
+
`,qe=({actions:t,isFormDisabled:n,kind:o})=>{const{formatMessage:s}=(0,F.useIntl)(),{modifiedData:a,onChangeCollectionTypeGlobalActionCheckbox:l}=(0,ee.$_)(),c=(0,e.useMemo)(()=>_t(t),[t]),d=(0,e.useMemo)(()=>nn(c,a[o]),[a,c,o]);return e.createElement(i.Box,{paddingBottom:4,paddingTop:6,style:{paddingLeft:se}},e.createElement(i.Flex,{gap:0},c.map(({label:p,actionId:m})=>e.createElement(sn,{direction:"column",alignItems:"center",justifyContent:"center",key:m,gap:3},e.createElement(i.Typography,{variant:"sigma",textColor:"neutral500"},s({id:`Settings.roles.form.permissions.${p.toLowerCase()}`,defaultMessage:p})),e.createElement(i.BaseCheckbox,{disabled:n,onValueChange:g=>{l(o,m,g)},name:m,"aria-label":s({id:"Settings.permissions.select-all-by-permission",defaultMessage:"Select all {label} permissions"},{label:s({id:`Settings.roles.form.permissions.${p.toLowerCase()}`,defaultMessage:p})}),value:E()(d,[m,"hasAllActionsSelected"],!1),indeterminate:E()(d,[m,"hasSomeActionsSelected"],!1)})))))};qe.defaultProps={actions:[]},qe.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};var on=(0,e.memo)(qe);const rn=(0,b.default)(i.Box)`
|
|
196
|
+
overflow-x: auto;
|
|
197
|
+
`,rt=({isFormDisabled:t,kind:n,layout:{actions:o,subjects:s}})=>{const a=Q()([...s],"label");return e.createElement(rn,{background:"neutral0"},e.createElement(on,{actions:o,kind:n,isFormDisabled:t}),e.createElement(Qt,{actions:o,isFormDisabled:t,pathToData:n,subjects:a}))};rt.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};var at=(0,e.memo)(rt),an=u(66694);const it=({children:t,value:n})=>e.createElement(an.$l.Provider,{value:n},t);it.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};var ln=it,cn=(t,n,o)=>t.map(s=>{const a=[...o,s.action,"properties","enabled"],l=E()(n,a,!1),c=E()(n,[...o,s.action,"conditions"],{}),d=Ee(c).some(p=>p);return{...s,isDisplayed:l,checkboxName:a.join(".."),hasSomeActionsSelected:l,value:l,hasConditions:d,label:s.displayName,actionId:s.action,pathToConditionsObject:[...o,s.action]}}),dn=t=>{const n=Object.entries(t).reduce((s,a)=>{const[l,{conditions:c}]=a;return s[l]=c,s},{});return Ee(n).some(s=>s)};const un=b.default.div`
|
|
198
|
+
flex: 1;
|
|
199
|
+
align-self: center;
|
|
200
|
+
border-top: 1px solid ${({theme:t})=>t.colors.neutral150};
|
|
201
|
+
`,mn=b.default.div`
|
|
202
|
+
position: relative;
|
|
203
|
+
word-break: keep-all;
|
|
204
|
+
${({hasConditions:t,disabled:n,theme:o})=>t&&`
|
|
205
|
+
&:before {
|
|
206
|
+
content: '';
|
|
207
|
+
position: absolute;
|
|
208
|
+
top: ${-4/16}rem;
|
|
209
|
+
left: ${-8/16}rem;
|
|
210
|
+
width: ${6/16}rem;
|
|
211
|
+
height: ${6/16}rem;
|
|
212
|
+
border-radius: ${20/16}rem;
|
|
213
|
+
background: ${n?o.colors.neutral100:o.colors.primary600};
|
|
214
|
+
}
|
|
215
|
+
`}
|
|
216
|
+
`,lt=({categoryName:t,isFormDisabled:n,subCategoryName:o,actions:s,pathToData:a})=>{const[l,c]=(0,e.useState)(!1),{modifiedData:d,onChangeParentCheckbox:p,onChangeSimpleCheckbox:m}=(0,ee.$_)(),{formatMessage:g}=(0,F.useIntl)(),h=E()(d,a,{}),v=(0,e.useMemo)(()=>Object.keys(h).reduce((S,V)=>(S[V]=Le(h[V]),S),{}),[h]),{hasAllActionsSelected:O,hasSomeActionsSelected:x}=ge(v),C=()=>{c(S=>!S)},f=()=>{c(!1)},T=cn(s,d,a),R=dn(E()(d,[...a],{}));return e.createElement(e.Fragment,null,e.createElement(i.Box,null,e.createElement(i.Flex,{justifyContent:"space-between",alignItems:"center"},e.createElement(i.Box,{paddingRight:4},e.createElement(i.Typography,{variant:"sigma",textColor:"neutral600"},o)),e.createElement(un,null),e.createElement(i.Box,{paddingLeft:4},e.createElement(i.Checkbox,{name:a.join(".."),disabled:n,onValueChange:S=>{p({target:{name:a.join(".."),value:S}})},indeterminate:x,value:O},g({id:"app.utils.select-all",defaultMessage:"Select all"})))),e.createElement(i.Flex,{paddingTop:6,paddingBottom:6},e.createElement(i.Grid,{gap:2,style:{flex:1}},T.map(({checkboxName:S,value:V,action:M,displayName:j,hasConditions:k})=>e.createElement(i.GridItem,{col:3,key:M},e.createElement(mn,{disabled:n,hasConditions:k},e.createElement(i.Checkbox,{name:S,disabled:n,onValueChange:J=>{m({target:{name:S,value:J}})},value:V},j))))),e.createElement(de,{hasConditions:R,onClick:C}))),l&&e.createElement(be,{headerBreadCrumbs:[t,o],actions:T,isFormDisabled:n,onClosed:f,onToggle:C}))};lt.propTypes={actions:r().array.isRequired,categoryName:r().string.isRequired,isFormDisabled:r().bool.isRequired,subCategoryName:r().string.isRequired,pathToData:r().array.isRequired};var pn=lt;const we=({childrenForm:t,kind:n,name:o,isOpen:s,isFormDisabled:a,isWhite:l,onOpenCategory:c,pathToData:d})=>{const{formatMessage:p}=(0,F.useIntl)(),m=()=>{c(o)},g=(0,e.useMemo)(()=>o.split("::").pop(),[o]);return e.createElement(i.Accordion,{expanded:s,onToggle:m,id:`accordion-${o}`,variant:l?"primary":"secondary"},e.createElement(i.AccordionToggle,{title:N()(g),description:`${p({id:"Settings.permissions.category"},{category:g})} ${n==="plugins"?"plugin":n}`}),e.createElement(i.AccordionContent,null,e.createElement(i.Box,{padding:6},t.map(({actions:h,subCategoryName:v,subCategoryId:O})=>e.createElement(pn,{key:v,actions:h,categoryName:g,isFormDisabled:a,subCategoryName:v,pathToData:[...d,O]})))))};we.defaultProps={},we.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};var gn=we;const ct=({isFormDisabled:t,kind:n,layout:o})=>{const[s,a]=(0,e.useState)(null),l=c=>{a(c===s?null:c)};return e.createElement(i.Box,{padding:6,background:"neutral0"},o.map(({category:c,categoryId:d,childrenForm:p},m)=>e.createElement(gn,{key:c,childrenForm:p,kind:n,isFormDisabled:t,isOpen:s===c,isWhite:m%2===1,name:c,onOpenCategory:l,pathToData:[n,d]})))};ct.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};var dt=ct,fn=u(86349),yn=u.n(fn),hn=u(3040),z=u.n(hn),ut=(t,n,o)=>t.find(s=>s.action===n&&s.subject===o);const mt=(t,n=[])=>t.reduce((o,s)=>(o[s.id]=n.indexOf(s.id)!==-1,o),{}),pt=({children:t},n,o="")=>t.reduce((s,a)=>{if(a.children)return{...s,[a.value]:pt(a,n,`${o}${a.value}.`)};const l=n.indexOf(`${o}${a.value}`)!==-1;return s[a.value]=l,s},{}),Cn=(t,n,o)=>t.reduce((s,a)=>{const l=n.properties.find(({value:c})=>c===a);if(l){const c=E()(o,["properties",l.value],[]),d=pt(l,c);s.properties[a]=d}return s},{properties:{}}),bn=(t,n)=>n.reduce((o,s)=>{const a=t.find(({uid:l})=>l===s)||null;return a&&(o[s]=a),o},{});var gt=({subjects:t},n,o,s=[])=>n.reduce((a,l)=>{const c=l.subjects,d=bn(t,c);if(G()(d))return a;const p=Object.keys(d).reduce((m,g)=>{const{actionId:h,applyToProperties:v}=l,C=d[g].properties.map(({value:S})=>S).every(S=>(v||[]).indexOf(S)===-1),f=ut(s,h,g),T=mt(o,E()(f,"conditions",[]));if(G()(v)||C)return z()(m,[g,h],{properties:{enabled:f!==void 0},conditions:T}),m;const R=Cn(v,d[g],f);return z()(m,[g,h],{...R,conditions:T}),m},{});return yn()(a,p)},{});const En=(t,n,o)=>t.reduce((s,a)=>{const l=ut(o,a.action,null);return s[a.action]={properties:{enabled:l!==void 0},conditions:mt(n,l?.conditions??[])},s},{}),vn=(t,n,o)=>t.reduce((s,a)=>(s[a.subCategoryId]=En(a.actions,n,o),s),{});var ft=(t,n,o=[])=>t.reduce((s,{categoryId:a,childrenForm:l})=>{const c=vn(l,n,o);return s[a]=c,s},{});const yt=t=>t.split(" ").join("-");var ht=(t,n)=>Object.entries(B()(t,n)).map(([o,s])=>({category:o,categoryId:yt(o),childrenForm:Object.entries(B()(s,"subCategory")).map(([a,l])=>({subCategoryName:a,subCategoryId:yt(a),actions:l}))})),xn=(t,n)=>{const{conditions:o,sections:{collectionTypes:s,singleTypes:a,plugins:l,settings:c}}=t,d={collectionTypes:s,singleTypes:a,plugins:ht(l,"plugin"),settings:ht(c,"category")},p={collectionTypes:gt(s,s.actions||[],o,n),singleTypes:gt(a,a.actions||[],o,n),plugins:ft(d.plugins,o,n),settings:ft(d.settings,o,n)};return{initialData:p,modifiedData:p,layouts:d}},Rn=u(99381),Ve=u.n(Rn);const Ct=t=>Object.keys(t).reduce((n,o)=>{const s=t[o];if(ce()(s)&&!D()(s,"conditions"))return{...n,[o]:Ct(s)};if(ce()(s)&&D()(s,"conditions")&&!Ee($e()(s,"conditions")).some(l=>l)){const l=Object.keys(s.conditions).reduce((c,d)=>(c[d]=!1,c),{});return{...n,[o]:{...s,conditions:l}}}return n[o]=s,n},{});var Ge=Ct;const bt=(t,n)=>Object.keys(t).reduce((o,s)=>{const a=t[s];return s==="conditions"?(o[s]=a,o):ce()(a)?{...o,[s]:bt(a,n)}:(o[s]=n,o)},{});var Me=bt;const Tn={initialData:{},modifiedData:{},layouts:{}};var Sn=(t,n)=>(0,L.default)(t,o=>{switch(n.type){case"ON_CHANGE_COLLECTION_TYPE_GLOBAL_ACTION_CHECKBOX":{const{collectionTypeKind:s,actionId:a,value:l}=n,c=["modifiedData",s];Object.keys(E()(t,c)).forEach(d=>{const p=E()(t,[...c,d,a],void 0);if(p){let m=Me(p,l);if(!l&&m.conditions){const g=Me(m.conditions,!1);m={...m,conditions:g}}z()(o,[...c,d,a],m)}});break}case"ON_CHANGE_COLLECTION_TYPE_ROW_LEFT_CHECKBOX":{const{pathToCollectionType:s,propertyName:a,rowName:l,value:c}=n;let d=Ve()(t.modifiedData);const p=s.split(".."),m=E()(d,p,{});Object.keys(m).forEach(g=>{if(D()(m[g],`properties.${a}`)){const h=E()(m,[g,"properties",a,l]),v=[...p,g,"properties",a,l];if(!ce()(h))z()(d,v,c);else{const O=Me(h,c);z()(d,v,O)}}}),c||(d=Ge(d)),z()(o,"modifiedData",d);break}case"ON_CHANGE_CONDITIONS":{Object.entries(n.conditions).forEach(s=>{const[a,l]=s;z()(o,["modifiedData",...a.split(".."),"conditions"],l)});break}case"ON_CHANGE_SIMPLE_CHECKBOX":{let s=Ve()(t.modifiedData);z()(s,[...n.keys.split("..")],n.value),n.value||(s=Ge(s)),z()(o,"modifiedData",s);break}case"ON_CHANGE_TOGGLE_PARENT_CHECKBOX":{const{keys:s,value:a}=n,l=[...s.split("..")];let c=Ve()(t.modifiedData);const d=E()(c,l,{}),p=Me(d,a);z()(c,l,p),a||(c=Ge(c)),z()(o,["modifiedData"],c);break}case"RESET_FORM":{o.modifiedData=t.initialData;break}case"SET_FORM_AFTER_SUBMIT":{o.initialData=t.modifiedData;break}default:return o}});const He=t=>Object.entries(t).filter(([,n])=>n).map(([n])=>n),An=t=>{const[n,{conditions:o}]=t;return{action:n,subject:null,conditions:He(o),properties:{}}},Pn=t=>Object.values(t).reduce((n,o)=>{const s=Object.entries(o).reduce((a,l)=>{const[,{properties:{enabled:c}}]=l;if(!c)return a;const d=An(l);return a.push(d),a},[]);return[...n,...s]},[]);var Et=t=>Object.values(t).reduce((n,o)=>{const s=Pn(o);return[...n,...s]},[]);const vt=(t,n="")=>Object.entries(t).reduce((o,s)=>{const[a,l]=s;return ce()(l)?[...o,...vt(l,`${n}${a}.`)]:(l&&!ce()(l)&&o.push(`${n}${a}`),o)},[]),$n=(t,n,{conditions:o,properties:s})=>Object.entries(s).reduce((a,l)=>{const[c,d]=l;return a.properties[c]=vt(d),a},{action:t,subject:n,conditions:He(o),properties:{}}),On=(t,n,{conditions:o})=>({action:t,subject:n,properties:{},conditions:He(o)}),kn=(t,n)=>Object.entries(n).reduce((s,a)=>{const[l,c]=a;if(!Ee(c).some(m=>m))return s;if(!c?.properties?.enabled){const m=$n(l,t,c);return[...s,m]}if(!c.properties.enabled)return s;const p=On(l,t,c);return s.push(p),s},[]);var xt=t=>Object.entries(t).reduce((o,s)=>{const[a,l]=s,c=kn(a,l);return[...o,...c]},[]),Mn=t=>{const n=Et(t.plugins),o=Et(t.settings),s=xt(t.collectionTypes),a=xt(t.singleTypes);return[...n,...o,...s,...a]},Fn=[{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"}];const We=(0,e.forwardRef)(({layout:t,isFormDisabled:n,permissions:o},s)=>{const[{initialData:a,layouts:l,modifiedData:c},d]=(0,e.useReducer)(Sn,Tn,()=>xn(t,o)),{formatMessage:p}=(0,F.useIntl)();(0,e.useImperativeHandle)(s,()=>({getPermissions(){const x=(0,y.difference)(a.collectionTypes,c.collectionTypes),C=(0,y.difference)(a.singleTypes,c.singleTypes),f={...x,...C};let T;return G()(f)?T=!1:T=Object.values(f).some(R=>Object.values(R).some(S=>D()(S,"conditions"))),{permissionsToSend:Mn(c),didUpdateConditions:T}},resetForm(){d({type:"RESET_FORM"})},setFormAfterSubmit(){d({type:"SET_FORM_AFTER_SUBMIT"})}}));const m=(x,C,f,T)=>{d({type:"ON_CHANGE_COLLECTION_TYPE_ROW_LEFT_CHECKBOX",pathToCollectionType:x,propertyName:C,rowName:f,value:T})},g=(x,C,f)=>{d({type:"ON_CHANGE_COLLECTION_TYPE_GLOBAL_ACTION_CHECKBOX",collectionTypeKind:x,actionId:C,value:f})},h=x=>{d({type:"ON_CHANGE_CONDITIONS",conditions:x})},v=(0,e.useCallback)(({target:{name:x,value:C}})=>{d({type:"ON_CHANGE_SIMPLE_CHECKBOX",keys:x,value:C})},[]),O=(0,e.useCallback)(({target:{name:x,value:C}})=>{d({type:"ON_CHANGE_TOGGLE_PARENT_CHECKBOX",keys:x,value:C})},[]);return e.createElement(ln,{value:{availableConditions:t.conditions,modifiedData:c,onChangeConditions:h,onChangeSimpleCheckbox:v,onChangeParentCheckbox:O,onChangeCollectionTypeLeftActionRowCheckbox:m,onChangeCollectionTypeGlobalActionCheckbox:g}},e.createElement(i.TabGroup,{id:"tabs",label:p({id:"Settings.permissions.users.tabs.label",defaultMessage:"Tabs Permissions"})},e.createElement(i.Tabs,null,Fn.map(x=>e.createElement(i.Tab,{key:x.id},p({id:x.labelId,defaultMessage:x.defaultMessage})))),e.createElement(i.TabPanels,{style:{position:"relative"}},e.createElement(i.TabPanel,null,e.createElement(at,{layout:l.collectionTypes,kind:"collectionTypes",isFormDisabled:n})),e.createElement(i.TabPanel,null,e.createElement(at,{layout:l.singleTypes,kind:"singleTypes",isFormDisabled:n})),e.createElement(i.TabPanel,null,e.createElement(dt,{layout:l.plugins,kind:"plugins",isFormDisabled:n})),e.createElement(i.TabPanel,null,e.createElement(dt,{layout:l.settings,kind:"settings",isFormDisabled:n})))))});We.defaultProps={permissions:[],layout:{conditions:[],sections:{collectionTypes:{},singleTypes:{actions:[]},settings:[],plugins:[]}}},We.propTypes={layout:r().object,isFormDisabled:r().bool.isRequired,permissions:r().array};var Ln=(0,e.memo)(We)},33778:function(U,W,u){"use strict";u.r(W),u.d(W,{default:function(){return L}});var e=u(32735),A=u(13478),r=u(5141),y=u(72041),i=u(39161),I=u(83281),D=u(57269),K=u(33795),G=u.n(K),F=u(5636),b=u(7247),he=u(60216),Q=u.n(he);const _=({disabled:Z,role:B,values:P,errors:N,onChange:X,onBlur:te})=>{const{formatMessage:w}=(0,F.useIntl)();return e.createElement(i.Box,{background:"neutral0",padding:6,shadow:"filterShadow",hasRadius:!0},e.createElement(i.Flex,{direction:"column",alignItems:"stretch",gap:4},e.createElement(i.Flex,{justifyContent:"space-between"},e.createElement(i.Box,null,e.createElement(i.Box,null,e.createElement(i.Typography,{fontWeight:"bold"},B?B.name:w({id:"global.details",defaultMessage:"Details"}))),e.createElement(i.Box,null,e.createElement(i.Typography,{textColor:"neutral500",variant:"pi"},B?B.description:w({id:"Settings.roles.form.description",defaultMessage:"Name and description of the role"})))),e.createElement(i.Button,{disabled:!0,variant:"secondary"},w({id:"Settings.roles.form.button.users-with-role",defaultMessage:"{number, plural, =0 {# users} one {# user} other {# users}} with this role"},{number:B.usersCount}))),e.createElement(i.Grid,{gap:4},e.createElement(i.GridItem,{col:6},e.createElement(i.TextInput,{disabled:Z,name:"name",error:N.name&&w({id:N.name}),label:w({id:"global.name",defaultMessage:"Name"}),onChange:X,onBlur:te,value:P.name||""})),e.createElement(i.GridItem,{col:6},e.createElement(i.Textarea,{disabled:Z,label:w({id:"global.description",defaultMessage:"Description"}),name:"description",error:N.name&&w({id:N.name}),onChange:X,onBlur:te},P.description||"")))))};_.defaultProps={disabled:!1,role:null,values:{name:"",description:""}},_.propTypes={disabled:Q().bool,errors:Q().object.isRequired,onBlur:Q().func.isRequired,onChange:Q().func.isRequired,role:Q().object,values:Q().object};var Ce=_,E=u(8888),ie=u(5173),ee=ie.Ry().shape({name:ie.Z_().required(A.translatedErrors.required)}),le=()=>{const Z=(0,A.useNotification)(),{formatMessage:B}=(0,F.useIntl)(),{params:{id:P}}=(0,r.useRouteMatch)("/settings/roles/:id"),[N,X]=(0,e.useState)(!1),te=(0,e.useRef)(),{lockApp:w,unlockApp:oe}=(0,A.useOverlayBlocker)(),{trackUsage:xe}=(0,A.useTracking)(),{isLoading:ue,data:Re}=(0,E.U_)(P),{role:re,permissions:Te,isLoading:me,onSubmitSucceeded:be}=(0,E.Dq)(P),ne=async $=>{try{w(),X(!0);const{permissionsToSend:q,didUpdateConditions:Y}=te.current.getPermissions();await(0,A.request)(`/admin/roles/${P}`,{method:"PUT",body:$}),re.code!=="strapi-super-admin"&&(await(0,A.request)(`/admin/roles/${P}/permissions`,{method:"PUT",body:{permissions:q}}),Y&&xe("didUpdateConditions")),te.current.setFormAfterSubmit(),be({name:$.name,description:$.description}),Z({type:"success",message:{id:"notification.success.saved"}})}catch(q){console.error(q.response);const Y=G()(q,"response.payload.message","An error occured"),pe=G()(q,"response.payload.data.permissions[0]",Y);Z({type:"warning",message:pe})}finally{X(!1),oe()}},se=re.code==="strapi-super-admin";return e.createElement(i.Main,null,e.createElement(A.SettingsPageTitle,{name:"Roles"}),e.createElement(I.Formik,{enableReinitialize:!0,initialValues:{name:re.name,description:re.description},onSubmit:ne,validationSchema:ee,validateOnChange:!1},({handleSubmit:$,values:q,errors:Y,handleChange:pe,handleBlur:ke})=>e.createElement("form",{onSubmit:$},e.createElement(i.HeaderLayout,{primaryAction:e.createElement(i.Flex,{gap:2},e.createElement(i.Button,{disabled:re.code==="strapi-super-admin",onClick:$,loading:N,size:"L"},B({id:"global.save",defaultMessage:"Save"}))),title:B({id:"Settings.roles.edit.title",defaultMessage:"Edit a role"}),subtitle:B({id:"Settings.roles.create.description",defaultMessage:"Define the rights given to the role"}),navigationAction:e.createElement(A.Link,{startIcon:e.createElement(D.ArrowLeft,null),to:"/settings/roles"},B({id:"global.back",defaultMessage:"Back"}))}),e.createElement(i.ContentLayout,null,e.createElement(i.Flex,{direction:"column",alignItems:"stretch",gap:6},e.createElement(Ce,{isLoading:me,disabled:se,errors:Y,values:q,onChange:pe,onBlur:ke,role:re}),!ue&&!me?e.createElement(i.Box,{shadow:"filterShadow",hasRadius:!0},e.createElement(b.Z,{isFormDisabled:se,permissions:Te,ref:te,layout:Re})):e.createElement(i.Box,{background:"neutral0",padding:6,shadow:"filterShadow",hasRadius:!0},e.createElement(A.LoadingIndicatorPage,null)))))))},L=()=>{const Z=(0,e.useMemo)(()=>({read:y.Z.settings.roles.read,update:y.Z.settings.roles.update}),[]),{isLoading:B,allowedActions:{canRead:P,canUpdate:N}}=(0,A.useRBAC)(Z);return B?e.createElement(A.LoadingIndicatorPage,null):!P&&!N?e.createElement(r.Redirect,{to:"/"}):e.createElement(le,null)}},84802:function(U){function W(u,e,A,r){for(var y=-1,i=u==null?0:u.length;++y<i;){var I=u[y];e(r,I,A(I),u)}return r}U.exports=W},62435:function(U,W,u){var e=u(56671);function A(r,y,i,I){return e(r,function(D,K,G){y(I,D,i(D),G)}),I}U.exports=A},85580:function(U,W,u){var e=u(84802),A=u(62435),r=u(88904),y=u(77236);function i(I,D){return function(K,G){var F=y(K)?e:A,b=D?D():{};return F(K,I,r(G,2),b)}}U.exports=i},72091:function(U,W,u){var e=u(40314),A=1/0;function r(y){var i=y==null?0:y.length;return i?e(y,A):[]}U.exports=r},81346:function(U,W,u){var e=u(40999),A=u(85580),r=Object.prototype,y=r.hasOwnProperty,i=A(function(I,D,K){y.call(I,K)?I[K].push(D):e(I,K,[D])});U.exports=i}}]);
|