Merge pull request #1305 from Safelite/feature/skiener/CSR-1582

CSR-1582 | Navigation fix for schedule release
This commit is contained in:
scottkiener 2023-08-15 09:24:13 -04:00 committed by GitHub
commit 9c104adc8c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 29 additions and 128 deletions

View file

@ -31,7 +31,8 @@ export async function getPageToRouteExistingOrderTo(toRoute = {}, existingHerita
// Return that page, so that it can navigate like normal. // Return that page, so that it can navigate like normal.
if ( if (
toRoute.query[queryStrings.FMG_PAGE] !== undefined && toRoute.query[queryStrings.FMG_PAGE] !== undefined &&
toRoute.query[queryStrings.FMG_PAGE] !== fmgPageValues.QUOTE && toRoute.query[queryStrings.FMG_PAGE] !== fmgPageValues.SERVICE_LOCATION &&
toRoute.query[queryStrings.FMG_PAGE] !== fmgPageValues.SCHEDULE &&
!isVinRelatedPage(toRoute) !isVinRelatedPage(toRoute)
) { ) {
return overrideYmmsDirectionIfNeeded(toRoute); return overrideYmmsDirectionIfNeeded(toRoute);
@ -115,6 +116,8 @@ async function getLatestPageForRedirection() {
fmgPageValues.CAPABILITY_QUESTIONS fmgPageValues.CAPABILITY_QUESTIONS
); );
const quoteComponent = await getLazyLoadedComponent(fmgPageValues.QUOTE); const quoteComponent = await getLazyLoadedComponent(fmgPageValues.QUOTE);
const serviceLocationComponent = await getLazyLoadedComponent(fmgPageValues.SERVICE_LOCATION);
const scheduleComponent = await getLazyLoadedComponent(fmgPageValues.SCHEDULE);
const skipVin = await skipVinLookup(); const skipVin = await skipVinLookup();
@ -129,7 +132,13 @@ async function getLatestPageForRedirection() {
} else if (!estimateComponent.methods.arePagePrerequisitesValid()) { } else if (!estimateComponent.methods.arePagePrerequisitesValid()) {
return fmgPageValues.VEHICLE_DAMAGE; return fmgPageValues.VEHICLE_DAMAGE;
} else { } else {
if (quoteComponent.methods.arePagePrerequisitesValid()) { if (scheduleComponent.methods.arePagePrerequisitesValid()) {
return fmgPageValues.SCHEDULE;
} else if (serviceLocationComponent.methods.arePagePrerequisitesValid()) {
// This should be reversed 45+ days after the 8.24 release (Sunday October 8th, 2023)
//return fmgPageValues.SERVICE_LOCATION;
return fmgPageValues.QUOTE;
} else if (quoteComponent.methods.arePagePrerequisitesValid()) {
return fmgPageValues.QUOTE; return fmgPageValues.QUOTE;
} else if (capabilityQuestionsComponent.methods.arePagePrerequisitesValid()) { } else if (capabilityQuestionsComponent.methods.arePagePrerequisitesValid()) {
return fmgPageValues.CAPABILITY_QUESTIONS; return fmgPageValues.CAPABILITY_QUESTIONS;

View file

@ -135,64 +135,9 @@ describe("service-package-question.vue", () => {
expectedModifiedAnswers[packageNameKey].tierThree expectedModifiedAnswers[packageNameKey].tierThree
); );
}); });
it("should not select a default package if ANY glass part or supporting item has no prices", async () => { it("should not select a default package if isInsurance is null", async () => {
// Note, only the first WSREPAIR item has a 0 for laborAmount, this is enough to not try and select a default package // Note, only the first WSREPAIR item has a 0 for laborAmount, this is enough to not try and select a default package
const wrapper = setupMocks({ const wrapper = setupMocks({});
mountOptionsMockData: {
store: {
getters: {
lineItems: {
glassParts: [
{
partNumber: "FW02627GBYNOEE",
description: "solar, 3rd visor band",
color: "Green Tint, Blue Shade",
partType: "WINDSHIELD",
canSafeliteRecalibrate: false,
requiresRecalibration: false,
requiresCapabilityQuestions: false,
recalibrationType: null,
childParts: null,
laborAmount: 5.0,
},
],
supportingItems: [
{
partNumber: "SUPPLIES-REPAIR",
description: null,
partType: "REPAIR FEE",
laborAmount: 5.0,
},
{
partNumber: "WSREPAIR",
description: null,
partType: "REPAIR FEE",
laborAmount: 0,
},
{
partNumber: "WSREPAIR",
description: null,
partType: "REPAIR FEE",
laborAmount: 5.0,
},
{
partNumber: "WSREPAIR",
description: null,
partType: "REPAIR FEE",
laborAmount: 5.0,
},
],
},
order: {
damage: {
isRepair: false,
glassToReplace: [{ glassLocation: "Windshield" }],
},
},
},
},
},
});
// Act // Act
wrapper.setProps({ availableLineItems: null }); wrapper.setProps({ availableLineItems: null });
@ -202,59 +147,24 @@ describe("service-package-question.vue", () => {
// Assert // Assert
expect(wrapper.vm.selectedPackageName).toBe(null); expect(wrapper.vm.selectedPackageName).toBe(null);
}); });
it("should select a default package if ALL glass parts and supporting items have prices", async () => { it("should select a default package if isInsurance is NOT null", async () => {
const wrapper = setupMocks({ const wrapper = setupMocks({
mountOptionsMockData: { mountOptionsMockData: {
store: { store: {
getters: { getters: {
lineItems: {
glassParts: [
{
partNumber: "FW02627GBYNOEE",
description: "solar, 3rd visor band",
color: "Green Tint, Blue Shade",
partType: "WINDSHIELD",
canSafeliteRecalibrate: false,
requiresRecalibration: false,
requiresCapabilityQuestions: false,
recalibrationType: null,
childParts: null,
laborAmount: 5.0,
},
],
supportingItems: [
{
partNumber: "SUPPLIES-REPAIR",
description: null,
partType: "REPAIR FEE",
laborAmount: 5.0,
},
{
partNumber: "WSREPAIR",
description: null,
partType: "REPAIR FEE",
laborAmount: 5.0,
},
{
partNumber: "WSREPAIR",
description: null,
partType: "REPAIR FEE",
laborAmount: 5.0,
},
{
partNumber: "WSREPAIR",
description: null,
partType: "REPAIR FEE",
laborAmount: 5.0,
},
],
},
order: { order: {
damage: { damage: {
isRepair: false, isRepair: false,
glassToReplace: [{ glassLocation: "Windshield" }], glassToReplace: [{ glassLocation: "Windshield" }],
}, },
}, },
lineItems: {
vaps: [],
},
hasAnyNonWindshieldGlassParts: false,
payment: {
isInsurance: false,
},
}, },
}, },
}, },
@ -329,6 +239,9 @@ describe("service-package-question.vue", () => {
glassToReplace: [{ glassLocation: "Windshield" }], glassToReplace: [{ glassLocation: "Windshield" }],
}, },
}, },
payment: {
isInsurance: false,
},
}, },
}, },
}, },
@ -758,6 +671,9 @@ function setupMocks({ mountOptionsMockData, props = mockProps }) {
}, },
}, },
hasAnyNonWindshieldGlassParts: false, hasAnyNonWindshieldGlassParts: false,
payment: {
isInsurance: null,
},
}, },
}, },
}; };

View file

@ -44,7 +44,7 @@ export default {
}, },
watch: { watch: {
availableLineItems() { availableLineItems() {
if (this.allGlassPartsAndSupportingItemsHavePrices(this.$store.getters.lineItems)) { if (this.$store.getters.payment.isInsurance != null) {
this.selectDefaultPackage(); this.selectDefaultPackage();
} }
}, },
@ -230,30 +230,6 @@ export default {
} }
this.selectedPackageName = lowestTierForPackage; this.selectedPackageName = lowestTierForPackage;
}, },
allGlassPartsAndSupportingItemsHavePrices(lineItems) {
if (lineItems?.glassParts) {
for (let i = 0; i < lineItems.glassParts.length; i++) {
if (this.priceIsNullOrZero(lineItems.glassParts[i])) {
return false;
}
}
}
if (lineItems?.supportingItems) {
for (let i = 0; i < lineItems.supportingItems.length; i++) {
if (this.priceIsNullOrZero(lineItems.supportingItems[i])) {
return false;
}
}
}
return true;
},
priceIsNullOrZero(lineItem) {
return (
(lineItem.kitPrice == null || lineItem.kitPrice == 0) &&
(lineItem.laborAmount == null || lineItem.laborAmount == 0) &&
(lineItem.sellingPrice == null || lineItem.sellingPrice == 0)
);
},
getLowestTierForThisItem(vapsItem) { getLowestTierForThisItem(vapsItem) {
let lowestTierForThisItem = null; let lowestTierForThisItem = null;
switch (vapsItem.partType) { switch (vapsItem.partType) {

View file

@ -1429,7 +1429,7 @@ export const actions = {
InsuranceCoverage: { InsuranceCoverage: {
isVerified: order.payment.insuranceCoverage.isVerified ?? false, isVerified: order.payment.insuranceCoverage.isVerified ?? false,
}, },
isInsurance: order.payment.isInsurance ?? false, isInsurance: order.payment.isInsurance,
parentAccountNumber: order.payment.parentAccountNumber, parentAccountNumber: order.payment.parentAccountNumber,
}, },
serviceLocation: { serviceLocation: {