{"version":3,"file":"Variant_info_label.CBGD1NRb.mjs","names":["LoadingSkeleton"],"sources":["https:/framerusercontent.com/modules/DVekzR4Sf5b9vz5aNZl6/2lgVkNwwrTIvGOx35KfY/Variant_info_label.js"],"sourcesContent":["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":"obAOG,SA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