function BraindwAddEvent(e, ev, callback) { var elements = document.querySelectorAll(e); for (var i = 0; i < elements.length; i++) { elements[i].addEventListener(ev, callback); } } function braindw_hidepop_close() { setWithExpiry('braindw_close_popup',1,259200000); braindw_hidepop(); } function setWithExpiry(key, value, ttl) { const now = new Date() const item = { value: value, expiry: now.getTime() + ttl, } localStorage.setItem(key, JSON.stringify(item)) } function getWithExpiry(key) { const itemStr = localStorage.getItem(key) // if the item doesn't exist, return null if (!itemStr) { return null } const item = JSON.parse(itemStr) const now = new Date() // compare the expiry time of the item with the current time if (now.getTime() > item.expiry) { // If the item is expired, delete the item from storage // and return null localStorage.removeItem(key) return null } return item.value } function braindw_hidepop() { if (document.contains(document.querySelector('.braindw_cupon'))) { //document.querySelector('.braindw_cupon').parentElement.remove(); jQuery('.braindw_cupon').css("display", "none"); } } function SendEmail() { try { if (document.querySelector('.braindw_inptmail').value == '' || !BraindwvalidateEmail(document.querySelector('.braindw_inptmail').value)) { document.querySelector(".braindw_regerror").style.display = "block"; return false; } var hash = document.querySelector('#hash').value; var idgroup = '10010';//document.querySelector('#idgroup').value; var email = document.querySelector('.braindw_inptmail').value; var token = document.querySelector('#token').value; fetch(document.querySelector('#braindw_email').getAttribute("value") + '?hash=' + hash + '&idgroup=' + idgroup + '&email=' + email + '&token=' + token + "&data=", { credentials: "include", mode: 'no-cors', method: 'POST', }) .then(function(resp) { return resp.text(); }) .then(function(data) { document.querySelector('#braindw_register').style.display = "none"; document.querySelector('#braindw_registerOk').style.display = "block"; localStorage.setItem('bdw_email', email) return false; }) .catch(function(ex) { console.log(ex); }); window.setTimeout("braindw_hidepop();", 3000); return false; } catch (err) {} } /* function SendEmail() { try { console.log('entro al SendEmailG'); var hash = document.querySelector('#hash').value; var idgroup = document.querySelector('#idgroup').value; var email = document.querySelector('.braindw_inptmail').value; var token = document.querySelector('#token').value; var _urlCoupon ="https://s.braindw.com/Tracking/Coupon"; jQuery.ajax({ type: 'POST', url: _urlCoupon, xhrFields: { withCredentials: true }, dataType: 'jsonp', data: 'HASH=' + hash + '&idgroup='+ idgroup + '&email=' + email + '&token=' + token, success: function (data) { return false; } }); return false; } catch (err) { console.log(err); } }*/ var BraindwCuponHtml = function() { return `

¿Sos fan de tu casa?

¡Recibí nuestras ofertas antes que nadie!

` } function Braindw_Category(){ if(document.querySelector('#product_addtocart_form') != null){ if (document.querySelectorAll('.breadcrumbs li').length != 0) { var cc = document.querySelectorAll('.breadcrumbs li')[document.querySelectorAll('.breadcrumbs li').length-2].className.split('category')[1]; } }else{ if (document.querySelectorAll('.breadcrumbs li').length != 0) { var cc = document.querySelectorAll('.breadcrumbs li')[document.querySelectorAll('.breadcrumbs li').length-1].className.split('category')[1]; } } var categoryCode = cc; console.log("category", cc); var i = 0; if(categoryCode != undefined && categoryCode != null && categoryCode != ""){ var currentCategory = { "id": cc } braindwObject.current.category = currentCategory; for(item of braindwObject.history.categoryViewed){ if(item.id == categoryCode){ braindwObject.history.categoryViewed.splice(i, 1); } i++; } if(braindwObject.history.categoryViewed.length < 15){ braindwObject.history.categoryViewed.unshift ({ "id": categoryCode }) } else{ braindwObject.history.categoryViewed.splice(14, 1); braindwObject.history.categoryViewed.unshift ({ "id": categoryCode }) } } localStorage.setItem('braindw_object', JSON.stringify(braindwObject)); if(categoryCode != undefined, categoryCode != '', categoryCode != null){ BraindwCaptureCategory(categoryCode); bdw_getCategory(categoryCode); } } function Braindw_Collection(){ if(document.querySelector('#product_addtocart_form') != null){ var cc = document.querySelectorAll('.breadcrumbs li')[document.querySelectorAll('.breadcrumbs li').length - 2 ].className.split('category')[1]; }else{ var cc = document.querySelectorAll('.breadcrumbs li')[document.querySelectorAll('.breadcrumbs li').length - 1 ].className.split('category')[1]; } var collectionCode = cc; console.log("collection", cc); var i = 0; if(collectionCode != undefined && collectionCode != null && collectionCode != ""){ var currentCollection = { "id": cc } braindwObject.current.collection = currentCollection; for(item of braindwObject.history.collectionViewed){ if(item.id == collectionCode){ braindwObject.history.collectionViewed.splice(i, 1); } i++; } if(braindwObject.history.collectionViewed.length < 15){ braindwObject.history.collectionViewed.unshift ({ "id": collectionCode }) } else{ braindwObject.history.collectionViewed.splice(14, 1); braindwObject.history.collectionViewed.unshift ({ "id": collectionCode }) } } localStorage.setItem('braindw_object', JSON.stringify(braindwObject)); } function Braindw_Product() { //var codeProduct = document.querySelector('.product-info-stock-sku .value').textContent; var codeProduct = document.querySelector('#product_addtocart_form').firstElementChild.value; var skuProduct = document.querySelector('#product_addtocart_form').dataset.productSku; console.log("product", codeProduct); console.log("sku", skuProduct); var i = 0; if(codeProduct != undefined && codeProduct != null && codeProduct != ""){ var currentProduct = { "id": codeProduct, "sku": skuProduct } braindwObject.current.product = currentProduct; for(item of braindwObject.history.productViewed){ if(item.id == codeProduct){ braindwObject.history.productViewed.splice(i, 1); } i++; } if(braindwObject.history.productViewed.length < 15){ braindwObject.history.productViewed.unshift ({ "id": codeProduct, "sku": skuProduct, "sellerId": "" }) } else{ braindwObject.history.productViewed.splice(14, 1); braindwObject.history.productViewed.unshift ({ "id": codeProduct, "sku": skuProduct, "sellerId": "" }) } } localStorage.setItem('braindw_object', JSON.stringify(braindwObject)); capturesFichaProduct(skuProduct); } function Braindw_addedProduct() { BraindwAddEvent('#product-addtocart-button', 'click', function(e){ if(document.getElementById('product_addtocart_form')){ var element = document.getElementById('product_addtocart_form'); var codeProduct = element.firstElementChild.value; var skuProduct = element.dataset.productSku; var i = 0; for(item of braindwObject.history.productAdded){ if(item.id == codeProduct){ braindwObject.history.productAdded.splice(i, 1); } i++; } if(braindwObject.history.productAdded.length < 15){ braindwObject.history.productAdded.unshift({ "id": codeProduct, "sku": skuProduct, "sellerId": "" }) } else{ braindwObject.history.productAdded.splice(14, 1); braindwObject.history.productAdded.unshift({ "id": codeProduct, "sku": skuProduct, "sellerId": "" }) } } localStorage.setItem('braindw_object', JSON.stringify(braindwObject)); }); /*Pendiente revisión addToCart de productCard en caso de ser necesario BraindwAddEvent('button.action.tocart.primary', 'click', function(e){ if(braindwObject.history.productAdded.length < 15){ if(document.getElementById('product_addtocart_form')){ var element = document.getElementById('product_addtocart_form'); var productSku = element.getAttribute('data-product-sku'); braindwObject.history.productAdded.unshift({ "id": productSku, "sku": "", "sellerId": "" }) } } localStorage.setItem('braindw_object', JSON.stringify(braindwObject)); });*/ } function Braindw_SearchTerm(searchTerm) { var i = 0; var supr = -1; if(searchTerm != undefined && searchTerm != null && searchTerm != ""){ braindwObject.current.searchTerm = searchTerm; for(item of braindwObject.history.searchedTerm){ if(item == searchTerm){ supr = i; } i++; if(supr != -1){ braindwObject.history.searchedTerm.splice(supr, 1); } } if(braindwObject.history.searchedTerm.length < 15){ braindwObject.history.searchedTerm.unshift(searchTerm); } else{ braindwObject.history.searchedTerm.splice(14, 1); braindwObject.history.searchedTerm.unshift(searchTerm); } } localStorage.setItem('braindw_object', JSON.stringify(braindwObject)); } function Braindw_CartOpened() { var items = []; var cartOpen = braindwObject.current.cartOpen; if(braindwObject.current.cartOpen.length != 0){ braindwObject.current.cartOpen.splice(0); } for(var i=0; i< document.querySelectorAll('tbody.cart.item .item-info').length; i++){ var item = document.querySelectorAll("tbody.cart.item .item-info")[i]; var productCode = item.querySelector("td.col.item a span").className.split('-')[5]; var productSku = item.querySelector("td.col.qty div div input").dataset.cartItemId; var positionPriceTotal = item.getElementsByClassName("price").length-1; items.push({ ProductTitle: item.getElementsByTagName('a')[0].title, ProductCode: productSku, ProductSku: productSku, ProductUrlImage: item.getElementsByTagName('img')[0].currentSrc, ProductQuantity: item.getElementsByClassName('input-text qty')[0].value, ProductQuantityDetails: '', ProductPrice: item.querySelector("td.col.price div div span span.price").innerHTML, PriceTotal: item.querySelector("td.col.subtotal span span span.price").innerHTML, Event: "Load" }) cartOpen.push({ "id": items[i].ProductCode, "sku": items[i].ProductSku, "qt": items[i].ProductQuantity, "price": items[i].ProductPrice, "total": items[i].PriceTotal, "sellerId": "" }) localStorage.setItem('braindw_object', JSON.stringify(braindwObject)); } } function Braindw_CartClosed() { //var orderNumber = document.querySelector('.content-op-result p:eq(1) a').text(); var cartClose = braindwObject.current.cartClose; cartClose.id = Math.random() * (9999999 - 11111111) + 11111111; } function BraindwCaptureCategory(category) { var _bndwOb2 = document.createElement('script'); _bndwOb2.async = true; _bndwOb2.src = _PURLBNDW + "/tracking/capture?HASH="+ _HASHBNDW +"&minify=1&iscategory=true&og:categorycode=" + category; _bndwOb2.charset = "UTF-8"; document.head.appendChild(_bndwOb2); } function BraindwCaptureProduct(skuProduct, isCart, bdwcategories, catCode, inf) { try { let oldPrice = document.querySelectorAll('.price-final_price .price')[0].innerText; let priceInternet = "1"; var price = priceInternet; var imgProperty = document.querySelector("meta[property='og:image']"); let image = ""; image = imgProperty.content.split('?')[0]; let $title = document.querySelector('.page-title .base'); let title = $title.innerText; let url = document.URL; let categoriescodes = ""; let categorycode = ""; if (bdwcategories != "") { categoriescodes = bdwcategories; categorycode = catCode; } let info = ""; if (inf != undefined){ info = inf; } if (skuProduct && priceInternet && image && title && url) { var data = { CodeProduct: skuProduct, Title: title, Price: priceInternet, Brand: "", CategoryCode: categorycode, UrlImage: image, UrlProduct: url, CategoriesCodes: categoriescodes, PriceSale: priceInternet, OldPrice: oldPrice, }; var urlParameters = "og:title=" + title + "&og:image=" + image + "&og:url=" + url + "&og:categoriescodes=" + categoriescodes + '&og:codeproduct=' + skuProduct + '&og:brand=' + '&og:categorycode=' + categorycode + '&og:price=' + price + '&og:priceold=' + oldPrice + '&og:pricesale=' + priceInternet + '&iscart=' + isCart + '&info=' + info; ; var _bndwOb2 = document.createElement('script'); _bndwOb2.async = true; _bndwOb2.src = _PURLBNDW + "/tracking/capture?HASH="+ _HASHBNDW + "&" + urlParameters; _bndwOb2.charset = "UTF-8"; document.head.appendChild(_bndwOb2); bdw_getProduct(data); } } catch (error) { console.log(error); } } function capturesFichaProduct(bdwProductSku){ var bdwCategoryList = ""; var bdwCategoryCode = ""; //bdwCategoryList = getListCategories(); try{ fetch ('https://u.braindw.com/Get/somosrex?ext=json&sale=0&company=somosrex&minstock=1&limit=15&productids='+ bdwProductSku) .then((resp) => resp.json()) .then(function(data) { if(data.length > 0){ bdwCategoryList = data[0].IdCategoria.replaceAll(' ', ''); bdwCategoryCode = bdwCategoryList.split(",")[0]; if(bdwCategoryList != undefined){ BraindwCaptureProduct(bdwProductSku, 0, bdwCategoryList, bdwCategoryCode); }else{ BraindwCaptureProduct(bdwProductSku, 0, '', bdwCategoryCode); } BraindwAddEvent('#product-addtocart-button, #product-addtocart-button-sticky', 'click', function(e){ if (bdwCategoryCode!='' && bdwCategoryCode!= undefined){ BraindwCaptureProduct(bdwProductSku, 1, bdwCategoryList, bdwCategoryCode); } else{ var info = 1; BraindwCaptureProduct(bdwProductSku, 1, bdwCategoryList, bdwCategoryCode, info); } }); } }) .catch(function(ex) { console.log(ex); }); } catch { } } var _intervalo = -1; var _bdwLogicListener = false; var _intervaloStorePickup = -1; var _bdwLogicListenerStorePickup = false; function LogicListenerStorePickup(){ if(document.querySelector("#store-pickup-customer-email-fieldset > fieldset.fieldset.confirm-step > div > div > button") && !_bdwLogicListenerStorePickup){ _bdwLogicListenerStorePickup = true; clearInterval(_intervaloStorePickup); document.querySelector("#store-pickup-customer-email-fieldset > fieldset.fieldset.confirm-step > div > div > button").onclick = function() { var email = document.querySelector("#store-pickup-checkout-customer-email").value; if(email){ localStorage.setItem('bdw_email', email); BraindwCookiePush(email); } }; } } function LogicListener() { if(location.href.indexOf('/checkout/#shipping')>-1 && !_bdwLogicListener){ //_bdwCheckListener += 1; console.log("interval"); //if(_bdwCheckListener<5) //{ if(document.querySelector("#customer-email-fieldset > fieldset.fieldset.confirm-step > div > div > button") && document.querySelector("#delivery-method-selector > div.delivery-method-item.select-store-pickup")) { _bdwLogicListener = true; clearInterval(_intervalo); document.querySelector("#delivery-method-selector > div.delivery-method-item.select-store-pickup").addEventListener("click", () => { LogicListenerStorePickup(); _intervaloStorePickup = setInterval(LogicListenerStorePickup, 1000); }); document.querySelector("#customer-email-fieldset > fieldset.fieldset.confirm-step > div > div > button").onclick = function() { var email = document.querySelector("#customer-email").value; if(email){ localStorage.setItem('bdw_email', email); BraindwCookiePush(email); } }; if (document.querySelector("#modal-content-10 > div > div > div.block-content > form > div.actions-toolbar > div.primary > button > span")) { _bdwLogicListener = true; document .querySelector("#modal-content-10 > div > div > div.block-content > form > div.actions-toolbar > div.primary > button > span") .addEventListener("click", () => { var email = document.querySelector("#login-email").value; if(email){ localStorage.setItem('bdw_email', email); BraindwCookiePush(email); } }); } } // else // { // setTimeout(LogicListener(),1000); // } //} } } function BraindwCaptureEmailsSite(){ /*var rgxHome = new RegExp(".*?:\/\/(.*)mcprod.cetrogar.com.ar\/?$"); if(rgxHome.test(location.href)){*/ if(document.querySelector("#newsletter-validate-detail > div.actions > button") != null){ document.querySelector("#newsletter-validate-detail > div.actions > button").onclick = function() { event.preventDefault(); var email = document.querySelector("#newsletter").value; if(email){ localStorage.setItem('bdw_email', email); BraindwCookiePush(email); //SendEmail(email); } setTimeout(function() { console.log("bdw - BraindwCookiePush finished") /* #3739 AVOID THE USE OF .submit() FORM function */ //jQuery("#newsletter-validate-detail").submit(); }, 1500); }; } /*if(location.href.indexOf('checkout/#shipping')>-1){ setTimeout(function() { if(location.href.indexOf('checkout/#shipping')>-1){ document.querySelector("#customer-email-fieldset > fieldset.fieldset.confirm-step > div > div > button").onclick = function() { var email = document.querySelector("#customer-email").value; if(email){ localStorage.setItem('bdw_email', email); BraindwCookiePush(email); } }; if (document.querySelector("#modal-content-10 > div > div > div.block-content > form > div.actions-toolbar > div.primary > button > span")) { document .querySelector("#modal-content-10 > div > div > div.block-content > form > div.actions-toolbar > div.primary > button > span") .addEventListener("click", () => { var email = document.querySelector("#login-email").value; if(email){ localStorage.setItem('bdw_email', email); BraindwCookiePush(email); } }); } } }, 4500); }*/ if(location.href.indexOf('checkout/')>-1){ LogicListener(); _intervalo = setInterval(LogicListener, 1000); } if(location.href.indexOf('customer/account/login/') > -1 && document.querySelector("#send2") != null){ document.querySelector("#send2").onclick = function() { event.preventDefault(); var email = document.querySelector("#email").value; if(email){ //BraindwCookiePush(email); localStorage.setItem('bdw_email', email); } setTimeout(function() { console.log("bdw - BraindwCookiePush finished") /* #3739 AVOID THE USE OF .submit() FORM function */ //jQuery("form#login-form").submit(); }, 1500); }; } if(location.href.indexOf('customer/account/create/') > -1){ document.querySelector("#form-validate > div > div.primary > button").onclick = function() { event.preventDefault(); var email = document.querySelector("#email_address").value; if(email){ //BraindwCookiePush(email); localStorage.setItem('bdw_email', email); } setTimeout(function() { console.log("bdw - BraindwCookiePush finished") /* #3739 AVOID THE USE OF .submit() FORM function */ //jQuery("form#form-validate").submit(); }, 1500); }; } } function getListCategories(){ var categoryPosition = document.querySelectorAll('.breadcrumbs li').length; var listCategories = ""; if(document.querySelector('#product_addtocart_form') != null){ for(i=2; i -1) a = Braindw_getCartOpened(); if (document.URL.indexOf('checkout/onepage/success') > -1) { a = Braindw_getCartClosed(); e.cartClosed = a; }else{ e.cartOpened = a; } braindw_sendPersistency(e, email); } function braindw_getSessionDate() { let result = null; try { let SalesChannel = "";//BraindwGetSucCookie(); result = { SalesChannel: SalesChannel, }; } catch (e) { console.log('braindw_getSessionDate error ', e); } return result; } function BraindwGetSucCookie(){ return ""; } function braindw_getSearch() { let result=null; try { var braindw_url = document.URL; if(braindw_url.toLowerCase().indexOf("/result")===-1) return result; result = { searchterm: braindwGetUrlParameter("q"), }; } catch (e) { console.log(e); } return result; } function Braindw_getCartOpened() { var e = null; var items = []; for(var i=0; i< document.querySelectorAll('tbody.cart.item .item-info').length; i++){ var item = document.querySelectorAll("tbody.cart.item .item-info")[i]; var productCode = item.querySelector("td.col.item a span").className.split('-')[5]; var productSku = item.querySelector("td.col.qty div div input").dataset.cartItemId; var positionPriceTotal = item.getElementsByClassName("price").length-1; items.push({ ProductTitle: item.getElementsByTagName('a')[0].title, ProductCode: productSku, ProductSku: productSku, ProductUrlImage: item.getElementsByTagName('img')[0].currentSrc, ProductQuantity: item.getElementsByClassName('input-text qty')[0].value, ProductQuantityDetails: '', ProductPrice: item.querySelector("td.col.price div div span span.price").innerHTML.replace("$","").replace(".",""), PriceTotal: item.querySelector("td.col.subtotal span span span.price").innerHTML.replace("$","").replace(".",""), Event: "Load" }) } e = { CartNumber: '', BranchOffice: '', Items: items }; return e; } function Braindw_getCartClosed() { let orderNumber = ""; if( jQuery('.order-number').text() > 0 ){ orderNumber = parseInt(jQuery('.order-number').text()); } var cartClose = braindwObject.current.cartClose; if(braindwObject.current.cartClose.length != 0){ braindwObject.current.cartClose.splice(0); } cartClose.push ({ "id": orderNumber }); localStorage.setItem('braindw_object', JSON.stringify(braindwObject)); let r = orderNumber, i = [], e = { CartNumber: r, Items: i } return e; } function braindw_sendPersistency(e, emailGuest) { let n = { emailguest: emailGuest != undefined ? emailGuest : '', dataset: encodeURI(JSON.stringify(e)), page: "", url: window.location.href.split("?")[0], urlb: _NSURLBNDW + '/Script/braindw/'+ _HASHBNDW +'?hs=Thu Dec 04 2019 20:49:26 GMT-0300 (hora estándar de Argentina)', BranchOffice: "" }; fetch('https://p.braindw.com/Api/Data/Capture', { method: "POST", body: JSON.stringify(n), credentials: 'include', headers: { 'Accept': 'application/json', 'Content-Type': 'application/json', } }) .then((resp) => resp.json()) .then(function(data) { }) .catch(function(ex) { console.log(ex); }); } function BraindwCookiePush(email) { if (BraindwvalidateEmail(email)) { try { fetch(_NSURLBNDW + '/tracking/SetCookiesNdway?email=' + email + '&company=pintureriasrex_produccion', { credentials: "include", mode: 'no-cors', method: 'POST', }) .then(function(resp) { return resp.text(); }) .then(function(data) { Braindw_pushInfo(email); return false; }) .catch(function(ex) { console.log(ex); }); } catch (e) {} } } function BraindwvalidateEmail(email) { var re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; return re.test(String(email).toLowerCase()); } function BraindGetProductsCart(listCodes) { fetch(`https://u.braindw.com/Get/Somosrex?token=&limit=20&sale=0&idcategory=&productids=${listCodes}&minstock=1&ext=json`) .then( function(response) { if (response.status !== 200) { console.log('Looks like there was a problem. Status Code: '); return; } response.json().then(function(data) { if(data.length > 0){ BraindwBuildCartItem(data) } }); } ) .catch(function(err) { console.log('Fetch Error :-S', err); document.querySelector('#braindw_loader').remove(); }); } function BraindwBuildCartItem(data) { if (data.length > 0) { let item = data[0]; let key = BraindwGetCookie('form_key'); let formData = new FormData(); let IdArticulo = item.addToCart.split('/')[item.addToCart.split('/').length-2]; formData.append('product', IdArticulo); formData.append('selected_configurable_option', ''); formData.append('related_product', ''); formData.append('item', IdArticulo); formData.append('form_key', key); formData.append('qty', '1'); fetch(`https://somosrex.com/checkout/cart/add/uenc//product/${IdArticulo}/`, { credentials: "include", mode: 'no-cors', method: 'POST', body: formData, }) .then(function(resp) { BraindwReProcessCartItem(data); }) .catch(function(ex) { console.log(ex); document.querySelector('#braindw_loader').remove(); }); } else { if (document.URL.indexOf("CartAbandoned=") > -1) { location.href = 'https://somosrex.com/checkout/cart/'; } location.reload(); //location.href = 'https://somosrex.com/checkout/cart/'; } } function BraindwReProcessCartItem(data) { if (data.length >= 0) data.splice(0, 1); if (data.length === 0 || data == null || data == 'undefined') { //jQuery("#braindw_loader").attr('style', 'display:none'); //location.href = 'https://somosrex.com/checkout/cart/?productcart'; if (document.URL.indexOf("CartAbandoned=") > -1) { jQuery("#braindw_loader").attr('style', 'display:none'); location.href = 'https://somosrex.com/checkout/cart/?productcart'; } localStorage.setItem("reload",0); //location.reload(); } else { BraindwBuildCartItem(data); } } function BraindwGetCookie(key) { var BraindwCa = decodeURIComponent(document.cookie).split(';'); for (var bnwi = 0; bnwi < BraindwCa.length; bnwi++) { if (BraindwCa[bnwi].indexOf(key) > -1) { return BraindwCa[bnwi].split('=')[1]; } } return ''; } function showPopup() { jQuery("body").after( " " + '
' + '
' + '
' + '
' + '
' + "
" + '
' + '
' + "

Espera un momento, tu carro se está cargando.

" + "
" + "
" + "
" ); } var BraindwDomReady = function (callback) { document.readyState === "complete" || document.readyState === "interactive" ? callback() : document.addEventListener("DOMContentLoaded", callback); }; var braindwObject = ""; if (localStorage.getItem('braindw_object') != null && localStorage.getItem('braindw_object') != undefined && localStorage.getItem('braindw_object') != '' && localStorage.getItem('braindw_object') != 'null' && localStorage.getItem('braindw_object') != '""' && localStorage.getItem('braindw_object') != 'null') { braindwObject = JSON.parse(localStorage.getItem('braindw_object')); } else { createObjectBDW(); braindwObject = JSON.parse(localStorage.getItem('braindw_object')); } function createObjectBDW() { var braindwObject = { "filterSectionId": [], "history": { "productViewed": [], "productAdded": [], "searchedTerm": [], "categoryViewed": [], "collectionViewed": [] }, "current": { "product": {}, "category": {}, "collection": {}, "searchTerm": "", "cartOpen": [], "cartClose": [] }, "session": { "name": "", "email": "", "branchOffice": "", "sellerId": "", "guid": "", "country": "", "state": "", "city": "", "ip": "" } }; localStorage.setItem('braindw_object', JSON.stringify(braindwObject)); } var _HASHBNDW = 'pintureriasrex_produccion_ftxkq'; var _COMPANY = 'pintureriasrex_produccion'; var _PURLBNDW = window.location.protocol + "//s2.braindw.com"; var _NSURLBNDW = window.location.protocol + "//s.braindw.com"; const event = new Event('braindw_done'); BraindwDomReady(function (){ try{ if(!document.URL.includes('/account/')){ pushUrlLocation(); } console.log("[Braindw] [begin]"); window.braindw = { done : false }; var bdw_object = localStorage.getItem('braindw_object', JSON.stringify(braindwObject)); if(bdw_object == null || bdw_object == undefined || bdw_object == '' || bdw_object == '""'){ createObjectBDW(); } if(window.location.href == "https://somosrex.com/"){ /* * issue #3800 REX AR: Desactivar Pop Up de Registro durante el Hotsale- Zendesk 4293 */ // try { // if (!localStorage.getItem('bdw_email') && !getWithExpiry('braindw_close_popup')) { // document.querySelector("body").insertAdjacentHTML('beforebegin', BraindwCuponHtml()); // window.setTimeout("braindw_hidepop();", 60000); // } // } catch (e) { console.log (e);} } BraindwCaptureEmailsSite(); if(bdw_object != null && bdw_object.includes('"searchTerm":[]')){ bdw_object = bdw_object.replace('"searchTerm":[]','"searchTerm":""'); braindwObject = JSON.parse(bdw_object); localStorage.setItem('braindw_object', JSON.stringify(braindwObject)); } //getProductID if(document.querySelector('#product_addtocart_form') != null){ Braindw_Product(); Braindw_addedProduct(); } //searchTerm if(document.URL.includes('q=')){ var term = document.URL.split('q=')[document.URL.split('q=').length -1]; //braindwObject.current.searchTerm = term; //var term = document.querySelector("#search").value; Braindw_SearchTerm(term); } //cartOpened and cartClosed if (document.URL.toLowerCase().indexOf('checkout/cart') > -1){ Braindw_CartOpened(); Braindw_pushInfo(); } /*if (document.URL.indexOf('checkout/onepage/success') > -1) { Braindw_CartClosed(); }*/ //colletion if(document.URL.includes('/ofertas')){ Braindw_Collection(); } if (document.URL.indexOf("CartAbandoned=") > -1 && localStorage.getItem("reload")!== 0) { showPopup(); var listCodes = document.URL.split("CartAbandoned=")[1]; if (listCodes.charAt(listCodes.length - 1).indexOf(",") > -1) { listCodes = listCodes.slice(0, -1); } if (listCodes != "") { BraindGetProductsCart(listCodes); } else { jQuery("#braindw_loader").attr("style", "display:none"); } } //getCategory if(!document.URL.includes('checkout/') && window.location.href != "https://somosrex.com/" && window.location.href.split('?')[0] != "https://somosrex.com/" && !document.URL.includes('/account/')){ Braindw_Category(); } BraindwCaptureEmailsSite(); if(!document.URL.includes('/account/')){ var bdw_email = localStorage.getItem('bdw_email'); BraindwCookiePush(bdw_email); //Braindw_pushInfo(); } if (localStorage.getItem('bdw_email') != null && localStorage.getItem('bdw_email') != undefined && localStorage.getItem('bdw_email') != '' && localStorage.getItem('bdw_email') != 'null' && localStorage.getItem('bdw_email') != '""'){ var sessionEmail = localStorage.getItem('bdw_email'); braindwObject.session.email = sessionEmail; localStorage.setItem('braindw_object', JSON.stringify(braindwObject)); } document.dispatchEvent(event); window.braindw.done = true; } catch (e) { console.log('[Braindw] [error]'); console.log(e); } }); try{ console.log('[abtest 0] [usertest ]'); } catch(e) {console.log('error load abtest log')}