From f1f74d0e6ea5d4fa5433af350d773e642ec6c15e Mon Sep 17 00:00:00 2001 From: Ben White Date: Tue, 13 Aug 2024 16:21:58 +0200 Subject: [PATCH 1/2] Fix types issue --- src/posthog-core.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/posthog-core.ts b/src/posthog-core.ts index 16f21e721..41bd5e473 100644 --- a/src/posthog-core.ts +++ b/src/posthog-core.ts @@ -863,7 +863,8 @@ export class PostHog { this.on('eventCaptured', (data) => callback(data.event, data)) } - _calculate_event_properties(event_name: string, event_properties: Properties, timestamp: Date): Properties { + _calculate_event_properties(event_name: string, event_properties: Properties, timestamp?: Date): Properties { + timestamp = timestamp || new Date() if (!this.persistence || !this.sessionPersistence) { return event_properties } From f7663e016e5982ce1c349881cf42056501a302bd Mon Sep 17 00:00:00 2001 From: Ben White Date: Tue, 13 Aug 2024 16:29:38 +0200 Subject: [PATCH 2/2] Expose the version --- src/__tests__/posthog-core.test.ts | 4 ++++ src/posthog-core.ts | 1 + 2 files changed, 5 insertions(+) diff --git a/src/__tests__/posthog-core.test.ts b/src/__tests__/posthog-core.test.ts index cdbeba835..c60a699b9 100644 --- a/src/__tests__/posthog-core.test.ts +++ b/src/__tests__/posthog-core.test.ts @@ -35,6 +35,10 @@ describe('posthog core', () => { console.error = jest.fn() }) + it('exposes the version', () => { + expect(defaultPostHog().version).toMatch(/\d+\.\d+\.\d+/) + }) + describe('capture()', () => { const eventName = 'custom_event' const eventProperties = { diff --git a/src/posthog-core.ts b/src/posthog-core.ts index 41bd5e473..356457966 100644 --- a/src/posthog-core.ts +++ b/src/posthog-core.ts @@ -264,6 +264,7 @@ export class PostHog { __request_queue: QueuedRequestOptions[] decideEndpointWasHit: boolean analyticsDefaultEndpoint: string + version = Config.LIB_VERSION SentryIntegration: typeof SentryIntegration sentryIntegration: (options?: SentryIntegrationOptions) => ReturnType