{"version":3,"file":"ProductInfoLabel.PGo4kFd8.mjs","names":["currencySymbols"],"sources":["https:/framerusercontent.com/modules/Ncx6rwHWSXe5kU34gWm3/ODkUbH8JS0kgmkT2t1Ml/ProductInfoLabel.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{ControlType,withCSS}from\"framer\";import{useSelectedVariant}from\"https://framerusercontent.com/modules/ajKYBgRXgNyNgL1GkpqG/prknJU66nI5iRE43ff6z/ProductState.js\";import{useCartItem}from\"https://framerusercontent.com/modules/Be5mN5EUhdOwl54qCG8y/Icj1ZU450uFtWcyrdGTm/CartItemContext.js\";import{currencyFormatProp,formatCurrency,addPropertyControlsFrameship}from\"https://framerusercontent.com/modules/gd3dcT3w5rYoRy7ZcKte/sH6FZizM8jJ11j2dQOhQ/Shared.js\";import currencySymbols from\"https://framerusercontent.com/modules/pJIZxaEdKo1uS87sS4xM/4PSl3AVmNoISomoZ0s7m/CurrencySymbols.js\";const HIDDEN_CLASS=\"frameship-price-label-hidden\";var ProductInfoType;(function(ProductInfoType){ProductInfoType[\"Price\"]=\"price\";ProductInfoType[\"CompareAtPrice\"]=\"compareAtPrice\";})(ProductInfoType||(ProductInfoType={}));function ProductInfoLabelComponent(props){const{type,whenZero,textWhenZero,currencyFormat}=props;const Tag=props.htmlTag||\"p\";const variant=useSelectedVariant(props.shopifyData);const{inCart,price:cartPrice,compareAtPrice:cartCompareAtPrice}=useCartItem();let value=0;let currencyCode=props.currency;let hidden=false;if(inCart){if(type===\"price\"){if(isPriceV2(cartPrice)){value=cartPrice.amount||0;currencyCode=cartPrice.currencyCode||props.currency;}}else if(type===\"compareAtPrice\"){if(isPriceV2(cartCompareAtPrice)){value=cartCompareAtPrice.amount||0;currencyCode=cartCompareAtPrice.currencyCode||props.currency;}}}else if(variant){const price=variant[type];if(isPriceV2(price)){value=price.amount||0;currencyCode=price.currencyCode||props.currency;}else if(typeof price===\"number\"){value=price;}}let text=\"\";if(whenZero==\"hide\"&&!value){hidden=true;}else if(whenZero==\"showText\"&&!value){text=textWhenZero;}else{text=formatCurrency(value,currencyCode,currencyFormat);}return hidden?/*#__PURE__*/_jsx(\"div\",{className:HIDDEN_CLASS}):/*#__PURE__*/_jsxs(Tag,{style:{color:props.color,margin:0,whiteSpace:\"pre\",userSelect:props.selectable?undefined:\"none\",textDecoration:props.decoration===\"strikethrough\"?\"line-through\":props.decoration,textWrap:props.style?.width==\"100%\"?\"wrap\":\"nowrap\",...props.font,...props.style},children:[props.prefix,text,props.suffix]});}/**\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight auto\n * @framerDisableUnlink\n */const ProductInfoLabel=withCSS(ProductInfoLabelComponent,[`.${HIDDEN_CLASS} { display: none !important; }`,`div:has(> .${HIDDEN_CLASS}) { display: none !important; }`],\"\");export default ProductInfoLabel;ProductInfoLabel.displayName=\"Price Label\";addPropertyControlsFrameship(ProductInfoLabel,{type:{type:ControlType.Enum,defaultValue:\"price\",options:Object.values(ProductInfoType),optionTitles:[\"Price\",\"Compare-at Price\"],displaySegmentedControl:true,segmentedControlDirection:\"vertical\"},whenZero:{type:ControlType.Enum,defaultValue:\"show\",options:[\"show\",\"showText\",\"hide\"],optionTitles:[\"Show\",\"Show Text\",\"Hide\"],title:\"When Zero\"},textWhenZero:{type:ControlType.String,defaultValue:\"Free\",title:\"Text\",description:\"This text is shown when the price is 0\",hidden:props=>props.whenZero!==\"showText\"},currency:{type:ControlType.Enum,defaultValue:\"USD\",title:\"Default Currency\",options:Object.keys(currencySymbols)},currencyFormat:currencyFormatProp(),font:{type:\"font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:16,lineHeight:1.4}},color:{type:ControlType.Color,defaultValue:\"#999999\"},prefix:{type:ControlType.String,defaultValue:\"\"},suffix:{type:ControlType.String,defaultValue:\"\"},decoration:{type:ControlType.Enum,defaultValue:\"none\",options:[\"none\",\"strikethrough\",\"underline\"],optionTitles:[\"None\",\"Strikethrough\",\"Underline\"]},selectable:{type:ControlType.Boolean,defaultValue:true,title:\"User Select\"},htmlTag:{type:ControlType.Enum,options:[\"p\",\"span\",\"h1\",\"h2\",\"h3\",\"h4\",\"h5\",\"h6\"],title:\"Tag\"}},{shopifyData:true});function isPriceV2(value){return value&&typeof value===\"object\"&&value.hasOwnProperty(\"amount\");}\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ProductInfoLabel\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any\",\"framerDisableUnlink\":\"\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ProductInfoLabel.map"],"mappings":"8QAAk2B,SAAS,EAA0B,EAAM,CAAC,GAAK,CAAC,OAAK,WAAS,eAAa,kBAAgB,EAAY,EAAI,EAAM,SAAS,IAAU,EAAQ,EAAmB,EAAM,YAAY,CAAM,CAAC,SAAO,MAAM,EAAU,eAAe,GAAoB,GAAa,CAAK,EAAM,EAAM,EAAa,EAAM,SAAa,EAAO,GAAM,GAAG,EAAW,IAAO,QAAY,EAAU,EAAU,GAAE,EAAM,EAAU,QAAQ,EAAE,EAAa,EAAU,cAAc,EAAM,UAAmB,IAAO,kBAAqB,EAAU,EAAmB,GAAE,EAAM,EAAmB,QAAQ,EAAE,EAAa,EAAmB,cAAc,EAAM,kBAAoB,EAAQ,CAAC,IAAM,EAAM,EAAQ,GAAS,EAAU,EAAM,EAAE,EAAM,EAAM,QAAQ,EAAE,EAAa,EAAM,cAAc,EAAM,UAAkB,OAAO,GAAQ,WAAU,EAAM,GAAQ,IAAI,EAAK,GAAmK,OAA7J,GAAU,QAAQ,CAAC,EAAO,EAAO,GAAoE,EAAtD,GAAU,YAAY,CAAC,EAAY,EAAwB,EAAe,EAAM,EAAa,EAAe,CAAS,EAAoB,EAAK,MAAM,CAAC,UAAU,EAAa,CAAC,CAAc,EAAM,EAAI,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