var goodFreeBaseUrl="https://gifts.good-apps.co/";var goodFreeApiUrl="https://gifts.good-apps.co/";var goodFreeShop="superdulcesmexico.myshopify.com";var goodFreeWidget={"widget_name":"Widget - default","widget_active_img":"https:\/\/gifts.good-apps.co\/assets\/images\/widgets\/preview\/style_1.png","widget_type":"1","widget_themes":"style_1","design_type":{"position":"right","animation":"animate__fadeIn"},"top":{"top_show":true,"background_top":"#191919","close_show":true,"close_bg_color":"#2F2F2F","close_bg_color_hover":"#2F2F2F","close_color":"#fff","close_color_hover":"#fff","close_border_radius":"10","title_show":true,"title_font_size":"20","title_color":"#fff","title_font_weight":"700","title_font_style":"normal","title_line_height":"28","description_show":true,"description_font_size":"16","description_color":"#989898","description_font_weight":"400","description_font_style":"normal","description_line_height":"20"},"main":{"background_main":"#fff","wallpaper":"wallpaper_0","border_width":"0","border_color":"transparent","border_radius":"5","section_hide":false},"bottom":{"background_bottom":"transparent","checkout_btn_show":true,"checkout_btn_bg":"transparent","checkout_btn_bg_hover":"transparent","checkout_btn_font_color":"#f98800","checkout_btn_font_color_hover":"#f98800","checkout_btn_border_radius":"4","checkout_btn_font_size":"15","checkout_btn_font_weight":"400","checkout_btn_font_style":"normal","checkout_btn_line_height":"22","checkout_btn_padding_t_b":"12"},"product":{"background_offer":"#fff","background":"#fff","prod_border_width":"1","prod_border_color":"#e6e6e6","prod_border_radius":"5","prod_title_show":true,"prod_title_color":"#000","prod_title_font_size":"18","prod_title_font_weight":"700","prod_title_font_style":"normal","prod_title_line_height":"26","prod_desc_show":true,"prod_desc_color":"#757474","prod_desc_font_size":"14","prod_desc_font_weight":"400","prod_desc_font_style":"normal","prod_desc_line_height":"18","prod_name_show":true,"prod_name_color":"#757474","prod_name_font_size":"14","prod_name_font_weight":"400","prod_name_font_style":"normal","prod_name_line_height":"24","price_show":false,"price_color":"#f98800","price_font_size":"12","price_font_weight":"500","price_font_style":"normal","price_line_height":"24","compare_price_show":false,"compare_price_color":"#757474","compare_price_font_size":"12","compare_price_font_weight":"500","compare_price_font_style":"normal","compare_price_line_height":"24","variations_background":"#fff","variations_font_color":"#757474","variations_border_width":"1","variations_border_color":"#e6e6e6","variations_border_radius":"3","icon_color":"#656565","prod_active_border_color":"#50b83c"},"translation":{"title":"Free Gifts","description":"Gifts will be added at checkout","checkout_btn":"Checkout"},"custom_css":".goodfg-title, .goodfg-description {text-align: center;} .goodfg-offer {box-shadow: 2px 2px 4px rgba(25, 25, 25, 0.09);} .goodfg-product {border-top-width: 1px !important;}"};var goodFreeCurrencyCode="USD";var goodFreeCurrencySymbol="$";var goodFreeVersion="60";var goodFreeActiveApp="1";var goodFreeRemoveFunnelProducts="2";var goodFreeShowPopupAllPeriod="0";var goodFreeShowPopupPerDay="0";var goodFreeMaxShowOffer="0";var goodFreeTriggerButton="";var goodFreeCartButton="";var goodFreeBuyItNow="";var goodFreeIconUrl="https://gifts.good-apps.co/assets/images/gift_icons_small";var goodFreeDiscountCodes="0";var goodFreeThreshold="0";var goodFreeLabel="";var goodFreeQnt="";var goodFreeAppName="GoodAppsFreeGifts";var goodFreeAllowBlockQty=[];if(!goodFreeApp){var goodFreeApp=function(){if(goodFreeActiveApp==="0"){return;} if(window.ShopifyAnalytics&&window.ShopifyAnalytics.meta.page.pageType=='product'&&window.ShopifyAnalytics.meta.product.type=='ghost_product'){let indexOf=window.location.href.indexOf('free-gift-');let newUrl=window.location.href.slice(0,indexOf)+window.location.href.slice(indexOf+10,window.location.href.length);window.location.replace(newUrl);} let purchaseData=[];let isActive;const url=location.href;const storeUrl=new URL(url).origin;let rootId1='goodappsf-icon';let rootId2='goodappsf-offers';let iframe1;let iframe2;let widgetStyles=goodFreeWidget;let oneFreeGift=typeof goodFreeThreshold!='undefined'?+goodFreeThreshold:false;let addToCart=typeof goodFreeDiscountCodes!='undefined'?(+goodFreeDiscountCodes?false:true):false;addToCart=!addToCart;let freeGiftLabel=typeof goodFreeLabel!='undefined'?(goodFreeLabel?goodFreeLabel:'Free Gift'):'Free Gift';let giftIcon;let boxWrapper;let boxWrapperIn;const defaultChackoutTriggers=['.cart__submit','input[name="checkout"]','button[name="checkout"]'];const defaultBuyItNowTriggers=['.shopify-payment-button__button'];const quantityClasses=['.cart-item .quantity__button.no-js-hidden','.cart-item .quantity__input'];let otherClasess=typeof goodFreeQnt==='undefined'?'':goodFreeQnt;if(goodFreeBuyItNow!=''){cloneNodeBtn(goodFreeBuyItNow);} addGlobalCSS(widgetStyles);function addGlobalCSS(widgetStyles){if(widgetStyles.custom_css_float===null){return;} const styleTag=``;document.head.insertAdjacentHTML('beforeend',styleTag);} let allCheckoutTriggers=goodFreeBuyItNow?goodFreeBuyItNow:'';allCheckoutTriggers=goodFreeTriggerButton?allCheckoutTriggers+goodFreeTriggerButton:allCheckoutTriggers;allCheckoutTriggers=allCheckoutTriggers.split(',').map((el)=>el.trim());allCheckoutTriggers=allCheckoutTriggers.concat(defaultChackoutTriggers);allCheckoutTriggers=allCheckoutTriggers.concat(defaultBuyItNowTriggers);allCheckoutTriggers=[...new Set(allCheckoutTriggers)];allCheckoutTriggers=allCheckoutTriggers.filter((el)=>el);let allInputQntClasses=otherClasess.split(',').map((el)=>el.trim());allInputQntClasses=allInputQntClasses.concat(quantityClasses);let freeGiftObjects=[];let boxIsOpen=false;let chosenFreeGifts=window.localStorage.getItem('goodappsf-free-gifts');goodFreeCurrencySymbol=decodeHTML(goodFreeCurrencySymbol.replace(/(<([^>]+)>)/ig,""));const currentCurrencyCode=Shopify.currency.active;let currentCurrencySymbol=goodFreeCurrencySymbol;let currencyRate=1;if(goodFreeCurrencyCode!==currentCurrencyCode){const country=Shopify.country;currencyRate=Shopify.currency.rate;const regexStr=getMainCurrencySymbol();currentCurrencySymbol=goodFreeCurrencySymbol.replace(regexStr,getCurrencySymbol(country,currentCurrencyCode));} function getCurrencySymbol(locale,currency){return(0).toLocaleString(locale.toLowerCase(),{style:'currency',currency:currency,minimumFractionDigits:0,maximumFractionDigits:0}).replace(/\d/g,'').trim()} function getMainCurrencySymbol(){if(goodFreeCurrencySymbol.includes('{{')){return goodFreeCurrencySymbol.replace(/{{(.*?)}}/ig,'').trim();}else{return goodFreeCurrencySymbol.trim();}} function getPriceByRate(price){return(parseFloat(price)*currencyRate).toFixed(2);} function getStorePriceByRate(price){return parseFloat((parseFloat(price)*currencyRate).toFixed(2));} function currencyFormat(num){if(currentCurrencySymbol.includes('{{')){return currentCurrencySymbol.replace(/{{(.*?)}}/ig,formatNumber(num));}else{return currentCurrencySymbol+formatNumber(num);}} function formatNumber(num){num=parseFloat(num).toFixed(2);return num.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1,");} function setCookieData(){let url=location.href;const goodappsfbCurrentShownPerMonth=getCookie('goodappsfCurrentShownPerMonth');const goodappsfbCurrentShownPerDay=getCookie('goodappsfCurrentShownPerDay');const ZERO=0;const oneMonth=new Date(Date.now()+3600000*24*25);const oneWeek=new Date(Date.now()+3600000*24*7);const oneDay=new Date(Date.now()+3600000*24);let currentDate=new Date(Date.now());currentDate=currentDate.toUTCString();if(url.includes('#')){url=url.split('#');if(url[url.length-1]){let parameter='#'+url[url.length-1];setCookie('goodappsfUrl',parameter,{expires:oneWeek});}} if(!goodappsfbCurrentShownPerMonth){setCookie('goodappsfCurrentShownPerMonth',ZERO,{expires:oneMonth});setCookie('goodappsfStartDatePerMonth',currentDate,{expires:oneMonth});} if(!goodappsfbCurrentShownPerDay){setCookie('goodappsfCurrentShownPerDay',ZERO,{expires:oneDay});setCookie('goodappsfStartDatePerDay',currentDate,{expires:oneDay});}} setCookieData();function setCookie(name,value,options={}){options={path:'/',...options};if(options.expires instanceof Date){options.expires=options.expires.toUTCString();} let updatedCookie=encodeURIComponent(name)+"="+encodeURIComponent(value);for(let optionKey in options){updatedCookie+="; "+optionKey;let optionValue=options[optionKey];if(optionValue!==true){updatedCookie+="="+optionValue;}} document.cookie=updatedCookie;} function deleteFreeProductsInCart(){let toDeleteProducts=typeof goodFreeRemoveFunnelProducts=='undefined'?3:goodFreeRemoveFunnelProducts;let chosenFreeGifts=window.localStorage.getItem('goodappsf-free-gifts');if(chosenFreeGifts){chosenFreeGifts=JSON.parse(chosenFreeGifts);} if(toDeleteProducts==2&&chosenFreeGifts){let productsTodeleteDiscounts=[];fetchCart().then(function(dataCart){dataCart.items.forEach((item,i)=>{if(item.properties&&item.properties.status==freeGiftLabel){item.index=i;productsTodeleteDiscounts.push(item);}});let promiseObjs=productsTodeleteDiscounts.map((item)=>{return{'line':item.index+1};});Promise.all(promiseObjs.map((data)=>removeItem(data))).then(()=>{}).catch((err)=>{console.log('err',err);});})}} deleteFreeProductsInCart();function getCookie(name){let matches=document.cookie.match(new RegExp("(?:^|; )"+name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g,'\\$1')+"=([^;]*)"));return matches?decodeURIComponent(matches[1]):undefined;} function increasePopupShown(){let currentShownPerMonth=parseInt(getCookie('goodappsfCurrentShownPerMonth'));let currentShownPerDay=parseInt(getCookie('goodappsfCurrentShownPerDay'));let goodappsfbStartDatePerMonth=getCookie('goodappsfStartDatePerMonth');let goodappsfbStartDatePerDay=getCookie('goodappsfStartDatePerDay');currentShownPerMonth++;currentShownPerDay++;let expireMonth=new Date(Date.parse(goodappsfbStartDatePerMonth)+3600000*24*25);let expireDay=new Date(Date.parse(goodappsfbStartDatePerDay)+3600000*24);setCookie('goodappsfCurrentShownPerMonth',currentShownPerMonth,{expires:expireMonth});setCookie('goodappsfCurrentShownPerDay',currentShownPerDay,{expires:expireDay});} function isPopupShown(){const currentShownPerMonth=parseInt(getCookie('goodappsfCurrentShownPerMonth'));const currentShownPerDay=parseInt(getCookie('goodappsfCurrentShownPerDay'));if((parseInt(goodFreeShowPopupPerDay)>currentShownPerDay||parseInt(goodFreeShowPopupPerDay)===0)&&(parseInt(goodFreeShowPopupAllPeriod)>currentShownPerMonth||parseInt(goodFreeShowPopupAllPeriod)===0)){return true}else{return false}} if(location.href.includes('offerId')&&location.href.includes(goodFreeAppName)){setCrisp();buildPreviewMessage();addPreviewMessageStyles();setTimeout(()=>{openPopup();},0) popupEvents();} function buildPreviewMessage(){const html=`