Convert rest of the mutations to typed
All mutations (vehicle, damage, service location, customer, schedule, line items, payment, referral, application user, RESET, external params, updateStateWithOrderInformation, updateExperiments, updateTriggeredSiteEntry, updateAffiliateCookies, updateHasTriggeredError) use RootState and typed payloads
This commit is contained in:
parent
2d9fcc0383
commit
10357cb4a6
4 changed files with 329 additions and 249 deletions
|
|
@ -173,7 +173,7 @@ export function hasInsuranceInfo(order, logQueue = null) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks whether the scheduling information is valid for the order.
|
* Checks whether the scheduling information is valid for the order.
|
||||||
* Should be used on pages after scheduling info collection is complete.
|
* Should be used on pages after scheduling info collection is complete.
|
||||||
* Returns true if the required info is present for the chosen appointment type.
|
* Returns true if the required info is present for the chosen appointment type.
|
||||||
* For MOBILE: date, startTime, endTime, jobMaxMinutes, and jobMinMinutes must be present on schedule.
|
* For MOBILE: date, startTime, endTime, jobMaxMinutes, and jobMinMinutes must be present on schedule.
|
||||||
|
|
|
||||||
|
|
@ -35,9 +35,7 @@ vueApp.config.errorHandler = (err: unknown, vm: unknown, info: string) => {
|
||||||
vm && typeof (vm as { getPageName?: () => string }).getPageName === "function"
|
vm && typeof (vm as { getPageName?: () => string }).getPageName === "function"
|
||||||
? (vm as { getPageName: () => string }).getPageName()
|
? (vm as { getPageName: () => string }).getPageName()
|
||||||
: "Unknown";
|
: "Unknown";
|
||||||
global.$logger.logError(
|
global.$logger.logError(`Page Name - ${pageName} - ${info}: ${error.message}\n${error.stack}`);
|
||||||
`Page Name - ${pageName} - ${info}: ${error.message}\n${error.stack}`
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
vueApp.mount("#app");
|
vueApp.mount("#app");
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,15 @@ import type {
|
||||||
RootState,
|
RootState,
|
||||||
VehicleUpdatePayload,
|
VehicleUpdatePayload,
|
||||||
RegistrationUpdatePayload,
|
RegistrationUpdatePayload,
|
||||||
|
ServiceZipUpdatePayload,
|
||||||
|
ServiceLocationUpdatePayload,
|
||||||
|
MobileDetailsUpdatePayload,
|
||||||
|
ScheduleUpdatePayload,
|
||||||
|
CustomerDetailsUpdatePayload,
|
||||||
|
PageDataUpdatePayload,
|
||||||
|
EventBusEventPayload,
|
||||||
|
CcTokenUpdatePayload,
|
||||||
|
FlexibleRecord,
|
||||||
} from "./types";
|
} from "./types";
|
||||||
import { endpoints } from "@/constants/endpoints.js";
|
import { endpoints } from "@/constants/endpoints.js";
|
||||||
import { storeMutations } from "@/constants/store-mutations";
|
import { storeMutations } from "@/constants/store-mutations";
|
||||||
|
|
@ -280,121 +289,124 @@ export const mutations = {
|
||||||
updateCapabilityQuestionAnswers(state: RootState, answersArray: unknown[] | null) {
|
updateCapabilityQuestionAnswers(state: RootState, answersArray: unknown[] | null) {
|
||||||
state.order.damage.capabilityQuestionAnswers = answersArray;
|
state.order.damage.capabilityQuestionAnswers = answersArray;
|
||||||
},
|
},
|
||||||
updateGlassParts(state, partsData) {
|
updateGlassParts(state: RootState, partsData: unknown[] | null) {
|
||||||
state.order.lineItems.glassParts = partsData;
|
state.order.lineItems.glassParts = partsData;
|
||||||
},
|
},
|
||||||
updateVaps(state, partsData) {
|
updateVaps(state: RootState, partsData: unknown[] | null) {
|
||||||
state.order.lineItems.vaps = partsData;
|
state.order.lineItems.vaps = partsData;
|
||||||
},
|
},
|
||||||
updateSupportingItems(state, partsData) {
|
updateSupportingItems(state: RootState, partsData: unknown[] | null) {
|
||||||
state.order.lineItems.supportingItems = partsData;
|
state.order.lineItems.supportingItems = partsData;
|
||||||
},
|
},
|
||||||
updateLineItemsServerData(state, serverData) {
|
updateLineItemsServerData(state: RootState, serverData: unknown) {
|
||||||
state.order.lineItems.serverData = serverData;
|
state.order.lineItems.serverData = serverData;
|
||||||
},
|
},
|
||||||
updateInactivePromos(state, inactivePromos) {
|
updateInactivePromos(state: RootState, inactivePromos: unknown[] | null) {
|
||||||
state.order.payment.inactivePromos = inactivePromos;
|
state.order.payment.inactivePromos = inactivePromos;
|
||||||
},
|
},
|
||||||
updatePromos(state, promos) {
|
updatePromos(state: RootState, promos: unknown[] | null) {
|
||||||
state.order.lineItems.promos = promos;
|
state.order.lineItems.promos = promos;
|
||||||
},
|
},
|
||||||
updatePageData(state, pageData) {
|
updatePageData(state: RootState, pageData: PageDataUpdatePayload) {
|
||||||
state.applicationUser.pageData[pageData.page] = pageData.data;
|
state.applicationUser.pageData[pageData.page] = pageData.data;
|
||||||
},
|
},
|
||||||
updateReferralCorrelationId(state, referralCorrelationId) {
|
updateReferralCorrelationId(state: RootState, referralCorrelationId: string | null) {
|
||||||
state.order.referralCorrelationId = referralCorrelationId;
|
state.order.referralCorrelationId = referralCorrelationId;
|
||||||
},
|
},
|
||||||
updateReferralNumber(state, referralNumber) {
|
updateReferralNumber(state: RootState, referralNumber: string | null) {
|
||||||
state.order.referralNumber = referralNumber;
|
state.order.referralNumber = referralNumber;
|
||||||
},
|
},
|
||||||
updateReferralSequenceNumber(state, referralSequenceNumber) {
|
updateReferralSequenceNumber(state: RootState, referralSequenceNumber: string | null) {
|
||||||
state.order.referralSequenceNumber = referralSequenceNumber;
|
state.order.referralSequenceNumber = referralSequenceNumber;
|
||||||
},
|
},
|
||||||
updateReferralDate(state, referralDate) {
|
updateReferralDate(state: RootState, referralDate: string | null) {
|
||||||
state.order.referralDate = referralDate;
|
state.order.referralDate = referralDate;
|
||||||
},
|
},
|
||||||
updateParentAcctNumber(state, parentAcctNumber) {
|
updateParentAcctNumber(state: RootState, parentAcctNumber: number) {
|
||||||
state.order.payment.parentAccountNumber = parentAcctNumber;
|
state.order.payment.parentAccountNumber = parentAcctNumber;
|
||||||
},
|
},
|
||||||
updateBillToAcctNumber(state, billToAcctNumber) {
|
updateBillToAcctNumber(state: RootState, billToAcctNumber: string | null) {
|
||||||
state.order.payment.billToAccountNumber = billToAcctNumber;
|
state.order.payment.billToAccountNumber = billToAcctNumber;
|
||||||
},
|
},
|
||||||
updateEON(state, eon) {
|
updateEON(state: RootState, eon: string | null) {
|
||||||
state.order.eon = eon;
|
state.order.eon = eon;
|
||||||
},
|
},
|
||||||
updateIsInsurance(state, isInsurance) {
|
updateIsInsurance(state, isInsurance) {
|
||||||
state.order.payment.isInsurance = isInsurance;
|
state.order.payment.isInsurance = isInsurance;
|
||||||
},
|
},
|
||||||
updateIsPia(state, isPia) {
|
updateIsPia(state: RootState, isPia: boolean | null) {
|
||||||
state.order.payment.isPia = isPia;
|
state.order.payment.isPia = isPia;
|
||||||
},
|
},
|
||||||
updatePiaType(state, piaType) {
|
updatePiaType(state: RootState, piaType: string | null) {
|
||||||
state.order.payment.piaType = piaType;
|
state.order.payment.piaType = piaType;
|
||||||
},
|
},
|
||||||
updateWorkOrderNumber(state, workOrderNumber) {
|
updateWorkOrderNumber(state: RootState, workOrderNumber: string | null) {
|
||||||
state.order.workOrderNumber = workOrderNumber;
|
state.order.workOrderNumber = workOrderNumber;
|
||||||
},
|
},
|
||||||
updateWorkOrderId(state, workOrderId) {
|
updateWorkOrderId(state: RootState, workOrderId: string | null) {
|
||||||
state.order.workOrderId = workOrderId;
|
state.order.workOrderId = workOrderId;
|
||||||
},
|
},
|
||||||
updateCustomerPortalLoginToken(state, customerPortalLoginToken) {
|
updateCustomerPortalLoginToken(state: RootState, customerPortalLoginToken: string | null) {
|
||||||
state.order.customerPortalLoginToken = customerPortalLoginToken;
|
state.order.customerPortalLoginToken = customerPortalLoginToken;
|
||||||
},
|
},
|
||||||
updateLockToken(state, lockToken) {
|
updateLockToken(state: RootState, lockToken: string | null) {
|
||||||
state.order.lockToken = lockToken;
|
state.order.lockToken = lockToken;
|
||||||
},
|
},
|
||||||
updateSettledTenderAmount(state, settledTenderAmount) {
|
updateSettledTenderAmount(state: RootState, settledTenderAmount: number) {
|
||||||
state.order.settledTenderAmount = settledTenderAmount;
|
state.order.settledTenderAmount = settledTenderAmount;
|
||||||
},
|
},
|
||||||
updateIsRecalAckOptIn(state, isRecalAckOptIn) {
|
updateIsRecalAckOptIn(state: RootState, isRecalAckOptIn: boolean) {
|
||||||
state.order.isRecalAckOptIn = isRecalAckOptIn;
|
state.order.isRecalAckOptIn = isRecalAckOptIn;
|
||||||
},
|
},
|
||||||
updateIsRecalAcknowledgedForScheduling(state, isRecalAcknowledgedForScheduling) {
|
updateIsRecalAcknowledgedForScheduling(
|
||||||
|
state: RootState,
|
||||||
|
isRecalAcknowledgedForScheduling: string
|
||||||
|
) {
|
||||||
state.order.isRecalAcknowledgedForScheduling = isRecalAcknowledgedForScheduling;
|
state.order.isRecalAcknowledgedForScheduling = isRecalAcknowledgedForScheduling;
|
||||||
},
|
},
|
||||||
updateIsOemGlassSelected(state: RootState, isOemGlassSelected: boolean | null) {
|
updateIsOemGlassSelected(state: RootState, isOemGlassSelected: boolean | null) {
|
||||||
state.order.damage.installOemGlass = isOemGlassSelected;
|
state.order.damage.installOemGlass = isOemGlassSelected;
|
||||||
},
|
},
|
||||||
updateIsMSRFeeApplicable(state, isMSRFeeApplicable) {
|
updateIsMSRFeeApplicable(state: RootState, isMSRFeeApplicable: boolean) {
|
||||||
state.order.isMSRFeeApplicable = isMSRFeeApplicable;
|
state.order.isMSRFeeApplicable = isMSRFeeApplicable;
|
||||||
},
|
},
|
||||||
updateCashPriceSubTotal(state, cashPriceSubTotal) {
|
updateCashPriceSubTotal(state: RootState, cashPriceSubTotal: string | number) {
|
||||||
state.order.cashPriceSubTotal =
|
state.order.cashPriceSubTotal =
|
||||||
cashPriceSubTotal === "" ? null : cashPriceSubTotal.toString();
|
cashPriceSubTotal === "" ? null : cashPriceSubTotal.toString();
|
||||||
},
|
},
|
||||||
updateCCToken(state, ccToken) {
|
updateCCToken(state: RootState, ccToken: CcTokenUpdatePayload) {
|
||||||
state.order.payment.ccToken.subscriptionId = ccToken.subscriptionId;
|
state.order.payment.ccToken.subscriptionId = ccToken.subscriptionId ?? null;
|
||||||
state.order.payment.ccToken.expMonth = ccToken.expMonth;
|
state.order.payment.ccToken.expMonth = ccToken.expMonth ?? null;
|
||||||
state.order.payment.ccToken.expYear = ccToken.expYear;
|
state.order.payment.ccToken.expYear = ccToken.expYear ?? null;
|
||||||
state.order.payment.ccToken.cardType = ccToken.cardType;
|
state.order.payment.ccToken.cardType = ccToken.cardType ?? null;
|
||||||
state.order.payment.ccToken.billToPostalCode = ccToken.billToPostalCode;
|
state.order.payment.ccToken.billToPostalCode = ccToken.billToPostalCode ?? null;
|
||||||
state.order.payment.ccToken.billToFirstName = ccToken.billToFirstName;
|
state.order.payment.ccToken.billToFirstName = ccToken.billToFirstName ?? null;
|
||||||
state.order.payment.ccToken.billToLastName = ccToken.billToLastName;
|
state.order.payment.ccToken.billToLastName = ccToken.billToLastName ?? null;
|
||||||
state.order.payment.ccToken.referenceNumber = ccToken.referenceNumber;
|
state.order.payment.ccToken.referenceNumber = ccToken.referenceNumber ?? null;
|
||||||
state.order.payment.ccToken.authCode = ccToken.authCode;
|
state.order.payment.ccToken.authCode = ccToken.authCode ?? null;
|
||||||
state.order.payment.ccToken.transactionId = ccToken.transactionId;
|
state.order.payment.ccToken.transactionId = ccToken.transactionId ?? null;
|
||||||
state.order.payment.ccToken.transReferenceNumber = ccToken.transReferenceNumber;
|
state.order.payment.ccToken.transReferenceNumber = ccToken.transReferenceNumber ?? null;
|
||||||
state.order.payment.ccToken.lastFour = ccToken.lastFour;
|
state.order.payment.ccToken.lastFour = ccToken.lastFour ?? null;
|
||||||
},
|
},
|
||||||
updatePaypalToken(state, ppToken) {
|
updatePaypalToken(state: RootState, ppToken: string | null) {
|
||||||
state.order.payment.paypalToken = ppToken;
|
state.order.payment.paypalToken = ppToken;
|
||||||
},
|
},
|
||||||
updateNextGenSettledAmount(state, nextGenSettledAmount) {
|
updateNextGenSettledAmount(state: RootState, nextGenSettledAmount: number) {
|
||||||
state.order.payment.nextGenSettledAmount = nextGenSettledAmount;
|
state.order.payment.nextGenSettledAmount = nextGenSettledAmount;
|
||||||
},
|
},
|
||||||
updateInsuranceVerifiedStatus(state, isVerified) {
|
updateInsuranceVerifiedStatus(state: RootState, isVerified: boolean | null) {
|
||||||
state.order.payment.insuranceCoverage.isVerified = isVerified;
|
state.order.payment.insuranceCoverage.isVerified = isVerified;
|
||||||
},
|
},
|
||||||
updateCustomerEmailAddress(state, customerEmailAddress) {
|
updateCustomerEmailAddress(state: RootState, customerEmailAddress: string | null) {
|
||||||
state.order.customer.emailAddress = customerEmailAddress;
|
state.order.customer.emailAddress = customerEmailAddress;
|
||||||
},
|
},
|
||||||
updateCustomerPhoneNumber(state, phoneNumber) {
|
updateCustomerPhoneNumber(state: RootState, phoneNumber: string | null) {
|
||||||
state.order.customer.phoneNumber = phoneNumber;
|
state.order.customer.phoneNumber = phoneNumber;
|
||||||
},
|
},
|
||||||
updateCustomerIsSmsOptin(state, isSmsOptIn) {
|
updateCustomerIsSmsOptin(state: RootState, isSmsOptIn: boolean | null) {
|
||||||
state.order.customer.isSmsOptIn = isSmsOptIn;
|
state.order.customer.isSmsOptIn = isSmsOptIn;
|
||||||
},
|
},
|
||||||
updateCustomerWaitListRequested(state, waitListRequested) {
|
updateCustomerWaitListRequested(state: RootState, waitListRequested: boolean | null) {
|
||||||
state.order.customer.waitListRequested = waitListRequested;
|
state.order.customer.waitListRequested = waitListRequested;
|
||||||
},
|
},
|
||||||
updateVehicle(state: RootState, vehicleInfo: VehicleUpdatePayload) {
|
updateVehicle(state: RootState, vehicleInfo: VehicleUpdatePayload) {
|
||||||
|
|
@ -411,88 +423,88 @@ export const mutations = {
|
||||||
state.order.vehicle.imageColor = vehicleInfo.imageVifColor ?? null;
|
state.order.vehicle.imageColor = vehicleInfo.imageVifColor ?? null;
|
||||||
},
|
},
|
||||||
updateRegistration(state: RootState, registrationInfo: RegistrationUpdatePayload) {
|
updateRegistration(state: RootState, registrationInfo: RegistrationUpdatePayload) {
|
||||||
state.order.vehicle.registration.licensePlate =
|
state.order.vehicle.registration.licensePlate = registrationInfo?.licensePlate ?? null;
|
||||||
registrationInfo?.licensePlate ?? null;
|
|
||||||
},
|
},
|
||||||
updateServiceZip(state, serviceZipInfo) {
|
updateServiceZip(state: RootState, serviceZipInfo: ServiceZipUpdatePayload) {
|
||||||
state.order.serviceLocation.state = serviceZipInfo.state;
|
state.order.serviceLocation.state = serviceZipInfo.state ?? null;
|
||||||
state.order.serviceLocation.zipCode = serviceZipInfo.zipCode;
|
state.order.serviceLocation.zipCode = serviceZipInfo.zipCode ?? null;
|
||||||
state.order.serviceLocation.zipCodeCtu = serviceZipInfo.zipCodeCtu;
|
state.order.serviceLocation.zipCodeCtu = serviceZipInfo.zipCodeCtu ?? null;
|
||||||
},
|
},
|
||||||
updateServiceLocation(state, serviceLocationInfo) {
|
updateServiceLocation(state: RootState, serviceLocationInfo: ServiceLocationUpdatePayload) {
|
||||||
state.order.serviceLocation.address = serviceLocationInfo.address;
|
state.order.serviceLocation.address = serviceLocationInfo.address ?? null;
|
||||||
state.order.serviceLocation.address2 = serviceLocationInfo.address2;
|
state.order.serviceLocation.address2 = serviceLocationInfo.address2 ?? null;
|
||||||
state.order.serviceLocation.city = serviceLocationInfo.city;
|
state.order.serviceLocation.city = serviceLocationInfo.city ?? null;
|
||||||
state.order.serviceLocation.state = serviceLocationInfo.state;
|
state.order.serviceLocation.state = serviceLocationInfo.state ?? null;
|
||||||
state.order.serviceLocation.zipCode = serviceLocationInfo.zipCode;
|
state.order.serviceLocation.zipCode = serviceLocationInfo.zipCode ?? null;
|
||||||
state.order.serviceLocation.zipCodeCtu = serviceLocationInfo.zipCodeCtu;
|
state.order.serviceLocation.zipCodeCtu = serviceLocationInfo.zipCodeCtu ?? null;
|
||||||
state.order.serviceLocation.appointmentType = serviceLocationInfo.appointmentType;
|
state.order.serviceLocation.appointmentType = serviceLocationInfo.appointmentType ?? null;
|
||||||
state.order.serviceLocation.isVehicleProtected = serviceLocationInfo.isVehicleProtected;
|
state.order.serviceLocation.isVehicleProtected =
|
||||||
|
serviceLocationInfo.isVehicleProtected ?? null;
|
||||||
|
|
||||||
state.order.serviceLocation.provider = {
|
state.order.serviceLocation.provider = {
|
||||||
providerNumber: serviceLocationInfo.provider?.providerNumber,
|
providerNumber: serviceLocationInfo.provider?.providerNumber ?? null,
|
||||||
address: {
|
address: {
|
||||||
streetAddress: serviceLocationInfo.provider?.address?.streetAddress,
|
streetAddress: serviceLocationInfo.provider?.address?.streetAddress ?? null,
|
||||||
city: serviceLocationInfo.provider?.address?.city,
|
city: serviceLocationInfo.provider?.address?.city ?? null,
|
||||||
state: serviceLocationInfo.provider?.address?.state,
|
state: serviceLocationInfo.provider?.address?.state ?? null,
|
||||||
zipCode: serviceLocationInfo.provider?.address?.zipCode,
|
zipCode: serviceLocationInfo.provider?.address?.zipCode ?? null,
|
||||||
zipCodeCtu: serviceLocationInfo.provider?.address?.zipCodeCtu,
|
zipCodeCtu: serviceLocationInfo.provider?.address?.zipCodeCtu ?? null,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
updateMobileDetails(state, mobileDetails) {
|
updateMobileDetails(state: RootState, mobileDetails: MobileDetailsUpdatePayload) {
|
||||||
state.order.serviceLocation.address = mobileDetails.address;
|
state.order.serviceLocation.address = mobileDetails.address ?? null;
|
||||||
state.order.serviceLocation.address2 = mobileDetails.address2;
|
state.order.serviceLocation.address2 = mobileDetails.address2 ?? null;
|
||||||
state.order.serviceLocation.city = mobileDetails.city;
|
state.order.serviceLocation.city = mobileDetails.city ?? null;
|
||||||
state.order.serviceLocation.isVehicleProtected = mobileDetails.isVehicleProtected;
|
state.order.serviceLocation.isVehicleProtected = mobileDetails.isVehicleProtected ?? null;
|
||||||
},
|
},
|
||||||
updateServiceLocationTechNotes(state, techNotes) {
|
updateServiceLocationTechNotes(state: RootState, techNotes: string | null) {
|
||||||
state.order.serviceLocation.techNotes = techNotes;
|
state.order.serviceLocation.techNotes = techNotes;
|
||||||
},
|
},
|
||||||
updateSchedule(state, scheduleInfo) {
|
updateSchedule(state: RootState, scheduleInfo: ScheduleUpdatePayload | null) {
|
||||||
if (scheduleInfo) {
|
if (scheduleInfo) {
|
||||||
state.order.schedule.date = scheduleInfo.date;
|
state.order.schedule.date = scheduleInfo.date ?? null;
|
||||||
state.order.schedule.startTime = scheduleInfo.startTime;
|
state.order.schedule.startTime = scheduleInfo.startTime ?? null;
|
||||||
state.order.schedule.endTime = scheduleInfo.endTime;
|
state.order.schedule.endTime = scheduleInfo.endTime ?? null;
|
||||||
state.order.schedule.routeCode = scheduleInfo.routeCode;
|
state.order.schedule.routeCode = scheduleInfo.routeCode ?? null;
|
||||||
state.order.schedule.jobMaxMinutes = scheduleInfo.jobMaxMinutes;
|
state.order.schedule.jobMaxMinutes = scheduleInfo.jobMaxMinutes ?? null;
|
||||||
state.order.schedule.jobMinMinutes = scheduleInfo.jobMinMinutes;
|
state.order.schedule.jobMinMinutes = scheduleInfo.jobMinMinutes ?? null;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
updateCustomerDetails(state, customerDetails) {
|
updateCustomerDetails(state: RootState, customerDetails: CustomerDetailsUpdatePayload | null) {
|
||||||
if (customerDetails) {
|
if (customerDetails) {
|
||||||
state.order.customer.firstName = customerDetails.firstName;
|
state.order.customer.firstName = customerDetails.firstName ?? null;
|
||||||
state.order.customer.lastName = customerDetails.lastName;
|
state.order.customer.lastName = customerDetails.lastName ?? null;
|
||||||
state.order.customer.emailAddress = customerDetails.emailAddress;
|
state.order.customer.emailAddress = customerDetails.emailAddress ?? null;
|
||||||
state.order.customer.phoneNumber = customerDetails.phoneNumber;
|
state.order.customer.phoneNumber = customerDetails.phoneNumber ?? null;
|
||||||
state.order.customer.isSmsOptIn = customerDetails.isSmsOptIn;
|
state.order.customer.isSmsOptIn = customerDetails.isSmsOptIn ?? null;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// applicationUser MUTATIONS
|
// applicationUser MUTATIONS
|
||||||
updateSaveSessionPromise(state, saveSessionPromise) {
|
updateSaveSessionPromise(state: RootState, saveSessionPromise: Promise<unknown> | null) {
|
||||||
state.applicationUser.saveSessionPromise = saveSessionPromise;
|
state.applicationUser.saveSessionPromise = saveSessionPromise;
|
||||||
},
|
},
|
||||||
updateSavedSessionId(state, savedSessionId) {
|
updateSavedSessionId(state: RootState, savedSessionId: string | null) {
|
||||||
state.applicationUser.savedSessionId = savedSessionId;
|
state.applicationUser.savedSessionId = savedSessionId;
|
||||||
},
|
},
|
||||||
updateCrmCustomerId(state, crmCustomerId) {
|
updateCrmCustomerId(state: RootState, crmCustomerId: string | null) {
|
||||||
state.applicationUser.crmCustomerId = crmCustomerId;
|
state.applicationUser.crmCustomerId = crmCustomerId;
|
||||||
},
|
},
|
||||||
updateLastPageVisited(state, lastPageVisited) {
|
updateLastPageVisited(state: RootState, lastPageVisited: string | null) {
|
||||||
state.applicationUser.lastPageVisited = lastPageVisited;
|
state.applicationUser.lastPageVisited = lastPageVisited;
|
||||||
},
|
},
|
||||||
updateLoggingOption(state, loggingOption) {
|
updateLoggingOption(state: RootState, loggingOption: boolean) {
|
||||||
state.applicationUser.loggingOption = loggingOption;
|
state.applicationUser.loggingOption = loggingOption;
|
||||||
},
|
},
|
||||||
// EVENT BUS MUTATIONS
|
// EVENT BUS MUTATIONS
|
||||||
addEventToBus(state, event) {
|
addEventToBus(state: RootState, event: EventBusEventPayload) {
|
||||||
state.applicationUser.eventBus.push(event);
|
state.applicationUser.eventBus.push(event);
|
||||||
},
|
},
|
||||||
removeEventFromBus(state, eventData) {
|
removeEventFromBus(state: RootState, eventData: EventBusEventPayload) {
|
||||||
const matchedEvent = state.applicationUser.eventBus.find(
|
const matchedEvent = state.applicationUser.eventBus.find(
|
||||||
({ category, subCategory }) =>
|
(e: EventBusEventPayload) =>
|
||||||
category === eventData.category && subCategory === eventData.subCategory
|
e.category === eventData.category && e.subCategory === eventData.subCategory
|
||||||
);
|
);
|
||||||
const itemIndex = state.applicationUser.eventBus.indexOf(matchedEvent);
|
const itemIndex = state.applicationUser.eventBus.indexOf(matchedEvent);
|
||||||
|
|
||||||
|
|
@ -502,68 +514,68 @@ export const mutations = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
//ExternalParameter MUTATIONS
|
//ExternalParameter MUTATIONS
|
||||||
updateIsExternalParameter(state, isExternalParameter) {
|
updateIsExternalParameter(state: RootState, isExternalParameter: string) {
|
||||||
externalParameterState.isExternalParameter = isExternalParameter;
|
externalParameterState.isExternalParameter = isExternalParameter;
|
||||||
saveExternalParameterState(externalParameterState);
|
saveExternalParameterState(externalParameterState);
|
||||||
},
|
},
|
||||||
updateExternalParameterYear(state, year) {
|
updateExternalParameterYear(state: RootState, year: string | null) {
|
||||||
externalParameterState.vehicle.year = year;
|
externalParameterState.vehicle.year = year;
|
||||||
saveExternalParameterState(externalParameterState);
|
saveExternalParameterState(externalParameterState);
|
||||||
},
|
},
|
||||||
updateExternalParameterMake(state, make) {
|
updateExternalParameterMake(state: RootState, make: string | null) {
|
||||||
externalParameterState.vehicle.make = make;
|
externalParameterState.vehicle.make = make;
|
||||||
saveExternalParameterState(externalParameterState);
|
saveExternalParameterState(externalParameterState);
|
||||||
},
|
},
|
||||||
updateExternalParameterModel(state, model) {
|
updateExternalParameterModel(state: RootState, model: string | null) {
|
||||||
externalParameterState.vehicle.model = model;
|
externalParameterState.vehicle.model = model;
|
||||||
saveExternalParameterState(externalParameterState);
|
saveExternalParameterState(externalParameterState);
|
||||||
},
|
},
|
||||||
updateExternalParameterStyle(state, style) {
|
updateExternalParameterStyle(state: RootState, style: string | null) {
|
||||||
externalParameterState.vehicle.style = style;
|
externalParameterState.vehicle.style = style;
|
||||||
saveExternalParameterState(externalParameterState);
|
saveExternalParameterState(externalParameterState);
|
||||||
},
|
},
|
||||||
updateExternalParameterQsStash(state, qsStash) {
|
updateExternalParameterQsStash(state: RootState, qsStash: unknown) {
|
||||||
externalParameterState.qsStash = qsStash;
|
externalParameterState.qsStash = qsStash;
|
||||||
saveExternalParameterState(externalParameterState);
|
saveExternalParameterState(externalParameterState);
|
||||||
},
|
},
|
||||||
updateExternalParameterIsRepair(state, isRepair) {
|
updateExternalParameterIsRepair(state: RootState, isRepair: boolean | null) {
|
||||||
externalParameterState.vehicleDamage.isRepair = isRepair;
|
externalParameterState.vehicleDamage.isRepair = isRepair;
|
||||||
saveExternalParameterState(externalParameterState);
|
saveExternalParameterState(externalParameterState);
|
||||||
},
|
},
|
||||||
updateExternalParameterNumberOfChips(state, numberOfChips) {
|
updateExternalParameterNumberOfChips(state: RootState, numberOfChips: number | null) {
|
||||||
externalParameterState.vehicleDamage.numberOfChips = numberOfChips;
|
externalParameterState.vehicleDamage.numberOfChips = numberOfChips;
|
||||||
saveExternalParameterState(externalParameterState);
|
saveExternalParameterState(externalParameterState);
|
||||||
},
|
},
|
||||||
updateExternalParameterDamageType(state, damageType) {
|
updateExternalParameterDamageType(state: RootState, damageType: string | null) {
|
||||||
externalParameterState.vehicleDamage.damageType = damageType;
|
externalParameterState.vehicleDamage.damageType = damageType;
|
||||||
saveExternalParameterState(externalParameterState);
|
saveExternalParameterState(externalParameterState);
|
||||||
},
|
},
|
||||||
updateExternalParameterZipCode(state, zipCode) {
|
updateExternalParameterZipCode(state: RootState, zipCode: string | null) {
|
||||||
externalParameterState.serviceZip.zipCode = zipCode;
|
externalParameterState.serviceZip.zipCode = zipCode;
|
||||||
saveExternalParameterState(externalParameterState);
|
saveExternalParameterState(externalParameterState);
|
||||||
},
|
},
|
||||||
updateExternalParameterEmailAddress(state, emailAddress) {
|
updateExternalParameterEmailAddress(state: RootState, emailAddress: string | null) {
|
||||||
externalParameterState.customer.emailAddress = emailAddress;
|
externalParameterState.customer.emailAddress = emailAddress;
|
||||||
saveExternalParameterState(externalParameterState);
|
saveExternalParameterState(externalParameterState);
|
||||||
},
|
},
|
||||||
updateExternalParameterIsInsurance(state, isInsurance) {
|
updateExternalParameterIsInsurance(state: RootState, isInsurance: boolean | null) {
|
||||||
externalParameterState.quote.isInsurance = isInsurance;
|
externalParameterState.quote.isInsurance = isInsurance;
|
||||||
saveExternalParameterState(externalParameterState);
|
saveExternalParameterState(externalParameterState);
|
||||||
},
|
},
|
||||||
updateExternalParameterVinSelection(state, vinSelection) {
|
updateExternalParameterVinSelection(state: RootState, vinSelection: string | null) {
|
||||||
externalParameterState.estimate.vinSelection = vinSelection;
|
externalParameterState.estimate.vinSelection = vinSelection;
|
||||||
saveExternalParameterState(externalParameterState);
|
saveExternalParameterState(externalParameterState);
|
||||||
},
|
},
|
||||||
updateExternalParameterServicePackage(state, servicePackage) {
|
updateExternalParameterServicePackage(state: RootState, servicePackage: string | null) {
|
||||||
externalParameterState.quote.servicePackage = servicePackage;
|
externalParameterState.quote.servicePackage = servicePackage;
|
||||||
saveExternalParameterState(externalParameterState);
|
saveExternalParameterState(externalParameterState);
|
||||||
},
|
},
|
||||||
updateExternalParameterPhoneNumber(state, phoneNumber) {
|
updateExternalParameterPhoneNumber(state: RootState, phoneNumber: string | null) {
|
||||||
externalParameterState.customer.phoneNumber = phoneNumber;
|
externalParameterState.customer.phoneNumber = phoneNumber;
|
||||||
saveExternalParameterState(externalParameterState);
|
saveExternalParameterState(externalParameterState);
|
||||||
},
|
},
|
||||||
//RESET ExternalParameter MUTATIONS
|
//RESET ExternalParameter MUTATIONS
|
||||||
resetExternalParameterVehicleState(state) {
|
resetExternalParameterVehicleState(state: RootState) {
|
||||||
externalParameterState.vehicle.year = null;
|
externalParameterState.vehicle.year = null;
|
||||||
externalParameterState.vehicle.make = null;
|
externalParameterState.vehicle.make = null;
|
||||||
externalParameterState.vehicle.model = null;
|
externalParameterState.vehicle.model = null;
|
||||||
|
|
@ -571,38 +583,38 @@ export const mutations = {
|
||||||
|
|
||||||
saveExternalParameterState(externalParameterState);
|
saveExternalParameterState(externalParameterState);
|
||||||
},
|
},
|
||||||
resetExternalParameterDamageState(state) {
|
resetExternalParameterDamageState(state: RootState) {
|
||||||
externalParameterState.vehicleDamage.isRepair = null;
|
externalParameterState.vehicleDamage.isRepair = null;
|
||||||
externalParameterState.vehicleDamage.numberOfChips = null;
|
externalParameterState.vehicleDamage.numberOfChips = null;
|
||||||
externalParameterState.vehicleDamage.damageType = null;
|
externalParameterState.vehicleDamage.damageType = null;
|
||||||
|
|
||||||
saveExternalParameterState(externalParameterState);
|
saveExternalParameterState(externalParameterState);
|
||||||
},
|
},
|
||||||
resetExternalParameterEstimateState(state) {
|
resetExternalParameterEstimateState(state: RootState) {
|
||||||
externalParameterState.estimate.vinSelection = null;
|
externalParameterState.estimate.vinSelection = null;
|
||||||
saveExternalParameterState(externalParameterState);
|
saveExternalParameterState(externalParameterState);
|
||||||
},
|
},
|
||||||
resetExternalParameterServiceZipState(state) {
|
resetExternalParameterServiceZipState(state: RootState) {
|
||||||
externalParameterState.serviceZip.zipCode = null;
|
externalParameterState.serviceZip.zipCode = null;
|
||||||
saveExternalParameterState(externalParameterState);
|
saveExternalParameterState(externalParameterState);
|
||||||
},
|
},
|
||||||
resetExternalParameterQuoteState(state) {
|
resetExternalParameterQuoteState(state: RootState) {
|
||||||
externalParameterState.quote.servicePackage = null;
|
externalParameterState.quote.servicePackage = null;
|
||||||
externalParameterState.quote.isInsurance = null;
|
externalParameterState.quote.isInsurance = null;
|
||||||
saveExternalParameterState(externalParameterState);
|
saveExternalParameterState(externalParameterState);
|
||||||
},
|
},
|
||||||
resetIsExternalParameter(state) {
|
resetIsExternalParameter(state: RootState) {
|
||||||
externalParameterState.isExternalParameter = externalParameterStatus.INACTIVE;
|
externalParameterState.isExternalParameter = externalParameterStatus.INACTIVE;
|
||||||
saveExternalParameterState(externalParameterState);
|
saveExternalParameterState(externalParameterState);
|
||||||
},
|
},
|
||||||
resetExternalParameterCustomerState(state) {
|
resetExternalParameterCustomerState(state: RootState) {
|
||||||
externalParameterState.customer.emailAddress = null;
|
externalParameterState.customer.emailAddress = null;
|
||||||
externalParameterState.customer.phoneNumber = null;
|
externalParameterState.customer.phoneNumber = null;
|
||||||
saveExternalParameterState(externalParameterState);
|
saveExternalParameterState(externalParameterState);
|
||||||
},
|
},
|
||||||
|
|
||||||
// RESET DEPENDENCY MUTATIONS
|
// RESET DEPENDENCY MUTATIONS
|
||||||
resetVehicleState(state) {
|
resetVehicleState(state: RootState) {
|
||||||
state.order.vehicle.year = null;
|
state.order.vehicle.year = null;
|
||||||
state.order.vehicle.make = null;
|
state.order.vehicle.make = null;
|
||||||
state.order.vehicle.model = null;
|
state.order.vehicle.model = null;
|
||||||
|
|
@ -614,15 +626,15 @@ export const mutations = {
|
||||||
state.order.vehicle.imageVifNumber = null;
|
state.order.vehicle.imageVifNumber = null;
|
||||||
state.order.vehicle.imageColor = null;
|
state.order.vehicle.imageColor = null;
|
||||||
},
|
},
|
||||||
resetDamageState(state) {
|
resetDamageState(state: RootState) {
|
||||||
state.order.damage.isRepair = null;
|
state.order.damage.isRepair = null;
|
||||||
state.order.damage.numberOfChips = null;
|
state.order.damage.numberOfChips = null;
|
||||||
state.order.damage.glassToReplace = null;
|
state.order.damage.glassToReplace = null;
|
||||||
},
|
},
|
||||||
resetRegistrationState(state) {
|
resetRegistrationState(state: RootState) {
|
||||||
state.order.vehicle.registration.licensePlate = null;
|
state.order.vehicle.registration.licensePlate = null;
|
||||||
},
|
},
|
||||||
resetGlassPartsState(state) {
|
resetGlassPartsState(state: RootState) {
|
||||||
state.order.lineItems.glassParts = null;
|
state.order.lineItems.glassParts = null;
|
||||||
state.order.damage.partQuestionAnswers = null;
|
state.order.damage.partQuestionAnswers = null;
|
||||||
state.order.damage.moldingQuestionAnswers = null;
|
state.order.damage.moldingQuestionAnswers = null;
|
||||||
|
|
@ -632,7 +644,7 @@ export const mutations = {
|
||||||
state.applicationUser.pageData[routeData.MOLDING_QUESTIONS.name] = null;
|
state.applicationUser.pageData[routeData.MOLDING_QUESTIONS.name] = null;
|
||||||
state.applicationUser.pageData[routeData.CAPABILITY_QUESTIONS.name] = null;
|
state.applicationUser.pageData[routeData.CAPABILITY_QUESTIONS.name] = null;
|
||||||
},
|
},
|
||||||
resetSchedule(state) {
|
resetSchedule(state: RootState) {
|
||||||
state.order.schedule.date = null;
|
state.order.schedule.date = null;
|
||||||
state.order.schedule.startTime = null;
|
state.order.schedule.startTime = null;
|
||||||
state.order.schedule.endTime = null;
|
state.order.schedule.endTime = null;
|
||||||
|
|
@ -643,7 +655,7 @@ export const mutations = {
|
||||||
//premium appointment fee used on schedule page also needs reset when schedule is reset
|
//premium appointment fee used on schedule page also needs reset when schedule is reset
|
||||||
const supportingItems = state.order.lineItems.supportingItems;
|
const supportingItems = state.order.lineItems.supportingItems;
|
||||||
const premiumAppointmentFeeIndex = supportingItems?.findIndex(
|
const premiumAppointmentFeeIndex = supportingItems?.findIndex(
|
||||||
(item) => item.partType == PREMIUM_FEE_PART_TYPE
|
(item: { partType?: string }) => item.partType == PREMIUM_FEE_PART_TYPE
|
||||||
);
|
);
|
||||||
|
|
||||||
if (premiumAppointmentFeeIndex >= 0) {
|
if (premiumAppointmentFeeIndex >= 0) {
|
||||||
|
|
@ -651,16 +663,16 @@ export const mutations = {
|
||||||
state.order.lineItems.supportingItems = supportingItems;
|
state.order.lineItems.supportingItems = supportingItems;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
resetState(state) {
|
resetState(state: RootState) {
|
||||||
Object.assign(state, getDefaultState());
|
Object.assign(state, getDefaultState());
|
||||||
},
|
},
|
||||||
resetSaveSessionPromise(state) {
|
resetSaveSessionPromise(state: RootState) {
|
||||||
state.applicationUser.saveSessionPromise = null;
|
state.applicationUser.saveSessionPromise = null;
|
||||||
},
|
},
|
||||||
resetServiceLocationAppointmentType(state) {
|
resetServiceLocationAppointmentType(state: RootState) {
|
||||||
state.order.serviceLocation.appointmentType = null;
|
state.order.serviceLocation.appointmentType = null;
|
||||||
},
|
},
|
||||||
resetServiceLocationProvider(state) {
|
resetServiceLocationProvider(state: RootState) {
|
||||||
state.order.serviceLocation.provider = {
|
state.order.serviceLocation.provider = {
|
||||||
providerNumber: null,
|
providerNumber: null,
|
||||||
address: {
|
address: {
|
||||||
|
|
@ -672,37 +684,40 @@ export const mutations = {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
resetServiceLocationMobileAddress(state) {
|
resetServiceLocationMobileAddress(state: RootState) {
|
||||||
state.order.serviceLocation.address = null;
|
state.order.serviceLocation.address = null;
|
||||||
state.order.serviceLocation.address2 = null;
|
state.order.serviceLocation.address2 = null;
|
||||||
state.order.serviceLocation.city = null;
|
state.order.serviceLocation.city = null;
|
||||||
state.order.serviceLocation.state = null;
|
state.order.serviceLocation.state = null;
|
||||||
state.order.serviceLocation.isVehicleProtected = null;
|
state.order.serviceLocation.isVehicleProtected = null;
|
||||||
},
|
},
|
||||||
resetPaymentMethodChoice(state) {
|
resetPaymentMethodChoice(state: RootState) {
|
||||||
state.order.payment.isPia = null;
|
state.order.payment.isPia = null;
|
||||||
state.order.payment.piaType = null;
|
state.order.payment.piaType = null;
|
||||||
},
|
},
|
||||||
// Misc Mutations
|
// Misc Mutations
|
||||||
updateStateWithOrderInformation(state, sessionInformation) {
|
updateStateWithOrderInformation(
|
||||||
state.order.referralNumber = sessionInformation.order.referralNumber;
|
state: RootState,
|
||||||
state.order.referralSequenceNumber = sessionInformation.order.referralSequenceNumber;
|
sessionInformation: {
|
||||||
state.order.referralDate = sessionInformation.order.referralDate;
|
order?: Record<string, unknown>;
|
||||||
state.order.referralCorrelationId = sessionInformation.order.referralCorrelationId;
|
applicationUser?: Record<string, unknown>;
|
||||||
state.order.eon = sessionInformation.order.eon;
|
}
|
||||||
state.order.customerPortalLoginToken = sessionInformation.order.CustomerPortalLoginToken;
|
) {
|
||||||
state.order.isRecalAckOptIn = sessionInformation.order.isRecalAckOptIn;
|
// Session API has dynamic structure - FlexibleRecord allows nested access
|
||||||
state.order.workOrderId = sessionInformation.order.workOrderId
|
const order = (sessionInformation?.order ?? {}) as FlexibleRecord;
|
||||||
? sessionInformation.order.workOrderId
|
const applicationUser = (sessionInformation?.applicationUser ?? {}) as FlexibleRecord;
|
||||||
: null;
|
state.order.referralNumber = order.referralNumber as string | null;
|
||||||
state.order.workOrderNumber = sessionInformation.order.workOrderNumber
|
state.order.referralSequenceNumber = order.referralSequenceNumber as string | null;
|
||||||
? sessionInformation.order.workOrderNumber
|
state.order.referralDate = order.referralDate as string | null;
|
||||||
: null;
|
state.order.referralCorrelationId = order.referralCorrelationId;
|
||||||
state.order.lockToken = sessionInformation.order.lockToken
|
state.order.eon = order.eon;
|
||||||
? sessionInformation.order.lockToken
|
state.order.customerPortalLoginToken = order.CustomerPortalLoginToken;
|
||||||
: null;
|
state.order.isRecalAckOptIn = order.isRecalAckOptIn;
|
||||||
|
state.order.workOrderId = order.workOrderId ? order.workOrderId : null;
|
||||||
|
state.order.workOrderNumber = order.workOrderNumber ? order.workOrderNumber : null;
|
||||||
|
state.order.lockToken = order.lockToken ? order.lockToken : null;
|
||||||
|
|
||||||
if (state.order.vehicle.vin !== sessionInformation.order.vehicle?.vin) {
|
if (state.order.vehicle.vin !== order.vehicle?.vin) {
|
||||||
state.applicationUser.pageData[routeData.PART_QUESTIONS.name] = null;
|
state.applicationUser.pageData[routeData.PART_QUESTIONS.name] = null;
|
||||||
state.applicationUser.pageData[routeData.VEHICLE_PARTS.name] = null;
|
state.applicationUser.pageData[routeData.VEHICLE_PARTS.name] = null;
|
||||||
state.applicationUser.pageData[routeData.MOLDING_QUESTIONS.name] = null;
|
state.applicationUser.pageData[routeData.MOLDING_QUESTIONS.name] = null;
|
||||||
|
|
@ -710,162 +725,146 @@ export const mutations = {
|
||||||
}
|
}
|
||||||
|
|
||||||
state.order.vehicle = Object.assign(state.order.vehicle, {
|
state.order.vehicle = Object.assign(state.order.vehicle, {
|
||||||
year: sessionInformation.order.vehicle?.year,
|
year: order.vehicle?.year,
|
||||||
make: sessionInformation.order.vehicle?.make,
|
make: order.vehicle?.make,
|
||||||
model: sessionInformation.order.vehicle?.model,
|
model: order.vehicle?.model,
|
||||||
style: sessionInformation.order.vehicle?.style,
|
style: order.vehicle?.style,
|
||||||
vin: sessionInformation.order.vehicle?.vin,
|
vin: order.vehicle?.vin,
|
||||||
carId: sessionInformation.order.vehicle?.carId,
|
carId: order.vehicle?.carId,
|
||||||
category: sessionInformation.order.vehicle?.category,
|
category: order.vehicle?.category,
|
||||||
imageUrl: sessionInformation.order.vehicle?.imageUrl,
|
imageUrl: order.vehicle?.imageUrl,
|
||||||
imageVifNumber: sessionInformation.order.vehicle?.imageVifNumber,
|
imageVifNumber: order.vehicle?.imageVifNumber,
|
||||||
imageColor: sessionInformation.order.vehicle?.imageVifColor,
|
imageColor: order.vehicle?.imageVifColor,
|
||||||
vehicleSubType: sessionInformation.order.vehicle?.vehicleSubType,
|
vehicleSubType: order.vehicle?.vehicleSubType,
|
||||||
vehicleSpecialClass: sessionInformation.order.vehicle?.vehicleSpecialClass,
|
vehicleSpecialClass: order.vehicle?.vehicleSpecialClass,
|
||||||
isBigTruck: sessionInformation.order.vehicle?.isBigTruck,
|
isBigTruck: order.vehicle?.isBigTruck,
|
||||||
canSafeliteService: sessionInformation.order.vehicle?.canSafeliteService,
|
canSafeliteService: order.vehicle?.canSafeliteService,
|
||||||
});
|
});
|
||||||
|
|
||||||
state.order.damage.glassToReplace = sessionInformation.order.damage.glassToReplace;
|
state.order.damage.glassToReplace = order.damage.glassToReplace;
|
||||||
state.order.damage.isRepair = sessionInformation.order.damage.isRepair;
|
state.order.damage.isRepair = order.damage.isRepair;
|
||||||
state.order.damage.numberOfChips = sessionInformation.order.damage.numberOfChips;
|
state.order.damage.numberOfChips = order.damage.numberOfChips;
|
||||||
state.order.damage.dateOfLoss = sessionInformation.order.damage?.dateOfLoss;
|
state.order.damage.dateOfLoss = order.damage?.dateOfLoss;
|
||||||
state.order.damage.damageCause = sessionInformation.order.damage?.damageCause;
|
state.order.damage.damageCause = order.damage?.damageCause;
|
||||||
|
|
||||||
state.order.damage.partQuestionAnswers =
|
state.order.damage.partQuestionAnswers = order.damage.partQuestionAnswers;
|
||||||
sessionInformation.order.damage.partQuestionAnswers;
|
state.order.damage.moldingQuestionAnswers = order.damage.moldingQuestionAnswers;
|
||||||
state.order.damage.moldingQuestionAnswers =
|
state.order.damage.capabilityQuestionAnswers = order.damage.capabilityQuestionAnswers;
|
||||||
sessionInformation.order.damage.moldingQuestionAnswers;
|
|
||||||
state.order.damage.capabilityQuestionAnswers =
|
|
||||||
sessionInformation.order.damage.capabilityQuestionAnswers;
|
|
||||||
|
|
||||||
state.order.damage.installOemGlass = sessionInformation.order.damage.installOemGlass;
|
state.order.damage.installOemGlass = order.damage.installOemGlass;
|
||||||
|
|
||||||
state.order.lineItems.glassParts = sessionInformation.order.lineItems.glassParts;
|
state.order.lineItems.glassParts = order.lineItems.glassParts;
|
||||||
state.order.lineItems.supportingItems = sessionInformation.order.lineItems.supportingItems;
|
state.order.lineItems.supportingItems = order.lineItems.supportingItems;
|
||||||
state.order.lineItems.vaps = sessionInformation.order.lineItems.vaps ?? [];
|
state.order.lineItems.vaps = order.lineItems.vaps ?? [];
|
||||||
state.order.lineItems.promos = sessionInformation.order.lineItems.promos;
|
state.order.lineItems.promos = order.lineItems.promos;
|
||||||
state.order.lineItems.serverData = sessionInformation.order.lineItems.serverData;
|
state.order.lineItems.serverData = order.lineItems.serverData;
|
||||||
|
|
||||||
state.order.payment.parentAccountNumber =
|
state.order.payment.parentAccountNumber = order.payment.parentAccountNumber;
|
||||||
sessionInformation.order.payment.parentAccountNumber;
|
state.order.payment.billToAccountNumber = order.payment.billToAccountNumber;
|
||||||
state.order.payment.billToAccountNumber =
|
state.order.payment.inactivePromos = order.payment.inactivePromos;
|
||||||
sessionInformation.order.payment.billToAccountNumber;
|
|
||||||
state.order.payment.inactivePromos = sessionInformation.order.payment.inactivePromos;
|
|
||||||
|
|
||||||
//Do not assign default service type once user make service type selection
|
//Do not assign default service type once user make service type selection
|
||||||
if (state.order.serviceLocation.appointmentType == null) {
|
if (state.order.serviceLocation.appointmentType == null) {
|
||||||
state.order.serviceLocation.address =
|
state.order.serviceLocation.address = order.serviceLocation.streetAddress;
|
||||||
sessionInformation.order.serviceLocation.streetAddress;
|
state.order.serviceLocation.address2 = order.serviceLocation.streetAddress2;
|
||||||
state.order.serviceLocation.address2 =
|
state.order.serviceLocation.city = order.serviceLocation.city;
|
||||||
sessionInformation.order.serviceLocation.streetAddress2;
|
state.order.serviceLocation.state = order.serviceLocation.state;
|
||||||
state.order.serviceLocation.city = sessionInformation.order.serviceLocation.city;
|
state.order.serviceLocation.zipCode = order.serviceLocation.zipCode;
|
||||||
state.order.serviceLocation.state = sessionInformation.order.serviceLocation.state;
|
state.order.serviceLocation.zipCodeCtu = order.serviceLocation.zipCodeCtu;
|
||||||
state.order.serviceLocation.zipCode = sessionInformation.order.serviceLocation.zipCode;
|
|
||||||
state.order.serviceLocation.zipCodeCtu =
|
|
||||||
sessionInformation.order.serviceLocation.zipCodeCtu;
|
|
||||||
|
|
||||||
state.order.serviceLocation.appointmentType =
|
state.order.serviceLocation.appointmentType = order.serviceLocation.appointmentType;
|
||||||
sessionInformation.order.serviceLocation.appointmentType;
|
|
||||||
state.order.serviceLocation.isVehicleProtected =
|
state.order.serviceLocation.isVehicleProtected =
|
||||||
sessionInformation.order.serviceLocation.isVehicleProtected;
|
order.serviceLocation.isVehicleProtected;
|
||||||
|
|
||||||
state.order.serviceLocation.provider.providerNumber =
|
state.order.serviceLocation.provider.providerNumber =
|
||||||
sessionInformation.order.serviceLocation.provider?.providerNumber;
|
order.serviceLocation.provider?.providerNumber;
|
||||||
state.order.serviceLocation.provider.address.streetAddress =
|
state.order.serviceLocation.provider.address.streetAddress =
|
||||||
sessionInformation.order.serviceLocation.provider?.address?.streetAddress;
|
order.serviceLocation.provider?.address?.streetAddress;
|
||||||
state.order.serviceLocation.provider.address.city =
|
state.order.serviceLocation.provider.address.city =
|
||||||
sessionInformation.order.serviceLocation.provider?.address?.city;
|
order.serviceLocation.provider?.address?.city;
|
||||||
state.order.serviceLocation.provider.address.state =
|
state.order.serviceLocation.provider.address.state =
|
||||||
sessionInformation.order.serviceLocation.provider?.address?.state;
|
order.serviceLocation.provider?.address?.state;
|
||||||
state.order.serviceLocation.provider.address.zipCode =
|
state.order.serviceLocation.provider.address.zipCode =
|
||||||
sessionInformation.order.serviceLocation.provider?.address?.zipCode;
|
order.serviceLocation.provider?.address?.zipCode;
|
||||||
state.order.serviceLocation.provider.address.zipCodeCtu =
|
state.order.serviceLocation.provider.address.zipCodeCtu =
|
||||||
sessionInformation.order.serviceLocation.provider?.address?.zipCodeCtu;
|
order.serviceLocation.provider?.address?.zipCodeCtu;
|
||||||
state.order.serviceLocation.techNotes =
|
state.order.serviceLocation.techNotes = order.serviceLocation.techNotes;
|
||||||
sessionInformation.order.serviceLocation.techNotes;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// if we're loading a session and we do not have a provider number yet, then set isInsurance to null so that
|
// if we're loading a session and we do not have a provider number yet, then set isInsurance to null so that
|
||||||
// a service package is not selected by default on the quote page.
|
// a service package is not selected by default on the quote page.
|
||||||
if (
|
if (
|
||||||
(sessionInformation.order.payment.isInsurance === null ||
|
(order.payment.isInsurance === null || order.payment.isInsurance === undefined) &&
|
||||||
sessionInformation.order.payment.isInsurance === undefined) &&
|
!order.serviceLocation.provider?.providerNumber
|
||||||
!sessionInformation.order.serviceLocation.provider?.providerNumber
|
|
||||||
) {
|
) {
|
||||||
state.order.payment.isInsurance = null;
|
state.order.payment.isInsurance = null;
|
||||||
} else {
|
} else {
|
||||||
state.order.payment.isInsurance = sessionInformation.order.payment.isInsurance;
|
state.order.payment.isInsurance = order.payment.isInsurance;
|
||||||
}
|
}
|
||||||
|
|
||||||
state.order.payment.insuranceCoverage.isVerified =
|
state.order.payment.insuranceCoverage.isVerified =
|
||||||
coverageStatusValue(sessionInformation?.order.insuranceCoverage.coverageStatus) ===
|
coverageStatusValue(order.insuranceCoverage.coverageStatus) === coverageStatus.VERIFIED
|
||||||
coverageStatus.VERIFIED
|
|
||||||
? true
|
? true
|
||||||
: false;
|
: false;
|
||||||
state.order.payment.insuranceCoverage.coverageStatus = coverageStatusValue(
|
state.order.payment.insuranceCoverage.coverageStatus = coverageStatusValue(
|
||||||
sessionInformation?.order.insuranceCoverage.coverageStatus
|
order.insuranceCoverage.coverageStatus
|
||||||
);
|
);
|
||||||
state.order.payment.insuranceCoverage.coverageSubStatus =
|
state.order.payment.insuranceCoverage.coverageSubStatus =
|
||||||
sessionInformation?.order.insuranceCoverage.coverageSubStatus;
|
order.insuranceCoverage.coverageSubStatus;
|
||||||
state.order.payment.insuranceCoverage.coverageType = coverageTypeValue(
|
state.order.payment.insuranceCoverage.coverageType = coverageTypeValue(
|
||||||
sessionInformation?.order.insuranceCoverage.coverageType
|
order.insuranceCoverage.coverageType
|
||||||
);
|
);
|
||||||
state.order.payment.insuranceCoverage.coverageVerificationType =
|
state.order.payment.insuranceCoverage.coverageVerificationType =
|
||||||
sessionInformation?.order.insuranceCoverage.coverageVerificationType;
|
order.insuranceCoverage.coverageVerificationType;
|
||||||
|
|
||||||
state.order.customer.emailAddress = sessionInformation.order.customer.emailAddress;
|
state.order.customer.emailAddress = order.customer.emailAddress;
|
||||||
state.order.customer.firstName = sessionInformation.order.customer.firstName;
|
state.order.customer.firstName = order.customer.firstName;
|
||||||
state.order.customer.lastName = sessionInformation.order.customer.lastName;
|
state.order.customer.lastName = order.customer.lastName;
|
||||||
state.order.customer.phoneNumber = sessionInformation.order.customer.homePhone;
|
state.order.customer.phoneNumber = order.customer.homePhone;
|
||||||
state.order.customer.isSmsOptIn = sessionInformation.order.customer.isSmsOptIn;
|
state.order.customer.isSmsOptIn = order.customer.isSmsOptIn;
|
||||||
|
|
||||||
state.applicationUser.experiments = sessionInformation.applicationUser.experiments;
|
state.applicationUser.experiments = applicationUser.experiments;
|
||||||
state.applicationUser.crmCustomerId = sessionInformation.applicationUser.crmCustomerId;
|
state.applicationUser.crmCustomerId = applicationUser.crmCustomerId;
|
||||||
state.applicationUser.pageData = sessionInformation.applicationUser.pageData;
|
state.applicationUser.pageData = applicationUser.pageData;
|
||||||
state.applicationUser.lastPage = sessionInformation.applicationUser.lastPage;
|
state.applicationUser.lastPageVisited = applicationUser.lastPage as string | null;
|
||||||
|
|
||||||
if (sessionInformation.applicationUser.savedSessionId) {
|
if (applicationUser.savedSessionId) {
|
||||||
state.applicationUser.savedSessionId =
|
state.applicationUser.savedSessionId = applicationUser.savedSessionId;
|
||||||
sessionInformation.applicationUser.savedSessionId;
|
|
||||||
}
|
}
|
||||||
//Do not assign default schedule details once user make schedule selection
|
//Do not assign default schedule details once user make schedule selection
|
||||||
if (state.order.schedule.date == null) {
|
if (state.order.schedule.date == null) {
|
||||||
state.order.schedule.date = sessionInformation.order.schedule?.date;
|
state.order.schedule.date = order.schedule?.date;
|
||||||
state.order.schedule.startTime = sessionInformation.order.schedule?.startTime;
|
state.order.schedule.startTime = order.schedule?.startTime;
|
||||||
state.order.schedule.endTime = sessionInformation.order.schedule?.endTime;
|
state.order.schedule.endTime = order.schedule?.endTime;
|
||||||
state.order.schedule.routeCode = sessionInformation.order.schedule?.routeCode;
|
state.order.schedule.routeCode = order.schedule?.routeCode;
|
||||||
state.order.schedule.jobMaxMinutes = sessionInformation.order.schedule?.jobMaxMinutes;
|
state.order.schedule.jobMaxMinutes = order.schedule?.jobMaxMinutes;
|
||||||
state.order.schedule.jobMinMinutes = sessionInformation.order.schedule?.jobMinMinutes;
|
state.order.schedule.jobMinMinutes = order.schedule?.jobMinMinutes;
|
||||||
}
|
}
|
||||||
state.order.policy.currentDeductible = sessionInformation.order.policy?.currentDeductible;
|
state.order.policy.currentDeductible = order.policy?.currentDeductible;
|
||||||
state.order.policy.originalDeductible = sessionInformation.order.policy?.originalDeductible;
|
state.order.policy.originalDeductible = order.policy?.originalDeductible;
|
||||||
state.order.policy.additionalAuthFlag = sessionInformation.order.policy?.additionalAuthFlag;
|
state.order.policy.additionalAuthFlag = order.policy?.additionalAuthFlag;
|
||||||
state.order.policy.isItac =
|
state.order.policy.isItac =
|
||||||
coverageTypeValue(sessionInformation?.order.insuranceCoverage.coverageType) ===
|
coverageTypeValue(order.insuranceCoverage.coverageType) === coverageType.ITAC
|
||||||
coverageType.ITAC
|
|
||||||
? true
|
? true
|
||||||
: false;
|
: false;
|
||||||
state.order.policy.policyNumber = sessionInformation.order.policy?.policyNumber;
|
state.order.policy.policyNumber = order.policy?.policyNumber;
|
||||||
state.order.policy.insuranceCompanyName =
|
state.order.policy.insuranceCompanyName = order.policy?.insuranceCompanyName;
|
||||||
sessionInformation.order.policy?.insuranceCompanyName;
|
|
||||||
state.order.policy.isNoComp =
|
state.order.policy.isNoComp =
|
||||||
coverageTypeValue(sessionInformation?.order.insuranceCoverage.coverageType) ===
|
coverageTypeValue(order.insuranceCoverage.coverageType) === coverageType.NOCOMP
|
||||||
coverageType.NOCOMP
|
|
||||||
? true
|
? true
|
||||||
: false;
|
: false;
|
||||||
sessionInformation.order.policy?.noComprehensive;
|
order.policy?.noComprehensive;
|
||||||
},
|
},
|
||||||
updateExperiments(state, experiments) {
|
updateExperiments(state: RootState, experiments: unknown[]) {
|
||||||
state.applicationUser.experiments = experiments;
|
state.applicationUser.experiments = experiments;
|
||||||
},
|
},
|
||||||
updateTriggeredSiteEntry(state, wasSiteEntryTriggered) {
|
updateTriggeredSiteEntry(state: RootState, wasSiteEntryTriggered: boolean) {
|
||||||
state.applicationUser.triggeredSiteEntry = wasSiteEntryTriggered;
|
state.applicationUser.triggeredSiteEntry = wasSiteEntryTriggered;
|
||||||
},
|
},
|
||||||
updateAffiliateCookies(state, affiliateCookies) {
|
updateAffiliateCookies(state: RootState, affiliateCookies: unknown[]) {
|
||||||
state.applicationUser.affiliateCookies = affiliateCookies;
|
state.applicationUser.affiliateCookies = affiliateCookies;
|
||||||
},
|
},
|
||||||
updateHasTriggeredError(state, hasTriggeredError) {
|
updateHasTriggeredError(state: RootState, hasTriggeredError: boolean) {
|
||||||
state.applicationUser.hasAlreadyTriggeredError = hasTriggeredError;
|
state.applicationUser.hasAlreadyTriggeredError = hasTriggeredError;
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,10 @@
|
||||||
* Mirrors the structure from getDefaultState() in store/index.ts
|
* Mirrors the structure from getDefaultState() in store/index.ts
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/** Permissive type for API responses with dynamic structure - allows nested property access */
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
|
export type FlexibleRecord = { [key: string]: any };
|
||||||
|
|
||||||
export interface VehicleRegistration {
|
export interface VehicleRegistration {
|
||||||
licensePlate: string | null;
|
licensePlate: string | null;
|
||||||
}
|
}
|
||||||
|
|
@ -44,6 +48,68 @@ export interface RegistrationUpdatePayload {
|
||||||
licensePlate?: string | null;
|
licensePlate?: string | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Payload for updateServiceZip mutation */
|
||||||
|
export interface ServiceZipUpdatePayload {
|
||||||
|
state?: string | null;
|
||||||
|
zipCode?: string | null;
|
||||||
|
zipCodeCtu?: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Payload for updateServiceLocation mutation */
|
||||||
|
export interface ServiceLocationUpdatePayload {
|
||||||
|
address?: string | null;
|
||||||
|
address2?: string | null;
|
||||||
|
city?: string | null;
|
||||||
|
state?: string | null;
|
||||||
|
zipCode?: string | null;
|
||||||
|
zipCodeCtu?: string | null;
|
||||||
|
appointmentType?: string | null;
|
||||||
|
isVehicleProtected?: boolean | null;
|
||||||
|
provider?: {
|
||||||
|
providerNumber?: string | null;
|
||||||
|
address?: Partial<ProviderAddress>;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Payload for updateMobileDetails mutation */
|
||||||
|
export interface MobileDetailsUpdatePayload {
|
||||||
|
address?: string | null;
|
||||||
|
address2?: string | null;
|
||||||
|
city?: string | null;
|
||||||
|
isVehicleProtected?: boolean | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Payload for updateSchedule mutation */
|
||||||
|
export interface ScheduleUpdatePayload {
|
||||||
|
date?: string | null;
|
||||||
|
startTime?: string | null;
|
||||||
|
endTime?: string | null;
|
||||||
|
routeCode?: string | null;
|
||||||
|
jobMaxMinutes?: number | null;
|
||||||
|
jobMinMinutes?: number | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Payload for updateCustomerDetails mutation */
|
||||||
|
export interface CustomerDetailsUpdatePayload {
|
||||||
|
firstName?: string | null;
|
||||||
|
lastName?: string | null;
|
||||||
|
emailAddress?: string | null;
|
||||||
|
phoneNumber?: string | null;
|
||||||
|
isSmsOptIn?: boolean | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Payload for updatePageData mutation */
|
||||||
|
export interface PageDataUpdatePayload {
|
||||||
|
page: string;
|
||||||
|
data: unknown;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Payload for addEventToBus / removeEventFromBus */
|
||||||
|
export interface EventBusEventPayload {
|
||||||
|
category: string;
|
||||||
|
subCategory: string;
|
||||||
|
}
|
||||||
|
|
||||||
export interface ProviderAddress {
|
export interface ProviderAddress {
|
||||||
streetAddress: string | null;
|
streetAddress: string | null;
|
||||||
city: string | null;
|
city: string | null;
|
||||||
|
|
@ -122,6 +188,22 @@ export interface CcTokenState {
|
||||||
lastFour: string | null;
|
lastFour: string | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Payload for updateCCToken mutation */
|
||||||
|
export interface CcTokenUpdatePayload {
|
||||||
|
subscriptionId?: string | null;
|
||||||
|
expMonth?: string | null;
|
||||||
|
expYear?: string | null;
|
||||||
|
cardType?: string | null;
|
||||||
|
billToPostalCode?: string | null;
|
||||||
|
billToFirstName?: string | null;
|
||||||
|
billToLastName?: string | null;
|
||||||
|
referenceNumber?: string | null;
|
||||||
|
authCode?: string | null;
|
||||||
|
transactionId?: string | null;
|
||||||
|
transReferenceNumber?: string | null;
|
||||||
|
lastFour?: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
export interface PaymentState {
|
export interface PaymentState {
|
||||||
isInsurance: boolean | null;
|
isInsurance: boolean | null;
|
||||||
insuranceCoverage: InsuranceCoverageState;
|
insuranceCoverage: InsuranceCoverageState;
|
||||||
|
|
@ -176,6 +258,7 @@ export interface OrderState {
|
||||||
isRecalAckOptIn: boolean;
|
isRecalAckOptIn: boolean;
|
||||||
isRecalAcknowledgedForScheduling: string;
|
isRecalAcknowledgedForScheduling: string;
|
||||||
isMSRFeeApplicable: boolean;
|
isMSRFeeApplicable: boolean;
|
||||||
|
cashPriceSubTotal?: string | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ApplicationUserState {
|
export interface ApplicationUserState {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue