@faststats/web 0.6.0 → 0.8.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.
- package/README.md +67 -0
- package/dist/chunks/api-urls-DWk43fu6.js +53 -0
- package/dist/chunks/extensions-DW7tJY0T.d.ts +51 -0
- package/dist/chunks/identifiers-KgQDX74Q.js +21 -0
- package/dist/chunks/send-data-DFZnsaL2.js +219 -0
- package/dist/error.d.ts +9 -4
- package/dist/error.js +89 -59
- package/dist/index.d.ts +54 -72
- package/dist/index.js +349 -353
- package/dist/outbound-links.d.ts +10 -0
- package/dist/outbound-links.js +62 -0
- package/dist/replay.d.ts +128 -2
- package/dist/replay.js +154 -62
- package/dist/web-vitals.d.ts +10 -5
- package/dist/web-vitals.js +56 -50
- package/package.json +11 -12
- package/dist/chunks/api-urls-CaNa8upY.js +0 -45
- package/dist/chunks/identifiers-cUymVK5H.js +0 -20
- package/dist/chunks/replay-DgodPHzA.d.ts +0 -104
- package/dist/chunks/send-data-DjdbGDDc.js +0 -196
- package/dist/feature-flags.d.ts +0 -18
- package/dist/feature-flags.js +0 -32
package/dist/index.d.ts
CHANGED
|
@@ -1,60 +1,40 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as ReplayTrackerOptions } from "./chunks/replay-DgodPHzA.js";
|
|
3
|
-
|
|
1
|
+
import { a as ExtensionHook, i as ExtensionHandler, n as AnalyticsExtensionContext, o as ExtensionHooks, r as ExtensionCleanup, t as AnalyticsExtension } from "./chunks/extensions-DW7tJY0T.js";
|
|
4
2
|
//#region src/analytics.d.ts
|
|
5
|
-
type ConsentMode = "
|
|
6
|
-
type PendingBehavior = "anonymous" | "disabled";
|
|
3
|
+
type ConsentMode = "anonymous" | "granted" | "denied";
|
|
7
4
|
interface IdentifyOptions {
|
|
8
|
-
name?: string;
|
|
9
|
-
phone?: string;
|
|
10
|
-
avatarUrl?: string;
|
|
5
|
+
name?: string | null;
|
|
6
|
+
phone?: string | null;
|
|
7
|
+
avatarUrl?: string | null;
|
|
11
8
|
traits?: Record<string, unknown>;
|
|
9
|
+
traitMode?: "merge" | "replace";
|
|
10
|
+
unsetTraits?: string[];
|
|
11
|
+
aliases?: string[];
|
|
12
|
+
}
|
|
13
|
+
interface IdentifyUser extends IdentifyOptions {
|
|
14
|
+
id: string;
|
|
15
|
+
email?: string | null;
|
|
12
16
|
}
|
|
13
17
|
interface WebAnalyticsOptions {
|
|
14
18
|
siteKey: string;
|
|
15
19
|
baseUrl?: string;
|
|
16
|
-
featureFlagsBaseUrl?: string;
|
|
17
20
|
debug?: boolean;
|
|
18
|
-
autoTrack?: boolean;
|
|
19
21
|
trackHash?: boolean;
|
|
20
22
|
cookieless?: boolean;
|
|
21
|
-
consent?:
|
|
22
|
-
|
|
23
|
-
pendingBehavior?: PendingBehavior;
|
|
24
|
-
};
|
|
25
|
-
webVitals?: {
|
|
26
|
-
enabled?: boolean;
|
|
27
|
-
attribution?: boolean;
|
|
28
|
-
};
|
|
29
|
-
sessionReplays?: {
|
|
30
|
-
enabled?: boolean;
|
|
31
|
-
};
|
|
32
|
-
errorTracking?: {
|
|
33
|
-
enabled?: boolean;
|
|
34
|
-
};
|
|
35
|
-
replayOptions?: Partial<ReplayTrackerOptions>;
|
|
23
|
+
consent?: ConsentMode;
|
|
24
|
+
extensions?: readonly AnalyticsExtension[];
|
|
36
25
|
/** @internal */
|
|
37
26
|
sdkName?: string;
|
|
38
27
|
/** @internal */
|
|
39
28
|
sdkVersion?: string;
|
|
40
29
|
}
|
|
41
|
-
declare function getInstance(): WebAnalytics | null;
|
|
42
|
-
declare function trackEvent(eventName: string, properties?: Record<string, unknown>): void;
|
|
43
|
-
declare function identify(externalId: string, email: string, options?: IdentifyOptions): Promise<boolean>;
|
|
44
|
-
declare function logout(resetAnonymousIdentity?: boolean): void;
|
|
45
|
-
declare function setConsentMode(mode: ConsentMode): void;
|
|
46
|
-
declare function optIn(): void;
|
|
47
|
-
declare function optOut(): void;
|
|
48
|
-
declare function reportError(error: Error): void;
|
|
49
|
-
declare function isTrackingDisabled(): boolean;
|
|
50
30
|
declare class WebAnalytics {
|
|
51
31
|
private readonly options;
|
|
52
32
|
private readonly baseUrl;
|
|
53
33
|
private readonly debug;
|
|
34
|
+
private readonly cleanup;
|
|
54
35
|
private started;
|
|
55
|
-
private destroyed;
|
|
56
|
-
private epoch;
|
|
57
36
|
private heartbeatTimer;
|
|
37
|
+
private extensions;
|
|
58
38
|
private pageKey;
|
|
59
39
|
private entry;
|
|
60
40
|
private left;
|
|
@@ -62,51 +42,53 @@ declare class WebAnalytics {
|
|
|
62
42
|
private visitStartedAt;
|
|
63
43
|
private pendingPageviewTrigger;
|
|
64
44
|
private consentMode;
|
|
65
|
-
private readonly pendingBehavior;
|
|
66
|
-
private readonly cleanup;
|
|
67
|
-
private readonly childTrackers;
|
|
68
|
-
private readonly outboundLinks;
|
|
69
45
|
constructor(options: WebAnalyticsOptions);
|
|
70
|
-
|
|
71
|
-
private isTrackingBlocked;
|
|
72
|
-
private ensureActive;
|
|
73
|
-
private canTrack;
|
|
74
|
-
private canSendEvents;
|
|
75
|
-
private cookieless;
|
|
76
|
-
private touch;
|
|
77
|
-
private bind;
|
|
78
|
-
private stopHeartbeat;
|
|
79
|
-
private loadChild;
|
|
80
|
-
private loadOptionalTrackers;
|
|
81
|
-
private enterPage;
|
|
82
|
-
private beginTracking;
|
|
83
|
-
private readonly onLinkClick;
|
|
84
|
-
private readonly onVisibilityChange;
|
|
85
|
-
private readonly onPageHide;
|
|
86
|
-
private readonly onPageShow;
|
|
87
|
-
start(): Promise<void>;
|
|
46
|
+
start(): void;
|
|
88
47
|
destroy(): void;
|
|
89
|
-
pageview(
|
|
90
|
-
track(name: string,
|
|
91
|
-
identify(
|
|
48
|
+
pageview(properties?: Record<string, unknown>): void;
|
|
49
|
+
track(name: string, properties?: Record<string, unknown>): void;
|
|
50
|
+
identify(user: IdentifyUser): Promise<boolean>;
|
|
51
|
+
identify(externalId: string, email?: string, options?: IdentifyOptions): Promise<boolean>;
|
|
92
52
|
logout(resetAnonymousIdentity?: boolean): void;
|
|
93
53
|
setConsentMode(mode: ConsentMode): void;
|
|
94
|
-
getConsentMode(): ConsentMode;
|
|
95
54
|
getAnonymousId(): string;
|
|
96
|
-
getSessionId(): string;
|
|
97
|
-
getWindowId(): string;
|
|
98
|
-
checkFeatureFlag(key: string, attributes?: Record<string, unknown>, opts?: {
|
|
99
|
-
externalId?: string;
|
|
100
|
-
signal?: AbortSignal;
|
|
101
|
-
}): Promise<FeatureFlagEvaluation>;
|
|
102
55
|
reportError(error: Error): void;
|
|
103
|
-
private
|
|
56
|
+
private canTrack;
|
|
57
|
+
private isCookieless;
|
|
58
|
+
private ensureActive;
|
|
59
|
+
private activate;
|
|
60
|
+
private startExtensions;
|
|
61
|
+
private stopExtensions;
|
|
62
|
+
private installBrowserLifecycle;
|
|
63
|
+
private bind;
|
|
64
|
+
private readonly onNavigate;
|
|
65
|
+
private readonly onVisibilityChange;
|
|
66
|
+
private readonly onPageHide;
|
|
67
|
+
private readonly onPageShow;
|
|
68
|
+
private navigate;
|
|
69
|
+
private enterPage;
|
|
104
70
|
private leavePage;
|
|
105
|
-
private startVisit;
|
|
106
71
|
private pauseVisit;
|
|
107
72
|
private resumeVisit;
|
|
73
|
+
private touch;
|
|
108
74
|
private startHeartbeat;
|
|
109
|
-
private
|
|
75
|
+
private stopHeartbeat;
|
|
76
|
+
private send;
|
|
110
77
|
}
|
|
111
78
|
//#endregion
|
|
112
|
-
|
|
79
|
+
//#region src/client.d.ts
|
|
80
|
+
/** Creates an independent client. Call `start()` when it should begin tracking. */
|
|
81
|
+
declare function createClient(options: WebAnalyticsOptions): WebAnalytics;
|
|
82
|
+
/** Initializes and starts the shared client used by the convenience functions. */
|
|
83
|
+
declare function init(options: WebAnalyticsOptions): WebAnalytics;
|
|
84
|
+
/** Stops and forgets the shared client. Independent clients are unaffected. */
|
|
85
|
+
declare function shutdown(): void;
|
|
86
|
+
declare function pageview(properties?: Record<string, unknown>): void;
|
|
87
|
+
declare function track(name: string, properties?: Record<string, unknown>): void;
|
|
88
|
+
declare function identify(user: IdentifyUser): Promise<boolean>;
|
|
89
|
+
declare function identify(externalId: string, email?: string, options?: IdentifyOptions): Promise<boolean>;
|
|
90
|
+
declare function logout(resetAnonymousIdentity?: boolean): void;
|
|
91
|
+
declare function setConsentMode(mode: ConsentMode): void;
|
|
92
|
+
declare function reportError(error: Error): void;
|
|
93
|
+
//#endregion
|
|
94
|
+
export { type AnalyticsExtension, type AnalyticsExtensionContext, type ConsentMode, type ExtensionCleanup, type ExtensionHandler, type ExtensionHook, type ExtensionHooks, type IdentifyOptions, type IdentifyUser, WebAnalytics, type WebAnalyticsOptions, createClient, identify, init, logout, pageview, reportError, setConsentMode, shutdown, track };
|