galley-cms 0.1.0 → 0.1.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/README.md +3 -3
- package/dist/galley.mjs +887 -425
- package/dist/starters/astro-editorial/README.md +3 -11
- package/dist/starters/astro-editorial/src/galley/catalog-data.js +1 -1
- package/dist/starters/astro-editorial/src/galley/catalog.js +1 -1
- package/dist/starters/astro-editorial/src/galley/client/attribution.js +1 -1
- package/dist/starters/astro-editorial/src/galley/client/forms.js +2 -2
- package/dist/starters/astro-editorial/src/galley/client/providers/frame-post.js +1 -1
- package/dist/starters/astro-editorial/src/galley/client/providers/galley.js +1 -1
- package/dist/starters/astro-editorial/src/galley/client/providers/hubspot.js +1 -1
- package/dist/starters/astro-editorial/src/galley/client/providers/mailto.js +1 -1
- package/dist/starters/astro-editorial/src/galley/client/providers/marketo.js +1 -1
- package/dist/starters/astro-editorial/src/galley/client/providers/pardot.js +1 -1
- package/dist/starters/astro-editorial/src/galley/client/providers/salesforce.js +1 -1
- package/dist/starters/astro-editorial/src/galley/client/providers/webhook.js +1 -1
- package/dist/starters/astro-editorial/src/galley/client/registry.js +1 -1
- package/dist/starters/astro-editorial/src/galley/client/types.d.ts +1 -1
- package/dist/starters/astro-editorial/src/galley/components/ConsentBanner.astro +1 -1
- package/dist/starters/astro-editorial/src/galley/components/Form.astro +1 -1
- package/dist/starters/astro-editorial/src/galley/components/Scripts.astro +1 -1
- package/dist/starters/astro-editorial/src/galley/components/index.js +1 -1
- package/dist/starters/astro-editorial/src/galley/forms/forms.css +1 -1
- package/dist/starters/astro-editorial/src/galley/forms/free-email-domains.js +1 -1
- package/dist/starters/astro-editorial/src/galley/forms/logic.js +1 -1
- package/dist/starters/astro-editorial/src/galley/forms/messages.js +1 -1
- package/dist/starters/astro-editorial/src/galley/forms/render.js +1 -1
- package/dist/starters/astro-editorial/src/galley/integration.js +1 -1
- package/dist/starters/astro-editorial/src/galley/kit.d.ts +1 -1
- package/dist/starters/astro-editorial/src/galley/mailto/config.js +1 -1
- package/dist/starters/astro-editorial/src/galley/mailto/runtime.gen.js +1 -1
- package/dist/starters/astro-editorial/src/galley/runtime/site-config.js +1 -1
- package/dist/starters/astro-editorial/src/galley/schema.js +1 -1
- package/dist/starters/astro-editorial/src/galley/scripts/banner.js +1 -1
- package/dist/starters/astro-editorial/src/galley/scripts/plan.js +1 -1
- package/dist/starters/astro-editorial/src/galley/scripts/runtime.gen.js +1 -1
- package/dist/starters/astro-editorial/src/galley/scripts/snippets.js +1 -1
- package/dist/starters/astro-editorial/src/galley/shared/glob.js +1 -1
- package/dist/starters/astro-editorial/src/galley/shared/markdown.js +1 -1
- package/dist/starters/astro-editorial/src/galley/visibility/config.js +1 -1
- package/dist/starters/astro-editorial/src/galley/visibility/content.js +1 -1
- package/dist/starters/astro-editorial/src/galley/visibility/crawlers.js +1 -1
- package/dist/starters/astro-editorial/src/galley/visibility/html.js +1 -1
- package/dist/starters/astro-editorial/src/galley/visibility/integration.js +1 -1
- package/dist/starters/astro-editorial/src/galley/visibility/markdown.js +1 -1
- package/dist/starters/astro-editorial/src/galley/visibility/page.js +1 -1
- package/dist/starters/astro-editorial/src/galley/visibility/site.js +1 -1
- package/dist/starters/astro-editorial/src/galley/visibility/structured.js +1 -1
- package/dist/starters/astro-saas/README.md +5 -7
- package/dist/starters/astro-saas/src/galley/catalog-data.js +1 -1
- package/dist/starters/astro-saas/src/galley/catalog.js +1 -1
- package/dist/starters/astro-saas/src/galley/client/attribution.js +1 -1
- package/dist/starters/astro-saas/src/galley/client/forms.js +2 -2
- package/dist/starters/astro-saas/src/galley/client/providers/frame-post.js +1 -1
- package/dist/starters/astro-saas/src/galley/client/providers/galley.js +1 -1
- package/dist/starters/astro-saas/src/galley/client/providers/hubspot.js +1 -1
- package/dist/starters/astro-saas/src/galley/client/providers/mailto.js +1 -1
- package/dist/starters/astro-saas/src/galley/client/providers/marketo.js +1 -1
- package/dist/starters/astro-saas/src/galley/client/providers/pardot.js +1 -1
- package/dist/starters/astro-saas/src/galley/client/providers/salesforce.js +1 -1
- package/dist/starters/astro-saas/src/galley/client/providers/webhook.js +1 -1
- package/dist/starters/astro-saas/src/galley/client/registry.js +1 -1
- package/dist/starters/astro-saas/src/galley/client/types.d.ts +1 -1
- package/dist/starters/astro-saas/src/galley/components/ConsentBanner.astro +1 -1
- package/dist/starters/astro-saas/src/galley/components/Form.astro +1 -1
- package/dist/starters/astro-saas/src/galley/components/Scripts.astro +1 -1
- package/dist/starters/astro-saas/src/galley/components/index.js +1 -1
- package/dist/starters/astro-saas/src/galley/forms/forms.css +1 -1
- package/dist/starters/astro-saas/src/galley/forms/free-email-domains.js +1 -1
- package/dist/starters/astro-saas/src/galley/forms/logic.js +1 -1
- package/dist/starters/astro-saas/src/galley/forms/messages.js +1 -1
- package/dist/starters/astro-saas/src/galley/forms/render.js +1 -1
- package/dist/starters/astro-saas/src/galley/integration.js +1 -1
- package/dist/starters/astro-saas/src/galley/kit.d.ts +1 -1
- package/dist/starters/astro-saas/src/galley/mailto/config.js +1 -1
- package/dist/starters/astro-saas/src/galley/mailto/runtime.gen.js +1 -1
- package/dist/starters/astro-saas/src/galley/runtime/site-config.js +1 -1
- package/dist/starters/astro-saas/src/galley/schema.js +1 -1
- package/dist/starters/astro-saas/src/galley/scripts/banner.js +1 -1
- package/dist/starters/astro-saas/src/galley/scripts/plan.js +1 -1
- package/dist/starters/astro-saas/src/galley/scripts/runtime.gen.js +1 -1
- package/dist/starters/astro-saas/src/galley/scripts/snippets.js +1 -1
- package/dist/starters/astro-saas/src/galley/shared/glob.js +1 -1
- package/dist/starters/astro-saas/src/galley/shared/markdown.js +1 -1
- package/dist/starters/astro-saas/src/galley/visibility/config.js +1 -1
- package/dist/starters/astro-saas/src/galley/visibility/content.js +1 -1
- package/dist/starters/astro-saas/src/galley/visibility/crawlers.js +1 -1
- package/dist/starters/astro-saas/src/galley/visibility/html.js +1 -1
- package/dist/starters/astro-saas/src/galley/visibility/integration.js +1 -1
- package/dist/starters/astro-saas/src/galley/visibility/markdown.js +1 -1
- package/dist/starters/astro-saas/src/galley/visibility/page.js +1 -1
- package/dist/starters/astro-saas/src/galley/visibility/site.js +1 -1
- package/dist/starters/astro-saas/src/galley/visibility/structured.js +1 -1
- package/dist/starters/astro-starter/README.md +5 -13
- package/dist/starters/astro-starter/src/galley/catalog-data.js +1 -1
- package/dist/starters/astro-starter/src/galley/catalog.js +1 -1
- package/dist/starters/astro-starter/src/galley/client/attribution.js +1 -1
- package/dist/starters/astro-starter/src/galley/client/forms.js +2 -2
- package/dist/starters/astro-starter/src/galley/client/providers/frame-post.js +1 -1
- package/dist/starters/astro-starter/src/galley/client/providers/galley.js +1 -1
- package/dist/starters/astro-starter/src/galley/client/providers/hubspot.js +1 -1
- package/dist/starters/astro-starter/src/galley/client/providers/mailto.js +1 -1
- package/dist/starters/astro-starter/src/galley/client/providers/marketo.js +1 -1
- package/dist/starters/astro-starter/src/galley/client/providers/pardot.js +1 -1
- package/dist/starters/astro-starter/src/galley/client/providers/salesforce.js +1 -1
- package/dist/starters/astro-starter/src/galley/client/providers/webhook.js +1 -1
- package/dist/starters/astro-starter/src/galley/client/registry.js +1 -1
- package/dist/starters/astro-starter/src/galley/client/types.d.ts +1 -1
- package/dist/starters/astro-starter/src/galley/components/ConsentBanner.astro +1 -1
- package/dist/starters/astro-starter/src/galley/components/Form.astro +1 -1
- package/dist/starters/astro-starter/src/galley/components/Scripts.astro +1 -1
- package/dist/starters/astro-starter/src/galley/components/index.js +1 -1
- package/dist/starters/astro-starter/src/galley/forms/forms.css +1 -1
- package/dist/starters/astro-starter/src/galley/forms/free-email-domains.js +1 -1
- package/dist/starters/astro-starter/src/galley/forms/logic.js +1 -1
- package/dist/starters/astro-starter/src/galley/forms/messages.js +1 -1
- package/dist/starters/astro-starter/src/galley/forms/render.js +1 -1
- package/dist/starters/astro-starter/src/galley/integration.js +1 -1
- package/dist/starters/astro-starter/src/galley/kit.d.ts +1 -1
- package/dist/starters/astro-starter/src/galley/mailto/config.js +1 -1
- package/dist/starters/astro-starter/src/galley/mailto/runtime.gen.js +1 -1
- package/dist/starters/astro-starter/src/galley/runtime/site-config.js +1 -1
- package/dist/starters/astro-starter/src/galley/schema.js +1 -1
- package/dist/starters/astro-starter/src/galley/scripts/banner.js +1 -1
- package/dist/starters/astro-starter/src/galley/scripts/plan.js +1 -1
- package/dist/starters/astro-starter/src/galley/scripts/runtime.gen.js +1 -1
- package/dist/starters/astro-starter/src/galley/scripts/snippets.js +1 -1
- package/dist/starters/astro-starter/src/galley/shared/glob.js +1 -1
- package/dist/starters/astro-starter/src/galley/shared/markdown.js +1 -1
- package/dist/starters/astro-starter/src/galley/visibility/config.js +1 -1
- package/dist/starters/astro-starter/src/galley/visibility/content.js +1 -1
- package/dist/starters/astro-starter/src/galley/visibility/crawlers.js +1 -1
- package/dist/starters/astro-starter/src/galley/visibility/html.js +1 -1
- package/dist/starters/astro-starter/src/galley/visibility/integration.js +1 -1
- package/dist/starters/astro-starter/src/galley/visibility/markdown.js +1 -1
- package/dist/starters/astro-starter/src/galley/visibility/page.js +1 -1
- package/dist/starters/astro-starter/src/galley/visibility/site.js +1 -1
- package/dist/starters/astro-starter/src/galley/visibility/structured.js +1 -1
- package/dist/starters/astro-storefront/README.md +3 -1
- package/dist/starters/astro-storefront/src/galley/catalog-data.js +1 -1
- package/dist/starters/astro-storefront/src/galley/catalog.js +1 -1
- package/dist/starters/astro-storefront/src/galley/client/attribution.js +1 -1
- package/dist/starters/astro-storefront/src/galley/client/forms.js +2 -2
- package/dist/starters/astro-storefront/src/galley/client/providers/frame-post.js +1 -1
- package/dist/starters/astro-storefront/src/galley/client/providers/galley.js +1 -1
- package/dist/starters/astro-storefront/src/galley/client/providers/hubspot.js +1 -1
- package/dist/starters/astro-storefront/src/galley/client/providers/mailto.js +1 -1
- package/dist/starters/astro-storefront/src/galley/client/providers/marketo.js +1 -1
- package/dist/starters/astro-storefront/src/galley/client/providers/pardot.js +1 -1
- package/dist/starters/astro-storefront/src/galley/client/providers/salesforce.js +1 -1
- package/dist/starters/astro-storefront/src/galley/client/providers/webhook.js +1 -1
- package/dist/starters/astro-storefront/src/galley/client/registry.js +1 -1
- package/dist/starters/astro-storefront/src/galley/client/types.d.ts +1 -1
- package/dist/starters/astro-storefront/src/galley/components/ConsentBanner.astro +1 -1
- package/dist/starters/astro-storefront/src/galley/components/Form.astro +1 -1
- package/dist/starters/astro-storefront/src/galley/components/Scripts.astro +1 -1
- package/dist/starters/astro-storefront/src/galley/components/index.js +1 -1
- package/dist/starters/astro-storefront/src/galley/forms/forms.css +1 -1
- package/dist/starters/astro-storefront/src/galley/forms/free-email-domains.js +1 -1
- package/dist/starters/astro-storefront/src/galley/forms/logic.js +1 -1
- package/dist/starters/astro-storefront/src/galley/forms/messages.js +1 -1
- package/dist/starters/astro-storefront/src/galley/forms/render.js +1 -1
- package/dist/starters/astro-storefront/src/galley/integration.js +1 -1
- package/dist/starters/astro-storefront/src/galley/kit.d.ts +1 -1
- package/dist/starters/astro-storefront/src/galley/mailto/config.js +1 -1
- package/dist/starters/astro-storefront/src/galley/mailto/runtime.gen.js +1 -1
- package/dist/starters/astro-storefront/src/galley/runtime/site-config.js +1 -1
- package/dist/starters/astro-storefront/src/galley/schema.js +1 -1
- package/dist/starters/astro-storefront/src/galley/scripts/banner.js +1 -1
- package/dist/starters/astro-storefront/src/galley/scripts/plan.js +1 -1
- package/dist/starters/astro-storefront/src/galley/scripts/runtime.gen.js +1 -1
- package/dist/starters/astro-storefront/src/galley/scripts/snippets.js +1 -1
- package/dist/starters/astro-storefront/src/galley/shared/glob.js +1 -1
- package/dist/starters/astro-storefront/src/galley/shared/markdown.js +1 -1
- package/dist/starters/astro-storefront/src/galley/visibility/config.js +1 -1
- package/dist/starters/astro-storefront/src/galley/visibility/content.js +1 -1
- package/dist/starters/astro-storefront/src/galley/visibility/crawlers.js +1 -1
- package/dist/starters/astro-storefront/src/galley/visibility/html.js +1 -1
- package/dist/starters/astro-storefront/src/galley/visibility/integration.js +1 -1
- package/dist/starters/astro-storefront/src/galley/visibility/markdown.js +1 -1
- package/dist/starters/astro-storefront/src/galley/visibility/page.js +1 -1
- package/dist/starters/astro-storefront/src/galley/visibility/site.js +1 -1
- package/dist/starters/astro-storefront/src/galley/visibility/structured.js +1 -1
- package/dist/web/assets/{AppSettingsScreen-D9ZHXus9.js → AppSettingsScreen-C-YJx3gF.js} +1 -1
- package/dist/web/assets/{BodyEditor-DAJ8MM41.js → BodyEditor-8Hp9g0iX.js} +1 -1
- package/dist/web/assets/{CollectionScreen-DVXLw7MF.js → CollectionScreen-Ci_RBTIP.js} +1 -1
- package/dist/web/assets/{EditorScreen-8vhIBZu1.js → EditorScreen-CG30ospj.js} +3 -3
- package/dist/web/assets/{FormsScreen-BbngAAzO.js → FormsScreen-C5Z4-vVZ.js} +2 -2
- package/dist/web/assets/{HistoryScreen-CubZj8QG.js → HistoryScreen-Cz0FyF3N.js} +3 -3
- package/dist/web/assets/InboxScreen-GB8e8oLq.js +2 -0
- package/dist/web/assets/{MediaLibraryPane-jMuqbnLa.js → MediaLibraryPane-D5J9z7rw.js} +1 -1
- package/dist/web/assets/{MediaScreen-mg2CATkP.js → MediaScreen-CoOq4MwF.js} +1 -1
- package/dist/web/assets/{NewSiteScreen-D9zWX6oE.js → NewSiteScreen-B_2094y0.js} +1 -1
- package/dist/web/assets/Online-CS3LLMG4.js +1 -0
- package/dist/web/assets/{PluginsScreen-1qEv-u35.js → PluginsScreen-Cdkv2qWN.js} +1 -1
- package/dist/web/assets/{PreviewPane-a06mELw4.js → PreviewPane-HeTLVD45.js} +1 -1
- package/dist/web/assets/{ProofScreen-CZfFbHFS.js → ProofScreen-BGAsVuYb.js} +1 -1
- package/dist/web/assets/{ProviderSettings-BOiCGeSI.js → ProviderSettings-BtM56M7d.js} +1 -1
- package/dist/web/assets/{PublishDialog-CSKU1lfx.js → PublishDialog-Ctv1sxHs.js} +2 -2
- package/dist/web/assets/{ReachNote-CZYr1oL0.js → ReachNote-BJrBYKWR.js} +1 -1
- package/dist/web/assets/{ScriptsScreen-BXY-kqbq.js → ScriptsScreen-BsYOIXkI.js} +2 -2
- package/dist/web/assets/{SiteHomeScreen-DOrqAteL.js → SiteHomeScreen-C7LLVNdQ.js} +1 -1
- package/dist/web/assets/{SiteSettingsScreen-B8xQnhjd.js → SiteSettingsScreen-DhX8CluW.js} +1 -1
- package/dist/web/assets/{SourceView-B5SoYjUF.js → SourceView-CkX8bKwR.js} +1 -1
- package/dist/web/assets/{VisibilityScreen-B4iOATC4.js → VisibilityScreen-ChOKniqk.js} +1 -1
- package/dist/web/assets/{codemirror-g0T4-Tsm.js → codemirror-ClWBLK2a.js} +1 -1
- package/dist/web/assets/index-CtsAxi5d.js +10 -0
- package/dist/web/assets/{index-Pd8oyXqS.css → index-xTbHx1DQ.css} +1 -1
- package/dist/web/assets/{listPlan-BXud7Oxv.js → listPlan-BPJMzA6e.js} +1 -1
- package/dist/web/assets/{outside-DaBM5h5B.js → outside-Bv1jj3yu.js} +1 -1
- package/dist/web/assets/{paths-C8ESZJVU.js → paths-B6ATG9Kg.js} +1 -1
- package/dist/web/assets/{prefs-BcNyBxxO.js → prefs-D04M07D3.js} +1 -1
- package/dist/web/assets/{scaffold-BHkqc62J.js → scaffold-DrnWBKU9.js} +1 -1
- package/dist/web/assets/{usePlugins-acEOSN5a.js → usePlugins-6k3yRVYT.js} +1 -1
- package/dist/web/index.html +2 -2
- package/package.json +5 -5
- package/dist/web/assets/InboxScreen-Azqy6w4_.js +0 -2
- package/dist/web/assets/Online-bYUu0ETZ.js +0 -1
- package/dist/web/assets/index-Djh-DSIT.js +0 -10
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{$ as e,A as t,At as n,F as r,Ft as i,I as a,N as o,Nt as s,O as c,_ as l,a as u,bt as d,c as f,g as p,gt as m,i as h,j as g,k as _,mt as v,n as y,pt as b,v as x,vt as ee}from"./ui-C6O2tW4c.js";import{A as S,B as C,C as w,D as T,H as E,M as D,N as O,P as k,R as A,S as te,V as ne,b as j,c as re,d as ie,f as ae,h as oe,i as se,j as M,l as ce,n as N,o as le,p as ue,t as de,v as P,y as F,z as I}from"./ProviderSettings-BOiCGeSI.js";import{n as L}from"./chrome-Brnq5kGb.js";import{E as fe,T as R,_ as pe,b as me,g as he,i as ge,n as _e,y as ve}from"./outside-DaBM5h5B.js";import{_ as ye,a as be,i as xe}from"./listPlan-BXud7Oxv.js";import{t as z}from"./site-DJUEXLHW.js";import{A as Se,F as Ce}from"./index-Djh-DSIT.js";var B=i(s(),1);function V(e){return oe.find(t=>t.kind===e)??ae(e)}function H(e){return e.label?.trim()||V(e.kind)?.name||e.kind}function we(e){let t=V(e.kind),n=e.kind===`custom`?M(e.settings.src)?`src`:null:t?.settings.find(e=>e.required)?.key??t?.settings[0]?.key??null;return n&&M(e.settings[n]).trim()||null}function U(e){return e.category===`tag-manager`||e.category===`analytics`?`eager`:e.category===`support`?`interaction`:`idle`}function Te(e,t,n){let r=new Set(n),i=e.kind;for(let t=2;r.has(i);t++)i=`${e.kind}-${t}`;let a={};for(let[e,n]of Object.entries(t))M(n).trim()&&(a[e]=typeof n==`string`?n.trim():n);return{id:i,kind:e.kind,enabled:!0,settings:a,placement:e.defaultPlacement,load:U(e),consent:e.defaultConsent}}var W={eager:{label:`Straight away`,line:`Loads with the page. Needed for tags that must see the first page view.`},idle:{label:`When idle`,line:`Waits until the page has finished loading, so it doesn’t slow the page down.`},interaction:{label:`First interaction`,line:`Waits for the visitor’s first scroll, tap or key press. Best for chat and pop-ups.`}},G={necessary:{label:`Necessary`,line:`Always loads. Only for scripts the site can’t work without, or that keep no record of the visitor.`},analytics:{label:`Analytics`,line:`Measures visits. Loads once the visitor agrees to analytics.`},marketing:{label:`Marketing`,line:`Advertising and follow-up. Loads once the visitor agrees to marketing.`},preferences:{label:`Preferences`,line:`Remembers choices and powers extras like chat. Loads once the visitor agrees to preferences.`}},K={head:`In the page head`,"body-start":`At the start of the page`,"body-end":`At the end of the page`},q={"tag-manager":`Tag managers`,analytics:`Analytics`,advertising:`Advertising`,marketing:`Marketing`,support:`Support and chat`,other:`Other`};function J(e){return e.consent??V(e.kind)?.defaultConsent??`necessary`}function Y(e){return e.load??`eager`}function Ee(e){return{gtm:`GTM`,ga4:`GA`,"meta-pixel":`Me`,"linkedin-insight":`in`,hubspot:`Hs`,"marketo-munchkin":`Mk`,plausible:`Pl`,segment:`Sg`,hotjar:`Hj`,clarity:`Cl`,intercom:`Ic`,custom:`</>`}[e]??e.slice(0,2)}var X=d();function De(e,t){let n=`${e.name} ${e.description} ${q[e.category]}`.toLowerCase();return t.toLowerCase().split(/\s+/).filter(Boolean).every(e=>n.includes(e))}function Oe({open:e,onClose:i,taken:a,allowBuild:o,onAdd:s}){let[u,d]=(0,B.useState)(``),{siteId:f=``}=n(),p=ue(f),[h,_]=(0,B.useState)(null),[v,y]=(0,B.useState)({}),[x,S]=(0,B.useState)(`src`),[C,w]=(0,B.useState)(!1);(0,B.useEffect)(()=>{e&&(d(``),_(null),y({}),S(`src`),w(!1))},[e]);let T=(0,B.useMemo)(()=>{let e=p.scriptIntegrations.filter(e=>De(e,u));return Object.keys(q).map(t=>({category:t,items:e.filter(e=>e.category===t)})).filter(e=>e.items.length>0)},[u,p.scriptIntegrations]),E=h?.kind===`custom`,D=(h?.settings??[]).filter(e=>!E||e.key===x),O=Object.fromEntries(D.map(e=>[e.key,se(E?{...e,required:!0}:e,v[e.key])]).filter(([,e])=>e)),k=h!==null&&Object.keys(O).length===0,A=()=>{if(w(!0),!h||!k)return;let e={};for(let t of D)v[t.key]?.trim()&&(e[t.key]=v[t.key]??``);let t=Te(h,e,a);s(re(h)?ie(t,h,p.nameOf(h.plugin)):t),i()};return(0,X.jsx)(r,{open:e,onClose:i,title:h?`Add ${h.name}`:`Add a script`,description:h?h.description:`Pick what to add. You’ll only be asked for what it needs.`,size:`lg`,footer:h?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(b,{variant:`secondary`,onClick:()=>_(null),children:`Back to the list`}),(0,X.jsxs)(b,{variant:`primary`,onClick:A,disabled:C&&!k,children:[`Add `,h.name]})]}):(0,X.jsx)(b,{variant:`secondary`,onClick:i,children:`Not now`}),children:h?(0,X.jsxs)(`div`,{className:`kit-add`,children:[E?(0,X.jsx)(g,{label:`How it’s added`,group:!0,hint:o?void 0:`Writing code into the page is only offered on sites where build mode is allowed, because it runs with full access to every page.`,children:(0,X.jsx)(l,{label:`How it’s added`,options:[{value:`src`,label:`From an address`},{value:`inline`,label:`Code`,disabled:!o}],value:x,onChange:S})}):null,D.map(e=>{let n=C||v[e.key]?O[e.key]:void 0;return(0,X.jsx)(g,{label:e.label,hint:n?void 0:e.help??(e.placeholder?`Looks like ${e.placeholder}`:void 0),error:n,children:e.key===`inline`?(0,X.jsx)(t,{mono:!0,rows:6,maxRows:16,spellCheck:!1,value:v[e.key]??``,onChange:t=>y({...v,[e.key]:t.target.value})}):(0,X.jsx)(c,{mono:!0,spellCheck:!1,placeholder:e.placeholder,value:v[e.key]??``,onChange:t=>y({...v,[e.key]:t.target.value}),onKeyDown:e=>e.key===`Enter`&&A()})},e.key)}),(0,X.jsxs)(`div`,{className:m(`kit-add__defaults`),children:[(0,X.jsx)(`p`,{className:`g-eyebrow`,children:`Already chosen for you`}),(0,X.jsxs)(`ul`,{children:[(0,X.jsxs)(`li`,{children:[W[U(h)].label,` — `,W[U(h)].line]}),(0,X.jsxs)(`li`,{children:[K[h.defaultPlacement],`.`]}),(0,X.jsxs)(`li`,{children:[`Consent: `,G[h.defaultConsent].label,`. `,G[h.defaultConsent].line]}),(0,X.jsx)(`li`,{children:`Every page. You can limit it to some pages once it’s added.`})]})]})]}):(0,X.jsxs)(`div`,{className:`kit-catalogue`,children:[(0,X.jsx)(c,{"aria-label":`Search scripts`,placeholder:`Search — analytics, chat, ads…`,value:u,onChange:e=>d(e.target.value),"data-autofocus":!0}),T.length===0?(0,X.jsxs)(`p`,{className:`g-hint`,children:[`Nothing matches “`,u,`”. Try a shorter word, or add a custom script.`]}):null,T.map(e=>(0,X.jsxs)(`section`,{className:`kit-catalogue__group`,"aria-label":q[e.category],children:[(0,X.jsx)(`p`,{className:`g-eyebrow`,children:q[e.category]}),(0,X.jsx)(`div`,{className:`kit-catalogue__items`,children:e.items.map(e=>(0,X.jsxs)(`button`,{type:`button`,className:`kit-catalogue__item`,onClick:()=>{_(e),y({}),w(!1)},children:[(0,X.jsx)(N,{text:Ee(e.kind)}),(0,X.jsxs)(`span`,{className:`kit-catalogue__text`,children:[(0,X.jsx)(`span`,{className:`kit-catalogue__name`,children:e.name}),(0,X.jsx)(`span`,{className:`kit-catalogue__description`,children:e.description}),e.plugin===`@galley/builtin`?null:(0,X.jsxs)(`span`,{className:`kit-catalogue__description`,children:[`From the plugin `,p.nameOf(e.plugin)]})]}),(0,X.jsx)(ee,{name:`chevron-right`})]},e.kind))})]},e.category))]})})}var ke=[{value:`none`,label:`Off`},{value:`banner`,label:`Built-in banner`},{value:`external`,label:`Another consent tool`}],Ae={none:`Every switched-on script loads for every visitor, without asking.`,banner:`The site asks visitors first, with a small banner. Scripts wait for the categories they need.`,external:`Your own consent tool asks, and tells the site what visitors agreed to. Scripts wait for it.`},je=[`analytics`,`marketing`,`preferences`],Z={title:`Cookies and tracking`,text:`This site would like to measure visits and the success of its marketing. Choose what it may use. You can change this at any time from the link at the bottom of each page.`,acceptLabel:`Accept all`,rejectLabel:`Reject all`,settingsLabel:`Choose…`};function Me({banner:e,theme:t}){return(0,X.jsxs)(`div`,{className:`kit-banner-frame`,"data-theme":t,children:[(0,X.jsxs)(`div`,{className:`kit-banner`,"aria-hidden":`true`,children:[(0,X.jsx)(`p`,{className:`kit-banner__title`,children:e.title||Z.title}),(0,X.jsxs)(`p`,{className:`kit-banner__text`,children:[e.text||Z.text,` `,e.policyUrl?(0,X.jsx)(`span`,{className:`g-link`,children:`Privacy policy`}):null]}),(0,X.jsxs)(`span`,{className:`kit-banner__buttons`,children:[(0,X.jsx)(`span`,{className:`kit-pv__button`,children:e.acceptLabel||Z.acceptLabel}),(0,X.jsx)(`span`,{className:`kit-pv__button`,children:e.rejectLabel||Z.rejectLabel}),(0,X.jsx)(`span`,{className:`kit-pv__button kit-pv__button--back`,children:e.settingsLabel||Z.settingsLabel})]})]}),(0,X.jsx)(`span`,{className:`kit-banner-frame__label`,children:t===`light`?`Light`:`Dark`})]})}function Ne({config:t,trackingWithoutConsent:n}){let r=j(),i=ne(),a=t.consent,o=a?.mode??`none`,s=new Set(a?.defaults??[]),c=a?.banner??{},u=(e,t)=>{let n=je.filter(n=>n===e?t:s.has(n));r.choose([`consent`,`defaults`],n.length?n:void 0)};return(0,X.jsxs)(`section`,{className:m(`g-block kit-consent`,i.has(`area:consent`)&&`kit-consent--flash`),"aria-labelledby":`consent-title`,children:[(0,X.jsx)(`header`,{className:`g-block__head`,children:(0,X.jsx)(`h2`,{id:`consent-title`,className:`kit-tab-head__title`,children:`Consent`})}),(0,X.jsxs)(`div`,{className:`g-block__body kit-consent__body`,children:[(0,X.jsx)(g,{label:`Ask visitors first`,group:!0,hint:Ae[o],children:(0,X.jsx)(l,{label:`Ask visitors first`,options:ke,value:o,onChange:e=>r.choose([`consent`,`mode`],e)})}),n?(0,X.jsxs)(`p`,{className:`g-margin-note kit-note kit-note--warning`,role:`status`,children:[(0,X.jsx)(e,{kind:`bang`}),(0,X.jsx)(`span`,{children:`Analytics or marketing scripts are switched on with consent off. In many countries visitors must agree before these load.`})]}):null,o===`banner`?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`kit-consent__texts`,children:[(0,X.jsx)(P,{path:[`consent`,`banner`,`title`],label:`Title`,placeholder:Z.title}),(0,X.jsx)(P,{path:[`consent`,`banner`,`text`],label:`Text`,placeholder:Z.text,multiline:!0}),(0,X.jsxs)(`div`,{className:`app-form-row`,children:[(0,X.jsx)(P,{path:[`consent`,`banner`,`acceptLabel`],label:`Accept button`,placeholder:Z.acceptLabel}),(0,X.jsx)(P,{path:[`consent`,`banner`,`rejectLabel`],label:`Refuse button`,placeholder:Z.rejectLabel})]}),(0,X.jsxs)(`div`,{className:`app-form-row`,children:[(0,X.jsx)(P,{path:[`consent`,`banner`,`settingsLabel`],label:`Choices button`,placeholder:Z.settingsLabel}),(0,X.jsx)(P,{path:[`consent`,`banner`,`policyUrl`],label:`Privacy policy page`,mono:!0,placeholder:`/privacy/`})]})]}),(0,X.jsxs)(`div`,{className:`kit-consent__previews`,"aria-label":`Banner preview`,children:[(0,X.jsx)(Me,{banner:c,theme:`light`}),(0,X.jsx)(Me,{banner:c,theme:`dark`})]})]}):null,o===`none`?null:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(g,{label:`On before the visitor chooses`,group:!0,hint:`Necessary scripts always load. Leave these off where the law asks for agreement first.`,children:(0,X.jsx)(`div`,{className:`kit-checks`,children:je.map(e=>(0,X.jsx)(h,{label:G[e].label,description:G[e].line,checked:s.has(e),onChange:t=>u(e,t)},e))})}),(0,X.jsx)(F,{path:[`consent`,`googleConsentMode`],label:`Tell Google tags about consent (Consent Mode)`,description:`Google Analytics and Tag Manager are told what visitors agreed to, so they can adjust what they record.`})]})]})]})}function Pe(e){let t=[],n=new Map;e.scripts.forEach((e,t)=>n.set(e.id,[...n.get(e.id)??[],t]));for(let[e,r]of n)e&&r.length>1&&t.push({id:`id-${e}`,tone:`warning`,text:`${r.length} scripts use the name “${e}”. Give each its own, so changes and page rules apply to the right one.`,scripts:r});let r=new Map;e.scripts.forEach((e,t)=>{if(!e.enabled)return;let n=we(e);if(!n)return;let i=`${e.kind}\n${n}`;r.set(i,[...r.get(i)??[],t])});for(let[n,i]of r){if(i.length<2)continue;let r=e.scripts[i[0]],a=n.split(`
|
|
2
|
-
`)[1]??``;t.push({id:`tag-${n}`,tone:`warning`,text:`${r?H(r):`This script`} is installed ${i.length} times with ${a}. Visits would be counted more than once — switch one off.`,scripts:i})}let i=e.scripts.flatMap((e,t)=>e.enabled&&e.kind===`ga4`?[t]:[]),a=e.scripts.flatMap((e,t)=>e.enabled&&e.kind===`gtm`?[t]:[]);if(i.length>0&&a.length>0&&t.push({id:`ga4-in-gtm`,tone:`info`,text:`Google Analytics is often set up inside the Tag Manager container too. If yours is, page views are counted twice — keep it in one place.`,scripts:[...i,...a]}),(e.consent?.mode??`none`)===`none`){let n=e.scripts.flatMap((e,t)=>{let n=J(e);return e.enabled&&(n===`analytics`||n===`marketing`)?[t]:[]});n.length>0&&t.push({id:`no-consent`,tone:`warning`,text:`Analytics and marketing scripts load without asking, because consent is off. In many countries visitors must agree before these load.`,scripts:n})}return t}function Q(e){let t=e.trim(),n=/^[a-z][a-z0-9+.-]*:\/\/[^/]*/i.exec(t);return n&&(t=t.slice(n[0].length)),t=t.split(/[?#]/)[0]??``,t.startsWith(`/`)||(t=`/${t}`),t=t.replace(/\/{2,}/g,`/`),t.length>1&&(t=t.replace(/\/+$/,``)),t}function Fe(e){let t=``,n=e.trim();n.startsWith(`/`)||(n=`/${n}`),n=n.replace(/\/+$/,``);for(let e=0;e<n.length;e+=1){let r=n[e];r===`*`&&n[e+1]===`*`?(t.endsWith(`/`)?t=`${t.slice(0,-1)}(?:/.*)?`:t+=`.*`,e+=1):t+=r===`*`?`[^/]*`:r===`?`?`[^/]`:r.replace(/[.+^${}()|[\]\\]/g,`\\$&`)}return RegExp(`^${t}/?$`)}function Ie(e,t){let n=Q(t);return Fe(e).test(n)||e.trim().replace(/\/+$/,``)===``&&n===`/`}function Le(e,t){let n=e.include??[],r=(e.exclude??[]).find(e=>Ie(e,t));if(r)return{loads:!1,because:{list:`exclude`,pattern:r}};if(n.length===0)return{loads:!0};let i=n.find(e=>Ie(e,t));return i?{loads:!0,because:{list:`include`,pattern:i}}:{loads:!1}}function Re(e){return(e.include??[]).length>0?`only`:(e.exclude??[]).length>0?`except`:`everywhere`}function ze(e){let t=Re(e),n=e=>(e??[]).map(e=>e.trim()||`/`).join(`, `);return t===`only`?`Only ${n(e.include)}${(e.exclude??[]).length?`, not ${n(e.exclude)}`:``}`:t===`except`?`Every page except ${n(e.exclude)}`:`Every page`}var Be=[{value:`everywhere`,label:`Every page`},{value:`only`,label:`Only these`},{value:`except`,label:`All except`}];function Ve({entry:e}){let[t,n]=(0,B.useState)(``),r=t.trim()?Le(e,t):null;return(0,X.jsxs)(g,{label:`Try an address`,hint:r?void 0:`Type a page address to see whether this script loads there.`,children:[(0,X.jsx)(c,{mono:!0,size:`sm`,placeholder:`/pricing/teams/`,value:t,onChange:e=>n(e.target.value)}),r?(0,X.jsxs)(`p`,{className:r.loads?`kit-verdict kit-verdict--yes`:`kit-verdict kit-verdict--no`,role:`status`,children:[r.loads?`Loads here`:`Doesn’t load here`,r.because?` — matches ${r.because.pattern}`:r.loads?` — it loads on every page`:` — no pattern matches`]}):null]})}function He({index:e,entry:t}){let n=j(),r=Re(t),[i,a]=(0,B.useState)(null),o=r===`everywhere`&&i?i:r,s=o===`except`?`exclude`:`include`,u=(o===`except`?t.exclude:t.include)??[],d=[`scripts`,e,s],f=r=>{if(a(r),r===o)return;let i=u.filter(e=>e.trim());if(r===`everywhere`){n.apply(...t.include?[{op:`unset`,path:[`scripts`,e,`include`]}]:[],...t.exclude?[{op:`unset`,path:[`scripts`,e,`exclude`]}]:[]);return}if(i.length===0)return;let c=r===`except`?`exclude`:`include`;n.apply({op:`unset`,path:[`scripts`,e,s]},{op:`set`,path:[`scripts`,e,c],value:i})},p=u.length>0?u:o===`everywhere`?[]:[``];return(0,X.jsxs)(`div`,{className:`kit-insp__group`,children:[(0,X.jsx)(g,{label:`Pages`,group:!0,children:(0,X.jsx)(l,{label:`Pages`,options:Be,value:o,onChange:f})}),o===`everywhere`?null:(0,X.jsxs)(g,{label:o===`only`?`Load only on`:`Don’t load on`,group:!0,hint:`A page address per line. * stands for one part of the address (/blog/*), ** for any number (/docs/**).`,children:[(0,X.jsx)(`ul`,{className:`kit-patterns`,children:p.map((e,t)=>(0,X.jsxs)(`li`,{className:`kit-pattern`,children:[(0,X.jsx)(c,{mono:!0,size:`sm`,"aria-label":`Page pattern ${t+1}`,placeholder:`/pricing/*`,value:e,onChange:e=>{let r=e.target.value;u.length===0?n.type(d,r?[r]:void 0):n.type([...d,t],r,!0)},onBlur:e=>{e.target.value.trim()===``&&u.length>0?n.apply(u.length===1?{op:`unset`,path:d}:{op:`remove`,path:d,index:t}):(n.commit(d),n.commit([...d,t]))}}),u.length>0?(0,X.jsx)(v,{icon:`close`,label:`Remove ${e||`pattern`}`,onClick:()=>n.apply(u.length===1?{op:`unset`,path:d}:{op:`remove`,path:d,index:t})}):null]},t))}),u.length>0?(0,X.jsx)(b,{size:`sm`,variant:`secondary`,icon:`plus`,onClick:()=>n.apply({op:`insert`,path:d,index:u.length,value:``}),children:`Add an address`}):null]}),(0,X.jsx)(Ve,{entry:t})]})}var Ue=[`necessary`,`analytics`,`marketing`,`preferences`];function We({index:t,entry:n}){let r=j(),i=I(),a=V(n.kind),o=(...e)=>[`scripts`,t,...e],s=Y(n),c=J(n),u=n.kind===`custom`,d=M(n.settings.inline).trim()!==``,f=(a?.settings??[]).filter(e=>!(u&&e.key===`inline`&&!i));return(0,X.jsxs)(`div`,{className:`kit-script-detail`,children:[(0,X.jsxs)(`div`,{className:`kit-script-detail__col`,children:[(0,X.jsx)(P,{path:o(`label`),label:`Name in this app`,placeholder:a?.name??n.kind}),f.length>0?(0,X.jsx)(de,{path:o(`settings`),specs:f,values:n.settings}):(0,X.jsx)(`p`,{className:`g-hint`,children:`This kind of script isn’t in the catalogue; its settings stay as they are in the file.`}),u&&!i?(0,X.jsxs)(`p`,{className:`g-margin-note kit-note`,children:[(0,X.jsx)(e,{kind:`reg`}),(0,X.jsx)(`span`,{children:d?`This script runs code written into the site. It can only be changed where build mode is allowed.`:`Custom code can only be added on sites where build mode is allowed. A script address works everywhere.`})]}):null,a?.docsUrl?(0,X.jsxs)(`a`,{className:`g-link`,href:a.docsUrl,target:`_blank`,rel:`noreferrer`,children:[`Where to find these in `,a.name]}):null,(0,X.jsx)(P,{path:o(`note`),label:`Note for colleagues`,multiline:!0,placeholder:`Who asked for it and why — “added for the spring campaign, ask before removing”`})]}),(0,X.jsxs)(`div`,{className:`kit-script-detail__col`,children:[(0,X.jsx)(He,{index:t,entry:n}),(0,X.jsx)(g,{label:`When it loads`,group:!0,hint:W[s].line,children:(0,X.jsx)(l,{label:`When it loads`,options:Object.keys(W).map(e=>({value:e,label:W[e].label})),value:s,onChange:e=>r.choose(o(`load`),e)})}),(0,X.jsx)(g,{label:`Consent`,group:!0,hint:G[c].line,children:(0,X.jsx)(l,{label:`Consent`,options:Ue.map(e=>({value:e,label:G[e].label})),value:c,onChange:e=>r.choose(o(`consent`),e)})}),(0,X.jsx)(g,{label:`Where in the page`,children:(0,X.jsx)(_,{value:n.placement??a?.defaultPlacement??`head`,options:Object.keys(K).map(e=>({value:e,label:K[e]})),onChange:e=>r.choose(o(`placement`),e)})}),(0,X.jsx)(F,{path:o(`inPreview`),label:`Also load in preview and development`,description:`Off by default, so your own testing isn’t counted as visits or sent to your ad accounts.`})]})]})}function Ge({index:t}){let n=[`scripts`,t],r=pe(n),i=he(n);return r===0?null:(0,X.jsxs)(`span`,{className:`g-field__state`,children:[(0,X.jsx)(e,{kind:`caret`}),i===`added`?`New`:`Edited`]})}var Ke=(0,B.memo)(function({index:t,total:n,open:r,warned:i,drag:a,onToggle:o,onMove:s,onRemove:c}){let l=me([`scripts`,t]),d=j(),p=ne(),h=(0,B.useRef)(null),g=S(l);if(!g)return null;let _=H(g),y=we(g),b=J(g),x=e=>{if(!e.altKey||e.key!==`ArrowUp`&&e.key!==`ArrowDown`)return;e.preventDefault();let r=t+(e.key===`ArrowUp`?-1:1);r>=0&&r<n&&s(t,r)};return(0,X.jsxs)(`section`,{ref:h,className:m(`g-block kit-script`,!g.enabled&&`kit-script--off`,p.has(`script:${g.id}`)&&`kit-script--flash`,i&&`kit-script--warned`),"aria-label":_,...a.card(t),children:[(0,X.jsxs)(`div`,{className:`kit-script__row`,onKeyDown:x,children:[(0,X.jsx)(`span`,{className:`kit-dest__grip`,"aria-hidden":`true`,title:`Drag to change the order`,...a.grip(t,()=>h.current),children:(0,X.jsx)(fe,{name:`grip`})}),(0,X.jsx)(N,{text:Ee(g.kind)}),(0,X.jsxs)(`button`,{type:`button`,className:`kit-script__open`,"aria-expanded":r,onClick:()=>o(t),"aria-keyshortcuts":`Alt+ArrowUp Alt+ArrowDown`,children:[(0,X.jsx)(e,{kind:`chevron`,className:m(`app-card__chevron`,!r&&`app-card__chevron--closed`)}),(0,X.jsxs)(`span`,{className:`kit-script__titles`,children:[(0,X.jsx)(`span`,{className:`kit-script__name`,children:_}),(0,X.jsx)(`span`,{className:`kit-script__id g-mono`,children:y??(g.kind===`custom`?`Code written into the page`:V(g.kind)?`Not set up yet`:ce(g.kind))})]}),(0,X.jsxs)(`span`,{className:`g-sr`,children:[`, script `,t+1,` of `,n,`. Alt and arrow keys move it.`]})]}),(0,X.jsxs)(`span`,{className:`kit-script__facts`,children:[(0,X.jsx)(`span`,{children:ze(g)}),(0,X.jsx)(`span`,{children:W[Y(g)].label}),(0,X.jsx)(f,{tone:b===`necessary`?`neutral`:`info`,mark:null,children:G[b].label})]}),(0,X.jsx)(Ge,{index:t}),(0,X.jsx)(`span`,{className:`kit-script__switch`,children:(0,X.jsx)(u,{checked:g.enabled,"aria-label":g.enabled?`${_} is on`:`${_} is off`,onChange:e=>d.choose([`scripts`,t,`enabled`],e)})}),(0,X.jsxs)(`span`,{className:`kit-dest__tools`,children:[(0,X.jsx)(R,{icon:`arrow-up`,label:`Move ${_} up`,disabled:t===0,onClick:()=>s(t,t-1)}),(0,X.jsx)(R,{icon:`arrow-down`,label:`Move ${_} down`,disabled:t===n-1,onClick:()=>s(t,t+1)}),(0,X.jsx)(v,{icon:`trash`,label:`Remove ${_}`,onClick:()=>c(t)})]})]}),g.note&&!r?(0,X.jsx)(`p`,{className:`kit-script__note`,children:g.note}):null,r?(0,X.jsx)(`div`,{className:`g-block__body`,children:(0,X.jsx)(We,{index:t,entry:g})}):null]})});function qe(e,t){return e===`necessary`||(t?.mode??`none`)===`none`?!1:!(t?.defaults??[]).includes(e)}function Je(e,t){let n=J(e);return qe(n,t)?`Waits until ${t?.mode===`external`?`your consent tool`:`the visitor`} allows ${n}`:null}function Ye(e,t,n={}){let r=[],i=[];return e.scripts.forEach((a,o)=>{let s=H(a);if(!a.enabled)return void i.push({index:o,name:s,reason:`Switched off`});if(n.preview&&!a.inPreview)return void i.push({index:o,name:s,reason:`Not loaded in preview`});let c=Le(a,t);if(c.loads)r.push({index:o,id:a.id,name:s,load:Y(a),consent:J(a),waitsFor:Je(a,e.consent)});else{let e=c.because?`Not on pages matching ${c.because.pattern}`:`Only on ${(a.include??[]).join(`, `)}`;i.push({index:o,name:s,reason:e})}}),{loads:r,skipped:i}}function Xe({config:e,suggestions:t}){let[n,r]=(0,B.useState)(`/`),i=(0,B.useMemo)(()=>Ye(e,n||`/`),[e,n]),a=Q(n||`/`);return(0,X.jsxs)(`section`,{className:`g-block kit-where`,"aria-labelledby":`where-title`,children:[(0,X.jsx)(`header`,{className:`g-block__head`,children:(0,X.jsx)(`h2`,{id:`where-title`,className:`kit-tab-head__title`,children:`What loads where`})}),(0,X.jsxs)(`div`,{className:`g-block__body`,children:[(0,X.jsx)(g,{label:`Page address`,children:(0,X.jsx)(c,{mono:!0,value:n,onChange:e=>r(e.target.value),placeholder:`/pricing/`})}),t.length?(0,X.jsx)(`div`,{className:`kit-where__chips`,children:t.map(e=>(0,X.jsx)(`button`,{type:`button`,className:`g-chip`,onClick:()=>r(e),"aria-pressed":Q(e)===a,children:e},e))}):null,(0,X.jsxs)(`div`,{role:`status`,"aria-live":`polite`,children:[i.loads.length===0?(0,X.jsxs)(`p`,{className:`g-hint`,children:[`No scripts load on `,a,`.`]}):(0,X.jsx)(`ol`,{className:`kit-where__list`,children:i.loads.map(e=>(0,X.jsxs)(`li`,{className:`kit-where__item`,children:[(0,X.jsx)(`span`,{className:`kit-where__name`,children:e.name}),(0,X.jsxs)(`span`,{className:`kit-where__facts`,children:[W[e.load].label,e.waitsFor?` · ${e.waitsFor}`:` · No agreement needed`]})]},e.index))}),i.skipped.length>0?(0,X.jsxs)(`details`,{className:`app-details`,children:[(0,X.jsxs)(`summary`,{children:[`Not loaded here (`,i.skipped.length,`)`]}),(0,X.jsx)(`ul`,{className:`kit-where__skipped`,children:i.skipped.map(e=>(0,X.jsxs)(`li`,{children:[(0,X.jsx)(`b`,{children:e.name}),` `,(0,X.jsx)(`span`,{className:`g-muted`,children:e.reason})]},e.index))})]}):null]})]})]})}var $=[`scripts`],Ze=[`Add GA4 with ID G-ABC123 and only load it after consent`,`Turn on the built-in consent banner with Consent Mode`,`Load the chat widget only on /support/**`];function Qe({open:e,setOpen:t,onAdd:n,warned:r}){let i=j(),a=me($),s=Array.isArray(a)?a:[],c=te(),l=(0,B.useRef)(null),u=(n,r)=>{let a=xe($,s.length,n,r);a&&(i.apply(...a.ops),e.has(n)&&t(new Set([...e].filter(e=>e!==n).concat(r))))},d=le(l,u),f=e=>{let n=be($,s,e),r=c.scripts[e];n&&r&&(i.apply(...n.ops),t(new Set),y({tone:`neutral`,title:`${H(r)} removed`,body:`It stops loading on the site when you publish. Undo puts it back where it was.`,action:{label:`Undo`,onClick:()=>i.apply(...n.undo)},duration:1e4}))},p=n=>{let r=new Set(e);r.has(n)?r.delete(n):r.add(n),t(r)};return s.length===0?(0,X.jsx)(o,{compact:!0,title:`No scripts yet.`,body:`Add analytics, a tag manager, ad tracking or a chat widget. Nothing loads until you publish.`,actions:(0,X.jsx)(b,{variant:`primary`,icon:`plus`,onClick:n,children:`Add a script`})}):(0,X.jsx)(`div`,{className:`kit-scripts`,ref:l,children:s.map((t,n)=>(0,X.jsx)(Ke,{index:n,total:s.length,open:e.has(n),warned:r.has(n),drag:d,onToggle:p,onMove:u,onRemove:f},n))})}function $e({siteId:t,entry:n}){let r=z(e=>e.detail?.name??`Site`),i=z(e=>e.detail?.model.collections.find(e=>e.id===`pages`)?.url??null);L({crumbs:[{label:r,to:`/sites/${t}`},{label:`Scripts`}],...n.status===`modified`?{tag:{label:`Edited`,tone:`change`}}:n.status===`added`?{tag:{label:`New`,tone:`insert`}}:{}});let a=te(),o=j(),s=I(),c=z(e=>e.detail?.model),l=ve(e=>e.outside),[u,d]=(0,B.useState)(!1),[f,p]=(0,B.useState)(()=>new Set),m=(0,B.useMemo)(()=>Pe(a),[a]),h=(0,B.useMemo)(()=>new Set(m.filter(e=>e.tone===`warning`&&e.id!==`no-consent`).flatMap(e=>e.scripts)),[m]),g=(0,B.useMemo)(()=>{let e=a.scripts.flatMap(e=>[...e.include??[],...e.exclude??[]]).map(e=>e.replace(/\*\*?/g,`example`).replace(/\?/g,`x`));return[...new Set([`/`,i?i.replace(`{slug}`,`about`):`/about/`,...e])].slice(0,6)},[a.scripts,i]),_=e=>{let t=a.scripts.length;o.apply(ye($,t,D(e))),p(new Set([t]))},v=m.some(e=>e.id===`no-consent`);return(0,X.jsxs)(`div`,{className:`app-screen kit-scripts-screen`,children:[(0,X.jsxs)(`div`,{className:`app-screen__inner app-screen__inner--wide`,children:[(0,X.jsx)(x,{eyebrow:`Site`,title:`Scripts`,description:`Analytics, tags and widgets the site loads. Adding or changing one is powerful, so every change waits in Proof like any other until you publish.`,actions:(0,X.jsx)(b,{variant:`primary`,icon:`plus`,onClick:()=>d(!0),children:`Add a script`})}),(0,X.jsx)(w,{subject:`scripts`,context:`About the scripts setup in ${n.path}:`,examples:Ze,placeholder:`Add GA4 with ID G-… and only load it after consent`}),(0,X.jsx)(O,{step:`layout`}),(0,X.jsx)(_e,{fields:n.fields,noun:Se(c,n.collection)}),(0,X.jsx)(ge,{}),l?(0,X.jsxs)(`p`,{className:`g-margin-note kit-note`,role:`status`,children:[(0,X.jsx)(e,{kind:`transpose`}),(0,X.jsx)(`span`,{children:l.origin===`agent`?`The assistant changed the scripts. What it changed is marked for a moment.`:`The scripts setup changed outside the app. This shows the latest version.`})]},l.at):null,m.filter(e=>e.id!==`no-consent`).map(t=>(0,X.jsxs)(`p`,{className:t.tone===`warning`?`g-margin-note kit-note kit-note--warning`:`g-margin-note kit-note`,role:`status`,children:[(0,X.jsx)(e,{kind:t.tone===`warning`?`bang`:`pilcrow`}),(0,X.jsx)(`span`,{children:t.text})]},t.id)),(0,X.jsxs)(`div`,{className:`kit-scripts-layout`,children:[(0,X.jsxs)(`section`,{className:`kit-scripts-layout__main`,"aria-labelledby":`installed-title`,children:[(0,X.jsx)(`h2`,{id:`installed-title`,className:`kit-tab-head__title`,children:`Installed`}),(0,X.jsx)(Qe,{open:f,setOpen:p,onAdd:()=>d(!0),warned:h})]}),(0,X.jsxs)(`div`,{className:`kit-scripts-layout__side`,children:[(0,X.jsx)(Ne,{config:a,trackingWithoutConsent:v}),(0,X.jsx)(Xe,{config:a,suggestions:g})]})]})]}),(0,X.jsx)(Oe,{open:u,onClose:()=>d(!1),taken:a.scripts.map(e=>e.id),allowBuild:s,onAdd:_})]})}function et({siteId:e,siteName:t}){return L({crumbs:[{label:t,to:`/sites/${e}`},{label:`Scripts`}]}),null}function tt(){let{siteId:e=``}=n(),t=z(e=>e.detail),r=t?.name??`Site`,i=t&&t.id===e?Ce(t.model):null,o=E(e,i?.path??null),s;if(!t||t.id!==e||i&&o.loading)s=(0,X.jsx)(`div`,{className:`app-screen`,"aria-busy":`true`,children:(0,X.jsxs)(`div`,{className:`app-screen__inner`,children:[(0,X.jsx)(p,{width:120,height:12}),(0,X.jsx)(p,{width:240,height:28,style:{marginBlock:`var(--space-3) var(--space-6)`}}),(0,X.jsx)(p,{lines:5,height:14})]})});else if(!i)s=(0,X.jsx)(`div`,{className:`app-screen`,children:(0,X.jsxs)(`div`,{className:`app-screen__inner`,children:[(0,X.jsx)(x,{eyebrow:`Site`,title:`Scripts`}),(0,X.jsx)(k,{feature:`scripts`})]})});else if(!o.data)s=(0,X.jsx)(`div`,{className:`app-screen app-screen--center`,children:(0,X.jsx)(a,{title:`Couldn’t open the scripts setup`,error:o.error,onRetry:()=>void o.refetch()})});else return(0,X.jsx)(C,{siteId:e,entry:o.data,marksFor:T,children:(0,X.jsxs)(`div`,{className:`kit-screen`,children:[(0,X.jsx)($e,{siteId:e,entry:o.data}),(0,X.jsx)(A,{siteId:e,entryPath:o.data.path})]})},o.data.path);return(0,X.jsxs)(`div`,{className:`kit-screen`,children:[(0,X.jsx)(et,{siteId:e,siteName:r}),s,(0,X.jsx)(A,{siteId:e})]})}export{tt as ScriptsScreen};
|
|
1
|
+
import{$ as e,A as t,At as n,F as r,Ft as i,I as a,N as o,Nt as s,O as c,_ as l,a as u,bt as d,c as f,g as p,gt as m,i as h,j as g,k as _,mt as v,n as y,pt as b,v as x,vt as ee}from"./ui-C6O2tW4c.js";import{A as S,B as C,C as w,D as T,H as E,M as D,N as O,P as k,R as A,S as te,V as ne,b as j,c as re,d as ie,f as ae,h as oe,i as se,j as M,l as ce,n as N,o as le,p as ue,t as de,v as P,y as F,z as I}from"./ProviderSettings-BtM56M7d.js";import{n as L}from"./chrome-Brnq5kGb.js";import{E as fe,T as R,_ as pe,b as me,g as he,i as ge,n as _e,y as ve}from"./outside-Bv1jj3yu.js";import{_ as ye,a as be,i as xe}from"./listPlan-BPJMzA6e.js";import{t as z}from"./site-DJUEXLHW.js";import{I as Se,j as Ce}from"./index-CtsAxi5d.js";var B=i(s(),1);function V(e){return oe.find(t=>t.kind===e)??ae(e)}function H(e){return e.label?.trim()||V(e.kind)?.name||e.kind}function we(e){let t=V(e.kind),n=e.kind===`custom`?M(e.settings.src)?`src`:null:t?.settings.find(e=>e.required)?.key??t?.settings[0]?.key??null;return n&&M(e.settings[n]).trim()||null}function U(e){return e.category===`tag-manager`||e.category===`analytics`?`eager`:e.category===`support`?`interaction`:`idle`}function Te(e,t,n){let r=new Set(n),i=e.kind;for(let t=2;r.has(i);t++)i=`${e.kind}-${t}`;let a={};for(let[e,n]of Object.entries(t))M(n).trim()&&(a[e]=typeof n==`string`?n.trim():n);return{id:i,kind:e.kind,enabled:!0,settings:a,placement:e.defaultPlacement,load:U(e),consent:e.defaultConsent}}var W={eager:{label:`Straight away`,line:`Loads with the page. Needed for tags that must see the first page view.`},idle:{label:`When idle`,line:`Waits until the page has finished loading, so it doesn’t slow the page down.`},interaction:{label:`First interaction`,line:`Waits for the visitor’s first scroll, tap or key press. Best for chat and pop-ups.`}},G={necessary:{label:`Necessary`,line:`Always loads. Only for scripts the site can’t work without, or that keep no record of the visitor.`},analytics:{label:`Analytics`,line:`Measures visits. Loads once the visitor agrees to analytics.`},marketing:{label:`Marketing`,line:`Advertising and follow-up. Loads once the visitor agrees to marketing.`},preferences:{label:`Preferences`,line:`Remembers choices and powers extras like chat. Loads once the visitor agrees to preferences.`}},K={head:`In the page head`,"body-start":`At the start of the page`,"body-end":`At the end of the page`},q={"tag-manager":`Tag managers`,analytics:`Analytics`,advertising:`Advertising`,marketing:`Marketing`,support:`Support and chat`,other:`Other`};function J(e){return e.consent??V(e.kind)?.defaultConsent??`necessary`}function Y(e){return e.load??`eager`}function Ee(e){return{gtm:`GTM`,ga4:`GA`,"meta-pixel":`Me`,"linkedin-insight":`in`,hubspot:`Hs`,"marketo-munchkin":`Mk`,plausible:`Pl`,segment:`Sg`,hotjar:`Hj`,clarity:`Cl`,intercom:`Ic`,custom:`</>`}[e]??e.slice(0,2)}var X=d();function De(e,t){let n=`${e.name} ${e.description} ${q[e.category]}`.toLowerCase();return t.toLowerCase().split(/\s+/).filter(Boolean).every(e=>n.includes(e))}function Oe({open:e,onClose:i,taken:a,allowBuild:o,onAdd:s}){let[u,d]=(0,B.useState)(``),{siteId:f=``}=n(),p=ue(f),[h,_]=(0,B.useState)(null),[v,y]=(0,B.useState)({}),[x,S]=(0,B.useState)(`src`),[C,w]=(0,B.useState)(!1);(0,B.useEffect)(()=>{e&&(d(``),_(null),y({}),S(`src`),w(!1))},[e]);let T=(0,B.useMemo)(()=>{let e=p.scriptIntegrations.filter(e=>De(e,u));return Object.keys(q).map(t=>({category:t,items:e.filter(e=>e.category===t)})).filter(e=>e.items.length>0)},[u,p.scriptIntegrations]),E=h?.kind===`custom`,D=(h?.settings??[]).filter(e=>!E||e.key===x),O=Object.fromEntries(D.map(e=>[e.key,se(E?{...e,required:!0}:e,v[e.key])]).filter(([,e])=>e)),k=h!==null&&Object.keys(O).length===0,A=()=>{if(w(!0),!h||!k)return;let e={};for(let t of D)v[t.key]?.trim()&&(e[t.key]=v[t.key]??``);let t=Te(h,e,a);s(re(h)?ie(t,h,p.nameOf(h.plugin)):t),i()};return(0,X.jsx)(r,{open:e,onClose:i,title:h?`Add ${h.name}`:`Add a script`,description:h?h.description:`Pick what to add. You’ll only be asked for what it needs.`,size:`lg`,footer:h?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(b,{variant:`secondary`,onClick:()=>_(null),children:`Back to the list`}),(0,X.jsxs)(b,{variant:`primary`,onClick:A,disabled:C&&!k,children:[`Add `,h.name]})]}):(0,X.jsx)(b,{variant:`secondary`,onClick:i,children:`Not now`}),children:h?(0,X.jsxs)(`div`,{className:`kit-add`,children:[E?(0,X.jsx)(g,{label:`How it’s added`,group:!0,hint:o?void 0:`Writing code into the page is only offered on sites where build mode is allowed, because it runs with full access to every page.`,children:(0,X.jsx)(l,{label:`How it’s added`,options:[{value:`src`,label:`From an address`},{value:`inline`,label:`Code`,disabled:!o}],value:x,onChange:S})}):null,D.map(e=>{let n=C||v[e.key]?O[e.key]:void 0;return(0,X.jsx)(g,{label:e.label,hint:n?void 0:e.help??(e.placeholder?`Looks like ${e.placeholder}`:void 0),error:n,children:e.key===`inline`?(0,X.jsx)(t,{mono:!0,rows:6,maxRows:16,spellCheck:!1,value:v[e.key]??``,onChange:t=>y({...v,[e.key]:t.target.value})}):(0,X.jsx)(c,{mono:!0,spellCheck:!1,placeholder:e.placeholder,value:v[e.key]??``,onChange:t=>y({...v,[e.key]:t.target.value}),onKeyDown:e=>e.key===`Enter`&&A()})},e.key)}),(0,X.jsxs)(`div`,{className:m(`kit-add__defaults`),children:[(0,X.jsx)(`p`,{className:`g-eyebrow`,children:`Already chosen for you`}),(0,X.jsxs)(`ul`,{children:[(0,X.jsxs)(`li`,{children:[W[U(h)].label,` — `,W[U(h)].line]}),(0,X.jsxs)(`li`,{children:[K[h.defaultPlacement],`.`]}),(0,X.jsxs)(`li`,{children:[`Consent: `,G[h.defaultConsent].label,`. `,G[h.defaultConsent].line]}),(0,X.jsx)(`li`,{children:`Every page. You can limit it to some pages once it’s added.`})]})]})]}):(0,X.jsxs)(`div`,{className:`kit-catalogue`,children:[(0,X.jsx)(c,{"aria-label":`Search scripts`,placeholder:`Search — analytics, chat, ads…`,value:u,onChange:e=>d(e.target.value),"data-autofocus":!0}),T.length===0?(0,X.jsxs)(`p`,{className:`g-hint`,children:[`Nothing matches “`,u,`”. Try a shorter word, or add a custom script.`]}):null,T.map(e=>(0,X.jsxs)(`section`,{className:`kit-catalogue__group`,"aria-label":q[e.category],children:[(0,X.jsx)(`p`,{className:`g-eyebrow`,children:q[e.category]}),(0,X.jsx)(`div`,{className:`kit-catalogue__items`,children:e.items.map(e=>(0,X.jsxs)(`button`,{type:`button`,className:`kit-catalogue__item`,onClick:()=>{_(e),y({}),w(!1)},children:[(0,X.jsx)(N,{text:Ee(e.kind)}),(0,X.jsxs)(`span`,{className:`kit-catalogue__text`,children:[(0,X.jsx)(`span`,{className:`kit-catalogue__name`,children:e.name}),(0,X.jsx)(`span`,{className:`kit-catalogue__description`,children:e.description}),e.plugin===`@galley/builtin`?null:(0,X.jsxs)(`span`,{className:`kit-catalogue__description`,children:[`From the plugin `,p.nameOf(e.plugin)]})]}),(0,X.jsx)(ee,{name:`chevron-right`})]},e.kind))})]},e.category))]})})}var ke=[{value:`none`,label:`Off`},{value:`banner`,label:`Built-in banner`},{value:`external`,label:`Another consent tool`}],Ae={none:`Every switched-on script loads for every visitor, without asking.`,banner:`The site asks visitors first, with a small banner. Scripts wait for the categories they need.`,external:`Your own consent tool asks, and tells the site what visitors agreed to. Scripts wait for it.`},je=[`analytics`,`marketing`,`preferences`],Z={title:`Cookies and tracking`,text:`This site would like to measure visits and the success of its marketing. Choose what it may use. You can change this at any time from the link at the bottom of each page.`,acceptLabel:`Accept all`,rejectLabel:`Reject all`,settingsLabel:`Choose…`};function Me({banner:e,theme:t}){return(0,X.jsxs)(`div`,{className:`kit-banner-frame`,"data-theme":t,children:[(0,X.jsxs)(`div`,{className:`kit-banner`,"aria-hidden":`true`,children:[(0,X.jsx)(`p`,{className:`kit-banner__title`,children:e.title||Z.title}),(0,X.jsxs)(`p`,{className:`kit-banner__text`,children:[e.text||Z.text,` `,e.policyUrl?(0,X.jsx)(`span`,{className:`g-link`,children:`Privacy policy`}):null]}),(0,X.jsxs)(`span`,{className:`kit-banner__buttons`,children:[(0,X.jsx)(`span`,{className:`kit-pv__button`,children:e.acceptLabel||Z.acceptLabel}),(0,X.jsx)(`span`,{className:`kit-pv__button`,children:e.rejectLabel||Z.rejectLabel}),(0,X.jsx)(`span`,{className:`kit-pv__button kit-pv__button--back`,children:e.settingsLabel||Z.settingsLabel})]})]}),(0,X.jsx)(`span`,{className:`kit-banner-frame__label`,children:t===`light`?`Light`:`Dark`})]})}function Ne({config:t,trackingWithoutConsent:n}){let r=j(),i=ne(),a=t.consent,o=a?.mode??`none`,s=new Set(a?.defaults??[]),c=a?.banner??{},u=(e,t)=>{let n=je.filter(n=>n===e?t:s.has(n));r.choose([`consent`,`defaults`],n.length?n:void 0)};return(0,X.jsxs)(`section`,{className:m(`g-block kit-consent`,i.has(`area:consent`)&&`kit-consent--flash`),"aria-labelledby":`consent-title`,children:[(0,X.jsx)(`header`,{className:`g-block__head`,children:(0,X.jsx)(`h2`,{id:`consent-title`,className:`kit-tab-head__title`,children:`Consent`})}),(0,X.jsxs)(`div`,{className:`g-block__body kit-consent__body`,children:[(0,X.jsx)(g,{label:`Ask visitors first`,group:!0,hint:Ae[o],children:(0,X.jsx)(l,{label:`Ask visitors first`,options:ke,value:o,onChange:e=>r.choose([`consent`,`mode`],e)})}),n?(0,X.jsxs)(`p`,{className:`g-margin-note kit-note kit-note--warning`,role:`status`,children:[(0,X.jsx)(e,{kind:`bang`}),(0,X.jsx)(`span`,{children:`Analytics or marketing scripts are switched on with consent off. In many countries visitors must agree before these load.`})]}):null,o===`banner`?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`kit-consent__texts`,children:[(0,X.jsx)(P,{path:[`consent`,`banner`,`title`],label:`Title`,placeholder:Z.title}),(0,X.jsx)(P,{path:[`consent`,`banner`,`text`],label:`Text`,placeholder:Z.text,multiline:!0}),(0,X.jsxs)(`div`,{className:`app-form-row`,children:[(0,X.jsx)(P,{path:[`consent`,`banner`,`acceptLabel`],label:`Accept button`,placeholder:Z.acceptLabel}),(0,X.jsx)(P,{path:[`consent`,`banner`,`rejectLabel`],label:`Refuse button`,placeholder:Z.rejectLabel})]}),(0,X.jsxs)(`div`,{className:`app-form-row`,children:[(0,X.jsx)(P,{path:[`consent`,`banner`,`settingsLabel`],label:`Choices button`,placeholder:Z.settingsLabel}),(0,X.jsx)(P,{path:[`consent`,`banner`,`policyUrl`],label:`Privacy policy page`,mono:!0,placeholder:`/privacy/`})]})]}),(0,X.jsxs)(`div`,{className:`kit-consent__previews`,"aria-label":`Banner preview`,children:[(0,X.jsx)(Me,{banner:c,theme:`light`}),(0,X.jsx)(Me,{banner:c,theme:`dark`})]})]}):null,o===`none`?null:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(g,{label:`On before the visitor chooses`,group:!0,hint:`Necessary scripts always load. Leave these off where the law asks for agreement first.`,children:(0,X.jsx)(`div`,{className:`kit-checks`,children:je.map(e=>(0,X.jsx)(h,{label:G[e].label,description:G[e].line,checked:s.has(e),onChange:t=>u(e,t)},e))})}),(0,X.jsx)(F,{path:[`consent`,`googleConsentMode`],label:`Tell Google tags about consent (Consent Mode)`,description:`Google Analytics and Tag Manager are told what visitors agreed to, so they can adjust what they record.`})]})]})]})}function Pe(e){let t=[],n=new Map;e.scripts.forEach((e,t)=>n.set(e.id,[...n.get(e.id)??[],t]));for(let[e,r]of n)e&&r.length>1&&t.push({id:`id-${e}`,tone:`warning`,text:`${r.length} scripts use the name “${e}”. Give each its own, so changes and page rules apply to the right one.`,scripts:r});let r=new Map;e.scripts.forEach((e,t)=>{if(!e.enabled)return;let n=we(e);if(!n)return;let i=`${e.kind}\n${n}`;r.set(i,[...r.get(i)??[],t])});for(let[n,i]of r){if(i.length<2)continue;let r=e.scripts[i[0]],a=n.split(`
|
|
2
|
+
`)[1]??``;t.push({id:`tag-${n}`,tone:`warning`,text:`${r?H(r):`This script`} is installed ${i.length} times with ${a}. Visits would be counted more than once — switch one off.`,scripts:i})}let i=e.scripts.flatMap((e,t)=>e.enabled&&e.kind===`ga4`?[t]:[]),a=e.scripts.flatMap((e,t)=>e.enabled&&e.kind===`gtm`?[t]:[]);if(i.length>0&&a.length>0&&t.push({id:`ga4-in-gtm`,tone:`info`,text:`Google Analytics is often set up inside the Tag Manager container too. If yours is, page views are counted twice — keep it in one place.`,scripts:[...i,...a]}),(e.consent?.mode??`none`)===`none`){let n=e.scripts.flatMap((e,t)=>{let n=J(e);return e.enabled&&(n===`analytics`||n===`marketing`)?[t]:[]});n.length>0&&t.push({id:`no-consent`,tone:`warning`,text:`Analytics and marketing scripts load without asking, because consent is off. In many countries visitors must agree before these load.`,scripts:n})}return t}function Q(e){let t=e.trim(),n=/^[a-z][a-z0-9+.-]*:\/\/[^/]*/i.exec(t);return n&&(t=t.slice(n[0].length)),t=t.split(/[?#]/)[0]??``,t.startsWith(`/`)||(t=`/${t}`),t=t.replace(/\/{2,}/g,`/`),t.length>1&&(t=t.replace(/\/+$/,``)),t}function Fe(e){let t=``,n=e.trim();n.startsWith(`/`)||(n=`/${n}`),n=n.replace(/\/+$/,``);for(let e=0;e<n.length;e+=1){let r=n[e];r===`*`&&n[e+1]===`*`?(t.endsWith(`/`)?t=`${t.slice(0,-1)}(?:/.*)?`:t+=`.*`,e+=1):t+=r===`*`?`[^/]*`:r===`?`?`[^/]`:r.replace(/[.+^${}()|[\]\\]/g,`\\$&`)}return RegExp(`^${t}/?$`)}function Ie(e,t){let n=Q(t);return Fe(e).test(n)||e.trim().replace(/\/+$/,``)===``&&n===`/`}function Le(e,t){let n=e.include??[],r=(e.exclude??[]).find(e=>Ie(e,t));if(r)return{loads:!1,because:{list:`exclude`,pattern:r}};if(n.length===0)return{loads:!0};let i=n.find(e=>Ie(e,t));return i?{loads:!0,because:{list:`include`,pattern:i}}:{loads:!1}}function Re(e){return(e.include??[]).length>0?`only`:(e.exclude??[]).length>0?`except`:`everywhere`}function ze(e){let t=Re(e),n=e=>(e??[]).map(e=>e.trim()||`/`).join(`, `);return t===`only`?`Only ${n(e.include)}${(e.exclude??[]).length?`, not ${n(e.exclude)}`:``}`:t===`except`?`Every page except ${n(e.exclude)}`:`Every page`}var Be=[{value:`everywhere`,label:`Every page`},{value:`only`,label:`Only these`},{value:`except`,label:`All except`}];function Ve({entry:e}){let[t,n]=(0,B.useState)(``),r=t.trim()?Le(e,t):null;return(0,X.jsxs)(g,{label:`Try an address`,hint:r?void 0:`Type a page address to see whether this script loads there.`,children:[(0,X.jsx)(c,{mono:!0,size:`sm`,placeholder:`/pricing/teams/`,value:t,onChange:e=>n(e.target.value)}),r?(0,X.jsxs)(`p`,{className:r.loads?`kit-verdict kit-verdict--yes`:`kit-verdict kit-verdict--no`,role:`status`,children:[r.loads?`Loads here`:`Doesn’t load here`,r.because?` — matches ${r.because.pattern}`:r.loads?` — it loads on every page`:` — no pattern matches`]}):null]})}function He({index:e,entry:t}){let n=j(),r=Re(t),[i,a]=(0,B.useState)(null),o=r===`everywhere`&&i?i:r,s=o===`except`?`exclude`:`include`,u=(o===`except`?t.exclude:t.include)??[],d=[`scripts`,e,s],f=r=>{if(a(r),r===o)return;let i=u.filter(e=>e.trim());if(r===`everywhere`){n.apply(...t.include?[{op:`unset`,path:[`scripts`,e,`include`]}]:[],...t.exclude?[{op:`unset`,path:[`scripts`,e,`exclude`]}]:[]);return}if(i.length===0)return;let c=r===`except`?`exclude`:`include`;n.apply({op:`unset`,path:[`scripts`,e,s]},{op:`set`,path:[`scripts`,e,c],value:i})},p=u.length>0?u:o===`everywhere`?[]:[``];return(0,X.jsxs)(`div`,{className:`kit-insp__group`,children:[(0,X.jsx)(g,{label:`Pages`,group:!0,children:(0,X.jsx)(l,{label:`Pages`,options:Be,value:o,onChange:f})}),o===`everywhere`?null:(0,X.jsxs)(g,{label:o===`only`?`Load only on`:`Don’t load on`,group:!0,hint:`A page address per line. * stands for one part of the address (/blog/*), ** for any number (/docs/**).`,children:[(0,X.jsx)(`ul`,{className:`kit-patterns`,children:p.map((e,t)=>(0,X.jsxs)(`li`,{className:`kit-pattern`,children:[(0,X.jsx)(c,{mono:!0,size:`sm`,"aria-label":`Page pattern ${t+1}`,placeholder:`/pricing/*`,value:e,onChange:e=>{let r=e.target.value;u.length===0?n.type(d,r?[r]:void 0):n.type([...d,t],r,!0)},onBlur:e=>{e.target.value.trim()===``&&u.length>0?n.apply(u.length===1?{op:`unset`,path:d}:{op:`remove`,path:d,index:t}):(n.commit(d),n.commit([...d,t]))}}),u.length>0?(0,X.jsx)(v,{icon:`close`,label:`Remove ${e||`pattern`}`,onClick:()=>n.apply(u.length===1?{op:`unset`,path:d}:{op:`remove`,path:d,index:t})}):null]},t))}),u.length>0?(0,X.jsx)(b,{size:`sm`,variant:`secondary`,icon:`plus`,onClick:()=>n.apply({op:`insert`,path:d,index:u.length,value:``}),children:`Add an address`}):null]}),(0,X.jsx)(Ve,{entry:t})]})}var Ue=[`necessary`,`analytics`,`marketing`,`preferences`];function We({index:t,entry:n}){let r=j(),i=I(),a=V(n.kind),o=(...e)=>[`scripts`,t,...e],s=Y(n),c=J(n),u=n.kind===`custom`,d=M(n.settings.inline).trim()!==``,f=(a?.settings??[]).filter(e=>!(u&&e.key===`inline`&&!i));return(0,X.jsxs)(`div`,{className:`kit-script-detail`,children:[(0,X.jsxs)(`div`,{className:`kit-script-detail__col`,children:[(0,X.jsx)(P,{path:o(`label`),label:`Name in this app`,placeholder:a?.name??n.kind}),f.length>0?(0,X.jsx)(de,{path:o(`settings`),specs:f,values:n.settings}):(0,X.jsx)(`p`,{className:`g-hint`,children:`This kind of script isn’t in the catalogue; its settings stay as they are in the file.`}),u&&!i?(0,X.jsxs)(`p`,{className:`g-margin-note kit-note`,children:[(0,X.jsx)(e,{kind:`reg`}),(0,X.jsx)(`span`,{children:d?`This script runs code written into the site. It can only be changed where build mode is allowed.`:`Custom code can only be added on sites where build mode is allowed. A script address works everywhere.`})]}):null,a?.docsUrl?(0,X.jsxs)(`a`,{className:`g-link`,href:a.docsUrl,target:`_blank`,rel:`noreferrer`,children:[`Where to find these in `,a.name]}):null,(0,X.jsx)(P,{path:o(`note`),label:`Note for colleagues`,multiline:!0,placeholder:`Who asked for it and why — “added for the spring campaign, ask before removing”`})]}),(0,X.jsxs)(`div`,{className:`kit-script-detail__col`,children:[(0,X.jsx)(He,{index:t,entry:n}),(0,X.jsx)(g,{label:`When it loads`,group:!0,hint:W[s].line,children:(0,X.jsx)(l,{label:`When it loads`,options:Object.keys(W).map(e=>({value:e,label:W[e].label})),value:s,onChange:e=>r.choose(o(`load`),e)})}),(0,X.jsx)(g,{label:`Consent`,group:!0,hint:G[c].line,children:(0,X.jsx)(l,{label:`Consent`,options:Ue.map(e=>({value:e,label:G[e].label})),value:c,onChange:e=>r.choose(o(`consent`),e)})}),(0,X.jsx)(g,{label:`Where in the page`,children:(0,X.jsx)(_,{value:n.placement??a?.defaultPlacement??`head`,options:Object.keys(K).map(e=>({value:e,label:K[e]})),onChange:e=>r.choose(o(`placement`),e)})}),(0,X.jsx)(F,{path:o(`inPreview`),label:`Also load in preview and development`,description:`Off by default, so your own testing isn’t counted as visits or sent to your ad accounts.`})]})]})}function Ge({index:t}){let n=[`scripts`,t],r=pe(n),i=he(n);return r===0?null:(0,X.jsxs)(`span`,{className:`g-field__state`,children:[(0,X.jsx)(e,{kind:`caret`}),i===`added`?`New`:`Edited`]})}var Ke=(0,B.memo)(function({index:t,total:n,open:r,warned:i,drag:a,onToggle:o,onMove:s,onRemove:c}){let l=me([`scripts`,t]),d=j(),p=ne(),h=(0,B.useRef)(null),g=S(l);if(!g)return null;let _=H(g),y=we(g),b=J(g),x=e=>{if(!e.altKey||e.key!==`ArrowUp`&&e.key!==`ArrowDown`)return;e.preventDefault();let r=t+(e.key===`ArrowUp`?-1:1);r>=0&&r<n&&s(t,r)};return(0,X.jsxs)(`section`,{ref:h,className:m(`g-block kit-script`,!g.enabled&&`kit-script--off`,p.has(`script:${g.id}`)&&`kit-script--flash`,i&&`kit-script--warned`),"aria-label":_,...a.card(t),children:[(0,X.jsxs)(`div`,{className:`kit-script__row`,onKeyDown:x,children:[(0,X.jsx)(`span`,{className:`kit-dest__grip`,"aria-hidden":`true`,title:`Drag to change the order`,...a.grip(t,()=>h.current),children:(0,X.jsx)(fe,{name:`grip`})}),(0,X.jsx)(N,{text:Ee(g.kind)}),(0,X.jsxs)(`button`,{type:`button`,className:`kit-script__open`,"aria-expanded":r,onClick:()=>o(t),"aria-keyshortcuts":`Alt+ArrowUp Alt+ArrowDown`,children:[(0,X.jsx)(e,{kind:`chevron`,className:m(`app-card__chevron`,!r&&`app-card__chevron--closed`)}),(0,X.jsxs)(`span`,{className:`kit-script__titles`,children:[(0,X.jsx)(`span`,{className:`kit-script__name`,children:_}),(0,X.jsx)(`span`,{className:`kit-script__id g-mono`,children:y??(g.kind===`custom`?`Code written into the page`:V(g.kind)?`Not set up yet`:ce(g.kind))})]}),(0,X.jsxs)(`span`,{className:`g-sr`,children:[`, script `,t+1,` of `,n,`. Alt and arrow keys move it.`]})]}),(0,X.jsxs)(`span`,{className:`kit-script__facts`,children:[(0,X.jsx)(`span`,{children:ze(g)}),(0,X.jsx)(`span`,{children:W[Y(g)].label}),(0,X.jsx)(f,{tone:b===`necessary`?`neutral`:`info`,mark:null,children:G[b].label})]}),(0,X.jsx)(Ge,{index:t}),(0,X.jsx)(`span`,{className:`kit-script__switch`,children:(0,X.jsx)(u,{checked:g.enabled,"aria-label":g.enabled?`${_} is on`:`${_} is off`,onChange:e=>d.choose([`scripts`,t,`enabled`],e)})}),(0,X.jsxs)(`span`,{className:`kit-dest__tools`,children:[(0,X.jsx)(R,{icon:`arrow-up`,label:`Move ${_} up`,disabled:t===0,onClick:()=>s(t,t-1)}),(0,X.jsx)(R,{icon:`arrow-down`,label:`Move ${_} down`,disabled:t===n-1,onClick:()=>s(t,t+1)}),(0,X.jsx)(v,{icon:`trash`,label:`Remove ${_}`,onClick:()=>c(t)})]})]}),g.note&&!r?(0,X.jsx)(`p`,{className:`kit-script__note`,children:g.note}):null,r?(0,X.jsx)(`div`,{className:`g-block__body`,children:(0,X.jsx)(We,{index:t,entry:g})}):null]})});function qe(e,t){return e===`necessary`||(t?.mode??`none`)===`none`?!1:!(t?.defaults??[]).includes(e)}function Je(e,t){let n=J(e);return qe(n,t)?`Waits until ${t?.mode===`external`?`your consent tool`:`the visitor`} allows ${n}`:null}function Ye(e,t,n={}){let r=[],i=[];return e.scripts.forEach((a,o)=>{let s=H(a);if(!a.enabled)return void i.push({index:o,name:s,reason:`Switched off`});if(n.preview&&!a.inPreview)return void i.push({index:o,name:s,reason:`Not loaded in preview`});let c=Le(a,t);if(c.loads)r.push({index:o,id:a.id,name:s,load:Y(a),consent:J(a),waitsFor:Je(a,e.consent)});else{let e=c.because?`Not on pages matching ${c.because.pattern}`:`Only on ${(a.include??[]).join(`, `)}`;i.push({index:o,name:s,reason:e})}}),{loads:r,skipped:i}}function Xe({config:e,suggestions:t}){let[n,r]=(0,B.useState)(`/`),i=(0,B.useMemo)(()=>Ye(e,n||`/`),[e,n]),a=Q(n||`/`);return(0,X.jsxs)(`section`,{className:`g-block kit-where`,"aria-labelledby":`where-title`,children:[(0,X.jsx)(`header`,{className:`g-block__head`,children:(0,X.jsx)(`h2`,{id:`where-title`,className:`kit-tab-head__title`,children:`What loads where`})}),(0,X.jsxs)(`div`,{className:`g-block__body`,children:[(0,X.jsx)(g,{label:`Page address`,children:(0,X.jsx)(c,{mono:!0,value:n,onChange:e=>r(e.target.value),placeholder:`/pricing/`})}),t.length?(0,X.jsx)(`div`,{className:`kit-where__chips`,children:t.map(e=>(0,X.jsx)(`button`,{type:`button`,className:`g-chip`,onClick:()=>r(e),"aria-pressed":Q(e)===a,children:e},e))}):null,(0,X.jsxs)(`div`,{role:`status`,"aria-live":`polite`,children:[i.loads.length===0?(0,X.jsxs)(`p`,{className:`g-hint`,children:[`No scripts load on `,a,`.`]}):(0,X.jsx)(`ol`,{className:`kit-where__list`,children:i.loads.map(e=>(0,X.jsxs)(`li`,{className:`kit-where__item`,children:[(0,X.jsx)(`span`,{className:`kit-where__name`,children:e.name}),(0,X.jsxs)(`span`,{className:`kit-where__facts`,children:[W[e.load].label,e.waitsFor?` · ${e.waitsFor}`:` · No agreement needed`]})]},e.index))}),i.skipped.length>0?(0,X.jsxs)(`details`,{className:`app-details`,children:[(0,X.jsxs)(`summary`,{children:[`Not loaded here (`,i.skipped.length,`)`]}),(0,X.jsx)(`ul`,{className:`kit-where__skipped`,children:i.skipped.map(e=>(0,X.jsxs)(`li`,{children:[(0,X.jsx)(`b`,{children:e.name}),` `,(0,X.jsx)(`span`,{className:`g-muted`,children:e.reason})]},e.index))})]}):null]})]})]})}var $=[`scripts`],Ze=[`Add GA4 with ID G-ABC123 and only load it after consent`,`Turn on the built-in consent banner with Consent Mode`,`Load the chat widget only on /support/**`];function Qe({open:e,setOpen:t,onAdd:n,warned:r}){let i=j(),a=me($),s=Array.isArray(a)?a:[],c=te(),l=(0,B.useRef)(null),u=(n,r)=>{let a=xe($,s.length,n,r);a&&(i.apply(...a.ops),e.has(n)&&t(new Set([...e].filter(e=>e!==n).concat(r))))},d=le(l,u),f=e=>{let n=be($,s,e),r=c.scripts[e];n&&r&&(i.apply(...n.ops),t(new Set),y({tone:`neutral`,title:`${H(r)} removed`,body:`It stops loading on the site when you publish. Undo puts it back where it was.`,action:{label:`Undo`,onClick:()=>i.apply(...n.undo)},duration:1e4}))},p=n=>{let r=new Set(e);r.has(n)?r.delete(n):r.add(n),t(r)};return s.length===0?(0,X.jsx)(o,{compact:!0,title:`No scripts yet.`,body:`Add analytics, a tag manager, ad tracking or a chat widget. Nothing loads until you publish.`,actions:(0,X.jsx)(b,{variant:`primary`,icon:`plus`,onClick:n,children:`Add a script`})}):(0,X.jsx)(`div`,{className:`kit-scripts`,ref:l,children:s.map((t,n)=>(0,X.jsx)(Ke,{index:n,total:s.length,open:e.has(n),warned:r.has(n),drag:d,onToggle:p,onMove:u,onRemove:f},n))})}function $e({siteId:t,entry:n}){let r=z(e=>e.detail?.name??`Site`),i=z(e=>e.detail?.model.collections.find(e=>e.id===`pages`)?.url??null);L({crumbs:[{label:r,to:`/sites/${t}`},{label:`Scripts`}],...n.status===`modified`?{tag:{label:`Edited`,tone:`change`}}:n.status===`added`?{tag:{label:`New`,tone:`insert`}}:{}});let a=te(),o=j(),s=I(),c=z(e=>e.detail?.model),l=ve(e=>e.outside),[u,d]=(0,B.useState)(!1),[f,p]=(0,B.useState)(()=>new Set),m=(0,B.useMemo)(()=>Pe(a),[a]),h=(0,B.useMemo)(()=>new Set(m.filter(e=>e.tone===`warning`&&e.id!==`no-consent`).flatMap(e=>e.scripts)),[m]),g=(0,B.useMemo)(()=>{let e=a.scripts.flatMap(e=>[...e.include??[],...e.exclude??[]]).map(e=>e.replace(/\*\*?/g,`example`).replace(/\?/g,`x`));return[...new Set([`/`,i?i.replace(`{slug}`,`about`):`/about/`,...e])].slice(0,6)},[a.scripts,i]),_=e=>{let t=a.scripts.length;o.apply(ye($,t,D(e))),p(new Set([t]))},v=m.some(e=>e.id===`no-consent`);return(0,X.jsxs)(`div`,{className:`app-screen kit-scripts-screen`,children:[(0,X.jsxs)(`div`,{className:`app-screen__inner app-screen__inner--wide`,children:[(0,X.jsx)(x,{eyebrow:`Site`,title:`Scripts`,description:`Analytics, tags and widgets the site loads. Adding or changing one is powerful, so every change waits in Proof like any other until you publish.`,actions:(0,X.jsx)(b,{variant:`primary`,icon:`plus`,onClick:()=>d(!0),children:`Add a script`})}),(0,X.jsx)(w,{subject:`scripts`,context:`About the scripts setup in ${n.path}:`,examples:Ze,placeholder:`Add GA4 with ID G-… and only load it after consent`}),(0,X.jsx)(O,{step:`layout`}),(0,X.jsx)(_e,{fields:n.fields,noun:Ce(c,n.collection)}),(0,X.jsx)(ge,{}),l?(0,X.jsxs)(`p`,{className:`g-margin-note kit-note`,role:`status`,children:[(0,X.jsx)(e,{kind:`transpose`}),(0,X.jsx)(`span`,{children:l.origin===`agent`?`The assistant changed the scripts. What it changed is marked for a moment.`:`The scripts setup changed outside the app. This shows the latest version.`})]},l.at):null,m.filter(e=>e.id!==`no-consent`).map(t=>(0,X.jsxs)(`p`,{className:t.tone===`warning`?`g-margin-note kit-note kit-note--warning`:`g-margin-note kit-note`,role:`status`,children:[(0,X.jsx)(e,{kind:t.tone===`warning`?`bang`:`pilcrow`}),(0,X.jsx)(`span`,{children:t.text})]},t.id)),(0,X.jsxs)(`div`,{className:`kit-scripts-layout`,children:[(0,X.jsxs)(`section`,{className:`kit-scripts-layout__main`,"aria-labelledby":`installed-title`,children:[(0,X.jsx)(`h2`,{id:`installed-title`,className:`kit-tab-head__title`,children:`Installed`}),(0,X.jsx)(Qe,{open:f,setOpen:p,onAdd:()=>d(!0),warned:h})]}),(0,X.jsxs)(`div`,{className:`kit-scripts-layout__side`,children:[(0,X.jsx)(Ne,{config:a,trackingWithoutConsent:v}),(0,X.jsx)(Xe,{config:a,suggestions:g})]})]})]}),(0,X.jsx)(Oe,{open:u,onClose:()=>d(!1),taken:a.scripts.map(e=>e.id),allowBuild:s,onAdd:_})]})}function et({siteId:e,siteName:t}){return L({crumbs:[{label:t,to:`/sites/${e}`},{label:`Scripts`}]}),null}function tt(){let{siteId:e=``}=n(),t=z(e=>e.detail),r=t?.name??`Site`,i=t&&t.id===e?Se(t.model):null,o=E(e,i?.path??null),s;if(!t||t.id!==e||i&&o.loading)s=(0,X.jsx)(`div`,{className:`app-screen`,"aria-busy":`true`,children:(0,X.jsxs)(`div`,{className:`app-screen__inner`,children:[(0,X.jsx)(p,{width:120,height:12}),(0,X.jsx)(p,{width:240,height:28,style:{marginBlock:`var(--space-3) var(--space-6)`}}),(0,X.jsx)(p,{lines:5,height:14})]})});else if(!i)s=(0,X.jsx)(`div`,{className:`app-screen`,children:(0,X.jsxs)(`div`,{className:`app-screen__inner`,children:[(0,X.jsx)(x,{eyebrow:`Site`,title:`Scripts`}),(0,X.jsx)(k,{feature:`scripts`})]})});else if(!o.data)s=(0,X.jsx)(`div`,{className:`app-screen app-screen--center`,children:(0,X.jsx)(a,{title:`Couldn’t open the scripts setup`,error:o.error,onRetry:()=>void o.refetch()})});else return(0,X.jsx)(C,{siteId:e,entry:o.data,marksFor:T,children:(0,X.jsxs)(`div`,{className:`kit-screen`,children:[(0,X.jsx)($e,{siteId:e,entry:o.data}),(0,X.jsx)(A,{siteId:e,entryPath:o.data.path})]})},o.data.path);return(0,X.jsxs)(`div`,{className:`kit-screen`,children:[(0,X.jsx)(et,{siteId:e,siteName:r}),s,(0,X.jsx)(A,{siteId:e})]})}export{tt as ScriptsScreen};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{$ as e,At as t,E as n,Ft as r,I as i,N as a,Nt as o,Q as s,St as c,at as l,bt as u,c as d,ft as f,g as p,ht as m,it as h,kt as g,lt as _,nt as v,ot as y,pt as b,st as x,vt as S,z as C}from"./ui-C6O2tW4c.js";import{n as w,s as T}from"./chrome-Brnq5kGb.js";import{f as E}from"./changes-BtRtvJ12.js";import{n as D,t as O}from"./PreviewControls-Du87hOEG.js";import{
|
|
1
|
+
import{$ as e,At as t,E as n,Ft as r,I as i,N as a,Nt as o,Q as s,St as c,at as l,bt as u,c as d,ft as f,g as p,ht as m,it as h,kt as g,lt as _,nt as v,ot as y,pt as b,st as x,vt as S,z as C}from"./ui-C6O2tW4c.js";import{n as w,s as T}from"./chrome-Brnq5kGb.js";import{f as E}from"./changes-BtRtvJ12.js";import{n as D,t as O}from"./PreviewControls-Du87hOEG.js";import{B as k,R as A,z as j}from"./index-CtsAxi5d.js";import{t as M}from"./changes-DLBkrfUR.js";import{r as N,t as P}from"./site-DJUEXLHW.js";import{OnlineCard as F}from"./Online-CS3LLMG4.js";var I=r(o(),1),L=u(),R={added:{label:`New`,tone:`insert`},modified:{label:`Edited`,tone:`change`},deleted:{label:`Deleted`,tone:`delete`}};function z({change:e,actions:t,current:n}){let r=R[e.status];return(0,L.jsxs)(`div`,{className:`g-file app-file`,role:`listitem`,"aria-current":n||void 0,children:[(0,L.jsx)(d,{tone:r.tone,children:r.label}),(0,L.jsxs)(`div`,{className:`g-file__main`,children:[(0,L.jsx)(`span`,{className:`g-file__title`,children:e.title??(e.kind===`media`?y(e.path):x(e.path))}),(0,L.jsxs)(`span`,{className:`g-file__path`,children:[l(e.path),(0,L.jsx)(`b`,{children:y(e.path)}),e.media?` · ${_(e.media)}`:null,e.summary?(0,L.jsxs)(`span`,{className:`app-file__summary`,children:[` · `,e.summary]}):null]})]}),e.binary?(0,L.jsx)(`span`,{className:`g-tally`,children:(0,L.jsx)(`span`,{className:`g-tally__chg`,children:`image`})}):(0,L.jsx)(s,{additions:e.additions,deletions:e.deletions}),t?(0,L.jsx)(`div`,{className:`app-file__actions`,children:t}):(0,L.jsx)(`span`,{})]})}function B({siteId:e}){let t=g(),[r,i]=(0,I.useState)(``),a=n=>{n?.preventDefault();let i=r.trim();t(`/sites/${e}/edit${i?`?ask=${encodeURIComponent(i)}`:``}`)};return(0,L.jsxs)(`form`,{className:`app-ask`,onSubmit:a,children:[(0,L.jsx)(`label`,{className:`app-ask__label`,htmlFor:`home-ask`,children:`What would you like to change?`}),(0,L.jsxs)(`div`,{className:`g-composer`,children:[(0,L.jsx)(`textarea`,{id:`home-ask`,rows:2,placeholder:`Ask for a change… “Add a team member called Sam”, “Shorten the home page heading”`,value:r,onChange:e=>i(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&a()}}),(0,L.jsx)(`button`,{className:`g-btn g-btn--primary g-btn--icon g-btn--sm`,type:`submit`,"aria-label":`Ask the assistant`,children:(0,L.jsx)(`span`,{className:`g-mark g-mark--send`,"aria-hidden":`true`})}),(0,L.jsxs)(`div`,{className:`g-composer__foot`,children:[(0,L.jsx)(n,{keys:[`enter`]}),` opens the editor with your request · nothing changes until you publish`]})]})]})}function V({title:e,action:t,children:n,id:r}){return(0,L.jsxs)(`section`,{className:`app-section`,"aria-labelledby":r,children:[(0,L.jsxs)(`div`,{className:`app-section__head`,children:[(0,L.jsx)(`h2`,{className:`app-section__title`,id:r,children:e}),t]}),n]})}function H({siteId:e}){let{changes:t,status:n,error:r,refresh:o}=M(),s=g(),l=t?.files??[];return(0,L.jsx)(V,{id:`home-pending`,title:`Waiting to publish`,action:l.length>0?(0,L.jsx)(b,{size:`sm`,variant:`secondary`,icon:`proof`,onClick:()=>s(`/sites/${e}/proof`),children:`Review changes`}):null,children:n===`error`&&!t?(0,L.jsx)(i,{compact:!0,title:`Couldn’t check for changes`,error:r,onRetry:()=>void o()}):t?l.length===0?(0,L.jsx)(`div`,{className:`app-card app-card--quiet`,children:(0,L.jsx)(a,{compact:!0,mark:`reg`,title:`Nothing to publish.`,body:`Everything here already matches the live site. Changes you make wait here until you publish.`})}):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`p`,{className:`app-section__lede`,children:[h(l.length,`page or image`,`pages and images`),` changed since the last publish`,E(l)?` — ${E(l)}`:``,`.`]}),(0,L.jsx)(`div`,{className:`app-card`,role:`list`,children:l.slice(0,5).map(t=>(0,L.jsx)(z,{change:t,actions:t.kind===`content`&&t.status!==`deleted`?(0,L.jsx)(c,{className:m(`quiet`,`sm`),to:`/sites/${e}/edit?path=${encodeURIComponent(t.path)}`,children:`Open`}):void 0},t.path))}),l.length>5?(0,L.jsxs)(c,{className:`g-link app-section__more`,to:`/sites/${e}/proof`,children:[`And `,h(l.length-5,`more change`),` in Proof`]}):null]}):(0,L.jsx)(`div`,{className:`app-card`,"aria-busy":`true`,children:[0,1].map(e=>(0,L.jsxs)(`div`,{className:`g-file`,"aria-hidden":`true`,children:[(0,L.jsx)(p,{width:54,height:20,pill:!0}),(0,L.jsx)(p,{width:180,height:12}),(0,L.jsx)(p,{width:40,height:12}),(0,L.jsx)(`span`,{})]},e))})})}function U({siteId:e}){let t=T(k.history(e,4),()=>C(`GET /api/sites/:siteId/history`,{params:{siteId:e},query:{limit:4}})),n=t.data?.items??[];return(0,L.jsx)(V,{id:`home-history`,title:`Recently published`,action:(0,L.jsx)(c,{className:m(`quiet`,`sm`),to:`/sites/${e}/history`,children:`Version history`}),children:t.loading?(0,L.jsx)(`ul`,{className:`app-timeline`,"aria-busy":`true`,children:[0,1,2].map(e=>(0,L.jsxs)(`li`,{className:`app-timeline__item`,children:[(0,L.jsx)(p,{width:220-e*30,height:14}),(0,L.jsx)(p,{width:120,height:11})]},e))}):t.status===`error`&&!t.data?(0,L.jsx)(i,{compact:!0,title:`Couldn’t load recent versions`,error:t.error,onRetry:()=>void t.refetch()}):n.length===0?(0,L.jsx)(`p`,{className:`g-hint`,children:`Nothing published yet. Each publish appears here.`}):(0,L.jsx)(`ul`,{className:`app-timeline`,children:n.map(e=>(0,L.jsxs)(`li`,{className:`app-timeline__item`,children:[(0,L.jsx)(`span`,{className:`app-timeline__message`,children:e.message}),(0,L.jsxs)(`span`,{className:`app-timeline__meta`,children:[e.author,` · `,f(e.date),e.viaGalley?(0,L.jsx)(`span`,{className:`g-sr`,children:` · published from this app`}):null]})]},e.commit))})})}function W({siteId:e}){let t=N(e);return(0,L.jsx)(V,{id:`home-preview`,title:`Preview`,action:(0,L.jsx)(D,{siteId:e}),children:(0,L.jsxs)(`div`,{className:`app-card app-card--pad app-preview-card`,children:[(0,L.jsx)(`p`,{className:`app-preview-card__text`,children:t?.state===`ready`?`Your site is running with your changes, so the editor can show every page as visitors will see it.`:t?.state===`error`?t.detail??`The preview stopped. The site’s own build reported a problem.`:t?.state===`starting`||t?.state===`installing`?t.detail??`Starting the site’s own dev server…`:`The preview runs your site with your changes. It starts when you open the editor, or now.`}),t?.baselineSource?(0,L.jsxs)(`p`,{className:`g-hint`,children:[`Compared against the `,t.baselineSource===`staging`?`staging site`:`live site`,`.`]}):null,(0,L.jsxs)(`div`,{className:`app-preview-card__actions`,children:[(0,L.jsx)(O,{siteId:e}),t?.state===`ready`&&t.url?(0,L.jsxs)(`a`,{className:m(`quiet`,`sm`),href:t.url,target:`_blank`,rel:`noreferrer`,children:[(0,L.jsx)(S,{name:`external`}),`Open in a new tab`]}):null]})]})})}function G(){let{siteId:n=``}=t(),r=P(e=>e.detail);if(w({crumbs:[{label:r?.name??`Site`},{label:`Site home`}]}),!r)return(0,L.jsx)(`div`,{className:`app-screen`,"aria-busy":`true`,children:(0,L.jsxs)(`div`,{className:`app-screen__inner app-screen__inner--wide`,children:[(0,L.jsx)(p,{width:90,height:12}),(0,L.jsx)(p,{width:260,height:30,style:{marginBlock:`var(--space-3) var(--space-8)`}}),(0,L.jsx)(p,{height:96})]})});let{model:i}=r,a=j(i),o=i.framework.version?`${i.framework.name} ${i.framework.version}`:i.framework.name,s=a.filter(e=>e.kind===`entries`).reduce((e,t)=>e+t.count,0);return(0,L.jsx)(`div`,{className:`app-screen`,children:(0,L.jsxs)(`div`,{className:`app-screen__inner app-screen__inner--wide app-home`,children:[(0,L.jsxs)(`header`,{className:`app-home__head`,children:[(0,L.jsxs)(`p`,{className:`g-eyebrow`,children:[o,` site`]}),(0,L.jsx)(`h1`,{className:`app-home__title`,children:r.name}),(0,L.jsxs)(`p`,{className:`app-home__lede`,children:[h(a.length,`collection`),` and `,h(s,`page`),` ready to edit.`,r.git.hasRemote?null:` Its versions are kept on this computer only — not backed up or shared anywhere yet.`]})]}),(0,L.jsx)(B,{siteId:n}),(0,L.jsxs)(`div`,{className:`app-home__grid`,children:[(0,L.jsxs)(`div`,{className:`app-home__main`,children:[(0,L.jsx)(H,{siteId:n}),(0,L.jsxs)(V,{id:`home-found`,title:`What’s on this site`,children:[(0,L.jsx)(`ul`,{className:`app-collections`,children:a.map(e=>(0,L.jsx)(`li`,{children:(0,L.jsxs)(c,{className:`app-collection-row`,to:`/sites/${n}/c/${encodeURIComponent(e.id)}`,children:[(0,L.jsx)(S,{name:A(e)}),(0,L.jsx)(`span`,{className:`app-collection-row__label`,children:e.label}),(0,L.jsx)(`span`,{className:`app-collection-row__path g-mono`,children:e.path}),(0,L.jsx)(`span`,{className:`app-collection-row__count`,children:e.kind===`entries`?h(e.count,e.singular,v(e).many):(0,L.jsx)(d,{mark:null,children:`Settings file`})}),(0,L.jsx)(S,{name:`chevron-right`,className:`app-collection-row__go`})]})},e.id))}),i.notes.length>0?(0,L.jsxs)(`details`,{className:`app-details app-notes`,children:[(0,L.jsx)(`summary`,{children:`How this site was read`}),(0,L.jsx)(`ul`,{children:i.notes.map(t=>(0,L.jsxs)(`li`,{className:`g-margin-note`,children:[(0,L.jsx)(e,{kind:`stet`}),(0,L.jsx)(`span`,{children:t})]},t))})]}):null]})]}),(0,L.jsxs)(`div`,{className:`app-home__side`,children:[(0,L.jsx)(V,{id:`home-online`,title:`Online`,children:(0,L.jsx)(F,{siteId:n})}),(0,L.jsx)(V,{id:`home-import`,title:`Moving from WordPress?`,children:(0,L.jsxs)(`div`,{className:`app-card app-card--pad app-preview-card`,children:[(0,L.jsx)(`p`,{className:`app-preview-card__text`,children:`Bring its posts, pages, images and SEO details here, as changes you check before anything goes live.`}),(0,L.jsx)(`div`,{className:`app-preview-card__actions`,children:(0,L.jsx)(c,{className:m(`secondary`,`sm`),to:`/sites/${n}/import`,children:`Bring your WordPress site`})})]})}),(0,L.jsx)(W,{siteId:n}),(0,L.jsx)(U,{siteId:n})]})]})]})})}export{G as SiteHomeScreen};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{A as e,At as t,Ft as n,H as r,I as i,Nt as a,O as o,St as s,a as c,bt as l,c as u,g as d,gt as f,ht as p,it as m,j as h,n as g,pt as _,ut as v,v as y,z as b}from"./ui-C6O2tW4c.js";import{i as x,r as S}from"./usePlugins-acEOSN5a.js";import{a as C,n as w,o as T,s as E}from"./chrome-Brnq5kGb.js";import{t as D}from"./site-DJUEXLHW.js";import{z as O}from"./index-Djh-DSIT.js";import{OnlineCard as k}from"./Online-bYUu0ETZ.js";import{t as A}from"./hashScroll-CSp59QpH.js";var j=n(a(),1),M=l(),N={anthropic:{title:`Assistant`,what:`The Anthropic API key the assistant uses for this site.`,placeholder:`sk-ant-…`},openai:{title:`Images (OpenAI)`,what:`The OpenAI key image generation uses for this site.`,placeholder:`sk-…`},google:{title:`Images (Google)`,what:`The Google AI key image generation uses for this site.`,placeholder:`AIza…`},cloudflare:{title:`Cloudflare`,what:`The Cloudflare access key used to put this site online.`,placeholder:`Cloudflare API token`},vercel:{title:`Vercel`,what:`The Vercel access key used to put this site online.`,placeholder:`Vercel access token`}},P=e=>[`site`,e,`connections`],F=e=>[`site`,e,`usage`];function I(e){return e.inUse===`site`?`This site’s own key, ending ${e.hint??`…`}`:e.inUse===`env`?`The shared key from the environment, ending ${e.hint??`…`}`:e.inUse===`shared`?`The shared key, ending ${e.hint??`…`}`:`Not set — neither this site nor the app has one`}function L({siteId:e,secret:t,onChange:n}){let[i,a]=(0,j.useState)(!1),[s,c]=(0,j.useState)(``),[l,d]=(0,j.useState)(!1),[f,p]=(0,j.useState)(null),m=N[t.name]??{title:t.name,what:``,placeholder:``},v=async i=>{d(!0),p(null);try{n(await b(`PUT /api/sites/:siteId/secrets/:name`,{params:{siteId:e,name:t.name},body:{value:i}})),a(!1),c(``),g({tone:`success`,title:i?`Saved this site’s own ${m.title.toLowerCase()} key`:`This site uses the shared key again`})}catch(e){p(r(e).message)}finally{d(!1)}};return(0,M.jsxs)(`li`,{className:`sites-conn`,children:[(0,M.jsxs)(`div`,{className:`sites-conn__head`,children:[(0,M.jsx)(`span`,{className:`sites-conn__title`,children:m.title}),(0,M.jsx)(u,{tone:t.inUse===`site`?`accent`:`neutral`,children:t.inUse===`site`?`This site’s own key`:t.inUse?`The shared key`:`Not set`})]}),(0,M.jsx)(`p`,{className:`sites-conn__text`,children:I(t)}),i?(0,M.jsxs)(`form`,{className:`sites-conn__form`,onSubmit:e=>{e.preventDefault(),s.trim()&&v(s.trim())},children:[(0,M.jsx)(h,{label:`This site’s own ${m.title.toLowerCase()} key`,hideLabel:!0,error:f??void 0,hint:m.what,children:(0,M.jsx)(o,{type:`password`,mono:!0,size:`sm`,autoComplete:`off`,spellCheck:!1,value:s,placeholder:m.placeholder,onChange:e=>c(e.target.value),autoFocus:!0})}),(0,M.jsx)(_,{type:`submit`,size:`sm`,variant:`primary`,disabled:!s.trim(),busy:l,busyLabel:`Saving`,children:`Save key`}),(0,M.jsx)(_,{type:`button`,size:`sm`,variant:`quiet`,onClick:()=>(a(!1),c(``),p(null)),children:`Keep as it is`})]}):(0,M.jsxs)(`div`,{className:`sites-conn__actions`,children:[(0,M.jsx)(_,{size:`sm`,variant:`secondary`,onClick:()=>a(!0),children:t.site.configured?`Replace this site’s key…`:`Use a key of this site’s own…`}),t.site.configured?(0,M.jsx)(_,{size:`sm`,variant:`quiet`,busy:l,busyLabel:`Clearing`,onClick:()=>void v(null),children:`Use the shared key`}):null,f?(0,M.jsx)(`span`,{className:`g-error-text`,children:f}):null]})]})}function R({siteId:e,connections:t,onChange:n}){let i=t.author.site,[a,s]=(0,j.useState)(i?.name??``),[c,l]=(0,j.useState)(i?.email??``),[d,f]=(0,j.useState)(!1),[p,m]=(0,j.useState)(!1),[v,y]=(0,j.useState)(null),x=async t=>{m(!0),y(null);try{n(await b(`PUT /api/sites/:siteId/author`,{params:{siteId:e},body:{author:t}})),f(!1),g({tone:`success`,title:t?`Versions of this site will be recorded under that name`:`This site uses the shared author again`})}catch(e){y(r(e).message)}finally{m(!1)}};return(0,M.jsxs)(`li`,{className:`sites-conn`,children:[(0,M.jsxs)(`div`,{className:`sites-conn__head`,children:[(0,M.jsx)(`span`,{className:`sites-conn__title`,children:`Publishing author`}),(0,M.jsx)(u,{tone:t.author.inUse===`site`?`accent`:`neutral`,children:t.author.inUse===`site`?`This site’s own`:`The shared author`})]}),(0,M.jsxs)(`p`,{className:`sites-conn__text`,children:[`Each version published from this site is recorded as `,t.author.name?(0,M.jsx)(`strong`,{children:t.author.name}):`the computer’s own name`,t.author.email?(0,M.jsxs)(`span`,{className:`g-mono`,children:[` <`,t.author.email,`>`]}):null,`.`]}),d?(0,M.jsxs)(`form`,{className:`sites-conn__form sites-conn__form--author`,onSubmit:e=>{e.preventDefault(),x({name:a.trim(),email:c.trim()})},children:[(0,M.jsx)(h,{label:`Name`,children:(0,M.jsx)(o,{size:`sm`,value:a,onChange:e=>s(e.target.value),autoComplete:`name`,autoFocus:!0})}),(0,M.jsx)(h,{label:`Email`,children:(0,M.jsx)(o,{size:`sm`,type:`email`,value:c,onChange:e=>l(e.target.value),autoComplete:`email`})}),(0,M.jsx)(_,{type:`submit`,size:`sm`,variant:`primary`,disabled:!a.trim()||!c.trim(),busy:p,busyLabel:`Saving`,children:`Save author`}),(0,M.jsx)(_,{type:`button`,size:`sm`,variant:`quiet`,onClick:()=>f(!1),children:`Keep as it is`}),v?(0,M.jsx)(`span`,{className:`g-error-text`,children:v}):null]}):(0,M.jsxs)(`div`,{className:`sites-conn__actions`,children:[(0,M.jsx)(_,{size:`sm`,variant:`secondary`,onClick:()=>f(!0),children:i?`Change this site’s author…`:`Use an author of this site’s own…`}),i?(0,M.jsx)(_,{size:`sm`,variant:`quiet`,busy:p,busyLabel:`Clearing`,onClick:()=>void x(null),children:`Use the shared author`}):null]})]})}function z({label:e,totals:t}){return(0,M.jsxs)(`div`,{className:`sites-usage__cell`,children:[(0,M.jsx)(`span`,{className:`g-eyebrow`,children:e}),(0,M.jsx)(`span`,{className:`sites-usage__cost`,children:v(t.cost)}),(0,M.jsxs)(`span`,{className:`g-hint`,children:[m(t.turns,`request`),t.images?` · ${m(t.images,`image`)}`:``]})]})}function B({siteId:e}){let t=E(P(e),()=>b(`GET /api/sites/:siteId/connections`,{params:{siteId:e}})),n=E(F(e),()=>b(`GET /api/sites/:siteId/usage`,{params:{siteId:e}})),r=t=>T(P(e),t),a=[`anthropic`,`openai`,`google`,`cloudflare`,`vercel`];return(0,M.jsxs)(`div`,{className:`app-settings__sections sites-connections`,children:[(0,M.jsxs)(`section`,{className:`app-settings__section`,id:`connections`,children:[(0,M.jsxs)(`header`,{className:`app-settings__section-head`,children:[(0,M.jsx)(`h2`,{className:`app-settings__section-title`,children:`Connections`}),(0,M.jsx)(`p`,{className:`app-settings__section-text`,children:`The keys and the author this site uses. Without its own, a site uses the shared ones from App settings — give a site its own when its client pays for their own use. Keys are kept on this computer only.`})]}),(0,M.jsx)(`div`,{className:`app-settings__section-body`,children:t.loading?(0,M.jsx)(d,{height:220}):t.status===`error`&&!t.data?(0,M.jsx)(i,{compact:!0,title:`Couldn’t load this site’s connections`,error:t.error,onRetry:()=>void t.refetch()}):t.data?(0,M.jsxs)(`ul`,{className:`sites-conns`,children:[[...t.data.secrets].sort((e,t)=>a.indexOf(e.name)-a.indexOf(t.name)).map(t=>(0,M.jsx)(L,{siteId:e,secret:t,onChange:r},t.name)),(0,M.jsx)(R,{siteId:e,connections:t.data,onChange:r},t.data.author.site?.email??`shared`)]}):null})]}),(0,M.jsxs)(`section`,{className:`app-settings__section`,id:`site-usage`,children:[(0,M.jsxs)(`header`,{className:`app-settings__section-head`,children:[(0,M.jsx)(`h2`,{className:`app-settings__section-title`,children:`Assistant use`}),(0,M.jsx)(`p`,{className:`app-settings__section-text`,children:`What the assistant has cost on this site at list prices, whichever key paid for it.`})]}),(0,M.jsx)(`div`,{className:`app-settings__section-body`,children:n.loading?(0,M.jsx)(d,{height:80}):n.data?(0,M.jsxs)(`div`,{className:`sites-usage`,children:[(0,M.jsx)(z,{label:`30 days`,totals:n.data.last30}),(0,M.jsx)(z,{label:`7 days`,totals:n.data.last7}),(0,M.jsx)(z,{label:`All time`,totals:n.data.allTime})]}):(0,M.jsx)(i,{compact:!0,title:`Couldn’t load this site’s use`,error:n.error,onRetry:()=>void n.refetch()})})]})]})}function V({siteId:e}){let t=S(e),n=t.data?.plugins??[],r=n.filter(e=>e.active).length,i=n.filter(e=>e.source===`site`).length,a=n.filter(e=>e.problems.length>0).length;return(0,M.jsxs)(`section`,{className:`app-settings__section`,"aria-labelledby":`site-plugins-title`,children:[(0,M.jsxs)(`header`,{className:`app-settings__section-head`,children:[(0,M.jsx)(`h2`,{className:`app-settings__section-title`,id:`site-plugins-title`,children:`Plugins`}),(0,M.jsx)(`p`,{className:`app-settings__section-text`,children:`What plugins add while this site is open, including any the site itself names.`})]}),(0,M.jsxs)(`div`,{className:`plg-summary`,children:[t.loading?(0,M.jsx)(d,{width:280,height:16}):t.data?(0,M.jsxs)(`p`,{className:`plg-summary__text`,children:[m(r,`plugin`),` active`,i?`, ${i} named by this site`:`, none named by this site`,a?`. ${m(a,`plugin`)} ${a===1?`isn’t`:`aren’t`} working.`:`.`]}):(0,M.jsx)(`p`,{className:`plg-summary__text`,children:`The plugin list can’t be read right now.`}),(0,M.jsx)(s,{className:p(`secondary`,`sm`),to:`/sites/${e}/plugins`,children:`See plugins`})]})]})}function H(e,t,n){let r=structuredClone(e),i=[r],a=r;for(let e of t.slice(0,-1)){let t=a[e];a[e]=t&&typeof t==`object`&&!Array.isArray(t)?t:{},a=a[e],i.push(a)}let o=t[t.length-1];n===void 0||n===``||Array.isArray(n)&&n.length===0?delete a[o]:a[o]=n;for(let e=t.length-2;e>=0;e--){let n=i[e],r=t[e],a=n[r];Object.keys(a).length===0&&delete n[r]}return r}function U({id:e,title:t,description:n,children:r}){return(0,M.jsxs)(`section`,{className:`app-settings__section`,id:e,children:[(0,M.jsxs)(`header`,{className:`app-settings__section-head`,children:[(0,M.jsx)(`h2`,{className:`app-settings__section-title`,children:t}),n?(0,M.jsx)(`p`,{className:`app-settings__section-text`,children:n}):null]}),(0,M.jsx)(`div`,{className:`app-settings__section-body`,children:r})]})}function W({overridden:e,detected:t,onClear:n,hint:r}){return e?(0,M.jsxs)(M.Fragment,{children:[t?(0,M.jsxs)(M.Fragment,{children:[`Detected: `,(0,M.jsx)(`span`,{className:`g-mono`,children:t})]}):`Nothing was detected`,` · `,(0,M.jsx)(`button`,{type:`button`,className:`app-link-button`,onClick:n,children:`Use detected`})]}):r??null}function G({value:e,detected:t,onChange:n}){let r=e??t;return(0,M.jsxs)(`fieldset`,{className:`app-fieldset app-choice-list`,children:[(0,M.jsx)(`legend`,{className:`g-label`,children:`When someone presses Publish`}),[{mode:`commit`,title:`Publish directly`,body:`Pressing Publish makes changes live straight away.`},{mode:`pull-request`,title:`Send for review`,body:`Pressing Publish sends the changes to a developer, who approves them before they go live.`}].map(i=>(0,M.jsxs)(`label`,{className:f(`app-model`,r===i.mode&&`app-model--checked`),children:[(0,M.jsx)(`input`,{type:`radio`,name:`publish-mode`,className:`app-model__radio`,checked:r===i.mode,onChange:()=>n(i.mode===t?void 0:i.mode)}),(0,M.jsxs)(`span`,{className:`app-model__text`,children:[(0,M.jsxs)(`span`,{className:`app-model__name`,children:[i.title,i.mode===t&&e===void 0?(0,M.jsx)(`span`,{className:`g-faint`,children:` · detected`}):null]}),(0,M.jsx)(`span`,{className:`app-model__blurb`,children:i.body})]})]},i.mode))]})}function K({siteId:t,model:n,config:r}){let a=(0,j.useMemo)(()=>r??{},[r]),[s,l]=(0,j.useState)(a),[d,f]=(0,j.useState)(!1),[p,v]=(0,j.useState)(null),[y,S]=(0,j.useState)(a.dev?.port?.toString()??``),[w,E]=(0,j.useState)(null);(0,j.useEffect)(()=>{l(a),S(a.dev?.port?.toString()??``)},[a]);let A=JSON.stringify(s)!==JSON.stringify(a),N=(e,t)=>l(n=>H(n,e,t)),P=async e=>{if(e.preventDefault(),!w){f(!0),v(null);try{let e=await b(`PUT /api/sites/:siteId/config`,{params:{siteId:t},body:{config:s}});T(O.config(t),{config:s,detected:n}),C(O.config(t)),D.getState().refresh(),g({tone:`success`,title:`Settings saved`,body:`The site now has ${m(e.collections.length,`collection`)}. The settings file waits in Proof like any other change.`})}catch(e){v(e)}finally{f(!1)}}},F=s.ai?.instructions;return(0,M.jsxs)(`form`,{className:`app-settings__sections`,onSubmit:P,children:[(0,M.jsxs)(U,{title:`Addresses`,description:`Where the site is published. The staging address powers the side-by-side comparison in the editor and in Proof: your changes beside what’s on staging now.`,children:[(0,M.jsx)(h,{label:`Live site`,fieldKey:`urls.production`,hint:(0,M.jsx)(W,{overridden:s.urls?.production!==void 0,detected:n.urls.production,onClear:()=>N([`urls`,`production`],void 0),hint:`The address visitors use`}),children:(0,M.jsx)(o,{type:`url`,mono:!0,value:s.urls?.production??``,placeholder:n.urls.production??`https://www.example.com`,onChange:e=>N([`urls`,`production`],e.target.value.trim())})}),(0,M.jsx)(h,{label:`Staging site`,fieldKey:`urls.staging`,hint:(0,M.jsx)(W,{overridden:s.urls?.staging!==void 0,detected:n.urls.staging,onClear:()=>N([`urls`,`staging`],void 0),hint:`Optional. Used for comparisons when present; otherwise the live site is used`}),children:(0,M.jsx)(o,{type:`url`,mono:!0,value:s.urls?.staging??``,placeholder:n.urls.staging??`https://staging.example.com`,onChange:e=>N([`urls`,`staging`],e.target.value.trim())})})]}),(0,M.jsx)(U,{title:`Online`,description:`Where the site is put online and whether publishing puts changes live by itself. Saved as it changes.`,children:(0,M.jsx)(k,{siteId:t,variant:`settings`})}),(0,M.jsx)(U,{title:`Publishing`,children:(0,M.jsx)(G,{value:s.publish?.mode,detected:n.publish.mode,onChange:e=>N([`publish`,`mode`],e)})}),(0,M.jsx)(U,{title:`Preview`,description:`How the site’s own dev server is started for the preview.`,children:(0,M.jsxs)(`div`,{className:`app-form-row app-form-row--wide-first`,children:[(0,M.jsx)(h,{label:`Start command`,fieldKey:`dev.command`,hint:(0,M.jsx)(W,{overridden:s.dev?.command!==void 0,detected:n.dev?.command,onClear:()=>N([`dev`,`command`],void 0)}),children:(0,M.jsx)(o,{mono:!0,value:s.dev?.command??``,placeholder:n.dev?.command??`npm run dev`,onChange:e=>N([`dev`,`command`],e.target.value)})}),(0,M.jsx)(h,{label:`Port`,fieldKey:`dev.port`,error:w??void 0,hint:(0,M.jsx)(W,{overridden:s.dev?.port!==void 0,detected:n.dev?.port?.toString(),onClear:()=>{S(``),E(null),N([`dev`,`port`],void 0)}}),children:(0,M.jsx)(o,{mono:!0,inputMode:`numeric`,value:y,placeholder:n.dev?.port?.toString()??`auto`,onChange:e=>{let t=e.target.value.trim();S(e.target.value);let n=Number(t);t&&(!Number.isInteger(n)||n<1||n>65535)?E(`Ports are whole numbers from 1 to 65535.`):(E(null),N([`dev`,`port`],t?n:void 0))}})})]})}),(0,M.jsx)(U,{title:`Media`,children:(0,M.jsxs)(`div`,{className:`app-form-row`,children:[(0,M.jsx)(h,{label:`Folder for new images`,fieldKey:`media.dir`,hint:(0,M.jsx)(W,{overridden:s.media?.dir!==void 0,detected:n.media.dir,onClear:()=>N([`media`,`dir`],void 0)}),children:(0,M.jsx)(o,{mono:!0,value:s.media?.dir??``,placeholder:n.media.dir,onChange:e=>N([`media`,`dir`],e.target.value.trim())})}),(0,M.jsx)(h,{label:`Served from`,fieldKey:`media.publicPath`,hint:(0,M.jsx)(W,{overridden:s.media?.publicPath!==void 0,detected:n.media.publicPath,onClear:()=>N([`media`,`publicPath`],void 0),hint:`The address that folder has on the site`}),children:(0,M.jsx)(o,{mono:!0,value:s.media?.publicPath??``,placeholder:n.media.publicPath,onChange:e=>N([`media`,`publicPath`],e.target.value.trim())})})]})}),(0,M.jsxs)(U,{id:`assistant`,title:`Assistant`,description:`Files the assistant reads before every request, such as a style guide or brand voice. One path per line, from the site’s folder.`,children:[(0,M.jsx)(h,{label:`Instructions files`,fieldKey:`ai.instructions`,hint:(0,M.jsx)(W,{overridden:F!==void 0,detected:n.ai.instructions.join(`, `)||null,onClear:()=>N([`ai`,`instructions`],void 0)}),children:(0,M.jsx)(e,{mono:!0,rows:2,value:(F??[]).join(`
|
|
1
|
+
import{A as e,At as t,Ft as n,H as r,I as i,Nt as a,O as o,St as s,a as c,bt as l,c as u,g as d,gt as f,ht as p,it as m,j as h,n as g,pt as _,ut as v,v as y,z as b}from"./ui-C6O2tW4c.js";import{i as x,r as S}from"./usePlugins-6k3yRVYT.js";import{a as C,n as w,o as T,s as E}from"./chrome-Brnq5kGb.js";import{t as D}from"./site-DJUEXLHW.js";import{B as O}from"./index-CtsAxi5d.js";import{OnlineCard as k}from"./Online-CS3LLMG4.js";import{t as A}from"./hashScroll-CSp59QpH.js";var j=n(a(),1),M=l(),N={anthropic:{title:`Assistant`,what:`The Anthropic API key the assistant uses for this site.`,placeholder:`sk-ant-…`},openai:{title:`Images (OpenAI)`,what:`The OpenAI key image generation uses for this site.`,placeholder:`sk-…`},google:{title:`Images (Google)`,what:`The Google AI key image generation uses for this site.`,placeholder:`AIza…`},cloudflare:{title:`Cloudflare`,what:`The Cloudflare access key used to put this site online.`,placeholder:`Cloudflare API token`},vercel:{title:`Vercel`,what:`The Vercel access key used to put this site online.`,placeholder:`Vercel access token`}},P=e=>[`site`,e,`connections`],F=e=>[`site`,e,`usage`];function I(e){return e.inUse===`site`?`This site’s own key, ending ${e.hint??`…`}`:e.inUse===`env`?`The shared key from the environment, ending ${e.hint??`…`}`:e.inUse===`shared`?`The shared key, ending ${e.hint??`…`}`:`Not set — neither this site nor the app has one`}function L({siteId:e,secret:t,onChange:n}){let[i,a]=(0,j.useState)(!1),[s,c]=(0,j.useState)(``),[l,d]=(0,j.useState)(!1),[f,p]=(0,j.useState)(null),m=N[t.name]??{title:t.name,what:``,placeholder:``},v=async i=>{d(!0),p(null);try{n(await b(`PUT /api/sites/:siteId/secrets/:name`,{params:{siteId:e,name:t.name},body:{value:i}})),a(!1),c(``),g({tone:`success`,title:i?`Saved this site’s own ${m.title.toLowerCase()} key`:`This site uses the shared key again`})}catch(e){p(r(e).message)}finally{d(!1)}};return(0,M.jsxs)(`li`,{className:`sites-conn`,children:[(0,M.jsxs)(`div`,{className:`sites-conn__head`,children:[(0,M.jsx)(`span`,{className:`sites-conn__title`,children:m.title}),(0,M.jsx)(u,{tone:t.inUse===`site`?`accent`:`neutral`,children:t.inUse===`site`?`This site’s own key`:t.inUse?`The shared key`:`Not set`})]}),(0,M.jsx)(`p`,{className:`sites-conn__text`,children:I(t)}),i?(0,M.jsxs)(`form`,{className:`sites-conn__form`,onSubmit:e=>{e.preventDefault(),s.trim()&&v(s.trim())},children:[(0,M.jsx)(h,{label:`This site’s own ${m.title.toLowerCase()} key`,hideLabel:!0,error:f??void 0,hint:m.what,children:(0,M.jsx)(o,{type:`password`,mono:!0,size:`sm`,autoComplete:`off`,spellCheck:!1,value:s,placeholder:m.placeholder,onChange:e=>c(e.target.value),autoFocus:!0})}),(0,M.jsx)(_,{type:`submit`,size:`sm`,variant:`primary`,disabled:!s.trim(),busy:l,busyLabel:`Saving`,children:`Save key`}),(0,M.jsx)(_,{type:`button`,size:`sm`,variant:`quiet`,onClick:()=>(a(!1),c(``),p(null)),children:`Keep as it is`})]}):(0,M.jsxs)(`div`,{className:`sites-conn__actions`,children:[(0,M.jsx)(_,{size:`sm`,variant:`secondary`,onClick:()=>a(!0),children:t.site.configured?`Replace this site’s key…`:`Use a key of this site’s own…`}),t.site.configured?(0,M.jsx)(_,{size:`sm`,variant:`quiet`,busy:l,busyLabel:`Clearing`,onClick:()=>void v(null),children:`Use the shared key`}):null,f?(0,M.jsx)(`span`,{className:`g-error-text`,children:f}):null]})]})}function R({siteId:e,connections:t,onChange:n}){let i=t.author.site,[a,s]=(0,j.useState)(i?.name??``),[c,l]=(0,j.useState)(i?.email??``),[d,f]=(0,j.useState)(!1),[p,m]=(0,j.useState)(!1),[v,y]=(0,j.useState)(null),x=async t=>{m(!0),y(null);try{n(await b(`PUT /api/sites/:siteId/author`,{params:{siteId:e},body:{author:t}})),f(!1),g({tone:`success`,title:t?`Versions of this site will be recorded under that name`:`This site uses the shared author again`})}catch(e){y(r(e).message)}finally{m(!1)}};return(0,M.jsxs)(`li`,{className:`sites-conn`,children:[(0,M.jsxs)(`div`,{className:`sites-conn__head`,children:[(0,M.jsx)(`span`,{className:`sites-conn__title`,children:`Publishing author`}),(0,M.jsx)(u,{tone:t.author.inUse===`site`?`accent`:`neutral`,children:t.author.inUse===`site`?`This site’s own`:`The shared author`})]}),(0,M.jsxs)(`p`,{className:`sites-conn__text`,children:[`Each version published from this site is recorded as `,t.author.name?(0,M.jsx)(`strong`,{children:t.author.name}):`the computer’s own name`,t.author.email?(0,M.jsxs)(`span`,{className:`g-mono`,children:[` <`,t.author.email,`>`]}):null,`.`]}),d?(0,M.jsxs)(`form`,{className:`sites-conn__form sites-conn__form--author`,onSubmit:e=>{e.preventDefault(),x({name:a.trim(),email:c.trim()})},children:[(0,M.jsx)(h,{label:`Name`,children:(0,M.jsx)(o,{size:`sm`,value:a,onChange:e=>s(e.target.value),autoComplete:`name`,autoFocus:!0})}),(0,M.jsx)(h,{label:`Email`,children:(0,M.jsx)(o,{size:`sm`,type:`email`,value:c,onChange:e=>l(e.target.value),autoComplete:`email`})}),(0,M.jsx)(_,{type:`submit`,size:`sm`,variant:`primary`,disabled:!a.trim()||!c.trim(),busy:p,busyLabel:`Saving`,children:`Save author`}),(0,M.jsx)(_,{type:`button`,size:`sm`,variant:`quiet`,onClick:()=>f(!1),children:`Keep as it is`}),v?(0,M.jsx)(`span`,{className:`g-error-text`,children:v}):null]}):(0,M.jsxs)(`div`,{className:`sites-conn__actions`,children:[(0,M.jsx)(_,{size:`sm`,variant:`secondary`,onClick:()=>f(!0),children:i?`Change this site’s author…`:`Use an author of this site’s own…`}),i?(0,M.jsx)(_,{size:`sm`,variant:`quiet`,busy:p,busyLabel:`Clearing`,onClick:()=>void x(null),children:`Use the shared author`}):null]})]})}function z({label:e,totals:t}){return(0,M.jsxs)(`div`,{className:`sites-usage__cell`,children:[(0,M.jsx)(`span`,{className:`g-eyebrow`,children:e}),(0,M.jsx)(`span`,{className:`sites-usage__cost`,children:v(t.cost)}),(0,M.jsxs)(`span`,{className:`g-hint`,children:[m(t.turns,`request`),t.images?` · ${m(t.images,`image`)}`:``]})]})}function B({siteId:e}){let t=E(P(e),()=>b(`GET /api/sites/:siteId/connections`,{params:{siteId:e}})),n=E(F(e),()=>b(`GET /api/sites/:siteId/usage`,{params:{siteId:e}})),r=t=>T(P(e),t),a=[`anthropic`,`openai`,`google`,`cloudflare`,`vercel`];return(0,M.jsxs)(`div`,{className:`app-settings__sections sites-connections`,children:[(0,M.jsxs)(`section`,{className:`app-settings__section`,id:`connections`,children:[(0,M.jsxs)(`header`,{className:`app-settings__section-head`,children:[(0,M.jsx)(`h2`,{className:`app-settings__section-title`,children:`Connections`}),(0,M.jsx)(`p`,{className:`app-settings__section-text`,children:`The keys and the author this site uses. Without its own, a site uses the shared ones from App settings — give a site its own when its client pays for their own use. Keys are kept on this computer only.`})]}),(0,M.jsx)(`div`,{className:`app-settings__section-body`,children:t.loading?(0,M.jsx)(d,{height:220}):t.status===`error`&&!t.data?(0,M.jsx)(i,{compact:!0,title:`Couldn’t load this site’s connections`,error:t.error,onRetry:()=>void t.refetch()}):t.data?(0,M.jsxs)(`ul`,{className:`sites-conns`,children:[[...t.data.secrets].sort((e,t)=>a.indexOf(e.name)-a.indexOf(t.name)).map(t=>(0,M.jsx)(L,{siteId:e,secret:t,onChange:r},t.name)),(0,M.jsx)(R,{siteId:e,connections:t.data,onChange:r},t.data.author.site?.email??`shared`)]}):null})]}),(0,M.jsxs)(`section`,{className:`app-settings__section`,id:`site-usage`,children:[(0,M.jsxs)(`header`,{className:`app-settings__section-head`,children:[(0,M.jsx)(`h2`,{className:`app-settings__section-title`,children:`Assistant use`}),(0,M.jsx)(`p`,{className:`app-settings__section-text`,children:`What the assistant has cost on this site at list prices, whichever key paid for it.`})]}),(0,M.jsx)(`div`,{className:`app-settings__section-body`,children:n.loading?(0,M.jsx)(d,{height:80}):n.data?(0,M.jsxs)(`div`,{className:`sites-usage`,children:[(0,M.jsx)(z,{label:`30 days`,totals:n.data.last30}),(0,M.jsx)(z,{label:`7 days`,totals:n.data.last7}),(0,M.jsx)(z,{label:`All time`,totals:n.data.allTime})]}):(0,M.jsx)(i,{compact:!0,title:`Couldn’t load this site’s use`,error:n.error,onRetry:()=>void n.refetch()})})]})]})}function V({siteId:e}){let t=S(e),n=t.data?.plugins??[],r=n.filter(e=>e.active).length,i=n.filter(e=>e.source===`site`).length,a=n.filter(e=>e.problems.length>0).length;return(0,M.jsxs)(`section`,{className:`app-settings__section`,"aria-labelledby":`site-plugins-title`,children:[(0,M.jsxs)(`header`,{className:`app-settings__section-head`,children:[(0,M.jsx)(`h2`,{className:`app-settings__section-title`,id:`site-plugins-title`,children:`Plugins`}),(0,M.jsx)(`p`,{className:`app-settings__section-text`,children:`What plugins add while this site is open, including any the site itself names.`})]}),(0,M.jsxs)(`div`,{className:`plg-summary`,children:[t.loading?(0,M.jsx)(d,{width:280,height:16}):t.data?(0,M.jsxs)(`p`,{className:`plg-summary__text`,children:[m(r,`plugin`),` active`,i?`, ${i} named by this site`:`, none named by this site`,a?`. ${m(a,`plugin`)} ${a===1?`isn’t`:`aren’t`} working.`:`.`]}):(0,M.jsx)(`p`,{className:`plg-summary__text`,children:`The plugin list can’t be read right now.`}),(0,M.jsx)(s,{className:p(`secondary`,`sm`),to:`/sites/${e}/plugins`,children:`See plugins`})]})]})}function H(e,t,n){let r=structuredClone(e),i=[r],a=r;for(let e of t.slice(0,-1)){let t=a[e];a[e]=t&&typeof t==`object`&&!Array.isArray(t)?t:{},a=a[e],i.push(a)}let o=t[t.length-1];n===void 0||n===``||Array.isArray(n)&&n.length===0?delete a[o]:a[o]=n;for(let e=t.length-2;e>=0;e--){let n=i[e],r=t[e],a=n[r];Object.keys(a).length===0&&delete n[r]}return r}function U({id:e,title:t,description:n,children:r}){return(0,M.jsxs)(`section`,{className:`app-settings__section`,id:e,children:[(0,M.jsxs)(`header`,{className:`app-settings__section-head`,children:[(0,M.jsx)(`h2`,{className:`app-settings__section-title`,children:t}),n?(0,M.jsx)(`p`,{className:`app-settings__section-text`,children:n}):null]}),(0,M.jsx)(`div`,{className:`app-settings__section-body`,children:r})]})}function W({overridden:e,detected:t,onClear:n,hint:r}){return e?(0,M.jsxs)(M.Fragment,{children:[t?(0,M.jsxs)(M.Fragment,{children:[`Detected: `,(0,M.jsx)(`span`,{className:`g-mono`,children:t})]}):`Nothing was detected`,` · `,(0,M.jsx)(`button`,{type:`button`,className:`app-link-button`,onClick:n,children:`Use detected`})]}):r??null}function G({value:e,detected:t,onChange:n}){let r=e??t;return(0,M.jsxs)(`fieldset`,{className:`app-fieldset app-choice-list`,children:[(0,M.jsx)(`legend`,{className:`g-label`,children:`When someone presses Publish`}),[{mode:`commit`,title:`Publish directly`,body:`Pressing Publish makes changes live straight away.`},{mode:`pull-request`,title:`Send for review`,body:`Pressing Publish sends the changes to a developer, who approves them before they go live.`}].map(i=>(0,M.jsxs)(`label`,{className:f(`app-model`,r===i.mode&&`app-model--checked`),children:[(0,M.jsx)(`input`,{type:`radio`,name:`publish-mode`,className:`app-model__radio`,checked:r===i.mode,onChange:()=>n(i.mode===t?void 0:i.mode)}),(0,M.jsxs)(`span`,{className:`app-model__text`,children:[(0,M.jsxs)(`span`,{className:`app-model__name`,children:[i.title,i.mode===t&&e===void 0?(0,M.jsx)(`span`,{className:`g-faint`,children:` · detected`}):null]}),(0,M.jsx)(`span`,{className:`app-model__blurb`,children:i.body})]})]},i.mode))]})}function K({siteId:t,model:n,config:r}){let a=(0,j.useMemo)(()=>r??{},[r]),[s,l]=(0,j.useState)(a),[d,f]=(0,j.useState)(!1),[p,v]=(0,j.useState)(null),[y,S]=(0,j.useState)(a.dev?.port?.toString()??``),[w,E]=(0,j.useState)(null);(0,j.useEffect)(()=>{l(a),S(a.dev?.port?.toString()??``)},[a]);let A=JSON.stringify(s)!==JSON.stringify(a),N=(e,t)=>l(n=>H(n,e,t)),P=async e=>{if(e.preventDefault(),!w){f(!0),v(null);try{let e=await b(`PUT /api/sites/:siteId/config`,{params:{siteId:t},body:{config:s}});T(O.config(t),{config:s,detected:n}),C(O.config(t)),D.getState().refresh(),g({tone:`success`,title:`Settings saved`,body:`The site now has ${m(e.collections.length,`collection`)}. The settings file waits in Proof like any other change.`})}catch(e){v(e)}finally{f(!1)}}},F=s.ai?.instructions;return(0,M.jsxs)(`form`,{className:`app-settings__sections`,onSubmit:P,children:[(0,M.jsxs)(U,{title:`Addresses`,description:`Where the site is published. The staging address powers the side-by-side comparison in the editor and in Proof: your changes beside what’s on staging now.`,children:[(0,M.jsx)(h,{label:`Live site`,fieldKey:`urls.production`,hint:(0,M.jsx)(W,{overridden:s.urls?.production!==void 0,detected:n.urls.production,onClear:()=>N([`urls`,`production`],void 0),hint:`The address visitors use`}),children:(0,M.jsx)(o,{type:`url`,mono:!0,value:s.urls?.production??``,placeholder:n.urls.production??`https://www.example.com`,onChange:e=>N([`urls`,`production`],e.target.value.trim())})}),(0,M.jsx)(h,{label:`Staging site`,fieldKey:`urls.staging`,hint:(0,M.jsx)(W,{overridden:s.urls?.staging!==void 0,detected:n.urls.staging,onClear:()=>N([`urls`,`staging`],void 0),hint:`Optional. Used for comparisons when present; otherwise the live site is used`}),children:(0,M.jsx)(o,{type:`url`,mono:!0,value:s.urls?.staging??``,placeholder:n.urls.staging??`https://staging.example.com`,onChange:e=>N([`urls`,`staging`],e.target.value.trim())})})]}),(0,M.jsx)(U,{title:`Online`,description:`Where the site is put online and whether publishing puts changes live by itself. Saved as it changes.`,children:(0,M.jsx)(k,{siteId:t,variant:`settings`})}),(0,M.jsx)(U,{title:`Publishing`,children:(0,M.jsx)(G,{value:s.publish?.mode,detected:n.publish.mode,onChange:e=>N([`publish`,`mode`],e)})}),(0,M.jsx)(U,{title:`Preview`,description:`How the site’s own dev server is started for the preview.`,children:(0,M.jsxs)(`div`,{className:`app-form-row app-form-row--wide-first`,children:[(0,M.jsx)(h,{label:`Start command`,fieldKey:`dev.command`,hint:(0,M.jsx)(W,{overridden:s.dev?.command!==void 0,detected:n.dev?.command,onClear:()=>N([`dev`,`command`],void 0)}),children:(0,M.jsx)(o,{mono:!0,value:s.dev?.command??``,placeholder:n.dev?.command??`npm run dev`,onChange:e=>N([`dev`,`command`],e.target.value)})}),(0,M.jsx)(h,{label:`Port`,fieldKey:`dev.port`,error:w??void 0,hint:(0,M.jsx)(W,{overridden:s.dev?.port!==void 0,detected:n.dev?.port?.toString(),onClear:()=>{S(``),E(null),N([`dev`,`port`],void 0)}}),children:(0,M.jsx)(o,{mono:!0,inputMode:`numeric`,value:y,placeholder:n.dev?.port?.toString()??`auto`,onChange:e=>{let t=e.target.value.trim();S(e.target.value);let n=Number(t);t&&(!Number.isInteger(n)||n<1||n>65535)?E(`Ports are whole numbers from 1 to 65535.`):(E(null),N([`dev`,`port`],t?n:void 0))}})})]})}),(0,M.jsx)(U,{title:`Media`,children:(0,M.jsxs)(`div`,{className:`app-form-row`,children:[(0,M.jsx)(h,{label:`Folder for new images`,fieldKey:`media.dir`,hint:(0,M.jsx)(W,{overridden:s.media?.dir!==void 0,detected:n.media.dir,onClear:()=>N([`media`,`dir`],void 0)}),children:(0,M.jsx)(o,{mono:!0,value:s.media?.dir??``,placeholder:n.media.dir,onChange:e=>N([`media`,`dir`],e.target.value.trim())})}),(0,M.jsx)(h,{label:`Served from`,fieldKey:`media.publicPath`,hint:(0,M.jsx)(W,{overridden:s.media?.publicPath!==void 0,detected:n.media.publicPath,onClear:()=>N([`media`,`publicPath`],void 0),hint:`The address that folder has on the site`}),children:(0,M.jsx)(o,{mono:!0,value:s.media?.publicPath??``,placeholder:n.media.publicPath,onChange:e=>N([`media`,`publicPath`],e.target.value.trim())})})]})}),(0,M.jsxs)(U,{id:`assistant`,title:`Assistant`,description:`Files the assistant reads before every request, such as a style guide or brand voice. One path per line, from the site’s folder.`,children:[(0,M.jsx)(h,{label:`Instructions files`,fieldKey:`ai.instructions`,hint:(0,M.jsx)(W,{overridden:F!==void 0,detected:n.ai.instructions.join(`, `)||null,onClear:()=>N([`ai`,`instructions`],void 0)}),children:(0,M.jsx)(e,{mono:!0,rows:2,value:(F??[]).join(`
|
|
2
2
|
`),placeholder:n.ai.instructions.join(`
|
|
3
3
|
`)||`CONTENT-GUIDE.md`,onChange:e=>N([`ai`,`instructions`],e.target.value.split(`
|
|
4
4
|
`).map(e=>e.trim()).filter(Boolean))})}),(0,M.jsx)(c,{checked:s.ai?.allowBuild??n.ai.allowBuild,onChange:e=>N([`ai`,`allowBuild`],e===n.ai.allowBuild&&s.ai?.allowBuild===void 0?void 0:e),label:`Allow build mode`,description:`Lets the assistant change the site’s design and code — layouts, components, styles — not just pages and images. Leave off for editors.`})]}),(0,M.jsx)(U,{title:`Settings file`,description:`What’s saved: only what differs from what was detected. It lives at the root of the site and is published with it.`,children:(0,M.jsxs)(`div`,{className:`app-config-file`,children:[(0,M.jsxs)(`div`,{className:`app-config-file__head`,children:[(0,M.jsx)(`span`,{className:`g-mono`,children:x.configFile}),A?(0,M.jsx)(u,{tone:`change`,children:`Not saved`}):r?(0,M.jsx)(u,{tone:`success`,children:`Saved`}):(0,M.jsx)(u,{mark:null,children:`Not created yet`})]}),(0,M.jsx)(`pre`,{className:`app-config-file__body`,"aria-label":`Settings file contents`,children:Object.keys(s).length>0?JSON.stringify(s,null,2):`{} — everything comes from what was detected`})]})}),p?(0,M.jsx)(i,{compact:!0,title:`Couldn’t save the settings`,error:p}):null,(0,M.jsxs)(`div`,{className:`app-savebar`,children:[(0,M.jsx)(`span`,{className:`g-hint`,children:A?`You have unsaved settings.`:`Everything is saved.`}),(0,M.jsx)(_,{variant:`quiet`,disabled:!A||d,onClick:()=>{l(a),S(a.dev?.port?.toString()??``),E(null)},children:`Reset`}),(0,M.jsx)(_,{type:`submit`,variant:`primary`,disabled:!A||!!w,busy:d,busyLabel:`Saving`,children:`Save settings`})]})]})}function q(){let{siteId:e=``}=t();w({crumbs:[{label:`Settings`}]});let n=D(e=>e.detail),a=E(O.config(e),()=>b(`GET /api/sites/:siteId/config`,{params:{siteId:e}}));A(!!a.data);let[o,s]=(0,j.useState)(!1),c=async()=>{s(!0);try{let t=await b(`POST /api/sites/:siteId/refresh`,{params:{siteId:e}});await D.getState().refresh(),C(O.site(e)),g({tone:`success`,title:`Site read again`,body:`Found ${m(t.collections.length,`collection`)} with ${m(t.collections.reduce((e,t)=>e+(t.kind===`entries`?t.count:0),0),`page`)}.`})}catch(e){g({tone:`danger`,title:`Couldn’t read the site again`,body:r(e).message,detail:r(e).detail})}finally{s(!1)}};return(0,M.jsx)(`div`,{className:`app-screen`,children:(0,M.jsxs)(`div`,{className:`app-screen__inner`,children:[(0,M.jsx)(y,{title:`Site settings`,description:`Everything here was worked out from the site itself. Change only what needs correcting; empty fields keep the detected value shown in grey.`,actions:(0,M.jsx)(_,{variant:`secondary`,icon:`refresh`,busy:o,busyLabel:`Reading the site`,onClick:()=>void c(),children:`Detect again`})}),!n||a.loading?(0,M.jsx)(`div`,{"aria-busy":`true`,children:[0,1,2].map(e=>(0,M.jsx)(d,{height:120,style:{marginBlockEnd:`var(--space-6)`}},e))}):a.status===`error`&&!a.data?(0,M.jsx)(i,{title:`Couldn’t read the site’s settings file`,error:a.error,onRetry:()=>void a.refetch()}):(0,M.jsx)(K,{siteId:e,model:a.data?.detected??n.model,config:a.data?.config??null}),n?(0,M.jsx)(B,{siteId:e}):null,n?(0,M.jsx)(V,{siteId:e}):null]})})}export{q as SiteSettingsScreen};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{$ as e,Ft as t,H as n,I as r,Nt as i,bt as a}from"./ui-C6O2tW4c.js";import{a as o}from"./EditorScreen-
|
|
1
|
+
import{$ as e,Ft as t,H as n,I as r,Nt as i,bt as a}from"./ui-C6O2tW4c.js";import{a as o}from"./EditorScreen-CG30ospj.js";import{v as s}from"./outside-Bv1jj3yu.js";var c=t(i(),1),l=a(),u=800;function d(e){return e===`json`?`json`:e===`yaml`||e===`toml`?`yaml`:`frontmatter`}function f({raw:t,format:i}){let{store:a}=s(),[f,p]=(0,c.useState)(t),[m,h]=(0,c.useState)({kind:`idle`}),g=(0,c.useRef)(null),_=(0,c.useRef)(f);_.current=f;let v=async e=>{h({kind:`saving`});try{let t=(await a.actions.saveRaw(e)).refused[0];h(t?{kind:`unreadable`,detail:t.reason}:{kind:`saved`})}catch(e){h({kind:`failed`,error:e})}};return(0,c.useEffect)(()=>()=>{g.current&&(clearTimeout(g.current),a.actions.saveRaw(_.current))},[a]),(0,l.jsxs)(`div`,{className:`app-source`,children:[(0,l.jsxs)(`p`,{className:`g-margin-note app-source__note`,children:[(0,l.jsx)(e,{kind:`stet`}),(0,l.jsx)(`span`,{children:`The whole file, as text. Changes save as you type; the form picks them up when you go back.`})]}),m.kind===`unreadable`?(0,l.jsx)(r,{compact:!0,title:`This can’t be read yet, so the last change isn’t saved`,message:`Check the line it points to — often a missing quote, colon or indent. The form keeps the last version that could be read.`,detail:m.detail}):null,m.kind===`failed`?(0,l.jsx)(r,{compact:!0,title:`Couldn’t save the file`,error:m.error,message:`${n(m.error).message} What you typed is still here.`,onRetry:()=>void v(_.current)}):null,(0,l.jsx)(o,{value:f,language:d(i),label:`File source`,className:`app-source__editor`,onChange:e=>{p(e),g.current&&clearTimeout(g.current),g.current=setTimeout(()=>{g.current=null,v(e)},u)}}),(0,l.jsx)(`p`,{className:`app-source__status g-hint`,role:`status`,children:m.kind===`saving`?`Saving…`:m.kind===`saved`?`Saved`:``})]})}export{f as SourceView};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{At as e,Ft as t,I as n,N as r,Nt as i,St as a,_ as o,bt as s,c,g as l,k as u,n as d,pt as f,v as p,vt as m,z as h}from"./ui-C6O2tW4c.js";import{c as g,i as _,l as v,n as y,o as b,r as x,s as S,t as C,u as w}from"./useVisibility-kpZhLMTT.js";import{n as T,o as E,s as D}from"./chrome-Brnq5kGb.js";import{n as O,r as k,t as A}from"./site-DJUEXLHW.js";import{
|
|
1
|
+
import{At as e,Ft as t,I as n,N as r,Nt as i,St as a,_ as o,bt as s,c,g as l,k as u,n as d,pt as f,v as p,vt as m,z as h}from"./ui-C6O2tW4c.js";import{c as g,i as _,l as v,n as y,o as b,r as x,s as S,t as C,u as w}from"./useVisibility-kpZhLMTT.js";import{n as T,o as E,s as D}from"./chrome-Brnq5kGb.js";import{n as O,r as k,t as A}from"./site-DJUEXLHW.js";import{F as j}from"./index-CtsAxi5d.js";var M=t(i(),1),N={titles:`Titles & descriptions`,content:`Headings & content`,images:`Images`,links:`Links`,indexing:`Indexing`,structured:`Structured data`,ai:`AI visibility`},P=[`titles`,`content`,`images`,`links`,`indexing`,`structured`,`ai`],F=s(),I={search:`Answers with links`,training:`Model training`,user:`Fetches for a person`,dataset:`Open archive`},L=[{value:`allow`,label:`Allow`},{value:`block`,label:`Block`}];function R({crawler:e,value:t,editable:n,onChange:r}){return(0,F.jsxs)(`li`,{className:`seo-crawler`,children:[(0,F.jsxs)(`div`,{className:`seo-crawler__control`,children:[(0,F.jsxs)(`span`,{className:`seo-crawler__name`,children:[e.label,(0,F.jsx)(`span`,{className:`seo-crawler__purpose`,children:I[e.purpose]})]}),n?(0,F.jsx)(o,{label:`${e.label}`,options:L,value:t,onChange:r}):(0,F.jsx)(`span`,{className:`seo-crawler__state`,"data-allowed":t===`allow`,children:t===`allow`?`Allowed`:`Blocked`})]}),(0,F.jsxs)(`details`,{className:`seo-crawler__more`,children:[(0,F.jsxs)(`summary`,{children:[`What it does · `,(0,F.jsx)(`span`,{className:`g-mono`,children:e.token})]}),(0,F.jsx)(`p`,{className:`seo-crawler__what`,children:e.what}),(0,F.jsxs)(`p`,{className:`seo-crawler__if`,children:[`If blocked: `,e.ifBlocked,` `,(0,F.jsxs)(`a`,{href:e.source.url,target:`_blank`,rel:`noreferrer`,className:`g-link`,children:[e.vendor,`’s page`,(0,F.jsx)(m,{name:`external`,size:12})]})]}),e.caveat?(0,F.jsx)(`p`,{className:`seo-crawler__caveat`,children:e.caveat}):null]})]})}function z({siteId:e,report:t,onSaved:n}){let r=(0,M.useMemo)(()=>Object.fromEntries(t.crawlers.map(e=>[e.token,e.allowed?`allow`:`block`])),[t]),[i,a]=(0,M.useState)(r),[o,s]=(0,M.useState)(!1),c=Object.keys(i).filter(e=>i[e]!==r[e]),l=[...new Set(t.crawlers.map(e=>e.vendor))];(0,M.useEffect)(()=>a(r),[r]);let u=async()=>{s(!0);try{n(await h(`PUT /api/sites/:siteId/visibility/crawlers`,{params:{siteId:e},body:{choices:Object.fromEntries(c.map(e=>[e,i[e]]))}})),d({tone:`success`,title:`Crawler rules changed`,body:t.where.kind===`kit`?`The change to the crawler choices is waiting in Proof. The site writes them into robots.txt once you publish.`:`The new robots.txt is waiting in Proof. Crawlers see it once you publish.`})}catch(e){d({tone:`danger`,title:`Couldn’t change the crawler rules`,body:e instanceof Error?e.message:String(e)})}finally{s(!1)}};return(0,F.jsxs)(`section`,{className:`app-card seo-panel`,"aria-labelledby":`seo-crawlers-title`,children:[(0,F.jsxs)(`header`,{className:`seo-panel__head`,children:[(0,F.jsx)(`h2`,{id:`seo-crawlers-title`,className:`seo-panel__title`,children:`AI crawlers`}),(0,F.jsx)(`p`,{className:`seo-panel__lede`,children:`Search crawlers decide whether AI assistants can find and link to this site; training crawlers decide whether its pages may train models. Blocking one isn’t blocking the other. Following these rules is up to each crawler: reputable ones say they do.`})]}),t.where.kind===`kit`?(0,F.jsxs)(`p`,{className:`seo-panel__note`,children:[t.policy,` These choices are kept in `,(0,F.jsx)(`span`,{className:`g-mono`,children:t.where.path}),`; the site writes robots.txt from them each time it is built.`]}):null,(0,F.jsx)(`ul`,{className:`seo-panel__summary`,children:t.summary.map(e=>(0,F.jsx)(`li`,{children:e},e))}),t.readable?l.map(e=>(0,F.jsxs)(`div`,{className:`seo-crawlers`,children:[(0,F.jsx)(`h3`,{className:`seo-crawlers__vendor`,children:e}),(0,F.jsx)(`ul`,{className:`seo-crawlers__list`,children:t.crawlers.filter(t=>t.vendor===e).map(e=>(0,F.jsx)(R,{crawler:e,value:i[e.token]??`allow`,editable:t.editable,onChange:t=>a({...i,[e.token]:t})},e.token))})]},e)):null,t.editNote?(0,F.jsx)(`p`,{className:`seo-panel__note`,children:t.editNote}):null,t.editable&&c.length?(0,F.jsxs)(`div`,{className:`seo-panel__foot`,children:[(0,F.jsx)(f,{variant:`secondary`,size:`sm`,onClick:()=>a(r),children:`Keep as it is`}),(0,F.jsxs)(f,{variant:`primary`,size:`sm`,busy:o,busyLabel:`Saving…`,onClick:()=>void u(),children:[`Change `,c.length===1?`1 rule`:`${c.length} rules`]})]}):null]})}function B(e){return e===`/`?`/index.md`:`${e.replace(/\/$/,``)}.md`}function V({siteId:e,report:t}){let n=A(e=>e.detail?.model.collections),r=(0,M.useMemo)(()=>(n??[]).filter(e=>e.kind===`entries`&&e.url),[n]),i=D([`site`,e,`visibility`,`pages`,r.map(e=>e.id).join(`,`)],async()=>(await Promise.all(r.slice(0,4).map(t=>h(`GET /api/sites/:siteId/entries`,{params:{siteId:e},query:{collection:t.id,limit:40,sort:`title`}})))).flatMap(e=>e.items).filter(e=>e.url),{enabled:r.length>0}),a=(0,M.useMemo)(()=>(i.data??[]).map(e=>({value:e.url,label:`${e.title} · ${e.url}`})),[i.data]),[o,s]=(0,M.useState)(`/`),c=k(e)?.url??null,p=t.kit?[t.kit.markdownTwins?`a markdown version of every page`:null,t.kit.llmsTxt?`llms.txt`:null,t.kit.llmsFullTxt?`llms-full.txt (the whole site in one file)`:null,t.kit.agentPage?`agent.md (a short guide for agents)`:null].filter(e=>e!==null):[],[g,_]=(0,M.useState)(null),[v,y]=(0,M.useState)(!1),b=async()=>{y(!0);try{_(await h(`GET /api/sites/:siteId/visibility/agent-view`,{params:{siteId:e},query:{url:o}}))}catch(e){d({tone:`danger`,title:`Couldn’t read that page`,body:e instanceof Error?e.message:String(e)})}finally{y(!1)}};return(0,F.jsxs)(`section`,{className:`app-card seo-panel`,"aria-labelledby":`seo-agent-title`,children:[(0,F.jsxs)(`header`,{className:`seo-panel__head`,children:[(0,F.jsx)(`h2`,{id:`seo-agent-title`,className:`seo-panel__title`,children:`What an AI agent reads`}),(0,F.jsx)(`p`,{className:`seo-panel__lede`,children:t.kit?t.summary.split(`${t.kit.file}. `)[1]??t.summary:t.summary})]}),t.kit?(0,F.jsxs)(`p`,{className:`seo-panel__note`,children:[p.length?`This site publishes ${p.join(`, `)}, set in `:`This site is set to publish no agent-readable version, in `,(0,F.jsx)(`span`,{className:`g-mono`,children:t.kit.file}),`.`,` `,c?(0,F.jsxs)(F.Fragment,{children:[`In the preview:`,` `,(0,F.jsxs)(`a`,{className:`g-link`,href:`${c}/llms.txt`,target:`_blank`,rel:`noreferrer`,children:[`llms.txt`,(0,F.jsx)(m,{name:`external`,size:12})]}),` `,`·`,` `,(0,F.jsxs)(`a`,{className:`g-link`,href:`${c}${B(o)}`,target:`_blank`,rel:`noreferrer`,children:[`this page’s markdown version`,(0,F.jsx)(m,{name:`external`,size:12})]})]}):`Start the preview to open them.`]}):null,(0,F.jsxs)(`p`,{className:`seo-panel__small`,children:[t.kit?``:`An agent-readable version is an llms.txt file and a plain-text copy of each page. `,`Google says its search doesn’t use them, and so far there is little evidence that other AI systems read them. Offering one is a choice, not a requirement.`,` `,(0,F.jsxs)(`a`,{className:`g-link`,href:`https://llmstxt.org/`,target:`_blank`,rel:`noreferrer`,children:[`The proposal`,(0,F.jsx)(m,{name:`external`,size:12})]})]}),(0,F.jsxs)(`div`,{className:`seo-agent__pick`,children:[a.length?(0,F.jsx)(u,{value:o,onChange:s,options:[{value:`/`,label:`Home page · /`},...a.filter(e=>e.value!==`/`)]}):(0,F.jsx)(l,{height:32}),(0,F.jsx)(f,{variant:`secondary`,size:`sm`,icon:`eye`,busy:v,busyLabel:`Reading…`,onClick:()=>void b(),children:`Show`})]}),g?(0,F.jsxs)(`div`,{className:`seo-agent__view`,children:[(0,F.jsx)(`p`,{className:`seo-panel__small`,children:g.kind===`markdown`?`The page’s own markdown version: ${g.from}.`:g.kind===`text`?`No markdown version, so this is the page’s text as sent, before any script runs — ${g.from}.`:`Read from ${g.from}.`}),(0,F.jsxs)(`pre`,{className:`seo-agent__text`,tabIndex:0,"aria-label":`What an agent receives`,children:[g.text||`(nothing)`,g.truncated?`
|
|
2
2
|
…`:``]})]}):null]})}function H({siteId:e}){let t=A(e=>e.detail?.model.collections.find(j));return t?(0,F.jsxs)(`p`,{className:`g-hint seo-settings-file`,children:[(0,F.jsx)(a,{className:`g-link`,to:`/sites/${e}/edit?path=${encodeURIComponent(t.path)}`,children:`Edit the settings file`}),` `,(0,F.jsx)(`span`,{className:`g-mono`,children:t.path})]}):null}var U={titles:`The title and description people see in search results and AI answers.`,content:`Headings, length and the words on each page.`,images:`Alt text, file sizes and share pictures.`,links:`Links that lead nowhere, and pages nothing links to.`,indexing:`Whether search engines may show each page, and which address they use.`,structured:`Details search engines read to show richer results.`,ai:`What AI crawlers may read, and how plainly the site says who it is.`};function W(e){try{return e?new URL(e).host.replace(/^www\./,``):`your-site`}catch{return`your-site`}}function G({audit:e}){return(0,F.jsx)(`div`,{className:`seo-tally`,role:`group`,"aria-label":`Findings by severity`,children:[`must`,`should`,`idea`].map(t=>(0,F.jsxs)(`div`,{className:`seo-tally__item`,"data-severity":t,children:[(0,F.jsx)(`span`,{className:`seo-tally__value`,children:e.counts[t]}),(0,F.jsx)(`span`,{className:`seo-tally__label`,children:t===`idea`?e.counts.idea===1?`Idea`:`Ideas`:S[t].label})]},t))})}function K({siteId:e,group:t,findings:n,open:r,onToggle:i,connected:a,address:o,fixing:s,onFix:l,onWrite:u}){let d={must:0,should:0,idea:0};for(let e of n)d[e.severity]+=1;let{writes:p,fixes:h}=v(n),y=`seo-group-${t}`;return(0,F.jsxs)(`section`,{className:`app-card seo-group`,"data-open":r||void 0,children:[(0,F.jsx)(`h2`,{className:`seo-group__heading`,children:(0,F.jsxs)(`button`,{type:`button`,className:`seo-group__toggle`,"aria-expanded":r,"aria-controls":y,onClick:i,disabled:n.length===0,children:[(0,F.jsx)(m,{name:r?`chevron-down`:`chevron-right`,className:`seo-group__chevron`}),(0,F.jsxs)(`span`,{className:`seo-group__text`,children:[(0,F.jsx)(`span`,{className:`seo-group__label`,children:N[t]}),(0,F.jsx)(`span`,{className:`seo-group__blurb`,children:U[t]})]}),(0,F.jsx)(`span`,{className:`seo-group__counts`,children:n.length===0?(0,F.jsx)(c,{tone:`success`,children:`In good shape`}):[`must`,`should`,`idea`].filter(e=>d[e]>0).map(e=>(0,F.jsxs)(c,{tone:S[e].tone,children:[d[e],` `,e===`idea`?d.idea===1?`idea`:`ideas`:S[e].label.toLowerCase()]},e))})]})}),r&&n.length?(0,F.jsxs)(`div`,{id:y,className:`seo-group__body`,children:[p.length||h.length>1?(0,F.jsxs)(`div`,{className:`seo-group__batch`,role:`group`,"aria-label":`Do several at once in ${N[t]}`,children:[h.length>1?(0,F.jsxs)(f,{size:`sm`,variant:`secondary`,icon:`check`,busy:h.some(e=>s.has(e.id)),busyLabel:`Fixing…`,onClick:()=>l(h),children:[`Fix all `,h.length]}):null,p.map(e=>(0,F.jsx)(f,{size:`sm`,variant:`secondary`,icon:`chat`,disabled:!a,title:a?`${w(e.count,`request`)} to the assistant, one per page`:`Connect the assistant in App settings first.`,onClick:()=>u(e.kind),children:g[e.kind].many(e.count)},e.kind)),p.length&&!a?(0,F.jsx)(`p`,{className:`seo-group__batch-note`,children:`Connect the assistant in App settings to have it write these. It uses one request per page, and only what each page already says.`}):null]}):null,(0,F.jsx)(`ul`,{className:`seo-findings`,children:n.map(t=>(0,F.jsx)(_,{finding:t,siteId:e,connected:a,fixing:s.has(t.id),onFix:e=>l([e]),onWrite:e=>u(e.write,e.path?[e.path]:void 0),address:`${o}${t.url&&t.url!==`/`?` › ${t.url.split(`/`).filter(Boolean).join(` › `)}`:``}`},t.id))})]}):null]})}function q({siteId:e,audit:t}){let n=k(e),r=O(e=>e.run);return t.rendering.source===`none`?(0,F.jsxs)(`p`,{className:`seo-note seo-note--action`,children:[(0,F.jsx)(m,{name:`eye`}),(0,F.jsx)(`span`,{children:`Only the content files were checked. Start the preview to also check the pages as visitors and crawlers get them: headings, preferred addresses, structured data and the sitemap.`}),(0,F.jsx)(f,{size:`sm`,variant:`secondary`,icon:`play`,busy:n?.state===`starting`||n?.state===`installing`,busyLabel:`Starting…`,onClick:()=>void r(e,`start`),children:`Start the preview`})]}):(0,F.jsxs)(`p`,{className:`seo-note`,children:[(0,F.jsx)(m,{name:`eye`}),` `,t.rendering.detail,` `,t.rendering.sampled<t.rendering.total?`${w(t.rendering.sampled,`page`)} of ${t.rendering.total} were checked as sent.`:``,t.rendering.stale?` Start the preview to check your latest changes.`:``]})}function J({siteId:e,audit:t,refetch:n}){let r=A(e=>e.detail?.model.urls.production),i=D([`settings`],()=>h(`GET /api/settings`)).data?.secrets.some(e=>e.name===`anthropic`&&e.configured)??!1,[a,o]=(0,M.useState)(()=>new Set(P.filter(e=>t.byGroup[e].must+t.byGroup[e].should>0).slice(0,1))),[s,c]=(0,M.useState)(null),{fix:l,busy:u}=C(e,n),d=W(r),f=(0,M.useMemo)(()=>new Map(P.map(e=>[e,t.findings.filter(t=>t.group===e)])),[t.findings]),p=e=>{let t=new Set(a);t.has(e)?t.delete(e):t.add(e),o(t)};return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`div`,{className:`seo-overview`,children:[(0,F.jsx)(G,{audit:t}),(0,F.jsx)(`p`,{className:`seo-overview__summary`,children:t.summary.split(/(?<=\.)\s/)[0]})]}),(0,F.jsx)(q,{siteId:e,audit:t}),(0,F.jsxs)(`div`,{className:`seo-layout`,children:[(0,F.jsxs)(`div`,{className:`seo-layout__main`,children:[P.map(t=>(0,F.jsx)(K,{siteId:e,group:t,findings:f.get(t)??[],open:a.has(t),onToggle:()=>p(t),connected:i,address:d,fixing:u,onFix:e=>void l(e),onWrite:(e,t)=>c({kind:e,...t?{paths:t}:{}})},t)),(0,F.jsx)(`p`,{className:`seo-fineprint`,children:`Each item says whether it is measured on the site, documented by the search engine or AI provider (with a link to their page), or a judgement. Nothing here predicts rankings or whether an AI assistant will quote the site.`})]}),(0,F.jsxs)(`aside`,{className:`seo-layout__side`,"aria-label":`How AI systems see this site`,children:[(0,F.jsx)(`h2`,{className:`seo-side__title`,children:`How AI systems see this site`}),(0,F.jsx)(z,{siteId:e,report:t.crawlers,onSaved:n=>E(x.site(e),{...t,crawlers:n})}),(0,F.jsx)(V,{siteId:e,report:t.agentReadable})]})]}),(0,F.jsx)(b,{siteId:e,open:s!==null,kind:s?.kind??null,...s?.paths?{paths:s.paths}:{},onClose:()=>c(null),onFinished:()=>void n()})]})}function Y(){let{siteId:t=``}=e(),i=A(e=>e.detail?.name??`Site`),a=y(t);T({crumbs:[{label:i,to:`/sites/${t}`},{label:`Search & AI`}]});let o;return o=a.loading?(0,F.jsxs)(`div`,{"aria-busy":`true`,className:`seo-loading`,children:[(0,F.jsx)(l,{height:64}),P.map(e=>(0,F.jsx)(l,{height:56},e))]}):a.data?a.data.pages.checked===0?(0,F.jsx)(r,{title:`Nothing to check yet.`,body:`Once the site has pages, this shows how search engines and AI assistants see them.`}):(0,F.jsx)(J,{siteId:t,audit:a.data,refetch:a.refetch}):(0,F.jsx)(n,{title:`Couldn’t check the site`,error:a.error,onRetry:()=>void a.refetch()}),(0,F.jsx)(`div`,{className:`app-screen seo-screen`,children:(0,F.jsxs)(`div`,{className:`app-screen__inner app-screen__inner--wide`,children:[(0,F.jsx)(p,{eyebrow:`Site`,title:`Search & AI`,description:`How search engines and AI assistants find, read and quote this site — what needs fixing, and ideas worth a look. Fixes wait in Proof like any other change.`,actions:(0,F.jsx)(f,{variant:`secondary`,icon:`refresh`,busy:a.fetching&&!a.loading,busyLabel:`Checking…`,onClick:()=>void a.refetch(),children:`Check again`})}),o,(0,F.jsx)(H,{siteId:t})]})})}export{Y as VisibilityScreen};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{B as e,F as t,I as n,L as r,R as i,V as a,W as o,a as s}from"./codemirror-CWul2x0p.js";import{n as c,r as l,t as u}from"./codemirror-languages-RlWkzgfM.js";import{n as d,r as f,t as p}from"./EditorScreen-
|
|
1
|
+
import{B as e,F as t,I as n,L as r,R as i,V as a,W as o,a as s}from"./codemirror-CWul2x0p.js";import{n as c,r as l,t as u}from"./codemirror-languages-RlWkzgfM.js";import{n as d,r as f,t as p}from"./EditorScreen-CG30ospj.js";function m(e,t){if(e===t)return null;let n=0,r=Math.min(e.length,t.length);for(;n<r&&e.charCodeAt(n)===t.charCodeAt(n);)n++;let i=e.length,a=t.length;for(;i>n&&a>n&&e.charCodeAt(i-1)===t.charCodeAt(a-1);)i--,a--;return{from:n,to:i,insert:t.slice(n,a)}}function h(e){return e.map(([e,n])=>{let a=new r({regexp:e,decoration:t.mark({class:n})});return i.fromClass(class{decorations;constructor(e){this.decorations=a.createDeco(e)}update(e){this.decorations=a.updateDeco(e,this.decorations)}},{decorations:e=>e.decorations})})}var g=[[/^#{1,6} .*$/gm,`app-cm-heading`],[/^>.*$/gm,`app-cm-quote`],[/^\s*(?:[-*+]|\d+[.)])(?=\s)/gm,`app-cm-marker`],[/\*\*[^*\n]+\*\*|__[^_\n]+__/g,`app-cm-strong`],[/(?<![*\w])\*[^*\s][^*\n]*\*(?!\*)|(?<![_\w])_[^_\s][^_\n]*_(?!_)/g,`app-cm-em`],[/`[^`\n]+`/g,`app-cm-code`],[/!?\[[^\]\n]*\]\([^)\n]*\)/g,`app-cm-link`]],_=[[/^---\s*$/gm,`app-cm-marker`],[/^\s*(?:- )?[\w$.-]+(?=:(?:\s|$))/gm,`app-cm-key`],[/"(?:[^"\\\n]|\\.)*"(?=\s*:)/g,`app-cm-key`],[/(?<=^\s*)#.*$/gm,`app-cm-comment`]];function v(e){return e===`json`?[l(),h(_)]:e===`yaml`?[u(),h(_)]:e===`frontmatter`?[c(),h([..._,...g])]:[c(),h(g)]}function y(t){let r=!1,i,c=e=>{let{from:t,to:n}=i.state.selection.main,r=i.state.doc.toString(),a=e(r,t,n),o=m(r,a.text);return i.dispatch({...o?{changes:o}:{},selection:{anchor:a.start,head:a.end},scrollIntoView:!0}),i.focus(),!0},l=t.shortcuts?e.of([{key:`Mod-b`,run:()=>c((e,t,n)=>f(e,t,n,`**`))},{key:`Mod-i`,run:()=>c((e,t,n)=>f(e,t,n,`*`))},{key:`Mod-e`,run:()=>c((e,t,n)=>f(e,t,n,"`"))},{key:`Mod-k`,run:()=>c((e,t,n)=>p(e,t,n))},{key:`Mod-Alt-2`,run:()=>c((e,t,n)=>d(e,t,n,`## `))},{key:`Mod-Alt-3`,run:()=>c((e,t,n)=>d(e,t,n,`### `))},{key:`Mod-Shift-8`,run:()=>c((e,t,n)=>d(e,t,n,`- `))},{key:`Mod-Shift-9`,run:()=>c((e,t,n)=>d(e,t,n,`> `))}]):[];return i=new n({parent:t.parent,state:o.create({doc:t.value,extensions:[l,s,n.lineWrapping,v(t.language),t.placeholder?a(t.placeholder):[],n.contentAttributes.of({"aria-label":t.label,"aria-multiline":`true`,spellcheck:t.language===`markdown`?`true`:`false`}),n.updateListener.of(e=>{e.docChanged&&!r&&t.onChange(e.state.doc.toString()),e.focusChanged&&(e.view.hasFocus?t.onFocus?.():t.onBlur?.())})]})}),{setValue(e){let t=m(i.state.doc.toString(),e);t&&(r=!0,i.dispatch({changes:t}),r=!1)},hasFocus:()=>i.hasFocus,focus:()=>i.focus(),edit:e=>void c(e),destroy:()=>i.destroy()}}export{y as createEditor};
|