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