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