PageSourceSearch

https://hopelia.com/assets/app.parrainage-7aFM_IaB.js

js hopelia.com collected 2026-09-24 14:46:34 UTC 10,206 bytes, 1 lines download raw bytes

1import{bJ as N,bK as y,j as e,L as P,B as h,bL as p,t as m,r as g}from"./index-DveFA38Q.js";import{P as w}from"./PageTitle-CLOtybkc.js";import{I as b}from"./input-Bgc_cqFg.js";import{S as z}from"./skeleton-1BtWIr2P.js";import{u as C,b as k,c as L,d as S}from"./useReferral-g0JpnpZw.js";import{S as E}from"./star-B4Ot62XL.js";import{H as j}from"./hand-coins-AOEYZK42.js";import{C as D}from"./copy-BMNs6JxP.js";import{P as F}from"./pencil-JPrQ3P9I.js";import{U as I}from"./users-Dz_qc2xP.js";import{B as v}from"./badge-check-hiAa7_Yv.js";import{G as R}from"./gift-CCz80uUd.js";import"./useMutation-66Cllo-Z.js";function V(){const{data:t,isLoading:n,isError:a}=C(),{data:s}=k(),r=t?.alias||t?.code||"",d=r?N(r,typeof window<"u"?window.location.origin:null):"",c=async()=>{if(d)try{await navigator.clipboard.writeText(d),m.success("Lien de parrainage copié !")}catch{m.error("Impossible de copier le lien, sélectionnez-le à la main.")}},i=t?.isInfluenceur??!1,o=y(t?.rate),f=(s??[]).some(u=>u.statut==="demande");return e.jsxs("div",{className:"bg-card border border-border rounded-2xl p-6 space-y-4",children:[i&&e.jsx("div",{className:"flex flex-wrap items-center gap-2",children:e.jsxs("span",{className:"inline-flex items-center gap-1.5 rounded-full border border-primary/20 bg-primary/10 px-2.5 py-0.5 text-xs font-semibold text-primary",children:[e.jsx(E,{className:"size-3"})," Espace influenceur, taux ",o]})}),e.jsxs("div",{className:"bg-primary/10 border border-primary/25 rounded-xl p-5 flex items-start gap-4",children:[e.jsx(j,{className:"size-8 text-primary shrink-0 mt-0.5"}),e.jsxs("div",{children:[e.jsxs("div",{className:"text-2xl font-display font-bold text-primary leading-tight",children:[o," reversés, tous les mois"]}),e.jsxs("p",{className:"text-sm text-foreground/90 mt-1",children:["Vous touchez ",e.jsxs("span",{className:"font-semibold",children:[o," de chaque abonnement"]})," ","payé par une personne que vous avez invitée, chaque mois, tant qu'elle reste abonnée."]})]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground/80",children:["Les gains s'accumulent ici. Quand vous voulez, demandez votre versement (IBAN ou PayPal), traité sous quelques jours ouvrés. En participant, vous acceptez les conditions du programme (",e.jsx(P,{to:"/cgu",className:"text-primary hover:underline",children:"CGU, section 12"}),") et vous êtes responsable de vos propres impôts sur ces gains."]}),n?e.jsx(z,{className:"h-24 rounded-xl"}):a||!t?.code?e.jsx("p",{className:"text-sm text-muted-foreground",children:"Votre lien de parrainage n'est pas disponible pour le moment, réessayez dans un instant."}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(b,{readOnly:!0,value:d,onFocus:u=>u.currentTarget.select(),"aria-label":"Votre lien de parrainage",className:"font-mono text-sm"}),e.jsxs(h,{variant:"outline",onClick:c,className:"shrink-0",children:[e.jsx(D,{className:"size-4"}),"Copier"]})]}),e.jsx(q,{currentAlias:t.alias,code:t.code}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[e.jsx(x,{label:"Filleuls inscrits",value:String(t.filleuls)}),e.jsx(x,{label:"Filleuls abonnés",value:String(t.filleulsAbonnes)}),e.jsx(x,{label:"Gains en attente",value:p(t.gainsDusCents),highlight:!0}),e.jsx(x,{label:"Déjà versés",value:p(t.gainsPayesCents)})]}),e.jsx(A,{rows:t.filleulsList??[]}),e.jsx(B,{gainsDusCents:t.gainsDusCents,hasPending:f}),s&&s.length>0&&e.jsx(T,{requests:s})]})]})}function q({currentAlias:t,code:n}){const[a,s]=g.useState(t??""),r=L(),d=a.trim().toLowerCase()||t||n||"votrenom",c=()=>{const i=a.trim().toLowerCase();!i||i===t||r.mutate(i,{onSuccess:o=>m.success(`Votre lien est maintenant hopelia.com/r/${o}`),onError:o=>m.error(o instanceof Error?o.message:"Identifiant impossible.")})};return e.jsxs("div",{className:"bg-muted/30 border border-border rounded-xl p-4 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(F,{className:"size-4 text-primary"}),e.jsx("h3",{className:"text-sm font-semibold",children:"Personnalisez votre lien"})]}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Choisissez la fin de votre lien (votre nom, votre pseudo…). Il devient plus facile à partager :"," ",e.jsxs("span",{className:"font-mono text-foreground",children:["hopelia.com/r/",d]})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 sm:items-center",children:[e.jsxs("div",{className:"flex items-center gap-1.5 flex-1 min-w-0",children:[e.jsx("span",{className:"text-sm text-muted-foreground shrink-0 font-mono",children:"hopelia.com/r/"}),e.jsx(b,{value:a,onChange:i=>s(i.target.value),onKeyDown:i=>i.key==="Enter"&&c(),placeholder:n??"votrenom","aria-label":"Fin personnalisée de votre lien",className:"font-mono text-sm",maxLength:24})]}),e.jsx(h,{variant:"outline",className:"shrink-0",disabled:r.isPending||!a.trim()||a.trim().toLowerCase()===t,onClick:c,children:r.isPending?"…":"Enregistrer"})]}
1),e.jsx("p",{className:"text-xs text-muted-foreground/80",children:"3 à 24 caractères : lettres minuscules, chiffres et tirets. Votre ancien lien continue de fonctionner."})]})}function A({rows:t}){const n=s=>{if(!s)return"";const r=new Date(s);return isFinite(r.getTime())?r.toLocaleDateString("fr-FR"):""},a=s=>s==="pro"?"Pro":s==="perso"?"Perso":"";return e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(I,{className:"size-4 text-primary"}),e.jsx("h3",{className:"text-sm font-semibold",children:"Mes filleuls"})]}),t.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:"Personne pour l'instant. Partagez votre lien : vos filleuls apparaîtront ici, avec leur statut d'abonnement."}):e.jsx("ul",{className:"divide-y divide-border rounded-xl border border-border overflow-hidden",children:t.map((s,r)=>e.jsxs("li",{className:"flex items-center justify-between gap-3 px-4 py-2.5 text-sm bg-card",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"font-medium truncate",children:s.email||"Filleul"}),s.joinedAt&&e.jsxs("div",{className:"text-xs text-muted-foreground",children:["Inscrit le ",n(s.joinedAt)]})]}),s.subscribed?e.jsxs("span",{className:"inline-flex items-center gap-1 shrink-0 text-xs font-medium rounded-full px-2 py-0.5 text-primary bg-primary/10",children:[e.jsx(v,{className:"size-3"})," Abonné · ",a(s.plan)]}):e.jsx("span",{className:"inline-flex items-center shrink-0 text-xs font-medium rounded-full px-2 py-0.5 text-muted-foreground bg-muted",children:"Inscrit"})]},r))})]})}function x({label:t,value:n,highlight:a}){return e.jsxs("div",{className:"bg-muted/40 border border-border rounded-xl p-3",children:[e.jsx("div",{className:"text-xs uppercase tracking-wider text-muted-foreground",children:t}),e.jsx("div",{className:`text-lg font-semibold tabular-nums mt-0.5 ${a?"text-primary":""}`,children:n})]})}function B({gainsDusCents:t,hasPending:n}){const[a,s]=g.useState("iban"),[r,d]=g.useState(""),c=S(),i=t<=0,o=r.trim().length===0,f=i||n||o||c.isPending,u=()=>{c.mutate({method:a,details:r.trim()},{onSuccess:()=>{m.success("Demande de versement enregistrée. Elle sera traitée sous quelques jours ouvrés."),d("")},onError:l=>m.error(l instanceof Error?l.message:"Demande impossible.")})};return e.jsxs("div",{className:"bg-muted/30 border border-border rounded-xl p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(j,{className:"size-4 text-primary"}),e.jsx("h3",{className:"text-sm font-semibold",children:"Demander mon versement"})]}),n?e.jsx("p",{className:"text-sm text-muted-foreground",children:"Vous avez déjà une demande en cours de traitement. Son statut passera à « Versé » une fois réglée."}):i?e.jsx("p",{className:"text-sm text-muted-foreground",children:"Vous n'avez pas encore de gains à verser. Ils apparaîtront ici au premier paiement d'un filleul."}):e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Montant à verser :"," ",e.jsx("span",{className:"font-semibold text-foreground",children:p(t)}),". Choisissez votre moyen de versement et renseignez vos coordonnées."]}),e.jsx("div",{className:"inline-flex rounded-lg border border-border bg-background p-0.5 text-sm",children:["iban","paypal"].map(l=>e.jsx("button",{type:"button",onClick:()=>s(l),className:`rounded-md px-3 py-1.5 font-medium transition-colors ${a===l?"bg-primary/15 text-primary":"text-muted-foreground"}`,children:l==="iban"?"IBAN":"PayPal"},l))}),e.jsx(b,{value:r,onChange:l=>d(l.target.value),placeholder:a==="iban"?"Votre IBAN (FR76...)":"Votre email PayPal","aria-label":"Coordonnées de versement",maxLength:200}),e.jsx(h,{onClick:u,disabled:f,children:c.isPending?"Envoi…":"Demander mon versement"})]})]})}function T({requests:t}){const n={demande:"En attente",paye:"Versé",refuse:"Refusé"},a=s=>{const r=new Date(s);return isFinite(r.getTime())?r.toLocaleDateString("fr-FR"):""};return e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-semibold",children:"Mes demandes de versement"}),e.jsx("ul",{className:"divide-y divide-border rounded-xl border border-border overflow-hidden",children:t.map(s=>e.jsxs("li",{className:"flex items-center justify-between gap-3 px-4 py-2.5 text-sm bg-card",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("span",{className:"tabular-nums font-semibold",children:p(s.montant_cents)}),e.jsxs("span",{className:"text-muted-foreground truncate",children:[s.method==="iban"?"IBAN":"PayPal"," · ",a(s.created_at)]})]}),e.jsxs("span",{className:`inline-flex items-center gap-1 shrink-0 text-xs font-medium rounded-full px-2 py-0.5 ${s.statut==="paye"?"text-primary bg-primary/10":s.statut==="refuse"?"text-destructive bg-destructive/10":"text-muted-foreground bg-muted"}`,children:[s.statut==="paye"&&e.jsx(v,{className:"size-3"}),n[s.statut]]})]},s.id))})]})}function Z(){return e.jsxs("div",{className:"px-4 md:px-8 py-6 max-w-3xl mx-auto",children:[e.jsx("header",{className:"mb-5",children:e.jsx(w,{icon:R,children:"Parrainage"})}),e.jsx(V,{})]})}
1export{Z as component};

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.