PageSourceSearch

https://skillsend.ai/assets/AdminGeo-BJPETXco.js

js skillsend.ai collected 2026-10-05 15:01:37 UTC 5,441 bytes, 1 lines download raw bytes

1import{r as l,j as e}from"./vendor-ui-Ct21t0qS.js";import{u as S,s as E,B as y,aS as G,T as u}from"./index-AVQVOSmy.js";import{b as D}from"./admin-economics-opitul8T.js";import{E as L}from"./EnvironmentBadge-CLFUI4mH.js";import{A as P,S as o,D as v,a as N,P as i,c as I}from"./directory-y0d4tkSb.js";import{u as R}from"./vendor-react-06-JDQ11.js";import{A as U}from"./arrow-left-Do1kEzHx.js";import{G as F}from"./globe-BklB0Lln.js";import"./vendor-auth-CW-W13oV.js";import"./vendor-excalidraw-B8dKh24X.js";import"./vendor-editor-CSQkwAvY.js";import"./vendor-charts-BtrxrLbI.js";import"./vendor-observability-UFhKWPWG.js";import"./vendor-query-CA46PksI.js";function A(a){if(!a||a.length!==2)return"🌐";const r=127462;return String.fromCodePoint(...[...a.toUpperCase()].map(n=>r+n.charCodeAt(0)-65))}function X(){var j,b,w;const a=R(),{user:r}=S(),n=(j=r==null?void 0:r.email)==null?void 0:j.endsWith("@craftcode.com"),[s,k]=l.useState(null),[x,g]=l.useState(!0),[h,p]=l.useState(null),[c,C]=l.useState(!1);l.useEffect(()=>{r&&(n||a("/dashboard",{replace:!0}))},[r,n,a]);const d=l.useCallback(async()=>{if(n){g(!0),p(null);try{const t=await E(D,{input:{includeInternal:c}});k(t.adminGeoOverview)}catch(t){p(t instanceof Error?t.message:"Failed to load")}finally{g(!1)}}},[n,c]);if(l.useEffect(()=>{d()},[d]),!n)return null;const f=(s==null?void 0:s.byCountry)??[];return e.jsxs("div",{className:"max-w-7xl mx-auto px-4 py-8 space-y-6",children:[e.jsx(P,{title:"Geography",count:s==null?void 0:s.distinctCountries,subtitle:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(L,{}),e.jsx("span",{children:"Registered users by country (this environment)"})]}),actions:e.jsxs(e.Fragment,{children:[e.jsx(y,{variant:"ghost",size:"sm",onClick:()=>a("/admin"),children:e.jsx(U,{className:"h-4 w-4"})}),e.jsxs("label",{className:"text-xs text-muted-foreground flex items-center gap-1.5 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:c,onChange:t=>C(t.target.checked)}),"Include team/comp"]}),e.jsx(y,{variant:"outline",size:"sm",className:"rounded-full",onClick:d,disabled:x,children:e.jsx(G,{className:`h-4 w-4 ${x?"animate-spin":""}`})})]})}),h&&e.jsxs("div",{className:"border border-red-200 bg-red-50/50 rounded-lg p-4 flex items-center gap-2 text-sm text-red-700",children:[e.jsx(u,{className:"h-4 w-4"})," ",h]}),s&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[e.jsx(o,{label:"Total users",value:s.totalUsers.toLocaleString()}),e.jsx(o,{label:"Known country",value:s.knownUsers.toLocaleString(),sub:`${s.coveragePct}% coverage`}),e.jsx(o,{label:"Distinct countries",value:s.distinctCountries.toLocaleString()}),e.jsx(o,{label:"Unknown",value:(s.totalUsers-s.knownUsers).toLocaleString(),sub:"no country captured yet"})]}),s.coveragePct<50&&e.jsxs("div",{className:"border border-yellow-200 bg-yellow-50/50 rounded-lg p-3 text-xs text-yellow-800 flex items-center gap-2",children:[e.jsx(u,{className:"h-4 w-4 shrink-0"}),"Country is captured from CloudFront at sign-in and backfills on next login — coverage climbs as existing users return. WhatsApp-origin users have no browser geo yet."]}),e.jsxs(v,{children:[f.length===0&&e.jsx("div",{className:"px-4 py-8 text-center text-muted-foreground text-sm",children:"No users to show."}),f.map((t,m)=>e.jsxs(N,{children:[e.jsx("span",{className:"text-lg shrink-0",children:A(t.country==="(unknown)"?"":t.country)}),e.jsx("span",{className:"font-medium text-slate-900 flex-1 truncate",children:t.country}),e.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap justify-end",children:[e.jsxs(i,{children:["web ",t.web]}),e.jsxs(i,{className:"bg-emerald-50 text-emerald-700",children:["wa ",t.whatsapp]}),e.jsxs(i,{className:"bg-amber-50 text-amber-700",children:["trial ",t.trial]}),e.jsxs(i,{className:"bg-emerald-100 text-emerald-700",children:["active ",t.active]})]}),e.jsx("span",{className:"tabular-nums font-semibold text-slate-900 w-12 text-right",children:t.total})]},m))]}),e.jsxs(I,{title:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(F,{className:"h-4 w-4"})," Visitor geography (GA4)"]}),actions:(b=s.ga4)!=null&&b.dataAvailable?e.jsxs("span",{className:"text-xs text-muted-foreground",children:["last ",s.ga4.windowDays,"d · prod web hosts"]}):void 0,children:[e.jsx("p",{className:"text-xs text-muted-foreground mb-3",children:"Anonymous website visitors (mostly pre-signup) — this is where the real geographic signal is, unlike the registered-user table above which stays sparse until users sign in via web."}),!s.ga4||!s.ga4.dataAvailable?e.jsxs("div",{className:"border border-yellow-200 bg-yellow-50/50 rounded-lg p-3 text-xs text-yellow-800 flex items-center gap-2",children:[e.jsx(u,{className:"h-4 w-4 shrink-0"}),"GA4 visitor geography unavailable",(w=s.ga4)!=null&&w.error?` — ${s.ga4.error}`:"","."]}):e.jsxs(v,{children:[s.ga4.regions.length===0&&e.jsx("div",{className:"px-4 py-8 text-center text-muted-foreground text-sm",children:"No GA4 visitor data in window."}),s.ga4.regions.map((t,m)=>e.jsxs(N,{children:[e.jsx("span",{className:"text-lg shrink-0",children:A(t.country.length===2?t.country:"")}),e.jsx("span",{className:"font-medium text-slate-900",children:t.country}
1),e.jsx(i,{children:t.region||"—"}),e.jsx("span",{className:"ml-auto tabular-nums font-semibold text-slate-900",children:t.users})]},m))]})]})]})]})}export{X 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.