react-native-inapp-inspector 2.3.14 → 2.3.16

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 (125) hide show
  1. package/README.md +1 -0
  2. package/dist/commonjs/components/AnimatedEntrance.js +3 -3
  3. package/dist/commonjs/components/ConsoleLogCard.js +174 -100
  4. package/dist/commonjs/components/Inspector/AnalyticsTab.js +0 -22
  5. package/dist/commonjs/components/Inspector/ConsoleTab.js +25 -38
  6. package/dist/commonjs/components/Inspector/CrashTab.js +19 -28
  7. package/dist/commonjs/components/Inspector/DeviceInfoTab.js +198 -98
  8. package/dist/commonjs/components/Inspector/FeedbackModal.d.ts +7 -0
  9. package/dist/commonjs/components/Inspector/FeedbackModal.js +552 -0
  10. package/dist/commonjs/components/Inspector/InspectorHeader.js +58 -6
  11. package/dist/commonjs/components/Inspector/MainScreen.js +100 -58
  12. package/dist/commonjs/components/Inspector/NetworkTab.js +26 -371
  13. package/dist/commonjs/components/Inspector/NpmStarPrompt.d.ts +3 -0
  14. package/dist/commonjs/components/Inspector/NpmStarPrompt.js +494 -0
  15. package/dist/commonjs/components/Inspector/PerformanceTab.js +40 -7
  16. package/dist/commonjs/components/Inspector/ReduxTab.js +3 -23
  17. package/dist/commonjs/components/Inspector/SettingsPanel.js +1035 -173
  18. package/dist/commonjs/components/Inspector/StorageTab.js +23 -28
  19. package/dist/commonjs/components/Inspector/TabBar.js +50 -15
  20. package/dist/commonjs/components/JsonViewer.js +14 -2
  21. package/dist/commonjs/components/LogCard.js +428 -227
  22. package/dist/commonjs/components/NetworkIcons.d.ts +5 -0
  23. package/dist/commonjs/components/NetworkIcons.js +33 -2
  24. package/dist/commonjs/constants/version.d.ts +1 -1
  25. package/dist/commonjs/constants/version.js +1 -1
  26. package/dist/commonjs/customHooks/analyticsLogger.js +1 -1
  27. package/dist/commonjs/customHooks/consoleLogger.js +34 -2
  28. package/dist/commonjs/customHooks/crashHandler.js +1 -1
  29. package/dist/commonjs/customHooks/networkLogger.js +184 -26
  30. package/dist/commonjs/helpers/index.d.ts +1 -0
  31. package/dist/commonjs/helpers/index.js +1 -0
  32. package/dist/commonjs/helpers/remoteConfig.d.ts +4 -0
  33. package/dist/commonjs/helpers/remoteConfig.js +165 -0
  34. package/dist/commonjs/helpers/searchQueryParser.d.ts +1 -1
  35. package/dist/commonjs/helpers/searchQueryParser.js +39 -291
  36. package/dist/commonjs/helpers/telemetry.d.ts +5 -0
  37. package/dist/commonjs/helpers/telemetry.js +339 -8
  38. package/dist/commonjs/index.d.ts +1 -0
  39. package/dist/commonjs/index.js +173 -29
  40. package/dist/commonjs/styles/AppFonts.d.ts +2 -0
  41. package/dist/commonjs/styles/AppFonts.js +1 -0
  42. package/dist/commonjs/styles/index.d.ts +22 -0
  43. package/dist/commonjs/styles/index.js +19 -0
  44. package/dist/commonjs/types/enums.d.ts +1 -0
  45. package/dist/commonjs/types/enums.js +1 -0
  46. package/dist/commonjs/types/interfaces.d.ts +12 -0
  47. package/dist/esm/components/AnimatedEntrance.js +3 -3
  48. package/dist/esm/components/ConsoleLogCard.js +141 -100
  49. package/dist/esm/components/Inspector/AnalyticsTab.js +1 -23
  50. package/dist/esm/components/Inspector/ConsoleTab.js +26 -39
  51. package/dist/esm/components/Inspector/CrashTab.js +20 -29
  52. package/dist/esm/components/Inspector/DeviceInfoTab.js +198 -98
  53. package/dist/esm/components/Inspector/FeedbackModal.d.ts +7 -0
  54. package/dist/esm/components/Inspector/FeedbackModal.js +515 -0
  55. package/dist/esm/components/Inspector/InspectorHeader.js +60 -8
  56. package/dist/esm/components/Inspector/MainScreen.js +101 -59
  57. package/dist/esm/components/Inspector/NetworkTab.js +27 -372
  58. package/dist/esm/components/Inspector/NpmStarPrompt.d.ts +3 -0
  59. package/dist/esm/components/Inspector/NpmStarPrompt.js +454 -0
  60. package/dist/esm/components/Inspector/PerformanceTab.js +40 -7
  61. package/dist/esm/components/Inspector/ReduxTab.js +4 -24
  62. package/dist/esm/components/Inspector/SettingsPanel.js +1038 -176
  63. package/dist/esm/components/Inspector/StorageTab.js +23 -28
  64. package/dist/esm/components/Inspector/TabBar.js +50 -15
  65. package/dist/esm/components/JsonViewer.js +14 -2
  66. package/dist/esm/components/LogCard.js +422 -221
  67. package/dist/esm/components/NetworkIcons.d.ts +5 -0
  68. package/dist/esm/components/NetworkIcons.js +26 -0
  69. package/dist/esm/constants/version.d.ts +1 -1
  70. package/dist/esm/constants/version.js +1 -1
  71. package/dist/esm/customHooks/analyticsLogger.js +1 -1
  72. package/dist/esm/customHooks/consoleLogger.js +34 -2
  73. package/dist/esm/customHooks/crashHandler.js +1 -1
  74. package/dist/esm/customHooks/networkLogger.js +184 -26
  75. package/dist/esm/helpers/index.d.ts +1 -0
  76. package/dist/esm/helpers/index.js +1 -0
  77. package/dist/esm/helpers/remoteConfig.d.ts +4 -0
  78. package/dist/esm/helpers/remoteConfig.js +160 -0
  79. package/dist/esm/helpers/searchQueryParser.d.ts +1 -1
  80. package/dist/esm/helpers/searchQueryParser.js +39 -291
  81. package/dist/esm/helpers/telemetry.d.ts +5 -0
  82. package/dist/esm/helpers/telemetry.js +332 -9
  83. package/dist/esm/index.d.ts +1 -0
  84. package/dist/esm/index.js +171 -29
  85. package/dist/esm/styles/AppFonts.d.ts +2 -0
  86. package/dist/esm/styles/AppFonts.js +1 -0
  87. package/dist/esm/styles/index.d.ts +22 -0
  88. package/dist/esm/styles/index.js +19 -0
  89. package/dist/esm/types/enums.d.ts +1 -0
  90. package/dist/esm/types/enums.js +1 -0
  91. package/dist/esm/types/interfaces.d.ts +12 -0
  92. package/package.json +1 -1
  93. package/src/components/AnimatedEntrance.tsx +3 -3
  94. package/src/components/ConsoleLogCard.tsx +154 -103
  95. package/src/components/Inspector/AnalyticsTab.tsx +0 -23
  96. package/src/components/Inspector/ConsoleTab.tsx +27 -41
  97. package/src/components/Inspector/CrashTab.tsx +19 -28
  98. package/src/components/Inspector/DeviceInfoTab.tsx +224 -102
  99. package/src/components/Inspector/FeedbackModal.tsx +626 -0
  100. package/src/components/Inspector/InspectorHeader.tsx +83 -5
  101. package/src/components/Inspector/MainScreen.tsx +61 -6
  102. package/src/components/Inspector/NetworkTab.tsx +70 -480
  103. package/src/components/Inspector/NpmStarPrompt.tsx +532 -0
  104. package/src/components/Inspector/PerformanceTab.tsx +44 -8
  105. package/src/components/Inspector/ReduxTab.tsx +9 -24
  106. package/src/components/Inspector/SettingsPanel.tsx +1162 -197
  107. package/src/components/Inspector/StorageTab.tsx +27 -30
  108. package/src/components/Inspector/TabBar.tsx +57 -20
  109. package/src/components/JsonViewer.tsx +15 -2
  110. package/src/components/LogCard.tsx +528 -339
  111. package/src/components/NetworkIcons.tsx +92 -0
  112. package/src/constants/version.ts +1 -1
  113. package/src/customHooks/analyticsLogger.ts +1 -1
  114. package/src/customHooks/consoleLogger.ts +36 -3
  115. package/src/customHooks/crashHandler.ts +1 -1
  116. package/src/customHooks/networkLogger.ts +214 -26
  117. package/src/helpers/index.ts +1 -0
  118. package/src/helpers/remoteConfig.ts +212 -0
  119. package/src/helpers/searchQueryParser.ts +42 -284
  120. package/src/helpers/telemetry.ts +381 -10
  121. package/src/index.tsx +374 -211
  122. package/src/styles/AppFonts.ts +2 -0
  123. package/src/styles/index.ts +20 -1
  124. package/src/types/enums.ts +1 -0
  125. package/src/types/interfaces.ts +12 -0
@@ -1,311 +1,59 @@
1
- export function matchNetworkLogQuery(log, searchQuery, routePath, options) {
1
+ import { markSearchFilterUsed } from './telemetry';
2
+ export function matchNetworkLogQuery(log, searchQuery, routePath, _options) {
2
3
  if (!searchQuery || searchQuery.trim().length === 0)
3
4
  return true;
4
- const rawTokens = searchQuery.trim().match(/(?:[^\s,"']+|"[^"]*"|'[^']*')+/g) || [];
5
+ markSearchFilterUsed();
6
+ const rawTokens = searchQuery.trim().toLowerCase().split(/\s+/).filter(Boolean);
5
7
  if (rawTokens.length === 0)
6
8
  return true;
7
- const isCaseSensitive = Boolean(options?.isCaseSensitive);
8
- const isRegex = Boolean(options?.isRegex);
9
- const scope = options?.scope || 'all';
10
- const methodRaw = log.method || '';
11
- const urlRaw = log.url || '';
9
+ const methodRaw = (log.method || '').toLowerCase();
10
+ const urlRaw = (log.url || '').toLowerCase();
11
+ const statusStr = log.status != null ? String(log.status).toLowerCase() : 'pending';
12
12
  const statusNum = typeof log.status === 'number'
13
13
  ? log.status
14
14
  : log.status != null
15
15
  ? parseInt(String(log.status), 10)
16
16
  : null;
17
- const statusStr = log.status != null ? String(log.status) : 'pending';
18
- const durationNum = log.duration || 0;
19
- const clientRaw = log.client || '';
20
- const callerRaw = log.caller || '';
17
+ const clientRaw = (log.client || '').toLowerCase();
18
+ const callerRaw = (log.caller || '').toLowerCase();
19
+ const pathRaw = (routePath || log?.routeInfo?.path || '').toLowerCase();
21
20
  const reqRaw = typeof log.request === 'string'
22
- ? log.request
21
+ ? log.request.toLowerCase()
23
22
  : log.request != null
24
- ? JSON.stringify(log.request)
23
+ ? JSON.stringify(log.request).toLowerCase()
25
24
  : '';
26
25
  const resRaw = typeof log.response === 'string'
27
- ? log.response
26
+ ? log.response.toLowerCase()
28
27
  : log.response != null
29
- ? JSON.stringify(log.response)
28
+ ? JSON.stringify(log.response).toLowerCase()
30
29
  : '';
31
30
  const reqHeadersRaw = log.requestHeaders
32
- ? JSON.stringify(log.requestHeaders)
31
+ ? JSON.stringify(log.requestHeaders).toLowerCase()
33
32
  : '';
34
33
  const resHeadersRaw = log.responseHeaders
35
- ? JSON.stringify(log.responseHeaders)
34
+ ? JSON.stringify(log.responseHeaders).toLowerCase()
36
35
  : '';
37
- const pathRaw = routePath || log?.routeInfo?.path || '';
38
- const getScopedCorpus = (caseSens) => {
39
- let parts = [];
40
- if (scope === 'url') {
41
- parts = [methodRaw, urlRaw, pathRaw, callerRaw];
42
- }
43
- else if (scope === 'reqBody') {
44
- parts = [reqRaw];
45
- }
46
- else if (scope === 'resBody') {
47
- parts = [resRaw];
48
- }
49
- else if (scope === 'headers') {
50
- parts = [reqHeadersRaw, resHeadersRaw];
51
- }
52
- else {
53
- parts = [
54
- methodRaw,
55
- urlRaw,
56
- statusStr,
57
- pathRaw,
58
- callerRaw,
59
- clientRaw,
60
- reqRaw,
61
- resRaw,
62
- reqHeadersRaw,
63
- resHeadersRaw,
64
- ];
65
- }
66
- const combined = parts.join(' ');
67
- return caseSens ? combined : combined.toLowerCase();
68
- };
69
- const targetCorpus = getScopedCorpus(isCaseSensitive);
70
- const methodStr = methodRaw.toLowerCase();
71
- const urlStr = urlRaw.toLowerCase();
72
- const clientStr = clientRaw.toLowerCase();
73
- const callerStr = callerRaw.toLowerCase();
74
- const reqStr = reqRaw.toLowerCase();
75
- const resStr = resRaw.toLowerCase();
76
- const reqHeadersStr = reqHeadersRaw.toLowerCase();
77
- const resHeadersStr = resHeadersRaw.toLowerCase();
78
- const pathStr = pathRaw.toLowerCase();
79
- for (const rawToken of rawTokens) {
80
- const token = rawToken.replace(/^["']|["']$/g, '').trim();
81
- if (!token)
82
- continue;
83
- const lowerToken = token.toLowerCase();
84
- if (lowerToken.startsWith('method:') || lowerToken.startsWith('m:')) {
85
- const targetMethod = lowerToken.replace(/^(method:|m:)/, '').trim();
86
- if (targetMethod.startsWith('!')) {
87
- if (methodStr === targetMethod.slice(1))
88
- return false;
89
- }
90
- else {
91
- if (methodStr !== targetMethod)
92
- return false;
93
- }
94
- continue;
95
- }
96
- if (lowerToken.startsWith('status:') || lowerToken.startsWith('s:')) {
97
- const val = lowerToken.replace(/^(status:|s:)/, '').trim();
98
- if (val === 'pending' || val === 'loading') {
99
- if (log.status != null)
100
- return false;
101
- }
102
- else if (val.startsWith('>=')) {
103
- const threshold = parseInt(val.slice(2), 10);
104
- if (isNaN(threshold) || statusNum === null || statusNum < threshold)
105
- return false;
106
- }
107
- else if (val.startsWith('>')) {
108
- const threshold = parseInt(val.slice(1), 10);
109
- if (isNaN(threshold) || statusNum === null || statusNum <= threshold)
110
- return false;
111
- }
112
- else if (val.startsWith('<=')) {
113
- const threshold = parseInt(val.slice(2), 10);
114
- if (isNaN(threshold) || statusNum === null || statusNum > threshold)
115
- return false;
116
- }
117
- else if (val.startsWith('<')) {
118
- const threshold = parseInt(val.slice(1), 10);
119
- if (isNaN(threshold) || statusNum === null || statusNum >= threshold)
120
- return false;
121
- }
122
- else if (val.endsWith('xx') || val.endsWith('x')) {
123
- const prefix = val.replace(/x/g, '');
124
- if (!statusStr.startsWith(prefix))
125
- return false;
126
- }
127
- else {
128
- const targetCode = parseInt(val, 10);
129
- if (!isNaN(targetCode)) {
130
- if (statusNum !== targetCode)
131
- return false;
132
- }
133
- else if (!statusStr.includes(val)) {
134
- return false;
135
- }
136
- }
137
- continue;
138
- }
139
- if (lowerToken.startsWith('is:')) {
140
- const flag = lowerToken.slice(3).trim();
141
- if (flag === 'error' ||
142
- flag === 'failed' ||
143
- flag === 'err' ||
144
- flag === 'fail') {
145
- const isErr = log.status === 0 || (statusNum !== null && statusNum >= 400);
146
- if (!isErr)
147
- return false;
148
- }
149
- else if (flag === 'success' || flag === 'ok' || flag === '2xx') {
150
- const isSuccess = statusNum !== null && statusNum >= 200 && statusNum < 300;
151
- if (!isSuccess)
152
- return false;
153
- }
154
- else if (flag === 'pending' || flag === 'loading') {
155
- if (log.status != null)
156
- return false;
157
- }
158
- else if (flag === 'slow') {
159
- if (durationNum < 1000)
160
- return false;
161
- }
162
- else if (flag === 'fast') {
163
- if (durationNum >= 200)
164
- return false;
165
- }
166
- else if (flag === 'graphql' || flag === 'gql') {
167
- const isGql = urlStr.includes('graphql') ||
168
- clientStr === 'graphql' ||
169
- clientStr === 'apollo';
170
- if (!isGql)
171
- return false;
172
- }
173
- else if (flag === 'https') {
174
- if (!urlStr.startsWith('https'))
175
- return false;
176
- }
177
- else if (flag === 'http') {
178
- if (urlStr.startsWith('https') || !urlStr.startsWith('http'))
179
- return false;
180
- }
181
- else if (flag === 'json') {
182
- const isJson = reqHeadersStr.includes('application/json') ||
183
- resHeadersStr.includes('application/json') ||
184
- urlStr.includes('.json');
185
- if (!isJson)
186
- return false;
187
- }
188
- else if (flag === 'image') {
189
- const isImg = resHeadersStr.includes('image/') ||
190
- /\.(png|jpe?g|gif|webp|svg)/i.test(urlStr);
191
- if (!isImg)
192
- return false;
193
- }
194
- continue;
195
- }
196
- if (lowerToken.startsWith('slow:') ||
197
- lowerToken.startsWith('dur:') ||
198
- lowerToken.startsWith('duration:')) {
199
- const val = lowerToken.replace(/^(slow:|dur:|duration:)/, '').trim();
200
- let thresholdMs = 0;
201
- let isGreater = true;
202
- let cleanVal = val;
203
- if (val.startsWith('>=')) {
204
- isGreater = true;
205
- cleanVal = val.slice(2);
206
- }
207
- else if (val.startsWith('>')) {
208
- isGreater = true;
209
- cleanVal = val.slice(1);
210
- }
211
- else if (val.startsWith('<=')) {
212
- isGreater = false;
213
- cleanVal = val.slice(2);
214
- }
215
- else if (val.startsWith('<')) {
216
- isGreater = false;
217
- cleanVal = val.slice(1);
218
- }
219
- if (cleanVal.endsWith('s') && !cleanVal.endsWith('ms')) {
220
- thresholdMs = parseFloat(cleanVal.slice(0, -1)) * 1000;
221
- }
222
- else if (cleanVal.endsWith('ms')) {
223
- thresholdMs = parseFloat(cleanVal.slice(0, -2));
224
- }
225
- else {
226
- thresholdMs = parseFloat(cleanVal);
227
- }
228
- if (!isNaN(thresholdMs)) {
229
- if (isGreater) {
230
- if (durationNum < thresholdMs)
231
- return false;
232
- }
233
- else {
234
- if (durationNum > thresholdMs)
235
- return false;
236
- }
237
- }
238
- continue;
239
- }
240
- if (lowerToken.startsWith('client:') || lowerToken.startsWith('c:')) {
241
- const targetClient = lowerToken.replace(/^(client:|c:)/, '').trim();
242
- if (!clientStr.includes(targetClient))
243
- return false;
244
- continue;
245
- }
246
- if (lowerToken.startsWith('domain:') || lowerToken.startsWith('d:')) {
247
- const targetDomain = lowerToken.replace(/^(domain:|d:)/, '').trim();
248
- if (!urlStr.includes(targetDomain))
249
- return false;
250
- continue;
251
- }
252
- if (lowerToken.startsWith('path:') ||
253
- lowerToken.startsWith('p:') ||
254
- lowerToken.startsWith('page:')) {
255
- const targetPath = lowerToken
256
- .replace(/^(path:|p:|page:)/, '')
257
- .trim();
258
- if (!urlStr.includes(targetPath) &&
259
- !pathStr.includes(targetPath) &&
260
- !callerStr.includes(targetPath)) {
261
- return false;
262
- }
263
- continue;
264
- }
265
- if (lowerToken.startsWith('req:') || lowerToken.startsWith('body:')) {
266
- const target = lowerToken.replace(/^(req:|body:)/, '').trim();
267
- if (!reqStr.includes(target))
268
- return false;
269
- continue;
270
- }
271
- if (lowerToken.startsWith('res:')) {
272
- const target = lowerToken.slice(4).trim();
273
- if (!resStr.includes(target))
274
- return false;
275
- continue;
276
- }
277
- if (lowerToken.startsWith('header:') || lowerToken.startsWith('h:')) {
278
- const target = lowerToken.replace(/^(header:|h:)/, '').trim();
279
- if (!reqHeadersStr.includes(target) && !resHeadersStr.includes(target)) {
280
- return false;
281
- }
282
- continue;
283
- }
284
- if (isRegex) {
285
- try {
286
- const re = new RegExp(token, isCaseSensitive ? '' : 'i');
287
- if (!re.test(targetCorpus))
288
- return false;
289
- }
290
- catch {
291
- const queryTerm = isCaseSensitive ? token : lowerToken;
292
- if (!targetCorpus.includes(queryTerm))
293
- return false;
294
- }
295
- }
296
- else {
297
- const queryTerm = isCaseSensitive ? token : lowerToken;
298
- if (!targetCorpus.includes(queryTerm)) {
299
- if (queryTerm === 'error' ||
300
- queryTerm === 'failed' ||
301
- queryTerm === 'fail') {
302
- const isErr = log.status === 0 || (statusNum !== null && statusNum >= 400);
303
- if (isErr)
304
- continue;
305
- }
306
- return false;
307
- }
308
- }
309
- }
310
- return true;
36
+ const corpus = [
37
+ methodRaw,
38
+ urlRaw,
39
+ statusStr,
40
+ pathRaw,
41
+ callerRaw,
42
+ clientRaw,
43
+ reqRaw,
44
+ resRaw,
45
+ reqHeadersRaw,
46
+ resHeadersRaw,
47
+ ].join(' ');
48
+ return rawTokens.every(token => {
49
+ if (corpus.includes(token))
50
+ return true;
51
+ if (token === 'error' || token === 'failed' || token === 'err' || token === 'fail') {
52
+ return log.status === 0 || (statusNum !== null && statusNum >= 400);
53
+ }
54
+ if (token === 'success' || token === 'ok' || token === '2xx') {
55
+ return statusNum !== null && statusNum >= 200 && statusNum < 300;
56
+ }
57
+ return false;
58
+ });
311
59
  }
@@ -1,2 +1,7 @@
1
1
  export declare function setTelemetryEnabled(enabled: boolean): void;
2
+ export declare function markSearchFilterUsed(): void;
2
3
  export declare function trackActiveTelemetryHeartbeat(telemetryEnabled?: boolean, environment?: string): Promise<void>;
4
+ export declare function trackTelemetryEvent(eventName: string, eventParams?: Record<string, any>): Promise<void>;
5
+ export declare function trackInspectorTabView(tabName: string): void;
6
+ export declare function trackInspectorScreenView(screenName: string): void;
7
+ export declare function trackInspectorScreenRecord(action: 'start' | 'stop' | 'toggle', recordingType?: string): void;