@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,383 +1 @@
1
- "use strict";
2
-
3
- /**
4
- * EventsModal
5
- *
6
- * Modal wrapper for the unified events timeline.
7
- * Uses JsModal for consistent bottom sheet behavior.
8
- */
9
-
10
- import { View, StyleSheet, TouchableOpacity, Text, Alert } from "react-native";
11
- import { useState, useCallback, useEffect, useRef } from "react";
12
- import { JsModal, ModalHeader, buoyColors, night, Trash2, Copy, Search, devToolsStorageKeys, ToolbarCopyButton, UpgradeModal, PowerToggleButton, useSafeRouter, windowDragProps } from "@buoy-gg/shared-ui";
13
- import { useUnifiedEvents } from "../hooks/useUnifiedEvents";
14
- import { UnifiedEventFilters } from "./UnifiedEventFilters";
15
- import { UnifiedEventList } from "./UnifiedEventList";
16
- import { UnifiedEventDetail } from "./UnifiedEventDetail";
17
- import { EventsCopySettingsView } from "./EventsCopySettingsView";
18
- import { EVENTS_TEST_ID } from "../utils/testIDs";
19
-
20
- // Try to load TickProvider from network package for time refresh
21
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
22
- let TickProvider = null;
23
- try {
24
- // @ts-ignore - Dynamic import that may not exist
25
- const network = require("@buoy-gg/network");
26
- TickProvider = network.TickProvider;
27
- } catch {
28
- // Network package not installed, times won't auto-refresh
29
- }
30
- export function EventsModal({
31
- visible,
32
- onClose,
33
- onBack,
34
- onMinimize,
35
- enableSharedModalDimensions = false,
36
- inline = false,
37
- capturing: capturingProp,
38
- onCapturingChange,
39
- networkDetailWrapper,
40
- NetworkEventDetailViewComponent,
41
- RouteEventDetailComponent,
42
- detailComponents
43
- }) {
44
- const router = useSafeRouter();
45
-
46
- // Controlled when the host supplies both halves; otherwise the tool's own
47
- // store is the source of truth.
48
- const controlledCapture = capturingProp != null && onCapturingChange != null;
49
- const {
50
- filteredEvents,
51
- availableSources,
52
- toggleSource,
53
- clearEvents,
54
- totalCount,
55
- filteredCount,
56
- isCapturing: isCapturingLocal,
57
- toggleCapturing: toggleCapturingLocal,
58
- hiddenEventsCount,
59
- searchText,
60
- setSearchText
61
- } = useUnifiedEvents(
62
- // Hand the hook the effective power state so its paused-list boundary
63
- // follows the host's toggle rather than the local persisted one.
64
- controlledCapture ? {
65
- capturingOverride: capturingProp
66
- } : undefined);
67
- const isCapturing = controlledCapture ? capturingProp : isCapturingLocal;
68
- const toggleCapturing = controlledCapture ? () => onCapturingChange(!capturingProp) : toggleCapturingLocal;
69
- const [currentView, setCurrentView] = useState("list");
70
- const [selectedEvent, setSelectedEvent] = useState(null);
71
- const [showUpgradeModal, setShowUpgradeModal] = useState(false);
72
- const [isSearchActive, setIsSearchActive] = useState(false);
73
- const searchInputRef = useRef(null);
74
-
75
- // Focus after the input has actually mounted (it replaces the title block).
76
- useEffect(() => {
77
- if (!isSearchActive) return;
78
- const frame = requestAnimationFrame(() => {
79
- searchInputRef.current?.focus();
80
- });
81
- return () => cancelAnimationFrame(frame);
82
- }, [isSearchActive]);
83
- const closeSearch = useCallback(() => {
84
- setIsSearchActive(false);
85
- setSearchText("");
86
- }, [setSearchText]);
87
-
88
- // Navigation handler for route events
89
- const handleNavigate = useCallback(pathname => {
90
- try {
91
- router.push(pathname);
92
- } catch (error) {
93
- Alert.alert("Navigation Error", String(error));
94
- }
95
- }, [router]);
96
- const handleEventPress = useCallback(event => {
97
- setSelectedEvent(event);
98
- setCurrentView("detail");
99
- }, []);
100
- const handleBack = useCallback(() => {
101
- if (currentView === "detail") {
102
- setSelectedEvent(null);
103
- setCurrentView("list");
104
- } else if (currentView === "copySettings") {
105
- setCurrentView("list");
106
- }
107
- }, [currentView]);
108
- const handleOpenCopySettings = useCallback(() => {
109
- setCurrentView("copySettings");
110
- }, []);
111
- const handleModeChange = useCallback(_mode => {
112
- // Mode changes handled by JsModal
113
- }, []);
114
- const persistenceKey = enableSharedModalDimensions ? devToolsStorageKeys.modal.root() : "buoy-events-modal";
115
- if (!visible) return null;
116
- const renderHeaderContent = () => {
117
- // Detail view header
118
- if (currentView === "detail" && selectedEvent) {
119
- const copyData = {
120
- source: selectedEvent.source,
121
- title: selectedEvent.title,
122
- subtitle: selectedEvent.subtitle,
123
- status: selectedEvent.status,
124
- timestamp: new Date(selectedEvent.timestamp).toISOString(),
125
- data: selectedEvent.originalEvent
126
- };
127
- return /*#__PURE__*/_jsxs(ModalHeader, {
128
- children: [/*#__PURE__*/_jsx(ModalHeader.Navigation, {
129
- onBack: handleBack
130
- }), /*#__PURE__*/_jsx(ModalHeader.Content, {
131
- title: selectedEvent.title,
132
- testID: `${EVENTS_TEST_ID}-detail-heading`
133
- }), /*#__PURE__*/_jsx(ModalHeader.Actions, {
134
- children: /*#__PURE__*/_jsx(ToolbarCopyButton, {
135
- value: copyData
136
- })
137
- })]
138
- });
139
- }
140
-
141
- // Copy settings view header
142
- if (currentView === "copySettings") {
143
- return /*#__PURE__*/_jsxs(ModalHeader, {
144
- children: [/*#__PURE__*/_jsx(ModalHeader.Navigation, {
145
- onBack: handleBack
146
- }), /*#__PURE__*/_jsx(ModalHeader.Content, {
147
- title: "Copy Settings",
148
- testID: `${EVENTS_TEST_ID}-copy-settings-heading`
149
- })]
150
- });
151
- }
152
-
153
- // List view header (default)
154
- return /*#__PURE__*/_jsxs(ModalHeader, {
155
- children: [onBack && /*#__PURE__*/_jsx(ModalHeader.Navigation, {
156
- onBack: onBack
157
- }), /*#__PURE__*/_jsx(ModalHeader.Content, {
158
- title: "",
159
- children: isSearchActive ? /*#__PURE__*/_jsx(ModalHeader.Search, {
160
- value: searchText,
161
- onChangeText: setSearchText,
162
- onCancel: closeSearch,
163
- placeholder: "Search events...",
164
- accessibilityLabel: "Search events",
165
- iconSize: 14,
166
- testID: `${EVENTS_TEST_ID}-search-field`,
167
- containerTestID: `${EVENTS_TEST_ID}-search`,
168
- clearTestID: `${EVENTS_TEST_ID}-search-clear`
169
- // Stay open while the query still filters the list — collapsing
170
- // it would hide why events are missing.
171
- ,
172
- onBlur: () => {
173
- if (searchText.length === 0) setIsSearchActive(false);
174
- }
175
- }) : /*#__PURE__*/_jsxs(View, {
176
- style: styles.headerTitleContainer,
177
- children: [/*#__PURE__*/_jsx(Text, {
178
- style: styles.headerTitle,
179
- testID: `${EVENTS_TEST_ID}-title`,
180
- children: "Events"
181
- }), /*#__PURE__*/_jsxs(Text, {
182
- style: styles.headerSubtitle,
183
- testID: `${EVENTS_TEST_ID}-count`,
184
- children: [totalCount, " captured"]
185
- })]
186
- })
187
- }), /*#__PURE__*/_jsxs(ModalHeader.Actions, {
188
- children: [!isSearchActive && /*#__PURE__*/_jsx(TouchableOpacity, {
189
- onPress: () => setIsSearchActive(true),
190
- style: [styles.headerActionButton, searchText.length > 0 && styles.headerActionButtonActive],
191
- testID: `${EVENTS_TEST_ID}-search-open`,
192
- accessibilityRole: "button",
193
- accessibilityLabel: "Search events",
194
- children: /*#__PURE__*/_jsx(Search, {
195
- size: 14,
196
- color: searchText.length > 0 ? night.color.accent : night.color.textSecondary
197
- })
198
- }), /*#__PURE__*/_jsx(TouchableOpacity, {
199
- onPress: handleOpenCopySettings,
200
- style: [styles.headerActionButton, totalCount === 0 && styles.headerActionButtonDisabled],
201
- disabled: totalCount === 0,
202
- testID: `${EVENTS_TEST_ID}-copy`,
203
- accessibilityRole: "button",
204
- accessibilityLabel: "Copy events",
205
- children: /*#__PURE__*/_jsx(Copy, {
206
- size: 14,
207
- color: totalCount > 0 ? night.color.textSecondary : night.color.textTertiary
208
- })
209
- }), /*#__PURE__*/_jsx(PowerToggleButton, {
210
- isEnabled: isCapturing,
211
- onToggle: toggleCapturing,
212
- testID: `${EVENTS_TEST_ID}-power`,
213
- accessibilityLabel: "Toggle event capture"
214
- }), /*#__PURE__*/_jsx(TouchableOpacity, {
215
- onPress: clearEvents,
216
- style: [styles.headerActionButton, totalCount === 0 && styles.headerActionButtonDisabled],
217
- disabled: totalCount === 0,
218
- testID: `${EVENTS_TEST_ID}-clear`,
219
- accessibilityRole: "button",
220
- accessibilityLabel: "Clear events",
221
- children: /*#__PURE__*/_jsx(Trash2, {
222
- size: 14,
223
- color: totalCount > 0 ? night.color.textSecondary : night.color.textTertiary
224
- })
225
- })]
226
- })]
227
- });
228
- };
229
- const content = /*#__PURE__*/_jsx(View, {
230
- style: styles.container,
231
- children: currentView === "copySettings" ? /*#__PURE__*/_jsx(EventsCopySettingsView, {
232
- events: filteredEvents
233
- }) : currentView === "detail" && selectedEvent ? /*#__PURE__*/_jsx(UnifiedEventDetail, {
234
- event: selectedEvent,
235
- onBack: handleBack,
236
- onNavigate: handleNavigate,
237
- networkDetailWrapper: networkDetailWrapper,
238
- NetworkEventDetailViewComponent: NetworkEventDetailViewComponent,
239
- RouteEventDetailComponent: RouteEventDetailComponent,
240
- detailComponents: detailComponents
241
- }) : /*#__PURE__*/_jsxs(_Fragment, {
242
- children: [/*#__PURE__*/_jsx(UnifiedEventFilters, {
243
- availableSources: availableSources,
244
- onToggleSource: toggleSource,
245
- totalCount: totalCount,
246
- filteredCount: filteredCount
247
- }), /*#__PURE__*/_jsx(UnifiedEventList, {
248
- events: filteredEvents,
249
- selectedEventId: undefined,
250
- expandedEventId: undefined,
251
- onEventPress: handleEventPress,
252
- onNavigate: handleNavigate,
253
- isCapturing: isCapturing,
254
- hiddenEventsCount: hiddenEventsCount,
255
- searchText: searchText
256
- // The three facts an empty list needs to explain ITSELF: what was
257
- // captured before the user's own filters, how many sources exist,
258
- // and how many are on. Without them the list can only guess, and
259
- // its guess used to be "events will appear here" no matter what.
260
- ,
261
- totalCount: totalCount,
262
- sourceCount: availableSources.length,
263
- enabledSourceCount: availableSources.filter(source => source.enabled !== false).length,
264
- onUpgradePress: () => setShowUpgradeModal(true)
265
- })]
266
- })
267
- });
268
- const body = TickProvider ? /*#__PURE__*/_jsx(TickProvider, {
269
- children: content
270
- }) : content;
271
- const upgradeModal = /*#__PURE__*/_jsx(_Fragment, {
272
- children: /*#__PURE__*/_jsx(UpgradeModal, {
273
- visible: showUpgradeModal,
274
- onClose: () => setShowUpgradeModal(false),
275
- featureName: "Unlimited Events",
276
- description: "View your complete event history to debug complex flows and track down issues.",
277
- benefits: ["Unlimited event history (vs 25 events)", "Export events to Markdown, JSON, or plain text", "Share event flows with teammates", "Feed event context directly to AI assistants"]
278
- })
279
- });
280
-
281
- // The ONLY difference between the phone and the desktop dashboard is which
282
- // shell the header and body go in. Everything above this line is shared.
283
- if (inline) {
284
- return /*#__PURE__*/_jsxs(_Fragment, {
285
- children: [/*#__PURE__*/_jsxs(View, {
286
- style: styles.inlineRoot,
287
- children: [/*#__PURE__*/_jsx(View, {
288
- style: styles.inlineHeader,
289
- ...windowDragProps,
290
- children: renderHeaderContent()
291
- }), body]
292
- }), upgradeModal]
293
- });
294
- }
295
- return /*#__PURE__*/_jsxs(_Fragment, {
296
- children: [/*#__PURE__*/_jsx(JsModal, {
297
- visible: visible,
298
- onClose: onClose,
299
- onMinimize: onMinimize,
300
- persistenceKey: persistenceKey,
301
- header: {
302
- showToggleButton: true,
303
- customContent: renderHeaderContent()
304
- },
305
- onModeChange: handleModeChange,
306
- enablePersistence: true,
307
- initialMode: "bottomSheet",
308
- enableGlitchEffects: true,
309
- styles: {},
310
- disableScrollWrapper: true,
311
- children: body
312
- }), upgradeModal]
313
- });
314
- }
315
- const styles = StyleSheet.create({
316
- inlineRoot: {
317
- flex: 1,
318
- minHeight: 0,
319
- // Transparent so the desktop workbench's hoisted sky (one field spanning
320
- // sidebar + panel) shows through — the shell paints its base beneath it.
321
- backgroundColor: "transparent"
322
- },
323
- inlineHeader: {
324
- paddingHorizontal: 12,
325
- paddingVertical: 8,
326
- borderBottomWidth: 1,
327
- borderBottomColor: buoyColors.border,
328
- // Clear, like Bench — the host's hoisted sky shows through the header.
329
- backgroundColor: "transparent"
330
- },
331
- container: {
332
- flex: 1,
333
- // Transparent so JsModal's ToolBackground shows through (the modal paints opaque base beneath it).
334
- backgroundColor: "transparent"
335
- },
336
- headerTitleContainer: {
337
- flexDirection: "row",
338
- alignItems: "baseline",
339
- gap: 8
340
- },
341
- headerTitle: {
342
- fontSize: 16,
343
- fontWeight: "600",
344
- color: night.color.text
345
- },
346
- headerSubtitle: {
347
- fontSize: 12,
348
- color: night.color.textTertiary
349
- },
350
- headerActionButton: {
351
- width: 32,
352
- height: 32,
353
- borderRadius: 8,
354
- backgroundColor: night.color.buttonSurface,
355
- borderWidth: 1,
356
- borderColor: night.color.border,
357
- alignItems: "center",
358
- justifyContent: "center"
359
- },
360
- headerActionButtonDisabled: {
361
- opacity: 0.55
362
- },
363
- headerActionButtonActive: {
364
- backgroundColor: night.color.accentSoft,
365
- borderColor: night.color.accentBorderStrong
366
- }
367
- });
368
-
369
- /**
370
- * The same events tool as `EventsModal`, rendered INLINE for hosts that place
371
- * tools in a panel rather than a modal. Exists so there is exactly one
372
- * implementation — the desktop dashboard used to ship its own copy of this
373
- * component's header and screen router.
374
- */
375
- export function EventsToolView(props = {}) {
376
- return /*#__PURE__*/_jsx(EventsModal, {
377
- ...props,
378
- inline: true,
379
- visible: true,
380
- onClose: () => {}
381
- });
382
- }
383
- //# sourceMappingURL=EventsModal.js.map
1
+ "use strict";import{View as b,StyleSheet as se,TouchableOpacity as x,Text as z,Alert as ce}from"react-native";import{useState as v,useCallback as d,useEffect as de,useRef as ue}from"react";import{JsModal as he,ModalHeader as t,buoyColors as ge,night as o,Trash2 as pe,Copy as fe,Search as be,devToolsStorageKeys as ve,ToolbarCopyButton as me,UpgradeModal as ye,PowerToggleButton as Ce,useSafeRouter as Se,windowDragProps as Ee}from"@buoy-gg/shared-ui";import{useUnifiedEvents as Te}from"../hooks/useUnifiedEvents";import{UnifiedEventFilters as xe}from"./UnifiedEventFilters";import{UnifiedEventList as we}from"./UnifiedEventList";import{UnifiedEventDetail as De}from"./UnifiedEventDetail";import{EventsCopySettingsView as Be}from"./EventsCopySettingsView";import{EVENTS_TEST_ID as r}from"../utils/testIDs";import{TickProvider as L}from"@buoy-gg/shared-ui";import{jsx as e,jsxs as a,Fragment as m}from"react/jsx-runtime";export function EventsModal({visible:h,onClose:P,onBack:w,onMinimize:F,enableSharedModalDimensions:H=false,inline:_=false,capturing:g,onCapturingChange:D,networkDetailWrapper:j,NetworkEventDetailViewComponent:O,RouteEventDetailComponent:W,detailComponents:K}){const B=Se();const y=g!=null&&D!=null;const{filteredEvents:I,availableSources:C,toggleSource:J,clearEvents:q,totalCount:s,filteredCount:G,isCapturing:Q,toggleCapturing:X,hiddenEventsCount:Y,searchText:u,setSearchText:S}=Te(y?{capturingOverride:g}:void 0);const A=y?g:Q;const Z=y?()=>D(!g):X;const[c,p]=v("list");const[i,k]=v(null);const[ee,M]=v(false);const[f,E]=v(false);const te=ue(null);de(()=>{if(!f)return;const l=requestAnimationFrame(()=>{te.current?.focus()});return()=>cancelAnimationFrame(l)},[f]);const oe=d(()=>{E(false);S("")},[S]);const N=d(l=>{try{B.push(l)}catch(ae){ce.alert("Navigation Error",String(ae))}},[B]);const ne=d(l=>{k(l);p("detail")},[]);const T=d(()=>{if(c==="detail"){k(null);p("list")}else if(c==="copySettings"){p("list")}},[c]);const re=d(()=>{p("copySettings")},[]);const ie=d(l=>{},[]);const le=H?ve.modal.root():"buoy-events-modal";if(!h)return null;const $=()=>{if(c==="detail"&&i){const l={source:i.source,title:i.title,subtitle:i.subtitle,status:i.status,timestamp:new Date(i.timestamp).toISOString(),data:i.originalEvent};return a(t,{children:[e(t.Navigation,{onBack:T}),e(t.Content,{title:i.title,testID:`${r}-detail-heading`}),e(t.Actions,{children:e(me,{value:l})})]})}if(c==="copySettings"){return a(t,{children:[e(t.Navigation,{onBack:T}),e(t.Content,{title:"Copy Settings",testID:`${r}-copy-settings-heading`})]})}return a(t,{children:[w&&e(t.Navigation,{onBack:w}),e(t.Content,{title:"",children:f?e(t.Search,{value:u,onChangeText:S,onCancel:oe,placeholder:"Search events...",accessibilityLabel:"Search events",iconSize:14,testID:`${r}-search-field`,containerTestID:`${r}-search`,clearTestID:`${r}-search-clear`,onBlur:()=>{if(u.length===0)E(false)}}):a(b,{style:n.headerTitleContainer,children:[e(z,{style:n.headerTitle,testID:`${r}-title`,children:"Events"}),a(z,{style:n.headerSubtitle,testID:`${r}-count`,children:[s," captured"]})]})}),a(t.Actions,{children:[!f&&e(x,{onPress:()=>E(true),style:[n.headerActionButton,u.length>0&&n.headerActionButtonActive],testID:`${r}-search-open`,accessibilityRole:"button",accessibilityLabel:"Search events",children:e(be,{size:14,color:u.length>0?o.color.accent:o.color.textSecondary})}),e(x,{onPress:re,style:[n.headerActionButton,s===0&&n.headerActionButtonDisabled],disabled:s===0,testID:`${r}-copy`,accessibilityRole:"button",accessibilityLabel:"Copy events",children:e(fe,{size:14,color:s>0?o.color.textSecondary:o.color.textTertiary})}),e(Ce,{isEnabled:A,onToggle:Z,testID:`${r}-power`,accessibilityLabel:"Toggle event capture"}),e(x,{onPress:q,style:[n.headerActionButton,s===0&&n.headerActionButtonDisabled],disabled:s===0,testID:`${r}-clear`,accessibilityRole:"button",accessibilityLabel:"Clear events",children:e(pe,{size:14,color:s>0?o.color.textSecondary:o.color.textTertiary})})]})]})};const R=e(b,{style:n.container,children:c==="copySettings"?e(Be,{events:I}):c==="detail"&&i?e(De,{event:i,onBack:T,onNavigate:N,networkDetailWrapper:j,NetworkEventDetailViewComponent:O,RouteEventDetailComponent:W,detailComponents:K}):a(m,{children:[e(xe,{availableSources:C,onToggleSource:J,totalCount:s,filteredCount:G}),e(we,{events:I,selectedEventId:void 0,expandedEventId:void 0,onEventPress:ne,onNavigate:N,isCapturing:A,hiddenEventsCount:Y,searchText:u,totalCount:s,sourceCount:C.length,enabledSourceCount:C.filter(l=>l.enabled!==false).length,onUpgradePress:()=>M(true)})]})});const U=L?e(L,{children:R}):R;const V=e(m,{children:e(ye,{visible:ee,onClose:()=>M(false),featureName:"Unlimited Events",description:"View your complete event history to debug complex flows and track down issues.",benefits:["Unlimited event history (vs 25 events)","Export events to Markdown, JSON, or plain text","Share event flows with teammates","Feed event context directly to AI assistants"]})});if(_){return a(m,{children:[a(b,{style:n.inlineRoot,children:[e(b,{style:n.inlineHeader,...Ee,children:$()}),U]}),V]})}return a(m,{children:[e(he,{visible:h,onClose:P,onMinimize:F,persistenceKey:le,header:{showToggleButton:true,customContent:$()},onModeChange:ie,enablePersistence:true,initialMode:"bottomSheet",enableGlitchEffects:true,styles:{},disableScrollWrapper:true,children:U}),V]})}const n=se.create({inlineRoot:{flex:1,minHeight:0,backgroundColor:"transparent"},inlineHeader:{paddingHorizontal:12,paddingVertical:8,borderBottomWidth:1,borderBottomColor:ge.border,backgroundColor:"transparent"},container:{flex:1,backgroundColor:"transparent"},headerTitleContainer:{flexDirection:"row",alignItems:"baseline",gap:8},headerTitle:{fontSize:16,fontWeight:"600",color:o.color.text},headerSubtitle:{fontSize:12,color:o.color.textTertiary},headerActionButton:{width:32,height:32,borderRadius:8,backgroundColor:o.color.buttonSurface,borderWidth:1,borderColor:o.color.border,alignItems:"center",justifyContent:"center"},headerActionButtonDisabled:{opacity:.55},headerActionButtonActive:{backgroundColor:o.color.accentSoft,borderColor:o.color.accentBorderStrong}});export function EventsToolView(h={}){return e(EventsModal,{...h,inline:true,visible:true,onClose:()=>{}})}