{"version":3,"file":"Variant_info_label.CAO2dhmM.mjs","names":["create","LoadingSkeleton"],"sources":["https:/framerusercontent.com/modules/Vu8sM3DwKDdSi2bltsPi/rIQkvmwRwXuf9UdI67ZU/Parse_shopify_data.js","https:/framerusercontent.com/modules/8l7kldZFdo4Q33wHQBGB/7lKMJPqBiw0YZrxpJACh/Product_selection_store.js","https:/framerusercontent.com/modules/DVekzR4Sf5b9vz5aNZl6/2lgVkNwwrTIvGOx35KfY/Variant_info_label.js"],"sourcesContent":["export const parseShopifyData=shopifyData=>{const parsedShopifyData=shopifyData?JSON.parse(shopifyData):EXAMPLE_DATA;return parsedShopifyData;};const EXAMPLE_DATA={id:\"15176683880773\",variants:[{id:\"55218501157189\",title:\"Variant Title\",price:{amount:\"99\",currencyCode:\"USD\"},priceByMarket:{US:{amount:\"99\",currencyCode:\"USD\"},GB:{amount:\"79\",currencyCode:\"GBP\"},CA:{amount:\"129\",currencyCode:\"CAD\"},EU:{amount:\"89\",currencyCode:\"EUR\"},AU:{amount:\"139\",currencyCode:\"AUD\"}},compareAtPriceByMarket:{US:{amount:\"120\",currencyCode:\"USD\"},GB:{amount:\"95\",currencyCode:\"GBP\"},CA:{amount:\"155\",currencyCode:\"CAD\"},EU:{amount:\"109\",currencyCode:\"EUR\"},AU:{amount:\"169\",currencyCode:\"AUD\"}},weight:0,weightUnit:\"KILOGRAMS\",availableForSale:true,sku:\"sku-untracked-1\",image:{id:\"gid://shopify/ProductImage/77445152801093\",url:\"https://cdn.shopify.com/s/files/1/0967/3896/7877/files/snowboard_purple_hydrogen.png?v=1753365380\",altText:\"Top and bottom view of a snowboard. The top view shows a centred hexagonal logo for Hydrogen that\\n          appears to radiate outwards, as well as some overlapping hexagons at the bottom. The bottom view shows an\\n          abstract angular grid in purples.\",width:3097,height:3908}}]};\nexport const __FramerMetadata__ = {\"exports\":{\"parseShopifyData\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Parse_shopify_data.map","import{create}from\"https://framerusercontent.com/modules/ieMSnIJVCiFKJmsg1OmM/KWFJj6n258MVreTmJoNk/Zustand.js\";const sanitizeQuantity=value=>{if(!Number.isFinite(value))return 1;const rounded=Math.floor(value);return Math.max(1,rounded);};export const useProductSelectionStore=create((set,get)=>({quantitiesByVariantId:{},selectedVariantByProductId:{},getQuantity:variantId=>{const value=get().quantitiesByVariantId[variantId];return typeof value===\"number\"?value:1;},setQuantity:(variantId,quantity)=>{const next=sanitizeQuantity(quantity);set(state=>({quantitiesByVariantId:{...state.quantitiesByVariantId,[variantId]:next}}));},increment:(variantId,step=1)=>{set(state=>{const current=state.quantitiesByVariantId[variantId]??1;const next=sanitizeQuantity(current+step);return{quantitiesByVariantId:{...state.quantitiesByVariantId,[variantId]:next}};});},decrement:(variantId,step=1)=>{set(state=>{const current=state.quantitiesByVariantId[variantId]??1;const next=sanitizeQuantity(current-step);return{quantitiesByVariantId:{...state.quantitiesByVariantId,[variantId]:next}};});},resetQuantity:variantId=>{set(state=>({quantitiesByVariantId:{...state.quantitiesByVariantId,[variantId]:1}}));},getSelectedVariant:(productId,variants)=>{const selectedVariantId=get().selectedVariantByProductId[productId];if(selectedVariantId&&variants.some(v=>v.id===selectedVariantId)){return selectedVariantId;}// Default to first variant if no selection or invalid selection\n    return variants[0]?.id||\"\";},setSelectedVariant:(productId,variantId)=>{set(state=>({selectedVariantByProductId:{...state.selectedVariantByProductId,[productId]:variantId}}));},clearAll:()=>set({quantitiesByVariantId:{},selectedVariantByProductId:{}})}));\nexport const __FramerMetadata__ = {\"exports\":{\"useProductSelectionStore\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Product_selection_store.map","import{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{parseShopifyData}from\"https://framerusercontent.com/modules/Vu8sM3DwKDdSi2bltsPi/rIQkvmwRwXuf9UdI67ZU/Parse_shopify_data.js\";import{useProductSelectionStore}from\"https://framerusercontent.com/modules/8l7kldZFdo4Q33wHQBGB/7lKMJPqBiw0YZrxpJACh/Product_selection_store.js\";import{useLivePricingStore}from\"https://framerusercontent.com/modules/3C9wF5reOoO0EZmRXDu0/U0F0IYbzpYj27k6whgBv/Live_pricing_store.js\";import{SHARED_COLORS}from\"https://framerusercontent.com/modules/Nrs4jz2AAEOfEZRQEQij/7Ao2SBt1Ssf683HHXgzl/Shared_styles.js\";import{renderWithTag,TagPropertyControls}from\"https://framerusercontent.com/modules/cmJdj1YCmFSsS6n95OKk/9t9XeEHurZ6w5fbXeCsJ/Shared_tag_props.js\";import{CurrencyFormatControls,formatCurrency}from\"https://framerusercontent.com/modules/mHaK3bedwyJwyNxfaowX/r1Q3D8lLCMVdN6bFU9bz/Shared_currency_props.js\";import{TextDecorationControls}from\"https://framerusercontent.com/modules/br9bXgadWgfJaD0swwuT/jUc9YNpAtX8KUoSpiBD2/Shared_text_decoration_props.js\";import LoadingSkeleton from\"https://framerusercontent.com/modules/N0h2Mv73o8xtz2My1yiB/RR9fj2DVzBXn0Wwu7ijL/Loading_skeleton.js\";import{SHOPIFY_DATA_DESCRIPTION,SUPPORT_CONTROL}from\"https://framerusercontent.com/modules/G9UZNzEc4NZQrMJzPvWx/tl22i1lNtmmpBOq8EDe4/Shared_props.js\";// ------------------------------------------------------------ //\n// MAIN COMPONENT\n// ------------------------------------------------------------ //\n/**\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n * @framerDisableUnlink\n */export default function VariantInfoLabel(props){const shopifyData=parseShopifyData(props.shopifyData);const{getSelectedVariant}=useProductSelectionStore();const{getLivePrice,isLoading,isFetching}=useLivePricingStore();const selectedVariantId=getSelectedVariant(shopifyData.id,shopifyData.variants);const selectedVariant=shopifyData.variants.find(variant=>variant.id===selectedVariantId);const renderVariantInfo=()=>{if(!selectedVariant)return null;switch(props.type){case\"price\":{// Priority: live > cms default\nconst livePrice=getLivePrice(selectedVariant.id);let priceData=selectedVariant.price;// Default fallback\n// Override with live pricing if available\nif(livePrice?.price){priceData=livePrice.price;}return formatCurrency({amount:Number(priceData.amount),currencyCode:priceData.currencyCode,options:props.currencyFormat});}case\"compareAtPrice\":{// Priority: live > cms market > cms default\nconst livePrice=getLivePrice(selectedVariant.id);let compareAtPriceData=selectedVariant.compareAtPrice;// Default fallback\n// Override with live pricing if available\nif(livePrice?.compareAtPrice){compareAtPriceData=livePrice.compareAtPrice;}if(!compareAtPriceData)return\"\";return formatCurrency({amount:Number(compareAtPriceData.amount),currencyCode:compareAtPriceData.currencyCode,options:props.currencyFormat});}case\"variantName\":return selectedVariant.title===\"Default Title\"?\"\":selectedVariant.title;case\"sku\":return selectedVariant.sku;case\"barcode\":return selectedVariant.barcode;}};// Show loading skeleton for price/compareAtPrice during initial load\nconst isPriceType=props.type===\"price\"||props.type===\"compareAtPrice\";if(isLoading&&isPriceType){return /*#__PURE__*/_jsx(LoadingSkeleton,{style:{width:\"60px\",height:\"20px\"}});}const content=renderVariantInfo();const style={...props.font,color:props.color,textDecoration:props.decoration===\"none\"?\"none\":props.decoration};// Hide component when empty and whenZero is \"hide\"\nconst isEmptyValue=!content||content===\"\";if(props.whenZero===\"hide\"&&isEmptyValue){return null;}// Show specified text if whenZero is \"text\" and empty\nif(props.whenZero===\"text\"&&isEmptyValue){return /*#__PURE__*/_jsx(\"div\",{style:{opacity:isFetching&&isPriceType?.6:1,transition:\"opacity 0.3s ease\"},children:renderWithTag(props.tag,props.text,style)});}// Show empty content if whenZero is \"show\"\nif(isEmptyValue){return /*#__PURE__*/_jsx(\"div\",{style:{opacity:isFetching&&isPriceType?.6:1,transition:\"opacity 0.3s ease\"},children:renderWithTag(props.tag,\"0\",style)});}// Wrap content in fade transition container for price types\nreturn /*#__PURE__*/_jsx(\"div\",{style:{opacity:isFetching&&isPriceType?.6:1,transition:\"opacity 0.3s ease\"},children:renderWithTag(props.tag,content,style)});}// ------------------------------------------------------------ //\n// PROPERTY CONTROLS\n// ------------------------------------------------------------ //\naddPropertyControls(VariantInfoLabel,{shopifyData:{type:ControlType.String,description:SHOPIFY_DATA_DESCRIPTION},type:{type:ControlType.Enum,options:[\"price\",\"compareAtPrice\",\"variantName\",\"sku\",\"barcode\"],optionTitles:[\"Price\",\"Compare At Price\",\"Variant Name\",\"SKU\",\"Barcode\"],defaultValue:\"price\"},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultFontType:\"sans-serif\"},color:{type:ControlType.Color,title:\"Color\",defaultValue:SHARED_COLORS.foreground},whenZero:{type:ControlType.Enum,title:\"When Zero\",options:[\"show\",\"hide\",\"text\"],optionTitles:[\"Show\",\"Hide\",\"Text\"],defaultValue:\"hide\",displaySegmentedControl:true},text:{type:ControlType.String,title:\"Text\",defaultValue:\"Free\",hidden:props=>props.whenZero!==\"text\"},currencyFormat:{...CurrencyFormatControls.currencyFormat,hidden:props=>props.type!==\"price\"&&props.type!==\"compareAtPrice\"},...TagPropertyControls,...TextDecorationControls,...SUPPORT_CONTROL});VariantInfoLabel.displayName=\"Variant Info Label\";\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"VariantInfoLabel\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerDisableUnlink\":\"\",\"framerSupportedLayoutHeight\":\"any\",\"framerSupportedLayoutWidth\":\"any\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Variant_info_label.map"],"mappings":"oYAAa,EAAiB,GAAsC,EAAY,KAAK,MAAM,EAAY,CAAC,EAA8C,EAAa,CAAC,GAAG,iBAAiB,SAAS,CAAC,CAAC,GAAG,iBAAiB,MAAM,gBAAgB,MAAM,CAAC,OAAO,KAAK,aAAa,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC,OAAO,KAAK,aAAa,MAAM,CAAC,GAAG,CAAC,OAAO,KAAK,aAAa,MAA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