@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,156 +1 @@
1
- "use strict";
2
-
3
- /**
4
- * UnifiedEventFilters
5
- *
6
- * Filter bar showing toggleable badges for each available event source.
7
- * Badges are sorted: enabled first, disabled last.
8
- * Toggling a badge enables/disables event listening for that source.
9
- *
10
- * Badge layout (inspired by React Query DevTools):
11
- * [subscriber_count] • Label [event_count]
12
- */
13
-
14
- import { View, Text, TouchableOpacity, StyleSheet, ScrollView } from "react-native";
15
- import { memo } from "react";
16
- import { night } from "@buoy-gg/shared-ui";
17
- import { EVENTS_TEST_ID, eventFilterTestID } from "../utils/testIDs";
18
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
19
- export const UnifiedEventFilters = /*#__PURE__*/memo(function UnifiedEventFilters({
20
- availableSources,
21
- onToggleSource,
22
- totalCount,
23
- filteredCount
24
- }) {
25
- if (availableSources.length === 0) {
26
- return null;
27
- }
28
- return /*#__PURE__*/_jsxs(View, {
29
- style: styles.container,
30
- testID: `${EVENTS_TEST_ID}-filter-bar`,
31
- children: [/*#__PURE__*/_jsx(ScrollView, {
32
- horizontal: true,
33
- showsHorizontalScrollIndicator: false,
34
- contentContainerStyle: styles.badgesRow,
35
- testID: `${EVENTS_TEST_ID}-filter-scroll`,
36
- children: availableSources.map(source => {
37
- const isEnabled = source.enabled !== false;
38
- const subscriberCount = source.subscriberCount;
39
- const hasSubscriberTracking = subscriberCount !== undefined;
40
- const eventCount = source.count || 0;
41
- const testID = eventFilterTestID(source.source);
42
- return /*#__PURE__*/_jsxs(TouchableOpacity, {
43
- testID: testID,
44
- accessibilityRole: "button"
45
- // Spelled out, because the chip is a dot, a word and two
46
- // numbers — three of which Fabric merges into the container,
47
- // leaving assistive tech with an unnamed control.
48
- ,
49
- accessibilityLabel: `${source.label} filter, ${isEnabled ? "on" : "off"}, ${eventCount} event${eventCount === 1 ? "" : "s"}`,
50
- style: [styles.badge, isEnabled ? {
51
- backgroundColor: night.color.surface,
52
- borderColor: source.color + "50"
53
- } : styles.badgeDisabled],
54
- onPress: () => onToggleSource(source.source),
55
- activeOpacity: 0.7,
56
- children: [hasSubscriberTracking && /*#__PURE__*/_jsx(View, {
57
- style: [styles.countBadge, {
58
- backgroundColor: isEnabled ? subscriberCount > 0 ? source.color + "25" : night.color.fillSecondary : night.color.fill
59
- }],
60
- children: /*#__PURE__*/_jsx(Text, {
61
- style: [styles.countText, {
62
- color: isEnabled ? subscriberCount > 0 ? source.color : night.color.textTertiary : night.color.textTertiary
63
- }],
64
- testID: `${testID}-subscribers`,
65
- children: subscriberCount
66
- })
67
- }), /*#__PURE__*/_jsx(View, {
68
- style: [styles.dot, {
69
- backgroundColor: isEnabled ? source.color : night.color.fillTertiary
70
- }]
71
- }), /*#__PURE__*/_jsx(Text, {
72
- style: [styles.badgeLabel, {
73
- color: isEnabled ? night.color.text : night.color.textTertiary
74
- }],
75
- numberOfLines: 1,
76
- testID: `${testID}-label`,
77
- children: source.label
78
- }), /*#__PURE__*/_jsx(View, {
79
- style: [styles.countBadge, {
80
- backgroundColor: isEnabled ? eventCount > 0 ? source.color + "20" : night.color.fill : night.color.fill
81
- }],
82
- children: /*#__PURE__*/_jsx(Text, {
83
- style: [styles.countText, {
84
- color: isEnabled ? eventCount > 0 ? source.color : night.color.textTertiary : night.color.textTertiary
85
- }],
86
- testID: `${testID}-count`,
87
- children: eventCount
88
- })
89
- })]
90
- }, source.source);
91
- })
92
- }), filteredCount < totalCount && /*#__PURE__*/_jsxs(Text, {
93
- style: styles.filterInfo,
94
- testID: `${EVENTS_TEST_ID}-showing`,
95
- children: ["Showing ", filteredCount, " of ", totalCount]
96
- })]
97
- });
98
- });
99
- const styles = StyleSheet.create({
100
- container: {
101
- paddingVertical: 8,
102
- // Transparent so the night sheet's star field shows through.
103
- backgroundColor: "transparent",
104
- borderBottomWidth: 1,
105
- borderBottomColor: night.color.border
106
- },
107
- badgesRow: {
108
- flexDirection: "row",
109
- gap: 8,
110
- paddingHorizontal: 12
111
- },
112
- badge: {
113
- flexDirection: "row",
114
- alignItems: "center",
115
- paddingVertical: 5,
116
- paddingHorizontal: 6,
117
- borderRadius: 20,
118
- borderWidth: 1,
119
- gap: 6,
120
- flexShrink: 0
121
- },
122
- badgeDisabled: {
123
- backgroundColor: night.color.surface,
124
- borderColor: night.color.border,
125
- opacity: 0.5
126
- },
127
- dot: {
128
- width: 7,
129
- height: 7,
130
- borderRadius: 4
131
- },
132
- badgeLabel: {
133
- fontSize: 12,
134
- fontWeight: "500"
135
- },
136
- countBadge: {
137
- minWidth: 18,
138
- height: 18,
139
- borderRadius: 9,
140
- alignItems: "center",
141
- justifyContent: "center",
142
- paddingHorizontal: 5
143
- },
144
- countText: {
145
- fontSize: 10,
146
- fontWeight: "600",
147
- fontVariant: ["tabular-nums"]
148
- },
149
- filterInfo: {
150
- marginTop: 6,
151
- fontSize: 11,
152
- color: night.color.textTertiary,
153
- textAlign: "center"
154
- }
155
- });
156
- //# sourceMappingURL=UnifiedEventFilters.js.map
1
+ "use strict";import{View as a,Text as s,TouchableOpacity as m,StyleSheet as x,ScrollView as p}from"react-native";import{memo as T}from"react";import{night as o}from"@buoy-gg/shared-ui";import{EVENTS_TEST_ID as d,eventFilterTestID as I}from"../utils/testIDs";import{jsx as l,jsxs as b}from"react/jsx-runtime";export const UnifiedEventFilters=T(function D({availableSources:f,onToggleSource:u,totalCount:g,filteredCount:h}){if(f.length===0){return null}return b(a,{style:e.container,testID:`${d}-filter-bar`,children:[l(p,{horizontal:true,showsHorizontalScrollIndicator:false,contentContainerStyle:e.badgesRow,testID:`${d}-filter-scroll`,children:f.map(t=>{const r=t.enabled!==false;const n=t.subscriberCount;const y=n!==void 0;const i=t.count||0;const c=I(t.source);return b(m,{testID:c,accessibilityRole:"button",accessibilityLabel:`${t.label} filter, ${r?"on":"off"}, ${i} event${i===1?"":"s"}`,style:[e.badge,r?{backgroundColor:o.color.surface,borderColor:t.color+"50"}:e.badgeDisabled],onPress:()=>u(t.source),activeOpacity:.7,children:[y&&l(a,{style:[e.countBadge,{backgroundColor:r?n>0?t.color+"25":o.color.fillSecondary:o.color.fill}],children:l(s,{style:[e.countText,{color:r?n>0?t.color:o.color.textTertiary:o.color.textTertiary}],testID:`${c}-subscribers`,children:n})}),l(a,{style:[e.dot,{backgroundColor:r?t.color:o.color.fillTertiary}]}),l(s,{style:[e.badgeLabel,{color:r?o.color.text:o.color.textTertiary}],numberOfLines:1,testID:`${c}-label`,children:t.label}),l(a,{style:[e.countBadge,{backgroundColor:r?i>0?t.color+"20":o.color.fill:o.color.fill}],children:l(s,{style:[e.countText,{color:r?i>0?t.color:o.color.textTertiary:o.color.textTertiary}],testID:`${c}-count`,children:i})})]},t.source)})}),h<g&&b(s,{style:e.filterInfo,testID:`${d}-showing`,children:["Showing ",h," of ",g]})]})});const e=x.create({container:{paddingVertical:8,backgroundColor:"transparent",borderBottomWidth:1,borderBottomColor:o.color.border},badgesRow:{flexDirection:"row",gap:8,paddingHorizontal:12},badge:{flexDirection:"row",alignItems:"center",paddingVertical:5,paddingHorizontal:6,borderRadius:20,borderWidth:1,gap:6,flexShrink:0},badgeDisabled:{backgroundColor:o.color.surface,borderColor:o.color.border,opacity:.5},dot:{width:7,height:7,borderRadius:4},badgeLabel:{fontSize:12,fontWeight:"500"},countBadge:{minWidth:18,height:18,borderRadius:9,alignItems:"center",justifyContent:"center",paddingHorizontal:5},countText:{fontSize:10,fontWeight:"600",fontVariant:["tabular-nums"]},filterInfo:{marginTop:6,fontSize:11,color:o.color.textTertiary,textAlign:"center"}});
@@ -1,413 +1 @@
1
- "use strict";
2
-
3
- /**
4
- * UnifiedEventItem
5
- *
6
- * Renders a single event in the unified event timeline.
7
- * Uses shared UI components from other packages when available,
8
- * falls back to generic CompactRow when packages aren't installed.
9
- */
10
-
11
- import { memo } from "react";
12
- import { View, Text, StyleSheet } from "react-native";
13
- import { CompactRow, formatRelativeTime, Pill } from "@buoy-gg/shared-ui";
14
- import { eventRowTestID } from "../utils/testIDs";
15
-
16
- // ============================================================================
17
- // Optional Component Loading
18
- // ============================================================================
19
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
20
- function tryLoadOptionalComponents() {
21
- const components = {
22
- StorageEventCard: null,
23
- getValueType: null,
24
- ReduxActionItem: null,
25
- NetworkEventItemCompact: null,
26
- RouteEventItemCompact: null,
27
- ZustandStateChangeItem: null,
28
- JotaiAtomChangeItem: null
29
- };
30
-
31
- // Try to load storage components
32
- try {
33
- // @ts-ignore - Dynamic import that may not exist
34
- const storage = require("@buoy-gg/storage");
35
- components.StorageEventCard = storage.StorageEventCard;
36
- components.getValueType = storage.getValueType;
37
- } catch {
38
- // Optional dependency not installed
39
- }
40
-
41
- // Try to load redux components
42
- try {
43
- // @ts-ignore - Dynamic import that may not exist
44
- const redux = require("@buoy-gg/redux");
45
- components.ReduxActionItem = redux.ReduxActionItem;
46
- } catch {
47
- // Optional dependency not installed
48
- }
49
-
50
- // Try to load network components
51
- try {
52
- // @ts-ignore - Dynamic import that may not exist
53
- const network = require("@buoy-gg/network");
54
- components.NetworkEventItemCompact = network.NetworkEventItemCompact;
55
- } catch {
56
- // Optional dependency not installed
57
- }
58
-
59
- // Try to load route events components
60
- try {
61
- // @ts-ignore - Dynamic import that may not exist
62
- const routeEvents = require("@buoy-gg/route-events");
63
- components.RouteEventItemCompact = routeEvents.RouteEventItemCompact;
64
- } catch {
65
- // Optional dependency not installed
66
- }
67
-
68
- // Try to load zustand components
69
- try {
70
- // @ts-ignore - Dynamic import that may not exist
71
- const zustand = require("@buoy-gg/zustand");
72
- components.ZustandStateChangeItem = zustand.ZustandStateChangeItem;
73
- } catch {
74
- // Optional dependency not installed
75
- }
76
-
77
- // Try to load jotai components
78
- try {
79
- // @ts-ignore - Dynamic import that may not exist
80
- const jotai = require("@buoy-gg/jotai");
81
- components.JotaiAtomChangeItem = jotai.JotaiAtomChangeItem;
82
- } catch {
83
- // Optional dependency not installed
84
- }
85
- return components;
86
- }
87
-
88
- // Cache loaded components
89
- const optionalComponents = tryLoadOptionalComponents();
90
-
91
- // ============================================================================
92
- // Configuration
93
- // ============================================================================
94
-
95
- /**
96
- * Source configuration for display (used for fallback rendering)
97
- */
98
- const SOURCE_CONFIG = {
99
- "storage-async": {
100
- label: "Storage",
101
- color: "#8B5CF6" // Purple
102
- },
103
- "storage-mmkv": {
104
- label: "MMKV",
105
- color: "#F59E0B" // Orange
106
- },
107
- redux: {
108
- label: "Redux",
109
- color: "#3B82F6" // Blue
110
- },
111
- network: {
112
- label: "Network",
113
- color: "#10B981" // Green
114
- },
115
- "react-query": {
116
- label: "Query",
117
- color: "#EC4899" // Pink (legacy, kept for backwards compatibility)
118
- },
119
- "react-query-query": {
120
- label: "Query",
121
- color: "#EC4899" // Pink
122
- },
123
- "react-query-mutation": {
124
- label: "Mutation",
125
- color: "#F97316" // Orange - distinct from queries
126
- },
127
- route: {
128
- label: "Route",
129
- color: "#06B6D4" // Cyan
130
- },
131
- zustand: {
132
- label: "Zustand",
133
- color: "#764ABC" // Purple
134
- },
135
- jotai: {
136
- label: "Jotai",
137
- color: "#14B8A6" // Teal
138
- },
139
- render: {
140
- label: "Render",
141
- color: "#F472B6" // Pink
142
- }
143
- };
144
-
145
- /**
146
- * Get status color based on event status
147
- */
148
- function getStatusColor(status) {
149
- switch (status) {
150
- case "success":
151
- return "#10B981";
152
- // Green
153
- case "error":
154
- return "#EF4444";
155
- // Red
156
- case "pending":
157
- return "#F59E0B";
158
- // Orange
159
- case "neutral":
160
- default:
161
- return "#6B7280";
162
- // Gray
163
- }
164
- }
165
-
166
- /**
167
- * Check if an event is a storage event
168
- */
169
- function isStorageEvent(source) {
170
- return source === "storage-async" || source === "storage-mmkv";
171
- }
172
-
173
- // ============================================================================
174
- // Component
175
- // ============================================================================
176
-
177
- /**
178
- * Correlation badge component - shows linked event indicator
179
- */
180
- function CorrelationBadge({
181
- label,
182
- color,
183
- testID
184
- }) {
185
- return /*#__PURE__*/_jsx(Pill, {
186
- label: label,
187
- color: color,
188
- variant: "soft",
189
- size: "sm",
190
- style: {
191
- marginLeft: 6
192
- },
193
- testID: testID
194
- });
195
- }
196
-
197
- /**
198
- * Source badge configuration - short labels for top-right badge
199
- * Colors match SOURCE_CONFIG used for filter badges
200
- */
201
- const SOURCE_BADGE_LABELS = {
202
- "storage-async": "STORAGE",
203
- "storage-mmkv": "MMKV",
204
- redux: "REDUX",
205
- network: "NET",
206
- "react-query": "QUERY",
207
- "react-query-query": "QUERY",
208
- "react-query-mutation": "MUTATION",
209
- route: "ROUTE",
210
- zustand: "ZUSTAND",
211
- jotai: "JOTAI",
212
- render: "RENDER"
213
- };
214
-
215
- /**
216
- * Source badge wrapper - adds source type badge to top-right of any card
217
- */
218
- function SourceBadgeWrapper({
219
- source,
220
- testID,
221
- children
222
- }) {
223
- const color = SOURCE_CONFIG[source].color;
224
- const label = SOURCE_BADGE_LABELS[source];
225
- return /*#__PURE__*/_jsxs(View, {
226
- style: styles.badgeWrapper,
227
- testID: testID,
228
- children: [children, /*#__PURE__*/_jsx(View, {
229
- style: [styles.sourceBadge, {
230
- backgroundColor: `${color}20`
231
- }],
232
- children: /*#__PURE__*/_jsx(Text, {
233
- style: [styles.sourceBadgeText, {
234
- color
235
- }],
236
- testID: testID ? `${testID}-badge` : undefined,
237
- children: label
238
- })
239
- })]
240
- });
241
- }
242
- export const UnifiedEventItem = /*#__PURE__*/memo(function UnifiedEventItem({
243
- event,
244
- onPress,
245
- isSelected = false,
246
- isExpanded = false,
247
- onNavigate,
248
- correlationCount = 1,
249
- correlationLabel,
250
- correlationColor
251
- }) {
252
- const sourceConfig = SOURCE_CONFIG[event.source];
253
- const statusColor = getStatusColor(event.status);
254
- const rowTestID = eventRowTestID(event);
255
-
256
- // For storage events, try to use the shared StorageEventCard component
257
- if (isStorageEvent(event.source) && optionalComponents.StorageEventCard && optionalComponents.getValueType) {
258
- const {
259
- StorageEventCard,
260
- getValueType
261
- } = optionalComponents;
262
- const originalEvent = event.originalEvent;
263
- const cardData = {
264
- key: originalEvent.data?.key || "unknown",
265
- lastAction: originalEvent.action,
266
- totalOperations: 1,
267
- lastEventTimestamp: new Date(event.timestamp),
268
- storageTypes: new Set([originalEvent.storageType || "async"]),
269
- valueType: originalEvent.data?.value !== undefined ? getValueType(originalEvent.data.value) : undefined
270
- };
271
- return /*#__PURE__*/_jsx(SourceBadgeWrapper, {
272
- source: event.source,
273
- testID: rowTestID,
274
- children: /*#__PURE__*/_jsx(StorageEventCard, {
275
- data: cardData,
276
- onPress: onPress,
277
- isSelected: isSelected
278
- })
279
- });
280
- }
281
-
282
- // For Redux events, try to use the shared ReduxActionItem component
283
- if (event.source === "redux" && optionalComponents.ReduxActionItem) {
284
- const {
285
- ReduxActionItem
286
- } = optionalComponents;
287
- const reduxAction = event.originalEvent;
288
- return /*#__PURE__*/_jsx(SourceBadgeWrapper, {
289
- source: event.source,
290
- testID: rowTestID,
291
- children: /*#__PURE__*/_jsx(ReduxActionItem, {
292
- action: reduxAction,
293
- onPress: () => onPress()
294
- })
295
- });
296
- }
297
-
298
- // For network events, use the shared NetworkEventItemCompact component
299
- // Note: No SourceBadgeWrapper needed - network card already has its own badges (FETCH, GQL, etc.)
300
- if (event.source === "network" && optionalComponents.NetworkEventItemCompact) {
301
- const {
302
- NetworkEventItemCompact
303
- } = optionalComponents;
304
- const networkEvent = event.originalEvent;
305
- return /*#__PURE__*/_jsx(View, {
306
- testID: rowTestID,
307
- children: /*#__PURE__*/_jsx(NetworkEventItemCompact, {
308
- event: networkEvent,
309
- onPress: () => onPress()
310
- })
311
- });
312
- }
313
-
314
- // For route events, try to use the shared RouteEventItemCompact component
315
- if (event.source === "route" && optionalComponents.RouteEventItemCompact) {
316
- const {
317
- RouteEventItemCompact
318
- } = optionalComponents;
319
- const routeEvent = event.originalEvent;
320
- return /*#__PURE__*/_jsx(SourceBadgeWrapper, {
321
- source: event.source,
322
- testID: rowTestID,
323
- children: /*#__PURE__*/_jsx(RouteEventItemCompact, {
324
- event: routeEvent,
325
- visitNumber: 0,
326
- isExpanded: isExpanded,
327
- onPress: () => onPress(),
328
- onNavigate: onNavigate
329
- })
330
- });
331
- }
332
-
333
- // For Zustand events, try to use the shared ZustandStateChangeItem component
334
- if (event.source === "zustand" && optionalComponents.ZustandStateChangeItem) {
335
- const {
336
- ZustandStateChangeItem
337
- } = optionalComponents;
338
- return /*#__PURE__*/_jsx(SourceBadgeWrapper, {
339
- source: event.source,
340
- testID: rowTestID,
341
- children: /*#__PURE__*/_jsx(ZustandStateChangeItem, {
342
- change: event.originalEvent,
343
- onPress: () => onPress()
344
- })
345
- });
346
- }
347
-
348
- // For Jotai events, try to use the shared JotaiAtomChangeItem component
349
- if (event.source === "jotai" && optionalComponents.JotaiAtomChangeItem) {
350
- const {
351
- JotaiAtomChangeItem
352
- } = optionalComponents;
353
- return /*#__PURE__*/_jsx(SourceBadgeWrapper, {
354
- source: event.source,
355
- testID: rowTestID,
356
- children: /*#__PURE__*/_jsx(JotaiAtomChangeItem, {
357
- change: event.originalEvent,
358
- onPress: () => onPress()
359
- })
360
- });
361
- }
362
-
363
- // Fallback: Use CompactRow for all events when specific components aren't available
364
- const customBadge = correlationLabel && correlationColor ? /*#__PURE__*/_jsx(CorrelationBadge, {
365
- label: correlationLabel,
366
- color: correlationColor,
367
- testID: `${rowTestID}-correlation`
368
- }) : null;
369
- return /*#__PURE__*/_jsx(CompactRow
370
- // Status section - shows source type
371
- , {
372
- statusDotColor: sourceConfig.color,
373
- statusLabel: sourceConfig.label
374
- // Content section - shows event details
375
- ,
376
- primaryText: event.title,
377
- secondaryText: event.subtitle
378
- // Badge section - shows correlation indicator for linked events
379
- ,
380
- badgeText: correlationCount > 1 && !correlationLabel ? `${correlationCount}` : "",
381
- badgeColor: correlationColor || statusColor,
382
- customBadge: customBadge
383
- // Timestamp at bottom right
384
- ,
385
- bottomRightText: formatRelativeTime(new Date(event.timestamp))
386
- // Interaction
387
- ,
388
- showChevron: true,
389
- isSelected: isSelected,
390
- onPress: onPress,
391
- testID: rowTestID
392
- });
393
- });
394
- const styles = StyleSheet.create({
395
- badgeWrapper: {
396
- position: "relative"
397
- },
398
- sourceBadge: {
399
- position: "absolute",
400
- top: 4,
401
- right: 12,
402
- paddingHorizontal: 6,
403
- paddingVertical: 2,
404
- borderRadius: 4,
405
- zIndex: 10
406
- },
407
- sourceBadgeText: {
408
- fontSize: 8,
409
- fontWeight: "700",
410
- letterSpacing: 0.5
411
- }
412
- });
413
- //# sourceMappingURL=UnifiedEventItem.js.map
1
+ "use strict";import{loadToolModule as s,getToolModuleVersion as R}from"@buoy-gg/shared-ui/utils";import{memo as A}from"react";import{View as m,Text as N,StyleSheet as O}from"react-native";import{CompactRow as U,formatRelativeTime as V,Pill as j}from"@buoy-gg/shared-ui";import{eventRowTestID as z}from"../utils/testIDs";import{jsx as o,jsxs as q}from"react/jsx-runtime";function F(){const e={StorageEventCard:null,getValueType:null,ReduxActionItem:null,NetworkEventItemCompact:null,RouteEventItemCompact:null,ZustandStateChangeItem:null,JotaiAtomChangeItem:null};try{const t=s("@buoy-gg/storage");e.StorageEventCard=t.StorageEventCard;e.getValueType=t.getValueType}catch{}try{const t=s("@buoy-gg/redux");e.ReduxActionItem=t.ReduxActionItem}catch{}try{const t=s("@buoy-gg/network");e.NetworkEventItemCompact=t.NetworkEventItemCompact}catch{}try{const t=s("@buoy-gg/route-events");e.RouteEventItemCompact=t.RouteEventItemCompact}catch{}try{const t=s("@buoy-gg/zustand");e.ZustandStateChangeItem=t.ZustandStateChangeItem}catch{}try{const t=s("@buoy-gg/jotai");e.JotaiAtomChangeItem=t.JotaiAtomChangeItem}catch{}return e}let g;let S=-1;function M(){if(!g||S!==R()){g=F();S=R()}return g}const w={"storage-async":{label:"Storage",color:"#8B5CF6"},"storage-mmkv":{label:"MMKV",color:"#F59E0B"},redux:{label:"Redux",color:"#3B82F6"},network:{label:"Network",color:"#10B981"},"react-query":{label:"Query",color:"#EC4899"},"react-query-query":{label:"Query",color:"#EC4899"},"react-query-mutation":{label:"Mutation",color:"#F97316"},route:{label:"Route",color:"#06B6D4"},zustand:{label:"Zustand",color:"#764ABC"},jotai:{label:"Jotai",color:"#14B8A6"},render:{label:"Render",color:"#F472B6"}};function J(e){switch(e){case"success":return"#10B981";case"error":return"#EF4444";case"pending":return"#F59E0B";case"neutral":default:return"#6B7280"}}function Z(e){return e==="storage-async"||e==="storage-mmkv"}function _({label:e,color:t,testID:r}){return o(j,{label:e,color:t,variant:"soft",size:"sm",style:{marginLeft:6},testID:r})}const Q={"storage-async":"STORAGE","storage-mmkv":"MMKV",redux:"REDUX",network:"NET","react-query":"QUERY","react-query-query":"QUERY","react-query-mutation":"MUTATION",route:"ROUTE",zustand:"ZUSTAND",jotai:"JOTAI",render:"RENDER"};function u({source:e,testID:t,children:r}){const c=w[e].color;const l=Q[e];return q(m,{style:p.badgeWrapper,testID:t,children:[r,o(m,{style:[p.sourceBadge,{backgroundColor:`${c}20`}],children:o(N,{style:[p.sourceBadgeText,{color:c}],testID:t?`${t}-badge`:void 0,children:l})})]})}export const UnifiedEventItem=A(function e({event:t,onPress:r,isSelected:c=false,isExpanded:l=false,onNavigate:B,correlationCount:y=1,correlationLabel:i,correlationColor:d}){const{StorageEventCard:E,getValueType:I,ReduxActionItem:C,NetworkEventItemCompact:f,RouteEventItemCompact:h,ZustandStateChangeItem:b,JotaiAtomChangeItem:T}=M();const x=w[t.source];const D=J(t.status);const n=z(t);if(Z(t.source)&&E&&I){const a=t.originalEvent;const k={key:a.data?.key||"unknown",lastAction:a.action,totalOperations:1,lastEventTimestamp:new Date(t.timestamp),storageTypes:new Set([a.storageType||"async"]),valueType:a.data?.value!==void 0?I(a.data.value):void 0};return o(u,{source:t.source,testID:n,children:o(E,{data:k,onPress:r,isSelected:c})})}if(t.source==="redux"&&C){const a=t.originalEvent;return o(u,{source:t.source,testID:n,children:o(C,{action:a,onPress:()=>r()})})}if(t.source==="network"&&f){const a=t.originalEvent;return o(m,{testID:n,children:o(f,{event:a,onPress:()=>r()})})}if(t.source==="route"&&h){const a=t.originalEvent;return o(u,{source:t.source,testID:n,children:o(h,{event:a,visitNumber:0,isExpanded:l,onPress:()=>r(),onNavigate:B})})}if(t.source==="zustand"&&b){return o(u,{source:t.source,testID:n,children:o(b,{change:t.originalEvent,onPress:()=>r()})})}if(t.source==="jotai"&&T){return o(u,{source:t.source,testID:n,children:o(T,{change:t.originalEvent,onPress:()=>r()})})}const v=i&&d?o(_,{label:i,color:d,testID:`${n}-correlation`}):null;return o(U,{statusDotColor:x.color,statusLabel:x.label,primaryText:t.title,secondaryText:t.subtitle,badgeText:y>1&&!i?`${y}`:"",badgeColor:d||D,customBadge:v,bottomRightText:V(new Date(t.timestamp)),showChevron:true,isSelected:c,onPress:r,testID:n})});const p=O.create({badgeWrapper:{position:"relative"},sourceBadge:{position:"absolute",top:4,right:12,paddingHorizontal:6,paddingVertical:2,borderRadius:4,zIndex:10},sourceBadgeText:{fontSize:8,fontWeight:"700",letterSpacing:.5}});