var RV_SERVER_URL_DEV = "roundview.io" var RV_GOOGLE_API_KEY = "AIzaSyC-fhYFNeCYUiR0BLQ27IMhDwexwFVYgRI" var RV_CURRENT_PAGE_URL = window.location.href; var RV_TRACKING_URL_DEV = "https://micro2."+RV_SERVER_URL_DEV; // "http://localhost:8082"; // var RV_BASE_URL_DEV = "https://micro3."+RV_SERVER_URL_DEV; // "http://localhost:8083"; // var RV_EC_URL_DEV = "https://micro4."+RV_SERVER_URL_DEV; //"http://localhost:8084"; // var RV_SOCKET_URl_DEV = "https://micro5."+RV_SERVER_URL_DEV; //"http://localhost:8085"; // var RV_PROJECT_SETTINGS_DEV = {}; var Website_Id_DEV = ""; var botsetting_DEV = ""; var botTimezone_DEV = ""; var sessionId_DEV = ""; var RVClearinterval_DEV = ""; var RVClearNotification_DEV = ""; var setPixeltalkId = ""; var Is_Agent_DEV = rvGetCookies("agent-chat") ? rvGetCookies("agent-chat") : false; var Is_Agent_Flag_DEV = ""; var workflow_DEV = false; var page_URL_DEV = []; var websitePages_DEV = ""; var ioConnectFlag_DEV = false; var msgRead_DEV = false; var userType_DEV = ""; var currentWorkflowId_DEV = ""; var AgentDetails_DEV = {}; var RV_Customer_Name_DEV = rvGetCookies("rv_name") ? rvGetCookies("rv_name") : "me"; var RV_Customer_Email_DEV = rvGetCookies("rv_email") ? rvGetCookies("rv_email") : ""; var Visitor_Chat_Id_DEV = rvGetCookies("customer_id") ? rvGetCookies("customer_id") : ""; var Website_Id_DEV = rvGetCookies("project_id") ? rvGetCookies("project_id"): ""; var Conversation_Id = rvGetCookies("conversation_id") ? rvGetCookies("conversation_id") : ""; var currentOption = rvGetCookies("rvce_current_option") ? rvGetCookies("rvce_current_option") : ""; var VisitorId = rvGetCookies("VisitorId") ? rvGetCookies("VisitorId") : ""; var RV_MSG_BODY_HEIGHT_DEV = ""; var RV_MSG_BODY_DEV = ""; var RV_ORDER_NUMBER = ""; var RVOrderStatus = ""; var RVOnClick = ""; var RVAgentOption = true; var RVLastMsg = {}; var RVOrderType = ""; var charsetMetaTag = document.createElement('meta'); var RV_MSG = []; var RV_HOME_HEADER = ""; var RV_HOME_CONTENT = ""; var RV_CONVERSATION = ""; var RV_Collection_Article = []; var collectionBreadCrumb = {} var agentInformationHtml = "" var RV_ARTICLE_TYPE = ""; var RV_BOT_AGENT_OFFICE = []; var RV_ORDER_STATUS = false; var RV_CUSTOMER_ORDER = []; var RV_ORDER_BREADCRUMBS = {}; var RV_RETURN_FORM = false; var cookiePrefix = "rvDev_"; var No_Help_Array = ["10054915dd965874b99be9d025fdfd65", "c4f50849cccca0dbf6fed7597b2f2b66", "5995d965c93e81f99f334168125ac065"] var RV_BTN_TEXT = "Send us a message" var RV_EMAIL_PHONE = rvGetCookies("rv_order_email") ? rvGetCookies("rv_order_email") : ""; var RV_EXISTING_CUSTOMER = rvGetCookies("rv_existing_customer") ? rvGetCookies("rv_existing_customer") : false; var typingLoader = `
`; charsetMetaTag['content'] = 'text/html; charset=utf-8'; var rvWebsiteIdDev = window.rvwebsiteidDev; var widgetFrameDEV, chatToggleFrameDEV, triggerFrameDEV, notificationFrameDEV, widgetContentFrameDEV, toggleContentFrameDEV, triggerContentFrameDEV, notificationContentFrameDEV, divWidgetDEV; var socketDEV; // var _paq = window._paq || []; // _paq.push(["setCustomVariable",1,"login-customerid",rvGetCookies("login-customerid"), "visit"]); // _paq.push(["trackPageView"]); // _paq.push(["enableLinkTracking"]); // var rvWebsiteId = window.rvwebsiteidDev; // (function () { // var u = RV_TRACKING_URL_DEV + '/api/v1/livetracking'; // _paq.push(["setTrackerUrl", u]); // _paq.push(["setSiteId", rvWebsiteId]); // _paq.push(["setDocumentTitle", document.title]); // var d = document, // g = d.createElement("script"), // s = d.getElementsByTagName("script")[0]; // g.type = "text/javascript"; // g.async = true; // g.defer = true; // g.src = "https://storage.googleapis.com/rcassets/tracking.js"; // s.parentNode.insertBefore(g, s); // var url = new URL(u); // var c = url.searchParams.get("c"); // })(); // _paq.push([ // function () { // //Get the visitor info. // VisitorId = this.getVisitorId() // rvSetCookies(31, "VisitorId", this.getVisitorId()); // }, // ]); var RVBotViewDev = { init: function(){ widgetFrameDEV = RVBotViewDev.createIframe("RoundView Bot", "rvecChatWidgetFrame"); chatToggleFrameDEV = RVBotViewDev.createIframe("RoundView Bot Toggle", "rvecChatToggleFrame"); triggerFrameDEV = RVBotViewDev.createIframe("RoundView Bot Trigger", "rvecChatTriggerFrame"); notificationFrameDEV = RVBotViewDev.createIframe("RoundView Bot Notification", "rvecNotificationFrame"); let divParent = document.createElement("div"); divParent.id = cookiePrefix+"RVParentFrame"; divWidgetDEV = document.createElement("div"); divWidgetDEV.id = "RVWidgetFrame"; divWidgetDEV.style.display = "none"; document.body.appendChild(divParent); divParent.appendChild(divWidgetDEV); divWidgetDEV.appendChild(widgetFrameDEV); widgetFrameDEV.style.display = "block"; divParent.appendChild(chatToggleFrameDEV); divParent.appendChild(triggerFrameDEV); divParent.appendChild(notificationFrameDEV); if (navigator.userAgent.toLowerCase().indexOf('firefox') === -1) { // DOM widgetContentFrameDEV = widgetFrameDEV.contentDocument; toggleContentFrameDEV = chatToggleFrameDEV.contentDocument; triggerContentFrameDEV = triggerFrameDEV.contentDocument; }else { // IE win widgetContentFrameDEV = widgetFrameDEV.contentWindow.document; toggleContentFrameDEV = chatToggleFrameDEV.contentWindow.document; triggerContentFrameDEV = triggerFrameDEV.contentWindow.document; } RVBotViewDev.rvEcLoadScript(RV_SOCKET_URl_DEV+"/socket.io/socket.io.js"); RVBotViewDev.checkProject(rvWebsiteIdDev) }, createIframe: function(title, id){ var iframeContent = document.createElement('iframe'); iframeContent.setAttribute("aria-hidden", "true"), iframeContent.setAttribute("tabIndex", "-1"), iframeContent.setAttribute("title", title); iframeContent.style.display="none"; iframeContent.classList.add('rvecIframeBot'); iframeContent.id = id; return iframeContent; }, rvEcLoadScript: function( url ){ var script = document.createElement("script") if(script.readyState) { // only required for IE <9 script.onreadystatechange = function() { if ( script.readyState === "loaded" || script.readyState === "complete" ) { script.onreadystatechange = null; RVBotViewDev.socketConnect(); } }; } else { //Others script.onload = function() { RVBotViewDev.socketConnect(); }; } script.crossorigin = "*" script.src = url; if (navigator.userAgent.toLowerCase().indexOf('firefox') === -1) { // DOM widgetContentFrameDEV = widgetFrameDEV.contentDocument; toggleContentFrameDEV = chatToggleFrameDEV.contentDocument; triggerContentFrameDEV = triggerFrameDEV.contentDocument; notificationContentFrameDEV = notificationFrameDEV.contentDocument; }else { // IE win widgetContentFrameDEV = widgetFrameDEV.contentWindow.document; toggleContentFrameDEV = chatToggleFrameDEV.contentWindow.document; triggerContentFrameDEV = triggerFrameDEV.contentWindow.document; notificationContentFrameDEV = notificationFrameDEV.contentWindow.document; } widgetContentFrameDEV.head.appendChild(script); var googleMapScript = document.createElement("script"); googleMapScript.src = `https://maps.googleapis.com/maps/api/js?key=${RV_GOOGLE_API_KEY}`; widgetContentFrameDEV.head.appendChild(googleMapScript); }, rvConvertTZ: function(date, tzString) { return new Date((typeof date === "string" ? new Date(date) : date).toLocaleString("en-US", {timeZone: tzString})); }, rvConvertUTCTZ: function(){ var date = new Date(); var now_utc = Date.UTC(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(), date.getUTCHours(), date.getUTCMinutes(), date.getUTCSeconds()); console.log(new Date().toISOString()); console.log(new Date(now_utc)); return new Date(now_utc); }, checkProject: async function(rvWebsiteIdDev){ let url = "/livechat/checkProjectdev"; let data = `id=${rvWebsiteIdDev}&&url=${RV_CURRENT_PAGE_URL}`; let res = await RVBotViewDev.rvXmlRequest(url, data); if (res.status == true) { //RV_PROJECT_SETTINGS_DEV = res.setting; Website_Id_DEV = res.Website_Id; rvSetCookies(31, "project_id", Website_Id_DEV); botsetting_DEV = res.botsetting; let userDetails = res.getAllUser; RV_ORDER_STATUS = res.orderStatusFlag; for( let i = 0; i < userDetails.length; i++ ){ AgentDetails_DEV[userDetails[i].userId] = {"firstName": userDetails[i].firstName, "lastName": userDetails[i].lastName, "email": userDetails[i].email} } let timeZone = botsetting_DEV.Bot_Agent_TimeZone ? botsetting_DEV.Bot_Agent_TimeZone : "America/Detroit"; let agentTime = RVBotViewDev.rvConvertTZ(new Date(), timeZone); let agentDay = agentTime.getDay() - 1; let agentHour = agentTime.getHours(); let agentMinutes = agentTime.getMinutes(); if(botsetting_DEV.Agent_Online_status !== null && !botsetting_DEV.Agent_Online_status ){ RVAgentOption = false RV_BTN_TEXT = "Leave us a message"; }else{ if(botsetting_DEV.Bot_Agent_Office_Hours){ RV_BOT_AGENT_OFFICE = botsetting_DEV.Bot_Agent_Office_Hours while( typeof RV_BOT_AGENT_OFFICE !== "object"){ RV_BOT_AGENT_OFFICE = JSON.parse(RV_BOT_AGENT_OFFICE); } let botAgentOfficeHours = RV_BOT_AGENT_OFFICE; if( agentDay < 0 ){ agentDay = 6; } if( botAgentOfficeHours.length > 0 ){ let currentDaySetting = botAgentOfficeHours[agentDay]; let fromArray = currentDaySetting.fromHour.split(" "); let toArray = currentDaySetting.toHour.split(" "); let startHour = startMin = endHour = endMin = 0; if( fromArray.length > 0 && fromArray[1] === "AM" ){ if( parseInt(fromArray[0]) === 12 ){ startHour = 0 }else{ startHour = parseInt(fromArray[0]); } }else if( fromArray[1] === "PM" ){ if( parseInt(fromArray[0]) === 12 ){ startHour = 12 }else{ startHour = parseInt(fromArray[0]) + 12; } } if( toArray.length > 0 && toArray[1] === "AM" ){ if( parseInt(toArray[0]) === 12 ){ endHour = 0 }else{ endHour = parseInt(toArray[0]); } }else if( toArray[1] === "PM" ){ if( parseInt(toArray[0]) === 12 ){ endHour = 12 }else{ endHour = parseInt(toArray[0]) + 12; } } startMin = parseInt(currentDaySetting.fromMin); endMin = parseInt(currentDaySetting.toMin); if( agentHour >= startHour && agentHour <= endHour ){ if( agentHour === endHour ){ if( agentMinutes <= endMin ){ RVAgentOption = true }else{ RVAgentOption = false RV_BTN_TEXT = "Leave us a message" } }else if(agentHour === startHour){ if( agentMinutes >= startMin ){ RVAgentOption = true }else{ RVAgentOption = false RV_BTN_TEXT = "Leave us a message" } }else{ RVAgentOption = true } }else{ RVAgentOption = false RV_BTN_TEXT = "Leave us a message" } } } } if (rvGetCookies("project_id") && rvGetCookies("conversation_id") && rvGetCookies("customer_id")) { RVBotViewDev.rvGetAllMessages(); } //RVBotViewDev.rvLoadWidgetHTMLAndFunc(res); RVBotViewDev.getChatTrigger(); RVBotViewDev.getFullArticle(); RVBotViewDev.getUserOrderDetails(); }else{ widgetFrameDEV.remove(); triggerFrameDEV.remove(); chatToggleFrameDEV.remove(); notificationFrameDEV.remove(); } }, getUserOrderDetails: async function(){ if( RV_EMAIL_PHONE !== "" ){ let url = "/api/v1/getCustomerAllOrdersByEmail" let data = `order_email=${RV_EMAIL_PHONE}&Website_Id=${Website_Id_DEV}` let res = await RVBotViewDev.rvXmlRequest(url, data, 4); if( res.status === "success" ){ rvSetCookies(31, "rv_order_email", RV_EMAIL_PHONE); RV_CUSTOMER_ORDER = res.data.orders; }else if(res.status === "failure"){ rvDeleteCookies("rv_order_email"); RV_CUSTOMER_ORDER = []; RV_EMAIL_PHONE = ""; } } }, getNextAvailableTime: function(){ let timeZone = botsetting_DEV.Bot_Agent_TimeZone ? botsetting_DEV.Bot_Agent_TimeZone : "America/Detroit"; let agentTime = RVBotViewDev.rvConvertTZ(new Date(), timeZone); let agentDay = agentTime.getDay() - 1; let agentHour = agentTime.getHours(); let agentMinutes = agentTime.getMinutes(); if(botsetting_DEV.Bot_Agent_Office_Hours){ let botAgentOfficeHours = RV_BOT_AGENT_OFFICE; if( agentDay < 0 ){ agentDay = 6; } if( botAgentOfficeHours.length > 0 ){ let currentDaySetting = botAgentOfficeHours[agentDay]; let fromArray = currentDaySetting.fromHour.split(" "); let toArray = currentDaySetting.toHour.split(" "); let startHour = startMin = endHour = endMin = 0; if( fromArray.length > 0 && fromArray[1] === "AM" ){ if( parseInt(fromArray[0]) === 12 ){ startHour = 0 }else{ startHour = parseInt(fromArray[0]); } }else if( fromArray[1] === "PM" ){ if( parseInt(fromArray[0]) === 12 ){ startHour = 12 }else{ startHour = parseInt(fromArray[0]) + 12; } } if( toArray.length > 0 && toArray[1] === "AM" ){ if( parseInt(toArray[0]) === 12 ){ endHour = 0 }else{ endHour = parseInt(toArray[0]); } }else if( toArray[1] === "PM" ){ if( parseInt(toArray[0]) === 12 ){ endHour = 12 }else{ endHour = parseInt(toArray[0]) + 12; } } startMin = parseInt(currentDaySetting.fromMin); endMin = parseInt(currentDaySetting.toMin); if( agentHour >= startHour && agentHour <= endHour ){ if( agentHour === endHour ){ if( agentMinutes <= endMin ){ return "Online" } }else if(agentHour === startHour){ if( agentMinutes >= startMin ){ return "Online" } }else{ return "Online" } } if( agentHour < startHour ){ let remainHour = startHour - agentHour; return remainHour+" Hours"; }else if( agentHour > endHour ){ if( agentDay == 6 ){ agentDay = -1; } let currentDaySetting = botAgentOfficeHours[agentDay+1]; let from1Array = currentDaySetting.fromHour.split(" "); let to1Array = currentDaySetting.toHour.split(" "); if( from1Array.length > 0 && from1Array[1] === "AM" ){ if( parseInt(from1Array[0]) === 12 ){ start1Hour = 0 }else{ start1Hour = parseInt(fromArray[0]); } }else if( from1Array[1] === "PM" ){ if( parseInt(from1Array[0]) === 12 ){ start1Hour = 12 }else{ start1Hour = parseInt(from1Array[0]) + 12; } } if( to1Array.length > 0 && to1Array[1] === "AM" ){ if( parseInt(to1Array[0]) === 12 ){ end1Hour = 0 }else{ end1Hour = parseInt(to1Array[0]); } }else if( to1Array[1] === "PM" ){ if( parseInt(to1Array[0]) === 12 ){ end1Hour = 12 }else{ end1Hour = parseInt(to1Array[0]) + 12; } } start1Min = parseInt(currentDaySetting.fromMin); end1Min = parseInt(currentDaySetting.toMin); if( start1Hour < endHour || ( start1Hour === end1Hour && start1Min < end1Min ) ){ let remainHour = 24 - agentHour + start1Hour; return remainHour+ " Hours"; }else { return "a Day"; } } }else{ return "a Day" } }else{ return botsetting_DEV.Bot_Agent_Reply_Time; } }, getFullArticle: async function(){ let url = "/api/v1/getCollectionsbyWebsiteId"; let data = `Website_Id=${Website_Id_DEV}`; let res = await RVBotViewDev.rvXmlRequest(url, data); if( res.status === "success" ){ RV_Collection_Article = res.data.getCollectionslist; } }, getChatTrigger: async function(){ let url = "/api/v1/getChatTrigger"; let data = `Website_Id=${Website_Id_DEV}¤t_pageUrl=${RV_CURRENT_PAGE_URL}&VisitorId=${VisitorId}`; let res = await RVBotViewDev.rvXmlRequest(url, data); if (res.status == 'success') { if (res.data) { websitePages_DEV = res.data.ChatTrigger; //RVBotViewDev.showupflyPopup(res.data.resType) //RVBotViewDev.insertTriggerInConversation(); var loginUser = res.data.loginUser; if(loginUser.email && typeof loginUser.email !== "undefined"){ rvSetCookies(31, "rv_name", loginUser.first_name+' '+loginUser.last_name); rvSetCookies(31, "rv_email", loginUser.email); rvSetCookies(31, "pt_login_customer", true); } } } }, insertTriggerInConversation: async function(){ let triggerConversationWrapper = widgetContentFrameDEV.body.querySelector('.triggerConversationWrapper'); if( websitePages_DEV.length > 0 && triggerConversationWrapper ) { triggerConversationWrapper.innerHTML = ""; for (i = 0; i < websitePages_DEV.length; i++) { let msg = websitePages_DEV[i].Trigger_Message; if (msg != "") { flyPopup = ``; triggerConversationWrapper.insertAdjacentHTML("beforeend", flyPopup); } } RVBotViewDev.conversationTriggerEvent(); } }, showupflyPopup: function(){ if (websitePages_DEV.length > 0) { for (i = 0; i < websitePages_DEV.length; i++) { let msg = websitePages_DEV[i].Trigger_Message; let Message_Delay = websitePages_DEV[i].Message_Delay; let intent = websitePages_DEV[i].Workflow_Intent_Text; if (msg != "") { flyPopup = ``; RVBotViewDev.insertFlyPopup(flyPopup, Message_Delay, 'trigger') } } } // else { // // // if( RVAgentOption ){ // flyPopup = ` // // `; // RVBotViewDev.insertFlyPopup(flyPopup, 1000, 'fly') // } // } }, insertFlyPopup: function(setflyPopup, delay, type){ if (type == 'trigger') { // let liveChatButton = ``; // if( !RVAgentOption ){ // liveChatButton = ''; // } let liveChatButton = ''; setTimeout(function () { if (triggerContentFrameDEV.getElementById("flyPopup")) { var totalElement = triggerContentFrameDEV.getElementById("flyPopup").getElementsByClassName("rve_trigger")[0].getElementsByClassName('rve_outer_options').length // var n = RVAgentOption ? 1 : 0; triggerContentFrameDEV.getElementById("flyPopup").getElementsByClassName("rve_trigger")[0].getElementsByClassName('rve_outer_options')[totalElement - 1].insertAdjacentHTML("beforebegin", setflyPopup); triggerFrameDEV.style.height = (triggerContentFrameDEV.getElementById("flyPopup").offsetHeight+50) +"px"; } else { // var content = `
${botsetting_DEV.Agent_Bot_Name}
Operator from ${botsetting_DEV.Agent_Bot_Name}
${botsetting_DEV.Bot_Agent_Description.replace(/\n/g, "
")}
${setflyPopup} ${liveChatButton}
`; triggerContentFrameDEV.body.insertAdjacentHTML("afterbegin", content); triggerFrameDEV.style.display = "block"; triggerFrameDEV.style.height = (triggerContentFrameDEV.getElementById("flyPopup").offsetHeight+50) +"px"; setTimeout(function () { if (triggerContentFrameDEV.getElementById("flyPopup")) { triggerContentFrameDEV.getElementById("flyPopup").classList.add("enable"); } }, 500); } RVBotViewDev.flyPopupEvents(); }, delay * 1000); } else { setTimeout(function () { var content = `
${setflyPopup}
`; triggerContentFrameDEV.body.insertAdjacentHTML("afterbegin", content); triggerFrameDEV.style.display = "block"; triggerFrameDEV.style.height = (triggerContentFrameDEV.getElementById("flyPopup").offsetHeight+50) +"px"; // if(type == 'fly'){ setTimeout(function () { if (triggerContentFrameDEV.getElementById("flyPopup")) { triggerContentFrameDEV.getElementById("flyPopup").classList.add("enable"); } }, 500); // } RVBotViewDev.flyPopupEvents(); }, delay); } }, conversationTriggerEvent: function(){ if (widgetContentFrameDEV.querySelector('.triggerConversationWrapper') ) { var flyPopupButtons = widgetContentFrameDEV.querySelector('.triggerConversationWrapper').getElementsByClassName('rve_outer_options'); for (i = 0; i < flyPopupButtons.length; i++) { flyPopupButtons[i].removeEventListener("click", RVBotViewDev.flyOptionEvent); flyPopupButtons[i].addEventListener("click", RVBotViewDev.flyOptionEvent); } } }, flyPopupEvents: function(){ if (triggerContentFrameDEV.querySelector('.flyOptionButton') ) { var flyPopupButtons = triggerContentFrameDEV.querySelector('.flyOptionButton').getElementsByClassName('rve_outer_options'); for (i = 0; i < flyPopupButtons.length; i++) { flyPopupButtons[i].removeEventListener("click", RVBotViewDev.flyOptionEvent); flyPopupButtons[i].addEventListener("click", RVBotViewDev.flyOptionEvent); } var exitChat = triggerContentFrameDEV.querySelector(".exit-chat"); if(exitChat){ exitChat.addEventListener("click", function () { var flyPopup = triggerContentFrameDEV.querySelector(".flypopup"); flyPopup.style.display = "none"; triggerFrameDEV.style.display = "none"; //pxSetCookie("1", "exit-chat", 1); }); } } }, rvGetAllMessages: async function(){ let data = `Visitor_Chat_Id=${Visitor_Chat_Id_DEV}&Website_Id=${Website_Id_DEV}`; let url = "/livechat/get-message"; let res = await RVBotViewDev.rvXmlRequest(url, data); if (res.status == true) { if (res.Data.length > 0) { var rvMessages = JSON.stringify(res); var rvChatMsg = JSON.parse(rvMessages); RV_MSG = rvChatMsg.Data; for (var i = 0; i < RV_MSG.length; i++) { let msg, flag = false if(!/<\/?[a-z][\s\S]*>/i.test(RV_MSG[i].message)){ msg = RV_MSG[i].message.replace(/\n/g, "
"); msg = RVBotViewDev.convertMsgHtml(msg); flag = true }else{ msg = RV_MSG[i].message } var setTime = RVBotViewDev.rvGetCurrentTime(RV_MSG[i].createdAt); if (RV_MSG[i].type == "user") { if( flag ){ msg = `
${msg}
` } RV_CONVERSATION += `

${RV_Customer_Name_DEV}, ${setTime}

${msg}
`; } else if (RV_MSG[i].type == "activity") { } else{ var name = "admin"; if (RV_MSG[i].type.toLowerCase() === "bot") { name = botsetting_DEV.Agent_Bot_Name; }else if( RV_MSG[i].userId && RV_MSG[i].userId !== "" ){ let msgUser = RV_MSG[i].userId; if( AgentDetails_DEV[msgUser] ){ name = AgentDetails_DEV[msgUser].firstName; if(AgentDetails_DEV[msgUser].lastName){ name += " "+AgentDetails_DEV[msgUser].lastName; } } } if( flag ){ msg = `
${msg}
` } RV_CONVERSATION += `

logo ${name} , ${setTime}

${msg}
`; } } RVBotViewDev.removeTyping(); } else { RVBotViewDev.removeTyping(); } } else { RVBotViewDev.removeTyping(); } if(RV_MSG.length > 0 ){ let lastIndex = RV_MSG.length-1; while(lastIndex != -1) { if( RV_MSG[lastIndex].type !== "activity" ){ RVLastMsg = RV_MSG[lastIndex]; lastIndex = -1; }else{ lastIndex--; } } RVBotViewDev.rvDisplayLastMsg() } }, rvDisplayLastMsg: function(){ if( RVLastMsg.hasOwnProperty('type') ){ let initials = name = ""; if( RVLastMsg.type == "user"){ name = RV_Customer_Name_DEV }else if( RVLastMsg.type == "bot"){ name = RVLastMsg.type.toLowerCase() === "bot" ? botsetting_DEV.Agent_Bot_Name : RVLastMsg.type; }else{ var name = "Admin"; if (RVLastMsg.name != "") { name = RVLastMsg.type.toLowerCase() === "bot" ? botsetting_DEV.Agent_Bot_Name : RVLastMsg.type; } } initials = name.substring(0,1); lastMessage = `
Continue the conversation
${initials}
${name} • ${RVBotViewDev.rvConvertDateTime(RVLastMsg.createdAt)}
${RVBotViewDev.rvStripHtml(RVLastMsg.message)}
`; if(widgetContentFrameDEV.querySelector('.rvHomeScreenInnerWrap')){ widgetContentFrameDEV.querySelector('.rvHomeScreenInnerWrap').insertAdjacentHTML('afterBegin', lastMessage); RVBotViewDev.viewOldConversation() } } }, socketConnect: function(){ if( !ioConnectFlag_DEV ){ socketDEV = widgetFrameDEV.contentWindow.io.connect( RV_SOCKET_URl_DEV, { jsonp: false }, { reconnectionDelay: 1000, reconnection: true, reconnectionAttempts: 10, transports: ["websocket"], agent: false, // [2] Please don't set this to true upgrade: false, rejectUnauthorized: false, }, { forceNew: true }, { withCredentials: true, } ); //get message from operator in real time. socketDEV.on("send_cust_message", function (data) { clearInterval(RVClearNotification_DEV); if (Visitor_Chat_Id_DEV == data.message.Visitor_Chat_Id) { var wrapper = divWidgetDEV; if (wrapper.style.display == "none") { var new_message = notificationContentFrameDEV.querySelector(".new-message"); notificationFrameDEV.style.display = "block"; var htmlContent = new_message.innerHTML; var nsum = parseInt(htmlContent) + 1; rvGetCookies(31, "notify-value", nsum); new_message.innerHTML = nsum; } RVBotViewDev.play(); data.message.msg = data.message.msg.replace(/\n/g, "
"); data.message.msg = RVBotViewDev.convertMsgHtml(data.message.msg); var rvMsg = `

logo ` + data.message.operator_name +`, ` +RVBotViewDev.rvGetCurrentTime() +`

` + data.message.msg +`
`; RV_CONVERSATION += rvMsg; if( RV_MSG_BODY_HEIGHT_DEV !== "" ){ RVBotViewDev.removeTyping(); RV_MSG_BODY_HEIGHT_DEV.insertAdjacentHTML("beforebegin", rvMsg); RVBotViewDev.rvResetMsgScroll(); } return true; } }); // socket typing socketDEV.on("user_display", (data) => { var pt_customer_id = rvGetCookies("customer_id"); if (pt_customer_id == data.user.Visitor_Chat_Id) { if (data.typing == true && RV_MSG_BODY_HEIGHT_DEV !== "" ) { var rvMessage = ""; RVBotViewDev.removeTyping(); rvMessage = typingLoader; RV_MSG_BODY_HEIGHT_DEV.insertAdjacentHTML("beforebegin", rvMessage); // var rvMessage =""; RVBotViewDev.rvResetMsgScroll(); } } }); socketDEV.on("admin_close_conversation", (data) =>{ if (Visitor_Chat_Id_DEV == data.Visitor_Chat_Id) { var rvMsg = `
admin close the current conversation ${RVBotViewDev.rvGetCurrentTime()}
`; RV_CONVERSATION += rvMsg; RVBotViewDev.removeTyping(); currentOption = ""; rvSetCookies(1, "rvce_current_option", ""); if( RV_MSG_BODY_HEIGHT_DEV !== "" ){ RV_MSG_BODY_HEIGHT_DEV.insertAdjacentHTML("beforebegin", rvMsg); widgetContentFrameDEV.querySelector('.rvReplyInputBox > textarea').setAttribute('disabled', 'disabled'); widgetContentFrameDEV.querySelector('.rvReplyInputBox .rvMessengerReplyInputUtilsButton').classList.add('disabled'); RVBotViewDev.rvResetMsgScroll(); } return true; } }) ioConnectFlag_DEV = true } rvGetCookies("1", "socketConnect", true); }, convertMsgHtml: function(text){ var exp = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/gi; var text1 = text.replace(exp, '$1'); var exp2 = /(^|[^\/])(www\.[\S]+(\b|$))/gim; return text1.replace(exp2, '$1$2'); }, rvResetMsgScroll: function(){ var messageBody = widgetContentFrameDEV.getElementById("rvMessengerHeight"); if (messageBody) { setTimeout(function(){ RV_MSG_BODY_DEV.scrollTop = messageBody.offsetTop; }, 500); } }, rvXmlRequest: function(url, data, micro = 3){ if( micro === 3 ){ url = RV_BASE_URL_DEV + url }else{ url = RV_EC_URL_DEV + url } return new Promise(function (resolve, reject) { var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function () { if (this.readyState == 4 && this.status == 200) { var res = JSON.parse(this.responseText); resolve(res); }else if(this.readyState == 4 && this.status == 422){ var res = JSON.parse(this.responseText); resolve(res); } }; xhttp.open("post", url, true); xhttp.setRequestHeader("content-type", "application/x-www-form-urlencoded"); //xhttp.setRequestHeader("content-type", "application/json"); xhttp.send(data); }); }, rvXmlJsonRequest: function(url, data, micro = 3){ if( micro === 3 ){ url = RV_BASE_URL_DEV + url }else{ url = RV_EC_URL_DEV + url } return new Promise(function (resolve, reject) { var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function () { if (this.readyState == 4 && this.status == 200) { var res = JSON.parse(this.responseText); resolve(res); }else if(this.readyState == 4 && this.status == 422){ var res = JSON.parse(this.responseText); resolve(res); } }; xhttp.open("post", url, true); //xhttp.setRequestHeader("content-type", "application/x-www-form-urlencoded"); xhttp.setRequestHeader("content-type", "application/json"); xhttp.send(JSON.stringify(data)); }); }, rvLoadWidgetHTMLAndFunc: function(res){ botsetting_DEV = res.botsetting; RVBotViewDev.rvLoadWidgetHTML(res.setting, res.botsetting); var styleSheet = document.createElement("style"); styleSheet.type = "text/css"; styleSheet.innerText = RVBotViewDev.overAllCssFile(); document.head.appendChild(styleSheet); // if (rvGetCookies("circle-ripple") == 1) { // var circle_ripple = toggleContentFrameDEV.querySelector(".circle-ripple"); // circle_ripple.style.display = "none"; // } var pt_chat = toggleContentFrameDEV.body.querySelector(".ptw_chat_toggle"); if(pt_chat){ pt_chat.addEventListener("click", function () { var dd = divWidgetDEV; if (dd.style.display == "none") { dd.style.display = "block"; //this.style.display ='none'; if (rvGetCookies("customer_id")) { RVBotViewDev.rvSendMessage("logged in", "nobot", "activity", "online"); } notificationContentFrameDEV.getElementsByClassName("new-message")[0].innerHTML = 0; rvSetCookies(1, "notify-value", 0); var flyMessage = triggerContentFrameDEV.querySelector(".flypopup"); if(flyMessage){ flyMessage.style.display = "none"; triggerFrameDEV.style.display = "none"; } var circle_ripple = toggleContentFrameDEV.querySelector(".circle-ripple"); if(circle_ripple){ circle_ripple.style.display = "none"; rvSetCookies(1, "circle-ripple", 1); } if(notificationFrameDEV){ notificationFrameDEV.style.display = "none"; } RVBotViewDev.homeScreenFunction(); } else { dd.style.display = "none"; if (rvGetCookies("customer_id")) { RVBotViewDev.rvSendMessage("chat closed", "nobot", "activity", "offline"); } } //RVBotViewDev.rvResetMsgScroll(); }); } var node = notificationContentFrameDEV.querySelector(".new-message"); var htmlContent = node.innerHTML; if (rvGetCookies("notify-value") > 0) { notificationFrameDEV.style.display = "block"; node.innerHTML = rvGetCookies("notify-value"); } }, homeScreenFunction: function(){ RVBotViewDev.rvHomeScreenScroll(); RVBotViewDev.addStartConversationEvent(); //RVBotViewDev.viewOldConversation(); RVBotViewDev.loadProductFaqEvent(); RVBotViewDev.orderStatusEvent(); RVBotViewDev.insertTriggerInConversation(); }, orderStatusEvent: function(){ let rvOrderStatusDom = widgetContentFrameDEV.body.querySelector('#rvOrderStatus'); if( rvOrderStatusDom ){ rvOrderStatusDom.addEventListener("click", RVBotViewDev.orderStatusFunc); } }, orderStatusFunc: function(e){ let widgetHeader = widgetContentFrameDEV.body.querySelector('.rvMessengerHeader > div'); widgetHeader.innerHTML = ""; if(widgetContentFrameDEV.body.querySelector('.rvHomeScreenWrap')){ widgetContentFrameDEV.body.querySelector('.rvHomeScreenWrap').remove(); } if(widgetContentFrameDEV.body.querySelector('.rvMessengerHeader .breadCrumbHtml')){ widgetContentFrameDEV.body.querySelector('.rvMessengerHeader .breadCrumbHtml').remove(); } if(widgetContentFrameDEV.body.querySelector('.rvArticleWrapper')){ widgetContentFrameDEV.body.querySelector('.rvArticleWrapper').remove(); } //widgetHomeContent.innerHTML = ""; widgetContentFrameDEV.body.querySelector('.rvMessengerHeader').style.height = "55px"; let articleHeader = `
` widgetHeader.innerHTML = articleHeader; if( RV_EMAIL_PHONE === "" ){ let rvMessengerHeader = widgetContentFrameDEV.body.querySelector('.rvMessengerHeader'); let accessHtml = `
Access your account
` rvMessengerHeader.insertAdjacentHTML('afterend', accessHtml); RVBotViewDev.accountAccessEvent(); }else{ RVBotViewDev.loadCustomerOrder(); } RVBotViewDev.goBackHomeButton(); }, accountAccessEvent: function(){ let accessInputDom = widgetContentFrameDEV.body.querySelector('#access_input'); if( accessInputDom ){ accessInputDom.addEventListener("keyup", RVBotViewDev.accessInputKeyUpEvent); accessInputDom.addEventListener("keydown", RVBotViewDev.accessInputKeyDownEvent); } let accessFormSubmitDom = widgetContentFrameDEV.body.querySelector('#accessFormSubmit'); if( accessFormSubmitDom ){ accessFormSubmitDom.addEventListener("click", RVBotViewDev.accessFormSubmission); } }, accessInputKeyDownEvent: function(e){ var emailPhone = this.value; if( emailPhone === "" ){ e.target.parentNode.parentNode.classList.add('form-error'); e.target.parentNode.parentNode.querySelector('.form-feedback').innerHTML = "Please enter phone/email"; return false; }else if( !rvValidatePhone(emailPhone) && !rvValidateEmail(emailPhone) ){ e.target.parentNode.parentNode.classList.add('form-error'); e.target.parentNode.parentNode.querySelector('.form-feedback').innerHTML = "Enter valid email/phone"; return false; } e.target.parentNode.parentNode.classList.remove('form-error'); e.target.parentNode.parentNode.querySelector('.form-feedback').innerHTML = ""; }, accessInputKeyUpEvent: function(e){ var keyCode = e.keyCode || e.which; if (keyCode == 13) { if (!e.shiftKey) { e.preventDefault(); RVBotViewDev.accessFormSubmission() } } }, accessFormSubmission: async function(e){ let accessInputDom = widgetContentFrameDEV.body.querySelector('#access_input'); let accesButtonDom = widgetContentFrameDEV.body.querySelector('#accessFormSubmit'); let emailPhone = accessInputDom.value; if( emailPhone === "" ){ accessInputDom.parentNode.parentNode.classList.add('form-error'); accessInputDom.parentNode.parentNode.querySelector('.form-feedback').innerHTML = "Please enter phone/email"; return false; }else if( !rvValidatePhone(emailPhone) && !rvValidateEmail(emailPhone) ){ accessInputDom.parentNode.parentNode.classList.add('form-error'); accessInputDom.parentNode.parentNode.querySelector('.form-feedback').innerHTML = "Enter valid email/phone"; return false; } accessInputDom.parentNode.parentNode.classList.remove('form-error'); accessInputDom.parentNode.parentNode.querySelector('.form-feedback').innerHTML = ""; accessInputDom.setAttribute("disabled", "disabled"); let buttonHtml = accesButtonDom.innerHTML; accesButtonDom.innerHTML = `${typingLoader}` accesButtonDom.setAttribute("disabled", "disabled"); let url = "/api/v1/getCustomerAllOrdersByEmail" let data = `order_email=${emailPhone}&Website_Id=${Website_Id_DEV}` let res = await RVBotViewDev.rvXmlRequest(url, data, 4); if( res.status === "success" ){ RV_EMAIL_PHONE = emailPhone; rvSetCookies(31, "rv_order_email", emailPhone); RV_CUSTOMER_ORDER = res.data.orders; RVBotViewDev.loadCustomerOrder(); }else if(res.status === "failure"){ accessInputDom.removeAttribute("disabled", "disabled"); accesButtonDom.removeAttribute("disabled", "disabled"); accessInputDom.parentNode.parentNode.classList.add('form-error'); accessInputDom.parentNode.parentNode.querySelector('.form-feedback').innerHTML = "We couldn’t find an account with this phone/ email"; accesButtonDom.innerHTML = buttonHtml; } }, loadCustomerOrder: function(){ let accessYourAccountDom = widgetContentFrameDEV.body.querySelector('.accessYourAccount'); if(accessYourAccountDom){ accessYourAccountDom.remove(); } let OrderHtml = ""; RV_ORDER_BREADCRUMBS = {}; if( RV_CUSTOMER_ORDER.length > 0 ){ for( let i = 0; i < RV_CUSTOMER_ORDER.length; i++ ){ let dateString = RV_CUSTOMER_ORDER[i].created_at; OrderHtml += `
Order: ${RV_CUSTOMER_ORDER[i].order_name}
${new Date(dateString).toLocaleDateString('en-US', { month: 'long', day: 'numeric', year: 'numeric' })}
${RV_CUSTOMER_ORDER[i].fulfillment_status}
Amount
$ ${RV_CUSTOMER_ORDER[i].total_price}
Qty
${RV_CUSTOMER_ORDER[i].products.length}
` } }else{ OrderHtml = `
No order found in your account
` } let OrderWholeHtml = `
${OrderHtml}
` let rvMessengerHeader = widgetContentFrameDEV.body.querySelector('.rvMessengerHeader'); rvMessengerHeader.insertAdjacentHTML('afterend', OrderWholeHtml); RVBotViewDev.viewCustomerOrderEvent(); }, viewCustomerOrderEvent: function(){ let viewCustomerButtons = widgetContentFrameDEV.body.querySelectorAll('.rvViewCustomerOrder'); if( viewCustomerButtons ){ for(let i = 0; i < viewCustomerButtons.length; i++ ){ viewCustomerButtons[i].addEventListener("click", RVBotViewDev.rvViewCustomerEventClicked); } } }, rvViewCustomerEventClicked: function(e){ let currentOrderIndex = e.target.dataset.index; RV_ORDER_BREADCRUMBS.currentOrderIndex = currentOrderIndex; RVBotViewDev.loadParticularOrder(); }, loadParticularOrder: function(){ if( RV_ORDER_BREADCRUMBS.currentOrderIndex !== "" ){ let orderIndex = RV_ORDER_BREADCRUMBS.currentOrderIndex; let currentOrder = RV_CUSTOMER_ORDER[orderIndex]; if( widgetContentFrameDEV.body.querySelector('.rvInnerPageWrap') ){ widgetContentFrameDEV.body.querySelector('.rvInnerPageWrap').remove(); } if( widgetContentFrameDEV.body.querySelector('.breadCrumbHtml') ){ widgetContentFrameDEV.body.querySelector('.breadCrumbHtml').remove() } if( widgetContentFrameDEV.body.querySelector('.rvAgentsInformation') ){ widgetContentFrameDEV.body.querySelector('.rvAgentsInformation').remove(); } let timeText = "Back in"; if( RVAgentOption ){ timeText = ""; } let agentHeaderHtml = `
${agentInformationHtml}
${botsetting_DEV.Agent_Bot_Name}
${timeText} ${RVBotViewDev.getNextAvailableTime()}
`; let rvGoBackHome = widgetContentFrameDEV.body.querySelector('.rvGoBackHome'); rvGoBackHome.insertAdjacentHTML("afterend", agentHeaderHtml); let rvMessengerHeader = widgetContentFrameDEV.body.querySelector('.rvMessengerHeader'); rvMessengerHeader.style.height = "75px"; let helpButtonHtml = ""; if(!No_Help_Array.includes(rvWebsiteIdDev)){ helpButtonHtml = `` } let BreadCrumbHtml = ` ` let OrderHtml = `
Order: ${currentOrder.order_name}
${new Date(currentOrder.created_at).toLocaleDateString('en-US', { month: 'long', day: 'numeric', year: 'numeric' })}
${currentOrder.fulfillment_status}
Amount
$ ${currentOrder.total_price}
Qty
${currentOrder.products.length}
${helpButtonHtml}
` if( typeof currentOrder.shipping_address !== "undefined" || typeof currentOrder.billing_address !== "undefined" ){ let rvAddressHtml = ""; if( typeof currentOrder.billing_address !== "undefined" ){ let billingAddress = currentOrder.billing_address; rvAddressHtml += `
BILLING ADDRESS
${billingAddress.address1 && billingAddress.address1+", "}${billingAddress.address2 && ", "+billingAddress.address2}${billingAddress.city && ", "+billingAddress.city}${billingAddress.province && ", "+billingAddress.province}${billingAddress.country && ", "+billingAddress.country}${billingAddress.zip && " "+billingAddress.zip}
` } if( typeof currentOrder.shipping_address !== "undefined" ){ let shippingAddress = currentOrder.shipping_address; rvAddressHtml += `
SHIPPING ADDRESS
${shippingAddress.address1 && shippingAddress.address1+", "}${shippingAddress.address2 && ", "+shippingAddress.address2}${shippingAddress.city && ", "+shippingAddress.city}${shippingAddress.province && ", "+shippingAddress.province}${shippingAddress.country && ", "+shippingAddress.country}${shippingAddress.zip && " "+shippingAddress.zip}
` } OrderHtml += `
Order Summary
${rvAddressHtml}
` } let bodyHtml = `
${BreadCrumbHtml} ${OrderHtml}
` rvMessengerHeader.insertAdjacentHTML("afterend", bodyHtml); RVBotViewDev.orderBreadCrumbsEvent(); RVBotViewDev.orderTrackEvent(); } }, orderTrackEvent: function(){ let rvTrackCustomerOrder = widgetContentFrameDEV.body.querySelector('.rvTrackCustomerOrder'); if( rvTrackCustomerOrder ){ rvTrackCustomerOrder.addEventListener("click", RVBotViewDev.rvTrackEventFunc); } let rvHelpCustomerOrder = widgetContentFrameDEV.body.querySelector('.rvHelpCustomerOrder'); if( rvHelpCustomerOrder ){ rvHelpCustomerOrder.addEventListener("click", RVBotViewDev.rvHelpEventFunc); } }, rvTrackEventFunc: async function(){ let orderIndex = RV_ORDER_BREADCRUMBS.currentOrderIndex; let currentOrder = RV_CUSTOMER_ORDER[orderIndex]; let rvInnerPageWrap = widgetContentFrameDEV.body.querySelector('.rvInnerPageWrap'); if( rvInnerPageWrap ){ rvInnerPageWrap.remove(); } let rvLoader = `
` let rvMessengerHeader = widgetContentFrameDEV.body.querySelector('.rvMessengerHeader'); rvMessengerHeader.insertAdjacentHTML("afterend", rvLoader); let url = "/api/v1/getCustomerOrderStatus"; let data = `Website_Id=${Website_Id_DEV}&req_order_id=${currentOrder.order_id}` let res = await RVBotViewDev.rvXmlRequest(url, data, 4) rvInnerPageWrap = widgetContentFrameDEV.body.querySelector('.rvInnerPageWrap'); rvInnerPageWrap.remove(); if( res.status == "success"){ let BreadCrumbHtml = ` ` let products = currentOrder.products; let productHtml = ""; for (let i = 0; i < products.length; i++){ let product = products[i]; let productImage = product.productImage; let productImageHtml = "" if( productImage && productImage.length > 0 ){ productImageHtml = `${product.name}` }else{ productImageHtml = `` } productHtml += `
${productImageHtml}
${product.quantity}
${product.name}
` } let trackingHtml = ""; if( res.data.tracking_number && res.data.tracking_number !== "" ){ trackingHtml += `
Your item(s) are dispatched
${res.data.tracking_company}

Tracking no

${res.data.tracking_number}

Click here to Track your order ` }else{ trackingHtml += `

No Tracking Information Available
` } let orderDetailsHtml = `
${trackingHtml}
${productHtml}
`; let bodyHtml = `
${BreadCrumbHtml} ${orderDetailsHtml}
` rvMessengerHeader.insertAdjacentHTML("afterend", bodyHtml); RVBotViewDev.orderBreadCrumbsEvent(); if(currentOrder.shipping_address){ RVBotViewDev.loadMap(currentOrder.shipping_address); } } }, rvHelpEventFunc: function(){ let orderIndex = RV_ORDER_BREADCRUMBS.currentOrderIndex; let currentOrder = RV_CUSTOMER_ORDER[orderIndex]; let rvInnerPageWrap = widgetContentFrameDEV.body.querySelector('.rvInnerPageWrap'); if( rvInnerPageWrap ){ rvInnerPageWrap.remove(); } let BreadCrumbHtml = ` ` let HelpHtml = `
Order: ${currentOrder.order_name}
${new Date(currentOrder.created_at).toLocaleDateString('en-US', { month: 'long', day: 'numeric', year: 'numeric' })}
${currentOrder.fulfillment_status}
Help with this order
I want to return some items
` let bodyHtml = `
${BreadCrumbHtml} ${HelpHtml}
` let rvMessengerHeader = widgetContentFrameDEV.body.querySelector('.rvMessengerHeader'); rvMessengerHeader.insertAdjacentHTML("afterend", bodyHtml); RVBotViewDev.orderBreadCrumbsEvent(); RVBotViewDev.helpOptionClickEvent(); }, helpOptionClickEvent: function(){ let helpOptions = widgetContentFrameDEV.body.querySelectorAll('.rvHelpOptionWrap .rvOrderHelpList'); if(helpOptions){ for( let i = 0; i < helpOptions.length; i++ ){ helpOptions[i].addEventListener("click", RVBotViewDev.helpOptionEventClicked); } } }, helpOptionEventClicked: function(e){ let options = e.target.dataset.value; switch (options){ case "return": RVBotViewDev.loadReturnOptionsFunc(); } }, loadReturnOptionsFunc: function(){ let orderIndex = RV_ORDER_BREADCRUMBS.currentOrderIndex; let currentOrder = RV_CUSTOMER_ORDER[orderIndex]; let rvInnerPageWrap = widgetContentFrameDEV.body.querySelector('.rvInnerPageWrap'); if( rvInnerPageWrap ){ rvInnerPageWrap.remove(); } let name = ""; if( currentOrder.first_name ){ name += currentOrder.first_name; } if( currentOrder.last_name ){ name += " "+currentOrder.last_name; } let BreadCrumbHtml = ` ` let HelpHtml = `
Order: ${currentOrder.order_name}
${new Date(currentOrder.created_at).toLocaleDateString('en-US', { month: 'long', day: 'numeric', year: 'numeric' })}
${currentOrder.fulfillment_status}
I want to return some items
${name} - we provide no questions asked returns on eligible items. Please select your reason for return and refund options and we'll get back to you with a confirmation.
` let bodyHtml = `
${BreadCrumbHtml} ${HelpHtml}
` let rvMessengerHeader = widgetContentFrameDEV.body.querySelector('.rvMessengerHeader'); rvMessengerHeader.insertAdjacentHTML("afterend", bodyHtml); RVBotViewDev.orderBreadCrumbsEvent(); RVBotViewDev.initiateReturnEvent(); }, initiateReturnEvent: function(){ let initateReturn = widgetContentFrameDEV.body.querySelector('.initateReturn'); if( initateReturn ){ initateReturn.addEventListener("click", RVBotViewDev.initateReturnFunc); } }, initateReturnFunc: function(){ let rvReturnOptions = widgetContentFrameDEV.body.querySelector('.rvReturnOptions'); if(rvReturnOptions){ let orderIndex = RV_ORDER_BREADCRUMBS.currentOrderIndex; let currentOrder = RV_CUSTOMER_ORDER[orderIndex]; let rvHelpMiddleWrap = widgetContentFrameDEV.body.querySelector('.rvHelpMiddleWrap'); rvHelpMiddleWrap.innerHTML = ""; let rvHelpBottomWrap = widgetContentFrameDEV.body.querySelector('.rvHelpBottomWrap') rvHelpBottomWrap.innerHTML = ""; let products = currentOrder.products; let productHtml = ""; for (let i = 0; i < products.length; i++){ let product = products[i]; let productImage = product.productImage; let productImageHtml = "" if( productImage && productImage.length > 0 ){ productImageHtml = `${product.name}` }else{ productImageHtml = `` } productHtml += `
${productImageHtml}
${product.name}
$${product.price}*${product.quantity}
$${product.price*product.quantity}
` } let middleHtml = `
select relevant items
${productHtml}
` let endHtml = ` ` rvHelpMiddleWrap.innerHTML = middleHtml; rvHelpBottomWrap.innerHTML = endHtml; RVBotViewDev.proceedWithReturnEvent(); } }, proceedWithReturnEvent: function(){ let selectAllOption = widgetContentFrameDEV.body.querySelector('.selectAllOption'); if( selectAllOption ){ selectAllOption.addEventListener("change", RVBotViewDev.productReturnSelectAllFunc); } let multipleCheckBoxes = widgetContentFrameDEV.body.querySelectorAll('.productSelect'); for( let i = 0; i < multipleCheckBoxes.length; i++ ){ multipleCheckBoxes[i].addEventListener("change", RVBotViewDev.singleProductCheckboxFunc); } let proceedReturnDom = widgetContentFrameDEV.body.querySelector('#proceedReturn'); if( proceedReturnDom ){ proceedReturnDom.addEventListener("click", RVBotViewDev.returnFormSubmissionFunc); } }, returnFormSubmissionFunc: async function(){ let multipleCheckBoxes = widgetContentFrameDEV.body.querySelectorAll('.productSelect'); let reasonforreturn = widgetContentFrameDEV.body.querySelector('#reasonforreturn'); let refundOrExchange = widgetContentFrameDEV.body.querySelector('#refundOrExchange'); let productArray = []; let returnOption = reasonforreturn ? reasonforreturn.value : ""; let refundOption = refundOrExchange ? refundOrExchange.value : "" ; for( let i = 0; i < multipleCheckBoxes.length; i++ ){ if ( multipleCheckBoxes[i].checked ){ let value = multipleCheckBoxes[i].value; if( !productArray.includes(value) ){ productArray.push(value); } } } if( productArray.length === 0 ){ widgetContentFrameDEV.body.querySelector('.rvHelpMiddleWrap .errorFeedBack').innerHTML = "
Please Select the product First
"; }else if( returnOption === "" ){ widgetContentFrameDEV.body.querySelector('.rvHelpMiddleWrap .errorFeedBack').innerHTML = "
Please choose return option
"; }else if( refundOption === "" ){ widgetContentFrameDEV.body.querySelector('.rvHelpMiddleWrap .errorFeedBack').innerHTML = "
Please choose refund option
"; }else{ RV_RETURN_FORM = true; widgetContentFrameDEV.body.querySelector('.rvHelpMiddleWrap .errorFeedBack').innerHTML = ""; await RVBotViewDev.startConversationFunc(false); let orderIndex = RV_ORDER_BREADCRUMBS.currentOrderIndex; let currentOrder = RV_CUSTOMER_ORDER[orderIndex]; let products = currentOrder.products; let productFaqMessage1 = `
Order
>
I want to return some items
` let rvMsg = `

` + RV_Customer_Name_DEV +`, ` +RVBotViewDev.rvGetCurrentTime() +`

${productFaqMessage1}
` RV_CONVERSATION += rvMsg; if( RV_MSG_BODY_HEIGHT_DEV !== "" ){ RVBotViewDev.removeTyping(); RV_MSG_BODY_HEIGHT_DEV.insertAdjacentHTML("beforebegin", rvMsg); RVBotViewDev.rvResetMsgScroll(); } await RVBotViewDev.rvSendMessage(encodeURIComponent(productFaqMessage1), "", "user"); let name = ""; if(currentOrder.first_name){ name += currentOrder.first_name } if(currentOrder.last_name){ name += " " + currentOrder.last_name } let productHtml = ""; let requestProduct = [] for( let i = 0; i < productArray.length; i++ ){ let currentProduct = products[productArray[i]]; requestProduct.push(currentProduct); productHtml += `
${currentProduct.name} * ${currentProduct.quantity}
$${currentProduct.price*currentProduct.quantity}
` } let url = "/api/v1/requestOrder"; let data = {"Order_Id":currentOrder.order_id,"Order_Number":currentOrder.order_number,"Customer_Name":name, "Customer_Email": currentOrder.email, "Website_Id": Website_Id_DEV, "Order_type": "return", "products":requestProduct, "Visitor_Chat_Id": Visitor_Chat_Id_DEV, "Conversation_Id": Conversation_Id, "reason_for_return": returnOption, "refund_option": refundOption} if( currentOrder.order_name ){ data.Order_Name = currentOrder.order_name; } RVBotViewDev.rvXmlJsonRequest(url, data); let productFaqMessage2 = `
${returnOption}
${refundOption}
` rvMsg = `
${productFaqMessage2}
` RV_CONVERSATION += rvMsg; if( RV_MSG_BODY_HEIGHT_DEV !== "" ){ RVBotViewDev.removeTyping(); RV_MSG_BODY_HEIGHT_DEV.insertAdjacentHTML("beforebegin", rvMsg); RVBotViewDev.rvResetMsgScroll(); } await RVBotViewDev.rvSendMessage(encodeURIComponent(productFaqMessage2), "", "user"); let productFaqMessage3 = `
Order: ${currentOrder.order_name}
${new Date(currentOrder.created_at).toLocaleDateString('en-US', { month: 'long', day: 'numeric', year: 'numeric' })}
${currentOrder.fulfillment_status}
Amount
$ ${currentOrder.total_price}
Qty
${currentOrder.products.length}
Selected Items
${productHtml}
` rvMsg = `
${productFaqMessage3}
` RV_CONVERSATION += rvMsg; if( RV_MSG_BODY_HEIGHT_DEV !== "" ){ RVBotViewDev.removeTyping(); RV_MSG_BODY_HEIGHT_DEV.insertAdjacentHTML("beforebegin", rvMsg); RVBotViewDev.rvResetMsgScroll(); } await RVBotViewDev.rvSendMessage((productFaqMessage3), "", "user"); let msg = `Your Return request has been submitted succesfully. The team typically replies in ${botsetting_DEV.Bot_Agent_Reply_Time}`; var rvMessage =`

logo Bot, ${RVBotViewDev.rvGetCurrentTime()}

${msg}
`; RV_CONVERSATION += rvMessage; RV_MSG_BODY_HEIGHT_DEV.insertAdjacentHTML("beforebegin", rvMessage); await RVBotViewDev.rvSendMessage( msg, "", "bot"); RVBotViewDev.rvResetMsgScroll(); RV_Customer_Email_DEV = currentOrder.email; msg = "you will notified here and on email ("+currentOrder.email+") when they reply."; rvMessage =`
${msg}
`; RV_CONVERSATION += rvMessage; RV_MSG_BODY_HEIGHT_DEV.insertAdjacentHTML("beforebegin", rvMessage); await RVBotViewDev.rvSendMessage( msg, "", "bot"); RVBotViewDev.rvResetMsgScroll(); RVBotViewDev.rvCollectMessage(); } }, singleProductCheckboxFunc: function(){ if( widgetContentFrameDEV.body.querySelector('.rvHelpMiddleWrap .errorFeedBack')){ widgetContentFrameDEV.body.querySelector('.rvHelpMiddleWrap .errorFeedBack').innerHTML = ""; } }, productReturnSelectAllFunc: function(e){ if( widgetContentFrameDEV.body.querySelector('.rvHelpMiddleWrap .errorFeedBack')){ widgetContentFrameDEV.body.querySelector('.rvHelpMiddleWrap .errorFeedBack').innerHTML = ""; } let options; if( e.target.checked ){ options = true; e.target.parentNode.querySelector('.selectAllText').innerHTML = "Unselect All"; }else{ options = false; e.target.parentNode.querySelector('.selectAllText').innerHTML = "Select All"; } let multipleCheckBoxes = widgetContentFrameDEV.body.querySelectorAll('.productSelect'); for( let i = 0; i < multipleCheckBoxes.length; i++ ){ multipleCheckBoxes[i].checked = options; } }, loadMap: function(address){ const myLatLng = { lat: address.latitude, lng: address.longitude }; const map = new widgetFrameDEV.contentWindow.google.maps.Map(widgetContentFrameDEV.body.querySelector("#map"), { zoom: 15, center: myLatLng, mapTypeControl: false, draggable: false, scaleControl: false, scrollwheel: false, navigationControl: false, streetViewControl: false, }); let contentString = "Shipping Address
"; if( address.province ){ contentString += address.province+ ", " } if( address.country ){ contentString += address.country } const infowindow = new widgetFrameDEV.contentWindow.google.maps.InfoWindow({ content: contentString, }); const marker = new widgetFrameDEV.contentWindow.google.maps.Marker({ position: myLatLng, map, //title: `Shipping Address
${address.province && address.province+" ,"}${ address.country && address.country}` }); marker.addListener("click", () => { infowindow.open({ anchor: marker, map, shouldFocus: false, }); }); }, orderBreadCrumbsEvent: function(){ let orderBreadCrumbs = widgetContentFrameDEV.body.querySelectorAll('.orderBreadCrumbs'); if(orderBreadCrumbs){ for( let i = 0; i < orderBreadCrumbs.length; i++ ){ orderBreadCrumbs[i].addEventListener("click", RVBotViewDev.orderBreadCrumbsClicked); } } }, orderBreadCrumbsClicked: function(e){ let breadCrumbsValue = e.target.dataset.value; switch (breadCrumbsValue){ case "home": RVBotViewDev.goBackHomeButtonClicked(); break; case "order": RVBotViewDev.loadCustomerOrder(); break; case 'particularOrder': RVBotViewDev.loadParticularOrder(); break; case 'help': RVBotViewDev.rvHelpEventFunc(); } }, loadProductFaqEvent: function(){ let productFaqDom = widgetContentFrameDEV.body.querySelector('#rvProdFaqArticle'); if(productFaqDom){ productFaqDom.addEventListener("click", RVBotViewDev.loadProductFaqFunc); } let otherAritcleDom = widgetContentFrameDEV.body.querySelector('#rvProdFaqOtherArticle'); if(otherAritcleDom){ otherAritcleDom.addEventListener("click", RVBotViewDev.loadProductFaqFunc); } }, loadProductFaqFunc: function(e){ if( RV_ARTICLE_TYPE === "" ){ articleType = e.target.dataset.value; RV_ARTICLE_TYPE = articleType } if( RV_Collection_Article && RV_Collection_Article[articleType] && RV_Collection_Article[articleType].length > 0 ){ let widgetHeader = widgetContentFrameDEV.body.querySelector('.rvMessengerHeader > div'); widgetHeader.innerHTML = ""; if(widgetContentFrameDEV.body.querySelector('.rvHomeScreenWrap')){ widgetContentFrameDEV.body.querySelector('.rvHomeScreenWrap').remove(); } if(widgetContentFrameDEV.body.querySelector('.rvMessengerHeader .breadCrumbHtml')){ widgetContentFrameDEV.body.querySelector('.rvMessengerHeader .breadCrumbHtml').remove(); } if(widgetContentFrameDEV.body.querySelector('.rvArticleWrapper')){ widgetContentFrameDEV.body.querySelector('.rvArticleWrapper').remove(); } //widgetHomeContent.innerHTML = ""; widgetContentFrameDEV.body.querySelector('.rvMessengerHeader').style.height = "55px"; let articleHeader = `
` widgetHeader.innerHTML = articleHeader; let rvMessengerHeader = widgetContentFrameDEV.body.querySelector('.rvMessengerHeader'); let collectionsList = ""; for(let i = 0; i < RV_Collection_Article[articleType].length; i++){ collectionsList += `
${RV_Collection_Article[articleType][i]['Title']}
` } let rvHeaderTitle = ""; if( RV_ARTICLE_TYPE === "Product FAQs"){ rvHeaderTitle = "Product Questions" }else{ rvHeaderTitle = "Start a Conversation" } var productFaqHtml = `
${rvHeaderTitle}
${collectionsList}
`; rvMessengerHeader.insertAdjacentHTML('afterend', productFaqHtml); RVBotViewDev.collectionClickEvent(); RVBotViewDev.goBackHomeButton(); } }, collectionClickEvent: function(){ var collectionList = widgetContentFrameDEV.body.querySelectorAll('.rvArticleWrapper .rvArticleColList'); if( collectionList && collectionList.length > 0 ){ for(let i = 0; i < collectionList.length; i++ ){ collectionList[i].addEventListener("click", RVBotViewDev.collectionClicked); } } }, collectionClicked: function(e){ RVBotViewDev.collectionClickedFunction(e.target.dataset.value) }, collectionClickedFunction: function(indexValue){ if( !collectionBreadCrumb.hasOwnProperty('collectionIndex') || ( collectionBreadCrumb.hasOwnProperty('collectionIndex') && collectionBreadCrumb.collectionIndex === "" ) ){ var collectionIndex = indexValue; collectionBreadCrumb.collectionIndex = collectionIndex; var collectionArticles = RV_Collection_Article[RV_ARTICLE_TYPE][collectionIndex].articles; if( collectionArticles.length > 0 ){ var rvConversationHeader = widgetContentFrameDEV.body.querySelector('.rvConversationHeader'); if(rvConversationHeader.querySelector('.breadCrumbHtml')){ rvConversationHeader.querySelector('.breadCrumbHtml').remove(); } let rvHeaderTitle = ""; if( RV_ARTICLE_TYPE === "Product FAQs"){ rvHeaderTitle = "Product Questions" }else{ rvHeaderTitle = "Start a Conversation" } var breadCrumbHtml = ` `; rvConversationHeader.insertAdjacentHTML("beforeend", breadCrumbHtml); var rvProductFaqHeader = widgetContentFrameDEV.body.querySelector('.rvProductFaqHeader'); if( rvProductFaqHeader.querySelector('.productFaqTitle') ){ rvProductFaqHeader.querySelector('.productFaqTitle').innerHTML = RV_Collection_Article[RV_ARTICLE_TYPE][collectionIndex].Title; } if(rvProductFaqHeader.querySelector('.productFaqDescription')){ rvProductFaqHeader.querySelector('.productFaqDescription').remove(); } let rvCollectionDescription = `
${RV_Collection_Article[RV_ARTICLE_TYPE][collectionIndex].Description}
` rvProductFaqHeader.querySelector('.productFaqTitle').insertAdjacentHTML("afterend", rvCollectionDescription); var collectionList = widgetContentFrameDEV.body.querySelectorAll('.rvArticleWrapper .rvArticleColList'); if( collectionList && collectionList.length > 0 ){ for(let i = 0; i < collectionList.length; i++ ){ collectionList[i].remove(); } } let articleList = ""; for(let i = 0; i < collectionArticles.length; i++){ articleList += `
${collectionArticles[i]['Title']}
` } let rvProductFaqWrap = widgetContentFrameDEV.body.querySelector('.rvArticleWrapper .rvProductFaqWrap'); rvProductFaqWrap.insertAdjacentHTML("beforeend", articleList); RVBotViewDev.collectionClickEvent(); RVBotViewDev.breadCrumbClickEvent(); } }else{ var articleIndex = indexValue; collectionBreadCrumb.articleIndex = articleIndex; let collectionIndex = collectionBreadCrumb.collectionIndex; var article = RV_Collection_Article[RV_ARTICLE_TYPE][collectionIndex].articles[articleIndex]; if( article ){ var rvConversationHeader = widgetContentFrameDEV.body.querySelector('.rvConversationHeader'); if(rvConversationHeader.querySelector('.breadCrumbHtml')){ rvConversationHeader.querySelector('.breadCrumbHtml').remove(); } var breadCrumbHtml = ` `; rvConversationHeader.insertAdjacentHTML("beforeend", breadCrumbHtml); var rvProductFaqHeader = widgetContentFrameDEV.body.querySelector('.rvProductFaqHeader'); if( rvProductFaqHeader.querySelector('.productFaqTitle') ){ rvProductFaqHeader.querySelector('.productFaqTitle').innerHTML = article.Title; if(rvProductFaqHeader.querySelector('.productFaqDescription')){ rvProductFaqHeader.querySelector('.productFaqDescription').remove(); } let rvCollectionDescription = `
${article.Content_Json}
` rvProductFaqHeader.querySelector('.productFaqTitle').insertAdjacentHTML("afterend", rvCollectionDescription); } var collectionList = widgetContentFrameDEV.body.querySelectorAll('.rvArticleWrapper .rvArticleColList'); if( collectionList && collectionList.length > 0 ){ for(let i = 0; i < collectionList.length; i++ ){ collectionList[i].remove(); } } let articleOptionHtml = `
` let rvProductFaqWrap = widgetContentFrameDEV.body.querySelector('.rvArticleWrapper .rvProductFaqWrap'); rvProductFaqWrap.insertAdjacentHTML("beforeend", articleOptionHtml); RVBotViewDev.breadCrumbClickEvent(); RVBotViewDev.articleOptionsEvent(); } } }, articleOptionsEvent: function(){ let rvArticleReturnHome = widgetContentFrameDEV.body.querySelector('.rvArticleColList .rvArticleReturnHome'); if( rvArticleReturnHome ){ rvArticleReturnHome.addEventListener("click", RVBotViewDev.rvArticleReturnHomeClicked); } let rvArticleSendMsg = widgetContentFrameDEV.body.querySelector('.rvArticleColList .rvArticleSendMsg'); if( rvArticleSendMsg ){ rvArticleSendMsg.addEventListener("click", RVBotViewDev.rvArticleSendMsgClicked); } }, rvArticleReturnHomeClicked: function(){ RVBotViewDev.goBackHomeButtonClicked(); }, rvArticleSendMsgClicked: function(){ RVBotViewDev.startConversationFunc(true, true); }, breadCrumbClickEvent: function(){ var breadCrumbHtmlDom = widgetContentFrameDEV.body.querySelector('.rvMessengerHeader .breadCrumbHtml'); if( breadCrumbHtmlDom ){ breadCrumbHtmlDom.addEventListener('click', RVBotViewDev.breadCrumbClicked); } }, breadCrumbClicked: function(e){ var breadCrumbValue = e.target.dataset.value; if( breadCrumbValue === "collectionList" ){ collectionBreadCrumb = {} RVBotViewDev.loadProductFaqFunc(); }else{ let indexValue = collectionBreadCrumb.collectionIndex; collectionBreadCrumb = {}; RVBotViewDev.collectionClickedFunction(indexValue); } }, viewOldConversation: function(){ var rvConversationSummary = widgetContentFrameDEV.body.querySelector('#oldConversation'); rvConversationSummary.addEventListener('click', RVBotViewDev.oldConversationEvent); }, oldConversationEvent: function(){ if( currentOption !== "live_agent" ){ RVBotViewDev.startConversationFunc(false); }else{ RVBotViewDev.startConversationFunc(false, false, false); } }, rvGetCurrentDate: function(){ let rvDt = new Date(); // if(botTimezone_DEV !="" && botTimezone_DEV != undefined){ // var date = new Date().toLocaleString("en-US", {timeZone: botTimezone_DEV}); // var rvDt = new Date(date) // } let rvDate = rvDt.getDate(), rvMonth = rvDt.getMonth() + 1, rvYear = rvDt.getFullYear(); if (rvDate.toString().length == 1) { rvDate = "0" + rvDate; } if (rvMonth.toString().length == 1) { rvMonth = "0" + rvMonth; } var rvCurrentDate = rvYear + "-" + rvMonth + "-" + rvDate; return rvCurrentDate; }, rvSendMessage: async function(rvMsg, botstatus, type, emit = "", Workflow_Id = "", Workflow_Next_Block = "", activateUser = ""){ if(type !== "activity" ){ RVLastMsg.type = type; RVLastMsg.message = rvMsg; RVLastMsg.createdAt = new Date(new Date().toUTCString().slice(0, -3)); } if (Visitor_Chat_Id_DEV !== "") { if( rvMsg !== '' && type !== "activity" ){ socketDEV.emit("message", { Conversation_Id: Conversation_Id, customer_name: RV_Customer_Name_DEV, Visitor_Chat_Id_DEV: Visitor_Chat_Id, Website_Id: Website_Id_DEV, message: rvMsg, type: type, createdDate: new Date(), createdAt: new Date(), }); } if( (type === "activity" && emit !== "" ) || ( activateUser === 1 ) ){ socketDEV.emit( emit, { Conversation_Id: Conversation_Id, Website_Id: Website_Id_DEV }); } } if( RV_MSG_BODY_HEIGHT_DEV !== "" ){ var rvMessage = ""; rvMessage += typingLoader; RVBotViewDev.removeTyping(); RV_MSG_BODY_HEIGHT_DEV.insertAdjacentHTML("beforebegin", rvMessage); RVBotViewDev.rvResetMsgScroll(); } let url = "/livechat/send-message"; let data = `Conversation_Id=${Conversation_Id}&type=${type}&Visitor_Chat_Id=${Visitor_Chat_Id_DEV}&message=${rvMsg}&Website_Id=${Website_Id_DEV}&time=${RVBotViewDev.rvGetCurrentDate() + " " + RVBotViewDev.rvGetCurrentTime()}&VisitorId=${VisitorId}¤t_option=${currentOption}&name=${rvGetCookies("rv_name")}&email=${rvGetCookies("rv_email")}`; // if( Is_Agent_Flag === "changed" ){ // data += `&is_live_chat=${Is_Agent}` // Is_Agent_Flag = "" // } if( botstatus === "no" ){ data += `&dialog=no` } if( type === "activity" && emit !== "" ){ data += `&vistor_status=${emit}` } if( activateUser === 1 ){ data += `&logged_in=1` } if( botstatus === "workflow" ){ data += `&Agent_Bot_Workflow_Id=${Workflow_Id}` if( Workflow_Next_Block !== ""){ data += `&Workflow_Next_Block=${Workflow_Next_Block}` } } let res = await RVBotViewDev.rvXmlRequest(url, data); if( res.status === true ){ if (rvGetCookies("customer_id") == "" || rvGetCookies("customer_id") == null) { rvSetCookies(31, "customer_id", res.Visitor_Chat_Id); rvSetCookies(31, "conversation_id", res.Conversation_Id); rvSetCookies(31, "project_id", res.Website_Id); Visitor_Chat_Id_DEV = res.Visitor_Chat_Id; Conversation_Id = res.Conversation_Id; Website_Id_DEV = res.Website_Id; if( rvMsg !== '' && type !== "activity" ){ socketDEV.emit("message", { Conversation_Id: Conversation_Id, customer_name: RV_Customer_Name_DEV, Visitor_Chat_Id: Visitor_Chat_Id_DEV, Website_Id: Website_Id_DEV, message: rvMsg, type: type, createdDate: new Date(), createdAt: new Date(), }); } socketDEV.emit( emit, { Conversation_Id: Conversation_Id, Website_Id: Website_Id_DEV }); socketDEV.emit("new_user", { Website_Id: res.Website_Id, Visitor_Chat_Id: res.Visitor_Chat_Id, } ); } if( rvMsg === "started live chat" && type === "activity" ){ socketDEV.emit( emit, { Conversation_Id: Conversation_Id, Website_Id: Website_Id_DEV }); } if( currentOption === "faq" && botstatus !== "no" ){ RVBotViewDev.faqResponseDisplay(res.dialogflow_response); }else if(currentOption === "workflow"){ RVBotViewDev.workflowResponseDisplay(res.workflow_response) }else{ RVBotViewDev.removeTyping(); } } }, faqResponseDisplay: function(dialogFlowResponse){ if (Object.keys(dialogFlowResponse).length > 0) { //removeTyping(); var rvMessages = ""; var rvMsg = dialogFlowResponse.messages; var rvMessage = ""; var getCurTime = pxGetCurrentTime(); for (let i = 0; i < rvMsg.length; i++) { let msg = rvMsg[i].replace(/\n/g, "
"); msg = RVBotViewDev.convertMsgHtml(msg); var name = "Bot"; setTimeout( function () { var rvMessage; if (i === 0) { rvMessage = `

logo ` +name + `, ` + getCurTime + `

` + msg + `
`; } else { rvMessage = `
` + msg + `
`; } RV_CONVERSATION += rvMessage; RVBotViewDev.removeTyping(); RV_MSG_BODY_HEIGHT_DEV.insertAdjacentHTML("beforebegin", rvMessage); if (i === 0) { RVBotViewDev.play(); } RVBotViewDev.rvResetMsgScroll(); }, i * 1000, i, RV_MSG_BODY_HEIGHT_DEV, msg, typingLoader ); socketDEV.emit("message", { Conversation_Id: Conversation_Id, Visitor_Chat_Id: Visitor_Chat_Id_DEV, Website_Id: Website_Id_DEV, message: msg, type: "Bot", createdDate: new Date(), createdAt: new Date(), }); } if (rvMsg.length > 0) { var dd = divWidgetDEV; if (dd.style.display == "none") { var node = notificationContentFrameDEV.getElementsByClassName("new-message"); var htmlContent = node[0].innerHTML; var nsum = parseInt(htmlContent) + rvMsg.length; pxSetCookie("1", "notify-value", nsum); node[0].innerHTML = nsum; notificationFrameDEV.style.display = "block"; } } } else { RVBotViewDev.removeTyping(); } }, workflowResponseDisplay: function(workflowResponse){ let rvMessages = ""; let rvMsg = workflowResponse.content; let rvBtn = workflowResponse.buttons; let rvMessage = ""; let getCurTime = RVBotViewDev.rvGetCurrentTime(); currentWorkflowId_DEV = workflowResponse.Agent_Bot_Workflow_Id; let msgArray = []; for (let i = 0; i < rvMsg.length; i++) { switch (rvMsg[i].type){ case "text": msg = rvMsg[i].message.replace(/\n/g, "
"); msg = RVBotViewDev.convertMsgHtml(msg); msg = `
${msg}
`; break; case "image": msg = `

${rvMsg[i].title}

${rvMsg[i].subtitle}

` break; case "gallery": let gallery = rvMsg[i].gallery; let galleryInner = ''; let style = "block"; for (let i = 0; i < gallery.length; i++) { let buttonInnerHtml = msg1 = ""; let btnDetails = gallery[i].buttonDetails for (let j = 0; j < btnDetails.length; j++) { let btn = btnDetails[j]; buttonInnerHtml += ``; } if( btnDetails.length > 0 ){ msg1 = `
${buttonInnerHtml}
`; } if( i === 0 ){ style="block"; }else{ style="none"; } galleryInner += `

${gallery[i].title}

${gallery[i].subtitle}

${msg1}
` } if( gallery.length > 0 ){ msg = `
${galleryInner}
` } } msgArray.push(msg); var name = botsetting_DEV.Agent_Bot_Name; setTimeout( function () { if (i === 0) { var rvMessage = `

logo ` +name + `, ` + getCurTime + `

${msgArray[i]}
`; } else { var rvMessage = `
${msgArray[i]}
`; } if( msgArray[i] !== "" ){ RV_CONVERSATION += rvMessage; RVBotViewDev.removeTyping(); RV_MSG_BODY_HEIGHT_DEV.insertAdjacentHTML("beforebegin", rvMessage); RV_MSG_BODY_HEIGHT_DEV.insertAdjacentHTML("beforebegin", typingLoader); } if (i === 0) { RVBotViewDev.play(); } RVBotViewDev.rvResetMsgScroll(); }, i * 1000, i, RV_MSG_BODY_HEIGHT_DEV, msgArray, name, typingLoader ); socketDEV.emit("message", { Conversation_Id: Conversation_Id, Visitor_Chat_Id: Visitor_Chat_Id_DEV, Website_Id: Website_Id_DEV, message: msg, type: "Bot", createdDate: new Date(), createdAt: new Date(), }); } if (rvMsg.length > 0) { RVLastMsg.type = "bot"; RVLastMsg.createdAt = new Date(new Date().toUTCString().slice(0, -3)); RVLastMsg.message = msg; var dd = divWidgetDEV; if (dd.style.display == "none") { var node = toggleContentFrameDEV.getElementsByClassName("new-message"); var htmlContent = node[0].innerHTML; var nsum = parseInt(htmlContent) + rvMsg.length; pxSetCookie("1", "notify-value", nsum); node[0].innerHTML = nsum; node[0].style.display = "block"; } } if (rvBtn.length > 0) { setTimeout( function () { RVBotViewDev.removeTyping(); let buttonInnerHtml = ""; for (i = 0; i < rvBtn.length; i++) { let btn = rvBtn[i]; buttonInnerHtml += ``; } var msg1 = `
${buttonInnerHtml}
`; RVBotViewDev.removeTyping(); RV_MSG_BODY_HEIGHT_DEV.insertAdjacentHTML("beforebegin", msg1); RVBotViewDev.rvResetMsgScroll(); }, (rvMsg.length + 1) * 1000, RV_MSG_BODY_HEIGHT_DEV, rvBtn ); } else { setTimeout(function () { RVBotViewDev.removeTyping(); }, (rvMsg.length + 1) * 1000); } setTimeout( function () { let domButtons = widgetContentFrameDEV.querySelectorAll(".rve_dg_btn_options"); for (let k = 0; k < domButtons.length; k++) { domButtons[k].addEventListener("click", RVBotViewDev.rveDgClickEvent); } }, (rvMsg.length + 1) * 1000 ); }, rveDgClickEvent: function(e){ let msg = e.target.dataset.msg let nextBlockId = e.target.dataset.value; if (msg) { msg = msg.replace(/\n/g, "
"); var msg1 = `

` + RV_Customer_Name_DEV + `, ` + RVBotViewDev.rvGetCurrentTime() + `

` + RVBotViewDev.convertMsgHtml(msg) + `
`; RVBotViewDev.removeTyping(); if(e.target.parentNode.parentNode.parentNode.parentNode.classList[0] === "rvecGalleryBtnWrapper"){ var galleryParentNode = e.target.parentNode.parentNode.parentNode.parentNode.parentNode var galleryButtonNode = galleryParentNode.querySelectorAll('.rvConvMsg'); for (let m = 0; m < galleryButtonNode.length; m++) { galleryButtonNode[m].remove(); } var userIntent = `
${msg1}
` RV_MSG_BODY_HEIGHT_DEV.insertAdjacentHTML("beforebegin", userIntent); }else{ e.target.parentNode.parentNode.innerHTML = msg1; } RV_MSG_BODY_HEIGHT_DEV.insertAdjacentHTML("beforebegin", typingLoader); RVBotViewDev.rvSendMessage( msg, "workflow", "user", "", currentWorkflowId_DEV, nextBlockId); RVBotViewDev.rvResetMsgScroll(); } }, rvHomeScreenScroll: function (){ var rvHomeScreen = widgetContentFrameDEV.body.querySelector('.rvHomeScreen'); rvHomeScreen.onscroll = function() { if(widgetContentFrameDEV.body.querySelector('.rvMsgHeaderOpacity')){ let scrollTop, opacity; if( rvHomeScreen.scrollTop === 0 ){ scrollTop = 0; opacity = 1; }else{ scrollTop = rvHomeScreen.scrollTop / 2; opacity = 1 / ( scrollTop / 4 ); if( opacity < 0 ){ opacity = 0; } if( scrollTop > 120 ){ scrollTop = 120 } } widgetContentFrameDEV.body.querySelector('.rvMsgHeaderOpacity').style.opacity = opacity; widgetContentFrameDEV.body.querySelector('.rvMsgHeaderOpacity').style.transform = `translateY(-${scrollTop}px)`; } } }, addStartConversationEvent: function (){ var startConversationBtn = widgetContentFrameDEV.body.querySelector('#startConversation'); startConversationBtn.addEventListener("click", RVBotViewDev.startConversationFunc); }, startConversationFunc: function( flag = true, breadCrumbsArgs = false, openTextWidget = true){ var widgetHeader = widgetContentFrameDEV.body.querySelector('.rvMessengerHeader > div'); widgetHeader.innerHTML = ""; if(widgetContentFrameDEV.body.querySelector('.rvHomeScreenWrap')){ widgetContentFrameDEV.body.querySelector('.rvHomeScreenWrap').remove(); } if( widgetContentFrameDEV.body.querySelector('.rvInnerPageWrap') ){ widgetContentFrameDEV.body.querySelector('.rvInnerPageWrap').remove(); } let timeText = "Back in"; if( RVAgentOption ){ timeText = ""; } //widgetHomeContent.innerHTML = ""; widgetContentFrameDEV.body.querySelector('.rvMessengerHeader').style.height = "75px"; var conversationHeader = `
${agentInformationHtml}
${botsetting_DEV.Agent_Bot_Name}
${timeText} ${RVBotViewDev.getNextAvailableTime()}
` widgetHeader.innerHTML = conversationHeader; var rvMessengerHeader = widgetContentFrameDEV.body.querySelector('.rvMessengerHeader'); if( breadCrumbsArgs ){ let productFaqMessage = `
` let rvMsg = `

` + RV_Customer_Name_DEV +`, ` +RVBotViewDev.rvGetCurrentTime() +`

${productFaqMessage}
` RV_CONVERSATION += rvMsg; RVBotViewDev.rvSendMessage(encodeURIComponent(productFaqMessage), "", "user"); collectionBreadCrumb = {}; } var chatConversationHtml = `
${RV_CONVERSATION}
` rvMessengerHeader.insertAdjacentHTML('afterend', chatConversationHtml); RV_MSG_BODY_HEIGHT_DEV = widgetContentFrameDEV.body.querySelector('#rvMessengerHeight'); RV_MSG_BODY_DEV = widgetContentFrameDEV.body.querySelector('.rvConversationMessage'); var slideHtml = ` ` var galleryOuterContainers = widgetContentFrameDEV.getElementsByClassName('rvecGalleryOuterContainer'); var galleryInnerContainers = widgetContentFrameDEV.getElementsByClassName('rvecGalleryInnerContainer'); if(galleryInnerContainers.length > 0){ for (let galleryIndex = 0; galleryIndex < galleryInnerContainers.length; galleryIndex++) { let galleryInnerContainerObj = galleryInnerContainers[galleryIndex]; let galleryOuterContainerObj = galleryOuterContainers[galleryIndex]; let slides = galleryInnerContainerObj.children; if( slides.length > 0 ){ galleryOuterContainerObj.insertAdjacentHTML('beforeend', slideHtml) } for (let i = 0; i < slides.length; i++) { slides[i].style.display = "none"; } slides[0].style.display = "block"; } } RVBotViewDev.goBackHomeButton(); //RVBotViewDev.sendMessageEvent(); RVBotViewDev.rvResetMsgScroll(); if(openTextWidget){ widgetContentFrameDEV.querySelector('.rvReplyInputBox > textarea').setAttribute('disabled', 'disabled'); widgetContentFrameDEV.querySelector('.rvReplyInputBox .rvMessengerReplyInputUtilsButton').classList.add('disabled'); } if( flag ){ RVBotViewDev.initiateConversation(); } }, sendMessageEvent: function (){ var textArea = widgetContentFrameDEV.body.querySelector('.rvReplyInputBox textarea'); textArea.addEventListener("keydown", function (e) { var rvMsg = this.value; var keyCode = e.keyCode || e.which; if (keyCode == 13) { if (!event.shiftKey) { e.preventDefault(); if (rvMsg) { rvMsg = rvMsg.replace(/\n/g, "
"); var msg = `

` + RV_Customer_Name_DEV +`, ` +RVBotViewDev.rvGetCurrentTime() +`

` +RVBotViewDev.convertMsgHtml(rvMsg) +`
`; RV_CONVERSATION += msg; RVBotViewDev.removeTyping(); RV_MSG_BODY_HEIGHT_DEV.insertAdjacentHTML("beforebegin", msg); RVBotViewDev.rvSendMessage(this.value, "", "user"); RVBotViewDev.rvResetMsgScroll(); textArea.value = ""; if( msgRead_DEV ){ RVBotViewDev.rvEcUserNotify(); } } return false; } } }); textArea.addEventListener("keyup", function (e) { var rvMsg = this.value; if (rvMsg) { widgetContentFrameDEV.querySelector(".rvMessengerReplyInputUtilsButton").classList.add("active"); if (Visitor_Chat_Id_DEV === "") { socketDEV.emit("user_typing", { Conversation_Id: Conversation_Id, Visitor_Chat_Id: Visitor_Chat_Id_DEV, Website_Id: Website_Id_DEV, type: "typing", typing: true, }); } RVBotViewDev.rvActiveButtonCall(); } else { var rvBtnActive = widgetContentFrameDEV.querySelector(".rvMessengerReplyInputUtilsButton.active"); rvBtnActive.removeEventListener("click", RVBotViewDev.sendMsgBtnClick); widgetContentFrameDEV.querySelector(".rvMessengerReplyInputUtilsButton").classList.remove("active"); } }); }, rvActiveButtonCall: function() { var rvBtnActive = widgetContentFrameDEV.querySelector(".rvMessengerReplyInputUtilsButton.active"); rvBtnActive.addEventListener("click", RVBotViewDev.sendMsgBtnClick); }, sendMsgBtnClick: function(){ var msg = widgetContentFrameDEV.body.querySelector('.rvReplyInputBox textarea').value; if (RV_Customer_Name_DEV === null) { name = "me"; } if (msg) { msg = msg.replace(/\n/g, "
"); var msg1 = `

` + name + `, ` + RVBotViewDev.rvGetCurrentTime() +`

` + RVBotViewDev.convertMsgHtml(msg) +`
`; RV_CONVERSATION += msg1; RVBotViewDev.removeTyping(); RV_MSG_BODY_HEIGHT_DEV.insertAdjacentHTML("beforebegin", msg1); widgetContentFrameDEV.body.querySelector('.rvReplyInputBox textarea').value = ""; RVBotViewDev.rvSendMessage(msg, "", "user"); RVBotViewDev.rvResetMsgScroll(); this.classList.remove("active"); if( msgRead_DEV ){ RVBotViewDev.rvEcUserNotify(); } } }, goBackHomeButton: function (){ var homeButton = widgetContentFrameDEV.body.querySelector('.rvGoBackHome'); homeButton.addEventListener("click", RVBotViewDev.goBackHomeButtonClicked); }, goBackHomeButtonClicked: function(){ RV_ARTICLE_TYPE = ""; var widgetHeader = widgetContentFrameDEV.body.querySelector('.rvMessengerHeader > div'); widgetHeader.innerHTML = RV_HOME_HEADER; var rvMessengerHeader = widgetContentFrameDEV.body.querySelector('.rvMessengerHeader'); rvMessengerHeader.insertAdjacentHTML('afterend', RV_HOME_CONTENT); RVBotViewDev.rvDisplayLastMsg(); widgetContentFrameDEV.body.querySelector('.rvMessengerHeader').style.height = "275px"; if( widgetContentFrameDEV.body.querySelector('.rvConversationMessage') ){ widgetContentFrameDEV.body.querySelector('.rvConversationMessage').remove(); } if( widgetContentFrameDEV.body.querySelector('.rvReplyInputBox') ){ widgetContentFrameDEV.body.querySelector('.rvReplyInputBox').remove(); } if( widgetContentFrameDEV.body.querySelector('.rvInnerPageWrap') ){ widgetContentFrameDEV.body.querySelector('.rvInnerPageWrap').remove(); } RVBotViewDev.homeScreenFunction(); RV_MSG_BODY_HEIGHT_DEV = ""; RV_MSG_BODY_DEV = ""; collectionBreadCrumb = {}; RV_ORDER_BREADCRUMBS = {}; }, rvLoadWidgetHTML: function( setting, botsetting_DEV){ if (navigator.userAgent.toLowerCase().indexOf('firefox') === -1) { // DOM widgetContentFrameDEV = widgetFrameDEV.contentDocument; toggleContentFrameDEV = chatToggleFrameDEV.contentDocument; triggerContentFrameDEV = triggerFrameDEV.contentDocument; }else { // IE win widgetContentFrameDEV = widgetFrameDEV.contentWindow.document; toggleContentFrameDEV = chatToggleFrameDEV.contentWindow.document; triggerContentFrameDEV = triggerFrameDEV.contentWindow.document; } var toggleFrameStyle = document.createElement("style"); toggleFrameStyle.innerText = RVBotViewDev.chatToggleCssFile(); toggleContentFrameDEV.head.appendChild(toggleFrameStyle); var chatToggleHtml = `
`; toggleContentFrameDEV.body.insertAdjacentHTML("beforeend", chatToggleHtml); chatToggleFrameDEV.style.display="block"; var widgetFrameStyle = document.createElement("style"); widgetFrameStyle.innerText = RVBotViewDev.widgetCssFile(); // var widgetFontAwesome = document.createElement("link"); // widgetFontAwesome.rel = "stylesheet"; // widgetFontAwesome.href = "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css"; // widgetFontAwesome.crossorigin = "anonymous"; // widgetFontAwesome.integrity = "sha512-9usAa10IRO0HhonpyAIVpjrylPvoDwiPUiKdWk5t3PyolY1cOd4DSE0Ga+ri4AuTroPR5aQvXU9xC6qOPnzFeg=="; // widgetFontAwesome.referrerpolicy = "no-referrer"; widgetContentFrameDEV.head.appendChild(widgetFrameStyle); widgetContentFrameDEV.head.insertAdjacentHTML("beforeend", ''); let welcomeTitle = botsetting_DEV.Welcome_Title let replaceText = botsetting_DEV.Welcome_Title_Fallback ? botsetting_DEV.Welcome_Title_Fallback : "There"; if( botsetting_DEV.Welcome_Title && botsetting_DEV.Welcome_Title.indexOf("$firstName") !== -1 ){ if( RV_Customer_Name_DEV !== "me" ){ welcomeTitle = botsetting_DEV.Welcome_Title.replace(new RegExp('\\$firstName', 'g'), RV_Customer_Name_DEV); }else{ welcomeTitle = botsetting_DEV.Welcome_Title.replace(new RegExp('\\$firstName', 'g'), replaceText); } } if( botsetting_DEV.Welcome_Title && botsetting_DEV.Welcome_Title.indexOf("$lastName") !== -1 ){ if( RV_Customer_Name_DEV !== "me" ){ welcomeTitle = botsetting_DEV.Welcome_Title.replace(new RegExp('\\$lastName', 'g'), RV_Customer_Name_DEV); }else{ welcomeTitle = botsetting_DEV.Welcome_Title.replace(new RegExp('\\$lastName', 'g'), replaceText); } } if( botsetting_DEV.Welcome_Title && botsetting_DEV.Welcome_Title.indexOf("$name") !== -1 ){ if( RV_Customer_Name_DEV !== "me" ){ welcomeTitle = botsetting_DEV.Welcome_Title.replace(new RegExp('\\$name', 'g'), RV_Customer_Name_DEV); }else{ welcomeTitle = botsetting_DEV.Welcome_Title.replace(new RegExp('\\$name', 'g'), replaceText); } } if( botsetting_DEV.Welcome_Title && botsetting_DEV.Welcome_Title.indexOf("$email") !== -1 ){ if( RV_Customer_Email_DEV !== "" ){ welcomeTitle = botsetting_DEV.Welcome_Title.replace(new RegExp('\\$email', 'g'), RV_Customer_Email_DEV); }else{ welcomeTitle = botsetting_DEV.Welcome_Title.replace(new RegExp('\\$email', 'g'), replaceText); } } let quickLinksHtml = "", quickLinkWholeHtml = ""; if( RV_ORDER_STATUS ){ quickLinksHtml += `
Your recent orders
Track and manage your orders
` } if( botsetting_DEV.Faq_Article ){ quickLinksHtml += `
Product FAQs
Browse our FAQs
` } if( botsetting_DEV.Other_Article ){ quickLinksHtml += `
Select another topic
` } if( quickLinksHtml !== "" ){ quickLinkWholeHtml = `
Quick Links
${quickLinksHtml}
` } let timeText = "Back in"; let timeValue = RVBotViewDev.getNextAvailableTime(); if( RVAgentOption ){ timeText = "Team will reply"; timeValue = "As soon as possible"; } let i = 0; for (const [key, value] of Object.entries(AgentDetails_DEV)) { if( i === 3 ){ break; } i++; let initials = ""; if( value.firstName ){ initials = value.firstName.substring(0,1).toUpperCase(); } if( value.lastName ){ initials += value.lastName.substring(0,1).toUpperCase(); } agentInformationHtml += `
${initials}
`; } RV_HOME_HEADER = `
${botsetting_DEV.Agent_Bot_Name} Logo
${welcomeTitle}
${botsetting_DEV.Welcome_Description}
${agentInformationHtml}
${timeText}
${timeValue}
` RV_HOME_CONTENT = `
Start a conversation
${quickLinkWholeHtml}
` var chatWidgetHtml = `
${RV_HOME_HEADER}
${RV_HOME_CONTENT}
` widgetContentFrameDEV.body.insertAdjacentHTML("beforeend", chatWidgetHtml); var triggerFrameStyle = document.createElement("style"); triggerFrameStyle.innerText = RVBotViewDev.triggerMsgCss(); triggerFrameDEV.contentWindow.document.head.appendChild(triggerFrameStyle); var notificationFrameStyle = document.createElement("style"); notificationFrameStyle.innerText = RVBotViewDev.notificationCssFile(); notificationContentFrameDEV.head.appendChild(notificationFrameStyle); var notificationWidgetHtml = `
0
`; notificationContentFrameDEV.body.insertAdjacentHTML("beforeend", notificationWidgetHtml); }, play: function(){ var audio = widgetContentFrameDEV.getElementById("audio"); audio.play(); }, overAllCssFile: function() { // Your CSS as text var styles = ` .rvecIframeBot { border: none; } #rvecChatToggleFrame{ position:fixed; bottom:30px; font-size:14px; line-height:1.5; z-index: 999999999999; width: 60px; height: 60px; overflow:hidden; right: 30px; box-shadow: 0 0 40px rgb(0 0 0 / 10%); border-radius: 50%; } #rvecChatWidgetFrame{ // position:fixed; // bottom:90px; // right:30px; // max-width:390px; // width:100%; // display:none; // -webkit-animation:ptwchatbox_anim .3s; // -moz-animation:ptwchatbox_anim .3s; // animation:ptwchatbox_anim .3s; // z-index: 999999999999; // box-shadow: 0 0 40px rgb(0 0 0 / 10%); } #rvecNotificationFrame{ position:fixed; bottom: 60px; right: 30px; width:20px; height:20px; display:none; z-index: 99999999999999999999999; } @-webkit-keyframes ptwchatbox_anim{ 0%{-webkit-transform:translateY(10px);opacity:0} 100%{-webkit-transform:translateY(0);opacity:1} } @-moz-keyframes ptwchatbox_anim{ 0%{-moz-transform:translateY(10px);opacity:0} 100%{-moz-transform:translateY(0);opacity:1} } @keyframes ptwchatbox_anim{ 0%{transform:translateY(10px);opacity:0} 100%{transform:translateY(0);opacity:1} } #rvecChatTriggerFrame { position: fixed; z-index: 99999999; bottom: 90px; right: 30px; width: 290px; } @media(max-width:430px){ #rvecChatWidgetFrame{ right: 0; } } #RVWidgetFrame{ z-index: 2147483000; position: fixed; bottom: 100px; right: 20px; height: calc(100% - 120px); width: 376px; min-height: 250px; max-height: 704px; box-shadow: rgba(0, 0, 0, 0.16) 0px 5px 40px; opacity: 1; border-radius: 8px; overflow: hidden; transition: width 200ms ease 0s, height ease 0s, max-height ease 0s; display:none; } #RVWidgetFrame > iframe{ width: 100%; height: 100%; position: absolute; } `; return styles; }, chatToggleCssFile: function(){ var styles = ` @charset "UTF-8";@import url(https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap); body{ margin: 0; font-family: Poppins,sans-serif; font-size: 14px; line-height: 1.5; } .ptw_chat_toggle{ z-index: 1; width:60px; height:60px; border-radius:60px; background-color:#2f26d0; // box-shadow: 0 0 40px rgb(0 0 0 / 10%); color:#fff; display:flex; align-items:center; justify-content:center; font-size:16px; position:relative; cursor:pointer; -webkit-animation:ptwchattoggle_anim .3s; -moz-animation:ptwchattoggle_anim .3s; animation:ptwchattoggle_anim .3s; } @-webkit-keyframes ptwchattoggle_anim{ 0%{-webkit-transform:scale(.5);opacity:0} 100%{-webkit-transform:scale(1);opacity:1} } @-moz-keyframes ptwchattoggle_anim{ 0%{-moz-transform:scale(.5);opacity:0} 100%{-moz-transform:scale(1);opacity:1} } @keyframes ptwchattoggle_anim{ 0%{transform:scale(.5);opacity:0} 100%{transform:scale(1);opacity:1} } .ptw_chat_toggle>span{ display:none } .ptw_chat_toggle>.ptw_chat_bubble_arrow{ content:""; position:absolute; top:60%; right:75%; display:block; border-top:20px solid transparent; border-bottom:0 solid transparent; border-right:20px solid #2f26d0; -webkit-transform:rotate(-25deg); -moz-transform:rotate(-25deg); transform:rotate(-25deg) } ` return styles; }, notificationCssFile: function(){ var styles = ` .new-message.active { animation: 0.82s cubic-bezier(0.36, 0.07, 0.19, 0.97) 0s 1 normal both running shake; } .new-message { font-size: 12px; background: rgb(247, 46, 56); z-index: 2; line-height: 1; } .new-message, #dnd-indicator { position: absolute; top: 0; font-weight: 700; color: rgb(255, 255, 255); right: 0; pointer-events: none; border-radius: 10px; display: flex; -webkit-box-pack: center; justify-content: center; -webkit-box-align: center; align-items: center; width: 20px; height: 20px; } ` return styles; }, widgetCssFile: function(){ var styles = ` @charset "UTF-8";@import url(https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap); body{ margin:0; font-family: Poppins,sans-serif; font-size: 14px; line-height: 1.5; overflow: hidden; display: block; margin: 8px; } select { -webkit-appearance: none; -moz-appearance: none; appearance: none; background-color: transparent; border: none; padding: 4px 1em 4px 0; margin: 0; width: 100%; font-family: inherit; font-size: 14px; cursor: inherit; line-height: inherit; z-index: 1; outline: none; } select::-ms-expand { display: none; } .select { display: grid; grid-template-areas: "select"; align-items: center; position: relative; min-width: 15ch; max-width: 30ch; border: 1px solid #777; border-radius: 0.25em; padding: 0.25em 0.5em; font-size: 1.25rem; cursor: pointer; line-height: 1.1; background-color: #fff; background-image: linear-gradient(to top, #f9f9f9, #fff 33%); } .select select, .select::after { grid-area: select; } .select:not(.select--multiple)::after { content: ""; justify-self: end; width: 0.8em; height: 0.5em; background-color: #777; -webkit-clip-path: polygon(100% 0%, 0 0%, 50% 100%); clip-path: polygon(100% 0%, 0 0%, 50% 100%); } select:focus + .focus { position: absolute; top: -1px; left: -1px; right: -1px; bottom: -1px; border: 2px solid blue; border-radius: inherit; } select[multiple] { padding-right: 0; height: 6rem; } select[multiple] option { white-space: normal; outline-color: blue; } .select--disabled { cursor: not-allowed; background-color: #eee; background-image: linear-gradient(to top, #ddd, #eee 33%); } .rvMessenger{ display: flex; flex-direction: column; -webkit-box-pack: start; justify-content: flex-start; position: absolute; inset: 0px; overflow: hidden; background-color: #fff; } .rvMsgHead{ position: relative; color: white; transition: height 160ms ease-out 0s; background-image: linear-gradient(135deg,hsla(0,0%,100%,0),rgba(0,0,0,.32)); height: 295px; background-color: ${botsetting_DEV.Bot_Agent_Background_Color} } .rvMsgHeaderView{ position: absolute; top: 0px; left: 0px; right: 0px; padding: 24px 40px 87px; box-sizing: border-box; transition: transform 0.3s ease-out 0s, opacity 0.3s ease-out 0s; transform: scale(1); } .rvMsgHeaderOpacity{ transform: translateY(0px); opacity: 1; } .rvMsgImgWrap{ height:32px; /*padding-bottom:16px;*/ } .rvMsgImgWrap img{ max-width: 100%; max-height: 100%; margin: auto 0px; display: block; } .rvMsgContWrap .title{ font-size: 32px; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; } .rvMsgContWrap .paraContent{ color: rgba(255, 255, 255, 0.7); display: block; font-size: 1em; line-height: 1.5em; overflow-wrap: break-word; white-space: pre-line; } .rvHomeScreenWrap{ position: relative; flex: 1 1 0%; background-color: white; box-shadow: rgb(0 0 0 / 20%) 0px 21px 4px -20px inset; } .rvConversationMessage{ padding: 20px; background-color: #fff; height: calc(100% - 218px); overflow: scroll; } .rvHomeScreen{ z-index: 2147483002; position: fixed; inset: 0px; overflow-y: auto; padding-top:251px; } .rvHomeScreenInnerWrap{ display: flex; flex-direction: column; box-sizing: border-box; padding: 0px 16px 55px; min-height: 100%; } .rvTransition{ transition: transform 0.3s ease-out 0s, opacity 0.3s ease-out 0s; transform: scale(1); } .rvHomeScreenCard{ max-width: 100%; margin-bottom: 17px; background-color: rgb(255, 255, 255); border-radius: 3px; font-size: 14px; line-height: 1.4; color: rgb(0, 0, 0); overflow: hidden; position: relative; box-shadow: ${botsetting_DEV.boxShadow}; } .rv-5qt81h { /*height: 139.781px;*/ transition: height 250ms ease 0s; } .rv-s0sg41 { padding: 26px 24px 16px; } .rv-vmab6f { margin-bottom: 4px; } .rv-66oquk { line-height: 1.5; word-break: break-word; font-size: 16px; font-weight: 600; text-align: left; margin-bottom: 0px; } .rv-aga1a1 { display: flex; flex-flow: row nowrap; -webkit-box-align: center; align-items: center; align-content: stretch; position: relative; outline-offset: -5px; padding: 16px 24px; margin: 0px -24px; } .rv-aga1a1::before { /*content: ""; position: absolute; height: 100%; left: 0px; right: 0px; top: 0px; border-top: 2px solid transparent;*/ } .rv-aga1a1 * { cursor: pointer; } .rv-qh16t7 { flex: 0 0 auto; left: 15px; } .rv-7nfnba { margin: 0px auto; border-radius: 50%; display: inline-block; vertical-align: middle; cursor: default; width: 36px; height: 36px; line-height: 36px; font-size: 18px; } .rv-7nfnba img { width: 36px; height: 36px; border-radius: 50%; } .rv-7sdh8r { flex: 1 1 0%; padding-left: 16px; padding-right: 8px; min-width: 0px; } .rv-15r69cz { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: rgb(115, 115, 118); margin-bottom: 0px; } .rv-15fzge { margin-left: 4px; } .rv-1esx35 { color: rgb(58, 60, 76); font-size: 13px; display: flex; } .rv-1fvrbgz { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: rgb(0, 0, 0); } .rv-ea67jx { transform: rotate(180deg); } .rv-6a43gu { margin: 0px auto; width: 9px; height: 15px; } .rvFlex{ display: -webkit-box; display: -ms-flexbox; display: flex; -webkit-box-align: center; -ms-flex-align: center; align-items: center; } .rvAgentsInformation{ padding: 6px 10px; border-radius: 12px; background-color: hsla(0,0%,100%,.08); -webkit-box-pack: center; -ms-flex-pack: center; justify-content: center; margin-top: 32px; margin-bottom: 15px; } .rvAgentsPictures{ text-align: center; display: -webkit-box; display: -ms-flexbox; display: flex; -webkit-box-pack: start; -ms-flex-pack: start; justify-content: flex-start; margin: 0; } .rvAgentPicture, .rvAgentsInformation .rvAgentsPictures .rvAgentPicture { display: inline-block; margin-left: -8px; vertical-align: middle; position: relative; } .rvAgentsInformation .rvAgentsPictures .rvAgentPicture:first-child{ margin-left: 0; } .settingWidth{ max-width: 280px; text-align: left; justify-content: start; } .rvInitialsAvatar{ color: #fff; text-align: center; line-height: 24px; position: relative; width: 24px; height: 24px; border-radius: 24px; display: -webkit-box; display: -ms-flexbox; display: flex; -ms-flex-negative: 0; flex-shrink: 0; -webkit-box-pack: center; -ms-flex-pack: center; justify-content: center; -webkit-box-align: center; -ms-flex-align: center; align-items: center; font-weight: 600; font-size:9px; } .rvAgentPicture:first-child .rvInitialsAvatar, .rvAgentsInformation .rvAgentsPictures .rvAgentPicture:first-child .rvInitialsAvatar{ background-color: rgb(128, 78, 158); border: 1px solid rgb(255, 255, 255); } .rvAgentsInformation .rvAgentsPictures .rvAgentPicture:nth-child(2) .rvInitialsAvatar{ background-color: rgb(48, 96, 99); border: 1px solid rgb(255, 255, 255); } .rvAgentsInformation .rvAgentsPictures .rvAgentPicture:nth-child(3) .rvInitialsAvatar{ background-color: rgb(147, 106, 37); border: 1px solid rgb(255, 255, 255); } .rv-ea67jx svg > g > g { fill: ${botsetting_DEV.Bot_Agent_Button_Color}; } .rvOfflineMessage{ margin-left: 14px; font-size: 14px; font-weight: 400; max-width: 100%; color: #666; text-align: left; line-height: 1; overflow: hidden; color: #fff; } .rvOfflineMessage overflow-elipses{ overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; } .replyTimeIndicator{ font-weight: 600; color: #fff; display: -webkit-box; display: -ms-flexbox; display: flex; -webkit-box-align: center; -ms-flex-align: center; align-items: center; } .replyTimeIndicatorText{ padding-left:4px; } .replyTimeIndicator .clockIcon{ height: 14px; } .replyTimeIndicator .clockIcon svg{ min-height: 14px; min-width: 14px; margin-left: 6px; } .rvMessengerHome ::-webkit-scrollbar{width:6px;height:6px} .rvMessengerHome ::-webkit-scrollbar-track{background-color:#fff;border-radius:10px} .rvMessengerHome ::-webkit-scrollbar-thumb{background-color:${botsetting_DEV.Bot_Agent_Background_Color};border-radius:10px} .rvMessengerHome *{scrollbar-color:${botsetting_DEV.Bot_Agent_Background_Color} #f1f1f1;scrollbar-width:thin} .rvBtnFullWidth{ padding: 0.95rem 1rem; width: 100%; max-width: 327px; color: ${botsetting_DEV.Bot_Agent_Button_Text_Color}; border: 1px solid ${botsetting_DEV.Bot_Agent_Button_Color}; background-color: ${botsetting_DEV.Bot_Agent_Button_Color}; border-radius: 8px; font-size: 14px; font-weight: 600; cursor:pointer; } .rvFooterWidget{ z-index: 2147483002; position: absolute; bottom: 0px; left: 0px; right: 0px; } .rvFooterWidget .e1zvd8h1 { position: absolute; opacity: 0.97; width: 100%; bottom: 0px; display: flex; align-items: flex-end; -webkit-box-pack: center; justify-content: center; margin: 0px; padding: 5px 0px; background-color: rgb(255, 255, 255); box-shadow: rgb(0 0 0 / 4%) 0px 0px 0px 1px; } .rvFooterWidget .e1zvd8h1 .e1zvd8h3 { display: flex; width: 100%; -webkit-box-pack: center; justify-content: center; } .rv-52kfez { display: inline-block; font-size: 13px; padding: 8px 16px; border-radius: 16px; transition: all 80ms ease 0s; color: rgb(119, 118, 120) !important; text-decoration:none; letter-spacing: -0.6px; } .rv-52kfez svg { width: 16px; height: 16px; color: rgb(119, 118, 120); vertical-align: sub; padding-right: 8px; } .rv-edahy21{ padding: 0 20px; cursor: pointer; } .rvJustifyContentSpaceBetween{ -webkit-box-pack: justify; -ms-flex-pack: justify; justify-content: space-between; } .rvAlignItemsCenter{ -webkit-box-align: center; -ms-flex-align: center; align-items: center; } .rvAlignItemsStart{ -webkit-box-align: start; -ms-flex-align: flex-start; align-items: flex-start; } .qLinkImgWrap{ height: 40px; width: 40px; background-color: rgba(0,0,0,.03); border-radius: 50%; margin-right: 16px; } .qLinkImgWrap svg{ height: 24px; width: 24px; } .qLinkContWrap .qLinkContTitle{ font-size: 14px; font-weight: 500; line-height: 1.43; color: #000; } .qLinkContWrap .qLinkContSubTitle{ font-size: 13px; line-height: 1.54; color: #6d7175; font-weight: 400; } .rvJustifyContentCenter{ -webkit-box-pack: center; -ms-flex-pack: center; justify-content: center; } .rv-awfege .edyhj2e0{ padding-bottom:20px; } .paddingTopBottom20{ padding: 20px 0; } .rv-edahy21:not(:last-child) .borderBottom{ border-bottom: 1px solid #e5e5e5; } .rvConversationHeader { padding: 15px 20px; } .rvGoBackHome { padding: 0 10px; margin-right: 10px; cursor: pointer; } .rvConversationHeader .rvAgentsInformation { margin: 0; background-color: transparent; } .rvMb1{ margin-bottom: 6px; } .rvBotName{ font-size: 16px; } .rvConversationHeader .replyTimeIndicator .clockIcon svg{ margin-left: 0; margin-right: 6px; } .rvConversationHeader .replyTimeIndicator{ font-size: 14px; font-weight: 400; } .rvConvMsg{ margin-bottom:15px; -webkit-animation:rvMsgAnim .3s; -moz-animation:rvMsgAnim .3s; animation:rvMsgAnim .3s; -webkit-animation-fill-mode:forwards; -moz-animation-fill-mode:forwards; animation-fill-mode:forwards } @-webkit-keyframes rvMsgAnim{ 0%{-webkit-transform:translateY(10px);opacity:0} 100%{-webkit-transform:translateY(0);opacity:1} } @-moz-keyframes rvMsgAnim{ 0%{-moz-transform:translateY(10px);opacity:0} 100%{-moz-transform:translateY(0);opacity:1} } @keyframes rvMsgAnim{ 0%{transform:translateY(10px);opacity:0} 100%{transform:translateY(0);opacity:1} } .rvConvMsg>.rvConvMsgInner>.rvConvMsgText{ background-color:#f1f1f1; color:#222; padding:10px 12px; border-radius:10px 10px 10px 0; font-size:13px; margin:0; word-break:break-word; max-width: 70%; display: inline-block; } .rvConvMsg>.rvConvMsgInner>.rvConvMsgText a{ color:inherit; text-decoration:underline; } .rvConvMsg.rvMsgRight>.rvConvMsgInner>.rvConvMsgText a{ color:#fff; text-decoration:underline } .rvConvMsg>.rvConvMsgInner>.rvConvMsgTime{ font-size:11px; margin:0; margin-bottom:2px; // max-width: 70%; // display: inline-block; } .rvConvMsg.rvMsgRight{ text-align:right } .rvConvMsg.rvMsgRight>.rvConvMsgInner>.rvConvMsgText{ background-color:#2f26d0; color:#fff; border-radius:10px 10px 0 10px; margin:0; display:inline-block; text-align:left } .rvConvMsg.rvMsgRight>.rvConvMsgInner>.rvConvMsgTime{ padding-right:5px } .rvReplyInputBox { position: absolute; bottom: 46px; left: 0; right: 0; min-height: 53px; max-height: 200px; border-top: 1px solid #e6e6e6; z-index: 1; } .rvReplyInputBox textarea{ width: 100%; height: 100%; line-height: 1.33; background: #fff; white-space: pre-wrap; word-wrap: break-word; font-size: 14px; font-weight: 400; -webkit-transition: -webkit-box-shadow .2s; transition: -webkit-box-shadow .2s; transition: box-shadow .2s; transition: box-shadow .2s,-webkit-box-shadow .2s; color: #000; padding: 17px 40px 17px 15px; letter-spacing: normal; position: absolute; bottom: 0; left: 0; font-family: Poppins,sans-serif; } .rvMessengerReplyInputUtils { display: -webkit-box; display: -ms-flexbox; display: flex; -webkit-box-pack: center; -ms-flex-pack: center; justify-content: center; -webkit-box-align: center; -ms-flex-align: center; align-items: center; position: absolute; top: 50%; -webkit-transform: translateY(-50%); transform: translateY(-50%); right: 10px; top: 29px; } .rvMessengerReplyInputUtilsButton { height: 30px; width: 30px; display: block; cursor: pointer; margin: 0 4px; background: transparent; } .rvReplyInputBox button, .rvReplyInputBox textarea { border: none; outline: none; } .rve_dg_btn_Wrapper{ flex-wrap: wrap; overflow: auto; font-size: 14px; transform: translateY(10px); will-change: transform; } .rve_buttonGroup button, .rve_dg_btn_Wrapper button, .rve_dg_btn_Wrapper .rve_outter_btn_options, .rve_dg_btn_Wrapper .rve_dg_btn_options{ -webkit-box-align: center; align-items: center; padding: 10px 20px; max-width: 235px; text-align: left; cursor: pointer; margin-bottom: 5px; margin-top: 5px; background-color: rgb(237, 240, 247); border: 1px solid ${botsetting_DEV.Bot_Agent_Button_Color}; border-radius: 8px; color: rgba(61, 78, 99, 0.8); display: inline-block; margin-right: 10px; transition: background 0.2s ease 0s; font-size: 15px; } .rve_buttonGroup button{ width:100%; margin: 0 0 15px; max-width: 100%; padding: 8px 20px; border-radius: 5px; } .rve_buttonGroup.rve_mb20 button{ margin-bottom: 20px; } .rve_buttonGroup button:lastchild{ margin-bottom:0; } .rve_buttonGroup button:hover, .rve_dg_btn_Wrapper button:hover, .rve_dg_btn_Wrapper .rve_dg_btn_options:hover{ color: rgb(255, 255, 255); background-color: ${botsetting_DEV.Bot_Agent_Button_Color}; } .rve_trigger {margin-top: 20px;} rve_dg_btn_Wrapper button, .rve_dg_btn_Wrapper .rve_outter_btn_options, .rve_dg_btn_Wrapper .rve_dg_btn_options{ -webkit-box-align: center; align-items: center; padding: 10px 20px; max-width: 235px; text-align: left; cursor: pointer; margin-bottom: 5px; margin-top: 5px; background-color: rgb(237, 240, 247); border: 1px solid ${botsetting_DEV.Bot_Agent_Button_Color}; border-radius: 8px; color: rgba(61, 78, 99, 0.8); display: inline-block; margin-right: 10px; transition: background 0.2s ease 0s; font-size: 15px; } .rve_dg_btn_Wrapper button:hover, .rve_dg_btn_Wrapper .rve_dg_btn_options:hover{ color: rgb(255, 255, 255); background-color: ${botsetting_DEV.Bot_Agent_Button_Color}; } .typing-indicator { /*background-color: #e6e7ed;*/ will-change: transform; width: auto; border-radius: 50px; padding: 20px; display: inline-block; margin: 0 auto; position: relative; animation: 2s bulge infinite ease-out; } .typing-indicator::before, .typing-indicator::after { content: ''; position: absolute; bottom: -2px; left: -2px; height: 20px; width: 20px; border-radius: 50%; /*background-color: #e6e7ed;*/ } .typing-indicator::after { height: 10px; width: 10px; left: -10px; bottom: -10px; } .typing-indicator span { height: 8px; width: 8px; float: left; margin: 0 1px; background-color: #9e9ea1; display: block; border-radius: 50%; opacity: 0.4; } .typing-indicator span:nth-of-type(1) { animation: 1s blink infinite 0.3333s; } .typing-indicator span:nth-of-type(2) { animation: 1s blink infinite 0.6666s; } .typing-indicator span:nth-of-type(3) { animation: 1s blink infinite 0.9999s; } @keyframes blink { 50% { opacity: 1; } } @keyframes bulge { 50% { transform: scale(1.05); } } .rvMsgContainer>.rvConvMsg>.rvConvMsgInner .rvecImageWrapper { padding: 12px 12px; background-color: #f1f1f1; border-radius:15px; display:inline-block; } .rvMsgContainer>.rvConvMsg>.rvConvMsgInner .rvecImageWrapper img{ border-top-left-radius:15px; border-top-right-radius:15px; max-width:100%; max-height:180px } .rvMsgContainer>.rvConvMsg>.rvConvMsgInner .rvecImageWrapper .rvecImgContTitle{ font-size: 17px; margin-bottom:10px; margin-top:10px; font-weight: bold; line-height:1.2; } .rvMsgContainer>.rvConvMsg>.rvConvMsgInner .rvecImageWrapper .rvecImgContSubTitle a, .rvMsgContainer>.rvConvMsg>.rvConvMsgInner .rvecImageWrapper .rvecImgContTitle a{ text-decoration: none; color:inherit; } .rvecImageWrapper .rvecImgContSubTitle{ font-size: 14px; margin: 0; } .rvecGalleryInnerContainer { max-width: 1000px; position: relative; margin: auto; } .rvecGalleryInnerContainer > div { display: none; } /* Fading animation */ .fade { -webkit-animation-name: fade; -webkit-animation-duration: 1.5s; animation-name: fade; animation-duration: 1.5s; } @-webkit-keyframes fade { from {opacity: .4} to {opacity: 1} } @keyframes fade { from {opacity: .4} to {opacity: 1} } /* Next & previous buttons */ .rvecGalleryOuterContainer .rvecgalleryprev, .rvecGalleryOuterContainer .rvecgallerynext { cursor: pointer; position: absolute; top: 50%; margin-top: -22px; color: #000; font-weight: bold; font-size: 18px; transition: 0.6s ease; border-radius: 0 3px 3px 0; user-select: none; background-color: rgb(255, 255, 255); box-shadow: rgb(40 44 53 / 6%) 0px 4px 15px 0px, rgb(40 44 53 / 8%) 0px 2px 2px 0px; border-radius: 50%; width: 40px; height: 40px; text-align: center; line-height: 40px; } .rvMsgContainer>.rvConvMsg>.rvConvMsgInner .rvecImageWrapper, .rvMsgContainer>.rvConvMsg>.rvConvMsgInner .rvecGalleryOuterContainer .rvecImageWrapper{ display: inline-block; width: 280px; } .rvMsgContainer>.rvConvMsg>.rvConvMsgInner .rvecGalleryOuterContainer .rvecImageWrapper{ display: block; margin: 0 auto; } .rvMsgContainer>.rvConvMsg>.rvConvMsgInner .rvecImageWrapper img{ border-radius: 5px; } .rvMsgContainer>.rvConvMsg>.rvConvMsgInner .rvecImageWrapper .rvecImageInnerWrap{ text-align:center; } /* Position the "next button" to the right */ .rvecGalleryOuterContainer .rvecgallerynext { right: 0; // border-radius: 3px 0 0 3px; } /* On hover, add a black background color with a little bit see-through */ .rvecGalleryOuterContainer .rvecgalleryprev:hover, .rvecGalleryOuterContainer .rvecgallerynext:hover { // background-color: rgba(0,0,0,0.8); } .rvMsgContainer .rvecGalleryOuterContainer .ptw_right { text-align: right; } .rvForm { padding: 1.5rem; background: #fff; border: 1px solid #ccc; border-top: 2px solid ${botsetting_DEV.Bot_Agent_Background_Color}; border-radius: 5px; max-width: 250px; margin-left: auto; text-align: left; } .rvFormWrapper { font-size: 13px; color: #4d4d4d; } .rvForm .rvFormField label { margin-bottom: 8px; font-size: 14px; font-weight: 400; } .rvForm .rvFormField .form-group { margin-top: 0.75rem; margin-bottom: 0.75rem; } .rvForm .rvFormField .form-control { border-color: #b3b3b3; color: #333; padding: 10px 15px; height: 50px; line-height: 50px; box-shadow: none; border-width: 1px; -webkit-appearance: none; background-color: #fff; background-image: none; border-radius: 4px; border: 1px solid #dcdfe6; -webkit-box-sizing: border-box; box-sizing: border-box; color: #606266; display: inline-block; font-size: inherit; outline: 0; -webkit-transition: border-color .2s cubic-bezier(.645,.045,.355,1); transition: border-color .2s cubic-bezier(.645,.045,.355,1); width: 100%; border-top-right-radius:0; border-bottom-right-radius:0; } .rvForm .rvFormField .form-button { background-color: #f5f7fa; color: #909399; vertical-align: middle; display: table-cell; position: relative; white-space: nowrap; } .rvConvMsgInner .rvForm{ max-width: 100%; } .rvConvMsgInner .rvForm.initialLoader{ max-width: 250px; } .rvForm .rvFormField .form-button button { padding: 12px 12px; height: 50px; border: none; width: 40px; border: 1px solid #dcdfe6; border-radius: 4px; border-top-left-radius: 0; border-bottom-left-radius: 0; cursor: pointer; } .rvForm .rvFormField .form-button button i{ font-size: 20px; color: ${botsetting_DEV.Bot_Agent_Button_Color}; } .rvAccessForm .form-group.form-error, .rvForm .rvFormField .form-input.form-error { position: relative; } .rvAccessForm .form-group.form-error span.form-feedback, .rvForm .rvFormField span.form-feedback { position: absolute; left: 0; right: 0; top: 100%; color: red; font-size: 11px; } .rvAccessForm .form-group.form-error .form-control, .rvForm .rvFormField .form-input.form-error .form-control { border-color: red; } .rvec_activity .rvConvMsgInner { padding: 5px 16px; text-align: center; font-size: 10px; display: inline-block; color: #8898aa !important; } .rvec_activity { text-align: center; } .rvArticleColList:hover, .rv-edahy21:hover{ background-color: ${botsetting_DEV.Bot_Agent_Button_Color}0f; color: ${botsetting_DEV.Bot_Agent_Background_Text_Color}; } .rvInnerPageWrap.rvScrollBehaviour{ overflow: auto; max-height: calc(100% - 103px); } .rvInnerPageWrapper{ -webkit-box-flex: 1; -ms-flex: 1; flex: 1; overflow: auto; overflow-x: hidden; background-color: #fff; } .rvAccessWrap, .rvProductFaqWrap { margin: 20px; width: calc(100% - 40px); height: unset; padding-bottom: 7px; border-radius: 8px; background: #fff; -webkit-box-shadow: ${botsetting_DEV.boxShadow}; box-shadow: ${botsetting_DEV.boxShadow}; } .rvAccessHeader, .rvProductFaqHeader { display: -webkit-box; display: -ms-flexbox; display: flex; -webkit-box-align: start; -ms-flex-align: start; align-items: flex-start; -webkit-box-orient: vertical; -webkit-box-direction: normal; -ms-flex-direction: column; flex-direction: column; font-size: 24px; border-top-left-radius: 8px; border-top-right-radius: 8px; padding: 20px; color: #000; font-weight: 600!important; } .rvAccessForm{ padding: 0 20px 20px; } .rvAccessForm .form-group{ margin-bottom: 20px; } .rvAccessForm .form-group label{ line-height: normal; text-align: left; margin-bottom: 8px; color: rgb(0, 0, 0); display:inline-block; } .rvAccessForm .form-group .input-group input{ border-color: #b3b3b3; color: #333; padding: 10px 15px; height: 40px; line-height: 40px; box-shadow: none; border-width: 1px; -webkit-appearance: none; background-color: #fff; background-image: none; border-radius: 4px; border: 1px solid #dcdfe6; -webkit-box-sizing: border-box; box-sizing: border-box; color: #606266; display: inline-block; font-size: inherit; outline: 0; -webkit-transition: border-color .2s cubic-bezier(.645,.045,.355,1); transition: border-color .2s cubic-bezier(.645,.045,.355,1); width: 100%; } .rvAccessForm .form-button .accessFormSubmit{ width: 100%; max-width: 327px; font-size: 12px; word-spacing: 1px; display: flex; -webkit-box-align: center; align-items: center; -webkit-box-pack: center; justify-content: center; position: relative; cursor: pointer; border-radius: 8px; color: ${botsetting_DEV.Bot_Agent_Button_Text_Color}; border: 1px solid ${botsetting_DEV.Bot_Agent_Button_Color}; background-color: ${botsetting_DEV.Bot_Agent_Button_Color}; padding: 0.95rem 1.5rem; font-size: 14px; } .removeBefore{ cursor: default !important; } .removeBefore:hover{ background-color: transparent !important; } .removeBefore:before{ display:none !important; } .rvArticleColList > div { display: -webkit-box; display: -ms-flexbox; display: flex; -webkit-box-align: center; -ms-flex-align: center; align-items: center; line-height: 15px; padding: 20px 0; color: #000; cursor: pointer; border-bottom: 1px solid #eee; font-size: 22px; font-weight: 500; -webkit-transition: border-bottom-color .3s; transition: border-bottom-color .3s; outline: none; } .rvArticleColList > div span:nth-child(1){ padding: 0 20px; font-size: 16px; font-weight: 500; line-height: 22px; word-break: break-word; color: #000; } .rvArticleColList > div span:nth-child(2){ margin: 0 20px 0 auto; -webkit-transition: -webkit-transform .3s; transition: -webkit-transform .3s; transition: transform .3s; transition: transform .3s,-webkit-transform .3s; font-weight: 500; color: #4d4d4d; font-size: 16px; } .rvArticleColList > div span:nth-child(2) i{ color: ${botsetting_DEV.Bot_Agent_Button_Color}; } .rvProductFaqWrap > div:last-child > div{ border-bottom: none; } .breadCrumbHtml:before, .rvArticleColList:before { content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0; } .rvArticleColList { position: relative; cursor: pointer; } .breadCrumbHtml { font-size: 14px; font-weight: 500; background-color: rgba(255, 255, 255, 0.12); border-radius: 6px; padding: 6px 16px 6px 6px; cursor: pointer; max-width: 100%; position: relative; } .breadCrumbHtml .backText { text-overflow: ellipsis; overflow: hidden; white-space: nowrap; margin-left: 5px; } .productFaqDescription{ font-size: 17px; color: #000; word-break: break-word; font-weight: 400; line-height: 1.4; margin: 1em 0; } .rvArticleColList > div.articleOptionList { border-top: 1px solid #e5e5e5; margin-top: 30px; padding: 20px; display: block; cursor: default; } .rvHelpBottomWrap > button, .rvArticleColList > div.articleOptionList button{ overflow: hidden; text-overflow: ellipsis; white-space: normal; line-height: 22px; display: block; margin-top: 15px; width: 100%; padding: 12px 20px; font-size: 14px; border: none; background-color: ${botsetting_DEV.Bot_Agent_Button_Color}; color: ${botsetting_DEV.Bot_Agent_Button_Text_Color}; border-radius: 8px; font-weight: 500; cursor: pointer; } .rvHelpBottomWrap > button, .rvArticleColList > div.articleOptionList button:last-child{ background-color:transparent; border: 1px solid ${botsetting_DEV.Bot_Agent_Button_Color}; color: ${botsetting_DEV.Bot_Agent_Button_Color}; } .jounerySteps{ margin-right: 8px; } .jounerySteps i{ margin: 0 8px 0 0; font-size: 12px; color: #666; } [data-value] { position: relative; } [data-value]:before { content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0; z-index: 1; } button#accessFormSubmit .rvConvMsg { margin-bottom: 0; } button#accessFormSubmit .rvConvMsg .rvConvMsgInner .typing-indicator { padding: 0; } button#accessFormSubmit .rvConvMsg .rvConvMsgInner .typing-indicator span { background-color: ${botsetting_DEV.Bot_Agent_Button_Text_Color}; } .noOrderMessage { padding: 20px; text-align: center; font-size: 14px; } .rvOrderListInner { padding: 20px; } .rvHelpOrderTopWrap{ padding: 20px; background-color: #f3f3f3; border-top-left-radius:8px; border-top-right-radius:8px; } .rvHelpOrderTopWrap .orderImage{ background-color: transparent; } .rvHelpMiddleWrap { padding: 15px 20px; border-bottom: 1px solid #eee; } .rvHelpHeadTitle { font-size: 21px; font-weight: 600; } .rvHelpDescription{ padding-top:15px; color:#484747; } .noBorderBottom{ border-bottom: none !important; } .rvHelpBottomWrap{ padding: 0 20px 20px; } .rvHelpOptionWrap .rvArticleColList:last-child > div{ border-bottom:none; } .orderImage { width: 40px; height: 40px; background: #e7e4e4; padding: 0px; display: flex; justify-content: center; align-items: center; margin-right: 10px; border-radius: 4px; } .orderImage svg { width: 29px; height: 29px; } .orderLeftWrapper .orderNumberWrapper { font-size: 15px; font-weight: 500; line-height: 1; margin-bottom: 2px; } .orderLeftWrapper .orderDateWrapper { font-size: 12px; font-weight: 500; color: #878585; } .orderStatusWrapper span { display: inline-block; padding: 2px 9px; background-color: #2daf2d; color: #fff; border-radius: 6px; } .rvOrderTopWrap { margin-bottom: 15px; } /*.rvHelpOrderTopWrap{ background-color:#ccc; border-top-left-radius:8px; border-top-right-radius:8px; }*/ .rvOrderMiddleWrap .width50 { width: 50%; } .rvMiddleHeadWrap { font-size: 16px; font-weight: 400; color: #878585; line-height: 1; } .rvMiddleContWrap { font-size: 16px; font-weight: 600; } .rvOrderMiddleWrap { margin-bottom: 15px; } button.rvOrderInnerButton { padding: 8px 20px; background: transparent; outline: none; box-shadow: none; border: 1px solid ${botsetting_DEV.Bot_Agent_Button_Color}; color: ${botsetting_DEV.Bot_Agent_Button_Color}; cursor: pointer; } button.rvOrderInnerButton:hover{ background-color: ${botsetting_DEV.Bot_Agent_Button_Color}; color: ${botsetting_DEV.Bot_Agent_Button_Text_Color}; } button.rvOrderInnerButton:not(:last-child) { margin-right: 10px; } .rvFlexWrap{ flex-wrap: wrap; } .breadCrumbInnerWrapper { padding: 12px 20px; margin-bottom: 10px; } .breadCrumbInnerWrapper > div > div { padding: 2.5px 5px; display: flex; align-items: center; } .breadCrumbInnerWrapper > div > div:not(:last-child):after { content: ">"; padding-left: 10px; font-size: 16px; font-weight: 500; line-height: 1; } .breadCrumbInnerWrapper > div > div:not(:last-child):after, .breadCrumbInnerWrapper > div > div:last-child { color: #8d8d8d; } .breadCrumbInnerWrapper > div > div:not(:last-child) { cursor: pointer; } .accessYourAccount.rvInnerPageWrap.rvScrollBehaviour { background-color: #fff; height: calc(100% - 141px); overflow: auto; } .rvAddressInnerWrap .orderImage { width: auto; height: auto; padding: 10px; margin-top: 6px; } .rvAddressInnerWrap { align-items: flex-start; margin-top: 20px; } .rvCustAddressWrapper .rvHeadTitle { font-size: 15px; font-weight: 500; } .rvCustAddressWrapper .rvHeadDescription { font-size: 13px; color: #7a7777; } .rvInnerLoader { flex: 1 1 0%; position: relative; width: 100%; height: 100%; align-items: center; justify-content: center; display: flex; } .rvLoaderWrapper{ border: 6px solid #f3f3f3; border-top: 6px solid ${botsetting_DEV.Bot_Agent_Button_Color}; border-radius: 50%; width: 30px; height: 30px; animation: spin 2s linear infinite; } @keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } } .rvProductImageWrapper { position: relative; } .rvProductImage { width: 40px; height: 40px; padding: 7px; background: #fff; box-shadow: 0 0 5px rgb(0 0 0 / 10%); display: flex; align-items: center; margin-right: 15px; border-radius: 8px; } img.productImage { max-width: 100%; } .rvProductQty { position: absolute; padding: 8px; top: -8px; background: ${botsetting_DEV.Bot_Agent_Button_Color}; border-radius: 50%; width: 5px; height: 5px; display: flex; align-items: center; justify-content: center; color: ${botsetting_DEV.Bot_Agent_Button_Text_Color}; left: 40px; font-size: 12px; } .rvProductOuterWrapper { margin-bottom: 15px; } #map { width: 100%; height: 160px; } .trackingHeaderWrap { padding: 20px 0 15px; border-bottom: 1px solid #dcdcdc; font-size: 16px; font-weight: 600; } .rvCourierName { padding-left: 15px; font-weight: 600; } .rvTrackingInfoWrap p { margin: 0; font-size: 15px; } .rvTrackingInfoWrap { padding-right: 15px; margin-top: 10px; } .rvNoTrackInfo { padding: 10px 10px 0; text-align: center; font-size: 15px; font-weight: 600; } .rvReturnOptionHead { padding: 0 0 15px; align-items: center; border-bottom: 1px solid #eee; } .rvReturnOptionHead .helpOptionLeft { font-weight: 600; } .customCheckBox1 { display: block; position: relative; padding-left: 22px; cursor: pointer; font-size: 14px; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; } .customCheckBox1 > input { position: absolute; opacity: 0; cursor: pointer; height: 0; width: 0; } .customCheckBox1 span.checkmark { position: absolute; top: 0; left: 0; height: 15px; width: 15px; background-color: #fff; border-radius: 50%; border: 1px solid ${botsetting_DEV.Bot_Agent_Button_Color}3b; } .customCheckBox1:hover input ~ .checkmark { background-color: ${botsetting_DEV.Bot_Agent_Button_Color}3b; } .customCheckBox1 input:checked ~ .checkmark { background-color: ${botsetting_DEV.Bot_Agent_Button_Color}; } .customCheckBox1 span.checkmark:after { content: ""; position: absolute; display: block; left: 5px; top: 2px; width: 3px; height: 6px; border: solid ${botsetting_DEV.Bot_Agent_Button_Color}3b; border-width: 0 2.5px 2.5px 0; -webkit-transform: rotate(45deg); -ms-transform: rotate(45deg); transform: rotate(45deg); } .customCheckBox1 input:checked ~ span.checkmark:after{ border-color: ${botsetting_DEV.Bot_Agent_Button_Text_Color}; } .rvHelpMiddleWrap .rvProductImage { width: 40px; height: auto; background: none; box-shadow: none; padding: 0; } .rvHelpMiddleWrap .rvProductTitle{ line-height: 1; } span.productName.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: inline-block; width: 130px; margin-bottom:5px; } .rvReturnProductWrapper{ margin-bottom: 0; padding-top: 20px; padding-bottom: 20px; border-bottom: 1px solid #eee; } .wid100{ width: 100%; } .wid80 { width: 80%; } .wid20 { width: 20%; } .rvProductConversationList { padding: 20px; background-color: #f2eaea; } .rvConvProdTitle { font-size: 15px; font-weight: 600; padding-bottom:10px; } .errorFeedBack > div { padding: 10px 15px 0; color: red; } .reasonForReturns { margin: 15px 0; } .reasonForReturns label { display: block; margin-bottom: 5px; font-weight: 500; } .refundOrExchange{ margin-bottom:0; } .rvConvMsgInner .rvAccessWrap { margin: 0; width: 100%; text-align: left; } .rvConvMsgInner .rvAccessWrap .rvOrderMiddleWrap { margin-bottom: 0; } .rvProductConversationList div { font-size: 13px; } .text-right{ text-align:right; } .triggerConversationWrapper button{ width: 100%; margin: 5px; padding: 10px 15px; border-radius: 5px; background-color: transparent; border: 1px solid ${botsetting_DEV.Bot_Agent_Button_Color}; color: ${botsetting_DEV.Bot_Agent_Button_Color}; cursor: pointer; } .rvForm.loader{ position:realtive; } .rvForm.loader:before { content: ''; position: absolute; left: 0; top: 0; right: 0; bottom: 0; background-color: rgba(255,255,255,1); opacity: 0.4; z-index: 55544; } .rvConvMsg.rvMsgRight>.rvConvMsgInner>.rvConvMsgText.articleStartWrapper{ display: inline-block;padding: 1rem;border-radius: 7px;border: 1px solid #ccc;max-width: 85%;font-weight: 400;line-height: 22px;font-size: 15px;background-color: transparent;color: #000; } .trackingOuterWrapper{ margin-bottom: 30px; padding-bottom: 10px; border-bottom: 1px solid #dcdcdc; } .overflow-elipses { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; } .width85{ width: 85%; } .width100{ width:100%; } .rvBotAvatar{ box-shadow: #0000001a 0px 5px 10px; width: 20px; height: 20px; border-radius: 50%; } ` return styles; }, triggerMsgCss: function(){ var styles = ` @charset "UTF-8";@import url(https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap); body{ margin:0; font-family: Poppins,sans-serif; font-size: 14px; line-height: 1.5; } .rvBotAvatar{ box-shadow: #0000001a 0px 5px 10px; border: 1px solid #d3d2d2; width: 34px; border-radius: 50%; } .rvTrigger.posRelative { position: relative; border-radius: 5px 5px 5px 0px; box-sizing: border-box; padding: 15px 0px; background-color: rgb(255, 255, 255); box-shadow: ${botsetting_DEV.boxShadow}; clear: both; margin-left: 45px; margin-bottom: 8px; } .rvTriggerBotIcon { position: absolute; bottom: 0px; left: -40px; box-shadow: rgba(35, 47, 53, 0.09) 0px 2px 8px 0px; border-radius: 100%; } .rvTriggerBotIcon img { width: 32px; } .rvoperatorWrap { font-size: 10px; color: rgba(115, 115, 118, 0.7); padding: 0px 20px 10px; } .rvoperatorMsgWrap { padding: 0px 20px; max-height: 300px; } .rvOperatorContWrap { font-size: 14px; line-height: 1.4; /* margin: 0px 0px 10px; */ } .rvTrigger.posRelative:after { content: ""; position: absolute; bottom: 0px; left: -5px; width: 0px; height: 0px; border-style: solid; border-width: 0px 0px 13px 5px; border-color: transparent transparent white; } .flypopup{ padding: 0; width: 285px; position: absolute; bottom: 0; border-radius: 12px; display: flex; flex-direction: column; z-index: 1; right: 0; margin-left: 20px; opacity:0; transition: ease-in 2s opacity; } .flypopup.enable{ opacity:1; } .flypopup .close-button-wrapper { position: absolute; bottom: 100%; opacity: 0; width: 100%; height: 45px; transition: all 0.3s ease 0s; transform: translateY(10px); left: 0px; } .flypopup .close-button-wrapper button.material-icons.exit-chat.mobile-close { position: absolute; top: 0px; border-radius: 50%; margin: 0px; padding: 3px; box-shadow: rgb(0 0 0 / 16%) 0px 3px 6px, rgb(0 0 0 / 23%) 0px 3px 6px; height: 24px; width: 24px; display: flex; background: rgb(255, 255, 255); right: 5px; } .flypopup:hover .close-button-wrapper { opacity: 1; transform: translateY(0px); } button, button.material-icons { background: none; border: 0px; color: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: inherit; font-family: inherit; line-height: normal; overflow: visible; padding: 0px; user-select: none; outline: none; cursor: pointer; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); } .rve_trigger button{ margin: 0 0 10px auto; font-size: 14px; line-height: 18px; padding: 10px; border-radius: 6px; background-color: rgb(0, 113, 178); color: rgb(255, 255, 255); display: block; } .rve_trigger button:hover{ background-color: rgb(229, 246, 255); color: rgb(0, 113, 178); } .rve_trigger button:lastchild{ margin-bottom:0; } .flypopup .close-button-wrapper button.material-icons.exit-chat.mobile-close svg#ic_close { width: 20px; height: 20px; fill: rgb(136, 148, 171); } ` return styles; }, flyOptionEvent: async function(e){ var activateUser = 0 if (e.target.parentNode.classList[0] === "rve_dg_btn_Wrapper") { e.target.parentNode.parentNode.remove(); } else { activateUser = 1; notificationContentFrameDEV.getElementsByClassName("new-message")[0].innerHTML = 0; rvSetCookies(31, "notify-value", 0); var flyMessage = triggerContentFrameDEV.querySelector(".flypopup"); if(flyMessage){ flyMessage.style.display = "none"; triggerFrameDEV.style.display = "none"; var circle_ripple = toggleContentFrameDEV.querySelector(".circle-ripple"); circle_ripple.style.display = "none"; notificationFrameDEV.style.display = "none"; var dd = divWidgetDEV; dd.style.display = "block"; } } var options = e.target.dataset.value; currentOption = options rvSetCookies(31, "rvce_current_option", options); if( options === "live_agent" ){ Is_Agent_DEV = true Is_Agent_Flag_DEV = "changed" rvSetCookies( 1, 'agent-chat', true); }else{ Is_Agent_DEV = false Is_Agent_Flag_DEV = "changed" rvSetCookies( 1, 'agent-chat', false); } if( options === "workflow"){ await RVBotViewDev.startConversationFunc(false); workflow_DEV = true; let index = e.target.dataset.workflow let websitePage = websitePages_DEV[index] var getCurTime = RVBotViewDev.rvGetCurrentTime(); msg = websitePage.Trigger_Message.replace(/\n/g, "
"); let name = ( RV_Customer_Name_DEV && RV_Customer_Name_DEV === null ) ? RV_Customer_Name_DEV : 'me'; var rvMessage =`

${name}, ${getCurTime}

${msg}
`; RV_CONVERSATION += rvMessage; RVBotViewDev.removeTyping(); RV_MSG_BODY_HEIGHT_DEV.insertAdjacentHTML("beforebegin", rvMessage); RVBotViewDev.rvSendMessage( msg, "workflow", "user", "", websitePage.Agent_Bot_Workflow_Id, "", activateUser); currentWorkflowId_DEV = websitePage.Agent_Bot_Workflow_Id; RVBotViewDev.rvResetMsgScroll(); if( Visitor_Chat_Id_DEV !== "" ){ socketDEV.emit("online", { Conversation_Id: Conversation_Id, Website_Id: Website_Id_DEV }) } }else{ workflow_DEV = false; currentWorkflowId_DEV = ""; widgetContentFrameDEV.querySelector('.rvReplyInputBox > textarea').setAttribute('disabled', 'disabled'); widgetContentFrameDEV.querySelector('.rvReplyInputBox .rvMessengerReplyInputUtilsButton').classList.add('disabled'); var lc_msg = ""; if(rvGetCookies("pt_login_customer")){ lc_msg = "Hi "+RV_Customer_Name_DEV+", "; } var msg = options === "faq" ? "Please enter your queries" : '' if (msg) { await RVBotViewDev.startConversationFunc(false); var getCurTime = RVBotViewDev.rvGetCurrentTime(); msg = msg.replace(/\n/g, "
"); var rvMessage =`

logo Bot, ${getCurTime}

${lc_msg+msg}
`; RV_CONVERSATION += rvMessage; RVBotViewDev.removeTyping(); RV_MSG_BODY_HEIGHT_DEV.insertAdjacentHTML("beforebegin", rvMessage); RVBotViewDev.rvSendMessage( msg, "no", "bot", "","","",activateUser); RVBotViewDev.rvResetMsgScroll(); if( Visitor_Chat_Id_DEV !== "" ){ socketDEV.emit("online", { Conversation_Id: Conversation_Id, Website_Id: Website_Id_DEV }) } } else { await RVBotViewDev.startConversationFunc(); RVBotViewDev.initiateConversation(); // if (rvGetCookies("rv_email") || rvGetCookies("login-customerid")) { // var pt_login_box = widgetContentFrameDEV.querySelector(".loginBox"); // pt_login_box.style.display = "none"; // RVBotViewDev.rvSendMessage("started live chat", "", "activity", "online"); // } else { // widgetContentFrameDEV.getElementsByClassName('loginBox')[0].style.left = 0; // // var ptw_cb_footer = document.querySelector(".ptw_cb_footer"); // // ptw_cb_footer.style.display = "none"; // //ptResetMessageScroll(); // } } } }, initiateConversation: function(){ if( RVAgentOption ){ rvSetCookies(31, "rvce_current_option", "live_chat"); currentOption = "live_chat"; } if(RV_EXISTING_CUSTOMER === false){ var rvMessage =`

logo Bot, ${RVBotViewDev.rvGetCurrentTime()}

Are you an existing customer?
`; RV_CONVERSATION += rvMessage; RVBotViewDev.removeTyping(); RV_MSG_BODY_HEIGHT_DEV.insertAdjacentHTML("beforebegin", rvMessage); RVBotViewDev.rvSendMessage( "Are you an existing customer?", "", "bot"); var rvMessage = `
`; RVBotViewDev.removeTyping(); RV_MSG_BODY_HEIGHT_DEV.insertAdjacentHTML("beforebegin", rvMessage); RVBotViewDev.rvResetMsgScroll(); let domButtons = widgetContentFrameDEV.querySelectorAll(".rv_initiate_conversation"); for (i = 0; i < domButtons.length; i++) { domButtons[i].addEventListener("click", RVBotViewDev.rvCustomerOption); } }else{ if( !rvGetCookies("rv_email") ) { RVBotViewDev.rvCollectEmailInformation(); }else if( !rvGetCookies("rv_name") ) { RVBotViewDev.rvCollectNameInformation(); }else{ RVBotViewDev.rvCollectMessage(); } } }, rvCollectEmailInformation: async function(){ let msg = "Give the team a way to reach you."; var rvMessage =`

logo Bot, ${RVBotViewDev.rvGetCurrentTime()}

${msg}
`; RV_CONVERSATION += rvMessage; RVBotViewDev.removeTyping(); RV_MSG_BODY_HEIGHT_DEV.insertAdjacentHTML("beforebegin", rvMessage); RVBotViewDev.rvSendMessage( msg, "", "bot"); var rvMessage = `
`; RVBotViewDev.removeTyping(); RV_MSG_BODY_HEIGHT_DEV.insertAdjacentHTML("beforebegin", rvMessage); RVBotViewDev.rvResetMsgScroll(); RVBotViewDev.collectEmailEvent(); }, rvCollectNameInformation: function(){ let msg = "Thanks! A few more details will help assign you to the right person:"; var rvMessage =`

logo Bot, ${RVBotViewDev.rvGetCurrentTime()}

${msg}
`; RV_CONVERSATION += rvMessage; RVBotViewDev.removeTyping(); RV_MSG_BODY_HEIGHT_DEV.insertAdjacentHTML("beforebegin", rvMessage); RVBotViewDev.rvSendMessage( msg, "", "bot"); var rvMessage = `
`; RVBotViewDev.removeTyping(); RV_MSG_BODY_HEIGHT_DEV.insertAdjacentHTML("beforebegin", rvMessage); RVBotViewDev.rvResetMsgScroll(); RVBotViewDev.collectNameEvent(); }, rvCollectMessage: function(){ let msg = "Please leave your message"; var rvMessage =`

logo Bot, ${RVBotViewDev.rvGetCurrentTime()}

${msg}
`; RV_CONVERSATION += rvMessage; RVBotViewDev.removeTyping(); RV_MSG_BODY_HEIGHT_DEV.insertAdjacentHTML("beforebegin", rvMessage); RVBotViewDev.rvSendMessage( msg, "", "bot"); RVBotViewDev.rvResetMsgScroll(); RVBotViewDev.collectMessageEvent(); }, collectMessageEvent: function (){ widgetContentFrameDEV.querySelector('.rvReplyInputBox > textarea').removeAttribute('disabled'); widgetContentFrameDEV.querySelector('.rvReplyInputBox .rvMessengerReplyInputUtilsButton').classList.remove('disabled'); var textArea = widgetContentFrameDEV.body.querySelector('.rvReplyInputBox textarea'); textArea.addEventListener("keydown", RVBotViewDev.collectMessageKeyDownEvent); textArea.addEventListener("keyup", RVBotViewDev.collectMessageKeyUpEvent); }, collectMessageKeyDownEvent: function (e){ var rvMsg = this.value; var keyCode = e.keyCode || e.which; if (keyCode == 13) { if (!e.shiftKey) { e.preventDefault(); RVBotViewDev.sendMessageBtnClick() } } }, collectMessageKeyUpEvent: function(e){ var rvMsg = this.value; if (rvMsg) { widgetContentFrameDEV.querySelector(".rvMessengerReplyInputUtilsButton").classList.add("active"); if (Visitor_Chat_Id_DEV === "") { socketDEV.emit("user_typing", { Conversation_Id: Conversation_Id, Visitor_Chat_Id: Visitor_Chat_Id_DEV, Website_Id: Website_Id_DEV, type: "typing", typing: true, }); } RVBotViewDev.collectMessageBtnEvent(); } else { var rvBtnActive = widgetContentFrameDEV.querySelector(".rvMessengerReplyInputUtilsButton"); rvBtnActive.removeEventListener("click", RVBotViewDev.sendMessageBtnClick); widgetContentFrameDEV.querySelector(".rvMessengerReplyInputUtilsButton").classList.remove("active"); } }, collectMessageBtnEvent: function() { var rvBtnActive = widgetContentFrameDEV.querySelector(".rvMessengerReplyInputUtilsButton.active"); rvBtnActive.addEventListener("click", RVBotViewDev.sendMessageBtnClick); }, sendMessageBtnClick: async function(){ var msg = widgetContentFrameDEV.body.querySelector('.rvReplyInputBox textarea').value; if (msg) { msg = msg.replace(/\n/g, "
"); var msg1 = `

` + RV_Customer_Name_DEV + `, ` + RVBotViewDev.rvGetCurrentTime() +`

` + RVBotViewDev.convertMsgHtml(msg) +`
`; RV_CONVERSATION += msg1; RVBotViewDev.removeTyping(); RV_MSG_BODY_HEIGHT_DEV.insertAdjacentHTML("beforebegin", msg1); RVBotViewDev.rvResetMsgScroll(); var textArea = widgetContentFrameDEV.body.querySelector('.rvReplyInputBox textarea'); var rvBtnActive = widgetContentFrameDEV.querySelector(".rvMessengerReplyInputUtilsButton"); textArea.removeEventListener("keydown", RVBotViewDev.collectMessageKeyDownEvent); textArea.removeEventListener("keyup", RVBotViewDev.collectMessageKeyUpEvent); rvBtnActive.removeEventListener("click", RVBotViewDev.sendMessageBtnClick); widgetContentFrameDEV.body.querySelector('.rvReplyInputBox textarea').value = ''; if( RVAgentOption === true ){ RVBotViewDev.sendMessageEvent(); }else{ widgetContentFrameDEV.querySelector('.rvReplyInputBox > textarea').setAttribute('disabled', 'disabled'); widgetContentFrameDEV.querySelector('.rvReplyInputBox .rvMessengerReplyInputUtilsButton').classList.add('disabled'); } RVClearNotification_DEV = setInterval(RVBotViewDev.addNotificationMessage, 5000); let url = "/livechat/updateLead/"+rvWebsiteIdDev; let data = `VisitorId=${rvGetCookies("VisitorId")}&Visitor_Chat_Id=${Visitor_Chat_Id_DEV}&Conversation_Id=${Conversation_Id}&message=${msg}&RV_RETURN_FORM=${RV_RETURN_FORM}`; let res = await RVBotViewDev.rvXmlRequest(url, data); RV_RETURN_FORM = false; if (res.status == true) { if (rvGetCookies("customer_id") == "" || rvGetCookies("customer_id") == null) { rvSetCookies(31, "customer_id", res.Visitor_Chat_Id); rvSetCookies(31, "conversation_id", res.Conversation_Id); rvSetCookies(31, "project_id", res.Website_Id); Visitor_Chat_Id_DEV = res.Visitor_Chat_Id; Conversation_Id = res.Conversation_Id; Website_Id_DEV = res.Website_Id; socketDEV.emit("new_user",{ Website_Id: res.Website_Id, Visitor_Chat_Id: res.Visitor_Chat_Id, } ); } socketDEV.emit( "online", { Conversation_Id: Conversation_Id, Website_Id: Website_Id_DEV }); } } }, addNotificationMessage: function(){ let timeText = "back in"; let timeValue = RVBotViewDev.getNextAvailableTime(); if( RVAgentOption ){ timeText = "reply in"; timeValue = "as soon as possible"; } let msg = `
You’ll get replies here and in your email:
${RV_Customer_Email_DEV}

We’ll be ${timeText}
${timeValue}
`; var rvMessage =`

logo Bot, ${RVBotViewDev.rvGetCurrentTime()}

${msg}
`; RV_CONVERSATION += rvMessage; RVBotViewDev.removeTyping(); RV_MSG_BODY_HEIGHT_DEV.insertAdjacentHTML("beforebegin", rvMessage); RVBotViewDev.rvSendMessage( msg, "", "bot"); clearInterval(RVClearNotification_DEV); }, collectEmailEvent: async function(){ let emailDom = widgetContentFrameDEV.body.querySelector('#email'); emailDom.addEventListener('keydown', function(e){ var email = this.value; if( email === "" ){ e.target.parentNode.classList.add('form-error'); e.target.parentNode.querySelector('.form-feedback').innerHTML = "Please provide email"; return false; } if( !/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email) ){ e.target.parentNode.classList.add('form-error'); e.target.parentNode.querySelector('.form-feedback').innerHTML = "Please provide valid email"; return false; } e.target.parentNode.classList.remove('form-error'); e.target.parentNode.querySelector('.form-feedback').innerHTML = ""; var keyCode = e.keyCode || e.which; if (keyCode == 13) { if (!event.shiftKey) { RVBotViewDev.updateEmailLead(email); } } }); let emailFormBtn = widgetContentFrameDEV.body.querySelector('.rvCollectUserEmail'); emailFormBtn.addEventListener('click', function(e){ var email = widgetContentFrameDEV.body.querySelector('#email').value; if( email === "" ){ emailFormBtn.parentNode.parentNode.querySelector('.form-input').classList.add('form-error'); emailFormBtn.parentNode.parentNode.querySelector('.form-feedback').innerHTML = "Please provide email"; return false; } if( !/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email) ){ emailFormBtn.parentNode.parentNode.querySelector('.form-input').classList.add('form-error'); emailFormBtn.parentNode.parentNode.querySelector('.form-feedback').innerHTML = "Please provide valid email"; return false; } emailFormBtn.parentNode.parentNode.querySelector('.form-input').classList.remove('form-error'); emailFormBtn.parentNode.parentNode.querySelector('.form-feedback').innerHTML = ""; RVBotViewDev.updateEmailLead(email); }) }, collectNameEvent: async function(){ let nameDom = widgetContentFrameDEV.body.querySelector('#name'); nameDom.addEventListener('keydown', function(e){ var name = this.value; if( name === "" ){ e.target.parentNode.classList.add('form-error'); e.target.parentNode.querySelector('.form-feedback').innerHTML = "Please provide name"; return false; } e.target.parentNode.classList.remove('form-error'); e.target.parentNode.querySelector('.form-feedback').innerHTML = ""; var keyCode = e.keyCode || e.which; if (keyCode == 13) { if (!event.shiftKey) { RVBotViewDev.updateNameLead(name); } } }); let nameFormBtn = widgetContentFrameDEV.body.querySelector('.rvCollectUserName'); nameFormBtn.addEventListener('click', function(e){ var name = widgetContentFrameDEV.body.querySelector('#name').value; if( name === "" ){ nameFormBtn.parentNode.parentNode.querySelector('.form-input').classList.add('form-error'); nameFormBtn.parentNode.parentNode.querySelector('.form-feedback').innerHTML = "Please provide name"; return false; } nameFormBtn.parentNode.parentNode.querySelector('.form-input').classList.remove('form-error'); nameFormBtn.parentNode.parentNode.querySelector('.form-feedback').innerHTML = ""; RVBotViewDev.updateNameLead(name); }) }, updateEmailLead: async function(email){ let initialLoader = widgetContentFrameDEV.body.querySelector('.initialLoader'); initialLoader.classList.add('loader'); initialLoader.classList.remove('initialLoader'); let url = "/livechat/updateLead/"+rvWebsiteIdDev; let data = `VisitorId=${VisitorId}&Visitor_Chat_Id=${Visitor_Chat_Id_DEV}&Conversation_Id=${Conversation_Id}&email=${email}`; let res = await RVBotViewDev.rvXmlRequest(url, data); if (res.status == true) { let initialLoader = widgetContentFrameDEV.body.querySelector('.loader'); initialLoader.classList.remove('loader'); rvSetCookies(31, "rv_email", res.email); RV_Customer_Email_DEV = res.email; if (rvGetCookies("customer_id") == "" || rvGetCookies("customer_id") == null) { rvSetCookies(31, "customer_id", res.Visitor_Chat_Id); rvSetCookies(31, "conversation_id", res.Conversation_Id); rvSetCookies(31, "project_id", res.Website_Id); Visitor_Chat_Id_DEV = res.Visitor_Chat_Id; Conversation_Id = res.Conversation_Id; Website_Id_DEV = res.Website_Id; socketDEV.emit("new_user",{ Website_Id: res.Website_Id, Visitor_Chat_Id: res.Visitor_Chat_Id, } ); } let emailDom = widgetContentFrameDEV.body.querySelector('#email'); emailDom.parentNode.parentNode.innerHTML = email; let emailMsg = `
${email}
` RV_CONVERSATION += emailMsg; RVBotViewDev.removeTyping(); RVBotViewDev.rvSendMessage(encodeURIComponent(emailMsg), "", "user"); socketDEV.emit( "online", { Conversation_Id: Conversation_Id, Website_Id: Website_Id_DEV }); RVBotViewDev.rvCollectNameInformation(); } }, updateNameLead: async function(name){ let initialLoader = widgetContentFrameDEV.body.querySelector('.initialLoader'); initialLoader.classList.add('loader'); initialLoader.classList.remove('initialLoader'); let url = "/livechat/updateLead/"+rvWebsiteIdDev; let data = `VisitorId=${rvGetCookies("VisitorId")}&Visitor_Chat_Id=${Visitor_Chat_Id_DEV}&Conversation_Id=${Conversation_Id}&name=${name}`; let res = await RVBotViewDev.rvXmlRequest(url, data); if (res.status == true) { let initialLoader = widgetContentFrameDEV.body.querySelector('.loader'); initialLoader.classList.remove('loader'); rvSetCookies(31, "rv_name", name); RV_Customer_Name_DEV = name; if (rvGetCookies("customer_id") == "" || rvGetCookies("customer_id") == null) { rvSetCookies(31, "customer_id", res.Visitor_Chat_Id); rvSetCookies(31, "conversation_id", res.Conversation_Id); rvSetCookies(31, "project_id", res.Website_Id); Visitor_Chat_Id_DEV = res.Visitor_Chat_Id; Conversation_Id = res.Conversation_Id; Website_Id_DEV = res.Website_Id; socketDEV.emit("new_user",{ Website_Id: res.Website_Id, Visitor_Chat_Id: res.Visitor_Chat_Id, } ); } let nameDom = widgetContentFrameDEV.body.querySelector('#name'); nameDom.parentNode.parentNode.innerHTML = name; let nameMsg = `
${name}
` RV_CONVERSATION += nameMsg; RVBotViewDev.removeTyping(); RVBotViewDev.rvSendMessage(encodeURIComponent(nameMsg), "", "user"); socketDEV.emit( "online", { Conversation_Id: Conversation_Id, Website_Id: Website_Id_DEV }); RVBotViewDev.rvCollectMessage(); } }, rvCustomerOption: async function(e){ let value = e.target.dataset.value var rvMessage = `

` + RV_Customer_Name_DEV + `, ` + RVBotViewDev.rvGetCurrentTime() + `

` + value + `
`; e.target.parentNode.parentNode.innerHTML = rvMessage; RV_EXISTING_CUSTOMER = value; rvSetCookies(31, "rv_existing_customer", value); RV_MSG_BODY_HEIGHT_DEV.insertAdjacentHTML("beforebegin", typingLoader); await RVBotViewDev.rvSendMessage( value, "", "user"); RVBotViewDev.removeTyping(); RVBotViewDev.rvResetMsgScroll(); if( !rvGetCookies("rv_email") ) { RVBotViewDev.rvCollectEmailInformation(); }else if( !rvGetCookies("rv_name") ) { RVBotViewDev.rvCollectNameInformation(); }else{ RVBotViewDev.rvCollectMessage(); } }, removeTyping: function() { var typingLoaderDom = widgetContentFrameDEV.getElementById("typingLoader"); if (typingLoaderDom) { typingLoaderDom.remove(); } }, rvGetCurrentTime: function( argDate = "") { var date; if( argDate === "" ){ date = new Date(); }else{ date = new Date(argDate); } var hours = date.getHours(); var minutes = date.getMinutes(); var ampm = hours >= 12 ? "PM" : "AM"; hours = hours % 12; hours = hours ? hours : 12; // the hour '0' should be '12' minutes = minutes < 10 ? "0" + minutes : minutes; var strTime = hours + ":" + minutes + " " + ampm; return strTime; }, rvConvertDateTime: function (val){ const isoDate = new Date().toISOString(); const today = new Date(isoDate.substring(0, isoDate.length - 5 )); const endDate = new Date(val); const days = parseInt(Math.abs(endDate.getTime() - today.getTime()) / (1000 * 60 * 60 * 24)); const hours = parseInt(Math.abs(endDate.getTime() - today.getTime()) / (1000 * 60 * 60) % 24); const minutes = parseInt(Math.abs(endDate.getTime() - today.getTime()) / (1000 * 60) % 60); const seconds = parseInt(Math.abs(endDate.getTime() - today.getTime()) / (1000) % 60); let date = ""; if (days > 0) { date = days + " days ago"; } else if (hours > 0) { date = hours + " hours ago"; } else if (minutes > 0) { date = minutes + " minutes ago"; } else if (seconds > 0) { date = seconds + " seconds ago"; } return date; }, rvEcUserNotify: async function(){ let url = "/livechat/updateUserNotify"; let data = "Visitor_Chat_Id=" + Visitor_Chat_Id + "&Website_Id=" + Website_Id_DEV; let res = await RVBotViewDev.rvXmlRequest(url, data); if (res.status == true) { msgRead_DEV = false } }, rvStripHtml: function(html){ let tmp = document.createElement("DIV"); tmp.innerHTML = html; return tmp.textContent || tmp.innerText || ""; }, } function rotateRvEcSlide(currentElement, index){ let parentNode = currentElement.parentNode; let slideIndex = parentNode.getElementsByClassName('slideIndex')[0] ? parseInt(parentNode.getElementsByClassName('slideIndex')[0].value) : 1; let currentSlideIndex = slideIndex + index let currentSlideInner = parentNode.getElementsByClassName('rvecGalleryInnerContainer')[0]; let slides = currentSlideInner.children; if (currentSlideIndex > slides.length) {currentSlideIndex = 1} if (currentSlideIndex < 1) {currentSlideIndex = slides.length} for (let i = 0; i < slides.length; i++) { slides[i].style.display = "none"; } slides[currentSlideIndex-1].style.display = "block"; if(parentNode.getElementsByClassName('slideIndex')[0]){ parentNode.getElementsByClassName('slideIndex')[0].value = currentSlideIndex } } function rvGetCookies(name){ var rvCookieValue = null, setcookies = document.cookie, splitArr = setcookies.split(";"); for (var i = 0; i < splitArr.length; i++) { var t = splitArr[i].split("="); if (t.length && t.length >= 2) { var k = t[0].trim(), v = t[1].trim(); cookiePrefix+name == k && (rvCookieValue = v); } } return rvCookieValue; } function rvSetCookies(rvDays, rvCookieName, rvCookieValue) { var d = new Date(); d.setTime(d.getTime() + rvDays * 24 * 60 * 60 * 1000); var expires = "expires=" + d.toUTCString(); document.cookie = cookiePrefix+rvCookieName + "=" + rvCookieValue + ";" + expires; } function rvDeleteCookies(name) { document.cookie = name +'=; Path=/; Expires=Thu, 01 Jan 1970 00:00:01 GMT;'; } function rvValidateEmail(email) { var re = /^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(?!test)(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/; return re.test(email); } function rvValidatePhone(phone) { var ph = /^[(]{0,1}[0-9]{3}[)]{0,1}[-\s\.]{0,1}[0-9]{3}[-\s\.]{0,1}[0-9]{4}$/; return ph.test(phone); } window.addEventListener("load", function(){ RVBotViewDev.init(); });