Merge pull request #1695 from Safelite/feature/debugLoop
debug qa env logging
This commit is contained in:
commit
f0737fc00e
3 changed files with 20 additions and 1 deletions
|
|
@ -30,7 +30,10 @@ export function isAnalyticsSessionStillActive() {
|
||||||
export function isSavedSessionStillActive() {
|
export function isSavedSessionStillActive() {
|
||||||
if (getFunnelCookie() !== null) {
|
if (getFunnelCookie() !== null) {
|
||||||
const savedSessionTimeStamp = new Date(getFunnelCookie().SavedSessionTimeoutDate);
|
const savedSessionTimeStamp = new Date(getFunnelCookie().SavedSessionTimeoutDate);
|
||||||
|
console.log("savedSessionTimeStamp " + savedSessionTimeStamp);
|
||||||
const isSavedSessionTimedOut = new Date(new Date().toUTCString()) > savedSessionTimeStamp;
|
const isSavedSessionTimedOut = new Date(new Date().toUTCString()) > savedSessionTimeStamp;
|
||||||
|
console.log("utc date " + new Date(new Date().toUTCString()));
|
||||||
|
console.log("isSavedSessionTimedOut " + isSavedSessionTimedOut);
|
||||||
|
|
||||||
return !isSavedSessionTimedOut;
|
return !isSavedSessionTimedOut;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,7 @@ const routes = [
|
||||||
async beforeEnter(to, from, next) {
|
async beforeEnter(to, from, next) {
|
||||||
// If we have no query string, or we don't have the FmgPage query string.
|
// If we have no query string, or we don't have the FmgPage query string.
|
||||||
try {
|
try {
|
||||||
|
console.log("beforeEnter");
|
||||||
await analyticsMixin.methods.validateSession();
|
await analyticsMixin.methods.validateSession();
|
||||||
|
|
||||||
if (getFunnelCookie()?.SuppressConceptFunnel) {
|
if (getFunnelCookie()?.SuppressConceptFunnel) {
|
||||||
|
|
@ -61,6 +62,7 @@ const routes = [
|
||||||
}
|
}
|
||||||
// On entering the funnel "fresh", read cookie information, decide what to do next.
|
// On entering the funnel "fresh", read cookie information, decide what to do next.
|
||||||
else if (from.redirectedFrom === undefined) {
|
else if (from.redirectedFrom === undefined) {
|
||||||
|
console.log("redirectFrom is undefined");
|
||||||
// clear the saveSessionPromise - if it exists in the vuex store but a new instance was created
|
// clear the saveSessionPromise - if it exists in the vuex store but a new instance was created
|
||||||
// the saveSessionPromise will no longer point to a valid promise
|
// the saveSessionPromise will no longer point to a valid promise
|
||||||
baseMixin.methods.dispatchStoreAction(storeActions.RESET_SAVE_SESSION_PROMISE);
|
baseMixin.methods.dispatchStoreAction(storeActions.RESET_SAVE_SESSION_PROMISE);
|
||||||
|
|
@ -68,6 +70,7 @@ const routes = [
|
||||||
if (!to.query.fmgPage.startsWith("payment")) {
|
if (!to.query.fmgPage.startsWith("payment")) {
|
||||||
//payment pages used to return from safelitehop so exclude here
|
//payment pages used to return from safelitehop so exclude here
|
||||||
// Remove the parameter after quote release
|
// Remove the parameter after quote release
|
||||||
|
console.log("calling load session");
|
||||||
const loadSessionResponse = await loadSessionIfPresent(
|
const loadSessionResponse = await loadSessionIfPresent(
|
||||||
to.query.isInsurance != null
|
to.query.isInsurance != null
|
||||||
? to.query.isInsurance == "true"
|
? to.query.isInsurance == "true"
|
||||||
|
|
@ -78,12 +81,13 @@ const routes = [
|
||||||
);
|
);
|
||||||
|
|
||||||
const pageToRedirectTo = await getPageToRouteExistingOrderTo(to);
|
const pageToRedirectTo = await getPageToRouteExistingOrderTo(to);
|
||||||
|
console.log("load session complete...redirect to " + pageToRedirectTo);
|
||||||
|
|
||||||
// Assign our fmgPage so it will load normally like the other pages.
|
// Assign our fmgPage so it will load normally like the other pages.
|
||||||
to.query.fmgPage = pageToRedirectTo;
|
to.query.fmgPage = pageToRedirectTo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
console.log("router run experiments");
|
||||||
await runExperiments(to.query.fmgPage);
|
await runExperiments(to.query.fmgPage);
|
||||||
|
|
||||||
// Process funnel cookie.
|
// Process funnel cookie.
|
||||||
|
|
@ -91,6 +95,7 @@ const routes = [
|
||||||
|
|
||||||
// If we already have our route, go to it.
|
// If we already have our route, go to it.
|
||||||
if (router.hasRoute(to.query.fmgPage)) {
|
if (router.hasRoute(to.query.fmgPage)) {
|
||||||
|
console.log("has to page " + to.query.fmgPage);
|
||||||
// Since our route is already in scope, we can grab the component from it and call the arePagePrerequisitesValid function.
|
// Since our route is already in scope, we can grab the component from it and call the arePagePrerequisitesValid function.
|
||||||
let component = router
|
let component = router
|
||||||
.getRoutes()
|
.getRoutes()
|
||||||
|
|
@ -102,6 +107,7 @@ const routes = [
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!arePagePrerequisitesValid(component)) {
|
if (!arePagePrerequisitesValid(component)) {
|
||||||
|
console.log("go to start 404");
|
||||||
GoToFunnelStartOn404(next);
|
GoToFunnelStartOn404(next);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -133,6 +139,8 @@ const routes = [
|
||||||
GoToFunnelStartOn404(next);
|
GoToFunnelStartOn404(next);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log("next " + routeData[0].name + " ");
|
||||||
|
|
||||||
// Assign current query string parameters, as well as our fmgPage one.
|
// Assign current query string parameters, as well as our fmgPage one.
|
||||||
next({
|
next({
|
||||||
name: routeData[0].name,
|
name: routeData[0].name,
|
||||||
|
|
@ -143,6 +151,7 @@ const routes = [
|
||||||
console.log(error);
|
console.log(error);
|
||||||
|
|
||||||
if (to.query?.fmgPage === funnelStartPageName) {
|
if (to.query?.fmgPage === funnelStartPageName) {
|
||||||
|
console.log("router catch error");
|
||||||
deleteFunnelCookie();
|
deleteFunnelCookie();
|
||||||
await baseMixin.methods.dispatchStoreAction(storeActions.RESET_STATE);
|
await baseMixin.methods.dispatchStoreAction(storeActions.RESET_STATE);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1744,6 +1744,10 @@ export const actions = {
|
||||||
) {
|
) {
|
||||||
const order = context.state.order;
|
const order = context.state.order;
|
||||||
|
|
||||||
|
console.log(
|
||||||
|
"store load session " + savedSessionId + " " + referralNumber + " " + referralDate
|
||||||
|
);
|
||||||
|
|
||||||
return globalMethods
|
return globalMethods
|
||||||
.callHttpClient({
|
.callHttpClient({
|
||||||
method: endpoints.LoadSession.method,
|
method: endpoints.LoadSession.method,
|
||||||
|
|
@ -1769,6 +1773,8 @@ export const actions = {
|
||||||
return glass;
|
return glass;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
console.log("load session success " + JSON.stringify(response.data));
|
||||||
|
|
||||||
// clear the state if the existing EON does not equal what is returned from loadSession
|
// clear the state if the existing EON does not equal what is returned from loadSession
|
||||||
if (context.state.order.eon && context.state.order.eon != response.data.eon) {
|
if (context.state.order.eon && context.state.order.eon != response.data.eon) {
|
||||||
context.commit(storeMutations.RESET_STATE);
|
context.commit(storeMutations.RESET_STATE);
|
||||||
|
|
@ -1783,6 +1789,7 @@ export const actions = {
|
||||||
return response;
|
return response;
|
||||||
},
|
},
|
||||||
(error) => {
|
(error) => {
|
||||||
|
console.log("load session error " + JSON.stringify(error));
|
||||||
deleteFunnelCookie();
|
deleteFunnelCookie();
|
||||||
context.commit(storeMutations.RESET_STATE);
|
context.commit(storeMutations.RESET_STATE);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue