{"version":3,"file":"SN_SchemaCollection.L3yLZPJO.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/7J39Jc8WBQVOLLhYwUz3/Jf3nBTO0tCA32t5bVxQm/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.\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}`;function prettify(handle){return String(handle||\"\").split(\"-\").filter(Boolean).map(w=>w.charAt(0).toUpperCase()+w.slice(1)).join(\" \");}/**\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n */export default function SN_SchemaCollection(props){const{collectionHandle,name,description,homeName,homeUrl,maxItems}=props;const isCanvas=RenderTarget.current()===RenderTarget.canvas;const[data,setData]=useState(null);const handle=collectionHandle||(typeof window!==\"undefined\"?window.location.pathname.split(\"/\").filter(Boolean)[0]||\"\":\"\");const origin=typeof window!==\"undefined\"?window.location.origin:\"\";const canonical=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:homeUrl||origin||\"\"},{\"@type\":\"ListItem\",position:2,name:collName,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:\"\",name:\"\",description:\"\",homeName:\"Home\",homeUrl:\"\",maxItems:24};addPropertyControls(SN_SchemaCollection,{collectionHandle:{type:ControlType.String,title:\"Collection Handle\",description:\"Empty = first URL segment (e.g. bulletproof-vests). Name + products are fetched automatically.\"},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\",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