@buoy-gg/network 7.0.40 → 7.0.42

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (275) hide show
  1. package/README.md +11 -79
  2. package/lib/commonjs/index.js +1 -325
  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 -404
  22. package/lib/commonjs/network/components/NetworkListScreen.web.js +1 -625
  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 -110
  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 -453
  61. package/lib/commonjs/network/overrides/engine.js +1 -93
  62. package/lib/commonjs/network/overrides/matchRule.js +1 -81
  63. package/lib/commonjs/network/overrides/overriddenRows.js +1 -0
  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 -393
  80. package/lib/commonjs/network/utils/networkListener.js +4 -1259
  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 -0
  85. package/lib/commonjs/network/utils/resolveRequestUrl.js +1 -0
  86. package/lib/commonjs/network/utils/selectSavedEvents.js +1 -39
  87. package/lib/commonjs/network/utils/startNetworkCapture.js +1 -0
  88. package/lib/commonjs/network/utils/withPinnedFirst.js +1 -32
  89. package/lib/commonjs/preset.js +1 -102
  90. package/lib/module/index.js +1 -103
  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 -400
  110. package/lib/module/network/components/NetworkListScreen.web.js +1 -623
  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 -106
  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 -446
  149. package/lib/module/network/overrides/engine.js +1 -85
  150. package/lib/module/network/overrides/matchRule.js +1 -75
  151. package/lib/module/network/overrides/overriddenRows.js +1 -0
  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 -391
  168. package/lib/module/network/utils/networkListener.js +4 -1249
  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 -0
  173. package/lib/module/network/utils/resolveRequestUrl.js +1 -0
  174. package/lib/module/network/utils/selectSavedEvents.js +1 -35
  175. package/lib/module/network/utils/startNetworkCapture.js +1 -0
  176. package/lib/module/network/utils/withPinnedFirst.js +1 -28
  177. package/lib/module/preset.js +1 -100
  178. package/lib/typescript/index.d.ts +1 -0
  179. package/lib/typescript/network/overrides/applyToXhr.d.ts +1 -0
  180. package/lib/typescript/network/overrides/engine.d.ts +1 -1
  181. package/lib/typescript/network/overrides/matchRule.d.ts +1 -1
  182. package/lib/typescript/network/overrides/overriddenRows.d.ts +16 -0
  183. package/lib/typescript/network/overrides/resolveOverride.d.ts +2 -2
  184. package/lib/typescript/network/overrides/types.d.ts +9 -0
  185. package/lib/typescript/network/utils/networkListener.d.ts +14 -4
  186. package/lib/typescript/network/utils/networkSavedStore.d.ts +4 -4
  187. package/lib/typescript/network/utils/realNow.d.ts +18 -0
  188. package/lib/typescript/network/utils/requestId.d.ts +2 -0
  189. package/lib/typescript/network/utils/resolveRequestUrl.d.ts +3 -0
  190. package/lib/typescript/network/utils/startNetworkCapture.d.ts +6 -0
  191. package/lib/web/index.mjs +145 -0
  192. package/package.json +32 -10
  193. package/lib/typescript/index.d.ts.map +0 -1
  194. package/lib/typescript/index.web.d.ts.map +0 -1
  195. package/lib/typescript/network/components/DataViewer.web.d.ts.map +0 -1
  196. package/lib/typescript/network/components/NetworkCopyScreen.web.d.ts.map +0 -1
  197. package/lib/typescript/network/components/NetworkCopySettingsView.d.ts.map +0 -1
  198. package/lib/typescript/network/components/NetworkCopySettingsView.web.d.ts.map +0 -1
  199. package/lib/typescript/network/components/NetworkDetailScreen.web.d.ts.map +0 -1
  200. package/lib/typescript/network/components/NetworkDetailStepper.d.ts.map +0 -1
  201. package/lib/typescript/network/components/NetworkDetailStepper.web.d.ts.map +0 -1
  202. package/lib/typescript/network/components/NetworkEventDetailView.d.ts.map +0 -1
  203. package/lib/typescript/network/components/NetworkEventDetailView.web.d.ts.map +0 -1
  204. package/lib/typescript/network/components/NetworkEventItemCompact.d.ts.map +0 -1
  205. package/lib/typescript/network/components/NetworkEventItemCompact.web.d.ts.map +0 -1
  206. package/lib/typescript/network/components/NetworkFilterScreen.web.d.ts.map +0 -1
  207. package/lib/typescript/network/components/NetworkFilterViewV3.d.ts.map +0 -1
  208. package/lib/typescript/network/components/NetworkFilterViewV3.web.d.ts.map +0 -1
  209. package/lib/typescript/network/components/NetworkHeaderLive.d.ts.map +0 -1
  210. package/lib/typescript/network/components/NetworkHeaderLive.web.d.ts.map +0 -1
  211. package/lib/typescript/network/components/NetworkHeaderMenu.d.ts.map +0 -1
  212. package/lib/typescript/network/components/NetworkListScreen.d.ts.map +0 -1
  213. package/lib/typescript/network/components/NetworkListScreen.web.d.ts.map +0 -1
  214. package/lib/typescript/network/components/NetworkModal.d.ts.map +0 -1
  215. package/lib/typescript/network/components/NetworkNumberPrompt.d.ts.map +0 -1
  216. package/lib/typescript/network/components/NetworkNumberPrompt.web.d.ts.map +0 -1
  217. package/lib/typescript/network/components/NetworkOverrideEditor.d.ts.map +0 -1
  218. package/lib/typescript/network/components/NetworkOverrideEditor.web.d.ts.map +0 -1
  219. package/lib/typescript/network/components/NetworkOverrideHeaderButton.d.ts.map +0 -1
  220. package/lib/typescript/network/components/NetworkOverrideHeaderButton.web.d.ts.map +0 -1
  221. package/lib/typescript/network/components/NetworkOverridesButton.d.ts.map +0 -1
  222. package/lib/typescript/network/components/NetworkOverridesButton.web.d.ts.map +0 -1
  223. package/lib/typescript/network/components/NetworkOverridesScreen.d.ts.map +0 -1
  224. package/lib/typescript/network/components/NetworkOverridesScreen.web.d.ts.map +0 -1
  225. package/lib/typescript/network/components/NetworkSavedScreen.d.ts.map +0 -1
  226. package/lib/typescript/network/components/NetworkSavedScreen.web.d.ts.map +0 -1
  227. package/lib/typescript/network/components/NetworkUpgradeBanner.d.ts.map +0 -1
  228. package/lib/typescript/network/components/response-editor/Explorer.d.ts.map +0 -1
  229. package/lib/typescript/network/components/response-editor/Explorer.web.d.ts.map +0 -1
  230. package/lib/typescript/network/components/response-editor/deleteNestedDataByPath.d.ts.map +0 -1
  231. package/lib/typescript/network/components/response-editor/editorContext.d.ts.map +0 -1
  232. package/lib/typescript/network/components/response-editor/updateNestedDataByPath.d.ts.map +0 -1
  233. package/lib/typescript/network/conditions/NetworkConditionsControl.d.ts.map +0 -1
  234. package/lib/typescript/network/conditions/NetworkConditionsControl.test.d.ts.map +0 -1
  235. package/lib/typescript/network/conditions/NetworkConditionsIcon.d.ts.map +0 -1
  236. package/lib/typescript/network/conditions/NetworkFloatingTool.d.ts.map +0 -1
  237. package/lib/typescript/network/conditions/NetworkFloatingTool.test.d.ts.map +0 -1
  238. package/lib/typescript/network/conditions/store.d.ts.map +0 -1
  239. package/lib/typescript/network/conditions/wait.d.ts.map +0 -1
  240. package/lib/typescript/network/conditions/xhr.d.ts.map +0 -1
  241. package/lib/typescript/network/hooks/useLiveNetworkEvent.d.ts.map +0 -1
  242. package/lib/typescript/network/hooks/useNetworkBadgeCounts.d.ts.map +0 -1
  243. package/lib/typescript/network/hooks/useNetworkEventList.d.ts.map +0 -1
  244. package/lib/typescript/network/hooks/useNetworkEvents.d.ts.map +0 -1
  245. package/lib/typescript/network/hooks/useNetworkHasMatches.d.ts.map +0 -1
  246. package/lib/typescript/network/hooks/useNetworkSaved.d.ts.map +0 -1
  247. package/lib/typescript/network/hooks/useNetworkSelection.d.ts.map +0 -1
  248. package/lib/typescript/network/hooks/useOverrideRules.d.ts.map +0 -1
  249. package/lib/typescript/network/hooks/useTickEveryMinute.d.ts.map +0 -1
  250. package/lib/typescript/network/overrides/applyToFetch.d.ts.map +0 -1
  251. package/lib/typescript/network/overrides/applyToXhr.d.ts.map +0 -1
  252. package/lib/typescript/network/overrides/engine.d.ts.map +0 -1
  253. package/lib/typescript/network/overrides/matchRule.d.ts.map +0 -1
  254. package/lib/typescript/network/overrides/overrideRulesStore.d.ts.map +0 -1
  255. package/lib/typescript/network/overrides/presets.d.ts.map +0 -1
  256. package/lib/typescript/network/overrides/resolveOverride.d.ts.map +0 -1
  257. package/lib/typescript/network/overrides/types.d.ts.map +0 -1
  258. package/lib/typescript/network/sync/networkBodyResolver.d.ts.map +0 -1
  259. package/lib/typescript/network/sync/networkSyncAdapter.d.ts.map +0 -1
  260. package/lib/typescript/network/sync/overrideHonesty.release.test.d.ts.map +0 -1
  261. package/lib/typescript/network/types/index.d.ts.map +0 -1
  262. package/lib/typescript/network/utils/extractOperationName.d.ts.map +0 -1
  263. package/lib/typescript/network/utils/filterNetworkEvents.d.ts.map +0 -1
  264. package/lib/typescript/network/utils/formatGraphQLVariables.d.ts.map +0 -1
  265. package/lib/typescript/network/utils/formatting.d.ts.map +0 -1
  266. package/lib/typescript/network/utils/generateCurl.d.ts.map +0 -1
  267. package/lib/typescript/network/utils/generateNetworkCopyText.d.ts.map +0 -1
  268. package/lib/typescript/network/utils/httpCompletion.d.ts.map +0 -1
  269. package/lib/typescript/network/utils/networkEventStore.d.ts.map +0 -1
  270. package/lib/typescript/network/utils/networkListener.d.ts.map +0 -1
  271. package/lib/typescript/network/utils/networkSavedStore.d.ts.map +0 -1
  272. package/lib/typescript/network/utils/networkSelectionStore.d.ts.map +0 -1
  273. package/lib/typescript/network/utils/selectSavedEvents.d.ts.map +0 -1
  274. package/lib/typescript/network/utils/withPinnedFirst.d.ts.map +0 -1
  275. package/lib/typescript/preset.d.ts.map +0 -1
@@ -1,750 +1,27 @@
1
- "use strict";
2
-
3
- import { DynamicFilterView, macOSColors, FileText, FileCode, Link, Zap, Settings, Hash, Eye, ToolbarCopyButton, formatRelativeTime, useFeatureGate, ProFeatureBanner, ExportPreview, monoFont } from "@buoy-gg/shared-ui";
4
- import { DataViewer } from "@buoy-gg/shared-ui/dataViewer";
5
- import { useCallback, useMemo, useState } from "react";
6
- import { Text, StyleSheet, ScrollView, View } from "react-native";
7
- import { useTickEveryMinute } from "../hooks/useTickEveryMinute";
8
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
9
- export const DEFAULT_COPY_SETTINGS = {
10
- includeMethod: true,
11
- includeStatus: true,
12
- includeDuration: true,
13
- includeTimestamp: true,
14
- includeClient: true,
15
- includeSizes: true,
16
- includeErrors: true,
17
- includeRequestHeaders: true,
18
- includeResponseHeaders: true,
19
- includeRequestBody: true,
20
- includeResponseBody: true,
21
- bodySizeThreshold: 10,
22
- format: "markdown",
23
- filterMode: "all"
24
- };
25
-
26
- // Preset configurations for comparison
27
- const PRESET_CONFIGS = {
28
- urls: {
29
- includeMethod: true,
30
- includeStatus: false,
31
- includeDuration: false,
32
- includeTimestamp: false,
33
- includeClient: false,
34
- includeSizes: false,
35
- includeErrors: false,
36
- includeRequestHeaders: false,
37
- includeResponseHeaders: false,
38
- includeRequestBody: false,
39
- includeResponseBody: false,
40
- bodySizeThreshold: 10,
41
- format: "plaintext",
42
- filterMode: "all"
43
- },
44
- llm: {
45
- includeMethod: true,
46
- includeStatus: true,
47
- includeDuration: true,
48
- includeTimestamp: true,
49
- includeClient: true,
50
- includeSizes: true,
51
- includeErrors: true,
52
- includeRequestHeaders: true,
53
- includeResponseHeaders: true,
54
- includeRequestBody: true,
55
- includeResponseBody: true,
56
- bodySizeThreshold: 10,
57
- format: "markdown",
58
- filterMode: "all"
59
- },
60
- json: {
61
- includeMethod: true,
62
- includeStatus: true,
63
- includeDuration: true,
64
- includeTimestamp: true,
65
- includeClient: true,
66
- includeSizes: true,
67
- includeErrors: true,
68
- includeRequestHeaders: true,
69
- includeResponseHeaders: true,
70
- includeRequestBody: true,
71
- includeResponseBody: true,
72
- bodySizeThreshold: -1,
73
- format: "json",
74
- filterMode: "all"
75
- },
76
- full: {
77
- includeMethod: true,
78
- includeStatus: true,
79
- includeDuration: true,
80
- includeTimestamp: true,
81
- includeClient: true,
82
- includeSizes: true,
83
- includeErrors: true,
84
- includeRequestHeaders: true,
85
- includeResponseHeaders: true,
86
- includeRequestBody: true,
87
- includeResponseBody: true,
88
- bodySizeThreshold: -1,
89
- format: "markdown",
90
- filterMode: "all"
91
- }
92
- };
93
- // Detect which preset matches current settings
94
- function detectActivePreset(settings) {
95
- for (const [presetName, presetConfig] of Object.entries(PRESET_CONFIGS)) {
96
- const matches = Object.keys(presetConfig).every(key => presetConfig[key] === settings[key]);
97
- if (matches) return presetName;
98
- }
99
- return null; // No preset matches = Custom
100
- }
101
-
102
- // Size thresholds for warnings
103
- const SIZE_WARNING_THRESHOLD = 100 * 1024; // 100KB - show warning
104
- const SIZE_DANGER_THRESHOLD = 500 * 1024; // 500KB - show danger warning
105
-
106
- // Helper to format bytes for display
107
- function formatBytes(bytes) {
108
- if (bytes < 1024) return `${bytes} B`;
109
- if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;
110
- return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
111
- }
112
- export function NetworkCopySettingsView({
113
- settings,
114
- onSettingsChange,
115
- events = []
116
- }) {
117
- // Check Pro status for gating
118
- const {
119
- isPro
120
- } = useFeatureGate();
121
-
122
- // Use tick for updating relative time
123
- const tick = useTickEveryMinute();
124
-
125
- // State for preview expansion - collapsed by default to prevent crashes
126
- const [isPreviewExpanded, setIsPreviewExpanded] = useState(false);
127
-
128
- // Auto-detect if we have live data
129
- const hasLiveData = events.length > 0;
130
-
131
- // Get the most recent event timestamp for "last updated" display
132
- const lastEventTimestamp = useMemo(() => {
133
- if (!hasLiveData) return null;
134
- const timestamps = events.map(e => typeof e.timestamp === 'number' ? e.timestamp : new Date(e.timestamp).getTime());
135
- return Math.max(...timestamps);
136
- }, [events, hasLiveData]);
137
-
138
- // Detect active preset
139
- const activePreset = useMemo(() => detectActivePreset(settings), [settings]);
140
-
141
- // Quick preset handlers
142
- const applyUrlsPreset = useCallback(() => {
143
- onSettingsChange(PRESET_CONFIGS.urls);
144
- }, [onSettingsChange]);
145
- const applyLLMPreset = useCallback(() => {
146
- onSettingsChange(PRESET_CONFIGS.llm);
147
- }, [onSettingsChange]);
148
- const applyJSONPreset = useCallback(() => {
149
- onSettingsChange(PRESET_CONFIGS.json);
150
- }, [onSettingsChange]);
151
- const applyFullPreset = useCallback(() => {
152
- onSettingsChange(PRESET_CONFIGS.full);
153
- }, [onSettingsChange]);
154
-
155
- // Handle individual option changes
156
- const handleOptionChange = useCallback((optionId, value) => {
157
- const [group, key] = optionId.split("::");
158
- if (group === "preset") {
159
- switch (key) {
160
- case "urls":
161
- applyUrlsPreset();
162
- break;
163
- case "llm":
164
- applyLLMPreset();
165
- break;
166
- case "json":
167
- applyJSONPreset();
168
- break;
169
- case "full":
170
- applyFullPreset();
171
- break;
172
- }
173
- return;
174
- }
175
- if (group === "requestInfo") {
176
- // Toggle boolean value
177
- onSettingsChange({
178
- ...settings,
179
- [key]: !settings[key]
180
- });
181
- return;
182
- }
183
- if (group === "headers") {
184
- // Toggle boolean value
185
- onSettingsChange({
186
- ...settings,
187
- [key]: !settings[key]
188
- });
189
- return;
190
- }
191
- if (group === "body") {
192
- if (key === "bodySizeThreshold") {
193
- onSettingsChange({
194
- ...settings,
195
- bodySizeThreshold: value
196
- });
197
- } else {
198
- // Toggle boolean value
199
- onSettingsChange({
200
- ...settings,
201
- [key]: !settings[key]
202
- });
203
- }
204
- return;
205
- }
206
- if (group === "format") {
207
- onSettingsChange({
208
- ...settings,
209
- format: value
210
- });
211
- return;
212
- }
213
- if (group === "filter") {
214
- onSettingsChange({
215
- ...settings,
216
- filterMode: value
217
- });
218
- }
219
- }, [settings, onSettingsChange, applyUrlsPreset, applyLLMPreset, applyJSONPreset, applyFullPreset]);
220
-
221
- // Mock data for preview
222
- const mockRequestData = useMemo(() => ({
223
- method: "POST",
224
- url: "https://api.example.com/v1/users",
225
- status: 201,
226
- duration: 342,
227
- timestamp: new Date().toISOString(),
228
- requestHeaders: {
229
- "Content-Type": "application/json",
230
- "Authorization": "Bearer ***"
231
- },
232
- responseHeaders: {
233
- "Content-Type": "application/json",
234
- "X-Request-ID": "abc123"
235
- },
236
- requestBody: {
237
- name: "John Doe",
238
- email: "john@example.com"
239
- },
240
- responseBody: {
241
- id: "user_123",
242
- name: "John Doe",
243
- email: "john@example.com",
244
- createdAt: "2025-01-10T12:00:00Z"
245
- }
246
- }), []);
247
-
248
- // Get data source - auto-detect live vs mock
249
- const previewData = useMemo(() => {
250
- if (hasLiveData) {
251
- return events; // Show ALL events
252
- }
253
- // Mock data - return as array for consistency
254
- return [mockRequestData];
255
- }, [hasLiveData, events, mockRequestData]);
256
-
257
- // Estimate the size of the preview content to warn users about large payloads
258
- const estimatedSize = useMemo(() => {
259
- const dataSource = hasLiveData ? events : [mockRequestData];
260
- let totalSize = 0;
261
- for (const eventData of dataSource) {
262
- // Estimate based on what's included
263
- if (settings.includeMethod) {
264
- totalSize += (eventData.url?.length || 0) + 10;
265
- }
266
- if (settings.includeStatus) {
267
- totalSize += 30;
268
- }
269
- if (settings.includeTimestamp) {
270
- totalSize += 30;
271
- }
272
- if (settings.includeRequestHeaders) {
273
- try {
274
- totalSize += JSON.stringify(eventData.requestHeaders || {}).length;
275
- } catch {
276
- totalSize += 100;
277
- }
278
- }
279
- if (settings.includeRequestBody) {
280
- const body = 'requestBody' in eventData ? eventData.requestBody : eventData.requestData;
281
- try {
282
- totalSize += JSON.stringify(body || {}).length;
283
- } catch {
284
- totalSize += 100;
285
- }
286
- }
287
- if (settings.includeResponseBody) {
288
- const body = 'responseBody' in eventData ? eventData.responseBody : eventData.responseData;
289
- try {
290
- totalSize += JSON.stringify(body || {}).length;
291
- } catch {
292
- totalSize += 100;
293
- }
294
- }
295
- }
296
- return totalSize;
297
- }, [hasLiveData, events, mockRequestData, settings]);
298
-
299
- // Determine warning level based on estimated size
300
- const sizeWarningLevel = useMemo(() => {
301
- if (estimatedSize >= SIZE_DANGER_THRESHOLD) return 'danger';
302
- if (estimatedSize >= SIZE_WARNING_THRESHOLD) return 'warning';
303
- return 'none';
304
- }, [estimatedSize]);
305
-
306
- // Generate copy text - should match preview content exactly
307
- const generateCopyText = useCallback(() => {
308
- const dataSource = hasLiveData ? events : [mockRequestData];
309
- const {
310
- format,
311
- includeMethod,
312
- includeStatus,
313
- includeTimestamp,
314
- includeRequestHeaders,
315
- includeRequestBody,
316
- includeResponseBody
317
- } = settings;
318
-
319
- // Build filtered data for a single event
320
- const buildFilteredData = eventData => {
321
- const data = {};
322
- if (includeMethod) {
323
- data.method = eventData.method;
324
- data.url = eventData.url;
325
- }
326
- if (includeStatus) {
327
- data.status = eventData.status;
328
- data.duration = eventData.duration;
329
- }
330
- if (includeTimestamp) {
331
- data.timestamp = eventData.timestamp;
332
- }
333
- if (includeRequestHeaders) {
334
- data.requestHeaders = eventData.requestHeaders;
335
- }
336
- if (includeRequestBody) {
337
- data.requestBody = 'requestBody' in eventData ? eventData.requestBody : eventData.requestData;
338
- }
339
- if (includeResponseBody) {
340
- data.responseBody = 'responseBody' in eventData ? eventData.responseBody : eventData.responseData;
341
- }
342
- return data;
343
- };
344
- if (format === "json") {
345
- const allFilteredData = dataSource.map(buildFilteredData);
346
- return JSON.stringify(allFilteredData, null, 2);
347
- }
348
- if (format === "markdown") {
349
- const allRequests = dataSource.map((eventData, index) => {
350
- const sections = [];
351
- sections.push(`# Request ${index + 1}`);
352
- if (includeMethod) {
353
- sections.push(`\n**${eventData.method}** ${eventData.url}`);
354
- }
355
- const metaInfo = [];
356
- if (includeStatus) {
357
- metaInfo.push(`**Status:** ${eventData.status}`);
358
- metaInfo.push(`**Duration:** ${eventData.duration}ms`);
359
- }
360
- if (includeTimestamp) {
361
- metaInfo.push(`**Timestamp:** ${eventData.timestamp}`);
362
- }
363
- if (metaInfo.length > 0) {
364
- sections.push('\n' + metaInfo.join('\n'));
365
- }
366
- if (includeRequestHeaders) {
367
- const headers = eventData.requestHeaders || {};
368
- sections.push(`\n## Request Headers\n\`\`\`json\n${JSON.stringify(headers, null, 2)}\n\`\`\``);
369
- }
370
- if (includeRequestBody) {
371
- const body = 'requestBody' in eventData ? eventData.requestBody : eventData.requestData;
372
- sections.push(`\n## Request Body\n\`\`\`json\n${JSON.stringify(body || {}, null, 2)}\n\`\`\``);
373
- }
374
- if (includeResponseBody) {
375
- const body = 'responseBody' in eventData ? eventData.responseBody : eventData.responseData;
376
- sections.push(`\n## Response Body\n\`\`\`json\n${JSON.stringify(body || {}, null, 2)}\n\`\`\``);
377
- }
378
- return sections.join('\n');
379
- });
380
- return allRequests.join('\n\n---\n\n') || "No data included";
381
- }
382
-
383
- // Plaintext
384
- const allRequests = dataSource.map((eventData, index) => {
385
- const lines = [];
386
- lines.push(`Request ${index + 1}:`);
387
- if (includeMethod) {
388
- lines.push(`${eventData.method} ${eventData.url}`);
389
- }
390
- if (includeStatus) {
391
- lines.push(`Status: ${eventData.status}`);
392
- lines.push(`Duration: ${eventData.duration}ms`);
393
- }
394
- if (includeTimestamp) {
395
- lines.push(`Timestamp: ${eventData.timestamp}`);
396
- }
397
- if (includeRequestBody) {
398
- const body = 'requestBody' in eventData ? eventData.requestBody : eventData.requestData;
399
- lines.push('\nRequest:');
400
- lines.push(JSON.stringify(body || {}, null, 2));
401
- }
402
- if (includeResponseBody) {
403
- const body = 'responseBody' in eventData ? eventData.responseBody : eventData.responseData;
404
- lines.push('\nResponse:');
405
- lines.push(JSON.stringify(body || {}, null, 2));
406
- }
407
- return lines.join('\n');
408
- });
409
- return allRequests.join('\n\n---\n\n') || "No data included";
410
- }, [hasLiveData, events, mockRequestData, settings]);
411
-
412
- // Generate the expanded preview content (only called when expanded)
413
- const generateExpandedPreviewContent = useCallback(() => {
414
- const dataSource = hasLiveData ? events : [mockRequestData];
415
- const {
416
- format,
417
- includeMethod,
418
- includeStatus,
419
- includeTimestamp,
420
- includeRequestHeaders,
421
- includeRequestBody,
422
- includeResponseBody
423
- } = settings;
424
-
425
- // Build filtered data for a single event
426
- const buildFilteredData = eventData => {
427
- const data = {};
428
- if (includeMethod) {
429
- data.method = eventData.method;
430
- data.url = eventData.url;
431
- }
432
- if (includeStatus) {
433
- data.status = eventData.status;
434
- data.duration = eventData.duration;
435
- }
436
- if (includeTimestamp) {
437
- data.timestamp = eventData.timestamp;
438
- }
439
- if (includeRequestHeaders) {
440
- data.requestHeaders = eventData.requestHeaders;
441
- }
442
- if (includeRequestBody) {
443
- data.requestBody = 'requestBody' in eventData ? eventData.requestBody : eventData.requestData;
444
- }
445
- if (includeResponseBody) {
446
- data.responseBody = 'responseBody' in eventData ? eventData.responseBody : eventData.responseData;
447
- }
448
- return data;
449
- };
450
- if (format === "json") {
451
- const allFilteredData = dataSource.map(buildFilteredData);
452
- return /*#__PURE__*/_jsx(DataViewer, {
453
- data: allFilteredData,
454
- title: "",
455
- showTypeFilter: false
456
- });
457
- }
458
- if (format === "markdown") {
459
- const allRequests = dataSource.map((eventData, index) => {
460
- const sections = [];
461
- sections.push(`# Request ${index + 1}`);
462
- if (includeMethod) {
463
- sections.push(`\n**${eventData.method}** ${eventData.url}`);
464
- }
465
- const metaInfo = [];
466
- if (includeStatus) {
467
- metaInfo.push(`**Status:** ${eventData.status}`);
468
- metaInfo.push(`**Duration:** ${eventData.duration}ms`);
469
- }
470
- if (includeTimestamp) {
471
- metaInfo.push(`**Timestamp:** ${eventData.timestamp}`);
472
- }
473
- if (metaInfo.length > 0) {
474
- sections.push('\n' + metaInfo.join('\n'));
475
- }
476
- if (includeRequestHeaders) {
477
- const headers = eventData.requestHeaders || {};
478
- sections.push(`\n## Request Headers\n\`\`\`json\n${JSON.stringify(headers, null, 2)}\n\`\`\``);
479
- }
480
- if (includeRequestBody) {
481
- const body = 'requestBody' in eventData ? eventData.requestBody : eventData.requestData;
482
- sections.push(`\n## Request Body\n\`\`\`json\n${JSON.stringify(body || {}, null, 2)}\n\`\`\``);
483
- }
484
- if (includeResponseBody) {
485
- const body = 'responseBody' in eventData ? eventData.responseBody : eventData.responseData;
486
- sections.push(`\n## Response Body\n\`\`\`json\n${JSON.stringify(body || {}, null, 2)}\n\`\`\``);
487
- }
488
- return sections.join('\n');
489
- });
490
- const markdown = allRequests.join('\n\n---\n\n');
491
- return /*#__PURE__*/_jsx(ScrollView, {
492
- style: styles.previewScroll,
493
- nestedScrollEnabled: true,
494
- children: /*#__PURE__*/_jsx(Text, {
495
- style: styles.markdownText,
496
- selectable: isPro,
497
- children: markdown || "No data included"
498
- })
499
- });
500
- }
501
-
502
- // Plaintext
503
- const allRequests = dataSource.map((eventData, index) => {
504
- const lines = [];
505
- lines.push(`Request ${index + 1}:`);
506
- if (includeMethod) {
507
- lines.push(`${eventData.method} ${eventData.url}`);
508
- }
509
- if (includeStatus) {
510
- lines.push(`Status: ${eventData.status}`);
511
- lines.push(`Duration: ${eventData.duration}ms`);
512
- }
513
- if (includeTimestamp) {
514
- lines.push(`Timestamp: ${eventData.timestamp}`);
515
- }
516
- if (includeRequestBody) {
517
- const body = 'requestBody' in eventData ? eventData.requestBody : eventData.requestData;
518
- lines.push('\nRequest:');
519
- lines.push(JSON.stringify(body || {}, null, 2));
520
- }
521
- if (includeResponseBody) {
522
- const body = 'responseBody' in eventData ? eventData.responseBody : eventData.responseData;
523
- lines.push('\nResponse:');
524
- lines.push(JSON.stringify(body || {}, null, 2));
525
- }
526
- return lines.join('\n');
527
- });
528
- const plaintext = allRequests.join('\n\n---\n\n');
529
- return /*#__PURE__*/_jsx(ScrollView, {
530
- style: styles.previewScroll,
531
- nestedScrollEnabled: true,
532
- children: /*#__PURE__*/_jsx(Text, {
533
- style: styles.plaintextText,
534
- selectable: isPro,
535
- children: plaintext || "No data included"
536
- })
537
- });
538
- }, [settings, hasLiveData, events, mockRequestData, isPro]);
539
-
540
- // Generate formatted output for copying/preview - with collapsible support
541
- const generatePreviewContent = useCallback(() => {
542
- const dataSource = hasLiveData ? events : [mockRequestData];
543
- const requestCount = dataSource.length;
544
- return /*#__PURE__*/_jsx(ExportPreview, {
545
- expanded: isPreviewExpanded,
546
- onExpandedChange: setIsPreviewExpanded,
547
- summary: `${requestCount} request${requestCount !== 1 ? "s" : ""} • ~${formatBytes(estimatedSize)}`,
548
- warningLevel: sizeWarningLevel,
549
- warningText: {
550
- warning: "Large payload - preview may be slow",
551
- danger: "Very large payload - may cause performance issues"
552
- },
553
- renderBody: generateExpandedPreviewContent
554
- });
555
- }, [settings, hasLiveData, events, mockRequestData, isPreviewExpanded, estimatedSize, sizeWarningLevel, generateExpandedPreviewContent]);
556
-
557
- // Render preview header actions (status label and Copy button)
558
- const renderPreviewHeaderActions = useCallback(() => {
559
- const statusLabel = hasLiveData && lastEventTimestamp ? `Live data • Updated ${formatRelativeTime(lastEventTimestamp, tick)}` : "Mock data (no events captured)";
560
- return /*#__PURE__*/_jsxs(_Fragment, {
561
- children: [/*#__PURE__*/_jsx(Text, {
562
- style: styles.statusLabel,
563
- children: statusLabel
564
- }), /*#__PURE__*/_jsx(ToolbarCopyButton, {
565
- value: generateCopyText()
566
- })]
567
- });
568
- }, [hasLiveData, lastEventTimestamp, tick, generateCopyText]);
569
-
570
- // Render preview content only
571
- const renderPreviewContent = useCallback(() => {
572
- return generatePreviewContent();
573
- }, [generatePreviewContent]);
574
- const dynamicFilterConfig = useMemo(() => ({
575
- sections: [
576
- // Quick Presets Section - Hero element
577
- {
578
- id: "presets",
579
- title: "Presets",
580
- type: "custom",
581
- data: [{
582
- id: "preset::urls",
583
- label: "URLs",
584
- icon: Link,
585
- color: macOSColors.semantic.info,
586
- value: "urls",
587
- isActive: activePreset === "urls"
588
- }, {
589
- id: "preset::llm",
590
- label: "LLM",
591
- icon: Zap,
592
- color: macOSColors.semantic.success,
593
- value: "llm",
594
- isActive: activePreset === "llm"
595
- }, {
596
- id: "preset::json",
597
- label: "JSON",
598
- icon: FileCode,
599
- color: macOSColors.semantic.warning,
600
- value: "json",
601
- isActive: activePreset === "json"
602
- }, {
603
- id: "preset::full",
604
- label: "Full",
605
- icon: FileText,
606
- color: macOSColors.semantic.info,
607
- value: "full",
608
- isActive: activePreset === "full"
609
- }, {
610
- id: "preset::custom",
611
- label: "Custom",
612
- icon: Settings,
613
- color: macOSColors.text.secondary,
614
- value: "custom",
615
- isActive: activePreset === null
616
- }]
617
- },
618
- // Include Section - Consolidated
619
- {
620
- id: "include",
621
- title: "Include",
622
- type: "custom",
623
- data: [{
624
- id: "requestInfo::includeMethod",
625
- label: "URL",
626
- value: "includeMethod",
627
- isActive: settings.includeMethod
628
- }, {
629
- id: "requestInfo::includeStatus",
630
- label: "Status",
631
- value: "includeStatus",
632
- isActive: settings.includeStatus
633
- }, {
634
- id: "requestInfo::includeTimestamp",
635
- label: "Time",
636
- value: "includeTimestamp",
637
- isActive: settings.includeTimestamp
638
- }, {
639
- id: "headers::includeRequestHeaders",
640
- label: "Headers",
641
- value: "includeRequestHeaders",
642
- isActive: settings.includeRequestHeaders
643
- }, {
644
- id: "body::includeRequestBody",
645
- label: "Req Body",
646
- value: "includeRequestBody",
647
- isActive: settings.includeRequestBody
648
- }, {
649
- id: "body::includeResponseBody",
650
- label: "Res Body",
651
- value: "includeResponseBody",
652
- isActive: settings.includeResponseBody
653
- }, {
654
- id: "requestInfo::includeErrors",
655
- label: "Errors",
656
- value: "includeErrors",
657
- isActive: settings.includeErrors
658
- }]
659
- },
660
- // Output Format
661
- {
662
- id: "format",
663
- title: "Format",
664
- type: "custom",
665
- data: [{
666
- id: "format::markdown",
667
- label: "Markdown",
668
- icon: FileText,
669
- color: macOSColors.semantic.info,
670
- value: "markdown",
671
- isActive: settings.format === "markdown"
672
- }, {
673
- id: "format::json",
674
- label: "JSON",
675
- icon: FileCode,
676
- color: macOSColors.semantic.warning,
677
- value: "json",
678
- isActive: settings.format === "json"
679
- }, {
680
- id: "format::plaintext",
681
- label: "Text",
682
- icon: Hash,
683
- color: macOSColors.text.secondary,
684
- value: "plaintext",
685
- isActive: settings.format === "plaintext"
686
- }]
687
- }],
688
- previewSection: {
689
- enabled: true,
690
- title: "PREVIEW",
691
- icon: Eye,
692
- content: renderPreviewContent,
693
- headerActions: renderPreviewHeaderActions
694
- },
695
- onFilterChange: handleOptionChange
696
- }), [settings, handleOptionChange, renderPreviewContent, renderPreviewHeaderActions, activePreset]);
697
-
698
- // For free users, show banner at the top explaining this is a Pro feature
699
- // Users can interact with controls but copy is blocked at the button level
700
- if (!isPro) {
701
- return /*#__PURE__*/_jsxs(View, {
702
- style: styles.gatedContainer,
703
- children: [/*#__PURE__*/_jsx(ProFeatureBanner, {
704
- featureName: "Network Export",
705
- description: "Export network requests to share with your team, debug APIs, or feed into AI tools.",
706
- benefits: ["Export to JSON, Markdown, or plain text", "Customizable copy presets (URLs only, LLM-ready, full data)", "Share request details with teammates", "Feed network data directly to AI assistants"]
707
- }), /*#__PURE__*/_jsx(View, {
708
- style: styles.gatedPreview,
709
- children: /*#__PURE__*/_jsx(DynamicFilterView, {
710
- ...dynamicFilterConfig
711
- })
712
- })]
713
- });
714
- }
715
- return /*#__PURE__*/_jsx(DynamicFilterView, {
716
- ...dynamicFilterConfig
717
- });
718
- }
719
- const styles = StyleSheet.create({
720
- previewScroll: {
721
- maxHeight: 300
722
- },
723
- markdownText: {
724
- fontFamily: monoFont,
725
- fontSize: 11,
726
- color: macOSColors.text.primary,
727
- lineHeight: 18
728
- },
729
- plaintextText: {
730
- fontFamily: monoFont,
731
- fontSize: 11,
732
- color: macOSColors.text.primary,
733
- lineHeight: 18
734
- },
735
- statusLabel: {
736
- fontSize: 11,
737
- fontWeight: "600",
738
- color: macOSColors.text.muted,
739
- marginRight: 8
740
- },
741
- // Collapsible preview styles
742
- // Gated container styles for free users
743
- gatedContainer: {
744
- flex: 1,
745
- padding: 12
746
- },
747
- gatedPreview: {
748
- flex: 1
749
- }
750
- });
1
+ "use strict";import{DynamicFilterView as X,macOSColors as y,FileText as Y,FileCode as Q,Link as se,Zap as te,Settings as oe,Hash as ie,Eye as ue,ToolbarCopyButton as ne,formatRelativeTime as le,useFeatureGate as de,ProFeatureBanner as ce,ExportPreview as ae,monoFont as g}from"@buoy-gg/shared-ui";import{DataViewer as pe}from"@buoy-gg/shared-ui/dataViewer";import{useCallback as q,useMemo as b,useState as me}from"react";import{Text as F,StyleSheet as fe,ScrollView as v,View as D}from"react-native";import{useTickEveryMinute as ye}from"../hooks/useTickEveryMinute";import{jsx as m,Fragment as he,jsxs as ee}from"react/jsx-runtime";export const DEFAULT_COPY_SETTINGS={includeMethod:true,includeStatus:true,includeDuration:true,includeTimestamp:true,includeClient:true,includeSizes:true,includeErrors:true,includeRequestHeaders:true,includeResponseHeaders:true,includeRequestBody:true,includeResponseBody:true,bodySizeThreshold:10,format:"markdown",filterMode:"all"};const k={urls:{includeMethod:true,includeStatus:false,includeDuration:false,includeTimestamp:false,includeClient:false,includeSizes:false,includeErrors:false,includeRequestHeaders:false,includeResponseHeaders:false,includeRequestBody:false,includeResponseBody:false,bodySizeThreshold:10,format:"plaintext",filterMode:"all"},llm:{includeMethod:true,includeStatus:true,includeDuration:true,includeTimestamp:true,includeClient:true,includeSizes:true,includeErrors:true,includeRequestHeaders:true,includeResponseHeaders:true,includeRequestBody:true,includeResponseBody:true,bodySizeThreshold:10,format:"markdown",filterMode:"all"},json:{includeMethod:true,includeStatus:true,includeDuration:true,includeTimestamp:true,includeClient:true,includeSizes:true,includeErrors:true,includeRequestHeaders:true,includeResponseHeaders:true,includeRequestBody:true,includeResponseBody:true,bodySizeThreshold:-1,format:"json",filterMode:"all"},full:{includeMethod:true,includeStatus:true,includeDuration:true,includeTimestamp:true,includeClient:true,includeSizes:true,includeErrors:true,includeRequestHeaders:true,includeResponseHeaders:true,includeRequestBody:true,includeResponseBody:true,bodySizeThreshold:-1,format:"markdown",filterMode:"all"}};function qe(r){for(const[l,c]of Object.entries(k)){const T=Object.keys(c).every(j=>c[j]===r[j]);if(T)return l}return null}const Re=100*1024;const Be=500*1024;function Se(r){if(r<1024)return`${r} B`;if(r<1024*1024)return`${(r/1024).toFixed(1)} KB`;return`${(r/(1024*1024)).toFixed(1)} MB`}export function NetworkCopySettingsView({settings:r,onSettingsChange:l,events:c=[]}){const{isPro:T}=de();const j=ye();const[P,re]=me(false);const a=c.length>0;const O=b(()=>{if(!a)return null;const d=c.map(o=>typeof o.timestamp==="number"?o.timestamp:new Date(o.timestamp).getTime());return Math.max(...d)},[c,a]);const x=b(()=>qe(r),[r]);const L=q(()=>{l(k.urls)},[l]);const z=q(()=>{l(k.llm)},[l]);const I=q(()=>{l(k.json)},[l]);const J=q(()=>{l(k.full)},[l]);const C=q((d,o)=>{const[u,n]=d.split("::");if(u==="preset"){switch(n){case"urls":L();break;case"llm":z();break;case"json":I();break;case"full":J();break}return}if(u==="requestInfo"){l({...r,[n]:!r[n]});return}if(u==="headers"){l({...r,[n]:!r[n]});return}if(u==="body"){if(n==="bodySizeThreshold"){l({...r,bodySizeThreshold:o})}else{l({...r,[n]:!r[n]})}return}if(u==="format"){l({...r,format:o});return}if(u==="filter"){l({...r,filterMode:o})}},[r,l,L,z,I,J]);const h=b(()=>({method:"POST",url:"https://api.example.com/v1/users",status:201,duration:342,timestamp:new Date().toISOString(),requestHeaders:{"Content-Type":"application/json","Authorization":"Bearer ***"},responseHeaders:{"Content-Type":"application/json","X-Request-ID":"abc123"},requestBody:{name:"John Doe",email:"john@example.com"},responseBody:{id:"user_123",name:"John Doe",email:"john@example.com",createdAt:"2025-01-10T12:00:00Z"}}),[]);const be=b(()=>{if(a){return c}return[h]},[a,c,h]);const H=b(()=>{const d=a?c:[h];let o=0;for(const u of d){if(r.includeMethod){o+=(u.url?.length||0)+10}if(r.includeStatus){o+=30}if(r.includeTimestamp){o+=30}if(r.includeRequestHeaders){try{o+=JSON.stringify(u.requestHeaders||{}).length}catch{o+=100}}if(r.includeRequestBody){const n="requestBody"in u?u.requestBody:u.requestData;try{o+=JSON.stringify(n||{}).length}catch{o+=100}}if(r.includeResponseBody){const n="responseBody"in u?u.responseBody:u.responseData;try{o+=JSON.stringify(n||{}).length}catch{o+=100}}}return o},[a,c,h,r]);const _=b(()=>{if(H>=Be)return"danger";if(H>=Re)return"warning";return"none"},[H]);const V=q(()=>{const d=a?c:[h];const{format:o,includeMethod:u,includeStatus:n,includeTimestamp:R,includeRequestHeaders:$,includeRequestBody:B,includeResponseBody:S}=r;const M=t=>{const e={};if(u){e.method=t.method;e.url=t.url}if(n){e.status=t.status;e.duration=t.duration}if(R){e.timestamp=t.timestamp}if($){e.requestHeaders=t.requestHeaders}if(B){e.requestBody="requestBody"in t?t.requestBody:t.requestData}if(S){e.responseBody="responseBody"in t?t.responseBody:t.responseData}return e};if(o==="json"){const t=d.map(M);return JSON.stringify(t,null,2)}if(o==="markdown"){const t=d.map((e,i)=>{const s=[];s.push(`# Request ${i+1}`);if(u){s.push(`
2
+ **${e.method}** ${e.url}`)}const f=[];if(n){f.push(`**Status:** ${e.status}`);f.push(`**Duration:** ${e.duration}ms`)}if(R){f.push(`**Timestamp:** ${e.timestamp}`)}if(f.length>0){s.push("\n"+f.join("\n"))}if($){const p=e.requestHeaders||{};s.push(`
3
+ ## Request Headers
4
+ \`\`\`json
5
+ ${JSON.stringify(p,null,2)}
6
+ \`\`\``)}if(B){const p="requestBody"in e?e.requestBody:e.requestData;s.push(`
7
+ ## Request Body
8
+ \`\`\`json
9
+ ${JSON.stringify(p||{},null,2)}
10
+ \`\`\``)}if(S){const p="responseBody"in e?e.responseBody:e.responseData;s.push(`
11
+ ## Response Body
12
+ \`\`\`json
13
+ ${JSON.stringify(p||{},null,2)}
14
+ \`\`\``)}return s.join("\n")});return t.join("\n\n---\n\n")||"No data included"}const A=d.map((t,e)=>{const i=[];i.push(`Request ${e+1}:`);if(u){i.push(`${t.method} ${t.url}`)}if(n){i.push(`Status: ${t.status}`);i.push(`Duration: ${t.duration}ms`)}if(R){i.push(`Timestamp: ${t.timestamp}`)}if(B){const s="requestBody"in t?t.requestBody:t.requestData;i.push("\nRequest:");i.push(JSON.stringify(s||{},null,2))}if(S){const s="responseBody"in t?t.responseBody:t.responseData;i.push("\nResponse:");i.push(JSON.stringify(s||{},null,2))}return i.join("\n")});return A.join("\n\n---\n\n")||"No data included"},[a,c,h,r]);const U=q(()=>{const d=a?c:[h];const{format:o,includeMethod:u,includeStatus:n,includeTimestamp:R,includeRequestHeaders:$,includeRequestBody:B,includeResponseBody:S}=r;const M=e=>{const i={};if(u){i.method=e.method;i.url=e.url}if(n){i.status=e.status;i.duration=e.duration}if(R){i.timestamp=e.timestamp}if($){i.requestHeaders=e.requestHeaders}if(B){i.requestBody="requestBody"in e?e.requestBody:e.requestData}if(S){i.responseBody="responseBody"in e?e.responseBody:e.responseData}return i};if(o==="json"){const e=d.map(M);return m(pe,{data:e,title:"",showTypeFilter:false})}if(o==="markdown"){const e=d.map((s,f)=>{const p=[];p.push(`# Request ${f+1}`);if(u){p.push(`
15
+ **${s.method}** ${s.url}`)}const E=[];if(n){E.push(`**Status:** ${s.status}`);E.push(`**Duration:** ${s.duration}ms`)}if(R){E.push(`**Timestamp:** ${s.timestamp}`)}if(E.length>0){p.push("\n"+E.join("\n"))}if($){const N=s.requestHeaders||{};p.push(`
16
+ ## Request Headers
17
+ \`\`\`json
18
+ ${JSON.stringify(N,null,2)}
19
+ \`\`\``)}if(B){const N="requestBody"in s?s.requestBody:s.requestData;p.push(`
20
+ ## Request Body
21
+ \`\`\`json
22
+ ${JSON.stringify(N||{},null,2)}
23
+ \`\`\``)}if(S){const N="responseBody"in s?s.responseBody:s.responseData;p.push(`
24
+ ## Response Body
25
+ \`\`\`json
26
+ ${JSON.stringify(N||{},null,2)}
27
+ \`\`\``)}return p.join("\n")});const i=e.join("\n\n---\n\n");return m(v,{style:w.previewScroll,nestedScrollEnabled:true,children:m(F,{style:w.markdownText,selectable:T,children:i||"No data included"})})}const A=d.map((e,i)=>{const s=[];s.push(`Request ${i+1}:`);if(u){s.push(`${e.method} ${e.url}`)}if(n){s.push(`Status: ${e.status}`);s.push(`Duration: ${e.duration}ms`)}if(R){s.push(`Timestamp: ${e.timestamp}`)}if(B){const f="requestBody"in e?e.requestBody:e.requestData;s.push("\nRequest:");s.push(JSON.stringify(f||{},null,2))}if(S){const f="responseBody"in e?e.responseBody:e.responseData;s.push("\nResponse:");s.push(JSON.stringify(f||{},null,2))}return s.join("\n")});const t=A.join("\n\n---\n\n");return m(v,{style:w.previewScroll,nestedScrollEnabled:true,children:m(F,{style:w.plaintextText,selectable:T,children:t||"No data included"})})},[r,a,c,h,T]);const G=q(()=>{const d=a?c:[h];const o=d.length;return m(ae,{expanded:P,onExpandedChange:re,summary:`${o} request${o!==1?"s":""} \u2022 ~${Se(H)}`,warningLevel:_,warningText:{warning:"Large payload - preview may be slow",danger:"Very large payload - may cause performance issues"},renderBody:U})},[r,a,c,h,P,H,_,U]);const W=q(()=>{const d=a&&O?`Live data \u2022 Updated ${le(O,j)}`:"Mock data (no events captured)";return ee(he,{children:[m(F,{style:w.statusLabel,children:d}),m(ne,{value:V()})]})},[a,O,j,V]);const Z=q(()=>{return G()},[G]);const K=b(()=>({sections:[{id:"presets",title:"Presets",type:"custom",data:[{id:"preset::urls",label:"URLs",icon:se,color:y.semantic.info,value:"urls",isActive:x==="urls"},{id:"preset::llm",label:"LLM",icon:te,color:y.semantic.success,value:"llm",isActive:x==="llm"},{id:"preset::json",label:"JSON",icon:Q,color:y.semantic.warning,value:"json",isActive:x==="json"},{id:"preset::full",label:"Full",icon:Y,color:y.semantic.info,value:"full",isActive:x==="full"},{id:"preset::custom",label:"Custom",icon:oe,color:y.text.secondary,value:"custom",isActive:x===null}]},{id:"include",title:"Include",type:"custom",data:[{id:"requestInfo::includeMethod",label:"URL",value:"includeMethod",isActive:r.includeMethod},{id:"requestInfo::includeStatus",label:"Status",value:"includeStatus",isActive:r.includeStatus},{id:"requestInfo::includeTimestamp",label:"Time",value:"includeTimestamp",isActive:r.includeTimestamp},{id:"headers::includeRequestHeaders",label:"Headers",value:"includeRequestHeaders",isActive:r.includeRequestHeaders},{id:"body::includeRequestBody",label:"Req Body",value:"includeRequestBody",isActive:r.includeRequestBody},{id:"body::includeResponseBody",label:"Res Body",value:"includeResponseBody",isActive:r.includeResponseBody},{id:"requestInfo::includeErrors",label:"Errors",value:"includeErrors",isActive:r.includeErrors}]},{id:"format",title:"Format",type:"custom",data:[{id:"format::markdown",label:"Markdown",icon:Y,color:y.semantic.info,value:"markdown",isActive:r.format==="markdown"},{id:"format::json",label:"JSON",icon:Q,color:y.semantic.warning,value:"json",isActive:r.format==="json"},{id:"format::plaintext",label:"Text",icon:ie,color:y.text.secondary,value:"plaintext",isActive:r.format==="plaintext"}]}],previewSection:{enabled:true,title:"PREVIEW",icon:ue,content:Z,headerActions:W},onFilterChange:C}),[r,C,Z,W,x]);if(!T){return ee(D,{style:w.gatedContainer,children:[m(ce,{featureName:"Network Export",description:"Export network requests to share with your team, debug APIs, or feed into AI tools.",benefits:["Export to JSON, Markdown, or plain text","Customizable copy presets (URLs only, LLM-ready, full data)","Share request details with teammates","Feed network data directly to AI assistants"]}),m(D,{style:w.gatedPreview,children:m(X,{...K})})]})}return m(X,{...K})}const w=fe.create({previewScroll:{maxHeight:300},markdownText:{fontFamily:g,fontSize:11,color:y.text.primary,lineHeight:18},plaintextText:{fontFamily:g,fontSize:11,color:y.text.primary,lineHeight:18},statusLabel:{fontSize:11,fontWeight:"600",color:y.text.muted,marginRight:8},gatedContainer:{flex:1,padding:12},gatedPreview:{flex:1}});