@buoy-gg/network 7.0.41 → 7.0.43

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (272) hide show
  1. package/README.md +11 -85
  2. package/lib/commonjs/index.js +1 -332
  3. package/lib/commonjs/index.web.js +1 -420
  4. package/lib/commonjs/network/components/DataViewer.web.js +1 -879
  5. package/lib/commonjs/network/components/NetworkCopyScreen.web.js +1 -48
  6. package/lib/commonjs/network/components/NetworkCopySettingsView.js +27 -755
  7. package/lib/commonjs/network/components/NetworkCopySettingsView.web.js +14 -1242
  8. package/lib/commonjs/network/components/NetworkDetailScreen.web.js +1 -101
  9. package/lib/commonjs/network/components/NetworkDetailStepper.js +1 -108
  10. package/lib/commonjs/network/components/NetworkDetailStepper.web.js +1 -298
  11. package/lib/commonjs/network/components/NetworkEventDetailView.js +15 -1130
  12. package/lib/commonjs/network/components/NetworkEventDetailView.web.js +15 -1484
  13. package/lib/commonjs/network/components/NetworkEventItemCompact.js +2 -401
  14. package/lib/commonjs/network/components/NetworkEventItemCompact.web.js +2 -820
  15. package/lib/commonjs/network/components/NetworkFilterScreen.web.js +1 -55
  16. package/lib/commonjs/network/components/NetworkFilterViewV3.js +1 -442
  17. package/lib/commonjs/network/components/NetworkFilterViewV3.web.js +1 -1310
  18. package/lib/commonjs/network/components/NetworkHeaderLive.js +1 -375
  19. package/lib/commonjs/network/components/NetworkHeaderLive.web.js +1 -623
  20. package/lib/commonjs/network/components/NetworkHeaderMenu.js +1 -190
  21. package/lib/commonjs/network/components/NetworkListScreen.js +1 -403
  22. package/lib/commonjs/network/components/NetworkListScreen.web.js +1 -624
  23. package/lib/commonjs/network/components/NetworkModal.js +1 -786
  24. package/lib/commonjs/network/components/NetworkNumberPrompt.js +1 -178
  25. package/lib/commonjs/network/components/NetworkNumberPrompt.web.js +1 -232
  26. package/lib/commonjs/network/components/NetworkOverrideEditor.js +1 -814
  27. package/lib/commonjs/network/components/NetworkOverrideEditor.web.js +1 -942
  28. package/lib/commonjs/network/components/NetworkOverrideHeaderButton.js +1 -107
  29. package/lib/commonjs/network/components/NetworkOverrideHeaderButton.web.js +1 -133
  30. package/lib/commonjs/network/components/NetworkOverridesButton.js +1 -90
  31. package/lib/commonjs/network/components/NetworkOverridesButton.web.js +1 -143
  32. package/lib/commonjs/network/components/NetworkOverridesScreen.js +1 -543
  33. package/lib/commonjs/network/components/NetworkOverridesScreen.web.js +1 -830
  34. package/lib/commonjs/network/components/NetworkSavedScreen.js +1 -226
  35. package/lib/commonjs/network/components/NetworkSavedScreen.web.js +1 -463
  36. package/lib/commonjs/network/components/NetworkUpgradeBanner.js +1 -76
  37. package/lib/commonjs/network/components/response-editor/Explorer.js +1 -973
  38. package/lib/commonjs/network/components/response-editor/Explorer.web.js +1 -1136
  39. package/lib/commonjs/network/components/response-editor/deleteNestedDataByPath.js +1 -56
  40. package/lib/commonjs/network/components/response-editor/editorContext.js +1 -33
  41. package/lib/commonjs/network/components/response-editor/updateNestedDataByPath.js +1 -61
  42. package/lib/commonjs/network/conditions/NetworkConditionsControl.js +1 -235
  43. package/lib/commonjs/network/conditions/NetworkConditionsControl.test.js +1 -136
  44. package/lib/commonjs/network/conditions/NetworkConditionsIcon.js +1 -33
  45. package/lib/commonjs/network/conditions/NetworkFloatingTool.js +1 -310
  46. package/lib/commonjs/network/conditions/NetworkFloatingTool.test.js +1 -219
  47. package/lib/commonjs/network/conditions/store.js +1 -75
  48. package/lib/commonjs/network/conditions/wait.js +1 -43
  49. package/lib/commonjs/network/conditions/xhr.js +1 -135
  50. package/lib/commonjs/network/hooks/useLiveNetworkEvent.js +1 -62
  51. package/lib/commonjs/network/hooks/useNetworkBadgeCounts.js +1 -83
  52. package/lib/commonjs/network/hooks/useNetworkEventList.js +1 -108
  53. package/lib/commonjs/network/hooks/useNetworkEvents.js +1 -318
  54. package/lib/commonjs/network/hooks/useNetworkHasMatches.js +1 -56
  55. package/lib/commonjs/network/hooks/useNetworkSaved.js +1 -38
  56. package/lib/commonjs/network/hooks/useNetworkSelection.js +1 -53
  57. package/lib/commonjs/network/hooks/useOverrideRules.js +1 -36
  58. package/lib/commonjs/network/hooks/useTickEveryMinute.js +1 -21
  59. package/lib/commonjs/network/overrides/applyToFetch.js +1 -80
  60. package/lib/commonjs/network/overrides/applyToXhr.js +2 -510
  61. package/lib/commonjs/network/overrides/engine.js +1 -93
  62. package/lib/commonjs/network/overrides/matchRule.js +1 -87
  63. package/lib/commonjs/network/overrides/overriddenRows.js +1 -37
  64. package/lib/commonjs/network/overrides/overrideRulesStore.js +1 -550
  65. package/lib/commonjs/network/overrides/presets.js +1 -70
  66. package/lib/commonjs/network/overrides/resolveOverride.js +1 -158
  67. package/lib/commonjs/network/overrides/types.js +1 -90
  68. package/lib/commonjs/network/sync/networkBodyResolver.js +1 -39
  69. package/lib/commonjs/network/sync/networkSyncAdapter.js +1 -882
  70. package/lib/commonjs/network/sync/overrideHonesty.release.test.js +1 -36
  71. package/lib/commonjs/network/types/index.js +1 -5
  72. package/lib/commonjs/network/utils/extractOperationName.js +1 -80
  73. package/lib/commonjs/network/utils/filterNetworkEvents.js +1 -96
  74. package/lib/commonjs/network/utils/formatGraphQLVariables.js +1 -219
  75. package/lib/commonjs/network/utils/formatting.js +1 -30
  76. package/lib/commonjs/network/utils/generateCurl.js +2 -71
  77. package/lib/commonjs/network/utils/generateNetworkCopyText.js +37 -166
  78. package/lib/commonjs/network/utils/httpCompletion.js +1 -37
  79. package/lib/commonjs/network/utils/networkEventStore.js +1 -411
  80. package/lib/commonjs/network/utils/networkListener.js +4 -1352
  81. package/lib/commonjs/network/utils/networkSavedStore.js +3 -577
  82. package/lib/commonjs/network/utils/networkSelectionStore.js +1 -193
  83. package/lib/commonjs/network/utils/realNow.js +1 -0
  84. package/lib/commonjs/network/utils/requestId.js +1 -16
  85. package/lib/commonjs/network/utils/resolveRequestUrl.js +1 -15
  86. package/lib/commonjs/network/utils/selectSavedEvents.js +1 -39
  87. package/lib/commonjs/network/utils/startNetworkCapture.js +1 -24
  88. package/lib/commonjs/network/utils/withPinnedFirst.js +1 -32
  89. package/lib/commonjs/preset.js +1 -93
  90. package/lib/module/index.js +1 -104
  91. package/lib/module/index.web.js +1 -82
  92. package/lib/module/network/components/DataViewer.web.js +1 -875
  93. package/lib/module/network/components/NetworkCopyScreen.web.js +1 -44
  94. package/lib/module/network/components/NetworkCopySettingsView.js +27 -750
  95. package/lib/module/network/components/NetworkCopySettingsView.web.js +14 -1237
  96. package/lib/module/network/components/NetworkDetailScreen.web.js +1 -97
  97. package/lib/module/network/components/NetworkDetailStepper.js +1 -104
  98. package/lib/module/network/components/NetworkDetailStepper.web.js +1 -296
  99. package/lib/module/network/components/NetworkEventDetailView.js +15 -1129
  100. package/lib/module/network/components/NetworkEventDetailView.web.js +15 -1482
  101. package/lib/module/network/components/NetworkEventItemCompact.js +2 -398
  102. package/lib/module/network/components/NetworkEventItemCompact.web.js +2 -818
  103. package/lib/module/network/components/NetworkFilterScreen.web.js +1 -51
  104. package/lib/module/network/components/NetworkFilterViewV3.js +1 -438
  105. package/lib/module/network/components/NetworkFilterViewV3.web.js +1 -1306
  106. package/lib/module/network/components/NetworkHeaderLive.js +1 -366
  107. package/lib/module/network/components/NetworkHeaderLive.web.js +1 -617
  108. package/lib/module/network/components/NetworkHeaderMenu.js +1 -184
  109. package/lib/module/network/components/NetworkListScreen.js +1 -399
  110. package/lib/module/network/components/NetworkListScreen.web.js +1 -622
  111. package/lib/module/network/components/NetworkModal.js +1 -781
  112. package/lib/module/network/components/NetworkNumberPrompt.js +1 -174
  113. package/lib/module/network/components/NetworkNumberPrompt.web.js +1 -230
  114. package/lib/module/network/components/NetworkOverrideEditor.js +1 -811
  115. package/lib/module/network/components/NetworkOverrideEditor.web.js +1 -939
  116. package/lib/module/network/components/NetworkOverrideHeaderButton.js +1 -104
  117. package/lib/module/network/components/NetworkOverrideHeaderButton.web.js +1 -131
  118. package/lib/module/network/components/NetworkOverridesButton.js +1 -87
  119. package/lib/module/network/components/NetworkOverridesButton.web.js +1 -141
  120. package/lib/module/network/components/NetworkOverridesScreen.js +1 -539
  121. package/lib/module/network/components/NetworkOverridesScreen.web.js +1 -826
  122. package/lib/module/network/components/NetworkSavedScreen.js +1 -222
  123. package/lib/module/network/components/NetworkSavedScreen.web.js +1 -461
  124. package/lib/module/network/components/NetworkUpgradeBanner.js +1 -72
  125. package/lib/module/network/components/response-editor/Explorer.js +1 -972
  126. package/lib/module/network/components/response-editor/Explorer.web.js +1 -1133
  127. package/lib/module/network/components/response-editor/deleteNestedDataByPath.js +1 -51
  128. package/lib/module/network/components/response-editor/editorContext.js +1 -29
  129. package/lib/module/network/components/response-editor/updateNestedDataByPath.js +1 -56
  130. package/lib/module/network/conditions/NetworkConditionsControl.js +1 -231
  131. package/lib/module/network/conditions/NetworkConditionsControl.test.js +1 -135
  132. package/lib/module/network/conditions/NetworkConditionsIcon.js +1 -29
  133. package/lib/module/network/conditions/NetworkFloatingTool.js +1 -304
  134. package/lib/module/network/conditions/NetworkFloatingTool.test.js +1 -218
  135. package/lib/module/network/conditions/store.js +1 -65
  136. package/lib/module/network/conditions/wait.js +1 -38
  137. package/lib/module/network/conditions/xhr.js +1 -131
  138. package/lib/module/network/hooks/useLiveNetworkEvent.js +1 -58
  139. package/lib/module/network/hooks/useNetworkBadgeCounts.js +1 -79
  140. package/lib/module/network/hooks/useNetworkEventList.js +1 -104
  141. package/lib/module/network/hooks/useNetworkEvents.js +1 -314
  142. package/lib/module/network/hooks/useNetworkHasMatches.js +1 -52
  143. package/lib/module/network/hooks/useNetworkSaved.js +1 -34
  144. package/lib/module/network/hooks/useNetworkSelection.js +1 -46
  145. package/lib/module/network/hooks/useOverrideRules.js +1 -32
  146. package/lib/module/network/hooks/useTickEveryMinute.js +1 -11
  147. package/lib/module/network/overrides/applyToFetch.js +1 -72
  148. package/lib/module/network/overrides/applyToXhr.js +2 -502
  149. package/lib/module/network/overrides/engine.js +1 -85
  150. package/lib/module/network/overrides/matchRule.js +1 -81
  151. package/lib/module/network/overrides/overriddenRows.js +1 -33
  152. package/lib/module/network/overrides/overrideRulesStore.js +1 -547
  153. package/lib/module/network/overrides/presets.js +1 -65
  154. package/lib/module/network/overrides/resolveOverride.js +1 -152
  155. package/lib/module/network/overrides/types.js +1 -86
  156. package/lib/module/network/sync/networkBodyResolver.js +1 -34
  157. package/lib/module/network/sync/networkSyncAdapter.js +1 -880
  158. package/lib/module/network/sync/overrideHonesty.release.test.js +1 -35
  159. package/lib/module/network/types/index.js +1 -3
  160. package/lib/module/network/utils/extractOperationName.js +1 -76
  161. package/lib/module/network/utils/filterNetworkEvents.js +1 -92
  162. package/lib/module/network/utils/formatGraphQLVariables.js +1 -213
  163. package/lib/module/network/utils/formatting.js +1 -9
  164. package/lib/module/network/utils/generateCurl.js +2 -67
  165. package/lib/module/network/utils/generateNetworkCopyText.js +37 -162
  166. package/lib/module/network/utils/httpCompletion.js +1 -32
  167. package/lib/module/network/utils/networkEventStore.js +1 -409
  168. package/lib/module/network/utils/networkListener.js +4 -1341
  169. package/lib/module/network/utils/networkSavedStore.js +3 -572
  170. package/lib/module/network/utils/networkSelectionStore.js +1 -188
  171. package/lib/module/network/utils/realNow.js +1 -0
  172. package/lib/module/network/utils/requestId.js +1 -12
  173. package/lib/module/network/utils/resolveRequestUrl.js +1 -11
  174. package/lib/module/network/utils/selectSavedEvents.js +1 -35
  175. package/lib/module/network/utils/startNetworkCapture.js +1 -21
  176. package/lib/module/network/utils/withPinnedFirst.js +1 -28
  177. package/lib/module/preset.js +1 -91
  178. package/lib/typescript/network/overrides/engine.d.ts +1 -1
  179. package/lib/typescript/network/overrides/matchRule.d.ts +1 -1
  180. package/lib/typescript/network/overrides/resolveOverride.d.ts +2 -2
  181. package/lib/typescript/network/overrides/types.d.ts +9 -0
  182. package/lib/typescript/network/utils/networkListener.d.ts +11 -0
  183. package/lib/typescript/network/utils/realNow.d.ts +18 -0
  184. package/lib/web/index.mjs +73 -74
  185. package/package.json +3 -6
  186. package/lib/typescript/index.d.ts.map +0 -1
  187. package/lib/typescript/index.web.d.ts.map +0 -1
  188. package/lib/typescript/network/components/DataViewer.web.d.ts.map +0 -1
  189. package/lib/typescript/network/components/NetworkCopyScreen.web.d.ts.map +0 -1
  190. package/lib/typescript/network/components/NetworkCopySettingsView.d.ts.map +0 -1
  191. package/lib/typescript/network/components/NetworkCopySettingsView.web.d.ts.map +0 -1
  192. package/lib/typescript/network/components/NetworkDetailScreen.web.d.ts.map +0 -1
  193. package/lib/typescript/network/components/NetworkDetailStepper.d.ts.map +0 -1
  194. package/lib/typescript/network/components/NetworkDetailStepper.web.d.ts.map +0 -1
  195. package/lib/typescript/network/components/NetworkEventDetailView.d.ts.map +0 -1
  196. package/lib/typescript/network/components/NetworkEventDetailView.web.d.ts.map +0 -1
  197. package/lib/typescript/network/components/NetworkEventItemCompact.d.ts.map +0 -1
  198. package/lib/typescript/network/components/NetworkEventItemCompact.web.d.ts.map +0 -1
  199. package/lib/typescript/network/components/NetworkFilterScreen.web.d.ts.map +0 -1
  200. package/lib/typescript/network/components/NetworkFilterViewV3.d.ts.map +0 -1
  201. package/lib/typescript/network/components/NetworkFilterViewV3.web.d.ts.map +0 -1
  202. package/lib/typescript/network/components/NetworkHeaderLive.d.ts.map +0 -1
  203. package/lib/typescript/network/components/NetworkHeaderLive.web.d.ts.map +0 -1
  204. package/lib/typescript/network/components/NetworkHeaderMenu.d.ts.map +0 -1
  205. package/lib/typescript/network/components/NetworkListScreen.d.ts.map +0 -1
  206. package/lib/typescript/network/components/NetworkListScreen.web.d.ts.map +0 -1
  207. package/lib/typescript/network/components/NetworkModal.d.ts.map +0 -1
  208. package/lib/typescript/network/components/NetworkNumberPrompt.d.ts.map +0 -1
  209. package/lib/typescript/network/components/NetworkNumberPrompt.web.d.ts.map +0 -1
  210. package/lib/typescript/network/components/NetworkOverrideEditor.d.ts.map +0 -1
  211. package/lib/typescript/network/components/NetworkOverrideEditor.web.d.ts.map +0 -1
  212. package/lib/typescript/network/components/NetworkOverrideHeaderButton.d.ts.map +0 -1
  213. package/lib/typescript/network/components/NetworkOverrideHeaderButton.web.d.ts.map +0 -1
  214. package/lib/typescript/network/components/NetworkOverridesButton.d.ts.map +0 -1
  215. package/lib/typescript/network/components/NetworkOverridesButton.web.d.ts.map +0 -1
  216. package/lib/typescript/network/components/NetworkOverridesScreen.d.ts.map +0 -1
  217. package/lib/typescript/network/components/NetworkOverridesScreen.web.d.ts.map +0 -1
  218. package/lib/typescript/network/components/NetworkSavedScreen.d.ts.map +0 -1
  219. package/lib/typescript/network/components/NetworkSavedScreen.web.d.ts.map +0 -1
  220. package/lib/typescript/network/components/NetworkUpgradeBanner.d.ts.map +0 -1
  221. package/lib/typescript/network/components/response-editor/Explorer.d.ts.map +0 -1
  222. package/lib/typescript/network/components/response-editor/Explorer.web.d.ts.map +0 -1
  223. package/lib/typescript/network/components/response-editor/deleteNestedDataByPath.d.ts.map +0 -1
  224. package/lib/typescript/network/components/response-editor/editorContext.d.ts.map +0 -1
  225. package/lib/typescript/network/components/response-editor/updateNestedDataByPath.d.ts.map +0 -1
  226. package/lib/typescript/network/conditions/NetworkConditionsControl.d.ts.map +0 -1
  227. package/lib/typescript/network/conditions/NetworkConditionsControl.test.d.ts.map +0 -1
  228. package/lib/typescript/network/conditions/NetworkConditionsIcon.d.ts.map +0 -1
  229. package/lib/typescript/network/conditions/NetworkFloatingTool.d.ts.map +0 -1
  230. package/lib/typescript/network/conditions/NetworkFloatingTool.test.d.ts.map +0 -1
  231. package/lib/typescript/network/conditions/store.d.ts.map +0 -1
  232. package/lib/typescript/network/conditions/wait.d.ts.map +0 -1
  233. package/lib/typescript/network/conditions/xhr.d.ts.map +0 -1
  234. package/lib/typescript/network/hooks/useLiveNetworkEvent.d.ts.map +0 -1
  235. package/lib/typescript/network/hooks/useNetworkBadgeCounts.d.ts.map +0 -1
  236. package/lib/typescript/network/hooks/useNetworkEventList.d.ts.map +0 -1
  237. package/lib/typescript/network/hooks/useNetworkEvents.d.ts.map +0 -1
  238. package/lib/typescript/network/hooks/useNetworkHasMatches.d.ts.map +0 -1
  239. package/lib/typescript/network/hooks/useNetworkSaved.d.ts.map +0 -1
  240. package/lib/typescript/network/hooks/useNetworkSelection.d.ts.map +0 -1
  241. package/lib/typescript/network/hooks/useOverrideRules.d.ts.map +0 -1
  242. package/lib/typescript/network/hooks/useTickEveryMinute.d.ts.map +0 -1
  243. package/lib/typescript/network/overrides/applyToFetch.d.ts.map +0 -1
  244. package/lib/typescript/network/overrides/applyToXhr.d.ts.map +0 -1
  245. package/lib/typescript/network/overrides/engine.d.ts.map +0 -1
  246. package/lib/typescript/network/overrides/matchRule.d.ts.map +0 -1
  247. package/lib/typescript/network/overrides/overriddenRows.d.ts.map +0 -1
  248. package/lib/typescript/network/overrides/overrideRulesStore.d.ts.map +0 -1
  249. package/lib/typescript/network/overrides/presets.d.ts.map +0 -1
  250. package/lib/typescript/network/overrides/resolveOverride.d.ts.map +0 -1
  251. package/lib/typescript/network/overrides/types.d.ts.map +0 -1
  252. package/lib/typescript/network/sync/networkBodyResolver.d.ts.map +0 -1
  253. package/lib/typescript/network/sync/networkSyncAdapter.d.ts.map +0 -1
  254. package/lib/typescript/network/sync/overrideHonesty.release.test.d.ts.map +0 -1
  255. package/lib/typescript/network/types/index.d.ts.map +0 -1
  256. package/lib/typescript/network/utils/extractOperationName.d.ts.map +0 -1
  257. package/lib/typescript/network/utils/filterNetworkEvents.d.ts.map +0 -1
  258. package/lib/typescript/network/utils/formatGraphQLVariables.d.ts.map +0 -1
  259. package/lib/typescript/network/utils/formatting.d.ts.map +0 -1
  260. package/lib/typescript/network/utils/generateCurl.d.ts.map +0 -1
  261. package/lib/typescript/network/utils/generateNetworkCopyText.d.ts.map +0 -1
  262. package/lib/typescript/network/utils/httpCompletion.d.ts.map +0 -1
  263. package/lib/typescript/network/utils/networkEventStore.d.ts.map +0 -1
  264. package/lib/typescript/network/utils/networkListener.d.ts.map +0 -1
  265. package/lib/typescript/network/utils/networkSavedStore.d.ts.map +0 -1
  266. package/lib/typescript/network/utils/networkSelectionStore.d.ts.map +0 -1
  267. package/lib/typescript/network/utils/requestId.d.ts.map +0 -1
  268. package/lib/typescript/network/utils/resolveRequestUrl.d.ts.map +0 -1
  269. package/lib/typescript/network/utils/selectSavedEvents.d.ts.map +0 -1
  270. package/lib/typescript/network/utils/startNetworkCapture.d.ts.map +0 -1
  271. package/lib/typescript/network/utils/withPinnedFirst.d.ts.map +0 -1
  272. package/lib/typescript/preset.d.ts.map +0 -1
@@ -1,543 +1 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.NetworkOverridesScreen = NetworkOverridesScreen;
7
- var _react = require("react");
8
- var _reactNative = require("react-native");
9
- var _sharedUi = require("@buoy-gg/shared-ui");
10
- var _useOverrideRules = require("../hooks/useOverrideRules");
11
- var _NetworkOverrideEditor = require("./NetworkOverrideEditor");
12
- var _overrideRulesStore = require("../overrides/overrideRulesStore");
13
- var _types = require("../overrides/types");
14
- var _jsxRuntime = require("react/jsx-runtime");
15
- /**
16
- * The rule manager: what's armed, and how to stop all of it.
17
- *
18
- * One bar across the top is both the warning and the switch. It used to be two
19
- * things — an ON/OFF pill beside a title, and a separate banner saying the same
20
- * thing in different words — which left the pill reading as though it applied
21
- * to the selected rule. A state pill is ambiguous; a verb button isn't.
22
- */
23
-
24
- function blankDraft() {
25
- return {
26
- enabled: true,
27
- urlPattern: "",
28
- kind: "respond",
29
- status: 500,
30
- body: "",
31
- times: null
32
- };
33
- }
34
- function toDraft(rule) {
35
- const {
36
- id: _id,
37
- hits: _hits,
38
- seen: _seen,
39
- createdAt: _createdAt,
40
- ...draft
41
- } = rule;
42
- return draft;
43
- }
44
-
45
- /**
46
- * Where the rule applies — PATH only, not the whole URL.
47
- *
48
- * The host is the same for every rule in a typical app, so showing it pushes
49
- * the part that differs off the end of the line. Same reasoning as the request
50
- * row's `displayUrl`.
51
- */
52
- function patternPath(rule) {
53
- const path = rule.urlPattern;
54
- const schemeEnd = path.indexOf("://");
55
- if (schemeEnd === -1) return path;
56
- const slash = path.indexOf("/", schemeEnd + 3);
57
- return slash === -1 ? path.slice(schemeEnd + 3) : path.slice(slash);
58
- }
59
-
60
- /** Delay and lifetime, in the editor's own words. Empty for a plain rule. */
61
- function extrasLine(rule) {
62
- const parts = [];
63
- if (rule.delayMs) parts.push(`${rule.delayMs / 1000}s delay`);
64
- if (rule.alternate) parts.push("every other");else if (rule.times === 1) parts.push("once");else if (typeof rule.times === "number") parts.push(`${rule.times}×`);
65
- return parts.join(" · ");
66
- }
67
-
68
- /** The outcome's color, on the request list's status scale — a forced 500
69
- * should look exactly like a real one. */
70
- function ruleAccent(rule) {
71
- if (rule.kind === "fail") return _sharedUi.macOSColors.semantic.error;
72
- if (rule.kind === "delay") return _sharedUi.macOSColors.semantic.info;
73
- const status = rule.status ?? 200;
74
- if (status >= 200 && status < 300) return _sharedUi.macOSColors.semantic.success;
75
- if (status >= 300 && status < 400) return _sharedUi.macOSColors.semantic.info;
76
- return _sharedUi.macOSColors.semantic.error;
77
- }
78
-
79
- /**
80
- * One rule, in the request row's visual language — the same card, method badge,
81
- * monospace path and status colors as `NetworkEventItemCompact`, so a rule
82
- * reads as "the request it will produce". What's different is what a rule
83
- * needs: a trash instead of the type chip and chevron, and the outcome color
84
- * only floods the left edge while the rule is live. There's no per-rule
85
- * on/off — a rule you don't want anymore gets deleted, and pausing everything
86
- * is the master bar's job.
87
- */
88
- function RuleRow({
89
- rule,
90
- spent,
91
- onEdit,
92
- onDelete
93
- }) {
94
- const live = rule.enabled && !spent;
95
- const accent = ruleAccent(rule);
96
- const extras = extrasLine(rule);
97
- const method = rule.methods?.length ? rule.methods.join("/") : "ANY";
98
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_sharedUi.DevToolsCard, {
99
- onPress: onEdit,
100
- style: styles.cardWrapper,
101
- contentStyle: [styles.card, {
102
- borderLeftColor: live ? accent : "transparent"
103
- }],
104
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.MethodBadge, {
105
- method: method,
106
- size: "small"
107
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
108
- style: styles.cardMiddle,
109
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
110
- style: [styles.urlText, !live && styles.urlTextOff],
111
- numberOfLines: 2,
112
- children: patternPath(rule)
113
- }), extras ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
114
- style: styles.extrasText,
115
- children: extras
116
- }) : null]
117
- }), rule.hits > 0 ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
118
- style: styles.rowHits,
119
- children: rule.hits
120
- }) : null, rule.kind === "fail" ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
121
- style: styles.failBadge,
122
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.AlertCircle, {
123
- size: 10,
124
- color: _sharedUi.macOSColors.semantic.error
125
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
126
- style: styles.failText,
127
- children: rule.failKind === "timeout" ? "TIMEOUT" : "OFFLINE"
128
- })]
129
- }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
130
- style: [styles.statusText, {
131
- color: accent
132
- }],
133
- children: rule.kind === "delay" ? "PASS" : String(rule.status ?? 200)
134
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
135
- onPress: onDelete,
136
- "sentry-label": "ignore delete override rule",
137
- testID: "buoy-network-rule-delete",
138
- accessibilityRole: "button",
139
- accessibilityLabel: "Delete rule",
140
- hitSlop: {
141
- top: 8,
142
- bottom: 8,
143
- left: 4,
144
- right: 4
145
- },
146
- style: styles.rowDelete,
147
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.Trash2, {
148
- size: 13,
149
- color: _sharedUi.macOSColors.text.muted
150
- })
151
- })]
152
- });
153
- }
154
- /**
155
- * Stable-router gate.
156
- *
157
- * The screens in `NetworkModal` are rendered as permanent siblings, and the
158
- * convention there is that a HIDDEN screen must not subscribe to anything.
159
- * Splitting the body out is how this one honours that: `useOverrideRules`
160
- * subscribes to a store that ticks while rules are firing, and a hidden screen
161
- * re-rendering for that would be pure waste. (The header's overrides button is
162
- * a deliberate exception — it's always visible and its whole job is to react.)
163
- */
164
- function NetworkOverridesScreen(props) {
165
- if (!props.visible) return null;
166
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(OverridesBody, {
167
- ...props
168
- });
169
- }
170
- function OverridesBody({
171
- isPro,
172
- onUpgradePress,
173
- pendingDraft,
174
- onPendingConsumed,
175
- backHandlerRef,
176
- applySafeAreaInset
177
- }) {
178
- // `isPro` stays a prop so callers can force the unlimited view.
179
- const tierRuleLimit = (0, _sharedUi.useLimit)("network.overrideRules");
180
- const ruleLimit = isPro ? _types.MAX_RULES : tierRuleLimit;
181
- const {
182
- enabled,
183
- autoPaused,
184
- rules,
185
- activeCount,
186
- setEnabled,
187
- upsertRule,
188
- setRuleEnabled,
189
- removeRule,
190
- isRuleSpent
191
- } = (0, _useOverrideRules.useOverrideRules)();
192
- const [editing, setEditing] = (0, _react.useState)(null);
193
-
194
- // Reaching this screen proves the app renders, so the launch-safety streak
195
- // has nothing to guard against — see `noteHealthyLaunch`.
196
- (0, _react.useEffect)(() => {
197
- _overrideRulesStore.overrideRulesStore.noteHealthyLaunch();
198
- }, []);
199
-
200
- // Back while editing means "back to the rule list", not "leave overrides" —
201
- // see the prop's comment. Cleared on unmount so a hidden screen can't
202
- // swallow back presses.
203
- (0, _react.useEffect)(() => {
204
- if (!backHandlerRef) return;
205
- backHandlerRef.current = editing ? () => {
206
- setEditing(null);
207
- return true;
208
- } : null;
209
- return () => {
210
- backHandlerRef.current = null;
211
- };
212
- }, [backHandlerRef, editing]);
213
-
214
- /**
215
- * Open a rule for editing, pulling its body over if this surface doesn't have
216
- * it.
217
- *
218
- * On the device that's already the case and the fetch resolves synchronously.
219
- * On the dashboard a large body is left out of the snapshot on purpose (see
220
- * `stripLargeRuleBodies`), so it arrives a moment after the editor does — the
221
- * `id` re-check keeps a slow reply from landing in a rule you've since moved
222
- * on from.
223
- */
224
- const hydrateBody = (0, _react.useCallback)(id => {
225
- void _overrideRulesStore.overrideRulesStore.fetchRuleBody(id).then(body => {
226
- if (body == null) return;
227
- setEditing(current => current?.id === id ? {
228
- ...current,
229
- draft: {
230
- ...current.draft,
231
- body,
232
- bodyOmitted: undefined
233
- }
234
- } : current);
235
- });
236
- }, []);
237
- (0, _react.useEffect)(() => {
238
- if (!pendingDraft) return;
239
- const {
240
- id,
241
- ...draft
242
- } = pendingDraft;
243
- setEditing({
244
- id,
245
- draft
246
- });
247
- // Same reason as `openRule`: the detail page's Override button hands over an
248
- // existing rule, and on the dashboard that rule's body may not be here yet.
249
- if (id && draft.bodyOmitted) hydrateBody(id);
250
- onPendingConsumed?.();
251
- }, [pendingDraft, onPendingConsumed, hydrateBody]);
252
-
253
- /**
254
- * Leave the editor when the rule it's editing stops existing.
255
- *
256
- * Rules can be cleared from somewhere else — the dashboard, an MCP agent —
257
- * while this editor is open. Without this, Save would upsert the old id and
258
- * quietly RESURRECT a rule someone had just deleted. Only guards existing
259
- * rules; a draft with no id yet is a new rule and has nothing to lose.
260
- */
261
- (0, _react.useEffect)(() => {
262
- if (!editing?.id) return;
263
- if (rules.some(rule => rule.id === editing.id)) return;
264
- setEditing(null);
265
- }, [editing?.id, rules]);
266
- const openRule = rule => {
267
- setEditing({
268
- id: rule.id,
269
- draft: toDraft(rule)
270
- });
271
- if (rule.bodyOmitted) hydrateBody(rule.id);
272
- };
273
-
274
- /**
275
- * On the free tier a new rule REPLACES the live one rather than being refused.
276
- *
277
- * The old behaviour put an upgrade modal in the action path: you tapped a
278
- * thing and got a sales pitch instead of the thing. Nobody buys from a modal
279
- * that just cancelled their action, and it hid the feature behind a wall
280
- * instead of letting you feel its shape. "One override at a time" is a shape
281
- * a developer understands.
282
- */
283
- const enforceRuleLimit = keepId => {
284
- // Only trims when the tier is actually over its cap, so Pro (whose limit
285
- // is the hard MAX_RULES ceiling) is never touched.
286
- const active = rules.filter(rule => rule.enabled && !isRuleSpent(rule));
287
- if (active.length <= ruleLimit) return;
288
- rules.filter(rule => rule.enabled && !isRuleSpent(rule) && rule.id !== keepId).forEach(rule => setRuleEnabled(rule.id, false));
289
- };
290
- const handleSave = () => {
291
- if (!editing) return;
292
- // Saving always arms the rule. With no per-rule toggle, this is the ONLY
293
- // way back on for a rule the free tier disabled or that used itself up —
294
- // and nobody edits a rule they want to stay inert.
295
- const draft = {
296
- ...editing.draft,
297
- enabled: true,
298
- urlPattern: editing.draft.urlPattern.trim()
299
- };
300
- if (!draft.urlPattern) return;
301
- const saved = upsertRule({
302
- ...draft,
303
- id: editing.id
304
- });
305
- enforceRuleLimit(saved?.id ?? editing.id);
306
- // Arm the master switch. Deliberately creating a rule and having it sit
307
- // inert because overrides happen to be paused is the silent-failure this
308
- // feature can least afford — the preset path already does this, and the
309
- // manager disagreeing with it was just a gap.
310
- setEnabled(true);
311
- setEditing(null);
312
- };
313
- if (editing) {
314
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_NetworkOverrideEditor.NetworkOverrideEditor, {
315
- draft: editing.draft,
316
- onChange: draft => setEditing({
317
- ...editing,
318
- draft
319
- }),
320
- onSave: handleSave,
321
- onCancel: () => setEditing(null),
322
- saveLabel: editing.id ? "Save" : "Add",
323
- applySafeAreaInset: applySafeAreaInset
324
- });
325
- }
326
- const hasRules = rules.length > 0;
327
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
328
- style: styles.root,
329
- children: [hasRules ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
330
- style: [styles.bar, enabled && activeCount > 0 && styles.barOn],
331
- children: [enabled && activeCount > 0 ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.AlertTriangle, {
332
- size: 12,
333
- color: _sharedUi.macOSColors.semantic.warning
334
- }) : null, /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
335
- style: [styles.barText, enabled && activeCount > 0 && styles.barTextOn],
336
- numberOfLines: 2,
337
- children: autoPaused ? "Overrides paused — they'd been on for 3 launches" : enabled && activeCount > 0 ? `${activeCount} override${activeCount === 1 ? " is" : "s are"} on` : "Overrides are off"
338
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
339
- onPress: () => setEnabled(!(enabled && activeCount > 0)),
340
- "sentry-label": "ignore toggle overrides master",
341
- testID: "buoy-network-overrides-master",
342
- accessibilityRole: "button",
343
- style: styles.barButton,
344
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
345
- style: styles.barButtonText,
346
- children: enabled && activeCount > 0 ? "Turn all off" : autoPaused ? "Turn back on" : "Turn on"
347
- })
348
- })]
349
- }) : null, /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
350
- style: styles.listHeader,
351
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
352
- style: styles.listHeaderText,
353
- children: hasRules ? `${rules.length} rule${rules.length === 1 ? "" : "s"}` : ""
354
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
355
- onPress: () => setEditing({
356
- draft: blankDraft()
357
- }),
358
- "sentry-label": "ignore new override rule",
359
- accessibilityLabel: "New override rule",
360
- style: styles.newButton,
361
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.Plus, {
362
- size: 14,
363
- color: _sharedUi.macOSColors.semantic.info
364
- })
365
- })]
366
- }), !hasRules ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
367
- style: styles.emptyWrap,
368
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.EmptyState
369
- // Otto instead of the flask: nothing is faked yet, so he peers
370
- // into an empty box. Truthful by construction — this branch only
371
- // renders when the rule list is genuinely empty, and the master
372
- // switch bar above is hidden in exactly that case.
373
- , {
374
- otto: "empty"
375
- // 32 → pixelSize 2, the size the saved/list screens use, so the
376
- // three network empties read as one family.
377
- ,
378
- iconSize: 32,
379
- title: "Nothing overridden"
380
- // Names the control that actually exists. This said "tap Force 500"
381
- // — a button from the deleted preset list, which sent anyone
382
- // following it looking for something that isn't there.
383
- ,
384
- description: "Open any request and tap Override, or + to write a rule."
385
- })
386
- }) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.ScrollView, {
387
- style: styles.list,
388
- contentContainerStyle: styles.listContent,
389
- keyboardShouldPersistTaps: "handled",
390
- children: [rules.map(rule => /*#__PURE__*/(0, _jsxRuntime.jsx)(RuleRow, {
391
- rule: rule,
392
- spent: isRuleSpent(rule),
393
- onEdit: () => openRule(rule),
394
- onDelete: () => removeRule(rule.id)
395
- }, rule.id)), ruleLimit < _types.MAX_RULES ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
396
- style: styles.footNote,
397
- children: `Your plan: ${ruleLimit} override at a time. Pro: up to ${_types.MAX_RULES}.`
398
- }) : null]
399
- })]
400
- });
401
- }
402
- const styles = _reactNative.StyleSheet.create({
403
- root: {
404
- flex: 1
405
- },
406
- bar: {
407
- flexDirection: "row",
408
- alignItems: "center",
409
- gap: 8,
410
- paddingHorizontal: 12,
411
- paddingVertical: 10,
412
- borderBottomWidth: 1,
413
- borderBottomColor: _sharedUi.macOSColors.border.default,
414
- backgroundColor: _sharedUi.macOSColors.background.card
415
- },
416
- barOn: {
417
- borderBottomColor: _sharedUi.macOSColors.semantic.warning + "44",
418
- backgroundColor: _sharedUi.macOSColors.semantic.warningBackground
419
- },
420
- barText: {
421
- flex: 1,
422
- fontSize: 12,
423
- fontWeight: "600",
424
- color: _sharedUi.macOSColors.text.secondary
425
- },
426
- barTextOn: {
427
- color: _sharedUi.macOSColors.semantic.warning
428
- },
429
- barButton: {
430
- paddingHorizontal: 10,
431
- paddingVertical: 6,
432
- borderRadius: 5,
433
- borderWidth: 1,
434
- borderColor: _sharedUi.macOSColors.border.hover,
435
- backgroundColor: _sharedUi.macOSColors.background.base
436
- },
437
- barButtonText: {
438
- fontSize: 11,
439
- fontWeight: "700",
440
- color: _sharedUi.macOSColors.text.primary
441
- },
442
- listHeader: {
443
- flexDirection: "row",
444
- alignItems: "center",
445
- justifyContent: "space-between",
446
- paddingHorizontal: 12,
447
- paddingTop: 10,
448
- paddingBottom: 4
449
- },
450
- listHeaderText: {
451
- fontSize: 10,
452
- fontWeight: "700",
453
- letterSpacing: 0.6,
454
- color: _sharedUi.macOSColors.text.muted,
455
- textTransform: "uppercase"
456
- },
457
- newButton: {
458
- padding: 6,
459
- borderRadius: 5,
460
- borderWidth: 1,
461
- borderColor: _sharedUi.macOSColors.border.default,
462
- backgroundColor: _sharedUi.macOSColors.background.card
463
- },
464
- emptyWrap: {
465
- flex: 1,
466
- justifyContent: "center"
467
- },
468
- list: {
469
- flex: 1
470
- },
471
- listContent: {
472
- padding: 10,
473
- gap: 6
474
- },
475
- // The list already spaces rows via `listContent` gap — zero out the card's
476
- // own margins so the two don't stack.
477
- cardWrapper: {
478
- marginHorizontal: 0,
479
- marginVertical: 0
480
- },
481
- card: {
482
- flexDirection: "row",
483
- alignItems: "center",
484
- gap: 8,
485
- borderLeftWidth: 3,
486
- borderLeftColor: "transparent"
487
- },
488
- cardMiddle: {
489
- flex: 1
490
- },
491
- // Same type as the request row's URL.
492
- urlText: {
493
- fontSize: 12,
494
- color: _sharedUi.macOSColors.text.primary,
495
- lineHeight: 16,
496
- fontFamily: _sharedUi.monoFont
497
- },
498
- urlTextOff: {
499
- color: _sharedUi.macOSColors.text.muted
500
- },
501
- extrasText: {
502
- fontSize: 10,
503
- color: _sharedUi.macOSColors.text.secondary,
504
- marginTop: 2
505
- },
506
- statusText: {
507
- fontSize: 11,
508
- fontWeight: "600"
509
- },
510
- failBadge: {
511
- flexDirection: "row",
512
- alignItems: "center",
513
- gap: 2,
514
- paddingHorizontal: 4,
515
- paddingVertical: 1,
516
- backgroundColor: _sharedUi.macOSColors.semantic.error + "26",
517
- borderRadius: 3
518
- },
519
- failText: {
520
- fontSize: 10,
521
- color: _sharedUi.macOSColors.semantic.error,
522
- fontWeight: "600"
523
- },
524
- rowHits: {
525
- fontSize: 11,
526
- fontWeight: "700",
527
- color: _sharedUi.macOSColors.semantic.warning
528
- },
529
- rowDelete: {
530
- padding: 5,
531
- borderRadius: 5,
532
- borderWidth: 1,
533
- borderColor: _sharedUi.macOSColors.border.default,
534
- backgroundColor: _sharedUi.macOSColors.background.base
535
- },
536
- footNote: {
537
- fontSize: 10,
538
- lineHeight: 14,
539
- color: _sharedUi.macOSColors.text.muted,
540
- paddingHorizontal: 4,
541
- paddingTop: 8
542
- }
543
- });
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.NetworkOverridesScreen=NetworkOverridesScreen;var _react=require("react");var _reactNative=require("react-native");var _sharedUi=require("@buoy-gg/shared-ui");var _useOverrideRules=require("../hooks/useOverrideRules");var _NetworkOverrideEditor=require("./NetworkOverrideEditor");var _overrideRulesStore=require("../overrides/overrideRulesStore");var _types=require("../overrides/types");var _jsxRuntime=require("react/jsx-runtime");function blankDraft(){return{enabled:true,urlPattern:"",kind:"respond",status:500,body:"",times:null}}function toDraft(e){const{id:r,hits:i,seen:l,createdAt:d,...f}=e;return f}function patternPath(e){const r=e.urlPattern;const i=r.indexOf("://");if(i===-1)return r;const l=r.indexOf("/",i+3);return l===-1?r.slice(i+3):r.slice(l)}function extrasLine(e){const r=[];if(e.delayMs)r.push(`${e.delayMs/1e3}s delay`);if(e.alternate)r.push("every other");else if(e.times===1)r.push("once");else if(typeof e.times==="number")r.push(`${e.times}\xD7`);return r.join(" \xB7 ")}function ruleAccent(e){if(e.kind==="fail")return _sharedUi.macOSColors.semantic.error;if(e.kind==="delay")return _sharedUi.macOSColors.semantic.info;const r=e.status??200;if(r>=200&&r<300)return _sharedUi.macOSColors.semantic.success;if(r>=300&&r<400)return _sharedUi.macOSColors.semantic.info;return _sharedUi.macOSColors.semantic.error}function RuleRow({rule:e,spent:r,onEdit:i,onDelete:l}){const d=e.enabled&&!r;const f=ruleAccent(e);const b=extrasLine(e);const x=e.methods?.length?e.methods.join("/"):"ANY";return(0,_jsxRuntime.jsxs)(_sharedUi.DevToolsCard,{onPress:i,style:styles.cardWrapper,contentStyle:[styles.card,{borderLeftColor:d?f:"transparent"}],children:[(0,_jsxRuntime.jsx)(_sharedUi.MethodBadge,{method:x,size:"small"}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.cardMiddle,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.urlText,!d&&styles.urlTextOff],numberOfLines:2,children:patternPath(e)}),b?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.extrasText,children:b}):null]}),e.hits>0?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.rowHits,children:e.hits}):null,e.kind==="fail"?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.failBadge,children:[(0,_jsxRuntime.jsx)(_sharedUi.AlertCircle,{size:10,color:_sharedUi.macOSColors.semantic.error}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.failText,children:e.failKind==="timeout"?"TIMEOUT":"OFFLINE"})]}):(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.statusText,{color:f}],children:e.kind==="delay"?"PASS":String(e.status??200)}),(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{onPress:l,"sentry-label":"ignore delete override rule",testID:"buoy-network-rule-delete",accessibilityRole:"button",accessibilityLabel:"Delete rule",hitSlop:{top:8,bottom:8,left:4,right:4},style:styles.rowDelete,children:(0,_jsxRuntime.jsx)(_sharedUi.Trash2,{size:13,color:_sharedUi.macOSColors.text.muted})})]})}function NetworkOverridesScreen(e){if(!e.visible)return null;return(0,_jsxRuntime.jsx)(OverridesBody,{...e})}function OverridesBody({isPro:e,onUpgradePress:r,pendingDraft:i,onPendingConsumed:l,backHandlerRef:d,applySafeAreaInset:f}){const b=(0,_sharedUi.useLimit)("network.overrideRules");const x=e?_types.MAX_RULES:b;const{enabled:m,autoPaused:p,rules:c,activeCount:u,setEnabled:S,upsertRule:O,setRuleEnabled:C,removeRule:v,isRuleSpent:h}=(0,_useOverrideRules.useOverrideRules)();const[o,s]=(0,_react.useState)(null);(0,_react.useEffect)(()=>{_overrideRulesStore.overrideRulesStore.noteHealthyLaunch()},[]);(0,_react.useEffect)(()=>{if(!d)return;d.current=o?()=>{s(null);return true}:null;return()=>{d.current=null}},[d,o]);const g=(0,_react.useCallback)(t=>{void _overrideRulesStore.overrideRulesStore.fetchRuleBody(t).then(a=>{if(a==null)return;s(n=>n?.id===t?{...n,draft:{...n.draft,body:a,bodyOmitted:void 0}}:n)})},[]);(0,_react.useEffect)(()=>{if(!i)return;const{id:t,...a}=i;s({id:t,draft:a});if(t&&a.bodyOmitted)g(t);l?.()},[i,l,g]);(0,_react.useEffect)(()=>{if(!o?.id)return;if(c.some(t=>t.id===o.id))return;s(null)},[o?.id,c]);const T=t=>{s({id:t.id,draft:toDraft(t)});if(t.bodyOmitted)g(t.id)};const j=t=>{const a=c.filter(n=>n.enabled&&!h(n));if(a.length<=x)return;c.filter(n=>n.enabled&&!h(n)&&n.id!==t).forEach(n=>C(n.id,false))};const w=()=>{if(!o)return;const t={...o.draft,enabled:true,urlPattern:o.draft.urlPattern.trim()};if(!t.urlPattern)return;const a=O({...t,id:o.id});j(a?.id??o.id);S(true);s(null)};if(o){return(0,_jsxRuntime.jsx)(_NetworkOverrideEditor.NetworkOverrideEditor,{draft:o.draft,onChange:t=>s({...o,draft:t}),onSave:w,onCancel:()=>s(null),saveLabel:o.id?"Save":"Add",applySafeAreaInset:f})}const y=c.length>0;return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.root,children:[y?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.bar,m&&u>0&&styles.barOn],children:[m&&u>0?(0,_jsxRuntime.jsx)(_sharedUi.AlertTriangle,{size:12,color:_sharedUi.macOSColors.semantic.warning}):null,(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.barText,m&&u>0&&styles.barTextOn],numberOfLines:2,children:p?"Overrides paused \u2014 they'd been on for 3 launches":m&&u>0?`${u} override${u===1?" is":"s are"} on`:"Overrides are off"}),(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{onPress:()=>S(!(m&&u>0)),"sentry-label":"ignore toggle overrides master",testID:"buoy-network-overrides-master",accessibilityRole:"button",style:styles.barButton,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.barButtonText,children:m&&u>0?"Turn all off":p?"Turn back on":"Turn on"})})]}):null,(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.listHeader,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.listHeaderText,children:y?`${c.length} rule${c.length===1?"":"s"}`:""}),(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{onPress:()=>s({draft:blankDraft()}),"sentry-label":"ignore new override rule",accessibilityLabel:"New override rule",style:styles.newButton,children:(0,_jsxRuntime.jsx)(_sharedUi.Plus,{size:14,color:_sharedUi.macOSColors.semantic.info})})]}),!y?(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.emptyWrap,children:(0,_jsxRuntime.jsx)(_sharedUi.EmptyState,{otto:"empty",iconSize:32,title:"Nothing overridden",description:"Open any request and tap Override, or + to write a rule."})}):(0,_jsxRuntime.jsxs)(_reactNative.ScrollView,{style:styles.list,contentContainerStyle:styles.listContent,keyboardShouldPersistTaps:"handled",children:[c.map(t=>(0,_jsxRuntime.jsx)(RuleRow,{rule:t,spent:h(t),onEdit:()=>T(t),onDelete:()=>v(t.id)},t.id)),x<_types.MAX_RULES?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.footNote,children:`Your plan: ${x} override at a time. Pro: up to ${_types.MAX_RULES}.`}):null]})]})}const styles=_reactNative.StyleSheet.create({root:{flex:1},bar:{flexDirection:"row",alignItems:"center",gap:8,paddingHorizontal:12,paddingVertical:10,borderBottomWidth:1,borderBottomColor:_sharedUi.macOSColors.border.default,backgroundColor:_sharedUi.macOSColors.background.card},barOn:{borderBottomColor:_sharedUi.macOSColors.semantic.warning+"44",backgroundColor:_sharedUi.macOSColors.semantic.warningBackground},barText:{flex:1,fontSize:12,fontWeight:"600",color:_sharedUi.macOSColors.text.secondary},barTextOn:{color:_sharedUi.macOSColors.semantic.warning},barButton:{paddingHorizontal:10,paddingVertical:6,borderRadius:5,borderWidth:1,borderColor:_sharedUi.macOSColors.border.hover,backgroundColor:_sharedUi.macOSColors.background.base},barButtonText:{fontSize:11,fontWeight:"700",color:_sharedUi.macOSColors.text.primary},listHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:12,paddingTop:10,paddingBottom:4},listHeaderText:{fontSize:10,fontWeight:"700",letterSpacing:.6,color:_sharedUi.macOSColors.text.muted,textTransform:"uppercase"},newButton:{padding:6,borderRadius:5,borderWidth:1,borderColor:_sharedUi.macOSColors.border.default,backgroundColor:_sharedUi.macOSColors.background.card},emptyWrap:{flex:1,justifyContent:"center"},list:{flex:1},listContent:{padding:10,gap:6},cardWrapper:{marginHorizontal:0,marginVertical:0},card:{flexDirection:"row",alignItems:"center",gap:8,borderLeftWidth:3,borderLeftColor:"transparent"},cardMiddle:{flex:1},urlText:{fontSize:12,color:_sharedUi.macOSColors.text.primary,lineHeight:16,fontFamily:_sharedUi.monoFont},urlTextOff:{color:_sharedUi.macOSColors.text.muted},extrasText:{fontSize:10,color:_sharedUi.macOSColors.text.secondary,marginTop:2},statusText:{fontSize:11,fontWeight:"600"},failBadge:{flexDirection:"row",alignItems:"center",gap:2,paddingHorizontal:4,paddingVertical:1,backgroundColor:_sharedUi.macOSColors.semantic.error+"26",borderRadius:3},failText:{fontSize:10,color:_sharedUi.macOSColors.semantic.error,fontWeight:"600"},rowHits:{fontSize:11,fontWeight:"700",color:_sharedUi.macOSColors.semantic.warning},rowDelete:{padding:5,borderRadius:5,borderWidth:1,borderColor:_sharedUi.macOSColors.border.default,backgroundColor:_sharedUi.macOSColors.background.base},footNote:{fontSize:10,lineHeight:14,color:_sharedUi.macOSColors.text.muted,paddingHorizontal:4,paddingTop:8}});