@canonry/canonry 7.116.0 → 7.116.1
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/assets/{AgentSetupPage-CgZuonLM.js → AgentSetupPage-s4qM5l-m.js} +1 -1
- package/assets/assets/MeasurementPropertyPage-D5As0Tnh.js +4 -0
- package/assets/assets/{ProjectPage-Ce4gBiK_.js → ProjectPage-DpsuPdQ6.js} +7 -7
- package/assets/assets/RunsPage-DdZT_ymi.js +1 -0
- package/assets/assets/ServerTrafficSection-Co3bhYAQ.js +41 -0
- package/assets/assets/{SettingsPage-D6iGHRSV.js → SettingsPage-BBMyfzb2.js} +1 -1
- package/assets/assets/{TrafficPage-DtUjNJ9U.js → TrafficPage-BiOAIZ_a.js} +1 -1
- package/assets/assets/TrafficSourceDetailPage-CmA6q6Gi.js +1 -0
- package/assets/assets/extract-error-message-C1RkZ7dQ.js +1 -0
- package/assets/assets/index-yaR6JS3H.js +43 -0
- package/assets/assets/preload-helper-BHTtLTWU.js +1 -0
- package/assets/assets/{react-sigma_core.esm.min-BN4etdK8.js → react-sigma_core.esm.min-BVgWTcxp.js} +1 -1
- package/assets/index.html +3 -1
- package/dist/{chunk-KWAAPYTA.js → chunk-7Q4DS5JP.js} +1 -1
- package/dist/{chunk-QMNM2YWF.js → chunk-CSQTR3JO.js} +3 -3
- package/dist/{chunk-IIIBDDAR.js → chunk-DCW5R7SJ.js} +1 -1
- package/dist/{cli-commands-3P4EFKQC.js → cli-commands-J2E4ZSGG.js} +1 -1
- package/dist/cli.js +2 -2
- package/dist/index.d.ts +73 -73
- package/dist/index.js +1 -1
- package/dist/{init-2K3C2O27.js → init-HU3CQ3KE.js} +1 -1
- package/dist/{serve-233RXB4F.js → serve-AAGQ7AV7.js} +1 -1
- package/package.json +1 -1
- package/assets/assets/MeasurementPropertyPage-Dd7B-Ixb.js +0 -4
- package/assets/assets/RunsPage-DRGUFx7X.js +0 -1
- package/assets/assets/ServerTrafficSection-CrPHSAa5.js +0 -40
- package/assets/assets/TrafficSourceDetailPage-o-I_uVwZ.js +0 -1
- package/assets/assets/index-CWI3NboX.js +0 -43
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@canonry/canonry",
|
|
3
|
-
"version": "7.116.
|
|
3
|
+
"version": "7.116.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Self-hosted AI visibility (AEO) platform: track how ChatGPT, Claude, Gemini, and Perplexity cite your domain, join it with Search Console, GA4, server-side traffic, and paid media, and fix what you find through agent tools (CLI, REST, MCP). Local SQLite.",
|
|
6
6
|
"keywords": [
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{ft as t,ut as n}from"./vendor-lucide-iE5MEh2-.js";import{r}from"./vendor-markdown-BBGbNklj.js";import{_ as i,d as a,f as o,p as s,u as c,v as l,x as u}from"./vendor-tanstack-16u6cATb.js";import{Fs as d,Is as f,Mc as p,Ps as m,Ys as h,bt as g,ft as _,jc as v,kt as ee,r as y,t as b}from"./ToneBadge-D3F2fbxC.js";import{R as x,S,f as C,h as w,z as T}from"./ChartPrimitives-IodrWRFV.js";import{r as te}from"./account-context-CBRGXimz.js";import{Dt as ne,Et as re,Ft as ie,Mt as E,Ot as ae,Tt as D,kt as O,yn as k}from"./react-query-DNgX0alO.js";import{E as A,n as j}from"./AccessControls-BTEv8WEG.js";import{t as M}from"./InfoTooltip-D29JcNMW.js";import{$ as oe,Bt as se,Ht as ce,Rt as N,X as P,dt as F,et as I,ft as le,gt as L,nt as ue,pt as de,q as fe}from"./index-CWI3NboX.js";import{c as R,r as z,s as pe,t as me,u as B}from"./service-DxCuciCi.js";var V=e(t(),1),H=r(),U={heading:`Names that count as this Property`,help:`These names identify this Property in answer text. Source titles and URLs do not count as mentions. Qualified names add distinguishing words when several Properties share a name, such as a product line, service, or location.`,names:`Names`,qualifiedNames:`Qualified names`,noNames:`No names are set, so answers can cite this Property but never mention it.`,edit:`Edit names`,save:`Save to draft`,saving:`Saving…`,cancel:`Cancel`,namesHint:`One name per line.`,qualifiedHint:`One per line. Include a name above plus words that identify this specific Property.`,qualifiedNote:`With qualified names set, an answer that uses only a plain name counts as a mention only when it also cites this Property’s own page. Otherwise it is left out as not tied to one property.`,draftOnly:`Saving changes the draft only. Nothing is measured differently until the setup is published.`,saved:`Saved to the draft. Publish the setup to start using these names.`,pending:`Name changes are saved in the draft and not published yet.`,review:`Review and publish`,noChanges:`No changes to save.`,staleDraft:`The draft is based on an older published setup. Open measurement setup to restart it before editing names.`,missingFromDraft:`This Property is not included in the current draft. Open measurement setup to review it.`,conflict:`The draft changed in another session. The latest names are loaded; review them and save again.`,failed:`Could not save these names. Try again.`};function he(e){return[...new Set(e.split(`
|
|
2
|
-
`).map(e=>e.trim()).filter(Boolean))]}function ge(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}function W(e,t){return ge(e.aliases,t.aliases)&&ge(e.identityAliases??[],t.identityAliases??[])}function _e(e,t,n){let{identityAliases:r,...i}=e;return n.length>0?{...i,aliases:t,identityAliases:n}:{...i,aliases:t}}function G({label:e,names:t}){return(0,H.jsxs)(`div`,{className:`space-y-1`,children:[(0,H.jsx)(`h3`,{className:`text-heading-14 text-heading`,children:e}),(0,H.jsx)(`ul`,{className:`space-y-1`,children:t.map(e=>(0,H.jsx)(`li`,{className:`text-label-14 text-secondary`,children:e},e))})]})}function K({id:e,issues:t}){return t.length===0?null:(0,H.jsx)(`ul`,{id:e,className:`mt-2 space-y-1`,"aria-label":`Name warnings`,children:t.map(e=>(0,H.jsx)(`li`,{className:`text-label-14 text-caution`,children:m(e)},`${e.field}:${e.index}`))})}function ve({projectName:e,targetKey:t,published:n,activeRevision:r,publishedBrandNames:i,service:a=me}){let{canWrite:o}=te(),s=(0,V.useId)(),p=u({...re({client:g,path:{name:e}}),enabled:o}),m=u({...ie({client:g,path:{name:e}}),enabled:o}),h=p.data?.draft?.authoring.targets.find(e=>e.stableKey===t),_=n.identityAliases??[],v=h!==void 0&&p.data?.draft?.baseActiveRevision===r&&!W(h,n),ee=!p.isFetching&&!m.isPending,b=m.data,x=(0,V.useMemo)(()=>b?f(b):i,[b,i]),[S,C]=(0,V.useState)(!1),[w,T]=(0,V.useState)(``),[ne,E]=(0,V.useState)(``),[ae,D]=(0,V.useState)(n),[O,k]=(0,V.useState)(null),A=`${e}\u0000${t}`,[oe,se]=(0,V.useState)(A);oe!==A&&(se(A),C(!1),T(``),E(``),D(n),k(null));let ce=(0,V.useRef)(A);ce.current=A;let N=(0,V.useMemo)(()=>he(w),[w]),P=(0,V.useMemo)(()=>he(ne),[ne]),F=(0,V.useMemo)(()=>d({aliases:N,identityAliases:P,brandNames:x}),[N,P,x]),I=F.filter(e=>e.field===`aliases`),le=F.filter(e=>e.field===`identityAliases`);function L(e){T(e.aliases.join(`
|
|
3
|
-
`)),E((e.identityAliases??[]).join(`
|
|
4
|
-
`)),D({aliases:[...e.aliases],identityAliases:[...e.identityAliases??[]]})}function ue(e){return e.draft?e.draft.authoring.targets.find(e=>e.stableKey===t)??null:n}function de(){L(v?h:n),k(null),C(!0)}function fe(e){e&&L(e),k({tone:`negative`,text:U.conflict,review:!1})}let R=l({mutationFn:async i=>{let o=await a.loadDraft(e);if(!o.draft){if(W(i.names,n))return{outcome:`unchanged`};if(!W(i.base,n))return{outcome:`conflict`,latest:n};await a.createDraft(e,r),o=await a.loadDraft(e)}let s=o.draft;if(!s||!o.etag)throw Error(U.failed);if(s.baseActiveRevision!==r)return{outcome:`stale`};let c=s.authoring.targets.find(e=>e.stableKey===t);return!c||c.status!==`included`?{outcome:`missing`}:W(i.names,c)?{outcome:`unchanged`}:W(i.base,c)?(await a.upsertTarget(e,o.etag,_e(c,i.names.aliases,i.names.identityAliases)),{outcome:`saved`}):{outcome:`conflict`,latest:c}},meta:{skipGlobalErrorToast:!0},onSuccess:(e,t)=>{if(t.openFor===ce.current)switch(e.outcome){case`saved`:C(!1),k({tone:`positive`,text:U.saved,review:!0});return;case`unchanged`:C(!1),k({tone:`positive`,text:U.noChanges,review:!1});return;case`stale`:k({tone:`negative`,text:U.staleDraft,review:!0});return;case`missing`:k({tone:`negative`,text:U.missingFromDraft,review:!0});return;case`conflict`:fe(e.latest),p.refetch();return}},onError:(e,t)=>{t.openFor===ce.current&&(z(e)?(fe(null),p.refetch().then(e=>{e.isSuccess&&fe(ue(e.data))})):k({tone:`negative`,text:U.failed,review:!1}))}}),pe=(0,H.jsx)(c,{to:`/projects/$projectName/portfolio`,params:{projectName:e},className:`text-link underline-offset-2 hover:underline`,children:U.review}),B=n.aliases.length+_.length;return(0,H.jsxs)(`section`,{"aria-labelledby":`property-names`,className:`page-section-divider`,children:[(0,H.jsxs)(`div`,{className:`section-head section-head-inline`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,H.jsx)(`h2`,{id:`property-names`,className:`text-heading-16 text-heading`,children:U.heading}),(0,H.jsx)(M,{text:U.help})]}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,H.jsxs)(`p`,{className:`supporting-copy`,children:[B,` `,B===1?`name`:`names`]}),o&&!S?(0,H.jsx)(y,{type:`button`,size:`sm`,variant:`outline`,className:`h-11 px-4 text-button-14 md:h-11`,disabled:!ee,onClick:de,children:U.edit}):null]})]}),O?(0,H.jsxs)(`p`,{role:O.tone===`negative`?`alert`:`status`,className:`mb-3 text-copy-14 ${O.tone===`negative`?`text-negative`:`text-positive`}`,children:[O.text,O.review?(0,H.jsxs)(H.Fragment,{children:[` `,pe]}):null]}):v&&!S?(0,H.jsxs)(`p`,{role:`status`,className:`mb-3 text-copy-14 text-caution`,children:[U.pending,` `,pe]}):null,S?(0,H.jsxs)(`form`,{className:`space-y-4`,"aria-label":`Edit names`,onSubmit:e=>{e.preventDefault(),!R.isPending&&R.mutate({names:{aliases:N,identityAliases:P},base:ae,openFor:A})},children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`label`,{htmlFor:`${s}-names`,className:`block text-label-14-strong text-heading`,children:U.names}),(0,H.jsx)(`p`,{id:`${s}-names-hint`,className:`text-copy-14 text-secondary`,children:U.namesHint}),(0,H.jsx)(`textarea`,{id:`${s}-names`,className:`mt-1 min-h-24 w-full rounded-md border border-strong bg-transparent px-3 py-2 text-copy-14 text-strong focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-mono-400`,"aria-describedby":`${s}-names-hint${I.length?` ${s}-names-issues`:``}`,value:w,onChange:e=>T(e.target.value)}),(0,H.jsx)(K,{id:`${s}-names-issues`,issues:I}),N.length===0?(0,H.jsx)(`p`,{className:`mt-2 text-copy-14 text-caution`,children:U.noNames}):null]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`label`,{htmlFor:`${s}-qualified`,className:`block text-label-14-strong text-heading`,children:U.qualifiedNames}),(0,H.jsx)(`p`,{id:`${s}-qualified-hint`,className:`text-copy-14 text-secondary`,children:U.qualifiedHint}),(0,H.jsx)(`textarea`,{id:`${s}-qualified`,className:`mt-1 min-h-20 w-full rounded-md border border-strong bg-transparent px-3 py-2 text-copy-14 text-strong focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-mono-400`,"aria-describedby":`${s}-qualified-hint ${s}-qualified-note${le.length?` ${s}-qualified-issues`:``}`,value:ne,onChange:e=>E(e.target.value)}),(0,H.jsx)(K,{id:`${s}-qualified-issues`,issues:le}),(0,H.jsx)(`p`,{id:`${s}-qualified-note`,className:`mt-2 max-w-3xl text-copy-14 text-secondary`,children:U.qualifiedNote})]}),(0,H.jsx)(`p`,{className:`text-copy-14 text-secondary`,children:U.draftOnly}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,H.jsx)(j,{type:`submit`,className:`h-11 px-4 text-label-14 md:h-11`,disabled:R.isPending,children:R.isPending?U.saving:U.save}),(0,H.jsx)(y,{type:`button`,variant:`ghost`,className:`h-11 px-4 text-button-14 md:h-11`,disabled:R.isPending,onClick:()=>{C(!1),k(null)},children:U.cancel})]})]}):B===0?(0,H.jsx)(`p`,{className:`text-copy-14 text-secondary`,children:U.noNames}):(0,H.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[n.aliases.length>0?(0,H.jsx)(G,{label:U.names,names:n.aliases}):null,_.length>0?(0,H.jsx)(G,{label:U.qualifiedNames,names:_}):null]})]})}var ye=50,q={branded:{technical:`Branded queries`},"non-brand":{technical:`Non-brand queries`}},J={plan_v1:`Setup update required`,no_completed_run:`No completed measurement yet`,no_population:`No queries of this type are assigned`,evidence_incomplete:`Source evidence is incomplete`,identity_ambiguous:T,not_applicable:`Not applicable for this Property`,citation_not_measured:`The engines return no sources`},be={complete:{label:`Measured`,tone:`positive`},partial:{label:`Partly measured`,tone:`caution`},running:{label:`Measuring now`,tone:`neutral`},queued:{label:`Measurement queued`,tone:`neutral`},failed:{label:`Measurement failed`,tone:`negative`},not_measured:{label:`Not measured`,tone:`neutral`}},Y={assigned:{label:`Matches this Property`,tone:`positive`},sibling:{label:`Matches another Property`,tone:`caution`},ownedUnmapped:{label:`Site URL not in a Property`,tone:`caution`},external:{label:`External URL`,tone:`neutral`},ambiguous:{label:`Matches multiple Properties`,tone:`caution`},invalid:{label:`Invalid URL`,tone:`negative`}};function X(e){return[...e].sort((e,t)=>Number(t.classification===`assigned`)-Number(e.classification===`assigned`))}function xe(e){return`${e.expectedSlotId}:${e.usageEdgeId}`}function Se({row:e}){return e.mentioned===null?(0,H.jsxs)(`span`,{className:`inline-flex flex-col items-start gap-0.5`,children:[(0,H.jsx)(b,{tone:`neutral`,children:`Not measured`}),(0,H.jsx)(`span`,{className:`text-label-12 text-muted`,children:`No mention signal for this Property`})]}):!e.mentioned&&e.mentionIdentity===`wrong-subject`?(0,H.jsxs)(`span`,{className:`inline-flex flex-col items-start gap-0.5`,children:[(0,H.jsx)(b,{tone:`neutral`,children:`Not mentioned`}),(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-label-12 text-muted`,children:[L.label,(0,H.jsx)(M,{text:L.property})]})]}):(0,H.jsx)(b,{tone:e.mentioned?`positive`:`neutral`,children:e.mentioned?`Mentioned`:`Not mentioned`})}var Ce=`—`;function we({row:e}){return e.cited===null?(0,H.jsxs)(`span`,{className:`inline-flex flex-col items-start gap-0.5`,children:[(0,H.jsx)(b,{tone:`neutral`,children:`Not measured`}),(0,H.jsx)(`span`,{className:`text-label-12 text-muted`,children:e.citationMeasured===!1?`The engine returns no sources`:`Sources were not fully captured`})]}):(0,H.jsx)(b,{tone:e.cited?`positive`:`neutral`,children:e.cited?`Cited`:`Not cited`})}function Te({row:e}){return e.citationMeasured===!1?(0,H.jsx)(`p`,{className:`py-2 text-copy-14 text-secondary`,children:x}):e.cited===null&&e.sources.length===0?(0,H.jsx)(`p`,{className:`py-2 text-copy-14 text-secondary`,children:`The sources for this answer were not fully captured, so none can be shown.`}):e.sources.length===0?(0,H.jsx)(`p`,{className:`py-2 text-copy-14 text-secondary`,children:`This answer returned no source URLs at all.`}):(0,H.jsxs)(`details`,{className:`mt-2`,"data-answer-sources":!0,children:[(0,H.jsxs)(`summary`,{className:`min-h-11 cursor-pointer py-3 text-label-14 text-secondary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-mono-400`,children:[le,` (`,e.sources.length,`)`]}),(0,H.jsx)(`div`,{className:`overflow-x-auto`,children:(0,H.jsxs)(`table`,{className:`evidence-table min-w-[420px]`,children:[(0,H.jsxs)(`caption`,{className:`sr-only`,children:[`Source URLs for `,e.queryText]}),(0,H.jsx)(`thead`,{children:(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`th`,{children:`Match`}),(0,H.jsx)(`th`,{children:`URL`})]})}),(0,H.jsx)(`tbody`,{children:X(e.sources).map(e=>(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`td`,{children:(0,H.jsx)(b,{tone:Y[e.classification].tone,children:Y[e.classification].label})}),(0,H.jsx)(`td`,{children:(0,H.jsx)(F,{url:e.sourceUrl})})]},e.sourceUrl))})]})})]})}function Ee({project:e,targetKey:t,resultId:n}){let r=u({...E({client:g,path:{name:e},query:{targetKey:t,resultId:n}})});if(r.isPending)return(0,H.jsx)(`p`,{className:`py-2 text-copy-14 text-secondary`,role:`status`,"aria-live":`polite`,children:`Loading the answer…`});if(r.isError)return(0,H.jsx)(`p`,{className:`py-2 text-copy-14 text-secondary`,role:`alert`,children:`Could not load this answer.`});let i=r.data?.answer;return i==null||i.trim()===``?(0,H.jsx)(`p`,{className:`py-2 text-copy-14 text-secondary`,children:`This answer was measured, but its text was not stored.`}):(0,H.jsx)(`div`,{className:`py-2`,children:(0,H.jsx)(de,{headingLevel:4,copyable:!0,children:i})})}function De(e){return J[e.reason]??`Not measured`}function Oe({metric:e,signal:t,queryClass:n,emphasis:r=!1,compact:i=!1}){if(e.state===`unavailable`)return(0,H.jsxs)(`span`,{className:`inline-flex flex-col gap-0.5`,children:[(0,H.jsx)(`span`,{className:r?`text-label-18-strong text-secondary`:`text-label-14-strong text-secondary`,children:`Not measured`}),(0,H.jsxs)(`span`,{className:`sr-only`,children:[` · `,n,` queries`]}),(0,H.jsx)(`span`,{className:`text-label-14 text-secondary`,children:De(e)})]});let a=h(e.value),o=e.numerator===void 0||e.denominator===void 0?null:`${e.numerator} of ${e.denominator}`,s=S(e,t);return i?(0,H.jsxs)(`span`,{className:`inline-flex flex-col items-end gap-0.5`,children:[(0,H.jsxs)(`span`,{className:`engine-comparison-metric`,children:[(0,H.jsx)(`span`,{className:`text-label-14-strong text-primary`,children:a}),o?(0,H.jsxs)(`span`,{className:`text-label-13 text-secondary`,"aria-hidden":`true`,children:[e.numerator,`/`,e.denominator]}):null,(0,H.jsxs)(`span`,{className:`sr-only`,children:[o?` · ${o} answers`:``,` · `,n,` queries`]})]}),s?(0,H.jsx)(`span`,{className:`flex`,children:(0,H.jsx)(M,{tone:`caution`,placement:`bottom`,label:s.label,text:s.text})}):null]}):(0,H.jsxs)(`span`,{className:`inline-flex flex-col gap-0.5 tabular-nums`,children:[(0,H.jsx)(`span`,{className:r?`text-label-18-strong text-heading`:`text-label-14-strong text-primary`,children:a}),(0,H.jsxs)(`span`,{className:`sr-only`,children:[` · `,n,` queries`]}),o?(0,H.jsx)(`span`,{className:`text-label-12 text-muted`,children:o}):null,s?(0,H.jsx)(`span`,{className:`-ml-2 flex`,children:(0,H.jsx)(M,{tone:`caution`,placement:`bottom`,label:s.label,text:s.text})}):null]})}function ke(e,t,n){return D({client:g,path:{name:e},query:{scope:`property`,targetKey:t,queryClass:n}})}function Ae(e){return e?.properties.items.at(0)}function je({measuredAt:e,unmeasuredReason:t,queryClass:n}){let r=e===void 0?null:e===null?`No completed check yet`:`Measured ${C(w(e))}`;return r===null&&t===void 0?null:(0,H.jsxs)(`p`,{className:`supporting-copy`,children:[[r,t].filter(Boolean).join(` · `),r!==null&&t===void 0?` · ${q[n].technical.toLocaleLowerCase()} only`:``]})}function Me({project:e,groups:t}){return t.length===0?null:(0,H.jsxs)(`section`,{"aria-labelledby":`property-market`,className:`page-section-divider`,children:[(0,H.jsxs)(`div`,{className:`section-head section-head-inline`,children:[(0,H.jsx)(`div`,{children:(0,H.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,H.jsx)(`h2`,{id:`property-market`,className:`text-heading-16 text-heading`,children:`Measured at the market level`}),(0,H.jsx)(M,{text:`Competitors are attached to groups. Share of voice and competitor pressure use the group or market that includes this Property.`})]})}),(0,H.jsx)(y,{asChild:!0,type:`button`,size:`sm`,variant:`outline`,children:(0,H.jsx)(c,{to:`/projects/$projectName`,params:{projectName:e},search:e=>I(P(e),{measurementScope:`project`}),children:`Open measurement overview`})})]}),(0,H.jsx)(`ul`,{className:`flex flex-wrap gap-2`,children:t.map(e=>(0,H.jsxs)(`li`,{className:`rounded-md border border-default px-3 py-1.5 text-label-14 text-strong`,children:[e.label,(0,H.jsxs)(`span`,{className:`ml-2 text-label-12 text-muted`,children:[e.competitors.length,` `,e.competitors.length===1?`competitor`:`competitors`]})]},e.stableKey))})]})}function Ne({branded:e,nonBrand:t,brandedError:n,nonBrandError:r,onRetry:i}){return(0,H.jsxs)(`section`,{"aria-labelledby":`property-brand-contrast`,children:[(0,H.jsx)(`div`,{className:`section-head section-head-inline`,children:(0,H.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,H.jsx)(`h2`,{id:`property-brand-contrast`,className:`text-heading-16 text-heading`,children:`Coverage for this Property`}),(0,H.jsx)(M,{text:`Non-brand queries do not name this Property. Branded queries name it. Each rate uses only the measured answers for that query type. Mentioned means the Property was named in the answer; cited means its URL appeared in the sources. Unchecked sources are not counted as a citation miss.`})]})}),(0,H.jsx)(`div`,{className:`overflow-x-auto rounded-md border border-default`,children:(0,H.jsxs)(`table`,{className:`evidence-table min-w-[560px]`,children:[(0,H.jsx)(`caption`,{className:`sr-only`,children:`Mention and citation coverage for this Property, split by query class`}),(0,H.jsx)(`thead`,{children:(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`th`,{children:`Query type`}),(0,H.jsx)(`th`,{children:`Mentioned in the answer`}),(0,H.jsx)(`th`,{children:`Cited as a source`})]})}),(0,H.jsx)(`tbody`,{children:[{queryClass:`non-brand`,row:t,isError:r},{queryClass:`branded`,row:e,isError:n}].map(({queryClass:e,row:t,isError:n})=>(0,H.jsxs)(`tr`,{children:[(0,H.jsxs)(`td`,{children:[(0,H.jsx)(`span`,{className:`block text-label-14-strong text-heading`,children:q[e].technical}),t&&n?(0,H.jsxs)(`span`,{className:`mt-2 flex flex-wrap items-center gap-2 text-label-14 text-caution`,children:[(0,H.jsx)(`span`,{role:`status`,children:`Refresh failed.`}),(0,H.jsxs)(y,{type:`button`,size:`sm`,variant:`ghost`,className:`h-11 px-3 text-button-14 md:h-11`,onClick:()=>i(e),children:[`Retry `,q[e].technical.toLocaleLowerCase()]})]}):null]}),t?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`td`,{children:(0,H.jsx)(Oe,{metric:t.mentionCoverage,signal:`mentioned`,queryClass:e,emphasis:!0})}),(0,H.jsx)(`td`,{children:(0,H.jsx)(Oe,{metric:t.citationCoverage,signal:`cited`,queryClass:e,emphasis:!0})})]}):n?(0,H.jsx)(`td`,{colSpan:2,children:(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 text-label-14 text-secondary`,children:[(0,H.jsxs)(`span`,{role:`alert`,children:[`Could not load `,q[e].technical.toLocaleLowerCase(),`.`]}),(0,H.jsxs)(y,{type:`button`,size:`sm`,variant:`outline`,className:`h-11 px-4 text-button-14 md:h-11`,onClick:()=>i(e),children:[`Retry `,q[e].technical.toLocaleLowerCase()]})]})}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`td`,{children:(0,H.jsx)(`span`,{className:`text-label-14 text-secondary`,children:`Loading…`})}),(0,H.jsx)(`td`,{children:(0,H.jsx)(`span`,{className:`text-label-14 text-secondary`,children:`Loading…`})})]})]},e))})]})})]})}function Pe({row:e,queryClass:t,isError:n}){return(0,H.jsxs)(`section`,{"aria-labelledby":`property-providers`,className:`page-section-divider`,children:[(0,H.jsx)(`div`,{className:`section-head section-head-inline`,children:(0,H.jsx)(`div`,{children:(0,H.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,H.jsx)(`h2`,{id:`property-providers`,className:`text-heading-16 text-heading`,children:`Which engines answer for this Property`}),(0,H.jsx)(M,{text:`Each row is measured over the queries that engine actually answered for this Property, so the rows are a split of the same population rather than parts that add up to the Property total. An engine that answered nothing for this Property is absent instead of shown at 0%.`})]})})}),e===void 0&&n?(0,H.jsxs)(`p`,{className:`text-copy-14 text-secondary`,children:[`Details for `,q[t].technical.toLocaleLowerCase(),` are unavailable. Retry that query type above.`]}):e===void 0?(0,H.jsx)(`p`,{className:`text-copy-14 text-secondary`,children:`Loading…`}):e.providers.length===0?(0,H.jsxs)(`p`,{className:`text-copy-14 text-secondary`,children:[`No answer engine has measured `,q[t].technical.toLocaleLowerCase(),` for this Property.`,e.mentionCoverage.state===`unavailable`?` ${De(e.mentionCoverage)}.`:``]}):(0,H.jsx)(`div`,{className:`overflow-x-auto`,children:(0,H.jsxs)(`table`,{className:`engine-comparison`,children:[(0,H.jsx)(`caption`,{className:`sr-only`,children:`Per-engine mention and citation coverage`}),(0,H.jsx)(`thead`,{children:(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`th`,{scope:`col`,children:`Engine`}),(0,H.jsx)(`th`,{scope:`col`,children:`Mentioned`}),(0,H.jsx)(`th`,{scope:`col`,children:`Cited`})]})}),(0,H.jsx)(`tbody`,{children:e.providers.map(e=>(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`td`,{children:(0,H.jsx)(B,{provider:e.provider})}),(0,H.jsx)(`td`,{children:(0,H.jsx)(Oe,{metric:e.mentionCoverage,signal:`mentioned`,queryClass:t,compact:!0})}),(0,H.jsx)(`td`,{children:(0,H.jsx)(Oe,{metric:e.citationCoverage,signal:`cited`,queryClass:t,compact:!0})})]},e.provider))})]})})]})}function Z(e){let t=e.questions.join(` · `);return e.questionsTruncated?`${t} +${e.questionTotal-e.questions.length} more`:t}function Fe({project:e,targetKey:t,queryClass:n}){let r=u({...ae({client:g,path:{name:e},query:{targetKey:t,queryClass:n}})});if(r.isPending||r.isError)return null;let i=r.data?.competitors??[],a=r.data?.basis;return(0,H.jsxs)(`section`,{"aria-labelledby":`property-named-instead`,className:`page-section-divider`,children:[(0,H.jsxs)(`div`,{className:`section-head section-head-inline`,children:[(0,H.jsx)(`div`,{children:(0,H.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,H.jsx)(`h2`,{id:`property-named-instead`,className:`text-heading-16 text-heading`,children:`Named instead of this Property`}),(0,H.jsx)(M,{text:`Counted from the answers that did not name this Property, so a name here is one an engine recommended in its place. Occurrences count answers, not positions: an engine naming the same rival in two answers counts twice, and one naming it twice in a single answer counts once.`})]})}),i.length>0?(0,H.jsxs)(`p`,{className:`supporting-copy`,children:[r.data?.total??i.length,` named`]}):null]}),i.length===0?(0,H.jsx)(`p`,{className:`text-copy-14 text-secondary`,children:`No rival was named in the answers this Property missed. Nothing to compete with here yet.`}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{className:`overflow-x-auto`,children:(0,H.jsxs)(`table`,{className:`evidence-table min-w-[420px]`,children:[(0,H.jsx)(`caption`,{className:`sr-only`,children:`Names the engines gave instead of this Property`}),(0,H.jsx)(`thead`,{children:(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`th`,{children:`Named`}),(0,H.jsx)(`th`,{children:`Answers`}),(0,H.jsx)(`th`,{children:`Engines`}),(0,H.jsx)(`th`,{children:`Queries`})]})}),(0,H.jsx)(`tbody`,{children:i.map(e=>(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`td`,{className:`text-strong`,children:e.name}),(0,H.jsx)(`td`,{className:`tabular-nums text-secondary`,children:e.occurrences}),(0,H.jsxs)(`td`,{className:`text-secondary`,children:[e.providers.map(e=>A(e)).join(`, `),e.providersTruncated?` +${e.providerTotal-e.providers.length}`:``]}),(0,H.jsx)(`td`,{className:`text-right`,children:(0,H.jsxs)(`span`,{className:`inline-flex items-center justify-end gap-1`,children:[(0,H.jsx)(`span`,{className:`tabular-nums text-secondary`,children:e.questionTotal}),(0,H.jsx)(M,{text:Z(e)})]})})]},e.name))})]})}),a?.state===`available`?(0,H.jsxs)(`p`,{className:`supporting-copy mt-2`,children:[a.targetMissResults,` of `,a.answeredResults,` answers to `,q[n].technical.toLocaleLowerCase(),` did not name this Property.`]}):null]})]})}function Ie({questions:e,queryClass:t}){return(0,H.jsxs)(`section`,{"aria-labelledby":`property-questions`,className:`page-section-divider`,children:[(0,H.jsxs)(`div`,{className:`section-head section-head-inline`,children:[(0,H.jsx)(`div`,{children:(0,H.jsxs)(`h2`,{id:`property-questions`,className:`text-heading-16 text-heading`,children:[q[t].technical,` assigned to this Property`]})}),(0,H.jsxs)(`p`,{className:`supporting-copy`,children:[e.length,` assigned`]})]}),e.length===0?(0,H.jsxs)(`p`,{className:`text-copy-14 text-secondary`,children:[`No `,q[t].technical.toLocaleLowerCase(),` are assigned. Add one in advanced measurement setup to measure this class.`]}):(0,H.jsx)(`div`,{className:`overflow-x-auto`,children:(0,H.jsxs)(`table`,{className:`evidence-table min-w-[420px]`,children:[(0,H.jsx)(`caption`,{className:`sr-only`,children:`Queries assigned to this Property`}),(0,H.jsx)(`thead`,{children:(0,H.jsx)(`tr`,{children:(0,H.jsx)(`th`,{children:`Query`})})}),(0,H.jsx)(`tbody`,{children:e.map(e=>(0,H.jsx)(`tr`,{children:(0,H.jsx)(`td`,{className:`text-secondary`,children:e})},e))})]})})]})}function Le({urls:e}){return(0,H.jsxs)(`section`,{"aria-labelledby":`property-urls`,className:`page-section-divider`,children:[(0,H.jsxs)(`div`,{className:`section-head section-head-inline`,children:[(0,H.jsx)(`div`,{children:(0,H.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,H.jsx)(`h2`,{id:`property-urls`,className:`text-heading-16 text-heading`,children:`URLs that count as this Property`}),(0,H.jsx)(M,{text:`A cited source URL is credited to this Property when it matches one of these. The most specific matcher wins, so a URL covered by two Properties at the same specificity is flagged for review instead of being credited to either.`})]})}),(0,H.jsxs)(`p`,{className:`supporting-copy`,children:[e.length,` configured`]})]}),e.length===0?(0,H.jsx)(`p`,{className:`text-copy-14 text-secondary`,children:`No URLs are configured for this Property.`}):(0,H.jsx)(`div`,{className:`overflow-x-auto`,children:(0,H.jsxs)(`table`,{className:`evidence-table min-w-[420px]`,children:[(0,H.jsx)(`caption`,{className:`sr-only`,children:`URL matchers configured for this Property`}),(0,H.jsx)(`thead`,{children:(0,H.jsx)(`tr`,{children:(0,H.jsx)(`th`,{children:`URL`})})}),(0,H.jsx)(`tbody`,{children:e.map(e=>(0,H.jsx)(`tr`,{children:(0,H.jsx)(`td`,{className:`break-all text-secondary`,children:e})},e))})]})})]})}var Q={heading:`Cited on other queries`,help:`Answers to queries assigned to other properties that still cited one of this Property’s own pages. This Property was not measured on those queries, so these answers are not in its Mentioned or Cited rates.`,notCounted:`not in this Property’s rates`,empty:`No answer to a query assigned elsewhere cited this Property’s pages in the displayed measurement.`,loadError:`Citations from other queries could not be loaded.`,partlySaved:`Sources partly saved`};function Re({project:e,targetKey:t,queryClass:n,runId:r,targetLabels:a}){let[o,s]=(0,V.useState)(new Set),l={client:g,path:{name:e},query:{targetKey:t,queryClass:n,shape:p[`other-queries`],limit:ye,...r?{runId:r}:{}}},u=i({...O(l),initialPageParam:l,getNextPageParam:e=>e.otherQueries?.nextCursor?{path:l.path,query:{...l.query,cursor:e.otherQueries.nextCursor}}:void 0}),d=u.data?.pages??[];if(d[0]?.measurement.state===`not_measured`)return null;let f=d.flatMap(e=>e.otherQueries?.items??[]),m=d[0]?.otherQueries?.totalEstimate??f.length,h=e=>`${e.expectedSlotId}:${e.queryClass}`,_=q[n].technical.toLocaleLowerCase();return(0,H.jsxs)(`section`,{"aria-labelledby":`property-other-queries`,className:`page-section-divider`,children:[(0,H.jsxs)(`div`,{className:`section-head section-head-inline`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,H.jsx)(`h2`,{id:`property-other-queries`,className:`text-heading-16 text-heading`,children:Q.heading}),(0,H.jsx)(M,{text:Q.help})]}),u.data?(0,H.jsxs)(`p`,{className:`supporting-copy`,children:[m,` `,m===1?`answer`:`answers`,` · `,_,` · `,Q.notCounted]}):null]}),u.isPending?(0,H.jsx)(`p`,{className:`text-copy-14 text-secondary`,children:`Loading…`}):u.isError&&f.length===0?(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 text-label-14 text-secondary`,children:[(0,H.jsx)(`span`,{role:`alert`,children:Q.loadError}),(0,H.jsx)(y,{type:`button`,size:`sm`,variant:`outline`,className:`h-11 px-4 text-button-14 md:h-11`,onClick:()=>{u.refetch()},children:`Retry`})]}):f.length===0?(0,H.jsx)(`p`,{className:`text-copy-14 text-secondary`,children:Q.empty}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{className:`overflow-x-auto`,children:(0,H.jsxs)(`table`,{className:`evidence-table min-w-[640px]`,children:[(0,H.jsx)(`caption`,{className:`sr-only`,children:`Answers to other properties’ queries that cited this Property’s pages`}),(0,H.jsx)(`thead`,{children:(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`th`,{children:`Query`}),(0,H.jsx)(`th`,{children:`Assigned to`}),(0,H.jsx)(`th`,{children:`Pages cited`}),(0,H.jsx)(`th`,{children:(0,H.jsx)(`span`,{className:`sr-only`,children:`Answer`})})]})}),(0,H.jsx)(`tbody`,{children:f.map(t=>{let n=h(t),r=o.has(n),i=`property-other-query-${encodeURIComponent(n)}`;return(0,H.jsxs)(V.Fragment,{children:[(0,H.jsxs)(`tr`,{children:[(0,H.jsxs)(`td`,{className:`text-secondary`,children:[(0,H.jsx)(`span`,{className:`block text-label-14-strong text-heading`,children:t.queryText}),(0,H.jsx)(`span`,{className:`mt-1 block text-label-12 text-muted`,children:[A(t.provider),t.location].filter(Boolean).join(` · `)})]}),(0,H.jsx)(`td`,{children:(0,H.jsx)(`ul`,{className:`space-y-1`,children:t.assignedTargetKeys.map(t=>(0,H.jsx)(`li`,{children:(0,H.jsx)(c,{to:`/projects/$projectName/properties/$targetKey`,params:{projectName:e,targetKey:t},search:P,className:`text-label-14 text-link hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-mono-400`,children:a.get(t)??t})},t))})}),(0,H.jsxs)(`td`,{children:[(0,H.jsx)(`ul`,{className:`space-y-1`,children:t.sources.map(e=>(0,H.jsx)(`li`,{className:`min-w-0`,children:(0,H.jsx)(F,{url:e.sourceUrl})},e.sourceUrl))}),t.sourcesTruncated?(0,H.jsxs)(`span`,{className:`mt-1 block text-label-12 text-muted`,children:[t.sourceCount,` pages in total`]}):null,t.evidenceComplete?null:(0,H.jsx)(`span`,{className:`mt-1 block text-label-12 text-muted`,children:Q.partlySaved})]}),(0,H.jsx)(`td`,{className:`text-right`,children:(0,H.jsx)(y,{type:`button`,size:`sm`,variant:`ghost`,className:`h-auto pointer-coarse:min-h-11 max-w-full whitespace-normal py-2 text-left md:h-auto`,"aria-expanded":r,"aria-label":r?`Hide the answer for ${t.queryText}`:`Read the answer for ${t.queryText}`,"aria-controls":r?i:void 0,onClick:()=>s(e=>{let t=new Set(e);return t.delete(n)||t.add(n),t}),children:r?`Hide answer`:`Read answer`})})]}),r?(0,H.jsx)(`tr`,{children:(0,H.jsx)(`td`,{id:i,colSpan:4,className:`bg-surface-subtle px-4`,children:(0,H.jsx)(Ee,{project:e,targetKey:t.assignedTargetKeys[0],resultId:t.observationId})})}):null]},n)})})]})}),u.hasNextPage?(0,H.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-3 text-label-14 text-secondary`,children:[(0,H.jsxs)(`span`,{children:[`Showing `,f.length,` of `,m]}),(0,H.jsx)(y,{size:`sm`,variant:`outline`,className:`h-11 px-4 text-button-14 md:h-11`,disabled:u.isFetchingNextPage,onClick:()=>{u.fetchNextPage()},children:u.isFetchingNextPage?`Loading…`:`Show ${ye} more`})]}):null]})]})}function ze(e,t){let n=[e.marketKey?t??`the selected market`:null,e.provider?`the ${A(e.provider)} answer engine`:null,e.model?`the ${v(e.model)} model`:null,e.location?`location ${e.location}`:null,e.from||e.to?`a date range`:null,e.measurementRunId?`a saved check`:null].filter(e=>e!==null);return n.length===0?null:`AI Visibility is filtered to ${n.join(`, `)}. This page shows the latest measurement for ${R.allMarkets.toLocaleLowerCase()} and answer engines.`}function Be(){let{projectName:e,targetKey:t}=s({strict:!1}),r=a(),l=o({strict:!1}),d=(0,V.useMemo)(()=>oe(l),[l]),[f,m]=(0,V.useState)(new Set),h=e??``,v=t??``,x=!!h&&!!v,S=(0,V.useMemo)(()=>se(`portfolio`,N(_())),[]),C=x&&S,{canWrite:w}=te(),T=u({...ne({client:g,path:{name:h}}),enabled:C}),re=T.data?.active?.plan,ie=re?.schemaVersion===2?re:null,E=d.queryClass===`branded`||d.queryClass===`non-brand`?d.queryClass:null,ae=e=>ie?.assignments.some(t=>t.targetKey===v&&t.queryClass===e)??!1,D=E??(!ae(`non-brand`)&&ae(`branded`)?`branded`:`non-brand`);(0,V.useEffect)(()=>{ie&&!E&&r({to:`.`,replace:!0,search:e=>I(e,{queryClass:D})})},[ie,E,D,r]);let j=u({...ke(h,v,`branded`),enabled:C}),F=u({...ke(h,v,`non-brand`),enabled:C}),L=Ae(j.data),de=Ae(F.data),R=D===`branded`?j.data:F.data,z=D===`branded`?L:de,me=(D===`branded`?j.isError:F.isError)&&z===void 0,B=R?.measurement.displayedRunId;ce(h,{view:`property`,selection:{mode:`advanced`,scope:`property`,scopeKey:v,queryClass:D,limit:10,...B?{runId:B}:{}}});let U=z?.mentionCoverage.state===`unavailable`?De(z.mentionCoverage):void 0,he=R===void 0?void 0:R.measurement.completedAt??null,ge=R!==void 0&&(R.measurement.state===`not_measured`||R.nextAction.kind===`run_measurement`),W=e=>I(P(e),{measurementScope:`property`,measurementScopeKey:v,queryClass:D,measurementRunId:void 0,measurementRevision:void 0,measurementTo:void 0}),_e=u({...k({client:g,path:{name:h},query:ue(oe(W(l)))}),enabled:C&&ge,retry:!1}).data,G=_e!==void 0&&_e.selection.measurement.measuredRevision!==null&&(_e.populations.find(e=>e.queryClass===D)?.summary.queryCount??0)>0,K={client:g,path:{name:h},query:{targetKey:v,queryClass:D,shape:p.answers,limit:ye,...B?{runId:B}:{}}},J=i({...O(K),enabled:C&&R!==void 0,initialPageParam:K,getNextPageParam:e=>e.answers?.nextCursor?{path:K.path,query:{...K.query,cursor:e.answers.nextCursor}}:void 0}),Y=T.data?.active??null,X=Y?.plan.schemaVersion===2?Y.plan:null,Oe=Y!==null&&X===null,Z=X?.targets.find(e=>e.stableKey===v)??null,Q=ze(d,X?.reportingScopes?.find(e=>e.stableKey===d.marketKey)?.label),Be=(0,V.useMemo)(()=>{if(!X)return[];let e=new Map(X.querySnapshots.map(e=>[e.queryId,e.queryText]));return[...new Set(X.assignments.filter(e=>e.targetKey===v&&e.queryClass===D).flatMap(t=>{let n=e.get(t.queryId);return n===void 0?[]:[n]}))].sort((e,t)=>e.localeCompare(t))},[X,v,D]),Ve=(0,V.useMemo)(()=>Z?.urlMatchers.map(pe)??[],[Z]),He=(0,V.useMemo)(()=>new Map((X?.targets??[]).map(e=>[e.stableKey,e.label])),[X]),Ue=(0,V.useMemo)(()=>X?.groups.filter(e=>e.targetKeys.includes(v))??[],[X,v]),$=(0,V.useMemo)(()=>(J.data?.pages??[]).flatMap(e=>e.answers?.items??[]),[J.data]),We=J.data?.pages[0]?.answers?.totalEstimate??$.length,Ge=(J.data?.pages??[]).length>0&&(J.data?.pages??[]).every(e=>e.answers===void 0),Ke=J.data?.pages[0]?.measurement.state,qe=(0,H.jsxs)(c,{to:`/projects/$projectName`,params:{projectName:h},search:P,className:`inline-flex items-center gap-1 text-label-12 text-muted hover:text-strong`,children:[(0,H.jsx)(n,{className:`size-3.5`,"aria-hidden":`true`}),`Back to AI Visibility`]});if(!x)return(0,H.jsx)(`div`,{className:`page-container`,children:(0,H.jsx)(`p`,{className:`text-copy-14 text-muted`,children:`Missing project name or Property key in URL.`})});if(!S)return(0,H.jsxs)(`div`,{className:`page-container space-y-3`,children:[qe,(0,H.jsx)(`p`,{className:`text-copy-14 text-muted`,children:`This view is not available here.`})]});if(T.isPending&&!T.isError)return(0,H.jsx)(`div`,{className:`page-container`,children:(0,H.jsxs)(`div`,{role:`status`,"aria-live":`polite`,children:[(0,H.jsx)(`span`,{className:`sr-only`,children:`Loading Property`}),(0,H.jsx)(`div`,{className:`h-32 animate-pulse rounded-md bg-surface-subtle`,"aria-hidden":`true`})]})});let Je=T.isError&&T.data===void 0,Ye=j.isError&&j.data===void 0,Xe=F.isError&&F.data===void 0;return Je||Ye&&Xe?(0,H.jsxs)(`div`,{className:`page-container space-y-3`,children:[qe,(0,H.jsx)(`p`,{role:`alert`,className:`text-copy-14 text-negative`,children:`Could not load this Property.`}),(0,H.jsx)(y,{type:`button`,size:`sm`,variant:`outline`,className:`h-11 px-4 text-button-14 md:h-11`,onClick:()=>{T.refetch(),j.refetch(),F.refetch()},children:`Try again`})]}):!X||!Z?(0,H.jsxs)(`div`,{className:`page-container space-y-3`,children:[qe,(0,H.jsx)(`p`,{role:`status`,className:`text-copy-14 text-secondary`,children:X?`This Property is not in the published setup. It may have been renamed or removed.`:`A Property page needs a published advanced measurement setup. Republish setup from the project Portfolio tab.`}),(0,H.jsx)(y,{asChild:!0,type:`button`,variant:`outline`,className:`h-11 px-4 text-button-14 md:h-11`,children:(0,H.jsx)(c,{to:`/projects/$projectName/portfolio`,params:{projectName:h},children:w?Oe?`Republish setup`:`Open measurement setup`:`View measurement setup`})})]}):(0,H.jsxs)(`div`,{className:`page-container space-y-8`,children:[(0,H.jsxs)(`div`,{className:`page-header`,children:[(0,H.jsxs)(`div`,{className:`page-header-left`,children:[qe,(0,H.jsx)(`h1`,{className:`page-title mt-2`,children:Z.label}),(0,H.jsxs)(`p`,{className:`page-subtitle`,children:[`Property in `,h,Q?(0,H.jsxs)(H.Fragment,{children:[` · Filters not applied `,(0,H.jsx)(M,{text:Q})]}):null]})]}),(0,H.jsxs)(`div`,{className:`page-header-right`,children:[R?(0,H.jsx)(b,{tone:be[R.measurement.state].tone,children:be[R.measurement.state].label}):null,z&&z.flags>0?(0,H.jsxs)(b,{tone:`caution`,children:[z.flags,` flagged`]}):null]})]}),(0,H.jsx)(Ne,{branded:L,nonBrand:de,brandedError:j.isError,nonBrandError:F.isError,onRetry:e=>{e===`branded`?j.refetch():F.refetch()}}),ge?(0,H.jsxs)(`section`,{className:`flex flex-wrap items-center justify-between gap-3 py-4`,"aria-label":`Measurement next step`,children:[(0,H.jsx)(`p`,{className:`text-copy-14 text-secondary`,children:ee()?fe:w?`Run a measurement from the project overview to collect this Property’s coverage and source evidence.${G?` AI Visibility still shows the last results.`:``}`:`This Property needs a new measurement before coverage and source evidence are available.`}),(0,H.jsx)(y,{asChild:!0,type:`button`,className:`h-11 px-4 text-button-14 md:h-11`,children:(0,H.jsx)(c,{to:`/projects/$projectName`,params:{projectName:h},search:G?W:P,children:G?`See the last results`:w?`Go to AI Visibility`:`View AI Visibility`})})]}):null,(0,H.jsxs)(`div`,{className:`flex flex-wrap items-end gap-4 py-4`,children:[(0,H.jsxs)(`div`,{className:`space-y-1`,children:[(0,H.jsx)(`label`,{htmlFor:`property-query-class`,className:`block text-label-14-strong text-heading`,children:`Query type`}),(0,H.jsxs)(`select`,{id:`property-query-class`,value:D,onChange:e=>{let t=e.target.value===`branded`?`branded`:`non-brand`;r({to:`.`,search:e=>I(e,{queryClass:t})})},className:`h-11 rounded-md border border-default bg-surface px-3 text-label-14 text-primary focus:outline-none focus:ring-2 focus:ring-mono-400`,children:[(0,H.jsx)(`option`,{value:`non-brand`,children:q[`non-brand`].technical}),(0,H.jsx)(`option`,{value:`branded`,children:q.branded.technical})]})]}),(0,H.jsx)(je,{measuredAt:he,unmeasuredReason:U,queryClass:D})]}),(0,H.jsx)(Pe,{row:z,queryClass:D,isError:me}),(0,H.jsx)(Fe,{project:h,targetKey:v,queryClass:D}),(0,H.jsx)(Ie,{questions:Be,queryClass:D}),(0,H.jsx)(ve,{projectName:h,targetKey:v,published:Z,activeRevision:Y.revision,publishedBrandNames:X.identities.projectBrand.names}),(0,H.jsx)(Le,{urls:Ve}),(0,H.jsx)(Me,{project:h,groups:Ue}),(0,H.jsxs)(`section`,{"aria-labelledby":`property-evidence`,className:`page-section-divider`,children:[(0,H.jsxs)(`div`,{className:`section-head section-head-inline`,children:[(0,H.jsx)(`div`,{children:(0,H.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,H.jsx)(`h2`,{id:`property-evidence`,className:`text-heading-16 text-heading`,children:`Answers the engines gave`}),(0,H.jsx)(M,{text:`Answers for the queries assigned to this Property in the displayed measurement. Mentioned and cited are independent. Missing answer text shows Not measured. Open an answer to read its text and sources, including any other Property it named.`})]})}),$.length>0?(0,H.jsxs)(`p`,{className:`supporting-copy`,children:[$.length,` of `,We]}):null]}),me?(0,H.jsxs)(`p`,{className:`text-copy-14 text-secondary`,children:[`Evidence for `,q[D].technical.toLocaleLowerCase(),` is unavailable. Retry that query type above.`]}):J.isPending&&$.length===0?(0,H.jsx)(`p`,{className:`text-copy-14 text-secondary`,children:`Loading evidence…`}):J.isError&&$.length===0?(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 text-label-14 text-secondary`,children:[(0,H.jsx)(`span`,{role:`alert`,children:`Evidence could not be loaded.`}),(0,H.jsx)(y,{type:`button`,size:`sm`,variant:`outline`,className:`h-11 px-4 text-button-14 md:h-11`,onClick:()=>{J.refetch()},children:`Retry evidence`})]}):Ke===`not_measured`?(0,H.jsx)(`p`,{className:`text-copy-14 text-secondary`,children:ee()?fe:`Not measured yet. Run a measurement to collect the answers for this Property.`}):Ge?(0,H.jsx)(`p`,{role:`alert`,className:`text-copy-14 text-caution`,children:`This measurement was returned in an older format, so the answers cannot be shown here. The numbers above are unaffected.`}):$.length===0?(0,H.jsx)(`p`,{className:`text-copy-14 text-secondary`,children:`No answers matched this Property in the displayed measurement.`}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{className:`property-answer-table-container overflow-x-auto`,children:(0,H.jsxs)(`table`,{className:`evidence-table property-evidence-table`,children:[(0,H.jsx)(`caption`,{className:`sr-only`,children:`Answers measured for this Property`}),(0,H.jsx)(`thead`,{children:(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`th`,{children:`Query`}),(0,H.jsx)(`th`,{children:`Mentioned in the answer`}),(0,H.jsx)(`th`,{children:`Cited as a source`}),(0,H.jsx)(`th`,{children:`Sources`}),(0,H.jsx)(`th`,{children:(0,H.jsx)(`span`,{className:`sr-only`,children:`Sources detail`})})]})}),(0,H.jsx)(`tbody`,{children:$.map(e=>{let t=xe(e),n=f.has(t),r=`property-answer-${encodeURIComponent(t)}`;return(0,H.jsxs)(V.Fragment,{children:[(0,H.jsxs)(`tr`,{className:`property-answer-summary`,children:[(0,H.jsxs)(`td`,{className:`text-secondary`,children:[(0,H.jsx)(`h3`,{className:`text-heading-14 text-heading`,children:e.queryText}),(0,H.jsx)(`span`,{className:`mt-1 block text-label-12 text-muted`,children:[A(e.provider),e.location].filter(Boolean).join(` · `)}),e.historical||e.bridged?(0,H.jsx)(`span`,{className:`mt-1 flex`,children:(0,H.jsx)(b,{tone:`caution`,children:`Historical`})}):null]}),(0,H.jsxs)(`td`,{children:[(0,H.jsx)(`span`,{className:`property-evidence-mobile-label`,"aria-hidden":`true`,children:`Mentioned`}),(0,H.jsx)(Se,{row:e})]}),(0,H.jsxs)(`td`,{children:[(0,H.jsx)(`span`,{className:`property-evidence-mobile-label`,"aria-hidden":`true`,children:`Cited`}),(0,H.jsx)(we,{row:e})]}),(0,H.jsxs)(`td`,{className:`tabular-nums text-secondary`,children:[(0,H.jsx)(`span`,{className:`property-evidence-mobile-label`,"aria-hidden":`true`,children:le}),e.cited===null?Ce:e.sources.length]}),(0,H.jsx)(`td`,{className:`text-right`,children:(0,H.jsx)(y,{type:`button`,size:`sm`,variant:`ghost`,className:`h-auto pointer-coarse:min-h-11 max-w-full whitespace-normal py-2 text-left md:h-auto`,"aria-expanded":n,"aria-label":n?`Hide the answer for ${e.queryText}`:`Read the answer for ${e.queryText}`,"aria-controls":n?r:void 0,onClick:()=>m(e=>{let n=new Set(e);return n.delete(t)||n.add(t),n}),children:n?`Hide answer`:`Read answer`})})]}),n?(0,H.jsx)(`tr`,{className:`property-answer-detail`,children:(0,H.jsxs)(`td`,{id:r,colSpan:5,className:`bg-surface-subtle px-4`,children:[(0,H.jsx)(Ee,{project:h,targetKey:v,resultId:e.observationId}),(0,H.jsx)(Te,{row:e})]})}):null]},t)})})]})}),J.hasNextPage?(0,H.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-3 text-label-14 text-secondary`,children:[(0,H.jsxs)(`span`,{children:[`Showing `,$.length,` of `,We]}),J.isFetchNextPageError?(0,H.jsx)(`span`,{role:`alert`,children:`Could not load more evidence.`}):null,(0,H.jsx)(y,{size:`sm`,variant:`outline`,className:`h-11 px-4 text-button-14 md:h-11`,disabled:J.isFetchingNextPage,onClick:()=>{J.fetchNextPage()},children:J.isFetchingNextPage?`Loading…`:J.isFetchNextPageError?`Retry more evidence`:`Show ${ye} more`})]}):null]})]}),R?(0,H.jsx)(Re,{project:h,targetKey:v,queryClass:D,runId:B,targetLabels:He}):null]})}export{Y as EVIDENCE_LABELS,Be as MeasurementPropertyPage,Q as OTHER_QUERIES_COPY};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{ft as t}from"./vendor-lucide-iE5MEh2-.js";import{a as n,i as r,o as i,r as a,s as o,t as s}from"./vendor-radix-DKCt5Z_h.js";import{r as c}from"./vendor-markdown-BBGbNklj.js";import{d as l,f as u,x as d}from"./vendor-tanstack-16u6cATb.js";import{At as f,_c as p,bt as m,kt as h,r as g,vc as _}from"./ToneBadge-D3F2fbxC.js";import{I as v}from"./ChartPrimitives-IodrWRFV.js";import{a as y}from"./query-client-CsLay1me.js";import{Cn as b,bn as x}from"./react-query-DNgX0alO.js";import{n as S}from"./AccessControls-BTEv8WEG.js";import{t as C}from"./InfoTooltip-D29JcNMW.js";import{t as w}from"./card-Biwv3_aH.js";import{Ct as T,M as E,jt as D,lt as O,r as k,rt as A,ut as j}from"./index-CWI3NboX.js";var M=e(t(),1),N=c(),P={"30d":{label:`Last 30 days`,days:30},"90d":{label:`Last 90 days`,days:90},"365d":{label:`Last year`,days:365}};function F(e){return new Date(Date.now()-P[e].days*24*60*60*1e3).toISOString()}function I({open:e,projectCount:t,pending:c,onOpenChange:l,onConfirm:u,onClosed:d}){let f=t===1;return(0,N.jsx)(s,{open:e,onOpenChange:l,children:(0,N.jsxs)(i,{children:[(0,N.jsx)(n,{className:`fixed inset-0 z-50 bg-overlay-scrim/70 backdrop-blur-sm`}),(0,N.jsxs)(a,{className:`material-modal fixed left-1/2 top-1/2 z-50 max-h-[85dvh] w-[calc(100%-2rem)] max-w-xl -translate-x-1/2 -translate-y-1/2 overflow-y-auto p-5`,onCloseAutoFocus:e=>{e.preventDefault(),d()},children:[(0,N.jsxs)(`div`,{className:`space-y-2`,children:[(0,N.jsx)(o,{className:`text-heading-20 text-heading`,children:`Review AI Visibility checks`}),(0,N.jsx)(r,{className:`text-copy-14 text-secondary`,children:f?`Checks 1 project. It runs its saved queries on its selected engines. Provider charges apply.`:`Checks all ${t} projects. Each runs its saved queries on its selected engines. Provider charges apply.`})]}),(0,N.jsx)(`p`,{className:`mt-4 text-copy-13 text-secondary`,children:`Runs once. Schedules stay unchanged. Projects already running or not set up are skipped.`}),(0,N.jsxs)(`div`,{className:`mt-6 flex flex-wrap gap-3`,children:[(0,N.jsx)(g,{type:`button`,variant:`outline`,onClick:()=>l(!1),children:`Cancel`}),(0,N.jsx)(S,{type:`button`,disabled:c,onClick:u,children:c?`Queueing…`:`Run ${t} ${f?`project`:`projects`}`})]})]})]})})}function L(){let e=O()?.dashboard,t=u({strict:!1}),n=l(),r=Object.values(_).includes(t.runStatus)?t.runStatus:`all`,i=Object.values(p).includes(t.runKind)?t.runKind:`all`,a=t.runProject??`all`,o=Object.hasOwn(P,t.runWindow??``)?t.runWindow:`30d`,s=t.runQuery??``,c=(0,M.useMemo)(()=>F(o),[o]),L=d({...x({client:m}),initialData:e?.projects.map(({project:e})=>e),initialDataUpdatedAt:0}),R=d({...b({client:m,query:{limit:1e3,since:c}}),initialData:e?.runs,initialDataUpdatedAt:0,staleTime:y,refetchInterval:e=>e.state.data?.some(e=>e.status===_.queued||e.status===_.running)?3e3:y}),z=k(),[B,V]=(0,M.useState)(!1),H=(0,M.useRef)(null),U=(0,M.useMemo)(()=>new Map((L.data??[]).map(e=>[e.id,e.displayName||e.name])),[L.data]),W=(0,M.useMemo)(()=>(R.data??[]).map(e=>`projectName`in e?e:j(e,U.get(e.projectId)??`Unknown project`)),[U,R.data]),G=s.trim().toLowerCase(),K=W.filter(e=>r!==`all`&&e.status!==r||i!==`all`&&e.kind!==i||a!==`all`&&e.projectId!==a?!1:!G||[e.summary,e.projectName,e.kindLabel,e.statusDetail].some(e=>e.toLowerCase().includes(G))),q=r!==`all`||i!==`all`||a!==`all`||s.trim()!==``||o!==`30d`,J=e=>{n({to:`/runs`,search:t=>({...t,...e}),replace:!0})};if(L.isLoading||R.isLoading)return(0,N.jsxs)(`div`,{className:`page-skeleton`,children:[(0,N.jsxs)(`div`,{className:`page-skeleton-header`,children:[(0,N.jsx)(`div`,{className:`skeleton-text h-6 w-20`}),(0,N.jsx)(`div`,{className:`skeleton-text-sm w-72`})]}),(0,N.jsx)(`div`,{className:`space-y-2`,children:[1,2,3,4].map(e=>(0,N.jsxs)(`div`,{className:`material-base p-3 flex items-center gap-3`,children:[(0,N.jsxs)(`div`,{className:`flex-1 space-y-1.5`,children:[(0,N.jsx)(`div`,{className:`skeleton-text w-40`}),(0,N.jsx)(`div`,{className:`skeleton-text-sm w-56`})]}),(0,N.jsx)(`div`,{className:`skeleton h-5 w-16 rounded-full`})]},e))})]});let Y=L.data?.length??0,X=async()=>{try{await z.mutateAsync(void 0),V(!1)}catch{}};return(0,N.jsxs)(`div`,{className:`page-container`,children:[(0,N.jsxs)(`div`,{className:`page-header`,children:[(0,N.jsxs)(`div`,{className:`page-header-left`,children:[(0,N.jsx)(`h1`,{className:`page-title`,children:`Runs`}),(0,N.jsx)(`p`,{className:`page-subtitle`,children:`Recent jobs across all projects.`})]}),!f()&&(h()?(0,N.jsx)(`p`,{className:`text-copy-14 text-secondary`,children:`AI Visibility checks are run by your Canonry team`}):Y>0?(0,N.jsx)(S,{type:`button`,variant:`outline`,size:`sm`,"aria-haspopup":`dialog`,onClick:e=>{H.current=e.currentTarget,V(!0)},children:`Run all projects`}):null)]}),!f()&&!h()?(0,N.jsx)(I,{open:B,projectCount:Y,pending:z.isPending,onOpenChange:V,onConfirm:()=>void X(),onClosed:()=>H.current?.focus()}):null,(0,N.jsxs)(`section`,{children:[(0,N.jsxs)(`div`,{className:`run-filters`,role:`group`,"aria-label":`Run filters`,children:[(0,N.jsx)(`input`,{type:`search`,"aria-label":`Search runs`,value:s,onChange:e=>J({runQuery:e.target.value||void 0}),placeholder:`Search runs or projects`,className:`run-filter-control`}),(0,N.jsxs)(`select`,{"aria-label":`Filter runs by status`,value:r,onChange:e=>J({runStatus:e.target.value===`all`?void 0:e.target.value}),className:`run-filter-control`,children:[(0,N.jsx)(`option`,{value:`all`,children:`All statuses`}),Object.values(_).map(e=>(0,N.jsx)(`option`,{value:e,children:v(e)},e))]}),(0,N.jsxs)(`select`,{"aria-label":`Filter runs by project`,value:a,onChange:e=>J({runProject:e.target.value===`all`?void 0:e.target.value}),className:`run-filter-control`,children:[(0,N.jsx)(`option`,{value:`all`,children:`All projects`}),(L.data??[]).map(e=>(0,N.jsx)(`option`,{value:e.id,children:e.displayName||e.name},e.id))]}),(0,N.jsxs)(`select`,{"aria-label":`Filter runs by type`,value:i,onChange:e=>J({runKind:e.target.value===`all`?void 0:e.target.value}),className:`run-filter-control`,children:[(0,N.jsx)(`option`,{value:`all`,children:`All run types`}),Object.values(p).map(e=>(0,N.jsx)(`option`,{value:e,children:A(e)},e))]}),(0,N.jsx)(`select`,{"aria-label":`Filter runs by date range`,value:o,onChange:e=>J({runWindow:e.target.value===`30d`?void 0:e.target.value}),className:`run-filter-control`,children:Object.entries(P).map(([e,t])=>(0,N.jsx)(`option`,{value:e,children:t.label},e))}),q?(0,N.jsx)(g,{type:`button`,variant:`ghost`,onClick:()=>J({runStatus:void 0,runKind:void 0,runProject:void 0,runWindow:void 0,runQuery:void 0}),children:`Clear filters`}):null]}),R.isError?(0,N.jsxs)(w,{className:`surface-card empty-card`,children:[(0,N.jsx)(`h2`,{children:`Run history unavailable`}),(0,N.jsx)(`p`,{children:D(R.error)}),(0,N.jsx)(g,{variant:`outline`,onClick:()=>void R.refetch(),children:`Try again`})]}):null,!R.isError&&K.length>0?(0,N.jsx)(`div`,{className:`data-table-wrapper`,children:(0,N.jsxs)(`table`,{className:`data-table runs-table`,children:[(0,N.jsx)(`caption`,{className:`sr-only`,children:`Recent runs across projects`}),(0,N.jsx)(`thead`,{children:(0,N.jsxs)(`tr`,{children:[(0,N.jsx)(`th`,{scope:`col`,children:`Run`}),(0,N.jsx)(`th`,{scope:`col`,children:`Project`}),(0,N.jsx)(`th`,{scope:`col`,children:`Status`}),(0,N.jsx)(`th`,{scope:`col`,children:`Started`}),(0,N.jsx)(`th`,{scope:`col`,children:`Duration`}),(0,N.jsx)(`th`,{scope:`col`,children:`Trigger`})]})}),(0,N.jsx)(`tbody`,{children:K.map(e=>(0,N.jsxs)(`tr`,{children:[(0,N.jsx)(`td`,{children:(0,N.jsx)(E,{run:e,projectName:L.data?.find(t=>t.id===e.projectId)?.name,className:`text-link text-label-14-strong text-left`,label:`View ${e.summary} for ${e.projectName}`,children:e.kindLabel})}),(0,N.jsxs)(`td`,{children:[(0,N.jsx)(`span`,{className:`text-primary`,children:e.projectName}),e.location?(0,N.jsx)(`span`,{className:`block text-copy-13 text-secondary`,children:e.location}):null]}),(0,N.jsx)(`td`,{children:(0,N.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,N.jsx)(T,{status:e.status}),(0,N.jsx)(C,{text:e.statusDetail})]})}),(0,N.jsx)(`td`,{className:`whitespace-nowrap tabular-nums`,children:e.startedAt}),(0,N.jsx)(`td`,{className:`whitespace-nowrap tabular-nums`,children:e.duration}),(0,N.jsx)(`td`,{className:`whitespace-nowrap`,children:e.triggerLabel})]},e.id))})]})}):R.isError?null:(0,N.jsxs)(w,{className:`surface-card empty-card`,children:[(0,N.jsx)(`h2`,{children:q?`No runs match these filters`:`No recent runs`}),(0,N.jsx)(`p`,{children:q?`Change or clear the filters to see more runs.`:`Start a check from a project, or choose a wider date range.`})]})]})]})}export{L as RunsPage};
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{C as t,H as n,W as r,f as i,ft as a,it as o,lt as s,o as c,q as l,tt as u,ut as d,z as f}from"./vendor-lucide-iE5MEh2-.js";import{r as p}from"./vendor-markdown-BBGbNklj.js";import{S as m,d as h,u as g}from"./vendor-tanstack-16u6cATb.js";import{At as _,Cn as ee,bt as te,r as v,t as y}from"./ToneBadge-D3F2fbxC.js";import{t as ne}from"./async-handler-Bj3TnIRw.js";import{d as re}from"./query-client-CsLay1me.js";import{hn as ie}from"./react-query-DNgX0alO.js";import{t as b}from"./InfoTooltip-D29JcNMW.js";import{t as x}from"./card-Biwv3_aH.js";import{St as S,Ut as C,bt as w,j as T,jt as E,vt as D,xt as O,yt as k}from"./index-CWI3NboX.js";import{i as A,n as ae,r as oe,s as se,t as ce}from"./server-traffic-CvK4BAVZ.js";var j=e(a(),1),M=p();function le({open:e,onOpenChange:t,onClosed:n,projectName:r}){let[i,a]=(0,j.useState)(`pick`);(0,j.useEffect)(()=>{e&&a(`pick`)},[e]);let o=()=>{t(!1),a(`pick`)};return(0,M.jsx)(D,{open:e,onOpenChange:e=>{e?t(!0):o()},children:(0,M.jsx)(k,{onCloseAutoFocus:e=>{n&&(e.preventDefault(),n())},children:i===`pick`?(0,M.jsx)(de,{onPick:a}):i===`cloudflare`?(0,M.jsx)(he,{projectName:r,onBack:()=>a(`pick`),onClose:o}):i===`wordpress`?(0,M.jsx)(L,{projectName:r,onBack:()=>a(`pick`),onClose:o}):i===`vercel`?(0,M.jsx)(z,{projectName:r,onBack:()=>a(`pick`),onClose:o}):(0,M.jsx)(R,{projectName:r,onBack:()=>a(`pick`),onClose:o})})})}var ue=[{type:`cloudflare`,name:`Cloudflare`,needs:`A zone you manage. Set up from the terminal.`,icon:i},{type:`wordpress`,name:`WordPress`,needs:`wp-admin access to install a plugin`,icon:f},{type:`vercel`,name:`Vercel`,needs:`A Vercel access token`,icon:c},{type:`cloud-run`,name:`Google Cloud Run`,needs:`A service account that can read logs`,icon:l}];function de({onPick:e}){return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(O,{children:[(0,M.jsx)(S,{children:`Connect a traffic source`}),(0,M.jsx)(w,{children:`Pick where your site runs. Canonry reads AI crawler visits and AI referrals from there.`})]}),(0,M.jsx)(`div`,{className:`mt-6 flex flex-col gap-3`,children:ue.map(({type:t,name:n,needs:r,icon:i})=>(0,M.jsxs)(`button`,{type:`button`,onClick:()=>e(t),className:`group flex items-center gap-3 rounded-md border border-base bg-bg-elevated/30 px-3 py-3 text-left transition-colors hover:border-mono-600 hover:bg-bg-elevated/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-mono-400`,children:[(0,M.jsx)(`span`,{className:`mt-0.5 inline-flex size-9 shrink-0 items-center justify-center rounded-md border border-base bg-bg text-neutral group-hover:text-heading`,children:(0,M.jsx)(i,{className:`size-4`})}),(0,M.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,M.jsx)(`span`,{className:`text-label-14-strong text-heading`,children:n}),(0,M.jsx)(`span`,{className:`text-label-13 text-secondary`,children:r})]})]},t))}),(0,M.jsx)(`p`,{className:`mt-6 text-copy-13 text-secondary`,children:`Your agent can set up any of these for you. Pick a source to copy instructions for it.`})]})}function N({title:e,description:t,onBack:n}){return(0,M.jsxs)(O,{children:[(0,M.jsxs)(`button`,{type:`button`,onClick:n,className:`mb-1 inline-flex w-fit items-center gap-1 rounded text-button-14 text-secondary transition-colors hover:text-strong focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-mono-400`,children:[(0,M.jsx)(d,{className:`size-3`}),`Choose a different source`]}),(0,M.jsx)(S,{children:e}),(0,M.jsx)(w,{children:t})]})}function P(e,t){let n=h();return async(r,i)=>{i.startInitialBackfill&&await ee(e,r),i.afterConnected?.(),t(),n({to:`/traffic/$projectName/$sourceId`,params:{projectName:e,sourceId:r}})}}function F(e,t){let[n,r]=(0,j.useState)(null),i=P(e,t);return{error:n,runConnect:async e=>{r(null);let t=e.validate();if(t){r(t);return}let n;try{n=await e.mutate()}catch(e){r(E(e));return}try{await i(n.id,{startInitialBackfill:e.startInitialBackfill??!0,afterConnected:e.onConnected})}catch(e){r(`Source connected, but starting the initial backfill failed: ${E(e)}`)}}}}function I({title:e,description:t,projectName:n,onBack:r,onClose:i,onSubmit:a,isPending:o,error:s,guide:c,children:l}){return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(N,{title:e,description:t,onBack:r}),(0,M.jsxs)(`div`,{className:`-mr-1 mt-6 min-h-0 flex-1 overflow-y-auto pr-1`,children:[(0,M.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,M.jsx)(X,{request:c.agentRequest,docsUrl:c.docsUrl}),(0,M.jsx)(Z,{steps:c.steps})]}),(0,M.jsxs)(`form`,{onSubmit:ne(async e=>{e.preventDefault(),await a()}),className:`mt-6 flex flex-col gap-5 border-t border-default pt-5`,children:[(0,M.jsxs)(`p`,{className:`text-copy-14-strong text-heading`,children:[`Then connect it to `,(0,M.jsx)(`span`,{className:`text-label-13-mono`,children:n})]}),l,s?(0,M.jsx)(`p`,{className:`rounded-md border border-negative-800/50 bg-negative-950/30 px-3 py-2 text-copy-13 text-negative-200`,children:s}):null,(0,M.jsxs)(`div`,{className:`mt-2 flex items-center justify-end gap-2 border-t border-default pt-4`,children:[(0,M.jsx)(v,{type:`button`,variant:`ghost`,size:`sm`,onClick:i,children:`Close`}),(0,M.jsx)(v,{type:`submit`,disabled:o,size:`sm`,children:o?`Connecting…`:`Connect`})]})]})]})]})}function L({projectName:e,onBack:t,onClose:n}){let[r,i]=(0,j.useState)(``),[a,o]=(0,j.useState)(``),[s,c]=(0,j.useState)(``),[l,u]=(0,j.useState)(``),d=A(e||null),{error:f,runConnect:p}=F(e,n);return(0,M.jsxs)(I,{title:`Connect a WordPress site`,description:(0,M.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[`Reads AI crawler visits from the Canonry Traffic Logger plugin.`,(0,M.jsx)(b,{text:`${K(`Application Password`)} Pages served from a full-page cache never reach the plugin, so exclude AI crawlers from your cache. The docs list the user agents.`})]}),guide:Y(e,r),projectName:e,onBack:t,onClose:n,onSubmit:()=>p({validate:()=>r.trim()?a.trim()?s.trim()?null:`Application Password is required.`:`Username is required.`:`WordPress site URL is required.`,mutate:()=>d.mutateAsync({baseUrl:r.trim(),username:a.trim(),applicationPassword:s.trim(),displayName:l.trim()||void 0}),onConnected:()=>c(``)}),isPending:d.isPending,error:f,children:[(0,M.jsx)(B,{label:`WordPress site URL`,description:`Base URL of the site running the Canonry Traffic Logger plugin.`,required:!0,children:(0,M.jsx)(`input`,{type:`url`,value:r,onChange:e=>i(e.target.value),required:!0,autoComplete:`url`,placeholder:`https://example.com`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-label-14 text-strong placeholder-mono-400 focus:border-mono-500 focus:outline-none`})}),(0,M.jsx)(B,{label:`Username`,description:`WordPress user that owns the Application Password.`,required:!0,children:(0,M.jsx)(`input`,{type:`text`,value:a,onChange:e=>o(e.target.value),required:!0,autoComplete:`username`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-label-14 text-strong placeholder-mono-400 focus:border-mono-500 focus:outline-none`})}),(0,M.jsx)(B,{label:`Application Password`,description:`Create one in wp-admin under Users -> Profile -> Application Passwords.`,required:!0,children:(0,M.jsx)(`input`,{type:`password`,value:s,onChange:e=>c(e.target.value),required:!0,autoComplete:`new-password`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-label-14 text-strong placeholder-mono-400 focus:border-mono-500 focus:outline-none`})}),(0,M.jsx)(Q,{children:(0,M.jsx)(B,{label:`Display name (optional)`,description:`Friendly label shown in the dashboard. Defaults to the WordPress host.`,children:(0,M.jsx)(`input`,{type:`text`,value:l,onChange:e=>u(e.target.value),autoComplete:`off`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-label-14 text-strong placeholder-mono-400 focus:border-mono-500 focus:outline-none`})})})]})}function R({projectName:e,onBack:t,onClose:n}){let[r,i]=(0,j.useState)(``),[a,o]=(0,j.useState)(``),[s,c]=(0,j.useState)(``),[l,u]=(0,j.useState)(``),[d,f]=(0,j.useState)(``),p=ae(e||null),{error:m,runConnect:h}=F(e,n),g=()=>h({validate:()=>r.trim()?d.trim()?null:`Service-account JSON content is required.`:`GCP project ID is required.`,mutate:()=>p.mutateAsync({gcpProjectId:r.trim(),serviceName:a.trim()||void 0,location:s.trim()||void 0,displayName:l.trim()||void 0,keyJson:d.trim()}),onConnected:()=>f(``)}),_=async e=>{if(!e)return;let t=await e.text();f(t)};return(0,M.jsxs)(I,{title:`Connect a Cloud Run service`,description:(0,M.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[`Reads AI crawler visits from your Cloud Run request logs.`,(0,M.jsx)(b,{text:K(`service-account private key`)})]}),guide:pe(e,r),projectName:e,onBack:t,onClose:n,onSubmit:g,isPending:p.isPending,error:m,children:[(0,M.jsx)(B,{label:`GCP project ID`,description:`The Google Cloud project hosting the Cloud Run service (e.g. my-prod-foo).`,required:!0,children:(0,M.jsx)(`input`,{type:`text`,value:r,onChange:e=>i(e.target.value),required:!0,autoComplete:`off`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-label-14 text-strong placeholder-mono-400 focus:border-mono-500 focus:outline-none`})}),(0,M.jsxs)(B,{label:`Service-account JSON`,description:`Paste the contents of the SA key (JSON). The SA needs roles/logging.viewer (or any role granting logging.logEntries.list).`,required:!0,children:[(0,M.jsx)(`textarea`,{value:d,onChange:e=>f(e.target.value),rows:6,spellCheck:!1,autoComplete:`off`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-copy-14-mono text-strong placeholder-mono-400 focus:border-mono-500 focus:outline-none`,placeholder:`{"type":"service_account","project_id":"…","private_key":"…"}`,required:!0}),(0,M.jsxs)(`label`,{className:`mt-2 inline-flex cursor-pointer items-center gap-2 text-label-14 text-secondary hover:text-strong`,children:[(0,M.jsx)(`input`,{type:`file`,accept:`application/json,.json`,className:`hidden`,onChange:e=>void _(e.target.files?.[0]??null)}),(0,M.jsx)(`span`,{className:`rounded-md border border-base px-2 py-1`,children:`Or upload a key file`})]})]}),(0,M.jsxs)(Q,{children:[(0,M.jsx)(B,{label:`Service name (optional)`,description:`Restrict log pulls to a specific Cloud Run service. Omit to pull all services in the project.`,children:(0,M.jsx)(`input`,{type:`text`,value:a,onChange:e=>o(e.target.value),autoComplete:`off`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-label-14 text-strong placeholder-mono-400 focus:border-mono-500 focus:outline-none`})}),(0,M.jsx)(B,{label:`Location (optional)`,description:`Region of the Cloud Run service (e.g. us-central1). Helpful when multiple regions emit logs.`,children:(0,M.jsx)(`input`,{type:`text`,value:s,onChange:e=>c(e.target.value),autoComplete:`off`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-label-14 text-strong placeholder-mono-400 focus:border-mono-500 focus:outline-none`})}),(0,M.jsx)(B,{label:`Display name (optional)`,description:`Friendly label shown in the dashboard. Defaults to the project + service combo.`,children:(0,M.jsx)(`input`,{type:`text`,value:l,onChange:e=>u(e.target.value),autoComplete:`off`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-label-14 text-strong placeholder-mono-400 focus:border-mono-500 focus:outline-none`})})]})]})}function z({projectName:e,onBack:t,onClose:n}){let[r,i]=(0,j.useState)(``),[a,o]=(0,j.useState)(``),[s,c]=(0,j.useState)(``),[l,u]=(0,j.useState)(`production`),[d,f]=(0,j.useState)(``),p=oe(e||null),{error:m,runConnect:h}=F(e,n);return(0,M.jsxs)(I,{title:`Connect a Vercel project`,description:(0,M.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[`Reads AI crawler visits from Vercel request logs. Nothing to install on your site.`,(0,M.jsx)(b,{text:K(`access token`)})]}),guide:fe(e),projectName:e,onBack:t,onClose:n,onSubmit:()=>h({validate:()=>r.trim()?a.trim()?s.trim()?null:`Vercel personal access token is required.`:`Vercel team / account ID is required.`:`Vercel project ID is required.`,mutate:()=>p.mutateAsync({projectId:r.trim(),teamId:a.trim(),token:s.trim(),environment:l,displayName:d.trim()||void 0}),startInitialBackfill:!1,onConnected:()=>c(``)}),isPending:p.isPending,error:m,children:[(0,M.jsx)(B,{label:`Vercel project ID`,description:`The prj_… id from the Vercel dashboard or .vercel/project.json.`,required:!0,children:(0,M.jsx)(`input`,{type:`text`,value:r,onChange:e=>i(e.target.value),required:!0,autoComplete:`off`,placeholder:`prj_…`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-label-14 text-strong placeholder-mono-400 focus:border-mono-500 focus:outline-none`})}),(0,M.jsx)(B,{label:`Vercel team / account ID`,description:`The Vercel team or personal account that owns the project. Find it as orgId in your .vercel/project.json.`,required:!0,children:(0,M.jsx)(`input`,{type:`text`,value:a,onChange:e=>o(e.target.value),required:!0,autoComplete:`off`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-label-14 text-strong placeholder-mono-400 focus:border-mono-500 focus:outline-none`})}),(0,M.jsx)(B,{label:`Personal access token`,description:`Create a Vercel personal access token under Account Settings → Tokens. Tokens can expire, so use a long-lived one.`,required:!0,children:(0,M.jsx)(`input`,{type:`password`,value:s,onChange:e=>c(e.target.value),required:!0,autoComplete:`new-password`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-label-14 text-strong placeholder-mono-400 focus:border-mono-500 focus:outline-none`})}),(0,M.jsxs)(Q,{children:[(0,M.jsx)(B,{label:`Environment`,description:`Which deployment environment's request logs to pull.`,children:(0,M.jsxs)(`select`,{value:l,onChange:e=>u(e.target.value),className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-label-14 text-strong focus:border-mono-500 focus:outline-none`,children:[(0,M.jsx)(`option`,{value:`production`,children:`production`}),(0,M.jsx)(`option`,{value:`preview`,children:`preview`})]})}),(0,M.jsx)(B,{label:`Display name (optional)`,description:`Friendly label shown in the dashboard. Defaults to the Vercel project ID.`,children:(0,M.jsx)(`input`,{type:`text`,value:d,onChange:e=>f(e.target.value),autoComplete:`off`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-label-14 text-strong placeholder-mono-400 focus:border-mono-500 focus:outline-none`})})]})]})}function B({label:e,description:t,required:n,children:r}){return(0,M.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,M.jsxs)(`span`,{className:`text-label-14-strong text-strong`,children:[e,n?(0,M.jsx)(`span`,{className:`ml-1 text-negative-400`,children:`*`}):null]}),r,(0,M.jsx)(`span`,{className:`text-label-13 text-secondary`,children:t})]})}var V=`https://github.com/Canonry/canonry/blob/main`,H=`${V}/skills/canonry/references/server-side-traffic.md`,U=`${V}/docs/cloudflare-traffic-setup.md`,W=`1.1.1`,G=`https://github.com/Canonry/canonry/releases/download/wp-traffic-logger-v${W}/canonry-traffic-logger-${W}.zip`;function K(e){return`The ${e} is stored in ~/.canonry/config.yaml on the Canonry server and never sent back to the dashboard.`}var q=`Never ask me to paste a password, token, or key into this chat. When a command needs one, give me the exact command to run myself, or read it from a file I point you to.`;function J(e,t){try{let n=new URL(e.trim());return n.protocol!==`https:`&&n.protocol!==`http:`?null:`${n.origin}${n.pathname.replace(/\/+$/,``)}/wp-admin/${t}`}catch{return null}}function Y(e,t){let n=C(e),r=J(t,`plugin-install.php?tab=upload`),i=J(t,`profile.php#application-passwords-section`);return{docsUrl:`${H}#connecting-a-wordpress-source`,steps:[{title:`Download the Canonry Traffic Logger plugin`,link:{label:`Download v${W} (.zip)`,href:G}},{title:`Upload and activate it in wp-admin`,detail:`Plugins → Add New → Upload Plugin, then Activate.`,...r?{link:{label:`Open the upload page`,href:r}}:{}},{title:`Create an Application Password`,detail:`Users → Profile → Application Passwords. Name it “Canonry” and copy the password it shows once.`,...i?{link:{label:`Open your profile`,href:i}}:{}},{title:`Using a page cache or CDN? Exclude AI crawlers from it`,detail:`Cached pages never reach the plugin, so crawler visits go uncounted.`,link:{label:`User agents to exclude`,href:`${H}#connecting-a-wordpress-source`}}],agentRequest:`Help me connect my WordPress site to the Canonry project "${e}" for server-side traffic.
|
|
2
|
-
|
|
3
|
-
Follow the WordPress section of the Canonry docs: ${H}#connecting-a-wordpress-source
|
|
4
|
-
|
|
5
|
-
1. Ask me for the site URL and a WordPress admin username.
|
|
6
|
-
2. Walk me through installing the Canonry Traffic Logger plugin: download ${G}, then upload and activate it under Plugins → Add New → Upload Plugin. If you have shell or WP-CLI access to the site, you may install it yourself after I approve.
|
|
7
|
-
3. Have me create an Application Password under Users → Profile → Application Passwords.
|
|
8
|
-
4. Ask whether the site uses a page cache or CDN. If it does, tell me exactly which AI user agents to exclude from it, using the list in the docs.
|
|
9
|
-
5. Give me the exact command to connect: cnry traffic connect wordpress ${n} --url <site-url> --username <user> --app-password '<app-password>'
|
|
10
|
-
6. After it connects, run cnry traffic sources ${n} --format json and cnry doctor --project ${n} --check 'traffic.source.*' --format json, and tell me in plain words whether events are arriving.
|
|
11
|
-
|
|
12
|
-
${q}`}}function fe(e){let t=C(e);return{docsUrl:`${H}#connecting-a-vercel-source`,steps:[{title:`Create a Vercel access token`,detail:`Give it access to the team that owns the project. Tokens can expire, so pick a long lifetime.`,link:{label:`Open Vercel tokens`,href:`https://vercel.com/account/tokens`}},{title:`Find the project ID and team ID`,detail:`Both are in the project’s Settings → General, or in .vercel/project.json (projectId and orgId) after vercel link.`}],agentRequest:`Help me connect my Vercel project to the Canonry project "${e}" for server-side traffic.
|
|
13
|
-
|
|
14
|
-
Follow the Vercel section of the Canonry docs: ${H}#connecting-a-vercel-source
|
|
15
|
-
|
|
16
|
-
1. Find the Vercel project ID and team ID. If this repo is linked, read projectId and orgId from .vercel/project.json. Otherwise ask me.
|
|
17
|
-
2. Have me create an access token at https://vercel.com/account/tokens, scoped to that team, and save it to a file only I can read.
|
|
18
|
-
3. Connect with: cnry traffic connect vercel ${t} --project-id <prj_...> --team-id <team_...> --token-file <path>
|
|
19
|
-
4. Confirm the source with cnry traffic sources ${t} --format json and cnry doctor --project ${t} --check 'traffic.source.*' --format json. Vercel keeps about 14 days of request logs, so tell me before starting any history backfill.
|
|
20
|
-
|
|
21
|
-
${q}`}}function pe(e,t){let n=C(e),r=t.trim(),i=`https://console.cloud.google.com/iam-admin/serviceaccounts${r?`?project=${encodeURIComponent(r)}`:``}`;return{docsUrl:`${H}#connecting-a-cloud-run-source`,steps:[{title:`Create a service account in the Google Cloud project`,detail:`Grant it the Logs Viewer role (roles/logging.viewer). Nothing broader is needed.`,link:{label:`Open service accounts`,href:i}},{title:`Create a JSON key for it`,detail:`Keys → Add key → Create new key → JSON. Upload the file below.`}],agentRequest:`Help me connect my Cloud Run service to the Canonry project "${e}" for server-side traffic.
|
|
22
|
-
|
|
23
|
-
Follow the Cloud Run section of the Canonry docs: ${H}#connecting-a-cloud-run-source
|
|
24
|
-
|
|
25
|
-
1. Ask me for the Google Cloud project ID and, if there is more than one, the Cloud Run service name and region.
|
|
26
|
-
2. If gcloud is installed and signed in, propose the exact commands to create a service account with only roles/logging.viewer and download a JSON key, and run them after I approve. Otherwise walk me through it in the Cloud Console.
|
|
27
|
-
3. Connect with: cnry traffic connect cloud-run ${n} --gcp-project <project-id> --service-account-key <path/to/key.json> (add --service and --location to narrow it).
|
|
28
|
-
4. Confirm with cnry doctor --project ${n} --check 'traffic.source.*' --format json and tell me in plain words whether logs are readable.
|
|
29
|
-
|
|
30
|
-
${q}`}}function me(e){let t=C(e);return{docsUrl:U,steps:[{title:`Check your request volume first`,detail:`The Worker runs on every request to your zone. A busy site can pass the Workers free allowance of 100,000 requests a day.`,link:{label:`How to size it`,href:`${U}#before-you-start-size-the-request-volume`}},{title:`Find your zone ID and account ID`,detail:`Both are on the zone’s Overview page in the Cloudflare dashboard, under API.`,link:{label:`Open Cloudflare`,href:`https://dash.cloudflare.com/`}},{title:`Run the connect command where Canonry runs`,detail:`cnry traffic connect cloudflare ${t} --zone-id <zone-id> --account-id <account-id>`}],agentRequest:`Help me connect my Cloudflare zone to the Canonry project "${e}" for server-side traffic.
|
|
31
|
-
|
|
32
|
-
Follow the Canonry Cloudflare guide: ${U}
|
|
33
|
-
|
|
34
|
-
1. Before anything else, estimate the zone's daily request volume with me, as the guide's "size the request volume" section shows, and tell me whether it fits the Workers plan I am on.
|
|
35
|
-
2. Ask me for the zone ID and account ID, and whether I want direct push or Queue pull. Recommend one and say why.
|
|
36
|
-
3. Run cnry traffic connect cloudflare ${t} --zone-id <zone-id> --account-id <account-id> (plus the flags for the mode I chose). It writes the Worker and its config without deploying. Show me what it wrote.
|
|
37
|
-
4. Deploy only after I approve, and attach the route with Fail open exactly as the guide says.
|
|
38
|
-
5. Smoke-check with cnry traffic events ${t} --source <source-id> --format json and tell me whether events are arriving.
|
|
39
|
-
|
|
40
|
-
${q}`}}function X({request:e,docsUrl:t}){let[i,a]=(0,j.useState)(!1),s=async()=>{try{await navigator.clipboard.writeText(e),a(!0),window.setTimeout(()=>a(!1),1800)}catch{re({tone:`negative`,title:`Could not copy the setup request`,detail:`Follow the steps below, or open the setup guide instead.`})}};return(0,M.jsxs)(`section`,{"aria-labelledby":`traffic-agent-heading`,className:`material-base px-4 py-3`,children:[(0,M.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-2`,children:[(0,M.jsx)(o,{className:`size-4 text-positive`,"aria-hidden":`true`}),(0,M.jsx)(`h3`,{id:`traffic-agent-heading`,className:`flex-1 text-heading-14 text-heading`,children:`Have your agent set this up`}),(0,M.jsxs)(v,{type:`button`,variant:`secondary`,size:`sm`,onClick:()=>{s()},children:[i?(0,M.jsx)(u,{className:`size-3.5`,"aria-hidden":`true`}):(0,M.jsx)(r,{className:`size-3.5`,"aria-hidden":`true`}),(0,M.jsx)(`span`,{"aria-live":`polite`,children:i?`Copied`:`Copy setup request`})]})]}),(0,M.jsxs)(`p`,{className:`mt-1.5 text-copy-13 text-secondary`,children:[`Paste it into Claude Code, Codex, or any agent with a terminal. It follows the`,` `,(0,M.jsxs)(`a`,{href:t,target:`_blank`,rel:`noreferrer`,className:`text-link underline-offset-4 hover:underline`,children:[`setup guide`,(0,M.jsx)(n,{className:`ml-0.5 inline size-3`,"aria-hidden":`true`})]}),` `,`and never asks you to paste secrets into the chat.`]})]})}function Z({steps:e,heading:t=`Or do it yourself`}){return(0,M.jsxs)(`section`,{"aria-labelledby":`traffic-steps-heading`,children:[(0,M.jsx)(`h3`,{id:`traffic-steps-heading`,className:`text-heading-14 text-heading`,children:t}),(0,M.jsx)(`ol`,{className:`mt-3 flex flex-col gap-3`,children:e.map((e,t)=>(0,M.jsxs)(`li`,{className:`flex gap-3`,children:[(0,M.jsx)(`span`,{"aria-hidden":`true`,className:`flex size-6 shrink-0 items-center justify-center rounded-full border border-default bg-surface-subtle text-label-12-strong tabular-nums text-secondary`,children:t+1}),(0,M.jsxs)(`div`,{className:`min-w-0 pt-0.5`,children:[(0,M.jsx)(`p`,{className:`text-copy-14 text-heading`,children:e.title}),e.detail?(0,M.jsx)(`p`,{className:`mt-0.5 text-copy-13 text-secondary ${e.detail.startsWith(`cnry `)?`break-all font-mono`:``}`,children:e.detail}):null,e.link?(0,M.jsxs)(`a`,{href:e.link.href,target:`_blank`,rel:`noreferrer`,className:`mt-1 inline-flex items-center gap-1 text-label-13-strong text-link underline-offset-4 hover:underline`,children:[e.link.label,(0,M.jsx)(n,{className:`size-3`,"aria-hidden":`true`})]}):null]})]},e.title))})]})}function Q({children:e}){return(0,M.jsxs)(`details`,{className:`group`,children:[(0,M.jsxs)(`summary`,{className:`cursor-pointer list-none text-label-14-strong text-secondary hover:text-heading`,children:[(0,M.jsx)(`span`,{className:`group-open:hidden`,children:`Show more options`}),(0,M.jsx)(`span`,{className:`hidden group-open:inline`,children:`Hide more options`})]}),(0,M.jsx)(`div`,{className:`mt-4 flex flex-col gap-5`,children:e})]})}function he({projectName:e,onBack:t,onClose:r}){let i=me(e);return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(N,{title:`Connect a Cloudflare zone`,description:(0,M.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[`A small Worker on your zone reports AI crawler visits. It is set up from the terminal.`,(0,M.jsx)(b,{text:`Setting it up deploys a Worker to your Cloudflare account, so it runs from the Canonry CLI on the machine where Canonry runs, never from the browser.`})]}),onBack:t}),(0,M.jsxs)(`div`,{className:`-mr-1 mt-6 min-h-0 flex-1 overflow-y-auto pr-1`,children:[(0,M.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,M.jsx)(X,{request:i.agentRequest,docsUrl:i.docsUrl}),(0,M.jsx)(Z,{steps:i.steps})]}),(0,M.jsxs)(`div`,{className:`mt-6 flex items-center justify-end gap-2 border-t border-default pt-4`,children:[(0,M.jsx)(v,{type:`button`,variant:`ghost`,size:`sm`,onClick:r,children:`Close`}),(0,M.jsx)(v,{type:`button`,size:`sm`,asChild:!0,children:(0,M.jsxs)(`a`,{href:i.docsUrl,target:`_blank`,rel:`noreferrer`,children:[`Open the setup guide`,(0,M.jsx)(n,{className:`size-3.5`,"aria-hidden":`true`})]})})]})]})]})}function ge(e){if(!e)return`never`;let t=Date.now()-new Date(e).getTime(),n=Math.floor(t/6e4);if(n<1)return`just now`;if(n<60)return`${n}m ago`;let r=Math.floor(n/60);return r<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}function $(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:e.toLocaleString()}function _e({projectName:e,heading:n=!0}){let[r,i]=(0,j.useState)(!1),a=(0,j.useRef)(null),o=se(e),s=o.data?.sources??[],c=e=>{a.current=e,i(!0)};return(0,M.jsxs)(`section`,{"aria-labelledby":n?`server-traffic-heading`:void 0,"aria-label":n?void 0:`Server traffic`,children:[(0,M.jsxs)(`div`,{className:`section-head section-head-inline`,children:[(0,M.jsx)(`div`,{children:n?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`h2`,{id:`server-traffic-heading`,className:`text-heading-20 text-heading`,children:`Server traffic`}),(0,M.jsx)(`p`,{className:`page-subtitle`,children:`AI crawler hits and referral sessions from your server logs.`})]}):null}),!_()&&(0,M.jsxs)(v,{type:`button`,variant:`outline`,size:`sm`,onClick:e=>c(e.currentTarget),children:[(0,M.jsx)(t,{className:`size-3.5`}),`Connect a source`]})]}),o.isLoading?(0,M.jsx)(x,{className:`p-6 text-center text-label-14 text-muted`,children:`Loading sources…`}):s.length===0?(0,M.jsxs)(x,{className:`p-8 text-center`,children:[(0,M.jsxs)(`p`,{className:`text-copy-14 text-neutral`,children:[`No traffic sources connected for `,e,`.`]}),!_()&&(0,M.jsx)(`p`,{className:`mt-1 text-copy-14 text-secondary`,children:`Connect a source to start collecting traffic.`})]}):(0,M.jsx)(ve,{projectName:e,sources:s}),!_()&&(0,M.jsx)(le,{open:r,onOpenChange:i,onClosed:()=>{a.current?.isConnected&&a.current.focus()},projectName:e})]})}function ve({projectName:e,sources:t}){let n=h(),r=m({queries:t.map(t=>({...ie({client:te,path:{name:e,id:t.id}}),staleTime:3e4}))}),i=t.map((e,t)=>({source:e,detail:r[t]?.data,isLoading:r[t]?.isLoading??!1}));return(0,M.jsx)(`div`,{className:`material-base overflow-hidden`,children:(0,M.jsxs)(`table`,{className:`w-full text-label-14`,children:[(0,M.jsx)(`caption`,{className:`sr-only`,children:`Server traffic sources for the last 24 hours`}),(0,M.jsx)(`thead`,{className:`bg-bg-elevated/50 text-label-12-strong normal-case text-muted`,children:(0,M.jsxs)(`tr`,{children:[(0,M.jsx)(`th`,{className:`px-4 py-2 text-left`,children:`Source`}),(0,M.jsx)(`th`,{className:`px-4 py-2 text-left`,children:`Status`}),(0,M.jsx)(`th`,{className:`px-4 py-2 text-left`,children:`Last sync`}),(0,M.jsx)(`th`,{className:`px-4 py-2 text-right`,children:`Content crawls`}),(0,M.jsx)(`th`,{className:`px-4 py-2 text-right`,children:`Infra crawls`}),(0,M.jsx)(`th`,{className:`px-4 py-2 text-right`,children:`AI fetches`}),(0,M.jsx)(`th`,{className:`px-4 py-2 text-right`,children:`AI referrals`}),(0,M.jsx)(`th`,{className:`px-4 py-2 text-right`,children:(0,M.jsx)(`span`,{className:`sr-only`,children:`Detail`})})]})}),(0,M.jsx)(`tbody`,{className:`divide-y divide-mono-800/60`,children:i.map(({source:t,detail:r,isLoading:i})=>(0,M.jsxs)(`tr`,{className:`cursor-pointer transition-colors hover:bg-bg-elevated/40 focus-within:bg-bg-elevated/40`,onClick:r=>{T(r)&&n({to:`/traffic/$projectName/$sourceId`,params:{projectName:e,sourceId:t.id}})},children:[(0,M.jsx)(`td`,{className:`px-4 py-3`,children:(0,M.jsx)(g,{to:`/traffic/$projectName/$sourceId`,params:{projectName:e,sourceId:t.id},className:`text-label-14-strong text-heading hover:underline`,children:t.displayName})}),(0,M.jsxs)(`td`,{className:`px-4 py-3`,children:[(0,M.jsx)(y,{tone:ce(t.status),children:t.status}),t.lastError?(0,M.jsx)(`p`,{className:`mt-1 max-w-[18rem] truncate text-copy-14 text-negative-400`,title:t.lastError,children:t.lastError}):null]}),(0,M.jsx)(`td`,{className:`px-4 py-3 text-neutral`,children:ge(t.lastSyncedAt)}),(0,M.jsx)(`td`,{className:`px-4 py-3 text-right tabular-nums text-heading`,title:r?`${r.totals24h.crawlerHits.toLocaleString(`en-US`)} total crawler hits`:void 0,children:i?`—`:$(r?.totals24h.crawlerContentHits??0)}),(0,M.jsx)(`td`,{className:`px-4 py-3 text-right tabular-nums text-muted`,children:i?`—`:$(r?.totals24h.crawlerInfraHits??0)}),(0,M.jsx)(`td`,{className:`px-4 py-3 text-right tabular-nums text-heading`,children:i?`—`:$(r?.totals24h.aiUserFetchHits??0)}),(0,M.jsx)(`td`,{className:`px-4 py-3 text-right tabular-nums text-heading`,children:i?`—`:$(r?.totals24h.aiReferralLandedHits??0)}),(0,M.jsx)(`td`,{className:`px-4 py-3 text-right`,children:(0,M.jsxs)(g,{to:`/traffic/$projectName/$sourceId`,params:{projectName:e,sourceId:t.id},className:`inline-flex items-center gap-1 text-label-14 text-secondary hover:text-heading`,children:[`View`,(0,M.jsx)(s,{className:`size-3.5`})]})})]},t.id))})]})})}export{_e as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{$ as t,Q as n,b as r,ft as i,n as a,ut as o}from"./vendor-lucide-iE5MEh2-.js";import{r as s}from"./vendor-markdown-BBGbNklj.js";import{p as ee,t as te,u as ne}from"./vendor-tanstack-16u6cATb.js";import{a as c,c as re,f as l,h as ie,i as ae,n as oe,p as se,r as ce}from"./vendor-recharts-ColROAYR.js";import{Ao as u,At as le,Oo as d,r as ue,t as de}from"./ToneBadge-D3F2fbxC.js";import{A as fe,a as f,n as pe,r as me,s as he,t as ge}from"./ChartPrimitives-IodrWRFV.js";import{t as p}from"./InfoTooltip-D29JcNMW.js";import{t as m}from"./card-Biwv3_aH.js";import{jt as _e}from"./index-CWI3NboX.js";import{a as ve,l as ye,o as be,t as xe}from"./server-traffic-CvK4BAVZ.js";import{r as Se}from"./agent-trust-copy-Bfe0oX0J.js";var h=e(i(),1),Ce=[{value:`all`,label:`All status`},{value:`2xx`,label:`2xx success`},{value:`3xx`,label:`3xx redirect`},{value:`4xx`,label:`4xx client error`},{value:`5xx`,label:`5xx server error`}],we=[{value:`all`,label:`All claims`},{value:u.verified,label:`Verified`},{value:u.claimed_unverified,label:`Claimed unverified`},{value:u.unknown_ai_like,label:`Unknown AI-like`}];function g(e){return e===`all`?null:Number.parseInt(e[0],10)}function Te(e){switch(e.kind){case d.crawler:case d[`ai-user-fetch`]:return e.botId;case d[`ai-referral`]:return e.product}}function _(e){switch(e.kind){case d.crawler:case d[`ai-user-fetch`]:return e.pathNormalized;case d[`ai-referral`]:return e.landingPathNormalized}}function v(e){switch(e.kind){case d.crawler:case d[`ai-user-fetch`]:return e.verificationStatus;case d[`ai-referral`]:return null}}function y(e,t){return t===`hour`?e:e.slice(0,10)}function Ee(e,t){return t===`hour`?{since:e,until:e}:{since:`${e}T00:00:00.000Z`,until:`${e}T23:59:59.999Z`}}function De(e,t,n){let r=t.pathQuery.trim().toLowerCase(),i=g(t.statusClass);return e.filter(e=>!(t.selectedBucket&&y(e.tsHour,n)!==t.selectedBucket||t.identity&&Te(e)!==t.identity||t.operator&&e.operator!==t.operator||r&&!_(e).toLowerCase().includes(r)||i!==null&&Math.floor(e.status/100)!==i||t.verification!==`all`&&v(e)!==t.verification))}function Oe(e,t){if(!e||typeof e!=`object`)return null;let n=e.activeTooltipIndex,r;if(typeof n==`number`)r=n;else if(typeof n==`string`&&n!==``)r=Number(n);else return null;return!Number.isInteger(r)||r<0||r>=t.length?null:t[r]?.bucket??null}var b=s(),x=[{value:60,label:`1h`,granularity:`hour`,fetchLimit:500},{value:360,label:`6h`,granularity:`hour`,fetchLimit:500},{value:1440,label:`24h`,granularity:`hour`,fetchLimit:500},{value:10080,label:`7d`,granularity:`hour`,fetchLimit:1e3},{value:43200,label:`30d`,granularity:`day`,fetchLimit:2e3},{value:129600,label:`90d`,granularity:`day`,fetchLimit:5e3}],ke=x.find(e=>e.label===`24h`)??x[2],S=50,Ae=5e3,je=f[0],Me=f[2],Ne=f[1],Pe=fe();function C(e){let t=new Date(e);return`${t.getMonth()+1}/${t.getDate()} ${String(t.getHours()).padStart(2,`0`)}:00`}function w(e){let t=new Date(`${e}T00:00:00`);return`${t.getMonth()+1}/${t.getDate()}`}function T(e){if(!e)return`never`;let t=Date.now()-new Date(e).getTime(),n=Math.floor(t/6e4);if(n<1)return`just now`;if(n<60)return`${n}m ago`;let r=Math.floor(n/60);return r<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}var E=[`crawler`,`ai-user-fetch`,`ai-referral`];function Fe(e){let t=E.filter(t=>e.has(t));return t.length===0||t.length===E.length?`all`:t.join(`,`)}var D=`browser agent non-page`;function Ie(e){return[`Pulled ${e.pulledEvents} entries`,`${e.crawlerHits} crawler`,`${e.aiUserFetchHits} AI user fetch`,`${e.aiUserFetchLikelyFakeHits} likely fake agent`,...e.aiUserFetchBrowserNonPageHits?[`${e.aiUserFetchBrowserNonPageHits} ${D}`]:[],`${e.aiReferralHits} AI referral`,`${e.unknownHits} unknown`].join(` · `)}function Le({canGoBack:e,className:t}){let n=`inline-flex items-center gap-1`;return e?(0,b.jsxs)(`button`,{type:`button`,onClick:()=>{window.history.back()},className:`${n} ${t??``}`,children:[(0,b.jsx)(o,{className:`size-3`}),` Back`]}):(0,b.jsxs)(ne,{to:`/traffic`,className:`${n} ${t??``}`,children:[(0,b.jsx)(o,{className:`size-3`}),` All sources`]})}function O(){let e=ee({strict:!1}),i=e.projectName??``,a=te(),o=e.sourceId??``,[s,ne]=(0,h.useState)(ke.value),[u,fe]=(0,h.useState)(()=>new Set([`crawler`,`ai-user-fetch`,`ai-referral`])),[f,g]=(0,h.useState)(null),[_,v]=(0,h.useState)(``),[y,C]=(0,h.useState)(``),[w,E]=(0,h.useState)(``),[D,O]=(0,h.useState)(`all`),[M,N]=(0,h.useState)(`all`),[Ve,P]=(0,h.useState)(1),[Ue,We]=(0,h.useState)(null),[Ge,Ke]=(0,h.useState)(null),F=(0,h.useMemo)(()=>x.find(e=>e.value===s)??ke,[s]),qe=(0,h.useMemo)(()=>Fe(u),[u]),I=(0,h.useMemo)(()=>f?Ee(f,F.granularity):null,[f,F.granularity]),L=be(i||null,o||null),R=ve(i||null,{kind:`all`,sourceId:o||void 0,sinceMinutes:s,limit:F.fetchLimit,granularity:F.granularity}),Je=qe!==`all`||I!==null,Ye=ve(i||null,{kind:qe,sourceId:o||void 0,sinceMinutes:s,range:I??void 0,limit:I?Ae:F.fetchLimit,granularity:F.granularity},{enabled:Je}),z=Je?Ye:R,B=ye(i||null,o||null),V=L.data,H=z.data?.events??[],U=R.data?.totals,W=z.data?.eventRows,Xe=z.isLoading,G=z.isError?z.error:null,K=(0,h.useMemo)(()=>H.filter(e=>{switch(e.kind){case d.crawler:return u.has(`crawler`);case d[`ai-user-fetch`]:return u.has(`ai-user-fetch`);case d[`ai-referral`]:return u.has(`ai-referral`)}}),[H,u]),Ze=(0,h.useMemo)(()=>{let e=new Set;for(let t of H)e.add(Te(t));return _&&e.add(_),[...e].sort((e,t)=>e.localeCompare(t))},[H,_]),Qe=(0,h.useMemo)(()=>{let e=new Set;for(let t of H)e.add(t.operator);return y&&e.add(y),[...e].sort((e,t)=>e.localeCompare(t))},[H,y]),q=(0,h.useMemo)(()=>De(K,{selectedBucket:null,identity:_,operator:y,pathQuery:w,statusClass:D,verification:M},F.granularity),[K,_,y,w,D,M,F.granularity]);(0,h.useEffect)(()=>{P(1)},[K,f,_,y,w,D,M]);let J=Math.max(1,Math.ceil(q.length/S)),Y=Math.min(Math.max(1,Ve),J),X=(Y-1)*S,$e=(0,h.useMemo)(()=>q.slice(X,X+S),[q,X]),et=q.length>S,tt=q.length===0?0:X+1,nt=Math.min(X+S,q.length),Z=(0,h.useMemo)(()=>f?Re(f,F.granularity):null,[f,F.granularity]),Q=(0,h.useMemo)(()=>ze(R.data?.series.points??[],F.granularity),[R.data?.series.points,F.granularity]),$=e=>{fe(t=>{let n=new Set(t);return n.has(e)?n.size>1&&n.delete(e):n.add(e),n})},rt=e=>{let t=Oe(e,Q);t&&g(e=>e===t?null:t)},it=()=>{g(null),v(``),C(``),E(``),O(`all`),N(`all`)},at=!!(f||_||y||w.trim()||D!==`all`||M!==`all`),ot=async()=>{We(null),Ke(null);try{let e=await B.mutateAsync({sinceMinutes:60});Ke(Ie(e))}catch(e){We(_e(e))}};return!i||!o?(0,b.jsx)(`div`,{className:`page-container`,children:(0,b.jsx)(`p`,{className:`text-copy-14 text-muted`,children:`Missing project name or source id in URL.`})}):L.isLoading?(0,b.jsx)(`div`,{className:`page-container`,children:(0,b.jsx)(`p`,{className:`text-copy-14 text-muted`,children:`Loading source…`})}):L.isError||!V?(0,b.jsxs)(`div`,{className:`page-container`,children:[(0,b.jsx)(`p`,{className:`text-copy-14 text-negative`,children:`Could not load this source.`}),(0,b.jsx)(Le,{canGoBack:a,className:`mt-2 text-label-12 text-secondary hover:text-strong`})]}):(0,b.jsxs)(`div`,{className:`page-container space-y-8`,children:[(0,b.jsxs)(`div`,{className:`page-header`,children:[(0,b.jsxs)(`div`,{className:`page-header-left`,children:[(0,b.jsx)(Le,{canGoBack:a,className:`text-label-12 text-muted hover:text-strong`}),(0,b.jsx)(`h1`,{className:`page-title mt-2`,children:V.displayName}),(0,b.jsxs)(`p`,{className:`page-subtitle`,children:[V.sourceType,` source for `,i]})]}),(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(de,{tone:xe(V.status),children:V.status}),!le()&&(0,b.jsxs)(ue,{type:`button`,variant:`outline`,size:`sm`,disabled:B.isPending,onClick:()=>void ot(),children:[(0,b.jsx)(r,{className:`size-3.5 ${B.isPending?`animate-spin`:``}`}),B.isPending?`Syncing…`:`Sync now`]})]})]}),Ue?(0,b.jsx)(`div`,{className:`rounded-md border border-negative-800/50 bg-negative-950/30 px-3 py-2 text-label-14 text-negative-200`,children:Ue}):null,Ge?(0,b.jsx)(`div`,{className:`rounded-md border border-positive-800/50 bg-positive-950/30 px-3 py-2 text-label-14 text-positive-200`,children:Ge}):null,(0,b.jsxs)(`section`,{"aria-labelledby":`traffic-24h-heading`,children:[(0,b.jsx)(`h2`,{id:`traffic-24h-heading`,className:`mb-3 text-heading-14 text-heading`,children:`Last 24 hours`}),(0,b.jsxs)(`div`,{className:`grid grid-cols-1 divide-y divide-default border-y border-default sm:grid-cols-3 sm:divide-x sm:divide-y-0`,children:[(0,b.jsx)(j,{label:`Content crawls`,value:V.totals24h.crawlerContentHits,tooltip:`Content and document paths only. Excludes sitemap ${V.totals24h.crawlerSegments.sitemap.toLocaleString(`en-US`)}, robots ${V.totals24h.crawlerSegments.robots.toLocaleString(`en-US`)}, assets ${V.totals24h.crawlerSegments.asset.toLocaleString(`en-US`)}, and ${V.totals24h.crawlerSegments.other.toLocaleString(`en-US`)} other requests such as feeds, API paths, or downloads. Total crawler hits: ${V.totals24h.crawlerHits.toLocaleString(`en-US`)}.`}),(0,b.jsx)(j,{label:`AI user fetches`,value:V.totals24h.aiUserFetchHits,tooltip:`Requests from AI assistants fetching a page for a person (ChatGPT-User, Claude-User, Perplexity-User and others). ${Se(V.totals24h.aiUserFetchLikelyFakeHits)}`}),(0,b.jsx)(j,{label:`AI referral sessions`,value:V.totals24h.aiReferralLandedHits,tooltip:`Browser click-throughs from AI surfaces, identified by Referer or UTM evidence. Excludes ${V.totals24h.aiReferralRedirectedHits.toLocaleString(`en-US`)} request(s) answered with a redirect: a hop is not an arrival. Total including hops: ${V.totals24h.aiReferralHits.toLocaleString(`en-US`)}.`})]})]}),(0,b.jsxs)(`section`,{children:[(0,b.jsx)(`p`,{className:`eyebrow mb-4`,children:`Latest sync run`}),V.latestRun?(0,b.jsxs)(m,{className:`p-4 text-label-14`,children:[(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-6 gap-y-1.5`,children:[(0,b.jsxs)(`span`,{className:`text-heading`,children:[`Status: `,(0,b.jsx)(`span`,{className:`text-label-14-strong`,children:V.latestRun.status})]}),(0,b.jsxs)(`span`,{className:`text-muted`,children:[`Started: `,T(V.latestRun.startedAt)]}),V.latestRun.finishedAt?(0,b.jsxs)(`span`,{className:`text-muted`,children:[`Finished: `,T(V.latestRun.finishedAt)]}):null]}),(0,b.jsxs)(`details`,{className:`mt-3`,children:[(0,b.jsx)(`summary`,{className:`cursor-pointer text-label-14 text-secondary hover:text-strong`,children:`Run details`}),(0,b.jsx)(`code`,{className:`mt-2 block text-label-12 text-muted`,children:V.latestRun.runId})]}),V.latestRun.error?(0,b.jsx)(`p`,{className:`mt-2 rounded border border-negative-900/40 bg-negative-950/30 px-3 py-2 text-copy-13 text-negative`,children:V.latestRun.error}):null]}):(0,b.jsx)(m,{className:`px-4 py-3 text-label-14 text-muted`,children:le()?`No traffic-sync runs recorded yet.`:`No traffic-sync runs recorded yet. Hit "Sync now" above to create one.`})]}),(0,b.jsxs)(`section`,{children:[(0,b.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-end justify-between gap-x-4 gap-y-3`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`p`,{className:`text-label-12-strong normal-case text-muted`,children:`Events`}),(0,b.jsx)(`h2`,{className:`mt-1 text-heading-16 text-primary`,children:F.granularity===`day`?`Daily rollups`:`Hourly rollups`}),U?(0,b.jsxs)(`p`,{className:`mt-1.5 text-copy-13 text-muted`,children:[U.crawlerContentHits.toLocaleString(`en-US`),` content crawls ·`,` `,U.crawlerInfraHits.toLocaleString(`en-US`),` infra (sitemap/robots/assets) ·`,` `,U.aiUserFetchHits.toLocaleString(`en-US`),` AI user fetches ·`,` `,U.aiReferralLandedHits.toLocaleString(`en-US`),` AI referral sessions · last `,F.label,` · `,Pe]}):null]}),(0,b.jsx)(`div`,{className:`inline-flex rounded-md border border-base p-0.5`,role:`toolbar`,"aria-label":`Window`,children:x.map(e=>(0,b.jsx)(`button`,{type:`button`,className:`rounded px-2.5 py-1 text-button-14 ${s===e.value?`bg-bg-elevated text-heading`:`text-secondary hover:text-strong`}`,"aria-pressed":s===e.value,onClick:()=>{ne(e.value),g(null)},children:e.label},e.value))})]}),(0,b.jsxs)(m,{className:`p-4`,children:[(0,b.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center gap-2`,role:`toolbar`,"aria-label":`Series`,children:[(0,b.jsx)(A,{label:`Crawler`,color:je,count:U?.crawlerHits??0,active:u.has(`crawler`),onToggle:()=>$(`crawler`)}),(0,b.jsx)(A,{label:`AI user fetches`,color:Me,count:U?.aiUserFetchHits??0,active:u.has(`ai-user-fetch`),onToggle:()=>$(`ai-user-fetch`)}),(0,b.jsx)(A,{label:`AI referral sessions`,color:Ne,count:U?.aiReferralLandedHits??0,active:u.has(`ai-referral`),onToggle:()=>$(`ai-referral`)})]}),R.isError?(0,b.jsxs)(`p`,{className:`py-12 text-center text-copy-13 text-negative-400`,children:[`Failed to load events: `,R.error instanceof Error?R.error.message:`Unknown error`]}):R.isLoading?(0,b.jsx)(`p`,{className:`py-12 text-center text-copy-13 text-muted`,children:`Loading events…`}):Q.length===0?(0,b.jsx)(`p`,{className:`py-12 text-center text-copy-13 text-muted`,children:`No events in this window.`}):(0,b.jsx)(`div`,{className:`h-72`,children:(0,b.jsx)(ie,{children:(0,b.jsxs)(oe,{data:Q,margin:{top:4,right:4,bottom:0,left:0},onClick:rt,style:{cursor:`pointer`},children:[(0,b.jsx)(re,{stroke:me,strokeDasharray:`3 3`}),(0,b.jsx)(ae,{dataKey:`label`,tick:pe,stroke:ge,interval:`preserveStartEnd`,minTickGap:F.granularity===`day`?24:32}),(0,b.jsx)(ce,{tick:pe,stroke:ge,allowDecimals:!1}),(0,b.jsx)(se,{...he}),u.has(`crawler`)?(0,b.jsx)(c,{dataKey:`crawler`,name:`Crawler`,fill:je,stackId:`a`,children:Q.map(e=>(0,b.jsx)(l,{fillOpacity:f&&f!==e.bucket?.25:1},e.bucket))}):null,u.has(`ai-user-fetch`)?(0,b.jsx)(c,{dataKey:`aiUserFetch`,name:`AI user fetch`,fill:Me,stackId:`a`,children:Q.map(e=>(0,b.jsx)(l,{fillOpacity:f&&f!==e.bucket?.25:1},e.bucket))}):null,u.has(`ai-referral`)?(0,b.jsx)(c,{dataKey:`aiReferral`,name:`AI referral`,fill:Ne,stackId:`a`,children:Q.map(e=>(0,b.jsx)(l,{fillOpacity:f&&f!==e.bucket?.25:1},e.bucket))}):null]})})})]})]}),(0,b.jsxs)(`section`,{children:[(0,b.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-end justify-between gap-x-4 gap-y-2`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`p`,{className:`text-label-12-strong normal-case text-muted`,children:`Event rows`}),(0,b.jsxs)(`p`,{className:`mt-1 text-copy-13 text-muted`,children:[Xe?`Loading…`:(0,b.jsxs)(b.Fragment,{children:[`Showing `,(0,b.jsx)(`span`,{className:`tabular-nums text-neutral`,children:q.length.toLocaleString(`en-US`)}),` of`,` `,(0,b.jsx)(`span`,{className:`tabular-nums text-muted`,children:K.length.toLocaleString(`en-US`)}),` `,W?.truncated?`loaded events`:`events`,W?.truncated?(0,b.jsxs)(b.Fragment,{children:[` `,`· loaded `,(0,b.jsx)(`span`,{className:`tabular-nums text-neutral`,children:W.returned.toLocaleString(`en-US`)}),` of`,` `,(0,b.jsx)(`span`,{className:`tabular-nums text-muted`,children:W.total.toLocaleString(`en-US`)}),` rows`]}):null]}),` `,`· `,Pe]})]}),(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,b.jsxs)(`span`,{className:`inline-flex items-center text-secondary`,children:[(0,b.jsxs)(`select`,{"aria-label":`Filter by identity`,value:_,onChange:e=>v(e.target.value),className:`rounded-md border border-base bg-bg px-2.5 py-1.5 text-label-12 text-strong focus:outline-none focus-visible:ring-1 focus-visible:ring-mono-600`,children:[(0,b.jsx)(`option`,{value:``,children:`All identities`}),Ze.map(e=>(0,b.jsx)(`option`,{value:e,children:e},e))]}),(0,b.jsx)(p,{text:`The specific bot or AI product making the request (e.g., GPTBot, ChatGPT-User, Perplexity). One operator usually runs several identities.`})]}),(0,b.jsxs)(`span`,{className:`inline-flex items-center text-secondary`,children:[(0,b.jsxs)(`select`,{"aria-label":`Filter by operator`,value:y,onChange:e=>C(e.target.value),className:`rounded-md border border-base bg-bg px-2.5 py-1.5 text-label-12 text-strong focus:outline-none focus-visible:ring-1 focus-visible:ring-mono-600`,children:[(0,b.jsx)(`option`,{value:``,children:`All operators`}),Qe.map(e=>(0,b.jsx)(`option`,{value:e,children:e},e))]}),(0,b.jsx)(p,{text:`The company that runs the bot or product (e.g., OpenAI, Anthropic, Perplexity). Filtering by operator includes every identity under that company.`})]}),(0,b.jsx)(`select`,{"aria-label":`Filter by HTTP status class`,value:D,onChange:e=>O(e.target.value),className:`rounded-md border border-base bg-bg px-2.5 py-1.5 text-label-12 text-strong focus:outline-none focus-visible:ring-1 focus-visible:ring-mono-600`,children:Ce.map(e=>(0,b.jsx)(`option`,{value:e.value,children:e.label},e.value))}),(0,b.jsx)(`select`,{"aria-label":`Filter by verification claim`,value:M,onChange:e=>N(e.target.value),className:`rounded-md border border-base bg-bg px-2.5 py-1.5 text-label-12 text-strong focus:outline-none focus-visible:ring-1 focus-visible:ring-mono-600`,children:we.map(e=>(0,b.jsx)(`option`,{value:e.value,children:e.label},e.value))}),(0,b.jsx)(`input`,{type:`search`,"aria-label":`Filter by path`,placeholder:`path contains…`,value:w,onChange:e=>E(e.target.value),className:`w-44 rounded-md border border-base bg-bg px-2.5 py-1.5 text-label-12 text-strong placeholder:text-faint focus:outline-none focus-visible:ring-1 focus-visible:ring-mono-600`})]})]}),at?(0,b.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center gap-2`,children:[Z?(0,b.jsx)(k,{label:`Bucket: ${Z}`,onClear:()=>g(null)}):null,_?(0,b.jsx)(k,{label:`Identity: ${_}`,onClear:()=>v(``)}):null,y?(0,b.jsx)(k,{label:`Operator: ${y}`,onClear:()=>C(``)}):null,w.trim()?(0,b.jsx)(k,{label:`Path: ${w.trim()}`,onClear:()=>E(``)}):null,D===`all`?null:(0,b.jsx)(k,{label:`Status: ${D}`,onClear:()=>O(`all`)}),M===`all`?null:(0,b.jsx)(k,{label:`Claim: ${Be(M)}`,onClear:()=>N(`all`)}),(0,b.jsx)(`button`,{type:`button`,onClick:it,className:`text-button-14 text-muted underline-offset-4 hover:text-strong hover:underline`,children:`Clear all`})]}):null,G?(0,b.jsxs)(`p`,{className:`py-8 text-center text-copy-13 text-negative-400`,children:[`Failed to load event rows: `,G instanceof Error?G.message:`Unknown error`]}):Xe?(0,b.jsx)(`p`,{className:`py-8 text-center text-copy-13 text-muted`,children:Z?`Loading rows for ${Z}…`:`Loading event rows…`}):(0,b.jsx)(He,{events:$e,truncated:W?.truncated??!1}),et?(0,b.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center justify-between gap-x-4 gap-y-2 text-label-12 text-secondary`,children:[(0,b.jsxs)(`p`,{className:`tabular-nums`,children:[`Showing `,(0,b.jsx)(`span`,{className:`text-neutral`,children:tt.toLocaleString(`en-US`)}),`–`,(0,b.jsx)(`span`,{className:`text-neutral`,children:nt.toLocaleString(`en-US`)}),` of`,` `,(0,b.jsx)(`span`,{className:`text-neutral`,children:q.length.toLocaleString(`en-US`)}),` events`]}),(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsxs)(`button`,{type:`button`,onClick:()=>P(e=>Math.max(1,e-1)),disabled:Y<=1,"aria-label":`Previous page`,className:`inline-flex items-center gap-1 rounded-md border border-base bg-bg px-2.5 py-1.5 text-strong transition hover:border-strong hover:text-primary disabled:cursor-not-allowed disabled:opacity-40 disabled:hover:border-base disabled:hover:text-strong`,children:[(0,b.jsx)(t,{className:`size-3.5`}),`Prev`]}),(0,b.jsxs)(`span`,{className:`tabular-nums`,children:[`Page `,(0,b.jsx)(`span`,{className:`text-strong`,children:Y}),` of`,` `,(0,b.jsx)(`span`,{className:`text-strong`,children:J})]}),(0,b.jsxs)(`button`,{type:`button`,onClick:()=>P(e=>Math.min(J,e+1)),disabled:Y>=J,"aria-label":`Next page`,className:`inline-flex items-center gap-1 rounded-md border border-base bg-bg px-2.5 py-1.5 text-strong transition hover:border-strong hover:text-primary disabled:cursor-not-allowed disabled:opacity-40 disabled:hover:border-base disabled:hover:text-strong`,children:[`Next`,(0,b.jsx)(n,{className:`size-3.5`})]})]})]}):null]}),(0,b.jsxs)(`details`,{className:`border-t border-default pt-4`,children:[(0,b.jsx)(`summary`,{className:`cursor-pointer text-label-14 text-secondary hover:text-strong`,children:`How traffic is classified`}),(0,b.jsx)(`p`,{className:`mt-2 max-w-3xl text-copy-14 text-secondary`,children:`Crawler requests, AI user fetches, and referrals are recorded separately. Filters expose the underlying evidence.`})]})]})}function Re(e,t){return t===`day`?w(e):C(e)}function ze(e,t){return e.map(e=>({bucket:e.bucket,label:Re(e.bucket,t),crawler:e.crawlerHits,aiUserFetch:e.aiUserFetchHits,aiReferral:e.aiReferralLandedHits}))}function Be(e){return we.find(t=>t.value===e)?.label??e}function k({label:e,onClear:t}){return(0,b.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 rounded border border-strong bg-surface-inset px-2.5 py-1 text-label-14 text-strong`,children:[e,(0,b.jsx)(`button`,{type:`button`,onClick:t,"aria-label":`Clear ${e}`,className:`rounded p-0.5 text-secondary hover:bg-mono-700/60 hover:text-heading`,children:(0,b.jsx)(a,{className:`size-3`})})]})}function A({label:e,color:t,count:n,active:r,onToggle:i}){return(0,b.jsxs)(`button`,{type:`button`,onClick:i,"aria-pressed":r,className:`inline-flex items-center gap-2 rounded border px-3 py-1.5 text-button-14 transition ${r?`border-strong bg-surface-inset text-heading`:`border-base bg-transparent text-muted hover:text-neutral`}`,children:[(0,b.jsx)(`span`,{"aria-hidden":`true`,className:`flex size-3 items-center justify-center rounded-sm border transition-opacity ${r?`border-transparent opacity-100`:`border-strong opacity-60`}`,style:r?{backgroundColor:t}:void 0,children:r?`✓`:``}),(0,b.jsx)(`span`,{children:e}),(0,b.jsx)(`span`,{className:`tabular-nums ${r?`text-secondary`:`text-faint`}`,children:n.toLocaleString(`en-US`)})]})}function j({label:e,value:t,tooltip:n}){return(0,b.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,b.jsxs)(`p`,{className:`flex items-center gap-1 text-copy-14 text-secondary`,children:[e,n?(0,b.jsx)(p,{text:n}):null]}),(0,b.jsx)(`p`,{className:`mt-1 text-copy-24-strong tabular-nums text-heading`,children:t.toLocaleString(`en-US`)})]})}function M(e){switch(e){case d.crawler:return`Crawler`;case d[`ai-user-fetch`]:return`AI hit`;case d[`ai-referral`]:return`AI referral`}}function N(e){switch(e.kind){case d.crawler:case d[`ai-user-fetch`]:return e.botId;case d[`ai-referral`]:return e.product}}function Ve(e){switch(e.kind){case d.crawler:case d[`ai-user-fetch`]:return`${e.verificationStatus} · HTTP ${e.status}`;case d[`ai-referral`]:return`${e.evidenceType} · ${e.sourceDomain}`}}function He({events:e,truncated:t=!1}){return e.length===0?(0,b.jsx)(m,{className:`p-6 text-center text-label-14 text-muted`,children:t?`No matches in the rows loaded so far. More rows exist beyond the load limit, so narrow the time window to search them.`:`No event rows match the current filters.`}):(0,b.jsx)(`div`,{className:`material-base overflow-hidden`,children:(0,b.jsxs)(`table`,{className:`w-full text-label-14`,children:[(0,b.jsx)(`thead`,{className:`bg-bg-elevated/50 text-label-12-strong normal-case text-muted`,children:(0,b.jsxs)(`tr`,{children:[(0,b.jsx)(`th`,{className:`px-4 py-2 text-left`,children:`Hour`}),(0,b.jsx)(`th`,{className:`px-4 py-2 text-left`,children:`Kind`}),(0,b.jsx)(`th`,{className:`px-4 py-2 text-left`,children:`Identity`}),(0,b.jsx)(`th`,{className:`px-4 py-2 text-left`,children:`Evidence / status`}),(0,b.jsx)(`th`,{className:`px-4 py-2 text-left`,children:`Path`}),(0,b.jsx)(`th`,{className:`px-4 py-2 text-right`,children:(0,b.jsxs)(`span`,{className:`inline-flex items-center`,children:[`Hits`,(0,b.jsx)(p,{text:`Each row is one hour-bucket, not one request. Hits is the number of requests in that hour that shared the same identity, path, HTTP status, and verification claim.`})]})})]})}),(0,b.jsx)(`tbody`,{className:`divide-y divide-mono-800/60`,children:e.map((e,t)=>(0,b.jsxs)(`tr`,{className:`hover:bg-bg-elevated/40 transition-colors`,children:[(0,b.jsx)(`td`,{className:`px-4 py-2 text-label-12-mono text-neutral`,children:C(e.tsHour)}),(0,b.jsx)(`td`,{className:`px-4 py-2 text-neutral`,children:M(e.kind)}),(0,b.jsxs)(`td`,{className:`px-4 py-2 text-heading`,children:[N(e),(0,b.jsx)(`span`,{className:`ml-2 text-label-12 text-muted`,children:e.operator})]}),(0,b.jsx)(`td`,{className:`px-4 py-2 text-neutral`,children:Ve(e)}),(0,b.jsx)(`td`,{className:`px-4 py-2 truncate text-label-12-mono text-neutral`,children:_(e)}),(0,b.jsx)(`td`,{className:`px-4 py-2 text-right tabular-nums text-heading`,children:e.hits})]},`${e.kind}:${e.tsHour}:${t}`))})]})})}export{D as BROWSER_AGENT_NON_PAGE_LABEL,He as EventsTable,j as TrafficKpi,O as TrafficSourceDetailPage,Fe as trafficFetchKind,Ie as trafficSyncSummary};
|