File: //opt/netdata/usr/share/netdata/web/v3/9883.eb1c151b566cc815c44d.chunk.js
try{!function(){var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="3cb07827-c381-43c3-9ad9-44da2e5f59e3",e._sentryDebugIdIdentifier="sentry-dbid-3cb07827-c381-43c3-9ad9-44da2e5f59e3")}()}catch(e){}!function(){try{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{}).SENTRY_RELEASE={id:"89edb4d0ccffc3f81f5612f91bc363bd6e773034"}}catch(e){}}(),(self.webpackChunkcloud_frontend=self.webpackChunkcloud_frontend||[]).push([[9883],{1457:(e,t,n)=>{n.d(t,{Rq:()=>r,oL:()=>a,u:()=>s,ue:()=>l});var o=n(52035),i=n(84929);const l={items:[],error:"",id:null,loading:!0,loaded:!1},r=(0,i.Iz)((()=>(0,o.eU)(0))),a=(0,i.Iz)((e=>(0,o.eU)({...l,id:e}))),s=(0,i.Iz)((()=>(0,o.eU)(null)))},34646:(e,t,n)=>{n.d(t,{FX:()=>l,ON:()=>a,Uj:()=>s,Zl:()=>i,lG:()=>r,lt:()=>d});var o=n(91130);const i=e=>o.A.get(`/api/v3/spaces/${e}/scim`),l=(e,t)=>e?o.A.get(`/api/v3/spaces/${t}/scim/${e}`):Promise.resolve({data:null}),r=(e,t)=>o.A.post(`/api/v3/spaces/${e}/scim`,t),a=(e,t,n)=>o.A.patch(`/api/v3/spaces/${t}/scim/${e}`,n),s=(e,t)=>o.A.delete(`/api/v3/spaces/${t}/scim/${e}`),d=(e,t)=>e?o.A.post(`/api/v3/spaces/${t}/scim/${e}/rotate-token`):Promise.resolve({data:null})},49883:(e,t,n)=>{n.r(t),n.d(t,{default:()=>ke});var o=n(86177),i=n(60908),l=n(74891),r=n(74848);const a=(0,l.A)(o.Button),s="rows",d="grid",c=e=>t=>e==s&&t||e==d&&!t?{flavour:"hollow"}:{},u=e=>{let{showGrid:t,toggleLayout:n}=e;return(0,r.jsxs)(o.Flex,{alignItems:"center",children:[(0,r.jsx)(a,{small:!0,groupFirst:!0,icon:"list",onClick:n,tooltip:"Show in rows",...c(s)(t)}),(0,r.jsx)(a,{small:!0,groupLast:!0,icon:"grid",onClick:n,tooltip:"Show in grid",...c(d)(t)})]})};n(98992),n(72577);var h=n(91130);var g=n(24609),x=n(32052),p=n(52035),f=n(84929);const m={items:[],error:"",id:null,loading:!0,loaded:!1,oidcID:null},j=(0,f.Iz)((()=>(0,p.eU)(0))),b=(0,f.Iz)((e=>(0,p.eU)({...m,id:e}))),v=(0,f.Iz)((()=>(0,p.eU)(null)));var C=n(96540),k=n(34843),y=n(57377);const w=(0,f.Iz)((e=>{let{id:t,key:n}=e;return(0,p.eU)((e=>{const o=e(b(t));return n?o[n]:o}),((e,o,i)=>{o(b(t),(e=>n?{...e,[n]:"function"===typeof i?i(e):i}:{...e,..."function"===typeof i?i(e):i}))}))}),y.Ay),A=e=>((e,t)=>(0,k.md)(w({id:e,key:t})))((0,g.vt)(),e),D=e=>(0,k.fp)(v(e)),S=e=>{const t=(0,g.vt)(),[n,o]=D(t),i=(0,C.useCallback)((function(){return function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return h.A.post(`/api/v3/spaces/${e}/oidc`,{...t})}(t,arguments.length>0&&void 0!==arguments[0]?arguments[0]:{})}),[t]),l=(0,C.useCallback)((function(){return function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return h.A.patch(`/api/v3/spaces/${t}/oidc/${e}`,n)}(e,t,arguments.length>0&&void 0!==arguments[0]?arguments[0]:{})}),[e,t]),r=(0,C.useCallback)((()=>((e,t)=>h.A.delete(`/api/v3/spaces/${t}/oidc/${e}`))(e,t).then((()=>(o(null),Promise.resolve())))),[e,t,o]);return{config:n,isEdit:!!e,save:e?l:i,remove:r}},F=()=>{const e=(0,g.vt)(),t=((e,t)=>(0,k.Xr)(w({id:e,key:t})))(e),n=(()=>{const e=(0,g.vt)();return(0,k.md)(j(e))})();(0,x.A)((()=>({enabled:!!e,fetch:()=>(e=>h.A.get(`/api/v3/spaces/${e}/oidc`))(e),onFail:e=>t({...m,error:e?.response?.data||e}),onSettle:()=>t({loading:!1,loaded:!0}),onSuccess:e=>{const{oidcID:n}=e.find((e=>{let{oidcID:t}=e;return!!t}))||{};t((t=>({...t,items:e,oidcID:n})))}})),[n,e])};n(54520),n(81454);var I=n(55093),T=n(79748),L=n(95565),M=n(76375);const $="authentication",B=function(){let{flavour:e,error:t={},logProps:n={}}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{loaded:l,isPaid:a}=(0,M.A)(),{errorMsgKey:s}=t,d=(0,C.useMemo)((()=>function(){let{flavour:e,isPaid:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=e===$;return{ErrForbidden:{title:"No permissions",Content:()=>(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(o.Text,{children:"You don't have permissions to view the authentication methods."}),(0,r.jsx)(o.Text,{children:"Please contact the Space administrators if this is unexpected."})]})},ErrNotAvailable:{title:"No available "+(n?"Authn":"Authz"),Content:()=>(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(o.Text,{children:["No available ",n?"authentication":"authorization"," integrations found."]}),t?null:(0,r.jsxs)(o.Text,{children:["To enable this feature, please"," ",(0,r.jsx)(L.A,{children:(0,r.jsx)(o.Text,{color:"primary",children:"upgrade to the Business plan"})}),"."]})]})},default:{title:"Error",Content:()=>(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(o.Text,{children:"Something went wrong, please check again later."}),(0,r.jsxs)(o.Text,{children:["If the problem persists feel free to contact us with a"," ",(0,r.jsx)(T.A,{href:"https://github.com/netdata/netdata-cloud/issues/new/choose",target:"_blank",rel:"noopener noreferrer",children:"ticket"})]})]})}}}({flavour:e,isPaid:a})),[e,a]),{title:c,Content:u}=d[s]||d.default;return l?(0,r.jsx)(i.DL,{errorMsgKey:s,...n,children:(0,r.jsxs)(o.Flex,{column:!0,gap:1,padding:[4,0],children:[(0,r.jsxs)(o.Flex,{alignItems:"center",gap:2,children:[(0,r.jsx)(o.Icon,{name:"warning_triangle",color:"warning"}),(0,r.jsx)(o.H5,{children:c})]}),(0,r.jsx)(u,{})]})}):null},E={flexWrap:!0},P={column:!0},U=e=>{let{flavour:t,loading:n,loaded:i,items:l=[],oidcID:a,error:s,showGrid:d,CardComponent:c,errorViewProps:u={},noLoader:h}=e;const g=l.filter((e=>{let{available:t}=e;return!!t})),x=(0,C.useMemo)((()=>({width:"100%",gap:4,...d?E:P})),[d]),p=(0,C.useMemo)((()=>d?{height:37,width:75,margin:[0,0,4,0]}:{}),[d]);return!i&&n?h?null:(0,r.jsx)(I.A,{title:"Loading..."}):i?s?(0,r.jsx)(B,{flavour:t,error:s,...u}):g.length?c?(0,r.jsx)(o.Flex,{...x,children:g.map((e=>(0,r.jsx)(c,{configuredItemExists:!!a,...p,...e},e.id)))}):null:(0,r.jsx)(B,{flavour:t,error:{errorMsgKey:"ErrNotAvailable"},...u}):(0,r.jsx)(B,{flavour:t,error:"Something went wrong",...u})};var R=n(6304);n(23215);const z=e=>{const t=(0,g.vt)(),[,n]=D(t);(0,x.A)((()=>({enabled:!!t,fetch:()=>((e,t)=>e?h.A.get(`/api/v3/spaces/${t}/oidc/${e}`):Promise.resolve({data:null}))(e,t),onSuccess:e=>{n(e)}})),[t,e])},q={okta:{name:"okta",color:"bright"},"auth-server":{name:"openid",color:"bright"}},_=e=>{let{title:t,onConfirm:n,onDecline:i,isConfirmLoading:l}=e;return(0,r.jsx)(o.ConfirmationDialog,{confirmLabel:"Yes, delete",handleConfirm:n,handleDecline:i,message:(0,r.jsxs)(r.Fragment,{children:["You are about to delete ",(0,r.jsx)("strong",{children:t})," configuration.",(0,r.jsx)("br",{}),"Are you sure you want to continue?"]}),title:"Delete configuration",isConfirmLoading:l})};var N=n(99728),G=n(94404),O=n(3319);const X=(0,l.A)((0,G.A)(o.Button)),Y=e=>{let{title:t,isLoading:n,isEditable:i,validFields:l,onSave:a,onConfirmDelete:s}=e;const[d,,c,u]=(0,R.A)(),h=(0,N.JT)("oidc:Manage"),{sendLog:g}=(0,O.A)(),x=(0,C.useCallback)((()=>{s(),u(),g({feature:"OidcModalConfirmDeleteButton",title:t})}),[s,u]),p=(0,C.useMemo)((()=>({feature:"OidcModalSaveButton",label:"Save",onClick:a,disabled:!l||!h||n,tooltip:h?l?"Save the configuration":"Please provide values to the required fields":"You don't have permission to manage single sign-on configurations."})),[a,l,h,n]),f=(0,C.useMemo)((()=>({feature:"OidcModalDeleteButton",label:"Delete",flavour:"hollow",danger:!0,onClick:c,disabled:!h||n,tooltip:h?"Delete the configuration":"You don't have permission to manage single sign-on configurations."})),[c,n,h]);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(o.ModalFooter,{gap:2,children:[i?(0,r.jsx)(X,{...f}):null,(0,r.jsx)(X,{...p})]}),d?(0,r.jsx)(_,{title:t,onConfirm:x,onDecline:u,isConfirmLoading:n}):null]})},H={string:e=>{let{propKey:t,title:n,setFormData:i,...l}=e;const a=(0,C.useCallback)((e=>{let{target:n}=e;i((e=>({...e,[t]:n.value})))}),[t,i]);return(0,r.jsx)(o.TextInput,{label:n,onChange:a,...l})},default:()=>null},V=e=>{let{propKey:t,type:n,setFormData:o,...i}=e;const l=H[n]||H.default,a=(0,C.useCallback)((e=>{let{target:n}=e;o((e=>({...e,initialData:!1,[t]:n.value})))}),[o]);return(0,r.jsx)(l,{onChange:a,...i})},K=e=>{let{properties:t={},errors:n={},formData:i,required:l,setFormData:a}=e;return(0,r.jsx)(o.Flex,{column:!0,gap:2,children:Object.entries(t).map((e=>{let[t,o]=e;return(0,r.jsx)(V,{propKey:t,isRequired:l.includes(t),...o,value:i[t]||"",setFormData:a,error:n[t]},t)}))})};var W=n(63872);n(8872);const Z={string:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{format:n}=t;return"uri"!=n||(e=>{try{const{host:t}=new URL(e);return/^(?!-)[a-zA-Z0-9-]{1,63}(?<!-)(\.[a-zA-Z0-9]{1,63})+$/.test(t)}catch{return!1}})(e)?null:"Invalid URL format"},default:()=>null},J=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Object.entries(e).reduce(((e,n)=>{let[o,i]=n;const l=t[o]||{},r=(Z[l.type]||Z.default)(i,l);return r&&(e[o]=r),e}),{})},Q=e=>{let{id:t,oidcID:n,title:l,slug:a,description:s,properties:d={},required:c=[],isEditable:u,docsUrl:h,onClose:x,openDnsRecord:p}=e;z(n);const{config:f,isEdit:m,save:b,remove:v}=S(n),[y,w]=(0,C.useState)({}),[A,,D,F]=(0,R.A)(),L=(()=>{const e=(0,g.vt)(),t=(0,k.Xr)(j(e));return(0,C.useCallback)((()=>t((e=>e+1))),[t])})(),[M,$]=(0,W.A)(),[B,E]=(0,C.useState)({}),P=c.every((e=>!!y[e]));(0,C.useEffect)((()=>{w(f||{})}),[f]),(0,C.useEffect)((()=>{E(J(y,d))}),[y,d,E]);const U=(0,C.useCallback)((()=>{D(),b({...m?{}:{integrationID:t},...y}).then((function(){let{data:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};M({header:"Success",text:`Successfully configured ${l}`}),x(),L(),e?.dnsRecordValue&&p()})).catch($).finally((()=>{F()}))}),[b,y,m,M,$,x,L,D,F]),_=(0,C.useCallback)((()=>{D(),v().then((()=>{M({header:"Success",text:`Successfully deleted ${l} configuration`}),x(),L()})).catch($).finally((()=>{F()}))}),[v,M,$,x,L,D,F]);return(0,r.jsx)(i.Ay,{feature:"AuthModal",title:l,children:(0,r.jsx)(o.Modal,{backdropProps:{backdropBlur:!0},onEsc:x,children:(0,r.jsxs)(o.ModalContent,{width:{min:100,base:140},children:[(0,r.jsxs)(o.ModalHeader,{border:{side:"bottom",color:"disabled"},column:!0,gap:.5,padding:[6,4,3],children:[(0,r.jsxs)(o.Flex,{alignItems:"center",children:[(0,r.jsxs)(o.Flex,{gap:1,alignItems:"center",children:[(0,r.jsx)(o.Icon,{...q[a]||{}}),(0,r.jsx)(o.H3,{children:l})]}),x&&(0,r.jsx)(o.ModalCloseButton,{onClose:x,tooltip:"Close modal"})]}),(0,r.jsxs)(o.TextSmall,{as:o.Box,children:[s,h?(0,r.jsxs)(r.Fragment,{children:["\xa0",(0,r.jsx)(T.A,{Component:o.TextSmall,href:h,target:"_blank",whiteSpace:"nowrap",children:"Learn how to configure it."})]}):null]})]}),(0,r.jsx)(o.ModalBody,{height:{min:60,base:60},overflow:{vertical:"auto"},children:A?(0,r.jsx)(I.A,{height:60,title:"Loading..."}):(0,r.jsx)(K,{formData:y,required:c,setFormData:w,properties:d,errors:B})}),(0,r.jsx)(Y,{title:l,isLoading:A,isEditable:u,validFields:P||!!Object.keys(B).length,onSave:U,onConfirmDelete:_})]})})})};var ee=n(30005);const te=e=>{let{oidcID:t,title:n,slug:l,onClose:a}=e;z(t);const{config:s}=S(t);return s?.dnsRecordValue?(0,r.jsx)(i.Ay,{feature:"AuthDnsRecord",title:n,children:(0,r.jsx)(o.Modal,{backdropProps:{backdropBlur:!0},onEsc:a,children:(0,r.jsxs)(o.ModalContent,{width:{min:100,base:140},children:[(0,r.jsx)(o.ModalHeader,{border:{side:"bottom",color:"disabled"},column:!0,gap:.5,padding:[6,4,3],children:(0,r.jsxs)(o.Flex,{alignItems:"center",children:[(0,r.jsxs)(o.Flex,{gap:1,alignItems:"center",children:[(0,r.jsx)(o.Icon,{...q[l]||{}}),(0,r.jsx)(o.H3,{children:"Create a new TXT record in the DNS settings"})]}),a&&(0,r.jsx)(o.ModalCloseButton,{onClose:a,tooltip:"Close modal"})]})}),(0,r.jsx)(o.ModalBody,{height:{min:60,base:60},overflow:{vertical:"auto"},children:(0,r.jsxs)(o.Flex,{column:!0,gap:2,padding:[4],children:[(0,r.jsx)(o.Text,{children:"In your domain's DNS settings, create a new TXT record and use the code below as its' value."}),(0,r.jsx)(ee.Ay,{"data-testid":"dnsRecordValue",children:s.dnsRecordValue}),(0,r.jsx)(T.A,{Component:o.TextSmall,href:"https://learn.netdata.cloud/docs/netdata-cloud/authentication-&-authorization/enterprise-sso-authentication#how-to-authenticate-to-netdata",target:"_blank",whiteSpace:"nowrap",children:"Learn how to configure DNS TXT records"})]})})]})})}):null},ne=(0,l.A)(o.Button),oe=e=>{let{title:t,isEditable:n,isDisabled:o,onClick:i}=e;const l=(0,C.useMemo)((()=>o?"You have already configured a SSO provider":n?`Edit ${t} configuration`:`Configure ${t}`),[o,n,t]);return(0,r.jsx)(ne,{label:n?"Edit":"Configure",flavour:"hollow",icon:"gear",onClick:i,disabled:o,tooltip:l,tooltipProps:{align:"bottom"}})};var ie=n(98563);const le=e=>{let{id:t,slug:n,title:i,description:l,"data-testid":a="card",configuredItemExists:s,oidcID:d,schema:c={},...u}=e;const h=q[n],[g,,x,p]=(0,R.A)(),[f,,m,j]=(0,R.A)(),b=s&&!d,v=s&&!!d,{annotations:C={},properties:k={},required:y=[]}=c,{docsUrl:w}=C;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(o.Flex,{background:"elementBackground",column:!0,"data-testid":a,justifyContent:"between",flex:!1,padding:[3,2,2,3],position:"relative",overflow:"hidden",round:.5,...u,children:[(0,r.jsx)(ie.MU,{"data-testid":`${a}-blurredIcon`,...h}),(0,r.jsxs)(o.Flex,{column:!0,"data-testid":`${a}-details`,gap:3,margin:[0,0,3,0],children:[(0,r.jsxs)(o.Flex,{"data-testid":`${a}-header`,justifyContent:"between",children:[(0,r.jsxs)(o.Flex,{alignItems:"center","data-testid":`${a}-titleContainer`,gap:1,children:[(0,r.jsx)(o.Icon,{"data-testid":`${a}-icon`,...h}),(0,r.jsx)(o.Text,{"data-testid":`${a}-title`,children:i})]}),(0,r.jsxs)(o.Flex,{gap:1,children:[v&&(0,r.jsx)(o.Button,{label:"DNS TXT record",flavour:"hollow",icon:"serviceDNS",onClick:m,neutral:!0}),(0,r.jsx)(oe,{title:i,isEditable:v,isDisabled:b,onClick:x})]})]}),(0,r.jsxs)(o.TextSmall,{color:"textDescription","data-testid":`${a}-description`,children:[l," ",w&&(0,r.jsx)(T.A,{Component:ie.W6,"data-testid":`${a}-docsLink`,href:w,target:"_blank",whiteSpace:"nowrap",children:"Learn more."})]})]})]}),g&&(0,r.jsx)(Q,{id:t,oidcID:d,slug:n,title:i,description:l,docsUrl:w,properties:k,required:y,onClose:p,isEditable:v,openDnsRecord:m}),f&&(0,r.jsx)(te,{oidcID:d,slug:n,title:i,onClose:j})]})},re=e=>{let{showGrid:t}=e;F();const n=A();return(0,r.jsx)(U,{flavour:"authentication",showGrid:t,CardComponent:le,errorViewProps:{logProps:{feature:"AuthenticationIntegrationError"}},...n})};var ae=n(53746),se=n(63956),de=n(34646);const ce=e=>{const t=(0,g.vt)(),[,n]=(0,se.Hy)(t);(0,x.A)((()=>({enabled:!!t,fetch:()=>(0,de.FX)(e,t),onSuccess:e=>{n(e)}})),[t])},ue=e=>{let{title:t,onConfirm:n,onDecline:i,isConfirmLoading:l}=e;return(0,r.jsx)(o.ConfirmationDialog,{confirmLabel:"Yes, delete",handleConfirm:n,handleDecline:i,message:(0,r.jsxs)(r.Fragment,{children:["You are about to delete ",(0,r.jsx)("strong",{children:t})," integration.",(0,r.jsx)("br",{}),"Are you sure you want to continue?"]}),title:"Delete integration",isConfirmLoading:l})},he=(0,l.A)((0,G.A)(o.Button)),ge=e=>{let{title:t,isLoading:n,isEditable:i,isDirty:l,credentials:a,validFields:s,onActivate:d,onUpdate:c,onRotateToken:u,onConfirmDelete:h,onClose:g}=e;const[x,,p,f]=(0,R.A)(),m=(0,N.JT)("oidc:Manage"),{sendLog:j}=(0,O.A)(),b=(0,C.useCallback)((()=>{h(),f(),j({feature:"ScimModalConfirmDeleteButton",title:t})}),[h,f]),v=(0,C.useMemo)((()=>({feature:"ScimModalSaveButton",label:"Save",onClick:c,disabled:!l||!s||!m||n,tooltip:m?s?"Save the integration":"Please provide values to the required fields":"You don't have permission to manage scim integrations."})),[c,l,s,m,n]),k=(0,C.useMemo)((()=>({feature:"ScimModalDeleteButton",label:"Delete",flavour:"hollow",danger:!0,onClick:p,disabled:!m||n,tooltip:m?"Delete the integration":"You don't have permission to manage scim integrations."})),[p,n,m]);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(o.ModalFooter,{gap:2,justifyContent:"between",children:[i&&!a?(0,r.jsx)(he,{...k}):(0,r.jsx)("div",{}),(0,r.jsx)(o.Flex,{gap:2,children:a?(0,r.jsx)(he,{label:"Done",onClick:g}):i?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(he,{label:"Regenerate token",flavour:"hollow",onClick:u}),(0,r.jsx)(he,{...v})]}):(0,r.jsx)(he,{label:"Activate",onClick:d})})]}),x?(0,r.jsx)(ue,{title:t,onConfirm:b,onDecline:f,isConfirmLoading:n}):null]})};var xe=n(67723);const pe=e=>{let{baseURL:t,token:n}=e;return(0,r.jsxs)(o.Flex,{column:!0,gap:2,children:[(0,r.jsxs)(o.Flex,{column:!0,gap:1,children:[(0,r.jsx)(o.Text,{as:"label",children:"Base URL"}),(0,r.jsx)(xe.A,{logProps:{feature:"CopyScimBaseURL"},padding:[2],noMargin:!0,children:t})]}),(0,r.jsxs)(o.Flex,{column:!0,gap:1,children:[(0,r.jsx)(o.Text,{as:"label",children:"Token"}),(0,r.jsx)(xe.A,{logProps:{feature:"CopyScimToken"},padding:[2],noMargin:!0,children:n})]})]})},fe="Loading...",me=e=>{let{id:t,scimID:n,title:l,slug:a,description:s,properties:d={},required:c=[],docsUrl:u,onClose:h}=e;ce(n);const g=(0,C.useRef)(),{integration:x,create:p,update:f,remove:m,rotateToken:j}=(0,se.dI)(n||t),b=(0,se.nB)(),[v,,k]=(0,R.A)(),[y,w]=(0,C.useState)({}),{isLoading:A,loadingText:D,startLoading:S,startLoadingToken:F,stopLoading:L}=(()=>{const[e,,t,n]=(0,R.A)(),[o,i]=(0,C.useState)(fe),l=(0,C.useCallback)((()=>{i("Generating token..."),t()}),[t,i]),r=(0,C.useCallback)((()=>{n(),i(fe)}),[n,i]);return{isLoading:e,loadingText:o,startLoading:t,startLoadingToken:l,stopLoading:r}})(),[M,$]=(0,W.A)(),[B,E]=(0,C.useState)({}),P=c.every((e=>!!y[e])),[U,z]=(0,C.useState)();(0,C.useEffect)((()=>{if(Object.keys(x||{}).length){const e={...x,initialData:!0};w(e)}}),[x]),(0,C.useEffect)((()=>{E(J(y,d))}),[y,d,E]),(0,C.useEffect)((()=>{Object.keys(y).length&&!y.initialData&&(g.current=!0)}),[y]);const _=(0,C.useCallback)((()=>{v&&b(),h()}),[v,b,h]),N=(0,C.useCallback)((()=>{const{scimToken:e}=y||{};F(),p({scimToken:e}).then((e=>{let{data:t}=e;z(t),k()})).catch((e=>{$(e)})).finally((()=>L()))}),[t,y,p,k,z,F,L,$]),G=(0,C.useCallback)((()=>{const{scimToken:e}=y||{};S(),f({scimToken:e}).then((()=>{M("Successfully updated integration")})).catch($).finally(L)}),[y,f,S,L,M,$]),O=(0,C.useCallback)((()=>{F(),j().then((e=>{let{data:t}=e;z(t),k()})).catch((e=>{$(e)})).finally((()=>L()))}),[j,F,L,z,k,$]),X=(0,C.useCallback)((()=>{S(),m().then((()=>{M({header:"Success",text:`Successfully deleted ${l} integration`}),b(),_()})).catch($).finally((()=>{L()}))}),[m,b,M,$,_,S,L]);return(0,r.jsx)(i.Ay,{feature:"AuthModal",title:l,children:(0,r.jsx)(o.Modal,{backdropProps:{backdropBlur:!0},onEsc:_,children:(0,r.jsxs)(o.ModalContent,{width:{min:100,base:140},children:[(0,r.jsxs)(o.ModalHeader,{border:{side:"bottom",color:"disabled"},column:!0,gap:.5,padding:[6,4,3],children:[(0,r.jsxs)(o.Flex,{alignItems:"center",children:[(0,r.jsxs)(o.Flex,{gap:1,alignItems:"center",children:[(0,r.jsx)(o.Icon,{...q[a]||{}}),(0,r.jsx)(o.H3,{children:l})]}),h&&(0,r.jsx)(o.ModalCloseButton,{onClose:_,tooltip:"Close modal"})]}),(0,r.jsxs)(o.TextSmall,{as:o.Box,children:[s,u?(0,r.jsxs)(r.Fragment,{children:["\xa0",(0,r.jsx)(T.A,{Component:o.TextSmall,href:u,target:"_blank",whiteSpace:"nowrap",children:"Learn how to configure it."})]}):null]})]}),(0,r.jsx)(o.ModalBody,{height:{min:40,base:60},overflow:{vertical:"auto"},children:A?(0,r.jsx)(I.A,{height:40,title:D}):U?(0,r.jsx)(pe,{...U}):(0,r.jsx)(K,{formData:y,required:c,setFormData:w,properties:d,errors:B})}),(0,r.jsx)(ge,{title:l,isLoading:A,isEditable:!!n,isDirty:g?.current,credentials:U,validFields:P||!!Object.keys(B).length,onActivate:N,onUpdate:G,onRotateToken:O,onConfirmDelete:X,onClose:_})]})})})},je=(0,l.A)(o.Button),be=e=>{let{title:t,isActive:n,onClick:o}=e;const{tooltip:i,buttonLabel:l,icon:a}=(0,C.useMemo)((()=>({tooltip:n?`Configure ${t}`:`Activate ${t}`,buttonLabel:n?"Configure":"Activate",icon:n?"gear":null})),[n]);return(0,r.jsx)(je,{label:l,flavour:"hollow",icon:a,onClick:o,tooltip:i,tooltipProps:{align:"bottom"}})},ve=e=>{let{id:t,slug:n,title:i,description:l,"data-testid":a="card",schema:s={},SCIMID:d,...c}=e;const[u,,h,g]=(0,R.A)(),x=!!d,{annotations:p={},properties:f={},required:m=[]}=s,{docsUrl:j}=p;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(o.Flex,{background:"elementBackground",column:!0,"data-testid":a,justifyContent:"between",flex:!1,padding:[3,2,2,3],position:"relative",overflow:"hidden",round:.5,...c,children:[(0,r.jsx)(ie.MU,{"data-testid":`${a}-blurredIcon`}),(0,r.jsxs)(o.Flex,{column:!0,"data-testid":`${a}-details`,gap:3,margin:[0,0,3,0],children:[(0,r.jsxs)(o.Flex,{"data-testid":`${a}-header`,justifyContent:"between",children:[(0,r.jsx)(o.Text,{"data-testid":`${a}-title`,children:i}),(0,r.jsx)(be,{title:i,onClick:h,isActive:x})]}),(0,r.jsxs)(o.TextSmall,{color:"textDescription","data-testid":`${a}-description`,children:[l," ",j&&(0,r.jsx)(T.A,{Component:ie.W6,"data-testid":`${a}-docsLink`,href:j,target:"_blank",whiteSpace:"nowrap",children:"Learn more."})]})]})]}),u&&(0,r.jsx)(me,{id:t,scimID:d,slug:n,title:i,description:l,docsUrl:j,properties:f,required:m,onClose:g})]})},Ce=e=>{let{showGrid:t}=e;(0,ae.A)();const n=(0,se.Xy)();return(0,r.jsx)(U,{flavour:"authorization",showGrid:t,CardComponent:ve,errorViewProps:{logProps:{feature:"AuthorizationIntegrationError"}},...n,noLoader:!0})},ke=e=>{const[t,n]=(0,R.A)();return(0,r.jsx)(i.Ay,{tab:"AuthenticationAndAuthorization",children:(0,r.jsxs)(o.Flex,{column:!0,gap:4,height:"100%",overflow:{vertical:"auto"},flex:"grow",padding:[2,4,0,4],...e,children:[(0,r.jsxs)(o.Flex,{alignItems:"center",justifyContent:"between",children:[(0,r.jsx)(o.TextBig,{margin:[1,0,3],children:"See the available single sign-on, authorization, and authentication integrations and configure the ones that your company supports."}),(0,r.jsx)(u,{showGrid:t,toggleLayout:n})]}),(0,r.jsx)(re,{showGrid:t}),(0,r.jsx)(o.Box,{as:"hr",height:"1px",width:"100%",margin:t?[-4,0,0,0]:[0],sx:{borderWidth:"1px 0px 0px 0px",borderColor:"borderSecondary",borderStyle:"solid"}}),(0,r.jsx)(Ce,{showGrid:t})]})})}},53746:(e,t,n)=>{n.d(t,{A:()=>s});var o=n(34646),i=n(24609),l=n(32052),r=n(1457),a=n(63956);const s=()=>{const e=(0,i.vt)(),t=(0,a.cP)(e),n=(0,a.Bc)();(0,l.A)((()=>({enabled:!!e,fetch:()=>(0,o.Zl)(e),onFail:e=>t({...r.ue,error:e?.response?.data||e}),onSettle:()=>t({loading:!1,loaded:!0}),onSuccess:e=>{t({...r.ue,items:e||[]})}})),[n,e])}},63956:(e,t,n)=>{n.d(t,{Bc:()=>u,Hy:()=>f,Xy:()=>p,cP:()=>x,dI:()=>m,nB:()=>h});var o=n(96540),i=n(52035),l=n(34843),r=n(84929),a=n(24609),s=n(1457),d=n(34646),c=n(57377);const u=()=>{const e=(0,a.vt)();return(0,l.md)((0,s.Rq)(e))},h=()=>{const e=(0,a.vt)(),t=(0,l.Xr)((0,s.Rq)(e));return(0,o.useCallback)((()=>t((e=>e+1))),[t])},g=(0,r.Iz)((e=>{let{id:t,key:n}=e;return(0,i.eU)((e=>{const o=e((0,s.oL)(t));return n?o[n]:o}),((e,o,i)=>{o((0,s.oL)(t),(e=>n?{...e,[n]:i}:{...e,...i}))}))}),c.Ay),x=(e,t)=>(0,l.Xr)(g({id:e,key:t})),p=e=>{const t=(0,a.vt)();return(0,l.md)(g({id:t,key:e}))},f=e=>(0,l.fp)((0,s.u)(e)),m=e=>{const t=(0,a.vt)(),[n,i]=f(t);return{integration:n,create:(0,o.useCallback)((function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return(0,d.lG)(t,{integrationID:e,...n})}),[t]),update:(0,o.useCallback)((function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return(0,d.ON)(e,t,n)}),[e,t]),remove:(0,o.useCallback)((()=>(0,d.Uj)(e,t).then((()=>(i(null),Promise.resolve())))),[e,t,i]),rotateToken:(0,o.useCallback)((()=>(0,d.lt)(e,t)),[e,t])}}}}]);