posthog-js-lite 3.5.0 → 3.6.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.
@@ -1,179 +0,0 @@
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,3 +0,0 @@
1
- import { PostHog } from './src/posthog-web';
2
- export default PostHog;
3
- export * from './src/posthog-web';
@@ -1 +0,0 @@
1
- export declare function getContext(window: Window | undefined): any;
@@ -1,19 +0,0 @@
1
- import { PostHogCore, PostHogFetchOptions, PostHogFetchResponse, PostHogPersistedProperty } from '../../posthog-core/src';
2
- import { PostHogOptions } from './types';
3
- export declare class PostHog extends PostHogCore {
4
- private _storage;
5
- private _storageCache;
6
- private _storageKey;
7
- private _lastPathname;
8
- constructor(apiKey: string, options?: PostHogOptions);
9
- private getWindow;
10
- getPersistedProperty<T>(key: PostHogPersistedProperty): T | undefined;
11
- setPersistedProperty<T>(key: PostHogPersistedProperty, value: T | null): void;
12
- fetch(url: string, options: PostHogFetchOptions): Promise<PostHogFetchResponse>;
13
- getLibraryId(): string;
14
- getLibraryVersion(): string;
15
- getCustomUserAgent(): void;
16
- getCommonEventProperties(): any;
17
- private setupHistoryEventTracking;
18
- private captureNavigationEvent;
19
- }
@@ -1,10 +0,0 @@
1
- import { PostHogOptions } from './types';
2
- export type PostHogStorage = {
3
- getItem: (key: string) => string | null | undefined;
4
- setItem: (key: string, value: string) => void;
5
- removeItem: (key: string) => void;
6
- clear: () => void;
7
- getAllKeys: () => readonly string[];
8
- };
9
- export declare const cookieStore: PostHogStorage;
10
- export declare const getStorage: (type: PostHogOptions['persistence'], window: Window | undefined) => PostHogStorage;
@@ -1,7 +0,0 @@
1
- import { PostHogCoreOptions } from '../../posthog-core/src';
2
- export type PostHogOptions = {
3
- autocapture?: boolean;
4
- persistence?: 'localStorage' | 'sessionStorage' | 'cookie' | 'memory';
5
- persistence_name?: string;
6
- captureHistoryEvents?: boolean;
7
- } & PostHogCoreOptions;