// ######## modul 'chatVUBnew' verzia 16.09.2024 12.16.29
//zmena ikony chatu - vyzera to ako animacia :-)
$("div.align-floating-icons-horizontal").addClass("hide");
$("div.align-floating-icons-horizontal span").first().removeClass("icon-ic_intesa").addClass("icon-ic_advisor");
var envAPI = "testappvubsk";
if (window.location.hostname.endsWith('www.vub.sk'))
envAPI = "app.vub.sk";
function initializeChat(widgetPath, enableDebug)
{
console.log("## chat VUB inic...");
widgetPath = widgetPath.replace(/\/$/, "");
//debugger;
var mapTema = [
{url: "/magnifica", tema: "magnifica"},
{url: "/en/magnifica", tema: "magnifica"},
{url: "/privatne-bankovnictvo", tema: "private"},
{url: "/en/privatne-bankovnictvo", tema: "private"}
];
var VUBchatTheme = "retail"; //retail, magnifica, private, quatro, univerzal
mapTema.forEach(tema => {
if (window.location.pathname.startsWith(tema.url)) {
VUBchatTheme = tema.tema;
}
});
console.log("## chat VUB theme: " + VUBchatTheme);
var mapInst = [
{url: "/en", inst: "english"},
{url: "/ludia/hypoteky", inst: "hypoteka"},
{url: "/ludia/sporenie", inst: "investicie"},
{url: "/ludia/poistenie", inst: "poistenia"},
{url: "/ludia/investovanie", inst: "investicie"},
{url: "/firmy-a-podnikatelia", inst: "podnikatelia"}
];
var VUBchatInstance = "vub"; //hypoteka, investicie, kampan, podnikatelia, poistenia, quatro, quatrocar, vub, english
mapInst.forEach(inst => {
if (window.location.pathname.startsWith(inst.url)) {
VUBchatInstance = inst.inst;
}
});
console.log("## chat VUB instance: " + VUBchatInstance);
//nové chat VUB tlacidlo
var startVubChatBtn = $("#startChatBtn").clone();
startVubChatBtn.prop("id","startVubChatBtn")
$("#startChatBtn").after(startVubChatBtn)
$("#startChatBtn").hide();
$("#startVubChatBtn")
.removeAttr("data-bs-toggle")
.removeAttr("data-bs-target")
.click(function (event){
CXBus.command('WebChat.open');
window.dataLayer.push({
event: "service",
serviceCat: "chat",
serviceAction: "chat",
serviceLabel: window.dataLayer[0].pageName
})
});
var VUBoperatorReady = false;
window._vubCXWidget = {
widgetPath: widgetPath,
apiHost: envAPI,
theme: VUBchatTheme,
instance: VUBchatInstance,
downloadFont: false,
enableChatButton: function($) {
VUBoperatorReady = true;
console.log("## => chat operator ready");
$("div.align-floating-icons-horizontal").removeClass("hide");
},
disableChatButton: function($) {
console.log("## => chat operator unavailable");
$("div.align-floating-icons-horizontal").addClass("hide");
//$("div.align-floating-icons-horizontal").removeClass("hide");
},
chatOpened: function($) {
console.log("## => chat otvoreny");
$("div.align-floating-icons-horizontal").addClass("hide");
},
chatClosed: function($) {
console.log("## => chat zatvoreny");
if (VUBoperatorReady) {
$("div.align-floating-icons-horizontal").removeClass("hide");
}
}
}
// load css
$("", {rel: "stylesheet", href: widgetPath + "/themes/" + window._vubCXWidget.theme + ".css", id: "cx-widget-vub-style-overrides"}).appendTo("head");
// load widget
$.getScript(widgetPath + "/cxbus.min.js", function() {
CXBus.configure({debug:enableDebug,pluginsPath: widgetPath + "/plugins/"});
CXBus.loadFile(widgetPath + "/widgets.config.js").done(function(){
CXBus.loadFile(widgetPath + "/plugins/vubwebchat.min.js").done(function(){
CXBus.loadPlugin("widgets-core");
});
});
});
}
$(document).ready(function() {
initializeChat("https://" + envAPI + "/genesys/widgets", true);
});
// ######## modul 'call-me-back_CONTACT' verzia 04.02.2025 11.50.40
//odchytenie odoslania call me back
$(document).ready(function()
{
function cakajNaCMB() {
return new Promise(function(resolve, reject) {
var cakajNaCMB_int = setInterval(function() {
//console.log("## => CMB button " + $("button.cmb__modal__btnSend.btn").length);
if ($("button.cmb__modal__btnSend.btn").length == 1) {
console.log("## => CMB button najdeny");
clearInterval(cakajNaCMB_int);
resolve();
}
}, 2000);
});
}
cakajNaCMB().then(function() {
console.log("## => CMB handler inic");
$("button.cmb__modal__btnSend.btn").click(() => {
CMBtrackVUB();
});
});
function CMBtrackVUB() {
console.log("## => CMB click event");
var mapProductType = [
{url: "/hypoteky/", pt: "Hypotéka"},
{url: "/pozicky/", pt: "Pôžička"},
{url: "/kreditne-karty/", pt: "Kreditná karta"},
{url: "/investovanie/", pt: "Investície"},
{url: "/sporenie/", pt: "Sporenie"},
{url: "/osobny-financny-plan", pt: "Osobné financie"},
{url: "/magnifica/", pt: "Osobné financie"},
{url: "/firmy-a-podnikatelia/", pt: "Firmy a podnikatelia"}
];
var VUBproductType = "";
mapProductType.forEach(zaznam => {
if (window.location.pathname.includes(zaznam.url)) {
VUBproductType = zaznam.pt;
}
});
if (window.location.pathname.includes("/sporenie/") && window.location.pathname.includes("vklad")) {
VUBproductType = "Termínovaný účet";
}
var cookieTrackName = 'web-p-track';
var paramsPost = new Object();
paramsPost["p0"] = '';
paramsPost["p1"] = document.URL;
paramsPost["p2"] = document.referrer;
paramsPost["p3"] = screen.height;
paramsPost["p4"] = screen.width;
paramsPost["p-formName"] = "Call me back";
paramsPost["p-calcType"] = "";
paramsPost["p-productType"] = VUBproductType;
paramsPost["p-product"] = document.title.slice(0, document.title.indexOf("|")).trim();
paramsPost["p-mail"] = $("input#item_email").val();
paramsPost["p-mobilePhone"] = $("div#cmbModal input[name='countryPrefix']").val() + $("div#cmbModal input[name='phoneNumber']").val();
paramsPost["p-clientName"] = $("input#item_firstname").val();
paramsPost["p-actualUrl"] = $('#window.location.href').val();
if ($.vubTrackGetCookie(cookieTrackName) != null) {
var webTrack = $.vubTrackGetCookie(cookieTrackName);
paramsPost["p0"] = webTrack;
if (window.console) console.log('cookie: ' + webTrack);
vubTrackFormAjax('contact',paramsPost);
}
else {
paramsPost["p0"] = "00000000-0000-0000-0000-000000000000";
if (window.console) console.log('cookie: XX');
vubTrackFormAjax('contact',paramsPost);
}
//event.preventDefault();
}
function vubTrackFormAjax(type, paramsPost) {
var jsonData;
$.ajax({
url: 'https://app.vub.sk/vubtrack/?type='+type,
method: 'POST',
data: paramsPost
}).done(function (response) {
jsonData = JSON.parse(response);
//$.cookie(cookieTrackName, jsonData.detail, { expires: 90, path: '/', domain: 'vub.sk' });
//$.cookie(cookieTrackName, jsonData.detail, { expires: 90, path: '/' });
});
}
});
// ######## modul 'convertAtoCTA' verzia 04.10.2024 11.48.22
//premeň A element na otvaranie CTA
$(document).ready(function() {
$('a.leadFormVubCallMe').each(function() {
console.log("## => konvert A na CTA");
$(this).attr("onclick","$('[data-bs-target=\"#cmbModal\"]').click(); return false;");
});
});
// ######## modul 'convertBannerBTN' verzia 30.05.2024 10.48.01
//premeň button v Banner komponente (ak CTA=#leadform#)
$(document).ready(function() {
$("div.com11__buttonCover a[data-scrollto='#leadform#']").each(function() {
console.log("## => konvert banner button");
$(this).parent().attr("onclick","$('[data-target=\"#cmbModal\"]').click(); return false;");
});
});
// ######## modul 'convertHeroBTN' verzia 30.08.2024 23.04.26
//premeň hero button (ak CTA=#leadForm#)
$(document).ready(function() {
//$("div.js-hero-btn").each(function() {
$('xxdiv.js-hero-btn:not(:has("a.js-loan-hero-btn"))').each(function() {
console.log("## => konvert hero button");
$(this).attr("onclick","$('[data-target=\"#cmbModal\"]').click(); return false;");
var scrollToValue = $(this).find('a').attr("data-scrollto");
var lastChar = scrollToValue.charAt(scrollToValue.length - 1);
if (scrollToValue === '#leadForm#') { //fix
$(this).find('a').attr("data-scrollto","#leadForm");
}
});
$('div.js-hero-btn a[data-scrollto*="leadForm"]').each(function() {
console.log("## => konvert hero button2");
$(this).parent().attr("onclick","$('[data-bs-target=\"#cmbModal\"]').click(); return false;");
if ($(this).attr("data-scrollto") === '#leadForm#') { //fix
$(this).attr("data-scrollto","#leadForm");
console.log("## => konvert hero button FIX");
}
});
$('div.com11__buttonCover a[data-scrollto*="leadform"]').each(function() {
console.log("## => konvert hero button3");
$(this).parent().attr("onclick","$('[data-target=\"#cmbModal\"]').click(); return false;");
});
$('div.js-hero-btn form[action*="leadForm"] a.heroBtnDesktop').each(function() {
console.log("## => konvert hero button (loan)");
$(this).attr("onclick","$('[data-bs-target=\"#cmbModal\"]').click(); return false;");
});
});
//end...