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
@@ -31,11 +31,6 @@ import {isReduxConnected} from '../../customHooks/reduxLogger';
31
31
  import {isAnalyticsConnected} from '../../customHooks/analyticsLogger';
32
32
  import {useTranslation} from '../../i18n';
33
33
  import {ActiveTab} from '../../types';
34
- import {
35
- getTelemetryConsentStatus,
36
- setTelemetryConsent,
37
- sendSessionTelemetryPing,
38
- } from '../../helpers/telemetry';
39
34
  import {
40
35
  SignalIcon,
41
36
  TerminalIcon,
@@ -121,22 +116,6 @@ const SettingsPanel = () => {
121
116
  } = useInspector();
122
117
 
123
118
  const [stagedHeight, setStagedHeight] = useState(modalHeightPercent);
124
- const [telemetryConsent, setTelemetryConsentState] = useState<boolean>(true);
125
-
126
- useEffect(() => {
127
- getTelemetryConsentStatus().then(status => {
128
- setTelemetryConsentState(status === 'granted');
129
- });
130
- }, []);
131
-
132
- const handleToggleTelemetry = async () => {
133
- const nextVal = !telemetryConsent;
134
- setTelemetryConsentState(nextVal);
135
- await setTelemetryConsent(nextVal);
136
- if (nextVal) {
137
- sendSessionTelemetryPing({force: true});
138
- }
139
- };
140
119
 
141
120
  useEffect(() => {
142
121
  setStagedHeight(modalHeightPercent);
@@ -1679,112 +1658,7 @@ const SettingsPanel = () => {
1679
1658
  </View>
1680
1659
  </View>
1681
1660
 
1682
- {/* Section 4: Privacy & Diagnostics */}
1683
- <View
1684
- style={{
1685
- backgroundColor: AppColors.primaryLight,
1686
- borderRadius: 14,
1687
- borderWidth: 1,
1688
- borderColor: AppColors.grayBorderSecondary,
1689
- overflow: 'hidden',
1690
- padding: 14,
1691
- gap: 12,
1692
- }}>
1693
- <Text
1694
- style={{
1695
- fontFamily: AppFonts.interBold,
1696
- fontSize: 11,
1697
- lineHeight: 14,
1698
- color: AppColors.grayTextWeak,
1699
- letterSpacing: 0.8,
1700
- }}>
1701
- PRIVACY & ANONYMOUS DIAGNOSTICS
1702
- </Text>
1703
-
1704
- <View
1705
- style={{
1706
- flexDirection: 'row',
1707
- alignItems: 'center',
1708
- justifyContent: 'space-between',
1709
- }}>
1710
- <View
1711
- style={{
1712
- flexDirection: 'row',
1713
- alignItems: 'center',
1714
- gap: 10,
1715
- flex: 1,
1716
- marginRight: 10,
1717
- }}>
1718
- <View
1719
- style={{
1720
- width: 32,
1721
- height: 32,
1722
- borderRadius: 8,
1723
- backgroundColor: AppColors.purpleShade50,
1724
- alignItems: 'center',
1725
- justifyContent: 'center',
1726
- }}>
1727
- <ShieldAlertIcon color={AppColors.purple} size={15} />
1728
- </View>
1729
- <View style={{flex: 1}}>
1730
- <Text
1731
- style={{
1732
- fontFamily: AppFonts.interBold,
1733
- fontSize: 13.5,
1734
- lineHeight: 18,
1735
- color: AppColors.primaryBlack,
1736
- }}>
1737
- Help Improve In-App Inspector
1738
- </Text>
1739
- <Text
1740
- style={{
1741
- fontFamily: AppFonts.interRegular,
1742
- fontSize: 11,
1743
- lineHeight: 15,
1744
- color: AppColors.grayText,
1745
- marginTop: 1,
1746
- }}>
1747
- Share non-identifiable technical metrics (RN version, JS
1748
- engine, device model). No user data or network payloads
1749
- are captured.
1750
- </Text>
1751
- </View>
1752
- </View>
1753
-
1754
- <TouchableScale
1755
- accessible={true}
1756
- accessibilityRole="switch"
1757
- accessibilityLabel="Toggle Anonymous Telemetry"
1758
- accessibilityState={{checked: telemetryConsent}}
1759
- onPress={handleToggleTelemetry}
1760
- style={{
1761
- width: 42,
1762
- height: 24,
1763
- borderRadius: 12,
1764
- backgroundColor: telemetryConsent
1765
- ? AppColors.purple
1766
- : AppColors.grayBorderSecondary,
1767
- padding: 2,
1768
- justifyContent: 'center',
1769
- alignItems: telemetryConsent ? 'flex-end' : 'flex-start',
1770
- }}>
1771
- <View
1772
- style={{
1773
- width: 20,
1774
- height: 20,
1775
- borderRadius: 10,
1776
- backgroundColor: AppColors.white,
1777
- shadowColor: AppColors.black,
1778
- shadowOpacity: 0.18,
1779
- shadowRadius: 2,
1780
- shadowOffset: {width: 0, height: 1},
1781
- }}
1782
- />
1783
- </TouchableScale>
1784
- </View>
1785
- </View>
1786
-
1787
- {/* Section 5: Notifications & Toasts */}
1661
+ {/* Section 4: Notifications & Toasts */}
1788
1662
  <View
1789
1663
  style={{
1790
1664
  backgroundColor: AppColors.primaryLight,
@@ -1888,7 +1762,7 @@ const SettingsPanel = () => {
1888
1762
  </View>
1889
1763
  </View>
1890
1764
 
1891
- {/* Section 6: NPM Package & Updates */}
1765
+ {/* Section 5: NPM Package & Updates */}
1892
1766
  <View
1893
1767
  style={{
1894
1768
  backgroundColor: AppColors.primaryLight,
@@ -1,3 +1,3 @@
1
1
  // AUTO-GENERATED FILE — do not edit by hand.
2
2
  // Regenerated from package.json on every build by scripts/gen-version.js.
3
- export const LIB_VERSION = '2.2.4';
3
+ export const LIB_VERSION = '2.2.6';
@@ -23,7 +23,6 @@ import {
23
23
  StackFrameType,
24
24
  } from '../types';
25
25
  export * from './searchQueryParser';
26
- export * from './telemetry';
27
26
  export * from './memoryManager';
28
27
 
29
28
  export const getDomainColor = (domain: string): string => {
package/src/index.tsx CHANGED
@@ -30,13 +30,6 @@ import {
30
30
  getDomainColor,
31
31
  getEventCategory,
32
32
  matchNetworkLogQuery,
33
- sendSessionTelemetryPing,
34
- trackTelemetryEvent,
35
- trackInspectorOpen,
36
- trackTabSwitch,
37
- trackLogExport,
38
- GA4_MEASUREMENT_ID,
39
- GA4_API_SECRET,
40
33
  setupMemoryWarningHandler,
41
34
  pruneAllLogs,
42
35
  subscribeMemoryWarning,
@@ -920,14 +913,7 @@ const NetworkInspector = ({
920
913
  const useNativeFab =
921
914
  (Platform.OS === 'ios' || Platform.OS === 'android') && isNativeModule;
922
915
 
923
- // Send anonymous initialization heartbeat to GA4 Measurement Protocol
924
- useEffect(() => {
925
- sendSessionTelemetryPing({
926
- environment,
927
- hasNavigation: Boolean(navigationRef),
928
- hasAppIcon: Boolean(appIcon),
929
- });
930
- }, [environment, navigationRef, appIcon]);
916
+
931
917
 
932
918
  // 100% Native Main-Thread Floating Button Lifecycle
933
919
  useEffect(() => {
@@ -989,8 +975,7 @@ const NetworkInspector = ({
989
975
  : 'apis';
990
976
  setActiveTab(target);
991
977
 
992
- // Track inspector opened event in GA4
993
- trackInspectorOpen({activeTab: target});
978
+
994
979
 
995
980
  // Instant synchronization of data collected while modal was closed
996
981
  if (latestNetworkLogsRef.current.length > 0) {
@@ -2263,13 +2248,6 @@ export {
2263
2248
  } from './native/NativeInspector';
2264
2249
 
2265
2250
  export {
2266
- sendSessionTelemetryPing,
2267
- trackTelemetryEvent,
2268
- trackInspectorOpen,
2269
- trackTabSwitch,
2270
- trackLogExport,
2271
- GA4_MEASUREMENT_ID,
2272
- GA4_API_SECRET,
2273
2251
  setupMemoryWarningHandler,
2274
2252
  pruneAllLogs,
2275
2253
  subscribeMemoryWarning,
@@ -1,4 +1,9 @@
1
- import {NativeModules, NativeEventEmitter, Platform} from 'react-native';
1
+ import {
2
+ NativeModules,
3
+ NativeEventEmitter,
4
+ DeviceEventEmitter,
5
+ Platform,
6
+ } from 'react-native';
2
7
  import NativeNetworkInspector from './NativeNetworkInspector';
3
8
 
4
9
  export interface NativeDeviceMetrics {
@@ -44,12 +49,16 @@ export const isNativeModuleAvailable = (): boolean => {
44
49
  return !!NativeModule;
45
50
  };
46
51
 
47
- const eventTarget: any =
48
- NativeModules.NetworkInspectorModule || NativeNetworkInspector;
52
+ const getNativeEmitter = () => {
53
+ try {
54
+ if (NativeModules && NativeModules.NetworkInspectorModule) {
55
+ return new NativeEventEmitter(NativeModules.NetworkInspectorModule);
56
+ }
57
+ } catch (e) {}
58
+ return null;
59
+ };
49
60
 
50
- const nativeEmitter = eventTarget
51
- ? new NativeEventEmitter(eventTarget)
52
- : null;
61
+ const nativeEmitter = getNativeEmitter();
53
62
 
54
63
  /**
55
64
  * Retrieves low-level native hardware and system metrics (RAM, Heap, Disk, Battery, CPU).
@@ -93,17 +102,27 @@ export const enableNativeCrashProtection = async (options?: {
93
102
  export const subscribeNativeCrashes = (
94
103
  callback: (event: NativeCrashEvent) => void,
95
104
  ): (() => void) => {
96
- if (!nativeEmitter) {
97
- return () => {};
98
- }
105
+ const cleanups: Array<() => void> = [];
106
+
99
107
  try {
100
- const subscription = nativeEmitter.addListener('onNativeCrash', callback);
101
- return () => {
102
- subscription.remove();
103
- };
104
- } catch (e) {
105
- return () => {};
108
+ const sub1 = DeviceEventEmitter.addListener('onNativeCrash', callback);
109
+ cleanups.push(() => sub1.remove());
110
+ } catch (e) {}
111
+
112
+ if (nativeEmitter) {
113
+ try {
114
+ const sub2 = nativeEmitter.addListener('onNativeCrash', callback);
115
+ cleanups.push(() => sub2.remove());
116
+ } catch (e) {}
106
117
  }
118
+
119
+ return () => {
120
+ cleanups.forEach(fn => {
121
+ try {
122
+ fn();
123
+ } catch (e) {}
124
+ });
125
+ };
107
126
  };
108
127
 
109
128
  export interface FloatingButtonOptions {
@@ -168,20 +187,33 @@ export const setNativeFloatingButtonBadge = async (
168
187
  export const subscribeNativeFloatingButtonPress = (
169
188
  callback: () => void,
170
189
  ): (() => void) => {
171
- if (!nativeEmitter) {
172
- return () => {};
173
- }
190
+ const cleanups: Array<() => void> = [];
191
+
174
192
  try {
175
- const subscription = nativeEmitter.addListener(
193
+ const sub1 = DeviceEventEmitter.addListener(
176
194
  'onFloatingButtonPress',
177
195
  callback,
178
196
  );
179
- return () => {
180
- subscription.remove();
181
- };
182
- } catch (e) {
183
- return () => {};
197
+ cleanups.push(() => sub1.remove());
198
+ } catch (e) {}
199
+
200
+ if (nativeEmitter) {
201
+ try {
202
+ const sub2 = nativeEmitter.addListener(
203
+ 'onFloatingButtonPress',
204
+ callback,
205
+ );
206
+ cleanups.push(() => sub2.remove());
207
+ } catch (e) {}
184
208
  }
209
+
210
+ return () => {
211
+ cleanups.forEach(fn => {
212
+ try {
213
+ fn();
214
+ } catch (e) {}
215
+ });
216
+ };
185
217
  };
186
218
 
187
219
  /**
@@ -1,3 +0,0 @@
1
- import React from 'react';
2
- export declare const TelemetryConsentModal: () => React.JSX.Element;
3
- export default TelemetryConsentModal;