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 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 navigationScenarios from './router-constants/navigation-scenarios';
const routes = [
{
@ -123,20 +123,21 @@ router.afterEach(async (to, from) => {
const store = useMainStore();
// Update lastPageVisited in the store
store.updateLastPageVisited(to.name);
if (from.redirectedFrom === undefined){
if (from.redirectedFrom === undefined) {
store.clearSaveSessionPromise();
}
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) {
router.navigate(
navigationScenarios.SAVE_SESSION_FAILED,
{query: {issPage: issPageValues.WELCOME_PAGE}});
{ query: { issPage: issPageValues.WELCOME_PAGE } }
);
}
});
if (to.query.issPage !== issPageValues.ENTRY_PAGE) {
// Push page view to GA
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.
// This will reach out to the Cms and there is a 1:1 relationship between page names and route names.
async function GetRouteInfoFromPageName(pageName) {
@ -174,8 +185,10 @@ router.overrideNavigation = (
isSavingNavigation,
optionalQuery = {},
optionalParams = {},
optionalPageData) => {
navigate(scenario,
optionalPageData
) => {
navigate(
scenario,
currentRoute,
isSavingNavigation,
optionalQuery,

View file

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

View file

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