react-native-inapp-inspector 2.3.19 → 2.3.21
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 +14 -14
- package/android/src/main/java/com/inappinspector/NetworkInspectorModule.kt +67 -0
- package/dist/commonjs/analytics.js +1 -24
- package/dist/commonjs/bundle.js +1 -16
- package/dist/commonjs/capture.js +1 -35
- package/dist/commonjs/components/AnalyticsDetail.js +92 -623
- package/dist/commonjs/components/AnalyticsEventCard.js +54 -350
- package/dist/commonjs/components/AnalyticsGraph.js +70 -370
- package/dist/commonjs/components/AnimatedEntrance.js +1 -11
- package/dist/commonjs/components/AppHeaderLogo.js +7 -134
- package/dist/commonjs/components/BrandCircleIcon.js +73 -118
- package/dist/commonjs/components/BrandSquareIcon.js +63 -108
- package/dist/commonjs/components/CodeSnippet.js +48 -623
- package/dist/commonjs/components/ConsoleLogCard.js +63 -537
- package/dist/commonjs/components/CopyButton.js +3 -89
- package/dist/commonjs/components/DiffViewer.js +19 -83
- package/dist/commonjs/components/DomainHeader.js +27 -127
- package/dist/commonjs/components/EmptyState.js +10 -87
- package/dist/commonjs/components/EndOfListFooter.js +7 -81
- package/dist/commonjs/components/ErrorBoundary.js +72 -566
- package/dist/commonjs/components/HeadersSection.js +31 -110
- package/dist/commonjs/components/HighlightText.js +17 -58
- package/dist/commonjs/components/Inspector/AboutModal.d.ts +6 -0
- package/dist/commonjs/components/Inspector/AboutModal.js +243 -0
- package/dist/commonjs/components/Inspector/AnalyticsFilterModal.js +98 -797
- package/dist/commonjs/components/Inspector/AnalyticsTab.js +284 -930
- package/dist/commonjs/components/Inspector/BundleTab.js +551 -2918
- package/dist/commonjs/components/Inspector/ConsoleTab.js +79 -492
- package/dist/commonjs/components/Inspector/CrashDetail.js +123 -672
- package/dist/commonjs/components/Inspector/CrashFilterModal.js +66 -498
- package/dist/commonjs/components/Inspector/CrashTab.js +98 -670
- package/dist/commonjs/components/Inspector/DebuggingTab.js +74 -875
- package/dist/commonjs/components/Inspector/DeviceInfoTab.js +143 -907
- package/dist/commonjs/components/Inspector/FabLauncher.js +42 -466
- package/dist/commonjs/components/Inspector/FeatureUnderDevNotice.js +6 -99
- package/dist/commonjs/components/Inspector/InspectorContext.js +1 -21
- package/dist/commonjs/components/Inspector/InspectorHeader.js +191 -1110
- package/dist/commonjs/components/Inspector/LogDetail.js +168 -994
- package/dist/commonjs/components/Inspector/MainScreen.js +52 -335
- package/dist/commonjs/components/Inspector/MediaGalleryTab.js +97 -644
- package/dist/commonjs/components/Inspector/MediaPreviewModal.js +90 -605
- package/dist/commonjs/components/Inspector/NavigationTracker.js +1 -12
- package/dist/commonjs/components/Inspector/NetworkDetail.js +89 -411
- package/dist/commonjs/components/Inspector/NetworkFilterModal.js +60 -576
- package/dist/commonjs/components/Inspector/NetworkTab.js +84 -514
- package/dist/commonjs/components/Inspector/NpmStarPrompt.js +18 -434
- package/dist/commonjs/components/Inspector/NpmUpdateToast.js +25 -298
- package/dist/commonjs/components/Inspector/PerformanceTab.js +182 -1397
- package/dist/commonjs/components/Inspector/ReduxDetail.js +188 -1089
- package/dist/commonjs/components/Inspector/ReduxTab.js +85 -701
- package/dist/commonjs/components/Inspector/SettingsPanel.js +427 -3807
- package/dist/commonjs/components/Inspector/SkeletonPlaceholder.js +11 -180
- package/dist/commonjs/components/Inspector/StorageTab.js +93 -826
- package/dist/commonjs/components/Inspector/TabBar.js +36 -334
- package/dist/commonjs/components/Inspector/UpdateAvailableModal.js +37 -412
- package/dist/commonjs/components/JsonViewer.js +168 -381
- package/dist/commonjs/components/LogCard.js +57 -567
- package/dist/commonjs/components/LogSyntaxHighlighter.js +11 -130
- package/dist/commonjs/components/MetaAccordion.js +69 -238
- package/dist/commonjs/components/MiniBarChart.js +3 -56
- package/dist/commonjs/components/MiniLineChart.js +3 -58
- package/dist/commonjs/components/NetworkIcons.d.ts +13 -0
- package/dist/commonjs/components/NetworkIcons.js +521 -1022
- package/dist/commonjs/components/QRCodeView.js +5 -79
- package/dist/commonjs/components/SectionHeader.js +15 -37
- package/dist/commonjs/components/SegmentedTabs.js +7 -62
- package/dist/commonjs/components/SkeletonPlaceholder.js +11 -180
- package/dist/commonjs/components/Slider.js +15 -243
- package/dist/commonjs/components/SourcePageCard.js +30 -89
- package/dist/commonjs/components/Toast.js +5 -147
- package/dist/commonjs/components/TouchableScale.js +3 -24
- package/dist/commonjs/components/TreeNode.js +55 -130
- package/dist/commonjs/console.js +1 -16
- package/dist/commonjs/constants/index.js +1 -32
- package/dist/commonjs/constants/telemetryConfig.js +1 -6
- package/dist/commonjs/constants/version.d.ts +1 -1
- package/dist/commonjs/constants/version.js +1 -4
- package/dist/commonjs/crash.js +1 -23
- package/dist/commonjs/customHooks/analyticsLogger.js +1 -250
- package/dist/commonjs/customHooks/bundleAnalyzer.js +1 -957
- package/dist/commonjs/customHooks/consoleLogger.js +6 -445
- package/dist/commonjs/customHooks/crashHandler.js +7 -656
- package/dist/commonjs/customHooks/logFilters.js +1 -23
- package/dist/commonjs/customHooks/networkLogger.js +2 -536
- package/dist/commonjs/customHooks/performanceTracker.js +63 -750
- package/dist/commonjs/customHooks/reduxLogger.js +2 -313
- package/dist/commonjs/customHooks/storageInspector.js +1 -435
- package/dist/commonjs/customHooks/useAccordion.js +1 -18
- package/dist/commonjs/decorators/index.js +1 -100
- package/dist/commonjs/helpers/gaAnalyticsRegistry.js +1 -148
- package/dist/commonjs/helpers/index.d.ts +1 -0
- package/dist/commonjs/helpers/index.js +8 -921
- package/dist/commonjs/helpers/memoryManager.js +1 -99
- package/dist/commonjs/helpers/qrGenerator.js +1 -367
- package/dist/commonjs/helpers/remoteConfig.js +1 -165
- package/dist/commonjs/helpers/searchQueryParser.js +1 -62
- package/dist/commonjs/helpers/settingsStore.js +1 -144
- package/dist/commonjs/helpers/telemetry.js +1 -501
- package/dist/commonjs/helpers/toast.js +1 -20
- package/dist/commonjs/i18n/index.js +1 -90
- package/dist/commonjs/i18n/locales/en.json +1 -1140
- package/dist/commonjs/index.js +5 -2168
- package/dist/commonjs/metro.js +6 -468
- package/dist/commonjs/native/NativeInspector.d.ts +1 -0
- package/dist/commonjs/native/NativeInspector.js +1 -415
- package/dist/commonjs/native/NativeNetworkInspector.js +1 -4
- package/dist/commonjs/network.js +1 -13
- package/dist/commonjs/performance.js +1 -29
- package/dist/commonjs/redux.js +1 -20
- package/dist/commonjs/storage.js +1 -14
- package/dist/commonjs/styles/AppColors.js +1 -423
- package/dist/commonjs/styles/AppFonts.js +1 -17
- package/dist/commonjs/styles/common.js +1 -190
- package/dist/commonjs/styles/index.d.ts +6 -0
- package/dist/commonjs/styles/index.js +1 -1589
- package/dist/commonjs/types/enums.d.ts +0 -1
- package/dist/commonjs/types/enums.js +1 -152
- package/dist/commonjs/types/index.js +1 -18
- package/dist/commonjs/types/interfaces.d.ts +2 -2
- package/dist/commonjs/types/interfaces.js +1 -2
- package/dist/esm/analytics.js +1 -2
- package/dist/esm/bundle.js +1 -2
- package/dist/esm/capture.js +1 -32
- package/dist/esm/components/AnalyticsDetail.js +171 -664
- package/dist/esm/components/AnalyticsEventCard.js +77 -335
- package/dist/esm/components/AnalyticsGraph.js +95 -357
- package/dist/esm/components/AnimatedEntrance.js +1 -6
- package/dist/esm/components/AppHeaderLogo.js +7 -94
- package/dist/esm/components/BrandCircleIcon.js +114 -119
- package/dist/esm/components/BrandSquareIcon.js +73 -78
- package/dist/esm/components/CodeSnippet.js +58 -595
- package/dist/esm/components/ConsoleLogCard.js +91 -526
- package/dist/esm/components/CopyButton.js +3 -51
- package/dist/esm/components/DiffViewer.js +22 -48
- package/dist/esm/components/DomainHeader.js +43 -138
- package/dist/esm/components/EmptyState.js +17 -56
- package/dist/esm/components/EndOfListFooter.js +15 -83
- package/dist/esm/components/ErrorBoundary.js +125 -582
- package/dist/esm/components/HeadersSection.js +52 -93
- package/dist/esm/components/HighlightText.js +17 -53
- package/dist/esm/components/Inspector/AboutModal.d.ts +6 -0
- package/dist/esm/components/Inspector/AboutModal.js +243 -0
- package/dist/esm/components/Inspector/AnalyticsFilterModal.js +225 -886
- package/dist/esm/components/Inspector/AnalyticsTab.js +296 -904
- package/dist/esm/components/Inspector/BundleTab.js +1175 -3502
- package/dist/esm/components/Inspector/ConsoleTab.js +113 -488
- package/dist/esm/components/Inspector/CrashDetail.js +236 -747
- package/dist/esm/components/Inspector/CrashFilterModal.js +149 -541
- package/dist/esm/components/Inspector/CrashTab.js +177 -711
- package/dist/esm/components/Inspector/DebuggingTab.js +164 -925
- package/dist/esm/components/Inspector/DeviceInfoTab.js +199 -924
- package/dist/esm/components/Inspector/FabLauncher.js +68 -454
- package/dist/esm/components/Inspector/FeatureUnderDevNotice.js +14 -70
- package/dist/esm/components/Inspector/InspectorContext.js +1 -12
- package/dist/esm/components/Inspector/InspectorHeader.js +282 -1163
- package/dist/esm/components/Inspector/LogDetail.js +235 -1023
- package/dist/esm/components/Inspector/MainScreen.js +78 -323
- package/dist/esm/components/Inspector/MediaGalleryTab.js +143 -650
- package/dist/esm/components/Inspector/MediaPreviewModal.js +138 -613
- package/dist/esm/components/Inspector/NavigationTracker.js +1 -10
- package/dist/esm/components/Inspector/NetworkDetail.js +138 -455
- package/dist/esm/components/Inspector/NetworkFilterModal.js +122 -597
- package/dist/esm/components/Inspector/NetworkTab.js +125 -517
- package/dist/esm/components/Inspector/NpmStarPrompt.js +58 -434
- package/dist/esm/components/Inspector/NpmUpdateToast.js +45 -281
- package/dist/esm/components/Inspector/PerformanceTab.js +393 -1570
- package/dist/esm/components/Inspector/ReduxDetail.js +307 -1170
- package/dist/esm/components/Inspector/ReduxTab.js +144 -722
- package/dist/esm/components/Inspector/SettingsPanel.js +643 -3985
- package/dist/esm/components/Inspector/SkeletonPlaceholder.js +30 -163
- package/dist/esm/components/Inspector/StorageTab.js +172 -866
- package/dist/esm/components/Inspector/TabBar.js +45 -305
- package/dist/esm/components/Inspector/UpdateAvailableModal.js +80 -418
- package/dist/esm/components/JsonViewer.js +179 -354
- package/dist/esm/components/LogCard.js +93 -565
- package/dist/esm/components/LogSyntaxHighlighter.js +11 -123
- package/dist/esm/components/MetaAccordion.js +136 -267
- package/dist/esm/components/MiniBarChart.js +3 -18
- package/dist/esm/components/MiniLineChart.js +3 -20
- package/dist/esm/components/NetworkIcons.d.ts +13 -0
- package/dist/esm/components/NetworkIcons.js +523 -838
- package/dist/esm/components/QRCodeView.js +8 -45
- package/dist/esm/components/SectionHeader.js +22 -39
- package/dist/esm/components/SegmentedTabs.js +8 -58
- package/dist/esm/components/SkeletonPlaceholder.js +30 -163
- package/dist/esm/components/Slider.js +24 -213
- package/dist/esm/components/SourcePageCard.js +65 -86
- package/dist/esm/components/Toast.js +10 -117
- package/dist/esm/components/TouchableScale.js +3 -19
- package/dist/esm/components/TreeNode.js +58 -95
- package/dist/esm/console.js +1 -2
- package/dist/esm/constants/index.js +1 -28
- package/dist/esm/constants/telemetryConfig.js +1 -3
- package/dist/esm/constants/version.d.ts +1 -1
- package/dist/esm/constants/version.js +1 -1
- package/dist/esm/crash.js +1 -2
- package/dist/esm/customHooks/analyticsLogger.js +1 -230
- package/dist/esm/customHooks/bundleAnalyzer.js +1 -944
- package/dist/esm/customHooks/consoleLogger.js +6 -432
- package/dist/esm/customHooks/crashHandler.js +7 -630
- package/dist/esm/customHooks/logFilters.js +1 -20
- package/dist/esm/customHooks/networkLogger.js +2 -519
- package/dist/esm/customHooks/performanceTracker.js +63 -723
- package/dist/esm/customHooks/reduxLogger.js +2 -293
- package/dist/esm/customHooks/storageInspector.js +1 -418
- package/dist/esm/customHooks/useAccordion.js +1 -16
- package/dist/esm/decorators/index.js +1 -95
- package/dist/esm/helpers/gaAnalyticsRegistry.js +1 -143
- package/dist/esm/helpers/index.d.ts +1 -0
- package/dist/esm/helpers/index.js +8 -861
- package/dist/esm/helpers/memoryManager.js +1 -91
- package/dist/esm/helpers/qrGenerator.js +1 -364
- package/dist/esm/helpers/remoteConfig.js +1 -160
- package/dist/esm/helpers/searchQueryParser.js +1 -59
- package/dist/esm/helpers/settingsStore.js +1 -134
- package/dist/esm/helpers/telemetry.js +1 -489
- package/dist/esm/helpers/toast.js +1 -15
- package/dist/esm/i18n/index.js +1 -78
- package/dist/esm/i18n/locales/en.json +1 -1140
- package/dist/esm/index.js +7 -1982
- package/dist/esm/metro.js +6 -459
- package/dist/esm/native/NativeInspector.d.ts +1 -0
- package/dist/esm/native/NativeInspector.js +1 -382
- package/dist/esm/native/NativeNetworkInspector.js +1 -2
- package/dist/esm/network.js +1 -1
- package/dist/esm/performance.js +1 -2
- package/dist/esm/redux.js +1 -1
- package/dist/esm/storage.js +1 -1
- package/dist/esm/styles/AppColors.js +1 -417
- package/dist/esm/styles/AppFonts.js +1 -13
- package/dist/esm/styles/common.js +1 -186
- package/dist/esm/styles/index.d.ts +6 -0
- package/dist/esm/styles/index.js +1 -1551
- package/dist/esm/types/enums.d.ts +0 -1
- package/dist/esm/types/enums.js +1 -149
- package/dist/esm/types/index.js +1 -2
- package/dist/esm/types/interfaces.d.ts +2 -2
- package/dist/esm/types/interfaces.js +1 -1
- package/ios/NetworkInspectorModule.mm +60 -12
- package/package.json +5 -3
- package/src/native/NativeInspector.ts +18 -0
- package/dist/commonjs/components/Inspector/FeedbackModal.d.ts +0 -7
- package/dist/commonjs/components/Inspector/FeedbackModal.js +0 -552
- package/dist/esm/components/Inspector/FeedbackModal.d.ts +0 -7
- package/dist/esm/components/Inspector/FeedbackModal.js +0 -515
- package/src/analytics.ts +0 -35
- package/src/bundle.ts +0 -25
- package/src/capture.ts +0 -109
- package/src/components/AnalyticsDetail.tsx +0 -870
- package/src/components/AnalyticsEventCard.tsx +0 -444
- package/src/components/AnalyticsGraph.tsx +0 -583
- package/src/components/AnimatedEntrance.tsx +0 -20
- package/src/components/AppHeaderLogo.tsx +0 -143
- package/src/components/BrandCircleIcon.tsx +0 -144
- package/src/components/BrandSquareIcon.tsx +0 -184
- package/src/components/CodeSnippet.tsx +0 -725
- package/src/components/ConsoleLogCard.tsx +0 -679
- package/src/components/CopyButton.tsx +0 -87
- package/src/components/DiffViewer.tsx +0 -82
- package/src/components/DomainHeader.tsx +0 -224
- package/src/components/EmptyState.tsx +0 -97
- package/src/components/EndOfListFooter.tsx +0 -100
- package/src/components/ErrorBoundary.tsx +0 -688
- package/src/components/HeadersSection.tsx +0 -172
- package/src/components/HighlightText.tsx +0 -100
- package/src/components/Inspector/AnalyticsFilterModal.tsx +0 -1250
- package/src/components/Inspector/AnalyticsTab.tsx +0 -1362
- package/src/components/Inspector/BundleTab.tsx +0 -4768
- package/src/components/Inspector/ConsoleTab.tsx +0 -726
- package/src/components/Inspector/CrashDetail.tsx +0 -997
- package/src/components/Inspector/CrashFilterModal.tsx +0 -721
- package/src/components/Inspector/CrashTab.tsx +0 -933
- package/src/components/Inspector/DebuggingTab.tsx +0 -1103
- package/src/components/Inspector/DeviceInfoTab.tsx +0 -1397
- package/src/components/Inspector/FabLauncher.tsx +0 -590
- package/src/components/Inspector/FeatureUnderDevNotice.tsx +0 -94
- package/src/components/Inspector/FeedbackModal.tsx +0 -626
- package/src/components/Inspector/InspectorContext.tsx +0 -28
- package/src/components/Inspector/InspectorHeader.tsx +0 -1583
- package/src/components/Inspector/LogDetail.tsx +0 -1431
- package/src/components/Inspector/MainScreen.tsx +0 -460
- package/src/components/Inspector/MediaGalleryTab.tsx +0 -829
- package/src/components/Inspector/MediaPreviewModal.tsx +0 -783
- package/src/components/Inspector/NavigationTracker.tsx +0 -13
- package/src/components/Inspector/NetworkDetail.tsx +0 -778
- package/src/components/Inspector/NetworkFilterModal.tsx +0 -730
- package/src/components/Inspector/NetworkTab.tsx +0 -820
- package/src/components/Inspector/NpmStarPrompt.tsx +0 -532
- package/src/components/Inspector/NpmUpdateToast.tsx +0 -387
- package/src/components/Inspector/PerformanceTab.tsx +0 -1967
- package/src/components/Inspector/ReduxDetail.tsx +0 -1651
- package/src/components/Inspector/ReduxTab.tsx +0 -987
- package/src/components/Inspector/SettingsPanel.tsx +0 -5136
- package/src/components/Inspector/SkeletonPlaceholder.tsx +0 -206
- package/src/components/Inspector/StorageTab.tsx +0 -1159
- package/src/components/Inspector/TabBar.tsx +0 -431
- package/src/components/Inspector/UpdateAvailableModal.tsx +0 -555
- package/src/components/JsonViewer.tsx +0 -549
- package/src/components/LogCard.tsx +0 -694
- package/src/components/LogSyntaxHighlighter.tsx +0 -178
- package/src/components/MetaAccordion.tsx +0 -355
- package/src/components/MiniBarChart.tsx +0 -42
- package/src/components/MiniLineChart.tsx +0 -33
- package/src/components/NetworkIcons.tsx +0 -2655
- package/src/components/QRCodeView.tsx +0 -75
- package/src/components/SectionHeader.tsx +0 -101
- package/src/components/SegmentedTabs.tsx +0 -84
- package/src/components/SkeletonPlaceholder.tsx +0 -206
- package/src/components/Slider.tsx +0 -300
- package/src/components/SourcePageCard.tsx +0 -150
- package/src/components/Toast.tsx +0 -131
- package/src/components/TouchableScale.tsx +0 -61
- package/src/components/TreeNode.tsx +0 -171
- package/src/console.ts +0 -24
- package/src/constants/index.ts +0 -41
- package/src/constants/telemetryConfig.ts +0 -4
- package/src/constants/version.ts +0 -3
- package/src/crash.ts +0 -32
- package/src/customHooks/analyticsLogger.ts +0 -336
- package/src/customHooks/bundleAnalyzer.ts +0 -1256
- package/src/customHooks/consoleLogger.ts +0 -530
- package/src/customHooks/crashHandler.ts +0 -944
- package/src/customHooks/logFilters.ts +0 -32
- package/src/customHooks/networkLogger.ts +0 -624
- package/src/customHooks/performanceTracker.ts +0 -1014
- package/src/customHooks/reduxLogger.ts +0 -406
- package/src/customHooks/storageInspector.ts +0 -513
- package/src/customHooks/useAccordion.tsx +0 -27
- package/src/decorators/index.ts +0 -184
- package/src/helpers/gaAnalyticsRegistry.ts +0 -204
- package/src/helpers/index.ts +0 -1092
- package/src/helpers/memoryManager.ts +0 -138
- package/src/helpers/qrGenerator.ts +0 -430
- package/src/helpers/remoteConfig.ts +0 -212
- package/src/helpers/searchQueryParser.ts +0 -84
- package/src/helpers/settingsStore.ts +0 -171
- package/src/helpers/telemetry.ts +0 -568
- package/src/helpers/toast.ts +0 -17
- package/src/i18n/index.ts +0 -104
- package/src/i18n/locales/en.json +0 -1141
- package/src/index.tsx +0 -2650
- package/src/metro.ts +0 -598
- package/src/network.ts +0 -22
- package/src/performance.ts +0 -38
- package/src/redux.ts +0 -23
- package/src/storage.ts +0 -18
- package/src/styles/AppColors.ts +0 -455
- package/src/styles/AppFonts.ts +0 -26
- package/src/styles/common.ts +0 -209
- package/src/styles/index.ts +0 -1606
- package/src/types/enums.ts +0 -210
- package/src/types/index.ts +0 -34
- package/src/types/interfaces.ts +0 -535
package/src/helpers/telemetry.ts
DELETED
|
@@ -1,568 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {Appearance, Dimensions, PixelRatio, Platform, NativeModules} from 'react-native';
|
|
3
|
-
import {LIB_VERSION} from '../constants/version';
|
|
4
|
-
import {loadSettings, saveSettings, PersistedSettings} from './settingsStore';
|
|
5
|
-
import {isReduxConnected} from '../customHooks/reduxLogger';
|
|
6
|
-
import {isFirebaseAnalyticsPatched} from '../customHooks/analyticsLogger';
|
|
7
|
-
import {getCrashRecords} from '../customHooks/crashHandler';
|
|
8
|
-
import {getNetworkLogs} from '../customHooks/networkLogger';
|
|
9
|
-
import {isNativeModuleAvailable} from '../native/NativeInspector';
|
|
10
|
-
import {
|
|
11
|
-
getAppName,
|
|
12
|
-
getBundleIdentifier,
|
|
13
|
-
getAppVersionAndBuild,
|
|
14
|
-
isLocalDebugEnvironment,
|
|
15
|
-
} from './index';
|
|
16
|
-
import {
|
|
17
|
-
ENC_MID,
|
|
18
|
-
ENC_SEC,
|
|
19
|
-
TELEMETRY_SALT,
|
|
20
|
-
} from '../constants/telemetryConfig';
|
|
21
|
-
|
|
22
|
-
// ─── Runtime Keystream Deobfuscation ────────────────────────────────────────
|
|
23
|
-
|
|
24
|
-
const PKG_NAME = 'react-native-inapp-inspector';
|
|
25
|
-
const KEY_MATERIAL = `${PKG_NAME}::${TELEMETRY_SALT}`;
|
|
26
|
-
|
|
27
|
-
function getKeystream(material: string, length: number): number[] {
|
|
28
|
-
const stream: number[] = [];
|
|
29
|
-
let acc = 0x5a827999;
|
|
30
|
-
for (let i = 0; i < length; i++) {
|
|
31
|
-
const charCode = material.charCodeAt(i % material.length);
|
|
32
|
-
acc = ((acc * 31 + charCode * 17 + i * 13) ^ (acc >>> 7)) & 0xffffffff;
|
|
33
|
-
stream.push((acc >>> (i % 24)) & 0xff);
|
|
34
|
-
}
|
|
35
|
-
return stream;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function deobfuscate(hexStr: string): string {
|
|
39
|
-
if (!hexStr) return '';
|
|
40
|
-
const bytes: number[] = [];
|
|
41
|
-
for (let i = 0; i < hexStr.length; i += 2) {
|
|
42
|
-
bytes.push(parseInt(hexStr.substring(i, i + 2), 16));
|
|
43
|
-
}
|
|
44
|
-
const keystream = getKeystream(KEY_MATERIAL, bytes.length);
|
|
45
|
-
const out: string[] = [];
|
|
46
|
-
for (let i = 0; i < bytes.length; i++) {
|
|
47
|
-
const k = keystream[i];
|
|
48
|
-
const s = TELEMETRY_SALT.charCodeAt(i % TELEMETRY_SALT.length);
|
|
49
|
-
const dec = (bytes[i] ^ k ^ s) & 0xff;
|
|
50
|
-
out.push(String.fromCharCode(dec));
|
|
51
|
-
}
|
|
52
|
-
return out.join('');
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
// ─── Lazy-initialized credentials ──────────────────────────────────────────
|
|
56
|
-
let _cachedMid: string | null = null;
|
|
57
|
-
let _cachedSec: string | null = null;
|
|
58
|
-
|
|
59
|
-
function getCredentials(): {measurementId: string; apiSecret: string} {
|
|
60
|
-
if (_cachedMid !== null && _cachedSec !== null) {
|
|
61
|
-
return {measurementId: _cachedMid, apiSecret: _cachedSec};
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
if (!ENC_MID || !ENC_SEC || !TELEMETRY_SALT) {
|
|
65
|
-
_cachedMid = '';
|
|
66
|
-
_cachedSec = '';
|
|
67
|
-
return {measurementId: '', apiSecret: ''};
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
try {
|
|
71
|
-
_cachedMid = deobfuscate(ENC_MID);
|
|
72
|
-
_cachedSec = deobfuscate(ENC_SEC);
|
|
73
|
-
} catch {
|
|
74
|
-
_cachedMid = '';
|
|
75
|
-
_cachedSec = '';
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
return {measurementId: _cachedMid, apiSecret: _cachedSec};
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
function getCollectUrl(): string {
|
|
82
|
-
const {measurementId, apiSecret} = getCredentials();
|
|
83
|
-
if (!measurementId || !apiSecret) return '';
|
|
84
|
-
return `https://www.google-analytics.com/mp/collect?measurement_id=${measurementId}&api_secret=${apiSecret}`;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
// ─── Telemetry State & Heartbeat ───────────────────────────────────────────
|
|
88
|
-
|
|
89
|
-
const PING_INTERVAL_MS = 24 * 60 * 60 * 1000;
|
|
90
|
-
|
|
91
|
-
let isTelemetryEnabled = true;
|
|
92
|
-
let _hasSearchFilterBeenUsed = false;
|
|
93
|
-
|
|
94
|
-
export function setTelemetryEnabled(enabled: boolean): void {
|
|
95
|
-
isTelemetryEnabled = enabled;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
export function markSearchFilterUsed(): void {
|
|
99
|
-
_hasSearchFilterBeenUsed = true;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
async function getOrCreateClientId(): Promise<string> {
|
|
103
|
-
try {
|
|
104
|
-
const settings = await loadSettings();
|
|
105
|
-
if (settings.telemetryClientId || settings.telemetryDeviceId) {
|
|
106
|
-
const id = settings.telemetryClientId || settings.telemetryDeviceId || '';
|
|
107
|
-
if (!settings.telemetryDeviceId) {
|
|
108
|
-
await saveSettings({...settings, telemetryDeviceId: id});
|
|
109
|
-
}
|
|
110
|
-
return id;
|
|
111
|
-
}
|
|
112
|
-
const part1 = Math.floor(100000000 + Math.random() * 900000000);
|
|
113
|
-
const part2 = Math.floor(1000000000 + Math.random() * 9000000000);
|
|
114
|
-
const newId = `${part1}.${part2}`;
|
|
115
|
-
const now = Date.now();
|
|
116
|
-
await saveSettings({
|
|
117
|
-
...settings,
|
|
118
|
-
telemetryClientId: newId,
|
|
119
|
-
telemetryDeviceId: newId,
|
|
120
|
-
deviceFirstSeen: settings.deviceFirstSeen || now,
|
|
121
|
-
});
|
|
122
|
-
return newId;
|
|
123
|
-
} catch {
|
|
124
|
-
return `${Math.floor(100000000 + Math.random() * 900000000)}.${Math.floor(1000000000 + Math.random() * 9000000000)}`;
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
function isDeviceEmulator(): boolean {
|
|
129
|
-
try {
|
|
130
|
-
if (Platform.OS === 'android') {
|
|
131
|
-
const c = (Platform.constants as any) || {};
|
|
132
|
-
const model = String(c.Model || '').toLowerCase();
|
|
133
|
-
const brand = String(c.Brand || '').toLowerCase();
|
|
134
|
-
const fingerprint = String(c.Fingerprint || '').toLowerCase();
|
|
135
|
-
const hardware = String(c.Hardware || '').toLowerCase();
|
|
136
|
-
const manufacturer = String(c.Manufacturer || '').toLowerCase();
|
|
137
|
-
return (
|
|
138
|
-
model.includes('emulator') ||
|
|
139
|
-
model.includes('sdk') ||
|
|
140
|
-
model.includes('google_sdk') ||
|
|
141
|
-
model.includes('vbox') ||
|
|
142
|
-
brand.includes('generic') ||
|
|
143
|
-
fingerprint.startsWith('generic') ||
|
|
144
|
-
hardware.includes('goldfish') ||
|
|
145
|
-
hardware.includes('ranchu') ||
|
|
146
|
-
manufacturer.includes('genymotion')
|
|
147
|
-
);
|
|
148
|
-
}
|
|
149
|
-
if (Platform.OS === 'ios') {
|
|
150
|
-
const c = (Platform.constants as any) || {};
|
|
151
|
-
const model = String(c.Model || '').toLowerCase();
|
|
152
|
-
return model.includes('simulator') || Boolean(c.isSimulator);
|
|
153
|
-
}
|
|
154
|
-
} catch {
|
|
155
|
-
return false;
|
|
156
|
-
}
|
|
157
|
-
return false;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
function getDeviceLocaleInfo(): {countryCode: string; locale: string; timeZone: string} {
|
|
161
|
-
try {
|
|
162
|
-
const opts = typeof Intl !== 'undefined' && Intl.DateTimeFormat ? Intl.DateTimeFormat().resolvedOptions() : {} as any;
|
|
163
|
-
const timeZone = opts.timeZone || 'unknown';
|
|
164
|
-
const locale = opts.locale || 'unknown';
|
|
165
|
-
let countryCode = 'unknown';
|
|
166
|
-
|
|
167
|
-
if (locale && locale !== 'unknown') {
|
|
168
|
-
const parts = locale.split(/[-_]/);
|
|
169
|
-
if (parts.length > 1) {
|
|
170
|
-
countryCode = parts[parts.length - 1].toUpperCase();
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
return { countryCode, locale, timeZone };
|
|
175
|
-
} catch {
|
|
176
|
-
return { countryCode: 'unknown', locale: 'unknown', timeZone: 'unknown' };
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
function getSystemMetadata(environment?: string, currentSettings?: PersistedSettings) {
|
|
181
|
-
const rnConstants = Platform.constants as any;
|
|
182
|
-
const rnVersion = rnConstants?.reactNativeVersion
|
|
183
|
-
? `${rnConstants.reactNativeVersion.major}.${rnConstants.reactNativeVersion.minor}.${rnConstants.reactNativeVersion.patch}`
|
|
184
|
-
: 'unknown';
|
|
185
|
-
|
|
186
|
-
const isHermes = Boolean(typeof (global as any).HermesInternal === 'object' && (global as any).HermesInternal !== null);
|
|
187
|
-
const isFabric = Boolean((global as any)?.nativeFabricUIManager !== undefined);
|
|
188
|
-
const isBridgeless = Boolean((global as any)?._rn_bridgeless || (global as any)?.RN$Bridgeless);
|
|
189
|
-
const isDev = Boolean(typeof __DEV__ !== 'undefined' && __DEV__);
|
|
190
|
-
const isEmulator = isDeviceEmulator();
|
|
191
|
-
const { countryCode, locale, timeZone } = getDeviceLocaleInfo();
|
|
192
|
-
|
|
193
|
-
let screenRes = 'unknown';
|
|
194
|
-
let screenDensity = 1;
|
|
195
|
-
let fontScale = 1;
|
|
196
|
-
let deviceFormFactor = 'phone';
|
|
197
|
-
let screenOrientation = 'portrait';
|
|
198
|
-
try {
|
|
199
|
-
const dim = Dimensions.get('window');
|
|
200
|
-
screenRes = `${Math.round(dim.width)}x${Math.round(dim.height)}`;
|
|
201
|
-
screenDensity = PixelRatio.get();
|
|
202
|
-
fontScale = PixelRatio.getFontScale();
|
|
203
|
-
screenOrientation = dim.width > dim.height ? 'landscape' : 'portrait';
|
|
204
|
-
const isTablet = (Platform.OS === 'ios' && Boolean((Platform as any).isPad)) ||
|
|
205
|
-
(Math.min(dim.width, dim.height) >= 600);
|
|
206
|
-
deviceFormFactor = isTablet ? 'tablet' : 'phone';
|
|
207
|
-
} catch {}
|
|
208
|
-
|
|
209
|
-
let appearanceMode = 'unknown';
|
|
210
|
-
try {
|
|
211
|
-
appearanceMode = Appearance?.getColorScheme?.() || 'unknown';
|
|
212
|
-
} catch {}
|
|
213
|
-
|
|
214
|
-
const isExpo = Boolean(
|
|
215
|
-
(globalThis as any)?.expo ||
|
|
216
|
-
(globalThis as any)?.__expo ||
|
|
217
|
-
(globalThis as any)?.__turboModuleProxy?.name === 'Expo' ||
|
|
218
|
-
(Platform.constants as any)?.ExpoVersion
|
|
219
|
-
);
|
|
220
|
-
|
|
221
|
-
let hermesVersion = 'non_hermes';
|
|
222
|
-
let jsEngine = 'jsc';
|
|
223
|
-
if (isHermes) {
|
|
224
|
-
jsEngine = 'hermes';
|
|
225
|
-
try {
|
|
226
|
-
const props = (global as any).HermesInternal?.getRuntimeProperties?.() || {};
|
|
227
|
-
hermesVersion = props['OSS Release Version'] || (props['Bytecode Version'] ? `bc_v${props['Bytecode Version']}` : 'hermes');
|
|
228
|
-
} catch {
|
|
229
|
-
hermesVersion = 'hermes';
|
|
230
|
-
}
|
|
231
|
-
} else if ((globalThis as any)?._v8) {
|
|
232
|
-
jsEngine = 'v8';
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
let reduxAttached = false;
|
|
236
|
-
try {
|
|
237
|
-
reduxAttached = isReduxConnected();
|
|
238
|
-
} catch {}
|
|
239
|
-
|
|
240
|
-
let analyticsAttached = false;
|
|
241
|
-
try {
|
|
242
|
-
analyticsAttached = isFirebaseAnalyticsPatched();
|
|
243
|
-
} catch {}
|
|
244
|
-
|
|
245
|
-
const hasNativeModule = isNativeModuleAvailable();
|
|
246
|
-
const hasMmkv = Boolean(NativeModules?.RNMMKV || (globalThis as any)?.MMKV);
|
|
247
|
-
|
|
248
|
-
let capturedCrashesCount = 0;
|
|
249
|
-
try {
|
|
250
|
-
capturedCrashesCount = getCrashRecords().length;
|
|
251
|
-
} catch {}
|
|
252
|
-
|
|
253
|
-
let capturedApisBracket = '0';
|
|
254
|
-
try {
|
|
255
|
-
const apiCount = getNetworkLogs().length;
|
|
256
|
-
capturedApisBracket =
|
|
257
|
-
apiCount === 0
|
|
258
|
-
? '0'
|
|
259
|
-
: apiCount <= 10
|
|
260
|
-
? '1-10'
|
|
261
|
-
: apiCount <= 50
|
|
262
|
-
? '11-50'
|
|
263
|
-
: apiCount <= 100
|
|
264
|
-
? '51-100'
|
|
265
|
-
: '100+';
|
|
266
|
-
} catch {}
|
|
267
|
-
|
|
268
|
-
let isMetroConnected = false;
|
|
269
|
-
try {
|
|
270
|
-
isMetroConnected = isLocalDebugEnvironment();
|
|
271
|
-
} catch {}
|
|
272
|
-
|
|
273
|
-
const defaultLandingTab = currentSettings?.defaultTab || 'apis';
|
|
274
|
-
const fabMode =
|
|
275
|
-
hasNativeModule && currentSettings?.useNativeFab !== false
|
|
276
|
-
? 'native_ui_thread'
|
|
277
|
-
: 'js_floating_button';
|
|
278
|
-
|
|
279
|
-
const deviceBrand = String(
|
|
280
|
-
rnConstants?.Brand ||
|
|
281
|
-
(Platform.OS === 'ios' ? 'Apple' : 'unknown'),
|
|
282
|
-
);
|
|
283
|
-
|
|
284
|
-
const deviceModel = String(
|
|
285
|
-
rnConstants?.Model ||
|
|
286
|
-
rnConstants?.systemName ||
|
|
287
|
-
(Platform.OS === 'ios' ? 'iPhone/iPad' : 'unknown'),
|
|
288
|
-
);
|
|
289
|
-
|
|
290
|
-
const deviceManufacturer = String(
|
|
291
|
-
rnConstants?.Manufacturer ||
|
|
292
|
-
(Platform.OS === 'ios' ? 'Apple' : 'unknown'),
|
|
293
|
-
);
|
|
294
|
-
|
|
295
|
-
let appName = 'App';
|
|
296
|
-
let bundleId = 'unknown';
|
|
297
|
-
let appVersion = 'unknown';
|
|
298
|
-
let appBuild = 'unknown';
|
|
299
|
-
try {
|
|
300
|
-
appName = getAppName() || 'App';
|
|
301
|
-
bundleId = getBundleIdentifier() || 'unknown';
|
|
302
|
-
const verInfo = getAppVersionAndBuild();
|
|
303
|
-
appVersion = verInfo.version || 'unknown';
|
|
304
|
-
appBuild = verInfo.build || 'unknown';
|
|
305
|
-
} catch {}
|
|
306
|
-
|
|
307
|
-
const reactVer = typeof React !== 'undefined' && React.version ? React.version : 'unknown';
|
|
308
|
-
|
|
309
|
-
return {
|
|
310
|
-
pkg_name: PKG_NAME,
|
|
311
|
-
pkg_version: LIB_VERSION,
|
|
312
|
-
lib_version: LIB_VERSION,
|
|
313
|
-
install_type: isDev ? 'local_dev' : 'bundled_production',
|
|
314
|
-
app_name: appName,
|
|
315
|
-
bundle_id: bundleId,
|
|
316
|
-
app_version: appVersion,
|
|
317
|
-
app_build: appBuild,
|
|
318
|
-
react_version: reactVer,
|
|
319
|
-
platform: Platform.OS,
|
|
320
|
-
os_version: String(Platform.Version || 'unknown'),
|
|
321
|
-
rn_version: rnVersion,
|
|
322
|
-
country_code: countryCode,
|
|
323
|
-
device_locale: locale,
|
|
324
|
-
time_zone: timeZone,
|
|
325
|
-
device_brand: deviceBrand,
|
|
326
|
-
device_model: deviceModel,
|
|
327
|
-
device_manufacturer: deviceManufacturer,
|
|
328
|
-
device_form_factor: deviceFormFactor,
|
|
329
|
-
screen_resolution: screenRes,
|
|
330
|
-
screen_density: screenDensity,
|
|
331
|
-
screen_orientation: screenOrientation,
|
|
332
|
-
font_scale: fontScale,
|
|
333
|
-
appearance_mode: appearanceMode,
|
|
334
|
-
is_expo: isExpo,
|
|
335
|
-
js_engine: jsEngine,
|
|
336
|
-
hermes_version: hermesVersion,
|
|
337
|
-
is_hermes: isHermes,
|
|
338
|
-
is_fabric: isFabric,
|
|
339
|
-
is_bridgeless: isBridgeless,
|
|
340
|
-
has_native_module: hasNativeModule,
|
|
341
|
-
has_mmkv: hasMmkv,
|
|
342
|
-
fab_mode: fabMode,
|
|
343
|
-
default_landing_tab: defaultLandingTab,
|
|
344
|
-
captured_crashes_count: capturedCrashesCount,
|
|
345
|
-
captured_apis_bracket: capturedApisBracket,
|
|
346
|
-
search_filter_used: _hasSearchFilterBeenUsed,
|
|
347
|
-
is_metro_connected: isMetroConnected,
|
|
348
|
-
is_dev: isDev,
|
|
349
|
-
is_emulator: isEmulator,
|
|
350
|
-
device_type: isEmulator ? 'emulator' : 'real_device',
|
|
351
|
-
app_mode: isDev ? 'local_mode' : 'bundled_application',
|
|
352
|
-
redux_attached: reduxAttached,
|
|
353
|
-
analytics_attached: analyticsAttached,
|
|
354
|
-
environment: environment || (isDev ? 'DEV' : 'PROD'),
|
|
355
|
-
engagement_time_msec: 1000,
|
|
356
|
-
};
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
export async function trackActiveTelemetryHeartbeat(
|
|
360
|
-
telemetryEnabled = true,
|
|
361
|
-
environment?: string,
|
|
362
|
-
): Promise<void> {
|
|
363
|
-
if (telemetryEnabled === false) {
|
|
364
|
-
isTelemetryEnabled = false;
|
|
365
|
-
return;
|
|
366
|
-
}
|
|
367
|
-
isTelemetryEnabled = true;
|
|
368
|
-
|
|
369
|
-
const url = getCollectUrl();
|
|
370
|
-
if (!url) return;
|
|
371
|
-
|
|
372
|
-
try {
|
|
373
|
-
const settings = await loadSettings();
|
|
374
|
-
const lastPing = settings.telemetryLastPing || 0;
|
|
375
|
-
const now = Date.now();
|
|
376
|
-
const isNewDevice = !settings.deviceRegistered;
|
|
377
|
-
|
|
378
|
-
// Send on first launch or if 24h passed since last ping
|
|
379
|
-
if (!isNewDevice && now - lastPing < PING_INTERVAL_MS) return;
|
|
380
|
-
|
|
381
|
-
const clientId = await getOrCreateClientId();
|
|
382
|
-
const params = getSystemMetadata(environment, settings);
|
|
383
|
-
|
|
384
|
-
const deviceParams = {
|
|
385
|
-
...params,
|
|
386
|
-
device_id: clientId,
|
|
387
|
-
is_new_device: isNewDevice,
|
|
388
|
-
device_first_seen: settings.deviceFirstSeen || now,
|
|
389
|
-
};
|
|
390
|
-
|
|
391
|
-
const eventsToDispatch = isNewDevice
|
|
392
|
-
? [
|
|
393
|
-
{name: 'active_device', params: deviceParams},
|
|
394
|
-
{name: 'first_device_install', params: deviceParams},
|
|
395
|
-
{name: 'inspector_active_heartbeat', params: deviceParams},
|
|
396
|
-
]
|
|
397
|
-
: [
|
|
398
|
-
{name: 'active_device', params: deviceParams},
|
|
399
|
-
{name: 'inspector_active_heartbeat', params: deviceParams},
|
|
400
|
-
];
|
|
401
|
-
|
|
402
|
-
await fetch(url, {
|
|
403
|
-
method: 'POST',
|
|
404
|
-
headers: {'Content-Type': 'application/json'},
|
|
405
|
-
body: JSON.stringify({
|
|
406
|
-
client_id: clientId,
|
|
407
|
-
user_id: clientId,
|
|
408
|
-
non_personalized_ads: true,
|
|
409
|
-
user_properties: {
|
|
410
|
-
device_id: { value: clientId },
|
|
411
|
-
pkg_name: { value: params.pkg_name },
|
|
412
|
-
pkg_version: { value: params.pkg_version },
|
|
413
|
-
install_type: { value: params.install_type },
|
|
414
|
-
app_name: { value: params.app_name },
|
|
415
|
-
bundle_id: { value: params.bundle_id },
|
|
416
|
-
app_version: { value: params.app_version },
|
|
417
|
-
react_version: { value: params.react_version },
|
|
418
|
-
country: { value: params.country_code },
|
|
419
|
-
country_code: { value: params.country_code },
|
|
420
|
-
locale: { value: params.device_locale },
|
|
421
|
-
time_zone: { value: params.time_zone },
|
|
422
|
-
device_brand: { value: params.device_brand },
|
|
423
|
-
device_model: { value: params.device_model },
|
|
424
|
-
device_form_factor: { value: params.device_form_factor },
|
|
425
|
-
screen_resolution: { value: params.screen_resolution },
|
|
426
|
-
appearance_mode: { value: params.appearance_mode },
|
|
427
|
-
is_expo: { value: String(params.is_expo) },
|
|
428
|
-
js_engine: { value: params.js_engine },
|
|
429
|
-
is_fabric: { value: String(params.is_fabric) },
|
|
430
|
-
is_bridgeless: { value: String(params.is_bridgeless) },
|
|
431
|
-
has_native_module: { value: String(params.has_native_module) },
|
|
432
|
-
has_mmkv: { value: String(params.has_mmkv) },
|
|
433
|
-
fab_mode: { value: params.fab_mode },
|
|
434
|
-
default_landing_tab: { value: params.default_landing_tab },
|
|
435
|
-
captured_crashes_count: { value: String(params.captured_crashes_count) },
|
|
436
|
-
captured_apis_bracket: { value: params.captured_apis_bracket },
|
|
437
|
-
search_filter_used: { value: String(params.search_filter_used) },
|
|
438
|
-
is_metro_connected: { value: String(params.is_metro_connected) },
|
|
439
|
-
redux_attached: { value: String(params.redux_attached) },
|
|
440
|
-
analytics_attached: { value: String(params.analytics_attached) },
|
|
441
|
-
platform: { value: params.platform },
|
|
442
|
-
rn_version: { value: params.rn_version },
|
|
443
|
-
lib_version: { value: params.lib_version },
|
|
444
|
-
},
|
|
445
|
-
events: eventsToDispatch,
|
|
446
|
-
}),
|
|
447
|
-
});
|
|
448
|
-
|
|
449
|
-
await saveSettings({
|
|
450
|
-
...settings,
|
|
451
|
-
telemetryClientId: clientId,
|
|
452
|
-
telemetryDeviceId: clientId,
|
|
453
|
-
deviceRegistered: true,
|
|
454
|
-
deviceFirstSeen: settings.deviceFirstSeen || now,
|
|
455
|
-
telemetryLastPing: now,
|
|
456
|
-
telemetryLastActive: now,
|
|
457
|
-
});
|
|
458
|
-
} catch {
|
|
459
|
-
// silent
|
|
460
|
-
}
|
|
461
|
-
}
|
|
462
|
-
|
|
463
|
-
export async function trackTelemetryEvent(
|
|
464
|
-
eventName: string,
|
|
465
|
-
eventParams?: Record<string, any>,
|
|
466
|
-
): Promise<void> {
|
|
467
|
-
if (!isTelemetryEnabled) return;
|
|
468
|
-
const url = getCollectUrl();
|
|
469
|
-
if (!url) return;
|
|
470
|
-
|
|
471
|
-
try {
|
|
472
|
-
const clientId = await getOrCreateClientId();
|
|
473
|
-
const settings = await loadSettings().catch(() => ({} as PersistedSettings));
|
|
474
|
-
const metadata = getSystemMetadata(undefined, settings);
|
|
475
|
-
|
|
476
|
-
const params = {
|
|
477
|
-
...metadata,
|
|
478
|
-
device_id: clientId,
|
|
479
|
-
...eventParams,
|
|
480
|
-
engagement_time_msec: 100,
|
|
481
|
-
};
|
|
482
|
-
|
|
483
|
-
await fetch(url, {
|
|
484
|
-
method: 'POST',
|
|
485
|
-
headers: {'Content-Type': 'application/json'},
|
|
486
|
-
body: JSON.stringify({
|
|
487
|
-
client_id: clientId,
|
|
488
|
-
user_id: clientId,
|
|
489
|
-
non_personalized_ads: true,
|
|
490
|
-
user_properties: {
|
|
491
|
-
device_id: { value: clientId },
|
|
492
|
-
pkg_name: { value: metadata.pkg_name },
|
|
493
|
-
pkg_version: { value: metadata.pkg_version },
|
|
494
|
-
install_type: { value: metadata.install_type },
|
|
495
|
-
app_name: { value: metadata.app_name },
|
|
496
|
-
bundle_id: { value: metadata.bundle_id },
|
|
497
|
-
app_version: { value: metadata.app_version },
|
|
498
|
-
react_version: { value: metadata.react_version },
|
|
499
|
-
country: { value: metadata.country_code },
|
|
500
|
-
country_code: { value: metadata.country_code },
|
|
501
|
-
locale: { value: metadata.device_locale },
|
|
502
|
-
time_zone: { value: metadata.time_zone },
|
|
503
|
-
device_brand: { value: metadata.device_brand },
|
|
504
|
-
device_model: { value: metadata.device_model },
|
|
505
|
-
device_form_factor: { value: metadata.device_form_factor },
|
|
506
|
-
screen_resolution: { value: metadata.screen_resolution },
|
|
507
|
-
appearance_mode: { value: metadata.appearance_mode },
|
|
508
|
-
is_expo: { value: String(metadata.is_expo) },
|
|
509
|
-
js_engine: { value: metadata.js_engine },
|
|
510
|
-
is_fabric: { value: String(metadata.is_fabric) },
|
|
511
|
-
is_bridgeless: { value: String(metadata.is_bridgeless) },
|
|
512
|
-
has_native_module: { value: String(metadata.has_native_module) },
|
|
513
|
-
has_mmkv: { value: String(metadata.has_mmkv) },
|
|
514
|
-
fab_mode: { value: metadata.fab_mode },
|
|
515
|
-
default_landing_tab: { value: metadata.default_landing_tab },
|
|
516
|
-
captured_crashes_count: { value: String(metadata.captured_crashes_count) },
|
|
517
|
-
captured_apis_bracket: { value: metadata.captured_apis_bracket },
|
|
518
|
-
search_filter_used: { value: String(metadata.search_filter_used) },
|
|
519
|
-
is_metro_connected: { value: String(metadata.is_metro_connected) },
|
|
520
|
-
redux_attached: { value: String(metadata.redux_attached) },
|
|
521
|
-
analytics_attached: { value: String(metadata.analytics_attached) },
|
|
522
|
-
platform: { value: metadata.platform },
|
|
523
|
-
rn_version: { value: metadata.rn_version },
|
|
524
|
-
lib_version: { value: metadata.lib_version },
|
|
525
|
-
},
|
|
526
|
-
events: [{ name: eventName, params }],
|
|
527
|
-
}),
|
|
528
|
-
});
|
|
529
|
-
} catch {
|
|
530
|
-
// silent
|
|
531
|
-
}
|
|
532
|
-
}
|
|
533
|
-
|
|
534
|
-
/**
|
|
535
|
-
* Tracks when a developer opens/switches tabs in the In-App Inspector (e.g. APIs, Logs, Redux, Performance, Storage, etc.)
|
|
536
|
-
*/
|
|
537
|
-
export function trackInspectorTabView(tabName: string): void {
|
|
538
|
-
trackTelemetryEvent('inspector_tab_view', {
|
|
539
|
-
tab_name: tabName,
|
|
540
|
-
screen_name: `tab_${tabName}`,
|
|
541
|
-
screen_class: 'NetworkInspector',
|
|
542
|
-
});
|
|
543
|
-
}
|
|
544
|
-
|
|
545
|
-
/**
|
|
546
|
-
* Tracks screen views within the In-App Inspector
|
|
547
|
-
*/
|
|
548
|
-
export function trackInspectorScreenView(screenName: string): void {
|
|
549
|
-
trackTelemetryEvent('screen_view', {
|
|
550
|
-
screen_name: screenName,
|
|
551
|
-
screen_class: 'NetworkInspector',
|
|
552
|
-
});
|
|
553
|
-
}
|
|
554
|
-
|
|
555
|
-
/**
|
|
556
|
-
* Tracks screen / performance recording events
|
|
557
|
-
*/
|
|
558
|
-
export function trackInspectorScreenRecord(
|
|
559
|
-
action: 'start' | 'stop' | 'toggle',
|
|
560
|
-
recordingType = 'screen',
|
|
561
|
-
): void {
|
|
562
|
-
trackTelemetryEvent('inspector_screen_record', {
|
|
563
|
-
action,
|
|
564
|
-
recording_type: recordingType,
|
|
565
|
-
});
|
|
566
|
-
}
|
|
567
|
-
|
|
568
|
-
|
package/src/helpers/toast.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
type ToastListener = (message: string) => void;
|
|
2
|
-
const listeners: Set<ToastListener> = new Set();
|
|
3
|
-
|
|
4
|
-
export const showToast = (message: string) => {
|
|
5
|
-
listeners.forEach(fn => {
|
|
6
|
-
try {
|
|
7
|
-
fn(message);
|
|
8
|
-
} catch {}
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export const subscribeToast = (listener: ToastListener) => {
|
|
13
|
-
listeners.add(listener);
|
|
14
|
-
return () => {
|
|
15
|
-
listeners.delete(listener);
|
|
16
|
-
};
|
|
17
|
-
};
|
package/src/i18n/index.ts
DELETED
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import enLocale from './locales/en.json';
|
|
3
|
-
|
|
4
|
-
type TranslationParams = Record<string, any>;
|
|
5
|
-
|
|
6
|
-
const localeRegistry: Record<string, Record<string, any>> = {
|
|
7
|
-
en: enLocale,
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
let currentLanguage = 'en';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Lightweight nested lookup for translation keys (e.g. "network.headers")
|
|
14
|
-
*/
|
|
15
|
-
function lookupKey(obj: any, path: string): any {
|
|
16
|
-
if (!obj || !path) return undefined;
|
|
17
|
-
const parts = path.split('.');
|
|
18
|
-
let current = obj;
|
|
19
|
-
for (let i = 0; i < parts.length; i++) {
|
|
20
|
-
if (current == null) return undefined;
|
|
21
|
-
current = current[parts[i]];
|
|
22
|
-
}
|
|
23
|
-
return current;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Interpolates {{key}} placeholders in string templates
|
|
28
|
-
*/
|
|
29
|
-
function interpolate(template: string, params?: TranslationParams): string {
|
|
30
|
-
if (!params || typeof template !== 'string') return template;
|
|
31
|
-
return template.replace(/\{\{\s*([a-zA-Z0-9_]+)\s*\}\}/g, (_, key) => {
|
|
32
|
-
return params[key] !== undefined ? String(params[key]) : `{{${key}}}`;
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Standalone zero-dependency translation function
|
|
38
|
-
*/
|
|
39
|
-
export function t(key: string, optionsOrFallback?: TranslationParams | string): string {
|
|
40
|
-
const activeBundle = localeRegistry[currentLanguage] || localeRegistry.en;
|
|
41
|
-
let raw = lookupKey(activeBundle, key);
|
|
42
|
-
if (raw === undefined && currentLanguage !== 'en') {
|
|
43
|
-
raw = lookupKey(localeRegistry.en, key);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
if (typeof raw === 'string') {
|
|
47
|
-
if (typeof optionsOrFallback === 'object' && optionsOrFallback !== null) {
|
|
48
|
-
return interpolate(raw, optionsOrFallback);
|
|
49
|
-
}
|
|
50
|
-
return raw;
|
|
51
|
-
}
|
|
52
|
-
if (typeof optionsOrFallback === 'string') {
|
|
53
|
-
return optionsOrFallback;
|
|
54
|
-
}
|
|
55
|
-
return key;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export function setLanguage(lang: string): void {
|
|
59
|
-
if (typeof lang === 'string' && lang.trim()) {
|
|
60
|
-
currentLanguage = lang.trim();
|
|
61
|
-
i18n.language = currentLanguage;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export function addTranslations(lang: string, translations: Record<string, any>): void {
|
|
66
|
-
if (!lang || !translations || typeof translations !== 'object') return;
|
|
67
|
-
localeRegistry[lang] = {
|
|
68
|
-
...(localeRegistry[lang] || {}),
|
|
69
|
-
...translations,
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
export function setTranslations(translations: Record<string, any>, lang: string = 'en'): void {
|
|
74
|
-
addTranslations(lang, translations);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
export const i18n = {
|
|
78
|
-
t,
|
|
79
|
-
language: currentLanguage,
|
|
80
|
-
changeLanguage: setLanguage,
|
|
81
|
-
addResourceBundle: (lng: string, _ns: string, resources: any) => addTranslations(lng, resources),
|
|
82
|
-
setLanguage,
|
|
83
|
-
addTranslations,
|
|
84
|
-
setTranslations,
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* React hook compatible with react-i18next useTranslation()
|
|
89
|
-
*/
|
|
90
|
-
export function useTranslation() {
|
|
91
|
-
return {
|
|
92
|
-
t,
|
|
93
|
-
i18n,
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* Backward-compatible I18nextProvider component
|
|
99
|
-
*/
|
|
100
|
-
export const I18nextProvider = ({children}: {children?: React.ReactNode; i18n?: any}): any => {
|
|
101
|
-
return React.createElement(React.Fragment, null, children);
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
export default i18n;
|