1import{p as v,q as w,n as C,r as l,a7 as k,af as S,j as e,v as d,Z as T,t as x,ad as h,y as p,x as g,m}from"./index-DpfGtWPm.js";import{F as D}from"./Footer-BcQ83ngb.js";import{C as b,a as u}from"./card-nihJjM9B.js";import{P as U}from"./percent-CCAOksHX.js";import{G as E}from"./gift-CTFOmabt.js";import{C as F}from"./chart-column-CkmnPK7b.js";import{C as P}from"./clock-FGUEOtyb.js";import{U as R}from"./user-plus-CmkCVu78.js";import{S as B}from"./share-2-yiFtMd89.js";import{W as L}from"./wallet-CGdsCEpD.js";import{T as W}from"./trending-up-NKgnhIob.js";import{C as q}from"./circle-check-big-BgDAPNZx.js";const V=()=>{const{t}=v(),{user:a,loading:c}=w(),r=C(),[n,o]=l.useState(!1),[j,f]=l.useState(!0);k(),l.useEffect(()=>{c||(async()=>{if(!a){f(!1);return}try{const{data:i}=await g.from("affiliates").select("id, status").eq("user_id",a.id).maybeSingle();if(i){r("/account?tab=affiliate",{replace:!0});return}}catch(i){console.error("Error checking affiliate status:",i)}finally{f(!1)}})()},[a,c,r]);const N=async()=>{if(!a){r("/auth?redirect=/devenir-affilie");return}o(!0);try{const{data:s,error:i}=await g.functions.invoke("register-affiliate");if(i)throw i;s.success?(m.success(s.message),r("/account?tab=affiliate")):m.error(s.error)}catch{m.error(t("becomeAffiliate.registerError"))}finally{o(!1)}},A=[{icon:U,text:t("becomeAffiliate.commissionText"),highlight:!0},{icon:E,text:t("becomeAffiliate.discountText"),highlight:!0},{icon:F,text:t("becomeAffiliate.dashboard")},{icon:P,text:t("becomeAffiliate.payments")}],y=[{icon:R,step:1,title:t("becomeAffiliate.step1"),description:t("becomeAffiliate.step1Desc")},{icon:B,step:2,title:t("becomeAffiliate.step2"),description:t("becomeAffiliate.step2Desc")},{icon:S,step:3,title:t("becomeAffiliate.step3"),description:t("becomeAffiliate.step3Desc")},{icon:L,step:4,title:t("becomeAffiliate.step4"),description:t("becomeAffiliate.step4Desc")}];return c||j?e.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:e.jsx(d,{className:"w-8 h-8 animate-spin text-primary"})}):e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx(T,{}),e.jsx("main",{className:"pt-28 pb-12 md:pt-32 md:pb-20",children:e.jsx("div",{className:"container mx-auto px-4",children:e.jsxs("div",{className:"max-w-4xl mx-auto",children:[e.jsxs("div",{className:"text-center mb-12",children:[e.jsxs("div",{className:"inline-flex items-center gap-2 px-4 py-2 rounded-full bg-primary/10 text-primary mb-6",children:[e.jsx(W,{className:"w-4 h-4"}),e.jsx("span",{className:"text-sm font-medium",children:t("becomeAffiliate.badge")})]}),e.jsxs("h1",{className:"text-3xl md:text-4xl lg:text-5xl font-bold mb-4",children:[t("becomeAffiliate.title"),e.jsx("br",{className:"hidden md:block"}),e.jsx("span",{className:"text-primary",children:t("becomeAffiliate.commission")})]}),e.jsx("p",{className:"text-lg text-muted-foreground max-w-2xl mx-auto",children:t("becomeAffiliate.subtitle")})]}),e.jsx(b,{className:"mb-12 overflow-hidden",children:e.jsx(u,{className:"p-0",children:e.jsxs("div",{className:"grid lg:grid-cols-2",children:[e.jsxs("div",{className:"p-8 lg:p-10",children:[e.jsx("h2",{className:"text-xl font-semibold mb-6",children:t("becomeAffiliate.benefits")}),e.jsx("div",{className:"space-y-4 mb-8",children:A.map((s,i)=>e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:`w-12 h-12 rounded-xl flex items-center justify-center shrink-0 ${s.highlight?"bg-primary text-primary-foreground":"bg-primary/10"}`,children:e.jsx(s.icon,{className:`w-6 h-6 ${s.highlight?"":"text-primary"}`})}),e.jsx("span",{className:s.highlight?"font-medium":"",children:s.text})]},i))}),e.jsx("div",{className:"space-y-3",children:[t("becomeAffiliate.freeSignup"),t("becomeAffiliate.validation24h"),t("becomeAffiliate.noCommitment")].map((s,i)=>e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(q,{className:"w-4 h-4 text-green-500"}),e.jsx("span",{children:s})]},i))})]}),e.jsxs("div",{className:"bg-gradient-to-br from-primary to-primary/80 p-8 lg:p-10 flex flex-col justify-center text-white",children:[e.jsx("h3",{className:"text-2xl font-bold mb-4",children:t(a?"becomeAffiliate.signUpNow":"becomeAffiliate.createAccount")}
1),e.jsx("p",{className:"text-white/90 mb-8",children:t(a?"becomeAffiliate.signUpDesc":"becomeAffiliate.loginDesc")}),e.jsx(x,{onClick:N,disabled:n,size:"lg",variant:"secondary",className:"w-full py-6 text-lg gap-2",children:n?e.jsxs(e.Fragment,{children:[e.jsx(d,{className:"w-5 h-5 animate-spin"}),t("becomeAffiliate.registering")]}):e.jsxs(e.Fragment,{children:[t(a?"becomeAffiliate.becomeAffiliate":"becomeAffiliate.loginToJoin"),e.jsx(h,{className:"w-5 h-5"})]})}),e.jsxs("p",{className:"text-sm text-white/70 mt-4 text-center",children:[t("becomeAffiliate.termsAgree")," ",e.jsx(p,{to:"/affiliate-terms",className:"underline hover:text-white",children:t("becomeAffiliate.affiliateTerms")})]})]})]})})}),e.jsxs("div",{className:"mb-12",children:[e.jsx("h2",{className:"text-2xl font-bold text-center mb-8",children:t("becomeAffiliate.howItWorks")}),e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:y.map((s,i)=>e.jsx(b,{className:"text-center",children:e.jsxs(u,{className:"pt-6 pb-4",children:[e.jsx("div",{className:"w-10 h-10 bg-primary text-primary-foreground rounded-full flex items-center justify-center mx-auto mb-3 text-lg font-bold",children:s.step}),e.jsx(s.icon,{className:"w-8 h-8 text-primary mx-auto mb-2"}),e.jsx("h3",{className:"font-semibold mb-1",children:s.title}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s.description})]})},i))})]}),e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-muted-foreground mb-4",children:t("becomeAffiliate.learnMore")}),e.jsx(x,{variant:"outline",asChild:!0,children:e.jsxs(p,{to:"/affiliation",className:"gap-2",children:[t("becomeAffiliate.discoverProgram"),e.jsx(h,{className:"w-4 h-4"})]})})]})]})})}),e.jsx(D,{})]})};export{V 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.