posthog-node
Advanced tools
Comparing version 2.0.0-alpha5 to 2.0.0-alpha6
@@ -142,3 +142,3 @@ 'use strict'; | ||
var version = "2.0.0-alpha5"; | ||
var version = "2.0.0-alpha6"; | ||
@@ -1217,9 +1217,11 @@ var PostHogPersistedProperty; | ||
PostHogGlobal.prototype.reInit = function (distinctId) { | ||
// Remove all state except the queue | ||
var queue = this._sharedClient.getPersistedProperty(PostHogPersistedProperty.Queue); | ||
// Certain properties we want to persist | ||
var propertiesToKeep = [PostHogPersistedProperty.Queue, PostHogPersistedProperty.OptedOut]; | ||
this._sharedClient.reset(); | ||
for (var key in PostHogPersistedProperty) { | ||
if (!propertiesToKeep.includes(key)) { | ||
this._sharedClient.setPersistedProperty(PostHogPersistedProperty[key], null); | ||
} | ||
} | ||
this._sharedClient.setPersistedProperty(PostHogPersistedProperty.Queue, queue); | ||
this._sharedClient.setPersistedProperty(PostHogPersistedProperty.DistinctId, distinctId); | ||
@@ -1226,0 +1228,0 @@ }; |
@@ -134,3 +134,3 @@ import undici from 'undici'; | ||
var version = "2.0.0-alpha5"; | ||
var version = "2.0.0-alpha6"; | ||
@@ -1209,9 +1209,11 @@ var PostHogPersistedProperty; | ||
PostHogGlobal.prototype.reInit = function (distinctId) { | ||
// Remove all state except the queue | ||
var queue = this._sharedClient.getPersistedProperty(PostHogPersistedProperty.Queue); | ||
// Certain properties we want to persist | ||
var propertiesToKeep = [PostHogPersistedProperty.Queue, PostHogPersistedProperty.OptedOut]; | ||
this._sharedClient.reset(); | ||
for (var key in PostHogPersistedProperty) { | ||
if (!propertiesToKeep.includes(key)) { | ||
this._sharedClient.setPersistedProperty(PostHogPersistedProperty[key], null); | ||
} | ||
} | ||
this._sharedClient.setPersistedProperty(PostHogPersistedProperty.Queue, queue); | ||
this._sharedClient.setPersistedProperty(PostHogPersistedProperty.DistinctId, distinctId); | ||
@@ -1218,0 +1220,0 @@ }; |
{ | ||
"name": "posthog-node", | ||
"version": "2.0.0-alpha5", | ||
"version": "2.0.0-alpha6", | ||
"description": "PostHog Node.js integration", | ||
@@ -5,0 +5,0 @@ "repository": "PostHog/posthog-node", |
@@ -65,6 +65,10 @@ import { version } from '../package.json' | ||
private reInit(distinctId: string): void { | ||
// Remove all state except the queue | ||
const queue = this._sharedClient.getPersistedProperty(PostHogPersistedProperty.Queue) | ||
this._sharedClient.reset() | ||
this._sharedClient.setPersistedProperty(PostHogPersistedProperty.Queue, queue) | ||
// Certain properties we want to persist | ||
const propertiesToKeep = [PostHogPersistedProperty.Queue, PostHogPersistedProperty.OptedOut] | ||
for (const key in PostHogPersistedProperty) { | ||
if (!propertiesToKeep.includes(key as any)) { | ||
this._sharedClient.setPersistedProperty((PostHogPersistedProperty as any)[key], null) | ||
} | ||
} | ||
this._sharedClient.setPersistedProperty(PostHogPersistedProperty.DistinctId, distinctId) | ||
@@ -71,0 +75,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
349562
3286