@pulseboard/react-native 0.2.0 → 0.2.2

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/dist/index.d.mts CHANGED
@@ -1,10 +1,9 @@
1
1
  type EventType = "error" | "event" | "metric";
2
2
  type Platform = "ios" | "android" | "unknown";
3
3
  type NetworkType = "wifi" | "cellular" | "offline" | "unknown";
4
+ type Environment = "production" | "staging" | "development" | string;
4
5
  type AppContext = {
5
- appVersion?: string;
6
- buildNumber?: string;
7
- environment?: "production" | "staging" | "development";
6
+ environment?: Environment;
8
7
  };
9
8
  type UserContext = {
10
9
  userId?: string;
@@ -56,11 +55,13 @@ type PulseEvent = {
56
55
  context?: EnrichedContext;
57
56
  };
58
57
  type SDKConfig = {
59
- apiKey: string;
60
- host: string;
61
- app?: AppContext;
62
- autoCapture?: boolean;
58
+ apiKey?: string;
59
+ organisation?: string;
60
+ product?: string;
61
+ project?: string;
62
+ environment: Environment;
63
63
  debug?: boolean;
64
+ autoCapture?: boolean;
64
65
  flushInterval?: number;
65
66
  maxQueueSize?: number;
66
67
  };
@@ -71,6 +72,27 @@ type TrackOptions = {
71
72
  type CaptureErrorOptions = {
72
73
  payload?: Record<string, unknown>;
73
74
  };
75
+ type LogLevel = "debug" | "info" | "warn" | "error";
76
+ type LogEntry = {
77
+ apiKey: string;
78
+ level: LogLevel;
79
+ message: string;
80
+ meta?: Record<string, unknown>;
81
+ sessionId?: string;
82
+ appVersion?: string;
83
+ timestamp: string;
84
+ };
85
+ type LogOptions = {
86
+ meta?: Record<string, unknown>;
87
+ };
88
+ type FeedbackType = "bug" | "feature" | "general";
89
+ type FeedbackOptions = {
90
+ type?: FeedbackType;
91
+ meta?: Record<string, unknown>;
92
+ userEmail?: string;
93
+ userName?: string;
94
+ screenshot?: string;
95
+ };
74
96
 
75
97
  declare class PulseBoardSDK {
76
98
  private config;
@@ -80,24 +102,37 @@ declare class PulseBoardSDK {
80
102
  private contextCollector;
81
103
  private flushTimer;
82
104
  private initialized;
105
+ private readonly PULSEBOARD_API;
106
+ private logQueue;
107
+ private logFlushTimer;
108
+ private originalConsole;
109
+ private consoleCapturing;
110
+ private get apiKey();
83
111
  init(config: SDKConfig): void;
112
+ private resolveApiKey;
113
+ private completeInit;
84
114
  getContext(): Promise<EnrichedContext>;
85
115
  identify(user: UserContext): void;
86
116
  clearUser(): void;
87
117
  track(name: string, options?: TrackOptions): void;
88
118
  metric(name: string, value: number, options?: TrackOptions): void;
89
119
  captureError(error: Error, options?: CaptureErrorOptions): void;
120
+ log(level: LogLevel, message: string, options?: LogOptions): void;
121
+ captureConsole(): void;
122
+ releaseConsole(): void;
123
+ flushLogs(): Promise<void>;
90
124
  startSession(): void;
91
125
  endSession(duration?: number): void;
92
126
  trackScreen(screenName: string, loadTime?: number): void;
93
127
  trackApiCall(endpoint: string, httpMethod: string, statusCode: number, duration: number, payloadSize?: number): void;
94
128
  trackCrash(error: Error, isFatal?: boolean): void;
129
+ feedback(message: string, options?: FeedbackOptions): void;
95
130
  flush(): Promise<void>;
96
131
  destroy(): void;
97
132
  private buildAndEnqueue;
98
133
  private assertInitialized;
99
- private log;
134
+ private debugLog;
100
135
  }
101
136
  declare const PulseBoard: PulseBoardSDK;
102
137
 
103
- export { type AppContext, type CaptureErrorOptions, type DeviceContext, type EnrichedContext, type EventType, type NetworkContext, PulseBoard, type PulseEvent, type SDKConfig, type SessionContext, type TrackOptions, type UserContext };
138
+ export { type AppContext, type CaptureErrorOptions, type DeviceContext, type EnrichedContext, type EventType, type LogEntry, type LogLevel, type LogOptions, type NetworkContext, PulseBoard, type PulseEvent, type SDKConfig, type SessionContext, type TrackOptions, type UserContext };
package/dist/index.d.ts CHANGED
@@ -1,10 +1,9 @@
1
1
  type EventType = "error" | "event" | "metric";
2
2
  type Platform = "ios" | "android" | "unknown";
3
3
  type NetworkType = "wifi" | "cellular" | "offline" | "unknown";
4
+ type Environment = "production" | "staging" | "development" | string;
4
5
  type AppContext = {
5
- appVersion?: string;
6
- buildNumber?: string;
7
- environment?: "production" | "staging" | "development";
6
+ environment?: Environment;
8
7
  };
9
8
  type UserContext = {
10
9
  userId?: string;
@@ -56,11 +55,13 @@ type PulseEvent = {
56
55
  context?: EnrichedContext;
57
56
  };
58
57
  type SDKConfig = {
59
- apiKey: string;
60
- host: string;
61
- app?: AppContext;
62
- autoCapture?: boolean;
58
+ apiKey?: string;
59
+ organisation?: string;
60
+ product?: string;
61
+ project?: string;
62
+ environment: Environment;
63
63
  debug?: boolean;
64
+ autoCapture?: boolean;
64
65
  flushInterval?: number;
65
66
  maxQueueSize?: number;
66
67
  };
@@ -71,6 +72,27 @@ type TrackOptions = {
71
72
  type CaptureErrorOptions = {
72
73
  payload?: Record<string, unknown>;
73
74
  };
75
+ type LogLevel = "debug" | "info" | "warn" | "error";
76
+ type LogEntry = {
77
+ apiKey: string;
78
+ level: LogLevel;
79
+ message: string;
80
+ meta?: Record<string, unknown>;
81
+ sessionId?: string;
82
+ appVersion?: string;
83
+ timestamp: string;
84
+ };
85
+ type LogOptions = {
86
+ meta?: Record<string, unknown>;
87
+ };
88
+ type FeedbackType = "bug" | "feature" | "general";
89
+ type FeedbackOptions = {
90
+ type?: FeedbackType;
91
+ meta?: Record<string, unknown>;
92
+ userEmail?: string;
93
+ userName?: string;
94
+ screenshot?: string;
95
+ };
74
96
 
75
97
  declare class PulseBoardSDK {
76
98
  private config;
@@ -80,24 +102,37 @@ declare class PulseBoardSDK {
80
102
  private contextCollector;
81
103
  private flushTimer;
82
104
  private initialized;
105
+ private readonly PULSEBOARD_API;
106
+ private logQueue;
107
+ private logFlushTimer;
108
+ private originalConsole;
109
+ private consoleCapturing;
110
+ private get apiKey();
83
111
  init(config: SDKConfig): void;
112
+ private resolveApiKey;
113
+ private completeInit;
84
114
  getContext(): Promise<EnrichedContext>;
85
115
  identify(user: UserContext): void;
86
116
  clearUser(): void;
87
117
  track(name: string, options?: TrackOptions): void;
88
118
  metric(name: string, value: number, options?: TrackOptions): void;
89
119
  captureError(error: Error, options?: CaptureErrorOptions): void;
120
+ log(level: LogLevel, message: string, options?: LogOptions): void;
121
+ captureConsole(): void;
122
+ releaseConsole(): void;
123
+ flushLogs(): Promise<void>;
90
124
  startSession(): void;
91
125
  endSession(duration?: number): void;
92
126
  trackScreen(screenName: string, loadTime?: number): void;
93
127
  trackApiCall(endpoint: string, httpMethod: string, statusCode: number, duration: number, payloadSize?: number): void;
94
128
  trackCrash(error: Error, isFatal?: boolean): void;
129
+ feedback(message: string, options?: FeedbackOptions): void;
95
130
  flush(): Promise<void>;
96
131
  destroy(): void;
97
132
  private buildAndEnqueue;
98
133
  private assertInitialized;
99
- private log;
134
+ private debugLog;
100
135
  }
101
136
  declare const PulseBoard: PulseBoardSDK;
102
137
 
103
- export { type AppContext, type CaptureErrorOptions, type DeviceContext, type EnrichedContext, type EventType, type NetworkContext, PulseBoard, type PulseEvent, type SDKConfig, type SessionContext, type TrackOptions, type UserContext };
138
+ export { type AppContext, type CaptureErrorOptions, type DeviceContext, type EnrichedContext, type EventType, type LogEntry, type LogLevel, type LogOptions, type NetworkContext, PulseBoard, type PulseEvent, type SDKConfig, type SessionContext, type TrackOptions, type UserContext };