Merge branch 'develop' into feature/CSR-2179-ajc

This commit is contained in:
Adam Caouette 2024-09-10 15:26:53 -04:00
commit 834508d646
34 changed files with 552 additions and 241 deletions

View file

@ -36,6 +36,7 @@ const queryStrings = {
VIN_SELECTION: "vinselection", VIN_SELECTION: "vinselection",
SERVICE_PACKAGE: "servicepackage", SERVICE_PACKAGE: "servicepackage",
NUMBER_OF_CHIPS: "numberofchips", NUMBER_OF_CHIPS: "numberofchips",
LOG: "log",
UTM_SOURCE: "_source", UTM_SOURCE: "_source",
UTM_MEDIUM: "_medium", UTM_MEDIUM: "_medium",
UTM_CAMPAIGN: "_campaign", UTM_CAMPAIGN: "_campaign",

View file

@ -1123,42 +1123,6 @@ describe("baseInputButton.vue", () => {
}); });
}); });
describe("buttonId", () => {
test("groupName and value combo yield correct id for input button with string value", () => {
// Arrange/Act
const { wrapper } = setupMocks({
mockData: {
propsData: {
groupName: "my test-name",
value: "Aaa-BBB CcC",
},
},
});
// Assert
const inputElement = wrapper.find("input");
expect(wrapper.vm.buttonId).toBe("my-test-name-Aaa-BBB-CcC");
expect(inputElement.attributes().id).toBe("my-test-name-Aaa-BBB-CcC");
});
test("groupName and value combo yield correct id for input button with number value", () => {
// Arrange/Act
const { wrapper } = setupMocks({
mockData: {
propsData: {
groupName: "my test-name",
value: 2,
},
},
});
// Assert
const inputElement = wrapper.find("input");
expect(wrapper.vm.buttonId).toBe("my-test-name-2");
expect(inputElement.attributes().id).toBe("my-test-name-2");
});
});
describe("inputType", () => { describe("inputType", () => {
test("isMultiSelect is true => inputType is 'checkbox'", () => { test("isMultiSelect is true => inputType is 'checkbox'", () => {
// Arrange/Act // Arrange/Act

View file

@ -34,6 +34,7 @@ import {
handleInputComponentBlur, handleInputComponentBlur,
} from "@/helpers/button-question-focus-helper"; } from "@/helpers/button-question-focus-helper";
import { inputButtonProps } from "@/digital-components/base-input-button/button-functionality-props"; import { inputButtonProps } from "@/digital-components/base-input-button/button-functionality-props";
import { v4 as uuidv4 } from "uuid";
export default { export default {
name: "base-input-button", name: "base-input-button",
@ -45,6 +46,7 @@ export default {
data() { data() {
return { return {
valueToEmit: null, valueToEmit: null,
buttonId: uuidv4(),
}; };
}, },
mounted() { mounted() {
@ -153,11 +155,6 @@ export default {
inputType() { inputType() {
return this.isMultiSelect ? "checkbox" : "radio"; return this.isMultiSelect ? "checkbox" : "radio";
}, },
buttonId() {
return `${this.groupName?.replace(" ", "-")}-${this.value
?.toString()
?.replace(" ", "-")}`;
},
isValueSelectedOnClick() { isValueSelectedOnClick() {
return this.isMultiSelect || this.selectingInitiatesLoad; return this.isMultiSelect || this.selectingInitiatesLoad;
}, },

View file

@ -139,7 +139,7 @@
</div> </div>
<div <div
class="my-2 lh-1 applied-promo-tag" class="my-2 lh-1 applied-promo-tag"
v-for="(promoCode, i) in this.getPromoCodeList()" v-for="(promoCode, i) in getPromoCodeList"
:key="i"> :key="i">
<span class="caption" <span class="caption"
>Promo code <span class="promo-code">{{ promoCode }}</span> applied >Promo code <span class="promo-code">{{ promoCode }}</span> applied
@ -183,6 +183,7 @@ export default {
allowItemRemoval: Boolean, allowItemRemoval: Boolean,
recyclingModalCmsWidgetName: String, recyclingModalCmsWidgetName: String,
showAsPaid: Boolean, showAsPaid: Boolean,
isInsurance: Boolean,
insuranceDeductible: Number, insuranceDeductible: Number,
insuranceCompanyName: String, insuranceCompanyName: String,
showInsuranceCoverageAs: String, showInsuranceCoverageAs: String,
@ -282,6 +283,7 @@ export default {
(lineItemsToKeep) => lineItemsToKeep.cartItemType != cartItemType (lineItemsToKeep) => lineItemsToKeep.cartItemType != cartItemType
); );
}, },
getPromoCodeList() { getPromoCodeList() {
if (this.$refs["promoModalQuestion"]) { if (this.$refs["promoModalQuestion"]) {
return this.$refs["promoModalQuestion"].getPromoCodeList(); return this.$refs["promoModalQuestion"].getPromoCodeList();
@ -298,6 +300,14 @@ export default {
this.$emit("update:modelValue", newValue); this.$emit("update:modelValue", newValue);
}, },
}, },
lineItemsWithoutRecal() {
if (!this.lineItems || this.lineItems.length < 1) return;
const lineItemsCopy = deepClone(this.lineItems);
lineItemsCopy.supportingItems = baseMixin.methods.filterOutRecalibration(
lineItemsCopy.supportingItems
);
return lineItemsCopy;
},
showCoverageAsPending() { showCoverageAsPending() {
return this.showInsuranceCoverageAs === coverageStatus.PENDING; return this.showInsuranceCoverageAs === coverageStatus.PENDING;
}, },
@ -426,7 +436,14 @@ export default {
packagePrice() { packagePrice() {
let packagePrice = 0; let packagePrice = 0;
if (!this.showCoverageAsVerified && !this.showCoverageAsPending) { if (!this.isInsurance) {
// CASH ONLY
packagePrice = baseMixin.methods.getTierOnePackagePrice(
baseMixin.methods.filterOutFees(
baseMixin.methods.filterOutRecalibration(this.availableLineItems)
)
);
} else if (!this.showCoverageAsVerified && !this.showCoverageAsPending) {
packagePrice = baseMixin.methods.getTierOnePackagePrice( packagePrice = baseMixin.methods.getTierOnePackagePrice(
baseMixin.methods.filterOutFees(this.availableLineItems) baseMixin.methods.filterOutFees(this.availableLineItems)
); );
@ -915,8 +932,6 @@ export default {
promoCartItems() { promoCartItems() {
const promoCartItems = []; const promoCartItems = [];
// clone the promos array
const promosClone = deepClone(this.promo);
// get unique promo codes // get unique promo codes
const uniquePromoCodes = [ const uniquePromoCodes = [
...new Set( ...new Set(
@ -982,16 +997,23 @@ export default {
return this.getCmsContent("SubtotalTextWidget", "Text"); return this.getCmsContent("SubtotalTextWidget", "Text");
}, },
subTotal() { subTotal() {
return baseMixin.methods.getSubTotal(this.lineItems); if (!this.lineItems || this.lineItems.length < 1) return;
return this.isInsurance
? baseMixin.methods.getSubTotal(this.lineItems)
: baseMixin.methods.getSubTotal(this.lineItemsWithoutRecal);
}, },
salesTax() { salesTax() {
return baseMixin.methods.getSalesTax(this.lineItems); if (!this.lineItems || this.lineItems.length < 1) return;
return this.isInsurance
? baseMixin.methods.getSalesTax(this.lineItems)
: baseMixin.methods.getSalesTax(this.lineItemsWithoutRecal);
}, },
amountDue() { amountDue() {
if (this.showAsPaid) { if (!this.lineItems || this.lineItems.length < 1) return;
return 0; if (this.showAsPaid) return 0;
} return this.isInsurance
return baseMixin.methods.getAmountDue(this.lineItems); ? baseMixin.methods.getAmountDue(this.lineItems)
: baseMixin.methods.getAmountDue(this.lineItemsWithoutRecal);
}, },
amountPaid() { amountPaid() {
if (!this.showAsPaid) { if (!this.showAsPaid) {

View file

@ -8,6 +8,10 @@ export function getDateDifferenceInDays(startDate, endDate) {
return Math.round(difference / (1000 * 3600 * 24)); return Math.round(difference / (1000 * 3600 * 24));
} }
export function get12HourTimeFormat(time) { export function get12HourTimeFormat(time) {
if (!time) {
return null;
}
// Check correct time format and split into components // Check correct time format and split into components
time = time.toString().match(/^([01]\d|2[0-3])(:)([0-5]\d)?$/) || [time]; time = time.toString().match(/^([01]\d|2[0-3])(:)([0-5]\d)?$/) || [time];
@ -20,8 +24,12 @@ export function get12HourTimeFormat(time) {
return time.join(""); // return adjusted time or original string return time.join(""); // return adjusted time or original string
} }
export function get12HourTimeMobileFormat(time) { export function get12HourTimeMobileFormat(time) {
if (!time) {
return null;
}
// Check correct time format and split into components // Check correct time format and split into components
time = time.toString().match(/^([01]\d|2[0-3])(:)([0-5]\d)?$/) || [time]; time = time?.toString().match(/^([01]\d|2[0-3])(:)([0-5]\d)?$/) || [time];
if (time.length > 1) { if (time.length > 1) {
// If time format correct // If time format correct

View file

@ -107,8 +107,12 @@ export async function getImplicitNavigation(toRoute) {
*/ */
export async function navigateToHeritageFunnel({ shouldSaveSession, pageNameToLog }) { export async function navigateToHeritageFunnel({ shouldSaveSession, pageNameToLog }) {
console.log(new Date() + " navigateToHeritageFunnel: " + JSON.stringify(applicationConfig)); const log = getQuerystringParameter(queryStrings.LOG);
console.log(new Date() + " navigateToHeritageFunnel: " + applicationConfig.HERITAGE_FUNNEL); if (eval(log)) {
console.log(new Date() + " applicationConfig: " + JSON.stringify(applicationConfig));
console.log(new Date() + " navigateToHeritageFunnel: " + applicationConfig.HERITAGE_FUNNEL);
}
// Create the order (or save existing order) when navigating to Heritage Funnel. // Create the order (or save existing order) when navigating to Heritage Funnel.
if (shouldSaveSession) { if (shouldSaveSession) {
await saveSession({ pageNameToLog: pageNameToLog, shouldAwaitSaveSessionQueue: true }); await saveSession({ pageNameToLog: pageNameToLog, shouldAwaitSaveSessionQueue: true });

View file

@ -150,7 +150,7 @@ 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.isExternalParameter) { if (store.getters.externalParameterState?.isExternalParameter) {
baseMixin.methods.ResetExternalParamsAndHideModal(); baseMixin.methods.ResetExternalParamsAndHideModal();
} }
}); });

View file

@ -54,7 +54,7 @@ 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.isExternalParameter) { if (store.getters.externalParameterState?.isExternalParameter) {
baseMixin.methods.ResetExternalParamsAndHideModal(); baseMixin.methods.ResetExternalParamsAndHideModal();
} }
}); });

View file

@ -34,6 +34,8 @@ import {
import store from "@/store"; import store from "@/store";
import { serviceType } from "@/constants/service-type"; import { serviceType } from "@/constants/service-type";
import { applicationConfig } from "@/constants/application-config.js"; import { applicationConfig } from "@/constants/application-config.js";
import baseMixin from "@/mixins/base-mixin.js";
export default { export default {
name: "add-to-calendar", name: "add-to-calendar",
components: { components: {
@ -110,10 +112,10 @@ export default {
return this.getCmsContent(this.sameDayDropOffWidgetName, "BodyText"); return this.getCmsContent(this.sameDayDropOffWidgetName, "BodyText");
}, },
UniqueId() { UniqueId() {
return store.getters.submittedOrder.referralNumber?.toString(); return this.getSubmittedOrder()?.referralNumber?.toString();
}, },
ServiceType() { ServiceType() {
const isRepair = store.getters.submittedOrder.damage.isRepair; const isRepair = this.getSubmittedOrder()?.damage.isRepair;
const funnelHasRecalibrationPart = store.getters.isRecalibrationOnSubmittedOrder; const funnelHasRecalibrationPart = store.getters.isRecalibrationOnSubmittedOrder;
if (!isRepair) { if (!isRepair) {
if (funnelHasRecalibrationPart) { if (funnelHasRecalibrationPart) {
@ -125,7 +127,7 @@ export default {
return serviceType.REPAIR; return serviceType.REPAIR;
}, },
RouteCode() { RouteCode() {
return store.getters.submittedOrder.schedule.routeCode; return this.getSubmittedOrder()?.schedule.routeCode;
}, },
Appointment() { Appointment() {
var subject = ""; var subject = "";
@ -206,6 +208,9 @@ export default {
}, },
methods: { methods: {
getSubmittedOrder() {
return baseMixin.methods.getSubmittedOrder();
},
setCalendarAppointment(calendarOption) { setCalendarAppointment(calendarOption) {
if ( if (
calendarOption.name == calendarOptions.ICAL || calendarOption.name == calendarOptions.ICAL ||

View file

@ -19,67 +19,6 @@ beforeEach(() => {
jest.restoreAllMocks(); jest.restoreAllMocks();
jest.clearAllMocks(); jest.clearAllMocks();
store.getters = { store.getters = {
submittedOrder: {
schedule: {
date: "2023-01-01",
startTime: "09:00",
endTime: "10:00",
routeCode: "000",
jobMaxMinutes: "120",
jobMinMinutes: "60",
},
lineItems: {
glassParts: [
{
partNumber: "ABC123",
},
],
supportingItems: [],
},
serviceLocation: {
address: "test",
address2: "123",
city: "test",
state: "AZ",
appointmentType: "Inshop",
zipCode: "12345",
zipCodeCtu: "01234",
provider: {
providerNumber: "123",
address: {
streetAddress: "test1",
city: "test",
state: "AZ",
zipCode: "12345",
zipCodeCtu: "01234",
},
},
},
damage: {
isRepair: false,
},
payment: {
isPia: true,
isInsurance: false,
insuranceCoverage: {
coverageStatus: "test",
},
},
policy: {
isNoComp: false,
currentDeductible: 1,
insuranceCompanyName: "test name",
},
referralNumber: "1234567",
vehicle: {
year: "2004",
make: "Ford",
model: "F Series F250",
},
customer: {
emailAddress: "test@test.com",
},
},
order: { order: {
schedule: { schedule: {
date: "2023-01-01", date: "2023-01-01",
@ -96,6 +35,7 @@ beforeEach(() => {
supportingItems: [], supportingItems: [],
}, },
serviceLocation: { serviceLocation: {
appointmentType: AppointmentTypeStrings.IN_SHOP,
address: "test", address: "test",
address2: "123", address2: "123",
city: "test", city: "test",
@ -180,6 +120,20 @@ describe("computed properties...", () => {
test("ScheduleDateFormatted should return date in expected format.", () => { test("ScheduleDateFormatted should return date in expected format.", () => {
//Arrange //Arrange
const { wrapper } = setupMocks({}); const { wrapper } = setupMocks({});
wrapper.vm.submittedOrder = {
vehicle: {
imageUrl: "",
},
schedule: {
startTime: "09:00",
endTime: "11:00",
date: "2023-01-01",
jobMaxMinutes: 120,
jobMinMinutes: 60,
routeCode: "",
},
serviceLocation: store.getters.order.serviceLocation,
};
// Act // Act
const testValue = wrapper.vm.ScheduleDateFormatted; const testValue = wrapper.vm.ScheduleDateFormatted;
@ -189,11 +143,22 @@ describe("computed properties...", () => {
}); });
test("ScheduleTimeFormatted should return mobile time in expected format.", () => { test("ScheduleTimeFormatted should return mobile time in expected format.", () => {
//Arrange //Arrange
store.getters.submittedOrder.serviceLocation.appointmentType =
AppointmentTypeStrings.MOBILE;
store.getters.submittedOrder.schedule.startTime = "09:00";
store.getters.submittedOrder.schedule.endTime = "11:00";
const { wrapper } = setupMocks({}); const { wrapper } = setupMocks({});
wrapper.vm.submittedOrder = {
vehicle: {
imageUrl: "",
},
schedule: {
startTime: "09:00",
endTime: "11:00",
date: "2024-09-28",
jobMaxMinutes: 120,
jobMinMinutes: 60,
routeCode: "",
},
serviceLocation: store.getters.order.serviceLocation,
};
wrapper.vm.submittedOrder.serviceLocation.appointmentType = AppointmentTypeStrings.MOBILE;
// Act // Act
const testValue = wrapper.vm.ScheduleTimeFormatted; const testValue = wrapper.vm.ScheduleTimeFormatted;
@ -203,11 +168,22 @@ describe("computed properties...", () => {
}); });
test("ScheduleTimeFormatted should return DROP_OFF time in expected format.", () => { test("ScheduleTimeFormatted should return DROP_OFF time in expected format.", () => {
//Arrange //Arrange
store.getters.submittedOrder.serviceLocation.appointmentType =
AppointmentTypeStrings.DROP_OFF;
store.getters.submittedOrder.schedule.startTime = "09:00";
store.getters.submittedOrder.schedule.endTime = "11:00";
const { wrapper } = setupMocks({}); const { wrapper } = setupMocks({});
wrapper.vm.submittedOrder = {
vehicle: {
imageUrl: "",
},
schedule: {
startTime: "09:00",
endTime: "11:00",
date: "2024-09-28",
jobMaxMinutes: 120,
jobMinMinutes: 60,
routeCode: "",
},
serviceLocation: store.getters.order.serviceLocation,
};
wrapper.vm.submittedOrder.serviceLocation.appointmentType = AppointmentTypeStrings.DROP_OFF;
// Act // Act
const testValue = wrapper.vm.ScheduleTimeFormatted; const testValue = wrapper.vm.ScheduleTimeFormatted;
@ -217,11 +193,22 @@ describe("computed properties...", () => {
}); });
test("ScheduleTimeFormatted should return Inshop time in expected format.", () => { test("ScheduleTimeFormatted should return Inshop time in expected format.", () => {
//Arrange //Arrange
store.getters.submittedOrder.serviceLocation.appointmentType =
AppointmentTypeStrings.IN_SHOP;
store.getters.submittedOrder.schedule.startTime = "09:00";
store.getters.submittedOrder.schedule.endTime = "11:00";
const { wrapper } = setupMocks({}); const { wrapper } = setupMocks({});
wrapper.vm.submittedOrder = {
vehicle: {
imageUrl: "",
},
schedule: {
startTime: "09:00",
endTime: "11:00",
date: "2024-09-28",
jobMaxMinutes: 120,
jobMinMinutes: 60,
routeCode: "",
},
serviceLocation: store.getters.order.serviceLocation,
};
wrapper.vm.submittedOrder.serviceLocation.appointmentType = AppointmentTypeStrings.IN_SHOP;
// Act // Act
const testValue = wrapper.vm.ScheduleTimeFormatted; const testValue = wrapper.vm.ScheduleTimeFormatted;
@ -231,10 +218,21 @@ describe("computed properties...", () => {
}); });
test("AppointmentWordingText should return mobile text in expected format.", () => { test("AppointmentWordingText should return mobile text in expected format.", () => {
//Arrange //Arrange
store.getters.submittedOrder.serviceLocation.appointmentType =
AppointmentTypeStrings.MOBILE;
const { wrapper } = setupMocks({}); const { wrapper } = setupMocks({});
wrapper.vm.submittedOrder = {
vehicle: {
imageUrl: "",
},
schedule: {
endTime: "10:00",
date: "2024-09-28",
jobMaxMinutes: 120,
jobMinMinutes: 60,
routeCode: "",
},
serviceLocation: store.getters.order.serviceLocation,
};
wrapper.vm.submittedOrder.serviceLocation.appointmentType = AppointmentTypeStrings.MOBILE;
// Act // Act
const testValue = wrapper.vm.AppointmentWordingText; const testValue = wrapper.vm.AppointmentWordingText;
@ -243,10 +241,21 @@ describe("computed properties...", () => {
}); });
test("AppointmentWordingText should return DROP_OFF text in expected format.", () => { test("AppointmentWordingText should return DROP_OFF text in expected format.", () => {
//Arrange //Arrange
store.getters.submittedOrder.serviceLocation.appointmentType =
AppointmentTypeStrings.DROP_OFF;
const { wrapper } = setupMocks({}); const { wrapper } = setupMocks({});
wrapper.vm.submittedOrder = {
vehicle: {
imageUrl: "",
},
schedule: {
endTime: "10:00",
date: "2024-09-28",
jobMaxMinutes: 120,
jobMinMinutes: 60,
routeCode: "",
},
serviceLocation: store.getters.order.serviceLocation,
};
wrapper.vm.submittedOrder.serviceLocation.appointmentType = AppointmentTypeStrings.DROP_OFF;
// Act // Act
const testValue = wrapper.vm.AppointmentWordingText; const testValue = wrapper.vm.AppointmentWordingText;
@ -256,10 +265,20 @@ describe("computed properties...", () => {
}); });
test("AppointmentWordingText should return IN_SHOP text in expected format.", () => { test("AppointmentWordingText should return IN_SHOP text in expected format.", () => {
//Arrange //Arrange
store.getters.submittedOrder.serviceLocation.appointmentType =
AppointmentTypeStrings.IN_SHOP;
const { wrapper } = setupMocks({}); const { wrapper } = setupMocks({});
wrapper.vm.submittedOrder = {
vehicle: {
imageUrl: "",
},
schedule: {
endTime: "10:00",
date: "2024-09-28",
jobMaxMinutes: 120,
jobMinMinutes: 60,
routeCode: "",
},
serviceLocation: store.getters.order.serviceLocation,
};
// Act // Act
const testValue = wrapper.vm.AppointmentWordingText; const testValue = wrapper.vm.AppointmentWordingText;
@ -280,6 +299,19 @@ describe("computed properties...", () => {
test("ScheduleDate should return date in expected format.", () => { test("ScheduleDate should return date in expected format.", () => {
//Arrange //Arrange
const { wrapper } = setupMocks({}); const { wrapper } = setupMocks({});
wrapper.vm.submittedOrder = {
vehicle: {
imageUrl: "",
},
schedule: {
date: "2023-01-01",
endTime: "10:00",
jobMaxMinutes: 120,
jobMinMinutes: 60,
routeCode: "",
},
serviceLocation: store.getters.order.serviceLocation,
};
// Act // Act
const testValue = wrapper.vm.ScheduleDate; const testValue = wrapper.vm.ScheduleDate;
@ -290,6 +322,19 @@ describe("computed properties...", () => {
test("ScheduleStartTime should return time in expected format.", () => { test("ScheduleStartTime should return time in expected format.", () => {
//Arrange //Arrange
const { wrapper } = setupMocks({}); const { wrapper } = setupMocks({});
wrapper.vm.submittedOrder = {
vehicle: {
imageUrl: "",
},
schedule: {
startTime: "09:00",
date: "2024-09-28",
jobMaxMinutes: 120,
jobMinMinutes: 60,
routeCode: "",
},
serviceLocation: store.getters.order.serviceLocation,
};
// Act // Act
const testValue = wrapper.vm.ScheduleStartTime; const testValue = wrapper.vm.ScheduleStartTime;
@ -300,6 +345,19 @@ describe("computed properties...", () => {
test("ScheduleEndTime should return time in expected format.", () => { test("ScheduleEndTime should return time in expected format.", () => {
//Arrange //Arrange
const { wrapper } = setupMocks({}); const { wrapper } = setupMocks({});
wrapper.vm.submittedOrder = {
vehicle: {
imageUrl: "",
},
schedule: {
endTime: "10:00",
date: "2024-09-28",
jobMaxMinutes: 120,
jobMinMinutes: 60,
routeCode: "",
},
serviceLocation: store.getters.order.serviceLocation,
};
// Act // Act
const testValue = wrapper.vm.ScheduleEndTime; const testValue = wrapper.vm.ScheduleEndTime;
@ -344,6 +402,18 @@ describe("computed properties...", () => {
//Arrange //Arrange
const { wrapper } = setupMocks({}); const { wrapper } = setupMocks({});
wrapper.vm.submittedOrder = {
vehicle: {
imageUrl: "",
},
schedule: {
date: "2024-09-28",
jobMaxMinutes: 120,
jobMinMinutes: 60,
routeCode: "",
},
serviceLocation: store.getters.order.serviceLocation,
};
// Act // Act
const testValue = wrapper.vm.ServiceLocationFullAddress; const testValue = wrapper.vm.ServiceLocationFullAddress;
@ -355,6 +425,18 @@ describe("computed properties...", () => {
//Arrange //Arrange
const { wrapper } = setupMocks({}); const { wrapper } = setupMocks({});
wrapper.vm.submittedOrder = {
vehicle: {
imageUrl: "",
},
schedule: {
date: "2024-09-28",
jobMaxMinutes: 120,
jobMinMinutes: 60,
routeCode: "",
},
serviceLocation: store.getters.order.serviceLocation,
};
// Act // Act
const testValue = wrapper.vm.ProviderFullAddress; const testValue = wrapper.vm.ProviderFullAddress;
@ -366,6 +448,17 @@ describe("computed properties...", () => {
//Arrange //Arrange
const { wrapper } = setupMocks({}); const { wrapper } = setupMocks({});
wrapper.vm.submittedOrder = {
vehicle: {
imageUrl: "",
},
schedule: {
date: "2024-09-28",
jobMaxMinutes: 120,
jobMinMinutes: 60,
routeCode: "",
},
};
// Act // Act
const testValue = wrapper.vm.AppointmentDuration; const testValue = wrapper.vm.AppointmentDuration;
@ -375,9 +468,18 @@ describe("computed properties...", () => {
}); });
test("Appointment Duration should return with correct duration values in expected format for hours.", () => { test("Appointment Duration should return with correct duration values in expected format for hours.", () => {
//Arrange //Arrange
store.getters.submittedOrder.schedule.jobMaxMinutes = 120;
store.getters.submittedOrder.schedule.jobMinMinutes = 60;
const { wrapper } = setupMocks({}); const { wrapper } = setupMocks({});
wrapper.vm.submittedOrder = {
vehicle: {
imageUrl: "",
},
schedule: {
date: "2024-09-28",
jobMaxMinutes: 120,
jobMinMinutes: 60,
routeCode: "",
},
};
// Act // Act
const testValue = wrapper.vm.AppointmentDuration; const testValue = wrapper.vm.AppointmentDuration;
@ -387,9 +489,18 @@ describe("computed properties...", () => {
}); });
test("Appointment Duration should return with correct duration values in expected format for minutes.", () => { test("Appointment Duration should return with correct duration values in expected format for minutes.", () => {
//Arrange //Arrange
store.getters.submittedOrder.schedule.jobMaxMinutes = 45;
store.getters.submittedOrder.schedule.jobMinMinutes = 30;
const { wrapper } = setupMocks({}); const { wrapper } = setupMocks({});
wrapper.vm.submittedOrder = {
vehicle: {
imageUrl: "",
},
schedule: {
date: "2024-09-28",
jobMaxMinutes: 45,
jobMinMinutes: 30,
routeCode: "",
},
};
// Act // Act
const testValue = wrapper.vm.AppointmentDuration; const testValue = wrapper.vm.AppointmentDuration;
@ -400,10 +511,18 @@ describe("computed properties...", () => {
test("Appointment Duration should return with All Day.", () => { test("Appointment Duration should return with All Day.", () => {
//Arrange //Arrange
store.getters.submittedOrder.schedule.jobMaxMinutes = 45;
store.getters.submittedOrder.schedule.jobMinMinutes = 30;
store.getters.submittedOrder.schedule.routeCode = RouteCodeFlags.ALL_DAY_DROP_OFF;
const { wrapper } = setupMocks({}); const { wrapper } = setupMocks({});
wrapper.vm.submittedOrder = {
vehicle: {
imageUrl: "",
},
schedule: {
date: "2024-09-28",
jobMaxMinutes: 45,
jobMinMinutes: 30,
routeCode: RouteCodeFlags.ALL_DAY_DROP_OFF,
},
};
// Act // Act
const testValue = wrapper.vm.AppointmentDuration; const testValue = wrapper.vm.AppointmentDuration;
@ -414,10 +533,18 @@ describe("computed properties...", () => {
test("Appointment Duration should return with Overnight.", () => { test("Appointment Duration should return with Overnight.", () => {
//Arrange //Arrange
store.getters.submittedOrder.schedule.jobMaxMinutes = 45;
store.getters.submittedOrder.schedule.jobMinMinutes = 30;
store.getters.submittedOrder.schedule.routeCode = RouteCodeFlags.OVERNIGHT_DROP_OFF;
const { wrapper } = setupMocks({}); const { wrapper } = setupMocks({});
wrapper.vm.submittedOrder = {
vehicle: {
imageUrl: "",
},
schedule: {
date: "2024-09-28",
jobMaxMinutes: 45,
jobMinMinutes: 30,
routeCode: RouteCodeFlags.OVERNIGHT_DROP_OFF,
},
};
// Act // Act
const testValue = wrapper.vm.AppointmentDuration; const testValue = wrapper.vm.AppointmentDuration;

View file

@ -112,13 +112,14 @@ export default {
await baseMixin.methods.dispatchStoreAction(storeActions.CREATE_SUBMITTED_ORDER); await baseMixin.methods.dispatchStoreAction(storeActions.CREATE_SUBMITTED_ORDER);
// Call APIs // Call APIs
const submittedOrder = baseMixin.methods.getSubmittedOrder();
const cmsContentPromise = fetchCmsContentForPage(to.query.fmgPage); const cmsContentPromise = fetchCmsContentForPage(to.query.fmgPage);
const wipersPromise = baseMixin.methods.dispatchStoreActionWithLogging( const wipersPromise = baseMixin.methods.dispatchStoreActionWithLogging(
storeActions.GET_WIPERS, storeActions.GET_WIPERS,
{ {
serviceZipCode: store.getters.submittedOrder.serviceLocation.zipCode, serviceZipCode: submittedOrder.serviceLocation.zipCode,
carId: store.getters.submittedOrder.vehicle.carId, carId: submittedOrder.vehicle.carId,
}, },
"confirmation" "confirmation"
); );
@ -147,24 +148,26 @@ export default {
const resultMap = await settleAllPromises(promiseResultMap); const resultMap = await settleAllPromises(promiseResultMap);
const availableVaps = [resultMap.rainDefense, ...resultMap.wipers]; const availableVaps = [resultMap.rainDefense, ...resultMap.wipers];
const lineItemsFromSubmittedOrder = deepClone(store.getters.submittedOrder.lineItems); const lineItemsFromSubmittedOrder = deepClone(submittedOrder.lineItems);
// 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);
vm.lineItems = lineItemsFromSubmittedOrder; vm.lineItems = lineItemsFromSubmittedOrder;
vm.vaps = availableVaps; vm.vaps = availableVaps;
vm.submittedOrder = submittedOrder;
}); });
}, },
data() { data() {
return { return {
lineItems: [], lineItems: [],
vaps: [], vaps: [],
submittedOrder: null,
}; };
}, },
computed: { computed: {
ShowCart() { ShowCart() {
if (this.isPia && store.getters.submittedOrder.settledTenderAmount == 0) { if (this.isPia && this.submittedOrder?.settledTenderAmount == 0) {
// settleTenderAmount always shows 0 via localhost or dev. // settleTenderAmount always shows 0 via localhost or dev.
// Temporarily set return true to see cart in localhost or dev environment // Temporarily set return true to see cart in localhost or dev environment
return false; return false;
@ -179,62 +182,102 @@ export default {
return this.getCmsContent("ScheduleConfirmationWidget", "Image"); return this.getCmsContent("ScheduleConfirmationWidget", "Image");
}, },
CustomerPortalLoginToken() { CustomerPortalLoginToken() {
return store.getters.submittedOrder.customerPortalLoginToken; return this.submittedOrder?.customerPortalLoginToken;
}, },
ConfirmationEmailText() { ConfirmationEmailText() {
return this.getCmsContent("ConfirmationEmailWidget", "BodyText") return this.getCmsContent("ConfirmationEmailWidget", "BodyText")
?.replaceAll(
"{custom:submittedOrder.customer.emailAddress}",
this.submittedOrder?.customer?.emailAddress
)
?.replaceAll("{custom:MY_ACCOUNT_URL}", applicationConfig.MY_ACCOUNT) ?.replaceAll("{custom:MY_ACCOUNT_URL}", applicationConfig.MY_ACCOUNT)
?.replaceAll("{custom:CUSTOMER_PORTAL_LOGIN_TOKEN}", this.CustomerPortalLoginToken) ?.replaceAll("{custom:CUSTOMER_PORTAL_LOGIN_TOKEN}", this.CustomerPortalLoginToken)
?.replaceAll("&lt;", "<") ?.replaceAll("&lt;", "<")
?.replaceAll("&gt;", ">"); ?.replaceAll("&gt;", ">");
}, },
ScheduleDate() { ScheduleDate() {
return store.getters.submittedOrder.schedule.date; return this.submittedOrder?.schedule?.date;
}, },
AppointmentType() { AppointmentType() {
return store.getters.submittedOrder.serviceLocation.appointmentType; return this.submittedOrder?.serviceLocation?.appointmentType;
}, },
ScheduleStartTime() { ScheduleStartTime() {
return store.getters.submittedOrder.schedule.startTime; return this.submittedOrder?.schedule?.startTime;
}, },
ScheduleEndTime() { ScheduleEndTime() {
return store.getters.submittedOrder.schedule.endTime; return this.submittedOrder?.schedule?.endTime;
}, },
InShopWordingText() { InShopWordingText() {
return this.getCmsContent("InShopWordingWidget", "BodyText"); return this.getCmsContent("InShopWordingWidget", "BodyText")
?.replaceAll(
"{custom:submittedOrder.vehicle.year}",
this.submittedOrder?.vehicle?.year
)
?.replaceAll(
"{custom:submittedOrder.vehicle.make}",
this.submittedOrder?.vehicle?.make
)
?.replaceAll(
"{custom:submittedOrder.vehicle.model}",
this.submittedOrder?.vehicle?.model
);
}, },
MobileWordingText() { MobileWordingText() {
return this.getCmsContent("MobileWordingWidget", "BodyText"); return this.getCmsContent("MobileWordingWidget", "BodyText")
?.replaceAll(
"{custom:submittedOrder.vehicle.year}",
this.submittedOrder?.vehicle?.year
)
?.replaceAll(
"{custom:submittedOrder.vehicle.make}",
this.submittedOrder?.vehicle?.make
)
?.replaceAll(
"{custom:submittedOrder.vehicle.model}",
this.submittedOrder?.vehicle?.model
);
}, },
DropOffWordingText() { DropOffWordingText() {
return this.getCmsContent("DropOffWordingWidget", "BodyText"); return this.getCmsContent("DropOffWordingWidget", "BodyText")
?.replaceAll(
"{custom:submittedOrder.vehicle.year}",
this.submittedOrder?.vehicle?.year
)
?.replaceAll(
"{custom:submittedOrder.vehicle.make}",
this.submittedOrder?.vehicle?.make
)
?.replaceAll(
"{custom:submittedOrder.vehicle.model}",
this.submittedOrder?.vehicle?.model
);
}, },
ServiceLocationAddress() { ServiceLocationAddress() {
return store.getters.submittedOrder.serviceLocation.address; return this.submittedOrder?.serviceLocation?.address;
}, },
ServiceLocationAddress2() { ServiceLocationAddress2() {
return store.getters.submittedOrder.serviceLocation.address2; return this.submittedOrder?.serviceLocation?.address2;
}, },
ServiceLocationCity() { ServiceLocationCity() {
return store.getters.submittedOrder.serviceLocation.city; return this.submittedOrder?.serviceLocation?.city;
}, },
ServiceLocationState() { ServiceLocationState() {
return store.getters.submittedOrder.serviceLocation.state; return this.submittedOrder?.serviceLocation?.state;
}, },
ServiceLocationZipCode() { ServiceLocationZipCode() {
return store.getters.submittedOrder.serviceLocation.zipCode; return this.submittedOrder?.serviceLocation?.zipCode;
}, },
ProviderAddress() { ProviderAddress() {
return store.getters.submittedOrder.serviceLocation.provider.address.streetAddress; return this.submittedOrder?.serviceLocation?.provider?.address?.streetAddress;
}, },
ProviderCity() { ProviderCity() {
return store.getters.submittedOrder.serviceLocation.provider.address.city; return this.submittedOrder?.serviceLocation?.provider?.address?.city;
}, },
ProviderState() { ProviderState() {
return store.getters.submittedOrder.serviceLocation.provider.address.state; return this.submittedOrder?.serviceLocation?.provider?.address?.state;
}, },
ProviderZipCode() { ProviderZipCode() {
return store.getters.submittedOrder.serviceLocation.provider.address.zipCode; return this.submittedOrder?.serviceLocation?.provider?.address?.zipCode;
}, },
AppointmentWordingText() { AppointmentWordingText() {
if (this.AppointmentType == AppointmentTypeStrings.MOBILE) { if (this.AppointmentType == AppointmentTypeStrings.MOBILE) {
@ -268,7 +311,7 @@ export default {
// This conversion ensures we don't get get GMT induced date changes // This conversion ensures we don't get get GMT induced date changes
const dateObject = convertDateStringToDate(this.ScheduleDate); const dateObject = convertDateStringToDate(this.ScheduleDate);
// Ex: Tuesday, April 22 // Ex: Tuesday, April 22
return dateObject.toLocaleDateString("en-us", { return dateObject?.toLocaleDateString("en-us", {
weekday: "long", weekday: "long",
month: "long", month: "long",
day: "numeric", day: "numeric",
@ -286,19 +329,19 @@ export default {
} }
}, },
vehicleBannerImageUrl() { vehicleBannerImageUrl() {
return store.getters.submittedOrder?.vehicle.imageUrl; return this.submittedOrder?.vehicle.imageUrl;
}, },
damageInfo() { damageInfo() {
return store.getters.submittedOrder.damage; return this.submittedOrder?.damage;
}, },
isInsurance() { isInsurance() {
return store.getters.submittedOrder.payment.isInsurance; return this.submittedOrder?.payment?.isInsurance;
}, },
isNoComp() { isNoComp() {
return store.getters.submittedOrder.policy.isNoComp; return this.submittedOrder?.policy?.isNoComp;
}, },
isItac() { isItac() {
return store.getters.submittedOrder.policy.isItac; return this.submittedOrder?.policy?.isItac;
}, },
hasVapsInCart() { hasVapsInCart() {
if (this.lineItems?.vaps?.length > 0) { if (this.lineItems?.vaps?.length > 0) {
@ -311,32 +354,28 @@ export default {
if (this.isNoComp || this.isItac) { if (this.isNoComp || this.isItac) {
return coverageStatus.NOCOMP; return coverageStatus.NOCOMP;
} else { } else {
return store.getters.submittedOrder.payment.insuranceCoverage.coverageStatus; return this.submittedOrder?.payment?.insuranceCoverage?.coverageStatus;
} }
}, },
currentDeductible() { currentDeductible() {
return store.getters.submittedOrder.policy.currentDeductible; return this.submittedOrder?.policy?.currentDeductible;
}, },
insuranceCompanyName() { insuranceCompanyName() {
return store.getters.submittedOrder.policy.insuranceCompanyName; return this.submittedOrder?.policy?.insuranceCompanyName;
}, },
isPia() { isPia() {
return store.getters.submittedOrder?.payment.isPia; return this.submittedOrder?.payment?.isPia;
}, },
AppointmentDuration() { AppointmentDuration() {
const durationMaximum = store.getters.submittedOrder?.schedule?.jobMaxMinutes; const durationMaximum = this.submittedOrder?.schedule?.jobMaxMinutes;
const durationMinimum = store.getters.submittedOrder?.schedule?.jobMinMinutes; const durationMinimum = this.submittedOrder?.schedule?.jobMinMinutes;
const durationLengthString = "Duration: "; const durationLengthString = "Duration: ";
if ( if (
store.getters.submittedOrder?.schedule?.routeCode.includes( this.submittedOrder?.schedule?.routeCode.includes(RouteCodeFlags.ALL_DAY_DROP_OFF)
RouteCodeFlags.ALL_DAY_DROP_OFF
)
) { ) {
return durationLengthString.concat("All Day"); return durationLengthString.concat("All Day");
} else if ( } else if (
store.getters.submittedOrder?.schedule?.routeCode.includes( this.submittedOrder?.schedule?.routeCode.includes(RouteCodeFlags.OVERNIGHT_DROP_OFF)
RouteCodeFlags.OVERNIGHT_DROP_OFF
)
) { ) {
return durationLengthString.concat("Overnight"); return durationLengthString.concat("Overnight");
} else { } else {
@ -348,7 +387,7 @@ export default {
}, },
methods: { methods: {
arePagePrerequisitesValid() { arePagePrerequisitesValid() {
if (store.getters.hasSubmittedOrder) { if (baseMixin.methods.hasSubmittedOrder()) {
return true; return true;
} }

View file

@ -216,7 +216,7 @@ describe("estimate.vue", () => {
describe("estimate.vue", () => { describe("estimate.vue", () => {
test("should call forwardButtonAction if isExternalParameter is true and form is valid", async () => { test("should call forwardButtonAction if isExternalParameter is true and form is valid", async () => {
store.getters = { store.getters = {
isExternalParameter: true, externalParameterState: { isExternalParameter: true },
externalParameterEstimate: { vinSelection: "decline" }, externalParameterEstimate: { vinSelection: "decline" },
}; };
// Set up the component // Set up the component

View file

@ -146,7 +146,7 @@ export default {
} }
vm.setCmsContent(resultMap.cmsContent); vm.setCmsContent(resultMap.cmsContent);
if (store.getters.isExternalParameter) { if (store.getters.externalParameterState?.isExternalParameter) {
if (store.getters.externalParameterEstimate.vinSelection) { if (store.getters.externalParameterEstimate.vinSelection) {
vm.selectedVinLookupMethod = vinPagesMixin.methods.getVinlookupMethod( vm.selectedVinLookupMethod = vinPagesMixin.methods.getVinlookupMethod(
store.getters.externalParameterEstimate.vinSelection store.getters.externalParameterEstimate.vinSelection

View file

@ -76,7 +76,7 @@ export default {
next((vm) => { next((vm) => {
vm.setCmsContent(resultMap.cmsContent); vm.setCmsContent(resultMap.cmsContent);
vm.originalList = resultMap.insuranceCompanyList; vm.originalList = resultMap.insuranceCompanyList;
if (store.getters.isExternalParameter) { if (store.getters.externalParameterState?.isExternalParameter) {
baseMixin.methods.ResetExternalParamsAndHideModal(); baseMixin.methods.ResetExternalParamsAndHideModal();
} }
}); });

View file

@ -148,7 +148,7 @@ 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.isExternalParameter) { if (store.getters.externalParameterState?.isExternalParameter) {
baseMixin.methods.ResetExternalParamsAndHideModal(); baseMixin.methods.ResetExternalParamsAndHideModal();
} }
}); });

View file

@ -54,7 +54,7 @@ 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.isExternalParameter) { if (store.getters.externalParameterState?.isExternalParameter) {
baseMixin.methods.ResetExternalParamsAndHideModal(); baseMixin.methods.ResetExternalParamsAndHideModal();
} }
}); });

View file

@ -54,7 +54,7 @@ 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.isExternalParameter) { if (store.getters.externalParameterState?.isExternalParameter) {
baseMixin.methods.ResetExternalParamsAndHideModal(); baseMixin.methods.ResetExternalParamsAndHideModal();
} }
}); });

View file

@ -30,6 +30,7 @@
pageName="payment-method" pageName="payment-method"
servicePackageOptionsCmsName="ServicePackageTitle" servicePackageOptionsCmsName="ServicePackageTitle"
recyclingModalCmsWidgetName="RecycleModal" recyclingModalCmsWidgetName="RecycleModal"
:isInsurance="isInsurance"
:insuranceDeductible="currentDeductible" :insuranceDeductible="currentDeductible"
:insuranceCompanyName="insuranceCompanyName" :insuranceCompanyName="insuranceCompanyName"
:showInsuranceCoverageAs="showInsuranceCoverageAs" /> :showInsuranceCoverageAs="showInsuranceCoverageAs" />
@ -573,7 +574,10 @@ export default {
); );
}, },
hasSubmittedOrder() { hasSubmittedOrder() {
return this.$store.getters.hasSubmittedOrder; return baseMixin.methods.hasSubmittedOrder();
},
getSubmittedOrder() {
return baseMixin.methods.getSubmittedOrder();
}, },
openModal(modalName) { openModal(modalName) {
this.$refs[modalName].openModal(); this.$refs[modalName].openModal();
@ -600,17 +604,17 @@ export default {
}, },
isInsurance() { isInsurance() {
return this.hasSubmittedOrder() return this.hasSubmittedOrder()
? this.$store.getters.submittedOrder.payment.isInsurance ? this.getSubmittedOrder()?.payment.isInsurance
: this.$store.getters.payment.isInsurance; : this.$store.getters.payment.isInsurance;
}, },
isNoComp() { isNoComp() {
return this.hasSubmittedOrder() return this.hasSubmittedOrder()
? this.$store.getters.submittedOrder.policy.isNoComp ? this.getSubmittedOrder()?.policy.isNoComp
: this.$store.getters.policy.isNoComp; : this.$store.getters.policy.isNoComp;
}, },
isItac() { isItac() {
return this.hasSubmittedOrder() return this.hasSubmittedOrder()
? this.$store.getters.submittedOrder.policy.isItac ? this.getSubmittedOrder()?.policy.isItac
: this.$store.getters.policy.isItac; : this.$store.getters.policy.isItac;
}, },
hasVapsInCart() { hasVapsInCart() {
@ -625,13 +629,13 @@ export default {
return coverageStatus.NOCOMP; return coverageStatus.NOCOMP;
} else { } else {
return this.hasSubmittedOrder() return this.hasSubmittedOrder()
? this.$store.getters.submittedOrder.payment.insuranceCoverage.coverageStatus ? this.getSubmittedOrder()?.payment.insuranceCoverage.coverageStatus
: this.$store.getters.payment.insuranceCoverage.coverageStatus; : this.$store.getters.payment.insuranceCoverage.coverageStatus;
} }
}, },
currentDeductible() { currentDeductible() {
return this.hasSubmittedOrder() return this.hasSubmittedOrder()
? this.$store.getters.submittedOrder.policy.currentDeductible ? this.getSubmittedOrder()?.policy.currentDeductible
: this.$store.getters.policy.currentDeductible; : this.$store.getters.policy.currentDeductible;
}, },
insuranceCompanyName() { insuranceCompanyName() {

View file

@ -701,7 +701,7 @@ describe("quote.vue", () => {
inactivePromos: [], inactivePromos: [],
}, },
}, },
isExternalParameter: true, externalParameterState: { isExternalParameter: true },
externalParameterQuote: { externalParameterQuote: {
isInsurance: true, isInsurance: true,
servicePackage: "glassonly", servicePackage: "glassonly",

View file

@ -323,7 +323,7 @@ export default {
} }
} }
if (store.getters.isExternalParameter) { if (store.getters.externalParameterState?.isExternalParameter) {
if (store.getters.externalParameterQuote.isInsurance == true) { if (store.getters.externalParameterQuote.isInsurance == true) {
vm.isInsuranceSelected = true; vm.isInsuranceSelected = true;
vm.servicePackage = store.getters.externalParameterQuote.servicePackage; vm.servicePackage = store.getters.externalParameterQuote.servicePackage;

View file

@ -169,6 +169,7 @@ function resetMockStoreData() {
zipCode: null, zipCode: null,
emailAddress: null, emailAddress: null,
}, },
externalParameterState: { isExternalParameter: false },
}; };
} }
@ -412,7 +413,7 @@ describe("service-zip.vue", () => {
describe("service-zip.vue", () => { describe("service-zip.vue", () => {
test("should call forwardButtonAction if isExternalParameter is true and form is valid", async () => { test("should call forwardButtonAction if isExternalParameter is true and form is valid", async () => {
// Set up the store with isExternalParameter as true // Set up the store with isExternalParameter as true
store.getters.isExternalParameter = true; store.getters.externalParameterState = { isExternalParameter: true };
// Set up the component // Set up the component
const wrapper = setupMocks({}); const wrapper = setupMocks({});
@ -436,7 +437,7 @@ describe("service-zip.vue", () => {
}); });
test("should not call forwardButtonAction if isExternalParameter is true and form is invalid", async () => { test("should not call forwardButtonAction if isExternalParameter is true and form is invalid", async () => {
// Set up the store with isExternalParameter as true // Set up the store with isExternalParameter as true
store.getters.isExternalParameter = true; store.getters.externalParameterState = { isExternalParameter: true };
// Set up the component // Set up the component
const wrapper = setupMocks({}); const wrapper = setupMocks({});

View file

@ -132,7 +132,7 @@ export default {
next(async (vm) => { next(async (vm) => {
vm.setCmsContent(resultMap.cmsContent); vm.setCmsContent(resultMap.cmsContent);
if (store.getters.isExternalParameter) { if (store.getters.externalParameterState?.isExternalParameter) {
const isValid = await baseMixin.methods.isFormValid(vm.$refs.theForm); const isValid = await baseMixin.methods.isFormValid(vm.$refs.theForm);
if (isValid) { if (isValid) {
vm.forwardButtonAction(); vm.forwardButtonAction();
@ -188,7 +188,7 @@ export default {
if (!zipCodeData.isValid) { if (!zipCodeData.isValid) {
this.displayInvalidZipAlert = true; this.displayInvalidZipAlert = true;
if (store.getters.isExternalParameter) { if (store.getters.externalParameterState?.isExternalParameter) {
baseMixin.methods.ResetExternalParamsAndHideModal(); baseMixin.methods.ResetExternalParamsAndHideModal();
} }
return this.$refs.navbar.removeLoader(); return this.$refs.navbar.removeLoader();
@ -197,7 +197,7 @@ export default {
if (!zipCodeData.isServiceable) { if (!zipCodeData.isServiceable) {
this.displayNonServiceableZipAlert = true; this.displayNonServiceableZipAlert = true;
if (store.getters.isExternalParameter) { if (store.getters.externalParameterState?.isExternalParameter) {
baseMixin.methods.ResetExternalParamsAndHideModal(); baseMixin.methods.ResetExternalParamsAndHideModal();
} }
return this.$refs.navbar.removeLoader(); return this.$refs.navbar.removeLoader();

View file

@ -66,7 +66,7 @@ jest.mock("@/store", () => ({
glassToReplace: [], glassToReplace: [],
}, },
}, },
isExternalParameter: false, externalParameterState: { isExternalParameter: false },
externalParameterDamage: { externalParameterDamage: {
damageType: null, damageType: null,
isRepair: null, isRepair: null,
@ -813,7 +813,7 @@ describe("vehicle-damage.vue", () => {
describe("vehicle-damage.vue", () => { describe("vehicle-damage.vue", () => {
test("should call forwardButtonAction if isExternalParameter is true and form is valid", async () => { test("should call forwardButtonAction if isExternalParameter is true and form is valid", async () => {
// Set up the store with isExternalParameter as true // Set up the store with isExternalParameter as true
store.getters.isExternalParameter = true; store.getters.externalParameterState = { isExternalParameter: true };
store.getters.externalParameterDamage = { store.getters.externalParameterDamage = {
damageType: "windshieldReplace", damageType: "windshieldReplace",
isRepair: false, isRepair: false,

View file

@ -1,5 +1,5 @@
<template> <template>
<Form @submit="onSubmit" @invalid-submit="onInvalidSubmit" ref="theForm" v-slot="{ meta }"> <Form @submit="onSubmit" @invalid-submit="onInvalidSubmit" ref="theForm">
<div class="container-fluid page-container-grouped-styles vehicle-damage"> <div class="container-fluid page-container-grouped-styles vehicle-damage">
<div class="row justify-content-center"> <div class="row justify-content-center">
<div class="col-md-6"> <div class="col-md-6">
@ -70,7 +70,7 @@
<div class="col-md-6 col-xl-4"> <div class="col-md-6 col-xl-4">
<navbar <navbar
cmsWidgetName="FunnelFooterWidget" cmsWidgetName="FunnelFooterWidget"
:isForwardActionDisabled="!meta.valid" :isForwardActionDisabled="!isContinueEnabled"
:isBackButtonHidden="shouldHideBackButton" :isBackButtonHidden="shouldHideBackButton"
@back-clicked="backButtonAction" @back-clicked="backButtonAction"
@ForwardClicked="forwardButtonAction" /> @ForwardClicked="forwardButtonAction" />
@ -151,7 +151,7 @@ export default {
vm.$refs.backGlassOptions.initializeComponent( vm.$refs.backGlassOptions.initializeComponent(
resultMap.damageOptions.backGlassOptions.availableReplacementOptions resultMap.damageOptions.backGlassOptions.availableReplacementOptions
); );
if (store.getters.isExternalParameter) { if (store.getters.externalParameterState?.isExternalParameter) {
await nextTick(); await nextTick();
const isValid = await baseMixin.methods.isFormValid(vm.$refs.theForm); const isValid = await baseMixin.methods.isFormValid(vm.$refs.theForm);
if (isValid) { if (isValid) {
@ -180,6 +180,36 @@ export default {
this.attachCustomEvents(); this.attachCustomEvents();
}, },
methods: { methods: {
clearChildEntries() {
if (!this.isSideDoorDamageLocation) {
this.sideDoorOptionsData = {
selectedDoorSides: [],
selectedDriverSideReplaceOptions: [],
selectedPassengerSideReplaceOptions: [],
};
} else {
if (!this.isDriverSideReplace) {
this.sideDoorOptionsData.selectedDriverSideReplaceOptions = [];
}
if (!this.isPassengerSideReplace) {
this.sideDoorOptionsData.selectedPassengerSideReplaceOptions = [];
}
}
if (!this.isRearWindowDamageLocation) {
this.selectedRearReplaceOptions = "";
}
if (!this.isWindshieldDamageLocation) {
this.selectedWindshieldOptions = {
selectedWindshieldDamageType: "",
selectedWindshieldChipCount: null,
selectedWindshieldReplaceOptions: [],
};
} else {
if (!this.isWindshieldRepair) {
this.selectedWindshieldOptions.selectedWindshieldChipCount = null;
}
}
},
arePagePrerequisitesValid() { arePagePrerequisitesValid() {
if (store.getters.vehicle.carId) { if (store.getters.vehicle.carId) {
return true; return true;
@ -584,6 +614,94 @@ export default {
shouldHideBackButton() { shouldHideBackButton() {
return this.$store.getters.requiresVerifiedRedirecting; return this.$store.getters.requiresVerifiedRedirecting;
}, },
isContinueEnabled() {
return (
this.isAnyDamageSelected &&
this.isWindshieldValid &&
this.isRearGlassValid &&
this.isSideGlassValid
);
},
isAnyDamageSelected() {
return this.selectedDamageLocations != null && this.selectedDamageLocations.length != 0;
},
isSideGlassValid() {
if (this.isSideDoorDamageLocation) {
if (
this.sideDoorOptionsData.selectedDoorSides == null ||
this.sideDoorOptionsData.selectedDoorSides == 0
) {
// SideDoor is selected, but "which side" question is unanswered
return false;
} else {
if (this.isPassengerSideReplace) {
if (
this.sideDoorOptionsData.selectedPassengerSideReplaceOptions == null ||
this.sideDoorOptionsData.selectedPassengerSideReplaceOptions.length == 0
) {
// PassengerSide is selected, but no sub option is
return false;
}
}
if (this.isDriverSideReplace) {
if (
this.sideDoorOptionsData.selectedDriverSideReplaceOptions == null ||
this.sideDoorOptionsData.selectedDriverSideReplaceOptions.length == 0
) {
// DriverSide is selected, but no sub option is
return false;
}
}
}
}
return true;
},
isRearGlassValid() {
if (this.isRearWindowDamageLocation) {
if (!this.selectedRearReplaceOptions) {
// RearDoor is selected, but rear option question is unanswered
return false;
}
}
return true;
},
isWindshieldValid() {
if (this.isWindshieldDamageLocation) {
if (!this.selectedWindshieldOptions.selectedWindshieldDamageType) {
// Windshield is selected but no replace/repair option is selected
return false;
} else {
if (this.hasSplitSingleConflict) {
return false;
}
if (this.isWindshieldRepair) {
if (this.hasRepairReplaceConflict) {
return false;
}
if (!this.selectedWindshieldOptions.selectedWindshieldChipCount) {
// Repair selected but no chips selected
return false;
}
} else {
if (
this.selectedWindshieldOptions.selectedWindshieldReplaceOptions ==
null ||
this.selectedWindshieldOptions.selectedWindshieldReplaceOptions
.length == 0
) {
// Replace selected but follow-up split/single question not answered
return false;
}
}
}
}
return true;
},
},
watch: {
selectedDamageLocations() {
this.clearChildEntries();
},
}, },
components: { components: {

View file

@ -102,7 +102,7 @@ export default {
FeatureQuestionWidget: resultMap.cmsContent.FeatureQuestionWidget, FeatureQuestionWidget: resultMap.cmsContent.FeatureQuestionWidget,
}) })
); );
if (store.getters.isExternalParameter) { if (store.getters.externalParameterState?.isExternalParameter) {
baseMixin.methods.ResetExternalParamsAndHideModal(); baseMixin.methods.ResetExternalParamsAndHideModal();
} }
}); });

View file

@ -28,7 +28,7 @@ jest.mock("@/store", () => ({
applicationUser: { applicationUser: {
experiments: [{ universeName: "ConceptFunnel" }], experiments: [{ universeName: "ConceptFunnel" }],
}, },
isExternalParameter: false, externalParameterState: { isExternalParameter: false },
externalParameterVehicle: { externalParameterVehicle: {
year: null, year: null,
make: null, make: null,
@ -94,7 +94,7 @@ describe("vehicle.vue", () => {
describe("vehicle.vue", () => { describe("vehicle.vue", () => {
test("should call forwardButtonAction if isExternalParameter is true and form is valid", async () => { test("should call forwardButtonAction if isExternalParameter is true and form is valid", async () => {
store.getters.isExternalParameter = true; store.getters.externalParameterState.isExternalParameter = true;
// Create a shallow mount of MyComponent // Create a shallow mount of MyComponent
const { wrapper } = setupMocks(); const { wrapper } = setupMocks();
// Set displayNoServiceAlert to false // Set displayNoServiceAlert to false

View file

@ -221,7 +221,7 @@ export default {
let resultMap = await settleAllPromises(promiseResultMap); let resultMap = await settleAllPromises(promiseResultMap);
//ExternalParameter widget have different case style value so need to parse with NextGen //ExternalParameter widget have different case style value so need to parse with NextGen
if (store.getters.isExternalParameter) { if (store.getters.externalParameterState?.isExternalParameter) {
if ( if (
makeQuestionInitialDataPromise && makeQuestionInitialDataPromise &&
modelQuestionInitialDataPromise && modelQuestionInitialDataPromise &&
@ -269,7 +269,7 @@ export default {
resultMap.modelQuestionInitialData, resultMap.modelQuestionInitialData,
resultMap.styleQuestionInitialData resultMap.styleQuestionInitialData
); );
if (store.getters.isExternalParameter) { if (store.getters.externalParameterState?.isExternalParameter) {
await vm.getVehicleDetails(); await vm.getVehicleDetails();
if (!vm.displayNoServiceAlert) { if (!vm.displayNoServiceAlert) {
const isValid = await baseMixin.methods.isFormValid(vm.$refs.theForm); const isValid = await baseMixin.methods.isFormValid(vm.$refs.theForm);

View file

@ -192,7 +192,7 @@ 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.isExternalParameter) { if (store.getters.externalParameterState?.isExternalParameter) {
baseMixin.methods.ResetExternalParamsAndHideModal(); baseMixin.methods.ResetExternalParamsAndHideModal();
} }
}); });

View file

@ -37,9 +37,11 @@ export default {
const currentPageName = getPageNameByQueryString(); const currentPageName = getPageNameByQueryString();
await this.validateSession(); await this.validateSession();
const submittedOrder = baseMixin.methods.getSubmittedOrder();
const refSequenceNum = const refSequenceNum =
store.getters.order.referralSequenceNumber || store.getters.order.referralSequenceNumber ||
store.getters.submittedOrder?.referralSequenceNumber; submittedOrder?.referralSequenceNumber;
var payload = { var payload = {
userId: getUserIdValue(), userId: getUserIdValue(),
@ -125,8 +127,9 @@ export default {
const isDefined = (x) => x !== null && x !== undefined; const isDefined = (x) => x !== null && x !== undefined;
// Get correct order object // Get correct order object
const hasSubmittedOrder = store.getters.hasSubmittedOrder; const hasSubmittedOrder = baseMixin.methods.hasSubmittedOrder();
const order = hasSubmittedOrder ? store.getters.submittedOrder : store.getters.order; const submittedOrder = baseMixin.methods.getSubmittedOrder();
const order = hasSubmittedOrder ? submittedOrder : store.getters.order;
// Begin assembling payload for data layer // Begin assembling payload for data layer
const payload = {}; const payload = {};

View file

@ -21,6 +21,7 @@ import {
getSessionKeyValue, getSessionKeyValue,
getUserIdValue, getUserIdValue,
} from "@/helpers/heritage-integration/cookie-helper"; } from "@/helpers/heritage-integration/cookie-helper";
import baseMixin from "./base-mixin";
const parts = { const parts = {
windshield: { windshield: {
@ -470,8 +471,9 @@ describe("analyticsMixin.js", () => {
test("Pushes correct data when submitted order is present", () => { test("Pushes correct data when submitted order is present", () => {
// Arrange // Arrange
window.dataLayer = []; window.dataLayer = [];
store.getters.hasSubmittedOrder = true; baseMixin.methods.hasSubmittedOrder = jest.fn().mockReturnValue(true);
store.getters.submittedOrder = store.getters.order; baseMixin.methods.getSubmittedOrder = jest.fn().mockReturnValue(store.getters.order);
store.getters.order = { store.getters.order = {
vehicle: { vehicle: {
year: null, year: null,

View file

@ -102,6 +102,12 @@ export default {
}); });
return filteredLineItems; return filteredLineItems;
}, },
filterOutRecalibration(lineItems) {
const filteredLineItems = lineItems.filter((item) => {
return item.partType != partTypeStrings.RECALIBRATION;
});
return filteredLineItems;
},
getTotalPriceOfAllLineItemsAndChildParts(lineItems, includeTax) { getTotalPriceOfAllLineItemsAndChildParts(lineItems, includeTax) {
let totalPrice = 0; let totalPrice = 0;
lineItems.forEach((lineItem) => { lineItems.forEach((lineItem) => {
@ -160,9 +166,7 @@ export default {
); );
} }
const order = store.getters.hasSubmittedOrder const order = this.hasSubmittedOrder() ? this.getSubmittedOrder() : store.getters.order;
? store.getters.submittedOrder
: store.getters.order;
if ( if (
order.payment.insuranceCoverage.isVerified && order.payment.insuranceCoverage.isVerified &&
@ -218,6 +222,12 @@ export default {
return [parseInt(v[1], 10), parseInt(v[2], 10), parseInt(v[3] || 0, 10)]; return [parseInt(v[1], 10), parseInt(v[2], 10), parseInt(v[3] || 0, 10)];
} }
}, },
getSubmittedOrder() {
return JSON.parse(window.sessionStorage.getItem("submittedOrder"));
},
hasSubmittedOrder() {
return window.sessionStorage.getItem("submittedOrder") !== null;
},
}, },
computed: { computed: {
storeActions() { storeActions() {

View file

@ -226,15 +226,16 @@ describe("baseMixin.js", () => {
const payment = { insuranceCoverage: { isVerified: true } }; const payment = { insuranceCoverage: { isVerified: true } };
const policy = { isNoComp: false, isItac: false, currentDeductible: 250 }; const policy = { isNoComp: false, isItac: false, currentDeductible: 250 };
mixIn.methods.hasSubmittedOrder = jest.fn().mockReturnValue(true);
mixIn.methods.getSubmittedOrder = jest.fn().mockReturnValue({
payment: payment,
policy: policy,
});
store.getters = { store.getters = {
payment: {}, payment: {},
policy: {}, policy: {},
order: {}, order: {},
submittedOrder: {
payment: payment,
policy: policy,
},
hasSubmittedOrder: true,
}; };
var amtDue = mixIn.methods.getAmountDue(lineItems); var amtDue = mixIn.methods.getAmountDue(lineItems);
@ -301,6 +302,8 @@ describe("baseMixin.js", () => {
const payment = { isInsurance: null, insuranceCoverage: { isVerified: null } }; const payment = { isInsurance: null, insuranceCoverage: { isVerified: null } };
const policy = { isNoComp: false, isItac: false, currentDeductible: 0 }; const policy = { isNoComp: false, isItac: false, currentDeductible: 0 };
mixIn.methods.hasSubmittedOrder = jest.fn().mockReturnValue(false);
store.getters = { store.getters = {
payment: payment, payment: payment,
policy: policy, policy: policy,

View file

@ -64,7 +64,7 @@ const routes = [
} }
// Intercept all navigation if a submitted order exists in storage // Intercept all navigation if a submitted order exists in storage
if (store.getters.hasSubmittedOrder) { if (window.sessionStorage.getItem("submittedOrder") !== null) {
if (to.query.fmgPage !== funnelStartPageName) { if (to.query.fmgPage !== funnelStartPageName) {
to.query.fmgPage = fmgPageValues.CONFIRMATION; to.query.fmgPage = fmgPageValues.CONFIRMATION;
} }
@ -245,7 +245,7 @@ router.beforeEach(async (to, from, next) => {
const notToPIAReturn = toQueryPage != fmgPageValues.PAYMENT_PIA_RETURN; const notToPIAReturn = toQueryPage != fmgPageValues.PAYMENT_PIA_RETURN;
const isInIframe = window !== window.top; const isInIframe = window !== window.top;
if (store.getters.isExternalParameter) { if (store.getters.externalParameterState?.isExternalParameter) {
// Check if alert event is on the bus // Check if alert event is on the bus
const alertEvent = eventBus.readEventFromBus( const alertEvent = eventBus.readEventFromBus(
globalEvents.Categories.GLOBAL_ALERT, globalEvents.Categories.GLOBAL_ALERT,
@ -295,7 +295,7 @@ router.afterEach(async (to, from) => {
await saveSession({ pageNameToLog: to.query.fmgPage }); await saveSession({ pageNameToLog: to.query.fmgPage });
} }
} }
if (!store.getters.isExternalParameter) { if (!store.getters.externalParameterState?.isExternalParameter) {
showFmgLoadingModal(false); showFmgLoadingModal(false);
} }
@ -409,6 +409,7 @@ async function navigate(
const zip = getQuerystringParameter(queryStrings.ZIP_CODE); const zip = getQuerystringParameter(queryStrings.ZIP_CODE);
const promo = getQuerystringParameter(queryStrings.PROMO); const promo = getQuerystringParameter(queryStrings.PROMO);
const pageError = getQuerystringParameter(queryStrings.PAGE_ERROR); const pageError = getQuerystringParameter(queryStrings.PAGE_ERROR);
const log = getQuerystringParameter(queryStrings.LOG);
if ( if (
hasZip && hasZip &&
@ -428,6 +429,10 @@ async function navigate(
queryStringsObject[queryStrings.PAGE_ERROR] = pageError; queryStringsObject[queryStrings.PAGE_ERROR] = pageError;
} }
if (log) {
queryStringsObject[queryStrings.LOG] = log;
}
router.push({ router.push({
name: "root", name: "root",
query: Object.assign(optionalQuery, queryStringsObject), query: Object.assign(optionalQuery, queryStringsObject),

View file

@ -883,8 +883,6 @@ export const getters = {
.filter((x) => !!x.isActive) .filter((x) => !!x.isActive)
.map((x) => x.settings) .map((x) => x.settings)
.reduce((r, c) => Object.assign(r, c), {}) ?? {}, .reduce((r, c) => Object.assign(r, c), {}) ?? {},
submittedOrder: (state) => JSON.parse(window.sessionStorage.getItem("submittedOrder")),
hasSubmittedOrder: (state) => window.sessionStorage.getItem("submittedOrder") !== null,
isVerifiedAndDeductibleZeroConfirmed: (state) => { isVerifiedAndDeductibleZeroConfirmed: (state) => {
// used as a CMS variable on /payment-method, needed for FunnelSubHeaderWidget on cart pages // used as a CMS variable on /payment-method, needed for FunnelSubHeaderWidget on cart pages
if ( if (
@ -900,7 +898,7 @@ export const getters = {
requiresVerifiedRedirecting: (state) => { requiresVerifiedRedirecting: (state) => {
return state.order?.referralNumber?.length === 6; return state.order?.referralNumber?.length === 6;
}, },
isExternalParameter: (state) => externalParameterState?.isExternalParameter, externalParameterState: (state) => externalParameterState,
externalParameterVehicle: (state) => externalParameterState?.vehicle, externalParameterVehicle: (state) => externalParameterState?.vehicle,
externalParameterDamage: (state) => externalParameterState?.vehicleDamage, externalParameterDamage: (state) => externalParameterState?.vehicleDamage,
externalParameterQuote: (state) => externalParameterState?.quote, externalParameterQuote: (state) => externalParameterState?.quote,
@ -2798,7 +2796,7 @@ export const actions = {
}, },
createSubmittedOrder(context) { createSubmittedOrder(context) {
if (context.getters.hasSubmittedOrder) { if (window.sessionStorage.getItem("submittedOrder") !== null) {
return; return;
} }