@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.
- package/README.md +11 -85
- package/lib/commonjs/index.js +1 -332
- package/lib/commonjs/index.web.js +1 -420
- package/lib/commonjs/network/components/DataViewer.web.js +1 -879
- package/lib/commonjs/network/components/NetworkCopyScreen.web.js +1 -48
- package/lib/commonjs/network/components/NetworkCopySettingsView.js +27 -755
- package/lib/commonjs/network/components/NetworkCopySettingsView.web.js +14 -1242
- package/lib/commonjs/network/components/NetworkDetailScreen.web.js +1 -101
- package/lib/commonjs/network/components/NetworkDetailStepper.js +1 -108
- package/lib/commonjs/network/components/NetworkDetailStepper.web.js +1 -298
- package/lib/commonjs/network/components/NetworkEventDetailView.js +15 -1130
- package/lib/commonjs/network/components/NetworkEventDetailView.web.js +15 -1484
- package/lib/commonjs/network/components/NetworkEventItemCompact.js +2 -401
- package/lib/commonjs/network/components/NetworkEventItemCompact.web.js +2 -820
- package/lib/commonjs/network/components/NetworkFilterScreen.web.js +1 -55
- package/lib/commonjs/network/components/NetworkFilterViewV3.js +1 -442
- package/lib/commonjs/network/components/NetworkFilterViewV3.web.js +1 -1310
- package/lib/commonjs/network/components/NetworkHeaderLive.js +1 -375
- package/lib/commonjs/network/components/NetworkHeaderLive.web.js +1 -623
- package/lib/commonjs/network/components/NetworkHeaderMenu.js +1 -190
- package/lib/commonjs/network/components/NetworkListScreen.js +1 -403
- package/lib/commonjs/network/components/NetworkListScreen.web.js +1 -624
- package/lib/commonjs/network/components/NetworkModal.js +1 -786
- package/lib/commonjs/network/components/NetworkNumberPrompt.js +1 -178
- package/lib/commonjs/network/components/NetworkNumberPrompt.web.js +1 -232
- package/lib/commonjs/network/components/NetworkOverrideEditor.js +1 -814
- package/lib/commonjs/network/components/NetworkOverrideEditor.web.js +1 -942
- package/lib/commonjs/network/components/NetworkOverrideHeaderButton.js +1 -107
- package/lib/commonjs/network/components/NetworkOverrideHeaderButton.web.js +1 -133
- package/lib/commonjs/network/components/NetworkOverridesButton.js +1 -90
- package/lib/commonjs/network/components/NetworkOverridesButton.web.js +1 -143
- package/lib/commonjs/network/components/NetworkOverridesScreen.js +1 -543
- package/lib/commonjs/network/components/NetworkOverridesScreen.web.js +1 -830
- package/lib/commonjs/network/components/NetworkSavedScreen.js +1 -226
- package/lib/commonjs/network/components/NetworkSavedScreen.web.js +1 -463
- package/lib/commonjs/network/components/NetworkUpgradeBanner.js +1 -76
- package/lib/commonjs/network/components/response-editor/Explorer.js +1 -973
- package/lib/commonjs/network/components/response-editor/Explorer.web.js +1 -1136
- package/lib/commonjs/network/components/response-editor/deleteNestedDataByPath.js +1 -56
- package/lib/commonjs/network/components/response-editor/editorContext.js +1 -33
- package/lib/commonjs/network/components/response-editor/updateNestedDataByPath.js +1 -61
- package/lib/commonjs/network/conditions/NetworkConditionsControl.js +1 -235
- package/lib/commonjs/network/conditions/NetworkConditionsControl.test.js +1 -136
- package/lib/commonjs/network/conditions/NetworkConditionsIcon.js +1 -33
- package/lib/commonjs/network/conditions/NetworkFloatingTool.js +1 -310
- package/lib/commonjs/network/conditions/NetworkFloatingTool.test.js +1 -219
- package/lib/commonjs/network/conditions/store.js +1 -75
- package/lib/commonjs/network/conditions/wait.js +1 -43
- package/lib/commonjs/network/conditions/xhr.js +1 -135
- package/lib/commonjs/network/hooks/useLiveNetworkEvent.js +1 -62
- package/lib/commonjs/network/hooks/useNetworkBadgeCounts.js +1 -83
- package/lib/commonjs/network/hooks/useNetworkEventList.js +1 -108
- package/lib/commonjs/network/hooks/useNetworkEvents.js +1 -318
- package/lib/commonjs/network/hooks/useNetworkHasMatches.js +1 -56
- package/lib/commonjs/network/hooks/useNetworkSaved.js +1 -38
- package/lib/commonjs/network/hooks/useNetworkSelection.js +1 -53
- package/lib/commonjs/network/hooks/useOverrideRules.js +1 -36
- package/lib/commonjs/network/hooks/useTickEveryMinute.js +1 -21
- package/lib/commonjs/network/overrides/applyToFetch.js +1 -80
- package/lib/commonjs/network/overrides/applyToXhr.js +2 -510
- package/lib/commonjs/network/overrides/engine.js +1 -93
- package/lib/commonjs/network/overrides/matchRule.js +1 -87
- package/lib/commonjs/network/overrides/overriddenRows.js +1 -37
- package/lib/commonjs/network/overrides/overrideRulesStore.js +1 -550
- package/lib/commonjs/network/overrides/presets.js +1 -70
- package/lib/commonjs/network/overrides/resolveOverride.js +1 -158
- package/lib/commonjs/network/overrides/types.js +1 -90
- package/lib/commonjs/network/sync/networkBodyResolver.js +1 -39
- package/lib/commonjs/network/sync/networkSyncAdapter.js +1 -882
- package/lib/commonjs/network/sync/overrideHonesty.release.test.js +1 -36
- package/lib/commonjs/network/types/index.js +1 -5
- package/lib/commonjs/network/utils/extractOperationName.js +1 -80
- package/lib/commonjs/network/utils/filterNetworkEvents.js +1 -96
- package/lib/commonjs/network/utils/formatGraphQLVariables.js +1 -219
- package/lib/commonjs/network/utils/formatting.js +1 -30
- package/lib/commonjs/network/utils/generateCurl.js +2 -71
- package/lib/commonjs/network/utils/generateNetworkCopyText.js +37 -166
- package/lib/commonjs/network/utils/httpCompletion.js +1 -37
- package/lib/commonjs/network/utils/networkEventStore.js +1 -411
- package/lib/commonjs/network/utils/networkListener.js +4 -1352
- package/lib/commonjs/network/utils/networkSavedStore.js +3 -577
- package/lib/commonjs/network/utils/networkSelectionStore.js +1 -193
- package/lib/commonjs/network/utils/realNow.js +1 -0
- package/lib/commonjs/network/utils/requestId.js +1 -16
- package/lib/commonjs/network/utils/resolveRequestUrl.js +1 -15
- package/lib/commonjs/network/utils/selectSavedEvents.js +1 -39
- package/lib/commonjs/network/utils/startNetworkCapture.js +1 -24
- package/lib/commonjs/network/utils/withPinnedFirst.js +1 -32
- package/lib/commonjs/preset.js +1 -93
- package/lib/module/index.js +1 -104
- package/lib/module/index.web.js +1 -82
- package/lib/module/network/components/DataViewer.web.js +1 -875
- package/lib/module/network/components/NetworkCopyScreen.web.js +1 -44
- package/lib/module/network/components/NetworkCopySettingsView.js +27 -750
- package/lib/module/network/components/NetworkCopySettingsView.web.js +14 -1237
- package/lib/module/network/components/NetworkDetailScreen.web.js +1 -97
- package/lib/module/network/components/NetworkDetailStepper.js +1 -104
- package/lib/module/network/components/NetworkDetailStepper.web.js +1 -296
- package/lib/module/network/components/NetworkEventDetailView.js +15 -1129
- package/lib/module/network/components/NetworkEventDetailView.web.js +15 -1482
- package/lib/module/network/components/NetworkEventItemCompact.js +2 -398
- package/lib/module/network/components/NetworkEventItemCompact.web.js +2 -818
- package/lib/module/network/components/NetworkFilterScreen.web.js +1 -51
- package/lib/module/network/components/NetworkFilterViewV3.js +1 -438
- package/lib/module/network/components/NetworkFilterViewV3.web.js +1 -1306
- package/lib/module/network/components/NetworkHeaderLive.js +1 -366
- package/lib/module/network/components/NetworkHeaderLive.web.js +1 -617
- package/lib/module/network/components/NetworkHeaderMenu.js +1 -184
- package/lib/module/network/components/NetworkListScreen.js +1 -399
- package/lib/module/network/components/NetworkListScreen.web.js +1 -622
- package/lib/module/network/components/NetworkModal.js +1 -781
- package/lib/module/network/components/NetworkNumberPrompt.js +1 -174
- package/lib/module/network/components/NetworkNumberPrompt.web.js +1 -230
- package/lib/module/network/components/NetworkOverrideEditor.js +1 -811
- package/lib/module/network/components/NetworkOverrideEditor.web.js +1 -939
- package/lib/module/network/components/NetworkOverrideHeaderButton.js +1 -104
- package/lib/module/network/components/NetworkOverrideHeaderButton.web.js +1 -131
- package/lib/module/network/components/NetworkOverridesButton.js +1 -87
- package/lib/module/network/components/NetworkOverridesButton.web.js +1 -141
- package/lib/module/network/components/NetworkOverridesScreen.js +1 -539
- package/lib/module/network/components/NetworkOverridesScreen.web.js +1 -826
- package/lib/module/network/components/NetworkSavedScreen.js +1 -222
- package/lib/module/network/components/NetworkSavedScreen.web.js +1 -461
- package/lib/module/network/components/NetworkUpgradeBanner.js +1 -72
- package/lib/module/network/components/response-editor/Explorer.js +1 -972
- package/lib/module/network/components/response-editor/Explorer.web.js +1 -1133
- package/lib/module/network/components/response-editor/deleteNestedDataByPath.js +1 -51
- package/lib/module/network/components/response-editor/editorContext.js +1 -29
- package/lib/module/network/components/response-editor/updateNestedDataByPath.js +1 -56
- package/lib/module/network/conditions/NetworkConditionsControl.js +1 -231
- package/lib/module/network/conditions/NetworkConditionsControl.test.js +1 -135
- package/lib/module/network/conditions/NetworkConditionsIcon.js +1 -29
- package/lib/module/network/conditions/NetworkFloatingTool.js +1 -304
- package/lib/module/network/conditions/NetworkFloatingTool.test.js +1 -218
- package/lib/module/network/conditions/store.js +1 -65
- package/lib/module/network/conditions/wait.js +1 -38
- package/lib/module/network/conditions/xhr.js +1 -131
- package/lib/module/network/hooks/useLiveNetworkEvent.js +1 -58
- package/lib/module/network/hooks/useNetworkBadgeCounts.js +1 -79
- package/lib/module/network/hooks/useNetworkEventList.js +1 -104
- package/lib/module/network/hooks/useNetworkEvents.js +1 -314
- package/lib/module/network/hooks/useNetworkHasMatches.js +1 -52
- package/lib/module/network/hooks/useNetworkSaved.js +1 -34
- package/lib/module/network/hooks/useNetworkSelection.js +1 -46
- package/lib/module/network/hooks/useOverrideRules.js +1 -32
- package/lib/module/network/hooks/useTickEveryMinute.js +1 -11
- package/lib/module/network/overrides/applyToFetch.js +1 -72
- package/lib/module/network/overrides/applyToXhr.js +2 -502
- package/lib/module/network/overrides/engine.js +1 -85
- package/lib/module/network/overrides/matchRule.js +1 -81
- package/lib/module/network/overrides/overriddenRows.js +1 -33
- package/lib/module/network/overrides/overrideRulesStore.js +1 -547
- package/lib/module/network/overrides/presets.js +1 -65
- package/lib/module/network/overrides/resolveOverride.js +1 -152
- package/lib/module/network/overrides/types.js +1 -86
- package/lib/module/network/sync/networkBodyResolver.js +1 -34
- package/lib/module/network/sync/networkSyncAdapter.js +1 -880
- package/lib/module/network/sync/overrideHonesty.release.test.js +1 -35
- package/lib/module/network/types/index.js +1 -3
- package/lib/module/network/utils/extractOperationName.js +1 -76
- package/lib/module/network/utils/filterNetworkEvents.js +1 -92
- package/lib/module/network/utils/formatGraphQLVariables.js +1 -213
- package/lib/module/network/utils/formatting.js +1 -9
- package/lib/module/network/utils/generateCurl.js +2 -67
- package/lib/module/network/utils/generateNetworkCopyText.js +37 -162
- package/lib/module/network/utils/httpCompletion.js +1 -32
- package/lib/module/network/utils/networkEventStore.js +1 -409
- package/lib/module/network/utils/networkListener.js +4 -1341
- package/lib/module/network/utils/networkSavedStore.js +3 -572
- package/lib/module/network/utils/networkSelectionStore.js +1 -188
- package/lib/module/network/utils/realNow.js +1 -0
- package/lib/module/network/utils/requestId.js +1 -12
- package/lib/module/network/utils/resolveRequestUrl.js +1 -11
- package/lib/module/network/utils/selectSavedEvents.js +1 -35
- package/lib/module/network/utils/startNetworkCapture.js +1 -21
- package/lib/module/network/utils/withPinnedFirst.js +1 -28
- package/lib/module/preset.js +1 -91
- package/lib/typescript/network/overrides/engine.d.ts +1 -1
- package/lib/typescript/network/overrides/matchRule.d.ts +1 -1
- package/lib/typescript/network/overrides/resolveOverride.d.ts +2 -2
- package/lib/typescript/network/overrides/types.d.ts +9 -0
- package/lib/typescript/network/utils/networkListener.d.ts +11 -0
- package/lib/typescript/network/utils/realNow.d.ts +18 -0
- package/lib/web/index.mjs +73 -74
- package/package.json +3 -6
- package/lib/typescript/index.d.ts.map +0 -1
- package/lib/typescript/index.web.d.ts.map +0 -1
- package/lib/typescript/network/components/DataViewer.web.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkCopyScreen.web.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkCopySettingsView.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkCopySettingsView.web.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkDetailScreen.web.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkDetailStepper.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkDetailStepper.web.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkEventDetailView.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkEventDetailView.web.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkEventItemCompact.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkEventItemCompact.web.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkFilterScreen.web.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkFilterViewV3.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkFilterViewV3.web.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkHeaderLive.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkHeaderLive.web.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkHeaderMenu.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkListScreen.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkListScreen.web.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkModal.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkNumberPrompt.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkNumberPrompt.web.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkOverrideEditor.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkOverrideEditor.web.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkOverrideHeaderButton.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkOverrideHeaderButton.web.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkOverridesButton.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkOverridesButton.web.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkOverridesScreen.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkOverridesScreen.web.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkSavedScreen.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkSavedScreen.web.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkUpgradeBanner.d.ts.map +0 -1
- package/lib/typescript/network/components/response-editor/Explorer.d.ts.map +0 -1
- package/lib/typescript/network/components/response-editor/Explorer.web.d.ts.map +0 -1
- package/lib/typescript/network/components/response-editor/deleteNestedDataByPath.d.ts.map +0 -1
- package/lib/typescript/network/components/response-editor/editorContext.d.ts.map +0 -1
- package/lib/typescript/network/components/response-editor/updateNestedDataByPath.d.ts.map +0 -1
- package/lib/typescript/network/conditions/NetworkConditionsControl.d.ts.map +0 -1
- package/lib/typescript/network/conditions/NetworkConditionsControl.test.d.ts.map +0 -1
- package/lib/typescript/network/conditions/NetworkConditionsIcon.d.ts.map +0 -1
- package/lib/typescript/network/conditions/NetworkFloatingTool.d.ts.map +0 -1
- package/lib/typescript/network/conditions/NetworkFloatingTool.test.d.ts.map +0 -1
- package/lib/typescript/network/conditions/store.d.ts.map +0 -1
- package/lib/typescript/network/conditions/wait.d.ts.map +0 -1
- package/lib/typescript/network/conditions/xhr.d.ts.map +0 -1
- package/lib/typescript/network/hooks/useLiveNetworkEvent.d.ts.map +0 -1
- package/lib/typescript/network/hooks/useNetworkBadgeCounts.d.ts.map +0 -1
- package/lib/typescript/network/hooks/useNetworkEventList.d.ts.map +0 -1
- package/lib/typescript/network/hooks/useNetworkEvents.d.ts.map +0 -1
- package/lib/typescript/network/hooks/useNetworkHasMatches.d.ts.map +0 -1
- package/lib/typescript/network/hooks/useNetworkSaved.d.ts.map +0 -1
- package/lib/typescript/network/hooks/useNetworkSelection.d.ts.map +0 -1
- package/lib/typescript/network/hooks/useOverrideRules.d.ts.map +0 -1
- package/lib/typescript/network/hooks/useTickEveryMinute.d.ts.map +0 -1
- package/lib/typescript/network/overrides/applyToFetch.d.ts.map +0 -1
- package/lib/typescript/network/overrides/applyToXhr.d.ts.map +0 -1
- package/lib/typescript/network/overrides/engine.d.ts.map +0 -1
- package/lib/typescript/network/overrides/matchRule.d.ts.map +0 -1
- package/lib/typescript/network/overrides/overriddenRows.d.ts.map +0 -1
- package/lib/typescript/network/overrides/overrideRulesStore.d.ts.map +0 -1
- package/lib/typescript/network/overrides/presets.d.ts.map +0 -1
- package/lib/typescript/network/overrides/resolveOverride.d.ts.map +0 -1
- package/lib/typescript/network/overrides/types.d.ts.map +0 -1
- package/lib/typescript/network/sync/networkBodyResolver.d.ts.map +0 -1
- package/lib/typescript/network/sync/networkSyncAdapter.d.ts.map +0 -1
- package/lib/typescript/network/sync/overrideHonesty.release.test.d.ts.map +0 -1
- package/lib/typescript/network/types/index.d.ts.map +0 -1
- package/lib/typescript/network/utils/extractOperationName.d.ts.map +0 -1
- package/lib/typescript/network/utils/filterNetworkEvents.d.ts.map +0 -1
- package/lib/typescript/network/utils/formatGraphQLVariables.d.ts.map +0 -1
- package/lib/typescript/network/utils/formatting.d.ts.map +0 -1
- package/lib/typescript/network/utils/generateCurl.d.ts.map +0 -1
- package/lib/typescript/network/utils/generateNetworkCopyText.d.ts.map +0 -1
- package/lib/typescript/network/utils/httpCompletion.d.ts.map +0 -1
- package/lib/typescript/network/utils/networkEventStore.d.ts.map +0 -1
- package/lib/typescript/network/utils/networkListener.d.ts.map +0 -1
- package/lib/typescript/network/utils/networkSavedStore.d.ts.map +0 -1
- package/lib/typescript/network/utils/networkSelectionStore.d.ts.map +0 -1
- package/lib/typescript/network/utils/requestId.d.ts.map +0 -1
- package/lib/typescript/network/utils/resolveRequestUrl.d.ts.map +0 -1
- package/lib/typescript/network/utils/selectSavedEvents.d.ts.map +0 -1
- package/lib/typescript/network/utils/startNetworkCapture.d.ts.map +0 -1
- package/lib/typescript/network/utils/withPinnedFirst.d.ts.map +0 -1
- package/lib/typescript/preset.d.ts.map +0 -1
|
@@ -1,830 +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 _useOverrideRules = require("../hooks/useOverrideRules");
|
|
9
|
-
var _NetworkOverrideEditor = require("./NetworkOverrideEditor.web");
|
|
10
|
-
var _overrideRulesStore = require("../overrides/overrideRulesStore");
|
|
11
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
-
/**
|
|
13
|
-
* NetworkOverridesScreen.web — DOM twin of NetworkOverridesScreen.tsx.
|
|
14
|
-
*
|
|
15
|
-
* The rule manager: what's armed, and how to stop all of it. One bar across
|
|
16
|
-
* the top is both the warning and the switch; rules render in the request
|
|
17
|
-
* row's visual language (card, method badge, monospace path, status colors);
|
|
18
|
-
* the rule editor takes over the whole screen while open, with the header's
|
|
19
|
-
* back press routed through `backHandlerRef` (back-while-editing means "back
|
|
20
|
-
* to the rule list", not "leave overrides").
|
|
21
|
-
*
|
|
22
|
-
* REUSED, not forked (all platform-free): `useOverrideRules`,
|
|
23
|
-
* `overrideRulesStore` (persisting via the shared-ui barrel → the web shim's
|
|
24
|
-
* localStorage `persistentStorage`, SAME `@react_buoy_network_overrides` key
|
|
25
|
-
* + JSON shape as the phone), `isRuleSpent`, the free-tier enforcement, and
|
|
26
|
-
* the pending-draft adoption flow. A rule saved here is picked up by the live
|
|
27
|
-
* `networkListener` through the exact hooks native registers
|
|
28
|
-
* (`setOverrideHooks` at overrideRulesStore import).
|
|
29
|
-
*
|
|
30
|
-
* shared-ui RN chrome is replicated as DOM with provenance (web consumers
|
|
31
|
-
* resolve `@buoy-gg/shared-ui` to a minimal shim):
|
|
32
|
-
* - `macOSColors` / `buoyColors` — inlined verbatim subsets from
|
|
33
|
-
* shared/src/ui/gameUI/constants/.
|
|
34
|
-
* - Icons — inline lucide SVGs (shared-ui's icons are lucide re-exports).
|
|
35
|
-
* - `DevToolsCard` / `MethodBadge` — inlined DOM twins, values from
|
|
36
|
-
* shared/src/ui/components/DevToolsCard.tsx and Badge.tsx (same twins the
|
|
37
|
-
* F2 list rows carry).
|
|
38
|
-
* - `EmptyState` — inlined DOM twin, values from
|
|
39
|
-
* shared/src/ui/components/EmptyState.tsx (including its shipped
|
|
40
|
-
* low-contrast description color, documented there).
|
|
41
|
-
*
|
|
42
|
-
* Intentional deviations (all logged):
|
|
43
|
-
* - `hitSlop` on the row delete button has no DOM equivalent — the button
|
|
44
|
-
* keeps its natural hit area.
|
|
45
|
-
*
|
|
46
|
-
* @platform React DOM Web
|
|
47
|
-
*/
|
|
48
|
-
|
|
49
|
-
// =============================
|
|
50
|
-
// Native palettes (provenance)
|
|
51
|
-
// =============================
|
|
52
|
-
|
|
53
|
-
/** macOSColors subset — shared/src/ui/gameUI/constants/macOSDesignSystemColors.ts, verbatim. */
|
|
54
|
-
const macOSColors = {
|
|
55
|
-
background: {
|
|
56
|
-
base: "#0A0A0C",
|
|
57
|
-
card: "#1A1A1C"
|
|
58
|
-
},
|
|
59
|
-
border: {
|
|
60
|
-
default: "#2D2D2F",
|
|
61
|
-
hover: "#4D4D4F"
|
|
62
|
-
},
|
|
63
|
-
text: {
|
|
64
|
-
primary: "#F5F5F7",
|
|
65
|
-
secondary: "#A1A1A6",
|
|
66
|
-
muted: "#8E8E93",
|
|
67
|
-
icon: "#6D6D6F"
|
|
68
|
-
},
|
|
69
|
-
semantic: {
|
|
70
|
-
success: "#34C759",
|
|
71
|
-
error: "#FF453A",
|
|
72
|
-
warning: "#FFEB3B",
|
|
73
|
-
warningBackground: "rgba(255, 235, 59, 0.15)",
|
|
74
|
-
info: "#00B8E6"
|
|
75
|
-
}
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
/** buoyColors subset — shared/src/ui/gameUI/constants/gameUIColors.ts (macOS theme), verbatim. */
|
|
79
|
-
const buoy = {
|
|
80
|
-
card: "#1A1A1A",
|
|
81
|
-
border: "#333333",
|
|
82
|
-
textSecondary: "#A0A0A0",
|
|
83
|
-
textMuted: "#888888",
|
|
84
|
-
primary: "#20C997",
|
|
85
|
-
success: "#20C997",
|
|
86
|
-
warning: "#FFA94D",
|
|
87
|
-
error: "#EF4444"
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
// =============================
|
|
91
|
-
// Inline lucide icons (shared-ui icons are lucide re-exports)
|
|
92
|
-
// =============================
|
|
93
|
-
|
|
94
|
-
function Svg({
|
|
95
|
-
size = 14,
|
|
96
|
-
color = "currentColor",
|
|
97
|
-
children
|
|
98
|
-
}) {
|
|
99
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)("svg", {
|
|
100
|
-
width: size,
|
|
101
|
-
height: size,
|
|
102
|
-
viewBox: "0 0 24 24",
|
|
103
|
-
fill: "none",
|
|
104
|
-
stroke: color,
|
|
105
|
-
strokeWidth: 2,
|
|
106
|
-
strokeLinecap: "round",
|
|
107
|
-
strokeLinejoin: "round",
|
|
108
|
-
style: {
|
|
109
|
-
flexShrink: 0,
|
|
110
|
-
display: "block"
|
|
111
|
-
},
|
|
112
|
-
children: children
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
const AlertCircle = p => /*#__PURE__*/(0, _jsxRuntime.jsxs)(Svg, {
|
|
116
|
-
...p,
|
|
117
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("circle", {
|
|
118
|
-
cx: "12",
|
|
119
|
-
cy: "12",
|
|
120
|
-
r: "10"
|
|
121
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("line", {
|
|
122
|
-
x1: "12",
|
|
123
|
-
x2: "12",
|
|
124
|
-
y1: "8",
|
|
125
|
-
y2: "12"
|
|
126
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("line", {
|
|
127
|
-
x1: "12",
|
|
128
|
-
x2: "12.01",
|
|
129
|
-
y1: "16",
|
|
130
|
-
y2: "16"
|
|
131
|
-
})]
|
|
132
|
-
});
|
|
133
|
-
const AlertTriangle = p => /*#__PURE__*/(0, _jsxRuntime.jsxs)(Svg, {
|
|
134
|
-
...p,
|
|
135
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
|
|
136
|
-
d: "m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 20h16a2 2 0 0 0 1.73-2Z"
|
|
137
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
|
|
138
|
-
d: "M12 9v4"
|
|
139
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
|
|
140
|
-
d: "M12 17h.01"
|
|
141
|
-
})]
|
|
142
|
-
});
|
|
143
|
-
const FlaskConical = p => /*#__PURE__*/(0, _jsxRuntime.jsxs)(Svg, {
|
|
144
|
-
...p,
|
|
145
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
|
|
146
|
-
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"
|
|
147
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
|
|
148
|
-
d: "M8.5 2h7"
|
|
149
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
|
|
150
|
-
d: "M7 16h10"
|
|
151
|
-
})]
|
|
152
|
-
});
|
|
153
|
-
const Plus = p => /*#__PURE__*/(0, _jsxRuntime.jsxs)(Svg, {
|
|
154
|
-
...p,
|
|
155
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
|
|
156
|
-
d: "M5 12h14"
|
|
157
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
|
|
158
|
-
d: "M12 5v14"
|
|
159
|
-
})]
|
|
160
|
-
});
|
|
161
|
-
const Trash2 = p => /*#__PURE__*/(0, _jsxRuntime.jsxs)(Svg, {
|
|
162
|
-
...p,
|
|
163
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
|
|
164
|
-
d: "M3 6h18"
|
|
165
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
|
|
166
|
-
d: "M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"
|
|
167
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
|
|
168
|
-
d: "M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"
|
|
169
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("line", {
|
|
170
|
-
x1: "10",
|
|
171
|
-
x2: "10",
|
|
172
|
-
y1: "11",
|
|
173
|
-
y2: "17"
|
|
174
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("line", {
|
|
175
|
-
x1: "14",
|
|
176
|
-
x2: "14",
|
|
177
|
-
y1: "11",
|
|
178
|
-
y2: "17"
|
|
179
|
-
})]
|
|
180
|
-
});
|
|
181
|
-
|
|
182
|
-
// =============================
|
|
183
|
-
// shared-ui DOM twins (provenance: Badge.tsx / DevToolsCard.tsx / EmptyState.tsx)
|
|
184
|
-
// =============================
|
|
185
|
-
|
|
186
|
-
/**
|
|
187
|
-
* MethodBadge twin — shared/src/ui/components/Badge.tsx `MethodBadge`
|
|
188
|
-
* (`size="small"`: 6/2 padding, 11px, weight 700, minWidth 45, `${color}15`
|
|
189
|
-
* fill, `${color}40` border, radius 4). METHOD_COLORS map, verbatim — an
|
|
190
|
-
* unknown method (the rule rows' "ANY", or "GET/POST") falls to #6B7280,
|
|
191
|
-
* same as native.
|
|
192
|
-
*/
|
|
193
|
-
const METHOD_COLORS = {
|
|
194
|
-
GET: buoy.success,
|
|
195
|
-
POST: buoy.primary,
|
|
196
|
-
PUT: buoy.warning,
|
|
197
|
-
PATCH: buoy.textSecondary,
|
|
198
|
-
DELETE: buoy.error,
|
|
199
|
-
HEAD: buoy.textMuted,
|
|
200
|
-
OPTIONS: buoy.primary
|
|
201
|
-
};
|
|
202
|
-
function MethodBadgeWeb({
|
|
203
|
-
method
|
|
204
|
-
}) {
|
|
205
|
-
const color = METHOD_COLORS[method.toUpperCase()] || "#6B7280";
|
|
206
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
207
|
-
style: {
|
|
208
|
-
display: "inline-flex",
|
|
209
|
-
alignItems: "center",
|
|
210
|
-
justifyContent: "center",
|
|
211
|
-
minWidth: 45,
|
|
212
|
-
boxSizing: "border-box",
|
|
213
|
-
padding: "2px 6px",
|
|
214
|
-
fontSize: 11,
|
|
215
|
-
fontWeight: 700,
|
|
216
|
-
color,
|
|
217
|
-
backgroundColor: `${color}15`,
|
|
218
|
-
border: `1px solid ${color}40`,
|
|
219
|
-
borderRadius: 4,
|
|
220
|
-
flexShrink: 0
|
|
221
|
-
},
|
|
222
|
-
children: method.toUpperCase()
|
|
223
|
-
});
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
/**
|
|
227
|
-
* DevToolsCard twin — shared/src/ui/components/DevToolsCard.tsx (buoyColors
|
|
228
|
-
* card fill, `${border}40` outline + bottom hairline, radius 8, padding 12,
|
|
229
|
-
* minHeight 44). The rule list zeroes the wrapper margins — the list's own
|
|
230
|
-
* gap spaces rows, same as native `cardWrapper`.
|
|
231
|
-
*/
|
|
232
|
-
function DevToolsCardWeb({
|
|
233
|
-
onPress,
|
|
234
|
-
children,
|
|
235
|
-
contentStyle
|
|
236
|
-
}) {
|
|
237
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
238
|
-
style: {
|
|
239
|
-
margin: 0
|
|
240
|
-
},
|
|
241
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
242
|
-
role: "button",
|
|
243
|
-
tabIndex: 0,
|
|
244
|
-
onClick: onPress,
|
|
245
|
-
onKeyDown: e => {
|
|
246
|
-
if (e.key === "Enter" || e.key === " ") onPress();
|
|
247
|
-
},
|
|
248
|
-
style: {
|
|
249
|
-
backgroundColor: buoy.card,
|
|
250
|
-
border: `1px solid ${buoy.border}40`,
|
|
251
|
-
borderBottom: `1px solid ${buoy.border}`,
|
|
252
|
-
borderRadius: 8,
|
|
253
|
-
padding: 12,
|
|
254
|
-
minHeight: 44,
|
|
255
|
-
boxSizing: "border-box",
|
|
256
|
-
cursor: "pointer",
|
|
257
|
-
...contentStyle
|
|
258
|
-
},
|
|
259
|
-
children: children
|
|
260
|
-
})
|
|
261
|
-
});
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
/**
|
|
265
|
-
* EmptyState twin — shared/src/ui/components/EmptyState.tsx, default variant
|
|
266
|
-
* (icon 48 @ border.hover, 16/500 title in text.icon, 14px description in
|
|
267
|
-
* border.hover — the shipped low-contrast look, documented in the native
|
|
268
|
-
* file).
|
|
269
|
-
*/
|
|
270
|
-
function EmptyStateWeb({
|
|
271
|
-
icon,
|
|
272
|
-
title,
|
|
273
|
-
description
|
|
274
|
-
}) {
|
|
275
|
-
const Icon = icon;
|
|
276
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
277
|
-
style: styles.emptyContainer,
|
|
278
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
279
|
-
style: styles.emptyContent,
|
|
280
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
281
|
-
style: {
|
|
282
|
-
marginBottom: 16
|
|
283
|
-
},
|
|
284
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Icon, {
|
|
285
|
-
size: 48,
|
|
286
|
-
color: macOSColors.border.hover
|
|
287
|
-
})
|
|
288
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
289
|
-
style: styles.emptyTitle,
|
|
290
|
-
children: title
|
|
291
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
292
|
-
style: styles.emptyDescription,
|
|
293
|
-
children: description
|
|
294
|
-
})]
|
|
295
|
-
})
|
|
296
|
-
});
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
// =============================
|
|
300
|
-
// Screen (structure mirrors the native file 1:1)
|
|
301
|
-
// =============================
|
|
302
|
-
|
|
303
|
-
function blankDraft() {
|
|
304
|
-
return {
|
|
305
|
-
enabled: true,
|
|
306
|
-
urlPattern: "",
|
|
307
|
-
kind: "respond",
|
|
308
|
-
status: 500,
|
|
309
|
-
body: "",
|
|
310
|
-
times: null
|
|
311
|
-
};
|
|
312
|
-
}
|
|
313
|
-
function toDraft(rule) {
|
|
314
|
-
const {
|
|
315
|
-
id: _id,
|
|
316
|
-
hits: _hits,
|
|
317
|
-
seen: _seen,
|
|
318
|
-
createdAt: _createdAt,
|
|
319
|
-
...draft
|
|
320
|
-
} = rule;
|
|
321
|
-
return draft;
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
/**
|
|
325
|
-
* Where the rule applies — PATH only, not the whole URL (the host is the same
|
|
326
|
-
* for every rule in a typical app; same reasoning as the request row's
|
|
327
|
-
* `displayUrl`).
|
|
328
|
-
*/
|
|
329
|
-
function patternPath(rule) {
|
|
330
|
-
const path = rule.urlPattern;
|
|
331
|
-
const schemeEnd = path.indexOf("://");
|
|
332
|
-
if (schemeEnd === -1) return path;
|
|
333
|
-
const slash = path.indexOf("/", schemeEnd + 3);
|
|
334
|
-
return slash === -1 ? path.slice(schemeEnd + 3) : path.slice(slash);
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
/** Delay and lifetime, in the editor's own words. Empty for a plain rule. */
|
|
338
|
-
function extrasLine(rule) {
|
|
339
|
-
const parts = [];
|
|
340
|
-
if (rule.delayMs) parts.push(`${rule.delayMs / 1000}s delay`);
|
|
341
|
-
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}×`);
|
|
342
|
-
return parts.join(" · ");
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
/** The outcome's color, on the request list's status scale — a forced 500
|
|
346
|
-
* should look exactly like a real one. */
|
|
347
|
-
function ruleAccent(rule) {
|
|
348
|
-
if (rule.kind === "fail") return macOSColors.semantic.error;
|
|
349
|
-
if (rule.kind === "delay") return macOSColors.semantic.info;
|
|
350
|
-
const status = rule.status ?? 200;
|
|
351
|
-
if (status >= 200 && status < 300) return macOSColors.semantic.success;
|
|
352
|
-
if (status >= 300 && status < 400) return macOSColors.semantic.info;
|
|
353
|
-
return macOSColors.semantic.error;
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
/**
|
|
357
|
-
* One rule, in the request row's visual language — same card, method badge,
|
|
358
|
-
* monospace path and status colors as `NetworkEventItemCompact`. A trash
|
|
359
|
-
* instead of the type chip and chevron; the outcome color floods the left
|
|
360
|
-
* edge only while the rule is live. No per-rule on/off — delete the rule, or
|
|
361
|
-
* pause everything from the master bar. (Native comment.)
|
|
362
|
-
*/
|
|
363
|
-
function RuleRow({
|
|
364
|
-
rule,
|
|
365
|
-
spent,
|
|
366
|
-
onEdit,
|
|
367
|
-
onDelete
|
|
368
|
-
}) {
|
|
369
|
-
const live = rule.enabled && !spent;
|
|
370
|
-
const accent = ruleAccent(rule);
|
|
371
|
-
const extras = extrasLine(rule);
|
|
372
|
-
const method = rule.methods?.length ? rule.methods.join("/") : "ANY";
|
|
373
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(DevToolsCardWeb, {
|
|
374
|
-
onPress: onEdit,
|
|
375
|
-
contentStyle: {
|
|
376
|
-
...styles.card,
|
|
377
|
-
borderLeft: `3px solid ${live ? accent : "transparent"}`
|
|
378
|
-
},
|
|
379
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(MethodBadgeWeb, {
|
|
380
|
-
method: method
|
|
381
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
382
|
-
style: styles.cardMiddle,
|
|
383
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
384
|
-
style: {
|
|
385
|
-
...styles.urlText,
|
|
386
|
-
...(!live ? styles.urlTextOff : null)
|
|
387
|
-
},
|
|
388
|
-
children: patternPath(rule)
|
|
389
|
-
}), extras ? /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
390
|
-
style: styles.extrasText,
|
|
391
|
-
children: extras
|
|
392
|
-
}) : null]
|
|
393
|
-
}), rule.hits > 0 ? /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
394
|
-
style: styles.rowHits,
|
|
395
|
-
children: rule.hits
|
|
396
|
-
}) : null, rule.kind === "fail" ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
|
|
397
|
-
style: styles.failBadge,
|
|
398
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(AlertCircle, {
|
|
399
|
-
size: 10,
|
|
400
|
-
color: macOSColors.semantic.error
|
|
401
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
402
|
-
style: styles.failText,
|
|
403
|
-
children: rule.failKind === "timeout" ? "TIMEOUT" : "OFFLINE"
|
|
404
|
-
})]
|
|
405
|
-
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
406
|
-
style: {
|
|
407
|
-
...styles.statusText,
|
|
408
|
-
color: accent
|
|
409
|
-
},
|
|
410
|
-
children: rule.kind === "delay" ? "PASS" : String(rule.status ?? 200)
|
|
411
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
|
|
412
|
-
type: "button",
|
|
413
|
-
onClick: e => {
|
|
414
|
-
// The delete sits inside the card's press target — stop the row's
|
|
415
|
-
// edit from also firing (native gets this free from nested
|
|
416
|
-
// touchables).
|
|
417
|
-
e.stopPropagation();
|
|
418
|
-
onDelete();
|
|
419
|
-
},
|
|
420
|
-
"aria-label": "Delete rule",
|
|
421
|
-
style: styles.rowDelete,
|
|
422
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Trash2, {
|
|
423
|
-
size: 13,
|
|
424
|
-
color: macOSColors.text.muted
|
|
425
|
-
})
|
|
426
|
-
})]
|
|
427
|
-
});
|
|
428
|
-
}
|
|
429
|
-
/**
|
|
430
|
-
* Stable-router gate — same convention as native: a HIDDEN screen must not
|
|
431
|
-
* subscribe to anything, so the subscribing body is split out and the shell
|
|
432
|
-
* returns null.
|
|
433
|
-
*/
|
|
434
|
-
function NetworkOverridesScreen(props) {
|
|
435
|
-
if (!props.visible) return null;
|
|
436
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(OverridesBody, {
|
|
437
|
-
...props
|
|
438
|
-
});
|
|
439
|
-
}
|
|
440
|
-
function OverridesBody({
|
|
441
|
-
isPro,
|
|
442
|
-
onUpgradePress: _onUpgradePress,
|
|
443
|
-
pendingDraft,
|
|
444
|
-
onPendingConsumed,
|
|
445
|
-
backHandlerRef,
|
|
446
|
-
applySafeAreaInset
|
|
447
|
-
}) {
|
|
448
|
-
const {
|
|
449
|
-
enabled,
|
|
450
|
-
autoPaused,
|
|
451
|
-
rules,
|
|
452
|
-
activeCount,
|
|
453
|
-
setEnabled,
|
|
454
|
-
upsertRule,
|
|
455
|
-
setRuleEnabled,
|
|
456
|
-
removeRule,
|
|
457
|
-
isRuleSpent
|
|
458
|
-
} = (0, _useOverrideRules.useOverrideRules)();
|
|
459
|
-
const [editing, setEditing] = (0, _react.useState)(null);
|
|
460
|
-
|
|
461
|
-
// Reaching this screen proves the app renders, so the launch-safety streak
|
|
462
|
-
// has nothing to guard against — see `noteHealthyLaunch`.
|
|
463
|
-
(0, _react.useEffect)(() => {
|
|
464
|
-
_overrideRulesStore.overrideRulesStore.noteHealthyLaunch();
|
|
465
|
-
}, []);
|
|
466
|
-
|
|
467
|
-
// Back while editing means "back to the rule list", not "leave overrides".
|
|
468
|
-
// Cleared on unmount so a hidden screen can't swallow back presses.
|
|
469
|
-
(0, _react.useEffect)(() => {
|
|
470
|
-
if (!backHandlerRef) return;
|
|
471
|
-
backHandlerRef.current = editing ? () => {
|
|
472
|
-
setEditing(null);
|
|
473
|
-
return true;
|
|
474
|
-
} : null;
|
|
475
|
-
return () => {
|
|
476
|
-
backHandlerRef.current = null;
|
|
477
|
-
};
|
|
478
|
-
}, [backHandlerRef, editing]);
|
|
479
|
-
|
|
480
|
-
/**
|
|
481
|
-
* Open a rule for editing, pulling its body over if this surface doesn't
|
|
482
|
-
* have it. On the device (and this webview) that fetch resolves locally and
|
|
483
|
-
* immediately; the `id` re-check keeps a slow reply from landing in a rule
|
|
484
|
-
* you've since moved on from. (Native comment — kept for parity.)
|
|
485
|
-
*/
|
|
486
|
-
const hydrateBody = (0, _react.useCallback)(id => {
|
|
487
|
-
void _overrideRulesStore.overrideRulesStore.fetchRuleBody(id).then(body => {
|
|
488
|
-
if (body == null) return;
|
|
489
|
-
setEditing(current => current?.id === id ? {
|
|
490
|
-
...current,
|
|
491
|
-
draft: {
|
|
492
|
-
...current.draft,
|
|
493
|
-
body,
|
|
494
|
-
bodyOmitted: undefined
|
|
495
|
-
}
|
|
496
|
-
} : current);
|
|
497
|
-
});
|
|
498
|
-
}, []);
|
|
499
|
-
(0, _react.useEffect)(() => {
|
|
500
|
-
if (!pendingDraft) return;
|
|
501
|
-
const {
|
|
502
|
-
id,
|
|
503
|
-
...draft
|
|
504
|
-
} = pendingDraft;
|
|
505
|
-
setEditing({
|
|
506
|
-
id,
|
|
507
|
-
draft
|
|
508
|
-
});
|
|
509
|
-
if (id && draft.bodyOmitted) hydrateBody(id);
|
|
510
|
-
onPendingConsumed?.();
|
|
511
|
-
}, [pendingDraft, onPendingConsumed, hydrateBody]);
|
|
512
|
-
|
|
513
|
-
/**
|
|
514
|
-
* Leave the editor when the rule it's editing stops existing — without
|
|
515
|
-
* this, Save would upsert the old id and quietly RESURRECT a rule someone
|
|
516
|
-
* had just deleted (dashboard / MCP agent). Only guards existing rules.
|
|
517
|
-
*/
|
|
518
|
-
(0, _react.useEffect)(() => {
|
|
519
|
-
if (!editing?.id) return;
|
|
520
|
-
if (rules.some(rule => rule.id === editing.id)) return;
|
|
521
|
-
setEditing(null);
|
|
522
|
-
}, [editing?.id, rules]);
|
|
523
|
-
const openRule = rule => {
|
|
524
|
-
setEditing({
|
|
525
|
-
id: rule.id,
|
|
526
|
-
draft: toDraft(rule)
|
|
527
|
-
});
|
|
528
|
-
if (rule.bodyOmitted) hydrateBody(rule.id);
|
|
529
|
-
};
|
|
530
|
-
|
|
531
|
-
/**
|
|
532
|
-
* On the free tier a new rule REPLACES the live one rather than being
|
|
533
|
-
* refused — "one override at a time" is a shape a developer understands.
|
|
534
|
-
* (Native comment.)
|
|
535
|
-
*/
|
|
536
|
-
const enforceFreeTier = keepId => {
|
|
537
|
-
if (isPro) return;
|
|
538
|
-
rules.filter(rule => rule.enabled && !isRuleSpent(rule) && rule.id !== keepId).forEach(rule => setRuleEnabled(rule.id, false));
|
|
539
|
-
};
|
|
540
|
-
const handleSave = () => {
|
|
541
|
-
if (!editing) return;
|
|
542
|
-
// Saving always arms the rule — the ONLY way back on for a rule the free
|
|
543
|
-
// tier disabled or that used itself up. (Native comment.)
|
|
544
|
-
const draft = {
|
|
545
|
-
...editing.draft,
|
|
546
|
-
enabled: true,
|
|
547
|
-
urlPattern: editing.draft.urlPattern.trim()
|
|
548
|
-
};
|
|
549
|
-
if (!draft.urlPattern) return;
|
|
550
|
-
const saved = upsertRule({
|
|
551
|
-
...draft,
|
|
552
|
-
id: editing.id
|
|
553
|
-
});
|
|
554
|
-
enforceFreeTier(saved?.id ?? editing.id);
|
|
555
|
-
// Arm the master switch — a deliberately-created rule sitting inert
|
|
556
|
-
// because overrides happen to be paused is the silent-failure this
|
|
557
|
-
// feature can least afford. (Native comment.)
|
|
558
|
-
setEnabled(true);
|
|
559
|
-
setEditing(null);
|
|
560
|
-
};
|
|
561
|
-
if (editing) {
|
|
562
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_NetworkOverrideEditor.NetworkOverrideEditor, {
|
|
563
|
-
draft: editing.draft,
|
|
564
|
-
onChange: draft => setEditing({
|
|
565
|
-
...editing,
|
|
566
|
-
draft
|
|
567
|
-
}),
|
|
568
|
-
onSave: handleSave,
|
|
569
|
-
onCancel: () => setEditing(null),
|
|
570
|
-
saveLabel: editing.id ? "Save" : "Add",
|
|
571
|
-
applySafeAreaInset: applySafeAreaInset
|
|
572
|
-
});
|
|
573
|
-
}
|
|
574
|
-
const hasRules = rules.length > 0;
|
|
575
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
576
|
-
style: styles.root,
|
|
577
|
-
children: [hasRules ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
578
|
-
style: {
|
|
579
|
-
...styles.bar,
|
|
580
|
-
...(enabled && activeCount > 0 ? styles.barOn : null)
|
|
581
|
-
},
|
|
582
|
-
children: [enabled && activeCount > 0 ? /*#__PURE__*/(0, _jsxRuntime.jsx)(AlertTriangle, {
|
|
583
|
-
size: 12,
|
|
584
|
-
color: macOSColors.semantic.warning
|
|
585
|
-
}) : null, /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
586
|
-
style: {
|
|
587
|
-
...styles.barText,
|
|
588
|
-
...(enabled && activeCount > 0 ? styles.barTextOn : null)
|
|
589
|
-
},
|
|
590
|
-
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"
|
|
591
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
|
|
592
|
-
type: "button",
|
|
593
|
-
onClick: () => setEnabled(!(enabled && activeCount > 0)),
|
|
594
|
-
style: styles.barButton,
|
|
595
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
596
|
-
style: styles.barButtonText,
|
|
597
|
-
children: enabled && activeCount > 0 ? "Turn all off" : autoPaused ? "Turn back on" : "Turn on"
|
|
598
|
-
})
|
|
599
|
-
})]
|
|
600
|
-
}) : null, /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
601
|
-
style: styles.listHeader,
|
|
602
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
603
|
-
style: styles.listHeaderText,
|
|
604
|
-
children: hasRules ? `${rules.length} rule${rules.length === 1 ? "" : "s"}` : ""
|
|
605
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
|
|
606
|
-
type: "button",
|
|
607
|
-
onClick: () => setEditing({
|
|
608
|
-
draft: blankDraft()
|
|
609
|
-
}),
|
|
610
|
-
"aria-label": "New override rule",
|
|
611
|
-
style: styles.newButton,
|
|
612
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Plus, {
|
|
613
|
-
size: 14,
|
|
614
|
-
color: macOSColors.semantic.info
|
|
615
|
-
})
|
|
616
|
-
})]
|
|
617
|
-
}), !hasRules ? /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
618
|
-
style: styles.emptyWrap,
|
|
619
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(EmptyStateWeb, {
|
|
620
|
-
icon: FlaskConical,
|
|
621
|
-
title: "Nothing overridden",
|
|
622
|
-
description: "Open any request and tap Override, or + to write a rule."
|
|
623
|
-
})
|
|
624
|
-
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
625
|
-
style: styles.list,
|
|
626
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
627
|
-
style: styles.listContent,
|
|
628
|
-
children: [rules.map(rule => /*#__PURE__*/(0, _jsxRuntime.jsx)(RuleRow, {
|
|
629
|
-
rule: rule,
|
|
630
|
-
spent: isRuleSpent(rule),
|
|
631
|
-
onEdit: () => openRule(rule),
|
|
632
|
-
onDelete: () => removeRule(rule.id)
|
|
633
|
-
}, rule.id)), !isPro ? /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
634
|
-
style: styles.footNote,
|
|
635
|
-
children: "Free: one override at a time. Pro: up to 50."
|
|
636
|
-
}) : null]
|
|
637
|
-
})
|
|
638
|
-
})]
|
|
639
|
-
});
|
|
640
|
-
}
|
|
641
|
-
|
|
642
|
-
// Values mirror the native StyleSheet block 1:1.
|
|
643
|
-
const styles = {
|
|
644
|
-
root: {
|
|
645
|
-
display: "flex",
|
|
646
|
-
flexDirection: "column",
|
|
647
|
-
flex: 1,
|
|
648
|
-
minHeight: 0
|
|
649
|
-
},
|
|
650
|
-
bar: {
|
|
651
|
-
display: "flex",
|
|
652
|
-
flexDirection: "row",
|
|
653
|
-
alignItems: "center",
|
|
654
|
-
gap: 8,
|
|
655
|
-
padding: "10px 12px",
|
|
656
|
-
borderBottom: `1px solid ${macOSColors.border.default}`,
|
|
657
|
-
backgroundColor: macOSColors.background.card
|
|
658
|
-
},
|
|
659
|
-
barOn: {
|
|
660
|
-
borderBottom: `1px solid ${macOSColors.semantic.warning}44`,
|
|
661
|
-
backgroundColor: macOSColors.semantic.warningBackground
|
|
662
|
-
},
|
|
663
|
-
barText: {
|
|
664
|
-
flex: 1,
|
|
665
|
-
minWidth: 0,
|
|
666
|
-
fontSize: 12,
|
|
667
|
-
fontWeight: 600,
|
|
668
|
-
color: macOSColors.text.secondary
|
|
669
|
-
},
|
|
670
|
-
barTextOn: {
|
|
671
|
-
color: macOSColors.semantic.warning
|
|
672
|
-
},
|
|
673
|
-
barButton: {
|
|
674
|
-
padding: "6px 10px",
|
|
675
|
-
borderRadius: 5,
|
|
676
|
-
border: `1px solid ${macOSColors.border.hover}`,
|
|
677
|
-
backgroundColor: macOSColors.background.base,
|
|
678
|
-
cursor: "pointer",
|
|
679
|
-
margin: 0,
|
|
680
|
-
flexShrink: 0
|
|
681
|
-
},
|
|
682
|
-
barButtonText: {
|
|
683
|
-
fontSize: 11,
|
|
684
|
-
fontWeight: 700,
|
|
685
|
-
color: macOSColors.text.primary,
|
|
686
|
-
whiteSpace: "nowrap"
|
|
687
|
-
},
|
|
688
|
-
listHeader: {
|
|
689
|
-
display: "flex",
|
|
690
|
-
flexDirection: "row",
|
|
691
|
-
alignItems: "center",
|
|
692
|
-
justifyContent: "space-between",
|
|
693
|
-
padding: "10px 12px 4px"
|
|
694
|
-
},
|
|
695
|
-
listHeaderText: {
|
|
696
|
-
fontSize: 10,
|
|
697
|
-
fontWeight: 700,
|
|
698
|
-
letterSpacing: 0.6,
|
|
699
|
-
color: macOSColors.text.muted,
|
|
700
|
-
textTransform: "uppercase"
|
|
701
|
-
},
|
|
702
|
-
newButton: {
|
|
703
|
-
display: "inline-flex",
|
|
704
|
-
padding: 6,
|
|
705
|
-
borderRadius: 5,
|
|
706
|
-
border: `1px solid ${macOSColors.border.default}`,
|
|
707
|
-
backgroundColor: macOSColors.background.card,
|
|
708
|
-
cursor: "pointer",
|
|
709
|
-
margin: 0
|
|
710
|
-
},
|
|
711
|
-
emptyWrap: {
|
|
712
|
-
flex: 1,
|
|
713
|
-
minHeight: 0,
|
|
714
|
-
display: "flex",
|
|
715
|
-
flexDirection: "column",
|
|
716
|
-
justifyContent: "center"
|
|
717
|
-
},
|
|
718
|
-
list: {
|
|
719
|
-
flex: 1,
|
|
720
|
-
minHeight: 0,
|
|
721
|
-
overflowY: "auto"
|
|
722
|
-
},
|
|
723
|
-
listContent: {
|
|
724
|
-
padding: 10,
|
|
725
|
-
display: "flex",
|
|
726
|
-
flexDirection: "column",
|
|
727
|
-
gap: 6
|
|
728
|
-
},
|
|
729
|
-
card: {
|
|
730
|
-
display: "flex",
|
|
731
|
-
flexDirection: "row",
|
|
732
|
-
alignItems: "center",
|
|
733
|
-
gap: 8
|
|
734
|
-
},
|
|
735
|
-
cardMiddle: {
|
|
736
|
-
flex: 1,
|
|
737
|
-
minWidth: 0
|
|
738
|
-
},
|
|
739
|
-
// Same type as the request row's URL.
|
|
740
|
-
urlText: {
|
|
741
|
-
fontSize: 12,
|
|
742
|
-
color: macOSColors.text.primary,
|
|
743
|
-
lineHeight: "16px",
|
|
744
|
-
fontFamily: "ui-monospace, Menlo, monospace",
|
|
745
|
-
display: "-webkit-box",
|
|
746
|
-
WebkitLineClamp: 2,
|
|
747
|
-
WebkitBoxOrient: "vertical",
|
|
748
|
-
overflow: "hidden",
|
|
749
|
-
overflowWrap: "anywhere"
|
|
750
|
-
},
|
|
751
|
-
urlTextOff: {
|
|
752
|
-
color: macOSColors.text.muted
|
|
753
|
-
},
|
|
754
|
-
extrasText: {
|
|
755
|
-
fontSize: 10,
|
|
756
|
-
color: macOSColors.text.secondary,
|
|
757
|
-
marginTop: 2
|
|
758
|
-
},
|
|
759
|
-
statusText: {
|
|
760
|
-
fontSize: 11,
|
|
761
|
-
fontWeight: 600,
|
|
762
|
-
flexShrink: 0
|
|
763
|
-
},
|
|
764
|
-
failBadge: {
|
|
765
|
-
display: "inline-flex",
|
|
766
|
-
flexDirection: "row",
|
|
767
|
-
alignItems: "center",
|
|
768
|
-
gap: 2,
|
|
769
|
-
padding: "1px 4px",
|
|
770
|
-
backgroundColor: `${macOSColors.semantic.error}26`,
|
|
771
|
-
borderRadius: 3,
|
|
772
|
-
flexShrink: 0
|
|
773
|
-
},
|
|
774
|
-
failText: {
|
|
775
|
-
fontSize: 10,
|
|
776
|
-
color: macOSColors.semantic.error,
|
|
777
|
-
fontWeight: 600
|
|
778
|
-
},
|
|
779
|
-
rowHits: {
|
|
780
|
-
fontSize: 11,
|
|
781
|
-
fontWeight: 700,
|
|
782
|
-
color: macOSColors.semantic.warning,
|
|
783
|
-
flexShrink: 0
|
|
784
|
-
},
|
|
785
|
-
rowDelete: {
|
|
786
|
-
display: "inline-flex",
|
|
787
|
-
padding: 5,
|
|
788
|
-
borderRadius: 5,
|
|
789
|
-
border: `1px solid ${macOSColors.border.default}`,
|
|
790
|
-
backgroundColor: macOSColors.background.base,
|
|
791
|
-
cursor: "pointer",
|
|
792
|
-
margin: 0,
|
|
793
|
-
flexShrink: 0
|
|
794
|
-
},
|
|
795
|
-
footNote: {
|
|
796
|
-
fontSize: 10,
|
|
797
|
-
lineHeight: "14px",
|
|
798
|
-
color: macOSColors.text.muted,
|
|
799
|
-
padding: "8px 4px 0"
|
|
800
|
-
},
|
|
801
|
-
// EmptyState.tsx styles, verbatim (default variant).
|
|
802
|
-
emptyContainer: {
|
|
803
|
-
flex: 1,
|
|
804
|
-
display: "flex",
|
|
805
|
-
flexDirection: "column",
|
|
806
|
-
justifyContent: "center",
|
|
807
|
-
alignItems: "center",
|
|
808
|
-
padding: 32
|
|
809
|
-
},
|
|
810
|
-
emptyContent: {
|
|
811
|
-
display: "flex",
|
|
812
|
-
flexDirection: "column",
|
|
813
|
-
alignItems: "center",
|
|
814
|
-
maxWidth: 300
|
|
815
|
-
},
|
|
816
|
-
emptyTitle: {
|
|
817
|
-
color: macOSColors.text.icon,
|
|
818
|
-
fontSize: 16,
|
|
819
|
-
fontWeight: 500,
|
|
820
|
-
textAlign: "center",
|
|
821
|
-
marginBottom: 8
|
|
822
|
-
},
|
|
823
|
-
emptyDescription: {
|
|
824
|
-
// Shipped low-contrast look — see the note in the native EmptyState.tsx.
|
|
825
|
-
color: macOSColors.border.hover,
|
|
826
|
-
fontSize: 14,
|
|
827
|
-
textAlign: "center",
|
|
828
|
-
lineHeight: "20px"
|
|
829
|
-
}
|
|
830
|
-
};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.NetworkOverridesScreen=NetworkOverridesScreen;var _react=require("react");var _useOverrideRules=require("../hooks/useOverrideRules");var _NetworkOverrideEditor=require("./NetworkOverrideEditor.web");var _overrideRulesStore=require("../overrides/overrideRulesStore");var _jsxRuntime=require("react/jsx-runtime");const macOSColors={background:{base:"#0A0A0C",card:"#1A1A1C"},border:{default:"#2D2D2F",hover:"#4D4D4F"},text:{primary:"#F5F5F7",secondary:"#A1A1A6",muted:"#8E8E93",icon:"#6D6D6F"},semantic:{success:"#34C759",error:"#FF453A",warning:"#FFEB3B",warningBackground:"rgba(255, 235, 59, 0.15)",info:"#00B8E6"}};const buoy={card:"#1A1A1A",border:"#333333",textSecondary:"#A0A0A0",textMuted:"#888888",primary:"#20C997",success:"#20C997",warning:"#FFA94D",error:"#EF4444"};function Svg({size:e=14,color:t="currentColor",children:n}){return(0,_jsxRuntime.jsx)("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:t,strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0,display:"block"},children:n})}const AlertCircle=e=>(0,_jsxRuntime.jsxs)(Svg,{...e,children:[(0,_jsxRuntime.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,_jsxRuntime.jsx)("line",{x1:"12",x2:"12",y1:"8",y2:"12"}),(0,_jsxRuntime.jsx)("line",{x1:"12",x2:"12.01",y1:"16",y2:"16"})]});const AlertTriangle=e=>(0,_jsxRuntime.jsxs)(Svg,{...e,children:[(0,_jsxRuntime.jsx)("path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 20h16a2 2 0 0 0 1.73-2Z"}),(0,_jsxRuntime.jsx)("path",{d:"M12 9v4"}),(0,_jsxRuntime.jsx)("path",{d:"M12 17h.01"})]});const FlaskConical=e=>(0,_jsxRuntime.jsxs)(Svg,{...e,children:[(0,_jsxRuntime.jsx)("path",{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"}),(0,_jsxRuntime.jsx)("path",{d:"M8.5 2h7"}),(0,_jsxRuntime.jsx)("path",{d:"M7 16h10"})]});const Plus=e=>(0,_jsxRuntime.jsxs)(Svg,{...e,children:[(0,_jsxRuntime.jsx)("path",{d:"M5 12h14"}),(0,_jsxRuntime.jsx)("path",{d:"M12 5v14"})]});const Trash2=e=>(0,_jsxRuntime.jsxs)(Svg,{...e,children:[(0,_jsxRuntime.jsx)("path",{d:"M3 6h18"}),(0,_jsxRuntime.jsx)("path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"}),(0,_jsxRuntime.jsx)("path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"}),(0,_jsxRuntime.jsx)("line",{x1:"10",x2:"10",y1:"11",y2:"17"}),(0,_jsxRuntime.jsx)("line",{x1:"14",x2:"14",y1:"11",y2:"17"})]});const METHOD_COLORS={GET:buoy.success,POST:buoy.primary,PUT:buoy.warning,PATCH:buoy.textSecondary,DELETE:buoy.error,HEAD:buoy.textMuted,OPTIONS:buoy.primary};function MethodBadgeWeb({method:e}){const t=METHOD_COLORS[e.toUpperCase()]||"#6B7280";return(0,_jsxRuntime.jsx)("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",minWidth:45,boxSizing:"border-box",padding:"2px 6px",fontSize:11,fontWeight:700,color:t,backgroundColor:`${t}15`,border:`1px solid ${t}40`,borderRadius:4,flexShrink:0},children:e.toUpperCase()})}function DevToolsCardWeb({onPress:e,children:t,contentStyle:n}){return(0,_jsxRuntime.jsx)("div",{style:{margin:0},children:(0,_jsxRuntime.jsx)("div",{role:"button",tabIndex:0,onClick:e,onKeyDown:o=>{if(o.key==="Enter"||o.key===" ")e()},style:{backgroundColor:buoy.card,border:`1px solid ${buoy.border}40`,borderBottom:`1px solid ${buoy.border}`,borderRadius:8,padding:12,minHeight:44,boxSizing:"border-box",cursor:"pointer",...n},children:t})})}function EmptyStateWeb({icon:e,title:t,description:n}){const o=e;return(0,_jsxRuntime.jsx)("div",{style:styles.emptyContainer,children:(0,_jsxRuntime.jsxs)("div",{style:styles.emptyContent,children:[(0,_jsxRuntime.jsx)("div",{style:{marginBottom:16},children:(0,_jsxRuntime.jsx)(o,{size:48,color:macOSColors.border.hover})}),(0,_jsxRuntime.jsx)("div",{style:styles.emptyTitle,children:t}),(0,_jsxRuntime.jsx)("div",{style:styles.emptyDescription,children:n})]})})}function blankDraft(){return{enabled:true,urlPattern:"",kind:"respond",status:500,body:"",times:null}}function toDraft(e){const{id:t,hits:n,seen:o,createdAt:c,...u}=e;return u}function patternPath(e){const t=e.urlPattern;const n=t.indexOf("://");if(n===-1)return t;const o=t.indexOf("/",n+3);return o===-1?t.slice(n+3):t.slice(o)}function extrasLine(e){const t=[];if(e.delayMs)t.push(`${e.delayMs/1e3}s delay`);if(e.alternate)t.push("every other");else if(e.times===1)t.push("once");else if(typeof e.times==="number")t.push(`${e.times}\xD7`);return t.join(" \xB7 ")}function ruleAccent(e){if(e.kind==="fail")return macOSColors.semantic.error;if(e.kind==="delay")return macOSColors.semantic.info;const t=e.status??200;if(t>=200&&t<300)return macOSColors.semantic.success;if(t>=300&&t<400)return macOSColors.semantic.info;return macOSColors.semantic.error}function RuleRow({rule:e,spent:t,onEdit:n,onDelete:o}){const c=e.enabled&&!t;const u=ruleAccent(e);const l=extrasLine(e);const f=e.methods?.length?e.methods.join("/"):"ANY";return(0,_jsxRuntime.jsxs)(DevToolsCardWeb,{onPress:n,contentStyle:{...styles.card,borderLeft:`3px solid ${c?u:"transparent"}`},children:[(0,_jsxRuntime.jsx)(MethodBadgeWeb,{method:f}),(0,_jsxRuntime.jsxs)("div",{style:styles.cardMiddle,children:[(0,_jsxRuntime.jsx)("div",{style:{...styles.urlText,...!c?styles.urlTextOff:null},children:patternPath(e)}),l?(0,_jsxRuntime.jsx)("div",{style:styles.extrasText,children:l}):null]}),e.hits>0?(0,_jsxRuntime.jsx)("span",{style:styles.rowHits,children:e.hits}):null,e.kind==="fail"?(0,_jsxRuntime.jsxs)("span",{style:styles.failBadge,children:[(0,_jsxRuntime.jsx)(AlertCircle,{size:10,color:macOSColors.semantic.error}),(0,_jsxRuntime.jsx)("span",{style:styles.failText,children:e.failKind==="timeout"?"TIMEOUT":"OFFLINE"})]}):(0,_jsxRuntime.jsx)("span",{style:{...styles.statusText,color:u},children:e.kind==="delay"?"PASS":String(e.status??200)}),(0,_jsxRuntime.jsx)("button",{type:"button",onClick:d=>{d.stopPropagation();o()},"aria-label":"Delete rule",style:styles.rowDelete,children:(0,_jsxRuntime.jsx)(Trash2,{size:13,color:macOSColors.text.muted})})]})}function NetworkOverridesScreen(e){if(!e.visible)return null;return(0,_jsxRuntime.jsx)(OverridesBody,{...e})}function OverridesBody({isPro:e,onUpgradePress:t,pendingDraft:n,onPendingConsumed:o,backHandlerRef:c,applySafeAreaInset:u}){const{enabled:l,autoPaused:f,rules:d,activeCount:x,setEnabled:b,upsertRule:g,setRuleEnabled:j,removeRule:v,isRuleSpent:m}=(0,_useOverrideRules.useOverrideRules)();const[i,a]=(0,_react.useState)(null);(0,_react.useEffect)(()=>{_overrideRulesStore.overrideRulesStore.noteHealthyLaunch()},[]);(0,_react.useEffect)(()=>{if(!c)return;c.current=i?()=>{a(null);return true}:null;return()=>{c.current=null}},[c,i]);const h=(0,_react.useCallback)(r=>{void _overrideRulesStore.overrideRulesStore.fetchRuleBody(r).then(s=>{if(s==null)return;a(p=>p?.id===r?{...p,draft:{...p.draft,body:s,bodyOmitted:void 0}}:p)})},[]);(0,_react.useEffect)(()=>{if(!n)return;const{id:r,...s}=n;a({id:r,draft:s});if(r&&s.bodyOmitted)h(r);o?.()},[n,o,h]);(0,_react.useEffect)(()=>{if(!i?.id)return;if(d.some(r=>r.id===i.id))return;a(null)},[i?.id,d]);const k=r=>{a({id:r.id,draft:toDraft(r)});if(r.bodyOmitted)h(r.id)};const S=r=>{if(e)return;d.filter(s=>s.enabled&&!m(s)&&s.id!==r).forEach(s=>j(s.id,false))};const C=()=>{if(!i)return;const r={...i.draft,enabled:true,urlPattern:i.draft.urlPattern.trim()};if(!r.urlPattern)return;const s=g({...r,id:i.id});S(s?.id??i.id);b(true);a(null)};if(i){return(0,_jsxRuntime.jsx)(_NetworkOverrideEditor.NetworkOverrideEditor,{draft:i.draft,onChange:r=>a({...i,draft:r}),onSave:C,onCancel:()=>a(null),saveLabel:i.id?"Save":"Add",applySafeAreaInset:u})}const y=d.length>0;return(0,_jsxRuntime.jsxs)("div",{style:styles.root,children:[y?(0,_jsxRuntime.jsxs)("div",{style:{...styles.bar,...l&&x>0?styles.barOn:null},children:[l&&x>0?(0,_jsxRuntime.jsx)(AlertTriangle,{size:12,color:macOSColors.semantic.warning}):null,(0,_jsxRuntime.jsx)("span",{style:{...styles.barText,...l&&x>0?styles.barTextOn:null},children:f?"Overrides paused \u2014 they'd been on for 3 launches":l&&x>0?`${x} override${x===1?" is":"s are"} on`:"Overrides are off"}),(0,_jsxRuntime.jsx)("button",{type:"button",onClick:()=>b(!(l&&x>0)),style:styles.barButton,children:(0,_jsxRuntime.jsx)("span",{style:styles.barButtonText,children:l&&x>0?"Turn all off":f?"Turn back on":"Turn on"})})]}):null,(0,_jsxRuntime.jsxs)("div",{style:styles.listHeader,children:[(0,_jsxRuntime.jsx)("span",{style:styles.listHeaderText,children:y?`${d.length} rule${d.length===1?"":"s"}`:""}),(0,_jsxRuntime.jsx)("button",{type:"button",onClick:()=>a({draft:blankDraft()}),"aria-label":"New override rule",style:styles.newButton,children:(0,_jsxRuntime.jsx)(Plus,{size:14,color:macOSColors.semantic.info})})]}),!y?(0,_jsxRuntime.jsx)("div",{style:styles.emptyWrap,children:(0,_jsxRuntime.jsx)(EmptyStateWeb,{icon:FlaskConical,title:"Nothing overridden",description:"Open any request and tap Override, or + to write a rule."})}):(0,_jsxRuntime.jsx)("div",{style:styles.list,children:(0,_jsxRuntime.jsxs)("div",{style:styles.listContent,children:[d.map(r=>(0,_jsxRuntime.jsx)(RuleRow,{rule:r,spent:m(r),onEdit:()=>k(r),onDelete:()=>v(r.id)},r.id)),!e?(0,_jsxRuntime.jsx)("span",{style:styles.footNote,children:"Free: one override at a time. Pro: up to 50."}):null]})})]})}const styles={root:{display:"flex",flexDirection:"column",flex:1,minHeight:0},bar:{display:"flex",flexDirection:"row",alignItems:"center",gap:8,padding:"10px 12px",borderBottom:`1px solid ${macOSColors.border.default}`,backgroundColor:macOSColors.background.card},barOn:{borderBottom:`1px solid ${macOSColors.semantic.warning}44`,backgroundColor:macOSColors.semantic.warningBackground},barText:{flex:1,minWidth:0,fontSize:12,fontWeight:600,color:macOSColors.text.secondary},barTextOn:{color:macOSColors.semantic.warning},barButton:{padding:"6px 10px",borderRadius:5,border:`1px solid ${macOSColors.border.hover}`,backgroundColor:macOSColors.background.base,cursor:"pointer",margin:0,flexShrink:0},barButtonText:{fontSize:11,fontWeight:700,color:macOSColors.text.primary,whiteSpace:"nowrap"},listHeader:{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:"10px 12px 4px"},listHeaderText:{fontSize:10,fontWeight:700,letterSpacing:.6,color:macOSColors.text.muted,textTransform:"uppercase"},newButton:{display:"inline-flex",padding:6,borderRadius:5,border:`1px solid ${macOSColors.border.default}`,backgroundColor:macOSColors.background.card,cursor:"pointer",margin:0},emptyWrap:{flex:1,minHeight:0,display:"flex",flexDirection:"column",justifyContent:"center"},list:{flex:1,minHeight:0,overflowY:"auto"},listContent:{padding:10,display:"flex",flexDirection:"column",gap:6},card:{display:"flex",flexDirection:"row",alignItems:"center",gap:8},cardMiddle:{flex:1,minWidth:0},urlText:{fontSize:12,color:macOSColors.text.primary,lineHeight:"16px",fontFamily:"ui-monospace, Menlo, monospace",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden",overflowWrap:"anywhere"},urlTextOff:{color:macOSColors.text.muted},extrasText:{fontSize:10,color:macOSColors.text.secondary,marginTop:2},statusText:{fontSize:11,fontWeight:600,flexShrink:0},failBadge:{display:"inline-flex",flexDirection:"row",alignItems:"center",gap:2,padding:"1px 4px",backgroundColor:`${macOSColors.semantic.error}26`,borderRadius:3,flexShrink:0},failText:{fontSize:10,color:macOSColors.semantic.error,fontWeight:600},rowHits:{fontSize:11,fontWeight:700,color:macOSColors.semantic.warning,flexShrink:0},rowDelete:{display:"inline-flex",padding:5,borderRadius:5,border:`1px solid ${macOSColors.border.default}`,backgroundColor:macOSColors.background.base,cursor:"pointer",margin:0,flexShrink:0},footNote:{fontSize:10,lineHeight:"14px",color:macOSColors.text.muted,padding:"8px 4px 0"},emptyContainer:{flex:1,display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",padding:32},emptyContent:{display:"flex",flexDirection:"column",alignItems:"center",maxWidth:300},emptyTitle:{color:macOSColors.text.icon,fontSize:16,fontWeight:500,textAlign:"center",marginBottom:8},emptyDescription:{color:macOSColors.border.hover,fontSize:14,textAlign:"center",lineHeight:"20px"}};
|