Merge pull request #415 from Safelite/revert-411-feature/CSR-416

Revert "Feature/csr 416"
This commit is contained in:
katieoh-safelite 2022-05-11 08:15:45 -04:00 committed by GitHub
commit fd4de9386e
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_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",

View file

@ -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 };

View file

@ -3,10 +3,8 @@ 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
@ -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. 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.
@ -57,9 +56,6 @@ 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();
@ -144,14 +140,4 @@ function isVinRelatedPage(toRoute) {
fmgPageValue === fmgPageValues.ADDRESS_LOOKUP || fmgPageValue === fmgPageValues.ADDRESS_LOOKUP ||
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
);
}
} }

View file

@ -87,6 +87,8 @@ 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";

View file

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

View file

@ -107,10 +107,6 @@ 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,
} }
], ],
}, },

View file

@ -15,7 +15,7 @@ const getDefaultState = () => {
model: null, model: null,
style: null, style: null,
carId: null, carId: null,
category: null, category: null,
vin: null, vin: null,
imageUrl: null, imageUrl: null,
imageVifNumber: null, imageVifNumber: null,
@ -31,9 +31,6 @@ const getDefaultState = () => {
}, },
}, },
serviceLocation: { serviceLocation: {
address: null,
city: null,
state: null,
zipCode: null, zipCode: null,
}, },
customer: { customer: {
@ -230,39 +227,18 @@ 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.damage.glassToReplace; state.order.damage.glassToReplace = orderInformation.glassToReplace;
state.order.damage.isRepair = orderInformation.damage.isRepair; state.order.damage.isRepair = orderInformation.isRepair;
state.order.damage.numberOfChips = orderInformation.damage.numberOfChips; state.order.damage.numberOfChips = orderInformation.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.address = orderInformation.serviceLocation.streetAddress, state.order.serviceLocation.zipCode = orderInformation.zipCode;
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;
} }
} }
@ -443,9 +419,6 @@ 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({
@ -529,7 +502,6 @@ 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,
@ -541,34 +513,14 @@ 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,
},
}, },
damage: { numberOfChips: damage.numberOfChips,
numberOfChips: damage.numberOfChips, zipCode: 43215, // TODO CSR-416, should not be hardcoded (state.order.serviceLocation.zipCode)
glassToReplace: damage.glassToReplace, glassToReplace: damage.glassToReplace,
isRepair: damage.isRepair referralNumber: context.state.order.referralNumber,
}, referralDate: context.state.order.referralDate,
customer: { accountNumber: context.state.order.accountNumber
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
}, },
}); });
}, },

View file

@ -215,19 +215,14 @@ 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
@ -567,16 +562,11 @@ 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(() => {