@strapi/admin 4.10.4 → 4.11.0-alpha.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/BulkActionsBar/index.js +307 -0
- package/admin/src/content-manager/components/DynamicTable/index.js +20 -4
- package/admin/src/content-manager/components/EditViewDataManagerProvider/index.js +3 -2
- package/admin/src/content-manager/components/EditViewDataManagerProvider/utils/index.js +0 -1
- package/admin/src/content-manager/pages/ListView/index.js +118 -2
- package/admin/src/content-manager/utils/index.js +2 -0
- package/admin/src/content-manager/{components/EditViewDataManagerProvider/utils → utils}/schema.js +1 -1
- package/admin/src/injectionZones.js +6 -1
- package/admin/src/translations/en.json +5 -1
- package/build/{1387.437eb420.chunk.js → 1387.84b454d3.chunk.js} +1 -1
- package/build/{1657.85034334.chunk.js → 1657.45231968.chunk.js} +52 -52
- package/build/3081.bcf9a12f.chunk.js +108 -0
- package/build/3562.57745ccd.chunk.js +50 -0
- package/build/462.8fff7f3b.chunk.js +71 -0
- package/build/{4628.9cbb6df5.chunk.js → 4628.20631dd1.chunk.js} +1 -1
- package/build/5542.b8240e3f.chunk.js +70 -0
- package/build/{5563.44e0ef15.chunk.js → 5563.986609ed.chunk.js} +22 -22
- package/build/6404.68405699.chunk.js +100 -0
- package/build/6970.5159b068.chunk.js +1 -0
- package/build/{7259.3ed2b60e.chunk.js → 7259.7a48aa2f.chunk.js} +1 -1
- package/build/7725.1633e06f.chunk.js +213 -0
- package/build/{Admin-authenticatedApp.dbb99d34.chunk.js → Admin-authenticatedApp.27a2329f.chunk.js} +2 -2
- package/build/Admin_homePage.9f7c0bb1.chunk.js +73 -0
- package/build/Admin_marketplace.5f7b89e5.chunk.js +55 -0
- package/build/Admin_pluginsPage.9e6fa51c.chunk.js +6 -0
- package/build/{Admin_profilePage.1687246a.chunk.js → Admin_profilePage.1b337b73.chunk.js} +1 -1
- package/build/Admin_settingsPage.9d0419bc.chunk.js +79 -0
- package/build/{Upload_ConfigureTheView.aa64ed9a.chunk.js → Upload_ConfigureTheView.d429a7fc.chunk.js} +1 -1
- package/build/{admin-app.d4fd9379.chunk.js → admin-app.8e1f56bc.chunk.js} +5 -5
- package/build/{admin-edit-roles-page.6fe9de49.chunk.js → admin-edit-roles-page.d0c9497b.chunk.js} +41 -43
- package/build/{admin-edit-users.49363035.chunk.js → admin-edit-users.2aae89f5.chunk.js} +2 -2
- package/build/admin-roles-list.c759daa3.chunk.js +31 -0
- package/build/{admin-users.16bb6e77.chunk.js → admin-users.04a823ca.chunk.js} +15 -15
- package/build/audit-logs-settings-page.45cb4fb5.chunk.js +76 -0
- package/build/content-manager.cf467ecc.chunk.js +1123 -0
- package/build/content-type-builder-list-view.5ff685ec.chunk.js +214 -0
- package/build/{content-type-builder.51c64fe5.chunk.js → content-type-builder.4737a30c.chunk.js} +4 -4
- package/build/email-settings-page.dc07d518.chunk.js +10 -0
- package/build/{en-json.1f6af924.chunk.js → en-json.7edb00f6.chunk.js} +1 -1
- package/build/i18n-settings-page.8219dd99.chunk.js +60 -0
- package/build/i18n-translation-en-json.1ec7becf.chunk.js +1 -0
- package/build/index.html +1 -1
- package/build/main.14dca275.js +2592 -0
- package/build/{review-workflows-settings.26409ce4.chunk.js → review-workflows-settings.6a662ebd.chunk.js} +2 -2
- package/build/{runtime~main.a096f3d0.js → runtime~main.1074f2bb.js} +2 -2
- package/build/{sso-settings-page.c9d7c8df.chunk.js → sso-settings-page.f44d95d8.chunk.js} +1 -1
- package/build/upload-settings.dd2d987c.chunk.js +13 -0
- package/build/upload.c8479232.chunk.js +33 -0
- package/build/users-advanced-settings-page.c36cfd59.chunk.js +8 -0
- package/build/users-email-settings-page.2716ce8e.chunk.js +23 -0
- package/build/users-providers-settings-page.0d6304a5.chunk.js +28 -0
- package/build/webhook-edit-page.f4db86f3.chunk.js +75 -0
- package/build/webhook-list-page.30d73114.chunk.js +71 -0
- package/ee/admin/content-manager/components/DynamicTable/CellContent/ReviewWorkflowsStage/getTableColumn.js +6 -1
- package/package.json +11 -11
- package/admin/src/content-manager/components/DynamicTable/ConfirmDialogDeleteAll/index.js +0 -73
- package/build/3081.c2cdfac8.chunk.js +0 -108
- package/build/3816.2b58bc1a.chunk.js +0 -214
- package/build/462.a073ff1f.chunk.js +0 -71
- package/build/5542.5328b662.chunk.js +0 -71
- package/build/617.ce23dea8.chunk.js +0 -155
- package/build/6858.85d76858.chunk.js +0 -50
- package/build/6970.e8422af3.chunk.js +0 -1
- package/build/Admin_homePage.e15dcf28.chunk.js +0 -73
- package/build/Admin_marketplace.87f51b29.chunk.js +0 -55
- package/build/Admin_pluginsPage.7df6b5a9.chunk.js +0 -6
- package/build/Admin_settingsPage.20884a40.chunk.js +0 -79
- package/build/admin-roles-list.a323aa9f.chunk.js +0 -31
- package/build/audit-logs-settings-page.48b921f9.chunk.js +0 -129
- package/build/content-manager.a837bfcd.chunk.js +0 -1123
- package/build/content-type-builder-list-view.1e821eb9.chunk.js +0 -215
- package/build/email-settings-page.5bc22e5a.chunk.js +0 -11
- package/build/i18n-settings-page.1581894e.chunk.js +0 -114
- package/build/i18n-translation-en-json.60af6722.chunk.js +0 -1
- package/build/main.31bdf27e.js +0 -2679
- package/build/upload-settings.4d962053.chunk.js +0 -14
- package/build/upload.4dcd513f.chunk.js +0 -34
- package/build/users-advanced-settings-page.dd2a4954.chunk.js +0 -9
- package/build/users-email-settings-page.510648ab.chunk.js +0 -24
- package/build/users-providers-settings-page.0ee7d54f.chunk.js +0 -29
- package/build/webhook-edit-page.36c9f20d.chunk.js +0 -128
- package/build/webhook-list-page.0983d83f.chunk.js +0 -71
package/build/{admin-edit-roles-page.6fe9de49.chunk.js → admin-edit-roles-page.d0c9497b.chunk.js}
RENAMED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
(self.webpackChunk_strapi_admin=self.webpackChunk_strapi_admin||[]).push([[2544],{92034:function(
|
|
2
|
-
border: 1px solid ${({theme:
|
|
3
|
-
background: ${({theme:
|
|
4
|
-
padding: ${({theme:
|
|
5
|
-
color: ${({theme:
|
|
6
|
-
border-radius: ${({theme:
|
|
1
|
+
(self.webpackChunk_strapi_admin=self.webpackChunk_strapi_admin||[]).push([[2544],{92034:function(w,F,r){"use strict";r.r(F),r.d(F,{CreatePage:function(){return Ce},default:function(){return Oe}});var e=r(32735),C=r(14723),o=r(24989),x=r(27649),k=r(82055),R=r(87933),v=r(41415),S=r(17e3),P=r(72850),M=r(49372),A=r(15335),I=r(5803),y=r(10369),u=r(10508),N=r(29439),Q=r(92802),z=r(33795),fe=r.n(z),T=r(86834),X=r.n(T),me=r(67879),f=r(53038),q=r(8471),Y=r(7247),ee=r(67927),ie=r(83983),le=r(24346),ye=le.Ry().shape({name:le.Z_().required(o.I0.required),description:le.Z_().required(o.I0.required)});const de=q.ZP.div`
|
|
2
|
+
border: 1px solid ${({theme:G})=>G.colors.primary200};
|
|
3
|
+
background: ${({theme:G})=>G.colors.primary100};
|
|
4
|
+
padding: ${({theme:G})=>`${G.spaces[2]} ${G.spaces[4]}`};
|
|
5
|
+
color: ${({theme:G})=>G.colors.primary600};
|
|
6
|
+
border-radius: ${({theme:G})=>G.borderRadius};
|
|
7
7
|
font-size: ${12/16}rem;
|
|
8
8
|
font-weight: bold;
|
|
9
|
-
`,Ce=()=>{const
|
|
9
|
+
`,Ce=()=>{const G=(0,o.lm)(),{lockApp:re,unlockApp:D}=(0,o.o1)(),{formatMessage:j}=(0,me.Z)(),[_,se]=(0,e.useState)(!1),{replace:ce}=(0,f.k6)(),te=(0,e.useRef)(),{trackUsage:ue}=(0,o.rS)(),Ie=(0,f.$B)("/settings/roles/duplicate/:id"),Re=fe()(Ie,"params.id",null),{isLoading:Ze,data:he}=(0,ee.U_)(),{permissions:$e,isLoading:Me}=(0,ee.Dq)(Re),{post:Be,put:De}=(0,o.kY)(),Ve=ae=>{re(),se(!0),ue(Re?"willDuplicateRole":"willCreateNewRole"),Promise.resolve(Be("/admin/roles",ae)).then(async({data:V})=>{const{permissionsToSend:K}=te.current.getPermissions();return ue(Re?"didDuplicateRole":"didCreateNewRole"),V.data.id&&!X()(K)&&await De(`/admin/roles/${V.data.id}/permissions`,{permissions:K}),V}).then(V=>{se(!1),G({type:"success",message:{id:"Settings.roles.created",defaultMessage:"created"}}),ce(`/settings/roles/${V.data.id}`)}).catch(V=>{console.error(V),se(!1),G({type:"warning",message:{id:"notification.error"}})}).finally(()=>{D()})},je=`${j({id:"Settings.roles.form.created",defaultMessage:"Created"})} ${(0,C.Z)(new Date,"PPP")}`;return e.createElement(x.o,null,e.createElement(o.SL,{name:"Roles"}),e.createElement(Q.J9,{initialValues:{name:"",description:je},onSubmit:Ve,validationSchema:ye,validateOnChange:!1},({handleSubmit:ae,values:V,errors:K,handleReset:ve,handleChange:Ee})=>e.createElement(o.l0,{noValidate:!0},e.createElement(e.Fragment,null,e.createElement(k.T,{primaryAction:e.createElement(R.k,{gap:2},e.createElement(v.z,{variant:"secondary",onClick:()=>{ve(),te.current.resetForm()},size:"L"},j({id:"app.components.Button.reset",defaultMessage:"Reset"})),e.createElement(v.z,{onClick:ae,loading:_,size:"L"},j({id:"global.save",defaultMessage:"Save"}))),title:j({id:"Settings.roles.create.title",defaultMessage:"Create a role"}),subtitle:j({id:"Settings.roles.create.description",defaultMessage:"Define the rights given to the role"}),navigationAction:e.createElement(o.rU,{startIcon:e.createElement(N.Z,null),to:"/settings/roles"},j({id:"global.back",defaultMessage:"Back"}))}),e.createElement(S.D,null,e.createElement(R.k,{direction:"column",alignItems:"stretch",gap:6},e.createElement(P.x,{background:"neutral0",padding:6,shadow:"filterShadow",hasRadius:!0},e.createElement(R.k,{direction:"column",alignItems:"stretch",gap:4},e.createElement(R.k,{justifyContent:"space-between"},e.createElement(P.x,null,e.createElement(P.x,null,e.createElement(M.Z,{fontWeight:"bold"},j({id:"global.details",defaultMessage:"Details"}))),e.createElement(P.x,null,e.createElement(M.Z,{variant:"pi",textColor:"neutral600"},j({id:"Settings.roles.form.description",defaultMessage:"Name and description of the role"})))),e.createElement(de,null,j({id:"Settings.roles.form.button.users-with-role",defaultMessage:"{number, plural, =0 {# users} one {# user} other {# users}} with this role"},{number:0}))),e.createElement(A.r,{gap:4},e.createElement(I.P,{col:6},e.createElement(y.o,{name:"name",error:K.name&&j({id:K.name}),label:j({id:"global.name",defaultMessage:"Name"}),onChange:Ee,value:V.name})),e.createElement(I.P,{col:6},e.createElement(u.g,{label:j({id:"global.description",defaultMessage:"Description"}),name:"description",error:K.description&&j({id:K.description}),onChange:Ee},V.description))))),!Ze&&!Me?e.createElement(P.x,{shadow:"filterShadow",hasRadius:!0},e.createElement(Y.Z,{isFormDisabled:!1,ref:te,permissions:$e,layout:he})):e.createElement(P.x,{background:"neutral0",padding:6,shadow:"filterShadow",hasRadius:!0},e.createElement(o.dO,null))))))))};function Oe(){return e.createElement(o.O4,{permissions:ie.Z.settings.roles.create},e.createElement(Ce,null))}},7247:function(w,F,r){"use strict";r.d(F,{Z:function(){return _n}});var e=r(32735),C=r(60216),o=r.n(C),x=r(24989),k=r(91215),R=r(39291),v=r(3653),S=r(23973),P=r.n(S),M=r(86834),A=r.n(M),I=r(67879),y=r(72850),u=r(8471),N=r(98978),Q=r.n(N),z=r(15974),fe=r(96441),T=r(87933),X=r(44426),me=r(33795),f=r.n(me),q=r(9086),Y=r.n(q),ee=r(67927),ie=r(45112),le=r(41415);const Se=u.ZP.div`
|
|
10
10
|
position: relative;
|
|
11
11
|
|
|
12
12
|
${({hasConditions:t,disabled:n,theme:a})=>t&&`
|
|
@@ -21,20 +21,20 @@
|
|
|
21
21
|
background: ${n?a.colors.neutral100:a.colors.primary600};
|
|
22
22
|
}
|
|
23
23
|
`}
|
|
24
|
-
`,ye=({onClick:t,className:n,hasConditions:a,variant:s})=>{const{formatMessage:i}=(0,
|
|
24
|
+
`,ye=({onClick:t,className:n,hasConditions:a,variant:s})=>{const{formatMessage:i}=(0,I.Z)();return e.createElement(Se,{hasConditions:a,className:n},e.createElement(le.z,{variant:s,startIcon:e.createElement(ie.Z,null),onClick:t},i({id:"global.settings",defaultMessage:"Settings"})))};ye.defaultProps={className:null,hasConditions:!1,variant:"tertiary"},ye.propTypes={onClick:o().func.isRequired,className:o().string,hasConditions:o().bool,variant:o().string};var de=(0,u.ZP)(ye)``,Ce=r(85025),Oe=r(55225),G=r(11299),re=r(31600),D=r(49372),j=r(11406),_=r(97889),se=r(81346),ce=r.n(se),te=r(23940),ue=r.n(te),Ie=r(47328);const Re=t=>Object.values(t).map(n=>Object.entries(n).filter(([,a])=>a).map(([a])=>a)).flat(),Ze=t=>t.reduce((n,[a,s])=>(n.push({label:ue()(a),children:s.map(i=>({label:i.displayName,value:i.id}))}),n),[]),he=(t,n)=>t.map(([,a])=>a).flat().reduce((a,s)=>({[s.id]:n.includes(s.id),...a}),{}),$e=({arrayOfOptionsGroupedByCategory:t,isFormDisabled:n,isGrey:a,label:s,name:i,onChange:l,value:d})=>{const{formatMessage:c}=(0,I.Z)(),p=m=>{l(i,he(t,m))};return e.createElement(T.k,{as:"li",background:a?"neutral100":"neutral0",paddingBottom:3,paddingTop:3},e.createElement(T.k,{paddingLeft:6,style:{width:180}},e.createElement(D.Z,{variant:"sigma",textColor:"neutral600"},c({id:"Settings.permissions.conditions.can",defaultMessage:"Can"}),"\xA0"),e.createElement(D.Z,{variant:"sigma",title:s,textColor:"primary600",ellipsis:!0},c({id:`Settings.roles.form.permissions.${s.toLowerCase()}`,defaultMessage:s})),e.createElement(D.Z,{variant:"sigma",textColor:"neutral600"},"\xA0",c({id:"Settings.permissions.conditions.when",defaultMessage:"When"}))),e.createElement(y.x,{style:{maxWidth:430,width:"100%"}},e.createElement(Ie.Q,{id:i,customizeContent:m=>`${m.length} currently selected`,onChange:p,value:Re(d),options:Ze(t),disabled:n})))};$e.propTypes={arrayOfOptionsGroupedByCategory:o().array.isRequired,isFormDisabled:o().bool.isRequired,isGrey:o().bool.isRequired,label:o().string.isRequired,name:o().string.isRequired,value:o().object.isRequired,onChange:o().func.isRequired};var Me=$e;const Be=(t,n)=>t.reduce((a,s)=>(a[s.id]=f()(n,s.id,!1),a),{}),De=(t,n)=>t.reduce((a,s)=>{const[i,l]=s,d=Be(l,n);return a[i]=d,a},{});var je=(t,n,a)=>t.reduce((s,i)=>{const l=f()(n,[...i.pathToConditionsObject,"conditions"],{}),d=De(a,l);return s[i.pathToConditionsObject.join("..")]=d,s},{});const ae=({actions:t,headerBreadCrumbs:n,isFormDisabled:a,onClosed:s,onToggle:i})=>{const{formatMessage:l}=(0,I.Z)(),{availableConditions:d,modifiedData:c,onChangeConditions:p}=(0,ee.$_)(),m=(0,e.useMemo)(()=>Object.entries(ce()(d,"category")),[d]),g=t.filter(({isDisplayed:h,hasSomeActionsSelected:Z,hasAllActionsSelected:L})=>h&&(Z||L)),E=(0,e.useMemo)(()=>je(g,c,m),[g,c,m]),[O,W]=(0,e.useState)(E),$=(h,Z)=>{W((0,_.ZP)(L=>{L[h]||(L[h]={}),L[h].default||(L[h].default={}),L[h].default=Z}))},b=()=>{const h=Object.entries(O).reduce((Z,L)=>{const[B,ne]=L,U=Object.values(ne).reduce((J,H)=>({...J,...H}),{});return Z[B]=U,Z},{});p(h),i()};return e.createElement(Ce.P,{labelledBy:"condition-modal-breadcrumbs",onClose:s},e.createElement(Oe.x,null,e.createElement(G.O,{id:"condition-modal-breadcrumbs",label:n.join(", ")},n.map(h=>e.createElement(G.$,{key:h},ue()(l({id:h,defaultMessage:h})))))),e.createElement(re.f,null,g.length===0&&e.createElement(D.Z,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:h,label:Z,pathToConditionsObject:L},B)=>{const ne=L.join("..");return e.createElement(Me,{key:h,arrayOfOptionsGroupedByCategory:m,label:Z,isFormDisabled:a,isGrey:B%2===0,name:ne,onChange:$,value:f()(O,ne,{})})}))),e.createElement(j.m,{startActions:e.createElement(le.z,{variant:"tertiary",onClick:i},l({id:"app.components.Button.cancel",defaultMessage:"Cancel"})),endActions:e.createElement(le.z,{onClick:b},l({id:"Settings.permissions.conditions.apply",defaultMessage:"Apply"}))}))};ae.propTypes={actions:o().arrayOf(o().shape({actionId:o().string.isRequired,checkboxName:o().string,hasSomeActionsSelected:o().bool.isRequired,hasAllActionsSelected:o().bool,isDisplayed:o().bool.isRequired,label:o().string})).isRequired,headerBreadCrumbs:o().arrayOf(o().string).isRequired,isFormDisabled:o().bool.isRequired,onClosed:o().func.isRequired,onToggle:o().func.isRequired};var V=ae;const K=`${120/16}rem`,ve=`${200/16}rem`,Ee=`${53/16}rem`;var Ge=u.ZP.div`
|
|
25
25
|
width: ${K};
|
|
26
|
-
`,st=(0,u.ZP)(
|
|
26
|
+
`,st=(0,u.ZP)(T.k)`
|
|
27
27
|
padding-right: ${({theme:t})=>t.spaces[2]};
|
|
28
28
|
overflow: hidden;
|
|
29
29
|
flex: 1;
|
|
30
30
|
${({isCollapsable:t})=>t&&"cursor: pointer;"}
|
|
31
|
-
`;const Ke=({children:t,isCollapsable:n,isActive:a,isFormDisabled:s,label:i,onChange:l,onClick:d,checkboxName:c,someChecked:p,value:m})=>{const{formatMessage:g}=(0,
|
|
31
|
+
`;const Ke=({children:t,isCollapsable:n,isActive:a,isFormDisabled:s,label:i,onChange:l,onClick:d,checkboxName:c,someChecked:p,value:m})=>{const{formatMessage:g}=(0,I.Z)();return e.createElement(T.k,{alignItems:"center",paddingLeft:6,style:{width:ve,flexShrink:0}},e.createElement(y.x,{paddingRight:2},e.createElement(X.C,{name:c,"aria-label":g({id:"Settings.permissions.select-all-by-permission",defaultMessage:"Select all {label} permissions"},{label:i}),disabled:s,onValueChange:E=>l({target:{name:c,value:E}}),indeterminate:p,value:m})),e.createElement(st,{title:i,alignItems:"center",isCollapsable:n,...n&&{onClick:d,"aria-expanded":a,onKeyDown:({key:E})=>(E==="Enter"||E===" ")&&d(),tabIndex:0,role:"button"}},e.createElement(D.Z,{fontWeight:a?"bold":"",textColor:a?"primary600":"neutral800",ellipsis:!0},ue()(i)),t))};Ke.defaultProps={children:null,checkboxName:"",onChange(){},value:!1,someChecked:!1,isCollapsable:!1},Ke.propTypes={checkboxName:o().string,children:o().node,label:o().string.isRequired,isCollapsable:o().bool,isFormDisabled:o().bool.isRequired,onChange:o().func,onClick:o().func.isRequired,someChecked:o().bool,value:o().bool,isActive:o().bool.isRequired};var ot=(0,e.memo)(Ke),Bt=r(72091),Ft=r.n(Bt),Nt=r(85973),xe=r.n(Nt);const rt=t=>xe()(t)?Ft()(Object.values(t).map(n=>xe()(n)?rt(n):n)):[];var Le=rt,Ue=t=>t?Object.keys(t).reduce((n,a)=>(a!=="conditions"&&(n[a]=t[a]),n),{}):null,Pe=t=>{const n=Ue(t),a=Le(n);if(!a.length)return{hasAllActionsSelected:!1,hasSomeActionsSelected:!1};const s=a.every(l=>l),i=a.some(l=>l)&&!s;return{hasAllActionsSelected:s,hasSomeActionsSelected:i}},Wt=(t,n,a)=>t.map(({actionId:s,isDisplayed:i,applyToProperties:l,label:d})=>{if(!i)return{actionId:s,hasSomeActionsSelected:!1,isDisplayed:i};const c=[...a.split(".."),s],p=A()(l)?[...c,"properties","enabled"]:c,m=p.join(".."),g=f()(n,[...c,"conditions"],null),E=Le(g).some(b=>b);if(A()(l)){const b=f()(n,p,!1);return{actionId:s,checkboxName:m,hasAllActionsSelected:b,hasConditions:E,hasSomeActionsSelected:b,isDisplayed:i,isParentCheckbox:!1,label:d,pathToConditionsObject:c}}const O=f()(n,p,null),{hasAllActionsSelected:W,hasSomeActionsSelected:$}=Pe(O);return{actionId:s,checkboxName:m,hasAllActionsSelected:W,hasConditions:E,hasSomeActionsSelected:$,isDisplayed:i,isParentCheckbox:!0,label:d,pathToConditionsObject:c}}),Vt=r(16899),Fe=(0,u.ZP)(Vt.Z)`
|
|
32
32
|
display: none;
|
|
33
33
|
width: ${10/16}rem;
|
|
34
34
|
transform: rotate(${({$isActive:t})=>t?"180":"0"}deg);
|
|
35
35
|
margin-left: ${({theme:t})=>t.spaces[2]};
|
|
36
36
|
`,Ne=t=>`
|
|
37
|
-
${
|
|
37
|
+
${D.Z} {
|
|
38
38
|
color: ${t.colors.primary600};
|
|
39
39
|
font-weight: ${t.fontWeights.bold}
|
|
40
40
|
}
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
&:hover {
|
|
83
83
|
${({theme:t,isActive:n})=>ze(t,n)}
|
|
84
84
|
}
|
|
85
|
-
`,it=(0,u.ZP)(
|
|
85
|
+
`,it=(0,u.ZP)(T.k)`
|
|
86
86
|
width: ${K};
|
|
87
87
|
position: relative;
|
|
88
88
|
`,lt=(0,u.ZP)(y.x)`
|
|
@@ -101,21 +101,21 @@
|
|
|
101
101
|
height: 6px;
|
|
102
102
|
border-radius: 20px;
|
|
103
103
|
background: ${({theme:t})=>t.colors.primary600};
|
|
104
|
-
`,
|
|
104
|
+
`,Gt=(0,u.ZP)(y.x)`
|
|
105
105
|
position: absolute;
|
|
106
106
|
right: 9px;
|
|
107
107
|
transform: translateY(10px);
|
|
108
|
-
`,ct=({availableActions:t,isActive:n,isGrey:a,isFormDisabled:s,label:i,onClickToggle:l,pathToData:d})=>{const[c,p]=(0,e.useState)(!1),{formatMessage:m}=(0,
|
|
108
|
+
`,ct=({availableActions:t,isActive:n,isGrey:a,isFormDisabled:s,label:i,onClickToggle:l,pathToData:d})=>{const[c,p]=(0,e.useState)(!1),{formatMessage:m}=(0,I.Z)(),{modifiedData:g,onChangeParentCheckbox:E,onChangeSimpleCheckbox:O}=(0,ee.$_)(),W=()=>{p(U=>!U)},$=()=>{p(!1)},b=f()(g,d.split(".."),{}),h=(0,e.useMemo)(()=>Object.keys(b).reduce((U,J)=>(U[J]=Y()(b[J],"conditions"),U),{}),[b]),{hasAllActionsSelected:Z,hasSomeActionsSelected:L}=Pe(h),B=(0,e.useMemo)(()=>Wt(t,g,d),[t,g,d]),ne=B.some(({hasConditions:U})=>U);return e.createElement(Ht,{isActive:n},e.createElement(at,{isGrey:a},e.createElement(ot,{isCollapsable:!0,isFormDisabled:s,label:i,checkboxName:d,onChange:E,onClick:l,someChecked:L,value:Z,isActive:n},e.createElement(lt,{paddingLeft:2},n?e.createElement(z.Z,null):e.createElement(fe.Z,null))),e.createElement(T.k,{style:{flex:1}},B.map(({actionId:U,hasConditions:J,hasAllActionsSelected:H,hasSomeActionsSelected:ge,isDisplayed:ke,isParentCheckbox:oe,checkboxName:be,label:We})=>ke?oe?e.createElement(it,{key:U,justifyContent:"center",alignItems:"center"},J&&e.createElement(dt,null),e.createElement(X.C,{disabled:s,name:be,"aria-label":m({id:"Settings.permissions.select-by-permission",defaultMessage:"Select {label} permission"},{label:`${We} ${i}`}),onValueChange:Ae=>{E({target:{name:be,value:Ae}})},indeterminate:ge,value:H})):e.createElement(it,{key:U,justifyContent:"center",alignItems:"center"},J&&e.createElement(dt,null),e.createElement(X.C,{disabled:s,indeterminate:J,name:be,onValueChange:Ae=>{O({target:{name:be,value:Ae}})},value:H})):e.createElement(Ge,{key:U}))),c&&e.createElement(V,{headerBreadCrumbs:[i,"Settings.permissions.conditions.conditions"],actions:B,isFormDisabled:s,onClosed:$,onToggle:W})),e.createElement(Gt,null,e.createElement(de,{onClick:W,hasConditions:ne})))};ct.propTypes={availableActions:o().array.isRequired,isActive:o().bool.isRequired,isGrey:o().bool.isRequired,isFormDisabled:o().bool.isRequired,label:o().string.isRequired,onClickToggle:o().func.isRequired,pathToData:o().string.isRequired};var Kt=ct,Ut=(t,n)=>t.map(a=>{const s=Array.isArray(a.applyToProperties)&&a.applyToProperties.indexOf(n)!==-1&&a.isDisplayed;return{label:a.label,actionId:a.actionId,isActionRelatedToCurrentProperty:s}});const ut=(0,u.ZP)(T.k)`
|
|
109
109
|
width: ${K};
|
|
110
110
|
flex-shrink: 0;
|
|
111
|
-
`,zt=(0,u.ZP)(
|
|
111
|
+
`,zt=(0,u.ZP)(T.k)`
|
|
112
112
|
width: ${ve};
|
|
113
113
|
height: ${Ee};
|
|
114
114
|
flex-shrink: 0;
|
|
115
|
-
`,mt=({headers:t,label:n})=>{const{formatMessage:a}=(0,
|
|
115
|
+
`,mt=({headers:t,label:n})=>{const{formatMessage:a}=(0,I.Z)(),s=a({id:"Settings.roles.form.permission.property-label",defaultMessage:"{label} permissions"},{label:n});return e.createElement(T.k,null,e.createElement(zt,{alignItems:"center",paddingLeft:6},e.createElement(D.Z,{variant:"sigma",textColor:"neutral500"},s)),t.map(i=>i.isActionRelatedToCurrentProperty?e.createElement(ut,{justifyContent:"center",key:i.label},e.createElement(D.Z,{variant:"sigma",textColor:"neutral500"},a({id:`Settings.roles.form.permissions.${i.label.toLowerCase()}`,defaultMessage:i.label}))):e.createElement(ut,{key:i.label})))};mt.propTypes={headers:o().arrayOf(o().shape({label:o().string.isRequired,isActionRelatedToCurrentProperty:o().bool.isRequired})).isRequired,label:o().string.isRequired};var Xt=mt;const Yt=u.ZP.span`
|
|
116
116
|
color: ${({theme:t})=>t.colors.danger700};
|
|
117
117
|
padding-left: ${({theme:t})=>t.spaces[1]}px;
|
|
118
|
-
`;var pt=()=>e.createElement(
|
|
118
|
+
`;var pt=()=>e.createElement(Yt,null,"*"),wt=(t,n)=>t.map(a=>{const s=Array.isArray(a.subjects)&&a.subjects.indexOf(n)!==-1;return{...a,isDisplayed:s}});const Jt=(0,u.ZP)(y.x)`
|
|
119
119
|
transform: translate(-4px, -12px);
|
|
120
120
|
|
|
121
121
|
&:before {
|
|
@@ -133,16 +133,16 @@
|
|
|
133
133
|
* {
|
|
134
134
|
fill: ${({theme:t,color:n})=>t.colors[n]};
|
|
135
135
|
}
|
|
136
|
-
`,Xe=t=>e.createElement(Jt,null,e.createElement(Qt,{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"})));Xe.defaultProps={fill:"primary200"},Xe.propTypes={fill:o().string};var qt=(0,e.memo)(Xe);const gt=(0,u.ZP)(
|
|
136
|
+
`,Xe=t=>e.createElement(Jt,null,e.createElement(Qt,{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"})));Xe.defaultProps={fill:"primary200"},Xe.propTypes={fill:o().string};var qt=(0,e.memo)(Xe);const gt=(0,u.ZP)(T.k)`
|
|
137
137
|
width: ${K};
|
|
138
138
|
position: relative;
|
|
139
|
-
`,_t=(0,u.ZP)(
|
|
139
|
+
`,_t=(0,u.ZP)(T.k)`
|
|
140
140
|
height: ${Ee};
|
|
141
141
|
`,en=(0,u.ZP)(y.x)`
|
|
142
142
|
padding-left: ${31/16}rem;
|
|
143
143
|
`,tn=(0,u.ZP)(y.x)`
|
|
144
144
|
border-left: ${({isVisible:t,theme:n})=>t?`4px solid ${n.colors.primary200}`:"4px solid transparent"};
|
|
145
|
-
`,nn=(0,u.ZP)(
|
|
145
|
+
`,nn=(0,u.ZP)(T.k)`
|
|
146
146
|
padding-left: ${({theme:t})=>t.spaces[4]};
|
|
147
147
|
width: ${({level:t})=>145-t*36}px;
|
|
148
148
|
|
|
@@ -163,10 +163,10 @@
|
|
|
163
163
|
background-color: ${({theme:t})=>t.colors.primary200};
|
|
164
164
|
border-top-left-radius: 2px;
|
|
165
165
|
border-top-right-radius: 2px;
|
|
166
|
-
`,
|
|
166
|
+
`,Ye=({childrenForm:t,isFormDisabled:n,recursiveLevel:a,pathToDataFromActionRow:s,propertyActions:i,parentName:l,propertyName:d})=>{const{formatMessage:c}=(0,I.Z)(),{modifiedData:p,onChangeParentCheckbox:m,onChangeSimpleCheckbox:g}=(0,ee.$_)(),[E,O]=(0,e.useState)(null),W=b=>{O(h=>h===b?null:b)},$=(0,e.useMemo)(()=>E?t.find(({value:b})=>b===E):null,[E,t]);return e.createElement(en,null,e.createElement(sn,null),t.map(({label:b,value:h,required:Z,children:L},B)=>{const ne=B+1<t.length,U=Array.isArray(L),J=E===h;return e.createElement(tn,{key:h,isVisible:ne},e.createElement(_t,null,e.createElement(qt,{color:"primary200"}),e.createElement(T.k,{style:{flex:1}},e.createElement(nn,{level:a,isActive:J,isCollapsable:U},e.createElement(st,{alignItems:"center",isCollapsable:U,...U&&{onClick:()=>W(h),"aria-expanded":J,onKeyDown:({key:H})=>(H==="Enter"||H===" ")&&W(h),tabIndex:0,role:"button"},title:b},e.createElement(D.Z,{ellipsis:!0},ue()(b)),Z&&e.createElement(pt,null),e.createElement(Fe,{$isActive:J}))),e.createElement(T.k,{style:{flex:1}},i.map(({actionId:H,label:ge,isActionRelatedToCurrentProperty:ke})=>{if(!ke)return e.createElement(Ge,{key:H});const oe=[...s.split(".."),H,"properties",d,...l.split(".."),h],be=f()(p,oe,!1);if(!L)return e.createElement(gt,{key:ge,justifyContent:"center",alignItems:"center"},e.createElement(X.C,{disabled:n,name:oe.join(".."),"aria-label":c({id:"Settings.permissions.select-by-permission",defaultMessage:"Select {label} permission"},{label:`${l} ${b} ${ge}`}),onValueChange:Te=>{g({target:{name:oe.join(".."),value:Te}})},value:be}));const{hasAllActionsSelected:We,hasSomeActionsSelected:Ae}=Pe(be);return e.createElement(gt,{key:ge,justifyContent:"center",alignItems:"center"},e.createElement(X.C,{key:ge,disabled:n,name:oe.join(".."),"aria-label":c({id:"Settings.permissions.select-by-permission",defaultMessage:"Select {label} permission"},{label:`${l} ${b} ${ge}`}),onValueChange:Te=>{m({target:{name:oe.join(".."),value:Te}})},value:We,indeterminate:Ae}))})))),$&&J&&e.createElement(y.x,{paddingBottom:2},e.createElement(Ye,{isFormDisabled:n,parentName:`${l}..${h}`,pathToDataFromActionRow:s,propertyActions:i,propertyName:d,recursiveLevel:a+1,childrenForm:$.children})))}))};Ye.propTypes={childrenForm:o().array.isRequired,isFormDisabled:o().bool.isRequired,parentName:o().string.isRequired,pathToDataFromActionRow:o().string.isRequired,propertyActions:o().array.isRequired,propertyName:o().string.isRequired,recursiveLevel:o().number.isRequired};var on=(0,e.memo)(Ye);const rn=t=>t.reduce((a,s)=>(s.isActionRelatedToCurrentProperty&&a.push(s.actionId),a),[]);var an=(t,n,a,s,i)=>{const d=rn(t).reduce((c,p)=>{const m=[...a.split(".."),p,"properties",s,i],g=f()(n,m,!1);return c[p]=g,c},{});return Pe(d)};const ft=(0,u.ZP)(T.k)`
|
|
167
167
|
width: ${K};
|
|
168
168
|
position: relative;
|
|
169
|
-
`,ln=(0,u.ZP)(
|
|
169
|
+
`,ln=(0,u.ZP)(T.k)`
|
|
170
170
|
height: ${Ee};
|
|
171
171
|
flex: 1;
|
|
172
172
|
|
|
@@ -180,21 +180,21 @@
|
|
|
180
180
|
}
|
|
181
181
|
`}
|
|
182
182
|
${({isActive:t,theme:n})=>t&&Ne(n)};
|
|
183
|
-
`,
|
|
183
|
+
`,we=({childrenForm:t,label:n,isFormDisabled:a,name:s,required:i,pathToData:l,propertyActions:d,propertyName:c,isOdd:p})=>{const{formatMessage:m}=(0,I.Z)(),[g,E]=(0,e.useState)(null),{modifiedData:O,onChangeCollectionTypeLeftActionRowCheckbox:W,onChangeParentCheckbox:$,onChangeSimpleCheckbox:b}=(0,ee.$_)(),h=g===s,Z=(0,e.useMemo)(()=>Array.isArray(t)?t:[],[t]),L=Z.length>0,B=(0,e.useCallback)(()=>{L&&E(H=>H===s?null:s)},[L,s]),ne=({target:{value:H}})=>{W(l,c,s,H)},{hasAllActionsSelected:U,hasSomeActionsSelected:J}=(0,e.useMemo)(()=>an(d,O,l,c,s),[d,O,l,c,s]);return e.createElement(e.Fragment,null,e.createElement(ln,{alignItems:"center",isCollapsable:L,isActive:h,background:p?"neutral100":"neutral0"},e.createElement(T.k,null,e.createElement(ot,{onChange:ne,onClick:B,isCollapsable:L,isFormDisabled:a,label:n,someChecked:J,value:U,isActive:h},i&&e.createElement(pt,null),e.createElement(Fe,{$isActive:h})),e.createElement(T.k,null,d.map(({label:H,isActionRelatedToCurrentProperty:ge,actionId:ke})=>{if(!ge)return e.createElement(Ge,{key:H});const oe=[...l.split(".."),ke,"properties",c,s];if(!L){const Te=f()(O,oe,!1);return e.createElement(ft,{key:ke,justifyContent:"center",alignItems:"center"},e.createElement(X.C,{disabled:a,name:oe.join(".."),"aria-label":m({id:"Settings.permissions.select-by-permission",defaultMessage:"Select {label} permission"},{label:`${s} ${H}`}),onValueChange:es=>{b({target:{name:oe.join(".."),value:es}})},value:Te}))}const be=f()(O,oe,{}),{hasAllActionsSelected:We,hasSomeActionsSelected:Ae}=Pe(be);return e.createElement(ft,{key:H,justifyContent:"center",alignItems:"center"},e.createElement(X.C,{disabled:a,name:oe.join(".."),onValueChange:Te=>{$({target:{name:oe.join(".."),value:Te}})},"aria-label":m({id:"Settings.permissions.select-by-permission",defaultMessage:"Select {label} permission"},{label:`${s} ${H}`}),value:We,indeterminate:Ae}))})))),h&&e.createElement(on,{childrenForm:Z,isFormDisabled:a,parentName:s,pathToDataFromActionRow:l,propertyName:c,propertyActions:d,recursiveLevel:0}))};we.defaultProps={childrenForm:[],required:!1},we.propTypes={childrenForm:o().array,label:o().string.isRequired,isFormDisabled:o().bool.isRequired,name:o().string.isRequired,pathToData:o().string.isRequired,propertyActions:o().array.isRequired,propertyName:o().string.isRequired,required:o().bool,isOdd:o().bool.isRequired};var dn=(0,e.memo)(we);const cn=u.ZP.div`
|
|
184
184
|
display: inline-flex;
|
|
185
185
|
flex-direction: column;
|
|
186
186
|
min-width: 0;
|
|
187
|
-
`,ht=({availableActions:t,childrenForm:n,isFormDisabled:a,label:s,pathToData:i,propertyName:l})=>{const d=(0,e.useMemo)(()=>
|
|
187
|
+
`,ht=({availableActions:t,childrenForm:n,isFormDisabled:a,label:s,pathToData:i,propertyName:l})=>{const d=(0,e.useMemo)(()=>Ut(t,l),[t,l]);return e.createElement(cn,null,e.createElement(Xt,{label:s,headers:d}),e.createElement(y.x,null,n.map(({children:c,label:p,value:m,required:g},E)=>e.createElement(dn,{childrenForm:c,key:m,label:p,isFormDisabled:a,name:m,required:g,propertyActions:d,pathToData:i,propertyName:l,isOdd:E%2===0}))))};ht.propTypes={childrenForm:o().array.isRequired,availableActions:o().array.isRequired,isFormDisabled:o().bool.isRequired,label:o().string.isRequired,pathToData:o().string.isRequired,propertyName:o().string.isRequired};var un=ht;const mn=u.ZP.div`
|
|
188
188
|
flex-direction: column;
|
|
189
189
|
display: inline-flex;
|
|
190
190
|
min-width: 100%;
|
|
191
191
|
${({theme:t,isActive:n})=>n&&`border: 1px solid ${t.colors.primary600};`}
|
|
192
|
-
`,yt=({allActions:t,contentTypeName:n,label:a,index:s,isActive:i,isFormDisabled:l,onClickToggleCollapse:d,pathToData:c,properties:p})=>{const m=(0,e.useCallback)(()=>{d(n)},[n,d]),g=(0,e.useMemo)(()=>
|
|
192
|
+
`,yt=({allActions:t,contentTypeName:n,label:a,index:s,isActive:i,isFormDisabled:l,onClickToggleCollapse:d,pathToData:c,properties:p})=>{const m=(0,e.useCallback)(()=>{d(n)},[n,d]),g=(0,e.useMemo)(()=>wt(t,n),[t,n]);return e.createElement(mn,{isActive:i},e.createElement(Kt,{availableActions:g,isActive:i,isGrey:s%2===0,isFormDisabled:l,label:a,onClickToggle:m,pathToData:c}),i&&p.map(({label:E,value:O,children:W})=>e.createElement(un,{availableActions:g,childrenForm:W,isFormDisabled:l,label:E,pathToData:c,propertyName:O,key:O})))};yt.propTypes={allActions:o().array.isRequired,contentTypeName:o().string.isRequired,index:o().number.isRequired,isActive:o().bool.isRequired,isFormDisabled:o().bool.isRequired,label:o().string.isRequired,onClickToggleCollapse:o().func.isRequired,pathToData:o().string.isRequired,properties:o().array.isRequired};var pn=yt;const Je=({actions:t,isFormDisabled:n,pathToData:a,subjects:s})=>{const[i,l]=(0,e.useState)(null),d=c=>{l(i===c?null:c)};return s.map(({uid:c,label:p,properties:m},g)=>e.createElement(pn,{allActions:t,key:c,contentTypeName:c,label:p,isActive:i===c,isFormDisabled:n,index:g,onClickToggleCollapse:d,pathToData:`${a}..${c}`,properties:m}))};Je.defaultProps={actions:[],subjects:[]},Je.propTypes={actions:o().array.isRequired,isFormDisabled:o().bool.isRequired,pathToData:o().string.isRequired,subjects:o().arrayOf(o().shape({uid:o().string.isRequired,label:o().string.isRequired,properties:o().array.isRequired}))};var gn=(0,e.memo)(Je),fn=t=>t.filter(({subjects:n})=>n&&n.length);const hn=t=>t.map(({actionId:n})=>n),yn=(t,n)=>t.reduce((a,s)=>(Object.keys(n).forEach(i=>{const l=f()(n,[i,s],{}),d={[i]:Ue(l)};a[s]?a[s]={...a[s],...d}:a[s]=d}),a),{});var Cn=(t,n)=>{const a=hn(t),s=yn(a,n);return Object.keys(s).reduce((l,d)=>(l[d]=Pe(s[d]),l),{})};const vn=(0,u.ZP)(T.k)`
|
|
193
193
|
width: ${K};
|
|
194
194
|
flex-shrink: 0;
|
|
195
|
-
`,Qe=({actions:t,isFormDisabled:n,kind:a})=>{const{formatMessage:s}=(0,
|
|
195
|
+
`,Qe=({actions:t,isFormDisabled:n,kind:a})=>{const{formatMessage:s}=(0,I.Z)(),{modifiedData:i,onChangeCollectionTypeGlobalActionCheckbox:l}=(0,ee.$_)(),d=(0,e.useMemo)(()=>fn(t),[t]),c=(0,e.useMemo)(()=>Cn(d,i[a]),[i,d,a]);return e.createElement(y.x,{paddingBottom:4,paddingTop:6,style:{paddingLeft:ve}},e.createElement(T.k,{gap:0},d.map(({label:p,actionId:m})=>e.createElement(vn,{direction:"column",alignItems:"center",justifyContent:"center",key:m,gap:3},e.createElement(D.Z,{variant:"sigma",textColor:"neutral500"},s({id:`Settings.roles.form.permissions.${p.toLowerCase()}`,defaultMessage:p})),e.createElement(X.C,{disabled:n,onValueChange:g=>{l(a,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:f()(c,[m,"hasAllActionsSelected"],!1),indeterminate:f()(c,[m,"hasSomeActionsSelected"],!1)})))))};Qe.defaultProps={actions:[]},Qe.propTypes={actions:o().arrayOf(o().shape({label:o().string.isRequired,actionId:o().string.isRequired,subjects:o().array.isRequired})),isFormDisabled:o().bool.isRequired,kind:o().string.isRequired};var En=(0,e.memo)(Qe);const bn=(0,u.ZP)(y.x)`
|
|
196
196
|
overflow-x: auto;
|
|
197
|
-
`,Ct=({isFormDisabled:t,kind:n,layout:{actions:a,subjects:s}})=>{const i=Q()([...s],"label");return e.createElement(bn,{background:"neutral0"},e.createElement(En,{actions:a,kind:n,isFormDisabled:t}),e.createElement(gn,{actions:a,isFormDisabled:t,pathToData:n,subjects:i}))};Ct.propTypes={isFormDisabled:o().bool.isRequired,kind:o().string.isRequired,layout:o().shape({actions:o().array,subjects:o().arrayOf(o().shape({uid:o().string.isRequired,label:o().string.isRequired,properties:o().array.isRequired}))}).isRequired};var vt=(0,e.memo)(Ct),xn=r(66694);const Et=({children:t,value:n})=>e.createElement(xn.$l.Provider,{value:n},t);Et.propTypes={children:o().node.isRequired,value:o().exact({availableConditions:o().array.isRequired,modifiedData:o().object.isRequired,onChangeCollectionTypeLeftActionRowCheckbox:o().func.isRequired,onChangeConditions:o().func.isRequired,onChangeSimpleCheckbox:o().func.isRequired,onChangeParentCheckbox:o().func.isRequired,onChangeCollectionTypeGlobalActionCheckbox:o().func.isRequired}).isRequired};var Rn=Et,Pn=r(83828),An=r(61762),Tn=r(89966),bt=r(8284),Sn=r(15335),
|
|
197
|
+
`,Ct=({isFormDisabled:t,kind:n,layout:{actions:a,subjects:s}})=>{const i=Q()([...s],"label");return e.createElement(bn,{background:"neutral0"},e.createElement(En,{actions:a,kind:n,isFormDisabled:t}),e.createElement(gn,{actions:a,isFormDisabled:t,pathToData:n,subjects:i}))};Ct.propTypes={isFormDisabled:o().bool.isRequired,kind:o().string.isRequired,layout:o().shape({actions:o().array,subjects:o().arrayOf(o().shape({uid:o().string.isRequired,label:o().string.isRequired,properties:o().array.isRequired}))}).isRequired};var vt=(0,e.memo)(Ct),xn=r(66694);const Et=({children:t,value:n})=>e.createElement(xn.$l.Provider,{value:n},t);Et.propTypes={children:o().node.isRequired,value:o().exact({availableConditions:o().array.isRequired,modifiedData:o().object.isRequired,onChangeCollectionTypeLeftActionRowCheckbox:o().func.isRequired,onChangeConditions:o().func.isRequired,onChangeSimpleCheckbox:o().func.isRequired,onChangeParentCheckbox:o().func.isRequired,onChangeCollectionTypeGlobalActionCheckbox:o().func.isRequired}).isRequired};var Rn=Et,Pn=r(83828),An=r(61762),Tn=r(89966),bt=r(8284),Sn=r(15335),On=r(5803),$n=(t,n,a)=>t.map(s=>{const i=[...a,s.action,"properties","enabled"],l=f()(n,i,!1),d=f()(n,[...a,s.action,"conditions"],{}),c=Le(d).some(p=>p);return{...s,isDisplayed:l,checkboxName:i.join(".."),hasSomeActionsSelected:l,value:l,hasConditions:c,label:s.displayName,actionId:s.action,pathToConditionsObject:[...a,s.action]}}),Mn=t=>{const n=Object.entries(t).reduce((s,i)=>{const[l,{conditions:d}]=i;return s[l]=d,s},{});return Le(n).some(s=>s)};const Dn=u.ZP.div`
|
|
198
198
|
flex: 1;
|
|
199
199
|
align-self: center;
|
|
200
200
|
border-top: 1px solid ${({theme:t})=>t.colors.neutral150};
|
|
@@ -213,21 +213,21 @@
|
|
|
213
213
|
background: ${n?a.colors.neutral100:a.colors.primary600};
|
|
214
214
|
}
|
|
215
215
|
`}
|
|
216
|
-
`,xt=({categoryName:t,isFormDisabled:n,subCategoryName:a,actions:s,pathToData:i})=>{const[l,d]=(0,e.useState)(!1),{modifiedData:c,onChangeParentCheckbox:p,onChangeSimpleCheckbox:m}=(0,ee.$_)(),{formatMessage:g}=(0,F.Z)(),C=f()(c,i,{}),S=(0,e.useMemo)(()=>Object.keys(C).reduce((k,ne)=>(k[ne]=Ge(C[ne]),k),{}),[C]),{hasAllActionsSelected:W,hasSomeActionsSelected:M}=Pe(S),E=()=>{d(k=>!k)},h=()=>{d(!1)},L=On(s,c,i),D=$n(f()(c,[...i],{}));return e.createElement(e.Fragment,null,e.createElement(y.x,null,e.createElement(A.k,{justifyContent:"space-between",alignItems:"center"},e.createElement(y.x,{paddingRight:4},e.createElement(O.Z,{variant:"sigma",textColor:"neutral600"},a)),e.createElement(Dn,null),e.createElement(y.x,{paddingLeft:4},e.createElement(bt.X,{name:i.join(".."),disabled:n,onValueChange:k=>{p({target:{name:i.join(".."),value:k}})},indeterminate:M,value:W},g({id:"app.utils.select-all",defaultMessage:"Select all"})))),e.createElement(A.k,{paddingTop:6,paddingBottom:6},e.createElement(Sn.r,{gap:2,style:{flex:1}},L.map(({checkboxName:k,value:ne,action:G,displayName:J,hasConditions:H})=>e.createElement(Mn.P,{col:3,key:G},e.createElement(jn,{disabled:n,hasConditions:H},e.createElement(bt.X,{name:k,disabled:n,onValueChange:ge=>{m({target:{name:k,value:ge}})},value:ne},J))))),e.createElement(de,{hasConditions:D,onClick:E}))),l&&e.createElement(V,{headerBreadCrumbs:[t,a],actions:L,isFormDisabled:n,onClosed:h,onToggle:E}))};xt.propTypes={actions:o().array.isRequired,categoryName:o().string.isRequired,isFormDisabled:o().bool.isRequired,subCategoryName:o().string.isRequired,pathToData:o().array.isRequired};var Ln=xt;const qe=({childrenForm:t,kind:n,name:a,isOpen:s,isFormDisabled:i,isWhite:l,onOpenCategory:d,pathToData:c})=>{const{formatMessage:p}=(0,F.Z)(),m=()=>{d(a)},g=(0,e.useMemo)(()=>a.split("::").pop(),[a]);return e.createElement(Pn.U,{expanded:s,onToggle:m,id:`accordion-${a}`,variant:l?"primary":"secondary"},e.createElement(An.B,{title:ue()(g),description:`${p({id:"Settings.permissions.category"},{category:g})} ${n==="plugins"?"plugin":n}`}),e.createElement(Tn.v,null,e.createElement(y.x,{padding:6},t.map(({actions:C,subCategoryName:S,subCategoryId:W})=>e.createElement(Ln,{key:S,actions:C,categoryName:g,isFormDisabled:i,subCategoryName:S,pathToData:[...c,W]})))))};qe.defaultProps={},qe.propTypes={childrenForm:o().array.isRequired,isOpen:o().bool.isRequired,isFormDisabled:o().bool.isRequired,isWhite:o().bool.isRequired,kind:o().string.isRequired,name:o().string.isRequired,onOpenCategory:o().func.isRequired,pathToData:o().array.isRequired};var kn=qe;const Rt=({isFormDisabled:t,kind:n,layout:a})=>{const[s,i]=(0,e.useState)(null),l=d=>{i(d===s?null:d)};return e.createElement(y.x,{padding:6,background:"neutral0"},a.map(({category:d,categoryId:c,childrenForm:p},m)=>e.createElement(kn,{key:d,childrenForm:p,kind:n,isFormDisabled:t,isOpen:s===d,isWhite:m%2===1,name:d,onOpenCategory:l,pathToData:[n,c]})))};Rt.propTypes={isFormDisabled:o().bool.isRequired,kind:o().string.isRequired,layout:o().arrayOf(o().shape({category:o().string.isRequired,categoryId:o().string.isRequired,childrenForm:o().arrayOf(o().shape({actions:o().array.isRequired})).isRequired}).isRequired).isRequired};var Pt=Rt,In=r(86349),Zn=r.n(In),Bn=r(3040),pe=r.n(Bn),At=(t,n,a)=>t.find(s=>s.action===n&&s.subject===a);const Tt=(t,n=[])=>t.reduce((a,s)=>(a[s.id]=n.indexOf(s.id)!==-1,a),{}),St=({children:t},n,a="")=>t.reduce((s,i)=>{if(i.children)return{...s,[i.value]:St(i,n,`${a}${i.value}.`)};const l=n.indexOf(`${a}${i.value}`)!==-1;return s[i.value]=l,s},{}),Fn=(t,n,a)=>t.reduce((s,i)=>{const l=n.properties.find(({value:d})=>d===i);if(l){const d=f()(a,["properties",l.value],[]),c=St(l,d);s.properties[i]=c}return s},{properties:{}}),Nn=(t,n)=>n.reduce((a,s)=>{const i=t.find(({uid:l})=>l===s)||null;return i&&(a[s]=i),a},{});var Mt=({subjects:t},n,a,s=[])=>n.reduce((i,l)=>{const d=l.subjects,c=Nn(t,d);if(j()(c))return i;const p=Object.keys(c).reduce((m,g)=>{const{actionId:C,applyToProperties:S}=l,E=c[g].properties.map(({value:k})=>k).every(k=>(S||[]).indexOf(k)===-1),h=At(s,C,g),L=Tt(a,f()(h,"conditions",[]));if(j()(S)||E)return pe()(m,[g,C],{properties:{enabled:h!==void 0},conditions:L}),m;const D=Fn(S,c[g],h);return pe()(m,[g,C],{...D,conditions:L}),m},{});return Zn()(i,p)},{});const Wn=(t,n,a)=>t.reduce((s,i)=>{const l=At(a,i.action,null);return s[i.action]={properties:{enabled:l!==void 0},conditions:Tt(n,l?.conditions??[])},s},{}),Vn=(t,n,a)=>t.reduce((s,i)=>(s[i.subCategoryId]=Wn(i.actions,n,a),s),{});var Ot=(t,n,a=[])=>t.reduce((s,{categoryId:i,childrenForm:l})=>{const d=Vn(l,n,a);return s[i]=d,s},{});const $t=t=>t.split(" ").join("-");var Dt=(t,n)=>Object.entries(ce()(t,n)).map(([a,s])=>({category:a,categoryId:$t(a),childrenForm:Object.entries(ce()(s,"subCategory")).map(([i,l])=>({subCategoryName:i,subCategoryId:$t(i),actions:l}))})),Hn=(t,n)=>{const{conditions:a,sections:{collectionTypes:s,singleTypes:i,plugins:l,settings:d}}=t,c={collectionTypes:s,singleTypes:i,plugins:Dt(l,"plugin"),settings:Dt(d,"category")},p={collectionTypes:Mt(s,s.actions||[],a,n),singleTypes:Mt(i,i.actions||[],a,n),plugins:Ot(c.plugins,a,n),settings:Ot(c.settings,a,n)};return{initialData:p,modifiedData:p,layouts:c}},Un=r(99381),_e=r.n(Un);const jt=t=>Object.keys(t).reduce((n,a)=>{const s=t[a];if(xe()(s)&&!x()(s,"conditions"))return{...n,[a]:jt(s)};if(xe()(s)&&x()(s,"conditions")&&!Le(w()(s,"conditions")).some(l=>l)){const l=Object.keys(s.conditions).reduce((d,c)=>(d[c]=!1,d),{});return{...n,[a]:{...s,conditions:l}}}return n[a]=s,n},{});var et=jt;const Lt=(t,n,a=!1)=>Object.keys(t).reduce((s,i)=>{const l=t[i];return i==="conditions"&&!a?(s[i]=l,s):xe()(l)?{...s,[i]:Lt(l,n,i==="fields")}:(s[i]=n,s)},{});var He=Lt;const Kn={initialData:{},modifiedData:{},layouts:{}};var Gn=(t,n)=>(0,_.ZP)(t,a=>{switch(n.type){case"ON_CHANGE_COLLECTION_TYPE_GLOBAL_ACTION_CHECKBOX":{const{collectionTypeKind:s,actionId:i,value:l}=n,d=["modifiedData",s];Object.keys(f()(t,d)).forEach(c=>{const p=f()(t,[...d,c,i],void 0);if(p){let m=He(p,l);if(!l&&m.conditions){const g=He(m.conditions,!1);m={...m,conditions:g}}pe()(a,[...d,c,i],m)}});break}case"ON_CHANGE_COLLECTION_TYPE_ROW_LEFT_CHECKBOX":{const{pathToCollectionType:s,propertyName:i,rowName:l,value:d}=n;let c=_e()(t.modifiedData);const p=s.split(".."),m=f()(c,p,{});Object.keys(m).forEach(g=>{if(x()(m[g],`properties.${i}`)){const C=f()(m,[g,"properties",i,l]),S=[...p,g,"properties",i,l];if(!xe()(C))pe()(c,S,d);else{const W=He(C,d);pe()(c,S,W)}}}),d||(c=et(c)),pe()(a,"modifiedData",c);break}case"ON_CHANGE_CONDITIONS":{Object.entries(n.conditions).forEach(s=>{const[i,l]=s;pe()(a,["modifiedData",...i.split(".."),"conditions"],l)});break}case"ON_CHANGE_SIMPLE_CHECKBOX":{let s=_e()(t.modifiedData);pe()(s,[...n.keys.split("..")],n.value),n.value||(s=et(s)),pe()(a,"modifiedData",s);break}case"ON_CHANGE_TOGGLE_PARENT_CHECKBOX":{const{keys:s,value:i}=n,l=[...s.split("..")];let d=_e()(t.modifiedData);const c=f()(d,l,{}),p=He(c,i);pe()(d,l,p),i||(d=et(d)),pe()(a,["modifiedData"],d);break}case"RESET_FORM":{a.modifiedData=t.initialData;break}case"SET_FORM_AFTER_SUBMIT":{a.initialData=t.modifiedData;break}default:return a}});const tt=t=>Object.entries(t).filter(([,n])=>n).map(([n])=>n),zn=t=>{const[n,{conditions:a}]=t;return{action:n,subject:null,conditions:tt(a),properties:{}}},Xn=t=>Object.values(t).reduce((n,a)=>{const s=Object.entries(a).reduce((i,l)=>{const[,{properties:{enabled:d}}]=l;if(!d)return i;const c=zn(l);return i.push(c),i},[]);return[...n,...s]},[]);var kt=t=>Object.values(t).reduce((n,a)=>{const s=Xn(a);return[...n,...s]},[]);const It=(t,n="")=>Object.entries(t).reduce((a,s)=>{const[i,l]=s;return xe()(l)?[...a,...It(l,`${n}${i}.`)]:(l&&!xe()(l)&&a.push(`${n}${i}`),a)},[]),wn=(t,n,{conditions:a,properties:s})=>Object.entries(s).reduce((i,l)=>{const[d,c]=l;return i.properties[d]=It(c),i},{action:t,subject:n,conditions:tt(a),properties:{}}),Yn=(t,n,{conditions:a})=>({action:t,subject:n,properties:{},conditions:tt(a)}),Jn=(t,n)=>Object.entries(n).reduce((s,i)=>{const[l,d]=i;if(!Le(d).some(m=>m))return s;if(!d?.properties?.enabled){const m=wn(l,t,d);return[...s,m]}if(!d.properties.enabled)return s;const p=Yn(l,t,d);return s.push(p),s},[]);var Zt=t=>Object.entries(t).reduce((a,s)=>{const[i,l]=s,d=Jn(i,l);return[...a,...d]},[]),Qn=t=>{const n=kt(t.plugins),a=kt(t.settings),s=Zt(t.collectionTypes),i=Zt(t.singleTypes);return[...n,...a,...s,...i]},qn=[{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 nt=(0,e.forwardRef)(({layout:t,isFormDisabled:n,permissions:a},s)=>{const[{initialData:i,layouts:l,modifiedData:d},c]=(0,e.useReducer)(Gn,Kn,()=>Hn(t,a)),{formatMessage:p}=(0,F.Z)();(0,e.useImperativeHandle)(s,()=>({getPermissions(){const M=(0,T.e5)(i.collectionTypes,d.collectionTypes),E=(0,T.e5)(i.singleTypes,d.singleTypes),h={...M,...E};let L;return j()(h)?L=!1:L=Object.values(h).some(D=>Object.values(D).some(k=>x()(k,"conditions"))),{permissionsToSend:Qn(d),didUpdateConditions:L}},resetForm(){c({type:"RESET_FORM"})},setFormAfterSubmit(){c({type:"SET_FORM_AFTER_SUBMIT"})}}));const m=(M,E,h,L)=>{c({type:"ON_CHANGE_COLLECTION_TYPE_ROW_LEFT_CHECKBOX",pathToCollectionType:M,propertyName:E,rowName:h,value:L})},g=(M,E,h)=>{c({type:"ON_CHANGE_COLLECTION_TYPE_GLOBAL_ACTION_CHECKBOX",collectionTypeKind:M,actionId:E,value:h})},C=M=>{c({type:"ON_CHANGE_CONDITIONS",conditions:M})},S=(0,e.useCallback)(({target:{name:M,value:E}})=>{c({type:"ON_CHANGE_SIMPLE_CHECKBOX",keys:M,value:E})},[]),W=(0,e.useCallback)(({target:{name:M,value:E}})=>{c({type:"ON_CHANGE_TOGGLE_PARENT_CHECKBOX",keys:M,value:E})},[]);return e.createElement(Rn,{value:{availableConditions:t.conditions,modifiedData:d,onChangeConditions:C,onChangeSimpleCheckbox:S,onChangeParentCheckbox:W,onChangeCollectionTypeLeftActionRowCheckbox:m,onChangeCollectionTypeGlobalActionCheckbox:g}},e.createElement(I.v,{id:"tabs",label:p({id:"Settings.permissions.users.tabs.label",defaultMessage:"Tabs Permissions"})},e.createElement(b.m,null,qn.map(M=>e.createElement(b.O,{key:M.id},p({id:M.labelId,defaultMessage:M.defaultMessage})))),e.createElement(P.n,{style:{position:"relative"}},e.createElement(P.x,null,e.createElement(vt,{layout:l.collectionTypes,kind:"collectionTypes",isFormDisabled:n})),e.createElement(P.x,null,e.createElement(vt,{layout:l.singleTypes,kind:"singleTypes",isFormDisabled:n})),e.createElement(P.x,null,e.createElement(Pt,{layout:l.plugins,kind:"plugins",isFormDisabled:n})),e.createElement(P.x,null,e.createElement(Pt,{layout:l.settings,kind:"settings",isFormDisabled:n})))))});nt.defaultProps={permissions:[],layout:{conditions:[],sections:{collectionTypes:{},singleTypes:{actions:[]},settings:[],plugins:[]}}},nt.propTypes={layout:o().object,isFormDisabled:o().bool.isRequired,permissions:o().array};var _n=(0,e.memo)(nt)},33778:function(Y,Z,r){"use strict";r.r(Z),r.d(Z,{default:function(){return U}});var e=r(32735),v=r(24989),o=r(53038),T=r(83983),I=r(27649),b=r(82055),P=r(87933),R=r(41415),x=r(17e3),B=r(72850),j=r(92802),F=r(29439),y=r(33795),u=r.n(y),N=r(67879),Q=r(7247),z=r(49372),fe=r(15335),A=r(5803),X=r(10369),me=r(10508),f=r(60216),q=r.n(f);const w=({disabled:re,role:O,values:$,errors:_,onChange:se,onBlur:ce})=>{const{formatMessage:te}=(0,N.Z)();return e.createElement(B.x,{background:"neutral0",padding:6,shadow:"filterShadow",hasRadius:!0},e.createElement(P.k,{direction:"column",alignItems:"stretch",gap:4},e.createElement(P.k,{justifyContent:"space-between"},e.createElement(B.x,null,e.createElement(B.x,null,e.createElement(z.Z,{fontWeight:"bold"},O?O.name:te({id:"global.details",defaultMessage:"Details"}))),e.createElement(B.x,null,e.createElement(z.Z,{textColor:"neutral500",variant:"pi"},O?O.description:te({id:"Settings.roles.form.description",defaultMessage:"Name and description of the role"})))),e.createElement(R.z,{disabled:!0,variant:"secondary"},te({id:"Settings.roles.form.button.users-with-role",defaultMessage:"{number, plural, =0 {# users} one {# user} other {# users}} with this role"},{number:O.usersCount}))),e.createElement(fe.r,{gap:4},e.createElement(A.P,{col:6},e.createElement(X.o,{disabled:re,name:"name",error:_.name&&te({id:_.name}),label:te({id:"global.name",defaultMessage:"Name"}),onChange:se,onBlur:ce,value:$.name||""})),e.createElement(A.P,{col:6},e.createElement(me.g,{disabled:re,label:te({id:"global.description",defaultMessage:"Description"}),name:"description",error:_.name&&te({id:_.name}),onChange:se,onBlur:ce},$.description||"")))))};w.defaultProps={disabled:!1,role:null,values:{name:"",description:""}},w.propTypes={disabled:q().bool,errors:q().object.isRequired,onBlur:q().func.isRequired,onChange:q().func.isRequired,role:q().object,values:q().object};var ee=w,ie=r(67927),le=r(24346),ye=le.Ry().shape({name:le.Z_().required(v.I0.required)}),Ce=()=>{const re=(0,v.lm)(),{formatMessage:O}=(0,N.Z)(),{params:{id:$}}=(0,o.$B)("/settings/roles/:id"),[_,se]=(0,e.useState)(!1),ce=(0,e.useRef)(),{lockApp:te,unlockApp:ue}=(0,v.o1)(),{trackUsage:Ie}=(0,v.rS)(),{isLoading:Re,data:Ze}=(0,ie.U_)($),{role:he,permissions:Oe,isLoading:$e,onSubmitSucceeded:Be}=(0,ie.Dq)($),{put:De}=(0,v.kY)(),Ve=async ae=>{try{te(),se(!0);const{permissionsToSend:V,didUpdateConditions:K}=ce.current.getPermissions();await De(`/admin/roles/${$}`,ae),he.code!=="strapi-super-admin"&&(await De(`/admin/roles/${$}/permissions`,{permissions:V}),K&&Ie("didUpdateConditions")),ce.current.setFormAfterSubmit(),Be({name:ae.name,description:ae.description}),re({type:"success",message:{id:"notification.success.saved"}})}catch(V){console.error(V.response);const K=u()(V,"response.payload.message","An error occured"),ve=u()(V,"response.payload.data.permissions[0]",K);re({type:"warning",message:ve})}finally{se(!1),ue()}},je=he.code==="strapi-super-admin";return e.createElement(I.o,null,e.createElement(v.SL,{name:"Roles"}),e.createElement(j.J9,{enableReinitialize:!0,initialValues:{name:he.name,description:he.description},onSubmit:Ve,validationSchema:ye,validateOnChange:!1},({handleSubmit:ae,values:V,errors:K,handleChange:ve,handleBlur:Ee})=>e.createElement("form",{onSubmit:ae},e.createElement(b.T,{primaryAction:e.createElement(P.k,{gap:2},e.createElement(R.z,{disabled:he.code==="strapi-super-admin",onClick:ae,loading:_,size:"L"},O({id:"global.save",defaultMessage:"Save"}))),title:O({id:"Settings.roles.edit.title",defaultMessage:"Edit a role"}),subtitle:O({id:"Settings.roles.create.description",defaultMessage:"Define the rights given to the role"}),navigationAction:e.createElement(v.rU,{startIcon:e.createElement(F.Z,null),to:"/settings/roles"},O({id:"global.back",defaultMessage:"Back"}))}),e.createElement(x.D,null,e.createElement(P.k,{direction:"column",alignItems:"stretch",gap:6},e.createElement(ee,{isLoading:$e,disabled:je,errors:K,values:V,onChange:ve,onBlur:Ee,role:he}),!Re&&!$e?e.createElement(B.x,{shadow:"filterShadow",hasRadius:!0},e.createElement(Q.Z,{isFormDisabled:je,permissions:Oe,ref:ce,layout:Ze})):e.createElement(B.x,{background:"neutral0",padding:6,shadow:"filterShadow",hasRadius:!0},e.createElement(v.dO,null)))))))},U=()=>{const re=(0,e.useMemo)(()=>({read:T.Z.settings.roles.read,update:T.Z.settings.roles.update}),[]),{isLoading:O,allowedActions:{canRead:$,canUpdate:_}}=(0,v.ss)(re);return O?e.createElement(v.dO,null):!$&&!_?e.createElement(o.l_,{to:"/"}):e.createElement(Ce,null)}},84802:function(Y){function Z(r,e,v,o){for(var T=-1,I=r==null?0:r.length;++T<I;){var b=r[T];e(o,b,v(b),r)}return o}Y.exports=Z},62435:function(Y,Z,r){var e=r(56671);function v(o,T,I,b){return e(o,function(P,R,x){T(b,P,I(P),x)}),b}Y.exports=v},85580:function(Y,Z,r){var e=r(84802),v=r(62435),o=r(88904),T=r(77236);function I(b,P){return function(R,x){var B=T(R)?e:v,j=P?P():{};return B(R,b,o(x,2),j)}}Y.exports=I},72091:function(Y,Z,r){var e=r(40314),v=1/0;function o(T){var I=T==null?0:T.length;return I?e(T,v):[]}Y.exports=o},81346:function(Y,Z,r){var e=r(40999),v=r(85580),o=Object.prototype,T=o.hasOwnProperty,I=v(function(b,P,R){T.call(b,R)?b[R].push(P):e(b,R,[P])});Y.exports=I},83828:function(Y,Z,r){"use strict";r.d(Z,{U:function(){return F},y:function(){return B}});var e=r(74512),v=r(32735),o=r(8471),T=r(91045),I=r(74971),b=r(49372),P=r(87933),R=r(72850);const x=({theme:y,expanded:u,variant:N,disabled:Q,error:z})=>z?`1px solid ${y.colors.danger600} !important`:Q?`1px solid ${y.colors.neutral150}`:u?`1px solid ${y.colors.primary600}`:N==="primary"?`1px solid ${y.colors.neutral0}`:`1px solid ${y.colors.neutral100}`,B=(0,o.ZP)(b.Z)``,j=(0,o.ZP)(R.x)`
|
|
217
|
-
border: ${
|
|
216
|
+
`,xt=({categoryName:t,isFormDisabled:n,subCategoryName:a,actions:s,pathToData:i})=>{const[l,d]=(0,e.useState)(!1),{modifiedData:c,onChangeParentCheckbox:p,onChangeSimpleCheckbox:m}=(0,ee.$_)(),{formatMessage:g}=(0,I.Z)(),E=f()(c,i,{}),O=(0,e.useMemo)(()=>Object.keys(E).reduce((B,ne)=>(B[ne]=Ue(E[ne]),B),{}),[E]),{hasAllActionsSelected:W,hasSomeActionsSelected:$}=Pe(O),b=()=>{d(B=>!B)},h=()=>{d(!1)},Z=$n(s,c,i),L=Mn(f()(c,[...i],{}));return e.createElement(e.Fragment,null,e.createElement(y.x,null,e.createElement(T.k,{justifyContent:"space-between",alignItems:"center"},e.createElement(y.x,{paddingRight:4},e.createElement(D.Z,{variant:"sigma",textColor:"neutral600"},a)),e.createElement(Dn,null),e.createElement(y.x,{paddingLeft:4},e.createElement(bt.X,{name:i.join(".."),disabled:n,onValueChange:B=>{p({target:{name:i.join(".."),value:B}})},indeterminate:$,value:W},g({id:"app.utils.select-all",defaultMessage:"Select all"})))),e.createElement(T.k,{paddingTop:6,paddingBottom:6},e.createElement(Sn.r,{gap:2,style:{flex:1}},Z.map(({checkboxName:B,value:ne,action:U,displayName:J,hasConditions:H})=>e.createElement(On.P,{col:3,key:U},e.createElement(jn,{disabled:n,hasConditions:H},e.createElement(bt.X,{name:B,disabled:n,onValueChange:ge=>{m({target:{name:B,value:ge}})},value:ne},J))))),e.createElement(de,{hasConditions:L,onClick:b}))),l&&e.createElement(V,{headerBreadCrumbs:[t,a],actions:Z,isFormDisabled:n,onClosed:h,onToggle:b}))};xt.propTypes={actions:o().array.isRequired,categoryName:o().string.isRequired,isFormDisabled:o().bool.isRequired,subCategoryName:o().string.isRequired,pathToData:o().array.isRequired};var Ln=xt;const qe=({childrenForm:t,kind:n,name:a,isOpen:s,isFormDisabled:i,isWhite:l,onOpenCategory:d,pathToData:c})=>{const{formatMessage:p}=(0,I.Z)(),m=()=>{d(a)},g=(0,e.useMemo)(()=>a.split("::").pop(),[a]);return e.createElement(Pn.U,{expanded:s,onToggle:m,id:`accordion-${a}`,variant:l?"primary":"secondary"},e.createElement(An.B,{title:ue()(g),description:`${p({id:"Settings.permissions.category"},{category:g})} ${n==="plugins"?"plugin":n}`}),e.createElement(Tn.v,null,e.createElement(y.x,{padding:6},t.map(({actions:E,subCategoryName:O,subCategoryId:W})=>e.createElement(Ln,{key:O,actions:E,categoryName:g,isFormDisabled:i,subCategoryName:O,pathToData:[...c,W]})))))};qe.defaultProps={},qe.propTypes={childrenForm:o().array.isRequired,isOpen:o().bool.isRequired,isFormDisabled:o().bool.isRequired,isWhite:o().bool.isRequired,kind:o().string.isRequired,name:o().string.isRequired,onOpenCategory:o().func.isRequired,pathToData:o().array.isRequired};var kn=qe;const Rt=({isFormDisabled:t,kind:n,layout:a})=>{const[s,i]=(0,e.useState)(null),l=d=>{i(d===s?null:d)};return e.createElement(y.x,{padding:6,background:"neutral0"},a.map(({category:d,categoryId:c,childrenForm:p},m)=>e.createElement(kn,{key:d,childrenForm:p,kind:n,isFormDisabled:t,isOpen:s===d,isWhite:m%2===1,name:d,onOpenCategory:l,pathToData:[n,c]})))};Rt.propTypes={isFormDisabled:o().bool.isRequired,kind:o().string.isRequired,layout:o().arrayOf(o().shape({category:o().string.isRequired,categoryId:o().string.isRequired,childrenForm:o().arrayOf(o().shape({actions:o().array.isRequired})).isRequired}).isRequired).isRequired};var Pt=Rt,In=r(86349),Zn=r.n(In),Bn=r(3040),pe=r.n(Bn),At=(t,n,a)=>t.find(s=>s.action===n&&s.subject===a);const Tt=(t,n=[])=>t.reduce((a,s)=>(a[s.id]=n.indexOf(s.id)!==-1,a),{}),St=({children:t},n,a="")=>t.reduce((s,i)=>{if(i.children)return{...s,[i.value]:St(i,n,`${a}${i.value}.`)};const l=n.indexOf(`${a}${i.value}`)!==-1;return s[i.value]=l,s},{}),Fn=(t,n,a)=>t.reduce((s,i)=>{const l=n.properties.find(({value:d})=>d===i);if(l){const d=f()(a,["properties",l.value],[]),c=St(l,d);s.properties[i]=c}return s},{properties:{}}),Nn=(t,n)=>n.reduce((a,s)=>{const i=t.find(({uid:l})=>l===s)||null;return i&&(a[s]=i),a},{});var Ot=({subjects:t},n,a,s=[])=>n.reduce((i,l)=>{const d=l.subjects,c=Nn(t,d);if(A()(c))return i;const p=Object.keys(c).reduce((m,g)=>{const{actionId:E,applyToProperties:O}=l,b=c[g].properties.map(({value:B})=>B).every(B=>(O||[]).indexOf(B)===-1),h=At(s,E,g),Z=Tt(a,f()(h,"conditions",[]));if(A()(O)||b)return pe()(m,[g,E],{properties:{enabled:h!==void 0},conditions:Z}),m;const L=Fn(O,c[g],h);return pe()(m,[g,E],{...L,conditions:Z}),m},{});return Zn()(i,p)},{});const Wn=(t,n,a)=>t.reduce((s,i)=>{const l=At(a,i.action,null);return s[i.action]={properties:{enabled:l!==void 0},conditions:Tt(n,l?.conditions??[])},s},{}),Vn=(t,n,a)=>t.reduce((s,i)=>(s[i.subCategoryId]=Wn(i.actions,n,a),s),{});var $t=(t,n,a=[])=>t.reduce((s,{categoryId:i,childrenForm:l})=>{const d=Vn(l,n,a);return s[i]=d,s},{});const Mt=t=>t.split(" ").join("-");var Dt=(t,n)=>Object.entries(ce()(t,n)).map(([a,s])=>({category:a,categoryId:Mt(a),childrenForm:Object.entries(ce()(s,"subCategory")).map(([i,l])=>({subCategoryName:i,subCategoryId:Mt(i),actions:l}))})),Hn=(t,n)=>{const{conditions:a,sections:{collectionTypes:s,singleTypes:i,plugins:l,settings:d}}=t,c={collectionTypes:s,singleTypes:i,plugins:Dt(l,"plugin"),settings:Dt(d,"category")},p={collectionTypes:Ot(s,s.actions||[],a,n),singleTypes:Ot(i,i.actions||[],a,n),plugins:$t(c.plugins,a,n),settings:$t(c.settings,a,n)};return{initialData:p,modifiedData:p,layouts:c}},Gn=r(99381),_e=r.n(Gn);const jt=t=>Object.keys(t).reduce((n,a)=>{const s=t[a];if(xe()(s)&&!P()(s,"conditions"))return{...n,[a]:jt(s)};if(xe()(s)&&P()(s,"conditions")&&!Le(Y()(s,"conditions")).some(l=>l)){const l=Object.keys(s.conditions).reduce((d,c)=>(d[c]=!1,d),{});return{...n,[a]:{...s,conditions:l}}}return n[a]=s,n},{});var et=jt;const Lt=(t,n,a=!1)=>Object.keys(t).reduce((s,i)=>{const l=t[i];return i==="conditions"&&!a?(s[i]=l,s):xe()(l)?{...s,[i]:Lt(l,n,i==="fields")}:(s[i]=n,s)},{});var He=Lt;const Kn={initialData:{},modifiedData:{},layouts:{}};var Un=(t,n)=>(0,_.ZP)(t,a=>{switch(n.type){case"ON_CHANGE_COLLECTION_TYPE_GLOBAL_ACTION_CHECKBOX":{const{collectionTypeKind:s,actionId:i,value:l}=n,d=["modifiedData",s];Object.keys(f()(t,d)).forEach(c=>{const p=f()(t,[...d,c,i],void 0);if(p){let m=He(p,l);if(!l&&m.conditions){const g=He(m.conditions,!1);m={...m,conditions:g}}pe()(a,[...d,c,i],m)}});break}case"ON_CHANGE_COLLECTION_TYPE_ROW_LEFT_CHECKBOX":{const{pathToCollectionType:s,propertyName:i,rowName:l,value:d}=n;let c=_e()(t.modifiedData);const p=s.split(".."),m=f()(c,p,{});Object.keys(m).forEach(g=>{if(P()(m[g],`properties.${i}`)){const E=f()(m,[g,"properties",i,l]),O=[...p,g,"properties",i,l];if(!xe()(E))pe()(c,O,d);else{const W=He(E,d);pe()(c,O,W)}}}),d||(c=et(c)),pe()(a,"modifiedData",c);break}case"ON_CHANGE_CONDITIONS":{Object.entries(n.conditions).forEach(s=>{const[i,l]=s;pe()(a,["modifiedData",...i.split(".."),"conditions"],l)});break}case"ON_CHANGE_SIMPLE_CHECKBOX":{let s=_e()(t.modifiedData);pe()(s,[...n.keys.split("..")],n.value),n.value||(s=et(s)),pe()(a,"modifiedData",s);break}case"ON_CHANGE_TOGGLE_PARENT_CHECKBOX":{const{keys:s,value:i}=n,l=[...s.split("..")];let d=_e()(t.modifiedData);const c=f()(d,l,{}),p=He(c,i);pe()(d,l,p),i||(d=et(d)),pe()(a,["modifiedData"],d);break}case"RESET_FORM":{a.modifiedData=t.initialData;break}case"SET_FORM_AFTER_SUBMIT":{a.initialData=t.modifiedData;break}default:return a}});const tt=t=>Object.entries(t).filter(([,n])=>n).map(([n])=>n),zn=t=>{const[n,{conditions:a}]=t;return{action:n,subject:null,conditions:tt(a),properties:{}}},Xn=t=>Object.values(t).reduce((n,a)=>{const s=Object.entries(a).reduce((i,l)=>{const[,{properties:{enabled:d}}]=l;if(!d)return i;const c=zn(l);return i.push(c),i},[]);return[...n,...s]},[]);var kt=t=>Object.values(t).reduce((n,a)=>{const s=Xn(a);return[...n,...s]},[]);const It=(t,n="")=>Object.entries(t).reduce((a,s)=>{const[i,l]=s;return xe()(l)?[...a,...It(l,`${n}${i}.`)]:(l&&!xe()(l)&&a.push(`${n}${i}`),a)},[]),Yn=(t,n,{conditions:a,properties:s})=>Object.entries(s).reduce((i,l)=>{const[d,c]=l;return i.properties[d]=It(c),i},{action:t,subject:n,conditions:tt(a),properties:{}}),wn=(t,n,{conditions:a})=>({action:t,subject:n,properties:{},conditions:tt(a)}),Jn=(t,n)=>Object.entries(n).reduce((s,i)=>{const[l,d]=i;if(!Le(d).some(m=>m))return s;if(!d?.properties?.enabled){const m=Yn(l,t,d);return[...s,m]}if(!d.properties.enabled)return s;const p=wn(l,t,d);return s.push(p),s},[]);var Zt=t=>Object.entries(t).reduce((a,s)=>{const[i,l]=s,d=Jn(i,l);return[...a,...d]},[]),Qn=t=>{const n=kt(t.plugins),a=kt(t.settings),s=Zt(t.collectionTypes),i=Zt(t.singleTypes);return[...n,...a,...s,...i]},qn=[{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 nt=(0,e.forwardRef)(({layout:t,isFormDisabled:n,permissions:a},s)=>{const[{initialData:i,layouts:l,modifiedData:d},c]=(0,e.useReducer)(Un,Kn,()=>Hn(t,a)),{formatMessage:p}=(0,I.Z)();(0,e.useImperativeHandle)(s,()=>({getPermissions(){const $=(0,x.e5)(i.collectionTypes,d.collectionTypes),b=(0,x.e5)(i.singleTypes,d.singleTypes),h={...$,...b};let Z;return A()(h)?Z=!1:Z=Object.values(h).some(L=>Object.values(L).some(B=>P()(B,"conditions"))),{permissionsToSend:Qn(d),didUpdateConditions:Z}},resetForm(){c({type:"RESET_FORM"})},setFormAfterSubmit(){c({type:"SET_FORM_AFTER_SUBMIT"})}}));const m=($,b,h,Z)=>{c({type:"ON_CHANGE_COLLECTION_TYPE_ROW_LEFT_CHECKBOX",pathToCollectionType:$,propertyName:b,rowName:h,value:Z})},g=($,b,h)=>{c({type:"ON_CHANGE_COLLECTION_TYPE_GLOBAL_ACTION_CHECKBOX",collectionTypeKind:$,actionId:b,value:h})},E=$=>{c({type:"ON_CHANGE_CONDITIONS",conditions:$})},O=(0,e.useCallback)(({target:{name:$,value:b}})=>{c({type:"ON_CHANGE_SIMPLE_CHECKBOX",keys:$,value:b})},[]),W=(0,e.useCallback)(({target:{name:$,value:b}})=>{c({type:"ON_CHANGE_TOGGLE_PARENT_CHECKBOX",keys:$,value:b})},[]);return e.createElement(Rn,{value:{availableConditions:t.conditions,modifiedData:d,onChangeConditions:E,onChangeSimpleCheckbox:O,onChangeParentCheckbox:W,onChangeCollectionTypeLeftActionRowCheckbox:m,onChangeCollectionTypeGlobalActionCheckbox:g}},e.createElement(k.v,{id:"tabs",label:p({id:"Settings.permissions.users.tabs.label",defaultMessage:"Tabs Permissions"})},e.createElement(R.m,null,qn.map($=>e.createElement(R.O,{key:$.id},p({id:$.labelId,defaultMessage:$.defaultMessage})))),e.createElement(v.n,{style:{position:"relative"}},e.createElement(v.x,null,e.createElement(vt,{layout:l.collectionTypes,kind:"collectionTypes",isFormDisabled:n})),e.createElement(v.x,null,e.createElement(vt,{layout:l.singleTypes,kind:"singleTypes",isFormDisabled:n})),e.createElement(v.x,null,e.createElement(Pt,{layout:l.plugins,kind:"plugins",isFormDisabled:n})),e.createElement(v.x,null,e.createElement(Pt,{layout:l.settings,kind:"settings",isFormDisabled:n})))))});nt.defaultProps={permissions:[],layout:{conditions:[],sections:{collectionTypes:{},singleTypes:{actions:[]},settings:[],plugins:[]}}},nt.propTypes={layout:o().object,isFormDisabled:o().bool.isRequired,permissions:o().array};var _n=(0,e.memo)(nt)},33778:function(w,F,r){"use strict";r.r(F),r.d(F,{default:function(){return G}});var e=r(32735),C=r(24989),o=r(53038),x=r(83983),k=r(27649),R=r(82055),v=r(87933),S=r(41415),P=r(17e3),M=r(72850),A=r(92802),I=r(29439),y=r(33795),u=r.n(y),N=r(67879),Q=r(7247),z=r(49372),fe=r(15335),T=r(5803),X=r(10369),me=r(10508),f=r(60216),q=r.n(f);const Y=({disabled:re,role:D,values:j,errors:_,onChange:se,onBlur:ce})=>{const{formatMessage:te}=(0,N.Z)();return e.createElement(M.x,{background:"neutral0",padding:6,shadow:"filterShadow",hasRadius:!0},e.createElement(v.k,{direction:"column",alignItems:"stretch",gap:4},e.createElement(v.k,{justifyContent:"space-between"},e.createElement(M.x,null,e.createElement(M.x,null,e.createElement(z.Z,{fontWeight:"bold"},D?D.name:te({id:"global.details",defaultMessage:"Details"}))),e.createElement(M.x,null,e.createElement(z.Z,{textColor:"neutral500",variant:"pi"},D?D.description:te({id:"Settings.roles.form.description",defaultMessage:"Name and description of the role"})))),e.createElement(S.z,{disabled:!0,variant:"secondary"},te({id:"Settings.roles.form.button.users-with-role",defaultMessage:"{number, plural, =0 {# users} one {# user} other {# users}} with this role"},{number:D.usersCount}))),e.createElement(fe.r,{gap:4},e.createElement(T.P,{col:6},e.createElement(X.o,{disabled:re,name:"name",error:_.name&&te({id:_.name}),label:te({id:"global.name",defaultMessage:"Name"}),onChange:se,onBlur:ce,value:j.name||""})),e.createElement(T.P,{col:6},e.createElement(me.g,{disabled:re,label:te({id:"global.description",defaultMessage:"Description"}),name:"description",error:_.name&&te({id:_.name}),onChange:se,onBlur:ce},j.description||"")))))};Y.defaultProps={disabled:!1,role:null,values:{name:"",description:""}},Y.propTypes={disabled:q().bool,errors:q().object.isRequired,onBlur:q().func.isRequired,onChange:q().func.isRequired,role:q().object,values:q().object};var ee=Y,ie=r(67927),le=r(24346),ye=le.Ry().shape({name:le.Z_().required(C.I0.required)}),Ce=()=>{const re=(0,C.lm)(),{formatMessage:D}=(0,N.Z)(),{params:{id:j}}=(0,o.$B)("/settings/roles/:id"),[_,se]=(0,e.useState)(!1),ce=(0,e.useRef)(),{lockApp:te,unlockApp:ue}=(0,C.o1)(),{trackUsage:Ie}=(0,C.rS)(),{isLoading:Re,data:Ze}=(0,ie.U_)(j),{role:he,permissions:$e,isLoading:Me,onSubmitSucceeded:Be}=(0,ie.Dq)(j),{put:De}=(0,C.kY)(),Ve=async ae=>{try{te(),se(!0);const{permissionsToSend:V,didUpdateConditions:K}=ce.current.getPermissions();await De(`/admin/roles/${j}`,ae),he.code!=="strapi-super-admin"&&(await De(`/admin/roles/${j}/permissions`,{permissions:V}),K&&Ie("didUpdateConditions")),ce.current.setFormAfterSubmit(),Be({name:ae.name,description:ae.description}),re({type:"success",message:{id:"notification.success.saved"}})}catch(V){console.error(V.response);const K=u()(V,"response.payload.message","An error occured"),ve=u()(V,"response.payload.data.permissions[0]",K);re({type:"warning",message:ve})}finally{se(!1),ue()}},je=he.code==="strapi-super-admin";return e.createElement(k.o,null,e.createElement(C.SL,{name:"Roles"}),e.createElement(A.J9,{enableReinitialize:!0,initialValues:{name:he.name,description:he.description},onSubmit:Ve,validationSchema:ye,validateOnChange:!1},({handleSubmit:ae,values:V,errors:K,handleChange:ve,handleBlur:Ee})=>e.createElement("form",{onSubmit:ae},e.createElement(R.T,{primaryAction:e.createElement(v.k,{gap:2},e.createElement(S.z,{disabled:he.code==="strapi-super-admin",onClick:ae,loading:_,size:"L"},D({id:"global.save",defaultMessage:"Save"}))),title:D({id:"Settings.roles.edit.title",defaultMessage:"Edit a role"}),subtitle:D({id:"Settings.roles.create.description",defaultMessage:"Define the rights given to the role"}),navigationAction:e.createElement(C.rU,{startIcon:e.createElement(I.Z,null),to:"/settings/roles"},D({id:"global.back",defaultMessage:"Back"}))}),e.createElement(P.D,null,e.createElement(v.k,{direction:"column",alignItems:"stretch",gap:6},e.createElement(ee,{isLoading:Me,disabled:je,errors:K,values:V,onChange:ve,onBlur:Ee,role:he}),!Re&&!Me?e.createElement(M.x,{shadow:"filterShadow",hasRadius:!0},e.createElement(Q.Z,{isFormDisabled:je,permissions:$e,ref:ce,layout:Ze})):e.createElement(M.x,{background:"neutral0",padding:6,shadow:"filterShadow",hasRadius:!0},e.createElement(C.dO,null)))))))},G=()=>{const re=(0,e.useMemo)(()=>({read:x.Z.settings.roles.read,update:x.Z.settings.roles.update}),[]),{isLoading:D,allowedActions:{canRead:j,canUpdate:_}}=(0,C.ss)(re);return D?e.createElement(C.dO,null):!j&&!_?e.createElement(o.l_,{to:"/"}):e.createElement(Ce,null)}},84802:function(w){function F(r,e,C,o){for(var x=-1,k=r==null?0:r.length;++x<k;){var R=r[x];e(o,R,C(R),r)}return o}w.exports=F},62435:function(w,F,r){var e=r(56671);function C(o,x,k,R){return e(o,function(v,S,P){x(R,v,k(v),P)}),R}w.exports=C},85580:function(w,F,r){var e=r(84802),C=r(62435),o=r(88904),x=r(77236);function k(R,v){return function(S,P){var M=x(S)?e:C,A=v?v():{};return M(S,R,o(P,2),A)}}w.exports=k},72091:function(w,F,r){var e=r(40314),C=1/0;function o(x){var k=x==null?0:x.length;return k?e(x,C):[]}w.exports=o},81346:function(w,F,r){var e=r(40999),C=r(85580),o=Object.prototype,x=o.hasOwnProperty,k=C(function(R,v,S){x.call(R,S)?R[S].push(v):e(R,S,[v])});w.exports=k},83828:function(w,F,r){"use strict";r.d(F,{U:function(){return I},y:function(){return M}});var e=r(74512),C=r(32735),o=r(8471),x=r(91045),k=r(72850),R=r(87933),v=r(74971),S=r(49372);const P=({theme:y,expanded:u,variant:N,disabled:Q,error:z})=>z?`1px solid ${y.colors.danger600} !important`:Q?`1px solid ${y.colors.neutral150}`:u?`1px solid ${y.colors.primary600}`:N==="primary"?`1px solid ${y.colors.neutral0}`:`1px solid ${y.colors.neutral100}`,M=(0,o.ZP)(S.Z)``,A=(0,o.ZP)(k.x)`
|
|
217
|
+
border: ${P};
|
|
218
218
|
|
|
219
219
|
&:hover:not([aria-disabled='true']) {
|
|
220
220
|
border: 1px solid ${({theme:y})=>y.colors.primary600};
|
|
221
221
|
|
|
222
|
-
${
|
|
222
|
+
${M} {
|
|
223
223
|
color: ${({theme:y,expanded:u})=>u?void 0:y.colors.primary700};
|
|
224
224
|
}
|
|
225
225
|
|
|
226
|
-
${
|
|
226
|
+
${S.Z} {
|
|
227
227
|
color: ${({theme:y,expanded:u})=>u?void 0:y.colors.primary600};
|
|
228
228
|
}
|
|
229
229
|
|
|
230
|
-
& > ${
|
|
230
|
+
& > ${R.k} {
|
|
231
231
|
background: ${({theme:y})=>y.colors.primary100};
|
|
232
232
|
}
|
|
233
233
|
|
|
@@ -235,7 +235,7 @@
|
|
|
235
235
|
background: ${({theme:y})=>y.colors.primary200};
|
|
236
236
|
}
|
|
237
237
|
}
|
|
238
|
-
`,
|
|
238
|
+
`,I=({children:y,disabled:u=!1,error:N,expanded:Q=!1,hasErrorMessage:z=!0,id:fe,onToggle:T,toggle:X,size:me="M",variant:f="primary",shadow:q})=>{const Y=(0,v.M)(fe),ee=C.useMemo(()=>({expanded:Q,onToggle:T,toggle:X,id:Y,size:me,variant:f,disabled:u}),[u,Q,Y,T,me,X,f]);return(0,e.jsxs)(x.S.Provider,{value:ee,children:[(0,e.jsx)(A,{"data-strapi-expanded":Q,disabled:u,"aria-disabled":u,expanded:Q,hasRadius:!0,variant:f,error:N,shadow:q,children:y}),N&&z&&(0,e.jsx)(k.x,{paddingTop:1,children:(0,e.jsx)(S.Z,{variant:"pi",textColor:"danger600",children:N})})]})}},89966:function(w,F,r){"use strict";r.d(F,{v:function(){return x}});var e=r(74512),C=r(91045),o=r(72850);const x=({children:k,...R})=>{const{expanded:v,id:S}=(0,C.A)();if(!v)return null;const P=`accordion-content-${S}`,M=`accordion-label-${S}`,A=`accordion-desc-${S}`;return(0,e.jsx)(o.x,{role:"region",id:P,"aria-labelledby":M,"aria-describedby":A,...R,children:k})}},91045:function(w,F,r){"use strict";r.d(F,{A:function(){return o},S:function(){return C}});var e=r(32735);const C=(0,e.createContext)({disabled:!1,expanded:!1,id:"",size:"M",variant:"primary"}),o=()=>(0,e.useContext)(C)},61762:function(w,F,r){"use strict";r.d(F,{B:function(){return y}});var e=r(74512),C=r(16899),o=r(8471),x=r(83828),k=r(91045);const R=({expanded:u,disabled:N,variant:Q})=>{let z="neutral100";return u?z="primary100":N?z="neutral150":Q==="primary"&&(z="neutral0"),z};var v=r(87933),S=r(99140),P=r(7563),M=r(49372);const A=(0,o.ZP)(P.A)`
|
|
239
239
|
text-align: left;
|
|
240
240
|
|
|
241
241
|
// necessary to make the ellipsis prop work on the title
|
|
@@ -251,7 +251,7 @@
|
|
|
251
251
|
fill: ${({theme:u,expanded:N})=>N?u.colors.primary600:u.colors.neutral500};
|
|
252
252
|
}
|
|
253
253
|
}
|
|
254
|
-
`,
|
|
254
|
+
`,I=(0,o.ZP)(v.k)`
|
|
255
255
|
min-height: ${({theme:u,size:N})=>u.sizes.accordions[N]};
|
|
256
256
|
border-radius: ${({theme:u,expanded:N})=>N?`${u.borderRadius} ${u.borderRadius} 0 0`:u.borderRadius};
|
|
257
257
|
|
|
@@ -262,21 +262,19 @@
|
|
|
262
262
|
}
|
|
263
263
|
}
|
|
264
264
|
}
|
|
265
|
-
`,y=({title:u,description:N,as:Q="span",togglePosition:z="right",action:fe,...
|
|
265
|
+
`,y=({title:u,description:N,as:Q="span",togglePosition:z="right",action:fe,...T})=>{const{onToggle:X,toggle:me,expanded:f,id:q,size:Y,variant:ee,disabled:ie}=(0,k.A)(),le=`accordion-content-${q}`,Se=`accordion-label-${q}`,ye=`accordion-desc-${q}`,de=Y==="M"?6:4,Ce=Y==="M"?de:de-2,Oe=R({expanded:f,disabled:ie,variant:ee}),G={as:Q,fontWeight:Y==="S"?"bold":void 0,id:Se,textColor:f?"primary600":"neutral700",ellipsis:!0,variant:Y==="M"?"delta":void 0},re=f?"primary600":"neutral600",D=f?"primary200":"neutral200",j=Y==="M"?`${32/16}rem`:`${24/16}rem`,_=()=>{ie||(me&&!X?(console.warn('Deprecation warning: Usage of "toggle" prop in Accordion component is deprecated. This is discouraged and will be removed in the next major release. Please use "onToggle" instead'),me()):X&&X())},se=(0,e.jsx)(v.k,{justifyContent:"center",borderRadius:"50%",height:j,width:j,transform:f?"rotate(180deg)":void 0,"data-strapi-dropdown":!0,"aria-hidden":!0,as:"span",background:D,cursor:ie?"not-allowed":"pointer",onClick:_,shrink:0,children:(0,e.jsx)(S.J,{as:C.Z,width:Y==="M"?`${11/16}rem`:`${8/16}rem`,color:f?"primary600":"neutral600"})});return(0,e.jsx)(I,{paddingBottom:Ce,paddingLeft:de,paddingRight:de,paddingTop:Ce,background:Oe,expanded:f,size:Y,justifyContent:"space-between",cursor:ie?"not-allowed":"",children:(0,e.jsxs)(v.k,{gap:3,flex:1,maxWidth:"100%",children:[z==="left"&&se,(0,e.jsx)(A,{onClick:_,"aria-disabled":ie,"aria-expanded":f,"aria-controls":le,"aria-labelledby":Se,"data-strapi-accordion-toggle":!0,expanded:f,type:"button",flex:1,minWidth:0,...T,children:(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(x.y,{...G,children:u}),N&&(0,e.jsx)(M.Z,{as:"p",id:ye,textColor:re,children:N})]})}),z==="right"&&(0,e.jsxs)(v.k,{gap:3,children:[se,fe]}),z==="left"&&fe]})})}},11299:function(w,F,r){"use strict";r.d(F,{$:function(){return P},O:function(){return M}});var e=r(74512),C=r(77277),o=r(8471),x=r(72850),k=r(87933),R=r(49372),v=r(3685);const S=(0,o.ZP)(k.k)`
|
|
266
266
|
svg {
|
|
267
267
|
height: ${10/16}rem;
|
|
268
268
|
width: ${10/16}rem;
|
|
269
269
|
path {
|
|
270
|
-
fill: ${({theme:
|
|
270
|
+
fill: ${({theme:A})=>A.colors.neutral500};
|
|
271
271
|
}
|
|
272
272
|
}
|
|
273
|
-
:last-of-type ${
|
|
273
|
+
:last-of-type ${x.x} {
|
|
274
274
|
display: none;
|
|
275
275
|
}
|
|
276
|
-
:last-of-type ${
|
|
277
|
-
color: ${({theme:
|
|
278
|
-
font-weight: ${({theme:
|
|
276
|
+
:last-of-type ${R.Z} {
|
|
277
|
+
color: ${({theme:A})=>A.colors.neutral800};
|
|
278
|
+
font-weight: ${({theme:A})=>A.fontWeights.bold};
|
|
279
279
|
}
|
|
280
|
-
`,
|
|
281
|
-
padding-left: ${({theme:b})=>b.spaces[7]};
|
|
282
|
-
`}}]);
|
|
280
|
+
`,P=({children:A})=>(0,e.jsxs)(S,{inline:!0,as:"li",children:[(0,e.jsx)(R.Z,{variant:"pi",textColor:"neutral600",children:A}),(0,e.jsx)(x.x,{"aria-hidden":!0,paddingLeft:3,paddingRight:3,children:(0,e.jsx)(C.Z,{})})]});P.displayName="Crumb";const M=({children:A,label:I,...y})=>(0,e.jsxs)(k.k,{...y,children:[(0,e.jsx)(v.T,{children:I}),(0,e.jsx)("ol",{"aria-hidden":!0,children:A})]});M.displayName="Breadcrumbs"},47328:function(w,F,r){"use strict";r.d(F,{Q:function(){return R}});var e=r(32735),C=r(60216),o=r(84967);const x=({children:v,label:S,...P})=>{const M=v.map(A=>A.props.value);return e.createElement(e.Fragment,null,e.createElement(o.W,{"data-opt-group":!0,"data-opt-group-children":M,"aria-label":`${S}, ${v.length} items`,...P},S),v)};x.propTypes={children:C.arrayOf(C.node).isRequired,label:C.string.isRequired},x.displayName="OptGroup";var k=r(80084);const R=({options:v,...S})=>e.createElement(k.P,{multi:!0,...S},v.map(({label:P,value:M,children:A})=>A?e.createElement(x,{key:P,label:P},A?.map(I=>e.createElement(o.W,{key:I.value,value:I.value},I.label))):e.createElement(o.W,{key:M,value:M},P)));R.propTypes={options:C.arrayOf(C.object).isRequired}}}]);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_strapi_admin=self.webpackChunk_strapi_admin||[]).push([[4263],{40874:function(T,l,e){e.r(l),e.d(l,{default:function(){return ne}});var t=e(32735),a=e(24989),s=e(53038),d=e(83983),i=e(20011),g=e(67879),n=e(60216),p=e.n(n),m=e(88423),c=e.n(m),f=e(33795),M=e.n(f),R=e(9086),Z=e.n(R),U=e(20108),A=e(92802),O=e(27649),S=e(82055),x=e(41415),z=e(17e3),W=e(72850),h=e(87933),$=e(49372),b=e(15335),j=e(5803),w=e(66456),N=e(29439),u=e(8997);const J=async y=>{const{get:P}=(0,a.tg)(),{data:o}=await P(`/admin/users/${y}`);return o.data},k=async(y,P)=>{const{put:o}=(0,a.tg)(),{data:v}=await o(`/admin/users/${y}`,P);return v.data};var q=[[{intlLabel:{id:"Auth.form.firstname.label",defaultMessage:"First name"},name:"firstname",placeholder:{id:"Auth.form.firstname.placeholder",defaultMessage:"e.g. Kai"},type:"text",size:{col:6,xs:12},required:!0},{intlLabel:{id:"Auth.form.lastname.label",defaultMessage:"Last name"},name:"lastname",placeholder:{id:"Auth.form.lastname.placeholder",defaultMessage:"e.g. Doe"},type:"text",size:{col:6,xs:12}}],[{intlLabel:{id:"Auth.form.email.label",defaultMessage:"Email"},name:"email",placeholder:{id:"Auth.form.email.placeholder",defaultMessage:"e.g. kai.doe@strapi.io"},type:"email",size:{col:6,xs:12},required:!0},{intlLabel:{id:"Auth.form.username.label",defaultMessage:"Username"},name:"username",placeholder:{id:"Auth.form.username.placeholder",defaultMessage:"e.g. Kai_Doe"},type:"text",size:{col:6,xs:12}}],[{intlLabel:{id:"global.password",defaultMessage:"Password"},name:"password",type:"password",size:{col:6,xs:12},autoComplete:"new-password"},{intlLabel:{id:"Auth.form.confirmPassword.label",defaultMessage:"Password confirmation"},name:"confirmPassword",type:"password",size:{col:6,xs:12},autoComplete:"new-password"}],[{intlLabel:{id:"Auth.form.active.label",defaultMessage:"Active"},name:"isActive",type:"bool",size:{col:6,xs:12}}]],ee=e(1057),te=e(4397);const ae=(()=>window&&window.strapi&&window.strapi.isEE?e(28890).Z:e(16325).Z)(),G=["email","firstname","lastname","username","isActive","roles"],Q=y=>{let{canUpdate:P}=y;const{formatMessage:o}=(0,g.Z)(),{params:{id:v}}=(0,s.$B)("/settings/users/:id"),{push:C}=(0,s.k6)(),{setUserDisplayName:Y}=(0,a.L7)(),_=(0,a.lm)(),{lockApp:oe,unlockApp:re}=(0,a.o1)();(0,a.go)();const{status:le,data:K}=(0,U.useQuery)(["user",v],()=>J(v),{retry:!1,onError(r){r.response.status===403&&(_({type:"info",message:{id:"notification.permission.not-allowed-read",defaultMessage:"You are not allowed to see this document"}}),C("/")),console.log(r.response.status)}}),ie=async(r,E)=>{oe();try{const L=await k(v,Z()(r,"confirmPassword"));_({type:"success",message:o({id:"notification.success.saved",defaultMessage:"Saved"})});const D=a.I8.getUserInfo();if(v.toString()===D.id.toString()){a.I8.setUserInfo(L);const B=M()(r,"username")||(0,u.Pp)(r.firstname,r.lastname);Y(B)}E.setValues(c()(r,G))}catch(L){const D=(0,u.Iz)(L.response.data),B=Object.keys(D).reduce((H,I)=>(H[I]=D[I].id,H),{});E.setErrors(B),_({type:"warning",message:M()(L,"response.data.error.message","notification.error")})}re()},V=le!=="success",de=V?{id:"app.containers.Users.EditPage.header.label-loading",defaultMessage:"Edit user"}:{id:"app.containers.Users.EditPage.header.label",defaultMessage:"Edit {name}"},F=Object.keys(c()(K,G)).reduce((r,E)=>E==="roles"?(r[E]=(K?.roles||[]).map(L=>{let{id:D}=L;return D}),r):(r[E]=K?.[E],r),{}),ce=F.username||(0,u.Pp)(F.firstname,F.lastname),X=o(de,{name:ce});return V?t.createElement(O.o,{"aria-busy":"true"},t.createElement(a.SL,{name:"Users"}),t.createElement(S.T,{primaryAction:t.createElement(x.z,{disabled:!0,startIcon:t.createElement(w.Z,null),type:"button",size:"L"},o({id:"global.save",defaultMessage:"Save"})),title:X,navigationAction:t.createElement(a.rU,{startIcon:t.createElement(N.Z,null),to:"/settings/users?pageSize=10&page=1&sort=firstname"},o({id:"global.back",defaultMessage:"Back"}))}),t.createElement(z.D,null,t.createElement(a.dO,null))):t.createElement(O.o,null,t.createElement(a.SL,{name:"Users"}),t.createElement(A.J9,{onSubmit:ie,initialValues:F,validateOnChange:!1,validationSchema:ee.YM},r=>{let{errors:E,values:L,handleChange:D,isSubmitting:B}=r;return t.createElement(a.l0,null,t.createElement(S.T,{primaryAction:t.createElement(x.z,{disabled:B||!P,startIcon:t.createElement(w.Z,null),loading:B,type:"submit",size:"L"},o({id:"global.save",defaultMessage:"Save"})),title:X,navigationAction:t.createElement(a.rU,{startIcon:t.createElement(N.Z,null),to:"/settings/users?pageSize=10&page=1&sort=firstname"},o({id:"global.back",defaultMessage:"Back"}))}),t.createElement(z.D,null,K?.registrationToken&&t.createElement(W.x,{paddingBottom:6},t.createElement(ae,{registrationToken:K.registrationToken})),t.createElement(h.k,{direction:"column",alignItems:"stretch",gap:7},t.createElement(W.x,{background:"neutral0",hasRadius:!0,shadow:"filterShadow",paddingTop:6,paddingBottom:6,paddingLeft:7,paddingRight:7},t.createElement(h.k,{direction:"column",alignItems:"stretch",gap:4},t.createElement($.Z,{variant:"delta",as:"h2"},o({id:"app.components.Users.ModalCreateBody.block-title.details",defaultMessage:"Details"})),t.createElement(b.r,{gap:5},q.map(H=>H.map(I=>t.createElement(j.P,(0,i.Z)({key:I.name},I.size),t.createElement(a.jm,(0,i.Z)({},I,{disabled:!P,error:E[I.name],onChange:D,value:L[I.name]||""})))))))),t.createElement(W.x,{background:"neutral0",hasRadius:!0,shadow:"filterShadow",paddingTop:6,paddingBottom:6,paddingLeft:7,paddingRight:7},t.createElement(h.k,{direction:"column",alignItems:"stretch",gap:4},t.createElement($.Z,{variant:"delta",as:"h2"},o({id:"global.roles",defaultMessage:"User's role"})),t.createElement(b.r,{gap:5},t.createElement(j.P,{col:6,xs:12},t.createElement(te.Z,{disabled:!P,error:E.roles,onChange:D,value:L.roles}))))))))}))};Q.propTypes={canUpdate:p().bool.isRequired};var se=Q,ne=()=>{const y=(0,a.lm)(),P=(0,t.useMemo)(()=>({read:d.Z.settings.users.read,update:d.Z.settings.users.update}),[]),{isLoading:o,allowedActions:{canRead:v,canUpdate:C}}=(0,a.ss)(P),{state:Y}=(0,s.TH)(),_=Y?.from??"/";return(0,t.useEffect)(()=>{o||!v&&!C&&y({type:"info",message:{id:"notification.permission.not-allowed-read",defaultMessage:"You are not allowed to see this document"}})},[o,v,C,y]),o?t.createElement(a.dO,null):!v&&!C?t.createElement(s.l_,{to:_}):t.createElement(se,{canUpdate:C})}},76779:function(T,l,e){var t=e(32735),a=e(60216),s=e.n(a),d=e(50563),i=e(24989),g=e(47765),n=e(59087),p=e.n(n),m=e(67879);const c=({children:f,target:M})=>{const R=(0,i.lm)(),{formatMessage:Z}=(0,m.Z)(),U=()=>{R({type:"info",message:{id:"notification.link-copied"}})},A=Z({id:"app.component.CopyToClipboard.label",defaultMessage:"Copy to clipboard"});return t.createElement(i.Y_,{endAction:t.createElement(n.CopyToClipboard,{onCopy:U,text:M},t.createElement(d.h,{label:A,noBorder:!0,icon:t.createElement(g.Z,null)})),title:M,titleEllipsis:!0,subtitle:f,icon:t.createElement("span",{style:{fontSize:32}},"\u2709\uFE0F"),iconBackground:"neutral100"})};c.propTypes={children:s().oneOfType([s().element,s().string]).isRequired,target:s().string.isRequired},l.Z=c},16325:function(T,l,e){var t=e(32735),a=e(67879),s=e(60216),d=e.n(s),i=e(78246),g=e(76779);const n=({registrationToken:p})=>{const{formatMessage:m}=(0,a.Z)(),c=`${window.location.origin}${i.Z}auth/register?registrationToken=${p}`;return t.createElement(g.Z,{target:c},m({id:"app.components.Users.MagicLink.connect",defaultMessage:"Copy and share this link to give access to this user"}))};n.defaultProps={registrationToken:""},n.propTypes={registrationToken:d().string},l.Z=n},4397:function(T,l,e){var t=e(32735),a=e(60216),s=e.n(a),d=e(67879),i=e(
|
|
1
|
+
"use strict";(self.webpackChunk_strapi_admin=self.webpackChunk_strapi_admin||[]).push([[4263],{40874:function(T,l,e){e.r(l),e.d(l,{default:function(){return ne}});var t=e(32735),a=e(24989),s=e(53038),d=e(83983),i=e(20011),g=e(67879),n=e(60216),p=e.n(n),m=e(88423),c=e.n(m),f=e(33795),M=e.n(f),R=e(9086),Z=e.n(R),U=e(20108),A=e(92802),O=e(27649),S=e(82055),x=e(41415),z=e(17e3),W=e(72850),h=e(87933),$=e(49372),b=e(15335),j=e(5803),w=e(66456),N=e(29439),u=e(8997);const J=async y=>{const{get:P}=(0,a.tg)(),{data:o}=await P(`/admin/users/${y}`);return o.data},k=async(y,P)=>{const{put:o}=(0,a.tg)(),{data:v}=await o(`/admin/users/${y}`,P);return v.data};var q=[[{intlLabel:{id:"Auth.form.firstname.label",defaultMessage:"First name"},name:"firstname",placeholder:{id:"Auth.form.firstname.placeholder",defaultMessage:"e.g. Kai"},type:"text",size:{col:6,xs:12},required:!0},{intlLabel:{id:"Auth.form.lastname.label",defaultMessage:"Last name"},name:"lastname",placeholder:{id:"Auth.form.lastname.placeholder",defaultMessage:"e.g. Doe"},type:"text",size:{col:6,xs:12}}],[{intlLabel:{id:"Auth.form.email.label",defaultMessage:"Email"},name:"email",placeholder:{id:"Auth.form.email.placeholder",defaultMessage:"e.g. kai.doe@strapi.io"},type:"email",size:{col:6,xs:12},required:!0},{intlLabel:{id:"Auth.form.username.label",defaultMessage:"Username"},name:"username",placeholder:{id:"Auth.form.username.placeholder",defaultMessage:"e.g. Kai_Doe"},type:"text",size:{col:6,xs:12}}],[{intlLabel:{id:"global.password",defaultMessage:"Password"},name:"password",type:"password",size:{col:6,xs:12},autoComplete:"new-password"},{intlLabel:{id:"Auth.form.confirmPassword.label",defaultMessage:"Password confirmation"},name:"confirmPassword",type:"password",size:{col:6,xs:12},autoComplete:"new-password"}],[{intlLabel:{id:"Auth.form.active.label",defaultMessage:"Active"},name:"isActive",type:"bool",size:{col:6,xs:12}}]],ee=e(1057),te=e(4397);const ae=(()=>window&&window.strapi&&window.strapi.isEE?e(28890).Z:e(16325).Z)(),G=["email","firstname","lastname","username","isActive","roles"],Q=y=>{let{canUpdate:P}=y;const{formatMessage:o}=(0,g.Z)(),{params:{id:v}}=(0,s.$B)("/settings/users/:id"),{push:C}=(0,s.k6)(),{setUserDisplayName:Y}=(0,a.L7)(),_=(0,a.lm)(),{lockApp:oe,unlockApp:re}=(0,a.o1)();(0,a.go)();const{status:le,data:K}=(0,U.useQuery)(["user",v],()=>J(v),{retry:!1,onError(r){r.response.status===403&&(_({type:"info",message:{id:"notification.permission.not-allowed-read",defaultMessage:"You are not allowed to see this document"}}),C("/")),console.log(r.response.status)}}),ie=async(r,E)=>{oe();try{const L=await k(v,Z()(r,"confirmPassword"));_({type:"success",message:o({id:"notification.success.saved",defaultMessage:"Saved"})});const D=a.I8.getUserInfo();if(v.toString()===D.id.toString()){a.I8.setUserInfo(L);const B=M()(r,"username")||(0,u.Pp)(r.firstname,r.lastname);Y(B)}E.setValues(c()(r,G))}catch(L){const D=(0,u.Iz)(L.response.data),B=Object.keys(D).reduce((H,I)=>(H[I]=D[I].id,H),{});E.setErrors(B),_({type:"warning",message:M()(L,"response.data.error.message","notification.error")})}re()},V=le!=="success",de=V?{id:"app.containers.Users.EditPage.header.label-loading",defaultMessage:"Edit user"}:{id:"app.containers.Users.EditPage.header.label",defaultMessage:"Edit {name}"},F=Object.keys(c()(K,G)).reduce((r,E)=>E==="roles"?(r[E]=(K?.roles||[]).map(L=>{let{id:D}=L;return D}),r):(r[E]=K?.[E],r),{}),ce=F.username||(0,u.Pp)(F.firstname,F.lastname),X=o(de,{name:ce});return V?t.createElement(O.o,{"aria-busy":"true"},t.createElement(a.SL,{name:"Users"}),t.createElement(S.T,{primaryAction:t.createElement(x.z,{disabled:!0,startIcon:t.createElement(w.Z,null),type:"button",size:"L"},o({id:"global.save",defaultMessage:"Save"})),title:X,navigationAction:t.createElement(a.rU,{startIcon:t.createElement(N.Z,null),to:"/settings/users?pageSize=10&page=1&sort=firstname"},o({id:"global.back",defaultMessage:"Back"}))}),t.createElement(z.D,null,t.createElement(a.dO,null))):t.createElement(O.o,null,t.createElement(a.SL,{name:"Users"}),t.createElement(A.J9,{onSubmit:ie,initialValues:F,validateOnChange:!1,validationSchema:ee.YM},r=>{let{errors:E,values:L,handleChange:D,isSubmitting:B}=r;return t.createElement(a.l0,null,t.createElement(S.T,{primaryAction:t.createElement(x.z,{disabled:B||!P,startIcon:t.createElement(w.Z,null),loading:B,type:"submit",size:"L"},o({id:"global.save",defaultMessage:"Save"})),title:X,navigationAction:t.createElement(a.rU,{startIcon:t.createElement(N.Z,null),to:"/settings/users?pageSize=10&page=1&sort=firstname"},o({id:"global.back",defaultMessage:"Back"}))}),t.createElement(z.D,null,K?.registrationToken&&t.createElement(W.x,{paddingBottom:6},t.createElement(ae,{registrationToken:K.registrationToken})),t.createElement(h.k,{direction:"column",alignItems:"stretch",gap:7},t.createElement(W.x,{background:"neutral0",hasRadius:!0,shadow:"filterShadow",paddingTop:6,paddingBottom:6,paddingLeft:7,paddingRight:7},t.createElement(h.k,{direction:"column",alignItems:"stretch",gap:4},t.createElement($.Z,{variant:"delta",as:"h2"},o({id:"app.components.Users.ModalCreateBody.block-title.details",defaultMessage:"Details"})),t.createElement(b.r,{gap:5},q.map(H=>H.map(I=>t.createElement(j.P,(0,i.Z)({key:I.name},I.size),t.createElement(a.jm,(0,i.Z)({},I,{disabled:!P,error:E[I.name],onChange:D,value:L[I.name]||""})))))))),t.createElement(W.x,{background:"neutral0",hasRadius:!0,shadow:"filterShadow",paddingTop:6,paddingBottom:6,paddingLeft:7,paddingRight:7},t.createElement(h.k,{direction:"column",alignItems:"stretch",gap:4},t.createElement($.Z,{variant:"delta",as:"h2"},o({id:"global.roles",defaultMessage:"User's role"})),t.createElement(b.r,{gap:5},t.createElement(j.P,{col:6,xs:12},t.createElement(te.Z,{disabled:!P,error:E.roles,onChange:D,value:L.roles}))))))))}))};Q.propTypes={canUpdate:p().bool.isRequired};var se=Q,ne=()=>{const y=(0,a.lm)(),P=(0,t.useMemo)(()=>({read:d.Z.settings.users.read,update:d.Z.settings.users.update}),[]),{isLoading:o,allowedActions:{canRead:v,canUpdate:C}}=(0,a.ss)(P),{state:Y}=(0,s.TH)(),_=Y?.from??"/";return(0,t.useEffect)(()=>{o||!v&&!C&&y({type:"info",message:{id:"notification.permission.not-allowed-read",defaultMessage:"You are not allowed to see this document"}})},[o,v,C,y]),o?t.createElement(a.dO,null):!v&&!C?t.createElement(s.l_,{to:_}):t.createElement(se,{canUpdate:C})}},76779:function(T,l,e){var t=e(32735),a=e(60216),s=e.n(a),d=e(50563),i=e(24989),g=e(47765),n=e(59087),p=e.n(n),m=e(67879);const c=({children:f,target:M})=>{const R=(0,i.lm)(),{formatMessage:Z}=(0,m.Z)(),U=()=>{R({type:"info",message:{id:"notification.link-copied"}})},A=Z({id:"app.component.CopyToClipboard.label",defaultMessage:"Copy to clipboard"});return t.createElement(i.Y_,{endAction:t.createElement(n.CopyToClipboard,{onCopy:U,text:M},t.createElement(d.h,{label:A,noBorder:!0,icon:t.createElement(g.Z,null)})),title:M,titleEllipsis:!0,subtitle:f,icon:t.createElement("span",{style:{fontSize:32}},"\u2709\uFE0F"),iconBackground:"neutral100"})};c.propTypes={children:s().oneOfType([s().element,s().string]).isRequired,target:s().string.isRequired},l.Z=c},16325:function(T,l,e){var t=e(32735),a=e(67879),s=e(60216),d=e.n(s),i=e(78246),g=e(76779);const n=({registrationToken:p})=>{const{formatMessage:m}=(0,a.Z)(),c=`${window.location.origin}${i.Z}auth/register?registrationToken=${p}`;return t.createElement(g.Z,{target:c},m({id:"app.components.Users.MagicLink.connect",defaultMessage:"Copy and share this link to give access to this user"}))};n.defaultProps={registrationToken:""},n.propTypes={registrationToken:d().string},l.Z=n},4397:function(T,l,e){var t=e(32735),a=e(60216),s=e.n(a),d=e(67879),i=e(80084),g=e(84967),n=e(20108),p=e(8471),m=e(27169),c=e(24989);const f=p.F4`
|
|
2
2
|
from {
|
|
3
3
|
transform: rotate(0deg);
|
|
4
4
|
}
|
|
@@ -7,4 +7,4 @@
|
|
|
7
7
|
}
|
|
8
8
|
`,M=p.ZP.div`
|
|
9
9
|
animation: ${f} 2s infinite linear;
|
|
10
|
-
`,R=()=>t.createElement(M,null,t.createElement(m.Z,null)),Z=async()=>{const{get:A}=(0,c.tg)(),{data:O}=await A("/admin/roles");return O.data},U=({disabled:A,error:O,onChange:S,value:x})=>{const{status:z,data:W}=(0,n.useQuery)(["roles"],Z,{staleTime:5e4}),{formatMessage:h}=(0,d.Z)(),$=O?h({id:O,defaultMessage:O}):"",b=h({id:"app.components.Users.ModalCreateBody.block-title.roles",defaultMessage:"User's roles"}),j=h({id:"app.components.Users.ModalCreateBody.block-title.roles.description",defaultMessage:"A user can have one or several roles"}),w=h({id:"app.components.Select.placeholder",defaultMessage:"Select"}),N=z==="loading"?t.createElement(R,null):void 0;return t.createElement(i.P,{id:"roles",disabled:A,error:$,hint:j,label:b,name:"roles",onChange:u=>{S({target:{name:"roles",value:u}})},placeholder:w,multi:!0,startIcon:N,value:x.map(u=>u.toString()),withTags:!0,required:!0},(W||[]).map(u=>t.createElement(g.W,{key:u.id,value:u.id.toString()},h({id:`global.${u.code}`,defaultMessage:u.name}))))};U.defaultProps={disabled:!1,error:void 0},U.propTypes={disabled:s().bool,error:s().string,onChange:s().func.isRequired,value:s().array.isRequired},l.Z=U},1057:function(T,l,e){e.d(l,{YM:function(){return m},Rw:function(){return i}});var t=e(24346),a=e(24989);const s={firstname:t.Z_().trim().required(a.I0.required),lastname:t.Z_(),email:t.Z_().email(a.I0.email).lowercase().required(a.I0.required),username:t.Z_().nullable(),password:t.Z_().min(8,a.I0.minLength).matches(/[a-z]/,"components.Input.error.contain.lowercase").matches(/[A-Z]/,"components.Input.error.contain.uppercase").matches(/\d/,"components.Input.error.contain.number"),confirmPassword:t.Z_().min(8,a.I0.minLength).oneOf([t.iH("password"),null],"components.Input.error.password.noMatch").when("password",(c,f)=>c?f.required(a.I0.required):f)};var i={...s,currentPassword:t.Z_().when(["password","confirmPassword"],(c,f,M)=>c||f?M.required(a.I0.required):M),preferedLanguage:t.Z_().nullable()},n={roles:t.IX().min(1,a.I0.required).required(a.I0.required)},m=t.Ry().shape({...s,isActive:t.Xg(),...n})},28890:function(T,l,e){var t=e(32735),a=e(67879),s=e(60216),d=e.n(s),i=e(78246),g=e(76779);const n=({registrationToken:p})=>{const{formatMessage:m}=(0,a.Z)();return p?t.createElement(g.Z,{target:`${window.location.origin}${i.Z}auth/register?registrationToken=${p}`},m({id:"app.components.Users.MagicLink.connect",defaultMessage:"Copy and share this link to give access to this user"})):t.createElement(g.Z,{target:`${window.location.origin}${i.Z}auth/login`},m({id:"app.components.Users.MagicLink.connect.sso",defaultMessage:"Send this link to the user, the first login can be made via a SSO provider."}))};n.defaultProps={registrationToken:""},n.propTypes={registrationToken:d().string},l.Z=n},29439:function(T,l,e){e.d(l,{Z:function(){return s}});var t=e(74512);const a=d=>(0,t.jsx)("svg",{
|
|
10
|
+
`,R=()=>t.createElement(M,null,t.createElement(m.Z,null)),Z=async()=>{const{get:A}=(0,c.tg)(),{data:O}=await A("/admin/roles");return O.data},U=({disabled:A,error:O,onChange:S,value:x})=>{const{status:z,data:W}=(0,n.useQuery)(["roles"],Z,{staleTime:5e4}),{formatMessage:h}=(0,d.Z)(),$=O?h({id:O,defaultMessage:O}):"",b=h({id:"app.components.Users.ModalCreateBody.block-title.roles",defaultMessage:"User's roles"}),j=h({id:"app.components.Users.ModalCreateBody.block-title.roles.description",defaultMessage:"A user can have one or several roles"}),w=h({id:"app.components.Select.placeholder",defaultMessage:"Select"}),N=z==="loading"?t.createElement(R,null):void 0;return t.createElement(i.P,{id:"roles",disabled:A,error:$,hint:j,label:b,name:"roles",onChange:u=>{S({target:{name:"roles",value:u}})},placeholder:w,multi:!0,startIcon:N,value:x.map(u=>u.toString()),withTags:!0,required:!0},(W||[]).map(u=>t.createElement(g.W,{key:u.id,value:u.id.toString()},h({id:`global.${u.code}`,defaultMessage:u.name}))))};U.defaultProps={disabled:!1,error:void 0},U.propTypes={disabled:s().bool,error:s().string,onChange:s().func.isRequired,value:s().array.isRequired},l.Z=U},1057:function(T,l,e){e.d(l,{YM:function(){return m},Rw:function(){return i}});var t=e(24346),a=e(24989);const s={firstname:t.Z_().trim().required(a.I0.required),lastname:t.Z_(),email:t.Z_().email(a.I0.email).lowercase().required(a.I0.required),username:t.Z_().nullable(),password:t.Z_().min(8,a.I0.minLength).matches(/[a-z]/,"components.Input.error.contain.lowercase").matches(/[A-Z]/,"components.Input.error.contain.uppercase").matches(/\d/,"components.Input.error.contain.number"),confirmPassword:t.Z_().min(8,a.I0.minLength).oneOf([t.iH("password"),null],"components.Input.error.password.noMatch").when("password",(c,f)=>c?f.required(a.I0.required):f)};var i={...s,currentPassword:t.Z_().when(["password","confirmPassword"],(c,f,M)=>c||f?M.required(a.I0.required):M),preferedLanguage:t.Z_().nullable()},n={roles:t.IX().min(1,a.I0.required).required(a.I0.required)},m=t.Ry().shape({...s,isActive:t.Xg(),...n})},28890:function(T,l,e){var t=e(32735),a=e(67879),s=e(60216),d=e.n(s),i=e(78246),g=e(76779);const n=({registrationToken:p})=>{const{formatMessage:m}=(0,a.Z)();return p?t.createElement(g.Z,{target:`${window.location.origin}${i.Z}auth/register?registrationToken=${p}`},m({id:"app.components.Users.MagicLink.connect",defaultMessage:"Copy and share this link to give access to this user"})):t.createElement(g.Z,{target:`${window.location.origin}${i.Z}auth/login`},m({id:"app.components.Users.MagicLink.connect.sso",defaultMessage:"Send this link to the user, the first login can be made via a SSO provider."}))};n.defaultProps={registrationToken:""},n.propTypes={registrationToken:d().string},l.Z=n},29439:function(T,l,e){e.d(l,{Z:function(){return s}});var t=e(74512);const a=d=>(0,t.jsx)("svg",{width:"1rem",height:"1rem",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...d,children:(0,t.jsx)("path",{d:"M24 13.3a.2.2 0 0 1-.2.2H5.74l8.239 8.239a.2.2 0 0 1 0 .282L12.14 23.86a.2.2 0 0 1-.282 0L.14 12.14a.2.2 0 0 1 0-.282L11.86.14a.2.2 0 0 1 .282 0L13.98 1.98a.2.2 0 0 1 0 .282L5.74 10.5H23.8c.11 0 .2.09.2.2v2.6Z",fill:"#212134"})}),s=a}}]);
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_strapi_admin=self.webpackChunk_strapi_admin||[]).push([[3455],{67249:function(V,x,t){t.r(x),t.d(x,{default:function(){return me}});var e=t(32735),n=t(24989),v=t(83983),R=t(47765),B=t(68625),Z=t(4038),I=t(19406),D=t(27649),u=t(82055),C=t(41415),g=t(99223),$=t(17e3),S=t(56755),X=t(73269),G=t(33827),H=t(94547),T=t(19786),W=t(49372),J=t(3685),Y=t(35658),k=t(33795),w=t.n(k),b=t(67879),q=t(53038),_=t(67927),ee=()=>"todo empty role",te=t(60216),A=t.n(te),ne=t(87933),le=t(72850),ae=t(50563);const F=({id:s,name:o,description:l,usersCount:p,icons:r,rowIndex:m,canUpdate:f})=>{const{formatMessage:M}=(0,b.Z)(),[,i]=r,y=M({id:"Roles.RoleRow.user-count",defaultMessage:"{number, plural, =0 {# user} one {# user} other {# users}}"},{number:p});return e.createElement(H.Tr,{"aria-rowindex":m,key:s,...f?(0,n.X7)({fn:i.onClick}):{}},e.createElement(T.Td,{maxWidth:(0,n.Q1)(130)},e.createElement(W.Z,{ellipsis:!0,textColor:"neutral800"},o)),e.createElement(T.Td,{maxWidth:(0,n.Q1)(250)},e.createElement(W.Z,{ellipsis:!0,textColor:"neutral800"},l)),e.createElement(T.Td,null,e.createElement(W.Z,{textColor:"neutral800"},y)),e.createElement(T.Td,null,e.createElement(ne.k,{justifyContent:"flex-end",...n.UW},r.map((d,L)=>d?e.createElement(le.x,{key:d.label,paddingLeft:L===0?0:1},e.createElement(ae.h,{onClick:d.onClick,label:d.label,noBorder:!0,icon:d.icon})):null))))};F.propTypes={id:A().number.isRequired,name:A().string.isRequired,description:A().string.isRequired,usersCount:A().number.isRequired,icons:A().array.isRequired,rowIndex:A().number.isRequired,canUpdate:A().bool},F.defaultProps={canUpdate:!1};var se=F,oe=t(97889);const re={roleToDelete:null,showModalConfirmButtonLoading:!1,shouldRefetchData:!1};var ie=(s,o)=>(0,oe.ZP)(s,l=>{switch(o.type){case"ON_REMOVE_ROLES":{l.showModalConfirmButtonLoading=!0;break}case"ON_REMOVE_ROLES_SUCCEEDED":{l.shouldRefetchData=!0,l.roleToDelete=null;break}case"RESET_DATA_TO_DELETE":{l.shouldRefetchData=!1,l.roleToDelete=null,l.showModalConfirmButtonLoading=!1;break}case"SET_ROLE_TO_DELETE":{l.roleToDelete=o.id;break}default:return l}});const de=()=>{(0,n.go)();const{locale:s}=(0,b.Z)(),{isLoading:o,allowedActions:{canCreate:l,canDelete:p,canRead:r,canUpdate:m}}=(0,n.ss)(v.Z.settings.roles),{getData:f,roles:M,isLoading:i}=(0,_.bF)(!1),[{query:y}]=(0,n.Kx)(),d=y?._q||"",{includes:L}=(0,n.L0)(s,{sensitivity:"base"}),P=(0,n.Xe)(s,{sensitivity:"base"}),U=(M||[]).filter(h=>L(h.name,d)||L(h.description,d)).sort((h,O)=>P.compare(h.name,O.name)||P.compare(h.description,O.description));return(0,e.useEffect)(()=>{!o&&r&&f()},[o,r,f]),{isLoadingForPermissions:o,canCreate:l,canDelete:p,canRead:r,canUpdate:m,isLoading:i,getData:f,sortedRoles:U,roles:M}},ce=({getData:s,canCreate:o,canDelete:l,canUpdate:p})=>{const{formatMessage:r}=(0,b.Z)(),m=(0,n.lm)(),[f,M]=(0,e.useState)(!1),{push:i}=(0,q.k6)(),[{selectedRoles:y,showModalConfirmButtonLoading:d,roleToDelete:L},P]=(0,e.useReducer)(ie,re),{post:U}=(0,n.tg)(),h=async()=>{try{P({type:"ON_REMOVE_ROLES"}),await U("/admin/roles/batch-delete",{ids:[L]}),await s(),P({type:"RESET_DATA_TO_DELETE"})}catch(a){const c=w()(a,["response","payload","data","ids"],null);if(c&&Array.isArray(c)){const ge=c.join(`
|
|
2
|
+
`);m({type:"warning",message:ge})}else m({type:"warning",message:{id:"notification.error"}})}E()},O=(0,e.useCallback)(a=>{i(`/settings/roles/duplicate/${a}`)},[i]),N=()=>i("/settings/roles/new"),K=(0,e.useCallback)(a=>{P({type:"SET_ROLE_TO_DELETE",id:a}),E()},[]),E=()=>M(a=>!a),j=(0,e.useCallback)(a=>{i(`/settings/roles/${a}`)},[i]),Q=(0,e.useCallback)((a,c)=>{a.preventDefault(),a.stopPropagation(),c.usersCount?m({type:"info",message:{id:"Roles.ListPage.notification.delete-not-allowed"}}):K(c.id)},[m,K]),z=(0,e.useCallback)((a,c)=>{a.preventDefault(),a.stopPropagation(),O(c.id)},[O]),Ee=(0,e.useCallback)(a=>[...o?[{onClick:c=>z(c,a),label:r({id:"app.utils.duplicate",defaultMessage:"Duplicate"}),icon:e.createElement(R.Z,null)}]:[],...p?[{onClick:()=>j(a.id),label:r({id:"app.utils.edit",defaultMessage:"Edit"}),icon:e.createElement(B.Z,null)}]:[],...l?[{onClick:c=>Q(c,a),label:r({id:"global.delete",defaultMessage:"Delete"}),icon:e.createElement(Z.Z,null)}]:[]],[r,Q,z,j,o,p,l]);return{handleNewRoleClick:N,getIcons:Ee,selectedRoles:y,isWarningDeleteAllOpened:f,showModalConfirmButtonLoading:d,handleToggleModal:E,handleDeleteData:h}};var ue=()=>{const{formatMessage:s}=(0,b.Z)(),{isLoadingForPermissions:o,canCreate:l,canRead:p,canDelete:r,canUpdate:m,isLoading:f,getData:M,sortedRoles:i}=de(),{handleNewRoleClick:y,getIcons:d,isWarningDeleteAllOpened:L,showModalConfirmButtonLoading:P,handleToggleModal:U,handleDeleteData:h}=ce({getData:M,canCreate:l,canDelete:r,canUpdate:m}),O=i.length+1,N=6;if(o)return e.createElement(D.o,null,e.createElement(n.dO,null));const K=s({id:"global.roles",defaultMessage:"roles"});return e.createElement(D.o,null,e.createElement(n.SL,{name:"Roles"}),e.createElement(u.T,{primaryAction:l?e.createElement(C.z,{onClick:y,startIcon:e.createElement(I.Z,null),size:"S"},s({id:"Settings.roles.list.button.add",defaultMessage:"Add new role"})):null,title:K,subtitle:s({id:"Settings.roles.list.description",defaultMessage:"List of roles"}),as:"h2"}),p&&e.createElement(g.Z,{startActions:e.createElement(n.m,{label:s({id:"app.component.search.label",defaultMessage:"Search for {target}"},{target:K})})}),p&&e.createElement($.D,null,e.createElement(S.i,{colCount:N,rowCount:O,footer:l?e.createElement(X.c,{onClick:y,icon:e.createElement(I.Z,null)},s({id:"Settings.roles.list.button.add",defaultMessage:"Add new role"})):null},e.createElement(G.h,null,e.createElement(H.Tr,{"aria-rowindex":1},e.createElement(T.Th,null,e.createElement(W.Z,{variant:"sigma",textColor:"neutral600"},s({id:"global.name",defaultMessage:"Name"}))),e.createElement(T.Th,null,e.createElement(W.Z,{variant:"sigma",textColor:"neutral600"},s({id:"global.description",defaultMessage:"Description"}))),e.createElement(T.Th,null,e.createElement(W.Z,{variant:"sigma",textColor:"neutral600"},s({id:"global.users",defaultMessage:"Users"}))),e.createElement(T.Th,null,e.createElement(J.T,null,s({id:"global.actions",defaultMessage:"Actions"}))))),e.createElement(Y.p,null,i?.map((E,j)=>e.createElement(se,{key:E.id,id:E.id,name:E.name,description:E.description,usersCount:E.usersCount,icons:d(E),rowIndex:j+2,canUpdate:m})))),!O&&!f&&e.createElement(ee,null)),e.createElement(n.QH,{isOpen:L,onConfirm:h,isConfirmButtonLoading:P,onToggleDialog:U}))},me=()=>e.createElement(n.O4,{permissions:v.Z.settings.roles.main},e.createElement(ue,null))},99223:function(V,x,t){t.d(x,{Z:function(){return D}});var e=t(32735),n=t(60216),v=t(8471),R=t(72850),B=t(87933);const Z=(0,v.ZP)(B.k)`
|
|
3
|
+
& > * + * {
|
|
4
|
+
margin-left: ${({theme:u})=>u.spaces[2]};
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
margin-left: ${({pullRight:u})=>u?"auto":void 0};
|
|
8
|
+
`,I=(0,v.ZP)(Z)`
|
|
9
|
+
flex-shrink: 0;
|
|
10
|
+
`,D=({startActions:u,endActions:C})=>u||C?e.createElement(R.x,{paddingLeft:10,paddingRight:10},e.createElement(R.x,{paddingBottom:4},e.createElement(B.k,{justifyContent:"space-between",alignItems:"flex-start"},u&&e.createElement(Z,{wrap:"wrap"},u),C&&e.createElement(I,{pullRight:!0},C)))):null;D.defaultProps={endActions:void 0,startActions:void 0},D.propTypes={endActions:n.node,startActions:n.node}},73269:function(V,x,t){t.d(x,{c:function(){return C}});var e=t(32735),n=t(60216),v=t(8471),R=t(72850),B=t(9026),Z=t(87933),I=t(49372);const D=(0,v.ZP)(R.x)`
|
|
11
|
+
height: ${24/16}rem;
|
|
12
|
+
width: ${24/16}rem;
|
|
13
|
+
border-radius: 50%;
|
|
14
|
+
display: flex;
|
|
15
|
+
justify-content: center;
|
|
16
|
+
align-items: center;
|
|
17
|
+
|
|
18
|
+
svg {
|
|
19
|
+
height: ${10/16}rem;
|
|
20
|
+
width: ${10/16}rem;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
svg path {
|
|
24
|
+
fill: ${({theme:g})=>g.colors.primary600};
|
|
25
|
+
}
|
|
26
|
+
`,u=(0,v.ZP)(R.x)`
|
|
27
|
+
border-radius: 0 0 ${({theme:g})=>g.borderRadius} ${({theme:g})=>g.borderRadius};
|
|
28
|
+
display: block;
|
|
29
|
+
width: 100%;
|
|
30
|
+
border: none;
|
|
31
|
+
`,C=({children:g,icon:$,...S})=>e.createElement("div",null,e.createElement(B.i,null),e.createElement(u,{as:"button",background:"primary100",padding:5,...S},e.createElement(Z.k,null,e.createElement(D,{"aria-hidden":!0,background:"primary200"},$),e.createElement(R.x,{paddingLeft:3},e.createElement(I.Z,{variant:"pi",fontWeight:"bold",textColor:"primary600"},g)))));C.propTypes={children:n.string.isRequired,icon:n.node.isRequired}}}]);
|