import{R as h,o as p,aY as r,k as g,l as x,j as e,E as S,a9 as n,g as f,h as j,i as m}from"./app-BgLa5dit.js";function w(a){const[l,s]=h.useState(!1),t=p(r.interactiveMetadata(a.id)),d=g(),i=x();function u(){var o;s(!0),d(r.deleteInteractive(a.id,(o=t.data._parentVideo)==null?void 0:o.id)).then(()=>{var c;i.success(`Successfully deleted <strong>${t.data.name}</strong>.`),f.trigger({application:m.VIDEOS,action:j.Videos.EDIT_VIDEO_INTERACTIVES,args:[(c=t.data._parentVideo)==null?void 0:c.id]},{replace:!0}),a.closePopup()}).catch(()=>{i.error(`Something went wrong while trying to delete <strong>${t.data.name}</strong>. Please try again.`),s(!1)})}return e.jsxs(S,{title:"Delete draft interactive",closePopup:a.closePopup,showLoadingSpinner:!t.data,children:[e.jsxs("p",{children:["Are you sure you want to delete ",e.jsx("strong",{children:t.data.name}),"?"]}),e.jsx("p",{children:"This interactive has not been published, which means it has not had any usage and is safe to delete."}),e.jsxs(n,{children:[e.jsx(n.Cancel,{onClick:a.closePopup}),e.jsx(n.Submit,{variant:"danger",type:"button",text:"Delete interactive",onClick:u,showSpinner:l})]})]})}export{w as DeleteInteractiveView};
//# sourceMappingURL=C1-L3PIk.chunk.js.map
