INSR-8493: More robust MSR fee alert logic, fix custom copy

This commit is contained in:
Alex Humphries 2026-06-18 14:59:18 -04:00
parent 56ae9cd194
commit 6f0a6ce44c
2 changed files with 26 additions and 4 deletions

View file

@ -120,5 +120,9 @@ export function anyPartWithRequiresRecalFlag(lineItems) {
}
export function hasMSRPart(lineItems) {
return lineItems?.feeItems?.some((item) => item.partNumber === partNumberStrings.RECAL_MOBILEDUAL || item.partNumber === partNumberStrings.RECAL_MOBILE) ?? false
return lineItems?.feeItems?.some((item) => isMSRPart(item)) ?? false;
}
export function isMSRPart(part) {
return part.partNumber === partNumberStrings.RECAL_MOBILEDUAL || part.partNumber === partNumberStrings.RECAL_MOBILE;
}

View file

@ -135,7 +135,7 @@ import {
getMobileZipCodeData
} from '@/helpers/service-location-helper';
import { toTitleCase } from '@/helpers/text-helper.js';
import { isRecalOrder } from '@/helpers/recal-helper';
import { isMSRPart, isRecalOrder } from '@/helpers/recal-helper';
// Import Component
import alert from '@/ux-components/alert/alert.vue';
@ -148,6 +148,7 @@ import recalModal from '@/iss-components/recal-modal/recal-modal.vue';
import { getPricedMobileFeePart } from '@/helpers/service-location-helper';
import { processIfStatements } from '@/helpers/cms-content-helper';
import partNumberStrings from '@/constants/part-number-strings';
import { experimentSettings } from '@/constants/experiments';
const RECAL_MODAL_REF_NAME = 'RecalModal';
@ -294,11 +295,28 @@ export default {
return this.processIfStatements(bodyText, 'custom', this.getCustomValueFromString);
},
displayMSRFeeAlert() {
return this.mobileFeePart !== null && this.mobileFeePart.sellingPrice > 0 && (this.mobileFeePart.partNumber === partNumberStrings.RECAL_MOBILEDUAL || this.mobileFeePart.partNumber === partNumberStrings.RECAL_MOBILE);
if (!this.mobileFeePart || this.mobileFeePart.sellingPrice === 0 || !isMSRPart(this.mobileFeePart)) {
return false;
}
if (this.mainStore.isITAC || this.mainStore.isNoComp) {
return true;
}
const isSplitPayEnabled = this.getSettingValue(experimentSettings.MSR_SPLIT_PAY_ENABLED) === 'true';
if (!isSplitPayEnabled) {
return false;
}
if (!this.mobileFeePart.isInsurable) {
return true;
}
return false;
},
msrFeeAlertCopy() {
let content = this.getCmsContent('AlertMSRFeeWidget', widgetFields.ALERT_WIDGET.BODY_TEXT);
content = content.replace('{custom:fee}', `$${this.mobileFeePart.sellingPrice.toFixed(2)}`);
content = content.replace('{custom:mobileFee}', `${this.mobileFeePart.sellingPrice.toFixed(2)}`);
return content;
}
},