UNPKG

@boxyhq/react-ui

Version:

React UI components from BoxyHQ

1 lines 60.5 kB
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-CS5SeY3J.cjs"),v=require("react"),i=require("./index-DleagIor.cjs"),he=require("./index-CkmUXhUX.cjs"),De=(t,n)=>`boxyhq-${t}-${n}`,Ee=(t,n)=>{let x="";return x=De(t,n),x},Le="_container_1p7w3_2",Me="_label_1p7w3_8",Pe="_input_1p7w3_12",Te="_button_1p7w3_32",me={container:Le,label:Me,input:Pe,button:Te},be="sso",je={ssoIdentifier:"",inputLabel:"Tenant",placeholder:"",buttonText:"Sign-in with SSO"};function $e(t){var F,_,U,L,D,r,c,s;const[n,x]=v.useState(()=>je.ssoIdentifier),[E,I]=v.useState(()=>""),[g,u]=v.useState(()=>!1);function S(){return!!E}function N(){return!(n||t.ssoIdentifier)||g}function j(){return!t.ssoIdentifier}function h(){return Ee(be,"input")}function a(){return Ee(be,"span")}function o(){var l,m,C,y;return{container:e.cssClassAssembler((l=t.classNames)==null?void 0:l.container,me.container),label:e.cssClassAssembler((m=t.classNames)==null?void 0:m.label,me.label),input:e.cssClassAssembler((C=t.classNames)==null?void 0:C.input,me.input),button:e.cssClassAssembler((y=t.classNames)==null?void 0:y.button,me.button)}}function b(l){var m;I(""),x((m=l.currentTarget)==null?void 0:m.value)}function p(l){l.preventDefault(),u(!0);const m=(n||t.ssoIdentifier)??"";t.onSubmit({ssoIdentifier:m,cb:C=>{u(!1),C!=null&&C.error.message&&I(C.error.message)}})}return e.jsxRuntimeExports.jsxs("div",{style:(F=t.styles)==null?void 0:F.container,className:o().container,...(_=t.innerProps)==null?void 0:_.container,children:[j()?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("label",{htmlFor:h(),style:(U=t.styles)==null?void 0:U.label,className:o().label,...(L=t.innerProps)==null?void 0:L.label,children:t.inputLabel||je.inputLabel}),e.jsxRuntimeExports.jsx("input",{id:h(),value:n,placeholder:t.placeholder||je.placeholder,onInput:l=>b(l),style:(D=t.styles)==null?void 0:D.input,className:o().input,"aria-invalid":S(),"aria-describedby":a(),...(r=t.innerProps)==null?void 0:r.input}),S()?e.jsxRuntimeExports.jsx("span",{id:a(),children:E}):null]}):null,e.jsxRuntimeExports.jsx("button",{type:"button",disabled:N(),onClick:l=>p(l),style:(c=t.styles)==null?void 0:c.button,className:o().button,...(s=t.innerProps)==null?void 0:s.button,children:t.buttonText||je.buttonText})]})}const pe=async({formObj:t,isEditView:n,connectionIsSAML:x,connectionIsOIDC:E,callback:I,url:g})=>{const{rawMetadata:u,redirectUrl:S,oidcDiscoveryUrl:N,oidcMetadata:j,oidcClientId:h,oidcClientSecret:a,metadataUrl:o,...b}=t,p=window.btoa(u||""),F=await i.sendHTTPRequest(g,{method:n?"PATCH":"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...b,encodedRawMetadata:x?p:void 0,oidcDiscoveryUrl:E?N:void 0,oidcMetadata:E?j:void 0,oidcClientId:E?h:void 0,oidcClientSecret:E?a:void 0,redirectUrl:JSON.stringify(S),metadataUrl:x?o:void 0})});I(F)},Se=async({url:t,clientId:n,clientSecret:x,callback:E})=>{const I=new URLSearchParams({clientID:n,clientSecret:x}),g=await i.sendHTTPRequest(`${t}?${I}`,{method:"DELETE"});E(g)},qe="_h5_1dluy_3",He="_hint_1dluy_10",Ve="_formAction_1dluy_16",ze="_selectContainer_1dluy_21",T={h5:qe,hint:He,formAction:Ve,selectContainer:ze},Be="_separator_1r6oe_3",We={separator:Be};function X(t){return e.jsxRuntimeExports.jsx("div",{className:We.separator,children:t.text})}const Je="_a_wfblf_2",Xe="_button_wfblf_29",Ce={"sr-only":"_sr-only_wfblf_1",a:Je,button:Xe};function Re(t){function n(){return Ce.a+(t.variant?` ${Ce[t.variant]}`:"")+(t.cssClass?` ${t.cssClass}`:"")}return e.jsxRuntimeExports.jsx("a",{target:"_blank",href:t.href,className:n(),children:t.linkText})}const Ge={variant:"basic"},Ke={oidcConnection:{name:"",label:"",description:"",tenant:"",product:"",redirectUrl:[""],defaultRedirectUrl:"",oidcClientSecret:"",oidcClientId:"",oidcDiscoveryUrl:"","oidcMetadata.issuer":"","oidcMetadata.authorization_endpoint":"","oidcMetadata.token_endpoint":"","oidcMetadata.jwks_uri":"","oidcMetadata.userinfo_endpoint":"",sortOrder:""}};function Ie(t){var _,U,L,D;const[n,x]=v.useState(()=>Ke.oidcConnection),[E,I]=v.useState(()=>!1);function g(r){return{...n,...r}}function u(r){var m;const s=r.target.id,l=(m=r.currentTarget)==null?void 0:m.value;x(g({[s]:l}))}function S(r,c){x(g({[r]:c}))}function N(r){r.preventDefault();const c={};Object.entries(n).map(([s,l])=>{s.startsWith("oidcMetadata.")?(c.oidcMetadata===void 0&&(c.oidcMetadata={}),c.oidcMetadata[s.replace("oidcMetadata.","")]=l):s==="sortOrder"?l!==""&&(c[s]=+l):c[s]=l}),I(!0),pe({url:t.urls.post,formObj:c,connectionIsOIDC:!0,callback:async s=>{I(!1),s&&typeof s=="object"&&("error"in s?typeof t.errorCallback=="function"&&t.errorCallback(s.error.message):typeof t.successCallback=="function"&&t.successCallback({operation:"CREATE",connection:s,connectionIsOIDC:!0}))}})}function j(){var r,c,s,l,m,C,y,w,$;return{form:e.cssClassAssembler((r=t.classNames)==null?void 0:r.form,T.form),inputField:{label:(c=t.classNames)==null?void 0:c.label,input:(s=t.classNames)==null?void 0:s.input,container:(l=t.classNames)==null?void 0:l.fieldContainer},select:{label:(m=t.classNames)==null?void 0:m.label,select:(C=t.classNames)==null?void 0:C.select},textarea:{label:(y=t.classNames)==null?void 0:y.label,textarea:(w=t.classNames)==null?void 0:w.textarea,container:($=t.classNames)==null?void 0:$.fieldContainer}}}function h(){return t.variant||Ge.variant}function a(r){var c;return!!((c=t.excludeFields)!=null&&c.includes(r))}function o(r){var c,s;return r==="tenant"&&Array.isArray((c=t.defaults)==null?void 0:c.tenant)&&t.defaults.tenant.length===1?!0:!!((s=t.readOnlyFields)!=null&&s.includes(r))}function b(){var r;return Array.isArray((r=t.defaults)==null?void 0:r.tenant)&&t.defaults.tenant.length>1}function p(){var r,c;return Array.isArray((r=t.defaults)==null?void 0:r.tenant)?(c=t.defaults)==null?void 0:c.tenant.map(s=>({value:s,text:s})):[]}function F(){return t.displayHeader!==void 0?t.displayHeader:!0}return v.useEffect(()=>{if(t.defaults){const{forceAuthn:r,tenant:c,...s}=t.defaults,l=Array.isArray(c)?c[0]:c;x(g({...s,tenant:l}))}},[t.defaults]),e.jsxRuntimeExports.jsxs("div",{children:[F()?e.jsxRuntimeExports.jsx("h5",{className:T.h5,children:"Create SSO Connection"}):null,e.jsxRuntimeExports.jsxs("form",{method:"post",onSubmit:r=>N(r),className:j().form,children:[h()==="advanced"?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[a("name")?null:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(i.InputField,{label:"Connection name (Optional)",id:"name",placeholder:"MyApp",classNames:j().inputField,required:!1,readOnly:o("name"),value:n.name,handleInputChange:u}),e.jsxRuntimeExports.jsx(e.Spacer,{y:6})]}),a("label")?null:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(i.InputField,{label:"Connection label (Optional)",id:"label",placeholder:"An internal label to identify the connection",classNames:j().inputField,required:!1,readOnly:o("label"),value:n.label,handleInputChange:u}),e.jsxRuntimeExports.jsx(e.Spacer,{y:6})]}),a("description")?null:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(i.InputField,{label:"Description (Optional)",id:"description",placeholder:"A short description not more than 100 characters",classNames:j().inputField,required:!1,readOnly:o("description"),maxLength:100,value:n.description,handleInputChange:u}),e.jsxRuntimeExports.jsx(e.Spacer,{y:6})]}),a("tenant")?null:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[b()?null:e.jsxRuntimeExports.jsx(i.InputField,{label:"Tenant",id:"tenant",placeholder:"acme.com","aria-describedby":"tenant-hint",classNames:j().inputField,required:!0,readOnly:o("tenant"),value:n.tenant,handleInputChange:u}),b()?e.jsxRuntimeExports.jsx("div",{className:T.selectContainer,children:e.jsxRuntimeExports.jsx(i.Select,{label:"Tenant",name:"tenant",id:"tenant",options:p(),classNames:j().select,selectedValue:n.tenant,handleChange:u})}):null,e.jsxRuntimeExports.jsxs("div",{id:"tenant-hint",className:T.hint,children:["Unique identifier for the tenant to which this SSO connection is linked.See",e.jsxRuntimeExports.jsx(e.Spacer,{x:1}),e.jsxRuntimeExports.jsx(Re,{href:"https://boxyhq.com/guides/jackson/configuring-saml-sso#sso-connection-identifier",linkText:"SSO connection identifier."})]}),e.jsxRuntimeExports.jsx(e.Spacer,{y:6})]}),a("product")?null:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(i.InputField,{label:"Product",id:"product",placeholder:"demo","aria-describedby":"product-hint",classNames:j().inputField,required:!0,readOnly:o("product"),value:n.product,handleInputChange:u}),e.jsxRuntimeExports.jsx("div",{id:"product-hint",className:T.hint,children:"Identifies the product/app to which this SSO connection is linked."}),e.jsxRuntimeExports.jsx(e.Spacer,{y:6})]}),a("redirectUrl")?null:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(he.ItemList,{inputType:"url",label:"Allowed redirect URLs",fieldName:"redirectUrl",currentlist:n.redirectUrl,handleItemListUpdate:S,classNames:j().inputField}),e.jsxRuntimeExports.jsx("div",{id:"redirectUrl-hint",className:T.hint,children:"URL(s) to redirect the user to after login. Only the URLs in this list are allowed in the OAuth flow."}),e.jsxRuntimeExports.jsx(e.Spacer,{y:6})]}),a("defaultRedirectUrl")?null:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(i.InputField,{label:"Default redirect URL",id:"defaultRedirectUrl","aria-describedby":"defaultRedirectUrl-hint",placeholder:"http://localhost:3366",type:"url",classNames:j().inputField,required:!0,readOnly:o("defaultRedirectUrl"),value:n.defaultRedirectUrl,handleInputChange:u}),e.jsxRuntimeExports.jsx("div",{id:"defaultRedirectUrl-hint",className:T.hint,children:"URL to redirect the user to after an IdP initiated login."}),e.jsxRuntimeExports.jsx(e.Spacer,{y:6})]}),e.jsxRuntimeExports.jsx(X,{text:"OIDC Provider Metadata"}),e.jsxRuntimeExports.jsx(e.Spacer,{y:6})]}):null,e.jsxRuntimeExports.jsx(i.InputField,{label:"Client ID",id:"oidcClientId","aria-describedby":"oidc-clientid-hint",classNames:j().inputField,value:n.oidcClientId,handleInputChange:u}),e.jsxRuntimeExports.jsx("div",{id:"oidc-clientid-hint",className:T.hint,children:"ClientId of the app created on the OIDC Provider."}),e.jsxRuntimeExports.jsx(e.Spacer,{y:6}),e.jsxRuntimeExports.jsx(i.SecretInputFormControl,{label:"Client Secret",id:"oidcClientSecret","aria-describedby":"oidc-clientsecret-hint",readOnly:!1,classNames:j().inputField,handleChange:u,value:n.oidcClientSecret,required:!0}),e.jsxRuntimeExports.jsx("div",{id:"oidc-clientsecret-hint",className:T.hint,children:"ClientSecret of the app created on the OIDC Provider."}),e.jsxRuntimeExports.jsx(e.Spacer,{y:6}),e.jsxRuntimeExports.jsx(i.InputField,{id:"oidcDiscoveryUrl",type:"url",label:"Well-known URL of OpenID Provider",placeholder:"https://example.com/.well-known/openid-configuration","aria-describedby":"oidc-metadata-hint",classNames:j().inputField,value:n.oidcDiscoveryUrl,handleInputChange:u}),e.jsxRuntimeExports.jsx("div",{id:"oidc-metadata-hint",className:T.hint,children:"Enter the well known discovery path of OpenID provider or manually enter the OpenId provider metadata below."}),e.jsxRuntimeExports.jsx(e.Spacer,{y:6}),e.jsxRuntimeExports.jsx(X,{text:"OR"}),e.jsxRuntimeExports.jsx(e.Spacer,{y:6}),e.jsxRuntimeExports.jsx(i.InputField,{id:"oidcMetadata.issuer",label:"Issuer",placeholder:"https://example.com",classNames:j().inputField,value:n["oidcMetadata.issuer"],handleInputChange:u}),e.jsxRuntimeExports.jsx(e.Spacer,{y:6}),e.jsxRuntimeExports.jsx(i.InputField,{id:"oidcMetadata.authorization_endpoint",type:"url",label:"Authorization Endpoint",placeholder:"https://example.com/oauth/authorize",classNames:j().inputField,value:n["oidcMetadata.authorization_endpoint"],handleInputChange:u}),e.jsxRuntimeExports.jsx(e.Spacer,{y:6}),e.jsxRuntimeExports.jsx(i.InputField,{id:"oidcMetadata.token_endpoint",type:"url",label:"Token endpoint",placeholder:"https://example.com/oauth/token",classNames:j().inputField,value:n["oidcMetadata.token_endpoint"],handleInputChange:u}),e.jsxRuntimeExports.jsx(e.Spacer,{y:6}),e.jsxRuntimeExports.jsx(i.InputField,{id:"oidcMetadata.jwks_uri",type:"url",label:"JWKS URI",placeholder:"https://example.com/.well-known/jwks.json",classNames:j().inputField,value:n["oidcMetadata.jwks_uri"],handleInputChange:u}),e.jsxRuntimeExports.jsx(e.Spacer,{y:6}),e.jsxRuntimeExports.jsx(i.InputField,{id:"oidcMetadata.userinfo_endpoint",type:"url",label:"UserInfo endpoint",placeholder:"https://example.com/userinfo",autoComplete:"one-time-code",classNames:j().inputField,value:n["oidcMetadata.userinfo_endpoint"],handleInputChange:u}),e.jsxRuntimeExports.jsx(e.Spacer,{y:6}),h()==="advanced"?e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:a("sortOrder")?null:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(i.InputField,{label:"Sort Order",id:"sortOrder",type:"number",min:"0",placeholder:"10",classNames:j().inputField,readOnly:o("sortOrder"),value:n.sortOrder,handleInputChange:u}),e.jsxRuntimeExports.jsx("div",{id:"sortOrder-hint",className:T.hint,children:"Connections will be sorted (in a listing view like IdP Selection) using this setting. Higher values will be displayed first."})]})}):null,e.jsxRuntimeExports.jsx(e.Spacer,{y:6}),e.jsxRuntimeExports.jsxs("div",{className:T.formAction,children:[typeof t.cancelCallback=="function"?e.jsxRuntimeExports.jsx(e.Button,{type:"button",name:"Cancel",variant:"outline",handleClick:t.cancelCallback,classNames:(U=(_=t.classNames)==null?void 0:_.button)==null?void 0:U.cancel}):null,e.jsxRuntimeExports.jsx(e.Button,{type:"submit",name:"Save",classNames:(D=(L=t.classNames)==null?void 0:L.button)==null?void 0:D.ctoa,isLoading:E})]})]})]})}const Ye="_h5_1se5f_3",Qe="_hint_1se5f_10",Ze="_formAction_1se5f_16",et="_selectContainer_1se5f_21",H={h5:Ye,hint:Qe,formAction:Ze,selectContainer:et};function Ne(t){function n(){const{id:E,label:I,value:g,classNames:u,handleInputChange:S,...N}=t;return N}function x(){var E,I,g;return{container:e.cssClassAssembler((E=t.classNames)==null?void 0:E.container,e.styles.container),textarea:e.cssClassAssembler((I=t.classNames)==null?void 0:I.textarea,e.styles.textarea),label:e.cssClassAssembler((g=t.classNames)==null?void 0:g.label,e.styles.label)}}return e.jsxRuntimeExports.jsxs("div",{className:e.styles.container,children:[e.jsxRuntimeExports.jsx("label",{htmlFor:t.id,className:e.styles.label,children:t.label}),e.jsxRuntimeExports.jsx(e.Spacer,{y:2}),e.jsxRuntimeExports.jsx("textarea",{id:t.id,value:t.value,className:x().textarea,onChange:E=>t.handleInputChange(E),...n()})]})}const tt={variant:"basic"},nt={samlConnection:{name:"",label:"",description:"",tenant:"",product:"",redirectUrl:[""],defaultRedirectUrl:"",rawMetadata:"",metadataUrl:"",sortOrder:"",forceAuthn:!1,acsUrlOverride:""}};function _e(t){var _,U,L,D;const[n,x]=v.useState(()=>nt.samlConnection);function E(r){return{...n,...r}}const[I,g]=v.useState(()=>!1);function u(r){const c=r.target,s=c.id,l=s!=="forceAuthn"?c.value:c.checked;x(E({[s]:l}))}function S(r,c){x(E({[r]:c}))}function N(r){r.preventDefault(),g(!0);const{sortOrder:c,...s}=n,l=c===""?s:{...n,sortOrder:+c};pe({url:t.urls.post,formObj:l,connectionIsSAML:!0,callback:async m=>{g(!1),m&&typeof m=="object"&&("error"in m?typeof t.errorCallback=="function"&&t.errorCallback(m.error.message):typeof t.successCallback=="function"&&t.successCallback({operation:"CREATE",connection:m,connectionIsSAML:!0}))}})}function j(){return t.variant||tt.variant}function h(){var r,c,s,l,m,C,y,w,$;return{form:e.cssClassAssembler((r=t.classNames)==null?void 0:r.form,H.form),inputField:{label:(c=t.classNames)==null?void 0:c.label,input:(s=t.classNames)==null?void 0:s.input,container:(l=t.classNames)==null?void 0:l.fieldContainer},select:{label:(m=t.classNames)==null?void 0:m.label,select:(C=t.classNames)==null?void 0:C.select},textarea:{label:(y=t.classNames)==null?void 0:y.label,textarea:(w=t.classNames)==null?void 0:w.textarea,container:($=t.classNames)==null?void 0:$.fieldContainer}}}function a(r){var c;return!!((c=t.excludeFields)!=null&&c.includes(r))}function o(r){var c,s;return r==="tenant"&&Array.isArray((c=t.defaults)==null?void 0:c.tenant)&&t.defaults.tenant.length===1?!0:!!((s=t.readOnlyFields)!=null&&s.includes(r))}function b(){var r;return Array.isArray((r=t.defaults)==null?void 0:r.tenant)&&t.defaults.tenant.length>1}function p(){var r,c;return Array.isArray((r=t.defaults)==null?void 0:r.tenant)?(c=t.defaults)==null?void 0:c.tenant.map(s=>({value:s,text:s})):[]}function F(){return t.displayHeader!==void 0?t.displayHeader:!0}return v.useEffect(()=>{if(t.defaults){const r=Array.isArray(t.defaults.tenant)?t.defaults.tenant[0]:t.defaults.tenant;x(E({...t.defaults,tenant:r}))}},[t.defaults]),e.jsxRuntimeExports.jsxs("div",{children:[F()?e.jsxRuntimeExports.jsx("h5",{className:H.h5,children:"Create SSO Connection"}):null,e.jsxRuntimeExports.jsxs("form",{method:"post",onSubmit:r=>N(r),className:h().form,children:[j()==="advanced"?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[a("name")?null:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(i.InputField,{label:"Connection name (Optional)",id:"name",placeholder:"MyApp",classNames:h().inputField,required:!1,readOnly:o("name"),value:n.name,handleInputChange:u}),e.jsxRuntimeExports.jsx(e.Spacer,{y:6})]}),a("label")?null:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(i.InputField,{label:"Connection label (Optional)",id:"label",placeholder:"An internal label to identify the connection",classNames:h().inputField,required:!1,readOnly:o("label"),value:n.label,handleInputChange:u}),e.jsxRuntimeExports.jsx(e.Spacer,{y:6})]}),a("description")?null:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(i.InputField,{label:"Description (Optional)",id:"description",placeholder:"A short description not more than 100 characters",classNames:h().inputField,required:!1,readOnly:o("description"),maxLength:100,value:n.description,handleInputChange:u}),e.jsxRuntimeExports.jsx(e.Spacer,{y:6})]}),a("tenant")?null:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[b()?null:e.jsxRuntimeExports.jsx(i.InputField,{label:"Tenant",id:"tenant",placeholder:"acme.com","aria-describedby":"tenant-hint",classNames:h().inputField,required:!0,readOnly:o("tenant"),value:n.tenant,handleInputChange:u}),b()?e.jsxRuntimeExports.jsx("div",{className:H.selectContainer,children:e.jsxRuntimeExports.jsx(i.Select,{label:"Tenant",name:"tenant",id:"tenant",options:p(),classNames:h().select,selectedValue:n.tenant,handleChange:u})}):null,e.jsxRuntimeExports.jsxs("div",{id:"tenant-hint",className:H.hint,children:["Unique identifier for the tenant to which this SSO connection is linked.See",e.jsxRuntimeExports.jsx(e.Spacer,{x:1}),e.jsxRuntimeExports.jsx(Re,{href:"https://boxyhq.com/guides/jackson/configuring-saml-sso#sso-connection-identifier",linkText:"SSO connection identifier."})]}),e.jsxRuntimeExports.jsx(e.Spacer,{y:6})]}),a("product")?null:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(i.InputField,{label:"Product",id:"product",placeholder:"demo","aria-describedby":"product-hint",classNames:h().inputField,required:!0,readOnly:o("product"),value:n.product,handleInputChange:u}),e.jsxRuntimeExports.jsx("div",{id:"product-hint",className:H.hint,children:"Identifies the product/app to which this SSO connection is linked."}),e.jsxRuntimeExports.jsx(e.Spacer,{y:6})]}),a("redirectUrl")?null:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(he.ItemList,{inputType:"url",label:"Allowed redirect URLs",fieldName:"redirectUrl",currentlist:n.redirectUrl,handleItemListUpdate:S,classNames:h().inputField}),e.jsxRuntimeExports.jsx("div",{id:"redirectUrl-hint",className:H.hint,children:"URL(s) to redirect the user to after login. Only the URLs in this list are allowed in the OAuth flow."}),e.jsxRuntimeExports.jsx(e.Spacer,{y:6})]}),a("defaultRedirectUrl")?null:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(i.InputField,{label:"Default redirect URL",id:"defaultRedirectUrl","aria-describedby":"defaultRedirectUrl-hint",placeholder:"http://localhost:3366/login/saml",type:"url",classNames:h().inputField,required:!0,readOnly:o("defaultRedirectUrl"),value:n.defaultRedirectUrl,handleInputChange:u}),e.jsxRuntimeExports.jsx("div",{id:"defaultRedirectUrl-hint",className:H.hint,children:"URL to redirect the user to after an IdP initiated SAML login."})]}),e.jsxRuntimeExports.jsx(e.Spacer,{y:6}),e.jsxRuntimeExports.jsx(X,{text:"SAML Provider Metadata"}),e.jsxRuntimeExports.jsx(e.Spacer,{y:6})]}):null,e.jsxRuntimeExports.jsx(Ne,{label:"Raw IdP XML",id:"rawMetadata","aria-describedby":"xml-metadata-hint",placeholder:"Paste the raw XML here",classNames:h().textarea,required:n.metadataUrl==="",value:n.rawMetadata,handleInputChange:u}),e.jsxRuntimeExports.jsx("div",{id:"xml-metadata-hint",className:H.hint,children:"Paste the raw XML metadata obtained from SAML provider or enter the metadata URL below."}),e.jsxRuntimeExports.jsx(e.Spacer,{y:6}),e.jsxRuntimeExports.jsx(X,{text:"OR"}),e.jsxRuntimeExports.jsx(e.Spacer,{y:6}),e.jsxRuntimeExports.jsx(i.InputField,{label:"Metadata URL",id:"metadataUrl",type:"url",placeholder:"Paste the Metadata URL here",classNames:h().inputField,required:n.rawMetadata==="",value:n.metadataUrl,handleInputChange:u}),e.jsxRuntimeExports.jsx(e.Spacer,{y:6}),j()==="advanced"?e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:a("sortOrder")?null:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(i.InputField,{label:"Sort Order",id:"sortOrder",type:"number",min:"0",placeholder:"10",classNames:h().inputField,readOnly:o("sortOrder"),value:n.sortOrder,handleInputChange:u}),e.jsxRuntimeExports.jsx("div",{id:"sortOrder-hint",className:H.hint,children:"Connections will be sorted (in a listing view like IdP Selection) using this setting. Higher values will be displayed first."})]})}):null,e.jsxRuntimeExports.jsx(e.Spacer,{y:6}),j()==="advanced"?e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:a("acsUrlOverride")?null:e.jsxRuntimeExports.jsx(i.InputField,{label:"ACS URL Override",id:"acsUrlOverride",placeholder:"https://yourcompany.com/app/saml/acs",type:"url",classNames:h().inputField,value:n.acsUrlOverride,handleInputChange:u})}):null,e.jsxRuntimeExports.jsx(e.Spacer,{y:6}),j()==="advanced"?e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:a("forceAuthn")?null:e.jsxRuntimeExports.jsx(i.Checkbox,{label:"Force Authentication",name:"forceAuthn",id:"forceAuthn",checked:n.forceAuthn,handleChange:u})}):null,e.jsxRuntimeExports.jsx(e.Spacer,{y:6}),e.jsxRuntimeExports.jsxs("div",{className:H.formAction,children:[typeof t.cancelCallback=="function"?e.jsxRuntimeExports.jsx(e.Button,{type:"button",name:"Cancel",variant:"outline",handleClick:t.cancelCallback,classNames:(U=(_=t.classNames)==null?void 0:_.button)==null?void 0:U.cancel}):null,e.jsxRuntimeExports.jsx(e.Button,{type:"submit",name:"Save",classNames:(D=(L=t.classNames)==null?void 0:L.button)==null?void 0:D.ctoa,isLoading:I})]})]})]})}const st="_container_1c3hr_1",at="_inputs_1c3hr_6",fe={container:st,inputs:at};function it(t){function n(){return t.label.replace(/ /g,"")}function x(){return t.orientation||"horizontal"}return e.jsxRuntimeExports.jsxs("div",{role:"radiogroup",className:fe.container,"aria-labelledby":n(),"aria-orientation":x(),children:[e.jsxRuntimeExports.jsx("div",{className:fe.label,id:n(),children:t.label}),x()==="horizontal"?e.jsxRuntimeExports.jsx(e.Spacer,{x:1}):null,x()==="horizontal"?e.jsxRuntimeExports.jsx(e.Spacer,{y:1}):null,e.jsxRuntimeExports.jsx("div",{className:fe.inputs,children:t.children})]})}const lt="_radioDiv_eeujj_3",rt="_radio_eeujj_3",ye={radioDiv:lt,radio:rt};function ve(t){function n(){return t.value.replace(/ /g,"")}return e.jsxRuntimeExports.jsxs("div",{className:ye.radioDiv,children:[e.jsxRuntimeExports.jsx("input",{type:"radio",value:t.value,checked:t.checked,name:t.name,id:n(),className:ye.radio,onChange:x=>t.handleInputChange(x)}),e.jsxRuntimeExports.jsx(e.Spacer,{x:1}),e.jsxRuntimeExports.jsx("label",{htmlFor:n(),children:t.children})]})}function Fe(t){var S,N,j,h,a,o;const[n,x]=v.useState(()=>"saml");function E(){return n==="saml"}function I(){return n==="oidc"}function g(){var b,p;return{...t.defaults,tenant:((b=t.defaults)==null?void 0:b.tenants)||((p=t.defaults)==null?void 0:p.tenant)}}function u(b){x(b.target.value)}return e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsxs(it,{label:"Select SSO type:",children:[e.jsxRuntimeExports.jsx(ve,{name:"connection",value:"saml",checked:n==="saml",handleInputChange:u,children:"SAML"}),e.jsxRuntimeExports.jsx(ve,{name:"connection",value:"oidc",checked:n==="oidc",handleInputChange:u,children:"OIDC"})]}),e.jsxRuntimeExports.jsx(e.Spacer,{y:4}),E()?e.jsxRuntimeExports.jsx(_e,{urls:t.urls,excludeFields:(S=t.excludeFields)==null?void 0:S.saml,readOnlyFields:(N=t.readOnlyFields)==null?void 0:N.saml,classNames:t.classNames,variant:(j=t.variant)==null?void 0:j.saml,errorCallback:t.errorCallback,successCallback:t.successCallback,cancelCallback:t.cancelCallback,displayHeader:!1,defaults:g()}):null,I()?e.jsxRuntimeExports.jsx(Ie,{urls:t.urls,excludeFields:(h=t.excludeFields)==null?void 0:h.oidc,readOnlyFields:(a=t.readOnlyFields)==null?void 0:a.oidc,classNames:t.classNames,variant:(o=t.variant)==null?void 0:o.oidc,errorCallback:t.errorCallback,successCallback:t.successCallback,cancelCallback:t.cancelCallback,displayHeader:!1,defaults:g()}):null]})}const ct={connectionListData:[]};function ke(t){var c;const[n,x]=v.useState(()=>ct.connectionListData),[E,I]=v.useState(()=>!0),[g,u]=v.useState(()=>({})),[S,N]=v.useState(()=>!1),[j,h]=v.useState(()=>"");function a(){return t.urls.get}function o(){var s;return((s=t.paginate)==null?void 0:s.itemsPerPage)!==void 0}function b(){return(t.cols||["name","provider","tenant","product","type","status","actions"]).map(s=>s==="status"?{name:"status",badge:{position:"surround",variantSelector(l){let m;return l.deactivated&&(m="warning"),l.deactivated||(m="success"),m}}}:s==="name"?{name:"name",badge:{position:"right",badgeText:"System",variant:"info",shouldDisplayBadge(l){return l.isSystemSSO}}}:s)}function p(s){return"idpMetadata"in s?s.idpMetadata.friendlyProviderName||s.idpMetadata.provider:"oidcProvider"in s?s.oidcProvider.friendlyProviderName||s.oidcProvider.provider:"Unknown"}function F(){return[{icon:"PencilIcon",label:"Edit",handleClick:s=>t.handleActionClick("edit",s)}]}function _(s){let l=s.getUrl;const[m,C]=l.split("?"),y=new URLSearchParams(C);if(s.tenant)if(Array.isArray(s.tenant))for(const w of s.tenant)y.append("tenant",w);else y.set("tenant",s.tenant);return s.product&&y.set("product",s.product),s.pageToken&&y.set("pageToken",s.pageToken),s.displaySorted&&y.set("sort","true"),(s==null?void 0:s.offset)!==void 0&&(y.set("pageOffset",`${s.offset}`),y.set("pageLimit",`${s.limit}`)),y.toString()?`${m}?${y}`:l}function U(){return _({getUrl:a(),tenant:t.tenant,product:t.product,displaySorted:t.displaySorted})}function L(s,l){return{...g,[s]:l}}async function D(s){I(!0);const l=await i.sendHTTPRequest(s);if(I(!1),l&&typeof l=="object")if("error"in l&&l.error)N(!0),h(l.error.message),typeof t.errorCallback=="function"&&t.errorCallback(l.error.message);else{const m=typeof l=="object"&&"pageToken"in l,C=m?l.data:l;if(Array.isArray(C)){const y=C.map(w=>({...w,provider:p(w),type:"oidcProvider"in w?"OIDC":"SAML",status:w.deactivated?"Inactive":"Active",isSystemSSO:w.isSystemSSO}));x(y),typeof t.handleListFetchComplete=="function"&&t.handleListFetchComplete(y)}if(m)return l.pageToken}}async function r(s){const l=await D(_({getUrl:U(),...s}));l&&u(L(s.offset,l))}return v.useEffect(()=>{o()||D(U())},[U(),o()]),e.jsxRuntimeExports.jsxs(i.LoadingContainer,{isBusy:E,children:[o()?e.jsxRuntimeExports.jsx(i.Paginate,{itemsPerPage:t.paginate.itemsPerPage,currentPageItemsCount:n.length,handlePageChange:(c=t.paginate)==null?void 0:c.handlePageChange,reFetch:r,pageTokenMap:g,children:e.jsxRuntimeExports.jsx(i.PaginatedTable,{emptyStateMessage:"No connections found.",cols:b(),data:n,actions:F(),showErrorComponent:S,errorMessage:j,tableProps:t.tableProps})}):null,o()?null:e.jsxRuntimeExports.jsx(i.NonPaginatedTable,{emptyStateMessage:"No connections found.",cols:b(),data:n,actions:F(),showErrorComponent:S,errorMessage:j,tableProps:t.tableProps})]})}const ot="_container_1xdqq_1",ut={container:ot};function Oe(t){var h;const[n,x]=v.useState(()=>!1);function E(){return t.connection.deactivated?"Inactive":"Active"}function I(){return t.connection.deactivated?"activate":"deactivate"}function g(){x(!0)}function u(){x(!1)}function S(){j(!t.connection.deactivated)}function N(){var a;return{container:e.cssClassAssembler((a=t.classNames)==null?void 0:a.container,ut.container)}}function j(a){async function o(){const b={clientID:t.connection.clientID,clientSecret:t.connection.clientSecret,tenant:t.connection.tenant,product:t.connection.product,deactivated:a},p="idpMetadata"in t.connection,F="oidcProvider"in t.connection;p?b.isSAML=!0:F&&(b.isOIDC=!0);const _=await i.sendHTTPRequest(t.urls.patch,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)});x(!1),_!=null&&_.error?typeof t.errorCallback=="function"&&t.errorCallback(_.error.message):typeof t.successCallback=="function"&&t.successCallback({operation:"UPDATE",connectionIsSAML:p,connectionIsOIDC:F})}o()}return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:t.connection!==void 0||t.connection!==null?e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsxs("div",{className:N().container,children:[n?e.jsxRuntimeExports.jsx(i.ConfirmationPrompt,{ctoaVariant:t.connection.deactivated?"primary":"destructive",classNames:(h=t.classNames)==null?void 0:h.confirmationPrompt,cancelCallback:u,confirmationCallback:S,promptMessage:`Do you want to ${I()} the connection?`}):null,n?null:e.jsxRuntimeExports.jsx(i.ToggleSwitch,{label:E(),handleChange:g,checked:!t.connection.deactivated,disabled:n})]})}):null})}const dt="_label_1wo5i_1",xt="_formDiv_1wo5i_8",mt="_headingContainer_1wo5i_14",jt="_h5_1wo5i_25",ht="_section_1wo5i_32",pt="_info_1wo5i_44",ft="_sectionHeading_1wo5i_54",Rt="_sectionPara_1wo5i_59",Et="_formAction_1wo5i_67",bt="_hint_1wo5i_72",P={label:dt,formDiv:xt,headingContainer:mt,h5:jt,section:ht,info:pt,sectionHeading:ft,sectionPara:Rt,formAction:Et,hint:bt},Ct="_container_hbehf_3",yt="_vertical_hbehf_13",vt="_title_hbehf_17",gt="_body_hbehf_26",St="_info_hbehf_31",It="_success_hbehf_35",Nt="_svg_hbehf_39",J={"sr-only":"_sr-only_hbehf_1",container:Ct,vertical:yt,title:vt,body:gt,info:St,success:It,svg:Nt};function Ae(t){function n(){return t.variant?" "+J[t.variant]:""}function x(){return t.arrangement==="vertical"?" "+J.vertical:""}function E(){return typeof t.displayIcon=="boolean"?t.displayIcon:!0}return e.jsxRuntimeExports.jsxs("article",{className:`${J.container}${n()}${x()}`,children:[t.title?e.jsxRuntimeExports.jsxs("h3",{className:J.title,children:[E()?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[t.variant==="success"?e.jsxRuntimeExports.jsx(e.CheckMarkIcon,{svgAttrs:{class:J.svg}}):null,t.variant==="info"?e.jsxRuntimeExports.jsx(e.InfoIcon,{svgAttrs:{class:J.svg}}):null]}):null,t.title]}):null,e.jsxRuntimeExports.jsx("div",{className:J.body,children:t.children})]})}const _t={name:"",tenant:"",product:"",description:"",redirectUrl:[""],defaultRedirectUrl:"",oidcClientSecret:"",oidcClientId:"",oidcDiscoveryUrl:"","oidcMetadata.issuer":"","oidcMetadata.authorization_endpoint":"","oidcMetadata.token_endpoint":"","oidcMetadata.jwks_uri":"","oidcMetadata.userinfo_endpoint":""};function Ue(t){var s,l,m,C,y,w,$,G,K,Y,Q,Z,ee,te,ne,se,ae,ie,le,re,ce,oe,ue,de,xe,k;const[n,x]=v.useState(()=>_t),[E,I]=v.useState(()=>!0),[g,u]=v.useState(()=>!1),[S,N]=v.useState(()=>!1);function j(){N(!S)}function h(){return t.variant||"basic"}function a(){var f,R,d,A,q,V,z,B,O;return{formDiv:e.cssClassAssembler((f=t.classNames)==null?void 0:f.formDiv,P.formDiv),label:e.cssClassAssembler((R=t.classNames)==null?void 0:R.label,P.label),inputField:{label:(d=t.classNames)==null?void 0:d.label,input:(A=t.classNames)==null?void 0:A.input,container:(q=t.classNames)==null?void 0:q.fieldContainer},textarea:{label:(V=t.classNames)==null?void 0:V.label,textarea:(z=t.classNames)==null?void 0:z.textarea,container:(B=t.classNames)==null?void 0:B.fieldContainer},section:e.cssClassAssembler((O=t.classNames)==null?void 0:O.section,P.section)}}function o(f){var R;return!!((R=t.excludeFields)!=null&&R.includes(f))}function b(f){return{...n,...f}}function p(f){var q;const d=f.target.id,A=(q=f.currentTarget)==null?void 0:q.value;x(b({[d]:A}))}function F(f,R){x(b({[f]:R}))}function _(){x({...n,"oidcMetadata.issuer":"","oidcMetadata.authorization_endpoint":"","oidcMetadata.token_endpoint":"","oidcMetadata.jwks_uri":"","oidcMetadata.userinfo_endpoint":""})}function U(f){f.preventDefault();const R={connectionIsOIDC:!0};Object.entries(n).map(([d,A])=>{d.startsWith("oidcMetadata.")?(R.oidcMetadata===void 0&&(R.oidcMetadata={}),R.oidcMetadata[d.replace("oidcMetadata.","")]=A):d==="sortOrder"?A!==""&&(R[d]=+A):R[d]=A}),u(!0),pe({url:t.urls.patch,isEditView:!0,formObj:R,connectionIsOIDC:!0,callback:async d=>{u(!1),d!=null&&d.error?typeof t.errorCallback=="function"&&t.errorCallback(d.error.message):(n.oidcDiscoveryUrl&&_(),typeof t.successCallback=="function"&&t.successCallback({operation:"UPDATE",connection:R,connectionIsOIDC:!0}))}})}function L(f){f.preventDefault(),Se({url:t.urls.delete,clientId:n.clientID,clientSecret:n.clientSecret,callback:async R=>{R!=null&&R.error?typeof t.errorCallback=="function"&&t.errorCallback(R.error.message):typeof t.successCallback=="function"&&t.successCallback({operation:"DELETE",connectionIsOIDC:!0})}})}function D(){return t.displayHeader!==void 0?t.displayHeader:!0}function r(){return t.displayInfo!==void 0?t.displayInfo:!0}function c(){return t.urls.get}return v.useEffect(()=>{async function f(R){var A,q,V,z,B;const d=await i.sendHTTPRequest(R);if(I(!1),d&&typeof d=="object"){if("error"in d&&d.error)typeof t.errorCallback=="function"&&t.errorCallback(d.error.message);else if(Array.isArray(d)){const O=d[0];O&&x({...O,name:O.name||"",label:O.label||"",tenant:O.tenant||"",product:O.product||"",description:O.description||"",redirectUrl:O.redirectUrl,defaultRedirectUrl:O.defaultRedirectUrl,oidcClientId:O.oidcProvider.clientId||"",oidcClientSecret:O.oidcProvider.clientSecret||"",oidcDiscoveryUrl:O.oidcProvider.discoveryUrl||"","oidcMetadata.issuer":((A=O.oidcProvider.metadata)==null?void 0:A.issuer)||"","oidcMetadata.authorization_endpoint":((q=O.oidcProvider.metadata)==null?void 0:q.authorization_endpoint)||"","oidcMetadata.token_endpoint":((V=O.oidcProvider.metadata)==null?void 0:V.token_endpoint)||"","oidcMetadata.jwks_uri":((z=O.oidcProvider.metadata)==null?void 0:z.jwks_uri)||"","oidcMetadata.userinfo_endpoint":((B=O.oidcProvider.metadata)==null?void 0:B.userinfo_endpoint)||"",sortOrder:O.sortOrder??""})}}}f(c())},[c()]),e.jsxRuntimeExports.jsx(i.LoadingContainer,{isBusy:E,children:e.jsxRuntimeExports.jsxs("div",{className:a().formDiv,children:[e.jsxRuntimeExports.jsxs("div",{className:P.headingContainer,children:[D()?e.jsxRuntimeExports.jsx("h5",{className:P.h5,children:"Edit SSO Connection"}):null,e.jsxRuntimeExports.jsx(Oe,{connection:n,urls:{patch:t.urls.patch},classNames:{confirmationPrompt:{button:{ctoa:`${(m=(l=(s=t.classNames)==null?void 0:s.confirmationPrompt)==null?void 0:l.button)==null?void 0:m.ctoa} ${n.deactivated?(y=(C=t.classNames)==null?void 0:C.button)==null?void 0:y.ctoa:($=(w=t.classNames)==null?void 0:w.button)==null?void 0:$.destructive}`.trim(),cancel:(Y=(K=(G=t.classNames)==null?void 0:G.confirmationPrompt)==null?void 0:K.button)==null?void 0:Y.cancel}}},errorCallback:t.errorCallback,successCallback:t.successCallback})]}),e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsxs("form",{method:"post",onSubmit:f=>U(f),children:[h()==="advanced"?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[o("name")?null:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(i.InputField,{label:"Connection name (Optional)",id:"name",placeholder:"MyApp",classNames:a().inputField,required:!1,value:n.name||"",handleInputChange:p}),e.jsxRuntimeExports.jsx(e.Spacer,{y:6})]}),o("label")?null:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(i.InputField,{label:"Connection label (Optional)",id:"label",placeholder:"An internal label to identify the connection",classNames:a().inputField,required:!1,value:n.label,handleInputChange:p}),e.jsxRuntimeExports.jsx(e.Spacer,{y:6})]}),o("description")?null:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(i.InputField,{label:"Description (Optional)",id:"description",placeholder:"A short description not more than 100 characters",classNames:a().inputField,required:!1,maxLength:100,value:n.description||"",handleInputChange:p}),e.jsxRuntimeExports.jsx(e.Spacer,{y:6})]}),o("redirectUrl")?null:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(he.ItemList,{inputType:"url",label:"Allowed redirect URLs",fieldName:"redirectUrl",currentlist:n.redirectUrl,handleItemListUpdate:F,classNames:a().inputField}),e.jsxRuntimeExports.jsx("div",{id:"redirectUrl-hint",className:P.hint,children:"URL(s) to redirect the user to after login. Only the URLs in this list are allowed in the OAuth flow."}),e.jsxRuntimeExports.jsx(e.Spacer,{y:6})]}),o("defaultRedirectUrl")?null:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(i.InputField,{label:"Default redirect URL",id:"defaultRedirectUrl","aria-describedby":"defaultRedirectUrl-hint",placeholder:"http://localhost:3366/login/saml",type:"url",classNames:a().inputField,required:!0,value:n.defaultRedirectUrl||"",handleInputChange:p}),e.jsxRuntimeExports.jsx("div",{id:"defaultRedirectUrl-hint",className:P.hint,children:"URL to redirect the user to after an IdP initiated login."}),e.jsxRuntimeExports.jsx(e.Spacer,{y:6})]})]}):null,e.jsxRuntimeExports.jsx(i.InputField,{label:"Client ID [OIDC Provider]",id:"oidcClientId","aria-describedby":"oidc-clientid-hint",required:!0,readOnly:!0,classNames:a().inputField,value:n.oidcClientId||""}),e.jsxRuntimeExports.jsx(e.Spacer,{y:6}),e.jsxRuntimeExports.jsx(i.SecretInputFormControl,{label:"Client Secret [OIDC Provider]",id:"oidcClientSecret",classNames:{input:(Q=t.classNames)==null?void 0:Q.secretInput},value:n.oidcClientSecret,required:!0,readOnly:!1,copyDoneCallback:t.successCallback,handleChange:p}),e.jsxRuntimeExports.jsx(e.Spacer,{y:6}),e.jsxRuntimeExports.jsx(i.InputField,{id:"oidcDiscoveryUrl",type:"url",label:"Well-known URL of OpenID Provider",placeholder:"https://example.com/.well-known/openid-configuration","aria-describedby":"oidc-metadata-hint",classNames:a().inputField,value:n.oidcDiscoveryUrl||"",handleInputChange:p}),e.jsxRuntimeExports.jsx("div",{id:"oidc-metadata-hint",className:P.hint,children:"Enter the well known discovery path of OpenID provider or manually enter the OpenId provider metadata below."}),e.jsxRuntimeExports.jsx(e.Spacer,{y:6}),e.jsxRuntimeExports.jsx(X,{text:"OR"}),e.jsxRuntimeExports.jsx(e.Spacer,{y:6}),e.jsxRuntimeExports.jsx(i.InputField,{id:"oidcMetadata.issuer",label:"Issuer",placeholder:"https://example.com",classNames:a().inputField,value:n["oidcMetadata.issuer"],handleInputChange:p}),e.jsxRuntimeExports.jsx(e.Spacer,{y:6}),e.jsxRuntimeExports.jsx(i.InputField,{id:"oidcMetadata.authorization_endpoint",type:"url",label:"Authorization Endpoint",placeholder:"https://example.com/oauth/authorize",classNames:a().inputField,value:n["oidcMetadata.authorization_endpoint"],handleInputChange:p}),e.jsxRuntimeExports.jsx(e.Spacer,{y:6}),e.jsxRuntimeExports.jsx(i.InputField,{id:"oidcMetadata.token_endpoint",type:"url",label:"Token endpoint",placeholder:"https://example.com/oauth/token",classNames:a().inputField,value:n["oidcMetadata.token_endpoint"],handleInputChange:p}),e.jsxRuntimeExports.jsx(e.Spacer,{y:6}),e.jsxRuntimeExports.jsx(i.InputField,{id:"oidcMetadata.jwks_uri",type:"url",label:"JWKS URI",placeholder:"https://example.com/.well-known/jwks.json",classNames:a().inputField,value:n["oidcMetadata.jwks_uri"],handleInputChange:p}),e.jsxRuntimeExports.jsx(e.Spacer,{y:6}),e.jsxRuntimeExports.jsx(i.InputField,{id:"oidcMetadata.userinfo_endpoint",type:"url",label:"UserInfo endpoint",placeholder:"https://example.com/userinfo",classNames:a().inputField,value:n["oidcMetadata.userinfo_endpoint"],handleInputChange:p}),e.jsxRuntimeExports.jsx(e.Spacer,{y:6}),h()==="advanced"?e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:o("sortOrder")?null:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(i.InputField,{label:"Sort Order",id:"sortOrder",type:"number",min:"0",placeholder:"10",classNames:a().inputField,value:n.sortOrder,handleInputChange:p}),e.jsxRuntimeExports.jsx("div",{id:"sortOrder-hint",className:P.hint,children:"Connections will be sorted (in a listing view like IdP Selection) using this setting. Higher values will be displayed first."})]})}):null,e.jsxRuntimeExports.jsxs("div",{className:P.formAction,children:[typeof t.cancelCallback=="function"?e.jsxRuntimeExports.jsx(e.Button,{type:"button",name:"Cancel",variant:"outline",handleClick:t.cancelCallback,classNames:(ee=(Z=t.classNames)==null?void 0:Z.button)==null?void 0:ee.cancel}):null,e.jsxRuntimeExports.jsx(e.Button,{type:"submit",name:"Save",classNames:(ne=(te=t.classNames)==null?void 0:te.button)==null?void 0:ne.ctoa,isLoading:g})]}),e.jsxRuntimeExports.jsx(e.Spacer,{y:6}),r()?e.jsxRuntimeExports.jsxs(Ae,{title:"Connection info",variant:"info",arrangement:"vertical",children:[e.jsxRuntimeExports.jsxs("div",{className:P.info,children:[h()==="advanced"?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[o("tenant")?null:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(i.InputField,{label:"Tenant",id:"tenant",placeholder:"acme.com",classNames:a().inputField,required:!0,readOnly:!0,value:n.tenant}),e.jsxRuntimeExports.jsx(e.Spacer,{y:6})]}),o("product")?null:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(i.InputField,{label:"Product",id:"product",placeholder:"demo",classNames:a().inputField,required:!0,readOnly:!0,value:n.product}),e.jsxRuntimeExports.jsx(e.Spacer,{y:6})]})]}):null,e.jsxRuntimeExports.jsx(e.InputWithCopyButton,{label:"Client ID",text:n.clientID||"",classNames:a().inputField,copyDoneCallback:t.successCallback}),e.jsxRuntimeExports.jsx(e.Spacer,{y:6}),e.jsxRuntimeExports.jsx(i.SecretInputFormControl,{label:"Client Secret",id:"clientSecret",classNames:{input:(se=t.classNames)==null?void 0:se.secretInput},value:n.clientSecret,required:!0,readOnly:!0,copyDoneCallback:t.successCallback,handleChange:p})]}),e.jsxRuntimeExports.jsx(e.Spacer,{y:6})]}):null,e.jsxRuntimeExports.jsx(e.Spacer,{y:4}),n.clientID&&n.clientSecret?e.jsxRuntimeExports.jsxs("section",{className:a().section,children:[e.jsxRuntimeExports.jsxs("div",{className:P.info,children:[e.jsxRuntimeExports.jsx("h6",{className:P.sectionHeading,children:"Delete this connection"}),e.jsxRuntimeExports.jsx("p",{className:P.sectionPara,children:"All your apps using this connection will stop working."})]}),S?null:e.jsxRuntimeExports.jsx(e.Button,{name:"Delete",variant:"destructive",type:"button",handleClick:j,classNames:(ie=(ae=t.classNames)==null?void 0:ae.button)==null?void 0:ie.destructive}),S?e.jsxRuntimeExports.jsx(i.ConfirmationPrompt,{ctoaVariant:"destructive",promptMessage:"Are you sure you want to delete the Connection? This action cannot be undone and will permanently delete the Connection.",classNames:{button:{ctoa:`${(re=(le=t.classNames)==null?void 0:le.button)==null?void 0:re.destructive} ${(ue=(oe=(ce=t.classNames)==null?void 0:ce.confirmationPrompt)==null?void 0:oe.button)==null?void 0:ue.ctoa}`.trim(),cancel:(k=(xe=(de=t.classNames)==null?void 0:de.confirmationPrompt)==null?void 0:xe.button)==null?void 0:k.cancel}},cancelCallback:j,confirmationCallback:L}):null]}):null]})})]})})}const Ft="_container_12xxf_1",kt="_label_12xxf_1",Ot="_formDiv_12xxf_4",At="_headingContainer_12xxf_9",Ut="_h5_12xxf_20",wt="_pre_12xxf_33",Dt="_info_12xxf_47",Lt="_section_12xxf_53",Mt="_sectionHeading_12xxf_69",Pt="_sectionPara_12xxf_74",Tt="_formAction_12xxf_82",$t="_hint_12xxf_87",M={container:Ft,label:kt,formDiv:Ot,headingContainer:At,h5:Ut,pre:wt,info:Dt,section:Lt,sectionHeading:Mt,sectionPara:Pt,formAction:Tt,hint:$t},qt={variant:"basic"},Ht={samlConnection:{name:"",label:"",tenant:"",product:"",clientID:"",clientSecret:"",description:"",redirectUrl:[""],defaultRedirectUrl:"",rawMetadata:"",metadataUrl:"",forceAuthn:!1,sortOrder:"",acsUrlOverride:""}};function we(t){var c,s,l,m,C,y,w,$,G,K,Y,Q,Z,ee,te,ne,se,ae,ie,le,re,ce,oe,ue,de,xe;const[n,x]=v.useState(()=>Ht.samlConnection),[E,I]=v.useState(()=>!0),[g,u]=v.useState(()=>!1),[S,N]=v.useState(()=>!1);function j(){N(!S)}function h(){return t.variant||qt.variant}function a(){var k,f,R,d,A,q,V,z,B;return{formDiv:e.cssClassAssembler((k=t.classNames)==null?void 0:k.formDiv,M.formDiv),label:e.cssClassAssembler((f=t.classNames)==null?void 0:f.label,M.label),inputField:{label:(R=t.classNames)==null?void 0:R.label,input:(d=t.classNames)==null?void 0:d.input,container:(A=t.classNames)==null?void 0:A.fieldContainer},textarea:{label:(q=t.classNames)==null?void 0:q.label,textarea:(V=t.classNames)==null?void 0:V.textarea,container:(z=t.classNames)==null?void 0:z.fieldContainer},section:e.cssClassAssembler((B=t.classNames)==null?void 0:B.section,M.section)}}function o(k){var f;return!!((f=t.excludeFields)!=null&&f.includes(k))}function b(k){return{...n,...k}}function p(k){const f=k.target,R=f.id,d=R!=="forceAuthn"?f.value:f.checked;x(b({[R]:d}))}function F(k,f){x(b({[k]:f}))}function _(k){k.preventDefault();const{sortOrder:f,...R}=n,d=f===""?R:{...n,sortOrder:+f};u(!0),pe({url:t.urls.patch,isEditView:!0,formObj:d,connectionIsSAML:!0,callback:async A=>{u(!1),A!=null&&A.error?typeof t.errorCallback=="function"&&t.errorCallback(A.error.message):typeof t.successCallback=="function"&&t.successCallback({operation:"UPDATE",connection:d,connectionIsSAML:!0})}})}function U(k){k.preventDefault(),Se({url:t.urls.delete,clientId:n.clientID,clientSecret:n.clientSecret,callback:async f=>{f!=null&&f.error?typeof t.errorCallback=="function"&&t.errorCallback(f.error.message):typeof t.successCallback=="function"&&t.successCallback({operation:"DELETE",connectionIsSAML:!0})}})}function L(){return t.displayHeader!==void 0?t.displayHeader:!0}function D(){return t.displayInfo!==void 0?t.displayInfo:!0}function r(){return t.urls.get}return v.useEffect(()=>{async function k(f){const R=await i.sendHTTPRequest(f);if(I(!1),R&&typeof R=="object"){if("error"in R&&R.error)typeof t.errorCallback=="function"&&t.errorCallback(R.error.message);else if(Array.isArray(R)){const d=R[0];d&&x({...d,name:d.name||"",label:d.label||"",tenant:d.tenant||"",product:d.product||"",clientID:d.clientID,clientSecret:d.clientSecret,description:d.description||"",redirectUrl:d.redirectUrl,defaultRedirectUrl:d.defaultRedirectUrl,rawMetadata:d.rawMetadata||"",metadataUrl:d.metadataUrl||"",forceAuthn:d.forceAuthn===!0,sortOrder:d.sortOrder??""})}}}k(r())},[r()]),e.jsxRuntimeExports.jsx(i.LoadingContainer,{isBusy:E,children:e.jsxRuntimeExports.jsxs("div",{className:a().formDiv,children:[e.jsxRuntimeExports.jsxs("div",{className:M.headingContainer,children:[L()?e.jsxRuntimeExports.jsx("h5",{className:M.h5,children:"Edit SSO Connection"}):null,e.jsxRuntimeExports.jsx(Oe,{connection:n,urls:{patch:t.urls.patch},classNames:{confirmationPrompt:{button:{ctoa:`${(l=(s=(c=t.classNames)==null?void 0:c.confirmationPrompt)==null?void 0:s.button)==null?void 0:l.ctoa} ${n.deactivated?(C=(m=t.classNames)==null?void 0:m.button)==null?void 0:C.ctoa:(w=(y=t.classNames)==null?void 0:y.button)==null?void 0:w.destructive}`.trim(),cancel:(K=(G=($=t.classNames)==null?void 0:$.confirmationPrompt)==null?void 0:G.button)==null?void 0:K.cancel}}},errorCallback:t.errorCallback,successCallback:t.successCallback})]}),e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsxs("form",{method:"post",onSubmit:k=>_(k),children:[h()==="advanced"?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[o("name")?null:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(i.InputField,{label:"Connection name (Optional)",id:"name",placeholder:"MyApp",classNames:a().inputField,required:!1,value:n.name,handleInputChange:p}),e.jsxRuntimeExports.jsx(e.Spacer,{y:6})]}),o("label")?null:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(i.InputField,{label:"Connection label (Optional)",id:"label",placeholder:"An internal label to identify the connection",classNames:a().inputField,required:!1,value:n.label,handleInputChange:p}),e.jsxRuntimeExports.jsx(e.Spacer,{y:6})]}),o("description")?null:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(i.InputField,{label:"Description (Optional)",id:"description",placeholder:"A short description not more than 100 characters",classNames:a().inputField,required:!