PageSourceSearch

https://app.tradersedge.io/assets/MyReferralsPage-Cui9i1Yh.js

js tradersedge.io collected 2026-10-02 01:59:57 UTC 7,907 bytes, 1 lines download raw bytes

1import{q as F,u as M,r as y,b as U,z as Q,b5 as B,b6 as n,b7 as r,b9 as e,b8 as a,bd as h,a6 as x,bx as u,bw as m,ba as d,bG as I,ac as k,bc as c,bA as A,bB as Y,bb as z,bC as P,aZ as q,a_ as w,N as p}from"./index-ZTZX6O4r.js";import{Q as V}from"./QPage-OM5JgPVG.js";import{c as W}from"./copy-to-clipboard-CrbYhwaz.js";import{f as G}from"./formatDistanceToNow-DTeh1iPw.js";import{_ as $}from"./_plugin-vue_export-helper-DlAUqK2U.js";import"./normalizeDates-CacZHBiA.js";import"./en-US-3LvP7pCn.js";const H={class:"q-pa-md"},Z={class:"page-header q-mb-lg"},j={class:"text-h4 q-mt-none q-mb-sm"},J={key:0,class:"referral-section"},K={class:"q-mb-md"},O={class:"row q-col-gutter-sm"},X={class:"col"},ee={class:"col-auto"},te={class:"q-mb-sm"},se={class:"text-h6 text-primary q-mt-xs"},ae={key:1,class:"referral-section"},re={class:"row q-col-gutter-md q-mb-lg"},oe={class:"col-12 col-sm-6 col-md-4"},ie={class:"text-h4 text-primary"},le={class:"col-12 col-sm-6 col-md-4"},ne={class:"text-h4 text-info"},de={class:"col-12 col-sm-6 col-md-4"},ce={class:"text-h4 text-positive"},ue={key:0,class:"text-center te-text-secondary q-py-lg"},me={key:1,class:"activity-timeline"},pe={class:"timeline-marker"},ve={key:0,class:"timeline-line"},ye={class:"activity-content"},fe={class:"activity-header"},ge={class:"activity-title"},be={class:"activity-time"},_e={class:"text-caption te-text-secondary"},he=F({__name:"MyReferralsPage",setup(xe){const C=M(),l=y({hasCode:!1,code:null}),v=y([]),g=y(!1),f=y(!1),b=U(()=>l.value.code?`https://app.tradersedge.io/register?ref=${l.value.code.code}`:""),R=()=>{const t=(C.user?.displayName??"").replace(/\s+/g,"").toLowerCase();return t.length>=3?t:t+Math.floor(Math.random()*1e4).toString().padStart(4,"0")},_=async()=>{g.value=!0;try{const i=(await q(w,"getUserReferralStats")()).data;l.value={hasCode:i.hasCode||!1,code:i.code??null},v.value=(i.events||[]).map(o=>({id:o.id||`${o.type}-${o.timestamp}`,type:o.type||"signup",userName:o.userDisplayName||"Unknown User",userEmail:o.userEmail||"",timestamp:o.timestamp?new Date(o.timestamp):new Date})).sort((o,D)=>new Date(D.timestamp).getTime()-new Date(o.timestamp).getTime())}catch(s){console.error("Error loading referral stats:",s),p.create({type:"negative",message:"Failed to load referral stats",position:"top"})}finally{g.value=!1}},S=async()=>{f.value=!0;try{const s=R();await q(w,"createReferralCode")({code:s,type:"user"}),p.create({type:"positive",message:"Referral code generated successfully",position:"top"}),await _()}catch(s){console.error("Error generating referral code:",s);let t="Failed to generate referral code";s instanceof Error&&s.message?.includes("already exists")&&(t="That code is already taken. Try a different name or contact support."),p.create({type:"negative",message:t,position:"top"})}finally{f.value=!1}},N=async()=>{try{await W(b.value),p.create({type:"positive",message:"Referral link copied to clipboard",position:"top"})}catch(s){console.error("Error copying link:",s),p.create({type:"negative",message:"Failed to copy link",position:"top"})}},T=s=>{try{return G(new Date(s),{addSuffix:!0})}catch{return"Unknown time"}},E=s=>{switch(s){case"signup":return"person_add";case"conversion":return"check_circle";case"cancellation":return"cancel";default:return"info"}},L=s=>{switch(s.type){case"signup":return"New signup via your link";case"conversion":return"Referred user subscribed to Pro";case"cancellation":return"Referred user cancelled subscription";default:return"Referral event"}};return Q(()=>{_()}),(s,t)=>(n(),B(V,{class:"my-referrals-page"},{default:r(()=>[e("div",H,[e("div",Z,[e("h4",j,[a(x,{name:"share",color:"primary",size:"md",class:"q-mr-sm"}),t[0]||(t[0]=h(" My Referrals ",-1))]),t[1]||(t[1]=e("p",{class:"text-subtitle1 te-text-secondary"},"Share TradersEdge and track your referrals",-1))]),a(u,{class:"te-card referral-link-card q-mb-lg"},{default:r(()=>[a(m,null,{default:r(()=>[t[7]||(t[7]=e("div",{class:"text-h6 q-mb-md"},"Your Referral Link",-1)),l.value.hasCode&&l.value.code?(n(),d("div",J,[e("div",K,[t[2]||(t[2]=e("div",{class:"text-caption te-text-secondary q-mb-xs"},"Your unique referral link",-1)),e("div",O,[e("div",X,[a(I,{"model-value":b.value,outlined:"",dense:"",readonly:"",class:"referral-input"},null,8,["model-value"])]),e("div",ee,[a(k,{color:"primary",label:"Copy Link",icon:"content_copy",onClick:N,unelevated:""})])])]),t[4]||(t[4]=e("div",{class:"divider q-my-md"},null,-1)),e("div",te,[t[3]||(t[3]=e("div",{class:"text-caption te-text-secondary"},"Your referral code",-1)),e("div",se,c(l.value.code.code),1)]),t[5]||(t[5]=e("p",{class:"text-caption te-text-secondary q-my-none"}," Share this link with traders. When they sign up, you'll see them here. ",-1))])):(n(),d("div",ae,[t[6]||(t[6]=e("p",{class:"te-text-secondary q-mb-md"}," Generate a unique referral link to start earning. When traders sign up using your link, you'll get credit and earn rewards. ",-1)),a(k,{color:"primary",label:"Generate My Referral Link",icon:"add",onClick:S,loading:f.value,unelevated:""},null,8,["loading"])]))]),_:1})]),_:1}),e("div",re,[e("div",oe,[a(u,{class:"te-card stats-card"},{default:r(()=>[a(m,null,{default:r(()=>[t[8]||(t[8]=e("div",{class:"text-subtitle2 te-text-secondary q-mb-sm"},"Total Signups",-1)),e("div",ie,c(l.value.code?.signups||0),1),t[9]||(t[9]=e("div",{class:"text-caption te-text-secondary q-mt-sm"}," people registered via your link ",-1))]),_:1})]),_:1})]),e("div",le,[a(u,{class:"te-card stats-card"},{default:r(()=>[a(m,null,{default:r(()=>[t[10]||(t[10]=e("div",{class:"text-subtitle2 te-text-secondary q-mb-sm"},"Conversions",-1)),e("div",ne,c(l.value.code?.conversions||0),1),t[11]||(t[11]=e("div",{class:"text-caption te-text-secondary q-mt-sm"},"became paid subscribers",-1))]),_:1})]),_:1})]),e("div",de,[a(u,{class:"te-card stats-card"},{default:r(()=>[a(m,null,{default:r(()=>[t[12]||(t[12]=e("div",{class:"text-subtitle2 te-text-secondary q-mb-sm"},"Active Subscribers",-1)),e("div",ce,c(l.value.code?.activeSubscribers||0),1),t[13]||(t[13]=e("div",{class:"text-caption te-text-secondary q-mt-sm"},"currently paying",-1))]),_:1})]),_:1})])]),a(u,{class:"te-card q-mb-lg"},{default:r(()=>[a(m,null,{default:r(()=>[t[14]||(t[14]=e("div",{class:"text-h6 q-mb-md"},"Recent Activity",-1)),v.value.length===0?(n(),d("div",ue," No referral activity yet. Share your link to get started! ")):(n(),d("div",me,[(n(!0),d(A,null,Y(v.value,(i,o)=>(n(),d("div",{key:i.id,class:"activity-item"},[e("div",pe,[e("div",{class:P(["timeline-dot",i.type])},null,2),o<v.value.length-1?(n(),d("div",ve)):z("",!0)]),e("div",ye,[e("div",fe,[e("div",ge,[a(x,{name:E(i.type),size:"sm",class:"q-mr-sm"},null,8,["name"]),h(" "+c(L(i)),1)]),e("div",be,c(T(i.timestamp)),1)]),e("div",_e,c(i.userName||"Unknown User"),1)])]))),128))]))]),_:1})]),_:1}),a(u,{class:"te-card how-it-works-card"},{default:r(()=>[a(m,null,{default:r(()=>[...t[15]||(t[15]=[e("div",{class:"text-h6 q-mb-lg"},"How It Works",-1),e("div",{class:"steps-container"},[e("div",{class:"step"},[e("div",{class:"step-number"},"1"),e("div",{class:"step-content"},[e("div",{class:"step-title"},"Share Your Link"),e("div",{class:"step-description"}," Copy your unique referral link and share it with traders you know ")])]),e("div",{class:"step-arrow"},"→"),e("div",{class:"step"},[e("div",{class:"step-number"},"2"),e("div",{class:"step-content"},[e("div",{class:"step-title"},"They Register"),e("div",{class:"step-description"}," When someone signs up through your link, you get credit ")])]),e("div",{class:"step-arrow"},"→"),e("div",{class:"step"},[e("div",{class:"step-number"},"3"),e("div",{class:"step-content"},[e("div",{class:"step-title"},"Track Your Impact"),e("div",{class:"step-description"}," Monitor signups, conversions, and active subscribers right here ")])])],-1)])]),_:1})]),_:1})])]),_:1}))}}),Te=$(he,[["__scopeId","data-v-0b51628e"]]);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.