react-native-inapp-inspector 2.4.0 → 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/dist/commonjs/components/Inspector/AnalyticsTab.js +18 -18
- package/dist/commonjs/components/Inspector/ConsoleTab.js +12 -12
- package/dist/commonjs/components/Inspector/CrashTab.js +20 -20
- package/dist/commonjs/components/Inspector/NetworkTab.js +11 -11
- package/dist/commonjs/components/Inspector/PushTab.js +12 -12
- package/dist/commonjs/components/Inspector/ReduxTab.js +15 -15
- package/dist/commonjs/components/Inspector/StorageTab.js +16 -16
- package/dist/commonjs/components/LogCard.js +9 -6
- package/dist/commonjs/constants/version.d.ts +1 -1
- package/dist/commonjs/constants/version.js +1 -1
- package/dist/commonjs/index.js +1 -1
- package/dist/esm/components/Inspector/AnalyticsTab.js +31 -31
- package/dist/esm/components/Inspector/ConsoleTab.js +31 -31
- package/dist/esm/components/Inspector/CrashTab.js +23 -23
- package/dist/esm/components/Inspector/NetworkTab.js +11 -11
- package/dist/esm/components/Inspector/PushTab.js +26 -26
- package/dist/esm/components/Inspector/ReduxTab.js +40 -40
- package/dist/esm/components/Inspector/StorageTab.js +51 -51
- package/dist/esm/components/LogCard.js +25 -22
- package/dist/esm/constants/version.d.ts +1 -1
- package/dist/esm/constants/version.js +1 -1
- package/dist/esm/index.js +3 -3
- package/package.json +1 -1
|
@@ -1,60 +1,60 @@
|
|
|
1
|
-
import
|
|
1
|
+
import X,{useCallback as F,useState as Y,useMemo as Z,useRef as Fe}from"react";import{FlatList as Pe,Platform as Re,Pressable as Ve,ScrollView as Be,Text as N,TextInput as Me,TouchableOpacity as Ce,View as C}from"react-native";import{animateNextLayout as _e,useInspector as Ne}from"./InspectorContext";import Oe from"../AnalyticsEventCard";import $e from"./AnalyticsFilterModal";import De from"../EndOfListFooter";import He from"../EmptyState";import I from"../../styles";import{AppColors as r}from"../../styles/AppColors";import{AppFonts as O}from"../../styles/AppFonts";import{useTranslation as We}from"../../i18n";import Ge from"../TouchableScale";import{getEventCategory as je}from"../../helpers";import{LayersIcon as Je,SearchIcon as Qe,ClearIcon as Ke,TrashIcon as Ue,FilterIcon as Xe,CartIcon as Ye,GlobeIcon as Ze,BoltIcon as et,SparkleIcon as tt}from"../NetworkIcons";const Se=10,ot=X.memo(()=>{const{t:$}=We(),{analyticsEvents:D,filteredAnalyticsEvents:a,analyticsSearch:S,setAnalyticsSearch:P,analyticsFilters:A,setAnalyticsFilters:H,handleDelete:we,selectedEvent:Ie,setSelectedEvent:W,newEventIds:G,logRouteMapRef:j,isAnalyticsLayoutReady:Te,setIsAnalyticsLayoutReady:ve,isAnalyticsFilterApplied:R,maxAnalyticsEventsLimit:V}=Ne(),xe=V||100,J=Fe(null),[Le,Q]=Y(!1),[q,K]=Y(xe);X.useEffect(()=>{K(V||100),J.current?.scrollToOffset({offset:0,animated:!1})},[S,A,V]);const B=Z(()=>a.slice(0,q),[a,q]),v=Z(()=>{let e=0,o=0,t=0,w=0;for(const E of D){const k=je(E.name),T=E.count||1;k==="ecommerce"?e+=T:k==="page_view"?o+=T:k==="system"?t+=T:w+=T}const L=e+o+t+w;return{ecommerce:e,page_view:o,system:t,custom:w,totalCount:L}},[D]),ke=F(e=>{_e(),H(o=>{if(e==="all")return{...o,categories:new Set(["all"])};const t=new Set(o.categories);if(t.has("all"))t.delete("all"),t.add(e);else if(t.has(e))t.delete(e),t.size===0&&t.add("all");else if(t.add(e),t.has("ecommerce")&&t.has("page_view")&&t.has("system")&&t.has("custom"))return{...o,categories:new Set(["all"])};return{...o,categories:t}})},[H]),Ae=F((e,o)=>e?.id?.toString()??o.toString(),[]),Ee=F(({item:e,index:o})=>{const t=a[o+1],w=a[o-1],L=t?e.timestamp-t.timestamp:void 0,E=Math.floor(e.timestamp/6e4),k=w?Math.floor(w.timestamp/6e4):-1,T=o===0||E!==k;return<Oe event={e}onPress={()=>{W(e)}}isNew={G.has(e.id)}searchStr={S}isFirst={o===0}isLast={o===a.length-1}msSincePrev={L}showTimestamp={T}computedScreenName={(()=>{if(!e)return"";const z=e.screenName||e.screenClass||e.pageTitle||e.pageLocation||e.params?.firebase_screen||e.params?.screen_name||e.params?.firebase_screen_class||e.params?.screen_class;let M=typeof z=="string"?z:z?JSON.stringify(z):"";const _=j.current.get(e.id+1e6);if(!M&&_&&_.path!=="Navigators"){const U=_.path.split(" \u2794 ");M=U[U.length-1]}return M})()}/>},[a,S,G,W,j]),ze=F((e,o)=>({length:86,offset:86*o,index:o}),[]);return<>
|
|
2
2
|
|
|
3
|
-
{
|
|
3
|
+
{Ie==null&&<C style={{backgroundColor:r.white,borderBottomWidth:1,borderBottomColor:r.dividerColor,paddingBottom:6}}>
|
|
4
4
|
<C style={[I.toolbarRow,{marginTop:12,marginBottom:8}]}>
|
|
5
5
|
<C style={I.searchContainer}>
|
|
6
|
-
<
|
|
7
|
-
<
|
|
8
|
-
{
|
|
6
|
+
<Qe color={r.grayTextWeak}size={16}/>
|
|
7
|
+
<Me placeholder={$("analytics.searchPlaceholder","Search events...")}placeholderTextColor={r.grayTextWeak}value={S}onChangeText={P}style={I.searchInput}autoCorrect={!1}autoCapitalize="none"/>
|
|
8
|
+
{S.length>0&&<C style={{flexDirection:"row",alignItems:"center",gap:4}}>
|
|
9
9
|
<C style={{backgroundColor:`${r.purple}20`,borderRadius:10,paddingHorizontal:6,paddingVertical:1.5}}>
|
|
10
|
-
<
|
|
10
|
+
<N style={{color:r.purple,fontSize:9.5,fontFamily:O.interBold}}>
|
|
11
11
|
{a.length}
|
|
12
|
-
</
|
|
12
|
+
</N>
|
|
13
13
|
</C>
|
|
14
|
-
<
|
|
15
|
-
<
|
|
16
|
-
</
|
|
14
|
+
<Ve onPress={()=>P("")}hitSlop={10}style={I.clearBtn}>
|
|
15
|
+
<Ke color={r.grayTextWeak}size={13}/>
|
|
16
|
+
</Ve>
|
|
17
17
|
</C>}
|
|
18
18
|
</C>
|
|
19
19
|
<C style={I.toolbarRight}>
|
|
20
20
|
|
|
21
|
-
<
|
|
22
|
-
<
|
|
23
|
-
{
|
|
24
|
-
</
|
|
21
|
+
<Ce style={[I.toolbarBtn,R&&{borderColor:`${r.brandPurple}60`,backgroundColor:`${r.brandPurple}15`}]}onPress={()=>Q(!0)}hitSlop={6}>
|
|
22
|
+
<Xe color={R?r.brandPurple:r.grayTextStrong}size={15}/>
|
|
23
|
+
{R&&<C style={{position:"absolute",top:2,right:2,width:7,height:7,borderRadius:3.5,backgroundColor:r.darkOrange,borderWidth:1,borderColor:r.white}}/>}
|
|
24
|
+
</Ce>
|
|
25
25
|
|
|
26
|
-
<
|
|
27
|
-
<
|
|
28
|
-
</
|
|
26
|
+
<Ce style={[I.toolbarBtn,{borderColor:`${r.errorColor}38`,backgroundColor:`${r.errorColor}0F`}]}onPress={we}hitSlop={6}>
|
|
27
|
+
<Ue color={r.errorColor}size={15}/>
|
|
28
|
+
</Ce>
|
|
29
29
|
</C>
|
|
30
30
|
</C>
|
|
31
31
|
|
|
32
32
|
|
|
33
33
|
<C style={{flexDirection:"row",alignItems:"center",marginBottom:8,paddingHorizontal:12,gap:6}}>
|
|
34
|
-
<
|
|
35
|
-
{[{id:"all",label
|
|
34
|
+
<Be horizontal showsHorizontalScrollIndicator={!1}style={{flex:1}}contentContainerStyle={{flexDirection:"row",alignItems:"center",gap:6,paddingRight:6}}>
|
|
35
|
+
{[{id:"all",label:$("common.all","All"),count:v.totalCount,color:r.purple,Icon:Je},{id:"ecommerce",label:"Ecommerce",count:v.ecommerce,color:r.amber600,Icon:Ye},{id:"page_view",label:"Screens",count:v.page_view,color:r.sky600,Icon:Ze},{id:"system",label:"System",count:v.system,color:r.violet600,Icon:et},{id:"custom",label:"Custom",count:v.custom,color:r.teal600,Icon:tt}].map(e=>{const o=e.id==="all"?A.categories.has("all"):!A.categories.has("all")&&A.categories.has(e.id),t=e.color||r.purple,w=o?r.white:t,L=e.Icon;return<Ge key={e.id}onPress={()=>ke(e.id)}>
|
|
36
36
|
<C style={{flexDirection:"row",alignItems:"center",paddingHorizontal:9,paddingVertical:4.5,borderRadius:8,backgroundColor:o?t:`${t}12`,borderWidth:1,borderColor:o?t:`${t}30`,gap:5}}>
|
|
37
|
-
<
|
|
38
|
-
<
|
|
37
|
+
<L size={11}color={w}/>
|
|
38
|
+
<N style={{fontFamily:O.interBold,fontSize:10.5,color:o?r.white:r.primaryBlack}}>
|
|
39
39
|
{e.label}
|
|
40
|
-
</
|
|
40
|
+
</N>
|
|
41
41
|
<C style={{backgroundColor:o?"rgba(255,255,255,0.25)":`${t}20`,paddingHorizontal:5,paddingVertical:1,borderRadius:8,alignItems:"center",justifyContent:"center"}}>
|
|
42
|
-
<
|
|
42
|
+
<N style={{fontFamily:O.interBold,fontSize:9.5,color:o?r.white:t}}>
|
|
43
43
|
{e.count}
|
|
44
|
-
</
|
|
44
|
+
</N>
|
|
45
45
|
</C>
|
|
46
46
|
</C>
|
|
47
|
-
</
|
|
48
|
-
</
|
|
47
|
+
</Ge>})}
|
|
48
|
+
</Be>
|
|
49
49
|
</C>
|
|
50
50
|
</C>}
|
|
51
51
|
|
|
52
52
|
|
|
53
|
-
|
|
53
|
+
<$e visible={Le}onClose={()=>Q(!1)}/>
|
|
54
54
|
|
|
55
|
-
<C style={{flex:1}}onLayout={()=>
|
|
56
|
-
{
|
|
57
|
-
<
|
|
55
|
+
<C style={{flex:1}}onLayout={()=>ve(!0)}>
|
|
56
|
+
{Te?<>
|
|
57
|
+
<Pe ref={J}data={B}keyExtractor={Ae}renderItem={Ee}getItemLayout={ze}initialNumToRender={15}maxToRenderPerBatch={10}windowSize={9}removeClippedSubviews={Re.OS==="android"}renderToHardwareTextureAndroid={!0}ListEmptyComponent={<He isSearch={S.length>0}searchQuery={S}customTitle={S.length>0?"No matching analytics events":"No analytics events yet"}customSub={S.length>0?`No events matched "${S}"`:"Call setupAnalyticsLogger(analytics()) at app start."}onClearSearch={()=>P("")}/>}ListFooterComponent={a.length>0?<De count={B.length}totalCount={a.length}label="events"loadMoreStep={Se}hasMore={B.length<a.length}onLoadMore={()=>K(e=>e+Se)}/>:null}contentContainerStyle={[I.listContent,a.length===0&&{flexGrow:1}]}keyboardShouldPersistTaps="handled"/>
|
|
58
58
|
</>:null}
|
|
59
59
|
</C>
|
|
60
|
-
</>});export default
|
|
60
|
+
</>});export default ot;
|
|
@@ -1,58 +1,58 @@
|
|
|
1
|
-
import
|
|
2
|
-
<Lo item={o}searchStr={
|
|
3
|
-
</Ao>,[
|
|
1
|
+
import F,{useCallback as $,useMemo as k,useRef as lo}from"react";import{FlatList as So,Platform as ho,Pressable as Co,ScrollView as _,Text as L,TextInput as To,View as S}from"react-native";import{useInspector as Io}from"./InspectorContext";import{useTranslation as xo}from"../../i18n";import H from"../TouchableScale";import Ao from"../AnimatedEntrance";import{ConsoleLogCard as Lo}from"../ConsoleLogCard";import Vo from"../EmptyState";import Eo from"../EndOfListFooter";import I from"../../styles";import{AppColors as e}from"../../styles/AppColors";import{AppFonts as z}from"../../styles/AppFonts";import{LogFilter as V}from"../../types";import{SearchIcon as Bo,ClearIcon as Fo,SortArrowIcon as Ho,TrashIcon as Po,LayersIcon as Ro,UserIcon as Oo,InfoCircleIcon as Wo,WarningTriangleIcon as $o,ErrorCircleIcon as Do,AnalyticsIcon as No}from"../NetworkIcons";const Q=10,Uo=F.memo(()=>{const{t:b}=xo(),{logSearch:h,setLogSearch:E,logSortOrder:Y,setLogSortOrder:K,handleDelete:X,logFilters:C,setLogFilters:P,logCounts:x,filteredConsoleLogs:w,visibleConsoleLogs:D,maxConsoleLogs:R}=Io(),j=R||100,N=lo(null),[U,G]=F.useState(j);F.useEffect(()=>{G(R||100),N.current?.scrollToOffset({offset:0,animated:!1})},[h,C,R]);const O=k(()=>w.slice(0,U),[w,U]),q=$(({item:o,index:t})=><Ao index={t}distance={8}>
|
|
2
|
+
<Lo item={o}searchStr={h}/>
|
|
3
|
+
</Ao>,[h]),J=$((o,t)=>({length:148,offset:148*t,index:t}),[]),Z=$((o,t)=>o?.id?.toString()??t.toString(),[]),oo=k(()=>{const o=D.length,t=w.length;if(C.has("all")||!Array.from(C).some(B=>B!=="all"))return<S style={{paddingHorizontal:12,paddingTop:8,paddingBottom:3}}>
|
|
4
4
|
<L style={{fontFamily:z.interMedium,fontSize:11,color:e.grayTextWeak,letterSpacing:.2}}>
|
|
5
5
|
{t===o?`Showing ${o} logs`:`Showing ${t} of ${o} logs`}
|
|
6
6
|
</L>
|
|
7
|
-
</S>;{const
|
|
7
|
+
</S>;{const B=Array.from(C).filter(T=>T!=="all").map(T=>T==="user-log"?"Log":T==="analytics"?"Analytics":T.charAt(0).toUpperCase()+T.slice(1));return<S style={{paddingHorizontal:12,paddingTop:8,paddingBottom:3}}>
|
|
8
8
|
<L style={{fontFamily:z.interMedium,fontSize:11,color:e.grayTextWeak,letterSpacing:.2}}>
|
|
9
|
-
Filtered by {
|
|
9
|
+
Filtered by {B.join(", ")} ({t} of {o} logs)
|
|
10
10
|
</L>
|
|
11
|
-
</S>}},[
|
|
11
|
+
</S>}},[D.length,w.length,C]),[W,M]=F.useState(!1),eo=k(()=>["[AXIOS]","[API]","[GRAPHQL]","[REDUX]","[ANALYTICS]","[AUTH]","[NAV]","[STORAGE]","[PERF]","[WS]","[PUSH]","[PAYMENT]","[SYNC]","[BLE]","[LOCATION]","[TEST]","[DEBUG]"],[]),to=k(()=>[{id:V.All,label:b("common.all","All"),count:x.all?.split("/")?.[0]??"0",color:e.purple,Icon:Ro},{id:V.UserLog,label:b("console.log","Log"),count:x["user-log"]?.split("/")?.[0]??"0",color:e.teal600,Icon:Oo},{id:V.Info,label:b("console.info","Info"),count:x.info?.split("/")?.[0]??"0",color:e.sky600,Icon:Wo},{id:V.Warn,label:b("console.warning","Warn"),count:x.warn?.split("/")?.[0]??"0",color:e.amber600,Icon:$o},{id:V.Error,label:b("console.error","Error"),count:x.error?.split("/")?.[0]??"0",color:e.errorColor,Icon:Do},{id:V.Analytics,label:b("console.analytics","Analytics"),count:x.analytics?.split("/")?.[0]??"0",color:e.violet600,Icon:No}],[x,b]);return<S style={{flex:1}}>
|
|
12
12
|
<S style={{backgroundColor:e.white,borderBottomWidth:1,borderBottomColor:e.dividerColor,paddingBottom:6}}>
|
|
13
|
-
<S style={[
|
|
14
|
-
<S style={[
|
|
15
|
-
<
|
|
16
|
-
<
|
|
17
|
-
{
|
|
13
|
+
<S style={[I.toolbarRow,{marginTop:12,marginBottom:8}]}>
|
|
14
|
+
<S style={[I.searchContainer,W&&{borderColor:e.purple,borderWidth:1.5}]}>
|
|
15
|
+
<Bo color={W?e.purple:e.grayTextWeak}size={16}/>
|
|
16
|
+
<To placeholder={b("console.searchPlaceholder")}placeholderTextColor={e.grayTextWeak}value={h}onChangeText={E}onFocus={()=>M(!0)}onBlur={()=>M(!1)}style={I.searchInput}autoCorrect={!1}autoCapitalize="none"/>
|
|
17
|
+
{h.length>0&&<S style={{flexDirection:"row",alignItems:"center",gap:4}}>
|
|
18
18
|
<S style={{backgroundColor:`${e.purple}20`,borderRadius:10,paddingHorizontal:6,paddingVertical:2}}>
|
|
19
19
|
<L style={{color:e.purple,fontSize:10,fontFamily:z.interBold}}>
|
|
20
|
-
{
|
|
20
|
+
{w.length}
|
|
21
21
|
</L>
|
|
22
22
|
</S>
|
|
23
|
-
<Co onPress={()=>
|
|
24
|
-
<
|
|
23
|
+
<Co onPress={()=>E("")}hitSlop={10}style={I.clearBtn}>
|
|
24
|
+
<Fo color={e.grayTextWeak}size={14}/>
|
|
25
25
|
</Co>
|
|
26
26
|
</S>}
|
|
27
27
|
</S>
|
|
28
28
|
|
|
29
|
-
<S style={
|
|
30
|
-
<
|
|
31
|
-
<Ho color={e.grayTextStrong}size={18}direction={
|
|
32
|
-
</
|
|
33
|
-
<
|
|
29
|
+
<S style={I.toolbarRight}>
|
|
30
|
+
<H style={I.toolbarBtn}onPress={()=>K(o=>o==="newest"?"oldest":"newest")}hitSlop={10}>
|
|
31
|
+
<Ho color={e.grayTextStrong}size={18}direction={Y==="newest"?"down":"up"}/>
|
|
32
|
+
</H>
|
|
33
|
+
<H style={[I.toolbarBtn,{borderColor:`${e.errorColor}38`,backgroundColor:`${e.errorColor}0F`}]}onPress={X}hitSlop={6}>
|
|
34
34
|
<Po color={e.errorColor}size={15}/>
|
|
35
|
-
</
|
|
35
|
+
</H>
|
|
36
36
|
</S>
|
|
37
37
|
</S>
|
|
38
38
|
|
|
39
39
|
|
|
40
|
-
{(
|
|
41
|
-
{
|
|
40
|
+
{(W||h.length>0)&&<_ horizontal showsHorizontalScrollIndicator={!1}style={{marginBottom:6,maxHeight:30}}contentContainerStyle={{paddingHorizontal:16,flexDirection:"row",alignItems:"center",gap:6}}>
|
|
41
|
+
{eo.map(o=>{const t=h.includes(o);return<H key={o}onPress={()=>{E(t?r=>r.replace(o,"").trim():r=>r?`${r} ${o}`.trim():o)}}>
|
|
42
42
|
<S style={{paddingHorizontal:8,paddingVertical:3,borderRadius:6,backgroundColor:t?e.purple:`${e.purple}14`,borderWidth:1,borderColor:t?e.purple:`${e.purple}30`}}>
|
|
43
43
|
<L style={{fontFamily:z.interBold,fontSize:10,color:t?e.white:e.purple}}>
|
|
44
44
|
{o}
|
|
45
45
|
</L>
|
|
46
46
|
</S>
|
|
47
|
-
</
|
|
48
|
-
</
|
|
47
|
+
</H>})}
|
|
48
|
+
</_>}
|
|
49
49
|
|
|
50
50
|
|
|
51
51
|
<S style={{flexDirection:"row",alignItems:"center",marginBottom:8,paddingHorizontal:12,gap:6}}>
|
|
52
|
-
<
|
|
53
|
-
{
|
|
52
|
+
<_ horizontal showsHorizontalScrollIndicator={!1}style={{flex:1}}contentContainerStyle={{flexDirection:"row",alignItems:"center",gap:6,paddingRight:6}}>
|
|
53
|
+
{to.map(o=>{const t=o.id==="all"?C.has("all"):C.has(o.id)&&!C.has("all"),r=o.color||e.purple,B=t?e.white:r,T=o.Icon;return<H key={o.id}onPress={()=>{o.id==="all"?P(new Set(["all"])):P(ro=>{const A=new Set(ro);return A.delete("all"),A.has(o.id)?A.delete(o.id):A.add(o.id),A.size===0&&A.add("all"),A})}}>
|
|
54
54
|
<S style={{flexDirection:"row",alignItems:"center",paddingHorizontal:9,paddingVertical:4.5,borderRadius:8,backgroundColor:t?r:`${r}12`,borderWidth:1,borderColor:t?r:`${r}30`,gap:5}}>
|
|
55
|
-
<
|
|
55
|
+
<T size={11}color={B}/>
|
|
56
56
|
<L style={{fontFamily:z.interBold,fontSize:10.5,color:t?e.white:e.primaryBlack}}>
|
|
57
57
|
{o.label}
|
|
58
58
|
</L>
|
|
@@ -62,10 +62,10 @@ import W,{useCallback as $,useMemo as k,useRef as oo}from"react";import{FlatList
|
|
|
62
62
|
</L>
|
|
63
63
|
</S>
|
|
64
64
|
</S>
|
|
65
|
-
</
|
|
66
|
-
</
|
|
65
|
+
</H>})}
|
|
66
|
+
</_>
|
|
67
67
|
</S>
|
|
68
68
|
</S>
|
|
69
69
|
|
|
70
|
-
<So ref={
|
|
71
|
-
</S>});export default
|
|
70
|
+
<So ref={N}data={O}keyExtractor={Z}ListHeaderComponent={oo}renderItem={q}getItemLayout={J}initialNumToRender={15}maxToRenderPerBatch={10}windowSize={9}removeClippedSubviews={ho.OS==="android"}renderToHardwareTextureAndroid={!0}ListEmptyComponent={<Vo isSearch={h.length>0||!C.has("all")}searchQuery={h}customTitle={h.length>0?"No matching console logs":"No console logs"}onClearSearch={()=>{E(""),P(new Set(["all"]))}}/>}ListFooterComponent={w.length>0?<Eo count={O.length}totalCount={w.length}label="logs"loadMoreStep={Q}hasMore={O.length<w.length}onLoadMore={()=>G(o=>o+Q)}/>:null}contentContainerStyle={[I.listContent,w.length===0&&{flexGrow:1}]}keyboardShouldPersistTaps="handled"/>
|
|
71
|
+
</S>});export default Uo;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
<
|
|
1
|
+
import te,{useCallback as re,useEffect as oe,useMemo as q,useRef as ae,useState as A}from"react";import{Alert as le,FlatList as Ce,Platform as be,ScrollView as N,StyleSheet as Te,Text as T,TextInput as Se,TouchableOpacity as Ie,View as C}from"react-native";import{useTranslation as Be}from"../../i18n";import{useInspector as Ve}from"./InspectorContext";import M from"../TouchableScale";import Fe from"../AnimatedEntrance";import Re from"../EndOfListFooter";import He from"./FeatureUnderDevNotice";import Pe from"../HighlightText";import{AppColors as e}from"../../styles/AppColors";import{AppFonts as k}from"../../styles/AppFonts";import{clearCrashRecords as Le}from"../../customHooks/crashHandler";import We,{DEFAULT_CRASH_FILTERS as G,isCrashFiltersDefault as W}from"./CrashFilterModal";import{SearchIcon as $e,ClearIcon as De,TrashIcon as Ae,TerminalIcon as Me,LayersIcon as je,ClockIcon as Oe,ShieldAlertIcon as Ee,FlameIcon as Ne,JsIcon as Je,HourglassIcon as _e,SkullIcon as Ue,LayoutIcon as Qe,ChipIcon as qe,AppleIcon as Ge,AndroidIcon as Ke,RepeatIcon as Xe,CodeBracketsIcon as Ye,FilterIcon as Ze,ForwardChevronIcon as Ct}from"../NetworkIcons";const bt=S=>{const R=Date.now(),j=Math.max(0,R-S),v=Math.floor(j/1e3),$=Math.floor(v/60),L=Math.floor($/60),D=Math.floor(L/24);return v<60?`${v}s ago`:$<60?`${$}m ago`:L<24?`${L}h ago`:`${D}d ago`},K=10,Tt=te.memo(()=>{const{t:S}=Be(),{crashRecords:R,setSelectedCrash:j,maxCrashLogs:v}=Ve(),$=v||50,L=ae(null),[D,J]=A($),[B,E]=A(""),[z,_]=A("all"),[w,U]=A(G),[X,Q]=A(!1);oe(()=>{J(v||50),L.current?.scrollToOffset({offset:0,animated:!1})},[B,z,w,v]);const V=q(()=>{const r=R.length;let o=0,x=0,F=0,I=0,O=0;return R.forEach(P=>{P.isFatal&&o++,P.type==="js"?x++:P.type==="promise"?F++:P.type==="render"?I++:P.type==="native"&&O++}),{total:r,fatalCount:o,jsCount:x,promiseCount:F,renderCount:I,nativeCount:O}},[R]),H=q(()=>{let r=R.filter(o=>{if(z==="fatal"&&!o.isFatal||z==="js"&&o.type!=="js"||z==="promise"&&o.type!=="promise"||z==="render"&&o.type!=="render"||z==="native"&&o.type!=="native"||w.types.size>0&&!w.types.has("all")&&!(w.types.has("fatal")&&o.isFatal||w.types.has("js")&&o.type==="js"||w.types.has("promise")&&o.type==="promise"||w.types.has("render")&&o.type==="render"||w.types.has("native")&&o.type==="native"))return!1;if(w.timeWindow!=="all"){const x=Date.now(),F=w.timeWindow==="15m"?x-900*1e3:w.timeWindow==="1h"?x-3600*1e3:w.timeWindow==="24h"?x-1440*60*1e3:x-10080*60*1e3;if(o.timestamp<F)return!1}if(w.platform!=="all"&&(o.deviceInfo?.platform||"").toLowerCase()!==w.platform)return!1;if(w.engine!=="all"){const x=o.deviceInfo?.isHermes;if(w.engine==="hermes"&&x!==!0||w.engine==="jsc"&&x===!0)return!1}if(B.trim().length>0){const x=B.trim().toLowerCase().split(/\s+/).filter(Boolean),F=[o.message||"",o.name||"",o.stack||"",o.type||"",o.deviceInfo?.platform||"",...(o.breadcrumbs||[]).map(I=>`${I.type||""} ${I.message||""}`)].join(" ").toLowerCase();return x.every(I=>F.includes(I))}return!0});return w.sortBy==="time_asc"&&(r=[...r].sort((o,x)=>o.timestamp-x.timestamp)),r},[R,z,B,w]),Y=()=>{le.alert(S("crash.clearTitle"),S("crash.clearMessage"),[{text:S("crash.clearCancel"),style:"cancel"},{text:S("crash.clearConfirm"),style:"destructive",onPress:()=>Le()}])},Z=re(({item:r,index:o})=>{const x=r.isFatal,F=r.type.toUpperCase(),I=r.parsedStack&&r.parsedStack.length>0?r.parsedStack.find(ee=>ee.isAppCode)||r.parsedStack[0]:null,O=r.type==="native"?`${e.errorColor}22`:r.type==="render"?`${e.purple}22`:r.type==="promise"?`${e.darkOrange}22`:`${e.offerPurple}22`,P=r.type==="native"?e.errorColor:r.type==="render"?e.purple:r.type==="promise"?e.darkOrange:e.offerPurple;return<Fe index={o}distance={8}>
|
|
2
|
+
<M onPress={()=>{j(r)}}style={[t.cardContainer,x&&t.fatalCardBorder]}>
|
|
3
3
|
|
|
4
4
|
<C style={t.cardHeader}>
|
|
5
5
|
<C style={t.badgeRow}>
|
|
@@ -8,13 +8,13 @@ import Y,{useCallback as Z,useMemo as Q,useRef as ee,useState as D}from"react";i
|
|
|
8
8
|
</C>
|
|
9
9
|
|
|
10
10
|
{x?<C style={t.fatalBadge}>
|
|
11
|
-
<
|
|
11
|
+
<Ne size={10}color={e.white}/>
|
|
12
12
|
<T style={t.fatalBadgeText}>{S("crash.fatalBadge")}</T>
|
|
13
13
|
</C>:<C style={t.caughtBadge}>
|
|
14
14
|
<T style={t.caughtBadgeText}>{S("crash.handledBadge")}</T>
|
|
15
15
|
</C>}
|
|
16
16
|
|
|
17
|
-
<C style={[t.typeBadge,{backgroundColor:
|
|
17
|
+
<C style={[t.typeBadge,{backgroundColor:O}]}>
|
|
18
18
|
<T style={[t.typeBadgeText,{color:P}]}>
|
|
19
19
|
{F}
|
|
20
20
|
</T>
|
|
@@ -83,8 +83,8 @@ import Y,{useCallback as Z,useMemo as Q,useRef as ee,useState as D}from"react";i
|
|
|
83
83
|
</C>}
|
|
84
84
|
</C>
|
|
85
85
|
</C>
|
|
86
|
-
</
|
|
87
|
-
</Fe>},[B,
|
|
86
|
+
</M>
|
|
87
|
+
</Fe>},[B,j]);return<C style={t.container}>
|
|
88
88
|
{R.length>0&&<>
|
|
89
89
|
|
|
90
90
|
<C style={t.statsBar}>
|
|
@@ -136,29 +136,29 @@ import Y,{useCallback as Z,useMemo as Q,useRef as ee,useState as D}from"react";i
|
|
|
136
136
|
<C style={t.searchRow}>
|
|
137
137
|
<C style={t.searchInputWrapper}>
|
|
138
138
|
<$e color={e.grayTextWeak}size={14}/>
|
|
139
|
-
<Se value={B}onChangeText={
|
|
139
|
+
<Se value={B}onChangeText={E}placeholder={S("crash.searchPlaceholder")}placeholderTextColor={e.grayTextWeak}style={t.searchInput}autoCapitalize="none"autoCorrect={!1}/>
|
|
140
140
|
{B.length>0&&<C style={{flexDirection:"row",alignItems:"center",gap:4}}>
|
|
141
141
|
<C style={{backgroundColor:`${e.purple}20`,borderRadius:10,paddingHorizontal:6,paddingVertical:1.5}}>
|
|
142
142
|
<T style={{color:e.purple,fontSize:9.5,fontFamily:k.interBold}}>
|
|
143
143
|
{H.length}
|
|
144
144
|
</T>
|
|
145
145
|
</C>
|
|
146
|
-
<Ie onPress={()=>
|
|
146
|
+
<Ie onPress={()=>E("")}hitSlop={8}>
|
|
147
147
|
<De color={e.grayTextWeak}size={14}/>
|
|
148
148
|
</Ie>
|
|
149
149
|
</C>}
|
|
150
150
|
</C>
|
|
151
151
|
|
|
152
152
|
|
|
153
|
-
<
|
|
154
|
-
<Ze size={14}color={
|
|
155
|
-
{!
|
|
156
|
-
</
|
|
153
|
+
<M onPress={()=>Q(!0)}style={[t.filterButton,!W(w)&&{borderColor:`${e.brandPurple}60`,backgroundColor:`${e.brandPurple}15`}]}>
|
|
154
|
+
<Ze size={14}color={W(w)?e.grayTextStrong:e.brandPurple}/>
|
|
155
|
+
{!W(w)&&<C style={{position:"absolute",top:2,right:2,width:7,height:7,borderRadius:3.5,backgroundColor:e.darkOrange,borderWidth:1,borderColor:e.white}}/>}
|
|
156
|
+
</M>
|
|
157
157
|
|
|
158
158
|
|
|
159
|
-
<
|
|
159
|
+
<M onPress={Y}style={t.clearButton}>
|
|
160
160
|
<Ae size={14}color={e.errorColor}/>
|
|
161
|
-
</
|
|
161
|
+
</M>
|
|
162
162
|
</C>
|
|
163
163
|
|
|
164
164
|
<He featureName="Crash & Exception Sentinel"/>
|
|
@@ -166,7 +166,7 @@ import Y,{useCallback as Z,useMemo as Q,useRef as ee,useState as D}from"react";i
|
|
|
166
166
|
|
|
167
167
|
<C style={{flexDirection:"row",alignItems:"center",marginBottom:8,paddingHorizontal:12,gap:6}}>
|
|
168
168
|
<N horizontal showsHorizontalScrollIndicator={!1}style={{flex:1}}contentContainerStyle={{flexDirection:"row",alignItems:"center",gap:6,paddingRight:6}}>
|
|
169
|
-
{[{key:"all",label:S("crash.filterAll"),Icon:je,count:V.total,themeColor:e.purple},{key:"fatal",label:S("crash.filterFatal"),Icon:
|
|
169
|
+
{[{key:"all",label:S("crash.filterAll"),Icon:je,count:V.total,themeColor:e.purple},{key:"fatal",label:S("crash.filterFatal"),Icon:Ue,count:V.fatalCount,themeColor:e.errorColor},{key:"js",label:S("crash.filterJsError"),Icon:Je,count:V.jsCount,themeColor:e.amber600},{key:"promise",label:S("crash.filterPromise"),Icon:_e,count:V.promiseCount,themeColor:e.orange600},{key:"render",label:S("crash.filterRender"),Icon:Qe,count:V.renderCount,themeColor:e.violet600},{key:"native",label:S("crash.filterNative"),Icon:qe,count:V.nativeCount,themeColor:e.cyan600}].map(r=>{const o=z===r.key,x=r.themeColor||e.purple,F=o?e.white:x,I=r.Icon;return<M key={r.key}onPress={()=>_(r.key)}>
|
|
170
170
|
<C style={{flexDirection:"row",alignItems:"center",paddingHorizontal:9,paddingVertical:4.5,borderRadius:8,backgroundColor:o?x:`${x}12`,borderWidth:1,borderColor:o?x:`${x}30`,gap:5}}>
|
|
171
171
|
<I size={11}color={F}/>
|
|
172
172
|
<T style={{fontFamily:k.interBold,fontSize:10.5,color:o?e.white:e.primaryBlack}}>
|
|
@@ -178,7 +178,7 @@ import Y,{useCallback as Z,useMemo as Q,useRef as ee,useState as D}from"react";i
|
|
|
178
178
|
</T>
|
|
179
179
|
</C>
|
|
180
180
|
</C>
|
|
181
|
-
</
|
|
181
|
+
</M>})}
|
|
182
182
|
</N>
|
|
183
183
|
</C>
|
|
184
184
|
</C>
|
|
@@ -187,23 +187,23 @@ import Y,{useCallback as Z,useMemo as Q,useRef as ee,useState as D}from"react";i
|
|
|
187
187
|
|
|
188
188
|
{H.length===0?<N contentContainerStyle={t.emptyContainer}showsVerticalScrollIndicator={!1}>
|
|
189
189
|
<C style={t.emptyIconCircle}>
|
|
190
|
-
<
|
|
190
|
+
<Ee size={38}color={e.greenColor}/>
|
|
191
191
|
</C>
|
|
192
192
|
<T style={t.emptyTitle}>
|
|
193
|
-
{B.length>0?"No matching crash entries":z!=="all"||!
|
|
193
|
+
{B.length>0?"No matching crash entries":z!=="all"||!W(w)?"No crashes match filters":S("crash.emptyTitle")}
|
|
194
194
|
</T>
|
|
195
195
|
<T style={t.emptySub}>
|
|
196
|
-
{B?`No crash entries matched "${B}"`:z!=="all"||!
|
|
196
|
+
{B?`No crash entries matched "${B}"`:z!=="all"||!W(w)?"Try adjusting your filters or search keywords.":S("crash.emptySubtitle")}
|
|
197
197
|
</T>
|
|
198
|
-
{(B.length>0||z!=="all"||!
|
|
198
|
+
{(B.length>0||z!=="all"||!W(w))&&<M onPress={()=>{E(""),_("all"),U(G)}}style={{marginTop:10,paddingHorizontal:14,paddingVertical:7,borderRadius:8,backgroundColor:e.purple}}>
|
|
199
199
|
<T style={{fontFamily:k.interBold,fontSize:11.5,color:e.white}}>
|
|
200
200
|
Clear Search & Filters
|
|
201
201
|
</T>
|
|
202
|
-
</
|
|
202
|
+
</M>}
|
|
203
203
|
</N>:<>
|
|
204
|
-
<Ce ref={
|
|
204
|
+
<Ce ref={L}data={H.slice(0,D)}keyExtractor={r=>r.id}renderItem={Z}initialNumToRender={12}maxToRenderPerBatch={8}windowSize={5}removeClippedSubviews={be.OS==="android"}renderToHardwareTextureAndroid={!0}contentContainerStyle={t.listContent}showsVerticalScrollIndicator={!1}ListFooterComponent={H.length>0?<Re count={Math.min(D,H.length)}totalCount={H.length}label="crashes"loadMoreStep={K}hasMore={H.length>D}onLoadMore={()=>J(r=>r+K)}/>:null}/>
|
|
205
205
|
</>}
|
|
206
206
|
|
|
207
207
|
|
|
208
|
-
<We visible={
|
|
208
|
+
<We visible={X}onClose={()=>Q(!1)}filters={w}onApply={U}searchQuery={B}/>
|
|
209
209
|
</C>});export default Tt;const t=Te.create({container:{flex:1,backgroundColor:e.grayBackground},statsBar:{backgroundColor:e.primaryLight,borderBottomWidth:1,borderBottomColor:e.grayBorderSecondary,paddingVertical:10},statsScrollContent:{paddingHorizontal:16,gap:8},statChip:{flexDirection:"row",alignItems:"center",gap:6,paddingHorizontal:10,paddingVertical:5,borderRadius:8,backgroundColor:e.purpleShade50,borderWidth:1,borderColor:`${e.purple}14`},statChipActive:{backgroundColor:`${e.purple}14`,borderColor:`${e.purple}33`},statChipValue:{fontFamily:k.interBold,fontSize:13,color:e.primaryBlack},statChipLabel:{fontFamily:k.interMedium,fontSize:11,color:e.grayText},controlsContainer:{paddingHorizontal:16,paddingTop:12,paddingBottom:6,backgroundColor:e.grayBackground},searchRow:{flexDirection:"row",alignItems:"center",gap:8},searchInputWrapper:{flex:1,flexDirection:"row",alignItems:"center",backgroundColor:e.primaryLight,borderWidth:1,borderColor:e.grayBorderSecondary,borderRadius:10,paddingHorizontal:10,height:38,gap:8},searchInput:{flex:1,fontFamily:k.interRegular,fontSize:13,color:e.primaryBlack,paddingVertical:0},clearButton:{width:38,height:38,borderRadius:10,backgroundColor:`${e.errorColor}14`,borderWidth:1,borderColor:`${e.errorColor}22`,alignItems:"center",justifyContent:"center"},filterButton:{width:38,height:38,borderRadius:10,backgroundColor:`${e.brandPurple}0F`,borderWidth:1,borderColor:`${e.brandPurple}30`,alignItems:"center",justifyContent:"center"},filterScrollContent:{paddingVertical:10,gap:6},filterChip:{flexDirection:"row",alignItems:"center",gap:5,paddingHorizontal:12,paddingVertical:6,borderRadius:8,backgroundColor:e.primaryLight,borderWidth:1,borderColor:e.grayBorderSecondary},filterChipActive:{backgroundColor:e.purple,borderColor:e.purple},filterChipText:{fontFamily:k.interMedium,fontSize:12,color:e.grayText},filterChipTextActive:{fontFamily:k.interBold,color:e.white},listContent:{paddingHorizontal:16,paddingTop:4,paddingBottom:24,gap:10},cardContainer:{backgroundColor:e.primaryLight,borderRadius:12,borderWidth:1,borderColor:e.grayBorderSecondary,padding:14,shadowColor:e.shadowColorString,shadowOffset:{width:0,height:1},shadowOpacity:.05,shadowRadius:3,elevation:2},fatalCardBorder:{borderColor:`${e.errorColor}44`},cardHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between"},badgeRow:{flexDirection:"row",alignItems:"center",gap:6,flexShrink:1},sNoBadge:{backgroundColor:e.grayBackground,borderWidth:1,borderColor:e.grayBorderSecondary,paddingHorizontal:6,paddingVertical:3,borderRadius:5},sNoBadgeText:{fontFamily:k.interBold,fontSize:9.5,color:e.grayText,letterSpacing:.3},fatalBadge:{flexDirection:"row",alignItems:"center",gap:4,backgroundColor:e.errorColor,paddingHorizontal:6,paddingVertical:3,borderRadius:5},fatalBadgeText:{fontFamily:k.interBold,fontSize:9.5,color:e.white,letterSpacing:.5},caughtBadge:{backgroundColor:`${e.greenColor}1F`,paddingHorizontal:6,paddingVertical:3,borderRadius:5},caughtBadgeText:{fontFamily:k.interBold,fontSize:9.5,color:e.greenColor,letterSpacing:.5},typeBadge:{paddingHorizontal:6,paddingVertical:3,borderRadius:5},typeBadgeText:{fontFamily:k.interBold,fontSize:9.5,letterSpacing:.5},timeRow:{flexDirection:"row",alignItems:"center",gap:4,flexShrink:1},timestampText:{fontFamily:k.interRegular,fontSize:11,color:e.grayTextWeak},relativeTimeText:{fontFamily:k.interBold,fontSize:10,color:e.grayTextWeak,backgroundColor:e.grayBackground,paddingHorizontal:5,paddingVertical:1,borderRadius:4,overflow:"hidden"},errorMessageText:{fontFamily:k.interBold,fontSize:13.5,color:e.primaryBlack,lineHeight:18},locationRow:{flexDirection:"row",alignItems:"center",gap:6,marginTop:2,marginBottom:6,backgroundColor:e.purpleShade50,paddingHorizontal:8,paddingVertical:4,borderRadius:6},locationText:{fontFamily:k.interRegular,fontSize:11,color:e.grayText,flex:1},cardFooter:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginTop:6,paddingTop:8,borderTopWidth:1,borderTopColor:e.dividerColor},metaPill:{flexDirection:"row",alignItems:"center",gap:4,backgroundColor:e.purpleShade50,paddingHorizontal:6,paddingVertical:2,borderRadius:4},metaPillText:{fontFamily:k.interMedium,fontSize:10,color:e.grayTextWeak},emptyContainer:{flexGrow:1,alignItems:"center",justifyContent:"center",padding:32,paddingBottom:80},emptyIconCircle:{width:72,height:72,borderRadius:36,backgroundColor:`${e.greenColor}1F`,alignItems:"center",justifyContent:"center",marginBottom:16},emptyTitle:{fontFamily:k.interBold,fontSize:17,color:e.primaryBlack,marginBottom:6},emptySub:{fontFamily:k.interRegular,fontSize:13,color:e.grayText,textAlign:"center",lineHeight:18,maxWidth:280}});
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import X,{useCallback as de,useMemo as J,useRef as Oe}from"react";import{FlatList as $e,Platform as qe,Pressable as Ne,ScrollView as He,Text as R,TextInput as Ae,View as C}from"react-native";import{useInspector as De}from"./InspectorContext";import O from"../TouchableScale";import Ce from"../AnimatedEntrance";import Me from"../DomainHeader";import Ee from"../LogCard";import We from"../EmptyState";import Ge from"../EndOfListFooter";import Qe from"./NetworkFilterModal";import b from"../../styles";import{AppColors as e}from"../../styles/AppColors";import{AppFonts as k}from"../../styles/AppFonts";import{METHOD_COLORS as Se}from"../../constants";import{useTranslation as _e}from"../../i18n";import{SearchIcon as Ue,ClearIcon as Ke,TrashIcon as Xe,SortArrowIcon as Je,FilterIcon as Te,ChevronIcon as Ye,CheckIcon as Ze,CircleCheckIcon as Co,CircleXIcon as So,LayersIcon as To,ClockIcon as Vo,RequestIcon as Io,ResponseIcon as Ro,AtomIcon as Fo}from"../NetworkIcons";const Lo=X.memo(()=>{const{groupedData:Y,loadMoreSection:Z,search:F,setSearch:M,setSearchScope:xe,quickFilter:G,setQuickFilter:j,handleDelete:Ve,selectedLogs:E,sortOrder:Q,setSortOrder:v,statusFilters:x,setStatusFilters:
|
|
1
|
+
import X,{useCallback as de,useMemo as J,useRef as Oe}from"react";import{FlatList as $e,Platform as qe,Pressable as Ne,ScrollView as He,Text as R,TextInput as Ae,View as C}from"react-native";import{useInspector as De}from"./InspectorContext";import O from"../TouchableScale";import Ce from"../AnimatedEntrance";import Me from"../DomainHeader";import Ee from"../LogCard";import We from"../EmptyState";import Ge from"../EndOfListFooter";import Qe from"./NetworkFilterModal";import b from"../../styles";import{AppColors as e}from"../../styles/AppColors";import{AppFonts as k}from"../../styles/AppFonts";import{METHOD_COLORS as Se}from"../../constants";import{useTranslation as _e}from"../../i18n";import{SearchIcon as Ue,ClearIcon as Ke,TrashIcon as Xe,SortArrowIcon as Je,FilterIcon as Te,ChevronIcon as Ye,CheckIcon as Ze,CircleCheckIcon as Co,CircleXIcon as So,LayersIcon as To,ClockIcon as Vo,RequestIcon as Io,ResponseIcon as Ro,AtomIcon as Fo}from"../NetworkIcons";const Lo=X.memo(()=>{const{groupedData:Y,loadMoreSection:Z,search:F,setSearch:M,setSearchScope:xe,quickFilter:G,setQuickFilter:j,handleDelete:Ve,selectedLogs:E,sortOrder:Q,setSortOrder:v,statusFilters:x,setStatusFilters:N,methodFilters:V,setMethodFilters:H,filteredLogs:$,logs:A,toggleSectionFilter:ee,toggleSectionCollapse:oe,minStart:te,totalRange:re,newLogIds:le,toggleSelect:ie,setSelected:se}=De(),{t:_}=_e(),Ie=Oe(null),[Re,U]=X.useState(!1),[ae,ne]=X.useState(!1),ke=J(()=>({statusCodes:x.size>0?new Set(x):new Set(["all"]),methods:V.size>0?new Set(V):new Set(["all"]),latency:"all",protocol:"all",sortBy:Q==="newest"?"time_desc":"time_asc"}),[x,V,Q]),Fe=de(o=>{o.statusCodes.has("all")||o.statusCodes.size===0?N(new Set):N(new Set(o.statusCodes)),o.methods.has("all")||o.methods.size===0?H(new Set):H(new Set([...o.methods].map(z=>z))),o.sortBy==="time_asc"?v("oldest"):v("newest")},[N,H,v]),L=J(()=>{let o=0,z=0,T=0,I=0,D=0,W=0;return A.forEach(S=>{const P=typeof S.status=="number"?S.status:parseInt(String(S.status),10);S.status===0||S.status==null||!isNaN(P)&&P>=400?o++:!isNaN(P)&&P>=200&&P<400&&z++,(S.duration||0)>=500&&T++;const B=(S.method||"").toUpperCase();B==="POST"&&I++,B==="GET"&&D++;const K=(S.url||"").toLowerCase(),q=(S.client||"").toLowerCase();(K.includes("graphql")||q.includes("graphql")||q.includes("apollo"))&&W++}),{all:A.length,errors:o,success:z,slow:T,post:I,get:D,graphql:W}},[A]),Le=J(()=>[{id:"all",label:"All",count:L.all,color:e.purple},{id:"errors",label:"Errors",count:L.errors,color:e.errorColor},{id:"success",label:"2xx OK",count:L.success,color:e.greenColor},{id:"slow",label:"Slow >500ms",count:L.slow,color:e.warningIconGold},{id:"POST",label:"POST",count:L.post,color:Se.POST||"#3B82F6"},{id:"GET",label:"GET",count:L.get,color:Se.GET||"#10B981"},{id:"graphql",label:"GraphQL",count:L.graphql,color:e.graphqlPink}],[L]),Be=de(({item:o,index:z})=>{if(o.type==="header")return<Ce index={z}distance={8}>
|
|
2
2
|
<Me pageName={o.pageName}color={o.color}stats={o.stats}activeFilters={o.activeFilters}onToggleFilter={ee}isCollapsed={o.isCollapsed}onToggleCollapse={oe}isFirst={o.isFirst}timestamp={o.timestamp}/>
|
|
3
|
-
</Ce>;if(o.type==="loadMore"){const{pageName:W,color:S,remainingCount:P,totalCount:B,loadedCount:K,loadMoreStep:
|
|
3
|
+
</Ce>;if(o.type==="loadMore"){const{pageName:W,color:S,remainingCount:P,totalCount:B,loadedCount:K,loadMoreStep:q,hasMore:Pe}=o;return<C style={[b.treeNodeRow,b.treeNodeRowLast]}>
|
|
4
4
|
<C style={b.treeLines}>
|
|
5
5
|
<C style={[b.modernTreeLine,{borderColor:S},b.modernTreeLineLast]}/>
|
|
6
6
|
</C>
|
|
7
7
|
<C style={b.treeCardWrapper}>
|
|
8
|
-
{Pe?<O onPress={()=>Z(W,
|
|
8
|
+
{Pe?<O onPress={()=>Z(W,q||10)}hitSlop={6}style={{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:9,paddingHorizontal:12,marginVertical:3,marginRight:2,borderRadius:10,backgroundColor:`${S}14`,borderWidth:1.5,borderColor:`${S}40`,shadowColor:S,shadowOffset:{width:0,height:1.5},shadowOpacity:.1,shadowRadius:3,elevation:2}}>
|
|
9
9
|
<C style={{flexDirection:"row",alignItems:"center",gap:8}}>
|
|
10
10
|
<C style={{width:22,height:22,borderRadius:11,backgroundColor:S,alignItems:"center",justifyContent:"center",shadowColor:S,shadowOffset:{width:0,height:1},shadowOpacity:.25,shadowRadius:2,elevation:1}}>
|
|
11
11
|
<Ye color={e.white}size={9}direction="down"/>
|
|
12
12
|
</C>
|
|
13
13
|
<C>
|
|
14
14
|
<R style={{fontFamily:k.interBold,fontSize:12,color:S}}>
|
|
15
|
-
{_("footer.loadMoreRequests",{count:
|
|
15
|
+
{_("footer.loadMoreRequests",{count:q,defaultValue:`Load ${q} More Requests`})}
|
|
16
16
|
</R>
|
|
17
17
|
<R style={{fontFamily:k.interRegular,fontSize:9.5,color:e.grayTextWeak,marginTop:1}}>
|
|
18
18
|
Showing {K} of {B} requests
|
|
@@ -45,10 +45,10 @@ import X,{useCallback as de,useMemo as J,useRef as Oe}from"react";import{FlatLis
|
|
|
45
45
|
</C>
|
|
46
46
|
</C>}
|
|
47
47
|
</C>
|
|
48
|
-
</C>}const{log:T,isLast:I,color:
|
|
48
|
+
</C>}const{log:T,isLast:I,color:D}=o;return<Ce index={z}distance={8}style={[b.treeNodeRow,I&&b.treeNodeRowLast]}>
|
|
49
49
|
<C style={b.treeLines}>
|
|
50
|
-
<C style={[b.modernTreeLine,{borderColor:
|
|
51
|
-
{!I&&<C style={[b.modernTreeBranch,{borderColor:
|
|
50
|
+
<C style={[b.modernTreeLine,{borderColor:D},I&&b.modernTreeLineLast]}/>
|
|
51
|
+
{!I&&<C style={[b.modernTreeBranch,{borderColor:D}]}/>}
|
|
52
52
|
</C>
|
|
53
53
|
<C style={b.treeCardWrapper}>
|
|
54
54
|
<Ee item={T}isSelected={E.has(T.id)}onToggleSelect={ie}onPress={()=>{se(T)}}timelineMinStart={te}timelineTotalRange={re}isNew={le.has(T.id)}searchStr={F}/>
|
|
@@ -134,11 +134,11 @@ import X,{useCallback as de,useMemo as J,useRef as Oe}from"react";import{FlatLis
|
|
|
134
134
|
</C>
|
|
135
135
|
|
|
136
136
|
|
|
137
|
-
{(G!=="all"||F.trim().length>0||x.size>0||V.size>0||$.length!==
|
|
137
|
+
{(G!=="all"||F.trim().length>0||x.size>0||V.size>0||$.length!==A.length)&&<C style={{flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginHorizontal:12,marginBottom:8,paddingHorizontal:10,paddingVertical:5.5,backgroundColor:`${e.purple}10`,borderRadius:8,borderWidth:1,borderColor:`${e.purple}25`}}>
|
|
138
138
|
<R style={{fontFamily:k.interMedium,fontSize:10.5,color:e.purple}}>
|
|
139
|
-
Showing {$.length} of {
|
|
139
|
+
Showing {$.length} of {A.length} requests
|
|
140
140
|
</R>
|
|
141
|
-
<O onPress={()=>{M(""),j("all"),
|
|
141
|
+
<O onPress={()=>{M(""),j("all"),N(new Set),H(new Set)}}>
|
|
142
142
|
<R style={{fontFamily:k.interBold,fontSize:10.5,color:e.errorColor}}>
|
|
143
143
|
Clear All Filters
|
|
144
144
|
</R>
|
|
@@ -146,7 +146,7 @@ import X,{useCallback as de,useMemo as J,useRef as Oe}from"react";import{FlatLis
|
|
|
146
146
|
</C>}
|
|
147
147
|
</C>
|
|
148
148
|
|
|
149
|
-
<$e ref={Ie}data={Y}keyExtractor={o=>o?.id?.toString()}renderItem={Be}initialNumToRender={15}maxToRenderPerBatch={10}windowSize={9}removeClippedSubviews={qe.OS==="android"}renderToHardwareTextureAndroid={!0}ListEmptyComponent={<We isSearch={F.length>0||x.size>0||V.size>0||G!=="all"}searchQuery={F}customTitle={F.length>0?"No matching API requests":"No network activity"}onClearSearch={()=>{M(""),
|
|
149
|
+
<$e ref={Ie}data={Y}keyExtractor={o=>o?.id?.toString()}renderItem={Be}initialNumToRender={15}maxToRenderPerBatch={10}windowSize={9}removeClippedSubviews={qe.OS==="android"}renderToHardwareTextureAndroid={!0}ListEmptyComponent={<We isSearch={F.length>0||x.size>0||V.size>0||G!=="all"}searchQuery={F}customTitle={F.length>0?"No matching API requests":"No network activity"}onClearSearch={()=>{M(""),N(new Set),H(new Set),j("all"),xe("all")}}/>}ListFooterComponent={Y.length>0?<Ge count={$.length}totalCount={$.length}label="requests"/>:null}contentContainerStyle={[b.listContent,$.length===0&&{flexGrow:1}]}keyboardShouldPersistTaps="handled"/>
|
|
150
150
|
|
|
151
151
|
|
|
152
152
|
<Qe visible={Re}onClose={()=>U(!1)}filters={ke}onApply={Fe}searchQuery={F}/>
|
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
import
|
|
2
|
-
<
|
|
3
|
-
</
|
|
1
|
+
import j,{useCallback as V,useMemo as E,useRef as le,useState as q}from"react";import{FlatList as Ce,Platform as K,Pressable as Se,ScrollView as Pe,StyleSheet as Te,Text as Ie,TextInput as Be,View as C}from"react-native";import{useInspector as Re}from"./InspectorContext";import Le from"./PushCard";import F from"../TouchableScale";import Ve from"../AnimatedEntrance";import Ee from"../EmptyState";import Fe from"../EndOfListFooter";import S from"../../styles";import{AppColors as t}from"../../styles/AppColors";import{AppFonts as U}from"../../styles/AppFonts";import{ClearIcon as Ae,SearchIcon as Me,TrashIcon as Oe,BellIcon as We,SunIcon as $e,MoonIcon as He,ExternalLinkIcon as Ne,CloudPushIcon as _e,BoltIcon as De}from"../NetworkIcons";const G=10,J=j.memo(()=>{const{pushRecords:x,filteredPushRecords:P,pushSearch:r,setPushSearch:z,pushQuickFilter:T,setPushQuickFilter:A,setSelectedPush:M,clearAllPushLogs:X,simulatePush:O,maxPushLogs:B}=Re(),Y=B||50,W=le(null),[v,Z]=q(0),[$,H]=q(Y);j.useEffect(()=>{H(B||50),W.current?.scrollToOffset({offset:0,animated:!1})},[r,T,B]);const R=E(()=>P.slice(0,$),[P,$]),N=["salesforce","fcm","apns","deeplink","rich_media"],ee=V(()=>{const e=N[v%N.length];O(e),Z(o=>o+1)},[v,O]),_=E(()=>{let e=0,o=0,I=0;const k={};return x.forEach(L=>{const D=(L.appState||"").toLowerCase();D==="foreground"&&e++,D==="background"&&o++,L.action==="opened"&&I++;const Q=(L.source||"other").toLowerCase();k[Q]=(k[Q]||0)+1}),{all:x.length,foreground:e,background:o,opened:I,sources:k}},[x]),oe=E(()=>{const e=[{id:"all",label:"All",color:t.purple,icon:o=><We size={12}color={o}/>},{id:"foreground",label:"Foreground",color:t.greenColor,icon:o=><$e size={12}color={o}/>},{id:"background",label:"Background",color:t.darkOrange,icon:o=><He size={12}color={o}/>},{id:"opened",label:"Opened",color:t.brandPurple,icon:o=><Ne size={12}color={o}/>}];return Object.entries(_.sources).forEach(([o,I])=>{I>0&&o!=="all"&&e.push({id:`source:${o}`,label:o.toUpperCase(),color:o==="salesforce"?t.sky600:t.brandPurple,icon:k=><_e size={12}color={k}/>})}),e},[_]),te=V(({item:e,index:o})=><Ve index={o}distance={8}>
|
|
2
|
+
<Le item={e}searchStr={r}onPress={()=>M(e)}/>
|
|
3
|
+
</Ve>,[r,M]),re=V(e=>e.id||`push_${e.timestamp}`,[]);return<C style={{flex:1}}>
|
|
4
4
|
|
|
5
5
|
<C style={{marginTop:6}}>
|
|
6
6
|
<C style={S.toolbarRow}>
|
|
7
7
|
<C style={[S.searchContainer,{flex:1,marginRight:8,height:38}]}>
|
|
8
8
|
<C style={S.searchIcon}>
|
|
9
|
-
<
|
|
9
|
+
<Me color={t.grayTextWeak}size={15}/>
|
|
10
10
|
</C>
|
|
11
|
-
<
|
|
12
|
-
{
|
|
13
|
-
<
|
|
14
|
-
<
|
|
15
|
-
</
|
|
11
|
+
<Be style={[S.searchInput,{paddingVertical:0}]}placeholder="Search notifications..."placeholderTextColor={t.grayTextWeak}value={r}onChangeText={z}autoCapitalize="none"autoCorrect={!1}returnKeyType="search"clearButtonMode="while-editing"/>
|
|
12
|
+
{r.length>0&&K.OS==="android"&&<C style={{position:"absolute",right:8,top:0,bottom:0,justifyContent:"center"}}>
|
|
13
|
+
<Se onPress={()=>z("")}hitSlop={10}style={S.clearBtn}>
|
|
14
|
+
<Ae color={t.grayTextWeak}size={13}/>
|
|
15
|
+
</Se>
|
|
16
16
|
</C>}
|
|
17
17
|
</C>
|
|
18
18
|
|
|
19
19
|
<C style={S.toolbarRight}>
|
|
20
|
-
<
|
|
21
|
-
<
|
|
22
|
-
</
|
|
20
|
+
<F style={[S.toolbarBtn,{backgroundColor:`${t.brandPurple}14`,borderColor:`${t.brandPurple}30`}]}onPress={ee}hitSlop={6}accessibilityRole="button"accessibilityLabel="Simulate incoming push notification">
|
|
21
|
+
<De color={t.brandPurple}size={15}/>
|
|
22
|
+
</F>
|
|
23
23
|
|
|
24
|
-
{
|
|
25
|
-
<
|
|
26
|
-
</
|
|
24
|
+
{x.length>0&&<F style={[S.toolbarBtn,{borderColor:`${t.errorColor}38`,backgroundColor:`${t.errorColor}0F`}]}onPress={X}hitSlop={6}accessibilityRole="button"accessibilityLabel="Clear all push notification history">
|
|
25
|
+
<Oe color={t.errorColor}size={15}/>
|
|
26
|
+
</F>}
|
|
27
27
|
</C>
|
|
28
28
|
</C>
|
|
29
29
|
</C>
|
|
30
30
|
|
|
31
31
|
|
|
32
|
-
<C style={
|
|
33
|
-
<
|
|
34
|
-
{
|
|
35
|
-
{
|
|
36
|
-
<
|
|
37
|
-
{
|
|
38
|
-
</
|
|
39
|
-
</
|
|
40
|
-
</
|
|
32
|
+
<C style={w.carouselWrapper}>
|
|
33
|
+
<Pe horizontal showsHorizontalScrollIndicator={!1}contentContainerStyle={w.carouselContent}>
|
|
34
|
+
{oe.map(e=>{const o=T===e.id;return<F key={e.id}onPress={()=>A(e.id)}style={[w.filterPill,o&&{backgroundColor:e.color,borderColor:e.color}]}>
|
|
35
|
+
{e.icon?e.icon(o?t.white:e.color):null}
|
|
36
|
+
<Ie style={[w.filterPillText,o&&{color:t.white}]}>
|
|
37
|
+
{e.label}
|
|
38
|
+
</Ie>
|
|
39
|
+
</F>})}
|
|
40
|
+
</Pe>
|
|
41
41
|
</C>
|
|
42
42
|
|
|
43
43
|
|
|
44
|
-
<
|
|
45
|
-
</C>}),
|
|
44
|
+
<Ce ref={W}data={R}renderItem={te}keyExtractor={re}contentContainerStyle={w.listContent}initialNumToRender={15}maxToRenderPerBatch={20}windowSize={11}removeClippedSubviews={K.OS==="android"}ListEmptyComponent={<Ee isSearch={!!(r||T!=="all")}searchQuery={r}customTitle={r||T!=="all"?"No matching push notifications":"No push notifications captured yet"}customSub={r||T!=="all"?"Try adjusting your search query or filter chips.":"Incoming or opened push payloads from any domain (Salesforce, FCM, APNs, etc.) will appear here automatically."}onClearSearch={()=>{z(""),A("all")}}showReload={!1}/>}ListFooterComponent={P.length>0?<Fe count={R.length}totalCount={P.length}label="push notifications"loadMoreStep={G}hasMore={R.length<P.length}onLoadMore={()=>H(e=>e+G)}/>:null}/>
|
|
45
|
+
</C>}),w=Te.create({carouselWrapper:{paddingVertical:6,borderBottomWidth:1,borderBottomColor:t.dividerColor,backgroundColor:t.white},carouselContent:{paddingHorizontal:8,gap:6,flexDirection:"row",alignItems:"center"},filterPill:{flexDirection:"row",alignItems:"center",gap:5,paddingHorizontal:9,paddingVertical:4.5,borderRadius:20,backgroundColor:t.grayBackground,borderWidth:1,borderColor:t.dividerColor},filterPillText:{fontSize:11,fontFamily:U.interMedium,color:t.primaryBlack},countBadge:{paddingHorizontal:5,paddingVertical:1,borderRadius:10},countBadgeText:{fontSize:9.5,fontFamily:U.interBold},listContent:{padding:8,paddingBottom:24}});J.displayName="PushTab";export default J;
|