Skip to content

Commit

Permalink
NOISSUE - Get rid of clearIdexCache (#272)
Browse files Browse the repository at this point in the history
  • Loading branch information
3link authored Dec 6, 2023
1 parent 66eef57 commit 32b739a
Showing 1 changed file with 0 additions and 29 deletions.
29 changes: 0 additions & 29 deletions src/standard-live-connect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,6 @@ function standardInitialization(liveConnectConfig: LiveConnectConfig, externalSt

const _push = (...args: unknown[]) => processArgs(args, pixelSender, enrichedState, eventBus)

clearIdexCache(eventBus, enrichedState.cookieDomain)

return {
push: _push,
fire: () => _push({}),
Expand Down Expand Up @@ -202,30 +200,3 @@ export function StandardLiveConnect(liveConnectConfig: LiveConnectConfig, extern
// @ts-ignore
return lc
}

// TODO: remove this in next version
function clearIdexCache(bus: EventBus, cookieDomain: string) {
if (window.localStorage) {
try {
for (const key in window.localStorage) {
if (key.startsWith('__li_idex_cache2')) {
localStorage.removeItem(key)
}
}
} catch (e) {
bus.emitErrorWithMessage('ClearIdexLs', 'Failed to clear localStorage', e)
}
}

try {
const allCookies = window.document.cookie.split(';')
for (const cookie of allCookies) {
const key = cookie.split('=')[0].trim()
if (key.startsWith('__li_idex_cache2')) {
document.cookie = `${key}=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/; domain=${cookieDomain}`
}
}
} catch (e) {
bus.emitErrorWithMessage('ClearIdexCookie', 'Failed to clear cookies', e)
}
}

0 comments on commit 32b739a

Please sign in to comment.