posthog-node 5.39.0 → 5.39.1

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/dist/client.d.ts CHANGED
@@ -218,6 +218,7 @@ export declare abstract class PostHogBackendClient extends PostHogCoreStateless
218
218
  */
219
219
  debug(enabled?: boolean): void;
220
220
  private _warnIfInvalidCapture;
221
+ private _sendPreparedEvent;
221
222
  private _capturePreparedEvent;
222
223
  /**
223
224
  * Capture an event manually.
@@ -1094,6 +1095,7 @@ export declare abstract class PostHogBackendClient extends PostHogCoreStateless
1094
1095
  properties: PostHogEventProperties;
1095
1096
  options: PostHogCaptureOptions;
1096
1097
  }>;
1098
+ private _prepareEventMessage;
1097
1099
  private _runBeforeSend;
1098
1100
  }
1099
1101
  //# sourceMappingURL=client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,gBAAgB,EAGhB,QAAQ,EACR,qBAAqB,EACrB,oBAAoB,EACpB,sBAAsB,EACtB,mBAAmB,EACnB,oBAAoB,EACpB,+BAA+B,EAE/B,wBAAwB,EAGzB,MAAM,eAAe,CAAA;AACtB,OAAO,EACL,eAAe,EACf,YAAY,EAIZ,iBAAiB,EACjB,qBAAqB,EACrB,oBAAoB,EACpB,eAAe,EACf,QAAQ,EACR,2BAA2B,EAC3B,cAAc,EAEd,0BAA0B,EAC1B,4BAA4B,EAC7B,MAAM,SAAS,CAAA;AAChB,OAAO,EAEL,sBAAsB,EAEtB,qBAAqB,EACtB,MAAM,4BAA4B,CAAA;AAOnC,OAAO,aAAa,MAAM,6BAA6B,CAAA;AAEvD,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAyBzF;;GAEG;AACH,wBAAgB,iCAAiC,IAAI,IAAI,CAExD;AA6CD,8BAAsB,oBAAqB,SAAQ,oBAAqB,YAAW,QAA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P;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAmCG;IACG,yBAAyB,CAC7B,KAAK,EAAE,OAAO,EACd,UAAU,CAAC,EAAE,MAAM,EACnB,oBAAoB,CAAC,EAAE,MAAM,CAAC,MAAM,GAAG,MAAM,EAAE,GAAG,CAAC,EACnD,KAAK,CAAC,EAAE,sBAAsB,GAC7B,OAAO,CAAC,IAAI,CAAC;IAeH,mBAAmB,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC;QAC7D,UAAU,EAAE,MAAM,CAAA;QAClB,KAAK,EAAE,MAAM,CAAA;QACb,UAAU,EAAE,sBAAsB,CAAA;QAClC,OAAO,EAAE,qBAAqB,CAAA;KAC/B,CAAC;YAIY,oBAAoB;IA8IlC,OAAO,CAAC,cAAc;CAuBvB"}
package/dist/client.js CHANGED
@@ -215,18 +215,29 @@ class PostHogBackendClient extends core_namespaceObject.PostHogCoreStateless {
215
215
  if ('string' == typeof props) this._logger.warn(stringArgumentWarning);
216
216
  if ('$exception' === props.event && !props._originatedFromCaptureException) this._logger.warn(exceptionCaptureWarning);
217
217
  }
218
- _capturePreparedEvent(props, immediate) {
219
- return this.addPendingPromise(this.prepareEventMessage(props).then(({ distinctId, event, properties, options })=>{
218
+ _sendPreparedEvent(type, props, immediate, prepareOptions) {
219
+ return this.addPendingPromise(this._prepareEventMessage(props, prepareOptions).then(({ distinctId, event, properties, options })=>{
220
220
  const captureOptions = {
221
221
  timestamp: options.timestamp,
222
222
  disableGeoip: options.disableGeoip,
223
223
  uuid: options.uuid
224
224
  };
225
- return immediate ? super.captureStatelessImmediate(distinctId, event, properties, captureOptions) : super.captureStateless(distinctId, event, properties, captureOptions);
225
+ const message = {
226
+ distinctId,
227
+ event,
228
+ properties: {
229
+ ...properties,
230
+ ...this.getCommonEventProperties()
231
+ }
232
+ };
233
+ return immediate ? this.sendImmediate(type, message, captureOptions) : this.enqueue(type, message, captureOptions);
226
234
  }).catch((err)=>{
227
235
  if (err) console.error(err);
228
236
  }));
229
237
  }
238
+ _capturePreparedEvent(props, immediate) {
239
+ return this._sendPreparedEvent('capture', props, immediate);
240
+ }
230
241
  capture(props) {
231
242
  this._warnIfInvalidCapture(props, 'Called capture() with a string as the first argument when an object was expected.', "Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically.");
232
243
  this._capturePreparedEvent(props, false);
@@ -244,8 +255,13 @@ class PostHogBackendClient extends core_namespaceObject.PostHogCoreStateless {
244
255
  $set_once: setOnceProps,
245
256
  $anon_distinct_id: $anon_distinct_id ?? void 0
246
257
  };
247
- super.identifyStateless(distinctId, eventProperties, {
258
+ this._sendPreparedEvent('identify', {
259
+ distinctId,
260
+ event: '$identify',
261
+ properties: eventProperties,
248
262
  disableGeoip
263
+ }, false, {
264
+ includeContextProperties: false
249
265
  });
250
266
  }
251
267
  async identifyImmediate({ distinctId, properties = {}, disableGeoip }) {
@@ -257,8 +273,13 @@ class PostHogBackendClient extends core_namespaceObject.PostHogCoreStateless {
257
273
  $set_once: setOnceProps,
258
274
  $anon_distinct_id: $anon_distinct_id ?? void 0
259
275
  };
260
- await super.identifyStatelessImmediate(distinctId, eventProperties, {
276
+ await this._sendPreparedEvent('identify', {
277
+ distinctId,
278
+ event: '$identify',
279
+ properties: eventProperties,
261
280
  disableGeoip
281
+ }, true, {
282
+ includeContextProperties: false
262
283
  });
263
284
  }
264
285
  setPersonProperties({ distinctId, properties = {}, propertiesOnce = {} }) {
@@ -284,13 +305,29 @@ class PostHogBackendClient extends core_namespaceObject.PostHogCoreStateless {
284
305
  });
285
306
  }
286
307
  alias(data) {
287
- super.aliasStateless(data.alias, data.distinctId, void 0, {
308
+ this._sendPreparedEvent('alias', {
309
+ distinctId: data.distinctId,
310
+ event: '$create_alias',
311
+ properties: {
312
+ distinct_id: data.distinctId,
313
+ alias: data.alias
314
+ },
288
315
  disableGeoip: data.disableGeoip
316
+ }, false, {
317
+ includeContextProperties: false
289
318
  });
290
319
  }
291
320
  async aliasImmediate(data) {
292
- await super.aliasStatelessImmediate(data.alias, data.distinctId, void 0, {
321
+ await this._sendPreparedEvent('alias', {
322
+ distinctId: data.distinctId,
323
+ event: '$create_alias',
324
+ properties: {
325
+ distinct_id: data.distinctId,
326
+ alias: data.alias
327
+ },
293
328
  disableGeoip: data.disableGeoip
329
+ }, true, {
330
+ includeContextProperties: false
294
331
  });
295
332
  }
296
333
  isLocalEvaluationReady() {
@@ -696,14 +733,32 @@ class PostHogBackendClient extends core_namespaceObject.PostHogCoreStateless {
696
733
  return this._featureFlagEvaluationsHost;
697
734
  }
698
735
  groupIdentify({ groupType, groupKey, properties, distinctId, disableGeoip }) {
699
- super.groupIdentifyStateless(groupType, groupKey, properties, {
736
+ this._sendPreparedEvent('capture', {
737
+ distinctId: distinctId || `$${groupType}_${groupKey}`,
738
+ event: '$groupidentify',
739
+ properties: {
740
+ $group_type: groupType,
741
+ $group_key: groupKey,
742
+ $group_set: properties || {}
743
+ },
700
744
  disableGeoip
701
- }, distinctId);
745
+ }, false, {
746
+ includeContextProperties: false
747
+ });
702
748
  }
703
749
  async groupIdentifyImmediate({ groupType, groupKey, properties, distinctId, disableGeoip }) {
704
- await super.groupIdentifyStatelessImmediate(groupType, groupKey, properties, {
750
+ await this._sendPreparedEvent('capture', {
751
+ distinctId: distinctId || `$${groupType}_${groupKey}`,
752
+ event: '$groupidentify',
753
+ properties: {
754
+ $group_type: groupType,
755
+ $group_key: groupKey,
756
+ $group_set: properties || {}
757
+ },
705
758
  disableGeoip
706
- }, distinctId);
759
+ }, true, {
760
+ includeContextProperties: false
761
+ });
707
762
  }
708
763
  async reloadFeatureFlags() {
709
764
  await this.featureFlagsPoller?.loadFeatureFlags(true);
@@ -902,19 +957,25 @@ class PostHogBackendClient extends core_namespaceObject.PostHogCoreStateless {
902
957
  }
903
958
  }
904
959
  async prepareEventMessage(props) {
960
+ return this._prepareEventMessage(props);
961
+ }
962
+ async _prepareEventMessage(props, options = {}) {
905
963
  const { distinctId, event, properties, groups, flags, sendFeatureFlags, timestamp, disableGeoip, uuid } = props;
906
964
  const contextData = this.context?.get();
965
+ const includeContextProperties = options.includeContextProperties ?? true;
907
966
  let mergedDistinctId = distinctId || contextData?.distinctId;
908
- const mergedProperties = {
967
+ const mergedProperties = includeContextProperties ? {
909
968
  ...this.props,
910
969
  ...contextData?.properties || {},
911
970
  ...properties || {}
971
+ } : {
972
+ ...properties || {}
912
973
  };
913
974
  if (!mergedDistinctId) {
914
975
  mergedDistinctId = (0, core_namespaceObject.uuidv7)();
915
976
  mergedProperties.$process_person_profile = false;
916
977
  }
917
- if (contextData?.sessionId && !mergedProperties.$session_id) mergedProperties.$session_id = contextData.sessionId;
978
+ if (includeContextProperties && contextData?.sessionId && !mergedProperties.$session_id) mergedProperties.$session_id = contextData.sessionId;
918
979
  const eventMessage = this._runBeforeSend({
919
980
  distinctId: mergedDistinctId,
920
981
  event,
package/dist/client.mjs CHANGED
@@ -176,18 +176,29 @@ class PostHogBackendClient extends PostHogCoreStateless {
176
176
  if ('string' == typeof props) this._logger.warn(stringArgumentWarning);
177
177
  if ('$exception' === props.event && !props._originatedFromCaptureException) this._logger.warn(exceptionCaptureWarning);
178
178
  }
179
- _capturePreparedEvent(props, immediate) {
180
- return this.addPendingPromise(this.prepareEventMessage(props).then(({ distinctId, event, properties, options })=>{
179
+ _sendPreparedEvent(type, props, immediate, prepareOptions) {
180
+ return this.addPendingPromise(this._prepareEventMessage(props, prepareOptions).then(({ distinctId, event, properties, options })=>{
181
181
  const captureOptions = {
182
182
  timestamp: options.timestamp,
183
183
  disableGeoip: options.disableGeoip,
184
184
  uuid: options.uuid
185
185
  };
186
- return immediate ? super.captureStatelessImmediate(distinctId, event, properties, captureOptions) : super.captureStateless(distinctId, event, properties, captureOptions);
186
+ const message = {
187
+ distinctId,
188
+ event,
189
+ properties: {
190
+ ...properties,
191
+ ...this.getCommonEventProperties()
192
+ }
193
+ };
194
+ return immediate ? this.sendImmediate(type, message, captureOptions) : this.enqueue(type, message, captureOptions);
187
195
  }).catch((err)=>{
188
196
  if (err) console.error(err);
189
197
  }));
190
198
  }
199
+ _capturePreparedEvent(props, immediate) {
200
+ return this._sendPreparedEvent('capture', props, immediate);
201
+ }
191
202
  capture(props) {
192
203
  this._warnIfInvalidCapture(props, 'Called capture() with a string as the first argument when an object was expected.', "Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically.");
193
204
  this._capturePreparedEvent(props, false);
@@ -205,8 +216,13 @@ class PostHogBackendClient extends PostHogCoreStateless {
205
216
  $set_once: setOnceProps,
206
217
  $anon_distinct_id: $anon_distinct_id ?? void 0
207
218
  };
208
- super.identifyStateless(distinctId, eventProperties, {
219
+ this._sendPreparedEvent('identify', {
220
+ distinctId,
221
+ event: '$identify',
222
+ properties: eventProperties,
209
223
  disableGeoip
224
+ }, false, {
225
+ includeContextProperties: false
210
226
  });
211
227
  }
212
228
  async identifyImmediate({ distinctId, properties = {}, disableGeoip }) {
@@ -218,8 +234,13 @@ class PostHogBackendClient extends PostHogCoreStateless {
218
234
  $set_once: setOnceProps,
219
235
  $anon_distinct_id: $anon_distinct_id ?? void 0
220
236
  };
221
- await super.identifyStatelessImmediate(distinctId, eventProperties, {
237
+ await this._sendPreparedEvent('identify', {
238
+ distinctId,
239
+ event: '$identify',
240
+ properties: eventProperties,
222
241
  disableGeoip
242
+ }, true, {
243
+ includeContextProperties: false
223
244
  });
224
245
  }
225
246
  setPersonProperties({ distinctId, properties = {}, propertiesOnce = {} }) {
@@ -245,13 +266,29 @@ class PostHogBackendClient extends PostHogCoreStateless {
245
266
  });
246
267
  }
247
268
  alias(data) {
248
- super.aliasStateless(data.alias, data.distinctId, void 0, {
269
+ this._sendPreparedEvent('alias', {
270
+ distinctId: data.distinctId,
271
+ event: '$create_alias',
272
+ properties: {
273
+ distinct_id: data.distinctId,
274
+ alias: data.alias
275
+ },
249
276
  disableGeoip: data.disableGeoip
277
+ }, false, {
278
+ includeContextProperties: false
250
279
  });
251
280
  }
252
281
  async aliasImmediate(data) {
253
- await super.aliasStatelessImmediate(data.alias, data.distinctId, void 0, {
282
+ await this._sendPreparedEvent('alias', {
283
+ distinctId: data.distinctId,
284
+ event: '$create_alias',
285
+ properties: {
286
+ distinct_id: data.distinctId,
287
+ alias: data.alias
288
+ },
254
289
  disableGeoip: data.disableGeoip
290
+ }, true, {
291
+ includeContextProperties: false
255
292
  });
256
293
  }
257
294
  isLocalEvaluationReady() {
@@ -657,14 +694,32 @@ class PostHogBackendClient extends PostHogCoreStateless {
657
694
  return this._featureFlagEvaluationsHost;
658
695
  }
659
696
  groupIdentify({ groupType, groupKey, properties, distinctId, disableGeoip }) {
660
- super.groupIdentifyStateless(groupType, groupKey, properties, {
697
+ this._sendPreparedEvent('capture', {
698
+ distinctId: distinctId || `$${groupType}_${groupKey}`,
699
+ event: '$groupidentify',
700
+ properties: {
701
+ $group_type: groupType,
702
+ $group_key: groupKey,
703
+ $group_set: properties || {}
704
+ },
661
705
  disableGeoip
662
- }, distinctId);
706
+ }, false, {
707
+ includeContextProperties: false
708
+ });
663
709
  }
664
710
  async groupIdentifyImmediate({ groupType, groupKey, properties, distinctId, disableGeoip }) {
665
- await super.groupIdentifyStatelessImmediate(groupType, groupKey, properties, {
711
+ await this._sendPreparedEvent('capture', {
712
+ distinctId: distinctId || `$${groupType}_${groupKey}`,
713
+ event: '$groupidentify',
714
+ properties: {
715
+ $group_type: groupType,
716
+ $group_key: groupKey,
717
+ $group_set: properties || {}
718
+ },
666
719
  disableGeoip
667
- }, distinctId);
720
+ }, true, {
721
+ includeContextProperties: false
722
+ });
668
723
  }
669
724
  async reloadFeatureFlags() {
670
725
  await this.featureFlagsPoller?.loadFeatureFlags(true);
@@ -863,19 +918,25 @@ class PostHogBackendClient extends PostHogCoreStateless {
863
918
  }
864
919
  }
865
920
  async prepareEventMessage(props) {
921
+ return this._prepareEventMessage(props);
922
+ }
923
+ async _prepareEventMessage(props, options = {}) {
866
924
  const { distinctId, event, properties, groups, flags, sendFeatureFlags, timestamp, disableGeoip, uuid } = props;
867
925
  const contextData = this.context?.get();
926
+ const includeContextProperties = options.includeContextProperties ?? true;
868
927
  let mergedDistinctId = distinctId || contextData?.distinctId;
869
- const mergedProperties = {
928
+ const mergedProperties = includeContextProperties ? {
870
929
  ...this.props,
871
930
  ...contextData?.properties || {},
872
931
  ...properties || {}
932
+ } : {
933
+ ...properties || {}
873
934
  };
874
935
  if (!mergedDistinctId) {
875
936
  mergedDistinctId = uuidv7();
876
937
  mergedProperties.$process_person_profile = false;
877
938
  }
878
- if (contextData?.sessionId && !mergedProperties.$session_id) mergedProperties.$session_id = contextData.sessionId;
939
+ if (includeContextProperties && contextData?.sessionId && !mergedProperties.$session_id) mergedProperties.$session_id = contextData.sessionId;
879
940
  const eventMessage = this._runBeforeSend({
880
941
  distinctId: mergedDistinctId,
881
942
  event,
package/dist/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const version = "5.39.0";
1
+ export declare const version = "5.39.1";
2
2
  //# sourceMappingURL=version.d.ts.map
package/dist/version.js CHANGED
@@ -26,7 +26,7 @@ __webpack_require__.r(__webpack_exports__);
26
26
  __webpack_require__.d(__webpack_exports__, {
27
27
  version: ()=>version
28
28
  });
29
- const version = '5.39.0';
29
+ const version = '5.39.1';
30
30
  exports.version = __webpack_exports__.version;
31
31
  for(var __webpack_i__ in __webpack_exports__)if (-1 === [
32
32
  "version"
package/dist/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- const version = '5.39.0';
1
+ const version = '5.39.1';
2
2
  export { version };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "posthog-node",
3
- "version": "5.39.0",
3
+ "version": "5.39.1",
4
4
  "bugs": {
5
5
  "url": "https://github.com/PostHog/posthog-js/issues"
6
6
  },
@@ -28,7 +28,7 @@
28
28
  "module": "dist/entrypoints/index.node.mjs",
29
29
  "types": "dist/entrypoints/index.node.d.ts",
30
30
  "dependencies": {
31
- "@posthog/core": "^1.39.0"
31
+ "@posthog/core": "^1.39.2"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@edge-runtime/jest-environment": "^4.0.0",
package/src/client.ts CHANGED
@@ -532,18 +532,31 @@ export abstract class PostHogBackendClient extends PostHogCoreStateless implemen
532
532
  }
533
533
  }
534
534
 
535
- private _capturePreparedEvent(props: EventMessage, immediate: boolean): Promise<void> {
535
+ private _sendPreparedEvent(
536
+ type: string,
537
+ props: EventMessage,
538
+ immediate: boolean,
539
+ prepareOptions?: { includeContextProperties?: boolean }
540
+ ): Promise<void> {
536
541
  return this.addPendingPromise(
537
- this.prepareEventMessage(props)
542
+ this._prepareEventMessage(props, prepareOptions)
538
543
  .then(({ distinctId, event, properties, options }) => {
539
544
  const captureOptions: PostHogCaptureOptions = {
540
545
  timestamp: options.timestamp,
541
546
  disableGeoip: options.disableGeoip,
542
547
  uuid: options.uuid,
543
548
  }
549
+ const message = {
550
+ distinctId,
551
+ event,
552
+ properties: {
553
+ ...properties,
554
+ ...this.getCommonEventProperties(),
555
+ },
556
+ }
544
557
  return immediate
545
- ? super.captureStatelessImmediate(distinctId, event, properties, captureOptions)
546
- : super.captureStateless(distinctId, event, properties, captureOptions)
558
+ ? this.sendImmediate(type, message, captureOptions)
559
+ : this.enqueue(type, message, captureOptions)
547
560
  })
548
561
  .catch((err) => {
549
562
  if (err) {
@@ -553,6 +566,10 @@ export abstract class PostHogBackendClient extends PostHogCoreStateless implemen
553
566
  )
554
567
  }
555
568
 
569
+ private _capturePreparedEvent(props: EventMessage, immediate: boolean): Promise<void> {
570
+ return this._sendPreparedEvent('capture', props, immediate)
571
+ }
572
+
556
573
  /**
557
574
  * Capture an event manually.
558
575
  *
@@ -676,7 +693,12 @@ export abstract class PostHogBackendClient extends PostHogCoreStateless implemen
676
693
  $set_once: setOnceProps,
677
694
  $anon_distinct_id: $anon_distinct_id ?? undefined,
678
695
  }
679
- super.identifyStateless(distinctId, eventProperties, { disableGeoip })
696
+ this._sendPreparedEvent(
697
+ 'identify',
698
+ { distinctId, event: '$identify', properties: eventProperties, disableGeoip },
699
+ false,
700
+ { includeContextProperties: false }
701
+ )
680
702
  }
681
703
 
682
704
  /**
@@ -710,7 +732,12 @@ export abstract class PostHogBackendClient extends PostHogCoreStateless implemen
710
732
  $set_once: setOnceProps,
711
733
  $anon_distinct_id: $anon_distinct_id ?? undefined,
712
734
  }
713
- await super.identifyStatelessImmediate(distinctId, eventProperties, { disableGeoip })
735
+ await this._sendPreparedEvent(
736
+ 'identify',
737
+ { distinctId, event: '$identify', properties: eventProperties, disableGeoip },
738
+ true,
739
+ { includeContextProperties: false }
740
+ )
714
741
  }
715
742
 
716
743
  /**
@@ -790,7 +817,17 @@ export abstract class PostHogBackendClient extends PostHogCoreStateless implemen
790
817
  * @param data - The alias data containing distinctId and alias
791
818
  */
792
819
  alias(data: { distinctId: string; alias: string; disableGeoip?: boolean }): void {
793
- super.aliasStateless(data.alias, data.distinctId, undefined, { disableGeoip: data.disableGeoip })
820
+ this._sendPreparedEvent(
821
+ 'alias',
822
+ {
823
+ distinctId: data.distinctId,
824
+ event: '$create_alias',
825
+ properties: { distinct_id: data.distinctId, alias: data.alias },
826
+ disableGeoip: data.disableGeoip,
827
+ },
828
+ false,
829
+ { includeContextProperties: false }
830
+ )
794
831
  }
795
832
 
796
833
  /**
@@ -811,7 +848,17 @@ export abstract class PostHogBackendClient extends PostHogCoreStateless implemen
811
848
  * @returns Promise that resolves when the alias is processed
812
849
  */
813
850
  async aliasImmediate(data: { distinctId: string; alias: string; disableGeoip?: boolean }): Promise<void> {
814
- await super.aliasStatelessImmediate(data.alias, data.distinctId, undefined, { disableGeoip: data.disableGeoip })
851
+ await this._sendPreparedEvent(
852
+ 'alias',
853
+ {
854
+ distinctId: data.distinctId,
855
+ event: '$create_alias',
856
+ properties: { distinct_id: data.distinctId, alias: data.alias },
857
+ disableGeoip: data.disableGeoip,
858
+ },
859
+ true,
860
+ { includeContextProperties: false }
861
+ )
815
862
  }
816
863
 
817
864
  /**
@@ -1965,7 +2012,21 @@ export abstract class PostHogBackendClient extends PostHogCoreStateless implemen
1965
2012
  * @param data - The group identify data
1966
2013
  */
1967
2014
  groupIdentify({ groupType, groupKey, properties, distinctId, disableGeoip }: GroupIdentifyMessage): void {
1968
- super.groupIdentifyStateless(groupType, groupKey, properties, { disableGeoip }, distinctId)
2015
+ this._sendPreparedEvent(
2016
+ 'capture',
2017
+ {
2018
+ distinctId: distinctId || `$${groupType}_${groupKey}`,
2019
+ event: '$groupidentify',
2020
+ properties: {
2021
+ $group_type: groupType,
2022
+ $group_key: groupKey,
2023
+ $group_set: properties || {},
2024
+ },
2025
+ disableGeoip,
2026
+ },
2027
+ false,
2028
+ { includeContextProperties: false }
2029
+ )
1969
2030
  }
1970
2031
 
1971
2032
  /**
@@ -1997,7 +2058,21 @@ export abstract class PostHogBackendClient extends PostHogCoreStateless implemen
1997
2058
  distinctId,
1998
2059
  disableGeoip,
1999
2060
  }: GroupIdentifyMessage): Promise<void> {
2000
- await super.groupIdentifyStatelessImmediate(groupType, groupKey, properties, { disableGeoip }, distinctId)
2061
+ await this._sendPreparedEvent(
2062
+ 'capture',
2063
+ {
2064
+ distinctId: distinctId || `$${groupType}_${groupKey}`,
2065
+ event: '$groupidentify',
2066
+ properties: {
2067
+ $group_type: groupType,
2068
+ $group_key: groupKey,
2069
+ $group_set: properties || {},
2070
+ },
2071
+ disableGeoip,
2072
+ },
2073
+ true,
2074
+ { includeContextProperties: false }
2075
+ )
2001
2076
  }
2002
2077
 
2003
2078
  /**
@@ -2531,6 +2606,18 @@ export abstract class PostHogBackendClient extends PostHogCoreStateless implemen
2531
2606
  event: string
2532
2607
  properties: PostHogEventProperties
2533
2608
  options: PostHogCaptureOptions
2609
+ }> {
2610
+ return this._prepareEventMessage(props)
2611
+ }
2612
+
2613
+ private async _prepareEventMessage(
2614
+ props: EventMessage,
2615
+ options: { includeContextProperties?: boolean } = {}
2616
+ ): Promise<{
2617
+ distinctId: string
2618
+ event: string
2619
+ properties: PostHogEventProperties
2620
+ options: PostHogCaptureOptions
2534
2621
  }> {
2535
2622
  const {
2536
2623
  distinctId,
@@ -2545,21 +2632,24 @@ export abstract class PostHogBackendClient extends PostHogCoreStateless implemen
2545
2632
  }: EventMessage = props
2546
2633
 
2547
2634
  const contextData = this.context?.get()
2635
+ const includeContextProperties = options.includeContextProperties ?? true
2548
2636
 
2549
2637
  let mergedDistinctId = distinctId || contextData?.distinctId
2550
2638
 
2551
- const mergedProperties = {
2552
- ...this.props,
2553
- ...(contextData?.properties || {}),
2554
- ...(properties || {}),
2555
- }
2639
+ const mergedProperties = includeContextProperties
2640
+ ? {
2641
+ ...this.props,
2642
+ ...(contextData?.properties || {}),
2643
+ ...(properties || {}),
2644
+ }
2645
+ : { ...(properties || {}) }
2556
2646
 
2557
2647
  if (!mergedDistinctId) {
2558
2648
  mergedDistinctId = uuidv7()
2559
2649
  mergedProperties.$process_person_profile = false
2560
2650
  }
2561
2651
 
2562
- if (contextData?.sessionId && !mergedProperties.$session_id) {
2652
+ if (includeContextProperties && contextData?.sessionId && !mergedProperties.$session_id) {
2563
2653
  mergedProperties.$session_id = contextData.sessionId
2564
2654
  }
2565
2655
 
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const version = '5.39.0'
1
+ export const version = '5.39.1'