"use strict";(self.webpackChunk_digicms_admin=self.webpackChunk_digicms_admin||[]).push([[302],{26930:function(N,x,e){e.r(x),e.d(x,{SingleSignOn:function(){return n},default:function(){return r}});var t=e(32735),s=e(58521),a=e(66456),y=e(96709),O=e(28356),I=e(17e3),P=e(41415),F=e(27649),A=e(27677),$=e(49372),C=e(9139),B=e(70218),D=e(84967),L=e(15335),z=e(5803),W=e(5636),Z=e(89793),H=e.n(Z),j=e(64421),b=e(31842),T=e(83983),g=e(5173),k=g.Ry().shape({autoRegister:g.Xg().required(s.translatedErrors.required),defaultRole:g.nK().when("autoRegister",(l,o)=>l?o.required(s.translatedErrors.required):o.nullable())});const h={...T.Z.settings.sso,readRoles:T.Z.settings.roles.read},n=()=>{const{formatMessage:l}=(0,W.useIntl)(),{isLoading:o,allowedActions:{canUpdate:i,canReadRoles:E}}=(0,s.useRBAC)(h),[{formErrors:c,initialData:S,isLoading:p,modifiedData:f,showHeaderButtonLoader:m},M,{handleChange:v,handleSubmit:G}]=(0,b.G4)((0,j.IF)("providers/options"),k,()=>{},["autoRegister","defaultRole"]),{roles:R}=(0,b.bF)(E);(0,s.useFocusWhenNavigate)();const U=o||p;(0,t.useEffect)(()=>{if(c.defaultRole){const d='[name="defaultRole"]';document.querySelector(d).focus()}},[c]);const K=H()(S,f);return t.createElement(y.A,null,t.createElement(s.SettingsPageTitle,{name:"SSO"}),t.createElement(F.o,{tabIndex:-1},t.createElement("form",{onSubmit:d=>{if(K){d.preventDefault();return}G(d)}},t.createElement(O.T,{primaryAction:t.createElement(P.z,{"data-testid":"save-button",disabled:K,loading:m,startIcon:t.createElement(a.Z,null),type:"submit",size:"L"},l({id:"global.save",defaultMessage:"Save"})),title:l({id:"Settings.sso.title",defaultMessage:"Single Sign-On"}),subtitle:l({id:"Settings.sso.description",defaultMessage:"Configure the settings for the Single Sign-On feature."})}),t.createElement(I.D,null,U?t.createElement(s.LoadingIndicatorPage,null):t.createElement(A.K,{spacing:4,background:"neutral0",padding:6,shadow:"filterShadow",hasRadius:!0},t.createElement($.Z,{variant:"delta",as:"h2"},l({id:"global.settings",defaultMessage:"Settings"})),t.createElement(L.r,{gap:4},t.createElement(z.P,{col:6,m:6,s:12},t.createElement(C.s,{"aria-label":"autoRegister","data-testid":"autoRegister",disabled:!i,checked:f.autoRegister,hint:l({id:"Settings.sso.form.registration.description",defaultMessage:"Create new user on SSO login if no account exists"}),label:l({id:"Settings.sso.form.registration.label",defaultMessage:"Auto-registration"}),name:"autoRegister",offLabel:l({id:"app.components.ToggleCheckbox.off-label",defaultMessage:"Off"}),onLabel:l({id:"app.components.ToggleCheckbox.on-label",defaultMessage:"On"}),onChange:d=>{v({target:{name:"autoRegister",value:d.target.checked}})}})),t.createElement(z.P,{col:6,m:6,s:12},t.createElement(B.P,{disabled:!i,hint:l({id:"Settings.sso.form.defaultRole.description",defaultMessage:"It will attach the new authenticated user to the selected role"}),error:c.defaultRole?l({id:c.defaultRole.id,defaultMessage:c.defaultRole.id}):"",label:l({id:"Settings.sso.form.defaultRole.label",defaultMessage:"Default role"}),name:"defaultRole",onChange:d=>{v({target:{name:"defaultRole",value:d}})},placeholder:l({id:"components.InputSelect.option.placeholder",defaultMessage:"Choose here"}),value:f.defaultRole},R.map(({id:d,name:Q})=>t.createElement(D.W,{key:d,value:d.toString()},Q))))))))))};var r=()=>t.createElement(s.CheckPagePermissions,{permissions:h.main},t.createElement(n,null))},9139:function(N,x,e){e.d(x,{s:function(){return h}});var t=e(32735),s=e(83292),a=e(60216),y=e(78542),O=e(59002),I=e(87107),P=e(76437),F=e(67014),A=e(47851),$=e(27677),C=e(87933),B=e(7563),D=e(30350),L=e(49372),z=e(3685),W=e(72850),Z=e(76144);const H=s.default.label`
  position: relative;
  display: inline-block;
  z-index: 0;
  width: 100%;
`,j=(0,s.default)(W.x)`
  cursor: ${({disabled:n})=>n?"not-allowed":void 0};
  // Masks the background of each value
  overflow: hidden;
  flex-wrap: wrap;

  ${(0,D.k3)()}
`,b=(0,s.default)(C.k).attrs({hasRadius:!0})`
  background-color: ${({theme:n,checked:u,disabled:r})=>u?r?n.colors.neutral200:n.colors.neutral0:"transparent"};
  border: 1px solid
    ${({theme:n,checked:u,disabled:r})=>u&&u!==null?r?n.colors.neutral300:n.colors.neutral200:r?n.colors.neutral150:n.colors.neutral100};
  position: relative;
  user-select: none;
  z-index: 2;
  flex: 1 1 50%;
  /**
    We declare the defined value because we want the height of the input when 
    the values are in a row to be 40px. But defining a height on the label
    would break the input when it wraps.
  */
  padding-top: ${({size:n})=>`${n==="S"?"2px":"6px"}`};
  padding-bottom: ${({size:n})=>`${n==="S"?"2px":"6px"}`};
`,T=s.default.input`
  height: 100%;
  left: 0;
  opacity: 0;
  position: absolute;
  top: 0;
  z-index: 1;
  width: 100%;
`,g=t.forwardRef(({size:n,onLabel:u,offLabel:r,children:l,checked:o,disabled:i,onChange:E,...c},S)=>{const{name:p,required:f}=(0,Z.U)(),m="neutral600";let M=!o&&o!==null?"danger700":m,v=o?"primary600":m;const G=R=>{i||E(R)};return t.createElement(H,null,t.createElement(z.T,null,l),t.createElement(j,{hasRadius:!0,disabled:i,padding:1,display:"flex",background:i?"neutral150":"neutral100",borderStyle:"solid",borderWidth:"1px",borderColor:"neutral200"},t.createElement(b,{size:n,paddingLeft:3,paddingRight:3,justifyContent:"center",alignItems:"center","aria-hidden":!0,checked:o===null?!1:!o,disabled:i},t.createElement(L.Z,{variant:"pi",fontWeight:"bold",textTransform:"uppercase",textColor:i?"neutral700":M},r)),t.createElement(b,{size:n,paddingLeft:3,paddingRight:3,justifyContent:"center",alignItems:"center","aria-hidden":!0,checked:o===null?!1:o,disabled:i},t.createElement(L.Z,{variant:"pi",fontWeight:"bold",textTransform:"uppercase",textColor:i?"neutral700":v},u)),t.createElement(T,{type:"checkbox","aria-disabled":i,onChange:R=>G(R),name:p,ref:S,"aria-required":f,...c,checked:!(o===null||!o)})))});g.displayName="ToggleCheckbox",g.defaultProps={disabled:!1,checked:!1,onChange:void 0,size:"M"},g.propTypes={checked:a.bool,children:a.string.isRequired,disabled:a.bool,offLabel:a.string.isRequired,onChange:a.func,onLabel:a.string.isRequired,size:a.oneOf(Object.keys(y.J.input))};const J=(0,s.default)(I.g)`
  max-width: 320px;
`,k=(0,s.default)(B.A)`
  align-self: flex-end;
  margin-left: auto;
`,h=({disabled:n,size:u,error:r,hint:l,label:o,name:i,labelAction:E,required:c,id:S,onClear:p,clearLabel:f,checked:m,...M})=>{const v=(0,O.M)("toggleinput",S);return t.createElement(J,{name:i,hint:l,error:r,id:v,required:c},t.createElement($.K,{spacing:1},t.createElement(C.k,null,t.createElement(P.Q,{action:E},o),f&&p&&m!==null&&!n&&t.createElement(k,{onClick:p},f)),t.createElement(g,{id:v,size:u,checked:m,disabled:n,...M},o),t.createElement(F.J,null),t.createElement(A.c,null)))};h.displayName="ToggleInput",h.defaultProps={checked:!1,clearLabel:void 0,disabled:!1,error:void 0,hint:void 0,id:void 0,label:"",labelAction:void 0,name:"",onClear:void 0,required:!1,size:"M"},h.propTypes={checked:a.bool,clearLabel:a.string,disabled:a.bool,error:a.string,hint:a.oneOfType([a.string,a.node,a.arrayOf(a.node)]),id:a.string,label:a.string,labelAction:a.node,name:a.string,onClear:a.func,required:a.bool,size:a.oneOf(Object.keys(y.J.input))}}}]);
