posthog-react-native 2.0.0 → 2.1.0

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.
@@ -5,7 +5,7 @@ import { LZString } from './lz-string';
5
5
  import { SimpleEventEmitter } from './eventemitter';
6
6
  export declare abstract class PostHogCore {
7
7
  private apiKey;
8
- private host;
8
+ host: string;
9
9
  private flushAt;
10
10
  private flushInterval;
11
11
  private captureMode;
@@ -28,12 +28,13 @@ export declare abstract class PostHogCore {
28
28
  protected getCommonEventProperties(): any;
29
29
  private get props();
30
30
  private set props(value);
31
+ private clearProps;
31
32
  private _props;
32
33
  get optedOut(): boolean;
33
34
  optIn(): void;
34
35
  optOut(): void;
35
36
  on(event: string, cb: (...args: any[]) => void): () => void;
36
- reset(): void;
37
+ reset(propertiesToKeep?: PostHogPersistedProperty[]): void;
37
38
  debug(enabled?: boolean): void;
38
39
  private buildPayload;
39
40
  getSessionId(): string | undefined;
@@ -50,7 +51,7 @@ export declare abstract class PostHogCore {
50
51
  identify(distinctId?: string, properties?: PostHogEventProperties): this;
51
52
  capture(event: string, properties?: {
52
53
  [key: string]: any;
53
- }): this;
54
+ }, forceSendFeatureFlags?: boolean): this;
54
55
  alias(alias: string): this;
55
56
  autocapture(eventType: string, elements: PostHogAutocaptureElement[], properties?: PostHogEventProperties): this;
56
57
  /***
@@ -61,18 +62,30 @@ export declare abstract class PostHogCore {
61
62
  }): this;
62
63
  group(groupType: string, groupKey: string | number, groupProperties?: PostHogEventProperties): this;
63
64
  groupIdentify(groupType: string, groupKey: string | number, groupProperties?: PostHogEventProperties): this;
65
+ /***
66
+ * PROPERTIES
67
+ ***/
68
+ personProperties(properties: {
69
+ [type: string]: string;
70
+ }): this;
71
+ groupProperties(properties: {
72
+ [type: string]: Record<string, string>;
73
+ }): this;
64
74
  /***
65
75
  *** FEATURE FLAGS
66
76
  ***/
67
77
  private decideAsync;
68
78
  private _decideAsync;
69
- getFeatureFlag(key: string, defaultResult?: string | boolean): boolean | string | undefined;
79
+ getFeatureFlag(key: string): boolean | string | undefined;
70
80
  getFeatureFlags(): PostHogDecideResponse['featureFlags'] | undefined;
71
- isFeatureEnabled(key: string, defaultResult?: boolean): boolean;
72
- reloadFeatureFlagsAsync(): Promise<PostHogDecideResponse['featureFlags']>;
81
+ isFeatureEnabled(key: string): boolean | undefined;
82
+ reloadFeatureFlagsAsync(sendAnonDistinctId?: boolean): Promise<PostHogDecideResponse['featureFlags']>;
73
83
  onFeatureFlags(cb: (flags: PostHogDecideResponse['featureFlags']) => void): () => void;
74
84
  onFeatureFlag(key: string, cb: (value: string | boolean) => void): () => void;
75
85
  overrideFeatureFlag(flags: PostHogDecideResponse['featureFlags'] | null): void;
86
+ _sendFeatureFlags(event: string, properties?: {
87
+ [key: string]: any;
88
+ }): void;
76
89
  /***
77
90
  *** QUEUEING AND FLUSHING
78
91
  ***/
@@ -19,7 +19,9 @@ export declare enum PostHogPersistedProperty {
19
19
  Queue = "queue",
20
20
  OptedOut = "opted_out",
21
21
  SessionId = "session_id",
22
- SessionLastTimestamp = "session_timestamp"
22
+ SessionLastTimestamp = "session_timestamp",
23
+ PersonProperties = "person_properties",
24
+ GroupProperties = "group_properties"
23
25
  }
24
26
  export declare type PostHogFetchOptions = {
25
27
  method: 'GET' | 'POST' | 'PUT' | 'PATCH';
@@ -1 +1 @@
1
- export declare function useFeatureFlag(flag: string, defaultValue?: boolean | string): string | boolean | undefined;
1
+ export declare function useFeatureFlag(flag: string): string | boolean | undefined;
@@ -9,5 +9,7 @@ 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
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "posthog-react-native",
3
- "version": "2.0.0",
3
+ "version": "2.1.0",
4
4
  "main": "lib/index.cjs.js",
5
5
  "module": "lib/index.esm.js",
6
6
  "types": "lib/index.d.ts",