posthog-node 2.0.0-alpha1 → 2.0.0-alpha4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "posthog-node",
3
- "version": "2.0.0-alpha1",
3
+ "version": "2.0.0-alpha4",
4
4
  "description": "PostHog Node.js integration",
5
5
  "repository": "PostHog/posthog-node",
6
6
  "scripts": {
@@ -66,6 +66,14 @@ export class PostHogGlobal implements PostHogNodeV1 {
66
66
  this._sharedClient.setPersistedProperty(PostHogPersistedProperty.DistinctId, distinctId)
67
67
  }
68
68
 
69
+ enable(): void {
70
+ return this._sharedClient.optIn()
71
+ }
72
+
73
+ disable(): void {
74
+ return this._sharedClient.optOut()
75
+ }
76
+
69
77
  capture({ distinctId, event, properties, groups }: EventMessageV1): void {
70
78
  this.reInit(distinctId)
71
79
  if (groups) {
@@ -41,12 +41,6 @@ describe('PostHog Core', () => {
41
41
  it('should capture an event to shared queue', async () => {
42
42
  expect(mockedUndici.fetch).toHaveBeenCalledTimes(0)
43
43
  posthog.capture({ distinctId: '123', event: 'test-event', properties: { foo: 'bar' }, groups: { org: 123 } })
44
- posthog
45
- .user('124')
46
- .groups({
47
- org: 234,
48
- })
49
- .capture('test-event2', { foo: 'bar2' })
50
44
 
51
45
  jest.runOnlyPendingTimers()
52
46
  const batchEvents = getLastBatchEvents()
@@ -59,14 +53,6 @@ describe('PostHog Core', () => {
59
53
  foo: 'bar',
60
54
  },
61
55
  },
62
- {
63
- distinct_id: '124',
64
- event: 'test-event2',
65
- properties: {
66
- $groups: { org: 234 },
67
- foo: 'bar2',
68
- },
69
- },
70
56
  ])
71
57
  })
72
58