nother draft check
test broken atm
This commit is contained in:
parent
76f9ec39aa
commit
48aa306498
6 changed files with 52 additions and 13 deletions
20
src/helpers/vehicle-helper.js
Normal file
20
src/helpers/vehicle-helper.js
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
import { useMainStore } from '@/store';
|
||||
import { experimentSettings } from '@/constants/experiments';
|
||||
import experimentMixin from '@/mixins/experiment-mixin';
|
||||
|
||||
export function hasYMMExperimentBailoutSettingEnabled() {
|
||||
return ymmIsVinRequired() && experimentMixin.methods.hasSettingEqualTo(experimentSettings.ISS_YMMS_VIN_REQUIRED_BAILOUT_ENABLED, 'true');
|
||||
}
|
||||
|
||||
export function hasYMMExperimentPageSettingEnabled() {
|
||||
return ymmIsVinRequired() && experimentMixin.methods.hasSettingEqualTo(experimentSettings.ISS_YMMS_VIN_REQUIRED_PAGE_ENABLED, 'true');
|
||||
}
|
||||
|
||||
export function hasYMMExperimentSettingEnabled() {
|
||||
return experimentMixin.methods.hasSettingEqualTo(experimentSettings.ISS_YMMS_VIN_REQUIRED_PAGE_ENABLED, 'true')
|
||||
|| experimentMixin.methods.hasSettingEqualTo(experimentSettings.ISS_YMMS_VIN_REQUIRED_BAILOUT_ENABLED, 'true');
|
||||
}
|
||||
|
||||
function ymmIsVinRequired() {
|
||||
return useMainStore().order?.vehicle?.vinRequired === true;
|
||||
}
|
||||
|
|
@ -83,6 +83,7 @@ import { Form } from 'vee-validate';
|
|||
// Supporting files
|
||||
import { fetchCmsContentForPage } from '@/helpers/cms-content-helper';
|
||||
import settleAllPromises from '@/helpers/layout-helper';
|
||||
import { hasYMMExperimentBailoutSettingEnabled } from '@/helpers/vehicle-helper';
|
||||
import routerParams from '@/router/router-constants/router-params';
|
||||
import {
|
||||
getDamageString,
|
||||
|
|
@ -344,6 +345,10 @@ export default {
|
|||
{ [routerParams.DISPLAY_VEHICLE_CHANGE_ALERT]: true }
|
||||
);
|
||||
} else if (matchingCars.length === 1) {
|
||||
if (hasYMMExperimentBailoutSettingEnabled()) {
|
||||
this.navigateBailout(bailoutMessage.YMMNotFound());
|
||||
return;
|
||||
}
|
||||
await this.navigateForwardWithSingleCarMatch();
|
||||
} else {
|
||||
this.$router.navigate(
|
||||
|
|
|
|||
|
|
@ -73,6 +73,7 @@ import { useMainStore } from '@/store';
|
|||
import issPageValues from '@/router/router-constants/issPage-values';
|
||||
import errorMessages from '@/constants/error-messages';
|
||||
import { required } from '@/helpers/validation-rules';
|
||||
import { hasYMMExperimentBailoutSettingEnabled } from '@/helpers/vehicle-helper';
|
||||
import { Form, defineRule } from 'vee-validate';
|
||||
import { isGlassAvailableForCarId } from '@/helpers/damage-helper';
|
||||
import {
|
||||
|
|
@ -257,6 +258,11 @@ export default {
|
|||
false
|
||||
);
|
||||
|
||||
if (hasYMMExperimentBailoutSettingEnabled()) {
|
||||
this.navigateBailout(bailoutMessage.YMMNotFound());
|
||||
return;
|
||||
}
|
||||
|
||||
await this.navigateForward();
|
||||
},
|
||||
async navigateForward() {
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ import settleAllPromises from '@/helpers/layout-helper';
|
|||
import { useMainStore } from '@/store';
|
||||
import bailoutMessage from '@/constants/bailoutMessage';
|
||||
import errorMessages from '@/constants/error-messages';
|
||||
import { experimentSettings } from '@/constants/experiments';
|
||||
import { hasYMMExperimentBailoutSettingEnabled } from '@/helpers/vehicle-helper';
|
||||
import { required } from '@/helpers/validation-rules';
|
||||
import { defineRule, Form } from 'vee-validate';
|
||||
import {
|
||||
|
|
@ -305,6 +305,11 @@ export default {
|
|||
}
|
||||
});
|
||||
|
||||
if (hasYMMExperimentBailoutSettingEnabled()) {
|
||||
this.navigateBailout(bailoutMessage.YMMNotFound());
|
||||
return;
|
||||
}
|
||||
|
||||
return this.navigateForward();
|
||||
},
|
||||
async navigateForward() {
|
||||
|
|
|
|||
|
|
@ -15,8 +15,8 @@
|
|||
|
||||
// Import Other Supporting Files
|
||||
import { useMainStore } from '@/store';
|
||||
import { experimentSettings } from '@/constants/experiments';
|
||||
import vinLookupMethodSelections from '@/constants/vin-lookup-methods';
|
||||
import { hasYMMExperimentSettingEnabled } from '@/helpers/vehicle-helper';
|
||||
import settleAllPromises from '@/helpers/layout-helper';
|
||||
import globalRules from '@/constants/global-rules';
|
||||
|
||||
|
|
@ -67,9 +67,9 @@ export default {
|
|||
answers.splice(homeAddressIndex, 1);
|
||||
}
|
||||
|
||||
const ymmsPageEnabled = this.getSettingValue(experimentSettings.ISS_YMMS_VIN_REQUIRED_PAGE_ENABLED) === 'true';
|
||||
const ymmsExperimentEnabled = hasYMMExperimentSettingEnabled();
|
||||
const isVinRequired = useMainStore().order.vehicle.vinRequired;
|
||||
if (isVinRequired && ymmsPageEnabled) {
|
||||
if (isVinRequired && ymmsExperimentEnabled) {
|
||||
const vinIndex = answers.findIndex(answer => answer.Name === vinLookupMethodSelections.NOVIN);
|
||||
if (vinIndex >= 0) {
|
||||
answers.splice(vinIndex, 1);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { useMainStore } from '@/store';
|
||||
import vehicleQuestionsMixin from '@/mixins/vehicle-questions-mixin';
|
||||
import { experimentSettings } from '@/constants/experiments';
|
||||
import bailoutMessage from '@/constants/bailoutMessage';
|
||||
import { hasYMMExperimentBailoutSettingEnabled, hasYMMExperimentPageSettingEnabled, hasYMMExperimentSettingEnabled } from '@/helpers/vehicle-helper';
|
||||
|
||||
export default {
|
||||
methods: {
|
||||
|
|
@ -16,24 +16,27 @@ export default {
|
|||
vehicleQuestionsMixin.methods.navigateForward(partsOrQuestions, this);
|
||||
},
|
||||
async handleVinRequiredVehicle(vin) {
|
||||
if (!this.mainStore.order.vehicle.vinRequired) {
|
||||
if (!this.mainStore.order.vehicle.vinRequired || !hasYMMExperimentSettingEnabled()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
this.mainStore.order.vehicle.vin = vin;
|
||||
if (this.hasSettingEqualTo(experimentSettings.ISS_YMMS_VIN_REQUIRED_BAILOUT_ENABLED, 'true')) {
|
||||
if (hasYMMExperimentBailoutSettingEnabled()) {
|
||||
this.navigateBailout(bailoutMessage.YMMNotFound());
|
||||
return true;
|
||||
}
|
||||
|
||||
const partsOrQuestionsResponse = await this.getPartsOrQuestionsV2();
|
||||
if (partsOrQuestionsResponse.data.partsOrQuestions.length === 0) {
|
||||
this.navigateBailout(bailoutMessage.YMMNotFound('No Parts Returned'));
|
||||
if (hasYMMExperimentPageSettingEnabled()) {
|
||||
const partsOrQuestionsResponse = await useMainStore().getPartsOrQuestionsV2();
|
||||
if (partsOrQuestionsResponse.data.partsOrQuestions.length === 0) {
|
||||
this.navigateBailout(bailoutMessage.YMMNotFound('No Parts Returned'));
|
||||
return true;
|
||||
}
|
||||
|
||||
await vehicleQuestionsMixin.methods.navigateForward(partsOrQuestionsResponse.data.partsOrQuestions, this);
|
||||
return true;
|
||||
}
|
||||
|
||||
await this.navigateForward(partsOrQuestionsResponse.data.partsOrQuestions, this);
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue