PageSourceSearch

https://living-corporate.com/assets/enterprise-admin--oK0s6gW.js

js living-corporate.com collected 2026-10-02 05:01:03 UTC 36,533 bytes, 1 lines download raw bytes

1import{e as ge,p as Fe,v as De,r as c,f as h,aS as Me,x as te,b0 as $e,i as C,j as e,L as P,B as i,y as Oe,I as p,c as Re,C as qe,G as re,s as _e,n as Be,H as ae,E as He,aT as Ke,aW as Ve,aU as Qe,z as Ge}from"./index-QiiZ-xPT.js";import{N as ie}from"./Navigation-r93ZBuy6.js";import{F as ne}from"./Footer-3JNsJayo.js";import{T as We,a as Ye,b as v,c as y}from"./tabs-DPcdb2bX.js";import{S as _,a as B,b as H,c as K,d as w}from"./select-B1P2Vx_w.js";import{u as Je,C as Ze,b as Xe,T as V,a as es}from"./tour-config-CWH4oY0c.js";import{D as le,f as oe,a as de,b as ce,c as me}from"./dialog-D2VXyQJN.js";import{S as ss}from"./SharePlaylistDialog-C4Lru2aQ.js";import{L as g}from"./label-BA9Xin3m.js";import{u as ts}from"./useTranslation-XedzLvcK.js";import{B as xe}from"./building-2-Bz-h5bHH.js";import{U as rs}from"./user-plus-ByFLpPUn.js";import{M as as}from"./mail-Cr62Xklx.js";import{C as is}from"./clipboard-check-DSDlAS2e.js";import{C as ns,U as ls,F as os}from"./user-cog-BzJIYKuk.js";import{S as ds}from"./shopping-cart-DAnbZHyy.js";import{B as cs}from"./bot-CtNfOEMS.js";import{P as ms}from"./pen-tool-BIPnQTAg.js";import{L as xs}from"./list-checks-D2pt5pRC.js";import{U as A}from"./users-JkJLChox.js";import{A as us}from"./activity-BQV8JmT-.js";import{M as ue}from"./megaphone-BHSDGW_A.js";import{P as hs}from"./play-F_iIYdsj.js";import{C as ps}from"./clock-Jb0c5sRN.js";import{C as gs}from"./circle-check-BOGFOgJv.js";import{L as js}from"./list-music-BmTAMQgl.js";import{T as he}from"./trending-up-BLnfQQLk.js";import{P as Q}from"./plus-BG3Uc6gN.js";import{S as bs}from"./share-2-hqok4cMh.js";import{E as fs}from"./eye-BVhHQpi4.js";import{M as vs}from"./mouse-pointer-DiGl33sk.js";import{P as ys}from"./pencil-C6vIE4g4.js";import{T as Ns}from"./trash-2-D3MslYjV.js";import{S as Ss}from"./shield-BMABX0Pd.js";import"./checkbox-CrGTwbPu.js";import"./index-DqZlRfV5.js";import"./check-KTa2Xihg.js";import"./save-BsB7cS8F.js";import"./dropdown-menu-D4zjGRmc.js";import"./index-BMyKsIJE.js";import"./Combination-TP2Egp2x.js";import"./index-Bj3iuRQR.js";import"./chevron-right-f4G5e4zR.js";import"./circle-2nw1jhuN.js";import"./globe-3tsuvpPT.js";import"./chevron-down-BWOHa16b.js";import"./log-out-CqAuLeet.js";import"./BrandSponsor-DEW6i_On.js";import"./card-DkXabqFf.js";import"./twitter-BzZd48jL.js";import"./chevron-left-BlU_Pgs7.js";import"./circle-question-mark-D1Xaa_pm.js";import"./link-2-CbRvItDK.js";import"./copy-DPG-QUn2.js";import"./code-D6uVMda9.js";const Cs=[["circle",{cx:"9",cy:"12",r:"3",key:"u3jwor"}],["rect",{width:"20",height:"14",x:"2",y:"5",rx:"7",key:"g7kal2"}]],ws=ge("toggle-left",Cs);const zs=[["circle",{cx:"15",cy:"12",r:"3",key:"1afu0r"}],["rect",{width:"20",height:"14",x:"2",y:"5",rx:"7",key:"g7kal2"}]],Ts=ge("toggle-right",zs),ks=[{key:"learning-library",label:"Learning Library Header",tier:"tier1"},{key:"learning",label:"Module Detail",tier:"tier1"},{key:"learning-completion",label:"Module Completion",tier:"tier1"},{key:"learning-paths",label:"Learning Path Sidebar",tier:"tier2"},{key:"learning-recommendations",label:"For You Recommendations",tier:"tier2"},{key:"learning-categories",label:"Category Filter Area",tier:"tier3"},{key:"course-catalog",label:"Course Catalog",tier:"tier3"}],pe={tier1:{label:"Tier 1 — Premium",color:"bg-amber-500/10 text-amber-600"},tier2:{label:"Tier 2 — High Value",color:"bg-blue-500/10 text-blue-600"},tier3:{label:"Tier 3 — Standard",color:"bg-gray-500/10 text-gray-600"}},Es=[{value:"week",label:"Last 7 Days"},{value:"month",label:"Last 30 Days"},{value:"quarter",label:"Last 90 Days"},{value:"6months",label:"Last 6 Months"},{value:"12months",label:"Last 12 Months"},{value:"ytd",label:"Year to Date"}];function At(){const{t:r}=ts(),{toast:j}=Fe(),b=De(),[I,G]=c.useState(""),[je,W]=c.useState(!1),[L,be]=c.useState("month"),[n,z]=c.useState(),[N,fe]=c.useState(null),[ve,Y]=c.useState(!1),[ye,S]=c.useState(!1),[T,U]=c.useState(null),[o,x]=c.useState({name:"",logoUrl:"",websiteUrl:"",tagline:"",zones:[],sponsorshipTier:"tier3",priority:0}),[Ne,Se]=c.useState(0),{hasSeenTour:Ce,resetTour:we}=Je(V.ENTERPRISE_ADMIN),ze=()=>{we(),Se(s=>s+1)},{data:u}=h({queryKey:["/api/auth/user"]}),{data:J}=h({queryKey:["/api/user/org-admin-status"],enabled:!!u}),f=Me(u),Z=f||u?.membershipTier==="admin",Te=J?.organizations?.some(s=>s.role==="admin")??!1,ke=Z||Te,F=f||u?.membershipTier==="enterprise"||Z,m=J?.organizations??[];c.useEffect(()=>{n&&(m.length===0||m.some(s=>s.id===n))||(u?.organizationId&&(m.length===0||m.some(s=>s.id===u.organizationId))?z(u.organizationId):m.length===1?z(m[0].id):z(void 0))},[m,n,u?.organizationId]);const D=n?`?organizationId=${encodeURIComponent(n)}
1`:"",k=F&&(m.length<=1||!!n),{data:l,error:M}=h({queryKey:["/api/enterprise/organization",n],queryFn:async()=>{const s=`/api/enterprise/organization${D}`,t=await fetch(s,{credentials:"include",cache:"no-store"});if(!t.ok){const d=await t.json().catch(()=>null);if(!f&&Ke(t.status,d)){const E=Ve(t.status,d);throw Qe(s),E}throw await Ge(t,"Failed to fetch organization")}return t.json()},enabled:k,staleTime:0,refetchOnMount:"always",refetchOnWindowFocus:!0,refetchOnReconnect:!0,refetchInterval:3e4,refetchIntervalInBackground:!0});c.useEffect(()=>{!f&&n&&te(M)&&$e(b,{organizationId:n})},[f,M,b,n]);const{data:a}=h({queryKey:["/api/enterprise/analytics",L,n],queryFn:async()=>{const s=await fetch(`/api/enterprise/analytics?period=${L}${n?`&organizationId=${encodeURIComponent(n)}`:""}`);if(!s.ok)throw new Error("Failed to fetch analytics");return s.json()},enabled:k}),{data:$}=h({queryKey:["/api/enterprise/playlists",n],queryFn:async()=>{const s=await fetch(`/api/enterprise/playlists${D}`,{credentials:"include"});if(!s.ok)throw new Error("Failed to fetch playlists");return s.json()},enabled:k}),{data:O}=h({queryKey:["/api/enterprise/activity",n],queryFn:async()=>{const s=await fetch(`/api/enterprise/activity${D}`,{credentials:"include"});if(!s.ok)throw new Error("Failed to fetch activity");return s.json()},enabled:k}),{data:R}=h({queryKey:["/api/org/sponsors",l?.slug],queryFn:async()=>{if(!l?.slug)return[];const s=await fetch(`/api/org/${l.slug}/brand-sponsors`,{credentials:"include"});return s.ok?s.json():[]},enabled:F&&!!l?.slug}),X=C({mutationFn:async s=>{const t=await fetch(`/api/org/${l?.slug}/brand-sponsors`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(s)});if(!t.ok)throw new Error("Failed to create sponsor");return t.json()},onSuccess:()=>{b.invalidateQueries({queryKey:["/api/org/sponsors",l?.slug]}),j({title:"Sponsor created",description:"New sponsor has been added."}),S(!1),q()},onError:()=>{j({title:"Error",description:"Failed to create sponsor.",variant:"destructive"})}}),ee=C({mutationFn:async({id:s,data:t})=>{const d=await fetch(`/api/org/${l?.slug}/brand-sponsors/${s}`,{method:"PATCH",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(t)});if(!d.ok)throw new Error("Failed to update sponsor");return d.json()},onSuccess:()=>{b.invalidateQueries({queryKey:["/api/org/sponsors",l?.slug]}),j({title:"Sponsor updated"}),S(!1),U(null),q()}}),Ee=C({mutationFn:async({id:s,isActive:t})=>{const d=await fetch(`/api/org/${l?.slug}/brand-sponsors/${s}/toggle`,{method:"PATCH",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({isActive:t})});if(!d.ok)throw new Error("Failed to toggle sponsor");return d.json()},onSuccess:()=>{b.invalidateQueries({queryKey:["/api/org/sponsors",l?.slug]})}}),Pe=C({mutationFn:async s=>{const t=await fetch(`/api/org/${l?.slug}/brand-sponsors/${s}`,{method:"DELETE",credentials:"include"});if(!t.ok)throw new Error("Failed to delete sponsor");return t.json()},onSuccess:()=>{b.invalidateQueries({queryKey:["/api/org/sponsors",l?.slug]}),j({title:"Sponsor deleted"})}}),q=()=>{x({name:"",logoUrl:"",websiteUrl:"",tagline:"",zones:[],sponsorshipTier:"tier3",priority:0})},Ae=s=>{U(s),x({name:s.name,logoUrl:s.logoUrl,websiteUrl:s.websiteUrl,tagline:s.tagline||"",zones:s.zones||[],sponsorshipTier:s.sponsorshipTier||"tier3",priority:s.priority}),S(!0)},Ie=()=>{T?ee.mutate({id:T.id,data:o}):X.mutate(o)},Le=s=>{x(t=>({...t,zones:t.zones.includes(s)?t.zones.filter(d=>d!==s):[...t.zones,s]}))},se=C({mutationFn:async s=>{const t=await fetch("/api/enterprise/invite",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:s,organizationId:n})});if(!t.ok)throw new Error("Failed to send invite");return t.json()},onSuccess:()=>{j({title:r("enterprise.inviteSent"),description:r("enterprise.inviteSentDesc")}),G(""),W(!1)},onError:()=>{j({title:r("enterprise.inviteError"),description:r("enterprise.inviteErrorDesc"),variant:"destructive"})}}),Ue=s=>{fe({shareCode:s.shareCode,name:s.name,description:s.description||"",moduleCount:s.moduleCount||0}),Y(!0)};return F?!f&&te(M)?e.jsx("div",{className:"flex min-h-screen items-center justify-center px-6 text-center",children:e.jsx("p",{"data-testid":"text-learning-access-denied",children:Oe})}):e.jsxs("div",{className:"bg-background text-foreground min-h-screen",children:[e.jsx(ie,{}),e.jsx(Ze,{tourId:V.ENTERPRISE_ADMIN,steps:Xe,autoStart:!Ce,startNonce:Ne,delay:2500}),e.jsx("section",{className:"pt-32 pb-8","data-testid":"section-enterprise-hero",children:e.jsx("div",{className:"max-w-7xl mx-auto px-6",children:e.jsxs("div",{className:"flex items-center justify-between mb-8",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"inline-flex items-center gap-2 px-3 py-1 rounded-full bg-primary/10 text-primary text-sm font-medium mb-4",children:[e.jsx(xe,{size:14}),e.jsx("span",{children:r("enterprise.badge")})]}),e.jsx("h1",{className:"font-display text-3xl font-bold",children:l?.name||r("enterprise.yourOrganization")})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[m.length>1&&e.jsxs(_,{value:n??"",onValueChange:z,children:[e.jsx(B,{className:"w-[220px]","data-testid":"select-enterprise-organization",children:e.jsx(H,{placeholder:"Select organization"})}),e.jsx(K,{children:m.map(s=>e.jsx(w,{value:s.id,children:s.name},s.id))})]}),e.jsx(es,{tourId:V.ENTERPRISE_ADMIN,onStart:ze}),e.jsxs(le,{open:je,onOpenChange:W,children:[e.jsx(oe,{asChild:!0,children:e.jsxs(i,{className:"gap-2","data-testid":"button-invite-user",children:[e.jsx(rs,{size:16}),r("enterprise.inviteUser")]})}),e.jsxs(de,{children:[e.jsx(ce,{children:e.jsx(me,{children:r("enterprise.inviteTeamMember")})}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsx("div",{children:e.jsx(p,{type:"email",placeholder:r("enterprise.emailPlaceholder"),value:
1I,onChange:s=>G(s.target.value),"data-testid":"input-invite-email"})}),e.jsxs(i,{className:"w-full gap-2",onClick:()=>se.mutate(I),disabled:!I||se.isPending,"data-testid":"button-send-invite",children:[e.jsx(as,{size:16}),r("enterprise.sendInvitation")]})]})]})]})]})]})})}),e.jsx("section",{className:"pb-8","data-testid":"section-enterprise-tools",children:e.jsxs("div",{className:"max-w-7xl mx-auto px-6",children:[e.jsx("h2",{className:"text-xl font-semibold mb-4",children:"Enterprise Tools"}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4",children:[{icon:e.jsx(is,{size:20}),label:"Compliance",desc:"Track requirements & recertifications",href:"/compliance-dashboard"},{icon:e.jsx(ns,{size:20}),label:"ILT Sessions",desc:"Schedule instructor-led training",href:"/ilt-sessions"},{icon:e.jsx(ls,{size:20}),label:"Enrollment Rules",desc:"Auto-enroll by role or department",href:"/enrollment-rules"},{icon:e.jsx(os,{size:20}),label:"Report Builder",desc:"Custom reports & analytics",href:"/report-builder"},{icon:e.jsx(ds,{size:20}),label:"Course Sales",desc:"Pricing, purchases & enrollment keys",href:"/course-sales"},{icon:e.jsx(cs,{size:20}),label:"AI Assistant",desc:"Query data with natural language",href:"/ai-assistant"},{icon:e.jsx(ms,{size:20}),label:"Course Builder",desc:"Author courses & manage lessons",href:"/course-builder"},{icon:e.jsx(xs,{size:20}),label:"Checklists",desc:"Observational skill verification",href:"/checklists"}].map(s=>e.jsx(P,{href:s.href,children:e.jsxs("div",{className:"bg-card border border-border rounded-2xl p-4 hover:border-primary/50 hover:shadow-md transition-all cursor-pointer group","data-testid":`tool-card-${s.href.slice(1)}`,children:[e.jsxs("div",{className:"flex items-start justify-between mb-2",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl bg-primary/10 flex items-center justify-center text-primary",children:s.icon}),e.jsx(Re,{size:16,className:"text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity mt-1"})]}),e.jsx("h3",{className:"font-semibold text-sm mt-3",children:s.label}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:s.desc})]})},s.href))})]})}),e.jsx("section",{className:"pb-16",children:e.jsx("div",{className:"max-w-7xl mx-auto px-6",children:e.jsxs(We,{defaultValue:"analytics",className:"space-y-6",children:[e.jsxs(Ye,{className:"bg-card border border-border",children:[e.jsxs(v,{value:"analytics",className:"gap-2","data-testid":"tab-analytics",children:[e.jsx(qe,{size:16}),r("enterprise.tabs.analytics")]}),e.jsxs(v,{value:"users",className:"gap-2","data-testid":"tab-users",children:[e.jsx(A,{size:16}),r("enterprise.tabs.users")]}),e.jsxs(v,{value:"playlists",className:"gap-2","data-testid":"tab-playlists",children:[e.jsx(re,{size:16}),r("enterprise.tabs.playlists")]}),e.jsxs(v,{value:"activity",className:"gap-2","data-testid":"tab-activity",children:[e.jsx(us,{size:16}),r("enterprise.tabs.activity")]}),e.jsxs(v,{value:"sponsors",className:"gap-2","data-testid":"tab-sponsors",children:[e.jsx(ue,{size:16}),"Sponsors"]}),e.jsxs(v,{value:"settings",className:"gap-2","data-testid":"tab-settings",children:[e.jsx(_e,{size:16}),r("enterprise.tabs.settings")]})]}),e.jsxs(y,{value:"analytics",className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h2",{className:"text-xl font-semibold",children:r("enterprise.analytics.title")}),e.jsxs(_,{value:L,onValueChange:be,children:[e.jsxs(B,{className:"w-48","data-testid":"select-time-period",children:[e.jsx(Be,{size:16,className:"mr-2"}),e.jsx(H,{})]}),e.jsx(K,{children:Es.map(s=>e.jsx(w,{value:s.value,children:r(`enterprise.timePeriods.${s.value}`)},s.value))})]})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-4",children:[e.jsxs("div",{className:"p-4 rounded-xl bg-card border border-border",children:[e.jsx(hs,{size:20,className:"text-primary mb-2"}),e.jsx("div",{className:"text-2xl font-bold",children:a?.summary.totalPlays||0}),e.jsx("div",{className:"text-xs text-muted-foreground",children:r("enterprise.analytics.totalPlays")})]}),e.jsxs("div",{className:"p-4 rounded-xl bg-card border border-border",children:[e.jsx(ps,{size:20,className:"text-blue-500 mb-2"}),e.jsx("div",{className:"text-2xl font-bold",children:a?.summary.totalHours||0}),e.jsx("div",{className:"text-xs text-muted-foreground",children:r("enterprise.analytics.hoursOfLearning")})]}),e.jsxs("div",{className:"p-4 rounded-xl bg-card border border-border",children:[e.jsx(gs,{size:20,className:"text-green-500 mb-2"}),e.jsx("div",{className:"text-2xl font-bold",children:a?.summary.totalCompletions||0}),e.jsx("div",{className:"text-xs text-muted-foreground",children:r("enterprise.analytics.modulesCompleted")})]}),e.jsxs("div",{className:"p-4 rounded-xl bg-card border border-border",children:[e.jsx(js,{size:20,className:"text-purple-500 mb-2"}),e.jsx("div",{className:"text-2xl font-bold",children:a?.summary.totalPlaylistsCreated||0}),e.jsx("div",{className:"text-xs text-muted-foreground",children:r("enterprise.analytics.playlistsCreated")})]}),e.jsxs("div",{className:"p-4 rounded-xl bg-card border border-border",children:[e.jsx(A,{size:20,className:"text-amber-500 mb-2"}),e.jsx("div",{className:"text-2xl font-bold",children:a?.summary.totalUsers||0}),e.jsx("div",{className:"text-xs text-muted-foreground",children:r("enterprise.analytics.totalUsers")})]}),e.jsxs("div",{className:"p-4 rounded-xl bg-card border border-border",children:[e.jsx(he,{size:20,className:"text-teal-500 mb-2"}),e.jsx("div",{className:"text-2xl font-bold",children:a?.summary.activeUsers||0}),e.jsx("div",{className:"text-xs text-muted-foreground",children:r("enterprise.analytics.activeUsers")})]})]}),e.jsxs("div",{className:"grid lg:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"rounded-xl border border-border bg-card p-6",children:[e.jsxs("h3",{className:"font-semibold mb-4 flex items-center gap-2",children:[e.jsx(ae,{size:18}),r("enterprise.analytics.categoriesListenedTo")]}),a?.categories&&a.categories.length>0?e.jsx("div",{className:"space-y-3",children:a.categories.map((s,t)=>e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:`w-8 h-8 rounded-lg flex items-center justify-center text-sm font-bold ${t===0?"bg-primary/20 text-primary":t===1?"bg-blue-500/20 text-blue-500":t===2?"bg-green-500/20 text-green-500":"bg-muted text-muted-foreground"}`,children:t+1}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:s.name}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:[s.hours," ",r("enterprise.analytics.hours")]})]})]}),e.jsxs("div",{className:"text-right",children:[e.jsxs("div",{className:"font-medium",children:[s.plays," ",r("enterprise.analytics.plays")]}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:[s.completions," ",r("enterprise.analytics.completed")]})]})]},s.name))}):e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[e.jsx(ae,{size:48,className:"mx-auto mb-4 opacity-50"}),e.jsx("p",{children:r("enterprise.analytics.noCategoryData")})]})]}),e.jsxs("div",{className:"rounded-xl border border-border bg-card p-6",children:[e.jsxs("h3",{className:"font-semibold mb-4 flex items-center gap-2",children:[e.jsx(A,{size:18}),r("enterprise.analytics.topLearners")]}),a?.individualStats&&a.individualStats.length>0?e.jsx("div",{className:"space-y-3",children:a.individualStats.slice(0,10).map((s,t)=>e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:`w-8 h-8 rounded-full flex items-center justify-center text-sm font-bold ${t===0?"bg-yellow-500/20 text-yellow-500":t===1?"bg-gray-400/20 text-gray-400":t===2?"bg-amber-600/20 text-amber-600":"bg-muted text-muted-foreground"}`,children:t+1}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:s.name}),e.jsx("div",{className:"text-xs text-muted-foreground",children:s.email})]})]}),e.jsxs("div",{className:"text-right",children:[e.jsxs("div",{className:"font-medium",children:[s.hours," ",r("enterprise.analytics.hrs")]}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:[s.plays," ",r("enterprise.analytics.plays")]})]})]},s.userId))}):e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[e.jsx(A,{size:48,className:"mx-auto mb-4 opacity-50"}),e.jsx("p",{children:r("enterprise.analytics.noUserActivity")})]})]})]}),e.jsxs("div",{className:"rounded-xl border border-border overflow-hidden",children:[e.jsx("div",{className:"bg-muted/30 px-6 py-4 border-b border-border",children:e.jsx("h3",{className:"font-semibold",children:r("enterprise.analytics.individualPerformance")})}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{className:"bg-muted/50",children:e.jsxs("tr",{children:[e.jsx("th",{className:"text-left p-4 text-sm font-medium",children:r("enterprise.users.tableUser")}),e.jsx("th",{className:"text-right p-4 text-sm font-medium",children:r("enterprise.users.tablePlays")}),e.jsx("th",{className:"text-right p-4 text-sm font-medium",children:r("enterprise.users.tableHours")}),e.jsx("th",{className:"text-right p-4 text-sm font-medium",children:r("enterprise.users.tableCompletions")}),e.jsx("th",{className:"text-right p-4 text-sm font-medium",children:r("enterprise.users.tablePlaylists")}
1)]})}),e.jsxs("tbody",{children:[a?.individualStats?.map(s=>e.jsxs("tr",{className:"border-t border-border hover:bg-muted/20",children:[e.jsxs("td",{className:"p-4",children:[e.jsx("div",{className:"font-medium",children:s.name}),e.jsx("div",{className:"text-sm text-muted-foreground",children:s.email})]}),e.jsx("td",{className:"p-4 text-right font-medium",children:s.plays}),e.jsx("td",{className:"p-4 text-right font-medium",children:s.hours}),e.jsx("td",{className:"p-4 text-right font-medium",children:s.completions}),e.jsx("td",{className:"p-4 text-right font-medium",children:s.playlists})]},s.userId)),(!a?.individualStats||a.individualStats.length===0)&&e.jsx("tr",{children:e.jsx("td",{colSpan:5,className:"p-8 text-center text-muted-foreground",children:r("enterprise.analytics.noUserData")})})]})]})})]})]}),e.jsx(y,{value:"users",className:"space-y-4",children:e.jsx("div",{className:"rounded-xl border border-border overflow-hidden",children:e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{className:"bg-muted/50",children:e.jsxs("tr",{children:[e.jsx("th",{className:"text-left p-4 text-sm font-medium",children:r("enterprise.users.tableUser")}),e.jsx("th",{className:"text-right p-4 text-sm font-medium",children:r("enterprise.users.tablePlays")}),e.jsx("th",{className:"text-right p-4 text-sm font-medium",children:r("enterprise.users.tableHours")}),e.jsx("th",{className:"text-right p-4 text-sm font-medium",children:r("enterprise.users.tableCompleted")}),e.jsx("th",{className:"text-right p-4 text-sm font-medium",children:r("enterprise.users.tablePlaylists")})]})}),e.jsxs("tbody",{children:[a?.individualStats?.map(s=>e.jsxs("tr",{className:"border-t border-border hover:bg-muted/20",children:[e.jsxs("td",{className:"p-4",children:[e.jsx("div",{className:"font-medium",children:s.name}),e.jsx("div",{className:"text-sm text-muted-foreground",children:s.email})]}),e.jsx("td",{className:"p-4 text-right",children:s.plays}),e.jsx("td",{className:"p-4 text-right",children:s.hours}),e.jsx("td",{className:"p-4 text-right",children:s.completions}),e.jsx("td",{className:"p-4 text-right",children:s.playlists})]},s.userId)),(!a?.individualStats||a.individualStats.length===0)&&e.jsx("tr",{children:e.jsx("td",{colSpan:5,className:"p-8 text-center text-muted-foreground",children:r("enterprise.users.noUsers")})})]})]})})}),e.jsxs(y,{value:"playlists",className:"space-y-4",children:[e.jsxs("div",{className:"flex justify-between items-center mb-4",children:[e.jsx("h3",{className:"font-semibold",children:"Your Playlists"}),e.jsx(P,{href:"/my-progress",children:e.jsxs(i,{variant:"outline",className:"gap-2",children:[e.jsx(Q,{size:16}),"Create Playlist"]})})]}),e.jsxs("div",{className:"grid md:grid-cols-2 lg:grid-cols-3 gap-4",children:[$?.map(s=>e.jsxs("div",{className:"p-4 rounded-xl bg-card border border-border",children:[e.jsxs("div",{className:"flex items-start justify-between mb-2",children:[e.jsx("h4",{className:"font-semibold",children:s.name}),e.jsx("span",{className:`px-2 py-0.5 rounded-full text-xs ${s.isPublic?"bg-green-500/10 text-green-500":"bg-muted text-muted-foreground"}`,children:s.isPublic?"Public":"Private"})]}),s.description&&e.jsx("p",{className:"text-sm text-muted-foreground mb-3 line-clamp-2",children:s.description}),e.jsxs("div",{className:"text-xs text-muted-foreground mb-4",children:[s.moduleCount," modules"]}),ke?e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(i,{size:"sm",variant:"outline",className:"gap-1 flex-1",onClick:()=>Ue(s),"data-testid":`button-share-playlist-${s.id}`,children:[e.jsx(bs,{size:14}),"Share"]}),e.jsx("a",{href:`/playlist/${s.shareCode}`,target:"_blank",rel:"noopener noreferrer",children:e.jsx(i,{size:"sm",variant:"ghost",className:"gap-1","data-testid":`button-view-playlist-${s.id}`,children:e.jsx(He,{size:14})})})]}):e.jsx("p",{className:"text-xs text-muted-foreground",children:"Contact your organization admin to share playlists."})]},s.id)),(!$||$.length===0)&&e.jsxs("div",{className:"col-span-full p-8 text-center text-muted-foreground bg-card rounded-xl border border-border",children:[e.jsx(re,{size:48,className:"mx-auto mb-4 opacity-50"}),e.jsx("p",{className:"mb-4",children:"No playlists yet. Create a playlist to share with your team."}),e.jsx(P,{href:"/my-progress",children:e.jsx(i,{children:"Create Your First Playlist"})})]})]}),N&&e.jsx(ss,{open:ve,onOpenChange:Y,shareCode:N.shareCode,playlistName:N.name,description:N.description,moduleCount:N.moduleCount})]}),e.jsx(y,{value:"activity",className:"space-y-4",children:e.jsx("div",{className:"rounded-xl border border-border overflow-hidden",children:e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{className:"bg-muted/50",children:e.jsxs("tr",{children:[e.jsx("th",{className:"text-left p-4 text-sm font-medium",children:"User"}),e.jsx("th",{className:"text-left p-4 text-sm font-medium",children:"Activity"}),e.jsx("th",{className:"text-left p-4 text-sm font-medium",children:"Module"}),e.jsx("th",{className:"text-left p-4 text-sm font-medium",children:"Date"})]})}),e.jsxs("tbody",{children:[O?.map(s=>e.jsxs("tr",{className:"border-t border-border hover:bg-muted/20",children:[e.jsx("td",{className:"p-4 font-medium",children:s.userName}),e.jsx("td",{className:"p-4",children:e.jsx("span",{className:`px-2 py-1 rounded-full text-xs font-medium ${s.activityType==="module_completed"?"bg-green-500/10 text-green-500":s.activityType==="module_started"?"bg-blue-500/10 text-blue-500":s.activityType==="playlist_created"?"bg-purple-500/10 text-purple-500":"bg-muted text-muted-foreground"}`,children:s.activityType.replace(/_/g," ")})}),e.jsx("td",{className:"p-4 text-sm",children:s.moduleTitle||"—"}),e.jsx("td",{className:"p-4 text-sm text-muted-foreground",children:new Date(s.createdAt).toLocaleStr
1ing()})]},s.id)),(!O||O.length===0)&&e.jsx("tr",{children:e.jsx("td",{colSpan:4,className:"p-8 text-center text-muted-foreground",children:"No activity recorded yet. Activity will appear as users engage with content."})})]})]})})}),e.jsxs(y,{value:"sponsors",className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-semibold",children:"Sponsorship Management"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Manage sponsors across your learning experience"})]}),e.jsxs(le,{open:ye,onOpenChange:s=>{S(s),s||(U(null),q())},children:[e.jsx(oe,{asChild:!0,children:e.jsxs(i,{className:"gap-2","data-testid":"button-add-sponsor",children:[e.jsx(Q,{size:16}),"Add Sponsor"]})}),e.jsxs(de,{className:"max-w-lg max-h-[80vh] overflow-y-auto",children:[e.jsx(ce,{children:e.jsx(me,{children:T?"Edit Sponsor":"Add New Sponsor"})}),e.jsxs("div",{className:"space-y-4 py-2",children:[e.jsxs("div",{children:[e.jsx(g,{children:"Sponsor Name"}),e.jsx(p,{"data-testid":"input-sponsor-name",value:o.name,onChange:s=>x(t=>({...t,name:s.target.value})),placeholder:"Acme Corp"})]}),e.jsxs("div",{children:[e.jsx(g,{children:"Logo URL"}),e.jsx(p,{"data-testid":"input-sponsor-logo",value:o.logoUrl,onChange:s=>x(t=>({...t,logoUrl:s.target.value})),placeholder:"https://example.com/logo.png"})]}),e.jsxs("div",{children:[e.jsx(g,{children:"Website URL"}),e.jsx(p,{"data-testid":"input-sponsor-website",value:o.websiteUrl,onChange:s=>x(t=>({...t,websiteUrl:s.target.value})),placeholder:"https://example.com"})]}),e.jsxs("div",{children:[e.jsx(g,{children:"Tagline"}),e.jsx(p,{"data-testid":"input-sponsor-tagline",value:o.tagline,onChange:s=>x(t=>({...t,tagline:s.target.value})),placeholder:"Empowering teams everywhere"})]}),e.jsxs("div",{children:[e.jsx(g,{children:"Sponsorship Tier"}),e.jsxs(_,{value:o.sponsorshipTier,onValueChange:s=>x(t=>({...t,sponsorshipTier:s})),children:[e.jsx(B,{"data-testid":"select-sponsor-tier",children:e.jsx(H,{})}),e.jsxs(K,{children:[e.jsx(w,{value:"tier1",children:"Tier 1 — Premium"}),e.jsx(w,{value:"tier2",children:"Tier 2 — High Value"}),e.jsx(w,{value:"tier3",children:"Tier 3 — Standard"})]})]})]}),e.jsxs("div",{children:[e.jsx(g,{children:"Priority (higher = shown first)"}),e.jsx(p,{type:"number","data-testid":"input-sponsor-priority",value:o.priority,onChange:s=>x(t=>({...t,priority:parseInt(s.target.value)||0}))})]}),e.jsxs("div",{children:[e.jsx(g,{className:"mb-2 block",children:"Zone Placements"}),e.jsx("div",{className:"space-y-2",children:ks.map(s=>{const t=pe[s.tier];return e.jsxs("label",{className:"flex items-center gap-3 p-2 rounded-lg hover:bg-muted/50 cursor-pointer","data-testid":`zone-toggle-${s.key}`,children:[e.jsx("input",{type:"checkbox",checked:o.zones.includes(s.key),onChange:()=>Le(s.key),className:"rounded"}),e.jsx("span",{className:"text-sm flex-1",children:s.label}),e.jsx("span",{className:`text-xs px-2 py-0.5 rounded-full ${t.color}`,children:t.label})]},s.key)})})]}),e.jsx(i,{className:"w-full",onClick:Ie,disabled:!o.name||!o.logoUrl||!o.websiteUrl||X.isPending||ee.isPending,"data-testid":"button-submit-sponsor",children:T?"Update Sponsor":"Create Sponsor"})]})]})]})]}),R&&R.length>0?e.jsx("div",{className:"space-y-4",children:R.map(s=>{const t=pe[s.sponsorshipTier||"tier3"],d=s.impressionCount>0?(s.clickCount/s.impressionCount*100).toFixed(1):"0.0";return e.jsx("div",{className:"p-4 rounded-xl bg-card border border-border","data-testid":`sponsor-card-${s.id}`,children:e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx("div",{className:"w-[80px] h-[40px] flex items-center justify-center flex-shrink-0 bg-muted rounded-lg p-1",children:e.jsx("img",{src:s.logoUrl,alt:s.name,className:"max-w-full max-h-full object-contain"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("h4",{className:"font-semibold",children:s.name}),e.jsx("span",{className:`text-xs px-2 py-0.5 rounded-full ${t.color}`,children:t.label}),e.jsx("span",{className:`text-xs px-2 py-0.5 rounded-full ${s.isActive?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:s.isActive?"Active":"Inactive"})]}),s.tagline&&e.jsx("p",{className:"text-sm text-muted-foreground",children:s.tagline}),e.jsx("div",{className:"flex flex-wrap gap-1 mt-2",children:(s.zones||[]).map(E=>e.jsx("span",{className:"text-xs bg-muted px-2 py-0.5 rounded",children:E},E))})]}),e.jsxs("div",{className:"flex items-center gap-6 text-sm",children:[e.jsxs("div",{className:"text-center","data-testid":`sponsor-impressions-${s.id}`,children:[e.jsx("div",{className:"flex items-center gap-1 text-muted-foreground",children:e.jsx(fs,{size:14})}),e.jsx("div",{className:"font-medium",children:s.impressionCount}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"Impressions"})]}),e.jsxs("div",{className:"text-center","data-testid":`sponsor-clicks-${s.id}`,children:[e.jsx("div",{className:"flex items-center gap-1 text-muted-foreground",children:e.jsx(vs,{size:14})}),e.jsx("div",{className:"font-medium",children:s.clickCount}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"Clicks"})]}),e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"flex items-center gap-1 text-muted-foreground",children:e.jsx(he,{size:14})}),e.jsxs("div",{className:"font-medium",children:[d,"%"]}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"CTR"})]})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(i,{variant:"ghost",size:"sm",onClick:()=>Ee.mutate({id:s.id,isActive:!s.isActive}),"data-testid":`button-toggle-sponsor-${s.id}`,children:s.isActive?e.jsx(Ts,{size:18,className:"text-green-500"}):e.jsx(ws,{size:18,className:"text-muted-foreground"})}),e.jsx(i,{variant:"ghost",size:"sm",onClick:()=>Ae(s),"data-testid":`button-edit-sponsor-${s.id}`,children:e.jsx(ys,{size:14})}),e.jsx(i,{variant:"ghost",size:"sm",onClick:()=>Pe.mutate(s.id),className:"text-red-500 hover:text-red-600","data-testid":`button-delete-sp
1onsor-${s.id}`,children:e.jsx(Ns,{size:14})})]})]})},s.id)})}):e.jsxs("div",{className:"text-center py-12 bg-card rounded-xl border border-border",children:[e.jsx(ue,{size:48,className:"mx-auto mb-4 text-muted-foreground opacity-50"}),e.jsx("h3",{className:"font-semibold mb-2",children:"No sponsors configured"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Add sponsors to display across your learning experience."}),e.jsxs(i,{onClick:()=>S(!0),"data-testid":"button-add-first-sponsor",children:[e.jsx(Q,{size:16,className:"mr-2"}),"Add Your First Sponsor"]})]})]}),e.jsxs(y,{value:"settings",className:"space-y-6",children:[e.jsxs("div",{className:"p-6 rounded-xl bg-card border border-border",children:[e.jsxs("div",{className:"flex items-start gap-4 mb-6",children:[e.jsx("div",{className:"w-12 h-12 rounded-xl bg-primary/10 flex items-center justify-center",children:e.jsx(Ss,{size:24,className:"text-primary"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold text-lg",children:"Single Sign-On (SSO)"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Configure SSO to allow your team to sign in with your organization's identity provider."})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"p-4 rounded-lg border border-border bg-background",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:"SAML 2.0"}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"Connect to Okta, OneLogin, or other SAML providers"})]}),e.jsx(i,{variant:"outline",size:"sm",children:"Configure"})]})}),e.jsx("div",{className:"p-4 rounded-lg border border-border bg-background",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:"Microsoft Azure AD"}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"Enable Microsoft work account login"})]}),e.jsx(i,{variant:"outline",size:"sm",children:"Configure"})]})}),e.jsx("div",{className:"p-4 rounded-lg border border-border bg-background",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:"Google Workspace"}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"Allow Google Workspace domain login"})]}),e.jsx(i,{variant:"outline",size:"sm",children:"Configure"})]})}),e.jsx("div",{className:"p-4 rounded-lg border border-border bg-background",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:"Okta"}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"Connect directly to Okta"})]}),e.jsx(i,{variant:"outline",size:"sm",children:"Configure"})]})})]}),e.jsx("div",{className:"mt-6 p-4 rounded-lg bg-muted/30",children:e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Need help setting up SSO? Contact our enterprise support team at ",e.jsx("a",{href:"mailto:[email protected]",className:"text-primary hover:underline",children:"[email protected]"})]})})]}),e.jsxs("div",{className:"p-6 rounded-xl bg-card border border-border",children:[e.jsx("h3",{className:"font-semibold text-lg mb-4",children:"Domain Verification"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Verify your domain to automatically add users with matching email addresses to your organization."}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(p,{placeholder:"yourcompany.com",className:"flex-1"}),e.jsx(i,{children:"Verify Domain"})]})]})]})]})})}),e.jsx(ne,{})]}):e.jsxs("div",{className:"bg-background text-foreground min-h-screen",children:[e.jsx(ie,{}),e.jsx("div",{className:"pt-32 pb-16 text-center",children:e.jsxs("div",{className:"max-w-2xl mx-auto px-6",children:[e.jsx(xe,{size:64,className:"mx-auto text-muted-foreground mb-6"}),e.jsx("h1",{className:"font-display text-3xl font-bold mb-4",children:r("enterprise.title")}),e.jsx("p",{className:"text-muted-foreground mb-8",children:r("enterprise.noAccessMessage")}),e.jsx(P,{href:"/learning/enterprise-pricing",children:e.jsx(i,{size:"lg","data-testid":"button-view-enterprise",children:r("enterprise.viewEnterprisePlans")})})]})}),e.jsx(ne,{})]})}
1export{At 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.