import{R as d,o as P,l as b,k as I,j as e,E as j,C as w,a9 as i}from"./app-BgLa5dit.js";import{S as h}from"./B11DWb8Z.chunk.js";import"./CIRO_mWB.chunk.js";function y(s){var c;const[u,n]=d.useState(!1),[l,p]=d.useState(!1),o=P(h.getIdp(s.idpId)),a=b(),g=I(),x=!o.hasCompleted;async function m(){var t;try{n(!0),await g(h.deleteIdp(s.idpId)),a.success("Custom IDP has been deleted"),s.closePopup()}catch(r){console.error(`error deleting idp: ${r}`),a.error(((t=r.responseJSON)==null?void 0:t.message)||"Failed to deleted IDP, please try again")}finally{n(!1)}}return e.jsxs(j,{size:"md",title:"Delete custom IDP",closePopup:s.closePopup,showLoadingSpinner:x,children:[e.jsxs("p",{children:["Are you sure you want to delete ",e.jsxs("span",{className:"fw-bold",children:['"',(c=o.data)==null?void 0:c.name,'"']}),"? Proceeding will result in the following:"]}),e.jsxs("ul",{children:[e.jsx("li",{children:"The IDP certifcates will be removed"}),e.jsx("li",{children:"Attributes and IDP bindings will be deleted"}),e.jsx("li",{children:"The IDP will be disabled"}),s.isOrg?e.jsx("li",{children:"Users from schools in this organisation will no longer be ale to sign-in using this IDP"}):e.jsx("li",{children:"Users will no longer be able to sign-in using this IDP"})]}),e.jsx(w,{className:"my-3",id:"ack",checked:l,onChange:t=>p(t.target.checked),label:"I understand that this IDP cannot be recovered once deleted."}),e.jsxs(i,{children:[e.jsx(i.Cancel,{onClick:s.closePopup}),e.jsx(i.Submit,{variant:"danger",text:"Delete IDP",disabled:!l,showSpinner:u,onClick:m})]})]})}export{y as DeleteIdpPopupView};
//# sourceMappingURL=DYMMzY_O.chunk.js.map
