@multiplayer-app/session-recorder-react-native 0.0.1-alpha.1 → 0.0.1-alpha.10
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/RRWEB_INTEGRATION.md +336 -0
- package/VIEWSHOT_INTEGRATION_TEST.md +123 -0
- package/copy-react-native-dist.sh +38 -0
- package/dist/components/GestureCaptureWrapper/GestureCaptureWrapper.d.ts +6 -0
- package/dist/components/GestureCaptureWrapper/GestureCaptureWrapper.js +1 -0
- package/dist/components/GestureCaptureWrapper/GestureCaptureWrapper.js.map +1 -0
- package/dist/components/GestureCaptureWrapper/index.d.ts +1 -0
- package/dist/components/GestureCaptureWrapper/index.js +1 -0
- package/dist/components/GestureCaptureWrapper/index.js.map +1 -0
- package/dist/components/GestureCaptureWrapper.d.ts +6 -0
- package/dist/components/GestureCaptureWrapper.js +1 -0
- package/dist/components/GestureCaptureWrapper.js.map +1 -0
- package/dist/components/ScreenRecorderView/ScreenRecorderView.d.ts +5 -0
- package/dist/components/ScreenRecorderView/ScreenRecorderView.js +1 -0
- package/dist/components/ScreenRecorderView/ScreenRecorderView.js.map +1 -0
- package/dist/components/ScreenRecorderView/index.d.ts +1 -0
- package/dist/components/ScreenRecorderView/index.js +1 -0
- package/dist/components/ScreenRecorderView/index.js.map +1 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/components/index.js.map +1 -0
- package/dist/config/constants.d.ts +18 -0
- package/dist/config/constants.js +1 -0
- package/dist/config/constants.js.map +1 -0
- package/dist/config/defaults.d.ts +4 -0
- package/dist/config/defaults.js +1 -0
- package/dist/config/defaults.js.map +1 -0
- package/dist/config/index.d.ts +5 -0
- package/dist/config/index.js +1 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/masking.d.ts +2 -30
- package/dist/config/masking.js +1 -1
- package/dist/config/masking.js.map +1 -1
- package/dist/config/session-recorder.d.ts +2 -0
- package/dist/config/session-recorder.js +1 -0
- package/dist/config/session-recorder.js.map +1 -0
- package/dist/config/validators.d.ts +10 -0
- package/dist/config/validators.js +1 -0
- package/dist/config/validators.js.map +1 -0
- package/dist/context/SessionRecorderContext.d.ts +12 -0
- package/dist/context/SessionRecorderContext.js +1 -0
- package/dist/context/SessionRecorderContext.js.map +1 -0
- package/dist/expo.d.ts +5 -9
- package/dist/expo.js +1 -1
- package/dist/expo.js.map +1 -1
- package/dist/index.d.ts +6 -10
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/otel/helpers.d.ts +45 -3
- package/dist/otel/helpers.js +1 -1
- package/dist/otel/helpers.js.map +1 -1
- package/dist/otel/index.d.ts +4 -25
- package/dist/otel/index.js +1 -1
- package/dist/otel/index.js.map +1 -1
- package/dist/otel/instrumentations/gestureInstrumentation.js +1 -1
- package/dist/otel/instrumentations/gestureInstrumentation.js.map +1 -1
- package/dist/otel/instrumentations/index.d.ts +3 -4
- package/dist/otel/instrumentations/index.js +1 -1
- package/dist/otel/instrumentations/index.js.map +1 -1
- package/dist/otel/instrumentations/reactNativeInstrumentation.js +1 -1
- package/dist/otel/instrumentations/reactNativeInstrumentation.js.map +1 -1
- package/dist/otel/instrumentations/reactNavigationInstrumentation.d.ts +1 -0
- package/dist/otel/instrumentations/reactNavigationInstrumentation.js +1 -1
- package/dist/otel/instrumentations/reactNavigationInstrumentation.js.map +1 -1
- package/dist/patch/index.d.ts +1 -0
- package/dist/patch/index.js +1 -0
- package/dist/patch/index.js.map +1 -0
- package/dist/patch/xhr.d.ts +2 -0
- package/dist/patch/xhr.js +1 -0
- package/dist/patch/xhr.js.map +1 -0
- package/dist/recorder/eventExporter.d.ts +21 -0
- package/dist/recorder/eventExporter.js +1 -0
- package/dist/recorder/eventExporter.js.map +1 -0
- package/dist/recorder/gestureHandlerRecorder.d.ts +19 -0
- package/dist/recorder/gestureHandlerRecorder.js +1 -0
- package/dist/recorder/gestureHandlerRecorder.js.map +1 -0
- package/dist/recorder/gestureRecorder.d.ts +68 -11
- package/dist/recorder/gestureRecorder.js +1 -1
- package/dist/recorder/gestureRecorder.js.map +1 -1
- package/dist/recorder/index.d.ts +60 -6
- package/dist/recorder/index.js +1 -1
- package/dist/recorder/index.js.map +1 -1
- package/dist/recorder/navigationTracker.js +1 -1
- package/dist/recorder/navigationTracker.js.map +1 -1
- package/dist/recorder/screenRecorder.d.ts +79 -10
- package/dist/recorder/screenRecorder.js +1 -1
- package/dist/recorder/screenRecorder.js.map +1 -1
- package/dist/services/api.service.d.ts +62 -10
- package/dist/services/api.service.js +1 -1
- package/dist/services/api.service.js.map +1 -1
- package/dist/services/storage.service.d.ts +23 -16
- package/dist/services/storage.service.js +1 -1
- package/dist/services/storage.service.js.map +1 -1
- package/dist/session-recorder.d.ts +166 -0
- package/dist/session-recorder.js +1 -0
- package/dist/session-recorder.js.map +1 -0
- package/dist/types/index.d.ts +15 -76
- package/dist/types/index.js +1 -1
- package/dist/types/index.js.map +1 -1
- package/dist/types/rrweb.d.ts +118 -0
- package/dist/types/rrweb.js +1 -0
- package/dist/types/rrweb.js.map +1 -0
- package/dist/types/session-recorder.d.ts +366 -0
- package/dist/types/session-recorder.js +1 -0
- package/dist/types/session-recorder.js.map +1 -0
- package/dist/types/session.d.ts +59 -0
- package/dist/types/session.js +1 -0
- package/dist/types/session.js.map +1 -0
- package/dist/utils/app-metadata.d.ts +16 -0
- package/dist/utils/app-metadata.js +1 -0
- package/dist/utils/app-metadata.js.map +1 -0
- package/dist/utils/index.d.ts +7 -0
- package/dist/utils/index.js +1 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/logger.d.ts +112 -0
- package/dist/utils/logger.js +1 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/platform.d.ts +37 -0
- package/dist/utils/platform.js +1 -1
- package/dist/utils/platform.js.map +1 -1
- package/dist/utils/request-utils.d.ts +21 -0
- package/dist/utils/request-utils.js +1 -0
- package/dist/utils/request-utils.js.map +1 -0
- package/dist/utils/rrweb-events.d.ts +65 -0
- package/dist/utils/rrweb-events.js +1 -0
- package/dist/utils/rrweb-events.js.map +1 -0
- package/dist/utils/session.d.ts +5 -0
- package/dist/utils/session.js +1 -0
- package/dist/utils/session.js.map +1 -0
- package/dist/utils/time.d.ts +4 -0
- package/dist/utils/time.js +1 -0
- package/dist/utils/time.js.map +1 -0
- package/dist/utils/type-utils.d.ts +16 -0
- package/dist/utils/type-utils.js +1 -0
- package/dist/utils/type-utils.js.map +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/docs/AUTO_METADATA_DETECTION.md +108 -0
- package/package.json +10 -9
- package/scripts/generate-app-metadata.js +173 -0
- package/src/components/GestureCaptureWrapper/GestureCaptureWrapper.tsx +86 -0
- package/src/components/GestureCaptureWrapper/index.ts +1 -0
- package/src/components/ScreenRecorderView/ScreenRecorderView.tsx +72 -0
- package/src/components/ScreenRecorderView/index.ts +1 -0
- package/src/components/index.ts +1 -0
- package/src/config/constants.ts +60 -0
- package/src/config/defaults.ts +82 -0
- package/src/config/index.ts +6 -0
- package/src/config/masking.ts +10 -61
- package/src/config/session-recorder.ts +55 -0
- package/src/config/validators.ts +31 -0
- package/src/context/SessionRecorderContext.tsx +75 -0
- package/src/expo.ts +7 -37
- package/src/index.ts +14 -17
- package/src/otel/helpers.ts +265 -11
- package/src/otel/index.ts +37 -247
- package/src/otel/instrumentations/index.ts +82 -53
- package/src/patch/index.ts +1 -0
- package/src/patch/xhr.ts +142 -0
- package/src/recorder/eventExporter.ts +141 -0
- package/src/recorder/gestureRecorder.ts +194 -125
- package/src/recorder/index.ts +132 -24
- package/src/recorder/navigationTracker.ts +12 -10
- package/src/recorder/screenRecorder.ts +242 -155
- package/src/services/api.service.ts +170 -45
- package/src/services/storage.service.ts +102 -74
- package/src/session-recorder.ts +600 -0
- package/src/types/index.ts +19 -79
- package/src/types/session-recorder.ts +423 -0
- package/src/types/session.ts +65 -0
- package/src/utils/app-metadata.ts +31 -0
- package/src/utils/index.ts +8 -0
- package/src/utils/logger.ts +225 -0
- package/src/utils/platform.ts +321 -6
- package/src/utils/request-utils.ts +61 -0
- package/src/utils/rrweb-events.ts +309 -0
- package/src/utils/session.ts +18 -0
- package/src/utils/time.ts +17 -0
- package/src/utils/type-utils.ts +75 -0
- package/src/version.ts +1 -1
- package/dist/sessionRecorder.d.ts +0 -54
- package/dist/sessionRecorder.js +0 -1
- package/dist/sessionRecorder.js.map +0 -1
- package/examples/sample-expo-app/README.md +0 -142
- package/examples/sample-expo-app/app/(tabs)/_layout.tsx +0 -60
- package/examples/sample-expo-app/app/(tabs)/explore.tsx +0 -110
- package/examples/sample-expo-app/app/(tabs)/index.tsx +0 -125
- package/examples/sample-expo-app/app/(tabs)/posts.tsx +0 -96
- package/examples/sample-expo-app/app/(tabs)/users.tsx +0 -131
- package/examples/sample-expo-app/app/+not-found.tsx +0 -32
- package/examples/sample-expo-app/app/_layout.tsx +0 -53
- package/examples/sample-expo-app/app/post/[id].tsx +0 -199
- package/examples/sample-expo-app/app/user/[id].tsx +0 -270
- package/examples/sample-expo-app/app.json +0 -42
- package/examples/sample-expo-app/assets/fonts/SpaceMono-Regular.ttf +0 -0
- package/examples/sample-expo-app/assets/images/adaptive-icon.png +0 -0
- package/examples/sample-expo-app/assets/images/favicon.png +0 -0
- package/examples/sample-expo-app/assets/images/icon.png +0 -0
- package/examples/sample-expo-app/assets/images/partial-react-logo.png +0 -0
- package/examples/sample-expo-app/assets/images/react-logo.png +0 -0
- package/examples/sample-expo-app/assets/images/react-logo@2x.png +0 -0
- package/examples/sample-expo-app/assets/images/react-logo@3x.png +0 -0
- package/examples/sample-expo-app/assets/images/splash-icon.png +0 -0
- package/examples/sample-expo-app/components/Collapsible.tsx +0 -45
- package/examples/sample-expo-app/components/ErrorView.tsx +0 -52
- package/examples/sample-expo-app/components/ExternalLink.tsx +0 -24
- package/examples/sample-expo-app/components/HapticTab.tsx +0 -18
- package/examples/sample-expo-app/components/HelloWave.tsx +0 -40
- package/examples/sample-expo-app/components/LoadingSpinner.tsx +0 -34
- package/examples/sample-expo-app/components/ParallaxScrollView.tsx +0 -82
- package/examples/sample-expo-app/components/ThemedText.tsx +0 -60
- package/examples/sample-expo-app/components/ThemedView.tsx +0 -14
- package/examples/sample-expo-app/components/ui/IconSymbol.ios.tsx +0 -32
- package/examples/sample-expo-app/components/ui/IconSymbol.tsx +0 -41
- package/examples/sample-expo-app/components/ui/TabBarBackground.ios.tsx +0 -19
- package/examples/sample-expo-app/components/ui/TabBarBackground.tsx +0 -6
- package/examples/sample-expo-app/constants/Colors.ts +0 -26
- package/examples/sample-expo-app/eslint.config.js +0 -10
- package/examples/sample-expo-app/hooks/useApi.ts +0 -41
- package/examples/sample-expo-app/hooks/useColorScheme.ts +0 -1
- package/examples/sample-expo-app/hooks/useColorScheme.web.ts +0 -21
- package/examples/sample-expo-app/hooks/useThemeColor.ts +0 -21
- package/examples/sample-expo-app/metro.config.js +0 -26
- package/examples/sample-expo-app/package-lock.json +0 -26296
- package/examples/sample-expo-app/package.json +0 -59
- package/examples/sample-expo-app/scripts/reset-project.js +0 -112
- package/examples/sample-expo-app/services/api.ts +0 -98
- package/examples/sample-expo-app/tsconfig.json +0 -17
- package/examples/sample-expo-app/utils/navigation.ts +0 -19
- package/src/otel/instrumentations/gestureInstrumentation.ts +0 -141
- package/src/otel/instrumentations/reactNativeInstrumentation.ts +0 -164
- package/src/otel/instrumentations/reactNavigationInstrumentation.ts +0 -114
- package/src/sessionRecorder.ts +0 -367
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
import { SessionType } from '@multiplayer-app/session-recorder-common';
|
|
2
|
+
import { PropagateTraceHeaderCorsUrls } from '@opentelemetry/sdk-trace-web';
|
|
3
|
+
import { Span } from '@opentelemetry/api';
|
|
4
|
+
import type { ISession } from './session';
|
|
5
|
+
export declare enum WidgetButtonPlacement {
|
|
6
|
+
topLeft = "top-left",
|
|
7
|
+
topRight = "top-right",
|
|
8
|
+
bottomLeft = "bottom-left",
|
|
9
|
+
bottomRight = "bottom-right"
|
|
10
|
+
}
|
|
11
|
+
export interface SessionRecorderOptions {
|
|
12
|
+
/**
|
|
13
|
+
* The API key used to authenticate with the session debugger service.
|
|
14
|
+
*/
|
|
15
|
+
apiKey: string;
|
|
16
|
+
/**
|
|
17
|
+
* The version of the application using the session debugger.
|
|
18
|
+
*/
|
|
19
|
+
version: string;
|
|
20
|
+
/**
|
|
21
|
+
* The name of the application being debugged.
|
|
22
|
+
*/
|
|
23
|
+
application: string;
|
|
24
|
+
/**
|
|
25
|
+
* The environment where the application is running (e.g., 'production', 'staging').
|
|
26
|
+
*/
|
|
27
|
+
environment: string;
|
|
28
|
+
/**
|
|
29
|
+
* (Optional) OTLP collector endpoint.
|
|
30
|
+
*/
|
|
31
|
+
exporterEndpoint?: string;
|
|
32
|
+
/**
|
|
33
|
+
* (Optional) Base URL for the API calls.
|
|
34
|
+
* This allows customization of the API endpoint for sending session data.
|
|
35
|
+
*/
|
|
36
|
+
apiBaseUrl?: string;
|
|
37
|
+
/**
|
|
38
|
+
* (Optional) An array of URLs or regular expressions that should be ignored by the session debugger.
|
|
39
|
+
* Any URL that partially matches any regex in this array will not be traced.
|
|
40
|
+
* Additionally, URLs that exactly match any string in the array will also be ignored.
|
|
41
|
+
*/
|
|
42
|
+
ignoreUrls?: Array<string | RegExp>;
|
|
43
|
+
/**
|
|
44
|
+
* (Optional) Determines where the record button should be placed on the screen.
|
|
45
|
+
* Possible values:
|
|
46
|
+
* - 'top-left'
|
|
47
|
+
* - 'top-right'
|
|
48
|
+
* - 'bottom-left'
|
|
49
|
+
* - 'bottom-right'
|
|
50
|
+
*/
|
|
51
|
+
widgetButtonPlacement?: WidgetButtonPlacement;
|
|
52
|
+
/**
|
|
53
|
+
* (Optional) Enables the continuous recording feature and UI.
|
|
54
|
+
* If false, the UI toggle is hidden and attempts to start a continuous
|
|
55
|
+
* session are ignored.
|
|
56
|
+
* @default true
|
|
57
|
+
*/
|
|
58
|
+
showContinuousRecording?: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* (Optional) If false, the session recording widget will be hidden from the UI.
|
|
61
|
+
* Use this option if you want to enable session recording without a visible UI element.
|
|
62
|
+
* @default showWidget = true
|
|
63
|
+
*/
|
|
64
|
+
showWidget?: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* (Optional) Trace ID Ratio for sampling
|
|
67
|
+
* @default 0.15
|
|
68
|
+
*/
|
|
69
|
+
sampleTraceRatio?: number;
|
|
70
|
+
/**
|
|
71
|
+
* (Optional) URLs or regex patterns for CORS trace header propagation
|
|
72
|
+
*/
|
|
73
|
+
propagateTraceHeaderCorsUrls?: PropagateTraceHeaderCorsUrls;
|
|
74
|
+
/**
|
|
75
|
+
* (Optional) If true, schematizes document span payload
|
|
76
|
+
* @default true
|
|
77
|
+
*/
|
|
78
|
+
schemifyDocSpanPayload?: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* (Optional) Maximum size for capturing HTTP payload
|
|
81
|
+
* @default 100000
|
|
82
|
+
*/
|
|
83
|
+
maxCapturingHttpPayloadSize?: number;
|
|
84
|
+
/**
|
|
85
|
+
* (Optional) If true, uses post message fallback
|
|
86
|
+
* @default false
|
|
87
|
+
*/
|
|
88
|
+
usePostMessageFallback?: boolean;
|
|
89
|
+
/** If true, captures body in traces
|
|
90
|
+
* @default true
|
|
91
|
+
*/
|
|
92
|
+
captureBody?: boolean;
|
|
93
|
+
/** If true, captures headers in traces
|
|
94
|
+
* @default true
|
|
95
|
+
*/
|
|
96
|
+
captureHeaders?: boolean;
|
|
97
|
+
/**
|
|
98
|
+
* (Optional) Configuration for masking sensitive data in session recordings
|
|
99
|
+
* @default { maskAllInputs: true, isContentMaskingEnabled: true }
|
|
100
|
+
*/
|
|
101
|
+
masking?: MaskingConfig;
|
|
102
|
+
/**
|
|
103
|
+
* (Optional) Configuration for customizable UI text and labels
|
|
104
|
+
* @default See PopoverTextConfig defaults
|
|
105
|
+
*/
|
|
106
|
+
widgetTextOverrides?: WidgetTextOverridesConfig;
|
|
107
|
+
/** Whether to record gestures */
|
|
108
|
+
recordGestures?: boolean;
|
|
109
|
+
/** Whether to record navigation */
|
|
110
|
+
recordNavigation?: boolean;
|
|
111
|
+
/** Whether to record screen */
|
|
112
|
+
recordScreen?: boolean;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Interface for masking configuration
|
|
116
|
+
*/
|
|
117
|
+
export interface MaskingConfig {
|
|
118
|
+
/** If true, enables masking for debug span payload in traces
|
|
119
|
+
* @default true
|
|
120
|
+
*/
|
|
121
|
+
isContentMaskingEnabled?: boolean;
|
|
122
|
+
/** Custom function for masking body in traces */
|
|
123
|
+
maskBody?: (payload: any, span: Span) => any;
|
|
124
|
+
/** Custom function for masking headers in traces */
|
|
125
|
+
maskHeaders?: (headers: any, span: any) => any;
|
|
126
|
+
/** List of body fields to mask in traces */
|
|
127
|
+
maskBodyFieldsList?: string[];
|
|
128
|
+
/** List of headers to mask in traces */
|
|
129
|
+
maskHeadersList?: string[];
|
|
130
|
+
/** List of headers to include in traces (if specified, only these headers will be captured) */
|
|
131
|
+
headersToInclude?: string[];
|
|
132
|
+
/** List of headers to exclude from traces */
|
|
133
|
+
headersToExclude?: string[];
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Base configuration interface with common properties
|
|
137
|
+
*/
|
|
138
|
+
export interface BaseConfig {
|
|
139
|
+
/** API key for authentication */
|
|
140
|
+
apiKey: string;
|
|
141
|
+
/** Base URL for the API calls */
|
|
142
|
+
apiBaseUrl: string;
|
|
143
|
+
/** Base URL for the API calls */
|
|
144
|
+
exporterEndpoint: string;
|
|
145
|
+
/** Whether to use post message fallback */
|
|
146
|
+
usePostMessageFallback?: boolean;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Configuration interface for the Tracer class
|
|
150
|
+
*/
|
|
151
|
+
export type TracerReactNativeMasking = Pick<MaskingConfig, 'isContentMaskingEnabled' | 'maskBody' | 'maskHeaders' | 'maskBodyFieldsList' | 'maskHeadersList' | 'headersToInclude' | 'headersToExclude'>;
|
|
152
|
+
export interface TracerReactNativeConfig extends BaseConfig {
|
|
153
|
+
/** Application name */
|
|
154
|
+
application: string;
|
|
155
|
+
/** Application version */
|
|
156
|
+
version: string;
|
|
157
|
+
/** Environment (e.g., 'production', 'staging') */
|
|
158
|
+
environment: string;
|
|
159
|
+
/** URLs to ignore during tracing */
|
|
160
|
+
ignoreUrls: Array<string | RegExp>;
|
|
161
|
+
/** Trace ID ratio for sampling */
|
|
162
|
+
sampleTraceRatio: number;
|
|
163
|
+
/** URLs for CORS trace header propagation */
|
|
164
|
+
propagateTraceHeaderCorsUrls: PropagateTraceHeaderCorsUrls;
|
|
165
|
+
/** Whether to schematize document span payload */
|
|
166
|
+
schemifyDocSpanPayload: boolean;
|
|
167
|
+
/** Maximum size for capturing HTTP payload */
|
|
168
|
+
maxCapturingHttpPayloadSize: number;
|
|
169
|
+
/** If true, captures body in traces
|
|
170
|
+
* @default true
|
|
171
|
+
*/
|
|
172
|
+
captureBody: boolean;
|
|
173
|
+
/** If true, captures headers in traces
|
|
174
|
+
* @default true
|
|
175
|
+
*/
|
|
176
|
+
captureHeaders: boolean;
|
|
177
|
+
/** Configuration for masking sensitive data in session recordings */
|
|
178
|
+
masking: TracerReactNativeMasking;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Configuration interface for the Recorder class
|
|
182
|
+
*/
|
|
183
|
+
export interface RecorderConfig extends BaseConfig {
|
|
184
|
+
/** Whether to record gestures */
|
|
185
|
+
recordGestures?: boolean;
|
|
186
|
+
/** Whether to record navigation */
|
|
187
|
+
recordNavigation?: boolean;
|
|
188
|
+
/** Whether to record screen */
|
|
189
|
+
recordScreen?: boolean;
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Configuration interface for the SessionWidget class
|
|
193
|
+
*/
|
|
194
|
+
export interface SessionWidgetConfig {
|
|
195
|
+
/** Whether to show the widget */
|
|
196
|
+
showWidget: boolean;
|
|
197
|
+
/** Placement of the widget button */
|
|
198
|
+
widgetButtonPlacement: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
199
|
+
/** Whether continuous recording feature is enabled */
|
|
200
|
+
showContinuousRecording: boolean;
|
|
201
|
+
/** Configuration for customizable UI text and labels */
|
|
202
|
+
widgetTextOverrides: WidgetTextOverridesConfig;
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Interface for customizable widget text configuration
|
|
206
|
+
*/
|
|
207
|
+
export interface WidgetTextOverridesConfig {
|
|
208
|
+
/** Title for the initial popover when continuous recording is enabled */
|
|
209
|
+
initialTitleWithContinuous?: string;
|
|
210
|
+
/** Title for the initial popover when continuous recording is disabled */
|
|
211
|
+
initialTitleWithoutContinuous?: string;
|
|
212
|
+
/** Description for the initial popover when continuous recording is enabled */
|
|
213
|
+
initialDescriptionWithContinuous?: string;
|
|
214
|
+
/** Description for the initial popover when continuous recording is disabled */
|
|
215
|
+
initialDescriptionWithoutContinuous?: string;
|
|
216
|
+
/** Label for the continuous recording toggle */
|
|
217
|
+
continuousRecordingLabel?: string;
|
|
218
|
+
/** Text for the start recording button */
|
|
219
|
+
startRecordingButtonText?: string;
|
|
220
|
+
/** Title for the final popover */
|
|
221
|
+
finalTitle?: string;
|
|
222
|
+
/** Description for the final popover */
|
|
223
|
+
finalDescription?: string;
|
|
224
|
+
/** Placeholder text for the comment textarea */
|
|
225
|
+
commentPlaceholder?: string;
|
|
226
|
+
/** Text for the save button in final popover */
|
|
227
|
+
saveButtonText?: string;
|
|
228
|
+
/** Text for the cancel button in final popover */
|
|
229
|
+
cancelButtonText?: string;
|
|
230
|
+
/** Title for the continuous recording overlay */
|
|
231
|
+
continuousOverlayTitle?: string;
|
|
232
|
+
/** Description for the continuous recording overlay */
|
|
233
|
+
continuousOverlayDescription?: string;
|
|
234
|
+
/** Text for the save last snapshot button */
|
|
235
|
+
saveLastSnapshotButtonText?: string;
|
|
236
|
+
/** Title for the submit session dialog */
|
|
237
|
+
submitDialogTitle?: string;
|
|
238
|
+
/** Subtitle for the submit session dialog */
|
|
239
|
+
submitDialogSubtitle?: string;
|
|
240
|
+
/** Label for the comment field in submit dialog */
|
|
241
|
+
submitDialogCommentLabel?: string;
|
|
242
|
+
/** Placeholder for the comment field in submit dialog */
|
|
243
|
+
submitDialogCommentPlaceholder?: string;
|
|
244
|
+
/** Text for the submit button in dialog */
|
|
245
|
+
submitDialogSubmitText?: string;
|
|
246
|
+
/** Text for the cancel button in dialog */
|
|
247
|
+
submitDialogCancelText?: string;
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Configuration interface for the ApiService class
|
|
251
|
+
*/
|
|
252
|
+
export interface ApiServiceConfig extends BaseConfig {
|
|
253
|
+
}
|
|
254
|
+
export interface SessionRecorderConfigs extends Required<SessionRecorderOptions> {
|
|
255
|
+
}
|
|
256
|
+
export declare enum SessionState {
|
|
257
|
+
started = "2",
|
|
258
|
+
paused = "1",
|
|
259
|
+
stopped = "0"
|
|
260
|
+
}
|
|
261
|
+
export interface ISessionRecorder {
|
|
262
|
+
/**
|
|
263
|
+
* The current session ID
|
|
264
|
+
*/
|
|
265
|
+
readonly sessionId: string | null;
|
|
266
|
+
/**
|
|
267
|
+
* Whether continuous recording is enabled
|
|
268
|
+
*/
|
|
269
|
+
readonly continuousRecording: boolean;
|
|
270
|
+
/**
|
|
271
|
+
* The current debug session object
|
|
272
|
+
*/
|
|
273
|
+
readonly session: ISession | null;
|
|
274
|
+
/**
|
|
275
|
+
* The type of session (plain or continuous)
|
|
276
|
+
*/
|
|
277
|
+
readonly sessionType: SessionType;
|
|
278
|
+
/**
|
|
279
|
+
* The current state of the session
|
|
280
|
+
*/
|
|
281
|
+
readonly sessionState: SessionState | null;
|
|
282
|
+
/**
|
|
283
|
+
* Session attributes for additional context
|
|
284
|
+
*/
|
|
285
|
+
readonly sessionAttributes: Record<string, any>;
|
|
286
|
+
/**
|
|
287
|
+
* Current error message
|
|
288
|
+
*/
|
|
289
|
+
error: string;
|
|
290
|
+
/**
|
|
291
|
+
* The HTML button element for the session widget's recorder button
|
|
292
|
+
*/
|
|
293
|
+
readonly sessionWidgetButtonElement: HTMLButtonElement;
|
|
294
|
+
/**
|
|
295
|
+
* Initialize the session debugger with custom configurations
|
|
296
|
+
* @param configs - custom configurations for session debugger
|
|
297
|
+
*/
|
|
298
|
+
init(configs: SessionRecorderOptions): void;
|
|
299
|
+
/**
|
|
300
|
+
* Save the continuous recording session
|
|
301
|
+
* @returns Promise that resolves to the save response
|
|
302
|
+
*/
|
|
303
|
+
save(): Promise<any>;
|
|
304
|
+
/**
|
|
305
|
+
* Start a new session
|
|
306
|
+
* @param type - the type of session to start
|
|
307
|
+
* @param session - optional existing session to start
|
|
308
|
+
*/
|
|
309
|
+
start(type?: SessionType, session?: ISession): void;
|
|
310
|
+
/**
|
|
311
|
+
* Stop the current session with an optional comment
|
|
312
|
+
* @param comment - user-provided comment to include in session feedback metadata
|
|
313
|
+
*/
|
|
314
|
+
stop(comment?: string): Promise<void>;
|
|
315
|
+
/**
|
|
316
|
+
* Cancel the current session
|
|
317
|
+
*/
|
|
318
|
+
cancel(): Promise<void>;
|
|
319
|
+
/**
|
|
320
|
+
* Pause the current session
|
|
321
|
+
*/
|
|
322
|
+
pause(): Promise<void>;
|
|
323
|
+
/**
|
|
324
|
+
* Resume the current session
|
|
325
|
+
*/
|
|
326
|
+
resume(): Promise<void>;
|
|
327
|
+
/**
|
|
328
|
+
* Set the session metadata
|
|
329
|
+
* @param attributes - the attributes to set
|
|
330
|
+
*/
|
|
331
|
+
setSessionAttributes(attributes: Record<string, any>): void;
|
|
332
|
+
/**
|
|
333
|
+
* Set a custom click handler for the recording button
|
|
334
|
+
* @param handler - function that will be invoked when the button is clicked
|
|
335
|
+
*/
|
|
336
|
+
set recordingButtonClickHandler(handler: () => boolean | void);
|
|
337
|
+
}
|
|
338
|
+
export type Breaker = {};
|
|
339
|
+
export interface ScreenEvent {
|
|
340
|
+
screenName: string;
|
|
341
|
+
timestamp: number;
|
|
342
|
+
params?: Record<string, any>;
|
|
343
|
+
type?: string;
|
|
344
|
+
metadata?: Record<string, any>;
|
|
345
|
+
dataUrl?: string;
|
|
346
|
+
}
|
|
347
|
+
export interface GestureEvent {
|
|
348
|
+
type: string;
|
|
349
|
+
timestamp: number;
|
|
350
|
+
x?: number;
|
|
351
|
+
y?: number;
|
|
352
|
+
direction?: string;
|
|
353
|
+
target?: string;
|
|
354
|
+
coordinates?: {
|
|
355
|
+
x: number;
|
|
356
|
+
y: number;
|
|
357
|
+
};
|
|
358
|
+
metadata?: Record<string, any>;
|
|
359
|
+
}
|
|
360
|
+
export interface NavigationEvent {
|
|
361
|
+
type: string;
|
|
362
|
+
timestamp: number;
|
|
363
|
+
routeName?: string;
|
|
364
|
+
params?: Record<string, any>;
|
|
365
|
+
metadata?: Record<string, any>;
|
|
366
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.WidgetButtonPlacement=exports.SessionState=void 0;var WidgetButtonPlacement;(function(WidgetButtonPlacement){WidgetButtonPlacement["topLeft"]="top-left";WidgetButtonPlacement["topRight"]="top-right";WidgetButtonPlacement["bottomLeft"]="bottom-left";WidgetButtonPlacement["bottomRight"]="bottom-right";})(WidgetButtonPlacement||(exports.WidgetButtonPlacement=WidgetButtonPlacement={}));var SessionState;(function(SessionState){SessionState["started"]="2";SessionState["paused"]="1";SessionState["stopped"]="0";})(SessionState||(exports.SessionState=SessionState={}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-recorder.js","sourceRoot":"","sources":["../../src/types/session-recorder.ts"],"names":[],"mappings":"AAMA,MAAM,CAAN,IAAY,qBAKX;AALD,WAAY,qBAAqB;IAC/B,6CAAoB,CAAA;IACpB,+CAAsB,CAAA;IACtB,mDAA0B,CAAA;IAC1B,qDAA4B,CAAA;AAC9B,CAAC,EALW,qBAAqB,KAArB,qBAAqB,QAKhC;AA0RD,MAAM,CAAN,IAAY,YAIX;AAJD,WAAY,YAAY;IACtB,6BAAa,CAAA;IACb,4BAAY,CAAA;IACZ,6BAAa,CAAA;AACf,CAAC,EAJW,YAAY,KAAZ,YAAY,QAIvB"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { SessionType } from '@multiplayer-app/session-recorder-common';
|
|
2
|
+
export interface IResourceAttributes {
|
|
3
|
+
browserInfo?: string;
|
|
4
|
+
cookiesEnabled?: string;
|
|
5
|
+
deviceInfo?: string;
|
|
6
|
+
hardwareConcurrency?: number;
|
|
7
|
+
osInfo?: string;
|
|
8
|
+
pixelRatio?: number;
|
|
9
|
+
screenSize?: string;
|
|
10
|
+
packageVersion?: string;
|
|
11
|
+
[key: string]: any;
|
|
12
|
+
}
|
|
13
|
+
export interface ISessionAttributes {
|
|
14
|
+
userEmail?: string;
|
|
15
|
+
userId?: string;
|
|
16
|
+
userName?: string;
|
|
17
|
+
accountId?: string;
|
|
18
|
+
accountName?: string;
|
|
19
|
+
[key: string]: any;
|
|
20
|
+
}
|
|
21
|
+
export interface ISessionView {
|
|
22
|
+
_id: string;
|
|
23
|
+
name: string;
|
|
24
|
+
components?: string[];
|
|
25
|
+
}
|
|
26
|
+
export interface ISession {
|
|
27
|
+
_id: string;
|
|
28
|
+
shortId: string;
|
|
29
|
+
workspace: string;
|
|
30
|
+
project: string;
|
|
31
|
+
continuousDebugSession?: string;
|
|
32
|
+
creationType: SessionType;
|
|
33
|
+
name: string;
|
|
34
|
+
startedAt: string | Date;
|
|
35
|
+
stoppedAt: string | Date;
|
|
36
|
+
durationInSeconds?: number;
|
|
37
|
+
createdAt: string | Date;
|
|
38
|
+
updatedAt: string | Date;
|
|
39
|
+
tags: any[];
|
|
40
|
+
resourceAttributes?: IResourceAttributes;
|
|
41
|
+
sessionAttributes?: ISessionAttributes;
|
|
42
|
+
views: ISessionView[];
|
|
43
|
+
starred: boolean;
|
|
44
|
+
starredItems: string[];
|
|
45
|
+
s3Files: {
|
|
46
|
+
_id?: string;
|
|
47
|
+
bucket: string;
|
|
48
|
+
key: string;
|
|
49
|
+
dataType: DebugSessionDataType;
|
|
50
|
+
url?: string;
|
|
51
|
+
}[];
|
|
52
|
+
finishedS3Transfer?: boolean;
|
|
53
|
+
tempApiKey?: string;
|
|
54
|
+
}
|
|
55
|
+
export declare enum DebugSessionDataType {
|
|
56
|
+
OTLP_TRACES = "OTLP_TRACES",
|
|
57
|
+
OTLP_LOGS = "OTLP_LOGS",
|
|
58
|
+
RRWEB_EVENTS = "RRWEB_EVENTS"
|
|
59
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.DebugSessionDataType=void 0;var DebugSessionDataType;(function(DebugSessionDataType){DebugSessionDataType["OTLP_TRACES"]="OTLP_TRACES";DebugSessionDataType["OTLP_LOGS"]="OTLP_LOGS";DebugSessionDataType["RRWEB_EVENTS"]="RRWEB_EVENTS";})(DebugSessionDataType||(exports.DebugSessionDataType=DebugSessionDataType={}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.js","sourceRoot":"","sources":["../../src/types/session.ts"],"names":[],"mappings":"AA4DA,MAAM,CAAN,IAAY,oBAIX;AAJD,WAAY,oBAAoB;IAC9B,mDAA2B,CAAA;IAC3B,+CAAuB,CAAA;IACvB,qDAA6B,CAAA;AAC/B,CAAC,EAJW,oBAAoB,KAApB,oBAAoB,QAI/B"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Auto-generated app metadata
|
|
3
|
+
* This file is generated at build time to provide app metadata without developer intervention
|
|
4
|
+
*/
|
|
5
|
+
export interface AppMetadata {
|
|
6
|
+
name?: string;
|
|
7
|
+
version?: string;
|
|
8
|
+
bundleId?: string;
|
|
9
|
+
buildNumber?: string;
|
|
10
|
+
displayName?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare const APP_METADATA: AppMetadata;
|
|
13
|
+
/**
|
|
14
|
+
* Get auto-detected app metadata
|
|
15
|
+
*/
|
|
16
|
+
export declare function getAutoDetectedAppMetadata(): AppMetadata;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.APP_METADATA=void 0;exports.getAutoDetectedAppMetadata=getAutoDetectedAppMetadata;var _defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));function ownKeys(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable;})),t.push.apply(t,o);}return t;}function _objectSpread(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?ownKeys(Object(t),!0).forEach(function(r){(0,_defineProperty2["default"])(e,r,t[r]);}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ownKeys(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r));});}return e;}var APP_METADATA=exports.APP_METADATA={name:"@multiplayer-app/session-recorder-react-native",version:"0.0.1-alpha.10",bundleId:undefined,buildNumber:undefined,displayName:undefined};function getAutoDetectedAppMetadata(){return _objectSpread({},APP_METADATA);}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-metadata.js","sourceRoot":"","sources":["../../src/utils/app-metadata.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAaH,wDAAwD;AACxD,MAAM,CAAC,MAAM,YAAY,GAAgB;IACvC,IAAI,EAAE,gDAAgD;IACtD,OAAO,EAAE,gBAAgB;IACzB,QAAQ,EAAE,SAAS;IACnB,WAAW,EAAE,SAAS;IACtB,WAAW,EAAE,SAAS;CACvB,CAAA;AAED;;GAEG;AACH,MAAM,UAAU,0BAA0B;IACxC,OAAO,EAAE,GAAG,YAAY,EAAE,CAAA;AAC5B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});var _platform=require("./platform");Object.keys(_platform).forEach(function(key){if(key==="default"||key==="__esModule")return;if(key in exports&&exports[key]===_platform[key])return;Object.defineProperty(exports,key,{enumerable:true,get:function get(){return _platform[key];}});});var _session=require("./session");Object.keys(_session).forEach(function(key){if(key==="default"||key==="__esModule")return;if(key in exports&&exports[key]===_session[key])return;Object.defineProperty(exports,key,{enumerable:true,get:function get(){return _session[key];}});});var _time=require("./time");Object.keys(_time).forEach(function(key){if(key==="default"||key==="__esModule")return;if(key in exports&&exports[key]===_time[key])return;Object.defineProperty(exports,key,{enumerable:true,get:function get(){return _time[key];}});});var _typeUtils=require("./type-utils");Object.keys(_typeUtils).forEach(function(key){if(key==="default"||key==="__esModule")return;if(key in exports&&exports[key]===_typeUtils[key])return;Object.defineProperty(exports,key,{enumerable:true,get:function get(){return _typeUtils[key];}});});var _requestUtils=require("./request-utils");Object.keys(_requestUtils).forEach(function(key){if(key==="default"||key==="__esModule")return;if(key in exports&&exports[key]===_requestUtils[key])return;Object.defineProperty(exports,key,{enumerable:true,get:function get(){return _requestUtils[key];}});});var _rrwebEvents=require("./rrweb-events");Object.keys(_rrwebEvents).forEach(function(key){if(key==="default"||key==="__esModule")return;if(key in exports&&exports[key]===_rrwebEvents[key])return;Object.defineProperty(exports,key,{enumerable:true,get:function get(){return _rrwebEvents[key];}});});var _logger=require("./logger");Object.keys(_logger).forEach(function(key){if(key==="default"||key==="__esModule")return;if(key in exports&&exports[key]===_logger[key])return;Object.defineProperty(exports,key,{enumerable:true,get:function get(){return _logger[key];}});});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,cAAc,YAAY,CAAA;AAC1B,cAAc,WAAW,CAAA;AACzB,cAAc,QAAQ,CAAA;AACtB,cAAc,cAAc,CAAA;AAC5B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,UAAU,CAAA"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Centralized logger utility for the session recorder
|
|
3
|
+
* Provides consistent logging across all components
|
|
4
|
+
*/
|
|
5
|
+
export declare enum LogLevel {
|
|
6
|
+
DEBUG = 0,
|
|
7
|
+
INFO = 1,
|
|
8
|
+
WARN = 2,
|
|
9
|
+
ERROR = 3
|
|
10
|
+
}
|
|
11
|
+
export interface LoggerConfig {
|
|
12
|
+
level: LogLevel;
|
|
13
|
+
enableConsole: boolean;
|
|
14
|
+
enablePrefix: boolean;
|
|
15
|
+
prefix: string;
|
|
16
|
+
}
|
|
17
|
+
declare class Logger {
|
|
18
|
+
private config;
|
|
19
|
+
private componentPrefixes;
|
|
20
|
+
/**
|
|
21
|
+
* Configure the logger
|
|
22
|
+
* @param config - Logger configuration
|
|
23
|
+
*/
|
|
24
|
+
configure(config: Partial<LoggerConfig>): void;
|
|
25
|
+
/**
|
|
26
|
+
* Set the log level
|
|
27
|
+
* @param level - Log level to set
|
|
28
|
+
*/
|
|
29
|
+
setLevel(level: LogLevel): void;
|
|
30
|
+
/**
|
|
31
|
+
* Enable or disable console output
|
|
32
|
+
* @param enabled - Whether to enable console output
|
|
33
|
+
*/
|
|
34
|
+
setConsoleEnabled(enabled: boolean): void;
|
|
35
|
+
/**
|
|
36
|
+
* Add or update a component prefix
|
|
37
|
+
* @param component - Component name
|
|
38
|
+
* @param emoji - Emoji prefix for the component
|
|
39
|
+
*/
|
|
40
|
+
setComponentPrefix(component: string, emoji: string): void;
|
|
41
|
+
/**
|
|
42
|
+
* Get the formatted prefix for a component
|
|
43
|
+
* @param component - Component name
|
|
44
|
+
* @returns Formatted prefix string
|
|
45
|
+
*/
|
|
46
|
+
private getPrefix;
|
|
47
|
+
/**
|
|
48
|
+
* Check if a log level should be output
|
|
49
|
+
* @param level - Log level to check
|
|
50
|
+
* @returns True if should output
|
|
51
|
+
*/
|
|
52
|
+
private shouldLog;
|
|
53
|
+
/**
|
|
54
|
+
* Format the log message
|
|
55
|
+
* @param component - Component name
|
|
56
|
+
* @param level - Log level
|
|
57
|
+
* @param message - Log message
|
|
58
|
+
* @param data - Additional data to log
|
|
59
|
+
* @returns Formatted log message
|
|
60
|
+
*/
|
|
61
|
+
private formatMessage;
|
|
62
|
+
/**
|
|
63
|
+
* Log a debug message
|
|
64
|
+
* @param component - Component name
|
|
65
|
+
* @param message - Log message
|
|
66
|
+
* @param data - Additional data to log
|
|
67
|
+
*/
|
|
68
|
+
debug(component: string, message: string, data?: any): void;
|
|
69
|
+
/**
|
|
70
|
+
* Log an info message
|
|
71
|
+
* @param component - Component name
|
|
72
|
+
* @param message - Log message
|
|
73
|
+
* @param data - Additional data to log
|
|
74
|
+
*/
|
|
75
|
+
info(component: string, message: string, data?: any): void;
|
|
76
|
+
/**
|
|
77
|
+
* Log a warning message
|
|
78
|
+
* @param component - Component name
|
|
79
|
+
* @param message - Log message
|
|
80
|
+
* @param data - Additional data to log
|
|
81
|
+
*/
|
|
82
|
+
warn(component: string, message: string, data?: any): void;
|
|
83
|
+
/**
|
|
84
|
+
* Log an error message
|
|
85
|
+
* @param component - Component name
|
|
86
|
+
* @param message - Log message
|
|
87
|
+
* @param data - Additional data to log
|
|
88
|
+
*/
|
|
89
|
+
error(component: string, message: string, data?: any): void;
|
|
90
|
+
/**
|
|
91
|
+
* Log a success message (info level with success emoji)
|
|
92
|
+
* @param component - Component name
|
|
93
|
+
* @param message - Log message
|
|
94
|
+
* @param data - Additional data to log
|
|
95
|
+
*/
|
|
96
|
+
success(component: string, message: string, data?: any): void;
|
|
97
|
+
/**
|
|
98
|
+
* Log a failure message (error level with failure emoji)
|
|
99
|
+
* @param component - Component name
|
|
100
|
+
* @param message - Log message
|
|
101
|
+
* @param data - Additional data to log
|
|
102
|
+
*/
|
|
103
|
+
failure(component: string, message: string, data?: any): void;
|
|
104
|
+
}
|
|
105
|
+
export declare const logger: Logger;
|
|
106
|
+
export declare const logDebug: (component: string, message: string, data?: any) => void;
|
|
107
|
+
export declare const logInfo: (component: string, message: string, data?: any) => void;
|
|
108
|
+
export declare const logWarn: (component: string, message: string, data?: any) => void;
|
|
109
|
+
export declare const logError: (component: string, message: string, data?: any) => void;
|
|
110
|
+
export declare const logSuccess: (component: string, message: string, data?: any) => void;
|
|
111
|
+
export declare const logFailure: (component: string, message: string, data?: any) => void;
|
|
112
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.logger=exports.logWarn=exports.logSuccess=exports.logInfo=exports.logFailure=exports.logError=exports.logDebug=exports.LogLevel=void 0;var _defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));var _classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));var _createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass"));function ownKeys(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable;})),t.push.apply(t,o);}return t;}function _objectSpread(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?ownKeys(Object(t),!0).forEach(function(r){(0,_defineProperty2["default"])(e,r,t[r]);}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ownKeys(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r));});}return e;}var LogLevel;(function(LogLevel){LogLevel[LogLevel["DEBUG"]=0]="DEBUG";LogLevel[LogLevel["INFO"]=1]="INFO";LogLevel[LogLevel["WARN"]=2]="WARN";LogLevel[LogLevel["ERROR"]=3]="ERROR";})(LogLevel||(exports.LogLevel=LogLevel={}));var Logger=function(){function Logger(){(0,_classCallCheck2["default"])(this,Logger);this.config={level:LogLevel.INFO,enableConsole:true,enablePrefix:true,prefix:'[SessionRecorder]'};this.componentPrefixes=new Map([['ScreenRecorder','📸'],['GestureRecorder','👆'],['GestureCaptureWrapper','📸'],['SessionRecorderContext','🎯'],['EventExporter','📤'],['NavigationTracker','📸'],['RecorderReactNativeSDK','📤'],['DEBUGGER_LIB','🔍']]);}return(0,_createClass2["default"])(Logger,[{key:"configure",value:function configure(config){this.config=_objectSpread(_objectSpread({},this.config),config);}},{key:"setLevel",value:function setLevel(level){this.config.level=level;}},{key:"setConsoleEnabled",value:function setConsoleEnabled(enabled){this.config.enableConsole=enabled;}},{key:"setComponentPrefix",value:function setComponentPrefix(component,emoji){this.componentPrefixes.set(component,emoji);}},{key:"getPrefix",value:function getPrefix(component){if(!this.config.enablePrefix)return'';var emoji=this.componentPrefixes.get(component)||'📝';return"".concat(this.config.prefix," ").concat(emoji," [").concat(component,"]");}},{key:"shouldLog",value:function shouldLog(level){return level>=this.config.level&&this.config.enableConsole;}},{key:"formatMessage",value:function formatMessage(component,level,message,data){var prefix=this.getPrefix(component);var timestamp=new Date().toISOString();var levelName=LogLevel[level];var formattedMessage="".concat(prefix," ").concat(levelName," ").concat(message);if(data!==undefined){formattedMessage+=" ".concat(JSON.stringify(data));}return formattedMessage;}},{key:"debug",value:function debug(component,message,data){if(!this.shouldLog(LogLevel.DEBUG))return;var formattedMessage=this.formatMessage(component,LogLevel.DEBUG,message,data);console.log(formattedMessage);}},{key:"info",value:function info(component,message,data){if(!this.shouldLog(LogLevel.INFO))return;var formattedMessage=this.formatMessage(component,LogLevel.INFO,message,data);console.log(formattedMessage);}},{key:"warn",value:function warn(component,message,data){if(!this.shouldLog(LogLevel.WARN))return;var formattedMessage=this.formatMessage(component,LogLevel.WARN,message,data);console.warn(formattedMessage);}},{key:"error",value:function error(component,message,data){if(!this.shouldLog(LogLevel.ERROR))return;var formattedMessage=this.formatMessage(component,LogLevel.ERROR,message,data);console.error(formattedMessage);}},{key:"success",value:function success(component,message,data){if(!this.shouldLog(LogLevel.INFO))return;var prefix=this.getPrefix(component);var timestamp=new Date().toISOString();var formattedMessage="".concat(prefix," \u2705 ").concat(message);var fullMessage=formattedMessage;if(data!==undefined){fullMessage+=" ".concat(JSON.stringify(data));}console.log(fullMessage);}},{key:"failure",value:function failure(component,message,data){if(!this.shouldLog(LogLevel.ERROR))return;var prefix=this.getPrefix(component);var timestamp=new Date().toISOString();var formattedMessage="".concat(prefix," \u274C ").concat(message);var fullMessage=formattedMessage;if(data!==undefined){fullMessage+=" ".concat(JSON.stringify(data));}console.error(fullMessage);}}]);}();var logger=exports.logger=new Logger();var logDebug=exports.logDebug=function logDebug(component,message,data){return logger.debug(component,message,data);};var logInfo=exports.logInfo=function logInfo(component,message,data){return logger.info(component,message,data);};var logWarn=exports.logWarn=function logWarn(component,message,data){return logger.warn(component,message,data);};var logError=exports.logError=function logError(component,message,data){return logger.error(component,message,data);};var logSuccess=exports.logSuccess=function logSuccess(component,message,data){return logger.success(component,message,data);};var logFailure=exports.logFailure=function logFailure(component,message,data){return logger.failure(component,message,data);};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,CAAN,IAAY,QAKX;AALD,WAAY,QAAQ;IAClB,yCAAS,CAAA;IACT,uCAAQ,CAAA;IACR,uCAAQ,CAAA;IACR,yCAAS,CAAA;AACX,CAAC,EALW,QAAQ,KAAR,QAAQ,QAKnB;AASD,MAAM,MAAM;IAAZ;QACU,WAAM,GAAiB;YAC7B,KAAK,EAAE,QAAQ,CAAC,IAAI;YACpB,aAAa,EAAE,IAAI;YACnB,YAAY,EAAE,IAAI;YAClB,MAAM,EAAE,mBAAmB;SAC5B,CAAA;QAEO,sBAAiB,GAAwB,IAAI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AAG,CAAC,SAAiB,EAAE,OAAe,EAAE,IAAU,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,EAAE,OAAO,EAAE,IAAI,CAAC,CAAA;AAClH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,SAAiB,EAAE,OAAe,EAAE,IAAU,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,EAAE,OAAO,EAAE,IAAI,CAAC,CAAA;AACtH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,SAAiB,EAAE,OAAe,EAAE,IAAU,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,EAAE,OAAO,EAAE,IAAI,CAAC,CAAA"}
|
package/dist/utils/platform.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { IResourceAttributes } from '../types';
|
|
1
2
|
export interface PlatformInfo {
|
|
2
3
|
isExpo: boolean;
|
|
3
4
|
isReactNative: boolean;
|
|
@@ -7,3 +8,39 @@ export interface PlatformInfo {
|
|
|
7
8
|
deviceType: string;
|
|
8
9
|
}
|
|
9
10
|
export declare function isReactNativeEnvironment(): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Configure app metadata for non-Expo React Native apps
|
|
13
|
+
* Call this function in your app initialization to provide app information
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* import { configureAppMetadata } from '@multiplayer-app/session-recorder-react-native'
|
|
18
|
+
*
|
|
19
|
+
* // In your App.tsx or index.js
|
|
20
|
+
* configureAppMetadata({
|
|
21
|
+
* name: 'My Awesome App',
|
|
22
|
+
* version: '1.2.3',
|
|
23
|
+
* bundleId: 'com.mycompany.myapp',
|
|
24
|
+
* buildNumber: '123',
|
|
25
|
+
* displayName: 'My App'
|
|
26
|
+
* })
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export declare function configureAppMetadata(metadata: {
|
|
30
|
+
name?: string;
|
|
31
|
+
version?: string;
|
|
32
|
+
bundleId?: string;
|
|
33
|
+
buildNumber?: string;
|
|
34
|
+
displayName?: string;
|
|
35
|
+
}): void;
|
|
36
|
+
/**
|
|
37
|
+
* Get configured app metadata
|
|
38
|
+
*/
|
|
39
|
+
export declare function getConfiguredAppMetadata(): {
|
|
40
|
+
name?: string;
|
|
41
|
+
version?: string;
|
|
42
|
+
bundleId?: string;
|
|
43
|
+
buildNumber?: string;
|
|
44
|
+
displayName?: string;
|
|
45
|
+
};
|
|
46
|
+
export declare const getNavigatorInfo: () => IResourceAttributes;
|