Skip to content

Instantly share code, notes, and snippets.

@sdornan
Created July 13, 2021 21:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sdornan/ffe45de3c13cb639d4349a42dcf7eae7 to your computer and use it in GitHub Desktop.
Save sdornan/ffe45de3c13cb639d4349a42dcf7eae7 to your computer and use it in GitHub Desktop.
<style>
.embeddedServiceHelpButton .helpButton .uiButton {
background-color: #0068B5;
font-family: "Founders Grotesk", "Roboto", sans-serif;
font-size: 0.600em;
min-width: 9em;
max-width: 11em;
}
.embeddedServiceHelpButton .helpButton .uiButton:focus {
outline: 1px solid #0068B5;
}
@media screen and (min-width: 600px) {
.embeddedServiceHelpButton .helpButton .uiButton {
font-size: 0.800em;
max-width: 10em;
}
}
</style>
<script>
var initESW = function(gslbBaseURL) {
if (typeof window !== undefined) {
if (!window.location.href.includes('/breezy-braces')) {
return
}
}
embedded_svc.settings.displayHelpButton = true; //Or false
embedded_svc.settings.language = ''; //For example, enter 'en' or 'en-US'
embedded_svc.settings.defaultMinimizedText = "Chat with us";
embedded_svc.settings.offlineSupportMinimizedText = "Contact us";
embedded_svc.settings.loadingText = "Just a second";
embedded_svc.settings.extraPrechatInfo = [{
"entityFieldMaps": [{
"doCreate": true,
"doFind": false,
"fieldName": "LastName",
"isExactMatch": false,
"label": "Last Name"
}, {
"doCreate": true,
"doFind": false,
"fieldName": "FirstName",
"isExactMatch": false,
"label": "First Name"
}, {
"doCreate": true,
"doFind": false,
"fieldName": "Phone",
"isExactMatch": false,
"label": "Phone number"
},{
"doCreate": true,
"doFind": true,
"fieldName": "Email",
"isExactMatch": true,
"label": "Email"
}],
"entityName": "Contact",
"saveToTranscript": "Contact",
"showOnCreate": true
}];
//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://hellotend--testing.my.salesforce.com',
'https://testing-hellotend.cs197.force.com/liveAgentSetupFlow',
gslbBaseURL,
'00D040000004ccJ',
'Chat',
{
baseLiveAgentContentURL: 'https://c.la3-c1cs-ia4.salesforceliveagent.com/content',
deploymentId: '5722E000000DYRO',
buttonId: '57304000000GmdN',
baseLiveAgentURL: 'https://d.la3-c1cs-ia4.salesforceliveagent.com/chat',
eswLiveAgentDevName: 'Chat',
isOfflineSupportEnabled: true
}
);
};
if (!window.embedded_svc) {
var s = document.createElement('script');
s.setAttribute('src', 'https://hellotend--testing.my.salesforce.com/embeddedservice/5.0/esw.min.js');
s.onload = function() {
initESW(null);
};
setTimeout(function(){
document.body.appendChild(s);
}, 5000);
} else {
initESW('https://service.force.com');
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment