react-native-inapp-inspector 2.3.24 → 2.4.0
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 +26 -5
- package/dist/commonjs/components/AnalyticsDetail.js +15 -12
- package/dist/commonjs/components/AnalyticsEventCard.js +11 -8
- package/dist/commonjs/components/AppHeaderLogo.js +4 -6
- package/dist/commonjs/components/ConsoleLogCard.d.ts +1 -0
- package/dist/commonjs/components/ConsoleLogCard.js +92 -80
- package/dist/commonjs/components/EndOfListFooter.d.ts +5 -1
- package/dist/commonjs/components/EndOfListFooter.js +27 -5
- package/dist/commonjs/components/Inspector/AnalyticsFilterModal.js +1 -1
- package/dist/commonjs/components/Inspector/AnalyticsTab.js +27 -299
- package/dist/commonjs/components/Inspector/ConsoleTab.js +36 -94
- package/dist/commonjs/components/Inspector/CrashDetail.js +11 -10
- package/dist/commonjs/components/Inspector/CrashTab.js +43 -33
- package/dist/commonjs/components/Inspector/DebuggingTab.js +13 -13
- package/dist/commonjs/components/Inspector/DeviceInfoTab.js +107 -71
- package/dist/commonjs/components/Inspector/FabLauncher.js +8 -9
- package/dist/commonjs/components/Inspector/InspectorHeader.js +93 -70
- package/dist/commonjs/components/Inspector/LogDetail.js +10 -7
- package/dist/commonjs/components/Inspector/MainScreen.js +66 -30
- package/dist/commonjs/components/Inspector/MediaGalleryTab.js +1 -1
- package/dist/commonjs/components/Inspector/MediaPreviewModal.js +3 -3
- package/dist/commonjs/components/Inspector/NetworkDetail.js +29 -28
- package/dist/commonjs/components/Inspector/NetworkFilterModal.js +1 -1
- package/dist/commonjs/components/Inspector/NetworkTab.js +87 -85
- package/dist/commonjs/components/Inspector/NpmStarPrompt.js +3 -3
- package/dist/commonjs/components/Inspector/NpmUpdateToast.js +21 -22
- package/dist/commonjs/components/Inspector/PushCard.d.ts +4 -0
- package/dist/commonjs/components/Inspector/PushCard.js +89 -0
- package/dist/commonjs/components/Inspector/PushDetail.d.ts +4 -0
- package/dist/commonjs/components/Inspector/PushDetail.js +190 -0
- package/dist/commonjs/components/Inspector/PushTab.d.ts +3 -0
- package/dist/commonjs/components/Inspector/PushTab.js +45 -0
- package/dist/commonjs/components/Inspector/ReduxDetail.js +16 -13
- package/dist/commonjs/components/Inspector/ReduxTab.js +109 -106
- package/dist/commonjs/components/Inspector/SettingsPanel.js +230 -134
- package/dist/commonjs/components/Inspector/StorageTab.js +55 -51
- package/dist/commonjs/components/Inspector/TabBar.js +30 -26
- package/dist/commonjs/components/Inspector/UpdateAvailableModal.js +2 -2
- package/dist/commonjs/components/JsonViewer.js +151 -159
- package/dist/commonjs/components/LogCard.js +34 -38
- package/dist/commonjs/components/LogSyntaxHighlighter.js +3 -3
- package/dist/commonjs/components/ModuleErrorBoundary.d.ts +24 -0
- package/dist/commonjs/components/ModuleErrorBoundary.js +33 -0
- package/dist/commonjs/components/NetworkIcons.d.ts +3 -3
- package/dist/commonjs/components/NetworkIcons.js +10 -6
- package/dist/commonjs/components/SegmentedTabs.d.ts +8 -2
- package/dist/commonjs/components/SegmentedTabs.js +11 -7
- package/dist/commonjs/components/ShareButton.d.ts +11 -0
- package/dist/commonjs/components/ShareButton.js +6 -0
- package/dist/commonjs/constants/index.js +1 -1
- package/dist/commonjs/constants/version.d.ts +1 -1
- package/dist/commonjs/constants/version.js +1 -1
- package/dist/commonjs/customHooks/crashHandler.js +4 -4
- package/dist/commonjs/customHooks/networkLogger.js +1 -2
- package/dist/commonjs/customHooks/pushNotificationLogger.d.ts +19 -0
- package/dist/commonjs/customHooks/pushNotificationLogger.js +1 -0
- package/dist/commonjs/helpers/index.d.ts +6 -0
- package/dist/commonjs/helpers/index.js +4 -4
- package/dist/commonjs/helpers/memoryManager.d.ts +2 -2
- package/dist/commonjs/helpers/memoryManager.js +1 -1
- package/dist/commonjs/helpers/remoteConfig.js +1 -1
- package/dist/commonjs/helpers/settingsStore.d.ts +1 -0
- package/dist/commonjs/helpers/settingsStore.js +1 -1
- package/dist/commonjs/helpers/shareFormatter.d.ts +13 -0
- package/dist/commonjs/helpers/shareFormatter.js +7 -0
- package/dist/commonjs/i18n/index.d.ts +35 -0
- package/dist/commonjs/i18n/index.js +1 -1
- package/dist/commonjs/i18n/locales/ar.json +1 -0
- package/dist/commonjs/i18n/locales/de.json +1 -0
- package/dist/commonjs/i18n/locales/en.json +1 -1
- package/dist/commonjs/i18n/locales/es.json +1 -0
- package/dist/commonjs/i18n/locales/fr.json +1 -0
- package/dist/commonjs/i18n/locales/hi.json +1 -0
- package/dist/commonjs/i18n/locales/ja.json +1 -0
- package/dist/commonjs/i18n/locales/ko.json +1 -0
- package/dist/commonjs/i18n/locales/pt.json +1 -0
- package/dist/commonjs/i18n/locales/ru.json +1 -0
- package/dist/commonjs/i18n/locales/zh.json +1 -0
- package/dist/commonjs/index.d.ts +6 -5
- package/dist/commonjs/index.js +4 -4
- package/dist/commonjs/push.d.ts +4 -0
- package/dist/commonjs/push.js +1 -0
- package/dist/commonjs/styles/AppColors.d.ts +40 -0
- package/dist/commonjs/styles/AppColors.js +1 -1
- package/dist/commonjs/styles/index.js +1 -1
- package/dist/commonjs/types/enums.d.ts +30 -20
- package/dist/commonjs/types/enums.js +1 -1
- package/dist/commonjs/types/index.d.ts +10 -0
- package/dist/commonjs/types/interfaces.d.ts +63 -7
- package/dist/esm/components/AnalyticsDetail.js +84 -81
- package/dist/esm/components/AnalyticsEventCard.js +20 -17
- package/dist/esm/components/AppHeaderLogo.js +5 -7
- package/dist/esm/components/ConsoleLogCard.d.ts +1 -0
- package/dist/esm/components/ConsoleLogCard.js +98 -86
- package/dist/esm/components/EndOfListFooter.d.ts +5 -1
- package/dist/esm/components/EndOfListFooter.js +36 -14
- package/dist/esm/components/Inspector/AnalyticsFilterModal.js +14 -14
- package/dist/esm/components/Inspector/AnalyticsTab.js +44 -316
- package/dist/esm/components/Inspector/ConsoleTab.js +55 -113
- package/dist/esm/components/Inspector/CrashDetail.js +53 -52
- package/dist/esm/components/Inspector/CrashTab.js +74 -64
- package/dist/esm/components/Inspector/DebuggingTab.js +33 -33
- package/dist/esm/components/Inspector/DeviceInfoTab.js +174 -138
- package/dist/esm/components/Inspector/FabLauncher.js +41 -42
- package/dist/esm/components/Inspector/InspectorHeader.js +138 -115
- package/dist/esm/components/Inspector/LogDetail.js +24 -21
- package/dist/esm/components/Inspector/MainScreen.js +98 -62
- package/dist/esm/components/Inspector/MediaGalleryTab.js +1 -1
- package/dist/esm/components/Inspector/MediaPreviewModal.js +31 -31
- package/dist/esm/components/Inspector/NetworkDetail.js +88 -87
- package/dist/esm/components/Inspector/NetworkFilterModal.js +8 -8
- package/dist/esm/components/Inspector/NetworkTab.js +132 -130
- package/dist/esm/components/Inspector/NpmStarPrompt.js +42 -42
- package/dist/esm/components/Inspector/NpmUpdateToast.js +45 -46
- package/dist/esm/components/Inspector/PushCard.d.ts +4 -0
- package/dist/esm/components/Inspector/PushCard.js +89 -0
- package/dist/esm/components/Inspector/PushDetail.d.ts +4 -0
- package/dist/esm/components/Inspector/PushDetail.js +190 -0
- package/dist/esm/components/Inspector/PushTab.d.ts +3 -0
- package/dist/esm/components/Inspector/PushTab.js +45 -0
- package/dist/esm/components/Inspector/ReduxDetail.js +40 -37
- package/dist/esm/components/Inspector/ReduxTab.js +155 -152
- package/dist/esm/components/Inspector/SettingsPanel.js +380 -284
- package/dist/esm/components/Inspector/StorageTab.js +177 -173
- package/dist/esm/components/Inspector/TabBar.js +38 -34
- package/dist/esm/components/Inspector/UpdateAvailableModal.js +1 -1
- package/dist/esm/components/JsonViewer.js +161 -169
- package/dist/esm/components/LogCard.js +38 -42
- package/dist/esm/components/LogSyntaxHighlighter.js +1 -1
- package/dist/esm/components/ModuleErrorBoundary.d.ts +24 -0
- package/dist/esm/components/ModuleErrorBoundary.js +33 -0
- package/dist/esm/components/NetworkIcons.d.ts +3 -3
- package/dist/esm/components/NetworkIcons.js +7 -3
- package/dist/esm/components/SegmentedTabs.d.ts +8 -2
- package/dist/esm/components/SegmentedTabs.js +12 -8
- package/dist/esm/components/ShareButton.d.ts +11 -0
- package/dist/esm/components/ShareButton.js +6 -0
- package/dist/esm/constants/index.js +1 -1
- package/dist/esm/constants/version.d.ts +1 -1
- package/dist/esm/constants/version.js +1 -1
- package/dist/esm/customHooks/crashHandler.js +6 -6
- package/dist/esm/customHooks/networkLogger.js +1 -2
- package/dist/esm/customHooks/pushNotificationLogger.d.ts +19 -0
- package/dist/esm/customHooks/pushNotificationLogger.js +1 -0
- package/dist/esm/helpers/index.d.ts +6 -0
- package/dist/esm/helpers/index.js +4 -4
- package/dist/esm/helpers/memoryManager.d.ts +2 -2
- package/dist/esm/helpers/memoryManager.js +1 -1
- package/dist/esm/helpers/remoteConfig.js +1 -1
- package/dist/esm/helpers/settingsStore.d.ts +1 -0
- package/dist/esm/helpers/settingsStore.js +1 -1
- package/dist/esm/helpers/shareFormatter.d.ts +13 -0
- package/dist/esm/helpers/shareFormatter.js +7 -0
- package/dist/esm/i18n/index.d.ts +35 -0
- package/dist/esm/i18n/index.js +1 -1
- package/dist/esm/i18n/locales/ar.json +1 -0
- package/dist/esm/i18n/locales/de.json +1 -0
- package/dist/esm/i18n/locales/en.json +1 -1
- package/dist/esm/i18n/locales/es.json +1 -0
- package/dist/esm/i18n/locales/fr.json +1 -0
- package/dist/esm/i18n/locales/hi.json +1 -0
- package/dist/esm/i18n/locales/ja.json +1 -0
- package/dist/esm/i18n/locales/ko.json +1 -0
- package/dist/esm/i18n/locales/pt.json +1 -0
- package/dist/esm/i18n/locales/ru.json +1 -0
- package/dist/esm/i18n/locales/zh.json +1 -0
- package/dist/esm/index.d.ts +6 -5
- package/dist/esm/index.js +7 -7
- package/dist/esm/push.d.ts +4 -0
- package/dist/esm/push.js +1 -0
- package/dist/esm/styles/AppColors.d.ts +40 -0
- package/dist/esm/styles/AppColors.js +1 -1
- package/dist/esm/styles/index.js +1 -1
- package/dist/esm/types/enums.d.ts +30 -20
- package/dist/esm/types/enums.js +1 -1
- package/dist/esm/types/index.d.ts +10 -0
- package/dist/esm/types/interfaces.d.ts +63 -7
- package/package.json +53 -24
- package/src/native/NativeInspector.ts +0 -1
- package/dist/commonjs/bundle.d.ts +0 -2
- package/dist/commonjs/bundle.js +0 -1
- package/dist/commonjs/components/BrandSquareIcon.d.ts +0 -5
- package/dist/commonjs/components/BrandSquareIcon.js +0 -112
- package/dist/commonjs/components/Inspector/BundleTab.d.ts +0 -48
- package/dist/commonjs/components/Inspector/BundleTab.js +0 -1297
- package/dist/commonjs/components/Inspector/PerformanceTab.d.ts +0 -27
- package/dist/commonjs/components/Inspector/PerformanceTab.js +0 -454
- package/dist/commonjs/customHooks/bundleAnalyzer.d.ts +0 -115
- package/dist/commonjs/customHooks/bundleAnalyzer.js +0 -1
- package/dist/commonjs/customHooks/performanceTracker.d.ts +0 -144
- package/dist/commonjs/customHooks/performanceTracker.js +0 -63
- package/dist/commonjs/performance.d.ts +0 -2
- package/dist/commonjs/performance.js +0 -1
- package/dist/esm/bundle.d.ts +0 -2
- package/dist/esm/bundle.js +0 -1
- package/dist/esm/components/BrandSquareIcon.d.ts +0 -5
- package/dist/esm/components/BrandSquareIcon.js +0 -112
- package/dist/esm/components/Inspector/BundleTab.d.ts +0 -48
- package/dist/esm/components/Inspector/BundleTab.js +0 -1297
- package/dist/esm/components/Inspector/PerformanceTab.d.ts +0 -27
- package/dist/esm/components/Inspector/PerformanceTab.js +0 -454
- package/dist/esm/customHooks/bundleAnalyzer.d.ts +0 -115
- package/dist/esm/customHooks/bundleAnalyzer.js +0 -1
- package/dist/esm/customHooks/performanceTracker.d.ts +0 -144
- package/dist/esm/customHooks/performanceTracker.js +0 -63
- package/dist/esm/performance.d.ts +0 -2
- package/dist/esm/performance.js +0 -1
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import{Component as E}from"react";import{StyleSheet as S,Text as F,View as C,TouchableOpacity as T,Platform as D}from"react-native";import{AppFonts as w}from"../styles/AppFonts";import{copyToClipboard as k}from"../helpers";import{WarningTriangleIcon as B,RefreshCcwIcon as I,CopyIcon as O}from"./NetworkIcons";import{handleInterceptedCrash as V}from"../customHooks/crashHandler";import{CrashType as W}from"../types/enums";export class ModuleErrorBoundary extends E{constructor(){super(...arguments),this.state={hasError:!1,error:null,copied:!1},this.handleRetry=()=>{this.setState({hasError:!1,error:null,copied:!1}),this.props.onRetry&&this.props.onRetry()},this.handleCopy=()=>{if(!this.state.error)return;const e=`[Module Error: ${this.props.moduleName||"Micro-Feature"}]
|
|
2
|
+
Message: ${this.state.error.message}
|
|
3
|
+
Stack: ${this.state.error.stack||"N/A"}`;k(e),this.setState({copied:!0}),setTimeout(()=>{this.setState({copied:!1})},2e3)}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,b){try{V(e,e?.stack,!1,W.Js,b.componentStack||void 0)}catch{}this.props.onError&&this.props.onError(e,b)}render(){if(this.state.hasError&&this.state.error){const{fallback:e,moduleName:b="UI Module",containerStyle:R}=this.props;return typeof e=="function"?e(this.state.error,this.handleRetry):e||<C style={[t.card,R]}>
|
|
4
|
+
<C style={t.headerRow}>
|
|
5
|
+
<C style={t.titleRow}>
|
|
6
|
+
<B color="#DC2626"size={16}/>
|
|
7
|
+
<F style={t.moduleName}numberOfLines={1}>
|
|
8
|
+
{b}
|
|
9
|
+
</F>
|
|
10
|
+
</C>
|
|
11
|
+
<C style={t.badge}>
|
|
12
|
+
<F style={t.badgeText}>FAULT ISOLATED</F>
|
|
13
|
+
</C>
|
|
14
|
+
</C>
|
|
15
|
+
|
|
16
|
+
<F style={t.message}numberOfLines={2}>
|
|
17
|
+
{this.state.error.message||"An unexpected rendering error occurred in this module."}
|
|
18
|
+
</F>
|
|
19
|
+
|
|
20
|
+
<C style={t.actionsRow}>
|
|
21
|
+
<T style={t.retryButton}onPress={this.handleRetry}activeOpacity={.7}>
|
|
22
|
+
<I color="#FFFFFF"size={12}/>
|
|
23
|
+
<F style={t.retryText}>Retry Module</F>
|
|
24
|
+
</T>
|
|
25
|
+
|
|
26
|
+
<T style={t.copyButton}onPress={this.handleCopy}activeOpacity={.7}>
|
|
27
|
+
<O color="#475569"size={12}/>
|
|
28
|
+
<F style={t.copyText}>
|
|
29
|
+
{this.state.copied?"Copied":"Copy Error"}
|
|
30
|
+
</F>
|
|
31
|
+
</T>
|
|
32
|
+
</C>
|
|
33
|
+
</C>}return this.props.children}}export default ModuleErrorBoundary;const t=S.create({card:{backgroundColor:"#FEF2F2",borderColor:"#FECDD3",borderWidth:1.2,borderRadius:16,padding:14,marginVertical:6,gap:10,...D.select({ios:{shadowColor:"#DC2626",shadowOffset:{width:0,height:2},shadowOpacity:.06,shadowRadius:6},android:{elevation:2}})},headerRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:6},titleRow:{flexDirection:"row",alignItems:"center",gap:6,flexShrink:1},moduleName:{fontSize:12.5,fontWeight:"800",color:"#991B1B",fontFamily:w.interBold,flexShrink:1},badge:{backgroundColor:"#FEE2E2",paddingHorizontal:6,paddingVertical:2,borderRadius:6,borderWidth:1,borderColor:"#FCA5A5"},badgeText:{fontSize:8.5,fontWeight:"800",color:"#B91C1C",letterSpacing:.4},message:{fontSize:11.5,color:"#7F1D1D",lineHeight:16,fontFamily:w.interRegular},actionsRow:{flexDirection:"row",alignItems:"center",gap:8,marginTop:2},retryButton:{flex:1,flexDirection:"row",alignItems:"center",justifyContent:"center",gap:6,backgroundColor:"#DC2626",paddingVertical:7,paddingHorizontal:12,borderRadius:9},retryText:{fontSize:11,fontWeight:"700",color:"#FFFFFF",fontFamily:w.interBold},copyButton:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:4,backgroundColor:"#F1F5F9",paddingVertical:7,paddingHorizontal:12,borderRadius:9,borderWidth:1,borderColor:"#E2E8F0"},copyText:{fontSize:11,fontWeight:"600",color:"#475569",fontFamily:w.interMedium}});
|
|
@@ -4,7 +4,6 @@ export interface IconProps {
|
|
|
4
4
|
size?: number;
|
|
5
5
|
strokeWidth?: number;
|
|
6
6
|
isExpanded?: boolean;
|
|
7
|
-
isPaused?: boolean;
|
|
8
7
|
active?: boolean;
|
|
9
8
|
direction?: 'up' | 'down' | string;
|
|
10
9
|
ascending?: boolean;
|
|
@@ -31,7 +30,6 @@ export declare const CircleXIcon: ({ color, size }: IconProps) => React.JSX.Elem
|
|
|
31
30
|
export declare const CircleAlertIcon: ({ color, size }: IconProps) => React.JSX.Element;
|
|
32
31
|
export declare const FailIcon: ({ color, size }: IconProps) => React.JSX.Element;
|
|
33
32
|
export declare const TrashIcon: ({ color, size }: IconProps) => React.JSX.Element;
|
|
34
|
-
export declare const HeaderPauseIcon: ({ isPaused, color, size, }: IconProps) => React.JSX.Element;
|
|
35
33
|
export declare const ExportIcon: ({ color, size, }: IconProps) => React.JSX.Element;
|
|
36
34
|
export declare const ShareIcon: ({ color, size, }: IconProps) => React.JSX.Element;
|
|
37
35
|
export declare const SignalIcon: ({ color, size, }: IconProps) => React.JSX.Element;
|
|
@@ -49,7 +47,6 @@ export declare const DebugIcon: ({ color, size }: IconProps) => React.JSX.Elemen
|
|
|
49
47
|
export declare const SunIcon: ({ color, size }: IconProps) => React.JSX.Element;
|
|
50
48
|
export declare const MoonIcon: ({ color, size }: IconProps) => React.JSX.Element;
|
|
51
49
|
export { BrandCircleIcon } from './BrandCircleIcon';
|
|
52
|
-
export { BrandSquareIcon } from './BrandSquareIcon';
|
|
53
50
|
export declare const HtmlIcon: ({ color, size }: IconProps) => React.JSX.Element;
|
|
54
51
|
export declare const CssIcon: ({ color, size }: IconProps) => React.JSX.Element;
|
|
55
52
|
export declare const JsIcon: ({ color, size }: IconProps) => React.JSX.Element;
|
|
@@ -168,3 +165,6 @@ export declare const NeutralFaceIcon: ({ color, size, }: IconProps) => React.JSX
|
|
|
168
165
|
export declare const SmileFaceIcon: ({ color, size, }: IconProps) => React.JSX.Element;
|
|
169
166
|
export declare const StarFaceIcon: ({ color, size, }: IconProps) => React.JSX.Element;
|
|
170
167
|
export declare const HeartFaceIcon: ({ color, size, }: IconProps) => React.JSX.Element;
|
|
168
|
+
export declare const BellIcon: ({ color, size, }: IconProps) => React.JSX.Element;
|
|
169
|
+
export declare const NotificationIcon: ({ color, size, }: IconProps) => React.JSX.Element;
|
|
170
|
+
export declare const CloudPushIcon: ({ color, size, }: IconProps) => React.JSX.Element;
|
|
@@ -60,8 +60,6 @@ import"react";import W,{Circle as M,Ellipse as T,Line as S,Path as L,Rect as B}f
|
|
|
60
60
|
<L d="M18 6L6 18M6 6l12 12"stroke={e}strokeWidth="3"strokeLinecap="round"strokeLinejoin="round"/>
|
|
61
61
|
</W>,TrashIcon=({color:e=p.primaryLight,size:t=18})=><W width={t}height={t}viewBox="0 0 24 24"fill="none">
|
|
62
62
|
<L d="M3 6h18M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"stroke={e}strokeWidth="2"strokeLinecap="round"strokeLinejoin="round"/>
|
|
63
|
-
</W>,HeaderPauseIcon=({isPaused:e,color:t=p.primaryLight,size:I=20})=><W width={I}height={I}viewBox="0 0 24 24"fill="none">
|
|
64
|
-
{e?<L d="M5 3l14 9-14 9V3z"fill={t}/>:<L d="M6 5h3v14H6V5zm9 0h3v14h-3V5z"fill={t}/>}
|
|
65
63
|
</W>,ExportIcon=({color:e=p.primaryLight,size:t=18})=><W width={t}height={t}viewBox="0 0 24 24"fill="none">
|
|
66
64
|
<L d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M17 8l-5-5-5 5M12 3v12"stroke={e}strokeWidth="2"strokeLinecap="round"strokeLinejoin="round"/>
|
|
67
65
|
</W>,ShareIcon=({color:e=p.white,size:t=14})=><W width={t}height={t}viewBox="0 0 24 24"fill="none">
|
|
@@ -116,7 +114,7 @@ import"react";import W,{Circle as M,Ellipse as T,Line as S,Path as L,Rect as B}f
|
|
|
116
114
|
<L d="M12 1v2M12 21v2M4.22 4.22l1.42 1.42M18.36 18.36l1.42 1.42M1 12h2M21 12h2M4.22 19.78l1.42-1.42M18.36 5.64l1.42-1.42"stroke={e}strokeWidth="2"strokeLinecap="round"/>
|
|
117
115
|
</W>,MoonIcon=({color:e=p.white,size:t=16})=><W width={t}height={t}viewBox="0 0 24 24"fill="none">
|
|
118
116
|
<L d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"fill={e}stroke={e}strokeWidth="1.5"strokeLinecap="round"strokeLinejoin="round"/>
|
|
119
|
-
</W>;export{BrandCircleIcon}from"./BrandCircleIcon";export
|
|
117
|
+
</W>;export{BrandCircleIcon}from"./BrandCircleIcon";export const HtmlIcon=({color:e=p.grayTextWeak,size:t=14})=><W width={t}height={t}viewBox="0 0 24 24"fill="none">
|
|
120
118
|
<L d="M17.5 8.5L21 12l-3.5 3.5M6.5 8.5L3 12l3.5 3.5M14 4.5l-4 15"stroke={e}strokeWidth="2.5"strokeLinecap="round"strokeLinejoin="round"/>
|
|
121
119
|
</W>,CssIcon=({color:e=p.grayTextWeak,size:t=14})=><W width={t}height={t}viewBox="0 0 24 24"fill="none">
|
|
122
120
|
<L d="M12 2L2 7l10 5 10-5-10-5zM2 17l10 5 10-5M2 12l10 5 10-5"stroke={e}strokeWidth="2"strokeLinecap="round"strokeLinejoin="round"/>
|
|
@@ -533,4 +531,10 @@ import"react";import W,{Circle as M,Ellipse as T,Line as S,Path as L,Rect as B}f
|
|
|
533
531
|
|
|
534
532
|
<L d="M15 8.2C14.3 7.4 13.2 7.5 12.7 8.2C12.1 9 12.4 10.1 15 11.6C17.6 10.1 17.9 9 17.3 8.2C16.8 7.5 15.7 7.4 15 8.2Z"fill={e}/>
|
|
535
533
|
<L d="M8 14.5C8 14.5 9.5 17.5 12 17.5C14.5 17.5 16 14.5 16 14.5"stroke={e}strokeWidth="1.8"strokeLinecap="round"/>
|
|
534
|
+
</W>,BellIcon=({color:e=p.brandPurple,size:t=20})=><W width={t}height={t}viewBox="0 0 24 24"fill="none">
|
|
535
|
+
<L d="M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9"stroke={e}strokeWidth="2"strokeLinecap="round"strokeLinejoin="round"/>
|
|
536
|
+
<L d="M13.73 21a2 2 0 0 1-3.46 0"stroke={e}strokeWidth="2"strokeLinecap="round"strokeLinejoin="round"/>
|
|
537
|
+
</W>,NotificationIcon=BellIcon,CloudPushIcon=({color:e=p.brandPurple,size:t=20})=><W width={t}height={t}viewBox="0 0 24 24"fill="none">
|
|
538
|
+
<L d="M18 10h-1.26A8 8 0 1 0 9 20h9a5 5 0 0 0 0-10z"stroke={e}strokeWidth="2"strokeLinecap="round"strokeLinejoin="round"/>
|
|
539
|
+
<L d="m12 13 3 3m0 0-3 3m3-3H7"stroke={e}strokeWidth="1.8"strokeLinecap="round"strokeLinejoin="round"/>
|
|
536
540
|
</W>;
|
|
@@ -3,13 +3,19 @@ import { ViewStyle } from 'react-native';
|
|
|
3
3
|
export interface SegmentedTab {
|
|
4
4
|
key: string;
|
|
5
5
|
label: string;
|
|
6
|
-
|
|
6
|
+
themeColor?: string;
|
|
7
|
+
color?: string;
|
|
8
|
+
icon?: (isActive: boolean, themeColor?: string) => React.ReactNode;
|
|
7
9
|
}
|
|
8
10
|
interface SegmentedTabsProps {
|
|
9
11
|
tabs: SegmentedTab[];
|
|
10
12
|
activeKey: string;
|
|
11
13
|
onChange: (key: string) => void;
|
|
12
14
|
style?: ViewStyle | ViewStyle[];
|
|
15
|
+
scrollable?: boolean;
|
|
13
16
|
}
|
|
14
|
-
declare const
|
|
17
|
+
export declare const DEFAULT_INNER_TAB_THEMES: Record<string, string>;
|
|
18
|
+
declare const SegmentedTabs: React.MemoExoticComponent<({ tabs, activeKey, onChange, style, scrollable }: SegmentedTabsProps & {
|
|
19
|
+
scrollable?: boolean;
|
|
20
|
+
}) => React.JSX.Element>;
|
|
15
21
|
export default SegmentedTabs;
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
{
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import T from"react";import{Pressable as A,ScrollView as R,Text as V,View as C}from"react-native";import{AppColors as e}from"../styles/AppColors";import{AppFonts as z}from"../styles/AppFonts";export const DEFAULT_INNER_TAB_THEMES={metadata:e.sky600,headers:e.teal600,request:e.amber600,response:e.brandPurple,req:e.amber600,res:e.brandPurple,output:e.teal600,arguments:e.amber600,stack:e.errorColor,caller:e.sky600,error:e.errorColor,app:e.green600,all:e.brandPurple,live:e.violet600,timeline:e.orange600,persisted:e.teal600,payload:e.violet600,diff:e.green600,raw:e.brandPurple,diagnostics:e.amber600,breadcrumbs:e.orange600,overview:e.sky600,json:e.brandPurple,tree:e.violet600,preview:e.brandPurple,delivery:e.amber600,domainAttrs:e.sky600,pretty:e.violet600,table:e.teal600,production:e.brandPurple,files:e.teal600,packages:e.orange600,media:e.pink600,optimizer:e.violet600,hardware:e.orange600,network:e.teal600,display:e.pink600,runtime:e.amber600,security:e.errorColor,fatal:e.errorColor,promise:e.orange600,render:e.pink600,native:e.cyan600,js:e.amber600,asyncStorage:e.brandPurple,mmkv:e.teal600};const D=T.memo(({tabs:v,activeKey:P,onChange:x,style:i,scrollable:t})=>{const n=v.map(r=>{const o=P===r.key,a=r.themeColor||r.color||DEFAULT_INNER_TAB_THEMES[r.key]||e.brandPurple;return<A key={r.key}onPress={()=>x(r.key)}style={({pressed:S})=>[{flex:t?void 0:1,paddingVertical:7,paddingHorizontal:t?12:6,borderRadius:7,backgroundColor:o?a:"transparent",alignItems:"center",justifyContent:"center",gap:4.5,flexDirection:"row",opacity:S?.8:1},o&&{shadowColor:a,shadowOffset:{width:0,height:1},shadowOpacity:.28,shadowRadius:3,elevation:2}]}>
|
|
2
|
+
{r.icon?typeof r.icon=="function"?r.icon(o,a):r.icon:null}
|
|
3
|
+
<V numberOfLines={1}style={{fontFamily:z.interBold,fontSize:10.5,color:o?e.white:e.grayText,letterSpacing:.2}}>
|
|
4
|
+
{r.label}
|
|
5
|
+
</V>
|
|
6
|
+
</A>});return t?<C style={[{borderRadius:10,backgroundColor:`${e.slate200}80`,padding:3,borderWidth:1,borderColor:e.dividerColor},i]}>
|
|
7
|
+
<R horizontal showsHorizontalScrollIndicator={!1}contentContainerStyle={{flexDirection:"row",alignItems:"center",gap:4}}>
|
|
8
|
+
{n}
|
|
9
|
+
</R>
|
|
10
|
+
</C>:<C style={[{flexDirection:"row",borderRadius:10,backgroundColor:`${e.slate200}80`,padding:3,borderWidth:1,borderColor:e.dividerColor,gap:3,minWidth:0},i]}>
|
|
11
|
+
{n}
|
|
12
|
+
</C>});export default D;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StyleProp, ViewStyle } from 'react-native';
|
|
3
|
+
export interface ShareButtonProps {
|
|
4
|
+
onShare: () => void | Promise<void>;
|
|
5
|
+
label?: string;
|
|
6
|
+
style?: StyleProp<ViewStyle>;
|
|
7
|
+
color?: string;
|
|
8
|
+
size?: number;
|
|
9
|
+
}
|
|
10
|
+
declare const ShareButton: React.MemoExoticComponent<({ onShare, label, style, color, size, }: ShareButtonProps) => React.JSX.Element>;
|
|
11
|
+
export default ShareButton;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import p,{useCallback as h,useState as S}from"react";import{Text as C}from"react-native";import T from"./TouchableScale";import{ShareIcon as B,CheckIcon as $}from"./NetworkIcons";import{triggerNativeHaptic as q}from"../native/NativeInspector";import{AppColors as r}from"../styles/AppColors";import s from"../styles";const n=p.memo(({onShare:a,label:e,style:l,color:t=r.brandPurple,size:i=14})=>{const[o,c]=S(!1),m=h(async()=>{try{q("medium"),await a(),c(!0),setTimeout(()=>c(!1),1200)}catch{}},[a]),u=[s.iconSquareBtn,{backgroundColor:`${t}14`,borderColor:`${t}30`},o&&s.iconSquareBtnSuccess,l];return<T accessible={!0}accessibilityRole="button"accessibilityLabel={`Share ${e}`}accessibilityHint={`Opens native share sheet to export ${e}`}style={u}onPress={m}hitSlop={8}>
|
|
2
|
+
{o?<$ color={r.greenColor}size={i}strokeWidth={2.4}/>:<B color={t}size={i}/>}
|
|
3
|
+
{e?<C style={[s.iconSquareBtnText,{color:o?r.greenColor:t}]}>
|
|
4
|
+
{o?"Shared":e}
|
|
5
|
+
</C>:null}
|
|
6
|
+
</T>});n.displayName="ShareButton";export default n;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{AppColors as o}from"../styles/AppColors";export const STATUS_FILTERS=["ALL","2xx","200","3xx","4xx","400","404","5xx","500","Failed"],METHOD_COLORS={ALL:
|
|
1
|
+
import{AppColors as o}from"../styles/AppColors";export const STATUS_FILTERS=["ALL","2xx","200","3xx","4xx","400","404","5xx","500","Failed"],METHOD_COLORS={ALL:o.slate500,GET:o.emerald600,POST:o.blue600,PUT:o.amber600,PATCH:o.violet600,DELETE:o.red600,QUERY:o.sky600,OPTIONS:o.slate600,HEAD:o.cyan600},DOMAIN_COLORS=o.domainColors,DURATION_FAST_MS=200,DURATION_SLOW_MS=800;export{LIB_VERSION}from"./version";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const LIB_VERSION = "2.
|
|
1
|
+
export declare const LIB_VERSION = "2.4.0";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const LIB_VERSION="2.
|
|
1
|
+
export const LIB_VERSION="2.4.0";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{LogBox as M,NativeModules as v,TurboModuleRegistry as D,NativeEventEmitter as F,Platform as y,AppState as L,Dimensions as B}from"react-native";import{CrashExportFormat as A,CrashType as
|
|
2
|
-
`),n=[];for(const o of t){const r=o.trim();if(!r||r.includes("crashHandler.ts")||r.includes("handleInterceptedCrash")||r.includes("addLogFromCrash")||r.includes("setupGlobalCrashHandler"))continue;const a=r.match(/^([^@]+)@(.*):(\d+):(\d+)$/);if(a){const[,c,i,u,
|
|
3
|
-
`):
|
|
1
|
+
import{LogBox as M,NativeModules as v,TurboModuleRegistry as D,NativeEventEmitter as F,Platform as y,AppState as L,Dimensions as B}from"react-native";import{CrashExportFormat as A,CrashType as m}from"../types/enums";import{addLogFromCrash as H}from"./consoleLogger";import{showNativeFloatingButton as U,setNativeFloatingButtonBadge as _}from"../native/NativeInspector";import{t as s}from"../i18n";export{A as CrashExportFormat};let E=[],k=!1,I=0,l=[],f=[];const R=50;let S=100;const T=Date.now();let N=!1;export const setCrashModuleEnabled=e=>{N=e},getCrashModuleEnabled=()=>N,setMaxCrashLogsLimit=e=>{S=Math.max(10,e),l.length>S&&(l=l.slice(0,S))},getMaxCrashLogsLimit=()=>S,pruneCrashRecords=e=>{const t=e!==void 0?Math.max(0,e):Math.floor(l.length/2),n=l.length-t;return n>0&&(l=l.slice(0,t)),f.length>20&&(f=f.slice(0,20)),Math.max(0,n)},addCrashBreadcrumb=(e,t,n)=>{if(N)try{const o={type:e,message:t,timestamp:Date.now(),data:n};f.unshift(o),f.length>R&&(f=f.slice(0,R))}catch{}},recordNavigationBreadcrumb=(e,t)=>{addCrashBreadcrumb("navigation",s("crash.breadcrumbNavigation",{from:e||"/",to:t||"/"}),{from:e,to:t})},recordNetworkBreadcrumb=(e,t,n,o)=>{const r=n!=null?` [${n}]`:"",a=o!=null?` (${Math.round(o)}ms)`:"";addCrashBreadcrumb("network",`${t.toUpperCase()} ${e}${r}${a}`,{url:e,method:t,status:n,duration:o})},recordReduxBreadcrumb=(e,t)=>{addCrashBreadcrumb("redux",s("crash.breadcrumbAction",{actionType:e}),{type:e,payloadSummary:typeof t=="object"&&t!==null?Object.keys(t):typeof t})},recordUserActionBreadcrumb=(e,t)=>{addCrashBreadcrumb("user",e,t)},clearCrashBreadcrumbs=()=>{f=[]},getCrashBreadcrumbs=()=>[...f],parseCrashStackTrace=e=>{if(!e||typeof e!="string")return[];const t=e.split(`
|
|
2
|
+
`),n=[];for(const o of t){const r=o.trim();if(!r||r.includes("crashHandler.ts")||r.includes("handleInterceptedCrash")||r.includes("addLogFromCrash")||r.includes("setupGlobalCrashHandler"))continue;const a=r.match(/^([^@]+)@(.*):(\d+):(\d+)$/);if(a){const[,c,i,u,g]=a,b=i.split("?")[0].split("/").pop()||i,x=!i.includes("node_modules")&&!i.includes("react-native")&&!i.includes("react-dom")&&!i.includes("hermes")&&!i.includes("internal");n.push({method:c.trim(),file:b,lineNumber:parseInt(u,10),column:parseInt(g,10),raw:r,isAppCode:x});continue}const d=r.match(/^at\s+(.+)\s+\((.+):(\d+):(\d+)\)$/);if(d){const[,c,i,u,g]=d,b=i.split("?")[0].split("/").pop()||i,x=!i.includes("node_modules")&&!i.includes("react-native")&&!i.includes("react-dom")&&!i.includes("internal");n.push({method:c.trim(),file:b,lineNumber:parseInt(u,10),column:parseInt(g,10),raw:r,isAppCode:x});continue}const h=r.match(/^at\s+(.+):(\d+):(\d+)$/);if(h){const[,c,i,u]=h,g=c.split("?")[0].split("/").pop()||c,b=!c.includes("node_modules")&&!c.includes("react-native");n.push({method:"<anonymous>",file:g,lineNumber:parseInt(i,10),column:parseInt(u,10),raw:r,isAppCode:b});continue}const $=r.match(/^at\s+([a-zA-Z0-9_$.]+)\(([a-zA-Z0-9_$]+\.java):(\d+)\)$/);if($){const[,c,i,u]=$,g=!c.startsWith("com.facebook.react")&&!c.startsWith("android.");n.push({method:c,file:i,lineNumber:parseInt(u,10),column:0,raw:r,isAppCode:g});continue}const p=r.match(/^\d+\s+([^\s]+)\s+(0x[0-9a-fA-F]+)\s+(.+)$/);if(p){const[,c,,i]=p,u=!c.startsWith("lib")&&!c.startsWith("Core")&&!c.startsWith("React");n.push({method:i,file:c,lineNumber:0,column:0,raw:r,isAppCode:u});continue}n.push({method:r.startsWith("at ")?r.slice(3):r,file:"runtime",lineNumber:0,column:0,raw:r,isAppCode:!1})}return n};const J=()=>{try{const e=globalThis.performance;if(e&&e.memory)return{usedJSHeapSize:Math.round(e.memory.usedJSHeapSize/(1024*1024)),totalJSHeapSize:Math.round(e.memory.totalJSHeapSize/(1024*1024))}}catch{}},z=()=>{try{const e=B.get("window");return`${Math.round(e.width)}x${Math.round(e.height)} (${e.scale}x)`}catch{return s("crash.unknown")}};export const computeCrashFingerprint=e=>{const t=e.type||"js",n=e.name||"Error",o=e.parsedStack&&e.parsedStack.length>0?e.parsedStack[0]:null,r=o?`${o.file}:${o.lineNumber}`:"unknown";return`${t}_${n}_${r}`},getCrashRecords=()=>[...l],clearCrashRecords=()=>{l=[],emitCrashEvent({error:null,message:"__CLEARED__",timestamp:Date.now()})},subscribeCrashEvents=e=>(E.push(e),()=>{E=E.filter(t=>t!==e)}),emitCrashEvent=e=>{if(e.message!=="__CLEARED__"){const t=Date.now();if(t-I<250)return;I=t}E.forEach(t=>{try{t(e)}catch{}})},handleInterceptedCrash=(e,t,n=!1,o,r)=>{try{const a=e instanceof Error||typeof e=="object"&&e!==null?e:new Error(String(e||s("crash.runtimeException"))),d=a.message||(typeof e=="string"?e:s("crash.runtimeException"));let h="";typeof t=="string"?h=t:Array.isArray(t)?h=t.map(C=>`at ${C.methodName||"<anonymous>"} (${C.file||"unknown"}:${C.lineNumber||0}:${C.column||0})`).join(`
|
|
3
|
+
`):h=a.stack||new Error().stack||"";let $=o||m.Js;const p=d.toLowerCase();o||(p.includes("native")||p.includes("sigsegv")||p.includes("nsrange")||p.includes("nullpointerexception")||p.includes("fatal signal")?$=m.Native:p.includes("promise")||p.includes("unhandled rejection")||p.includes("unhandledrejection")?$=m.Promise:p.includes("render")||p.includes("errorboundary")||r?$=m.Render:$=m.Js);const c=new Date,i=c.toLocaleDateString(),u=c.toLocaleTimeString(),g=parseCrashStackTrace(h),b=H(a,`[${n?s("crash.logFatalCrash"):s("crash.logUnhandledError")}] ${d}`,h,n),x=typeof globalThis.HermesInternal<"u",j=typeof globalThis.nativeFabricUIManager<"u",w={id:`crash_${Date.now()}_${Math.random().toString(36).substr(2,6)}`,error:a,isFatal:n,type:$,message:d,name:a.name||(n?s("crash.errorNameFatal"):s("crash.errorNameUnhandled")),stack:h,parsedStack:g,componentStack:r||void 0,timestamp:Date.now(),dateStr:i,timeStr:u,deviceInfo:{platform:y.OS,osVersion:String(y.Version),rnVersion:y.constants?.reactNativeVersion?`${y.constants.reactNativeVersion.major}.${y.constants.reactNativeVersion.minor}.${y.constants.reactNativeVersion.patch}`:s("crash.unknown"),isHermes:x,isFabric:j,appState:L.currentState||"active"},memoryInfo:J(),breadcrumbs:[...f],logId:b?.id};l.unshift(w),l.length>S&&(l=l.slice(0,S)),emitCrashEvent({error:a,isFatal:n,message:`[${n?s("crash.logFatalCrash"):s("crash.logUnhandledError")}] ${d}`,stack:h,timestamp:Date.now(),logId:b?.id,crashRecord:w});try{U(),_(!0)}catch{}return w}catch{return{id:`crash_${Date.now()}`,isFatal:!0,type:m.Js,message:String(e||s("crash.unknownException")),timestamp:Date.now(),dateStr:new Date().toLocaleDateString(),timeStr:new Date().toLocaleTimeString()}}},recordCustomCrash=(e,t)=>handleInterceptedCrash(e,typeof e=="object"?e.stack:void 0,t?.isFatal??!1,t?.type||m.Custom,t?.componentStack),simulateTestCrash=(e=m.Js,t,n)=>{const o=new Error(t||P(e));return handleInterceptedCrash(e===m.Native?o.message:o,n||o.stack,e===m.Native,e,e===m.Render?V():void 0)};const P=e=>{switch(e){case"native":return s("crash.simNativeMessage");case"promise":return s("crash.simPromiseMessage");case"render":return s("crash.simRenderMessage");default:return s("crash.simJsMessage")}},V=()=>{try{const e=new Error;if(e.stack)return e.stack.split(`
|
|
4
4
|
`).slice(1,6).map(t=>` ${t.trim()}`).join(`
|
|
5
|
-
`)}catch{}};export const exportCrashReport=(e,t="text")=>{if(t==="json")return JSON.stringify(e,null,2);const n=Math.round((e.timestamp-T)/1e3);if(t==="markdown"){const r=[];return r.push(`## ${s("crash.mdReportTitle",{name:e.name||"Error"})}`),r.push(`> **${e.message}**`),r.push(""),r.push(`- **${s("crash.reportType")}** \`${e.type.toUpperCase()}\``),r.push(`- **${s("crash.reportFatal")}** \`${e.isFatal?s("crash.mdSeverityFatal"):s("crash.mdSeverityHandled")}\``),r.push(`- **${s("crash.reportTimestamp")}** ${e.dateStr} ${e.timeStr}`),r.push(`- **${s("crash.reportUptime")}** ${n}s`),r.push(`- **${s("crash.reportPlatform")}** ${e.deviceInfo?.platform?.toUpperCase()} (v${e.deviceInfo?.osVersion})`),r.push(`- **${s("crash.reportReactNative")}** v${e.deviceInfo?.rnVersion||"N/A"}`),r.push(`- **${s("crash.jsEngine")}** ${e.deviceInfo?.isHermes?s("crash.hermesEngine"):s("crash.jsc")}`),r.push(`- **${s("crash.reportArchitecture")}** ${e.deviceInfo?.isFabric?s("crash.reportFabricNew"):s("crash.reportPaperLegacy")}`),e.memoryInfo&&r.push(`- **${s("crash.reportJsMemory")}** ${e.memoryInfo.usedJSHeapSize} MB / ${e.memoryInfo.totalJSHeapSize} MB`),r.push(""),r.push(`### ${s("crash.mdStackTrace")}`),r.push("```"),r.push(e.stack||s("crash.reportNoStackTrace")),r.push("```"),e.componentStack&&(r.push(""),r.push(`### ${s("crash.mdComponentHierarchy")}`),r.push("```"),r.push(e.componentStack),r.push("```")),e.breadcrumbs&&e.breadcrumbs.length>0&&(r.push(""),r.push(`### ${s("crash.mdRecentBreadcrumbs")}`),e.breadcrumbs.forEach(a=>{const
|
|
6
|
-
`)}const o=[];return o.push("===================================================="),o.push(` ${s("crash.reportTitle")} `),o.push("===================================================="),o.push(`${s("crash.reportErrorName")} ${e.name||"Error"}`),o.push(`${s("crash.reportMessage")} ${e.message}`),o.push(`${s("crash.reportType")} ${e.type.toUpperCase()}`),o.push(`${s("crash.reportFatal")} ${e.isFatal?s("crash.reportFatalYes"):s("crash.reportFatalNo")}`),o.push(`${s("crash.reportTimestamp")} ${e.dateStr} ${e.timeStr} (${e.timestamp})`),o.push(`${s("crash.reportUptime")} ${s("crash.reportUptimeValue",{seconds:n})}`),o.push(`${s("crash.reportPlatform")} ${e.deviceInfo?.platform?.toUpperCase()} (v${e.deviceInfo?.osVersion})`),o.push(`${s("crash.reportReactNative")} ${e.deviceInfo?.rnVersion||"N/A"}`),o.push(`${s("crash.reportHermes")} ${e.deviceInfo?.isHermes?s("crash.reportEnabled"):s("crash.reportDisabled")}`),o.push(`${s("crash.reportArchitecture")} ${e.deviceInfo?.isFabric?s("crash.reportFabricNew"):s("crash.reportPaperLegacy")}`),o.push(`${s("crash.reportScreenSize")} ${
|
|
7
|
-
`)},setupGlobalCrashHandler=()=>{if(!k){k=!0;try{M&&typeof M.ignoreAllLogs=="function"&&M.ignoreAllLogs(!0)}catch{}try{const e=require("react-native/Libraries/LogBox/Data/LogBoxData");e&&typeof e.setDisabled=="function"&&e.setDisabled(!0)}catch{}try{const e=v?.NetworkInspectorModule;e&&(typeof e.enableNativeCrashProtection=="function"&&e.enableNativeCrashProtection(),new F(e).addListener("onNativeCrash",n=>{const r=`[${(n?.platform||y.OS).toUpperCase()} ${s("crash.nativeCrashTitle")}] ${n?.message||s("crash.nativeUncaughtException")}`,a=n?.stack||"";handleInterceptedCrash(r,a,!0,"native")}))}catch{}try{const e=D||globalThis.__turboModuleProxy,t=v?.ExceptionsManager||(e?.get?e.get("ExceptionsManager"):null);if(t){t.reportFatalException=(o,r,a)=>{handleInterceptedCrash(o,r,!0,"native");try{typeof t.dismissRedbox=="function"&&t.dismissRedbox()}catch{}},t.reportSoftException=(o,r,a)=>{handleInterceptedCrash(o,r,!1,"js");try{typeof t.dismissRedbox=="function"&&t.dismissRedbox()}catch{}},t.reportException=o=>{const r=o?.message||o?.title||s("crash.nativeException"),a=o?.stack||o?.rawStack;handleInterceptedCrash(r,a,o?.isFatal??!0,"js");try{typeof t.dismissRedbox=="function"&&t.dismissRedbox()}catch{}},t.updateExceptionMessage=()=>{};try{typeof t.dismissRedbox=="function"&&t.dismissRedbox()}catch{}}const n=v?.RedBox||v?.RCTRedBox||(e?.get?e.get("RedBox")||e.get("RCTRedBox"):null);n&&(typeof n.showErrorMessage=="function"&&(n.showErrorMessage=()=>{}),typeof n.showUserError=="function"&&(n.showUserError=()=>{}),typeof n.dismiss=="function"&&n.dismiss())}catch{}try{const t=globalThis.ErrorUtils;t&&(typeof t.setGlobalHandler=="function"&&t.setGlobalHandler((n,o)=>{handleInterceptedCrash(n,n?.stack,o??!1,"js")}),typeof t.reportFatalError=="function"&&(t.reportFatalError=n=>{handleInterceptedCrash(n,n?.stack,!0,"js")}),typeof t.reportError=="function"&&(t.reportError=n=>{handleInterceptedCrash(n,n?.stack,!1,"js")}))}catch{}try{const e=globalThis,t=n=>{try{const o=n?.reason||n?.detail?.reason||n,r=o?.
|
|
5
|
+
`)}catch{}};export const exportCrashReport=(e,t="text")=>{if(t==="json")return JSON.stringify(e,null,2);const n=Math.round((e.timestamp-T)/1e3);if(t==="markdown"){const r=[];return r.push(`## ${s("crash.mdReportTitle",{name:e.name||"Error"})}`),r.push(`> **${e.message}**`),r.push(""),r.push(`- **${s("crash.reportType")}** \`${e.type.toUpperCase()}\``),r.push(`- **${s("crash.reportFatal")}** \`${e.isFatal?s("crash.mdSeverityFatal"):s("crash.mdSeverityHandled")}\``),r.push(`- **${s("crash.reportTimestamp")}** ${e.dateStr} ${e.timeStr}`),r.push(`- **${s("crash.reportUptime")}** ${n}s`),r.push(`- **${s("crash.reportPlatform")}** ${e.deviceInfo?.platform?.toUpperCase()} (v${e.deviceInfo?.osVersion})`),r.push(`- **${s("crash.reportReactNative")}** v${e.deviceInfo?.rnVersion||"N/A"}`),r.push(`- **${s("crash.jsEngine")}** ${e.deviceInfo?.isHermes?s("crash.hermesEngine"):s("crash.jsc")}`),r.push(`- **${s("crash.reportArchitecture")}** ${e.deviceInfo?.isFabric?s("crash.reportFabricNew"):s("crash.reportPaperLegacy")}`),e.memoryInfo&&r.push(`- **${s("crash.reportJsMemory")}** ${e.memoryInfo.usedJSHeapSize} MB / ${e.memoryInfo.totalJSHeapSize} MB`),r.push(""),r.push(`### ${s("crash.mdStackTrace")}`),r.push("```"),r.push(e.stack||s("crash.reportNoStackTrace")),r.push("```"),e.componentStack&&(r.push(""),r.push(`### ${s("crash.mdComponentHierarchy")}`),r.push("```"),r.push(e.componentStack),r.push("```")),e.breadcrumbs&&e.breadcrumbs.length>0&&(r.push(""),r.push(`### ${s("crash.mdRecentBreadcrumbs")}`),e.breadcrumbs.forEach(a=>{const d=new Date(a.timestamp).toLocaleTimeString();r.push(`- \`[${d}]\` **[${a.type.toUpperCase()}]** ${a.message}`)})),r.join(`
|
|
6
|
+
`)}const o=[];return o.push("===================================================="),o.push(` ${s("crash.reportTitle")} `),o.push("===================================================="),o.push(`${s("crash.reportErrorName")} ${e.name||"Error"}`),o.push(`${s("crash.reportMessage")} ${e.message}`),o.push(`${s("crash.reportType")} ${e.type.toUpperCase()}`),o.push(`${s("crash.reportFatal")} ${e.isFatal?s("crash.reportFatalYes"):s("crash.reportFatalNo")}`),o.push(`${s("crash.reportTimestamp")} ${e.dateStr} ${e.timeStr} (${e.timestamp})`),o.push(`${s("crash.reportUptime")} ${s("crash.reportUptimeValue",{seconds:n})}`),o.push(`${s("crash.reportPlatform")} ${e.deviceInfo?.platform?.toUpperCase()} (v${e.deviceInfo?.osVersion})`),o.push(`${s("crash.reportReactNative")} ${e.deviceInfo?.rnVersion||"N/A"}`),o.push(`${s("crash.reportHermes")} ${e.deviceInfo?.isHermes?s("crash.reportEnabled"):s("crash.reportDisabled")}`),o.push(`${s("crash.reportArchitecture")} ${e.deviceInfo?.isFabric?s("crash.reportFabricNew"):s("crash.reportPaperLegacy")}`),o.push(`${s("crash.reportScreenSize")} ${z()}`),o.push(`${s("crash.reportAppState")} ${e.deviceInfo?.appState||"active"}`),e.memoryInfo&&o.push(`${s("crash.reportJsMemory")} ${e.memoryInfo.usedJSHeapSize} MB / ${e.memoryInfo.totalJSHeapSize} MB`),o.push("----------------------------------------------------"),o.push(`${s("crash.reportStackTrace")}`),o.push(e.stack||s("crash.reportNoStackTrace")),e.componentStack&&(o.push("----------------------------------------------------"),o.push(`${s("crash.reportComponentHierarchy")}`),o.push(e.componentStack)),e.breadcrumbs&&e.breadcrumbs.length>0&&(o.push("----------------------------------------------------"),o.push(`${s("crash.reportRecentBreadcrumbs")}`),e.breadcrumbs.forEach(r=>{const a=new Date(r.timestamp).toLocaleTimeString();o.push(` [${a}] [${r.type.toUpperCase()}] ${r.message}`)})),o.push("===================================================="),o.join(`
|
|
7
|
+
`)},setupGlobalCrashHandler=()=>{if(!k){k=!0;try{M&&typeof M.ignoreAllLogs=="function"&&M.ignoreAllLogs(!0)}catch{}try{const e=require("react-native/Libraries/LogBox/Data/LogBoxData");e&&typeof e.setDisabled=="function"&&e.setDisabled(!0)}catch{}try{const e=v?.NetworkInspectorModule;e&&(typeof e.enableNativeCrashProtection=="function"&&e.enableNativeCrashProtection(),new F(e).addListener("onNativeCrash",n=>{const r=`[${(n?.platform||y.OS).toUpperCase()} ${s("crash.nativeCrashTitle")}] ${n?.message||s("crash.nativeUncaughtException")}`,a=n?.stack||"";handleInterceptedCrash(r,a,!0,"native")}))}catch{}try{const e=D||globalThis.__turboModuleProxy,t=v?.ExceptionsManager||(e?.get?e.get("ExceptionsManager"):null);if(t){t.reportFatalException=(o,r,a)=>{handleInterceptedCrash(o,r,!0,"native");try{typeof t.dismissRedbox=="function"&&t.dismissRedbox()}catch{}},t.reportSoftException=(o,r,a)=>{handleInterceptedCrash(o,r,!1,"js");try{typeof t.dismissRedbox=="function"&&t.dismissRedbox()}catch{}},t.reportException=o=>{const r=o?.message||o?.title||s("crash.nativeException"),a=o?.stack||o?.rawStack;handleInterceptedCrash(r,a,o?.isFatal??!0,"js");try{typeof t.dismissRedbox=="function"&&t.dismissRedbox()}catch{}},t.updateExceptionMessage=()=>{};try{typeof t.dismissRedbox=="function"&&t.dismissRedbox()}catch{}}const n=v?.RedBox||v?.RCTRedBox||(e?.get?e.get("RedBox")||e.get("RCTRedBox"):null);n&&(typeof n.showErrorMessage=="function"&&(n.showErrorMessage=()=>{}),typeof n.showUserError=="function"&&(n.showUserError=()=>{}),typeof n.dismiss=="function"&&n.dismiss())}catch{}try{const t=globalThis.ErrorUtils;t&&(typeof t.setGlobalHandler=="function"&&t.setGlobalHandler((n,o)=>{handleInterceptedCrash(n,n?.stack,o??!1,"js")}),typeof t.reportFatalError=="function"&&(t.reportFatalError=n=>{handleInterceptedCrash(n,n?.stack,!0,"js")}),typeof t.reportError=="function"&&(t.reportError=n=>{handleInterceptedCrash(n,n?.stack,!1,"js")}))}catch{}try{const e=globalThis,t=n=>{try{const o=n?.reason||n?.detail?.reason||n,r=o?.stack||(n?.stack??new Error().stack);handleInterceptedCrash(o,r,!1,"promise")}catch{}};typeof e.addEventListener=="function"&&e.addEventListener("unhandledrejection",t),typeof e.onunhandledrejection<"u"&&(e.onunhandledrejection=t)}catch{}}};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import R from"axios";import{setupGlobalCrashHandler as
|
|
2
|
-
`);for(let s=0;s<t.length;s++){const n=t[s];if(!(n.includes("networkLogger")||n.includes("node_modules")||n.includes("Error")||n.includes("regeneratorRuntime")))return n.trim().replace(/^at /,"")}}catch{}return"Unknown"}export const subscribeNetworkLogs=e=>(b.push(e),e([...l]),()=>{b=b.filter(t=>t!==e)}),clearNetworkLogs=()=>{l=[],H()},getNetworkLogs=()=>[...l];let w=250;export const setMaxNetworkLogsLimit=e=>{w=Math.max(10,e),l.length>w&&(l=l.slice(0,w),H())},getMaxNetworkLogsLimit=()=>w,pruneNetworkLogs=e=>{const t=e!==void 0?Math.max(0,e):Math.floor(l.length/2),s=l.length-t;return s>0&&(l=l.slice(0,t),H()),Math.max(0,s)};const H=()=>{const e=[...l];b.forEach(t=>t(e))},f=e=>{if(!T)return;const t=e.method?.toUpperCase();if(t&&!A.includes(t)||I(e.url))return;const s=l.findIndex(n=>n.id===e.id);s>=0?l[s]={...l[s],...e}:l.unshift(e),l=l.slice(0,w),H()};let N=!1;export const setupNetworkLogger=()=>{if(globalThis.__NETWORK_LOGGER_INITIALIZED__)return;globalThis.__NETWORK_LOGGER__=f;const e=globalThis.XMLHttpRequest;if(e&&e.prototype&&!globalThis.__XHR_LOGGER_INITIALIZED__){globalThis.__XHR_LOGGER_INITIALIZED__=!0;const s=e.prototype.open,n=e.prototype.send,o=e.prototype.setRequestHeader;e.prototype.open=function(i,r,a,u,d){return this.__logMethod=(i||"GET").toUpperCase(),this.__logUrl=typeof r=="string"?r:String(r),this.__logRequestHeaders={},this.__logStartTime=Date.now(),this.__logCaller=O(),s.apply(this,[i,r,a!==!1,u,d])},e.prototype.setRequestHeader=function(i,r){return i&&r!=null&&(this.__logRequestHeaders||(this.__logRequestHeaders={}),this.__logRequestHeaders[i.toLowerCase()]=String(r)),o.apply(this,[i,r])},e.prototype.send=function(i){if(!T||N||this.__inAppInspectorTracked)return n.apply(this,[i]);const r=this.__logUrl||"",a=this.__logMethod||"GET";if(I(r))return n.apply(this,[i]);const u=k++;this.__logId=u;const d=this.__logStartTime||Date.now(),p=this.__logCaller||"Unknown",c=this.__logRequestHeaders;let _="xhr";c?.["apollographql-client-name"]||r.toLowerCase().includes("/graphql")?_="apollo":p.toLowerCase().includes("axios")&&(_="axios");const m=g?g():null;f({id:u,url:r,method:a,startTime:d,caller:p,client:_,routeInfo:m||void 0,request:a==="GET"?void 0:D(i),requestHeaders:Object.keys(c||{}).length>0?c:void 0});const y=()=>{if(this.__logFinished)return;this.__logFinished=!0;const x=Date.now()-d;let h=null;try{if(this.responseType===""||this.responseType==="text"){const q=this.responseText;try{h=JSON.parse(q)}catch{h=q}}else this.responseType==="json"?h=this.response:this.responseType==="blob"?h=`[Blob: ${this.response?.size||0} bytes]`:h=`[${this.responseType||"Unknown"} Data]`}catch{h=this.response||null}const C=this.getAllResponseHeaders?this.getAllResponseHeaders():"",G=M(C);f({id:u,url:r,method:a,status:this.status,response:h,duration:x,startTime:d,caller:p,client:_,responseHeaders:G})},L=()=>{if(this.__logFinished)return;this.__logFinished=!0;const x=Date.now()-d;f({id:u,url:r,method:a,status:this.status||0,response:"Network request failed",duration:x,startTime:d,caller:p,client:_})};return this.addEventListener("load",y),this.addEventListener("error",L),this.addEventListener("abort",L),this.addEventListener("timeout",L),n.apply(this,[i])}}const t=globalThis.fetch;t&&(globalThis.fetch=async(s,n={})=>{if(!T)return t(s,n);const o=(n?.method||"GET").toUpperCase(),i=k++,r=Date.now(),a=typeof s=="string"?s:s?.url;if(I(a))return t(s,n);let u="Unknown",d,p="fetch";try{d=E(n?.headers),u=O(),d?.["apollographql-client-name"]||a?.toLowerCase().includes("/graphql")?p="apollo":d?.["x-requested-with"]?.toLowerCase().includes("xmlhttprequest")?p="xhr":u?.toLowerCase().includes("axios")&&(p="axios");const c=g?g():null;f({id:i,url:a,method:o,startTime:r,caller:u,client:p,routeInfo:c||void 0,request:o==="GET"?void 0:D(n?.body),requestHeaders:d})}catch{}try{N=!0;let c;try{c=await t(s,n)}finally{N=!1}const _=Date.now()-r;try{const m=E(c.headers);let y=null;if((m?.["content-type"]||m?.["Content-Type"]||"").includes("image/"))y="[Image Data]";else try{const h=await c.clone().text();try{y=JSON.parse(h)}catch{y=h}}catch{}f({id:i,url:a,method:o,status:c.status,response:y,duration:_,startTime:r,caller:u,client:p,responseHeaders:m})}catch{}return c}catch(c){try{f({id:i,url:a,method:o,status:0,startTime:r,response:c,caller:u,client:p,duration:Date.now()-r})}catch{}throw c}});try{if(R){addAxiosInterceptors(R);const s=R.create;typeof s=="function"&&(R.create=function(...n){const o=s.apply(this,n);return addAxiosInterceptors(o),o})}}catch{}try{U()}catch{}globalThis.__NETWORK_LOGGER_INITIALIZED__=!0},addAxiosInterceptors=e=>{e.interceptors.request.use(async t=>{const s=(t.method||"GET").toUpperCase(),n=k++,o=Date.now(),i=O();let r=t.url??"";if(r.startsWith("http")||(r=`${t.baseURL??""}${r}`),I(r))return t;t.__logId=n,t.__logStart=o,t.__logCaller=i;const a=g?g():null;return f({id:n,url:r,method:s,startTime:o,caller:i,client:"axios",routeInfo:a||void 0,request:s==="GET"?void 0:D(t.data),requestHeaders:E(t.headers)}),t}),e.interceptors.response.use(t=>{const s=t.config||{},n=s.__logId,o=s.__logStart,i=s.__logCaller,r=(s.method||"GET").toUpperCase();if(n==null)return t;let a=s.url??"";return a.startsWith("http")||(a=`${s.baseURL??""}${a}`),f({id:n,url:a,method:r,status:t.status,response:t.data,startTime:o||Date.now(),duration:o!=null?Date.now()-o:void 0,caller:i,client:"axios",responseHeaders:E(t.headers)}),t},t=>{const s=t.config||{},n=s.__logId,o=s.__logStart,i=s.__logCaller,r=(s.method||"GET").toUpperCase();if(n!=null){let a=s.url??"";a.startsWith("http")||(a=`${s.baseURL??""}${a}`),f({id:n,url:a,method:r,status:t.response?.status??0,response:t.response?.data??t.message,startTime:o||Date.now(),duration:o!=null?Date.now()-o:void 0,caller:i,client:"axios",responseHeaders:E(t.response?.headers)})}return Promise.reject(t)})};if(typeof globalThis<"u")try{setupNetworkLogger()}catch{}
|
|
1
|
+
import R from"axios";import{setupGlobalCrashHandler as k}from"./crashHandler";let c=[],b=[],w=0,T=!0,f=null;export const setRouteInfoProvider=e=>{f=e},setNetworkModuleEnabled=e=>{T=e},getNetworkModuleEnabled=()=>T;const A=["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS","CONNECT","TRACE"],C=[/\/symbolicate(?:\?|$)/i,/\/index\.bundle(?:\?|$)/i,/\/open-debugger(?:\?|$)/i,/:(?:8081|8082|8083|19000|19001)\/(?:index\.bundle|symbolicate|hot|message|status)/i,/google-analytics\.com\/mp\/collect/i,/analytics\.google\.com/i];function x(e){return e?C.some(t=>t.test(e)):!1}function U(e){if(!e||typeof e!="string")return;const t=e.trim().split(/[\r\n]+/),s={};return t.forEach(n=>{const o=n.indexOf(":");if(o>0){const i=n.substring(0,o).trim().toLowerCase(),r=n.substring(o+1).trim();s[i]=r}}),Object.keys(s).length>0?s:void 0}function m(e){if(!e)return;if(typeof e.forEach=="function"){const n={};return e.forEach((o,i)=>{n[i]=o}),Object.keys(n).length>0?n:void 0}if(Array.isArray(e)){const n={};return e.forEach(([o,i])=>{n[o]=i}),Object.keys(n).length>0?n:void 0}const t=e,s={};return Object.entries(t).forEach(([n,o])=>{o!=null&&(s[n]=String(o))}),Object.keys(s).length>0?s:void 0}function I(e){if(!e)return e;if(e&&e._parts&&Array.isArray(e._parts)){const t={};return e._parts.forEach(s=>{const n=s[0],o=s[1];o&&typeof o=="object"&&o.uri?t[n]={_isFile:!0,name:o.name||"unknown",type:o.type||"unknown",uri:o.uri}:t[n]=o}),{_isFormData:!0,...t}}return e}export const subscribeNetworkLogs=e=>(b.push(e),e([...c]),()=>{b=b.filter(t=>t!==e)}),clearNetworkLogs=()=>{c=[],H()},getNetworkLogs=()=>[...c];let N=1/0;export const setMaxNetworkLogsLimit=e=>{N=e},getMaxNetworkLogsLimit=()=>N,pruneNetworkLogs=e=>{const t=e!==void 0?Math.max(0,e):Math.floor(c.length/2),s=c.length-t;return s>0&&(c=c.slice(0,t),H()),Math.max(0,s)};const H=()=>{const e=[...c];b.forEach(t=>t(e))},h=e=>{if(!T)return;const t=e.method?.toUpperCase();if(t&&!A.includes(t)||x(e.url))return;const s=c.findIndex(n=>n.id===e.id);s>=0?c[s]={...c[s],...e}:c.unshift(e),H()};let D=!1;export const setupNetworkLogger=()=>{if(globalThis.__NETWORK_LOGGER_INITIALIZED__)return;globalThis.__NETWORK_LOGGER__=h;const e=globalThis.XMLHttpRequest;if(e&&e.prototype&&!globalThis.__XHR_LOGGER_INITIALIZED__){globalThis.__XHR_LOGGER_INITIALIZED__=!0;const s=e.prototype.open,n=e.prototype.send,o=e.prototype.setRequestHeader;e.prototype.open=function(i,r,u,d,l){return this.__logMethod=(i||"GET").toUpperCase(),this.__logUrl=typeof r=="string"?r:String(r),this.__logRequestHeaders={},this.__logStartTime=Date.now(),s.apply(this,[i,r,u!==!1,d,l])},e.prototype.setRequestHeader=function(i,r){return i&&r!=null&&(this.__logRequestHeaders||(this.__logRequestHeaders={}),this.__logRequestHeaders[i.toLowerCase()]=String(r)),o.apply(this,[i,r])},e.prototype.send=function(i){if(!T||D||this.__inAppInspectorTracked)return n.apply(this,[i]);const r=this.__logUrl||"",u=this.__logMethod||"GET";if(x(r))return n.apply(this,[i]);const d=w++;this.__logId=d;const l=this.__logStartTime||Date.now(),a=this.__logRequestHeaders;let _="xhr";(a?.["apollographql-client-name"]||r.toLowerCase().includes("/graphql"))&&(_="apollo");const y=f?f():null;h({id:d,url:r,method:u,startTime:l,client:_,routeInfo:y||void 0,request:u==="GET"?void 0:I(i),requestHeaders:Object.keys(a||{}).length>0?a:void 0});const g=()=>{if(this.__logFinished)return;this.__logFinished=!0;const L=Date.now()-l;let p=null;try{if(this.responseType===""||this.responseType==="text"){const O=this.responseText;try{p=JSON.parse(O)}catch{p=O}}else this.responseType==="json"?p=this.response:this.responseType==="blob"?p=`[Blob: ${this.response?.size||0} bytes]`:p=`[${this.responseType||"Unknown"} Data]`}catch{p=this.response||null}const q=this.getAllResponseHeaders?this.getAllResponseHeaders():"",G=U(q);h({id:d,url:r,method:u,status:this.status,response:p,duration:L,startTime:l,client:_,responseHeaders:G})},E=()=>{if(this.__logFinished)return;this.__logFinished=!0;const L=Date.now()-l;h({id:d,url:r,method:u,status:this.status||0,response:"Network request failed",duration:L,startTime:l,client:_})};return this.addEventListener("load",g),this.addEventListener("error",E),this.addEventListener("abort",E),this.addEventListener("timeout",E),n.apply(this,[i])}}const t=globalThis.fetch;t&&(globalThis.fetch=async(s,n={})=>{if(!T)return t(s,n);const o=(n?.method||"GET").toUpperCase(),i=w++,r=Date.now(),u=typeof s=="string"?s:s?.url;if(x(u))return t(s,n);let d,l="fetch";try{d=m(n?.headers),d?.["apollographql-client-name"]||u?.toLowerCase().includes("/graphql")?l="apollo":d?.["x-requested-with"]?.toLowerCase().includes("xmlhttprequest")&&(l="xhr");const a=f?f():null;h({id:i,url:u,method:o,startTime:r,client:l,routeInfo:a||void 0,request:o==="GET"?void 0:I(n?.body),requestHeaders:d})}catch{}try{D=!0;let a;try{a=await t(s,n)}finally{D=!1}const _=Date.now()-r;try{const y=m(a.headers);let g=null;if((y?.["content-type"]||y?.["Content-Type"]||"").includes("image/"))g="[Image Data]";else try{const p=await a.clone().text();try{g=JSON.parse(p)}catch{g=p}}catch{}h({id:i,url:u,method:o,status:a.status,response:g,duration:_,startTime:r,client:l,responseHeaders:y})}catch{}return a}catch(a){try{h({id:i,url:u,method:o,status:0,startTime:r,response:a,client:l,duration:Date.now()-r})}catch{}throw a}});try{if(R){addAxiosInterceptors(R);const s=R.create;typeof s=="function"&&(R.create=function(...n){const o=s.apply(this,n);return addAxiosInterceptors(o),o})}}catch{}try{k()}catch{}globalThis.__NETWORK_LOGGER_INITIALIZED__=!0},addAxiosInterceptors=e=>{e.interceptors.request.use(async t=>{const s=(t.method||"GET").toUpperCase(),n=w++,o=Date.now();let i=t.url??"";if(i.startsWith("http")||(i=`${t.baseURL??""}${i}`),x(i))return t;t.__logId=n,t.__logStart=o;const r=f?f():null;return h({id:n,url:i,method:s,startTime:o,client:"axios",routeInfo:r||void 0,request:s==="GET"?void 0:I(t.data),requestHeaders:m(t.headers)}),t}),e.interceptors.response.use(t=>{const s=t.config||{},n=s.__logId,o=s.__logStart,i=(s.method||"GET").toUpperCase();if(n==null)return t;let r=s.url??"";return r.startsWith("http")||(r=`${s.baseURL??""}${r}`),h({id:n,url:r,method:i,status:t.status,response:t.data,startTime:o||Date.now(),duration:o!=null?Date.now()-o:void 0,client:"axios",responseHeaders:m(t.headers)}),t},t=>{const s=t.config||{},n=s.__logId,o=s.__logStart,i=(s.method||"GET").toUpperCase();if(n!=null){let r=s.url??"";r.startsWith("http")||(r=`${s.baseURL??""}${r}`),h({id:n,url:r,method:i,status:t.response?.status??0,response:t.response?.data??t.message,startTime:o||Date.now(),duration:o!=null?Date.now()-o:void 0,client:"axios",responseHeaders:m(t.response?.headers)})}return Promise.reject(t)})};if(typeof globalThis<"u")try{setupNetworkLogger()}catch{}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { PushNotificationRecord } from '../types';
|
|
2
|
+
export declare function normalizePushPayload(raw: any, options?: Partial<PushNotificationRecord>): PushNotificationRecord;
|
|
3
|
+
export declare function recordPushNotification(payload: any, options?: Partial<PushNotificationRecord>): PushNotificationRecord;
|
|
4
|
+
export declare function recordSalesforcePush(payload: any, options?: Partial<PushNotificationRecord>): PushNotificationRecord;
|
|
5
|
+
export declare function getPushRecords(): PushNotificationRecord[];
|
|
6
|
+
export declare function clearPushRecords(): void;
|
|
7
|
+
export declare function prunePushRecords(keepCount?: number): void;
|
|
8
|
+
export declare function setMaxPushRecordsLimit(limit: number): void;
|
|
9
|
+
export declare function getMaxPushRecordsLimit(): number;
|
|
10
|
+
export declare const emitPushEvent: typeof recordPushNotification;
|
|
11
|
+
export declare function subscribePushEvents(callback: (records: PushNotificationRecord[]) => void): () => void;
|
|
12
|
+
export declare function getDiscoveredPushSources(): string[];
|
|
13
|
+
export declare function simulateTestPush(preset?: 'salesforce' | 'fcm' | 'apns' | 'deeplink' | 'rich_media' | 'custom', customData?: any): PushNotificationRecord;
|
|
14
|
+
export declare function autoSetupPushLogger(options?: {
|
|
15
|
+
messaging?: any;
|
|
16
|
+
notifee?: any;
|
|
17
|
+
expoNotifications?: any;
|
|
18
|
+
marketingCloud?: any;
|
|
19
|
+
}): () => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{AppState as p}from"react-native";let n=[],r=50;const l=new Set;function u(){const e=[...n];l.forEach(t=>{try{t(e)}catch{}})}function g(){return`push_${Date.now()}_${Math.random().toString(36).substring(2,9)}`}export function normalizePushPayload(e,t){if(!e||typeof e!="object")return{id:t?.id||g(),title:t?.title||"Notification",body:t?.body||String(e||""),source:t?.source||"custom",domain:t?.domain||"custom",appState:t?.appState||(p.currentState==="active"?"foreground":"background"),action:t?.action||"received",timestamp:t?.timestamp||Date.now(),data:t?.data||{},rawPayload:e};const o=e.notification||e.aps?.alert||e.alert||e,i=e.data||e.custom||e.customKeys||e.userInfo||e.payload||{},a=t?.id||e.id||e.messageId||e.message_id||e._m||e.identifier||e["gcm.message_id"]||e["google.message_id"]||g(),h=t?.title||(typeof o=="object"?o.title||o.subject||o.headline:null)||i.title||e.title||(typeof e.alert=="string"?e.alert:void 0)||"Push Notification",y=t?.body||(typeof o=="object"?o.body||o.message||o.text||o.alert:null)||i.body||i.message||e.body||e.message||(typeof e.alert=="string"?e.alert:void 0)||"",b=t?.subtitle||(typeof o=="object"?o.subtitle||o.subTitle:null)||i.subtitle||e.subtitle,_=t?.imageUrl||(typeof o=="object"?o.imageUrl||o.image||o.bigPicture:null)||i.imageUrl||i.image||e.imageUrl||e.image||e.fcm_options?.image,f=t?.sound||(typeof o=="object"?o.sound:null)||i.sound||e.sound||e.aps?.sound,m=t?.badge??(typeof e.badge=="number"?e.badge:null)??(typeof e.aps?.badge=="number"?e.aps.badge:null),v=t?.channelId||(typeof o=="object"?o.channelId||o.android?.channelId:null)||i.channelId||e.channelId,S=t?.priority||e.priority||(e.highPriority?"high":void 0);let s=t?.source||"push",c=t?.domain;e._m||e._sid||e._od||e._h||e._r||i._m||i._sid||i.customKeys?(s="salesforce",c="Salesforce Marketing Cloud"):e.ab_||i.ab_||e.braze_id?(s="braze",c="Braze"):e.custom?.i||e.os_||i.os_?(s="onesignal",c="OneSignal"):e.experienceId||e.projectId?(s="expo",c="Expo Notifications"):e["gcm.message_id"]||e.fcm_options||e.from?(s="fcm",c="Firebase Cloud Messaging"):e.aps?(s="apns",c="Apple Push Notification Service"):t?.source&&(s=t.source,c=t.domain||t.source);const d={};s==="salesforce"&&((e._m||i._m)&&(d.messageId=e._m||i._m),(e._sid||i._sid)&&(d.sendId=e._sid||i._sid),(e._od||i._od)&&(d.openDirectUrl=e._od||i._od),(e._h||i._h)&&(d.cloudPageUrl=e._h||i._h),(e._r||i._r)&&(d.receiptUrl=e._r||i._r),(e.customKeys||i.customKeys)&&(d.customKeys=e.customKeys||i.customKeys));const P={...typeof e=="object"?e:{},...typeof i=="object"?i:{},...t?.data||{}},x=p.currentState==="active"?"foreground":"background";return{id:String(a),title:h,body:y,subtitle:b,source:s,domain:c||s,appState:t?.appState||x,action:t?.action||"received",actionId:t?.actionId,userText:t?.userText,timestamp:t?.timestamp||Date.now(),data:P,rawPayload:e,channelId:v,imageUrl:_,sound:f?String(f):void 0,badge:m!=null?Number(m):void 0,collapseKey:e.collapseKey||e.collapse_key,priority:S,customDomainAttributes:Object.keys(d).length>0?d:void 0}}export function recordPushNotification(e,t){const o=normalizePushPayload(e,t);return n.unshift(o),n.length>r&&(n=n.slice(0,r)),u(),o}export function recordSalesforcePush(e,t){return recordPushNotification(e,{source:"salesforce",domain:"Salesforce Marketing Cloud",...t})}export function getPushRecords(){return[...n]}export function clearPushRecords(){n=[],u()}export function prunePushRecords(e=20){n.length>e&&(n=n.slice(0,e),u())}export function setMaxPushRecordsLimit(e){r=Math.max(10,Math.min(e,500)),n.length>r&&(n=n.slice(0,r),u())}export function getMaxPushRecordsLimit(){return r}export const emitPushEvent=recordPushNotification;export function subscribePushEvents(e){return l.add(e),e([...n]),()=>{l.delete(e)}}export function getDiscoveredPushSources(){const e=new Set;return n.forEach(t=>{t.source&&e.add(t.source.toLowerCase())}),Array.from(e)}export function simulateTestPush(e="salesforce",t){const o=Date.now();switch(e){case"salesforce":return recordPushNotification({_m:`sfmc_msg_${Math.floor(Math.random()*9e5+1e5)}`,_sid:"journey_flash_sale_q3",_od:"app://deals/flash-50-off",_h:"https://cloud.email.salesforce.com/pages/view",_r:`receipt_${o}`,title:"\u{1F525} Salesforce Flash 50% Off Sale!",body:"Special VIP weekend access unlocked! Tap to claim your discount.",customKeys:{campaign:"LaborDayPromo",discountCode:"FLASH50",tier:"Diamond VIP",loyaltyPoints:1250},channelId:"promotions",priority:"high"},{source:"salesforce",domain:"Salesforce Marketing Cloud",appState:"foreground",action:"received"});case"fcm":return recordPushNotification({"gcm.message_id":`fcm_${Math.floor(Math.random()*9e6)}`,notification:{title:"\u{1F4E6} Order #98421 Out for Delivery",body:"Your courier is 5 minutes away with your package.",imageUrl:"https://images.unsplash.com/photo-1549465220-1a8b9238cd48?w=300",channelId:"deliveries"},data:{orderId:"ORD-98421",courier:"Express Delivery",trackingUrl:"https://track.example.com/98421"}},{source:"fcm",domain:"Firebase Cloud Messaging",appState:"background",action:"received"});case"apns":return recordPushNotification({aps:{alert:{title:"\u{1F4AC} New Message from Alex",subtitle:"Direct Message",body:"Hey! Are you ready for the team sync at 11 AM?"},badge:3,sound:"chime.aiff","thread-id":"chat_thread_102"},customData:{senderId:"user_alex_84",chatRoomId:"room_dev_sync"}},{source:"apns",domain:"Apple Push (APNs)",appState:"foreground",action:"received"});case"deeplink":return recordPushNotification({id:`dl_${o}`,title:"\u{1F680} Deep Link Received",body:"Tap to navigate to the new payment analytics dashboard.",data:{deepLink:"myapp://analytics/payments?period=monthly",screen:"AnalyticsDetail",sourceCampaign:"in_app_reminder"}},{source:"deeplink",domain:"Custom Deep Link",appState:"foreground",action:"opened"});case"rich_media":return recordPushNotification({id:`rich_${o}`,title:"\u{1F3AC} New Video Available",body:"Watch the product keynote highlights now in HD.",imageUrl:"https://images.unsplash.com/photo-1618005182384-a83a8bd57fbe?w=500",data:{videoId:"vid_launch_2026",category:"Keynotes",duration:340}},{source:"rich_media",domain:"Media Service",appState:"foreground",action:"received"});default:return recordPushNotification(t||{id:`custom_${o}`,title:"\u26A1 Custom Domain Push",body:"This is a flexible dynamic push payload from an arbitrary backend.",data:{domain:"api.mycustomservice.io",event:"custom_alert",nestedData:{level:"high",score:98.4}}},{source:"custom",domain:"Custom API"})}}export function autoSetupPushLogger(e){const t=[];if(e?.messaging)try{const o=typeof e.messaging=="function"?e.messaging():e.messaging;if(typeof o.onMessage=="function"){const i=o.onMessage(async a=>{recordPushNotification(a,{source:"fcm",appState:"foreground",action:"received"})});typeof i=="function"&&t.push(i)}if(typeof o.onNotificationOpenedApp=="function"){const i=o.onNotificationOpenedApp(a=>{recordPushNotification(a,{source:"fcm",appState:"background",action:"opened"})});typeof i=="function"&&t.push(i)}}catch{}if(e?.notifee)try{if(typeof e.notifee.onForegroundEvent=="function"){const o=e.notifee.onForegroundEvent(({type:i,detail:a})=>{recordPushNotification(a.notification,{source:"notifee",appState:"foreground",action:i===1?"opened":"received",actionId:a.pressAction?.id})});typeof o=="function"&&t.push(o)}}catch{}if(e?.marketingCloud)try{typeof e.marketingCloud.setNotificationOpenedListener=="function"&&e.marketingCloud.setNotificationOpenedListener(o=>{recordSalesforcePush(o,{action:"opened",appState:"foreground"})})}catch{}return()=>{t.forEach(o=>{try{o()}catch{}})}}
|
|
@@ -59,6 +59,12 @@ export interface ParsedStackFrame {
|
|
|
59
59
|
copyableLocation: string;
|
|
60
60
|
}
|
|
61
61
|
export declare const parseStackLine: (rawLine: string, isOrigin?: boolean) => ParsedStackFrame;
|
|
62
|
+
export declare const getCleanCallerDisplay: (caller?: string) => {
|
|
63
|
+
fileName: string;
|
|
64
|
+
lineNumber?: string;
|
|
65
|
+
functionName?: string;
|
|
66
|
+
display: string;
|
|
67
|
+
} | null;
|
|
62
68
|
export declare const openInVSCode: (filePath: string, lineNumber?: string | number, columnNumber?: string | number) => void;
|
|
63
69
|
export declare const ANALYTICS_EVENT_PALETTE: string[];
|
|
64
70
|
export declare const getEventColor: (name: string) => string;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import{Platform as
|
|
1
|
+
import{Platform as S,ToastAndroid as y,Alert as E,NativeModules as p,Linking as b}from"react-native";import N from"@react-native-clipboard/clipboard";import{showToast as B}from"./toast";import{copyMediaToClipboard as M}from"../native/NativeInspector";import{AppColors as c}from"../styles/AppColors";import{DOMAIN_COLORS as C,DURATION_FAST_MS as U,DURATION_SLOW_MS as j}from"../constants";export*from"./searchQueryParser";export*from"./memoryManager";export*from"./toast";export const isLocalDebugEnvironment=()=>{const t=typeof __DEV__<"u"&&!!__DEV__,e=p.SourceCode?.scriptURL||"",n=e.startsWith("http://")||e.startsWith("https://")||e.includes(":8081")||e.includes(":8082");return t||n},getDomainColor=t=>{if(!t)return C[0];let e=0;for(let n=0;n<t.length;n++)e=t.charCodeAt(n)+((e<<5)-e);return C[Math.abs(e)%C.length]},formatDateTime=t=>{const e=new Date(t),n=(h,l=2)=>String(h).padStart(l,"0"),r=n(e.getDate()),o=n(e.getMonth()+1),i=e.getFullYear(),s=n(e.getHours()),a=n(e.getMinutes()),d=n(e.getSeconds());return`${r}/${o}/${i} ${s}:${a}:${d}`},formatTimestamp=t=>{try{const e=new Date(t),n=e.getHours().toString().padStart(2,"0"),r=e.getMinutes().toString().padStart(2,"0"),o=e.getSeconds().toString().padStart(2,"0"),i=e.getMilliseconds().toString().padStart(3,"0");return`${n}:${r}:${o}.${i}`}catch{return"\u2014"}},getStatusColor=t=>!t||t===0?c.errorColor:t>=500?c.errorColor:t>=400?c.darkOrange:t>=300?c.warningIconGold:c.greenColor,getDurationColor=t=>t==null?c.grayTextWeak:t<U?c.greenColor:t<j?c.lightOrange:c.errorColor,getSize=t=>{try{const e=JSON.stringify(t)?.length??0;return e<1024?`${e} B`:`${(e/1024).toFixed(1)} KB`}catch{return"\u2014"}},formatBytes=t=>{if(t===0||!t||isNaN(t))return"0 B";const e=1024,n=["B","KB","MB","GB"],r=Math.floor(Math.log(t)/Math.log(e));return`${parseFloat((t/Math.pow(e,r)).toFixed(1))} ${n[r]||"B"}`},copyToClipboard=(t,e)=>{const n=typeof t=="function"?t():t;let r="";if(typeof n=="string")r=n;else try{r=JSON.stringify(n,null,2)}catch{r=String(n)}try{typeof N?.setString=="function"?N.setString(r):typeof N?.default?.setString=="function"&&N.default.setString(r)}catch(o){__DEV__&&console.warn("[NetworkInspector] Clipboard.setString failed:",o)}try{B(e?`${e} copied to clipboard`:"Copied to clipboard")}catch{}try{S.OS==="android"&&y?.show&&y.show(e?`${e} copied to clipboard`:"Copied to clipboard",y.SHORT)}catch{}},copyImageOrMediaToClipboard=async(t,e="Image")=>{if(!t)return;let n=!1;try{n=await M(t)}catch{n=!1}if(!n){copyToClipboard(t,e);return}try{B(`${e} copied to clipboard`)}catch{}try{S.OS==="android"&&y?.show&&y.show(`${e} copied to clipboard`,y.SHORT)}catch{}},getPath=t=>{try{const e=new URL(t);return e.pathname+(e.search?e.search:"")}catch{return t.replace(/^https?:\/\/[^/?#]+/,"")||"/"}},getBaseUrl=t=>{try{const e=new URL(t);return`${e.protocol}//${e.host}`}catch{const e=t.match(/^(https?:\/\/[^/]+)/);return e?e[1]:""}},getCurlCommand=t=>{let e=`curl -X ${t.method} "${t.url}"`;if(t.requestHeaders&&Object.entries(t.requestHeaders).forEach(([n,r])=>{e+=` \\
|
|
2
2
|
-H "${n}: ${r}"`}),t.request&&t.method!=="GET"){const n=typeof t.request=="string"?t.request:JSON.stringify(t.request);e+=` \\
|
|
3
|
-
-d '${n.replace(/'/g,"'\\''")}'`}return e},getFetchCommand=t=>{const e={method:t.method};return t.requestHeaders&&Object.keys(t.requestHeaders).length>0&&(e.headers=t.requestHeaders),t.request&&t.method!=="GET"&&(e.body=JSON.stringify(t.request)),`fetch("${t.url}", ${JSON.stringify(e,null,2)})`},deduplicateLogs=t=>{const e=new Map;return t.forEach(n=>{if(!e.has(n.id))e.set(n.id,n);else{const r=e.get(n.id);(r.status==null&&n.status!=null||(n.startTime??0)>=(r.startTime??0))&&e.set(n.id,n)}}),Array.from(e.values()).sort((n,r)=>r.id-n.id)},escapeRegex=t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),getNavigationInfo=(t,e=[])=>{if(!t)return{path:e.length>0?e.join(" \u2794 "):"",params:null};if(t.name&&!t.routes)return{path:e.length>0?[...e,t.name].join(" \u2794 "):t.name,params:t.params||null};if(!t.routes||!Array.isArray(t.routes)||t.routes.length===0)return{path:e.length>0?e.join(" \u2794 "):"",params:null};const n=typeof t.index=="number"&&t.index>=0&&t.index<t.routes.length?t.index:0,r=t.routes[n];if(!r)return{path:e.length>0?e.join(" \u2794 "):"",params:null};const o=r.name?[...e,r.name]:e;return r?.state?getNavigationInfo(r.state,o):{path:o.length>0?o.join(" \u2794 "):r.name||"",params:r.params||null}},getLogPageName=(t,e)=>{const n=e||t?.routeInfo;if(n&&n.path&&n.path!=="Navigators"){const r=n.path.split(" \u2794 ").map(o=>o.trim()).filter(Boolean);return r.length>0?r[r.length-1]:n.path}if(t.caller&&t.caller!=="Unknown")try{const r=t.caller.match(/([^/\\]+)\.(tsx|jsx|ts|js)/i);if(r&&r[1]){const o=r[1];if(!["networklogger","fetch","axios","apiclient","request","http","index","nativeinspector","inappinspector","bundleanalyzer"].includes(o.toLowerCase()))return o}}catch{}if(t.url)try{const o=t.url.split("?")[0].split("#")[0].replace(/^https?:\/\//i,""),
|
|
3
|
+
-d '${n.replace(/'/g,"'\\''")}'`}return e},getFetchCommand=t=>{const e={method:t.method};return t.requestHeaders&&Object.keys(t.requestHeaders).length>0&&(e.headers=t.requestHeaders),t.request&&t.method!=="GET"&&(e.body=JSON.stringify(t.request)),`fetch("${t.url}", ${JSON.stringify(e,null,2)})`},deduplicateLogs=t=>{const e=new Map;return t.forEach(n=>{if(!e.has(n.id))e.set(n.id,n);else{const r=e.get(n.id);(r.status==null&&n.status!=null||(n.startTime??0)>=(r.startTime??0))&&e.set(n.id,n)}}),Array.from(e.values()).sort((n,r)=>r.id-n.id)},escapeRegex=t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),getNavigationInfo=(t,e=[])=>{if(!t)return{path:e.length>0?e.join(" \u2794 "):"",params:null};if(t.name&&!t.routes)return{path:e.length>0?[...e,t.name].join(" \u2794 "):t.name,params:t.params||null};if(!t.routes||!Array.isArray(t.routes)||t.routes.length===0)return{path:e.length>0?e.join(" \u2794 "):"",params:null};const n=typeof t.index=="number"&&t.index>=0&&t.index<t.routes.length?t.index:0,r=t.routes[n];if(!r)return{path:e.length>0?e.join(" \u2794 "):"",params:null};const o=r.name?[...e,r.name]:e;return r?.state?getNavigationInfo(r.state,o):{path:o.length>0?o.join(" \u2794 "):r.name||"",params:r.params||null}},getLogPageName=(t,e)=>{const n=e||t?.routeInfo;if(n&&n.path&&n.path!=="Navigators"){const r=n.path.split(" \u2794 ").map(o=>o.trim()).filter(Boolean);return r.length>0?r[r.length-1]:n.path}if(t.caller&&t.caller!=="Unknown")try{const r=t.caller.match(/([^/\\]+)\.(tsx|jsx|ts|js)/i);if(r&&r[1]){const o=r[1];if(!["networklogger","fetch","axios","apiclient","request","http","index","nativeinspector","inappinspector","bundleanalyzer"].includes(o.toLowerCase()))return o}}catch{}if(t.url)try{const o=t.url.split("?")[0].split("#")[0].replace(/^https?:\/\//i,""),i=o.indexOf("/");if(i!==-1){const a=o.substring(i+1).split("/").filter(Boolean),d=["api","v1","v2","v3","v4","rest","graphql","json","data","service","app"],h=a.filter(l=>!d.includes(l.toLowerCase()));if(h.length>0){const l=h[0];return l.charAt(0).toUpperCase()+l.slice(1)}}const s=o.split("/")[0];if(s)return s}catch{}return"General"},flattenObject=(t,e="")=>{let n={};return typeof t=="object"&&t!==null?Array.isArray(t)?t.forEach((r,o)=>{Object.assign(n,flattenObject(r,e?`${e}[${o}]`:`[${o}]`))}):Object.keys(t).forEach(r=>{Object.assign(n,flattenObject(t[r],e?`${e}.${r}`:r))}):n[e||"root"]=t,n},getDiff=(t,e)=>{const n=flattenObject(t),r=flattenObject(e),o=[];return new Set([...Object.keys(n),...Object.keys(r)]).forEach(s=>{s in n?s in r?n[s]!==r[s]&&o.push({type:"changed",path:s,oldVal:n[s],newVal:r[s]}):o.push({type:"removed",path:s,oldVal:n[s]}):o.push({type:"added",path:s,newVal:r[s]})}),o.sort((s,a)=>s.path.localeCompare(a.path))},formatDisplayUrl=t=>t?t.startsWith("http://")||t.startsWith("https://")?t:`https://${t}`:"",getLocalizedFilePath=(t,e,n)=>t.replace("country-language",`${e?.toLowerCase()}-${n?.toLowerCase()}`),getLocalizedFilePathWithSlash=(t,e,n)=>t.replace("country/language",`${e?.toLowerCase()}/${n?.toLowerCase()}`),isAllValuesEmpty=t=>!t||typeof t!="object"?!0:Object.values(t).every(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0),formatDateTimeToAnalytics=t=>new Date(t)?.toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"}),getBundleIdentifier=()=>{const t=p.RNDeviceInfo;if(t&&typeof t.bundleId=="string")return t.bundleId;if(t&&typeof t.getBundleId=="function")try{const o=t.getBundleId();if(typeof o=="string")return o}catch{}const e=p.ExponentConstants;if(e&&e.manifest){const o=e.manifest;if(o.ios&&o.ios.bundleIdentifier)return o.ios.bundleIdentifier;if(o.android&&o.android.package)return o.android.package}const n=p.ExpoApplication;if(n&&typeof n.applicationId=="string")return n.applicationId;const r=p.SourceCode;if(r&&typeof r.scriptURL=="string"){const o=r.scriptURL;if(o.includes("assets/"))try{const i=o.match(/assets\/([^/?#]+)/);if(i&&i[1])return i[1]}catch{}}return"org.reactjs.native.example"},getAppName=()=>{const t=p.PlatformConstants;t&&t.interfaceIdiom;const e=p.RNDeviceInfo;if(e&&typeof e.appName=="string")return e.appName;const n=p.ExpoApplication;if(n&&typeof n.applicationName=="string")return n.applicationName;const r=p.ExponentConstants;if(r&&r.manifest){const s=r.manifest;if(s.name)return s.name}const o=p.AppInfo;if(o&&typeof o.appName=="string")return o.appName;const i=getBundleIdentifier();if(i&&i!=="org.reactjs.native.example"){const s=i.split("."),a=s[s.length-1];return a?a.charAt(0).toUpperCase()+a.slice(1):"App"}return"App"},getAppVersionAndBuild=()=>{let t="",e="";const n=p.ExpoApplication;n&&(typeof n.nativeAppVersion=="string"&&(t=n.nativeAppVersion),typeof n.nativeBuildVersion=="string"&&(e=n.nativeBuildVersion));const r=p.ExponentConstants;if(r){const a=r.manifest||r.expoConfig;a&&(!t&&a.version&&(t=String(a.version)),e||(a.ios?.buildNumber?e=String(a.ios.buildNumber):a.android?.versionCode&&(e=String(a.android.versionCode))))}const o=p.RNDeviceInfo;if(o){if(!t){if(typeof o.appVersion=="string")t=o.appVersion;else if(typeof o.getVersion=="function")try{t=o.getVersion()}catch{}}if(!e){if(typeof o.buildNumber=="string")e=o.buildNumber;else if(typeof o.getBuildNumber=="function")try{e=o.getBuildNumber()}catch{}}}const i=S.constants||p.PlatformConstants;if(i&&(!t&&i.Version&&typeof i.Version=="string"&&i.Version.includes(".")&&(t=i.Version),!t&&i.reactNativeVersion)){const a=i.reactNativeVersion;a.major!==void 0&&(t=`${a.major}.${a.minor}.${a.patch}`)}const s=p.AppInfo;return s&&(!t&&typeof s.versionName=="string"&&(t=s.versionName),!e&&typeof s.versionCode=="string"&&(e=s.versionCode)),t||(t="1.0.0"),e||(e="1"),{version:t,build:e,formatted:`${t} (${e})`}},handleOpenExternalLink=t=>{if(!t)return;const e=formatDisplayUrl(t);E.alert("Open Link",`Do you want to open this link in your web browser?
|
|
4
4
|
|
|
5
|
-
${e}`,[{text:"Cancel",style:"cancel"},{text:"Open",onPress:()=>{
|
|
5
|
+
${e}`,[{text:"Cancel",style:"cancel"},{text:"Open",onPress:()=>{b.openURL(e).catch(()=>{})}}])},formatTimeShort=t=>{const e=new Date(t),n=String(e.getHours()).padStart(2,"0"),r=String(e.getMinutes()).padStart(2,"0"),o=String(e.getSeconds()).padStart(2,"0");return`${n}:${r}:${o}`},formatTime=t=>{const e=new Date(t),n=String(e.getHours()).padStart(2,"0"),r=String(e.getMinutes()).padStart(2,"0"),o=String(e.getSeconds()).padStart(2,"0"),i=String(e.getMilliseconds()).padStart(3,"0");return`${n}:${r}:${o}.${i}`},formatGap=t=>{if(t<1e3)return`+${t}ms`;const e=Math.round(t/1e3);if(e<60)return`+${e}s`;const n=Math.floor(e/60),r=e%60;return r>0?`+${n}m ${r}s`:`+${n}m`},getJsonContent=t=>{if(!t)return null;const e=[];for(let n=0;n<t.length;n++)(t[n]==="{"||t[n]==="[")&&e.push(n);for(const n of e){const r=t.substring(n).trim();try{const o=JSON.parse(r);if(o!==null&&typeof o=="object")return{header:t.substring(0,n).trim(),data:o}}catch{}}return null},getJsonPreviewText=(t,e=4)=>{try{const n=JSON.stringify(t,null,2),r=n.split(`
|
|
6
6
|
`);return r.length>e?{text:r.slice(0,e).join(`
|
|
7
7
|
`)+`
|
|
8
|
-
...`,hasMore:!0}:{text:n,hasMore:!1}}catch{return{text:String(t),hasMore:!1}}},parseStackLine=(t,e=!1)=>{let n=t.trim().replace(/^at /,"");if(n.includes("@")){const O=n.indexOf("@"),I=n.substring(0,O).trim(),_=n.substring(O+1).trim();n=I?`${I} (${_})`:_}const r=n.match(/^(.*?)\s*\((.*?)\)$/);let o="<anonymous>",
|
|
8
|
+
...`,hasMore:!0}:{text:n,hasMore:!1}}catch{return{text:String(t),hasMore:!1}}},parseStackLine=(t,e=!1)=>{let n=t.trim().replace(/^at /,"");if(n.includes("@")){const O=n.indexOf("@"),I=n.substring(0,O).trim(),_=n.substring(O+1).trim();n=I?`${I} (${_})`:_}const r=n.match(/^(.*?)\s*\((.*?)\)$/);let o="<anonymous>",i=n;r&&(o=r[1].trim()||"<anonymous>",i=r[2].trim()),(o.startsWith("?anon_")||o==="?")&&(o="anonymous"),i=i.replace(/^address at /,"");const s=i.match(/^(.*?):(\d+):(\d+)$/);let a=i,d,h;s&&(a=s[1],d=s[2],h=s[3]);let l=a.replace(/[?&].*$/,"").replace(/[)]+$/,"").replace(/\/\/+$/,"");l=l.replace(/^(?:https?:\/\/[^\/]+\/|file:\/\/\/|webpack:\/\/\/?)/,"");let u=l.split("/").filter(Boolean).pop()||l;u=u.replace(/[?&].*$/,"").replace(/[)]+$/,""),(u.startsWith("&")||u.startsWith("?")||u.startsWith("platform=")||u.includes("platform=")||u.startsWith("dev=")||u.includes("dev="))&&(u="Unknown",l="Unknown");const x=u.match(/\.([a-z0-9]+)$/i),f=x?x[1].toLowerCase():"",g=f==="tsx"||f==="jsx"||f==="ts"||f==="js"?f:"other",$=i==="native"||l==="native",v=l.includes("InternalBytecode")||l.includes("metro-runtime")||l.includes("regenerator-runtime")||o==="tryCallOne"||o==="asyncGeneratorStep"||o==="_next"||o==="next"&&$,w=l.includes("node_modules")||l.includes("react-native/Libraries")||l.includes("react-native-inapp-inspector")&&!l.includes("/example/"),A=!$&&!v&&!w&&(g==="tsx"||g==="jsx"||g==="ts"||g==="js"||!u.includes(".bundle")&&u!=="Unknown"),L=A?"app":w?"dependency":$?"native":"runtime",T=v||$||o==="asyncGeneratorStep"||o==="_next";let m=l;m.includes("/example/")?m=m.substring(m.indexOf("/example/")+9):m.includes("/src/")?m=m.substring(m.indexOf("/src/")+1):m.includes("/node_modules/")&&(m=m.substring(m.indexOf("/node_modules/")+14));const D=d?`${u}:${d}${h?`:${h}`:""}`:u;return{raw:t,functionName:o,fileName:u,fullPath:m,rawFilePath:a,fileExt:g,frameType:L,isUserCode:A,isRuntimeNoise:T,lineNumber:d,columnNumber:h,isOrigin:e,copyableLocation:D}},getCleanCallerDisplay=t=>{if(!t||t==="Unknown"||t.trim()==="")return null;const e=t.trim();if(e.startsWith("&platform")||e.startsWith("?platform")||e.startsWith("&")||e.includes("&platform=")||e.includes("?platform=")){const i=e.match(/^(.*?)\s*[\(@]/);if(i&&i[1]&&!i[1].includes("&")&&!i[1].includes("platform")){const s=i[1].trim();if(s&&s!=="<anonymous>"&&s!=="anonymous"&&!s.startsWith("?anon_"))return{fileName:s,functionName:s,display:s}}return null}const n=parseStackLine(t,!0);if(!n)return null;if(n.fileName.includes(".bundle")||n.fileName.includes("platform=")||n.fileName.startsWith("&")||n.fileName.startsWith("?")||n.fileName==="index.bundle"||n.fileName==="bundle"||n.fileName==="Unknown")return n.functionName&&n.functionName!=="<anonymous>"&&n.functionName!=="anonymous"&&!n.functionName.startsWith("?")&&!n.functionName.startsWith("_callee")&&!n.functionName.includes("regeneratorRuntime")?{fileName:n.functionName,lineNumber:n.lineNumber,functionName:n.functionName,display:n.functionName}:null;const o=n.lineNumber?`${n.fileName}:${n.lineNumber}`:n.fileName;return{fileName:n.fileName,lineNumber:n.lineNumber,functionName:n.functionName,display:o}},openInVSCode=(t,e,n)=>{const r=e?Number(e):1,o=n?Number(n):1,i=e?`:${e}`:"",s=n?`:${n}`:"",a=t.replace(/^file:\/\//,"");let d=null;try{const f=p?.SourceCode?.scriptURL||p?.PlatformConstants?.serverHost||p?.DevSettings?.serverHost;if(typeof f=="string"&&f.length>0){const g=f.match(/^(https?:\/\/[^/]+)/);g?d=g[1]:!f.startsWith("http")&&f.includes(":")&&(d=`http://${f}`)}}catch{}Array.from(new Set([...d?[d]:[],"http://localhost:8081","http://127.0.0.1:8081","http://10.0.2.2:8081"])).forEach(f=>{try{fetch(`${f}/open-stack-frame`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({file:a,lineNumber:r,column:o})}).catch(()=>{})}catch{}});const l=`vscode://file/${a.replace(/^\/+/,"")}${i}${s}`,u=`cursor://file/${a.replace(/^\/+/,"")}${i}${s}`,x=`vscode-insiders://file/${a.replace(/^\/+/,"")}${i}${s}`;b.openURL(l).catch(()=>{b.openURL(u).catch(()=>{b.openURL(x).catch(()=>{copyToClipboard(`${a}${i}${s}`,"Location")})})})},ANALYTICS_EVENT_PALETTE=[c.googleBlue,c.googleGreen,c.googlePurple,c.googleTeal,c.googleRed,c.googleOrange,c.blue700,c.materialGreen],getEventColor=t=>{const e=typeof t=="string"?t:String(t||"");let n=0;for(let r=0;r<e.length;r++)n=n*31+e.charCodeAt(r)|0;return ANALYTICS_EVENT_PALETTE[Math.abs(n)%ANALYTICS_EVENT_PALETTE.length]};export{getEventCategory,registerGAPlugin}from"./gaAnalyticsRegistry";export const getCategoryColors=t=>{switch(t){case"page_view":case"Page View":return{bg:c.blueBg,border:c.blueBorder,text:c.blue800};case"ecommerce":case"Ecommerce":return{bg:c.greenBg,border:c.greenBorder,text:c.materialGreen};case"system":case"System":return{bg:c.greyBg,border:c.greyBorder,text:c.grey600};default:return{bg:c.purpleBg,border:c.purpleBorder,text:c.purpleText}}},getRuntimeDiagnostics=()=>{const t=typeof global.HermesInternal<"u",e=typeof global._v8runtime<"u",n=t?"hermes":e?"v8":"jsc",o=typeof global.nativeFabricUIManager<"u"||!!global.__turboModuleProxy?"fabric":"paper";let i=32.4,s=64;try{const a=global.HermesInternal?.getInstrumentedStats?.();a?.js_heap_size?(i=Number((a.js_heap_size/(1024*1024)).toFixed(1)),s=Number(((a.js_allocated_bytes||a.js_heap_size*1.6)/(1024*1024)).toFixed(1))):global.performance?.memory?.usedJSHeapSize&&(i=Number((global.performance.memory.usedJSHeapSize/(1024*1024)).toFixed(1)),s=Number((global.performance.memory.totalJSHeapSize/(1024*1024)).toFixed(1)))}catch{}return{engineType:n,archType:o,usedHeapMb:i,totalAllocMb:s}};
|
|
@@ -5,12 +5,12 @@ export interface MemoryPruneSummary {
|
|
|
5
5
|
prunedRedux: number;
|
|
6
6
|
prunedAnalytics: number;
|
|
7
7
|
prunedCrashes: number;
|
|
8
|
-
|
|
8
|
+
prunedPush: number;
|
|
9
9
|
totalPruned: number;
|
|
10
10
|
triggeredBy: 'memory-warning' | 'manual' | 'ram-threshold';
|
|
11
11
|
}
|
|
12
12
|
type MemoryWarningListener = (summary: MemoryPruneSummary) => void;
|
|
13
|
-
export declare const pruneAllLogs: (triggeredBy?: MemoryPruneSummary["triggeredBy"],
|
|
13
|
+
export declare const pruneAllLogs: (triggeredBy?: MemoryPruneSummary["triggeredBy"], _targetRetentionPct?: number) => MemoryPruneSummary;
|
|
14
14
|
export declare const setupMemoryWarningHandler: () => (() => void);
|
|
15
15
|
export declare const subscribeMemoryWarning: (listener: MemoryWarningListener) => (() => void);
|
|
16
16
|
export declare const getLastPruneTimestamp: () => number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{AppState as
|
|
1
|
+
import{AppState as f}from"react-native";import{pruneNetworkLogs as g}from"../customHooks/networkLogger";import{pruneConsoleLogs as h}from"../customHooks/consoleLogger";import{pruneReduxHistory as x}from"../customHooks/reduxLogger";import{pruneAnalyticsLogs as L}from"../customHooks/analyticsLogger";import{pruneCrashRecords as w,addCrashBreadcrumb as A}from"../customHooks/crashHandler";import{prunePushRecords as M}from"../customHooks/pushNotificationLogger";import{showToast as P}from"./toast";const o=new Set;let r=null,t=!1,s=0;export const pruneAllLogs=(e="manual",a=.5)=>{const u=g(void 0),c=h(void 0),m=x(void 0),i=L(void 0),p=w(void 0),d=0;M(20);const l=u+c+m+i+p+d;if(s=Date.now(),typeof globalThis.gc=="function")try{globalThis.gc()}catch{}const n={timestamp:s,prunedNetwork:u,prunedConsole:c,prunedRedux:m,prunedAnalytics:i,prunedCrashes:p,prunedPush:d,totalPruned:l,triggeredBy:e};try{A("system",`[MemoryManager] Low memory auto-prune executed (${e}). Freed ${l} log records.`,n)}catch{}return o.forEach(y=>{try{y(n)}catch{}}),n},setupMemoryWarningHandler=()=>{if(t)return()=>{};t=!0;try{r=f.addEventListener("memoryWarning",e=>{const a=pruneAllLogs("memory-warning",.5);try{P(`Memory Warning: Auto-pruned ${a.totalPruned} inspector logs`)}catch{}})}catch{}return()=>{if(r){try{r.remove()}catch{}r=null}t=!1}},subscribeMemoryWarning=e=>(o.add(e),()=>{o.delete(e)}),getLastPruneTimestamp=()=>s,isMemoryHandlerActive=()=>t;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const l=["apis","logs","analytics","redux","storage","device","crash","
|
|
1
|
+
const l=["apis","logs","analytics","redux","storage","device","crash","debugging"];let u=null;export function getFirebaseRemoteConfig(t){if(t&&typeof t=="object")return u=t,t;if(u)return u;try{const n=require("@react-native-firebase/remote-config"),e=typeof n.default=="function"?n.default():typeof n=="function"?n():n;return u=e,e}catch{return null}}export function isFirebaseRemoteConfigAvailable(t){return!!getFirebaseRemoteConfig(t)}function p(t){if(t!=null){if(typeof t=="boolean")return t;if(typeof t=="number")return t!==0;if(typeof t=="string"){const n=t.trim().toLowerCase();if(n==="true"||n==="1"||n==="enabled"||n==="on")return!0;if(n==="false"||n==="0"||n==="disabled"||n==="off")return!1;try{return JSON.parse(t)}catch{return}}if(typeof t.asBoolean=="function")return t.asBoolean();if(typeof t.asString=="function"){const n=t.asString(),e=n.trim().toLowerCase();if(e==="true"||e==="1"||e==="enabled"||e==="on")return!0;if(e==="false"||e==="0"||e==="disabled"||e==="off")return!1;try{return JSON.parse(n)}catch{return}}}}export async function fetchRemoteConfigModuleStatus(t,n=8e3){const e=getFirebaseRemoteConfig(t);if(!e)return null;try{const a=(async()=>{typeof e.fetchAndActivate=="function"?await e.fetchAndActivate():(typeof e.fetch=="function"&&await e.fetch(),typeof e.activate=="function"&&await e.activate())})(),d=new Promise((o,i)=>setTimeout(()=>i(new Error("Remote Config fetch timeout")),n));await Promise.race([a,d]).catch(()=>{});const c={},y=["inspector_modules","inapp_inspector_modules","react_native_inapp_inspector_modules"];for(const o of y){let i;if(typeof e.getValue=="function")try{i=e.getValue(o)}catch{}else e[o]!==void 0&&(i=e[o]);const r=p(i);if(r&&typeof r=="object")for(const f of l)typeof r[f]=="boolean"&&(c[f]=r[f])}for(const o of l){const i=[`inspector_module_${o}`,`inapp_inspector_${o}`,`inspector_${o}`,`inapp_inspector_module_${o}`,`rn_inspector_${o}`];for(const r of i){let f;if(typeof e.getValue=="function")try{f=e.getValue(r)}catch{}else e[r]!==void 0&&(f=e[r]);const s=p(f);if(typeof s=="boolean"){c[o]=s;break}}}return c.apis===void 0&&(c.apis=!0),Object.keys(c).length>0?c:null}catch{return null}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Platform as n,Settings as c}from"react-native";import{getNativeStorageItem as
|
|
1
|
+
import{Platform as n,Settings as c}from"react-native";import{getNativeStorageItem as l,setNativeStorageItem as u,isNativeModuleAvailable as i}from"../native/NativeInspector";const m=new Map;let s=null;export function setCustomStorage(t){s=t}const e="rn-inapp-inspector.settings.v1";export async function loadSettings(){try{if(s){const r=await s.getItem(e);if(!r)return{};const o=JSON.parse(r);return o&&typeof o=="object"?o:{}}if(i()){const r=await l(e);if(r){const o=JSON.parse(r);return o&&typeof o=="object"?o:{}}}if(n.OS==="ios"){const r=c.get(e);if(!r)return{};if(typeof r=="string"){const o=JSON.parse(r);return o&&typeof o=="object"?o:{}}return r&&typeof r=="object"?r:{}}const t=m.get(e);if(!t)return{};const a=JSON.parse(t);return a&&typeof a=="object"?a:{}}catch{return{}}}export function saveSettings(t){try{const a=JSON.stringify(t);if(s){s.setItem(e,a);return}if(i()&&u(e,a),n.OS==="ios"){c.set({[e]:a});return}m.set(e,a)}catch{}}export async function clearPersistedSettings(){try{if(s){typeof s.removeItem=="function"?await s.removeItem(e):await s.setItem(e,"");return}if(i()&&await u(e,null),n.OS==="ios"){c.set({[e]:null});return}m.delete(e)}catch{}}export const isPersistentStorageAvailable=()=>s!==null||i()||n.OS==="ios";export function getCustomStorage(){return s}export function calculateRamBasedLimits(t){return t>=3e3?{maxNetworkLogs:500,maxConsoleLogs:500,maxAnalyticsEvents:300,maxCrashRecords:150,maxPushRecords:100,profileName:"High-End",freeRamMb:t}:t>=1500?{maxNetworkLogs:300,maxConsoleLogs:300,maxAnalyticsEvents:200,maxCrashRecords:100,maxPushRecords:75,profileName:"Standard",freeRamMb:t}:t>=600?{maxNetworkLogs:200,maxConsoleLogs:200,maxAnalyticsEvents:100,maxCrashRecords:50,maxPushRecords:50,profileName:"Compact",freeRamMb:t}:{maxNetworkLogs:100,maxConsoleLogs:100,maxAnalyticsEvents:50,maxCrashRecords:25,maxPushRecords:25,profileName:"Ultra-Light",freeRamMb:t}}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { AnalyticsEvent, ConsoleLog, CrashRecord, NetworkLog, PushNotificationRecord, ReduxHistoryEntry } from '../types';
|
|
2
|
+
export declare function formatApiReport(log: NetworkLog): string;
|
|
3
|
+
export declare function formatPushReport(record: PushNotificationRecord): string;
|
|
4
|
+
export declare function formatCrashReport(crash: CrashRecord): string;
|
|
5
|
+
export declare function formatAnalyticsReport(event: AnalyticsEvent): string;
|
|
6
|
+
export declare function formatReduxReport(action: ReduxHistoryEntry): string;
|
|
7
|
+
export declare function formatLogReport(log: ConsoleLog): string;
|
|
8
|
+
export declare function shareApiReport(log: NetworkLog): Promise<void>;
|
|
9
|
+
export declare function sharePushReport(record: PushNotificationRecord): Promise<void>;
|
|
10
|
+
export declare function shareCrashReport(crash: CrashRecord): Promise<void>;
|
|
11
|
+
export declare function shareAnalyticsReport(event: AnalyticsEvent): Promise<void>;
|
|
12
|
+
export declare function shareReduxReport(action: ReduxHistoryEntry): Promise<void>;
|
|
13
|
+
export declare function shareLogReport(log: ConsoleLog): Promise<void>;
|