Add prod and modify comments

Comments now accurately guide how to update code when salesforce sends new stuff
This commit is contained in:
scottkiener-at-safelite 2026-01-23 10:35:05 -05:00
parent 9587614353
commit b4f1b6a557
5 changed files with 71 additions and 184 deletions

View file

@ -1,4 +1,9 @@
/* eslint-disable */ /* 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( function setupCustomSettings(
modifyEmbeddedSvcCallback, modifyEmbeddedSvcCallback,
@ -12,23 +17,6 @@ function setupCustomSettings(
window.addEventListener("onEmbeddedMessagingWindowClosed", onWebchatCloseCallback); 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 initializeSalesforceWebchatForDev
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 initializeSalesforceWebchatForDev( export function initializeSalesforceWebchatForDev(
modifyEmbeddedSvcCallback, modifyEmbeddedSvcCallback,
finishedLoadingCallback, finishedLoadingCallback,
@ -41,7 +29,8 @@ export function initializeSalesforceWebchatForDev(
onWebchatOpenCallback, onWebchatOpenCallback,
onWebchatCloseCallback onWebchatCloseCallback
); );
// START OF SALESFORCE GENERATED CODE
// Copy in the contents of the first <script> tag inside the initEmbeddedMessaging() method
try { try {
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'
@ -56,4 +45,5 @@ export function initializeSalesforceWebchatForDev(
} catch (err) { } catch (err) {
console.error("Error loading Embedded Messaging: ", err); console.error("Error loading Embedded Messaging: ", err);
} }
// END OF SALESFORCE GENERATED CODE
} }

View file

@ -1,4 +1,9 @@
/* eslint-disable */ /* 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( function setupCustomSettings(
modifyEmbeddedSvcCallback, modifyEmbeddedSvcCallback,
@ -7,91 +12,39 @@ function setupCustomSettings(
onWebchatCloseCallback onWebchatCloseCallback
) { ) {
modifyEmbeddedSvcCallback(); modifyEmbeddedSvcCallback();
embedded_svc.addEventHandler("onSettingsCallCompleted", finishedLoadingCallback); window.addEventListener("onEmbeddedMessagingButtonCreated", finishedLoadingCallback);
embedded_svc.addEventHandler("afterMaximize", onWebchatOpenCallback); window.addEventListener("onEmbeddedMessagingWindowMaximized", onWebchatOpenCallback);
embedded_svc.addEventHandler("afterDestroy", onWebchatCloseCallback); 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 initializeSalesforceWebchatForDev
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 initializeSalesforceWebchatForProd( export function initializeSalesforceWebchatForProd(
modifyEmbeddedSvcCallback, modifyEmbeddedSvcCallback,
finishedLoadingCallback, finishedLoadingCallback,
onWebchatOpenCallback, onWebchatOpenCallback,
onWebchatCloseCallback onWebchatCloseCallback
) { ) {
var initESW = function (gslbBaseURL) { setupCustomSettings(
let embedded_svc = window.embedded_svc; modifyEmbeddedSvcCallback,
embedded_svc.settings.displayHelpButton = true; //Or false finishedLoadingCallback,
embedded_svc.settings.language = ""; //For example, enter 'en' or 'en-US' onWebchatOpenCallback,
onWebchatCloseCallback
);
//embedded_svc.settings.defaultMinimizedText = '...'; //(Defaults to Chat with an Expert) // START OF SALESFORCE GENERATED CODE
//embedded_svc.settings.disabledMinimizedText = '...'; //(Defaults to Agent Offline) // 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'
//embedded_svc.settings.loadingText = ''; //(Defaults to Loading) embeddedservice_bootstrap.init(
//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";
setupCustomSettings(
modifyEmbeddedSvcCallback,
finishedLoadingCallback,
onWebchatOpenCallback,
onWebchatCloseCallback
);
embedded_svc.init(
"https://safelite2.my.salesforce.com",
"https://safelite2.my.salesforce-sites.com/chat",
gslbBaseURL,
"00D3t000004nvsT", "00D3t000004nvsT",
"Sales_Central_Snap_in", "Sales_Central_TFN",
"https://safelite2.my.site.com/ESWSalesCentralTFN1769108630294",
{ {
baseLiveAgentContentURL: scrt2URL: "https://safelite2.my.salesforce-scrt.com",
"https://c.la13-core2.sfdc-lywfpd.salesforceliveagent.com/content",
deploymentId: "5723t0000008wWB",
buttonId: "5733t000000D90z",
baseLiveAgentURL: "https://d.la13-core2.sfdc-lywfpd.salesforceliveagent.com/chat",
eswLiveAgentDevName:
"EmbeddedServiceLiveAgent_Parent04I3t000000Cq0SEAS_188de1871ea",
isOfflineSupportEnabled: false,
} }
); );
}; } catch (err) {
console.error("Error loading Embedded Messaging: ", err);
if (!window.embedded_svc) {
var s = document.createElement("script");
s.setAttribute("src", "https://safelite2.my.salesforce.com/embeddedservice/5.0/esw.min.js");
s.onload = function () {
initESW(null);
};
document.body.appendChild(s);
} else {
initESW("https://service.force.com");
} }
// END OF SALESFORCE GENERATED CODE
} }

View file

@ -1,4 +1,9 @@
/* eslint-disable */ /* 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( function setupCustomSettings(
modifyEmbeddedSvcCallback, modifyEmbeddedSvcCallback,
@ -7,93 +12,38 @@ function setupCustomSettings(
onWebchatCloseCallback onWebchatCloseCallback
) { ) {
modifyEmbeddedSvcCallback(); modifyEmbeddedSvcCallback();
embedded_svc.addEventHandler("onSettingsCallCompleted", finishedLoadingCallback); window.addEventListener("onEmbeddedMessagingButtonCreated", finishedLoadingCallback);
embedded_svc.addEventHandler("afterMaximize", onWebchatOpenCallback); window.addEventListener("onEmbeddedMessagingWindowMaximized", onWebchatOpenCallback);
embedded_svc.addEventHandler("afterDestroy", onWebchatCloseCallback); 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 initializeSalesforceWebchatForQa
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 initializeSalesforceWebchatForQa( export function initializeSalesforceWebchatForQa(
modifyEmbeddedSvcCallback, modifyEmbeddedSvcCallback,
finishedLoadingCallback, finishedLoadingCallback,
onWebchatOpenCallback, onWebchatOpenCallback,
onWebchatCloseCallback onWebchatCloseCallback
) { ) {
var initESW = function (gslbBaseURL) { setupCustomSettings(
embedded_svc.settings.displayHelpButton = true; //Or false modifyEmbeddedSvcCallback,
embedded_svc.settings.language = ""; //For example, enter 'en' or 'en-US' 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'
//embedded_svc.settings.defaultMinimizedText = '...'; //(Defaults to Chat with an Expert) embeddedservice_bootstrap.init(
//embedded_svc.settings.disabledMinimizedText = '...'; //(Defaults to Agent Offline) "00DTI000005x7c7",
"Sales_Central_TFN",
//embedded_svc.settings.loadingText = ''; //(Defaults to Loading) "https://safelite2--qa.sandbox.my.site.com/ESWSalesCentralTFN1768832680884",
//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";
setupCustomSettings(
modifyEmbeddedSvcCallback,
finishedLoadingCallback,
onWebchatOpenCallback,
onWebchatCloseCallback
);
embedded_svc.init(
"https://safelite2--safeliteua.sandbox.my.salesforce.com",
"https://safelite2--safeliteua.sandbox.my.salesforce-sites.com/chat",
gslbBaseURL,
"00DDJ000000HRqO",
"Sales_Central_Snap_in",
{ {
baseLiveAgentContentURL: scrt2URL: "https://safelite2--qa.sandbox.my.salesforce-scrt.com",
"https://c.la12s-core1.sfdc-8tgtt5.salesforceliveagent.com/content",
deploymentId: "572DJ00000001j3",
buttonId: "573DJ00000001ur",
baseLiveAgentURL: "https://d.la12s-core1.sfdc-8tgtt5.salesforceliveagent.com/chat",
eswLiveAgentDevName:
"EmbeddedServiceLiveAgent_Parent04IDJ0000008OZk2AM_1883057c9a6",
isOfflineSupportEnabled: false,
} }
); );
}; } catch (err) {
console.error("Error loading Embedded Messaging: ", err);
if (!window.embedded_svc) {
var s = document.createElement("script");
s.setAttribute(
"src",
"https://safelite2--safeliteua.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");
} }
// END OF SALESFORCE GENERATED CODE
} }

View file

@ -1,4 +1,9 @@
/* eslint-disable */ /* 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( function setupCustomSettings(
modifyEmbeddedSvcCallback, modifyEmbeddedSvcCallback,
@ -12,23 +17,6 @@ function setupCustomSettings(
window.addEventListener("onEmbeddedMessagingWindowClosed", onWebchatCloseCallback); 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( export function initializeSalesforceWebchatForSys(
modifyEmbeddedSvcCallback, modifyEmbeddedSvcCallback,
finishedLoadingCallback, finishedLoadingCallback,
@ -42,6 +30,8 @@ export function initializeSalesforceWebchatForSys(
onWebchatCloseCallback onWebchatCloseCallback
); );
// START OF SALESFORCE GENERATED CODE
// Copy in the contents of the first <script> tag inside the initEmbeddedMessaging() method
try { try {
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'
@ -56,4 +46,5 @@ export function initializeSalesforceWebchatForSys(
} catch (err) { } catch (err) {
console.error("Error loading Embedded Messaging: ", err); console.error("Error loading Embedded Messaging: ", err);
} }
// END OF SALESFORCE GENERATED CODE
} }

View file

@ -105,14 +105,17 @@ export default {
}, },
computed: { computed: {
webChatScriptSrc() { webChatScriptSrc() {
// These URLs are from the src tag on the script tag in the Salesforce generated code.
switch (applicationConfig.CURRENT_ENVIRONMENT) { switch (applicationConfig.CURRENT_ENVIRONMENT) {
case "Prod": case "Prod":
return "https://safelite2.my.salesforce.com/embeddedservice/5.0/esw.min.js"; return "https://safelite2.my.site.com/ESWSalesCentralTFN1769108630294/assets/js/bootstrap.min.js";
case "QA": case "QA":
return "https://safelite2--qa.sandbox.my.site.com/ESWSalesCentralTFN1768832680884/assets/js/bootstrap.min.js";
case "SysTest": case "SysTest":
return "https://safelite2--sys.sandbox.my.site.com/ESWSalesCentralTFN1767797265631/assets/js/bootstrap.min.js"; return "https://safelite2--sys.sandbox.my.site.com/ESWSalesCentralTFN1767797265631/assets/js/bootstrap.min.js";
case "Dev": case "Dev":
case "Localhost": case "Localhost":
default:
return "https://safelite2--dev.sandbox.my.site.com/ESWSalesCentralTFN1755660094477/assets/js/bootstrap.min.js"; return "https://safelite2--dev.sandbox.my.site.com/ESWSalesCentralTFN1755660094477/assets/js/bootstrap.min.js";
} }
}, },