1import{v as j,f as N,i as f,j as e,o as l,B as g,aO as y}from"./index-QiiZ-xPT.js";import{N as c}from"./Navigation-r93ZBuy6.js";import{F as m}from"./Footer-3JNsJayo.js";import{C as x,a as p,b,c as v}from"./card-DkXabqFf.js";import{B as h}from"./badge-IOHUIid2.js";import"./label-BA9Xin3m.js";import"./checkbox-CrGTwbPu.js";import"./index-DqZlRfV5.js";import"./check-KTa2Xihg.js";import"./select-B1P2Vx_w.js";import"./index-BMyKsIJE.js";import"./Combination-TP2Egp2x.js";import"./chevron-down-BWOHa16b.js";import"./dialog-D2VXyQJN.js";import"./save-BsB7cS8F.js";import"./dropdown-menu-D4zjGRmc.js";import"./index-Bj3iuRQR.js";import"./chevron-right-f4G5e4zR.js";import"./circle-2nw1jhuN.js";import"./useTranslation-XedzLvcK.js";import"./globe-3tsuvpPT.js";import"./log-out-CqAuLeet.js";import"./building-2-Bz-h5bHH.js";import"./BrandSponsor-DEW6i_On.js";import"./mail-Cr62Xklx.js";import"./twitter-BzZd48jL.js";function J(){const o=j(),t=N({queryKey:["/api/admin/workplace-index/admin/partners"]}),u=f({mutationFn:async({id:s,status:r})=>(await y("PATCH",`/api/admin/workplace-index/admin/cohorts/${s}`,{fieldingStatus:r})).json(),onSuccess:()=>o.invalidateQueries()});if(t.error&&/401|403|forbidden/i.test(t.error instanceof Error?t.error.message:""))return e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx(c,{}),e.jsxs("div",{className:"max-w-3xl mx-auto px-6 py-32 text-center",children:[e.jsx("h1",{className:"text-3xl font-bold mb-4",children:"Admin only"}),e.jsx("p",{className:"text-muted-foreground",children:"You don't have permission to view this page."})]}),e.jsx(m,{})]});const a=t.data?.partners??[],i=new Set,d=new Map;for(const s of a)if(s.tierSlug==="index_lead"&&s.status==="active"){const r=s.industry.trim().toLowerCase(),n=(d.get(r)||0)+1;d.set(r,n),n>1&&i.add(r)}return e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx(c,{}),e.jsxs("main",{className:"max-w-7xl mx-auto px-6 py-20","data-testid":"page-admin-workplace-index",children:[e.jsxs("div",{className:"mb-8",children:[e.jsx("h1",{className:"text-3xl font-bold mb-2",children:"Workplace Index â Partners"}),e.jsx("p",{className:"text-muted-foreground",children:"Live partner subscriptions. Industry exclusivity is a soft check on Lead tier â flagged below, not enforced."})]}),i.size>0&&e.jsx(x,{className:"mb-6 border-orange-500/40 bg-orange-500/5",children:e.jsxs(p,{className:"p-4 text-sm","data-testid":"warn-industry-conflict",children:[e.jsx("strong",{children:"Industry exclusivity conflict:"})," Multiple Lead-tier partners exist in:"," ",Array.from(i).join(", "),". Reach out to sales to either downgrade one or carve out segment-level exclusivity."]})}),t.isLoading?e.jsxs("div",{className:"text-muted-foreground",children:[e.jsx(l,{className:"w-4 h-4 animate-spin inline mr-2"})," Loading partnersâ¦"]}):e.jsxs(x,{children:[e.jsx(b,{children:e.jsxs(v,{children:[a.length," partners"]})}),e.jsx(p,{children:a.length===0?e.jsx("p",{className:"text-muted-foreground","data-testid":"text-empty",children:"No partners provisioned yet. As soon as a Stripe invoice is paid, the partner row appears here."}):e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"text-left border-b",children:[e.jsx("th",{className:"py-2 pr-4",children:"Organization"}),e.jsx("th",{className:"py-2 pr-4",children:"Industry"}),e.jsx("th",{className:"py-2 pr-4",children:"Segment"}),e.jsx("th",{className:"py-2 pr-4",children:"Tier"}),e.jsx("th",{className:"py-2 pr-4",children:"Sub status"}),e.jsx("th",{className:"py-2 pr-4",children:"Renews"}),e.jsx("th",{className:"py-2 pr-4",children:"Cohorts (D/F/C/R)"}),e.jsx("th",{className:"py-2 pr-4",children:"Last closed"}),e.jsx("th",{className:"py-2 pr-4",children:"Dashboard"}),e.jsx("th",{className:"py-2 pr-4",children:"Provisioned"})]})}),e.jsx("tbody",{children:a.map(s=>e.jsxs("tr",{className:"border-b last:border-b-0","data-testid":`row-partner-${s.id}`,children:[e.jsxs("td",{className:"py-2 pr-4",children:[e.jsx("div",{className:"font-medium",children:s.organizationName}),e.jsx("div",{className:"text-xs text-muted-foreground",children:s.primaryContactEmail})]}),e.jsx("td",{className:"py-2 pr-4",children:s.industry}),e.jsx("td",{className:"py-2 pr-4",children:s.icpSegment}),e.jsx("td",{className:"py-2 pr-4",children:e.jsx(h,{variant:"outline",className:"text-xs",children:s.tierSlug})}),e.jsx("td",{className:"py-2 pr-4",children:e.jsx(h,{variant:"outline",className:"text-xs",children:s.subscriptionStatus??"â"})}),e.jsx("td",{className:"py-2 pr-4",children:s.currentPeriodEnd?new Date(s.currentPeriodEnd).toLocaleDateString():"â"}),e.jsxs("td",{className:"py-2 pr-4 text-xs font-mono","data-testid":`text-rollup-${s.id}`,children:[s.cohortRollup.draft,"/",s.cohortRollup.fielding,"/",s.cohortRollup.closed,"/",s.cohortRollup.reported]}),e.jsx("td",{className:"py-2 pr-4 text-xs text-muted-foreground",children:s.lastCohortClosedAt?new Date(s.lastCohortClosedAt).toLocaleDateString():"â"}),e.jsx("td",{className:"py-2 pr-4",children:e.jsx("a",{className:"text-orange-600 underline text-xs",href:s.dashboardUrl,target:"_blank",rel:"noreferrer","data-testid":`link-dashboard-${s.id}`,children:"open"})}),e.jsx("td",{className:"py-2 pr-4 text-xs text-muted-foreground",children:new Date(s.createdAt).toLocaleDateString()})]},s.id))})]})})})]}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-8",children:[u.isPending&&e.jsxs(e.Fragment,{children:[e.jsx(l,{className:"w-3 h-3 inline animate-spin mr-1"})," Updating cohortâ¦"]}),"Cohort lifecycle (draft â fielding â closed â reported) is updated via"," ",e.jsx("code",{children:"PATCH /api/admin/workplace-index/admin/cohorts/:id"}),". UI for that ships next sprint."," ",e.jsx(g,{variant:"ghost",size:"sm",onClick:()=>o.invalidateQueries(),"data-testid":"button-refresh",children:"Refresh"})]})]}),e.jsx(m,{})]})}
1export{J 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.