posthog-react-native 3.14.0 → 3.15.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.
Files changed (149) hide show
  1. package/lib/index.cjs.js +4677 -0
  2. package/lib/index.cjs.js.map +1 -0
  3. package/lib/index.d.ts +875 -0
  4. package/lib/index.esm.js +4659 -0
  5. package/lib/index.esm.js.map +1 -0
  6. package/lib/posthog-core/src/eventemitter.d.ts +8 -8
  7. package/lib/posthog-core/src/featureFlagUtils.d.ts +34 -34
  8. package/lib/posthog-core/src/index.d.ts +239 -239
  9. package/lib/posthog-core/src/lz-string.d.ts +8 -8
  10. package/lib/posthog-core/src/types.d.ts +423 -422
  11. package/lib/posthog-core/src/utils.d.ts +19 -19
  12. package/lib/posthog-core/src/vendor/uuidv7.d.ts +179 -179
  13. package/lib/posthog-react-native/index.d.ts +10 -10
  14. package/lib/posthog-react-native/src/PostHogContext.d.ts +5 -5
  15. package/lib/posthog-react-native/src/PostHogProvider.d.ts +14 -14
  16. package/lib/posthog-react-native/src/autocapture.d.ts +4 -4
  17. package/lib/posthog-react-native/src/frameworks/wix-navigation.d.ts +3 -3
  18. package/lib/posthog-react-native/src/hooks/useFeatureFlag.d.ts +5 -5
  19. package/lib/posthog-react-native/src/hooks/useFeatureFlags.d.ts +3 -3
  20. package/lib/posthog-react-native/src/hooks/useNavigationTracker.d.ts +6 -6
  21. package/lib/posthog-react-native/src/hooks/usePostHog.d.ts +2 -2
  22. package/lib/posthog-react-native/src/legacy.d.ts +4 -4
  23. package/lib/posthog-react-native/src/native-deps.d.ts +4 -4
  24. package/lib/posthog-react-native/src/optional/OptionalAsyncStorage.d.ts +2 -2
  25. package/lib/posthog-react-native/src/optional/OptionalExpoApplication.d.ts +2 -2
  26. package/lib/posthog-react-native/src/optional/OptionalExpoDevice.d.ts +2 -2
  27. package/lib/posthog-react-native/src/optional/OptionalExpoFileSystem.d.ts +2 -2
  28. package/lib/posthog-react-native/src/optional/OptionalExpoLocalization.d.ts +2 -2
  29. package/lib/posthog-react-native/src/optional/OptionalReactNativeDeviceInfo.d.ts +2 -2
  30. package/lib/posthog-react-native/src/optional/OptionalReactNativeLocalize.d.ts +13 -13
  31. package/lib/posthog-react-native/src/optional/OptionalReactNativeNavigation.d.ts +2 -2
  32. package/lib/posthog-react-native/src/optional/OptionalReactNativeNavigationWix.d.ts +2 -2
  33. package/lib/posthog-react-native/src/optional/OptionalReactNativeSafeArea.d.ts +2 -2
  34. package/lib/posthog-react-native/src/optional/OptionalSessionReplay.d.ts +2 -2
  35. package/lib/posthog-react-native/src/posthog-rn.d.ts +71 -71
  36. package/lib/posthog-react-native/src/storage.d.ts +21 -21
  37. package/lib/posthog-react-native/src/surveys/PostHogSurveyProvider.d.ts +16 -16
  38. package/lib/posthog-react-native/src/surveys/components/BottomSection.d.ts +9 -9
  39. package/lib/posthog-react-native/src/surveys/components/Cancel.d.ts +6 -6
  40. package/lib/posthog-react-native/src/surveys/components/ConfirmationMessage.d.ts +13 -13
  41. package/lib/posthog-react-native/src/surveys/components/QuestionHeader.d.ts +7 -7
  42. package/lib/posthog-react-native/src/surveys/components/QuestionTypes.d.ts +27 -27
  43. package/lib/posthog-react-native/src/surveys/components/SurveyModal.d.ts +10 -10
  44. package/lib/posthog-react-native/src/surveys/components/Surveys.d.ts +14 -14
  45. package/lib/posthog-react-native/src/surveys/getActiveMatchingSurveys.d.ts +2 -2
  46. package/lib/posthog-react-native/src/surveys/icons.d.ts +10 -8
  47. package/lib/posthog-react-native/src/surveys/index.d.ts +6 -6
  48. package/lib/posthog-react-native/src/surveys/surveys-utils.d.ts +13 -13
  49. package/lib/posthog-react-native/src/surveys/useActivatedSurveys.d.ts +3 -3
  50. package/lib/posthog-react-native/src/surveys/useSurveyStorage.d.ts +8 -8
  51. package/lib/posthog-react-native/src/types.d.ts +112 -112
  52. package/lib/posthog-react-native/src/version.d.ts +1 -1
  53. package/lib/posthog-react-native/test/test-utils.d.ts +2 -0
  54. package/package.json +9 -8
  55. package/lib/posthog-core/src/eventemitter.js +0 -1
  56. package/lib/posthog-core/src/eventemitter.js.map +0 -1
  57. package/lib/posthog-core/src/featureFlagUtils.js +0 -1
  58. package/lib/posthog-core/src/featureFlagUtils.js.map +0 -1
  59. package/lib/posthog-core/src/index.js +0 -1
  60. package/lib/posthog-core/src/index.js.map +0 -1
  61. package/lib/posthog-core/src/lz-string.js +0 -1
  62. package/lib/posthog-core/src/lz-string.js.map +0 -1
  63. package/lib/posthog-core/src/types.js +0 -1
  64. package/lib/posthog-core/src/types.js.map +0 -1
  65. package/lib/posthog-core/src/utils.js +0 -1
  66. package/lib/posthog-core/src/utils.js.map +0 -1
  67. package/lib/posthog-core/src/vendor/uuidv7.js +0 -7
  68. package/lib/posthog-core/src/vendor/uuidv7.js.map +0 -1
  69. package/lib/posthog-react-native/index.js +0 -1
  70. package/lib/posthog-react-native/index.js.map +0 -1
  71. package/lib/posthog-react-native/src/PostHogContext.js +0 -1
  72. package/lib/posthog-react-native/src/PostHogContext.js.map +0 -1
  73. package/lib/posthog-react-native/src/PostHogProvider.js +0 -1
  74. package/lib/posthog-react-native/src/PostHogProvider.js.map +0 -1
  75. package/lib/posthog-react-native/src/autocapture.js +0 -1
  76. package/lib/posthog-react-native/src/autocapture.js.map +0 -1
  77. package/lib/posthog-react-native/src/frameworks/wix-navigation.js +0 -1
  78. package/lib/posthog-react-native/src/frameworks/wix-navigation.js.map +0 -1
  79. package/lib/posthog-react-native/src/hooks/useFeatureFlag.js +0 -1
  80. package/lib/posthog-react-native/src/hooks/useFeatureFlag.js.map +0 -1
  81. package/lib/posthog-react-native/src/hooks/useFeatureFlags.js +0 -1
  82. package/lib/posthog-react-native/src/hooks/useFeatureFlags.js.map +0 -1
  83. package/lib/posthog-react-native/src/hooks/useNavigationTracker.js +0 -1
  84. package/lib/posthog-react-native/src/hooks/useNavigationTracker.js.map +0 -1
  85. package/lib/posthog-react-native/src/hooks/usePostHog.js +0 -1
  86. package/lib/posthog-react-native/src/hooks/usePostHog.js.map +0 -1
  87. package/lib/posthog-react-native/src/legacy.js +0 -1
  88. package/lib/posthog-react-native/src/legacy.js.map +0 -1
  89. package/lib/posthog-react-native/src/native-deps.js +0 -1
  90. package/lib/posthog-react-native/src/native-deps.js.map +0 -1
  91. package/lib/posthog-react-native/src/optional/OptionalAsyncStorage.js +0 -1
  92. package/lib/posthog-react-native/src/optional/OptionalAsyncStorage.js.map +0 -1
  93. package/lib/posthog-react-native/src/optional/OptionalExpoApplication.js +0 -1
  94. package/lib/posthog-react-native/src/optional/OptionalExpoApplication.js.map +0 -1
  95. package/lib/posthog-react-native/src/optional/OptionalExpoDevice.js +0 -1
  96. package/lib/posthog-react-native/src/optional/OptionalExpoDevice.js.map +0 -1
  97. package/lib/posthog-react-native/src/optional/OptionalExpoFileSystem.js +0 -1
  98. package/lib/posthog-react-native/src/optional/OptionalExpoFileSystem.js.map +0 -1
  99. package/lib/posthog-react-native/src/optional/OptionalExpoLocalization.js +0 -1
  100. package/lib/posthog-react-native/src/optional/OptionalExpoLocalization.js.map +0 -1
  101. package/lib/posthog-react-native/src/optional/OptionalReactNativeDeviceInfo.js +0 -1
  102. package/lib/posthog-react-native/src/optional/OptionalReactNativeDeviceInfo.js.map +0 -1
  103. package/lib/posthog-react-native/src/optional/OptionalReactNativeLocalize.js +0 -1
  104. package/lib/posthog-react-native/src/optional/OptionalReactNativeLocalize.js.map +0 -1
  105. package/lib/posthog-react-native/src/optional/OptionalReactNativeNavigation.js +0 -1
  106. package/lib/posthog-react-native/src/optional/OptionalReactNativeNavigation.js.map +0 -1
  107. package/lib/posthog-react-native/src/optional/OptionalReactNativeNavigationWix.js +0 -1
  108. package/lib/posthog-react-native/src/optional/OptionalReactNativeNavigationWix.js.map +0 -1
  109. package/lib/posthog-react-native/src/optional/OptionalReactNativeSafeArea.js +0 -1
  110. package/lib/posthog-react-native/src/optional/OptionalReactNativeSafeArea.js.map +0 -1
  111. package/lib/posthog-react-native/src/optional/OptionalSessionReplay.js +0 -1
  112. package/lib/posthog-react-native/src/optional/OptionalSessionReplay.js.map +0 -1
  113. package/lib/posthog-react-native/src/posthog-rn.js +0 -1
  114. package/lib/posthog-react-native/src/posthog-rn.js.map +0 -1
  115. package/lib/posthog-react-native/src/storage.js +0 -1
  116. package/lib/posthog-react-native/src/storage.js.map +0 -1
  117. package/lib/posthog-react-native/src/surveys/PostHogSurveyProvider.js +0 -1
  118. package/lib/posthog-react-native/src/surveys/PostHogSurveyProvider.js.map +0 -1
  119. package/lib/posthog-react-native/src/surveys/components/BottomSection.js +0 -1
  120. package/lib/posthog-react-native/src/surveys/components/BottomSection.js.map +0 -1
  121. package/lib/posthog-react-native/src/surveys/components/Cancel.js +0 -1
  122. package/lib/posthog-react-native/src/surveys/components/Cancel.js.map +0 -1
  123. package/lib/posthog-react-native/src/surveys/components/ConfirmationMessage.js +0 -1
  124. package/lib/posthog-react-native/src/surveys/components/ConfirmationMessage.js.map +0 -1
  125. package/lib/posthog-react-native/src/surveys/components/QuestionHeader.js +0 -1
  126. package/lib/posthog-react-native/src/surveys/components/QuestionHeader.js.map +0 -1
  127. package/lib/posthog-react-native/src/surveys/components/QuestionTypes.js +0 -1
  128. package/lib/posthog-react-native/src/surveys/components/QuestionTypes.js.map +0 -1
  129. package/lib/posthog-react-native/src/surveys/components/SurveyModal.js +0 -1
  130. package/lib/posthog-react-native/src/surveys/components/SurveyModal.js.map +0 -1
  131. package/lib/posthog-react-native/src/surveys/components/Surveys.js +0 -1
  132. package/lib/posthog-react-native/src/surveys/components/Surveys.js.map +0 -1
  133. package/lib/posthog-react-native/src/surveys/getActiveMatchingSurveys.js +0 -1
  134. package/lib/posthog-react-native/src/surveys/getActiveMatchingSurveys.js.map +0 -1
  135. package/lib/posthog-react-native/src/surveys/icons.js +0 -1
  136. package/lib/posthog-react-native/src/surveys/icons.js.map +0 -1
  137. package/lib/posthog-react-native/src/surveys/index.js +0 -1
  138. package/lib/posthog-react-native/src/surveys/index.js.map +0 -1
  139. package/lib/posthog-react-native/src/surveys/surveys-utils.js +0 -1
  140. package/lib/posthog-react-native/src/surveys/surveys-utils.js.map +0 -1
  141. package/lib/posthog-react-native/src/surveys/useActivatedSurveys.js +0 -1
  142. package/lib/posthog-react-native/src/surveys/useActivatedSurveys.js.map +0 -1
  143. package/lib/posthog-react-native/src/surveys/useSurveyStorage.js +0 -1
  144. package/lib/posthog-react-native/src/surveys/useSurveyStorage.js.map +0 -1
  145. package/lib/posthog-react-native/src/types.js +0 -1
  146. package/lib/posthog-react-native/src/types.js.map +0 -1
  147. package/lib/posthog-react-native/src/version.js +0 -1
  148. package/lib/posthog-react-native/src/version.js.map +0 -1
  149. package/lib/posthog-react-native/tsconfig.tsbuildinfo +0 -1
@@ -1,19 +1,19 @@
1
- import { FetchLike } from './types';
2
- export declare const NEW_FLAGS_ROLLOUT_PERCENTAGE = 1;
3
- export declare const NEW_FLAGS_EXCLUDED_HASHES: Set<string>;
4
- export declare function assert(truthyValue: any, message: string): void;
5
- export declare function removeTrailingSlash(url: string): string;
6
- export interface RetriableOptions {
7
- retryCount: number;
8
- retryDelay: number;
9
- retryCheck: (err: any) => boolean;
10
- }
11
- export declare function retriable<T>(fn: () => Promise<T>, props: RetriableOptions): Promise<T>;
12
- export declare function currentTimestamp(): number;
13
- export declare function currentISOTime(): string;
14
- export declare function safeSetTimeout(fn: () => void, timeout: number): any;
15
- export declare const isPromise: (obj: any) => obj is Promise<any>;
16
- export declare const isError: (x: unknown) => x is Error;
17
- export declare function getFetch(): FetchLike | undefined;
18
- export declare const isFunction: (f: any) => f is (...args: any[]) => any;
19
- export declare function isTokenInRollout(token: string, percentage?: number, excludedHashes?: Set<string>): boolean;
1
+ import { FetchLike } from './types';
2
+ export declare const NEW_FLAGS_ROLLOUT_PERCENTAGE = 1;
3
+ export declare const NEW_FLAGS_EXCLUDED_HASHES: Set<string>;
4
+ export declare function assert(truthyValue: any, message: string): void;
5
+ export declare function removeTrailingSlash(url: string): string;
6
+ export interface RetriableOptions {
7
+ retryCount: number;
8
+ retryDelay: number;
9
+ retryCheck: (err: any) => boolean;
10
+ }
11
+ export declare function retriable<T>(fn: () => Promise<T>, props: RetriableOptions): Promise<T>;
12
+ export declare function currentTimestamp(): number;
13
+ export declare function currentISOTime(): string;
14
+ export declare function safeSetTimeout(fn: () => void, timeout: number): any;
15
+ export declare const isPromise: (obj: any) => obj is Promise<any>;
16
+ export declare const isError: (x: unknown) => x is Error;
17
+ export declare function getFetch(): FetchLike | undefined;
18
+ export declare const isFunction: (f: any) => f is (...args: any[]) => any;
19
+ export declare function isTokenInRollout(token: string, percentage?: number, excludedHashes?: Set<string>): boolean;
@@ -1,179 +1,179 @@
1
- /** Represents a UUID as a 16-byte byte array. */
2
- export declare class UUID {
3
- readonly bytes: Readonly<Uint8Array>;
4
- /** @param bytes - The 16-byte byte array representation. */
5
- private constructor();
6
- /**
7
- * Creates an object from the internal representation, a 16-byte byte array
8
- * containing the binary UUID representation in the big-endian byte order.
9
- *
10
- * This method does NOT shallow-copy the argument, and thus the created object
11
- * holds the reference to the underlying buffer.
12
- *
13
- * @throws TypeError if the length of the argument is not 16.
14
- */
15
- static ofInner(bytes: Readonly<Uint8Array>): UUID;
16
- /**
17
- * Builds a byte array from UUIDv7 field values.
18
- *
19
- * @param unixTsMs - A 48-bit `unix_ts_ms` field value.
20
- * @param randA - A 12-bit `rand_a` field value.
21
- * @param randBHi - The higher 30 bits of 62-bit `rand_b` field value.
22
- * @param randBLo - The lower 32 bits of 62-bit `rand_b` field value.
23
- * @throws RangeError if any field value is out of the specified range.
24
- */
25
- static fromFieldsV7(unixTsMs: number, randA: number, randBHi: number, randBLo: number): UUID;
26
- /**
27
- * Builds a byte array from a string representation.
28
- *
29
- * This method accepts the following formats:
30
- *
31
- * - 32-digit hexadecimal format without hyphens: `0189dcd553117d408db09496a2eef37b`
32
- * - 8-4-4-4-12 hyphenated format: `0189dcd5-5311-7d40-8db0-9496a2eef37b`
33
- * - Hyphenated format with surrounding braces: `{0189dcd5-5311-7d40-8db0-9496a2eef37b}`
34
- * - RFC 4122 URN format: `urn:uuid:0189dcd5-5311-7d40-8db0-9496a2eef37b`
35
- *
36
- * Leading and trailing whitespaces represents an error.
37
- *
38
- * @throws SyntaxError if the argument could not parse as a valid UUID string.
39
- */
40
- static parse(uuid: string): UUID;
41
- /**
42
- * @returns The 8-4-4-4-12 canonical hexadecimal string representation
43
- * (`0189dcd5-5311-7d40-8db0-9496a2eef37b`).
44
- */
45
- toString(): string;
46
- /**
47
- * @returns The 32-digit hexadecimal representation without hyphens
48
- * (`0189dcd553117d408db09496a2eef37b`).
49
- */
50
- toHex(): string;
51
- /** @returns The 8-4-4-4-12 canonical hexadecimal string representation. */
52
- toJSON(): string;
53
- /**
54
- * Reports the variant field value of the UUID or, if appropriate, "NIL" or
55
- * "MAX".
56
- *
57
- * For convenience, this method reports "NIL" or "MAX" if `this` represents
58
- * the Nil or Max UUID, although the Nil and Max UUIDs are technically
59
- * subsumed under the variants `0b0` and `0b111`, respectively.
60
- */
61
- getVariant(): "VAR_0" | "VAR_10" | "VAR_110" | "VAR_RESERVED" | "NIL" | "MAX";
62
- /**
63
- * Returns the version field value of the UUID or `undefined` if the UUID does
64
- * not have the variant field value of `0b10`.
65
- */
66
- getVersion(): number | undefined;
67
- /** Creates an object from `this`. */
68
- clone(): UUID;
69
- /** Returns true if `this` is equivalent to `other`. */
70
- equals(other: UUID): boolean;
71
- /**
72
- * Returns a negative integer, zero, or positive integer if `this` is less
73
- * than, equal to, or greater than `other`, respectively.
74
- */
75
- compareTo(other: UUID): number;
76
- }
77
- /**
78
- * Encapsulates the monotonic counter state.
79
- *
80
- * This class provides APIs to utilize a separate counter state from that of the
81
- * global generator used by {@link uuidv7} and {@link uuidv7obj}. In addition to
82
- * the default {@link generate} method, this class has {@link generateOrAbort}
83
- * that is useful to absolutely guarantee the monotonically increasing order of
84
- * generated UUIDs. See their respective documentation for details.
85
- */
86
- export declare class V7Generator {
87
- private timestamp;
88
- private counter;
89
- /** The random number generator used by the generator. */
90
- private readonly random;
91
- /**
92
- * Creates a generator object with the default random number generator, or
93
- * with the specified one if passed as an argument. The specified random
94
- * number generator should be cryptographically strong and securely seeded.
95
- */
96
- constructor(randomNumberGenerator?: {
97
- /** Returns a 32-bit random unsigned integer. */
98
- nextUint32(): number;
99
- });
100
- /**
101
- * Generates a new UUIDv7 object from the current timestamp, or resets the
102
- * generator upon significant timestamp rollback.
103
- *
104
- * This method returns a monotonically increasing UUID by reusing the previous
105
- * timestamp even if the up-to-date timestamp is smaller than the immediately
106
- * preceding UUID's. However, when such a clock rollback is considered
107
- * significant (i.e., by more than ten seconds), this method resets the
108
- * generator and returns a new UUID based on the given timestamp, breaking the
109
- * increasing order of UUIDs.
110
- *
111
- * See {@link generateOrAbort} for the other mode of generation and
112
- * {@link generateOrResetCore} for the low-level primitive.
113
- */
114
- generate(): UUID;
115
- /**
116
- * Generates a new UUIDv7 object from the current timestamp, or returns
117
- * `undefined` upon significant timestamp rollback.
118
- *
119
- * This method returns a monotonically increasing UUID by reusing the previous
120
- * timestamp even if the up-to-date timestamp is smaller than the immediately
121
- * preceding UUID's. However, when such a clock rollback is considered
122
- * significant (i.e., by more than ten seconds), this method aborts and
123
- * returns `undefined` immediately.
124
- *
125
- * See {@link generate} for the other mode of generation and
126
- * {@link generateOrAbortCore} for the low-level primitive.
127
- */
128
- generateOrAbort(): UUID | undefined;
129
- /**
130
- * Generates a new UUIDv7 object from the `unixTsMs` passed, or resets the
131
- * generator upon significant timestamp rollback.
132
- *
133
- * This method is equivalent to {@link generate} except that it takes a custom
134
- * timestamp and clock rollback allowance.
135
- *
136
- * @param rollbackAllowance - The amount of `unixTsMs` rollback that is
137
- * considered significant. A suggested value is `10_000` (milliseconds).
138
- * @throws RangeError if `unixTsMs` is not a 48-bit positive integer.
139
- */
140
- generateOrResetCore(unixTsMs: number, rollbackAllowance: number): UUID;
141
- /**
142
- * Generates a new UUIDv7 object from the `unixTsMs` passed, or returns
143
- * `undefined` upon significant timestamp rollback.
144
- *
145
- * This method is equivalent to {@link generateOrAbort} except that it takes a
146
- * custom timestamp and clock rollback allowance.
147
- *
148
- * @param rollbackAllowance - The amount of `unixTsMs` rollback that is
149
- * considered significant. A suggested value is `10_000` (milliseconds).
150
- * @throws RangeError if `unixTsMs` is not a 48-bit positive integer.
151
- */
152
- generateOrAbortCore(unixTsMs: number, rollbackAllowance: number): UUID | undefined;
153
- /** Initializes the counter at a 42-bit random integer. */
154
- private resetCounter;
155
- /**
156
- * Generates a new UUIDv4 object utilizing the random number generator inside.
157
- *
158
- * @internal
159
- */
160
- generateV4(): UUID;
161
- }
162
- /**
163
- * Generates a UUIDv7 string.
164
- *
165
- * @returns The 8-4-4-4-12 canonical hexadecimal string representation
166
- * ("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx").
167
- */
168
- export declare const uuidv7: () => string;
169
- /** Generates a UUIDv7 object. */
170
- export declare const uuidv7obj: () => UUID;
171
- /**
172
- * Generates a UUIDv4 string.
173
- *
174
- * @returns The 8-4-4-4-12 canonical hexadecimal string representation
175
- * ("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx").
176
- */
177
- export declare const uuidv4: () => string;
178
- /** Generates a UUIDv4 object. */
179
- export declare const uuidv4obj: () => UUID;
1
+ /** Represents a UUID as a 16-byte byte array. */
2
+ export declare class UUID {
3
+ readonly bytes: Readonly<Uint8Array>;
4
+ /** @param bytes - The 16-byte byte array representation. */
5
+ private constructor();
6
+ /**
7
+ * Creates an object from the internal representation, a 16-byte byte array
8
+ * containing the binary UUID representation in the big-endian byte order.
9
+ *
10
+ * This method does NOT shallow-copy the argument, and thus the created object
11
+ * holds the reference to the underlying buffer.
12
+ *
13
+ * @throws TypeError if the length of the argument is not 16.
14
+ */
15
+ static ofInner(bytes: Readonly<Uint8Array>): UUID;
16
+ /**
17
+ * Builds a byte array from UUIDv7 field values.
18
+ *
19
+ * @param unixTsMs - A 48-bit `unix_ts_ms` field value.
20
+ * @param randA - A 12-bit `rand_a` field value.
21
+ * @param randBHi - The higher 30 bits of 62-bit `rand_b` field value.
22
+ * @param randBLo - The lower 32 bits of 62-bit `rand_b` field value.
23
+ * @throws RangeError if any field value is out of the specified range.
24
+ */
25
+ static fromFieldsV7(unixTsMs: number, randA: number, randBHi: number, randBLo: number): UUID;
26
+ /**
27
+ * Builds a byte array from a string representation.
28
+ *
29
+ * This method accepts the following formats:
30
+ *
31
+ * - 32-digit hexadecimal format without hyphens: `0189dcd553117d408db09496a2eef37b`
32
+ * - 8-4-4-4-12 hyphenated format: `0189dcd5-5311-7d40-8db0-9496a2eef37b`
33
+ * - Hyphenated format with surrounding braces: `{0189dcd5-5311-7d40-8db0-9496a2eef37b}`
34
+ * - RFC 4122 URN format: `urn:uuid:0189dcd5-5311-7d40-8db0-9496a2eef37b`
35
+ *
36
+ * Leading and trailing whitespaces represents an error.
37
+ *
38
+ * @throws SyntaxError if the argument could not parse as a valid UUID string.
39
+ */
40
+ static parse(uuid: string): UUID;
41
+ /**
42
+ * @returns The 8-4-4-4-12 canonical hexadecimal string representation
43
+ * (`0189dcd5-5311-7d40-8db0-9496a2eef37b`).
44
+ */
45
+ toString(): string;
46
+ /**
47
+ * @returns The 32-digit hexadecimal representation without hyphens
48
+ * (`0189dcd553117d408db09496a2eef37b`).
49
+ */
50
+ toHex(): string;
51
+ /** @returns The 8-4-4-4-12 canonical hexadecimal string representation. */
52
+ toJSON(): string;
53
+ /**
54
+ * Reports the variant field value of the UUID or, if appropriate, "NIL" or
55
+ * "MAX".
56
+ *
57
+ * For convenience, this method reports "NIL" or "MAX" if `this` represents
58
+ * the Nil or Max UUID, although the Nil and Max UUIDs are technically
59
+ * subsumed under the variants `0b0` and `0b111`, respectively.
60
+ */
61
+ getVariant(): "VAR_0" | "VAR_10" | "VAR_110" | "VAR_RESERVED" | "NIL" | "MAX";
62
+ /**
63
+ * Returns the version field value of the UUID or `undefined` if the UUID does
64
+ * not have the variant field value of `0b10`.
65
+ */
66
+ getVersion(): number | undefined;
67
+ /** Creates an object from `this`. */
68
+ clone(): UUID;
69
+ /** Returns true if `this` is equivalent to `other`. */
70
+ equals(other: UUID): boolean;
71
+ /**
72
+ * Returns a negative integer, zero, or positive integer if `this` is less
73
+ * than, equal to, or greater than `other`, respectively.
74
+ */
75
+ compareTo(other: UUID): number;
76
+ }
77
+ /**
78
+ * Encapsulates the monotonic counter state.
79
+ *
80
+ * This class provides APIs to utilize a separate counter state from that of the
81
+ * global generator used by {@link uuidv7} and {@link uuidv7obj}. In addition to
82
+ * the default {@link generate} method, this class has {@link generateOrAbort}
83
+ * that is useful to absolutely guarantee the monotonically increasing order of
84
+ * generated UUIDs. See their respective documentation for details.
85
+ */
86
+ export declare class V7Generator {
87
+ private timestamp;
88
+ private counter;
89
+ /** The random number generator used by the generator. */
90
+ private readonly random;
91
+ /**
92
+ * Creates a generator object with the default random number generator, or
93
+ * with the specified one if passed as an argument. The specified random
94
+ * number generator should be cryptographically strong and securely seeded.
95
+ */
96
+ constructor(randomNumberGenerator?: {
97
+ /** Returns a 32-bit random unsigned integer. */
98
+ nextUint32(): number;
99
+ });
100
+ /**
101
+ * Generates a new UUIDv7 object from the current timestamp, or resets the
102
+ * generator upon significant timestamp rollback.
103
+ *
104
+ * This method returns a monotonically increasing UUID by reusing the previous
105
+ * timestamp even if the up-to-date timestamp is smaller than the immediately
106
+ * preceding UUID's. However, when such a clock rollback is considered
107
+ * significant (i.e., by more than ten seconds), this method resets the
108
+ * generator and returns a new UUID based on the given timestamp, breaking the
109
+ * increasing order of UUIDs.
110
+ *
111
+ * See {@link generateOrAbort} for the other mode of generation and
112
+ * {@link generateOrResetCore} for the low-level primitive.
113
+ */
114
+ generate(): UUID;
115
+ /**
116
+ * Generates a new UUIDv7 object from the current timestamp, or returns
117
+ * `undefined` upon significant timestamp rollback.
118
+ *
119
+ * This method returns a monotonically increasing UUID by reusing the previous
120
+ * timestamp even if the up-to-date timestamp is smaller than the immediately
121
+ * preceding UUID's. However, when such a clock rollback is considered
122
+ * significant (i.e., by more than ten seconds), this method aborts and
123
+ * returns `undefined` immediately.
124
+ *
125
+ * See {@link generate} for the other mode of generation and
126
+ * {@link generateOrAbortCore} for the low-level primitive.
127
+ */
128
+ generateOrAbort(): UUID | undefined;
129
+ /**
130
+ * Generates a new UUIDv7 object from the `unixTsMs` passed, or resets the
131
+ * generator upon significant timestamp rollback.
132
+ *
133
+ * This method is equivalent to {@link generate} except that it takes a custom
134
+ * timestamp and clock rollback allowance.
135
+ *
136
+ * @param rollbackAllowance - The amount of `unixTsMs` rollback that is
137
+ * considered significant. A suggested value is `10_000` (milliseconds).
138
+ * @throws RangeError if `unixTsMs` is not a 48-bit positive integer.
139
+ */
140
+ generateOrResetCore(unixTsMs: number, rollbackAllowance: number): UUID;
141
+ /**
142
+ * Generates a new UUIDv7 object from the `unixTsMs` passed, or returns
143
+ * `undefined` upon significant timestamp rollback.
144
+ *
145
+ * This method is equivalent to {@link generateOrAbort} except that it takes a
146
+ * custom timestamp and clock rollback allowance.
147
+ *
148
+ * @param rollbackAllowance - The amount of `unixTsMs` rollback that is
149
+ * considered significant. A suggested value is `10_000` (milliseconds).
150
+ * @throws RangeError if `unixTsMs` is not a 48-bit positive integer.
151
+ */
152
+ generateOrAbortCore(unixTsMs: number, rollbackAllowance: number): UUID | undefined;
153
+ /** Initializes the counter at a 42-bit random integer. */
154
+ private resetCounter;
155
+ /**
156
+ * Generates a new UUIDv4 object utilizing the random number generator inside.
157
+ *
158
+ * @internal
159
+ */
160
+ generateV4(): UUID;
161
+ }
162
+ /**
163
+ * Generates a UUIDv7 string.
164
+ *
165
+ * @returns The 8-4-4-4-12 canonical hexadecimal string representation
166
+ * ("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx").
167
+ */
168
+ export declare const uuidv7: () => string;
169
+ /** Generates a UUIDv7 object. */
170
+ export declare const uuidv7obj: () => UUID;
171
+ /**
172
+ * Generates a UUIDv4 string.
173
+ *
174
+ * @returns The 8-4-4-4-12 canonical hexadecimal string representation
175
+ * ("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx").
176
+ */
177
+ export declare const uuidv4: () => string;
178
+ /** Generates a UUIDv4 object. */
179
+ export declare const uuidv4obj: () => UUID;
@@ -1,10 +1,10 @@
1
- import { PostHog } from './src/posthog-rn';
2
- export default PostHog;
3
- export * from './src/posthog-rn';
4
- export * from './src/hooks/useNavigationTracker';
5
- export * from './src/hooks/useFeatureFlags';
6
- export * from './src/hooks/useFeatureFlag';
7
- export * from './src/hooks/usePostHog';
8
- export * from './src/PostHogProvider';
9
- export * from './src/types';
10
- export * from './src/surveys';
1
+ import { PostHog } from './src/posthog-rn';
2
+ export default PostHog;
3
+ export * from './src/posthog-rn';
4
+ export * from './src/hooks/useNavigationTracker';
5
+ export * from './src/hooks/useFeatureFlags';
6
+ export * from './src/hooks/useFeatureFlag';
7
+ export * from './src/hooks/usePostHog';
8
+ export * from './src/PostHogProvider';
9
+ export * from './src/types';
10
+ export * from './src/surveys';
@@ -1,5 +1,5 @@
1
- import React from 'react';
2
- import { PostHog } from './posthog-rn';
3
- export declare const PostHogContext: React.Context<{
4
- client: PostHog;
5
- }>;
1
+ import React from 'react';
2
+ import { PostHog } from './posthog-rn';
3
+ export declare const PostHogContext: React.Context<{
4
+ client: PostHog;
5
+ }>;
@@ -1,14 +1,14 @@
1
- import React from 'react';
2
- import { StyleProp, ViewStyle } from 'react-native';
3
- import { PostHog, PostHogOptions } from './posthog-rn';
4
- import { PostHogAutocaptureOptions } from './types';
5
- export interface PostHogProviderProps {
6
- children: React.ReactNode;
7
- options?: PostHogOptions;
8
- apiKey?: string;
9
- client?: PostHog;
10
- autocapture?: boolean | PostHogAutocaptureOptions;
11
- debug?: boolean;
12
- style?: StyleProp<ViewStyle>;
13
- }
14
- export declare const PostHogProvider: ({ children, client, options, apiKey, autocapture, style, debug, }: PostHogProviderProps) => JSX.Element | null;
1
+ import React from 'react';
2
+ import { StyleProp, ViewStyle } from 'react-native';
3
+ import { PostHog, PostHogOptions } from './posthog-rn';
4
+ import { PostHogAutocaptureOptions } from './types';
5
+ export interface PostHogProviderProps {
6
+ children: React.ReactNode;
7
+ options?: PostHogOptions;
8
+ apiKey?: string;
9
+ client?: PostHog;
10
+ autocapture?: boolean | PostHogAutocaptureOptions;
11
+ debug?: boolean;
12
+ style?: StyleProp<ViewStyle>;
13
+ }
14
+ export declare const PostHogProvider: ({ children, client, options, apiKey, autocapture, style, debug, }: PostHogProviderProps) => JSX.Element | null;
@@ -1,4 +1,4 @@
1
- import { PostHog } from './posthog-rn';
2
- import { PostHogAutocaptureOptions } from './types';
3
- export declare const defaultPostHogLabelProp = "ph-label";
4
- export declare const autocaptureFromTouchEvent: (e: any, posthog: PostHog, options?: PostHogAutocaptureOptions) => void;
1
+ import { PostHog } from './posthog-rn';
2
+ import { PostHogAutocaptureOptions } from './types';
3
+ export declare const defaultPostHogLabelProp = "ph-label";
4
+ export declare const autocaptureFromTouchEvent: (e: any, posthog: PostHog, options?: PostHogAutocaptureOptions) => void;
@@ -1,3 +1,3 @@
1
- import { PostHog } from '../posthog-rn';
2
- import { PostHogAutocaptureOptions } from '../types';
3
- export declare const withReactNativeNavigation: (posthog: PostHog, options?: PostHogAutocaptureOptions) => boolean;
1
+ import { PostHog } from '../posthog-rn';
2
+ import { PostHogAutocaptureOptions } from '../types';
3
+ export declare const withReactNativeNavigation: (posthog: PostHog, options?: PostHogAutocaptureOptions) => boolean;
@@ -1,5 +1,5 @@
1
- import { JsonType, FeatureFlagValue } from 'posthog-core/src';
2
- import { PostHog } from '../posthog-rn';
3
- export declare function useFeatureFlag(flag: string, client?: PostHog): FeatureFlagValue | undefined;
4
- export type FeatureFlagWithPayload = [FeatureFlagValue | undefined, JsonType | undefined];
5
- export declare function useFeatureFlagWithPayload(flag: string, client?: PostHog): FeatureFlagWithPayload;
1
+ import { JsonType, FeatureFlagValue } from 'posthog-core/src';
2
+ import { PostHog } from '../posthog-rn';
3
+ export declare function useFeatureFlag(flag: string, client?: PostHog): FeatureFlagValue | undefined;
4
+ export type FeatureFlagWithPayload = [FeatureFlagValue | undefined, JsonType | undefined];
5
+ export declare function useFeatureFlagWithPayload(flag: string, client?: PostHog): FeatureFlagWithPayload;
@@ -1,3 +1,3 @@
1
- import type { PostHog } from '../posthog-rn';
2
- import { PostHogDecideResponse } from 'posthog-core';
3
- export declare function useFeatureFlags(client?: PostHog): PostHogDecideResponse['featureFlags'] | undefined;
1
+ import type { PostHog } from '../posthog-rn';
2
+ import { PostHogDecideResponse } from 'posthog-core';
3
+ export declare function useFeatureFlags(client?: PostHog): PostHogDecideResponse['featureFlags'] | undefined;
@@ -1,6 +1,6 @@
1
- import type { PostHog } from '../posthog-rn';
2
- import { PostHogAutocaptureNavigationTrackerOptions } from '../types';
3
- import { PostHogNavigationRef } from '../types';
4
- declare function _useNavigationTracker(options?: PostHogAutocaptureNavigationTrackerOptions, navigationRef?: PostHogNavigationRef, client?: PostHog): void;
5
- export declare const useNavigationTracker: typeof _useNavigationTracker;
6
- export {};
1
+ import type { PostHog } from '../posthog-rn';
2
+ import { PostHogAutocaptureNavigationTrackerOptions } from '../types';
3
+ import { PostHogNavigationRef } from '../types';
4
+ declare function _useNavigationTracker(options?: PostHogAutocaptureNavigationTrackerOptions, navigationRef?: PostHogNavigationRef, client?: PostHog): void;
5
+ export declare const useNavigationTracker: typeof _useNavigationTracker;
6
+ export {};
@@ -1,2 +1,2 @@
1
- import { PostHog } from '../posthog-rn';
2
- export declare const usePostHog: () => PostHog;
1
+ import { PostHog } from '../posthog-rn';
2
+ export declare const usePostHog: () => PostHog;
@@ -1,4 +1,4 @@
1
- export declare const getLegacyValues: () => Promise<{
2
- distinctId?: string;
3
- anonymousId?: string;
4
- } | undefined>;
1
+ export declare const getLegacyValues: () => Promise<{
2
+ distinctId?: string;
3
+ anonymousId?: string;
4
+ } | undefined>;
@@ -1,4 +1,4 @@
1
- import { PostHogCustomAppProperties, PostHogCustomStorage } from './types';
2
- export declare const currentDeviceType: string;
3
- export declare const getAppProperties: () => PostHogCustomAppProperties;
4
- export declare const buildOptimisiticAsyncStorage: () => PostHogCustomStorage;
1
+ import { PostHogCustomAppProperties, PostHogCustomStorage } from './types';
2
+ export declare const currentDeviceType: string;
3
+ export declare const getAppProperties: () => PostHogCustomAppProperties;
4
+ export declare const buildOptimisiticAsyncStorage: () => PostHogCustomStorage;
@@ -1,2 +1,2 @@
1
- import type AsyncStorage from '@react-native-async-storage/async-storage';
2
- export declare let OptionalAsyncStorage: typeof AsyncStorage | undefined;
1
+ import type AsyncStorage from '@react-native-async-storage/async-storage';
2
+ export declare let OptionalAsyncStorage: typeof AsyncStorage | undefined;
@@ -1,2 +1,2 @@
1
- import type ExpoApplication from 'expo-application';
2
- export declare let OptionalExpoApplication: typeof ExpoApplication | undefined;
1
+ import type ExpoApplication from 'expo-application';
2
+ export declare let OptionalExpoApplication: typeof ExpoApplication | undefined;
@@ -1,2 +1,2 @@
1
- import type ExpoDevice from 'expo-device';
2
- export declare let OptionalExpoDevice: typeof ExpoDevice | undefined;
1
+ import type ExpoDevice from 'expo-device';
2
+ export declare let OptionalExpoDevice: typeof ExpoDevice | undefined;
@@ -1,2 +1,2 @@
1
- import type ExpoFileSystem from 'expo-file-system';
2
- export declare let OptionalExpoFileSystem: typeof ExpoFileSystem | undefined;
1
+ import type ExpoFileSystem from 'expo-file-system';
2
+ export declare let OptionalExpoFileSystem: typeof ExpoFileSystem | undefined;
@@ -1,2 +1,2 @@
1
- import type ExpoLocalization from 'expo-localization';
2
- export declare let OptionalExpoLocalization: typeof ExpoLocalization | undefined;
1
+ import type ExpoLocalization from 'expo-localization';
2
+ export declare let OptionalExpoLocalization: typeof ExpoLocalization | undefined;
@@ -1,2 +1,2 @@
1
- import type ReactNativeDeviceInfo from 'react-native-device-info';
2
- export declare let OptionalReactNativeDeviceInfo: typeof ReactNativeDeviceInfo | undefined;
1
+ import type ReactNativeDeviceInfo from 'react-native-device-info';
2
+ export declare let OptionalReactNativeDeviceInfo: typeof ReactNativeDeviceInfo | undefined;
@@ -1,13 +1,13 @@
1
- interface ReactNativeLocalize {
2
- getLocales: () => {
3
- languageCode: string;
4
- scriptCode?: string;
5
- countryCode: string;
6
- languageTag: string;
7
- isRTL: boolean;
8
- }[];
9
- getTimeZone(): string;
10
- }
11
- import type ReactNativeLocalize from 'react-native-localize';
12
- export declare let OptionalReactNativeLocalize: typeof ReactNativeLocalize | undefined;
13
- export {};
1
+ interface ReactNativeLocalize {
2
+ getLocales: () => {
3
+ languageCode: string;
4
+ scriptCode?: string;
5
+ countryCode: string;
6
+ languageTag: string;
7
+ isRTL: boolean;
8
+ }[];
9
+ getTimeZone(): string;
10
+ }
11
+ import type ReactNativeLocalize from 'react-native-localize';
12
+ export declare let OptionalReactNativeLocalize: typeof ReactNativeLocalize | undefined;
13
+ export {};
@@ -1,2 +1,2 @@
1
- import type ReactNativeNavigation from '@react-navigation/native';
2
- export declare let OptionalReactNativeNavigation: typeof ReactNativeNavigation | undefined;
1
+ import type ReactNativeNavigation from '@react-navigation/native';
2
+ export declare let OptionalReactNativeNavigation: typeof ReactNativeNavigation | undefined;
@@ -1,2 +1,2 @@
1
- import type ReactNativeNavigationWix from 'react-native-navigation';
2
- export declare let OptionalReactNativeNavigationWix: typeof ReactNativeNavigationWix | undefined;
1
+ import type ReactNativeNavigationWix from 'react-native-navigation';
2
+ export declare let OptionalReactNativeNavigationWix: typeof ReactNativeNavigationWix | undefined;
@@ -1,2 +1,2 @@
1
- import type RNSafeAreaContext from 'react-native-safe-area-context';
2
- export declare const useOptionalSafeAreaInsets: () => RNSafeAreaContext.EdgeInsets;
1
+ import type RNSafeAreaContext from 'react-native-safe-area-context';
2
+ export declare const useOptionalSafeAreaInsets: () => RNSafeAreaContext.EdgeInsets;
@@ -1,2 +1,2 @@
1
- import type PostHogReactNativeSessionReplay from 'posthog-react-native-session-replay';
2
- export declare let OptionalReactNativeSessionReplay: typeof PostHogReactNativeSessionReplay | undefined;
1
+ import type PostHogReactNativeSessionReplay from 'posthog-react-native-session-replay';
2
+ export declare let OptionalReactNativeSessionReplay: typeof PostHogReactNativeSessionReplay | undefined;