react-native-inapp-inspector 2.3.25 → 2.4.1
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 +9 -6
- package/dist/commonjs/components/AppHeaderLogo.js +4 -6
- package/dist/commonjs/components/Inspector/AnalyticsFilterModal.js +1 -1
- package/dist/commonjs/components/Inspector/AnalyticsTab.js +18 -22
- package/dist/commonjs/components/Inspector/ConsoleTab.js +13 -16
- package/dist/commonjs/components/Inspector/CrashDetail.js +7 -6
- package/dist/commonjs/components/Inspector/CrashTab.js +23 -23
- package/dist/commonjs/components/Inspector/DebuggingTab.js +6 -6
- package/dist/commonjs/components/Inspector/DeviceInfoTab.js +77 -43
- 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 +67 -29
- 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/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 +18 -28
- package/dist/commonjs/components/Inspector/SettingsPanel.js +253 -105
- package/dist/commonjs/components/Inspector/StorageTab.js +40 -40
- package/dist/commonjs/components/Inspector/TabBar.js +9 -8
- package/dist/commonjs/components/Inspector/UpdateAvailableModal.js +2 -2
- package/dist/commonjs/components/JsonViewer.js +77 -90
- package/dist/commonjs/components/LogCard.js +9 -6
- 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 +4 -1
- package/dist/commonjs/components/SegmentedTabs.js +12 -8
- package/dist/commonjs/components/ShareButton.d.ts +11 -0
- package/dist/commonjs/components/ShareButton.js +6 -0
- 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 -1
- package/dist/commonjs/customHooks/pushNotificationLogger.d.ts +19 -0
- package/dist/commonjs/customHooks/pushNotificationLogger.js +1 -0
- package/dist/commonjs/helpers/memoryManager.d.ts +2 -1
- package/dist/commonjs/helpers/memoryManager.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/locales/en.json +1 -1
- package/dist/commonjs/index.d.ts +5 -2
- 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/types/enums.d.ts +30 -0
- 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 +28 -25
- package/dist/esm/components/AppHeaderLogo.js +5 -7
- package/dist/esm/components/Inspector/AnalyticsFilterModal.js +14 -14
- package/dist/esm/components/Inspector/AnalyticsTab.js +36 -40
- package/dist/esm/components/Inspector/ConsoleTab.js +52 -55
- package/dist/esm/components/Inspector/CrashDetail.js +11 -10
- package/dist/esm/components/Inspector/CrashTab.js +23 -23
- package/dist/esm/components/Inspector/DebuggingTab.js +10 -10
- package/dist/esm/components/Inspector/DeviceInfoTab.js +208 -174
- 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 +100 -62
- 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 +136 -134
- 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 +109 -119
- package/dist/esm/components/Inspector/SettingsPanel.js +406 -258
- package/dist/esm/components/Inspector/StorageTab.js +174 -174
- package/dist/esm/components/Inspector/TabBar.js +28 -27
- package/dist/esm/components/Inspector/UpdateAvailableModal.js +1 -1
- package/dist/esm/components/JsonViewer.js +101 -114
- package/dist/esm/components/LogCard.js +25 -22
- 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 +4 -1
- 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/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 -1
- package/dist/esm/customHooks/pushNotificationLogger.d.ts +19 -0
- package/dist/esm/customHooks/pushNotificationLogger.js +1 -0
- package/dist/esm/helpers/memoryManager.d.ts +2 -1
- package/dist/esm/helpers/memoryManager.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/locales/en.json +1 -1
- package/dist/esm/index.d.ts +5 -2
- 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/types/enums.d.ts +30 -0
- 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 -10
- package/src/native/NativeInspector.ts +0 -1
- package/dist/commonjs/components/BrandSquareIcon.d.ts +0 -5
- package/dist/commonjs/components/BrandSquareIcon.js +0 -112
- package/dist/esm/components/BrandSquareIcon.d.ts +0 -5
- package/dist/esm/components/BrandSquareIcon.js +0 -112
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
import
|
|
1
|
+
import re from"react";import{useTranslation as ae}from"../../i18n";import{Alert as le,Image as Te,Linking as $,Pressable as P,ScrollView as Ce,Text as C,TextInput as L,View as T}from"react-native";import{animateNextLayout as Se,useInspector as Re}from"./InspectorContext";import K from"../TouchableScale";import Ve from"../SegmentedTabs";import De from"../MetaAccordion";import J from"../HeadersSection";import Be from"../SourcePageCard";import _ from"../SectionHeader";import G from"../JsonViewer";import Q from"../DiffViewer";import O from"../CopyButton";import Ie from"../ShareButton";import o from"../../styles";import{AppColors as t}from"../../styles/AppColors";import{AppFonts as R}from"../../styles/AppFonts";import{METHOD_COLORS as X}from"../../constants";import{getStatusColor as z,getSize as Y,formatDateTime as He,getFetchCommand as $e,getCurlCommand as qe}from"../../helpers";import{shareApiReport as Pe}from"../../helpers/shareFormatter";import{FailIcon as We,StatusIcon as Le,HeadersIcon as Oe,RequestIcon as Fe,ResponseIcon as Ue,DownloadIcon as Ae,ClearIcon as F,SizeIcon as Ee,ExternalLinkIcon as Me,ClockIcon as Ne}from"../NetworkIcons";const Ke=re.memo(()=>{const{t:b}=ae(),{selected:e,detailDisplayUrl:S,apiDetailActiveTab:D,setApiDetailActiveTab:Z,detailSearch:k,setDetailSearch:V,reqExpanded:B,setReqExpanded:U,resExpanded:I,setResExpanded:A,showReqDiff:v,setShowReqDiff:ee,showResDiff:W,setShowResDiff:te,prevRequestData:E,prevResponseData:M,logRouteMapRef:oe}=Re(),N=()=>{le.alert(b("common.openInBrowser")||"Open in Browser",`${b("common.openInBrowserPrompt")||"Are you sure you want to open this URL in your external browser?"}
|
|
2
2
|
|
|
3
|
-
${
|
|
3
|
+
${S}`,[{text:b("common.cancel")||"Cancel",style:"cancel"},{text:b("common.open")||"Open",onPress:()=>{$.canOpenURL(S).then(r=>{r?$.openURL(S):$.openURL(S).catch(()=>{})}).catch(()=>{})}}])};return e?<T style={{flex:1}}>
|
|
4
4
|
|
|
5
5
|
<T style={{paddingHorizontal:8,paddingTop:4}}>
|
|
6
|
-
<T style={
|
|
7
|
-
{(()=>{
|
|
6
|
+
<T style={o.detailInfoBar}>
|
|
7
|
+
{(()=>{const r=S.indexOf("://"),H=r!==-1?S.substring(0,r+3):"";return<>
|
|
8
8
|
|
|
9
9
|
<T style={{flexDirection:"row",alignItems:"center",justifyContent:"space-between",flexWrap:"wrap",gap:6,paddingBottom:8,borderBottomWidth:1,borderBottomColor:t.dividerColor}}>
|
|
10
10
|
<T style={{flexDirection:"row",alignItems:"center",gap:5,flexWrap:"wrap",flex:1}}>
|
|
11
11
|
|
|
12
|
-
<T style={[
|
|
13
|
-
<
|
|
12
|
+
<T style={[o.methodBadge,{backgroundColor:X[e.method]??X.ALL,paddingHorizontal:8,paddingVertical:3.5,borderRadius:6}]}>
|
|
13
|
+
<C style={[o.methodBadgeText,{color:t.white,fontSize:10.5,fontFamily:R.interBold}]}>
|
|
14
14
|
{e.method}
|
|
15
|
-
</
|
|
15
|
+
</C>
|
|
16
16
|
</T>
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
{e.client&&<T style={[
|
|
20
|
-
<
|
|
19
|
+
{e.client&&<T style={[o.chip,{backgroundColor:e.client==="axios"?`${t.purple}14`:e.client==="apollo"||e.client==="graphql"?`${t.pink500}14`:e.client==="xhr"?`${t.amber500}14`:`${t.sky500}14`,borderColor:e.client==="axios"?`${t.purple}30`:e.client==="apollo"||e.client==="graphql"?`${t.pink500}30`:e.client==="xhr"?`${t.amber500}30`:`${t.sky500}30`,paddingHorizontal:6,paddingVertical:3,borderRadius:6}]}>
|
|
20
|
+
<C style={[o.chipText,{fontFamily:R.interBold,fontSize:9.5,color:e.client==="axios"?t.purple:e.client==="apollo"||e.client==="graphql"?t.pink500:e.client==="xhr"?t.amber700:t.sky600}]}>
|
|
21
21
|
{e.client.toUpperCase()}
|
|
22
|
-
</
|
|
22
|
+
</C>
|
|
23
23
|
</T>}
|
|
24
24
|
|
|
25
25
|
|
|
26
|
-
{e.status!=null&&<T style={[
|
|
27
|
-
{e.status===0?<
|
|
28
|
-
<
|
|
26
|
+
{e.status!=null&&<T style={[o.chip,{backgroundColor:e.status===0?`${t.errorColor}18`:`${z(e.status)}18`,borderColor:e.status===0?`${t.errorColor}40`:`${z(e.status)}40`,paddingHorizontal:7,paddingVertical:3,borderRadius:6}]}>
|
|
27
|
+
{e.status===0?<We size={8}color={t.errorColor}/>:<T style={{width:6,height:6,borderRadius:3,backgroundColor:z(e.status)}}/>}
|
|
28
|
+
<C style={[o.chipText,{color:e.status===0?t.errorColor:z(e.status),fontFamily:R.interBold,fontSize:10.5}]}>
|
|
29
29
|
{e.status===0?"Failed":`${e.status} ${e.status===200?"OK":""}`}
|
|
30
|
-
</
|
|
30
|
+
</C>
|
|
31
31
|
</T>}
|
|
32
32
|
|
|
33
33
|
|
|
34
|
-
{e.duration!=null&&<T style={[
|
|
35
|
-
<
|
|
36
|
-
<
|
|
34
|
+
{e.duration!=null&&<T style={[o.chip,{backgroundColor:`${t.brandPurple}14`,borderColor:`${t.brandPurple}30`,paddingHorizontal:7,paddingVertical:3,borderRadius:6,gap:4}]}>
|
|
35
|
+
<Ne color={t.brandPurple}size={10}/>
|
|
36
|
+
<C style={[o.chipText,{color:t.brandPurple,fontFamily:R.interBold,fontSize:10.5}]}>
|
|
37
37
|
{e.duration}ms
|
|
38
|
-
</
|
|
38
|
+
</C>
|
|
39
39
|
</T>}
|
|
40
40
|
|
|
41
41
|
|
|
42
|
-
{e.response!=null&&<T style={[
|
|
43
|
-
<
|
|
44
|
-
<
|
|
45
|
-
{
|
|
46
|
-
</
|
|
42
|
+
{e.response!=null&&<T style={[o.chip,{backgroundColor:`${t.sky600}14`,borderColor:`${t.sky600}30`,paddingHorizontal:7,paddingVertical:3,borderRadius:6,gap:4}]}>
|
|
43
|
+
<Ee color={t.sky600}size={10}/>
|
|
44
|
+
<C style={[o.chipText,{color:t.sky600,fontFamily:R.interBold,fontSize:10.5}]}>
|
|
45
|
+
{Y(e.response)}
|
|
46
|
+
</C>
|
|
47
47
|
</T>}
|
|
48
48
|
</T>
|
|
49
49
|
</T>
|
|
@@ -53,109 +53,110 @@ ${C}`,[{text:k("common.cancel")||"Cancel",style:"cancel"},{text:k("common.open")
|
|
|
53
53
|
|
|
54
54
|
<T style={{flexDirection:"row",alignItems:"center",justifyContent:"space-between",flexWrap:"nowrap",gap:6}}>
|
|
55
55
|
<T style={{flexDirection:"row",alignItems:"center",gap:6,flexShrink:1,minWidth:0}}>
|
|
56
|
-
{
|
|
57
|
-
<
|
|
58
|
-
{
|
|
59
|
-
</
|
|
56
|
+
{H?<T style={{backgroundColor:H.startsWith("https")?`${t.green600}18`:`${t.amber500}18`,paddingHorizontal:6,paddingVertical:2,borderRadius:4}}>
|
|
57
|
+
<C style={{fontFamily:R.interBold,fontSize:9,color:H.startsWith("https")?t.green600:t.amber500}}>
|
|
58
|
+
{H.replace("://","").toUpperCase()}
|
|
59
|
+
</C>
|
|
60
60
|
</T>:null}
|
|
61
61
|
|
|
62
|
-
<
|
|
62
|
+
<C style={{fontFamily:R.interBold,fontSize:10,color:t.grayTextWeak,letterSpacing:.4,textTransform:"uppercase"}}numberOfLines={1}>
|
|
63
63
|
ENDPOINT URL
|
|
64
|
-
</
|
|
64
|
+
</C>
|
|
65
65
|
</T>
|
|
66
66
|
|
|
67
67
|
|
|
68
68
|
<T style={{flexDirection:"row",alignItems:"center",gap:5,flexShrink:0}}>
|
|
69
|
-
<
|
|
70
|
-
<
|
|
71
|
-
<
|
|
72
|
-
<
|
|
73
|
-
|
|
74
|
-
|
|
69
|
+
<O value={qe(e)}label="cURL"iconType="terminal"/>
|
|
70
|
+
<Ie onShare={()=>Pe(e)}/>
|
|
71
|
+
<O value={$e(e)}label="fetch()"iconType="fetch"/>
|
|
72
|
+
<O value={S}label="URL"iconType="copy"/>
|
|
73
|
+
<K style={[o.iconSquareBtn,{backgroundColor:`${t.sky600}15`,borderColor:`${t.sky600}35`}]}onPress={N}hitSlop={10}accessibilityLabel="Open in Browser">
|
|
74
|
+
<Me color={t.sky600}size={13}/>
|
|
75
|
+
</K>
|
|
75
76
|
</T>
|
|
76
77
|
</T>
|
|
77
78
|
|
|
78
79
|
|
|
79
|
-
<
|
|
80
|
-
<
|
|
81
|
-
{
|
|
82
|
-
</
|
|
83
|
-
</
|
|
80
|
+
<P onPress={N}>
|
|
81
|
+
<C selectable={!0}style={{fontFamily:R.interMedium,fontSize:12.5,color:t.skyBlue,textDecorationLine:"underline",lineHeight:18}}>
|
|
82
|
+
{S}
|
|
83
|
+
</C>
|
|
84
|
+
</P>
|
|
84
85
|
</T>
|
|
85
86
|
</>})()}
|
|
86
87
|
</T>
|
|
87
88
|
</T>
|
|
88
89
|
|
|
89
90
|
|
|
90
|
-
<
|
|
91
|
+
<Ve tabs={[{key:"metadata",label:b("network.detailTabs.metadata"),icon:r=><Le color={r?t.white:t.grayText}/>},{key:"headers",label:b("network.detailTabs.headers"),icon:r=><Oe color={r?t.white:t.grayText}/>},...e.request!=null?[{key:"request",label:b("network.detailTabs.request"),icon:r=><Fe color={r?t.white:t.grayText}/>}]:[],{key:"response",label:b("network.detailTabs.response"),icon:r=><Ue color={r?t.white:t.grayText}/>}]}activeKey={D}onChange={r=>{Se(),Z(r)}}style={{marginHorizontal:6,marginBottom:10,marginTop:6}}/>
|
|
91
92
|
|
|
92
93
|
|
|
93
|
-
<
|
|
94
|
-
{
|
|
95
|
-
<
|
|
94
|
+
<Ce style={o.detailScroll}contentContainerStyle={{paddingHorizontal:6,paddingBottom:24}}showsVerticalScrollIndicator={!0}>
|
|
95
|
+
{D==="metadata"&&<>
|
|
96
|
+
<De status={e.status}statusColor={z(e.status)}duration={e.duration}size={Y(e.response)}triggeredAt={He(e.startTime)}method={e.method}contentType={e.responseHeaders?.["content-type"]||e.responseHeaders?.["Content-Type"]}url={e.url}/>
|
|
96
97
|
|
|
97
|
-
{(()=>{const
|
|
98
|
+
{(()=>{const r=oe.current.get(e.id)||e?.routeInfo;return!r||!r.path||r.path==="Navigators"?null:<Be routeInfo={r}/>})()}
|
|
98
99
|
|
|
99
|
-
{(e.responseHeaders?.["content-type"]||e.responseHeaders?.["Content-Type"])?.includes("image/")?<T style={
|
|
100
|
-
<
|
|
101
|
-
<
|
|
102
|
-
<
|
|
103
|
-
</
|
|
100
|
+
{(e.responseHeaders?.["content-type"]||e.responseHeaders?.["Content-Type"])?.includes("image/")?<T style={o.imagePreviewWrapper}>
|
|
101
|
+
<Te source={{uri:e.url}}style={o.imagePreview}resizeMode="contain"/>
|
|
102
|
+
<K style={o.imageDownloadBtn}onPress={()=>$.openURL(e.url)}hitSlop={10}>
|
|
103
|
+
<Ae color={t.purple}size={18}/>
|
|
104
|
+
</K>
|
|
104
105
|
</T>:null}
|
|
105
106
|
</>}
|
|
106
107
|
|
|
107
|
-
{
|
|
108
|
-
<T style={
|
|
109
|
-
<T style={
|
|
110
|
-
<
|
|
111
|
-
{
|
|
112
|
-
<
|
|
113
|
-
</
|
|
108
|
+
{D==="headers"&&<>
|
|
109
|
+
<T style={o.detailSearchRow}>
|
|
110
|
+
<T style={o.detailSearchBox}>
|
|
111
|
+
<L placeholder={b("network.searchHeaders")}placeholderTextColor={t.grayTextWeak}value={k}onChangeText={V}style={o.detailSearchInput}autoCorrect={!1}autoCapitalize="none"/>
|
|
112
|
+
{k.length>0&&<P onPress={()=>V("")}hitSlop={10}style={{padding:8}}>
|
|
113
|
+
<F color={t.grayTextWeak}size={14}/>
|
|
114
|
+
</P>}
|
|
114
115
|
</T>
|
|
115
116
|
</T>
|
|
116
117
|
|
|
117
|
-
<
|
|
118
|
-
<
|
|
118
|
+
<J title="Request Headers"headers={e.requestHeaders}search={k}resetKey={e.id}/>
|
|
119
|
+
<J title="Response Headers"headers={e.responseHeaders}search={k}resetKey={e.id}/>
|
|
119
120
|
</>}
|
|
120
121
|
|
|
121
|
-
{
|
|
122
|
-
<T style={
|
|
123
|
-
<T style={
|
|
124
|
-
<
|
|
125
|
-
{
|
|
126
|
-
<
|
|
127
|
-
</
|
|
122
|
+
{D==="request"&&e.request!=null&&<>
|
|
123
|
+
<T style={o.detailSearchRow}>
|
|
124
|
+
<T style={o.detailSearchBox}>
|
|
125
|
+
<L placeholder={b("network.searchRequest")}placeholderTextColor={t.grayTextWeak}value={k}onChangeText={V}style={o.detailSearchInput}autoCorrect={!1}autoCapitalize="none"/>
|
|
126
|
+
{k.length>0&&<P onPress={()=>V("")}hitSlop={10}style={{padding:8}}>
|
|
127
|
+
<F color={t.grayTextWeak}size={14}/>
|
|
128
|
+
</P>}
|
|
128
129
|
</T>
|
|
129
130
|
</T>
|
|
130
131
|
|
|
131
|
-
<T style={
|
|
132
|
-
<
|
|
133
|
-
{
|
|
134
|
-
<
|
|
135
|
-
{
|
|
136
|
-
</
|
|
132
|
+
<T style={o.sectionContainer}>
|
|
133
|
+
<_ title={b("network.requestTitle")}value={e.request}expanded={B}onToggleExpand={()=>U(r=>!r)}showDiff={E!=null}isDiffing={v}onToggleDiff={()=>{ee(r=>!r),!B&&!v&&U(!0)}}/>
|
|
134
|
+
{v?<Q oldData={E}newData={e.request}forceOpen={B}/>:B?<G data={e.request}search={k}/>:<T style={o.codeBlock}>
|
|
135
|
+
<C style={[o.codeText,{color:t.grayTextWeak}]}>
|
|
136
|
+
{b("network.bodyHidden")}
|
|
137
|
+
</C>
|
|
137
138
|
</T>}
|
|
138
139
|
</T>
|
|
139
140
|
</>}
|
|
140
141
|
|
|
141
|
-
{
|
|
142
|
-
<T style={
|
|
143
|
-
<T style={
|
|
144
|
-
<
|
|
145
|
-
{
|
|
146
|
-
<
|
|
147
|
-
</
|
|
142
|
+
{D==="response"&&<>
|
|
143
|
+
<T style={o.detailSearchRow}>
|
|
144
|
+
<T style={o.detailSearchBox}>
|
|
145
|
+
<L placeholder={b("network.searchResponse")}placeholderTextColor={t.grayTextWeak}value={k}onChangeText={V}style={o.detailSearchInput}autoCorrect={!1}autoCapitalize="none"/>
|
|
146
|
+
{k.length>0&&<P onPress={()=>V("")}hitSlop={10}style={{padding:8}}>
|
|
147
|
+
<F color={t.grayTextWeak}size={14}/>
|
|
148
|
+
</P>}
|
|
148
149
|
</T>
|
|
149
150
|
</T>
|
|
150
151
|
|
|
151
|
-
<T style={
|
|
152
|
-
<
|
|
153
|
-
{
|
|
154
|
-
<
|
|
155
|
-
{
|
|
156
|
-
</
|
|
152
|
+
<T style={o.sectionContainer}>
|
|
153
|
+
<_ title={b("network.responseTitle")}value={e.response}expanded={I}onToggleExpand={()=>A(r=>!r)}showDiff={M!=null}isDiffing={W}onToggleDiff={()=>{te(r=>!r),!I&&!W&&A(!0)}}/>
|
|
154
|
+
{W?<Q oldData={M}newData={e.response}forceOpen={I}/>:I?<G data={e.response}search={k}wrap/>:<T style={o.codeBlock}>
|
|
155
|
+
<C style={[o.codeText,{color:t.grayTextWeak}]}>
|
|
156
|
+
{b("network.bodyHidden")}
|
|
157
|
+
</C>
|
|
157
158
|
</T>}
|
|
158
159
|
</T>
|
|
159
160
|
</>}
|
|
160
|
-
</
|
|
161
|
-
</T>:null});export default
|
|
161
|
+
</Ce>
|
|
162
|
+
</T>:null});export default Ke;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import{useEffect as te,useMemo as N,useState as le}from"react";import{Modal as Ce,Pressable as Y,ScrollView as Te,StyleSheet as we,Text as S,TouchableOpacity as L,View as T}from"react-native";import{useInspector as
|
|
1
|
+
import{useEffect as te,useMemo as N,useState as le}from"react";import{Modal as Ce,Pressable as Y,ScrollView as Te,StyleSheet as we,Text as S,TouchableOpacity as L,View as T}from"react-native";import{useInspector as ke}from"./InspectorContext";import{AppColors as t}from"../../styles/AppColors";import{AppFonts as B}from"../../styles/AppFonts";import{METHOD_COLORS as me}from"../../constants";import{FilterIcon as Se,CloseWhite as Be,ClockIcon as K,CircleCheckIcon as Pe,CircleAlertIcon as X,CircleXIcon as Ie,LayersIcon as A,RepeatIcon as Oe,ShieldAlertIcon as ze,BoltIcon as Ve,GlobeIcon as Re,LockIcon as Fe,UnlockIcon as Le,RocketIcon as We,TurtleIcon as Ee,HourglassIcon as Me,PackageIcon as Ne}from"../NetworkIcons";import J from"../TouchableScale";export const DEFAULT_NETWORK_FILTERS={statusCodes:new Set(["all"]),methods:new Set(["all"]),latency:"all",protocol:"all",sortBy:"time_desc"},isNetworkFiltersDefault=I=>(I.statusCodes.has("all")||I.statusCodes.size===0)&&(I.methods.has("all")||I.methods.size===0)&&I.latency==="all"&&I.protocol==="all"&&I.sortBy==="time_desc",NetworkFilterModal=({visible:I,onClose:E,filters:R,onApply:Z,searchQuery:M=""})=>{const{logs:W}=ke(),[r,F]=le(()=>({...R,statusCodes:new Set(R.statusCodes),methods:new Set(R.methods)}));te(()=>{I&&F({...R,statusCodes:new Set(R.statusCodes),methods:new Set(R.methods)})},[I,R]);const P=N(()=>{const e={all:W.length,"2xx":0,"3xx":0,"4xx":0,"5xx":0,failed:0},l={all:W.length};let C=0,g=0,O=0,v=0,_=0;for(const z of W){const V=typeof z.status=="number"?z.status:parseInt(String(z.status),10);z.status===0||z.status==null?e.failed=(e.failed||0)+1:isNaN(V)||(V>=200&&V<300?e["2xx"]=(e["2xx"]||0)+1:V>=300&&V<400?e["3xx"]=(e["3xx"]||0)+1:V>=400&&V<500?e["4xx"]=(e["4xx"]||0)+1:V>=500&&(e["5xx"]=(e["5xx"]||0)+1));const U=(z.method||"GET").toUpperCase();l[U]=(l[U]||0)+1;const G=z.duration||0;G<200?C++:G<=500?g++:O++,(z.url||"").toLowerCase().startsWith("https")?v++:_++}return{statusMap:e,methodMap:l,fastCount:C,normalCount:g,slowCount:O,httpsCount:v,httpCount:_}},[W]),D=N(()=>W.filter(e=>{if(!r.statusCodes.has("all")&&r.statusCodes.size>0){const g=typeof e.status=="number"?e.status:parseInt(String(e.status),10);let O=!1;if(r.statusCodes.has("failed")&&(e.status===0||e.status==null)&&(O=!0),r.statusCodes.has("2xx")&&!isNaN(g)&&g>=200&&g<300&&(O=!0),r.statusCodes.has("3xx")&&!isNaN(g)&&g>=300&&g<400&&(O=!0),r.statusCodes.has("4xx")&&!isNaN(g)&&g>=400&&g<500&&(O=!0),r.statusCodes.has("5xx")&&!isNaN(g)&&g>=500&&(O=!0),!O)return!1}if(!r.methods.has("all")&&r.methods.size>0){const g=(e.method||"GET").toUpperCase();if(!r.methods.has(g))return!1}const l=e.duration||0;if(r.latency==="fast"&&l>=200||r.latency==="normal"&&(l<200||l>500)||r.latency==="slow"&&l<=500)return!1;const C=(e.url||"").toLowerCase().startsWith("https");if(r.protocol==="https"&&!C||r.protocol==="http"&&C)return!1;if(M.trim().length>0){const g=M.toLowerCase();if(!(e.url||"").toLowerCase().includes(g))return!1}return!0}).length,[W,r,M]),Q=e=>{F(l=>{const C=new Set(l.statusCodes);return e==="all"?{...l,statusCodes:new Set(["all"])}:(C.delete("all"),C.has(e)?(C.delete(e),C.size===0&&C.add("all")):C.add(e),{...l,statusCodes:C})})},H=e=>{F(l=>{const C=new Set(l.methods);return e==="all"?{...l,methods:new Set(["all"])}:(C.delete("all"),C.has(e)?(C.delete(e),C.size===0&&C.add("all")):C.add(e),{...l,methods:C})})},ee=()=>{F({statusCodes:new Set(["all"]),methods:new Set(["all"]),latency:"all",protocol:"all",sortBy:"time_desc"})},oe=()=>{Z(r),E()},$=N(()=>{let e=0;return!r.statusCodes.has("all")&&r.statusCodes.size>0&&(e+=r.statusCodes.size),!r.methods.has("all")&&r.methods.size>0&&(e+=r.methods.size),r.latency!=="all"&&e++,r.protocol!=="all"&&e++,r.sortBy!=="time_desc"&&e++,e},[r]);return<Ce visible={I}transparent animationType="fade"onRequestClose={E}>
|
|
2
2
|
<Y style={o.overlay}onPress={E}>
|
|
3
3
|
<Y style={o.modalCard}onPress={e=>e.stopPropagation()}>
|
|
4
4
|
|
|
5
5
|
<T style={o.header}>
|
|
6
6
|
<T style={o.headerLeft}>
|
|
7
7
|
<T style={o.iconCircle}>
|
|
8
|
-
<
|
|
8
|
+
<Se size={16}color={t.purple}/>
|
|
9
9
|
</T>
|
|
10
10
|
<T>
|
|
11
11
|
<T style={{flexDirection:"row",alignItems:"center",gap:6}}>
|
|
@@ -18,7 +18,7 @@ import{useEffect as te,useMemo as N,useState as le}from"react";import{Modal as C
|
|
|
18
18
|
</T>
|
|
19
19
|
</T>
|
|
20
20
|
<L onPress={E}hitSlop={10}style={o.closeBtn}>
|
|
21
|
-
<
|
|
21
|
+
<Be size={14}color={t.grayText}/>
|
|
22
22
|
</L>
|
|
23
23
|
</T>
|
|
24
24
|
|
|
@@ -27,7 +27,7 @@ import{useEffect as te,useMemo as N,useState as le}from"react";import{Modal as C
|
|
|
27
27
|
<T style={o.section}>
|
|
28
28
|
<S style={o.sectionTitle}>HTTP STATUS CODE</S>
|
|
29
29
|
<T style={o.chipsWrap}>
|
|
30
|
-
{[{key:"all",label:"All Statuses",color:t.purple,icon:A,count:P.statusMap.all},{key:"2xx",label:"2xx Success",color:t.greenColor,icon:
|
|
30
|
+
{[{key:"all",label:"All Statuses",color:t.purple,icon:A,count:P.statusMap.all},{key:"2xx",label:"2xx Success",color:t.greenColor,icon:Pe,count:P.statusMap["2xx"]||0},{key:"3xx",label:"3xx Redirect",color:t.warningIconGold,icon:Oe,count:P.statusMap["3xx"]||0},{key:"4xx",label:"4xx Client Error",color:t.darkOrange,icon:X,count:P.statusMap["4xx"]||0},{key:"5xx",label:"5xx Server Error",color:t.errorColor,icon:Ie,count:P.statusMap["5xx"]||0},{key:"failed",label:"Network Failed / 0",color:t.errorColor,icon:ze,count:P.statusMap.failed||0}].map(e=>{const l=r.statusCodes.has(e.key),C=e.icon;return<L key={e.key}activeOpacity={.7}onPress={()=>Q(e.key)}style={[o.chip,l&&{backgroundColor:`${e.color}15`,borderColor:e.color}]}>
|
|
31
31
|
<C size={13}color={l?e.color:t.grayTextWeak}/>
|
|
32
32
|
<S style={[o.chipLabel,l&&{color:e.color,fontFamily:B.interBold}]}>
|
|
33
33
|
{e.label}
|
|
@@ -57,7 +57,7 @@ import{useEffect as te,useMemo as N,useState as le}from"react";import{Modal as C
|
|
|
57
57
|
</T>
|
|
58
58
|
</L>
|
|
59
59
|
|
|
60
|
-
{["GET","POST","PUT","DELETE","PATCH","QUERY","OPTIONS","HEAD"].map(e=>{const l=r.methods.has(e),C=
|
|
60
|
+
{["GET","POST","PUT","DELETE","PATCH","QUERY","OPTIONS","HEAD"].map(e=>{const l=r.methods.has(e),C=me[e]||t.grayText,g=P.methodMap[e]||0;return<L key={e}activeOpacity={.7}onPress={()=>H(e)}style={[o.chip,l&&{backgroundColor:`${C}18`,borderColor:C}]}>
|
|
61
61
|
<T style={[o.methodDot,{backgroundColor:C}]}/>
|
|
62
62
|
<S style={[o.chipLabel,l&&{color:C,fontFamily:B.interBold}]}>
|
|
63
63
|
{e}
|
|
@@ -75,7 +75,7 @@ import{useEffect as te,useMemo as N,useState as le}from"react";import{Modal as C
|
|
|
75
75
|
<T style={o.section}>
|
|
76
76
|
<S style={o.sectionTitle}>LATENCY & SPEED</S>
|
|
77
77
|
<T style={o.chipsWrap}>
|
|
78
|
-
{[{key:"all",label:"All Speeds",color:t.purple,icon:A},{key:"fast",label:"Fast (<200ms)",color:t.greenColor,icon:
|
|
78
|
+
{[{key:"all",label:"All Speeds",color:t.purple,icon:A},{key:"fast",label:"Fast (<200ms)",color:t.greenColor,icon:Ve,count:P.fastCount},{key:"normal",label:"Normal (200-500ms)",color:t.skyBlue,icon:K,count:P.normalCount},{key:"slow",label:"Slow (>500ms)",color:t.errorColor,icon:X,count:P.slowCount}].map(e=>{const l=r.latency===e.key,C=e.icon;return<L key={e.key}activeOpacity={.7}onPress={()=>F(g=>({...g,latency:e.key}))}style={[o.chip,l&&{backgroundColor:`${e.color}15`,borderColor:e.color}]}>
|
|
79
79
|
<C size={13}color={l?e.color:t.grayTextWeak}/>
|
|
80
80
|
<S style={[o.chipLabel,l&&{color:e.color,fontFamily:B.interBold}]}>
|
|
81
81
|
{e.label}
|
|
@@ -93,7 +93,7 @@ import{useEffect as te,useMemo as N,useState as le}from"react";import{Modal as C
|
|
|
93
93
|
<T style={o.section}>
|
|
94
94
|
<S style={o.sectionTitle}>PROTOCOL</S>
|
|
95
95
|
<T style={o.chipsWrap}>
|
|
96
|
-
{[{key:"all",label:"All Protocols",color:t.purple,icon:
|
|
96
|
+
{[{key:"all",label:"All Protocols",color:t.purple,icon:Re},{key:"https",label:"HTTPS Secure",color:t.mintGreenText,icon:Fe,count:P.httpsCount},{key:"http",label:"HTTP Insecure",color:t.amber700,icon:Le,count:P.httpCount}].map(e=>{const l=r.protocol===e.key,C=e.icon;return<L key={e.key}activeOpacity={.7}onPress={()=>F(g=>({...g,protocol:e.key}))}style={[o.chip,l&&{backgroundColor:`${e.color}15`,borderColor:e.color}]}>
|
|
97
97
|
<C size={13}color={l?e.color:t.grayTextWeak}/>
|
|
98
98
|
<S style={[o.chipLabel,l&&{color:e.color,fontFamily:B.interBold}]}>
|
|
99
99
|
{e.label}
|
|
@@ -111,7 +111,7 @@ import{useEffect as te,useMemo as N,useState as le}from"react";import{Modal as C
|
|
|
111
111
|
<T style={o.section}>
|
|
112
112
|
<S style={o.sectionTitle}>SORT BY</S>
|
|
113
113
|
<T style={o.chipsWrap}>
|
|
114
|
-
{[{key:"time_desc",label:"Newest First (Default)",icon:K},{key:"time_asc",label:"Oldest First",icon:
|
|
114
|
+
{[{key:"time_desc",label:"Newest First (Default)",icon:K},{key:"time_asc",label:"Oldest First",icon:Me},{key:"duration_desc",label:"Slowest Response",icon:Ee},{key:"duration_asc",label:"Fastest Response",icon:We},{key:"size_desc",label:"Largest Response Size",icon:Ne}].map(e=>{const l=r.sortBy===e.key,C=e.icon;return<L key={e.key}activeOpacity={.7}onPress={()=>F(g=>({...g,sortBy:e.key}))}style={[o.chip,l&&{backgroundColor:`${t.purple}15`,borderColor:t.purple}]}>
|
|
115
115
|
<C size={13}color={l?t.purple:t.grayTextWeak}/>
|
|
116
116
|
<S style={[o.chipLabel,l&&{color:t.purple,fontFamily:B.interBold}]}>
|
|
117
117
|
{e.label}
|