Cleanup
This commit is contained in:
parent
edd8158148
commit
4510241bdd
3 changed files with 11 additions and 53 deletions
|
|
@ -114,7 +114,7 @@ export function updateSessionIdCookie() {
|
||||||
export function getUserIdValue() {
|
export function getUserIdValue() {
|
||||||
const cookieValue = getCookieValueByName(cookieNames.FUNNEL_USER_ID);
|
const cookieValue = getCookieValueByName(cookieNames.FUNNEL_USER_ID);
|
||||||
|
|
||||||
if(cookieValue) {
|
if (cookieValue) {
|
||||||
return cookieValue;
|
return cookieValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -138,45 +138,6 @@ export default {
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
// async initSession() {
|
|
||||||
// const sid = getSessionIdValue();
|
|
||||||
// const skey = getSessionKeyValue();
|
|
||||||
// const referrer =
|
|
||||||
// applicationConfig.CURRENT_ENVIRONMENT != "Localhost" ? document.referrer : null;
|
|
||||||
|
|
||||||
// var payload = {
|
|
||||||
// userId: getDeviceIdValue(),
|
|
||||||
// sessionId: sid,
|
|
||||||
// userAgent: navigator.userAgent,
|
|
||||||
// referrer: referrer,
|
|
||||||
// };
|
|
||||||
|
|
||||||
// const response = await baseMixin.methods.dispatchStoreAction(
|
|
||||||
// storeActions.INITIALIZE_SESSION,
|
|
||||||
// payload,
|
|
||||||
// false
|
|
||||||
// );
|
|
||||||
|
|
||||||
// if (response?.data) {
|
|
||||||
// if (response?.data.sessionKey && skey === 0) {
|
|
||||||
// setCookieProperties(
|
|
||||||
// { [cookieNames.SESSION_KEY]: response?.data.sessionKey },
|
|
||||||
// {
|
|
||||||
// useDefaultFunnelCookieAttributes: false,
|
|
||||||
// }
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
// if (response?.data.sessionId && sid === "00000000-0000-0000-0000-000000000000") {
|
|
||||||
// setCookieProperties(
|
|
||||||
// { [cookieNames.SESSION_ID]: response?.data.sessionId },
|
|
||||||
// {
|
|
||||||
// maxAge: 60 * 30, // 30 minutes
|
|
||||||
// }
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
|
|
||||||
async initSession() {
|
async initSession() {
|
||||||
if (!isCookieSet(cookieNames.FUNNEL_USER_ID)) {
|
if (!isCookieSet(cookieNames.FUNNEL_USER_ID)) {
|
||||||
setCookieProperties(
|
setCookieProperties(
|
||||||
|
|
@ -199,7 +160,8 @@ export default {
|
||||||
const deviceId = getDeviceIdValue(); // cookieNames.DXDEV
|
const deviceId = getDeviceIdValue(); // cookieNames.DXDEV
|
||||||
const sessionId = getSessionIdValue(); // cookieNames.SESSION_ID
|
const sessionId = getSessionIdValue(); // cookieNames.SESSION_ID
|
||||||
const userAgent = navigator.userAgent; // navigator.userAgent
|
const userAgent = navigator.userAgent; // navigator.userAgent
|
||||||
const refferer = applicationConfig.CURRENT_ENVIRONMENT != "Localhost" ? document.referrer : null; // see above
|
const refferer =
|
||||||
|
applicationConfig.CURRENT_ENVIRONMENT != "Localhost" ? document.referrer : null; // see above
|
||||||
|
|
||||||
const payload = {
|
const payload = {
|
||||||
userId: userId,
|
userId: userId,
|
||||||
|
|
@ -209,31 +171,31 @@ export default {
|
||||||
refferer: refferer,
|
refferer: refferer,
|
||||||
};
|
};
|
||||||
|
|
||||||
const response = await baseMixin.dispatchStoreAction(
|
const response = await baseMixin.methods.dispatchStoreAction(
|
||||||
storeActions.INITIALIZE_SESSION,
|
storeActions.INITIALIZE_SESSION,
|
||||||
payload,
|
payload,
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
|
|
||||||
if(response?.data) {
|
if (response?.data) {
|
||||||
if(response.data.sessionKey && !isCookieSet(cookieNames.FUNNEL_SESSION_KEY)) {
|
if (response.data.sessionKey && !isCookieSet(cookieNames.FUNNEL_SESSION_KEY)) {
|
||||||
setCookieProperties(
|
setCookieProperties(
|
||||||
{
|
{
|
||||||
[cookieNames.FUNNEL_SESSION_KEY]: response.data.sessionKey,
|
[cookieNames.FUNNEL_SESSION_KEY]: response.data.sessionKey,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
maxAge: 30 * 60
|
maxAge: 30 * 60,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(response.data.sessionId && !isCookieSet(cookieNames.SESSION_ID)) {
|
if (response.data.sessionId && !isCookieSet(cookieNames.SESSION_ID)) {
|
||||||
setCookieProperties(
|
setCookieProperties(
|
||||||
{
|
{
|
||||||
[cookieNames.SESSION_ID]: response.data.sessionId
|
[cookieNames.SESSION_ID]: response.data.sessionId,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
maxAge: 30 * 60
|
maxAge: 30 * 60,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -38,11 +38,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 {
|
||||||
if (analyticsMixin.methods.noSession()) {
|
await analyticsMixin.methods.validateSession();
|
||||||
await analyticsMixin.methods.initSession();
|
|
||||||
} else {
|
|
||||||
updateSessionIdCookie();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (getFunnelCookie()?.SuppressConceptFunnel) {
|
if (getFunnelCookie()?.SuppressConceptFunnel) {
|
||||||
await navigateToHeritageFunnel({ shouldSaveSession: false });
|
await navigateToHeritageFunnel({ shouldSaveSession: false });
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue