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