react-native-inapp-inspector 2.2.4 → 2.2.6

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.
Files changed (43) hide show
  1. package/README.md +0 -10
  2. package/dist/commonjs/components/BrandSquareIcon.js +51 -117
  3. package/dist/commonjs/components/Inspector/InspectorHeader.js +0 -73
  4. package/dist/commonjs/components/Inspector/MainScreen.js +0 -4
  5. package/dist/commonjs/components/Inspector/SettingsPanel.js +2 -107
  6. package/dist/commonjs/constants/version.d.ts +1 -1
  7. package/dist/commonjs/constants/version.js +1 -1
  8. package/dist/commonjs/helpers/index.d.ts +0 -1
  9. package/dist/commonjs/helpers/index.js +0 -1
  10. package/dist/commonjs/index.d.ts +1 -1
  11. package/dist/commonjs/index.js +2 -19
  12. package/dist/commonjs/native/NativeInspector.js +50 -26
  13. package/dist/esm/components/BrandSquareIcon.js +52 -118
  14. package/dist/esm/components/Inspector/InspectorHeader.js +0 -73
  15. package/dist/esm/components/Inspector/MainScreen.js +0 -4
  16. package/dist/esm/components/Inspector/SettingsPanel.js +2 -107
  17. package/dist/esm/constants/version.d.ts +1 -1
  18. package/dist/esm/constants/version.js +1 -1
  19. package/dist/esm/helpers/index.d.ts +0 -1
  20. package/dist/esm/helpers/index.js +0 -1
  21. package/dist/esm/index.d.ts +1 -1
  22. package/dist/esm/index.js +2 -12
  23. package/dist/esm/native/NativeInspector.js +51 -27
  24. package/ios/NetworkInspectorModule.mm +34 -19
  25. package/package.json +2 -2
  26. package/src/components/BrandSquareIcon.tsx +109 -118
  27. package/src/components/Inspector/InspectorHeader.tsx +0 -93
  28. package/src/components/Inspector/MainScreen.tsx +0 -4
  29. package/src/components/Inspector/SettingsPanel.tsx +2 -128
  30. package/src/constants/version.ts +1 -1
  31. package/src/helpers/index.ts +0 -1
  32. package/src/index.tsx +2 -24
  33. package/src/native/NativeInspector.ts +56 -24
  34. package/dist/commonjs/components/Inspector/TelemetryConsentModal.d.ts +0 -3
  35. package/dist/commonjs/components/Inspector/TelemetryConsentModal.js +0 -368
  36. package/dist/commonjs/helpers/telemetry.d.ts +0 -99
  37. package/dist/commonjs/helpers/telemetry.js +0 -398
  38. package/dist/esm/components/Inspector/TelemetryConsentModal.d.ts +0 -3
  39. package/dist/esm/components/Inspector/TelemetryConsentModal.js +0 -331
  40. package/dist/esm/helpers/telemetry.d.ts +0 -99
  41. package/dist/esm/helpers/telemetry.js +0 -380
  42. package/src/components/Inspector/TelemetryConsentModal.tsx +0 -416
  43. package/src/helpers/telemetry.ts +0 -505
@@ -1,368 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.TelemetryConsentModal = void 0;
37
- const react_1 = __importStar(require("react"));
38
- const react_native_1 = require("react-native");
39
- const react_native_svg_1 = __importStar(require("react-native-svg"));
40
- const BrandSquareIcon_1 = require("../BrandSquareIcon");
41
- const telemetry_1 = require("../../helpers/telemetry");
42
- // ─── Inline Crisp SVG Icons ───────────────────────────────────────────────────
43
- const ShieldCheckSvg = ({ size = 15, color = '#7C3AED' }) => (<react_native_svg_1.default width={size} height={size} viewBox="0 0 24 24" fill="none">
44
- <react_native_svg_1.Path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z" stroke={color} strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
45
- <react_native_svg_1.Path d="M9 12l2 2 4-4" stroke={color} strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
46
- </react_native_svg_1.default>);
47
- const CheckSvg = ({ size = 14, color = '#FFFFFF' }) => (<react_native_svg_1.default width={size} height={size} viewBox="0 0 24 24" fill="none">
48
- <react_native_svg_1.Path d="M20 6L9 17l-5-5" stroke={color} strokeWidth="2.4" strokeLinecap="round" strokeLinejoin="round"/>
49
- </react_native_svg_1.default>);
50
- const CloseSvg = ({ size = 13, color = '#64748B' }) => (<react_native_svg_1.default width={size} height={size} viewBox="0 0 24 24" fill="none">
51
- <react_native_svg_1.Path d="M18 6L6 18M6 6l12 12" stroke={color} strokeWidth="2.2" strokeLinecap="round" strokeLinejoin="round"/>
52
- </react_native_svg_1.default>);
53
- const GearSvg = ({ size = 13, color = '#6366F1' }) => (<react_native_svg_1.default width={size} height={size} viewBox="0 0 24 24" fill="none">
54
- <react_native_svg_1.Path d="M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z" stroke={color} strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
55
- <react_native_svg_1.Path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1Z" stroke={color} strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
56
- </react_native_svg_1.default>);
57
- const TelemetryConsentModal = () => {
58
- const [visible, setVisible] = (0, react_1.useState)(false);
59
- const fadeAnim = (0, react_1.useState)(new react_native_1.Animated.Value(0))[0];
60
- const scaleAnim = (0, react_1.useState)(new react_native_1.Animated.Value(0.92))[0];
61
- (0, react_1.useEffect)(() => {
62
- let isMounted = true;
63
- (0, telemetry_1.getTelemetryConsentStatus)().then(status => {
64
- if (isMounted && status === 'undetermined') {
65
- setVisible(true);
66
- react_native_1.Animated.parallel([
67
- react_native_1.Animated.timing(fadeAnim, {
68
- toValue: 1,
69
- duration: 250,
70
- useNativeDriver: true,
71
- }),
72
- react_native_1.Animated.spring(scaleAnim, {
73
- toValue: 1,
74
- friction: 8,
75
- tension: 45,
76
- useNativeDriver: true,
77
- }),
78
- ]).start();
79
- }
80
- });
81
- return () => {
82
- isMounted = false;
83
- };
84
- }, [fadeAnim, scaleAnim]);
85
- const handleDecision = async (granted) => {
86
- react_native_1.Animated.parallel([
87
- react_native_1.Animated.timing(fadeAnim, {
88
- toValue: 0,
89
- duration: 180,
90
- useNativeDriver: true,
91
- }),
92
- react_native_1.Animated.timing(scaleAnim, {
93
- toValue: 0.92,
94
- duration: 180,
95
- useNativeDriver: true,
96
- }),
97
- ]).start(async () => {
98
- setVisible(false);
99
- await (0, telemetry_1.setTelemetryConsent)(granted);
100
- if (granted) {
101
- // Immediately trigger the session initialization ping
102
- (0, telemetry_1.sendSessionTelemetryPing)({ force: true });
103
- }
104
- });
105
- };
106
- if (!visible)
107
- return null;
108
- return (<react_native_1.Modal transparent visible={visible} animationType="none" statusBarTranslucent>
109
- <react_native_1.View style={styles.overlay}>
110
- <react_native_1.Animated.View style={[
111
- styles.card,
112
- {
113
- opacity: fadeAnim,
114
- transform: [{ scale: scaleAnim }],
115
- },
116
- ]}>
117
- {/* Top-Right Dismiss Icon Button */}
118
- <react_native_1.TouchableOpacity style={styles.topCloseButton} onPress={() => handleDecision(false)} hitSlop={10} activeOpacity={0.7}>
119
- <CloseSvg size={13} color="#64748B"/>
120
- </react_native_1.TouchableOpacity>
121
-
122
- {/* Centered Enlarged Square Brand Icon Header */}
123
- <react_native_1.View style={styles.headerSection}>
124
- <react_native_1.View style={styles.iconHaloRing}>
125
- <BrandSquareIcon_1.BrandSquareIcon size={54}/>
126
- </react_native_1.View>
127
-
128
- <react_native_1.Text style={styles.title}>Help Improve In-App Inspector</react_native_1.Text>
129
- <react_native_1.Text style={styles.subtitle}>Anonymous Diagnostic Insights</react_native_1.Text>
130
-
131
- {/* Subheading instruction hint badge */}
132
- <react_native_1.View style={styles.hintBadge}>
133
- <GearSvg size={12} color="#6366F1"/>
134
- <react_native_1.Text style={styles.hintBadgeText}>
135
- You can enable or disable this anytime in Settings
136
- </react_native_1.Text>
137
- </react_native_1.View>
138
- </react_native_1.View>
139
-
140
- {/* Description */}
141
- <react_native_1.Text style={styles.description}>
142
- To help us continually enhance tooling performance and compatibility,
143
- would you mind sharing anonymous diagnostics (such as React Native
144
- version, JavaScript engine, and device architecture)?
145
- </react_native_1.Text>
146
-
147
- {/* Privacy Callout Box */}
148
- <react_native_1.View style={styles.privacyBadge}>
149
- <react_native_1.View style={styles.privacyShieldWrapper}>
150
- <ShieldCheckSvg size={15} color="#7C3AED"/>
151
- </react_native_1.View>
152
- <react_native_1.Text style={styles.privacyText}>
153
- <react_native_1.Text style={styles.privacyHighlight}>Privacy Guaranteed:</react_native_1.Text> We
154
- strictly collect non-identifiable technical metrics. No user data,
155
- passwords, tokens, or network payload bodies are ever captured.
156
- </react_native_1.Text>
157
- </react_native_1.View>
158
-
159
- {/* Enhanced Action Buttons with Icons */}
160
- <react_native_1.View style={styles.buttonRow}>
161
- <react_native_1.TouchableOpacity style={styles.declineButton} onPress={() => handleDecision(false)} activeOpacity={0.7}>
162
- <CloseSvg size={12} color="#64748B"/>
163
- <react_native_1.Text style={styles.declineText}>Not Now</react_native_1.Text>
164
- </react_native_1.TouchableOpacity>
165
-
166
- <react_native_1.TouchableOpacity style={styles.allowButton} onPress={() => handleDecision(true)} activeOpacity={0.85}>
167
- <CheckSvg size={13} color="#FFFFFF"/>
168
- <react_native_1.Text style={styles.allowText}>Allow & Share</react_native_1.Text>
169
- </react_native_1.TouchableOpacity>
170
- </react_native_1.View>
171
- </react_native_1.Animated.View>
172
- </react_native_1.View>
173
- </react_native_1.Modal>);
174
- };
175
- exports.TelemetryConsentModal = TelemetryConsentModal;
176
- const fontStack = react_native_1.Platform.select({
177
- ios: {
178
- fontFamily: 'System',
179
- },
180
- android: {
181
- fontFamily: 'sans-serif',
182
- },
183
- default: {},
184
- });
185
- const styles = react_native_1.StyleSheet.create({
186
- overlay: {
187
- flex: 1,
188
- backgroundColor: 'rgba(15, 23, 42, 0.56)',
189
- justifyContent: 'center',
190
- alignItems: 'center',
191
- paddingHorizontal: 20,
192
- zIndex: 999999,
193
- },
194
- card: {
195
- width: '100%',
196
- maxWidth: 356,
197
- backgroundColor: '#FFFFFF',
198
- borderRadius: 24,
199
- borderWidth: 1,
200
- borderColor: '#E2E8F0',
201
- paddingHorizontal: 20,
202
- paddingTop: 22,
203
- paddingBottom: 20,
204
- alignItems: 'center',
205
- shadowColor: '#0F172A',
206
- shadowOffset: { width: 0, height: 16 },
207
- shadowOpacity: 0.22,
208
- shadowRadius: 32,
209
- elevation: 24,
210
- },
211
- topCloseButton: {
212
- position: 'absolute',
213
- top: 14,
214
- right: 14,
215
- width: 28,
216
- height: 28,
217
- borderRadius: 14,
218
- backgroundColor: '#F8FAFC',
219
- justifyContent: 'center',
220
- alignItems: 'center',
221
- borderWidth: 1,
222
- borderColor: '#E2E8F0',
223
- zIndex: 10,
224
- },
225
- headerSection: {
226
- alignItems: 'center',
227
- width: '100%',
228
- marginBottom: 4,
229
- },
230
- iconHaloRing: {
231
- width: 66,
232
- height: 66,
233
- borderRadius: 20,
234
- backgroundColor: '#FAF5FF',
235
- justifyContent: 'center',
236
- alignItems: 'center',
237
- borderWidth: 1.5,
238
- borderColor: '#F3E8FF',
239
- marginBottom: 8,
240
- shadowColor: '#7C3AED',
241
- shadowOffset: { width: 0, height: 4 },
242
- shadowOpacity: 0.16,
243
- shadowRadius: 10,
244
- elevation: 4,
245
- },
246
- title: {
247
- fontSize: 17,
248
- fontWeight: '800',
249
- color: '#0F172A',
250
- letterSpacing: -0.4,
251
- textAlign: 'center',
252
- lineHeight: 22,
253
- marginBottom: 2,
254
- ...fontStack,
255
- },
256
- subtitle: {
257
- fontSize: 11.5,
258
- fontWeight: '600',
259
- color: '#7C3AED',
260
- textAlign: 'center',
261
- letterSpacing: 0.2,
262
- marginBottom: 6,
263
- ...fontStack,
264
- },
265
- hintBadge: {
266
- flexDirection: 'row',
267
- alignItems: 'center',
268
- justifyContent: 'center',
269
- gap: 5,
270
- backgroundColor: '#EDE9FE80',
271
- borderWidth: 1,
272
- borderColor: '#DDD6FE',
273
- borderRadius: 7,
274
- paddingHorizontal: 8,
275
- paddingVertical: 3,
276
- marginBottom: 8,
277
- },
278
- hintBadgeText: {
279
- fontSize: 10,
280
- fontWeight: '600',
281
- color: '#6D28D9',
282
- textAlign: 'center',
283
- ...fontStack,
284
- },
285
- description: {
286
- fontSize: 12,
287
- lineHeight: 17.5,
288
- color: '#475569',
289
- textAlign: 'center',
290
- marginBottom: 12,
291
- paddingHorizontal: 2,
292
- ...fontStack,
293
- },
294
- privacyBadge: {
295
- flexDirection: 'row',
296
- alignItems: 'flex-start',
297
- backgroundColor: '#F8FAFC',
298
- borderRadius: 12,
299
- paddingVertical: 8,
300
- paddingHorizontal: 10,
301
- borderWidth: 1,
302
- borderColor: '#E2E8F0',
303
- marginBottom: 14,
304
- width: '100%',
305
- },
306
- privacyShieldWrapper: {
307
- marginRight: 7,
308
- marginTop: 1,
309
- },
310
- privacyText: {
311
- flex: 1,
312
- fontSize: 10.8,
313
- lineHeight: 15,
314
- color: '#475569',
315
- ...fontStack,
316
- },
317
- privacyHighlight: {
318
- fontWeight: '700',
319
- color: '#1E293B',
320
- },
321
- buttonRow: {
322
- flexDirection: 'row',
323
- justifyContent: 'space-between',
324
- alignItems: 'center',
325
- gap: 10,
326
- width: '100%',
327
- },
328
- declineButton: {
329
- flex: 1,
330
- flexDirection: 'row',
331
- alignItems: 'center',
332
- justifyContent: 'center',
333
- gap: 5,
334
- paddingVertical: 11,
335
- borderRadius: 12,
336
- backgroundColor: '#F1F5F9',
337
- borderWidth: 1,
338
- borderColor: '#E2E8F0',
339
- },
340
- declineText: {
341
- fontSize: 13,
342
- fontWeight: '600',
343
- color: '#475569',
344
- ...fontStack,
345
- },
346
- allowButton: {
347
- flex: 1,
348
- flexDirection: 'row',
349
- alignItems: 'center',
350
- justifyContent: 'center',
351
- gap: 5,
352
- paddingVertical: 11,
353
- borderRadius: 12,
354
- backgroundColor: '#7C3AED',
355
- shadowColor: '#7C3AED',
356
- shadowOffset: { width: 0, height: 3 },
357
- shadowOpacity: 0.28,
358
- shadowRadius: 6,
359
- elevation: 4,
360
- },
361
- allowText: {
362
- fontSize: 13,
363
- fontWeight: '700',
364
- color: '#FFFFFF',
365
- ...fontStack,
366
- },
367
- });
368
- exports.default = exports.TelemetryConsentModal;
@@ -1,99 +0,0 @@
1
- export declare const GA4_MEASUREMENT_ID = "G-XXXXXXXXXX";
2
- export declare const GA4_API_SECRET = "YOUR_GA4_API_SECRET";
3
- /**
4
- * Asynchronously loads host application and device metadata (strictly non-PII/technical).
5
- */
6
- export declare function loadAppDiagnosticsAsync(): Promise<Record<string, any>>;
7
- /**
8
- * Returns the developer's telemetry consent status.
9
- */
10
- export declare function getTelemetryConsentStatus(): Promise<'granted' | 'declined' | 'undetermined'>;
11
- /**
12
- * Saves the developer's telemetry consent choice.
13
- */
14
- export declare function setTelemetryConsent(granted: boolean): Promise<void>;
15
- /**
16
- * Checks if the user or environment has opted out of telemetry.
17
- */
18
- export declare function isTelemetryOptedOut(explicitSetting?: boolean): boolean;
19
- /**
20
- * Track an anonymous event via GA4 Measurement Protocol.
21
- */
22
- export declare function trackTelemetryEvent(eventName: string, params?: Record<string, any>, options?: {
23
- telemetry?: boolean;
24
- force?: boolean;
25
- }): Promise<void>;
26
- /**
27
- * 1. Session initialization heartbeat ping.
28
- */
29
- export declare function sendSessionTelemetryPing(options?: {
30
- telemetry?: boolean;
31
- environment?: string;
32
- hasNavigation?: boolean;
33
- hasAppIcon?: boolean;
34
- force?: boolean;
35
- }): Promise<void>;
36
- /**
37
- * 2. Track when the inspector modal is opened.
38
- */
39
- export declare function trackInspectorOpen(options?: {
40
- activeTab?: string;
41
- openSource?: 'fab' | 'shake' | 'programmatic';
42
- telemetry?: boolean;
43
- }): void;
44
- /**
45
- * 3. Track when the inspector modal is closed.
46
- */
47
- export declare function trackInspectorClose(options?: {
48
- telemetry?: boolean;
49
- }): void;
50
- /**
51
- * 4. Track tab / page view navigation inside the inspector.
52
- */
53
- export declare function trackTabSwitch(tabName: string, options?: {
54
- telemetry?: boolean;
55
- fromTab?: string;
56
- }): void;
57
- /**
58
- * 5. Track network API interaction (inspect details, copy cURL, retry).
59
- */
60
- export declare function trackNetworkInteraction(action: 'view_detail' | 'copy_curl' | 'retry_request' | 'copy_url' | 'clear_logs' | 'export_har', options?: {
61
- method?: string;
62
- statusCode?: number;
63
- durationMs?: number;
64
- telemetry?: boolean;
65
- }): void;
66
- /**
67
- * 6. Track Redux / State management interaction.
68
- */
69
- export declare function trackReduxInteraction(action: 'view_diff' | 'view_state' | 'view_action' | 'filter_reducer', options?: {
70
- reducerName?: string;
71
- telemetry?: boolean;
72
- }): void;
73
- /**
74
- * 7. Track Crash & Exception interaction.
75
- */
76
- export declare function trackCrashInteraction(action: 'view_crash_detail' | 'share_crash_report' | 'copy_stacktrace' | 'clear_crashes', options?: {
77
- crashType?: string;
78
- telemetry?: boolean;
79
- }): void;
80
- /**
81
- * 8. Track Performance monitoring tab interaction.
82
- */
83
- export declare function trackPerformanceInteraction(subTab: 'fps' | 'memory' | 'rerenders' | 'bundles', options?: {
84
- telemetry?: boolean;
85
- }): void;
86
- /**
87
- * 9. Track search queries and filter applications.
88
- */
89
- export declare function trackSearchOrFilter(target: 'apis' | 'console' | 'redux' | 'crashes' | 'analytics', actionType: 'search_query' | 'status_filter' | 'method_filter' | 'tag_filter', options?: {
90
- filterValue?: string;
91
- telemetry?: boolean;
92
- }): void;
93
- /**
94
- * 10. Track when logs / reports are exported or shared.
95
- */
96
- export declare function trackLogExport(exportType: 'logs_json' | 'logs_har' | 'curl' | 'crash_report', options?: {
97
- telemetry?: boolean;
98
- count?: number;
99
- }): void;