1import{r as T,j as e,aN as q,U as B,I as l,B as h,t as z}from"./app-BD8wY1UD.js";import{u as M,t as P}from"./zod-DyUk3Xi_.js";import{P as H}from"./PageLayout-BbQYY1__.js";import{T as E}from"./textarea-BQAU7sVP.js";import{L as F}from"./label-DQvQuDC9.js";import{u as O}from"./use-toast-D3gVNqUP.js";import{s as y}from"./client-C-6XxzlQ.js";import{g as _,R as b,t as A,b as V}from"./advocacy-templates-6AC29Jic.js";import{S as W}from"./send-BITInEpy.js";import{C as $}from"./copy-BnJXadGX.js";import{o as D,s as o,l as f,u as G}from"./types-XuSYHhSx.js";import"./Footer-CvjNbGDh.js";import"./tslib.es6-CmEaCU22.js";const J=D({your_name:o().trim().min(1,"Required").max(120),your_company:o().trim().min(1,"Required").max(160),your_email:o().trim().email("Invalid email").max(255),referred_name:o().trim().max(120).optional().or(f("")),referred_company:o().trim().max(160).optional().or(f("")),referred_email:G([o().trim().email("Invalid email").max(255),f("")]).optional(),notes:o().trim().max(5e3).optional().or(f("")),honeypot:o().max(0).optional().or(f(""))});function ce(){var w,v,R,C,S,I,L;const{toast:m}=O(),[c,u]=T.useState(!1),[s,j]=T.useState(null),{register:t,handleSubmit:U,formState:{errors:n}}=M({resolver:P(J),defaultValues:{honeypot:""}}),Y=async r=>{if(r.honeypot&&r.honeypot.length>0){j(_(r.your_company));return}u(!0);try{let a=_(r.your_company);const d=`${b}${a}`,p={referral_code:a,referrer_name:r.your_name,referrer_company:r.your_company,referrer_email:r.your_email,original_company:r.your_company,source:"refer-page",referral_link:d};let{error:x}=await y.from("referral_sources").insert(p);if(x&&/duplicate|unique/i.test(x.message)&&(a=_(r.your_company),p.referral_code=a,p.referral_link=`${b}${a}`,x=(await y.from("referral_sources").insert(p)).error),x)throw x;j(a),A("referral_link_generated"),z({form_id:"partner_scoping",framework:"",lead_tier:"partner",conversion_source:"refer_page",location:"section"}),y.functions.invoke("notify-advocacy",{body:{type:"referral_generated",data:{...p,contact_name:r.your_name,company:r.your_company,email:r.your_email,notes:r.notes}}})}catch(a){const d=a instanceof Error?a.message:"Could not create link";m({title:"Submission failed",description:d,variant:"destructive"})}finally{u(!1)}},g=async(r,a,d)=>{try{await navigator.clipboard.writeText(r),m({title:"Copied to clipboard"}),A(a),s&&await y.rpc("track_referral_event",{_code:s,_event:d})}catch{m({title:"Copy failed",variant:"destructive"})}},N=s?`${b}${s}`:"",k=s?V(s):"";return e.jsxs(H,{children:[e.jsxs(q,{children:[e.jsx("title",{children:"Refer StealthNet | StealthNet AI"}),e.jsx("meta",{name:"robots",content:"noindex, nofollow"}),e.jsx("meta",{name:"description",content:"Refer a company to StealthNet. If they become a customer, we will give you a free AI pentest."})]}),e.jsxs("section",{className:"relative py-12 sm:py-16 overflow-hidden",children:[e.jsx("div",{className:"absolute inset-0 -z-10 opacity-40",children:e.jsx("div",{className:"absolute top-0 left-1/2 -translate-x-1/2 w-[800px] h-[400px] bg-primary/20 rounded-full blur-[120px]"})}),e.jsxs("div",{className:"container mx-auto px-4 max-w-2xl",children:[e.jsxs("header",{className:"text-center mb-8",children:[e.jsx("div",{className:"inline-flex items-center justify-center w-14 h-14 rounded-full bg-primary/15 ring-1 ring-primary/30 mb-4",children:e.jsx(B,{className:"w-7 h-7 text-primary"})}),e.jsx("h1",{className:"text-3xl sm:text-4xl font-bold tracking-tight mb-3",children:"Refer StealthNet"}),e.jsx("p",{className:"text-muted-foreground text-base sm:text-lg",children:"If your referral becomes a customer, we will give you a free AI pentest."})]}),s?e.jsxs("div",{className:"rounded-2xl border border-border/50 bg-card/40 backdrop-blur p-6 sm:p-8 space-y-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl sm:text-2xl font-semibold mb-2",children:"Your referral link is ready."}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"Share the link or use the intro message below."})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs uppercase tracking-wide text-muted-foreground mb-2",children:"Referral link"}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[e.jsx("code",{className:"flex-1 px-3 py-2 rounded-md bg-muted/50 text-sm break-all",children:N}),e.jsxs(h,{variant:"outline",onClick:()=>g(N,"referral_link_copied","referral_link_copied"),children:[e.jsx($,{className:"mr-2 w-4 h-4"}),"Copy link"]})]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs uppercase tracking-wide text-muted-foreground mb-2",children:"Intro message"}),e.jsx(E,{readOnly:!0,value:k,className:"min-h-[180px] mb-3 font-mono text-sm"}),e.jsxs(h,{variant:"outline",onClick:()=>g(k,"referral_intro_message_copied","intro_message_copied"),children:[e.jsx($,{className:"mr-2 w-4 h-4"}),"Copy intro message"]})]})]}):e.jsxs("form",{onSubmit:U(Y),className:"space-y-5 rounded-2xl border border-border/50 bg-card/40 backdrop-blur p-6 sm:p-8",children:[e.jsxs("div",{className:"sr-only","aria-hidden":"true",children:[e.jsx(F,{htmlFor:"company_url",children:"Company URL"}),e.jsx("input",{id:"company_url",type:"text",tabIndex:-1,autoComplete:"off",...t("honeypot")})]}),e.jsx(i,{label:"Your name",error:(w=n.your_name)==null?void 0:w.message,children:e.jsx(l,{...t("your_name")}
1)}),e.jsx(i,{label:"Your company",error:(v=n.your_company)==null?void 0:v.message,children:e.jsx(l,{...t("your_company")})}),e.jsx(i,{label:"Your email",error:(R=n.your_email)==null?void 0:R.message,children:e.jsx(l,{type:"email",...t("your_email")})}),e.jsx(i,{label:"Who would you like to refer? (optional)",error:(C=n.referred_name)==null?void 0:C.message,children:e.jsx(l,{...t("referred_name")})}),e.jsx(i,{label:"Referred company name (optional)",error:(S=n.referred_company)==null?void 0:S.message,children:e.jsx(l,{...t("referred_company")})}),e.jsx(i,{label:"Referred contact email (optional)",error:(I=n.referred_email)==null?void 0:I.message,children:e.jsx(l,{type:"email",...t("referred_email")})}),e.jsx(i,{label:"Notes (optional)",error:(L=n.notes)==null?void 0:L.message,children:e.jsx(E,{...t("notes")})}),e.jsxs(h,{type:"submit",size:"lg",className:"w-full",disabled:c,children:[c?"Creatingâ¦":"Create referral link",e.jsx(W,{className:"ml-2 w-4 h-4"})]})]})]})]})]})}function i({label:m,error:c,children:u}){return e.jsxs("div",{children:[e.jsx(F,{className:"block mb-2",children:m}),u,c&&e.jsx("p",{className:"text-sm text-destructive mt-1",children:c})]})}export{ce 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.