PageSourceSearch

https://ultimatenexus.ai/assets/TwinPersonaBrowserPage-evAkoEA3.js

js ultimatenexus.ai collected 2026-10-05 13:13:12 UTC 3,582 bytes, 1 lines download raw bytes

1import{r as c,j as e}from"./vendor-DG5Dz7Ik.js";import{r as u}from"./rtbTwinAdminService-BHQuMxYf.js";import"./view-analytics-BkPD6vG9.js";import"./pdf-vendor-BQyayL6K.js";import"./socket-vendor-DENoLIvz.js";import"./auth-vendor-CeReGQmr.js";function p(s){if(s.length===0)return[];const a={desktop:0,tablet:.5,mobile:1},m={low:0,mid:.5,high:1};let d=0,r=0,o=0,h=0,l=0;for(const x of s){const t=x.attributes??{};d+=a[String(t.device??"desktop")]??0,r+=(String(t.geo??"US").charCodeAt(0)||0)/255,o+=m[String(t.ltvTier??"low")]??0,h+=(String(t.channel??"email").charCodeAt(0)||0)/255;const i=Number(t.recentCtr??0);l+=Number.isFinite(i)?Math.max(0,Math.min(1,i)):0}const n=s.length;return[{label:"deviceWeight",value:d/n},{label:"geoWeight",value:r/n},{label:"ltvWeight",value:o/n},{label:"channelWeight",value:h/n},{label:"ctrAffinity",value:l/n}]}function g(s){return`hsl(280, 65%, ${Math.round(75-45*Math.max(0,Math.min(1,s)))}%)`}const w=({orgId:s})=>{const[a,m]=c.useState([]),[d,r]=c.useState(null),[o,h]=c.useState(!1),l=c.useCallback(async()=>{r(null);try{const t=await u.listPersonas(s,100);m(t.items)}catch(t){r(t.message)}},[s]);c.useEffect(()=>{l()},[l]);const n=c.useCallback(async()=>{h(!0),r(null);try{await u.seedTwins(s,100),await l()}catch(t){r(t.message)}finally{h(!1)}},[s,l]),x=p(a);return e.jsxs("div",{className:"p-6 space-y-4 text-gray-200",children:[e.jsxs("header",{className:"flex items-center justify-between",children:[e.jsx("h2",{className:"text-xl font-semibold",children:"Twin — Persona Browser"}),e.jsx("button",{type:"button",onClick:n,disabled:o,className:"px-3 py-1.5 text-xs bg-purple-600 hover:bg-purple-700 rounded disabled:opacity-50","data-testid":"twin-seed",children:o?"Seeding…":"Seed 100 personas"})]}),d&&e.jsx("p",{className:"text-sm text-red-400",role:"alert",children:d}),e.jsxs("section",{className:"bg-gray-900 border border-gray-700 rounded p-4 space-y-2",children:[e.jsxs("h3",{className:"text-sm font-semibold text-gray-300",children:["Behavioural-attribute heatmap (avg across ",a.length," personas)"]}),x.length>0?e.jsx("div",{className:"grid grid-cols-5 gap-2","data-testid":"twin-heatmap",children:x.map(t=>e.jsxs("div",{className:"flex flex-col items-center text-xs p-2 rounded",style:{backgroundColor:g(t.value)},"data-testid":`heat-${t.label}`,children:[e.jsx("span",{className:"text-white",children:t.label}),e.jsx("span",{className:"text-white font-mono",children:t.value.toFixed(3)})]},t.label))}):e.jsx("p",{className:"text-xs text-gray-500","data-testid":"twin-heat-empty",children:"No personas yet — click Seed 100 personas."})]}),e.jsxs("section",{className:"bg-gray-900 border border-gray-700 rounded p-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-300 mb-2",children:"Persona list"}),a.length>0?e.jsxs("table",{className:"text-xs w-full","data-testid":"twin-table",children:[e.jsx("thead",{className:"text-gray-400",children:e.jsxs("tr",{children:[e.jsx("th",{className:"text-left",children:"Name"}),e.jsx("th",{className:"text-left",children:"Device"}),e.jsx("th",{className:"text-left",children:"Channel"}),e.jsx("th",{className:"text-right",children:"CTR"})]})}),e.jsx("tbody",{children:a.map(t=>{const i=t.attributes??{};return e.jsxs("tr",{children:[e.jsx("td",{children:t.personaName}),e.jsx("td",{children:String(i.device??"")}),e.jsx("td",{children:String(i.channel??"")}),e.jsx("td",{className:"text-right",children:Number(i.recentCtr??0).toFixed(4)})]},t.id)})})]}):e.jsx("p",{className:"text-xs text-gray-500",children:"No personas to display."})]})]})};export{w 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.