diff --git a/src/constants/application-config.js b/src/constants/application-config.js index 489776e66..a7841e5a9 100644 --- a/src/constants/application-config.js +++ b/src/constants/application-config.js @@ -3,7 +3,8 @@ const applicationConfig = { CONSUMER_APIGATEWAY_URL: process.env.VUE_APP_CONSUMER_API_GATEWAY, GOOGLE_PLACES_API_KEY: process.env.VUE_APP_GOOGLE_PLACES_API_KEY, ANALYTICS_SESSION_TIMEOUT_MINUTES: 30, - SAVED_SESSION_TIMEOUT_DAYS: 45 + SAVED_SESSION_TIMEOUT_DAYS: 45, + COOKIE_PATH: "/" }; export { applicationConfig }; \ No newline at end of file diff --git a/src/constants/store-actions.js b/src/constants/store-actions.js index c0e6893a4..09c6a4473 100644 --- a/src/constants/store-actions.js +++ b/src/constants/store-actions.js @@ -15,7 +15,6 @@ const storeActions = { SAVE_ORDER: "saveOrder", LOAD_ORDER: "loadOrder", SET_REFERRAL_INFORMATION: "setReferralInformation", - SET_LOAD_ORDER_DATA: "setLoadOrderData", // DEPENDENCY MUTATIONS RESET_VEHICLE_STATE_AND_DEPENDENCIES: "resetVehicleAndDependencies", diff --git a/src/constants/store-mutations.js b/src/constants/store-mutations.js index 8b59bacb0..834c4b648 100644 --- a/src/constants/store-mutations.js +++ b/src/constants/store-mutations.js @@ -34,7 +34,7 @@ const storeMutations = { // OTHER MUTATIONS UPDATE_PAGE_DATA: "updatePageData", - SET_LOAD_FUNNEL_SESSION_INFO: "setLoadOrderInformation" + SET_LOAD_FUNNEL_SESSION_INFO: "updateStateWithOrderInformation" }; diff --git a/src/helpers/heritage-integration/cookie-helper.js b/src/helpers/heritage-integration/cookie-helper.js index cee400e0c..36516a570 100644 --- a/src/helpers/heritage-integration/cookie-helper.js +++ b/src/helpers/heritage-integration/cookie-helper.js @@ -1,12 +1,13 @@ import { cookieNames } from "@/constants/cookie-names"; import store from "@/store"; +import { applicationConfig } from "@/constants/application-config"; /* Will update the cookie if present, or create a new one if not. */ export function updateOrCreateFunnelCookie() { // Create the cookie - document.cookie = `${cookieNames.FUNNEL_SESSION_INFO}={}; path=/; ${getCookieDomainValue()};`; + document.cookie = `${cookieNames.FUNNEL_SESSION_INFO}={}; path=${applicationConfig.COOKIE_PATH}; ${getCookieDomainValue()};`; // Set up cookie with all the props. setFunnelCookieProperties({ @@ -18,7 +19,6 @@ export function updateOrCreateFunnelCookie() { ReferralDate: store.getters.order.referralDate, ReferralCorrelationId: store.getters.order.referralCorrelationId, }); - } /* @@ -42,8 +42,7 @@ export function getFunnelCookie() { Removes cookie from browser. */ export function deleteFunnelCookie() { - console.log("hi there") - document.cookie = `${cookieNames.FUNNEL_SESSION_INFO}=; Max-Age=0; path=/; ${getCookieDomainValue()}`; + document.cookie = `${cookieNames.FUNNEL_SESSION_INFO}=; Max-Age=0; path=${applicationConfig.COOKIE_PATH}; ${getCookieDomainValue()}`; } /* @@ -61,7 +60,7 @@ function setFunnelCookieProperties(properties) { const cookieValueJson = JSON.stringify(cookie); - document.cookie = `${cookieNames.FUNNEL_SESSION_INFO}=${cookieValueJson}; path=/; ${getCookieDomainValue()}`; + document.cookie = `${cookieNames.FUNNEL_SESSION_INFO}=${cookieValueJson}; path=${applicationConfig.COOKIE_PATH}; ${getCookieDomainValue()}`; } } } diff --git a/src/helpers/heritage-integration/navigation-helper.js b/src/helpers/heritage-integration/navigation-helper.js index 12207acf4..974bff7cb 100644 --- a/src/helpers/heritage-integration/navigation-helper.js +++ b/src/helpers/heritage-integration/navigation-helper.js @@ -43,10 +43,10 @@ export async function getPageToRouteExistingOrderTo(toRoute = {}, existingHerita return 'vehicle-damage' } else { if (store.getters.vehicle.vin) { - return 'vehicle-damage'; + return 'heritage'; //return "vin-lookup"; (uncomment) } else { - return 'vehicle-damage'; + return 'heritage'; //return "estimate" (uncomment) } } @@ -58,7 +58,6 @@ export async function getPageToRouteExistingOrderTo(toRoute = {}, existingHerita */ export async function navigateToHeritageFunnel() { - // Create the order (or save existing order) when navigating to Heritage Funnel. await saveOrder(); @@ -67,6 +66,9 @@ export async function navigateToHeritageFunnel() { { corid: store.getters.order.referralCorrelationId, src: "concept-funnel", + // TODO CSR-28, remove this + cns: "all", + experiments: "RemoveServiceAreaPage=ServAreaRemoval_V7=NoShowPackages_CONTROL=true,ConceptFunnel=ConceptFunnel_V1=ConceptFunnel_TEST=true" } ); } \ No newline at end of file diff --git a/src/helpers/heritage-integration/navigation-helper.spec.js b/src/helpers/heritage-integration/navigation-helper.spec.js index be1136e63..44f087b64 100644 --- a/src/helpers/heritage-integration/navigation-helper.spec.js +++ b/src/helpers/heritage-integration/navigation-helper.spec.js @@ -229,7 +229,7 @@ describe("getPageToRouteExistingOrderTo", () => { //Assert //expect(result).toBe('vin-lookup'); - expect(result).toBe('vehicle-damage'); + expect(result).toBe('heritage'); }); test("getPageToRouteExistingOrderTo, should return estimate", async () => { @@ -285,7 +285,7 @@ describe("getPageToRouteExistingOrderTo", () => { //Assert //expect(result).toBe('estimate'); - expect(result).toBe('vehicle-damage'); + expect(result).toBe('heritage'); }); test("getPageToRouteExistingOrderTo, existing order, should return heritage", async () => { diff --git a/src/helpers/heritage-integration/order-helper.js b/src/helpers/heritage-integration/order-helper.js index 8dddb5436..1ce2ac2cc 100644 --- a/src/helpers/heritage-integration/order-helper.js +++ b/src/helpers/heritage-integration/order-helper.js @@ -10,8 +10,7 @@ import baseMixin from "@/mixins/base-mixin"; */ export async function loadOrderIfPresent() { const funnelCookie = getFunnelCookie(); - console.log(funnelCookie) - + // Do nothing if there is no cookie or no correlation id. if (funnelCookie == null || funnelCookie.ReferralCorrelationId == null) { return null; @@ -21,7 +20,6 @@ export async function loadOrderIfPresent() { if (funnelCookie.ShouldResetState) { baseMixin.methods.dispatchNonBlockingStoreAction(storeActions.RESET_STATE); deleteFunnelCookie(); - console.log("sup") return null; } diff --git a/src/layouts/vehicle-parts/vehicle-parts.vue b/src/layouts/vehicle-parts/vehicle-parts.vue index c02edfd27..59638e3a2 100644 --- a/src/layouts/vehicle-parts/vehicle-parts.vue +++ b/src/layouts/vehicle-parts/vehicle-parts.vue @@ -154,7 +154,6 @@ export default { methods: { arePagePrerequisitesValid() { // Check if isRepair is populated and if the pageData we need is here (Parts data) - console.log(store.getters.pageData(fmgPageValues.VEHICLE_PARTS)) if ( (store.getters.damage.isRepair != null) && Object.keys(store.getters.pageData(fmgPageValues.VEHICLE_PARTS)) diff --git a/src/router/index.js b/src/router/index.js index fc24e70c4..778c55cfc 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -45,8 +45,7 @@ const routes = [ await GoToFunnelStartOn404(next); } - // Process funnel cookie. - updateOrCreateFunnelCookie(); + // On entering the funnel "fresh", read cookie information, decide what to do next. if (from.redirectedFrom === undefined) { @@ -64,6 +63,9 @@ const routes = [ to.query.fmgPage = pageToRedirectTo; } + // Process funnel cookie. + updateOrCreateFunnelCookie(); + // If we already have our route, go to it. if (router.hasRoute(to.query.fmgPage)) { // Since our route is already in scope, we can grab the component from it and call the arePagePrerequisitesValid function. diff --git a/src/store/index.js b/src/store/index.js index 5f08cf0ba..a7b3420a9 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -169,7 +169,7 @@ export const mutations = { }, // Misc Mutations - setLoadOrderInformation(state, orderInformation) { + updateStateWithOrderInformation(state, orderInformation) { state.order.referralNumber = orderInformation.referralNumber; state.order.referralDate = orderInformation.referralDate; state.order.referralCorrelationId = orderInformation.referralCorrelationId; @@ -189,6 +189,7 @@ export const mutations = { state.order.damage.numberOfChips = orderInformation.numberOfChips; state.order.lineItems.glassParts = orderInformation.parts; state.order.parentAccountNumber = orderInformation.parentAccountNumber; + state.order.serviceLocation.zipCode = orderInformation.zipCode; // TODO CSR-416 Make sure this is correct } } @@ -374,6 +375,7 @@ export const actions = { style: vehicle.style, }, 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 diff --git a/src/store/store.spec.js b/src/store/store.spec.js index c8fe2476b..5c7e0c881 100644 --- a/src/store/store.spec.js +++ b/src/store/store.spec.js @@ -200,12 +200,12 @@ describe("Mutations", () => { expect(storeState.applicationUser.pageData['vehicle-year']).toEqual({}); }); - it("setLoadOrderInformation, should set order information in state", () => { + it("updateStateWithOrderInformation, should set order information in state", () => { // Arrange const storeState = state; // Act - mutations.setLoadOrderInformation(storeState, { + mutations.updateStateWithOrderInformation(storeState, { referralNumber: 123, referralDate: new Date().toUTCString(), referralCorrelationId: "xxx-xxx-xxx",