Merge pull request #959 from Safelite/rlsmerge/2023.01.19-to-develop

Rlsmerge/2023.01.19 to develop
This commit is contained in:
matthew-sykes 2023-01-30 10:24:57 -05:00 committed by GitHub
commit 7dbaec4096
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 44 additions and 25 deletions

View file

@ -44,7 +44,7 @@ export async function loadSessionIfPresent(isConceptInsurance) {
funnelCookie.ReferralCorrelationId, funnelCookie.ReferralCorrelationId,
isConceptInsurance isConceptInsurance
) )
).data; )?.data;
} }
/* /*

View file

@ -64,17 +64,14 @@ export default {
}; };
}, },
getTierOnePackagePrice(lineItems) { getTierOnePackagePrice(lineItems) {
let totalPrice = 0; let lineItemsToPrice = lineItems.filter((lineItem) => {
lineItems.forEach((lineItem) => { return (
const partType = lineItem.partType.toUpperCase(); lineItem.partType != partTypeStrings.FRONT_WIPER &&
if ( lineItem.partType != partTypeStrings.REAR_WIPER &&
partType != partTypeStrings.FRONT_WIPER && lineItem.partType != partTypeStrings.RAIN_DEFENSE
partType != partTypeStrings.REAR_WIPER && );
partType != partTypeStrings.RAIN_DEFENSE
) {
totalPrice += this.getTotalLineItemPrice(lineItem);
}
}); });
let totalPrice = this.getTotalPriceOfAllLineItemsAndChildParts(lineItemsToPrice);
return totalPrice; return totalPrice;
}, },
filterOutFees(lineItems) { filterOutFees(lineItems) {
@ -86,6 +83,18 @@ export default {
}); });
return filteredLineItems; return filteredLineItems;
}, },
getTotalPriceOfAllLineItemsAndChildParts(lineItems) {
let totalPrice = 0;
lineItems.forEach((lineItem) => {
totalPrice += this.getTotalLineItemPrice(lineItem);
if (lineItem.childParts) {
totalPrice += this.getTotalPriceOfAllLineItemsAndChildParts(
lineItem.childParts
);
}
});
return totalPrice;
},
getTotalLineItemPrice(lineItem) { getTotalLineItemPrice(lineItem) {
return lineItem.kitPrice + lineItem.laborAmount + lineItem.sellingPrice; return lineItem.kitPrice + lineItem.laborAmount + lineItem.sellingPrice;
}, },

View file

@ -10,6 +10,7 @@ import { experimentTriggers } from "@/constants/experiments";
import { damageLocationsSelected } from "@/constants/damage-locations-selected"; import { damageLocationsSelected } from "@/constants/damage-locations-selected";
import { fmgPageValues } from "@/router/router-constants/fmgPage-values"; import { fmgPageValues } from "@/router/router-constants/fmgPage-values";
import router from "@/router"; import router from "@/router";
import { deleteFunnelCookie } from "@/helpers/heritage-integration/cookie-helper.js";
// Export State // Export State
const getDefaultState = () => { const getDefaultState = () => {
@ -1059,23 +1060,32 @@ export const actions = {
referralCorrelationId: referralCorrelationId, referralCorrelationId: referralCorrelationId,
}, },
}) })
.then((response) => { .then(
// Flatten location and name properties (response) => {
response.data.order.damage?.glassToReplace?.map((glass) => { // Flatten location and name properties
glass.glassLocation = glass.location; response.data.order.damage?.glassToReplace?.map((glass) => {
glass.glassName = glass.name; glass.glassLocation = glass.location;
delete glass.location; glass.glassName = glass.name;
delete glass.name; delete glass.location;
return glass; delete glass.name;
}); return glass;
});
// clear the state if the existing EON does not equal what is returned from loadSession // clear the state if the existing EON does not equal what is returned from loadSession
if (context.state.order.eon && context.state.order.eon != response.data.eon) { if (context.state.order.eon && context.state.order.eon != response.data.eon) {
context.commit(storeMutations.RESET_STATE);
}
context.commit(
storeMutations.UPDATE_STATE_WITH_ORDER_INFORMATION,
response.data
);
return response;
},
(error) => {
deleteFunnelCookie();
context.commit(storeMutations.RESET_STATE); context.commit(storeMutations.RESET_STATE);
} }
context.commit(storeMutations.UPDATE_STATE_WITH_ORDER_INFORMATION, response.data); );
return response;
});
}, },
// Business domain actions // Business domain actions