/* eslint-disable */ "use strict"; function sweetHelpLoadScript(onJQueryLoad) { if (typeof (jQuery) == 'undefined' || !jQuery.ajax) { (function () { // Load jquery script if doesn't exist var script = document.createElement("SCRIPT"); script.src = 'https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js'; script.type = 'text/javascript'; script.onload = onJQueryLoad; document.head.appendChild(script); })(); } else { onJQueryLoad() } } function sweetHelpInitCss(e) { if(document.getElementById("sweet-help-css")){ e(); return; } var t = document.createElement("link"); const date = new Date(); t.setAttribute("rel", "stylesheet"), t.setAttribute("type", "text/css"), (t.onload = e), t.setAttribute("href", "https://appV2.sweethelp.io/sweet-help.css"); document.head.appendChild(t); } function sweetHelpBtnLoad(){ const BASE_URL = 'https://appV2.sweethelp.io'; const path = window.location.pathname; const currentPath = window.location.href; function sweetHelpShopId() { if (window.Shopify != undefined) { return window.Shopify.shop } var domain; var url = window.location.href if (url.indexOf("://") > -1) { domain = url.split('/')[2]; } else { domain = url.split('/')[0]; } domain = domain.split(':')[0]; return domain; } var shop_id = sweetHelpShopId(); localStorage.removeItem("chkevnt"); function sweetHelpGetCurrentTime(){ var d = new Date(); return d.getTime(); } function sweetHelpMobileCheck() { var e = !1; return ! function(t) { (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(t) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(t.substr(0, 4))) && (e = !0) }(navigator.userAgent || navigator.vendor || window.opera), e; } function sweetHelpDeviceType() { if (sweetHelpMobileCheck()) { return 1; } else { return 2; } } function sweetHelpWhatsappLink(phone, message, current_device_type) { var link = "" var IOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream; if (current_device_type == 2) { link = "https://web.whatsapp.com/send?text=" + message } else if(current_device_type == 1 && !IOS) { link = "whatsapp://send?text=" + message } else if(current_device_type == 1 && IOS) { link = "https://api.whatsapp.com/send?text=" + message } if(phone) { //added by TS 22062022 phone=phone.replace(/ |-/g, "") link += "&phone=" + phone } return link } function sweetHelpIsCollectionsPage() { if ((window.location.pathname.match("(.*)/collections/(.*)") || window.location.pathname.match("(.*)/collections")) && !(window.location.pathname.match("(.*)/products/(.*)") || window.location.pathname.match("(.*)/products"))) { return true } else { return false } } function sweetHelpIsCartPage() { if ((window.location.pathname.match("(.*)/cart/(.*)") || window.location.pathname.match("(.*)/cart"))) { return true } else { return false } } function sweetHelpIsOrdersPage() { if ((window.location.pathname.match("(.*)/orders/(.*)") || window.location.pathname.match("(.*)/orders") || window.location.pathname.match("(.*)/checkouts/(.*)"))) { return true } else { return false } } function sweetHelpIsBlogsPage() { if ((window.location.pathname.match("(.*)/blogs/(.*)") || window.location.pathname.match("(.*)/blogs"))) { return true } else { return false } } function sweetHelpIsGlobalPage() { if ((window.location.pathname.match("(.*)/pages/(.*)") || window.location.pathname.match("(.*)/pages"))) { return true } else { return false } } function sweetHelpIsAccountPage() { if ((window.location.pathname.match("(.*)/account/(.*)") || window.location.pathname.match("(.*)/account"))) { return true } else { return false } } function sweetHelpIsThankYouPage() { if (window.location.pathname.match("(.*)/orders/(.*)") || window.location.pathname.match("(.*)/checkouts/(.*)")) { return true } else { return false } } function sweetHelpIsProductYouPage() { if ((window.location.pathname.match("(.*)/products/(.*)") || window.location.pathname.match("(.*)/products"))) { return true } else { return false } } function sweetHelpIsCheckoutPage(){ if ((window.location.pathname.match("(.*)/checkouts/(.*)") || window.location.pathname.match("(.*)/checkouts"))) { return true } else { return false } } function sweetHelpIsWhatsAppBtnVisible(settings) { var wpnl; var wpn; wpnl=window.location.pathname.length; if(wpnl>1 && wpnl <=4){ wpn=window.location.pathname.substring(0,3); }else{ wpn=window.location.pathname; } if ((window.location.pathname === "/" ||wpn === "/ar" ||wpn === "/es" ||wpn === "/en" ||wpn === "/fr" ||wpn === "/it" ||wpn === "/nl" ||wpn === "/de" ) && settings.home_page === "home_page"){ return true; } if (sweetHelpIsCollectionsPage() && settings.collections === "collections") { return true; } if (sweetHelpIsProductYouPage() && settings.product_pages === "product_pages") { return true; } if (sweetHelpIsCartPage() && settings.cart_page === "cart_page") { return true; } if (sweetHelpIsOrdersPage() && settings.thank_you_page === "thank_you_page") { return true; } if (sweetHelpIsBlogsPage() && settings.blog_page === "blog_page") { return true; } if (sweetHelpIsGlobalPage() && settings.url_ending_with === "url_ending_with") { return true; } if (sweetHelpIsAccountPage() && settings.account_page === "account_page") { return true; } } function sweetHelpIsWhatsAppShareVisible(share) { var wpnl; var wpn; wpnl=window.location.pathname.length; if(wpnl>1){ wpn=window.location.pathname.substring(0,3); }else{ wpn=window.location.pathname; } if ((window.location.pathname === "/" ||wpn === "/ar" ||wpn === "/es" ||wpn === "/en" ||wpn === "/fr" ||wpn === "/it" ||wpn === "/nl" ||wpn === "/de" ) && share.home_page === "home_page") { return true; } if (sweetHelpIsCollectionsPage() && share.collections === "collections") { return true; } if (sweetHelpIsProductYouPage() && share.product_pages === "product_pages") { return true; } if (sweetHelpIsCartPage() && share.cart_page === "cart_page") { return true; } if (sweetHelpIsOrdersPage() && share.thank_you_page === "thank_you_page") { return true; } if (sweetHelpIsBlogsPage() && share.blog_page === "blog_page") { return true; } if (sweetHelpIsGlobalPage() && share.url_ending_with === "url_ending_with") { return true; } if (sweetHelpIsAccountPage() && share.account_page === "account_page") { return true; } } function sweetHelpGetTargetButton(target) { if (!target) { return null } else if (target.tagName == "BUTTON") { return target }else if (target.tagName == "INPUT" && target.type == "submit") { return target } else if (jQuery(target).closest('button')) { return jQuery(target).closest('button')[0] } } function sweetHelpGetTargetAhref(target) { if(!target) { return null } else if (target.tagName == "A") { return target } else if (jQuery(target).closest("a")) { return jQuery(target).closest("a")[0] } } /* function sweetHelpLoadOptPopup(data, dismiss){ var html = `
${text}
`; id.prepend(htmlCallOut); setTimeout(function() { $('.sweethelp-callout').show(); sweetHelpSetCookie('sh_call_out_popup_time', sweetHelpGetCurrentTime(), 1) }, time); } function sweetHelpShuffle(array) { var currentIndex = array.length, temporaryValue, randomIndex; while (0 !== currentIndex) { randomIndex = Math.floor(Math.random() * currentIndex); currentIndex -= 1; temporaryValue = array[currentIndex]; array[currentIndex] = array[randomIndex]; array[randomIndex] = temporaryValue; } return array; } function sweetHelpWhatsAppWidgetClass(val){ if (val === 2){return "sweet-help-chatbox-one";} else if (val === 3){return "sweet-help-chatbox-two";} else if (val === 4){return "sweet-help-chatbox-three";} else{return ""} } function sweetHelpGetCountryCode(success){ $.getJSON('https://cdn.shopify.com/s/files/1/0563/2226/1182/t/1/assets/iso_code.json?v=1623689281', function(data) { success(data); }) } function sweetHelpMakeWhatsappButton(data){ var current_device_type = sweetHelpDeviceType() //console.log(current_device_type); var phone = data.phone != undefined && data.phone != null ? data.phone : null, setting = data.settings != undefined && data.settings != null ? data.settings : null; if (setting && setting.is_chat_enabled && setting.selected_button != null && (setting.button_display_type && current_device_type) !== 0 && sweetHelpIsWhatsAppBtnVisible(setting.page)){ var ifWidgetUnavailable = ''; let mobilePosition = setting.button_display_position_mobile === 2 ? "sweethelp-wa-share-btn-pos-right" : "sweethelp-wa-share-btn-pos-left" ; let justifyContent = setting.button_display_position_mobile === 2 ? "sweethelp-justify-content-right" : "sweethelp-justify-content-left" ; let desktopPosition = setting.button_display_position_desktop === 2 ? "sweethelp-wa-share-btn-pos-right" : "sweethelp-wa-share-btn-pos-left" ; let leftRightPositionMobile = setting.button_display_position_mobile === 2 ? "right" : "left" ; let leftRightPositionDesktop = setting.button_display_position_desktop === 2 ? "right" : "left" ; let hideDesktop = setting.button_display_type === 1 && current_device_type === 2 ? "sweethelp-hide-wp-share-button" : (setting.button_display_type === 3 && current_device_type === 1 ? "sweethelp-hide-wp-share-button" :"" ) let backgroundColor = setting.chat_bg_type === 1 ? 'style="background-color: '+ setting.chat_bg_one +' "': 'style="background-image: linear-gradient(110.56deg, '+setting.chat_bg_one+' 0%, '+setting.chat_bg_two+')"'; let backgroundColorWidget = setting.widget_bg_color_type === 1 ? 'style="background-color: '+ setting.widget_bg_one +' "': 'style="background-image: linear-gradient(110.56deg, '+setting.widget_bg_one+' 0%, '+setting.widget_bg_two+')"'; let chatHeightDesktop = setting.height_offset_desktop != null ? setting.height_offset_desktop : ''; let chatEdgeDesktop = setting.edge_offset_desktop != null ? setting.edge_offset_desktop : ''; let chatHeightMobile = setting.height_offset_mobile != null ? setting.height_offset_mobile : ''; let chatEdgeMobile = setting.edge_offset_mobile != null ? setting.edge_offset_mobile : ''; let HTML = `