Merge pull request #3028 from Safelite/feature/CASH-1527

Removed unused flag
This commit is contained in:
scottkiener-at-safelite 2026-01-23 12:20:30 -05:00 committed by GitHub
commit 1e822acc0b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 87 additions and 194 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

@ -1,6 +1,7 @@
import { shallowMount } from "@vue/test-utils"; import { shallowMount } from "@vue/test-utils";
import salesforceWebchat from "./salesforce-webchat.vue"; import salesforceWebchat from "./salesforce-webchat.vue";
import * as devHelper from "./salesforce-helper-dev"; import * as devHelper from "./salesforce-helper-dev";
import * as qaHelper from "./salesforce-helper-qa";
import * as sysHelper from "./salesforce-helper-sys"; import * as sysHelper from "./salesforce-helper-sys";
import * as prodHelper from "./salesforce-helper-prod"; import * as prodHelper from "./salesforce-helper-prod";
import { applicationConfig } from "../../constants/application-config"; import { applicationConfig } from "../../constants/application-config";
@ -42,10 +43,16 @@ describe("salesforceWebchat.vue", () => {
applicationConfig.CURRENT_ENVIRONMENT = "QA"; applicationConfig.CURRENT_ENVIRONMENT = "QA";
wrapper = shallowMount(salesforceWebchat); wrapper = shallowMount(salesforceWebchat);
const mockQa = jest.spyOn(sysHelper, "initializeSalesforceWebchatForSys"); const mockQa = jest.spyOn(qaHelper, "initializeSalesforceWebchatForQa");
wrapper.vm.initializeSalesforceWebchat(); wrapper.vm.initializeSalesforceWebchat();
expect(mockQa).toHaveBeenCalled(); expect(mockQa).toHaveBeenCalled();
applicationConfig.CURRENT_ENVIRONMENT = "SysTest";
wrapper = shallowMount(salesforceWebchat);
const mockSys = jest.spyOn(sysHelper, "initializeSalesforceWebchatForSys");
wrapper.vm.initializeSalesforceWebchat();
expect(mockSys).toHaveBeenCalled();
applicationConfig.CURRENT_ENVIRONMENT = "Dev"; applicationConfig.CURRENT_ENVIRONMENT = "Dev";
wrapper = shallowMount(salesforceWebchat); wrapper = shallowMount(salesforceWebchat);
const mockDev = jest.spyOn(devHelper, "initializeSalesforceWebchatForDev"); const mockDev = jest.spyOn(devHelper, "initializeSalesforceWebchatForDev");

View file

@ -57,6 +57,13 @@ export default {
); );
break; break;
case "QA": case "QA":
initializeSalesforceWebchatForQa(
this.modifyEmbeddedSvcCallback,
this.finishedLoadingCallback,
this.onWebchatOpenCallback,
this.onWebchatCloseCallback
);
break;
case "SysTest": case "SysTest":
initializeSalesforceWebchatForSys( initializeSalesforceWebchatForSys(
this.modifyEmbeddedSvcCallback, this.modifyEmbeddedSvcCallback,
@ -67,6 +74,7 @@ export default {
break; break;
case "Dev": case "Dev":
case "Localhost": case "Localhost":
default:
initializeSalesforceWebchatForDev( initializeSalesforceWebchatForDev(
this.modifyEmbeddedSvcCallback, this.modifyEmbeddedSvcCallback,
this.finishedLoadingCallback, this.finishedLoadingCallback,
@ -105,14 +113,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";
} }
}, },

View file

@ -162,18 +162,9 @@ export default {
// Listen for Sierra chat open/close events from sierra-webchat // Listen for Sierra chat open/close events from sierra-webchat
this._handleSierraChatVisibility = (event) => { this._handleSierraChatVisibility = (event) => {
this.sierraChatOpen = !!(event.detail && event.detail.open); this.sierraChatOpen = !!(event.detail && event.detail.open);
if (this.sierraChatOpen) {
this.isSalesforceTransferInProgress = false;
}
}; };
window.addEventListener("sierra-chat-visibility", this._handleSierraChatVisibility); window.addEventListener("sierra-chat-visibility", this._handleSierraChatVisibility);
// Listen for transfer event to set transfer-in-progress flag
this._handleSierraToSalesforceTransfer = () => {
this.isSalesforceTransferInProgress = true;
};
window.addEventListener("sierra-chat-transfer", this._handleSierraToSalesforceTransfer);
// Add scroll listener for header shadow effect // Add scroll listener for header shadow effect
this._handleScroll = () => { this._handleScroll = () => {
this.isScrolled = window.scrollY > 0; this.isScrolled = window.scrollY > 0;