Merge branch 'develop' into feature/CSR-2130
This commit is contained in:
commit
3bf4e4e47a
31 changed files with 605 additions and 261 deletions
|
|
@ -33,6 +33,9 @@ const queryStrings = {
|
||||||
SERVICE_ZIP: "servicezip",
|
SERVICE_ZIP: "servicezip",
|
||||||
EMAIL: "email",
|
EMAIL: "email",
|
||||||
IS_INSURANCE: "isinsurance",
|
IS_INSURANCE: "isinsurance",
|
||||||
|
VIN_SELECTION: "vinselection",
|
||||||
|
SERVICE_PACKAGE: "servicepackage",
|
||||||
|
NUMBER_OF_CHIPS: "numberofchips",
|
||||||
};
|
};
|
||||||
|
|
||||||
export { queryStrings };
|
export { queryStrings };
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,8 @@ const storeActions = {
|
||||||
|
|
||||||
CREATE_SUBMITTED_ORDER: "createSubmittedOrder",
|
CREATE_SUBMITTED_ORDER: "createSubmittedOrder",
|
||||||
RESET_SUBMITTED_ORDER: "resetSubmittedOrder",
|
RESET_SUBMITTED_ORDER: "resetSubmittedOrder",
|
||||||
RESET_IS_LEAD_GEN: "resetIsLeadGen",
|
RESET_LEADGEN_STATE: "resetLeadGenState",
|
||||||
|
CREATE_LEADGEN_STATE: "createLeadGenState",
|
||||||
};
|
};
|
||||||
|
|
||||||
export { storeActions };
|
export { storeActions };
|
||||||
|
|
|
||||||
|
|
@ -88,6 +88,28 @@ const storeMutations = {
|
||||||
// EXPERIMENT MUTATIONS
|
// EXPERIMENT MUTATIONS
|
||||||
UPDATE_EXPERIMENTS: "updateExperiments",
|
UPDATE_EXPERIMENTS: "updateExperiments",
|
||||||
UPDATE_TRIGGERED_SITE_ENTRY: "updateTriggeredSiteEntry",
|
UPDATE_TRIGGERED_SITE_ENTRY: "updateTriggeredSiteEntry",
|
||||||
|
|
||||||
|
// LEADGEN MUTATIONS
|
||||||
|
UPDATE_LEAD_GEN_YEAR: "updateLeadGenYear",
|
||||||
|
UPDATE_LEAD_GEN_MAKE: "updateLeadGenMake",
|
||||||
|
UPDATE_LEAD_GEN_MODEL: "updateLeadGenModel",
|
||||||
|
UPDATE_LEAD_GEN_STYLE: "updateLeadGenStyle",
|
||||||
|
UPDATE_LEAD_GEN_IS_REPAIR: "updateLeadGenIsRepair",
|
||||||
|
UPDATE_LEAD_GEN_NUMBER_OF_CHIPS: "updateLeadGenNumberOfChips",
|
||||||
|
UPDATE_LEAD_GEN_DAMAGE_TYPE: "updateLeadGenDamageType",
|
||||||
|
UPDATE_LEAD_GEN_ZIP_CODE: "updateLeadGenZipCode",
|
||||||
|
UPDATE_LEAD_GEN_EMAIL_ADDRESS: "updateLeadGenEmailAddress",
|
||||||
|
UPDATE_LEAD_GEN_IS_INSURANCE: "updateLeadGenIsInsurance",
|
||||||
|
UPDATE_LEAD_GEN_VIN_SELECTION: "updateLeadGenVinSelection",
|
||||||
|
UPDATE_LEAD_GEN_SERVICE_PACKAGE: "updateLeadGenServicePackage",
|
||||||
|
|
||||||
|
//RESET LEADGEN MUTATIONS
|
||||||
|
RESET_LEADGEN_VEHICLE_STATE: "resetLeadGenVehicleState",
|
||||||
|
RESETL_EADGEN_DAMAGE_STATE: "resetLeadGenDamageState",
|
||||||
|
RESET_LEADGEN_ESTIMATE_STATE: "resetLeadGenEstimateState",
|
||||||
|
RESET_LEADGEN_SERVICEZIP_STATE: "resetLeadGenServiceZipState",
|
||||||
|
RESET_LEADGEN_QUOTE_STATE: "resetLeadGenQuoteState",
|
||||||
|
RESET_IS_LEADGEN: "resetIsLeadGen",
|
||||||
};
|
};
|
||||||
|
|
||||||
export { storeMutations };
|
export { storeMutations };
|
||||||
|
|
|
||||||
15
src/helpers/duration-length-helper.js
Normal file
15
src/helpers/duration-length-helper.js
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
export function getDisplayTextForDurationLength(durationMinimum, durationMaximum) {
|
||||||
|
const isLongAppointment = durationMaximum >= 120;
|
||||||
|
const isDurationRange = durationMinimum !== durationMaximum;
|
||||||
|
|
||||||
|
const adjustedMinimum = isLongAppointment ? durationMinimum / 60 : durationMinimum;
|
||||||
|
const adjustedMaximum = isLongAppointment ? durationMaximum / 60 : durationMaximum;
|
||||||
|
|
||||||
|
const durationText = isDurationRange
|
||||||
|
? `${adjustedMinimum} - ${adjustedMaximum}`
|
||||||
|
: adjustedMinimum;
|
||||||
|
|
||||||
|
const unitText = isLongAppointment ? "hours" : "minutes";
|
||||||
|
|
||||||
|
return `${durationText} ${unitText}`;
|
||||||
|
}
|
||||||
24
src/helpers/duration-length-helper.spec.js
Normal file
24
src/helpers/duration-length-helper.spec.js
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
import { getDisplayTextForDurationLength } from "@/helpers/duration-length-helper";
|
||||||
|
|
||||||
|
describe("damage-length-helper.js", () => {
|
||||||
|
it("Should return the expected duration for the appointment in hours", () => {
|
||||||
|
// Arrange / Act
|
||||||
|
const durationMinimum = 60;
|
||||||
|
const durationMaximum = 120;
|
||||||
|
|
||||||
|
const duration = getDisplayTextForDurationLength(durationMinimum, durationMaximum);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(duration).toEqual("1 - 2 hours");
|
||||||
|
});
|
||||||
|
it("Should return the expected duration for the appointment in minutes", () => {
|
||||||
|
// Arrange / Act
|
||||||
|
const durationMinimum = 30;
|
||||||
|
const durationMaximum = 45;
|
||||||
|
|
||||||
|
const duration = getDisplayTextForDurationLength(durationMinimum, durationMaximum);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(duration).toEqual("30 - 45 minutes");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
@ -230,6 +230,15 @@ export function getHighestFullySatisfiedTier(glassToReplace, availableLineItems,
|
||||||
return highestSatisfiedPackage;
|
return highestSatisfiedPackage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getPackageNameByType(packageType) {
|
||||||
|
const package_names = {
|
||||||
|
glassonly: packageNames.TIER_ONE,
|
||||||
|
standard: packageNames.TIER_TWO,
|
||||||
|
premium: packageNames.TIER_THREE,
|
||||||
|
};
|
||||||
|
return package_names[packageType] || null;
|
||||||
|
}
|
||||||
|
|
||||||
function maxTier(tierA, tierB) {
|
function maxTier(tierA, tierB) {
|
||||||
if (tierA === packageNames.TIER_THREE || tierB === packageNames.TIER_THREE) {
|
if (tierA === packageNames.TIER_THREE || tierB === packageNames.TIER_THREE) {
|
||||||
return packageNames.TIER_THREE;
|
return packageNames.TIER_THREE;
|
||||||
|
|
|
||||||
|
|
@ -119,7 +119,7 @@ import { settleAllPromises } from "@/helpers/layout-helper";
|
||||||
import { storeActions } from "@/constants/store-actions";
|
import { storeActions } from "@/constants/store-actions";
|
||||||
import { routerParams } from "@/router/router-constants/router-params";
|
import { routerParams } from "@/router/router-constants/router-params";
|
||||||
import { getDamageString, isGlassAvailableForCarId } from "@/helpers/damage-helper";
|
import { getDamageString, isGlassAvailableForCarId } from "@/helpers/damage-helper";
|
||||||
|
import baseMixin from "@/mixins/base-mixin.js";
|
||||||
import store from "@/store";
|
import store from "@/store";
|
||||||
import vinPagesMixin from "@/mixins/vin-pages-mixin";
|
import vinPagesMixin from "@/mixins/vin-pages-mixin";
|
||||||
|
|
||||||
|
|
@ -150,6 +150,10 @@ export default {
|
||||||
// Call the "next" function to complete the transition to this page.
|
// Call the "next" function to complete the transition to this page.
|
||||||
next((vm) => {
|
next((vm) => {
|
||||||
vm.setCmsContent(resultMap.cmsContent);
|
vm.setCmsContent(resultMap.cmsContent);
|
||||||
|
if (store.getters.isLeadGen) {
|
||||||
|
baseMixin.methods.dispatchStoreAction(storeActions.RESET_LEADGEN_STATE);
|
||||||
|
baseMixin.methods.hideFmgLoadingModal();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,8 @@ beforeEach(() => {
|
||||||
startTime: "09:00",
|
startTime: "09:00",
|
||||||
endTime: "10:00",
|
endTime: "10:00",
|
||||||
routeCode: "000",
|
routeCode: "000",
|
||||||
|
jobMaxMinutes: "120",
|
||||||
|
jobMinMinutes: "60",
|
||||||
},
|
},
|
||||||
lineItems: {
|
lineItems: {
|
||||||
glassParts: [
|
glassParts: [
|
||||||
|
|
@ -360,6 +362,41 @@ describe("computed properties...", () => {
|
||||||
// Assert
|
// Assert
|
||||||
expect(testValue).toEqual("test1,<br/> test, AZ 12345");
|
expect(testValue).toEqual("test1,<br/> test, AZ 12345");
|
||||||
});
|
});
|
||||||
|
test("Appointment Duration should return text in expected format.", () => {
|
||||||
|
//Arrange
|
||||||
|
|
||||||
|
const { wrapper } = setupMocks({});
|
||||||
|
|
||||||
|
// Act
|
||||||
|
const testValue = wrapper.vm.AppointmentDuration;
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(testValue).toEqual("Duration: 1 - 2 hours");
|
||||||
|
});
|
||||||
|
test("Appointment Duration should return with correct duration values in expected format for hours.", () => {
|
||||||
|
//Arrange
|
||||||
|
store.getters.submittedOrder.schedule.jobMaxMinutes = 120;
|
||||||
|
store.getters.submittedOrder.schedule.jobMinMinutes = 60;
|
||||||
|
const { wrapper } = setupMocks({});
|
||||||
|
|
||||||
|
// Act
|
||||||
|
const testValue = wrapper.vm.AppointmentDuration;
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(testValue).toEqual("Duration: 1 - 2 hours");
|
||||||
|
});
|
||||||
|
test("Appointment Duration should return with correct duration values in expected format for minutes.", () => {
|
||||||
|
//Arrange
|
||||||
|
store.getters.submittedOrder.schedule.jobMaxMinutes = 45;
|
||||||
|
store.getters.submittedOrder.schedule.jobMinMinutes = 30;
|
||||||
|
const { wrapper } = setupMocks({});
|
||||||
|
|
||||||
|
// Act
|
||||||
|
const testValue = wrapper.vm.AppointmentDuration;
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(testValue).toEqual("Duration: 30 - 45 minutes");
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function setupMocks({ customMountOptions }) {
|
function setupMocks({ customMountOptions }) {
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,12 @@
|
||||||
:scheduleEndTime="ScheduleEndTime" />
|
:scheduleEndTime="ScheduleEndTime" />
|
||||||
|
|
||||||
<div class="appoinmenttext" v-html="AppointmentWordingText"></div>
|
<div class="appoinmenttext" v-html="AppointmentWordingText"></div>
|
||||||
|
|
||||||
|
<textBlock
|
||||||
|
:customText="AppointmentDuration"
|
||||||
|
justifyText="center"
|
||||||
|
typeStyle="medium"
|
||||||
|
class="duration-text-block" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<hr />
|
<hr />
|
||||||
|
|
@ -82,6 +88,7 @@ import vehicleBanner from "@/fmg-components/vehicle-banner/vehicle-banner";
|
||||||
import navbar from "@/fmg-components/nav-bar/nav-bar";
|
import navbar from "@/fmg-components/nav-bar/nav-bar";
|
||||||
import addToCalendar from "@/layouts/confirmation/add-to-calendar/add-to-calendar";
|
import addToCalendar from "@/layouts/confirmation/add-to-calendar/add-to-calendar";
|
||||||
import cart from "@/fmg-components/cart/cart";
|
import cart from "@/fmg-components/cart/cart";
|
||||||
|
import textBlock from "@/digital-components/text-block/text-block";
|
||||||
|
|
||||||
//Supporting files
|
//Supporting files
|
||||||
import baseMixin from "@/mixins/base-mixin.js";
|
import baseMixin from "@/mixins/base-mixin.js";
|
||||||
|
|
@ -97,6 +104,7 @@ import { deepClone } from "@/helpers/object-helper";
|
||||||
import { Form } from "vee-validate";
|
import { Form } from "vee-validate";
|
||||||
import { get12HourTimeFormat, get12HourTimeMobileFormat } from "@/helpers/date-helper";
|
import { get12HourTimeFormat, get12HourTimeMobileFormat } from "@/helpers/date-helper";
|
||||||
import { coverageStatus } from "@/constants/insurance";
|
import { coverageStatus } from "@/constants/insurance";
|
||||||
|
import { getDisplayTextForDurationLength } from "@/helpers/duration-length-helper";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "confirmation",
|
name: "confirmation",
|
||||||
|
|
@ -315,6 +323,11 @@ export default {
|
||||||
isPia() {
|
isPia() {
|
||||||
return store.getters.submittedOrder?.payment.isPia;
|
return store.getters.submittedOrder?.payment.isPia;
|
||||||
},
|
},
|
||||||
|
AppointmentDuration() {
|
||||||
|
const durationMaximum = store.getters.submittedOrder?.schedule?.jobMaxMinutes;
|
||||||
|
const durationMinimum = store.getters.submittedOrder?.schedule?.jobMinMinutes;
|
||||||
|
return "Duration: " + getDisplayTextForDurationLength(durationMinimum, durationMaximum);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
arePagePrerequisitesValid() {
|
arePagePrerequisitesValid() {
|
||||||
|
|
@ -365,6 +378,7 @@ export default {
|
||||||
vehicleBanner,
|
vehicleBanner,
|
||||||
addToCalendar,
|
addToCalendar,
|
||||||
cart,
|
cart,
|
||||||
|
textBlock,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ import { fetchCmsContentForPage } from "@/helpers/cms-content-helper";
|
||||||
import baseMixin from "../../mixins/base-mixin";
|
import baseMixin from "../../mixins/base-mixin";
|
||||||
import { vinLookupMethodSelections } from "@/constants/vin-lookup-method-selections.js";
|
import { vinLookupMethodSelections } from "@/constants/vin-lookup-method-selections.js";
|
||||||
import { experimentSettings } from "@/constants/experiments";
|
import { experimentSettings } from "@/constants/experiments";
|
||||||
|
import { nextTick } from "vue";
|
||||||
|
|
||||||
// Mock our module for promises.
|
// Mock our module for promises.
|
||||||
jest.mock("@/helpers/layout-helper.js", () => ({
|
jest.mock("@/helpers/layout-helper.js", () => ({
|
||||||
|
|
@ -213,20 +214,18 @@ describe("estimate.vue", () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("estimate.vue", () => {
|
describe("estimate.vue", () => {
|
||||||
test("should call forwardButtonAction if isLeadGen is true", async () => {
|
test("should call forwardButtonAction if isLeadGen is true and form is valid", async () => {
|
||||||
// update store with isLeadGen as true
|
|
||||||
store.commit(storeMutations.UPDATE_IS_LEAD_GEN, true);
|
store.commit(storeMutations.UPDATE_IS_LEAD_GEN, true);
|
||||||
|
store.commit(storeMutations.UPDATE_LEAD_GEN_VIN_SELECTION, "decline");
|
||||||
|
|
||||||
// Set up the component
|
// Set up the component
|
||||||
const { wrapper } = setupMocks({});
|
const { wrapper } = setupMocks({});
|
||||||
|
|
||||||
wrapper.vm.forwardButtonAction = jest.fn();
|
wrapper.vm.forwardButtonAction = jest.fn();
|
||||||
|
|
||||||
const nextFunction = jest.fn((c) => {
|
const nextFunction = jest.fn((c) => {
|
||||||
c(wrapper.vm);
|
c(wrapper.vm);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Set selectedVinLookupMethod to decline
|
|
||||||
wrapper.setData({ selectedVinLookupMethod: vinLookupMethodSelections.DECLINE });
|
|
||||||
|
|
||||||
// Call the method that contains the if-else logic
|
// Call the method that contains the if-else logic
|
||||||
await estimate.beforeRouteEnter.call(
|
await estimate.beforeRouteEnter.call(
|
||||||
wrapper.vm,
|
wrapper.vm,
|
||||||
|
|
@ -234,7 +233,12 @@ describe("estimate.vue", () => {
|
||||||
undefined,
|
undefined,
|
||||||
nextFunction
|
nextFunction
|
||||||
);
|
);
|
||||||
|
await wrapper.vm.$nextTick();
|
||||||
|
|
||||||
expect(nextFunction).toHaveBeenCalled();
|
expect(nextFunction).toHaveBeenCalled();
|
||||||
|
expect(baseMixin.methods.isFormValid).toHaveBeenCalled();
|
||||||
|
expect(baseMixin.methods.isFormValid()).toBe(true);
|
||||||
|
await wrapper.vm.$nextTick();
|
||||||
expect(wrapper.vm.forwardButtonAction).toHaveBeenCalled();
|
expect(wrapper.vm.forwardButtonAction).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
@ -247,6 +251,7 @@ function setupMocks({
|
||||||
{ Name: "Provide my VIN manually Most specific to your vehicle" },
|
{ Name: "Provide my VIN manually Most specific to your vehicle" },
|
||||||
{ Name: "Provide my license plate # Most accurate VIN match" },
|
{ Name: "Provide my license plate # Most accurate VIN match" },
|
||||||
{ Name: "Provide my home address Most convenient VIN match" },
|
{ Name: "Provide my home address Most convenient VIN match" },
|
||||||
|
{ Name: "I'd rather not share my VIN" },
|
||||||
],
|
],
|
||||||
FunnelFooterWidget = { ForwardButtonText: "test txt" },
|
FunnelFooterWidget = { ForwardButtonText: "test txt" },
|
||||||
mountOptionsMockData = {
|
mountOptionsMockData = {
|
||||||
|
|
@ -280,7 +285,7 @@ function setupMocks({
|
||||||
const apiPromise = Promise.resolve({ cmsContent });
|
const apiPromise = Promise.resolve({ cmsContent });
|
||||||
settleAllPromises.mockImplementation(() => apiPromise);
|
settleAllPromises.mockImplementation(() => apiPromise);
|
||||||
fetchCmsContentForPage.mockImplementation(() => Promise.resolve());
|
fetchCmsContentForPage.mockImplementation(() => Promise.resolve());
|
||||||
|
baseMixin.methods.isFormValid = jest.fn().mockReturnValue(true);
|
||||||
const mountOptions = getMountOptions({
|
const mountOptions = getMountOptions({
|
||||||
...mountOptionsMockData,
|
...mountOptionsMockData,
|
||||||
mixins: [baseMixin, mockMixin],
|
mixins: [baseMixin, mockMixin],
|
||||||
|
|
|
||||||
|
|
@ -63,6 +63,7 @@ import { navigateToHeritageFunnel } from "@/helpers/heritage-integration/navigat
|
||||||
import { saveSession } from "@/helpers/heritage-integration/order-helper.js";
|
import { saveSession } from "@/helpers/heritage-integration/order-helper.js";
|
||||||
import baseMixin from "@/mixins/base-mixin.js";
|
import baseMixin from "@/mixins/base-mixin.js";
|
||||||
import { queryStrings } from "@/constants/query-strings";
|
import { queryStrings } from "@/constants/query-strings";
|
||||||
|
import { nextTick } from "vue";
|
||||||
|
|
||||||
// Define Validation Rules
|
// Define Validation Rules
|
||||||
defineRule("zip-required", required(errorMessages.SERVICE_ZIP_REQUIRED));
|
defineRule("zip-required", required(errorMessages.SERVICE_ZIP_REQUIRED));
|
||||||
|
|
@ -128,7 +129,7 @@ export default {
|
||||||
|
|
||||||
const resultMap = await settleAllPromises(promiseResultMap);
|
const resultMap = await settleAllPromises(promiseResultMap);
|
||||||
|
|
||||||
next((vm) => {
|
next(async (vm) => {
|
||||||
if (resultMap.cmsContent.FunnelFooterWidget.ForwardButtonText.includes("|")) {
|
if (resultMap.cmsContent.FunnelFooterWidget.ForwardButtonText.includes("|")) {
|
||||||
const forwardTextOption =
|
const forwardTextOption =
|
||||||
resultMap.cmsContent.FunnelFooterWidget.ForwardButtonText.split("|");
|
resultMap.cmsContent.FunnelFooterWidget.ForwardButtonText.split("|");
|
||||||
|
|
@ -146,10 +147,24 @@ export default {
|
||||||
|
|
||||||
vm.setCmsContent(resultMap.cmsContent);
|
vm.setCmsContent(resultMap.cmsContent);
|
||||||
if (store.getters.isLeadGen) {
|
if (store.getters.isLeadGen) {
|
||||||
vm.selectedVinLookupMethod = vinLookupMethodSelections.DECLINE;
|
if (store.getters.leadGenEstimate.vinSelection) {
|
||||||
vm.forwardButtonAction();
|
vm.selectedVinLookupMethod = vinPagesMixin.methods.getVinlookupMethod(
|
||||||
|
store.getters.leadGenEstimate.vinSelection
|
||||||
|
);
|
||||||
|
await nextTick();
|
||||||
|
const isValid = await baseMixin.methods.isFormValid(vm.$refs.theForm);
|
||||||
|
if (isValid) {
|
||||||
|
vm.forwardButtonAction();
|
||||||
|
} else {
|
||||||
|
baseMixin.methods.dispatchStoreAction(storeActions.RESET_LEADGEN_STATE);
|
||||||
|
baseMixin.methods.hideFmgLoadingModal();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
baseMixin.methods.dispatchStoreAction(storeActions.RESET_LEADGEN_STATE);
|
||||||
|
baseMixin.methods.hideFmgLoadingModal();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
baseMixin.methods.dispatchStoreAction(storeActions.RESET_IS_LEAD_GEN);
|
baseMixin.methods.dispatchStoreAction(storeActions.RESET_LEADGEN_STATE);
|
||||||
baseMixin.methods.hideFmgLoadingModal();
|
baseMixin.methods.hideFmgLoadingModal();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,7 @@ export default {
|
||||||
vm.setCmsContent(resultMap.cmsContent);
|
vm.setCmsContent(resultMap.cmsContent);
|
||||||
vm.originalList = resultMap.insuranceCompanyList;
|
vm.originalList = resultMap.insuranceCompanyList;
|
||||||
if (store.getters.isLeadGen) {
|
if (store.getters.isLeadGen) {
|
||||||
baseMixin.methods.dispatchStoreAction(storeActions.RESET_IS_LEAD_GEN);
|
baseMixin.methods.dispatchStoreAction(storeActions.RESET_LEADGEN_STATE);
|
||||||
baseMixin.methods.hideFmgLoadingModal();
|
baseMixin.methods.hideFmgLoadingModal();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -112,7 +112,7 @@ import { getDamageString, isGlassAvailableForCarId } from "@/helpers/damage-help
|
||||||
import { routerParams } from "@/router/router-constants/router-params";
|
import { routerParams } from "@/router/router-constants/router-params";
|
||||||
import { required, regex } from "@/helpers/validation-rules";
|
import { required, regex } from "@/helpers/validation-rules";
|
||||||
import { Form, defineRule } from "vee-validate";
|
import { Form, defineRule } from "vee-validate";
|
||||||
|
import baseMixin from "@/mixins/base-mixin.js";
|
||||||
import store from "@/store";
|
import store from "@/store";
|
||||||
import vinPagesMixin from "@/mixins/vin-pages-mixin";
|
import vinPagesMixin from "@/mixins/vin-pages-mixin";
|
||||||
|
|
||||||
|
|
@ -148,6 +148,10 @@ export default {
|
||||||
// Call the "next" function to complete the transition to this page.
|
// Call the "next" function to complete the transition to this page.
|
||||||
next((vm) => {
|
next((vm) => {
|
||||||
vm.setCmsContent(resultMap.cmsContent);
|
vm.setCmsContent(resultMap.cmsContent);
|
||||||
|
if (store.getters.isLeadGen) {
|
||||||
|
baseMixin.methods.dispatchStoreAction(storeActions.RESET_LEADGEN_STATE);
|
||||||
|
baseMixin.methods.hideFmgLoadingModal();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ export default {
|
||||||
next((vm) => {
|
next((vm) => {
|
||||||
vm.setCmsContent(resultMap.cmsContent);
|
vm.setCmsContent(resultMap.cmsContent);
|
||||||
if (store.getters.isLeadGen) {
|
if (store.getters.isLeadGen) {
|
||||||
baseMixin.methods.dispatchStoreAction(storeActions.RESET_IS_LEAD_GEN);
|
baseMixin.methods.dispatchStoreAction(storeActions.RESET_LEADGEN_STATE);
|
||||||
baseMixin.methods.hideFmgLoadingModal();
|
baseMixin.methods.hideFmgLoadingModal();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -58,6 +58,9 @@ jest.mock("@/mixins/base-mixin", () => ({
|
||||||
filterOutFees(items) {
|
filterOutFees(items) {
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
|
isFormValid(form) {
|
||||||
|
return true;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
@ -66,6 +69,9 @@ const mockMixin = {
|
||||||
filterOutFees: jest.fn().mockImplementation(() => {
|
filterOutFees: jest.fn().mockImplementation(() => {
|
||||||
return null;
|
return null;
|
||||||
}),
|
}),
|
||||||
|
isFormValid: jest.fn().mockImplementation(() => {
|
||||||
|
return true;
|
||||||
|
}),
|
||||||
getSettingValue: jest.fn((settingName) => {
|
getSettingValue: jest.fn((settingName) => {
|
||||||
if (settingName === experimentSettings.SERVICE_PACKAGE_DISCOUNT) {
|
if (settingName === experimentSettings.SERVICE_PACKAGE_DISCOUNT) {
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -641,7 +647,7 @@ describe("quote.vue", () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
describe("quote.vue", () => {
|
describe("quote.vue", () => {
|
||||||
test("should call forwardButtonAction if isLeadGen is true and Insurance is true", async () => {
|
test("should call forwardButtonAction if isLeadGen and Insurance is true and form is valid", async () => {
|
||||||
// Set up the store with isLeadGen as true
|
// Set up the store with isLeadGen as true
|
||||||
|
|
||||||
store.getters = {
|
store.getters = {
|
||||||
|
|
@ -666,6 +672,10 @@ describe("quote.vue", () => {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
isLeadGen: true,
|
isLeadGen: true,
|
||||||
|
leadGenQuote: {
|
||||||
|
isInsurance: true,
|
||||||
|
servicePackage: "glassonly",
|
||||||
|
},
|
||||||
payment: {
|
payment: {
|
||||||
isInsurance: true,
|
isInsurance: true,
|
||||||
inactivePromos: [],
|
inactivePromos: [],
|
||||||
|
|
@ -693,72 +703,24 @@ describe("quote.vue", () => {
|
||||||
undefined,
|
undefined,
|
||||||
nextFunction
|
nextFunction
|
||||||
);
|
);
|
||||||
|
await nextTick();
|
||||||
expect(nextFunction).toHaveBeenCalled();
|
expect(nextFunction).toHaveBeenCalled();
|
||||||
|
expect(baseMixin.methods.isFormValid).toHaveBeenCalled();
|
||||||
|
expect(baseMixin.methods.isFormValid()).toBe(true);
|
||||||
|
await wrapper.vm.$nextTick();
|
||||||
expect(wrapper.vm.forwardButtonAction).toHaveBeenCalled();
|
expect(wrapper.vm.forwardButtonAction).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
test("should not call forwardButtonAction if isLeadGen is true and Insurance is false", async () => {
|
|
||||||
// Set up the store with isLeadGen as true
|
|
||||||
store.getters = {
|
|
||||||
lineItems: {
|
|
||||||
glassParts: ["item", "item2"],
|
|
||||||
},
|
|
||||||
order: {
|
|
||||||
lineItems: {
|
|
||||||
glassParts: ["item", "item2"],
|
|
||||||
},
|
|
||||||
serviceLocation: {
|
|
||||||
zipCode: "12345",
|
|
||||||
zipCodeCtu: "value",
|
|
||||||
},
|
|
||||||
damage: {
|
|
||||||
isRepair: false,
|
|
||||||
},
|
|
||||||
referralNumber: "1234567",
|
|
||||||
payment: {
|
|
||||||
isInsurance: null,
|
|
||||||
inactivePromos: [],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
isLeadGen: true,
|
|
||||||
payment: {
|
|
||||||
isInsurance: null,
|
|
||||||
inactivePromos: [],
|
|
||||||
},
|
|
||||||
vehicle: {
|
|
||||||
cardId: "123",
|
|
||||||
},
|
|
||||||
experimentSettings: {
|
|
||||||
settingName: "SERVICE_PACKAGE_DISCOUNT",
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
// Set up the component
|
|
||||||
const { wrapper } = setupMocks({});
|
|
||||||
wrapper.vm.$route = { query: null };
|
|
||||||
wrapper.vm.forwardButtonAction = jest.fn();
|
|
||||||
const nextFunction = jest.fn((c) => {
|
|
||||||
c(wrapper.vm);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Call the method that contains the if-else logic
|
|
||||||
await quote.beforeRouteEnter.call(
|
|
||||||
wrapper.vm,
|
|
||||||
{ query: { fmgPage: "quote" } },
|
|
||||||
undefined,
|
|
||||||
nextFunction
|
|
||||||
);
|
|
||||||
expect(wrapper.vm.forwardButtonAction).not.toHaveBeenCalled();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function setupMocks({ customMountOptions }) {
|
function setupMocks({ customMountOptions }) {
|
||||||
const mountOptions = getMountOptions({
|
const mountOptions = getMountOptions({
|
||||||
...customMountOptions,
|
...customMountOptions,
|
||||||
});
|
});
|
||||||
|
|
||||||
baseMixin.methods.hideFmgLoadingModal = jest.fn();
|
baseMixin.methods.hideFmgLoadingModal = jest.fn();
|
||||||
|
baseMixin.methods.isFormValid = jest.fn().mockReturnValue(true);
|
||||||
mountOptions.global.mocks["$store"] = store;
|
mountOptions.global.mocks["$store"] = store;
|
||||||
mountOptions["attachTo"] = document.body;
|
mountOptions["attachTo"] = document.body;
|
||||||
|
|
||||||
const wrapper = shallowMount(quote, mountOptions);
|
const wrapper = shallowMount(quote, mountOptions);
|
||||||
wrapper.vm.setCmsContent = jest.fn();
|
wrapper.vm.setCmsContent = jest.fn();
|
||||||
return { wrapper };
|
return { wrapper };
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@
|
||||||
:isInsuranceSelected="isInsuranceSelected"
|
:isInsuranceSelected="isInsuranceSelected"
|
||||||
@vapsItemsSelected="vapsItemsSelectedAction"
|
@vapsItemsSelected="vapsItemsSelectedAction"
|
||||||
@servicePackageDiscountSelected="servicePackageDiscountSelectedAction"
|
@servicePackageDiscountSelected="servicePackageDiscountSelectedAction"
|
||||||
|
:servicePackage="servicePackage"
|
||||||
:activePromos="lineItems.promos"
|
:activePromos="lineItems.promos"
|
||||||
v-on="{ 'buttonEvent.openModal': openModalAction }"
|
v-on="{ 'buttonEvent.openModal': openModalAction }"
|
||||||
validationRules="option-required"
|
validationRules="option-required"
|
||||||
|
|
@ -124,6 +125,7 @@ import promoModalQuestion from "@/fmg-components/promo-modal-question/promo-moda
|
||||||
import { experimentSettings } from "@/constants/experiments";
|
import { experimentSettings } from "@/constants/experiments";
|
||||||
import { partTypeStrings } from "@/constants/part-type-strings";
|
import { partTypeStrings } from "@/constants/part-type-strings";
|
||||||
import { containsLineItemWithPartType } from "@/helpers/service-package-helper";
|
import { containsLineItemWithPartType } from "@/helpers/service-package-helper";
|
||||||
|
import { nextTick } from "vue";
|
||||||
defineRule("option-required", required(errorMessages.OPTION_REQUIRED));
|
defineRule("option-required", required(errorMessages.OPTION_REQUIRED));
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|
@ -245,7 +247,7 @@ export default {
|
||||||
// End of promo logic
|
// End of promo logic
|
||||||
|
|
||||||
// Call the "next" function to complete the transition to this page.
|
// Call the "next" function to complete the transition to this page.
|
||||||
next((vm) => {
|
next(async (vm) => {
|
||||||
vm.setCmsContent(resultMap.cmsContent);
|
vm.setCmsContent(resultMap.cmsContent);
|
||||||
vm.addableVaps = addableVaps;
|
vm.addableVaps = addableVaps;
|
||||||
vm.lineItems = lineItems;
|
vm.lineItems = lineItems;
|
||||||
|
|
@ -271,14 +273,23 @@ export default {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (store.getters.isLeadGen) {
|
if (store.getters.isLeadGen) {
|
||||||
if (store.getters.order.payment.isInsurance == true) {
|
if (store.getters.leadGenQuote.isInsurance == true) {
|
||||||
vm.forwardButtonAction();
|
vm.isInsuranceSelected = true;
|
||||||
|
vm.servicePackage = store.getters.leadGenQuote.servicePackage;
|
||||||
|
await nextTick();
|
||||||
|
const isValid = await baseMixin.methods.isFormValid(vm.$refs.theForm);
|
||||||
|
if (isValid) {
|
||||||
|
vm.forwardButtonAction();
|
||||||
|
} else {
|
||||||
|
baseMixin.methods.dispatchStoreAction(storeActions.RESET_LEADGEN_STATE);
|
||||||
|
baseMixin.methods.hideFmgLoadingModal();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
baseMixin.methods.dispatchStoreAction(storeActions.RESET_IS_LEAD_GEN);
|
baseMixin.methods.dispatchStoreAction(storeActions.RESET_LEADGEN_STATE);
|
||||||
baseMixin.methods.hideFmgLoadingModal();
|
baseMixin.methods.hideFmgLoadingModal();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
baseMixin.methods.dispatchStoreAction(storeActions.RESET_IS_LEAD_GEN);
|
baseMixin.methods.dispatchStoreAction(storeActions.RESET_LEADGEN_STATE);
|
||||||
baseMixin.methods.hideFmgLoadingModal();
|
baseMixin.methods.hideFmgLoadingModal();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -289,6 +300,7 @@ export default {
|
||||||
availableLineItems: null,
|
availableLineItems: null,
|
||||||
lineItems: [],
|
lineItems: [],
|
||||||
addableVaps: [],
|
addableVaps: [],
|
||||||
|
servicePackage: null,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
|
@ -454,7 +466,12 @@ export default {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
<style scoped>
|
<style>
|
||||||
|
.funnel-sub-header {
|
||||||
|
p {
|
||||||
|
font-size: 1rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
.text-block {
|
.text-block {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@ import {
|
||||||
getPackageContents,
|
getPackageContents,
|
||||||
containsLineItemWithPartType,
|
containsLineItemWithPartType,
|
||||||
findLineItemsWithPartType,
|
findLineItemsWithPartType,
|
||||||
|
getPackageNameByType,
|
||||||
} from "@/helpers/service-package-helper";
|
} from "@/helpers/service-package-helper";
|
||||||
import {
|
import {
|
||||||
getPromosThatMatchLineItemsOnOrder,
|
getPromosThatMatchLineItemsOnOrder,
|
||||||
|
|
@ -47,6 +48,7 @@ export default {
|
||||||
isInsuranceSelected: Boolean,
|
isInsuranceSelected: Boolean,
|
||||||
availableLineItems: null,
|
availableLineItems: null,
|
||||||
activePromos: null,
|
activePromos: null,
|
||||||
|
servicePackage: null,
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|
@ -58,7 +60,8 @@ export default {
|
||||||
availableLineItems() {
|
availableLineItems() {
|
||||||
if (
|
if (
|
||||||
this.$store.getters.payment.isInsurance != null ||
|
this.$store.getters.payment.isInsurance != null ||
|
||||||
getPromosWithAddableVaps(this.activePromos).length
|
getPromosWithAddableVaps(this.activePromos).length ||
|
||||||
|
this.servicePackage != null
|
||||||
) {
|
) {
|
||||||
this.selectDefaultPackage();
|
this.selectDefaultPackage();
|
||||||
}
|
}
|
||||||
|
|
@ -293,6 +296,9 @@ export default {
|
||||||
return price;
|
return price;
|
||||||
},
|
},
|
||||||
selectDefaultPackage() {
|
selectDefaultPackage() {
|
||||||
|
if (this.servicePackage != null) {
|
||||||
|
return (this.selectedPackageName = getPackageNameByType(this.servicePackage));
|
||||||
|
}
|
||||||
const promosWithAddableVaps = getPromosWithAddableVaps(this.activePromos);
|
const promosWithAddableVaps = getPromosWithAddableVaps(this.activePromos);
|
||||||
const vapsThatMatchPromos = getLineItemsThatMatchPromos(
|
const vapsThatMatchPromos = getLineItemsThatMatchPromos(
|
||||||
promosWithAddableVaps,
|
promosWithAddableVaps,
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@
|
||||||
class="strikethrough-price"
|
class="strikethrough-price"
|
||||||
v-if="shouldDisplayStrikeThroughPrice"
|
v-if="shouldDisplayStrikeThroughPrice"
|
||||||
v-html="this.additionalButtonData.strikeThroughPrice"></span>
|
v-html="this.additionalButtonData.strikeThroughPrice"></span>
|
||||||
<span v-html="this.buttonAuxillaryCopy"></span>*
|
<span v-html="this.buttonAuxillaryCopy"></span>
|
||||||
</span>
|
</span>
|
||||||
</p>
|
</p>
|
||||||
<p
|
<p
|
||||||
|
|
@ -150,9 +150,11 @@ export default {
|
||||||
display: block;
|
display: block;
|
||||||
@include media-breakpoint-up(md) {
|
@include media-breakpoint-up(md) {
|
||||||
display: flex;
|
display: flex;
|
||||||
min-height: 320px;
|
min-height: 336px;
|
||||||
}
|
}
|
||||||
@include media-breakpoint-up(xl) {
|
//Unique breakpoint for this page only to accommodate price spacing issues
|
||||||
|
//from use of position: absolute on .service-package-discount (per Design Team request)
|
||||||
|
@media only screen and (min-width: 860px) {
|
||||||
display: flex;
|
display: flex;
|
||||||
min-height: 276px;
|
min-height: 276px;
|
||||||
}
|
}
|
||||||
|
|
@ -336,7 +338,6 @@ export default {
|
||||||
margin: 1rem 0 0 -15px;
|
margin: 1rem 0 0 -15px;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
li {
|
li {
|
||||||
margin-bottom: 0.5rem;
|
|
||||||
font-size: 0.875rem;
|
font-size: 0.875rem;
|
||||||
line-height: 1.714;
|
line-height: 1.714;
|
||||||
color: $gray-550;
|
color: $gray-550;
|
||||||
|
|
|
||||||
|
|
@ -60,19 +60,3 @@ export function militaryToTwelveHourTime(timeString) {
|
||||||
|
|
||||||
return `${hours}:${minutes} ${meridianNotation}`;
|
return `${hours}:${minutes} ${meridianNotation}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getDisplayTextForDurationLength(durationMinimum, durationMaximum) {
|
|
||||||
const isLongAppointment = durationMaximum >= 120;
|
|
||||||
const isDurationRange = durationMinimum !== durationMaximum;
|
|
||||||
|
|
||||||
const adjustedMinimum = isLongAppointment ? durationMinimum / 60 : durationMinimum;
|
|
||||||
const adjustedMaximum = isLongAppointment ? durationMaximum / 60 : durationMaximum;
|
|
||||||
|
|
||||||
const durationText = isDurationRange
|
|
||||||
? `${adjustedMinimum} - ${adjustedMaximum}`
|
|
||||||
: adjustedMinimum;
|
|
||||||
|
|
||||||
const unitText = isLongAppointment ? "hours" : "minutes";
|
|
||||||
|
|
||||||
return `${durationText} ${unitText}`;
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -51,8 +51,8 @@ import { deepClone } from "@/helpers/object-helper";
|
||||||
import {
|
import {
|
||||||
convertDateStringToDate,
|
convertDateStringToDate,
|
||||||
militaryToTwelveHourTime,
|
militaryToTwelveHourTime,
|
||||||
getDisplayTextForDurationLength,
|
|
||||||
} from "@/layouts/schedule/helpers/schedule-helper";
|
} from "@/layouts/schedule/helpers/schedule-helper";
|
||||||
|
import { getDisplayTextForDurationLength } from "@/helpers/duration-length-helper";
|
||||||
|
|
||||||
// Validation - TODO: Move this somewhere more global?
|
// Validation - TODO: Move this somewhere more global?
|
||||||
import { defineRule, useField } from "vee-validate";
|
import { defineRule, useField } from "vee-validate";
|
||||||
|
|
|
||||||
|
|
@ -165,6 +165,10 @@ function resetMockStoreData() {
|
||||||
jobMaxMinutes: null,
|
jobMaxMinutes: null,
|
||||||
jobMinMinutes: null,
|
jobMinMinutes: null,
|
||||||
},
|
},
|
||||||
|
leadGenServiceZip: {
|
||||||
|
zipCode: null,
|
||||||
|
emailAddress: null,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -175,6 +179,7 @@ function applyMockStoreDataToGetters() {
|
||||||
damage: mockStoreData.damage,
|
damage: mockStoreData.damage,
|
||||||
payment: mockStoreData.payment,
|
payment: mockStoreData.payment,
|
||||||
policy: mockStoreData.policy,
|
policy: mockStoreData.policy,
|
||||||
|
leadGenServiceZip: mockStoreData.leadGenServiceZip,
|
||||||
};
|
};
|
||||||
store.state.order = mockStoreData;
|
store.state.order = mockStoreData;
|
||||||
store.state.applicationUser.experiments = mockExperimentSettings;
|
store.state.applicationUser.experiments = mockExperimentSettings;
|
||||||
|
|
@ -416,9 +421,7 @@ describe("service-zip.vue", () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
// Mock the isFormValid method
|
// Mock the isFormValid method
|
||||||
wrapper.vm.isFormValid = jest.fn().mockImplementation(() => {
|
baseMixin.methods.isFormValid = jest.fn().mockReturnValue(true);
|
||||||
return true;
|
|
||||||
});
|
|
||||||
|
|
||||||
// Call the method that contains the if-else logic
|
// Call the method that contains the if-else logic
|
||||||
await serviceZip.beforeRouteEnter.call(
|
await serviceZip.beforeRouteEnter.call(
|
||||||
|
|
@ -442,7 +445,7 @@ describe("service-zip.vue", () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
// Mock the isFormValid method
|
// Mock the isFormValid method
|
||||||
wrapper.vm.isFormValid = jest.fn().mockImplementation(() => {
|
baseMixin.methods.isFormValid = jest.fn().mockImplementation(() => {
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -463,6 +466,7 @@ function setupMocks({ customMountOptions, customZipQuery, customZipDataResponse
|
||||||
route.query.zipcode = customZipQuery;
|
route.query.zipcode = customZipQuery;
|
||||||
}
|
}
|
||||||
baseMixin.methods.hideFmgLoadingModal = jest.fn();
|
baseMixin.methods.hideFmgLoadingModal = jest.fn();
|
||||||
|
|
||||||
const mountOptions = getMountOptions({
|
const mountOptions = getMountOptions({
|
||||||
...customMountOptions,
|
...customMountOptions,
|
||||||
route: route,
|
route: route,
|
||||||
|
|
|
||||||
|
|
@ -134,11 +134,11 @@ export default {
|
||||||
next(async (vm) => {
|
next(async (vm) => {
|
||||||
vm.setCmsContent(resultMap.cmsContent);
|
vm.setCmsContent(resultMap.cmsContent);
|
||||||
if (store.getters.isLeadGen) {
|
if (store.getters.isLeadGen) {
|
||||||
const isValid = await vm.isFormValid();
|
const isValid = await baseMixin.methods.isFormValid(vm.$refs.theForm);
|
||||||
if (isValid) {
|
if (isValid) {
|
||||||
vm.forwardButtonAction();
|
vm.forwardButtonAction();
|
||||||
} else {
|
} else {
|
||||||
baseMixin.methods.dispatchStoreAction(storeActions.RESET_IS_LEAD_GEN);
|
baseMixin.methods.dispatchStoreAction(storeActions.RESET_LEADGEN_STATE);
|
||||||
baseMixin.methods.hideFmgLoadingModal();
|
baseMixin.methods.hideFmgLoadingModal();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -146,10 +146,16 @@ export default {
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getZipFromStore() {
|
getZipFromStore() {
|
||||||
return store.getters.order.serviceLocation.zipCode;
|
return (
|
||||||
|
store.getters.leadGenServiceZip.zipCode ??
|
||||||
|
store.getters.order.serviceLocation.zipCode
|
||||||
|
);
|
||||||
},
|
},
|
||||||
getEmailFromStore() {
|
getEmailFromStore() {
|
||||||
return store.getters.order.customer.emailAddress;
|
return (
|
||||||
|
store.getters.leadGenServiceZip.emailAddress ??
|
||||||
|
store.getters.order.customer.emailAddress
|
||||||
|
);
|
||||||
},
|
},
|
||||||
arePagePrerequisitesValid() {
|
arePagePrerequisitesValid() {
|
||||||
return store.getters.damage.isRepair || store.getters.damage.glassToReplace?.length > 0;
|
return store.getters.damage.isRepair || store.getters.damage.glassToReplace?.length > 0;
|
||||||
|
|
@ -185,7 +191,7 @@ export default {
|
||||||
if (!zipCodeData.isValid) {
|
if (!zipCodeData.isValid) {
|
||||||
this.displayInvalidZipAlert = true;
|
this.displayInvalidZipAlert = true;
|
||||||
if (store.getters.isLeadGen) {
|
if (store.getters.isLeadGen) {
|
||||||
baseMixin.methods.dispatchStoreAction(storeActions.RESET_IS_LEAD_GEN);
|
baseMixin.methods.dispatchStoreAction(storeActions.RESET_LEADGEN_STATE);
|
||||||
baseMixin.methods.hideFmgLoadingModal();
|
baseMixin.methods.hideFmgLoadingModal();
|
||||||
}
|
}
|
||||||
return this.$refs.navbar.removeLoader();
|
return this.$refs.navbar.removeLoader();
|
||||||
|
|
@ -195,7 +201,7 @@ export default {
|
||||||
if (!zipCodeData.isServiceable) {
|
if (!zipCodeData.isServiceable) {
|
||||||
this.displayNonServiceableZipAlert = true;
|
this.displayNonServiceableZipAlert = true;
|
||||||
if (store.getters.isLeadGen) {
|
if (store.getters.isLeadGen) {
|
||||||
baseMixin.methods.dispatchStoreAction(storeActions.RESET_IS_LEAD_GEN);
|
baseMixin.methods.dispatchStoreAction(storeActions.RESET_LEADGEN_STATE);
|
||||||
baseMixin.methods.hideFmgLoadingModal();
|
baseMixin.methods.hideFmgLoadingModal();
|
||||||
}
|
}
|
||||||
return this.$refs.navbar.removeLoader();
|
return this.$refs.navbar.removeLoader();
|
||||||
|
|
@ -250,11 +256,6 @@ export default {
|
||||||
await this.navigateForwardWithSingleCarMatch();
|
await this.navigateForwardWithSingleCarMatch();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async isFormValid() {
|
|
||||||
const form = this.$refs.theForm;
|
|
||||||
const formValidateResponse = await form.validate();
|
|
||||||
return formValidateResponse?.valid;
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
AlertNonServiceableZipHeader() {
|
AlertNonServiceableZipHeader() {
|
||||||
|
|
|
||||||
|
|
@ -67,6 +67,11 @@ jest.mock("@/store", () => ({
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
isLeadGen: false,
|
isLeadGen: false,
|
||||||
|
leadGenDamage: {
|
||||||
|
damageType: null,
|
||||||
|
isRepair: null,
|
||||||
|
numberOfChips: null,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
@ -148,6 +153,11 @@ describe("vehicle-damage.vue", () => {
|
||||||
getters: {
|
getters: {
|
||||||
vehicle: {},
|
vehicle: {},
|
||||||
payment: { insuranceCoverage: { isVerified: false } },
|
payment: { insuranceCoverage: { isVerified: false } },
|
||||||
|
leadGenDamage: {
|
||||||
|
damageType: null,
|
||||||
|
isRepair: null,
|
||||||
|
numberOfChips: null,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
@ -183,6 +193,7 @@ describe("vehicle-damage.vue", () => {
|
||||||
(c) => c(wrapper.vm)
|
(c) => c(wrapper.vm)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
wrapper.vm.isFormValid = jest.fn();
|
||||||
await wrapper.vm.forwardButtonAction();
|
await wrapper.vm.forwardButtonAction();
|
||||||
|
|
||||||
//Assert
|
//Assert
|
||||||
|
|
@ -257,6 +268,11 @@ describe("vehicle-damage.vue", () => {
|
||||||
getters: {
|
getters: {
|
||||||
vehicle: {},
|
vehicle: {},
|
||||||
payment: { insuranceCoverage: { isVerified: false } },
|
payment: { insuranceCoverage: { isVerified: false } },
|
||||||
|
leadGenDamage: {
|
||||||
|
damageType: null,
|
||||||
|
isRepair: null,
|
||||||
|
numberOfChips: null,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
@ -278,7 +294,7 @@ describe("vehicle-damage.vue", () => {
|
||||||
undefined,
|
undefined,
|
||||||
(c) => c(wrapper.vm)
|
(c) => c(wrapper.vm)
|
||||||
);
|
);
|
||||||
|
wrapper.vm.isFormValid = jest.fn();
|
||||||
await wrapper.vm.forwardButtonAction();
|
await wrapper.vm.forwardButtonAction();
|
||||||
|
|
||||||
//Assert
|
//Assert
|
||||||
|
|
@ -540,6 +556,11 @@ describe("vehicle-damage.vue", () => {
|
||||||
eventBusItem: jest.fn(),
|
eventBusItem: jest.fn(),
|
||||||
damage: { glassToReplace: [{ glassLocation: damageLocation }] },
|
damage: { glassToReplace: [{ glassLocation: damageLocation }] },
|
||||||
isRepair: true,
|
isRepair: true,
|
||||||
|
leadGenDamage: {
|
||||||
|
damageType: null,
|
||||||
|
isRepair: null,
|
||||||
|
numberOfChips: null,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
var glassSelections = wrapper.vm.getDamageLocationsFromStore();
|
var glassSelections = wrapper.vm.getDamageLocationsFromStore();
|
||||||
|
|
@ -617,6 +638,11 @@ describe("vehicle-damage.vue", () => {
|
||||||
isRepair: isRepair,
|
isRepair: isRepair,
|
||||||
numberOfChips: 2,
|
numberOfChips: 2,
|
||||||
},
|
},
|
||||||
|
leadGenDamage: {
|
||||||
|
damageType: null,
|
||||||
|
isRepair: null,
|
||||||
|
numberOfChips: null,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
var windshieldSelections = wrapper.vm.getWindshieldOptionsFromStore();
|
var windshieldSelections = wrapper.vm.getWindshieldOptionsFromStore();
|
||||||
|
|
@ -653,6 +679,11 @@ describe("vehicle-damage.vue", () => {
|
||||||
glassToReplace: [{ glassLocation: damageLocation, glassName: damageName }],
|
glassToReplace: [{ glassLocation: damageLocation, glassName: damageName }],
|
||||||
},
|
},
|
||||||
isRepair: true,
|
isRepair: true,
|
||||||
|
leadGenDamage: {
|
||||||
|
damageType: null,
|
||||||
|
isRepair: null,
|
||||||
|
numberOfChips: null,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
var glassSelections = wrapper.vm.getDriverSideReplaceOptionsFromStore();
|
var glassSelections = wrapper.vm.getDriverSideReplaceOptionsFromStore();
|
||||||
|
|
@ -689,6 +720,11 @@ describe("vehicle-damage.vue", () => {
|
||||||
glassToReplace: [{ glassLocation: damageLocation, glassName: damageName }],
|
glassToReplace: [{ glassLocation: damageLocation, glassName: damageName }],
|
||||||
},
|
},
|
||||||
isRepair: true,
|
isRepair: true,
|
||||||
|
leadGenDamage: {
|
||||||
|
damageType: null,
|
||||||
|
isRepair: null,
|
||||||
|
numberOfChips: null,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
var glassSelections = wrapper.vm.getPassengerSideReplaceOptionsFromStore();
|
var glassSelections = wrapper.vm.getPassengerSideReplaceOptionsFromStore();
|
||||||
|
|
@ -723,6 +759,11 @@ describe("vehicle-damage.vue", () => {
|
||||||
glassToReplace: [{ glassLocation: damageLocation, glassName: damageName }],
|
glassToReplace: [{ glassLocation: damageLocation, glassName: damageName }],
|
||||||
},
|
},
|
||||||
isRepair: true,
|
isRepair: true,
|
||||||
|
leadGenDamage: {
|
||||||
|
damageType: null,
|
||||||
|
isRepair: null,
|
||||||
|
numberOfChips: null,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
var glassSelections = wrapper.vm.getRearReplaceOptionsFromStore();
|
var glassSelections = wrapper.vm.getRearReplaceOptionsFromStore();
|
||||||
|
|
@ -744,6 +785,11 @@ describe("vehicle-damage.vue", () => {
|
||||||
vehicle: {},
|
vehicle: {},
|
||||||
payment: { insuranceCoverage: { isVerified: true } },
|
payment: { insuranceCoverage: { isVerified: true } },
|
||||||
requiresVerifiedRedirecting: true,
|
requiresVerifiedRedirecting: true,
|
||||||
|
leadGenDamage: {
|
||||||
|
damageType: null,
|
||||||
|
isRepair: null,
|
||||||
|
numberOfChips: null,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
@ -763,20 +809,24 @@ describe("vehicle-damage.vue", () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("vehicle-damage.vue", () => {
|
describe("vehicle-damage.vue", () => {
|
||||||
test("should call forwardButtonAction if isLeadGen is true and selectedDamageLocations is not empty", async () => {
|
test("should call forwardButtonAction if isLeadGen is true and form is valid", async () => {
|
||||||
// Set up the store with isLeadGen as true
|
// Set up the store with isLeadGen as true
|
||||||
store.getters.isLeadGen = true;
|
store.getters.isLeadGen = true;
|
||||||
|
store.getters.leadGenDamage = {
|
||||||
|
damageType: "windshieldReplace",
|
||||||
|
isRepair: false,
|
||||||
|
numberOfChips: null,
|
||||||
|
};
|
||||||
|
|
||||||
// Set up the component
|
// Set up the component
|
||||||
const { wrapper } = setupMocks({});
|
const { wrapper } = setupMocks({});
|
||||||
wrapper.vm.forwardButtonAction = jest.fn();
|
wrapper.vm.forwardButtonAction = jest.fn();
|
||||||
|
|
||||||
|
baseMixin.methods.isFormValid = jest.fn().mockReturnValue(true);
|
||||||
const nextFunction = jest.fn((c) => {
|
const nextFunction = jest.fn((c) => {
|
||||||
c(wrapper.vm);
|
c(wrapper.vm);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Set selectedDamageLocations
|
|
||||||
wrapper.setData({ selectedDamageLocations: ["windshield"] });
|
|
||||||
|
|
||||||
// Call the method that contains the if-else logic
|
// Call the method that contains the if-else logic
|
||||||
await vehicleDamage.beforeRouteEnter.call(
|
await vehicleDamage.beforeRouteEnter.call(
|
||||||
wrapper.vm,
|
wrapper.vm,
|
||||||
|
|
@ -784,32 +834,10 @@ describe("vehicle-damage.vue", () => {
|
||||||
undefined,
|
undefined,
|
||||||
nextFunction
|
nextFunction
|
||||||
);
|
);
|
||||||
|
await nextTick();
|
||||||
expect(nextFunction).toHaveBeenCalled();
|
expect(nextFunction).toHaveBeenCalled();
|
||||||
expect(wrapper.vm.forwardButtonAction).toHaveBeenCalled();
|
expect(wrapper.vm.forwardButtonAction).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
test("should not call forwardButtonAction if isLeadGen is true and selectedDamageLocations is empty", async () => {
|
|
||||||
// Set up the store with isLeadGen as true
|
|
||||||
store.getters.isLeadGen = true;
|
|
||||||
|
|
||||||
// Set up the component
|
|
||||||
const { wrapper } = setupMocks({});
|
|
||||||
wrapper.vm.forwardButtonAction = jest.fn();
|
|
||||||
const nextFunction = jest.fn((c) => {
|
|
||||||
c(wrapper.vm);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Set selectedDamageLocations to empty
|
|
||||||
wrapper.setData({ selectedDamageLocations: [] });
|
|
||||||
|
|
||||||
// Call the method that contains the if-else logic
|
|
||||||
await vehicleDamage.beforeRouteEnter.call(
|
|
||||||
wrapper.vm,
|
|
||||||
{ query: { fmgPage: "vehicle-damage" } },
|
|
||||||
undefined,
|
|
||||||
nextFunction
|
|
||||||
);
|
|
||||||
expect(wrapper.vm.forwardButtonAction).not.toHaveBeenCalled();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -834,7 +862,12 @@ function setupMocks({ pageHeaderWidgetHeaderText, mountOptionsMockData, funnelCo
|
||||||
isVerified: false,
|
isVerified: false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
isLeadGen: false,
|
// isLeadGen: false,
|
||||||
|
// leadGenDamage: {
|
||||||
|
// damageType: null,
|
||||||
|
// isRepair: null,
|
||||||
|
// numberOfChips: null,
|
||||||
|
// },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -106,6 +106,7 @@ import { getFunnelCookie } from "@/helpers/heritage-integration/cookie-helper";
|
||||||
|
|
||||||
import store from "@/store";
|
import store from "@/store";
|
||||||
import baseMixin from "@/mixins/base-mixin";
|
import baseMixin from "@/mixins/base-mixin";
|
||||||
|
import { nextTick } from "vue";
|
||||||
// DEFINE VALIDATION RULES
|
// DEFINE VALIDATION RULES
|
||||||
defineRule("replace-options-required", required(errorMessages.REPLACE_OPTIONS_REQUIRED));
|
defineRule("replace-options-required", required(errorMessages.REPLACE_OPTIONS_REQUIRED));
|
||||||
|
|
||||||
|
|
@ -136,7 +137,7 @@ export default {
|
||||||
const resultMap = await settleAllPromises(promiseResultMap);
|
const resultMap = await settleAllPromises(promiseResultMap);
|
||||||
|
|
||||||
// Call the "next" function to complete the transition to this page.
|
// Call the "next" function to complete the transition to this page.
|
||||||
next((vm) => {
|
next(async (vm) => {
|
||||||
vm.setCmsContent(resultMap.cmsContent);
|
vm.setCmsContent(resultMap.cmsContent);
|
||||||
vm.$refs.damageLocation.initializeComponent(resultMap.damageOptions);
|
vm.$refs.damageLocation.initializeComponent(resultMap.damageOptions);
|
||||||
vm.$refs.sideDoorOptions.initializeComponent(
|
vm.$refs.sideDoorOptions.initializeComponent(
|
||||||
|
|
@ -150,14 +151,16 @@ export default {
|
||||||
resultMap.damageOptions.backGlassOptions.availableReplacementOptions
|
resultMap.damageOptions.backGlassOptions.availableReplacementOptions
|
||||||
);
|
);
|
||||||
if (store.getters.isLeadGen) {
|
if (store.getters.isLeadGen) {
|
||||||
if (vm.selectedDamageLocations?.length > 0) {
|
await nextTick();
|
||||||
|
const isValid = await baseMixin.methods.isFormValid(vm.$refs.theForm);
|
||||||
|
if (isValid) {
|
||||||
vm.forwardButtonAction();
|
vm.forwardButtonAction();
|
||||||
} else {
|
} else {
|
||||||
baseMixin.methods.dispatchStoreAction(storeActions.RESET_IS_LEAD_GEN);
|
baseMixin.methods.dispatchStoreAction(storeActions.RESET_LEADGEN_STATE);
|
||||||
baseMixin.methods.hideFmgLoadingModal();
|
baseMixin.methods.hideFmgLoadingModal();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
baseMixin.methods.dispatchStoreAction(storeActions.RESET_IS_LEAD_GEN);
|
baseMixin.methods.dispatchStoreAction(storeActions.RESET_LEADGEN_STATE);
|
||||||
baseMixin.methods.hideFmgLoadingModal();
|
baseMixin.methods.hideFmgLoadingModal();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -184,7 +187,6 @@ export default {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|
||||||
attachCustomEvents() {
|
attachCustomEvents() {
|
||||||
if (this.$store.getters.vehicle.imageVifNumber) {
|
if (this.$store.getters.vehicle.imageVifNumber) {
|
||||||
this.pushEventToGA(
|
this.pushEventToGA(
|
||||||
|
|
@ -208,7 +210,9 @@ export default {
|
||||||
store.getters.damage.glassToReplace?.some((glass) => {
|
store.getters.damage.glassToReplace?.some((glass) => {
|
||||||
return glass.glassLocation === damageLocationsSelected.WINDSHIELD;
|
return glass.glassLocation === damageLocationsSelected.WINDSHIELD;
|
||||||
}) ||
|
}) ||
|
||||||
store.getters.damage.isRepair
|
store.getters.damage.isRepair ||
|
||||||
|
store.getters.leadGenDamage.isRepair ||
|
||||||
|
store.getters.leadGenDamage.damageType?.toUpperCase().includes("WINDSHIELD")
|
||||||
) {
|
) {
|
||||||
glassSelections.push(damageLocationsSelected.WINDSHIELD);
|
glassSelections.push(damageLocationsSelected.WINDSHIELD);
|
||||||
}
|
}
|
||||||
|
|
@ -241,11 +245,16 @@ export default {
|
||||||
selectedWindshieldReplaceOptions: [],
|
selectedWindshieldReplaceOptions: [],
|
||||||
};
|
};
|
||||||
|
|
||||||
if (store.getters.damage.isRepair === undefined) return windshieldOptions;
|
if (
|
||||||
|
store.getters.leadGenDamage.isRepair === undefined ||
|
||||||
|
store.getters.damage.isRepair === undefined
|
||||||
|
)
|
||||||
|
return windshieldOptions;
|
||||||
|
|
||||||
if (store.getters.damage.isRepair) {
|
if (store.getters.leadGenDamage.isRepair || store.getters.damage.isRepair) {
|
||||||
windShieldOptions.selectedWindshieldDamageType = damageLocationsSelected.REPAIR;
|
windShieldOptions.selectedWindshieldDamageType = damageLocationsSelected.REPAIR;
|
||||||
windShieldOptions.selectedWindshieldChipCount = store.getters.damage.numberOfChips;
|
windShieldOptions.selectedWindshieldChipCount =
|
||||||
|
store.getters.leadGenDamage.numberOfChips || store.getters.damage.numberOfChips;
|
||||||
} else {
|
} else {
|
||||||
if (
|
if (
|
||||||
store.getters.damage.glassToReplace?.some((glass) => {
|
store.getters.damage.glassToReplace?.some((glass) => {
|
||||||
|
|
@ -253,7 +262,8 @@ export default {
|
||||||
glass.glassLocation === damageLocationsSelected.WINDSHIELD &&
|
glass.glassLocation === damageLocationsSelected.WINDSHIELD &&
|
||||||
glass.glassName === damageLocationsSelected.SINGLE
|
glass.glassName === damageLocationsSelected.SINGLE
|
||||||
);
|
);
|
||||||
})
|
}) ||
|
||||||
|
store.getters.leadGenDamage.damageType?.toUpperCase() === "WINDSHIELDREPLACE"
|
||||||
) {
|
) {
|
||||||
windShieldOptions.selectedWindshieldDamageType =
|
windShieldOptions.selectedWindshieldDamageType =
|
||||||
damageLocationsSelected.REPLACE;
|
damageLocationsSelected.REPLACE;
|
||||||
|
|
@ -350,6 +360,8 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
async forwardButtonAction() {
|
async forwardButtonAction() {
|
||||||
|
const isValid = await this.isFormValid();
|
||||||
|
console.log(isValid);
|
||||||
await this.dispatchStoreAction(
|
await this.dispatchStoreAction(
|
||||||
this.storeActions.SAVE_VEHICLE_DAMAGE,
|
this.storeActions.SAVE_VEHICLE_DAMAGE,
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,12 @@ jest.mock("@/store", () => ({
|
||||||
experiments: [{ universeName: "ConceptFunnel" }],
|
experiments: [{ universeName: "ConceptFunnel" }],
|
||||||
},
|
},
|
||||||
isLeadGen: false,
|
isLeadGen: false,
|
||||||
|
leadGenVehicle: {
|
||||||
|
year: null,
|
||||||
|
make: null,
|
||||||
|
model: null,
|
||||||
|
style: null,
|
||||||
|
},
|
||||||
vehicle: {
|
vehicle: {
|
||||||
carId: "C00000000",
|
carId: "C00000000",
|
||||||
image: "test.jpg",
|
image: "test.jpg",
|
||||||
|
|
@ -87,50 +93,21 @@ describe("vehicle.vue", () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("vehicle.vue", () => {
|
describe("vehicle.vue", () => {
|
||||||
test("should call forwardButtonAction if isLeadGen is true and displayNoServiceAlert is false", async () => {
|
test("should call forwardButtonAction if isLeadGen is true and form is valid", async () => {
|
||||||
// Set up the store with isLeadGen as true
|
|
||||||
store.getters.isLeadGen = true;
|
store.getters.isLeadGen = true;
|
||||||
|
// Create a shallow mount of MyComponent
|
||||||
// Set up the component
|
|
||||||
const { wrapper } = setupMocks();
|
const { wrapper } = setupMocks();
|
||||||
wrapper.vm.forwardButtonAction = jest.fn();
|
|
||||||
const nextFunction = jest.fn((c) => {
|
|
||||||
c(wrapper.vm);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Set displayNoServiceAlert to false
|
// Set displayNoServiceAlert to false
|
||||||
wrapper.setData({ displayNoServiceAlert: false });
|
wrapper.setData({ displayNoServiceAlert: false });
|
||||||
|
|
||||||
// Mock the getVehicleDetails method
|
// Mock the getVehicleDetails method
|
||||||
wrapper.vm.getVehicleDetails = jest.fn();
|
wrapper.vm.getVehicleDetails = jest.fn();
|
||||||
|
|
||||||
// Call the method that contains the if-else logic
|
|
||||||
await vehicle.beforeRouteEnter.call(
|
|
||||||
wrapper.vm,
|
|
||||||
{ query: { fmgPage: "vehicle" } },
|
|
||||||
undefined,
|
|
||||||
nextFunction
|
|
||||||
);
|
|
||||||
expect(nextFunction).toHaveBeenCalled();
|
|
||||||
expect(wrapper.vm.forwardButtonAction).toHaveBeenCalled();
|
|
||||||
});
|
|
||||||
test("should not call forwardButtonAction if isLeadGen is true and displayNoServiceAlert is true", async () => {
|
|
||||||
// Set up the store with isLeadGen as true
|
|
||||||
store.getters.isLeadGen = true;
|
|
||||||
|
|
||||||
// Set up the component
|
|
||||||
const { wrapper } = setupMocks();
|
|
||||||
wrapper.vm.forwardButtonAction = jest.fn();
|
wrapper.vm.forwardButtonAction = jest.fn();
|
||||||
|
|
||||||
|
baseMixin.methods.isFormValid = jest.fn().mockReturnValue(true);
|
||||||
const nextFunction = jest.fn((c) => {
|
const nextFunction = jest.fn((c) => {
|
||||||
c(wrapper.vm);
|
c(wrapper.vm);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Set displayNoServiceAlert to false
|
|
||||||
wrapper.setData({ displayNoServiceAlert: true });
|
|
||||||
|
|
||||||
// Mock the getVehicleDetails method
|
|
||||||
wrapper.vm.getVehicleDetails = jest.fn();
|
|
||||||
|
|
||||||
// Call the method that contains the if-else logic
|
// Call the method that contains the if-else logic
|
||||||
await vehicle.beforeRouteEnter.call(
|
await vehicle.beforeRouteEnter.call(
|
||||||
wrapper.vm,
|
wrapper.vm,
|
||||||
|
|
@ -138,7 +115,10 @@ describe("vehicle.vue", () => {
|
||||||
undefined,
|
undefined,
|
||||||
nextFunction
|
nextFunction
|
||||||
);
|
);
|
||||||
expect(wrapper.vm.forwardButtonAction).not.toHaveBeenCalled();
|
await nextTick();
|
||||||
|
|
||||||
|
expect(nextFunction).toHaveBeenCalled();
|
||||||
|
expect(wrapper.vm.forwardButtonAction).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -143,14 +143,14 @@ export default {
|
||||||
var styleQuestionInitialDataPromise = null;
|
var styleQuestionInitialDataPromise = null;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
store.getters.order.vehicle.make &&
|
(store.getters.leadGenVehicle.make || store.getters.order.vehicle.make) &&
|
||||||
store.getters.order.vehicle.model &&
|
(store.getters.leadGenVehicle.model || store.getters.order.vehicle.model) &&
|
||||||
store.getters.order.vehicle.style
|
(store.getters.leadGenVehicle.style || store.getters.order.vehicle.style)
|
||||||
) {
|
) {
|
||||||
makeQuestionInitialDataPromise = baseMixin.methods.dispatchStoreActionWithLogging(
|
makeQuestionInitialDataPromise = baseMixin.methods.dispatchStoreActionWithLogging(
|
||||||
storeActions.GET_VEHICLE_MAKES,
|
storeActions.GET_VEHICLE_MAKES,
|
||||||
{
|
{
|
||||||
year: store.getters.order.vehicle.year,
|
year: store.getters.leadGenVehicle.year || store.getters.order.vehicle.year,
|
||||||
},
|
},
|
||||||
"vehicle"
|
"vehicle"
|
||||||
);
|
);
|
||||||
|
|
@ -158,8 +158,8 @@ export default {
|
||||||
modelQuestionInitialDataPromise = baseMixin.methods.dispatchStoreActionWithLogging(
|
modelQuestionInitialDataPromise = baseMixin.methods.dispatchStoreActionWithLogging(
|
||||||
storeActions.GET_VEHICLE_MODELS,
|
storeActions.GET_VEHICLE_MODELS,
|
||||||
{
|
{
|
||||||
year: store.getters.order.vehicle.year,
|
year: store.getters.leadGenVehicle.year || store.getters.order.vehicle.year,
|
||||||
make: store.getters.order.vehicle.make,
|
make: store.getters.leadGenVehicle.make || store.getters.order.vehicle.make,
|
||||||
},
|
},
|
||||||
"vehicle"
|
"vehicle"
|
||||||
);
|
);
|
||||||
|
|
@ -167,9 +167,9 @@ export default {
|
||||||
styleQuestionInitialDataPromise = baseMixin.methods.dispatchStoreActionWithLogging(
|
styleQuestionInitialDataPromise = baseMixin.methods.dispatchStoreActionWithLogging(
|
||||||
storeActions.GET_VEHICLE_STYLES,
|
storeActions.GET_VEHICLE_STYLES,
|
||||||
{
|
{
|
||||||
year: store.getters.order.vehicle.year,
|
year: store.getters.leadGenVehicle.year || store.getters.order.vehicle.year,
|
||||||
make: store.getters.order.vehicle.make,
|
make: store.getters.leadGenVehicle.make || store.getters.order.vehicle.make,
|
||||||
model: store.getters.order.vehicle.model,
|
model: store.getters.leadGenVehicle.model || store.getters.order.vehicle.model,
|
||||||
},
|
},
|
||||||
"vehicle"
|
"vehicle"
|
||||||
);
|
);
|
||||||
|
|
@ -235,13 +235,19 @@ export default {
|
||||||
if (store.getters.isLeadGen) {
|
if (store.getters.isLeadGen) {
|
||||||
await vm.getVehicleDetails();
|
await vm.getVehicleDetails();
|
||||||
if (!vm.displayNoServiceAlert) {
|
if (!vm.displayNoServiceAlert) {
|
||||||
vm.forwardButtonAction();
|
const isValid = await baseMixin.methods.isFormValid(vm.$refs.theForm);
|
||||||
|
if (isValid) {
|
||||||
|
vm.forwardButtonAction();
|
||||||
|
} else {
|
||||||
|
baseMixin.methods.dispatchStoreAction(storeActions.RESET_LEADGEN_STATE);
|
||||||
|
baseMixin.methods.hideFmgLoadingModal();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
baseMixin.methods.dispatchStoreAction(storeActions.RESET_IS_LEAD_GEN);
|
baseMixin.methods.dispatchStoreAction(storeActions.RESET_LEADGEN_STATE);
|
||||||
baseMixin.methods.hideFmgLoadingModal();
|
baseMixin.methods.hideFmgLoadingModal();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
baseMixin.methods.dispatchStoreAction(storeActions.RESET_IS_LEAD_GEN);
|
baseMixin.methods.dispatchStoreAction(storeActions.RESET_LEADGEN_STATE);
|
||||||
baseMixin.methods.hideFmgLoadingModal();
|
baseMixin.methods.hideFmgLoadingModal();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -429,16 +435,16 @@ export default {
|
||||||
this.styleOptions = styleOptions;
|
this.styleOptions = styleOptions;
|
||||||
},
|
},
|
||||||
selectedYearfromStore() {
|
selectedYearfromStore() {
|
||||||
return store.getters.vehicle.year?.toString();
|
return store.getters.leadGenVehicle.year ?? store.getters.vehicle.year?.toString();
|
||||||
},
|
},
|
||||||
selectedMakefromStore() {
|
selectedMakefromStore() {
|
||||||
return store.getters.vehicle.make;
|
return store.getters.leadGenVehicle.make ?? store.getters.vehicle.make;
|
||||||
},
|
},
|
||||||
selectedModelfromStore() {
|
selectedModelfromStore() {
|
||||||
return store.getters.vehicle.model;
|
return store.getters.leadGenVehicle.model ?? store.getters.vehicle.model;
|
||||||
},
|
},
|
||||||
selectedStylefromStore() {
|
selectedStylefromStore() {
|
||||||
return store.getters.vehicle.style;
|
return store.getters.leadGenVehicle.style ?? store.getters.vehicle.style;
|
||||||
},
|
},
|
||||||
async getMakeOptions(year) {
|
async getMakeOptions(year) {
|
||||||
return await baseMixin.methods.dispatchStoreActionWithLogging(
|
return await baseMixin.methods.dispatchStoreActionWithLogging(
|
||||||
|
|
|
||||||
|
|
@ -154,7 +154,7 @@ import { required, regex } from "@/helpers/validation-rules";
|
||||||
import { Form, defineRule } from "vee-validate";
|
import { Form, defineRule } from "vee-validate";
|
||||||
import { getFunnelCookie } from "@/helpers/heritage-integration/cookie-helper";
|
import { getFunnelCookie } from "@/helpers/heritage-integration/cookie-helper";
|
||||||
import { routerParams } from "@/router/router-constants/router-params";
|
import { routerParams } from "@/router/router-constants/router-params";
|
||||||
|
import baseMixin from "@/mixins/base-mixin.js";
|
||||||
import store from "@/store";
|
import store from "@/store";
|
||||||
import vinPagesMixin from "@/mixins/vin-pages-mixin";
|
import vinPagesMixin from "@/mixins/vin-pages-mixin";
|
||||||
|
|
||||||
|
|
@ -192,6 +192,10 @@ export default {
|
||||||
// Call the "next" function to complete the transition to this page.
|
// Call the "next" function to complete the transition to this page.
|
||||||
next((vm) => {
|
next((vm) => {
|
||||||
vm.setCmsContent(resultMap.cmsContent);
|
vm.setCmsContent(resultMap.cmsContent);
|
||||||
|
if (store.getters.isLeadGen) {
|
||||||
|
baseMixin.methods.dispatchStoreAction(storeActions.RESET_LEADGEN_STATE);
|
||||||
|
baseMixin.methods.hideFmgLoadingModal();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
|
|
|
||||||
|
|
@ -196,6 +196,10 @@ export default {
|
||||||
hideFmgLoadingModal() {
|
hideFmgLoadingModal() {
|
||||||
showFmgLoadingModal(false);
|
showFmgLoadingModal(false);
|
||||||
},
|
},
|
||||||
|
async isFormValid(form) {
|
||||||
|
const formValidateResponse = await form?.validate();
|
||||||
|
return formValidateResponse?.valid;
|
||||||
|
},
|
||||||
showApplePay() {
|
showApplePay() {
|
||||||
if (window.ApplePaySession && window.ApplePaySession.canMakePayments()) {
|
if (window.ApplePaySession && window.ApplePaySession.canMakePayments()) {
|
||||||
var iOSversion = this.getiOSversion();
|
var iOSversion = this.getiOSversion();
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ import store from "@/store";
|
||||||
import vehicleQuestionsMixin from "@/mixins/vehicle-questions-mixin";
|
import vehicleQuestionsMixin from "@/mixins/vehicle-questions-mixin";
|
||||||
import { saveSession } from "@/helpers/heritage-integration/order-helper.js";
|
import { saveSession } from "@/helpers/heritage-integration/order-helper.js";
|
||||||
import { experimentSettings } from "@/constants/experiments";
|
import { experimentSettings } from "@/constants/experiments";
|
||||||
|
import { vinLookupMethodSelections } from "@/constants/vin-lookup-method-selections.js";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
computed: {
|
computed: {
|
||||||
|
|
@ -32,5 +33,14 @@ export default {
|
||||||
|
|
||||||
vehicleQuestionsMixin.methods.navigateForward(partsOrQuestions, this);
|
vehicleQuestionsMixin.methods.navigateForward(partsOrQuestions, this);
|
||||||
},
|
},
|
||||||
|
getVinlookupMethod(vinSelection) {
|
||||||
|
const vinLookupMethods = {
|
||||||
|
vin: vinLookupMethodSelections.MANUALVIN,
|
||||||
|
licensePlate: vinLookupMethodSelections.LICENSEPLATE,
|
||||||
|
address: vinLookupMethodSelections.HOMEADDRESS,
|
||||||
|
decline: vinLookupMethodSelections.DECLINE,
|
||||||
|
};
|
||||||
|
return vinLookupMethods[vinSelection] || null;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@ import { experimentTriggers } from "../constants/experiments";
|
||||||
import { applicationConfig } from "../constants/application-config";
|
import { applicationConfig } from "../constants/application-config";
|
||||||
import { shouldStripPromoQueryString } from "@/helpers/promotions-helper";
|
import { shouldStripPromoQueryString } from "@/helpers/promotions-helper";
|
||||||
import bailout from "@/layouts/bailout/bailout";
|
import bailout from "@/layouts/bailout/bailout";
|
||||||
|
import { nextTick } from "vue";
|
||||||
|
|
||||||
const routes = [
|
const routes = [
|
||||||
{
|
{
|
||||||
|
|
@ -84,14 +85,25 @@ const routes = [
|
||||||
);
|
);
|
||||||
const parentAccount = getQuerystringParameter(queryStrings.PARENT_ACCOUNT);
|
const parentAccount = getQuerystringParameter(queryStrings.PARENT_ACCOUNT);
|
||||||
const correlationId = getQuerystringParameter(queryStrings.CORRELATION_ID);
|
const correlationId = getQuerystringParameter(queryStrings.CORRELATION_ID);
|
||||||
const vehicleYear = getQuerystringParameter(queryStrings.VEHICLE_YEAR);
|
const leadGenYear = getQuerystringParameter(queryStrings.VEHICLE_YEAR);
|
||||||
const vehicleMake = getQuerystringParameter(queryStrings.VEHICLE_MAKE);
|
const leadGenMake = getQuerystringParameter(queryStrings.VEHICLE_MAKE);
|
||||||
const vehicleModel = getQuerystringParameter(queryStrings.VEHICLE_MODEL);
|
const leadGenModel = getQuerystringParameter(queryStrings.VEHICLE_MODEL);
|
||||||
const vehicleStyle = getQuerystringParameter(queryStrings.VEHICLE_STYLE);
|
const leadGenStyle = getQuerystringParameter(queryStrings.VEHICLE_STYLE);
|
||||||
const vehicleDamage = getQuerystringParameter(queryStrings.VEHICLE_DAMAGE);
|
const leadGenDamage = getQuerystringParameter(queryStrings.VEHICLE_DAMAGE);
|
||||||
const serviceZip = getQuerystringParameter(queryStrings.SERVICE_ZIP);
|
const leadGenZipCode = getQuerystringParameter(queryStrings.SERVICE_ZIP);
|
||||||
const email = getQuerystringParameter(queryStrings.EMAIL);
|
const leadGenEmail = getQuerystringParameter(queryStrings.EMAIL);
|
||||||
const isInsurance = getQuerystringParameter(queryStrings.IS_INSURANCE);
|
const leadGenIsInsurance = getQuerystringParameter(
|
||||||
|
queryStrings.IS_INSURANCE
|
||||||
|
);
|
||||||
|
const leadGenVinSelection = getQuerystringParameter(
|
||||||
|
queryStrings.VIN_SELECTION
|
||||||
|
);
|
||||||
|
const leadGenServicePackage = getQuerystringParameter(
|
||||||
|
queryStrings.SERVICE_PACKAGE
|
||||||
|
);
|
||||||
|
const leadGenNumberOfChips = getQuerystringParameter(
|
||||||
|
queryStrings.NUMBER_OF_CHIPS
|
||||||
|
);
|
||||||
if (referralNumber) {
|
if (referralNumber) {
|
||||||
store.commit(storeMutations.UPDATE_REFERRAL_NUMBER, referralNumber);
|
store.commit(storeMutations.UPDATE_REFERRAL_NUMBER, referralNumber);
|
||||||
store.commit(storeMutations.UPDATE_PARENT_ACCT_NUMBER, parentAccount);
|
store.commit(storeMutations.UPDATE_PARENT_ACCT_NUMBER, parentAccount);
|
||||||
|
|
@ -102,46 +114,63 @@ const routes = [
|
||||||
updateOrCreateFunnelCookie();
|
updateOrCreateFunnelCookie();
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
vehicleYear &&
|
leadGenYear &&
|
||||||
vehicleMake &&
|
leadGenMake &&
|
||||||
vehicleModel &&
|
leadGenModel &&
|
||||||
vehicleStyle &&
|
leadGenStyle &&
|
||||||
vehicleDamage &&
|
leadGenDamage &&
|
||||||
serviceZip &&
|
leadGenZipCode &&
|
||||||
email &&
|
leadGenEmail &&
|
||||||
isInsurance
|
leadGenIsInsurance &&
|
||||||
|
(leadGenDamage.toUpperCase() == "WINDSHIELDREPAIR" ||
|
||||||
|
leadGenVinSelection?.length > 0) &&
|
||||||
|
(leadGenIsInsurance == "false" || leadGenServicePackage?.length > 0) &&
|
||||||
|
(leadGenDamage.toUpperCase() != "WINDSHIELDREPAIR" ||
|
||||||
|
leadGenNumberOfChips?.length > 0)
|
||||||
) {
|
) {
|
||||||
if (!store.getters.applicationUser.triggeredSiteEntry) {
|
if (!store.getters.applicationUser.triggeredSiteEntry) {
|
||||||
store.commit(storeMutations.UPDATE_YEAR, vehicleYear);
|
|
||||||
store.commit(storeMutations.UPDATE_MAKE, vehicleMake);
|
|
||||||
store.commit(storeMutations.UPDATE_MODEL, vehicleModel);
|
|
||||||
store.commit(storeMutations.UPDATE_STYLE, vehicleStyle);
|
|
||||||
store.commit(storeMutations.UPDATE_IS_LEAD_GEN, true);
|
store.commit(storeMutations.UPDATE_IS_LEAD_GEN, true);
|
||||||
if (vehicleDamage == "windshieldReplace") {
|
store.commit(storeMutations.UPDATE_LEAD_GEN_YEAR, leadGenYear);
|
||||||
store.commit(storeMutations.UPDATE_IS_REPAIR, false);
|
store.commit(storeMutations.UPDATE_LEAD_GEN_MAKE, leadGenMake);
|
||||||
store.commit(storeMutations.UPDATE_NUMBER_OF_CHIPS, null);
|
store.commit(storeMutations.UPDATE_LEAD_GEN_MODEL, leadGenModel);
|
||||||
const glassToReplace = [
|
store.commit(storeMutations.UPDATE_LEAD_GEN_STYLE, leadGenStyle);
|
||||||
{ glassLocation: "Windshield", glassName: "Single" },
|
store.commit(
|
||||||
];
|
storeMutations.UPDATE_LEAD_GEN_DAMAGE_TYPE,
|
||||||
|
leadGenDamage
|
||||||
|
);
|
||||||
|
if (leadGenDamage.toUpperCase() == "WINDSHIELDREPLACE") {
|
||||||
|
store.commit(storeMutations.UPDATE_LEAD_GEN_IS_REPAIR, false);
|
||||||
store.commit(
|
store.commit(
|
||||||
storeMutations.UPDATE_GLASS_TO_REPLACE,
|
storeMutations.UPDATE_LEAD_GEN_NUMBER_OF_CHIPS,
|
||||||
glassToReplace
|
null
|
||||||
|
);
|
||||||
|
} else if (leadGenDamage.toUpperCase() == "WINDSHIELDREPAIR") {
|
||||||
|
store.commit(storeMutations.UPDATE_LEAD_GEN_IS_REPAIR, true);
|
||||||
|
store.commit(
|
||||||
|
storeMutations.UPDATE_LEAD_GEN_NUMBER_OF_CHIPS,
|
||||||
|
leadGenNumberOfChips
|
||||||
);
|
);
|
||||||
} else if (vehicleDamage == "windshieldRepair") {
|
|
||||||
store.commit(storeMutations.UPDATE_IS_REPAIR, true);
|
|
||||||
store.commit(storeMutations.UPDATE_NUMBER_OF_CHIPS, 1);
|
|
||||||
}
|
}
|
||||||
const serviceZipInfo = {
|
store.commit(
|
||||||
state: null,
|
storeMutations.UPDATE_LEAD_GEN_ZIP_CODE,
|
||||||
zipCode: serviceZip,
|
leadGenZipCode
|
||||||
zipCodeCtu: null,
|
);
|
||||||
};
|
store.commit(
|
||||||
store.commit(storeMutations.UPDATE_SERVICE_ZIP, serviceZipInfo);
|
storeMutations.UPDATE_LEAD_GEN_EMAIL_ADDRESS,
|
||||||
store.commit(storeMutations.UPDATE_CUSTOMER_EMAIL_ADDRESS, email);
|
leadGenEmail
|
||||||
if (isInsurance == "true") {
|
);
|
||||||
store.commit(storeMutations.UPDATE_IS_INSURANCE, true);
|
if (leadGenIsInsurance == "true") {
|
||||||
} else {
|
store.commit(storeMutations.UPDATE_LEAD_GEN_IS_INSURANCE, true);
|
||||||
store.commit(storeMutations.UPDATE_IS_INSURANCE, null);
|
store.commit(
|
||||||
|
storeMutations.UPDATE_LEAD_GEN_SERVICE_PACKAGE,
|
||||||
|
leadGenServicePackage
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (leadGenDamage.toUpperCase() != "WINDSHIELDREPAIR") {
|
||||||
|
store.commit(
|
||||||
|
storeMutations.UPDATE_LEAD_GEN_VIN_SELECTION,
|
||||||
|
leadGenVinSelection
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,8 +24,8 @@ import { partTypeStrings } from "@/constants/part-type-strings";
|
||||||
import {
|
import {
|
||||||
convertDateStringToDate,
|
convertDateStringToDate,
|
||||||
militaryToTwelveHourTime,
|
militaryToTwelveHourTime,
|
||||||
getDisplayTextForDurationLength,
|
|
||||||
} from "@/layouts/schedule/helpers/schedule-helper";
|
} from "@/layouts/schedule/helpers/schedule-helper";
|
||||||
|
import { getDisplayTextForDurationLength } from "@/helpers/duration-length-helper";
|
||||||
import { paymentMethods } from "@/constants/payment-method-constants";
|
import { paymentMethods } from "@/constants/payment-method-constants";
|
||||||
import {
|
import {
|
||||||
getPromoCodeWithoutBundleIdentifier,
|
getPromoCodeWithoutBundleIdentifier,
|
||||||
|
|
@ -160,7 +160,6 @@ const getDefaultState = () => {
|
||||||
customerPortalLoginToken: null,
|
customerPortalLoginToken: null,
|
||||||
lockToken: null,
|
lockToken: null,
|
||||||
settledTenderAmount: 0,
|
settledTenderAmount: 0,
|
||||||
isLeadGen: false,
|
|
||||||
},
|
},
|
||||||
applicationUser: {
|
applicationUser: {
|
||||||
eventBus: [],
|
eventBus: [],
|
||||||
|
|
@ -177,7 +176,7 @@ const getDefaultState = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
export const state = getDefaultState();
|
export const state = getDefaultState();
|
||||||
|
export const leadGenState = getLeadGenDefaultState();
|
||||||
// Export Mutations
|
// Export Mutations
|
||||||
export const mutations = {
|
export const mutations = {
|
||||||
// VEHICLE MUTATIONS
|
// VEHICLE MUTATIONS
|
||||||
|
|
@ -295,9 +294,6 @@ export const mutations = {
|
||||||
updateSettledTenderAmount(state, settledTenderAmount) {
|
updateSettledTenderAmount(state, settledTenderAmount) {
|
||||||
state.order.settledTenderAmount = settledTenderAmount;
|
state.order.settledTenderAmount = settledTenderAmount;
|
||||||
},
|
},
|
||||||
updateIsLeadGen(state, isLeadGen) {
|
|
||||||
state.order.isLeadGen = isLeadGen;
|
|
||||||
},
|
|
||||||
updateCCToken(state, ccToken) {
|
updateCCToken(state, ccToken) {
|
||||||
state.order.payment.ccToken.subscriptionId = ccToken.subscriptionId;
|
state.order.payment.ccToken.subscriptionId = ccToken.subscriptionId;
|
||||||
state.order.payment.ccToken.expMonth = ccToken.expMonth;
|
state.order.payment.ccToken.expMonth = ccToken.expMonth;
|
||||||
|
|
@ -418,6 +414,92 @@ export const mutations = {
|
||||||
state.applicationUser.eventBus.splice(itemIndex, 1);
|
state.applicationUser.eventBus.splice(itemIndex, 1);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
//LEADGEN MUTATIONS
|
||||||
|
updateIsLeadGen(state, isLeadGen) {
|
||||||
|
leadGenState.isLeadGen = isLeadGen;
|
||||||
|
setLeadGenState(leadGenState);
|
||||||
|
},
|
||||||
|
updateLeadGenYear(state, year) {
|
||||||
|
leadGenState.vehicle.year = year;
|
||||||
|
setLeadGenState(leadGenState);
|
||||||
|
},
|
||||||
|
updateLeadGenMake(state, make) {
|
||||||
|
leadGenState.vehicle.make = make;
|
||||||
|
setLeadGenState(leadGenState);
|
||||||
|
},
|
||||||
|
updateLeadGenModel(state, model) {
|
||||||
|
leadGenState.vehicle.model = model;
|
||||||
|
setLeadGenState(leadGenState);
|
||||||
|
},
|
||||||
|
updateLeadGenStyle(state, style) {
|
||||||
|
leadGenState.vehicle.style = style;
|
||||||
|
setLeadGenState(leadGenState);
|
||||||
|
},
|
||||||
|
updateLeadGenIsRepair(state, isRepair) {
|
||||||
|
leadGenState.vehicleDamage.isRepair = isRepair;
|
||||||
|
setLeadGenState(leadGenState);
|
||||||
|
},
|
||||||
|
updateLeadGenNumberOfChips(state, numberOfChips) {
|
||||||
|
leadGenState.vehicleDamage.numberOfChips = numberOfChips;
|
||||||
|
setLeadGenState(leadGenState);
|
||||||
|
},
|
||||||
|
updateLeadGenDamageType(state, damageType) {
|
||||||
|
leadGenState.vehicleDamage.damageType = damageType;
|
||||||
|
setLeadGenState(leadGenState);
|
||||||
|
},
|
||||||
|
updateLeadGenZipCode(state, zipCode) {
|
||||||
|
leadGenState.serviceZip.zipCode = zipCode;
|
||||||
|
setLeadGenState(leadGenState);
|
||||||
|
},
|
||||||
|
updateLeadGenEmailAddress(state, emailAddress) {
|
||||||
|
leadGenState.serviceZip.emailAddress = emailAddress;
|
||||||
|
setLeadGenState(leadGenState);
|
||||||
|
},
|
||||||
|
updateLeadGenIsInsurance(state, isInsurance) {
|
||||||
|
leadGenState.quote.isInsurance = isInsurance;
|
||||||
|
setLeadGenState(leadGenState);
|
||||||
|
},
|
||||||
|
updateLeadGenVinSelection(state, vinSelection) {
|
||||||
|
leadGenState.estimate.vinSelection = vinSelection;
|
||||||
|
setLeadGenState(leadGenState);
|
||||||
|
},
|
||||||
|
updateLeadGenServicePackage(state, servicePackage) {
|
||||||
|
leadGenState.quote.servicePackage = servicePackage;
|
||||||
|
setLeadGenState(leadGenState);
|
||||||
|
},
|
||||||
|
//RESET LEADGEN MUTATIONS
|
||||||
|
resetLeadGenVehicleState(state) {
|
||||||
|
leadGenState.vehicle.year =
|
||||||
|
leadGenState.vehicle.make =
|
||||||
|
leadGenState.vehicle.model =
|
||||||
|
leadGenState.vehicle.style =
|
||||||
|
null;
|
||||||
|
setLeadGenState(leadGenState);
|
||||||
|
},
|
||||||
|
resetLeadGenDamageState(state) {
|
||||||
|
leadGenState.vehicleDamage.isRepair =
|
||||||
|
leadGenState.vehicleDamage.numberOfChips =
|
||||||
|
leadGenState.vehicleDamage.damageType =
|
||||||
|
null;
|
||||||
|
setLeadGenState(leadGenState);
|
||||||
|
},
|
||||||
|
resetLeadGenEstimateState(state) {
|
||||||
|
leadGenState.estimate.vinSelection = null;
|
||||||
|
setLeadGenState(leadGenState);
|
||||||
|
},
|
||||||
|
resetLeadGenServiceZipState(state) {
|
||||||
|
leadGenState.serviceZip.zipCode = leadGenState.serviceZip.emailAddress = null;
|
||||||
|
setLeadGenState(leadGenState);
|
||||||
|
},
|
||||||
|
resetLeadGenQuoteState(state) {
|
||||||
|
leadGenState.quote.isInsurance = null;
|
||||||
|
leadGenState.quote.servicePackage = null;
|
||||||
|
setLeadGenState(leadGenState);
|
||||||
|
},
|
||||||
|
resetIsLeadGen(state) {
|
||||||
|
leadGenState.isLeadGen = null;
|
||||||
|
setLeadGenState(leadGenState);
|
||||||
|
},
|
||||||
|
|
||||||
// RESET DEPENDENCY MUTATIONS
|
// RESET DEPENDENCY MUTATIONS
|
||||||
resetVehicleState(state) {
|
resetVehicleState(state) {
|
||||||
|
|
@ -678,7 +760,6 @@ export const getters = {
|
||||||
isOvernightDropOffAppointment: (state) => {
|
isOvernightDropOffAppointment: (state) => {
|
||||||
return state.order.schedule.routeCode?.includes(RouteCodeFlags.OVERNIGHT_DROP_OFF);
|
return state.order.schedule.routeCode?.includes(RouteCodeFlags.OVERNIGHT_DROP_OFF);
|
||||||
},
|
},
|
||||||
isLeadGen: (state) => state.order.isLeadGen,
|
|
||||||
isRecalibrationOnOrder: (state) => {
|
isRecalibrationOnOrder: (state) => {
|
||||||
return getHasRecalibrationPart(state);
|
return getHasRecalibrationPart(state);
|
||||||
},
|
},
|
||||||
|
|
@ -809,6 +890,12 @@ export const getters = {
|
||||||
requiresVerifiedRedirecting: (state) => {
|
requiresVerifiedRedirecting: (state) => {
|
||||||
return state.order?.referralNumber?.length === 6;
|
return state.order?.referralNumber?.length === 6;
|
||||||
},
|
},
|
||||||
|
isLeadGen: (state) => leadGenState?.isLeadGen,
|
||||||
|
leadGenVehicle: (state) => leadGenState?.vehicle,
|
||||||
|
leadGenDamage: (state) => leadGenState?.vehicleDamage,
|
||||||
|
leadGenQuote: (state) => leadGenState?.quote,
|
||||||
|
leadGenServiceZip: (state) => leadGenState?.serviceZip,
|
||||||
|
leadGenEstimate: (state) => leadGenState?.estimate,
|
||||||
};
|
};
|
||||||
|
|
||||||
function getNonFalseValuesOfPropertyInArrayOfObjects(array, propertyName) {
|
function getNonFalseValuesOfPropertyInArrayOfObjects(array, propertyName) {
|
||||||
|
|
@ -1934,13 +2021,11 @@ export const actions = {
|
||||||
context.state.order.vehicle.year != year ||
|
context.state.order.vehicle.year != year ||
|
||||||
context.state.order.vehicle.make != make ||
|
context.state.order.vehicle.make != make ||
|
||||||
context.state.order.vehicle.model != model ||
|
context.state.order.vehicle.model != model ||
|
||||||
context.state.order.vehicle.style != style ||
|
context.state.order.vehicle.style != style
|
||||||
context.state.order.isLeadGen
|
|
||||||
) {
|
) {
|
||||||
if (!context.state.order.isLeadGen) {
|
context.dispatch(storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES);
|
||||||
context.dispatch(storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES);
|
context.dispatch(storeActions.RESET_REGISTRATION_STATE_AND_DEPENDENCIES);
|
||||||
context.dispatch(storeActions.RESET_REGISTRATION_STATE_AND_DEPENDENCIES);
|
|
||||||
}
|
|
||||||
context.commit(storeMutations.UPDATE_VEHICLE_VIN, null);
|
context.commit(storeMutations.UPDATE_VEHICLE_VIN, null);
|
||||||
context.commit(storeMutations.UPDATE_YEAR, year);
|
context.commit(storeMutations.UPDATE_YEAR, year);
|
||||||
context.commit(storeMutations.UPDATE_MAKE, make);
|
context.commit(storeMutations.UPDATE_MAKE, make);
|
||||||
|
|
@ -2705,14 +2790,27 @@ export const actions = {
|
||||||
|
|
||||||
//restore user's experiments
|
//restore user's experiments
|
||||||
context.commit(storeMutations.UPDATE_EXPERIMENTS, experiments);
|
context.commit(storeMutations.UPDATE_EXPERIMENTS, experiments);
|
||||||
|
|
||||||
|
//clear leadGen session storage
|
||||||
|
window.sessionStorage.removeItem("leadGenState");
|
||||||
},
|
},
|
||||||
|
|
||||||
resetSubmittedOrder(context) {
|
resetSubmittedOrder(context) {
|
||||||
// clear from local storage
|
// clear from local storage
|
||||||
window.sessionStorage.removeItem("submittedOrder");
|
window.sessionStorage.removeItem("submittedOrder");
|
||||||
},
|
},
|
||||||
resetIsLeadGen(context) {
|
resetLeadGenState(context) {
|
||||||
context.commit(storeMutations.UPDATE_IS_LEAD_GEN, false);
|
if (context.getters.isLeadGen) {
|
||||||
|
context.commit(storeMutations.RESET_LEADGEN_VEHICLE_STATE);
|
||||||
|
context.commit(storeMutations.RESETL_EADGEN_DAMAGE_STATE);
|
||||||
|
context.commit(storeMutations.RESET_LEADGEN_ESTIMATE_STATE);
|
||||||
|
context.commit(storeMutations.RESET_LEADGEN_SERVICEZIP_STATE);
|
||||||
|
context.commit(storeMutations.RESET_LEADGEN_QUOTE_STATE);
|
||||||
|
context.commit(storeMutations.RESET_IS_LEADGEN);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
createLeadGenState(context) {
|
||||||
|
createLeadGenDefaultState();
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -3201,3 +3299,43 @@ async function resetScheduleIfUnavailable(context, order, pageNameToLog) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
function createLeadGenDefaultState() {
|
||||||
|
// create default leadGen state
|
||||||
|
const leadGenDefaultState = {
|
||||||
|
isLeadGen: null,
|
||||||
|
vehicle: {
|
||||||
|
year: null,
|
||||||
|
make: null,
|
||||||
|
model: null,
|
||||||
|
style: null,
|
||||||
|
},
|
||||||
|
vehicleDamage: {
|
||||||
|
damageType: null,
|
||||||
|
isRepair: null,
|
||||||
|
numberOfChips: null,
|
||||||
|
},
|
||||||
|
estimate: {
|
||||||
|
vinSelection: null,
|
||||||
|
},
|
||||||
|
serviceZip: {
|
||||||
|
emailAddress: null,
|
||||||
|
zipCode: null,
|
||||||
|
},
|
||||||
|
quote: {
|
||||||
|
isInsurance: null,
|
||||||
|
servicePackage: null,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
// set to session storage
|
||||||
|
setLeadGenState(leadGenDefaultState);
|
||||||
|
}
|
||||||
|
function getLeadGenDefaultState() {
|
||||||
|
const leadGenState = window.sessionStorage.getItem("leadGenState");
|
||||||
|
if (leadGenState === null) {
|
||||||
|
createLeadGenDefaultState();
|
||||||
|
}
|
||||||
|
return JSON.parse(window.sessionStorage.getItem("leadGenState"));
|
||||||
|
}
|
||||||
|
async function setLeadGenState(leadGenState) {
|
||||||
|
window.sessionStorage.setItem("leadGenState", JSON.stringify(leadGenState));
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue