61 lines
No EOL
2.7 KiB
JavaScript
61 lines
No EOL
2.7 KiB
JavaScript
/*
|
|
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
|
|
* The only custom code added here is `let embedded_svc = window.embedded_svc` in the first line of the `initESW` function
|
|
and the wrapper exported function `initializeSalesforceWebChatForDev`
|
|
*/
|
|
|
|
export function initializeSalesforceWebchatForDev() {
|
|
var initESW = function(gslbBaseURL) {
|
|
let embedded_svc = window.embedded_svc;
|
|
embedded_svc.settings.displayHelpButton = true; //Or false
|
|
embedded_svc.settings.language = ''; //For example, enter 'en' or 'en-US'
|
|
|
|
//embedded_svc.settings.defaultMinimizedText = '...'; //(Defaults to Chat with an Expert)
|
|
//embedded_svc.settings.disabledMinimizedText = '...'; //(Defaults to Agent Offline)
|
|
|
|
//embedded_svc.settings.loadingText = ''; //(Defaults to Loading)
|
|
//embedded_svc.settings.storageDomain = 'yourdomain.com'; //(Sets the domain for your deployment so that visitors can navigate subdomains during a chat session)
|
|
|
|
// Settings for Chat
|
|
//embedded_svc.settings.directToButtonRouting = function(prechatFormData) {
|
|
// Dynamically changes the button ID based on what the visitor enters in the pre-chat form.
|
|
// Returns a valid button ID.
|
|
//};
|
|
//embedded_svc.settings.prepopulatedPrechatFields = {}; //Sets the auto-population of pre-chat form fields
|
|
//embedded_svc.settings.fallbackRouting = []; //An array of button IDs, user IDs, or userId_buttonId
|
|
//embedded_svc.settings.offlineSupportMinimizedText = '...'; //(Defaults to Contact Us)
|
|
|
|
embedded_svc.settings.enabledFeatures = ['LiveAgent'];
|
|
embedded_svc.settings.entryFeature = 'LiveAgent';
|
|
|
|
embedded_svc.init(
|
|
'https://safelite2--dev.sandbox.my.salesforce.com',
|
|
'https://safelite2--dev.sandbox.my.salesforce-sites.com/chat',
|
|
gslbBaseURL,
|
|
'00D6s0000008r6A',
|
|
'Sales_Central_Snap_in',
|
|
{
|
|
baseLiveAgentContentURL: 'https://c.la12s-core1.sfdc-8tgtt5.salesforceliveagent.com/content',
|
|
deploymentId: '572Wr0000017xKX',
|
|
buttonId: '573Wr000000CpgH',
|
|
baseLiveAgentURL: 'https://d.la12s-core1.sfdc-8tgtt5.salesforceliveagent.com/chat',
|
|
eswLiveAgentDevName: 'EmbeddedServiceLiveAgent_Parent04IWr000003yKq9MAE_1961681659a',
|
|
isOfflineSupportEnabled: false
|
|
}
|
|
);
|
|
};
|
|
|
|
if (!window.embedded_svc) {
|
|
var s = document.createElement('script');
|
|
s.setAttribute('src', 'https://safelite2--dev.sandbox.my.salesforce.com/embeddedservice/5.0/esw.min.js');
|
|
s.onload = function() {
|
|
initESW(null);
|
|
};
|
|
document.body.appendChild(s);
|
|
} else {
|
|
initESW('https://service.force.com');
|
|
}
|
|
} |