@buoy-gg/events 7.0.40 → 7.0.42

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.
Files changed (126) hide show
  1. package/README.md +11 -60
  2. package/lib/commonjs/components/EventsCopySettingsView.js +1 -581
  3. package/lib/commonjs/components/EventsModal.js +1 -387
  4. package/lib/commonjs/components/ReactQueryEventDetail.js +1 -433
  5. package/lib/commonjs/components/UnifiedEventDetail.js +1 -556
  6. package/lib/commonjs/components/UnifiedEventFilters.js +1 -160
  7. package/lib/commonjs/components/UnifiedEventItem.js +1 -417
  8. package/lib/commonjs/components/UnifiedEventList.js +1 -187
  9. package/lib/commonjs/components/UnifiedEventViewer.js +1 -130
  10. package/lib/commonjs/hooks/useUnifiedEvents.js +1 -419
  11. package/lib/commonjs/index.js +1 -282
  12. package/lib/commonjs/preset.js +1 -60
  13. package/lib/commonjs/sources/sourceIds.js +1 -30
  14. package/lib/commonjs/stores/unifiedEventStore.js +1 -712
  15. package/lib/commonjs/sync/eventsSyncAdapter.js +1 -358
  16. package/lib/commonjs/types/copySettings.js +1 -249
  17. package/lib/commonjs/types/index.js +1 -17
  18. package/lib/commonjs/utils/autoDiscoverEventSources.js +1 -1065
  19. package/lib/commonjs/utils/badgeSelectionStorage.js +1 -126
  20. package/lib/commonjs/utils/copySettingsStorage.js +1 -43
  21. package/lib/commonjs/utils/correlationUtils.js +1 -130
  22. package/lib/commonjs/utils/eventExportFormatter.js +1 -1912
  23. package/lib/commonjs/utils/eventTransformers.js +1 -496
  24. package/lib/commonjs/utils/eventVisibility.js +1 -76
  25. package/lib/commonjs/utils/testIDs.js +1 -91
  26. package/lib/module/components/EventsCopySettingsView.js +1 -577
  27. package/lib/module/components/EventsModal.js +1 -383
  28. package/lib/module/components/ReactQueryEventDetail.js +1 -429
  29. package/lib/module/components/UnifiedEventDetail.js +1 -552
  30. package/lib/module/components/UnifiedEventFilters.js +1 -156
  31. package/lib/module/components/UnifiedEventItem.js +1 -413
  32. package/lib/module/components/UnifiedEventList.js +1 -183
  33. package/lib/module/components/UnifiedEventViewer.js +1 -126
  34. package/lib/module/hooks/useUnifiedEvents.js +1 -416
  35. package/lib/module/index.js +1 -102
  36. package/lib/module/preset.js +1 -57
  37. package/lib/module/sources/sourceIds.js +1 -26
  38. package/lib/module/stores/unifiedEventStore.js +1 -678
  39. package/lib/module/sync/eventsSyncAdapter.js +1 -354
  40. package/lib/module/types/copySettings.js +1 -244
  41. package/lib/module/types/index.js +1 -37
  42. package/lib/module/utils/autoDiscoverEventSources.js +1 -1057
  43. package/lib/module/utils/badgeSelectionStorage.js +1 -116
  44. package/lib/module/utils/copySettingsStorage.js +1 -37
  45. package/lib/module/utils/correlationUtils.js +1 -120
  46. package/lib/module/utils/eventExportFormatter.js +1 -1901
  47. package/lib/module/utils/eventTransformers.js +1 -487
  48. package/lib/module/utils/eventVisibility.js +1 -70
  49. package/lib/module/utils/testIDs.js +1 -83
  50. package/lib/typescript/components/EventsModal.d.ts +1 -7
  51. package/lib/typescript/components/UnifiedEventDetail.d.ts +2 -9
  52. package/lib/typescript/components/UnifiedEventItem.d.ts +0 -7
  53. package/lib/web/index.mjs +12 -0
  54. package/package.json +31 -11
  55. package/lib/commonjs/components/EventsCopySettingsView.js.map +0 -1
  56. package/lib/commonjs/components/EventsModal.js.map +0 -1
  57. package/lib/commonjs/components/ReactQueryEventDetail.js.map +0 -1
  58. package/lib/commonjs/components/UnifiedEventDetail.js.map +0 -1
  59. package/lib/commonjs/components/UnifiedEventFilters.js.map +0 -1
  60. package/lib/commonjs/components/UnifiedEventItem.js.map +0 -1
  61. package/lib/commonjs/components/UnifiedEventList.js.map +0 -1
  62. package/lib/commonjs/components/UnifiedEventViewer.js.map +0 -1
  63. package/lib/commonjs/hooks/useUnifiedEvents.js.map +0 -1
  64. package/lib/commonjs/index.js.map +0 -1
  65. package/lib/commonjs/preset.js.map +0 -1
  66. package/lib/commonjs/sources/sourceIds.js.map +0 -1
  67. package/lib/commonjs/stores/unifiedEventStore.js.map +0 -1
  68. package/lib/commonjs/sync/eventsSyncAdapter.js.map +0 -1
  69. package/lib/commonjs/types/copySettings.js.map +0 -1
  70. package/lib/commonjs/types/index.js.map +0 -1
  71. package/lib/commonjs/utils/autoDiscoverEventSources.js.map +0 -1
  72. package/lib/commonjs/utils/badgeSelectionStorage.js.map +0 -1
  73. package/lib/commonjs/utils/copySettingsStorage.js.map +0 -1
  74. package/lib/commonjs/utils/correlationUtils.js.map +0 -1
  75. package/lib/commonjs/utils/eventExportFormatter.js.map +0 -1
  76. package/lib/commonjs/utils/eventTransformers.js.map +0 -1
  77. package/lib/commonjs/utils/eventVisibility.js.map +0 -1
  78. package/lib/commonjs/utils/testIDs.js.map +0 -1
  79. package/lib/module/components/EventsCopySettingsView.js.map +0 -1
  80. package/lib/module/components/EventsModal.js.map +0 -1
  81. package/lib/module/components/ReactQueryEventDetail.js.map +0 -1
  82. package/lib/module/components/UnifiedEventDetail.js.map +0 -1
  83. package/lib/module/components/UnifiedEventFilters.js.map +0 -1
  84. package/lib/module/components/UnifiedEventItem.js.map +0 -1
  85. package/lib/module/components/UnifiedEventList.js.map +0 -1
  86. package/lib/module/components/UnifiedEventViewer.js.map +0 -1
  87. package/lib/module/hooks/useUnifiedEvents.js.map +0 -1
  88. package/lib/module/index.js.map +0 -1
  89. package/lib/module/preset.js.map +0 -1
  90. package/lib/module/sources/sourceIds.js.map +0 -1
  91. package/lib/module/stores/unifiedEventStore.js.map +0 -1
  92. package/lib/module/sync/eventsSyncAdapter.js.map +0 -1
  93. package/lib/module/types/copySettings.js.map +0 -1
  94. package/lib/module/types/index.js.map +0 -1
  95. package/lib/module/utils/autoDiscoverEventSources.js.map +0 -1
  96. package/lib/module/utils/badgeSelectionStorage.js.map +0 -1
  97. package/lib/module/utils/copySettingsStorage.js.map +0 -1
  98. package/lib/module/utils/correlationUtils.js.map +0 -1
  99. package/lib/module/utils/eventExportFormatter.js.map +0 -1
  100. package/lib/module/utils/eventTransformers.js.map +0 -1
  101. package/lib/module/utils/eventVisibility.js.map +0 -1
  102. package/lib/module/utils/testIDs.js.map +0 -1
  103. package/lib/typescript/components/EventsCopySettingsView.d.ts.map +0 -1
  104. package/lib/typescript/components/EventsModal.d.ts.map +0 -1
  105. package/lib/typescript/components/ReactQueryEventDetail.d.ts.map +0 -1
  106. package/lib/typescript/components/UnifiedEventDetail.d.ts.map +0 -1
  107. package/lib/typescript/components/UnifiedEventFilters.d.ts.map +0 -1
  108. package/lib/typescript/components/UnifiedEventItem.d.ts.map +0 -1
  109. package/lib/typescript/components/UnifiedEventList.d.ts.map +0 -1
  110. package/lib/typescript/components/UnifiedEventViewer.d.ts.map +0 -1
  111. package/lib/typescript/hooks/useUnifiedEvents.d.ts.map +0 -1
  112. package/lib/typescript/index.d.ts.map +0 -1
  113. package/lib/typescript/preset.d.ts.map +0 -1
  114. package/lib/typescript/sources/sourceIds.d.ts.map +0 -1
  115. package/lib/typescript/stores/unifiedEventStore.d.ts.map +0 -1
  116. package/lib/typescript/sync/eventsSyncAdapter.d.ts.map +0 -1
  117. package/lib/typescript/types/copySettings.d.ts.map +0 -1
  118. package/lib/typescript/types/index.d.ts.map +0 -1
  119. package/lib/typescript/utils/autoDiscoverEventSources.d.ts.map +0 -1
  120. package/lib/typescript/utils/badgeSelectionStorage.d.ts.map +0 -1
  121. package/lib/typescript/utils/copySettingsStorage.d.ts.map +0 -1
  122. package/lib/typescript/utils/correlationUtils.d.ts.map +0 -1
  123. package/lib/typescript/utils/eventExportFormatter.d.ts.map +0 -1
  124. package/lib/typescript/utils/eventTransformers.d.ts.map +0 -1
  125. package/lib/typescript/utils/eventVisibility.d.ts.map +0 -1
  126. package/lib/typescript/utils/testIDs.d.ts.map +0 -1
@@ -1,556 +1 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.UnifiedEventDetail = void 0;
7
- var _reactNative = require("react-native");
8
- var _react = require("react");
9
- var _sharedUi = require("@buoy-gg/shared-ui");
10
- var _dataViewer = require("@buoy-gg/shared-ui/dataViewer");
11
- var _ReactQueryEventDetail = require("./ReactQueryEventDetail");
12
- var _testIDs = require("../utils/testIDs");
13
- var _jsxRuntime = require("react/jsx-runtime");
14
- /**
15
- * UnifiedEventDetail
16
- *
17
- * Detail view for a single unified event.
18
- * Uses shared detail components from other packages when available,
19
- * falls back to generic DataViewer when packages aren't installed.
20
- */
21
-
22
- // ============================================================================
23
- // Optional Component Loading
24
- // ============================================================================
25
-
26
- function tryLoadOptionalDetailComponents() {
27
- const components = {
28
- StorageEventDetailContent: null,
29
- ReduxActionDetailContent: null,
30
- NetworkEventDetailView: null,
31
- RenderDetailView: null,
32
- ZustandStateDetailContent: null,
33
- JotaiAtomDetailContent: null,
34
- RouteEventDetail: null
35
- };
36
-
37
- // Try to load storage detail component
38
- try {
39
- // @ts-ignore - Dynamic import that may not exist
40
- const storage = require("@buoy-gg/storage");
41
- components.StorageEventDetailContent = storage.StorageEventDetailContent;
42
- } catch {
43
- // Optional dependency not installed
44
- }
45
-
46
- // Try to load redux detail component
47
- try {
48
- // @ts-ignore - Dynamic import that may not exist
49
- const redux = require("@buoy-gg/redux");
50
- components.ReduxActionDetailContent = redux.ReduxActionDetailContent;
51
- } catch {
52
- // Optional dependency not installed
53
- }
54
-
55
- // Try to load network detail component
56
- try {
57
- // @ts-ignore - Dynamic import that may not exist
58
- const network = require("@buoy-gg/network");
59
- components.NetworkEventDetailView = network.NetworkEventDetailView;
60
- } catch {
61
- // Optional dependency not installed
62
- }
63
-
64
- // Try to load render detail component
65
- try {
66
- // @ts-ignore - Dynamic import that may not exist
67
- const highlightUpdates = require("@buoy-gg/highlight-updates");
68
- components.RenderDetailView = highlightUpdates.RenderDetailView;
69
- } catch {
70
- // Optional dependency not installed
71
- }
72
-
73
- // Try to load zustand detail component
74
- try {
75
- // @ts-ignore - Dynamic import that may not exist
76
- const zustand = require("@buoy-gg/zustand");
77
- components.ZustandStateDetailContent = zustand.ZustandStateDetailContent;
78
- } catch {
79
- // Optional dependency not installed
80
- }
81
-
82
- // Try to load jotai detail component
83
- try {
84
- // @ts-ignore - Dynamic import that may not exist
85
- const jotai = require("@buoy-gg/jotai");
86
- components.JotaiAtomDetailContent = jotai.JotaiAtomDetailContent;
87
- } catch {
88
- // Optional dependency not installed
89
- }
90
-
91
- // Try to load route detail component
92
- try {
93
- // @ts-ignore - Dynamic import that may not exist
94
- const routeEvents = require("@buoy-gg/route-events");
95
- components.RouteEventDetail = routeEvents.RouteEventDetail;
96
- } catch {
97
- // Optional dependency not installed
98
- }
99
- return components;
100
- }
101
-
102
- // Cache loaded components
103
- const optionalComponents = tryLoadOptionalDetailComponents();
104
-
105
- // ============================================================================
106
- // Configuration
107
- // ============================================================================
108
-
109
- /**
110
- * Source configuration for display
111
- */
112
- const SOURCE_CONFIG = {
113
- "storage-async": {
114
- label: "AsyncStorage",
115
- color: "#8B5CF6"
116
- },
117
- "storage-mmkv": {
118
- label: "MMKV",
119
- color: "#F59E0B"
120
- },
121
- redux: {
122
- label: "Redux",
123
- color: "#3B82F6"
124
- },
125
- network: {
126
- label: "Network",
127
- color: "#10B981"
128
- },
129
- "react-query": {
130
- label: "React Query",
131
- color: "#EC4899"
132
- },
133
- "react-query-query": {
134
- label: "Query",
135
- color: "#EC4899"
136
- },
137
- "react-query-mutation": {
138
- label: "Mutation",
139
- color: "#F97316"
140
- },
141
- route: {
142
- label: "Route",
143
- color: "#06B6D4"
144
- },
145
- zustand: {
146
- label: "Zustand",
147
- color: "#764ABC"
148
- },
149
- jotai: {
150
- label: "Jotai",
151
- color: "#14B8A6"
152
- },
153
- render: {
154
- label: "Render",
155
- color: "#F472B6"
156
- }
157
- };
158
-
159
- /**
160
- * Check if an event is a storage event
161
- */
162
- function isStorageEvent(source) {
163
- return source === "storage-async" || source === "storage-mmkv";
164
- }
165
-
166
- /**
167
- * Get value type from a value
168
- */
169
- function getValueType(value) {
170
- const parsed = (0, _sharedUi.parseValue)(value);
171
- if (parsed === null) return "null";
172
- if (parsed === undefined) return "undefined";
173
- if (Array.isArray(parsed)) return "array";
174
- if (typeof parsed === "boolean") return "boolean";
175
- if (typeof parsed === "number") return "number";
176
- if (typeof parsed === "string") return "string";
177
- if (typeof parsed === "object") return "object";
178
- return "undefined";
179
- }
180
-
181
- // ============================================================================
182
- // Component
183
- // ============================================================================
184
-
185
- /** Passthrough used when no network detail wrapper is injected. */
186
- function PassThrough({
187
- children
188
- }) {
189
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
190
- children: children
191
- });
192
- }
193
- const UnifiedEventDetail = exports.UnifiedEventDetail = /*#__PURE__*/(0, _react.memo)(function UnifiedEventDetail({
194
- event,
195
- onBack,
196
- NetworkEventDetailViewComponent,
197
- networkDetailWrapper,
198
- RouteEventDetailComponent,
199
- detailComponents,
200
- onNavigate
201
- }) {
202
- /**
203
- * One resolution point for every per-tool detail page: the `require`-loaded
204
- * set, overridden by whatever the host injected.
205
- */
206
- const resolved = (0, _react.useMemo)(() => ({
207
- ...optionalComponents,
208
- ...detailComponents
209
- }), [detailComponents]);
210
- const sourceConfig = SOURCE_CONFIG[event.source];
211
- const timestamp = new Date(event.timestamp);
212
- // Shared ignored-domain/URL patterns — drives the "Ignore Domain / Ignore URL
213
- // Pattern" toggles at the bottom of the network detail page so they actually
214
- // work here and stay in sync with the Network tool.
215
- const {
216
- values: ignoredPatternValues,
217
- toggle: toggleIgnoredPattern
218
- } = (0, _sharedUi.useIgnoredPatterns)();
219
-
220
- // For storage events, create a conversation object to use with StorageEventDetailContent
221
- const storageConversation = (0, _react.useMemo)(() => {
222
- if (!isStorageEvent(event.source)) return null;
223
- if (!resolved.StorageEventDetailContent) return null;
224
- const raw = event.originalEvent;
225
-
226
- /**
227
- * `timestamp` is a real `Date` in-process but an ISO STRING once the event
228
- * has crossed a sync transport, and `StorageEventDetailContent` calls
229
- * `date.getHours()` on it. `new Date(...)` is idempotent for a Date, so
230
- * normalising unconditionally costs nothing and covers both. The same
231
- * reasoning is why `event.timestamp` above is wrapped.
232
- */
233
- const originalEvent = {
234
- ...raw,
235
- timestamp: new Date(raw.timestamp)
236
- };
237
-
238
- // Create a conversation with a single event for the detail view
239
- return {
240
- key: originalEvent.data?.key || "unknown",
241
- lastEvent: originalEvent,
242
- events: [originalEvent],
243
- totalOperations: 1,
244
- currentValue: originalEvent.data?.value,
245
- valueType: getValueType(originalEvent.data?.value),
246
- storageTypes: new Set([originalEvent.storageType || "async"])
247
- };
248
- }, [event, resolved]);
249
-
250
- // For storage events, use the shared StorageEventDetailContent if available
251
- if (storageConversation && resolved.StorageEventDetailContent) {
252
- const {
253
- StorageEventDetailContent
254
- } = resolved;
255
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
256
- style: styles.container,
257
- testID: `${_testIDs.EVENTS_TEST_ID}-detail-storage`,
258
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(StorageEventDetailContent, {
259
- conversation: storageConversation,
260
- selectedEventIndex: 0,
261
- onEventIndexChange: () => {},
262
- disableInternalFooter: true
263
- })
264
- });
265
- }
266
-
267
- // For Redux events, use the shared ReduxActionDetailContent if available
268
- if (event.source === "redux" && resolved.ReduxActionDetailContent) {
269
- const {
270
- ReduxActionDetailContent
271
- } = resolved;
272
- const reduxAction = event.originalEvent;
273
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
274
- style: styles.container,
275
- testID: `${_testIDs.EVENTS_TEST_ID}-detail-redux`,
276
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(ReduxActionDetailContent, {
277
- action: reduxAction,
278
- actions: [reduxAction],
279
- selectedIndex: 0,
280
- onIndexChange: () => {},
281
- disableInternalFooter: true
282
- })
283
- });
284
- }
285
-
286
- // For network events, render the SAME NetworkEventDetailView the Network tool
287
- // uses. Prefer an injected component (desktop), fall back to the dynamically
288
- // required one (mobile). Wire the shared ignored-patterns so the bottom
289
- // "Ignore Domain / Ignore URL Pattern" toggles work, and wrap in the optional
290
- // body-resolver provider so large bodies can be fetched on demand.
291
- const NetworkDetailView = NetworkEventDetailViewComponent ?? resolved.NetworkEventDetailView;
292
- if (event.source === "network" && NetworkDetailView) {
293
- const networkEvent = event.originalEvent;
294
- const NetworkWrapper = networkDetailWrapper ?? PassThrough;
295
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
296
- style: styles.container,
297
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(NetworkWrapper, {
298
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.ScrollView, {
299
- style: styles.content,
300
- testID: `${_testIDs.EVENTS_TEST_ID}-detail-network`,
301
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(NetworkDetailView, {
302
- event: networkEvent,
303
- ignoredPatterns: ignoredPatternValues,
304
- onTogglePattern: toggleIgnoredPattern
305
- })
306
- })
307
- })
308
- });
309
- }
310
-
311
- // For React Query events, use the specialized ReactQueryEventDetail
312
- if (event.source === "react-query" || event.source === "react-query-query" || event.source === "react-query-mutation") {
313
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
314
- style: styles.container,
315
- testID: `${_testIDs.EVENTS_TEST_ID}-detail-react-query`,
316
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ReactQueryEventDetail.ReactQueryEventDetail, {
317
- event: event
318
- })
319
- });
320
- }
321
-
322
- // For Zustand events, use the shared ZustandStateDetailContent if available
323
- if (event.source === "zustand" && resolved.ZustandStateDetailContent) {
324
- const {
325
- ZustandStateDetailContent
326
- } = resolved;
327
- const zustandChange = event.originalEvent;
328
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
329
- style: styles.container,
330
- testID: `${_testIDs.EVENTS_TEST_ID}-detail-zustand`,
331
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(ZustandStateDetailContent, {
332
- change: zustandChange,
333
- changes: [zustandChange],
334
- selectedIndex: 0,
335
- onIndexChange: () => {},
336
- disableInternalFooter: true
337
- })
338
- });
339
- }
340
-
341
- // For Jotai events, use the shared JotaiAtomDetailContent if available
342
- if (event.source === "jotai" && resolved.JotaiAtomDetailContent) {
343
- const {
344
- JotaiAtomDetailContent
345
- } = resolved;
346
- const jotaiChange = event.originalEvent;
347
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
348
- style: styles.container,
349
- testID: `${_testIDs.EVENTS_TEST_ID}-detail-jotai`,
350
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(JotaiAtomDetailContent, {
351
- change: jotaiChange,
352
- changes: [jotaiChange],
353
- selectedIndex: 0,
354
- onIndexChange: () => {},
355
- disableInternalFooter: true
356
- })
357
- });
358
- }
359
-
360
- // For render events, use the RenderDetailView if available
361
- if (event.source === "render" && resolved.RenderDetailView) {
362
- const {
363
- RenderDetailView
364
- } = resolved;
365
- const renderData = event.originalEvent;
366
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
367
- style: styles.container,
368
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.ScrollView, {
369
- style: styles.content,
370
- testID: `${_testIDs.EVENTS_TEST_ID}-detail-render`,
371
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(RenderDetailView, {
372
- render: renderData.render
373
- })
374
- })
375
- });
376
- }
377
-
378
- // For route events, render the SAME RouteEventDetail the Routes tool uses.
379
- // Prefer an injected component (desktop), fall back to the dynamically required
380
- // one (mobile). onNavigate powers the "Go to route" action.
381
- const RouteDetail = RouteEventDetailComponent ?? resolved.RouteEventDetail;
382
- if (event.source === "route" && RouteDetail) {
383
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
384
- style: styles.container,
385
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
386
- style: styles.container,
387
- testID: `${_testIDs.EVENTS_TEST_ID}-detail-route`,
388
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(RouteDetail, {
389
- event: event.originalEvent,
390
- onNavigate: onNavigate
391
- })
392
- })
393
- });
394
- }
395
-
396
- // For all other events (or when specific components aren't available), show the generic detail view
397
- const getEventData = () => {
398
- return event.originalEvent;
399
- };
400
- const handleCopy = async () => {
401
- await (0, _sharedUi.copyToClipboard)({
402
- source: event.source,
403
- timestamp: timestamp.toISOString(),
404
- title: event.title,
405
- subtitle: event.subtitle,
406
- data: getEventData()
407
- });
408
- };
409
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
410
- style: styles.container,
411
- testID: `${_testIDs.EVENTS_TEST_ID}-detail`,
412
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.ScrollView, {
413
- style: styles.content,
414
- contentContainerStyle: styles.contentContainer,
415
- testID: `${_testIDs.EVENTS_TEST_ID}-detail-scroll`,
416
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
417
- style: styles.sourceBadgeRow,
418
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
419
- style: [styles.sourceBadge, {
420
- backgroundColor: sourceConfig.color + "20"
421
- }],
422
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
423
- style: [styles.sourceDot, {
424
- backgroundColor: sourceConfig.color
425
- }]
426
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
427
- style: [styles.sourceLabel, {
428
- color: sourceConfig.color
429
- }],
430
- testID: `${_testIDs.EVENTS_TEST_ID}-detail-source`,
431
- children: sourceConfig.label
432
- })]
433
- })
434
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
435
- style: styles.title,
436
- testID: `${_testIDs.EVENTS_TEST_ID}-detail-title`,
437
- children: event.title
438
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
439
- style: styles.subtitle,
440
- testID: `${_testIDs.EVENTS_TEST_ID}-detail-subtitle`,
441
- children: event.subtitle
442
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
443
- style: styles.timestampRow,
444
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
445
- style: styles.timestampLabel,
446
- children: "Timestamp"
447
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Text, {
448
- style: styles.timestampValue,
449
- testID: `${_testIDs.EVENTS_TEST_ID}-detail-timestamp`,
450
- children: [timestamp.toLocaleTimeString(), " (", (0, _sharedUi.formatRelativeTime)(timestamp), ")"]
451
- })]
452
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
453
- style: styles.dataSection,
454
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
455
- style: styles.sectionLabel,
456
- children: "Event Data"
457
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
458
- style: styles.dataContainer,
459
- testID: `${_testIDs.EVENTS_TEST_ID}-detail-data`,
460
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_dataViewer.DataViewer, {
461
- testIDPrefix: `${_testIDs.EVENTS_TEST_ID}-detail-data`,
462
- data: getEventData(),
463
- title: "",
464
- showTypeFilter: true,
465
- rawMode: true,
466
- initialExpanded: true
467
- })
468
- })]
469
- })]
470
- })
471
- });
472
- });
473
- const styles = _reactNative.StyleSheet.create({
474
- container: {
475
- flex: 1,
476
- // Transparent so the night sheet's star field shows through.
477
- backgroundColor: "transparent"
478
- },
479
- content: {
480
- flex: 1
481
- },
482
- contentContainer: {
483
- padding: 16
484
- },
485
- sourceBadgeRow: {
486
- flexDirection: "row",
487
- marginBottom: 12
488
- },
489
- sourceBadge: {
490
- flexDirection: "row",
491
- alignItems: "center",
492
- paddingHorizontal: 10,
493
- paddingVertical: 6,
494
- borderRadius: 12,
495
- gap: 6
496
- },
497
- sourceDot: {
498
- width: 6,
499
- height: 6,
500
- borderRadius: 3
501
- },
502
- sourceLabel: {
503
- fontSize: 12,
504
- fontWeight: "600"
505
- },
506
- title: {
507
- fontSize: 24,
508
- fontWeight: "700",
509
- color: _sharedUi.night.color.text,
510
- marginBottom: 4
511
- },
512
- subtitle: {
513
- fontSize: 16,
514
- color: _sharedUi.night.color.textTertiary,
515
- marginBottom: 16
516
- },
517
- timestampRow: {
518
- flexDirection: "row",
519
- justifyContent: "space-between",
520
- alignItems: "center",
521
- paddingVertical: 12,
522
- borderTopWidth: 1,
523
- borderTopColor: _sharedUi.night.color.border,
524
- borderBottomWidth: 1,
525
- borderBottomColor: _sharedUi.night.color.border,
526
- marginBottom: 16
527
- },
528
- timestampLabel: {
529
- fontSize: 14,
530
- color: _sharedUi.night.color.textTertiary
531
- },
532
- timestampValue: {
533
- fontSize: 14,
534
- color: _sharedUi.night.color.text,
535
- fontFamily: _sharedUi.monoFont
536
- },
537
- dataSection: {
538
- marginTop: 8
539
- },
540
- sectionLabel: {
541
- fontSize: 12,
542
- fontWeight: "600",
543
- color: _sharedUi.night.color.textTertiary,
544
- textTransform: "uppercase",
545
- letterSpacing: 0.5,
546
- marginBottom: 8
547
- },
548
- dataContainer: {
549
- backgroundColor: _sharedUi.night.color.surface,
550
- borderRadius: 8,
551
- borderWidth: 1,
552
- borderColor: _sharedUi.night.color.border,
553
- overflow: "hidden"
554
- }
555
- });
556
- //# sourceMappingURL=UnifiedEventDetail.js.map
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.UnifiedEventDetail=void 0;var _utils=require("@buoy-gg/shared-ui/utils");var _reactNative=require("react-native");var _react=require("react");var _sharedUi=require("@buoy-gg/shared-ui");var _dataViewer=require("@buoy-gg/shared-ui/dataViewer");var _ReactQueryEventDetail=require("./ReactQueryEventDetail");var _testIDs=require("../utils/testIDs");var _jsxRuntime=require("react/jsx-runtime");function tryLoadOptionalDetailComponents(){const o={StorageEventDetailContent:null,ReduxActionDetailContent:null,NetworkEventDetailView:null,RenderDetailView:null,ZustandStateDetailContent:null,JotaiAtomDetailContent:null,RouteEventDetail:null};try{const e=(0,_utils.loadToolModule)("@buoy-gg/storage");o.StorageEventDetailContent=e.StorageEventDetailContent}catch{}try{const e=(0,_utils.loadToolModule)("@buoy-gg/redux");o.ReduxActionDetailContent=e.ReduxActionDetailContent}catch{}try{const e=(0,_utils.loadToolModule)("@buoy-gg/network");o.NetworkEventDetailView=e.NetworkEventDetailView}catch{}try{const e=(0,_utils.loadToolModule)("@buoy-gg/highlight-updates");o.RenderDetailView=e.RenderDetailView}catch{}try{const e=(0,_utils.loadToolModule)("@buoy-gg/zustand");o.ZustandStateDetailContent=e.ZustandStateDetailContent}catch{}try{const e=(0,_utils.loadToolModule)("@buoy-gg/jotai");o.JotaiAtomDetailContent=e.JotaiAtomDetailContent}catch{}try{const e=(0,_utils.loadToolModule)("@buoy-gg/route-events");o.RouteEventDetail=e.RouteEventDetail}catch{}return o}let optionalComponents;let componentVersion=-1;function getOptionalComponents(){if(!optionalComponents||componentVersion!==(0,_utils.getToolModuleVersion)()){optionalComponents=tryLoadOptionalDetailComponents();componentVersion=(0,_utils.getToolModuleVersion)()}return optionalComponents}const SOURCE_CONFIG={"storage-async":{label:"AsyncStorage",color:"#8B5CF6"},"storage-mmkv":{label:"MMKV",color:"#F59E0B"},redux:{label:"Redux",color:"#3B82F6"},network:{label:"Network",color:"#10B981"},"react-query":{label:"React Query",color:"#EC4899"},"react-query-query":{label:"Query",color:"#EC4899"},"react-query-mutation":{label:"Mutation",color:"#F97316"},route:{label:"Route",color:"#06B6D4"},zustand:{label:"Zustand",color:"#764ABC"},jotai:{label:"Jotai",color:"#14B8A6"},render:{label:"Render",color:"#F472B6"}};function isStorageEvent(o){return o==="storage-async"||o==="storage-mmkv"}function getValueType(o){const e=(0,_sharedUi.parseValue)(o);if(e===null)return"null";if(e===void 0)return"undefined";if(Array.isArray(e))return"array";if(typeof e==="boolean")return"boolean";if(typeof e==="number")return"number";if(typeof e==="string")return"string";if(typeof e==="object")return"object";return"undefined"}function PassThrough({children:o}){return(0,_jsxRuntime.jsx)(_jsxRuntime.Fragment,{children:o})}const UnifiedEventDetail=exports.UnifiedEventDetail=(0,_react.memo)(function o({event:e,onBack:h,NetworkEventDetailViewComponent:g,networkDetailWrapper:E,RouteEventDetailComponent:D,detailComponents:l,onNavigate:y}){const n=(0,_react.useMemo)(()=>({...getOptionalComponents(),...l}),[l,(0,_utils.getToolModuleVersion)()]);const a=SOURCE_CONFIG[e.source];const i=new Date(e.timestamp);const{values:T,toggle:x}=(0,_sharedUi.useIgnoredPatterns)();const s=(0,_react.useMemo)(()=>{if(!isStorageEvent(e.source))return null;if(!n.StorageEventDetailContent)return null;const r=e.originalEvent;const t={...r,timestamp:new Date(r.timestamp)};return{key:t.data?.key||"unknown",lastEvent:t,events:[t],totalOperations:1,currentValue:t.data?.value,valueType:getValueType(t.data?.value),storageTypes:new Set([t.storageType||"async"])}},[e,n]);if(s&&n.StorageEventDetailContent){const{StorageEventDetailContent:r}=n;return(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.container,testID:`${_testIDs.EVENTS_TEST_ID}-detail-storage`,children:(0,_jsxRuntime.jsx)(r,{conversation:s,selectedEventIndex:0,onEventIndexChange:()=>{},disableInternalFooter:true})})}if(e.source==="redux"&&n.ReduxActionDetailContent){const{ReduxActionDetailContent:r}=n;const t=e.originalEvent;return(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.container,testID:`${_testIDs.EVENTS_TEST_ID}-detail-redux`,children:(0,_jsxRuntime.jsx)(r,{action:t,actions:[t],selectedIndex:0,onIndexChange:()=>{},disableInternalFooter:true})})}const c=g??n.NetworkEventDetailView;if(e.source==="network"&&c){const r=e.originalEvent;const t=E??PassThrough;return(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.container,children:(0,_jsxRuntime.jsx)(t,{children:(0,_jsxRuntime.jsx)(_reactNative.ScrollView,{style:styles.content,testID:`${_testIDs.EVENTS_TEST_ID}-detail-network`,children:(0,_jsxRuntime.jsx)(c,{event:r,ignoredPatterns:T,onTogglePattern:x})})})})}if(e.source==="react-query"||e.source==="react-query-query"||e.source==="react-query-mutation"){return(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.container,testID:`${_testIDs.EVENTS_TEST_ID}-detail-react-query`,children:(0,_jsxRuntime.jsx)(_ReactQueryEventDetail.ReactQueryEventDetail,{event:e})})}if(e.source==="zustand"&&n.ZustandStateDetailContent){const{ZustandStateDetailContent:r}=n;const t=e.originalEvent;return(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.container,testID:`${_testIDs.EVENTS_TEST_ID}-detail-zustand`,children:(0,_jsxRuntime.jsx)(r,{change:t,changes:[t],selectedIndex:0,onIndexChange:()=>{},disableInternalFooter:true})})}if(e.source==="jotai"&&n.JotaiAtomDetailContent){const{JotaiAtomDetailContent:r}=n;const t=e.originalEvent;return(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.container,testID:`${_testIDs.EVENTS_TEST_ID}-detail-jotai`,children:(0,_jsxRuntime.jsx)(r,{change:t,changes:[t],selectedIndex:0,onIndexChange:()=>{},disableInternalFooter:true})})}if(e.source==="render"&&n.RenderDetailView){const{RenderDetailView:r}=n;const t=e.originalEvent;return(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.container,children:(0,_jsxRuntime.jsx)(_reactNative.ScrollView,{style:styles.content,testID:`${_testIDs.EVENTS_TEST_ID}-detail-render`,children:(0,_jsxRuntime.jsx)(r,{render:t.render})})})}const u=D??n.RouteEventDetail;if(e.source==="route"&&u){return(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.container,children:(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.container,testID:`${_testIDs.EVENTS_TEST_ID}-detail-route`,children:(0,_jsxRuntime.jsx)(u,{event:e.originalEvent,onNavigate:y})})})}const d=()=>{return e.originalEvent};const m=async()=>{await(0,_sharedUi.copyToClipboard)({source:e.source,timestamp:i.toISOString(),title:e.title,subtitle:e.subtitle,data:d()})};return(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.container,testID:`${_testIDs.EVENTS_TEST_ID}-detail`,children:(0,_jsxRuntime.jsxs)(_reactNative.ScrollView,{style:styles.content,contentContainerStyle:styles.contentContainer,testID:`${_testIDs.EVENTS_TEST_ID}-detail-scroll`,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.sourceBadgeRow,children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.sourceBadge,{backgroundColor:a.color+"20"}],children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.sourceDot,{backgroundColor:a.color}]}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.sourceLabel,{color:a.color}],testID:`${_testIDs.EVENTS_TEST_ID}-detail-source`,children:a.label})]})}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.title,testID:`${_testIDs.EVENTS_TEST_ID}-detail-title`,children:e.title}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.subtitle,testID:`${_testIDs.EVENTS_TEST_ID}-detail-subtitle`,children:e.subtitle}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.timestampRow,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.timestampLabel,children:"Timestamp"}),(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.timestampValue,testID:`${_testIDs.EVENTS_TEST_ID}-detail-timestamp`,children:[i.toLocaleTimeString()," (",(0,_sharedUi.formatRelativeTime)(i),")"]})]}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.dataSection,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.sectionLabel,children:"Event Data"}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.dataContainer,testID:`${_testIDs.EVENTS_TEST_ID}-detail-data`,children:(0,_jsxRuntime.jsx)(_dataViewer.DataViewer,{testIDPrefix:`${_testIDs.EVENTS_TEST_ID}-detail-data`,data:d(),title:"",showTypeFilter:true,rawMode:true,initialExpanded:true})})]})]})})});const styles=_reactNative.StyleSheet.create({container:{flex:1,backgroundColor:"transparent"},content:{flex:1},contentContainer:{padding:16},sourceBadgeRow:{flexDirection:"row",marginBottom:12},sourceBadge:{flexDirection:"row",alignItems:"center",paddingHorizontal:10,paddingVertical:6,borderRadius:12,gap:6},sourceDot:{width:6,height:6,borderRadius:3},sourceLabel:{fontSize:12,fontWeight:"600"},title:{fontSize:24,fontWeight:"700",color:_sharedUi.night.color.text,marginBottom:4},subtitle:{fontSize:16,color:_sharedUi.night.color.textTertiary,marginBottom:16},timestampRow:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:12,borderTopWidth:1,borderTopColor:_sharedUi.night.color.border,borderBottomWidth:1,borderBottomColor:_sharedUi.night.color.border,marginBottom:16},timestampLabel:{fontSize:14,color:_sharedUi.night.color.textTertiary},timestampValue:{fontSize:14,color:_sharedUi.night.color.text,fontFamily:_sharedUi.monoFont},dataSection:{marginTop:8},sectionLabel:{fontSize:12,fontWeight:"600",color:_sharedUi.night.color.textTertiary,textTransform:"uppercase",letterSpacing:.5,marginBottom:8},dataContainer:{backgroundColor:_sharedUi.night.color.surface,borderRadius:8,borderWidth:1,borderColor:_sharedUi.night.color.border,overflow:"hidden"}});