' +
''
);
}
)
.join('');
// =================================================
// GA4 VIEW_ITEM_LIST
// =================================================
ga4TrackViewItemList(
products,
term
);
// =================================================
// CLIQUE PRODUTO
// =================================================
productsEl
.querySelectorAll(
'.ks-product'
)
.forEach(
function (link) {
link.addEventListener(
'click',
function (e) {
/**
* Não intercepta:
*
* Ctrl + Click
* Cmd + Click
* Shift + Click
* Alt + Click
* botão do meio
*/
if (
e.ctrlKey ||
e.metaKey ||
e.shiftKey ||
e.altKey ||
e.button !== 0
) {
return;
}
/**
* IMPEDE NAVEGAÇÃO IMEDIATA
*/
e.preventDefault();
var index =
parseInt(
link.dataset
.gaIndex,
10
);
var item =
currentProducts[
index
];
var url =
link.href;
if (!item) {
window.location.href =
url;
return;
}
/**
* PRIMEIRO:
* select_item
*
* DEPOIS:
* navegação.
*/
ga4TrackSelectItemAndNavigate(
item,
index,
url
);
}
);
}
);
// =================================================
// VER TODOS
// =================================================
if (seeAllEl) {
var total =
data.paging &&
typeof data.paging.total !== 'undefined'
? parseInt(data.paging.total, 10)
: products.length;
if (total > 0) {
seeAllEl.style.display =
'';
seeAllEl.href =
buildSearchPageUrl(
term
);
seeAllEl.textContent =
'Ver todos os ' +
data.paging.total +
' resultados';
} else {
seeAllEl.style.display = 'none';
}
}
}
// =====================================================
// VER TODOS OS RESULTADOS
// =====================================================
if (seeAllEl) {
seeAllEl.addEventListener(
'click',
function () {
var term =
input
? input.value.trim()
: '';
if (!term) {
return;
}
ga4TrackSearch(
term
);
}
);
}
// =====================================================
// SEM RESULTADOS
// =====================================================
function renderEmptyResult(
term
) {
currentProducts =
[];
if (productsEl) {
productsEl.innerHTML =
'';
}
if (emptyResultEl) {
emptyResultEl.style.display =
'';
}
if (
whatsappLink
) {
// var msg =
// 'Olá, procurei por "' +
// term +
// '" no site e não encontrei. ' +
// 'Poderiam verificar um produto compatível?';
var msg =
'Ol\u00e1, procurei por "' +
cleanTerm +
'" no site e n\u00e3o encontrei. ' +
'Poderiam verificar um produto compat\u00edvel?';
whatsappLink.setAttribute('target', '_blank');
whatsappLink.setAttribute('rel', 'noopener noreferrer');
whatsappLink.href =
'https://wa.me/' +
WHATSAPP_NUMERO +
'?text=' +
encodeURIComponent(
msg
);
//whatsappLink.setAttribute('href', whatsappUrl);
}
}
// =====================================================
// START
// =====================================================
initVehicleSelects();
initPopularChips();
})();
Trabalhamos com diversas formas de pagamento.
Assim que finalizar sua compra, você poderá escolher qual a forma que mais lhe agrada. Demais instruções serão passadas após a escolha da forma de pagamento.