import{aA as t,ag as l,j as e,G as c,az as o,ax as d,aS as m,O as p,Q as x,av as h,ar as j}from"./app-BgLa5dit.js";import{F as u}from"./w68yffRy.chunk.js";var r=(a=>(a.Clever="clever",a.Classlink="classlink",a.CleverStreamable="cleverstreamable",a.ClasslinkStreamable="classlinkstreamable",a.MyLogin="mylogin",a.Skolon="skolon",a.SAFARIMontage="safarimontage",a))(r||{});const g=t.object().shape({idpId:t.string().max(255,"IDP Id is too long").required("IDP Id is required"),externalId:t.string().max(255,"External ID is too long").required("External ID is required")});function I(a){const s={idpId:"",externalId:""},n=a.type===l.Organisation?"Organisation":"Customer";return e.jsx(c,{initialValues:s,validationSchema:g,onSubmit:a.addIdp,children:e.jsx(o,{children:e.jsxs("div",{className:"row",children:[e.jsx("div",{className:"col-5",children:e.jsxs(d,{as:"select",label:"Provider (IDP Id)",name:"idpId",id:"idpId",children:[e.jsx("option",{value:"",children:"Select provider"}),m.getEnumKeys(r).map(i=>e.jsx("option",{value:r[i],children:i},i))]})}),e.jsx("div",{className:"col-5",children:e.jsx(d,{label:`External ${n} Id`,name:"externalId",id:"externalId",placeholder:`Enter the external ${n.toLowerCase()} ID`})}),e.jsx("div",{className:"col-2",children:e.jsx("div",{className:"mt-labelHeight",children:e.jsx(u,{isNew:!0,submitText:"Add",variant:"dark"})})})]})})})}function v(a){return e.jsxs("tr",{children:[e.jsx("td",{className:"ps-3",children:a.idpMapping.idpId}),e.jsx("td",{className:"ps-3",children:a.idpMapping.externalId}),e.jsx("td",{className:"ps-3",children:e.jsx(p,{onClick:()=>a.onDelete(a.idpMapping.idpId),children:e.jsx(x,{svg:h,title:"Delete this mapping",tooltipPlacement:"top",tooltipSpanHack:!0})})})]})}function N(a){var s;return e.jsxs("table",{className:"table m-0",children:[e.jsxs("thead",{children:[e.jsx("th",{scope:"col",className:"ps-3",children:"Provider (IdpId)"}),e.jsxs("th",{scope:"col",className:"ps-3",children:["External ",a.type===l.Customer?"Customer":"Organisation"," Id"]}),e.jsx("th",{scope:"col",className:"ps-3 text-center",children:"Action"})]}),e.jsx("tbody",{children:(s=a.idpMappings)==null?void 0:s.map((n,i)=>e.jsx(v,{idpMapping:n,onDelete:a.onDelete},i))})]})}function S(a){const s=a.type===l.Organisation?"Organisation":"Customer";return e.jsxs(e.Fragment,{children:[e.jsxs("p",{children:["An ",s.toLowerCase()," may only have ",e.jsx("strong",{children:"one"})," mapping per provider. To update an existing mapping please remove and re-add it."]}),e.jsxs("p",{children:["Please refer to ",e.jsx("a",{className:"info-link",target:"_blank",href:"https://clickview.quip.com/GRMNAgvFT3SI/SSO-Supported-IDP-Provider",children:"documentation"})," for all currently supported IDPs."]}),e.jsxs("div",{className:"card",children:[e.jsx("div",{className:"card-header",children:e.jsx("h3",{className:"h5 m-0",children:"Add IDP mapping"})}),e.jsx("div",{className:"card-body",children:e.jsx(I,{addIdp:a.onClickAddIdpMapping,type:a.type})})]}),e.jsxs("div",{className:"card mt-3",children:[e.jsx("div",{className:"card-header border-bottom-0",children:e.jsxs("h3",{className:"h5 m-0",children:[s," IDP mappings"]})}),e.jsx("div",{className:"card-body p-0",children:(()=>{var n;return a.isLoading?e.jsx("div",{className:"text-center py-3",children:e.jsx(j,{as:"div",animation:"border",role:"status"})}):(n=a.idpMappings)!=null&&n.length?e.jsx(N,{idpMappings:a.idpMappings,onDelete:a.removeIdpMapping,type:a.type}):e.jsx("div",{className:"px-3 py-2",children:e.jsxs("em",{children:["There are currently no mappings for this ",s.toLowerCase(),"."]})})})()})]})]})}export{S};
//# sourceMappingURL=Doe88eh-.chunk.js.map
