Skip to content

Commit

Permalink
fix: Expose version (#1357)
Browse files Browse the repository at this point in the history
  • Loading branch information
benjackwhite authored Aug 14, 2024
1 parent e74283f commit ca5c004
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/__tests__/posthog-core.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
4 changes: 3 additions & 1 deletion src/posthog-core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<typeof sentryIntegration>
Expand Down Expand Up @@ -863,7 +864,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
}
Expand Down

0 comments on commit ca5c004

Please sign in to comment.