react-native-inapp-inspector 2.2.2 → 2.2.3
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/constants/version.d.ts +1 -1
- package/dist/commonjs/constants/version.js +1 -1
- package/dist/esm/constants/version.d.ts +1 -1
- package/dist/esm/constants/version.js +1 -1
- package/package.json +2 -1
- package/src/analytics.ts +35 -0
- package/src/bundle.ts +25 -0
- package/src/components/AnalyticsDetail.tsx +865 -0
- package/src/components/AnalyticsEventCard.tsx +441 -0
- package/src/components/AnalyticsGraph.tsx +583 -0
- package/src/components/AnimatedEntrance.tsx +64 -0
- package/src/components/AppHeaderLogo.tsx +109 -0
- package/src/components/BrandCircleIcon.tsx +144 -0
- package/src/components/BrandSquareIcon.tsx +144 -0
- package/src/components/CodeSnippet.tsx +725 -0
- package/src/components/ConsoleLogCard.tsx +628 -0
- package/src/components/CopyButton.tsx +87 -0
- package/src/components/DiffViewer.tsx +82 -0
- package/src/components/DomainHeader.tsx +237 -0
- package/src/components/EmptyState.tsx +73 -0
- package/src/components/EndOfListFooter.tsx +100 -0
- package/src/components/ErrorBoundary.tsx +688 -0
- package/src/components/HeadersSection.tsx +192 -0
- package/src/components/HighlightText.tsx +100 -0
- package/src/components/Inspector/AnalyticsFilterModal.tsx +1250 -0
- package/src/components/Inspector/AnalyticsTab.tsx +1336 -0
- package/src/components/Inspector/BundleTab.tsx +4731 -0
- package/src/components/Inspector/ConsoleTab.tsx +702 -0
- package/src/components/Inspector/CrashDetail.tsx +941 -0
- package/src/components/Inspector/CrashFilterModal.tsx +721 -0
- package/src/components/Inspector/CrashTab.tsx +871 -0
- package/src/components/Inspector/FabLauncher.tsx +80 -0
- package/src/components/Inspector/InspectorContext.tsx +28 -0
- package/src/components/Inspector/InspectorHeader.tsx +973 -0
- package/src/components/Inspector/LogDetail.tsx +1427 -0
- package/src/components/Inspector/MainScreen.tsx +258 -0
- package/src/components/Inspector/NavigationTracker.tsx +13 -0
- package/src/components/Inspector/NetworkDetail.tsx +794 -0
- package/src/components/Inspector/NetworkTab.tsx +1095 -0
- package/src/components/Inspector/NpmUpdateToast.tsx +392 -0
- package/src/components/Inspector/PerformanceTab.tsx +1894 -0
- package/src/components/Inspector/ReduxDetail.tsx +1651 -0
- package/src/components/Inspector/ReduxTab.tsx +954 -0
- package/src/components/Inspector/SettingsPanel.tsx +3181 -0
- package/src/components/Inspector/TabBar.tsx +187 -0
- package/src/components/Inspector/TelemetryConsentModal.tsx +392 -0
- package/src/components/Inspector/UpdateAvailableModal.tsx +545 -0
- package/src/components/JsonViewer.tsx +486 -0
- package/src/components/LogCard.tsx +491 -0
- package/src/components/LogSyntaxHighlighter.tsx +178 -0
- package/src/components/MetaAccordion.tsx +340 -0
- package/src/components/MiniBarChart.tsx +42 -0
- package/src/components/MiniLineChart.tsx +33 -0
- package/src/components/NetworkIcons.tsx +2118 -0
- package/src/components/SectionHeader.tsx +113 -0
- package/src/components/SegmentedTabs.tsx +83 -0
- package/src/components/Slider.tsx +300 -0
- package/src/components/SourcePageCard.tsx +148 -0
- package/src/components/Toast.tsx +131 -0
- package/src/components/TouchableScale.tsx +91 -0
- package/src/components/TreeNode.tsx +186 -0
- package/src/console.ts +24 -0
- package/src/constants/index.ts +38 -0
- package/src/constants/version.ts +3 -0
- package/src/crash.ts +32 -0
- package/src/customHooks/analyticsLogger.ts +336 -0
- package/src/customHooks/bundleAnalyzer.ts +1231 -0
- package/src/customHooks/consoleLogger.ts +497 -0
- package/src/customHooks/crashHandler.ts +944 -0
- package/src/customHooks/logFilters.ts +32 -0
- package/src/customHooks/networkLogger.ts +419 -0
- package/src/customHooks/performanceTracker.ts +1014 -0
- package/src/customHooks/reduxLogger.ts +406 -0
- package/src/customHooks/useAccordion.tsx +60 -0
- package/src/decorators/index.ts +184 -0
- package/src/helpers/gaAnalyticsRegistry.ts +204 -0
- package/src/helpers/index.ts +860 -0
- package/src/helpers/memoryManager.ts +138 -0
- package/src/helpers/searchQueryParser.ts +283 -0
- package/src/helpers/settingsStore.ts +171 -0
- package/src/helpers/telemetry.ts +505 -0
- package/src/helpers/toast.ts +17 -0
- package/src/i18n/index.ts +69 -0
- package/src/i18n/locales/en.json +1052 -0
- package/src/index.tsx +2336 -0
- package/src/native/NativeInspector.ts +397 -0
- package/src/native/NativeNetworkInspector.ts +24 -0
- package/src/network.ts +22 -0
- package/src/performance.ts +38 -0
- package/src/redux.ts +23 -0
- package/src/styles/AppColors.ts +408 -0
- package/src/styles/AppFonts.ts +8 -0
- package/src/styles/common.ts +209 -0
- package/src/styles/index.ts +1570 -0
- package/src/types/enums.ts +194 -0
- package/src/types/index.ts +34 -0
- package/src/types/interfaces.ts +515 -0
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
// ─── Google Analytics (GA4) & Firebase Analytics Dynamic Registry ─────────────
|
|
2
|
+
//
|
|
3
|
+
// Dynamically inspects GA4 / Firebase Analytics runtime schemas, auto-detects
|
|
4
|
+
// standard GA4 event taxonomies, and supports dynamic GA plugins.
|
|
5
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
6
|
+
|
|
7
|
+
import {GAEventCategory} from '../types/enums';
|
|
8
|
+
|
|
9
|
+
export {GAEventCategory};
|
|
10
|
+
|
|
11
|
+
export interface GAPlugin {
|
|
12
|
+
name: string;
|
|
13
|
+
resolveCategory?: (
|
|
14
|
+
eventName: string,
|
|
15
|
+
params?: Record<string, any>,
|
|
16
|
+
) => GAEventCategory | string | null | undefined;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// ─── Official GA4 & Firebase Standard Event Sets ─────────────────────────────
|
|
20
|
+
|
|
21
|
+
const GA4_PAGE_VIEW_EVENTS = new Set([
|
|
22
|
+
'screen_view',
|
|
23
|
+
'page_view',
|
|
24
|
+
'screen_active',
|
|
25
|
+
'screen_inactive',
|
|
26
|
+
'view_search_results',
|
|
27
|
+
'search',
|
|
28
|
+
]);
|
|
29
|
+
|
|
30
|
+
const GA4_ECOMMERCE_EVENTS = new Set([
|
|
31
|
+
'purchase',
|
|
32
|
+
'refund',
|
|
33
|
+
'add_to_cart',
|
|
34
|
+
'remove_from_cart',
|
|
35
|
+
'view_cart',
|
|
36
|
+
'begin_checkout',
|
|
37
|
+
'add_shipping_info',
|
|
38
|
+
'add_payment_info',
|
|
39
|
+
'view_item',
|
|
40
|
+
'view_item_list',
|
|
41
|
+
'select_item',
|
|
42
|
+
'select_promotion',
|
|
43
|
+
'view_promotion',
|
|
44
|
+
'add_to_wishlist',
|
|
45
|
+
'generate_lead',
|
|
46
|
+
'in_app_purchase',
|
|
47
|
+
'earn_virtual_currency',
|
|
48
|
+
'spend_virtual_currency',
|
|
49
|
+
'join_group',
|
|
50
|
+
'level_up',
|
|
51
|
+
'level_start',
|
|
52
|
+
'level_end',
|
|
53
|
+
'post_score',
|
|
54
|
+
'select_content',
|
|
55
|
+
'tutorial_begin',
|
|
56
|
+
'tutorial_complete',
|
|
57
|
+
'unlock_achievement',
|
|
58
|
+
]);
|
|
59
|
+
|
|
60
|
+
const GA4_SYSTEM_EVENTS = new Set([
|
|
61
|
+
'first_open',
|
|
62
|
+
'first_visit',
|
|
63
|
+
'session_start',
|
|
64
|
+
'user_engagement',
|
|
65
|
+
'app_clear_data',
|
|
66
|
+
'app_exception',
|
|
67
|
+
'app_remove',
|
|
68
|
+
'app_store_refund',
|
|
69
|
+
'app_store_subscription_cancel',
|
|
70
|
+
'app_store_subscription_convert',
|
|
71
|
+
'app_store_subscription_renew',
|
|
72
|
+
'app_update',
|
|
73
|
+
'os_update',
|
|
74
|
+
'notification_receive',
|
|
75
|
+
'notification_open',
|
|
76
|
+
'notification_dismiss',
|
|
77
|
+
'notification_foreground',
|
|
78
|
+
'dynamic_link_first_open',
|
|
79
|
+
'dynamic_link_app_open',
|
|
80
|
+
'dynamic_link_app_update',
|
|
81
|
+
'ad_impression',
|
|
82
|
+
'ad_click',
|
|
83
|
+
'ad_reward',
|
|
84
|
+
'ad_query',
|
|
85
|
+
'ad_exposure',
|
|
86
|
+
]);
|
|
87
|
+
|
|
88
|
+
// ─── Registered Dynamic Plugins ──────────────────────────────────────────────
|
|
89
|
+
|
|
90
|
+
const registeredPlugins: GAPlugin[] = [];
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Register a dynamic Google Analytics / Firebase plugin or custom resolver.
|
|
94
|
+
*/
|
|
95
|
+
export const registerGAPlugin = (plugin: GAPlugin): void => {
|
|
96
|
+
if (!registeredPlugins.some(p => p.name === plugin.name)) {
|
|
97
|
+
registeredPlugins.push(plugin);
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Attempt dynamic inspection of host runtime Firebase / Google Analytics modules.
|
|
103
|
+
*/
|
|
104
|
+
const tryInspectRuntimeFirebaseAnalytics = (): void => {
|
|
105
|
+
try {
|
|
106
|
+
const firebaseAnalytics = require('@react-native-firebase/analytics');
|
|
107
|
+
const mod = firebaseAnalytics?.default || firebaseAnalytics;
|
|
108
|
+
if (mod?.EventNames) {
|
|
109
|
+
Object.keys(mod.EventNames).forEach(k => {
|
|
110
|
+
const val = mod.EventNames[k]?.toLowerCase();
|
|
111
|
+
if (val) {
|
|
112
|
+
if (
|
|
113
|
+
val.includes('cart') ||
|
|
114
|
+
val.includes('checkout') ||
|
|
115
|
+
val.includes('purchase') ||
|
|
116
|
+
val.includes('item')
|
|
117
|
+
) {
|
|
118
|
+
GA4_ECOMMERCE_EVENTS.add(val);
|
|
119
|
+
} else if (val.includes('screen') || val.includes('page')) {
|
|
120
|
+
GA4_PAGE_VIEW_EVENTS.add(val);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
} catch {
|
|
126
|
+
// Optional dependency - safe fallback to built-in GA4 taxonomy
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
// Initialize dynamic runtime inspection once
|
|
131
|
+
tryInspectRuntimeFirebaseAnalytics();
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Dynamically resolves the GA4 event category using:
|
|
135
|
+
* 1. Registered dynamic GA plugins
|
|
136
|
+
* 2. Runtime Firebase Analytics inspection
|
|
137
|
+
* 3. GA4 standard event taxonomies (O(1) Set lookup)
|
|
138
|
+
* 4. Semantic pattern & prefix analysis
|
|
139
|
+
*/
|
|
140
|
+
export const getEventCategory = (
|
|
141
|
+
name: string,
|
|
142
|
+
params?: Record<string, any>,
|
|
143
|
+
): GAEventCategory => {
|
|
144
|
+
if (!name || typeof name !== 'string') return 'custom';
|
|
145
|
+
const cleanName = name.trim().toLowerCase();
|
|
146
|
+
|
|
147
|
+
// 1. Run through registered dynamic plugins
|
|
148
|
+
for (const plugin of registeredPlugins) {
|
|
149
|
+
if (plugin.resolveCategory) {
|
|
150
|
+
const category = plugin.resolveCategory(cleanName, params);
|
|
151
|
+
if (category) return category as GAEventCategory;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
// 2. Exact GA4 taxonomy matching (O(1))
|
|
156
|
+
if (GA4_PAGE_VIEW_EVENTS.has(cleanName)) {
|
|
157
|
+
return 'page_view';
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
if (GA4_ECOMMERCE_EVENTS.has(cleanName)) {
|
|
161
|
+
return 'ecommerce';
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
if (GA4_SYSTEM_EVENTS.has(cleanName)) {
|
|
165
|
+
return 'system';
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
// 3. Prefix & namespace detection
|
|
169
|
+
if (
|
|
170
|
+
cleanName.startsWith('firebase_') ||
|
|
171
|
+
cleanName.startsWith('ga_') ||
|
|
172
|
+
cleanName.startsWith('gtag_') ||
|
|
173
|
+
cleanName.startsWith('_') ||
|
|
174
|
+
cleanName.startsWith('google_')
|
|
175
|
+
) {
|
|
176
|
+
return 'system';
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// 4. Semantic pattern matching
|
|
180
|
+
if (
|
|
181
|
+
cleanName.endsWith('_view') ||
|
|
182
|
+
cleanName.endsWith('_screen') ||
|
|
183
|
+
cleanName.startsWith('screen_') ||
|
|
184
|
+
cleanName.startsWith('page_') ||
|
|
185
|
+
cleanName.includes('screen_view') ||
|
|
186
|
+
cleanName.includes('page_view')
|
|
187
|
+
) {
|
|
188
|
+
return 'page_view';
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
if (
|
|
192
|
+
cleanName.includes('cart') ||
|
|
193
|
+
cleanName.includes('checkout') ||
|
|
194
|
+
cleanName.includes('purchase') ||
|
|
195
|
+
cleanName.includes('payment') ||
|
|
196
|
+
cleanName.includes('order') ||
|
|
197
|
+
cleanName.includes('refund') ||
|
|
198
|
+
cleanName.includes('shipping')
|
|
199
|
+
) {
|
|
200
|
+
return 'ecommerce';
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
return 'custom';
|
|
204
|
+
};
|