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