{"version":3,"file":"SN_SchemaCollection.CchhoKsp.mjs","names":["useState","__esmMin","init_npm_react_18_3_1","init_ssg_sandbox_shims","window","ce","init_jsx_runtime","c","_e","addPropertyControls","RenderTarget","init_framer_CN96F41L","ControlType","prettify","handle","w","lastSegment","path","normalizePath","p","SN_SchemaCollection","props","isCanvas","data","setData","pagePath","collectionHandle","origin","homeUrl","ORIGIN","canonical","cancel","SHOP","API","TOKEN","QUERY","maxItems","collName","name","collDesc","description","list","graph","homeName","i","init_SN_SchemaCollection"],"sources":["https:/framerusercontent.com/modules/1TckCHeK693G2P2JXhRg/OFTkdOnkJp9EMpMdgyK8/SN_SchemaCollection.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";import{useState,useEffect}from\"react\";// SN_SchemaCollection — emits CollectionPage + BreadcrumbList + ItemList JSON-LD\n// on a category page.\n//\n// v2 (Chat #79): ZERO-CONFIG. The collection name no longer needs to be bound\n// to a CMS variable (which the binding UI doesn't allow) — it's fetched from the\n// Storefront collection by handle, together with the product ItemList. The\n// handle comes from the first URL segment. Props remain only as fallbacks.\n//\n// v3 (Chat #164): SERVER-SIDE COMPLETENESS. Zero-config had a cost that only\n// showed up in a SEMrush audit: every input came from `window` or a client\n// fetch, so the pre-rendered HTML carried a BreadcrumbList with empty `name`\n// AND empty `item` on both positions, plus a nameless CollectionPage — verified\n// by curl on 8/8 category pages. Google renders JS and reports the breadcrumb as\n// valid, so this was never a ranking emergency; but rendering is deferred and\n// budgeted, and an empty value in the first snapshot is a needless bet.\n//\n// The fix is a `path` control set per page (\"/armor-plates\"). From it the\n// component derives the handle, the canonical URL and — via prettify — a\n// truthful name, all without touching `window`. The client fetch still runs and\n// still wins, so the live title from the Storefront replaces the derived one.\n//\n// Naming is safe to derive; STOCK IS NOT. See the v3.2 note in\n// SN_SchemaProduct.tsx: baking a guessed availability into the pre-rendered HTML\n// stamped InStock on 140/140 pages and opened a \"Mismatched product\n// availability\" cluster in GMC. A category label cannot mismatch anything —\n// which is exactly why this component may do what that one must not.\nconst SHOP=\"ace-link-armor.myshopify.com\";const TOKEN=\"0a593db1c8af3044faa3d79170fe3985\";const API=\"2025-01\";const QUERY=`query($handle: String!, $n: Int!) {\n  collection(handle: $handle) {\n    title\n    description\n    products(first: $n) { edges { node { title handle } } }\n  }\n}`;/** Site origin — a constant so the breadcrumb has a real URL before hydration. */const ORIGIN=\"https://acelinkarmor.com\";function prettify(handle){return String(handle||\"\").split(\"-\").filter(Boolean).map(w=>w.charAt(0).toUpperCase()+w.slice(1)).join(\" \");}/** \"/body-armor/bulletproof-shirt\" → \"bulletproof-shirt\". */function lastSegment(path){return String(path||\"\").split(\"/\").filter(Boolean).pop()||\"\";}/** \"armor-plates\" or \"/armor-plates/\" → \"/armor-plates\". */function normalizePath(path){const p=String(path||\"\").trim();if(!p)return\"\";return(\"/\"+p.replace(/^\\/+/,\"\").replace(/\\/+$/,\"\")).replace(/\\/{2,}/g,\"/\");}/**\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n */export default function SN_SchemaCollection(props){const{collectionHandle,path,name,description,homeName,homeUrl,maxItems}=props;const isCanvas=RenderTarget.current()===RenderTarget.canvas;const[data,setData]=useState(null);// Everything below must resolve without `window`, or it is empty in the\n// pre-rendered HTML. `path` is the one thing the page has to tell us; the\n// window reads stay as a fallback for instances where it was never set.\nconst pagePath=normalizePath(path);const handle=collectionHandle||lastSegment(pagePath)||(typeof window!==\"undefined\"?window.location.pathname.split(\"/\").filter(Boolean)[0]||\"\":\"\");const origin=homeUrl||ORIGIN;const canonical=pagePath?`${origin}${pagePath}`:typeof window!==\"undefined\"?window.location.href.split(\"?\")[0]:\"\";useEffect(()=>{if(isCanvas||!handle||typeof window===\"undefined\")return;let cancel=false;(async()=>{try{const r=await fetch(`https://${SHOP}/api/${API}/graphql.json`,{method:\"POST\",headers:{\"Content-Type\":\"application/json\",\"X-Shopify-Storefront-Access-Token\":TOKEN},body:JSON.stringify({query:QUERY,variables:{handle,n:maxItems||24}})});const j=await r.json();const c=j?.data?.collection;if(!cancel&&c)setData({title:c.title||\"\",description:c.description||\"\",list:(c.products?.edges||[]).map(e=>({name:e.node.title,handle:e.node.handle}))});}catch{}})();return()=>{cancel=true;};},[isCanvas,handle,maxItems]);const collName=data&&data.title||name||prettify(handle);const collDesc=data&&data.description||description||\"\";const list=data&&data.list||[];const graph=[{\"@type\":\"CollectionPage\",...canonical?{\"@id\":canonical}:{},name:collName,...collDesc?{description:collDesc}:{}},{\"@type\":\"BreadcrumbList\",itemListElement:[{\"@type\":\"ListItem\",position:1,name:homeName||\"Home\",item:origin},// Omit rather than emit an empty `item`: an absent URL is a warning,\n// an empty string is an invalid one.\n{\"@type\":\"ListItem\",position:2,name:collName,...canonical?{item:canonical}:{}}]}];if(list.length>0){graph.push({\"@type\":\"ItemList\",itemListElement:list.map((p,i)=>({\"@type\":\"ListItem\",position:i+1,url:`${origin}/${handle}/${p.handle}`,name:p.name}))});}const schema={\"@context\":\"https://schema.org\",\"@graph\":graph};return /*#__PURE__*/_jsx(\"script\",{type:\"application/ld+json\",dangerouslySetInnerHTML:{__html:JSON.stringify(schema)}});}SN_SchemaCollection.defaultProps={collectionHandle:\"\",path:\"\",name:\"\",description:\"\",homeName:\"Home\",homeUrl:\"\",maxItems:24};addPropertyControls(SN_SchemaCollection,{path:{type:ControlType.String,title:\"Path\",description:\"SET THIS PER PAGE, e.g. /armor-plates. Without it the breadcrumb and canonical are empty in the pre-rendered HTML (they only fill in after JS).\"},collectionHandle:{type:ControlType.String,title:\"Collection Handle\",description:\"Empty = last segment of Path, then first URL segment. Set only when the Shopify handle differs from the URL.\"},maxItems:{type:ControlType.Number,title:\"Max Items\",defaultValue:24,min:1,max:100,step:1},name:{type:ControlType.String,title:\"Name (fallback)\",description:\"Auto-fetched from the Storefront collection. Type only to override.\"},description:{type:ControlType.String,title:\"Description (fallback)\",displayTextArea:true},homeName:{type:ControlType.String,title:\"Breadcrumb Home\",defaultValue:\"Home\"},homeUrl:{type:ControlType.String,title:\"Home URL\",description:\"Optional. Empty = site origin.\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"SN_SchemaCollection\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"any\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"any\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./SN_SchemaCollection.map"],"mappings":"A,wMAgC6H,SAASa,EAAS,EAAO,CAAC,OAAO,OAAOC,GAAQ,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,IAAI,GAAGC,EAAE,OAAO,CAAC,CAAC,CAAC,YAAY,EAAEA,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,CAAE,CAA8D,SAASC,EAAY,EAAK,CAAC,OAAO,OAAOC,GAAM,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,IAAI,GAAG,EAAG,CAA6D,SAASC,EAAc,EAAK,CAAC,IAAMC,EAAE,OAAOF,GAAM,EAAE,CAAC,CAAC,KAAK,EAAiB,OAAXE,GAAkB,IAAIA,EAAE,QAAQ,OAAO,EAAE,CAAC,CAAC,QAAQ,OAAO,EAAE,EAAA,CAAG,QAAQ,UAAU,GAAG,EAA5E,EAA8E,CAG1mB,SAAwBC,EAAoB,EAAM,CAAC,GAAK,CAAC,mBAAiB,OAAK,OAAK,cAAY,WAAS,UAAQ,YAAUC,EAAYC,EAASZ,EAAa,QAAQ,IAAIA,EAAa,OAAY,CAACa,EAAKC,GAASxB,EAAS,IAAI,EAG3NyB,EAASP,EAAcD,CAAI,EAAQH,EAAOY,GAAkBV,EAAYS,CAAQ,IAAWrB,IAAS,OAAuE,GAA3DA,EAAO,SAAS,SAAS,MAAM,GAAG,CAAC,CAAC,OAAO,OAAO,C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