@blipit/react-native 0.3.0 → 0.5.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/dist/index.d.cts CHANGED
@@ -1,7 +1,110 @@
1
- import { ReactNativeOptions } from '@sentry/react-native';
2
- export { addBreadcrumb, captureException, captureMessage, flush, setTag, setUser, wrap } from '@sentry/react-native';
3
1
  import * as react from 'react';
4
- import { ReactNode } from 'react';
2
+ import { Component, ReactNode, ComponentType } from 'react';
3
+
4
+ declare const VERSION = "0.5.0";
5
+ declare const DEFAULT_ENDPOINT = "https://in.blipit.io";
6
+ type Level = "fatal" | "error" | "warning" | "info" | "debug";
7
+ type SeverityLevel = Level;
8
+ interface Breadcrumb {
9
+ category?: string;
10
+ message?: string;
11
+ level?: Level;
12
+ data?: Record<string, unknown>;
13
+ timestamp?: string | number;
14
+ type?: string;
15
+ }
16
+ interface User {
17
+ id?: string | number;
18
+ email?: string;
19
+ username?: string;
20
+ }
21
+ interface StackFrame {
22
+ filename: string;
23
+ function?: string;
24
+ lineno?: number;
25
+ colno?: number;
26
+ in_app: boolean;
27
+ }
28
+ interface Contexts {
29
+ os?: {
30
+ name?: string;
31
+ version?: string;
32
+ };
33
+ device?: {
34
+ model?: string;
35
+ screen?: string;
36
+ };
37
+ runtime?: {
38
+ name?: string;
39
+ version?: string;
40
+ };
41
+ }
42
+ interface BlipitEvent {
43
+ event_id: string;
44
+ timestamp: string;
45
+ platform: "react-native";
46
+ level: Level;
47
+ message?: string;
48
+ exception?: {
49
+ type: string;
50
+ value: string;
51
+ handled: boolean;
52
+ stacktrace?: {
53
+ frames: StackFrame[];
54
+ };
55
+ };
56
+ security?: Record<string, string>;
57
+ release?: string;
58
+ environment: string;
59
+ user?: {
60
+ id?: string;
61
+ email?: string;
62
+ username?: string;
63
+ };
64
+ tags?: Record<string, string>;
65
+ breadcrumbs?: Array<{
66
+ timestamp: string;
67
+ category: string;
68
+ message?: string;
69
+ level?: string;
70
+ data?: Record<string, unknown>;
71
+ }>;
72
+ contexts?: Contexts;
73
+ sdk: {
74
+ name: string;
75
+ version: string;
76
+ };
77
+ }
78
+
79
+ type NavigationRef = {
80
+ addListener: (event: "state", cb: () => void) => () => void;
81
+ getCurrentRoute: () => {
82
+ name: string;
83
+ } | undefined;
84
+ };
85
+
86
+ interface ErrorBoundaryProps {
87
+ children?: ReactNode;
88
+ fallback?: ReactNode | ((props: {
89
+ error: unknown;
90
+ resetError: () => void;
91
+ }) => ReactNode);
92
+ onError?: (error: unknown, eventId: string | undefined) => void;
93
+ }
94
+ declare class ErrorBoundary extends Component<ErrorBoundaryProps, {
95
+ error: unknown;
96
+ }> {
97
+ state: {
98
+ error: unknown;
99
+ };
100
+ static getDerivedStateFromError(error: unknown): {
101
+ error: unknown;
102
+ };
103
+ componentDidCatch(error: unknown): void;
104
+ resetError: () => void;
105
+ render(): ReactNode;
106
+ }
107
+ declare function wrap<P extends object>(Root: ComponentType<P>, options?: Omit<ErrorBoundaryProps, "children">): ComponentType<P>;
5
108
 
6
109
  declare function showReport(): void;
7
110
  declare function BlipitReporter({ children, showButton }: {
@@ -9,15 +112,23 @@ declare function BlipitReporter({ children, showButton }: {
9
112
  showButton?: boolean;
10
113
  }): react.JSX.Element;
11
114
 
12
- declare const DEFAULT_ENDPOINT = "https://in.blipit.io";
13
- declare const VERSION = "0.3.0";
14
- type BeforeSend = NonNullable<ReactNativeOptions["beforeSend"]>;
15
- declare function withIdentity(user?: BeforeSend): BeforeSend;
16
- interface BlipitOptions extends Omit<ReactNativeOptions, "dsn"> {
115
+ interface BlipitOptions {
17
116
  key?: string;
18
117
  publicKey?: string;
19
118
  project: string | number;
20
119
  endpoint?: string;
120
+ environment?: string;
121
+ release?: string;
122
+ sampleRate?: number;
123
+ tracesSampleRate?: number;
124
+ maxBreadcrumbs?: number;
125
+ ignoreErrors?: Array<string | RegExp>;
126
+ beforeSend?: (event: BlipitEvent) => BlipitEvent | null;
127
+ enabled?: boolean;
128
+ debug?: boolean;
129
+ autoSessionTracking?: boolean;
130
+ enableNative?: boolean;
131
+ waitForReady?: boolean;
21
132
  }
22
133
  interface SecurityDetails {
23
134
  outcome?: string;
@@ -26,8 +137,23 @@ interface SecurityDetails {
26
137
  userAgent?: string;
27
138
  target?: string;
28
139
  }
29
- declare function dsn(key: string, project: string | number, endpoint?: string): string;
30
140
  declare function init(options: BlipitOptions): boolean;
31
- declare function captureSecurity(kind: string, actor: string, details?: SecurityDetails): void;
141
+ declare function reportReady(): void;
142
+ declare function startFlow(name: string): void;
143
+ declare function flowStep(name: string, step: string): void;
144
+ declare function endFlow(name: string): void;
145
+ declare function captureException(error: unknown): string | undefined;
146
+ declare function captureMessage(message: string, level?: Level): string | undefined;
147
+ declare function captureSecurity(kind: string, actor: string, details?: SecurityDetails): string | undefined;
148
+ declare function setUser(user: User | null): void;
149
+ declare function setTag(key: string, value: string): void;
150
+ declare function addBreadcrumb(crumb: Breadcrumb): void;
151
+ declare function flush(timeout?: number): Promise<boolean>;
152
+ declare function setEnabled(on: boolean): void;
153
+ declare const isEnabled: () => boolean;
154
+ declare const lastEventId: () => string | undefined;
155
+ declare function setReplayConsent(granted: boolean): void;
156
+ declare function hasReplayConsent(): boolean;
157
+ declare const trackNavigation: (ref: NavigationRef) => (() => void);
32
158
 
33
- export { type BlipitOptions, BlipitReporter, DEFAULT_ENDPOINT, type SecurityDetails, VERSION, captureSecurity, dsn, init, showReport, withIdentity };
159
+ export { type BlipitEvent, type BlipitOptions, BlipitReporter, type Breadcrumb, DEFAULT_ENDPOINT, ErrorBoundary, type ErrorBoundaryProps, type Level, type NavigationRef, type SecurityDetails, type SeverityLevel, type User, VERSION, addBreadcrumb, captureException, captureMessage, captureSecurity, endFlow, flowStep, flush, hasReplayConsent, init, isEnabled, lastEventId, reportReady, setEnabled, setReplayConsent, setTag, setUser, showReport, startFlow, trackNavigation, wrap };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,110 @@
1
- import { ReactNativeOptions } from '@sentry/react-native';
2
- export { addBreadcrumb, captureException, captureMessage, flush, setTag, setUser, wrap } from '@sentry/react-native';
3
1
  import * as react from 'react';
4
- import { ReactNode } from 'react';
2
+ import { Component, ReactNode, ComponentType } from 'react';
3
+
4
+ declare const VERSION = "0.5.0";
5
+ declare const DEFAULT_ENDPOINT = "https://in.blipit.io";
6
+ type Level = "fatal" | "error" | "warning" | "info" | "debug";
7
+ type SeverityLevel = Level;
8
+ interface Breadcrumb {
9
+ category?: string;
10
+ message?: string;
11
+ level?: Level;
12
+ data?: Record<string, unknown>;
13
+ timestamp?: string | number;
14
+ type?: string;
15
+ }
16
+ interface User {
17
+ id?: string | number;
18
+ email?: string;
19
+ username?: string;
20
+ }
21
+ interface StackFrame {
22
+ filename: string;
23
+ function?: string;
24
+ lineno?: number;
25
+ colno?: number;
26
+ in_app: boolean;
27
+ }
28
+ interface Contexts {
29
+ os?: {
30
+ name?: string;
31
+ version?: string;
32
+ };
33
+ device?: {
34
+ model?: string;
35
+ screen?: string;
36
+ };
37
+ runtime?: {
38
+ name?: string;
39
+ version?: string;
40
+ };
41
+ }
42
+ interface BlipitEvent {
43
+ event_id: string;
44
+ timestamp: string;
45
+ platform: "react-native";
46
+ level: Level;
47
+ message?: string;
48
+ exception?: {
49
+ type: string;
50
+ value: string;
51
+ handled: boolean;
52
+ stacktrace?: {
53
+ frames: StackFrame[];
54
+ };
55
+ };
56
+ security?: Record<string, string>;
57
+ release?: string;
58
+ environment: string;
59
+ user?: {
60
+ id?: string;
61
+ email?: string;
62
+ username?: string;
63
+ };
64
+ tags?: Record<string, string>;
65
+ breadcrumbs?: Array<{
66
+ timestamp: string;
67
+ category: string;
68
+ message?: string;
69
+ level?: string;
70
+ data?: Record<string, unknown>;
71
+ }>;
72
+ contexts?: Contexts;
73
+ sdk: {
74
+ name: string;
75
+ version: string;
76
+ };
77
+ }
78
+
79
+ type NavigationRef = {
80
+ addListener: (event: "state", cb: () => void) => () => void;
81
+ getCurrentRoute: () => {
82
+ name: string;
83
+ } | undefined;
84
+ };
85
+
86
+ interface ErrorBoundaryProps {
87
+ children?: ReactNode;
88
+ fallback?: ReactNode | ((props: {
89
+ error: unknown;
90
+ resetError: () => void;
91
+ }) => ReactNode);
92
+ onError?: (error: unknown, eventId: string | undefined) => void;
93
+ }
94
+ declare class ErrorBoundary extends Component<ErrorBoundaryProps, {
95
+ error: unknown;
96
+ }> {
97
+ state: {
98
+ error: unknown;
99
+ };
100
+ static getDerivedStateFromError(error: unknown): {
101
+ error: unknown;
102
+ };
103
+ componentDidCatch(error: unknown): void;
104
+ resetError: () => void;
105
+ render(): ReactNode;
106
+ }
107
+ declare function wrap<P extends object>(Root: ComponentType<P>, options?: Omit<ErrorBoundaryProps, "children">): ComponentType<P>;
5
108
 
6
109
  declare function showReport(): void;
7
110
  declare function BlipitReporter({ children, showButton }: {
@@ -9,15 +112,23 @@ declare function BlipitReporter({ children, showButton }: {
9
112
  showButton?: boolean;
10
113
  }): react.JSX.Element;
11
114
 
12
- declare const DEFAULT_ENDPOINT = "https://in.blipit.io";
13
- declare const VERSION = "0.3.0";
14
- type BeforeSend = NonNullable<ReactNativeOptions["beforeSend"]>;
15
- declare function withIdentity(user?: BeforeSend): BeforeSend;
16
- interface BlipitOptions extends Omit<ReactNativeOptions, "dsn"> {
115
+ interface BlipitOptions {
17
116
  key?: string;
18
117
  publicKey?: string;
19
118
  project: string | number;
20
119
  endpoint?: string;
120
+ environment?: string;
121
+ release?: string;
122
+ sampleRate?: number;
123
+ tracesSampleRate?: number;
124
+ maxBreadcrumbs?: number;
125
+ ignoreErrors?: Array<string | RegExp>;
126
+ beforeSend?: (event: BlipitEvent) => BlipitEvent | null;
127
+ enabled?: boolean;
128
+ debug?: boolean;
129
+ autoSessionTracking?: boolean;
130
+ enableNative?: boolean;
131
+ waitForReady?: boolean;
21
132
  }
22
133
  interface SecurityDetails {
23
134
  outcome?: string;
@@ -26,8 +137,23 @@ interface SecurityDetails {
26
137
  userAgent?: string;
27
138
  target?: string;
28
139
  }
29
- declare function dsn(key: string, project: string | number, endpoint?: string): string;
30
140
  declare function init(options: BlipitOptions): boolean;
31
- declare function captureSecurity(kind: string, actor: string, details?: SecurityDetails): void;
141
+ declare function reportReady(): void;
142
+ declare function startFlow(name: string): void;
143
+ declare function flowStep(name: string, step: string): void;
144
+ declare function endFlow(name: string): void;
145
+ declare function captureException(error: unknown): string | undefined;
146
+ declare function captureMessage(message: string, level?: Level): string | undefined;
147
+ declare function captureSecurity(kind: string, actor: string, details?: SecurityDetails): string | undefined;
148
+ declare function setUser(user: User | null): void;
149
+ declare function setTag(key: string, value: string): void;
150
+ declare function addBreadcrumb(crumb: Breadcrumb): void;
151
+ declare function flush(timeout?: number): Promise<boolean>;
152
+ declare function setEnabled(on: boolean): void;
153
+ declare const isEnabled: () => boolean;
154
+ declare const lastEventId: () => string | undefined;
155
+ declare function setReplayConsent(granted: boolean): void;
156
+ declare function hasReplayConsent(): boolean;
157
+ declare const trackNavigation: (ref: NavigationRef) => (() => void);
32
158
 
33
- export { type BlipitOptions, BlipitReporter, DEFAULT_ENDPOINT, type SecurityDetails, VERSION, captureSecurity, dsn, init, showReport, withIdentity };
159
+ export { type BlipitEvent, type BlipitOptions, BlipitReporter, type Breadcrumb, DEFAULT_ENDPOINT, ErrorBoundary, type ErrorBoundaryProps, type Level, type NavigationRef, type SecurityDetails, type SeverityLevel, type User, VERSION, addBreadcrumb, captureException, captureMessage, captureSecurity, endFlow, flowStep, flush, hasReplayConsent, init, isEnabled, lastEventId, reportReady, setEnabled, setReplayConsent, setTag, setUser, showReport, startFlow, trackNavigation, wrap };