Renamed session variable.

This commit is contained in:
Jeremy Zimmerman 2022-11-08 11:30:50 -05:00
parent 744c02c57b
commit 96bdfe4dd8
3 changed files with 7 additions and 7 deletions

View file

@ -1,7 +1,7 @@
import { applicationConfig } from "@/constants/application-config.js";
const cookieNames = {
FUNNEL_SESSION_INFO: `FunnelSessionInfo-${applicationConfig.CURRENT_ENVIRONMENT}`,
ISS_SESSION_INFO: `ISSSessionInfo-${applicationConfig.CURRENT_ENVIRONMENT}`,
// Existing Safelite.com cookies
DXDEV: "dxdev",

View file

@ -32,7 +32,7 @@ export function updateOrCreateFunnelCookie() {
export function getFunnelCookie() {
const cookieJson = document.cookie
?.split("; ")
?.find((row) => row.startsWith(`${cookieNames.FUNNEL_SESSION_INFO}=`))
?.find((row) => row.startsWith(`${cookieNames.ISS_SESSION_INFO}=`))
?.split("=")[1];
try {
@ -46,7 +46,7 @@ export function getFunnelCookie() {
Removes cookie from browser.
*/
export function deleteFunnelCookie() {
createOrUpdateCookie(cookieNames.FUNNEL_SESSION_INFO, undefined, { maxAge: 0 });
createOrUpdateCookie(cookieNames.ISS_SESSION_INFO, undefined, { maxAge: 0 });
}
/*
@ -147,7 +147,7 @@ function setFunnelCookieProperties(properties) {
}
const cookieValueJson = JSON.stringify(cookie ?? {});
createOrUpdateCookie(cookieNames.FUNNEL_SESSION_INFO, cookieValueJson, {});
createOrUpdateCookie(cookieNames.ISS_SESSION_INFO, cookieValueJson, {});
}
}

View file

@ -62,7 +62,7 @@ export function getMountOptions(mockData) {
// Heritage integration common methods
export const cookies = {
[cookieNames.FUNNEL_SESSION_INFO]: `{"ReferralNumber":"1566818","ReferralDate":"2022-03-15T10:56:24.597","ReferralCorrelationId":"404d2b04-f86e-45c3-b373-127b6217b060","ShouldResetState":false,"DidHeritageFunnelUpdateLast":true}`,
[cookieNames.ISS_SESSION_INFO]: `{"ReferralNumber":"1566818","ReferralDate":"2022-03-15T10:56:24.597","ReferralCorrelationId":"404d2b04-f86e-45c3-b373-127b6217b060","ShouldResetState":false,"DidHeritageFunnelUpdateLast":true}`,
UNIQUE_SESSION_ID: "33756020-b58e-4ec7-b8b8-3f1576719c40",
anotherCookie: "{}",
someOtherCookie: "{}",
@ -74,8 +74,8 @@ export const cookies = {
export function setupCookies({ funnelCookieValue = "", includeHeritageCookie = true }) {
Object.keys(cookies).forEach((key) => {
const cookieValue =
key == cookieNames.FUNNEL_SESSION_INFO ? funnelCookieValue : cookies[key];
if (includeHeritageCookie || key != cookieNames.FUNNEL_SESSION_INFO)
key == cookieNames.ISS_SESSION_INFO ? funnelCookieValue : cookies[key];
if (includeHeritageCookie || key != cookieNames.ISS_SESSION_INFO)
setCookieProperties({ [key]: cookieValue }, { isSecure: false });
});
}