{
  "version": 3,
  "sources": ["ssg:https://framerusercontent.com/modules/xEahqZEsyG5uoZky61jQ/yMYjCncXBsxOaKoj8nUI/_useProduct.js", "ssg:https://framerusercontent.com/modules/XUMZkHzkb6JRq7hdD46W/5ECYOrhVo3Id9A4HahFR/Shopify_ProductPrice.js"],
  "sourcesContent": ["import{useState,useEffect,useMemo}from\"react\";import{useAtom}from\"jotai\";import{useShopify}from\"https://framerusercontent.com/modules/tdCHCV0pSkxlDaX5GkOX/SxZI1Y5OuGrQCk85U8Xt/_useShopify.js\";import{priceCode}from\"https://framerusercontent.com/modules/7dEgbg7qo3lsQk361YtS/NrF60tPHZRRgADqpoRFr/_utils.js\";import{selectedProductsAtom}from\"https://framerusercontent.com/modules/yZBbIevRfN36MGDPpltx/GNI9VoSkUDyJw3EMOM7K/_atoms.js\";import{DefaultProduct}from\"https://framerusercontent.com/modules/fWwtzMT2tYXMW4IKB8On/1dFHOQ0gPjMC0e1WUStY/_test_data.js\";const DefaultSelectedOption={quantity:1,quantityAvailable:null,selectedOption:null,sellingPlan:null};export function useProduct(productID,config,addToSelected){const[selectedProducts,setSelectedProducts]=useAtom(selectedProductsAtom);const{products}=useShopify(config);const[product,setProduct]=useState(config?.testMode?DefaultProduct:null);const selected=product?.id?selectedProducts[product.id]:null;// get price and compare price\nconst getPrice=(camparePrice,price)=>{const comparePriceValue=camparePrice&&camparePrice.amount!==\"0.0\"?priceCode(camparePrice,config):null;const priceValue=priceCode(price,config);return{camparePrice:comparePriceValue!==priceValue?comparePriceValue:null,price:priceValue};};const changeQuantity=quantity=>{if(!product)return;setSelectedProducts(state=>({...state,[product.id]:{...DefaultSelectedOption,...state[product.id],quantity}}));};const selectVariant=(item,sellingPlan)=>{if(!product)return;setSelectedProducts(state=>({...state,[product.id]:{...DefaultSelectedOption,...state[product.id],sellingPlan,quantityAvailable:item.quantityAvailable,selectedOption:item.id}}));};// set first variant as default selected when addToSelected is true\nuseEffect(()=>{if(product&&addToSelected){const defaultVariant=product.variants.nodes[0];setSelectedProducts(state=>({...state,[product.id]:{...DefaultSelectedOption,quantityAvailable:defaultVariant.quantityAvailable,selectedOption:defaultVariant.id}}));return()=>{setSelectedProducts(state=>({...state,[product.id]:null}));};}},[product,addToSelected]);// set product when productID found\nuseEffect(()=>{const foundProduct=products.find(item=>item.id===productID);if(foundProduct){setProduct(config?.testMode?DefaultProduct:foundProduct);}},[products,productID,config?.testMode]);// return result with two mode: when variant selected and when not selected\nconst result=useMemo(()=>{if(!product)return{product:null,availableForSale:null,multiplePrice:null,price:null,stock:null,selectedVariant:null,selectedProduct:null};const selectedVariant=product.variants.nodes.find(item=>item.id===selected?.selectedOption);if(selectedVariant){const selectedSellingPlan=selectedVariant?.sellingPlanAllocations?.nodes.find(item=>item.sellingPlan.id===selected?.sellingPlan);const{compareAtPriceV2,availableForSale,priceV2,quantityAvailable}=selectedVariant;const price=selectedSellingPlan?.checkoutChargeAmount??priceV2;return{product,price:getPrice(compareAtPriceV2,price),multiplePrice:false,availableForSale,stock:quantityAvailable,selectedVariant,selectedProduct:selected};}const{compareAtPriceRange,priceRange,availableForSale,totalInventory}=product??{};const multiplePrice=priceRange.minVariantPrice.amount!==priceRange.maxVariantPrice.amount;return{product,price:getPrice(compareAtPriceRange.minVariantPrice,priceRange.minVariantPrice),multiplePrice,availableForSale,stock:totalInventory,selectedVariant:null,selectedProduct:selected};},[product,selected,config?.languageIsoCode,config?.countryIsoCode]);return{...result,changeQuantity,selectVariant};}\nexport const __FramerMetadata__ = {\"exports\":{\"useProduct\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}", "import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{cn,ProductBaseControls,ConfigControls,textProperties}from\"https://framerusercontent.com/modules/eAejHXy6apg0StNmpKvK/GXn1lJ5V4nUwhRO9yQKC/_framer_utils.js\";import{useProduct}from\"https://framerusercontent.com/modules/xEahqZEsyG5uoZky61jQ/yMYjCncXBsxOaKoj8nUI/_useProduct.js\";import ComponentWrapper from\"https://framerusercontent.com/modules/hQlZBgGeLDev5WuUJA4d/6ncqGCEKZWsfLWpBe7Jn/ComponentWrapper.js\";/**\n * @framerDisableUnlink\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function Shopify_ProductPrice(props){const{product,price,multiplePrice,availableForSale}=useProduct(props.productID??null,props.config);return /*#__PURE__*/_jsx(ComponentWrapper,{style:styles.container,productID:props.productID||\"EMPTY\",hidden:!product,config:props.config,children:()=>/*#__PURE__*/_jsxs(_Fragment,{children:[price.camparePrice&&/*#__PURE__*/_jsxs(\"span\",{style:cn(props.comparePriceStyle,props.comparePriceStyle.textDecoration),children:[price.camparePrice,\" \"]}),/*#__PURE__*/_jsxs(\"span\",{style:cn(props.priceStyle),children:[multiplePrice?props.startFromTitle:\"\",\" \",price.price]}),!availableForSale&&props.soldOutTitle&&/*#__PURE__*/_jsx(\"span\",{style:cn(props.soldOutStyle),children:props.soldOutTitle})]})});}Shopify_ProductPrice.displayName=\"Product Price\";addPropertyControls(Shopify_ProductPrice,{...ConfigControls,...ProductBaseControls,startFromTitle:{title:\"Start from Label\",type:ControlType.String,defaultValue:\"Start from\"},soldOutTitle:{title:\"Sold out Label\",type:ControlType.String,defaultValue:\"Sold out\"},priceStyle:{title:\"Price\",buttonTitle:\"Style\",type:ControlType.Object,controls:{hidden:{type:ControlType.Boolean,defaultValue:false},...textProperties(18,\"rgba(18, 18, 18, 1)\")}},comparePriceStyle:{title:\"Compare Price\",buttonTitle:\"Style\",type:ControlType.Object,controls:{hidden:{type:ControlType.Boolean,defaultValue:false},textDecoration:{title:\"Decoration\",buttonTitle:\"Style\",type:ControlType.Object,controls:{textDecorationLine:{title:\"Line\",type:ControlType.Enum,options:[\"none\",\"line-through\",\"overline\",\"underline\"],optionTitles:[\"Hidden\",\"Line through\",\"Overline\",\"Underline\"],defaultValue:\"line-through\"},textDecorationColor:{title:\"Color\",type:ControlType.Color,optional:true},textDecorationStyle:{title:\"Style\",type:ControlType.Enum,options:[\"solid\",\"double\",\"dotted\",\"dashed\",\"wavy\"],optionTitles:[\"Solid\",\"Double\",\"Dotted\",\"Dashed\",\"Wavy\"],defaultValue:\"solid\"},textDecorationThickness:{title:\"Thickness\",type:ControlType.Number,min:1,max:30,defaultValue:1}}},...textProperties(16,\"rgba(18, 18, 18, 0.75)\")}},soldOutStyle:{title:\"Sold Out\",buttonTitle:\"Style\",type:ControlType.Object,controls:{hidden:{type:ControlType.Boolean,defaultValue:false},lineThrough:{type:ControlType.Boolean,defaultValue:true},...textProperties(14,\"#fff\"),backgroundColor:{type:ControlType.Color,defaultValue:\"#000000\"},border:{type:ControlType.Border,defaultValue:{borderWidth:0}},padding:{type:ControlType.Padding,defaultValue:\"2px 8px 2px 8px\"},borderRadius:{type:ControlType.BorderRadius,defaultValue:\"20px\"}}}});const styles={container:{display:\"flex\",flexDirection:\"row\",flexWrap:\"wrap\",gap:8,alignItems:\"center\"},comparePrice:{textDecoration:\"line-through\"}};\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"Shopify_ProductPrice\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerDisableUnlink\":\"* @framerSupportedLayoutWidth auto\",\"framerSupportedLayoutHeight\":\"auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Shopify_ProductPrice.map"],
  "mappings": "oOAAuiB,IAAMA,EAAsB,CAAC,SAAS,EAAE,kBAAkB,KAAK,eAAe,KAAK,YAAY,IAAI,EAAS,SAASC,EAAWC,EAAUC,EAAOC,EAAc,CAAC,GAAK,CAACC,EAAiBC,CAAmB,EAAEC,EAAQC,CAAoB,EAAO,CAAC,SAAAC,CAAQ,EAAEC,EAAWP,CAAM,EAAO,CAACQ,EAAQC,CAAU,EAAEC,EAASV,GAAQ,SAASW,E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AW,EAAE,aAAa,CAAC,SAAS,eAAe,WAAW,WAAW,EAAE,aAAa,cAAc,EAAE,oBAAoB,CAAC,MAAM,QAAQ,KAAKA,EAAY,MAAM,SAAS,EAAI,EAAE,oBAAoB,CAAC,MAAM,QAAQ,KAAKA,EAAY,KAAK,QAAQ,CAAC,QAAQ,SAAS,SAAS,SAAS,MAAM,EAAE,aAAa,CAAC,QAAQ,SAAS,SAAS,SAAS,MAAM,EAAE,aAAa,OAAO,EAAE,wBAAwB,CAAC,MAAM,YAAY,KAAKA,EAAY,OAAO,IAAI,EAAE,IAAI,GAAG,aAAa,CAAC,CAAC,CAAC,EAAE,GAAGC,EAAe,GAAG,wBAAwB,CAAC,CAAC,EAAE,aAAa,CAAC,MAAM,WAAW,YAAY,QAAQ,KAAKD,EAAY,OAAO,SAAS,CAAC,OAAO,CAAC,KAAKA,EAAY,QAAQ,aAAa,EAAK,EAAE,YAAY,CAAC,KAAKA,EAAY,QAAQ,aAAa,EAAI,EAAE,GAAGC,EAAe,GAAG,MAAM,EAAE,gBAAgB,CAAC,KAAKD,EAAY,MAAM,aAAa,SAAS,EAAE,OAAO,CAAC,KAAKA,EAAY,OAAO,aAAa,CAAC,YAAY,CAAC,CAAC,EAAE,QAAQ,CAAC,KAAKA,EAAY,QAAQ,aAAa,iBAAiB,EAAE,aAAa,CAAC,KAAKA,EAAY,aAAa,aAAa,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,IAAMP,EAAO,CAAC,UAAU,CAAC,QAAQ,OAAO,cAAc,MAAM,SAAS,OAAO,IAAI,EAAE,WAAW,QAAQ,EAAE,aAAa,CAAC,eAAe,cAAc,CAAC",
  "names": ["DefaultSelectedOption", "useProduct", "productID", "config", "addToSelected", "selectedProducts", "setSelectedProducts", "useAtom", "selectedProductsAtom", "products", "useShopify", "product", "setProduct", "ye", "DefaultProduct", "selected", "getPrice", "camparePrice", "price", "comparePriceValue", "priceCode", "priceValue", "changeQuantity", "quantity", "state", "selectVariant", "item", "sellingPlan", "ue", "defaultVariant", "foundProduct", "se", "selectedVariant", "selectedSellingPlan", "compareAtPriceV2", "availableForSale", "priceV2", "quantityAvailable", "compareAtPriceRange", "priceRange", "totalInventory", "multiplePrice", "Shopify_ProductPrice", "props", "product", "price", "multiplePrice", "availableForSale", "useProduct", "p", "ComponentWrapper", "styles", "u", "l", "cn", "addPropertyControls", "ConfigControls", "ProductBaseControls", "ControlType", "textProperties"]
}
