Merge pull request #1281 from Safelite/feature/richardson/INSR-9662
Original commits for first pass of YMM in NextGen
This commit is contained in:
commit
35fd4f4fb8
16 changed files with 251 additions and 49 deletions
|
|
@ -18,7 +18,9 @@ const bailoutCode = Object.freeze({
|
||||||
ApiError: 15,
|
ApiError: 15,
|
||||||
RouterError: 16,
|
RouterError: 16,
|
||||||
CoverageCancelledByUser: 17,
|
CoverageCancelledByUser: 17,
|
||||||
NeedHelp: 18,
|
FmgPartNotFound: 18,
|
||||||
|
NeedHelp: 19,
|
||||||
|
YMMNotFound: 20,
|
||||||
});
|
});
|
||||||
|
|
||||||
export default bailoutCode;
|
export default bailoutCode;
|
||||||
|
|
|
||||||
|
|
@ -101,7 +101,11 @@ const bailoutMessage = Object.freeze({
|
||||||
NeedHelp: () => ({
|
NeedHelp: () => ({
|
||||||
code: bailoutCode.NeedHelp,
|
code: bailoutCode.NeedHelp,
|
||||||
message: 'User clicked the Need Help link in the app.'
|
message: 'User clicked the Need Help link in the app.'
|
||||||
})
|
}),
|
||||||
|
YMMNotFound: () => ({
|
||||||
|
code: bailoutCode.YMMNotFound,
|
||||||
|
message: 'Vin Required vehicle'
|
||||||
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
export default bailoutMessage;
|
export default bailoutMessage;
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ const endpoints = Object.freeze({
|
||||||
method: 'POST'
|
method: 'POST'
|
||||||
},
|
},
|
||||||
GetMobilePremiumFee: {
|
GetMobilePremiumFee: {
|
||||||
url: `${PARTS_V1_BASE_URL}/mobile-premium-fee`,
|
url: `${PARTS_V1_BASE_URL}/mobile-premium-fee`,
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
},
|
},
|
||||||
GetVehicleYears: {
|
GetVehicleYears: {
|
||||||
|
|
@ -63,15 +63,19 @@ const endpoints = Object.freeze({
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
},
|
},
|
||||||
GetDamageOptions: {
|
GetDamageOptions: {
|
||||||
url: `${PARTS_V1_BASE_URL}/damage-options`,
|
url: `${PARTS_V1_BASE_URL}/damage-options`,
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
},
|
},
|
||||||
GetPartsOrQuestions: {
|
GetPartsOrQuestions: {
|
||||||
url: `${PARTS_V1_BASE_URL}/parts-or-questions`,
|
url: `${PARTS_V1_BASE_URL}/parts-or-questions`,
|
||||||
|
method: 'POST'
|
||||||
|
},
|
||||||
|
GetPartsOrQuestionsVinRequired: {
|
||||||
|
url: `${PARTS_V2_BASE_URL}/parts-or-questions`,
|
||||||
method: 'POST'
|
method: 'POST'
|
||||||
},
|
},
|
||||||
GetParts: {
|
GetParts: {
|
||||||
url: `${PARTS_V1_BASE_URL}/parts`,
|
url: `${PARTS_V1_BASE_URL}/parts`,
|
||||||
method: 'POST'
|
method: 'POST'
|
||||||
},
|
},
|
||||||
GetITACPriceOrderItems: {
|
GetITACPriceOrderItems: {
|
||||||
|
|
@ -100,19 +104,19 @@ const endpoints = Object.freeze({
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
},
|
},
|
||||||
GetCapabilityQuestions: {
|
GetCapabilityQuestions: {
|
||||||
url: `${PARTS_V1_BASE_URL}/capability-questions`,
|
url: `${PARTS_V1_BASE_URL}/capability-questions`,
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
},
|
},
|
||||||
GetPartFromCapabilityAnswer: {
|
GetPartFromCapabilityAnswer: {
|
||||||
url: `${PARTS_V1_BASE_URL}/part-from-capability-answer`,
|
url: `${PARTS_V1_BASE_URL}/part-from-capability-answer`,
|
||||||
method: 'POST'
|
method: 'POST'
|
||||||
},
|
},
|
||||||
GetWipers: {
|
GetWipers: {
|
||||||
url: `${PARTS_V1_BASE_URL}/wipers`,
|
url: `${PARTS_V1_BASE_URL}/wipers`,
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
},
|
},
|
||||||
GetRainDefense: {
|
GetRainDefense: {
|
||||||
url: `${PARTS_V1_BASE_URL}/rain-repel`,
|
url: `${PARTS_V1_BASE_URL}/rain-repel`,
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
},
|
},
|
||||||
GetRecalParts: {
|
GetRecalParts: {
|
||||||
|
|
@ -124,19 +128,19 @@ const endpoints = Object.freeze({
|
||||||
zipCode,
|
zipCode,
|
||||||
applicationName,
|
applicationName,
|
||||||
referralSequenceNumber
|
referralSequenceNumber
|
||||||
) => `${PARTS_V1_BASE_URL}/recal-parts/${carId}/${partNumber}/${recalibrationType}/${parentAccountNumber}/${zipCode}/${applicationName}/${referralSequenceNumber}`,
|
) => `${PARTS_V1_BASE_URL}/recal-parts/${carId}/${partNumber}/${recalibrationType}/${parentAccountNumber}/${zipCode}/${applicationName}/${referralSequenceNumber}`,
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
},
|
},
|
||||||
GetGlassFees: {
|
GetGlassFees: {
|
||||||
url: `${PARTS_V1_BASE_URL}/glass-fees`,
|
url: `${PARTS_V1_BASE_URL}/glass-fees`,
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
},
|
},
|
||||||
GetSupportingItems: {
|
GetSupportingItems: {
|
||||||
url: `${PARTS_V1_BASE_URL}/supporting-items`,
|
url: `${PARTS_V1_BASE_URL}/supporting-items`,
|
||||||
method: 'POST'
|
method: 'POST'
|
||||||
},
|
},
|
||||||
GetMobileFeePart: {
|
GetMobileFeePart: {
|
||||||
url: `${PARTS_V2_BASE_URL}/mobile-fee`,
|
url: `${PARTS_V2_BASE_URL}/mobile-fee`,
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
},
|
},
|
||||||
GetServiceabilityDetails: {
|
GetServiceabilityDetails: {
|
||||||
|
|
|
||||||
|
|
@ -92,6 +92,7 @@ import {
|
||||||
import vinPagesMixin from '@/mixins/vin-pages-mixin';
|
import vinPagesMixin from '@/mixins/vin-pages-mixin';
|
||||||
import { useMainStore } from '@/store/index.js';
|
import { useMainStore } from '@/store/index.js';
|
||||||
import showIssLoadingModal from '@/helpers/loading-modal-helper';
|
import showIssLoadingModal from '@/helpers/loading-modal-helper';
|
||||||
|
import bailoutMessage from '@/constants/bailoutMessage';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'address-lookup',
|
name: 'address-lookup',
|
||||||
|
|
@ -335,10 +336,7 @@ export default {
|
||||||
// If a different vehicle is found than the one entered and the selected glass
|
// If a different vehicle is found than the one entered and the selected glass
|
||||||
// is not available for that vehicle then navigate back to "vehicle-damage"
|
// is not available for that vehicle then navigate back to "vehicle-damage"
|
||||||
// display vehicle changed alert on that page.
|
// display vehicle changed alert on that page.
|
||||||
if (
|
if (this.isCarIdDifferent && !this.isSelectedGlassAvailableForVehicle) {
|
||||||
this.isCarIdDifferent
|
|
||||||
&& !this.isSelectedGlassAvailableForVehicle
|
|
||||||
) {
|
|
||||||
this.$router.navigate(
|
this.$router.navigate(
|
||||||
this.navigationScenarios.SELECTED_VIN_WITH_MISMATCHED_GLASS,
|
this.navigationScenarios.SELECTED_VIN_WITH_MISMATCHED_GLASS,
|
||||||
this.$route,
|
this.$route,
|
||||||
|
|
@ -346,6 +344,13 @@ export default {
|
||||||
{ [routerParams.DISPLAY_VEHICLE_CHANGE_ALERT]: true }
|
{ [routerParams.DISPLAY_VEHICLE_CHANGE_ALERT]: true }
|
||||||
);
|
);
|
||||||
} else if (matchingCars.length === 1) {
|
} else if (matchingCars.length === 1) {
|
||||||
|
if (this.mainStore.order.vehicle.vinRequired) {
|
||||||
|
this.mainStore.setBailout(bailoutMessage.YMMNotFound());
|
||||||
|
return this.$router.navigate(
|
||||||
|
this.navigationScenarios.BAILOUT,
|
||||||
|
this.$route
|
||||||
|
);
|
||||||
|
}
|
||||||
await this.navigateForwardWithSingleCarMatch();
|
await this.navigateForwardWithSingleCarMatch();
|
||||||
} else {
|
} else {
|
||||||
this.$router.navigate(
|
this.$router.navigate(
|
||||||
|
|
|
||||||
|
|
@ -256,6 +256,14 @@ export default {
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (this.mainStore.order.vehicle.vinRequired) {
|
||||||
|
this.mainStore.setBailout(bailoutMessage.YMMNotFound());
|
||||||
|
return this.$router.navigate(
|
||||||
|
this.navigationScenarios.BAILOUT,
|
||||||
|
this.$route
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
await this.navigateForward();
|
await this.navigateForward();
|
||||||
},
|
},
|
||||||
async navigateForward() {
|
async navigateForward() {
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ Object {
|
||||||
"disclaimerText": "DisclaimerWidget",
|
"disclaimerText": "DisclaimerWidget",
|
||||||
"noTpa": "ContentGroupNoTPAWidget",
|
"noTpa": "ContentGroupNoTPAWidget",
|
||||||
"notSeeingPreferredShop": "ContentGroupNotSeeingPreferredShop",
|
"notSeeingPreferredShop": "ContentGroupNotSeeingPreferredShop",
|
||||||
|
"ymmNotFound": "YMMNotFoundWidget",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
|
||||||
|
|
@ -211,6 +211,27 @@ describe('Bailout page', () => {
|
||||||
// Assert
|
// Assert
|
||||||
expect(name).toBe(expected);
|
expect(name).toBe(expected);
|
||||||
});
|
});
|
||||||
|
test('returns YMMNotFound widget name when bailout code is BailoutCode.YMMNotFound', () => {
|
||||||
|
// Arrange
|
||||||
|
const mainInitialState = {
|
||||||
|
applicationUser: {
|
||||||
|
pageData: {
|
||||||
|
'bailout-page': {
|
||||||
|
bailoutCode: bailoutCode.YMMNotFound
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const initialData = { };
|
||||||
|
const { wrapper } = getMountedComponent(mainInitialState, initialData);
|
||||||
|
const expected = 'YMMNotFoundWidget';
|
||||||
|
|
||||||
|
// Act
|
||||||
|
const name = wrapper.vm.subHeaderCmsWidgetName;
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(name).toBe(expected);
|
||||||
|
});
|
||||||
test('returns default widget name when bailoutCode does not match any other content bailout codes', () => {
|
test('returns default widget name when bailoutCode does not match any other content bailout codes', () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const mainInitialState = {
|
const mainInitialState = {
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
:contentProperty="subHeaderContentProperty"
|
:contentProperty="subHeaderContentProperty"
|
||||||
:stripRteStyle="stripRteStyle"
|
:stripRteStyle="stripRteStyle"
|
||||||
:subContentProperty="subContentProperty"
|
:subContentProperty="subContentProperty"
|
||||||
class="sub-header-content mt-2 mb-5"
|
class="sub-header-content mb-5"
|
||||||
justification="left" />
|
justification="left" />
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col">
|
<div class="col">
|
||||||
|
|
@ -159,6 +159,7 @@ export default {
|
||||||
defaultSiteHeader: 'SiteSubHeaderWidget',
|
defaultSiteHeader: 'SiteSubHeaderWidget',
|
||||||
noTpa: 'ContentGroupNoTPAWidget',
|
noTpa: 'ContentGroupNoTPAWidget',
|
||||||
notSeeingPreferredShop: 'ContentGroupNotSeeingPreferredShop',
|
notSeeingPreferredShop: 'ContentGroupNotSeeingPreferredShop',
|
||||||
|
ymmNotFound: 'YMMNotFoundWidget',
|
||||||
disclaimerText: 'DisclaimerWidget'
|
disclaimerText: 'DisclaimerWidget'
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
|
|
@ -172,20 +173,21 @@ export default {
|
||||||
computed: {
|
computed: {
|
||||||
subHeaderCmsWidgetName() {
|
subHeaderCmsWidgetName() {
|
||||||
switch (this.bailout.bailoutCode) {
|
switch (this.bailout.bailoutCode) {
|
||||||
case BailoutCode.TPANotEnabled:
|
|
||||||
return this.widget.noTpa;
|
|
||||||
|
|
||||||
case BailoutCode.DoNotSeeMyShop:
|
case BailoutCode.DoNotSeeMyShop:
|
||||||
return this.widget.notSeeingPreferredShop;
|
return this.widget.notSeeingPreferredShop;
|
||||||
|
case BailoutCode.TPANotEnabled:
|
||||||
|
return this.widget.noTpa;
|
||||||
|
case BailoutCode.YMMNotFound:
|
||||||
|
return this.widget.ymmNotFound;
|
||||||
default:
|
default:
|
||||||
return this.widget.defaultSiteHeader;
|
return this.widget.defaultSiteHeader;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
subHeaderContentProperty() {
|
subHeaderContentProperty() {
|
||||||
switch (this.bailout.bailoutCode) {
|
switch (this.bailout.bailoutCode) {
|
||||||
case BailoutCode.TPANotEnabled:
|
|
||||||
case BailoutCode.DoNotSeeMyShop:
|
case BailoutCode.DoNotSeeMyShop:
|
||||||
|
case BailoutCode.TPANotEnabled:
|
||||||
|
case BailoutCode.YMMNotFound:
|
||||||
return widgetFields.CONTENT_GROUP_WIDGET.HEADER_TEXT;
|
return widgetFields.CONTENT_GROUP_WIDGET.HEADER_TEXT;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
@ -194,8 +196,9 @@ export default {
|
||||||
},
|
},
|
||||||
subContentProperty() {
|
subContentProperty() {
|
||||||
switch (this.bailout.bailoutCode) {
|
switch (this.bailout.bailoutCode) {
|
||||||
case BailoutCode.TPANotEnabled:
|
|
||||||
case BailoutCode.DoNotSeeMyShop:
|
case BailoutCode.DoNotSeeMyShop:
|
||||||
|
case BailoutCode.TPANotEnabled:
|
||||||
|
case BailoutCode.YMMNotFound:
|
||||||
return widgetFields.CONTENT_GROUP_WIDGET.BODY_TEXT;
|
return widgetFields.CONTENT_GROUP_WIDGET.BODY_TEXT;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
@ -259,6 +262,10 @@ export default {
|
||||||
min-height: 1px;
|
min-height: 1px;
|
||||||
padding-left: .9375rem;
|
padding-left: .9375rem;
|
||||||
padding-right: .9375rem;
|
padding-right: .9375rem;
|
||||||
|
|
||||||
|
.sub-header-content {
|
||||||
|
margin-top: 1.25rem;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,9 @@
|
||||||
<div class="iss-heritage-container-width">
|
<div class="iss-heritage-container-width">
|
||||||
<div class="contact-confirmation-container iss-heritage-content-container-width">
|
<div class="contact-confirmation-container iss-heritage-content-container-width">
|
||||||
<siteSubHeader
|
<siteSubHeader
|
||||||
cmsWidgetName="SiteSubHeaderWidget"
|
:cmsWidgetName="subHeaderCmsWidgetName"
|
||||||
|
:contentProperty="subHeaderContentProperty"
|
||||||
|
:subContentProperty="subContentProperty"
|
||||||
class="sub-header-content mt-4"
|
class="sub-header-content mt-4"
|
||||||
justification="left" />
|
justification="left" />
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -20,6 +22,8 @@
|
||||||
import siteHeader from '@/iss-components/site-header/site-header.vue';
|
import siteHeader from '@/iss-components/site-header/site-header.vue';
|
||||||
import siteSubHeader from '@/iss-components/site-sub-header/site-sub-header.vue';
|
import siteSubHeader from '@/iss-components/site-sub-header/site-sub-header.vue';
|
||||||
// Supporting files
|
// Supporting files
|
||||||
|
import BailoutCode from '@/constants/bailoutCode';
|
||||||
|
import widgetFields from '@/constants/cms-widget-fields.js';
|
||||||
import { fetchCmsContentForPage } from '@/helpers/cms-content-helper';
|
import { fetchCmsContentForPage } from '@/helpers/cms-content-helper';
|
||||||
import issPageValues from '@/router/router-constants/issPage-values.js';
|
import issPageValues from '@/router/router-constants/issPage-values.js';
|
||||||
import settleAllPromises from '@/helpers/layout-helper';
|
import settleAllPromises from '@/helpers/layout-helper';
|
||||||
|
|
@ -55,12 +59,44 @@ export default {
|
||||||
return { mainStore };
|
return { mainStore };
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
const contactConfirmationData = useMainStore().pageData(issPageValues.CONTACT_CONFIRMATION);
|
const bailout = useMainStore().pageData(issPageValues.BAILOUT_PAGE);
|
||||||
return {
|
return {
|
||||||
contactConfirmationModel: contactConfirmationData
|
bailout: bailout ?? { bailoutCode: BailoutCode.Unknown },
|
||||||
|
contactConfirmationModel: useMainStore().pageData(issPageValues.CONTACT_CONFIRMATION),
|
||||||
|
widget: {
|
||||||
|
defaultSiteHeader: 'SiteSubHeaderWidget',
|
||||||
|
ymmNotFound: 'YMMNotFoundWidget'
|
||||||
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {},
|
computed: {
|
||||||
|
subHeaderCmsWidgetName() {
|
||||||
|
switch (this.bailout.bailoutCode) {
|
||||||
|
case BailoutCode.YMMNotFound:
|
||||||
|
return this.widget.ymmNotFound;
|
||||||
|
default:
|
||||||
|
return this.widget.defaultSiteHeader;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
subHeaderContentProperty() {
|
||||||
|
switch (this.bailout.bailoutCode) {
|
||||||
|
case BailoutCode.YMMNotFound:
|
||||||
|
return widgetFields.CONTENT_GROUP_WIDGET.HEADER_TEXT;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return widgetFields.SUB_HEADER_WIDGET.SUB_HEADER_TEXT;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
subContentProperty() {
|
||||||
|
switch (this.bailout.bailoutCode) {
|
||||||
|
case BailoutCode.YMMNotFound:
|
||||||
|
return widgetFields.CONTENT_GROUP_WIDGET.BODY_TEXT;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return widgetFields.SUB_HEADER_WIDGET.SECONDARY_TEXT;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
methods: {}
|
methods: {}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -76,6 +76,7 @@
|
||||||
import { fetchCmsContentForPage } from '@/helpers/cms-content-helper';
|
import { fetchCmsContentForPage } from '@/helpers/cms-content-helper';
|
||||||
import settleAllPromises from '@/helpers/layout-helper';
|
import settleAllPromises from '@/helpers/layout-helper';
|
||||||
import { useMainStore } from '@/store';
|
import { useMainStore } from '@/store';
|
||||||
|
import bailoutMessage from '@/constants/bailoutMessage';
|
||||||
import errorMessages from '@/constants/error-messages';
|
import errorMessages from '@/constants/error-messages';
|
||||||
import { required } from '@/helpers/validation-rules';
|
import { required } from '@/helpers/validation-rules';
|
||||||
import { defineRule, Form } from 'vee-validate';
|
import { defineRule, Form } from 'vee-validate';
|
||||||
|
|
@ -303,6 +304,14 @@ export default {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (this.mainStore.order.vehicle.vinRequired) {
|
||||||
|
this.mainStore.setBailout(bailoutMessage.YMMNotFound());
|
||||||
|
return this.$router.navigate(
|
||||||
|
this.navigationScenarios.BAILOUT,
|
||||||
|
this.$route
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return this.navigateForward();
|
return this.navigateForward();
|
||||||
},
|
},
|
||||||
async navigateForward() {
|
async navigateForward() {
|
||||||
|
|
|
||||||
|
|
@ -65,6 +65,15 @@ export default {
|
||||||
const homeAddressIndex = answers.findIndex(answer => answer.Name === vinLookupMethodSelections.HOMEADDRESS);
|
const homeAddressIndex = answers.findIndex(answer => answer.Name === vinLookupMethodSelections.HOMEADDRESS);
|
||||||
answers.splice(homeAddressIndex, 1);
|
answers.splice(homeAddressIndex, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const isVinRequired = useMainStore().order.vehicle.vinRequired;
|
||||||
|
if (isVinRequired) {
|
||||||
|
const vinIndex = answers.findIndex(answer => answer.Name === vinLookupMethodSelections.NOVIN);
|
||||||
|
if (vinIndex >= 0) {
|
||||||
|
answers.splice(vinIndex, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.answersFromCms = answers;
|
this.answersFromCms = answers;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,10 @@ const getPartsOrQuestions = {
|
||||||
methodName: 'getPartsOrQuestions',
|
methodName: 'getPartsOrQuestions',
|
||||||
mockResponse: null
|
mockResponse: null
|
||||||
};
|
};
|
||||||
|
const getPartsOrQuestionsVinRequired = {
|
||||||
|
methodName: 'getPartsOrQuestionsVinRequired',
|
||||||
|
mockResponse: null
|
||||||
|
};
|
||||||
|
|
||||||
const vehicleWithPartQuestionsMockResponse = {
|
const vehicleWithPartQuestionsMockResponse = {
|
||||||
data: {
|
data: {
|
||||||
|
|
@ -372,6 +376,8 @@ describe('vin-lookup.vue', () => {
|
||||||
.mockResolvedValue(lookupVehicleByVin.mockResponse);
|
.mockResolvedValue(lookupVehicleByVin.mockResponse);
|
||||||
jest.spyOn(vehicleQuestionsMixin.methods, getPartsOrQuestions.methodName)
|
jest.spyOn(vehicleQuestionsMixin.methods, getPartsOrQuestions.methodName)
|
||||||
.mockResolvedValue(getPartsOrQuestions.mockResponse);
|
.mockResolvedValue(getPartsOrQuestions.mockResponse);
|
||||||
|
jest.spyOn(vehicleQuestionsMixin.methods, getPartsOrQuestionsVinRequired.methodName)
|
||||||
|
.mockResolvedValue(getPartsOrQuestionsVinRequired.mockResponse);
|
||||||
|
|
||||||
const { container } = render(VinLookupComponent, mountOptions);
|
const { container } = render(VinLookupComponent, mountOptions);
|
||||||
|
|
||||||
|
|
@ -403,6 +409,8 @@ describe('vin-lookup.vue', () => {
|
||||||
.mockResolvedValue(lookupVehicleByVin.mockResponse);
|
.mockResolvedValue(lookupVehicleByVin.mockResponse);
|
||||||
jest.spyOn(vehicleQuestionsMixin.methods, getPartsOrQuestions.methodName)
|
jest.spyOn(vehicleQuestionsMixin.methods, getPartsOrQuestions.methodName)
|
||||||
.mockResolvedValue(getPartsOrQuestions.mockResponse);
|
.mockResolvedValue(getPartsOrQuestions.mockResponse);
|
||||||
|
jest.spyOn(vehicleQuestionsMixin.methods, getPartsOrQuestionsVinRequired.methodName)
|
||||||
|
.mockResolvedValue(getPartsOrQuestionsVinRequired.mockResponse);
|
||||||
|
|
||||||
const { container } = render(VinLookupComponent, mountOptions);
|
const { container } = render(VinLookupComponent, mountOptions);
|
||||||
|
|
||||||
|
|
@ -436,6 +444,8 @@ describe('vin-lookup.vue', () => {
|
||||||
.mockResolvedValue(lookupVehicleByVin.mockResponse);
|
.mockResolvedValue(lookupVehicleByVin.mockResponse);
|
||||||
jest.spyOn(vehicleQuestionsMixin.methods, getPartsOrQuestions.methodName)
|
jest.spyOn(vehicleQuestionsMixin.methods, getPartsOrQuestions.methodName)
|
||||||
.mockResolvedValue(getPartsOrQuestions.mockResponse);
|
.mockResolvedValue(getPartsOrQuestions.mockResponse);
|
||||||
|
jest.spyOn(vehicleQuestionsMixin.methods, getPartsOrQuestionsVinRequired.methodName)
|
||||||
|
.mockResolvedValue(getPartsOrQuestionsVinRequired.mockResponse);
|
||||||
store.getCapabilityQuestions.mockResolvedValueOnce({ data: [] });
|
store.getCapabilityQuestions.mockResolvedValueOnce({ data: [] });
|
||||||
|
|
||||||
const { container } = render(VinLookupComponent, mountOptions);
|
const { container } = render(VinLookupComponent, mountOptions);
|
||||||
|
|
@ -469,6 +479,8 @@ describe('vin-lookup.vue', () => {
|
||||||
.mockResolvedValue(lookupVehicleByVin.mockResponse);
|
.mockResolvedValue(lookupVehicleByVin.mockResponse);
|
||||||
jest.spyOn(vehicleQuestionsMixin.methods, getPartsOrQuestions.methodName)
|
jest.spyOn(vehicleQuestionsMixin.methods, getPartsOrQuestions.methodName)
|
||||||
.mockResolvedValue(getPartsOrQuestions.mockResponse);
|
.mockResolvedValue(getPartsOrQuestions.mockResponse);
|
||||||
|
jest.spyOn(vehicleQuestionsMixin.methods, getPartsOrQuestionsVinRequired.methodName)
|
||||||
|
.mockResolvedValue(getPartsOrQuestionsVinRequired.mockResponse);
|
||||||
|
|
||||||
const { container } = render(VinLookupComponent, mountOptions);
|
const { container } = render(VinLookupComponent, mountOptions);
|
||||||
|
|
||||||
|
|
@ -505,6 +517,8 @@ describe('vin-lookup.vue', () => {
|
||||||
.mockResolvedValue(lookupVehicleByVin.mockResponse);
|
.mockResolvedValue(lookupVehicleByVin.mockResponse);
|
||||||
jest.spyOn(vehicleQuestionsMixin.methods, getPartsOrQuestions.methodName)
|
jest.spyOn(vehicleQuestionsMixin.methods, getPartsOrQuestions.methodName)
|
||||||
.mockResolvedValue(getPartsOrQuestions.mockResponse);
|
.mockResolvedValue(getPartsOrQuestions.mockResponse);
|
||||||
|
jest.spyOn(vehicleQuestionsMixin.methods, getPartsOrQuestionsVinRequired.methodName)
|
||||||
|
.mockResolvedValue(getPartsOrQuestionsVinRequired.mockResponse);
|
||||||
|
|
||||||
const { container } = render(VinLookupComponent, mountOptions);
|
const { container } = render(VinLookupComponent, mountOptions);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -176,6 +176,14 @@ export default {
|
||||||
this.$refs.siteFooter.enableForwardAction();
|
this.$refs.siteFooter.enableForwardAction();
|
||||||
showIssLoadingModal(true);
|
showIssLoadingModal(true);
|
||||||
|
|
||||||
|
if (this.mainStore.order.vehicle.vinRequired) {
|
||||||
|
this.mainStore.setBailout(bailoutMessage.YMMNotFound());
|
||||||
|
return this.$router.navigate(
|
||||||
|
this.navigationScenarios.BAILOUT,
|
||||||
|
this.$route
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (this.needToLookupVehicle) {
|
if (this.needToLookupVehicle) {
|
||||||
try {
|
try {
|
||||||
const vehicleLookupResponse = await this.lookupVehicleByVin(this.vin);
|
const vehicleLookupResponse = await this.lookupVehicleByVin(this.vin);
|
||||||
|
|
@ -262,6 +270,30 @@ export default {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If the vehicle is vinRequired, we need to call getPartsOrQuestionsVinRequired() to get the parts or questions.
|
||||||
|
* If the vehicle is not vinRequired, we can call getPartsOrQuestions() to get the parts or questions.
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
if (this.mainStore.order.vehicle.vinRequired) {
|
||||||
|
try {
|
||||||
|
const partsOrQuestionsResponse = await this.getPartsOrQuestionsVinRequired();
|
||||||
|
await this.navigateForward(
|
||||||
|
partsOrQuestionsResponse.data.partsOrQuestions,
|
||||||
|
this
|
||||||
|
);
|
||||||
|
} catch (e) {
|
||||||
|
this.mainStore.setBailout(bailoutMessage.HeavyTruckVehicle(this.vehicleFromLookup.carId));
|
||||||
|
this.$router.navigate(
|
||||||
|
this.navigationScenarios.BAILOUT,
|
||||||
|
this.$route
|
||||||
|
);
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
*/
|
||||||
const partsOrQuestionsResponse = await this.getPartsOrQuestions();
|
const partsOrQuestionsResponse = await this.getPartsOrQuestions();
|
||||||
|
|
||||||
// Comes from vehicleQuestionsMixin.navigateForward()
|
// Comes from vehicleQuestionsMixin.navigateForward()
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ export default {
|
||||||
const store = useMainStore();
|
const store = useMainStore();
|
||||||
const issConfig = store.issConfig;
|
const issConfig = store.issConfig;
|
||||||
const currentPageName = this.getPageNameByQueryString();
|
const currentPageName = this.getPageNameByQueryString();
|
||||||
//await this.validateSession();
|
// await this.validateSession();
|
||||||
|
|
||||||
const submittedOrder = store.getSubmittedOrder();
|
const submittedOrder = store.getSubmittedOrder();
|
||||||
const hasSubmittedOrder = store.hasSubmittedOrder();
|
const hasSubmittedOrder = store.hasSubmittedOrder();
|
||||||
|
|
@ -98,7 +98,7 @@ export default {
|
||||||
const store = useMainStore();
|
const store = useMainStore();
|
||||||
const issConfig = store.issConfig;
|
const issConfig = store.issConfig;
|
||||||
const currentPageName = this.getPageNameByQueryString();
|
const currentPageName = this.getPageNameByQueryString();
|
||||||
//await this.validateSession();
|
// await this.validateSession();
|
||||||
|
|
||||||
const submittedOrder = store.getSubmittedOrder();
|
const submittedOrder = store.getSubmittedOrder();
|
||||||
const hasSubmittedOrder = store.hasSubmittedOrder();
|
const hasSubmittedOrder = store.hasSubmittedOrder();
|
||||||
|
|
@ -246,6 +246,18 @@ export default {
|
||||||
payload.vehicleStyle = "";
|
payload.vehicleStyle = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isDefined(order.vehicle.carId)) {
|
||||||
|
payload.vehicleCarId = order.vehicle.carId;
|
||||||
|
} else {
|
||||||
|
payload.vehicleCarId = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isDefined(order.vehicle.vinRequired)) {
|
||||||
|
payload.vehicleIsVinRequired = order.vehicle.vinRequired;
|
||||||
|
} else {
|
||||||
|
payload.vehicleIsVinRequired = "";
|
||||||
|
}
|
||||||
|
|
||||||
// Glass pieces
|
// Glass pieces
|
||||||
const glass = order.damage.glassToReplace ?? [];
|
const glass = order.damage.glassToReplace ?? [];
|
||||||
if (glass.length === 0) {
|
if (glass.length === 0) {
|
||||||
|
|
@ -257,7 +269,7 @@ export default {
|
||||||
payload.glassToReplace = glassString;
|
payload.glassToReplace = glassString;
|
||||||
}
|
}
|
||||||
|
|
||||||
//EON
|
// EON
|
||||||
if (order.eon) {
|
if (order.eon) {
|
||||||
payload.eon = order.eon;
|
payload.eon = order.eon;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -555,7 +567,6 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
async initSession() {
|
async initSession() {
|
||||||
|
|
||||||
regenerateDeviceId();
|
regenerateDeviceId();
|
||||||
regenerateUserId();
|
regenerateUserId();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -355,6 +355,9 @@ export default {
|
||||||
async getPartsOrQuestions() {
|
async getPartsOrQuestions() {
|
||||||
return useMainStore().getPartsOrQuestions();
|
return useMainStore().getPartsOrQuestions();
|
||||||
},
|
},
|
||||||
|
async getPartsOrQuestionsVinRequired() {
|
||||||
|
return useMainStore().getPartsOrQuestionsVinRequired();
|
||||||
|
},
|
||||||
|
|
||||||
// Can't use `this` because navigateForward is also called from vin-pages-mixin
|
// Can't use `this` because navigateForward is also called from vin-pages-mixin
|
||||||
async navigateForward(partsOrQuestions, vm) {
|
async navigateForward(partsOrQuestions, vm) {
|
||||||
|
|
|
||||||
|
|
@ -4,13 +4,13 @@ import bailoutCode from '@/constants/bailoutCode';
|
||||||
import coverageStatuses from '@/constants/coverage-statuses';
|
import coverageStatuses from '@/constants/coverage-statuses';
|
||||||
import coverageType from '@/constants/coverage-type';
|
import coverageType from '@/constants/coverage-type';
|
||||||
import damageLocationsSelected from '@/constants/damage-locations-selected';
|
import damageLocationsSelected from '@/constants/damage-locations-selected';
|
||||||
import endorsementOptions from '@/constants/endorsement-options';
|
|
||||||
import endpoints from '@/constants/endpoints';
|
import endpoints from '@/constants/endpoints';
|
||||||
import { experimentSettings, experimentTriggers, experimentUniverses } from '@/constants/experiments';
|
import { experimentSettings, experimentTriggers, experimentUniverses } from '@/constants/experiments';
|
||||||
import partNumberStrings from '@/constants/part-number-strings';
|
import partNumberStrings from '@/constants/part-number-strings';
|
||||||
import partTypeStrings from '@/constants/part-type-strings';
|
import partTypeStrings from '@/constants/part-type-strings';
|
||||||
import { paymentMethods } from '@/constants/payment-method-constants';
|
import { paymentMethods } from '@/constants/payment-method-constants';
|
||||||
import { AppointmentTypeStrings } from '@/constants/schedule-constants';
|
import { AppointmentTypeStrings } from '@/constants/schedule-constants';
|
||||||
|
import submitType from '@/constants/submit-type';
|
||||||
import webStorageConstants from '@/constants/web-storage-constants';
|
import webStorageConstants from '@/constants/web-storage-constants';
|
||||||
import globalMethods from '@/global-methods';
|
import globalMethods from '@/global-methods';
|
||||||
import { getSessionKeyValue, getUserIdValue, deleteISSCookie, getDeviceIdValue } from '@/helpers/cookie-helper';
|
import { getSessionKeyValue, getUserIdValue, deleteISSCookie, getDeviceIdValue } from '@/helpers/cookie-helper';
|
||||||
|
|
@ -27,7 +27,6 @@ import { getRecalPartNumbers, getTopLevelGlassPartsWithRecal, getHasRecalibratio
|
||||||
import { getDateForSavedSessionTimeout } from '@/helpers/session-helper';
|
import { getDateForSavedSessionTimeout } from '@/helpers/session-helper';
|
||||||
import { isMobileDevice } from '@/helpers/useragent-helper';
|
import { isMobileDevice } from '@/helpers/useragent-helper';
|
||||||
import issPageValues from '@/router/router-constants/issPage-values';
|
import issPageValues from '@/router/router-constants/issPage-values';
|
||||||
import CoverageStatuses from '@/constants/coverage-statuses';
|
|
||||||
import { getNonFalseValuesOfPropertyInArrayOfObjects, sortArrayOfObjectsByPropertyValue } from '@/helpers/object-helper';
|
import { getNonFalseValuesOfPropertyInArrayOfObjects, sortArrayOfObjectsByPropertyValue } from '@/helpers/object-helper';
|
||||||
|
|
||||||
const storeId = 'main';
|
const storeId = 'main';
|
||||||
|
|
@ -85,7 +84,10 @@ export const getDefaultState = () => ({
|
||||||
lastName: null
|
lastName: null
|
||||||
},
|
},
|
||||||
isBigTruck: null,
|
isBigTruck: null,
|
||||||
canSafeliteService: null
|
canSafeliteService: null,
|
||||||
|
skipVINLookup: null,
|
||||||
|
skipPartQuestions: null,
|
||||||
|
vinRequired: null
|
||||||
},
|
},
|
||||||
damage: {
|
damage: {
|
||||||
isRepair: null,
|
isRepair: null,
|
||||||
|
|
@ -762,7 +764,7 @@ export const useMainStore = defineStore({
|
||||||
this.updateDeductible(r.data);
|
this.updateDeductible(r.data);
|
||||||
return r;
|
return r;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.updateCoverageStatus(CoverageStatuses.PENDING);
|
this.updateCoverageStatus(coverageStatuses.PENDING);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -808,9 +810,7 @@ export const useMainStore = defineStore({
|
||||||
},
|
},
|
||||||
|
|
||||||
// PartsOrQuestions API Actions
|
// PartsOrQuestions API Actions
|
||||||
async getPartsOrQuestions() {
|
getPartsOrQuestionsPayload() {
|
||||||
this.resetPartsAndDependencies();
|
|
||||||
|
|
||||||
const { vehicle } = this;
|
const { vehicle } = this;
|
||||||
const { damage } = this;
|
const { damage } = this;
|
||||||
const { order } = this;
|
const { order } = this;
|
||||||
|
|
@ -822,17 +822,22 @@ export const useMainStore = defineStore({
|
||||||
|
|
||||||
// create a new array to avoid mutating state
|
// create a new array to avoid mutating state
|
||||||
const glassArrayForPayload = convertGlassPieceNamingForApi(glassArray);
|
const glassArrayForPayload = convertGlassPieceNamingForApi(glassArray);
|
||||||
|
return {
|
||||||
|
carId,
|
||||||
|
glassPieces: glassArrayForPayload,
|
||||||
|
zip: zipCode,
|
||||||
|
vin,
|
||||||
|
oemEndorsementFlag: this.hasOemEndorsement
|
||||||
|
};
|
||||||
|
},
|
||||||
|
async getPartsOrQuestions() {
|
||||||
|
this.resetPartsAndDependencies();
|
||||||
|
|
||||||
|
const payload = this.getPartsOrQuestionsPayload();
|
||||||
const response = await globalMethods.callHttpClient({
|
const response = await globalMethods.callHttpClient({
|
||||||
method: endpoints.GetPartsOrQuestions.method,
|
method: endpoints.GetPartsOrQuestions.method,
|
||||||
endpoint: endpoints.GetPartsOrQuestions.url,
|
endpoint: endpoints.GetPartsOrQuestions.url,
|
||||||
payload: {
|
payload: payload
|
||||||
carId,
|
|
||||||
glassPieces: glassArrayForPayload,
|
|
||||||
zip: zipCode,
|
|
||||||
vin,
|
|
||||||
oemEndorsementFlag: this.hasOemEndorsement
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Flatten location and name properties
|
// Flatten location and name properties
|
||||||
|
|
@ -840,7 +845,21 @@ export const useMainStore = defineStore({
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
},
|
},
|
||||||
|
async getPartsOrQuestionsVinRequired() {
|
||||||
|
this.resetPartsAndDependencies();
|
||||||
|
|
||||||
|
const payload = this.getPartsOrQuestionsPayload();
|
||||||
|
const response = await globalMethods.callHttpClient({
|
||||||
|
method: endpoints.GetPartsOrQuestionsVinRequired.method,
|
||||||
|
endpoint: endpoints.GetPartsOrQuestionsVinRequired.url,
|
||||||
|
payload: payload
|
||||||
|
});
|
||||||
|
|
||||||
|
// Flatten location and name properties
|
||||||
|
response.data.partsOrQuestions = convertGlassPieceNamingFromApi(response.data.partsOrQuestions);
|
||||||
|
|
||||||
|
return response;
|
||||||
|
},
|
||||||
async getParts() {
|
async getParts() {
|
||||||
const { vehicle } = this.order;
|
const { vehicle } = this.order;
|
||||||
const { damage } = this.order;
|
const { damage } = this.order;
|
||||||
|
|
@ -2081,6 +2100,9 @@ export const useMainStore = defineStore({
|
||||||
this.order.vehicle.imageColor = vehicle.imageVifColor;
|
this.order.vehicle.imageColor = vehicle.imageVifColor;
|
||||||
this.order.vehicle.isBigTruck = vehicle.isBigTruck;
|
this.order.vehicle.isBigTruck = vehicle.isBigTruck;
|
||||||
this.order.vehicle.canSafeliteService = vehicle.canSafeliteService;
|
this.order.vehicle.canSafeliteService = vehicle.canSafeliteService;
|
||||||
|
this.order.vehicle.skipVINLookup = vehicle.skipVINLookup;
|
||||||
|
this.order.vehicle.skipPartQuestions = vehicle.skipPartQuestions;
|
||||||
|
this.order.vehicle.vinRequired = vehicle.vinRequired;
|
||||||
|
|
||||||
this.updateSupportingItems(null);
|
this.updateSupportingItems(null);
|
||||||
this.updateVaps(null);
|
this.updateVaps(null);
|
||||||
|
|
@ -2215,6 +2237,9 @@ export const useMainStore = defineStore({
|
||||||
this.order.vehicle.registration.lastName = null;
|
this.order.vehicle.registration.lastName = null;
|
||||||
this.order.vehicle.isBigTruck = null;
|
this.order.vehicle.isBigTruck = null;
|
||||||
this.order.vehicle.canSafeliteService = null;
|
this.order.vehicle.canSafeliteService = null;
|
||||||
|
this.order.vehicle.skipVINLookup = null;
|
||||||
|
this.order.vehicle.skipPartQuestions = null;
|
||||||
|
this.order.vehicle.vinRequired = null;
|
||||||
|
|
||||||
if (this.isBailout && this.bailoutCode === bailoutCode.HeavyTruckVehicle) {
|
if (this.isBailout && this.bailoutCode === bailoutCode.HeavyTruckVehicle) {
|
||||||
this.resetBailout();
|
this.resetBailout();
|
||||||
|
|
@ -3158,7 +3183,7 @@ export const useMainStore = defineStore({
|
||||||
return JSON.parse(window.sessionStorage.getItem(webStorageConstants.SUBMITTED_ORDER));
|
return JSON.parse(window.sessionStorage.getItem(webStorageConstants.SUBMITTED_ORDER));
|
||||||
},
|
},
|
||||||
|
|
||||||
async createSubmittedOrder(submitType) {
|
async createSubmittedOrder(pSubmitType) {
|
||||||
if (this.hasSubmittedOrder()) {
|
if (this.hasSubmittedOrder()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -3169,16 +3194,27 @@ export const useMainStore = defineStore({
|
||||||
|
|
||||||
submittedOrder.isUnverified = this.isUnverified;
|
submittedOrder.isUnverified = this.isUnverified;
|
||||||
submittedOrder.isVerified = this.isVerified;
|
submittedOrder.isVerified = this.isVerified;
|
||||||
submittedOrder.submitType = submitType;
|
submittedOrder.submitType = pSubmitType;
|
||||||
submittedOrder.payment.isPayInAdvance = this.isPayInAdvance;
|
submittedOrder.payment.isPayInAdvance = this.isPayInAdvance;
|
||||||
submittedOrder.hasRecalibrationPart = hasRecalibrationPart;
|
submittedOrder.hasRecalibrationPart = hasRecalibrationPart;
|
||||||
|
|
||||||
// set to sessionStorage
|
// set to sessionStorage
|
||||||
window.sessionStorage.setItem(webStorageConstants.SUBMITTED_ORDER, JSON.stringify(submittedOrder));
|
window.sessionStorage.setItem(webStorageConstants.SUBMITTED_ORDER, JSON.stringify(submittedOrder));
|
||||||
|
|
||||||
|
let persistedBailout = null;
|
||||||
|
if (pSubmitType === submitType.BAILOUT) {
|
||||||
|
persistedBailout = this.pageData(issPageValues.BAILOUT_PAGE);
|
||||||
|
}
|
||||||
// clear vuex
|
// clear vuex
|
||||||
this.resetState();
|
this.resetState();
|
||||||
|
|
||||||
|
if (persistedBailout) {
|
||||||
|
this.updatePageData({
|
||||||
|
page: issPageValues.BAILOUT_PAGE,
|
||||||
|
data: persistedBailout
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// delete cookie
|
// delete cookie
|
||||||
deleteISSCookie();
|
deleteISSCookie();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue