From 219fb3a7315850b4b0ab116f9d114315a0e2584f Mon Sep 17 00:00:00 2001 From: Katie Date: Mon, 2 May 2022 17:19:22 -0400 Subject: [PATCH 01/11] CSR-416 WIP --- src/global-methods.js | 8 +++- .../heritage-integration/navigation-helper.js | 5 ++- src/layouts/vehicle-damage/vehicle-damage.vue | 10 +---- src/layouts/vehicle-year/vehicle-year.vue | 2 + src/layouts/vin-lookup/vin-lookup.vue | 14 +++++++ src/router/index.js | 3 ++ src/router/router-constants/routing-table.js | 3 +- src/store/index.js | 39 ++++++++++++++----- 8 files changed, 62 insertions(+), 22 deletions(-) diff --git a/src/global-methods.js b/src/global-methods.js index c0823f29a..1156aec20 100644 --- a/src/global-methods.js +++ b/src/global-methods.js @@ -5,7 +5,13 @@ import httpStatusCodes from "http-status-codes"; export default { callHttpClient({ method, endpoint, payload }) { return new Promise((resolve, reject) => { - const apiGatewayUrl = applicationConfig.CONSUMER_APIGATEWAY_URL; + let apiGatewayUrl = applicationConfig.CONSUMER_APIGATEWAY_URL; + + if (endpoint.includes("order")) { + apiGatewayUrl = "https://localhost:44346"; + } + + // const apiGatewayUrl = applicationConfig.CONSUMER_APIGATEWAY_URL; const payloadAndAnalyticsData = Object.assign({}, payload, { AppName: "FixMyGlass", diff --git a/src/helpers/heritage-integration/navigation-helper.js b/src/helpers/heritage-integration/navigation-helper.js index 724b13f7d..145df2e2b 100644 --- a/src/helpers/heritage-integration/navigation-helper.js +++ b/src/helpers/heritage-integration/navigation-helper.js @@ -12,7 +12,7 @@ import router from "@/router"; the user has an existing order and they come back in from the Safelite.com CTA. */ export async function getPageToRouteExistingOrderTo(toRoute = {}, existingHeritageOrder = false) { - + console.log("B") // 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. @@ -40,7 +40,7 @@ export async function getPageToRouteExistingOrderTo(toRoute = {}, existingHerita Used to navigate to the heritage funnel with the correct query string and url. */ -export async function navigateToHeritageFunnel() { +export async function navigateToHeritageFunnel(suppressConceptFunnel = false) { // Create the order (or save existing order) when navigating to Heritage Funnel. await saveOrder(); @@ -49,6 +49,7 @@ export async function navigateToHeritageFunnel() { { corid: store.getters.order.referralCorrelationId, src: "concept-funnel", + suppressConceptFunnel: suppressConceptFunnel } ); } diff --git a/src/layouts/vehicle-damage/vehicle-damage.vue b/src/layouts/vehicle-damage/vehicle-damage.vue index 543a02bef..73a43acb3 100644 --- a/src/layouts/vehicle-damage/vehicle-damage.vue +++ b/src/layouts/vehicle-damage/vehicle-damage.vue @@ -77,7 +77,7 @@ 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 { navigateToHeritageFunnel } from "@/helpers/heritage-integration/navigation-helper"; import store from "@/store"; import baseMixin from "@/mixins/base-mixin"; @@ -279,14 +279,6 @@ export default { }, navigateForward(partsData){ - - // Temporary easter egg to navigate to heritage funnel. - const vehicleYearsToShowHeritageFunnel = [ 2001, 2002, 2010, 2016 ]; - if (vehicleYearsToShowHeritageFunnel.includes(store.getters.vehicle.year)) { - navigateToHeritageFunnel(); - return; - } - // If vin already exists, navigate directly to vin-lookup if(this.$store.getters.vehicle.vin){ this.$router.navigate(this.navigationScenarios.CLICKED_FORWARD_WITH_VIN, this.$route); diff --git a/src/layouts/vehicle-year/vehicle-year.vue b/src/layouts/vehicle-year/vehicle-year.vue index 96f62409c..6986eee71 100644 --- a/src/layouts/vehicle-year/vehicle-year.vue +++ b/src/layouts/vehicle-year/vehicle-year.vue @@ -43,6 +43,8 @@ export default { const cmsContentPromise = fetchCmsContentForPage(to.query.fmgPage); const yearQuestionInitialDataPromise = yearQuestion.methods.loadInitialData(); + console.log("A") + // Log experiment exposure const logExperimentExposurePromise = baseMixin.methods.dispatchNonBlockingStoreAction(storeActions.LOG_EXPERIMENT_EXPOSURE, { diff --git a/src/layouts/vin-lookup/vin-lookup.vue b/src/layouts/vin-lookup/vin-lookup.vue index c3a1bbc33..5defba476 100644 --- a/src/layouts/vin-lookup/vin-lookup.vue +++ b/src/layouts/vin-lookup/vin-lookup.vue @@ -116,6 +116,7 @@ import { storeMutations } from "@/constants/store-mutations"; import { errorMessages } from "@/constants/error-messages"; import { required, regex } from "@/helpers/validation-rules"; import { Form, defineRule } from "vee-validate"; +import { navigateToHeritageFunnel } from "@/helpers/heritage-integration/navigation-helper"; // DEFINE VALIDATION RULES defineRule("zip-required", required(errorMessages.ZIP_REQUIRED)); @@ -127,6 +128,7 @@ defineRule("vin-format", regex(/^[A-HJ-NPR-Z0-9]{17}$/, errorMessages.VIN_FORMAT export default { name: "vin-lookup", async beforeRouteEnter(to, from, next) { + console.log("C") // Call APIs const cmsContentPromise = fetchCmsContentForPage(to.query.fmgPage); @@ -180,19 +182,23 @@ export default { this.$router.navigate(this.navigationScenarios.CLICKED_BACK, this.$route); }, async forwardButtonAction() { + console.log("1") const zipValidation = await this.validateZip(this.zip); if (!zipValidation.data.isServiceable) { + console.log("2") this.customAlertData.zip = this.zip; this.$refs.funnelFooter.removeLoader(); this.noServiceZip = true; return; } const vinLookup = await this.lookupVin(this.vin).catch(() => { + console.log("3") this.$refs.funnelFooter.removeLoader(); this.noMatchAlert = true; return; }); if (vinLookup.data.carId !== store.getters.vehicle.carId) { + console.log("4") this.customAlertData.vehicleInfo = vinLookup.data.vehicle; this.$refs.funnelFooter.removeLoader(); this.foundWindshieldAlert = true; @@ -213,6 +219,14 @@ export default { this.navigateForward(partsData); }, navigateForward(partsData){ + console.log("5") + // Temporary easter egg to navigate to heritage funnel. + const vehicleYearsToShowHeritageFunnel = [ 2001, 2002, 2010, 2016 ]; + if (vehicleYearsToShowHeritageFunnel.includes(store.getters.vehicle.year)) { + navigateToHeritageFunnel(); + return; + } + if(partsData.data.partsOrQuestions[0].partQuestions && partsData.data.partsOrQuestions[0].partQuestions.length > 0){ this.$router.navigateAfterSave(this.navigationScenarios.CONTINUING_WITH_PARTS_QUESTION, this.$route, {}, {}, partsData.data); return; diff --git a/src/router/index.js b/src/router/index.js index 1d46eec5f..7b03fd097 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -212,6 +212,9 @@ function navigateToUrl(url, optionalQuery = {}) { ///////////////////////////////////////////////////// if (externalUrl.search.indexOf("corid=") != -1) externalUrl.search = externalUrl.search + '&experiments=CollectEmailOnQuote=CollectEmailOnQuote_V1=YesCollectEmail_TEST1=true,RemoveServiceAreaPage=ServAreaRemoval_V7=ServAreaNoRemove_V7_TEST=true,VINeducationV2=VINeducation_V2=NoShowVINmodalV2_CONTROL=true,ServicePackages=ServicePackages_V1=NoShowPackages_CONTROL=true,PhotoUploadRedesign=PhotoUploadRedesign_V1=CurrentPhotoUpload_CONTROL=true,ScheduleDetailsServiceType=ScheduleBeforeServiceType_V1=ServTypeThenSched_CONTROL=true'; + + // TODO REMOVE + externalUrl.search += ",ConceptFunnel=ConceptFunnel_V1=ConceptFunnel_TEST=true" ///////////// END TEMP CODE ///////////////////////// window.location.assign(externalUrl); diff --git a/src/router/router-constants/routing-table.js b/src/router/router-constants/routing-table.js index 999bc1184..792f2f9bd 100644 --- a/src/router/router-constants/routing-table.js +++ b/src/router/router-constants/routing-table.js @@ -59,7 +59,8 @@ const routingTable = [ }, { scenario: navigationScenarios.CLICKED_FORWARD_WITH_VIN, - destinationFmgPageValue: fmgPageValues.VIN_LOOKUP, + // destinationFmgPageValue: fmgPageValues.VIN_LOOKUP, + destinationFmgPageValue: fmgPageValues.ADDRESS_LOOKUP, }, { scenario: navigationScenarios.SELECTED_DAMAGE_WITH_SINGLE_PART, diff --git a/src/store/index.js b/src/store/index.js index 6bda6ab13..6a9db85c9 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -15,7 +15,7 @@ const getDefaultState = () => { model: null, style: null, carId: null, - category: null, + category: null, vin: null, imageUrl: null, imageVifNumber: null, @@ -200,6 +200,7 @@ export const mutations = { // Misc Mutations updateStateWithOrderInformation(state, orderInformation) { + console.log(orderInformation) state.order.referralNumber = orderInformation.referralNumber; state.order.referralDate = orderInformation.referralDate; state.order.referralCorrelationId = orderInformation.referralCorrelationId; @@ -215,6 +216,9 @@ export const mutations = { imageUrl: orderInformation.vehicle?.imageUrl, imageVifNumber: orderInformation.vehicle?.imageVifNumber, imageColor: orderInformation.vehicle?.imageVifColor, + registration: { + zipCode: orderInformation.zipCode // TODO CSR-416 make sure customer vs service is different + } }); state.order.damage.glassToReplace = orderInformation.glassToReplace; @@ -223,10 +227,12 @@ export const mutations = { state.order.lineItems.glassParts = orderInformation.parts; state.order.accountNumber = orderInformation.accountNumber; - state.order.serviceLocation.zipCode = orderInformation.zipCode; + state.order.serviceLocation.zip = orderInformation.zipCode; // TODO CSR-416 make sure customer vs service is different state.order.payment.isInsurance = orderInformation.IsInsuranceOrder; state.order.payment.insuranceCoverage.isVerified = orderInformation?.insuranceInfo.coverageVerified; + + state.order.customer.emailAddress = orderInformation.emailAddress } } @@ -463,6 +469,7 @@ 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, @@ -474,14 +481,28 @@ export const actions = { make: vehicle.make, model: vehicle.model, style: vehicle.style, - vin: vehicle.vin + vin: vehicle.vin, + registration: { + firstName: vehicle.registration.firstName, + lastName: vehicle.registration.lastName, + licensePlate: vehicle.registration.licensePlate, + zipCode: vehicle.registration.zipCode + }, }, - 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 + damage: { + numberOfChips: damage.numberOfChips, + glassToReplace: damage.glassToReplace, + isRepair: damage.isRepair + }, + customer: { + emailAddress: order.customer.emailAddress, + }, + serviceLocation: { + zipCode: order.serviceLocation.zip + }, + referralNumber: order.referralNumber, + referralDate: order.referralDate, + accountNumber: order.accountNumber }, }); }, From 54791dd81defa470ceaafeada14c0d89abe7c9a7 Mon Sep 17 00:00:00 2001 From: Katie Date: Thu, 5 May 2022 08:38:20 -0400 Subject: [PATCH 02/11] CSR-416 WIP --- src/store/index.js | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/src/store/index.js b/src/store/index.js index 25af8c097..0417aee8c 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -229,22 +229,29 @@ export const mutations = { imageVifNumber: orderInformation.vehicle?.imageVifNumber, imageColor: orderInformation.vehicle?.imageVifColor, registration: { - zipCode: orderInformation.zipCode // TODO CSR-416 make sure customer vs service is different + 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, // TODO CSR-416 make sure customer vs service is different + licensePlate: null, } }); - state.order.damage.glassToReplace = orderInformation.glassToReplace; - state.order.damage.isRepair = orderInformation.isRepair; - state.order.damage.numberOfChips = orderInformation.numberOfChips; + state.order.damage.glassToReplace = orderInformation.damage.glassToReplace; + state.order.damage.isRepair = orderInformation.damage.isRepair; + state.order.damage.numberOfChips = orderInformation.damage.numberOfChips; state.order.lineItems.glassParts = orderInformation.parts; state.order.accountNumber = orderInformation.accountNumber; - state.order.serviceLocation.zip = orderInformation.zipCode; // TODO CSR-416 make sure customer vs service is different + state.order.serviceLocation.zip = orderInformation.zipCode; // TODO CSR-416 make sure customer vs service is different, add this to service state.order.payment.isInsurance = orderInformation.IsInsuranceOrder; state.order.payment.insuranceCoverage.isVerified = orderInformation?.insuranceInfo.coverageVerified; - state.order.customer.emailAddress = orderInformation.emailAddress + state.order.customer.emailAddress = orderInformation.customer.emailAddress + } } @@ -510,6 +517,8 @@ export const actions = { const damage = context.getters.damage; const order = context.state.order; + console.log(context) + return globalMethods.callHttpClient({ method: endpoints.SaveOrder.method, endpoint: endpoints.SaveOrder.url, @@ -537,7 +546,7 @@ export const actions = { emailAddress: order.customer.emailAddress, }, serviceLocation: { - zipCode: order.serviceLocation.zip + zipCode: order.serviceLocation.zipCode }, referralNumber: order.referralNumber, referralDate: order.referralDate, From 674386c7b4332bb5da97dea798f9dbc8aadbbba8 Mon Sep 17 00:00:00 2001 From: Katie Date: Mon, 9 May 2022 13:45:56 -0400 Subject: [PATCH 03/11] CSR-416 Add vin-lookup integration --- src/layouts/address-lookup/address-lookup.vue | 4 ++-- .../license-plate-lookup.vue | 2 ++ src/layouts/vin-lookup/vin-lookup.vue | 15 +++++++++++++-- src/router/index.js | 1 + src/store/index.js | 18 +++++++++++------- 5 files changed, 29 insertions(+), 11 deletions(-) diff --git a/src/layouts/address-lookup/address-lookup.vue b/src/layouts/address-lookup/address-lookup.vue index 032b42268..6f251333f 100644 --- a/src/layouts/address-lookup/address-lookup.vue +++ b/src/layouts/address-lookup/address-lookup.vue @@ -302,8 +302,8 @@ export default { store.commit(storeMutations.UPDATE_REGISTRATION_ZIP_CODE, this.customerQuestions.addressQuestions.zipCode); store.commit(storeMutations.UPDATE_REGISTRATION_FIRST_NAME, this.customerQuestions.firstName); store.commit(storeMutations.UPDATE_REGISTRATION_LAST_NAME, this.customerQuestions.lastName); - store.commit(storeMutations.UPDATE_SERVICE_LOCATION_ZIP_CODE, this.serviceZip); - store.commit(storeMutations.UPDATE_CUSTOMER_EMAIL_ADDRESS, this.customerQuestions.email); + store.commit(storeMutations.UPDATE_SERVICE_LOCATION_ZIP_CODE, this.serviceZip); + store.commit(storeMutations.UPDATE_CUSTOMER_EMAIL_ADDRESS, this.customerQuestions.emailAddress); }, }, diff --git a/src/layouts/license-plate-lookup/license-plate-lookup.vue b/src/layouts/license-plate-lookup/license-plate-lookup.vue index 1db7a57fd..264e24383 100644 --- a/src/layouts/license-plate-lookup/license-plate-lookup.vue +++ b/src/layouts/license-plate-lookup/license-plate-lookup.vue @@ -300,6 +300,8 @@ export default { if (this.isCarIdDifferent && !this.isSelectedGlassAvailableForVehicle) { store.dispatch(storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES); } + console.log("A") + console.log(this.licensePlate) store.commit(storeMutations.UPDATE_VEHICLE_VIN, vin); store.commit(storeMutations.UPDATE_YEAR, vehicleInfo.year); store.commit(storeMutations.UPDATE_MAKE, vehicleInfo.make); diff --git a/src/layouts/vin-lookup/vin-lookup.vue b/src/layouts/vin-lookup/vin-lookup.vue index 4c43eb513..c9bf44f62 100644 --- a/src/layouts/vin-lookup/vin-lookup.vue +++ b/src/layouts/vin-lookup/vin-lookup.vue @@ -250,7 +250,13 @@ export default { return store.getters.vehicle.vin }, getZipFromStore(){ - return store.getters.vehicle.registration.zipCode + var serviceZip = store.getters.order.serviceLocation.zipCode; + + if (!serviceZip) { + serviceZip = store.getters.vehicle.registration.zipCode; + } + + return serviceZip; }, attachCustomEvents() { this.prependActionToMethod(this, this.forwardButtonAction, () => { @@ -263,7 +269,12 @@ export default { }); }, 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() { const zipValidation = await this.validateZip(this.zip); diff --git a/src/router/index.js b/src/router/index.js index 23732d405..32f999820 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -166,6 +166,7 @@ async function navigate(scenario, currentRoute, invalidateOnSave, optionalQuery const currentComponent = currentRoute.matched[0].components; if (invalidateOnSave) { + console.log("A") resetDependentState(currentComponent); } diff --git a/src/store/index.js b/src/store/index.js index 0417aee8c..416ff3aee 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -133,6 +133,7 @@ export const mutations = { state.order.payment.insuranceCoverage.isVerified = isVerified; }, updateRegistrationLicensePlate(state, licensePlate){ + console.log(licensePlate) state.order.vehicle.registration.licensePlate = licensePlate; }, updateRegistrationState(state, registrationState){ @@ -148,13 +149,13 @@ export const mutations = { state.order.serviceLocation.zipCode = serviceLocationZipCode; }, updateRegistrationCity(state, serviceCity){ - state.order.serviceLocation.city = serviceCity; + state.order.vehicle.registration.city = serviceCity; }, updateRegistrationFirstName(state, firstName){ - state.order.serviceLocation.firstName = firstName; + state.order.vehicle.registration.firstName = firstName; }, updateRegistrationLastName(state, lastName){ - state.order.serviceLocation.lastName = lastName; + state.order.vehicle.registration.lastName = lastName; }, updateCustomerEmailAddress(state, customerEmailAddress){ state.order.customer.emailAddress = customerEmailAddress; @@ -235,7 +236,7 @@ export const mutations = { city: orderInformation.vehicle.registration.city, state: orderInformation.vehicle.registration.state, zipCode: orderInformation.vehicle.registration.zipCode, // TODO CSR-416 make sure customer vs service is different - licensePlate: null, + licensePlate: orderInformation.vehicle.registration.licensePlate, } }); @@ -245,7 +246,7 @@ export const mutations = { state.order.lineItems.glassParts = orderInformation.parts; state.order.accountNumber = orderInformation.accountNumber; - state.order.serviceLocation.zip = orderInformation.zipCode; // TODO CSR-416 make sure customer vs service is different, add this to service + state.order.serviceLocation.zipCode = orderInformation.serviceLocation.zipCode; // TODO CSR-416 make sure customer vs service is different, add this to service state.order.payment.isInsurance = orderInformation.IsInsuranceOrder; state.order.payment.insuranceCoverage.isVerified = orderInformation?.insuranceInfo.coverageVerified; @@ -533,8 +534,11 @@ export const actions = { registration: { firstName: vehicle.registration.firstName, lastName: vehicle.registration.lastName, - licensePlate: vehicle.registration.licensePlate, - zipCode: vehicle.registration.zipCode + streetAddress: vehicle.registration.address, + city: vehicle.registration.city, + state: vehicle.registration.state, + zipCode: vehicle.registration.zipCode, + licensePlateNumber: vehicle.registration.licensePlate, }, }, damage: { From 72b6208757f7e0259b56d2d0f33b3ac72e7cb984 Mon Sep 17 00:00:00 2001 From: Katie Date: Mon, 9 May 2022 15:23:45 -0400 Subject: [PATCH 04/11] CSR-416 Add back for vin-lookup --- src/router/router-constants/routing-table.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/router/router-constants/routing-table.js b/src/router/router-constants/routing-table.js index f087cac08..896eec425 100644 --- a/src/router/router-constants/routing-table.js +++ b/src/router/router-constants/routing-table.js @@ -107,6 +107,10 @@ const routingTable = [ { scenario: navigationScenarios.CLICKED_FORWARD, destinationFmgPageValue: fmgPageValues.VEHICLE_DAMAGE, + }, + { + scenario: navigationScenarios.CLICKED_BACK_WITH_VIN, + destinationFmgPageValue: fmgPageValues.VEHICLE_DAMAGE, } ], }, From 09fb6e40f97f102081e748ee5fd48538ca41f9ad Mon Sep 17 00:00:00 2001 From: Katie Date: Mon, 9 May 2022 16:49:17 -0400 Subject: [PATCH 05/11] CSR-416 Save vin for single vehicle found on address-lookup --- src/layouts/address-lookup/address-lookup.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/layouts/address-lookup/address-lookup.vue b/src/layouts/address-lookup/address-lookup.vue index 306217a65..33939609b 100644 --- a/src/layouts/address-lookup/address-lookup.vue +++ b/src/layouts/address-lookup/address-lookup.vue @@ -240,7 +240,7 @@ export default { } // update data if the zip or service zip is servicable - this.updateVehicleInfo(carFound.vin, carFound); + this.updateVehicleInfo(carsFound[0].vin, carFound); this.updateCustomerInfo(); } else if (carsFound.length > 1) { From 9786c954d07a171524561d392a01b99c646ec06d Mon Sep 17 00:00:00 2001 From: Katie Date: Tue, 10 May 2022 12:28:25 -0400 Subject: [PATCH 06/11] CSR-416 Add updating serviceLocation with vehicle registration information as needed --- src/constants/store-actions.js | 1 + src/constants/store-mutations.js | 4 ++-- .../heritage-integration/navigation-helper.js | 18 ++++++++++++++++-- src/layouts/address-lookup/address-lookup.vue | 2 +- src/store/index.js | 19 ++++++++++++++++++- 5 files changed, 38 insertions(+), 6 deletions(-) diff --git a/src/constants/store-actions.js b/src/constants/store-actions.js index 2a0a7f29d..fe658fbe1 100644 --- a/src/constants/store-actions.js +++ b/src/constants/store-actions.js @@ -22,6 +22,7 @@ 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", diff --git a/src/constants/store-mutations.js b/src/constants/store-mutations.js index 65f4719ec..179b484ef 100644 --- a/src/constants/store-mutations.js +++ b/src/constants/store-mutations.js @@ -44,8 +44,8 @@ const storeMutations = { // OTHER MUTATIONS 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 }; diff --git a/src/helpers/heritage-integration/navigation-helper.js b/src/helpers/heritage-integration/navigation-helper.js index eadb607f0..7e0b80f99 100644 --- a/src/helpers/heritage-integration/navigation-helper.js +++ b/src/helpers/heritage-integration/navigation-helper.js @@ -3,8 +3,10 @@ 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 @@ -40,7 +42,7 @@ export async function getPageToRouteExistingOrderTo(toRoute = {}, existingHerita Used to navigate to the heritage funnel with the correct query string and url. */ -export async function navigateToHeritageFunnel(suppressConceptFunnel = false) { +export async function navigateToHeritageFunnel() { // Create the order (or save existing order) when navigating to Heritage Funnel. await saveOrder(); @@ -49,7 +51,6 @@ export async function navigateToHeritageFunnel(suppressConceptFunnel = false) { { corid: store.getters.order.referralCorrelationId, src: "concept-funnel", - suppressConceptFunnel: suppressConceptFunnel } ); } @@ -57,6 +58,9 @@ export async function navigateToHeritageFunnel(suppressConceptFunnel = false) { 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(); @@ -141,4 +145,14 @@ function isVinRelatedPage(toRoute) { fmgPageValue === fmgPageValues.ADDRESS_LOOKUP || fmgPageValue === fmgPageValues.ADDRESS_VEHICLES || fmgPageValue === fmgPageValues.ESTIMATE; +} + +function setupOrderBeforeSave() { + const serviceLocation = store.getters.order.serviceLocation; + + if (!serviceLocation.address && (!serviceLocation.zipCode || serviceLocation.zipCode == store.getters.vehicle.registration.zipCode)) { + baseMixin.methods.dispatchStoreAction( + storeActions.UPDATE_SERVICE_LOCATION_WITH_VEHICLE_REGISTRATION + ); + } } \ No newline at end of file diff --git a/src/layouts/address-lookup/address-lookup.vue b/src/layouts/address-lookup/address-lookup.vue index 33939609b..ea5ba2a63 100644 --- a/src/layouts/address-lookup/address-lookup.vue +++ b/src/layouts/address-lookup/address-lookup.vue @@ -195,7 +195,7 @@ export default { if (!vinLookupResponse.data.isStatePermissible) { // State Restrictions forbid lookup by address - this.displayVinLookupByHomeAddressNotAllowedAlert = true; + this.displayVinLookupByHomeAddressNotAwllowedAlert = true; this.$refs.funnelFooter.removeLoader(); return; } diff --git a/src/store/index.js b/src/store/index.js index 608a981cd..f93dc6439 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -31,6 +31,9 @@ const getDefaultState = () => { }, }, serviceLocation: { + address: null, + city: null, + state: null, zipCode: null, }, customer: { @@ -251,8 +254,15 @@ export const mutations = { state.order.payment.isInsurance = orderInformation.IsInsuranceOrder; state.order.payment.insuranceCoverage.isVerified = orderInformation?.insuranceInfo.coverageVerified; - state.order.customer.emailAddress = orderInformation.customer.emailAddress + state.order.customer.emailAddress = orderInformation.customer.emailAddress; + }, + updateServiceLocationWithVehicleRegistration(state) { + console.log("Updating B") + 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; } } @@ -433,6 +443,10 @@ export const actions = { context.commit(storeMutations.UPDATE_REFERRAL_DATE, referralDate); context.commit(storeMutations.UPDATE_REFERRAL_CORRELATION_ID, referralCorrelationId); }, + updateServiceLocationWithVehicleRegistration(context) { + console.log("Updating A") + context.commit(storeMutations.UPDATE_SERVICE_LOCATION_WITH_VEHICLE_REGISTRATION); + }, logExperimentExposure(context, { userId, sessionKey, pageName, universeName }) { return globalMethods.callHttpClient({ @@ -550,6 +564,9 @@ export const actions = { emailAddress: order.customer.emailAddress, }, serviceLocation: { + streetAddress: order.serviceLocation.address, + city: order.serviceLocation.city, + state: order.serviceLocation.state, zipCode: order.serviceLocation.zipCode }, referralNumber: order.referralNumber, From 7c7e04728f8085e94909bcde3f1a13ae75008e8a Mon Sep 17 00:00:00 2001 From: Katie Date: Tue, 10 May 2022 14:35:44 -0400 Subject: [PATCH 07/11] CSR-416 Cleanup --- src/global-methods.js | 8 +------- src/helpers/heritage-integration/navigation-helper.js | 1 - src/layouts/address-lookup/address-lookup.vue | 1 - 3 files changed, 1 insertion(+), 9 deletions(-) diff --git a/src/global-methods.js b/src/global-methods.js index 6c7c630f1..5e4d04ea3 100644 --- a/src/global-methods.js +++ b/src/global-methods.js @@ -7,13 +7,7 @@ import { GaCategories, GaActions, GaLabels } from "@/constants/analytics"; export default { callHttpClient({ method, endpoint, payload, logApiCall = true }) { return new Promise((resolve, reject) => { - let cfDistroUrl = applicationConfig.CONSUMER_CF_DISTRO; - - if (endpoint.includes("order")) { - cfDistroUrl = "https://localhost:44346"; - } - - // const cfDistroUrl = applicationConfig.CONSUMER_CF_DISTRO; + const cfDistroUrl = applicationConfig.CONSUMER_CF_DISTRO; const payloadAndAnalyticsData = Object.assign({}, payload, { AppName: "FixMyGlass" }); axios({ method: method, url: cfDistroUrl + endpoint, data: payloadAndAnalyticsData, crossDomain: true, responseType: {} }) diff --git a/src/helpers/heritage-integration/navigation-helper.js b/src/helpers/heritage-integration/navigation-helper.js index 42db80810..6d2c0d93e 100644 --- a/src/helpers/heritage-integration/navigation-helper.js +++ b/src/helpers/heritage-integration/navigation-helper.js @@ -14,7 +14,6 @@ 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) { - console.log("B") // 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. diff --git a/src/layouts/address-lookup/address-lookup.vue b/src/layouts/address-lookup/address-lookup.vue index b2c637901..9fc4b7d55 100644 --- a/src/layouts/address-lookup/address-lookup.vue +++ b/src/layouts/address-lookup/address-lookup.vue @@ -176,7 +176,6 @@ export default { return store.getters.order.serviceLocation.zipCode; }, async forwardButtonAction() { - console.log("AL forwardButtonAction") this.resetWarningsAndErrors(); // Lookup VIN(s) with the provided address From 4478dea24889b5c6f607f032b127a01cf774aec3 Mon Sep 17 00:00:00 2001 From: Katie Date: Tue, 10 May 2022 16:01:42 -0400 Subject: [PATCH 08/11] CSR-416 Cleanup + use serviceZip for vin-lookup, registrationZip as backup --- src/layouts/address-lookup/address-lookup.vue | 2 +- src/layouts/vehicle-year/vehicle-year.vue | 2 -- src/layouts/vin-lookup/vin-lookup.vue | 2 -- src/router/index.js | 4 ---- src/store/index.js | 10 ++-------- 5 files changed, 3 insertions(+), 17 deletions(-) diff --git a/src/layouts/address-lookup/address-lookup.vue b/src/layouts/address-lookup/address-lookup.vue index 9fc4b7d55..d83df2247 100644 --- a/src/layouts/address-lookup/address-lookup.vue +++ b/src/layouts/address-lookup/address-lookup.vue @@ -193,7 +193,7 @@ export default { if (!vinLookupResponse.data.isStatePermissible) { // State Restrictions forbid lookup by address - this.displayVinLookupByHomeAddressNotAwllowedAlert = true; + this.displayVinLookupByHomeAddressNotAllowedAlert = true; this.$refs.funnelFooter.removeLoader(); return; } diff --git a/src/layouts/vehicle-year/vehicle-year.vue b/src/layouts/vehicle-year/vehicle-year.vue index 05e2d785f..ddca6b8bd 100644 --- a/src/layouts/vehicle-year/vehicle-year.vue +++ b/src/layouts/vehicle-year/vehicle-year.vue @@ -50,8 +50,6 @@ export default { const cmsContentPromise = fetchCmsContentForPage(to.query.fmgPage); const yearQuestionInitialDataPromise = yearQuestion.methods.loadInitialData(); - console.log("A") - // Log experiment exposure const logExperimentExposurePromise = baseMixin.methods.dispatchStoreAction(storeActions.LOG_EXPERIMENT_EXPOSURE, { diff --git a/src/layouts/vin-lookup/vin-lookup.vue b/src/layouts/vin-lookup/vin-lookup.vue index c3a21df9e..8f53207a6 100644 --- a/src/layouts/vin-lookup/vin-lookup.vue +++ b/src/layouts/vin-lookup/vin-lookup.vue @@ -151,7 +151,6 @@ import { errorMessages } from "@/constants/error-messages"; import { getDamageString, getIsWindshieldOnly, isGlassAvailableForCarId } from "@/helpers/damage-helper"; import { required, regex } from "@/helpers/validation-rules"; import { Form, defineRule } from "vee-validate"; -// import { navigateToHeritageFunnel } from "@/helpers/heritage-integration/navigation-helper"; import { navigateAfterSaveToHeritageFunnel } from "@/helpers/heritage-integration/navigation-helper"; // DEFINE VALIDATION RULES @@ -176,7 +175,6 @@ defineRule( export default { name: "vin-lookup", async beforeRouteEnter(to, from, next) { - console.log("C") // Call APIs const cmsContentPromise = fetchCmsContentForPage(to.query.fmgPage); diff --git a/src/router/index.js b/src/router/index.js index 32f999820..f11bd4228 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -166,7 +166,6 @@ async function navigate(scenario, currentRoute, invalidateOnSave, optionalQuery const currentComponent = currentRoute.matched[0].components; if (invalidateOnSave) { - console.log("A") resetDependentState(currentComponent); } @@ -220,9 +219,6 @@ function navigateToUrl(url, optionalQuery = {}) { ///////////////////////////////////////////////////// if (externalUrl.search.indexOf("corid=") != -1) externalUrl.search = externalUrl.search + '&experiments=CollectEmailOnQuote=CollectEmailOnQuote_V1=YesCollectEmail_TEST1=true,RemoveServiceAreaPage=ServAreaRemoval_V7=ServAreaNoRemove_V7_TEST=true,VINeducationV2=VINeducation_V2=NoShowVINmodalV2_CONTROL=true,ServicePackages=ServicePackages_V1=NoShowPackages_CONTROL=true,PhotoUploadRedesign=PhotoUploadRedesign_V1=CurrentPhotoUpload_CONTROL=true,ScheduleDetailsServiceType=ScheduleBeforeServiceType_V1=ServTypeThenSched_CONTROL=true'; - - // TODO REMOVE - externalUrl.search += ",ConceptFunnel=ConceptFunnel_V1=ConceptFunnel_TEST=true" ///////////// END TEMP CODE ///////////////////////// window.location.assign(externalUrl); diff --git a/src/store/index.js b/src/store/index.js index eab934fc9..d2123e546 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -136,7 +136,6 @@ export const mutations = { state.order.payment.insuranceCoverage.isVerified = isVerified; }, updateRegistrationLicensePlate(state, licensePlate){ - console.log(licensePlate) state.order.vehicle.registration.licensePlate = licensePlate; }, updateRegistrationAddress(state, registrationAddress){ @@ -216,7 +215,6 @@ export const mutations = { // Misc Mutations updateStateWithOrderInformation(state, orderInformation) { - console.log(orderInformation) state.order.referralNumber = orderInformation.referralNumber; state.order.referralDate = orderInformation.referralDate; state.order.referralCorrelationId = orderInformation.referralCorrelationId; @@ -238,7 +236,7 @@ export const mutations = { address: orderInformation.vehicle.registration.streetAddress, city: orderInformation.vehicle.registration.city, state: orderInformation.vehicle.registration.state, - zipCode: orderInformation.vehicle.registration.zipCode, // TODO CSR-416 make sure customer vs service is different + zipCode: orderInformation.vehicle.registration.zipCode, licensePlate: orderInformation.vehicle.registration.licensePlate, } }); @@ -252,7 +250,7 @@ export const mutations = { 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; // TODO CSR-416 make sure customer vs service is different, add this to service + state.order.serviceLocation.zipCode = orderInformation.serviceLocation.zipCode; state.order.payment.isInsurance = orderInformation.IsInsuranceOrder; state.order.payment.insuranceCoverage.isVerified = orderInformation?.insuranceInfo.coverageVerified; @@ -261,7 +259,6 @@ export const mutations = { }, updateServiceLocationWithVehicleRegistration(state) { - console.log("Updating B") 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; @@ -447,7 +444,6 @@ export const actions = { context.commit(storeMutations.UPDATE_REFERRAL_CORRELATION_ID, referralCorrelationId); }, updateServiceLocationWithVehicleRegistration(context) { - console.log("Updating A") context.commit(storeMutations.UPDATE_SERVICE_LOCATION_WITH_VEHICLE_REGISTRATION); }, @@ -535,8 +531,6 @@ export const actions = { const damage = context.getters.damage; const order = context.state.order; - console.log(context) - return globalMethods.callHttpClient({ method: endpoints.SaveOrder.method, endpoint: endpoints.SaveOrder.url, From fdc95af943f0dd1c2aeb6c66f155b6a41d91b4a8 Mon Sep 17 00:00:00 2001 From: Katie Date: Tue, 10 May 2022 16:10:37 -0400 Subject: [PATCH 09/11] CSR-416 Cleanup --- src/layouts/vin-lookup/vin-lookup.vue | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/layouts/vin-lookup/vin-lookup.vue b/src/layouts/vin-lookup/vin-lookup.vue index 8f53207a6..4ed5c8b03 100644 --- a/src/layouts/vin-lookup/vin-lookup.vue +++ b/src/layouts/vin-lookup/vin-lookup.vue @@ -328,13 +328,6 @@ export default { this.navigateForward(); }, navigateForward(){ - // Temporary easter egg to navigate to heritage funnel. - const vehicleYearsToShowHeritageFunnel = [ 2001, 2002, 2010, 2016 ]; - if (vehicleYearsToShowHeritageFunnel.includes(store.getters.vehicle.year)) { - navigateAfterSaveToHeritageFunnel(this.$route); - return; - } - if(this.isCarIdDifferent && !this.isSelectedGlassAvailableForVehicle){ this.$router.navigateAfterSave(this.navigationScenarios.CLICKED_FORWARD, this.$route, {}, { displayVehicleChangeAlert: true }, {}); return; From 92900249f7a84b422bb63c93c34de03c87555c1f Mon Sep 17 00:00:00 2001 From: Katie Date: Tue, 10 May 2022 16:34:16 -0400 Subject: [PATCH 10/11] CSR-416 Change using registrationZip to serviceZip on vin-lookup --- src/layouts/vin-lookup/vin-lookup.vue | 8 +------- src/store/store.spec.js | 10 +++++++--- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/layouts/vin-lookup/vin-lookup.vue b/src/layouts/vin-lookup/vin-lookup.vue index 4ed5c8b03..20740bfb6 100644 --- a/src/layouts/vin-lookup/vin-lookup.vue +++ b/src/layouts/vin-lookup/vin-lookup.vue @@ -268,13 +268,7 @@ export default { return store.getters.vehicle.vin }, getZipFromStore(){ - var serviceZip = store.getters.order.serviceLocation.zipCode; - - if (!serviceZip) { - serviceZip = store.getters.vehicle.registration.zipCode; - } - - return serviceZip; + return store.getters.order.serviceLocation.zipCode; }, attachCustomEvents() { this.prependActionToMethod(this, this.forwardButtonAction, () => { diff --git a/src/store/store.spec.js b/src/store/store.spec.js index b1667eb4c..88a080d40 100644 --- a/src/store/store.spec.js +++ b/src/store/store.spec.js @@ -204,6 +204,8 @@ describe("Mutations", () => { // Arrange const storeState = state; + mutations.resetState(storeState); + // Act mutations.updateStateWithOrderInformation(storeState, { referralNumber: 123, @@ -217,9 +219,11 @@ describe("Mutations", () => { carId: "C0000001", category: "CAR" }, - glassToReplace: ["Windshield"], - isRepair: false, - numberOfChips: 0, + damage: { + glassToReplace: ["Windshield"], + isRepair: false, + numberOfChips: 0, + }, parts: [], accountNumber: "123456789", insuranceInfo: {} From f9160902d5c936ea6d57854c471dbaf74a0a76cd Mon Sep 17 00:00:00 2001 From: Katie Date: Tue, 10 May 2022 16:49:45 -0400 Subject: [PATCH 11/11] CSR-416 Fix tests --- src/store/store.spec.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/store/store.spec.js b/src/store/store.spec.js index 88a080d40..24aa7cbd3 100644 --- a/src/store/store.spec.js +++ b/src/store/store.spec.js @@ -204,8 +204,6 @@ describe("Mutations", () => { // Arrange const storeState = state; - mutations.resetState(storeState); - // Act mutations.updateStateWithOrderInformation(storeState, { referralNumber: 123, @@ -217,7 +215,8 @@ describe("Mutations", () => { model: "ILX", style: "4 DOOR SEDAN", carId: "C0000001", - category: "CAR" + category: "CAR", + registration: {} }, damage: { glassToReplace: ["Windshield"], @@ -226,7 +225,9 @@ describe("Mutations", () => { }, parts: [], accountNumber: "123456789", - insuranceInfo: {} + insuranceInfo: {}, + serviceLocation: {}, + customer: {} }); // Assert @@ -566,11 +567,16 @@ describe("Actions", () => { const context = state; context.getters = { - vehicle: {}, + vehicle: { + registration: {} + }, damage: {}, }; context.state = { - order: {} + order: { + serviceLocation: {}, + customer: {} + } }; globalMethods.callHttpClient.mockImplementation(() => {