posthog-react-native 2.1.3 → 2.2.0-alpha1
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 +19 -0
- package/lib/index.cjs.js +298 -155
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.d.ts +58 -17
- package/lib/index.esm.js +298 -133
- package/lib/index.esm.js.map +1 -1
- package/lib/node_modules/tslib/tslib.es6.d.ts +35 -0
- package/lib/posthog-core/src/index.d.ts +2 -0
- package/lib/posthog-core/src/types.d.ts +7 -1
- package/lib/posthog-react-native/src/native-deps.d.ts +3 -0
- package/lib/posthog-react-native/src/optional/OptionalAsyncStorage.d.ts +1 -0
- package/lib/posthog-react-native/src/optional/OptionalExpoApplication.d.ts +2 -0
- package/lib/posthog-react-native/src/optional/OptionalExpoDevice.d.ts +2 -0
- package/lib/posthog-react-native/src/optional/OptionalExpoFileSystem.d.ts +2 -0
- package/lib/posthog-react-native/src/optional/OptionalExpoLocalization.d.ts +2 -0
- package/lib/posthog-react-native/src/optional/OptionalReactNativeDeviceInfo.d.ts +1 -0
- package/lib/posthog-react-native/src/{optional-imports.d.ts → optional/OptionalReactNativeNavigation.d.ts} +0 -0
- package/lib/posthog-react-native/src/optional/warning.d.ts +1 -0
- package/lib/posthog-react-native/src/posthog-rn.d.ts +7 -1
- package/lib/posthog-react-native/src/storage.d.ts +14 -8
- package/lib/posthog-react-native/src/types.d.ts +28 -0
- package/package.json +26 -5
- package/lib/posthog-react-native/src/posthog.d.ts +0 -14
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export function __extends(d: any, b: any): void;
|
|
2
|
+
export function __rest(s: any, e: any): {};
|
|
3
|
+
export function __decorate(decorators: any, target: any, key: any, desc: any, ...args: any[]): any;
|
|
4
|
+
export function __param(paramIndex: any, decorator: any): (target: any, key: any) => void;
|
|
5
|
+
export function __metadata(metadataKey: any, metadataValue: any): any;
|
|
6
|
+
export function __awaiter(thisArg: any, _arguments: any, P: any, generator: any): any;
|
|
7
|
+
export function __generator(thisArg: any, body: any): {
|
|
8
|
+
next: (v: any) => any;
|
|
9
|
+
throw: (v: any) => any;
|
|
10
|
+
return: (v: any) => any;
|
|
11
|
+
};
|
|
12
|
+
export function __exportStar(m: any, o: any): void;
|
|
13
|
+
export function __values(o: any): any;
|
|
14
|
+
export function __read(o: any, n: any): any;
|
|
15
|
+
/** @deprecated */
|
|
16
|
+
export function __spread(...args: any[]): any[];
|
|
17
|
+
/** @deprecated */
|
|
18
|
+
export function __spreadArrays(...args: any[]): any[];
|
|
19
|
+
export function __spreadArray(to: any, from: any, pack: any, ...args: any[]): any;
|
|
20
|
+
export function __await(v: any): __await;
|
|
21
|
+
export class __await {
|
|
22
|
+
constructor(v: any);
|
|
23
|
+
v: any;
|
|
24
|
+
}
|
|
25
|
+
export function __asyncGenerator(thisArg: any, _arguments: any, generator: any): {};
|
|
26
|
+
export function __asyncDelegator(o: any): {};
|
|
27
|
+
export function __asyncValues(o: any): any;
|
|
28
|
+
export function __makeTemplateObject(cooked: any, raw: any): any;
|
|
29
|
+
export function __importStar(mod: any): any;
|
|
30
|
+
export function __importDefault(mod: any): any;
|
|
31
|
+
export function __classPrivateFieldGet(receiver: any, state: any, kind: any, f: any): any;
|
|
32
|
+
export function __classPrivateFieldSet(receiver: any, state: any, value: any, kind: any, f: any): any;
|
|
33
|
+
export function __classPrivateFieldIn(state: any, receiver: any): any;
|
|
34
|
+
export function __assign(...args: any[]): any;
|
|
35
|
+
export function __createBinding(o: any, m: any, k: any, k2: any): void;
|
|
@@ -26,6 +26,7 @@ export declare abstract class PostHogCore {
|
|
|
26
26
|
private _optoutOverride;
|
|
27
27
|
constructor(apiKey: string, options?: PosthogCoreOptions);
|
|
28
28
|
protected getCommonEventProperties(): any;
|
|
29
|
+
protected setupBootstrap(options?: Partial<PosthogCoreOptions>): void;
|
|
29
30
|
private get props();
|
|
30
31
|
private set props(value);
|
|
31
32
|
private clearProps;
|
|
@@ -76,6 +77,7 @@ export declare abstract class PostHogCore {
|
|
|
76
77
|
***/
|
|
77
78
|
private decideAsync;
|
|
78
79
|
private _decideAsync;
|
|
80
|
+
private setKnownFeatureFlags;
|
|
79
81
|
getFeatureFlag(key: string): boolean | string | undefined;
|
|
80
82
|
getFeatureFlags(): PostHogDecideResponse['featureFlags'] | undefined;
|
|
81
83
|
isFeatureEnabled(key: string): boolean | undefined;
|
|
@@ -5,6 +5,11 @@ export declare type PosthogCoreOptions = {
|
|
|
5
5
|
enable?: boolean;
|
|
6
6
|
sendFeatureFlagEvent?: boolean;
|
|
7
7
|
preloadFeatureFlags?: boolean;
|
|
8
|
+
bootstrap?: {
|
|
9
|
+
distinctId?: string;
|
|
10
|
+
isIdentifiedId?: boolean;
|
|
11
|
+
featureFlags?: Record<string, boolean | string>;
|
|
12
|
+
};
|
|
8
13
|
fetchRetryCount?: number;
|
|
9
14
|
fetchRetryDelay?: number;
|
|
10
15
|
sessionExpirationTimeSeconds?: number;
|
|
@@ -30,7 +35,8 @@ export declare type PostHogFetchOptions = {
|
|
|
30
35
|
headers: {
|
|
31
36
|
[key: string]: string;
|
|
32
37
|
};
|
|
33
|
-
body
|
|
38
|
+
body?: string;
|
|
39
|
+
signal?: AbortSignal;
|
|
34
40
|
};
|
|
35
41
|
export declare type PostHogFetchResponse = {
|
|
36
42
|
status: number;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const OptionalAsyncStorage: import("@react-native-async-storage/async-storage").AsyncStorageStatic | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const OptionalReactNativeDeviceInfo: import("react-native-device-info/lib/typescript/internal/privateTypes").DeviceInfoModule | undefined;
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const warn: (name: string) => void;
|
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
import { PostHogCore, PosthogCoreOptions, PostHogFetchOptions, PostHogFetchResponse, PostHogPersistedProperty } from '../../posthog-core/src';
|
|
2
|
+
import { PostHogCustomAppProperties, PostHogCustomAsyncStorage } from './types';
|
|
2
3
|
export declare type PostHogOptions = PosthogCoreOptions & {
|
|
3
4
|
persistence?: 'memory' | 'file';
|
|
5
|
+
customAppProperties?: PostHogCustomAppProperties;
|
|
6
|
+
customAsyncStorage?: PostHogCustomAsyncStorage;
|
|
4
7
|
};
|
|
5
8
|
export declare class PostHog extends PostHogCore {
|
|
6
9
|
private _persistence;
|
|
7
10
|
private _memoryStorage;
|
|
8
|
-
|
|
11
|
+
private _semiAsyncStorage;
|
|
12
|
+
private _appProperties;
|
|
9
13
|
constructor(apiKey: string, options?: PostHogOptions);
|
|
14
|
+
/** Await this method to ensure that all state has been loaded from the async provider */
|
|
15
|
+
initAsync(): Promise<void>;
|
|
10
16
|
getPersistedProperty<T>(key: PostHogPersistedProperty): T | undefined;
|
|
11
17
|
setPersistedProperty<T>(key: PostHogPersistedProperty, value: T | null): void;
|
|
12
18
|
fetch(url: string, options: PostHogFetchOptions): Promise<PostHogFetchResponse>;
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { PostHogCustomAsyncStorage } from './types';
|
|
2
|
+
export declare class SemiAsyncStorage {
|
|
3
|
+
private _memoryCache;
|
|
4
|
+
private _preloadSemiAsyncStoragePromise;
|
|
5
|
+
private _asyncStorage;
|
|
6
|
+
constructor(asyncStorage: PostHogCustomAsyncStorage);
|
|
7
|
+
preloadAsync(): Promise<void>;
|
|
8
|
+
persist(): void;
|
|
9
|
+
getItem(key: string): any | null | undefined;
|
|
10
|
+
setItem(key: string, value: any): void;
|
|
11
|
+
removeItem(key: string): void;
|
|
12
|
+
clear(): void;
|
|
13
|
+
getAllKeys(): readonly string[];
|
|
14
|
+
}
|
|
@@ -9,5 +9,33 @@ export declare type PostHogAutocaptureOptions = {
|
|
|
9
9
|
maxElementsCaptured?: number;
|
|
10
10
|
ignoreLabels?: string[];
|
|
11
11
|
propsToCapture?: string[];
|
|
12
|
+
captureScreens?: boolean;
|
|
12
13
|
navigation?: PostHogAutocaptureNavigationTrackerOptions;
|
|
14
|
+
captureLifecycleEvents?: boolean;
|
|
13
15
|
};
|
|
16
|
+
export interface PostHogCustomAppProperties {
|
|
17
|
+
/** Build number like "1.2.2" or "122" */
|
|
18
|
+
$app_build?: string | null;
|
|
19
|
+
/** Name of the app as displayed below the icon like "PostHog" */
|
|
20
|
+
$app_name?: string | null;
|
|
21
|
+
/** Namespace of the app usually like "com.posthog.app" */
|
|
22
|
+
$app_namespace?: string | null;
|
|
23
|
+
/** Human friendly app version like what a user would see in the app store like "1.2.2" */
|
|
24
|
+
$app_version?: string | null;
|
|
25
|
+
/** Manufacturer like "Apple", "Samsung" or "Android" */
|
|
26
|
+
$device_manufacturer?: string | null;
|
|
27
|
+
/** Readable model name like "iPhone 12" */
|
|
28
|
+
$device_name?: string | null;
|
|
29
|
+
/** Operating system name like iOS or Android */
|
|
30
|
+
$os_name?: string | null;
|
|
31
|
+
/** Operating system version "14.0" */
|
|
32
|
+
$os_version?: string | null;
|
|
33
|
+
/** Locale (language) of the device like "en-US" */
|
|
34
|
+
$locale?: string | null;
|
|
35
|
+
/** Timezone of the device like "Europe/Berlin" */
|
|
36
|
+
$timezone?: string | null;
|
|
37
|
+
}
|
|
38
|
+
export interface PostHogCustomAsyncStorage {
|
|
39
|
+
getItem: (key: string) => Promise<string | null>;
|
|
40
|
+
setItem: (key: string, value: string) => Promise<void>;
|
|
41
|
+
}
|
package/package.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "posthog-react-native",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0-alpha1",
|
|
4
4
|
"main": "lib/index.cjs.js",
|
|
5
5
|
"module": "lib/index.esm.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
7
7
|
"files": [
|
|
8
8
|
"lib/"
|
|
9
9
|
],
|
|
10
|
-
"dependencies": {},
|
|
11
10
|
"scripts": {
|
|
12
11
|
"test": "jest -c jest.config.js",
|
|
13
|
-
"
|
|
12
|
+
"prepublishOnly": "cd .. && yarn build"
|
|
14
13
|
},
|
|
15
14
|
"devDependencies": {
|
|
15
|
+
"@react-native-async-storage/async-storage": "^1.17.10",
|
|
16
16
|
"@react-navigation/native": "^5.0.10",
|
|
17
17
|
"@types/react-native": "^0.69.1",
|
|
18
18
|
"expo": "^45.0.6",
|
|
@@ -22,18 +22,39 @@
|
|
|
22
22
|
"expo-localization": "~11.0.0",
|
|
23
23
|
"jest-expo": "^46.0.1",
|
|
24
24
|
"react": "^18.2.0",
|
|
25
|
-
"react-native": "^0.69.1"
|
|
25
|
+
"react-native": "^0.69.1",
|
|
26
|
+
"react-native-device-info": "^10.3.0"
|
|
26
27
|
},
|
|
27
28
|
"peerDependencies": {
|
|
29
|
+
"@react-native-async-storage/async-storage": "^>=1.0.0",
|
|
28
30
|
"@react-navigation/native": ">= 5.0.10",
|
|
29
31
|
"expo-application": ">= 4.0.0",
|
|
30
32
|
"expo-device": ">= 4.0.0",
|
|
31
33
|
"expo-file-system": ">= 13.0.0",
|
|
32
|
-
"expo-localization": ">= 11.0.0"
|
|
34
|
+
"expo-localization": ">= 11.0.0",
|
|
35
|
+
"react-native-device-info": ">= 10.0.0"
|
|
33
36
|
},
|
|
34
37
|
"peerDependenciesMeta": {
|
|
38
|
+
"@react-native-async-storage/async-storage": {
|
|
39
|
+
"optional": true
|
|
40
|
+
},
|
|
35
41
|
"@react-navigation/native": {
|
|
36
42
|
"optional": true
|
|
43
|
+
},
|
|
44
|
+
"expo-application": {
|
|
45
|
+
"optional": true
|
|
46
|
+
},
|
|
47
|
+
"expo-device": {
|
|
48
|
+
"optional": true
|
|
49
|
+
},
|
|
50
|
+
"expo-file-system": {
|
|
51
|
+
"optional": true
|
|
52
|
+
},
|
|
53
|
+
"expo-localization": {
|
|
54
|
+
"optional": true
|
|
55
|
+
},
|
|
56
|
+
"react-native-device-info": {
|
|
57
|
+
"optional": true
|
|
37
58
|
}
|
|
38
59
|
}
|
|
39
60
|
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { PostHogCore, PosthogCoreOptions, PostHogFetchOptions, PostHogFetchResponse, PostHogPersistedProperty } from 'posthog-core';
|
|
2
|
-
export interface PostHogReactNativeOptions extends PosthogCoreOptions {
|
|
3
|
-
}
|
|
4
|
-
export declare class PostHogReactNative extends PostHogCore {
|
|
5
|
-
constructor(apiKey: string, options?: PostHogReactNativeOptions);
|
|
6
|
-
getPersistedProperty<T>(key: PostHogPersistedProperty): T | undefined;
|
|
7
|
-
setPersistedProperty<T>(key: PostHogPersistedProperty, value: T | null): void;
|
|
8
|
-
fetch(url: string, options: PostHogFetchOptions): Promise<PostHogFetchResponse>;
|
|
9
|
-
getLibraryId(): string;
|
|
10
|
-
getLibraryVersion(): string;
|
|
11
|
-
getCustomUserAgent(): void;
|
|
12
|
-
getCommonEventProperties(): any;
|
|
13
|
-
screen(name: string, properties?: any): void;
|
|
14
|
-
}
|