{"version":3,"file":"_hooks.BBgf9mO2.mjs","names":["useState","useState"],"sources":["https:/framerusercontent.com/modules/q0qjLSJzCbedNd7w0WjB/JGy6EpHStxos0WnSsbPV/_utils.js","https:/framerusercontent.com/modules/vj7bFUjvEQFgEzNBkdoG/vf3CKm378wlVcBk7IhSU/createStore.js","https:/framer.com/m/framer/store.js@^1.0.0","https:/framerusercontent.com/modules/W6yslsBl39wY64LQYcWy/1FqYKlgF7UbRUjqy0pxp/_constants.js","https:/framerusercontent.com/modules/agcJAgx0B7xqixXVIWIM/pPWKOyJXdCguncBCbcCI/_hooks.js"],"sourcesContent":["import{ControlType,RenderTarget}from\"framer\";export const BaseControls={productID:{title:\"Product ID\",type:ControlType.String}};export const isDev=()=>RenderTarget.current()===RenderTarget.canvas||RenderTarget.current()===RenderTarget.preview;export function cn(...styles){let final={};styles.forEach(style=>{if(style){final={...final,...style};if(typeof style.border===\"object\"){final={...final,...style.border};}if(typeof style.font===\"object\"){final={...final,...style.font};}if(style.hidden){final={...final,display:\"none\"};}}});return final;}export function priceCode(price){if(!price)return\"\";return new Intl.NumberFormat(\"en-US\",{style:\"currency\",currency:price.currencyCode}).format(Number(price.amount));}export const textProperties=(fontSize=16,color)=>{return{fontSize:{type:ControlType.Number,min:6,max:100,defaultValue:fontSize},color:{type:ControlType.Color,defaultValue:color},font:{type:ControlType.Font,displayTextAlignment:true},padding:{type:ControlType.Padding}};};\nexport const __FramerMetadata__ = {\"exports\":{\"priceCode\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"textProperties\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"cn\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"isDev\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"BaseControls\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./_utils.map","import{useState,useEffect}from\"react\";import{Data,useObserveData}from\"framer\";export function createStore(state1){// Use Data so that a Preview reload resets the state\nconst dataStore=Data({state:Object.freeze({...state1})});// Create a set function that updates the state\nconst setDataStore=newState=>{// If the state is an object, make sure we copy it\nif(typeof newState===\"function\"){newState=newState(dataStore.state);}dataStore.state=Object.freeze({...dataStore.state,...newState});};// Store the initial state, copy the object if it's an object\nlet storeState=typeof state1===\"object\"?Object.freeze({...state1}):state1;// Keep a list of all the listeners, in the form of React hook setters\nconst storeSetters=new Set();// Create a set function that updates all the listeners / setters\nconst setStoreState=newState=>{// If the state is an object, make sure we copy it\nif(typeof newState===\"function\"){newState=newState(storeState);}storeState=typeof newState===\"object\"?Object.freeze({...storeState,...newState}):newState;// Update all the listeners / setters with the new value\nstoreSetters.forEach(setter=>setter(storeState));};// Create the actual hook based on everything above\nfunction useStore(){// Create the hook we are going to use as a listener\nconst[state,setState]=useState(storeState);// If we unmount the component using this hook, we need to remove the listener\n// @ts-ignore\nuseEffect(()=>{// But right now, we need to add the listener\nstoreSetters.add(setState);return()=>storeSetters.delete(setState);},[]);// If Data context exists, use Data, otherwise use vanilla React state\nif(useObserveData()===true){useObserveData();return[dataStore.state,setDataStore];}else{// Return the state and a function to update the central store\nreturn[state,setStoreState];}}return useStore;}\nexport const __FramerMetadata__ = {\"exports\":{\"createStore\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./createStore.map","/*\n * createStore (framer/store@1.0.1)\n *\n * Learn More: https://www.framer.com/asset-urls\n */\n\nexport * from \"https://framerusercontent.com/modules/vj7bFUjvEQFgEzNBkdoG/vf3CKm378wlVcBk7IhSU/createStore.js\"\n","export const DefaultCart={id:\"Test\",checkoutUrl:\"Test title\",cost:{subtotalAmount:{amount:\"50.0\",currencyCode:\"USD\"},totalAmount:{amount:\"60.0\",currencyCode:\"USD\"},totalTaxAmount:{amount:\"10.0\",currencyCode:\"USD\"},totalDutyAmount:null},lines:{edges:[{node:{id:\"test\",quantity:1,merchandise:{id:\"Test\",title:\"Medium / Red\",priceV2:{amount:\"50.0\",currencyCode:\"USD\"},image:{altText:\"\",height:720,url:\"https://cdn.shopify.com/s/files/1/0833/9275/8095/files/177763.webp?v=1717649175\",width:600},product:{id:\"Test\",title:\"Cafe Shirt Men's\"},selectedOptions:[{name:\"Size\",value:\"Medium\"}]}}}]}};export const DefaultProduct={id:\"test\",title:\"Cafe Shirt Men's\",availableForSale:false,compareAtPriceRange:{minVariantPrice:{amount:\"15.0\",currencyCode:\"USD\"}},priceRange:{minVariantPrice:{amount:\"10.0\",currencyCode:\"USD\"},maxVariantPrice:{amount:\"10.0\",currencyCode:\"USD\"}},options:[{id:\"gid://shopify/ProductOption/11329409777957\",name:\"Size\",values:[\"Medium\",\"Small\"]},{id:\"gid://shopify/ProductOption/11329409810725\",name:\"Color\",values:[\"Black\",\"Red\"]}],variants:{nodes:[{availableForSale:true,compareAtPriceV2:{amount:\"30.0\",currencyCode:\"CAD\"},currentlyNotInStock:false,id:\"gid://shopify/ProductVariant/47880718909733\",priceV2:{amount:\"20.0\",currencyCode:\"CAD\"},quantityAvailable:2,requiresShipping:true,selectedOptions:[{name:\"Size\",value:\"Medium\"},{name:\"Color\",value:\"Black\"}],taxable:false,title:\"Medium / Black\"},{availableForSale:true,compareAtPriceV2:{amount:\"30.0\",currencyCode:\"CAD\"},currentlyNotInStock:false,id:\"gid://shopify/ProductVariant/47880718942501\",priceV2:{amount:\"14.0\",currencyCode:\"CAD\"},quantityAvailable:3,requiresShipping:true,selectedOptions:[{name:\"Size\",value:\"Medium\"},{name:\"Color\",value:\"Red\"}],taxable:true,title:\"Medium / Red\"},{availableForSale:true,compareAtPriceV2:{amount:\"30.0\",currencyCode:\"CAD\"},currentlyNotInStock:true,id:\"gid://shopify/ProductVariant/47880718975269\",priceV2:{amount:\"5.0\",currencyCode:\"CAD\"},quantityAvailable:0,requiresShipping:true,selectedOptions:[{name:\"Size\",value:\"Small\"},{name:\"Color\",value:\"Black\"}],taxable:true,title:\"Small / Black\"},{availableForSale:false,compareAtPriceV2:{amount:\"30.0\",currencyCode:\"CAD\"},currentlyNotInStock:false,id:\"gid://shopify/ProductVariant/47880719008037\",priceV2:{amount:\"20.0\",currencyCode:\"CAD\"},quantityAvailable:0,requiresShipping:true,selectedOptions:[{name:\"Size\",value:\"Small\"},{name:\"Color\",value:\"Red\"}],taxable:true,title:\"Small / Red\"}]},images:{nodes:[{altText:\"\",height:720,url:\"https://cdn.shopify.com/s/files/1/0833/9275/8095/files/177763.webp?v=1717649175\",width:600},{altText:\"\",height:720,url:\"https://cdn.shopify.com/s/files/1/0833/9275/8095/files/1777631.webp?v=1717649175\",width:600}]}};\nexport const __FramerMetadata__ = {\"exports\":{\"DefaultProduct\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"DefaultCart\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./_constants.map","import{useState,useEffect}from\"react\";import{createStore}from\"https://framer.com/m/framer/store.js@^1.0.0\";import{isDev,priceCode}from\"https://framerusercontent.com/modules/q0qjLSJzCbedNd7w0WjB/JGy6EpHStxos0WnSsbPV/_utils.js\";import{DefaultProduct}from\"https://framerusercontent.com/modules/W6yslsBl39wY64LQYcWy/1FqYKlgF7UbRUjqy0pxp/_constants.js\";export const useShopify=createStore({client:null,products:[],selectedVariant:null,singleProduct:null,quantity:1,cart:null,devMode:false,font:null});export function useFindProduct(productID){const[shopify]=useShopify();const[selectedProduct,setSelectedProduct]=useState(null);useEffect(()=>{const product=shopify.products.find(item=>item.id===productID);if(product){setSelectedProduct(product);}else{if(shopify.devMode&&isDev()){setSelectedProduct(DefaultProduct);}}},[shopify.products]);return selectedProduct;}export function useProductPrice(product){const[shopify]=useShopify();if(!product)return null;const{singleProduct,selectedVariant}=shopify;if(singleProduct&&singleProduct===product.id&&selectedVariant){const{compareAtPriceV2,availableForSale,currentlyNotInStock,priceV2}=selectedVariant;const camparePrice=compareAtPriceV2&&compareAtPriceV2.amount!==\"0.0\"?priceCode(compareAtPriceV2):null;const price=priceCode(priceV2);return{camparePrice:camparePrice!==price?camparePrice:null,multiplePrice:false,price,availableForSale};}else{const{compareAtPriceRange,priceRange,availableForSale}=product!==null&&product!==void 0?product:{};const camparePrice=compareAtPriceRange.minVariantPrice.amount!==\"0.0\"?priceCode(compareAtPriceRange.minVariantPrice):null;const multiplePrice=priceRange.minVariantPrice.amount!==priceRange.maxVariantPrice.amount;const price=priceCode(priceRange.minVariantPrice);return{camparePrice:camparePrice!==price?camparePrice:null,multiplePrice,price,availableForSale};}}\nexport const __FramerMetadata__ = {\"exports\":{\"useProductPrice\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"useFindProduct\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"useShopify\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}"],"mappings":"8KAAmP,SAAgB,EAAG,GAAG,EAAO,CAAC,IAAI,EAAM,EAAE,CAAwP,OAAvP,EAAO,QAAQ,GAAO,CAAI,IAAO,EAAM,CAAC,GAAG,EAAM,GAAG,EAAM,CAAI,OAAO,EAAM,QAAS,WAAU,EAAM,CAAC,GAAG,EAAM,GAAG,EAAM,OAAO,EAAK,OAAO,EAAM,MAAO,WAAU,EAAM,CAAC,GAAG,EAAM,GAAG,EAAM,KAAK,EAAK,EAAM,SAAQ,EAAM,CAAC,GAAG,EAAM,QAAQ,OAAO,IAAK,CAAQ,EAAO,SAAgB,EAAU,EAAM,CAAoB,OAAf,EAAsB,IAAI,KAAK,aAAa,QAAQ,CAAC,MAAM,WAAW,SAAS,EAAM,aAAa,CAAC,CAAC,OAAO,OAAO,EAAM,OAAO,CAAC,CAApH,0BAAviB,CAAa,EAAa,CAAC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