{"version":3,"file":"Button.DGh5g20Q.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/kEMMGb5hqGCVwEpqX70U/xtbUYyPMDwLhvH64M4SK/_useCart.js","https:/framerusercontent.com/modules/EoMllm11FAeAfrQZgkjQ/LMhGmi204cugd6mksqKj/Button.js"],"sourcesContent":["import{useState}from\"react\";import{useAtomValue,useSetAtom}from\"jotai\";import{localCartAtom,clientAtom}from\"https://framerusercontent.com/modules/yZBbIevRfN36MGDPpltx/GNI9VoSkUDyJw3EMOM7K/_atoms.js\";import{addItemsToCart,removeCartItems,updateCartItems}from\"https://framerusercontent.com/modules/xpqbkEp3IFoaBlvr8BRa/mmYIfWtGVAI0nJXkmHhs/_queries.js\";import{useShopify}from\"https://framerusercontent.com/modules/tdCHCV0pSkxlDaX5GkOX/SxZI1Y5OuGrQCk85U8Xt/_useShopify.js\";import{DefaultCart}from\"https://framerusercontent.com/modules/fWwtzMT2tYXMW4IKB8On/1dFHOQ0gPjMC0e1WUStY/_test_data.js\";export const useCart=config=>{const[actionLoading,setActionLoading]=useState(false);const[cartError,setCartError]=useState(\"\");const{cart}=useShopify(config);const client=useAtomValue(clientAtom);const setCart=useSetAtom(localCartAtom);const cartCount=cart?.lines.edges.filter(({node})=>node.quantity).length??0;const addToCart=async({merchandiseId,quantity=1,attributes,sellingPlanId})=>{setActionLoading(true);setCartError(\"\");try{const res=await client?.request(addItemsToCart,{variables:{cartId:cart?.id,lines:{merchandiseId,quantity,attributes,sellingPlanId}}});setActionLoading(false);if(res?.data?.cartLinesAdd?.userErrors.length){setCartError(res.data.cartLinesAdd.userErrors[0].message);}if(res?.data?.cartLinesAdd?.cart){setCart(res.data.cartLinesAdd.cart);}return;}catch{setActionLoading(false);return;}};const removeFromCart=merchandiseId=>{setActionLoading(true);client?.request(removeCartItems,{variables:{cartId:cart?.id,lineIds:[merchandiseId]}}).then(res=>{setActionLoading(false);if(res.data?.cartLinesRemove?.userErrors){console.error(res.data.cartLinesRemove.userErrors);}if(res.data?.cartLinesRemove?.cart){setCart(res.data.cartLinesRemove.cart);}}).catch(()=>{setActionLoading(false);});};const changeQuantity=async(merchandiseId,quantity)=>{setActionLoading(true);client?.request(updateCartItems,{variables:{cartId:cart?.id,lines:{id:merchandiseId,quantity}}}).then(res=>{setActionLoading(false);if(res.data?.cartLinesUpdate?.userErrors){console.error(res.data.cartLinesUpdate.userErrors);}if(res.data?.cartLinesUpdate?.cart){setCart(res.data.cartLinesUpdate.cart);}}).catch(()=>{setActionLoading(false);});};return{cart:!config||config.testMode?DefaultCart:cart,actionLoading,cartError,cartCount,addToCart,changeQuantity,removeFromCart};};\nexport const __FramerMetadata__ = {\"exports\":{\"useCart\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}","import{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{motion}from\"framer-motion\";import{cn,textProperties}from\"https://framerusercontent.com/modules/eAejHXy6apg0StNmpKvK/GXn1lJ5V4nUwhRO9yQKC/_framer_utils.js\";import{addPropsToChildren}from\"https://framerusercontent.com/modules/7dEgbg7qo3lsQk361YtS/NrF60tPHZRRgADqpoRFr/_utils.js\";/**\n * @framerDisableUnlink\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight auto\n */export default function Button({onClick=()=>false,loading=false,disabled=false,style,hoverStyle,label,buttonType,buttonComponent,buttonVariants}){if(buttonType===\"Custom\"){let status=buttonVariants.default||\"Default\";if(loading)status=buttonVariants.loading||\"Loading\";if(disabled)status=buttonVariants.disabled||\"Disabled\";if(!buttonComponent||!buttonComponent?.[0])return /*#__PURE__*/_jsx(\"div\",{style:{background:\"#C83E3E\",color:\"#fff\",borderRadius:\"10px\",padding:\"8px\",boxShadow:\"0px 5px 15px 0px #AC1B1B33\",fontWeight:\"500\"},children:\"Assign your button component\"});const buttonWithVariants=addPropsToChildren(buttonComponent,{variant:status,onClick:status===(buttonVariants.default||\"Default\")?onClick:()=>false},true);const button=addPropsToChildren(buttonWithVariants,{style:{width:\"100%\"}});return button;}return /*#__PURE__*/_jsx(motion.button,{onClick:onClick,disabled:loading||disabled,style:cn(styles.container,style,loading&&styles.loading,disabled&&styles.disabled),whileHover:{...cn(hoverStyle),transition:{duration:.25}},children:/*#__PURE__*/_jsx(\"span\",{children:label})});}export const ButtonProperties=label=>({buttonType:{title:\"Type\",type:ControlType.SegmentedEnum,options:[\"Default\",\"Custom\"],optionTitles:[\"Default\",\"Custom\"],defaultValue:\"Default\"},buttonComponent:{title:\"Button Component\",type:ControlType.ComponentInstance,hidden:props=>props.buttonType!==\"Custom\"},buttonVariants:{title:\"Component Variants\",buttonTitle:\"Variants\",type:ControlType.Object,hidden:props=>props.buttonType!==\"Custom\",controls:{default:{type:ControlType.String,defaultValue:\"Default\"},loading:{type:ControlType.String,defaultValue:\"Loading\"},disabled:{type:ControlType.String,defaultValue:\"Disabled\"}},description:\"Variant names should match your button component's variant names\"},label:{title:\"Label\",type:ControlType.String,defaultValue:label,hidden:props=>props.buttonType!==\"Default\"},style:{buttonTitle:\"Style\",type:ControlType.Object,hidden:props=>props.buttonType!==\"Default\",controls:{...textProperties(16,\"#000\"),backgroundColor:{title:\"Background color\",type:ControlType.Color,optional:true},border:{type:ControlType.Border,defaultValue:{borderColor:\"#000\"}},borderRadius:{type:ControlType.BorderRadius,defaultValue:\"6px\"},padding:{type:ControlType.Padding,defaultValue:\"10px 32px 10px 32px\"}}},hoverStyle:{title:\"Hover\",buttonTitle:\"Style\",type:ControlType.Object,hidden:props=>props.buttonType!==\"Default\",controls:{color:{type:ControlType.Color,defaultValue:\"#fff\",optional:true},backgroundColor:{type:ControlType.Color,defaultValue:\"#000\",optional:true},border:{type:ControlType.Border,defaultValue:{borderColor:\"#fff\"}}}}});addPropertyControls(Button,ButtonProperties(\"Button\"));const styles={wrapper:{display:\"flex\",flexDirection:\"column\",gap:8},container:{display:\"flex\",flexDirection:\"row\",alignItems:\"center\",justifyContent:\"center\",cursor:\"pointer\",flex:1,fontFamily:\"inherit\"},loading:{opacity:.8,cursor:\"wait\"},disabled:{opacity:.8}};\nexport const __FramerMetadata__ = {\"exports\":{\"ButtonProperties\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"default\":{\"type\":\"reactComponent\",\"name\":\"Button\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"auto\",\"framerDisableUnlink\":\"* @framerSupportedLayoutWidth any-prefer-fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}"],"mappings":"qwBAA0lB,EAAQ,GAAQ,CAAC,GAAK,CAAC,EAAc,EAAiB,CAACA,EAAS,IAAY,CAAC,EAAU,EAAa,CAACA,EAAS,IAAS,CAAC,OAAK,CAAC,EAAW,GAAc,EAAO,EAAa,GAAkB,EAAQ,EAAW,GAAqB,EAAU,GAAM,MAAM,MAAM,QAAQ,CAAC,OAAK,GAAG,EAAK,UAAU,QAAQ,EAAQ,EAAU,MAAM,CAAC,gBAAc,WAAS,EAAE,aAAW,gBAAc,GAAG,CAAC,EAAiB,IAAM,EAAa,IAAI,GAAG,CAAC,IAAM,EAAI,MAAM,GAAQ,QAAQ,EAAe,CAAC,UAAU,CAAC,OAAO,GAAM,GAAG,MAAM,CAAC,gBAAc,WAAS,aAAW,gBAAc,CAAC,CAAC,EAAE,EAAiB,IAAU,GAAK,MAAM,cAAc,WAAW,QAAQ,EAAa,EAAI,KAAK,aAAa,WAAW,GAAG,SAAa,GAAK,MAAM,cAAc,MAAM,EAAQ,EAAI,KAAK,aAAa,MAAO,MAAQ,MAAK,CAAC,EAAiB,IAAO,MAAQ,CAAC,EAAO,EAAe,GAAe,CAAC,EAAiB,IAAM,GAAQ,QAAQ,EAAgB,CAAC,UAAU,CAAC,OAAO,GAAM,GAAG,QAAQ,CAAC,EAAc,CAAC,CAAC,EAAE,KAAK,GAAK,CAAC,EAAiB,IAAU,EAAI,MA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