@faststats/web 0.7.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.
@@ -1,124 +0,0 @@
1
- import { record } from "@rrweb/record";
2
- import { LogLevel } from "@rrweb/rrweb-plugin-console-record";
3
-
4
- //#region ../../node_modules/.bun/@rrweb+types@2.1.0/node_modules/@rrweb/types/dist/index.d.ts
5
- declare global {
6
- interface Window {
7
- FontFace: typeof FontFace;
8
- }
9
- }
10
- //#endregion
11
- //#region src/replay-mutation-throttler.d.ts
12
- type ReplayMutationThrottleOptions = {
13
- enabled?: boolean;
14
- bucketSize?: number;
15
- refillRate?: number;
16
- };
17
- //#endregion
18
- //#region src/replay.d.ts
19
- type RecordOptions = NonNullable<Parameters<typeof record>[0]>;
20
- interface ReplayTrackerOptions {
21
- siteKey: string;
22
- baseUrl?: string;
23
- debug?: boolean;
24
- trackHash?: boolean;
25
- compress?: boolean;
26
- flushInterval?: number;
27
- maxEvents?: number;
28
- maxBatchSizeBytes?: number;
29
- maxLowLatencyBatchSizeBytes?: number;
30
- maxPendingBatches?: number;
31
- maxQueueSizeBytes?: number;
32
- minReplayLengthMs?: number;
33
- sampling?: RecordOptions["sampling"];
34
- slimDOMOptions?: RecordOptions["slimDOMOptions"];
35
- maskAllInputs?: boolean;
36
- maskInputOptions?: RecordOptions["maskInputOptions"];
37
- blockClass?: string;
38
- blockSelector?: string;
39
- maskTextClass?: string;
40
- maskTextSelector?: string;
41
- checkoutEveryNms?: number;
42
- checkoutEveryNth?: number;
43
- recordConsole?: boolean;
44
- consoleLevel?: LogLevel[];
45
- consoleLengthThreshold?: number;
46
- consoleStringLengthLimit?: number;
47
- mutationThrottle?: ReplayMutationThrottleOptions;
48
- }
49
- declare class ReplayTracker {
50
- private readonly options;
51
- private readonly endpoint;
52
- private readonly compressionSupported;
53
- private readonly flushInterval;
54
- private readonly maxEvents;
55
- private readonly maxBatchSizeBytes;
56
- private readonly maxLowLatencyBatchSizeBytes;
57
- private readonly maxPendingBatches;
58
- private readonly maxQueueSizeBytes;
59
- private readonly minReplayLengthMs;
60
- private readonly events;
61
- private readonly pending;
62
- private readonly minLengthBlockedBatches;
63
- private queuedEventsSizeBytes;
64
- private pendingSizeBytes;
65
- private viewId;
66
- private viewUrl;
67
- private chunkStartedAt;
68
- private started;
69
- private disposed;
70
- private startGeneration;
71
- private startTime;
72
- private sequence;
73
- private intervalId;
74
- private flushTask;
75
- private retryTask;
76
- private retryAttempt;
77
- private minLengthFlushTask;
78
- private stopRecording?;
79
- private sending;
80
- private inFlightBatch;
81
- private queuedFlush;
82
- private unsubscribeRotation?;
83
- private lastCookielessMode;
84
- private terminalFlushRequested;
85
- private overflowed;
86
- private readonly mutationThrottler;
87
- constructor(options: ReplayTrackerOptions);
88
- private log;
89
- private clearFlushTimers;
90
- private clearQueues;
91
- private dropMinLengthBlockedBatches;
92
- private unblockSessionBatches;
93
- private finalizeSessionPending;
94
- private nextBatchSequence;
95
- setCookielessMode(cookieless: boolean): void;
96
- start(): void;
97
- trackPageChange(url?: string): void;
98
- onPageHidden(persisted?: boolean, terminal?: boolean): void;
99
- onPageShow(persisted?: boolean): void;
100
- private beginRecording;
101
- stop(discard?: boolean): void;
102
- private onSessionRotated;
103
- private applySessionRotation;
104
- private resetSessionTiming;
105
- private onEvent;
106
- private onUnload;
107
- private requestTerminalFlush;
108
- private hasReachedMinLength;
109
- private requestFlush;
110
- private scheduleMinLengthFlush;
111
- private enqueueEventsIfReady;
112
- private takeEventBatches;
113
- private createBatch;
114
- private eventSizeBytes;
115
- private batchSizeBytes;
116
- private removePending;
117
- private enqueueBatch;
118
- private flush;
119
- private scheduleRetry;
120
- private retryDelay;
121
- private sendBatch;
122
- }
123
- //#endregion
124
- export { ReplayTrackerOptions as n, ReplayTracker as t };
@@ -1,18 +0,0 @@
1
- //#region src/feature-flags.d.ts
2
- type FeatureFlagEvaluation = {
3
- value: string;
4
- variantKey?: string;
5
- variantValue?: string;
6
- };
7
- type FeatureFlagCheckContext = {
8
- baseUrl?: string;
9
- projectToken?: string;
10
- identifier?: string;
11
- externalId?: string;
12
- sessionId?: string;
13
- attributes?: Record<string, unknown>;
14
- signal?: AbortSignal;
15
- };
16
- declare function fetchFeatureFlagEvaluation(flagKey: string, context: FeatureFlagCheckContext): Promise<FeatureFlagEvaluation>;
17
- //#endregion
18
- export { FeatureFlagCheckContext, FeatureFlagEvaluation, fetchFeatureFlagEvaluation };
@@ -1,32 +0,0 @@
1
- import { a as resolveBaseUrl, n as FEATURE_FLAGS_BASE, r as URLS } from "./chunks/api-urls-Dp2XNjRF.js";
2
- //#region src/feature-flags.ts
3
- async function fetchFeatureFlagEvaluation(flagKey, context) {
4
- if (!context.projectToken) throw new Error("feature flag check requires projectToken");
5
- if (!context.identifier && !context.externalId) throw new Error("feature flag check requires serverId or externalId");
6
- const { baseUrl, projectToken, signal, attributes, ...bodyFields } = context;
7
- const body = {
8
- key: flagKey,
9
- ...bodyFields
10
- };
11
- if (attributes && Object.keys(attributes).length > 0) body.attributes = attributes;
12
- const headers = {
13
- "Content-Type": "application/json",
14
- Authorization: `Bearer ${projectToken}`
15
- };
16
- const url = `${resolveBaseUrl(baseUrl, FEATURE_FLAGS_BASE)}${URLS.flags}`;
17
- const res = await fetch(url, {
18
- method: "POST",
19
- headers,
20
- body: JSON.stringify(body),
21
- credentials: "omit",
22
- signal
23
- });
24
- if (!res.ok) {
25
- const err = await res.json().catch(() => null);
26
- const detail = typeof err?.error === "string" && err.error.length > 0 ? ` — ${err.error}` : "";
27
- throw new Error(`feature flag check failed: HTTP ${res.status}${detail}`);
28
- }
29
- return await res.json();
30
- }
31
- //#endregion
32
- export { fetchFeatureFlagEvaluation };