From e54ead578e532059944a1632ff85bc58cb4f4c22 Mon Sep 17 00:00:00 2001 From: Chloe Herd Date: Thu, 5 Sep 2024 17:02:15 -0400 Subject: [PATCH 1/9] Add call to recal endpoint --- src/constants/endpoints.js | 4 +++ src/constants/store-actions.js | 1 + src/mixins/vehicle-questions-mixin.js | 12 +++++++- src/store/index.js | 40 +++++++++++++++++++++++++++ 4 files changed, 56 insertions(+), 1 deletion(-) diff --git a/src/constants/endpoints.js b/src/constants/endpoints.js index 43abf149c..2b5c654e5 100644 --- a/src/constants/endpoints.js +++ b/src/constants/endpoints.js @@ -84,6 +84,10 @@ const endpoints = { url: "/parts/api/v1/parts/supporting-items", method: "POST", }, + GetRecalPart: { + url: "/parts/api/v1/parts/recal-parts", + method: "GET", + }, GetAlertReasons: { url: "/location/api/v1/location/alert-reasons", method: "GET", diff --git a/src/constants/store-actions.js b/src/constants/store-actions.js index 069079d35..f5c7ea047 100644 --- a/src/constants/store-actions.js +++ b/src/constants/store-actions.js @@ -53,6 +53,7 @@ const storeActions = { VALIDATE_ORDER_PROMO_AND_SAVE_SERVER_DATA: "validateOrderPromoAndSaveServerData", REVALIDATE_ORDER_PROMOS_AND_SAVE_SERVER_DATA: "revalidateOrderPromosAndSaveServerData", GET_INSURANCE_COMPANY_LIST: "getInsuranceCompanyList", + GET_RECAL_PARTS_AND_SAVE_TO_LINE_ITEMS: "getRecalPartsAndSaveToLineItems", // DEPENDENCY MUTATIONS RESET_DAMAGE_STATE_AND_DEPENDENCIES: "resetDamageAndDependencies", diff --git a/src/mixins/vehicle-questions-mixin.js b/src/mixins/vehicle-questions-mixin.js index 2749d1933..517fc7c90 100644 --- a/src/mixins/vehicle-questions-mixin.js +++ b/src/mixins/vehicle-questions-mixin.js @@ -450,7 +450,17 @@ export default { const collectedGlassParts = this.reducedGlassPartsArray(partsOrQuestions); // save to store lineItems.glassParts - self.dispatchStoreAction(storeActions.SAVE_GLASS_PARTS, collectedGlassParts, false); + await self.dispatchStoreAction( + storeActions.SAVE_GLASS_PARTS, + collectedGlassParts, + false + ); + + await self.dispatchStoreActionWithLogging( + storeActions.GET_RECAL_PARTS_AND_SAVE_TO_LINE_ITEMS, + null, + currentPage + ); const payment = store.getters.payment; diff --git a/src/store/index.js b/src/store/index.js index aa5747a0f..a74a52623 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -2855,6 +2855,46 @@ export const actions = { externalParameterMMS.externalParameterStyle ); }, + + async getRecalPartsAndSaveToLineItems(context, { pageNameToLog }) { + // identify each part that needs recal + const glassParts = context.state.order?.lineItems?.glassParts ?? []; + + for (let i = 0; i < glassParts.length; i++) { + // does this part need recal? + const needsRecal = + !!glassParts[i].requiresRecalibration && !!glassParts[i].recalibrationType; + + if (needsRecal) { + const recalType = glassParts[i].recalibrationType; + const parentAccountNumber = + context.state.order.payment.parentAccountNumber ?? + applicationConfig.CASH_PARENT_ACCOUNT_NUMBER; + + // Get part from API + const urlExtension = `${context.state.order.vehicle.carId}/${glassParts[i].partNumber}/${recalType}/${parentAccountNumber}/${context.state.order.serviceLocation.zipCode}/${applicationConfig.ANALYTICS_APPLICATION_NAME}/${context.state.order.referralSequenceNumber}`; + + const recalPartResponse = await globalMethods.callHttpClient({ + method: endpoints.GetRecalPart.method, + endpoint: `${endpoints.GetRecalPart.url}/${urlExtension}`, + payload: {}, + pageNameToLog: pageNameToLog, + }); + + // If any parts retrieved, add as children to the glass part. + if ( + recalPartResponse.status === 200 && + recalPartResponse.data.recalibrationParts?.length > 0 + ) { + if (!glassParts[i].childParts) { + glassParts[i].childParts = []; + } + + glassParts[i].childParts.push(...recalPartResponse.data.recalibrationParts); + } + } + } + }, }; export default createStore({ From 6f3e35388b7c7b2dfc434d59a80895d71201f5d5 Mon Sep 17 00:00:00 2001 From: Chloe Herd Date: Thu, 12 Sep 2024 09:52:39 -0400 Subject: [PATCH 2/9] Create helper files --- src/constants/part-type-strings.js | 1 + src/helpers/recal-helper.js | 39 ++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 src/helpers/recal-helper.js diff --git a/src/constants/part-type-strings.js b/src/constants/part-type-strings.js index 3ad66c40a..4681e2776 100644 --- a/src/constants/part-type-strings.js +++ b/src/constants/part-type-strings.js @@ -2,6 +2,7 @@ const partTypeStrings = { FRONT_WIPER: "FRONT WIPER", REAR_WIPER: "REAR WIPER", RAIN_DEFENSE: "RAIN DEFENSE", + ADAS_RECALIBRATION: "ADAS RECALIBRATION", RECALIBRATION: "RECALIBRATION", REPLACE_FEE: "REPLACE FEE", RECYCLE_FEE: "RECYCLE FEE", diff --git a/src/helpers/recal-helper.js b/src/helpers/recal-helper.js new file mode 100644 index 000000000..d6b1d044f --- /dev/null +++ b/src/helpers/recal-helper.js @@ -0,0 +1,39 @@ +import { deepClone } from "@/helpers/object-helper"; +import { partTypeStrings } from "@/constants/part-type-strings"; + +const recalPartTypes = [partTypeStrings.RECALIBRATION, partTypeStrings.ADAS_RECALIBRATION]; + +export function isRecalPartOrHasChildRecalPart(lineItem) { + if (lineItem.childParts && lineItem.childParts.length > 0) { + return isRecalPart(lineItem) || containsRecalParts(lineItem.childParts); + } else { + return isRecalPart(lineItem); + } +} + +export function isRecalPart(lineItem) { + return recalPartTypes.some((type) => lineItem.partType === type); +} + +export function containsRecalParts(lineItems) { + if (!lineItems) { + return false; + } + return lineItems.some((li) => isRecalPartOrHasChildRecalPart(li)); +} + +export function getItemsWithoutRecalParts(lineItems) { + const copy = deepClone(lineItems); + + const firstLevelFiltered = copy.filter((li) => !isRecalPart(li)); + + const childrenFiltered = firstLevelFiltered.map((li) => { + if (li.childParts && li.childParts.length > 0) { + li.childParts = getItemsWithoutRecalParts(li.childParts); + } + + return li; + }); + + return childrenFiltered; +} From 51fb83932d38a84b0a29faa63f4f23c1d696e34f Mon Sep 17 00:00:00 2001 From: Chloe Herd Date: Thu, 12 Sep 2024 12:28:32 -0400 Subject: [PATCH 3/9] Update `containsRecalPart` to accept both lineitems formats --- src/helpers/recal-helper.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/helpers/recal-helper.js b/src/helpers/recal-helper.js index d6b1d044f..fa33e7849 100644 --- a/src/helpers/recal-helper.js +++ b/src/helpers/recal-helper.js @@ -19,7 +19,20 @@ export function containsRecalParts(lineItems) { if (!lineItems) { return false; } - return lineItems.some((li) => isRecalPartOrHasChildRecalPart(li)); + + if (Array.isArray(lineItems)) { + return lineItems.some((li) => isRecalPartOrHasChildRecalPart(li)); + } else { + // complex object form -- flatten and re-call. + const flattened = [ + ...(lineItems.glassParts ?? []), + ...(lineItems.supportingItems ?? []), + ...(lineItems.vaps ?? []), + ...(lineItems.promos ?? []), + ]; + + return flattened.some((li) => isRecalPartOrHasChildRecalPart(li)); + } } export function getItemsWithoutRecalParts(lineItems) { From e29248a7ed0b65c207a25c4ede65fd96b542b0e3 Mon Sep 17 00:00:00 2001 From: Chloe Herd Date: Thu, 12 Sep 2024 12:29:22 -0400 Subject: [PATCH 4/9] Update quote to use new parts --- src/layouts/quote/quote.vue | 19 +++++++++---------- .../service-package-question.vue | 13 +++++-------- 2 files changed, 14 insertions(+), 18 deletions(-) diff --git a/src/layouts/quote/quote.vue b/src/layouts/quote/quote.vue index 3d539e630..c0e6165ea 100644 --- a/src/layouts/quote/quote.vue +++ b/src/layouts/quote/quote.vue @@ -30,6 +30,7 @@ insuranceCmsWidgetName="InsuranceServicePackageQuestionWidget" groupName="ServicePackageQuestion" :availableLineItems="availableLineItems" + :shouldHideRecalibration="shouldHideRecalibration" :isInsuranceSelected="isInsuranceSelected" @vapsItemsSelected="vapsItemsSelectedAction" @servicePackageDiscountSelected="servicePackageDiscountSelectedAction" @@ -131,6 +132,7 @@ import { containsLineItemWithPartType } from "@/helpers/service-package-helper"; import { nextTick } from "vue"; import { packageNames } from "@/constants/package-names"; import { navigateToHeritageFunnel } from "@/helpers/heritage-integration/navigation-helper"; +import { containsRecalParts } from "@/helpers/recal-helper"; defineRule("option-required", required(errorMessages.OPTION_REQUIRED)); export default { @@ -209,10 +211,7 @@ export default { ]; // If the recal experiment is found then log the experiment exposure. - const isRecalibrationOnOrder = containsLineItemWithPartType( - partTypeStrings.RECALIBRATION, - availableLineItems - ); + const isRecalibrationOnOrder = containsRecalParts(availableLineItems); const canSafeliteRecalibrate = nullSafeGlassParts.some((glassPart) => { return glassPart.partType === "WINDSHIELD" && glassPart.canSafeliteRecalibrate; }); @@ -354,10 +353,7 @@ export default { return Object.assign({}, this.lineItems); }, isRecalibrationOnOrder() { - return containsLineItemWithPartType( - partTypeStrings.RECALIBRATION, - this?.availableLineItems - ); + return containsRecalParts(this.lineItems); }, shouldHideRecalibration() { const recalSettingValue = experimentMixin.methods.getSettingValue( @@ -366,10 +362,13 @@ export default { return recalSettingValue; }, showAfterpayBanner() { - return !this.isInsuranceSelected && (!this.isRecalibrationOnOrder || !this.shouldHideRecalibration) + return ( + !this.isInsuranceSelected && + (!this.isRecalibrationOnOrder || !this.shouldHideRecalibration) + ); }, showRecalDisclaimer() { - return this.isRecalibrationOnOrder && this.shouldHideRecalibration + return this.isRecalibrationOnOrder && this.shouldHideRecalibration; }, }, methods: { diff --git a/src/layouts/quote/service-package-question/service-package-question.vue b/src/layouts/quote/service-package-question/service-package-question.vue index 93d8ff79b..f17fe908a 100644 --- a/src/layouts/quote/service-package-question/service-package-question.vue +++ b/src/layouts/quote/service-package-question/service-package-question.vue @@ -36,6 +36,7 @@ import { getPromosWithAddableVaps, getLineItemsThatMatchPromos, } from "@/helpers/promotions-helper"; +import { containsRecalParts, getItemsWithoutRecalParts } from "@/helpers/recal-helper"; export default { name: "servicePackageQuestion", @@ -49,6 +50,7 @@ export default { availableLineItems: null, activePromos: null, servicePackage: null, + shouldHideRecalibration: Boolean, }, data() { return { @@ -142,10 +144,7 @@ export default { return modifiedAnswers; }, isRecalibrationOnOrder() { - return containsLineItemWithPartType( - partTypeStrings.RECALIBRATION, - this.nullSafeAvailableLineItems - ); + return containsRecalParts(this.nullSafeAvailableLineItems); }, isServicePackageDiscountOnOrder() { return containsLineItemWithPartType( @@ -242,10 +241,8 @@ export default { }, getPackagePrice(packageName, { discountedPrice = false, servicePackageDiscount = false }) { var lineItemsToPrice = [...this.nullSafeAvailableLineItems]; - if (this.isRecalibrationOnOrder) { - lineItemsToPrice = lineItemsToPrice.filter((item) => { - return item.partType != partTypeStrings.RECALIBRATION; - }); + if (this.shouldHideRecalibration && this.isRecalibrationOnOrder) { + lineItemsToPrice = getItemsWithoutRecalParts(lineItemsToPrice); } //remove service package discount part From e30f2631e5952411f9c842728c48872acbf7674f Mon Sep 17 00:00:00 2001 From: Chloe Herd Date: Tue, 17 Sep 2024 13:23:19 -0400 Subject: [PATCH 5/9] Merge issue --- src/layouts/quote/quote.vue | 1 - 1 file changed, 1 deletion(-) diff --git a/src/layouts/quote/quote.vue b/src/layouts/quote/quote.vue index 599ba0f6a..c6176ff9d 100644 --- a/src/layouts/quote/quote.vue +++ b/src/layouts/quote/quote.vue @@ -30,7 +30,6 @@ insuranceCmsWidgetName="InsuranceServicePackageQuestionWidget" groupName="ServicePackageQuestion" :availableLineItems="availableLineItems" - :shouldHideRecalibration="shouldHideRecalibration" :isInsuranceSelected="isInsuranceSelected" :isRecalibrationOnOrder="isRecalibrationOnOrder" :shouldHideRecalibration="shouldHideRecalibration" From 1dde9eb6f7e50fe2f92579c29227c9a1f0bc4b35 Mon Sep 17 00:00:00 2001 From: Chloe Herd Date: Tue, 17 Sep 2024 13:45:32 -0400 Subject: [PATCH 6/9] Update store getters for recal --- src/store/index.js | 35 +++++------------------------------ 1 file changed, 5 insertions(+), 30 deletions(-) diff --git a/src/store/index.js b/src/store/index.js index c95366add..b0037bc61 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -39,6 +39,7 @@ import { coverageType, coverageTypeValue, } from "@/constants/insurance"; +import { containsRecalParts } from "@/helpers/recal-helper"; // Export State const getDefaultState = () => { @@ -2421,8 +2422,9 @@ export const actions = { })); const order = context.getters.order; - - var providerNumber = order.serviceLocation?.provider?.providerNumber ?? order.serviceLocation?.zipCodeCtu; + + var providerNumber = + order.serviceLocation?.provider?.providerNumber ?? order.serviceLocation?.zipCodeCtu; if (providerNumber.startsWith("00")) { providerNumber = providerNumber.substring(1); } @@ -2912,34 +2914,7 @@ export default createStore({ // Private Functions function getHasRecalibrationPart(state) { - var hasRequiresRecalibration = - getNonFalseValuesOfPropertyInArrayOfObjects( - state.order.lineItems.glassParts, - "requiresRecalibration" - )?.length > 0; - var hasRecalibrationType = - getNonFalseValuesOfPropertyInArrayOfObjects( - state.order.lineItems.glassParts, - "recalibrationType" - )?.length > 0; - - if (hasRequiresRecalibration) { - if (hasRecalibrationType) { - // Has both 'requiresRecalibration' and 'recalibrationType' and 'recalibrationType' - return ( - getNonFalseValuesOfPropertyInArrayOfObjects( - state.order.lineItems.glassParts, - "recalibrationType" - )[0].toLowerCase() != "unknown" - ); - } else { - // Has 'requiresRecalibration' but no 'recalibrationType' at all - return true; - } - } else { - // Does not have 'requiresRecalibration' - return false; - } + return containsRecalParts(state.order.lineItems); } function sortArrayOfObjectsByPropertyValue(arrayOfObjects, propertyName) { From 51655e7247d73f704aae148f5eb4223099453296 Mon Sep 17 00:00:00 2001 From: Chloe Herd Date: Tue, 17 Sep 2024 14:23:55 -0400 Subject: [PATCH 7/9] Update payment-method & cart for new recal --- src/fmg-components/cart/cart.vue | 4 ++-- src/layouts/payment-method/payment-method.vue | 10 ++++++---- src/mixins/base-mixin.js | 6 ++---- src/store/index.js | 5 +++-- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/fmg-components/cart/cart.vue b/src/fmg-components/cart/cart.vue index 90c1adf98..0dffbd6de 100644 --- a/src/fmg-components/cart/cart.vue +++ b/src/fmg-components/cart/cart.vue @@ -305,8 +305,8 @@ export default { if (!this.lineItems || this.lineItems.length < 1) return; const lineItemsCopy = deepClone(this.lineItems); - lineItemsCopy.supportingItems = lineItemsCopy.supportingItems - ? baseMixin.methods.filterOutRecalibration(lineItemsCopy?.supportingItems) + lineItemsCopy.glassParts = lineItemsCopy.glassParts + ? baseMixin.methods.filterOutRecalibration(lineItemsCopy?.glassParts) : []; return lineItemsCopy; }, diff --git a/src/layouts/payment-method/payment-method.vue b/src/layouts/payment-method/payment-method.vue index ff7e6a8d8..2c458e124 100644 --- a/src/layouts/payment-method/payment-method.vue +++ b/src/layouts/payment-method/payment-method.vue @@ -153,6 +153,7 @@ import { partTypeStrings } from "@/constants/part-type-strings"; import { mapTaxedLineItemsToStoreFormat } from "../../store"; import { coverageStatus } from "@/constants/insurance"; import { containsLineItemWithPartType } from "@/helpers/service-package-helper"; +import { containsRecalParts } from "@/helpers/recal-helper"; defineRule("payment-method-required", required(errorMessages.OPTION_REQUIRED)); defineRule("recal-ack-required", required(errorMessages.RECAL_ACK_REQUIRED)); @@ -588,10 +589,11 @@ export default { }, computed: { isRecalibrationOnOrder() { - return containsLineItemWithPartType( - partTypeStrings.RECALIBRATION, - this.$store.getters.order.lineItems?.supportingItems - ); + const order = baseMixin.methods.hasSubmittedOrder() + ? baseMixin.methods.getSubmittedOrder() + : this.$store.getters.order; + + return containsRecalParts(order.lineItems); }, shouldHideRecalibration() { return this.getSettingValue(experimentSettings.RECAL_PRICE_REMOVE); diff --git a/src/mixins/base-mixin.js b/src/mixins/base-mixin.js index c1e60d16a..669e3306f 100644 --- a/src/mixins/base-mixin.js +++ b/src/mixins/base-mixin.js @@ -8,6 +8,7 @@ import { queryStrings } from "@/constants/query-strings"; import { dynamicStrings } from "@/constants/dynamic-strings"; import { partTypeStrings } from "../constants/part-type-strings"; import { showFmgLoadingModal } from "@/helpers/loading-modal-helper"; +import { getItemsWithoutRecalParts } from "@/helpers/recal-helper"; export default { data() { @@ -103,10 +104,7 @@ export default { return filteredLineItems; }, filterOutRecalibration(lineItems) { - const filteredLineItems = lineItems.filter((item) => { - return !item.partType.includes(partTypeStrings.RECALIBRATION); - }); - return filteredLineItems; + return getItemsWithoutRecalParts(lineItems); }, getTotalPriceOfAllLineItemsAndChildParts(lineItems, includeTax) { let totalPrice = 0; diff --git a/src/store/index.js b/src/store/index.js index 8a87018d6..f6751bcef 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -2422,8 +2422,9 @@ export const actions = { })); const order = context.getters.order; - - var providerNumber = order.serviceLocation?.provider?.providerNumber ?? order.serviceLocation?.zipCodeCtu; + + var providerNumber = + order.serviceLocation?.provider?.providerNumber ?? order.serviceLocation?.zipCodeCtu; if (providerNumber.startsWith("00") && providerNumber.length > 5) { providerNumber = providerNumber.substring(1); } From fad42eba6ebdcfdb62b9b3b9c691b099d4f98863 Mon Sep 17 00:00:00 2001 From: Chloe Herd Date: Thu, 26 Sep 2024 15:52:17 -0400 Subject: [PATCH 8/9] Update unit test --- src/store/store.spec.js | 104 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 104 insertions(+) diff --git a/src/store/store.spec.js b/src/store/store.spec.js index fb1c73f98..6c36c6c26 100644 --- a/src/store/store.spec.js +++ b/src/store/store.spec.js @@ -3950,6 +3950,110 @@ describe("Getters", () => { mutations.updateVaps(storeState, mockStateValues.funnelVaps); mutations.updateGlassToReplace(storeState, mockStateValues.glassToReplace); + //Assert + expect(getters.experimentOrder(storeState)).toEqual({ + funnelVehicleYear: mockStateValues.vehicleYear, + funnelVehicleMake: mockStateValues.vehicleMake, + funnelVehicleModel: mockStateValues.vehicleModel, + funnelVehicleStyle: mockStateValues.vehicleStyle, + funnelIsRepair: mockStateValues.isRepair, + funnelNumberOfChips: mockStateValues.numberOfChips, + funnelCarId: mockStateValues.carId, + funnelServiceCity: mockStateValues.serviceCity, + funnelServiceState: mockStateValues.serviceState, + funnelServiceZipCode: mockStateValues.serviceZipCode, + funnelParentAccountNumber: mockStateValues.parentAccountNumber, + funnelIsCoverageVerified: mockStateValues.isCoverageVerified, + funnelOrderPartNumbers: ["WINDSHIELDPARTNUMBER"], + funnelOrderPartTypes: ["ADAS, maybe"], + funnelHasRecalibrationPart: false, + funnelSelectedMultiGlass: false, + funnelSelectedWindshieldGlass: true, + funnelSelectedBackGlass: false, + funnelSelectedDriverSideGlass: false, + funnelSelectedPassengerSideGlass: false, + funnelProviderNumber: mockStateValues.funnelProviderNumber, + funnelReferralType: mockStateValues.funnelReferralType, + funnelServiceZipCodeCtu: mockStateValues.funnelServiceZipCodeCtu, + }); + }); + + test("Single windshield with recalibration child part > return correct experimentOrder values", () => { + // Arrange + const storeState = state; + const mockStateValues = { + vehicleYear: 1000, + vehicleMake: "CarMake", + vehicleModel: "CarModel", + vehicleStyle: "SuperCoolStyle", + isRepair: false, + numberOfChips: 0, + carId: "Gibberish", + serviceCity: "Columbus", + serviceState: "OH-IO", + serviceZipCode: 43215, + parentAccountNumber: "999999", + isCoverageVerified: false, + glassParts: [ + { + partNumber: "WINDSHIELDPARTNUMBER", + description: "This is a windshield", + recalibrationType: "ADAS, maybe", + requiresRecalibration: true, + requiresCapabilityQuestions: false, + childParts: [ + { + "partNumber": "THIRD RECAL", + "description": "Additional Static Recal", + "recalibrationType": "DUAL & RECAL THIRD & HC FUNCTION TEST & RL SENSOR", + "ribCode": "RL", + "safelitePartNumber": "THIRD RECAL", + "status": "ACTIVE", + "partType": "ADAS RECALIBRATION", + "childParts": [], + "recalibrationFees": [], + "salesTax": null + } + ], + }, + ], + otherParts: [], + glassToReplace: [ + { + glassLocation: "Windshield", + glassName: "Single", + }, + ], + funnelProviderNumber: "1", + funnelReferralType: "CASH QUOTE", + funnelServiceZipCodeCtu: "11111", + }; + + //Act + mutations.updateYear(storeState, mockStateValues.vehicleYear); + mutations.updateMake(storeState, mockStateValues.vehicleMake); + mutations.updateModel(storeState, mockStateValues.vehicleModel); + mutations.updateStyle(storeState, mockStateValues.vehicleStyle); + mutations.updateIsRepair(storeState, mockStateValues.isRepair); + mutations.updateNumberOfChips(storeState, mockStateValues.numberOfChips); + mutations.updateCarId(storeState, mockStateValues.carId); + mutations.updateServiceLocation(storeState, { + city: mockStateValues.serviceCity, + state: mockStateValues.serviceState, + zipCode: mockStateValues.serviceZipCode, + zipCodeCtu: mockStateValues.funnelServiceZipCodeCtu, + provider: { + providerNumber: mockStateValues.funnelProviderNumber, + }, + }); + mutations.updateParentAcctNumber(storeState, mockStateValues.parentAccountNumber); + mutations.updateInsuranceVerifiedStatus(storeState, mockStateValues.isCoverageVerified); + mutations.updateIsInsurance(storeState, false); + mutations.updateGlassParts(storeState, mockStateValues.glassParts); + mutations.updateSupportingItems(storeState, mockStateValues.funnelSupportingItems); + mutations.updateVaps(storeState, mockStateValues.funnelVaps); + mutations.updateGlassToReplace(storeState, mockStateValues.glassToReplace); + //Assert expect(getters.experimentOrder(storeState)).toEqual({ funnelVehicleYear: mockStateValues.vehicleYear, From 06a2d381fa6728ed5e9847fdbb81f52ca488cbbe Mon Sep 17 00:00:00 2001 From: Chloe Herd Date: Thu, 26 Sep 2024 17:34:13 -0400 Subject: [PATCH 9/9] Tweaks to dev changes --- src/layouts/confirmation/confirmation.vue | 6 ++---- src/layouts/quote/quote.vue | 12 +++--------- src/store/store.spec.js | 23 ++++++++++++----------- 3 files changed, 17 insertions(+), 24 deletions(-) diff --git a/src/layouts/confirmation/confirmation.vue b/src/layouts/confirmation/confirmation.vue index 72ee038db..c7f944078 100644 --- a/src/layouts/confirmation/confirmation.vue +++ b/src/layouts/confirmation/confirmation.vue @@ -108,6 +108,7 @@ import { getDisplayTextForDurationLength } from "@/helpers/duration-length-helpe import { experimentSettings } from "@/constants/experiments"; import { partTypeStrings } from "@/constants/part-type-strings"; import { containsLineItemWithPartType } from "@/helpers/service-package-helper"; +import { containsRecalParts } from "@/helpers/recal-helper.js"; export default { name: "confirmation", @@ -170,10 +171,7 @@ export default { }, computed: { isRecalibrationOnOrder() { - return containsLineItemWithPartType( - partTypeStrings.RECALIBRATION, - this?.lineItems?.supportingItems - ); + return containsRecalParts(this?.lineItems); }, shouldHideRecalibration() { return ( diff --git a/src/layouts/quote/quote.vue b/src/layouts/quote/quote.vue index c8e2dda02..b778116e9 100644 --- a/src/layouts/quote/quote.vue +++ b/src/layouts/quote/quote.vue @@ -583,9 +583,8 @@ export default { if (tier) { let lineItemsToPrice = this.availableLineItems; if (this.isRecalibrationOnOrder && this.shouldHideRecalibration) { - lineItemsToPrice = lineItemsToPrice?.filter((item) => { - return item.partType != partTypeStrings.RECALIBRATION; - }); + lineItemsToPrice = + baseMixin.methods.filterOutRecalibration(lineItemsToPrice); } if (this.isServicePackageDiscountOnOrder) { lineItemsToPrice = lineItemsToPrice?.filter((item) => { @@ -609,12 +608,7 @@ export default { }); eventLabel = eventLabel.slice(0, -1); - this.pushEventToGA( - "quote", - this.GaActions.SERVICE_PACKAGE_PRICE, - eventLabel, - true - ); + this.pushEventToGA("quote", this.GaActions.SERVICE_PACKAGE_PRICE, eventLabel, true); }); }, }, diff --git a/src/store/store.spec.js b/src/store/store.spec.js index 6c36c6c26..9c546d3be 100644 --- a/src/store/store.spec.js +++ b/src/store/store.spec.js @@ -4003,17 +4003,18 @@ describe("Getters", () => { requiresCapabilityQuestions: false, childParts: [ { - "partNumber": "THIRD RECAL", - "description": "Additional Static Recal", - "recalibrationType": "DUAL & RECAL THIRD & HC FUNCTION TEST & RL SENSOR", - "ribCode": "RL", - "safelitePartNumber": "THIRD RECAL", - "status": "ACTIVE", - "partType": "ADAS RECALIBRATION", - "childParts": [], - "recalibrationFees": [], - "salesTax": null - } + partNumber: "THIRD RECAL", + description: "Additional Static Recal", + recalibrationType: + "DUAL & RECAL THIRD & HC FUNCTION TEST & RL SENSOR", + ribCode: "RL", + safelitePartNumber: "THIRD RECAL", + status: "ACTIVE", + partType: "ADAS RECALIBRATION", + childParts: [], + recalibrationFees: [], + salesTax: null, + }, ], }, ],