50 lines
1.9 KiB
JavaScript
50 lines
1.9 KiB
JavaScript
/* eslint-disable */
|
|
// ***************************************************************
|
|
// This file wraps the Salesforce generated code.
|
|
// See the comment below for where you need to paste in the Salesforce generated code.
|
|
// You may also need to modify the script tag src located in salesforce-webchat.vue to point to the correct Salesforce instance.
|
|
// ***************************************************************
|
|
|
|
function setupCustomSettings(
|
|
modifyEmbeddedSvcCallback,
|
|
finishedLoadingCallback,
|
|
onWebchatOpenCallback,
|
|
onWebchatCloseCallback
|
|
) {
|
|
modifyEmbeddedSvcCallback();
|
|
window.addEventListener("onEmbeddedMessagingButtonCreated", finishedLoadingCallback);
|
|
window.addEventListener("onEmbeddedMessagingWindowMaximized", onWebchatOpenCallback);
|
|
window.addEventListener("onEmbeddedMessagingWindowClosed", onWebchatCloseCallback);
|
|
}
|
|
|
|
export function initializeSalesforceWebchatForSys(
|
|
modifyEmbeddedSvcCallback,
|
|
finishedLoadingCallback,
|
|
onWebchatOpenCallback,
|
|
onWebchatCloseCallback
|
|
) {
|
|
setupCustomSettings(
|
|
modifyEmbeddedSvcCallback,
|
|
finishedLoadingCallback,
|
|
onWebchatOpenCallback,
|
|
onWebchatCloseCallback
|
|
);
|
|
|
|
// START OF SALESFORCE GENERATED CODE
|
|
// Copy in the contents of the first <script> tag inside the initEmbeddedMessaging() method
|
|
try {
|
|
embeddedservice_bootstrap.settings.language = "en_US"; // For example, enter 'en' or 'en-US'
|
|
|
|
embeddedservice_bootstrap.init(
|
|
"00DcY0000067qKz",
|
|
"Sales_Central_TFN",
|
|
"https://safelite2--sys.sandbox.my.site.com/ESWSalesCentralTFN1767797265631",
|
|
{
|
|
scrt2URL: "https://safelite2--sys.sandbox.my.salesforce-scrt.com",
|
|
}
|
|
);
|
|
} catch (err) {
|
|
console.error("Error loading Embedded Messaging: ", err);
|
|
}
|
|
// END OF SALESFORCE GENERATED CODE
|
|
}
|