Merge remote-tracking branch 'origin/develop' into feature/CSR-747

This commit is contained in:
Katie 2022-12-05 08:52:30 -05:00
commit 3690ac7b4b
6 changed files with 78 additions and 19 deletions

View file

@ -80,7 +80,9 @@ async function getLatestPageForRedirection() {
fmgPageValues.CAPABILITY_QUESTIONS
);
const isVinOptionalVehicle = await store.dispatch(storeActions.IS_VIN_OPTIONAL_VEHICLE);
const isVinOptionalVehicle = store.getters.order.vehicle.make
? await store.dispatch(storeActions.IS_VIN_OPTIONAL_VEHICLE)
: false;
if (!vehicleMakeComponent.methods.arePagePrerequisitesValid()) {
return fmgPageValues.VEHICLE_YEAR;

View file

@ -23,7 +23,7 @@
<div v-else>
<alert
class="my-4"
cmsWidgetName="AlertQuoteReady"
:cmsWidgetName="alertInfo"
alertClass="alert-info"
v-bind:isDismissible="false" />
<div class="row my-2">
@ -258,6 +258,11 @@ export default {
skipVinLookup() {
return this.isRepair || this.isVinOptionalVehicle;
},
alertInfo() {
return this.isVinOptionalVehicle && !this.isRepair
? "AlertQuoteVinOptional"
: "AlertQuoteReady";
},
},
watch: {
serviceZipCode() {

View file

@ -6,6 +6,7 @@ import {
mockProcessedCmsContent,
inputQuestionWidgetAnswers,
} from "./service-package-question-test-helper";
import { nextTick } from "vue";
jest.mock("@/store", () => ({
commit: jest.fn(),
@ -49,11 +50,12 @@ describe("service-package-question.vue", () => {
const packageNameKey = "05_01_CSR_Quote_Standard_Repair";
Object.assign(processedCmsContent, mockProcessedCmsContent[packageNameKey]);
});
it("should emit relevant VAPS items in an array", () => {
it("should emit relevant VAPS items in an array", async () => {
// Arrange
const wrapper = setupMocks({});
// Act
wrapper.componentVM.selectedValues = "TierThree";
wrapper.componentVM.selectedPackageName = "TierThree";
await nextTick();
// Assert
expect(wrapper.emitted()["update:modelValue"][0][0]).toEqual([

View file

@ -4,7 +4,7 @@
:groupName="groupName"
buttonTypeString="servicePackageRadio"
:buttonTypeObject="servicePackageRadio"
v-model="selectedValues"
v-model="selectedPackageName"
isRequired />
</template>
@ -35,19 +35,21 @@ export default {
data() {
return {
servicePackageRadio: servicePackageRadio,
selectedPackageName: null,
};
},
computed: {
selectedValues: {
get: function () {
return this.modelValue;
},
set: function (newValue) {
const VapsProductsInSelectedPackage =
this.getVapsLineItemsForSelectedPackage(newValue);
this.$emit("update:modelValue", VapsProductsInSelectedPackage);
},
watch: {
availableLineItems() {
if (this.$store.getters.lineItems.supportingItems) {
this.selectDefaultPackage();
}
},
selectedPackageName(newValue) {
const VapsProductsInSelectedPackage = this.getVapsLineItemsForSelectedPackage(newValue);
this.$emit("update:modelValue", VapsProductsInSelectedPackage);
},
},
computed: {
nullSafeAvailableLineItems() {
return this.availableLineItems ?? [];
},
@ -208,6 +210,50 @@ export default {
});
return vapsPrice;
},
selectDefaultPackage() {
const vapsFromStore = this.$store.getters.lineItems.vaps;
let lowestTierForPackage = packageNames.TIER_ONE;
vapsFromStore.every((vapsItem) => {
let lowestTierForThisItem = this.getLowestTierForThisItem(vapsItem);
if (lowestTierForThisItem === packageNames.TIER_THREE) {
lowestTierForPackage = packageNames.TIER_THREE;
return false;
} else if (lowestTierForThisItem === packageNames.TIER_TWO) {
lowestTierForPackage = packageNames.TIER_TWO;
return true;
} else {
return true;
}
});
this.selectedPackageName = lowestTierForPackage;
},
getLowestTierForThisItem(vapsItem) {
let lowestTierForThisItem = null;
switch (vapsItem.partType) {
case partTypeStrings.FRONT_WIPER:
if (this.frontWipersApplicableForTierThree) {
lowestTierForThisItem = packageNames.TIER_THREE;
}
if (this.frontWipersApplicableForTierTwo) {
lowestTierForThisItem = packageNames.TIER_TWO;
}
break;
case partTypeStrings.REAR_WIPER:
if (this.rearWiperApplicableForTierThree) {
lowestTierForThisItem = packageNames.TIER_THREE;
}
if (this.rearWiperApplicableForTierTwo) {
lowestTierForThisItem = packageNames.TIER_TWO;
}
break;
case partTypeStrings.RAIN_DEFENSE:
if (this.rainDefenseApplicableForTierThree) {
lowestTierForThisItem = packageNames.TIER_THREE;
}
break;
}
return lowestTierForThisItem;
},
getVapsLineItemsForSelectedPackage(packageName) {
const vapsLineItemsForSelectedPackage = [];
if (packageName === packageNames.TIER_TWO) {

View file

@ -10,11 +10,7 @@
<div class="fade-on-route-transition sub-container make-tall">
<div class="row mt-2">
<div class="col">
<!-- includeSearchIcon and questionAlignment, placeholderText for testing only. Remove after testing. -->
<textboxQuestion
includeSearchIcon
questionAlignment="center"
placeholderText="Styled for testing only"
cmsWidgetName="VinNumberQuestionWidget"
v-model="vin"
inputId="vin"

View file

@ -126,6 +126,14 @@ html {
background-position: right 0.75rem center;
background-size: 16px 12px;
}
.has-search-icon {
button[type="submit"] {
background-color: $red-100;
background-image: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M15.7817 14.7328L11.8252 10.7762C12.8833 9.45005 13.3936 7.76911 13.2513 6.07849C13.1091 4.38788 12.325 2.81587 11.0601 1.6852C9.79515 0.554524 8.14538 -0.0490261 6.44946 -0.00154744C4.75353 0.0459312 3.14012 0.740836 1.94045 1.94051C0.740775 3.14018 0.0458701 4.75359 -0.00160848 6.44952C-0.0490871 8.14545 0.554463 9.79521 1.68514 11.0601C2.81581 12.325 4.38782 13.1091 6.07843 13.2514C7.76905 13.3937 9.44999 12.8834 10.7762 11.8252L14.7349 15.7839C14.8044 15.8527 14.8869 15.907 14.9774 15.9439C15.068 15.9808 15.165 15.9995 15.2628 15.9989C15.3606 15.9983 15.4573 15.9784 15.5475 15.9405C15.6376 15.9025 15.7194 15.8471 15.7881 15.7776C15.8568 15.708 15.9112 15.6256 15.9481 15.535C15.985 15.4444 16.0036 15.3474 16.0031 15.2496C16.0025 15.1518 15.9826 15.0551 15.9446 14.965C15.9067 14.8748 15.8513 14.7931 15.7817 14.7243V14.7328ZM6.63737 11.7913C5.61803 11.7913 4.62157 11.4891 3.77402 10.9228C2.92646 10.3564 2.26587 9.5515 1.87578 8.60975C1.4857 7.668 1.38363 6.63172 1.5825 5.63196C1.78136 4.6322 2.27222 3.71386 2.99301 2.99307C3.7138 2.27229 4.63214 1.78142 5.6319 1.58256C6.63166 1.38369 7.66793 1.48576 8.60969 1.87585C9.55144 2.26593 10.3564 2.92652 10.9227 3.77408C11.489 4.62163 11.7913 5.61809 11.7913 6.63743C11.7896 8.00382 11.2461 9.31376 10.2799 10.2799C9.3137 11.2461 8.00376 11.7897 6.63737 11.7913Z' fill='%23d4281c'/%3E%3C/svg%3E%0A");
border: 1px solid $red;
border-left: none;
}
}
}
}
//Restore to default style if alert box is present