@strapi/admin 4.13.3 → 4.14.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/hooks/useAdminRoles/index.js +17 -7
- package/admin/src/hooks/useAdminUsers/useAdminUsers.js +16 -7
- package/admin/src/hooks/useContentTypes/useContentTypes.js +18 -7
- package/build/1227.ec336799.chunk.js +1 -0
- package/build/{3483.19381b40.chunk.js → 3483.f6b2439f.chunk.js} +1 -1
- package/build/4174.4587c7f6.chunk.js +1 -0
- package/build/6266.53be9ea3.chunk.js +124 -0
- package/build/7897.eac204a4.chunk.js +6 -0
- package/build/{Admin-authenticatedApp.796792a8.chunk.js → Admin-authenticatedApp.d200a4ee.chunk.js} +1 -1
- package/build/{admin-app.2a8615ab.chunk.js → admin-app.582877a3.chunk.js} +11 -11
- package/build/admin-edit-roles-page.0aa65505.chunk.js +267 -0
- package/build/admin-edit-users.9215912a.chunk.js +10 -0
- package/build/admin-roles-list.824a50de.chunk.js +22 -0
- package/build/admin-users.f6b3c643.chunk.js +11 -0
- package/build/audit-logs-settings-page.be2cb4dd.chunk.js +1 -0
- package/build/{content-manager.f448efdf.chunk.js → content-manager.06a2f7ec.chunk.js} +39 -39
- package/build/index.html +1 -1
- package/build/review-workflows-settings-create-view.604cffa0.chunk.js +1 -0
- package/build/review-workflows-settings-edit-view.73c57f07.chunk.js +1 -0
- package/build/review-workflows-settings-list-view.7e300ecb.chunk.js +56 -0
- package/build/{runtime~main.d2b8d4a1.js → runtime~main.9de029f4.js} +2 -2
- package/build/sso-settings-page.94373f78.chunk.js +1 -0
- package/ee/admin/content-manager/pages/EditView/InformationBox/components/StageSelect/StageSelect.js +65 -53
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/actions/index.js +50 -5
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/components/Stages/Stage/Stage.js +227 -19
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/components/WorkflowAttributes/WorkflowAttributes.js +8 -23
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/constants.js +6 -0
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/hooks/useReviewWorkflows.js +17 -7
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/hooks/useReviewWorkflowsStages.js +36 -0
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/pages/CreateView/CreateView.js +68 -19
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/pages/EditView/EditView.js +105 -35
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/reducer/index.js +68 -27
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/selectors.js +45 -0
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/utils/validateWorkflow.js +20 -0
- package/ee/server/config/admin-actions.js +6 -0
- package/ee/server/constants/workflows.js +13 -0
- package/ee/server/content-types/workflow-stage/index.js +6 -0
- package/ee/server/controllers/workflows/index.js +41 -16
- package/ee/server/controllers/workflows/stages/index.js +93 -6
- package/ee/server/routes/review-workflows.js +10 -9
- package/ee/server/services/index.js +1 -0
- package/ee/server/services/review-workflows/stage-permissions.js +60 -0
- package/ee/server/services/review-workflows/stages.js +83 -12
- package/ee/server/services/review-workflows/workflows/index.js +20 -7
- package/ee/server/validation/review-workflows.js +11 -0
- package/package.json +8 -8
- package/scripts/build.js +2 -3
- package/scripts/create-dev-plugins-file.js +2 -3
- package/server/content-types/Permission.js +6 -0
- package/server/domain/permission/index.js +11 -2
- package/server/services/role.js +12 -4
- package/server/validation/action-provider.js +1 -1
- package/server/validation/common-validators.js +92 -100
- package/server/validation/permission.js +0 -3
- package/utils/create-cache-dir.js +5 -102
- package/utils/plugins.js +217 -0
- package/webpack.config.js +2 -2
- package/build/1227.9f37e1dc.chunk.js +0 -1
- package/build/2237.b832ae6e.chunk.js +0 -114
- package/build/4174.f1f39e40.chunk.js +0 -1
- package/build/4724.aea5c8c1.chunk.js +0 -6
- package/build/admin-edit-roles-page.38a6c863.chunk.js +0 -267
- package/build/admin-edit-users.545fc882.chunk.js +0 -10
- package/build/admin-roles-list.1e2e814d.chunk.js +0 -22
- package/build/admin-users.b8ea5677.chunk.js +0 -11
- package/build/audit-logs-settings-page.96f9d608.chunk.js +0 -1
- package/build/review-workflows-settings-create-view.4a156a19.chunk.js +0 -1
- package/build/review-workflows-settings-edit-view.ce984d1f.chunk.js +0 -1
- package/build/review-workflows-settings-list-view.419b8deb.chunk.js +0 -56
- package/build/sso-settings-page.45153df5.chunk.js +0 -1
- package/utils/create-plugins-exclude-path.js +0 -20
- package/utils/get-plugins.js +0 -110
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_strapi_admin=self.webpackChunk_strapi_admin||[]).push([[2237],{61234:function(T,m,e){"use strict";e.d(m,{v:function(){return a}});var t=e(32735),r=e(15062);function a(d,c){const o=(0,r.oR)();(0,t.useEffect)(()=>{o.injectReducer(d,c)},[o,d,c])}},98866:function(T,m,e){"use strict";e.d(m,{q:function(){return d}});var t=e(32735),r=e(45509),a=e(20108);function d({enabled:c}={enabled:!0}){const{get:o}=(0,r.kY)(),{data:E,isError:u,isLoading:s}=(0,a.useQuery)(["ee","license-limit-info"],async()=>{const{data:{data:v}}=await o("/admin/license-limit-information");return v},{enabled:c}),n=t.useMemo(()=>E??{},[E]),g=t.useCallback(v=>(n?.features??[]).find(i=>i.name===v)?.options??{},[n?.features]);return{license:n,getFeature:g,isError:u,isLoading:s}}},77061:function(T,m,e){"use strict";e.d(m,{CI:function(){return d},FP:function(){return o},Js:function(){return u},_V:function(){return a},fC:function(){return r},rI:function(){return E},xn:function(){return c}});var t=e(2121);function r({status:s,data:n}){return{type:t.qZ,payload:{status:s,workflow:n}}}function a(s){return{type:t.x4,payload:{stageId:s}}}function d(s={}){return{type:t.Ot,payload:s}}function c(s,n){return{type:t.Nj,payload:{stageId:s,...n}}}function o(s,n){return{type:t.$k,payload:{newIndex:n,oldIndex:s}}}function E(s){return{type:t.VS,payload:s}}function u(){return{type:t.gu}}},27187:function(T,m,e){"use strict";e.d(m,{eJ:function(){return w},lx:function(){return P},h4:function(){return S},fC:function(){return A}});var t=e(32735),r=e(96709),a=e(27649),d=e(17e3),c=e(82055),o=e(45509),E=e(29439),u=e(67879),s=e(17379),n=e(2121),g=e(87933),v=e(49372),l=e(16899),i=e(60216),h=e.n(i),x=e(8471);const M=(0,x.ZP)(g.k)`
|
|
2
|
-
svg path {
|
|
3
|
-
fill: ${({theme:f})=>f.colors.neutral600};
|
|
4
|
-
}
|
|
5
|
-
`;function R({name:f}){return t.createElement(g.k,{background:"primary100",borderStyle:"dashed",borderColor:"primary600",borderWidth:"1px",gap:3,hasRadius:!0,padding:3,shadow:"tableShadow",width:(0,o.Q1)(300)},t.createElement(M,{alignItems:"center",background:"neutral200",borderRadius:"50%",height:6,justifyContent:"center",width:6},t.createElement(l.Z,{width:`${8/16}rem`})),t.createElement(v.Z,{fontWeight:"bold"},f))}R.propTypes={name:h().string.isRequired};function C({type:f,item:D}){switch(f){case n.uL.STAGE:return t.createElement(R,{...D});default:return null}}function P(){return t.createElement(s.r,{renderItem:C})}function A({children:f}){return t.createElement(r.A,null,t.createElement(a.o,{tabIndex:-1},t.createElement(d.D,null,f)))}function w({href:f}){const{formatMessage:D}=(0,u.Z)();return t.createElement(o.rU,{startIcon:t.createElement(E.Z,null),to:f},D({id:"global.back",defaultMessage:"Back"}))}function S({title:f,subtitle:D,navigationAction:W,primaryAction:k}){return t.createElement(t.Fragment,null,t.createElement(o.SL,{name:f}),t.createElement(c.T,{navigationAction:W,primaryAction:k,title:f,subtitle:D}))}},90562:function(T,m,e){"use strict";e.d(m,{uT:function(){return C},fC:function(){return w},Dx:function(){return R}});var t=e(32735),r=e(49372),a=e(87933),d=e(85025),c=e(31600),o=e(72850),E=e(50563),u=e(95489),s=e(35331),n=e(60216),g=e.n(n),v=e(67879),l=e(8471),i=e.p+"0cd5f8915b265d5b1856.png";const h="limits-title",x="https://strapi.io/pricing-cloud",M="https://strapi.io/contact-sales";function R({children:S}){return t.createElement(r.Z,{variant:"alpha",id:h},S)}R.propTypes={children:g().node.isRequired};function C({children:S}){return t.createElement(r.Z,{variant:"omega"},S)}C.propTypes={children:g().node.isRequired};function P(){const{formatMessage:S}=(0,v.Z)();return t.createElement(a.k,{gap:2,paddingTop:4},t.createElement(u.Q,{variant:"default",isExternal:!0,href:x},S({id:"Settings.review-workflows.limit.cta.learn",defaultMessage:"Learn more"})),t.createElement(u.Q,{variant:"tertiary",isExternal:!0,href:M},S({id:"Settings.review-workflows.limit.cta.sales",defaultMessage:"Contact Sales"})))}const A=l.ZP.img`
|
|
6
|
-
// Margin top|right reverse the padding of ModalBody
|
|
7
|
-
margin-right: ${({theme:S})=>`-${S.spaces[7]}`};
|
|
8
|
-
margin-top: ${({theme:S})=>`-${S.spaces[7]}`};
|
|
9
|
-
width: 360px;
|
|
10
|
-
`;function w({children:S,isOpen:f,onClose:D}){const{formatMessage:W}=(0,v.Z)();return f?t.createElement(d.P,{labelledBy:h},t.createElement(c.f,null,t.createElement(a.k,{gap:2,paddingLeft:7,position:"relative"},t.createElement(a.k,{alignItems:"start",direction:"column",gap:2,width:"60%"},S,t.createElement(P,null)),t.createElement(a.k,{justifyContent:"end",height:"100%",width:"40%"},t.createElement(A,{src:i,"aria-hidden":!0,alt:"",loading:"lazy"}),t.createElement(o.x,{display:"flex",position:"absolute",right:0,top:0},t.createElement(E.h,{icon:t.createElement(s.Z,null),"aria-label":W({id:"global.close",defaultMessage:"Close"}),onClick:D})))))):null}w.defaultProps={isOpen:!1},w.propTypes={children:g().node.isRequired,isOpen:g().bool,onClose:g().func.isRequired}},45594:function(T,m,e){"use strict";e.d(m,{U:function(){return L}});var t=e(32735),r=e(72850),a=e(87933),d=e(45509),c=e(60216),o=e.n(c),E=e(67879),u=e(15062),s=e(8471),n=e(77061),g=e(49372),v=e(86308);const l=(0,s.ZP)(v.Z)`
|
|
11
|
-
> circle {
|
|
12
|
-
fill: ${({theme:p})=>p.colors.neutral150};
|
|
13
|
-
}
|
|
14
|
-
> path {
|
|
15
|
-
fill: ${({theme:p})=>p.colors.neutral600};
|
|
16
|
-
}
|
|
17
|
-
`,i=(0,s.ZP)(r.x)`
|
|
18
|
-
border-radius: 26px;
|
|
19
|
-
|
|
20
|
-
svg {
|
|
21
|
-
height: ${({theme:p})=>p.spaces[6]};
|
|
22
|
-
width: ${({theme:p})=>p.spaces[6]};
|
|
23
|
-
|
|
24
|
-
> path {
|
|
25
|
-
fill: ${({theme:p})=>p.colors.neutral600};
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
&:hover {
|
|
30
|
-
color: ${({theme:p})=>p.colors.primary600} !important;
|
|
31
|
-
${g.Z} {
|
|
32
|
-
color: ${({theme:p})=>p.colors.primary600} !important;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
${l} {
|
|
36
|
-
> circle {
|
|
37
|
-
fill: ${({theme:p})=>p.colors.primary600};
|
|
38
|
-
}
|
|
39
|
-
> path {
|
|
40
|
-
fill: ${({theme:p})=>p.colors.neutral100};
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
&:active {
|
|
46
|
-
${g.Z} {
|
|
47
|
-
color: ${({theme:p})=>p.colors.primary600};
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
${l} {
|
|
51
|
-
> circle {
|
|
52
|
-
fill: ${({theme:p})=>p.colors.primary600};
|
|
53
|
-
}
|
|
54
|
-
> path {
|
|
55
|
-
fill: ${({theme:p})=>p.colors.neutral100};
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
`;function h({children:p,...B}){return t.createElement(i,{as:"button",background:"neutral0",border:"neutral150",paddingBottom:3,paddingLeft:4,paddingRight:4,paddingTop:3,shadow:"filterShadow",...B},t.createElement(a.k,{gap:2},t.createElement(l,{"aria-hidden":!0}),t.createElement(g.Z,{variant:"pi",fontWeight:"bold",textColor:"neutral500"},p)))}h.propTypes={children:o().node.isRequired};var x=e(3685),M=e(83828),R=e(61762),C=e(50563),P=e(89966),A=e(15335),w=e(5803),S=e(10369),f=e(77035),D=e(4038),W=e(47081),k=e(92802),K=e(51968),V=e(69242),b=e(69997),N=e(2121),Z=e(68886);const H=(0,Z.s)();function y(){return t.createElement(r.x,{background:"primary100",borderStyle:"dashed",borderColor:"primary600",borderWidth:"1px",display:"block",hasRadius:!0,padding:6,shadow:"tableShadow"})}function I({id:p,index:B,canDelete:U,canReorder:ee,canUpdate:G,isOpen:te=!1,stagesCount:z}){const Q=O=>`${O+1} of ${z}`,Y=O=>{J($({id:"dnd.grab-item",defaultMessage:"{item}, grabbed. Current position in list: {position}. Press up and down arrow to change position, Spacebar to drop, Escape to cancel."},{item:j.value,position:Q(O)}))},ie=O=>{J($({id:"dnd.drop-item",defaultMessage:"{item}, dropped. Final position in list: {position}."},{item:j.value,position:Q(O)}))},de=()=>{J($({id:"dnd.cancel-item",defaultMessage:"{item}, dropped. Re-order cancelled."},{item:j.value}))},ce=(O,X)=>{J($({id:"dnd.reorder",defaultMessage:"{item}, moved. New position in list: {position}."},{item:j.value,position:Q(O)})),_((0,n.FP)(X,O))},[ae,J]=t.useState(null),{formatMessage:$}=(0,E.Z)(),{trackUsage:ue}=(0,d.rS)(),_=(0,u.I0)(),[ne,me]=t.useState(te),[j,re,fe]=(0,k.U$)(`stages.${B}.name`),[q,oe,ge]=(0,k.U$)(`stages.${B}.color`),[{handlerId:pe,isDragging:ve,handleKeyDown:he},Ee,ye,we,se]=(0,V.Y9)(ee,{index:B,item:{name:j.value},onGrabItem:Y,onDropItem:ie,onMoveItem:ce,onCancel:de,type:N.uL.STAGE}),Te=(0,b.FE)(Ee,ye),Se=H.map(({hex:O,name:X})=>({value:O,label:$({id:"Settings.review-workflows.stage.color.name",defaultMessage:"{name}"},{name:X}),color:O}));t.useEffect(()=>{se((0,K.rX)(),{captureDraggingState:!1})},[se,B]);const{themeColorName:xe}=(0,Z.k)(q.value)??{};return t.createElement(r.x,{ref:Te},ae&&t.createElement(x.T,{"aria-live":"assertive"},ae),ve?t.createElement(y,null):t.createElement(M.U,{size:"S",variant:"primary",onToggle:()=>{me(!ne),ne||ue("willEditStage")},expanded:ne,shadow:"tableShadow",error:re.error??oe?.error??!1,hasErrorMessage:!1},t.createElement(R.B,{title:j.value,togglePosition:"left",action:(U||G)&&t.createElement(a.k,null,U&&t.createElement(C.h,{background:"transparent",icon:t.createElement(D.Z,null),label:$({id:"Settings.review-workflows.stage.delete",defaultMessage:"Delete stage"}),noBorder:!0,onClick:()=>_((0,n._V)(p))}),G&&t.createElement(C.h,{background:"transparent",forwardedAs:"div",role:"button",noBorder:!0,tabIndex:0,"data-handler-id":pe,ref:we,label:$({id:"Settings.review-workflows.stage.drag",defaultMessage:"Drag"}),onClick:O=>O.stopPropagation(),onKeyDown:he},t.createElement(W.Z,null)))}),t.createElement(P.v,{padding:6,background:"neutral0",hasRadius:!0},t.createElement(A.r,{gap:4},t.createElement(w.P,{col:6},t.createElement(S.o,{...j,id:j.name,disabled:!G,label:$({id:"Settings.review-workflows.stage.name.label",defaultMessage:"Stage name"}),error:re.error??!1,onChange:O=>{fe.setValue(O.target.value),_((0,n.xn)(p,{name:O.target.value}))},required:!0})),t.createElement(w.P,{col:6},t.createElement(f.q4,{disabled:!G,error:oe?.error??!1,id:q.name,required:!0,label:$({id:"content-manager.reviewWorkflows.stage.color",defaultMessage:"Color"}),onChange:O=>{ge.setValue(O),_((0,n.xn)(p,{color:O}))},value:q.value.toUpperCase(),startIcon:t.createElement(a.k,{as:"span",height:2,background:q.value,borderColor:xe==="neutral0"?"neutral150":"transparent",hasRadius:!0,shrink:0,width:2})},Se.map(({value:O,label:X,color:le})=>{const{themeColorName:Me}=(0,Z.k)(le);return t.createElement(f.ag,{value:O,key:O,startIcon:t.createElement(a.k,{as:"span",height:2,background:le,borderColor:Me==="neutral0"?"neutral150":"transparent",hasRadius:!0,shrink:0,width:2})},X)})))))))}I.propTypes=o().shape({id:o().number.isRequired,color:o().string.isRequired,canDelete:o().bool.isRequired,canReorder:o().bool.isRequired,canUpdate:o().bool.isRequired,stagesCount:o().number.isRequired}).isRequired;const F=(0,s.ZP)(r.x)`
|
|
60
|
-
transform: translateX(-50%);
|
|
61
|
-
`;function L({canDelete:p,canUpdate:B,stages:U}){const{formatMessage:ee}=(0,E.Z)(),G=(0,u.I0)(),{trackUsage:te}=(0,d.rS)();return t.createElement(a.k,{direction:"column",gap:6,width:"100%"},t.createElement(r.x,{position:"relative",spacing:4,width:"100%"},t.createElement(F,{background:"neutral200",height:"100%",left:"50%",position:"absolute",top:"0",width:2,zIndex:1}),t.createElement(a.k,{direction:"column",alignItems:"stretch",gap:6,zIndex:2,position:"relative",as:"ol"},U.map((z,Q)=>{const Y=z?.id??z.__temp_key__;return t.createElement(r.x,{key:`stage-${Y}`,as:"li"},t.createElement(I,{id:Y,index:Q,isOpen:!z.id,canDelete:U.length>1&&p,canReorder:U.length>1,canUpdate:B,stagesCount:U.length}))}))),B&&t.createElement(h,{type:"button",onClick:()=>{G((0,n.CI)({name:""})),te("willCreateStage")}},ee({id:"Settings.review-workflows.stage.add",defaultMessage:"Add new stage"})))}L.defaultProps={canDelete:!0,canUpdate:!0,stages:[]},L.propTypes={canDelete:o().bool,canUpdate:o().bool,stages:o().arrayOf(o().shape({id:o().number,__temp_key__:o().number,name:o().string.isRequired}))}},165:function(T,m,e){"use strict";e.d(m,{Y:function(){return M}});var t=e(32735),r=e(6407),a=e(49372),d=e(15335),c=e(5803),o=e(10369),E=e(45509),u=e(92802),s=e(60216),n=e.n(s),g=e(67879),v=e(15062),l=e(8471),i=e(77061);const h=(0,l.ZP)(r.ML)`
|
|
62
|
-
padding-left: ${({theme:C})=>C.spaces[7]};
|
|
63
|
-
`,x=(0,l.ZP)(a.Z)`
|
|
64
|
-
font-style: italic;
|
|
65
|
-
`;function M({canUpdate:C,contentTypes:{collectionTypes:P,singleTypes:A},currentWorkflow:w,workflows:S}){const{formatMessage:f,locale:D}=(0,g.Z)(),W=(0,v.I0)(),[k,K,V]=(0,u.U$)("name"),[b,N,Z]=(0,u.U$)("contentTypes"),H=(0,E.Xe)(D,{sensitivity:"base"});return t.createElement(d.r,{background:"neutral0",hasRadius:!0,gap:4,padding:6,shadow:"tableShadow"},t.createElement(c.P,{col:6},t.createElement(o.o,{...k,id:k.name,disabled:!C,label:f({id:"Settings.review-workflows.workflow.name.label",defaultMessage:"Workflow Name"}),error:K.error??!1,onChange:y=>{W((0,i.rI)({name:y.target.value})),V.setValue(y.target.value)},required:!0})),t.createElement(c.P,{col:6},t.createElement(r.NU,{...b,customizeContent:y=>f({id:"Settings.review-workflows.workflow.contentTypes.displayValue",defaultMessage:"{count} {count, plural, one {content type} other {content types}} selected"},{count:y.length}),disabled:!C,error:N.error??!1,id:b.name,label:f({id:"Settings.review-workflows.workflow.contentTypes.label",defaultMessage:"Associated to"}),onChange:y=>{W((0,i.rI)({contentTypes:y})),Z.setValue(y)},placeholder:f({id:"Settings.review-workflows.workflow.contentTypes.placeholder",defaultMessage:"Select"})},[...P.length>0?[{label:f({id:"Settings.review-workflows.workflow.contentTypes.collectionTypes.label",defaultMessage:"Collection Types"}),children:P.sort((y,I)=>H.compare(y.info.displayName,I.info.displayName)).map(y=>({label:y.info.displayName,value:y.uid}))}]:[],...A.length>0?[{label:f({id:"Settings.review-workflows.workflow.contentTypes.singleTypes.label",defaultMessage:"Single Types"}),children:A.map(y=>({label:y.info.displayName,value:y.uid}))}]:[]].map(y=>"children"in y?t.createElement(r.Ab,{key:y.label,label:y.label,values:y.children.map(I=>I.value.toString())},y.children.map(I=>{const{name:F}=S.find(L=>(w&&L.id!==w.id||!w)&&L.contentTypes.includes(I.value))??{};return t.createElement(h,{key:I.value,value:I.value},f({id:"Settings.review-workflows.workflow.contentTypes.assigned.notice",defaultMessage:"{label} {name, select, undefined {} other {<i>(assigned to <em>{name}</em> workflow)</i>}}"},{label:I.label,name:F,em:(...L)=>t.createElement(a.Z,{as:"em",fontWeight:"bold"},L),i:(...L)=>t.createElement(x,null,L)}))})):t.createElement(r.ML,{key:y.value,value:y.value},y.label)))))}const R=n().shape({uid:n().string.isRequired,info:n().shape({displayName:n().string.isRequired}).isRequired});M.defaultProps={canUpdate:!0,currentWorkflow:void 0},M.propTypes={canUpdate:n().bool,contentTypes:n().shape({collectionTypes:n().arrayOf(R).isRequired,singleTypes:n().arrayOf(R).isRequired}).isRequired,currentWorkflow:n().object,workflows:n().array.isRequired}},2121:function(T,m,e){"use strict";e.d(m,{$k:function(){return u},Ef:function(){return l},FT:function(){return g},Nj:function(){return E},Ot:function(){return o},VS:function(){return s},_X:function(){return i},gu:function(){return a},lv:function(){return n},qZ:function(){return d},sN:function(){return r},uL:function(){return v},x4:function(){return c}});var t=e(12301);const r="settings_review-workflows",a="Settings/Review_Workflows/RESET_WORKFLOW",d="Settings/Review_Workflows/SET_WORKFLOW",c="Settings/Review_Workflows/WORKFLOW_DELETE_STAGE",o="Settings/Review_Workflows/WORKFLOW_ADD_STAGE",E="Settings/Review_Workflows/WORKFLOW_UPDATE_STAGE",u="Settings/Review_Workflows/WORKFLOW_UPDATE_STAGE_POSITION",s="Settings/Review_Workflows/WORKFLOW_UPDATE",n={primary600:"Blue",primary200:"Lilac",alternative600:"Violet",alternative200:"Lavender",success600:"Green",success200:"Pale Green",danger500:"Cherry",danger200:"Pink",warning600:"Orange",warning200:"Yellow",secondary600:"Teal",secondary200:"Baby Blue",neutral400:"Gray",neutral0:"White"},g=t.W.colors.primary600,v={STAGE:"stage"},l="numberOfWorkflows",i="stagesPerWorkflow"},32329:function(T,m,e){"use strict";e.d(m,{n:function(){return a}});var t=e(45509),r=e(20108);function a(d={}){const{get:c}=(0,t.kY)(),{id:o="",...E}=d,u={populate:"stages"},{data:s,isLoading:n,status:g,refetch:v}=(0,r.useQuery)(["review-workflows","workflows",o],async()=>(await c(`/admin/review-workflows/workflows/${o}`,{params:{...u,...E}})).data);let l=[];return o&&s?.data?l=[s.data]:Array.isArray(s?.data)&&(l=s.data),{meta:s?.meta??{},workflows:l,isLoading:n,status:g,refetch:v}}},79989:function(T,m,e){"use strict";e.d(m,{E:function(){return c},I:function(){return o}});var t=e(97889),r=e(89793),a=e.n(r),d=e(2121);const c={status:"loading",serverState:{workflow:null},clientState:{currentWorkflow:{data:{name:"",contentTypes:[],stages:[]},isDirty:!1,hasDeletedServerStages:!1}}};function o(u=c,s){return(0,t.Uy)(u,n=>{const{payload:g}=s;switch(s.type){case d.qZ:{const{status:v,workflow:l}=g;n.status=v,l&&(n.serverState.workflow=l,n.clientState.currentWorkflow.data={...l,stages:l.stages.map(i=>({...i,color:i?.color??d.FT}))}),n.clientState.currentWorkflow.hasDeletedServerStages=!1;break}case d.gu:{n.clientState.currentWorkflow.data=c.clientState.currentWorkflow.data,n.serverState=c.serverState;break}case d.x4:{const{stageId:v}=g,{currentWorkflow:l}=u.clientState;n.clientState.currentWorkflow.data.stages=l.data.stages.filter(i=>(i?.id??i.__temp_key__)!==v),l.hasDeletedServerStages||(n.clientState.currentWorkflow.hasDeletedServerStages=!!(u.serverState.workflow?.stages??[]).find(i=>i.id===v));break}case d.Ot:{const{currentWorkflow:v}=u.clientState;v.data||(n.clientState.currentWorkflow.data={stages:[]});const l=E(n.clientState.currentWorkflow.data.stages);n.clientState.currentWorkflow.data.stages.push({...g,color:g?.color??d.FT,__temp_key__:l});break}case d.Nj:{const{currentWorkflow:v}=u.clientState,{stageId:l,...i}=g;n.clientState.currentWorkflow.data.stages=v.data.stages.map(h=>(h.id??h.__temp_key__)===l?{...h,...i}:h);break}case d.$k:{const{currentWorkflow:{data:{stages:v}}}=u.clientState,{newIndex:l,oldIndex:i}=g;if(l>=0&&l<v.length){const h=v[i];let x=[...v];x.splice(i,1),x.splice(l,0,h),n.clientState.currentWorkflow.data.stages=x}break}case d.VS:{n.clientState.currentWorkflow.data={...n.clientState.currentWorkflow.data,...g};break}default:break}u.clientState.currentWorkflow.data&&n.serverState.workflow?n.clientState.currentWorkflow.isDirty=!a()((0,t.Vk)(n.clientState.currentWorkflow).data,n.serverState.workflow):n.clientState.currentWorkflow.isDirty=!0})}const E=(u=[])=>{const s=u.map(n=>n.id??n.__temp_key__);return Math.max(...s,-1)+1}},68886:function(T,m,e){"use strict";e.d(m,{k:function(){return a},s:function(){return d}});var t=e(12301),r=e(2121);function a(c){if(!c)return null;const E=Object.entries(t.W.colors).filter(([,u])=>u.toUpperCase()===c.toUpperCase()).reduce((u,[s])=>(r.lv?.[s]&&(u=s),u),null);return E?{themeColorName:E,name:r.lv[E]}:null}function d(){return Object.entries(r.lv).map(([c,o])=>({hex:t.W.colors[c].toUpperCase(),name:o}))}},82920:function(T,m,e){"use strict";e.d(m,{V:function(){return d}});var t=e(3040),r=e.n(t),a=e(24346);async function d({values:c,formatMessage:o}){const E=a.Ry({contentTypes:a.IX().of(a.Z_()),name:a.Z_().max(255,o({id:"Settings.review-workflows.validation.name.max-length",defaultMessage:"Name can not be longer than 255 characters"})).required(),stages:a.IX().of(a.Ry().shape({name:a.Z_().required(o({id:"Settings.review-workflows.validation.stage.name",defaultMessage:"Name is required"})).max(255,o({id:"Settings.review-workflows.validation.stage.max-length",defaultMessage:"Name can not be longer than 255 characters"})).test("unique-name",o({id:"Settings.review-workflows.validation.stage.duplicate",defaultMessage:"Stage name must be unique"}),function(u){const{options:{context:s}}=this;return s.stages.filter(n=>n.name===u).length===1}),color:a.Z_().required(o({id:"Settings.review-workflows.validation.stage.color",defaultMessage:"Color is required"})).matches(/^#(?:[0-9a-fA-F]{3}){1,2}$/i)})).min(1)});try{return await E.validate(c,{abortEarly:!1,context:c}),!0}catch(u){let s={};return u instanceof a.p8&&u.inner.forEach(n=>{r()(s,n.path,n.message)}),s}}},51355:function(T,m,e){var t=e(94318),r=e(3387),a="[object Boolean]";function d(c){return c===!0||c===!1||r(c)&&t(c)==a}T.exports=d},95919:function(T,m,e){var t=e(80022);function r(a){return t(a)&&a!=+a}T.exports=r},80022:function(T,m,e){var t=e(94318),r=e(3387),a="[object Number]";function d(c){return typeof c=="number"||r(c)&&t(c)==a}T.exports=d},83828:function(T,m,e){"use strict";e.d(m,{U:function(){return v},y:function(){return n}});var t=e(74512),r=e(32735),a=e(8471),d=e(91045),c=e(74971),o=e(49372),E=e(87933),u=e(72850);const s=({theme:l,expanded:i,variant:h,disabled:x,error:M})=>M?`1px solid ${l.colors.danger600} !important`:x?`1px solid ${l.colors.neutral150}`:i?`1px solid ${l.colors.primary600}`:h==="primary"?`1px solid ${l.colors.neutral0}`:`1px solid ${l.colors.neutral100}`,n=(0,a.ZP)(o.Z)``,g=(0,a.ZP)(u.x)`
|
|
66
|
-
border: ${s};
|
|
67
|
-
|
|
68
|
-
&:hover:not([aria-disabled='true']) {
|
|
69
|
-
border: 1px solid ${({theme:l})=>l.colors.primary600};
|
|
70
|
-
|
|
71
|
-
${n} {
|
|
72
|
-
color: ${({theme:l,expanded:i})=>i?void 0:l.colors.primary700};
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
${o.Z} {
|
|
76
|
-
color: ${({theme:l,expanded:i})=>i?void 0:l.colors.primary600};
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
& > ${E.k} {
|
|
80
|
-
background: ${({theme:l})=>l.colors.primary100};
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
[data-strapi-dropdown='true'] {
|
|
84
|
-
background: ${({theme:l})=>l.colors.primary200};
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
`,v=({children:l,disabled:i=!1,error:h,expanded:x=!1,hasErrorMessage:M=!0,id:R,onToggle:C,toggle:P,size:A="M",variant:w="primary",shadow:S})=>{const f=(0,c.M)(R),D=r.useMemo(()=>({expanded:x,onToggle:C,toggle:P,id:f,size:A,variant:w,disabled:i}),[i,x,f,C,A,P,w]);return(0,t.jsxs)(d.S.Provider,{value:D,children:[(0,t.jsx)(g,{"data-strapi-expanded":x,disabled:i,"aria-disabled":i,expanded:x,hasRadius:!0,variant:w,error:h,shadow:S,children:l}),h&&M&&(0,t.jsx)(u.x,{paddingTop:1,children:(0,t.jsx)(o.Z,{variant:"pi",textColor:"danger600",children:h})})]})}},89966:function(T,m,e){"use strict";e.d(m,{v:function(){return d}});var t=e(74512),r=e(91045),a=e(72850);const d=({children:c,...o})=>{const{expanded:E,id:u}=(0,r.A)();if(!E)return null;const s=`accordion-content-${u}`,n=`accordion-label-${u}`,g=`accordion-desc-${u}`;return(0,t.jsx)(a.x,{role:"region",id:s,"aria-labelledby":n,"aria-describedby":g,...o,children:c})}},91045:function(T,m,e){"use strict";e.d(m,{A:function(){return a},S:function(){return r}});var t=e(32735);const r=(0,t.createContext)({disabled:!1,expanded:!1,id:"",size:"M",variant:"primary"}),a=()=>(0,t.useContext)(r)},61762:function(T,m,e){"use strict";e.d(m,{B:function(){return l}});var t=e(74512),r=e(16899),a=e(8471),d=e(83828),c=e(91045);const o=({expanded:i,disabled:h,variant:x})=>{let M="neutral100";return i?M="primary100":h?M="neutral150":x==="primary"&&(M="neutral0"),M};var E=e(7563),u=e(99140),s=e(87933),n=e(49372);const g=(0,a.ZP)(E.A)`
|
|
88
|
-
text-align: left;
|
|
89
|
-
|
|
90
|
-
// necessary to make the ellipsis prop work on the title
|
|
91
|
-
> span {
|
|
92
|
-
max-width: 100%;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
svg {
|
|
96
|
-
width: ${14/16}rem;
|
|
97
|
-
height: ${14/16}rem;
|
|
98
|
-
|
|
99
|
-
path {
|
|
100
|
-
fill: ${({theme:i,expanded:h})=>h?i.colors.primary600:i.colors.neutral500};
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
`,v=(0,a.ZP)(s.k)`
|
|
104
|
-
min-height: ${({theme:i,size:h})=>i.sizes.accordions[h]};
|
|
105
|
-
border-radius: ${({theme:i,expanded:h})=>h?`${i.borderRadius} ${i.borderRadius} 0 0`:i.borderRadius};
|
|
106
|
-
|
|
107
|
-
&:hover {
|
|
108
|
-
svg {
|
|
109
|
-
path {
|
|
110
|
-
fill: ${({theme:i})=>i.colors.primary600};
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
`,l=({title:i,description:h,as:x="span",togglePosition:M="right",action:R,...C})=>{const{onToggle:P,toggle:A,expanded:w,id:S,size:f,variant:D,disabled:W}=(0,c.A)(),k=`accordion-content-${S}`,K=`accordion-label-${S}`,V=`accordion-desc-${S}`,b=f==="M"?6:4,N=f==="M"?b:b-2,Z=o({expanded:w,disabled:W,variant:D}),H={as:x,fontWeight:f==="S"?"bold":void 0,id:K,textColor:w?"primary600":"neutral700",ellipsis:!0,variant:f==="M"?"delta":void 0},y=w?"primary600":"neutral600",I=w?"primary200":"neutral200",F=f==="M"?`${32/16}rem`:`${24/16}rem`,L=()=>{W||(A&&!P?(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'),A()):P&&P())},p=(0,t.jsx)(s.k,{justifyContent:"center",borderRadius:"50%",height:F,width:F,transform:w?"rotate(180deg)":void 0,"data-strapi-dropdown":!0,"aria-hidden":!0,as:"span",background:I,cursor:W?"not-allowed":"pointer",onClick:L,shrink:0,children:(0,t.jsx)(u.J,{as:r.Z,width:f==="M"?`${11/16}rem`:`${8/16}rem`,color:w?"primary600":"neutral600"})});return(0,t.jsx)(v,{paddingBottom:N,paddingLeft:b,paddingRight:b,paddingTop:N,background:Z,expanded:w,size:f,justifyContent:"space-between",cursor:W?"not-allowed":"",children:(0,t.jsxs)(s.k,{gap:3,flex:1,maxWidth:"100%",children:[M==="left"&&p,(0,t.jsx)(g,{onClick:L,"aria-disabled":W,"aria-expanded":w,"aria-controls":k,"aria-labelledby":K,"data-strapi-accordion-toggle":!0,expanded:w,type:"button",flex:1,minWidth:0,...C,children:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(d.y,{...H,children:i}),h&&(0,t.jsx)(n.Z,{as:"p",id:V,textColor:y,children:h})]})}),M==="right"&&(0,t.jsxs)(s.k,{gap:3,children:[p,R]}),M==="left"&&R]})})}},29439:function(T,m,e){"use strict";e.d(m,{Z:function(){return a}});var t=e(74512);const r=d=>(0,t.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1rem",height:"1rem",fill:"none",viewBox:"0 0 24 24",...d,children:(0,t.jsx)("path",{fill:"#212134",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"})}),a=r},47081:function(T,m,e){"use strict";e.d(m,{Z:function(){return a}});var t=e(74512);const r=d=>(0,t.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1rem",height:"1rem",fill:"none",viewBox:"0 0 24 24",...d,children:[(0,t.jsx)("path",{fill:"#212134",d:"M16.563 5.587a2.503 2.503 0 1 0 0-5.007 2.503 2.503 0 0 0 0 5.007Z"}),(0,t.jsx)("path",{fill:"#212134",d:"M18.487 3.083c-.012.788-.487 1.513-1.229 1.797a1.954 1.954 0 0 1-2.184-.574A1.943 1.943 0 0 1 14.9 2.11c.4-.684 1.2-1.066 1.981-.927a1.954 1.954 0 0 1 1.606 1.9c.011.748 1.17.748 1.158 0A3.138 3.138 0 0 0 17.565.17c-1.176-.423-2.567-.03-3.36.933-.83 1.002-.968 2.45-.284 3.575.678 1.124 1.993 1.674 3.273 1.431 1.432-.272 2.428-1.593 2.451-3.019.012-.753-1.147-.753-1.158-.006ZM16.563 14.372a2.503 2.503 0 1 0 0-5.007 2.503 2.503 0 0 0 0 5.007Z"}),(0,t.jsx)("path",{fill:"#212134",d:"M18.487 11.867c-.012.789-.487 1.513-1.229 1.797a1.954 1.954 0 0 1-2.184-.574 1.943 1.943 0 0 1-.174-2.196c.4-.684 1.2-1.066 1.981-.927.928.156 1.588.968 1.606 1.9.011.748 1.17.748 1.158 0a3.138 3.138 0 0 0-2.08-2.914c-1.176-.423-2.567-.029-3.36.933-.83 1.002-.968 2.45-.284 3.575.678 1.124 1.993 1.675 3.273 1.431 1.432-.272 2.428-1.593 2.451-3.019.012-.753-1.147-.753-1.158-.005ZM16.563 23.392a2.503 2.503 0 1 0 0-5.006 2.503 2.503 0 0 0 0 5.006Z"}),(0,t.jsx)("path",{fill:"#212134",d:"M18.487 20.89c-.012.787-.487 1.512-1.229 1.796a1.954 1.954 0 0 1-2.184-.574 1.943 1.943 0 0 1-.174-2.196c.4-.684 1.2-1.066 1.981-.927.928.156 1.588.967 1.606 1.9.011.748 1.17.748 1.158 0a3.138 3.138 0 0 0-2.08-2.914c-1.176-.423-2.567-.03-3.36.933-.83 1.002-.968 2.45-.284 3.575.678 1.124 1.993 1.674 3.273 1.431 1.432-.272 2.428-1.593 2.451-3.019.012-.753-1.147-.753-1.158-.006ZM7.378 5.622a2.503 2.503 0 1 0 0-5.007 2.503 2.503 0 0 0 0 5.007Z"}),(0,t.jsx)("path",{fill:"#212134",d:"M9.302 3.119c-.011.788-.486 1.512-1.228 1.796a1.954 1.954 0 0 1-2.185-.574 1.943 1.943 0 0 1-.173-2.196c.4-.684 1.199-1.066 1.981-.927a1.943 1.943 0 0 1 1.605 1.9c.012.748 1.17.748 1.16 0A3.138 3.138 0 0 0 8.38.205c-1.176-.423-2.567-.029-3.36.933-.83 1.002-.968 2.45-.285 3.575.678 1.124 1.994 1.675 3.274 1.431 1.431-.272 2.428-1.593 2.451-3.019.012-.753-1.147-.753-1.159-.005ZM7.378 14.406a2.503 2.503 0 1 0 0-5.006 2.503 2.503 0 0 0 0 5.006Z"}),(0,t.jsx)("path",{fill:"#212134",d:"M9.302 11.902c-.011.788-.486 1.513-1.228 1.797a1.954 1.954 0 0 1-2.185-.574 1.943 1.943 0 0 1-.173-2.196c.4-.684 1.199-1.066 1.981-.927a1.943 1.943 0 0 1 1.605 1.9c.012.748 1.17.748 1.16 0A3.138 3.138 0 0 0 8.38 8.988c-1.176-.423-2.567-.03-3.36.933-.83 1.002-.968 2.45-.285 3.575.678 1.124 1.994 1.674 3.274 1.431 1.431-.272 2.428-1.593 2.451-3.019.012-.753-1.147-.753-1.159-.006ZM7.378 23.427a2.503 2.503 0 1 0 0-5.007 2.503 2.503 0 0 0 0 5.007Z"}),(0,t.jsx)("path",{fill:"#212134",d:"M9.302 20.924c-.011.788-.486 1.513-1.228 1.797a1.954 1.954 0 0 1-2.185-.574 1.943 1.943 0 0 1-.173-2.196c.4-.684 1.199-1.066 1.981-.927.933.156 1.594.967 1.605 1.9.012.748 1.17.748 1.16 0A3.139 3.139 0 0 0 8.38 18.01c-1.176-.423-2.567-.03-3.36.933-.83 1.002-.968 2.45-.285 3.569.678 1.124 1.994 1.675 3.274 1.431 1.431-.272 2.428-1.593 2.451-3.019.012-.747-1.147-.747-1.159 0Z"})]}),a=r},86308:function(T,m,e){"use strict";e.d(m,{Z:function(){return a}});var t=e(74512);const r=d=>(0,t.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1rem",height:"1rem",fill:"none",viewBox:"0 0 24 24",...d,children:[(0,t.jsx)("circle",{cx:12,cy:12,r:12,fill:"#212134"}),(0,t.jsx)("path",{fill:"#F6F6F9",d:"M17 12.569c0 .124-.1.224-.225.224h-3.981v3.982c0 .124-.101.225-.226.225h-1.136a.225.225 0 0 1-.226-.225v-3.981H7.226A.225.225 0 0 1 7 12.567v-1.136c0-.125.1-.226.225-.226h3.982V7.226c0-.124.1-.225.224-.225h1.138c.124 0 .224.1.224.225v3.982h3.982c.124 0 .225.1.225.224v1.138Z"})]}),a=r}}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_strapi_admin=self.webpackChunk_strapi_admin||[]).push([[4174],{84174:function(v,i,e){e.r(i),e.d(i,{REVIEW_WORKFLOW_FILTERS:function(){return P}});var l=e(69997),t=e(32735),u=e(21428),c=e(90333),a=e(60216),n=e.n(a),r=e(67879),o=e(48586),s=e(97108);const E=({value:T,onChange:A})=>{const{formatMessage:W}=(0,r.Z)(),{users:p,isLoading:S}=(0,s.R)();return t.createElement(u.hQ,{value:T,"aria-label":W({id:"content-manager.components.Filters.usersSelect.label",defaultMessage:"Search and select an user to filter"}),onChange:A,loading:S},p.map(O=>t.createElement(c.O,{key:O.id,value:O.id.toString()},(0,o.G)(O,W))))};E.propTypes={onChange:n().func.isRequired,value:n().string},E.defaultProps={value:""};var d=e(77035),g=e(87933),f=e(49372),m=e(23866),C=e(32329),y=e(68886);const R=({value:T,onChange:A,uid:W})=>{const{formatMessage:p}=(0,r.Z)(),{workflows:[S],isLoading:O}=(0,C.n)({filters:{contentTypes:W}});return t.createElement(d.q4,{"aria-label":p({id:"content-manager.components.Filters.reviewWorkflows.label",defaultMessage:"Search and select an workflow stage to filter"}),value:T,onChange:A,loading:O,customizeContent:()=>t.createElement(g.k,{as:"span",justifyContent:"space-between",alignItems:"center",width:"100%"},t.createElement(f.Z,{textColor:"neutral800",ellipsis:!0},T),O?t.createElement(m.a,{small:!0,style:{display:"flex"}}):null)},(S?.stages??[]).map(({id:h,color:L,name:w})=>{const{themeColorName:F}=(0,y.k)(L);return t.createElement(d.ag,{key:h,startIcon:t.createElement(g.k,{height:2,background:L,borderColor:F==="neutral0"?"neutral150":"transparent",hasRadius:!0,shrink:0,width:2}),value:w},w)}))};R.defaultProps={value:""},R.propTypes={onChange:n().func.isRequired,uid:n().string.isRequired,value:n().string};const P=[{fieldSchema:{type:"relation",mainField:{name:"name",schema:{type:"string"}}},metadatas:{customInput:R,label:{id:(0,l.OB)("containers.ListPage.table-headers.reviewWorkflows.stage"),defaultMessage:"Review stage"}},name:"strapi_stage"},{fieldSchema:{type:"relation",mainField:{name:"id",schema:{type:"int"}}},metadatas:{customInput:E,customOperators:[{intlLabel:{id:"components.FilterOptions.FILTER_TYPES.$eq",defaultMessage:"is"},value:"$eq"},{intlLabel:{id:"components.FilterOptions.FILTER_TYPES.$ne",defaultMessage:"is not"},value:"$ne"}],label:{id:(0,l.OB)("containers.ListPage.table-headers.reviewWorkflows.assignee.label"),defaultMessage:"Assignee"}},name:"strapi_assignee"}]},2121:function(v,i,e){e.d(i,{$k:function(){return o},Ef:function(){return f},FT:function(){return d},Nj:function(){return r},Ot:function(){return n},VS:function(){return s},_X:function(){return m},gu:function(){return u},lv:function(){return E},qZ:function(){return c},sN:function(){return t},uL:function(){return g},x4:function(){return a}});var l=e(12301);const t="settings_review-workflows",u="Settings/Review_Workflows/RESET_WORKFLOW",c="Settings/Review_Workflows/SET_WORKFLOW",a="Settings/Review_Workflows/WORKFLOW_DELETE_STAGE",n="Settings/Review_Workflows/WORKFLOW_ADD_STAGE",r="Settings/Review_Workflows/WORKFLOW_UPDATE_STAGE",o="Settings/Review_Workflows/WORKFLOW_UPDATE_STAGE_POSITION",s="Settings/Review_Workflows/WORKFLOW_UPDATE",E={primary600:"Blue",primary200:"Lilac",alternative600:"Violet",alternative200:"Lavender",success600:"Green",success200:"Pale Green",danger500:"Cherry",danger200:"Pink",warning600:"Orange",warning200:"Yellow",secondary600:"Teal",secondary200:"Baby Blue",neutral400:"Gray",neutral0:"White"},d=l.W.colors.primary600,g={STAGE:"stage"},f="numberOfWorkflows",m="stagesPerWorkflow"},32329:function(v,i,e){e.d(i,{n:function(){return u}});var l=e(45509),t=e(20108);function u(c={}){const{get:a}=(0,l.kY)(),{id:n="",...r}=c,o={populate:"stages"},{data:s,isLoading:E,status:d,refetch:g}=(0,t.useQuery)(["review-workflows","workflows",n],async()=>(await a(`/admin/review-workflows/workflows/${n}`,{params:{...o,...r}})).data);let f=[];return n&&s?.data?f=[s.data]:Array.isArray(s?.data)&&(f=s.data),{meta:s?.meta??{},workflows:f,isLoading:E,status:d,refetch:g}}},68886:function(v,i,e){e.d(i,{k:function(){return u},s:function(){return c}});var l=e(12301),t=e(2121);function u(a){if(!a)return null;const r=Object.entries(l.W.colors).filter(([,o])=>o.toUpperCase()===a.toUpperCase()).reduce((o,[s])=>(t.lv?.[s]&&(o=s),o),null);return r?{themeColorName:r,name:t.lv[r]}:null}function c(){return Object.entries(t.lv).map(([a,n])=>({hex:l.W.colors[a].toUpperCase(),name:n}))}}}]);
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_strapi_admin=self.webpackChunk_strapi_admin||[]).push([[4724],{4468:function(I,c,t){t.d(c,{I:function(){return e},U:function(){return n}});const e="strapi_stage",n="strapi_assignee"},91130:function(I,c,t){t.r(c),t.d(c,{InformationBoxEE:function(){return Y}});var e=t(32735),n=t(45509),s=t(98865),E=t(87107),a=t(87933),u=t(21428),i=t(49372),o=t(23866),r=t(90333),v=t(67879),d=t(20108),p=t(15062),w=t(69997),C=t(97108),P=t(30305),l=t(4468);function K(){const{initialData:R,layout:{uid:M},isSingleType:k,onChange:j}=(0,n.Wq)(),Q=(0,p.v9)(P._),{formatMessage:g}=(0,v.Z)(),{formatAPIError:H}=(0,n.So)(),V=(0,n.lm)(),{put:X}=(0,n.kY)(),{allowedActions:{canReadUsers:L}}=(0,n.ss)({readUsers:Q.settings.users.read}),{users:B,isLoading:x,isError:F}=(0,C.R)({},{enabled:L}),h=R?.[l.U]??null,S=async({value:f})=>{y.mutate({entityId:R.id,assigneeId:parseInt(f,10),uid:M})},y=(0,d.useMutation)(async({entityId:f,assigneeId:z,uid:b})=>{const T=k?"single-types":"collection-types",{data:{data:W}}=await X(`/admin/content-manager/${T}/${b}/${f}/assignee`,{data:{id:z}});return j({target:{name:l.U,value:W[l.U]}},!0),W},{onSuccess(){V({type:"success",message:{id:"content-manager.reviewWorkflows.assignee.notification.saved",defaultMessage:"Assignee updated"}})}});return e.createElement(E.g,{name:l.U,id:l.U},e.createElement(a.k,{direction:"column",gap:2,alignItems:"stretch"},e.createElement(u.hQ,{clearLabel:g({id:"content-manager.reviewWorkflows.assignee.clear",defaultMessage:"Clear assignee"}),error:F&&L&&g({id:"content-manager.reviewWorkflows.assignee.error",defaultMessage:"An error occurred while fetching users"})||y.error&&H(y.error),disabled:!x&&B.length===0,name:l.U,id:l.U,value:h?h.id:null,onChange:f=>S({value:f}),onClear:()=>S({value:null}),placeholder:g({id:"content-manager.reviewWorkflows.assignee.placeholder",defaultMessage:"Select \u2026"}),label:g({id:"content-manager.reviewWorkflows.assignee.label",defaultMessage:"Assignee"}),customizeContent:()=>e.createElement(a.k,{as:"span",justifyContent:"space-between",alignItems:"center",width:"100%"},e.createElement(i.Z,{textColor:"neutral800",ellipsis:!0},h?(0,w.Gf)(h,g):null),x||y.isLoading?e.createElement(o.a,{small:!0,style:{display:"flex"}}):null)},B.map(f=>e.createElement(r.O,{key:f.id,value:f.id,textValue:(0,w.Gf)(f,g)},(0,w.Gf)(f,g))))))}var D=t(77035),U=t(47851),$=t(98866),O=t(90562),A=t(2121),m=t(32329),N=t(68886);function Z(){const{initialData:R,layout:{uid:M},isSingleType:k,onChange:j}=(0,n.Wq)(),{put:Q}=(0,n.kY)(),{formatMessage:g}=(0,v.Z)(),{formatAPIError:H}=(0,n.So)(),V=(0,n.lm)(),{meta:X,workflows:[L],isLoading:B}=(0,m.n)({filters:{contentTypes:M}}),{getFeature:x}=(0,$.q)(),[F,h]=e.useState(!1),S=x("review-workflows"),y=R?.[l.I]??null,f=(0,d.useMutation)(async({entityId:T,stageId:W,uid:G})=>{const J=k?"single-types":"collection-types",{data:{data:q}}=await Q(`/admin/content-manager/${J}/${G}/${T}/stage`,{data:{id:W}});return j({target:{name:l.I,value:q[l.I]}},!0),q},{onSuccess(){V({type:"success",message:{id:"content-manager.reviewWorkflows.stage.notification.saved",defaultMessage:"Review stage updated"}})}}),z=async({value:T})=>{try{S?.[A.Ef]&&parseInt(S[A.Ef],10)<X.workflowCount?h("workflow"):S?.[A._X]&&parseInt(S[A._X],10)<L.stages.length?h("stage"):f.mutateAsync({entityId:R.id,stageId:T,uid:M})}catch{}},{themeColorName:b}=y?.color?(0,N.k)(y?.color):{};return e.createElement(e.Fragment,null,e.createElement(E.g,{name:l.I,id:l.I},e.createElement(a.k,{direction:"column",gap:2,alignItems:"stretch"},e.createElement(D.q4,{error:f.error&&H(f.error)||null,name:l.I,id:l.I,value:y?.id,onChange:T=>z({value:T}),label:g({id:"content-manager.reviewWorkflows.stage.label",defaultMessage:"Review stage"}),startIcon:e.createElement(a.k,{as:"span",height:2,background:y?.color,borderColor:b==="neutral0"?"neutral150":"transparent",hasRadius:!0,shrink:0,width:2,marginRight:"-3px"}),customizeContent:()=>e.createElement(a.k,{as:"span",justifyContent:"space-between",alignItems:"center",width:"100%"},e.createElement(i.Z,{textColor:"neutral800",ellipsis:!0},y?.name),B?e.createElement(o.a,{small:!0,style:{display:"flex"}}):null)},L?L.stages.map(({id:T,color:W,name:G})=>{const{themeColorName:J}=(0,N.k)(W);return e.createElement(D.ag,{key:T,startIcon:e.createElement(a.k,{height:2,background:W,borderColor:J==="neutral0"?"neutral150":"transparent",hasRadius:!0,shrink:0,width:2}),value:T,textValue:G},G)}):[]),e.createElement(U.c,null))),e.createElement(O.fC,{isOpen:F==="workflow",onClose:()=>h(!1)},e.createElement(O.Dx,null,g({id:"content-manager.reviewWorkflows.workflows.limit.title",defaultMessage:"You\u2019ve reached the limit of workflows in your plan"})),e.createElement(O.uT,null,g({id:"content-manager.reviewWorkflows.workflows.limit.body",defaultMessage:"Delete a workflow or contact Sales to enable more workflows."}))),e.createElement(O.fC,{isOpen:F==="stage",onClose:()=>h(!1)},e.createElement(O.Dx,null,g({id:"content-manager.reviewWorkflows.stages.limit.title",defaultMessage:"You have reached the limit of stages for this workflow in your plan"})),e.createElement(O.uT,null,g({id:"content-manager.reviewWorkflows.stages.limit.body",defaultMessage:"Try deleting some stages or contact Sales to enable more stages."}))))}function Y(){const{isCreatingEntry:R,layout:{options:M}}=(0,n.Wq)(),k=M?.reviewWorkflows??!1;return e.createElement(s.d.Root,null,e.createElement(s.d.Title,null),k&&!R&&e.createElement(e.Fragment,null,e.createElement(Z,null),e.createElement(K,null)),e.createElement(s.d.Body,null))}},98866:function(I,c,t){t.d(c,{q:function(){return E}});var e=t(32735),n=t(45509),s=t(20108);function E({enabled:a}={enabled:!0}){const{get:u}=(0,n.kY)(),{data:i,isError:o,isLoading:r}=(0,s.useQuery)(["ee","license-limit-info"],async()=>{const{data:{data:p}}=await u("/admin/license-limit-information");return p},{enabled:a}),v=e.useMemo(()=>i??{},[i]),d=e.useCallback(p=>(v?.features??[]).find(C=>C.name===p)?.options??{},[v?.features]);return{license:v,getFeature:d,isError:o,isLoading:r}}},90562:function(I,c,t){t.d(c,{uT:function(){return U},fC:function(){return A},Dx:function(){return D}});var e=t(32735),n=t(49372),s=t(87933),E=t(85025),a=t(31600),u=t(72850),i=t(50563),o=t(95489),r=t(35331),v=t(60216),d=t.n(v),p=t(67879),w=t(8471),C=t.p+"0cd5f8915b265d5b1856.png";const P="limits-title",l="https://strapi.io/pricing-cloud",K="https://strapi.io/contact-sales";function D({children:m}){return e.createElement(n.Z,{variant:"alpha",id:P},m)}D.propTypes={children:d().node.isRequired};function U({children:m}){return e.createElement(n.Z,{variant:"omega"},m)}U.propTypes={children:d().node.isRequired};function $(){const{formatMessage:m}=(0,p.Z)();return e.createElement(s.k,{gap:2,paddingTop:4},e.createElement(o.Q,{variant:"default",isExternal:!0,href:l},m({id:"Settings.review-workflows.limit.cta.learn",defaultMessage:"Learn more"})),e.createElement(o.Q,{variant:"tertiary",isExternal:!0,href:K},m({id:"Settings.review-workflows.limit.cta.sales",defaultMessage:"Contact Sales"})))}const O=w.ZP.img`
|
|
2
|
-
// Margin top|right reverse the padding of ModalBody
|
|
3
|
-
margin-right: ${({theme:m})=>`-${m.spaces[7]}`};
|
|
4
|
-
margin-top: ${({theme:m})=>`-${m.spaces[7]}`};
|
|
5
|
-
width: 360px;
|
|
6
|
-
`;function A({children:m,isOpen:N,onClose:Z}){const{formatMessage:Y}=(0,p.Z)();return N?e.createElement(E.P,{labelledBy:P},e.createElement(a.f,null,e.createElement(s.k,{gap:2,paddingLeft:7,position:"relative"},e.createElement(s.k,{alignItems:"start",direction:"column",gap:2,width:"60%"},m,e.createElement($,null)),e.createElement(s.k,{justifyContent:"end",height:"100%",width:"40%"},e.createElement(O,{src:C,"aria-hidden":!0,alt:"",loading:"lazy"}),e.createElement(u.x,{display:"flex",position:"absolute",right:0,top:0},e.createElement(i.h,{icon:e.createElement(r.Z,null),"aria-label":Y({id:"global.close",defaultMessage:"Close"}),onClick:Z})))))):null}A.defaultProps={isOpen:!1},A.propTypes={children:d().node.isRequired,isOpen:d().bool,onClose:d().func.isRequired}},2121:function(I,c,t){t.d(c,{$k:function(){return o},Ef:function(){return w},FT:function(){return d},Nj:function(){return i},Ot:function(){return u},VS:function(){return r},_X:function(){return C},gu:function(){return s},lv:function(){return v},qZ:function(){return E},sN:function(){return n},uL:function(){return p},x4:function(){return a}});var e=t(12301);const n="settings_review-workflows",s="Settings/Review_Workflows/RESET_WORKFLOW",E="Settings/Review_Workflows/SET_WORKFLOW",a="Settings/Review_Workflows/WORKFLOW_DELETE_STAGE",u="Settings/Review_Workflows/WORKFLOW_ADD_STAGE",i="Settings/Review_Workflows/WORKFLOW_UPDATE_STAGE",o="Settings/Review_Workflows/WORKFLOW_UPDATE_STAGE_POSITION",r="Settings/Review_Workflows/WORKFLOW_UPDATE",v={primary600:"Blue",primary200:"Lilac",alternative600:"Violet",alternative200:"Lavender",success600:"Green",success200:"Pale Green",danger500:"Cherry",danger200:"Pink",warning600:"Orange",warning200:"Yellow",secondary600:"Teal",secondary200:"Baby Blue",neutral400:"Gray",neutral0:"White"},d=e.W.colors.primary600,p={STAGE:"stage"},w="numberOfWorkflows",C="stagesPerWorkflow"},32329:function(I,c,t){t.d(c,{n:function(){return s}});var e=t(45509),n=t(20108);function s(E={}){const{get:a}=(0,e.kY)(),{id:u="",...i}=E,o={populate:"stages"},{data:r,isLoading:v,status:d,refetch:p}=(0,n.useQuery)(["review-workflows","workflows",u],async()=>(await a(`/admin/review-workflows/workflows/${u}`,{params:{...o,...i}})).data);let w=[];return u&&r?.data?w=[r.data]:Array.isArray(r?.data)&&(w=r.data),{meta:r?.meta??{},workflows:w,isLoading:v,status:d,refetch:p}}},68886:function(I,c,t){t.d(c,{k:function(){return s},s:function(){return E}});var e=t(12301),n=t(2121);function s(a){if(!a)return null;const i=Object.entries(e.W.colors).filter(([,o])=>o.toUpperCase()===a.toUpperCase()).reduce((o,[r])=>(n.lv?.[r]&&(o=r),o),null);return i?{themeColorName:i,name:n.lv[i]}:null}function E(){return Object.entries(n.lv).map(([a,u])=>({hex:e.W.colors[a].toUpperCase(),name:u}))}}}]);
|
|
@@ -1,267 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_strapi_admin=self.webpackChunk_strapi_admin||[]).push([[2544],{64499:function(H,L,o){"use strict";o.d(L,{V:function(){return P}});var e=o(45509),v=o(20108);const P=(b={},O={})=>{const{id:A,...x}=b,{get:E}=(0,e.kY)();if(!A&&(O?.enabled===void 0||O?.enabled))throw new Error('"id" is a required argument');const{data:M,error:W,isError:a,isLoading:B,refetch:p}=(0,v.useQuery)(["roles",A,"permissions",x],async()=>{const{data:{data:S}}=await E(`/admin/roles/${A}/permissions`,{params:x});return S},O);return{permissions:M,error:W,isError:a,isLoading:B,refetch:p}}},86409:function(H,L,o){"use strict";o.d(L,{F:function(){return b}});var e=o(45509),v=o(67879),P=o(20108);const b=(O={},A={})=>{const{id:x="",...E}=O,{get:M}=(0,e.kY)(),{locale:W}=(0,v.Z)(),a=(0,e.Xe)(W,{sensitivity:"base"}),{data:B,error:p,isError:S,isLoading:F,refetch:g}=(0,P.useQuery)(["roles",x,E],async()=>{const{data:V}=await M(`/admin/roles/${x??""}`,{params:E});return V},A);let y=[];return x&&B?y=[B.data]:Array.isArray(B?.data)&&(y=B.data),{roles:y.sort((V,oe)=>a.compare(V.name,oe.name)),error:p,isError:S,isLoading:F,refetch:g}}},15570:function(H,L,o){"use strict";o.r(L),o.d(L,{CreatePage:function(){return Re},default:function(){return Se}});var e=o(32735),v=o(27649),P=o(82055),b=o(87933),O=o(41415),A=o(17e3),x=o(72850),E=o(49372),M=o(15335),W=o(5803),a=o(10369),B=o(33475),p=o(45509),S=o(29439),F=o(14723),g=o(92802),y=o(86834),V=o.n(y),oe=o(67879),de=o(15062),re=o(53038),C=o(8471),me=o(64499),X=o(30305),G=o(1283),_=o(91720),Ce=o(24346),xe=Ce.Ry().shape({name:Ce.Z_().required(p.I0.required),description:Ce.Z_().required(p.I0.required)});const ae=C.ZP.div`
|
|
2
|
-
border: 1px solid ${({theme:z})=>z.colors.primary200};
|
|
3
|
-
background: ${({theme:z})=>z.colors.primary100};
|
|
4
|
-
padding: ${({theme:z})=>`${z.spaces[2]} ${z.spaces[4]}`};
|
|
5
|
-
color: ${({theme:z})=>z.colors.primary600};
|
|
6
|
-
border-radius: ${({theme:z})=>z.borderRadius};
|
|
7
|
-
font-size: ${12/16}rem;
|
|
8
|
-
font-weight: bold;
|
|
9
|
-
`,Re=()=>{const z=(0,re.$B)("/settings/roles/duplicate/:id"),Y=(0,p.lm)(),{lockApp:ne,unlockApp:w}=(0,p.o1)(),{formatMessage:j}=(0,oe.Z)(),[Q,he]=(0,e.useState)(!1),{replace:pe}=(0,re.k6)(),J=(0,e.useRef)(),{trackUsage:ce}=(0,p.rS)(),{post:Ie,put:Be}=(0,p.kY)(),{params:ve}=z??{},{isLoading:Ze,data:Le}=(0,_.d)(ve?.id,{cacheTime:0}),{permissions:ye,isLoading:Me}=(0,me.V)({id:ve?.id},{cacheTime:0,enabled:!!ve?.id}),Fe=Pe=>{ne(),he(!0),ve?.id?ce("willDuplicateRole"):ce("willCreateNewRole"),Promise.resolve(Ie("/admin/roles",Pe)).then(async({data:ee})=>{const{permissionsToSend:ie}=J.current.getPermissions();return ve?.id?ce("didDuplicateRole"):ce("didCreateNewRole"),ee.data.id&&!V()(ie)&&await Be(`/admin/roles/${ee.data.id}/permissions`,{permissions:ie}),ee}).then(ee=>{he(!1),Y({type:"success",message:{id:"Settings.roles.created",defaultMessage:"created"}}),pe(`/settings/roles/${ee.data.id}`)}).catch(ee=>{console.error(ee),he(!1),Y({type:"warning",message:{id:"notification.error"}})}).finally(()=>{w()})},He=`${j({id:"Settings.roles.form.created",defaultMessage:"Created"})} ${(0,F.Z)(new Date,"PPP")}`;return e.createElement(v.o,null,e.createElement(p.SL,{name:"Roles"}),e.createElement(g.J9,{initialValues:{name:"",description:He},onSubmit:Fe,validationSchema:xe,validateOnChange:!1},({handleSubmit:Pe,values:ee,errors:ie,handleReset:le,handleChange:ue})=>e.createElement(p.l0,{noValidate:!0},e.createElement(e.Fragment,null,e.createElement(P.T,{primaryAction:e.createElement(b.k,{gap:2},e.createElement(O.z,{variant:"secondary",onClick:()=>{le(),J.current.resetForm()},size:"L"},j({id:"app.components.Button.reset",defaultMessage:"Reset"})),e.createElement(O.z,{onClick:Pe,loading:Q,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(p.rU,{startIcon:e.createElement(S.Z,null),to:"/settings/roles"},j({id:"global.back",defaultMessage:"Back"}))}),e.createElement(A.D,null,e.createElement(b.k,{direction:"column",alignItems:"stretch",gap:6},e.createElement(x.x,{background:"neutral0",padding:6,shadow:"filterShadow",hasRadius:!0},e.createElement(b.k,{direction:"column",alignItems:"stretch",gap:4},e.createElement(b.k,{justifyContent:"space-between"},e.createElement(x.x,null,e.createElement(x.x,null,e.createElement(E.Z,{fontWeight:"bold"},j({id:"global.details",defaultMessage:"Details"}))),e.createElement(x.x,null,e.createElement(E.Z,{variant:"pi",textColor:"neutral600"},j({id:"Settings.roles.form.description",defaultMessage:"Name and description of the role"})))),e.createElement(ae,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(M.r,{gap:4},e.createElement(W.P,{col:6},e.createElement(a.o,{name:"name",error:ie.name&&j({id:ie.name}),label:j({id:"global.name",defaultMessage:"Name"}),onChange:ue,required:!0,value:ee.name})),e.createElement(W.P,{col:6},e.createElement(B.g,{label:j({id:"global.description",defaultMessage:"Description"}),id:"description",error:ie.description&&j({id:ie.description}),onChange:ue},ee.description))))),!Ze&&!Me?e.createElement(x.x,{shadow:"filterShadow",hasRadius:!0},e.createElement(G.Z,{isFormDisabled:!1,ref:J,permissions:ye,layout:Le})):e.createElement(x.x,{background:"neutral0",padding:6,shadow:"filterShadow",hasRadius:!0},e.createElement(p.dO,null))))))))};function Se(){const z=(0,de.v9)(X._);return e.createElement(p.O4,{permissions:z.settings.roles.create},e.createElement(Re,null))}},1283:function(H,L,o){"use strict";o.d(L,{Z:function(){return ts}});var e=o(32735),v=o(91215),P=o(90980),b=o(3653),O=o(45509),A=o(23973),x=o.n(A),E=o(86834),M=o.n(E),W=o(60216),a=o.n(W),B=o(67879),p=o(72850),S=o(98978),F=o.n(S),g=o(8471),y=o(87933),V=o(82884),oe=o(15974),de=o(96441),re=o(33795),C=o.n(re),me=o(9086),X=o.n(me),G=o(79652),_=o(41415),Ce=o(45112);const be=g.ZP.div`
|
|
10
|
-
position: relative;
|
|
11
|
-
|
|
12
|
-
${({hasConditions:t,disabled:n,theme:r})=>t&&`
|
|
13
|
-
&:before {
|
|
14
|
-
content: '';
|
|
15
|
-
position: absolute;
|
|
16
|
-
top: -3px;
|
|
17
|
-
left: -10px;
|
|
18
|
-
width: 6px;
|
|
19
|
-
height: 6px;
|
|
20
|
-
border-radius: ${20/16}rem;;
|
|
21
|
-
background: ${n?r.colors.neutral100:r.colors.primary600};
|
|
22
|
-
}
|
|
23
|
-
`}
|
|
24
|
-
`,xe=({onClick:t,className:n,hasConditions:r,variant:s})=>{const{formatMessage:i}=(0,B.Z)();return e.createElement(be,{hasConditions:r,className:n},e.createElement(_.z,{variant:s,startIcon:e.createElement(Ce.Z,null),onClick:t},i({id:"global.settings",defaultMessage:"Settings"})))};xe.defaultProps={className:null,hasConditions:!1,variant:"tertiary"},xe.propTypes={onClick:a().func.isRequired,className:a().string,hasConditions:a().bool,variant:a().string};var ae=(0,g.ZP)(xe)``,Re=o(85025),Se=o(55225),z=o(31600),Y=o(49372),ne=o(11406),w=o(26858),j=o(51654),Q=o(97889),he=o(81346),pe=o.n(he),J=o(23940),ce=o.n(J),Ie=o(27799);const Be=t=>Object.values(t).map(n=>Object.entries(n).filter(([,r])=>r).map(([r])=>r)).flat(),ve=t=>t.reduce((n,[r,s])=>(n.push({label:ce()(r),children:s.map(i=>({label:i.displayName,value:i.id}))}),n),[]),Ze=(t,n)=>t.map(([,r])=>r).flat().reduce((r,s)=>({[s.id]:n.includes(s.id),...r}),{}),Le=({arrayOfOptionsGroupedByCategory:t,isFormDisabled:n,isGrey:r,label:s,name:i,onChange:l,value:d})=>{const{formatMessage:c}=(0,B.Z)(),m=u=>{l(i,Ze(t,u))};return e.createElement(y.k,{as:"li",background:r?"neutral100":"neutral0",paddingBottom:3,paddingTop:3},e.createElement(y.k,{paddingLeft:6,style:{width:180}},e.createElement(Y.Z,{variant:"sigma",textColor:"neutral600"},c({id:"Settings.permissions.conditions.can",defaultMessage:"Can"}),"\xA0"),e.createElement(Y.Z,{variant:"sigma",title:s,textColor:"primary600",ellipsis:!0},c({id:`Settings.roles.form.permissions.${s.toLowerCase()}`,defaultMessage:s})),e.createElement(Y.Z,{variant:"sigma",textColor:"neutral600"},"\xA0",c({id:"Settings.permissions.conditions.when",defaultMessage:"When"}))),e.createElement(p.x,{style:{maxWidth:430,width:"100%"}},e.createElement(Ie.Q,{id:i,customizeContent:u=>`${u.length} currently selected`,onChange:m,value:Be(d),options:ve(t),disabled:n})))};Le.propTypes={arrayOfOptionsGroupedByCategory:a().array.isRequired,isFormDisabled:a().bool.isRequired,isGrey:a().bool.isRequired,label:a().string.isRequired,name:a().string.isRequired,value:a().object.isRequired,onChange:a().func.isRequired};var ye=Le;const Me=(t,n)=>t.reduce((r,s)=>(r[s.id]=C()(n,s.id,!1),r),{}),Fe=(t,n)=>t.reduce((r,s)=>{const[i,l]=s,d=Me(l,n);return r[i]=d,r},{});var Pe=(t,n,r)=>t.reduce((s,i)=>{const l=C()(n,[...i.pathToConditionsObject,"conditions"],{}),d=Fe(r,l);return s[i.pathToConditionsObject.join("..")]=d,s},{});const ee=({actions:t,headerBreadCrumbs:n,isFormDisabled:r,onClosed:s,onToggle:i})=>{const{formatMessage:l}=(0,B.Z)(),{availableConditions:d,modifiedData:c,onChangeConditions:m}=(0,G.$_)(),u=(0,e.useMemo)(()=>Object.entries(pe()(d,"category")),[d]),f=t.filter(({isDisplayed:h,hasSomeActionsSelected:I,hasAllActionsSelected:D})=>h&&(I||D)),R=(0,e.useMemo)(()=>Pe(f,c,u),[f,c,u]),[$,N]=(0,e.useState)(R),k=(h,I)=>{N((0,Q.ZP)(D=>{D[h]||(D[h]={}),D[h].default||(D[h].default={}),D[h].default=I}))},T=()=>{const h=Object.entries($).reduce((I,D)=>{const[Z,te]=D,U=Object.values(te).reduce((q,K)=>({...q,...K}),{});return I[Z]=U,I},{});m(h),i()};return e.createElement(Re.P,{labelledBy:"condition-modal-breadcrumbs",onClose:s},e.createElement(Se.x,null,e.createElement(w.O,{id:"condition-modal-breadcrumbs",label:n.join(", ")},n.map((h,I,D)=>e.createElement(j.$,{isCurrent:I===D.length-1,key:h},ce()(l({id:h,defaultMessage:h})))))),e.createElement(z.f,null,f.length===0&&e.createElement(Y.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,f.map(({actionId:h,label:I,pathToConditionsObject:D},Z)=>{const te=D.join("..");return e.createElement(ye,{key:h,arrayOfOptionsGroupedByCategory:u,label:I,isFormDisabled:r,isGrey:Z%2===0,name:te,onChange:k,value:C()($,te,{})})}))),e.createElement(ne.m,{startActions:e.createElement(_.z,{variant:"tertiary",onClick:i},l({id:"app.components.Button.cancel",defaultMessage:"Cancel"})),endActions:e.createElement(_.z,{onClick:T},l({id:"Settings.permissions.conditions.apply",defaultMessage:"Apply"}))}))};ee.propTypes={actions:a().arrayOf(a().shape({actionId:a().string.isRequired,checkboxName:a().string,hasSomeActionsSelected:a().bool.isRequired,hasAllActionsSelected:a().bool,isDisplayed:a().bool.isRequired,label:a().string})).isRequired,headerBreadCrumbs:a().arrayOf(a().string).isRequired,isFormDisabled:a().bool.isRequired,onClosed:a().func.isRequired,onToggle:a().func.isRequired};var ie=ee;const le=`${120/16}rem`,ue=`${200/16}rem`,Ae=`${53/16}rem`;var Ne=g.ZP.div`
|
|
25
|
-
width: ${le};
|
|
26
|
-
`,rt=(0,g.ZP)(y.k)`
|
|
27
|
-
padding-right: ${({theme:t})=>t.spaces[2]};
|
|
28
|
-
overflow: hidden;
|
|
29
|
-
flex: 1;
|
|
30
|
-
${({isCollapsable:t})=>t&&"cursor: pointer;"}
|
|
31
|
-
`;const Ge=({children:t,isCollapsable:n,isActive:r,isFormDisabled:s,label:i,onChange:l,onClick:d,checkboxName:c,someChecked:m,value:u})=>{const{formatMessage:f}=(0,B.Z)();return e.createElement(y.k,{alignItems:"center",paddingLeft:6,style:{width:ue,flexShrink:0}},e.createElement(p.x,{paddingRight:2},e.createElement(V.C,{name:c,"aria-label":f({id:"Settings.permissions.select-all-by-permission",defaultMessage:"Select all {label} permissions"},{label:i}),disabled:s,onValueChange:R=>l({target:{name:c,value:R}}),indeterminate:m,value:u})),e.createElement(rt,{title:i,alignItems:"center",isCollapsable:n,...n&&{onClick:d,"aria-expanded":r,onKeyDown:({key:R})=>(R==="Enter"||R===" ")&&d(),tabIndex:0,role:"button"}},e.createElement(Y.Z,{fontWeight:r?"bold":"",textColor:r?"primary600":"neutral800",ellipsis:!0},ce()(i)),t))};Ge.defaultProps={children:null,checkboxName:"",onChange(){},value:!1,someChecked:!1,isCollapsable:!1},Ge.propTypes={checkboxName:a().string,children:a().node,label:a().string.isRequired,isCollapsable:a().bool,isFormDisabled:a().bool.isRequired,onChange:a().func,onClick:a().func.isRequired,someChecked:a().bool,value:a().bool,isActive:a().bool.isRequired};var at=(0,e.memo)(Ge),Nt=o(72091),Wt=o.n(Nt),Vt=o(85973),Te=o.n(Vt);const it=t=>Te()(t)?Wt()(Object.values(t).map(n=>Te()(n)?it(n):n)):[];var je=it,ze=t=>t?Object.keys(t).reduce((n,r)=>(r!=="conditions"&&(n[r]=t[r]),n),{}):null,Oe=t=>{const n=ze(t),r=je(n);if(!r.length)return{hasAllActionsSelected:!1,hasSomeActionsSelected:!1};const s=r.every(l=>l),i=r.some(l=>l)&&!s;return{hasAllActionsSelected:s,hasSomeActionsSelected:i}},Kt=o(16899),We=(0,g.ZP)(Kt.Z)`
|
|
32
|
-
display: none;
|
|
33
|
-
width: ${10/16}rem;
|
|
34
|
-
transform: rotate(${({$isActive:t})=>t?"180":"0"}deg);
|
|
35
|
-
margin-left: ${({theme:t})=>t.spaces[2]};
|
|
36
|
-
`,Ve=t=>`
|
|
37
|
-
${Y.Z} {
|
|
38
|
-
color: ${t.colors.primary600};
|
|
39
|
-
font-weight: ${t.fontWeights.bold}
|
|
40
|
-
}
|
|
41
|
-
${We} {
|
|
42
|
-
display: block;
|
|
43
|
-
path {
|
|
44
|
-
fill: ${t.colors.primary600}
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
`,Ht=(t,n,r)=>t.map(({actionId:s,isDisplayed:i,applyToProperties:l,label:d})=>{if(!i)return{actionId:s,hasSomeActionsSelected:!1,isDisplayed:i};const c=[...r.split(".."),s],m=M()(l)?[...c,"properties","enabled"]:c,u=m.join(".."),f=C()(n,[...c,"conditions"],null),R=je(f).some(T=>T);if(M()(l)){const T=C()(n,m,!1);return{actionId:s,checkboxName:u,hasAllActionsSelected:T,hasConditions:R,hasSomeActionsSelected:T,isDisplayed:i,isParentCheckbox:!1,label:d,pathToConditionsObject:c}}const $=C()(n,m,null),{hasAllActionsSelected:N,hasSomeActionsSelected:k}=Oe($);return{actionId:s,checkboxName:u,hasAllActionsSelected:N,hasConditions:R,hasSomeActionsSelected:k,isDisplayed:i,isParentCheckbox:!0,label:d,pathToConditionsObject:c}});const we=(t,n)=>`
|
|
48
|
-
${lt} {
|
|
49
|
-
background-color: ${t.colors.primary100};
|
|
50
|
-
color: ${t.colors.primary600};
|
|
51
|
-
border-radius: ${n?"2px 2px 0 0":"2px"};
|
|
52
|
-
}
|
|
53
|
-
${ct} {
|
|
54
|
-
display: flex;
|
|
55
|
-
}
|
|
56
|
-
${ae} {
|
|
57
|
-
display: block;
|
|
58
|
-
}
|
|
59
|
-
&:hover {
|
|
60
|
-
${Ve(t)}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
&:focus-within {
|
|
64
|
-
${({theme:r,isActive:s})=>we(r,s)}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
`,lt=g.ZP.div`
|
|
68
|
-
flex: 1;
|
|
69
|
-
display: flex;
|
|
70
|
-
align-items: center;
|
|
71
|
-
height: ${Ae};
|
|
72
|
-
background-color: ${({isGrey:t,theme:n})=>t?n.colors.neutral100:n.colors.neutral0};
|
|
73
|
-
border: 1px solid transparent;
|
|
74
|
-
`,Ut=g.ZP.div`
|
|
75
|
-
display: inline-flex;
|
|
76
|
-
min-width: 100%;
|
|
77
|
-
|
|
78
|
-
${ae} {
|
|
79
|
-
display: none;
|
|
80
|
-
}
|
|
81
|
-
${({isActive:t,theme:n})=>t&&we(n,t)}
|
|
82
|
-
&:hover {
|
|
83
|
-
${({theme:t,isActive:n})=>we(t,n)}
|
|
84
|
-
}
|
|
85
|
-
`,dt=(0,g.ZP)(y.k)`
|
|
86
|
-
width: ${le};
|
|
87
|
-
position: relative;
|
|
88
|
-
`,ct=(0,g.ZP)(p.x)`
|
|
89
|
-
display: none;
|
|
90
|
-
svg {
|
|
91
|
-
width: 11px;
|
|
92
|
-
}
|
|
93
|
-
* {
|
|
94
|
-
fill: ${({theme:t})=>t.colors.primary600};
|
|
95
|
-
}
|
|
96
|
-
`,ut=g.ZP.span`
|
|
97
|
-
position: absolute;
|
|
98
|
-
top: -6px;
|
|
99
|
-
left: 37px;
|
|
100
|
-
width: 6px;
|
|
101
|
-
height: 6px;
|
|
102
|
-
border-radius: 20px;
|
|
103
|
-
background: ${({theme:t})=>t.colors.primary600};
|
|
104
|
-
`,Gt=(0,g.ZP)(p.x)`
|
|
105
|
-
position: absolute;
|
|
106
|
-
right: 9px;
|
|
107
|
-
transform: translateY(10px);
|
|
108
|
-
`,mt=({availableActions:t,isActive:n,isGrey:r,isFormDisabled:s,label:i,onClickToggle:l,pathToData:d})=>{const[c,m]=(0,e.useState)(!1),{formatMessage:u}=(0,B.Z)(),{modifiedData:f,onChangeParentCheckbox:R,onChangeSimpleCheckbox:$}=(0,G.$_)(),N=()=>{m(U=>!U)},k=()=>{m(!1)},T=C()(f,d.split(".."),{}),h=(0,e.useMemo)(()=>Object.keys(T).reduce((U,q)=>(U[q]=X()(T[q],"conditions"),U),{}),[T]),{hasAllActionsSelected:I,hasSomeActionsSelected:D}=Oe(h),Z=(0,e.useMemo)(()=>Ht(t,f,d),[t,f,d]),te=Z.some(({hasConditions:U})=>U);return e.createElement(Ut,{isActive:n},e.createElement(lt,{isGrey:r},e.createElement(at,{isCollapsable:!0,isFormDisabled:s,label:i,checkboxName:d,onChange:R,onClick:l,someChecked:D,value:I,isActive:n},e.createElement(ct,{paddingLeft:2},n?e.createElement(oe.Z,null):e.createElement(de.Z,null))),e.createElement(y.k,{style:{flex:1}},Z.map(({actionId:U,hasConditions:q,hasAllActionsSelected:K,hasSomeActionsSelected:fe,isDisplayed:ke,isParentCheckbox:se,checkboxName:Ee,label:Ke})=>ke?se?e.createElement(dt,{key:U,justifyContent:"center",alignItems:"center"},q&&e.createElement(ut,null),e.createElement(V.C,{disabled:s,name:Ee,"aria-label":u({id:"Settings.permissions.select-by-permission",defaultMessage:"Select {label} permission"},{label:`${Ke} ${i}`}),onValueChange:$e=>{R({target:{name:Ee,value:$e}})},indeterminate:fe,value:K})):e.createElement(dt,{key:U,justifyContent:"center",alignItems:"center"},q&&e.createElement(ut,null),e.createElement(V.C,{disabled:s,indeterminate:q,name:Ee,onValueChange:$e=>{$({target:{name:Ee,value:$e}})},value:K})):e.createElement(Ne,{key:U}))),c&&e.createElement(ie,{headerBreadCrumbs:[i,"Settings.permissions.conditions.conditions"],actions:Z,isFormDisabled:s,onClosed:k,onToggle:N})),e.createElement(Gt,null,e.createElement(ae,{onClick:N,hasConditions:te})))};mt.propTypes={availableActions:a().array.isRequired,isActive:a().bool.isRequired,isGrey:a().bool.isRequired,isFormDisabled:a().bool.isRequired,label:a().string.isRequired,onClickToggle:a().func.isRequired,pathToData:a().string.isRequired};var zt=mt;const wt=g.ZP.span`
|
|
109
|
-
color: ${({theme:t})=>t.colors.danger700};
|
|
110
|
-
padding-left: ${({theme:t})=>t.spaces[1]}px;
|
|
111
|
-
`;var pt=()=>e.createElement(wt,null,"*"),Yt=(t,n)=>t.map(r=>{const s=Array.isArray(r.subjects)&&r.subjects.indexOf(n)!==-1;return{...r,isDisplayed:s}});const Xt=(0,g.ZP)(p.x)`
|
|
112
|
-
transform: translate(-4px, -12px);
|
|
113
|
-
|
|
114
|
-
&:before {
|
|
115
|
-
content: '';
|
|
116
|
-
width: ${4/16}rem;
|
|
117
|
-
height: ${12/16}rem;
|
|
118
|
-
background: ${({theme:t})=>t.colors.primary200};
|
|
119
|
-
display: block;
|
|
120
|
-
}
|
|
121
|
-
`,Qt=g.ZP.svg`
|
|
122
|
-
position: relative;
|
|
123
|
-
flex-shrink: 0;
|
|
124
|
-
transform: translate(-0.5px, -1px);
|
|
125
|
-
|
|
126
|
-
* {
|
|
127
|
-
fill: ${({theme:t,color:n})=>t.colors[n]};
|
|
128
|
-
}
|
|
129
|
-
`,Ye=t=>e.createElement(Xt,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"})));Ye.defaultProps={fill:"primary200"},Ye.propTypes={fill:a().string};var Jt=(0,e.memo)(Ye);const gt=(0,g.ZP)(y.k)`
|
|
130
|
-
width: ${le};
|
|
131
|
-
position: relative;
|
|
132
|
-
`,qt=(0,g.ZP)(y.k)`
|
|
133
|
-
height: ${Ae};
|
|
134
|
-
`,_t=(0,g.ZP)(p.x)`
|
|
135
|
-
padding-left: ${31/16}rem;
|
|
136
|
-
`,en=(0,g.ZP)(p.x)`
|
|
137
|
-
border-left: ${({isVisible:t,theme:n})=>t?`4px solid ${n.colors.primary200}`:"4px solid transparent"};
|
|
138
|
-
`,tn=(0,g.ZP)(y.k)`
|
|
139
|
-
padding-left: ${({theme:t})=>t.spaces[4]};
|
|
140
|
-
width: ${({level:t})=>145-t*36}px;
|
|
141
|
-
|
|
142
|
-
${({isCollapsable:t,theme:n})=>t&&`
|
|
143
|
-
${We} {
|
|
144
|
-
display: block;
|
|
145
|
-
color: ${n.colors.neutral100};
|
|
146
|
-
}
|
|
147
|
-
&:hover {
|
|
148
|
-
${Ve(n)}
|
|
149
|
-
}
|
|
150
|
-
`}
|
|
151
|
-
${({isActive:t,theme:n})=>t&&Ve(n)};
|
|
152
|
-
`,nn=g.ZP.div`
|
|
153
|
-
padding-top: ${({theme:t})=>t.spaces[2]};
|
|
154
|
-
margin-top: ${({theme:t})=>t.spaces[2]};
|
|
155
|
-
width: ${4/16}rem;
|
|
156
|
-
background-color: ${({theme:t})=>t.colors.primary200};
|
|
157
|
-
border-top-left-radius: 2px;
|
|
158
|
-
border-top-right-radius: 2px;
|
|
159
|
-
`,Xe=({childrenForm:t,isFormDisabled:n,recursiveLevel:r,pathToDataFromActionRow:s,propertyActions:i,parentName:l,propertyName:d})=>{const{formatMessage:c}=(0,B.Z)(),{modifiedData:m,onChangeParentCheckbox:u,onChangeSimpleCheckbox:f}=(0,G.$_)(),[R,$]=(0,e.useState)(null),N=T=>{$(h=>h===T?null:T)},k=(0,e.useMemo)(()=>R?t.find(({value:T})=>T===R):null,[R,t]);return e.createElement(_t,null,e.createElement(nn,null),t.map(({label:T,value:h,required:I,children:D},Z)=>{const te=Z+1<t.length,U=Array.isArray(D),q=R===h;return e.createElement(en,{key:h,isVisible:te},e.createElement(qt,null,e.createElement(Jt,{color:"primary200"}),e.createElement(y.k,{style:{flex:1}},e.createElement(tn,{level:r,isActive:q,isCollapsable:U},e.createElement(rt,{alignItems:"center",isCollapsable:U,...U&&{onClick:()=>N(h),"aria-expanded":q,onKeyDown:({key:K})=>(K==="Enter"||K===" ")&&N(h),tabIndex:0,role:"button"},title:T},e.createElement(Y.Z,{ellipsis:!0},ce()(T)),I&&e.createElement(pt,null),e.createElement(We,{$isActive:q}))),e.createElement(y.k,{style:{flex:1}},i.map(({actionId:K,label:fe,isActionRelatedToCurrentProperty:ke})=>{if(!ke)return e.createElement(Ne,{key:K});const se=[...s.split(".."),K,"properties",d,...l.split(".."),h],Ee=C()(m,se,!1);if(!D)return e.createElement(gt,{key:fe,justifyContent:"center",alignItems:"center"},e.createElement(V.C,{disabled:n,name:se.join(".."),"aria-label":c({id:"Settings.permissions.select-by-permission",defaultMessage:"Select {label} permission"},{label:`${l} ${T} ${fe}`}),onValueChange:De=>{f({target:{name:se.join(".."),value:De}})},value:Ee}));const{hasAllActionsSelected:Ke,hasSomeActionsSelected:$e}=Oe(Ee);return e.createElement(gt,{key:fe,justifyContent:"center",alignItems:"center"},e.createElement(V.C,{key:fe,disabled:n,name:se.join(".."),"aria-label":c({id:"Settings.permissions.select-by-permission",defaultMessage:"Select {label} permission"},{label:`${l} ${T} ${fe}`}),onValueChange:De=>{u({target:{name:se.join(".."),value:De}})},value:Ke,indeterminate:$e}))})))),k&&q&&e.createElement(p.x,{paddingBottom:2},e.createElement(Xe,{isFormDisabled:n,parentName:`${l}..${h}`,pathToDataFromActionRow:s,propertyActions:i,propertyName:d,recursiveLevel:r+1,childrenForm:k.children})))}))};Xe.propTypes={childrenForm:a().array.isRequired,isFormDisabled:a().bool.isRequired,parentName:a().string.isRequired,pathToDataFromActionRow:a().string.isRequired,propertyActions:a().array.isRequired,propertyName:a().string.isRequired,recursiveLevel:a().number.isRequired};var sn=(0,e.memo)(Xe);const on=t=>t.reduce((r,s)=>(s.isActionRelatedToCurrentProperty&&r.push(s.actionId),r),[]);var rn=(t,n,r,s,i)=>{const d=on(t).reduce((c,m)=>{const u=[...r.split(".."),m,"properties",s,i],f=C()(n,u,!1);return c[m]=f,c},{});return Oe(d)};const ft=(0,g.ZP)(y.k)`
|
|
160
|
-
width: ${le};
|
|
161
|
-
position: relative;
|
|
162
|
-
`,an=(0,g.ZP)(y.k)`
|
|
163
|
-
height: ${Ae};
|
|
164
|
-
flex: 1;
|
|
165
|
-
|
|
166
|
-
${({isCollapsable:t,theme:n})=>t&&`
|
|
167
|
-
${We} {
|
|
168
|
-
display: block;
|
|
169
|
-
color: ${n.colors.neutral100};
|
|
170
|
-
}
|
|
171
|
-
&:hover {
|
|
172
|
-
${Ve(n)}
|
|
173
|
-
}
|
|
174
|
-
`}
|
|
175
|
-
${({isActive:t,theme:n})=>t&&Ve(n)};
|
|
176
|
-
`,Qe=({childrenForm:t,label:n,isFormDisabled:r,name:s,required:i,pathToData:l,propertyActions:d,propertyName:c,isOdd:m})=>{const{formatMessage:u}=(0,B.Z)(),[f,R]=(0,e.useState)(null),{modifiedData:$,onChangeCollectionTypeLeftActionRowCheckbox:N,onChangeParentCheckbox:k,onChangeSimpleCheckbox:T}=(0,G.$_)(),h=f===s,I=(0,e.useMemo)(()=>Array.isArray(t)?t:[],[t]),D=I.length>0,Z=(0,e.useCallback)(()=>{D&&R(K=>K===s?null:s)},[D,s]),te=({target:{value:K}})=>{N(l,c,s,K)},{hasAllActionsSelected:U,hasSomeActionsSelected:q}=(0,e.useMemo)(()=>rn(d,$,l,c,s),[d,$,l,c,s]);return e.createElement(e.Fragment,null,e.createElement(an,{alignItems:"center",isCollapsable:D,isActive:h,background:m?"neutral100":"neutral0"},e.createElement(y.k,null,e.createElement(at,{onChange:te,onClick:Z,isCollapsable:D,isFormDisabled:r,label:n,someChecked:q,value:U,isActive:h},i&&e.createElement(pt,null),e.createElement(We,{$isActive:h})),e.createElement(y.k,null,d.map(({label:K,isActionRelatedToCurrentProperty:fe,actionId:ke})=>{if(!fe)return e.createElement(Ne,{key:K});const se=[...l.split(".."),ke,"properties",c,s];if(!D){const De=C()($,se,!1);return e.createElement(ft,{key:ke,justifyContent:"center",alignItems:"center"},e.createElement(V.C,{disabled:r,name:se.join(".."),"aria-label":u({id:"Settings.permissions.select-by-permission",defaultMessage:"Select {label} permission"},{label:`${s} ${K}`}),onValueChange:ns=>{T({target:{name:se.join(".."),value:ns}})},value:De}))}const Ee=C()($,se,{}),{hasAllActionsSelected:Ke,hasSomeActionsSelected:$e}=Oe(Ee);return e.createElement(ft,{key:K,justifyContent:"center",alignItems:"center"},e.createElement(V.C,{disabled:r,name:se.join(".."),onValueChange:De=>{k({target:{name:se.join(".."),value:De}})},"aria-label":u({id:"Settings.permissions.select-by-permission",defaultMessage:"Select {label} permission"},{label:`${s} ${K}`}),value:Ke,indeterminate:$e}))})))),h&&e.createElement(sn,{childrenForm:I,isFormDisabled:r,parentName:s,pathToDataFromActionRow:l,propertyName:c,propertyActions:d,recursiveLevel:0}))};Qe.defaultProps={childrenForm:[],required:!1},Qe.propTypes={childrenForm:a().array,label:a().string.isRequired,isFormDisabled:a().bool.isRequired,name:a().string.isRequired,pathToData:a().string.isRequired,propertyActions:a().array.isRequired,propertyName:a().string.isRequired,required:a().bool,isOdd:a().bool.isRequired};var ln=(0,e.memo)(Qe);const ht=(0,g.ZP)(y.k)`
|
|
177
|
-
width: ${le};
|
|
178
|
-
flex-shrink: 0;
|
|
179
|
-
`,dn=(0,g.ZP)(y.k)`
|
|
180
|
-
width: ${ue};
|
|
181
|
-
height: ${Ae};
|
|
182
|
-
flex-shrink: 0;
|
|
183
|
-
`,yt=({headers:t,label:n})=>{const{formatMessage:r}=(0,B.Z)(),s=r({id:"Settings.roles.form.permission.property-label",defaultMessage:"{label} permissions"},{label:n});return e.createElement(y.k,null,e.createElement(dn,{alignItems:"center",paddingLeft:6},e.createElement(Y.Z,{variant:"sigma",textColor:"neutral500"},s)),t.map(i=>i.isActionRelatedToCurrentProperty?e.createElement(ht,{justifyContent:"center",key:i.label},e.createElement(Y.Z,{variant:"sigma",textColor:"neutral500"},r({id:`Settings.roles.form.permissions.${i.label.toLowerCase()}`,defaultMessage:i.label}))):e.createElement(ht,{key:i.label})))};yt.propTypes={headers:a().arrayOf(a().shape({label:a().string.isRequired,isActionRelatedToCurrentProperty:a().bool.isRequired})).isRequired,label:a().string.isRequired};var cn=yt,un=(t,n)=>t.map(r=>{const s=Array.isArray(r.applyToProperties)&&r.applyToProperties.indexOf(n)!==-1&&r.isDisplayed;return{label:r.label,actionId:r.actionId,isActionRelatedToCurrentProperty:s}});const mn=g.ZP.div`
|
|
184
|
-
display: inline-flex;
|
|
185
|
-
flex-direction: column;
|
|
186
|
-
min-width: 0;
|
|
187
|
-
`,Ct=({availableActions:t,childrenForm:n,isFormDisabled:r,label:s,pathToData:i,propertyName:l})=>{const d=(0,e.useMemo)(()=>un(t,l),[t,l]);return e.createElement(mn,null,e.createElement(cn,{label:s,headers:d}),e.createElement(p.x,null,n.map(({children:c,label:m,value:u,required:f},R)=>e.createElement(ln,{childrenForm:c,key:u,label:m,isFormDisabled:r,name:u,required:f,propertyActions:d,pathToData:i,propertyName:l,isOdd:R%2===0}))))};Ct.propTypes={childrenForm:a().array.isRequired,availableActions:a().array.isRequired,isFormDisabled:a().bool.isRequired,label:a().string.isRequired,pathToData:a().string.isRequired,propertyName:a().string.isRequired};var pn=Ct;const gn=g.ZP.div`
|
|
188
|
-
flex-direction: column;
|
|
189
|
-
display: inline-flex;
|
|
190
|
-
min-width: 100%;
|
|
191
|
-
${({theme:t,isActive:n})=>n&&`border: 1px solid ${t.colors.primary600};`}
|
|
192
|
-
`,vt=({allActions:t,contentTypeName:n,label:r,index:s,isActive:i,isFormDisabled:l,onClickToggleCollapse:d,pathToData:c,properties:m})=>{const u=(0,e.useCallback)(()=>{d(n)},[n,d]),f=(0,e.useMemo)(()=>Yt(t,n),[t,n]);return e.createElement(gn,{isActive:i},e.createElement(zt,{availableActions:f,isActive:i,isGrey:s%2===0,isFormDisabled:l,label:r,onClickToggle:u,pathToData:c}),i&&m.map(({label:R,value:$,children:N})=>e.createElement(pn,{availableActions:f,childrenForm:N,isFormDisabled:l,label:R,pathToData:c,propertyName:$,key:$})))};vt.propTypes={allActions:a().array.isRequired,contentTypeName:a().string.isRequired,index:a().number.isRequired,isActive:a().bool.isRequired,isFormDisabled:a().bool.isRequired,label:a().string.isRequired,onClickToggleCollapse:a().func.isRequired,pathToData:a().string.isRequired,properties:a().array.isRequired};var fn=vt;const Je=({actions:t,isFormDisabled:n,pathToData:r,subjects:s})=>{const[i,l]=(0,e.useState)(null),d=c=>{l(i===c?null:c)};return s.map(({uid:c,label:m,properties:u},f)=>e.createElement(fn,{allActions:t,key:c,contentTypeName:c,label:m,isActive:i===c,isFormDisabled:n,index:f,onClickToggleCollapse:d,pathToData:`${r}..${c}`,properties:u}))};Je.defaultProps={actions:[],subjects:[]},Je.propTypes={actions:a().array.isRequired,isFormDisabled:a().bool.isRequired,pathToData:a().string.isRequired,subjects:a().arrayOf(a().shape({uid:a().string.isRequired,label:a().string.isRequired,properties:a().array.isRequired}))};var hn=(0,e.memo)(Je),yn=t=>t.filter(({subjects:n})=>n&&n.length);const Cn=t=>t.map(({actionId:n})=>n),vn=(t,n)=>t.reduce((r,s)=>(Object.keys(n).forEach(i=>{const l=C()(n,[i,s],{}),d={[i]:ze(l)};r[s]?r[s]={...r[s],...d}:r[s]=d}),r),{});var En=(t,n)=>{const r=Cn(t),s=vn(r,n);return Object.keys(s).reduce((l,d)=>(l[d]=Oe(s[d]),l),{})};const bn=(0,g.ZP)(y.k)`
|
|
193
|
-
width: ${le};
|
|
194
|
-
flex-shrink: 0;
|
|
195
|
-
`,qe=({actions:t,isFormDisabled:n,kind:r})=>{const{formatMessage:s}=(0,B.Z)(),{modifiedData:i,onChangeCollectionTypeGlobalActionCheckbox:l}=(0,G.$_)(),d=(0,e.useMemo)(()=>yn(t),[t]),c=(0,e.useMemo)(()=>En(d,i[r]),[i,d,r]);return e.createElement(p.x,{paddingBottom:4,paddingTop:6,style:{paddingLeft:ue}},e.createElement(y.k,{gap:0},d.map(({label:m,actionId:u})=>e.createElement(bn,{direction:"column",alignItems:"center",justifyContent:"center",key:u,gap:3},e.createElement(Y.Z,{variant:"sigma",textColor:"neutral500"},s({id:`Settings.roles.form.permissions.${m.toLowerCase()}`,defaultMessage:m})),e.createElement(V.C,{disabled:n,onValueChange:f=>{l(r,u,f)},name:u,"aria-label":s({id:"Settings.permissions.select-all-by-permission",defaultMessage:"Select all {label} permissions"},{label:s({id:`Settings.roles.form.permissions.${m.toLowerCase()}`,defaultMessage:m})}),value:C()(c,[u,"hasAllActionsSelected"],!1),indeterminate:C()(c,[u,"hasSomeActionsSelected"],!1)})))))};qe.defaultProps={actions:[]},qe.propTypes={actions:a().arrayOf(a().shape({label:a().string.isRequired,actionId:a().string.isRequired,subjects:a().array.isRequired})),isFormDisabled:a().bool.isRequired,kind:a().string.isRequired};var xn=(0,e.memo)(qe);const Rn=(0,g.ZP)(p.x)`
|
|
196
|
-
overflow-x: auto;
|
|
197
|
-
`,Et=({isFormDisabled:t,kind:n,layout:{actions:r,subjects:s}})=>{const i=F()([...s],"label");return e.createElement(Rn,{background:"neutral0"},e.createElement(xn,{actions:r,kind:n,isFormDisabled:t}),e.createElement(hn,{actions:r,isFormDisabled:t,pathToData:n,subjects:i}))};Et.propTypes={isFormDisabled:a().bool.isRequired,kind:a().string.isRequired,layout:a().shape({actions:a().array,subjects:a().arrayOf(a().shape({uid:a().string.isRequired,label:a().string.isRequired,properties:a().array.isRequired}))}).isRequired};var bt=(0,e.memo)(Et),Pn=o(76402);const xt=({children:t,value:n})=>e.createElement(Pn.$l.Provider,{value:n},t);xt.propTypes={children:a().node.isRequired,value:a().exact({availableConditions:a().array.isRequired,modifiedData:a().object.isRequired,onChangeCollectionTypeLeftActionRowCheckbox:a().func.isRequired,onChangeConditions:a().func.isRequired,onChangeSimpleCheckbox:a().func.isRequired,onChangeParentCheckbox:a().func.isRequired,onChangeCollectionTypeGlobalActionCheckbox:a().func.isRequired}).isRequired};var An=xt,Tn=o(83828),Sn=o(61762),Mn=o(89966),Rt=o(8284),On=o(15335),$n=o(5803),Dn=(t,n,r)=>t.map(s=>{const i=[...r,s.action,"properties","enabled"],l=C()(n,i,!1),d=C()(n,[...r,s.action,"conditions"],{}),c=je(d).some(m=>m);return{...s,isDisplayed:l,checkboxName:i.join(".."),hasSomeActionsSelected:l,value:l,hasConditions:c,label:s.displayName,actionId:s.action,pathToConditionsObject:[...r,s.action]}}),Ln=t=>{const n=Object.entries(t).reduce((s,i)=>{const[l,{conditions:d}]=i;return s[l]=d,s},{});return je(n).some(s=>s)};const jn=g.ZP.div`
|
|
198
|
-
flex: 1;
|
|
199
|
-
align-self: center;
|
|
200
|
-
border-top: 1px solid ${({theme:t})=>t.colors.neutral150};
|
|
201
|
-
`,kn=g.ZP.div`
|
|
202
|
-
position: relative;
|
|
203
|
-
word-break: keep-all;
|
|
204
|
-
${({hasConditions:t,disabled:n,theme:r})=>t&&`
|
|
205
|
-
&:before {
|
|
206
|
-
content: '';
|
|
207
|
-
position: absolute;
|
|
208
|
-
top: ${-4/16}rem;
|
|
209
|
-
left: ${-8/16}rem;
|
|
210
|
-
width: ${6/16}rem;
|
|
211
|
-
height: ${6/16}rem;
|
|
212
|
-
border-radius: ${20/16}rem;
|
|
213
|
-
background: ${n?r.colors.neutral100:r.colors.primary600};
|
|
214
|
-
}
|
|
215
|
-
`}
|
|
216
|
-
`,Pt=({categoryName:t,isFormDisabled:n,subCategoryName:r,actions:s,pathToData:i})=>{const[l,d]=(0,e.useState)(!1),{modifiedData:c,onChangeParentCheckbox:m,onChangeSimpleCheckbox:u}=(0,G.$_)(),{formatMessage:f}=(0,B.Z)(),R=C()(c,i,{}),$=(0,e.useMemo)(()=>Object.keys(R).reduce((Z,te)=>(Z[te]=ze(R[te]),Z),{}),[R]),{hasAllActionsSelected:N,hasSomeActionsSelected:k}=Oe($),T=()=>{d(Z=>!Z)},h=()=>{d(!1)},I=Dn(s,c,i),D=Ln(C()(c,[...i],{}));return e.createElement(e.Fragment,null,e.createElement(p.x,null,e.createElement(y.k,{justifyContent:"space-between",alignItems:"center"},e.createElement(p.x,{paddingRight:4},e.createElement(Y.Z,{variant:"sigma",textColor:"neutral600"},r)),e.createElement(jn,null),e.createElement(p.x,{paddingLeft:4},e.createElement(Rt.X,{name:i.join(".."),disabled:n,onValueChange:Z=>{m({target:{name:i.join(".."),value:Z}})},indeterminate:k,value:N},f({id:"app.utils.select-all",defaultMessage:"Select all"})))),e.createElement(y.k,{paddingTop:6,paddingBottom:6},e.createElement(On.r,{gap:2,style:{flex:1}},I.map(({checkboxName:Z,value:te,action:U,displayName:q,hasConditions:K})=>e.createElement($n.P,{col:3,key:U},e.createElement(kn,{disabled:n,hasConditions:K},e.createElement(Rt.X,{name:Z,disabled:n,onValueChange:fe=>{u({target:{name:Z,value:fe}})},value:te},q))))),e.createElement(ae,{hasConditions:D,onClick:T}))),l&&e.createElement(ie,{headerBreadCrumbs:[t,r],actions:I,isFormDisabled:n,onClosed:h,onToggle:T}))};Pt.propTypes={actions:a().array.isRequired,categoryName:a().string.isRequired,isFormDisabled:a().bool.isRequired,subCategoryName:a().string.isRequired,pathToData:a().array.isRequired};var In=Pt;const _e=({childrenForm:t,kind:n,name:r,isOpen:s,isFormDisabled:i,isWhite:l,onOpenCategory:d,pathToData:c})=>{const{formatMessage:m}=(0,B.Z)(),u=()=>{d(r)},f=(0,e.useMemo)(()=>r.split("::").pop(),[r]);return e.createElement(Tn.U,{expanded:s,onToggle:u,id:`accordion-${r}`,variant:l?"primary":"secondary"},e.createElement(Sn.B,{title:ce()(f),description:`${m({id:"Settings.permissions.category"},{category:f})} ${n==="plugins"?"plugin":n}`}),e.createElement(Mn.v,null,e.createElement(p.x,{padding:6},t.map(({actions:R,subCategoryName:$,subCategoryId:N})=>e.createElement(In,{key:$,actions:R,categoryName:f,isFormDisabled:i,subCategoryName:$,pathToData:[...c,N]})))))};_e.defaultProps={},_e.propTypes={childrenForm:a().array.isRequired,isOpen:a().bool.isRequired,isFormDisabled:a().bool.isRequired,isWhite:a().bool.isRequired,kind:a().string.isRequired,name:a().string.isRequired,onOpenCategory:a().func.isRequired,pathToData:a().array.isRequired};var Bn=_e;const At=({isFormDisabled:t,kind:n,layout:r})=>{const[s,i]=(0,e.useState)(null),l=d=>{i(d===s?null:d)};return e.createElement(p.x,{padding:6,background:"neutral0"},r.map(({category:d,categoryId:c,childrenForm:m},u)=>e.createElement(Bn,{key:d,childrenForm:m,kind:n,isFormDisabled:t,isOpen:s===d,isWhite:u%2===1,name:d,onOpenCategory:l,pathToData:[n,c]})))};At.propTypes={isFormDisabled:a().bool.isRequired,kind:a().string.isRequired,layout:a().arrayOf(a().shape({category:a().string.isRequired,categoryId:a().string.isRequired,childrenForm:a().arrayOf(a().shape({actions:a().array.isRequired})).isRequired}).isRequired).isRequired};var Tt=At,Zn=o(86349),Fn=o.n(Zn),Nn=o(3040),ge=o.n(Nn),St=(t,n,r)=>t.find(s=>s.action===n&&s.subject===r);const Mt=(t,n=[])=>t.reduce((r,s)=>(r[s.id]=n.indexOf(s.id)!==-1,r),{}),Ot=({children:t},n,r="")=>t.reduce((s,i)=>{if(i.children)return{...s,[i.value]:Ot(i,n,`${r}${i.value}.`)};const l=n.indexOf(`${r}${i.value}`)!==-1;return s[i.value]=l,s},{}),Wn=(t,n,r)=>t.reduce((s,i)=>{const l=n.properties.find(({value:d})=>d===i);if(l){const d=C()(r,["properties",l.value],[]),c=Ot(l,d);s.properties[i]=c}return s},{properties:{}}),Vn=(t,n)=>n.reduce((r,s)=>{const i=t.find(({uid:l})=>l===s)||null;return i&&(r[s]=i),r},{});var $t=({subjects:t},n,r,s=[])=>n.reduce((i,l)=>{const d=l.subjects,c=Vn(t,d);if(M()(c))return i;const m=Object.keys(c).reduce((u,f)=>{const{actionId:R,applyToProperties:$}=l,T=c[f].properties.map(({value:Z})=>Z).every(Z=>($||[]).indexOf(Z)===-1),h=St(s,R,f),I=Mt(r,C()(h,"conditions",[]));if(M()($)||T)return ge()(u,[f,R],{properties:{enabled:h!==void 0},conditions:I}),u;const D=Wn($,c[f],h);return ge()(u,[f,R],{...D,conditions:I}),u},{});return Fn()(i,m)},{});const Kn=(t,n,r)=>t.reduce((s,i)=>{const l=St(r,i.action,null);return s[i.action]={properties:{enabled:l!==void 0},conditions:Mt(n,l?.conditions??[])},s},{}),Hn=(t,n,r)=>t.reduce((s,i)=>(s[i.subCategoryId]=Kn(i.actions,n,r),s),{});var Dt=(t,n,r=[])=>t.reduce((s,{categoryId:i,childrenForm:l})=>{const d=Hn(l,n,r);return s[i]=d,s},{});const Lt=t=>t.split(" ").join("-");var jt=(t,n)=>Object.entries(pe()(t,n)).map(([r,s])=>({category:r,categoryId:Lt(r),childrenForm:Object.entries(pe()(s,"subCategory")).map(([i,l])=>({subCategoryName:i,subCategoryId:Lt(i),actions:l}))})),Un=(t,n)=>{const{conditions:r,sections:{collectionTypes:s,singleTypes:i,plugins:l,settings:d}}=t,c={collectionTypes:s,singleTypes:i,plugins:jt(l,"plugin"),settings:jt(d,"category")},m={collectionTypes:$t(s,s.actions||[],r,n),singleTypes:$t(i,i.actions||[],r,n),plugins:Dt(c.plugins,r,n),settings:Dt(c.settings,r,n)};return{initialData:m,modifiedData:m,layouts:c}},Gn=o(99381),et=o.n(Gn);const kt=t=>Object.keys(t).reduce((n,r)=>{const s=t[r];if(Te()(s)&&!x()(s,"conditions"))return{...n,[r]:kt(s)};if(Te()(s)&&x()(s,"conditions")&&!je(X()(s,"conditions")).some(l=>l)){const l=Object.keys(s.conditions).reduce((d,c)=>(d[c]=!1,d),{});return{...n,[r]:{...s,conditions:l}}}return n[r]=s,n},{});var tt=kt;const It=(t,n,r=!1)=>Object.keys(t).reduce((s,i)=>{const l=t[i];return i==="conditions"&&!r?(s[i]=l,s):Te()(l)?{...s,[i]:It(l,n,i==="fields")}:(s[i]=n,s)},{});var Ue=It;const zn={initialData:{},modifiedData:{},layouts:{}};var wn=(t,n)=>(0,Q.ZP)(t,r=>{switch(n.type){case"ON_CHANGE_COLLECTION_TYPE_GLOBAL_ACTION_CHECKBOX":{const{collectionTypeKind:s,actionId:i,value:l}=n,d=["modifiedData",s];Object.keys(C()(t,d)).forEach(c=>{const m=C()(t,[...d,c,i],void 0);if(m){let u=Ue(m,l);if(!l&&u.conditions){const f=Ue(u.conditions,!1);u={...u,conditions:f}}ge()(r,[...d,c,i],u)}});break}case"ON_CHANGE_COLLECTION_TYPE_ROW_LEFT_CHECKBOX":{const{pathToCollectionType:s,propertyName:i,rowName:l,value:d}=n;let c=et()(t.modifiedData);const m=s.split(".."),u=C()(c,m,{});Object.keys(u).forEach(f=>{if(x()(u[f],`properties.${i}`)){const R=C()(u,[f,"properties",i,l]),$=[...m,f,"properties",i,l];if(!Te()(R))ge()(c,$,d);else{const N=Ue(R,d);ge()(c,$,N)}}}),d||(c=tt(c)),ge()(r,"modifiedData",c);break}case"ON_CHANGE_CONDITIONS":{Object.entries(n.conditions).forEach(s=>{const[i,l]=s;ge()(r,["modifiedData",...i.split(".."),"conditions"],l)});break}case"ON_CHANGE_SIMPLE_CHECKBOX":{let s=et()(t.modifiedData);ge()(s,[...n.keys.split("..")],n.value),n.value||(s=tt(s)),ge()(r,"modifiedData",s);break}case"ON_CHANGE_TOGGLE_PARENT_CHECKBOX":{const{keys:s,value:i}=n,l=[...s.split("..")];let d=et()(t.modifiedData);const c=C()(d,l,{}),m=Ue(c,i);ge()(d,l,m),i||(d=tt(d)),ge()(r,["modifiedData"],d);break}case"RESET_FORM":{r.modifiedData=t.initialData;break}case"SET_FORM_AFTER_SUBMIT":{r.initialData=t.modifiedData;break}default:return r}});const nt=t=>Object.entries(t).filter(([,n])=>n).map(([n])=>n),Yn=t=>{const[n,{conditions:r}]=t;return{action:n,subject:null,conditions:nt(r),properties:{}}},Xn=t=>Object.values(t).reduce((n,r)=>{const s=Object.entries(r).reduce((i,l)=>{const[,{properties:{enabled:d}}]=l;if(!d)return i;const c=Yn(l);return i.push(c),i},[]);return[...n,...s]},[]);var Bt=t=>Object.values(t).reduce((n,r)=>{const s=Xn(r);return[...n,...s]},[]);const Zt=(t,n="")=>Object.entries(t).reduce((r,s)=>{const[i,l]=s;return Te()(l)?[...r,...Zt(l,`${n}${i}.`)]:(l&&!Te()(l)&&r.push(`${n}${i}`),r)},[]),Qn=(t,n,{conditions:r,properties:s})=>Object.entries(s).reduce((i,l)=>{const[d,c]=l;return i.properties[d]=Zt(c),i},{action:t,subject:n,conditions:nt(r),properties:{}}),Jn=(t,n,{conditions:r})=>({action:t,subject:n,properties:{},conditions:nt(r)}),qn=(t,n)=>Object.entries(n).reduce((s,i)=>{const[l,d]=i;if(!je(d).some(u=>u))return s;if(!d?.properties?.enabled){const u=Qn(l,t,d);return[...s,u]}if(!d.properties.enabled)return s;const m=Jn(l,t,d);return s.push(m),s},[]);var Ft=t=>Object.entries(t).reduce((r,s)=>{const[i,l]=s,d=qn(i,l);return[...r,...d]},[]),_n=t=>{const n=Bt(t.plugins),r=Bt(t.settings),s=Ft(t.collectionTypes),i=Ft(t.singleTypes);return[...n,...r,...s,...i]},es=[{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 st=(0,e.forwardRef)(({layout:t,isFormDisabled:n,permissions:r},s)=>{const[{initialData:i,layouts:l,modifiedData:d},c]=(0,e.useReducer)(wn,zn,()=>Un(t,r)),{formatMessage:m}=(0,B.Z)();(0,e.useImperativeHandle)(s,()=>({getPermissions(){const k=(0,O.e5)(i.collectionTypes,d.collectionTypes),T=(0,O.e5)(i.singleTypes,d.singleTypes),h={...k,...T};let I;return M()(h)?I=!1:I=Object.values(h).some(D=>Object.values(D).some(Z=>x()(Z,"conditions"))),{permissionsToSend:_n(d),didUpdateConditions:I}},resetForm(){c({type:"RESET_FORM"})},setFormAfterSubmit(){c({type:"SET_FORM_AFTER_SUBMIT"})}}));const u=(k,T,h,I)=>{c({type:"ON_CHANGE_COLLECTION_TYPE_ROW_LEFT_CHECKBOX",pathToCollectionType:k,propertyName:T,rowName:h,value:I})},f=(k,T,h)=>{c({type:"ON_CHANGE_COLLECTION_TYPE_GLOBAL_ACTION_CHECKBOX",collectionTypeKind:k,actionId:T,value:h})},R=k=>{c({type:"ON_CHANGE_CONDITIONS",conditions:k})},$=(0,e.useCallback)(({target:{name:k,value:T}})=>{c({type:"ON_CHANGE_SIMPLE_CHECKBOX",keys:k,value:T})},[]),N=(0,e.useCallback)(({target:{name:k,value:T}})=>{c({type:"ON_CHANGE_TOGGLE_PARENT_CHECKBOX",keys:k,value:T})},[]);return e.createElement(An,{value:{availableConditions:t.conditions,modifiedData:d,onChangeConditions:R,onChangeSimpleCheckbox:$,onChangeParentCheckbox:N,onChangeCollectionTypeLeftActionRowCheckbox:u,onChangeCollectionTypeGlobalActionCheckbox:f}},e.createElement(v.v,{id:"tabs",label:m({id:"Settings.permissions.users.tabs.label",defaultMessage:"Tabs Permissions"})},e.createElement(P.m,null,es.map(k=>e.createElement(P.O,{key:k.id},m({id:k.labelId,defaultMessage:k.defaultMessage})))),e.createElement(b.n,{style:{position:"relative"}},e.createElement(b.x,null,e.createElement(bt,{layout:l.collectionTypes,kind:"collectionTypes",isFormDisabled:n})),e.createElement(b.x,null,e.createElement(bt,{layout:l.singleTypes,kind:"singleTypes",isFormDisabled:n})),e.createElement(b.x,null,e.createElement(Tt,{layout:l.plugins,kind:"plugins",isFormDisabled:n})),e.createElement(b.x,null,e.createElement(Tt,{layout:l.settings,kind:"settings",isFormDisabled:n})))))});st.defaultProps={permissions:[],layout:{conditions:[],sections:{collectionTypes:{},singleTypes:{actions:[]},settings:[],plugins:[]}}},st.propTypes={layout:a().object,isFormDisabled:a().bool.isRequired,permissions:a().array};var ts=(0,e.memo)(st)},87056:function(H,L,o){"use strict";o.r(L),o.d(L,{default:function(){return Y}});var e=o(32735),v=o(45509),P=o(15062),b=o(53038),O=o(30305),A=o(27649),x=o(82055),E=o(87933),M=o(41415),W=o(17e3),a=o(72850),B=o(29439),p=o(92802),S=o(67879),F=o(64499),g=o(86409),y=o(91720),V=o(1283),oe=o(49372),de=o(15335),re=o(5803),C=o(10369),me=o(33475),X=o(60216),G=o.n(X);const _=({disabled:ne,role:w,values:j,errors:Q,onChange:he,onBlur:pe})=>{const{formatMessage:J}=(0,S.Z)();return e.createElement(a.x,{background:"neutral0",padding:6,shadow:"filterShadow",hasRadius:!0},e.createElement(E.k,{direction:"column",alignItems:"stretch",gap:4},e.createElement(E.k,{justifyContent:"space-between"},e.createElement(a.x,null,e.createElement(a.x,null,e.createElement(oe.Z,{fontWeight:"bold"},w?w.name:J({id:"global.details",defaultMessage:"Details"}))),e.createElement(a.x,null,e.createElement(oe.Z,{textColor:"neutral500",variant:"pi"},w?w.description:J({id:"Settings.roles.form.description",defaultMessage:"Name and description of the role"})))),e.createElement(M.z,{disabled:!0,variant:"secondary"},J({id:"Settings.roles.form.button.users-with-role",defaultMessage:"{number, plural, =0 {# users} one {# user} other {# users}} with this role"},{number:w.usersCount}))),e.createElement(de.r,{gap:4},e.createElement(re.P,{col:6},e.createElement(C.o,{disabled:ne,name:"name",error:Q.name&&J({id:Q.name}),label:J({id:"global.name",defaultMessage:"Name"}),onChange:he,onBlur:pe,required:!0,value:j.name||""})),e.createElement(re.P,{col:6},e.createElement(me.g,{disabled:ne,label:J({id:"global.description",defaultMessage:"Description"}),id:"description",error:Q.name&&J({id:Q.name}),onChange:he,onBlur:pe},j.description||"")))))};_.defaultProps={disabled:!1,role:null,values:{name:"",description:""}},_.propTypes={disabled:G().bool,errors:G().object.isRequired,onBlur:G().func.isRequired,onChange:G().func.isRequired,role:G().object,values:G().object};var Ce=_,be=o(24346),ae=be.Ry().shape({name:be.Z_().required(v.I0.required)}),Se=()=>{const ne=(0,v.lm)(),{formatMessage:w}=(0,S.Z)(),{params:{id:j}}=(0,b.$B)("/settings/roles/:id"),{put:Q}=(0,v.kY)(),[he,pe]=(0,e.useState)(!1),J=(0,e.useRef)(),{lockApp:ce,unlockApp:Ie}=(0,v.o1)(),{trackUsage:Be}=(0,v.rS)(),{formatAPIError:ve}=(0,v.So)(),{isLoading:Ze,data:Le}=(0,y.d)(j,{cacheTime:0}),{roles:[ye={}],isLoading:Me,refetch:Fe}=(0,g.F)({id:j},{cacheTime:0}),{permissions:He,isLoading:Pe}=(0,F.V)({id:j},{cacheTime:0}),ee=async le=>{try{ce(),pe(!0);const{permissionsToSend:ue,didUpdateConditions:Ae}=J.current.getPermissions();await Q(`/admin/roles/${j}`,le),ye.code!=="strapi-super-admin"&&(await Q(`/admin/roles/${j}/permissions`,{permissions:ue}),Ae&&Be("didUpdateConditions")),J.current.setFormAfterSubmit(),await Fe(),ne({type:"success",message:{id:"notification.success.saved"}})}catch(ue){ne({type:"warning",message:ve(ue)})}finally{pe(!1),Ie()}},ie=!Me&&ye.code==="strapi-super-admin";return e.createElement(A.o,null,e.createElement(v.SL,{name:"Roles"}),e.createElement(p.J9,{enableReinitialize:!0,initialValues:{name:ye.name,description:ye.description},onSubmit:ee,validationSchema:ae,validateOnChange:!1},({handleSubmit:le,values:ue,errors:Ae,handleChange:ot,handleBlur:Ne})=>e.createElement("form",{onSubmit:le},e.createElement(x.T,{primaryAction:e.createElement(E.k,{gap:2},e.createElement(M.z,{disabled:ye.code==="strapi-super-admin",onClick:le,loading:he,size:"L"},w({id:"global.save",defaultMessage:"Save"}))),title:w({id:"Settings.roles.edit.title",defaultMessage:"Edit a role"}),subtitle:w({id:"Settings.roles.create.description",defaultMessage:"Define the rights given to the role"}),navigationAction:e.createElement(v.rU,{startIcon:e.createElement(B.Z,null),to:"/settings/roles"},w({id:"global.back",defaultMessage:"Back"}))}),e.createElement(W.D,null,e.createElement(E.k,{direction:"column",alignItems:"stretch",gap:6},e.createElement(Ce,{isLoading:Me||Pe,disabled:ie,errors:Ae,values:ue,onChange:ot,onBlur:Ne,role:ye}),!Ze&&!Me&&!Pe?e.createElement(a.x,{shadow:"filterShadow",hasRadius:!0},e.createElement(V.Z,{isFormDisabled:ie,permissions:He,ref:J,layout:Le})):e.createElement(a.x,{background:"neutral0",padding:6,shadow:"filterShadow",hasRadius:!0},e.createElement(v.dO,null)))))))},Y=()=>{const ne=(0,P.v9)(O._),{isLoading:w,allowedActions:{canRead:j,canUpdate:Q}}=(0,v.ss)({read:ne.settings.roles.read,update:ne.settings.roles.update});return w?e.createElement(v.dO,null):!j&&!Q?e.createElement(b.l_,{to:"/"}):e.createElement(Se,null)}},91720:function(H,L,o){"use strict";o.d(L,{d:function(){return P}});var e=o(45509),v=o(20108);const P=(b,O={})=>{const{get:A}=(0,e.kY)(),{data:x,error:E,isError:M,isLoading:W}=(0,v.useQuery)(["permissions",b],async()=>{const{data:{data:a}}=await A("/admin/permissions",{params:{role:b}});return a},O);return{data:x,error:E,isError:M,isLoading:W}}},84802:function(H){function L(o,e,v,P){for(var b=-1,O=o==null?0:o.length;++b<O;){var A=o[b];e(P,A,v(A),o)}return P}H.exports=L},62435:function(H,L,o){var e=o(56671);function v(P,b,O,A){return e(P,function(x,E,M){b(A,x,O(x),M)}),A}H.exports=v},85580:function(H,L,o){var e=o(84802),v=o(62435),P=o(88904),b=o(77236);function O(A,x){return function(E,M){var W=b(E)?e:v,a=x?x():{};return W(E,A,P(M,2),a)}}H.exports=O},72091:function(H,L,o){var e=o(40314),v=1/0;function P(b){var O=b==null?0:b.length;return O?e(b,v):[]}H.exports=P},81346:function(H,L,o){var e=o(40999),v=o(85580),P=Object.prototype,b=P.hasOwnProperty,O=v(function(A,x,E){b.call(A,E)?A[E].push(x):e(A,E,[x])});H.exports=O},83828:function(H,L,o){"use strict";o.d(L,{U:function(){return B},y:function(){return W}});var e=o(74512),v=o(32735),P=o(8471),b=o(91045),O=o(74971),A=o(49372),x=o(87933),E=o(72850);const M=({theme:p,expanded:S,variant:F,disabled:g,error:y})=>y?`1px solid ${p.colors.danger600} !important`:g?`1px solid ${p.colors.neutral150}`:S?`1px solid ${p.colors.primary600}`:F==="primary"?`1px solid ${p.colors.neutral0}`:`1px solid ${p.colors.neutral100}`,W=(0,P.ZP)(A.Z)``,a=(0,P.ZP)(E.x)`
|
|
217
|
-
border: ${M};
|
|
218
|
-
|
|
219
|
-
&:hover:not([aria-disabled='true']) {
|
|
220
|
-
border: 1px solid ${({theme:p})=>p.colors.primary600};
|
|
221
|
-
|
|
222
|
-
${W} {
|
|
223
|
-
color: ${({theme:p,expanded:S})=>S?void 0:p.colors.primary700};
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
${A.Z} {
|
|
227
|
-
color: ${({theme:p,expanded:S})=>S?void 0:p.colors.primary600};
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
& > ${x.k} {
|
|
231
|
-
background: ${({theme:p})=>p.colors.primary100};
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
[data-strapi-dropdown='true'] {
|
|
235
|
-
background: ${({theme:p})=>p.colors.primary200};
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
`,B=({children:p,disabled:S=!1,error:F,expanded:g=!1,hasErrorMessage:y=!0,id:V,onToggle:oe,toggle:de,size:re="M",variant:C="primary",shadow:me})=>{const X=(0,O.M)(V),G=v.useMemo(()=>({expanded:g,onToggle:oe,toggle:de,id:X,size:re,variant:C,disabled:S}),[S,g,X,oe,re,de,C]);return(0,e.jsxs)(b.S.Provider,{value:G,children:[(0,e.jsx)(a,{"data-strapi-expanded":g,disabled:S,"aria-disabled":S,expanded:g,hasRadius:!0,variant:C,error:F,shadow:me,children:p}),F&&y&&(0,e.jsx)(E.x,{paddingTop:1,children:(0,e.jsx)(A.Z,{variant:"pi",textColor:"danger600",children:F})})]})}},89966:function(H,L,o){"use strict";o.d(L,{v:function(){return b}});var e=o(74512),v=o(91045),P=o(72850);const b=({children:O,...A})=>{const{expanded:x,id:E}=(0,v.A)();if(!x)return null;const M=`accordion-content-${E}`,W=`accordion-label-${E}`,a=`accordion-desc-${E}`;return(0,e.jsx)(P.x,{role:"region",id:M,"aria-labelledby":W,"aria-describedby":a,...A,children:O})}},91045:function(H,L,o){"use strict";o.d(L,{A:function(){return P},S:function(){return v}});var e=o(32735);const v=(0,e.createContext)({disabled:!1,expanded:!1,id:"",size:"M",variant:"primary"}),P=()=>(0,e.useContext)(v)},61762:function(H,L,o){"use strict";o.d(L,{B:function(){return p}});var e=o(74512),v=o(16899),P=o(8471),b=o(83828),O=o(91045);const A=({expanded:S,disabled:F,variant:g})=>{let y="neutral100";return S?y="primary100":F?y="neutral150":g==="primary"&&(y="neutral0"),y};var x=o(7563),E=o(99140),M=o(87933),W=o(49372);const a=(0,P.ZP)(x.A)`
|
|
239
|
-
text-align: left;
|
|
240
|
-
|
|
241
|
-
// necessary to make the ellipsis prop work on the title
|
|
242
|
-
> span {
|
|
243
|
-
max-width: 100%;
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
svg {
|
|
247
|
-
width: ${14/16}rem;
|
|
248
|
-
height: ${14/16}rem;
|
|
249
|
-
|
|
250
|
-
path {
|
|
251
|
-
fill: ${({theme:S,expanded:F})=>F?S.colors.primary600:S.colors.neutral500};
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
`,B=(0,P.ZP)(M.k)`
|
|
255
|
-
min-height: ${({theme:S,size:F})=>S.sizes.accordions[F]};
|
|
256
|
-
border-radius: ${({theme:S,expanded:F})=>F?`${S.borderRadius} ${S.borderRadius} 0 0`:S.borderRadius};
|
|
257
|
-
|
|
258
|
-
&:hover {
|
|
259
|
-
svg {
|
|
260
|
-
path {
|
|
261
|
-
fill: ${({theme:S})=>S.colors.primary600};
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
`,p=({title:S,description:F,as:g="span",togglePosition:y="right",action:V,...oe})=>{const{onToggle:de,toggle:re,expanded:C,id:me,size:X,variant:G,disabled:_}=(0,O.A)(),Ce=`accordion-content-${me}`,be=`accordion-label-${me}`,xe=`accordion-desc-${me}`,ae=X==="M"?6:4,Re=X==="M"?ae:ae-2,Se=A({expanded:C,disabled:_,variant:G}),z={as:g,fontWeight:X==="S"?"bold":void 0,id:be,textColor:C?"primary600":"neutral700",ellipsis:!0,variant:X==="M"?"delta":void 0},Y=C?"primary600":"neutral600",ne=C?"primary200":"neutral200",w=X==="M"?`${32/16}rem`:`${24/16}rem`,j=()=>{_||(re&&!de?(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'),re()):de&&de())},Q=(0,e.jsx)(M.k,{justifyContent:"center",borderRadius:"50%",height:w,width:w,transform:C?"rotate(180deg)":void 0,"data-strapi-dropdown":!0,"aria-hidden":!0,as:"span",background:ne,cursor:_?"not-allowed":"pointer",onClick:j,shrink:0,children:(0,e.jsx)(E.J,{as:v.Z,width:X==="M"?`${11/16}rem`:`${8/16}rem`,color:C?"primary600":"neutral600"})});return(0,e.jsx)(B,{paddingBottom:Re,paddingLeft:ae,paddingRight:ae,paddingTop:Re,background:Se,expanded:C,size:X,justifyContent:"space-between",cursor:_?"not-allowed":"",children:(0,e.jsxs)(M.k,{gap:3,flex:1,maxWidth:"100%",children:[y==="left"&&Q,(0,e.jsx)(a,{onClick:j,"aria-disabled":_,"aria-expanded":C,"aria-controls":Ce,"aria-labelledby":be,"data-strapi-accordion-toggle":!0,expanded:C,type:"button",flex:1,minWidth:0,...oe,children:(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(b.y,{...z,children:S}),F&&(0,e.jsx)(W.Z,{as:"p",id:xe,textColor:Y,children:F})]})}),y==="right"&&(0,e.jsxs)(M.k,{gap:3,children:[Q,V]}),y==="left"&&V]})})}},27799:function(H,L,o){"use strict";o.d(L,{Q:function(){return b}});var e=o(74512),v=o(8471),P=o(6407);const b=({options:A,...x})=>(0,e.jsx)(P.NU,{...x,children:A.map(E=>"children"in E?(0,e.jsx)(P.Ab,{label:E.label,values:E.children.map(M=>M.value.toString()),children:E.children.map(M=>(0,e.jsx)(O,{value:M.value,children:M.label},M.value))},E.label):(0,e.jsx)(P.ML,{value:E.value,children:E.label},E.value))}),O=(0,v.ZP)(P.ML)`
|
|
266
|
-
padding-left: ${({theme:A})=>A.spaces[7]};
|
|
267
|
-
`}}]);
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_strapi_admin=self.webpackChunk_strapi_admin||[]).push([[4263],{97108:function(B,c,e){e.d(c,{R:function(){return o}});var t=e(45509),a=e(20108);function o(i={},E={}){const{id:r="",...s}=i,{get:g}=(0,t.kY)(),{data:l,isError:n,isLoading:m,refetch:f}=(0,a.useQuery)(["users",r,s],async()=>{const{data:{data:y}}=await g(`/admin/users/${r}`,{params:s});return y},E);let v=[];return r&&l?v=[l]:Array.isArray(l?.results)&&(v=l.results),{users:v,pagination:l?.pagination??null,isLoading:m,isError:n,refetch:f}}},28363:function(B,c,e){e.r(c),e.d(c,{default:function(){return re}});var t=e(32735),a=e(45509),o=e(15062),i=e(53038),E=e(30305),r=e(27649),s=e(82055),g=e(41415),l=e(17e3),n=e(72850),m=e(87933),f=e(49372),v=e(15335),y=e(5803),L=e(66456),O=e(29439),I=e(92802),j=e(33795),x=e.n(j),N=e(9086),Y=e.n(N),U=e(88423),S=e.n(U),F=e(60216),H=e.n(F),V=e(67879),G=e(97108),M=e(9592),Q=e(90869),ee=e(47577),te=e(18703),ae=e(32720);const se=async(A,u)=>{const{put:C}=(0,a.tg)(),{data:T}=await C(`/admin/users/${A}`,u);return T.data};var ne=[[{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}}]];const J=["email","firstname","lastname","username","isActive","roles"],w=({canUpdate:A})=>{const{formatMessage:u}=(0,V.Z)(),{params:{id:C}}=(0,i.$B)("/settings/users/:id"),{push:T}=(0,i.k6)(),{setUserDisplayName:Z}=(0,a.L7)(),h=(0,a.lm)(),{lockApp:X,unlockApp:b}=(0,a.o1)(),k=(0,M.c)(ee.A,async()=>(await e.e(1727).then(e.bind(e,81727))).MagicLinkEE);(0,a.go)();const{users:[W],isLoading:le}=(0,G.R)({id:C},{cacheTime:0,onError(d){const{status:p}=d.response;p===403?(h({type:"info",message:{id:"notification.permission.not-allowed-read",defaultMessage:"You are not allowed to see this document"}}),T("/")):h({type:"warning",message:{id:"notification.error",defaultMessage:"An error occured"}})}}),ie=async(d,p)=>{X();try{const P=await se(C,Y()(d,"confirmPassword"));h({type:"success",message:u({id:"notification.success.saved",defaultMessage:"Saved"})});const R=a.I8.getUserInfo();if(C.toString()===R.id.toString()){a.I8.setUserInfo(P);const K=x()(d,"username")||(0,Q.Pp)(d.firstname,d.lastname);Z(K)}p.setValues(S()(d,J))}catch(P){const R=(0,Q.Iz)(P.response.data),K=Object.keys(R).reduce(($,D)=>($[D]=R[D].id,$),{});p.setErrors(K),h({type:"warning",message:x()(P,"response.data.error.message","notification.error")})}b()},_=le||!k,de=_?{id:"app.containers.Users.EditPage.header.label-loading",defaultMessage:"Edit user"}:{id:"app.containers.Users.EditPage.header.label",defaultMessage:"Edit {name}"},z=Object.keys(S()(W,J)).reduce((d,p)=>p==="roles"?(d[p]=(W?.roles||[]).map(({id:P})=>P),d):(d[p]=W?.[p],d),{}),ce=z.username||(0,Q.Pp)(z.firstname,z.lastname),q=u(de,{name:ce});return _?t.createElement(r.o,{"aria-busy":"true"},t.createElement(a.SL,{name:"Users"}),t.createElement(s.T,{primaryAction:t.createElement(g.z,{disabled:!0,startIcon:t.createElement(L.Z,null),type:"button",size:"L"},u({id:"global.save",defaultMessage:"Save"})),title:q,navigationAction:t.createElement(a.rU,{startIcon:t.createElement(O.Z,null),to:"/settings/users?pageSize=10&page=1&sort=firstname"},u({id:"global.back",defaultMessage:"Back"}))}),t.createElement(l.D,null,t.createElement(a.dO,null))):t.createElement(r.o,null,t.createElement(a.SL,{name:"Users"}),t.createElement(I.J9,{onSubmit:ie,initialValues:z,validateOnChange:!1,validationSchema:ae.YM},({errors:d,values:p,handleChange:P,isSubmitting:R,dirty:K})=>t.createElement(a.l0,null,t.createElement(s.T,{primaryAction:t.createElement(g.z,{disabled:R||!A?!0:!K,startIcon:t.createElement(L.Z,null),loading:R,type:"submit",size:"L"},u({id:"global.save",defaultMessage:"Save"})),title:q,navigationAction:t.createElement(a.rU,{startIcon:t.createElement(O.Z,null),to:"/settings/users?pageSize=10&page=1&sort=firstname"},u({id:"global.back",defaultMessage:"Back"}))}),t.createElement(l.D,null,W?.registrationToken&&t.createElement(n.x,{paddingBottom:6},t.createElement(k,{registrationToken:W.registrationToken})),t.createElement(m.k,{direction:"column",alignItems:"stretch",gap:7},t.createElement(n.x,{background:"neutral0",hasRadius:!0,shadow:"filterShadow",paddingTop:6,paddingBottom:6,paddingLeft:7,paddingRight:7},t.createElement(m.k,{direction:"column",alignItems:"stretch",gap:4},t.createElement(f.Z,{variant:"delta",as:"h2"},u({id:"app.components.Users.ModalCreateBody.block-title.details",defaultMessage:"Details"})),t.createElement(v.r,{gap:5},ne.map($=>$.map(D=>t.createElement(y.P,{key:D.name,...D.size},t.createElement(a.jm,{...D,disabled:!A,error:d[D.name],onChange:P,value:p[D.name]||""}))))))),t.createElement(n.x,{background:"neutral0",hasRadius:!0,shadow:"filterShadow",paddingTop:6,paddingBottom:6,paddingLeft:7,paddingRight:7},t.createElement(m.k,{direction:"column",alignItems:"stretch",gap:4},t.createElement(f.Z,{variant:"delta",as:"h2"},u({id:"global.roles",defaultMessage:"User's role"})),t.createElement(v.r,{gap:5},t.createElement(y.P,{col:6,xs:12},t.createElement(te.Z,{disabled:!A,error:d.roles,onChange:P,value:p.roles}))))))))))};w.propTypes={canUpdate:H().bool.isRequired};var oe=w,re=()=>{const A=(0,a.lm)(),u=(0,o.v9)(E._),C=t.useMemo(()=>({read:u.settings.users.read,update:u.settings.users.update}),[u.settings.users]),{isLoading:T,allowedActions:{canRead:Z,canUpdate:h}}=(0,a.ss)(C),{state:X}=(0,i.TH)(),b=X?.from??"/";return(0,t.useEffect)(()=>{T||!Z&&!h&&A({type:"info",message:{id:"notification.permission.not-allowed-read",defaultMessage:"You are not allowed to see this document"}})},[T,Z,h,A]),T?t.createElement(a.dO,null):!Z&&!h?t.createElement(i.l_,{to:b}):t.createElement(oe,{canUpdate:h})}},84024:function(B,c,e){var t=e(32735),a=e(50563),o=e(45509),i=e(47765),E=e(60216),r=e.n(E),s=e(67879);const g=({children:l,target:n})=>{const m=(0,o.lm)(),{formatMessage:f}=(0,s.Z)(),{copy:v}=(0,o.VP)(),y=f({id:"app.component.CopyToClipboard.label",defaultMessage:"Copy to clipboard"}),L=async()=>{await v(n)&&m({type:"info",message:{id:"notification.link-copied"}})};return t.createElement(o.Y_,{endAction:t.createElement(a.h,{label:y,noBorder:!0,icon:t.createElement(i.Z,null),onClick:L}),title:n,titleEllipsis:!0,subtitle:l,icon:t.createElement("span",{style:{fontSize:32}},"\u2709\uFE0F"),iconBackground:"neutral100"})};g.propTypes={children:r().oneOfType([r().element,r().string]).isRequired,target:r().string.isRequired},c.Z=g},47577:function(B,c,e){e.d(c,{A:function(){return s}});var t=e(32735),a=e(60216),o=e.n(a),i=e(67879),E=e(35231),r=e(84024);const s=({registrationToken:g})=>{const{formatMessage:l}=(0,i.Z)(),n=`${window.location.origin}${E.Z}auth/register?registrationToken=${g}`;return t.createElement(r.Z,{target:n},l({id:"app.components.Users.MagicLink.connect",defaultMessage:"Copy and share this link to give access to this user"}))};s.defaultProps={registrationToken:""},s.propTypes={registrationToken:o().string}},18703:function(B,c,e){var t=e(32735),a=e(68465),o=e(84967),i=e(45509),E=e(27169),r=e(60216),s=e.n(r),g=e(67879),l=e(20108),n=e(8471);const m=(0,n.F4)`
|
|
2
|
-
from {
|
|
3
|
-
transform: rotate(0deg);
|
|
4
|
-
}
|
|
5
|
-
to {
|
|
6
|
-
transform: rotate(359deg);
|
|
7
|
-
}
|
|
8
|
-
`,f=n.ZP.div`
|
|
9
|
-
animation: ${m} 2s infinite linear;
|
|
10
|
-
`,v=()=>t.createElement(f,null,t.createElement(E.Z,null)),y=async()=>{const{get:O}=(0,i.tg)(),{data:I}=await O("/admin/roles");return I.data},L=({disabled:O,error:I,onChange:j,value:x})=>{const{status:N,data:Y}=(0,l.useQuery)(["roles"],y,{staleTime:5e4}),{formatMessage:U}=(0,g.Z)(),S=I?U({id:I,defaultMessage:I}):"",F=U({id:"app.components.Users.ModalCreateBody.block-title.roles",defaultMessage:"User's roles"}),H=U({id:"app.components.Users.ModalCreateBody.block-title.roles.description",defaultMessage:"A user can have one or several roles"}),V=U({id:"app.components.Select.placeholder",defaultMessage:"Select"}),G=N==="loading"?t.createElement(v,null):void 0;return t.createElement(a.P,{id:"roles",disabled:O,error:S,hint:H,label:F,name:"roles",onChange:M=>{j({target:{name:"roles",value:M}})},placeholder:V,multi:!0,startIcon:G,value:x.map(M=>M.toString()),withTags:!0,required:!0},(Y||[]).map(M=>t.createElement(o.W,{key:M.id,value:M.id.toString()},U({id:`global.${M.code}`,defaultMessage:M.name}))))};L.defaultProps={disabled:!1,error:void 0},L.propTypes={disabled:s().bool,error:s().string,onChange:s().func.isRequired,value:s().array.isRequired},c.Z=L},32720:function(B,c,e){e.d(c,{YM:function(){return l},Rw:function(){return E}});var t=e(24346),a=e(45509);const o={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",(n,m)=>n?m.required(a.I0.required):m)};var E={...o,currentPassword:t.Z_().when(["password","confirmPassword"],(n,m,f)=>n||m?f.required(a.I0.required):f),preferedLanguage:t.Z_().nullable()},s={roles:t.IX().min(1,a.I0.required).required(a.I0.required)},l=t.Ry().shape({...o,isActive:t.Xg(),...s})},29439:function(B,c,e){e.d(c,{Z:function(){return o}});var t=e(74512);const a=i=>(0,t.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1rem",height:"1rem",fill:"none",viewBox:"0 0 24 24",...i,children:(0,t.jsx)("path",{fill:"#212134",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"})}),o=a}}]);
|