1import{c as U,k as z,aE as R,r as y,l as H,a3 as Q,D as W,E as G,j as e,aF as V,aG as Y,B as g,aH as J,aI as Z,aJ as X,aK as E,aL as q,aM as ee,ab as ae,aq as se,ar as te,as as re,at as ne,au as de,aB as j,I as S,aN as ie,a1 as le,F as ce,a9 as oe,u as me,f as B,q as L,C as w,a as C,S as pe,L as u,x as A,d as I,p as F,aO as ue,s as T}from"./index-CAQ9C6-z.js";import{S as xe}from"./SEO-DML7l8AZ.js";import{e as $,I as he,t as be,a as ge}from"./intakeQuestions-iYeXwBPH.js";import{C as je}from"./chevron-down--E-1bxpl.js";import{C as P}from"./circle-check-zN8KFlsu.js";import{M as fe}from"./megaphone-CkpqVfvO.js";/** 2 * @license lucide-react v0.453.0 - ISC 3 * 4 * This source code is licensed under the ISC license. 5 * See the LICENSE file in the root directory of this source tree. 6 */const Ne=U("Building2",[["path",{d:"M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z",key:"1b4qmf"}],["path",{d:"M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2",key:"i71pzd"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2",key:"10jefs"}],["path",{d:"M10 6h4",key:"1itunk"}],["path",{d:"M10 10h4",key:"tcdvrf"}],["path",{d:"M10 14h4",key:"kelpxr"}],["path",{d:"M10 18h4",key:"1ulq68"}]]),ye=["campaignGoals","targetDemographic","budgetRange"];function ve({question:s,answers:f,setAnswers:c}){const l=f[s.id];if(s.type==="chips-multi"){const n=Array.isArray(l)?l:[],r=t=>c(d=>{const m=d[s.id]??[],x=m.includes(t)?m.filter(i=>i!==t):[...m,t];return{...d,[s.id]:x}});return e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(j,{className:"text-sm",children:s.label}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:s.options.map(t=>{const d=n.includes(t.value);return e.jsxs("button",{type:"button",onClick:()=>r(t.value),className:`rounded-full border px-3 py-1 text-xs transition-colors ${d?"border-purple-500 bg-purple-500/10 text-purple-600":"border-muted-foreground/25 text-muted-foreground hover:border-purple-500/50"}`,"data-testid":`chip-${s.id}-${t.value}`,children:[d&&e.jsx(ce,{className:"mr-1 inline h-3 w-3"}),t.label]},t.value)})})]})}if(s.type==="chips-single"){const n=typeof l=="string"?l:"";return e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(j,{className:"text-sm",children:s.label}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:s.options.map(r=>{const t=n===r.value;return e.jsx("button",{type:"button",onClick:()=>c(d=>({...d,[s.id]:t?"":r.value})),className:`rounded-full border px-3 py-1 text-xs transition-colors ${t?"border-purple-500 bg-purple-500/10 text-purple-600":"border-muted-foreground/25 text-muted-foreground hover:border-purple-500/50"}`,"data-testid":`chip-${s.id}-${r.value}`,children:r.label},r.value)})})]})}const p=typeof l=="string"?l:"";return e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(j,{className:"text-sm",children:s.label}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:s.options.map(n=>e.jsxs("button",{type:"button",onClick:()=>c(r=>({...r,[s.id]:ge(r[s.id],n.value)})),className:"rounded-full border border-rose-400/40 bg-rose-400/5 px-3 py-1 text-xs text-rose-500 transition-colors hover:bg-rose-400/10","data-testid":`pill-${s.id}-${n.value}`,children:["+ ",n.label]},n.value))}),e.jsx(oe,{rows:s.rows??2,placeholder:s.placeholder,value:p,onChange:n=>c(r=>({...r,[s.id]:n.target.value})),"data-testid":`textarea-${s.id}`})]})}function we(){const{toast:s}=z(),{isAgency:f,brands:c,isLoading:l,activeManagedBrandId:p,activeManagedBrand:n,setActiveManagedBrandId:r}=R(),[t,d]=y.useState(!1),[m,x]=y.useState(""),[i,v]=y.useState(""),[h,N]=y.useState(""),[o,_]=y.useState($()),K=he.filter(a=>ye.includes(a.id)),M=H({mutationFn:async()=>{const a=be(o),b={brandName:m.trim(),...i.trim()?{industry:i.trim()}:{},...h.trim()?{websiteUrl:h.trim()}:{},...a};return(await G("POST","/api/agency/brands",b)).json()},onSuccess:async a=>{var b,D;await W.invalidateQueries({queryKey:["/api/agency/brands"]}),(b=a==null?void 0:a.brand)!=null&&b.id&&r(a.brand.id),s({title:"Brand added",description:`${((D=a==null?void 0:a.brand)==null?void 0:D.brandName)??"New brand"} is now active.`}),k(),d(!1)},onError:a=>{const b=a instanceof Q&&a.serverMessage||a.message;s({title:"Could not add brand",description:b,variant:"destructive"})}});function k(){x(""),v(""),N(""),_($())}if(!f)return null;const O=n?n.brandName:"My agency account";return e.jsxs(e.Fragment,{children:[e.jsxs(V,{children:[e.jsx(Y,{asChild:!0,children:e.jsxs(g,{variant:"outline",className:"gap-2 border-purple-500/30","data-testid":"button-brand-switcher",children:[e.jsx(Ne,{className:"h-4 w-4 text-purple-500"}),e.jsx("span",{className:"max-w-[12rem] truncate",children:O}),e.jsx(je,{className:"h-4 w-4 opacity-60"})]})}),e.jsxs(J,{align:"start",className:"w-64",children:[e.jsx(Z,{children:"Working as"}),e.jsxs(X,{value:p??"__self__",onValueChange:a=>r(a==="__self__"?null:a),children:[e.jsx(E,{value:"__self__","data-testid":"brand-option-self",children:"My agency account"}),c.map(a=>e.jsx(E,{value:a.id,"data-testid":`brand-option-${a.id}`,children:e.jsx("span",{className:"truncate",children:a.brandName})},a.id))]}),l&&e.jsx("div",{className:"px-2 py-1.5 text-xs text-muted-foreground",children:"Loading brandsâ¦"}),!l&&c.length===0&&e.jsx("div",{className:"px-2 py-1.5 text-xs text-muted-foreground",children:"No managed brands yet."}),e.jsx(q,{}),e.jsxs(ee,{onSelect:a=>{a.preventDefault(),d(!0)},"data-testid":"button-add-brand",children:[e.jsx(ae,{className:"mr-2 h-4 w-4"})," Add brand"]})]})]}),e.jsx(se,{open:t,onOpenChange:a=>a?d(!0):(d(!1),k()),children:e.jsxs(te,{className:"max-h-[85vh] overflow-y-auto sm:max-w-lg",children:[e.jsxs(re,{children:[e.jsx(ne,{children:"Add a managed brand"}),e.jsx(de,{children:"Create a sub-brand under your agency. It carries its own campaigns and plan."})]}),e.jsxs("form",{onSubmit:a=>{if(a.preventDefault(),!m.trim()){s({title:"Brand name required",variant:"destructive"});return}M.mutate()},className:"space-y-4",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(j,{htmlFor:"mb-name",className:"text-sm",children:"Brand name *"}),e.jsx(S,{id:"mb-name",value:m,onChange:a=>x(a.target.value),placeholder:"e.g. Acme Apparel","data-testid":"input-brand-name"})]}),e.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(j,{htmlFor:"mb-industry",className:"text-sm",children:"Industry"}),e.jsx(S,{id:"mb-industry",value:i,onChange:a=>v(a.target.value),placeholder:"e.g. Fashion","data-testid":"input-brand-industry"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(j,{htmlFor:"mb-website",className:"text-sm",children:"Website"}),e.jsx(S,{id:"mb-website",value:h,onChange:a=>N(a.target.value),placeholder:"https://â¦","data-testid":"input-brand-web
6site"})]})]}),K.map(a=>e.jsx(ve,{question:a,answers:o,setAnswers:_},a.id)),e.jsxs(ie,{children:[e.jsx(g,{type:"button",variant:"outline",onClick:()=>{d(!1),k()},"data-testid":"button-cancel-add-brand",children:"Cancel"}),e.jsx(g,{type:"submit",disabled:M.isPending,"data-testid":"button-submit-add-brand",children:M.isPending?e.jsx(le,{className:"h-4 w-4 animate-spin"}):"Add brand"})]})]})]})})]})}function Ae(){var h,N;const{user:s}=me(),{isAgency:f,activeManagedBrand:c}=R(),l=(s==null?void 0:s.profileCompleted)===1,{data:p}=B({queryKey:["/api/brand-profile"]}),{data:n}=B({queryKey:["/api/brand/campaigns"],select:o=>o.campaigns??[]}),{data:r}=B({queryKey:["/api/brand/subscription"]}),t=p==null?void 0:p.profile,d=(t==null?void 0:t.companyName)||(s==null?void 0:s.firstName)||"there",m=(n==null?void 0:n.filter(o=>o.submissionStatus==="pending_review").length)??0,x=(n==null?void 0:n.filter(o=>o.submissionStatus==="approved").length)??0,i=r!=null&&r.subscription&&r.subscription.status!=="canceled"?r.subscription:null,v=i?((N=(h=r==null?void 0:r.tiers)==null?void 0:h.find(o=>o.key===i.tier))==null?void 0:N.name)??i.tier:null;return e.jsxs("div",{className:"max-w-5xl mx-auto py-2",children:[e.jsx(xe,{title:"Brand Dashboard"}),e.jsxs("div",{className:"flex flex-col gap-3 mb-1 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(L,{className:"w-6 h-6 text-purple-500"}),e.jsxs("h1",{className:"text-2xl font-heading text-gradient-festival",children:["Welcome, ",d]})]}),e.jsx(we,{})]}),e.jsx("p",{className:"text-sm text-muted-foreground mb-6",children:f&&c?e.jsxs(e.Fragment,{children:["Managing ",e.jsx("span",{className:"font-medium text-foreground",children:c.brandName})," â new campaigns and plans apply to this brand."]}):"Your Festival Babes brand portal."}),!l&&e.jsx(w,{className:"mb-6 border-purple-500/30 bg-gradient-to-r from-purple-500/5 to-rose-500/5",children:e.jsxs(C,{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 py-5",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(pe,{className:"w-5 h-5 text-purple-500 mt-0.5"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-semibold",children:"Finish setting up your brand"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Complete your brand profile so our team can tailor your campaigns."})]})]}),e.jsx(u,{href:"/brand/onboarding",children:e.jsxs(g,{className:"bg-gradient-to-r from-purple-500 to-rose-500 text-white whitespace-nowrap","data-testid":"button-complete-brand-profile",children:["Complete profile ",e.jsx(A,{className:"w-4 h-4 ml-1.5"})]})})]})}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[e.jsxs(w,{className:"border-purple-500/20",children:[e.jsx(I,{className:"pb-2",children:e.jsxs(F,{className:"text-base flex items-center gap-2",children:[e.jsx(L,{className:"w-4 h-4 text-purple-500"})," Brand profile"]})}),e.jsx(C,{className:"text-sm space-y-1",children:l?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-green-600",children:[e.jsx(P,{className:"w-4 h-4"})," Complete"]}),(t==null?void 0:t.industry)&&e.jsx("p",{className:"text-muted-foreground",children:t.industry}),(t==null?void 0:t.websiteUrl)&&e.jsx("p",{className:"text-muted-foreground truncate",children:t.websiteUrl}),e.jsx(u,{href:"/brand/settings",className:"text-purple-500 text-sm font-medium hover:underline inline-block mt-1",children:"Edit profile"})]}):e.jsx("p",{className:"text-muted-foreground",children:"Not set up yet."})})]}),e.jsxs(w,{className:"border-purple-500/20",children:[e.jsxs(I,{className:"pb-2",children:[e.jsxs(F,{className:"text-base flex items-center gap-2",children:[e.jsx(ue,{className:"w-4 h-4 text-purple-500"})," Your plan"]}),!i&&e.jsx(T,{children:"Monthly creator retainers, 3-month minimum."})]}),e.jsx(C,{className:"text-sm space-y-2",children:i?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-green-600",children:[e.jsx(P,{className:"w-4 h-4"})," ",v]}),i.currentPeriodEnd&&e.jsxs("p",{className:"text-muted-foreground",children:[i.cancelAtPeriodEnd?"Ends":"Renews"," ",new Date(i.currentPeriodEnd).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})]}),e.jsx(u,{href:"/brand/plans",className:"text-purple-500 text-sm font-medium hover:underline inline-block mt-1",children:"Manage plan"})]}):e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-muted-foreground",children:"No active plan yet."}),e.jsx(u,{href:"/brand/plans",children:e.jsxs(g,{size:"sm",variant:"outline",className:"mt-1","data-testid":"button-dashboard-choose-plan",children:["Choose a plan ",e.jsx(A,{className:"w-3.5 h-3.5 ml-1"})]})}),e.jsx(u,{href:"/brand/plans?quiz=1",className:"text-purple-500 text-sm font-medium hover:underline inline-block mt-1 ml-3","data-testid":"link-dashboard-quiz",children:"Not sure? Take the quiz"})]})})]}),e.jsxs(w,{className:"border-purple-500/20",children:[e.jsxs(I,{className:"pb-2",children:[e.jsxs(F,{className:"text-base flex items-center gap-2",children:[e.jsx(fe,{className:"w-4 h-4 text-purple-500"})," Campaigns"]}),e.jsx(T,{children:"Submit briefs for our team to review."})]}),e.jsxs(C,{className:"text-sm space-y-2",children:[n&&n.length>0?e.jsxs("div",{className:"space-y-1",children:[e.jsxs("p",{children:[e.jsx("span",{className:"font-semibold",children:m})," ",e.jsx("span",{className:"text-muted-foreground",children:"pending review"})]}),e.jsxs("p",{children:[e.jsx("span",{className:"font-semibold",children:x})," ",e.jsx("span",{className:"text-muted-foreground",children:"approved"})]}),e.jsx(u,{href:"/brand/campaigns",className:"text-purple-500 text-sm font-medium hover:underline inline-block mt-1",children:"View campaigns"})]}):e.jsx("p",{className:"text-muted-foreground",children:"No campaigns yet. Submit your first brief and we'll review it."}),e.jsx(u,{href:"/brand/campaigns/new",children:e.jsxs(g,{size:"sm",variant:"outline",className:"mt-1","data-testid":"button-dashboard-submit-campaign",children:["Submit campaign ",e.jsx(A,{className:"w-3.5 h-3.5 ml-1"})]})})]})]})]})]})}export{Ae 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.