react-native-inapp-inspector 1.1.12 → 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/AnalyticsDetail.js +64 -21
- package/dist/commonjs/components/AnalyticsEventCard.js +100 -13
- package/dist/commonjs/components/HighlightText.js +1 -1
- package/dist/commonjs/components/JsonViewer.d.ts +3 -1
- package/dist/commonjs/components/JsonViewer.js +327 -9
- package/dist/commonjs/components/MetaAccordion.d.ts +10 -1
- package/dist/commonjs/components/MetaAccordion.js +121 -24
- package/dist/commonjs/components/NetworkIcons.d.ts +1 -0
- package/dist/commonjs/components/NetworkIcons.js +8 -1
- package/dist/commonjs/components/ReduxTreeView.d.ts +12 -3
- package/dist/commonjs/components/ReduxTreeView.js +1096 -278
- package/dist/commonjs/components/SectionHeader.d.ts +1 -1
- package/dist/commonjs/components/SectionHeader.js +7 -1
- 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/customHooks/reduxLogger.d.ts +2 -0
- package/dist/commonjs/customHooks/reduxLogger.js +2 -0
- package/dist/commonjs/helpers/index.d.ts +1 -0
- package/dist/commonjs/helpers/index.js +15 -1
- package/dist/commonjs/helpers/settingsStore.d.ts +1 -0
- package/dist/commonjs/helpers/settingsStore.js +4 -0
- package/dist/commonjs/index.d.ts +1 -1
- package/dist/commonjs/index.js +347 -444
- package/dist/commonjs/styles/index.d.ts +92 -33
- package/dist/commonjs/styles/index.js +101 -45
- package/dist/commonjs/types/index.d.ts +3 -0
- package/dist/esm/components/AnalyticsDetail.js +64 -21
- package/dist/esm/components/AnalyticsEventCard.js +100 -13
- package/dist/esm/components/HighlightText.js +3 -3
- package/dist/esm/components/JsonViewer.d.ts +3 -1
- package/dist/esm/components/JsonViewer.js +295 -10
- package/dist/esm/components/MetaAccordion.d.ts +10 -1
- package/dist/esm/components/MetaAccordion.js +90 -26
- package/dist/esm/components/NetworkIcons.d.ts +1 -0
- package/dist/esm/components/NetworkIcons.js +6 -0
- package/dist/esm/components/ReduxTreeView.d.ts +12 -3
- package/dist/esm/components/ReduxTreeView.js +1095 -279
- package/dist/esm/components/SectionHeader.d.ts +1 -1
- package/dist/esm/components/SectionHeader.js +8 -2
- 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/customHooks/reduxLogger.d.ts +2 -0
- package/dist/esm/customHooks/reduxLogger.js +2 -0
- package/dist/esm/helpers/index.d.ts +1 -0
- package/dist/esm/helpers/index.js +14 -1
- package/dist/esm/helpers/settingsStore.d.ts +1 -0
- package/dist/esm/helpers/settingsStore.js +3 -0
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js +345 -446
- package/dist/esm/styles/index.d.ts +92 -33
- package/dist/esm/styles/index.js +101 -45
- package/dist/esm/types/index.d.ts +3 -0
- 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
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { SectionHeaderProps } from '../types';
|
|
3
|
-
declare const SectionHeader: ({ title, value, expanded, onToggleExpand, showDiff, isDiffing, onToggleDiff, }: SectionHeaderProps) => React.JSX.Element;
|
|
3
|
+
declare const SectionHeader: ({ title, value, expanded, onToggleExpand, showDiff, isDiffing, onToggleDiff, showSearch, isSearching, onToggleSearch, }: SectionHeaderProps) => React.JSX.Element;
|
|
4
4
|
export default SectionHeader;
|
|
@@ -6,10 +6,10 @@ import { AppColors } from '../styles/AppColors';
|
|
|
6
6
|
import CopyButton from './CopyButton';
|
|
7
7
|
import TouchableScale from './TouchableScale';
|
|
8
8
|
// Assets
|
|
9
|
-
import { RequestIcon, ResponseIcon, HeadersIcon, DiffIcon, ChevronIcon, } from './NetworkIcons';
|
|
9
|
+
import { RequestIcon, ResponseIcon, HeadersIcon, DiffIcon, ChevronIcon, SearchIcon, } from './NetworkIcons';
|
|
10
10
|
// Stylesheet
|
|
11
11
|
import styles from '../styles';
|
|
12
|
-
const SectionHeader = ({ title, value, expanded, onToggleExpand, showDiff, isDiffing, onToggleDiff, }) => {
|
|
12
|
+
const SectionHeader = ({ title, value, expanded, onToggleExpand, showDiff, isDiffing, onToggleDiff, showSearch, isSearching, onToggleSearch, }) => {
|
|
13
13
|
const isOpen = expanded === undefined ? false : !!expanded;
|
|
14
14
|
const chevronAnim = useRef(new Animated.Value(isOpen ? 1 : 0)).current;
|
|
15
15
|
useEffect(() => {
|
|
@@ -30,6 +30,12 @@ const SectionHeader = ({ title, value, expanded, onToggleExpand, showDiff, isDif
|
|
|
30
30
|
<Text style={styles.sectionTitle}>{title}</Text>
|
|
31
31
|
</Pressable>
|
|
32
32
|
<View style={styles.sectionHeaderActions}>
|
|
33
|
+
{showSearch && (<TouchableScale onPress={onToggleSearch} hitSlop={12} style={[
|
|
34
|
+
styles.iconSquareBtn,
|
|
35
|
+
isSearching ? styles.iconSquareBtnActive : null,
|
|
36
|
+
]}>
|
|
37
|
+
<SearchIcon color={isSearching ? AppColors.skyBlue : AppColors.grayTextWeak} size={14}/>
|
|
38
|
+
</TouchableScale>)}
|
|
33
39
|
{showDiff && (<TouchableScale onPress={onToggleDiff} hitSlop={12} style={[
|
|
34
40
|
styles.iconSquareBtn,
|
|
35
41
|
isDiffing ? styles.iconSquareBtnActive : null,
|
|
@@ -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__)
|
|
@@ -21,3 +21,4 @@ export declare const isAllValuesEmpty: (obj: Record<string, any>) => boolean;
|
|
|
21
21
|
export declare const formatDateTimeToAnalytics: (ts: number) => string;
|
|
22
22
|
export declare const getBundleIdentifier: () => string;
|
|
23
23
|
export declare const getAppName: () => string;
|
|
24
|
+
export declare const handleOpenExternalLink: (url: string) => void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Clipboard, Platform, ToastAndroid, Alert, NativeModules } from 'react-native';
|
|
1
|
+
import { Clipboard, Platform, ToastAndroid, Alert, NativeModules, Linking } from 'react-native';
|
|
2
2
|
// Stylesheet
|
|
3
3
|
import { AppColors } from '../styles/AppColors';
|
|
4
4
|
// Constants
|
|
@@ -302,3 +302,16 @@ export const getAppName = () => {
|
|
|
302
302
|
}
|
|
303
303
|
return 'App';
|
|
304
304
|
};
|
|
305
|
+
export const handleOpenExternalLink = (url) => {
|
|
306
|
+
if (!url)
|
|
307
|
+
return;
|
|
308
|
+
Alert.alert('Open Link', `Do you want to open this link in your web browser?\n\n${url}`, [
|
|
309
|
+
{ text: 'Cancel', style: 'cancel' },
|
|
310
|
+
{
|
|
311
|
+
text: 'Open',
|
|
312
|
+
onPress: () => {
|
|
313
|
+
Linking.openURL(url).catch(() => { });
|
|
314
|
+
},
|
|
315
|
+
},
|
|
316
|
+
]);
|
|
317
|
+
};
|
|
@@ -27,3 +27,4 @@ export declare function loadSettings(): Promise<PersistedSettings>;
|
|
|
27
27
|
export declare function saveSettings(settings: PersistedSettings): void;
|
|
28
28
|
export declare function clearPersistedSettings(): Promise<void>;
|
|
29
29
|
export declare const isPersistentStorageAvailable: () => boolean;
|
|
30
|
+
export declare function getCustomStorage(): InspectorStorage | null;
|
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';
|