@buoy-gg/events 7.0.41 → 7.0.43

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