1import{u as L,c as F,b6 as M,r as k,W as $,F as q,j as e,C as d,K as c,b as A,N as o,aa as m,I as B,n as T,a as x,B as h,O as D,p as R,b9 as H,a4 as n,G as O,ao as U,Q as W}from"./index-tc5-nNLC.js";import{u as G,t as K}from"./zod-Bu1KJ1kD.js";import{L as i}from"./label-MwGx_WS4.js";import{T as Q}from"./textarea-DN2rY_yY.js";import{I as S}from"./instagram-1o4cdpgt.js";import{Y as J}from"./youtube-BIudLhIY.js";import{T as X}from"./twitter-DFPk9uR7.js";import{o as z,b as Z,s as l,e as _}from"./types-BkAQ3Jcx.js";const ee=z({firstName:l().min(1,"First name is required"),lastName:l().min(1,"Last name is required"),email:l().email("Valid email is required"),phone:l().optional(),bio:l().optional(),instagram:l().optional(),tiktok:l().optional(),youtube:l().optional(),twitter:l().optional(),payoutMethod:_(["stripe","paypal","bank"]).optional(),payoutEmail:l().email().optional(),agreeToTerms:Z().refine(u=>u===!0,"You must agree to the terms")});function oe(){var y,w,v;const[,u]=L(),{toast:j}=F(),[,p]=M("/onboarding/campaign/:token"),b=p==null?void 0:p.token,[r,N]=k.useState(1),[C,P]=k.useState(!1),{data:s,isLoading:E,error:I}=$({queryKey:["/api/onboarding/campaign",b],enabled:!!b}),t=G({resolver:K(ee),defaultValues:{firstName:"",lastName:"",email:"",phone:"",bio:"",instagram:"",tiktok:"",youtube:"",twitter:"",payoutMethod:void 0,payoutEmail:"",agreeToTerms:!1}}),g=q({mutationFn:async a=>W("POST",`/api/onboarding/campaign/${b}/complete`,a),onSuccess:()=>{P(!0),j({title:"Welcome to the team!",description:"Your profile has been created and you're ready to start."})},onError:a=>{j({title:"Error",description:a.message||"Failed to complete onboarding",variant:"destructive"})}});if(E)return e.jsx("div",{className:"min-h-screen bg-gradient-to-br from-slate-900 via-slate-800 to-slate-900 flex items-center justify-center",children:e.jsxs("div",{className:"text-white text-center",children:[e.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-amber-500 mx-auto mb-4"}),e.jsx("p",{children:"Loading your invitation..."})]})});if(I||!s)return e.jsx("div",{className:"min-h-screen bg-gradient-to-br from-slate-900 via-slate-800 to-slate-900 flex items-center justify-center p-4",children:e.jsx(d,{className:"max-w-md w-full bg-slate-900/80 border-red-500/30",children:e.jsxs(c,{className:"text-center",children:[e.jsx(A,{className:"w-16 h-16 text-red-500 mx-auto mb-4"}),e.jsx(o,{className:"text-white",children:"Invalid or Expired Link"}),e.jsx(m,{className:"text-slate-400",children:"This onboarding link is no longer valid. Please contact your campaign manager for a new invitation."})]})})});if(s.isExpired)return e.jsx("div",{className:"min-h-screen bg-gradient-to-br from-slate-900 via-slate-800 to-slate-900 flex items-center justify-center p-4",children:e.jsx(d,{className:"max-w-md w-full bg-slate-900/80 border-amber-500/30",children:e.jsxs(c,{className:"text-center",children:[e.jsx(B,{className:"w-16 h-16 text-amber-500 mx-auto mb-4"}),e.jsx(o,{className:"text-white",children:"Link Expired"}),e.jsx(m,{className:"text-slate-400",children:"This invitation link has expired. Please contact your campaign manager to receive a new link."})]})})});if(s.isCompleted||C)return e.jsx("div",{className:"min-h-screen bg-gradient-to-br from-slate-900 via-slate-800 to-slate-900 flex items-center justify-center p-4",children:e.jsxs(d,{className:"max-w-md w-full bg-slate-900/80 border-emerald-500/30",children:[e.jsxs(c,{className:"text-center",children:[e.jsx("div",{className:"w-20 h-20 bg-emerald-500/20 rounded-full flex items-center justify-center mx-auto mb-4",children:e.jsx(T,{className:"w-10 h-10 text-emerald-500"})}),e.jsx(o,{className:"text-white text-2xl",children:"You're All Set!"}),e.jsxs(m,{className:"text-slate-400",children:["Your profile is complete and you're ready to start earning with ",s.campaign.name,"."]})]}),e.jsx(x,{className:"text-center",children:e.jsx(h,{onClick:()=>u("/login"),className:"bg-amber-500 hover:bg-amber-600 text-black","data-testid":"button-go-to-login",children:"Sign In to Your Account"})})]})});const f=[{id:1,title:"Profile",description:"Your info"},{id:2,title:"Social",description:"Connect accounts"},{id:3,title:"Payout",description:"Get paid"}],V=t.handleSubmit(a=>{g.mutate(a)});return e.jsx("div",{className:"min-h-screen bg-gradient-to-br from-slate-900 via-slate-800 to-slate-900",children:e.jsx("div",{className:"container mx-auto px-4 py-8",children:e.jsxs("div",{className:"max-w-2xl mx-auto",children:[e.jsxs("div",{className:"text-center mb-8",children:[e.jsxs(D,{className:"bg-amber-500/20 text-amber-400 border-amber-500/30 mb-4",children:[e.jsx(R,{className:"w-3 h-3 mr-1"}),"Campaign Invitation"]}),e.jsxs("h1",{className:"text-3xl font-bold text-white mb-2",children:["Welcome, ",s.influencer.name,"!"]}),e.jsxs("p",{className:"text-slate-400",children:["You've been invited to join ",e.jsx("span",{className:"text-amber-400 font-medium",children:s.campaign.name}),((y=s.customer)==null?void 0:y.name)&&` by ${s.customer.name}`]})]}),e.jsx("div",{className:"flex justify-center gap-4 mb-8",children:f.map((a,Y)=>e.jsxs("div",{className:"flex items-center",children:[e.jsxs("div",{className:`flex items-center gap-2 px-4 py-2 rounded-full transition-colors ${a.id===r?"bg-amber-500/20 border border-amber-500/30":a.id<r?"bg-emerald-500/20 border border-emerald-500/30":"bg-slate-800/50"}`,children:[e.jsx("div",{className:`w-6 h-6 rounded-full flex items-center justify-center text-xs font-medium ${a.id===r?"bg-amber-500 text-black":a.id<r?"bg-emerald-500 text-white":"bg-slate-700 text-slate-400"}`,children:a.id<r?e.jsx(T,{className:"w-3 h-3"}):a.id}),e.jsx("span",{className:a.id===r?"text-white":"text-slate-400",children:a.title})]}),Y<f.length-1&&e.jsx("div",{className:`w-8 h-0.5 mx-2 ${a.id<r?"bg-emerald-500":"bg-slate-700"}`})]},a.id))}),e.jsx("form",{onSubmit:V,children:e.jsxs(d,{className:"bg-slate-900/80 border-slate-700 backdrop-blur-sm",children:[r===1&&e.jsxs(e.Fragment,{children:[e.jsxs(c,{children:[e.jsxs(o,{className:"text-white flex items-center gap-2",children:[e.jsx(H,{className:"w-5 h-5 text-amber-500"}),"Your Profile"]}),e.jsx(m,{children:"Tell us about yourself"})]}),e.jsxs(x,{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{className:"text-white",children:"First Name *"}),e.jsx(n,{...t.register("firstName"),className:"bg-slate-800 border-slate-700 text-white",placeholder:"John",defaultValue:((w=s.influencer.name)==null?void 0:w.split(" ")[0])||"","data-testid":"input-first-name"}),t.formState.errors.firstName&&e.jsx("p",{className:"text-red-400 text-sm",children:t.formState.errors.firstName.message})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{className:"text-white",children:"Last Name *"}),e.jsx(n,{...t.register("lastName"),className:"bg-slate-800 border-slate-700 text-white",placeholder:"Doe",defaultValue:((v=s.influencer.name)==null?void 0:v.split(" ").slice(1).join(" "))||"","data-testid":"input-last-name"}),t.formState.errors.lastName&&e.jsx("p",{className:"text-red-400 text-sm",children:t.formState.errors.lastName.message})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{className:"text-white",children:"Email *"}),e.jsx(n,{...t.register("email"),type:"email",className:"bg-slate-800 border-slate-700 text-white",placeholder:"[email protected]",defaultValue:s.influencer.email||"","data-testid":"input-email"}),t.formState.errors.email&&e.jsx("p",{className:"text-red-400 text-sm",children:t.formState.errors.email.message})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{className:"text-white",children:"Phone"}),e.jsx(n,{...t.register("phone"),className:"bg-slate-800 border-slate-700 text-white",placeholder:"+1 (555) 123-4567",defaultValue:s.influencer.phone||"","data-testid":"input-phone"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{className:"text-white",children:"Bio"}),e.jsx(Q,{...t.register("bio"),className:"bg-slate-800 border-slate-700 text-white min-h-[100px]",placeholder:"Tell us a bit about yourself...","data-testid":"input-bio"})]})]})]}),r===2&&e.jsxs(e.Fragment,{children:[e.jsxs(c,{children:[e.jsxs(o,{className:"text-white flex items-center gap-2",children:[e.jsx(S,{className:"w-5 h-5 text-amber-500"}
1),"Social Accounts"]}),e.jsx(m,{children:"Connect your social media (optional)"})]}),e.jsxs(x,{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(i,{className:"text-white flex items-center gap-2",children:[e.jsx(S,{className:"w-4 h-4"})," Instagram"]}),e.jsx(n,{...t.register("instagram"),className:"bg-slate-800 border-slate-700 text-white",placeholder:"@username",defaultValue:s.influencer.instagram||"","data-testid":"input-instagram"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{className:"text-white flex items-center gap-2",children:"TikTok"}),e.jsx(n,{...t.register("tiktok"),className:"bg-slate-800 border-slate-700 text-white",placeholder:"@username",defaultValue:s.influencer.tiktok||"","data-testid":"input-tiktok"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(i,{className:"text-white flex items-center gap-2",children:[e.jsx(J,{className:"w-4 h-4"})," YouTube"]}),e.jsx(n,{...t.register("youtube"),className:"bg-slate-800 border-slate-700 text-white",placeholder:"Channel URL or username",defaultValue:s.influencer.youtube||"","data-testid":"input-youtube"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(i,{className:"text-white flex items-center gap-2",children:[e.jsx(X,{className:"w-4 h-4"})," Twitter/X"]}),e.jsx(n,{...t.register("twitter"),className:"bg-slate-800 border-slate-700 text-white",placeholder:"@username",defaultValue:s.influencer.twitter||"","data-testid":"input-twitter"})]})]})]}),r===3&&e.jsxs(e.Fragment,{children:[e.jsxs(c,{children:[e.jsxs(o,{className:"text-white flex items-center gap-2",children:[e.jsx(O,{className:"w-5 h-5 text-amber-500"}),"Payout Setup"]}),e.jsx(m,{children:"How would you like to receive payments?"})]}),e.jsxs(x,{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{className:"text-white",children:"Payout Method"}),e.jsx("div",{className:"grid grid-cols-3 gap-3",children:["stripe","paypal","bank"].map(a=>e.jsx("button",{type:"button",onClick:()=>t.setValue("payoutMethod",a),className:`p-4 rounded-lg border text-center transition-colors ${t.watch("payoutMethod")===a?"bg-amber-500/20 border-amber-500 text-white":"bg-slate-800 border-slate-700 text-slate-400 hover:border-slate-600"}`,"data-testid":`button-payout-${a}`,children:a.charAt(0).toUpperCase()+a.slice(1)},a))})]}),t.watch("payoutMethod")==="paypal"&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{className:"text-white",children:"PayPal Email"}),e.jsx(n,{...t.register("payoutEmail"),type:"email",className:"bg-slate-800 border-slate-700 text-white",placeholder:"[email protected]","data-testid":"input-payout-email"})]}),e.jsx(U,{className:"bg-slate-700 my-6"}),e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("input",{type:"checkbox",...t.register("agreeToTerms"),className:"mt-1","data-testid":"checkbox-terms"}),e.jsxs(i,{className:"text-slate-400 text-sm",children:["I agree to the ",e.jsx("a",{href:"/terms",className:"text-amber-400 hover:underline",children:"Terms of Service"})," and ",e.jsx("a",{href:"/privacy",className:"text-amber-400 hover:underline",children:"Privacy Policy"}),". I understand that my earnings will be paid out according to the campaign terms."]})]}),t.formState.errors.agreeToTerms&&e.jsx("p",{className:"text-red-400 text-sm",children:t.formState.errors.agreeToTerms.message})]})]}),e.jsxs("div",{className:"p-6 pt-0 flex justify-between",children:[r>1?e.jsx(h,{type:"button",variant:"outline",onClick:()=>N(r-1),"data-testid":"button-back",children:"Back"}):e.jsx("div",{}),r<3?e.jsx(h,{type:"button",onClick:()=>N(r+1),className:"bg-amber-500 hover:bg-amber-600 text-black","data-testid":"button-next",children:"Continue"}):e.jsx(h,{type:"submit",className:"bg-amber-500 hover:bg-amber-600 text-black",disabled:g.isPending,"data-testid":"button-complete",children:g.isPending?"Completing...":"Complete Setup"})]})]})}),e.jsx("p",{className:"text-center text-slate-500 text-sm mt-8",children:"Having trouble? Contact [email protected] for help."})]})})})}export{oe 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.