Inflow = (function() { var presenceInitiated = false; function addScript(tag, src, wtcallback, attributes) { var s = document.createElement(tag); if(src) { s.setAttribute('src', src); } if (attributes) { for ( var key in attributes) { s.setAttribute(key, attributes[key]); } } s.onload = function() { if (wtcallback && typeof wtcallback === "function") { wtcallback.call(); } }; document.head.appendChild(s); } function getQueryParameters(str) { return (str || document.location.search).replace(/(^\?)/,'').split("&").map(function(n){return n = n.split("="),this[n[0]] = n[1],this}.bind({}))[0]; } function hideCoBrowseButton(){ var cobrowseButton = document.getElementById("start-cobrowse"); var glanceStopButton = document.getElementById("glance_stop_btn"); if(glanceStopButton && cobrowseButton ) cobrowseButton.style.display = "none"; if(glanceStopButton ) glanceStopButton.classList.remove("insession"); } function showCoBrowseButton(){ var cobrowseButton = document.getElementById("start-cobrowse"); var glanceStopButton = document.getElementById("glance_stop_btn"); if(cobrowseButton ) cobrowseButton.style.display = "block"; if(glanceStopButton ) glanceStopButton .classList.add("insession"); } return { handleErrors: function (inputError) { $.fn.refreshInflowOnError(null, null, null, null,inputError.errorCode,inputError.errorMessage,inputError.errorString,inputError.checkoutSessionId); } , handleRefresh: function (inputJSON) { $.fn.refreshInflow(inputJSON); } , initPresence: function (userId) { var glanceMetaTag = document.getElementById("cobrowsescript"); if(glanceMetaTag){ if (userId != null && presenceInitiated === false) { var presencevisitor = new GLANCE.Presence.Visitor({ groupid : glanceMetaTag.getAttribute("data-groupid"), visitorid : userId }); presencevisitor.presence(); presencevisitor.connect(); presenceInitiated = true; } } } , initializeLLM: function(options, sectionData){ if (options){ let llmOptions = options.limitlessData; if(llmOptions.isEnabled){ //CSINF-1455 : in SPA its not getting intialized //Hence deleting LLM object and doing re-init const llmEl = $("#limitless-root"); if (!llmEl || (llmEl && llmEl.length < 1)){ delete window.LLM; } if (!window.LLM){ if (window.llmObserver){ window.llmObserver.disconnect(); delete window.llmObserver; } let el = document.createElement('div'), locale = sectionData.locale ? sectionData.locale.replace("_","-") : "en-US"; locale = locale.replace("_MAIN",""); el.setAttribute('id', 'limitless-root'); el.setAttribute('data-client-key', llmOptions.clientKey); el.setAttribute('data-tenant-name', llmOptions.tenantName); el.setAttribute('data-group-name', llmOptions.groupName); el.setAttribute('data-locale', locale); el.setAttribute('data-persistence', false); el.setAttribute('data-message-prop1', llmOptions.emailUrl); el.setAttribute('data-message-prop2', sectionData.sessionId); el.setAttribute('data-message-prop3', options.siteId); el.setAttribute('data-message-prop4', options.pageId); el.setAttribute('data-message-prop5', options.userSegmentation || sectionData.segmentId); el.setAttribute('data-message-prop6', (options.deviceId !== 'DEVICE_DESKTOP') ? 'mobile' : 'desktop'); el.setAttribute('data-min-question-char-count', '20'); el.setAttribute('data-powered-by', 'true'); el.setAttribute('data-message-type', 'question'); el.setAttribute('data-message-source', 'Experts'); el.setAttribute('data-how-it-works', 'mandatory'); el.setAttribute('data-rating-system', 'star'); if(llmOptions.llmScreenId){ el.setAttribute('data-hiw-set', llmOptions.llmScreenId); el.setAttribute('data-fab-button-style', 'hidden'); el.setAttribute('data-llm-height', 'calc(100vh - 32px)'); if(llmOptions.llmScreenId == 2){ el.setAttribute('data-app-visible', 'true'); }else{ el.setAttribute('data-app-visible', 'false'); } }else{ // other than seller coach page el.setAttribute('data-app-visible', 'false'); } document.getElementById("infcontainer").appendChild(el); var scriptAttr = { 'integrity':llmOptions.jssriHash, "crossorigin":"anonymous" }; addScript('script', llmOptions.scriptUrl, null, scriptAttr); } } } }, cb : function(data) { var infinputjson = JSON.parse(data.inputJSON); if (data.enabledForWebTagging) { var webTaggingUrl = data.webTaggingUrl; var wtcallback = function() { startWebTagging(data.userName, data.puid, data.phoneNo); }; addScript('script', webTaggingUrl, wtcallback); } var glanceMetaTag = document.getElementById("cobrowsescript"); if (data.enabledForCobrowsing && (glanceMetaTag === null || glanceMetaTag === "undefined")){ var css = "", head = document.head || document.getElementsByTagName('head')[0], style = document.createElement('style'); style.type = 'text/css'; if (style.styleSheet){ style.styleSheet.cssText = css; } else { style.appendChild(document.createTextNode(css)); } head.appendChild(style); var metaAtrribute = {}; // var metaAtrribute = ""; metaAtrribute["id"] = "cobrowsescript"; if (!data.enableGlanceMigration){ metaAtrribute["data-ws"] = "ebay.glance.net"; metaAtrribute["data-presenceserver"] = "ebay-presence.glance.net" ; } metaAtrribute["data-termsurl"] = "https://pages.ebay.com/termsandconditions/co-browse.html"; metaAtrribute["data-groupid"] = data.coBrowseGroupId; metaAtrribute["data-site"] = data.environment; metaAtrribute["data-scriptserver"] = data.coBrowseURL; var scriptAttributes = { "data-termsurl": "https://pages.ebay.com/termsandconditions/co-browse.html", "data-groupid": data.coBrowseGroupId, "data-site": data.environment, "charset": "UTF-8", "integrity":data.coBrowseJSSriHash, "crossorigin":"anonymous" }; var isNative = false; var ocsPlatformId = data.enabledForStaticPresence ? document.getElementById("ocsPlatformId") : undefined; if(ocsPlatformId) { isNative = ocsPlatformId.value === '1' || ocsPlatformId.value === '2'; } //presence for callus and call me on helphub. if (data.enabledForStaticPresence && isNative === false) { metaAtrribute['data-presence'] = "on"; metaAtrribute['data-visitorid'] = data.presenceId; scriptAttributes["data-presence"] = "on"; scriptAttributes["data-visitorid"] = data.presenceId; } else { var coBrowseContainer = document.getElementById("cobrowseph"); if(coBrowseContainer) coBrowseContainer.innerHTML = (''); metaAtrribute['data-presence']="api"; scriptAttributes["data-presence"] = "api"; } addScript('meta', null, null, metaAtrribute); addScript('script', (data.coBrowseURL + '/js/' + data.coBrowseLoaderJS + '?group=' + data.coBrowseGroupId + '&site=' + data.environment), function() { if (GLANCE && GLANCE.Cobrowse.Visitor.addEventListener) { GLANCE.Cobrowse.Visitor.addEventListener("sessionstarting", function(data) { hideCoBrowseButton(); }); GLANCE.Cobrowse.Visitor.addEventListener("sessionstart", function(data) { hideCoBrowseButton(); }); GLANCE.Cobrowse.Visitor.addEventListener("error", function(data) { showCoBrowseButton(); }); GLANCE.Cobrowse.Visitor.addEventListener("agents", function(data) { hideCoBrowseButton(); var glanceStopButton = document.getElementById("glance_stop_btn"); if(glanceStopButton) glanceStopButton.classList.add("insession"); }); GLANCE.Cobrowse.Visitor.addEventListener("sessionend", function() { showCoBrowseButton(); }); GLANCE.Cobrowse.Visitor.addEventListener("sessioncontinue", function(data) { hideCoBrowseButton(); }); GLANCE.Cobrowse.Visitor.addEventListener("connection", function(data) { hideCoBrowseButton(); }); } }, scriptAttributes); } if(typeof jQuery !== "undefined"){ window.$ = jQuery; if (infinputjson && data.inflowParameterUrl){ infinputjson = $.extend( {}, infinputjson, getQueryParameters(data.inflowParameterUrl)); } if (data.enabledForDolores) { if (data.serviceResponse != null) { try { infinputjson.serviceResponse = JSON.parse(data.serviceResponse); } catch (err) { } } infinputjson.disableBotIcon = infinputjson.disableBotIcon || false; if (Boolean(infinputjson.disableBotIcon) === true && window.BotObj && typeof window.BotObj === "object") { if (window.BotUtils && typeof window.BotUtils === "object") { window.BotUtils.contentMap = JSON.parse(data.doloresContent); } return; } var dolorescssstyle = ""; $('body').append(dolorescssstyle); var BotObj = new Bot({ "user" : data.presenceId, "siteId" : (data.siteId).toString(), "ocs" : data.ocs, "isOpen" : data.open, "endPoint":data.helpBotUrl, "deviceType":data.doloresDeviceType, "content":data.doloresContent, "historyAvailable":data.historyAvailable, "pageId":data.pageId, "nativePage":data.doloresNativePage, "botToolTip":data.botToolTip, "convInflowEnabled":data.convInflowEnabled, "infinputjson" :infinputjson, "dfflow" :data.dfflow }); if (infinputjson.disableBotIcon){ window.BotObj = BotObj; } } else { if (data.enabledForInflowHelp) { if (data.infhtml != null && data.infcss != null) { var parentElement = $("#mainContent").length? $("#mainContent") : $("body"); // Returns page not to hde ifh widget if(data.pageId && (data.pageId == "4642" || data.pageId == "2519158")){ parentElement = $("body"); } if (infinputjson && infinputjson.ifhContainerId && $("#" + infinputjson.ifhContainerId).length) { parentElement = $("#" + infinputjson.ifhContainerId); } parentElement.append( "