@buoy-gg/network 7.0.15 → 7.0.16

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 (107) hide show
  1. package/lib/commonjs/index.web.js +395 -0
  2. package/lib/commonjs/network/components/DataViewer.web.js +879 -0
  3. package/lib/commonjs/network/components/NetworkCopyScreen.web.js +48 -0
  4. package/lib/commonjs/network/components/NetworkCopySettingsView.web.js +1242 -0
  5. package/lib/commonjs/network/components/NetworkDetailScreen.web.js +101 -0
  6. package/lib/commonjs/network/components/NetworkDetailStepper.web.js +296 -0
  7. package/lib/commonjs/network/components/NetworkEventDetailView.web.js +1498 -0
  8. package/lib/commonjs/network/components/NetworkEventItemCompact.web.js +802 -0
  9. package/lib/commonjs/network/components/NetworkFilterScreen.web.js +55 -0
  10. package/lib/commonjs/network/components/NetworkFilterViewV3.web.js +1310 -0
  11. package/lib/commonjs/network/components/NetworkHeaderLive.web.js +604 -0
  12. package/lib/commonjs/network/components/NetworkListScreen.js +2 -1
  13. package/lib/commonjs/network/components/NetworkListScreen.web.js +607 -0
  14. package/lib/commonjs/network/components/NetworkModal.js +12 -3
  15. package/lib/commonjs/network/components/NetworkNumberPrompt.web.js +232 -0
  16. package/lib/commonjs/network/components/NetworkOverrideEditor.web.js +942 -0
  17. package/lib/commonjs/network/components/NetworkOverrideHeaderButton.web.js +133 -0
  18. package/lib/commonjs/network/components/NetworkOverridesButton.web.js +143 -0
  19. package/lib/commonjs/network/components/NetworkOverridesScreen.js +160 -126
  20. package/lib/commonjs/network/components/NetworkOverridesScreen.web.js +830 -0
  21. package/lib/commonjs/network/components/NetworkSavedScreen.web.js +459 -0
  22. package/lib/commonjs/network/components/response-editor/Explorer.web.js +1136 -0
  23. package/lib/commonjs/network/hooks/useNetworkEventList.js +12 -2
  24. package/lib/commonjs/network/overrides/applyToXhr.js +276 -15
  25. package/lib/commonjs/network/utils/generateNetworkCopyText.js +32 -5
  26. package/lib/commonjs/network/utils/networkEventStore.js +12 -4
  27. package/lib/commonjs/network/utils/networkListener.js +1 -16
  28. package/lib/module/index.web.js +81 -0
  29. package/lib/module/network/components/DataViewer.web.js +875 -0
  30. package/lib/module/network/components/NetworkCopyScreen.web.js +44 -0
  31. package/lib/module/network/components/NetworkCopySettingsView.web.js +1237 -0
  32. package/lib/module/network/components/NetworkDetailScreen.web.js +97 -0
  33. package/lib/module/network/components/NetworkDetailStepper.web.js +294 -0
  34. package/lib/module/network/components/NetworkEventDetailView.web.js +1496 -0
  35. package/lib/module/network/components/NetworkEventItemCompact.web.js +800 -0
  36. package/lib/module/network/components/NetworkFilterScreen.web.js +51 -0
  37. package/lib/module/network/components/NetworkFilterViewV3.web.js +1306 -0
  38. package/lib/module/network/components/NetworkHeaderLive.web.js +598 -0
  39. package/lib/module/network/components/NetworkListScreen.js +2 -1
  40. package/lib/module/network/components/NetworkListScreen.web.js +605 -0
  41. package/lib/module/network/components/NetworkModal.js +12 -3
  42. package/lib/module/network/components/NetworkNumberPrompt.web.js +230 -0
  43. package/lib/module/network/components/NetworkOverrideEditor.web.js +939 -0
  44. package/lib/module/network/components/NetworkOverrideHeaderButton.web.js +131 -0
  45. package/lib/module/network/components/NetworkOverridesButton.web.js +141 -0
  46. package/lib/module/network/components/NetworkOverridesScreen.js +161 -127
  47. package/lib/module/network/components/NetworkOverridesScreen.web.js +826 -0
  48. package/lib/module/network/components/NetworkSavedScreen.web.js +457 -0
  49. package/lib/module/network/components/response-editor/Explorer.web.js +1133 -0
  50. package/lib/module/network/hooks/useNetworkEventList.js +12 -2
  51. package/lib/module/network/overrides/applyToXhr.js +275 -15
  52. package/lib/module/network/utils/generateNetworkCopyText.js +28 -1
  53. package/lib/module/network/utils/networkEventStore.js +12 -4
  54. package/lib/module/network/utils/networkListener.js +1 -16
  55. package/lib/typescript/index.web.d.ts +56 -0
  56. package/lib/typescript/index.web.d.ts.map +1 -0
  57. package/lib/typescript/network/components/DataViewer.web.d.ts +78 -0
  58. package/lib/typescript/network/components/DataViewer.web.d.ts.map +1 -0
  59. package/lib/typescript/network/components/NetworkCopyScreen.web.d.ts +27 -0
  60. package/lib/typescript/network/components/NetworkCopyScreen.web.d.ts.map +1 -0
  61. package/lib/typescript/network/components/NetworkCopySettingsView.web.d.ts +68 -0
  62. package/lib/typescript/network/components/NetworkCopySettingsView.web.d.ts.map +1 -0
  63. package/lib/typescript/network/components/NetworkDetailScreen.web.d.ts +45 -0
  64. package/lib/typescript/network/components/NetworkDetailScreen.web.d.ts.map +1 -0
  65. package/lib/typescript/network/components/NetworkDetailStepper.web.d.ts +40 -0
  66. package/lib/typescript/network/components/NetworkDetailStepper.web.d.ts.map +1 -0
  67. package/lib/typescript/network/components/NetworkEventDetailView.web.d.ts +67 -0
  68. package/lib/typescript/network/components/NetworkEventDetailView.web.d.ts.map +1 -0
  69. package/lib/typescript/network/components/NetworkEventItemCompact.web.d.ts +58 -0
  70. package/lib/typescript/network/components/NetworkEventItemCompact.web.d.ts.map +1 -0
  71. package/lib/typescript/network/components/NetworkFilterScreen.web.d.ts +28 -0
  72. package/lib/typescript/network/components/NetworkFilterScreen.web.d.ts.map +1 -0
  73. package/lib/typescript/network/components/NetworkFilterViewV3.web.d.ts +74 -0
  74. package/lib/typescript/network/components/NetworkFilterViewV3.web.d.ts.map +1 -0
  75. package/lib/typescript/network/components/NetworkHeaderLive.web.d.ts +112 -0
  76. package/lib/typescript/network/components/NetworkHeaderLive.web.d.ts.map +1 -0
  77. package/lib/typescript/network/components/NetworkListScreen.d.ts.map +1 -1
  78. package/lib/typescript/network/components/NetworkListScreen.web.d.ts +63 -0
  79. package/lib/typescript/network/components/NetworkListScreen.web.d.ts.map +1 -0
  80. package/lib/typescript/network/components/NetworkModal.d.ts.map +1 -1
  81. package/lib/typescript/network/components/NetworkNumberPrompt.web.d.ts +38 -0
  82. package/lib/typescript/network/components/NetworkNumberPrompt.web.d.ts.map +1 -0
  83. package/lib/typescript/network/components/NetworkOverrideEditor.web.d.ts +43 -0
  84. package/lib/typescript/network/components/NetworkOverrideEditor.web.d.ts.map +1 -0
  85. package/lib/typescript/network/components/NetworkOverrideHeaderButton.web.d.ts +32 -0
  86. package/lib/typescript/network/components/NetworkOverrideHeaderButton.web.d.ts.map +1 -0
  87. package/lib/typescript/network/components/NetworkOverridesButton.web.d.ts +26 -0
  88. package/lib/typescript/network/components/NetworkOverridesButton.web.d.ts.map +1 -0
  89. package/lib/typescript/network/components/NetworkOverridesScreen.d.ts +9 -0
  90. package/lib/typescript/network/components/NetworkOverridesScreen.d.ts.map +1 -1
  91. package/lib/typescript/network/components/NetworkOverridesScreen.web.d.ts +69 -0
  92. package/lib/typescript/network/components/NetworkOverridesScreen.web.d.ts.map +1 -0
  93. package/lib/typescript/network/components/NetworkSavedScreen.web.d.ts +67 -0
  94. package/lib/typescript/network/components/NetworkSavedScreen.web.d.ts.map +1 -0
  95. package/lib/typescript/network/components/response-editor/Explorer.web.d.ts +56 -0
  96. package/lib/typescript/network/components/response-editor/Explorer.web.d.ts.map +1 -0
  97. package/lib/typescript/network/hooks/useNetworkEventList.d.ts +10 -0
  98. package/lib/typescript/network/hooks/useNetworkEventList.d.ts.map +1 -1
  99. package/lib/typescript/network/overrides/__tests__/applyToXhr.test.d.ts.map +1 -1
  100. package/lib/typescript/network/overrides/applyToXhr.d.ts +40 -14
  101. package/lib/typescript/network/overrides/applyToXhr.d.ts.map +1 -1
  102. package/lib/typescript/network/utils/generateNetworkCopyText.d.ts +34 -1
  103. package/lib/typescript/network/utils/generateNetworkCopyText.d.ts.map +1 -1
  104. package/lib/typescript/network/utils/networkEventStore.d.ts.map +1 -1
  105. package/lib/typescript/network/utils/networkListener.d.ts +0 -1
  106. package/lib/typescript/network/utils/networkListener.d.ts.map +1 -1
  107. package/package.json +2 -2
@@ -0,0 +1,607 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.NetworkListScreen = NetworkListScreen;
7
+ var _react = require("react");
8
+ var _NetworkEventItemCompact = require("./NetworkEventItemCompact.web");
9
+ var _useNetworkEventList = require("../hooks/useNetworkEventList");
10
+ var _useNetworkSaved = require("../hooks/useNetworkSaved");
11
+ var _useOverrideRules = require("../hooks/useOverrideRules");
12
+ var _matchRule = require("../overrides/matchRule");
13
+ var _withPinnedFirst = require("../utils/withPinnedFirst");
14
+ var _jsxRuntime = require("react/jsx-runtime");
15
+ /**
16
+ * NetworkListScreen.web — DOM twin of NetworkListScreen.tsx.
17
+ *
18
+ * The network tool's LIST screen: owns the event-store subscription, the
19
+ * scrolling list, the OVERRIDDEN and PINNED strips, empty state, disabled
20
+ * banner, and the free-tier locked-history footer. Identical prop contract,
21
+ * hook usage and derivation order as the native file — the data layer is
22
+ * REUSED, not forked (`useNetworkEventList`, `useNetworkSaved`,
23
+ * `useOverrideRules`, `ruleMatches`, `splitPinned` are all platform-free).
24
+ *
25
+ * Stable-tree contract (rule4): hooks run unconditionally, then the
26
+ * component returns null when not visible. The subscription is gated with
27
+ * `paused || !visible` so a hidden list doesn't subscribe at all.
28
+ *
29
+ * shared-ui RN chrome is replicated as DOM with provenance (web consumers
30
+ * resolve `@buoy-gg/shared-ui` to a minimal shim):
31
+ * - `macOSColors` / `buoyColors` — inlined verbatim subsets from
32
+ * shared/src/ui/gameUI/constants/.
33
+ * - Icons — inline lucide SVGs (shared-ui's icons are lucide re-exports).
34
+ * - `NetworkUpgradeBanner` (which itself leans on shared-ui `ProBadge` +
35
+ * `Zap`) — inlined DOM twin below, values from
36
+ * NetworkUpgradeBanner.tsx + license/FeatureGate.tsx `proBadge` styles.
37
+ *
38
+ * Intentional deviations (all logged):
39
+ * - FlatList virtualization → a plain scrolled div. The store caps at 500
40
+ * events and web rows are cheap DOM; the window/batch tuning the native
41
+ * list carries is a FlatList-only concern.
42
+ * (`extraData={savedLiveIds}` is likewise moot — plain `map` has no
43
+ * PureComponent bail-out to bust.)
44
+ * - The upgrade banner's `ProBadge` renders the static gold "PRO" — the
45
+ * Weekend Pass variant reads `useProAccess` from @buoy-gg/license, which
46
+ * is not part of the web port.
47
+ * - `onEventPress` opens the detail view (ported in F3 as
48
+ * NetworkEventDetailView.web / NetworkDetailScreen.web) — callers wire the
49
+ * prop to `networkSelectionStore.select`, the screen just calls it
50
+ * (native behavior; nothing stubbed here).
51
+ * - Native's row tap opens the detail view and long-press toggles the pin;
52
+ * both are wired identically here (long-press = 500ms pointer hold, see
53
+ * NetworkEventItemCompact.web).
54
+ *
55
+ * F4 integration point: `ignoredPatterns` is a prop (same as native). The
56
+ * native root feeds it from shared-ui's persisted `useIgnoredPatterns` store,
57
+ * which the web shim does not expose — web hosts pass `[]` until the filter
58
+ * feature lands.
59
+ *
60
+ * @platform React DOM Web
61
+ */
62
+
63
+ // =============================
64
+ // Native palettes (provenance)
65
+ // =============================
66
+
67
+ /** macOSColors subset — shared/src/ui/gameUI/constants/macOSDesignSystemColors.ts, verbatim. */const macOSColors = {
68
+ background: {
69
+ card: "#1A1A1C"
70
+ },
71
+ border: {
72
+ default: "#2D2D2F"
73
+ },
74
+ text: {
75
+ primary: "#F5F5F7",
76
+ muted: "#8E8E93"
77
+ },
78
+ semantic: {
79
+ warning: "#FFEB3B",
80
+ warningBackground: "rgba(255, 235, 59, 0.15)",
81
+ info: "#00B8E6"
82
+ }
83
+ };
84
+
85
+ /** buoyColors subset — shared/src/ui/gameUI/constants/gameUIColors.ts (macOS theme), verbatim. */
86
+ const buoy = {
87
+ card: "#1A1A1A",
88
+ text: "#E0E0E0",
89
+ textMuted: "#888888",
90
+ primary: "#20C997"
91
+ };
92
+
93
+ // =============================
94
+ // Inline lucide icons (shared-ui icons are lucide re-exports)
95
+ // =============================
96
+
97
+ function Svg({
98
+ size = 14,
99
+ color = "currentColor",
100
+ children
101
+ }) {
102
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("svg", {
103
+ width: size,
104
+ height: size,
105
+ viewBox: "0 0 24 24",
106
+ fill: "none",
107
+ stroke: color,
108
+ strokeWidth: 2,
109
+ strokeLinecap: "round",
110
+ strokeLinejoin: "round",
111
+ style: {
112
+ flexShrink: 0,
113
+ display: "block"
114
+ },
115
+ children: children
116
+ });
117
+ }
118
+ const Globe = p => /*#__PURE__*/(0, _jsxRuntime.jsxs)(Svg, {
119
+ ...p,
120
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("circle", {
121
+ cx: "12",
122
+ cy: "12",
123
+ r: "10"
124
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
125
+ d: "M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"
126
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
127
+ d: "M2 12h20"
128
+ })]
129
+ });
130
+ const Pin = p => /*#__PURE__*/(0, _jsxRuntime.jsxs)(Svg, {
131
+ ...p,
132
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
133
+ d: "M12 17v5"
134
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
135
+ d: "M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V6h1a2 2 0 0 0 0-4H8a2 2 0 0 0 0 4h1z"
136
+ })]
137
+ });
138
+ const Power = p => /*#__PURE__*/(0, _jsxRuntime.jsxs)(Svg, {
139
+ ...p,
140
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
141
+ d: "M12 2v10"
142
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
143
+ d: "M18.4 6.6a9 9 0 1 1-12.77.04"
144
+ })]
145
+ });
146
+ const FlaskConical = p => /*#__PURE__*/(0, _jsxRuntime.jsxs)(Svg, {
147
+ ...p,
148
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
149
+ d: "M10 2v7.527a2 2 0 0 1-.211.896L4.72 20.55a1 1 0 0 0 .9 1.45h12.76a1 1 0 0 0 .9-1.45l-5.069-10.127A2 2 0 0 1 14 9.527V2"
150
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
151
+ d: "M8.5 2h7"
152
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
153
+ d: "M7 16h10"
154
+ })]
155
+ });
156
+ const Zap = p => /*#__PURE__*/(0, _jsxRuntime.jsx)(Svg, {
157
+ ...p,
158
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("polygon", {
159
+ points: "13 2 3 14 12 14 11 22 21 10 12 10 13 2"
160
+ })
161
+ });
162
+
163
+ // =============================
164
+ // NetworkUpgradeBanner DOM twin (provenance: NetworkUpgradeBanner.tsx +
165
+ // license/FeatureGate.tsx proBadge styles; ProBadge is static "PRO" — see
166
+ // the deviations log)
167
+ // =============================
168
+
169
+ function NetworkUpgradeBannerWeb({
170
+ title,
171
+ subtitle,
172
+ onPress
173
+ }) {
174
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)("button", {
175
+ type: "button",
176
+ style: styles.upgradeBanner,
177
+ onClick: onPress,
178
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
179
+ style: styles.upgradeContent,
180
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
181
+ style: styles.upgradeLeft,
182
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(Zap, {
183
+ size: 16,
184
+ color: buoy.primary
185
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
186
+ style: styles.upgradeTitle,
187
+ children: title
188
+ })]
189
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
190
+ style: styles.proBadge,
191
+ children: "PRO"
192
+ })]
193
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
194
+ style: styles.upgradeSubtitle,
195
+ children: subtitle
196
+ })]
197
+ });
198
+ }
199
+
200
+ // =============================
201
+ // Screen (structure mirrors the native file 1:1)
202
+ // =============================
203
+
204
+ function EmptyState({
205
+ isEnabled
206
+ }) {
207
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
208
+ style: styles.emptyState,
209
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(Globe, {
210
+ size: 32,
211
+ color: macOSColors.text.muted
212
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
213
+ style: styles.emptyTitle,
214
+ children: "No network events"
215
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
216
+ style: styles.emptyText,
217
+ children: isEnabled ? "Network requests will appear here" : "Enable interception to start capturing"
218
+ })]
219
+ });
220
+ }
221
+
222
+ /**
223
+ * The PINNED strip above the live list. Renders OUTSIDE the scrolled list on
224
+ * purpose — pins ignore the filters, are bounded at MAX_PINNED in the store,
225
+ * and keeping them out of the list keeps the boundary from moving as events
226
+ * arrive (same rationale as native).
227
+ */
228
+ function PinnedSection({
229
+ events,
230
+ onEventPress,
231
+ onLongPress,
232
+ savedLiveIds,
233
+ onClearPinned
234
+ }) {
235
+ if (events.length === 0) return null;
236
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
237
+ style: styles.pinnedSection,
238
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
239
+ style: styles.pinnedHeader,
240
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(Pin, {
241
+ size: 11,
242
+ color: macOSColors.semantic.info
243
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
244
+ style: styles.pinnedTitle,
245
+ children: ["PINNED \xB7 ", events.length]
246
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
247
+ type: "button",
248
+ onClick: onClearPinned,
249
+ style: styles.pinnedClear,
250
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
251
+ style: styles.pinnedClearText,
252
+ children: "Unpin all"
253
+ })
254
+ })]
255
+ }), events.map(event => /*#__PURE__*/(0, _jsxRuntime.jsx)(_NetworkEventItemCompact.NetworkEventItemCompact, {
256
+ event: event,
257
+ onPress: onEventPress,
258
+ onLongPress: onLongPress,
259
+ pinned: true,
260
+ saved: savedLiveIds.has(event.id)
261
+ }, event.id))]
262
+ });
263
+ }
264
+
265
+ /**
266
+ * The OVERRIDDEN strip, above the pins. Rows are matched against the RULES
267
+ * rather than filtered on the `override` mark, and the header button is
268
+ * PAUSE, not "Manage" — same reasoning as native (see NetworkListScreen.tsx).
269
+ */
270
+ function OverriddenSection({
271
+ events,
272
+ onEventPress,
273
+ onLongPress,
274
+ savedLiveIds,
275
+ paused,
276
+ onTogglePaused
277
+ }) {
278
+ if (events.length === 0) return null;
279
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
280
+ style: {
281
+ ...styles.overriddenSection,
282
+ ...(paused ? styles.overriddenSectionOff : null)
283
+ },
284
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
285
+ style: styles.overriddenHeader,
286
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(FlaskConical, {
287
+ size: 11,
288
+ color: paused ? macOSColors.text.muted : macOSColors.semantic.warning
289
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
290
+ style: {
291
+ ...styles.overriddenTitle,
292
+ ...(paused ? styles.overriddenTitleOff : null)
293
+ },
294
+ children: paused ? `PAUSED · ${events.length}` : `OVERRIDDEN · ${events.length}`
295
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
296
+ type: "button",
297
+ onClick: onTogglePaused,
298
+ style: styles.overriddenManage,
299
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
300
+ style: {
301
+ ...styles.overriddenManageText,
302
+ ...(paused ? styles.overriddenTitleOff : null)
303
+ },
304
+ children: paused ? "Resume" : "Pause"
305
+ })
306
+ })]
307
+ }), events.map(event => /*#__PURE__*/(0, _jsxRuntime.jsx)(_NetworkEventItemCompact.NetworkEventItemCompact, {
308
+ event: event,
309
+ onPress: onEventPress,
310
+ onLongPress: onLongPress,
311
+ overridden: true,
312
+ saved: savedLiveIds.has(event.id)
313
+ }, event.id))]
314
+ });
315
+ }
316
+ function NetworkListScreen({
317
+ visible,
318
+ paused,
319
+ filter,
320
+ ignoredPatterns,
321
+ isPro,
322
+ searchText,
323
+ onEventPress,
324
+ onUpgradePress
325
+ }) {
326
+ const {
327
+ visibleEvents,
328
+ hasLockedEvents,
329
+ lockedEventCount
330
+ } = (0, _useNetworkEventList.useNetworkEventList)({
331
+ filter,
332
+ ignoredPatterns,
333
+ paused: paused || !visible,
334
+ isPro
335
+ });
336
+
337
+ // Pins come from the persisted saved store, NOT from the live list — that is
338
+ // what lets a pinned failure survive Clear, the 500-event cap and a reload.
339
+ const {
340
+ pinnedEvents,
341
+ pinnedLiveIds,
342
+ savedLiveIds,
343
+ togglePin,
344
+ clearPinned
345
+ } = (0, _useNetworkSaved.useNetworkSaved)();
346
+
347
+ // Which rules are live right now — the strip below reflects the rules, not
348
+ // the history, so it's correct the moment a rule is made or removed.
349
+ const {
350
+ rules,
351
+ enabled: overridesEnabled,
352
+ setEnabled,
353
+ isRuleSpent
354
+ } = (0, _useOverrideRules.useOverrideRules)();
355
+
356
+ // Stable identity: handed to memoized rows.
357
+ const handleLongPress = (0, _react.useCallback)(event => {
358
+ togglePin(event);
359
+ }, [togglePin]);
360
+
361
+ // Everything above is a hook and must run unconditionally; everything below
362
+ // is work (same rule4 contract as native).
363
+ if (!visible) return null;
364
+ const {
365
+ pinned,
366
+ rest
367
+ } = (0, _withPinnedFirst.splitPinned)(visibleEvents, pinnedEvents, pinnedLiveIds);
368
+
369
+ // Hoist anything an active rule covers. Done after `splitPinned` so a request
370
+ // that is both pinned and overridden appears once, in the louder section.
371
+ const activeRules = rules.filter(rule => rule.enabled && !isRuleSpent(rule));
372
+ const isOverridden = event => activeRules.some(rule => (0, _matchRule.ruleMatches)(rule, event.url, String(event.method || "GET")));
373
+ const overridden = activeRules.length ? [...pinned, ...rest].filter(isOverridden) : [];
374
+ const overriddenIds = new Set(overridden.map(event => event.id));
375
+ const pinnedRows = pinned.filter(event => !overriddenIds.has(event.id));
376
+ const restRows = overriddenIds.size ? rest.filter(event => !overriddenIds.has(event.id)) : rest;
377
+ const isEnabled = !paused;
378
+ const renderListFooter = () => {
379
+ if (!hasLockedEvents) return null;
380
+ const isSearching = searchText.length > 0;
381
+ const bannerText = isSearching ? `${lockedEventCount} matching ${lockedEventCount === 1 ? "request" : "requests"} in locked history` : `${lockedEventCount} requests locked`;
382
+ const subtextMessage = isSearching ? "Upgrade to Pro to search your full request history" : "Upgrade to Pro to unlock full request history";
383
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(NetworkUpgradeBannerWeb, {
384
+ title: bannerText,
385
+ subtitle: subtextMessage,
386
+ onPress: onUpgradePress
387
+ });
388
+ };
389
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
390
+ style: styles.root,
391
+ children: [!isEnabled ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
392
+ style: styles.disabledBanner,
393
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(Power, {
394
+ size: 14,
395
+ color: macOSColors.semantic.warning
396
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
397
+ style: styles.disabledText,
398
+ children: "Network interception is disabled"
399
+ })]
400
+ }) : null, /*#__PURE__*/(0, _jsxRuntime.jsx)(OverriddenSection, {
401
+ events: overridden,
402
+ onEventPress: onEventPress,
403
+ onLongPress: handleLongPress,
404
+ savedLiveIds: savedLiveIds,
405
+ paused: !overridesEnabled,
406
+ onTogglePaused: () => setEnabled(!overridesEnabled)
407
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(PinnedSection, {
408
+ events: pinnedRows,
409
+ onEventPress: onEventPress,
410
+ onLongPress: handleLongPress,
411
+ savedLiveIds: savedLiveIds,
412
+ onClearPinned: clearPinned
413
+ }), restRows.length > 0 || hasLockedEvents ?
414
+ /*#__PURE__*/
415
+ // DEVIATION: FlatList → plain scrolled div (see file header). The
416
+ // list still OWNS scrolling — hosts render this screen without a
417
+ // scroll wrapper (JsModal's `disableScrollWrapper`), same as native.
418
+ (0, _jsxRuntime.jsx)("div", {
419
+ style: styles.list,
420
+ "aria-label": "Network events list",
421
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
422
+ style: styles.listContent,
423
+ children: [restRows.map(item => /*#__PURE__*/(0, _jsxRuntime.jsx)(_NetworkEventItemCompact.NetworkEventItemCompact, {
424
+ event: item,
425
+ onPress: onEventPress,
426
+ onLongPress: handleLongPress,
427
+ saved: savedLiveIds.has(item.id)
428
+ }, item.id)), renderListFooter()]
429
+ })
430
+ }) : pinnedRows.length > 0 || overridden.length > 0 ? null : /*#__PURE__*/(0, _jsxRuntime.jsx)(EmptyState, {
431
+ isEnabled: isEnabled
432
+ })]
433
+ });
434
+ }
435
+
436
+ // Values mirror the native StyleSheet block 1:1.
437
+ const styles = {
438
+ root: {
439
+ display: "flex",
440
+ flexDirection: "column",
441
+ flex: 1,
442
+ minHeight: 0
443
+ },
444
+ /**
445
+ * The strip is separated from the live list by a real rule, not just space:
446
+ * these rows do NOT obey the filters, and the boundary is what tells the
447
+ * user why a request they just filtered out is still on screen.
448
+ */
449
+ overriddenSection: {
450
+ borderBottom: `1px solid ${macOSColors.semantic.warning}44`,
451
+ backgroundColor: macOSColors.semantic.warningBackground
452
+ },
453
+ overriddenSectionOff: {
454
+ borderBottom: `1px solid ${macOSColors.border.default}`,
455
+ backgroundColor: macOSColors.background.card
456
+ },
457
+ overriddenTitleOff: {
458
+ color: macOSColors.text.muted
459
+ },
460
+ overriddenHeader: {
461
+ display: "flex",
462
+ flexDirection: "row",
463
+ alignItems: "center",
464
+ gap: 6,
465
+ padding: "8px 12px 4px"
466
+ },
467
+ overriddenTitle: {
468
+ flex: 1,
469
+ fontSize: 10,
470
+ fontWeight: 700,
471
+ letterSpacing: 0.8,
472
+ color: macOSColors.semantic.warning
473
+ },
474
+ overriddenManage: {
475
+ padding: "2px 6px",
476
+ background: "none",
477
+ border: "none",
478
+ cursor: "pointer",
479
+ margin: 0
480
+ },
481
+ overriddenManageText: {
482
+ fontSize: 10,
483
+ fontWeight: 600,
484
+ color: macOSColors.semantic.warning
485
+ },
486
+ pinnedSection: {
487
+ borderBottom: `1px solid ${macOSColors.border.default}`,
488
+ paddingBottom: 4
489
+ },
490
+ pinnedHeader: {
491
+ display: "flex",
492
+ flexDirection: "row",
493
+ alignItems: "center",
494
+ gap: 6,
495
+ padding: "10px 20px 6px"
496
+ },
497
+ pinnedTitle: {
498
+ flex: 1,
499
+ color: macOSColors.semantic.info,
500
+ fontSize: 10,
501
+ fontWeight: 700,
502
+ letterSpacing: 0.6,
503
+ fontFamily: "ui-monospace, Menlo, monospace"
504
+ },
505
+ pinnedClear: {
506
+ padding: "2px 6px",
507
+ background: "none",
508
+ border: "none",
509
+ cursor: "pointer",
510
+ margin: 0
511
+ },
512
+ pinnedClearText: {
513
+ color: macOSColors.text.muted,
514
+ fontSize: 10
515
+ },
516
+ disabledBanner: {
517
+ display: "flex",
518
+ flexDirection: "row",
519
+ alignItems: "center",
520
+ gap: 8,
521
+ padding: 10,
522
+ margin: "8px 12px 0",
523
+ backgroundColor: macOSColors.semantic.warningBackground,
524
+ borderRadius: 8,
525
+ border: `1px solid ${macOSColors.semantic.warning}20`
526
+ },
527
+ disabledText: {
528
+ color: macOSColors.semantic.warning,
529
+ fontSize: 11,
530
+ flex: 1
531
+ },
532
+ list: {
533
+ flex: 1,
534
+ minHeight: 0,
535
+ overflowY: "auto"
536
+ },
537
+ listContent: {
538
+ paddingTop: 8
539
+ },
540
+ emptyState: {
541
+ display: "flex",
542
+ flexDirection: "column",
543
+ alignItems: "center",
544
+ padding: "40px 0"
545
+ },
546
+ emptyTitle: {
547
+ color: macOSColors.text.primary,
548
+ fontSize: 14,
549
+ fontWeight: 600,
550
+ marginTop: 12,
551
+ marginBottom: 6
552
+ },
553
+ emptyText: {
554
+ color: macOSColors.text.muted,
555
+ fontSize: 12,
556
+ textAlign: "center"
557
+ },
558
+ // NetworkUpgradeBanner.tsx values (buoyColors), verbatim.
559
+ upgradeBanner: {
560
+ display: "block",
561
+ width: "calc(100% - 24px)",
562
+ boxSizing: "border-box",
563
+ backgroundColor: buoy.card,
564
+ borderRadius: 10,
565
+ border: `1px solid ${buoy.primary}40`,
566
+ padding: 12,
567
+ margin: "12px 12px 34px",
568
+ textAlign: "left",
569
+ cursor: "pointer",
570
+ fontFamily: "inherit"
571
+ },
572
+ upgradeContent: {
573
+ display: "flex",
574
+ flexDirection: "row",
575
+ alignItems: "center",
576
+ justifyContent: "space-between",
577
+ marginBottom: 4
578
+ },
579
+ upgradeLeft: {
580
+ display: "inline-flex",
581
+ flexDirection: "row",
582
+ alignItems: "center",
583
+ gap: 8
584
+ },
585
+ upgradeTitle: {
586
+ color: buoy.text,
587
+ fontSize: 13,
588
+ fontWeight: 600
589
+ },
590
+ upgradeSubtitle: {
591
+ display: "block",
592
+ color: buoy.textMuted,
593
+ fontSize: 11
594
+ },
595
+ // license/FeatureGate.tsx `proBadge`/`proBadgeText`, verbatim.
596
+ proBadge: {
597
+ display: "inline-flex",
598
+ backgroundColor: `${buoy.primary}15`,
599
+ borderRadius: 4,
600
+ border: `1px solid ${buoy.primary}40`,
601
+ padding: "2px 6px",
602
+ fontSize: 10,
603
+ fontWeight: 700,
604
+ color: buoy.primary,
605
+ letterSpacing: 0.5
606
+ }
607
+ };
@@ -125,7 +125,8 @@ function NetworkFilterScreen({
125
125
  } = (0, _useNetworkEventList.useNetworkEventList)({
126
126
  filter,
127
127
  ignoredPatterns,
128
- paused: paused || !visible,
128
+ paused,
129
+ visible,
129
130
  isPro
130
131
  });
131
132
  if (!visible) return null;
@@ -153,7 +154,8 @@ function NetworkCopyScreen({
153
154
  } = (0, _useNetworkEventList.useNetworkEventList)({
154
155
  filter,
155
156
  ignoredPatterns,
156
- paused: paused || !visible,
157
+ paused,
158
+ visible,
157
159
  isPro
158
160
  });
159
161
  if (!visible) return null;
@@ -327,6 +329,11 @@ function NetworkModalInner({
327
329
  // Stable identity: the Overrides screen adopts the draft in an effect keyed
328
330
  // on both, so an unstable callback would re-run it every render.
329
331
  const handlePendingOverrideConsumed = (0, _react.useCallback)(() => setPendingOverrideDraft(null), []);
332
+
333
+ // Non-null while the Overrides screen has its rule editor open — the editor
334
+ // is that screen's own state, so the header asks it first before popping the
335
+ // whole screen. See the prop's comment on NetworkOverridesScreen.
336
+ const overridesBackRef = (0, _react.useRef)(null);
330
337
  const handleSearch = text => {
331
338
  setSearchText(text);
332
339
  setFilter(prev => ({
@@ -406,6 +413,7 @@ function NetworkModalInner({
406
413
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_sharedUi.ModalHeader, {
407
414
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.ModalHeader.Navigation, {
408
415
  onBack: () => {
416
+ if (overridesBackRef.current?.()) return;
409
417
  setShowOverridesView(false);
410
418
  setPendingOverrideDraft(null);
411
419
  }
@@ -556,7 +564,8 @@ function NetworkModalInner({
556
564
  isPro: isPro,
557
565
  onUpgradePress: () => showUpgrade("overrides"),
558
566
  pendingDraft: pendingOverrideDraft,
559
- onPendingConsumed: handlePendingOverrideConsumed
567
+ onPendingConsumed: handlePendingOverrideConsumed,
568
+ backHandlerRef: overridesBackRef
560
569
  // Inline (desktop panel) has no home indicator to clear.
561
570
  ,
562
571
  applySafeAreaInset: !inline && modalMode === "bottomSheet"