Merge pull request #439 from Safelite/feature/richardson/SSR-364

fix for alert box, similar to fmg
This commit is contained in:
brich1212safe 2023-09-15 11:40:14 -04:00 committed by GitHub
commit 44c5258b12
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 32 additions and 16 deletions

View file

@ -13,9 +13,9 @@ import { experimentTriggers } from '@/constants/experiments';
import applicationConfig from '@/constants/application-config'; import applicationConfig from '@/constants/application-config';
import analyticsMixin from '@/mixins/analytics-mixin'; import analyticsMixin from '@/mixins/analytics-mixin';
import navigationScenarios from './router-constants/navigation-scenarios'; import { saveSession } from '@/helpers/order-helper.js';
import { saveSession } from "@/helpers/order-helper.js";
import routerParams from '@/router/router-constants/router-params'; import routerParams from '@/router/router-constants/router-params';
import navigationScenarios from './router-constants/navigation-scenarios';
const routes = [ const routes = [
{ {
@ -123,20 +123,21 @@ router.afterEach(async (to, from) => {
const store = useMainStore(); const store = useMainStore();
// Update lastPageVisited in the store // Update lastPageVisited in the store
store.updateLastPageVisited(to.name); store.updateLastPageVisited(to.name);
if (from.redirectedFrom === undefined){ if (from.redirectedFrom === undefined) {
store.clearSaveSessionPromise(); store.clearSaveSessionPromise();
} }
const saveSessionSynchronous = !!from.params[routerParams.SAVE_SESSION_SYNCHRONOUS]; const saveSessionSynchronous = !!from.params[routerParams.SAVE_SESSION_SYNCHRONOUS];
await saveSession({shouldAwaitSaveSessionQueue: saveSessionSynchronous}).catch((error) => { await saveSession({ shouldAwaitSaveSessionQueue: saveSessionSynchronous }).catch((error) => {
if (from.name === issPageValues.WELCOME_PAGE) { if (from.name === issPageValues.WELCOME_PAGE) {
router.navigate( router.navigate(
navigationScenarios.SAVE_SESSION_FAILED, navigationScenarios.SAVE_SESSION_FAILED,
{query: {issPage: issPageValues.WELCOME_PAGE}}); { query: { issPage: issPageValues.WELCOME_PAGE } }
);
} }
}); });
if (to.query.issPage !== issPageValues.ENTRY_PAGE) { if (to.query.issPage !== issPageValues.ENTRY_PAGE) {
// Push page view to GA // Push page view to GA
analyticsMixin.methods.pushPageViewToGA(); analyticsMixin.methods.pushPageViewToGA();
@ -146,6 +147,16 @@ router.afterEach(async (to, from) => {
} }
}); });
router.navigateWithoutSaving = (
scenario,
currentRoute,
optionalQuery = {},
optionalParams = {},
optionalPageData = {}
) => {
navigate(scenario, currentRoute, false, optionalQuery, optionalParams, optionalPageData);
};
// Get route information by page name. // Get route information by page name.
// This will reach out to the Cms and there is a 1:1 relationship between page names and route names. // This will reach out to the Cms and there is a 1:1 relationship between page names and route names.
async function GetRouteInfoFromPageName(pageName) { async function GetRouteInfoFromPageName(pageName) {
@ -174,8 +185,10 @@ router.overrideNavigation = (
isSavingNavigation, isSavingNavigation,
optionalQuery = {}, optionalQuery = {},
optionalParams = {}, optionalParams = {},
optionalPageData) => { optionalPageData
navigate(scenario, ) => {
navigate(
scenario,
currentRoute, currentRoute,
isSavingNavigation, isSavingNavigation,
optionalQuery, optionalQuery,

View file

@ -90,6 +90,10 @@ const routingTable = () => [
scenario: navigationScenarios.CLICKED_FORWARD_WITH_NO_MORE_QUESTIONS, scenario: navigationScenarios.CLICKED_FORWARD_WITH_NO_MORE_QUESTIONS,
destinationIssPageValue: issPageValues.COVERAGE_STATEMENT destinationIssPageValue: issPageValues.COVERAGE_STATEMENT
}, },
{
scenario: issPageValues.VEHICLE_LOOKUP,
destinationIssPageValue: issPageValues.VEHICLE_LOOKUP
},
{ {
scenario: navigationScenarios.CLICKED_FORWARD_WITH_BAILOUT, scenario: navigationScenarios.CLICKED_FORWARD_WITH_BAILOUT,
destinationIssPageValue: issPageValues.BAILOUT_PAGE destinationIssPageValue: issPageValues.BAILOUT_PAGE

View file

@ -21,13 +21,10 @@
v-else v-else
class="m-0 text-body small"> class="m-0 text-body small">
<template v-if="doesCopyContainRouterLink(paragraph)"> <template v-if="doesCopyContainRouterLink(paragraph)">
<span> <textBlock
<router-link :customText="paragraph"
:to="{ class="mb-1"
query: { [pageQueryString]: `${getRouterLinkRouteFromCopy(copy)}` }, marginTopSizeOverride="0" />
name: 'root',
}">{{ getRouterLinkDisplayTextFromCopy(copy) }}</router-link>
</span>
</template> </template>
<template <template
v-for="copy in splitCopyOnCMSPlaceHolder(paragraph)" v-for="copy in splitCopyOnCMSPlaceHolder(paragraph)"
@ -75,11 +72,13 @@ import {
splitCMSCopyOnParagraphTag splitCMSCopyOnParagraphTag
} from '@/helpers/cms-content-helper'; } from '@/helpers/cms-content-helper';
import applicationConfig from '@/constants/application-config'; import applicationConfig from '@/constants/application-config';
import textBlock from '@/digital-components/text-block/text-block.vue';
import textLink from '@/ux-components/text-link/text-link.vue'; import textLink from '@/ux-components/text-link/text-link.vue';
export default { export default {
name: 'alert', name: 'alert',
components: { components: {
textBlock,
textLink textLink
}, },
props: { props: {