{"version":3,"file":"Variant_info_label.DeadRNll.mjs","names":["create","__esmMin","init_jsx_runtime","c","addPropertyControls","init_framer_DymZktPS","ControlType","CurrencyFormatControls","TagPropertyControls","init_Loading_skeleton","SHOPIFY_DATA_DESCRIPTION","SUPPORT_CONTROL","renderWithTag","init_Shared_tag_props","LoadingSkeleton","formatCurrency","init_Shared_styles","TextDecorationControls","init_Zustand","SHARED_COLORS","f","init_Shared_props","init_Shared_currency_props","init_Live_pricing_store","useLivePricingStore","parseShopifyData","EXAMPLE_DATA","init_Parse_shopify_data","shopifyData","sanitizeQuantity","useProductSelectionStore","init_Product_selection_store","value","get","variantId","next","quantity","set","state","current","step","selectedVariantId","productId","variants","v","VariantInfoLabel","props","getSelectedVariant","selectedVariant","variant","renderVariantInfo","livePrice","getLivePrice","priceData","compareAtPriceData","isPriceType","isLoading","content","style","isEmptyValue","isFetching","init_Variant_info_label","init_Shared_text_decoration_props"],"sources":["https:/framerusercontent.com/modules/Vu8sM3DwKDdSi2bltsPi/Uam6NjjQgBdbM2uxwvNZ/Parse_shopify_data.js","https:/framerusercontent.com/modules/8l7kldZFdo4Q33wHQBGB/yNIABzdTP3fu4mWtyAdp/Product_selection_store.js","https:/framerusercontent.com/modules/DVekzR4Sf5b9vz5aNZl6/7TkUjog2l0gLWTslezhC/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/Uam6NjjQgBdbM2uxwvNZ/Parse_shopify_data.js\";import{useProductSelectionStore}from\"https://framerusercontent.com/modules/8l7kldZFdo4Q33wHQBGB/yNIABzdTP3fu4mWtyAdp/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\"}}}"],"mappings":"A,iaAAa,EAAiB,GAAsC4B,EAAY,KAAK,MAAMA,CAAW,EAAEF,EAA8C,EAAa,CAAC,GAAG,iBAAiB,SAAS,CAAC,CAAC,GAAG,iBAAiB,MAAM,gBAAgB,MAAM,CAAC,OAAO,KAAK,aAAa,KAAK,EAAE,cAAc,CAAC,GAAG,CAAC,OAAO,KAAK,aAAa,KAAK,EAAE,GAAG,CAAC,OAAO,KAAK,aAAa,KAAK,EAAE,GAAG,CAAC,OAAO,MAAM,aAAa,KAAK,EAAE,GAAG,CAAC,OAAO,KAAK,aAAa,KAAK,EAAE,GAAG,CAAC,OAAO,MAAM,aAAa,KAAK,CAAC,EAAE,uBAAuB,CAAC,GAAG,CAAC,OAAO,MAAM,aAAa,KAAK,EAAE,GAAG,CAAC,OAAO,KAAK,aAAa,KAAK,EAAE,GAAG,CAAC,OAAO,MAAM,aAAa,KAAK,EAAE,GAAG,CAAC,OAAO,MAAM,aAAa,KAAK,EAAE,GAAG,CAAC,OAAO,MAAM,aAAa,KAAK,CAAC,EAAE,OAAO,EAAE,WAAW,YAAY,iBAAiB,GAAK,IAAI,kBAAkB,MAAM,CAAC,GAAG,4CAA4C,IAAI,oGAAoG,QAAQ;;6CAAsQ,MAAM,KAAK,OAAO,IAAI,CAAC,CAAC,CAAC,C,iDCAvkC,EAAiB,GAAY,OAAO,SAASM,CAAK,EAAkD,KAAK,IAAI,EAAlC,KAAK,MAAMA,CAA+B,CAAC,EAA3D,EAA4E,EAAyBhC,GAAQ,EAAI,KAAO,CAAC,sBAAsB,CAAC,EAAE,2BAA2B,CAAC,EAAE,YAAY,GAAW,CAAC,IAAM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