@log-drop/web 1.0.0-alpha1

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.
@@ -0,0 +1,98 @@
1
+ export type LogLevelValue =
2
+ | "ERROR"
3
+ | "WARNING"
4
+ | "INFO"
5
+ | "DEBUG"
6
+ | "CRASH"
7
+ | "DEVICEINFO"
8
+ | "NETWORK_ACTIVITY"
9
+ | "REMOTE_MESSAGE"
10
+ | "EVENT";
11
+
12
+ export const LogLevel: Readonly<Record<string, LogLevelValue>>;
13
+
14
+ export interface LogDropNetworkConfig {
15
+ enabled?: boolean;
16
+ captureFetch?: boolean;
17
+ captureXHR?: boolean;
18
+ stripQuery?: boolean;
19
+ stripHash?: boolean;
20
+ sampleRate?: number;
21
+ onlyErrors?: boolean;
22
+ slowThresholdMs?: number;
23
+ headersAllowlist?: string[];
24
+ excludeUrls?: Array<string | RegExp>;
25
+ }
26
+
27
+ export interface LogDropConfig {
28
+ appId: string;
29
+ apiKey: string;
30
+ webSecretKey?: string | null;
31
+ baseUrl?: string;
32
+ env?: string;
33
+ release?: string;
34
+ debugLogEnabled?: boolean;
35
+ isDebugLogEnabled?: boolean;
36
+ flushIntervalMs?: number;
37
+ maxBatchSize?: number;
38
+ crashTracking?: boolean;
39
+ network?: LogDropNetworkConfig;
40
+ vapidPublicKey?: string;
41
+ manualServiceWorkerRegistration?: boolean;
42
+ serviceWorkerUrl?: string;
43
+ serviceWorkerScope?: string;
44
+ serviceWorkerRegistration?: ServiceWorkerRegistration | null;
45
+ onRemoteMessageReceived?: (payload: unknown) => void;
46
+ onSessionThreatChanged?: (threat: unknown) => void;
47
+ onRiskPolicyActionTaken?: (action: unknown) => void;
48
+ }
49
+
50
+ export class LogFlow {
51
+ constructor(name: string, id: string, customAttributes?: Record<string, unknown> | null);
52
+ name: string;
53
+ id: string;
54
+ customAttributes: Record<string, unknown> | null;
55
+ }
56
+
57
+ export interface LogDropPushApi {
58
+ subscribe(): Promise<PushSubscription | null>;
59
+ unsubscribe(): Promise<null>;
60
+ getPermissionState(): NotificationPermission | "unsupported";
61
+ }
62
+
63
+ export class LogDropClient {
64
+ push: LogDropPushApi | null;
65
+ init(config: LogDropConfig): void;
66
+ updateUser(externalId: string | null, completion?: (success: boolean) => void): Promise<void>;
67
+ e(message: unknown, flow?: LogFlow): void;
68
+ e(tag: string, message: string, flow?: LogFlow): void;
69
+ w(message: unknown, flow?: LogFlow): void;
70
+ w(tag: string, message: string, flow?: LogFlow): void;
71
+ i(message: unknown, flow?: LogFlow): void;
72
+ i(tag: string, message: string, flow?: LogFlow): void;
73
+ d(message: unknown, flow?: LogFlow): void;
74
+ d(tag: string, message: string, flow?: LogFlow): void;
75
+ log(tag: string, message: unknown, level: LogLevelValue, flow?: LogFlow | null): void;
76
+ onRemoteMessageReceived(userInfo: unknown): void;
77
+ saveCustomCrashReport(threadName: string, stackTrace: string, crashType?: string): void;
78
+ getBotSnapshot(): unknown;
79
+ refreshBotSnapshot(): unknown;
80
+ getSessionThreat(): unknown;
81
+ sendLogs(completion?: (success: boolean) => void): Promise<void>;
82
+ restoreFetch(): void;
83
+ teardown(): void;
84
+ }
85
+
86
+ export function generateUUID(): string;
87
+ export function fingerprintStack(stack: string): number;
88
+ export function capturePageState(): {
89
+ url: string;
90
+ referrer: string;
91
+ visibilityState: string;
92
+ onLine: boolean;
93
+ viewportWidth: number;
94
+ viewportHeight: number;
95
+ heapUsed: number | null;
96
+ };
97
+
98
+ export const LogDrop: LogDropClient;