Revert "Feature/csr 416"

This commit is contained in:
katieoh-safelite 2022-05-11 08:12:37 -04:00 committed by GitHub
parent 53aaa14b6c
commit 825b50505e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 26 additions and 106 deletions

View file

@ -22,7 +22,6 @@ const storeActions = {
LOG_PAGE_VIEW: "logPageView",
LOG_CUSTOM_EVENT: "logCustomEvent",
GET_EXPERIMENTS_BY_USER: "GetExperimentsByUser",
UPDATE_SERVICE_LOCATION_WITH_VEHICLE_REGISTRATION: "updateServiceLocationWithVehicleRegistration",
// DEPENDENCY MUTATIONS
RESET_VEHICLE_STATE_AND_DEPENDENCIES: "resetVehicleAndDependencies",

View file

@ -44,8 +44,8 @@ const storeMutations = {
// OTHER MUTATIONS
UPDATE_PAGE_DATA: "updatePageData",
UPDATE_STATE_WITH_ORDER_INFORMATION: "updateStateWithOrderInformation",
UPDATE_SERVICE_LOCATION_WITH_VEHICLE_REGISTRATION: "updateServiceLocationWithVehicleRegistration"
UPDATE_STATE_WITH_ORDER_INFORMATION: "updateStateWithOrderInformation"
};
export { storeMutations };

View file

@ -3,10 +3,8 @@ import { externalUrls } from "@/router/router-constants/externalUrl-values";
import { lazyLoadComponent } from "@/router/dynamic-routing/component-loader.js";
import { saveOrder } from "@/helpers/heritage-integration/order-helper.js";
import { fmgPageValues } from "@/router/router-constants/fmgPage-values";
import { storeActions } from "@/constants/store-actions";
import store from "@/store";
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
@ -14,6 +12,7 @@ import baseMixin from "@/mixins/base-mixin.js";
the user has an existing order and they come back in from the Safelite.com CTA.
*/
export async function getPageToRouteExistingOrderTo(toRoute = {}, existingHeritageOrder = false) {
// If the user is coming in via the Safelite.Com CTA
if (toRoute.query[queryStrings.START_TYPE] === 'fmg') {
// If they have an existing order, return 'heritage' for the page name.
@ -57,9 +56,6 @@ export async function navigateToHeritageFunnel() {
export async function navigateAfterSaveToHeritageFunnel(currentRoute) {
const currentComponent = currentRoute.matched[0].components;
currentComponent.default.methods.resetDependentState();
setupOrderBeforeSave();
// Create the order (or save existing order) when navigating to Heritage Funnel.
await saveOrder();
@ -144,14 +140,4 @@ function isVinRelatedPage(toRoute) {
fmgPageValue === fmgPageValues.ADDRESS_LOOKUP ||
fmgPageValue === fmgPageValues.ADDRESS_VEHICLES ||
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
);
}
}

View file

@ -87,6 +87,8 @@ import { required } from "@/helpers/validation-rules";
import { errorMessages } from "@/constants/error-messages";
import { damageLocationsCms } from "@/constants/damage-locations-cms.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 baseMixin from "@/mixins/base-mixin";

View file

@ -268,7 +268,7 @@ export default {
return store.getters.vehicle.vin
},
getZipFromStore(){
return store.getters.order.serviceLocation.zipCode;
return store.getters.vehicle.registration.zipCode
},
attachCustomEvents() {
this.prependActionToMethod(this, this.forwardButtonAction, () => {
@ -281,12 +281,7 @@ export default {
});
},
backButtonAction() {
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);
}
this.$router.navigate(this.navigationScenarios.CLICKED_BACK, this.$route);
},
async forwardButtonAction() {
const zipValidation = this.validateZip(this.zip);

View file

@ -107,10 +107,6 @@ const routingTable = [
{
scenario: navigationScenarios.CLICKED_FORWARD,
destinationFmgPageValue: fmgPageValues.VEHICLE_DAMAGE,
},
{
scenario: navigationScenarios.CLICKED_BACK_WITH_VIN,
destinationFmgPageValue: fmgPageValues.VEHICLE_DAMAGE,
}
],
},

View file

@ -15,7 +15,7 @@ const getDefaultState = () => {
model: null,
style: null,
carId: null,
category: null,
category: null,
vin: null,
imageUrl: null,
imageVifNumber: null,
@ -31,9 +31,6 @@ const getDefaultState = () => {
},
},
serviceLocation: {
address: null,
city: null,
state: null,
zipCode: null,
},
customer: {
@ -230,39 +227,18 @@ export const mutations = {
imageUrl: orderInformation.vehicle?.imageUrl,
imageVifNumber: orderInformation.vehicle?.imageVifNumber,
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.damage.glassToReplace;
state.order.damage.isRepair = orderInformation.damage.isRepair;
state.order.damage.numberOfChips = orderInformation.damage.numberOfChips;
state.order.damage.glassToReplace = orderInformation.glassToReplace;
state.order.damage.isRepair = orderInformation.isRepair;
state.order.damage.numberOfChips = orderInformation.numberOfChips;
state.order.lineItems.glassParts = orderInformation.parts;
state.order.accountNumber = orderInformation.accountNumber;
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.serviceLocation.zipCode = orderInformation.zipCode;
state.order.payment.isInsurance = orderInformation.IsInsuranceOrder;
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;
}
}
@ -443,9 +419,6 @@ export const actions = {
context.commit(storeMutations.UPDATE_REFERRAL_DATE, referralDate);
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 }) {
return globalMethods.callHttpClient({
@ -529,7 +502,6 @@ export const actions = {
saveOrder(context) {
const vehicle = context.getters.vehicle;
const damage = context.getters.damage;
const order = context.state.order;
return globalMethods.callHttpClient({
method: endpoints.SaveOrder.method,
@ -541,34 +513,14 @@ export const actions = {
make: vehicle.make,
model: vehicle.model,
style: vehicle.style,
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,
},
vin: vehicle.vin
},
damage: {
numberOfChips: damage.numberOfChips,
glassToReplace: damage.glassToReplace,
isRepair: damage.isRepair
},
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
numberOfChips: damage.numberOfChips,
zipCode: 43215, // TODO CSR-416, should not be hardcoded (state.order.serviceLocation.zipCode)
glassToReplace: damage.glassToReplace,
referralNumber: context.state.order.referralNumber,
referralDate: context.state.order.referralDate,
accountNumber: context.state.order.accountNumber
},
});
},

View file

@ -215,19 +215,14 @@ describe("Mutations", () => {
model: "ILX",
style: "4 DOOR SEDAN",
carId: "C0000001",
category: "CAR",
registration: {}
},
damage: {
glassToReplace: ["Windshield"],
isRepair: false,
numberOfChips: 0,
category: "CAR"
},
glassToReplace: ["Windshield"],
isRepair: false,
numberOfChips: 0,
parts: [],
accountNumber: "123456789",
insuranceInfo: {},
serviceLocation: {},
customer: {}
insuranceInfo: {}
});
// Assert
@ -567,16 +562,11 @@ describe("Actions", () => {
const context = state;
context.getters = {
vehicle: {
registration: {}
},
vehicle: {},
damage: {},
};
context.state = {
order: {
serviceLocation: {},
customer: {}
}
order: {}
};
globalMethods.callHttpClient.mockImplementation(() => {