{
  "version": 3,
  "sources": ["ssg:https://framerusercontent.com/modules/7dEgbg7qo3lsQk361YtS/GcbE9R3HahoLzirI2AwT/_utils.js", "ssg:https://framer.com/m/framer/store.js@^1.0.0", "ssg:https://framer.com/m/Store-Lbnw.js@EJ7oE8HLLZT5ZdmxDrqT", "ssg:https://framerusercontent.com/modules/hwL15yavZKdMNShkO3Of/In303XapPqIDyHIIxJd1/CheckoutWtihCoupon.js"],
  "sourcesContent": ["import{ControlType,RenderTarget}from\"framer\";export const ProductBaseControls={productID:{title:\"Product ID\",type:ControlType.String}};export const isOnCanvas=()=>RenderTarget.current()===RenderTarget.canvas;export const ConfigControls={config:{type:ControlType.Object,hidden:()=>true,controls:{storefrontToken:{type:ControlType.String},storeDomain:{type:ControlType.String},countryIsoCode:{type:ControlType.String,defaultValue:\"US\"},languageIsoCode:{type:ControlType.String,defaultValue:\"EN\"},testMode:{type:ControlType.Boolean,defaultValue:true}}},font:{type:ControlType.Font,hidden:()=>true}};export function cn(...styles){let final={};styles.forEach(style=>{if(style){final={...final,...style};if(typeof style.border===\"object\"){final={...final,...style.border};}if(typeof style.font===\"object\"){final={...final,...style.font};}if(style.hidden){final={...final,display:\"none\"};}}});return final;}export function priceCode(price,config){if(!price)return\"\";var _ref;const locale=(_ref=(config===null||config===void 0?void 0:config.languageIsoCode.includes(\"_\"))?config===null||config===void 0?void 0:config.languageIsoCode.replace(\"_\",\"-\"):`${config===null||config===void 0?void 0:config.languageIsoCode}-${config===null||config===void 0?void 0:config.countryIsoCode}`)!==null&&_ref!==void 0?_ref:\"EN-US\";const amount=parseFloat(price.amount);const formatter=new Intl.NumberFormat(locale,{style:\"currency\",currency:price.currencyCode});return formatter.format(amount);}/**\n * Parses global id (gid) and returns the resource type and id.\n * @see https://shopify.dev/api/usage/gids\n * @param gid - A shopify GID (string)\n *\n * @example\n * ```ts\n * const {id, resource} = parseGid('gid://shopify/Order/123')\n * // => id = \"123\", resource = 'Order'\n *\n *  * const {id, resource} = parseGid('gid://shopify/Cart/abc123')\n * // => id = \"abc123\", resource = 'Cart'\n * ```\n **/export function parseGid(gid){const defaultReturn={id:\"\",resource:null,resourceId:null,search:\"\",searchParams:new URLSearchParams,hash:\"\"};if(typeof gid!==\"string\"){return defaultReturn;}try{const{search,searchParams,pathname,hash}=new URL(gid);const pathnameParts=pathname.split(\"/\");const lastPathnamePart=pathnameParts[pathnameParts.length-1];const resourcePart=pathnameParts[pathnameParts.length-2];if(!lastPathnamePart||!resourcePart){return defaultReturn;}const id=`${lastPathnamePart}${search}${hash}`||\"\";const resourceId=lastPathnamePart||null;const resource=resourcePart!==null&&resourcePart!==void 0?resourcePart:null;return{id,resource,resourceId,search,searchParams,hash};}catch{return defaultReturn;}}export function debounce(func,delay){let timeoutId;return function(...args){clearTimeout(timeoutId);timeoutId=setTimeout(()=>{func.apply(this,args);},delay);};}function areDimensionsClose(el1,el2,threshold=5){const rect1=el1.getBoundingClientRect();const rect2=el2.getBoundingClientRect();const widthDifference=Math.abs(rect1.width-rect2.width);const heightDifference=Math.abs(rect1.height-rect2.height);// Check if both width and height differences are within the threshold\nreturn widthDifference<=threshold&&heightDifference<=threshold;}export const checkConfigAreSame=()=>{const wrappers=document.querySelectorAll(\".groundNodeWrapper\");wrappers.forEach(wrapper=>{const errorEl=wrapper.querySelector(\"#shopiframe-error\");const elements=wrapper.querySelectorAll(\"[data-shopiframe-store]\");let areSame=true;if(errorEl)wrapper.removeChild(errorEl);if(elements.length){const firstValue=elements[0].getAttribute(\"data-shopiframe-store\");elements.forEach(item=>{if(item.getAttribute(\"data-shopiframe-store\")!==firstValue){areSame=false;}});}if(!areSame){const errorStr=`\n        <div id=\"shopiframe-error\" style=\"position: absolute; top:0; left:0; right:0;z-index:999; bottom:0; border: solid 0.3vw #B00020;\" >\n        <p style=\"background: #B00020; font-size:22px; font-weight: 500; padding: 10px 10px calc(10px + 0.3vw); margin: 0; color: #fff;\" ><b>Shopiframe</b>: Components with different configurations detected. Please open the Shopiframe Plugin, and the issue will be fixed.</p>\n        </div>`;wrapper.insertAdjacentHTML(\"afterbegin\",errorStr);}});};export const textProperties=(fontSize=16,color)=>{return{fontSize:{type:ControlType.Number,min:6,max:100,defaultValue:fontSize},color:{type:ControlType.Color,defaultValue:color},font:{type:ControlType.Font,displayTextAlignment:true,defaultFontType:\"sans-serif\"},padding:{type:ControlType.Padding}};};\nexport const __FramerMetadata__ = {\"exports\":{\"cn\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"debounce\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"textProperties\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"ProductBaseControls\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"isOnCanvas\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"checkConfigAreSame\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"priceCode\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"parseGid\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"ConfigControls\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./_utils.map", "import{useState,useEffect}from\"react\";import{Data,useObserveData}from\"framer\";export function createStore(state1){// Use Data so that a Preview reload resets the state\nconst dataStore=Data({state:Object.freeze({...state1})});// Create a set function that updates the state\nconst setDataStore=newState=>{// If the state is an object, make sure we copy it\nif(typeof newState===\"function\"){newState=newState(dataStore.state);}dataStore.state=Object.freeze({...dataStore.state,...newState});};// Store the initial state, copy the object if it's an object\nlet storeState=typeof state1===\"object\"?Object.freeze({...state1}):state1;// Keep a list of all the listeners, in the form of React hook setters\nconst storeSetters=new Set();// Create a set function that updates all the listeners / setters\nconst setStoreState=newState=>{// If the state is an object, make sure we copy it\nif(typeof newState===\"function\"){newState=newState(storeState);}storeState=typeof newState===\"object\"?Object.freeze({...storeState,...newState}):newState;// Update all the listeners / setters with the new value\nstoreSetters.forEach(setter=>setter(storeState));};// Create the actual hook based on everything above\nfunction useStore(){// Create the hook we are going to use as a listener\nconst[state,setState]=useState(storeState);// If we unmount the component using this hook, we need to remove the listener\n// @ts-ignore\nuseEffect(()=>{// But right now, we need to add the listener\nstoreSetters.add(setState);return()=>storeSetters.delete(setState);},[]);// If Data context exists, use Data, otherwise use vanilla React state\nif(useObserveData()===true){useObserveData();return[dataStore.state,setDataStore];}else{// Return the state and a function to update the central store\nreturn[state,setStoreState];}}return useStore;}\nexport const __FramerMetadata__ = {\"exports\":{\"createStore\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./createStore.map", "import{createStore}from\"https://framer.com/m/framer/store.js@^1.0.0\";export const useStore=createStore({});\nexport const __FramerMetadata__ = {\"exports\":{\"useStore\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Store.map", "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/7dEgbg7qo3lsQk361YtS/GcbE9R3HahoLzirI2AwT/_utils.js\";// import { useCart } from \"https://framerusercontent.com/modules/kEMMGb5hqGCVwEpqX70U/GbzF3o48GqpDPjh2Rm4y/_useCart.js\"\n// import ComponentWrapper from \"https://framerusercontent.com/modules/hQlZBgGeLDev5WuUJA4d/bjHQA4uLvjbgjrDSUO16/ComponentWrapper.js\"\n// import {cn, ConfigControls} from \"https://framerusercontent.com/modules/eAejHXy6apg0StNmpKvK/GXn1lJ5V4nUwhRO9yQKC/_framer_utils.js\";\nimport{useCart}from\"https://framerusercontent.com/modules/kEMMGb5hqGCVwEpqX70U/xtbUYyPMDwLhvH64M4SK/_useCart.js\";import ComponentWrapper from\"https://framerusercontent.com/modules/hQlZBgGeLDev5WuUJA4d/6ncqGCEKZWsfLWpBe7Jn/ComponentWrapper.js\";import{useStore}from\"https://framer.com/m/Store-Lbnw.js@EJ7oE8HLLZT5ZdmxDrqT\";/**\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight auto\n */export default function Shopify_CartCheckoutButton(props){const{cart,cartCount}=useCart(props.config);const url=cart?.checkoutUrl;const isEnabled=!!url&&cartCount>0;const[{discountCode}]=useStore();console.log(\"discount code: \",discountCode);return /*#__PURE__*/_jsx(ComponentWrapper,{style:cn(styles.wrapper),config:props.config,children:/*#__PURE__*/_jsx(motion.button,{onClick:()=>{if(isEnabled){const newUrl=new URL(url);if(discountCode===\"\"||discountCode===null||discountCode===undefined){}else{newUrl.searchParams.set(\"discount\",discountCode);}location.href=newUrl.href;}},disabled:!isEnabled,whileHover:{...cn(props.hoverStyles),transition:{duration:.45}},style:cn(styles.container,props.styles,!isEnabled&&styles.disabled),children:/*#__PURE__*/_jsx(\"span\",{children:props.label})})});}Shopify_CartCheckoutButton.displayName=\"Modified Checkout Button with Coupon\";addPropertyControls(Shopify_CartCheckoutButton,{config:{type:ControlType.Object,controls:{storefrontToken:{type:ControlType.String},storeDomain:{type:ControlType.String},countryIsoCode:{type:ControlType.String,defaultValue:\"US\"},languageIsoCode:{type:ControlType.String,defaultValue:\"EN\"},testMode:{type:ControlType.Boolean,defaultValue:true}},description:\"Input the same settings as settings. This is a modified component. It can not inherit the config from plugin, so we have to manually change it.\"},label:{title:\"Label\",type:ControlType.String,defaultValue:\"Checkout\"},styles:{buttonTitle:\"Style\",type:ControlType.Object,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,controls:{color:{type:ControlType.Color,defaultValue:\"#fff\",optional:true},backgroundColor:{type:ControlType.Color,defaultValue:\"#000\",optional:true},border:{type:ControlType.Border,defaultValue:{borderColor:\"#fff\"}}}}});const styles={wrapper:{display:\"flex\",flexDirection:\"column\",gap:8},container:{display:\"flex\",flexDirection:\"row\",alignItems:\"center\",justifyContent:\"center\",cursor:\"pointer\",flex:1,fontFamily:\"inherit\"},disabled:{opacity:.8}};\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"Shopify_CartCheckoutButton\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"auto\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./CheckoutWtihCoupon.map"],
  "mappings": "4KAAoD,IAAMA,EAAoB,CAAC,UAAU,CAAC,MAAM,aAAa,KAAKC,EAAY,MAAM,CAAC,EAAkF,IAAMC,EAAe,CAAC,OAAO,CAAC,KAAKC,EAAY,OAAO,OAAO,IAAI,GAAK,SAAS,CAAC,gBAAgB,CAAC,KAAKA,EAAY,MAAM,EAAE,YAAY,CAAC,KAAKA,EAAY,MAAM,EAAE,eAAe,CAAC,KAAKA,EAAY,OAAO,aAAa,IAAI,EAAE,gBAAgB,CAAC,KAAKA,EAAY,OAAO,aAAa,IAAI,EAAE,SAAS,CAAC,KAAKA,EAAY,QAAQ,aAAa,EAAI,CAAC,CAAC,EAAE,KAAK,CAAC,KAAKA,EAAY,KAAK,OAAO,IAAI,EAAI,CAAC,EAAS,SAASC,KAAMC,EAAO,CAAC,IAAIC,EAAM,CAAC,EAAE,OAAAD,EAAO,QAAQE,GAAO,CAAIA,IAAOD,EAAM,CAAC,GAAGA,EAAM,GAAGC,CAAK,EAAK,OAAOA,EAAM,QAAS,WAAUD,EAAM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E,SAAS,CAAC,KAAKA,EAAY,QAAQ,aAAa,EAAI,CAAC,EAAE,YAAY,iJAAiJ,EAAE,MAAM,CAAC,MAAM,QAAQ,KAAKA,EAAY,OAAO,aAAa,UAAU,EAAE,OAAO,CAAC,YAAY,QAAQ,KAAKA,EAAY,OAAO,SAAS,CAAC,GAAGC,EAAe,GAAG,MAAM,EAAE,gBAAgB,CAAC,MAAM,mBAAmB,KAAKD,EAAY,MAAM,SAAS,EAAI,EAAE,OAAO,CAAC,KAAKA,EAAY,OAAO,aAAa,CAAC,YAAY,MAAM,CAAC,EAAE,aAAa,CAAC,KAAKA,EAAY,aAAa,aAAa,KAAK,EAAE,QAAQ,CAAC,KAAKA,EAAY,QAAQ,aAAa,qBAAqB,CAAC,CAAC,EAAE,WAAW,CAAC,MAAM,QAAQ,YAAY,QAAQ,KAAKA,EAAY,OAAO,SAAS,CAAC,MAAM,CAAC,KAAKA,EAAY,MAAM,aAAa,OAAO,SAAS,EAAI,EAAE,gBAAgB,CAAC,KAAKA,EAAY,MAAM,aAAa,OAAO,SAAS,EAAI,EAAE,OAAO,CAAC,KAAKA,EAAY,OAAO,aAAa,CAAC,YAAY,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,IAAMJ,EAAO,CAAC,QAAQ,CAAC,QAAQ,OAAO,cAAc,SAAS,IAAI,CAAC,EAAE,UAAU,CAAC,QAAQ,OAAO,cAAc,MAAM,WAAW,SAAS,eAAe,SAAS,OAAO,UAAU,KAAK,EAAE,WAAW,SAAS,EAAE,SAAS,CAAC,QAAQ,EAAE,CAAC",
  "names": ["ProductBaseControls", "ControlType", "ConfigControls", "ControlType", "cn", "styles", "final", "style", "textProperties", "fontSize", "color", "ControlType", "createStore", "state1", "dataStore", "Data", "setDataStore", "newState", "storeState", "storeSetters", "setStoreState", "setter", "useStore", "state", "setState", "ye", "ue", "useObserveData", "useStore", "createStore", "Shopify_CartCheckoutButton", "props", "cart", "cartCount", "useCart", "url", "isEnabled", "discountCode", "useStore", "p", "ComponentWrapper", "cn", "styles", "motion", "newUrl", "addPropertyControls", "ControlType", "textProperties"]
}
