From 5da7037e4d74dff9f91810b3472cd398cc5439fa Mon Sep 17 00:00:00 2001 From: FrankRua Date: Tue, 29 Mar 2022 09:30:26 -0400 Subject: [PATCH 01/11] lint --- src/.eslintrc.js | 6 ++++++ src/common-components/vehicle-banner/vehicle-banner.spec.js | 2 +- .../replace-options-question.spec.js | 2 +- .../side-door-options/side-door-options.spec.js | 4 ++-- 4 files changed, 10 insertions(+), 4 deletions(-) create mode 100644 src/.eslintrc.js diff --git a/src/.eslintrc.js b/src/.eslintrc.js new file mode 100644 index 000000000..309a0e4fd --- /dev/null +++ b/src/.eslintrc.js @@ -0,0 +1,6 @@ +module.exports = { + env: { + jest: true + }, +//... +} \ No newline at end of file diff --git a/src/common-components/vehicle-banner/vehicle-banner.spec.js b/src/common-components/vehicle-banner/vehicle-banner.spec.js index a6dc13154..210653df2 100644 --- a/src/common-components/vehicle-banner/vehicle-banner.spec.js +++ b/src/common-components/vehicle-banner/vehicle-banner.spec.js @@ -93,7 +93,7 @@ function setupMocks({ categoryValue = "CAR" }) { //Mock store - store.dispatch = jest.fn(() => dataFromStoreApi); + store.dispatch = jest.fn(() => {}); store.getters = { vehicle: { category: categoryValue, imageUrl: imageUrlValue } }; const mountOptions = getMountOptions({ store: { diff --git a/src/layouts/vehicle-damage/replace-options-question/replace-options-question.spec.js b/src/layouts/vehicle-damage/replace-options-question/replace-options-question.spec.js index a6ee43924..be3ef9485 100644 --- a/src/layouts/vehicle-damage/replace-options-question/replace-options-question.spec.js +++ b/src/layouts/vehicle-damage/replace-options-question/replace-options-question.spec.js @@ -3,7 +3,7 @@ import replaceOptionsQuestion from "@/layouts/vehicle-damage/replace-options-que import { getMountOptions } from "@/helpers/unit-test-helper.js"; import { nextTick } from "vue"; import store from "@/store"; -jest.mock("@/store", () => { return {}; }, {virtual: true}); +jest.mock("@/store",()=>{return{};},{virtual:true}); describe("replace-options-question.vue", () => { test("Selected damage option is emitted upon selection.", async () => { diff --git a/src/layouts/vehicle-damage/side-door-options/side-door-options.spec.js b/src/layouts/vehicle-damage/side-door-options/side-door-options.spec.js index 9c40a0683..29bbb68b5 100644 --- a/src/layouts/vehicle-damage/side-door-options/side-door-options.spec.js +++ b/src/layouts/vehicle-damage/side-door-options/side-door-options.spec.js @@ -3,7 +3,7 @@ import sideDoorOptions from "@/layouts/vehicle-damage/side-door-options/side-doo import { getMountOptions } from "@/helpers/unit-test-helper.js"; import replaceOptionsQuestion from "@/layouts/vehicle-damage/replace-options-question/replace-options-question"; import store from "@/store"; -jest.mock("@/store", () => { return {}; }, {virtual: true}); +jest.mock("@/store",()=>{return{};},{virtual:true}); describe("replace-options-question.vue", () => { test("Selected side door option is emitted upon selection.", async () => { @@ -95,7 +95,7 @@ describe("replace-options-question.vue", () => { }) { //Mock store - store.dispatch = jest.fn(() => dataFromStoreApi); + store.dispatch = jest.fn(() => {}); store.getters = { vehicle: {year: 2019, make: 'honda', model: 'civc', style: '2 Door', category: 'CAR'} }; const mountOptions = getMountOptions({ store: { From 4ee9a3fd06a62a01e8202431976c56ef22b43311 Mon Sep 17 00:00:00 2001 From: FrankRua Date: Tue, 29 Mar 2022 10:16:52 -0400 Subject: [PATCH 02/11] session helper unit tests --- .../heritage-integration/order-helper.spec.js | 26 ++++++- .../session-helper.spec.js | 67 +++++++++++++++++++ 2 files changed, 91 insertions(+), 2 deletions(-) create mode 100644 src/helpers/heritage-integration/session-helper.spec.js diff --git a/src/helpers/heritage-integration/order-helper.spec.js b/src/helpers/heritage-integration/order-helper.spec.js index 1826b6da6..b17e9ec75 100644 --- a/src/helpers/heritage-integration/order-helper.spec.js +++ b/src/helpers/heritage-integration/order-helper.spec.js @@ -47,7 +47,7 @@ describe("loadOrderIfPresent", () => { expect(cookieHelper.getConceptCookie).toHaveBeenCalled(); expect(mocks.baseMixin.methods.dispatchNonBlockingStoreAction).toHaveBeenCalledWith(storeActions.RESET_STATE); - cookieHelper.getConceptCookie.mockRestore(); + // store.dispatch.mockRestore(); }); @@ -69,8 +69,30 @@ describe("loadOrderIfPresent", () => { // Assert expect(cookieHelper.getConceptCookie).toHaveBeenCalled(); expect(mocks.baseMixin.methods.dispatchNonBlockingStoreAction).not.toHaveBeenCalledWith(storeActions.RESET_STATE); + }); - cookieHelper.getConceptCookie.mockRestore(); + test("Concept cookie valid, should call loadOrder", async () => { + // Arrange + cookieHelper.getConceptCookie = jest.spyOn(cookieHelper, "getConceptCookie") + .mockReturnValueOnce({ ShouldResetState: false, ReferralNumber: 123456, ReferralCorrelationId: "yyy-yyy-yyyy", ReferralDate: new Date()}); + + const mockData = { + actionList: [{ + actionName: storeActions.LOAD_ORDER, + data: { ReferralNumber: 123456, vehicle: { year: 2010 } } + }], + } + + var mocks = setupMocksForJsFiles(mockData); + + // Act + const result = await loadOrderIfPresent(); + + // Assert + expect(cookieHelper.getConceptCookie).toHaveBeenCalled(); + expect(mocks.baseMixin.methods.dispatchNonBlockingStoreAction).not.toHaveBeenCalledWith(storeActions.LOAD_ORDER); + expect(result.ReferralNumber).toBe(123456); + expect(result.vehicle.year).toBe(2010); }); }); diff --git a/src/helpers/heritage-integration/session-helper.spec.js b/src/helpers/heritage-integration/session-helper.spec.js new file mode 100644 index 000000000..b75923ebe --- /dev/null +++ b/src/helpers/heritage-integration/session-helper.spec.js @@ -0,0 +1,67 @@ +import * as cookieHelper from "@/helpers/heritage-integration/cookie-helper"; +import { isAnalyticsSessionStillActive, isSavedSessionStillActive } from "@/helpers/heritage-integration/session-helper"; + +describe("isAnalyticsSessionStillActive", () => { + test("isAnalyticsSessionStillActive, should return true", () => { + // Arrange + const mockDate = new Date(new Date().toUTCString()) + mockDate.setDate(mockDate.getDate() + 1) + + cookieHelper.getConceptCookie = jest.spyOn(cookieHelper, "getConceptCookie") + .mockReturnValue({ LastTouched: mockDate }); + + // Act + const result = isAnalyticsSessionStillActive(); + + // Assert + expect(result).toBe(true); + }); + + test("isAnalyticsSessionStillActive, should return false", () => { + // Arrange + const mockDate = new Date(new Date().toUTCString()) + mockDate.setDate(mockDate.getDate() - 1) + + cookieHelper.getConceptCookie = jest.spyOn(cookieHelper, "getConceptCookie") + .mockReturnValue({ LastTouched: mockDate }); + + // Act + const result = isAnalyticsSessionStillActive(); + + // Assert + expect(result).toBe(false); + }); +}); + +describe("isSavedSessionStillActive", () => { + test("isSavedSessionStillActive, should return true", () => { + // Arrange + const mockDate = new Date(new Date().toUTCString()) + mockDate.setDate(mockDate.getDate() + 1); + + cookieHelper.getConceptCookie = jest.spyOn(cookieHelper, "getConceptCookie") + .mockReturnValue({ SavedQuoteTimeoutDate: mockDate }); + + // Act + const result = isSavedSessionStillActive(); + + // Assert + expect(result).toBe(true); + }); + + test("isSavedSessionStillActive, should return false", () => { + // Arrange + const mockDate = new Date(new Date().toUTCString()) + mockDate.setDate(mockDate.getDate() + 65) + + cookieHelper.getConceptCookie = jest.spyOn(cookieHelper, "getConceptCookie") + .mockReturnValue({ SavedQuoteTimeoutDate: mockDate }); + + // Act + const result = isSavedSessionStillActive(); + + // Assert + expect(result).toBe(false); + + }); +}); \ No newline at end of file From 32c63e6b63ea3e7ff97456802d65b6f495d06fa9 Mon Sep 17 00:00:00 2001 From: FrankRua Date: Tue, 29 Mar 2022 11:21:50 -0400 Subject: [PATCH 03/11] more unit tests --- .../navigation-helper.spec.js | 68 ++++++++++++++ .../heritage-integration/session-helper.js | 2 +- .../session-helper.spec.js | 21 ++++- src/store/store.spec.js | 92 +++++++++++++++++++ 4 files changed, 179 insertions(+), 4 deletions(-) diff --git a/src/helpers/heritage-integration/navigation-helper.spec.js b/src/helpers/heritage-integration/navigation-helper.spec.js index 78f91162b..fd06920c2 100644 --- a/src/helpers/heritage-integration/navigation-helper.spec.js +++ b/src/helpers/heritage-integration/navigation-helper.spec.js @@ -4,6 +4,7 @@ import { lazyLoadComponent } from "@/router/dynamic-routing/component-loader.js" import { storeActions } from "@/constants/store-actions"; import { setupMocksForJsFiles, getMockOrderInfo } from "@/helpers/unit-test-helper.js"; import { externalUrls } from "@/router/router-constants/externalUrl-values"; +import { queryStrings } from "@/constants/query-strings"; import store from "@/store"; import router from "@/router"; @@ -15,6 +16,58 @@ jest.mock("@/router/dynamic-routing/component-loader.js", () => ({ describe("getPageToRouteExistingOrderTo", () => { + test("getPageToRouteExistingOrderTo, should return vehicle-year", async () => { + // Arrange + const toRoute = { + query: {} + }; + + // Mock out the lazy load calls for all components. + lazyLoadComponent + .mockReturnValueOnce(() => { + return { + default: { + methods: { + arePagePrerequisitesValid: jest.fn().mockReturnValueOnce(false) + } + } + } + }) + .mockReturnValueOnce(() => { + return { + default: { + methods: { + arePagePrerequisitesValid: jest.fn().mockReturnValueOnce(false) + } + } + } + }) + .mockReturnValueOnce(() => { + return { + default: { + methods: { + arePagePrerequisitesValid: jest.fn().mockReturnValueOnce(false) + } + } + } + }) + .mockReturnValueOnce(() => { + return { + default: { + methods: { + arePagePrerequisitesValid: jest.fn().mockReturnValueOnce(false) + } + } + } + }); + + // Act + const result = await getPageToRouteExistingOrderTo(toRoute, false); + + //Assert + expect(result).toBe('vehicle-year'); + }); + test("getPageToRouteExistingOrderTo, should return vehicle-model", async () => { // Arrange const toRoute = { @@ -232,6 +285,21 @@ describe("getPageToRouteExistingOrderTo", () => { //Assert expect(result).toBe('estimate'); }); + + test("getPageToRouteExistingOrderTo, existing order, should return heritage", async () => { + // Arrange + const toRoute = { + query: { + [queryStrings.START_TYPE]: 'fmg' + } + } + + // Act + const result = await getPageToRouteExistingOrderTo(toRoute, true); + + // Assert + expect(result).toBe("heritage"); + }) }); describe("navigateToHeritageFunnel", () => { diff --git a/src/helpers/heritage-integration/session-helper.js b/src/helpers/heritage-integration/session-helper.js index 068c445eb..49a0d8530 100644 --- a/src/helpers/heritage-integration/session-helper.js +++ b/src/helpers/heritage-integration/session-helper.js @@ -30,7 +30,7 @@ export function isSavedSessionStillActive() { if (getConceptCookie() !== null) { const savedSessionTimeStamp = new Date(getConceptCookie().SavedQuoteTimeoutDate); const isSavedSessionTimedOut = (new Date(new Date().toUTCString()) > savedSessionTimeStamp); - + console.log(savedSessionTimeStamp, isSavedSessionTimedOut); console.log("Saved Session Timed Out? --->", isSavedSessionTimedOut); if (isSavedSessionTimedOut) { diff --git a/src/helpers/heritage-integration/session-helper.spec.js b/src/helpers/heritage-integration/session-helper.spec.js index b75923ebe..1c974d508 100644 --- a/src/helpers/heritage-integration/session-helper.spec.js +++ b/src/helpers/heritage-integration/session-helper.spec.js @@ -1,5 +1,6 @@ import * as cookieHelper from "@/helpers/heritage-integration/cookie-helper"; -import { isAnalyticsSessionStillActive, isSavedSessionStillActive } from "@/helpers/heritage-integration/session-helper"; +import { isAnalyticsSessionStillActive, isSavedSessionStillActive, getDateForSavedSessionTimeout} from "@/helpers/heritage-integration/session-helper"; +import { applicationConfig } from "@/constants/application-config"; describe("isAnalyticsSessionStillActive", () => { test("isAnalyticsSessionStillActive, should return true", () => { @@ -52,7 +53,7 @@ describe("isSavedSessionStillActive", () => { test("isSavedSessionStillActive, should return false", () => { // Arrange const mockDate = new Date(new Date().toUTCString()) - mockDate.setDate(mockDate.getDate() + 65) + mockDate.setDate(mockDate.getDate() - 1) cookieHelper.getConceptCookie = jest.spyOn(cookieHelper, "getConceptCookie") .mockReturnValue({ SavedQuoteTimeoutDate: mockDate }); @@ -64,4 +65,18 @@ describe("isSavedSessionStillActive", () => { expect(result).toBe(false); }); -}); \ No newline at end of file +}); + +describe("getDateForSavedSessionTimeout", () => { + test("getDateForSavedSessionTimeout, should equal application config setting", () =>{ + // Arrange + const currentDate = new Date(new Date().toUTCString()) + currentDate.setDate(currentDate.getDate() + applicationConfig.SAVED_SESSION_TIMEOUT) + + // Act + const result = getDateForSavedSessionTimeout(); + + // Assert + expect(result).toEqual(currentDate.toUTCString()); + }); +}) \ No newline at end of file diff --git a/src/store/store.spec.js b/src/store/store.spec.js index a3f8a5cb5..b97ede119 100644 --- a/src/store/store.spec.js +++ b/src/store/store.spec.js @@ -200,6 +200,38 @@ describe("Mutations", () => { expect(storeState.applicationUser.pageData['vehicle-year']).toEqual({}); }); + it("setLoadOrderInformation, should set order information in state", () => { + // Arrange + const storeState = state; + + // Act + mutations.setLoadOrderInformation(storeState, { + referralNumber: 123, + referralDate: new Date().toUTCString(), + referralCorrelationId: "xxx-xxx-xxx", + vehicle: { + year: "2019", + make: "Acura", + model: "ILX", + style: "4 DOOR SEDAN", + carId: "C0000001", + category: "CAR" + }, + glassToReplace: ["Windshield"], + isRepair: false, + numberOfChips: 0, + parts: [], + parentAccountNumber: "123456789", + }); + + // Assert + expect(storeState.order.referralNumber).toEqual(123); + expect(storeState.order.referralCorrelationId).toEqual("xxx-xxx-xxx"); + expect(storeState.order.vehicle.year).toEqual("2019"); + expect(storeState.order.vehicle.make).toEqual("Acura"); + expect(storeState.order.vehicle.model).toEqual("ILX"); + }); + }); describe("Actions", () => { @@ -466,6 +498,66 @@ describe("Actions", () => { expect(response.data).toEqual({ imageUrl: "https://test.com" }); }); + it("saveOrder action, returns order information", async () => { + // Arrange + const context = state; + + context.getters = { + vehicle: {}, + damage: {}, + }; + context.state = { + order: {} + }; + + globalMethods.callHttpClient.mockImplementation(() => { + return Promise.resolve({ data: { referralNumber: 123 } }); + }); + + // Act + const response = await actions.saveOrder(context); + + // Assert + expect(response.data).toEqual({ referralNumber: 123 }); + }); + + + it("loadOrder action, returns order information, calls mutation", async () => { + // Arrange + const context = state; + + globalMethods.callHttpClient.mockImplementation(() => { + return Promise.resolve({ data: { referralNumber: 123 } }); + }); + + const commit = jest.fn(); + + context.commit = commit; + + // Act + const response = await actions.loadOrder(context, {referralNumber: "123", referralDate: new Date().toUTCString(), referralCorrelationId: "xxx-xxx-xxx"}); + + // Assert + expect(response.data).toEqual({ referralNumber: 123 }); + expect(commit).toBeCalledWith(storeMutations.SET_LOAD_CONCEPT_SESSION_INFO, {"referralNumber": 123}); + }); + + it("setReferralInformation, should call commit three times", () => { + // Arrange + const context = state; + const commit = jest.fn(); + + context.commit = commit; + + // Act + actions.setReferralInformation(context, {referralNumber: "123", referralDate: new Date().toUTCString(), referralCorrelationId: "xxx-xxx-xxx"}); + + // Assert + expect(commit).toBeCalledWith(storeMutations.UPDATE_REFERRAL_NUMBER, "123"); + expect(commit).toBeCalledWith(storeMutations.UPDATE_REFERRAL_DATE, new Date().toUTCString()); + expect(commit).toBeCalledWith(storeMutations.UPDATE_REFERRAL_CORRELATION_ID, "xxx-xxx-xxx"); + }); + }); describe("Getters", () => { From 3f09ccc022cb76179088397aed01b53f8756a012 Mon Sep 17 00:00:00 2001 From: FrankRua Date: Tue, 29 Mar 2022 11:54:02 -0400 Subject: [PATCH 04/11] New variable --- azure-pipelines.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index ba2e359dc..e58f51862 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -78,4 +78,5 @@ stages: appDeployVariables: __VUE_APP_CONSUMER_API_GATEWAY__: $(__VUE_APP_CONSUMER_API_GATEWAY__) __VUE_APP_GOOGLE_PLACES_API_KEY__: $(__VUE_APP_GOOGLE_PLACES_API_KEY__) + __VUE_APP_HERITAGE_FUNNEL__: $(__VUE_APP_HERITAGE_FUNNEL__) cfDistributionId: $(cfDistributionId) \ No newline at end of file From 9f49aafb7b8752379cc881d62acbfd9de40d4437 Mon Sep 17 00:00:00 2001 From: Katie Date: Tue, 29 Mar 2022 12:09:28 -0400 Subject: [PATCH 05/11] CSR-98 Remove mockRestore() --- src/helpers/heritage-integration/order-helper.spec.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/helpers/heritage-integration/order-helper.spec.js b/src/helpers/heritage-integration/order-helper.spec.js index 4a24c0573..fd0507bbb 100644 --- a/src/helpers/heritage-integration/order-helper.spec.js +++ b/src/helpers/heritage-integration/order-helper.spec.js @@ -46,8 +46,6 @@ describe("loadOrderIfPresent", () => { // Assert expect(cookieHelper.getConceptCookie).toHaveBeenCalled(); expect(mocks.baseMixin.methods.dispatchNonBlockingStoreAction).toHaveBeenCalledWith(storeActions.RESET_STATE); - - cookieHelper.getConceptCookie.mockRestore(); }); test("Concept cookie is null => store is unchanged", () => { From b6b5b6696e2c406364ec134a76527d6b2e8935e3 Mon Sep 17 00:00:00 2001 From: FrankRua Date: Tue, 29 Mar 2022 13:56:44 -0400 Subject: [PATCH 06/11] Temporary until estimate and vin pages exist --- src/helpers/heritage-integration/navigation-helper.js | 6 ++++-- src/helpers/heritage-integration/navigation-helper.spec.js | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/helpers/heritage-integration/navigation-helper.js b/src/helpers/heritage-integration/navigation-helper.js index 0aad13e50..9369fc7ac 100644 --- a/src/helpers/heritage-integration/navigation-helper.js +++ b/src/helpers/heritage-integration/navigation-helper.js @@ -45,9 +45,11 @@ export async function getPageToRouteExistingOrderTo(toRoute = {}, existingHerita return 'vehicle-damage' } else { if (store.getters.vehicle.vin) { - return "vin-lookup"; + return 'vehicle-damage'; + //return "vin-lookup"; (uncomment) } else { - return "estimate" + return 'vehicle-damage'; + //return "estimate" (uncomment) } } diff --git a/src/helpers/heritage-integration/navigation-helper.spec.js b/src/helpers/heritage-integration/navigation-helper.spec.js index fd06920c2..be1136e63 100644 --- a/src/helpers/heritage-integration/navigation-helper.spec.js +++ b/src/helpers/heritage-integration/navigation-helper.spec.js @@ -228,7 +228,8 @@ describe("getPageToRouteExistingOrderTo", () => { const result = await getPageToRouteExistingOrderTo(toRoute, false); //Assert - expect(result).toBe('vin-lookup'); + //expect(result).toBe('vin-lookup'); + expect(result).toBe('vehicle-damage'); }); test("getPageToRouteExistingOrderTo, should return estimate", async () => { @@ -283,7 +284,8 @@ describe("getPageToRouteExistingOrderTo", () => { const result = await getPageToRouteExistingOrderTo(toRoute, false); //Assert - expect(result).toBe('estimate'); + //expect(result).toBe('estimate'); + expect(result).toBe('vehicle-damage'); }); test("getPageToRouteExistingOrderTo, existing order, should return heritage", async () => { From a1c5150039f312c58b497d957acc974c0b9881d4 Mon Sep 17 00:00:00 2001 From: FrankRua Date: Tue, 29 Mar 2022 16:21:48 -0400 Subject: [PATCH 07/11] rename concept to funnel --- src/constants/application-config.js | 4 +-- src/constants/cookie-names.js | 2 +- src/constants/store-mutations.js | 2 +- .../heritage-integration/cookie-helper.js | 36 +++++++------------ .../cookie-helper.spec.js | 26 +++++++------- .../heritage-integration/navigation-helper.js | 4 +-- .../heritage-integration/order-helper.js | 22 ++++-------- .../heritage-integration/order-helper.spec.js | 22 ++++++------ .../heritage-integration/session-helper.js | 16 ++++----- .../session-helper.spec.js | 10 +++--- src/helpers/unit-test-helper.js | 8 ++--- src/router/index.js | 12 +++---- src/store/index.js | 2 +- src/store/store.spec.js | 2 +- 14 files changed, 72 insertions(+), 96 deletions(-) diff --git a/src/constants/application-config.js b/src/constants/application-config.js index d427b1d72..f2aff2951 100644 --- a/src/constants/application-config.js +++ b/src/constants/application-config.js @@ -1,8 +1,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: 30, - SAVED_SESSION_TIMEOUT: 45 + ANALYTICS_SESSION_TIMEOUT_MINUTES: 30, + SAVED_SESSION_TIMEOUT_DAYS: 45 }; diff --git a/src/constants/cookie-names.js b/src/constants/cookie-names.js index 6b1e3c909..2756a8eb7 100644 --- a/src/constants/cookie-names.js +++ b/src/constants/cookie-names.js @@ -1,5 +1,5 @@ const cookieNames = { - CONCEPT_SESSION_INFO: "ConceptSessionInfo", + FUNNEL_SESSION_INFO: "FunnelSessionInfo", }; export { cookieNames }; diff --git a/src/constants/store-mutations.js b/src/constants/store-mutations.js index 00ac66d58..8b59bacb0 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_CONCEPT_SESSION_INFO: "setLoadOrderInformation" + SET_LOAD_FUNNEL_SESSION_INFO: "setLoadOrderInformation" }; diff --git a/src/helpers/heritage-integration/cookie-helper.js b/src/helpers/heritage-integration/cookie-helper.js index 9de5d5760..096d03a04 100644 --- a/src/helpers/heritage-integration/cookie-helper.js +++ b/src/helpers/heritage-integration/cookie-helper.js @@ -5,22 +5,12 @@ import store from "@/store"; /* Will update the cookie if present, or create a new one if not. */ -export function updateOrCreateConceptCookie() { - console.log("Updating cookie...", { - LastTouched: new Date().toUTCString(), - SavedQuoteTimeoutDate: store.getters.applicationUser.savedSessionTimeout, - DidHeritageFunnelUpdateLast: false, - ShouldResetState: false, - ReferralNumber: store.getters.order.referralNumber, - ReferralDate: store.getters.order.referralDate, - ReferralCorrelationId: store.getters.order.referralCorrelationId, - }); - +export function updateOrCreateFunnelCookie() { // Create the cookie - document.cookie = `${cookieNames.CONCEPT_SESSION_INFO}={}; path=/`; + document.cookie = `${cookieNames.FUNNEL_SESSION_INFO}={}; path=/`; // Set up cookie with all the props. - setConceptCookieProperties({ + setFunnelCookieProperties({ LastTouched: new Date().toUTCString(), SavedQuoteTimeoutDate: store.getters.applicationUser.savedSessionTimeout, DidHeritageFunnelUpdateLast: false, @@ -33,13 +23,13 @@ export function updateOrCreateConceptCookie() { } /* - Gets the current instance of the concept funnel cookie. + Gets the current instance of the funnel cookie. Returns null if cookie isn't valid JSON. */ -export function getConceptCookie() { +export function getFunnelCookie() { const cookieJson = document.cookie ?.split("; ") - ?.find(row => row.startsWith(`${cookieNames.CONCEPT_SESSION_INFO}=`)) + ?.find(row => row.startsWith(`${cookieNames.FUNNEL_SESSION_INFO}=`)) ?.split("=")[1]; try { @@ -50,19 +40,19 @@ export function getConceptCookie() { } /* - Removes concept cookie from browser. + Removes cookie from browser. */ -export function deleteConceptCookie() { - document.cookie = `${cookieNames.CONCEPT_SESSION_INFO}=; Max-Age=0; path=/; domain=${location.hostname}`; +export function deleteFunnelCookie() { + document.cookie = `${cookieNames.FUNNEL_SESSION_INFO}=; Max-Age=0; path=/; domain=${location.hostname}`; } /* - Used to set properties on the concept funnel cookie. + Used to set properties on the funnel cookie. Takes an object with properties to set. Will overwrite existing properties. */ -function setConceptCookieProperties(properties) { +function setFunnelCookieProperties(properties) { if (typeof properties == "object") { - let cookie = getConceptCookie(); + let cookie = getFunnelCookie(); if (cookie !== null) { Object.keys(properties).forEach(key => { @@ -71,7 +61,7 @@ function setConceptCookieProperties(properties) { const cookieValueJson = JSON.stringify(cookie); - document.cookie = `${cookieNames.CONCEPT_SESSION_INFO}=${cookieValueJson}; path=/`; + document.cookie = `${cookieNames.FUNNEL_SESSION_INFO}=${cookieValueJson}; path=/`; } } } diff --git a/src/helpers/heritage-integration/cookie-helper.spec.js b/src/helpers/heritage-integration/cookie-helper.spec.js index a20af9300..9d14389e2 100644 --- a/src/helpers/heritage-integration/cookie-helper.spec.js +++ b/src/helpers/heritage-integration/cookie-helper.spec.js @@ -1,4 +1,4 @@ -import {getConceptCookie} from "@/helpers/heritage-integration/cookie-helper.js"; +import {getFunnelCookie} from "@/helpers/heritage-integration/cookie-helper.js"; import { removeAllTestCookies, setupCookies } from "@/helpers/unit-test-helper"; describe("cookies", () => { @@ -7,7 +7,7 @@ describe("cookies", () => { removeAllTestCookies(); }) - describe("getConceptCookie method", () => { + describe("getFunnelCookie method", () => { test("gets correct value when cookie is present", () => { // Arrange const testReferralNumber = 1566818; @@ -24,10 +24,10 @@ describe("cookies", () => { DidHeritageFunnelUpdateLast: testDidHeritageFunnelUpdateLast } - setupCookies({ conceptCookieValue: JSON.stringify(testCookieValue) }); + setupCookies({ funnelCookieValue: JSON.stringify(testCookieValue) }); // Act - var result = getConceptCookie(); + var result = getFunnelCookie(); // Assert expect(result).toEqual(testCookieValue); @@ -42,10 +42,10 @@ describe("cookies", () => { test("returns empty object when value is empty object", () => { // Arrange const testCookieValue = {}; - setupCookies({ conceptCookieValue: JSON.stringify(testCookieValue) }); + setupCookies({ funnelCookieValue: JSON.stringify(testCookieValue) }); // Act - var result = getConceptCookie(); + var result = getFunnelCookie(); // Assert expect(result).toEqual(testCookieValue); @@ -56,21 +56,21 @@ describe("cookies", () => { test("returns null when value is empty string", () => { // Arrange const testCookieValue = ""; - setupCookies({ conceptCookieValue: testCookieValue }); + setupCookies({ funnelCookieValue: testCookieValue }); // Act - var result = getConceptCookie(); + var result = getFunnelCookie(); // Assert expect(result).toEqual(null); }); - test("returns null when concept cookie doesn't exist", () => { + test("returns null when funnel cookie doesn't exist", () => { // Arrange setupCookies({ includeHeritageCookie: false }); // Act - var result = getConceptCookie(); + var result = getFunnelCookie(); // Assert expect(result).toEqual(null); @@ -80,10 +80,10 @@ describe("cookies", () => { // Arrange const testCookieValue = { test: "testValue" }; - setupCookies({ conceptCookieValue: JSON.stringify(testCookieValue) }); + setupCookies({ funnelCookieValue: JSON.stringify(testCookieValue) }); // Act - const actualCookieValue = getConceptCookie(); + const actualCookieValue = getFunnelCookie(); // Assert expect(actualCookieValue).toEqual(testCookieValue); @@ -94,7 +94,7 @@ describe("cookies", () => { setupCookies({ includeHeritageCookie: false }); // Act - const actualCookieValue = getConceptCookie(); + const actualCookieValue = getFunnelCookie(); // Assert expect(actualCookieValue).toBeNull(); diff --git a/src/helpers/heritage-integration/navigation-helper.js b/src/helpers/heritage-integration/navigation-helper.js index 6207351dc..19e036561 100644 --- a/src/helpers/heritage-integration/navigation-helper.js +++ b/src/helpers/heritage-integration/navigation-helper.js @@ -6,7 +6,7 @@ import store from "@/store"; import router from "@/router"; /* - If the user has visited the concept 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 drop them so they don't start at the beginning again. This method will return 'heritage' if the user has an existing order and they come back in from the Safelite.com CTA. */ @@ -14,11 +14,9 @@ export async function getPageToRouteExistingOrderTo(toRoute = {}, existingHerita // If the user is coming in via the Safelite.Com CTA if (toRoute.query[queryStrings.START_TYPE] === 'fmg') { - console.log("Start type is FMG... trying to figure out where to send them..."); // If they have an existing order, return 'heritage' for the page name. if (existingHeritageOrder) { - console.log("Existing heritage order found, returning 'heritage' for page redirect..."); return 'heritage'; } } diff --git a/src/helpers/heritage-integration/order-helper.js b/src/helpers/heritage-integration/order-helper.js index cf8a45d16..aaf0db740 100644 --- a/src/helpers/heritage-integration/order-helper.js +++ b/src/helpers/heritage-integration/order-helper.js @@ -1,5 +1,5 @@ import { storeActions } from "@/constants/store-actions.js"; -import { getConceptCookie, updateOrCreateConceptCookie, deleteConceptCookie } from "@/helpers/heritage-integration/cookie-helper.js"; +import { getFunnelCookie, updateOrCreateFunnelCookie, deleteFunnelCookie } from "@/helpers/heritage-integration/cookie-helper.js"; import baseMixin from "@/mixins/base-mixin"; /* @@ -9,29 +9,23 @@ import baseMixin from "@/mixins/base-mixin"; */ export async function loadOrderIfPresent() { - console.log("attempting to load referral...."); - const conceptCookie = getConceptCookie(); - - console.log(conceptCookie) + const funnelCookie = getFunnelCookie(); // Do nothing if there is no cookie or no correlation id. - if (conceptCookie == null || conceptCookie.ReferralCorrelationId == null) { - console.log("No referral found"); + if (funnelCookie == null || funnelCookie.ReferralCorrelationId == null) { return null; } // Reset state if cookie says to. - if (conceptCookie.ShouldResetState) { - console.log("Resetting state..."); + if (funnelCookie.ShouldResetState) { baseMixin.methods.dispatchNonBlockingStoreAction(storeActions.RESET_STATE); - deleteConceptCookie(); + deleteFunnelCookie(); return null; } - console.log("calling load order from loadOrderIfPresent()..."); // Load referral if there is a cookie, and it doesn't indicate it needs a state reset. - return (await loadOrder(conceptCookie.ReferralNumber, conceptCookie.ReferralDate, conceptCookie.ReferralCorrelationId)).data; + return (await loadOrder(funnelCookie.ReferralNumber, funnelCookie.ReferralDate, funnelCookie.ReferralCorrelationId)).data; } /* @@ -40,7 +34,6 @@ export async function loadOrderIfPresent() { update the cookie. */ export async function saveOrder() { - console.log("saving order..."); const savedOrderInfo = await baseMixin.methods.dispatchNonBlockingStoreAction(storeActions.SAVE_ORDER); // Save the referral information back from the store. @@ -51,7 +44,7 @@ export async function saveOrder() { }, false); // Update the cookie with the referral information when saved. - updateOrCreateConceptCookie(); + updateOrCreateFunnelCookie(); } @@ -62,7 +55,6 @@ export async function saveOrder() { and returns the response. */ async function loadOrder(referralNumber, referralDate, referralCorrelationId) { - console.log("loading order...", referralNumber, referralDate, referralCorrelationId); const response = await baseMixin.methods.dispatchNonBlockingStoreAction(storeActions.LOAD_ORDER, { referralNumber: referralNumber.toString(), diff --git a/src/helpers/heritage-integration/order-helper.spec.js b/src/helpers/heritage-integration/order-helper.spec.js index fd0507bbb..2e68867e9 100644 --- a/src/helpers/heritage-integration/order-helper.spec.js +++ b/src/helpers/heritage-integration/order-helper.spec.js @@ -11,7 +11,7 @@ describe("loadOrderIfPresent", () => { removeAllTestCookies(); }); - test("ShouldResetState == true => concept cookie is deleted", () => { + test("ShouldResetState == true => funnel cookie is deleted", () => { // Arrange const testShouldResetState = true; @@ -30,7 +30,7 @@ describe("loadOrderIfPresent", () => { test("ShouldResetState == true => reset store", () => { // Arrange - cookieHelper.getConceptCookie = jest.spyOn(cookieHelper, "getConceptCookie").mockReturnValueOnce({ ShouldResetState: true, ReferralCorrelationId: "xxx-xxx-xxx" }); + cookieHelper.getFunnelCookie = jest.spyOn(cookieHelper, "getFunnelCookie").mockReturnValueOnce({ ShouldResetState: true, ReferralCorrelationId: "xxx-xxx-xxx" }); const mockData = { actionList: [{ @@ -44,13 +44,13 @@ describe("loadOrderIfPresent", () => { loadOrderIfPresent(); // Assert - expect(cookieHelper.getConceptCookie).toHaveBeenCalled(); + expect(cookieHelper.getFunnelCookie).toHaveBeenCalled(); expect(mocks.baseMixin.methods.dispatchNonBlockingStoreAction).toHaveBeenCalledWith(storeActions.RESET_STATE); }); - test("Concept cookie is null => store is unchanged", () => { + test("Funnel cookie is null => store is unchanged", () => { // Arrange - cookieHelper.getConceptCookie = jest.spyOn(cookieHelper, "getConceptCookie").mockReturnValueOnce(null); + cookieHelper.getFunnelCookie = jest.spyOn(cookieHelper, "getFunnelCookie").mockReturnValueOnce(null); const mockData = { actionList: [{ @@ -64,13 +64,13 @@ describe("loadOrderIfPresent", () => { loadOrderIfPresent(); // Assert - expect(cookieHelper.getConceptCookie).toHaveBeenCalled(); + expect(cookieHelper.getFunnelCookie).toHaveBeenCalled(); expect(mocks.baseMixin.methods.dispatchNonBlockingStoreAction).not.toHaveBeenCalledWith(storeActions.RESET_STATE); }); - test("Concept cookie valid, should call loadOrder", async () => { + test("Funnel cookie valid, should call loadOrder", async () => { // Arrange - cookieHelper.getConceptCookie = jest.spyOn(cookieHelper, "getConceptCookie") + cookieHelper.getFunnelCookie = jest.spyOn(cookieHelper, "getFunnelCookie") .mockReturnValueOnce({ ShouldResetState: false, ReferralNumber: 123456, ReferralCorrelationId: "yyy-yyy-yyyy", ReferralDate: new Date()}); const mockData = { @@ -86,7 +86,7 @@ describe("loadOrderIfPresent", () => { const result = await loadOrderIfPresent(); // Assert - expect(cookieHelper.getConceptCookie).toHaveBeenCalled(); + expect(cookieHelper.getFunnelCookie).toHaveBeenCalled(); expect(mocks.baseMixin.methods.dispatchNonBlockingStoreAction).not.toHaveBeenCalledWith(storeActions.LOAD_ORDER); expect(result.ReferralNumber).toBe(123456); expect(result.vehicle.year).toBe(2010); @@ -159,12 +159,12 @@ describe("saveOrder", () => { DidHeritageFunnelUpdateLast: true } - setupCookies({ conceptCookieValue: JSON.stringify(testCookieValue) }); + setupCookies({ funnelCookieValue: JSON.stringify(testCookieValue) }); // Act await saveOrder(); // Assert - expect(cookieHelper.getConceptCookie().DidHeritageFunnelUpdateLast).toEqual(false); + expect(cookieHelper.getFunnelCookie().DidHeritageFunnelUpdateLast).toEqual(false); }); }); diff --git a/src/helpers/heritage-integration/session-helper.js b/src/helpers/heritage-integration/session-helper.js index 49a0d8530..ba816cdb1 100644 --- a/src/helpers/heritage-integration/session-helper.js +++ b/src/helpers/heritage-integration/session-helper.js @@ -1,14 +1,14 @@ import { applicationConfig } from "@/constants/application-config"; -import { getConceptCookie} from "@/helpers/heritage-integration/cookie-helper.js"; +import { getFunnelCookie} from "@/helpers/heritage-integration/cookie-helper.js"; /* Method to determine if our analytics session has timed out or not. Amount used for timeout is configurable in application-config.js */ export function isAnalyticsSessionStillActive() { - if (getConceptCookie() !== null) { - const lastTouchedValue = getConceptCookie().LastTouched; - const timeoutAmount = applicationConfig.ANALYTICS_SESSION_TIMEOUT; + if (getFunnelCookie() !== null) { + const lastTouchedValue = getFunnelCookie().LastTouched; + const timeoutAmount = applicationConfig.ANALYTICS_SESSION_TIMEOUT_MINUTES; const isMoreThanHalfHourAgo = ((new Date() - new Date(lastTouchedValue)) / 60000) > timeoutAmount; if (isMoreThanHalfHourAgo) { @@ -27,11 +27,9 @@ export function isAnalyticsSessionStillActive() { Note: That time for saved session timeout is configurable in application-config.js */ export function isSavedSessionStillActive() { - if (getConceptCookie() !== null) { - const savedSessionTimeStamp = new Date(getConceptCookie().SavedQuoteTimeoutDate); + if (getFunnelCookie() !== null) { + const savedSessionTimeStamp = new Date(getFunnelCookie().SavedQuoteTimeoutDate); const isSavedSessionTimedOut = (new Date(new Date().toUTCString()) > savedSessionTimeStamp); - console.log(savedSessionTimeStamp, isSavedSessionTimedOut); - console.log("Saved Session Timed Out? --->", isSavedSessionTimedOut); if (isSavedSessionTimedOut) { return false; @@ -47,6 +45,6 @@ Function to get the date for the saved session timeout. export function getDateForSavedSessionTimeout() { const currentDate = new Date(new Date().toUTCString()) - currentDate.setDate(currentDate.getDate() + applicationConfig.SAVED_SESSION_TIMEOUT) + currentDate.setDate(currentDate.getDate() + applicationConfig.SAVED_SESSION_TIMEOUT_DAYS) return currentDate.toUTCString(); } \ No newline at end of file diff --git a/src/helpers/heritage-integration/session-helper.spec.js b/src/helpers/heritage-integration/session-helper.spec.js index 1c974d508..8a17743d1 100644 --- a/src/helpers/heritage-integration/session-helper.spec.js +++ b/src/helpers/heritage-integration/session-helper.spec.js @@ -8,7 +8,7 @@ describe("isAnalyticsSessionStillActive", () => { const mockDate = new Date(new Date().toUTCString()) mockDate.setDate(mockDate.getDate() + 1) - cookieHelper.getConceptCookie = jest.spyOn(cookieHelper, "getConceptCookie") + cookieHelper.getFunnelCookie = jest.spyOn(cookieHelper, "getFunnelCookie") .mockReturnValue({ LastTouched: mockDate }); // Act @@ -23,7 +23,7 @@ describe("isAnalyticsSessionStillActive", () => { const mockDate = new Date(new Date().toUTCString()) mockDate.setDate(mockDate.getDate() - 1) - cookieHelper.getConceptCookie = jest.spyOn(cookieHelper, "getConceptCookie") + cookieHelper.getFunnelCookie = jest.spyOn(cookieHelper, "getFunnelCookie") .mockReturnValue({ LastTouched: mockDate }); // Act @@ -40,7 +40,7 @@ describe("isSavedSessionStillActive", () => { const mockDate = new Date(new Date().toUTCString()) mockDate.setDate(mockDate.getDate() + 1); - cookieHelper.getConceptCookie = jest.spyOn(cookieHelper, "getConceptCookie") + cookieHelper.getFunnelCookie = jest.spyOn(cookieHelper, "getFunnelCookie") .mockReturnValue({ SavedQuoteTimeoutDate: mockDate }); // Act @@ -55,7 +55,7 @@ describe("isSavedSessionStillActive", () => { const mockDate = new Date(new Date().toUTCString()) mockDate.setDate(mockDate.getDate() - 1) - cookieHelper.getConceptCookie = jest.spyOn(cookieHelper, "getConceptCookie") + cookieHelper.getFunnelCookie = jest.spyOn(cookieHelper, "getFunnelCookie") .mockReturnValue({ SavedQuoteTimeoutDate: mockDate }); // Act @@ -71,7 +71,7 @@ describe("getDateForSavedSessionTimeout", () => { test("getDateForSavedSessionTimeout, should equal application config setting", () =>{ // Arrange const currentDate = new Date(new Date().toUTCString()) - currentDate.setDate(currentDate.getDate() + applicationConfig.SAVED_SESSION_TIMEOUT) + currentDate.setDate(currentDate.getDate() + applicationConfig.SAVED_SESSION_TIMEOUT_DAYS) // Act const result = getDateForSavedSessionTimeout(); diff --git a/src/helpers/unit-test-helper.js b/src/helpers/unit-test-helper.js index 699c4f8e9..62fcc4ae4 100644 --- a/src/helpers/unit-test-helper.js +++ b/src/helpers/unit-test-helper.js @@ -54,7 +54,7 @@ export function setupMocksForJsFiles(mockData = {}) { // Heritage integration common methods export const cookies = { - [cookieNames.CONCEPT_SESSION_INFO]: `{"ReferralNumber":"1566818","ReferralDate":"2022-03-15T10:56:24.597","ReferralCorrelationId":"404d2b04-f86e-45c3-b373-127b6217b060","ShouldResetState":false,"DidHeritageFunnelUpdateLast":true}`, + [cookieNames.FUNNEL_SESSION_INFO]: `{"ReferralNumber":"1566818","ReferralDate":"2022-03-15T10:56:24.597","ReferralCorrelationId":"404d2b04-f86e-45c3-b373-127b6217b060","ShouldResetState":false,"DidHeritageFunnelUpdateLast":true}`, "UNIQUE_SESSION_ID": "33756020-b58e-4ec7-b8b8-3f1576719c40", "anotherCookie": "{}", "someOtherCookie": "{}" @@ -75,11 +75,11 @@ export function getMockOrderInfo(mockReferralNumber, mockCorrelationId, mockRefe } } -export function setupCookies({ conceptCookieValue = "", includeHeritageCookie = true }) { +export function setupCookies({ funnelCookieValue = "", includeHeritageCookie = true }) { Object.keys(cookies).forEach(key => { - const cookieValue = key == cookieNames.CONCEPT_SESSION_INFO ? conceptCookieValue : cookies[key]; + const cookieValue = key == cookieNames.FUNNEL_SESSION_INFO ? funnelCookieValue : cookies[key]; - if (includeHeritageCookie || key != cookieNames.CONCEPT_SESSION_INFO) + if (includeHeritageCookie || key != cookieNames.FUNNEL_SESSION_INFO) document.cookie = `${key}=${cookieValue}; path=/;`; }); } diff --git a/src/router/index.js b/src/router/index.js index eef9d4b23..bbb58e725 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -7,7 +7,7 @@ import { globalEvents, globalEventTypes } from "@/constants/events"; // Heritage integration import { isSavedSessionStillActive } from "@/helpers/heritage-integration/session-helper"; -import { updateOrCreateConceptCookie,getConceptCookie } from "@/helpers/heritage-integration/cookie-helper"; +import { updateOrCreateFunnelCookie,getFunnelCookie } from "@/helpers/heritage-integration/cookie-helper"; import { loadOrderIfPresent, saveOrder } from "@/helpers/heritage-integration/order-helper"; import { getPageToRouteExistingOrderTo, navigateToHeritageFunnel} from "@/helpers/heritage-integration/navigation-helper"; @@ -45,10 +45,10 @@ const routes = [ await GoToFunnelStartOn404(next); } - // Process concept funnel cookie. - updateOrCreateConceptCookie(); + // Process funnel cookie. + updateOrCreateFunnelCookie(); - // On entering the concept funnel "fresh", read cookie information, decide what to do next. + // On entering the funnel "fresh", read cookie information, decide what to do next. if (from.redirectedFrom === undefined) { const loadOrderResponse = await loadOrderIfPresent(); const pageToRedirectTo = await getPageToRouteExistingOrderTo(to, loadOrderResponse); @@ -62,8 +62,6 @@ const routes = [ // Assign our fmgPage so it will load normally like the other pages. to.query.fmgPage = pageToRedirectTo; - - console.log("Page to redirect to: ", pageToRedirectTo); } // If we already have our route, go to it. @@ -164,7 +162,7 @@ async function navigate(scenario, currentRoute, invalidateOnSave, optionalQuery baseMixin.methods.savePageDataToStore(destinationFmgPageValue, optionalPageData); // if cookie and referralNumber/Date exists - if (getConceptCookie()?.ReferralNumber && getConceptCookie()?.ReferralDate) { + if (getFunnelCookie()?.ReferralNumber && getFunnelCookie()?.ReferralDate) { await saveOrder(); } diff --git a/src/store/index.js b/src/store/index.js index 26a0b31b6..5f08cf0ba 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -391,7 +391,7 @@ export const actions = { referralCorrelationId: referralCorrelationId }, }).then((response) => { - context.commit(storeMutations.SET_LOAD_CONCEPT_SESSION_INFO, response.data); + context.commit(storeMutations.SET_LOAD_FUNNEL_SESSION_INFO, response.data); return response; }); } diff --git a/src/store/store.spec.js b/src/store/store.spec.js index b97ede119..c8fe2476b 100644 --- a/src/store/store.spec.js +++ b/src/store/store.spec.js @@ -539,7 +539,7 @@ describe("Actions", () => { // Assert expect(response.data).toEqual({ referralNumber: 123 }); - expect(commit).toBeCalledWith(storeMutations.SET_LOAD_CONCEPT_SESSION_INFO, {"referralNumber": 123}); + expect(commit).toBeCalledWith(storeMutations.SET_LOAD_FUNNEL_SESSION_INFO, {"referralNumber": 123}); }); it("setReferralInformation, should call commit three times", () => { From 5de5f2d17c03ff2913d2f3f184b5a173f0c27266 Mon Sep 17 00:00:00 2001 From: bmauger Date: Tue, 29 Mar 2022 16:28:58 -0400 Subject: [PATCH 08/11] CSR-269 fix rounded border, error border color and size, alert position, container padding --- .../funnel-header/funnel-header.vue | 3 +++ src/layouts/vehicle-damage/vehicle-damage.vue | 12 ++++++------ src/styles/common-error-styles.scss | 8 ++++++++ 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/common-components/funnel-header/funnel-header.vue b/src/common-components/funnel-header/funnel-header.vue index 382640219..3266b88a9 100644 --- a/src/common-components/funnel-header/funnel-header.vue +++ b/src/common-components/funnel-header/funnel-header.vue @@ -66,4 +66,7 @@ export default { .logo-image { max-width: 78px; } +.alert { + left: 0; +} diff --git a/src/layouts/vehicle-damage/vehicle-damage.vue b/src/layouts/vehicle-damage/vehicle-damage.vue index 93a3c9680..fd3f55a74 100644 --- a/src/layouts/vehicle-damage/vehicle-damage.vue +++ b/src/layouts/vehicle-damage/vehicle-damage.vue @@ -5,7 +5,7 @@ ref="theForm" v-slot="{ meta }" > -
+
@@ -285,7 +285,7 @@ export default { }, navigateForward(partsData){ - // CSR-98 TEMP + // CSR-98 TEMP if (store.getters.vehicle.year == 2010) { navigateToHeritageFunnel(); return; @@ -393,15 +393,15 @@ export default { hasSplitSingleConflict() { if (!this.selectedWindshieldOptions.selectedWindshieldReplaceOptions) return false; - return this.selectedWindshieldOptions.selectedWindshieldReplaceOptions.some(selectedSingleWindshield => + return this.selectedWindshieldOptions.selectedWindshieldReplaceOptions.some(selectedSingleWindshield => { return selectedSingleWindshield.toUpperCase() === damageLocationsSelected.SINGLE.toUpperCase(); - }) && - (this.selectedWindshieldOptions.selectedWindshieldReplaceOptions.some(selectedDriverWindshield => + }) && + (this.selectedWindshieldOptions.selectedWindshieldReplaceOptions.some(selectedDriverWindshield => { return selectedDriverWindshield.toUpperCase() === damageLocationsSelected.DRIVER.toUpperCase(); }) || - this.selectedWindshieldOptions.selectedWindshieldReplaceOptions.some(selectedPassengerWindshield => + this.selectedWindshieldOptions.selectedWindshieldReplaceOptions.some(selectedPassengerWindshield => { return selectedPassengerWindshield.toUpperCase() === damageLocationsSelected.PASSENGER.toUpperCase(); }) diff --git a/src/styles/common-error-styles.scss b/src/styles/common-error-styles.scss index 323430dfe..9fdd0ef44 100644 --- a/src/styles/common-error-styles.scss +++ b/src/styles/common-error-styles.scss @@ -11,6 +11,11 @@ input[type=radio]:focus + label { box-shadow: 0 0 0 2.5px $red; } + + &:hover { + box-shadow: 0px 0px 0px 4px $red-200; + border-radius: 10px !important; + } } input[type=checkbox]:checked + label, @@ -21,6 +26,9 @@ color: $red; label { border: 1px solid $red; + &:hover { + box-shadow: 0px 0px 0px 4px $red-200; + } } input[type=checkbox]:focus + label, input[type=radio]:focus + label { From 091e9b129e6de82efaab5c02c3a171f07b9b1408 Mon Sep 17 00:00:00 2001 From: bmauger Date: Wed, 30 Mar 2022 09:21:58 -0400 Subject: [PATCH 09/11] Update error styles. --- src/styles/common-error-styles.scss | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/styles/common-error-styles.scss b/src/styles/common-error-styles.scss index 9fdd0ef44..fe1637e43 100644 --- a/src/styles/common-error-styles.scss +++ b/src/styles/common-error-styles.scss @@ -3,18 +3,18 @@ &.list-card { border: 1px solid $red; color: $red; - label { - box-shadow: 0 0 1px $red !important; - border-radius: .5rem; - } input[type=checkbox]:focus + label, input[type=radio]:focus + label { box-shadow: 0 0 0 2.5px $red; } - + input[type=checkbox]:focus + label:hover, + input[type=radio]:focus + label { + box-shadow: 0 0 0 1px $red; + } &:hover { box-shadow: 0px 0px 0px 4px $red-200; border-radius: 10px !important; + border: 1px solid $red; } } From b4a0e36e6b4ce04ea47b8e356e6ebba15e1a7366 Mon Sep 17 00:00:00 2001 From: FrankRua Date: Wed, 30 Mar 2022 10:31:27 -0400 Subject: [PATCH 10/11] Stopped 404 from happening on initial load --- src/router/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/router/index.js b/src/router/index.js index bbb58e725..fc24e70c4 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -41,7 +41,7 @@ const routes = [ try { // If the saved session has timed out, clear the session, execute 404 logic. - if (!isSavedSessionStillActive()) { + if (getFunnelCookie() !== null && !isSavedSessionStillActive()) { await GoToFunnelStartOn404(next); } From 7f1a4b79b460cda20fd86691bdb351438fbe2faf Mon Sep 17 00:00:00 2001 From: bmauger Date: Wed, 30 Mar 2022 10:39:39 -0400 Subject: [PATCH 11/11] Update button border fix for Safari/iOS. --- src/ux-components/button-main/button-main.vue | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/ux-components/button-main/button-main.vue b/src/ux-components/button-main/button-main.vue index 60497df84..3ddd0bd6b 100644 --- a/src/ux-components/button-main/button-main.vue +++ b/src/ux-components/button-main/button-main.vue @@ -58,6 +58,9 @@ export default { @media (hover: hover) { background: linear-gradient(270deg, $blue-500 0%, $blue-700 100%); } + &:focus { + box-shadow: 0 0 0 3px, 0 0 0 5.5px $blue-700; + } &:focus, // Mouse, touch, stylus focus &:focus-visible { // Keyboard focus for accessibility @@ -88,6 +91,7 @@ export default { &.has-loader { color: $white; background: $blue-700; + box-shadow: 0 0 0 3px, 0 0 0 5.5px $blue-700; } &.delay {// fixes flicker while transitioning between states transition: background 0s 0s ease-in-out;