Merge pull request #1187 from Safelite/feature/kroell/INSR-8910

INSR-8910: pass endorsement values to SaveSession call
This commit is contained in:
katiekroell 2026-04-20 14:45:51 -04:00 committed by GitHub
commit b3b3c21d1c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 41 additions and 6 deletions

View file

@ -0,0 +1,6 @@
const endorsementCodes_LibertyMutual = Object.freeze({
EDUCATOR: '001',
PARKING_GUARD: '003'
});
export default endorsementCodes_LibertyMutual;

View file

@ -1,4 +1,5 @@
import endorsementOptions from '@/constants/endorsement-options';
import endorsementCodes_LibertyMutual from '@/constants/endorsement-codes';
export function noCoverageForSelectedVehicle(vehicle) {
return (vehicle?.coverages?.length ?? 0) === 0;
@ -18,6 +19,20 @@ export function endorsementsForSelectedVehicle(vehicle) {
}
return [];
}
export function endorsementCodesForSelectedVehicle(vehicle) {
if (!Array.isArray(vehicle?.endorsements) || vehicle.endorsements.length === 0) {
return '';
}
let codes = [];
if (vehicle.endorsements.includes(endorsementOptions.EDUCATOR)) {
codes.push(endorsementCodes_LibertyMutual.EDUCATOR);
}
if (vehicle.endorsements.includes(endorsementOptions.PARKING_GUARD)) {
codes.push(endorsementCodes_LibertyMutual.PARKING_GUARD);
}
return codes.join(',');
}
export function repairWaivedForSelectedVehicle(vehicle) {
return vehicle?.endorsements?.includes(endorsementOptions.REPAIR_WAIVED) ?? false;
}

View file

@ -125,7 +125,8 @@ describe('policy-vehicles.vue', () => {
noCoverage: true,
deductible: 0,
repairWaived: false,
endorsements: []
endorsements: [],
cvrgEndorsementCode: ""
};
// Act
@ -180,7 +181,8 @@ describe('policy-vehicles.vue', () => {
noCoverage: true,
deductible: 0,
repairWaived: false,
endorsements
endorsements,
cvrgEndorsementCode: "001"
};
// Act
@ -233,7 +235,8 @@ describe('policy-vehicles.vue', () => {
noCoverage: true,
deductible: 0,
repairWaived: false,
endorsements
endorsements,
cvrgEndorsementCode: "003"
};
// Act

View file

@ -55,6 +55,7 @@ import { useMainStore } from '@/store/index.js';
import {
deductibleForSelectedVehicle,
endorsementsForSelectedVehicle,
endorsementCodesForSelectedVehicle,
noCoverageForSelectedVehicle,
repairWaivedForSelectedVehicle
} from '@/helpers/policy-vehicle-helper';
@ -132,6 +133,9 @@ export default {
endorsementsForSelectedVehicle() {
return endorsementsForSelectedVehicle(this.selectedPolicyVehicle);
},
endorsementCodesForSelectedVehicle() {
return endorsementCodesForSelectedVehicle(this.selectedPolicyVehicle);
},
repairWaivedForSelectedVehicle() {
return repairWaivedForSelectedVehicle(this.selectedPolicyVehicle);
}
@ -201,7 +205,8 @@ export default {
noCoverage: this.noCoverageForSelectedVehicle,
deductible: this.deductibleForSelectedVehicle,
repairWaived: this.repairWaivedForSelectedVehicle,
endorsements: this.endorsementsForSelectedVehicle
endorsements: this.endorsementsForSelectedVehicle,
cvrgEndorsementCode: this.endorsementCodesForSelectedVehicle
});
this.navigateForward();
} catch (e) {

View file

@ -4,6 +4,7 @@ import bailoutCode from '@/constants/bailoutCode';
import coverageStatuses from '@/constants/coverage-statuses';
import coverageType from '@/constants/coverage-type';
import damageLocationsSelected from '@/constants/damage-locations-selected';
import endorsementOptions from '@/constants/endorsement-options';
import endpoints from '@/constants/endpoints';
import { experimentSettings, experimentTriggers, experimentUniverses } from '@/constants/experiments';
import partNumberStrings from '@/constants/part-number-strings';
@ -17,7 +18,7 @@ import { convertDateStringToDate, getDateDifferenceInDays, militaryToTwelveHourT
import { getExperimentSettingValue, getFeatureTogglesPayloadObject } from '@/helpers/experiment-helper';
import { findLineItemIndex, getLineItemsFlattened } from '@/helpers/line-items-helper';
import {
deductibleForSelectedVehicle, endorsementsForSelectedVehicle,
deductibleForSelectedVehicle, endorsementsForSelectedVehicle, endorsementCodesForSelectedVehicle,
noCoverageForSelectedVehicle,
repairWaivedForSelectedVehicle
} from '@/helpers/policy-vehicle-helper';
@ -109,6 +110,7 @@ export const getDefaultState = () => ({
vehicles: [],
endorsements: [],
endorsementQuestionAnswers: [],
cvrgEndorsementCode: null,
status: null,
policyData: null
},
@ -1469,7 +1471,9 @@ export const useMainStore = defineStore({
currentDeductible: this.currentDeductible,
OemEndorsement: this.hasOemEndorsement,
noCoverage: this.isNoComp,
isItac: this.isITAC
isItac: this.isITAC,
cvrgEndorsementCode: policy.cvrgEndorsementCode ?? endorsementCodesForSelectedVehicle(vehicle),
endorsementQuestionAnswers: policy.endorsementQuestionAnswers
},
customer: {
address: {
@ -2071,6 +2075,7 @@ export const useMainStore = defineStore({
this.order.policy.deductible.replace = coverage.deductible;
this.order.policy.deductible.repair = coverage?.repairWaived ?? false ? 0 : coverage.deductible;
this.order.policy.endorsements = coverage?.endorsements;
this.order.policy.cvrgEndorsementCode = coverage?.cvrgEndorsementCode;
this.order.originalDeductible.replace = this.order.policy.deductible.replace;
this.order.currentDeductible.replace = this.order.policy.deductible.replace;
@ -2112,6 +2117,7 @@ export const useMainStore = defineStore({
this.order.policy.vehicles = [];
this.order.policy.endorsements = [];
this.order.policy.endorsementQuestionAnswers = [];
this.order.policy.cvrgEndorsementCode = null;
this.order.policy.policyData = null;
this.order.policy.deductible.repair = null;
this.order.policy.deductible.replace = null;