1import{p as A,r as l,j as e}from"./vendor-react-DfYGAhtm.js";import{D as P,d as k}from"./vendor-icons-1odZwi-b.js";import{x as _,B as d,m as o,y as R,g as b,t as C}from"./index-DsBgCU7r.js";import{s as w}from"./success-C0L8gZxS.js";import{G as I}from"./gadgetPostPaymentFlowConfig-ChCU4qBA.js";import{u as D}from"./useAnalytics-HP01GbIH.js";import{S as B}from"./StepPageLayout-DdZUweau.js";import{V as i,a as p,i as L,T as u,n as N}from"./vendor-ui-DA_r9yXk.js";import"./vendor-state-BsBVN-fX.js";import"./vendor-forms-BP-7CbAP.js";import"./routes-CNOe4p0Z.js";const U=()=>{const{navigate:c}=_(),[r]=A(),[m,f]=l.useState(!1),x=r.get("policyId")??void 0,g=r.get("quoteId")??r.get("reference")??r.get("trxref")??void 0,a=r.get("trxref")??r.get("reference")??r.get("quoteId")??void 0,{track:n}=D(),y=l.useRef(!1);l.useEffect(()=>{y.current||(y.current=!0,n(d.SCREEN_PAYMENT_COMPLETED,{product_type:"screen",...a?{payment_reference:a}:{}}),n(d.SCREEN_CERTIFICATE_ISSUED,{product_type:"screen"}),n(d.SCREEN_FLOW_COMPLETED,{product_type:"screen"}))},[n,a]);const E=I.routes,S=async s=>{if(typeof navigator<"u"&&navigator.clipboard!=null&&typeof navigator.clipboard.writeText=="function")try{return await navigator.clipboard.writeText(s),!0}catch{}if(typeof document>"u")return!1;try{const t=document.createElement("textarea");t.value=s,t.setAttribute("readonly",""),t.style.position="fixed",t.style.top="0",t.style.left="0",t.style.opacity="0",document.body.appendChild(t),t.focus(),t.select();const v=document.execCommand("copy");return document.body.removeChild(t),v}catch{return!1}},T=async()=>{if(!a)return;if(!await S(a)){C.error("Could not copy. Please copy the transaction ref manually.");return}f(!0),C.success("Transaction ref copied to clipboard"),window.setTimeout(()=>f(!1),2e3)},j=()=>{if(x){const s=new URLSearchParams({policyId:x});g&&s.set("quoteId",g),c(`/${E.policyActivation}?${s.toString()}`);return}c("/policies")},h=()=>{c("/home",{replace:!0})};return e.jsx(B,{items:[],hideGoBack:!0,onGoBack:h,contentMaxW:"600px",children:e.jsxs(i,{bg:"white",borderRadius:"2xl",background:`linear-gradient(145deg, white 55%, ${o.orange[50]} 100%)`,border:"1px solid",borderColor:o.border.secondary,p:{base:6,md:10},align:"stretch",gap:6,children:[e.jsxs(i,{gap:4,align:"center",pt:4,children:[e.jsx(p,{display:"flex",justifyContent:"center",width:"100%",children:e.jsx(R,{data:w,autoplay:!0,loop:!0})}),e.jsx(L,{fontSize:{base:"xl",md:"2xl"},fontWeight:"bold",color:o.success[600],textAlign:"center",children:"Payment Successful"}),e.jsx(u,{fontSize:{base:"sm",md:"md"},color:o.text.gray,textAlign:"center",maxW:"360px",lineHeight:"tall",children:"Your gadget insurance has been successfully paid for. Complete policy activation to begin your cover."})]}),a&&e.jsx(p,{border:"1px solid",borderColor:o.border.primary,borderRadius:"2xl",px:6,py:5,bg:"white",children:e.jsxs(i,{gap:1,align:"center",children:[e.jsx(u,{fontSize:"xs",fontWeight:"semibold",color:o.text.gray,textTransform:"uppercase",letterSpacing:"0.1em",children:"Transaction Ref"}),e.jsxs(p,{display:"flex",alignItems:"center",gap:2,children:[e.jsx(u,{fontSize:{base:"lg",md:"xl"},fontWeight:"bold",color:o.text.label,fontFamily:"mono",children:a}),e.jsx(N,{"aria-label":m?"Copied!":"Copy transaction ref",variant:"ghost",size:"sm",color:m?o.success[600]:o.text.gray,onClick:()=>void T(),children:e.jsx(P,{})})]})]})}),e.jsxs(i,{gap:3,align:"stretch",children:[e.jsx(b,{buttonType:"primary",text:"Complete Policy Activation",size:"lg",onClick:j}),e.jsx(b,{buttonType:"outline",text:"Back to Dashboard",size:"lg",icon:e.jsx(k,{}),iconPosition:"right",onClick:h})]})]})})};export{U as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.