@lumin-monitor/react-native 0.1.0 → 0.4.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,96 +0,0 @@
1
- type EventType = "page" | "track" | "identify";
2
- interface WireEvent {
3
- ts?: number;
4
- session_id: string;
5
- anonymous_id?: string;
6
- user_id?: string;
7
- type: EventType;
8
- name?: string;
9
- url?: string;
10
- referrer?: string;
11
- properties?: Record<string, unknown>;
12
- trace_id?: string;
13
- }
14
- /**
15
- * Minimal AsyncStorage shape the SDK actually consumes. Matches both
16
- * @react-native-async-storage/async-storage (community) and the legacy
17
- * react-native built-in. Apps that ship a different storage backend can
18
- * implement this directly.
19
- */
20
- interface AsyncStorageLike {
21
- getItem(key: string): Promise<string | null>;
22
- setItem(key: string, value: string): Promise<void>;
23
- removeItem?(key: string): Promise<void>;
24
- }
25
- interface InitOptions {
26
- /** API key minted in the Lumin UI (settings → API keys). Must be `lmn_pub_*`. */
27
- apiKey: string;
28
- /**
29
- * Base URL of the Lumin ingest endpoint. Defaults to
30
- * `https://api.getlumin.dev`. Override only for local development against
31
- * a Lumin instance you are running yourself or for a customer-side
32
- * same-origin proxy.
33
- *
34
- * Validation: must parse as a valid URL with no path beyond `/`. `https://`
35
- * is required except when the hostname is `localhost`, `127.0.0.1`, or a
36
- * `.localhost` subdomain (where `http://` is allowed). Invalid shapes
37
- * throw synchronously from `init()` so misconfigurations surface at boot.
38
- */
39
- endpoint?: string;
40
- /** Max events to buffer before forcing a flush. Default 50. */
41
- batchSize?: number;
42
- /** Max ms between flushes. Default 500. */
43
- flushIntervalMs?: number;
44
- /**
45
- * Session idle timeout. A new session_id is minted on the next event if
46
- * the time since the last event exceeds this value. Default 30 min
47
- * (matches the industry-standard analytics convention).
48
- */
49
- sessionIdleMs?: number;
50
- /**
51
- * Optional error sink. Called with the failed batch + reason so apps can
52
- * surface drops. Default: console.warn.
53
- */
54
- onError?: (err: unknown, dropped: number) => void;
55
- /**
56
- * Override the global fetch. Tests use this to capture requests without
57
- * spinning up a network stub.
58
- */
59
- fetch?: typeof fetch;
60
- /**
61
- * Override the AsyncStorage implementation. The SDK auto-detects
62
- * `@react-native-async-storage/async-storage` when the peer dep is
63
- * installed; pass this only when you bring a different storage backend
64
- * (e.g. an MMKV-backed shim) or to disable persistence in tests.
65
- * Pass `null` explicitly to opt out of storage entirely (in-memory ids).
66
- */
67
- storage?: AsyncStorageLike | null;
68
- /**
69
- * Override the React Native AppState module. Defaults to `react-native`'s
70
- * AppState; tests pass a stub.
71
- */
72
- appState?: AppStateLike | null;
73
- }
74
- /**
75
- * Minimal AppState shape the SDK consumes (subset of react-native's AppState).
76
- * The SDK auto-detects `react-native` at runtime; pass this only for tests or
77
- * non-RN environments.
78
- */
79
- interface AppStateLike {
80
- addEventListener(type: "change", listener: (state: string) => void): {
81
- remove: () => void;
82
- };
83
- }
84
- interface LuminClient {
85
- screen(name?: string, properties?: Record<string, unknown>): void;
86
- track(name: string, properties?: Record<string, unknown>): void;
87
- identify(userId: string, traits?: Record<string, unknown>): void;
88
- flush(): Promise<void>;
89
- close(): Promise<void>;
90
- /** Current session id. Resolves once AsyncStorage hydration finishes. */
91
- getSessionId(): Promise<string>;
92
- /** Current anonymous id. Resolves once AsyncStorage hydration finishes. */
93
- getAnonymousId(): Promise<string>;
94
- }
95
-
96
- export type { AppStateLike as A, EventType as E, InitOptions as I, LuminClient as L, WireEvent as W, AsyncStorageLike as a };
@@ -1,96 +0,0 @@
1
- type EventType = "page" | "track" | "identify";
2
- interface WireEvent {
3
- ts?: number;
4
- session_id: string;
5
- anonymous_id?: string;
6
- user_id?: string;
7
- type: EventType;
8
- name?: string;
9
- url?: string;
10
- referrer?: string;
11
- properties?: Record<string, unknown>;
12
- trace_id?: string;
13
- }
14
- /**
15
- * Minimal AsyncStorage shape the SDK actually consumes. Matches both
16
- * @react-native-async-storage/async-storage (community) and the legacy
17
- * react-native built-in. Apps that ship a different storage backend can
18
- * implement this directly.
19
- */
20
- interface AsyncStorageLike {
21
- getItem(key: string): Promise<string | null>;
22
- setItem(key: string, value: string): Promise<void>;
23
- removeItem?(key: string): Promise<void>;
24
- }
25
- interface InitOptions {
26
- /** API key minted in the Lumin UI (settings → API keys). Must be `lmn_pub_*`. */
27
- apiKey: string;
28
- /**
29
- * Base URL of the Lumin ingest endpoint. Defaults to
30
- * `https://api.getlumin.dev`. Override only for local development against
31
- * a Lumin instance you are running yourself or for a customer-side
32
- * same-origin proxy.
33
- *
34
- * Validation: must parse as a valid URL with no path beyond `/`. `https://`
35
- * is required except when the hostname is `localhost`, `127.0.0.1`, or a
36
- * `.localhost` subdomain (where `http://` is allowed). Invalid shapes
37
- * throw synchronously from `init()` so misconfigurations surface at boot.
38
- */
39
- endpoint?: string;
40
- /** Max events to buffer before forcing a flush. Default 50. */
41
- batchSize?: number;
42
- /** Max ms between flushes. Default 500. */
43
- flushIntervalMs?: number;
44
- /**
45
- * Session idle timeout. A new session_id is minted on the next event if
46
- * the time since the last event exceeds this value. Default 30 min
47
- * (matches the industry-standard analytics convention).
48
- */
49
- sessionIdleMs?: number;
50
- /**
51
- * Optional error sink. Called with the failed batch + reason so apps can
52
- * surface drops. Default: console.warn.
53
- */
54
- onError?: (err: unknown, dropped: number) => void;
55
- /**
56
- * Override the global fetch. Tests use this to capture requests without
57
- * spinning up a network stub.
58
- */
59
- fetch?: typeof fetch;
60
- /**
61
- * Override the AsyncStorage implementation. The SDK auto-detects
62
- * `@react-native-async-storage/async-storage` when the peer dep is
63
- * installed; pass this only when you bring a different storage backend
64
- * (e.g. an MMKV-backed shim) or to disable persistence in tests.
65
- * Pass `null` explicitly to opt out of storage entirely (in-memory ids).
66
- */
67
- storage?: AsyncStorageLike | null;
68
- /**
69
- * Override the React Native AppState module. Defaults to `react-native`'s
70
- * AppState; tests pass a stub.
71
- */
72
- appState?: AppStateLike | null;
73
- }
74
- /**
75
- * Minimal AppState shape the SDK consumes (subset of react-native's AppState).
76
- * The SDK auto-detects `react-native` at runtime; pass this only for tests or
77
- * non-RN environments.
78
- */
79
- interface AppStateLike {
80
- addEventListener(type: "change", listener: (state: string) => void): {
81
- remove: () => void;
82
- };
83
- }
84
- interface LuminClient {
85
- screen(name?: string, properties?: Record<string, unknown>): void;
86
- track(name: string, properties?: Record<string, unknown>): void;
87
- identify(userId: string, traits?: Record<string, unknown>): void;
88
- flush(): Promise<void>;
89
- close(): Promise<void>;
90
- /** Current session id. Resolves once AsyncStorage hydration finishes. */
91
- getSessionId(): Promise<string>;
92
- /** Current anonymous id. Resolves once AsyncStorage hydration finishes. */
93
- getAnonymousId(): Promise<string>;
94
- }
95
-
96
- export type { AppStateLike as A, EventType as E, InitOptions as I, LuminClient as L, WireEvent as W, AsyncStorageLike as a };