// DEBUG MODE -- Set to true if you want console logs to show. var approve_debug_mode = false; if (approve_debug_mode) { approve_debug_log("NEW APPROVE SCRIPT LOADED"); } // window.kwipped_approve = window.kwipped_approve || {}; // window.kwipped_approve.url = "https://www.kwipped.com"; // window.kwipped_approve.approve_id = "eyJpdiI6Ikw1enpEV1RrMTZrWTFyRnFoSlRWQnc9PSIsInZhbHVlIjoiSkVqWWVqWjYwQVBvdmZOZ0p0OWpkdz09IiwibWFjIjoiMGVmNGYxMTUzYTA4YjEzNjBlNDFlNDhlOWVlZjVlZjM2NDViN2Q0NDg0MmUwZDYwNmFlZjkzZmFjOWEzMTNjMiJ9"; approve_debug_log("APPROVEID => "+window.kwipped_approve.approve_id); var approve_style_ele = document.createElement("style"); approve_style_ele.textContent = ".btnCl, #clActionsWrapp, #btcClRounded {display: none !important;}"; window.document.head.appendChild(approve_style_ele); var approve_remove_buttons = window.document.querySelectorAll("#clActionsWrapp"); if (approve_remove_buttons && approve_remove_buttons.length ) { for (var i = 0; i < approve_remove_buttons.length; i++) { approve_remove_buttons[i].remove(); } } var approve_change_buttons = window.document.querySelectorAll("[href*='https://app.clicklease.com']"); if (approve_change_buttons && approve_change_buttons.length ) { var approve_hosted_store_url = ""; if (window.kwipped_approve && window.kwipped_approve.url && window.kwipped_approve.approve_id ) { approve_hosted_store_url = window.kwipped_approve.url + "/approve/financestore?approveid="+window.kwipped_approve.approve_id; } for (var j = 0; j < approve_change_buttons.length; j++) { approve_change_buttons[j].setAttribute("href",approve_hosted_store_url); // approve_change_buttons[j].removeAttribute("href"); // window.kwipped_approve.core.activate_approve_teaser_rates(); } } var approve_original_href = document.location.href; window.onload = function() { var approve_body_ele = document.querySelector("body") var observer = new MutationObserver(function(mutations) { mutations.forEach(function(mutation) { if (approve_original_href != document.location.href) { approve_original_href = document.location.href; approve_debug_log("APPROVE SCRIPT LOADED IN MUTATION"); approve_loader_init(); setTimeout(() => { approve_cart_page_integration(); }, 900); } }); }); var config = { childList: true, subtree: true }; observer.observe(approve_body_ele, config); }; var button_styling = { button_color: '', hover_color: '', button_height: '', button_border: '', border_radius: '4px', background_gradient: '', background_gradient_hover: '', font: '', font_color: '', font_hover_color: '', font_size: '', font_weight: '', text_transform: '', powered_by_color: '', powered_by_size: '12px', max_width: '', min_width: '', width: '100%' }; // ****************************************************************** // ****************************************************************** // PRODUCT PAGE // ****************************************************************** // ****************************************************************** function approve_loader_init() { var approve_element_check_name = " .ecwid-productBrowser.ecwid-productBrowser-ProductPage .ec-wrapper .ec-store .ec-store__content-wrapper .product-details__sidebar .product-details__product-title"; var approve_element_check = window.document.querySelector(approve_element_check_name); var approve_tries = 1; function init_approve(){ if(!approve_element_check && approve_tries < 10 ){ setTimeout(()=>{ approve_element_check = window.document.querySelector(approve_element_check_name); approve_tries = approve_tries+1; init_approve(); },500) } else if (approve_element_check) { approve_debug_log("FOUND ELEMENT "+approve_element_check_name); init_approve_product_button_loader(); } } init_approve(); function init_approve_product_button_loader() { var approve_remove_buttons = window.document.querySelectorAll("#clActionsWrapp"); if (approve_remove_buttons && approve_remove_buttons.length ) { for (var i = 0; i < approve_remove_buttons.length; i++) { approve_remove_buttons[i].remove(); } } var approve_change_buttons = window.document.querySelectorAll("[href*='https://app.clicklease.com']"); if (approve_change_buttons && approve_change_buttons.length ) { var approve_hosted_store_url = ""; if (window.kwipped_approve && window.kwipped_approve.url && window.kwipped_approve.approve_id ) { approve_hosted_store_url = window.kwipped_approve.url + "/approve/financestore?approveid="+window.kwipped_approve.approve_id; } for (var j = 0; j < approve_change_buttons.length; j++) { approve_change_buttons[j].setAttribute("href",approve_hosted_store_url); // approve_change_buttons[j].removeAttribute("href"); // window.kwipped_approve.core.activate_approve_teaser_rates(); } } // In the easiest implementation, you will be able to set every variable you need right here. // GENERAL PRODUCT WRAPPER -- element to look for to know we are on a product page var approve_product_wrapper_ele = '.ecwid-productBrowser.ecwid-productBrowser-ProductPage .ec-wrapper .ec-store .ec-store__content-wrapper '; var approve_product_wrapper = (approve_product_wrapper_ele ? document.querySelector(approve_product_wrapper_ele) : null); // Must ensure we are on a product page before attempting to select the remaining elements. if (approve_product_wrapper){ // ****************************************************************** // PRODUCT PAGE Variable Configuration // ****************************************************************** // PRODUCT INFO ELEMENTS -- These strings will be used in document.querySelector(). Ensure that there is only one of each on the page. var approve_model_ele_name = approve_product_wrapper_ele+' .product-details__sidebar .product-details__product-title'; var approve_price_ele_name = approve_product_wrapper_ele+' .product-details__sidebar .product-details__product-price .details-product-price__value.ec-price-item'; var approve_qty_ele_name = ''; // ELEMENT TO INSERT THE BUTTON BELOW -- This strings will be used in document.querySelector(). Ensure that there is only one on the page. var approve_insert_after_ele_name = approve_product_wrapper_ele+' .product-details__sidebar .product-details-module.product-details__action-panel'; // var approve_insert_after_ele_name = approve_product_wrapper_ele+' .woocommerce-product-details__short-description .product-highlights'; // QTY INCREASE / DECREASE BUTTONS -- These buttons do not always trigger a change event on the QTY element. We will add click watchers on these elements. [Optional] var approve_inc_quantity_ele = ''; var approve_dec_quantity_ele = ''; // OPTIONS -- All of the following is optional. Options are be fairly custom // Wrapper for the ENTIRE options section var approve_options_wrapper_ele_name = ''; // Elements that need to have *change* watchers. Mostly used on select elements. Will be used in a foreach, so picking a class with multiple selects is both allowed and encouraged. Ensure these elements are contained within the wrapper above. var approve_select_ele_name = ''; // APPROVE BUTTON STYLING var approve_button_display_style = 'block'; // '50px' -- All sides will have margin of 50PX // '50px 10px' -- top/bottom will be 50px, right/left 10px // '50px 10px 20px 30px' -- top / right / bottom / left var approve_button_display_margin = '10px 0px'; var approve_button_to_remove_ele = ""; // ****************************************************************** // END PRODUCT PAGE Variable Configuration // ****************************************************************** // ****************************************************************** // INITIAL PRODUCT PAGE ELEMENT SELECTION -- No Action Required // ****************************************************************** // Grabbing variables based on the variable configuration. // IMPORTANT -- this selection has to be made both INSIDE and OUTSIDE of init_approve_button. // This is because we need to first identify the elements for the use of watchers -- but also need them to be dynamic. // model var approve_model_ele = document.querySelector(approve_model_ele_name); if (!approve_model_ele){ if (approve_debug_mode){ approve_debug_log("APPROVE: No initial approve_model_ele found.",1); } } // price var approve_price_ele = document.querySelector(approve_price_ele_name); if (!approve_price_ele){ if (approve_debug_mode){ approve_debug_log("APPROVE: No initial approve_price_ele found.",1); } } // qty if (approve_qty_ele_name){ var approve_qty_ele = document.querySelector(approve_qty_ele_name); if (!approve_qty_ele){ if (approve_debug_mode){ approve_debug_log("APPROVE: No initial approve_qty_ele found.",1); } } } // element to insert after var approve_insert_after_ele = document.querySelector(approve_insert_after_ele_name); if (!approve_insert_after_ele){ if (approve_debug_mode){ approve_debug_log("APPROVE: No initial approve_insert_after_ele found.",1); } } // ****************************************************************** // END INITIAL PRODUCT PAGE ELEMENT SELECTION // ****************************************************************** // ****************************************************************** // Initilizes the approve button. // This function handles both the CREATION and UPDATE of button variables // ****************************************************************** function init_approve_button(){ // ****************************************************************** // DYNAMIC PRODUCT PAGE ELEMENT SELECTION -- No Action Required // ****************************************************************** // Grabbing variables based on the variable configuration. // IMPORTANT -- this selection has to be made both INSIDE and OUTSIDE of init_approve_button. // This is because we need to first identify the elements for the use of watchers -- but also need them to be dynamic. // model var approve_model_ele = document.querySelector(approve_model_ele_name); if (!approve_model_ele){ if (approve_debug_mode){ approve_debug_log("APPROVE: No dynamic approve_model_ele found.",0,1); } return; } var approve_model = approve_model_ele.textContent // price var approve_price_ele = document.querySelector(approve_price_ele_name); if (!approve_price_ele){ if (approve_debug_mode){ approve_debug_logr("APPROVE: No dynamic approve_price_ele found.",0,1); } return; } var approve_price = approve_price_ele.innerHTML.replace(/[^0-9.]/g, ''); approve_price = parseFloat(approve_price); if (!approve_price || approve_price == 0){ if (approve_debug_mode){ approve_debug_log("APPROVE: Price not found (or is 0) after removing non-numerical characters.",0,1); } } // qty if (approve_qty_ele_name){ var approve_qty_ele = document.querySelector(approve_qty_ele_name); } if (!approve_qty_ele){ if (approve_debug_mode){ approve_debug_log("APPROVE: No dynamic approve_qty_ele found.",1); } var approve_qty = 1; } else { var approve_qty = approve_qty_ele.value; } approve_qty = parseInt(approve_qty); // element to insert after var approve_insert_after_ele = document.querySelector(approve_insert_after_ele_name); if (!approve_insert_after_ele){ if (approve_debug_mode){ approve_debug_log("APPROVE: No dynamic approve_insert_after_ele found.",0,1); } return; } // ****************************************************************** // END DYNAMIC PRODUCT PAGE ELEMENT SELECTION // ****************************************************************** // ****************************************************************** // FIND SELECT OPTIONS // ****************************************************************** if (approve_options_wrapper_ele_name){ // Get options wrapper var approve_options_wrapper_ele = document.querySelector(approve_options_wrapper_ele_name); if (!approve_options_wrapper_ele){ if (approve_debug_mode){ approve_debug_log("No approve_options_wrapper_ele found."); } } else { // TRH - added else to prevent js error when options dont exist var approve_selected_options = approve_options_wrapper_ele.querySelectorAll(approve_select_ele_name); if (!approve_selected_options){ if (approve_debug_mode){ approve_debug_log("No approve_selected_options found."); } } approve_selected_options.forEach(function (item, index) { // CONFIGURE OPTIONS HERE }); } } // ****************************************************************** // END SELECT OPTIONS // ****************************************************************** // ****************************************************************** // ADD APPROVE BUTTON TO PAGE // ****************************************************************** // Check if the button is on the page var approve_button = document.getElementById('approve_button_id'); if (!approve_button){ // If event listener is needed for options, here is where it can be initiated. if (approve_options_wrapper_ele_name){ var approve_options_wrapper_ele = document.querySelector(approve_options_wrapper_ele_name); if (approve_options_wrapper_ele){ // If a change listener is needed for options, it is initliazed here. var approve_options1 = approve_options_wrapper_ele.querySelectorAll(approve_select_ele_name); approve_options1.forEach(function (item, index) { item.addEventListener('change',event => { init_approve_button(); }) }); } } // Insert Button= var approve_button = document.createElement('approve-button'); approve_button.id = "approve_button_id"; if (approve_button_display_style){ approve_button.style.display = approve_button_display_style; } if (approve_button_display_margin){ approve_button.style.margin = approve_button_display_margin; } approve_button.style.maxWidth = '295px'; approve_button.style.setProperty('--button_border_radius', '50px'); approve_button.setAttribute('application-type',"embedded_app"); var approve_btn_wrapper = document.createElement("div"); approve_btn_wrapper.style.margin = "-17px 0px 0px 0px"; approve_btn_wrapper.appendChild(approve_button); approve_insert_after_ele.after(approve_btn_wrapper); } // Removing a button if (approve_button_to_remove_ele){ var approve_button_to_remove = document.querySelector(approve_button_to_remove_ele); if (approve_button_to_remove){ approve_button_to_remove.style.display = "none"; } } // If price is below $200, teaser rate breaks. Let's ensure that it's above $500. if ((parseFloat(approve_price) * parseInt(approve_qty)) < 500){ if (approve_debug_mode){ approve_debug_log("Price is below $500."); } approve_button.style.display = "none"; return; } // Set approve button variables. approve_button.setAttribute('price',approve_price); approve_button.setAttribute('model',approve_model); approve_button.setAttribute('qty',approve_qty); approve_button.setAttribute('type',"new_product"); } // ****************************************************************** // Simple set button qty. Must pass the new QTY to the button. // ****************************************************************** function approve_update_qty(approve_qty){ var approve_button = document.getElementById('approve_button_id'); if (approve_button){ var approve_btn_qty = parseInt(approve_button.getAttribute('qty')); if (approve_qty != approve_btn_qty){ approve_button.setAttribute('qty',approve_qty); } } } // ****************************************************************** // If timing is an issue, this function creates an interval for setting button qty. // ****************************************************************** var approve_timer = null; function approve_update_qty_timer(){ var approve_button = document.getElementById('approve_button_id'); if (approve_button){ if(approve_timer) { clearInterval(approve_timer); approve_timer = null; } var approve_btn_qty = parseInt(approve_button.getAttribute('qty')); var number_of_checks = 0; approve_timer = setInterval(function(){ if(number_of_checks>=5){ clearInterval(approve_timer); approve_timer = null; } if(approve_btn_qty != parseInt(approve_qty_ele.value)){ approve_button.setAttribute('qty',parseInt(approve_qty_ele.value)); clearInterval(approve_timer); approve_timer = null; } number_of_checks++; },500) } } init_approve_button(); // If there is a qty element, we need to set watchers/listeners. if (approve_qty_ele){ // Add change watcher to qty input approve_qty_ele.addEventListener('change',event => { approve_update_qty_timer(); }) if (approve_inc_quantity_ele && approve_dec_quantity_ele){ activate_increase_and_decrease_buttons(); } } if (approve_price_ele){ var approve_price_watcher = approve_price_ele; // Add observer to price element const approve_price_observer = new MutationObserver(function() { init_approve_button(); }); approve_price_observer.observe(approve_price_watcher,{subtree: true, childList: true}); var approve_model_watcher = approve_model_ele; if (approve_model_watcher){ // Add observer to price element const approve_model_observer = new MutationObserver(function() { init_approve_button(); }); approve_model_observer.observe(approve_model_watcher,{subtree: false, childList: true}); } } } else { if (approve_debug_mode){ approve_debug_log("APPROVE: approve_product_wrapper not found.",1) } } /** * * Activates quantity buttons. * QTY buttons are, sometimes added to the page after a page has been rendered. This will wait for that to happen. */ function activate_increase_and_decrease_buttons(number_of_tries=0){ number_of_tries++; // buttons that raise or lower the quantity. var approve_qty_btn_inc = document.querySelector(approve_inc_quantity_ele); var approve_qty_btn_dec = document.querySelector(approve_dec_quantity_ele); if ((!approve_qty_btn_inc || !approve_qty_btn_dec) && number_of_tries < 10){ setTimeout(()=>(activate_increase_and_decrease_buttons(number_of_tries)),500); return } // Assign click events to these buttons so that qty is updated on click. if(approve_qty_btn_inc && approve_qty_btn_dec){ approve_qty_btn_inc.addEventListener('click',event => { var approve_button = document.getElementById('approve_button_id'); if (approve_button){ var approve_btn_qty = parseInt(approve_button.getAttribute('qty')); approve_btn_qty = approve_btn_qty + 1; approve_update_qty(approve_btn_qty); } }); approve_qty_btn_dec.addEventListener('click',event => { var approve_button = document.getElementById('approve_button_id'); if (approve_button){ var approve_btn_qty = parseInt(approve_button.getAttribute('qty')); if (approve_btn_qty > 1){ approve_btn_qty = approve_btn_qty - 1; approve_update_qty(approve_btn_qty); } } }); } else { if (approve_debug_mode){ approve_debug_log("APPROVE: No approve_qty_btn_inc or approve_qty_btn_dec found.",1); } } } } } function approve_cart_page_integration() { button_styling.width = "100%"; button_styling.min_width = ""; button_styling.max_width = "426px"; var approve_cart_product = { wrapper_ele: ' .ec-cart__sidebar', item_ele: ' .ec-cart__products-inner', item_model_ele: ' .ec-cart-item__title', item_price_ele: ' .ec-cart-item__price-inner', item_qty_ele: ' .form-control__select-text', sku: '', insert_btn_after_ele: ' .ec-cart__cert.ec-text-muted', global_watcher: ' body', model_option_ele: '', tax_price_ele: '', shipping_price_ele: '', wrapper_align: '', wrapper_margin: '0px 0px 10px 0px' }; // ****************************************************************** // CART PAGE ELEMENT SELECTION -- No Action Required // ****************************************************************** // Find data wrappers -- ideally with syntax so that there will not be a console error thrown on non-cart pages [ie. no multiple query selectors / finds]. function approve_initialize_cart(){ if (approve_cart_product.wrapper_ele){ var approve_cart_wrapper = document.querySelector(approve_cart_product.wrapper_ele); var approve_cart_item = document.querySelectorAll(approve_cart_product.item_ele); } if (!approve_cart_item){ if (approve_debug_mode){ console.log("no cart items found.") } return; } var approve_cart_items_array = []; approve_cart_item.forEach(function (item, index) { var approve_cart_item = {}; // Find model, price, and qty for each cart item. var approve_cart_item_model_wrapper = item.querySelector(approve_cart_product.item_model_ele); var approve_cart_item_qty_wrapper = item.querySelector(approve_cart_product.item_qty_ele); var approve_cart_item_price_wrapper = item.querySelector(approve_cart_product.item_price_ele); if (approve_cart_product.sku) var approve_cart_item_sku_wrapper = item.querySelector(approve_cart_product.sku); // check model if (!approve_cart_item_model_wrapper){ if (approve_debug_mode){ console.log("No approve_cart_item_model_wrapper found."); } return; } // var approve_cart_item_model_wrapper = approve_cart_item_model_wrapper; // set and encode cart item model. var approve_cart_item_model = approve_cart_item_model_wrapper.textContent.trim(); if (approve_cart_item_sku_wrapper) approve_cart_item_model += " (SKU: " + approve_cart_item_sku_wrapper.textContent.trim() + ")"; if (approve_cart_product.model_option_ele) { var options = item.querySelectorAll(approve_cart_product.model_option_ele); if (!options) { approve_debug_log("No approve cart item options found."); } else { options.forEach(function(item, index) { approve_cart_item_model += " | " + item.textContent; }); } } approve_cart_item.model = encodeURIComponent(approve_cart_item_model); // check qty if (!approve_cart_item_qty_wrapper){ if (approve_debug_mode){ console.log("No approve_cart_item_qty_wrapper found. Qty is set to 1."); } var approve_qty = 1; } else { var approve_qty = approve_cart_item_qty_wrapper.textContent.replace("Qty: ", ""); } var approve_cart_qty = parseInt(approve_qty); // set qty approve_cart_item.qty = parseInt(approve_cart_qty); approve_cart_item.type = "new_product"; if (!approve_cart_item_price_wrapper){ if (approve_debug_mode){ console.log("No approve_cart_item_price_wrapper found."); } return; } var approve_price = approve_cart_item_price_wrapper.innerHTML.replace(/[^0-9.]/g, ''); var approve_cart_price = parseFloat(approve_price); // set price approve_cart_item.price = approve_cart_price/approve_qty; console.log(approve_cart_item); approve_cart_items_array.push(approve_cart_item); }); // Check to see if the approve button is already on the page. If it isn't, we will create it now. var approve_button = document.getElementById('approve_cart_button_id'); if (!approve_button){ // Find the element where we want to insert our button. var approve_cart_insert_after_ele = document.querySelector(approve_cart_product.insert_btn_after_ele); if(!approve_cart_insert_after_ele){ if (approve_debug_mode){ console.log("Element to insert approve button after not found."); } return; } var approve_button = document.createElement('approve-button'); var approve_button_wrapper = document.createElement('div'); approve_button_wrapper.appendChild(approve_button); approve_button.id = "approve_cart_button_id"; if (approve_cart_product.wrapper_align) approve_button_wrapper.style.textAlign = approve_cart_product.wrapper_align; if (approve_cart_product.wrapper_margin) approve_button_wrapper.style.margin = approve_cart_product.wrapper_margin; if (button_styling.width) approve_button.style.width = button_styling.width; if (button_styling.min_width) approve_button.style.minWidth = button_styling.min_width; if (button_styling.max_width) approve_button.style.maxWidth = button_styling.max_width; approve_button.style.display="inline-block"; approve_button.setAttribute('application-type',"embedded_app"); approve_button.setAttribute('clear-cart-items',"true"); approve_cart_insert_after_ele.after(approve_button_wrapper); } if (button_styling.button_color) approve_button.style.setProperty('--button_color', button_styling.button_color); if (button_styling.hover_color) approve_button.style.setProperty('--button_hover_color', button_styling.hover_color); if (button_styling.button_height) approve_button.style.setProperty('--button_height', button_styling.button_height); if (button_styling.button_border) approve_button.style.setProperty('--button_border', button_styling.button_border); if (button_styling.border_radius) approve_button.style.setProperty('--button_border_radius', button_styling.border_radius); if (button_styling.font) approve_button.style.setProperty('--button_font', button_styling.font); if (button_styling.font_color) approve_button.style.setProperty('--button_font_color', button_styling.font_color); if (button_styling.font_size) approve_button.style.setProperty('--button_font_size', button_styling.font_size); if (button_styling.text_transform) approve_button.style.setProperty('--button_text_transform', button_styling.text_transform); if (button_styling.font_hover_color) approve_button.style.setProperty('--button_font_hover_color', button_styling.font_hover_color); if (button_styling.background_gradient) approve_button.style.setProperty('--button_background_gradient', button_styling.background_gradient); if (button_styling.background_gradient_hover) approve_button.style.setProperty('--button_background_gradient_hover', button_styling.background_gradient_hover); if (button_styling.font_weight) approve_button.style.setProperty('--button_font_weight', button_styling.font_weight); if (button_styling.powered_by_color) approve_button.style.setProperty('--button_powered_by_color', button_styling.powered_by_color); if (button_styling.powered_by_size) approve_button.style.setProperty('--button_powered_by_size', button_styling.powered_by_size); if (approve_cart_product.tax_price_ele){ var approve_tax_price_raw = document.querySelector(approve_cart_product.tax_price_ele); var approve_tax_price = approve_tax_price_raw.textContent.replace(/[^0-9.]/g, ''); approve_tax_price = parseFloat(approve_tax_price).toFixed(2); if (approve_tax_price && approve_tax_price > 0){ var approve_cart_shipping_item = {}; approve_cart_shipping_item.model = "Tax"; approve_cart_shipping_item.price = approve_tax_price; approve_cart_shipping_item.qty = 1; approve_cart_shipping_item.type = "new_product"; approve_cart_items_array.push(approve_cart_shipping_item); } } if (approve_cart_product.shipping_price_ele){ var approve_shipping_price_raw = document.querySelector(approve_cart_product.shipping_price_ele); var approve_shipping_price = approve_shipping_price_raw.textContent.replace(/[^0-9.]/g, ''); approve_shipping_price = parseFloat(approve_shipping_price).toFixed(2); if (approve_shipping_price && approve_shipping_price > 0){ var approve_cart_shipping_item = {}; approve_cart_shipping_item.model = "Shipping"; approve_cart_shipping_item.price = approve_shipping_price; approve_cart_shipping_item.qty = 1; approve_cart_shipping_item.type = "new_product"; approve_cart_items_array.push(approve_cart_shipping_item); } } approve_button.setAttribute('items',JSON.stringify(approve_cart_items_array)); } if (approve_cart_product.wrapper_ele){ approve_initialize_cart(); if (approve_cart_product.global_watcher) { var approve_global_watcher = document.querySelector(approve_cart_product.global_watcher); // Add observer to price element const approve_global_observer = new MutationObserver(function() { approve_initialize_cart(); }); approve_global_observer.observe(approve_global_watcher,{subtree: true, childList: true}); } } else { if (approve_debug_mode){ approve_debug_log("No approve_cart_wrapper found.", 1); } } } approve_loader_init(); setTimeout(() => { approve_cart_page_integration(); }, 900); // ****************************************************************** // ****************************************************************** // END PRODUCT PAGE // ****************************************************************** // ****************************************************************** function approve_debug_log(log, warn, err) { warn = warn || false; err = err || false; let css = "padding: 5px 20px; "; if (err) { css += "background:#8B0000; color:#fff; "; } else if(warn) { css += "background:#FFBF00; color:#000; "; } else { css += "background:#418AC9; color:#fff; "; } if (approve_debug_mode) { console.log("%c"+log,css); } }