1import{c as be,r as u,W as w,F as D,j as e,C as n,K as d,aL as ae,N as o,aa as v,a as m,a4 as b,bZ as L,B as c,a7 as E,O as j,au as ye,c4 as Q,G as ie,af as we,am as Ce,U as re,A as le,a8 as Se,aP as Te,I as Ae,n as l,b as Fe,Z as Pe,$ as Oe,a0 as De,a1 as Le,a2 as Ee,a3 as ke,a5 as Me,q as Y,Q as k}from"./index-tc5-nNLC.js";import{T as Re,a as We,b as M,c as R}from"./tabs-D2OfY7RH.js";import{L as p}from"./label-MwGx_WS4.js";import{T as ne}from"./textarea-DN2rY_yY.js";import{S as W,a as B,b as I,c as V,d as i}from"./select-Bsa-6vNv.js";import{C as ce}from"./crown-BaX0qJx5.js";import{E as de}from"./eye-7YOw3q0i.js";import{M as Be}from"./mouse-pointer-click-CUquD_H1.js";import{G as z}from"./gift-CcGpxH7x.js";import"./index-C-y5wYFI.js";import"./chevron-down-DOFZ7rzv.js";import"./chevron-up-1gTexUQn.js";function ss(){var ee,se,te;const{toast:N}=be(),[oe,G]=u.useState("dashboard"),[Ie,Ve]=u.useState(null),[C,Z]=u.useState("monthly"),[A,me]=u.useState(""),[F,xe]=u.useState("all"),[P,he]=u.useState("all"),[S,H]=u.useState("all"),[ue,y]=u.useState(!1),[$e,je]=u.useState(!1),[f,O]=u.useState({businessName:"",businessType:"retail",description:""}),[r,g]=u.useState({title:"",description:"",benefitType:"discount",benefitValue:"10",maxTotalRedemptions:100,timeWindowStart:"",timeWindowEnd:""}),{data:t,isLoading:pe}=w({queryKey:["/api/merchant-presale/merchants/me"]}),{data:a}=w({queryKey:["/api/merchant-presale/merchants",t==null?void 0:t.id,"license"],enabled:!!(t!=null&&t.id)}),{data:fe=[]}=w({queryKey:["/api/merchant-presale/license-tiers"]}),{data:ge=[]}=w({queryKey:["/api/merchant-presale/campaigns/discover"]}),{data:x=[]}=w({queryKey:["/api/merchant-presale/merchants",t==null?void 0:t.id,"offers"],enabled:!!(t!=null&&t.id)}),{data:h}=w({queryKey:["/api/merchant-presale/merchants",t==null?void 0:t.id,"dashboard"],enabled:!!(t!=null&&t.id)}),ve=D({mutationFn:async s=>(await k("POST",`/api/merchant-presale/merchants/${t==null?void 0:t.id}/license/trial`,{tierId:s})).json(),onSuccess:()=>{N({title:"Trial started!",description:"Enjoy your free trial period."}),Y.invalidateQueries({queryKey:["/api/merchant-presale/merchants",t==null?void 0:t.id,"license"]})},onError:()=>{N({title:"Error",description:"Failed to start trial",variant:"destructive"})}}),$=D({mutationFn:async({tierId:s,interval:T})=>(await k("POST",`/api/merchant-presale/merchants/${t==null?void 0:t.id}/license/checkout`,{tierId:s,billingInterval:T})).json(),onSuccess:s=>{s.url&&(window.location.href=s.url)},onError:()=>{N({title:"Error",description:"Failed to start checkout",variant:"destructive"})}}),q=D({mutationFn:async s=>(await k("POST",`/api/merchant-presale/merchants/${t==null?void 0:t.id}/offers`,s)).json(),onSuccess:()=>{N({title:"Offer created!",description:"Your presale offer is now active."}),Y.invalidateQueries({queryKey:["/api/merchant-presale/merchants",t==null?void 0:t.id,"offers"]}),y(!1),g({title:"",description:"",benefitType:"discount",benefitValue:"10",maxTotalRedemptions:100,timeWindowStart:"",timeWindowEnd:""})},onError:()=>{N({title:"Error",description:"Failed to create offer",variant:"destructive"})}}),_=D({mutationFn:async s=>(await k("POST","/api/merchant-presale/merchants",s)).json(),onSuccess:()=>{N({title:"Account created!",description:"Your merchant account is now active."}),Y.invalidateQueries({queryKey:["/api/merchant-presale/merchants/me"]}),je(!1),O({businessName:"",businessType:"retail",description:""})},onError:()=>{N({title:"Error",description:"Failed to create merchant account",variant:"destructive"})}}),J=a&&"tier"in a&&(a.status==="active"||a.status==="trialing"),X=ge.filter(s=>!(A&&!s.name.toLowerCase().includes(A.toLowerCase())||F!=="all"&&s.sport!==F||P!=="all"&&s.wedgeType!==P)),U=Array.isArray(x)?S==="all"?x:x.filter(s=>s.status===S):[],K=s=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD"}).format(s/100),Ne=s=>({youth_sports:"Youth Sports",nil_athlete:"NIL Athlete",creator_streamer:"Creator/Streamer",city_tourism:"City Tourism",pro_sports:"Pro Sports",core_traveler:"Core Traveler"})[s]||s;return pe?e.jsx("div",{className:"flex items-center justify-center min-h-screen",children:e.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-primary"})}):t?e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx("div",{className:"border-b",children:e.jsx("div",{className:"container mx-auto px-4 py-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(ae,{className:"w-8 h-8 text-primary"}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-bold","data-testid":"text-merchant-name",children:t.businessName}),e.jsx("p",{className:"text-sm text-muted-foreground",children:t.businessType})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[J&&"tier"in a&&e.jsxs(j,{variant:"secondary",className:"gap-1","data-testid":"badge-license-tier",children:[e.jsx(ce,{className:"w-3 h-3"}),a.tier.name]}),e.jsxs(c,{variant:"outline",size:"sm",children:[e.jsx(ye,{className:"w-4 h-4 mr-2"}),"Settings"]})]})]})})}),e.jsx("div",{className:"container mx-auto px-4 py-6",children:e.jsxs(Re,{value:oe,onValueChange:G,children:[e.jsxs(We,{className:"mb-6",children:[e.jsx(M,{value:"dashboard","data-testid":"tab-dashboard",children:"Dashboard"}),e.jsx(M,{value:"campaigns","data-testid":"tab-campaigns",children:"Discover Campaigns"}),e.jsx(M,{value:"offers","data-testid":"tab-offers",children:"My Offers"}),e.jsx(M,{value:"license","data-testid":"tab-license",children:"License & Billing"})]}),e.jsxs(R,{value:"dashboard",children:[e.jsxs("div",{className:"grid gap-6 md:grid-cols-2 lg:grid-cols-4",children:[e.jsxs(n,{children:[e.jsxs(d,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(o,{className:"text-sm font-medium",children:"Total Views"}),e.jsx(de,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(m,{children:[e.jsx("div",{className:"text-2xl font-bold","data-testid":"text-total-views",children:((ee=h==null?void 0:h.totalViews)==null?void 0:ee.toLocaleStr
1ing())||"0"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Across all offers"})]})]}),e.jsxs(n,{children:[e.jsxs(d,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(o,{className:"text-sm font-medium",children:"Total Scans"}),e.jsx(Be,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(m,{children:[e.jsx("div",{className:"text-2xl font-bold","data-testid":"text-total-scans",children:((se=h==null?void 0:h.totalScans)==null?void 0:se.toLocaleString())||"0"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"QR code scans"})]})]}),e.jsxs(n,{children:[e.jsxs(d,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(o,{className:"text-sm font-medium",children:"Conversions"}),e.jsx(Q,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(m,{children:[e.jsx("div",{className:"text-2xl font-bold","data-testid":"text-conversions",children:((te=h==null?void 0:h.totalConversions)==null?void 0:te.toLocaleString())||"0"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Completed redemptions"})]})]}),e.jsxs(n,{children:[e.jsxs(d,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(o,{className:"text-sm font-medium",children:"Revenue"}),e.jsx(ie,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(m,{children:[e.jsx("div",{className:"text-2xl font-bold","data-testid":"text-revenue",children:K((h==null?void 0:h.totalRevenueCents)||0)}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Total attributed"})]})]})]}),e.jsxs("div",{className:"grid gap-6 mt-6 md:grid-cols-2",children:[e.jsxs(n,{children:[e.jsxs(d,{children:[e.jsxs(o,{className:"flex items-center gap-2",children:[e.jsx(z,{className:"w-5 h-5"}),"Active Offers"]}),e.jsx(v,{children:"Your current presale offers"})]}),e.jsx(m,{children:Array.isArray(x)&&x.length>0?e.jsx(we,{className:"h-[200px]",children:e.jsx("div",{className:"space-y-3",children:x.slice(0,5).map(s=>e.jsxs("div",{className:"flex items-center justify-between p-3 border rounded-lg","data-testid":`offer-item-${s.id}`,children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:s.title}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s.benefitLabel||s.benefitType||"â"})]}),e.jsx(j,{variant:s.status==="active"?"default":"secondary",children:s.status})]},s.id))})}):e.jsxs("div",{className:"text-center py-8",children:[e.jsx(z,{className:"w-12 h-12 mx-auto mb-4 text-muted-foreground"}),e.jsx("p",{className:"text-muted-foreground",children:"No offers yet"}),e.jsxs(c,{variant:"outline",className:"mt-4",onClick:()=>y(!0),"data-testid":"btn-create-first-offer",children:[e.jsx(E,{className:"w-4 h-4 mr-2"}),"Create Your First Offer"]})]})})]}),e.jsxs(n,{children:[e.jsxs(d,{children:[e.jsxs(o,{className:"flex items-center gap-2",children:[e.jsx(Ce,{className:"w-5 h-5"}),"Campaign Attachments"]}),e.jsx(v,{children:"Athlete campaigns you're connected to"})]}),e.jsx(m,{children:e.jsxs("div",{className:"text-center py-8",children:[e.jsx(re,{className:"w-12 h-12 mx-auto mb-4 text-muted-foreground"}),e.jsx("p",{className:"text-muted-foreground",children:"No campaign attachments yet"}),e.jsxs(c,{variant:"outline",className:"mt-4",onClick:()=>G("campaigns"),"data-testid":"btn-discover-campaigns",children:["Discover Campaigns",e.jsx(le,{className:"w-4 h-4 ml-2"})]})]})})]})]})]}),e.jsx(R,{value:"campaigns",children:e.jsxs(n,{children:[e.jsxs(d,{children:[e.jsx(o,{children:"Discover Athlete Campaigns"}),e.jsx(v,{children:"Browse available campaigns to attach your offers and reach new audiences"})]}),e.jsxs(m,{children:[e.jsxs("div",{className:"flex flex-wrap gap-4 mb-6",children:[e.jsx("div",{className:"flex-1 min-w-[200px]",children:e.jsxs("div",{className:"relative",children:[e.jsx(Se,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),e.jsx(b,{placeholder:"Search campaigns...",className:"pl-10",value:A,onChange:s=>me(s.target.value),"data-testid":"input-search-campaigns"})]})}),e.jsxs(W,{value:P,onValueChange:he,children:[e.jsx(B,{className:"w-[180px]","data-testid":"select-wedge-filter",children:e.jsx(I,{placeholder:"Campaign Type"})}),e.jsxs(V,{children:[e.jsx(i,{value:"all",children:"All Types"}),e.jsx(i,{value:"youth_sports",children:"Youth Sports"}),e.jsx(i,{value:"nil_athlete",children:"NIL Athlete"}),e.jsx(i,{value:"creator_streamer",children:"Creator/Streamer"}),e.jsx(i,{value:"pro_sports",children:"Pro Sports"})]})]}),e.jsxs(W,{value:F,onValueChange:xe,children:[e.jsx(B,{className:"w-[150px]","data-testid":"select-sport-filter",children:e.jsx(I,{placeholder:"Sport"})}),e.jsxs(V,{children:[e.jsx(i,{value:"all",children:"All Sports"}),e.jsx(i,{value:"basketball",children:"Basketball"}),e.jsx(i,{value:"football",children:"Football"}),e.jsx(i,{value:"baseball",children:"Baseball"}),e.jsx(i,{value:"soccer",children:"Soccer"})]})]})]}),X.length>0?e.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:X.map(s=>e.jsxs(n,{className:"overflow-hidden","data-testid":`campaign-card-${s.id}`,children:[e.jsx(d,{className:"pb-2",children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{children:[e.jsx(o,{className:"text-lg",children:s.name}),e.jsxs(v,{className:"flex items-center gap-2 mt-1",children:[e.jsx(j,{variant:"outline",className:"text-xs",children:Ne(s.wedgeType)}),s.sport&&e.jsx(j,{variant:"secondary",className:"text-xs",children:s.sport})]})]}),e.jsx(j,{variant:s.status==="active"?"default":"secondary",children:s.status})]})}),e.jsxs(m,{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-full bg-muted flex items-center justify-center",children:e.jsx(re,{className:"w-5 h-5 text-muted-foreground"})}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:s.creatorName}),s.estimatedReach&&e.jsxs("p",{className:"text-sm text-muted-foreground",children:[s.estimatedReach.toLocaleStr
1ing()," reach"]})]})]}),s.commissionRate&&e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(ie,{className:"w-4 h-4 text-green-600"}),e.jsxs("span",{children:[s.commissionRate,"% commission"]})]})]}),e.jsx(L,{className:"border-t pt-4",children:e.jsxs(c,{className:"w-full","data-testid":`btn-attach-${s.id}`,children:["Attach Offer",e.jsx(le,{className:"w-4 h-4 ml-2"})]})})]},s.id))}):e.jsxs("div",{className:"text-center py-12",children:[e.jsx(Q,{className:"w-12 h-12 mx-auto mb-4 text-muted-foreground"}),e.jsx("p",{className:"text-lg font-medium",children:"No campaigns found"}),e.jsx("p",{className:"text-muted-foreground",children:A||P!=="all"||F!=="all"?"Try adjusting your filters":"Check back later for new opportunities"})]})]})]})}),e.jsx(R,{value:"offers",children:e.jsxs(n,{children:[e.jsx(d,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(o,{children:"My Presale Offers"}),e.jsx(v,{children:"Create and manage offers to promote through athlete campaigns"})]}),e.jsxs(c,{onClick:()=>y(!0),"data-testid":"btn-create-offer",children:[e.jsx(E,{className:"w-4 h-4 mr-2"}),"Create Offer"]})]})}),e.jsxs(m,{children:[Array.isArray(x)&&x.length>0&&e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsxs(W,{value:S,onValueChange:H,children:[e.jsx(B,{className:"w-[160px]","data-testid":"select-offer-status-filter",children:e.jsx(I,{placeholder:"Filter by status"})}),e.jsxs(V,{children:[e.jsx(i,{value:"all",children:"All Statuses"}),e.jsx(i,{value:"active",children:"Active"}),e.jsx(i,{value:"draft",children:"Draft"}),e.jsx(i,{value:"paused",children:"Paused"}),e.jsx(i,{value:"ended",children:"Ended"}),e.jsx(i,{value:"cancelled",children:"Cancelled"})]})]}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[U.length," of ",x.length," offer",x.length!==1?"s":""]})]}),U.length>0?e.jsx("div",{className:"space-y-4",children:U.map(s=>e.jsx(n,{"data-testid":`offer-card-${s.id}`,children:e.jsx(m,{className:"pt-6",children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("h3",{className:"font-semibold",children:s.title}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s.description}),e.jsxs("div",{className:"flex items-center gap-4 mt-2",children:[e.jsxs("div",{className:"flex items-center gap-1 text-sm",children:[e.jsx(de,{className:"w-4 h-4"}),s.viewCount||0," views"]}),e.jsxs("div",{className:"flex items-center gap-1 text-sm",children:[e.jsx(Te,{className:"w-4 h-4"}),s.scanCount||0," scans"]}),e.jsxs("div",{className:"flex items-center gap-1 text-sm",children:[e.jsx(Q,{className:"w-4 h-4"}),s.conversionCount||0," conversions"]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(j,{variant:s.status==="active"?"default":"secondary",children:s.status}),e.jsx(j,{variant:"outline",children:s.benefitLabel||s.benefitType||"offer"})]})]})})},s.id))}):e.jsxs("div",{className:"text-center py-12",children:[e.jsx(z,{className:"w-12 h-12 mx-auto mb-4 text-muted-foreground"}),Array.isArray(x)&&x.length>0&&S!=="all"?e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"text-lg font-medium",children:["No ",S," offers"]}),e.jsx("p",{className:"text-muted-foreground mb-4",children:"No offers match the selected status filter."}),e.jsx(c,{variant:"outline",onClick:()=>H("all"),"data-testid":"btn-clear-offer-filter",children:"Show All Offers"})]}):e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-lg font-medium",children:"No offers yet"}),e.jsx("p",{className:"text-muted-foreground mb-4",children:"Create your first presale offer to start connecting with athlete audiences"}),e.jsxs(c,{onClick:()=>y(!0),"data-testid":"btn-create-first-offer-empty",children:[e.jsx(E,{className:"w-4 h-4 mr-2"}),"Create Your First Offer"]})]})]})]})]})}),e.jsx(R,{value:"license",children:e.jsxs("div",{className:"space-y-6",children:[J&&"tier"in a?e.jsxs(n,{children:[e.jsx(d,{children:e.jsxs(o,{className:"flex items-center gap-2",children:[e.jsx(ce,{className:"w-5 h-5 text-yellow-500"}),"Current License"]})}),e.jsxs(m,{children:[e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Plan"}),e.jsx("p",{className:"text-lg font-semibold",children:a.tier.name})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Status"}),e.jsx(j,{variant:a.status==="active"?"default":"secondary",children:a.status==="trialing"?"Free Trial":a.status})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Current Period"}),e.jsxs("p",{className:"text-sm",children:[new Date(a.currentPeriodStart).toLocaleDateString()," -"," ",new Date(a.currentPeriodEnd).toLocaleDateString()]})]}),a.trialEnd&&e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Trial Ends"}),e.jsxs("p",{className:"text-sm flex items-center gap-1",children:[e.jsx(Ae,{className:"w-4 h-4"}),new Date(a.trialEnd).toLocaleDateString()]})]})]}),e.jsxs("div",{className:"mt-6 pt-6 border-t",children:[e.jsx("h4",{className:"font-medium mb-3",children:"Your Plan Includes:"}),e.jsxs("div",{className:"grid gap-2 md:grid-cols-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(l,{className:"w-4 h-4 text-green-600"}),a.tier.maxActiveOffers===-1?"Unlimited offers":`${a.tier.maxActiveOffers} active offers`]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(l,{className:"w-4 h-4 text-green-600"}),a.tier.maxCampaignAttachments===-1?"Unlimited campaign attachments":`${a.tier.maxCampaignAttachments} campaign attachments`]}
1),a.tier.analyticsAccess&&e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(l,{className:"w-4 h-4 text-green-600"}),"Advanced analytics"]}),a.tier.prioritySupport&&e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(l,{className:"w-4 h-4 text-green-600"}),"Priority support"]}),a.tier.customBranding&&e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(l,{className:"w-4 h-4 text-green-600"}),"Custom branding"]}),a.tier.apiAccess&&e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(l,{className:"w-4 h-4 text-green-600"}),"API access"]})]})]})]})]}):e.jsxs(n,{className:"border-yellow-200 bg-yellow-50 dark:bg-yellow-950/20",children:[e.jsxs(d,{children:[e.jsxs(o,{className:"flex items-center gap-2",children:[e.jsx(Fe,{className:"w-5 h-5 text-yellow-600"}),"No Active License"]}),e.jsx(v,{children:"Start a free trial or purchase a license to access all merchant features"})]}),e.jsx(L,{children:e.jsxs(c,{onClick:()=>ve.mutate(void 0),"data-testid":"btn-start-trial",children:[e.jsx(Pe,{className:"w-4 h-4 mr-2"}),"Start Free Trial"]})})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h2",{className:"text-xl font-semibold",children:"Available Plans"}),e.jsxs("div",{className:"flex items-center gap-2 bg-muted p-1 rounded-lg",children:[e.jsx(c,{variant:C==="monthly"?"default":"ghost",size:"sm",onClick:()=>Z("monthly"),"data-testid":"btn-monthly",children:"Monthly"}),e.jsxs(c,{variant:C==="annual"?"default":"ghost",size:"sm",onClick:()=>Z("annual"),"data-testid":"btn-annual",children:["Annual",e.jsx(j,{variant:"secondary",className:"ml-2",children:"Save 20%"})]})]})]}),e.jsx("div",{className:"grid gap-6 md:grid-cols-3",children:fe.map(s=>e.jsxs(n,{className:`relative ${s.isPopular?"border-primary shadow-lg":""}`,"data-testid":`tier-card-${s.slug}`,children:[s.isPopular&&e.jsx("div",{className:"absolute -top-3 left-1/2 -translate-x-1/2",children:e.jsx(j,{className:"bg-primary",children:"Most Popular"})}),e.jsxs(d,{children:[e.jsx(o,{children:s.name}),e.jsx(v,{children:s.description}),e.jsxs("div",{className:"mt-4",children:[e.jsx("span",{className:"text-3xl font-bold",children:K(C==="annual"?Math.round(s.annualPriceCents/12):s.monthlyPriceCents)}),e.jsx("span",{className:"text-muted-foreground",children:"/month"}),C==="annual"&&e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Billed ",K(s.annualPriceCents)," annually"]})]})]}),e.jsxs(m,{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(l,{className:"w-4 h-4 text-green-600"}),s.maxActiveOffers===-1?"Unlimited":s.maxActiveOffers," offers"]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(l,{className:"w-4 h-4 text-green-600"}),s.maxCampaignAttachments===-1?"Unlimited":s.maxCampaignAttachments," campaign attachments"]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(l,{className:"w-4 h-4 text-green-600"}),s.maxMonthlyRedemptions===-1?"Unlimited":s.maxMonthlyRedemptions," monthly redemptions"]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(l,{className:"w-4 h-4 text-green-600"}),s.trialDays," day free trial"]}),s.analyticsAccess&&e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(l,{className:"w-4 h-4 text-green-600"}),"Advanced analytics"]}),s.prioritySupport&&e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(l,{className:"w-4 h-4 text-green-600"}),"Priority support"]}),s.customBranding&&e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(l,{className:"w-4 h-4 text-green-600"}),"Custom branding"]}),s.apiAccess&&e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(l,{className:"w-4 h-4 text-green-600"}),"API access"]}),s.whiteLabel&&e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(l,{className:"w-4 h-4 text-green-600"}),"White label"]})]}),e.jsx(L,{children:e.jsx(c,{className:"w-full",variant:s.isPopular?"default":"outline",onClick:()=>$.mutate({tierId:s.id,interval:C}),disabled:$.isPending,"data-testid":`btn-select-${s.slug}`,children:$.isPending?"Loading...":"Select Plan"})})]},s.id))})]})]})})]})}),e.jsx(Oe,{open:ue,onOpenChange:y,children:e.jsxs(De,{children:[e.jsxs(Le,{children:[e.jsx(Ee,{children:"Create Presale Offer"}),e.jsx(ke,{children:"Create an offer that can be attached to athlete campaigns"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(p,{htmlFor:"title",children:"Offer Title"}),e.jsx(b,{id:"title",value:r.title,onChange:s=>g({...r,title:s.target.value}),placeholder:"e.g., 20% Off First Purchase",maxLength:255,"data-testid":"input-offer-title"})]}),e.jsxs("div",{children:[e.jsx(p,{htmlFor:"description",children:"Description"}),e.jsx(ne,{id:"description",value:r.description,onChange:s=>g({...r,description:s.target.value}),placeholder:"Describe your offer...","data-testid":"input-offer-description"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(p,{htmlFor:"benefitType",children:"Benefit Type"}
1),e.jsxs("select",{id:"benefitType",value:r.benefitType,onChange:s=>g({...r,benefitType:s.target.value}),className:"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm","data-testid":"select-benefit-type",children:[e.jsx("option",{value:"discount",children:"Discount"}),e.jsx("option",{value:"free_item",children:"Free Item"}),e.jsx("option",{value:"priority_access",children:"Priority Access"}),e.jsx("option",{value:"other",children:"Other"})]})]}),e.jsxs("div",{children:[e.jsx(p,{htmlFor:"benefitValue",children:"Benefit Value (e.g., 10 for 10% off)"}),e.jsx(b,{id:"benefitValue",type:"number",value:r.benefitValue,onChange:s=>g({...r,benefitValue:s.target.value}),min:0,"data-testid":"input-benefit-value"})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(p,{htmlFor:"timeWindowStart",children:"Available From"}),e.jsx(b,{id:"timeWindowStart",type:"datetime-local",value:r.timeWindowStart,onChange:s=>g({...r,timeWindowStart:s.target.value}),"data-testid":"input-time-window-start"})]}),e.jsxs("div",{children:[e.jsx(p,{htmlFor:"timeWindowEnd",children:"Available Until"}),e.jsx(b,{id:"timeWindowEnd",type:"datetime-local",min:r.timeWindowStart||void 0,value:r.timeWindowEnd,onChange:s=>g({...r,timeWindowEnd:s.target.value}),"data-testid":"input-time-window-end"})]})]}),e.jsxs("div",{children:[e.jsx(p,{htmlFor:"maxTotalRedemptions",children:"Max Redemptions"}),e.jsx(b,{id:"maxTotalRedemptions",type:"number",value:r.maxTotalRedemptions,onChange:s=>g({...r,maxTotalRedemptions:parseInt(s.target.value)||0}),min:1,"data-testid":"input-offer-max-redemptions"})]})]}),e.jsxs(Me,{children:[e.jsx(c,{variant:"outline",onClick:()=>y(!1),children:"Cancel"}),e.jsx(c,{onClick:()=>q.mutate(r),disabled:!r.title||!r.timeWindowStart||!r.timeWindowEnd||q.isPending,"data-testid":"btn-submit-offer",children:q.isPending?"Creating...":"Create Offer"})]})]})})]}):e.jsx("div",{className:"container mx-auto py-8 px-4",children:e.jsxs(n,{className:"max-w-xl mx-auto",children:[e.jsxs(d,{className:"text-center",children:[e.jsx(ae,{className:"w-12 h-12 mx-auto mb-4 text-muted-foreground"}),e.jsx(o,{children:"No Merchant Account Found"}),e.jsx(v,{children:"Create a merchant account to access the self-service portal and connect with athlete campaigns."})]}),e.jsx(m,{children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(p,{htmlFor:"businessName",children:"Business Name"}),e.jsx(b,{id:"businessName",value:f.businessName,onChange:s=>O({...f,businessName:s.target.value}),placeholder:"Your Business Name","data-testid":"input-business-name"})]}),e.jsxs("div",{children:[e.jsx(p,{htmlFor:"businessType",children:"Business Type"}),e.jsxs(W,{value:f.businessType,onValueChange:s=>O({...f,businessType:s}),children:[e.jsx(B,{"data-testid":"select-business-type",children:e.jsx(I,{placeholder:"Select type"})}),e.jsxs(V,{children:[e.jsx(i,{value:"retail",children:"Retail"}),e.jsx(i,{value:"restaurant",children:"Restaurant"}),e.jsx(i,{value:"service",children:"Service"}),e.jsx(i,{value:"entertainment",children:"Entertainment"}),e.jsx(i,{value:"sports",children:"Sports"}),e.jsx(i,{value:"other",children:"Other"})]})]})]}),e.jsxs("div",{children:[e.jsx(p,{htmlFor:"description",children:"Description (Optional)"}),e.jsx(ne,{id:"description",value:f.description,onChange:s=>O({...f,description:s.target.value}),placeholder:"Brief description of your business","data-testid":"input-business-description"})]})]})}),e.jsx(L,{className:"justify-center",children:e.jsx(c,{onClick:()=>_.mutate(f),disabled:!f.businessName||_.isPending,"data-testid":"btn-create-merchant",children:_.isPending?e.jsx(e.Fragment,{children:"Creating..."}):e.jsxs(e.Fragment,{children:[e.jsx(E,{className:"w-4 h-4 mr-2"}),"Create Merchant Account"]})})})]})})}export{ss 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.