import{j as i,Y as m,h as n,i as s,Q as C,av as A,e9 as _,au as R,aO as D,o as l,at as L,bk as T}from"./app-BgLa5dit.js";import{C as w}from"./WqgNB-L4.chunk.js";import{S as E}from"./DAgrGerj.chunk.js";import{O as f}from"./DNClpFKN.chunk.js";import{S as y}from"./CIRO_mWB.chunk.js";import{C as P}from"./BPRDISw7.chunk.js";import{C as U,a as k}from"./8iu0vnCW.chunk.js";import{D as j}from"./C4BcftDO.chunk.js";import{E as N}from"./DTaYxhew.chunk.js";import{S as B}from"./ClcCVqTk.chunk.js";import{u as V}from"./jfOju8wm.chunk.js";import{O as G}from"./u6fIQ8Ti.chunk.js";import"./0GREfvNX.chunk.js";import"./3nM7jLnE.chunk.js";import"./CPXlV0fg.chunk.js";import"./ChrB5FYK.chunk.js";import"./DR2FaZH9.chunk.js";import"./KUnagq9Z.chunk.js";import"./DULWIWQR.chunk.js";import"./CCcwLDvu.chunk.js";import"./DDfKZ_ng.chunk.js";import"./DV8zX5C-.chunk.js";import"./CVqrJ8QP.chunk.js";import"./DjR16E2i.chunk.js";import"./B11DWb8Z.chunk.js";function W(a){return i.jsx("div",{className:"crm-studio-wizard-form",children:i.jsx("div",{children:i.jsx(j,{className:"overflow-hidden",innerContainerClassName:"border-bottom-0",defaultIsCollapsed:a.defaultCollapse,heading:i.jsx(N,{id:a.idpMapping.idpId}),button:i.jsx(m,{appLink:{application:s.CRM_STUDIO,action:n.CrmStudio.REMOVE_ORGANISATION_SSO_MAPPING,args:[a.id,a.idpMapping.idpId]},children:i.jsx(C,{className:"svg-container cursor-pointer ms-2",svg:A})}),children:i.jsxs("div",{className:"row mt-2 py-2 px-3",children:[i.jsx("label",{className:"col-4",children:"External customer ID"}),i.jsx("span",{className:"col text-break",children:a.idpMapping.externalOrganisationId})]})},a.idpMapping.idpId)})})}const z="_disabledBadge_fjau1_1",F={disabledBadge:z};function Z(a){const{idp:t,certificates:r,attributeMappings:o,isLoading:e}=V({idpId:a.authenticationMethod.idpId,enabled:!!a.authenticationMethod.idpId});return e?i.jsx(_,{}):i.jsx("div",{className:"crm-studio-wizard-form",children:i.jsx("div",{children:i.jsxs(j,{heading:i.jsxs("div",{className:"d-flex align-items-center gap-2",children:[i.jsx(N,{id:t.id,externalIdp:{name:t.name,logoUrl:t.logoUrl||D.SsoWizard.SAML_LOGO}}),!t.enabled&&i.jsx("div",{className:`rounded-pill px-2 fw-semibold ${F.disabledBadge}`,children:"Disabled"})]}),className:"overflow-hidden",innerContainerClassName:"border-bottom-0",defaultIsCollapsed:a.defaultCollapse,button:i.jsx(m,{appLink:{application:s.CRM_STUDIO,action:n.CrmStudio.CUSTOMER_SSO_WIZARD_EDIT_IDP_POPUP,args:[a.id],params:{idpId:a.authenticationMethod.idpId,isOrg:!0}},children:i.jsx(C,{className:"svg-container cursor-pointer ms-2",svg:R})}),children:[i.jsx("div",{className:"alert bg-light-orange p-2 rounded-2 d-flex justify-content-between align-items-center m-2",children:i.jsxs("p",{className:"mb-0",children:["Bindings for ",a.authenticationMethod.displayName," must be configured on a ",i.jsx(m,{className:"text-info",appLink:{application:s.CRM_STUDIO,action:n.CrmStudio.ORGANISATION_OVERVIEW,args:[a.id]},children:"customer level"})]})}),i.jsx(B,{idp:t,certificates:r,attributeMappings:o,showAttributeMappingsEdit:!1,showCustomerAttribute:!0,domains:a.domains,editDomainsAppLink:{application:s.CRM_STUDIO,action:n.CrmStudio.ORGANISATION_DOMAINS,args:[a.id]},isLast:!0})]},a.authenticationMethod.idpId)})})}function xi(a){var u,S,h,x,I;const t=l(G.getIdpMappings(a.id)),r=(u=t.data)==null?void 0:u[0],o=l(f.getAuthenticationMethods(a.id)),e=(S=o.data)==null?void 0:S.filter(d=>d.type===y.SAML2),c=l(f.getOrganisationDomains(a.id)),p=((h=o.data)==null?void 0:h.length)===0&&!((x=t.data)!=null&&x.length),M=t.hasCompleted&&o.hasCompleted&&c.hasCompleted,g=[...t.data||[],...e||[]].filter(Boolean).length>1;function b(){return p?null:i.jsx(L,{svg:T,className:"btn btn-outline-dark",appLink:{application:s.CRM_STUDIO,action:n.CrmStudio.ORGANISATION_SSO_WIZARD,args:[a.id]},children:"Add SSO mapping"})}return i.jsx(U,{view:k.Organisations,children:i.jsx(P,{title:"Organisation SSO",currentTabId:"sso",id:a.id,loading:!M,rightContent:b(),children:p?i.jsx(w,{heading:"This organisation doesn’t have SSO set up yet",appLink:{application:s.CRM_STUDIO,action:n.CrmStudio.ORGANISATION_SSO_WIZARD,args:[a.id]},ctaText:"Set up SSO"}):i.jsxs(i.Fragment,{children:[i.jsx(E,{type:"organisation"}),!!((I=t.data)!=null&&I.length)&&i.jsx(W,{id:a.id,idpMapping:r,defaultCollapse:g}),!!(e!=null&&e.length)&&i.jsx(i.Fragment,{children:e==null?void 0:e.map(d=>{var O;return i.jsx(Z,{id:a.id,authenticationMethod:d,defaultCollapse:g,domains:(O=c.data)==null?void 0:O.map(v=>v.domain)},d.idpId)})})]})})})}export{xi as OrganisationSsoView};
//# sourceMappingURL=B5r27giy.chunk.js.map
