react-native-inapp-inspector 1.0.14 β 1.0.15
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/README.md +203 -44
- package/dist/commonjs/customHooks/analyticsLogger.d.ts +1 -0
- package/dist/commonjs/customHooks/analyticsLogger.js +57 -17
- package/dist/commonjs/customHooks/networkLogger.d.ts +1 -1
- package/dist/commonjs/customHooks/networkLogger.js +54 -46
- package/dist/commonjs/index.js +1499 -792
- package/dist/esm/customHooks/analyticsLogger.d.ts +1 -0
- package/dist/esm/customHooks/analyticsLogger.js +55 -16
- package/dist/esm/customHooks/networkLogger.d.ts +1 -1
- package/dist/esm/customHooks/networkLogger.js +56 -48
- package/dist/esm/index.js +1500 -793
- package/example/App.tsx +1 -3
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -8,66 +8,75 @@
|
|
|
8
8
|
</picture>
|
|
9
9
|
</p>
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
<p align="center">
|
|
12
|
+
<a href="https://www.npmjs.com/package/react-native-inapp-inspector"><img src="https://img.shields.io/npm/v/react-native-inapp-inspector?color=6366f1&label=npm" alt="npm version" /></a>
|
|
13
|
+
<a href="https://github.com/vengatmacuser/react-native-inapp-inspector/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-green" alt="license" /></a>
|
|
14
|
+
<a href="https://github.com/vengatmacuser/react-native-inapp-inspector"><img src="https://img.shields.io/badge/platform-iOS%20%7C%20Android-blue" alt="platform" /></a>
|
|
15
|
+
</p>
|
|
16
|
+
|
|
17
|
+
A self-contained in-app debugging overlay for React Native. Inspect network traffic, console output, analytics events, Redux state, and WebView activity directly inside your app.
|
|
18
|
+
|
|
19
|
+
---
|
|
12
20
|
|
|
13
21
|
## Features
|
|
14
22
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
23
|
+
| Feature | Description |
|
|
24
|
+
|---|---|
|
|
25
|
+
| Network inspector | Captures `fetch` and axios `GET`, `POST`, `PUT`, `PATCH`, and `DELETE` calls with URL, method, status, headers, body, response, duration, caller, cURL, and fetch snippets. |
|
|
26
|
+
| Insights dashboard | Shows request totals, status breakdowns, latency, payload size, slow requests, and recent activity charts. |
|
|
27
|
+
| Console logger | Captures `console.log`, `console.info`, `console.warn`, and `console.error` with source method and caller details. |
|
|
28
|
+
| Analytics tracker | Captures manual analytics events and patched `@react-native-firebase/analytics` calls including `logEvent`, `logScreenView`, user properties, and user id. |
|
|
29
|
+
| Redux inspector | Connects to a Redux store, displays the live state tree, tracks dispatched actions, affected slices, and action history. |
|
|
30
|
+
| WebView inspector | Provides an instrumented `WebView` with console capture, navigation history, HTML/CSS/JS snapshots, and optional loading overlay. |
|
|
31
|
+
| Error boundary | Exports an `ErrorBoundary` for catching React errors and wrapping the inspector safely. |
|
|
21
32
|
|
|
22
33
|
---
|
|
23
34
|
|
|
24
35
|
## Video Walkthrough
|
|
25
36
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
[π¬ Download or watch the Video Walkthrough](https://raw.githubusercontent.com/vengatmacuser/react-native-inapp-inspector/main/example/guidance/Video-WalkThrough.mp4)
|
|
37
|
+
[Download or watch the Video Walkthrough](https://raw.githubusercontent.com/vengatmacuser/react-native-inapp-inspector/main/example/guidance/Video-WalkThrough.mp4)
|
|
29
38
|
|
|
30
39
|
---
|
|
31
40
|
|
|
32
41
|
## Installation
|
|
33
42
|
|
|
34
|
-
|
|
43
|
+
```bash
|
|
44
|
+
npm install --save-dev react-native-inapp-inspector axios
|
|
45
|
+
```
|
|
35
46
|
|
|
36
47
|
```bash
|
|
37
|
-
|
|
38
|
-
# OR
|
|
39
|
-
yarn add -D react-native-inapp-inspector
|
|
48
|
+
yarn add -D react-native-inapp-inspector axios
|
|
40
49
|
```
|
|
41
50
|
|
|
42
|
-
The package
|
|
51
|
+
The package has React and React Native as peer dependencies. It depends on `@react-navigation/native`, `react-native-linear-gradient`, and `react-native-svg`. The current network logger imports `axios` for axios interception, so install `axios` even if most of your requests use `fetch`.
|
|
52
|
+
|
|
53
|
+
Install optional integrations when you use WebView or Firebase Analytics capture:
|
|
43
54
|
|
|
44
|
-
For iOS projects, don't forget to run pod install:
|
|
45
55
|
```bash
|
|
46
|
-
|
|
56
|
+
npm install react-native-webview @react-native-firebase/analytics
|
|
47
57
|
```
|
|
48
58
|
|
|
49
|
-
|
|
59
|
+
For iOS, install pods after adding native dependencies:
|
|
50
60
|
|
|
51
|
-
|
|
61
|
+
```bash
|
|
62
|
+
cd ios && pod install
|
|
63
|
+
```
|
|
52
64
|
|
|
53
65
|
---
|
|
54
66
|
|
|
55
|
-
##
|
|
67
|
+
## Basic Setup
|
|
56
68
|
|
|
57
|
-
|
|
58
|
-
Place the `<NetworkInspector />` component at the root level of your application (usually in `App.tsx` or your root navigation container):
|
|
69
|
+
Mount the inspector once near the root of your app.
|
|
59
70
|
|
|
60
71
|
```tsx
|
|
61
72
|
import React from 'react';
|
|
62
|
-
import {
|
|
73
|
+
import {SafeAreaView} from 'react-native';
|
|
63
74
|
import NetworkInspector from 'react-native-inapp-inspector';
|
|
64
75
|
|
|
65
76
|
const App = () => {
|
|
66
77
|
return (
|
|
67
|
-
<SafeAreaView style={{
|
|
68
|
-
{/* Your
|
|
69
|
-
|
|
70
|
-
{/* Floating Inspector overlay */}
|
|
78
|
+
<SafeAreaView style={{flex: 1}}>
|
|
79
|
+
{/* Your app */}
|
|
71
80
|
<NetworkInspector />
|
|
72
81
|
</SafeAreaView>
|
|
73
82
|
);
|
|
@@ -76,38 +85,188 @@ const App = () => {
|
|
|
76
85
|
export default App;
|
|
77
86
|
```
|
|
78
87
|
|
|
79
|
-
|
|
80
|
-
|
|
88
|
+
When mounted, the inspector sets up network logging, clears previous network logs, patches console logging, and attempts Firebase Analytics auto-setup if `@react-native-firebase/analytics` is installed.
|
|
89
|
+
|
|
90
|
+
If you need to capture requests that happen before the component mounts, call `setupNetworkLogger()` at module level in your app entry file.
|
|
91
|
+
|
|
92
|
+
```tsx
|
|
93
|
+
import NetworkInspector, {setupNetworkLogger} from 'react-native-inapp-inspector';
|
|
94
|
+
|
|
95
|
+
setupNetworkLogger();
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
You can disable the overlay without removing it from your tree:
|
|
99
|
+
|
|
100
|
+
```tsx
|
|
101
|
+
<NetworkInspector enabled={false} />
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
---
|
|
81
105
|
|
|
82
|
-
|
|
106
|
+
## Network Logging
|
|
107
|
+
|
|
108
|
+
`setupNetworkLogger()` patches global `fetch`, the default axios instance, and future axios instances created with `axios.create()`.
|
|
109
|
+
|
|
110
|
+
```tsx
|
|
83
111
|
import axios from 'axios';
|
|
84
|
-
import {
|
|
112
|
+
import {setupNetworkLogger} from 'react-native-inapp-inspector';
|
|
85
113
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
});
|
|
114
|
+
setupNetworkLogger();
|
|
115
|
+
|
|
116
|
+
const api = axios.create({baseURL: 'https://api.example.com'});
|
|
117
|
+
|
|
118
|
+
await fetch('https://api.example.com/users');
|
|
119
|
+
await api.post('/login', {email, password});
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
If an axios instance was created before `setupNetworkLogger()` ran, attach interceptors manually:
|
|
123
|
+
|
|
124
|
+
```tsx
|
|
125
|
+
import {addAxiosInterceptors} from 'react-native-inapp-inspector';
|
|
89
126
|
|
|
90
|
-
// Register the interceptor
|
|
91
127
|
addAxiosInterceptors(api);
|
|
92
128
|
```
|
|
93
129
|
|
|
94
|
-
|
|
95
|
-
|
|
130
|
+
Network logs are capped at 100 entries and ignore React Native symbolication requests.
|
|
131
|
+
|
|
132
|
+
---
|
|
96
133
|
|
|
97
|
-
|
|
98
|
-
import { subscribeAnalyticsEvents } from 'react-native-inapp-inspector';
|
|
134
|
+
## Console Logging
|
|
99
135
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
136
|
+
The inspector captures console output automatically when mounted. You can also set it up manually:
|
|
137
|
+
|
|
138
|
+
```tsx
|
|
139
|
+
import {setupConsoleLogger} from 'react-native-inapp-inspector';
|
|
140
|
+
|
|
141
|
+
setupConsoleLogger();
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Captured levels are `log`, `info`, `warn`, and `error`.
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## Analytics Logging
|
|
149
|
+
|
|
150
|
+
Manual events can be pushed into the Analytics tab:
|
|
151
|
+
|
|
152
|
+
```tsx
|
|
153
|
+
import {logAnalyticsEvent} from 'react-native-inapp-inspector';
|
|
154
|
+
|
|
155
|
+
logAnalyticsEvent('purchase_completed', {
|
|
156
|
+
item_id: 'SKU-42',
|
|
157
|
+
value: 29.99,
|
|
158
|
+
currency: 'USD',
|
|
103
159
|
});
|
|
104
160
|
```
|
|
105
161
|
|
|
162
|
+
For Firebase Analytics, pass the result of `analytics()` to `setupAnalyticsLogger()` before analytics calls begin:
|
|
163
|
+
|
|
164
|
+
```tsx
|
|
165
|
+
import analytics from '@react-native-firebase/analytics';
|
|
166
|
+
import {setupAnalyticsLogger} from 'react-native-inapp-inspector';
|
|
167
|
+
|
|
168
|
+
setupAnalyticsLogger(analytics());
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
The logger patches `logEvent`, `logScreenView`, `setUserProperty`, `setUserProperties`, and `setUserId`. Analytics events are capped at 200 entries.
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
## Redux Inspection
|
|
176
|
+
|
|
177
|
+
Connect your Redux store once during app startup.
|
|
178
|
+
|
|
179
|
+
```tsx
|
|
180
|
+
import {connectReduxStore} from 'react-native-inapp-inspector';
|
|
181
|
+
import store from './store';
|
|
182
|
+
|
|
183
|
+
connectReduxStore(store);
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
The Redux tab shows the latest state tree, recent dispatches, payloads, and changed top-level state slices. Action history is capped at 50 entries.
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
## WebView Inspection
|
|
191
|
+
|
|
192
|
+
Use the exported `WebView` as a drop-in wrapper around `react-native-webview`.
|
|
193
|
+
|
|
194
|
+
```tsx
|
|
195
|
+
import {WebView} from 'react-native-inapp-inspector';
|
|
196
|
+
|
|
197
|
+
<WebView source={{uri: 'https://example.com'}} />;
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
The wrapper forwards your props and ref, preserves your `onMessage`, `onNavigationStateChange`, `onLoadStart`, and `onLoadEnd` handlers, and injects scripts for WebView console logs, navigation history, and source snapshots.
|
|
201
|
+
|
|
202
|
+
Disable the loading overlay with `showLoader={false}`:
|
|
203
|
+
|
|
204
|
+
```tsx
|
|
205
|
+
<WebView source={{uri: 'https://example.com'}} showLoader={false} />
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
---
|
|
209
|
+
|
|
210
|
+
## Error Boundary
|
|
211
|
+
|
|
212
|
+
```tsx
|
|
213
|
+
import {ErrorBoundary} from 'react-native-inapp-inspector';
|
|
214
|
+
|
|
215
|
+
<ErrorBoundary>
|
|
216
|
+
<YourComponent />
|
|
217
|
+
</ErrorBoundary>
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
---
|
|
221
|
+
|
|
222
|
+
## Public API
|
|
223
|
+
|
|
224
|
+
| Export | Type | Description |
|
|
225
|
+
|---|---|---|
|
|
226
|
+
| `NetworkInspector` | default component | Floating inspector overlay. Mount once near the root of the app. |
|
|
227
|
+
| `setupNetworkLogger()` | function | Patches `fetch`, default axios, and future `axios.create()` instances. |
|
|
228
|
+
| `addAxiosInterceptors(instance)` | function | Manually attaches axios interceptors to an existing instance. |
|
|
229
|
+
| `clearNetworkLogs()` | function | Clears captured network logs. |
|
|
230
|
+
| `subscribeNetworkLogs(callback)` | function | Subscribes to network log updates and returns an unsubscribe function. |
|
|
231
|
+
| `setupConsoleLogger()` | function | Patches console methods. |
|
|
232
|
+
| `clearConsoleLogs()` | function | Clears captured console logs. |
|
|
233
|
+
| `subscribeConsoleLogs(callback)` | function | Subscribes to console log updates and returns an unsubscribe function. |
|
|
234
|
+
| `setupAnalyticsLogger(instance)` | function | Patches a Firebase Analytics instance. |
|
|
235
|
+
| `logAnalyticsEvent(name, params?, userProperties?)` | function | Adds a manual analytics event to the inspector. |
|
|
236
|
+
| `clearAnalyticsEvents()` | function | Clears captured analytics events. |
|
|
237
|
+
| `subscribeAnalyticsEvents(callback)` | function | Subscribes to analytics event updates and returns an unsubscribe function. |
|
|
238
|
+
| `connectReduxStore(store)` | function | Connects a Redux store for live state and action inspection. |
|
|
239
|
+
| `getReduxState()` | function | Returns the latest captured Redux state. |
|
|
240
|
+
| `subscribeReduxState(callback)` | function | Subscribes to Redux state updates and returns an unsubscribe function. |
|
|
241
|
+
| `WebView` | component | Instrumented WebView wrapper. |
|
|
242
|
+
| `getWebViewLogs()` | function | Returns captured WebView console logs. |
|
|
243
|
+
| `getWebViewNavHistory()` | function | Returns captured WebView navigation history. |
|
|
244
|
+
| `getWebViewHtml()` | function | Returns the latest captured WebView HTML. |
|
|
245
|
+
| `getWebViewCss()` | function | Returns the latest captured WebView CSS. |
|
|
246
|
+
| `getWebViewJs()` | function | Returns the latest captured WebView JavaScript. |
|
|
247
|
+
| `getWebViewHtmlUrl()` | function | Returns the URL for the latest captured WebView source snapshot. |
|
|
248
|
+
| `clearWebViewData()` | function | Clears captured WebView logs, navigation, and source data. |
|
|
249
|
+
| `subscribeWebView(callback)` | function | Subscribes to WebView data changes and returns an unsubscribe function. |
|
|
250
|
+
| `ErrorBoundary` | component | React error boundary component. |
|
|
251
|
+
|
|
252
|
+
---
|
|
253
|
+
|
|
254
|
+
## Example App
|
|
255
|
+
|
|
256
|
+
The `example` directory contains a React Native sample app and video walkthrough.
|
|
257
|
+
|
|
258
|
+
```bash
|
|
259
|
+
cd example
|
|
260
|
+
npm install
|
|
261
|
+
cd ios && pod install && cd ..
|
|
262
|
+
npm run ios
|
|
263
|
+
```
|
|
264
|
+
|
|
106
265
|
---
|
|
107
266
|
|
|
108
267
|
## Support
|
|
109
268
|
|
|
110
|
-
If you find this project useful, consider sponsoring its development
|
|
269
|
+
If you find this project useful, consider sponsoring its development:
|
|
111
270
|
|
|
112
271
|
[](https://github.com/sponsors/vengatmacuser)
|
|
113
272
|
|
|
@@ -115,4 +274,4 @@ If you find this project useful, consider sponsoring its development on GitHub S
|
|
|
115
274
|
|
|
116
275
|
## License
|
|
117
276
|
|
|
118
|
-
|
|
277
|
+
MIT - see the [LICENSE](LICENSE) file for details.
|
|
@@ -19,3 +19,4 @@ export declare const logAnalyticsEvent: (name: string, params?: Record<string, a
|
|
|
19
19
|
* setupAnalyticsLogger(analytics());
|
|
20
20
|
*/
|
|
21
21
|
export declare const setupAnalyticsLogger: (analyticsInstance: any) => void;
|
|
22
|
+
export declare const autoSetupAnalyticsLogger: () => boolean;
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
// setUserId(id)
|
|
23
23
|
// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.setupAnalyticsLogger = exports.logAnalyticsEvent = exports.getAnalyticsEvents = exports.clearAnalyticsEvents = exports.subscribeAnalyticsEvents = void 0;
|
|
25
|
+
exports.autoSetupAnalyticsLogger = exports.setupAnalyticsLogger = exports.logAnalyticsEvent = exports.getAnalyticsEvents = exports.clearAnalyticsEvents = exports.subscribeAnalyticsEvents = void 0;
|
|
26
26
|
// βββ Internal state βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
27
27
|
let events = [];
|
|
28
28
|
let listeners = [];
|
|
@@ -33,7 +33,7 @@ let currentUserId;
|
|
|
33
33
|
// βββ Core helpers βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
34
34
|
const notify = () => {
|
|
35
35
|
const snapshot = [...events];
|
|
36
|
-
listeners.forEach(
|
|
36
|
+
listeners.forEach(cb => cb(snapshot));
|
|
37
37
|
};
|
|
38
38
|
const addEvent = (event) => {
|
|
39
39
|
events.unshift(event);
|
|
@@ -45,7 +45,7 @@ const subscribeAnalyticsEvents = (callback) => {
|
|
|
45
45
|
listeners.push(callback);
|
|
46
46
|
callback([...events]);
|
|
47
47
|
return () => {
|
|
48
|
-
listeners = listeners.filter(
|
|
48
|
+
listeners = listeners.filter(l => l !== callback);
|
|
49
49
|
};
|
|
50
50
|
};
|
|
51
51
|
exports.subscribeAnalyticsEvents = subscribeAnalyticsEvents;
|
|
@@ -68,10 +68,10 @@ const logAnalyticsEvent = (name, params = {}, userProperties = {}) => {
|
|
|
68
68
|
params,
|
|
69
69
|
userProperties: { ...currentUserProperties, ...userProperties },
|
|
70
70
|
timestamp: Date.now(),
|
|
71
|
-
source:
|
|
72
|
-
userId: currentUserId ??
|
|
73
|
-
screenName:
|
|
74
|
-
screenClass:
|
|
71
|
+
source: 'manual',
|
|
72
|
+
userId: currentUserId ?? '',
|
|
73
|
+
screenName: '',
|
|
74
|
+
screenClass: '',
|
|
75
75
|
});
|
|
76
76
|
};
|
|
77
77
|
exports.logAnalyticsEvent = logAnalyticsEvent;
|
|
@@ -89,7 +89,7 @@ exports.logAnalyticsEvent = logAnalyticsEvent;
|
|
|
89
89
|
*/
|
|
90
90
|
const setupAnalyticsLogger = (analyticsInstance) => {
|
|
91
91
|
if (!analyticsInstance) {
|
|
92
|
-
console.warn(
|
|
92
|
+
console.warn('[AnalyticsLogger] No analytics instance provided β skipping setup.');
|
|
93
93
|
return;
|
|
94
94
|
}
|
|
95
95
|
// Guard against double-patching the same instance
|
|
@@ -105,10 +105,10 @@ const setupAnalyticsLogger = (analyticsInstance) => {
|
|
|
105
105
|
params: params ?? {},
|
|
106
106
|
userProperties: { ...currentUserProperties },
|
|
107
107
|
timestamp: Date.now(),
|
|
108
|
-
source:
|
|
109
|
-
userId: currentUserId ??
|
|
110
|
-
screenName:
|
|
111
|
-
screenClass:
|
|
108
|
+
source: 'firebase',
|
|
109
|
+
userId: currentUserId ?? '',
|
|
110
|
+
screenName: '',
|
|
111
|
+
screenClass: '',
|
|
112
112
|
});
|
|
113
113
|
return originalLogEvent(name, params);
|
|
114
114
|
};
|
|
@@ -117,14 +117,14 @@ const setupAnalyticsLogger = (analyticsInstance) => {
|
|
|
117
117
|
analyticsInstance.logScreenView = async (params) => {
|
|
118
118
|
addEvent({
|
|
119
119
|
id: counter++,
|
|
120
|
-
name:
|
|
120
|
+
name: 'screen_view',
|
|
121
121
|
params: params ?? {},
|
|
122
122
|
userProperties: { ...currentUserProperties },
|
|
123
123
|
timestamp: Date.now(),
|
|
124
|
-
source:
|
|
125
|
-
screenName: params?.screen_name ??
|
|
126
|
-
screenClass: params?.screen_class ??
|
|
127
|
-
userId: currentUserId ??
|
|
124
|
+
source: 'firebase',
|
|
125
|
+
screenName: params?.screen_name ?? '',
|
|
126
|
+
screenClass: params?.screen_class ?? '',
|
|
127
|
+
userId: currentUserId ?? '',
|
|
128
128
|
});
|
|
129
129
|
return originalLogScreenView(params);
|
|
130
130
|
};
|
|
@@ -158,3 +158,43 @@ const setupAnalyticsLogger = (analyticsInstance) => {
|
|
|
158
158
|
};
|
|
159
159
|
};
|
|
160
160
|
exports.setupAnalyticsLogger = setupAnalyticsLogger;
|
|
161
|
+
const autoSetupAnalyticsLogger = () => {
|
|
162
|
+
if (globalThis.__INSPECTOR_ANALYTICS_AUTOSETUP__)
|
|
163
|
+
return true;
|
|
164
|
+
let mod;
|
|
165
|
+
try {
|
|
166
|
+
mod = require('@react-native-firebase/analytics'); // optional dep
|
|
167
|
+
}
|
|
168
|
+
catch {
|
|
169
|
+
return false; // GA not installed β silent no-op
|
|
170
|
+
}
|
|
171
|
+
const accessor = mod?.default ?? mod;
|
|
172
|
+
if (typeof accessor !== 'function')
|
|
173
|
+
return false;
|
|
174
|
+
try {
|
|
175
|
+
(0, exports.setupAnalyticsLogger)(accessor());
|
|
176
|
+
}
|
|
177
|
+
catch { } // patch default-app instance
|
|
178
|
+
if (!accessor.__INSPECTOR_WRAPPED__) {
|
|
179
|
+
// patch future/named instances
|
|
180
|
+
const wrapped = function (...args) {
|
|
181
|
+
const instance = accessor.apply(this, args);
|
|
182
|
+
try {
|
|
183
|
+
(0, exports.setupAnalyticsLogger)(instance);
|
|
184
|
+
}
|
|
185
|
+
catch { }
|
|
186
|
+
return instance;
|
|
187
|
+
};
|
|
188
|
+
Object.setPrototypeOf(wrapped, accessor);
|
|
189
|
+
Object.assign(wrapped, accessor);
|
|
190
|
+
wrapped.__INSPECTOR_WRAPPED__ = true;
|
|
191
|
+
try {
|
|
192
|
+
if (mod.default !== undefined)
|
|
193
|
+
mod.default = wrapped;
|
|
194
|
+
}
|
|
195
|
+
catch { }
|
|
196
|
+
}
|
|
197
|
+
globalThis.__INSPECTOR_ANALYTICS_AUTOSETUP__ = true;
|
|
198
|
+
return true;
|
|
199
|
+
};
|
|
200
|
+
exports.autoSetupAnalyticsLogger = autoSetupAnalyticsLogger;
|