@api-client/ui 0.0.5 → 0.0.8

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 (326) hide show
  1. package/demo/elements/http/http-assertions.html +3 -0
  2. package/demo/elements/http/http-assertions.ts +1 -1
  3. package/demo/elements/http/http-flows.html +23 -0
  4. package/demo/elements/http/http-flows.ts +92 -0
  5. package/demo/elements/http/index.html +3 -0
  6. package/demo/pages/http-project/main.ts +5 -6
  7. package/dist/bindings/base/StoreBindings.js +4 -4
  8. package/dist/bindings/base/StoreBindings.js.map +1 -1
  9. package/dist/define/dialog/delete-cookie-action-dialog.d.ts +10 -0
  10. package/dist/define/dialog/delete-cookie-action-dialog.d.ts.map +1 -0
  11. package/dist/define/dialog/delete-cookie-action-dialog.js +14 -0
  12. package/dist/define/dialog/delete-cookie-action-dialog.js.map +1 -0
  13. package/dist/define/dialog/set-cookie-action-dialog.d.ts +10 -0
  14. package/dist/define/dialog/set-cookie-action-dialog.d.ts.map +1 -0
  15. package/dist/define/dialog/set-cookie-action-dialog.js +14 -0
  16. package/dist/define/dialog/set-cookie-action-dialog.js.map +1 -0
  17. package/dist/define/http/http-assertions.d.ts +1 -1
  18. package/dist/define/http/http-assertions.d.ts.map +1 -1
  19. package/dist/define/http/http-assertions.js +3 -3
  20. package/dist/define/http/http-assertions.js.map +1 -1
  21. package/dist/define/http/http-flows.d.ts +10 -0
  22. package/dist/define/http/http-flows.d.ts.map +1 -0
  23. package/dist/define/http/http-flows.js +13 -0
  24. package/dist/define/http/http-flows.js.map +1 -0
  25. package/dist/define/ui/ui-divider.d.ts +4 -1
  26. package/dist/define/ui/ui-divider.d.ts.map +1 -1
  27. package/dist/define/ui/ui-divider.js +11 -2
  28. package/dist/define/ui/ui-divider.js.map +1 -1
  29. package/dist/elements/ApiElement.d.ts +4 -0
  30. package/dist/elements/ApiElement.d.ts.map +1 -1
  31. package/dist/elements/ApiElement.js +6 -0
  32. package/dist/elements/ApiElement.js.map +1 -1
  33. package/dist/elements/amf/ApiAuthorizationEditor.element.js +1 -1
  34. package/dist/elements/amf/ApiAuthorizationEditor.element.js.map +1 -1
  35. package/dist/elements/amf/ApiOperationDocument.element.d.ts.map +1 -1
  36. package/dist/elements/amf/ApiOperationDocument.element.js +2 -1
  37. package/dist/elements/amf/ApiOperationDocument.element.js.map +1 -1
  38. package/dist/elements/amf/ApiRequest.element.js +1 -1
  39. package/dist/elements/amf/ApiRequest.element.js.map +1 -1
  40. package/dist/elements/amf/ApiRequestEditor.element.d.ts +0 -1
  41. package/dist/elements/amf/ApiRequestEditor.element.d.ts.map +1 -1
  42. package/dist/elements/amf/ApiRequestEditor.element.js +0 -3
  43. package/dist/elements/amf/ApiRequestEditor.element.js.map +1 -1
  44. package/dist/elements/authorization/ui/Authorization.d.ts +2 -1
  45. package/dist/elements/authorization/ui/Authorization.d.ts.map +1 -1
  46. package/dist/elements/authorization/ui/Authorization.js +0 -3
  47. package/dist/elements/authorization/ui/Authorization.js.map +1 -1
  48. package/dist/elements/dialog/DeleteCookieAction.element.d.ts +20 -0
  49. package/dist/elements/dialog/DeleteCookieAction.element.d.ts.map +1 -0
  50. package/dist/elements/dialog/DeleteCookieAction.element.js +93 -0
  51. package/dist/elements/dialog/DeleteCookieAction.element.js.map +1 -0
  52. package/dist/elements/dialog/DeleteCookieAction.styles.d.ts +3 -0
  53. package/dist/elements/dialog/DeleteCookieAction.styles.d.ts.map +1 -0
  54. package/dist/elements/dialog/DeleteCookieAction.styles.js +13 -0
  55. package/dist/elements/dialog/DeleteCookieAction.styles.js.map +1 -0
  56. package/dist/elements/dialog/Rename.d.ts +7 -6
  57. package/dist/elements/dialog/Rename.d.ts.map +1 -1
  58. package/dist/elements/dialog/Rename.js +7 -6
  59. package/dist/elements/dialog/Rename.js.map +1 -1
  60. package/dist/elements/dialog/SetCookieAction.element.d.ts +22 -0
  61. package/dist/elements/dialog/SetCookieAction.element.d.ts.map +1 -0
  62. package/dist/elements/dialog/SetCookieAction.element.js +173 -0
  63. package/dist/elements/dialog/SetCookieAction.element.js.map +1 -0
  64. package/dist/elements/environment/EnvironmentEditor.d.ts +24 -3
  65. package/dist/elements/environment/EnvironmentEditor.d.ts.map +1 -1
  66. package/dist/elements/environment/EnvironmentEditor.js +69 -23
  67. package/dist/elements/environment/EnvironmentEditor.js.map +1 -1
  68. package/dist/elements/environment/EnvironmentEditor.styles.d.ts.map +1 -1
  69. package/dist/elements/environment/EnvironmentEditor.styles.js +5 -0
  70. package/dist/elements/environment/EnvironmentEditor.styles.js.map +1 -1
  71. package/dist/elements/environment/ServerEditor.d.ts +3 -3
  72. package/dist/elements/environment/ServerEditor.d.ts.map +1 -1
  73. package/dist/elements/environment/ServerEditor.js +3 -6
  74. package/dist/elements/environment/ServerEditor.js.map +1 -1
  75. package/dist/elements/environment/VariablesEditor.d.ts +0 -1
  76. package/dist/elements/environment/VariablesEditor.d.ts.map +1 -1
  77. package/dist/elements/environment/VariablesEditor.js +3 -6
  78. package/dist/elements/environment/VariablesEditor.js.map +1 -1
  79. package/dist/elements/highlight/Prism.styles.d.ts.map +1 -1
  80. package/dist/elements/highlight/Prism.styles.js +12 -5
  81. package/dist/elements/highlight/Prism.styles.js.map +1 -1
  82. package/dist/elements/http/BodyEditor.d.ts +0 -4
  83. package/dist/elements/http/BodyEditor.d.ts.map +1 -1
  84. package/dist/elements/http/BodyEditor.js +10 -16
  85. package/dist/elements/http/BodyEditor.js.map +1 -1
  86. package/dist/elements/http/BodyMultipartEditor.d.ts +3 -16
  87. package/dist/elements/http/BodyMultipartEditor.d.ts.map +1 -1
  88. package/dist/elements/http/BodyMultipartEditor.js +3 -19
  89. package/dist/elements/http/BodyMultipartEditor.js.map +1 -1
  90. package/dist/elements/http/BodyTextEditor.d.ts +0 -1
  91. package/dist/elements/http/BodyTextEditor.d.ts.map +1 -1
  92. package/dist/elements/http/BodyTextEditor.js +0 -3
  93. package/dist/elements/http/BodyTextEditor.js.map +1 -1
  94. package/dist/elements/http/BodyUrlEncodedEditor.d.ts +3 -3
  95. package/dist/elements/http/BodyUrlEncodedEditor.d.ts.map +1 -1
  96. package/dist/elements/http/BodyUrlEncodedEditor.js +3 -5
  97. package/dist/elements/http/BodyUrlEncodedEditor.js.map +1 -1
  98. package/dist/elements/http/HeadersForm.d.ts +0 -4
  99. package/dist/elements/http/HeadersForm.d.ts.map +1 -1
  100. package/dist/elements/http/HeadersForm.js +0 -6
  101. package/dist/elements/http/HeadersForm.js.map +1 -1
  102. package/dist/elements/http/HttpAssertions.element.d.ts +55 -0
  103. package/dist/elements/http/HttpAssertions.element.d.ts.map +1 -0
  104. package/dist/elements/http/HttpAssertions.element.js +264 -0
  105. package/dist/elements/http/HttpAssertions.element.js.map +1 -0
  106. package/dist/elements/http/HttpAssertions.styles.d.ts.map +1 -1
  107. package/dist/elements/http/HttpAssertions.styles.js +7 -156
  108. package/dist/elements/http/HttpAssertions.styles.js.map +1 -1
  109. package/dist/elements/http/HttpFlows.common.d.ts +3 -0
  110. package/dist/elements/http/HttpFlows.common.d.ts.map +1 -0
  111. package/dist/elements/http/HttpFlows.common.js +181 -0
  112. package/dist/elements/http/HttpFlows.common.js.map +1 -0
  113. package/dist/elements/http/HttpFlows.element.d.ts +97 -0
  114. package/dist/elements/http/HttpFlows.element.d.ts.map +1 -0
  115. package/dist/elements/http/HttpFlows.element.js +684 -0
  116. package/dist/elements/http/HttpFlows.element.js.map +1 -0
  117. package/dist/elements/http/HttpFlows.styles.d.ts +3 -0
  118. package/dist/elements/http/HttpFlows.styles.d.ts.map +1 -0
  119. package/dist/elements/http/HttpFlows.styles.js +28 -0
  120. package/dist/elements/http/HttpFlows.styles.js.map +1 -0
  121. package/dist/elements/http/HttpFlowsUi.d.ts +172 -0
  122. package/dist/elements/http/HttpFlowsUi.d.ts.map +1 -0
  123. package/dist/elements/http/HttpFlowsUi.js +1256 -0
  124. package/dist/elements/http/HttpFlowsUi.js.map +1 -0
  125. package/dist/elements/http/RequestConfigElement.d.ts +0 -1
  126. package/dist/elements/http/RequestConfigElement.d.ts.map +1 -1
  127. package/dist/elements/http/RequestConfigElement.js +8 -11
  128. package/dist/elements/http/RequestConfigElement.js.map +1 -1
  129. package/dist/elements/http/RequestEditor.d.ts +10 -10
  130. package/dist/elements/http/RequestEditor.d.ts.map +1 -1
  131. package/dist/elements/http/RequestEditor.js +62 -23
  132. package/dist/elements/http/RequestEditor.js.map +1 -1
  133. package/dist/elements/http/UrlInput.d.ts +3 -3
  134. package/dist/elements/http/UrlInput.d.ts.map +1 -1
  135. package/dist/elements/http/UrlInput.js +2 -2
  136. package/dist/elements/http/UrlInput.js.map +1 -1
  137. package/dist/elements/http/UrlParamsForm.d.ts +0 -1
  138. package/dist/elements/http/UrlParamsForm.d.ts.map +1 -1
  139. package/dist/elements/http/UrlParamsForm.js +0 -3
  140. package/dist/elements/http/UrlParamsForm.js.map +1 -1
  141. package/dist/elements/layout/SplitView.styles.d.ts.map +1 -1
  142. package/dist/elements/layout/SplitView.styles.js +1 -0
  143. package/dist/elements/layout/SplitView.styles.js.map +1 -1
  144. package/dist/elements/navigation/AppNavigationItem.styles.d.ts.map +1 -1
  145. package/dist/elements/navigation/AppNavigationItem.styles.js +2 -0
  146. package/dist/elements/navigation/AppNavigationItem.styles.js.map +1 -1
  147. package/dist/elements/project/HttpProjectRequest.d.ts +2 -1
  148. package/dist/elements/project/HttpProjectRequest.d.ts.map +1 -1
  149. package/dist/elements/project/HttpProjectRequest.js +14 -5
  150. package/dist/elements/project/HttpProjectRequest.js.map +1 -1
  151. package/dist/elements/project/ProjectRunner.d.ts +0 -1
  152. package/dist/elements/project/ProjectRunner.d.ts.map +1 -1
  153. package/dist/elements/project/ProjectRunner.js +1 -4
  154. package/dist/elements/project/ProjectRunner.js.map +1 -1
  155. package/dist/elements/schema-design/AssociationFormElement.d.ts +0 -1
  156. package/dist/elements/schema-design/AssociationFormElement.d.ts.map +1 -1
  157. package/dist/elements/schema-design/AssociationFormElement.js +2 -5
  158. package/dist/elements/schema-design/AssociationFormElement.js.map +1 -1
  159. package/dist/elements/schema-design/DataEntityEditorElement.d.ts +2 -2
  160. package/dist/elements/schema-design/DataEntityEditorElement.d.ts.map +1 -1
  161. package/dist/elements/schema-design/DataEntityEditorElement.js +5 -5
  162. package/dist/elements/schema-design/DataEntityEditorElement.js.map +1 -1
  163. package/dist/elements/schema-design/DataSchemaDocument.d.ts +0 -1
  164. package/dist/elements/schema-design/DataSchemaDocument.d.ts.map +1 -1
  165. package/dist/elements/schema-design/DataSchemaDocument.js +4 -7
  166. package/dist/elements/schema-design/DataSchemaDocument.js.map +1 -1
  167. package/dist/elements/schema-design/EntityFormElement.d.ts +0 -1
  168. package/dist/elements/schema-design/EntityFormElement.d.ts.map +1 -1
  169. package/dist/elements/schema-design/EntityFormElement.js +4 -7
  170. package/dist/elements/schema-design/EntityFormElement.js.map +1 -1
  171. package/dist/elements/schema-design/PropertyFormElement.d.ts +1 -2
  172. package/dist/elements/schema-design/PropertyFormElement.d.ts.map +1 -1
  173. package/dist/elements/schema-design/PropertyFormElement.js +8 -11
  174. package/dist/elements/schema-design/PropertyFormElement.js.map +1 -1
  175. package/dist/pages/ApplicationScreen.d.ts +1 -1
  176. package/dist/pages/ApplicationScreen.d.ts.map +1 -1
  177. package/dist/pages/ApplicationScreen.js +1 -1
  178. package/dist/pages/ApplicationScreen.js.map +1 -1
  179. package/dist/pages/api-client/ApiClient.styles.d.ts.map +1 -1
  180. package/dist/pages/api-client/ApiClient.styles.js +22 -3
  181. package/dist/pages/api-client/ApiClient.styles.js.map +1 -1
  182. package/dist/pages/api-client/Authenticate.screen.d.ts +2 -0
  183. package/dist/pages/api-client/Authenticate.screen.d.ts.map +1 -1
  184. package/dist/pages/api-client/Authenticate.screen.js +19 -3
  185. package/dist/pages/api-client/Authenticate.screen.js.map +1 -1
  186. package/dist/pages/api-client/StoreConfig.screen.d.ts.map +1 -1
  187. package/dist/pages/api-client/StoreConfig.screen.js +4 -2
  188. package/dist/pages/api-client/StoreConfig.screen.js.map +1 -1
  189. package/dist/pages/api-client/StoreConfig.styles.d.ts.map +1 -1
  190. package/dist/pages/api-client/StoreConfig.styles.js +5 -0
  191. package/dist/pages/api-client/StoreConfig.styles.js.map +1 -1
  192. package/dist/pages/api-client/pages/Files.page.d.ts +1 -0
  193. package/dist/pages/api-client/pages/Files.page.d.ts.map +1 -1
  194. package/dist/pages/api-client/pages/Files.page.js +2 -1
  195. package/dist/pages/api-client/pages/Files.page.js.map +1 -1
  196. package/dist/pages/http-project/HttpProject.screen.d.ts +0 -8
  197. package/dist/pages/http-project/HttpProject.screen.d.ts.map +1 -1
  198. package/dist/pages/http-project/HttpProject.screen.js +14 -15
  199. package/dist/pages/http-project/HttpProject.screen.js.map +1 -1
  200. package/dist/pages/http-project/types.d.ts +8 -6
  201. package/dist/pages/http-project/types.d.ts.map +1 -1
  202. package/dist/pages/http-project/types.js.map +1 -1
  203. package/dist/styles/m3/surface.module.d.ts.map +1 -1
  204. package/dist/styles/m3/surface.module.js +11 -27
  205. package/dist/styles/m3/surface.module.js.map +1 -1
  206. package/dist/ui/UiElement.d.ts +4 -0
  207. package/dist/ui/UiElement.d.ts.map +1 -1
  208. package/dist/ui/UiElement.js +6 -0
  209. package/dist/ui/UiElement.js.map +1 -1
  210. package/dist/ui/button/SegmentedButton.styles.d.ts.map +1 -1
  211. package/dist/ui/button/SegmentedButton.styles.js +3 -1
  212. package/dist/ui/button/SegmentedButton.styles.js.map +1 -1
  213. package/dist/ui/dialog/UiDialog.d.ts +3 -0
  214. package/dist/ui/dialog/UiDialog.d.ts.map +1 -1
  215. package/dist/ui/dialog/UiDialog.js +3 -0
  216. package/dist/ui/dialog/UiDialog.js.map +1 -1
  217. package/dist/ui/effects/ripple.d.ts.map +1 -1
  218. package/dist/ui/effects/ripple.js +5 -1
  219. package/dist/ui/effects/ripple.js.map +1 -1
  220. package/dist/ui/icons/Icons.d.ts +3 -2
  221. package/dist/ui/icons/Icons.d.ts.map +1 -1
  222. package/dist/ui/icons/Icons.js +2 -1
  223. package/dist/ui/icons/Icons.js.map +1 -1
  224. package/dist/ui/input/CheckedElement.d.ts +1 -1
  225. package/dist/ui/input/CheckedElement.d.ts.map +1 -1
  226. package/dist/ui/input/CheckedElement.js +3 -3
  227. package/dist/ui/input/CheckedElement.js.map +1 -1
  228. package/dist/ui/input/Input.js +1 -1
  229. package/dist/ui/input/Input.js.map +1 -1
  230. package/dist/ui/list/{DividerElement.d.ts → UiDivider.element.d.ts} +6 -6
  231. package/dist/ui/list/UiDivider.element.d.ts.map +1 -0
  232. package/dist/ui/list/UiDivider.element.js +39 -0
  233. package/dist/ui/list/UiDivider.element.js.map +1 -0
  234. package/dist/ui/list/UiDivider.styles.d.ts +3 -0
  235. package/dist/ui/list/UiDivider.styles.d.ts.map +1 -0
  236. package/dist/ui/list/UiDivider.styles.js +49 -0
  237. package/dist/ui/list/UiDivider.styles.js.map +1 -0
  238. package/dist/ui/tabs/UiTabs.d.ts +13 -1
  239. package/dist/ui/tabs/UiTabs.d.ts.map +1 -1
  240. package/dist/ui/tabs/UiTabs.js +42 -13
  241. package/dist/ui/tabs/UiTabs.js.map +1 -1
  242. package/package.json +1 -1
  243. package/src/bindings/base/StoreBindings.ts +4 -4
  244. package/src/define/dialog/delete-cookie-action-dialog.ts +16 -0
  245. package/src/define/dialog/set-cookie-action-dialog.ts +16 -0
  246. package/src/define/http/http-assertions.ts +3 -3
  247. package/src/define/http/http-flows.ts +15 -0
  248. package/src/define/ui/ui-divider.ts +7 -2
  249. package/src/elements/ApiElement.ts +7 -0
  250. package/src/elements/amf/ApiAuthorizationEditor.element.ts +1 -1
  251. package/src/elements/amf/ApiOperationDocument.element.ts +2 -1
  252. package/src/elements/amf/ApiRequest.element.ts +1 -1
  253. package/src/elements/amf/ApiRequestEditor.element.ts +0 -4
  254. package/src/elements/authorization/ui/Authorization.ts +3 -5
  255. package/src/elements/dialog/DeleteCookieAction.element.ts +100 -0
  256. package/src/elements/dialog/DeleteCookieAction.styles.ts +14 -0
  257. package/src/elements/dialog/Rename.ts +8 -7
  258. package/src/elements/dialog/SetCookieAction.element.ts +183 -0
  259. package/src/elements/environment/EnvironmentEditor.styles.ts +5 -0
  260. package/src/elements/environment/EnvironmentEditor.ts +81 -22
  261. package/src/elements/environment/ServerEditor.ts +4 -8
  262. package/src/elements/environment/VariablesEditor.ts +3 -7
  263. package/src/elements/highlight/Prism.styles.ts +12 -5
  264. package/src/elements/http/BodyEditor.ts +10 -17
  265. package/src/elements/http/BodyMultipartEditor.ts +3 -20
  266. package/src/elements/http/BodyTextEditor.ts +0 -4
  267. package/src/elements/http/BodyUrlEncodedEditor.ts +5 -8
  268. package/src/elements/http/HeadersForm.ts +2 -9
  269. package/src/elements/http/HttpAssertions.element.ts +286 -0
  270. package/src/elements/http/HttpAssertions.styles.ts +7 -156
  271. package/src/elements/http/HttpFlows.common.ts +181 -0
  272. package/src/elements/http/HttpFlows.element.ts +722 -0
  273. package/src/elements/http/HttpFlows.styles.ts +29 -0
  274. package/src/elements/http/HttpFlowsUi.ts +1327 -0
  275. package/src/elements/http/RequestConfigElement.ts +10 -14
  276. package/src/elements/http/RequestEditor.ts +77 -35
  277. package/src/elements/http/UrlInput.ts +6 -6
  278. package/src/elements/http/UrlParamsForm.ts +2 -6
  279. package/src/elements/layout/SplitView.styles.ts +1 -0
  280. package/src/elements/navigation/AppNavigationItem.styles.ts +2 -0
  281. package/src/elements/project/HttpProjectRequest.ts +16 -5
  282. package/src/elements/project/ProjectRunner.ts +3 -7
  283. package/src/elements/schema-design/AssociationFormElement.ts +4 -8
  284. package/src/elements/schema-design/DataEntityEditorElement.ts +8 -8
  285. package/src/elements/schema-design/DataSchemaDocument.ts +5 -9
  286. package/src/elements/schema-design/EntityFormElement.ts +6 -10
  287. package/src/elements/schema-design/PropertyFormElement.ts +11 -15
  288. package/src/pages/ApplicationScreen.ts +1 -1
  289. package/src/pages/api-client/ApiClient.styles.ts +22 -3
  290. package/src/pages/api-client/Authenticate.screen.ts +19 -3
  291. package/src/pages/api-client/StoreConfig.screen.ts +4 -2
  292. package/src/pages/api-client/StoreConfig.styles.ts +5 -0
  293. package/src/pages/api-client/pages/Files.page.ts +2 -1
  294. package/src/pages/http-project/HttpProject.screen.ts +14 -26
  295. package/src/pages/http-project/types.ts +8 -6
  296. package/src/styles/m3/surface.module.ts +11 -27
  297. package/src/styles/m3/theme.css +36 -0
  298. package/src/styles/m3/tokens.css +11 -0
  299. package/src/ui/UiElement.ts +7 -0
  300. package/src/ui/button/SegmentedButton.styles.ts +3 -1
  301. package/src/ui/dialog/UiDialog.ts +3 -0
  302. package/src/ui/effects/ripple.ts +6 -1
  303. package/src/ui/icons/Icons.ts +3 -2
  304. package/src/ui/input/CheckedElement.ts +3 -3
  305. package/src/ui/input/Input.ts +1 -1
  306. package/src/ui/list/UiDivider.element.ts +41 -0
  307. package/src/ui/list/UiDivider.styles.ts +49 -0
  308. package/src/ui/tabs/UiTabs.ts +55 -13
  309. package/test/amf/authorization/OAuth2Method.test.ts +1 -1
  310. package/test/elements/http/HttpAssertions.test.ts +5 -6
  311. package/test/elements/http/HttpFlows.test.ts +485 -0
  312. package/dist/elements/http/HttpAssertions.d.ts +0 -114
  313. package/dist/elements/http/HttpAssertions.d.ts.map +0 -1
  314. package/dist/elements/http/HttpAssertions.js +0 -1146
  315. package/dist/elements/http/HttpAssertions.js.map +0 -1
  316. package/dist/elements/http/internals.d.ts +0 -150
  317. package/dist/elements/http/internals.d.ts.map +0 -1
  318. package/dist/elements/http/internals.js +0 -150
  319. package/dist/elements/http/internals.js.map +0 -1
  320. package/dist/ui/list/DividerElement.d.ts.map +0 -1
  321. package/dist/ui/list/DividerElement.js +0 -82
  322. package/dist/ui/list/DividerElement.js.map +0 -1
  323. package/src/elements/http/HttpAssertions.ts +0 -1187
  324. package/src/elements/http/internals.ts +0 -151
  325. package/src/http-client/docs/Files.md +0 -28
  326. package/src/ui/list/DividerElement.ts +0 -84
@@ -0,0 +1,1256 @@
1
+ /* eslint-disable no-param-reassign */
2
+ import { FlowSourceEnum, FlowRequestDataEnum, DataSteps, FlowResponseDataEnum, TransformationSteps, HttpAssertions as CoreAssertions, AmfNamespace, } from "@api-client/core/build/browser.js";
3
+ import { live } from "lit/directives/live.js";
4
+ import { html, nothing } from "lit";
5
+ import { ifDefined } from "lit/directives/if-defined.js";
6
+ import ApiElement from "../ApiElement.js";
7
+ import '../../define/ui/ui-list.js';
8
+ import '../../define/ui/ui-list-item.js';
9
+ import '../../define/ui/ui-dropdown-list.js';
10
+ import '../../define/ui/ui-icon.js';
11
+ import '../../define/ui/ui-icon-button.js';
12
+ import '../../define/ui/ui-text-field.js';
13
+ import '../../define/ui/ui-chip.js';
14
+ import '../../define/ui/ui-dialog.js';
15
+ import '../../define/dialog/delete-cookie-action-dialog.js';
16
+ import '../../define/dialog/set-cookie-action-dialog.js';
17
+ /**
18
+ * The base UI class for HTTP flows and assertions
19
+ * since they are practically the same concept.
20
+ */
21
+ export class HttpFlowsUi extends ApiElement {
22
+ /**
23
+ * Checks whether the dragged element has the required content in the data transfer.
24
+ */
25
+ isValidDropTarget(dataTransfer) {
26
+ if (!dataTransfer) {
27
+ return false;
28
+ }
29
+ const { types } = dataTransfer;
30
+ return types.includes('flow/group') && types.includes('flow/kind');
31
+ }
32
+ /**
33
+ * Handles the suggestion chip drag start event.
34
+ */
35
+ handleChipDragStart(e) {
36
+ const { dataTransfer } = e;
37
+ if (!dataTransfer) {
38
+ return;
39
+ }
40
+ const chip = e.target;
41
+ const { group, kind, source, data, variant } = chip.dataset;
42
+ if (!group || !kind) {
43
+ return;
44
+ }
45
+ this.illustrateDraggedChip(chip, dataTransfer);
46
+ dataTransfer.setData('flow/group', group);
47
+ dataTransfer.setData('flow/kind', kind);
48
+ dataTransfer.setData(`flow/${group}`, '');
49
+ dataTransfer.setData(`flow/${kind}`, '');
50
+ if (source) {
51
+ dataTransfer.setData('flow/source', source);
52
+ }
53
+ if (data) {
54
+ dataTransfer.setData('flow/data', data);
55
+ }
56
+ if (variant) {
57
+ dataTransfer.setData('flow/variant', variant);
58
+ }
59
+ chip.blur();
60
+ }
61
+ /**
62
+ * Handles the suggestion chip drag end event.
63
+ */
64
+ handleChipDragEnd(e) {
65
+ const { draggedChip } = this;
66
+ if (!draggedChip) {
67
+ return;
68
+ }
69
+ e.preventDefault();
70
+ draggedChip.parentElement?.removeChild(draggedChip);
71
+ }
72
+ /**
73
+ * When interacting with a chip an MD ripple effect is generated.
74
+ * This causes the default drag image to include the surrounding ripple effect and
75
+ * everything around. This makes a copy of the chip and sets it as the drag image.
76
+ *
77
+ * Note, the copy of the chip has to be added to the DOM and be there for some time
78
+ * so the browser render it and set as the image. Because of that the copy is removed
79
+ * with the drop and not immediately.
80
+ */
81
+ illustrateDraggedChip(chip, dataTransfer) {
82
+ const copy = chip.cloneNode(true);
83
+ copy.style.position = 'absolute';
84
+ copy.style.top = `-100px`;
85
+ this.draggedChip = copy;
86
+ document.body.appendChild(copy);
87
+ dataTransfer.setDragImage(copy, 0, 0);
88
+ }
89
+ /**
90
+ * Removes all `dragover` classes from elements on the shadow DOM.
91
+ */
92
+ resetDragIndices() {
93
+ const nodes = this.shadowRoot.querySelectorAll('.dragover');
94
+ Array.from(nodes).forEach(n => n.classList.remove('dragover'));
95
+ }
96
+ /**
97
+ * A handler for the `dragover` event over a valid target.
98
+ * Sets the `dragover` class on the target.
99
+ */
100
+ handleTargetDragOver(e) {
101
+ const { draggedChip } = this;
102
+ if (!draggedChip || e.defaultPrevented || !this.isValidDropTarget(e.dataTransfer)) {
103
+ return;
104
+ }
105
+ e.preventDefault();
106
+ const dt = e.dataTransfer;
107
+ dt.dropEffect = 'copy';
108
+ const target = e.currentTarget;
109
+ target.classList.add('dragover');
110
+ }
111
+ /**
112
+ * A handler for the `dragleave` event over a valid target.
113
+ * Removes the `dragover` class from the target.
114
+ */
115
+ handleTargetDragLeave(e) {
116
+ if (e.defaultPrevented || !this.isValidDropTarget(e.dataTransfer)) {
117
+ return;
118
+ }
119
+ const target = e.currentTarget;
120
+ target.classList.remove('dragover');
121
+ }
122
+ /**
123
+ * Reads the `data-index` and `data-step-index` from the target of the event
124
+ * and calls the `processDrop()` with read values.
125
+ */
126
+ handleDrop(e) {
127
+ const { dataTransfer } = e;
128
+ if (!dataTransfer || e.defaultPrevented || !this.isValidDropTarget(dataTransfer)) {
129
+ return;
130
+ }
131
+ e.preventDefault();
132
+ this.resetDragIndices();
133
+ const { index, stepIndex } = e.target.dataset;
134
+ const assertionOrActionIndex = Number(index);
135
+ if (Number.isNaN(assertionOrActionIndex)) {
136
+ return;
137
+ }
138
+ let typedStepIndex;
139
+ if (stepIndex) {
140
+ const tmp = Number(stepIndex);
141
+ if (!Number.isNaN(tmp)) {
142
+ typedStepIndex = tmp;
143
+ }
144
+ }
145
+ this.processDrop(dataTransfer, assertionOrActionIndex, typedStepIndex);
146
+ }
147
+ /**
148
+ * A logic executed when a suggestion chip drop happens on a valid target.
149
+ *
150
+ * @param dataTransfer The event's dataTransfer object
151
+ * @param assertionOrActionIndex Action's or assertion's index where the drop happened.
152
+ * @param stepIndex The detected index of the step. When not set it adds the step at the end.
153
+ */
154
+ processDrop(dataTransfer, assertionOrActionIndex, stepIndex) {
155
+ const group = dataTransfer.getData('flow/group');
156
+ if (!group) {
157
+ return;
158
+ }
159
+ if (group === 'data-source') {
160
+ this.processDataSourceDrop(dataTransfer, assertionOrActionIndex, stepIndex);
161
+ }
162
+ else if (group === 'transformation') {
163
+ this.processTransformationDrop(dataTransfer, assertionOrActionIndex, stepIndex);
164
+ }
165
+ else if (group === 'assertion') {
166
+ this.processAssertionDrop(dataTransfer, assertionOrActionIndex, stepIndex);
167
+ }
168
+ else if (group === 'action') {
169
+ this.processActionDrop(dataTransfer, assertionOrActionIndex, stepIndex);
170
+ }
171
+ }
172
+ /**
173
+ * Processes dropping of a `data-source` suggestion chip.
174
+ */
175
+ processDataSourceDrop(dataTransfer, assertionOrActionIndex, stepIndex) {
176
+ const target = this.getStepsTarget(assertionOrActionIndex);
177
+ if (!target) {
178
+ return;
179
+ }
180
+ this.setupDataSource(target, dataTransfer, stepIndex);
181
+ }
182
+ /**
183
+ * Processes dropping of a `transformation` suggestion chip.
184
+ */
185
+ processTransformationDrop(dataTransfer, assertionOrActionIndex, stepIndex) {
186
+ const target = this.getStepsTarget(assertionOrActionIndex);
187
+ if (!target) {
188
+ return;
189
+ }
190
+ this.setupTransformation(target, dataTransfer, stepIndex);
191
+ }
192
+ /**
193
+ * Processes dropping of a `assertion` suggestion chip.
194
+ */
195
+ processAssertionDrop(dataTransfer, assertionOrActionIndex, stepIndex) {
196
+ const target = this.getStepsTarget(assertionOrActionIndex);
197
+ if (!target) {
198
+ return;
199
+ }
200
+ this.setupAssertion(target, dataTransfer, stepIndex);
201
+ }
202
+ /**
203
+ * Processes dropping of a `action` suggestion chip.
204
+ */
205
+ processActionDrop(dataTransfer, assertionOrActionIndex, stepIndex) {
206
+ const target = this.getStepsTarget(assertionOrActionIndex);
207
+ if (!target) {
208
+ return;
209
+ }
210
+ this.setupAction(target, dataTransfer, stepIndex);
211
+ }
212
+ setupDataSource(target, dataTransfer, stepIndex) {
213
+ const source = dataTransfer.getData('flow/source');
214
+ const data = dataTransfer.getData('flow/data');
215
+ const step = new DataSteps.ReadDataSourceStep(source, data).toJSON();
216
+ this.appendStep(step, target, stepIndex);
217
+ }
218
+ setupTransformation(target, dataTransfer, stepIndex) {
219
+ let step;
220
+ const kind = dataTransfer.getData('flow/kind');
221
+ if (kind === DataSteps.ReadValueStepKind) {
222
+ step = new DataSteps.ReadValueStep().toJSON();
223
+ }
224
+ else if (kind === TransformationSteps.AsNumberStepKind) {
225
+ step = new TransformationSteps.AsNumberStep().toJSON();
226
+ }
227
+ else if (kind === TransformationSteps.RoundStepKind) {
228
+ step = new TransformationSteps.RoundStep().toJSON();
229
+ }
230
+ else if (kind === TransformationSteps.AsLowerCaseStepKind) {
231
+ step = new TransformationSteps.AsLowerCaseStep().toJSON();
232
+ }
233
+ else if (kind === TransformationSteps.AsUpperCaseStepKind) {
234
+ step = new TransformationSteps.AsUpperCaseStep().toJSON();
235
+ }
236
+ else if (kind === TransformationSteps.TrimStepKind) {
237
+ step = new TransformationSteps.TrimStep().toJSON();
238
+ }
239
+ else if (kind === TransformationSteps.SubstringStepKind) {
240
+ step = new TransformationSteps.SubstringStep().toJSON();
241
+ }
242
+ if (!step) {
243
+ return;
244
+ }
245
+ this.appendStep(step, target, stepIndex);
246
+ }
247
+ setupAssertion(target, dataTransfer, stepIndex) {
248
+ let step;
249
+ const kind = dataTransfer.getData('flow/kind');
250
+ if (kind === CoreAssertions.EqualAssertionKind) {
251
+ step = new CoreAssertions.EqualAssertion().toJSON();
252
+ }
253
+ else if (kind === CoreAssertions.NotEqualAssertionKind) {
254
+ step = new CoreAssertions.NotEqualAssertion().toJSON();
255
+ }
256
+ else if (kind === CoreAssertions.GreaterThanAssertionKind) {
257
+ const instance = new CoreAssertions.GreaterThanAssertion();
258
+ if (dataTransfer.getData('flow/variant') === 'equal') {
259
+ instance.equal = true;
260
+ }
261
+ step = instance.toJSON();
262
+ }
263
+ else if (kind === CoreAssertions.LessThanAssertionKind) {
264
+ const instance = new CoreAssertions.LessThanAssertion();
265
+ if (dataTransfer.getData('flow/variant') === 'equal') {
266
+ instance.equal = true;
267
+ }
268
+ step = instance.toJSON();
269
+ }
270
+ else if (kind === CoreAssertions.IncludesAssertionKind) {
271
+ step = new CoreAssertions.IncludesAssertion().toJSON();
272
+ }
273
+ else if (kind === CoreAssertions.NotIncludesAssertionKind) {
274
+ step = new CoreAssertions.NotIncludesAssertion().toJSON();
275
+ }
276
+ else if (kind === CoreAssertions.MatchesAssertionKind) {
277
+ step = new CoreAssertions.MatchesAssertion().toJSON();
278
+ }
279
+ else if (kind === CoreAssertions.OkAssertionKind) {
280
+ step = new CoreAssertions.OkAssertion().toJSON();
281
+ }
282
+ else if (kind === CoreAssertions.NotOkAssertionKind) {
283
+ step = new CoreAssertions.NotOkAssertion().toJSON();
284
+ }
285
+ else if (kind === CoreAssertions.ToBeAssertionKind) {
286
+ step = new CoreAssertions.ToBeAssertion().toJSON();
287
+ }
288
+ else if (kind === CoreAssertions.NotToBeAssertionKind) {
289
+ step = new CoreAssertions.NotToBeAssertion().toJSON();
290
+ }
291
+ if (!step) {
292
+ return;
293
+ }
294
+ this.appendStep(step, target, stepIndex);
295
+ }
296
+ setupAction(target, dataTransfer, stepIndex) {
297
+ let step;
298
+ const kind = dataTransfer.getData('flow/kind');
299
+ if (kind === DataSteps.SetCookieStepKind) {
300
+ step = new DataSteps.SetCookieStep().toJSON();
301
+ }
302
+ else if (kind === DataSteps.SetVariableStepKind) {
303
+ step = new DataSteps.SetVariableStep().toJSON();
304
+ }
305
+ else if (kind === DataSteps.DeleteCookieStepKind) {
306
+ step = new DataSteps.DeleteCookieStep().toJSON();
307
+ }
308
+ else if (kind === DataSteps.DeleteVariableStepKind) {
309
+ step = new DataSteps.DeleteVariableStep().toJSON();
310
+ }
311
+ if (!step) {
312
+ return;
313
+ }
314
+ this.appendStep(step, target, stepIndex);
315
+ }
316
+ appendStep(step, target, stepIndex) {
317
+ if (stepIndex === undefined) {
318
+ target.steps.push(step);
319
+ }
320
+ else if (stepIndex === -1) {
321
+ target.steps.unshift(step);
322
+ }
323
+ else {
324
+ target.steps.splice(stepIndex, 0, step);
325
+ }
326
+ this.requestUpdate();
327
+ this.notifyChange();
328
+ }
329
+ removeStep(target, stepIndex) {
330
+ target.steps.splice(stepIndex, 1);
331
+ this.notifyChange();
332
+ this.requestUpdate();
333
+ }
334
+ handleSubstringStartChange(e) {
335
+ const step = this.stepFromChangeEvent(e);
336
+ if (!step) {
337
+ return;
338
+ }
339
+ const input = e.target;
340
+ input.checkValidity();
341
+ step.start = input.valueAsNumber;
342
+ this.requestUpdate();
343
+ this.notifyChange();
344
+ }
345
+ handleSubstringEndChange(e) {
346
+ const step = this.stepFromChangeEvent(e);
347
+ if (!step) {
348
+ return;
349
+ }
350
+ const input = e.target;
351
+ input.checkValidity();
352
+ step.end = input.valueAsNumber;
353
+ this.requestUpdate();
354
+ this.notifyChange();
355
+ }
356
+ handleRoundPrecisionChange(e) {
357
+ const step = this.stepFromChangeEvent(e);
358
+ if (!step) {
359
+ return;
360
+ }
361
+ const input = e.target;
362
+ input.checkValidity();
363
+ step.precision = input.valueAsNumber;
364
+ this.requestUpdate();
365
+ this.notifyChange();
366
+ }
367
+ handleReadValueStepChange(e) {
368
+ const step = this.stepFromChangeEvent(e);
369
+ if (!step) {
370
+ return;
371
+ }
372
+ const input = e.target;
373
+ input.checkValidity();
374
+ step.path = input.value;
375
+ this.requestUpdate();
376
+ this.notifyChange();
377
+ }
378
+ handleGreaterThanAssertionValueChange(e) {
379
+ const step = this.stepFromChangeEvent(e);
380
+ if (!step) {
381
+ return;
382
+ }
383
+ const input = e.target;
384
+ input.checkValidity();
385
+ step.value = Number(input.value);
386
+ this.requestUpdate();
387
+ this.notifyChange();
388
+ }
389
+ handleLessThanAssertionValueChange(e) {
390
+ const step = this.stepFromChangeEvent(e);
391
+ if (!step) {
392
+ return;
393
+ }
394
+ const input = e.target;
395
+ input.checkValidity();
396
+ step.value = Number(input.value);
397
+ this.requestUpdate();
398
+ this.notifyChange();
399
+ }
400
+ handleIncludesAssertionValueChange(e) {
401
+ const step = this.stepFromChangeEvent(e);
402
+ if (!step) {
403
+ return;
404
+ }
405
+ const input = e.target;
406
+ input.checkValidity();
407
+ step.value = input.value;
408
+ this.requestUpdate();
409
+ this.notifyChange();
410
+ }
411
+ handleToBeAssertionValueChange(e) {
412
+ const step = this.stepFromChangeEvent(e);
413
+ if (!step) {
414
+ return;
415
+ }
416
+ const input = e.target;
417
+ input.checkValidity();
418
+ step.value = input.value;
419
+ this.requestUpdate();
420
+ this.notifyChange();
421
+ }
422
+ handleMatchesAssertionValueChange(e) {
423
+ const step = this.stepFromChangeEvent(e);
424
+ if (!step) {
425
+ return;
426
+ }
427
+ const input = e.target;
428
+ step.value = input.value;
429
+ this.requestUpdate();
430
+ this.notifyChange();
431
+ }
432
+ handleEqualAssertionValueChange(e) {
433
+ const input = e.target;
434
+ input.checkValidity();
435
+ const assertionOrActionIndex = Number(input.dataset.assertionIndex);
436
+ const stepIndex = Number(input.dataset.stepIndex);
437
+ if (Number.isNaN(assertionOrActionIndex) || Number.isNaN(stepIndex)) {
438
+ return;
439
+ }
440
+ const stepsTarget = this.getStepsTarget(assertionOrActionIndex);
441
+ if (!stepsTarget) {
442
+ return;
443
+ }
444
+ const step = stepsTarget.steps[stepIndex];
445
+ if (!step) {
446
+ return;
447
+ }
448
+ step.value = input.value;
449
+ step.dataType = this.detectInputDataType(stepsTarget.steps.slice(0, stepIndex));
450
+ this.requestUpdate();
451
+ this.notifyChange();
452
+ }
453
+ /**
454
+ * Detects the correct data type for the step value based on previous steps.
455
+ *
456
+ * @param steps The steps before the current step
457
+ * @returns The data type for the step in the AMF namespace.
458
+ */
459
+ detectInputDataType(steps) {
460
+ // we reverse the list so we move from the last step.
461
+ const reversed = [...steps].reverse();
462
+ for (const step of reversed) {
463
+ if (step.kind === TransformationSteps.AsNumberStepKind) {
464
+ return AmfNamespace.aml.vocabularies.shapes.number;
465
+ }
466
+ if (step.kind === DataSteps.ReadDataSourceStepKind) {
467
+ const typed = step;
468
+ if (typed.data === FlowResponseDataEnum.status) {
469
+ return AmfNamespace.aml.vocabularies.shapes.number;
470
+ }
471
+ }
472
+ }
473
+ return AmfNamespace.w3.xmlSchema.string;
474
+ }
475
+ validateRegexPattern(e) {
476
+ const input = e.target;
477
+ try {
478
+ RegExp(input.value);
479
+ input.setCustomValidity('');
480
+ }
481
+ catch (_) {
482
+ input.setCustomValidity('Pattern is invalid');
483
+ }
484
+ input.reportValidity();
485
+ }
486
+ handleVariableNameChange(e) {
487
+ const step = this.stepFromChangeEvent(e);
488
+ if (!step) {
489
+ return;
490
+ }
491
+ const input = e.target;
492
+ step.name = input.value;
493
+ this.requestUpdate();
494
+ this.notifyChange();
495
+ }
496
+ handleRemoveStep(e) {
497
+ const target = e.currentTarget;
498
+ const assertionOrActionIndex = Number(target.dataset.index);
499
+ const stepIndex = Number(target.dataset.stepIndex);
500
+ if (Number.isNaN(assertionOrActionIndex) || Number.isNaN(stepIndex)) {
501
+ return;
502
+ }
503
+ const stepsTarget = this.getStepsTarget(assertionOrActionIndex);
504
+ if (!stepsTarget) {
505
+ return;
506
+ }
507
+ this.removeStep(stepsTarget, stepIndex);
508
+ }
509
+ handleConfigureDeleteCookieStep(e) {
510
+ const info = this.getEventStepLocation(e);
511
+ if (!info) {
512
+ return;
513
+ }
514
+ const stepsTarget = this.getStepsTarget(info.actionIndex);
515
+ if (!stepsTarget) {
516
+ return;
517
+ }
518
+ const step = stepsTarget.steps[info.stepIndex];
519
+ const dialog = document.createElement('delete-cookie-action-dialog');
520
+ dialog.step = step;
521
+ dialog.modal = true;
522
+ dialog.open = true;
523
+ document.body.appendChild(dialog);
524
+ dialog.addEventListener('close', (ev) => {
525
+ document.parentElement?.removeChild(dialog);
526
+ const typed = ev;
527
+ if (typed.detail.cancelled) {
528
+ return;
529
+ }
530
+ const value = typed.detail.value;
531
+ if (!stepsTarget) {
532
+ return;
533
+ }
534
+ stepsTarget.steps[info.stepIndex] = value;
535
+ this.notifyChange();
536
+ this.requestUpdate();
537
+ });
538
+ }
539
+ handleConfigureSetCookieStep(e) {
540
+ const info = this.getEventStepLocation(e);
541
+ if (!info) {
542
+ return;
543
+ }
544
+ const stepsTarget = this.getStepsTarget(info.actionIndex);
545
+ if (!stepsTarget) {
546
+ return;
547
+ }
548
+ const step = stepsTarget.steps[info.stepIndex];
549
+ const dialog = document.createElement('set-cookie-action-dialog');
550
+ dialog.step = step;
551
+ dialog.modal = true;
552
+ dialog.open = true;
553
+ document.body.appendChild(dialog);
554
+ dialog.addEventListener('close', (ev) => {
555
+ document.parentElement?.removeChild(dialog);
556
+ const typed = ev;
557
+ if (typed.detail.cancelled) {
558
+ return;
559
+ }
560
+ const value = typed.detail.value;
561
+ if (!stepsTarget) {
562
+ return;
563
+ }
564
+ stepsTarget.steps[info.stepIndex] = value;
565
+ this.notifyChange();
566
+ this.requestUpdate();
567
+ });
568
+ }
569
+ getEventStepLocation(e) {
570
+ const button = e.currentTarget;
571
+ const { index: ai, stepIndex: si } = button.dataset;
572
+ const actionIndex = Number(ai);
573
+ const stepIndex = Number(si);
574
+ if (Number.isNaN(actionIndex) || Number.isNaN(stepIndex)) {
575
+ return undefined;
576
+ }
577
+ return {
578
+ actionIndex,
579
+ stepIndex,
580
+ };
581
+ }
582
+ renderBlockChip(label, group, kind, opts = {}) {
583
+ const { data, disabled, source, variant, title } = opts;
584
+ return html `
585
+ <ui-chip
586
+ draggable="true"
587
+ data-group="${group}"
588
+ data-kind="${kind}"
589
+ data-source="${ifDefined(source)}"
590
+ data-data="${ifDefined(data)}"
591
+ data-variant="${ifDefined(variant)}"
592
+ @dragstart="${this.handleChipDragStart}"
593
+ @dragend="${this.handleChipDragEnd}"
594
+ ?disabled="${disabled}"
595
+ title="${ifDefined(title)}"
596
+ >${label}</ui-chip>
597
+ `;
598
+ }
599
+ renderDropSpacer(assertionOrActionIndex, stepIndex) {
600
+ return html `<div class="drop-target spacer"
601
+ data-index="${assertionOrActionIndex}"
602
+ data-step-index="${stepIndex}"
603
+ @drop="${this.handleDrop}"
604
+ @dragover="${this.handleTargetDragOver}"
605
+ @dragleave="${this.handleTargetDragLeave}"
606
+ > </div>`;
607
+ }
608
+ renderStepPill(label, assertionOrActionIndex, stepIndex, suffix) {
609
+ return html `
610
+ <span class="step-pill with-icon">
611
+ ${label}
612
+ ${suffix || nothing}
613
+ <ui-icon-button
614
+ title="Remove"
615
+ aria-label="Deletes this step"
616
+ @click="${this.handleRemoveStep}"
617
+ data-index="${assertionOrActionIndex}"
618
+ data-step-index="${stepIndex}"
619
+ ><ui-icon icon="close" role="presentation"></ui-icon></ui-icon-button>
620
+ </span>
621
+ `;
622
+ }
623
+ renderSteps(item, assertionOrActionIndex) {
624
+ const content = Array.isArray(item.steps) && !!item.steps.length ? this.renderStepsList(item.steps, assertionOrActionIndex) : this.renderEmptyStep(assertionOrActionIndex);
625
+ return html `
626
+ <div
627
+ class="steps"
628
+ data-index="${assertionOrActionIndex}"
629
+ @drop="${this.handleDrop}"
630
+ @dragover="${this.handleTargetDragOver}"
631
+ @dragleave="${this.handleTargetDragLeave}"
632
+ >${content}</div>
633
+ `;
634
+ }
635
+ renderEmptyStep(actionIndex) {
636
+ return html `
637
+ <span class="step-pill empty drop-target space-step-left" data-index="${actionIndex}" @drop="${this.handleDrop}" @dragover="${this.handleTargetDragOver}">Empty slot</span>
638
+ <span class="drop-info drop-target space-step-left" data-index="${actionIndex}" @drop="${this.handleDrop}" @dragover="${this.handleTargetDragOver}">Drop an action here</span>
639
+ `;
640
+ }
641
+ renderStepsList(steps, assertionOrActionIndex) {
642
+ const items = [];
643
+ steps.forEach((item, stepIndex) => {
644
+ const content = this.renderStep(item, assertionOrActionIndex, stepIndex);
645
+ if (content) {
646
+ items.push(html `
647
+ <div class="step-unit">
648
+ ${this.renderDropSpacer(assertionOrActionIndex, stepIndex)}
649
+ ${content}
650
+ </div>
651
+ `);
652
+ }
653
+ });
654
+ return items;
655
+ }
656
+ renderStep(item, assertionOrActionIndex, stepIndex) {
657
+ const { kind } = item;
658
+ switch (kind) {
659
+ // actions
660
+ case DataSteps.ReadDataSourceStepKind: return this.renderReadDataSourceStep(item, assertionOrActionIndex, stepIndex);
661
+ case DataSteps.ReadValueStepKind: return this.renderReadValueStep(item, assertionOrActionIndex, stepIndex);
662
+ case DataSteps.DeleteCookieStepKind: return this.renderDeleteCookieStep(item, assertionOrActionIndex, stepIndex);
663
+ case DataSteps.SetCookieStepKind: return this.renderSetCookieStep(item, assertionOrActionIndex, stepIndex);
664
+ case DataSteps.SetVariableStepKind: return this.renderSetVariableStep(item, assertionOrActionIndex, stepIndex);
665
+ case DataSteps.DeleteVariableStepKind: return this.renderDeleteVariableStep(item, assertionOrActionIndex, stepIndex);
666
+ // transformations
667
+ case TransformationSteps.AsNumberStepKind: return this.renderStepPill('As number', assertionOrActionIndex, stepIndex);
668
+ case TransformationSteps.AsLowerCaseStepKind: return this.renderStepPill('To lower case', assertionOrActionIndex, stepIndex);
669
+ case TransformationSteps.AsUpperCaseStepKind: return this.renderStepPill('To upper case', assertionOrActionIndex, stepIndex);
670
+ case TransformationSteps.TrimStepKind: return this.renderStepPill('Trim', assertionOrActionIndex, stepIndex);
671
+ case TransformationSteps.RoundStepKind: return this.renderRoundStep(item, assertionOrActionIndex, stepIndex);
672
+ case TransformationSteps.SubstringStepKind: return this.renderSubstringStep(item, assertionOrActionIndex, stepIndex);
673
+ // assertions
674
+ case CoreAssertions.EqualAssertionKind: return this.renderEqualAssertion(item, assertionOrActionIndex, stepIndex);
675
+ case CoreAssertions.NotEqualAssertionKind: return this.renderNotEqualAssertion(item, assertionOrActionIndex, stepIndex);
676
+ case CoreAssertions.GreaterThanAssertionKind: return this.renderGreaterThanAssertion(item, assertionOrActionIndex, stepIndex);
677
+ case CoreAssertions.LessThanAssertionKind: return this.renderLessThanAssertion(item, assertionOrActionIndex, stepIndex);
678
+ case CoreAssertions.IncludesAssertionKind: return this.renderIncludesAssertion(item, assertionOrActionIndex, stepIndex);
679
+ case CoreAssertions.NotIncludesAssertionKind: return this.renderNotIncludesAssertion(item, assertionOrActionIndex, stepIndex);
680
+ case CoreAssertions.MatchesAssertionKind: return this.renderMatchesAssertion(item, assertionOrActionIndex, stepIndex);
681
+ case CoreAssertions.OkAssertionKind: return this.renderStepPill('Is OK', assertionOrActionIndex, stepIndex);
682
+ case CoreAssertions.NotOkAssertionKind: return this.renderStepPill('Is not OK', assertionOrActionIndex, stepIndex);
683
+ case CoreAssertions.ToBeAssertionKind: return this.renderToBeAssertion(item, assertionOrActionIndex, stepIndex);
684
+ case CoreAssertions.NotToBeAssertionKind: return this.renderNotToBeAssertion(item, assertionOrActionIndex, stepIndex);
685
+ default:
686
+ // eslint-disable-next-line no-console
687
+ console.warn(`Unsupported step`, kind);
688
+ return undefined;
689
+ }
690
+ }
691
+ renderReadDataSourceStep(item, actionIndex, stepIndex) {
692
+ const { data, source } = item;
693
+ if (!data || !source) {
694
+ // invalid configuration
695
+ return undefined;
696
+ }
697
+ let label;
698
+ if (source === FlowSourceEnum.response) {
699
+ if (data === FlowResponseDataEnum.url) {
700
+ label = 'Response URL';
701
+ }
702
+ else if (data === FlowResponseDataEnum.headers) {
703
+ label = 'Response headers';
704
+ }
705
+ else if (data === FlowResponseDataEnum.status) {
706
+ label = 'Status code';
707
+ }
708
+ else if (data === FlowResponseDataEnum.statusText) {
709
+ label = 'Status message';
710
+ }
711
+ else if (data === FlowResponseDataEnum.body) {
712
+ label = 'Response body';
713
+ }
714
+ }
715
+ else if (source === FlowSourceEnum.request) {
716
+ if (data === FlowRequestDataEnum.url) {
717
+ label = 'Request URL';
718
+ }
719
+ else if (data === FlowRequestDataEnum.headers) {
720
+ label = 'Request headers';
721
+ }
722
+ else if (data === FlowRequestDataEnum.body) {
723
+ label = 'Request body';
724
+ }
725
+ else if (data === FlowRequestDataEnum.method) {
726
+ label = 'Request method';
727
+ }
728
+ }
729
+ if (!label) {
730
+ return undefined;
731
+ }
732
+ return this.renderStepPill(label, actionIndex, stepIndex);
733
+ }
734
+ renderReadValueStep(item, assertionOrActionIndex, stepIndex) {
735
+ const pill = this.renderStepPill('Read value', assertionOrActionIndex, stepIndex);
736
+ return html `
737
+ ${pill}
738
+ <ui-text-field
739
+ name="value.${assertionOrActionIndex}.${stepIndex}"
740
+ data-assertion-index="${assertionOrActionIndex}"
741
+ data-step-index="${stepIndex}"
742
+ label="Path to value"
743
+ required
744
+ .value="${live(item.path || '')}"
745
+ class="space-step-left"
746
+ @change="${this.handleReadValueStepChange}"
747
+ ></ui-text-field>
748
+ `;
749
+ }
750
+ renderDeleteCookieStep(item, assertionOrActionIndex, stepIndex) {
751
+ const { name, url } = item;
752
+ let label;
753
+ if (name && url) {
754
+ label = 'by name and URL';
755
+ }
756
+ else if (name) {
757
+ label = 'by name';
758
+ }
759
+ else if (url) {
760
+ label = 'by URL';
761
+ }
762
+ else {
763
+ label = 'all cookies';
764
+ }
765
+ const suffix = html `
766
+ <ui-icon-button
767
+ title="Configure this step"
768
+ aria-label="Configure this step"
769
+ data-index="${assertionOrActionIndex}"
770
+ data-step-index="${stepIndex}"
771
+ @click="${this.handleConfigureDeleteCookieStep}"
772
+ ><ui-icon icon="tune" role="presentation"></ui-icon></ui-icon-button>
773
+ `;
774
+ const pill = this.renderStepPill(`Delete cookie (${label})`, assertionOrActionIndex, stepIndex, suffix);
775
+ return pill;
776
+ }
777
+ renderSetCookieStep(item, assertionOrActionIndex, stepIndex) {
778
+ const suffix = html `
779
+ <ui-icon-button
780
+ title="Configure this step"
781
+ aria-label="Configure this step"
782
+ data-index="${assertionOrActionIndex}"
783
+ data-step-index="${stepIndex}"
784
+ @click="${this.handleConfigureSetCookieStep}"
785
+ ><ui-icon icon="tune" role="presentation"></ui-icon></ui-icon-button>
786
+ `;
787
+ const pill = this.renderStepPill('Set cookie', assertionOrActionIndex, stepIndex, suffix);
788
+ return pill;
789
+ }
790
+ renderSetVariableStep(item, assertionOrActionIndex, stepIndex) {
791
+ const { name = '' } = item;
792
+ const pill = this.renderStepPill('Set variable', assertionOrActionIndex, stepIndex);
793
+ return html `
794
+ ${pill}
795
+ <ui-text-field
796
+ name="variable.${assertionOrActionIndex}.${stepIndex}"
797
+ data-assertion-index="${assertionOrActionIndex}"
798
+ data-step-index="${stepIndex}"
799
+ label="Variable name"
800
+ required
801
+ .value="${live(name)}"
802
+ @change="${this.handleVariableNameChange}"
803
+ class="space-step-left"
804
+ pattern="[a-zA-Z0-9_]+"
805
+ aria-label="Variable name"
806
+ ></ui-text-field>
807
+ `;
808
+ }
809
+ renderDeleteVariableStep(item, assertionOrActionIndex, stepIndex) {
810
+ const { name = '' } = item;
811
+ const pill = this.renderStepPill('Delete variable', assertionOrActionIndex, stepIndex);
812
+ return html `
813
+ ${pill}
814
+ <ui-text-field
815
+ name="variable.${assertionOrActionIndex}.${stepIndex}"
816
+ data-assertion-index="${assertionOrActionIndex}"
817
+ data-step-index="${stepIndex}"
818
+ label="Variable name"
819
+ required
820
+ .value="${live(name)}"
821
+ @change="${this.handleVariableNameChange}"
822
+ class="space-step-left"
823
+ pattern="[a-zA-Z0-9_]+"
824
+ aria-label="Variable name"
825
+ ></ui-text-field>
826
+ `;
827
+ }
828
+ renderRoundStep(item, assertionOrActionIndex, stepIndex) {
829
+ const pill = this.renderStepPill('Round', assertionOrActionIndex, stepIndex);
830
+ const { precision = 0 } = item;
831
+ return html `
832
+ ${pill}
833
+ <ui-text-field
834
+ name="precision.${assertionOrActionIndex}.${stepIndex}"
835
+ data-assertion-index="${assertionOrActionIndex}"
836
+ data-step-index="${stepIndex}"
837
+ label="Precision"
838
+ required
839
+ .value="${live(String(precision))}"
840
+ @change="${this.handleRoundPrecisionChange}"
841
+ class="space-step-left number-input"
842
+ type="number"
843
+ min="0"
844
+ max="100"
845
+ step="1"
846
+ title="The number of digits to appear after the decimal point. Should be a value between 0 and 100, inclusive."
847
+ ></ui-text-field>
848
+ `;
849
+ }
850
+ renderSubstringStep(item, assertionOrActionIndex, stepIndex) {
851
+ const pill = this.renderStepPill('Substring', assertionOrActionIndex, stepIndex);
852
+ const { start = 0, end } = item;
853
+ return html `
854
+ ${pill}
855
+ <ui-text-field
856
+ name="start.${assertionOrActionIndex}.${stepIndex}"
857
+ data-assertion-index="${assertionOrActionIndex}"
858
+ data-step-index="${stepIndex}"
859
+ label="Start"
860
+ required
861
+ .value="${live(String(start))}"
862
+ @change="${this.handleSubstringStartChange}"
863
+ class="space-step-left number-input"
864
+ type="number"
865
+ step="1"
866
+ title="The index of the first character to include in the returned substring."
867
+ ></ui-text-field>
868
+
869
+ <ui-text-field
870
+ name="end.${assertionOrActionIndex}.${stepIndex}"
871
+ data-assertion-index="${assertionOrActionIndex}"
872
+ data-step-index="${stepIndex}"
873
+ label="End"
874
+ .value="${live(end ? String(end) : '')}"
875
+ @change="${this.handleSubstringEndChange}"
876
+ class="space-step-left number-input"
877
+ type="number"
878
+ step="1"
879
+ title="The index of the first character to exclude from the returned substring."
880
+ ></ui-text-field>
881
+ `;
882
+ }
883
+ renderEqualAssertion(item, assertionOrActionIndex, stepIndex) {
884
+ return html `
885
+ <ui-text-field
886
+ name="equal.${assertionOrActionIndex}.${stepIndex}"
887
+ data-assertion-index="${assertionOrActionIndex}"
888
+ data-step-index="${stepIndex}"
889
+ data-kind="${CoreAssertions.EqualAssertionKind}"
890
+ label="Equal to"
891
+ required
892
+ .value="${live(item.value || '')}"
893
+ @change="${this.handleEqualAssertionValueChange}"
894
+ >
895
+ <ui-icon-button
896
+ slot="suffix"
897
+ title="Remove assertion"
898
+ aria-label="Deletes this assertion"
899
+ @click="${this.handleRemoveStep}"
900
+ data-index="${assertionOrActionIndex}"
901
+ data-step-index="${stepIndex}"
902
+ ><ui-icon icon="close" role="presentation"></ui-icon></ui-icon-button>
903
+ </ui-text-field>
904
+ `;
905
+ }
906
+ renderNotEqualAssertion(item, assertionOrActionIndex, stepIndex) {
907
+ return html `
908
+ <ui-text-field
909
+ name="not-equal.${assertionOrActionIndex}.${stepIndex}"
910
+ data-assertion-index="${assertionOrActionIndex}"
911
+ data-step-index="${stepIndex}"
912
+ data-kind="${CoreAssertions.NotEqualAssertionKind}"
913
+ label="Not equal to"
914
+ required
915
+ .value="${live(item.value || '')}"
916
+ @change="${this.handleEqualAssertionValueChange}"
917
+ >
918
+ <ui-icon-button
919
+ slot="suffix"
920
+ title="Remove assertion"
921
+ aria-label="Deletes this assertion"
922
+ @click="${this.handleRemoveStep}"
923
+ data-index="${assertionOrActionIndex}"
924
+ data-step-index="${stepIndex}"
925
+ ><ui-icon icon="close" role="presentation"></ui-icon></ui-icon-button>
926
+ </ui-text-field>
927
+ `;
928
+ }
929
+ renderGreaterThanAssertion(item, assertionOrActionIndex, stepIndex) {
930
+ const { equal, value } = item;
931
+ const label = equal ? 'Greater than equal' : 'Greater than';
932
+ const effectiveValue = typeof value === 'number' ? String(value) : '';
933
+ return html `
934
+ <ui-text-field
935
+ name="value.${assertionOrActionIndex}.${stepIndex}"
936
+ data-assertion-index="${assertionOrActionIndex}"
937
+ data-step-index="${stepIndex}"
938
+ data-kind="${CoreAssertions.GreaterThanAssertionKind}"
939
+ data-variant="${equal ? 'equal' : ''}"
940
+ label="${label}"
941
+ required
942
+ .value="${live(effectiveValue)}"
943
+ @change="${this.handleGreaterThanAssertionValueChange}"
944
+ inputMode="numeric"
945
+ >
946
+ <ui-icon-button
947
+ slot="suffix"
948
+ title="Remove assertion"
949
+ aria-label="Deletes this assertion"
950
+ @click="${this.handleRemoveStep}"
951
+ data-index="${assertionOrActionIndex}"
952
+ data-step-index="${stepIndex}"
953
+ ><ui-icon icon="close" role="presentation"></ui-icon></ui-icon-button>
954
+ </ui-text-field>
955
+ `;
956
+ }
957
+ renderLessThanAssertion(item, assertionOrActionIndex, stepIndex) {
958
+ const { equal, value } = item;
959
+ const label = equal ? 'Less than equal' : 'Less than';
960
+ const effectiveValue = typeof value === 'number' ? String(value) : '';
961
+ return html `
962
+ <ui-text-field
963
+ name="value.${assertionOrActionIndex}.${stepIndex}"
964
+ data-assertion-index="${assertionOrActionIndex}"
965
+ data-step-index="${stepIndex}"
966
+ data-kind="${CoreAssertions.LessThanAssertionKind}"
967
+ data-variant="${equal ? 'equal' : ''}"
968
+ label="${label}"
969
+ required
970
+ .value="${live(effectiveValue)}"
971
+ @change="${this.handleLessThanAssertionValueChange}"
972
+ inputMode="numeric"
973
+ >
974
+ <ui-icon-button
975
+ slot="suffix"
976
+ title="Remove assertion"
977
+ aria-label="Deletes this assertion"
978
+ @click="${this.handleRemoveStep}"
979
+ data-index="${assertionOrActionIndex}"
980
+ data-step-index="${stepIndex}"
981
+ ><ui-icon icon="close" role="presentation"></ui-icon></ui-icon-button>
982
+ </ui-text-field>
983
+ `;
984
+ }
985
+ renderIncludesAssertion(item, assertionOrActionIndex, stepIndex) {
986
+ const { value } = item;
987
+ return html `
988
+ <ui-text-field
989
+ name="includes.${assertionOrActionIndex}.${stepIndex}"
990
+ data-assertion-index="${assertionOrActionIndex}"
991
+ data-step-index="${stepIndex}"
992
+ data-kind="${CoreAssertions.IncludesAssertionKind}"
993
+ label="Includes value"
994
+ required
995
+ .value="${live(value || '')}"
996
+ @change="${this.handleIncludesAssertionValueChange}"
997
+ >
998
+ <ui-icon-button
999
+ slot="suffix"
1000
+ title="Remove assertion"
1001
+ aria-label="Deletes this assertion"
1002
+ @click="${this.handleRemoveStep}"
1003
+ data-index="${assertionOrActionIndex}"
1004
+ data-step-index="${stepIndex}"
1005
+ ><ui-icon icon="close" role="presentation"></ui-icon></ui-icon-button>
1006
+ </ui-text-field>
1007
+ `;
1008
+ }
1009
+ renderNotIncludesAssertion(item, assertionOrActionIndex, stepIndex) {
1010
+ const { value } = item;
1011
+ return html `
1012
+ <ui-text-field
1013
+ name="not-includes.${assertionOrActionIndex}.${stepIndex}"
1014
+ data-assertion-index="${assertionOrActionIndex}"
1015
+ data-step-index="${stepIndex}"
1016
+ data-kind="${CoreAssertions.NotIncludesAssertionKind}"
1017
+ label="Not includes value"
1018
+ required
1019
+ .value="${live(value || '')}"
1020
+ @change="${this.handleIncludesAssertionValueChange}"
1021
+ >
1022
+ <ui-icon-button
1023
+ slot="suffix"
1024
+ title="Remove assertion"
1025
+ aria-label="Deletes this assertion"
1026
+ @click="${this.handleRemoveStep}"
1027
+ data-index="${assertionOrActionIndex}"
1028
+ data-step-index="${stepIndex}"
1029
+ ><ui-icon icon="close" role="presentation"></ui-icon></ui-icon-button>
1030
+ </ui-text-field>
1031
+ `;
1032
+ }
1033
+ renderMatchesAssertion(item, assertionOrActionIndex, stepIndex) {
1034
+ const { value } = item;
1035
+ return html `
1036
+ <ui-text-field
1037
+ name="matches.${assertionOrActionIndex}.${stepIndex}"
1038
+ data-assertion-index="${assertionOrActionIndex}"
1039
+ data-step-index="${stepIndex}"
1040
+ data-kind="${CoreAssertions.MatchesAssertionKind}"
1041
+ label="Matches regex"
1042
+ required
1043
+ .value="${live(value || '')}"
1044
+ @change="${this.handleMatchesAssertionValueChange}"
1045
+ @input="${this.validateRegexPattern}"
1046
+ invalidText="Pattern is invalid"
1047
+ >
1048
+ <ui-icon-button
1049
+ slot="suffix"
1050
+ title="Remove assertion"
1051
+ aria-label="Deletes this assertion"
1052
+ @click="${this.handleRemoveStep}"
1053
+ data-index="${assertionOrActionIndex}"
1054
+ data-step-index="${stepIndex}"
1055
+ ><ui-icon icon="close" role="presentation"></ui-icon></ui-icon-button>
1056
+ </ui-text-field>
1057
+ `;
1058
+ }
1059
+ renderToBeAssertion(item, assertionOrActionIndex, stepIndex) {
1060
+ const { value } = item;
1061
+ const types = Object.values(CoreAssertions.ToBeTypes);
1062
+ return html `
1063
+ <ui-text-field
1064
+ name="to-be.${assertionOrActionIndex}.${stepIndex}"
1065
+ data-assertion-index="${assertionOrActionIndex}"
1066
+ data-step-index="${stepIndex}"
1067
+ data-kind="${CoreAssertions.ToBeAssertionKind}"
1068
+ label="To be..."
1069
+ required
1070
+ .value="${live(value || '')}"
1071
+ @change="${this.handleToBeAssertionValueChange}"
1072
+ .list="${types}"
1073
+ >
1074
+ <ui-icon-button
1075
+ slot="suffix"
1076
+ title="Remove assertion"
1077
+ aria-label="Deletes this assertion"
1078
+ @click="${this.handleRemoveStep}"
1079
+ data-index="${assertionOrActionIndex}"
1080
+ data-step-index="${stepIndex}"
1081
+ ><ui-icon icon="close" role="presentation"></ui-icon></ui-icon-button>
1082
+ </ui-text-field>
1083
+ `;
1084
+ }
1085
+ renderNotToBeAssertion(item, assertionOrActionIndex, stepIndex) {
1086
+ const { value } = item;
1087
+ const types = Object.values(CoreAssertions.ToBeTypes);
1088
+ return html `
1089
+ <ui-text-field
1090
+ name="not-to-be.${assertionOrActionIndex}.${stepIndex}"
1091
+ data-assertion-index="${assertionOrActionIndex}"
1092
+ data-step-index="${stepIndex}"
1093
+ data-kind="${CoreAssertions.NotToBeAssertionKind}"
1094
+ label="Not to be..."
1095
+ required
1096
+ .value="${live(value || '')}"
1097
+ @change="${this.handleToBeAssertionValueChange}"
1098
+ .list="${types}"
1099
+ >
1100
+ <ui-icon-button
1101
+ slot="suffix"
1102
+ title="Remove assertion"
1103
+ aria-label="Deletes this assertion"
1104
+ @click="${this.handleRemoveStep}"
1105
+ data-index="${assertionOrActionIndex}"
1106
+ data-step-index="${stepIndex}"
1107
+ ><ui-icon icon="close" role="presentation"></ui-icon></ui-icon-button>
1108
+ </ui-text-field>
1109
+ `;
1110
+ }
1111
+ renderResponseDataSourceSuggestions(disabled = false) {
1112
+ return html `
1113
+ <details class="action-group" open>
1114
+ <summary>Data Source</summary>
1115
+ <div class="group-content">
1116
+ ${this.renderBlockChip('Status code', 'data-source', DataSteps.ReadDataSourceStepKind, {
1117
+ source: FlowSourceEnum.response,
1118
+ data: FlowResponseDataEnum.status,
1119
+ disabled,
1120
+ title: 'Reads the response status code and passes it to the next step.',
1121
+ })}
1122
+ ${this.renderBlockChip('Response headers', 'data-source', DataSteps.ReadDataSourceStepKind, {
1123
+ source: FlowSourceEnum.response,
1124
+ data: FlowResponseDataEnum.headers,
1125
+ disabled,
1126
+ title: 'Reads the response headers and passes them to the next step.',
1127
+ })}
1128
+ ${this.renderBlockChip('Response body', 'data-source', DataSteps.ReadDataSourceStepKind, {
1129
+ source: FlowSourceEnum.response,
1130
+ data: FlowResponseDataEnum.body,
1131
+ disabled,
1132
+ title: 'Reads the response body and passes it to the next step.',
1133
+ })}
1134
+ ${this.renderBlockChip('Status message', 'data-source', DataSteps.ReadDataSourceStepKind, {
1135
+ source: FlowSourceEnum.response,
1136
+ data: FlowResponseDataEnum.statusText,
1137
+ disabled,
1138
+ title: 'Reads the response status message and passes it to the next step.',
1139
+ })}
1140
+ </div>
1141
+ </details>
1142
+ `;
1143
+ }
1144
+ renderRequestDataSourceSuggestions(disabled = false) {
1145
+ return html `
1146
+ <details class="action-group" open>
1147
+ <summary>Data Source</summary>
1148
+ <div class="group-content">
1149
+ ${this.renderBlockChip('Request headers', 'data-source', DataSteps.ReadDataSourceStepKind, {
1150
+ source: FlowSourceEnum.request,
1151
+ data: FlowRequestDataEnum.headers,
1152
+ disabled,
1153
+ title: 'Reads the request headers and passes them to the next step.',
1154
+ })}
1155
+ ${this.renderBlockChip('Request body', 'data-source', DataSteps.ReadDataSourceStepKind, {
1156
+ source: FlowSourceEnum.request,
1157
+ data: FlowRequestDataEnum.body,
1158
+ disabled,
1159
+ title: 'Reads the request body and passes it to the next step.',
1160
+ })}
1161
+ ${this.renderBlockChip('Request method', 'data-source', DataSteps.ReadDataSourceStepKind, {
1162
+ source: FlowSourceEnum.request,
1163
+ data: FlowRequestDataEnum.method,
1164
+ disabled,
1165
+ title: 'Reads the request method and passes it to the next step.',
1166
+ })}
1167
+ </div>
1168
+ </details>
1169
+ `;
1170
+ }
1171
+ renderTransformationSuggestions(disabled = false) {
1172
+ return html `
1173
+ <details class="action-group" open>
1174
+ <summary>Transformation</summary>
1175
+ <div class="group-content">
1176
+ ${this.renderBlockChip('Read value', 'transformation', DataSteps.ReadValueStepKind, {
1177
+ disabled,
1178
+ title: 'Reads a value from the previous step. Configure the path to the value.',
1179
+ })}
1180
+ ${this.renderBlockChip('As number', 'transformation', TransformationSteps.AsNumberStepKind, {
1181
+ disabled,
1182
+ title: 'Transforms the value received from the previous step to a number.'
1183
+ })}
1184
+ ${this.renderBlockChip('Round', 'transformation', TransformationSteps.RoundStepKind, {
1185
+ disabled,
1186
+ title: 'Rounds the value received from the previous step with a precision',
1187
+ })}
1188
+ ${this.renderBlockChip('To lower case', 'transformation', TransformationSteps.AsLowerCaseStepKind, {
1189
+ disabled,
1190
+ title: 'Transforms the value received from the previous step to a lower case string',
1191
+ })}
1192
+ ${this.renderBlockChip('To upper case', 'transformation', TransformationSteps.AsUpperCaseStepKind, {
1193
+ disabled,
1194
+ title: 'Transforms the value received from the previous step to an upper case string',
1195
+ })}
1196
+ ${this.renderBlockChip('Trim', 'transformation', TransformationSteps.TrimStepKind, {
1197
+ disabled,
1198
+ title: 'Treats the value received from the previous step as string as trims the whitespace.',
1199
+ })}
1200
+ ${this.renderBlockChip('Substring', 'transformation', TransformationSteps.SubstringStepKind, {
1201
+ disabled,
1202
+ title: 'Passes a sub string of the current value to the next step.',
1203
+ })}
1204
+ </div>
1205
+ </details>
1206
+ `;
1207
+ }
1208
+ renderActionSuggestions(disabled = false) {
1209
+ return html `
1210
+ <details class="action-group" open>
1211
+ <summary>Actions</summary>
1212
+ <div class="group-content">
1213
+ ${this.renderBlockChip('Set cookie', 'action', DataSteps.SetCookieStepKind, {
1214
+ disabled,
1215
+ title: 'Sets and stores a cookie',
1216
+ })}
1217
+ ${this.renderBlockChip('Delete cookie', 'action', DataSteps.DeleteCookieStepKind, {
1218
+ disabled,
1219
+ title: 'Deletes a cookie.',
1220
+ })}
1221
+ ${this.renderBlockChip('Set variable', 'action', DataSteps.SetVariableStepKind, {
1222
+ disabled,
1223
+ title: 'Sets a variable during the execution time. It does not store the value.',
1224
+ })}
1225
+ ${this.renderBlockChip('Unset variable', 'action', DataSteps.DeleteVariableStepKind, {
1226
+ disabled,
1227
+ title: 'Clears a variable during the execution time. It does not store the value.',
1228
+ })}
1229
+ </div>
1230
+ </details>
1231
+ `;
1232
+ }
1233
+ renderAssertionSuggestions(disabled = false) {
1234
+ return html `
1235
+ <details class="action-group" open>
1236
+ <summary>Assertions</summary>
1237
+ <div class="group-content">
1238
+ ${this.renderBlockChip('Equal', 'assertion', CoreAssertions.EqualAssertionKind, { disabled })}
1239
+ ${this.renderBlockChip('Not equal', 'assertion', CoreAssertions.NotEqualAssertionKind, { disabled })}
1240
+ ${this.renderBlockChip('Greater than', 'assertion', CoreAssertions.GreaterThanAssertionKind, { disabled })}
1241
+ ${this.renderBlockChip('Greater than equal', 'assertion', CoreAssertions.GreaterThanAssertionKind, { disabled, variant: 'equal' })}
1242
+ ${this.renderBlockChip('Less than', 'assertion', CoreAssertions.LessThanAssertionKind, { disabled })}
1243
+ ${this.renderBlockChip('Less than equal', 'assertion', CoreAssertions.LessThanAssertionKind, { disabled, variant: 'equal' })}
1244
+ ${this.renderBlockChip('Includes', 'assertion', CoreAssertions.IncludesAssertionKind, { disabled })}
1245
+ ${this.renderBlockChip('Not includes', 'assertion', CoreAssertions.NotIncludesAssertionKind, { disabled })}
1246
+ ${this.renderBlockChip('Matches', 'assertion', CoreAssertions.MatchesAssertionKind, { disabled })}
1247
+ ${this.renderBlockChip('OK', 'assertion', CoreAssertions.OkAssertionKind, { disabled })}
1248
+ ${this.renderBlockChip('Not OK', 'assertion', CoreAssertions.NotOkAssertionKind, { disabled })}
1249
+ ${this.renderBlockChip('To be...', 'assertion', CoreAssertions.ToBeAssertionKind, { disabled })}
1250
+ ${this.renderBlockChip('Not to be...', 'assertion', CoreAssertions.NotToBeAssertionKind, { disabled })}
1251
+ </div>
1252
+ </details>
1253
+ `;
1254
+ }
1255
+ }
1256
+ //# sourceMappingURL=HttpFlowsUi.js.map