Updates.
This commit is contained in:
parent
a801c8d624
commit
815f6996ab
1 changed files with 61 additions and 22 deletions
|
|
@ -5,6 +5,7 @@ import globalMethods from "@/global-methods";
|
||||||
import { experimentTriggers } from "@/constants/experiments";
|
import { experimentTriggers } from "@/constants/experiments";
|
||||||
import { applicationConfig } from "@/constants/application-config";
|
import { applicationConfig } from "@/constants/application-config";
|
||||||
import { issPageValues } from "@/router/router-constants/issPage-values";
|
import { issPageValues } from "@/router/router-constants/issPage-values";
|
||||||
|
import { damageLocationsSelected } from "@/constants/damage-locations-selected";
|
||||||
|
|
||||||
const storeId = 'main';
|
const storeId = 'main';
|
||||||
|
|
||||||
|
|
@ -43,6 +44,12 @@ const getDefaultState = () => {
|
||||||
lineItems: {
|
lineItems: {
|
||||||
glassParts: null,
|
glassParts: null,
|
||||||
},
|
},
|
||||||
|
payment: {
|
||||||
|
isInsurance: true,
|
||||||
|
insuranceCoverage: {
|
||||||
|
isVerified: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
serviceLocation: {
|
serviceLocation: {
|
||||||
address: null,
|
address: null,
|
||||||
city: null,
|
city: null,
|
||||||
|
|
@ -92,39 +99,37 @@ export const useMainStore = defineStore({
|
||||||
},
|
},
|
||||||
experimentOrder: (state) => {
|
experimentOrder: (state) => {
|
||||||
return {
|
return {
|
||||||
funnelVehicleYear: state.order.vehicle.year,
|
issVehicleYear: state.order.vehicle.year,
|
||||||
funnelVehicleMake: state.order.vehicle.make,
|
issVehicleMake: state.order.vehicle.make,
|
||||||
funnelVehicleModel: state.order.vehicle.model,
|
issVehicleModel: state.order.vehicle.model,
|
||||||
funnelVehicleStyle: state.order.vehicle.style,
|
issVehicleStyle: state.order.vehicle.style,
|
||||||
funnelIsRepair: state.order.damage.isRepair,
|
issIsRepair: state.order.damage.isRepair,
|
||||||
funnelNumberOfChips: state.order.damage.numberOfChips,
|
issNumberOfChips: state.order.damage.numberOfChips,
|
||||||
funnelCarId: state.order.vehicle.carId,
|
issCarId: state.order.vehicle.carId,
|
||||||
funnelServiceCity: state.order.serviceLocation.city,
|
issServiceCity: state.order.serviceLocation.city,
|
||||||
funnelServiceState: state.order.serviceLocation.state,
|
issServiceState: state.order.serviceLocation.state,
|
||||||
funnelServiceZipCode: state.order.serviceLocation.zipCode,
|
issServiceZipCode: state.order.serviceLocation.zipCode,
|
||||||
funnelParentAccountNumber: state.order.accountNumber,
|
issParentAccountNumber: state.order.accountNumber,
|
||||||
//funnelIsCoverageVerified: state.order.payment.insuranceCoverage.isVerified,
|
issIsCoverageVerified: state.order.payment.insuranceCoverage.isVerified,
|
||||||
//funnelHasRecalibrationPart: getHasRecalibrationPart(state),
|
issHasRecalibrationPart: getHasRecalibrationPart(state),
|
||||||
funnelSelectedMultiGlass: state.order.damage.glassToReplace?.length > 1,
|
issSelectedMultiGlass: state.order.damage.glassToReplace?.length > 1,
|
||||||
/*
|
issSelectedWindshieldGlass: getNonFalseValuesOfPropertyInArrayOfObjects(
|
||||||
funnelSelectedWindshieldGlass: getNonFalseValuesOfPropertyInArrayOfObjects(
|
|
||||||
state.order.damage.glassToReplace,
|
state.order.damage.glassToReplace,
|
||||||
"glassLocation"
|
"glassLocation"
|
||||||
).includes(damageLocationsSelected.WINDSHIELD),
|
).includes(damageLocationsSelected.WINDSHIELD),
|
||||||
funnelSelectedBackGlass: getNonFalseValuesOfPropertyInArrayOfObjects(
|
issSelectedBackGlass: getNonFalseValuesOfPropertyInArrayOfObjects(
|
||||||
state.order.damage.glassToReplace,
|
state.order.damage.glassToReplace,
|
||||||
"glassLocation"
|
"glassLocation"
|
||||||
).includes(damageLocationsSelected.REAR),
|
).includes(damageLocationsSelected.REAR),
|
||||||
funnelSelectedDriverSideGlass: getNonFalseValuesOfPropertyInArrayOfObjects(
|
issSelectedDriverSideGlass: getNonFalseValuesOfPropertyInArrayOfObjects(
|
||||||
state.order.damage.glassToReplace,
|
state.order.damage.glassToReplace,
|
||||||
"glassLocation"
|
"glassLocation"
|
||||||
).includes(damageLocationsSelected.DRIVER),
|
).includes(damageLocationsSelected.DRIVER),
|
||||||
funnelSelectedPassengerSideGlass: getNonFalseValuesOfPropertyInArrayOfObjects(
|
issSelectedPassengerSideGlass: getNonFalseValuesOfPropertyInArrayOfObjects(
|
||||||
state.order.damage.glassToReplace,
|
state.order.damage.glassToReplace,
|
||||||
"glassLocation"
|
"glassLocation"
|
||||||
).includes(damageLocationsSelected.PASSENGER),
|
).includes(damageLocationsSelected.PASSENGER),
|
||||||
*/
|
issOrderPartNumbers: [
|
||||||
funnelOrderPartNumbers: [
|
|
||||||
...getNonFalseValuesOfPropertyInArrayOfObjects(
|
...getNonFalseValuesOfPropertyInArrayOfObjects(
|
||||||
state.order.lineItems.glassParts,
|
state.order.lineItems.glassParts,
|
||||||
"partNumber"
|
"partNumber"
|
||||||
|
|
@ -135,7 +140,7 @@ export const useMainStore = defineStore({
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|
||||||
funnelOrderPartTypes: [
|
issOrderPartTypes: [
|
||||||
...getNonFalseValuesOfPropertyInArrayOfObjects(
|
...getNonFalseValuesOfPropertyInArrayOfObjects(
|
||||||
state.order.lineItems.glassParts,
|
state.order.lineItems.glassParts,
|
||||||
"recalibrationType"
|
"recalibrationType"
|
||||||
|
|
@ -532,6 +537,40 @@ export const useMainStore = defineStore({
|
||||||
persist: true
|
persist: true
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
// Private Functions
|
||||||
|
|
||||||
|
function getHasRecalibrationPart(state) {
|
||||||
|
var hasRequiresRecalibration =
|
||||||
|
getNonFalseValuesOfPropertyInArrayOfObjects(
|
||||||
|
state.order.lineItems.glassParts,
|
||||||
|
"requiresRecalibration"
|
||||||
|
)?.length > 0;
|
||||||
|
var 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"
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
// Has 'requiresRecalibration' but no 'recalibrationType' at all
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Does not have 'requiresRecalibration'
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function getNonFalseValuesOfPropertyInArrayOfObjects(array, propertyName) {
|
function getNonFalseValuesOfPropertyInArrayOfObjects(array, propertyName) {
|
||||||
return (array ?? []).map((x) => x[propertyName]).filter((x) => x);
|
return (array ?? []).map((x) => x[propertyName]).filter((x) => x);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue