react-native-inapp-inspector 1.1.35 → 2.0.1

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 (104) hide show
  1. package/README.md +123 -101
  2. package/android/build.gradle +13 -1
  3. package/android/src/main/java/com/inappinspector/NetworkInspectorModule.kt +890 -0
  4. package/android/src/main/java/com/inappinspector/NetworkInspectorPackage.kt +17 -0
  5. package/dist/commonjs/components/ConsoleLogCard.js +5 -5
  6. package/dist/commonjs/components/CopyButton.js +3 -0
  7. package/dist/commonjs/components/EndOfListFooter.js +1 -1
  8. package/dist/commonjs/components/ErrorBoundary.js +3 -0
  9. package/dist/commonjs/components/Inspector/AnalyticsTab.js +25 -73
  10. package/dist/commonjs/components/Inspector/BundleTab.js +671 -189
  11. package/dist/commonjs/components/Inspector/ConsoleTab.js +110 -99
  12. package/dist/commonjs/components/Inspector/CrashTab.js +99 -91
  13. package/dist/commonjs/components/Inspector/InspectorHeader.js +107 -20
  14. package/dist/commonjs/components/Inspector/MainScreen.js +111 -68
  15. package/dist/commonjs/components/Inspector/NetworkTab.js +151 -30
  16. package/dist/commonjs/components/Inspector/PerformanceTab.js +96 -3
  17. package/dist/commonjs/components/Inspector/ReduxTab.js +18 -10
  18. package/dist/commonjs/components/Inspector/SettingsPanel.js +1218 -1238
  19. package/dist/commonjs/components/Inspector/TabBar.js +4 -2
  20. package/dist/commonjs/components/JsonViewer.js +9 -4
  21. package/dist/commonjs/components/LogCard.js +31 -1
  22. package/dist/commonjs/components/LogSyntaxHighlighter.d.ts +16 -0
  23. package/dist/commonjs/components/LogSyntaxHighlighter.js +130 -0
  24. package/dist/commonjs/components/NetworkIcons.d.ts +3 -0
  25. package/dist/commonjs/components/NetworkIcons.js +15 -1
  26. package/dist/commonjs/components/Slider.d.ts +13 -0
  27. package/dist/commonjs/components/Slider.js +261 -0
  28. package/dist/commonjs/components/TouchableScale.d.ts +1 -0
  29. package/dist/commonjs/components/TouchableScale.js +30 -32
  30. package/dist/commonjs/constants/index.d.ts +1 -2
  31. package/dist/commonjs/constants/index.js +4 -0
  32. package/dist/commonjs/constants/version.d.ts +1 -1
  33. package/dist/commonjs/constants/version.js +1 -1
  34. package/dist/commonjs/customHooks/analyticsLogger.d.ts +4 -0
  35. package/dist/commonjs/customHooks/analyticsLogger.js +8 -6
  36. package/dist/commonjs/customHooks/crashHandler.js +8 -1
  37. package/dist/commonjs/helpers/index.d.ts +1 -0
  38. package/dist/commonjs/helpers/index.js +25 -1
  39. package/dist/commonjs/helpers/searchQueryParser.d.ts +6 -0
  40. package/dist/commonjs/helpers/searchQueryParser.js +236 -0
  41. package/dist/commonjs/helpers/settingsStore.d.ts +9 -0
  42. package/dist/commonjs/helpers/settingsStore.js +59 -3
  43. package/dist/commonjs/index.d.ts +1 -0
  44. package/dist/commonjs/index.js +220 -43
  45. package/dist/commonjs/native/NativeInspector.d.ts +125 -0
  46. package/dist/commonjs/native/NativeInspector.js +313 -0
  47. package/dist/commonjs/native/NativeNetworkInspector.d.ts +22 -0
  48. package/dist/commonjs/native/NativeNetworkInspector.js +4 -0
  49. package/dist/commonjs/styles/index.js +41 -41
  50. package/dist/commonjs/types/enums.d.ts +1 -1
  51. package/dist/commonjs/types/interfaces.d.ts +9 -0
  52. package/dist/esm/components/ConsoleLogCard.js +5 -5
  53. package/dist/esm/components/CopyButton.js +3 -0
  54. package/dist/esm/components/EndOfListFooter.js +2 -2
  55. package/dist/esm/components/ErrorBoundary.js +3 -0
  56. package/dist/esm/components/Inspector/AnalyticsTab.js +27 -75
  57. package/dist/esm/components/Inspector/BundleTab.js +671 -189
  58. package/dist/esm/components/Inspector/ConsoleTab.js +111 -100
  59. package/dist/esm/components/Inspector/CrashTab.js +99 -91
  60. package/dist/esm/components/Inspector/InspectorHeader.js +108 -21
  61. package/dist/esm/components/Inspector/MainScreen.js +113 -70
  62. package/dist/esm/components/Inspector/NetworkTab.js +152 -31
  63. package/dist/esm/components/Inspector/PerformanceTab.js +96 -3
  64. package/dist/esm/components/Inspector/ReduxTab.js +18 -10
  65. package/dist/esm/components/Inspector/SettingsPanel.js +1222 -1242
  66. package/dist/esm/components/Inspector/TabBar.js +4 -2
  67. package/dist/esm/components/JsonViewer.js +9 -4
  68. package/dist/esm/components/LogCard.js +32 -2
  69. package/dist/esm/components/LogSyntaxHighlighter.d.ts +16 -0
  70. package/dist/esm/components/LogSyntaxHighlighter.js +123 -0
  71. package/dist/esm/components/NetworkIcons.d.ts +3 -0
  72. package/dist/esm/components/NetworkIcons.js +11 -0
  73. package/dist/esm/components/Slider.d.ts +13 -0
  74. package/dist/esm/components/Slider.js +222 -0
  75. package/dist/esm/components/TouchableScale.d.ts +1 -0
  76. package/dist/esm/components/TouchableScale.js +31 -33
  77. package/dist/esm/constants/index.d.ts +1 -2
  78. package/dist/esm/constants/index.js +4 -0
  79. package/dist/esm/constants/version.d.ts +1 -1
  80. package/dist/esm/constants/version.js +1 -1
  81. package/dist/esm/customHooks/analyticsLogger.d.ts +4 -0
  82. package/dist/esm/customHooks/analyticsLogger.js +6 -5
  83. package/dist/esm/customHooks/crashHandler.js +8 -1
  84. package/dist/esm/helpers/index.d.ts +1 -0
  85. package/dist/esm/helpers/index.js +11 -1
  86. package/dist/esm/helpers/searchQueryParser.d.ts +6 -0
  87. package/dist/esm/helpers/searchQueryParser.js +233 -0
  88. package/dist/esm/helpers/settingsStore.d.ts +9 -0
  89. package/dist/esm/helpers/settingsStore.js +58 -3
  90. package/dist/esm/index.d.ts +1 -0
  91. package/dist/esm/index.js +207 -44
  92. package/dist/esm/native/NativeInspector.d.ts +125 -0
  93. package/dist/esm/native/NativeInspector.js +289 -0
  94. package/dist/esm/native/NativeNetworkInspector.d.ts +22 -0
  95. package/dist/esm/native/NativeNetworkInspector.js +2 -0
  96. package/dist/esm/styles/index.js +41 -41
  97. package/dist/esm/types/enums.d.ts +1 -1
  98. package/dist/esm/types/interfaces.d.ts +9 -0
  99. package/ios/NetworkInspectorModule.h +6 -0
  100. package/ios/NetworkInspectorModule.m +760 -5
  101. package/package.json +13 -2
  102. package/react-native-inapp-inspector.podspec +7 -2
  103. package/android/src/main/java/com/inappinspector/NetworkInspectorModule.java +0 -97
  104. package/android/src/main/java/com/inappinspector/NetworkInspectorPackage.java +0 -28
@@ -1,6 +1,5 @@
1
1
  import { Method } from '../types';
2
- import { StatusFilter } from '../types';
3
- export declare const STATUS_FILTERS: StatusFilter[];
2
+ export declare const STATUS_FILTERS: string[];
4
3
  export declare const METHOD_COLORS: Record<Method, string>;
5
4
  export declare const DOMAIN_COLORS: string[];
6
5
  export declare const DURATION_FAST_MS = 200;
@@ -6,9 +6,13 @@ const AppColors_1 = require("../styles/AppColors");
6
6
  exports.STATUS_FILTERS = [
7
7
  'ALL',
8
8
  '2xx',
9
+ '200',
9
10
  '3xx',
10
11
  '4xx',
12
+ '400',
13
+ '404',
11
14
  '5xx',
15
+ '500',
12
16
  'Failed',
13
17
  ];
14
18
  exports.METHOD_COLORS = {
@@ -1 +1 @@
1
- export declare const LIB_VERSION = "1.1.35";
1
+ export declare const LIB_VERSION = "2.0.1";
@@ -3,4 +3,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.LIB_VERSION = void 0;
4
4
  // AUTO-GENERATED FILE — do not edit by hand.
5
5
  // Regenerated from package.json on every build by scripts/gen-version.js.
6
- exports.LIB_VERSION = '1.1.35';
6
+ exports.LIB_VERSION = '2.0.1';
@@ -17,6 +17,10 @@ export declare const getCollectionEnabled: () => boolean;
17
17
  * Useful for custom analytics wrappers or testing.
18
18
  */
19
19
  export declare const logAnalyticsEvent: (name: string, params?: Record<string, any>, userProperties?: Record<string, any>) => void;
20
+ /**
21
+ * Returns true if analytics logging is active (always ready for custom and Firebase events).
22
+ */
20
23
  export declare const isAnalyticsConnected: () => boolean;
24
+ export declare const isFirebaseAnalyticsPatched: () => boolean;
21
25
  export declare const setupAnalyticsLogger: (analyticsInstance: any) => void;
22
26
  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.autoSetupAnalyticsLogger = exports.setupAnalyticsLogger = exports.isAnalyticsConnected = exports.logAnalyticsEvent = exports.getCollectionEnabled = exports.getDefaultEventParameters = exports.getCurrentUserId = exports.getCurrentUserProperties = exports.getAnalyticsEvents = exports.clearAnalyticsEvents = exports.subscribeAnalyticsEvents = exports.getAnalyticsModuleEnabled = exports.setAnalyticsModuleEnabled = void 0;
25
+ exports.autoSetupAnalyticsLogger = exports.setupAnalyticsLogger = exports.isFirebaseAnalyticsPatched = exports.isAnalyticsConnected = exports.logAnalyticsEvent = exports.getCollectionEnabled = exports.getDefaultEventParameters = exports.getCurrentUserId = exports.getCurrentUserProperties = exports.getAnalyticsEvents = exports.clearAnalyticsEvents = exports.subscribeAnalyticsEvents = exports.getAnalyticsModuleEnabled = exports.setAnalyticsModuleEnabled = void 0;
26
26
  // ─── Internal state ───────────────────────────────────────────────────────────
27
27
  let events = [];
28
28
  let listeners = [];
@@ -48,7 +48,7 @@ const addEvent = (event) => {
48
48
  if (!isAnalyticsModuleEnabled)
49
49
  return;
50
50
  events.unshift(event);
51
- events = events.slice(0, 200);
51
+ events = events.slice(0, 75);
52
52
  notify();
53
53
  };
54
54
  // ─── Public subscribe / query API ────────────────────────────────────────────
@@ -107,11 +107,13 @@ exports.logAnalyticsEvent = logAnalyticsEvent;
107
107
  * setupAnalyticsLogger(analytics());
108
108
  */
109
109
  let isAnalyticsPatched = false;
110
- const isAnalyticsConnected = () => isAnalyticsPatched ||
111
- events.length > 0 ||
112
- Object.keys(currentUserProperties).length > 0 ||
113
- currentUserId != null;
110
+ /**
111
+ * Returns true if analytics logging is active (always ready for custom and Firebase events).
112
+ */
113
+ const isAnalyticsConnected = () => true;
114
114
  exports.isAnalyticsConnected = isAnalyticsConnected;
115
+ const isFirebaseAnalyticsPatched = () => isAnalyticsPatched;
116
+ exports.isFirebaseAnalyticsPatched = isFirebaseAnalyticsPatched;
115
117
  const setupAnalyticsLogger = (analyticsInstance) => {
116
118
  if (!analyticsInstance) {
117
119
  console.warn('[AnalyticsLogger] No analytics instance provided — skipping setup.');
@@ -5,6 +5,7 @@ const react_native_1 = require("react-native");
5
5
  const enums_1 = require("../types/enums");
6
6
  Object.defineProperty(exports, "CrashExportFormat", { enumerable: true, get: function () { return enums_1.CrashExportFormat; } });
7
7
  const consoleLogger_1 = require("./consoleLogger");
8
+ const NativeInspector_1 = require("../native/NativeInspector");
8
9
  const i18n_1 = require("../i18n");
9
10
  let crashListeners = [];
10
11
  let isCrashHandlerInitialized = false;
@@ -12,7 +13,7 @@ let lastHandledErrorTimestamp = 0;
12
13
  let crashRecordsStore = [];
13
14
  let breadcrumbsStore = [];
14
15
  const MAX_BREADCRUMBS = 50;
15
- let maxStoredCrashes = 100;
16
+ let maxStoredCrashes = 50;
16
17
  const appStartTime = Date.now();
17
18
  let isCrashModuleEnabled = false;
18
19
  const setCrashModuleEnabled = (enabled) => {
@@ -384,6 +385,12 @@ const handleInterceptedCrash = (errorOrTitle, rawStack, isFatal = false, customT
384
385
  logId: log?.id,
385
386
  crashRecord,
386
387
  });
388
+ // Ensure native floating icon is visible & badged even if React UI is broken
389
+ try {
390
+ (0, NativeInspector_1.showNativeFloatingButton)();
391
+ (0, NativeInspector_1.setNativeFloatingButtonBadge)(true);
392
+ }
393
+ catch { }
387
394
  return crashRecord;
388
395
  }
389
396
  catch (err) {
@@ -1,4 +1,5 @@
1
1
  import { NetworkLog, RouteInfo, DiffResult, JsonContent, StackFrameType } from '../types';
2
+ export * from './searchQueryParser';
2
3
  export declare const getDomainColor: (domain: string) => string;
3
4
  export declare const formatDateTime: (timestamp: number) => string;
4
5
  export declare const formatTimestamp: (timestamp: number) => string;
@@ -1,4 +1,18 @@
1
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
2
16
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
17
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
18
  };
@@ -11,6 +25,7 @@ const toast_1 = require("./toast");
11
25
  const AppColors_1 = require("../styles/AppColors");
12
26
  // Constants
13
27
  const constants_1 = require("../constants");
28
+ __exportStar(require("./searchQueryParser"), exports);
14
29
  const getDomainColor = (domain) => {
15
30
  if (!domain)
16
31
  return constants_1.DOMAIN_COLORS[0];
@@ -173,9 +188,18 @@ exports.getFetchCommand = getFetchCommand;
173
188
  const deduplicateLogs = (raw) => {
174
189
  const map = new Map();
175
190
  raw.forEach(entry => {
176
- if (!map.has(entry.id) || entry.status != null) {
191
+ if (!map.has(entry.id)) {
177
192
  map.set(entry.id, entry);
178
193
  }
194
+ else {
195
+ const existing = map.get(entry.id);
196
+ if (existing.status == null && entry.status != null) {
197
+ map.set(entry.id, entry);
198
+ }
199
+ else if ((entry.startTime ?? 0) >= (existing.startTime ?? 0)) {
200
+ map.set(entry.id, entry);
201
+ }
202
+ }
179
203
  });
180
204
  return Array.from(map.values()).sort((a, b) => b.id - a.id);
181
205
  };
@@ -0,0 +1,6 @@
1
+ import { NetworkLog } from '../types';
2
+ /**
3
+ * Parses query strings like `method:POST is:error slow:>1s status:200 auth`
4
+ * and checks whether a given NetworkLog matches all tokens.
5
+ */
6
+ export declare function matchNetworkLogQuery(log: NetworkLog, searchQuery: string, routePath?: string): boolean;
@@ -0,0 +1,236 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.matchNetworkLogQuery = matchNetworkLogQuery;
4
+ /**
5
+ * Parses query strings like `method:POST is:error slow:>1s status:200 auth`
6
+ * and checks whether a given NetworkLog matches all tokens.
7
+ */
8
+ function matchNetworkLogQuery(log, searchQuery, routePath) {
9
+ if (!searchQuery || searchQuery.trim().length === 0)
10
+ return true;
11
+ const rawTokens = searchQuery
12
+ .trim()
13
+ .match(/(?:[^\s"']+|"[^"]*"|'[^']*')+/g) || [];
14
+ if (rawTokens.length === 0)
15
+ return true;
16
+ const methodStr = (log.method || '').toLowerCase();
17
+ const urlStr = (log.url || '').toLowerCase();
18
+ const statusNum = typeof log.status === 'number' ? log.status : parseInt(String(log.status || 0), 10);
19
+ const statusStr = String(log.status ?? '');
20
+ const durationNum = log.duration || 0;
21
+ const clientStr = (log.client || '').toLowerCase();
22
+ const reqStr = typeof log.request === 'string' ? log.request : JSON.stringify(log.request || '');
23
+ const resStr = typeof log.response === 'string' ? log.response : JSON.stringify(log.response || '');
24
+ const reqHeadersStr = JSON.stringify(log.requestHeaders || '').toLowerCase();
25
+ const resHeadersStr = JSON.stringify(log.responseHeaders || '').toLowerCase();
26
+ const pathStr = routePath ? routePath.toLowerCase() : '';
27
+ const fullSearchCorpus = [
28
+ methodStr,
29
+ urlStr,
30
+ statusStr,
31
+ pathStr,
32
+ clientStr,
33
+ reqStr.toLowerCase(),
34
+ resStr.toLowerCase(),
35
+ reqHeadersStr,
36
+ resHeadersStr,
37
+ ].join(' ');
38
+ for (const rawToken of rawTokens) {
39
+ const token = rawToken.replace(/^["']|["']$/g, '').trim();
40
+ if (!token)
41
+ continue;
42
+ const lowerToken = token.toLowerCase();
43
+ // 1. method:<VAL> or m:<VAL>
44
+ if (lowerToken.startsWith('method:') || lowerToken.startsWith('m:')) {
45
+ const targetMethod = lowerToken.replace(/^(method:|m:)/, '').trim();
46
+ if (targetMethod.startsWith('!')) {
47
+ if (methodStr === targetMethod.slice(1))
48
+ return false;
49
+ }
50
+ else {
51
+ if (methodStr !== targetMethod)
52
+ return false;
53
+ }
54
+ continue;
55
+ }
56
+ // 2. status:<VAL> or s:<VAL>
57
+ if (lowerToken.startsWith('status:') || lowerToken.startsWith('s:')) {
58
+ const val = lowerToken.replace(/^(status:|s:)/, '').trim();
59
+ if (val.startsWith('>=')) {
60
+ const threshold = parseInt(val.slice(2), 10);
61
+ if (isNaN(threshold) || statusNum < threshold)
62
+ return false;
63
+ }
64
+ else if (val.startsWith('>')) {
65
+ const threshold = parseInt(val.slice(1), 10);
66
+ if (isNaN(threshold) || statusNum <= threshold)
67
+ return false;
68
+ }
69
+ else if (val.startsWith('<=')) {
70
+ const threshold = parseInt(val.slice(2), 10);
71
+ if (isNaN(threshold) || statusNum > threshold)
72
+ return false;
73
+ }
74
+ else if (val.startsWith('<')) {
75
+ const threshold = parseInt(val.slice(1), 10);
76
+ if (isNaN(threshold) || statusNum >= threshold)
77
+ return false;
78
+ }
79
+ else if (val.endsWith('xx') || val.endsWith('x')) {
80
+ const prefix = val.replace(/x/g, '');
81
+ if (!statusStr.startsWith(prefix))
82
+ return false;
83
+ }
84
+ else {
85
+ const targetCode = parseInt(val, 10);
86
+ if (!isNaN(targetCode)) {
87
+ if (statusNum !== targetCode)
88
+ return false;
89
+ }
90
+ else if (!statusStr.includes(val)) {
91
+ return false;
92
+ }
93
+ }
94
+ continue;
95
+ }
96
+ // 3. is:<FLAG>
97
+ if (lowerToken.startsWith('is:')) {
98
+ const flag = lowerToken.slice(3).trim();
99
+ if (flag === 'error' || flag === 'failed' || flag === 'err' || flag === 'fail') {
100
+ const isErr = log.status === 0 || log.status == null || statusNum >= 400;
101
+ if (!isErr)
102
+ return false;
103
+ }
104
+ else if (flag === 'success' || flag === 'ok' || flag === '2xx') {
105
+ const isSuccess = statusNum >= 200 && statusNum < 300;
106
+ if (!isSuccess)
107
+ return false;
108
+ }
109
+ else if (flag === 'slow') {
110
+ if (durationNum < 1000)
111
+ return false;
112
+ }
113
+ else if (flag === 'fast') {
114
+ if (durationNum >= 200)
115
+ return false;
116
+ }
117
+ else if (flag === 'graphql' || flag === 'gql') {
118
+ const isGql = urlStr.includes('graphql') ||
119
+ clientStr === 'graphql' ||
120
+ clientStr === 'apollo';
121
+ if (!isGql)
122
+ return false;
123
+ }
124
+ else if (flag === 'https') {
125
+ if (!urlStr.startsWith('https'))
126
+ return false;
127
+ }
128
+ else if (flag === 'http') {
129
+ if (urlStr.startsWith('https') || !urlStr.startsWith('http'))
130
+ return false;
131
+ }
132
+ else if (flag === 'json') {
133
+ const isJson = reqHeadersStr.includes('application/json') ||
134
+ resHeadersStr.includes('application/json') ||
135
+ urlStr.includes('.json');
136
+ if (!isJson)
137
+ return false;
138
+ }
139
+ continue;
140
+ }
141
+ // 4. slow:<DURATION> or dur:<DURATION> or duration:<DURATION>
142
+ if (lowerToken.startsWith('slow:') ||
143
+ lowerToken.startsWith('dur:') ||
144
+ lowerToken.startsWith('duration:')) {
145
+ const val = lowerToken.replace(/^(slow:|dur:|duration:)/, '').trim();
146
+ let thresholdMs = 0;
147
+ let isGreater = true;
148
+ let cleanVal = val;
149
+ if (val.startsWith('>=')) {
150
+ isGreater = true;
151
+ cleanVal = val.slice(2);
152
+ }
153
+ else if (val.startsWith('>')) {
154
+ isGreater = true;
155
+ cleanVal = val.slice(1);
156
+ }
157
+ else if (val.startsWith('<=')) {
158
+ isGreater = false;
159
+ cleanVal = val.slice(2);
160
+ }
161
+ else if (val.startsWith('<')) {
162
+ isGreater = false;
163
+ cleanVal = val.slice(1);
164
+ }
165
+ if (cleanVal.endsWith('s') && !cleanVal.endsWith('ms')) {
166
+ thresholdMs = parseFloat(cleanVal.slice(0, -1)) * 1000;
167
+ }
168
+ else if (cleanVal.endsWith('ms')) {
169
+ thresholdMs = parseFloat(cleanVal.slice(0, -2));
170
+ }
171
+ else {
172
+ thresholdMs = parseFloat(cleanVal);
173
+ }
174
+ if (!isNaN(thresholdMs)) {
175
+ if (isGreater) {
176
+ if (durationNum < thresholdMs)
177
+ return false;
178
+ }
179
+ else {
180
+ if (durationNum > thresholdMs)
181
+ return false;
182
+ }
183
+ }
184
+ continue;
185
+ }
186
+ // 5. client:<CLIENT> or c:<CLIENT>
187
+ if (lowerToken.startsWith('client:') || lowerToken.startsWith('c:')) {
188
+ const targetClient = lowerToken.replace(/^(client:|c:)/, '').trim();
189
+ if (!clientStr.includes(targetClient))
190
+ return false;
191
+ continue;
192
+ }
193
+ // 6. domain:<DOMAIN> or d:<DOMAIN>
194
+ if (lowerToken.startsWith('domain:') || lowerToken.startsWith('d:')) {
195
+ const targetDomain = lowerToken.replace(/^(domain:|d:)/, '').trim();
196
+ if (!urlStr.includes(targetDomain))
197
+ return false;
198
+ continue;
199
+ }
200
+ // 7. path:<PATH> or p:<PATH>
201
+ if (lowerToken.startsWith('path:') || lowerToken.startsWith('p:')) {
202
+ const targetPath = lowerToken.replace(/^(path:|p:)/, '').trim();
203
+ if (!urlStr.includes(targetPath) && !pathStr.includes(targetPath)) {
204
+ return false;
205
+ }
206
+ continue;
207
+ }
208
+ // 8. req:<TERM> or body:<TERM>
209
+ if (lowerToken.startsWith('req:') || lowerToken.startsWith('body:')) {
210
+ const target = lowerToken.replace(/^(req:|body:)/, '').trim();
211
+ if (!reqStr.toLowerCase().includes(target))
212
+ return false;
213
+ continue;
214
+ }
215
+ // 9. res:<TERM>
216
+ if (lowerToken.startsWith('res:')) {
217
+ const target = lowerToken.slice(4).trim();
218
+ if (!resStr.toLowerCase().includes(target))
219
+ return false;
220
+ continue;
221
+ }
222
+ // 10. header:<TERM> or h:<TERM>
223
+ if (lowerToken.startsWith('header:') || lowerToken.startsWith('h:')) {
224
+ const target = lowerToken.replace(/^(header:|h:)/, '').trim();
225
+ if (!reqHeadersStr.includes(target) && !resHeadersStr.includes(target)) {
226
+ return false;
227
+ }
228
+ continue;
229
+ }
230
+ // 11. Generic Plain Substring Match
231
+ if (!fullSearchCorpus.includes(lowerToken)) {
232
+ return false;
233
+ }
234
+ }
235
+ return true;
236
+ }
@@ -6,3 +6,12 @@ export declare function saveSettings(settings: PersistedSettings): void;
6
6
  export declare function clearPersistedSettings(): Promise<void>;
7
7
  export declare const isPersistentStorageAvailable: () => boolean;
8
8
  export declare function getCustomStorage(): InspectorStorage | null;
9
+ export interface RamLimitsProfile {
10
+ maxNetworkLogs: number;
11
+ maxConsoleLogs: number;
12
+ maxAnalyticsEvents: number;
13
+ maxCrashRecords: number;
14
+ profileName: 'High-End' | 'Standard' | 'Compact' | 'Ultra-Light';
15
+ freeRamMb: number;
16
+ }
17
+ export declare function calculateRamBasedLimits(freeRamMb: number): RamLimitsProfile;
@@ -10,7 +10,9 @@ exports.loadSettings = loadSettings;
10
10
  exports.saveSettings = saveSettings;
11
11
  exports.clearPersistedSettings = clearPersistedSettings;
12
12
  exports.getCustomStorage = getCustomStorage;
13
+ exports.calculateRamBasedLimits = calculateRamBasedLimits;
13
14
  const react_native_1 = require("react-native");
15
+ const NativeInspector_1 = require("../native/NativeInspector");
14
16
  // In-memory fallback (settings survive for the app session only).
15
17
  const memory = new Map();
16
18
  let customStorage = null;
@@ -27,6 +29,13 @@ async function loadSettings() {
27
29
  const parsed = JSON.parse(raw);
28
30
  return parsed && typeof parsed === 'object' ? parsed : {};
29
31
  }
32
+ if ((0, NativeInspector_1.isNativeModuleAvailable)()) {
33
+ const raw = await (0, NativeInspector_1.getNativeStorageItem)(SETTINGS_KEY);
34
+ if (raw) {
35
+ const parsed = JSON.parse(raw);
36
+ return parsed && typeof parsed === 'object' ? parsed : {};
37
+ }
38
+ }
30
39
  if (react_native_1.Platform.OS === 'ios') {
31
40
  const raw = react_native_1.Settings.get(SETTINGS_KEY);
32
41
  if (!raw)
@@ -37,7 +46,7 @@ async function loadSettings() {
37
46
  }
38
47
  return raw && typeof raw === 'object' ? raw : {};
39
48
  }
40
- // Android/fallback: memory
49
+ // In-memory fallback
41
50
  const raw = memory.get(SETTINGS_KEY);
42
51
  if (!raw)
43
52
  return {};
@@ -55,11 +64,13 @@ function saveSettings(settings) {
55
64
  customStorage.setItem(SETTINGS_KEY, raw);
56
65
  return;
57
66
  }
67
+ if ((0, NativeInspector_1.isNativeModuleAvailable)()) {
68
+ (0, NativeInspector_1.setNativeStorageItem)(SETTINGS_KEY, raw);
69
+ }
58
70
  if (react_native_1.Platform.OS === 'ios') {
59
71
  react_native_1.Settings.set({ [SETTINGS_KEY]: raw });
60
72
  return;
61
73
  }
62
- // Android/fallback: memory
63
74
  memory.set(SETTINGS_KEY, raw);
64
75
  }
65
76
  catch {
@@ -77,6 +88,9 @@ async function clearPersistedSettings() {
77
88
  }
78
89
  return;
79
90
  }
91
+ if ((0, NativeInspector_1.isNativeModuleAvailable)()) {
92
+ await (0, NativeInspector_1.setNativeStorageItem)(SETTINGS_KEY, null);
93
+ }
80
94
  if (react_native_1.Platform.OS === 'ios') {
81
95
  react_native_1.Settings.set({ [SETTINGS_KEY]: null });
82
96
  return;
@@ -88,9 +102,51 @@ async function clearPersistedSettings() {
88
102
  }
89
103
  }
90
104
  const isPersistentStorageAvailable = () => {
91
- return customStorage !== null || react_native_1.Platform.OS === 'ios';
105
+ return customStorage !== null || (0, NativeInspector_1.isNativeModuleAvailable)() || react_native_1.Platform.OS === 'ios';
92
106
  };
93
107
  exports.isPersistentStorageAvailable = isPersistentStorageAvailable;
94
108
  function getCustomStorage() {
95
109
  return customStorage;
96
110
  }
111
+ function calculateRamBasedLimits(freeRamMb) {
112
+ if (freeRamMb >= 3000) {
113
+ return {
114
+ maxNetworkLogs: 100,
115
+ maxConsoleLogs: 100,
116
+ maxAnalyticsEvents: 75,
117
+ maxCrashRecords: 50,
118
+ profileName: 'High-End',
119
+ freeRamMb,
120
+ };
121
+ }
122
+ else if (freeRamMb >= 1500) {
123
+ return {
124
+ maxNetworkLogs: 100,
125
+ maxConsoleLogs: 100,
126
+ maxAnalyticsEvents: 75,
127
+ maxCrashRecords: 50,
128
+ profileName: 'Standard',
129
+ freeRamMb,
130
+ };
131
+ }
132
+ else if (freeRamMb >= 600) {
133
+ return {
134
+ maxNetworkLogs: 100,
135
+ maxConsoleLogs: 100,
136
+ maxAnalyticsEvents: 50,
137
+ maxCrashRecords: 25,
138
+ profileName: 'Compact',
139
+ freeRamMb,
140
+ };
141
+ }
142
+ else {
143
+ return {
144
+ maxNetworkLogs: 50,
145
+ maxConsoleLogs: 50,
146
+ maxAnalyticsEvents: 25,
147
+ maxCrashRecords: 15,
148
+ profileName: 'Ultra-Light',
149
+ freeRamMb,
150
+ };
151
+ }
152
+ }
@@ -12,4 +12,5 @@ export { connectReduxStore, inspectorReduxMiddleware, getReduxState, subscribeRe
12
12
  export { getEventCategory, registerGAPlugin, type GAPlugin, } from './helpers/gaAnalyticsRegistry';
13
13
  export { usePerformanceTracker, useComponentProfiler, useNavigationProfiler, trackComponentRender, trackNavigationTransition, trackHeavyTask, measureAsync, getHermesMemoryStats, registerComponentProfile, subscribeRenderProfiles, getRenderProfiles, logPerformanceEvent, clearPerformanceEvents, subscribePerformanceEvents, getPerformanceEvents, getInitialRenderProfiles, getInitialPerformanceEvents, generateFixSnippet, } from './customHooks/performanceTracker';
14
14
  export { InspectLog, InspectTrackTime, InspectCatch, type InspectLogOptions, } from './decorators';
15
+ export { getNativeDeviceMetrics, enableNativeCrashProtection, subscribeNativeCrashes, showNativeFloatingButton, hideNativeFloatingButton, setNativeFloatingButtonBadge, subscribeNativeFloatingButtonPress, subscribeNativeDeviceShake, startNativeFpsMonitoring, stopNativeFpsMonitoring, getNativeFpsMetrics, getNativeStorageItem, setNativeStorageItem, isNativeModuleAvailable, type NativeDeviceMetrics, type NativeCrashEvent, type FloatingButtonOptions, type NativeFpsMetrics, } from './native/NativeInspector';
15
16
  export { ActiveTab, Method, StatusFilter, SortOrder, LocalFilter, ModalAnimationType, SettingsPage, SettingsSubTab, LogFilter, ConsoleLogType, AnalyticsEventSource, GAEventCategory, StackFrameType, DiffResultType, BundleSubTab, PerformanceSubTab, CrashType, CrashExportFormat, CrashDetailSubTab, CrashFilterType, BreadcrumbType, } from './types';