CASH-1527 | Add in sys snippet
This commit is contained in:
parent
da1a675d8a
commit
485ab11d42
3 changed files with 74 additions and 2 deletions
|
|
@ -0,0 +1,59 @@
|
||||||
|
/* eslint-disable */
|
||||||
|
|
||||||
|
function setupCustomSettings(
|
||||||
|
modifyEmbeddedSvcCallback,
|
||||||
|
finishedLoadingCallback,
|
||||||
|
onWebchatOpenCallback,
|
||||||
|
onWebchatCloseCallback
|
||||||
|
) {
|
||||||
|
modifyEmbeddedSvcCallback();
|
||||||
|
window.addEventListener("onEmbeddedMessagingButtonCreated", finishedLoadingCallback);
|
||||||
|
window.addEventListener("onEmbeddedMessagingWindowMaximized", onWebchatOpenCallback);
|
||||||
|
window.addEventListener("onEmbeddedMessagingWindowClosed", onWebchatCloseCallback);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
The code below is generated from salesforce but modified in the following ways:
|
||||||
|
* Only the javascript inside the second <script> tag in the provided salesforce code is copy pasted
|
||||||
|
* CSS is not copied in
|
||||||
|
* First <script> tag loading in the file from the CDN is not copied in
|
||||||
|
* Copy the entire contents of the second <script> tag inside the initializeSalesforceWebchatForSys
|
||||||
|
method and add a call to setupCustomSettings before the 'embedded_svc.init()' method is called
|
||||||
|
|
||||||
|
Actual call to paste in:
|
||||||
|
setupCustomSettings(
|
||||||
|
modifyEmbeddedSvcCallback,
|
||||||
|
finishedLoadingCallback,
|
||||||
|
onWebchatOpenCallback,
|
||||||
|
onWebchatCloseCallback
|
||||||
|
);
|
||||||
|
*/
|
||||||
|
|
||||||
|
export function initializeSalesforceWebchatForSys(
|
||||||
|
modifyEmbeddedSvcCallback,
|
||||||
|
finishedLoadingCallback,
|
||||||
|
onWebchatOpenCallback,
|
||||||
|
onWebchatCloseCallback
|
||||||
|
) {
|
||||||
|
setupCustomSettings(
|
||||||
|
modifyEmbeddedSvcCallback,
|
||||||
|
finishedLoadingCallback,
|
||||||
|
onWebchatOpenCallback,
|
||||||
|
onWebchatCloseCallback
|
||||||
|
);
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -103,7 +103,20 @@ export default {
|
||||||
!this.isWebchatOpen;
|
!this.isWebchatOpen;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
computed: {},
|
computed: {
|
||||||
|
webChatScriptSrc() {
|
||||||
|
switch (applicationConfig.CURRENT_ENVIRONMENT) {
|
||||||
|
case "Prod":
|
||||||
|
return "https://safelite2.my.salesforce.com/embeddedservice/5.0/esw.min.js";
|
||||||
|
case "QA":
|
||||||
|
case "SysTest":
|
||||||
|
return "https://safelite2--sys.sandbox.my.site.com/ESWSalesCentralTFN1767797265631/assets/js/bootstrap.min.js";
|
||||||
|
case "Dev":
|
||||||
|
case "Localhost":
|
||||||
|
return "https://safelite2--dev.sandbox.my.site.com/ESWSalesCentralTFN1755660094477/assets/js/bootstrap.min.js";
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
components: {},
|
components: {},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -160,7 +160,7 @@ export default {
|
||||||
typeof window.embeddedservice_bootstrap.liveAgentAPI.startChat ===
|
typeof window.embeddedservice_bootstrap.liveAgentAPI.startChat ===
|
||||||
"function"
|
"function"
|
||||||
) {
|
) {
|
||||||
window.embeddedservice_bootstrap.liveAgentAPI.startChat();
|
window.embeddedservice_bootstrap.utilAPI.launchChat();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue