From 0a631a6dc46dc3f32613a686fcc8bb7e87fc6fbc Mon Sep 17 00:00:00 2001 From: Jeremy-Z Date: Fri, 10 Apr 2026 11:41:33 -0400 Subject: [PATCH 1/7] Initial updates. --- src/mixins/analytics-mixin.js | 251 ++++++++++++++++++++++++++++++++++ src/router/index.js | 3 + 2 files changed, 254 insertions(+) diff --git a/src/mixins/analytics-mixin.js b/src/mixins/analytics-mixin.js index b619b6b4..ec213fbc 100644 --- a/src/mixins/analytics-mixin.js +++ b/src/mixins/analytics-mixin.js @@ -24,6 +24,7 @@ import { getCartTotal, getSubtotal } from '@/helpers/cart-helper'; import { getRecalPartNumbers } from "@/helpers/recal-helper"; import coverageStatuses from '@/constants/coverage-statuses'; import coverageType from '@/constants/coverage-type'; +import { AppointmentTypeStrings } from '@/constants/schedule-constants'; import issPageValues from '@/router/router-constants/issPage-values'; import { useMainStore } from '@/store'; @@ -140,6 +141,256 @@ export default { this.pushGenericObjectToGA(gaServiceType); } }, + + pushOrderToDataLayer() { + // helper check for if an object is defined (but maybe falsey) + const isDefined = (x) => x !== null && x !== undefined; + const store = useMainStore(); + + // Get correct order object + const hasSubmittedOrder = store.hasSubmittedOrder(); + const submittedOrder = store.getSubmittedOrder(); + const order = hasSubmittedOrder ? submittedOrder : store.order; + + // Begin assembling payload for data layer + const payload = {}; + + // Service Zip + if ( + order.serviceLocation.appointmentType === AppointmentTypeStrings.MOBILE && + isDefined(order.serviceLocation.zipCode) + ) { + payload.serviceZipCode = order.serviceLocation.zipCode; + } else if ( + isDefined(order.serviceLocation.appointmentType) && + order.serviceLocation.appointmentType !== AppointmentTypeStrings.MOBILE && + isDefined(order.serviceLocation.provider.address.zipCode) + ) { + payload.serviceZipCode = order.serviceLocation.provider.address.zipCode; + } else { + payload.serviceZipCode = ""; + } + + // Damage Type + if (isDefined(order.damage.isRepair)) { + payload.damageType = order.damage.isRepair ? "repair" : "replace"; + } else { + payload.damageType = ""; + } + + // Account Type + if (isDefined(order.payment.isInsurance)) { + payload.accountType = order.payment.isInsurance ? "insurance" : "cash"; + } else { + payload.accountType = ""; + } + + // Promo Codes + const promos = order.lineItems.promos ?? []; + if (promos.length === 0) { + payload.promoCodes = ""; + } else { + const promoCodes = promos.map((promo) => promo.promoCode); + const promoString = promoCodes.reduce((prev, next) => `${prev},${next}`); + payload.promoCodes = promoString; + } + + // Vehicle info + if (isDefined(order.vehicle.year)) { + // Ensure cast to string. + payload.vehicleYear = `${order.vehicle.year}`; + } else { + payload.vehicleYear = ""; + } + + if (isDefined(order.vehicle.make)) { + payload.vehicleMake = order.vehicle.make; + } else { + payload.vehicleMake = ""; + } + + if (isDefined(order.vehicle.model)) { + payload.vehicleModel = order.vehicle.model; + } else { + payload.vehicleModel = ""; + } + + if (isDefined(order.vehicle.style)) { + payload.vehicleStyle = order.vehicle.style; + } else { + payload.vehicleStyle = ""; + } + + // Glass pieces + const glass = order.damage.glassToReplace ?? []; + if (glass.length === 0) { + payload.glassToReplace = ""; + } else { + const glassNames = glass.map((g) => `${g.glassLocation}/${g.glassName}`); + const glassString = glassNames.reduce((prev, next) => `${prev},${next}`); + + payload.glassToReplace = glassString; + } + + //EON + if (order.eon) { + payload.eon = order.eon; + } else { + payload.eon = ""; + } + + // Work Order Id + if (order.workOrderId) { + const parsedId = parseInt(order.workOrderId); + if (!isNaN(parsedId)) { + payload.workOrderId = parsedId; + } else { + payload.workOrderId = ""; + } + } else { + payload.workOrderId = ""; + } + + // Provider Ctu + if (isDefined(order.serviceLocation.zipCodeCtu)) { + payload.providerCtu = order.serviceLocation.zipCodeCtu; + } else { + payload.providerCtu = ""; + } + + // Work Order Number + if (order.workOrderNumber) { + payload.orderNumber = order.workOrderNumber; + } else { + payload.orderNumber = ""; + } + + // Pricing + // Only fire for completed orders? + + const lineItems = order.lineItems ?? {}; + const combinedLineItems = [ + ...(lineItems.glassParts ?? []), + ...(lineItems.supportingItems ?? []), + ...(lineItems.vaps ?? []), + ...(lineItems.promos ?? []), + ]; + + const isPricingAvailable = + combinedLineItems.length > 0 && + combinedLineItems.every( + (lineItem) => + isDefined(lineItem.kitPrice) && + isDefined(lineItem.laborAmount) && + isDefined(lineItem.sellingPrice) + ); + const isTaxAvailable = + isPricingAvailable && + combinedLineItems.every((lineItem) => isDefined(lineItem.salesTax)); + + //unverified (in scenarios we don’t display the price) + if ( + order.payment.isInsurance && + isDefined(order.payment.insuranceCoverage.isVerified) && + !order.payment.insuranceCoverage.isVerified + ) { + payload.priceSubTotal = ""; + } + //deductible (in scenarios we don’t display the price) + // TODO: Need to redo this for ISS 2.0 + else if ( + order.payment.isInsurance && + isDefined(order.payment.insuranceCoverage.isVerified) && + order.payment.insuranceCoverage.isVerified && + isDefined(order.policy.currentDeductible) && + order.policy.currentDeductible >= 0 && + !order.policy.isItac && + !order.policy.isNoComp + ) { + payload.priceSubTotal = ""; + } else if (isPricingAvailable) { + const subtotal = getSubtotal(order).toFixed(2); + + payload.priceSubTotal = parseFloat(subtotal); + } else { + payload.priceSubTotal = ""; + } + + // Cash Quote or Cash Price Sub Total + payload.cashPriceSubTotal = order?.cashPriceSubTotal ?? ""; + + //unverified (in scenarios we don’t display the price) + if ( + order.payment.isInsurance && + isDefined(order.payment.insuranceCoverage.isVerified) && + !order.payment.insuranceCoverage.isVerified + ) { + payload.priceTotal = ""; + } + //deductible (in scenarios we don’t display the price) + else if ( + order.payment.isInsurance && + isDefined(order.payment.insuranceCoverage.isVerified) && + order.payment.insuranceCoverage.isVerified && + isDefined(order.policy.currentDeductible) && + order.policy.currentDeductible >= 0 && + !order.policy.isItac && + !order.policy.isNoComp + ) { + payload.priceTotal = ""; + } else if (isTaxAvailable) { + const total = getCartTotal(order).toFixed(2); + + payload.priceTotal = parseFloat(total); + } else { + payload.priceTotal = ""; + } + + // Recalibration + // TODO: Find equivalent ISS methods. + if (hasSubmittedOrder) { + payload.isRecalibrationOnOrder = store.getters.isRecalibrationOnSubmittedState; + } else { + payload.isRecalibrationOnOrder = store.getters.isRecalibrationOnOrder; + } + + // Appointment Type + if (isDefined(order.serviceLocation.appointmentType)) { + payload.appointmentType = order.serviceLocation.appointmentType; + } else { + payload.appointmentType = ""; + } + //Insurance + // TODO: Find equivalent ISS methods. + if (order.payment.isInsurance) { + payload.isInsuranceVerified = order.payment.insuranceCoverage.isVerified ?? ""; + payload.insuranceCompanyName = order.policy.insuranceCompanyName ?? ""; + if (!order.payment.insuranceCoverage.isVerified) { + payload.isInsuranceItac = ""; + payload.isInsuranceNoComp = ""; + } else { + payload.isInsuranceItac = order.policy.isItac ?? ""; + payload.isInsuranceNoComp = order.policy.isNoComp ?? ""; + } + if ( + order.policy.isItac || + order.policy.isNoComp || + !order.payment.insuranceCoverage.isVerified + ) { + payload.insuranceDeductible = ""; + } else { + payload.insuranceDeductible = order.policy.currentDeductible ?? ""; + } + } else { + payload.isInsuranceVerified = ""; + payload.insuranceDeductible = ""; + payload.isInsuranceItac = ""; + payload.isInsuranceNoComp = ""; + payload.insuranceCompanyName = ""; + } + + pushToDataLayerIfDefined(payload); + }, pushExperimentsToDataLayer() { const { experiments } = useMainStore().applicationUser; diff --git a/src/router/index.js b/src/router/index.js index eeca615e..4fd5306e 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -192,6 +192,9 @@ router.afterEach(async (to, from) => { // Push values to GA analyticsMixin.methods.pushValueToGA(); + + // Push current order status to Data Layer + analyticsMixin.methods.pushOrderToDataLayer(); } }); From 4ddd961d18cd5454dad2a4f23ee56d14a77336e9 Mon Sep 17 00:00:00 2001 From: Jeremy-Z Date: Fri, 10 Apr 2026 12:12:09 -0400 Subject: [PATCH 2/7] Updates on some of the logic. --- src/mixins/analytics-mixin.js | 87 +++++++++++++---------------------- 1 file changed, 31 insertions(+), 56 deletions(-) diff --git a/src/mixins/analytics-mixin.js b/src/mixins/analytics-mixin.js index ec213fbc..25e06531 100644 --- a/src/mixins/analytics-mixin.js +++ b/src/mixins/analytics-mixin.js @@ -178,12 +178,8 @@ export default { payload.damageType = ""; } - // Account Type - if (isDefined(order.payment.isInsurance)) { - payload.accountType = order.payment.isInsurance ? "insurance" : "cash"; - } else { - payload.accountType = ""; - } + // Account Type - always insurance for ISS + payload.accountType = "insurance"; // Promo Codes const promos = order.lineItems.promos ?? []; @@ -289,23 +285,16 @@ export default { combinedLineItems.every((lineItem) => isDefined(lineItem.salesTax)); //unverified (in scenarios we don’t display the price) - if ( - order.payment.isInsurance && - isDefined(order.payment.insuranceCoverage.isVerified) && - !order.payment.insuranceCoverage.isVerified - ) { + if (!store.isVerified) { payload.priceSubTotal = ""; } //deductible (in scenarios we don’t display the price) // TODO: Need to redo this for ISS 2.0 else if ( - order.payment.isInsurance && - isDefined(order.payment.insuranceCoverage.isVerified) && - order.payment.insuranceCoverage.isVerified && - isDefined(order.policy.currentDeductible) && - order.policy.currentDeductible >= 0 && - !order.policy.isItac && - !order.policy.isNoComp + store.isVerified && + store.currentDeductible >= 0 && + !store.isItac && + !store.isNoComp ) { payload.priceSubTotal = ""; } else if (isPricingAvailable) { @@ -317,25 +306,18 @@ export default { } // Cash Quote or Cash Price Sub Total - payload.cashPriceSubTotal = order?.cashPriceSubTotal ?? ""; + payload.cashPriceSubTotal = getSubtotal(order).toString(); //unverified (in scenarios we don’t display the price) - if ( - order.payment.isInsurance && - isDefined(order.payment.insuranceCoverage.isVerified) && - !order.payment.insuranceCoverage.isVerified - ) { + if (!store.isVerified) { payload.priceTotal = ""; } //deductible (in scenarios we don’t display the price) else if ( - order.payment.isInsurance && - isDefined(order.payment.insuranceCoverage.isVerified) && - order.payment.insuranceCoverage.isVerified && - isDefined(order.policy.currentDeductible) && - order.policy.currentDeductible >= 0 && - !order.policy.isItac && - !order.policy.isNoComp + store.isVerified && + store.currentDeductible >= 0 && + !store.isItac && + !store.isNoComp ) { payload.priceTotal = ""; } else if (isTaxAvailable) { @@ -351,7 +333,7 @@ export default { if (hasSubmittedOrder) { payload.isRecalibrationOnOrder = store.getters.isRecalibrationOnSubmittedState; } else { - payload.isRecalibrationOnOrder = store.getters.isRecalibrationOnOrder; + payload.isRecalibrationOnOrder = store.hasRecalibrationPart && containsRecalParts(order.lineItems); } // Appointment Type @@ -360,33 +342,26 @@ export default { } else { payload.appointmentType = ""; } + //Insurance - // TODO: Find equivalent ISS methods. - if (order.payment.isInsurance) { - payload.isInsuranceVerified = order.payment.insuranceCoverage.isVerified ?? ""; - payload.insuranceCompanyName = order.policy.insuranceCompanyName ?? ""; - if (!order.payment.insuranceCoverage.isVerified) { - payload.isInsuranceItac = ""; - payload.isInsuranceNoComp = ""; - } else { - payload.isInsuranceItac = order.policy.isItac ?? ""; - payload.isInsuranceNoComp = order.policy.isNoComp ?? ""; - } - if ( - order.policy.isItac || - order.policy.isNoComp || - !order.payment.insuranceCoverage.isVerified - ) { - payload.insuranceDeductible = ""; - } else { - payload.insuranceDeductible = order.policy.currentDeductible ?? ""; - } - } else { - payload.isInsuranceVerified = ""; - payload.insuranceDeductible = ""; + // TODO: Find equivalent ISS methods. Using store atm need to run off order object. + payload.isInsuranceVerified = store.isVerified; + payload.insuranceCompanyName = store.issConfig.clientName ?? ""; + if (!store.isVerified) { payload.isInsuranceItac = ""; payload.isInsuranceNoComp = ""; - payload.insuranceCompanyName = ""; + } else { + payload.isInsuranceItac = store.isItac ?? ""; + payload.isInsuranceNoComp = store.isNoComp ?? ""; + } + if ( + store.isItac || + store.isNoComp || + !store.isVerified + ) { + payload.insuranceDeductible = ""; + } else { + payload.insuranceDeductible = store.currentDeductible ?? ""; } pushToDataLayerIfDefined(payload); From 7125e1fa97ecc12486d03b4f256a10026ef06e07 Mon Sep 17 00:00:00 2001 From: Jeremy-Z Date: Fri, 10 Apr 2026 14:47:14 -0400 Subject: [PATCH 3/7] Added more fields. --- src/mixins/analytics-mixin.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/mixins/analytics-mixin.js b/src/mixins/analytics-mixin.js index 25e06531..08c1a6e0 100644 --- a/src/mixins/analytics-mixin.js +++ b/src/mixins/analytics-mixin.js @@ -129,11 +129,6 @@ export default { }, pushValueToGA() { - const gaSiteType = { - ['siteType']: useMainStore().issConfig.siteType - }; - this.pushGenericObjectToGA(gaSiteType); - const gaServiceType = { ['service_type']: useMainStore().order?.serviceLocation?.appointmentType?.toLowerCase() }; @@ -155,6 +150,10 @@ export default { // Begin assembling payload for data layer const payload = {}; + payload.appName = "ISS"; + payload.siteType = store.issConfig.siteType; + payload.pageName = this.getPageNameByQueryString(); + // Service Zip if ( order.serviceLocation.appointmentType === AppointmentTypeStrings.MOBILE && From 2754f7be9c875b43cc135c4d61be5b5be540133a Mon Sep 17 00:00:00 2001 From: Jeremy-Z Date: Fri, 10 Apr 2026 15:20:14 -0400 Subject: [PATCH 4/7] Some additional fields. --- src/mixins/analytics-mixin.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/mixins/analytics-mixin.js b/src/mixins/analytics-mixin.js index 08c1a6e0..b1d7d8cf 100644 --- a/src/mixins/analytics-mixin.js +++ b/src/mixins/analytics-mixin.js @@ -146,6 +146,8 @@ export default { const hasSubmittedOrder = store.hasSubmittedOrder(); const submittedOrder = store.getSubmittedOrder(); const order = hasSubmittedOrder ? submittedOrder : store.order; + const deviceId = getDeviceIdValue(); + const sid = getSessionIdValue(); // Begin assembling payload for data layer const payload = {}; @@ -153,7 +155,11 @@ export default { payload.appName = "ISS"; payload.siteType = store.issConfig.siteType; payload.pageName = this.getPageNameByQueryString(); - + payload.deviceId = deviceId; + payload.sessionId = sid; + payload.clientName = store.issConfig.clientName; + payload.lossCause = order.policy?.damageCause ?? ""; + // Service Zip if ( order.serviceLocation.appointmentType === AppointmentTypeStrings.MOBILE && From 5eb4ef0418bae67e24bb1d8f3c3b80917d97d9a1 Mon Sep 17 00:00:00 2001 From: Jeremy-Z Date: Mon, 13 Apr 2026 10:25:48 -0400 Subject: [PATCH 5/7] Moved some common methods around. --- src/helpers/object-helper.js | 14 ++++++++ src/helpers/recal-helper.js | 27 +++++++++++++- src/mixins/analytics-mixin.js | 68 ++++++----------------------------- src/store/index.js | 40 +++------------------ 4 files changed, 56 insertions(+), 93 deletions(-) diff --git a/src/helpers/object-helper.js b/src/helpers/object-helper.js index 37ee46be..e142c236 100644 --- a/src/helpers/object-helper.js +++ b/src/helpers/object-helper.js @@ -86,3 +86,17 @@ export function getPropertyCaseInsensitive(obj, property) { while (prop = props.pop()) if (prop.toLowerCase() === property.toLowerCase()) return prop; return null; } + +export function getNonFalseValuesOfPropertyInArrayOfObjects(array, propertyName) { + return (array ?? []).map((x) => x[propertyName]).filter((x) => x); +} + +export function sortArrayOfObjectsByPropertyValue(arrayOfObjects, propertyName) { + if (!arrayOfObjects) return null; + + return arrayOfObjects.sort((a, b) => { + if (a[propertyName] < b[propertyName]) return -1; + if (a[propertyName] > b[propertyName]) return 1; + return 0; + }); +} diff --git a/src/helpers/recal-helper.js b/src/helpers/recal-helper.js index f364bf68..029aee25 100644 --- a/src/helpers/recal-helper.js +++ b/src/helpers/recal-helper.js @@ -1,5 +1,5 @@ import partTypeStrings from '@/constants/part-type-strings'; -import { deepClone } from '@/helpers/object-helper'; +import { deepClone, getNonFalseValuesOfPropertyInArrayOfObjects } from '@/helpers/object-helper'; const recalPartTypes = [partTypeStrings.RECALIBRATION, partTypeStrings.ADAS_RECALIBRATION]; @@ -73,6 +73,31 @@ export function containsRecalParts(lineItems) { } } +export function isRecalOrder(lineItems) { + return (containsRecalParts(lineItems) && getHasRecalibrationPart(lineItems)); +} + +export function getHasRecalibrationPart(lineItems) { + const hasRequiresRecalibration = getNonFalseValuesOfPropertyInArrayOfObjects(lineItems.glassParts, 'requiresRecalibration')?.length > 0; + const hasRecalibrationType = getNonFalseValuesOfPropertyInArrayOfObjects(lineItems.glassParts, 'recalibrationType')?.length > 0; + + if (hasRequiresRecalibration) { + if (hasRecalibrationType) { + // Has both 'requiresRecalibration' and 'recalibrationType' and 'recalibrationType' + return ( + getNonFalseValuesOfPropertyInArrayOfObjects( + lineItems.glassParts, + 'recalibrationType' + )[0].toLowerCase() !== 'unknown' + ); + } + // Has 'requiresRecalibration' but no 'recalibrationType' at all + return true; + } + // Does not have 'requiresRecalibration' + return false; +} + export function anyPartWithRequiresRecalFlag(lineItems) { if (!lineItems) { return false; diff --git a/src/mixins/analytics-mixin.js b/src/mixins/analytics-mixin.js index b1d7d8cf..4827a559 100644 --- a/src/mixins/analytics-mixin.js +++ b/src/mixins/analytics-mixin.js @@ -21,7 +21,7 @@ import { ValueToLogTypes } from '@/constants/analytics'; import { getCartTotal, getSubtotal } from '@/helpers/cart-helper'; -import { getRecalPartNumbers } from "@/helpers/recal-helper"; +import { getRecalPartNumbers, isRecalOrder } from "@/helpers/recal-helper"; import coverageStatuses from '@/constants/coverage-statuses'; import coverageType from '@/constants/coverage-type'; import { AppointmentTypeStrings } from '@/constants/schedule-constants'; @@ -266,35 +266,12 @@ export default { payload.orderNumber = ""; } - // Pricing - // Only fire for completed orders? - - const lineItems = order.lineItems ?? {}; - const combinedLineItems = [ - ...(lineItems.glassParts ?? []), - ...(lineItems.supportingItems ?? []), - ...(lineItems.vaps ?? []), - ...(lineItems.promos ?? []), - ]; - - const isPricingAvailable = - combinedLineItems.length > 0 && - combinedLineItems.every( - (lineItem) => - isDefined(lineItem.kitPrice) && - isDefined(lineItem.laborAmount) && - isDefined(lineItem.sellingPrice) - ); - const isTaxAvailable = - isPricingAvailable && - combinedLineItems.every((lineItem) => isDefined(lineItem.salesTax)); - - //unverified (in scenarios we don’t display the price) + // Unverified (no price or deductible displayed) if (!store.isVerified) { payload.priceSubTotal = ""; + payload.priceTotal = ""; } - //deductible (in scenarios we don’t display the price) - // TODO: Need to redo this for ISS 2.0 + // Deductible case (no price is displayed, only deductible) else if ( store.isVerified && store.currentDeductible >= 0 && @@ -302,44 +279,23 @@ export default { !store.isNoComp ) { payload.priceSubTotal = ""; - } else if (isPricingAvailable) { + payload.priceTotal = ""; + // ITAC or NoComp (where cash price is shown) + } else if (store.isVerified && (store.isItac || store.isNoComp)) { const subtotal = getSubtotal(order).toFixed(2); - payload.priceSubTotal = parseFloat(subtotal); + const total = getCartTotal(order).toFixed(2); + payload.priceTotal = parseFloat(total); } else { payload.priceSubTotal = ""; + payload.priceTotal = ""; } // Cash Quote or Cash Price Sub Total payload.cashPriceSubTotal = getSubtotal(order).toString(); - //unverified (in scenarios we don’t display the price) - if (!store.isVerified) { - payload.priceTotal = ""; - } - //deductible (in scenarios we don’t display the price) - else if ( - store.isVerified && - store.currentDeductible >= 0 && - !store.isItac && - !store.isNoComp - ) { - payload.priceTotal = ""; - } else if (isTaxAvailable) { - const total = getCartTotal(order).toFixed(2); - - payload.priceTotal = parseFloat(total); - } else { - payload.priceTotal = ""; - } - // Recalibration - // TODO: Find equivalent ISS methods. - if (hasSubmittedOrder) { - payload.isRecalibrationOnOrder = store.getters.isRecalibrationOnSubmittedState; - } else { - payload.isRecalibrationOnOrder = store.hasRecalibrationPart && containsRecalParts(order.lineItems); - } + payload.isRecalibrationOnOrder = isRecalOrder(order.lineItems); // Appointment Type if (isDefined(order.serviceLocation.appointmentType)) { @@ -348,8 +304,6 @@ export default { payload.appointmentType = ""; } - //Insurance - // TODO: Find equivalent ISS methods. Using store atm need to run off order object. payload.isInsuranceVerified = store.isVerified; payload.insuranceCompanyName = store.issConfig.clientName ?? ""; if (!store.isVerified) { diff --git a/src/store/index.js b/src/store/index.js index db5894c6..a4689af7 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -22,11 +22,12 @@ import { repairWaivedForSelectedVehicle } from '@/helpers/policy-vehicle-helper'; import { buildURLSearchParams, getPartNumbersListForQueryString } from '@/helpers/querystring-helper'; -import { getRecalPartNumbers, getTopLevelGlassPartsWithRecal } from '@/helpers/recal-helper'; +import { getRecalPartNumbers, getTopLevelGlassPartsWithRecal, getHasRecalibrationPart } from '@/helpers/recal-helper'; import { getDateForSavedSessionTimeout } from '@/helpers/session-helper'; import { isMobileDevice } from '@/helpers/useragent-helper'; import issPageValues from '@/router/router-constants/issPage-values'; import CoverageStatuses from '@/constants/coverage-statuses'; +import { getNonFalseValuesOfPropertyInArrayOfObjects, sortArrayOfObjectsByPropertyValue } from '@/helpers/object-helper'; const storeId = 'main'; @@ -276,7 +277,7 @@ export const useMainStore = defineStore({ state: () => state, getters: { billToAccountNumber: (storeState) => storeState.issConfig.billToAccountNumber, - hasRecalibrationPart: (storeState) => getHasRecalibrationPart(storeState), + hasRecalibrationPart: (storeState) => getHasRecalibrationPartOnOrder(storeState), vehicle: (storeState) => storeState.order.vehicle, damage: (storeState) => storeState.order.damage, lineItems: (state) => state.order.lineItems, @@ -3179,39 +3180,8 @@ export const useMainStore = defineStore({ // Private Functions -function getHasRecalibrationPart(state) { - const hasRequiresRecalibration = getNonFalseValuesOfPropertyInArrayOfObjects(state.order.lineItems.glassParts, 'requiresRecalibration')?.length > 0; - const hasRecalibrationType = getNonFalseValuesOfPropertyInArrayOfObjects(state.order.lineItems.glassParts, 'recalibrationType')?.length > 0; - - if (hasRequiresRecalibration) { - if (hasRecalibrationType) { - // Has both 'requiresRecalibration' and 'recalibrationType' and 'recalibrationType' - return ( - getNonFalseValuesOfPropertyInArrayOfObjects( - state.order.lineItems.glassParts, - 'recalibrationType' - )[0].toLowerCase() !== 'unknown' - ); - } - // Has 'requiresRecalibration' but no 'recalibrationType' at all - return true; - } - // Does not have 'requiresRecalibration' - return false; -} - -function getNonFalseValuesOfPropertyInArrayOfObjects(array, propertyName) { - return (array ?? []).map((x) => x[propertyName]).filter((x) => x); -} - -function sortArrayOfObjectsByPropertyValue(arrayOfObjects, propertyName) { - if (!arrayOfObjects) return null; - - return arrayOfObjects.sort((a, b) => { - if (a[propertyName] < b[propertyName]) return -1; - if (a[propertyName] > b[propertyName]) return 1; - return 0; - }); +function getHasRecalibrationPartOnOrder(state) { + return getHasRecalibrationPart(state.order.lineItems); } function convertGlassPieceNamingForApi(glassArray) { From c17c57dbedf305f45436e7ce71af43fd0000465c Mon Sep 17 00:00:00 2001 From: Jeremy-Z Date: Mon, 13 Apr 2026 12:13:22 -0400 Subject: [PATCH 6/7] ITAC method call fix. --- src/mixins/analytics-mixin.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/mixins/analytics-mixin.js b/src/mixins/analytics-mixin.js index 4827a559..e35d1319 100644 --- a/src/mixins/analytics-mixin.js +++ b/src/mixins/analytics-mixin.js @@ -275,13 +275,13 @@ export default { else if ( store.isVerified && store.currentDeductible >= 0 && - !store.isItac && + !store.isITAC && !store.isNoComp ) { payload.priceSubTotal = ""; payload.priceTotal = ""; // ITAC or NoComp (where cash price is shown) - } else if (store.isVerified && (store.isItac || store.isNoComp)) { + } else if (store.isVerified && (store.isITAC || store.isNoComp)) { const subtotal = getSubtotal(order).toFixed(2); payload.priceSubTotal = parseFloat(subtotal); const total = getCartTotal(order).toFixed(2); @@ -310,11 +310,11 @@ export default { payload.isInsuranceItac = ""; payload.isInsuranceNoComp = ""; } else { - payload.isInsuranceItac = store.isItac ?? ""; + payload.isInsuranceItac = store.isITAC ?? ""; payload.isInsuranceNoComp = store.isNoComp ?? ""; } if ( - store.isItac || + store.isITAC || store.isNoComp || !store.isVerified ) { @@ -530,7 +530,7 @@ export default { sessionData.coverageSubStatus = coverageType.mapToApi(order?.insuranceCoverage.coverageType); sessionData.isNoComp = store.isNoComp; - sessionData.isItac = store.isITAC; + sessionData.isItac = store.isITAC; sessionData.subTotalPrice = getSubtotal(order).toString(); sessionData.totalPrice = getCartTotal(order).toString(); sessionData.cashPriceSubTotal = getSubtotal(order).toString(); From 3c3e16667134ad179b70d94330229ebefb76bc0a Mon Sep 17 00:00:00 2001 From: Jeremy-Z Date: Mon, 13 Apr 2026 12:17:05 -0400 Subject: [PATCH 7/7] Enforcement check. --- src/mixins/analytics-mixin.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mixins/analytics-mixin.js b/src/mixins/analytics-mixin.js index e35d1319..81d63e41 100644 --- a/src/mixins/analytics-mixin.js +++ b/src/mixins/analytics-mixin.js @@ -274,7 +274,7 @@ export default { // Deductible case (no price is displayed, only deductible) else if ( store.isVerified && - store.currentDeductible >= 0 && + (typeof store.currentDeductible === 'number' && store.currentDeductible >= 0) && !store.isITAC && !store.isNoComp ) {