posthog-react-native 2.0.0-alpha10 → 2.0.0-alpha13
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/lib/index.cjs.js +115 -89
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.d.ts +10 -4
- package/lib/index.esm.js +114 -89
- package/lib/index.esm.js.map +1 -1
- package/lib/posthog-core/src/index.d.ts +2 -2
- package/lib/posthog-core/src/storage-memory.d.ts +6 -0
- package/lib/posthog-core/src/types.d.ts +2 -1
- package/lib/posthog-core/src/utils.d.ts +0 -1
- package/lib/posthog-react-native/src/optional-imports.d.ts +0 -4
- package/lib/posthog-react-native/src/posthog-rn.d.ts +5 -1
- package/lib/posthog-react-native/src/types.d.ts +1 -0
- package/package.json +6 -14
|
@@ -15,8 +15,6 @@ export declare abstract class PostHogCore {
|
|
|
15
15
|
protected _events: SimpleEventEmitter;
|
|
16
16
|
protected _flushTimer?: any;
|
|
17
17
|
protected _decideResponsePromise?: Promise<PostHogDecideResponse>;
|
|
18
|
-
protected _decideTimer?: any;
|
|
19
|
-
protected _decidePollInterval: number;
|
|
20
18
|
protected _retryOptions: RetriableOptions;
|
|
21
19
|
protected _sessionExpirationTimeSeconds: number;
|
|
22
20
|
abstract fetch(url: string, options: PostHogFetchOptions): Promise<PostHogFetchResponse>;
|
|
@@ -40,6 +38,7 @@ export declare abstract class PostHogCore {
|
|
|
40
38
|
private buildPayload;
|
|
41
39
|
getSessionId(): string | undefined;
|
|
42
40
|
resetSessionId(): void;
|
|
41
|
+
getAnonymousId(): string;
|
|
43
42
|
getDistinctId(): string;
|
|
44
43
|
register(properties: {
|
|
45
44
|
[key: string]: any;
|
|
@@ -72,6 +71,7 @@ export declare abstract class PostHogCore {
|
|
|
72
71
|
isFeatureEnabled(key: string, defaultResult?: boolean): boolean;
|
|
73
72
|
reloadFeatureFlagsAsync(): Promise<PostHogDecideResponse['featureFlags']>;
|
|
74
73
|
onFeatureFlags(cb: (flags: PostHogDecideResponse['featureFlags']) => void): () => void;
|
|
74
|
+
onFeatureFlag(key: string, cb: (value: string | boolean) => void): () => void;
|
|
75
75
|
overrideFeatureFlag(flags: PostHogDecideResponse['featureFlags'] | null): void;
|
|
76
76
|
/***
|
|
77
77
|
*** QUEUEING AND FLUSHING
|
|
@@ -5,13 +5,13 @@ export declare type PosthogCoreOptions = {
|
|
|
5
5
|
enable?: boolean;
|
|
6
6
|
sendFeatureFlagEvent?: boolean;
|
|
7
7
|
preloadFeatureFlags?: boolean;
|
|
8
|
-
decidePollInterval?: number;
|
|
9
8
|
fetchRetryCount?: number;
|
|
10
9
|
fetchRetryDelay?: number;
|
|
11
10
|
sessionExpirationTimeSeconds?: number;
|
|
12
11
|
captureMode?: 'json' | 'form';
|
|
13
12
|
};
|
|
14
13
|
export declare enum PostHogPersistedProperty {
|
|
14
|
+
AnonymousId = "anonymous_id",
|
|
15
15
|
DistinctId = "distinct_id",
|
|
16
16
|
Props = "props",
|
|
17
17
|
FeatureFlags = "feature_flags",
|
|
@@ -33,6 +33,7 @@ export declare type PostHogFetchOptions = {
|
|
|
33
33
|
export declare type PostHogFetchResponse = {
|
|
34
34
|
status: number;
|
|
35
35
|
text: () => Promise<string>;
|
|
36
|
+
json: () => Promise<any>;
|
|
36
37
|
};
|
|
37
38
|
export declare type PostHogQueueItem = {
|
|
38
39
|
message: any;
|
|
@@ -9,5 +9,4 @@ export declare function retriable<T>(fn: () => Promise<T>, props?: RetriableOpti
|
|
|
9
9
|
export declare function generateUUID(globalThis?: any): string;
|
|
10
10
|
export declare function currentTimestamp(): number;
|
|
11
11
|
export declare function currentISOTime(): string;
|
|
12
|
-
export declare function isUndefined(obj: any): boolean;
|
|
13
12
|
export declare function safeSetTimeout(fn: () => void, timeout: number): any;
|
|
@@ -1,6 +1,2 @@
|
|
|
1
1
|
import type ReactNativeNavigation from '@react-navigation/native';
|
|
2
|
-
import type * as ExpoLocalization from 'expo-localization';
|
|
3
|
-
import type * as ExpoNetwork from 'expo-network';
|
|
4
2
|
export declare const OptionalReactNativeNavigation: typeof ReactNativeNavigation | undefined;
|
|
5
|
-
export declare const OptionalExpoLocalization: typeof ExpoLocalization | undefined;
|
|
6
|
-
export declare const OptionalExpoNetwork: typeof ExpoNetwork | undefined;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { PostHogCore, PosthogCoreOptions, PostHogFetchOptions, PostHogFetchResponse, PostHogPersistedProperty } from '../../posthog-core/src';
|
|
2
|
-
export declare type PostHogOptions = PosthogCoreOptions
|
|
2
|
+
export declare type PostHogOptions = PosthogCoreOptions & {
|
|
3
|
+
persistence?: 'memory' | 'file';
|
|
4
|
+
};
|
|
3
5
|
export declare class PostHog extends PostHogCore {
|
|
6
|
+
private _persistence;
|
|
7
|
+
private _memoryStorage;
|
|
4
8
|
static initAsync(): Promise<void>;
|
|
5
9
|
constructor(apiKey: string, options?: PostHogOptions);
|
|
6
10
|
getPersistedProperty<T>(key: PostHogPersistedProperty): T | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "posthog-react-native",
|
|
3
|
-
"version": "2.0.0-
|
|
3
|
+
"version": "2.0.0-alpha13",
|
|
4
4
|
"main": "lib/index.cjs.js",
|
|
5
5
|
"module": "lib/index.esm.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -20,27 +20,19 @@
|
|
|
20
20
|
"expo-device": "^4.0.0",
|
|
21
21
|
"expo-file-system": "^13.0.0",
|
|
22
22
|
"expo-localization": "~11.0.0",
|
|
23
|
-
"expo-network": "^4.2.0",
|
|
24
23
|
"react": "^18.2.0",
|
|
25
24
|
"react-native": "^0.69.1"
|
|
26
25
|
},
|
|
27
26
|
"peerDependencies": {
|
|
28
|
-
"@react-navigation/native": "
|
|
29
|
-
"expo-localization": "
|
|
30
|
-
"expo-
|
|
31
|
-
"expo-
|
|
32
|
-
"expo-
|
|
33
|
-
"expo-device": "^4.0.0"
|
|
27
|
+
"@react-navigation/native": ">= 5.0.10",
|
|
28
|
+
"expo-localization": ">= 11.0.0",
|
|
29
|
+
"expo-file-system": ">= 13.0.0",
|
|
30
|
+
"expo-application": ">= 4.0.0",
|
|
31
|
+
"expo-device": ">= 4.0.0"
|
|
34
32
|
},
|
|
35
33
|
"peerDependenciesMeta": {
|
|
36
34
|
"@react-navigation/native": {
|
|
37
35
|
"optional": true
|
|
38
|
-
},
|
|
39
|
-
"expo-localization": {
|
|
40
|
-
"optional": true
|
|
41
|
-
},
|
|
42
|
-
"expo-network": {
|
|
43
|
-
"optional": true
|
|
44
36
|
}
|
|
45
37
|
}
|
|
46
38
|
}
|