1import{z as h,r as u,a9 as p,j as e,az as g,bs as j,at as N,bH as k,au as w,y as v}from"./index-sg1QXStc.js";import{A as E,U as T}from"./AdminLayout-ru8Gt0EC.js";import{T as A}from"./triangle-alert-DKzycZ7-.js";import{f as C}from"./formatDistanceToNow-5vrp8xtd.js";import{E as q}from"./eye-off-BSkIVZN2.js";import{p as S,M as H,a as x}from"./member-gates-BjpDN-W9.js";import"./layout-dashboard-DseMIJLG.js";import"./map-pin-Lypj2MWY.js";import"./calendar-gUOMrkL1.js";import"./handshake-v5ElPvcb.js";import"./rss-kUPzL9Sb.js";import"./newspaper-BfnsLNcR.js";import"./mail-DElAdtZf.js";import"./message-square-UWTlzToj.js";import"./archive-_1cNHJwb.js";const B=[["circle",{cx:"12",cy:"16",r:"1",key:"1au0dj"}],["rect",{x:"3",y:"10",width:"18",height:"12",rx:"2",key:"6s8ecr"}],["path",{d:"M7 10V7a5 5 0 0 1 10 0v3",key:"1pqi11"}]],L=h("lock-keyhole",B);const M=[["path",{d:"M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z",key:"qn84l0"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],$=h("ticket-check",M);const _=[["path",{d:"m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71",key:"yqzxt4"}],["path",{d:"m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71",key:"4qinb0"}],["line",{x1:"8",x2:"8",y1:"2",y2:"5",key:"1041cp"}],["line",{x1:"2",x2:"5",y1:"8",y2:"8",key:"14m1p5"}],["line",{x1:"16",x2:"16",y1:"19",y2:"22",key:"rzdirn"}],["line",{x1:"19",x2:"22",y1:"16",y2:"16",key:"ox905f"}]],P=h("unlink",_);function y(n,r){return r===0?0:Math.round(n/r*100)}function F(n){if(!n)return null;const r=/Z|[+-]\d{2}:?\d{2}$/.test(n)?n:`${n.replace(" ","T")}Z`,a=new Date(r);return isNaN(a.getTime())?null:C(a,{addSuffix:!0})}function R({open:n}){const[r,a]=u.useState("with"),{data:c=[],isLoading:d,isError:m}=p({queryKey:["/api/admin/b2b/roster"],enabled:n,queryFn:async()=>{const t=await fetch("/api/admin/b2b/roster",{credentials:"include"});if(!t.ok)throw new Error("Failed to load roster");return t.json()}});if(!n)return null;if(d)return e.jsx("p",{className:"px-5 py-4 text-sm text-gray-500",children:"Loading namesâ¦"});if(m)return e.jsx("p",{className:"px-5 py-4 text-sm text-gray-500",children:"Could not load the list."});const s=c.filter(t=>t.hasAccount),l=c.filter(t=>!t.hasAccount),o=r==="with"?s:l,i=s.filter(t=>t.inDirectory).length,b=[{key:"with",label:"Has an account",count:s.length},{key:"without",label:"Not signed up",count:l.length}];return e.jsxs("div",{className:"border-t border-gray-100",children:[e.jsx("div",{className:"px-5 pt-4 flex flex-wrap gap-2",children:b.map(t=>e.jsxs("button",{type:"button",onClick:()=>a(t.key),className:`text-xs font-semibold px-3 py-1.5 rounded-lg transition-colors ${r===t.key?"bg-gray-900 text-white":"bg-gray-100 text-gray-600 hover:bg-gray-200"}`,children:[t.label," (",t.count,")"]},t.key))}),r==="with"&&e.jsxs("p",{className:"px-5 pt-3 text-xs text-gray-500",children:[e.jsx("span",{className:"font-semibold text-gray-900",children:i})," of these appear in the networking directory. A member signed in and holding a ticket sees one fewer than that â the directory never lists the person looking at it."]}),r==="without"&&e.jsx("p",{className:"px-5 pt-3 text-xs text-gray-500",children:"These ticket holders are already listed in the networking directory and can be sent meeting requests. The requests are waiting for them when they sign up with their ticket email."}),e.jsx("div",{className:"px-5 py-4 overflow-x-auto",children:o.length===0?e.jsx("p",{className:"text-sm text-gray-500",children:"Nobody in this group."}):e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"text-left text-gray-400 border-b border-gray-100",children:[e.jsx("th",{className:"font-medium pb-2 pr-3 w-8",children:"#"}),e.jsx("th",{className:"font-medium pb-2 pr-3",children:"Name"}),e.jsx("th",{className:"font-medium pb-2 pr-3",children:"Email"}),e.jsx("th",{className:"font-medium pb-2 pr-3",children:"Company"}),e.jsx("th",{className:"font-medium pb-2 pr-3",children:"Pass"}),r==="with"&&e.jsx("th",{className:"font-medium pb-2",children:"In directory"})]})}),e.jsx("tbody",{className:"divide-y divide-gray-50",children:o.map((t,f)=>e.jsxs("tr",{className:"text-gray-700",children:[e.jsx("td",{className:"py-2 pr-3 tabular-nums text-gray-400",children:f+1}),e.jsxs("td",{className:"py-2 pr-3 font-medium text-gray-900 whitespace-nowrap",children:[t.name??"â",t.tickets>1&&e.jsxs("span",{className:"ml-1.5 text-gray-400 font-normal",children:["Ã",t.tickets]})]}),e.jsx("td",{className:"py-2 pr-3 text-gray-500",children:t.email}),e.jsx("td",{className:"py-2 pr-3 text-gray-500",children:t.company??"â"}),e.jsx("td",{className:"py-2 pr-3 whitespace-nowrap",children:g[t.tier]}),r==="with"&&e.jsx("td",{className:"py-2 whitespace-nowrap",children:t.inDirectory?e.jsx("span",{className:"text-emerald-700 font-semibold",children:"Yes"}):t.hiddenByChoice?e.jsxs("span",{className:"inline-flex items-center gap-1 text-gray-500",children:[e.jsx(q,{className:"w-3 h-3"})," Hidden by them"]}):e.jsxs("span",{className:"inline-flex items-center gap-1 text-amber-700",children:[e.jsx(P,{className:"w-3 h-3"})," Ticket not linked"]})})]},t.email))})]})})]})}function K(){const[n,r]=u.useState(!1),{data:a,isLoading:c,isError:d}=p({queryKey:["/api/admin/b2b/signups"],queryFn:async()=>{const i=await fetch("/api/admin/b2b/signups",{credentials:"include"});if(!i.ok)throw new Error("Failed to load sign-up stats");return i.json()}});if(c)return e.jsx("div",{className:"max-w-4xl bg-white rounded-xl border border-gray-200 px-5 py-6 mb-8",children:e.jsx("p",{className:"text-sm text-gray-500",children:"Loading ticket holdersâ¦"})});if(d||!a)return e.jsx("div",{className:"max-w-4xl bg-white rounded-xl border border-gray-200 px-5 py-6 mb-8",children:e.jsx("p",{className:"text-sm text-gray-500",children:"Could not load ticket holder numbers."})});const m=Math.max(0,a.ticketHolders-a.withAccount),s=y(a.withAccount,a.ticketHolders),l=F(a.lastSyncedAt),o=a.byTier.filter(i=>i.ticketHolders>0);return e.jsxs("div",{className:"max-w-4xl mb-8",children:[e.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 overflow-hidden",children:[e.jsxs("div",{className:"px-5 py-4 border-b border-gray-100 flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx($,{className:"w-4 h-4 text-gray-400"}),e.jsx("h2",{className:"text-sm font-semibold text-gray-900",children:"Ticket holders on the platform"})]}),l&&e.jsxs("span",{className:"text-xs text-gray-400 flex-shrink-0",children:["Synced ",l]})]}),e.jsx("div",{className:"px-5 py-5",children:a.ticketHolders===0?e.jsx("p",{className:"text-sm text-gray-500",children:"No tickets have been synced from Eventbrite yet."}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-baseline gap-2",children:[e.jsx("span",{className:"text-4xl font-bold text-gray-900 leading-none",children:a.withAccount}),e.jsxs("span",{className:"text-sm text-gray-500",children:["of ",a.ticketHolders," ticket holders have an account"]})]}),e.jsx("div",{className:"mt-4 h-2 rounded-full bg-gray-100 overflow-hidden",children:e.jsx("div",{className:"h-full rounded-full bg-emerald-500 transition-all duration-500",style:{width:`${s}%`}})}),e.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-x-5 gap-y-1 text-xs",children:[e.jsxs("span",{className:"text-emerald-700 font-semibold",children:[s,"% signed up"]}),e.jsxs("span",{className:"text-gray-500",children:[e.jsx("span",{className:"font-semibold text-gray-900",children:m})," not signed up yet"]}),e.jsxs("span",{className:"text-gray-500",children:[e.jsx("span",{className:"font-semibold text-gray-900",children:a.accountsWithoutTicket})," ","account",a.accountsWithoutTicket===1?"":"s"," with no ticket"]}),e.jsx("button",{type:"button",onClick:()=>r(i=>!i),className:"ml-auto font-semibold text-gray-900 hover:underline",children:n?"Hide names":"Show names"})]}),o.length>0&&e.jsx("div",{className:"mt-5 border-t border-gray-100 pt-4 space-y-2.5",children:o.map(i=>e.jsxs("div",{className:"flex items-center gap-3 text-xs",children:[e.jsx("span",{className:"w-32 flex-shrink-0 text-gray-600",children:g[i.tier]}),e.jsx("div",{className:"flex-1 h-1.5 rounded-full bg-gray-100 overflow-hidden",children:e.jsx("div",{className:"h-full rounded-full bg-emerald-400",style:{width:`${y(i.withAccount,i.ticketHolders)}%`}})}),e.jsxs("span",{className:"w-16 flex-shrink-0 text-right tabular-nums text-gray-500",children:[i.withAccount," / ",i.ticketHolders]})]},i.tier))})]})}),a.unlinked>0&&e.jsxs("div",{className:"px-5 py-3 bg-amber-50 border-t border-amber-100 flex items-start gap-2",children:[e.jsx(A,{className:"w-4 h-4 text-amber-600 flex-shrink-0 mt-0.5"}),e.jsxs("p",{className:"text-xs text-amber-800",children:[a.unlinked," ticket",a.unlinked===1?"":"s"," match an account but were never linked to it, so those members are treated as having no ticket. Run an Eventbrite sync; if the number stays, the linking step needs a look."]})]}),e.jsx(R,{open:n})]}),e.jsx("p",{className:"text-xs text-gray-400 mt-3",children:"Buying a ticket doesn't create an account â attendees are matched to one by email when they register or sign in. Everyone in the gap above is missing from the networking directory and can't be sent a meeting request. Counted per person: refunded and removed tickets don't count, and someone holding several tickets is one ticket holder."})]})}function se(){const{toast:n}=j(),{data:r,isLoading:a}=p({queryKey:["/api/settings",x],queryFn:async()=>{const s=await fetch(`/api/settings/${x}`,{credentials:"include"});if(!s.ok)throw new Error("Failed to load setting");return s.json()}}),c=S(r?.value),d=N({mutationFn:s=>v("PUT",`/api/settings/${x}`,{value:JSON.stringify(s)}),onSuccess:()=>{w.invalidateQueries({queryKey:["/api/settings",x]}),n({title:"B2B Platform updated"})},onError:s=>{n({title:"Update failed",description:s instanceof Error?s.message:"Could not update setting",variant:"destructive"})}}),m=(s,l)=>{d.mutate({...c,[s]:l?"open":"closed"})};return e.jsxs(E,{children:[e.jsxs("div",{className:"mb-8",children:[e.jsxs("h1",{className:"text-2xl font-bold text-gray-900 flex items-center gap-2",children:[e.jsx(T,{className:"w-6 h-6"})," B2B Platform"]}),e.jsx("p",{className:"text-sm text-gray-500 mt-1",children:'Open or close B2B Platform pages. Closed pages show a "Coming Soon" screen to members until you open them here.'})]}),e.jsx(K,{}),e.jsx("h2",{className:"text-sm font-semibold text-gray-900 mb-3",children:"Page access"}),e.jsx("div",{className:"max-w-2xl bg-white rounded-xl border border-gray-200 divide-y divide-gray-100",children:H.map(s=>{const l=c[s.key]==="open";return e.jsxs("div",{className:"flex items-center justify-between gap-4 px-5 py-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-semibold text-gray-900",children:s.label}),e.jsx("div",{className:"text-xs text-gray-500 mt-0.5",children:s.href})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("span",{className:`inline-flex items-center gap-1.5 text-xs font-semibold px-2.5 py-1 rounded-full ${l?"bg-green-50 text-green-700":"bg-amber-50 text-amber-700"}`,children:[!l&&e.jsx(L,{className:"w-3 h-3"}),l?"Open":"Coming Soon"]}),e.jsx(k,{checked:l,onCheckedChange:o=>m(s.key,o),disabled:a||d.isPending,"aria-label":`Toggle ${s.label}`})]})]},s.key)})}),e.jsx("p",{className:"text-xs text-gray-400 mt-4 max-w-2xl",children:"Dashboard and Profile are always available to members. Changes take effect immediately for everyone, including admins."})]})}
1export{se 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.