Salesforcewebchat Changes
This commit is contained in:
parent
5445512816
commit
defd461145
4 changed files with 7 additions and 27 deletions
|
|
@ -7,7 +7,7 @@ function setupCustomSettings(
|
||||||
onWebchatCloseCallback
|
onWebchatCloseCallback
|
||||||
) {
|
) {
|
||||||
modifyEmbeddedSvcCallback();
|
modifyEmbeddedSvcCallback();
|
||||||
window.addEventListener("onEmbeddedMessagingReady", finishedLoadingCallback);
|
window.addEventListener("onEmbeddedMessagingButtonCreated", finishedLoadingCallback);
|
||||||
window.addEventListener("onEmbeddedMessagingWindowMaximized", onWebchatOpenCallback);
|
window.addEventListener("onEmbeddedMessagingWindowMaximized", onWebchatOpenCallback);
|
||||||
window.addEventListener("onEmbeddedMessagingWindowClosed", onWebchatCloseCallback);
|
window.addEventListener("onEmbeddedMessagingWindowClosed", onWebchatCloseCallback);
|
||||||
}
|
}
|
||||||
|
|
@ -43,7 +43,6 @@ export function initializeSalesforceWebchatForDev(
|
||||||
);
|
);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
console.log("initializing embeddedservice_bootstrap");
|
|
||||||
embeddedservice_bootstrap.settings.language = "en_US"; // For example, enter 'en' or 'en-US'
|
embeddedservice_bootstrap.settings.language = "en_US"; // For example, enter 'en' or 'en-US'
|
||||||
|
|
||||||
embeddedservice_bootstrap.init(
|
embeddedservice_bootstrap.init(
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ export default {
|
||||||
mixins: [analyticsMixin],
|
mixins: [analyticsMixin],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
isAgentAvailable: false,
|
isWebchatLoaded: false,
|
||||||
isWebchatOpen: false,
|
isWebchatOpen: false,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
@ -37,25 +37,9 @@ export default {
|
||||||
"https://safelite2--dev.sandbox.my.site.com/ESWSalesCentralTFN1755660094477/assets/js/bootstrap.min.js";
|
"https://safelite2--dev.sandbox.my.site.com/ESWSalesCentralTFN1755660094477/assets/js/bootstrap.min.js";
|
||||||
script.onload = this.initializeSalesforceWebchat;
|
script.onload = this.initializeSalesforceWebchat;
|
||||||
document.body.appendChild(script);
|
document.body.appendChild(script);
|
||||||
|
|
||||||
// Notify funnel-header about Salesforce chat open/close state
|
|
||||||
this._salesforceChatOpenObserver = new MutationObserver(() => {
|
|
||||||
const isOpen = !!document.querySelector(".embeddedServiceSidebar");
|
|
||||||
window.dispatchEvent(
|
|
||||||
new CustomEvent("salesforce-chat-visibility", { detail: { open: isOpen } })
|
|
||||||
);
|
|
||||||
});
|
|
||||||
this._salesforceChatOpenObserver.observe(document.body, {
|
|
||||||
childList: true,
|
|
||||||
subtree: true,
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
beforeUnmount() {
|
beforeUnmount() {
|
||||||
// Clean up event listeners and observers
|
// Clean up event listeners and observers
|
||||||
window.removeEventListener(
|
|
||||||
"salesforce-chat-visibility",
|
|
||||||
this._handleSalesforceChatVisibility
|
|
||||||
);
|
|
||||||
window.removeEventListener("sierra-chat-transfer", this._handleSierraToSalesforceTransfer);
|
window.removeEventListener("sierra-chat-transfer", this._handleSierraToSalesforceTransfer);
|
||||||
if (this._salesforceChatOpenObserver) {
|
if (this._salesforceChatOpenObserver) {
|
||||||
this._salesforceChatOpenObserver.disconnect();
|
this._salesforceChatOpenObserver.disconnect();
|
||||||
|
|
@ -93,16 +77,13 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
modifyEmbeddedSvcCallback() {
|
modifyEmbeddedSvcCallback() {
|
||||||
window.embeddedservice_bootstrap.settings.avatarImgURL = require("@/assets/img/salesforce-webchat/avatar_webchat.png");
|
window.embeddedservice_bootstrap.settings.hideChatButtonOnLoad = true;
|
||||||
window.embeddedservice_bootstrap.settings.prechatBackgroundImgURL = require("@/assets/img/salesforce-webchat/safelite_logo_webchat.png");
|
|
||||||
window.embeddedservice_bootstrap.settings.smallCompanyLogoImgURL = require("@/assets/img/salesforce-webchat/minimized_chat_bubble_webchat.png");
|
|
||||||
window.embeddedservice_bootstrap.settings.displayHelpButton = false;
|
|
||||||
window.addEventListener("onEmbeddedMessagingConversationStarted", () => {
|
window.addEventListener("onEmbeddedMessagingConversationStarted", () => {
|
||||||
this.pushEventForChatsToGA("support_chat", "chat_opened", "Live Agent", true);
|
this.pushEventForChatsToGA("support_chat", "chat_opened", "Live Agent", true);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
finishedLoadingCallback(data) {
|
finishedLoadingCallback(data) {
|
||||||
this.isAgentAvailable = data.isAgentAvailable;
|
this.isWebchatLoaded = true;
|
||||||
this.updateShouldShowWebchatButton();
|
this.updateShouldShowWebchatButton();
|
||||||
},
|
},
|
||||||
onWebchatOpenCallback() {
|
onWebchatOpenCallback() {
|
||||||
|
|
@ -118,7 +99,7 @@ export default {
|
||||||
updateShouldShowWebchatButton() {
|
updateShouldShowWebchatButton() {
|
||||||
this.webchatGlobalNonpersistedState.showWebchatButton =
|
this.webchatGlobalNonpersistedState.showWebchatButton =
|
||||||
!this.hideSalesforceWebchatLaunchButton &&
|
!this.hideSalesforceWebchatLaunchButton &&
|
||||||
this.isAgentAvailable &&
|
this.isWebchatLoaded &&
|
||||||
!this.isWebchatOpen;
|
!this.isWebchatOpen;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -172,7 +172,7 @@ export default {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
window.embeddedservice_bootstrap.bootstrapEmbeddedService();
|
window.embeddedservice_bootstrap.utilAPI.launchChat();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
window.addEventListener("sierra-chat-transfer", this._handleSierraTransfer);
|
window.addEventListener("sierra-chat-transfer", this._handleSierraTransfer);
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ export const webchatHelper = () => {
|
||||||
if (webchatGlobalNonpersistedState.shouldLaunchSierra) {
|
if (webchatGlobalNonpersistedState.shouldLaunchSierra) {
|
||||||
window.dispatchEvent(new CustomEvent("launch-sierra-webchat")); // launches the sierra chat
|
window.dispatchEvent(new CustomEvent("launch-sierra-webchat")); // launches the sierra chat
|
||||||
} else {
|
} else {
|
||||||
window.embeddedservice_bootstrap.bootstrapEmbeddedService(); // launches the salesForce prechat form
|
window.embeddedservice_bootstrap.utilAPI.launchChat(); // launches the salesForce prechat form
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue