femaecrm.my.salesforce.com Open in urlscan Pro
18.253.163.201  Public Scan

URL: https://femaecrm.my.salesforce.com/embeddedservice/5.0/client/liveagent.esw.min.js
Submission Tags: falconsandbox
Submission: On November 20 via api from US — Scanned from DE

Form analysis 0 forms found in the DOM

Text Content

/*
 Where possible, we changed noninclusive terms to align with our company value of Equality. We maintained certain terms to avoid any effect on customer implementations. 
*/
embedded_svc.defineFeature("LiveAgent",function(b){function r(a,c){this.name=a;this.data=c}function k(a){this.liveAgentAPI=a;this.running=!1;this.pingScript=this.pingTimeoutTimer=void 0;this.sid=b.getCookie("liveagent_sid")}function l(){this.createElements();this.registerMessageHandlers()}function n(){this.visitCount=0;this.originalReferrer=void 0;this.pages=[]}function g(){this.connection=new k(this);this.fileTransfer=new l;this.visitorInfo=new n;this.browserSessionInfo={};this.INVITATIONS_CONTAINER_ID=
"esw-invite-container";this.INVITE_RESOURCE_ID="esw-invite-resource";this.INVITE_API_ID="esw-invite-api";this.inviteButton={};this.hasInvitationsLoaded=!!document.getElementById("snapins_invite");this.isInvitationsRendered=!!document.getElementById("snapins_invite");b.setDefaultButtonText("LiveAgent","Chat with an Expert","Agent Offline","Live chat:");b.addDefaultSetting("avatarImgURL","");b.addDefaultSetting("prechatBackgroundImgURL","");b.addDefaultSetting("waitingStateBackgroundImgURL","");b.addDefaultSetting("smallCompanyLogoImgURL",
"");b.addDefaultSetting("headerBackgroundURL","");b.addDefaultSetting("extraPrechatInfo",[]);b.addDefaultSetting("extraPrechatFormDetails",[]);b.addDefaultSetting("agentAvailableOnButtonClick",!1);b.settings.isOfflineSupportEnabled&&(b.settings.offlineSupportMinimizedText=b.settings.offlineSupportMinimizedText||"Contact Us");b.addMessageHandler("liveagent.chatCanceledOnDifferentTab",function(){b.fireEvent("liveagent.chatCanceledOnDifferentTab")});b.addEventHandler("error",this.disconnect.bind(this));
b.addEventHandler("sessionDataRetrieved",function(a){q=embedded_svc.liveAgentAPI.constructChatSettingsEndpointURL();a.CHASITOR_SERIALIZED_KEY?(b.settings.agentAvailableOnButtonClick=!0,this.ping()):(embedded_svc.menu||embedded_svc.settings.disableDeploymentDataPrefetch||embedded_svc.liveAgentAPI.getChatSettings(),b.loadFeatureScript("Invite",function(){embedded_svc.liveAgentAPI.getButtonSettings();document.querySelector("style#inert-style")||b.loadScriptFromDirectory("utils","inert")}));this.visitorInfo.initialize(a);
return!!a.CHASITOR_SERIALIZED_KEY}.bind(this));b.addEventHandler("beforeCreate",function(){b.settings.visitorInfo=this.visitorInfo.getInfo()}.bind(this));b.addEventHandler("validateInit",function(a){if("string"!==typeof a.baseLiveAgentURL)throw Error("Invalid Live Agent chat URL: "+a.baseLiveAgentURL);if("string"!==typeof a.baseLiveAgentContentURL)throw Error("Invalid Live Agent content URL: "+a.baseLiveAgentContentURL);if(!this.isButtonId(a.buttonId))throw Error("Invalid ButtonId Parameter Value: "+
a.buttonId);if(!this.isDeploymentId(a.deploymentId))throw Error("Invalid DeploymentId Parameter Value: "+a.deploymentId);return!0}.bind(this));b.addEventHandler("onSettingsCallCompleted",function(){b.liveAgentAPI.hasInviteButton()&&this.hasInvitationsLoaded&&(this.isInvitationsRendered?t(b.liveAgentAPI.inviteButton):b.liveAgentAPI.appendInvitationsComponent())}.bind(this));b.addEventHandler("onInvitationResourceLoaded",function(){b.liveAgentAPI.hasInviteButton()&&!this.isInvitationsRendered&&b.liveAgentAPI.appendInvitationsComponent()}.bind(this));
b.loadStorageScript("Chasitor");b.registerStorageKeys("CHASITOR_SERIALIZED_KEY LA_ESW_CHAT_SCROLL_POSITION LA_ESW_UNSEEN_MESSAGES LA_ESW_SHOW_QUEUE_POSITION LA_VISITOR_INFO LA_ESW_FILE_TOKEN LA_ESW_FILE_UPLOAD_SERVLET_URL CHATBOT_FOOTER_MENU PRECHAT_FORM_DETAILS PRECHAT_ENTITIES".split(" "));"LiveAgent"===b.settings.entryFeature&&this.updateButton()}function t(a){var c=String(a.inviteRules);if("undefined"!==typeof window.JSON)var d=window.JSON.parse(c);else throw embedded_svc.utils.error("Browser does not support JSON.parse"),
Error("Error during JSON.parse");(c=document.getElementById("snapins_invite"))&&b.inviteAPI&&"Custom"!==a.inviteRenderer&&(b.inviteAPI.inviteButton.addTracker(c,a),b.inviteAPI.inviteButton.setRules(d.rules,d.filter),b.inviteAPI.inviteButton.setOnlineState(a.isAvailable))}var q,p=0;k.prototype.send=function(a,c){var d=c||{};c="Visitor";var e="",f=!1;if(this.pingScript)this.onError("SCRT did not handle response before sending another message.");else{1<a.length?(c="System",e="MultiNoun",d.nouns="",f=
!0):e=a[0].name;var m=b.settings.baseLiveAgentURL+"/rest/"+c+"/"+e+".jsonp?";a.forEach(function(h){f&&(d.nouns+=h.name+",");d[h.name+".prefix"]="Visitor";Object.getOwnPropertyNames(h.data).forEach(function(u){d[h.name+"."+u]=h.data[u]})});f&&(d.nouns=d.nouns.substr(0,d.nouns.length-1));Object.getOwnPropertyNames(d).forEach(function(h){m+=h+"="+d[h]+"&"});m+="callback=embedded_svc.liveAgentAPI.connection.handlePing&deployment_id="+b.settings.deploymentId+"&org_id="+b.settings.orgId+"&version=48";a=
document.createElement("script");a.type="text/javascript";a.src=m;this.pingScript=document.body.appendChild(a);this.pingTimeoutTimer=window.setTimeout(function(){this.onError("Server failed to respond.")}.bind(this),5E3)}};k.prototype.handlePing=function(a){this.pingTimeoutTimer&&(clearTimeout(this.pingTimeoutTimer),this.pingTimeoutTimer=void 0);this.running=!0;a.messages.forEach(function(c){this.messageHandler(c.type,c.message)}.bind(this));this.onSuccess();this.pingScript&&(document.body.removeChild(this.pingScript),
this.pingScript=void 0)};k.prototype.messageHandler=function(a,c){switch(a){case "Availability":this.liveAgentAPI.handleAvailability(c);break;case "SwitchServer":this.liveAgentAPI.handleSwitchServer(c);break;case "Settings":this.liveAgentAPI.handleSettings(c);break;default:b.log("Unexpected message of type "+a+": "+JSON.stringify(c))}};k.prototype.onSuccess=function(a){a=a||5E4;this.pingTimer&&clearTimeout(this.pingTimer);this.pingTimer=window.setTimeout(this.liveAgentAPI.ping.bind(this.liveAgentAPI),
a)};k.prototype.onError=function(a){b.error(a)};l.prototype.registerMessageHandlers=function(){b.addMessageHandler("liveagent.fileTransfer.uploadFile",function(a){this.uploadFile(a)}.bind(this));b.addMessageHandler("liveagent.fileTransfer.resetFileSelector",function(){this.resetFileSelector()}.bind(this))};l.prototype.handleFileSelectorChange=function(){var a=document.getElementById("fileSelector").files[0];embedded_svc.liveAgentAPI.sendFileInfo(a)};l.prototype.uploadFile=function(a){var c=document.getElementById("fileUploadForm");
embedded_svc.utils.isProtocolHttpOrHttps(a.url)&&(c.action=a.url,c.submit(),this.resetFileSelector())};l.prototype.resetFileSelector=function(){document.getElementById("fileSelector").value=""};l.prototype.createElements=function(){var a=document.createElement("form"),c=document.createElement("input"),d=document.createElement("input"),e=document.createElement("iframe");a.id="fileUploadForm";a.enctype="multipart/form-data";a.method="post";a.target="fileUploadIframe";c.type="file";c.id="fileSelector";
c.name="file";c.style.display="none";c.onchange=this.handleFileSelectorChange;d.name="filename";d.type="hidden";e.id="fileUploadIframe";e.name="fileUploadIframe";e.title="FileUploadFrame";e.style.display="none";a.appendChild(c);a.appendChild(d);document.body.appendChild(a);document.body.appendChild(e)};n.prototype.initialize=function(a){a&&a.LA_VISITOR_INFO?(a=JSON.parse(a.LA_VISITOR_INFO),this.visitCount=a.visitCount,this.pages=a.pages,this.originalReferrer=a.originalReferrer||document.referrer):
this.originalReferrer=document.referrer;this.visitCount+=1;this.addCurrentPage();this.serialize()};n.prototype.serialize=function(){var a=JSON.stringify({visitCount:this.visitCount,originalReferrer:this.originalReferrer,pages:this.pages});embedded_svc?embedded_svc.setSessionData("LA_VISITOR_INFO",a):window.sessionStorage.setItem("LA_VISITOR_INFO",a)};n.prototype.getInfo=function(){return{visitCount:this.visitCount,originalReferrer:this.originalReferrer,pages:this.pages}};n.prototype.addCurrentPage=
function(){var a=window.location.href;this.pages.forEach(function(c,d){c.location===a&&this.pages.splice(d,1)}.bind(this));this.pages.unshift({location:a,time:(new Date).getTime()})};g.prototype.ping=function(){var a={},c=[new r("Availability",{ids:"["+b.settings.buttonId+"]"})];b.log("Pinging server");this.connection.pingTimer=void 0;a.sid=this.sid;a.r=(new Date).getMilliseconds();this.connection.send(c,a)};g.prototype.getChatSettings=function(){embedded_svc.utils.loadScriptFromUrl(q);p+=1};g.prototype.constructChatSettingsEndpointURL=
function(){var a=embedded_svc.settings.language,c=embedded_svc.settings.eswConfigDevName;var d="?Settings.prefix=EmbeddedService&org_id="+embedded_svc.settings.orgId;d=d+("&EmbeddedServiceConfig.configName="+c)+"&callback=embedded_svc.liveAgentAPI.handleChatSettings&version=48";"string"===typeof a&&0<a.trim().length&&(d+="&EmbeddedServiceConfig.language="+a);return embedded_svc.settings.baseLiveAgentURL+"/rest/EmbeddedService/EmbeddedServiceConfig.jsonp"+d};g.prototype.handleChatSettings=function(a){var c=
{};a.messages.forEach(function(d){"EmbeddedServiceConfig"===d.type?(embedded_svc.config=d.message,embedded_svc.utils.isCommunityOrSite()&&(c.ChatInvitation=b.liveAgentAPI.processInvitations),embedded_svc.utils.isMatchingCustomizationFound(embedded_svc.config,embedded_svc.settings.pageName)&&embedded_svc.utils.processCustomizations(embedded_svc.settings.pageName,embedded_svc.config,c)):"SwitchServer"===d.type?(embedded_svc.utils.warning("[Chat] Your org has been migrated on the Service Cloud Real Time servers. Consider regenerating the snippet for this page."),
embedded_svc.settings.baseLiveAgentURL=d.message.newUrl,p=0,q=embedded_svc.liveAgentAPI.constructChatSettingsEndpointURL(),embedded_svc.liveAgentAPI.getChatSettings()):"EmbeddedServiceError"===d.type||"Error"===d.type?1<=p||"EmbeddedServiceError"===d.type&&!d.message.shouldRetry?embedded_svc.utils.error("[Chat] "+d.type+" from jsonp call: "+d.message.text):(embedded_svc.log("[Chat] Getting chat settings failed. Retrying..Attempt:"+p),embedded_svc.liveAgentAPI.getChatSettings()):embedded_svc.utils.error("[Chat] Unexpected message type from jsonp call:"+
d.type)})};g.prototype.getButtonSettings=function(){var a=[],c={};this.sid&&(c.sid=this.sid,c.r=(new Date).getMilliseconds(),b.log("Reusing existing session."));a.push(new r("Settings",{buttonIds:"["+b.settings.buttonId+"]",updateBreadcrumb:1}));this.connection.send(a,c)};g.prototype.handleAvailability=function(a){b.log("Agent Available: "+JSON.stringify(a));a.results.forEach(function(c){var d=c.isAvailable;embedded_svc.utils.fireEvent("onAvailability",void 0,{isAgentAvailable:d,id:c.id});"LiveAgent"===
b.settings.entryFeature&&(b.settings.agentAvailableOnButtonClick=d,this.updateButton(d),b.inviteAPI&&b.inviteAPI.inviteButton.getTracker()&&b.inviteAPI.inviteButton.setOnlineState(d))}.bind(this))};g.prototype.handleSettings=function(a){var c;"string"===typeof a.contentServerUrl&&(embedded_svc.settings.baseLiveAgentContentURL=a.contentServerUrl);a.buttons.forEach(function(d){d.id===b.settings.buttonId&&(c=d.isAvailable,"Invite"===d.type&&(b.liveAgentAPI.inviteButton=d))});b.log("Agent Available: "+
JSON.stringify(c));"LiveAgent"===b.settings.entryFeature&&(b.settings.agentAvailableOnButtonClick=c,this.updateButton(c));embedded_svc.utils.fireEvent("onSettingsCallCompleted",void 0,{isAgentAvailable:c})};g.prototype.handleSwitchServer=function(a){a&&a.newUrl&&"string"===typeof a.newUrl?(b.log("Detected new Live Agent URL: "+a.newUrl+". Sending a request to new endpoint."),b.settings.baseLiveAgentURL=a.newUrl,this.connection.onSuccess(1),window.setTimeout(function(){this.getButtonSettings()}.bind(this),
1)):b.error("Expected switch server response to return a redirect URL, instead received: "+(a&&a.newUrl?a.newUrl:a)+".")};g.prototype.disconnect=function(){b.log("Disconnecting from Live Agent");this.connection.running=!1};g.prototype.isButtonId=function(a){return"573"===b.getKeyPrefix(a)};g.prototype.isDeploymentId=function(a){return"572"===b.getKeyPrefix(a)};g.prototype.sendFileInfo=function(a){var c=document.createEvent("CustomEvent");c.initCustomEvent("sendFileInfo",!0,!1,{name:a.name,size:a.size});
window.dispatchEvent(c)};g.prototype.sendCustomEvent=function(a,c){var d={};d.type=a;d.data=c;b.postMessage("chasitor.sendCustomEvent",d)};g.prototype.getCustomEvents=function(a){b.addMessageHandler("liveagent.getCustomEventsResult",a);b.postMessage("chasitor.getCustomEvents")};g.prototype.addCustomEventListener=function(a,c){b.addMessageHandler("liveagent.customEventReceived",c);b.postMessage("chasitor.addCustomEventListener",a)};g.prototype.getSessionId=function(){return this.sid};g.prototype.updateButton=
function(a){b.settings.isOfflineSupportEnabled&&!a?(b.isButtonDisabled=!1,b.setHelpButtonText(b.settings.offlineSupportMinimizedText)):b.isButtonDisabled=!a};g.prototype.handleInvitationsResource=function(){embedded_svc.config.invitation.htmlMarkup&&(b.liveAgentAPI.hasInvitationsLoaded=!0,embedded_svc.utils.fireEvent("onInvitationResourceLoaded"))};g.prototype.appendInvitationsComponent=function(){var a=document.createElement("div");a.id=embedded_svc.liveAgentAPI.INVITATIONS_CONTAINER_ID;a.innerHTML=
embedded_svc.config.invitation.htmlMarkup;if(embedded_svc.config.invitation.styles){var c=document.createElement("style");c.type="text/css";c.innerHTML=embedded_svc.config.invitation.styles;a.appendChild(c)}embedded_svc.settings.targetElement.appendChild(a);this.isInvitationsRendered=!0;embedded_svc.config.invitation.invitationAPIs&&(a=document.createElement("script"),a.id=embedded_svc.liveAgentAPI.INVITE_API_ID,a.type="text/javascript",a.innerHTML=embedded_svc.config.invitation.invitationAPIs,embedded_svc.settings.targetElement.appendChild(a));
t(b.liveAgentAPI.inviteButton)};g.prototype.processInvitations=function(a){var c=embedded_svc.config.embeddedServiceConfig?embedded_svc.utils.getSiteEndpointUrl(embedded_svc.config.embeddedServiceConfig):null;c?(embedded_svc.config.invitation={},embedded_svc.utils.loadScriptFromUrl(embedded_svc.utils.generateResourceUrl(c,a.resource),embedded_svc.liveAgentAPI.handleInvitationsResource,function(){embedded_svc.utils.error("[Invitations] Something went wrong while loading invitations static resource.")}.bind(embedded_svc),
embedded_svc.liveAgentAPI.INVITE_RESOURCE_ID)):embedded_svc.utils.warning("Static resource cannot be loaded because no site endpoint exists for the embedded service deployment.")};g.prototype.hasInviteButton=function(){return 0<Object.keys(b.liveAgentAPI.inviteButton).length&&b.liveAgentAPI.inviteButton.constructor===Object};g.prototype.startChat=function(a){if("function"!==typeof Promise)b.loadScriptFromDirectory("common","promisepolyfill",function(){return b.liveAgentAPI.startChat(a)},!0);else return(new Promise(function(c,
d){var e;try{(e=document.querySelector(".embeddedServiceSidebar"))?e.classList.contains("sidebarMinimized")?e.dispatchEvent(new CustomEvent("embeddedservicemaximizechat",{detail:{resolve:c,reject:d}})):e.classList.contains("sidebarMaximized")&&c("Embedded Service component is already maximized."):b.bootstrapEmbeddedService({chatAPISettings:a}).then(function(){b.liveAgentAPI.startChat.bind(b,a);c("Embedded Service application and component bootstrapped")}).catch(function(f){d(f)})}catch(f){d(f)}})).then(function(c){b.log("[Start Chat API] "+
c);if(b.util.isChannelMenuContext()||b.menu)b.menu.hideButtonAndMenu(),b.menu.hideTopContainer();return(new Promise(function(d,e){try{var f=document.querySelector(".embeddedServiceLiveAgentSidebarFeature");var m=document.querySelector(".embeddedServiceSidebarState");f?m.classList.contains("embeddedServiceLiveAgentStateWaiting")||m.classList.contains("embeddedServiceLiveAgentStateChat")?d("Restricted from starting chat in current state. Chat request will not fire."):(f.dispatchEvent(new CustomEvent("embeddedservicestartchat",
{detail:{data:a?embedded_svc.validateStartChatAttributes(a):{},resolve:d,reject:e}})),b.addMessageHandler("liveagent.initialized",function(){d("Successfully requested to start chat session.")})):!f&&document.getElementsByClassName("embeddedServiceSidebarDialogState")?d("Restricted from starting a chat in current state. Chat request will not fire."):d("Embedded Service sidebar feature not rendered. Start Chat was not called.")}catch(h){e(h)}})).then(function(d){b.log("[Start Chat API] "+d)}).catch(function(d){b.error("[Start Chat API] Error starting chat: "+
d)})}).catch(function(c){b.error("[Start Chat API] Error bootstrapping/maximizing chat: "+c)})};g.prototype.endChat=function(){if("function"!==typeof Promise)b.loadScriptFromDirectory("common","promisepolyfill",function(){return this.endChat()}.bind(this),!0);else return(new Promise(function(a,c){var d=["embeddedServiceLiveAgentStateWaiting","embeddedServiceLiveAgentStateChat","embeddedServiceSidebarDialogState"],e;try{(e=document.querySelector(".embeddedServiceSidebarState"))?d.some(function(f){return e.classList.contains(f)})?
(e.dispatchEvent(new CustomEvent("embeddedserviceendchat",{detail:{resolve:a,reject:c}})),b.addMessageHandler("session.deletedSessionData",function(f){-1!==f.indexOf("CHASITOR_SERIALIZED_KEY")&&-1!==f.indexOf("MASTER_DEPLOYMENT_ID")&&a("Successfully deleted session keys after chat ended.")})):(b.addMessageHandler("session.deletedSessionData",function(f){-1!==f.indexOf("ESW_IS_MINIMIZED")&&a("Successfully deleted session keys after client closed.")}),b.deleteSessionData(["ESW_IS_MINIMIZED"])):a("Embedded Service application state is not rendered on this page.")}catch(f){c(f)}})).then(function(a){b.log("[End Chat API] "+
a);return(new Promise(function(c,d){var e;try{(e=document.querySelector(".embeddedServiceSidebar"))?(b.addMessageHandler("session.deletedSessionData",function(f){-1!==f.indexOf("ESW_IS_MINIMIZED")&&-1!==f.indexOf("LA_ESW_SHOW_QUEUE_POSITION")&&-1!==f.indexOf("CHATBOT_FOOTER_MENU")&&c("Successfully deleted session keys after sidebar destroyed.")}),e.dispatchEvent(new CustomEvent("embeddedservicedestroysidebar",{detail:{resolve:c,reject:d}})),b.deleteSessionData(["ESW_IS_MINIMIZED","SCROLL_ENABLED",
"LA_ESW_CHAT_SCROLL_POSITION","CHATBOT_FOOTER_MENU","LA_ESW_SHOW_QUEUE_POSITION"])):c("Embedded Service component is not rendered on this page.")}catch(f){d(f)}finally{e&&e.remove()}})).then(function(c){b.log("[End Chat API] "+c);b.deleteSessionData(["CHASITOR_SERIALIZED_KEY","MASTER_DEPLOYMENT_ID","ACTIVE_CHAT_SESSIONS","PRECHAT_FORM_DETAILS","PRECHAT_ENTITIES"]);embedded_svc.postMessage("chasitor.decrementActiveChatSession",embedded_svc.settings.deploymentId);sessionStorage.removeItem(b.settings.storageDomain+
"MASTER_DEPLOYMENT_ID");b.deleteSessionData(["ESW_IS_MINIMIZED","SCROLL_ENABLED","LA_ESW_CHAT_SCROLL_POSITION","CHATBOT_FOOTER_MENU","LA_ESW_SHOW_QUEUE_POSITION"]);b.menu&&b.menu.settings.displayChannelMenu&&b.menu.showButtonAndMenu();!b.menu&&b.settings.displayHelpButton&&b.showHelpButton()}).catch(function(c){b.error("[End Chat API] Error destroying sidebar: "+c)})}).catch(function(a){b.error("[End Chat API] Error ending chat: "+a)}).finally(function(){b.log("[End Chat API] Finished executing End Chat API")})};
g.prototype.clearSession=function(){if("function"!==typeof Promise)b.loadScriptFromDirectory("common","promisepolyfill",function(){return this.clearSession()}.bind(this),!0);else return b.liveAgentAPI.endChat().then(function(){return(new Promise(function(a,c){var d;try{if(d=document.getElementById("esw_storage_iframe"))if(-1===b.settings.enabledFeatures.indexOf("LiveAgent"))c("Embedded Service deployment does not have the LiveAgent feature enabled.");else{b.addMessageHandler("session.deletedAllSessionData",
function(){a("Successfully deleted all tracked ESW storage keys.")});try{b.postMessage("chasitor.cancelChat"),b.postMessage("chasitor.endChat")}finally{b.deleteSessionData("CHASITOR_SERIALIZED_KEY ACTIVE_CHAT_SESSIONS LA_VISITOR_INFO MASTER_DEPLOYMENT_ID CHASITOR_EVENTS PRECHAT_FORM_DETAILS PRECHAT_ENTITIES".split(" ")),b.deleteSessionData(["ACTIVE_CHAT_SESSIONS"],!0),sessionStorage.removeItem(b.settings.storageDomain+"MASTER_DEPLOYMENT_ID"),b.deleteSessionData(b.storageKeys),b.postMessage("session.deleteAllKeys",
b.settings.storageDomain)}}else a("Salesforce iframe not present on this page.")}catch(e){c(e)}})).then(function(a){b.log("[Clear Session API] "+a)}).catch(function(a){b.error("[Clear Session API] Error deleting session keys or iframe: "+a)})}).catch(function(a){b.error("[Clear Session API] Error clearing session: "+a)}).finally(function(){b.log("[Clear Session API] Finished executing Clear Session API")})};b.liveAgentAPI=new g});