posthog-node 2.5.1 → 2.5.3
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/CHANGELOG.md +10 -0
- package/lib/index.cjs.js +19 -7
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.d.ts +2 -1
- package/lib/index.esm.js +19 -7
- package/lib/index.esm.js.map +1 -1
- package/lib/posthog-node/src/posthog-node.d.ts +1 -1
- package/lib/posthog-node/src/types.d.ts +1 -0
- package/package.json +1 -1
- package/src/posthog-node.ts +13 -5
- package/src/types.ts +1 -0
- package/test/posthog-node.spec.ts +45 -2
package/lib/index.d.ts
CHANGED
|
@@ -174,6 +174,7 @@ interface GroupIdentifyMessage {
|
|
|
174
174
|
groupType: string;
|
|
175
175
|
groupKey: string;
|
|
176
176
|
properties?: Record<string | number, any>;
|
|
177
|
+
distinctId?: string;
|
|
177
178
|
}
|
|
178
179
|
declare type PostHogNodeV1 = {
|
|
179
180
|
/**
|
|
@@ -357,7 +358,7 @@ declare class PostHog extends PostHogCoreStateless implements PostHogNodeV1 {
|
|
|
357
358
|
groupProperties?: Record<string, Record<string, string>>;
|
|
358
359
|
onlyEvaluateLocally?: boolean;
|
|
359
360
|
}): Promise<PosthogFlagsAndPayloadsResponse>;
|
|
360
|
-
groupIdentify({ groupType, groupKey, properties }: GroupIdentifyMessage): void;
|
|
361
|
+
groupIdentify({ groupType, groupKey, properties, distinctId }: GroupIdentifyMessage): void;
|
|
361
362
|
reloadFeatureFlags(): Promise<void>;
|
|
362
363
|
shutdown(): void;
|
|
363
364
|
shutdownAsync(): Promise<void>;
|
package/lib/index.esm.js
CHANGED
|
@@ -155,7 +155,7 @@ function __spreadArray(to, from, pack) {
|
|
|
155
155
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
156
156
|
}
|
|
157
157
|
|
|
158
|
-
var version = "2.5.
|
|
158
|
+
var version = "2.5.3";
|
|
159
159
|
|
|
160
160
|
var PostHogPersistedProperty;
|
|
161
161
|
(function (PostHogPersistedProperty) {
|
|
@@ -2347,12 +2347,19 @@ function (_super) {
|
|
|
2347
2347
|
var _b = _a[_i],
|
|
2348
2348
|
feature = _b[0],
|
|
2349
2349
|
variant = _b[1];
|
|
2350
|
-
|
|
2350
|
+
|
|
2351
|
+
if (variant !== false) {
|
|
2352
|
+
featureVariantProperties["$feature/".concat(feature)] = variant;
|
|
2353
|
+
}
|
|
2351
2354
|
}
|
|
2352
2355
|
}
|
|
2353
2356
|
|
|
2357
|
+
var activeFlags = Object.keys(flags || {}).filter(function (flag) {
|
|
2358
|
+
return (flags === null || flags === void 0 ? void 0 : flags[flag]) !== false;
|
|
2359
|
+
});
|
|
2360
|
+
|
|
2354
2361
|
var flagProperties = __assign({
|
|
2355
|
-
$active_feature_flags:
|
|
2362
|
+
$active_feature_flags: activeFlags || undefined
|
|
2356
2363
|
}, featureVariantProperties);
|
|
2357
2364
|
|
|
2358
2365
|
_capture(__assign(__assign(__assign({}, properties), {
|
|
@@ -2368,9 +2375,13 @@ function (_super) {
|
|
|
2368
2375
|
|
|
2369
2376
|
PostHog.prototype.identify = function (_a) {
|
|
2370
2377
|
var distinctId = _a.distinctId,
|
|
2371
|
-
properties = _a.properties;
|
|
2378
|
+
properties = _a.properties; // Catch properties passed as $set and move them to the top level
|
|
2372
2379
|
|
|
2373
|
-
|
|
2380
|
+
var personProperties = (properties === null || properties === void 0 ? void 0 : properties.$set) || properties;
|
|
2381
|
+
|
|
2382
|
+
_super.prototype.identifyStateless.call(this, distinctId, {
|
|
2383
|
+
$set: personProperties
|
|
2384
|
+
});
|
|
2374
2385
|
};
|
|
2375
2386
|
|
|
2376
2387
|
PostHog.prototype.alias = function (data) {
|
|
@@ -2635,9 +2646,10 @@ function (_super) {
|
|
|
2635
2646
|
PostHog.prototype.groupIdentify = function (_a) {
|
|
2636
2647
|
var groupType = _a.groupType,
|
|
2637
2648
|
groupKey = _a.groupKey,
|
|
2638
|
-
properties = _a.properties
|
|
2649
|
+
properties = _a.properties,
|
|
2650
|
+
distinctId = _a.distinctId;
|
|
2639
2651
|
|
|
2640
|
-
_super.prototype.groupIdentifyStateless.call(this, groupType, groupKey, properties);
|
|
2652
|
+
_super.prototype.groupIdentifyStateless.call(this, groupType, groupKey, properties, undefined, distinctId);
|
|
2641
2653
|
};
|
|
2642
2654
|
|
|
2643
2655
|
PostHog.prototype.reloadFeatureFlags = function () {
|