Cleanup timing for heritage-return session load

This commit is contained in:
Chloe Herd 2025-05-14 11:48:37 -04:00
parent 72d3efee90
commit 3d30648199
2 changed files with 19 additions and 8 deletions

View file

@ -1,20 +1,18 @@
import { queryStrings } from "@/constants/query-strings";
import { sessionStorageKeyConstants } from "@/constants/session-storage";
import {
getFunnelCookie,
updateOrCreateFunnelCookie,
} from "@/helpers/heritage-integration/cookie-helper";
import { loadSessionIfPresent } from "@/helpers/heritage-integration/order-helper";
import { isSavedSessionStillActive } from "@/helpers/heritage-integration/session-helper";
import analyticsMixin from "@/mixins/analytics-mixin";
import { routeData, FUNNEL_START_PAGE } from "@/router/constants/routes";
import { consumeQueryFromStash } from "@/router/methods/helpers/querystring-stash";
import { runExperiments } from "@/router/methods/helpers/run-experiments";
import { bailout } from "@/router/methods/error";
import { checkPagePrerequisites } from "@/router/methods/page-prerequisites";
import { checkLogParam } from "@/helpers/debug-log-helper";
import { debugLog } from "@/helpers/debug-log-helper";
import { handleHeritageReturn } from "@/router/methods/helpers/handle-heritage-return";
export async function beforeEach(to, from) {
try {
@ -52,11 +50,8 @@ export async function beforeEach(to, from) {
}
}
// If sent from heritage, need to load session.
const fromHeritageFlag = consumeQueryFromStash(queryStrings.FROM_HERITAGE);
if (fromHeritageFlag) {
await loadSessionIfPresent(true, routeData.SERVICE_LOCATION.name);
}
// Special logic when returning from insurance flow.
await handleHeritageReturn(to, from);
// prettier-ignore
{

View file

@ -0,0 +1,16 @@
import { queryStrings } from "@/constants/query-strings";
import { consumeReferralQuerystrings } from "@/router/methods/helpers/consume-referral-info";
import { loadSessionIfPresent } from "@/helpers/heritage-integration/order-helper";
import { routeData } from "@/router/constants/routes";
export async function handleHeritageReturn(to, from) {
const fromHeritageFlag = to.query[queryStrings.FROM_HERITAGE];
if (fromHeritageFlag) {
// Get new referral info from querystring in case passed there.
await consumeReferralQuerystrings();
// load session with new cookie
await loadSessionIfPresent(true, routeData.SERVICE_LOCATION.name);
}
}