Merge branch 'revert-415-revert-411-feature/CSR-416' into feature/CSR-416
This commit is contained in:
commit
e9524018bf
8 changed files with 105 additions and 25 deletions
|
|
@ -22,6 +22,7 @@ const storeActions = {
|
||||||
LOG_PAGE_VIEW: "logPageView",
|
LOG_PAGE_VIEW: "logPageView",
|
||||||
LOG_CUSTOM_EVENT: "logCustomEvent",
|
LOG_CUSTOM_EVENT: "logCustomEvent",
|
||||||
GET_EXPERIMENTS_BY_USER: "GetExperimentsByUser",
|
GET_EXPERIMENTS_BY_USER: "GetExperimentsByUser",
|
||||||
|
UPDATE_SERVICE_LOCATION_WITH_VEHICLE_REGISTRATION: "updateServiceLocationWithVehicleRegistration",
|
||||||
|
|
||||||
// DEPENDENCY MUTATIONS
|
// DEPENDENCY MUTATIONS
|
||||||
RESET_VEHICLE_STATE_AND_DEPENDENCIES: "resetVehicleAndDependencies",
|
RESET_VEHICLE_STATE_AND_DEPENDENCIES: "resetVehicleAndDependencies",
|
||||||
|
|
|
||||||
|
|
@ -44,8 +44,8 @@ const storeMutations = {
|
||||||
|
|
||||||
// OTHER MUTATIONS
|
// OTHER MUTATIONS
|
||||||
UPDATE_PAGE_DATA: "updatePageData",
|
UPDATE_PAGE_DATA: "updatePageData",
|
||||||
UPDATE_STATE_WITH_ORDER_INFORMATION: "updateStateWithOrderInformation"
|
UPDATE_STATE_WITH_ORDER_INFORMATION: "updateStateWithOrderInformation",
|
||||||
|
UPDATE_SERVICE_LOCATION_WITH_VEHICLE_REGISTRATION: "updateServiceLocationWithVehicleRegistration"
|
||||||
};
|
};
|
||||||
|
|
||||||
export { storeMutations };
|
export { storeMutations };
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,10 @@ import { externalUrls } from "@/router/router-constants/externalUrl-values";
|
||||||
import { lazyLoadComponent } from "@/router/dynamic-routing/component-loader.js";
|
import { lazyLoadComponent } from "@/router/dynamic-routing/component-loader.js";
|
||||||
import { saveOrder } from "@/helpers/heritage-integration/order-helper.js";
|
import { saveOrder } from "@/helpers/heritage-integration/order-helper.js";
|
||||||
import { fmgPageValues } from "@/router/router-constants/fmgPage-values";
|
import { fmgPageValues } from "@/router/router-constants/fmgPage-values";
|
||||||
|
import { storeActions } from "@/constants/store-actions";
|
||||||
import store from "@/store";
|
import store from "@/store";
|
||||||
import router from "@/router";
|
import router from "@/router";
|
||||||
|
import baseMixin from "@/mixins/base-mixin.js";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
If the user has visited the funnel before this method will determine the bets place to
|
If the user has visited the funnel before this method will determine the bets place to
|
||||||
|
|
@ -12,7 +14,6 @@ import router from "@/router";
|
||||||
the user has an existing order and they come back in from the Safelite.com CTA.
|
the user has an existing order and they come back in from the Safelite.com CTA.
|
||||||
*/
|
*/
|
||||||
export async function getPageToRouteExistingOrderTo(toRoute = {}, existingHeritageOrder = false) {
|
export async function getPageToRouteExistingOrderTo(toRoute = {}, existingHeritageOrder = false) {
|
||||||
|
|
||||||
// If the user is coming in via the Safelite.Com CTA
|
// If the user is coming in via the Safelite.Com CTA
|
||||||
if (toRoute.query[queryStrings.START_TYPE] === 'fmg') {
|
if (toRoute.query[queryStrings.START_TYPE] === 'fmg') {
|
||||||
// If they have an existing order, return 'heritage' for the page name.
|
// If they have an existing order, return 'heritage' for the page name.
|
||||||
|
|
@ -56,6 +57,9 @@ export async function navigateToHeritageFunnel() {
|
||||||
export async function navigateAfterSaveToHeritageFunnel(currentRoute) {
|
export async function navigateAfterSaveToHeritageFunnel(currentRoute) {
|
||||||
const currentComponent = currentRoute.matched[0].components;
|
const currentComponent = currentRoute.matched[0].components;
|
||||||
currentComponent.default.methods.resetDependentState();
|
currentComponent.default.methods.resetDependentState();
|
||||||
|
|
||||||
|
setupOrderBeforeSave();
|
||||||
|
|
||||||
// Create the order (or save existing order) when navigating to Heritage Funnel.
|
// Create the order (or save existing order) when navigating to Heritage Funnel.
|
||||||
await saveOrder();
|
await saveOrder();
|
||||||
|
|
||||||
|
|
@ -141,3 +145,13 @@ function isVinRelatedPage(toRoute) {
|
||||||
fmgPageValue === fmgPageValues.ADDRESS_VEHICLES ||
|
fmgPageValue === fmgPageValues.ADDRESS_VEHICLES ||
|
||||||
fmgPageValue === fmgPageValues.ESTIMATE;
|
fmgPageValue === fmgPageValues.ESTIMATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setupOrderBeforeSave() {
|
||||||
|
const serviceLocation = store.getters.order.serviceLocation;
|
||||||
|
|
||||||
|
if (!serviceLocation.zipCode && serviceLocation.zipCode == store.getters.vehicle.registration.zipCode) {
|
||||||
|
baseMixin.methods.dispatchStoreAction(
|
||||||
|
storeActions.UPDATE_SERVICE_LOCATION_WITH_VEHICLE_REGISTRATION
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -87,8 +87,6 @@ import { required } from "@/helpers/validation-rules";
|
||||||
import { errorMessages } from "@/constants/error-messages";
|
import { errorMessages } from "@/constants/error-messages";
|
||||||
import { damageLocationsCms } from "@/constants/damage-locations-cms.js";
|
import { damageLocationsCms } from "@/constants/damage-locations-cms.js";
|
||||||
import { damageLocationsSelected } from "@/constants/damage-locations-selected.js";
|
import { damageLocationsSelected } from "@/constants/damage-locations-selected.js";
|
||||||
import { navigateToHeritageFunnel } from "@/helpers/heritage-integration/navigation-helper";
|
|
||||||
import { queryStrings } from "@/constants/query-strings";
|
|
||||||
|
|
||||||
import store from "@/store";
|
import store from "@/store";
|
||||||
import baseMixin from "@/mixins/base-mixin";
|
import baseMixin from "@/mixins/base-mixin";
|
||||||
|
|
|
||||||
|
|
@ -273,7 +273,12 @@ export default {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
backButtonAction() {
|
backButtonAction() {
|
||||||
this.$router.navigate(this.navigationScenarios.CLICKED_BACK, this.$route);
|
if (store.getters.vehicle.vin) {
|
||||||
|
this.$router.navigate(this.navigationScenarios.CLICKED_BACK_WITH_VIN, this.$route);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.$router.navigate(this.navigationScenarios.CLICKED_BACK, this.$route);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
async forwardButtonAction() {
|
async forwardButtonAction() {
|
||||||
const zipValidation = this.validateZip(this.zip);
|
const zipValidation = this.validateZip(this.zip);
|
||||||
|
|
|
||||||
|
|
@ -107,6 +107,10 @@ const routingTable = [
|
||||||
{
|
{
|
||||||
scenario: navigationScenarios.CLICKED_FORWARD,
|
scenario: navigationScenarios.CLICKED_FORWARD,
|
||||||
destinationFmgPageValue: fmgPageValues.VEHICLE_DAMAGE,
|
destinationFmgPageValue: fmgPageValues.VEHICLE_DAMAGE,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
scenario: navigationScenarios.CLICKED_BACK_WITH_VIN,
|
||||||
|
destinationFmgPageValue: fmgPageValues.VEHICLE_DAMAGE,
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,9 @@ const getDefaultState = () => {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
serviceLocation: {
|
serviceLocation: {
|
||||||
|
address: null,
|
||||||
|
city: null,
|
||||||
|
state: null,
|
||||||
zipCode: null,
|
zipCode: null,
|
||||||
},
|
},
|
||||||
customer: {
|
customer: {
|
||||||
|
|
@ -227,18 +230,39 @@ export const mutations = {
|
||||||
imageUrl: orderInformation.vehicle?.imageUrl,
|
imageUrl: orderInformation.vehicle?.imageUrl,
|
||||||
imageVifNumber: orderInformation.vehicle?.imageVifNumber,
|
imageVifNumber: orderInformation.vehicle?.imageVifNumber,
|
||||||
imageColor: orderInformation.vehicle?.imageVifColor,
|
imageColor: orderInformation.vehicle?.imageVifColor,
|
||||||
|
registration: {
|
||||||
|
firstName: orderInformation.vehicle.registration.firstName,
|
||||||
|
lastName: orderInformation.vehicle.registration.lastName,
|
||||||
|
address: orderInformation.vehicle.registration.streetAddress,
|
||||||
|
city: orderInformation.vehicle.registration.city,
|
||||||
|
state: orderInformation.vehicle.registration.state,
|
||||||
|
zipCode: orderInformation.vehicle.registration.zipCode,
|
||||||
|
licensePlate: orderInformation.vehicle.registration.licensePlate,
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
state.order.damage.glassToReplace = orderInformation.glassToReplace;
|
state.order.damage.glassToReplace = orderInformation.damage.glassToReplace;
|
||||||
state.order.damage.isRepair = orderInformation.isRepair;
|
state.order.damage.isRepair = orderInformation.damage.isRepair;
|
||||||
state.order.damage.numberOfChips = orderInformation.numberOfChips;
|
state.order.damage.numberOfChips = orderInformation.damage.numberOfChips;
|
||||||
|
|
||||||
state.order.lineItems.glassParts = orderInformation.parts;
|
state.order.lineItems.glassParts = orderInformation.parts;
|
||||||
state.order.accountNumber = orderInformation.accountNumber;
|
state.order.accountNumber = orderInformation.accountNumber;
|
||||||
state.order.serviceLocation.zipCode = orderInformation.zipCode;
|
state.order.serviceLocation.address = orderInformation.serviceLocation.streetAddress,
|
||||||
|
state.order.serviceLocation.city = orderInformation.serviceLocation.city,
|
||||||
|
state.order.serviceLocation.state = orderInformation.serviceLocation.state,
|
||||||
|
state.order.serviceLocation.zipCode = orderInformation.serviceLocation.zipCode;
|
||||||
|
|
||||||
state.order.payment.isInsurance = orderInformation.IsInsuranceOrder;
|
state.order.payment.isInsurance = orderInformation.IsInsuranceOrder;
|
||||||
state.order.payment.insuranceCoverage.isVerified = orderInformation?.insuranceInfo.coverageVerified;
|
state.order.payment.insuranceCoverage.isVerified = orderInformation?.insuranceInfo.coverageVerified;
|
||||||
|
|
||||||
|
state.order.customer.emailAddress = orderInformation.customer.emailAddress;
|
||||||
|
},
|
||||||
|
|
||||||
|
updateServiceLocationWithVehicleRegistration(state) {
|
||||||
|
state.order.serviceLocation.address = state.order.vehicle.registration.address;
|
||||||
|
state.order.serviceLocation.city = state.order.vehicle.registration.city;
|
||||||
|
state.order.serviceLocation.state = state.order.vehicle.registration.state;
|
||||||
|
state.order.serviceLocation.zipCode = state.order.vehicle.registration.zipCode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -419,6 +443,9 @@ export const actions = {
|
||||||
context.commit(storeMutations.UPDATE_REFERRAL_DATE, referralDate);
|
context.commit(storeMutations.UPDATE_REFERRAL_DATE, referralDate);
|
||||||
context.commit(storeMutations.UPDATE_REFERRAL_CORRELATION_ID, referralCorrelationId);
|
context.commit(storeMutations.UPDATE_REFERRAL_CORRELATION_ID, referralCorrelationId);
|
||||||
},
|
},
|
||||||
|
updateServiceLocationWithVehicleRegistration(context) {
|
||||||
|
context.commit(storeMutations.UPDATE_SERVICE_LOCATION_WITH_VEHICLE_REGISTRATION);
|
||||||
|
},
|
||||||
|
|
||||||
logExperimentExposure(context, { userId, sessionKey, pageName, universeName }) {
|
logExperimentExposure(context, { userId, sessionKey, pageName, universeName }) {
|
||||||
return globalMethods.callHttpClient({
|
return globalMethods.callHttpClient({
|
||||||
|
|
@ -502,6 +529,7 @@ export const actions = {
|
||||||
saveOrder(context) {
|
saveOrder(context) {
|
||||||
const vehicle = context.getters.vehicle;
|
const vehicle = context.getters.vehicle;
|
||||||
const damage = context.getters.damage;
|
const damage = context.getters.damage;
|
||||||
|
const order = context.state.order;
|
||||||
|
|
||||||
return globalMethods.callHttpClient({
|
return globalMethods.callHttpClient({
|
||||||
method: endpoints.SaveOrder.method,
|
method: endpoints.SaveOrder.method,
|
||||||
|
|
@ -513,14 +541,34 @@ export const actions = {
|
||||||
make: vehicle.make,
|
make: vehicle.make,
|
||||||
model: vehicle.model,
|
model: vehicle.model,
|
||||||
style: vehicle.style,
|
style: vehicle.style,
|
||||||
vin: vehicle.vin
|
vin: vehicle.vin,
|
||||||
|
registration: {
|
||||||
|
firstName: vehicle.registration.firstName,
|
||||||
|
lastName: vehicle.registration.lastName,
|
||||||
|
streetAddress: vehicle.registration.address,
|
||||||
|
city: vehicle.registration.city,
|
||||||
|
state: vehicle.registration.state,
|
||||||
|
zipCode: vehicle.registration.zipCode,
|
||||||
|
licensePlateNumber: vehicle.registration.licensePlate,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
numberOfChips: damage.numberOfChips,
|
damage: {
|
||||||
zipCode: 43215, // TODO CSR-416, should not be hardcoded (state.order.serviceLocation.zipCode)
|
numberOfChips: damage.numberOfChips,
|
||||||
glassToReplace: damage.glassToReplace,
|
glassToReplace: damage.glassToReplace,
|
||||||
referralNumber: context.state.order.referralNumber,
|
isRepair: damage.isRepair
|
||||||
referralDate: context.state.order.referralDate,
|
},
|
||||||
accountNumber: context.state.order.accountNumber
|
customer: {
|
||||||
|
emailAddress: order.customer.emailAddress,
|
||||||
|
},
|
||||||
|
serviceLocation: {
|
||||||
|
streetAddress: order.serviceLocation.address,
|
||||||
|
city: order.serviceLocation.city,
|
||||||
|
state: order.serviceLocation.state,
|
||||||
|
zipCode: order.serviceLocation.zipCode
|
||||||
|
},
|
||||||
|
referralNumber: order.referralNumber,
|
||||||
|
referralDate: order.referralDate,
|
||||||
|
accountNumber: order.accountNumber
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -215,14 +215,19 @@ describe("Mutations", () => {
|
||||||
model: "ILX",
|
model: "ILX",
|
||||||
style: "4 DOOR SEDAN",
|
style: "4 DOOR SEDAN",
|
||||||
carId: "C0000001",
|
carId: "C0000001",
|
||||||
category: "CAR"
|
category: "CAR",
|
||||||
|
registration: {}
|
||||||
|
},
|
||||||
|
damage: {
|
||||||
|
glassToReplace: ["Windshield"],
|
||||||
|
isRepair: false,
|
||||||
|
numberOfChips: 0,
|
||||||
},
|
},
|
||||||
glassToReplace: ["Windshield"],
|
|
||||||
isRepair: false,
|
|
||||||
numberOfChips: 0,
|
|
||||||
parts: [],
|
parts: [],
|
||||||
accountNumber: "123456789",
|
accountNumber: "123456789",
|
||||||
insuranceInfo: {}
|
insuranceInfo: {},
|
||||||
|
serviceLocation: {},
|
||||||
|
customer: {}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
|
|
@ -562,11 +567,16 @@ describe("Actions", () => {
|
||||||
const context = state;
|
const context = state;
|
||||||
|
|
||||||
context.getters = {
|
context.getters = {
|
||||||
vehicle: {},
|
vehicle: {
|
||||||
|
registration: {}
|
||||||
|
},
|
||||||
damage: {},
|
damage: {},
|
||||||
};
|
};
|
||||||
context.state = {
|
context.state = {
|
||||||
order: {}
|
order: {
|
||||||
|
serviceLocation: {},
|
||||||
|
customer: {}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
globalMethods.callHttpClient.mockImplementation(() => {
|
globalMethods.callHttpClient.mockImplementation(() => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue