PageSourceSearch

https://thiagovibesp.com/assets/Download-BW-JFSEI.js

js thiagovibesp.com collected 2026-10-02 00:57:32 UTC 3,894 bytes, 1 lines download raw bytes

1import{n as k,r as o,j as e,e as v,B as d,L as b,s as F}from"./index-Gd3ICOax.js";import{S as E}from"./SEOHead-C7dcErS8.js";import{F as P}from"./Footer-wwnpDw4k.js";import{C as z}from"./circle-check-Cd0FxmjF.js";import{D as T}from"./download-cOV1e_tl.js";import{T as y}from"./triangle-alert-D3lJcvB5.js";const O=()=>{const{token:r}=k(),[n,l]=o.useState("loading"),[x,N]=o.useState(""),[u,D]=o.useState(""),[h,S]=o.useState(null),[g,i]=o.useState(3),[p,c]=o.useState(""),[C,w]=o.useState(!1),f=async()=>{var j;if(r){w(!0);try{const{data:t,error:s}=await F.functions.invoke("download-product",{body:{token:r}});if(s){const m=((j=s==null?void 0:s.context)==null?void 0:j.body)||(s==null?void 0:s.context),a=typeof m=="string"?JSON.parse(m):m;if((a==null?void 0:a.error)==="limit_reached"){l("limit"),i(a.maxDownloads||3),c(a.message||"");return}throw new Error((a==null?void 0:a.error)||s.message)}if((t==null?void 0:t.error)==="limit_reached"){l("limit"),i(t.maxDownloads||3),c(t.message||"");return}N(t.downloadUrl),D(t.productName),S(t.downloadsRemaining),i(t.maxDownloads),l("ready"),window.location.href=t.downloadUrl}catch(t){console.error(t),c(t.message||"Could not process download."),l("error")}finally{w(!1)}}};return o.useEffect(()=>{f()},[r]),e.jsxs(e.Fragment,{children:[e.jsx(E,{title:"Download your purchase | ThiagoVibesp",description:"Download your digital product.",path:`/download/${r}`}),e.jsx("div",{className:"relative min-h-screen pt-24 pb-16 px-4 flex items-center justify-center",children:e.jsxs("div",{className:"max-w-xl w-full bg-card border border-border rounded-2xl p-8 md:p-10 text-center",children:[n==="loading"&&e.jsxs(e.Fragment,{children:[e.jsx(v,{className:"h-12 w-12 text-primary mx-auto mb-4 animate-spin"}),e.jsx("h1",{className:"font-display text-3xl text-foreground mb-3 tracking-wider",children:"Preparing your download…"}),e.jsx("p",{className:"text-muted-foreground",children:"Just a moment."})]}),n==="ready"&&e.jsxs(e.Fragment,{children:[e.jsx(z,{className:"h-14 w-14 text-primary mx-auto mb-4"}),e.jsx("h1",{className:"font-display text-3xl text-foreground mb-3 tracking-wider",children:"Your download is starting"}),u&&e.jsx("p",{className:"text-muted-foreground mb-4",children:u}),h!==null&&e.jsxs("p",{className:"text-sm text-muted-foreground mb-6",children:["Downloads remaining: ",e.jsx("strong",{className:"text-foreground",children:h})," of ",g]}),x&&e.jsx(d,{asChild:!0,size:"lg",className:"mb-3",children:e.jsxs("a",{href:x,download:!0,children:[e.jsx(T,{className:"h-4 w-4 mr-2"}),"Download again"]})}),e.jsx("p",{className:"text-xs text-muted-foreground mt-4",children:"If the download didn't start automatically, click the button above."})]}),n==="limit"&&e.jsxs(e.Fragment,{children:[e.jsx(y,{className:"h-14 w-14 text-destructive mx-auto mb-4"}),e.jsx("h1",{className:"font-display text-3xl text-foreground mb-3 tracking-wider",children:"Download limit reached"}),e.jsx("p",{className:"text-muted-foreground mb-4",children:p||`You have reached the maximum of ${g} downloads for this purchase.`}),e.jsx("p",{className:"text-sm text-muted-foreground mb-6",children:"Please contact our support team and we'll help you out right away."}),e.jsx(d,{asChild:!0,size:"lg",children:e.jsx(b,{to:"/contact",children:"Contact Support"})})]}),n==="error"&&e.jsxs(e.Fragment,{children:[e.jsx(y,{className:"h-12 w-12 text-destructive mx-auto mb-4"}),e.jsx("h1",{className:"font-display text-3xl text-foreground mb-3 tracking-wider",children:"We couldn't process your download"}),e.jsx("p",{className:"text-muted-foreground mb-6",children:p}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 justify-center",children:[e.jsx(d,{onClick:f,disabled:C,size:"lg",children:"Try again"}),e.jsx(d,{asChild:!0,size:"lg",variant:"outline",children:e.jsx(b,{to:"/contact",children:"Contact Support"})})]})]})]})}),e.jsx(P,{})]})};export{O 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.