react-native-inapp-inspector 2.3.5 → 2.3.6
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/analytics.d.ts +0 -4
- package/dist/commonjs/analytics.js +0 -4
- package/dist/commonjs/bundle.d.ts +0 -4
- package/dist/commonjs/bundle.js +0 -4
- package/dist/commonjs/components/AnalyticsDetail.js +18 -27
- package/dist/commonjs/components/AnalyticsEventCard.js +9 -12
- package/dist/commonjs/components/AnalyticsGraph.js +10 -15
- package/dist/commonjs/components/AppHeaderLogo.js +0 -3
- package/dist/commonjs/components/BrandCircleIcon.js +15 -15
- package/dist/commonjs/components/BrandSquareIcon.js +20 -20
- package/dist/commonjs/components/CodeSnippet.js +6 -19
- package/dist/commonjs/components/ConsoleLogCard.js +0 -1
- package/dist/commonjs/components/CopyButton.js +0 -4
- package/dist/commonjs/components/DiffViewer.js +0 -2
- package/dist/commonjs/components/DomainHeader.js +0 -4
- package/dist/commonjs/components/EmptyState.js +0 -3
- package/dist/commonjs/components/ErrorBoundary.js +5 -10
- package/dist/commonjs/components/HeadersSection.js +0 -5
- package/dist/commonjs/components/HighlightText.js +1 -4
- package/dist/commonjs/components/Inspector/AnalyticsFilterModal.js +11 -26
- package/dist/commonjs/components/Inspector/AnalyticsTab.js +34 -40
- package/dist/commonjs/components/Inspector/BundleTab.js +56 -84
- package/dist/commonjs/components/Inspector/ConsoleTab.js +7 -7
- package/dist/commonjs/components/Inspector/CrashDetail.js +18 -20
- package/dist/commonjs/components/Inspector/CrashFilterModal.js +0 -1
- package/dist/commonjs/components/Inspector/CrashTab.js +11 -20
- package/dist/commonjs/components/Inspector/DeviceInfoTab.js +12 -24
- package/dist/commonjs/components/Inspector/FabLauncher.js +1 -1
- package/dist/commonjs/components/Inspector/InspectorContext.js +0 -2
- package/dist/commonjs/components/Inspector/InspectorHeader.js +7 -8
- package/dist/commonjs/components/Inspector/LogDetail.js +27 -29
- package/dist/commonjs/components/Inspector/MainScreen.js +9 -10
- package/dist/commonjs/components/Inspector/NetworkDetail.js +10 -11
- package/dist/commonjs/components/Inspector/NetworkTab.js +14 -14
- package/dist/commonjs/components/Inspector/NpmUpdateToast.js +6 -9
- package/dist/commonjs/components/Inspector/PerformanceTab.js +30 -43
- package/dist/commonjs/components/Inspector/ReduxDetail.js +18 -34
- package/dist/commonjs/components/Inspector/ReduxTab.js +11 -20
- package/dist/commonjs/components/Inspector/SettingsPanel.js +32 -36
- package/dist/commonjs/components/Inspector/SkeletonPlaceholder.js +6 -6
- package/dist/commonjs/components/Inspector/StorageTab.js +14 -26
- package/dist/commonjs/components/Inspector/UpdateAvailableModal.js +5 -6
- package/dist/commonjs/components/JsonViewer.js +3 -10
- package/dist/commonjs/components/LogCard.js +7 -7
- package/dist/commonjs/components/MetaAccordion.js +1 -7
- package/dist/commonjs/components/NetworkIcons.js +12 -16
- package/dist/commonjs/components/SectionHeader.js +0 -4
- package/dist/commonjs/components/SkeletonPlaceholder.js +6 -6
- package/dist/commonjs/components/Slider.js +6 -6
- package/dist/commonjs/components/SourcePageCard.js +0 -4
- package/dist/commonjs/components/TreeNode.js +0 -4
- package/dist/commonjs/console.d.ts +0 -4
- package/dist/commonjs/console.js +0 -4
- package/dist/commonjs/constants/index.js +6 -9
- package/dist/commonjs/constants/telemetryConfig.d.ts +7 -0
- package/dist/commonjs/constants/telemetryConfig.js +10 -0
- package/dist/commonjs/constants/version.d.ts +1 -1
- package/dist/commonjs/constants/version.js +1 -3
- package/dist/commonjs/crash.d.ts +0 -4
- package/dist/commonjs/crash.js +0 -4
- package/dist/commonjs/customHooks/analyticsLogger.d.ts +0 -7
- package/dist/commonjs/customHooks/analyticsLogger.js +3 -59
- package/dist/commonjs/customHooks/bundleAnalyzer.d.ts +0 -9
- package/dist/commonjs/customHooks/bundleAnalyzer.js +3 -86
- package/dist/commonjs/customHooks/consoleLogger.js +0 -16
- package/dist/commonjs/customHooks/crashHandler.d.ts +0 -28
- package/dist/commonjs/customHooks/crashHandler.js +0 -55
- package/dist/commonjs/customHooks/logFilters.d.ts +0 -4
- package/dist/commonjs/customHooks/logFilters.js +0 -11
- package/dist/commonjs/customHooks/networkLogger.js +2 -13
- package/dist/commonjs/customHooks/performanceTracker.d.ts +0 -27
- package/dist/commonjs/customHooks/performanceTracker.js +0 -31
- package/dist/commonjs/customHooks/reduxLogger.d.ts +0 -12
- package/dist/commonjs/customHooks/reduxLogger.js +0 -51
- package/dist/commonjs/customHooks/storageInspector.d.ts +0 -40
- package/dist/commonjs/customHooks/storageInspector.js +1 -56
- package/dist/commonjs/decorators/index.d.ts +0 -37
- package/dist/commonjs/decorators/index.js +0 -42
- package/dist/commonjs/helpers/gaAnalyticsRegistry.d.ts +0 -10
- package/dist/commonjs/helpers/gaAnalyticsRegistry.js +0 -26
- package/dist/commonjs/helpers/index.d.ts +0 -7
- package/dist/commonjs/helpers/index.js +1 -42
- package/dist/commonjs/helpers/memoryManager.d.ts +0 -11
- package/dist/commonjs/helpers/memoryManager.js +0 -13
- package/dist/commonjs/helpers/searchQueryParser.d.ts +0 -4
- package/dist/commonjs/helpers/searchQueryParser.js +0 -18
- package/dist/commonjs/helpers/settingsStore.js +0 -8
- package/dist/commonjs/helpers/telemetry.d.ts +2 -0
- package/dist/commonjs/helpers/telemetry.js +302 -0
- package/dist/commonjs/i18n/index.d.ts +0 -9
- package/dist/commonjs/i18n/index.js +0 -15
- package/dist/commonjs/index.js +15 -97
- package/dist/commonjs/native/NativeInspector.d.ts +0 -54
- package/dist/commonjs/native/NativeInspector.js +0 -56
- package/dist/commonjs/network.d.ts +0 -4
- package/dist/commonjs/network.js +0 -4
- package/dist/commonjs/performance.d.ts +0 -4
- package/dist/commonjs/performance.js +0 -4
- package/dist/commonjs/redux.d.ts +0 -4
- package/dist/commonjs/redux.js +0 -4
- package/dist/commonjs/storage.d.ts +0 -4
- package/dist/commonjs/storage.js +0 -4
- package/dist/commonjs/styles/AppColors.d.ts +0 -3
- package/dist/commonjs/styles/AppColors.js +15 -30
- package/dist/commonjs/styles/AppFonts.d.ts +0 -4
- package/dist/commonjs/styles/AppFonts.js +0 -4
- package/dist/commonjs/styles/common.js +0 -11
- package/dist/commonjs/styles/index.js +0 -8
- package/dist/commonjs/types/enums.js +0 -3
- package/dist/commonjs/types/interfaces.d.ts +3 -3
- package/dist/esm/analytics.d.ts +0 -4
- package/dist/esm/analytics.js +0 -4
- package/dist/esm/bundle.d.ts +0 -4
- package/dist/esm/bundle.js +0 -4
- package/dist/esm/components/AnalyticsDetail.js +18 -27
- package/dist/esm/components/AnalyticsEventCard.js +9 -12
- package/dist/esm/components/AnalyticsGraph.js +10 -15
- package/dist/esm/components/AppHeaderLogo.js +0 -3
- package/dist/esm/components/BrandCircleIcon.js +15 -15
- package/dist/esm/components/BrandSquareIcon.js +20 -20
- package/dist/esm/components/CodeSnippet.js +6 -19
- package/dist/esm/components/ConsoleLogCard.js +0 -1
- package/dist/esm/components/CopyButton.js +0 -4
- package/dist/esm/components/DiffViewer.js +0 -2
- package/dist/esm/components/DomainHeader.js +0 -4
- package/dist/esm/components/EmptyState.js +0 -3
- package/dist/esm/components/ErrorBoundary.js +5 -10
- package/dist/esm/components/HeadersSection.js +0 -5
- package/dist/esm/components/HighlightText.js +1 -4
- package/dist/esm/components/Inspector/AnalyticsFilterModal.js +11 -26
- package/dist/esm/components/Inspector/AnalyticsTab.js +34 -40
- package/dist/esm/components/Inspector/BundleTab.js +56 -84
- package/dist/esm/components/Inspector/ConsoleTab.js +7 -7
- package/dist/esm/components/Inspector/CrashDetail.js +18 -20
- package/dist/esm/components/Inspector/CrashFilterModal.js +0 -1
- package/dist/esm/components/Inspector/CrashTab.js +11 -20
- package/dist/esm/components/Inspector/DeviceInfoTab.js +12 -24
- package/dist/esm/components/Inspector/FabLauncher.js +1 -1
- package/dist/esm/components/Inspector/InspectorContext.js +0 -2
- package/dist/esm/components/Inspector/InspectorHeader.js +7 -8
- package/dist/esm/components/Inspector/LogDetail.js +27 -29
- package/dist/esm/components/Inspector/MainScreen.js +9 -10
- package/dist/esm/components/Inspector/NetworkDetail.js +10 -11
- package/dist/esm/components/Inspector/NetworkTab.js +14 -14
- package/dist/esm/components/Inspector/NpmUpdateToast.js +6 -9
- package/dist/esm/components/Inspector/PerformanceTab.js +30 -43
- package/dist/esm/components/Inspector/ReduxDetail.js +18 -34
- package/dist/esm/components/Inspector/ReduxTab.js +11 -20
- package/dist/esm/components/Inspector/SettingsPanel.js +32 -36
- package/dist/esm/components/Inspector/SkeletonPlaceholder.js +6 -6
- package/dist/esm/components/Inspector/StorageTab.js +14 -26
- package/dist/esm/components/Inspector/UpdateAvailableModal.js +5 -6
- package/dist/esm/components/JsonViewer.js +3 -10
- package/dist/esm/components/LogCard.js +7 -7
- package/dist/esm/components/MetaAccordion.js +1 -7
- package/dist/esm/components/NetworkIcons.js +12 -16
- package/dist/esm/components/SectionHeader.js +0 -4
- package/dist/esm/components/SkeletonPlaceholder.js +6 -6
- package/dist/esm/components/Slider.js +6 -6
- package/dist/esm/components/SourcePageCard.js +0 -4
- package/dist/esm/components/TreeNode.js +0 -4
- package/dist/esm/console.d.ts +0 -4
- package/dist/esm/console.js +0 -4
- package/dist/esm/constants/index.js +6 -9
- package/dist/esm/constants/telemetryConfig.d.ts +7 -0
- package/dist/esm/constants/telemetryConfig.js +7 -0
- package/dist/esm/constants/version.d.ts +1 -1
- package/dist/esm/constants/version.js +1 -3
- package/dist/esm/crash.d.ts +0 -4
- package/dist/esm/crash.js +0 -4
- package/dist/esm/customHooks/analyticsLogger.d.ts +0 -7
- package/dist/esm/customHooks/analyticsLogger.js +3 -59
- package/dist/esm/customHooks/bundleAnalyzer.d.ts +0 -9
- package/dist/esm/customHooks/bundleAnalyzer.js +3 -86
- package/dist/esm/customHooks/consoleLogger.js +0 -16
- package/dist/esm/customHooks/crashHandler.d.ts +0 -28
- package/dist/esm/customHooks/crashHandler.js +0 -55
- package/dist/esm/customHooks/logFilters.d.ts +0 -4
- package/dist/esm/customHooks/logFilters.js +0 -11
- package/dist/esm/customHooks/networkLogger.js +2 -13
- package/dist/esm/customHooks/performanceTracker.d.ts +0 -27
- package/dist/esm/customHooks/performanceTracker.js +0 -31
- package/dist/esm/customHooks/reduxLogger.d.ts +0 -12
- package/dist/esm/customHooks/reduxLogger.js +0 -51
- package/dist/esm/customHooks/storageInspector.d.ts +0 -40
- package/dist/esm/customHooks/storageInspector.js +1 -56
- package/dist/esm/decorators/index.d.ts +0 -37
- package/dist/esm/decorators/index.js +0 -42
- package/dist/esm/helpers/gaAnalyticsRegistry.d.ts +0 -10
- package/dist/esm/helpers/gaAnalyticsRegistry.js +0 -26
- package/dist/esm/helpers/index.d.ts +0 -7
- package/dist/esm/helpers/index.js +1 -42
- package/dist/esm/helpers/memoryManager.d.ts +0 -11
- package/dist/esm/helpers/memoryManager.js +0 -13
- package/dist/esm/helpers/searchQueryParser.d.ts +0 -4
- package/dist/esm/helpers/searchQueryParser.js +0 -18
- package/dist/esm/helpers/settingsStore.js +0 -8
- package/dist/esm/helpers/telemetry.d.ts +2 -0
- package/dist/esm/helpers/telemetry.js +298 -0
- package/dist/esm/i18n/index.d.ts +0 -9
- package/dist/esm/i18n/index.js +0 -15
- package/dist/esm/index.js +15 -97
- package/dist/esm/native/NativeInspector.d.ts +0 -54
- package/dist/esm/native/NativeInspector.js +0 -56
- package/dist/esm/network.d.ts +0 -4
- package/dist/esm/network.js +0 -4
- package/dist/esm/performance.d.ts +0 -4
- package/dist/esm/performance.js +0 -4
- package/dist/esm/redux.d.ts +0 -4
- package/dist/esm/redux.js +0 -4
- package/dist/esm/storage.d.ts +0 -4
- package/dist/esm/storage.js +0 -4
- package/dist/esm/styles/AppColors.d.ts +0 -3
- package/dist/esm/styles/AppColors.js +15 -30
- package/dist/esm/styles/AppFonts.d.ts +0 -4
- package/dist/esm/styles/AppFonts.js +0 -4
- package/dist/esm/styles/common.js +0 -11
- package/dist/esm/styles/index.js +0 -8
- package/dist/esm/types/enums.js +0 -3
- package/dist/esm/types/interfaces.d.ts +3 -3
- package/package.json +2 -2
- package/src/constants/telemetryConfig.ts +16 -0
- package/src/constants/version.ts +1 -1
- package/src/helpers/telemetry.ts +341 -0
- package/src/index.tsx +15 -1
- package/src/types/interfaces.ts +3 -0
|
@@ -1,17 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
// #8 — Redux inspector module.
|
|
3
|
-
//
|
|
4
|
-
// Two integration paths, both feeding the same timeline/state snapshot:
|
|
5
|
-
//
|
|
6
|
-
// 1. `inspectorReduxMiddleware` (recommended) — a standard Redux middleware.
|
|
7
|
-
// Because it sits inside the middleware chain it sees EVERY action,
|
|
8
|
-
// including ones dispatched from thunks, sagas, listeners and RTK Query.
|
|
9
|
-
//
|
|
10
|
-
// 2. `connectReduxStore(store)` — zero-config fallback. It wraps the outer
|
|
11
|
-
// `store.dispatch` AND diffs state on `store.subscribe`, so even actions
|
|
12
|
-
// that bypass the wrapped dispatch (thunk/saga internals capture the raw
|
|
13
|
-
// dispatch reference at store-creation time) still update the state tree
|
|
14
|
-
// and per-reducer "last action" consistently.
|
|
15
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
3
|
exports.connectReduxStore = exports.inspectorReduxMiddleware = exports.subscribeReduxState = exports.setReduxState = exports.clearActionHistory = exports.getActionHistory = exports.clearLastActionForReducer = exports.getLastActionForReducer = exports.getReduxAutoRefresh = exports.setReduxAutoRefresh = exports.getReduxState = exports.isReduxConnected = exports.pruneReduxHistory = exports.getMaxReduxHistoryLimit = exports.setMaxReduxHistoryLimit = exports.getReduxModuleEnabled = exports.setReduxModuleEnabled = void 0;
|
|
17
4
|
const helpers_1 = require("../helpers");
|
|
@@ -49,9 +36,6 @@ const pruneReduxHistory = (targetCount) => {
|
|
|
49
36
|
return Math.max(0, pruned);
|
|
50
37
|
};
|
|
51
38
|
exports.pruneReduxHistory = pruneReduxHistory;
|
|
52
|
-
// Guards against double-instrumentation (e.g. connectReduxStore called twice,
|
|
53
|
-
// or middleware + connect used together) which previously produced duplicate
|
|
54
|
-
// timeline entries and inconsistent counts.
|
|
55
39
|
const connectedStores = new WeakSet();
|
|
56
40
|
let middlewareAttached = false;
|
|
57
41
|
const isReduxConnected = () => middlewareAttached || currentReduxState != null || actionHistory.length > 0;
|
|
@@ -107,7 +91,6 @@ function actionTypeOf(action) {
|
|
|
107
91
|
function detectActionOrigin(stack, actionType, actionObj) {
|
|
108
92
|
const stackLower = (stack || '').toLowerCase();
|
|
109
93
|
const typeLower = (actionType || '').toLowerCase();
|
|
110
|
-
// Explicit hint on action if developer tagged it
|
|
111
94
|
if (actionObj && actionObj.__origin) {
|
|
112
95
|
const raw = String(actionObj.__origin).toLowerCase();
|
|
113
96
|
if (raw.includes('saga'))
|
|
@@ -117,7 +100,6 @@ function detectActionOrigin(stack, actionType, actionObj) {
|
|
|
117
100
|
if (raw.includes('ui'))
|
|
118
101
|
return { originType: 'ui' };
|
|
119
102
|
}
|
|
120
|
-
// 1. Saga Detection (Stack + Action naming conventions)
|
|
121
103
|
const isSaga = stackLower.includes('redux-saga') ||
|
|
122
104
|
stackLower.includes('runputeffect') ||
|
|
123
105
|
stackLower.includes('proc.js') ||
|
|
@@ -129,7 +111,6 @@ function detectActionOrigin(stack, actionType, actionObj) {
|
|
|
129
111
|
typeLower.includes('saga') ||
|
|
130
112
|
typeLower.startsWith('saga/') ||
|
|
131
113
|
typeLower.startsWith('@saga/');
|
|
132
|
-
// 2. Thunk / RTK Query Detection
|
|
133
114
|
const isThunk = stackLower.includes('createasyncthunk') ||
|
|
134
115
|
stackLower.includes('redux-thunk') ||
|
|
135
116
|
stackLower.includes('rtk-query') ||
|
|
@@ -139,12 +120,10 @@ function detectActionOrigin(stack, actionType, actionObj) {
|
|
|
139
120
|
typeLower.endsWith('/pending') ||
|
|
140
121
|
typeLower.endsWith('/fulfilled') ||
|
|
141
122
|
typeLower.endsWith('/rejected');
|
|
142
|
-
// 3. Parse Stack Frames to find best application caller
|
|
143
123
|
const lines = (stack || '').split('\n').map(l => l.trim()).filter(Boolean);
|
|
144
124
|
let bestFrame = null;
|
|
145
125
|
for (let i = 0; i < lines.length; i++) {
|
|
146
126
|
const line = lines[i];
|
|
147
|
-
// Ignore logger / middleware lines inside inspector
|
|
148
127
|
if (line.includes('reduxLogger') ||
|
|
149
128
|
line.includes('inspectorReduxMiddleware') ||
|
|
150
129
|
line.includes('recordAction') ||
|
|
@@ -195,7 +174,6 @@ function extractSliceName(actionType, affectedSlices) {
|
|
|
195
174
|
if (affectedSlices && affectedSlices.length > 0) {
|
|
196
175
|
return affectedSlices[0];
|
|
197
176
|
}
|
|
198
|
-
// If Redux Toolkit action format: e.g. "users/fetchById" -> "users"
|
|
199
177
|
const match = actionType.match(/^([a-zA-Z0-9_\-]+)\//);
|
|
200
178
|
if (match && match[1] && !match[1].startsWith('@@')) {
|
|
201
179
|
return match[1];
|
|
@@ -260,27 +238,11 @@ function recordAction(action, prevState, nextState, rawStack) {
|
|
|
260
238
|
if (globalReduxAutoRefresh) {
|
|
261
239
|
currentReduxState = nextState;
|
|
262
240
|
}
|
|
263
|
-
// Timeline / last-action map always changed — notify even when the state
|
|
264
|
-
// tree snapshot is paused so those panels stay live.
|
|
265
241
|
notify();
|
|
266
242
|
}
|
|
267
|
-
/**
|
|
268
|
-
* Standard Redux middleware — add it to your store to capture every action,
|
|
269
|
-
* including those dispatched from thunks, sagas and RTK Query:
|
|
270
|
-
*
|
|
271
|
-
* const store = configureStore({
|
|
272
|
-
* reducer,
|
|
273
|
-
* middleware: gDM => gDM().concat(inspectorReduxMiddleware),
|
|
274
|
-
* });
|
|
275
|
-
*
|
|
276
|
-
* Pair with `connectReduxStore(store)` (safe — they de-duplicate) or rely on
|
|
277
|
-
* the middleware alone; the initial snapshot is taken on the first action.
|
|
278
|
-
*/
|
|
279
243
|
const inspectorReduxMiddleware = (storeApi) => (next) => (action) => {
|
|
280
244
|
middlewareAttached = true;
|
|
281
245
|
const capturedStack = new Error().stack || '';
|
|
282
|
-
// Thunks are functions — let them run; their inner plain-action dispatches
|
|
283
|
-
// pass back through this same middleware, so nothing is lost.
|
|
284
246
|
if (typeof action === 'function') {
|
|
285
247
|
return next(action);
|
|
286
248
|
}
|
|
@@ -300,22 +262,15 @@ const connectReduxStore = (store) => {
|
|
|
300
262
|
console.warn('[NetworkInspector] Invalid Redux store passed to connectReduxStore.');
|
|
301
263
|
return;
|
|
302
264
|
}
|
|
303
|
-
// Idempotent — connecting the same store twice must not double-wrap
|
|
304
|
-
// dispatch or double-record the timeline.
|
|
305
265
|
if (connectedStores.has(store)) {
|
|
306
266
|
return;
|
|
307
267
|
}
|
|
308
268
|
connectedStores.add(store);
|
|
309
|
-
// Wrap the outer dispatch so directly dispatched actions get full
|
|
310
|
-
// type/payload attribution. Skipped when the middleware is already
|
|
311
|
-
// attached, otherwise every direct dispatch would be recorded twice.
|
|
312
269
|
const originalDispatch = store.dispatch.bind(store);
|
|
313
270
|
let inWrappedDispatch = false;
|
|
314
271
|
store.dispatch = (action) => {
|
|
315
272
|
const capturedStack = new Error().stack || '';
|
|
316
273
|
if (middlewareAttached || typeof action === 'function') {
|
|
317
|
-
// Middleware handles recording, or it's a thunk whose inner dispatches
|
|
318
|
-
// will be picked up individually.
|
|
319
274
|
inWrappedDispatch = true;
|
|
320
275
|
try {
|
|
321
276
|
return originalDispatch(action);
|
|
@@ -337,9 +292,6 @@ const connectReduxStore = (store) => {
|
|
|
337
292
|
return result;
|
|
338
293
|
};
|
|
339
294
|
(0, exports.setReduxState)(store.getState());
|
|
340
|
-
// Subscribe-diff fallback: catches state changes whose dispatch bypassed
|
|
341
|
-
// the wrapper above (thunk/saga internals hold the raw dispatch reference).
|
|
342
|
-
// Without this, the tree and per-reducer last-action drifted out of sync.
|
|
343
295
|
let lastSeenState = store.getState();
|
|
344
296
|
store.subscribe(() => {
|
|
345
297
|
const nextState = store.getState();
|
|
@@ -348,15 +300,12 @@ const connectReduxStore = (store) => {
|
|
|
348
300
|
const prevState = lastSeenState;
|
|
349
301
|
lastSeenState = nextState;
|
|
350
302
|
if (inWrappedDispatch || middlewareAttached) {
|
|
351
|
-
// Already recorded with proper attribution; just refresh the snapshot.
|
|
352
303
|
if (globalReduxAutoRefresh) {
|
|
353
304
|
currentReduxState = nextState;
|
|
354
305
|
notify();
|
|
355
306
|
}
|
|
356
307
|
return;
|
|
357
308
|
}
|
|
358
|
-
// Change arrived outside the wrapped dispatch — record it so the
|
|
359
|
-
// timeline stays consistent, even without the original action type.
|
|
360
309
|
const subStack = new Error().stack || '';
|
|
361
310
|
recordAction({ type: '@@inspector/EXTERNAL_STATE_CHANGE' }, prevState, nextState, subStack);
|
|
362
311
|
});
|
|
@@ -6,62 +6,22 @@ export interface StorageEntry {
|
|
|
6
6
|
byteSize: number;
|
|
7
7
|
}
|
|
8
8
|
export type StorageDriver = 'asyncStorage' | 'mmkv';
|
|
9
|
-
/**
|
|
10
|
-
* Register an AsyncStorage instance with the inspector (optional override).
|
|
11
|
-
*/
|
|
12
9
|
export declare const connectAsyncStorage: (storageInstance: any) => void;
|
|
13
|
-
/**
|
|
14
|
-
* Register an MMKV instance with the inspector (optional override).
|
|
15
|
-
*/
|
|
16
10
|
export declare const connectMMKV: (mmkvInstance: any, id?: string) => void;
|
|
17
|
-
/**
|
|
18
|
-
* Auto-detect AsyncStorage:
|
|
19
|
-
* 1. Explicit connection
|
|
20
|
-
* 2. Global instance
|
|
21
|
-
* 3. Dynamic require '@react-native-async-storage/async-storage'
|
|
22
|
-
* 4. Native Bridge Direct interface
|
|
23
|
-
*/
|
|
24
11
|
export declare const getResolvedAsyncStorage: () => any;
|
|
25
|
-
/**
|
|
26
|
-
* Auto-detect MMKV:
|
|
27
|
-
* 1. Explicit connection
|
|
28
|
-
* 2. Dynamic require 'react-native-mmkv' & instantiate default instance
|
|
29
|
-
* 3. Global MMKV / JSI instances
|
|
30
|
-
*/
|
|
31
12
|
export declare const getResolvedMMKV: (id?: string) => any;
|
|
32
13
|
export declare const isAsyncStorageConnected: () => boolean;
|
|
33
14
|
export declare const isMMKVConnected: () => boolean;
|
|
34
15
|
export declare const getRegisteredMMKVInstanceIds: () => string[];
|
|
35
|
-
/**
|
|
36
|
-
* Calculate approximate byte size of a UTF-8 string
|
|
37
|
-
*/
|
|
38
16
|
export declare const calculateByteSize: (str: string) => number;
|
|
39
|
-
/**
|
|
40
|
-
* Determine type and format value safely without blocking JS thread
|
|
41
|
-
*/
|
|
42
17
|
export declare const analyzeStorageValue: (rawVal: any) => {
|
|
43
18
|
strVal: string;
|
|
44
19
|
parsedValue?: any;
|
|
45
20
|
type: "json" | "string" | "number" | "boolean" | "null";
|
|
46
21
|
byteSize: number;
|
|
47
22
|
};
|
|
48
|
-
/**
|
|
49
|
-
* Fetch all storage entries for given driver
|
|
50
|
-
*/
|
|
51
23
|
export declare const fetchStorageEntries: (driver: StorageDriver, instanceId?: string) => Promise<StorageEntry[]>;
|
|
52
|
-
/**
|
|
53
|
-
* Create or Update a key-value entry (CRUD: Create / Update)
|
|
54
|
-
*/
|
|
55
24
|
export declare const setStorageEntry: (driver: StorageDriver, key: string, value: string, instanceId?: string) => Promise<boolean>;
|
|
56
|
-
/**
|
|
57
|
-
* Delete a single key (CRUD: Delete)
|
|
58
|
-
*/
|
|
59
25
|
export declare const removeStorageEntry: (driver: StorageDriver, key: string, instanceId?: string) => Promise<boolean>;
|
|
60
|
-
/**
|
|
61
|
-
* Wipe all keys for given storage (CRUD: Clear All)
|
|
62
|
-
*/
|
|
63
26
|
export declare const clearStorageDriver: (driver: StorageDriver, instanceId?: string) => Promise<boolean>;
|
|
64
|
-
/**
|
|
65
|
-
* Subscribe to storage mutations
|
|
66
|
-
*/
|
|
67
27
|
export declare const subscribeToStorageChanges: (listener: () => void) => (() => void);
|
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
// Universal In-App Storage Inspector Adapter for AsyncStorage & MMKV
|
|
3
|
-
// Supports automatic module resolution, NativeModules SQLite fallback, custom instances, and full CRUD operations.
|
|
4
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
3
|
exports.subscribeToStorageChanges = exports.clearStorageDriver = exports.removeStorageEntry = exports.setStorageEntry = exports.fetchStorageEntries = exports.analyzeStorageValue = exports.calculateByteSize = exports.getRegisteredMMKVInstanceIds = exports.isMMKVConnected = exports.isAsyncStorageConnected = exports.getResolvedMMKV = exports.getResolvedAsyncStorage = exports.connectMMKV = exports.connectAsyncStorage = void 0;
|
|
6
4
|
const react_native_1 = require("react-native");
|
|
7
|
-
// In-memory registered storage references
|
|
8
5
|
let customAsyncStorage = null;
|
|
9
6
|
const customMMKVInstances = new Map();
|
|
10
|
-
// Listeners for storage mutations
|
|
11
7
|
const changeListeners = new Set();
|
|
12
8
|
const notifyChange = () => {
|
|
13
9
|
changeListeners.forEach(listener => {
|
|
@@ -17,9 +13,6 @@ const notifyChange = () => {
|
|
|
17
13
|
catch { }
|
|
18
14
|
});
|
|
19
15
|
};
|
|
20
|
-
/**
|
|
21
|
-
* Register an AsyncStorage instance with the inspector (optional override).
|
|
22
|
-
*/
|
|
23
16
|
const connectAsyncStorage = (storageInstance) => {
|
|
24
17
|
if (storageInstance) {
|
|
25
18
|
customAsyncStorage = storageInstance;
|
|
@@ -27,9 +20,6 @@ const connectAsyncStorage = (storageInstance) => {
|
|
|
27
20
|
}
|
|
28
21
|
};
|
|
29
22
|
exports.connectAsyncStorage = connectAsyncStorage;
|
|
30
|
-
/**
|
|
31
|
-
* Register an MMKV instance with the inspector (optional override).
|
|
32
|
-
*/
|
|
33
23
|
const connectMMKV = (mmkvInstance, id = 'default') => {
|
|
34
24
|
if (mmkvInstance) {
|
|
35
25
|
customMMKVInstances.set(id, mmkvInstance);
|
|
@@ -37,10 +27,6 @@ const connectMMKV = (mmkvInstance, id = 'default') => {
|
|
|
37
27
|
}
|
|
38
28
|
};
|
|
39
29
|
exports.connectMMKV = connectMMKV;
|
|
40
|
-
/**
|
|
41
|
-
* Native Bridge Fallback for AsyncStorage:
|
|
42
|
-
* Directly interfaces with NativeModules.RNCAsyncStorage without needing JS package imports.
|
|
43
|
-
*/
|
|
44
30
|
const getNativeAsyncStorageBridge = () => {
|
|
45
31
|
const nativeModule = react_native_1.NativeModules.RNCAsyncStorage ||
|
|
46
32
|
react_native_1.NativeModules.RNC_AsyncSQLiteDBStorage ||
|
|
@@ -135,17 +121,9 @@ const getNativeAsyncStorageBridge = () => {
|
|
|
135
121
|
}
|
|
136
122
|
return null;
|
|
137
123
|
};
|
|
138
|
-
/**
|
|
139
|
-
* Auto-detect AsyncStorage:
|
|
140
|
-
* 1. Explicit connection
|
|
141
|
-
* 2. Global instance
|
|
142
|
-
* 3. Dynamic require '@react-native-async-storage/async-storage'
|
|
143
|
-
* 4. Native Bridge Direct interface
|
|
144
|
-
*/
|
|
145
124
|
const getResolvedAsyncStorage = () => {
|
|
146
125
|
if (customAsyncStorage)
|
|
147
126
|
return customAsyncStorage;
|
|
148
|
-
// 1. Global instances
|
|
149
127
|
try {
|
|
150
128
|
const maybeReq = globalThis?.__inAppAsyncStorage ||
|
|
151
129
|
globalThis?.AsyncStorage ||
|
|
@@ -155,7 +133,6 @@ const getResolvedAsyncStorage = () => {
|
|
|
155
133
|
}
|
|
156
134
|
}
|
|
157
135
|
catch { }
|
|
158
|
-
// 2. Dynamic runtime require
|
|
159
136
|
try {
|
|
160
137
|
const req = typeof globalThis?.require === 'function'
|
|
161
138
|
? globalThis.require
|
|
@@ -182,7 +159,6 @@ const getResolvedAsyncStorage = () => {
|
|
|
182
159
|
}
|
|
183
160
|
}
|
|
184
161
|
catch { }
|
|
185
|
-
// 3. Native Bridge Fallback (Direct SQLite)
|
|
186
162
|
const nativeBridge = getNativeAsyncStorageBridge();
|
|
187
163
|
if (nativeBridge) {
|
|
188
164
|
return nativeBridge;
|
|
@@ -190,17 +166,10 @@ const getResolvedAsyncStorage = () => {
|
|
|
190
166
|
return null;
|
|
191
167
|
};
|
|
192
168
|
exports.getResolvedAsyncStorage = getResolvedAsyncStorage;
|
|
193
|
-
/**
|
|
194
|
-
* Auto-detect MMKV:
|
|
195
|
-
* 1. Explicit connection
|
|
196
|
-
* 2. Dynamic require 'react-native-mmkv' & instantiate default instance
|
|
197
|
-
* 3. Global MMKV / JSI instances
|
|
198
|
-
*/
|
|
199
169
|
const getResolvedMMKV = (id = 'default') => {
|
|
200
170
|
if (customMMKVInstances.has(id)) {
|
|
201
171
|
return customMMKVInstances.get(id);
|
|
202
172
|
}
|
|
203
|
-
// 1. Dynamic require
|
|
204
173
|
try {
|
|
205
174
|
const req = typeof globalThis?.require === 'function'
|
|
206
175
|
? globalThis.require
|
|
@@ -222,7 +191,6 @@ const getResolvedMMKV = (id = 'default') => {
|
|
|
222
191
|
}
|
|
223
192
|
}
|
|
224
193
|
catch { }
|
|
225
|
-
// 2. Global references
|
|
226
194
|
try {
|
|
227
195
|
const globalMMKV = globalThis?.mmkv ||
|
|
228
196
|
global?.mmkv ||
|
|
@@ -252,22 +220,16 @@ const isMMKVConnected = () => {
|
|
|
252
220
|
};
|
|
253
221
|
exports.isMMKVConnected = isMMKVConnected;
|
|
254
222
|
const getRegisteredMMKVInstanceIds = () => {
|
|
255
|
-
(0, exports.getResolvedMMKV)();
|
|
223
|
+
(0, exports.getResolvedMMKV)();
|
|
256
224
|
return Array.from(customMMKVInstances.keys());
|
|
257
225
|
};
|
|
258
226
|
exports.getRegisteredMMKVInstanceIds = getRegisteredMMKVInstanceIds;
|
|
259
|
-
/**
|
|
260
|
-
* Calculate approximate byte size of a UTF-8 string
|
|
261
|
-
*/
|
|
262
227
|
const calculateByteSize = (str) => {
|
|
263
228
|
if (!str)
|
|
264
229
|
return 0;
|
|
265
230
|
return str.length * 2;
|
|
266
231
|
};
|
|
267
232
|
exports.calculateByteSize = calculateByteSize;
|
|
268
|
-
/**
|
|
269
|
-
* Determine type and format value safely without blocking JS thread
|
|
270
|
-
*/
|
|
271
233
|
const analyzeStorageValue = (rawVal) => {
|
|
272
234
|
if (rawVal === null || rawVal === undefined) {
|
|
273
235
|
return { strVal: 'null', type: 'null', byteSize: 4 };
|
|
@@ -283,7 +245,6 @@ const analyzeStorageValue = (rawVal) => {
|
|
|
283
245
|
const trimmed = strVal.trim();
|
|
284
246
|
if ((trimmed.startsWith('{') && trimmed.endsWith('}')) ||
|
|
285
247
|
(trimmed.startsWith('[') && trimmed.endsWith(']'))) {
|
|
286
|
-
// For small/medium JSON, parse eagerly; for huge payloads (>10KB), parse lazily on expand
|
|
287
248
|
if (trimmed.length < 10000) {
|
|
288
249
|
try {
|
|
289
250
|
const parsed = JSON.parse(trimmed);
|
|
@@ -302,9 +263,6 @@ const analyzeStorageValue = (rawVal) => {
|
|
|
302
263
|
return { strVal, type: 'string', byteSize };
|
|
303
264
|
};
|
|
304
265
|
exports.analyzeStorageValue = analyzeStorageValue;
|
|
305
|
-
/**
|
|
306
|
-
* Fetch all storage entries for given driver
|
|
307
|
-
*/
|
|
308
266
|
const fetchStorageEntries = async (driver, instanceId) => {
|
|
309
267
|
const entries = [];
|
|
310
268
|
if (driver === 'asyncStorage') {
|
|
@@ -387,14 +345,10 @@ const fetchStorageEntries = async (driver, instanceId) => {
|
|
|
387
345
|
console.warn('[StorageInspector] Error reading MMKV keys:', err);
|
|
388
346
|
}
|
|
389
347
|
}
|
|
390
|
-
// Sort alphabetically by key
|
|
391
348
|
entries.sort((a, b) => a.key.localeCompare(b.key));
|
|
392
349
|
return entries;
|
|
393
350
|
};
|
|
394
351
|
exports.fetchStorageEntries = fetchStorageEntries;
|
|
395
|
-
/**
|
|
396
|
-
* Create or Update a key-value entry (CRUD: Create / Update)
|
|
397
|
-
*/
|
|
398
352
|
const setStorageEntry = async (driver, key, value, instanceId) => {
|
|
399
353
|
if (!key.trim())
|
|
400
354
|
return false;
|
|
@@ -422,9 +376,6 @@ const setStorageEntry = async (driver, key, value, instanceId) => {
|
|
|
422
376
|
return false;
|
|
423
377
|
};
|
|
424
378
|
exports.setStorageEntry = setStorageEntry;
|
|
425
|
-
/**
|
|
426
|
-
* Delete a single key (CRUD: Delete)
|
|
427
|
-
*/
|
|
428
379
|
const removeStorageEntry = async (driver, key, instanceId) => {
|
|
429
380
|
try {
|
|
430
381
|
if (driver === 'asyncStorage') {
|
|
@@ -450,9 +401,6 @@ const removeStorageEntry = async (driver, key, instanceId) => {
|
|
|
450
401
|
return false;
|
|
451
402
|
};
|
|
452
403
|
exports.removeStorageEntry = removeStorageEntry;
|
|
453
|
-
/**
|
|
454
|
-
* Wipe all keys for given storage (CRUD: Clear All)
|
|
455
|
-
*/
|
|
456
404
|
const clearStorageDriver = async (driver, instanceId) => {
|
|
457
405
|
try {
|
|
458
406
|
if (driver === 'asyncStorage') {
|
|
@@ -478,9 +426,6 @@ const clearStorageDriver = async (driver, instanceId) => {
|
|
|
478
426
|
return false;
|
|
479
427
|
};
|
|
480
428
|
exports.clearStorageDriver = clearStorageDriver;
|
|
481
|
-
/**
|
|
482
|
-
* Subscribe to storage mutations
|
|
483
|
-
*/
|
|
484
429
|
const subscribeToStorageChanges = (listener) => {
|
|
485
430
|
changeListeners.add(listener);
|
|
486
431
|
return () => {
|
|
@@ -4,45 +4,8 @@ export interface InspectLogOptions {
|
|
|
4
4
|
logResult?: boolean;
|
|
5
5
|
logDuration?: boolean;
|
|
6
6
|
}
|
|
7
|
-
/**
|
|
8
|
-
* `@InspectLog`: Automatically logs method execution, arguments, duration, and return values
|
|
9
|
-
* to the In-App Inspector Console.
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```ts
|
|
13
|
-
* class UserService {
|
|
14
|
-
* @InspectLog({ tag: 'API', logArgs: true, logDuration: true })
|
|
15
|
-
* async fetchUser(id: string) {
|
|
16
|
-
* return api.get(`/users/${id}`);
|
|
17
|
-
* }
|
|
18
|
-
* }
|
|
19
|
-
* ```
|
|
20
|
-
*/
|
|
21
7
|
export declare function InspectLog(options?: InspectLogOptions): (_target: any, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
|
22
|
-
/**
|
|
23
|
-
* `@InspectTrackTime`: Measures and logs execution duration for critical functions.
|
|
24
|
-
*
|
|
25
|
-
* @example
|
|
26
|
-
* ```ts
|
|
27
|
-
* class FeedManager {
|
|
28
|
-
* @InspectTrackTime('Feed Data Processing')
|
|
29
|
-
* processFeedItems(items: FeedItem[]) { ... }
|
|
30
|
-
* }
|
|
31
|
-
* ```
|
|
32
|
-
*/
|
|
33
8
|
export declare function InspectTrackTime(label?: string): (_target: any, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
|
34
|
-
/**
|
|
35
|
-
* `@InspectCatch`: Safely catches unhandled exceptions thrown inside the method,
|
|
36
|
-
* logs them to the In-App Inspector, and returns a fallback value.
|
|
37
|
-
*
|
|
38
|
-
* @example
|
|
39
|
-
* ```ts
|
|
40
|
-
* class AuthService {
|
|
41
|
-
* @InspectCatch({ fallback: null, tag: 'AUTH' })
|
|
42
|
-
* async getCachedToken() { ... }
|
|
43
|
-
* }
|
|
44
|
-
* ```
|
|
45
|
-
*/
|
|
46
9
|
export declare function InspectCatch(options?: {
|
|
47
10
|
fallback?: any;
|
|
48
11
|
tag?: string;
|
|
@@ -1,27 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
// ─── Method & Class Decorators for React Native In-App Inspector ─────────────
|
|
3
|
-
//
|
|
4
|
-
// Clean TypeScript decorators to seamlessly annotate methods, asynchronous actions,
|
|
5
|
-
// and API services with automatic inspection, logging, timing, and error boundaries.
|
|
6
|
-
// ─────────────────────────────────────────────────────────────────────────────
|
|
7
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
3
|
exports.InspectLog = InspectLog;
|
|
9
4
|
exports.InspectTrackTime = InspectTrackTime;
|
|
10
5
|
exports.InspectCatch = InspectCatch;
|
|
11
|
-
/**
|
|
12
|
-
* `@InspectLog`: Automatically logs method execution, arguments, duration, and return values
|
|
13
|
-
* to the In-App Inspector Console.
|
|
14
|
-
*
|
|
15
|
-
* @example
|
|
16
|
-
* ```ts
|
|
17
|
-
* class UserService {
|
|
18
|
-
* @InspectLog({ tag: 'API', logArgs: true, logDuration: true })
|
|
19
|
-
* async fetchUser(id: string) {
|
|
20
|
-
* return api.get(`/users/${id}`);
|
|
21
|
-
* }
|
|
22
|
-
* }
|
|
23
|
-
* ```
|
|
24
|
-
*/
|
|
25
6
|
function InspectLog(options = {}) {
|
|
26
7
|
const { tag = 'Inspect', logArgs = true, logResult = true, logDuration = true, } = options;
|
|
27
8
|
return function (_target, propertyKey, descriptor) {
|
|
@@ -67,17 +48,6 @@ function InspectLog(options = {}) {
|
|
|
67
48
|
return descriptor;
|
|
68
49
|
};
|
|
69
50
|
}
|
|
70
|
-
/**
|
|
71
|
-
* `@InspectTrackTime`: Measures and logs execution duration for critical functions.
|
|
72
|
-
*
|
|
73
|
-
* @example
|
|
74
|
-
* ```ts
|
|
75
|
-
* class FeedManager {
|
|
76
|
-
* @InspectTrackTime('Feed Data Processing')
|
|
77
|
-
* processFeedItems(items: FeedItem[]) { ... }
|
|
78
|
-
* }
|
|
79
|
-
* ```
|
|
80
|
-
*/
|
|
81
51
|
function InspectTrackTime(label) {
|
|
82
52
|
return function (_target, propertyKey, descriptor) {
|
|
83
53
|
const originalMethod = descriptor.value;
|
|
@@ -105,18 +75,6 @@ function InspectTrackTime(label) {
|
|
|
105
75
|
return descriptor;
|
|
106
76
|
};
|
|
107
77
|
}
|
|
108
|
-
/**
|
|
109
|
-
* `@InspectCatch`: Safely catches unhandled exceptions thrown inside the method,
|
|
110
|
-
* logs them to the In-App Inspector, and returns a fallback value.
|
|
111
|
-
*
|
|
112
|
-
* @example
|
|
113
|
-
* ```ts
|
|
114
|
-
* class AuthService {
|
|
115
|
-
* @InspectCatch({ fallback: null, tag: 'AUTH' })
|
|
116
|
-
* async getCachedToken() { ... }
|
|
117
|
-
* }
|
|
118
|
-
* ```
|
|
119
|
-
*/
|
|
120
78
|
function InspectCatch(options = {}) {
|
|
121
79
|
const { fallback = undefined, tag = 'Catch' } = options;
|
|
122
80
|
return function (_target, propertyKey, descriptor) {
|
|
@@ -4,15 +4,5 @@ export interface GAPlugin {
|
|
|
4
4
|
name: string;
|
|
5
5
|
resolveCategory?: (eventName: string, params?: Record<string, any>) => GAEventCategory | string | null | undefined;
|
|
6
6
|
}
|
|
7
|
-
/**
|
|
8
|
-
* Register a dynamic Google Analytics / Firebase plugin or custom resolver.
|
|
9
|
-
*/
|
|
10
7
|
export declare const registerGAPlugin: (plugin: GAPlugin) => void;
|
|
11
|
-
/**
|
|
12
|
-
* Dynamically resolves the GA4 event category using:
|
|
13
|
-
* 1. Registered dynamic GA plugins
|
|
14
|
-
* 2. Runtime Firebase Analytics inspection
|
|
15
|
-
* 3. GA4 standard event taxonomies (O(1) Set lookup)
|
|
16
|
-
* 4. Semantic pattern & prefix analysis
|
|
17
|
-
*/
|
|
18
8
|
export declare const getEventCategory: (name: string, params?: Record<string, any>) => GAEventCategory;
|
|
@@ -1,14 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
// ─── Google Analytics (GA4) & Firebase Analytics Dynamic Registry ─────────────
|
|
3
|
-
//
|
|
4
|
-
// Dynamically inspects GA4 / Firebase Analytics runtime schemas, auto-detects
|
|
5
|
-
// standard GA4 event taxonomies, and supports dynamic GA plugins.
|
|
6
|
-
// ─────────────────────────────────────────────────────────────────────────────
|
|
7
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
3
|
exports.getEventCategory = exports.registerGAPlugin = exports.GAEventCategory = void 0;
|
|
9
4
|
const enums_1 = require("../types/enums");
|
|
10
5
|
Object.defineProperty(exports, "GAEventCategory", { enumerable: true, get: function () { return enums_1.GAEventCategory; } });
|
|
11
|
-
// ─── Official GA4 & Firebase Standard Event Sets ─────────────────────────────
|
|
12
6
|
const GA4_PAGE_VIEW_EVENTS = new Set([
|
|
13
7
|
'screen_view',
|
|
14
8
|
'page_view',
|
|
@@ -73,20 +67,13 @@ const GA4_SYSTEM_EVENTS = new Set([
|
|
|
73
67
|
'ad_query',
|
|
74
68
|
'ad_exposure',
|
|
75
69
|
]);
|
|
76
|
-
// ─── Registered Dynamic Plugins ──────────────────────────────────────────────
|
|
77
70
|
const registeredPlugins = [];
|
|
78
|
-
/**
|
|
79
|
-
* Register a dynamic Google Analytics / Firebase plugin or custom resolver.
|
|
80
|
-
*/
|
|
81
71
|
const registerGAPlugin = (plugin) => {
|
|
82
72
|
if (!registeredPlugins.some(p => p.name === plugin.name)) {
|
|
83
73
|
registeredPlugins.push(plugin);
|
|
84
74
|
}
|
|
85
75
|
};
|
|
86
76
|
exports.registerGAPlugin = registerGAPlugin;
|
|
87
|
-
/**
|
|
88
|
-
* Attempt dynamic inspection of host runtime Firebase / Google Analytics modules.
|
|
89
|
-
*/
|
|
90
77
|
const tryInspectRuntimeFirebaseAnalytics = () => {
|
|
91
78
|
try {
|
|
92
79
|
const firebaseAnalytics = require('@react-native-firebase/analytics');
|
|
@@ -109,23 +96,13 @@ const tryInspectRuntimeFirebaseAnalytics = () => {
|
|
|
109
96
|
}
|
|
110
97
|
}
|
|
111
98
|
catch {
|
|
112
|
-
// Optional dependency - safe fallback to built-in GA4 taxonomy
|
|
113
99
|
}
|
|
114
100
|
};
|
|
115
|
-
// Initialize dynamic runtime inspection once
|
|
116
101
|
tryInspectRuntimeFirebaseAnalytics();
|
|
117
|
-
/**
|
|
118
|
-
* Dynamically resolves the GA4 event category using:
|
|
119
|
-
* 1. Registered dynamic GA plugins
|
|
120
|
-
* 2. Runtime Firebase Analytics inspection
|
|
121
|
-
* 3. GA4 standard event taxonomies (O(1) Set lookup)
|
|
122
|
-
* 4. Semantic pattern & prefix analysis
|
|
123
|
-
*/
|
|
124
102
|
const getEventCategory = (name, params) => {
|
|
125
103
|
if (!name || typeof name !== 'string')
|
|
126
104
|
return 'custom';
|
|
127
105
|
const cleanName = name.trim().toLowerCase();
|
|
128
|
-
// 1. Run through registered dynamic plugins
|
|
129
106
|
for (const plugin of registeredPlugins) {
|
|
130
107
|
if (plugin.resolveCategory) {
|
|
131
108
|
const category = plugin.resolveCategory(cleanName, params);
|
|
@@ -133,7 +110,6 @@ const getEventCategory = (name, params) => {
|
|
|
133
110
|
return category;
|
|
134
111
|
}
|
|
135
112
|
}
|
|
136
|
-
// 2. Exact GA4 taxonomy matching (O(1))
|
|
137
113
|
if (GA4_PAGE_VIEW_EVENTS.has(cleanName)) {
|
|
138
114
|
return 'page_view';
|
|
139
115
|
}
|
|
@@ -143,7 +119,6 @@ const getEventCategory = (name, params) => {
|
|
|
143
119
|
if (GA4_SYSTEM_EVENTS.has(cleanName)) {
|
|
144
120
|
return 'system';
|
|
145
121
|
}
|
|
146
|
-
// 3. Prefix & namespace detection
|
|
147
122
|
if (cleanName.startsWith('firebase_') ||
|
|
148
123
|
cleanName.startsWith('ga_') ||
|
|
149
124
|
cleanName.startsWith('gtag_') ||
|
|
@@ -151,7 +126,6 @@ const getEventCategory = (name, params) => {
|
|
|
151
126
|
cleanName.startsWith('google_')) {
|
|
152
127
|
return 'system';
|
|
153
128
|
}
|
|
154
|
-
// 4. Semantic pattern matching
|
|
155
129
|
if (cleanName.endsWith('_view') ||
|
|
156
130
|
cleanName.endsWith('_screen') ||
|
|
157
131
|
cleanName.startsWith('screen_') ||
|
|
@@ -31,15 +31,10 @@ export declare const getAppVersionAndBuild: () => {
|
|
|
31
31
|
formatted: string;
|
|
32
32
|
};
|
|
33
33
|
export declare const handleOpenExternalLink: (url: string) => void;
|
|
34
|
-
/** Formats a timestamp as HH:MM:SS (no milliseconds). */
|
|
35
34
|
export declare const formatTimeShort: (ts: number) => string;
|
|
36
|
-
/** Formats a timestamp as HH:MM:SS.mmm (with milliseconds). */
|
|
37
35
|
export declare const formatTime: (ts: number) => string;
|
|
38
|
-
/** Formats a relative gap like "+2s" / "+1m 5s" / "+350ms". */
|
|
39
36
|
export declare const formatGap: (ms: number) => string;
|
|
40
|
-
/** Finds the first JSON object/array embedded anywhere in a log message. */
|
|
41
37
|
export declare const getJsonContent: (message: string) => JsonContent | null;
|
|
42
|
-
/** Pretty-prints JSON data showing 3-4 lines with trailing "..." */
|
|
43
38
|
export declare const getJsonPreviewText: (data: any, maxLines?: number) => {
|
|
44
39
|
text: string;
|
|
45
40
|
hasMore: boolean;
|
|
@@ -59,9 +54,7 @@ export interface ParsedStackFrame {
|
|
|
59
54
|
isOrigin?: boolean;
|
|
60
55
|
copyableLocation: string;
|
|
61
56
|
}
|
|
62
|
-
/** Parses a stack trace line to extract function name, file name, extension (.tsx/.jsx/.ts), line, and column numbers */
|
|
63
57
|
export declare const parseStackLine: (rawLine: string, isOrigin?: boolean) => ParsedStackFrame;
|
|
64
|
-
/** Opens a file and line number directly in VS Code / system editor */
|
|
65
58
|
export declare const openInVSCode: (filePath: string, lineNumber?: string | number, columnNumber?: string | number) => void;
|
|
66
59
|
export declare const ANALYTICS_EVENT_PALETTE: string[];
|
|
67
60
|
export declare const getEventColor: (name: string) => string;
|