react-native-inapp-inspector 1.1.13 → 1.1.14
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/AnalyticsEventCard.js +100 -13
- package/dist/commonjs/constants/version.d.ts +1 -1
- package/dist/commonjs/constants/version.js +1 -1
- package/dist/commonjs/customHooks/analyticsLogger.d.ts +8 -0
- package/dist/commonjs/customHooks/analyticsLogger.js +42 -1
- package/dist/commonjs/index.d.ts +1 -1
- package/dist/commonjs/index.js +237 -353
- package/dist/commonjs/styles/index.d.ts +92 -33
- package/dist/commonjs/styles/index.js +101 -45
- package/dist/esm/components/AnalyticsEventCard.js +100 -13
- package/dist/esm/constants/version.d.ts +1 -1
- package/dist/esm/constants/version.js +1 -1
- package/dist/esm/customHooks/analyticsLogger.d.ts +8 -0
- package/dist/esm/customHooks/analyticsLogger.js +37 -0
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js +235 -355
- package/dist/esm/styles/index.d.ts +92 -33
- package/dist/esm/styles/index.js +101 -45
- package/example/android/app/build.gradle +29 -1
- package/example/android/app/src/main/java/com/example/MainApplication.kt +25 -0
- package/example/android/build.gradle +31 -4
- package/example/android/gradle/wrapper/gradle-wrapper.properties +1 -1
- package/example/android/gradle.properties +1 -0
- package/example/android/settings.gradle +20 -1
- package/example/package-lock.json +1 -1
- package/package.json +1 -1
|
@@ -305,6 +305,25 @@ export declare const getRawStyles: (colors: typeof AppColors) => {
|
|
|
305
305
|
color: string;
|
|
306
306
|
fontSize: number;
|
|
307
307
|
};
|
|
308
|
+
fabGreenDot: {
|
|
309
|
+
position: string;
|
|
310
|
+
top: number;
|
|
311
|
+
right: number;
|
|
312
|
+
width: number;
|
|
313
|
+
height: number;
|
|
314
|
+
borderRadius: number;
|
|
315
|
+
backgroundColor: string;
|
|
316
|
+
borderWidth: number;
|
|
317
|
+
borderColor: string;
|
|
318
|
+
shadowColor: string;
|
|
319
|
+
shadowOffset: {
|
|
320
|
+
width: number;
|
|
321
|
+
height: number;
|
|
322
|
+
};
|
|
323
|
+
shadowOpacity: number;
|
|
324
|
+
shadowRadius: number;
|
|
325
|
+
elevation: number;
|
|
326
|
+
};
|
|
308
327
|
statBox: {
|
|
309
328
|
flex: number;
|
|
310
329
|
alignItems: string;
|
|
@@ -1670,15 +1689,22 @@ export declare const getRawStyles: (colors: typeof AppColors) => {
|
|
|
1670
1689
|
marginTop: number;
|
|
1671
1690
|
};
|
|
1672
1691
|
analyticsCardRow: {};
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1692
|
+
analyticsIconCircle: {
|
|
1693
|
+
width: number;
|
|
1694
|
+
height: number;
|
|
1695
|
+
borderRadius: number;
|
|
1696
|
+
alignItems: string;
|
|
1697
|
+
justifyContent: string;
|
|
1698
|
+
};
|
|
1699
|
+
analyticsHeaderCard: {
|
|
1676
1700
|
backgroundColor: string;
|
|
1677
1701
|
borderRadius: number;
|
|
1678
1702
|
borderWidth: number;
|
|
1679
1703
|
borderColor: string;
|
|
1680
|
-
|
|
1681
|
-
|
|
1704
|
+
padding: number;
|
|
1705
|
+
marginHorizontal: number;
|
|
1706
|
+
marginTop: number;
|
|
1707
|
+
marginBottom: number;
|
|
1682
1708
|
shadowColor: string;
|
|
1683
1709
|
shadowOpacity: number;
|
|
1684
1710
|
shadowRadius: number;
|
|
@@ -1688,61 +1714,94 @@ export declare const getRawStyles: (colors: typeof AppColors) => {
|
|
|
1688
1714
|
};
|
|
1689
1715
|
elevation: number;
|
|
1690
1716
|
};
|
|
1691
|
-
|
|
1717
|
+
analyticsHeaderTop: {
|
|
1692
1718
|
flexDirection: string;
|
|
1693
|
-
alignItems: string;
|
|
1694
1719
|
justifyContent: string;
|
|
1720
|
+
alignItems: string;
|
|
1695
1721
|
marginBottom: number;
|
|
1696
1722
|
};
|
|
1697
|
-
|
|
1723
|
+
analyticsHeaderTitle: {
|
|
1698
1724
|
fontFamily: string;
|
|
1699
1725
|
fontSize: number;
|
|
1700
1726
|
color: string;
|
|
1701
|
-
letterSpacing: number;
|
|
1702
|
-
textTransform: string;
|
|
1703
1727
|
};
|
|
1704
|
-
|
|
1728
|
+
statusDot: {
|
|
1729
|
+
width: number;
|
|
1730
|
+
height: number;
|
|
1731
|
+
borderRadius: number;
|
|
1732
|
+
};
|
|
1733
|
+
analyticsHeaderSubtitle: {
|
|
1705
1734
|
fontFamily: string;
|
|
1706
1735
|
fontSize: number;
|
|
1707
1736
|
color: string;
|
|
1708
|
-
|
|
1737
|
+
marginTop: number;
|
|
1709
1738
|
};
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1739
|
+
analyticsHeaderToggle: {
|
|
1740
|
+
paddingVertical: number;
|
|
1741
|
+
paddingHorizontal: number;
|
|
1742
|
+
borderRadius: number;
|
|
1743
|
+
backgroundColor: string;
|
|
1744
|
+
borderWidth: number;
|
|
1745
|
+
borderColor: string;
|
|
1715
1746
|
};
|
|
1716
|
-
|
|
1747
|
+
analyticsHeaderToggleText: {
|
|
1717
1748
|
fontFamily: string;
|
|
1718
1749
|
fontSize: number;
|
|
1719
1750
|
color: string;
|
|
1720
|
-
flex: number;
|
|
1721
1751
|
};
|
|
1722
|
-
|
|
1752
|
+
analyticsStatsRow: {
|
|
1753
|
+
flexDirection: string;
|
|
1754
|
+
gap: number;
|
|
1755
|
+
borderTopWidth: number;
|
|
1756
|
+
borderTopColor: string;
|
|
1757
|
+
paddingTop: number;
|
|
1758
|
+
};
|
|
1759
|
+
analyticsStatBox: {
|
|
1723
1760
|
flex: number;
|
|
1724
|
-
height: number;
|
|
1725
1761
|
backgroundColor: string;
|
|
1726
1762
|
borderRadius: number;
|
|
1727
|
-
|
|
1763
|
+
paddingVertical: number;
|
|
1764
|
+
alignItems: string;
|
|
1728
1765
|
};
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1766
|
+
analyticsStatValue: {
|
|
1767
|
+
fontFamily: string;
|
|
1768
|
+
fontSize: number;
|
|
1769
|
+
color: string;
|
|
1732
1770
|
};
|
|
1733
|
-
|
|
1771
|
+
analyticsStatLabel: {
|
|
1734
1772
|
fontFamily: string;
|
|
1735
1773
|
fontSize: number;
|
|
1736
1774
|
color: string;
|
|
1737
|
-
|
|
1738
|
-
textAlign: string;
|
|
1775
|
+
marginTop: number;
|
|
1739
1776
|
};
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1777
|
+
analyticsHeaderDetails: {
|
|
1778
|
+
borderTopWidth: number;
|
|
1779
|
+
borderTopColor: string;
|
|
1780
|
+
paddingTop: number;
|
|
1781
|
+
marginTop: number;
|
|
1782
|
+
};
|
|
1783
|
+
detailsGroupTitle: {
|
|
1784
|
+
fontFamily: string;
|
|
1785
|
+
fontSize: number;
|
|
1786
|
+
color: string;
|
|
1787
|
+
marginBottom: number;
|
|
1788
|
+
};
|
|
1789
|
+
detailsRow: {
|
|
1790
|
+
flexDirection: string;
|
|
1745
1791
|
justifyContent: string;
|
|
1792
|
+
paddingVertical: number;
|
|
1793
|
+
borderBottomWidth: number;
|
|
1794
|
+
borderBottomColor: string;
|
|
1795
|
+
};
|
|
1796
|
+
detailsKey: {
|
|
1797
|
+
fontFamily: string;
|
|
1798
|
+
fontSize: number;
|
|
1799
|
+
color: string;
|
|
1800
|
+
};
|
|
1801
|
+
detailsValue: {
|
|
1802
|
+
fontFamily: string;
|
|
1803
|
+
fontSize: number;
|
|
1804
|
+
color: string;
|
|
1746
1805
|
};
|
|
1747
1806
|
};
|
|
1748
1807
|
declare const styles: any;
|
|
@@ -297,6 +297,22 @@ const getRawStyles = (colors) => ({
|
|
|
297
297
|
color: colors.primaryLight,
|
|
298
298
|
fontSize: 11,
|
|
299
299
|
},
|
|
300
|
+
fabGreenDot: {
|
|
301
|
+
position: 'absolute',
|
|
302
|
+
top: 2,
|
|
303
|
+
right: 2,
|
|
304
|
+
width: 12,
|
|
305
|
+
height: 12,
|
|
306
|
+
borderRadius: 6,
|
|
307
|
+
backgroundColor: '#00E676',
|
|
308
|
+
borderWidth: 2,
|
|
309
|
+
borderColor: colors.primaryLight,
|
|
310
|
+
shadowColor: '#000000',
|
|
311
|
+
shadowOffset: { width: 0, height: 1 },
|
|
312
|
+
shadowOpacity: 0.2,
|
|
313
|
+
shadowRadius: 1.5,
|
|
314
|
+
elevation: 2,
|
|
315
|
+
},
|
|
300
316
|
statBox: {
|
|
301
317
|
flex: 1,
|
|
302
318
|
alignItems: 'center',
|
|
@@ -1561,76 +1577,116 @@ const getRawStyles = (colors) => ({
|
|
|
1561
1577
|
marginTop: 2,
|
|
1562
1578
|
},
|
|
1563
1579
|
analyticsCardRow: {},
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1580
|
+
analyticsIconCircle: {
|
|
1581
|
+
width: 24,
|
|
1582
|
+
height: 24,
|
|
1583
|
+
borderRadius: 12,
|
|
1584
|
+
alignItems: 'center',
|
|
1585
|
+
justifyContent: 'center',
|
|
1586
|
+
},
|
|
1587
|
+
analyticsHeaderCard: {
|
|
1567
1588
|
backgroundColor: colors.primaryLight,
|
|
1568
1589
|
borderRadius: 12,
|
|
1569
1590
|
borderWidth: 1,
|
|
1570
1591
|
borderColor: colors.grayBorderSecondary,
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1592
|
+
padding: 14,
|
|
1593
|
+
marginHorizontal: 12,
|
|
1594
|
+
marginTop: 8,
|
|
1595
|
+
marginBottom: 8,
|
|
1596
|
+
shadowColor: '#000000',
|
|
1597
|
+
shadowOpacity: 0.03,
|
|
1575
1598
|
shadowRadius: 4,
|
|
1576
1599
|
shadowOffset: { width: 0, height: 1 },
|
|
1577
1600
|
elevation: 1,
|
|
1578
1601
|
},
|
|
1579
|
-
|
|
1602
|
+
analyticsHeaderTop: {
|
|
1580
1603
|
flexDirection: 'row',
|
|
1581
|
-
alignItems: 'center',
|
|
1582
1604
|
justifyContent: 'space-between',
|
|
1583
|
-
|
|
1605
|
+
alignItems: 'center',
|
|
1606
|
+
marginBottom: 10,
|
|
1584
1607
|
},
|
|
1585
|
-
|
|
1608
|
+
analyticsHeaderTitle: {
|
|
1586
1609
|
fontFamily: AppFonts_1.AppFonts.interBold,
|
|
1587
|
-
fontSize:
|
|
1588
|
-
color: colors.
|
|
1589
|
-
|
|
1590
|
-
|
|
1610
|
+
fontSize: 14,
|
|
1611
|
+
color: colors.primaryBlack,
|
|
1612
|
+
},
|
|
1613
|
+
statusDot: {
|
|
1614
|
+
width: 6,
|
|
1615
|
+
height: 6,
|
|
1616
|
+
borderRadius: 3,
|
|
1591
1617
|
},
|
|
1592
|
-
|
|
1618
|
+
analyticsHeaderSubtitle: {
|
|
1593
1619
|
fontFamily: AppFonts_1.AppFonts.interMedium,
|
|
1594
|
-
fontSize:
|
|
1595
|
-
color: colors.
|
|
1596
|
-
|
|
1620
|
+
fontSize: 11,
|
|
1621
|
+
color: colors.grayText,
|
|
1622
|
+
marginTop: 2,
|
|
1623
|
+
},
|
|
1624
|
+
analyticsHeaderToggle: {
|
|
1625
|
+
paddingVertical: 4,
|
|
1626
|
+
paddingHorizontal: 8,
|
|
1627
|
+
borderRadius: 4,
|
|
1628
|
+
backgroundColor: colors.grayBackground,
|
|
1629
|
+
borderWidth: 1,
|
|
1630
|
+
borderColor: colors.grayBorderSecondary,
|
|
1631
|
+
},
|
|
1632
|
+
analyticsHeaderToggleText: {
|
|
1633
|
+
fontFamily: AppFonts_1.AppFonts.interBold,
|
|
1634
|
+
fontSize: 10,
|
|
1635
|
+
color: colors.purple,
|
|
1597
1636
|
},
|
|
1598
|
-
|
|
1637
|
+
analyticsStatsRow: {
|
|
1599
1638
|
flexDirection: 'row',
|
|
1600
|
-
alignItems: 'center',
|
|
1601
|
-
marginBottom: 8,
|
|
1602
1639
|
gap: 8,
|
|
1640
|
+
borderTopWidth: 1,
|
|
1641
|
+
borderTopColor: colors.dividerColor,
|
|
1642
|
+
paddingTop: 10,
|
|
1603
1643
|
},
|
|
1604
|
-
|
|
1605
|
-
fontFamily: AppFonts_1.AppFonts.interMedium,
|
|
1606
|
-
fontSize: 12,
|
|
1607
|
-
color: colors.primaryBlack,
|
|
1644
|
+
analyticsStatBox: {
|
|
1608
1645
|
flex: 1,
|
|
1609
|
-
},
|
|
1610
|
-
analyticsTopEventBarWrap: {
|
|
1611
|
-
flex: 0.8,
|
|
1612
|
-
height: 3,
|
|
1613
1646
|
backgroundColor: colors.grayBackground,
|
|
1614
|
-
borderRadius:
|
|
1615
|
-
|
|
1647
|
+
borderRadius: 6,
|
|
1648
|
+
paddingVertical: 6,
|
|
1649
|
+
alignItems: 'center',
|
|
1616
1650
|
},
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1651
|
+
analyticsStatValue: {
|
|
1652
|
+
fontFamily: AppFonts_1.AppFonts.interBold,
|
|
1653
|
+
fontSize: 14,
|
|
1654
|
+
color: colors.primaryBlack,
|
|
1620
1655
|
},
|
|
1621
|
-
|
|
1656
|
+
analyticsStatLabel: {
|
|
1657
|
+
fontFamily: AppFonts_1.AppFonts.interRegular,
|
|
1658
|
+
fontSize: 9,
|
|
1659
|
+
color: colors.grayText,
|
|
1660
|
+
marginTop: 1,
|
|
1661
|
+
},
|
|
1662
|
+
analyticsHeaderDetails: {
|
|
1663
|
+
borderTopWidth: 1,
|
|
1664
|
+
borderTopColor: colors.dividerColor,
|
|
1665
|
+
paddingTop: 10,
|
|
1666
|
+
marginTop: 10,
|
|
1667
|
+
},
|
|
1668
|
+
detailsGroupTitle: {
|
|
1622
1669
|
fontFamily: AppFonts_1.AppFonts.interBold,
|
|
1623
1670
|
fontSize: 11,
|
|
1624
|
-
color: colors.
|
|
1625
|
-
|
|
1626
|
-
textAlign: 'right',
|
|
1671
|
+
color: colors.purple,
|
|
1672
|
+
marginBottom: 6,
|
|
1627
1673
|
},
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1674
|
+
detailsRow: {
|
|
1675
|
+
flexDirection: 'row',
|
|
1676
|
+
justifyContent: 'space-between',
|
|
1677
|
+
paddingVertical: 4,
|
|
1678
|
+
borderBottomWidth: 0.5,
|
|
1679
|
+
borderBottomColor: colors.dividerColor,
|
|
1680
|
+
},
|
|
1681
|
+
detailsKey: {
|
|
1682
|
+
fontFamily: AppFonts_1.AppFonts.interMedium,
|
|
1683
|
+
fontSize: 11,
|
|
1684
|
+
color: colors.primaryBlack,
|
|
1685
|
+
},
|
|
1686
|
+
detailsValue: {
|
|
1687
|
+
fontFamily: AppFonts_1.AppFonts.interRegular,
|
|
1688
|
+
fontSize: 11,
|
|
1689
|
+
color: colors.grayText,
|
|
1634
1690
|
},
|
|
1635
1691
|
});
|
|
1636
1692
|
exports.getRawStyles = getRawStyles;
|
|
@@ -16,9 +16,10 @@ const EVENT_PALETTE = [
|
|
|
16
16
|
'#2E7D32', // dark green
|
|
17
17
|
];
|
|
18
18
|
export function getEventColor(name) {
|
|
19
|
+
const safeName = typeof name === 'string' ? name : String(name || '');
|
|
19
20
|
let hash = 0;
|
|
20
|
-
for (let i = 0; i <
|
|
21
|
-
hash = (hash * 31 +
|
|
21
|
+
for (let i = 0; i < safeName.length; i++) {
|
|
22
|
+
hash = (hash * 31 + safeName.charCodeAt(i)) | 0;
|
|
22
23
|
}
|
|
23
24
|
return EVENT_PALETTE[Math.abs(hash) % EVENT_PALETTE.length];
|
|
24
25
|
}
|
|
@@ -41,6 +42,63 @@ function formatGap(ms) {
|
|
|
41
42
|
const rem = s % 60;
|
|
42
43
|
return rem > 0 ? `+${m}m ${rem}s` : `+${m}m`;
|
|
43
44
|
}
|
|
45
|
+
function getEventCategory(name) {
|
|
46
|
+
if (!name)
|
|
47
|
+
return 'Custom';
|
|
48
|
+
const lowercaseName = name.toLowerCase();
|
|
49
|
+
if (lowercaseName === 'screen_view' || lowercaseName === 'page_view') {
|
|
50
|
+
return 'Page View';
|
|
51
|
+
}
|
|
52
|
+
// Ecommerce events
|
|
53
|
+
const ecommerceEvents = [
|
|
54
|
+
'purchase', 'add_to_cart', 'begin_checkout', 'view_item',
|
|
55
|
+
'select_item', 'remove_from_cart', 'view_cart',
|
|
56
|
+
'add_shipping_info', 'add_payment_info', 'refund',
|
|
57
|
+
'view_item_list', 'select_promotion', 'view_promotion'
|
|
58
|
+
];
|
|
59
|
+
if (ecommerceEvents.includes(lowercaseName)) {
|
|
60
|
+
return 'Ecommerce';
|
|
61
|
+
}
|
|
62
|
+
// Firebase System Auto-events
|
|
63
|
+
const systemEvents = [
|
|
64
|
+
'first_open', 'session_start', 'user_engagement',
|
|
65
|
+
'app_clear_data', 'app_exception', 'app_update', 'os_update',
|
|
66
|
+
'notification_receive', 'notification_open', 'notification_dismiss',
|
|
67
|
+
'screen_active', 'screen_inactive'
|
|
68
|
+
];
|
|
69
|
+
if (systemEvents.includes(lowercaseName) || lowercaseName.startsWith('firebase_') || lowercaseName.startsWith('_')) {
|
|
70
|
+
return 'System';
|
|
71
|
+
}
|
|
72
|
+
return 'Custom';
|
|
73
|
+
}
|
|
74
|
+
function getCategoryColors(category) {
|
|
75
|
+
switch (category) {
|
|
76
|
+
case 'Page View':
|
|
77
|
+
return {
|
|
78
|
+
bg: '#E3F2FD',
|
|
79
|
+
border: '#BBDEFB',
|
|
80
|
+
text: '#1976D2',
|
|
81
|
+
};
|
|
82
|
+
case 'Ecommerce':
|
|
83
|
+
return {
|
|
84
|
+
bg: '#E8F5E9',
|
|
85
|
+
border: '#C8E6C9',
|
|
86
|
+
text: '#2E7D32',
|
|
87
|
+
};
|
|
88
|
+
case 'System':
|
|
89
|
+
return {
|
|
90
|
+
bg: '#F5F5F5',
|
|
91
|
+
border: '#E0E0E0',
|
|
92
|
+
text: '#616161',
|
|
93
|
+
};
|
|
94
|
+
default:
|
|
95
|
+
return {
|
|
96
|
+
bg: '#F3E5F5',
|
|
97
|
+
border: '#E1BEE7',
|
|
98
|
+
text: '#7B1FA2',
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
}
|
|
44
102
|
// ─── Component ────────────────────────────────────────────────────────────────
|
|
45
103
|
const AnalyticsEventCard = React.memo(function AnalyticsEventCard({ event, onPress, isNew = false, searchStr = '', msSincePrev, computedScreenName, }) {
|
|
46
104
|
const color = getEventColor(event.name);
|
|
@@ -89,6 +147,19 @@ const AnalyticsEventCard = React.memo(function AnalyticsEventCard({ event, onPre
|
|
|
89
147
|
<HighlightText text={event.name} search={searchStr} style={[cardStyles.eventName, { color: color }]} highlightStyle={cardStyles.highlight}/>
|
|
90
148
|
</View>
|
|
91
149
|
|
|
150
|
+
{(() => {
|
|
151
|
+
const category = getEventCategory(event.name);
|
|
152
|
+
const tagColors = getCategoryColors(category);
|
|
153
|
+
return (<View style={[
|
|
154
|
+
cardStyles.categoryBadge,
|
|
155
|
+
{ backgroundColor: tagColors.bg, borderColor: tagColors.border },
|
|
156
|
+
]}>
|
|
157
|
+
<Text style={[cardStyles.categoryText, { color: tagColors.text }]}>
|
|
158
|
+
{category}
|
|
159
|
+
</Text>
|
|
160
|
+
</View>);
|
|
161
|
+
})()}
|
|
162
|
+
|
|
92
163
|
{event.count !== undefined ? (<View style={[
|
|
93
164
|
cardStyles.duplicateBadge,
|
|
94
165
|
event.count === 1 && {
|
|
@@ -112,20 +183,24 @@ const AnalyticsEventCard = React.memo(function AnalyticsEventCard({ event, onPre
|
|
|
112
183
|
{/* Bottom Row: Metadata Chips & Sparkline */}
|
|
113
184
|
<View style={cardStyles.cardBody}>
|
|
114
185
|
<View style={cardStyles.chipsRow}>
|
|
115
|
-
{
|
|
116
|
-
|
|
117
|
-
event.params?.firebase_screen ||
|
|
118
|
-
event.params?.screen_name ||
|
|
119
|
-
event.params?.firebase_screen_class ? (<View style={[cardStyles.chip, { backgroundColor: AppColors.grayBackground, borderColor: AppColors.grayBorderSecondary }]}>
|
|
120
|
-
<View style={[cardStyles.screenDot, { backgroundColor: color }]}/>
|
|
121
|
-
<Text style={[cardStyles.chipText, { color: AppColors.grayText }]} numberOfLines={1}>
|
|
122
|
-
{computedScreenName ||
|
|
186
|
+
{(() => {
|
|
187
|
+
const rawScreenName = computedScreenName ||
|
|
123
188
|
event.screenName ||
|
|
124
189
|
event.params?.firebase_screen ||
|
|
125
190
|
event.params?.screen_name ||
|
|
126
|
-
event.params?.firebase_screen_class
|
|
127
|
-
|
|
128
|
-
|
|
191
|
+
event.params?.firebase_screen_class;
|
|
192
|
+
if (!rawScreenName)
|
|
193
|
+
return null;
|
|
194
|
+
const screenNameStr = typeof rawScreenName === 'object'
|
|
195
|
+
? JSON.stringify(rawScreenName)
|
|
196
|
+
: String(rawScreenName);
|
|
197
|
+
return (<View style={[cardStyles.chip, { backgroundColor: AppColors.grayBackground, borderColor: AppColors.grayBorderSecondary }]}>
|
|
198
|
+
<View style={[cardStyles.screenDot, { backgroundColor: color }]}/>
|
|
199
|
+
<Text style={[cardStyles.chipText, { color: AppColors.grayText }]} numberOfLines={1}>
|
|
200
|
+
{screenNameStr}
|
|
201
|
+
</Text>
|
|
202
|
+
</View>);
|
|
203
|
+
})()}
|
|
129
204
|
|
|
130
205
|
<View style={[cardStyles.chip, { backgroundColor: AppColors.grayBackground, borderColor: AppColors.grayBorderSecondary }]}>
|
|
131
206
|
<Text style={[cardStyles.chipText, { color: AppColors.grayText }]}>
|
|
@@ -272,6 +347,18 @@ const cardStyles = StyleSheet.create({
|
|
|
272
347
|
textTransform: 'uppercase',
|
|
273
348
|
letterSpacing: 0.5,
|
|
274
349
|
},
|
|
350
|
+
categoryBadge: {
|
|
351
|
+
borderWidth: 1,
|
|
352
|
+
paddingHorizontal: 5,
|
|
353
|
+
paddingVertical: 2,
|
|
354
|
+
borderRadius: 4,
|
|
355
|
+
},
|
|
356
|
+
categoryText: {
|
|
357
|
+
fontFamily: AppFonts.interBold,
|
|
358
|
+
fontSize: 9,
|
|
359
|
+
textTransform: 'uppercase',
|
|
360
|
+
letterSpacing: 0.5,
|
|
361
|
+
},
|
|
275
362
|
miniGraphWrapper: {
|
|
276
363
|
flexDirection: 'row',
|
|
277
364
|
alignItems: 'flex-end',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const LIB_VERSION = "1.1.
|
|
1
|
+
export declare const LIB_VERSION = "1.1.14";
|
|
@@ -2,6 +2,14 @@ import { AnalyticsEvent } from '../types';
|
|
|
2
2
|
export declare const subscribeAnalyticsEvents: (callback: (events: AnalyticsEvent[]) => void) => () => void;
|
|
3
3
|
export declare const clearAnalyticsEvents: () => void;
|
|
4
4
|
export declare const getAnalyticsEvents: () => AnalyticsEvent[];
|
|
5
|
+
export declare const getCurrentUserProperties: () => {
|
|
6
|
+
[x: string]: any;
|
|
7
|
+
};
|
|
8
|
+
export declare const getCurrentUserId: () => string;
|
|
9
|
+
export declare const getDefaultEventParameters: () => {
|
|
10
|
+
[x: string]: any;
|
|
11
|
+
};
|
|
12
|
+
export declare const getCollectionEnabled: () => boolean;
|
|
5
13
|
/**
|
|
6
14
|
* Directly push an event into the inspector without going through Firebase.
|
|
7
15
|
* Useful for custom analytics wrappers or testing.
|
|
@@ -27,6 +27,8 @@ let counter = 0;
|
|
|
27
27
|
// Running snapshot of user properties set so far — attached to every event
|
|
28
28
|
let currentUserProperties = {};
|
|
29
29
|
let currentUserId;
|
|
30
|
+
let currentDefaultEventParameters = {};
|
|
31
|
+
let isCollectionEnabled = true;
|
|
30
32
|
// ─── Core helpers ─────────────────────────────────────────────────────────────
|
|
31
33
|
const notify = () => {
|
|
32
34
|
const snapshot = [...events];
|
|
@@ -50,6 +52,10 @@ export const clearAnalyticsEvents = () => {
|
|
|
50
52
|
notify();
|
|
51
53
|
};
|
|
52
54
|
export const getAnalyticsEvents = () => [...events];
|
|
55
|
+
export const getCurrentUserProperties = () => ({ ...currentUserProperties });
|
|
56
|
+
export const getCurrentUserId = () => currentUserId;
|
|
57
|
+
export const getDefaultEventParameters = () => ({ ...currentDefaultEventParameters });
|
|
58
|
+
export const getCollectionEnabled = () => isCollectionEnabled;
|
|
53
59
|
// ─── Manual logging (escape hatch, rarely needed) ────────────────────────────
|
|
54
60
|
/**
|
|
55
61
|
* Directly push an event into the inspector without going through Firebase.
|
|
@@ -147,8 +153,39 @@ export const setupAnalyticsLogger = (analyticsInstance) => {
|
|
|
147
153
|
const originalSetUserId = analyticsInstance.setUserId.bind(analyticsInstance);
|
|
148
154
|
analyticsInstance.setUserId = async (id) => {
|
|
149
155
|
currentUserId = id ?? undefined;
|
|
156
|
+
notify();
|
|
150
157
|
return originalSetUserId(id);
|
|
151
158
|
};
|
|
159
|
+
// ── setDefaultEventParameters ──────────────────────────────────────────────
|
|
160
|
+
if (typeof analyticsInstance.setDefaultEventParameters === 'function') {
|
|
161
|
+
const originalSetDefaultEventParameters = analyticsInstance.setDefaultEventParameters.bind(analyticsInstance);
|
|
162
|
+
analyticsInstance.setDefaultEventParameters = async (params) => {
|
|
163
|
+
currentDefaultEventParameters = params ?? {};
|
|
164
|
+
notify();
|
|
165
|
+
return originalSetDefaultEventParameters(params);
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
// ── setAnalyticsCollectionEnabled ───────────────────────────────────────────
|
|
169
|
+
if (typeof analyticsInstance.setAnalyticsCollectionEnabled === 'function') {
|
|
170
|
+
const originalSetAnalyticsCollectionEnabled = analyticsInstance.setAnalyticsCollectionEnabled.bind(analyticsInstance);
|
|
171
|
+
analyticsInstance.setAnalyticsCollectionEnabled = async (enabled) => {
|
|
172
|
+
isCollectionEnabled = enabled;
|
|
173
|
+
notify();
|
|
174
|
+
return originalSetAnalyticsCollectionEnabled(enabled);
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
// ── resetAnalyticsData ──────────────────────────────────────────────────────
|
|
178
|
+
if (typeof analyticsInstance.resetAnalyticsData === 'function') {
|
|
179
|
+
const originalResetAnalyticsData = analyticsInstance.resetAnalyticsData.bind(analyticsInstance);
|
|
180
|
+
analyticsInstance.resetAnalyticsData = async () => {
|
|
181
|
+
clearAnalyticsEvents();
|
|
182
|
+
currentUserProperties = {};
|
|
183
|
+
currentUserId = undefined;
|
|
184
|
+
currentDefaultEventParameters = {};
|
|
185
|
+
notify();
|
|
186
|
+
return originalResetAnalyticsData();
|
|
187
|
+
};
|
|
188
|
+
}
|
|
152
189
|
};
|
|
153
190
|
export const autoSetupAnalyticsLogger = () => {
|
|
154
191
|
if (globalThis.__INSPECTOR_ANALYTICS_AUTOSETUP__)
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ declare const NetworkInspectorWrapper: (props: any) => React.JSX.Element;
|
|
|
3
3
|
export default NetworkInspectorWrapper;
|
|
4
4
|
export { setupNetworkLogger, clearNetworkLogs, subscribeNetworkLogs, addAxiosInterceptors, } from './customHooks/networkLogger';
|
|
5
5
|
export { setupConsoleLogger, clearConsoleLogs, subscribeConsoleLogs, } from './customHooks/consoleLogger';
|
|
6
|
-
export { setupAnalyticsLogger, logAnalyticsEvent, subscribeAnalyticsEvents, clearAnalyticsEvents, } from './customHooks/analyticsLogger';
|
|
6
|
+
export { setupAnalyticsLogger, logAnalyticsEvent, subscribeAnalyticsEvents, clearAnalyticsEvents, getCurrentUserProperties, getCurrentUserId, getDefaultEventParameters, getCollectionEnabled, } from './customHooks/analyticsLogger';
|
|
7
7
|
export { WebView, getWebViewLogs, getWebViewNavHistory, getWebViewHtml, getWebViewCss, getWebViewJs, getWebViewHtmlUrl, clearWebViewData, subscribeWebView, } from './customHooks/webViewLogger';
|
|
8
8
|
export { default as ErrorBoundary } from './components/ErrorBoundary';
|
|
9
9
|
export { connectReduxStore, inspectorReduxMiddleware, getReduxState, subscribeReduxState, getActionHistory, clearActionHistory, } from './customHooks/reduxLogger';
|