@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,581 +1 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.EventsCopySettingsView = EventsCopySettingsView;
7
- var _react = require("react");
8
- var _reactNative = require("react-native");
9
- var _sharedUi = require("@buoy-gg/shared-ui");
10
- var _dataViewer = require("@buoy-gg/shared-ui/dataViewer");
11
- var _copySettings = require("../types/copySettings");
12
- var _eventExportFormatter = require("../utils/eventExportFormatter");
13
- var _copySettingsStorage = require("../utils/copySettingsStorage");
14
- var _testIDs = require("../utils/testIDs");
15
- var _jsxRuntime = require("react/jsx-runtime");
16
- /**
17
- * EventsCopySettingsView
18
- *
19
- * Settings UI for configuring event export format and content.
20
- * Based on NetworkCopySettingsView pattern.
21
- */
22
-
23
- // Size thresholds for warnings
24
- const SIZE_WARNING_THRESHOLD = 50 * 1024; // 50KB
25
- const SIZE_DANGER_THRESHOLD = 200 * 1024; // 200KB
26
-
27
- // Helper to format bytes
28
- function formatBytes(bytes) {
29
- if (bytes < 1024) return `${bytes} B`;
30
- if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;
31
- return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
32
- }
33
-
34
- // Mock events for preview when no real events exist
35
- function createMockEvents() {
36
- const now = Date.now();
37
- return [{
38
- id: "mock-1",
39
- source: "storage-async",
40
- timestamp: now - 2000,
41
- title: "Set Item",
42
- subtitle: "user_cart",
43
- status: "success",
44
- originalEvent: {
45
- action: "setItem",
46
- key: "user_cart",
47
- value: {
48
- items: 2
49
- }
50
- }
51
- }, {
52
- id: "mock-2",
53
- source: "react-query-query",
54
- timestamp: now - 1500,
55
- title: "cart \u203A items",
56
- subtitle: "Fetching...",
57
- status: "pending",
58
- originalEvent: {
59
- type: "query-fetch-start",
60
- queryKey: ["cart", "items"]
61
- },
62
- correlationId: "rq-query-cart",
63
- sequenceInGroup: 1
64
- }, {
65
- id: "mock-3",
66
- source: "react-query-query",
67
- timestamp: now - 1000,
68
- title: "cart \u203A items",
69
- subtitle: "Success \u00B7 500ms",
70
- status: "success",
71
- originalEvent: {
72
- type: "query-fetch-success",
73
- queryKey: ["cart", "items"],
74
- data: {
75
- items: []
76
- }
77
- },
78
- correlationId: "rq-query-cart",
79
- sequenceInGroup: 2
80
- }, {
81
- id: "mock-4",
82
- source: "network",
83
- timestamp: now - 500,
84
- title: "POST /api/checkout",
85
- subtitle: "402 \u00B7 450ms",
86
- status: "error",
87
- originalEvent: {
88
- method: "POST",
89
- url: "/api/checkout",
90
- status: 402,
91
- error: "Payment required"
92
- }
93
- }];
94
- }
95
- function EventsCopySettingsView({
96
- events = [],
97
- initialSettings = _copySettings.DEFAULT_COPY_SETTINGS,
98
- onSettingsChange
99
- }) {
100
- const {
101
- isPro
102
- } = (0, _sharedUi.useFeatureGate)();
103
- const [settings, setSettings] = (0, _react.useState)(initialSettings);
104
- const [isPreviewExpanded, setIsPreviewExpanded] = (0, _react.useState)(false);
105
- const [isLoaded, setIsLoaded] = (0, _react.useState)(false);
106
-
107
- // Load persisted settings on mount
108
- (0, _react.useEffect)(() => {
109
- let mounted = true;
110
- (0, _copySettingsStorage.loadCopySettings)().then(savedSettings => {
111
- if (mounted && savedSettings) {
112
- setSettings(savedSettings);
113
- onSettingsChange?.(savedSettings);
114
- }
115
- if (mounted) {
116
- setIsLoaded(true);
117
- }
118
- });
119
- return () => {
120
- mounted = false;
121
- };
122
- }, [onSettingsChange]);
123
-
124
- // Update internal state, notify parent, and persist
125
- const updateSettings = (0, _react.useCallback)(newSettings => {
126
- setSettings(newSettings);
127
- onSettingsChange?.(newSettings);
128
- // Persist to storage
129
- (0, _copySettingsStorage.saveCopySettings)(newSettings);
130
- }, [onSettingsChange]);
131
-
132
- // Use mock events if no real events
133
- const hasLiveData = events.length > 0;
134
- const previewEvents = hasLiveData ? events : createMockEvents();
135
-
136
- // Detect active preset
137
- const activePreset = (0, _react.useMemo)(() => (0, _copySettings.detectActivePreset)(settings), [settings]);
138
-
139
- // Estimate size
140
- const estimatedSize = (0, _react.useMemo)(() => (0, _eventExportFormatter.estimateExportSize)(previewEvents, settings), [previewEvents, settings]);
141
-
142
- // Size warning level
143
- const sizeWarningLevel = (0, _react.useMemo)(() => {
144
- if (estimatedSize >= SIZE_DANGER_THRESHOLD) return "danger";
145
- if (estimatedSize >= SIZE_WARNING_THRESHOLD) return "warning";
146
- return "none";
147
- }, [estimatedSize]);
148
-
149
- // Generate copy text
150
- const generateCopyText = (0, _react.useCallback)(() => {
151
- return (0, _eventExportFormatter.generateExport)(previewEvents, settings);
152
- }, [previewEvents, settings]);
153
-
154
- // Handle preset selection
155
- const applyPreset = (0, _react.useCallback)(presetName => {
156
- const preset = _copySettings.COPY_PRESETS[presetName];
157
- updateSettings({
158
- ...preset,
159
- // Convert readonly array to mutable array
160
- filterSources: [...preset.filterSources]
161
- });
162
- }, [updateSettings]);
163
-
164
- // Handle option changes
165
- const handleOptionChange = (0, _react.useCallback)((optionId, value) => {
166
- const [group, key] = optionId.split("::");
167
- if (group === "preset") {
168
- applyPreset(key);
169
- return;
170
- }
171
- if (group === "include") {
172
- updateSettings({
173
- ...settings,
174
- [key]: !settings[key]
175
- });
176
- return;
177
- }
178
- if (group === "format") {
179
- updateSettings({
180
- ...settings,
181
- format: value
182
- });
183
- return;
184
- }
185
- if (group === "timestamp") {
186
- updateSettings({
187
- ...settings,
188
- timestampFormat: value
189
- });
190
- return;
191
- }
192
- if (group === "filter") {
193
- updateSettings({
194
- ...settings,
195
- filterMode: value
196
- });
197
- return;
198
- }
199
- if (group === "threshold") {
200
- updateSettings({
201
- ...settings,
202
- dataSizeThreshold: value
203
- });
204
- return;
205
- }
206
- }, [settings, updateSettings, applyPreset]);
207
-
208
- // Render preview content
209
- const renderPreviewContent = (0, _react.useCallback)(() => {
210
- const eventCount = previewEvents.length;
211
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.ExportPreview, {
212
- expanded: isPreviewExpanded,
213
- onExpandedChange: setIsPreviewExpanded,
214
- summary: `${eventCount} event${eventCount !== 1 ? "s" : ""} \u00B7 ~${formatBytes(estimatedSize)}${!hasLiveData ? " (mock data)" : ""}`,
215
- warningLevel: sizeWarningLevel,
216
- warningText: {
217
- warning: "Large payload - preview may be slow",
218
- danger: "Very large payload - may cause performance issues"
219
- },
220
- testIDs: {
221
- expand: `${_testIDs.EVENTS_TEST_ID}-preview-expand`,
222
- collapse: `${_testIDs.EVENTS_TEST_ID}-preview-collapse`,
223
- summary: `${_testIDs.EVENTS_TEST_ID}-preview-summary`,
224
- warning: `${_testIDs.EVENTS_TEST_ID}-preview-size-warning`
225
- },
226
- renderBody: () => {
227
- const exportText = generateCopyText();
228
- return settings.format === "json" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_dataViewer.DataViewer, {
229
- testIDPrefix: `${_testIDs.EVENTS_TEST_ID}-preview-json`,
230
- data: JSON.parse(exportText),
231
- title: "",
232
- showTypeFilter: true,
233
- rawMode: true,
234
- initialExpanded: true
235
- }) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
236
- children: [settings.format === "mermaid" && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
237
- style: styles.mermaidHint,
238
- children: "\uD83D\uDCA1 Paste into mermaid.live to visualize"
239
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.ScrollView, {
240
- style: styles.previewScroll,
241
- nestedScrollEnabled: true,
242
- testID: `${_testIDs.EVENTS_TEST_ID}-preview-scroll`,
243
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
244
- style: styles.previewText,
245
- selectable: isPro,
246
- testID: `${_testIDs.EVENTS_TEST_ID}-preview-text`,
247
- children: exportText
248
- })
249
- })]
250
- });
251
- }
252
- });
253
- }, [isPreviewExpanded, previewEvents, settings, estimatedSize, sizeWarningLevel, hasLiveData, generateCopyText, isPro]);
254
-
255
- // Render preview header actions
256
- const renderPreviewHeaderActions = (0, _react.useCallback)(() => {
257
- const summary = (0, _eventExportFormatter.getExportSummary)(previewEvents);
258
- const statusLabel = hasLiveData ? `${summary.totalEvents} events` : "Mock data (no events captured)";
259
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
260
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
261
- style: styles.statusLabel,
262
- testID: `${_testIDs.EVENTS_TEST_ID}-export-status`,
263
- children: statusLabel
264
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.ToolbarCopyButton, {
265
- value: generateCopyText()
266
- })]
267
- });
268
- }, [hasLiveData, previewEvents, generateCopyText]);
269
-
270
- // Build filter config
271
- const dynamicFilterConfig = (0, _react.useMemo)(() => ({
272
- sections: [
273
- // Presets Section
274
- {
275
- id: "presets",
276
- title: "Presets",
277
- type: "custom",
278
- data: [{
279
- id: "preset::llm",
280
- label: _copySettings.PRESET_METADATA.llm.label,
281
- icon: _sharedUi.Zap,
282
- color: _copySettings.PRESET_METADATA.llm.color,
283
- value: "llm",
284
- isActive: activePreset === "llm",
285
- description: _copySettings.PRESET_METADATA.llm.description
286
- }, {
287
- id: "preset::bugReport",
288
- label: _copySettings.PRESET_METADATA.bugReport.label,
289
- icon: _sharedUi.AlertTriangle,
290
- color: _copySettings.PRESET_METADATA.bugReport.color,
291
- value: "bugReport",
292
- isActive: activePreset === "bugReport",
293
- description: _copySettings.PRESET_METADATA.bugReport.description
294
- }, {
295
- id: "preset::json",
296
- label: _copySettings.PRESET_METADATA.json.label,
297
- icon: _sharedUi.FileCode,
298
- color: _copySettings.PRESET_METADATA.json.color,
299
- value: "json",
300
- isActive: activePreset === "json",
301
- description: _copySettings.PRESET_METADATA.json.description
302
- }, {
303
- id: "preset::errors",
304
- label: _copySettings.PRESET_METADATA.errors.label,
305
- icon: _sharedUi.XCircle,
306
- color: _copySettings.PRESET_METADATA.errors.color,
307
- value: "errors",
308
- isActive: activePreset === "errors",
309
- description: _copySettings.PRESET_METADATA.errors.description
310
- }, {
311
- id: "preset::minimal",
312
- label: _copySettings.PRESET_METADATA.minimal.label,
313
- icon: _sharedUi.FileText,
314
- color: _copySettings.PRESET_METADATA.minimal.color,
315
- value: "minimal",
316
- isActive: activePreset === "minimal",
317
- description: _copySettings.PRESET_METADATA.minimal.description
318
- }, {
319
- id: "preset::mermaid",
320
- label: _copySettings.PRESET_METADATA.mermaid.label,
321
- icon: _sharedUi.GitBranch,
322
- color: _copySettings.PRESET_METADATA.mermaid.color,
323
- value: "mermaid",
324
- isActive: activePreset === "mermaid",
325
- description: _copySettings.PRESET_METADATA.mermaid.description
326
- }, {
327
- id: "preset::custom",
328
- label: "Custom",
329
- icon: _sharedUi.Settings,
330
- color: _sharedUi.night.color.textSecondary,
331
- value: "custom",
332
- isActive: activePreset === null,
333
- description: "User-configured"
334
- }]
335
- },
336
- // Include Section
337
- {
338
- id: "include",
339
- title: "Include",
340
- type: "custom",
341
- data: [{
342
- id: "include::includeSource",
343
- label: "Source",
344
- value: "includeSource",
345
- isActive: settings.includeSource
346
- }, {
347
- id: "include::includeStatus",
348
- label: "Status",
349
- value: "includeStatus",
350
- isActive: settings.includeStatus
351
- }, {
352
- id: "include::includeTitle",
353
- label: "Title",
354
- value: "includeTitle",
355
- isActive: settings.includeTitle
356
- }, {
357
- id: "include::includeSubtitle",
358
- label: "Subtitle",
359
- value: "includeSubtitle",
360
- isActive: settings.includeSubtitle
361
- }, {
362
- id: "include::includeCorrelation",
363
- label: "Correlation",
364
- value: "includeCorrelation",
365
- isActive: settings.includeCorrelation
366
- }, {
367
- id: "include::includeDuration",
368
- label: "Duration",
369
- value: "includeDuration",
370
- isActive: settings.includeDuration
371
- }, {
372
- id: "include::includeSummaryHeader",
373
- label: "Summary",
374
- value: "includeSummaryHeader",
375
- isActive: settings.includeSummaryHeader
376
- }, {
377
- id: "include::includeEventData",
378
- label: "Data",
379
- value: "includeEventData",
380
- isActive: settings.includeEventData
381
- }]
382
- },
383
- // Format Section
384
- {
385
- id: "format",
386
- title: "Format",
387
- type: "custom",
388
- data: [{
389
- id: "format::markdown",
390
- label: "Markdown",
391
- icon: _sharedUi.FileText,
392
- color: _sharedUi.macOSColors.semantic.info,
393
- value: "markdown",
394
- isActive: settings.format === "markdown"
395
- }, {
396
- id: "format::json",
397
- label: "JSON",
398
- icon: _sharedUi.FileCode,
399
- color: _sharedUi.macOSColors.semantic.warning,
400
- value: "json",
401
- isActive: settings.format === "json"
402
- }, {
403
- id: "format::plaintext",
404
- label: "Text",
405
- icon: _sharedUi.Hash,
406
- color: _sharedUi.night.color.textSecondary,
407
- value: "plaintext",
408
- isActive: settings.format === "plaintext"
409
- }, {
410
- id: "format::mermaid",
411
- label: "Diagram",
412
- icon: _sharedUi.GitBranch,
413
- color: "#A855F7",
414
- value: "mermaid",
415
- isActive: settings.format === "mermaid",
416
- description: "Mermaid sequence diagram"
417
- }]
418
- },
419
- // Timestamp Section
420
- {
421
- id: "timestamp",
422
- title: "Timestamps",
423
- type: "custom",
424
- data: [{
425
- id: "timestamp::relative",
426
- label: "Relative",
427
- value: "relative",
428
- isActive: settings.timestampFormat === "relative",
429
- description: "+0ms, +150ms"
430
- }, {
431
- id: "timestamp::absolute",
432
- label: "Absolute",
433
- value: "absolute",
434
- isActive: settings.timestampFormat === "absolute",
435
- description: "ISO format"
436
- }, {
437
- id: "timestamp::both",
438
- label: "Both",
439
- value: "both",
440
- isActive: settings.timestampFormat === "both",
441
- description: "Both formats"
442
- }]
443
- },
444
- // Filter Section
445
- {
446
- id: "filter",
447
- title: "Filter Events",
448
- type: "custom",
449
- data: [{
450
- id: "filter::all",
451
- label: "All",
452
- value: "all",
453
- isActive: settings.filterMode === "all"
454
- }, {
455
- id: "filter::errors",
456
- label: "Errors",
457
- icon: _sharedUi.XCircle,
458
- color: _sharedUi.macOSColors.semantic.error,
459
- value: "errors",
460
- isActive: settings.filterMode === "errors"
461
- }, {
462
- id: "filter::success",
463
- label: "Success",
464
- color: _sharedUi.macOSColors.semantic.success,
465
- value: "success",
466
- isActive: settings.filterMode === "success"
467
- }, {
468
- id: "filter::pending",
469
- label: "Pending",
470
- color: _sharedUi.macOSColors.semantic.warning,
471
- value: "pending",
472
- isActive: settings.filterMode === "pending"
473
- }]
474
- },
475
- // LLM Optimization Section
476
- {
477
- id: "llmOptimization",
478
- title: "LLM Optimization",
479
- type: "custom",
480
- data: [{
481
- id: "include::compactMode",
482
- label: "Compact",
483
- value: "compactMode",
484
- isActive: settings.compactMode,
485
- description: "One line per event"
486
- }, {
487
- id: "include::smartJsonParsing",
488
- label: "Smart JSON",
489
- value: "smartJsonParsing",
490
- isActive: settings.smartJsonParsing,
491
- description: "Parse nested JSON"
492
- }, {
493
- id: "include::reduxChangedOnly",
494
- label: "Redux Diff",
495
- value: "reduxChangedOnly",
496
- isActive: settings.reduxChangedOnly,
497
- description: "Only show changes"
498
- }, {
499
- id: "include::showStorageDiff",
500
- label: "Storage Diff",
501
- value: "showStorageDiff",
502
- isActive: settings.showStorageDiff,
503
- description: "Show what changed"
504
- }, {
505
- id: "include::stripVerboseFields",
506
- label: "Strip Noise",
507
- value: "stripVerboseFields",
508
- isActive: settings.stripVerboseFields,
509
- description: "Remove images/descriptions"
510
- }]
511
- }],
512
- previewSection: {
513
- enabled: true,
514
- title: "PREVIEW",
515
- icon: _sharedUi.Eye,
516
- content: renderPreviewContent,
517
- headerActions: renderPreviewHeaderActions
518
- },
519
- onFilterChange: handleOptionChange
520
- }), [settings, activePreset, handleOptionChange, renderPreviewContent, renderPreviewHeaderActions]);
521
-
522
- // Pro gating - show banner at top with preview below (no floating)
523
- if (!isPro) {
524
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.ScrollView, {
525
- style: styles.gatedContainer,
526
- contentContainerStyle: styles.gatedContent,
527
- testID: `${_testIDs.EVENTS_TEST_ID}-copy-settings-gated`,
528
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.ProFeatureBanner, {
529
- featureName: "Events Export",
530
- description: "Export event flows to share with your team, debug issues, or feed into AI tools.",
531
- benefits: ["Export to Markdown, JSON, or plain text", "Customizable presets (LLM-ready, Bug Report, JSON)", "Share event flows with teammates", "Feed event context directly to AI assistants"]
532
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
533
- style: styles.gatedPreview,
534
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.DynamicFilterView, {
535
- ...dynamicFilterConfig
536
- })
537
- })]
538
- });
539
- }
540
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.DynamicFilterView, {
541
- ...dynamicFilterConfig
542
- });
543
- }
544
- const styles = _reactNative.StyleSheet.create({
545
- previewScroll: {
546
- maxHeight: 300
547
- },
548
- previewText: {
549
- fontFamily: _sharedUi.monoFont,
550
- fontSize: 11,
551
- color: _sharedUi.night.color.text,
552
- lineHeight: 18
553
- },
554
- mermaidHint: {
555
- fontSize: 11,
556
- color: _sharedUi.night.color.textSecondary,
557
- marginBottom: 8,
558
- paddingHorizontal: 8,
559
- paddingVertical: 6,
560
- backgroundColor: "#A855F7" + "15",
561
- borderRadius: 6,
562
- overflow: "hidden"
563
- },
564
- statusLabel: {
565
- fontSize: 11,
566
- fontWeight: "600",
567
- color: _sharedUi.night.color.textTertiary,
568
- marginRight: 8
569
- },
570
- gatedContainer: {
571
- flex: 1
572
- },
573
- gatedContent: {
574
- padding: 12,
575
- gap: 12
576
- },
577
- gatedPreview: {
578
- // No flex: 1 so it doesn't try to fill remaining space
579
- }
580
- });
581
- //# sourceMappingURL=EventsCopySettingsView.js.map
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.EventsCopySettingsView=EventsCopySettingsView;var _react=require("react");var _reactNative=require("react-native");var _sharedUi=require("@buoy-gg/shared-ui");var _dataViewer=require("@buoy-gg/shared-ui/dataViewer");var _copySettings=require("../types/copySettings");var _eventExportFormatter=require("../utils/eventExportFormatter");var _copySettingsStorage=require("../utils/copySettingsStorage");var _testIDs=require("../utils/testIDs");var _jsxRuntime=require("react/jsx-runtime");const SIZE_WARNING_THRESHOLD=50*1024;const SIZE_DANGER_THRESHOLD=200*1024;function formatBytes(r){if(r<1024)return`${r} B`;if(r<1024*1024)return`${(r/1024).toFixed(1)} KB`;return`${(r/(1024*1024)).toFixed(1)} MB`}function createMockEvents(){const r=Date.now();return[{id:"mock-1",source:"storage-async",timestamp:r-2e3,title:"Set Item",subtitle:"user_cart",status:"success",originalEvent:{action:"setItem",key:"user_cart",value:{items:2}}},{id:"mock-2",source:"react-query-query",timestamp:r-1500,title:"cart \u203A items",subtitle:"Fetching...",status:"pending",originalEvent:{type:"query-fetch-start",queryKey:["cart","items"]},correlationId:"rq-query-cart",sequenceInGroup:1},{id:"mock-3",source:"react-query-query",timestamp:r-1e3,title:"cart \u203A items",subtitle:"Success \xB7 500ms",status:"success",originalEvent:{type:"query-fetch-success",queryKey:["cart","items"],data:{items:[]}},correlationId:"rq-query-cart",sequenceInGroup:2},{id:"mock-4",source:"network",timestamp:r-500,title:"POST /api/checkout",subtitle:"402 \xB7 450ms",status:"error",originalEvent:{method:"POST",url:"/api/checkout",status:402,error:"Payment required"}}]}function EventsCopySettingsView({events:r=[],initialSettings:y=_copySettings.DEFAULT_COPY_SETTINGS,onSettingsChange:u}){const{isPro:m}=(0,_sharedUi.useFeatureGate)();const[e,v]=(0,_react.useState)(y);const[E,x]=(0,_react.useState)(false);const[D,h]=(0,_react.useState)(false);(0,_react.useEffect)(()=>{let t=true;(0,_copySettingsStorage.loadCopySettings)().then(i=>{if(t&&i){v(i);u?.(i)}if(t){h(true)}});return()=>{t=false}},[u]);const a=(0,_react.useCallback)(t=>{v(t);u?.(t);(0,_copySettingsStorage.saveCopySettings)(t)},[u]);const n=r.length>0;const o=n?r:createMockEvents();const s=(0,_react.useMemo)(()=>(0,_copySettings.detectActivePreset)(e),[e]);const c=(0,_react.useMemo)(()=>(0,_eventExportFormatter.estimateExportSize)(o,e),[o,e]);const S=(0,_react.useMemo)(()=>{if(c>=SIZE_DANGER_THRESHOLD)return"danger";if(c>=SIZE_WARNING_THRESHOLD)return"warning";return"none"},[c]);const d=(0,_react.useCallback)(()=>{return(0,_eventExportFormatter.generateExport)(o,e)},[o,e]);const T=(0,_react.useCallback)(t=>{const i=_copySettings.COPY_PRESETS[t];a({...i,filterSources:[...i.filterSources]})},[a]);const A=(0,_react.useCallback)((t,i)=>{const[l,p]=t.split("::");if(l==="preset"){T(p);return}if(l==="include"){a({...e,[p]:!e[p]});return}if(l==="format"){a({...e,format:i});return}if(l==="timestamp"){a({...e,timestampFormat:i});return}if(l==="filter"){a({...e,filterMode:i});return}if(l==="threshold"){a({...e,dataSizeThreshold:i});return}},[e,a,T]);const g=(0,_react.useCallback)(()=>{const t=o.length;return(0,_jsxRuntime.jsx)(_sharedUi.ExportPreview,{expanded:E,onExpandedChange:x,summary:`${t} event${t!==1?"s":""} \xB7 ~${formatBytes(c)}${!n?" (mock data)":""}`,warningLevel:S,warningText:{warning:"Large payload - preview may be slow",danger:"Very large payload - may cause performance issues"},testIDs:{expand:`${_testIDs.EVENTS_TEST_ID}-preview-expand`,collapse:`${_testIDs.EVENTS_TEST_ID}-preview-collapse`,summary:`${_testIDs.EVENTS_TEST_ID}-preview-summary`,warning:`${_testIDs.EVENTS_TEST_ID}-preview-size-warning`},renderBody:()=>{const i=d();return e.format==="json"?(0,_jsxRuntime.jsx)(_dataViewer.DataViewer,{testIDPrefix:`${_testIDs.EVENTS_TEST_ID}-preview-json`,data:JSON.parse(i),title:"",showTypeFilter:true,rawMode:true,initialExpanded:true}):(0,_jsxRuntime.jsxs)(_reactNative.View,{children:[e.format==="mermaid"&&(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.mermaidHint,children:"\u{1F4A1} Paste into mermaid.live to visualize"}),(0,_jsxRuntime.jsx)(_reactNative.ScrollView,{style:styles.previewScroll,nestedScrollEnabled:true,testID:`${_testIDs.EVENTS_TEST_ID}-preview-scroll`,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.previewText,selectable:m,testID:`${_testIDs.EVENTS_TEST_ID}-preview-text`,children:i})})]})}})},[E,o,e,c,S,n,d,m]);const f=(0,_react.useCallback)(()=>{const t=(0,_eventExportFormatter.getExportSummary)(o);const i=n?`${t.totalEvents} events`:"Mock data (no events captured)";return(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.statusLabel,testID:`${_testIDs.EVENTS_TEST_ID}-export-status`,children:i}),(0,_jsxRuntime.jsx)(_sharedUi.ToolbarCopyButton,{value:d()})]})},[n,o,d]);const b=(0,_react.useMemo)(()=>({sections:[{id:"presets",title:"Presets",type:"custom",data:[{id:"preset::llm",label:_copySettings.PRESET_METADATA.llm.label,icon:_sharedUi.Zap,color:_copySettings.PRESET_METADATA.llm.color,value:"llm",isActive:s==="llm",description:_copySettings.PRESET_METADATA.llm.description},{id:"preset::bugReport",label:_copySettings.PRESET_METADATA.bugReport.label,icon:_sharedUi.AlertTriangle,color:_copySettings.PRESET_METADATA.bugReport.color,value:"bugReport",isActive:s==="bugReport",description:_copySettings.PRESET_METADATA.bugReport.description},{id:"preset::json",label:_copySettings.PRESET_METADATA.json.label,icon:_sharedUi.FileCode,color:_copySettings.PRESET_METADATA.json.color,value:"json",isActive:s==="json",description:_copySettings.PRESET_METADATA.json.description},{id:"preset::errors",label:_copySettings.PRESET_METADATA.errors.label,icon:_sharedUi.XCircle,color:_copySettings.PRESET_METADATA.errors.color,value:"errors",isActive:s==="errors",description:_copySettings.PRESET_METADATA.errors.description},{id:"preset::minimal",label:_copySettings.PRESET_METADATA.minimal.label,icon:_sharedUi.FileText,color:_copySettings.PRESET_METADATA.minimal.color,value:"minimal",isActive:s==="minimal",description:_copySettings.PRESET_METADATA.minimal.description},{id:"preset::mermaid",label:_copySettings.PRESET_METADATA.mermaid.label,icon:_sharedUi.GitBranch,color:_copySettings.PRESET_METADATA.mermaid.color,value:"mermaid",isActive:s==="mermaid",description:_copySettings.PRESET_METADATA.mermaid.description},{id:"preset::custom",label:"Custom",icon:_sharedUi.Settings,color:_sharedUi.night.color.textSecondary,value:"custom",isActive:s===null,description:"User-configured"}]},{id:"include",title:"Include",type:"custom",data:[{id:"include::includeSource",label:"Source",value:"includeSource",isActive:e.includeSource},{id:"include::includeStatus",label:"Status",value:"includeStatus",isActive:e.includeStatus},{id:"include::includeTitle",label:"Title",value:"includeTitle",isActive:e.includeTitle},{id:"include::includeSubtitle",label:"Subtitle",value:"includeSubtitle",isActive:e.includeSubtitle},{id:"include::includeCorrelation",label:"Correlation",value:"includeCorrelation",isActive:e.includeCorrelation},{id:"include::includeDuration",label:"Duration",value:"includeDuration",isActive:e.includeDuration},{id:"include::includeSummaryHeader",label:"Summary",value:"includeSummaryHeader",isActive:e.includeSummaryHeader},{id:"include::includeEventData",label:"Data",value:"includeEventData",isActive:e.includeEventData}]},{id:"format",title:"Format",type:"custom",data:[{id:"format::markdown",label:"Markdown",icon:_sharedUi.FileText,color:_sharedUi.macOSColors.semantic.info,value:"markdown",isActive:e.format==="markdown"},{id:"format::json",label:"JSON",icon:_sharedUi.FileCode,color:_sharedUi.macOSColors.semantic.warning,value:"json",isActive:e.format==="json"},{id:"format::plaintext",label:"Text",icon:_sharedUi.Hash,color:_sharedUi.night.color.textSecondary,value:"plaintext",isActive:e.format==="plaintext"},{id:"format::mermaid",label:"Diagram",icon:_sharedUi.GitBranch,color:"#A855F7",value:"mermaid",isActive:e.format==="mermaid",description:"Mermaid sequence diagram"}]},{id:"timestamp",title:"Timestamps",type:"custom",data:[{id:"timestamp::relative",label:"Relative",value:"relative",isActive:e.timestampFormat==="relative",description:"+0ms, +150ms"},{id:"timestamp::absolute",label:"Absolute",value:"absolute",isActive:e.timestampFormat==="absolute",description:"ISO format"},{id:"timestamp::both",label:"Both",value:"both",isActive:e.timestampFormat==="both",description:"Both formats"}]},{id:"filter",title:"Filter Events",type:"custom",data:[{id:"filter::all",label:"All",value:"all",isActive:e.filterMode==="all"},{id:"filter::errors",label:"Errors",icon:_sharedUi.XCircle,color:_sharedUi.macOSColors.semantic.error,value:"errors",isActive:e.filterMode==="errors"},{id:"filter::success",label:"Success",color:_sharedUi.macOSColors.semantic.success,value:"success",isActive:e.filterMode==="success"},{id:"filter::pending",label:"Pending",color:_sharedUi.macOSColors.semantic.warning,value:"pending",isActive:e.filterMode==="pending"}]},{id:"llmOptimization",title:"LLM Optimization",type:"custom",data:[{id:"include::compactMode",label:"Compact",value:"compactMode",isActive:e.compactMode,description:"One line per event"},{id:"include::smartJsonParsing",label:"Smart JSON",value:"smartJsonParsing",isActive:e.smartJsonParsing,description:"Parse nested JSON"},{id:"include::reduxChangedOnly",label:"Redux Diff",value:"reduxChangedOnly",isActive:e.reduxChangedOnly,description:"Only show changes"},{id:"include::showStorageDiff",label:"Storage Diff",value:"showStorageDiff",isActive:e.showStorageDiff,description:"Show what changed"},{id:"include::stripVerboseFields",label:"Strip Noise",value:"stripVerboseFields",isActive:e.stripVerboseFields,description:"Remove images/descriptions"}]}],previewSection:{enabled:true,title:"PREVIEW",icon:_sharedUi.Eye,content:g,headerActions:f},onFilterChange:A}),[e,s,A,g,f]);if(!m){return(0,_jsxRuntime.jsxs)(_reactNative.ScrollView,{style:styles.gatedContainer,contentContainerStyle:styles.gatedContent,testID:`${_testIDs.EVENTS_TEST_ID}-copy-settings-gated`,children:[(0,_jsxRuntime.jsx)(_sharedUi.ProFeatureBanner,{featureName:"Events Export",description:"Export event flows to share with your team, debug issues, or feed into AI tools.",benefits:["Export to Markdown, JSON, or plain text","Customizable presets (LLM-ready, Bug Report, JSON)","Share event flows with teammates","Feed event context directly to AI assistants"]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.gatedPreview,children:(0,_jsxRuntime.jsx)(_sharedUi.DynamicFilterView,{...b})})]})}return(0,_jsxRuntime.jsx)(_sharedUi.DynamicFilterView,{...b})}const styles=_reactNative.StyleSheet.create({previewScroll:{maxHeight:300},previewText:{fontFamily:_sharedUi.monoFont,fontSize:11,color:_sharedUi.night.color.text,lineHeight:18},mermaidHint:{fontSize:11,color:_sharedUi.night.color.textSecondary,marginBottom:8,paddingHorizontal:8,paddingVertical:6,backgroundColor:"#A855F715",borderRadius:6,overflow:"hidden"},statusLabel:{fontSize:11,fontWeight:"600",color:_sharedUi.night.color.textTertiary,marginRight:8},gatedContainer:{flex:1},gatedContent:{padding:12,gap:12},gatedPreview:{}});