posthog-js-lite 2.5.0 → 2.6.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/CHANGELOG.md +8 -0
- package/lib/index.cjs.js +431 -38
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.d.ts +16 -12
- package/lib/index.esm.js +431 -38
- package/lib/index.esm.js.map +1 -1
- package/lib/posthog-core/src/index.d.ts +13 -12
- package/lib/posthog-core/src/types.d.ts +4 -1
- package/lib/posthog-core/src/utils.d.ts +0 -1
- package/package.json +6 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PostHogFetchOptions, PostHogFetchResponse, PostHogAutocaptureElement, PostHogDecideResponse, PosthogCoreOptions, PostHogEventProperties, PostHogPersistedProperty,
|
|
1
|
+
import { PostHogFetchOptions, PostHogFetchResponse, PostHogAutocaptureElement, PostHogDecideResponse, PosthogCoreOptions, PostHogEventProperties, PostHogPersistedProperty, PostHogCaptureOptions, JsonType } from './types';
|
|
2
2
|
import { RetriableOptions } from './utils';
|
|
3
3
|
export * as utils from './utils';
|
|
4
4
|
import { LZString } from './lz-string';
|
|
@@ -12,9 +12,9 @@ export declare abstract class PostHogCoreStateless {
|
|
|
12
12
|
private captureMode;
|
|
13
13
|
private removeDebugCallback?;
|
|
14
14
|
private debugMode;
|
|
15
|
-
private pendingPromises;
|
|
16
15
|
private disableGeoip;
|
|
17
16
|
private _optoutOverride;
|
|
17
|
+
private pendingPromises;
|
|
18
18
|
protected _events: SimpleEventEmitter;
|
|
19
19
|
protected _flushTimer?: any;
|
|
20
20
|
protected _retryOptions: RetriableOptions;
|
|
@@ -32,20 +32,21 @@ export declare abstract class PostHogCoreStateless {
|
|
|
32
32
|
on(event: string, cb: (...args: any[]) => void): () => void;
|
|
33
33
|
debug(enabled?: boolean): void;
|
|
34
34
|
private buildPayload;
|
|
35
|
+
protected addPendingPromise(promise: Promise<any>): void;
|
|
35
36
|
/***
|
|
36
37
|
*** TRACKING
|
|
37
38
|
***/
|
|
38
|
-
protected identifyStateless(distinctId: string, properties?: PostHogEventProperties, options?:
|
|
39
|
+
protected identifyStateless(distinctId: string, properties?: PostHogEventProperties, options?: PostHogCaptureOptions): this;
|
|
39
40
|
protected captureStateless(distinctId: string, event: string, properties?: {
|
|
40
41
|
[key: string]: any;
|
|
41
|
-
}, options?:
|
|
42
|
+
}, options?: PostHogCaptureOptions): this;
|
|
42
43
|
protected aliasStateless(alias: string, distinctId: string, properties?: {
|
|
43
44
|
[key: string]: any;
|
|
44
|
-
}, options?:
|
|
45
|
+
}, options?: PostHogCaptureOptions): this;
|
|
45
46
|
/***
|
|
46
47
|
*** GROUPS
|
|
47
48
|
***/
|
|
48
|
-
protected groupIdentifyStateless(groupType: string, groupKey: string | number, groupProperties?: PostHogEventProperties, options?:
|
|
49
|
+
protected groupIdentifyStateless(groupType: string, groupKey: string | number, groupProperties?: PostHogEventProperties, options?: PostHogCaptureOptions, distinctId?: string, eventProperties?: PostHogEventProperties): this;
|
|
49
50
|
/***
|
|
50
51
|
*** FEATURE FLAGS
|
|
51
52
|
***/
|
|
@@ -62,7 +63,7 @@ export declare abstract class PostHogCoreStateless {
|
|
|
62
63
|
/***
|
|
63
64
|
*** QUEUEING AND FLUSHING
|
|
64
65
|
***/
|
|
65
|
-
protected enqueue(type: string, _message: any, options?:
|
|
66
|
+
protected enqueue(type: string, _message: any, options?: PostHogCaptureOptions): void;
|
|
66
67
|
flushAsync(): Promise<any>;
|
|
67
68
|
flush(callback?: (err?: any, data?: any) => void): void;
|
|
68
69
|
private fetchWithRetry;
|
|
@@ -100,20 +101,20 @@ export declare abstract class PostHogCore extends PostHogCoreStateless {
|
|
|
100
101
|
/***
|
|
101
102
|
*** TRACKING
|
|
102
103
|
***/
|
|
103
|
-
identify(distinctId?: string, properties?: PostHogEventProperties, options?:
|
|
104
|
+
identify(distinctId?: string, properties?: PostHogEventProperties, options?: PostHogCaptureOptions): this;
|
|
104
105
|
capture(event: string, properties?: {
|
|
105
106
|
[key: string]: any;
|
|
106
|
-
}, options?:
|
|
107
|
+
}, options?: PostHogCaptureOptions): this;
|
|
107
108
|
alias(alias: string): this;
|
|
108
|
-
autocapture(eventType: string, elements: PostHogAutocaptureElement[], properties?: PostHogEventProperties, options?:
|
|
109
|
+
autocapture(eventType: string, elements: PostHogAutocaptureElement[], properties?: PostHogEventProperties, options?: PostHogCaptureOptions): this;
|
|
109
110
|
/***
|
|
110
111
|
*** GROUPS
|
|
111
112
|
***/
|
|
112
113
|
groups(groups: {
|
|
113
114
|
[type: string]: string | number;
|
|
114
115
|
}): this;
|
|
115
|
-
group(groupType: string, groupKey: string | number, groupProperties?: PostHogEventProperties, options?:
|
|
116
|
-
groupIdentify(groupType: string, groupKey: string | number, groupProperties?: PostHogEventProperties, options?:
|
|
116
|
+
group(groupType: string, groupKey: string | number, groupProperties?: PostHogEventProperties, options?: PostHogCaptureOptions): this;
|
|
117
|
+
groupIdentify(groupType: string, groupKey: string | number, groupProperties?: PostHogEventProperties, options?: PostHogCaptureOptions): this;
|
|
117
118
|
/***
|
|
118
119
|
* PROPERTIES
|
|
119
120
|
***/
|
|
@@ -44,7 +44,10 @@ export declare type PostHogFetchOptions = {
|
|
|
44
44
|
body?: string;
|
|
45
45
|
signal?: AbortSignal;
|
|
46
46
|
};
|
|
47
|
-
export declare type
|
|
47
|
+
export declare type PostHogCaptureOptions = {
|
|
48
|
+
/** If provided overrides the auto-generated event ID */
|
|
49
|
+
uuid?: string;
|
|
50
|
+
/** If provided overrides the auto-generated timestamp */
|
|
48
51
|
timestamp?: Date;
|
|
49
52
|
disableGeoip?: boolean;
|
|
50
53
|
};
|
|
@@ -6,7 +6,6 @@ export interface RetriableOptions {
|
|
|
6
6
|
retryCheck?: (err: any) => boolean;
|
|
7
7
|
}
|
|
8
8
|
export declare function retriable<T>(fn: () => Promise<T>, props?: RetriableOptions): Promise<T>;
|
|
9
|
-
export declare function generateUUID(globalThis?: any): string;
|
|
10
9
|
export declare function currentTimestamp(): number;
|
|
11
10
|
export declare function currentISOTime(): string;
|
|
12
11
|
export declare function safeSetTimeout(fn: () => void, timeout: number): any;
|
package/package.json
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "posthog-js-lite",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.6.1",
|
|
4
4
|
"main": "lib/index.cjs.js",
|
|
5
5
|
"module": "lib/index.esm.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/PostHog/posthog-js-lite.git",
|
|
10
|
+
"directory": "posthog-web"
|
|
11
|
+
},
|
|
7
12
|
"scripts": {
|
|
8
13
|
"test": "jest -c jest.config.js",
|
|
9
14
|
"prepublishOnly": "cd .. && yarn build"
|