From f6ca73d2c076c37fa1bf0dd8b18290eae00493d2 Mon Sep 17 00:00:00 2001 From: CarlNation Date: Tue, 12 Jul 2022 15:22:24 -0400 Subject: [PATCH 1/6] change event constant to match gtm trigger --- src/constants/analytics.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/constants/analytics.js b/src/constants/analytics.js index a3f057150..d4ac3d2ea 100644 --- a/src/constants/analytics.js +++ b/src/constants/analytics.js @@ -5,7 +5,7 @@ const analyticsPageEvents = { // GA Constants const GaEvents = { - GENERIC_EVENT: 'ga_Event', + GENERIC_EVENT: 'event', PAGE_VIEW_EVENT : 'logPageview' }; From cefd25399e9fe635e4fdfbfcc6b8eb4ac5adca36 Mon Sep 17 00:00:00 2001 From: Katie Date: Tue, 19 Jul 2022 15:20:02 -0400 Subject: [PATCH 2/6] CSR-530 Add routing for experiment-integration --- src/layouts/test-one.vue | 15 + src/layouts/test-two.vue | 15 + src/router/index.js | 25 +- src/router/router-constants/routing-table.js | 480 ++++++++++--------- 4 files changed, 300 insertions(+), 235 deletions(-) create mode 100644 src/layouts/test-one.vue create mode 100644 src/layouts/test-two.vue diff --git a/src/layouts/test-one.vue b/src/layouts/test-one.vue new file mode 100644 index 000000000..5ba269f2a --- /dev/null +++ b/src/layouts/test-one.vue @@ -0,0 +1,15 @@ + + + + \ No newline at end of file diff --git a/src/layouts/test-two.vue b/src/layouts/test-two.vue new file mode 100644 index 000000000..2ea5fd624 --- /dev/null +++ b/src/layouts/test-two.vue @@ -0,0 +1,15 @@ + + + + \ No newline at end of file diff --git a/src/router/index.js b/src/router/index.js index b09f734a2..f01fb4ff6 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -19,7 +19,24 @@ import eventBus from "@/helpers/event-bus/event-bus"; import store from "@/store"; import analyticsMixin from "@/mixins/analytics-mixin"; +import TestOne from "@/layouts/test-one"; +import TestTwo from "@/layouts/test-two"; + const routes = [ + { + path: "/test1", + name: "test1", + components: { + default: TestOne + } + }, + { + path: "/test2", + name: "test2", + components: { + default: TestTwo + } + }, { path: "/", name: "root", @@ -53,7 +70,6 @@ const routes = [ return next(false); } - // Assign our fmgPage so it will load normally like the other pages. to.query.fmgPage = pageToRedirectTo; } @@ -180,15 +196,16 @@ async function navigate(scenario, currentRoute, optionalQuery = {}, optionalPara // Get navigation map depending on the scenario and the current 'page' you're on. function getNavigationMap(scenario, currentRoute) { const fmgPageValue = currentRoute.query.fmgPage; - const matchedQueryValue = routingTable + let matchedQueryValue = routingTable(store) .filter( (item) => item.fmgPageValue === fmgPageValue && item.maps.filter((map) => map.scenario === scenario).length > 0 ) - .map((m) => m.maps.filter((map) => map.scenario === scenario)); + .map((m) => m.maps.filter((map) => map.scenario === scenario))[0] + .filter(x => x.filter === true || x.filter === undefined); - return matchedQueryValue[0][0]; + return matchedQueryValue[0]; } //---------------------------------------------------------- Private Functions ---------------------------------------------------------- diff --git a/src/router/router-constants/routing-table.js b/src/router/router-constants/routing-table.js index 3f81e99ad..5d89daab9 100644 --- a/src/router/router-constants/routing-table.js +++ b/src/router/router-constants/routing-table.js @@ -1,236 +1,254 @@ import { fmgPageValues } from "@/router/router-constants/fmgPage-values"; import { navigationScenarios } from "@/router/router-constants/navigation-scenarios"; -const routingTable = [ - { - fmgPageValue: fmgPageValues.VEHICLE_YEAR, - maps: [ - { - scenario: navigationScenarios.SELECTED_YEAR, - destinationFmgPageValue: fmgPageValues.VEHICLE_MAKE, - }, - ], - }, - { - fmgPageValue: fmgPageValues.VEHICLE_MAKE, - maps: [ - { - scenario: navigationScenarios.SELECTED_MAKE, - destinationFmgPageValue: fmgPageValues.VEHICLE_MODEL, - }, - { - scenario: navigationScenarios.CLICKED_BACK, - destinationFmgPageValue: fmgPageValues.VEHICLE_YEAR, - }, - ], - }, - { - fmgPageValue: fmgPageValues.VEHICLE_MODEL, - maps: [ - { - scenario: navigationScenarios.SELECTED_MODEL, - destinationFmgPageValue: fmgPageValues.VEHICLE_STYLE, - }, - { - scenario: navigationScenarios.CLICKED_BACK, - destinationFmgPageValue: fmgPageValues.VEHICLE_MAKE, - }, - ], - }, - { - fmgPageValue: fmgPageValues.VEHICLE_STYLE, - maps: [ - { - scenario: navigationScenarios.SELECTED_STYLE, - destinationFmgPageValue: fmgPageValues.VEHICLE_DAMAGE, - }, - { - scenario: navigationScenarios.CLICKED_BACK, - destinationFmgPageValue: fmgPageValues.VEHICLE_MODEL, - }, - ], - }, - { - fmgPageValue: fmgPageValues.VEHICLE_DAMAGE, - maps: [ - { - scenario: navigationScenarios.CLICKED_BACK, - destinationFmgPageValue: fmgPageValues.VEHICLE_STYLE, - }, - { - scenario: navigationScenarios.CLICKED_FORWARD_WITH_VIN, - destinationFmgPageValue: fmgPageValues.VIN_LOOKUP, - }, - { - scenario: navigationScenarios.CLICKED_FORWARD_WITHOUT_VIN, - destinationFmgPageValue: fmgPageValues.ESTIMATE, - }, - ], - }, - { - fmgPageValue: fmgPageValues.VEHICLE_PARTS, - maps: [ - { - scenario: navigationScenarios.CLICKED_BACK, - destinationFmgPageValue: fmgPageValues.VIN_LOOKUP, - }, - { - scenario: navigationScenarios.SELECTED_PARTS, - destinationFmgPageValue: fmgPageValues.QUOTE, - }, - { - scenario: navigationScenarios.CLICKED_FORWARD, - destinationFmgPageValue: fmgPageValues.REVEAL, - }, - ], - }, - { - fmgPageValue: fmgPageValues.REVEAL, - maps: [ - { - scenario: navigationScenarios.CLICKED_BACK, - destinationFmgPageValue: fmgPageValues.VEHICLE_DAMAGE, - }, - { - scenario: navigationScenarios.SELECTED_PARTS, - destinationFmgPageValue: fmgPageValues.VIN_LOOKUP, - }, - ], - }, - { - fmgPageValue: fmgPageValues.VIN_LOOKUP, - maps: [ - { - scenario: navigationScenarios.CLICKED_BACK, - destinationFmgPageValue: fmgPageValues.ESTIMATE, - }, - { - scenario: navigationScenarios.SELECTED_VIN_HAS_MISMATCHED_GLASS, - destinationFmgPageValue: fmgPageValues.VEHICLE_DAMAGE, - }, - { - scenario: navigationScenarios.CLICKED_BACK_WITH_VIN, - destinationFmgPageValue: fmgPageValues.VEHICLE_DAMAGE, - }, - { - scenario: navigationScenarios.SELECTED_VIN_WITH_PART_QUESTIONS, - destinationFmgPageValue: fmgPageValues.PART_QUESTIONS - }, - { - scenario: navigationScenarios.SELECTED_VIN_WITH_MULTIPLE_PARTS, - destinationFmgPageValue: fmgPageValues.VEHICLE_PARTS - } - ], - }, - { - fmgPageValue: fmgPageValues.LICENSE_PLATE_LOOKUP, - maps: [ - { - scenario: navigationScenarios.CLICKED_BACK, - destinationFmgPageValue: fmgPageValues.ESTIMATE, - }, - { - scenario: navigationScenarios.CLICKED_FORWARD, - destinationFmgPageValue: fmgPageValues.VEHICLE_DAMAGE, - }, - { - scenario: navigationScenarios.SELECTED_VIN_WITH_PART_QUESTIONS, - destinationFmgPageValue: fmgPageValues.PART_QUESTIONS - }, - { - scenario: navigationScenarios.SELECTED_VIN_WITH_MULTIPLE_PARTS, - destinationFmgPageValue: fmgPageValues.VEHICLE_PARTS - } - ], - }, - { - fmgPageValue: fmgPageValues.ADDRESS_LOOKUP, - maps: [ - { - scenario: navigationScenarios.CLICKED_BACK, - destinationFmgPageValue: fmgPageValues.ESTIMATE, - }, - { - scenario: navigationScenarios.CONTINUING_WITH_MULTIPLE_VEHICLES, - destinationFmgPageValue: fmgPageValues.ADDRESS_VEHICLES, - }, - { - scenario: navigationScenarios.SELECTED_VIN_HAS_MISMATCHED_GLASS, - destinationFmgPageValue: fmgPageValues.VEHICLE_DAMAGE, - }, - { - scenario: navigationScenarios.SELECTED_VIN_WITH_PART_QUESTIONS, - destinationFmgPageValue: fmgPageValues.PART_QUESTIONS - }, - { - scenario: navigationScenarios.SELECTED_VIN_WITH_MULTIPLE_PARTS, - destinationFmgPageValue: fmgPageValues.VEHICLE_PARTS - } - ], - }, - { - fmgPageValue: fmgPageValues.ADDRESS_VEHICLES, - maps: [ - { - scenario: navigationScenarios.CLICKED_BACK, - destinationFmgPageValue: fmgPageValues.ADDRESS_LOOKUP, - }, - { - scenario: navigationScenarios.CLICKED_FORWARD, - destinationFmgPageValue: fmgPageValues.VEHICLE_DAMAGE, - }, - { - scenario: navigationScenarios.SELECTED_VIN_WITH_PART_QUESTIONS, - destinationFmgPageValue: fmgPageValues.PART_QUESTIONS - }, - { - scenario: navigationScenarios.SELECTED_VIN_WITH_MULTIPLE_PARTS, - destinationFmgPageValue: fmgPageValues.VEHICLE_PARTS - }, - { - scenario: navigationScenarios.SELECTED_PROVIDE_VIN_DIFFERENT_WAY, - destinationFmgPageValue: fmgPageValues.ESTIMATE - } - ], - }, - { - fmgPageValue: fmgPageValues.ESTIMATE, - maps: [ - { - scenario: navigationScenarios.CLICKED_BACK, - destinationFmgPageValue: fmgPageValues.VEHICLE_DAMAGE, - }, - { - scenario: navigationScenarios.SELECTED_MANUAL_VIN, - destinationFmgPageValue: fmgPageValues.VIN_LOOKUP, - }, - { - scenario: navigationScenarios.SELECTED_LICENSE_PLATE, - destinationFmgPageValue: fmgPageValues.LICENSE_PLATE_LOOKUP, - }, - { - scenario: navigationScenarios.SELECTED_HOME_ADDRESS, - destinationFmgPageValue: fmgPageValues.ADDRESS_LOOKUP, - }, - ], - }, - { - fmgPageValue: fmgPageValues.PART_QUESTIONS, - maps: [ - { - scenario: navigationScenarios.CLICKED_BACK, - destinationFmgPageValue: fmgPageValues.VIN_LOOKUP - }, - { - scenario: navigationScenarios.ANSWERED_QUESTIONS_WITH_MULTIPLE_PARTS, - destinationFmgPageValue: fmgPageValues.VEHICLE_PARTS - }, - { - scenario: navigationScenarios.ANSWERED_QUESTIONS_WITH_SINGLE_PART, - destinationFmgPageValue: fmgPageValues.QUOTE, - }, - ] - }, -]; +// Get store from router/index.js instead of importing it here to get updated values +const routingTable = function(store) { + return [ + { + fmgPageValue: fmgPageValues.VEHICLE_YEAR, + maps: [ + { + scenario: navigationScenarios.SELECTED_YEAR, + destinationFmgPageValue: "test1", + filter: store.getters.vehicle.year > 2010 + }, + { + scenario: navigationScenarios.SELECTED_YEAR, + destinationFmgPageValue: "test2", + filter: store.getters.vehicle.year <= 2010 + }, + { + scenario: navigationScenarios.SELECTED_YEAR, + destinationFmgPageValue: fmgPageValues.VEHICLE_MAKE, + }, + + { + scenario: navigationScenarios.SELECTED_YEAR, + destinationFmgPageValue: fmgPageValues.VEHICLE_MAKE, + }, + ], + }, + { + fmgPageValue: fmgPageValues.VEHICLE_MAKE, + maps: [ + { + scenario: navigationScenarios.SELECTED_MAKE, + destinationFmgPageValue: fmgPageValues.VEHICLE_MODEL, + }, + { + scenario: navigationScenarios.CLICKED_BACK, + destinationFmgPageValue: fmgPageValues.VEHICLE_YEAR, + }, + ], + }, + { + fmgPageValue: fmgPageValues.VEHICLE_MODEL, + maps: [ + { + scenario: navigationScenarios.SELECTED_MODEL, + destinationFmgPageValue: fmgPageValues.VEHICLE_STYLE, + }, + { + scenario: navigationScenarios.CLICKED_BACK, + destinationFmgPageValue: fmgPageValues.VEHICLE_MAKE, + }, + ], + }, + { + fmgPageValue: fmgPageValues.VEHICLE_STYLE, + maps: [ + { + scenario: navigationScenarios.SELECTED_STYLE, + destinationFmgPageValue: fmgPageValues.VEHICLE_DAMAGE, + }, + { + scenario: navigationScenarios.CLICKED_BACK, + destinationFmgPageValue: fmgPageValues.VEHICLE_MODEL, + }, + ], + }, + { + fmgPageValue: fmgPageValues.VEHICLE_DAMAGE, + maps: [ + { + scenario: navigationScenarios.CLICKED_BACK, + destinationFmgPageValue: fmgPageValues.VEHICLE_STYLE, + }, + { + scenario: navigationScenarios.CLICKED_FORWARD_WITH_VIN, + destinationFmgPageValue: fmgPageValues.VIN_LOOKUP, + }, + { + scenario: navigationScenarios.CLICKED_FORWARD_WITHOUT_VIN, + destinationFmgPageValue: fmgPageValues.ESTIMATE, + }, + ], + }, + { + fmgPageValue: fmgPageValues.VEHICLE_PARTS, + maps: [ + { + scenario: navigationScenarios.CLICKED_BACK, + destinationFmgPageValue: fmgPageValues.VIN_LOOKUP, + }, + { + scenario: navigationScenarios.SELECTED_PARTS, + destinationFmgPageValue: fmgPageValues.QUOTE, + }, + { + scenario: navigationScenarios.CLICKED_FORWARD, + destinationFmgPageValue: fmgPageValues.REVEAL, + }, + ], + }, + { + fmgPageValue: fmgPageValues.REVEAL, + maps: [ + { + scenario: navigationScenarios.CLICKED_BACK, + destinationFmgPageValue: fmgPageValues.VEHICLE_DAMAGE, + }, + { + scenario: navigationScenarios.SELECTED_PARTS, + destinationFmgPageValue: fmgPageValues.VIN_LOOKUP, + }, + ], + }, + { + fmgPageValue: fmgPageValues.VIN_LOOKUP, + maps: [ + { + scenario: navigationScenarios.CLICKED_BACK, + destinationFmgPageValue: fmgPageValues.ESTIMATE, + }, + { + scenario: navigationScenarios.SELECTED_VIN_HAS_MISMATCHED_GLASS, + destinationFmgPageValue: fmgPageValues.VEHICLE_DAMAGE, + }, + { + scenario: navigationScenarios.CLICKED_BACK_WITH_VIN, + destinationFmgPageValue: fmgPageValues.VEHICLE_DAMAGE, + }, + { + scenario: navigationScenarios.SELECTED_VIN_WITH_PART_QUESTIONS, + destinationFmgPageValue: fmgPageValues.PART_QUESTIONS + }, + { + scenario: navigationScenarios.SELECTED_VIN_WITH_MULTIPLE_PARTS, + destinationFmgPageValue: fmgPageValues.VEHICLE_PARTS + } + ], + }, + { + fmgPageValue: fmgPageValues.LICENSE_PLATE_LOOKUP, + maps: [ + { + scenario: navigationScenarios.CLICKED_BACK, + destinationFmgPageValue: fmgPageValues.ESTIMATE, + }, + { + scenario: navigationScenarios.CLICKED_FORWARD, + destinationFmgPageValue: fmgPageValues.VEHICLE_DAMAGE, + }, + { + scenario: navigationScenarios.SELECTED_VIN_WITH_PART_QUESTIONS, + destinationFmgPageValue: fmgPageValues.PART_QUESTIONS + }, + { + scenario: navigationScenarios.SELECTED_VIN_WITH_MULTIPLE_PARTS, + destinationFmgPageValue: fmgPageValues.VEHICLE_PARTS + } + ], + }, + { + fmgPageValue: fmgPageValues.ADDRESS_LOOKUP, + maps: [ + { + scenario: navigationScenarios.CLICKED_BACK, + destinationFmgPageValue: fmgPageValues.ESTIMATE, + }, + { + scenario: navigationScenarios.CONTINUING_WITH_MULTIPLE_VEHICLES, + destinationFmgPageValue: fmgPageValues.ADDRESS_VEHICLES, + }, + { + scenario: navigationScenarios.SELECTED_VIN_HAS_MISMATCHED_GLASS, + destinationFmgPageValue: fmgPageValues.VEHICLE_DAMAGE, + }, + { + scenario: navigationScenarios.SELECTED_VIN_WITH_PART_QUESTIONS, + destinationFmgPageValue: fmgPageValues.PART_QUESTIONS + }, + { + scenario: navigationScenarios.SELECTED_VIN_WITH_MULTIPLE_PARTS, + destinationFmgPageValue: fmgPageValues.VEHICLE_PARTS + } + ], + }, + { + fmgPageValue: fmgPageValues.ADDRESS_VEHICLES, + maps: [ + { + scenario: navigationScenarios.CLICKED_BACK, + destinationFmgPageValue: fmgPageValues.ADDRESS_LOOKUP, + }, + { + scenario: navigationScenarios.CLICKED_FORWARD, + destinationFmgPageValue: fmgPageValues.VEHICLE_DAMAGE, + }, + { + scenario: navigationScenarios.SELECTED_VIN_WITH_PART_QUESTIONS, + destinationFmgPageValue: fmgPageValues.PART_QUESTIONS + }, + { + scenario: navigationScenarios.SELECTED_VIN_WITH_MULTIPLE_PARTS, + destinationFmgPageValue: fmgPageValues.VEHICLE_PARTS + }, + { + scenario: navigationScenarios.SELECTED_PROVIDE_VIN_DIFFERENT_WAY, + destinationFmgPageValue: fmgPageValues.ESTIMATE + } + ], + }, + { + fmgPageValue: fmgPageValues.ESTIMATE, + maps: [ + { + scenario: navigationScenarios.CLICKED_BACK, + destinationFmgPageValue: fmgPageValues.VEHICLE_DAMAGE, + }, + { + scenario: navigationScenarios.SELECTED_MANUAL_VIN, + destinationFmgPageValue: fmgPageValues.VIN_LOOKUP, + }, + { + scenario: navigationScenarios.SELECTED_LICENSE_PLATE, + destinationFmgPageValue: fmgPageValues.LICENSE_PLATE_LOOKUP, + }, + { + scenario: navigationScenarios.SELECTED_HOME_ADDRESS, + destinationFmgPageValue: fmgPageValues.ADDRESS_LOOKUP, + }, + ], + }, + { + fmgPageValue: fmgPageValues.PART_QUESTIONS, + maps: [ + { + scenario: navigationScenarios.CLICKED_BACK, + destinationFmgPageValue: fmgPageValues.VIN_LOOKUP + }, + { + scenario: navigationScenarios.ANSWERED_QUESTIONS_WITH_MULTIPLE_PARTS, + destinationFmgPageValue: fmgPageValues.VEHICLE_PARTS + }, + { + scenario: navigationScenarios.ANSWERED_QUESTIONS_WITH_SINGLE_PART, + destinationFmgPageValue: fmgPageValues.QUOTE, + }, + ] + }, + ]; +} export { routingTable }; From f9fa9d154f1d4e828ded9964f10995f3b6080a09 Mon Sep 17 00:00:00 2001 From: Katie Date: Tue, 19 Jul 2022 15:44:14 -0400 Subject: [PATCH 3/6] CSR-530 Add test cases in --- src/router/router-constants/routing-table.js | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/router/router-constants/routing-table.js b/src/router/router-constants/routing-table.js index 5d89daab9..25463bd8b 100644 --- a/src/router/router-constants/routing-table.js +++ b/src/router/router-constants/routing-table.js @@ -10,22 +10,17 @@ const routingTable = function(store) { { scenario: navigationScenarios.SELECTED_YEAR, destinationFmgPageValue: "test1", - filter: store.getters.vehicle.year > 2010 + filter: store.getters.vehicle.year === 2010 }, { scenario: navigationScenarios.SELECTED_YEAR, destinationFmgPageValue: "test2", - filter: store.getters.vehicle.year <= 2010 + filter: store.getters.vehicle.year < 1954 }, { scenario: navigationScenarios.SELECTED_YEAR, destinationFmgPageValue: fmgPageValues.VEHICLE_MAKE, }, - - { - scenario: navigationScenarios.SELECTED_YEAR, - destinationFmgPageValue: fmgPageValues.VEHICLE_MAKE, - }, ], }, { From f3120ef80dde21ad766d67d20f1708dd5426c199 Mon Sep 17 00:00:00 2001 From: Katie Date: Tue, 19 Jul 2022 15:46:48 -0400 Subject: [PATCH 4/6] CSR-530 Cleanup --- 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 f01fb4ff6..d2a5ee154 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -196,7 +196,7 @@ async function navigate(scenario, currentRoute, optionalQuery = {}, optionalPara // Get navigation map depending on the scenario and the current 'page' you're on. function getNavigationMap(scenario, currentRoute) { const fmgPageValue = currentRoute.query.fmgPage; - let matchedQueryValue = routingTable(store) + const matchedQueryValue = routingTable(store) .filter( (item) => item.fmgPageValue === fmgPageValue && From b21c6171e9d4574f4597a1d9e773074357e9b055 Mon Sep 17 00:00:00 2001 From: Scott Kiener Date: Mon, 25 Jul 2022 09:30:00 -0400 Subject: [PATCH 5/6] CSR-706 | Remove state resetting on loadOrder As well as making loadOrder await the latest saveOrderPromise Also clearing saveOrderPromise if entering the funnel fresh to avoid a broken promise object --- src/constants/store-actions.js | 1 + src/constants/store-mutations.js | 1 + src/helpers/heritage-integration/order-helper.js | 2 ++ src/router/index.js | 3 +++ src/store/index.js | 8 ++++++-- 5 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/constants/store-actions.js b/src/constants/store-actions.js index 87331daea..6fa81d45f 100644 --- a/src/constants/store-actions.js +++ b/src/constants/store-actions.js @@ -31,6 +31,7 @@ const storeActions = { INITIALIZE_SESSION: "initializeSession", GET_EXPERIMENTS_BY_USER: "GetExperimentsByUser", CLEAR_VIN: "clearVin", + RESET_SAVE_ORDER_PROMISE: "resetSaveOrderPromise", // DEPENDENCY MUTATIONS RESET_VEHICLE_STATE_AND_DEPENDENCIES: "resetVehicleAndDependencies", diff --git a/src/constants/store-mutations.js b/src/constants/store-mutations.js index 80697cc46..66b9ded0e 100644 --- a/src/constants/store-mutations.js +++ b/src/constants/store-mutations.js @@ -58,6 +58,7 @@ const storeMutations = { UPDATE_STATE_WITH_ORDER_INFORMATION: "updateStateWithOrderInformation", UPDATE_SAVE_ORDER_PROMISE: "updateSaveOrderPromise", UPDATE_LAST_PAGE_VISITED: "updateLastPageVisited", + RESET_SAVE_ORDER_PROMISE: "resetSaveOrderPromise", }; export { storeMutations }; diff --git a/src/helpers/heritage-integration/order-helper.js b/src/helpers/heritage-integration/order-helper.js index 9722744f0..2e6fcade0 100644 --- a/src/helpers/heritage-integration/order-helper.js +++ b/src/helpers/heritage-integration/order-helper.js @@ -60,6 +60,8 @@ export async function saveOrder() { and returns the response. */ async function loadOrder(referralNumber, referralDate, referralCorrelationId, accountNumber) { + // await the saveOrderPromise in the store to make sure we're loading up to date information + await store.getters.applicationUser.saveOrderPromise; const response = await baseMixin.methods.dispatchStoreAction(storeActions.LOAD_ORDER, { referralNumber: referralNumber.toString(), diff --git a/src/router/index.js b/src/router/index.js index d2a5ee154..98b26483b 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -60,6 +60,9 @@ const routes = [ // On entering the funnel "fresh", read cookie information, decide what to do next. if (from.redirectedFrom === undefined) { + // clear the saveOrderPromise - if it exists in the vuex store but a new instance was created + // the saveOrderPromise will no longer point to a valid promise + baseMixin.methods.dispatchStoreAction(storeActions.RESET_SAVE_ORDER_PROMISE); const loadOrderResponse = await loadOrderIfPresent(); const pageToRedirectTo = await getPageToRouteExistingOrderTo(to, loadOrderResponse); diff --git a/src/store/index.js b/src/store/index.js index 90932c8bb..82d3323d1 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -269,7 +269,9 @@ export const mutations = { resetState(state) { Object.assign(state, getDefaultState()); }, - + resetSaveOrderPromise(state) { + state.applicationUser.saveOrderPromise = null; + }, // Misc Mutations updateStateWithOrderInformation(state, orderInformation) { state.order.referralNumber = orderInformation.referralNumber; @@ -457,6 +459,9 @@ export const actions = { resetState(context) { context.commit(storeMutations.RESET_STATE); }, + resetSaveOrderPromise(context) { + context.commit(storeMutations.RESET_SAVE_ORDER_PROMISE); + }, // Content API Actions getRouteInfo(context, { pageName }) { @@ -701,7 +706,6 @@ export const actions = { accountNumber: accountNumber?.toString() }, }).then((response) => { - context.commit(storeMutations.RESET_STATE); context.commit(storeMutations.UPDATE_STATE_WITH_ORDER_INFORMATION, response.data); return response; }); From 62b72163d6127a8a09989bc4182e2ce221893b6f Mon Sep 17 00:00:00 2001 From: Scott Kiener Date: Mon, 25 Jul 2022 15:29:44 -0400 Subject: [PATCH 6/6] CSR-706 | Only clear state if referral does not match --- src/store/index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/store/index.js b/src/store/index.js index 82d3323d1..64ba356e6 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -706,6 +706,10 @@ export const actions = { accountNumber: accountNumber?.toString() }, }).then((response) => { + // clear the state if the existing referral number does not equal what is returned from loadOrder + if (context.state.order.referralNumber != response.data.referralNumber) { + context.commit(storeMutations.RESET_STATE); + } context.commit(storeMutations.UPDATE_STATE_WITH_ORDER_INFORMATION, response.data); return response; });