{"version":3,"file":"ComponentWrapper.fPssIhot.mjs","names":[],"sources":["https:/framerusercontent.com/modules/eAejHXy6apg0StNmpKvK/urqFMX8moevipl03sMG8/_framer_utils.js","https:/framerusercontent.com/modules/7dEgbg7qo3lsQk361YtS/Gqkzce24K1Cg6rwNd2hA/_utils.js","https:/framerusercontent.com/modules/hQlZBgGeLDev5WuUJA4d/efplB9Cs5ZjhxVN6gafY/ComponentWrapper.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},permissions:{type:ControlType.Object,controls:{selling_plans:{type:ControlType.Boolean,defaultValue:false}}}}},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(\"hidden\"in style&&style.hidden){final={...final,display:\"none\"};}}});return final;}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\":{\"isOnCanvas\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"ConfigControls\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"ProductBaseControls\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"textProperties\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"cn\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./_framer_utils.map","import React from\"react\";export function priceCode(price,config){if(!price)return\"\";const locale=(config?.languageIsoCode.includes(\"_\")?config?.languageIsoCode.replace(\"_\",\"-\"):`${config?.languageIsoCode}-${config?.countryIsoCode}`)??\"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;return{id,resource,resourceId,search,searchParams,hash};}catch{return defaultReturn;}}export function deepEqual(obj1,obj2){// Check if both are the same reference\nif(obj1===obj2)return true;// Check if either is null or undefined\nif(obj1==null||obj2==null)return obj1===obj2;// Check if types are different\nif(typeof obj1!==typeof obj2)return false;// Handle primitive types\nif(typeof obj1!==\"object\")return obj1===obj2;// Handle Arrays\nif(Array.isArray(obj1)&&Array.isArray(obj2)){if(obj1.length!==obj2.length)return false;for(let i=0;i<obj1.length;i++){if(!deepEqual(obj1[i],obj2[i]))return false;}return true;}// Handle Objects\nconst keys1=Object.keys(obj1);const keys2=Object.keys(obj2);// Check if they have the same number of keys\nif(keys1.length!==keys2.length)return false;// Check if all keys and values match\nfor(const key of keys1){if(!keys2.includes(key))return false;const val1=obj1[key];const val2=obj2[key];if(!deepEqual(val1,val2))return false;}return true;}export function debounce(func,delay){let timeoutId;return function(...args){clearTimeout(timeoutId);timeoutId=setTimeout(()=>{func.apply(this,args);},delay);};}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 addPropsToChildren=(children,changeProps,allInstances)=>{return React.Children.map(children,child=>{if(!/*#__PURE__*/React.isValidElement(child)){return child;}let childProps=child.props??{};// padd changedProps to all child elements props\nif(childProps.children&&allInstances){childProps.children=addPropsToChildren(childProps.children,changeProps,allInstances);}childProps={...childProps,...changeProps};return /*#__PURE__*/React.cloneElement(child,childProps);});};export function generateUpdatedAt(){return new Date().toISOString();}/**\n * Checks if a new config should be applied based on updatedAt timestamps.\n * Returns true if the new config should be applied, false otherwise.\n */export function shouldApplyConfig(currentConfig,newConfig){if(!currentConfig){return true;}if(!newConfig){return false;}// If either config has no updatedAt, check if the configs are different\nif(!currentConfig.updatedAt||!newConfig.updatedAt){return!deepEqual(currentConfig,newConfig);}const currentTime=new Date(currentConfig.updatedAt).getTime();const newTime=new Date(newConfig.updatedAt).getTime();return newTime>currentTime;}/**\n * Reverses the position of currency symbol/code in a price string\n */export function reverseCurrencyPosition(price){if(!price)return price;const currencyAtStart=price.match(/^([^\\d\\s]+)(\\s*)(.+)$/);if(currencyAtStart){const[,currency,space,amount]=currencyAtStart;return`${amount}${space}${currency}`;}const currencyAtEnd=price.match(/^(.+?)(\\s*)([^\\d\\s]+)$/);if(currencyAtEnd){const[,amount,space,currency]=currencyAtEnd;return`${currency}${space}${amount}`;}return price;}\nexport const __FramerMetadata__ = {\"exports\":{\"shouldApplyConfig\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"parseGid\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"addPropsToChildren\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"priceCode\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"debounce\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"reverseCurrencyPosition\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"deepEqual\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"generateUpdatedAt\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"checkConfigAreSame\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./_utils.map","import{jsx as _jsx}from\"react/jsx-runtime\";import{cn}from\"https://framerusercontent.com/modules/eAejHXy6apg0StNmpKvK/urqFMX8moevipl03sMG8/_framer_utils.js\";export default function ComponentWrapper({name,children,style={},hidden=false,productID,config}){const dataAttributes={\"data-shopiframe\":\"component\",\"data-shopiframe-store\":config?.storeDomain};console.log(name,!!config?.testMode);if(productID===\"EMPTY\")return /*#__PURE__*/_jsx(\"div\",{style:{background:\"#C83E3E\",color:\"#fff\",borderRadius:\"10px\",padding:\"8px\",boxShadow:\"0px 5px 15px 0px #AC1B1B33\",fontWeight:\"600\"},...dataAttributes,children:\"Product ID required for this component\"});if(hidden)return null;return /*#__PURE__*/_jsx(\"div\",{style:cn(style),...dataAttributes,children:typeof children===\"function\"?hidden||productID===\"EMPTY\"?null:children():children});}\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ComponentWrapper\",\"slots\":[\"children\"],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ComponentWrapper.map"],"mappings":"4JAAisB,SAAgB,EAAG,GAAG,EAAO,CAAC,IAAI,EAAM,CAAC,EAA2Q,OAAzQ,EAAO,QAAQ,GAAO,CAAI,IAAO,EAAM,CAAC,GAAG,EAAM,GAAG,CAAK,EAAK,OAAO,EAAM,QAAS,WAAU,EAAM,CAAC,GAAG,EAAM,GAAG,EAAM,MAAM,GAAM,OAAO,EAAM,MAAO,WAAU,EAAM,CAAC,GAAG,EAAM,GAAG,EAAM,IAAI,GAAM,WAAW,GAAO,EAAM,SAAQ,EAAM,CAAC,GAAG,EAAM,QAAQ,MAAM,GAAI,CAAC,EAAS,CAAM,uBAAt9B,EAAc,EAAoB,CAAC,UAAU,CAAC,MAAM,aAAa,KAAK,EAAY,MAAM,CAAC,EAAwF,EAAe,CAAC,OAAO,CAAC,KAAK,EAAY,OAAO,WAAW,GAAK,SAAS,CAAC,gBAAgB,CAAC,KAAK,EAAY,MAAM,EAAE,YAAY,CAAC,KAAK,EAAY,MAAM,EAAE,eAAe,CAAC,KAAK,EAAY,OAAO,aAAa,IAAI,EAAE,gBAAgB,CAAC,KAAK,EAAY,OAAO,aAAa,IAAI,EAAE,SAAS,CAAC,KAAK,EAAY,QAAQ,aAAa,EAAI,EAAE,YAAY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