@canonry/canonry 4.180.0 → 4.180.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/agent-workspace/skills/canonry/references/canonry-cli.md +11 -6
- package/assets/assets/{AuditHistoryPanel-DI6iXS0J.js → AuditHistoryPanel-Cf-jEEKZ.js} +1 -1
- package/assets/assets/{BacklinksPage-DiwTMJTp.js → BacklinksPage-oMcS6Hc_.js} +1 -1
- package/assets/assets/{HistoryPage-BWODoEok.js → HistoryPage-CDQOpxi0.js} +1 -1
- package/assets/assets/{MeasurementPropertyPage-C1uZ9LEl.js → MeasurementPropertyPage-MoKFTmrS.js} +1 -1
- package/assets/assets/{ProjectPage-C-fk0Jja.js → ProjectPage-CtD1AwXE.js} +8 -8
- package/assets/assets/{RunRow-CMSISg-I.js → RunRow-CPekiscK.js} +1 -1
- package/assets/assets/{RunsPage-HZwwLQDE.js → RunsPage-hn05ImCv.js} +1 -1
- package/assets/assets/{SettingsPage-3eoRO4ze.js → SettingsPage-BOTYXtfF.js} +1 -1
- package/assets/assets/{SiteHealthSection-CATUc26x.js → SiteHealthSection-FwMZ11F8.js} +3 -3
- package/assets/assets/{TrafficPage-Cw8AM5VR.js → TrafficPage-f2v6A_uk.js} +1 -1
- package/assets/assets/{TrafficSourceDetailPage-ChFDAstr.js → TrafficSourceDetailPage-nhWRLHiu.js} +1 -1
- package/assets/assets/{extract-error-message-CG_IQ_9c.js → extract-error-message-Cp1YeVEr.js} +1 -1
- package/assets/assets/{index-Dz0ju3qg.js → index-VmxEHABq.js} +22 -22
- package/assets/assets/{react-sigma_core.esm.min-BvgsCKLZ.js → react-sigma_core.esm.min-fnm2MkMi.js} +1 -1
- package/assets/index.html +1 -1
- package/dist/{chunk-QPJC2H6J.js → chunk-44LVINXQ.js} +39 -20
- package/dist/{chunk-A6XDLCKF.js → chunk-4XHQ2GCN.js} +2 -2
- package/dist/{chunk-UD3YJQOV.js → chunk-665YENL2.js} +4 -10
- package/dist/{chunk-3JW762Q4.js → chunk-6IR32MIH.js} +5 -7
- package/dist/{chunk-NFALEGSZ.js → chunk-DA25LOTW.js} +2 -2
- package/dist/cli.js +5 -5
- package/dist/index.js +4 -4
- package/dist/{intelligence-service-WQPUIJO6.js → intelligence-service-RNBODYMZ.js} +2 -2
- package/dist/mcp.js +3 -3
- package/package.json +10 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as s}from"./vendor-tanstack-Dock0eH1.js";import{u as r,cy as t,B as a}from"./index-
|
|
1
|
+
import{j as s}from"./vendor-tanstack-Dock0eH1.js";import{u as r,cy as t,B as a}from"./index-VmxEHABq.js";function n({run:e}){const{openRun:i}=r();return s.jsxs("article",{className:"run-row",children:[s.jsxs("div",{className:"run-row-main",children:[s.jsxs("div",{className:"run-row-head",children:[s.jsxs("div",{children:[s.jsx("p",{className:"run-row-title",children:e.summary}),s.jsxs("p",{className:"run-row-subtitle",children:[e.projectName,e.location?` · ${e.location}`:""," · ",e.kindLabel]})]}),s.jsx(t,{status:e.status})]}),s.jsx("p",{className:"run-row-detail",children:e.statusDetail})]}),s.jsxs("dl",{className:"run-row-meta",children:[s.jsxs("div",{children:[s.jsx("dt",{children:"Started"}),s.jsx("dd",{children:e.startedAt})]}),s.jsxs("div",{children:[s.jsx("dt",{children:"Duration"}),s.jsx("dd",{children:e.duration})]}),s.jsxs("div",{children:[s.jsx("dt",{children:"Trigger"}),s.jsx("dd",{children:e.triggerLabel})]})]}),s.jsx(a,{variant:"outline",size:"sm",type:"button",onClick:()=>i(e.id),children:"View run"})]})}export{n as R};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{k as O,h as I,r as p,u as v,j as s}from"./vendor-tanstack-Dock0eH1.js";import{bV as E,c7 as Q,a7 as f,bW as P,i as y,cu as N,cv as W,cw as _,cx as M,j as K,B as w,t as R,f as S}from"./index-
|
|
1
|
+
import{k as O,h as I,r as p,u as v,j as s}from"./vendor-tanstack-Dock0eH1.js";import{bV as E,c7 as Q,a7 as f,bW as P,i as y,cu as N,cv as W,cw as _,cx as M,j as K,B as w,t as R,f as S}from"./index-VmxEHABq.js";import{R as T}from"./RunRow-CPekiscK.js";import"./vendor-radix-4UOaVWza.js";import"./vendor-recharts-D8rt5lKn.js";import"./vendor-lucide-nYKv-BB7.js";import"./vendor-markdown-Bn7fRwrx.js";import"./vendor-yaml-GWJz5H2G.js";const g={"30d":{label:"Last 30 days",days:30},"90d":{label:"Last 90 days",days:90},"365d":{label:"Last year",days:365}};function U(l){return new Date(Date.now()-g[l].days*24*60*60*1e3).toISOString()}function J(){const l=E()?.dashboard,a=O({strict:!1}),k=I(),i=Object.values(Q).includes(a.runStatus)?a.runStatus:"all",o=Object.values(f).includes(a.runKind)?a.runKind:"all",d=a.runProject??"all",c=Object.hasOwn(g,a.runWindow??"")?a.runWindow:"30d",m=a.runQuery??"",C=p.useMemo(()=>U(c),[c]),u=v({...P({client:y}),initialData:l?.projects.map(({project:e})=>e),initialDataUpdatedAt:0}),t=v({...W({client:y,query:{limit:1e3,since:C}}),initialData:l?.runs,initialDataUpdatedAt:0,staleTime:N,refetchInterval:e=>e.state.data?.some(r=>r.status==="queued"||r.status==="running")?3e3:N}),h=_(),x=p.useMemo(()=>new Map((u.data??[]).map(e=>[e.id,e.displayName||e.name])),[u.data]),A=p.useMemo(()=>(t.data??[]).map(e=>"projectName"in e?e:M(e,x.get(e.projectId)??"Unknown project")),[x,t.data]),b=m.trim().toLowerCase(),j=A.filter(e=>i!=="all"&&e.status!==i||o!=="all"&&e.kind!==o||d!=="all"&&e.projectId!==d?!1:b?[e.summary,e.projectName,e.kindLabel,e.statusDetail].some(r=>r.toLowerCase().includes(b)):!0),D=i!=="all"||o!=="all"||d!=="all"||m.trim()!==""||c!=="30d",n=e=>{k({to:"/runs",search:r=>({...r,...e}),replace:!0})};if(u.isLoading||t.isLoading)return s.jsxs("div",{className:"page-skeleton",children:[s.jsxs("div",{className:"page-skeleton-header",children:[s.jsx("div",{className:"skeleton-text h-6 w-20"}),s.jsx("div",{className:"skeleton-text-sm w-72"})]}),s.jsx("div",{className:"space-y-2",children:[1,2,3,4].map(e=>s.jsxs("div",{className:"rounded-xl border border-default bg-surface p-3 flex items-center gap-3",children:[s.jsxs("div",{className:"flex-1 space-y-1.5",children:[s.jsx("div",{className:"skeleton-text w-40"}),s.jsx("div",{className:"skeleton-text-sm w-56"})]}),s.jsx("div",{className:"skeleton h-5 w-16 rounded-full"})]},e))})]});const L=async()=>{try{await h.mutateAsync(void 0)}catch{}};return s.jsxs("div",{className:"page-container",children:[s.jsxs("div",{className:"page-header",children:[s.jsxs("div",{className:"page-header-left",children:[s.jsx("h1",{className:"page-title",children:"Runs"}),s.jsx("p",{className:"page-subtitle",children:"Recent jobs across all projects."})]}),!K()&&s.jsx(w,{type:"button",variant:"outline",size:"sm",disabled:h.isPending,onClick:()=>{L()},children:h.isPending?"Queueing…":"Run all projects"})]}),s.jsxs("section",{children:[s.jsx("div",{className:"filter-row",role:"toolbar","aria-label":"Run filters",children:["all","queued","running","completed","partial","failed","cancelled"].map(e=>s.jsx("button",{className:`filter-chip ${i===e?"filter-chip-active":""}`,type:"button","aria-pressed":i===e,onClick:()=>n({runStatus:e==="all"?void 0:e}),children:e==="all"?"All runs":R(e)},e))}),s.jsxs("div",{className:"mb-4 grid gap-2 sm:grid-cols-2 lg:grid-cols-[minmax(12rem,1fr)_minmax(10rem,0.7fr)_minmax(9rem,0.6fr)_minmax(9rem,0.6fr)_auto]",children:[s.jsx("input",{type:"search","aria-label":"Search runs",value:m,onChange:e=>n({runQuery:e.target.value||void 0}),placeholder:"Search runs or projects",className:"min-h-11 rounded-md border border-base bg-bg px-3 text-sm text-strong placeholder-mono-600 focus:outline-none focus-visible:ring-1 focus-visible:ring-mono-600"}),s.jsxs("select",{"aria-label":"Filter runs by project",value:d,onChange:e=>n({runProject:e.target.value==="all"?void 0:e.target.value}),className:"min-h-11 rounded-md border border-base bg-bg px-3 text-sm text-strong focus:outline-none focus-visible:ring-1 focus-visible:ring-mono-600",children:[s.jsx("option",{value:"all",children:"All projects"}),(u.data??[]).map(e=>s.jsx("option",{value:e.id,children:e.displayName||e.name},e.id))]}),s.jsxs("select",{"aria-label":"Filter runs by type",value:o,onChange:e=>n({runKind:e.target.value==="all"?void 0:e.target.value}),className:"min-h-11 rounded-md border border-base bg-bg px-3 text-sm text-strong focus:outline-none focus-visible:ring-1 focus-visible:ring-mono-600",children:[s.jsx("option",{value:"all",children:"All run types"}),Object.values(f).map(e=>s.jsx("option",{value:e,children:R(e.replaceAll("-"," "))},e))]}),s.jsx("select",{"aria-label":"Filter runs by date range",value:c,onChange:e=>n({runWindow:e.target.value==="30d"?void 0:e.target.value}),className:"min-h-11 rounded-md border border-base bg-bg px-3 text-sm text-strong focus:outline-none focus-visible:ring-1 focus-visible:ring-mono-600",children:Object.entries(g).map(([e,r])=>s.jsx("option",{value:e,children:r.label},e))}),D?s.jsx(w,{type:"button",variant:"ghost",size:"sm",onClick:()=>n({runStatus:void 0,runKind:void 0,runProject:void 0,runWindow:void 0,runQuery:void 0}),children:"Clear"}):s.jsx("span",{})]}),t.isError?s.jsxs(S,{className:"surface-card empty-card",children:[s.jsx("h2",{children:"Run history unavailable"}),s.jsx("p",{children:t.error instanceof Error?t.error.message:"Could not load run history."})]}):null,s.jsx("div",{className:"run-list",children:!t.isError&&j.length>0?j.map(e=>s.jsx(T,{run:e},e.id)):t.isError?null:s.jsxs(S,{className:"surface-card empty-card",children:[s.jsx("h2",{children:"No runs match this filter"}),s.jsx("p",{children:"Change the project, type, status, or date range to widen the history."})]})})]})]})}export{J as RunsPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as n,j as e}from"./vendor-tanstack-Dock0eH1.js";import{B as b,l as B,cB as q,L as I,cC as z,cD as _,cE as V,cF as Q,cG as F,at as R,f as k,T as N,cH as W,cI as J,bV as Y,cJ as X,cK as Z,cL as ee,cM as A,cN as $}from"./index-Dz0ju3qg.js";import"./vendor-radix-4UOaVWza.js";import"./vendor-recharts-D8rt5lKn.js";import"./vendor-lucide-nYKv-BB7.js";import"./vendor-markdown-Bn7fRwrx.js";import"./vendor-yaml-GWJz5H2G.js";function se({providerName:t,keyUrl:i,modelHint:r,onSaved:p}){const x=t.toLowerCase()==="local",[l,c]=n.useState(""),[m,u]=n.useState(""),[f,h]=n.useState(""),[j,a]=n.useState(""),[d,y]=n.useState(""),[v,g]=n.useState(""),[S,P]=n.useState(!1),[C,s]=n.useState(null),[H,M]=n.useState(!1),O=x?m.trim().length>0:l.trim().length>0;async function K(){if(O){P(!0),s(null),M(!1);try{const o=T=>{const G=parseInt(T.trim(),10);return Number.isFinite(G)&&G>0?G:void 0},w={},U=o(j);U!==void 0&&(w.maxConcurrency=U);const D=o(d);D!==void 0&&(w.maxRequestsPerMinute=D);const E=o(v);E!==void 0&&(w.maxRequestsPerDay=E),await q(t.toLowerCase(),{...l.trim()?{apiKey:l.trim()}:{},...m.trim()?{baseUrl:m.trim()}:{},...f.trim()?{model:f.trim()}:{},...Object.keys(w).length>0?{quota:w}:{}}),c(""),u(""),h(""),a(""),y(""),g(""),M(!0),I({title:"Provider updated",detail:`${t} configuration saved.`,tone:"positive",dedupeKey:`settings:provider:${t}`,dedupeMode:"replace"}),p()}catch(o){s(o instanceof Error?o.message:"Failed to update provider")}finally{P(!1)}}}const L=r??"Use default model";return e.jsxs("div",{className:"mt-3 rounded-lg border border-base bg-bg-elevated/40 p-3 space-y-2",children:[x&&e.jsxs("div",{children:[e.jsx("label",{className:"text-sm text-secondary",htmlFor:`base-url-${t}`,children:"Base URL"}),e.jsx("input",{id:`base-url-${t}`,type:"text",className:"mt-0.5 w-full rounded border border-strong bg-transparent px-2 py-1.5 text-sm text-strong placeholder-mono-600 focus:border-mono-500 focus:outline-none",placeholder:"http://localhost:11434/v1",value:m,onChange:o=>u(o.target.value)}),e.jsx("p",{className:"mt-1 text-sm text-secondary",children:"Use any OpenAI-compatible endpoint, such as Ollama or vLLM."})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("label",{className:"text-sm text-secondary",htmlFor:`api-key-${t}`,children:["API key",x?" (optional)":""]}),i&&e.jsxs("a",{href:i,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-secondary hover:text-neutral underline underline-offset-2",children:["Get API key ","↗"]})]}),e.jsx("input",{id:`api-key-${t}`,type:"password",className:"mt-0.5 w-full rounded border border-strong bg-transparent px-2 py-1.5 text-sm text-strong placeholder-mono-600 focus:border-mono-500 focus:outline-none",placeholder:x?"Optional. Most local servers do not need one.":`Enter ${t} API key`,value:l,onChange:o=>c(o.target.value)})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm text-secondary",htmlFor:`model-${t}`,children:"Model (optional)"}),e.jsx("input",{id:`model-${t}`,type:"text",className:"mt-0.5 w-full rounded border border-strong bg-transparent px-2 py-1.5 text-sm text-strong placeholder-mono-600 focus:border-mono-500 focus:outline-none",placeholder:L,value:f,onChange:o=>h(o.target.value)})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm text-secondary",children:"Quota (optional)"}),e.jsxs("div",{className:"mt-0.5 grid grid-cols-3 gap-1.5",children:[e.jsxs("div",{children:[e.jsx("input",{type:"number",min:"1",className:"w-full rounded border border-strong bg-transparent px-2 py-1.5 text-sm text-strong placeholder-mono-600 focus:border-mono-500 focus:outline-none",placeholder:"Concurrent",value:j,onChange:o=>a(o.target.value)}),e.jsx("p",{className:"mt-1 text-sm text-secondary",children:"Max concurrent"})]}),e.jsxs("div",{children:[e.jsx("input",{type:"number",min:"1",className:"w-full rounded border border-strong bg-transparent px-2 py-1.5 text-sm text-strong placeholder-mono-600 focus:border-mono-500 focus:outline-none",placeholder:"/min",value:d,onChange:o=>y(o.target.value)}),e.jsx("p",{className:"mt-1 text-sm text-secondary",children:"Per minute"})]}),e.jsxs("div",{children:[e.jsx("input",{type:"number",min:"1",className:"w-full rounded border border-strong bg-transparent px-2 py-1.5 text-sm text-strong placeholder-mono-600 focus:border-mono-500 focus:outline-none",placeholder:"/day",value:v,onChange:o=>g(o.target.value)}),e.jsx("p",{className:"mt-1 text-sm text-secondary",children:"Per day"})]})]})]}),C&&e.jsx("p",{className:"text-sm text-negative-400",children:C}),H&&e.jsx("p",{className:"text-sm text-positive-400",children:"Provider updated."}),e.jsx(b,{type:"button",size:"sm",disabled:!O||S,onClick:B(K),children:S?"Saving...":"Save"})]})}function te({onSaved:t}){const[i,r]=n.useState(""),[p,x]=n.useState(""),[l,c]=n.useState(!1),[m,u]=n.useState(null),[f,h]=n.useState(!1),j=i.trim().length>0&&p.trim().length>0,a=typeof window>"u"?void 0:z(window.location,window.__CANONRY_CONFIG__?.basePath),d=a?_(a):void 0,y=a?V(a):void 0;async function v(){if(j){c(!0),u(null),h(!1);try{await Q({clientId:i.trim(),clientSecret:p.trim()}),r(""),x(""),h(!0),I({title:"Google OAuth app updated",detail:"Dashboard Google credentials were saved.",tone:"positive",dedupeKey:"settings:google-oauth",dedupeMode:"replace"}),t()}catch(g){u(g instanceof Error?g.message:"Failed to update Google OAuth credentials")}finally{c(!1)}}}return e.jsxs("div",{className:"mt-3 rounded-lg border border-base bg-bg-elevated/40 p-3 space-y-2",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("label",{className:"text-sm text-secondary",htmlFor:"google-client-id",children:"Client ID"}),e.jsxs("a",{href:"https://console.cloud.google.com/apis/credentials",target:"_blank",rel:"noopener noreferrer",className:"text-sm text-secondary hover:text-neutral underline underline-offset-2",children:["Google Cloud ","↗"]})]}),e.jsx("input",{id:"google-client-id",type:"text",className:"mt-0.5 w-full rounded border border-strong bg-transparent px-2 py-1.5 text-sm text-strong placeholder-mono-600 focus:border-mono-500 focus:outline-none",placeholder:"Google OAuth client ID",value:i,onChange:g=>r(g.target.value)})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm text-secondary",htmlFor:"google-client-secret",children:"Client secret"}),e.jsx("input",{id:"google-client-secret",type:"password",className:"mt-0.5 w-full rounded border border-strong bg-transparent px-2 py-1.5 text-sm text-strong placeholder-mono-600 focus:border-mono-500 focus:outline-none",placeholder:"Google OAuth client secret",value:p,onChange:g=>x(g.target.value)})]}),d&&y&&e.jsxs("div",{className:"rounded border border-default bg-surface px-3 py-2",children:[e.jsx("p",{className:"text-sm text-secondary",children:"Authorized redirect URIs"}),e.jsxs("dl",{className:"mt-1 space-y-2 text-xs",children:[e.jsxs("div",{children:[e.jsx("dt",{className:"text-muted",children:"Search Console and Business Profile"}),e.jsx("dd",{children:e.jsx("code",{className:"block break-all text-strong",children:d})})]}),e.jsxs("div",{children:[e.jsx("dt",{className:"text-muted",children:"Google Ads and Tag Manager"}),e.jsx("dd",{children:e.jsx("code",{className:"block break-all text-strong",children:y})})]})]})]}),m&&e.jsx("p",{className:"text-sm text-negative-400",children:m}),f&&e.jsx("p",{className:"text-sm text-positive-400",children:"Google OAuth credentials updated."}),e.jsx(b,{type:"button",size:"sm",disabled:!j||l,onClick:B(v),children:l?"Saving...":"Save Google OAuth app"})]})}function ne(t){const i=t.replace(/^Error:\s*/,"").replace(/\s+/g," ").trim();return i?i.length>140?`${i.slice(0,137)}...`:i:"Unknown error"}function ae(){const[t,i]=n.useState(null),[r,p]=n.useState(null),[x,l]=n.useState(!1),[c,m]=n.useState("localhost"),[u,f]=n.useState("9222"),[h,j]=n.useState(!1);return n.useEffect(()=>{F().then(a=>{i(a),p(null)}).catch(a=>{const d=R(a);d.includes("501")||p(d)})},[]),e.jsxs(k,{className:"surface-card",children:[e.jsxs("div",{className:"section-head",children:[e.jsxs("div",{children:[e.jsx("p",{className:"eyebrow eyebrow-soft",children:"Browser provider"}),e.jsx("h2",{children:"ChatGPT (CDP)"})]}),e.jsx(N,{tone:t?.connected?"positive":"caution",children:t?.connected?"Connected":"Not connected"})]}),e.jsx("p",{className:`mt-2 text-sm ${r?"text-negative":"text-secondary"}`,role:r?"alert":void 0,children:r?e.jsxs(e.Fragment,{children:["Could not check Chrome: ",ne(r),". Check that Chrome is running with remote debugging, then configure the endpoint."]}):t?.connected?"Chrome is available for this provider.":"Connect Chrome to enable this provider."}),e.jsxs("details",{className:"mt-3",children:[e.jsx("summary",{className:"cursor-pointer text-sm text-secondary hover:text-strong",children:"Advanced"}),e.jsxs("dl",{className:"definition-list mt-2",children:[t?.endpoint&&e.jsxs("div",{children:[e.jsx("dt",{children:"Endpoint"}),e.jsx("dd",{className:"font-mono text-xs",children:t.endpoint})]}),t?.browserVersion&&e.jsxs("div",{children:[e.jsx("dt",{children:"Browser"}),e.jsx("dd",{className:"text-xs",children:t.browserVersion})]}),t?.targets&&t.targets.length>0&&e.jsxs("div",{children:[e.jsx("dt",{children:"Tabs"}),e.jsx("dd",{children:t.targets.map(a=>e.jsxs("span",{className:"mr-2",children:[a.name,": ",a.alive?"● alive":"○ idle"]},a.name))})]})]})]}),e.jsx("div",{className:"mt-2",children:e.jsx(b,{type:"button",variant:"outline",size:"sm",onClick:()=>l(!x),children:x?"Cancel":t?.connected?"Update endpoint":"Configure"})}),x&&e.jsxs("form",{className:"mt-3 flex flex-col gap-2",onSubmit:B(async a=>{a.preventDefault(),j(!0);try{await W(c,parseInt(u,10)||9222);const d=await F();i(d),p(null),l(!1),I({title:"CDP endpoint saved",detail:`${c}:${parseInt(u,10)||9222} is now configured.`,tone:"positive",dedupeKey:"settings:cdp",dedupeMode:"replace"})}catch(d){p(R(d))}finally{j(!1)}}),children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{className:"flex-1 rounded border border-strong bg-bg-elevated px-2 py-1 text-sm text-heading placeholder-mono-500 focus:outline-none focus:ring-1 focus:ring-mono-500",placeholder:"localhost",value:c,onChange:a=>m(a.target.value),"aria-label":"CDP host"}),e.jsx("input",{className:"w-24 rounded border border-strong bg-bg-elevated px-2 py-1 text-sm text-heading placeholder-mono-500 focus:outline-none focus:ring-1 focus:ring-mono-500",placeholder:"9222",value:u,onChange:a=>f(a.target.value),"aria-label":"CDP port"})]}),e.jsx("div",{children:e.jsx(b,{type:"submit",size:"sm",disabled:h,children:h?"Saving…":"Save endpoint"})})]})]})}const re={apiStatus:{state:"checking",detail:"Checking service health"},workerStatus:{state:"checking",detail:"Checking service health"}};function he(){return e.jsx(J,{title:"Settings",children:e.jsx(le,{})})}function le(){const t=Y(),{dashboard:i}=X(),r=i?.settings??t?.dashboard?.settings,l=Z(!t,t?.health).data??t?.health??re,[c,m]=n.useState(null),[u,f]=n.useState(!1),[h,j]=n.useState(!1),[a,d]=n.useState(""),[y,v]=n.useState(!1),[g,S]=n.useState(null),[P,C]=n.useState(!1);return r?e.jsxs("div",{className:"page-container",children:[e.jsx("div",{className:"page-header",children:e.jsxs("div",{className:"page-header-left",children:[e.jsx("h1",{className:"page-title",children:"Settings"}),e.jsx("p",{className:"page-subtitle",children:"Connections and answer engines."})]})}),e.jsxs("section",{className:"space-y-6",children:[e.jsxs("section",{children:[e.jsx("div",{className:"section-head",children:e.jsxs("div",{children:[e.jsx("p",{className:"eyebrow eyebrow-soft",children:"Answer engines"}),e.jsx("h2",{children:"Providers"})]})}),e.jsx("div",{className:"divide-y divide-default border-y border-default",children:r.providerStatuses.map(s=>e.jsxs("div",{className:"py-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-heading",children:s.displayName??s.name}),e.jsx("p",{className:"text-sm text-secondary",children:s.detail})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(N,{tone:s.state==="ready"?"positive":"caution",children:s.state==="ready"?"Ready":"Needs config"}),e.jsx(b,{type:"button",variant:"outline",size:"sm",onClick:()=>m(c===s.name?null:s.name),children:c===s.name?"Cancel":s.state==="ready"?"Update":"Configure"})]})]}),e.jsxs("details",{className:"mt-3",children:[e.jsx("summary",{className:"cursor-pointer text-sm text-secondary hover:text-strong",children:"Advanced"}),e.jsxs("dl",{className:"definition-list mt-2",children:[e.jsxs("div",{children:[e.jsx("dt",{children:"Model"}),e.jsxs("dd",{className:"font-mono text-xs",children:[s.model??s.defaultModel??"unknown",!s.model&&s.defaultModel&&e.jsx("span",{className:"ml-1 font-sans text-muted",children:"(default)"})]})]}),s.quota&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("dt",{children:"Concurrency"}),e.jsx("dd",{children:s.quota.maxConcurrency})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Rate limit"}),e.jsxs("dd",{children:[s.quota.maxRequestsPerMinute,"/min · ",s.quota.maxRequestsPerDay,"/day"]})]})]})]})]}),c===s.name&&e.jsx(se,{providerName:s.name,keyUrl:s.keyUrl,modelHint:s.modelHint,onSaved:()=>{m(null)}})]},s.name))})]}),e.jsxs("section",{children:[e.jsx("div",{className:"section-head",children:e.jsxs("div",{children:[e.jsx("p",{className:"eyebrow eyebrow-soft",children:"Connections"}),e.jsx("h2",{children:"Search and browser"})]})}),e.jsxs("div",{className:"settings-grid",children:[e.jsxs(k,{className:"surface-card",children:[e.jsxs("div",{className:"section-head",children:[e.jsxs("div",{children:[e.jsx("p",{className:"eyebrow eyebrow-soft",children:"Google"}),e.jsx("h2",{children:"Google OAuth"})]}),e.jsx(N,{tone:r.google.state==="ready"?"positive":"caution",children:r.google.state==="ready"?"Ready":"Needs config"})]}),e.jsx("p",{className:"mt-2 text-sm text-secondary",children:r.google.detail}),e.jsxs("details",{className:"mt-3",children:[e.jsx("summary",{className:"cursor-pointer text-sm text-secondary hover:text-strong",children:"Advanced"}),e.jsxs("dl",{className:"definition-list mt-2",children:[e.jsxs("div",{children:[e.jsx("dt",{children:"Auth model"}),e.jsx("dd",{children:"One app credential set for Search Console, Business Profile, Google Ads, and Tag Manager"})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Storage"}),e.jsx("dd",{className:"font-mono text-xs",children:"~/.canonry/config.yaml"})]})]})]}),e.jsx("div",{className:"mt-2",children:e.jsx(b,{type:"button",variant:"outline",size:"sm",onClick:()=>f(!u),children:u?"Cancel":r.google.state==="ready"?"Update OAuth app":"Configure Google OAuth"})}),u&&e.jsx(te,{onSaved:()=>{f(!1)}})]}),e.jsxs(k,{className:"surface-card",children:[e.jsxs("div",{className:"section-head",children:[e.jsxs("div",{children:[e.jsx("p",{className:"eyebrow eyebrow-soft",children:"Bing"}),e.jsx("h2",{children:"Webmaster Tools"})]}),e.jsx(N,{tone:r.bing.state==="ready"?"positive":"caution",children:r.bing.state==="ready"?"Ready":"Needs config"})]}),e.jsx("p",{className:"mt-2 text-sm text-secondary",children:r.bing.detail}),e.jsxs("details",{className:"mt-3",children:[e.jsx("summary",{className:"cursor-pointer text-sm text-secondary hover:text-strong",children:"Advanced"}),e.jsxs("dl",{className:"definition-list mt-2",children:[e.jsxs("div",{children:[e.jsx("dt",{children:"Auth model"}),e.jsx("dd",{children:"API key authentication. OAuth is not required."})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Storage"}),e.jsx("dd",{className:"font-mono text-xs",children:"~/.canonry/config.yaml"})]})]})]}),e.jsx("div",{className:"mt-2",children:e.jsx(b,{type:"button",variant:"outline",size:"sm",onClick:()=>j(!h),children:h?"Cancel":r.bing.state==="ready"?"Update API key":"Configure Bing"})}),h&&e.jsxs("div",{className:"mt-3 rounded-lg border border-base bg-bg-elevated/40 p-3 space-y-2",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("label",{className:"text-sm text-secondary",htmlFor:"bing-api-key",children:"API key"}),e.jsx("a",{href:"https://www.bing.com/webmasters/",target:"_blank",rel:"noopener noreferrer",className:"text-sm text-secondary hover:text-neutral underline underline-offset-2",children:"Bing Webmaster Tools"})]}),e.jsx("input",{id:"bing-api-key",type:"password",className:"mt-0.5 w-full rounded border border-strong bg-transparent px-2 py-1.5 text-sm text-strong placeholder-mono-600 focus:border-mono-500 focus:outline-none",placeholder:"Bing Webmaster Tools API key",value:a,onChange:s=>d(s.target.value)})]}),e.jsx("p",{className:"text-sm text-secondary",children:"Used for project-level Bing connections."}),g&&e.jsx("p",{className:"text-sm text-negative-400",children:g}),P&&e.jsx("p",{className:"text-sm text-positive-400",children:"Bing API key updated."}),e.jsx(b,{type:"button",size:"sm",disabled:!a.trim()||y,onClick:B(async()=>{if(a.trim()){v(!0),S(null),C(!1);try{await ee(a.trim()),d(""),C(!0),j(!1),I({title:"Bing API key updated",detail:"Dashboard Bing credentials were saved.",tone:"positive",dedupeKey:"settings:bing",dedupeMode:"replace"})}catch(s){S(s instanceof Error?s.message:"Failed to update Bing API key")}finally{v(!1)}}}),children:y?"Saving...":"Save Bing API key"})]})]}),e.jsx(ae,{})]})]}),e.jsxs(k,{className:"surface-card",children:[e.jsx("div",{className:"section-head",children:e.jsxs("div",{children:[e.jsx("p",{className:"eyebrow eyebrow-soft",children:"Service health"}),e.jsx("h2",{children:"API and worker"})]})}),e.jsxs("div",{className:"compact-stack",children:[e.jsxs("div",{className:"health-row",children:[e.jsxs("div",{children:[e.jsx("p",{className:"run-row-title",children:"API"}),l.apiStatus.state!=="ok"&&e.jsx("p",{className:"mt-1 text-sm text-secondary",children:A(l.apiStatus)})]}),e.jsx(N,{tone:$(l.apiStatus),title:A(l.apiStatus),children:l.apiStatus.state==="ok"?"Healthy":"Attention"})]}),e.jsxs("div",{className:"health-row",children:[e.jsxs("div",{children:[e.jsx("p",{className:"run-row-title",children:"Worker"}),l.workerStatus.state!=="ok"&&e.jsx("p",{className:"mt-1 text-sm text-secondary",children:A(l.workerStatus)})]}),e.jsx(N,{tone:$(l.workerStatus),title:A(l.workerStatus),children:l.workerStatus.state==="ok"?"Healthy":"Attention"})]})]})]})]}),e.jsxs("details",{className:"page-section",children:[e.jsx("summary",{className:"cursor-pointer text-sm font-medium text-secondary hover:text-strong",children:"Self-hosting details"}),e.jsxs(k,{className:"surface-card mt-3",children:[e.jsx("ul",{className:"detail-list",children:r.selfHostNotes.map(s=>e.jsx("li",{children:s},s))}),e.jsx("p",{className:"supporting-copy",children:r.bootstrapNote})]})]})]}):null}export{he as SettingsPage};
|
|
1
|
+
import{r as n,j as e}from"./vendor-tanstack-Dock0eH1.js";import{B as b,l as B,cB as q,L as I,cC as z,cD as _,cE as V,cF as Q,cG as F,at as R,f as k,T as N,cH as W,cI as J,bV as Y,cJ as X,cK as Z,cL as ee,cM as A,cN as $}from"./index-VmxEHABq.js";import"./vendor-radix-4UOaVWza.js";import"./vendor-recharts-D8rt5lKn.js";import"./vendor-lucide-nYKv-BB7.js";import"./vendor-markdown-Bn7fRwrx.js";import"./vendor-yaml-GWJz5H2G.js";function se({providerName:t,keyUrl:i,modelHint:r,onSaved:p}){const x=t.toLowerCase()==="local",[l,c]=n.useState(""),[m,u]=n.useState(""),[f,h]=n.useState(""),[j,a]=n.useState(""),[d,y]=n.useState(""),[v,g]=n.useState(""),[S,P]=n.useState(!1),[C,s]=n.useState(null),[H,M]=n.useState(!1),O=x?m.trim().length>0:l.trim().length>0;async function K(){if(O){P(!0),s(null),M(!1);try{const o=T=>{const G=parseInt(T.trim(),10);return Number.isFinite(G)&&G>0?G:void 0},w={},U=o(j);U!==void 0&&(w.maxConcurrency=U);const D=o(d);D!==void 0&&(w.maxRequestsPerMinute=D);const E=o(v);E!==void 0&&(w.maxRequestsPerDay=E),await q(t.toLowerCase(),{...l.trim()?{apiKey:l.trim()}:{},...m.trim()?{baseUrl:m.trim()}:{},...f.trim()?{model:f.trim()}:{},...Object.keys(w).length>0?{quota:w}:{}}),c(""),u(""),h(""),a(""),y(""),g(""),M(!0),I({title:"Provider updated",detail:`${t} configuration saved.`,tone:"positive",dedupeKey:`settings:provider:${t}`,dedupeMode:"replace"}),p()}catch(o){s(o instanceof Error?o.message:"Failed to update provider")}finally{P(!1)}}}const L=r??"Use default model";return e.jsxs("div",{className:"mt-3 rounded-lg border border-base bg-bg-elevated/40 p-3 space-y-2",children:[x&&e.jsxs("div",{children:[e.jsx("label",{className:"text-sm text-secondary",htmlFor:`base-url-${t}`,children:"Base URL"}),e.jsx("input",{id:`base-url-${t}`,type:"text",className:"mt-0.5 w-full rounded border border-strong bg-transparent px-2 py-1.5 text-sm text-strong placeholder-mono-600 focus:border-mono-500 focus:outline-none",placeholder:"http://localhost:11434/v1",value:m,onChange:o=>u(o.target.value)}),e.jsx("p",{className:"mt-1 text-sm text-secondary",children:"Use any OpenAI-compatible endpoint, such as Ollama or vLLM."})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("label",{className:"text-sm text-secondary",htmlFor:`api-key-${t}`,children:["API key",x?" (optional)":""]}),i&&e.jsxs("a",{href:i,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-secondary hover:text-neutral underline underline-offset-2",children:["Get API key ","↗"]})]}),e.jsx("input",{id:`api-key-${t}`,type:"password",className:"mt-0.5 w-full rounded border border-strong bg-transparent px-2 py-1.5 text-sm text-strong placeholder-mono-600 focus:border-mono-500 focus:outline-none",placeholder:x?"Optional. Most local servers do not need one.":`Enter ${t} API key`,value:l,onChange:o=>c(o.target.value)})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm text-secondary",htmlFor:`model-${t}`,children:"Model (optional)"}),e.jsx("input",{id:`model-${t}`,type:"text",className:"mt-0.5 w-full rounded border border-strong bg-transparent px-2 py-1.5 text-sm text-strong placeholder-mono-600 focus:border-mono-500 focus:outline-none",placeholder:L,value:f,onChange:o=>h(o.target.value)})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm text-secondary",children:"Quota (optional)"}),e.jsxs("div",{className:"mt-0.5 grid grid-cols-3 gap-1.5",children:[e.jsxs("div",{children:[e.jsx("input",{type:"number",min:"1",className:"w-full rounded border border-strong bg-transparent px-2 py-1.5 text-sm text-strong placeholder-mono-600 focus:border-mono-500 focus:outline-none",placeholder:"Concurrent",value:j,onChange:o=>a(o.target.value)}),e.jsx("p",{className:"mt-1 text-sm text-secondary",children:"Max concurrent"})]}),e.jsxs("div",{children:[e.jsx("input",{type:"number",min:"1",className:"w-full rounded border border-strong bg-transparent px-2 py-1.5 text-sm text-strong placeholder-mono-600 focus:border-mono-500 focus:outline-none",placeholder:"/min",value:d,onChange:o=>y(o.target.value)}),e.jsx("p",{className:"mt-1 text-sm text-secondary",children:"Per minute"})]}),e.jsxs("div",{children:[e.jsx("input",{type:"number",min:"1",className:"w-full rounded border border-strong bg-transparent px-2 py-1.5 text-sm text-strong placeholder-mono-600 focus:border-mono-500 focus:outline-none",placeholder:"/day",value:v,onChange:o=>g(o.target.value)}),e.jsx("p",{className:"mt-1 text-sm text-secondary",children:"Per day"})]})]})]}),C&&e.jsx("p",{className:"text-sm text-negative-400",children:C}),H&&e.jsx("p",{className:"text-sm text-positive-400",children:"Provider updated."}),e.jsx(b,{type:"button",size:"sm",disabled:!O||S,onClick:B(K),children:S?"Saving...":"Save"})]})}function te({onSaved:t}){const[i,r]=n.useState(""),[p,x]=n.useState(""),[l,c]=n.useState(!1),[m,u]=n.useState(null),[f,h]=n.useState(!1),j=i.trim().length>0&&p.trim().length>0,a=typeof window>"u"?void 0:z(window.location,window.__CANONRY_CONFIG__?.basePath),d=a?_(a):void 0,y=a?V(a):void 0;async function v(){if(j){c(!0),u(null),h(!1);try{await Q({clientId:i.trim(),clientSecret:p.trim()}),r(""),x(""),h(!0),I({title:"Google OAuth app updated",detail:"Dashboard Google credentials were saved.",tone:"positive",dedupeKey:"settings:google-oauth",dedupeMode:"replace"}),t()}catch(g){u(g instanceof Error?g.message:"Failed to update Google OAuth credentials")}finally{c(!1)}}}return e.jsxs("div",{className:"mt-3 rounded-lg border border-base bg-bg-elevated/40 p-3 space-y-2",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("label",{className:"text-sm text-secondary",htmlFor:"google-client-id",children:"Client ID"}),e.jsxs("a",{href:"https://console.cloud.google.com/apis/credentials",target:"_blank",rel:"noopener noreferrer",className:"text-sm text-secondary hover:text-neutral underline underline-offset-2",children:["Google Cloud ","↗"]})]}),e.jsx("input",{id:"google-client-id",type:"text",className:"mt-0.5 w-full rounded border border-strong bg-transparent px-2 py-1.5 text-sm text-strong placeholder-mono-600 focus:border-mono-500 focus:outline-none",placeholder:"Google OAuth client ID",value:i,onChange:g=>r(g.target.value)})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm text-secondary",htmlFor:"google-client-secret",children:"Client secret"}),e.jsx("input",{id:"google-client-secret",type:"password",className:"mt-0.5 w-full rounded border border-strong bg-transparent px-2 py-1.5 text-sm text-strong placeholder-mono-600 focus:border-mono-500 focus:outline-none",placeholder:"Google OAuth client secret",value:p,onChange:g=>x(g.target.value)})]}),d&&y&&e.jsxs("div",{className:"rounded border border-default bg-surface px-3 py-2",children:[e.jsx("p",{className:"text-sm text-secondary",children:"Authorized redirect URIs"}),e.jsxs("dl",{className:"mt-1 space-y-2 text-xs",children:[e.jsxs("div",{children:[e.jsx("dt",{className:"text-muted",children:"Search Console and Business Profile"}),e.jsx("dd",{children:e.jsx("code",{className:"block break-all text-strong",children:d})})]}),e.jsxs("div",{children:[e.jsx("dt",{className:"text-muted",children:"Google Ads and Tag Manager"}),e.jsx("dd",{children:e.jsx("code",{className:"block break-all text-strong",children:y})})]})]})]}),m&&e.jsx("p",{className:"text-sm text-negative-400",children:m}),f&&e.jsx("p",{className:"text-sm text-positive-400",children:"Google OAuth credentials updated."}),e.jsx(b,{type:"button",size:"sm",disabled:!j||l,onClick:B(v),children:l?"Saving...":"Save Google OAuth app"})]})}function ne(t){const i=t.replace(/^Error:\s*/,"").replace(/\s+/g," ").trim();return i?i.length>140?`${i.slice(0,137)}...`:i:"Unknown error"}function ae(){const[t,i]=n.useState(null),[r,p]=n.useState(null),[x,l]=n.useState(!1),[c,m]=n.useState("localhost"),[u,f]=n.useState("9222"),[h,j]=n.useState(!1);return n.useEffect(()=>{F().then(a=>{i(a),p(null)}).catch(a=>{const d=R(a);d.includes("501")||p(d)})},[]),e.jsxs(k,{className:"surface-card",children:[e.jsxs("div",{className:"section-head",children:[e.jsxs("div",{children:[e.jsx("p",{className:"eyebrow eyebrow-soft",children:"Browser provider"}),e.jsx("h2",{children:"ChatGPT (CDP)"})]}),e.jsx(N,{tone:t?.connected?"positive":"caution",children:t?.connected?"Connected":"Not connected"})]}),e.jsx("p",{className:`mt-2 text-sm ${r?"text-negative":"text-secondary"}`,role:r?"alert":void 0,children:r?e.jsxs(e.Fragment,{children:["Could not check Chrome: ",ne(r),". Check that Chrome is running with remote debugging, then configure the endpoint."]}):t?.connected?"Chrome is available for this provider.":"Connect Chrome to enable this provider."}),e.jsxs("details",{className:"mt-3",children:[e.jsx("summary",{className:"cursor-pointer text-sm text-secondary hover:text-strong",children:"Advanced"}),e.jsxs("dl",{className:"definition-list mt-2",children:[t?.endpoint&&e.jsxs("div",{children:[e.jsx("dt",{children:"Endpoint"}),e.jsx("dd",{className:"font-mono text-xs",children:t.endpoint})]}),t?.browserVersion&&e.jsxs("div",{children:[e.jsx("dt",{children:"Browser"}),e.jsx("dd",{className:"text-xs",children:t.browserVersion})]}),t?.targets&&t.targets.length>0&&e.jsxs("div",{children:[e.jsx("dt",{children:"Tabs"}),e.jsx("dd",{children:t.targets.map(a=>e.jsxs("span",{className:"mr-2",children:[a.name,": ",a.alive?"● alive":"○ idle"]},a.name))})]})]})]}),e.jsx("div",{className:"mt-2",children:e.jsx(b,{type:"button",variant:"outline",size:"sm",onClick:()=>l(!x),children:x?"Cancel":t?.connected?"Update endpoint":"Configure"})}),x&&e.jsxs("form",{className:"mt-3 flex flex-col gap-2",onSubmit:B(async a=>{a.preventDefault(),j(!0);try{await W(c,parseInt(u,10)||9222);const d=await F();i(d),p(null),l(!1),I({title:"CDP endpoint saved",detail:`${c}:${parseInt(u,10)||9222} is now configured.`,tone:"positive",dedupeKey:"settings:cdp",dedupeMode:"replace"})}catch(d){p(R(d))}finally{j(!1)}}),children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{className:"flex-1 rounded border border-strong bg-bg-elevated px-2 py-1 text-sm text-heading placeholder-mono-500 focus:outline-none focus:ring-1 focus:ring-mono-500",placeholder:"localhost",value:c,onChange:a=>m(a.target.value),"aria-label":"CDP host"}),e.jsx("input",{className:"w-24 rounded border border-strong bg-bg-elevated px-2 py-1 text-sm text-heading placeholder-mono-500 focus:outline-none focus:ring-1 focus:ring-mono-500",placeholder:"9222",value:u,onChange:a=>f(a.target.value),"aria-label":"CDP port"})]}),e.jsx("div",{children:e.jsx(b,{type:"submit",size:"sm",disabled:h,children:h?"Saving…":"Save endpoint"})})]})]})}const re={apiStatus:{state:"checking",detail:"Checking service health"},workerStatus:{state:"checking",detail:"Checking service health"}};function he(){return e.jsx(J,{title:"Settings",children:e.jsx(le,{})})}function le(){const t=Y(),{dashboard:i}=X(),r=i?.settings??t?.dashboard?.settings,l=Z(!t,t?.health).data??t?.health??re,[c,m]=n.useState(null),[u,f]=n.useState(!1),[h,j]=n.useState(!1),[a,d]=n.useState(""),[y,v]=n.useState(!1),[g,S]=n.useState(null),[P,C]=n.useState(!1);return r?e.jsxs("div",{className:"page-container",children:[e.jsx("div",{className:"page-header",children:e.jsxs("div",{className:"page-header-left",children:[e.jsx("h1",{className:"page-title",children:"Settings"}),e.jsx("p",{className:"page-subtitle",children:"Connections and answer engines."})]})}),e.jsxs("section",{className:"space-y-6",children:[e.jsxs("section",{children:[e.jsx("div",{className:"section-head",children:e.jsxs("div",{children:[e.jsx("p",{className:"eyebrow eyebrow-soft",children:"Answer engines"}),e.jsx("h2",{children:"Providers"})]})}),e.jsx("div",{className:"divide-y divide-default border-y border-default",children:r.providerStatuses.map(s=>e.jsxs("div",{className:"py-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-heading",children:s.displayName??s.name}),e.jsx("p",{className:"text-sm text-secondary",children:s.detail})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(N,{tone:s.state==="ready"?"positive":"caution",children:s.state==="ready"?"Ready":"Needs config"}),e.jsx(b,{type:"button",variant:"outline",size:"sm",onClick:()=>m(c===s.name?null:s.name),children:c===s.name?"Cancel":s.state==="ready"?"Update":"Configure"})]})]}),e.jsxs("details",{className:"mt-3",children:[e.jsx("summary",{className:"cursor-pointer text-sm text-secondary hover:text-strong",children:"Advanced"}),e.jsxs("dl",{className:"definition-list mt-2",children:[e.jsxs("div",{children:[e.jsx("dt",{children:"Model"}),e.jsxs("dd",{className:"font-mono text-xs",children:[s.model??s.defaultModel??"unknown",!s.model&&s.defaultModel&&e.jsx("span",{className:"ml-1 font-sans text-muted",children:"(default)"})]})]}),s.quota&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("dt",{children:"Concurrency"}),e.jsx("dd",{children:s.quota.maxConcurrency})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Rate limit"}),e.jsxs("dd",{children:[s.quota.maxRequestsPerMinute,"/min · ",s.quota.maxRequestsPerDay,"/day"]})]})]})]})]}),c===s.name&&e.jsx(se,{providerName:s.name,keyUrl:s.keyUrl,modelHint:s.modelHint,onSaved:()=>{m(null)}})]},s.name))})]}),e.jsxs("section",{children:[e.jsx("div",{className:"section-head",children:e.jsxs("div",{children:[e.jsx("p",{className:"eyebrow eyebrow-soft",children:"Connections"}),e.jsx("h2",{children:"Search and browser"})]})}),e.jsxs("div",{className:"settings-grid",children:[e.jsxs(k,{className:"surface-card",children:[e.jsxs("div",{className:"section-head",children:[e.jsxs("div",{children:[e.jsx("p",{className:"eyebrow eyebrow-soft",children:"Google"}),e.jsx("h2",{children:"Google OAuth"})]}),e.jsx(N,{tone:r.google.state==="ready"?"positive":"caution",children:r.google.state==="ready"?"Ready":"Needs config"})]}),e.jsx("p",{className:"mt-2 text-sm text-secondary",children:r.google.detail}),e.jsxs("details",{className:"mt-3",children:[e.jsx("summary",{className:"cursor-pointer text-sm text-secondary hover:text-strong",children:"Advanced"}),e.jsxs("dl",{className:"definition-list mt-2",children:[e.jsxs("div",{children:[e.jsx("dt",{children:"Auth model"}),e.jsx("dd",{children:"One app credential set for Search Console, Business Profile, Google Ads, and Tag Manager"})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Storage"}),e.jsx("dd",{className:"font-mono text-xs",children:"~/.canonry/config.yaml"})]})]})]}),e.jsx("div",{className:"mt-2",children:e.jsx(b,{type:"button",variant:"outline",size:"sm",onClick:()=>f(!u),children:u?"Cancel":r.google.state==="ready"?"Update OAuth app":"Configure Google OAuth"})}),u&&e.jsx(te,{onSaved:()=>{f(!1)}})]}),e.jsxs(k,{className:"surface-card",children:[e.jsxs("div",{className:"section-head",children:[e.jsxs("div",{children:[e.jsx("p",{className:"eyebrow eyebrow-soft",children:"Bing"}),e.jsx("h2",{children:"Webmaster Tools"})]}),e.jsx(N,{tone:r.bing.state==="ready"?"positive":"caution",children:r.bing.state==="ready"?"Ready":"Needs config"})]}),e.jsx("p",{className:"mt-2 text-sm text-secondary",children:r.bing.detail}),e.jsxs("details",{className:"mt-3",children:[e.jsx("summary",{className:"cursor-pointer text-sm text-secondary hover:text-strong",children:"Advanced"}),e.jsxs("dl",{className:"definition-list mt-2",children:[e.jsxs("div",{children:[e.jsx("dt",{children:"Auth model"}),e.jsx("dd",{children:"API key authentication. OAuth is not required."})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Storage"}),e.jsx("dd",{className:"font-mono text-xs",children:"~/.canonry/config.yaml"})]})]})]}),e.jsx("div",{className:"mt-2",children:e.jsx(b,{type:"button",variant:"outline",size:"sm",onClick:()=>j(!h),children:h?"Cancel":r.bing.state==="ready"?"Update API key":"Configure Bing"})}),h&&e.jsxs("div",{className:"mt-3 rounded-lg border border-base bg-bg-elevated/40 p-3 space-y-2",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("label",{className:"text-sm text-secondary",htmlFor:"bing-api-key",children:"API key"}),e.jsx("a",{href:"https://www.bing.com/webmasters/",target:"_blank",rel:"noopener noreferrer",className:"text-sm text-secondary hover:text-neutral underline underline-offset-2",children:"Bing Webmaster Tools"})]}),e.jsx("input",{id:"bing-api-key",type:"password",className:"mt-0.5 w-full rounded border border-strong bg-transparent px-2 py-1.5 text-sm text-strong placeholder-mono-600 focus:border-mono-500 focus:outline-none",placeholder:"Bing Webmaster Tools API key",value:a,onChange:s=>d(s.target.value)})]}),e.jsx("p",{className:"text-sm text-secondary",children:"Used for project-level Bing connections."}),g&&e.jsx("p",{className:"text-sm text-negative-400",children:g}),P&&e.jsx("p",{className:"text-sm text-positive-400",children:"Bing API key updated."}),e.jsx(b,{type:"button",size:"sm",disabled:!a.trim()||y,onClick:B(async()=>{if(a.trim()){v(!0),S(null),C(!1);try{await ee(a.trim()),d(""),C(!0),j(!1),I({title:"Bing API key updated",detail:"Dashboard Bing credentials were saved.",tone:"positive",dedupeKey:"settings:bing",dedupeMode:"replace"})}catch(s){S(s instanceof Error?s.message:"Failed to update Bing API key")}finally{v(!1)}}}),children:y?"Saving...":"Save Bing API key"})]})]}),e.jsx(ae,{})]})]}),e.jsxs(k,{className:"surface-card",children:[e.jsx("div",{className:"section-head",children:e.jsxs("div",{children:[e.jsx("p",{className:"eyebrow eyebrow-soft",children:"Service health"}),e.jsx("h2",{children:"API and worker"})]})}),e.jsxs("div",{className:"compact-stack",children:[e.jsxs("div",{className:"health-row",children:[e.jsxs("div",{children:[e.jsx("p",{className:"run-row-title",children:"API"}),l.apiStatus.state!=="ok"&&e.jsx("p",{className:"mt-1 text-sm text-secondary",children:A(l.apiStatus)})]}),e.jsx(N,{tone:$(l.apiStatus),title:A(l.apiStatus),children:l.apiStatus.state==="ok"?"Healthy":"Attention"})]}),e.jsxs("div",{className:"health-row",children:[e.jsxs("div",{children:[e.jsx("p",{className:"run-row-title",children:"Worker"}),l.workerStatus.state!=="ok"&&e.jsx("p",{className:"mt-1 text-sm text-secondary",children:A(l.workerStatus)})]}),e.jsx(N,{tone:$(l.workerStatus),title:A(l.workerStatus),children:l.workerStatus.state==="ok"?"Healthy":"Attention"})]})]})]})]}),e.jsxs("details",{className:"page-section",children:[e.jsx("summary",{className:"cursor-pointer text-sm font-medium text-secondary hover:text-strong",children:"Self-hosting details"}),e.jsxs(k,{className:"surface-card mt-3",children:[e.jsx("ul",{className:"detail-list",children:r.selfHostNotes.map(s=>e.jsx("li",{children:s},s))}),e.jsx("p",{className:"supporting-copy",children:r.bootstrapNote})]})]})]}):null}export{he as SettingsPage};
|