diff --git a/src/common-components/button-question/button-question.vue b/src/common-components/button-question/button-question.vue index 91ad272a0..6cd06c7c5 100644 --- a/src/common-components/button-question/button-question.vue +++ b/src/common-components/button-question/button-question.vue @@ -175,11 +175,16 @@ export default { if(this.selectingInitiatesLoad) { this.selectedValues = val.value; } else { - if(Array.isArray(this.selectedValues)) { + if(this.isMultiSelect) { const newSelectedValues = this.selectedValues; val.checkValue ? newSelectedValues.push(val.value) : newSelectedValues.splice(newSelectedValues.indexOf(val.value), 1); this.selectedValues = newSelectedValues; } + else if (Array.isArray(this.selectedValues)) { + this.selectedValues[0] = val.value; + const temp = this.selectedValues; + this.selectedValues = temp; + } else { this.selectedValues = val.value; } diff --git a/src/layouts/estimate/estimate.vue b/src/layouts/estimate/estimate.vue index e003348bd..f38d6b77d 100644 --- a/src/layouts/estimate/estimate.vue +++ b/src/layouts/estimate/estimate.vue @@ -181,13 +181,13 @@ export default { state: zipCodeData.state, }, false); - if (!zipCodeData.isZipValid) { + if (!zipCodeData.isValid) { this.displayInvalidZipAlert = true; return this.$refs.funnelFooter.removeLoader(); } this.displayInvalidZipAlert = false; - if (!zipCodeData.isZipServiceable) { + if (!zipCodeData.isServiceable) { this.displayNonServiceableZipAlert = true; return this.$refs.funnelFooter.removeLoader(); } @@ -220,7 +220,6 @@ export default { }, computed: { AlertNonServiceableZipHeader(){ - console.log(this.getCmsContent("AlertNonServiceableZipWidget", "HeadlineText")); return this.getCmsContent("AlertNonServiceableZipWidget", "HeadlineText").replaceAll("{custom:serviceZip}", this.serviceZipCode); }, AlertNonServiceableZipBody(){ diff --git a/src/layouts/vehicle-damage/windshield-options/windshield-chip-count-question/windshield-chip-count-question.vue b/src/layouts/vehicle-damage/windshield-options/windshield-chip-count-question/windshield-chip-count-question.vue index 25d273eca..31a681857 100644 --- a/src/layouts/vehicle-damage/windshield-options/windshield-chip-count-question/windshield-chip-count-question.vue +++ b/src/layouts/vehicle-damage/windshield-options/windshield-chip-count-question/windshield-chip-count-question.vue @@ -47,7 +47,8 @@ export default ({ return this.modelValue; }, set: function(newValue) { - this.$emit("update:modelValue", newValue); + const numberValue = Number(newValue); + this.$emit("update:modelValue", numberValue); } }, }, diff --git a/src/layouts/vin-lookup/vin-lookup.spec.js b/src/layouts/vin-lookup/vin-lookup.spec.js index 5516f3cc5..246b442b0 100644 --- a/src/layouts/vin-lookup/vin-lookup.spec.js +++ b/src/layouts/vin-lookup/vin-lookup.spec.js @@ -239,11 +239,12 @@ function setupMocks({ customMountOptions }) { function mockOutPromises({carId, isZipValid = true, isZipServiceable = true}) { const apiResponses = { - serviceZipValidationResponse: { - isValid: isZipValid, - isServiceable: isZipServiceable + vehicleLookupResponse: { + carId: carId }, - vehicleLookupResponse: carId ? { carId: carId } : null + zipCodeData: { + isValid: true, isServiceable: true, state: "OH" + } }; settleAllPromises.mockImplementation(() => apiResponses); diff --git a/src/layouts/vin-lookup/vin-lookup.vue b/src/layouts/vin-lookup/vin-lookup.vue index fd3a2462a..3614c74cf 100644 --- a/src/layouts/vin-lookup/vin-lookup.vue +++ b/src/layouts/vin-lookup/vin-lookup.vue @@ -238,14 +238,16 @@ export default { resultKey: "vehicleLookupResponse", promise: vehicleLookupResponse, }, + { + resultKey: "zipCodeData", + promise: this.getZipCodeData(this.serviceZipCode) + } ]; const resultMap = await settleAllPromises(promiseResultMap); - const zipCodeData = await this.getZipCodeData(this.serviceZipCode); // If a Service Zip is entered and it is an invalid zip code (ex. 11111) then show an alert - const isZipValid = zipCodeData.isValid; - + const isZipValid = resultMap.zipCodeData.isValid; if (this.serviceZipCode && !isZipValid) { this.displayInvalidZipAlert = true; return this.$refs.funnelFooter.removeLoader(); @@ -253,14 +255,14 @@ export default { this.displayInvalidZipAlert = false; // If either lookup fails, remove the loader and stop processing the page. - if (!resultMap.vehicleLookupResponse || !zipCodeData.isServiceable) { + if (!resultMap.vehicleLookupResponse || !resultMap.zipCodeData.isServiceable) { // If the vehicle result is undefined, the vin entered was invalid. if(!resultMap.vehicleLookupResponse) { this.displayVinNotFoundAlert = true; } // Check if Service Zip entered is serviceable, if not display an alert - if (!zipCodeData.isServiceable) { + if (!resultMap.zipCodeData.isServiceable) { this.displayNonServiceableZipAlert = true; } @@ -294,7 +296,7 @@ export default { await this.dispatchStoreAction(storeActions.SAVE_EMAIL, this.emailAddress, false); await this.dispatchStoreAction(storeActions.SAVE_SERVICE_LOCATION, { zipCode: this.serviceZipCode, - state: zipCodeData.state, + state: resultMap.zipCodeData.state, }, false); return await this.navigateForward(); diff --git a/src/mixins/base-mixin.js b/src/mixins/base-mixin.js index b19b458da..f175c61b8 100644 --- a/src/mixins/base-mixin.js +++ b/src/mixins/base-mixin.js @@ -49,21 +49,12 @@ export default { return footerInfoBox ? footerInfoBox.offsetHeight : 0; }, async getZipCodeData(zipCode) { - const serviceZipValidationResponse = this.dispatchStoreAction(storeActions.VALIDATE_ZIP, { zip: zipCode }); - - const promiseResultMap = [ - { - resultKey: "serviceZipValidationResponse", - promise: serviceZipValidationResponse, - } - ]; - - const resultMap = await settleAllPromises(promiseResultMap); - + const serviceZipValidationResponse = await this.dispatchStoreAction(storeActions.VALIDATE_ZIP, { zip: zipCode }); + return { - isZipValid: resultMap.serviceZipValidationResponse.isValid, - isZipServiceable: resultMap.serviceZipValidationResponse.isServiceable, - state: resultMap.serviceZipValidationResponse.state + isValid: serviceZipValidationResponse.data.isValid, + isServiceable: serviceZipValidationResponse.data.isServiceable, + state: serviceZipValidationResponse.data.state }; } }, diff --git a/src/mixins/base-mixin.spec.js b/src/mixins/base-mixin.spec.js index 9c7ebcd90..6009dd67c 100644 --- a/src/mixins/base-mixin.spec.js +++ b/src/mixins/base-mixin.spec.js @@ -99,7 +99,7 @@ describe("baseMixin.js", () => { test("getZipCodeData calls dispatch", () => { const mixIn = getMixInInstance({}); mixIn.methods.dispatchStoreAction = jest.fn(); - mixIn.methods.dispatchStoreAction.mockReturnValue({ isValid:true, isServiceable:true, state:"OH" }); + mixIn.methods.dispatchStoreAction.mockReturnValue({data: { isValid:true, isServiceable:true, state:"OH" }}); const type = ""; const payload = { zip: 43015 }; diff --git a/src/store/index.js b/src/store/index.js index 9596b7b85..614d54d4b 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -717,7 +717,7 @@ export const actions = { endpoint: endpoints.GetPartsOrQuestions.url, payload: { carId: carId, - glass: glassArray, + glass: glassArray ?? [], zip: zipCode, vin: vin }, @@ -942,8 +942,14 @@ export const actions = { .slice() .sort() .every((obj, index) => obj.glassLocation === selectedGlassPassedInSorted[index].glassLocation && obj.glassName === selectedGlassPassedInSorted[index].glassName); + const isWindshieldRepairTheSame = isWindshieldRepair === context.state.order.damage.isRepair; + const isChipCountTheSame = Array.isArray(selectedWindshieldChipCount) //TODO: fix the underlying components so this is never an array + ? selectedWindshieldChipCount[0] === context.state.order.damage.numberOfChips + : selectedWindshieldChipCount === context.state.order.damage.numberOfChips; - if (!isGlassToReplaceTheSame) { + const isDamageChanging = !isGlassToReplaceTheSame || !isWindshieldRepairTheSame || (isWindshieldRepair && !isChipCountTheSame); + + if (isDamageChanging) { //Reset dependent state when changing context.dispatch(storeActions.RESET_PARTS_STATE_AND_DEPENDENCIES); diff --git a/src/ux-components/list-button-horizontal/list-button-horizontal.spec.js b/src/ux-components/list-button-horizontal/list-button-horizontal.spec.js index e74673c22..f55ba2b94 100644 --- a/src/ux-components/list-button-horizontal/list-button-horizontal.spec.js +++ b/src/ux-components/list-button-horizontal/list-button-horizontal.spec.js @@ -211,11 +211,12 @@ describe("list-button-horizontal.vue", () => { isWide: false, modelValue: ["List Card Checkbox"], isMultiSelect: false, + value: "Car-Front", selectedValues: ["Car-Front"] }, }); // Assert - expect(wrapper.componentVM.checkValue).toEqual(["Car-Front"]); + expect(wrapper.vm.checkValue).toEqual(true); }); it("Should run handleCheckChange if selectingInitiatesLoad is false and handleInputChange is triggered", async () => { diff --git a/src/ux-components/list-button-horizontal/list-button-horizontal.vue b/src/ux-components/list-button-horizontal/list-button-horizontal.vue index 5934d35e4..cc867053f 100644 --- a/src/ux-components/list-button-horizontal/list-button-horizontal.vue +++ b/src/ux-components/list-button-horizontal/list-button-horizontal.vue @@ -1,14 +1,34 @@