1import{l as L,U as N,a3 as T,r as l,L as E,m as S,q as V,v as t,G as f,M as D,y as n,B as a,t as d,C as i,N as F,A as h,D as $,R}from"./W_4QL2u5.js";import{m as x}from"./CgdHCVK0.js";import{u as H}from"./BAPMsqxh.js";import"./CoGQ8KCJ.js";const I={class:"bg-[#F5F5F5] min-h-screen flex items-center justify-center"},U={class:"container mx-auto px-5 py-12"},Y={class:"max-w-[600px] mx-auto"},q={class:"text-[#595959] text-lg mb-8"},G={class:"flex flex-col sm:flex-row gap-4 justify-center"},O={class:"flex flex-col sm:flex-row gap-4 justify-center"},z=900*1e3,W=30,X=L({__name:"purchase-confirmation",setup(Z){const g=N(),_=T(),r=g.query.product,y=g.query.checkout_id,p=l(!1),c=l(!1),m=l(""),u=l(0),P=Date.now(),b=l(!1),{trackPurchase:j}=H(),A=s=>({"all-access-yearly":"All Access Pass (Yearly)","all-access-lifetime":"All Access Pass (Lifetime)","all-access-creator":"All Access Pass (Creator)"})[s]||s.split("-").map(o=>o.charAt(0).toUpperCase()+o.slice(1)).join(" ");m.value=A(r);const M=async()=>{try{if(console.log(`[Poll ${u.value+1}] Checking for purchase: ${r}`),y&&!b.value){const o=await $fetch("/api/polar/reconcile-checkout",{method:"POST",body:{checkoutId:y,productSlug:r}});b.value=o.reconciled}
1const s=await $fetch("/api/dashboard/purchases");console.log("Total purchases:",s.length),console.log("All purchases:",s.map(o=>({slug:o.product_slug,status:o.status,type:o.product_type,title:o.title})));const e=s.find(o=>{const k=o.purchased_at||o.purchasedAt,w=k?new Date(k).getTime():Number.NaN,v=o.product_slug===r&&o.status==="completed"&&Number.isFinite(w)&&w>=P-z;return console.log(`Checking ${o.product_slug}: slug match=${o.product_slug===r}, status=${o.status}, matches=${v}`),v});if(e){const o=Number(e.price||0)/100;return j({transactionId:String(e.order_id||e.orderId||""),currency:String(e.currency||"USD"),value:o,item:{id:r,name:e.title||m.value,price:o}}),console.log("â Purchase found!"),p.value=!0,!0}return console.log("Purchase not found yet, will retry in 2 seconds..."),console.log("Looking for:",{productSlug:r,status:"completed"}),!1}catch(s){return console.error("Error checking purchase:",s),!1}},C=()=>{const s=async()=>{if(!await M()){if(u.value++,u.value>=W){c.value=!0;return}setTimeout(s,2e3)}};s()},B=()=>{c.value=!1,u.value=0,C()};return E(()=>{if(!r){_.push("/dashboard");return}C()}),S({title:"Purchase Confirmation - FramerHub",description:"Confirming your purchase",robots:"noindex, nofollow"}),(s,e)=>{const o=$;return d(),V("div",I,[t("div",U,[t("div",Y,[!n(p)&&!n(c)?(d(),f(n(x).div,{key:0,initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},class:"bg-white rounded-2xl p-12 border border-[#E4E4E4] text-center"},{default:a(()=>[...e[0]||(e[0]=[t("div",{class:"w-20 h-20 mx-auto mb-6"},[t("svg",{class:"animate-spin text-primary",fill:"none",viewBox:"0 0 24 24"},[t("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"}),t("path",{class:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})])],-1),t("h1",{class:"font-heading text-2xl md:text-3xl font-bold mb-3"}," Processing Your Purchase ",-1),t("p",{class:"text-[#595959] text-lg mb-6"}," Please wait while we confirm your payment... ",-1),t("div",{class:"flex items-center justify-center gap-2 text-sm text-[#999]"},[t("div",{class:"w-2 h-2 bg-primary rounded-full animate-pulse"}),t("span",null,"This usually takes just a few seconds")],-1)])]),_:1})):n(p)?(d(),f(n(x).div,{key:1,initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},class:"bg-white rounded-2xl p-12 border border-[#E4E4E4] text-center"},{default:a(()=>[e[5]||(e[5]=t("div",{class:"w-20 h-20 mx-auto mb-6 bg-[#88EF5F]/20 rounded-full flex items-center justify-center"},[t("svg",{width:"40",height:"40",viewBox:"0 0 24 24",fill:"none",class:"text-[#4CAF50]"},[t("path",{d:"M22 11.08V12C21.9988 14.1564 21.3005 16.2547 20.0093 17.9818C18.7182 19.709 16.9033 20.9725 14.8354 21.5839C12.7674 22.1953 10.5573 22.1219 8.53447 21.3746C6.51168 20.6273 4.78465 19.2461 3.61096 17.4371C2.43727 15.628 1.87979 13.4881 2.02168 11.3363C2.16356 9.18455 2.99721 7.13631 4.39828 5.49706C5.79935 3.85781 7.69279 2.71537 9.79619 2.24013C11.8996 1.76489 14.1003 1.98232 16.07 2.86",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),t("path",{d:"M22 4L12 14.01L9 11.01",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})])],-1)),e[6]||(e[6]=t("h1",{class:"font-heading text-2xl md:text-3xl font-bold mb-3 text-[#1B1B1B]"}," Purchase Confirmed! ð ",-1)),t("p",q,[e[1]||(e[1]=i(" Your ",-1)),t("strong",null,F(n(m)),1),e[2]||(e[2]=i(" is now ready to use. ",-1))]),t("div",G,[h(o,{to:"/dashboard/components",class:"inline-flex items-center justify-center gap-2 px-8 py-4 bg-primary text-white rounded-full hover:bg-primary/90 transition-colors font-semibold"},{default:a(()=>[...e[3]||(e[3]=[i(" Go to Dashboard ",-1),t("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},[t("path",{d:"M6.6665 3.33331L10.9998 7.99998L6.6665 12.6666",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])]),_:1}),h(o,{to:"/components",class:"inline-flex items-center justify-center gap-2 px-8 py-4 bg-white text-primary border-2 border-primary rounded-full hover:bg-primary/5 transition-colors font-semibold"},{default:a(()=>[...e[4]||(e[4]=[i(" Browse More Components ",-1)])]),_:1})])]),_:1})):n(c)?(d(),f(n(x).div,{key:2,initial:{opacity:0,scale:.9}
1,animate:{opacity:1,scale:1},class:"bg-white rounded-2xl p-12 border border-red-200 text-center"},{default:a(()=>[e[9]||(e[9]=t("div",{class:"w-20 h-20 mx-auto mb-6 bg-red-50 rounded-full flex items-center justify-center"},[t("svg",{width:"40",height:"40",viewBox:"0 0 24 24",fill:"none",class:"text-red-500"},[t("path",{d:"M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),t("path",{d:"M15 9L9 15M9 9L15 15",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})])],-1)),e[10]||(e[10]=t("h1",{class:"font-heading text-2xl md:text-3xl font-bold mb-3 text-[#1B1B1B]"}," Purchase Verification Taking Longer ",-1)),e[11]||(e[11]=t("p",{class:"text-[#595959] text-lg mb-8"}," Your payment was successful, but we're still processing it. Please check your dashboard in a few minutes, or contact support if you need help. ",-1)),t("div",O,[t("button",{onClick:B,class:"inline-flex items-center justify-center gap-2 px-8 py-4 bg-primary text-white rounded-full hover:bg-primary/90 transition-colors font-semibold"},[...e[7]||(e[7]=[t("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none"},[t("path",{d:"M1 4V10H7M23 20V14H17M20.49 9C19.9828 7.56678 19.1209 6.28536 17.9845 5.27542C16.8482 4.26548 15.4745 3.55976 13.9917 3.22426C12.5089 2.88875 10.9652 2.93433 9.50481 3.35677C8.04437 3.77921 6.71475 4.56471 5.64 5.64L1 10M23 14L18.36 18.36C17.2853 19.4353 15.9556 20.2208 14.4952 20.6432C13.0348 21.0657 11.4911 21.1112 10.0083 20.7757C8.52547 20.4402 7.1518 19.7345 6.01547 18.7246C4.87913 17.7146 4.01717 16.4332 3.51 15",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1),i(" Try Again ",-1)])]),h(o,{to:"/dashboard",class:"inline-flex items-center justify-center gap-2 px-8 py-4 bg-white text-primary border-2 border-primary rounded-full hover:bg-primary/5 transition-colors font-semibold"},{default:a(()=>[...e[8]||(e[8]=[i(" Go to Dashboard ",-1)])]),_:1})])]),_:1})):D("",!0)])])])}}}),te=R(X,[["__scopeId","data-v-77e9a18a"]]);export{te 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.