react-native-inapp-inspector 2.3.15 → 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.
- package/README.md +1 -0
- package/dist/commonjs/components/Inspector/AnalyticsTab.js +0 -22
- package/dist/commonjs/components/Inspector/ConsoleTab.js +0 -22
- package/dist/commonjs/components/Inspector/CrashTab.js +0 -23
- package/dist/commonjs/components/Inspector/FeedbackModal.d.ts +7 -0
- package/dist/commonjs/components/Inspector/FeedbackModal.js +552 -0
- package/dist/commonjs/components/Inspector/InspectorHeader.js +56 -4
- package/dist/commonjs/components/Inspector/MainScreen.js +45 -3
- package/dist/commonjs/components/Inspector/NetworkTab.js +27 -38
- package/dist/commonjs/components/Inspector/NpmStarPrompt.d.ts +3 -0
- package/dist/commonjs/components/Inspector/NpmStarPrompt.js +494 -0
- package/dist/commonjs/components/Inspector/PerformanceTab.js +8 -1
- package/dist/commonjs/components/Inspector/ReduxTab.js +0 -22
- package/dist/commonjs/components/Inspector/SettingsPanel.js +1035 -173
- package/dist/commonjs/components/Inspector/StorageTab.js +0 -23
- package/dist/commonjs/components/Inspector/TabBar.js +50 -15
- package/dist/commonjs/components/NetworkIcons.d.ts +5 -0
- package/dist/commonjs/components/NetworkIcons.js +33 -2
- package/dist/commonjs/constants/version.d.ts +1 -1
- package/dist/commonjs/constants/version.js +1 -1
- package/dist/commonjs/helpers/index.d.ts +1 -0
- package/dist/commonjs/helpers/index.js +1 -0
- package/dist/commonjs/helpers/remoteConfig.d.ts +4 -0
- package/dist/commonjs/helpers/remoteConfig.js +165 -0
- package/dist/commonjs/helpers/searchQueryParser.js +2 -0
- package/dist/commonjs/helpers/telemetry.d.ts +5 -0
- package/dist/commonjs/helpers/telemetry.js +339 -8
- package/dist/commonjs/index.d.ts +1 -0
- package/dist/commonjs/index.js +32 -2
- package/dist/commonjs/styles/AppFonts.d.ts +2 -0
- package/dist/commonjs/styles/AppFonts.js +1 -0
- package/dist/commonjs/styles/index.d.ts +22 -0
- package/dist/commonjs/styles/index.js +19 -0
- package/dist/commonjs/types/enums.d.ts +1 -0
- package/dist/commonjs/types/enums.js +1 -0
- package/dist/commonjs/types/interfaces.d.ts +12 -0
- package/dist/esm/components/Inspector/AnalyticsTab.js +1 -23
- package/dist/esm/components/Inspector/ConsoleTab.js +1 -23
- package/dist/esm/components/Inspector/CrashTab.js +1 -24
- package/dist/esm/components/Inspector/FeedbackModal.d.ts +7 -0
- package/dist/esm/components/Inspector/FeedbackModal.js +515 -0
- package/dist/esm/components/Inspector/InspectorHeader.js +57 -5
- package/dist/esm/components/Inspector/MainScreen.js +46 -4
- package/dist/esm/components/Inspector/NetworkTab.js +28 -39
- package/dist/esm/components/Inspector/NpmStarPrompt.d.ts +3 -0
- package/dist/esm/components/Inspector/NpmStarPrompt.js +454 -0
- package/dist/esm/components/Inspector/PerformanceTab.js +8 -1
- package/dist/esm/components/Inspector/ReduxTab.js +1 -23
- package/dist/esm/components/Inspector/SettingsPanel.js +1038 -176
- package/dist/esm/components/Inspector/StorageTab.js +0 -23
- package/dist/esm/components/Inspector/TabBar.js +50 -15
- package/dist/esm/components/NetworkIcons.d.ts +5 -0
- package/dist/esm/components/NetworkIcons.js +26 -0
- package/dist/esm/constants/version.d.ts +1 -1
- package/dist/esm/constants/version.js +1 -1
- package/dist/esm/helpers/index.d.ts +1 -0
- package/dist/esm/helpers/index.js +1 -0
- package/dist/esm/helpers/remoteConfig.d.ts +4 -0
- package/dist/esm/helpers/remoteConfig.js +160 -0
- package/dist/esm/helpers/searchQueryParser.js +2 -0
- package/dist/esm/helpers/telemetry.d.ts +5 -0
- package/dist/esm/helpers/telemetry.js +332 -9
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js +30 -2
- package/dist/esm/styles/AppFonts.d.ts +2 -0
- package/dist/esm/styles/AppFonts.js +1 -0
- package/dist/esm/styles/index.d.ts +22 -0
- package/dist/esm/styles/index.js +19 -0
- package/dist/esm/types/enums.d.ts +1 -0
- package/dist/esm/types/enums.js +1 -0
- package/dist/esm/types/interfaces.d.ts +12 -0
- package/package.json +1 -1
- package/src/components/Inspector/AnalyticsTab.tsx +0 -23
- package/src/components/Inspector/ConsoleTab.tsx +0 -23
- package/src/components/Inspector/CrashTab.tsx +0 -23
- package/src/components/Inspector/FeedbackModal.tsx +626 -0
- package/src/components/Inspector/InspectorHeader.tsx +78 -2
- package/src/components/Inspector/MainScreen.tsx +59 -3
- package/src/components/Inspector/NetworkTab.tsx +69 -78
- package/src/components/Inspector/NpmStarPrompt.tsx +532 -0
- package/src/components/Inspector/PerformanceTab.tsx +8 -1
- package/src/components/Inspector/ReduxTab.tsx +0 -23
- package/src/components/Inspector/SettingsPanel.tsx +1162 -197
- package/src/components/Inspector/StorageTab.tsx +0 -23
- package/src/components/Inspector/TabBar.tsx +57 -20
- package/src/components/NetworkIcons.tsx +92 -0
- package/src/constants/version.ts +1 -1
- package/src/helpers/index.ts +1 -0
- package/src/helpers/remoteConfig.ts +212 -0
- package/src/helpers/searchQueryParser.ts +3 -0
- package/src/helpers/telemetry.ts +381 -10
- package/src/index.tsx +42 -0
- package/src/styles/AppFonts.ts +2 -0
- package/src/styles/index.ts +20 -1
- package/src/types/enums.ts +1 -0
- package/src/types/interfaces.ts +12 -0
|
@@ -616,29 +616,6 @@ export const StorageTab = React.memo(() => {
|
|
|
616
616
|
}
|
|
617
617
|
ListFooterComponent={<View style={{height: 60}} />}
|
|
618
618
|
/>
|
|
619
|
-
|
|
620
|
-
<TouchableScale
|
|
621
|
-
onPress={() => {
|
|
622
|
-
try {
|
|
623
|
-
listRef.current?.scrollToOffset({
|
|
624
|
-
offset: 0,
|
|
625
|
-
animated: true,
|
|
626
|
-
});
|
|
627
|
-
} catch {
|
|
628
|
-
try {
|
|
629
|
-
listRef.current?.scrollToIndex({
|
|
630
|
-
index: 0,
|
|
631
|
-
animated: true,
|
|
632
|
-
});
|
|
633
|
-
} catch {}
|
|
634
|
-
}
|
|
635
|
-
}}
|
|
636
|
-
hitSlop={12}
|
|
637
|
-
style={globalStyles.scrollTopBtn}>
|
|
638
|
-
<View style={{transform: [{rotate: '180deg'}]}}>
|
|
639
|
-
<ChevronIcon color={AppColors.white} size={18} />
|
|
640
|
-
</View>
|
|
641
|
-
</TouchableScale>
|
|
642
619
|
</>
|
|
643
620
|
)}
|
|
644
621
|
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
import {useInspector} from './InspectorContext';
|
|
11
11
|
import styles from '../../styles';
|
|
12
12
|
import {AppColors} from '../../styles/AppColors';
|
|
13
|
+
import {AppFonts} from '../../styles/AppFonts';
|
|
13
14
|
import TouchableScale from '../TouchableScale';
|
|
14
15
|
import {
|
|
15
16
|
SignalIcon,
|
|
@@ -56,60 +57,70 @@ const TabBar = React.memo(() => {
|
|
|
56
57
|
{(
|
|
57
58
|
[
|
|
58
59
|
{
|
|
60
|
+
id: 1,
|
|
59
61
|
key: 'apis',
|
|
60
62
|
label: 'APIs',
|
|
61
63
|
count: logs.length,
|
|
62
64
|
icon: 'apis',
|
|
63
65
|
},
|
|
64
66
|
{
|
|
67
|
+
id: 2,
|
|
65
68
|
key: 'logs',
|
|
66
69
|
label: 'Logs',
|
|
67
70
|
count: consoleLogs.length,
|
|
68
71
|
icon: 'logs',
|
|
69
72
|
},
|
|
70
73
|
{
|
|
74
|
+
id: 3,
|
|
71
75
|
key: 'analytics',
|
|
72
76
|
label: 'Analytics',
|
|
73
77
|
count: analyticsEvents.length,
|
|
74
78
|
icon: 'analytics',
|
|
75
79
|
},
|
|
76
80
|
{
|
|
81
|
+
id: 4,
|
|
77
82
|
key: 'redux',
|
|
78
83
|
label: 'Redux',
|
|
79
84
|
count: 0,
|
|
80
85
|
icon: 'redux',
|
|
81
86
|
},
|
|
82
87
|
{
|
|
83
|
-
|
|
84
|
-
|
|
88
|
+
id: 5,
|
|
89
|
+
key: 'storage',
|
|
90
|
+
label: 'Storage',
|
|
85
91
|
count: 0,
|
|
86
|
-
icon: '
|
|
92
|
+
icon: 'storage',
|
|
87
93
|
},
|
|
88
94
|
{
|
|
89
|
-
|
|
90
|
-
|
|
95
|
+
id: 6,
|
|
96
|
+
key: 'device',
|
|
97
|
+
label: 'Device',
|
|
91
98
|
count: 0,
|
|
92
|
-
icon: '
|
|
99
|
+
icon: 'device',
|
|
93
100
|
},
|
|
94
101
|
{
|
|
102
|
+
id: 7,
|
|
95
103
|
key: 'crash',
|
|
96
104
|
label: 'Crash',
|
|
97
105
|
count: crashRecords?.length || 0,
|
|
98
106
|
icon: 'crash',
|
|
99
107
|
},
|
|
100
108
|
{
|
|
101
|
-
|
|
102
|
-
|
|
109
|
+
id: 8,
|
|
110
|
+
key: 'bundle',
|
|
111
|
+
label: 'Bundle',
|
|
103
112
|
count: 0,
|
|
104
|
-
icon: '
|
|
113
|
+
icon: 'bundle',
|
|
105
114
|
},
|
|
106
115
|
{
|
|
107
|
-
|
|
108
|
-
|
|
116
|
+
id: 9,
|
|
117
|
+
key: 'performance',
|
|
118
|
+
label: 'Performance',
|
|
109
119
|
count: 0,
|
|
110
|
-
icon: '
|
|
120
|
+
icon: 'performance',
|
|
111
121
|
},
|
|
112
122
|
{
|
|
123
|
+
id: 10,
|
|
113
124
|
key: 'debugging',
|
|
114
125
|
label: 'Debugging',
|
|
115
126
|
count: 0,
|
|
@@ -176,24 +187,50 @@ const TabBar = React.memo(() => {
|
|
|
176
187
|
{tab.icon === 'redux' && (
|
|
177
188
|
<ReduxIcon color={iconColor} size={14} />
|
|
178
189
|
)}
|
|
179
|
-
{tab.icon === '
|
|
180
|
-
<
|
|
190
|
+
{tab.icon === 'storage' && (
|
|
191
|
+
<DatabaseIcon color={iconColor} size={14} />
|
|
181
192
|
)}
|
|
182
|
-
{tab.icon === '
|
|
183
|
-
<
|
|
193
|
+
{tab.icon === 'device' && (
|
|
194
|
+
<SmartphoneIcon color={iconColor} size={14} />
|
|
184
195
|
)}
|
|
185
196
|
{tab.icon === 'crash' && (
|
|
186
197
|
<CrashIcon color={iconColor} size={14} />
|
|
187
198
|
)}
|
|
188
|
-
{tab.icon === '
|
|
189
|
-
<
|
|
199
|
+
{tab.icon === 'bundle' && (
|
|
200
|
+
<PackageIcon color={iconColor} size={14} />
|
|
190
201
|
)}
|
|
191
|
-
{tab.icon === '
|
|
192
|
-
<
|
|
202
|
+
{tab.icon === 'performance' && (
|
|
203
|
+
<PerformanceIcon color={iconColor} size={14} />
|
|
193
204
|
)}
|
|
194
205
|
{tab.icon === 'debugging' && (
|
|
195
206
|
<QrCodeIcon color={iconColor} size={14} />
|
|
196
207
|
)}
|
|
208
|
+
<View
|
|
209
|
+
style={{
|
|
210
|
+
minWidth: 20,
|
|
211
|
+
height: 20,
|
|
212
|
+
paddingHorizontal: 4,
|
|
213
|
+
borderRadius: 10,
|
|
214
|
+
backgroundColor: isActive
|
|
215
|
+
? `${AppColors.white}33`
|
|
216
|
+
: `${AppColors.purple}1F`,
|
|
217
|
+
borderWidth: 1,
|
|
218
|
+
borderColor: isActive
|
|
219
|
+
? `${AppColors.white}66`
|
|
220
|
+
: `${AppColors.purple}40`,
|
|
221
|
+
alignItems: 'center',
|
|
222
|
+
justifyContent: 'center',
|
|
223
|
+
}}>
|
|
224
|
+
<Text
|
|
225
|
+
style={{
|
|
226
|
+
fontFamily: AppFonts.interBold,
|
|
227
|
+
fontSize: 9.5,
|
|
228
|
+
lineHeight: 12,
|
|
229
|
+
color: isActive ? AppColors.white : AppColors.purple,
|
|
230
|
+
}}>
|
|
231
|
+
#{tab.id}
|
|
232
|
+
</Text>
|
|
233
|
+
</View>
|
|
197
234
|
<Text
|
|
198
235
|
numberOfLines={1}
|
|
199
236
|
ellipsizeMode="tail"
|
|
@@ -1520,6 +1520,23 @@ export const PackageBoxIcon = ({
|
|
|
1520
1520
|
);
|
|
1521
1521
|
};
|
|
1522
1522
|
|
|
1523
|
+
export const StarIcon = ({
|
|
1524
|
+
color = '#F59E0B',
|
|
1525
|
+
size = 14,
|
|
1526
|
+
}: IconProps) => {
|
|
1527
|
+
return (
|
|
1528
|
+
<Svg width={size} height={size} viewBox="0 0 24 24" fill={color}>
|
|
1529
|
+
<Path
|
|
1530
|
+
d="M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z"
|
|
1531
|
+
stroke={color}
|
|
1532
|
+
strokeWidth="1.5"
|
|
1533
|
+
strokeLinecap="round"
|
|
1534
|
+
strokeLinejoin="round"
|
|
1535
|
+
/>
|
|
1536
|
+
</Svg>
|
|
1537
|
+
);
|
|
1538
|
+
};
|
|
1539
|
+
|
|
1523
1540
|
export const GitHubIcon = ({
|
|
1524
1541
|
color = AppColors.grayTextWeak,
|
|
1525
1542
|
size = 14,
|
|
@@ -2355,3 +2372,78 @@ export const TurtleIcon = ({
|
|
|
2355
2372
|
</Svg>
|
|
2356
2373
|
);
|
|
2357
2374
|
|
|
2375
|
+
export const HeadphonesIcon = ({
|
|
2376
|
+
color = AppColors.white,
|
|
2377
|
+
size = 20,
|
|
2378
|
+
}: IconProps) => (
|
|
2379
|
+
<Svg width={size} height={size} viewBox="0 0 24 24" fill="none">
|
|
2380
|
+
<Path
|
|
2381
|
+
d="M3 18v-6a9 9 0 0 1 18 0v6"
|
|
2382
|
+
stroke={color}
|
|
2383
|
+
strokeWidth="2"
|
|
2384
|
+
strokeLinecap="round"
|
|
2385
|
+
strokeLinejoin="round"
|
|
2386
|
+
/>
|
|
2387
|
+
<Path
|
|
2388
|
+
d="M21 19a2 2 0 0 1-2 2h-1a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h3v5zM3 19a2 2 0 0 0 2 2h1a2 2 0 0 0 2-2v-3a2 2 0 0 0-2-2H3v5z"
|
|
2389
|
+
stroke={color}
|
|
2390
|
+
strokeWidth="2"
|
|
2391
|
+
strokeLinecap="round"
|
|
2392
|
+
strokeLinejoin="round"
|
|
2393
|
+
/>
|
|
2394
|
+
</Svg>
|
|
2395
|
+
);
|
|
2396
|
+
|
|
2397
|
+
export const HelpCircleIcon = ({
|
|
2398
|
+
color = AppColors.white,
|
|
2399
|
+
size = 20,
|
|
2400
|
+
}: IconProps) => (
|
|
2401
|
+
<Svg width={size} height={size} viewBox="0 0 24 24" fill="none">
|
|
2402
|
+
<Circle cx="12" cy="12" r="10" stroke={color} strokeWidth="2" />
|
|
2403
|
+
<Path
|
|
2404
|
+
d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"
|
|
2405
|
+
stroke={color}
|
|
2406
|
+
strokeWidth="2"
|
|
2407
|
+
strokeLinecap="round"
|
|
2408
|
+
strokeLinejoin="round"
|
|
2409
|
+
/>
|
|
2410
|
+
<Line x1="12" y1="17" x2="12.01" y2="17" stroke={color} strokeWidth="2" strokeLinecap="round" />
|
|
2411
|
+
</Svg>
|
|
2412
|
+
);
|
|
2413
|
+
|
|
2414
|
+
export const SendIcon = ({
|
|
2415
|
+
color = AppColors.white,
|
|
2416
|
+
size = 18,
|
|
2417
|
+
}: IconProps) => (
|
|
2418
|
+
<Svg width={size} height={size} viewBox="0 0 24 24" fill="none">
|
|
2419
|
+
<Path
|
|
2420
|
+
d="M22 2L11 13"
|
|
2421
|
+
stroke={color}
|
|
2422
|
+
strokeWidth="2"
|
|
2423
|
+
strokeLinecap="round"
|
|
2424
|
+
strokeLinejoin="round"
|
|
2425
|
+
/>
|
|
2426
|
+
<Path
|
|
2427
|
+
d="M22 2L15 22L11 13L2 9L22 2Z"
|
|
2428
|
+
stroke={color}
|
|
2429
|
+
strokeWidth="2"
|
|
2430
|
+
strokeLinecap="round"
|
|
2431
|
+
strokeLinejoin="round"
|
|
2432
|
+
/>
|
|
2433
|
+
</Svg>
|
|
2434
|
+
);
|
|
2435
|
+
|
|
2436
|
+
export const LifeBuoyIcon = ({
|
|
2437
|
+
color = AppColors.white,
|
|
2438
|
+
size = 20,
|
|
2439
|
+
}: IconProps) => (
|
|
2440
|
+
<Svg width={size} height={size} viewBox="0 0 24 24" fill="none">
|
|
2441
|
+
<Circle cx="12" cy="12" r="10" stroke={color} strokeWidth="2" />
|
|
2442
|
+
<Circle cx="12" cy="12" r="4" stroke={color} strokeWidth="2" />
|
|
2443
|
+
<Line x1="4.93" y1="4.93" x2="9.17" y2="9.17" stroke={color} strokeWidth="2" strokeLinecap="round" />
|
|
2444
|
+
<Line x1="14.83" y1="9.17" x2="19.07" y2="4.93" stroke={color} strokeWidth="2" strokeLinecap="round" />
|
|
2445
|
+
<Line x1="14.83" y1="14.83" x2="19.07" y2="19.07" stroke={color} strokeWidth="2" strokeLinecap="round" />
|
|
2446
|
+
<Line x1="4.93" y1="19.07" x2="9.17" y2="14.83" stroke={color} strokeWidth="2" strokeLinecap="round" />
|
|
2447
|
+
</Svg>
|
|
2448
|
+
);
|
|
2449
|
+
|
package/src/constants/version.ts
CHANGED
package/src/helpers/index.ts
CHANGED
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import {ActiveTab} from '../types';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Supported Remote Config keys for each module:
|
|
5
|
+
*
|
|
6
|
+
* 1. JSON Configuration:
|
|
7
|
+
* - `inspector_modules` (e.g. `{"apis": true, "logs": true, "analytics": true, ...}`)
|
|
8
|
+
* - `inapp_inspector_modules`
|
|
9
|
+
*
|
|
10
|
+
* 2. Individual Boolean Keys:
|
|
11
|
+
* - `inspector_module_apis` / `inapp_inspector_apis` / `inspector_apis`
|
|
12
|
+
* - `inspector_module_logs` / `inapp_inspector_logs` / `inspector_logs`
|
|
13
|
+
* - `inspector_module_analytics` / `inapp_inspector_analytics` / `inspector_analytics`
|
|
14
|
+
* - `inspector_module_redux` / `inapp_inspector_redux` / `inspector_redux`
|
|
15
|
+
* - `inspector_module_storage` / `inapp_inspector_storage` / `inspector_storage`
|
|
16
|
+
* - `inspector_module_device` / `inapp_inspector_device` / `inspector_device`
|
|
17
|
+
* - `inspector_module_crash` / `inapp_inspector_crash` / `inspector_crash`
|
|
18
|
+
* - `inspector_module_bundle` / `inapp_inspector_bundle` / `inspector_bundle`
|
|
19
|
+
* - `inspector_module_performance` / `inapp_inspector_performance` / `inspector_performance`
|
|
20
|
+
* - `inspector_module_debugging` / `inapp_inspector_debugging` / `inspector_debugging`
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
const MODULE_KEYS: ActiveTab[] = [
|
|
24
|
+
'apis',
|
|
25
|
+
'logs',
|
|
26
|
+
'analytics',
|
|
27
|
+
'redux',
|
|
28
|
+
'storage',
|
|
29
|
+
'device',
|
|
30
|
+
'crash',
|
|
31
|
+
'bundle',
|
|
32
|
+
'performance',
|
|
33
|
+
'debugging',
|
|
34
|
+
];
|
|
35
|
+
|
|
36
|
+
let cachedRemoteConfigInstance: any = null;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Dynamically resolves Firebase Remote Config instance if installed.
|
|
40
|
+
*/
|
|
41
|
+
export function getFirebaseRemoteConfig(customInstance?: any): any {
|
|
42
|
+
if (customInstance && typeof customInstance === 'object') {
|
|
43
|
+
cachedRemoteConfigInstance = customInstance;
|
|
44
|
+
return customInstance;
|
|
45
|
+
}
|
|
46
|
+
if (cachedRemoteConfigInstance) {
|
|
47
|
+
return cachedRemoteConfigInstance;
|
|
48
|
+
}
|
|
49
|
+
try {
|
|
50
|
+
const rcModule = require('@react-native-firebase/remote-config');
|
|
51
|
+
const instance =
|
|
52
|
+
typeof rcModule.default === 'function'
|
|
53
|
+
? rcModule.default()
|
|
54
|
+
: typeof rcModule === 'function'
|
|
55
|
+
? rcModule()
|
|
56
|
+
: rcModule;
|
|
57
|
+
cachedRemoteConfigInstance = instance;
|
|
58
|
+
return instance;
|
|
59
|
+
} catch {
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Checks if @react-native-firebase/remote-config is available in the environment.
|
|
66
|
+
*/
|
|
67
|
+
export function isFirebaseRemoteConfigAvailable(customInstance?: any): boolean {
|
|
68
|
+
return Boolean(getFirebaseRemoteConfig(customInstance));
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Helper to extract a boolean or JSON value from a Firebase Remote Config parameter.
|
|
73
|
+
*/
|
|
74
|
+
function extractValue(val: any): any {
|
|
75
|
+
if (val === null || val === undefined) return undefined;
|
|
76
|
+
if (typeof val === 'boolean') return val;
|
|
77
|
+
if (typeof val === 'number') return val !== 0;
|
|
78
|
+
if (typeof val === 'string') {
|
|
79
|
+
const lower = val.trim().toLowerCase();
|
|
80
|
+
if (lower === 'true' || lower === '1' || lower === 'enabled' || lower === 'on') return true;
|
|
81
|
+
if (lower === 'false' || lower === '0' || lower === 'disabled' || lower === 'off') return false;
|
|
82
|
+
try {
|
|
83
|
+
return JSON.parse(val);
|
|
84
|
+
} catch {
|
|
85
|
+
return undefined;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
// Firebase Remote Config Value object with .asBoolean() or .asString()
|
|
89
|
+
if (typeof val.asBoolean === 'function') {
|
|
90
|
+
return val.asBoolean();
|
|
91
|
+
}
|
|
92
|
+
if (typeof val.asString === 'function') {
|
|
93
|
+
const str = val.asString();
|
|
94
|
+
const lower = str.trim().toLowerCase();
|
|
95
|
+
if (lower === 'true' || lower === '1' || lower === 'enabled' || lower === 'on') return true;
|
|
96
|
+
if (lower === 'false' || lower === '0' || lower === 'disabled' || lower === 'off') return false;
|
|
97
|
+
try {
|
|
98
|
+
return JSON.parse(str);
|
|
99
|
+
} catch {
|
|
100
|
+
return undefined;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return undefined;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Fetches and activates latest values from Firebase Remote Config, then parses module enable/disable statuses.
|
|
108
|
+
* Returns a partial or complete mapping of module visibility flags, or null if Remote Config is unavailable.
|
|
109
|
+
*
|
|
110
|
+
* @param customInstance Optional custom remoteConfig instance from consumer app
|
|
111
|
+
* @param fetchTimeoutMs Timeout for fetch operation in ms (default: 8000)
|
|
112
|
+
*/
|
|
113
|
+
export async function fetchRemoteConfigModuleStatus(
|
|
114
|
+
customInstance?: any,
|
|
115
|
+
fetchTimeoutMs = 8000,
|
|
116
|
+
): Promise<Partial<Record<ActiveTab, boolean>> | null> {
|
|
117
|
+
const rc = getFirebaseRemoteConfig(customInstance);
|
|
118
|
+
if (!rc) {
|
|
119
|
+
return null;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
try {
|
|
123
|
+
// 1. Fetch & Activate with timeout protection
|
|
124
|
+
const fetchPromise = (async () => {
|
|
125
|
+
if (typeof rc.fetchAndActivate === 'function') {
|
|
126
|
+
await rc.fetchAndActivate();
|
|
127
|
+
} else {
|
|
128
|
+
if (typeof rc.fetch === 'function') {
|
|
129
|
+
await rc.fetch();
|
|
130
|
+
}
|
|
131
|
+
if (typeof rc.activate === 'function') {
|
|
132
|
+
await rc.activate();
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
})();
|
|
136
|
+
|
|
137
|
+
const timeoutPromise = new Promise((_, reject) =>
|
|
138
|
+
setTimeout(() => reject(new Error('Remote Config fetch timeout')), fetchTimeoutMs),
|
|
139
|
+
);
|
|
140
|
+
|
|
141
|
+
await Promise.race([fetchPromise, timeoutPromise]).catch(() => {
|
|
142
|
+
// If network fetch fails/times out, we still read cached/activated values
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
// 2. Read values from Remote Config
|
|
146
|
+
const result: Partial<Record<ActiveTab, boolean>> = {};
|
|
147
|
+
|
|
148
|
+
// Check JSON bundle key first: `inspector_modules` or `inapp_inspector_modules`
|
|
149
|
+
const jsonKeys = [
|
|
150
|
+
'inspector_modules',
|
|
151
|
+
'inapp_inspector_modules',
|
|
152
|
+
'react_native_inapp_inspector_modules',
|
|
153
|
+
];
|
|
154
|
+
|
|
155
|
+
for (const jKey of jsonKeys) {
|
|
156
|
+
let rawVal: any;
|
|
157
|
+
if (typeof rc.getValue === 'function') {
|
|
158
|
+
try {
|
|
159
|
+
rawVal = rc.getValue(jKey);
|
|
160
|
+
} catch {}
|
|
161
|
+
} else if (rc[jKey] !== undefined) {
|
|
162
|
+
rawVal = rc[jKey];
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
const parsed = extractValue(rawVal);
|
|
166
|
+
if (parsed && typeof parsed === 'object') {
|
|
167
|
+
for (const modKey of MODULE_KEYS) {
|
|
168
|
+
if (typeof parsed[modKey] === 'boolean') {
|
|
169
|
+
result[modKey] = parsed[modKey];
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
// Check individual module boolean flags (overrides JSON if explicitly defined)
|
|
176
|
+
for (const modKey of MODULE_KEYS) {
|
|
177
|
+
const paramKeys = [
|
|
178
|
+
`inspector_module_${modKey}`,
|
|
179
|
+
`inapp_inspector_${modKey}`,
|
|
180
|
+
`inspector_${modKey}`,
|
|
181
|
+
`inapp_inspector_module_${modKey}`,
|
|
182
|
+
`rn_inspector_${modKey}`,
|
|
183
|
+
];
|
|
184
|
+
|
|
185
|
+
for (const pKey of paramKeys) {
|
|
186
|
+
let rawVal: any;
|
|
187
|
+
if (typeof rc.getValue === 'function') {
|
|
188
|
+
try {
|
|
189
|
+
rawVal = rc.getValue(pKey);
|
|
190
|
+
} catch {}
|
|
191
|
+
} else if (rc[pKey] !== undefined) {
|
|
192
|
+
rawVal = rc[pKey];
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
const boolVal = extractValue(rawVal);
|
|
196
|
+
if (typeof boolVal === 'boolean') {
|
|
197
|
+
result[modKey] = boolVal;
|
|
198
|
+
break;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
// APIs module is fundamental core, keep true unless explicitly disabled via remote config
|
|
204
|
+
if (result.apis === undefined) {
|
|
205
|
+
result.apis = true;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
return Object.keys(result).length > 0 ? result : null;
|
|
209
|
+
} catch (error) {
|
|
210
|
+
return null;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {NetworkLog, SearchScope} from '../types';
|
|
2
|
+
import {markSearchFilterUsed} from './telemetry';
|
|
2
3
|
|
|
3
4
|
export interface SearchQueryOptions {
|
|
4
5
|
scope?: SearchScope;
|
|
@@ -18,6 +19,8 @@ export function matchNetworkLogQuery(
|
|
|
18
19
|
): boolean {
|
|
19
20
|
if (!searchQuery || searchQuery.trim().length === 0) return true;
|
|
20
21
|
|
|
22
|
+
markSearchFilterUsed();
|
|
23
|
+
|
|
21
24
|
const rawTokens = searchQuery.trim().toLowerCase().split(/\s+/).filter(Boolean);
|
|
22
25
|
if (rawTokens.length === 0) return true;
|
|
23
26
|
|