1import{R as h,j as e,s as N}from"./root-C9LVyve2.js";import{D as C,ae as D,h as g,s as T,t as w,u as S,af as P,w as R,i as f,I as A,x as E,ag as I,y as j,ah as L,T as _,a as F,b,c,d as O,e as m,L as k,W as B,B as H,C as Q,f as v,r as M,ac as V,v as W,A as y,k as q,l as z,m as Y,n as G,o as J,S as K}from"./index-DxzqVku9.js";import{P as U}from"./plus-DIKoTClW.js";import{c as X}from"./matcherModel-DAG2F6ue.js";import{c as Z}from"./criteria-DwvHm8ut.js";import"./RouterProvider-BasQyeSe.js";import"./useRouterState-CJ66pkiW.js";import"./queryOptions-BQvTFV_-.js";import"./useMutation-CBnyrxiv.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};t.SENTRY_RELEASE={id:"distillery-frontend"};var r=new t.Error().stack;r&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[r]="2a8c9361-ea18-4652-9e75-67a90f6265d9",t._sentryDebugIdIdentifier="sentry-dbid-2a8c9361-ea18-4652-9e75-67a90f6265d9")}catch{}})();const $=({clientSlug:t,siteLabel:r,accountSlug:s})=>{const[o,i]=h.useState(!1),[n,d]=h.useState(""),l=n.trim(),p=a=>{a.preventDefault(),l!==""&&(i(!1),j().navigate({to:L(t),search:u=>({...u,site:s,template:void 0,name:l})}))},x=a=>{i(a),a&&d("")};return e.jsxs(C,{open:o,onOpenChange:x,children:[e.jsxs(D,{render:e.jsx(g,{}),children:[e.jsx(U,{"aria-hidden":"true"})," Add page template"]}),e.jsxs(T,{children:[e.jsxs(w,{closeLabel:"Cancel adding a page template",children:[e.jsx(S,{children:"Add page template"}),e.jsx(P,{children:"Page matching criteria and the primary metric are set on the next screen."})]}),e.jsxs("form",{onSubmit:p,children:[e.jsxs(R,{children:[e.jsxs("div",{children:[e.jsx(f,{htmlFor:"new-template-domain",children:"Domain"}),e.jsx("p",{id:"new-template-domain",className:"text-sp-neutral-900 mt-1.5 text-sm font-medium",children:r})]}),e.jsxs("div",{children:[e.jsx(f,{htmlFor:"new-template-name",children:"Name"}),e.jsx(A,{id:"new-template-name",value:n,placeholder:"e.g. Category Pages",className:"mt-1.5",onChange:a=>d(a.target.value)})]})]}),e.jsxs(E,{children:[e.jsx(I,{render:e.jsx(g,{variant:"outline"}),children:"Cancel"}),e.jsx(g,{type:"submit",disabled:l==="",children:"Continue to configuration"})]})]})]})]})},ee=({pageTemplate:t})=>{const r=Z(t.criteria);if(r===null)return e.jsx("span",{className:"text-sp-neutral-400",children:"Not set"});const s=X(r);return e.jsx(e.Fragment,{children:s===0?"Whole site":s})},ae=({clientSlug:t,pageTemplates:r})=>e.jsxs(_,{children:[e.jsx(F,{children:e.jsxs(b,{children:[e.jsx(c,{children:"Template"}),e.jsx(c,{children:"Primary metric"}),e.jsx(c,{className:"text-right",children:"Criteria"}),e.jsx(c,{className:"w-12"})]})}),e.jsx(O,{children:r.map(s=>{const o=s.metrics.find(i=>i.isPrimary);return e.jsxs(b,{className:"hover:bg-sp-neutral-25 relative",children:[e.jsx(m,{children:e.jsx(k,{to:B(t,"settings","templateConfig"),search:i=>({...i,template:s.id}),className:"text-sp-neutral-900 hover:text-sp-primary-600 font-medium after:absolute after:inset-0",children:s.name})}),e.jsx(m,{children:o?e.jsx(H,{variant:"secondary",children:o.name}):e.jsx("span",{className:"text-sp-neutral-400",children:"â"})}),e.jsx(m,{className:"text-sp-neutral-700 text-right tabular-nums",children:e.jsx(ee,{pageTemplate:s})}),e.jsx(m,{className:"text-right",children:e.jsx(Q,{className:"text-sp-neutral-400 size-4","aria-hidden":"true"})})]},s.id)})})]}),me=()=>{const{clientSlug:t}=v.useParams(),{site:r}=v.useSearch(),s=h.useMemo(()=>M(t),[t]),o=V().can_modify_page_templates,i=s.some(a=>a.value===r)?r:void 0,n=i??s[0]?.value??"",d=s.find(a=>a.value===n)?.label??n,l=N({...W(n),enabled:n!==""});h.useEffect(()=>{i===void 0&&n!==""&&j().navigate({to:".",search:a=>({...a,site:n}),replace:!0})},[i,n]);const p=a=>{a===null||a===n||j().navigate({to:".",search:u=>({...u,site:a,template:void 0})})},x=()=>l.isError?e.jsx(y,{variant:"error",role:"alert",children:"Couldn't load this domain's page templates. Reload to try again."}):l.isPending?e.jsx("div",{"aria-busy":"true",children:e.jsx(K,{className:"h-40 w-full"})}):l.data.length===0?e.jsx("p",{className:"text-sp-neutral-500 px-5 py-10 text-center text-sm",children:o?"No page templates on this domain yet. Add one to start configuring criteria and experiments.":"No page templates on this domain yet."}):e.jsx(ae,{clientSlug:t,pageTemplates:l.data});return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-sp-neutral-900 text-lg font-semibold",children:"Settings"}),e.jsx("p",{className:"text-sp-neutral-500 mt-1 text-sm",children:"Domain configuration and page templates."})]}),s.length===0?e.jsx(y,{variant:"info",children:"This client has no domains yet."}):e.jsxs("section",{"aria-label":"Domain settings",className:"space-y-3",children:[e.jsxs(q,{items:s,value:n,onValueChange:p,children:[e.jsx(z,{"aria-label":"Domain",className:"text-sp-neutral-500 -ml-1 gap-1.5 border-0 bg-transparent px-1 text-xs font-semibold tracking-wider up
1percase shadow-none",children:e.jsx(Y,{})}),e.jsx(G,{children:s.map(a=>e.jsx(J,{value:a.value,children:a.label},a.value))})]}),e.jsxs("div",{className:"border-sp-neutral-200 overflow-hidden rounded-lg border bg-white",children:[e.jsxs("div",{className:"px-5 pt-4 pb-2",children:[e.jsx("h3",{className:"text-sp-neutral-900 text-sm font-semibold",children:"Page Templates"}),e.jsx("p",{className:"text-sp-neutral-500 mt-0.5 text-xs",children:"The sets of pages experiments run on. Open one to see how it is matched."})]}),x(),o&&n!==""&&e.jsx("div",{className:"border-sp-neutral-200 flex items-center justify-end border-t px-5 py-4",children:e.jsx($,{clientSlug:t,siteLabel:d,accountSlug:n})})]})]})]})};export{me as Settings}; 2//# sourceMappingURL=index-C1ltfvTe.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.