Merge remote-tracking branch 'origin/develop' into feature/skiener/INSR-2124

This commit is contained in:
scottkiener-at-safelite 2026-04-03 12:24:15 -04:00
commit b2dfe2fef9
4 changed files with 39 additions and 5 deletions

View file

@ -11,7 +11,7 @@ export function isRecalPartOrHasChildRecalPart(glassPart) {
const isGlassPartRecalPart = isRecalPart(glassPart); const isGlassPartRecalPart = isRecalPart(glassPart);
if (!isGlassPartRecalPart && glassPart.childParts && glassPart.childParts.length > 0) { if (!isGlassPartRecalPart && glassPart.childParts && glassPart.childParts.length > 0) {
return glassPart.childParts.filter((cp) => isRecalPartOrHasChildRecalPart(cp)); return glassPart.childParts.some((cp) => isRecalPartOrHasChildRecalPart(cp));
} }
return isGlassPartRecalPart; return isGlassPartRecalPart;
@ -52,3 +52,24 @@ export function getRecalPartNumbers(glassPartsArray) {
} }
} }
export function containsRecalParts(lineItems) {
if (!lineItems) {
return false;
}
if (Array.isArray(lineItems)) {
return lineItems.some((li) => isRecalPartOrHasChildRecalPart(li));
} else {
// complex object form -- flatten and re-call.
const flattened = [
...(lineItems.glassParts ?? []),
...(lineItems.supportingItems ?? []),
...(lineItems.otherParts ?? []),
...(lineItems.feeItems ?? []),
...(lineItems.vaps ?? []),
];
return flattened.some((li) => isRecalPartOrHasChildRecalPart(li));
}
}

View file

@ -32,6 +32,12 @@ jest.mock('@/helpers/text-helper', () => ({
formatAmountInDollars: jest.fn() formatAmountInDollars: jest.fn()
})); }));
jest.mock('@/helpers/recal-helper.js', () => ({
containsRecalParts: jest.fn()
}));
import { containsRecalParts } from '@/helpers/recal-helper.js';
const SAFELITE_PROVIDER = 'Safelite'; const SAFELITE_PROVIDER = 'Safelite';
const CANCEL_CLAIM_REF_NAME = 'CancelClaimModal'; const CANCEL_CLAIM_REF_NAME = 'CancelClaimModal';
@ -337,15 +343,17 @@ describe('coverageStatement.vue', () => {
// Assert // Assert
expect(result).toBeFalsy(); expect(result).toBeFalsy();
}); });
test('returns true when a part in glassParts require recalibration', () => { test('returns true when a part in glassParts require recalibration and recalibration has been added to order', () => {
// Arrange // Arrange
containsRecalParts.mockReturnValue(true);
const mainInitialState = { const mainInitialState = {
order: { order: {
lineItems: { lineItems: {
glassParts: [ glassParts: [
{ {
partNumber: 123, partNumber: 123,
requiresRecalibration: true requiresRecalibration: true,
partType: 'RECALIBRATION'
}, },
{ {
partNumber: 111, partNumber: 111,

View file

@ -147,6 +147,7 @@ import { getPriceOfLineItems } from '@/helpers/price-calculator';
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 oemEndorsementModal from '@/layouts/coverage-statement/oem-endorsement-modal/oem-endorsement-modal.vue'; import oemEndorsementModal from '@/layouts/coverage-statement/oem-endorsement-modal/oem-endorsement-modal.vue';
import { containsRecalParts } from '@/helpers/recal-helper';
const RECAL_MODAL_REF_NAME = 'RecalModal'; const RECAL_MODAL_REF_NAME = 'RecalModal';
const CANCEL_CLAIM_REF_NAME = 'CancelClaimModal'; const CANCEL_CLAIM_REF_NAME = 'CancelClaimModal';
@ -305,9 +306,11 @@ export default {
}, },
isADAS() { isADAS() {
const { glassParts } = useMainStore().order.lineItems; const { glassParts } = useMainStore().order.lineItems;
const orderContainsRecalPart = containsRecalParts(glassParts);
return ( return (
glassParts !== null glassParts !== null
&& !!glassParts.find((part) => part.requiresRecalibration) && !!glassParts.find((part) => part.requiresRecalibration)
&& orderContainsRecalPart
); );
}, },
totalServicePrice() { totalServicePrice() {
@ -410,7 +413,8 @@ export default {
} }
}, },
async navigateForward() { async navigateForward() {
if (this.isUnverifiedVisible || this.isDeductibleVisible) { showIssLoadingModal(true);
if (this.isUnverifiedVisible || this.isDeductibleVisible) {
this.navigateWithScenario(navigationScenarios.CLICKED_FORWARD); this.navigateWithScenario(navigationScenarios.CLICKED_FORWARD);
} else if (this.isITACQuoteVisible || this.isNoCompQuoteVisible) { } else if (this.isITACQuoteVisible || this.isNoCompQuoteVisible) {
this.mainStore.updateIsSafeliteProvider(true); this.mainStore.updateIsSafeliteProvider(true);

View file

@ -23,6 +23,7 @@ import partTypeStrings from '@/constants/part-type-strings';
import { useMainStore } from '@/store'; import { useMainStore } from '@/store';
import { getPriceOfLineItem } from '@/helpers/price-calculator'; import { getPriceOfLineItem } from '@/helpers/price-calculator';
import { shallowRef } from 'vue'; import { shallowRef } from 'vue';
import { containsRecalParts } from '@/helpers/recal-helper';
const glassLocations = damageLocationsSelected; const glassLocations = damageLocationsSelected;
@ -100,7 +101,7 @@ export default {
return modifiedAnswers; return modifiedAnswers;
}, },
isRecalibrationOnOrder() { isRecalibrationOnOrder() {
return this.mainStore.hasRecalibrationPart; return this.mainStore.hasRecalibrationPart && containsRecalParts(this.mainStore.order.lineItems);
}, },
frontWipersApplicableForTierTwo() { frontWipersApplicableForTierTwo() {
const frontWipersAreAvailable = this.lineItemsContainsPartType(partTypeStrings.FRONT_WIPER); const frontWipersAreAvailable = this.lineItemsContainsPartType(partTypeStrings.FRONT_WIPER);