autotel-posthog 2.0.0 → 3.0.0

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.
@@ -279,15 +279,12 @@ var PostHogSubscriber = class extends autotel_subscribers.EventSubscriber {
279
279
  } catch {}
280
280
  const distinctId = this.extractDistinctId(filteredAttributes);
281
281
  if (this.isBrowserClient) this.browserClient?.capture(payload.name, redactedProperties);
282
- else {
283
- const capturePayload = {
284
- distinctId,
285
- event: payload.name,
286
- properties: redactedProperties
287
- };
288
- if (filteredAttributes?.groups) capturePayload.groups = filteredAttributes.groups;
289
- this.posthog?.capture(capturePayload);
290
- }
282
+ else this.posthog?.capture({
283
+ distinctId,
284
+ event: payload.name,
285
+ properties: redactedProperties,
286
+ ...filteredAttributes?.groups ? { groups: filteredAttributes.groups } : {}
287
+ });
291
288
  }
292
289
  /**
293
290
  * Check if a feature flag is enabled for a user
@@ -142,9 +142,9 @@ interface FeatureFlagOptions {
142
142
  /** Group context for group-based feature flags */
143
143
  groups?: Record<string, string | number>;
144
144
  /** Group properties for feature flag evaluation */
145
- groupProperties?: Record<string, Record<string, any>>;
145
+ groupProperties?: Record<string, Record<string, unknown>>;
146
146
  /** Person properties for feature flag evaluation */
147
- personProperties?: Record<string, any>;
147
+ personProperties?: Record<string, unknown>;
148
148
  /** Only evaluate locally, don't send $feature_flag_called event */
149
149
  onlyEvaluateLocally?: boolean;
150
150
  /** Send feature flag events even if disabled globally */
@@ -155,11 +155,11 @@ interface FeatureFlagOptions {
155
155
  */
156
156
  interface PersonProperties {
157
157
  /** Set properties (will update existing values) */
158
- $set?: Record<string, any>;
158
+ $set?: Record<string, unknown>;
159
159
  /** Set properties only if they don't exist */
160
- $set_once?: Record<string, any>;
160
+ $set_once?: Record<string, unknown>;
161
161
  /** Any custom properties */
162
- [key: string]: any;
162
+ [key: string]: unknown;
163
163
  }
164
164
  declare class PostHogSubscriber extends EventSubscriber {
165
165
  readonly name = "PostHogSubscriber";
@@ -325,7 +325,7 @@ declare class PostHogSubscriber extends EventSubscriber {
325
325
  * });
326
326
  * ```
327
327
  */
328
- groupIdentify(groupType: string, groupKey: string | number, properties?: Record<string, any>): Promise<void>;
328
+ groupIdentify(groupType: string, groupKey: string | number, properties?: Record<string, unknown>): Promise<void>;
329
329
  /**
330
330
  * Track an event with group context
331
331
  *
@@ -142,9 +142,9 @@ interface FeatureFlagOptions {
142
142
  /** Group context for group-based feature flags */
143
143
  groups?: Record<string, string | number>;
144
144
  /** Group properties for feature flag evaluation */
145
- groupProperties?: Record<string, Record<string, any>>;
145
+ groupProperties?: Record<string, Record<string, unknown>>;
146
146
  /** Person properties for feature flag evaluation */
147
- personProperties?: Record<string, any>;
147
+ personProperties?: Record<string, unknown>;
148
148
  /** Only evaluate locally, don't send $feature_flag_called event */
149
149
  onlyEvaluateLocally?: boolean;
150
150
  /** Send feature flag events even if disabled globally */
@@ -155,11 +155,11 @@ interface FeatureFlagOptions {
155
155
  */
156
156
  interface PersonProperties {
157
157
  /** Set properties (will update existing values) */
158
- $set?: Record<string, any>;
158
+ $set?: Record<string, unknown>;
159
159
  /** Set properties only if they don't exist */
160
- $set_once?: Record<string, any>;
160
+ $set_once?: Record<string, unknown>;
161
161
  /** Any custom properties */
162
- [key: string]: any;
162
+ [key: string]: unknown;
163
163
  }
164
164
  declare class PostHogSubscriber extends EventSubscriber {
165
165
  readonly name = "PostHogSubscriber";
@@ -325,7 +325,7 @@ declare class PostHogSubscriber extends EventSubscriber {
325
325
  * });
326
326
  * ```
327
327
  */
328
- groupIdentify(groupType: string, groupKey: string | number, properties?: Record<string, any>): Promise<void>;
328
+ groupIdentify(groupType: string, groupKey: string | number, properties?: Record<string, unknown>): Promise<void>;
329
329
  /**
330
330
  * Track an event with group context
331
331
  *
@@ -255,15 +255,12 @@ var PostHogSubscriber = class extends EventSubscriber {
255
255
  } catch {}
256
256
  const distinctId = this.extractDistinctId(filteredAttributes);
257
257
  if (this.isBrowserClient) this.browserClient?.capture(payload.name, redactedProperties);
258
- else {
259
- const capturePayload = {
260
- distinctId,
261
- event: payload.name,
262
- properties: redactedProperties
263
- };
264
- if (filteredAttributes?.groups) capturePayload.groups = filteredAttributes.groups;
265
- this.posthog?.capture(capturePayload);
266
- }
258
+ else this.posthog?.capture({
259
+ distinctId,
260
+ event: payload.name,
261
+ properties: redactedProperties,
262
+ ...filteredAttributes?.groups ? { groups: filteredAttributes.groups } : {}
263
+ });
267
264
  }
268
265
  /**
269
266
  * Check if a feature flag is enabled for a user
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "autotel-posthog",
3
- "version": "2.0.0",
3
+ "version": "3.0.0",
4
4
  "description": "Everything PostHog for autotel: browser session/replay join, server-side event subscriber, and trace links in both directions",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -30,9 +30,9 @@
30
30
  "@opentelemetry/sdk-trace-base": ">=2.0.0",
31
31
  "posthog-js": ">=1.200.0",
32
32
  "posthog-node": ">=4.0.0",
33
- "autotel": "7.1.0",
34
- "autotel-subscribers": "51.0.0",
35
- "autotel-web": "1.13.1"
33
+ "autotel-subscribers": "52.0.0",
34
+ "autotel": "7.2.0",
35
+ "autotel-web": "1.13.2"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@opentelemetry/context-async-hooks": "^2.10.0",
@@ -46,9 +46,9 @@
46
46
  "tsdown": "^0.22.14",
47
47
  "typescript": "^6.0.3",
48
48
  "vitest": "^4.1.10",
49
- "autotel": "7.1.0",
50
- "autotel-web": "1.13.1",
51
- "autotel-subscribers": "51.0.0"
49
+ "autotel": "7.2.0",
50
+ "autotel-web": "1.13.2",
51
+ "autotel-subscribers": "52.0.0"
52
52
  },
53
53
  "keywords": [
54
54
  "opentelemetry",