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