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
|
@@ -1,921 +1,8 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
|
-
};
|
|
16
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
|
-
};
|
|
19
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
exports.getRuntimeDiagnostics = exports.getCategoryColors = exports.registerGAPlugin = exports.getEventCategory = exports.getEventColor = exports.ANALYTICS_EVENT_PALETTE = exports.openInVSCode = exports.parseStackLine = exports.getJsonPreviewText = exports.getJsonContent = exports.formatGap = exports.formatTime = exports.formatTimeShort = exports.handleOpenExternalLink = exports.getAppVersionAndBuild = exports.getAppName = exports.getBundleIdentifier = exports.formatDateTimeToAnalytics = exports.isAllValuesEmpty = exports.getLocalizedFilePathWithSlash = exports.getLocalizedFilePath = exports.formatDisplayUrl = exports.getDiff = exports.flattenObject = exports.getLogPageName = exports.getNavigationInfo = exports.escapeRegex = exports.deduplicateLogs = exports.getFetchCommand = exports.getCurlCommand = exports.getBaseUrl = exports.getPath = exports.copyToClipboard = exports.formatBytes = exports.getSize = exports.getDurationColor = exports.getStatusColor = exports.formatTimestamp = exports.formatDateTime = exports.getDomainColor = exports.isLocalDebugEnvironment = void 0;
|
|
21
|
-
const react_native_1 = require("react-native");
|
|
22
|
-
const clipboard_1 = __importDefault(require("@react-native-clipboard/clipboard"));
|
|
23
|
-
const toast_1 = require("./toast");
|
|
24
|
-
const AppColors_1 = require("../styles/AppColors");
|
|
25
|
-
const constants_1 = require("../constants");
|
|
26
|
-
__exportStar(require("./searchQueryParser"), exports);
|
|
27
|
-
__exportStar(require("./memoryManager"), exports);
|
|
28
|
-
__exportStar(require("./toast"), exports);
|
|
29
|
-
const isLocalDebugEnvironment = () => {
|
|
30
|
-
const isDev = typeof __DEV__ !== 'undefined' && Boolean(__DEV__);
|
|
31
|
-
const scriptURL = react_native_1.NativeModules.SourceCode?.scriptURL || '';
|
|
32
|
-
const hasDevServer = scriptURL.startsWith('http://') ||
|
|
33
|
-
scriptURL.startsWith('https://') ||
|
|
34
|
-
scriptURL.includes(':8081') ||
|
|
35
|
-
scriptURL.includes(':8082');
|
|
36
|
-
return isDev || hasDevServer;
|
|
37
|
-
};
|
|
38
|
-
exports.isLocalDebugEnvironment = isLocalDebugEnvironment;
|
|
39
|
-
const getDomainColor = (domain) => {
|
|
40
|
-
if (!domain)
|
|
41
|
-
return constants_1.DOMAIN_COLORS[0];
|
|
42
|
-
let hash = 0;
|
|
43
|
-
for (let i = 0; i < domain.length; i++) {
|
|
44
|
-
hash = domain.charCodeAt(i) + ((hash << 5) - hash);
|
|
45
|
-
}
|
|
46
|
-
return constants_1.DOMAIN_COLORS[Math.abs(hash) % constants_1.DOMAIN_COLORS.length];
|
|
47
|
-
};
|
|
48
|
-
exports.getDomainColor = getDomainColor;
|
|
49
|
-
const formatDateTime = (timestamp) => {
|
|
50
|
-
const date = new Date(timestamp);
|
|
51
|
-
const pad = (n, len = 2) => String(n).padStart(len, '0');
|
|
52
|
-
const day = pad(date.getDate());
|
|
53
|
-
const month = pad(date.getMonth() + 1);
|
|
54
|
-
const year = date.getFullYear();
|
|
55
|
-
const hours = pad(date.getHours());
|
|
56
|
-
const minutes = pad(date.getMinutes());
|
|
57
|
-
const seconds = pad(date.getSeconds());
|
|
58
|
-
return `${day}/${month}/${year} ${hours}:${minutes}:${seconds}`;
|
|
59
|
-
};
|
|
60
|
-
exports.formatDateTime = formatDateTime;
|
|
61
|
-
const formatTimestamp = (timestamp) => {
|
|
62
|
-
try {
|
|
63
|
-
const date = new Date(timestamp);
|
|
64
|
-
const hours = date.getHours().toString().padStart(2, '0');
|
|
65
|
-
const minutes = date.getMinutes().toString().padStart(2, '0');
|
|
66
|
-
const seconds = date.getSeconds().toString().padStart(2, '0');
|
|
67
|
-
const ms = date.getMilliseconds().toString().padStart(3, '0');
|
|
68
|
-
return `${hours}:${minutes}:${seconds}.${ms}`;
|
|
69
|
-
}
|
|
70
|
-
catch {
|
|
71
|
-
return '—';
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
exports.formatTimestamp = formatTimestamp;
|
|
75
|
-
const getStatusColor = (status) => {
|
|
76
|
-
if (!status || status === 0)
|
|
77
|
-
return AppColors_1.AppColors.errorColor;
|
|
78
|
-
if (status >= 500)
|
|
79
|
-
return AppColors_1.AppColors.errorColor;
|
|
80
|
-
if (status >= 400)
|
|
81
|
-
return AppColors_1.AppColors.darkOrange;
|
|
82
|
-
if (status >= 300)
|
|
83
|
-
return AppColors_1.AppColors.warningIconGold;
|
|
84
|
-
return AppColors_1.AppColors.greenColor;
|
|
85
|
-
};
|
|
86
|
-
exports.getStatusColor = getStatusColor;
|
|
87
|
-
const getDurationColor = (duration) => {
|
|
88
|
-
if (duration == null)
|
|
89
|
-
return AppColors_1.AppColors.grayTextWeak;
|
|
90
|
-
if (duration < constants_1.DURATION_FAST_MS)
|
|
91
|
-
return AppColors_1.AppColors.greenColor;
|
|
92
|
-
if (duration < constants_1.DURATION_SLOW_MS)
|
|
93
|
-
return AppColors_1.AppColors.lightOrange;
|
|
94
|
-
return AppColors_1.AppColors.errorColor;
|
|
95
|
-
};
|
|
96
|
-
exports.getDurationColor = getDurationColor;
|
|
97
|
-
const getSize = (data) => {
|
|
98
|
-
try {
|
|
99
|
-
const bytes = JSON.stringify(data)?.length ?? 0;
|
|
100
|
-
return bytes < 1024 ? `${bytes} B` : `${(bytes / 1024).toFixed(1)} KB`;
|
|
101
|
-
}
|
|
102
|
-
catch {
|
|
103
|
-
return '—';
|
|
104
|
-
}
|
|
105
|
-
};
|
|
106
|
-
exports.getSize = getSize;
|
|
107
|
-
const formatBytes = (bytes) => {
|
|
108
|
-
if (bytes === 0 || !bytes || isNaN(bytes))
|
|
109
|
-
return '0 B';
|
|
110
|
-
const k = 1024;
|
|
111
|
-
const sizes = ['B', 'KB', 'MB', 'GB'];
|
|
112
|
-
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
113
|
-
return `${parseFloat((bytes / Math.pow(k, i)).toFixed(1))} ${sizes[i] || 'B'}`;
|
|
114
|
-
};
|
|
115
|
-
exports.formatBytes = formatBytes;
|
|
116
|
-
const copyToClipboard = (value, label) => {
|
|
117
|
-
const resolved = typeof value === 'function' ? value() : value;
|
|
118
|
-
let textToCopy = '';
|
|
119
|
-
if (typeof resolved === 'string') {
|
|
120
|
-
textToCopy = resolved;
|
|
121
|
-
}
|
|
122
|
-
else {
|
|
123
|
-
try {
|
|
124
|
-
textToCopy = JSON.stringify(resolved, null, 2);
|
|
125
|
-
}
|
|
126
|
-
catch {
|
|
127
|
-
textToCopy = String(resolved);
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
try {
|
|
131
|
-
if (typeof clipboard_1.default?.setString === 'function') {
|
|
132
|
-
clipboard_1.default.setString(textToCopy);
|
|
133
|
-
}
|
|
134
|
-
else if (typeof clipboard_1.default?.default?.setString === 'function') {
|
|
135
|
-
clipboard_1.default.default.setString(textToCopy);
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
catch (err) {
|
|
139
|
-
if (__DEV__) {
|
|
140
|
-
console.warn('[NetworkInspector] Clipboard.setString failed:', err);
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
try {
|
|
144
|
-
(0, toast_1.showToast)(label ? `${label} copied to clipboard` : 'Copied to clipboard');
|
|
145
|
-
}
|
|
146
|
-
catch { }
|
|
147
|
-
try {
|
|
148
|
-
if (react_native_1.Platform.OS === 'android' && react_native_1.ToastAndroid?.show) {
|
|
149
|
-
react_native_1.ToastAndroid.show(label ? `${label} copied to clipboard` : 'Copied to clipboard', react_native_1.ToastAndroid.SHORT);
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
catch { }
|
|
153
|
-
};
|
|
154
|
-
exports.copyToClipboard = copyToClipboard;
|
|
155
|
-
const getPath = (url) => {
|
|
156
|
-
try {
|
|
157
|
-
const u = new URL(url);
|
|
158
|
-
return u.pathname + (u.search ? u.search : '');
|
|
159
|
-
}
|
|
160
|
-
catch {
|
|
161
|
-
const withoutDomain = url.replace(/^https?:\/\/[^/?#]+/, '');
|
|
162
|
-
return withoutDomain || '/';
|
|
163
|
-
}
|
|
164
|
-
};
|
|
165
|
-
exports.getPath = getPath;
|
|
166
|
-
const getBaseUrl = (url) => {
|
|
167
|
-
try {
|
|
168
|
-
const u = new URL(url);
|
|
169
|
-
return `${u.protocol}//${u.host}`;
|
|
170
|
-
}
|
|
171
|
-
catch {
|
|
172
|
-
const match = url.match(/^(https?:\/\/[^/]+)/);
|
|
173
|
-
return match ? match[1] : '';
|
|
174
|
-
}
|
|
175
|
-
};
|
|
176
|
-
exports.getBaseUrl = getBaseUrl;
|
|
177
|
-
const getCurlCommand = (log) => {
|
|
178
|
-
let cmd = `curl -X ${log.method} "${log.url}"`;
|
|
179
|
-
if (log.requestHeaders) {
|
|
180
|
-
Object.entries(log.requestHeaders).forEach(([k, v]) => {
|
|
181
|
-
cmd += ` \\\n -H "${k}: ${v}"`;
|
|
182
|
-
});
|
|
183
|
-
}
|
|
184
|
-
if (log.request && log.method !== 'GET') {
|
|
185
|
-
const body = typeof log.request === 'string'
|
|
186
|
-
? log.request
|
|
187
|
-
: JSON.stringify(log.request);
|
|
188
|
-
cmd += ` \\\n -d '${body.replace(/'/g, "'\\''")}'`;
|
|
189
|
-
}
|
|
190
|
-
return cmd;
|
|
191
|
-
};
|
|
192
|
-
exports.getCurlCommand = getCurlCommand;
|
|
193
|
-
const getFetchCommand = (log) => {
|
|
194
|
-
const opts = { method: log.method };
|
|
195
|
-
if (log.requestHeaders && Object.keys(log.requestHeaders).length > 0) {
|
|
196
|
-
opts.headers = log.requestHeaders;
|
|
197
|
-
}
|
|
198
|
-
if (log.request && log.method !== 'GET') {
|
|
199
|
-
opts.body = JSON.stringify(log.request);
|
|
200
|
-
}
|
|
201
|
-
return `fetch("${log.url}", ${JSON.stringify(opts, null, 2)})`;
|
|
202
|
-
};
|
|
203
|
-
exports.getFetchCommand = getFetchCommand;
|
|
204
|
-
const deduplicateLogs = (raw) => {
|
|
205
|
-
const map = new Map();
|
|
206
|
-
raw.forEach(entry => {
|
|
207
|
-
if (!map.has(entry.id)) {
|
|
208
|
-
map.set(entry.id, entry);
|
|
209
|
-
}
|
|
210
|
-
else {
|
|
211
|
-
const existing = map.get(entry.id);
|
|
212
|
-
if (existing.status == null && entry.status != null) {
|
|
213
|
-
map.set(entry.id, entry);
|
|
214
|
-
}
|
|
215
|
-
else if ((entry.startTime ?? 0) >= (existing.startTime ?? 0)) {
|
|
216
|
-
map.set(entry.id, entry);
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
});
|
|
220
|
-
return Array.from(map.values()).sort((a, b) => b.id - a.id);
|
|
221
|
-
};
|
|
222
|
-
exports.deduplicateLogs = deduplicateLogs;
|
|
223
|
-
const escapeRegex = (str) => {
|
|
224
|
-
return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
225
|
-
};
|
|
226
|
-
exports.escapeRegex = escapeRegex;
|
|
227
|
-
const getNavigationInfo = (state, path = []) => {
|
|
228
|
-
if (!state) {
|
|
229
|
-
return {
|
|
230
|
-
path: path.length > 0 ? path.join(' ➔ ') : '',
|
|
231
|
-
params: null,
|
|
232
|
-
};
|
|
233
|
-
}
|
|
234
|
-
if (state.name && !state.routes) {
|
|
235
|
-
const fullPath = path.length > 0 ? [...path, state.name].join(' ➔ ') : state.name;
|
|
236
|
-
return { path: fullPath, params: state.params || null };
|
|
237
|
-
}
|
|
238
|
-
if (!state.routes ||
|
|
239
|
-
!Array.isArray(state.routes) ||
|
|
240
|
-
state.routes.length === 0) {
|
|
241
|
-
return {
|
|
242
|
-
path: path.length > 0 ? path.join(' ➔ ') : '',
|
|
243
|
-
params: null,
|
|
244
|
-
};
|
|
245
|
-
}
|
|
246
|
-
const index = typeof state.index === 'number' &&
|
|
247
|
-
state.index >= 0 &&
|
|
248
|
-
state.index < state.routes.length
|
|
249
|
-
? state.index
|
|
250
|
-
: 0;
|
|
251
|
-
const route = state.routes[index];
|
|
252
|
-
if (!route) {
|
|
253
|
-
return {
|
|
254
|
-
path: path.length > 0 ? path.join(' ➔ ') : '',
|
|
255
|
-
params: null,
|
|
256
|
-
};
|
|
257
|
-
}
|
|
258
|
-
const currentPath = route.name ? [...path, route.name] : path;
|
|
259
|
-
if (route?.state) {
|
|
260
|
-
return (0, exports.getNavigationInfo)(route.state, currentPath);
|
|
261
|
-
}
|
|
262
|
-
const resolved = currentPath.length > 0 ? currentPath.join(' ➔ ') : route.name || '';
|
|
263
|
-
return { path: resolved, params: route.params || null };
|
|
264
|
-
};
|
|
265
|
-
exports.getNavigationInfo = getNavigationInfo;
|
|
266
|
-
const getLogPageName = (log, routeInfo) => {
|
|
267
|
-
const effectiveRoute = routeInfo || log?.routeInfo;
|
|
268
|
-
if (effectiveRoute &&
|
|
269
|
-
effectiveRoute.path &&
|
|
270
|
-
effectiveRoute.path !== 'Navigators') {
|
|
271
|
-
const parts = effectiveRoute.path
|
|
272
|
-
.split(' ➔ ')
|
|
273
|
-
.map((s) => s.trim())
|
|
274
|
-
.filter(Boolean);
|
|
275
|
-
if (parts.length > 0) {
|
|
276
|
-
return parts[parts.length - 1];
|
|
277
|
-
}
|
|
278
|
-
return effectiveRoute.path;
|
|
279
|
-
}
|
|
280
|
-
if (log.caller && log.caller !== 'Unknown') {
|
|
281
|
-
try {
|
|
282
|
-
const match = log.caller.match(/([^/\\]+)\.(tsx|jsx|ts|js)/i);
|
|
283
|
-
if (match && match[1]) {
|
|
284
|
-
const file = match[1];
|
|
285
|
-
const ignored = [
|
|
286
|
-
'networklogger',
|
|
287
|
-
'fetch',
|
|
288
|
-
'axios',
|
|
289
|
-
'apiclient',
|
|
290
|
-
'request',
|
|
291
|
-
'http',
|
|
292
|
-
'index',
|
|
293
|
-
'nativeinspector',
|
|
294
|
-
'inappinspector',
|
|
295
|
-
'bundleanalyzer',
|
|
296
|
-
];
|
|
297
|
-
if (!ignored.includes(file.toLowerCase())) {
|
|
298
|
-
return file;
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
catch (e) { }
|
|
303
|
-
}
|
|
304
|
-
if (log.url) {
|
|
305
|
-
try {
|
|
306
|
-
const cleanUrl = log.url.split('?')[0].split('#')[0];
|
|
307
|
-
const withoutProto = cleanUrl.replace(/^https?:\/\//i, '');
|
|
308
|
-
const slashIdx = withoutProto.indexOf('/');
|
|
309
|
-
if (slashIdx !== -1) {
|
|
310
|
-
const pathSegments = withoutProto
|
|
311
|
-
.substring(slashIdx + 1)
|
|
312
|
-
.split('/')
|
|
313
|
-
.filter(Boolean);
|
|
314
|
-
const ignoredSegments = [
|
|
315
|
-
'api',
|
|
316
|
-
'v1',
|
|
317
|
-
'v2',
|
|
318
|
-
'v3',
|
|
319
|
-
'v4',
|
|
320
|
-
'rest',
|
|
321
|
-
'graphql',
|
|
322
|
-
'json',
|
|
323
|
-
'data',
|
|
324
|
-
'service',
|
|
325
|
-
'app',
|
|
326
|
-
];
|
|
327
|
-
const meaningful = pathSegments.filter(s => !ignoredSegments.includes(s.toLowerCase()));
|
|
328
|
-
if (meaningful.length > 0) {
|
|
329
|
-
const seg = meaningful[0];
|
|
330
|
-
return seg.charAt(0).toUpperCase() + seg.slice(1);
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
const host = withoutProto.split('/')[0];
|
|
334
|
-
if (host)
|
|
335
|
-
return host;
|
|
336
|
-
}
|
|
337
|
-
catch (e) { }
|
|
338
|
-
}
|
|
339
|
-
return 'General';
|
|
340
|
-
};
|
|
341
|
-
exports.getLogPageName = getLogPageName;
|
|
342
|
-
const flattenObject = (obj, prefix = '') => {
|
|
343
|
-
let result = {};
|
|
344
|
-
if (typeof obj === 'object' && obj !== null) {
|
|
345
|
-
if (Array.isArray(obj)) {
|
|
346
|
-
obj.forEach((v, i) => {
|
|
347
|
-
Object.assign(result, (0, exports.flattenObject)(v, prefix ? `${prefix}[${i}]` : `[${i}]`));
|
|
348
|
-
});
|
|
349
|
-
}
|
|
350
|
-
else {
|
|
351
|
-
Object.keys(obj).forEach(k => {
|
|
352
|
-
Object.assign(result, (0, exports.flattenObject)(obj[k], prefix ? `${prefix}.${k}` : k));
|
|
353
|
-
});
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
else {
|
|
357
|
-
result[prefix || 'root'] = obj;
|
|
358
|
-
}
|
|
359
|
-
return result;
|
|
360
|
-
};
|
|
361
|
-
exports.flattenObject = flattenObject;
|
|
362
|
-
const getDiff = (oldObj, newObj) => {
|
|
363
|
-
const oldFlat = (0, exports.flattenObject)(oldObj);
|
|
364
|
-
const newFlat = (0, exports.flattenObject)(newObj);
|
|
365
|
-
const diff = [];
|
|
366
|
-
const allKeys = new Set([...Object.keys(oldFlat), ...Object.keys(newFlat)]);
|
|
367
|
-
allKeys.forEach(k => {
|
|
368
|
-
if (!(k in oldFlat)) {
|
|
369
|
-
diff.push({ type: 'added', path: k, newVal: newFlat[k] });
|
|
370
|
-
}
|
|
371
|
-
else if (!(k in newFlat)) {
|
|
372
|
-
diff.push({ type: 'removed', path: k, oldVal: oldFlat[k] });
|
|
373
|
-
}
|
|
374
|
-
else if (oldFlat[k] !== newFlat[k]) {
|
|
375
|
-
diff.push({
|
|
376
|
-
type: 'changed',
|
|
377
|
-
path: k,
|
|
378
|
-
oldVal: oldFlat[k],
|
|
379
|
-
newVal: newFlat[k],
|
|
380
|
-
});
|
|
381
|
-
}
|
|
382
|
-
});
|
|
383
|
-
return diff.sort((a, b) => a.path.localeCompare(b.path));
|
|
384
|
-
};
|
|
385
|
-
exports.getDiff = getDiff;
|
|
386
|
-
const formatDisplayUrl = (url) => {
|
|
387
|
-
if (!url)
|
|
388
|
-
return '';
|
|
389
|
-
if (url.startsWith('http://') || url.startsWith('https://'))
|
|
390
|
-
return url;
|
|
391
|
-
return `https://${url}`;
|
|
392
|
-
};
|
|
393
|
-
exports.formatDisplayUrl = formatDisplayUrl;
|
|
394
|
-
const getLocalizedFilePath = (path, country, language) => {
|
|
395
|
-
const url = path.replace('country-language', `${country?.toLowerCase()}-${language?.toLowerCase()}`);
|
|
396
|
-
return url;
|
|
397
|
-
};
|
|
398
|
-
exports.getLocalizedFilePath = getLocalizedFilePath;
|
|
399
|
-
const getLocalizedFilePathWithSlash = (path, country, language) => {
|
|
400
|
-
const url = path.replace('country/language', `${country?.toLowerCase()}/${language?.toLowerCase()}`);
|
|
401
|
-
return url;
|
|
402
|
-
};
|
|
403
|
-
exports.getLocalizedFilePathWithSlash = getLocalizedFilePathWithSlash;
|
|
404
|
-
const isAllValuesEmpty = (obj) => {
|
|
405
|
-
if (!obj || typeof obj !== 'object')
|
|
406
|
-
return true;
|
|
407
|
-
return Object.values(obj).every(value => value &&
|
|
408
|
-
typeof value === 'object' &&
|
|
409
|
-
!Array.isArray(value) &&
|
|
410
|
-
Object.keys(value).length === 0);
|
|
411
|
-
};
|
|
412
|
-
exports.isAllValuesEmpty = isAllValuesEmpty;
|
|
413
|
-
const formatDateTimeToAnalytics = (ts) => {
|
|
414
|
-
const d = new Date(ts);
|
|
415
|
-
return d?.toLocaleString(undefined, {
|
|
416
|
-
month: 'short',
|
|
417
|
-
day: 'numeric',
|
|
418
|
-
hour: '2-digit',
|
|
419
|
-
minute: '2-digit',
|
|
420
|
-
second: '2-digit',
|
|
421
|
-
});
|
|
422
|
-
};
|
|
423
|
-
exports.formatDateTimeToAnalytics = formatDateTimeToAnalytics;
|
|
424
|
-
const getBundleIdentifier = () => {
|
|
425
|
-
const RNDeviceInfo = react_native_1.NativeModules.RNDeviceInfo;
|
|
426
|
-
if (RNDeviceInfo && typeof RNDeviceInfo.bundleId === 'string') {
|
|
427
|
-
return RNDeviceInfo.bundleId;
|
|
428
|
-
}
|
|
429
|
-
if (RNDeviceInfo && typeof RNDeviceInfo.getBundleId === 'function') {
|
|
430
|
-
try {
|
|
431
|
-
const res = RNDeviceInfo.getBundleId();
|
|
432
|
-
if (typeof res === 'string')
|
|
433
|
-
return res;
|
|
434
|
-
}
|
|
435
|
-
catch (e) { }
|
|
436
|
-
}
|
|
437
|
-
const ExponentConstants = react_native_1.NativeModules.ExponentConstants;
|
|
438
|
-
if (ExponentConstants && ExponentConstants.manifest) {
|
|
439
|
-
const manifest = ExponentConstants.manifest;
|
|
440
|
-
if (manifest.ios && manifest.ios.bundleIdentifier) {
|
|
441
|
-
return manifest.ios.bundleIdentifier;
|
|
442
|
-
}
|
|
443
|
-
if (manifest.android && manifest.android.package) {
|
|
444
|
-
return manifest.android.package;
|
|
445
|
-
}
|
|
446
|
-
}
|
|
447
|
-
const ExpoApplication = react_native_1.NativeModules.ExpoApplication;
|
|
448
|
-
if (ExpoApplication && typeof ExpoApplication.applicationId === 'string') {
|
|
449
|
-
return ExpoApplication.applicationId;
|
|
450
|
-
}
|
|
451
|
-
const SourceCode = react_native_1.NativeModules.SourceCode;
|
|
452
|
-
if (SourceCode && typeof SourceCode.scriptURL === 'string') {
|
|
453
|
-
const url = SourceCode.scriptURL;
|
|
454
|
-
if (url.includes('assets/')) {
|
|
455
|
-
try {
|
|
456
|
-
const match = url.match(/assets\/([^/?#]+)/);
|
|
457
|
-
if (match && match[1]) {
|
|
458
|
-
return match[1];
|
|
459
|
-
}
|
|
460
|
-
}
|
|
461
|
-
catch (e) { }
|
|
462
|
-
}
|
|
463
|
-
}
|
|
464
|
-
return 'org.reactjs.native.example';
|
|
465
|
-
};
|
|
466
|
-
exports.getBundleIdentifier = getBundleIdentifier;
|
|
467
|
-
const getAppName = () => {
|
|
468
|
-
const constants = react_native_1.NativeModules.PlatformConstants;
|
|
469
|
-
if (constants && typeof constants.interfaceIdiom === 'string') {
|
|
470
|
-
}
|
|
471
|
-
const RNDeviceInfo = react_native_1.NativeModules.RNDeviceInfo;
|
|
472
|
-
if (RNDeviceInfo && typeof RNDeviceInfo.appName === 'string') {
|
|
473
|
-
return RNDeviceInfo.appName;
|
|
474
|
-
}
|
|
475
|
-
const ExpoApplication = react_native_1.NativeModules.ExpoApplication;
|
|
476
|
-
if (ExpoApplication && typeof ExpoApplication.applicationName === 'string') {
|
|
477
|
-
return ExpoApplication.applicationName;
|
|
478
|
-
}
|
|
479
|
-
const ExponentConstants = react_native_1.NativeModules.ExponentConstants;
|
|
480
|
-
if (ExponentConstants && ExponentConstants.manifest) {
|
|
481
|
-
const manifest = ExponentConstants.manifest;
|
|
482
|
-
if (manifest.name)
|
|
483
|
-
return manifest.name;
|
|
484
|
-
}
|
|
485
|
-
const AppInfo = react_native_1.NativeModules.AppInfo;
|
|
486
|
-
if (AppInfo && typeof AppInfo.appName === 'string') {
|
|
487
|
-
return AppInfo.appName;
|
|
488
|
-
}
|
|
489
|
-
const bundleId = (0, exports.getBundleIdentifier)();
|
|
490
|
-
if (bundleId && bundleId !== 'org.reactjs.native.example') {
|
|
491
|
-
const parts = bundleId.split('.');
|
|
492
|
-
const last = parts[parts.length - 1];
|
|
493
|
-
return last ? last.charAt(0).toUpperCase() + last.slice(1) : 'App';
|
|
494
|
-
}
|
|
495
|
-
return 'App';
|
|
496
|
-
};
|
|
497
|
-
exports.getAppName = getAppName;
|
|
498
|
-
const getAppVersionAndBuild = () => {
|
|
499
|
-
let version = '';
|
|
500
|
-
let build = '';
|
|
501
|
-
const ExpoApplication = react_native_1.NativeModules.ExpoApplication;
|
|
502
|
-
if (ExpoApplication) {
|
|
503
|
-
if (typeof ExpoApplication.nativeAppVersion === 'string') {
|
|
504
|
-
version = ExpoApplication.nativeAppVersion;
|
|
505
|
-
}
|
|
506
|
-
if (typeof ExpoApplication.nativeBuildVersion === 'string') {
|
|
507
|
-
build = ExpoApplication.nativeBuildVersion;
|
|
508
|
-
}
|
|
509
|
-
}
|
|
510
|
-
const ExponentConstants = react_native_1.NativeModules.ExponentConstants;
|
|
511
|
-
if (ExponentConstants) {
|
|
512
|
-
const manifest = ExponentConstants.manifest || ExponentConstants.expoConfig;
|
|
513
|
-
if (manifest) {
|
|
514
|
-
if (!version && manifest.version) {
|
|
515
|
-
version = String(manifest.version);
|
|
516
|
-
}
|
|
517
|
-
if (!build) {
|
|
518
|
-
if (manifest.ios?.buildNumber) {
|
|
519
|
-
build = String(manifest.ios.buildNumber);
|
|
520
|
-
}
|
|
521
|
-
else if (manifest.android?.versionCode) {
|
|
522
|
-
build = String(manifest.android.versionCode);
|
|
523
|
-
}
|
|
524
|
-
}
|
|
525
|
-
}
|
|
526
|
-
}
|
|
527
|
-
const RNDeviceInfo = react_native_1.NativeModules.RNDeviceInfo;
|
|
528
|
-
if (RNDeviceInfo) {
|
|
529
|
-
if (!version) {
|
|
530
|
-
if (typeof RNDeviceInfo.appVersion === 'string') {
|
|
531
|
-
version = RNDeviceInfo.appVersion;
|
|
532
|
-
}
|
|
533
|
-
else if (typeof RNDeviceInfo.getVersion === 'function') {
|
|
534
|
-
try {
|
|
535
|
-
version = RNDeviceInfo.getVersion();
|
|
536
|
-
}
|
|
537
|
-
catch (e) { }
|
|
538
|
-
}
|
|
539
|
-
}
|
|
540
|
-
if (!build) {
|
|
541
|
-
if (typeof RNDeviceInfo.buildNumber === 'string') {
|
|
542
|
-
build = RNDeviceInfo.buildNumber;
|
|
543
|
-
}
|
|
544
|
-
else if (typeof RNDeviceInfo.getBuildNumber === 'function') {
|
|
545
|
-
try {
|
|
546
|
-
build = RNDeviceInfo.getBuildNumber();
|
|
547
|
-
}
|
|
548
|
-
catch (e) { }
|
|
549
|
-
}
|
|
550
|
-
}
|
|
551
|
-
}
|
|
552
|
-
const constants = react_native_1.Platform.constants || react_native_1.NativeModules.PlatformConstants;
|
|
553
|
-
if (constants) {
|
|
554
|
-
if (!version &&
|
|
555
|
-
constants.Version &&
|
|
556
|
-
typeof constants.Version === 'string' &&
|
|
557
|
-
constants.Version.includes('.')) {
|
|
558
|
-
version = constants.Version;
|
|
559
|
-
}
|
|
560
|
-
if (!version && constants.reactNativeVersion) {
|
|
561
|
-
const rnv = constants.reactNativeVersion;
|
|
562
|
-
if (rnv.major !== undefined) {
|
|
563
|
-
version = `${rnv.major}.${rnv.minor}.${rnv.patch}`;
|
|
564
|
-
}
|
|
565
|
-
}
|
|
566
|
-
}
|
|
567
|
-
const AppInfo = react_native_1.NativeModules.AppInfo;
|
|
568
|
-
if (AppInfo) {
|
|
569
|
-
if (!version && typeof AppInfo.versionName === 'string') {
|
|
570
|
-
version = AppInfo.versionName;
|
|
571
|
-
}
|
|
572
|
-
if (!build && typeof AppInfo.versionCode === 'string') {
|
|
573
|
-
build = AppInfo.versionCode;
|
|
574
|
-
}
|
|
575
|
-
}
|
|
576
|
-
if (!version)
|
|
577
|
-
version = '1.0.0';
|
|
578
|
-
if (!build)
|
|
579
|
-
build = '1';
|
|
580
|
-
return {
|
|
581
|
-
version,
|
|
582
|
-
build,
|
|
583
|
-
formatted: `${version} (${build})`,
|
|
584
|
-
};
|
|
585
|
-
};
|
|
586
|
-
exports.getAppVersionAndBuild = getAppVersionAndBuild;
|
|
587
|
-
const handleOpenExternalLink = (url) => {
|
|
588
|
-
if (!url)
|
|
589
|
-
return;
|
|
590
|
-
const openUrl = (0, exports.formatDisplayUrl)(url);
|
|
591
|
-
react_native_1.Alert.alert('Open Link', `Do you want to open this link in your web browser?\n\n${openUrl}`, [
|
|
592
|
-
{ text: 'Cancel', style: 'cancel' },
|
|
593
|
-
{
|
|
594
|
-
text: 'Open',
|
|
595
|
-
onPress: () => {
|
|
596
|
-
react_native_1.Linking.openURL(openUrl).catch(() => { });
|
|
597
|
-
},
|
|
598
|
-
},
|
|
599
|
-
]);
|
|
600
|
-
};
|
|
601
|
-
exports.handleOpenExternalLink = handleOpenExternalLink;
|
|
602
|
-
const formatTimeShort = (ts) => {
|
|
603
|
-
const d = new Date(ts);
|
|
604
|
-
const hh = String(d.getHours()).padStart(2, '0');
|
|
605
|
-
const mm = String(d.getMinutes()).padStart(2, '0');
|
|
606
|
-
const ss = String(d.getSeconds()).padStart(2, '0');
|
|
607
|
-
return `${hh}:${mm}:${ss}`;
|
|
608
|
-
};
|
|
609
|
-
exports.formatTimeShort = formatTimeShort;
|
|
610
|
-
const formatTime = (ts) => {
|
|
611
|
-
const d = new Date(ts);
|
|
612
|
-
const hh = String(d.getHours()).padStart(2, '0');
|
|
613
|
-
const mm = String(d.getMinutes()).padStart(2, '0');
|
|
614
|
-
const ss = String(d.getSeconds()).padStart(2, '0');
|
|
615
|
-
const ms = String(d.getMilliseconds()).padStart(3, '0');
|
|
616
|
-
return `${hh}:${mm}:${ss}.${ms}`;
|
|
617
|
-
};
|
|
618
|
-
exports.formatTime = formatTime;
|
|
619
|
-
const formatGap = (ms) => {
|
|
620
|
-
if (ms < 1000)
|
|
621
|
-
return `+${ms}ms`;
|
|
622
|
-
const s = Math.round(ms / 1000);
|
|
623
|
-
if (s < 60)
|
|
624
|
-
return `+${s}s`;
|
|
625
|
-
const m = Math.floor(s / 60);
|
|
626
|
-
const rem = s % 60;
|
|
627
|
-
return rem > 0 ? `+${m}m ${rem}s` : `+${m}m`;
|
|
628
|
-
};
|
|
629
|
-
exports.formatGap = formatGap;
|
|
630
|
-
const getJsonContent = (message) => {
|
|
631
|
-
if (!message)
|
|
632
|
-
return null;
|
|
633
|
-
const indices = [];
|
|
634
|
-
for (let i = 0; i < message.length; i++) {
|
|
635
|
-
if (message[i] === '{' || message[i] === '[') {
|
|
636
|
-
indices.push(i);
|
|
637
|
-
}
|
|
638
|
-
}
|
|
639
|
-
for (const index of indices) {
|
|
640
|
-
const candidate = message.substring(index).trim();
|
|
641
|
-
try {
|
|
642
|
-
const parsed = JSON.parse(candidate);
|
|
643
|
-
if (parsed !== null && typeof parsed === 'object') {
|
|
644
|
-
const header = message.substring(0, index).trim();
|
|
645
|
-
return { header, data: parsed };
|
|
646
|
-
}
|
|
647
|
-
}
|
|
648
|
-
catch (e) {
|
|
649
|
-
}
|
|
650
|
-
}
|
|
651
|
-
return null;
|
|
652
|
-
};
|
|
653
|
-
exports.getJsonContent = getJsonContent;
|
|
654
|
-
const getJsonPreviewText = (data, maxLines = 4) => {
|
|
655
|
-
try {
|
|
656
|
-
const formatted = JSON.stringify(data, null, 2);
|
|
657
|
-
const lines = formatted.split('\n');
|
|
658
|
-
if (lines.length > maxLines) {
|
|
659
|
-
return {
|
|
660
|
-
text: lines.slice(0, maxLines).join('\n') + '\n...',
|
|
661
|
-
hasMore: true,
|
|
662
|
-
};
|
|
663
|
-
}
|
|
664
|
-
return {
|
|
665
|
-
text: formatted,
|
|
666
|
-
hasMore: false,
|
|
667
|
-
};
|
|
668
|
-
}
|
|
669
|
-
catch (e) {
|
|
670
|
-
return {
|
|
671
|
-
text: String(data),
|
|
672
|
-
hasMore: false,
|
|
673
|
-
};
|
|
674
|
-
}
|
|
675
|
-
};
|
|
676
|
-
exports.getJsonPreviewText = getJsonPreviewText;
|
|
677
|
-
const parseStackLine = (rawLine, isOrigin = false) => {
|
|
678
|
-
let line = rawLine.trim().replace(/^at /, '');
|
|
679
|
-
if (line.includes('@')) {
|
|
680
|
-
const atIndex = line.indexOf('@');
|
|
681
|
-
const funcPart = line.substring(0, atIndex).trim();
|
|
682
|
-
const pathPart = line.substring(atIndex + 1).trim();
|
|
683
|
-
line = funcPart ? `${funcPart} (${pathPart})` : pathPart;
|
|
684
|
-
}
|
|
685
|
-
const parenMatch = line.match(/^(.*?)\s*\((.*?)\)$/);
|
|
686
|
-
let functionName = '<anonymous>';
|
|
687
|
-
let locationPart = line;
|
|
688
|
-
if (parenMatch) {
|
|
689
|
-
functionName = parenMatch[1].trim() || '<anonymous>';
|
|
690
|
-
locationPart = parenMatch[2].trim();
|
|
691
|
-
}
|
|
692
|
-
if (functionName.startsWith('?anon_') || functionName === '?') {
|
|
693
|
-
functionName = 'anonymous';
|
|
694
|
-
}
|
|
695
|
-
locationPart = locationPart.replace(/^address at /, '');
|
|
696
|
-
const locMatch = locationPart.match(/^(.*?):(\d+):(\d+)$/);
|
|
697
|
-
let fullPath = locationPart;
|
|
698
|
-
let lineNumber;
|
|
699
|
-
let columnNumber;
|
|
700
|
-
if (locMatch) {
|
|
701
|
-
fullPath = locMatch[1];
|
|
702
|
-
lineNumber = locMatch[2];
|
|
703
|
-
columnNumber = locMatch[3];
|
|
704
|
-
}
|
|
705
|
-
let cleanPath = fullPath
|
|
706
|
-
.split('?')[0]
|
|
707
|
-
.split('&')[0]
|
|
708
|
-
.replace(/[)]+$/, '')
|
|
709
|
-
.replace(/\/\/+$/, '');
|
|
710
|
-
cleanPath = cleanPath.replace(/^(?:https?:\/\/[^\/]+\/|file:\/\/\/|webpack:\/\/\/?)/, '');
|
|
711
|
-
const fileName = cleanPath.split('/').filter(Boolean).pop() || cleanPath;
|
|
712
|
-
const extMatch = fileName.match(/\.([a-z0-9]+)$/i);
|
|
713
|
-
const ext = extMatch ? extMatch[1].toLowerCase() : '';
|
|
714
|
-
const fileExt = ext === 'tsx' || ext === 'jsx' || ext === 'ts' || ext === 'js'
|
|
715
|
-
? ext
|
|
716
|
-
: 'other';
|
|
717
|
-
const isNative = locationPart === 'native' || cleanPath === 'native';
|
|
718
|
-
const isInternalBytecode = cleanPath.includes('InternalBytecode') ||
|
|
719
|
-
cleanPath.includes('metro-runtime') ||
|
|
720
|
-
cleanPath.includes('regenerator-runtime') ||
|
|
721
|
-
functionName === 'tryCallOne' ||
|
|
722
|
-
functionName === 'asyncGeneratorStep' ||
|
|
723
|
-
functionName === '_next' ||
|
|
724
|
-
(functionName === 'next' && isNative);
|
|
725
|
-
const isDependency = cleanPath.includes('node_modules') ||
|
|
726
|
-
cleanPath.includes('react-native/Libraries') ||
|
|
727
|
-
(cleanPath.includes('react-native-inapp-inspector') &&
|
|
728
|
-
!cleanPath.includes('/example/'));
|
|
729
|
-
const isUserCode = !isNative &&
|
|
730
|
-
!isInternalBytecode &&
|
|
731
|
-
!isDependency &&
|
|
732
|
-
(fileExt === 'tsx' ||
|
|
733
|
-
fileExt === 'jsx' ||
|
|
734
|
-
fileExt === 'ts' ||
|
|
735
|
-
fileExt === 'js' ||
|
|
736
|
-
!fileName.includes('.bundle'));
|
|
737
|
-
const frameType = isUserCode
|
|
738
|
-
? 'app'
|
|
739
|
-
: isDependency
|
|
740
|
-
? 'dependency'
|
|
741
|
-
: isNative
|
|
742
|
-
? 'native'
|
|
743
|
-
: 'runtime';
|
|
744
|
-
const isRuntimeNoise = isInternalBytecode ||
|
|
745
|
-
isNative ||
|
|
746
|
-
functionName === 'asyncGeneratorStep' ||
|
|
747
|
-
functionName === '_next';
|
|
748
|
-
let relativePath = cleanPath;
|
|
749
|
-
if (relativePath.includes('/example/')) {
|
|
750
|
-
relativePath = relativePath.substring(relativePath.indexOf('/example/') + 9);
|
|
751
|
-
}
|
|
752
|
-
else if (relativePath.includes('/src/')) {
|
|
753
|
-
relativePath = relativePath.substring(relativePath.indexOf('/src/') + 1);
|
|
754
|
-
}
|
|
755
|
-
else if (relativePath.includes('/node_modules/')) {
|
|
756
|
-
relativePath = relativePath.substring(relativePath.indexOf('/node_modules/') + 14);
|
|
757
|
-
}
|
|
758
|
-
const copyableLocation = lineNumber
|
|
759
|
-
? `${fileName}:${lineNumber}${columnNumber ? `:${columnNumber}` : ''}`
|
|
760
|
-
: fileName;
|
|
761
|
-
return {
|
|
762
|
-
raw: rawLine,
|
|
763
|
-
functionName,
|
|
764
|
-
fileName,
|
|
765
|
-
fullPath: relativePath,
|
|
766
|
-
rawFilePath: fullPath,
|
|
767
|
-
fileExt,
|
|
768
|
-
frameType,
|
|
769
|
-
isUserCode,
|
|
770
|
-
isRuntimeNoise,
|
|
771
|
-
lineNumber,
|
|
772
|
-
columnNumber,
|
|
773
|
-
isOrigin,
|
|
774
|
-
copyableLocation,
|
|
775
|
-
};
|
|
776
|
-
};
|
|
777
|
-
exports.parseStackLine = parseStackLine;
|
|
778
|
-
const openInVSCode = (filePath, lineNumber, columnNumber) => {
|
|
779
|
-
const numLine = lineNumber ? Number(lineNumber) : 1;
|
|
780
|
-
const numCol = columnNumber ? Number(columnNumber) : 1;
|
|
781
|
-
const line = lineNumber ? `:${lineNumber}` : '';
|
|
782
|
-
const col = columnNumber ? `:${columnNumber}` : '';
|
|
783
|
-
const cleanPath = filePath.replace(/^file:\/\//, '');
|
|
784
|
-
let extractedOrigin = null;
|
|
785
|
-
try {
|
|
786
|
-
const scriptURL = react_native_1.NativeModules?.SourceCode?.scriptURL ||
|
|
787
|
-
react_native_1.NativeModules?.PlatformConstants?.serverHost ||
|
|
788
|
-
react_native_1.NativeModules?.DevSettings?.serverHost;
|
|
789
|
-
if (typeof scriptURL === 'string' && scriptURL.length > 0) {
|
|
790
|
-
const match = scriptURL.match(/^(https?:\/\/[^/]+)/);
|
|
791
|
-
if (match) {
|
|
792
|
-
extractedOrigin = match[1];
|
|
793
|
-
}
|
|
794
|
-
else if (!scriptURL.startsWith('http') && scriptURL.includes(':')) {
|
|
795
|
-
extractedOrigin = `http://${scriptURL}`;
|
|
796
|
-
}
|
|
797
|
-
}
|
|
798
|
-
}
|
|
799
|
-
catch { }
|
|
800
|
-
const metroHosts = Array.from(new Set([
|
|
801
|
-
...(extractedOrigin ? [extractedOrigin] : []),
|
|
802
|
-
'http://localhost:8081',
|
|
803
|
-
'http://127.0.0.1:8081',
|
|
804
|
-
'http://10.0.2.2:8081',
|
|
805
|
-
]));
|
|
806
|
-
metroHosts.forEach(host => {
|
|
807
|
-
try {
|
|
808
|
-
fetch(`${host}/open-stack-frame`, {
|
|
809
|
-
method: 'POST',
|
|
810
|
-
headers: { 'Content-Type': 'application/json' },
|
|
811
|
-
body: JSON.stringify({
|
|
812
|
-
file: cleanPath,
|
|
813
|
-
lineNumber: numLine,
|
|
814
|
-
column: numCol,
|
|
815
|
-
}),
|
|
816
|
-
}).catch(() => { });
|
|
817
|
-
}
|
|
818
|
-
catch { }
|
|
819
|
-
});
|
|
820
|
-
const vscodeUrl = `vscode://file/${cleanPath.replace(/^\/+/, '')}${line}${col}`;
|
|
821
|
-
const cursorUrl = `cursor://file/${cleanPath.replace(/^\/+/, '')}${line}${col}`;
|
|
822
|
-
const vscodeInsidersUrl = `vscode-insiders://file/${cleanPath.replace(/^\/+/, '')}${line}${col}`;
|
|
823
|
-
react_native_1.Linking.openURL(vscodeUrl).catch(() => {
|
|
824
|
-
react_native_1.Linking.openURL(cursorUrl).catch(() => {
|
|
825
|
-
react_native_1.Linking.openURL(vscodeInsidersUrl).catch(() => {
|
|
826
|
-
(0, exports.copyToClipboard)(`${cleanPath}${line}${col}`, 'Location');
|
|
827
|
-
});
|
|
828
|
-
});
|
|
829
|
-
});
|
|
830
|
-
};
|
|
831
|
-
exports.openInVSCode = openInVSCode;
|
|
832
|
-
exports.ANALYTICS_EVENT_PALETTE = [
|
|
833
|
-
AppColors_1.AppColors.googleBlue,
|
|
834
|
-
AppColors_1.AppColors.googleGreen,
|
|
835
|
-
AppColors_1.AppColors.googlePurple,
|
|
836
|
-
AppColors_1.AppColors.googleTeal,
|
|
837
|
-
AppColors_1.AppColors.googleRed,
|
|
838
|
-
AppColors_1.AppColors.googleOrange,
|
|
839
|
-
AppColors_1.AppColors.blue700,
|
|
840
|
-
AppColors_1.AppColors.materialGreen,
|
|
841
|
-
];
|
|
842
|
-
const getEventColor = (name) => {
|
|
843
|
-
const safeName = typeof name === 'string' ? name : String(name || '');
|
|
844
|
-
let hash = 0;
|
|
845
|
-
for (let i = 0; i < safeName.length; i++) {
|
|
846
|
-
hash = (hash * 31 + safeName.charCodeAt(i)) | 0;
|
|
847
|
-
}
|
|
848
|
-
return exports.ANALYTICS_EVENT_PALETTE[Math.abs(hash) % exports.ANALYTICS_EVENT_PALETTE.length];
|
|
849
|
-
};
|
|
850
|
-
exports.getEventColor = getEventColor;
|
|
851
|
-
var gaAnalyticsRegistry_1 = require("./gaAnalyticsRegistry");
|
|
852
|
-
Object.defineProperty(exports, "getEventCategory", { enumerable: true, get: function () { return gaAnalyticsRegistry_1.getEventCategory; } });
|
|
853
|
-
Object.defineProperty(exports, "registerGAPlugin", { enumerable: true, get: function () { return gaAnalyticsRegistry_1.registerGAPlugin; } });
|
|
854
|
-
const getCategoryColors = (category) => {
|
|
855
|
-
switch (category) {
|
|
856
|
-
case 'page_view':
|
|
857
|
-
case 'Page View':
|
|
858
|
-
return {
|
|
859
|
-
bg: AppColors_1.AppColors.blueBg,
|
|
860
|
-
border: AppColors_1.AppColors.blueBorder,
|
|
861
|
-
text: AppColors_1.AppColors.blue800,
|
|
862
|
-
};
|
|
863
|
-
case 'ecommerce':
|
|
864
|
-
case 'Ecommerce':
|
|
865
|
-
return {
|
|
866
|
-
bg: AppColors_1.AppColors.greenBg,
|
|
867
|
-
border: AppColors_1.AppColors.greenBorder,
|
|
868
|
-
text: AppColors_1.AppColors.materialGreen,
|
|
869
|
-
};
|
|
870
|
-
case 'system':
|
|
871
|
-
case 'System':
|
|
872
|
-
return {
|
|
873
|
-
bg: AppColors_1.AppColors.greyBg,
|
|
874
|
-
border: AppColors_1.AppColors.greyBorder,
|
|
875
|
-
text: AppColors_1.AppColors.grey600,
|
|
876
|
-
};
|
|
877
|
-
default:
|
|
878
|
-
return {
|
|
879
|
-
bg: AppColors_1.AppColors.purpleBg,
|
|
880
|
-
border: AppColors_1.AppColors.purpleBorder,
|
|
881
|
-
text: AppColors_1.AppColors.purpleText,
|
|
882
|
-
};
|
|
883
|
-
}
|
|
884
|
-
};
|
|
885
|
-
exports.getCategoryColors = getCategoryColors;
|
|
886
|
-
const getRuntimeDiagnostics = () => {
|
|
887
|
-
const isHermes = typeof global.HermesInternal !== 'undefined';
|
|
888
|
-
const isV8 = typeof global._v8runtime !== 'undefined';
|
|
889
|
-
const engineType = isHermes
|
|
890
|
-
? 'hermes'
|
|
891
|
-
: isV8
|
|
892
|
-
? 'v8'
|
|
893
|
-
: 'jsc';
|
|
894
|
-
const isFabric = typeof global.nativeFabricUIManager !== 'undefined' ||
|
|
895
|
-
Boolean(global.__turboModuleProxy);
|
|
896
|
-
const archType = isFabric ? 'fabric' : 'paper';
|
|
897
|
-
let usedHeapMb = 32.4;
|
|
898
|
-
let totalAllocMb = 64.0;
|
|
899
|
-
try {
|
|
900
|
-
const hermesStats = global.HermesInternal?.getInstrumentedStats?.();
|
|
901
|
-
if (hermesStats?.js_heap_size) {
|
|
902
|
-
usedHeapMb = Number((hermesStats.js_heap_size / (1024 * 1024)).toFixed(1));
|
|
903
|
-
totalAllocMb = Number(((hermesStats.js_allocated_bytes || hermesStats.js_heap_size * 1.6) /
|
|
904
|
-
(1024 * 1024)).toFixed(1));
|
|
905
|
-
}
|
|
906
|
-
else if (global.performance?.memory?.usedJSHeapSize) {
|
|
907
|
-
usedHeapMb = Number((global.performance.memory.usedJSHeapSize /
|
|
908
|
-
(1024 * 1024)).toFixed(1));
|
|
909
|
-
totalAllocMb = Number((global.performance.memory.totalJSHeapSize /
|
|
910
|
-
(1024 * 1024)).toFixed(1));
|
|
911
|
-
}
|
|
912
|
-
}
|
|
913
|
-
catch { }
|
|
914
|
-
return {
|
|
915
|
-
engineType,
|
|
916
|
-
archType,
|
|
917
|
-
usedHeapMb,
|
|
918
|
-
totalAllocMb,
|
|
919
|
-
};
|
|
920
|
-
};
|
|
921
|
-
exports.getRuntimeDiagnostics = getRuntimeDiagnostics;
|
|
1
|
+
"use strict";var __createBinding=this&&this.__createBinding||(Object.create?(function(e,t,o,r){r===void 0&&(r=o);var n=Object.getOwnPropertyDescriptor(t,o);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[o]}}),Object.defineProperty(e,r,n)}):(function(e,t,o,r){r===void 0&&(r=o),e[r]=t[o]})),__exportStar=this&&this.__exportStar||function(e,t){for(var o in e)o!=="default"&&!Object.prototype.hasOwnProperty.call(t,o)&&__createBinding(t,e,o)},__importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.getRuntimeDiagnostics=exports.getCategoryColors=exports.registerGAPlugin=exports.getEventCategory=exports.getEventColor=exports.ANALYTICS_EVENT_PALETTE=exports.openInVSCode=exports.parseStackLine=exports.getJsonPreviewText=exports.getJsonContent=exports.formatGap=exports.formatTime=exports.formatTimeShort=exports.handleOpenExternalLink=exports.getAppVersionAndBuild=exports.getAppName=exports.getBundleIdentifier=exports.formatDateTimeToAnalytics=exports.isAllValuesEmpty=exports.getLocalizedFilePathWithSlash=exports.getLocalizedFilePath=exports.formatDisplayUrl=exports.getDiff=exports.flattenObject=exports.getLogPageName=exports.getNavigationInfo=exports.escapeRegex=exports.deduplicateLogs=exports.getFetchCommand=exports.getCurlCommand=exports.getBaseUrl=exports.getPath=exports.copyImageOrMediaToClipboard=exports.copyToClipboard=exports.formatBytes=exports.getSize=exports.getDurationColor=exports.getStatusColor=exports.formatTimestamp=exports.formatDateTime=exports.getDomainColor=exports.isLocalDebugEnvironment=void 0;const react_native_1=require("react-native"),clipboard_1=__importDefault(require("@react-native-clipboard/clipboard")),toast_1=require("./toast"),NativeInspector_1=require("../native/NativeInspector"),AppColors_1=require("../styles/AppColors"),constants_1=require("../constants");__exportStar(require("./searchQueryParser"),exports),__exportStar(require("./memoryManager"),exports),__exportStar(require("./toast"),exports);const isLocalDebugEnvironment=()=>{const e=typeof __DEV__<"u"&&!!__DEV__,t=react_native_1.NativeModules.SourceCode?.scriptURL||"",o=t.startsWith("http://")||t.startsWith("https://")||t.includes(":8081")||t.includes(":8082");return e||o};exports.isLocalDebugEnvironment=isLocalDebugEnvironment;const getDomainColor=e=>{if(!e)return constants_1.DOMAIN_COLORS[0];let t=0;for(let o=0;o<e.length;o++)t=e.charCodeAt(o)+((t<<5)-t);return constants_1.DOMAIN_COLORS[Math.abs(t)%constants_1.DOMAIN_COLORS.length]};exports.getDomainColor=getDomainColor;const formatDateTime=e=>{const t=new Date(e),o=(d,c=2)=>String(d).padStart(c,"0"),r=o(t.getDate()),n=o(t.getMonth()+1),s=t.getFullYear(),i=o(t.getHours()),a=o(t.getMinutes()),l=o(t.getSeconds());return`${r}/${n}/${s} ${i}:${a}:${l}`};exports.formatDateTime=formatDateTime;const formatTimestamp=e=>{try{const t=new Date(e),o=t.getHours().toString().padStart(2,"0"),r=t.getMinutes().toString().padStart(2,"0"),n=t.getSeconds().toString().padStart(2,"0"),s=t.getMilliseconds().toString().padStart(3,"0");return`${o}:${r}:${n}.${s}`}catch{return"\u2014"}};exports.formatTimestamp=formatTimestamp;const getStatusColor=e=>!e||e===0||e>=500?AppColors_1.AppColors.errorColor:e>=400?AppColors_1.AppColors.darkOrange:e>=300?AppColors_1.AppColors.warningIconGold:AppColors_1.AppColors.greenColor;exports.getStatusColor=getStatusColor;const getDurationColor=e=>e==null?AppColors_1.AppColors.grayTextWeak:e<constants_1.DURATION_FAST_MS?AppColors_1.AppColors.greenColor:e<constants_1.DURATION_SLOW_MS?AppColors_1.AppColors.lightOrange:AppColors_1.AppColors.errorColor;exports.getDurationColor=getDurationColor;const getSize=e=>{try{const t=JSON.stringify(e)?.length??0;return t<1024?`${t} B`:`${(t/1024).toFixed(1)} KB`}catch{return"\u2014"}};exports.getSize=getSize;const formatBytes=e=>{if(e===0||!e||isNaN(e))return"0 B";const t=1024,o=["B","KB","MB","GB"],r=Math.floor(Math.log(e)/Math.log(t));return`${parseFloat((e/Math.pow(t,r)).toFixed(1))} ${o[r]||"B"}`};exports.formatBytes=formatBytes;const copyToClipboard=(e,t)=>{const o=typeof e=="function"?e():e;let r="";if(typeof o=="string")r=o;else try{r=JSON.stringify(o,null,2)}catch{r=String(o)}try{typeof clipboard_1.default?.setString=="function"?clipboard_1.default.setString(r):typeof clipboard_1.default?.default?.setString=="function"&&clipboard_1.default.default.setString(r)}catch(n){__DEV__&&console.warn("[NetworkInspector] Clipboard.setString failed:",n)}try{(0,toast_1.showToast)(t?`${t} copied to clipboard`:"Copied to clipboard")}catch{}try{react_native_1.Platform.OS==="android"&&react_native_1.ToastAndroid?.show&&react_native_1.ToastAndroid.show(t?`${t} copied to clipboard`:"Copied to clipboard",react_native_1.ToastAndroid.SHORT)}catch{}};exports.copyToClipboard=copyToClipboard;const copyImageOrMediaToClipboard=async(e,t="Image")=>{if(!e)return;let o=!1;try{o=await(0,NativeInspector_1.copyMediaToClipboard)(e)}catch{o=!1}if(!o){(0,exports.copyToClipboard)(e,t);return}try{(0,toast_1.showToast)(`${t} copied to clipboard`)}catch{}try{react_native_1.Platform.OS==="android"&&react_native_1.ToastAndroid?.show&&react_native_1.ToastAndroid.show(`${t} copied to clipboard`,react_native_1.ToastAndroid.SHORT)}catch{}};exports.copyImageOrMediaToClipboard=copyImageOrMediaToClipboard;const getPath=e=>{try{const t=new URL(e);return t.pathname+(t.search?t.search:"")}catch{return e.replace(/^https?:\/\/[^/?#]+/,"")||"/"}};exports.getPath=getPath;const getBaseUrl=e=>{try{const t=new URL(e);return`${t.protocol}//${t.host}`}catch{const t=e.match(/^(https?:\/\/[^/]+)/);return t?t[1]:""}};exports.getBaseUrl=getBaseUrl;const getCurlCommand=e=>{let t=`curl -X ${e.method} "${e.url}"`;if(e.requestHeaders&&Object.entries(e.requestHeaders).forEach(([o,r])=>{t+=` \\
|
|
2
|
+
-H "${o}: ${r}"`}),e.request&&e.method!=="GET"){const o=typeof e.request=="string"?e.request:JSON.stringify(e.request);t+=` \\
|
|
3
|
+
-d '${o.replace(/'/g,"'\\''")}'`}return t};exports.getCurlCommand=getCurlCommand;const getFetchCommand=e=>{const t={method:e.method};return e.requestHeaders&&Object.keys(e.requestHeaders).length>0&&(t.headers=e.requestHeaders),e.request&&e.method!=="GET"&&(t.body=JSON.stringify(e.request)),`fetch("${e.url}", ${JSON.stringify(t,null,2)})`};exports.getFetchCommand=getFetchCommand;const deduplicateLogs=e=>{const t=new Map;return e.forEach(o=>{if(!t.has(o.id))t.set(o.id,o);else{const r=t.get(o.id);(r.status==null&&o.status!=null||(o.startTime??0)>=(r.startTime??0))&&t.set(o.id,o)}}),Array.from(t.values()).sort((o,r)=>r.id-o.id)};exports.deduplicateLogs=deduplicateLogs;const escapeRegex=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");exports.escapeRegex=escapeRegex;const getNavigationInfo=(e,t=[])=>{if(!e)return{path:t.length>0?t.join(" \u2794 "):"",params:null};if(e.name&&!e.routes)return{path:t.length>0?[...t,e.name].join(" \u2794 "):e.name,params:e.params||null};if(!e.routes||!Array.isArray(e.routes)||e.routes.length===0)return{path:t.length>0?t.join(" \u2794 "):"",params:null};const o=typeof e.index=="number"&&e.index>=0&&e.index<e.routes.length?e.index:0,r=e.routes[o];if(!r)return{path:t.length>0?t.join(" \u2794 "):"",params:null};const n=r.name?[...t,r.name]:t;return r?.state?(0,exports.getNavigationInfo)(r.state,n):{path:n.length>0?n.join(" \u2794 "):r.name||"",params:r.params||null}};exports.getNavigationInfo=getNavigationInfo;const getLogPageName=(e,t)=>{const o=t||e?.routeInfo;if(o&&o.path&&o.path!=="Navigators"){const r=o.path.split(" \u2794 ").map(n=>n.trim()).filter(Boolean);return r.length>0?r[r.length-1]:o.path}if(e.caller&&e.caller!=="Unknown")try{const r=e.caller.match(/([^/\\]+)\.(tsx|jsx|ts|js)/i);if(r&&r[1]){const n=r[1];if(!["networklogger","fetch","axios","apiclient","request","http","index","nativeinspector","inappinspector","bundleanalyzer"].includes(n.toLowerCase()))return n}}catch{}if(e.url)try{const n=e.url.split("?")[0].split("#")[0].replace(/^https?:\/\//i,""),s=n.indexOf("/");if(s!==-1){const a=n.substring(s+1).split("/").filter(Boolean),l=["api","v1","v2","v3","v4","rest","graphql","json","data","service","app"],d=a.filter(c=>!l.includes(c.toLowerCase()));if(d.length>0){const c=d[0];return c.charAt(0).toUpperCase()+c.slice(1)}}const i=n.split("/")[0];if(i)return i}catch{}return"General"};exports.getLogPageName=getLogPageName;const flattenObject=(e,t="")=>{let o={};return typeof e=="object"&&e!==null?Array.isArray(e)?e.forEach((r,n)=>{Object.assign(o,(0,exports.flattenObject)(r,t?`${t}[${n}]`:`[${n}]`))}):Object.keys(e).forEach(r=>{Object.assign(o,(0,exports.flattenObject)(e[r],t?`${t}.${r}`:r))}):o[t||"root"]=e,o};exports.flattenObject=flattenObject;const getDiff=(e,t)=>{const o=(0,exports.flattenObject)(e),r=(0,exports.flattenObject)(t),n=[];return new Set([...Object.keys(o),...Object.keys(r)]).forEach(i=>{i in o?i in r?o[i]!==r[i]&&n.push({type:"changed",path:i,oldVal:o[i],newVal:r[i]}):n.push({type:"removed",path:i,oldVal:o[i]}):n.push({type:"added",path:i,newVal:r[i]})}),n.sort((i,a)=>i.path.localeCompare(a.path))};exports.getDiff=getDiff;const formatDisplayUrl=e=>e?e.startsWith("http://")||e.startsWith("https://")?e:`https://${e}`:"";exports.formatDisplayUrl=formatDisplayUrl;const getLocalizedFilePath=(e,t,o)=>e.replace("country-language",`${t?.toLowerCase()}-${o?.toLowerCase()}`);exports.getLocalizedFilePath=getLocalizedFilePath;const getLocalizedFilePathWithSlash=(e,t,o)=>e.replace("country/language",`${t?.toLowerCase()}/${o?.toLowerCase()}`);exports.getLocalizedFilePathWithSlash=getLocalizedFilePathWithSlash;const isAllValuesEmpty=e=>!e||typeof e!="object"?!0:Object.values(e).every(t=>t&&typeof t=="object"&&!Array.isArray(t)&&Object.keys(t).length===0);exports.isAllValuesEmpty=isAllValuesEmpty;const formatDateTimeToAnalytics=e=>new Date(e)?.toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"});exports.formatDateTimeToAnalytics=formatDateTimeToAnalytics;const getBundleIdentifier=()=>{const e=react_native_1.NativeModules.RNDeviceInfo;if(e&&typeof e.bundleId=="string")return e.bundleId;if(e&&typeof e.getBundleId=="function")try{const n=e.getBundleId();if(typeof n=="string")return n}catch{}const t=react_native_1.NativeModules.ExponentConstants;if(t&&t.manifest){const n=t.manifest;if(n.ios&&n.ios.bundleIdentifier)return n.ios.bundleIdentifier;if(n.android&&n.android.package)return n.android.package}const o=react_native_1.NativeModules.ExpoApplication;if(o&&typeof o.applicationId=="string")return o.applicationId;const r=react_native_1.NativeModules.SourceCode;if(r&&typeof r.scriptURL=="string"){const n=r.scriptURL;if(n.includes("assets/"))try{const s=n.match(/assets\/([^/?#]+)/);if(s&&s[1])return s[1]}catch{}}return"org.reactjs.native.example"};exports.getBundleIdentifier=getBundleIdentifier;const getAppName=()=>{const e=react_native_1.NativeModules.PlatformConstants;e&&e.interfaceIdiom;const t=react_native_1.NativeModules.RNDeviceInfo;if(t&&typeof t.appName=="string")return t.appName;const o=react_native_1.NativeModules.ExpoApplication;if(o&&typeof o.applicationName=="string")return o.applicationName;const r=react_native_1.NativeModules.ExponentConstants;if(r&&r.manifest){const i=r.manifest;if(i.name)return i.name}const n=react_native_1.NativeModules.AppInfo;if(n&&typeof n.appName=="string")return n.appName;const s=(0,exports.getBundleIdentifier)();if(s&&s!=="org.reactjs.native.example"){const i=s.split("."),a=i[i.length-1];return a?a.charAt(0).toUpperCase()+a.slice(1):"App"}return"App"};exports.getAppName=getAppName;const getAppVersionAndBuild=()=>{let e="",t="";const o=react_native_1.NativeModules.ExpoApplication;o&&(typeof o.nativeAppVersion=="string"&&(e=o.nativeAppVersion),typeof o.nativeBuildVersion=="string"&&(t=o.nativeBuildVersion));const r=react_native_1.NativeModules.ExponentConstants;if(r){const a=r.manifest||r.expoConfig;a&&(!e&&a.version&&(e=String(a.version)),t||(a.ios?.buildNumber?t=String(a.ios.buildNumber):a.android?.versionCode&&(t=String(a.android.versionCode))))}const n=react_native_1.NativeModules.RNDeviceInfo;if(n){if(!e){if(typeof n.appVersion=="string")e=n.appVersion;else if(typeof n.getVersion=="function")try{e=n.getVersion()}catch{}}if(!t){if(typeof n.buildNumber=="string")t=n.buildNumber;else if(typeof n.getBuildNumber=="function")try{t=n.getBuildNumber()}catch{}}}const s=react_native_1.Platform.constants||react_native_1.NativeModules.PlatformConstants;if(s&&(!e&&s.Version&&typeof s.Version=="string"&&s.Version.includes(".")&&(e=s.Version),!e&&s.reactNativeVersion)){const a=s.reactNativeVersion;a.major!==void 0&&(e=`${a.major}.${a.minor}.${a.patch}`)}const i=react_native_1.NativeModules.AppInfo;return i&&(!e&&typeof i.versionName=="string"&&(e=i.versionName),!t&&typeof i.versionCode=="string"&&(t=i.versionCode)),e||(e="1.0.0"),t||(t="1"),{version:e,build:t,formatted:`${e} (${t})`}};exports.getAppVersionAndBuild=getAppVersionAndBuild;const handleOpenExternalLink=e=>{if(!e)return;const t=(0,exports.formatDisplayUrl)(e);react_native_1.Alert.alert("Open Link",`Do you want to open this link in your web browser?
|
|
4
|
+
|
|
5
|
+
${t}`,[{text:"Cancel",style:"cancel"},{text:"Open",onPress:()=>{react_native_1.Linking.openURL(t).catch(()=>{})}}])};exports.handleOpenExternalLink=handleOpenExternalLink;const formatTimeShort=e=>{const t=new Date(e),o=String(t.getHours()).padStart(2,"0"),r=String(t.getMinutes()).padStart(2,"0"),n=String(t.getSeconds()).padStart(2,"0");return`${o}:${r}:${n}`};exports.formatTimeShort=formatTimeShort;const formatTime=e=>{const t=new Date(e),o=String(t.getHours()).padStart(2,"0"),r=String(t.getMinutes()).padStart(2,"0"),n=String(t.getSeconds()).padStart(2,"0"),s=String(t.getMilliseconds()).padStart(3,"0");return`${o}:${r}:${n}.${s}`};exports.formatTime=formatTime;const formatGap=e=>{if(e<1e3)return`+${e}ms`;const t=Math.round(e/1e3);if(t<60)return`+${t}s`;const o=Math.floor(t/60),r=t%60;return r>0?`+${o}m ${r}s`:`+${o}m`};exports.formatGap=formatGap;const getJsonContent=e=>{if(!e)return null;const t=[];for(let o=0;o<e.length;o++)(e[o]==="{"||e[o]==="[")&&t.push(o);for(const o of t){const r=e.substring(o).trim();try{const n=JSON.parse(r);if(n!==null&&typeof n=="object")return{header:e.substring(0,o).trim(),data:n}}catch{}}return null};exports.getJsonContent=getJsonContent;const getJsonPreviewText=(e,t=4)=>{try{const o=JSON.stringify(e,null,2),r=o.split(`
|
|
6
|
+
`);return r.length>t?{text:r.slice(0,t).join(`
|
|
7
|
+
`)+`
|
|
8
|
+
...`,hasMore:!0}:{text:o,hasMore:!1}}catch{return{text:String(e),hasMore:!1}}};exports.getJsonPreviewText=getJsonPreviewText;const parseStackLine=(e,t=!1)=>{let o=e.trim().replace(/^at /,"");if(o.includes("@")){const b=o.indexOf("@"),S=o.substring(0,b).trim(),v=o.substring(b+1).trim();o=S?`${S} (${v})`:v}const r=o.match(/^(.*?)\s*\((.*?)\)$/);let n="<anonymous>",s=o;r&&(n=r[1].trim()||"<anonymous>",s=r[2].trim()),(n.startsWith("?anon_")||n==="?")&&(n="anonymous"),s=s.replace(/^address at /,"");const i=s.match(/^(.*?):(\d+):(\d+)$/);let a=s,l,d;i&&(a=i[1],l=i[2],d=i[3]);let c=a.split("?")[0].split("&")[0].replace(/[)]+$/,"").replace(/\/\/+$/,"");c=c.replace(/^(?:https?:\/\/[^\/]+\/|file:\/\/\/|webpack:\/\/\/?)/,"");const g=c.split("/").filter(Boolean).pop()||c,m=g.match(/\.([a-z0-9]+)$/i),p=m?m[1].toLowerCase():"",f=p==="tsx"||p==="jsx"||p==="ts"||p==="js"?p:"other",h=s==="native"||c==="native",x=c.includes("InternalBytecode")||c.includes("metro-runtime")||c.includes("regenerator-runtime")||n==="tryCallOne"||n==="asyncGeneratorStep"||n==="_next"||n==="next"&&h,y=c.includes("node_modules")||c.includes("react-native/Libraries")||c.includes("react-native-inapp-inspector")&&!c.includes("/example/"),C=!h&&!x&&!y&&(f==="tsx"||f==="jsx"||f==="ts"||f==="js"||!g.includes(".bundle")),A=C?"app":y?"dependency":h?"native":"runtime",N=x||h||n==="asyncGeneratorStep"||n==="_next";let u=c;u.includes("/example/")?u=u.substring(u.indexOf("/example/")+9):u.includes("/src/")?u=u.substring(u.indexOf("/src/")+1):u.includes("/node_modules/")&&(u=u.substring(u.indexOf("/node_modules/")+14));const $=l?`${g}:${l}${d?`:${d}`:""}`:g;return{raw:e,functionName:n,fileName:g,fullPath:u,rawFilePath:a,fileExt:f,frameType:A,isUserCode:C,isRuntimeNoise:N,lineNumber:l,columnNumber:d,isOrigin:t,copyableLocation:$}};exports.parseStackLine=parseStackLine;const openInVSCode=(e,t,o)=>{const r=t?Number(t):1,n=o?Number(o):1,s=t?`:${t}`:"",i=o?`:${o}`:"",a=e.replace(/^file:\/\//,"");let l=null;try{const p=react_native_1.NativeModules?.SourceCode?.scriptURL||react_native_1.NativeModules?.PlatformConstants?.serverHost||react_native_1.NativeModules?.DevSettings?.serverHost;if(typeof p=="string"&&p.length>0){const f=p.match(/^(https?:\/\/[^/]+)/);f?l=f[1]:!p.startsWith("http")&&p.includes(":")&&(l=`http://${p}`)}}catch{}Array.from(new Set([...l?[l]:[],"http://localhost:8081","http://127.0.0.1:8081","http://10.0.2.2:8081"])).forEach(p=>{try{fetch(`${p}/open-stack-frame`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({file:a,lineNumber:r,column:n})}).catch(()=>{})}catch{}});const c=`vscode://file/${a.replace(/^\/+/,"")}${s}${i}`,g=`cursor://file/${a.replace(/^\/+/,"")}${s}${i}`,m=`vscode-insiders://file/${a.replace(/^\/+/,"")}${s}${i}`;react_native_1.Linking.openURL(c).catch(()=>{react_native_1.Linking.openURL(g).catch(()=>{react_native_1.Linking.openURL(m).catch(()=>{(0,exports.copyToClipboard)(`${a}${s}${i}`,"Location")})})})};exports.openInVSCode=openInVSCode,exports.ANALYTICS_EVENT_PALETTE=[AppColors_1.AppColors.googleBlue,AppColors_1.AppColors.googleGreen,AppColors_1.AppColors.googlePurple,AppColors_1.AppColors.googleTeal,AppColors_1.AppColors.googleRed,AppColors_1.AppColors.googleOrange,AppColors_1.AppColors.blue700,AppColors_1.AppColors.materialGreen];const getEventColor=e=>{const t=typeof e=="string"?e:String(e||"");let o=0;for(let r=0;r<t.length;r++)o=o*31+t.charCodeAt(r)|0;return exports.ANALYTICS_EVENT_PALETTE[Math.abs(o)%exports.ANALYTICS_EVENT_PALETTE.length]};exports.getEventColor=getEventColor;var gaAnalyticsRegistry_1=require("./gaAnalyticsRegistry");Object.defineProperty(exports,"getEventCategory",{enumerable:!0,get:function(){return gaAnalyticsRegistry_1.getEventCategory}}),Object.defineProperty(exports,"registerGAPlugin",{enumerable:!0,get:function(){return gaAnalyticsRegistry_1.registerGAPlugin}});const getCategoryColors=e=>{switch(e){case"page_view":case"Page View":return{bg:AppColors_1.AppColors.blueBg,border:AppColors_1.AppColors.blueBorder,text:AppColors_1.AppColors.blue800};case"ecommerce":case"Ecommerce":return{bg:AppColors_1.AppColors.greenBg,border:AppColors_1.AppColors.greenBorder,text:AppColors_1.AppColors.materialGreen};case"system":case"System":return{bg:AppColors_1.AppColors.greyBg,border:AppColors_1.AppColors.greyBorder,text:AppColors_1.AppColors.grey600};default:return{bg:AppColors_1.AppColors.purpleBg,border:AppColors_1.AppColors.purpleBorder,text:AppColors_1.AppColors.purpleText}}};exports.getCategoryColors=getCategoryColors;const getRuntimeDiagnostics=()=>{const e=typeof global.HermesInternal<"u",t=typeof global._v8runtime<"u",o=e?"hermes":t?"v8":"jsc",n=typeof global.nativeFabricUIManager<"u"||!!global.__turboModuleProxy?"fabric":"paper";let s=32.4,i=64;try{const a=global.HermesInternal?.getInstrumentedStats?.();a?.js_heap_size?(s=Number((a.js_heap_size/(1024*1024)).toFixed(1)),i=Number(((a.js_allocated_bytes||a.js_heap_size*1.6)/(1024*1024)).toFixed(1))):global.performance?.memory?.usedJSHeapSize&&(s=Number((global.performance.memory.usedJSHeapSize/(1024*1024)).toFixed(1)),i=Number((global.performance.memory.totalJSHeapSize/(1024*1024)).toFixed(1)))}catch{}return{engineType:o,archType:n,usedHeapMb:s,totalAllocMb:i}};exports.getRuntimeDiagnostics=getRuntimeDiagnostics;
|