Use provider ctu if inshop or dropoff

This commit is contained in:
Bill Richardson 2024-04-29 15:02:59 -04:00
parent b88a762667
commit 43605aa3bd

View file

@ -374,52 +374,58 @@ export const useMainStore = defineStore({
duration: readableDuration duration: readableDuration
}; };
}, },
experimentOrder: (state) => ({ experimentOrder: (s) => {
funnelVehicleYear: state.order.vehicle.year, const ctuToUse = (s.order.serviceLocation.appointmentType === AppointmentTypeStrings.IN_SHOP
funnelVehicleMake: state.order.vehicle.make, || s.order.serviceLocation.appointmentType === AppointmentTypeStrings.DROP_OFF)
funnelVehicleModel: state.order.vehicle.model, ? s.order.serviceLocation.zipCodeCtu : s.order.serviceLocation.provider?.address?.zipCodeCtu;
funnelVehicleStyle: state.order.vehicle.style,
funnelIsRepair: state.order.damage.isRepair, return {
funnelNumberOfChips: state.order.damage.numberOfChips, funnelVehicleYear: s.order.vehicle.year,
funnelCarId: state.order.vehicle.carId, funnelVehicleMake: s.order.vehicle.make,
funnelServiceCity: state.order.serviceLocation.city, funnelVehicleModel: s.order.vehicle.model,
funnelServiceState: state.order.serviceLocation.state, funnelVehicleStyle: s.order.vehicle.style,
funnelServiceZipCode: state.order.serviceLocation.zipCode, funnelIsRepair: s.order.damage.isRepair,
funnelServiceZipCodeCtu: state.order.serviceLocation.zipCodeCtu, funnelNumberOfChips: s.order.damage.numberOfChips,
funnelParentAccountNumber: state.order.accountNumber, funnelCarId: s.order.vehicle.carId,
funnelProviderNumber: state.order.serviceLocation.provider.providerNumber, funnelServiceCity: s.order.serviceLocation.city,
funnelIsCoverageVerified: state.order.payment.insuranceCoverage.isVerified, funnelServices: s.order.serviceLocation.state,
funnelHasRecalibrationPart: getHasRecalibrationPart(state), funnelServiceZipCode: s.order.serviceLocation.zipCode,
funnelSelectedMultiGlass: state.order.damage.glassToReplace?.length > 1, funnelServiceZipCodeCtu: ctuToUse,
funnelSelectedWindshieldGlass: getNonFalseValuesOfPropertyInArrayOfObjects(state.order.damage.glassToReplace, 'glassLocation') funnelParentAccountNumber: s.order.accountNumber,
.includes(damageLocationsSelected.WINDSHIELD), funnelProviderNumber: s.order.serviceLocation.provider.providerNumber,
funnelSelectedBackGlass: getNonFalseValuesOfPropertyInArrayOfObjects(state.order.damage.glassToReplace, 'glassLocation') funnelIsCoverageVerified: s.order.payment.insuranceCoverage.isVerified,
.includes(damageLocationsSelected.REAR), funnelHasRecalibrationPart: getHasRecalibrationPart(s),
funnelSelectedDriverSideGlass: getNonFalseValuesOfPropertyInArrayOfObjects(state.order.damage.glassToReplace, 'glassLocation') funnelSelectedMultiGlass: s.order.damage.glassToReplace?.length > 1,
.includes(damageLocationsSelected.DRIVER), funnelSelectedWindshieldGlass: getNonFalseValuesOfPropertyInArrayOfObjects(s.order.damage.glassToReplace, 'glassLocation')
funnelSelectedPassengerSideGlass: getNonFalseValuesOfPropertyInArrayOfObjects(state.order.damage.glassToReplace, 'glassLocation') .includes(damageLocationsSelected.WINDSHIELD),
.includes(damageLocationsSelected.PASSENGER), funnelSelectedBackGlass: getNonFalseValuesOfPropertyInArrayOfObjects(s.order.damage.glassToReplace, 'glassLocation')
funnelOrderPartNumbers: [ .includes(damageLocationsSelected.REAR),
...getNonFalseValuesOfPropertyInArrayOfObjects( funnelSelectedDriverSideGlass: getNonFalseValuesOfPropertyInArrayOfObjects(s.order.damage.glassToReplace, 'glassLocation')
state.order.lineItems.glassParts, .includes(damageLocationsSelected.DRIVER),
'partNumber' funnelSelectedPassengerSideGlass: getNonFalseValuesOfPropertyInArrayOfObjects(s.order.damage.glassToReplace, 'glassLocation')
), .includes(damageLocationsSelected.PASSENGER),
...getNonFalseValuesOfPropertyInArrayOfObjects( funnelOrderPartNumbers: [
state.order.lineItems.otherParts, ...getNonFalseValuesOfPropertyInArrayOfObjects(
'partNumber' s.order.lineItems.glassParts,
) 'partNumber'
], ),
funnelOrderPartTypes: [ ...getNonFalseValuesOfPropertyInArrayOfObjects(
...getNonFalseValuesOfPropertyInArrayOfObjects( s.order.lineItems.otherParts,
state.order.lineItems.glassParts, 'partNumber'
'recalibrationType' )
), ],
...getNonFalseValuesOfPropertyInArrayOfObjects( funnelOrderPartTypes: [
state.order.lineItems.otherParts, ...getNonFalseValuesOfPropertyInArrayOfObjects(
'recalibrationType' s.order.lineItems.glassParts,
) 'recalibrationType'
] ),
}), ...getNonFalseValuesOfPropertyInArrayOfObjects(
s.order.lineItems.otherParts,
'recalibrationType'
)
]
};
},
experimentSettings: (state) => state.applicationUser.experiments experimentSettings: (state) => state.applicationUser.experiments
.filter((x) => !!x.isActive) .filter((x) => !!x.isActive)
.map((x) => x.settings) .map((x) => x.settings)