"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[804],{76046:(e,t,a)=>{var r=a(66658);a.o(r,"usePathname")&&a.d(t,{usePathname:function(){return r.usePathname}}),a.o(r,"useRouter")&&a.d(t,{useRouter:function(){return r.useRouter}}),a.o(r,"useSearchParams")&&a.d(t,{useSearchParams:function(){return r.useSearchParams}})},71804:(e,t,a)=>{a.r(t),a.d(t,{default:()=>l});var r=a(95155),s=a(12115),n=a(90447),i=a(48173),o=a.n(i),c=a(76046);function l(){let[e,t]=(0,s.useState)(!0),a=(0,c.useSearchParams)();return((0,s.useEffect)(()=>{(async()=>{try{let e=a.get("session_id"),t=a.get("reference");if(!e&&!t)return;let r=JSON.parse(localStorage.getItem("giftData")||"{}");if(t&&!(await fetch("/api/verify-paystack",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reference:t})})).ok)throw Error("Payment verification failed");await fetch("/api/send-gift-emails",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...r,sessionId:e||t})}),localStorage.removeItem("giftData")}catch(e){console.error("Error:",e)}finally{t(!1)}})()},[a]),e)?(0,r.jsx)("div",{className:"min-h-screen flex items-center justify-center",children:(0,r.jsx)("div",{className:"animate-spin rounded-full h-12 w-12 border-t-2 border-b-2 border-coral"})}):(0,r.jsx)("div",{className:"min-h-screen flex items-center justify-center p-4",children:(0,r.jsxs)(n.P.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"text-center space-y-6",children:[(0,r.jsx)("h1",{className:"text-coral font-script text-4xl md:text-5xl",children:"Thank You!"}),(0,r.jsx)("p",{className:"text-[1.25rem] leading-8",children:"Your generous gift means the world to us. We are truly grateful for your support."}),(0,r.jsx)(o(),{href:"/",className:"btn-outline-dark inline-block",children:"Return Home"})]})})}}}]);