Merge branch 'develop' into rlsmerge/2026.01.29-to-develop
This commit is contained in:
commit
52099ad2d1
16 changed files with 284 additions and 352 deletions
|
|
@ -10,7 +10,6 @@ module.exports = {
|
|||
},
|
||||
transformIgnorePatterns: ["'/node_modules/(?!vee-validate)"],
|
||||
moduleFileExtensions: ["js", "vue"],
|
||||
modulePathIgnorePatterns: ["vin-lookup"],
|
||||
collectCoverageFrom: [
|
||||
"src/**/*.{js,vue}",
|
||||
"!src/main.js",
|
||||
|
|
|
|||
|
|
@ -36,6 +36,9 @@ const experimentSettings = {
|
|||
SHOW_PM_MOBILE_DAYS: "Show_PMmobileDays",
|
||||
SHOW_NO_PM_MOBILE_DAYS: "Show_NoPMmobileDays",
|
||||
SHOW_NO_MOBILE_AVAILABLE_DAYS: "Show_NoMobileAvailableDays",
|
||||
SHOW_MOBILE_FIRST_POPUP_REPAIR: "Show_Mobile_First_Popup_Repair",
|
||||
SHOW_MOBILE_FIRST_POPUP_REPLACE_WITHOUT_MSR: "Show_Mobile_First_Popup_Replace_Without_MSR",
|
||||
SHOW_MOBILE_FIRST_POPUP_REPLACE_WITH_MSR: "Show_Mobile_First_Popup_Replace_With_MSR",
|
||||
OFFER_OEM: "OfferOem",
|
||||
USE_ADYEN_PAYMENT: "UseAdyenPayment",
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,4 +1,9 @@
|
|||
/* 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(
|
||||
modifyEmbeddedSvcCallback,
|
||||
|
|
@ -7,90 +12,38 @@ function setupCustomSettings(
|
|||
onWebchatCloseCallback
|
||||
) {
|
||||
modifyEmbeddedSvcCallback();
|
||||
embedded_svc.addEventHandler("onSettingsCallCompleted", finishedLoadingCallback);
|
||||
embedded_svc.addEventHandler("afterMaximize", onWebchatOpenCallback);
|
||||
embedded_svc.addEventHandler("afterDestroy", onWebchatCloseCallback);
|
||||
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 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(
|
||||
modifyEmbeddedSvcCallback,
|
||||
finishedLoadingCallback,
|
||||
onWebchatOpenCallback,
|
||||
onWebchatCloseCallback
|
||||
) {
|
||||
var initESW = function (gslbBaseURL) {
|
||||
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)
|
||||
setupCustomSettings(
|
||||
modifyEmbeddedSvcCallback,
|
||||
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.enabledFeatures = ["LiveAgent"];
|
||||
embedded_svc.settings.entryFeature = "LiveAgent";
|
||||
|
||||
setupCustomSettings(
|
||||
modifyEmbeddedSvcCallback,
|
||||
finishedLoadingCallback,
|
||||
onWebchatOpenCallback,
|
||||
onWebchatCloseCallback
|
||||
);
|
||||
|
||||
embedded_svc.init(
|
||||
"https://safelite2--dev.sandbox.my.salesforce.com",
|
||||
"https://safelite2--dev.sandbox.my.salesforce-sites.com/chat",
|
||||
gslbBaseURL,
|
||||
embeddedservice_bootstrap.init(
|
||||
"00D6s0000008r6A",
|
||||
"Sales_Central_Snap_in",
|
||||
"Sales_Central_TFN",
|
||||
"https://safelite2--dev.sandbox.my.site.com/ESWSalesCentralTFN1755660094477",
|
||||
{
|
||||
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,
|
||||
scrt2URL: "https://safelite2--dev.sandbox.my.salesforce-scrt.com",
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
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");
|
||||
} catch (err) {
|
||||
console.error("Error loading Embedded Messaging: ", err);
|
||||
}
|
||||
// END OF SALESFORCE GENERATED CODE
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,9 @@
|
|||
/* 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(
|
||||
modifyEmbeddedSvcCallback,
|
||||
|
|
@ -7,91 +12,39 @@ function setupCustomSettings(
|
|||
onWebchatCloseCallback
|
||||
) {
|
||||
modifyEmbeddedSvcCallback();
|
||||
embedded_svc.addEventHandler("onSettingsCallCompleted", finishedLoadingCallback);
|
||||
embedded_svc.addEventHandler("afterMaximize", onWebchatOpenCallback);
|
||||
embedded_svc.addEventHandler("afterDestroy", onWebchatCloseCallback);
|
||||
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 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(
|
||||
modifyEmbeddedSvcCallback,
|
||||
finishedLoadingCallback,
|
||||
onWebchatOpenCallback,
|
||||
onWebchatCloseCallback
|
||||
) {
|
||||
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'
|
||||
setupCustomSettings(
|
||||
modifyEmbeddedSvcCallback,
|
||||
finishedLoadingCallback,
|
||||
onWebchatOpenCallback,
|
||||
onWebchatCloseCallback
|
||||
);
|
||||
|
||||
//embedded_svc.settings.defaultMinimizedText = '...'; //(Defaults to Chat with an Expert)
|
||||
//embedded_svc.settings.disabledMinimizedText = '...'; //(Defaults to Agent Offline)
|
||||
// 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.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";
|
||||
|
||||
setupCustomSettings(
|
||||
modifyEmbeddedSvcCallback,
|
||||
finishedLoadingCallback,
|
||||
onWebchatOpenCallback,
|
||||
onWebchatCloseCallback
|
||||
);
|
||||
|
||||
embedded_svc.init(
|
||||
"https://safelite2.my.salesforce.com",
|
||||
"https://safelite2.my.salesforce-sites.com/chat",
|
||||
gslbBaseURL,
|
||||
embeddedservice_bootstrap.init(
|
||||
"00D3t000004nvsT",
|
||||
"Sales_Central_Snap_in",
|
||||
"Sales_Central_TFN",
|
||||
"https://safelite2.my.site.com/ESWSalesCentralTFN1769108630294",
|
||||
{
|
||||
baseLiveAgentContentURL:
|
||||
"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,
|
||||
scrt2URL: "https://safelite2.my.salesforce-scrt.com",
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
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");
|
||||
} catch (err) {
|
||||
console.error("Error loading Embedded Messaging: ", err);
|
||||
}
|
||||
// END OF SALESFORCE GENERATED CODE
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,9 @@
|
|||
/* 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(
|
||||
modifyEmbeddedSvcCallback,
|
||||
|
|
@ -7,93 +12,38 @@ function setupCustomSettings(
|
|||
onWebchatCloseCallback
|
||||
) {
|
||||
modifyEmbeddedSvcCallback();
|
||||
embedded_svc.addEventHandler("onSettingsCallCompleted", finishedLoadingCallback);
|
||||
embedded_svc.addEventHandler("afterMaximize", onWebchatOpenCallback);
|
||||
embedded_svc.addEventHandler("afterDestroy", onWebchatCloseCallback);
|
||||
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 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(
|
||||
modifyEmbeddedSvcCallback,
|
||||
finishedLoadingCallback,
|
||||
onWebchatOpenCallback,
|
||||
onWebchatCloseCallback
|
||||
) {
|
||||
var initESW = function (gslbBaseURL) {
|
||||
embedded_svc.settings.displayHelpButton = true; //Or false
|
||||
embedded_svc.settings.language = ""; //For example, enter 'en' or 'en-US'
|
||||
setupCustomSettings(
|
||||
modifyEmbeddedSvcCallback,
|
||||
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)
|
||||
//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";
|
||||
|
||||
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",
|
||||
embeddedservice_bootstrap.init(
|
||||
"00DTI000005x7c7",
|
||||
"Sales_Central_TFN",
|
||||
"https://safelite2--qa.sandbox.my.site.com/ESWSalesCentralTFN1768832680884",
|
||||
{
|
||||
baseLiveAgentContentURL:
|
||||
"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,
|
||||
scrt2URL: "https://safelite2--qa.sandbox.my.salesforce-scrt.com",
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
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");
|
||||
} catch (err) {
|
||||
console.error("Error loading Embedded Messaging: ", err);
|
||||
}
|
||||
// END OF SALESFORCE GENERATED CODE
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,50 @@
|
|||
/* 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(
|
||||
modifyEmbeddedSvcCallback,
|
||||
finishedLoadingCallback,
|
||||
onWebchatOpenCallback,
|
||||
onWebchatCloseCallback
|
||||
) {
|
||||
modifyEmbeddedSvcCallback();
|
||||
window.addEventListener("onEmbeddedMessagingButtonCreated", finishedLoadingCallback);
|
||||
window.addEventListener("onEmbeddedMessagingWindowMaximized", onWebchatOpenCallback);
|
||||
window.addEventListener("onEmbeddedMessagingWindowClosed", onWebchatCloseCallback);
|
||||
}
|
||||
|
||||
export function initializeSalesforceWebchatForSys(
|
||||
modifyEmbeddedSvcCallback,
|
||||
finishedLoadingCallback,
|
||||
onWebchatOpenCallback,
|
||||
onWebchatCloseCallback
|
||||
) {
|
||||
setupCustomSettings(
|
||||
modifyEmbeddedSvcCallback,
|
||||
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'
|
||||
|
||||
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);
|
||||
}
|
||||
// END OF SALESFORCE GENERATED CODE
|
||||
}
|
||||
|
|
@ -2,10 +2,20 @@ import { shallowMount } from "@vue/test-utils";
|
|||
import salesforceWebchat from "./salesforce-webchat.vue";
|
||||
import * as devHelper from "./salesforce-helper-dev";
|
||||
import * as qaHelper from "./salesforce-helper-qa";
|
||||
import * as sysHelper from "./salesforce-helper-sys";
|
||||
import * as prodHelper from "./salesforce-helper-prod";
|
||||
import { applicationConfig } from "../../constants/application-config";
|
||||
|
||||
describe("salesforceWebchat.vue", () => {
|
||||
beforeEach(() => {
|
||||
window.embeddedservice_bootstrap = {
|
||||
settings: {},
|
||||
};
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
delete window.embeddedservice_bootstrap;
|
||||
});
|
||||
it("renders correctly", () => {
|
||||
const wrapper = shallowMount(salesforceWebchat);
|
||||
expect(wrapper.exists()).toBe(true);
|
||||
|
|
@ -14,7 +24,7 @@ describe("salesforceWebchat.vue", () => {
|
|||
it("has the correct default data", () => {
|
||||
const wrapper = shallowMount(salesforceWebchat);
|
||||
expect(wrapper.vm.$data).toEqual({
|
||||
isAgentAvailable: false,
|
||||
isWebchatLoaded: false,
|
||||
isWebchatOpen: false,
|
||||
});
|
||||
});
|
||||
|
|
@ -37,6 +47,12 @@ describe("salesforceWebchat.vue", () => {
|
|||
wrapper.vm.initializeSalesforceWebchat();
|
||||
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";
|
||||
wrapper = shallowMount(salesforceWebchat);
|
||||
const mockDev = jest.spyOn(devHelper, "initializeSalesforceWebchatForDev");
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
// Supporting files
|
||||
import { initializeSalesforceWebchatForDev } from "./salesforce-helper-dev";
|
||||
import { initializeSalesforceWebchatForQa } from "./salesforce-helper-qa";
|
||||
import { initializeSalesforceWebchatForSys } from "./salesforce-helper-sys";
|
||||
import { initializeSalesforceWebchatForProd } from "./salesforce-helper-prod";
|
||||
import { applicationConfig } from "@/constants/application-config";
|
||||
import { webchatHelper } from "@/helpers/webchat-helper";
|
||||
|
|
@ -16,7 +17,7 @@ export default {
|
|||
mixins: [analyticsMixin],
|
||||
data() {
|
||||
return {
|
||||
isAgentAvailable: false,
|
||||
isWebchatLoaded: false,
|
||||
isWebchatOpen: false,
|
||||
};
|
||||
},
|
||||
|
|
@ -33,28 +34,12 @@ export default {
|
|||
mounted() {
|
||||
// Load in script from salesforce CDN
|
||||
const script = document.createElement("script");
|
||||
script.src = "https://service.force.com/embeddedservice/5.0/esw.min.js";
|
||||
script.src = this.webChatScriptSrc;
|
||||
script.onload = this.initializeSalesforceWebchat;
|
||||
document.body.appendChild(script);
|
||||
|
||||
// Notify funnel-header about Salesforce chat open/close state
|
||||
this._salesforceChatOpenObserver = new MutationObserver(() => {
|
||||
const isOpen = !!document.querySelector(".embeddedServiceSidebar");
|
||||
window.dispatchEvent(
|
||||
new CustomEvent("salesforce-chat-visibility", { detail: { open: isOpen } })
|
||||
);
|
||||
});
|
||||
this._salesforceChatOpenObserver.observe(document.body, {
|
||||
childList: true,
|
||||
subtree: true,
|
||||
});
|
||||
},
|
||||
beforeUnmount() {
|
||||
// Clean up event listeners and observers
|
||||
window.removeEventListener(
|
||||
"salesforce-chat-visibility",
|
||||
this._handleSalesforceChatVisibility
|
||||
);
|
||||
window.removeEventListener("sierra-chat-transfer", this._handleSierraToSalesforceTransfer);
|
||||
if (this._salesforceChatOpenObserver) {
|
||||
this._salesforceChatOpenObserver.disconnect();
|
||||
|
|
@ -72,7 +57,6 @@ export default {
|
|||
);
|
||||
break;
|
||||
case "QA":
|
||||
case "SysTest":
|
||||
initializeSalesforceWebchatForQa(
|
||||
this.modifyEmbeddedSvcCallback,
|
||||
this.finishedLoadingCallback,
|
||||
|
|
@ -80,8 +64,17 @@ export default {
|
|||
this.onWebchatCloseCallback
|
||||
);
|
||||
break;
|
||||
case "SysTest":
|
||||
initializeSalesforceWebchatForSys(
|
||||
this.modifyEmbeddedSvcCallback,
|
||||
this.finishedLoadingCallback,
|
||||
this.onWebchatOpenCallback,
|
||||
this.onWebchatCloseCallback
|
||||
);
|
||||
break;
|
||||
case "Dev":
|
||||
case "Localhost":
|
||||
default:
|
||||
initializeSalesforceWebchatForDev(
|
||||
this.modifyEmbeddedSvcCallback,
|
||||
this.finishedLoadingCallback,
|
||||
|
|
@ -92,16 +85,13 @@ export default {
|
|||
}
|
||||
},
|
||||
modifyEmbeddedSvcCallback() {
|
||||
window.embedded_svc.settings.avatarImgURL = require("@/assets/img/salesforce-webchat/avatar_webchat.png");
|
||||
window.embedded_svc.settings.prechatBackgroundImgURL = require("@/assets/img/salesforce-webchat/safelite_logo_webchat.png");
|
||||
window.embedded_svc.settings.smallCompanyLogoImgURL = require("@/assets/img/salesforce-webchat/minimized_chat_bubble_webchat.png");
|
||||
window.embedded_svc.settings.displayHelpButton = false;
|
||||
window.embedded_svc.addEventHandler("onChatEstablished", () => {
|
||||
window.embeddedservice_bootstrap.settings.hideChatButtonOnLoad = true;
|
||||
window.addEventListener("onEmbeddedMessagingConversationStarted", () => {
|
||||
this.pushEventForChatsToGA("support_chat", "chat_opened", "Live Agent", true);
|
||||
});
|
||||
},
|
||||
finishedLoadingCallback(data) {
|
||||
this.isAgentAvailable = data.isAgentAvailable;
|
||||
this.isWebchatLoaded = true;
|
||||
this.updateShouldShowWebchatButton();
|
||||
},
|
||||
onWebchatOpenCallback() {
|
||||
|
|
@ -117,11 +107,27 @@ export default {
|
|||
updateShouldShowWebchatButton() {
|
||||
this.webchatGlobalNonpersistedState.showWebchatButton =
|
||||
!this.hideSalesforceWebchatLaunchButton &&
|
||||
this.isAgentAvailable &&
|
||||
this.isWebchatLoaded &&
|
||||
!this.isWebchatOpen;
|
||||
},
|
||||
},
|
||||
computed: {},
|
||||
computed: {
|
||||
webChatScriptSrc() {
|
||||
// These URLs are from the src tag on the script tag in the Salesforce generated code.
|
||||
switch (applicationConfig.CURRENT_ENVIRONMENT) {
|
||||
case "Prod":
|
||||
return "https://safelite2.my.site.com/ESWSalesCentralTFN1769108630294/assets/js/bootstrap.min.js";
|
||||
case "QA":
|
||||
return "https://safelite2--qa.sandbox.my.site.com/ESWSalesCentralTFN1768832680884/assets/js/bootstrap.min.js";
|
||||
case "SysTest":
|
||||
return "https://safelite2--sys.sandbox.my.site.com/ESWSalesCentralTFN1767797265631/assets/js/bootstrap.min.js";
|
||||
case "Dev":
|
||||
case "Localhost":
|
||||
default:
|
||||
return "https://safelite2--dev.sandbox.my.site.com/ESWSalesCentralTFN1755660094477/assets/js/bootstrap.min.js";
|
||||
}
|
||||
},
|
||||
},
|
||||
components: {},
|
||||
};
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -77,25 +77,4 @@ describe("sierraWebchat.vue", () => {
|
|||
expect.objectContaining({ type: "sierra-chat-transfer" })
|
||||
);
|
||||
});
|
||||
|
||||
it("handles sierra-chat-transfer event and starts Salesforce chat with prepopulated fields", () => {
|
||||
const transfer = {
|
||||
data: {
|
||||
first_name: "A",
|
||||
last_name: "B",
|
||||
email: "a@b.com",
|
||||
chat_summary: "summary",
|
||||
},
|
||||
};
|
||||
const event = new CustomEvent("sierra-chat-transfer", { detail: transfer });
|
||||
window.dispatchEvent(event);
|
||||
expect(window.sierraChat.closeChatModal).toHaveBeenCalled();
|
||||
expect(window.embedded_svc.settings.prepopulatedPrechatFields).toEqual({
|
||||
FirstName: "A",
|
||||
LastName: "B",
|
||||
Email: "a@b.com",
|
||||
Subject: "summary",
|
||||
});
|
||||
expect(window.embedded_svc.liveAgentAPI.startChat).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -139,8 +139,8 @@ export default {
|
|||
// Pass data to Salesforce chat if available
|
||||
const transfer = event.detail;
|
||||
if (
|
||||
window.embedded_svc &&
|
||||
typeof window.embedded_svc.bootstrapEmbeddedService === "function"
|
||||
window.embeddedservice_bootstrap &&
|
||||
typeof window.embeddedservice_bootstrap.bootstrapEmbeddedService === "function"
|
||||
) {
|
||||
if (
|
||||
transfer &&
|
||||
|
|
@ -149,29 +149,21 @@ export default {
|
|||
transfer.data.last_name &&
|
||||
transfer.data.email
|
||||
) {
|
||||
window.embedded_svc.settings.prepopulatedPrechatFields = {
|
||||
window.embeddedservice_bootstrap.prechatAPI.setHiddenPrechatFields({
|
||||
ScarlettAISummary: transfer.data.chat_summary,
|
||||
FirstName: transfer.data.first_name,
|
||||
LastName: transfer.data.last_name,
|
||||
Email: transfer.data.email,
|
||||
Subject: transfer.data.chat_summary,
|
||||
};
|
||||
window.embedded_svc.settings.extraPrechatFormDetails = [
|
||||
{
|
||||
label: "Scarlett AI Summary",
|
||||
value: transfer.data.chat_summary,
|
||||
transcriptFields: ["Scarlett_AI_Summary__c"],
|
||||
displayToAgent: true,
|
||||
},
|
||||
];
|
||||
});
|
||||
if (
|
||||
window.embedded_svc.liveAgentAPI &&
|
||||
typeof window.embedded_svc.liveAgentAPI.startChat === "function"
|
||||
window.embeddedservice_bootstrap.utilAPI &&
|
||||
typeof window.embeddedservice_bootstrap.utilAPI.launchChat === "function"
|
||||
) {
|
||||
window.embedded_svc.liveAgentAPI.startChat();
|
||||
window.embeddedservice_bootstrap.utilAPI.launchChat();
|
||||
return;
|
||||
}
|
||||
}
|
||||
window.embedded_svc.bootstrapEmbeddedService();
|
||||
window.embeddedservice_bootstrap.utilAPI.launchChat();
|
||||
}
|
||||
};
|
||||
window.addEventListener("sierra-chat-transfer", this._handleSierraTransfer);
|
||||
|
|
|
|||
|
|
@ -59,7 +59,6 @@ export default {
|
|||
return {
|
||||
globalAlertMessages: [],
|
||||
sierraChatOpen: false,
|
||||
salesforceChatOpen: false,
|
||||
isSalesforceTransferInProgress: false,
|
||||
isScrolled: false,
|
||||
};
|
||||
|
|
@ -84,10 +83,6 @@ export default {
|
|||
if (this.sierraChatOpen) {
|
||||
return false;
|
||||
}
|
||||
// Hide the chat icon if Salesforce chat is open or transfer is in progress
|
||||
if (this.salesforceChatOpen || this.isSalesforceTransferInProgress) {
|
||||
return false;
|
||||
}
|
||||
// Show if either Sierra is enabled or Salesforce button is available and not hidden by page
|
||||
return (
|
||||
(this.webchatGlobalNonpersistedState.shouldLaunchSierra ||
|
||||
|
|
@ -167,35 +162,9 @@ export default {
|
|||
// Listen for Sierra chat open/close events from sierra-webchat
|
||||
this._handleSierraChatVisibility = (event) => {
|
||||
this.sierraChatOpen = !!(event.detail && event.detail.open);
|
||||
if (this.sierraChatOpen) {
|
||||
this.isSalesforceTransferInProgress = false;
|
||||
}
|
||||
};
|
||||
window.addEventListener("sierra-chat-visibility", this._handleSierraChatVisibility);
|
||||
|
||||
// Listen for Salesforce chat open/close events from salesforce-webchat
|
||||
this._handleSalesforceChatVisibility = (event) => {
|
||||
this.salesforceChatOpen = !!(event.detail && event.detail.open === true);
|
||||
};
|
||||
window.addEventListener("salesforce-chat-visibility", this._handleSalesforceChatVisibility);
|
||||
|
||||
// Listen for transfer event to set transfer-in-progress flag
|
||||
this._handleSierraToSalesforceTransfer = () => {
|
||||
this.isSalesforceTransferInProgress = true;
|
||||
};
|
||||
window.addEventListener("sierra-chat-transfer", this._handleSierraToSalesforceTransfer);
|
||||
|
||||
// Reset transfer flag when Salesforce chat opens
|
||||
this._handleSalesforceChatOpened = (event) => {
|
||||
if (event.detail && event.detail.open === true) {
|
||||
this.isSalesforceTransferInProgress = false;
|
||||
this.salesforceChatOpen = true;
|
||||
} else {
|
||||
this.salesforceChatOpen = false;
|
||||
}
|
||||
};
|
||||
window.addEventListener("salesforce-chat-visibility", this._handleSalesforceChatOpened);
|
||||
|
||||
// Add scroll listener for header shadow effect
|
||||
this._handleScroll = () => {
|
||||
this.isScrolled = window.scrollY > 0;
|
||||
|
|
@ -205,12 +174,7 @@ export default {
|
|||
beforeUnmount() {
|
||||
window.removeEventListener("sierra-chat-closed", this._handleSierraChatClosed);
|
||||
window.removeEventListener("sierra-chat-visibility", this._handleSierraChatVisibility);
|
||||
window.removeEventListener(
|
||||
"salesforce-chat-visibility",
|
||||
this._handleSalesforceChatVisibility
|
||||
);
|
||||
window.removeEventListener("sierra-chat-transfer", this._handleSierraToSalesforceTransfer);
|
||||
window.removeEventListener("salesforce-chat-visibility", this._handleSalesforceChatOpened);
|
||||
window.removeEventListener("scroll", this._handleScroll);
|
||||
},
|
||||
};
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ export const webchatHelper = () => {
|
|||
if (webchatGlobalNonpersistedState.shouldLaunchSierra) {
|
||||
window.dispatchEvent(new CustomEvent("launch-sierra-webchat")); // launches the sierra chat
|
||||
} else {
|
||||
window.embedded_svc.bootstrapEmbeddedService(); // launches the salesForce prechat form
|
||||
window.embeddedservice_bootstrap.utilAPI.launchChat(); // launches the salesForce prechat form
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1840,6 +1840,20 @@ export default {
|
|||
const noMobileAvailableDays = experimentMixin.methods.getSettingValue(
|
||||
experimentSettings.SHOW_NO_MOBILE_AVAILABLE_DAYS
|
||||
);
|
||||
const mobileFirstPopupRepairSetting = experimentMixin.methods.getSettingValue(
|
||||
experimentSettings.SHOW_MOBILE_FIRST_POPUP_REPAIR
|
||||
);
|
||||
const mobileFirstPopupReplaceWithoutMsrSetting =
|
||||
experimentMixin.methods.getSettingValue(
|
||||
experimentSettings.SHOW_MOBILE_FIRST_POPUP_REPLACE_WITHOUT_MSR
|
||||
);
|
||||
const mobileFirstPopupReplaceWithMsrSetting =
|
||||
experimentMixin.methods.getSettingValue(
|
||||
experimentSettings.SHOW_MOBILE_FIRST_POPUP_REPLACE_WITH_MSR
|
||||
);
|
||||
|
||||
const order = this.$store.getters.order;
|
||||
const isRepair = order.damage.isRepair;
|
||||
|
||||
let preSelectedMobileAppointment = null;
|
||||
const todaysDate = getTodayDate();
|
||||
|
|
@ -1856,12 +1870,63 @@ export default {
|
|||
(new Date(firstMobilePMDate) - todaysDate) / (1000 * 60 * 60 * 24);
|
||||
|
||||
const shouldExposeMobileFirstAppointment = () => {
|
||||
return (
|
||||
const mobileFirstDaysCheck =
|
||||
(firstMobileAMDate &&
|
||||
numberOfDaysToFirstMobileAMDate <= noMobileAvailableDays) ||
|
||||
(firstMobilePMDate &&
|
||||
numberOfDaysToFirstMobilePMDate <= noMobileAvailableDays)
|
||||
);
|
||||
numberOfDaysToFirstMobilePMDate <= noMobileAvailableDays);
|
||||
debugLog("::: Mobile First Days Check:", mobileFirstDaysCheck);
|
||||
|
||||
if (
|
||||
mobileFirstPopupRepairSetting === "false" &&
|
||||
mobileFirstPopupReplaceWithoutMsrSetting === "false" &&
|
||||
mobileFirstPopupReplaceWithMsrSetting === "false"
|
||||
) {
|
||||
debugLog(
|
||||
"::: Mobile First Damage Popup settings are all false, using default check."
|
||||
);
|
||||
return mobileFirstDaysCheck;
|
||||
}
|
||||
|
||||
if (isRepair) {
|
||||
if (mobileFirstPopupRepairSetting === "true") {
|
||||
debugLog(
|
||||
"::: Mobile First Popup Repair setting is true, showing mobile first appointment for repair."
|
||||
);
|
||||
return mobileFirstDaysCheck;
|
||||
} else {
|
||||
debugLog(
|
||||
"::: Mobile First Popup Repair setting is false, not showing mobile first appointment for repair."
|
||||
);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.isMobileStaticRecalibrationApplicable) {
|
||||
if (mobileFirstPopupReplaceWithMsrSetting === "true") {
|
||||
debugLog(
|
||||
"::: Mobile First Popup Replace with MSR setting is true, showing mobile first appointment for replace with MSR."
|
||||
);
|
||||
return mobileFirstDaysCheck;
|
||||
} else {
|
||||
debugLog(
|
||||
"::: Mobile First Popup Replace with MSR setting is false, not showing mobile first appointment for replace with MSR."
|
||||
);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (mobileFirstPopupReplaceWithoutMsrSetting === "true") {
|
||||
debugLog(
|
||||
"::: Mobile First Popup Replace without MSR setting is true, showing mobile first appointment for replace without MSR."
|
||||
);
|
||||
return mobileFirstDaysCheck;
|
||||
} else {
|
||||
debugLog(
|
||||
"::: Mobile First Popup Replace without MSR setting is false, not showing mobile first appointment for replace without MSR."
|
||||
);
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
if (shouldExposeMobileFirstAppointment()) {
|
||||
|
|
|
|||
|
|
@ -95,9 +95,8 @@ describe("vin-lookup.vue", () => {
|
|||
it("Should call navigateForward() if the store carId does not match the vin response carId but does match previously enterted carId and forward button is clicked", async () => {
|
||||
// Arrange
|
||||
const { wrapper } = setupMocks({});
|
||||
mockOutPromises({ carId: "C11111" });
|
||||
mockOutPromises({ carId: "C11111" }); //this line in above tests affects this test, so adding to here too till we figure out how to isolate the calls
|
||||
|
||||
wrapper.vm.lookupVehicle = jest.fn().mockImplementation(() => vinPromise);
|
||||
wrapper.vm.navigateForward = jest.fn();
|
||||
wrapper.vm.previouslyEnteredCarId = "C11111";
|
||||
|
||||
|
|
@ -111,6 +110,7 @@ describe("vin-lookup.vue", () => {
|
|||
it("Should not call navigateForward() if zip service returns a non-serviceable flag", async () => {
|
||||
// Arrange
|
||||
const { wrapper } = setupMocks({});
|
||||
mockOutPromises({ carId: "C11111" }); //this line in above tests affects this test, so adding to here too till we figure out how to isolate the calls
|
||||
const zipValidationApiResponse = {
|
||||
data: {
|
||||
isServiceable: false,
|
||||
|
|
@ -135,6 +135,8 @@ describe("vin-lookup.vue", () => {
|
|||
it("Should not call navigateForward() when forward button is clicked but lookupVehicle errors out.", async () => {
|
||||
// Arrange
|
||||
const { wrapper } = setupMocks({});
|
||||
mockOutPromises({ carId: "C11111" }); //this line in above tests affects this test, so adding to here too till we figure out how to isolate the calls
|
||||
|
||||
wrapper.vm.vinTouched = true;
|
||||
wrapper.vm.vin = "foo";
|
||||
wrapper.vm.initialVin = "!foo";
|
||||
|
|
@ -164,6 +166,7 @@ describe("vin-lookup.vue", () => {
|
|||
isCarIdDifferent: true,
|
||||
isSelectedGlassAvailableForVehicle: false,
|
||||
});
|
||||
wrapper.vm.pageName = "vin-lookup";
|
||||
|
||||
// Act
|
||||
await wrapper.vm.navigateForward();
|
||||
|
|
@ -172,9 +175,7 @@ describe("vin-lookup.vue", () => {
|
|||
expect(wrapper.vm.$router.navigateWithSaving).toBeCalledTimes(1);
|
||||
expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledWith(
|
||||
navigationScenarios.SELECTED_VIN_WITH_MISMATCHED_GLASS,
|
||||
wrapper.vm.$route,
|
||||
expect.anything(),
|
||||
expect.anything()
|
||||
"vin-lookup"
|
||||
);
|
||||
});
|
||||
|
||||
|
|
@ -251,12 +252,14 @@ describe("vin-lookup.vue", () => {
|
|||
const { wrapper } = setupMocks({});
|
||||
|
||||
// Act
|
||||
const vinLookup = wrapper.findComponent('[data-test="vin-lookup-component"]');
|
||||
vinLookup.trigger("imageLookupError");
|
||||
const vinLookup = wrapper.findComponent({ ref: "vinLookupQuestion" });
|
||||
vinLookup.trigger("image-lookup-error");
|
||||
await wrapper.vm.$nextTick();
|
||||
|
||||
// Assert
|
||||
expect(wrapper.findAllComponents({ name: "alert" }).length).toBe(1);
|
||||
expect(wrapper.vm.displayVinScanFailedAlert).toBe(true);
|
||||
//TODO - Fix original check for alert box but should show if displayVinScanFailedAlert is true which I'm checking
|
||||
//expect(wrapper.findAllComponents({ cmsWidgetName: "AlertVinScanFailed" }).length).toBe(1);
|
||||
});
|
||||
|
||||
test("should hide the AlertNoService when displayNoServiceAlert is false", async () => {
|
||||
|
|
@ -277,6 +280,7 @@ describe("vin-lookup.vue", () => {
|
|||
});
|
||||
});
|
||||
|
||||
/*
|
||||
describe("getVinFromImage", () => {
|
||||
test("GetVinFromImage resolves with first valid VIN when any vins are returned.", async () => {
|
||||
// Arrange
|
||||
|
|
@ -289,7 +293,7 @@ describe("vin-lookup.vue", () => {
|
|||
|
||||
const storeMixin = {
|
||||
methods: {
|
||||
dispatchStoreAction: lookup,
|
||||
dispatchStoreActionWithLogging: lookup,
|
||||
},
|
||||
};
|
||||
|
||||
|
|
@ -354,6 +358,7 @@ describe("vin-lookup.vue", () => {
|
|||
await expect(promise).rejects.toEqual("An error occurred during the lookup.");
|
||||
});
|
||||
});
|
||||
*/
|
||||
});
|
||||
|
||||
function setupMocks({ customMountOptions }) {
|
||||
|
|
|
|||
|
|
@ -393,21 +393,18 @@ export default {
|
|||
|
||||
// Check if Service Zip entered is serviceable then save the ZIP info
|
||||
if (zipCodeData.isServiceable) {
|
||||
//Only save the zipCode, state, and zipCodeCtu if the zip changed or we lack zipCodeCtu
|
||||
if (
|
||||
this.$store.getters.order.serviceLocation.zipCode != this.serviceZipCode ||
|
||||
!this.$store.getters.order.serviceLocation.zipCodeCtu
|
||||
) {
|
||||
await this.dispatchStoreAction(
|
||||
storeActions.SAVE_SERVICE_ZIP_CODE_INFO,
|
||||
{
|
||||
state: zipCodeData.state,
|
||||
zipCode: this.serviceZipCode,
|
||||
zipCodeCtu: zipCodeData.zipCodeCtu,
|
||||
},
|
||||
false
|
||||
);
|
||||
}
|
||||
//Always save the service zip info even if it was not changed;
|
||||
// if it didn't change it doesn't alter other values and this makes it more consistent
|
||||
await this.dispatchStoreAction(
|
||||
storeActions.SAVE_SERVICE_ZIP_CODE_INFO,
|
||||
{
|
||||
state: zipCodeData.state,
|
||||
zipCode: this.serviceZipCode,
|
||||
zipCodeCtu: zipCodeData.zipCodeCtu,
|
||||
},
|
||||
false
|
||||
);
|
||||
|
||||
// if no value due to field being optional, blank both phone and email address
|
||||
if (!this.emailOrSms) {
|
||||
await this.dispatchStoreAction(storeActions.SAVE_PHONE_NUMBER, "", false);
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ export async function vehicleBeforeEnter(to, from) {
|
|||
if (zipData.isValid) {
|
||||
store.dispatch(storeActions.SAVE_SERVICE_ZIP_CODE_INFO, {
|
||||
zipCode: newZipFromQuerystring,
|
||||
state: zipData.state.state,
|
||||
state: zipData.state,
|
||||
zipCodeCtu: zipData.zipCodeCtu,
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue