PageSourceSearch

https://unicorniq.ai/assets/orientation-DolLHkCm.js

js unicorniq.ai collected 2026-10-05 16:12:24 UTC 7,248 bytes, 1 lines download raw bytes

1import{j as e}from"./index-DP61GySm.js";import{z as T,u as A,lN as R,lO as O,E as p,a2 as m,ai as f,lP as g}from"./loader-circle-eo-mph3g.js";import{L as N}from"./index-MuG4xkEZ.js";import{u as L,C as a,a as o,b as l,d as x,c as r}from"./use-toast-C6aFH3Eg.js";import{dx as I,ap as P,A as S,B as $,bK as F,at as q}from"./App-0t6TVAR4.js";import{c as E}from"./toaster-BDyw2x6L.js";import{H as w}from"./section-chips-C68mRSIN.js";import{T as G}from"./triangle-alert-CaKCF_Nq.js";import{T as H}from"./tags-Bv14kUiT.js";import"./vendor-shared-C5tCw9rW.js";import"./utils-hQAQiId-.js";import"./x-D235ZOFZ.js";import"./shield-check-BQHCFnRX.js";import"./trademark-screen-DYufZ-CB.js";import"./sparkles-B4yqwNG6.js";import"./waypoints-C6gFN1cM.js";import"./dialog-B9xd4dRw.js";import"./privacy-I8Fotoxq.js";import"./chevron-right-qcpptIv2.js";import"./chevron-down-C8mjF8sg.js";import"./image-off-CpRV4JaY.js";import"./trial-copy-BQN_0jwW.js";import"./unicorniq-logo-B9mOeuD0.js";function K(i){const c=i;return c?.data?.error||c?.message||"Something went wrong."}const V={ingested:{icon:f,cls:"text-primary",label:"ingested"},already_ingested:{icon:f,cls:"text-muted-foreground",label:"already in"},skipped:{icon:q,cls:"text-muted-foreground",label:"skipped"},failed:{icon:w,cls:"text-destructive",label:"failed"}};function me(){const{data:i}=T(),{toast:c}=L(),y=A(),h=!!i?.tenantId&&!!i?.roles?.includes("tenant_admin"),{data:s,isLoading:b,error:v}=R({query:{enabled:h,retry:!1,queryKey:g(),refetchInterval:t=>t.state.data?.status==="running"?4e3:!1}}),C=v?.status===404,n=O(),j=()=>n.mutate(void 0,{onSuccess:()=>y.invalidateQueries({queryKey:g()}),onError:t=>c({title:"Orientation could not start",description:K(t)})});return i?h?e.jsx("div",{className:"flex-1 overflow-y-auto bg-muted/20","data-testid":"orientation-page",children:e.jsxs("div",{className:"max-w-4xl mx-auto p-6 lg:p-10 space-y-6",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4 flex-wrap",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl font-semibold flex items-center gap-2",children:[e.jsx(I,{className:"w-6 h-6 text-primary"})," First-boot orientation"]}),e.jsx("p",{className:"text-muted-foreground mt-1 max-w-2xl",children:"Vera reads a bounded starter set from your connected sources, maps what it found, and tells you plainly what it now knows and what is missing."})]}),s&&s.status!=="running"&&e.jsxs(p,{variant:"outline",onClick:j,disabled:n.isPending,"data-testid":"button-rerun-orientation",children:[n.isPending?e.jsx(m,{className:"w-4 h-4 animate-spin"}):e.jsx(P,{className:"w-4 h-4"}),"Run again"]})]}),b?e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[e.jsx(m,{className:"w-4 h-4 animate-spin"})," Loading…"]}):C||!s?e.jsxs(a,{className:"max-w-2xl",children:[e.jsxs(o,{children:[e.jsx(l,{children:"No orientation yet"}),e.jsx(x,{children:"It runs by itself the first time a source is consented for ingestion (with a working AI key). You can also start it now."})]}),e.jsx(r,{children:e.jsxs(p,{onClick:j,disabled:n.isPending,"data-testid":"button-run-orientation",children:[n.isPending&&e.jsx(m,{className:"w-4 h-4 animate-spin"}),"Orient now"]})})]}):e.jsxs(e.Fragment,{children:[s.status==="running"&&e.jsx(a,{className:"border-primary/30",children:e.jsxs(r,{className:"py-4 flex items-center gap-3",children:[e.jsx(m,{className:"w-5 h-5 animate-spin text-primary"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-sm",children:"Vera is orienting itself…"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Reading a starter set, extracting claims and mapping topics. This page updates by itself — first reports usually land in minutes."})]})]})}),s.status==="failed"&&e.jsx(a,{className:"border-destructive/40",children:e.jsxs(r,{className:"py-4 flex items-center gap-3",children:[e.jsx(w,{className:"w-5 h-5 text-destructive"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-sm",children:"The last run failed"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s.error??"Unknown error."})]})]})}),s.narrative&&e.jsx(a,{"data-testid":"orientation-narrative",children:e.jsxs(r,{className:"py-5",children:[e.jsx("p",{className:"text-base leading-relaxed whitespace-pre-wrap",children:s.narrative}),(s.documentCount!=null||s.claimCount!=null)&&e.jsxs("p",{className:"text-xs text-muted-foreground mt-3",children:[s.documentCount??0," documents · ",s.claimCount??0," extracted claims",s.completedAt?` · ${new Date(s.completedAt).toLocaleStr
1ing()}`:""]})]})}),s.gaps.length>0&&e.jsxs(a,{"data-testid":"orientation-gaps",children:[e.jsxs(o,{className:"pb-3",children:[e.jsxs(l,{className:"text-base flex items-center gap-2",children:[e.jsx(G,{className:"w-4 h-4 text-amber-500"})," Gaps worth closing"]}),e.jsx(x,{children:"Priorities from your interview that the starter set did not cover."})]}),e.jsx(r,{className:"space-y-2",children:s.gaps.map((t,d)=>e.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-md border p-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-sm font-medium",children:t.priority}),e.jsx("p",{className:"text-sm text-muted-foreground",children:t.suggestion})]}),t.actionHref&&e.jsx(p,{asChild:!0,size:"sm",variant:"outline",className:"shrink-0",children:e.jsxs(N,{href:t.actionHref,"data-testid":`link-gap-action-${d}`,children:["Fix this ",e.jsx(S,{className:"w-4 h-4"})]})})]},d))})]}),s.topics.length>0&&e.jsxs(a,{"data-testid":"orientation-topics",children:[e.jsxs(o,{className:"pb-3",children:[e.jsxs(l,{className:"text-base flex items-center gap-2",children:[e.jsx(H,{className:"w-4 h-4"})," What Vera found"]}),e.jsx(x,{children:"Topic tags mapped from the extracted claims."})]}),e.jsx(r,{className:"flex flex-wrap gap-2",children:s.topics.map(t=>e.jsx(N,{href:`/knowledge?tag=${encodeURIComponent(t.tag)}`,children:e.jsxs($,{variant:"secondary",className:"cursor-pointer",children:[t.tag," · ",t.documentCount]})},t.tag))})]}),s.sources.length>0&&e.jsxs(a,{"data-testid":"orientation-sources",children:[e.jsx(o,{className:"pb-3",children:e.jsxs(l,{className:"text-base flex items-center gap-2",children:[e.jsx(F,{className:"w-4 h-4"})," Starter set examined"]})}),e.jsx(r,{className:"space-y-1.5",children:s.sources.map((t,d)=>{const u=V[t.action],k=u.icon;return e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(k,{className:`w-4 h-4 shrink-0 ${u.cls}`}),e.jsx("span",{className:"truncate",children:t.source}),e.jsxs("span",{className:"text-muted-foreground shrink-0",children:[u.label,typeof t.importedCount=="number"?` · ${t.importedCount} items`:"",t.detail?` — ${t.detail}`:""]})]},d)})})]})]})]})}):e.jsx("div",{className:"flex-1 overflow-y-auto bg-muted/20",children:e.jsx("div",{className:"max-w-2xl mx-auto p-6 lg:p-10",children:e.jsx(a,{children:e.jsxs(o,{children:[e.jsxs(l,{className:"flex items-center gap-2",children:[e.jsx(E,{className:"w-5 h-5 text-muted-foreground"}),"Orientation reports are for workspace admins"]}),e.jsxs(x,{className:"mt-1",children:["Ask an admin at ",i.tenantName??"your organization"," to share what Vera found on first boot."]})]})})})}):null}export{me 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.