posthog-react-native 2.1.4 → 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.
@@ -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;
@@ -0,0 +1,3 @@
1
+ import { PostHogCustomAppProperties, PostHogCustomAsyncStorage } from './types';
2
+ export declare const getAppProperties: () => PostHogCustomAppProperties;
3
+ export declare const buildOptimisiticAsyncStorage: () => PostHogCustomAsyncStorage;
@@ -0,0 +1 @@
1
+ export declare const OptionalAsyncStorage: import("@react-native-async-storage/async-storage").AsyncStorageStatic | undefined;
@@ -0,0 +1,2 @@
1
+ import type ExpoApplication from 'expo-application';
2
+ export declare const OptionalExpoApplication: typeof ExpoApplication | undefined;
@@ -0,0 +1,2 @@
1
+ import type ExpoDevice from 'expo-device';
2
+ export declare const OptionalExpoDevice: typeof ExpoDevice | undefined;
@@ -0,0 +1,2 @@
1
+ import type ExpoFileSystem from 'expo-file-system';
2
+ export declare const OptionalExpoFileSystem: typeof ExpoFileSystem | undefined;
@@ -0,0 +1,2 @@
1
+ import type ExpoLocalization from 'expo-localization';
2
+ export declare const OptionalExpoLocalization: typeof ExpoLocalization | undefined;
@@ -0,0 +1 @@
1
+ export declare const OptionalReactNativeDeviceInfo: import("react-native-device-info/lib/typescript/internal/privateTypes").DeviceInfoModule | undefined;
@@ -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
- static initAsync(): Promise<void>;
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
- export declare const SemiAsyncStorage: {
2
- getItem: (key: string) => any | null | undefined;
3
- setItem: (key: string, value: any) => void;
4
- removeItem: (key: string) => void;
5
- clear: () => void;
6
- getAllKeys: () => readonly string[];
7
- };
8
- export declare const preloadSemiAsyncStorage: () => Promise<void>;
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
+ }
@@ -13,3 +13,29 @@ export declare type PostHogAutocaptureOptions = {
13
13
  navigation?: PostHogAutocaptureNavigationTrackerOptions;
14
14
  captureLifecycleEvents?: boolean;
15
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.1.4",
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
- }