@nyaruka/temba-components 0.131.1 → 0.131.2

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 (427) hide show
  1. package/.github/workflows/publish.yml +4 -1
  2. package/CHANGELOG.md +61 -1
  3. package/demo/data/flows/food-order.json +2 -2
  4. package/demo/data/flows/sample-flow.json +74 -125
  5. package/dist/static/svg/index.svg +1 -1
  6. package/dist/temba-components.js +1155 -618
  7. package/dist/temba-components.js.map +1 -1
  8. package/out-tsc/src/Icons.js +4 -1
  9. package/out-tsc/src/Icons.js.map +1 -1
  10. package/out-tsc/src/events.js.map +1 -1
  11. package/out-tsc/src/flow/CanvasMenu.js +200 -0
  12. package/out-tsc/src/flow/CanvasMenu.js.map +1 -0
  13. package/out-tsc/src/flow/CanvasNode.js +327 -19
  14. package/out-tsc/src/flow/CanvasNode.js.map +1 -1
  15. package/out-tsc/src/flow/Editor.js +562 -66
  16. package/out-tsc/src/flow/Editor.js.map +1 -1
  17. package/out-tsc/src/flow/NodeEditor.js +240 -93
  18. package/out-tsc/src/flow/NodeEditor.js.map +1 -1
  19. package/out-tsc/src/flow/NodeTypeSelector.js +499 -0
  20. package/out-tsc/src/flow/NodeTypeSelector.js.map +1 -0
  21. package/out-tsc/src/flow/actions/add_contact_groups.js +3 -3
  22. package/out-tsc/src/flow/actions/add_contact_groups.js.map +1 -1
  23. package/out-tsc/src/flow/actions/add_contact_urn.js +62 -4
  24. package/out-tsc/src/flow/actions/add_contact_urn.js.map +1 -1
  25. package/out-tsc/src/flow/actions/add_input_labels.js +3 -3
  26. package/out-tsc/src/flow/actions/add_input_labels.js.map +1 -1
  27. package/out-tsc/src/flow/actions/play_audio.js +2 -2
  28. package/out-tsc/src/flow/actions/play_audio.js.map +1 -1
  29. package/out-tsc/src/flow/actions/remove_contact_groups.js +6 -5
  30. package/out-tsc/src/flow/actions/remove_contact_groups.js.map +1 -1
  31. package/out-tsc/src/flow/actions/request_optin.js +2 -2
  32. package/out-tsc/src/flow/actions/request_optin.js.map +1 -1
  33. package/out-tsc/src/flow/actions/say_msg.js +2 -2
  34. package/out-tsc/src/flow/actions/say_msg.js.map +1 -1
  35. package/out-tsc/src/flow/actions/send_broadcast.js +76 -23
  36. package/out-tsc/src/flow/actions/send_broadcast.js.map +1 -1
  37. package/out-tsc/src/flow/actions/send_email.js +4 -5
  38. package/out-tsc/src/flow/actions/send_email.js.map +1 -1
  39. package/out-tsc/src/flow/actions/send_msg.js +9 -19
  40. package/out-tsc/src/flow/actions/send_msg.js.map +1 -1
  41. package/out-tsc/src/flow/actions/set_contact_channel.js +5 -9
  42. package/out-tsc/src/flow/actions/set_contact_channel.js.map +1 -1
  43. package/out-tsc/src/flow/actions/set_contact_field.js +19 -20
  44. package/out-tsc/src/flow/actions/set_contact_field.js.map +1 -1
  45. package/out-tsc/src/flow/actions/set_contact_language.js +2 -2
  46. package/out-tsc/src/flow/actions/set_contact_language.js.map +1 -1
  47. package/out-tsc/src/flow/actions/set_contact_name.js +2 -12
  48. package/out-tsc/src/flow/actions/set_contact_name.js.map +1 -1
  49. package/out-tsc/src/flow/actions/set_contact_status.js +2 -2
  50. package/out-tsc/src/flow/actions/set_contact_status.js.map +1 -1
  51. package/out-tsc/src/flow/actions/set_run_result.js +3 -3
  52. package/out-tsc/src/flow/actions/set_run_result.js.map +1 -1
  53. package/out-tsc/src/flow/actions/start_session.js +180 -6
  54. package/out-tsc/src/flow/actions/start_session.js.map +1 -1
  55. package/out-tsc/src/flow/config.js +11 -15
  56. package/out-tsc/src/flow/config.js.map +1 -1
  57. package/out-tsc/src/flow/currencies.js +45 -0
  58. package/out-tsc/src/flow/currencies.js.map +1 -0
  59. package/out-tsc/src/flow/nodes/shared-rules.js +257 -0
  60. package/out-tsc/src/flow/nodes/shared-rules.js.map +1 -0
  61. package/out-tsc/src/flow/nodes/shared.js +17 -0
  62. package/out-tsc/src/flow/nodes/shared.js.map +1 -0
  63. package/out-tsc/src/flow/nodes/split_by_airtime.js +205 -5
  64. package/out-tsc/src/flow/nodes/split_by_airtime.js.map +1 -1
  65. package/out-tsc/src/flow/nodes/split_by_contact_field.js +147 -3
  66. package/out-tsc/src/flow/nodes/split_by_contact_field.js.map +1 -1
  67. package/out-tsc/src/flow/nodes/split_by_expression.js +68 -2
  68. package/out-tsc/src/flow/nodes/split_by_expression.js.map +1 -1
  69. package/out-tsc/src/flow/nodes/split_by_groups.js +12 -9
  70. package/out-tsc/src/flow/nodes/split_by_groups.js.map +1 -1
  71. package/out-tsc/src/flow/nodes/split_by_intent.js +7 -0
  72. package/out-tsc/src/flow/nodes/split_by_intent.js.map +1 -0
  73. package/out-tsc/src/flow/nodes/split_by_llm.js +3 -2
  74. package/out-tsc/src/flow/nodes/split_by_llm.js.map +1 -1
  75. package/out-tsc/src/flow/nodes/split_by_llm_categorize.js +2 -2
  76. package/out-tsc/src/flow/nodes/split_by_llm_categorize.js.map +1 -1
  77. package/out-tsc/src/flow/nodes/split_by_random.js +3 -3
  78. package/out-tsc/src/flow/nodes/split_by_random.js.map +1 -1
  79. package/out-tsc/src/flow/nodes/split_by_resthook.js +108 -0
  80. package/out-tsc/src/flow/nodes/split_by_resthook.js.map +1 -0
  81. package/out-tsc/src/flow/nodes/split_by_run_result.js +206 -3
  82. package/out-tsc/src/flow/nodes/split_by_run_result.js.map +1 -1
  83. package/out-tsc/src/flow/nodes/split_by_scheme.js +153 -2
  84. package/out-tsc/src/flow/nodes/split_by_scheme.js.map +1 -1
  85. package/out-tsc/src/flow/nodes/split_by_subflow.js +6 -4
  86. package/out-tsc/src/flow/nodes/split_by_subflow.js.map +1 -1
  87. package/out-tsc/src/flow/nodes/split_by_ticket.js +3 -2
  88. package/out-tsc/src/flow/nodes/split_by_ticket.js.map +1 -1
  89. package/out-tsc/src/flow/nodes/split_by_webhook.js +3 -2
  90. package/out-tsc/src/flow/nodes/split_by_webhook.js.map +1 -1
  91. package/out-tsc/src/flow/nodes/wait_for_audio.js +2 -2
  92. package/out-tsc/src/flow/nodes/wait_for_audio.js.map +1 -1
  93. package/out-tsc/src/flow/nodes/wait_for_digits.js +2 -2
  94. package/out-tsc/src/flow/nodes/wait_for_digits.js.map +1 -1
  95. package/out-tsc/src/flow/nodes/wait_for_image.js +2 -2
  96. package/out-tsc/src/flow/nodes/wait_for_image.js.map +1 -1
  97. package/out-tsc/src/flow/nodes/wait_for_location.js +2 -2
  98. package/out-tsc/src/flow/nodes/wait_for_location.js.map +1 -1
  99. package/out-tsc/src/flow/nodes/wait_for_menu.js +2 -2
  100. package/out-tsc/src/flow/nodes/wait_for_menu.js.map +1 -1
  101. package/out-tsc/src/flow/nodes/wait_for_response.js +32 -567
  102. package/out-tsc/src/flow/nodes/wait_for_response.js.map +1 -1
  103. package/out-tsc/src/flow/nodes/wait_for_video.js +2 -2
  104. package/out-tsc/src/flow/nodes/wait_for_video.js.map +1 -1
  105. package/out-tsc/src/flow/types.js +71 -12
  106. package/out-tsc/src/flow/types.js.map +1 -1
  107. package/out-tsc/src/flow/utils.js +101 -14
  108. package/out-tsc/src/flow/utils.js.map +1 -1
  109. package/out-tsc/src/form/FieldRenderer.js +2 -4
  110. package/out-tsc/src/form/FieldRenderer.js.map +1 -1
  111. package/out-tsc/src/interfaces.js +3 -0
  112. package/out-tsc/src/interfaces.js.map +1 -1
  113. package/out-tsc/src/list/SortableList.js +98 -33
  114. package/out-tsc/src/list/SortableList.js.map +1 -1
  115. package/out-tsc/src/live/ContactChat.js +15 -18
  116. package/out-tsc/src/live/ContactChat.js.map +1 -1
  117. package/out-tsc/src/store/AppState.js +53 -0
  118. package/out-tsc/src/store/AppState.js.map +1 -1
  119. package/out-tsc/src/utils.js +254 -13
  120. package/out-tsc/src/utils.js.map +1 -1
  121. package/out-tsc/temba-modules.js +4 -0
  122. package/out-tsc/temba-modules.js.map +1 -1
  123. package/out-tsc/test/ActionHelper.js +3 -3
  124. package/out-tsc/test/ActionHelper.js.map +1 -1
  125. package/out-tsc/test/NodeHelper.js +6 -3
  126. package/out-tsc/test/NodeHelper.js.map +1 -1
  127. package/out-tsc/test/actions/add_contact_urn.test.js +202 -0
  128. package/out-tsc/test/actions/add_contact_urn.test.js.map +1 -0
  129. package/out-tsc/test/actions/send_broadcast.test.js +148 -0
  130. package/out-tsc/test/actions/send_broadcast.test.js.map +1 -0
  131. package/out-tsc/test/actions/send_email.test.js +17 -23
  132. package/out-tsc/test/actions/send_email.test.js.map +1 -1
  133. package/out-tsc/test/actions/send_msg.test.js +33 -15
  134. package/out-tsc/test/actions/send_msg.test.js.map +1 -1
  135. package/out-tsc/test/actions/start_session.test.js +116 -0
  136. package/out-tsc/test/actions/start_session.test.js.map +1 -0
  137. package/out-tsc/test/nodes/split_by_airtime.test.js +604 -0
  138. package/out-tsc/test/nodes/split_by_airtime.test.js.map +1 -0
  139. package/out-tsc/test/nodes/split_by_contact_field.test.js +387 -0
  140. package/out-tsc/test/nodes/split_by_contact_field.test.js.map +1 -0
  141. package/out-tsc/test/nodes/split_by_expression.test.js +614 -0
  142. package/out-tsc/test/nodes/split_by_expression.test.js.map +1 -0
  143. package/out-tsc/test/nodes/split_by_random.test.js +3 -3
  144. package/out-tsc/test/nodes/split_by_random.test.js.map +1 -1
  145. package/out-tsc/test/nodes/split_by_resthook.test.js +337 -0
  146. package/out-tsc/test/nodes/split_by_resthook.test.js.map +1 -0
  147. package/out-tsc/test/nodes/split_by_run_result.test.js +920 -0
  148. package/out-tsc/test/nodes/split_by_run_result.test.js.map +1 -0
  149. package/out-tsc/test/nodes/split_by_scheme.test.js +399 -0
  150. package/out-tsc/test/nodes/split_by_scheme.test.js.map +1 -0
  151. package/out-tsc/test/nodes/split_by_subflow.test.js +333 -0
  152. package/out-tsc/test/nodes/split_by_subflow.test.js.map +1 -0
  153. package/out-tsc/test/nodes/wait_for_digits.test.js +2 -2
  154. package/out-tsc/test/nodes/wait_for_digits.test.js.map +1 -1
  155. package/out-tsc/test/nodes/wait_for_response.test.js +2 -1
  156. package/out-tsc/test/nodes/wait_for_response.test.js.map +1 -1
  157. package/out-tsc/test/temba-action-drag-between-nodes.test.js +252 -0
  158. package/out-tsc/test/temba-action-drag-between-nodes.test.js.map +1 -0
  159. package/out-tsc/test/temba-canvas-menu.test.js +122 -0
  160. package/out-tsc/test/temba-canvas-menu.test.js.map +1 -0
  161. package/out-tsc/test/temba-flow-editor-node.test.js +85 -2
  162. package/out-tsc/test/temba-flow-editor-node.test.js.map +1 -1
  163. package/out-tsc/test/temba-flow-editor.test.js +7 -8
  164. package/out-tsc/test/temba-flow-editor.test.js.map +1 -1
  165. package/out-tsc/test/temba-node-editor.test.js +3 -1
  166. package/out-tsc/test/temba-node-editor.test.js.map +1 -1
  167. package/out-tsc/test/temba-node-type-selector.test.js +115 -0
  168. package/out-tsc/test/temba-node-type-selector.test.js.map +1 -0
  169. package/out-tsc/test/temba-omnibox.test.js +2 -1
  170. package/out-tsc/test/temba-omnibox.test.js.map +1 -1
  171. package/out-tsc/test/temba-sortable-list.test.js +51 -0
  172. package/out-tsc/test/temba-sortable-list.test.js.map +1 -1
  173. package/out-tsc/test/temba-utils-index.test.js +1 -27
  174. package/out-tsc/test/temba-utils-index.test.js.map +1 -1
  175. package/out-tsc/test/utils.test.js +2 -0
  176. package/out-tsc/test/utils.test.js.map +1 -1
  177. package/package.json +2 -1
  178. package/screenshots/truth/actions/add_contact_groups/editor/descriptive-group-names.png +0 -0
  179. package/screenshots/truth/actions/add_contact_groups/editor/long-group-names.png +0 -0
  180. package/screenshots/truth/actions/add_contact_groups/editor/many-groups.png +0 -0
  181. package/screenshots/truth/actions/add_contact_groups/editor/multiple-groups.png +0 -0
  182. package/screenshots/truth/actions/add_contact_groups/editor/single-group.png +0 -0
  183. package/screenshots/truth/actions/add_contact_groups/render/descriptive-group-names.png +0 -0
  184. package/screenshots/truth/actions/add_contact_groups/render/long-group-names.png +0 -0
  185. package/screenshots/truth/actions/add_contact_groups/render/many-groups.png +0 -0
  186. package/screenshots/truth/actions/add_contact_groups/render/multiple-groups.png +0 -0
  187. package/screenshots/truth/actions/add_contact_groups/render/single-group.png +0 -0
  188. package/screenshots/truth/actions/add_contact_urn/editor/expression-facebook.png +0 -0
  189. package/screenshots/truth/actions/add_contact_urn/editor/expression-phone.png +0 -0
  190. package/screenshots/truth/actions/add_contact_urn/editor/facebook-id.png +0 -0
  191. package/screenshots/truth/actions/add_contact_urn/editor/instagram-handle.png +0 -0
  192. package/screenshots/truth/actions/add_contact_urn/editor/line-id.png +0 -0
  193. package/screenshots/truth/actions/add_contact_urn/editor/phone-number.png +0 -0
  194. package/screenshots/truth/actions/add_contact_urn/editor/telegram-id.png +0 -0
  195. package/screenshots/truth/actions/add_contact_urn/editor/viber-id.png +0 -0
  196. package/screenshots/truth/actions/add_contact_urn/editor/wechat-id.png +0 -0
  197. package/screenshots/truth/actions/add_contact_urn/editor/whatsapp.png +0 -0
  198. package/screenshots/truth/actions/add_contact_urn/render/expression-facebook.png +0 -0
  199. package/screenshots/truth/actions/add_contact_urn/render/expression-phone.png +0 -0
  200. package/screenshots/truth/actions/add_contact_urn/render/facebook-id.png +0 -0
  201. package/screenshots/truth/actions/add_contact_urn/render/instagram-handle.png +0 -0
  202. package/screenshots/truth/actions/add_contact_urn/render/line-id.png +0 -0
  203. package/screenshots/truth/actions/add_contact_urn/render/phone-number.png +0 -0
  204. package/screenshots/truth/actions/add_contact_urn/render/telegram-id.png +0 -0
  205. package/screenshots/truth/actions/add_contact_urn/render/viber-id.png +0 -0
  206. package/screenshots/truth/actions/add_contact_urn/render/wechat-id.png +0 -0
  207. package/screenshots/truth/actions/add_contact_urn/render/whatsapp.png +0 -0
  208. package/screenshots/truth/actions/remove_contact_groups/editor/cleanup-groups.png +0 -0
  209. package/screenshots/truth/actions/remove_contact_groups/editor/long-descriptive-group-names.png +0 -0
  210. package/screenshots/truth/actions/remove_contact_groups/editor/many-groups.png +0 -0
  211. package/screenshots/truth/actions/remove_contact_groups/editor/multiple-groups.png +0 -0
  212. package/screenshots/truth/actions/remove_contact_groups/editor/remove-from-all-groups.png +0 -0
  213. package/screenshots/truth/actions/remove_contact_groups/editor/single-group.png +0 -0
  214. package/screenshots/truth/actions/remove_contact_groups/render/cleanup-groups.png +0 -0
  215. package/screenshots/truth/actions/remove_contact_groups/render/long-descriptive-group-names.png +0 -0
  216. package/screenshots/truth/actions/remove_contact_groups/render/many-groups.png +0 -0
  217. package/screenshots/truth/actions/remove_contact_groups/render/multiple-groups.png +0 -0
  218. package/screenshots/truth/actions/remove_contact_groups/render/remove-from-all-groups.png +0 -0
  219. package/screenshots/truth/actions/remove_contact_groups/render/single-group.png +0 -0
  220. package/screenshots/truth/actions/send_broadcast/editor/contacts-only.png +0 -0
  221. package/screenshots/truth/actions/send_broadcast/editor/groups-and-contacts.png +0 -0
  222. package/screenshots/truth/actions/send_broadcast/editor/groups-only.png +0 -0
  223. package/screenshots/truth/actions/send_broadcast/editor/many-groups.png +0 -0
  224. package/screenshots/truth/actions/send_broadcast/editor/multiline-text.png +0 -0
  225. package/screenshots/truth/actions/send_broadcast/editor/with-attachments.png +0 -0
  226. package/screenshots/truth/actions/send_broadcast/render/contacts-only.png +0 -0
  227. package/screenshots/truth/actions/send_broadcast/render/groups-and-contacts.png +0 -0
  228. package/screenshots/truth/actions/send_broadcast/render/groups-only.png +0 -0
  229. package/screenshots/truth/actions/send_broadcast/render/many-groups.png +0 -0
  230. package/screenshots/truth/actions/send_broadcast/render/multiline-text.png +0 -0
  231. package/screenshots/truth/actions/send_broadcast/render/with-attachments.png +0 -0
  232. package/screenshots/truth/actions/send_email/editor/complex-business-email.png +0 -0
  233. package/screenshots/truth/actions/send_email/editor/empty-body.png +0 -0
  234. package/screenshots/truth/actions/send_email/editor/empty-subject.png +0 -0
  235. package/screenshots/truth/actions/send_email/editor/long-subject.png +0 -0
  236. package/screenshots/truth/actions/send_email/editor/multiline-body.png +0 -0
  237. package/screenshots/truth/actions/send_email/editor/multiple-recipients.png +0 -0
  238. package/screenshots/truth/actions/send_email/editor/simple-email.png +0 -0
  239. package/screenshots/truth/actions/send_email/editor/with-expressions.png +0 -0
  240. package/screenshots/truth/actions/send_email/render/complex-business-email.png +0 -0
  241. package/screenshots/truth/actions/send_email/render/empty-body.png +0 -0
  242. package/screenshots/truth/actions/send_email/render/empty-subject.png +0 -0
  243. package/screenshots/truth/actions/send_email/render/long-subject.png +0 -0
  244. package/screenshots/truth/actions/send_email/render/multiline-body.png +0 -0
  245. package/screenshots/truth/actions/send_email/render/multiple-recipients.png +0 -0
  246. package/screenshots/truth/actions/send_email/render/simple-email.png +0 -0
  247. package/screenshots/truth/actions/send_email/render/with-expressions.png +0 -0
  248. package/screenshots/truth/actions/send_msg/editor/long-quick-replies.png +0 -0
  249. package/screenshots/truth/actions/send_msg/editor/multiline-text-with-replies.png +0 -0
  250. package/screenshots/truth/actions/send_msg/editor/simple-text.png +0 -0
  251. package/screenshots/truth/actions/send_msg/editor/text-with-linebreaks.png +0 -0
  252. package/screenshots/truth/actions/send_msg/editor/text-with-many-quick-replies.png +0 -0
  253. package/screenshots/truth/actions/send_msg/editor/text-with-quick-replies.png +0 -0
  254. package/screenshots/truth/actions/send_msg/editor/text-without-quick-replies.png +0 -0
  255. package/screenshots/truth/actions/send_msg/render/long-quick-replies.png +0 -0
  256. package/screenshots/truth/actions/send_msg/render/multiline-text-with-replies.png +0 -0
  257. package/screenshots/truth/actions/send_msg/render/simple-text.png +0 -0
  258. package/screenshots/truth/actions/send_msg/render/text-with-linebreaks.png +0 -0
  259. package/screenshots/truth/actions/send_msg/render/text-with-many-quick-replies.png +0 -0
  260. package/screenshots/truth/actions/send_msg/render/text-with-quick-replies.png +0 -0
  261. package/screenshots/truth/actions/send_msg/render/text-without-quick-replies.png +0 -0
  262. package/screenshots/truth/actions/start_session/editor/contact-query.png +0 -0
  263. package/screenshots/truth/actions/start_session/editor/contacts-only.png +0 -0
  264. package/screenshots/truth/actions/start_session/editor/create-contact.png +0 -0
  265. package/screenshots/truth/actions/start_session/editor/groups-and-contacts.png +0 -0
  266. package/screenshots/truth/actions/start_session/editor/groups-only.png +0 -0
  267. package/screenshots/truth/actions/start_session/editor/many-recipients.png +0 -0
  268. package/screenshots/truth/actions/start_session/render/contact-query.png +0 -0
  269. package/screenshots/truth/actions/start_session/render/contacts-only.png +0 -0
  270. package/screenshots/truth/actions/start_session/render/create-contact.png +0 -0
  271. package/screenshots/truth/actions/start_session/render/groups-and-contacts.png +0 -0
  272. package/screenshots/truth/actions/start_session/render/groups-only.png +0 -0
  273. package/screenshots/truth/actions/start_session/render/many-recipients.png +0 -0
  274. package/screenshots/truth/canvas-menu/open.png +0 -0
  275. package/screenshots/truth/editor/router.png +0 -0
  276. package/screenshots/truth/editor/wait.png +0 -0
  277. package/screenshots/truth/list/fields-dragging.png +0 -0
  278. package/screenshots/truth/list/sortable-dragging.png +0 -0
  279. package/screenshots/truth/node-type-selector/action-mode.png +0 -0
  280. package/screenshots/truth/node-type-selector/split-mode.png +0 -0
  281. package/screenshots/truth/nodes/split_by_llm/editor/information-extraction.png +0 -0
  282. package/screenshots/truth/nodes/split_by_llm/editor/sentiment-analysis.png +0 -0
  283. package/screenshots/truth/nodes/split_by_llm/editor/summarization.png +0 -0
  284. package/screenshots/truth/nodes/split_by_llm/editor/translation-task.png +0 -0
  285. package/screenshots/truth/nodes/split_by_llm/render/information-extraction.png +0 -0
  286. package/screenshots/truth/nodes/split_by_llm/render/sentiment-analysis.png +0 -0
  287. package/screenshots/truth/nodes/split_by_llm/render/summarization.png +0 -0
  288. package/screenshots/truth/nodes/split_by_llm/render/translation-task.png +0 -0
  289. package/screenshots/truth/nodes/split_by_llm_categorize/editor/basic-categorization.png +0 -0
  290. package/screenshots/truth/nodes/split_by_llm_categorize/editor/custom-input-and-result-name.png +0 -0
  291. package/screenshots/truth/nodes/split_by_llm_categorize/editor/feedback-categorization.png +0 -0
  292. package/screenshots/truth/nodes/split_by_llm_categorize/editor/many-categories.png +0 -0
  293. package/screenshots/truth/nodes/split_by_llm_categorize/editor/minimal-categories.png +0 -0
  294. package/screenshots/truth/nodes/split_by_llm_categorize/render/basic-categorization.png +0 -0
  295. package/screenshots/truth/nodes/split_by_llm_categorize/render/custom-input-and-result-name.png +0 -0
  296. package/screenshots/truth/nodes/split_by_llm_categorize/render/feedback-categorization.png +0 -0
  297. package/screenshots/truth/nodes/split_by_llm_categorize/render/many-categories.png +0 -0
  298. package/screenshots/truth/nodes/split_by_llm_categorize/render/minimal-categories.png +0 -0
  299. package/screenshots/truth/nodes/split_by_random/editor/ab-test-multiple-variants.png +0 -0
  300. package/screenshots/truth/nodes/split_by_random/editor/sampling-split.png +0 -0
  301. package/screenshots/truth/nodes/split_by_random/editor/three-way-split.png +0 -0
  302. package/screenshots/truth/nodes/split_by_random/editor/two-bucket-split.png +0 -0
  303. package/screenshots/truth/nodes/split_by_random/render/ab-test-multiple-variants.png +0 -0
  304. package/screenshots/truth/nodes/split_by_random/render/sampling-split.png +0 -0
  305. package/screenshots/truth/nodes/split_by_random/render/three-way-split.png +0 -0
  306. package/screenshots/truth/nodes/split_by_random/render/two-bucket-split.png +0 -0
  307. package/screenshots/truth/nodes/wait_for_digits/editor/basic-digits-wait.png +0 -0
  308. package/screenshots/truth/nodes/wait_for_digits/editor/phone-number-collection.png +0 -0
  309. package/screenshots/truth/nodes/wait_for_digits/editor/single-digit-with-timeout.png +0 -0
  310. package/screenshots/truth/nodes/wait_for_digits/editor/verification-code.png +0 -0
  311. package/screenshots/truth/nodes/wait_for_digits/render/basic-digits-wait.png +0 -0
  312. package/screenshots/truth/nodes/wait_for_digits/render/phone-number-collection.png +0 -0
  313. package/screenshots/truth/nodes/wait_for_digits/render/single-digit-with-timeout.png +0 -0
  314. package/screenshots/truth/nodes/wait_for_digits/render/verification-code.png +0 -0
  315. package/screenshots/truth/nodes/wait_for_response/editor/basic-wait.png +0 -0
  316. package/screenshots/truth/nodes/wait_for_response/editor/custom-result-name.png +0 -0
  317. package/screenshots/truth/nodes/wait_for_response/editor/no-timeout.png +0 -0
  318. package/screenshots/truth/nodes/wait_for_response/editor/short-timeout.png +0 -0
  319. package/screenshots/truth/nodes/wait_for_response/render/basic-wait.png +0 -0
  320. package/screenshots/truth/nodes/wait_for_response/render/custom-result-name.png +0 -0
  321. package/screenshots/truth/nodes/wait_for_response/render/no-timeout.png +0 -0
  322. package/screenshots/truth/nodes/wait_for_response/render/short-timeout.png +0 -0
  323. package/src/Icons.ts +4 -1
  324. package/src/events.ts +2 -6
  325. package/src/flow/CanvasMenu.ts +217 -0
  326. package/src/flow/CanvasNode.ts +408 -10
  327. package/src/flow/Editor.ts +683 -44
  328. package/src/flow/NodeEditor.ts +304 -125
  329. package/src/flow/NodeTypeSelector.ts +592 -0
  330. package/src/flow/actions/add_contact_groups.ts +4 -4
  331. package/src/flow/actions/add_contact_urn.ts +76 -4
  332. package/src/flow/actions/add_input_labels.ts +4 -4
  333. package/src/flow/actions/play_audio.ts +2 -2
  334. package/src/flow/actions/remove_contact_groups.ts +14 -6
  335. package/src/flow/actions/request_optin.ts +2 -2
  336. package/src/flow/actions/say_msg.ts +2 -2
  337. package/src/flow/actions/send_broadcast.ts +85 -23
  338. package/src/flow/actions/send_email.ts +10 -6
  339. package/src/flow/actions/send_msg.ts +22 -32
  340. package/src/flow/actions/set_contact_channel.ts +5 -11
  341. package/src/flow/actions/set_contact_field.ts +20 -25
  342. package/src/flow/actions/set_contact_language.ts +9 -4
  343. package/src/flow/actions/set_contact_name.ts +3 -15
  344. package/src/flow/actions/set_contact_status.ts +3 -3
  345. package/src/flow/actions/set_run_result.ts +4 -4
  346. package/src/flow/actions/start_session.ts +208 -6
  347. package/src/flow/config.ts +13 -15
  348. package/src/flow/currencies.ts +51 -0
  349. package/src/flow/nodes/shared-rules.ts +301 -0
  350. package/src/flow/nodes/shared.ts +18 -0
  351. package/src/flow/nodes/split_by_airtime.ts +238 -5
  352. package/src/flow/nodes/split_by_contact_field.ts +185 -3
  353. package/src/flow/nodes/split_by_expression.ts +94 -2
  354. package/src/flow/nodes/split_by_groups.ts +15 -10
  355. package/src/flow/nodes/split_by_intent.ts +7 -0
  356. package/src/flow/nodes/split_by_llm.ts +4 -3
  357. package/src/flow/nodes/split_by_llm_categorize.ts +4 -4
  358. package/src/flow/nodes/split_by_random.ts +5 -5
  359. package/src/flow/nodes/split_by_resthook.ts +130 -0
  360. package/src/flow/nodes/split_by_run_result.ts +249 -3
  361. package/src/flow/nodes/split_by_scheme.ts +192 -2
  362. package/src/flow/nodes/split_by_subflow.ts +6 -4
  363. package/src/flow/nodes/split_by_ticket.ts +4 -3
  364. package/src/flow/nodes/split_by_webhook.ts +6 -5
  365. package/src/flow/nodes/wait_for_audio.ts +2 -2
  366. package/src/flow/nodes/wait_for_digits.ts +2 -2
  367. package/src/flow/nodes/wait_for_image.ts +2 -2
  368. package/src/flow/nodes/wait_for_location.ts +2 -2
  369. package/src/flow/nodes/wait_for_menu.ts +2 -2
  370. package/src/flow/nodes/wait_for_response.ts +48 -679
  371. package/src/flow/nodes/wait_for_video.ts +2 -2
  372. package/src/flow/types.ts +109 -23
  373. package/src/flow/utils.ts +108 -14
  374. package/src/form/FieldRenderer.ts +2 -4
  375. package/src/interfaces.ts +3 -0
  376. package/src/list/SortableList.ts +109 -34
  377. package/src/live/ContactChat.ts +15 -18
  378. package/src/store/AppState.ts +69 -0
  379. package/src/store/flow-definition.d.ts +2 -5
  380. package/src/utils.ts +332 -12
  381. package/static/api/channels.json +46 -0
  382. package/static/api/resthooks.json +31 -0
  383. package/static/svg/index.svg +1 -1
  384. package/static/svg/work/traced/lightning-02.svg +1 -0
  385. package/static/svg/work/used/lightning-02.svg +3 -0
  386. package/temba-modules.ts +4 -0
  387. package/test/ActionHelper.ts +3 -3
  388. package/test/NodeHelper.ts +6 -3
  389. package/test/actions/add_contact_urn.test.ts +287 -0
  390. package/test/actions/send_broadcast.test.ts +190 -0
  391. package/test/actions/send_email.test.ts +17 -23
  392. package/test/actions/send_msg.test.ts +39 -15
  393. package/test/actions/start_session.test.ts +151 -0
  394. package/test/nodes/split_by_airtime.test.ts +673 -0
  395. package/test/nodes/split_by_contact_field.test.ts +451 -0
  396. package/test/nodes/split_by_expression.test.ts +751 -0
  397. package/test/nodes/split_by_random.test.ts +3 -3
  398. package/test/nodes/split_by_resthook.test.ts +398 -0
  399. package/test/nodes/split_by_run_result.test.ts +1109 -0
  400. package/test/nodes/split_by_scheme.test.ts +486 -0
  401. package/test/nodes/split_by_subflow.test.ts +381 -0
  402. package/test/nodes/wait_for_digits.test.ts +2 -2
  403. package/test/nodes/wait_for_response.test.ts +2 -1
  404. package/test/temba-action-drag-between-nodes.test.ts +301 -0
  405. package/test/temba-canvas-menu.test.ts +156 -0
  406. package/test/temba-flow-editor-node.test.ts +102 -2
  407. package/test/temba-flow-editor.test.ts +7 -8
  408. package/test/temba-node-editor.test.ts +3 -1
  409. package/test/temba-node-type-selector.test.ts +152 -0
  410. package/test/temba-omnibox.test.ts +2 -1
  411. package/test/temba-sortable-list.test.ts +69 -0
  412. package/test/temba-utils-index.test.ts +0 -35
  413. package/test/utils.test.ts +2 -0
  414. package/test-assets/contacts/history.json +14 -20
  415. package/web-dev-server.config.mjs +3 -1
  416. package/out-tsc/src/flow/actions/call_classifier.js +0 -11
  417. package/out-tsc/src/flow/actions/call_classifier.js.map +0 -1
  418. package/out-tsc/src/flow/actions/call_resthook.js +0 -11
  419. package/out-tsc/src/flow/actions/call_resthook.js.map +0 -1
  420. package/out-tsc/src/flow/actions/split_by_expression_example.js +0 -77
  421. package/out-tsc/src/flow/actions/split_by_expression_example.js.map +0 -1
  422. package/out-tsc/src/flow/actions/transfer_airtime.js +0 -11
  423. package/out-tsc/src/flow/actions/transfer_airtime.js.map +0 -1
  424. package/src/flow/actions/call_classifier.ts +0 -12
  425. package/src/flow/actions/call_resthook.ts +0 -12
  426. package/src/flow/actions/split_by_expression_example.ts +0 -88
  427. package/src/flow/actions/transfer_airtime.ts +0 -12
@@ -1,13 +1,18 @@
1
1
  import { html } from 'lit-html';
2
- import { COLORS } from '../types';
2
+ import { ACTION_GROUPS } from '../types';
3
3
  export const set_contact_field = {
4
4
  name: 'Update Field',
5
- color: COLORS.update,
5
+ group: ACTION_GROUPS.contacts,
6
6
  render: (_node, action) => {
7
- return html `<div>
8
- Set <strong>${action.field.name}</strong> to
9
- <strong>${action.value}</strong>
10
- </div>`;
7
+ if (action.value) {
8
+ return html `<div>
9
+ Set <strong>${action.field.name}</strong> to
10
+ <strong>${action.value}</strong>
11
+ </div>`;
12
+ }
13
+ else {
14
+ return html `<div>Clear <strong>${action.field.name}</strong></div>`;
15
+ }
11
16
  },
12
17
  form: {
13
18
  field: {
@@ -16,6 +21,7 @@ export const set_contact_field = {
16
21
  required: true,
17
22
  searchable: true,
18
23
  clearable: false,
24
+ placeholder: 'Search for contact fields...',
19
25
  nameKey: 'name',
20
26
  valueKey: 'key',
21
27
  endpoint: '/api/v2/fields.json',
@@ -27,11 +33,17 @@ export const set_contact_field = {
27
33
  type: 'text',
28
34
  label: 'Value',
29
35
  placeholder: 'Enter field value...',
30
- required: true,
31
36
  evaluated: true,
32
37
  helpText: 'The new value for the contact field. You can use expressions like @contact.name'
33
38
  }
34
39
  },
40
+ toFormData: (action) => {
41
+ return {
42
+ uuid: action.uuid,
43
+ field: action.field ? [action.field] : null,
44
+ value: action.value
45
+ };
46
+ },
35
47
  fromFormData: (formData) => {
36
48
  const field = formData.field[0];
37
49
  return {
@@ -41,19 +53,6 @@ export const set_contact_field = {
41
53
  value: formData.value
42
54
  };
43
55
  },
44
- validate: (formData) => {
45
- const errors = {};
46
- if (!formData.field) {
47
- errors.field = 'Field is required';
48
- }
49
- if (!formData.value || formData.value.trim() === '') {
50
- errors.value = 'Field value is required';
51
- }
52
- return {
53
- valid: Object.keys(errors).length === 0,
54
- errors
55
- };
56
- },
57
56
  sanitize: (formData) => {
58
57
  if (formData.value && typeof formData.value === 'string') {
59
58
  formData.value = formData.value.trim();
@@ -1 +1 @@
1
- {"version":3,"file":"set_contact_field.js","sourceRoot":"","sources":["../../../../src/flow/actions/set_cont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AAC,GAAG,EAAE;YAC3C,KAAK,EAAE,QAAQ,CAAC,KAAK;SACtB,CAAC;IACJ,CAAC;IACD,QAAQ,EAAE,CAAC,QAAyB,EAAoB,EAAE;QACxD,MAAM,MAAM,GAA8B,EAAE,CAAC;QAE7C,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;YACpB,MAAM,CAAC,KAAK,GAAG,mBAAmB,CAAC;QACrC,CAAC;QAED,IAAI,CAAC,QAAQ,CAAC,KAAK,IAAI,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;YACpD,MAAM,CAAC,KAAK,GAAG,yBAAyB,CAAC;QAC3C,CAAC;QAED,OAAO;YACL,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,KAAK,CAAC;YACvC,MAAM;SACP,CAAC;IACJ,CAAC;IACD,QAAQ,EAAE,CAAC,QAAyB,EAAQ,EAAE;QAC5C,IAAI,QAAQ,CAAC,KAAK,IAAI,OAAO,QAAQ,CAAC,KAAK,KAAK,QAAQ,EAAE,CAAC;YACzD,QAAQ,CAAC,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;QACzC,CAAC;IACH,CAAC;CACF,CAAC","sourcesContent":["import { html } from 'lit-html';\nimport { ActionConfig, COLORS, ValidationResult } from '../types';\nimport { Node, SetContactField } from '../../store/flow-definition';\n\nexport const set_contact_field: ActionConfig = {\n name: 'Update Field',\n color: COLORS.update,\n render: (_node: Node, action: SetContactField) => {\n return html`<div>\n Set <strong>${action.field.name}</strong> to\n <strong>${action.value}</strong>\n </div>`;\n },\n form: {\n field: {\n type: 'select',\n label: 'Field',\n required: true,\n searchable: true,\n clearable: false,\n nameKey: 'name',\n valueKey: 'key',\n endpoint: '/api/v2/fields.json',\n helpText: 'Select the contact field to update',\n allowCreate: true,\n createArbitraryOption: (input: string) => ({ key: input, name: input })\n },\n value: {\n type: 'text',\n label: 'Value',\n placeholder: 'Enter field value...',\n required: true,\n evaluated: true,\n helpText:\n 'The new value for the contact field. You can use expressions like @contact.name'\n }\n },\n fromFormData: (formData: SetContactField): SetContactField => {\n const field = formData.field[0];\n return {\n uuid: formData.uuid,\n type: 'set_contact_field',\n field: { name: field.name, key: field.key },\n value: formData.value\n };\n },\n validate: (formData: SetContactField): ValidationResult => {\n const errors: { [key: string]: string } = {};\n\n if (!formData.field) {\n errors.field = 'Field is required';\n }\n\n if (!formData.value || formData.value.trim() === '') {\n errors.value = 'Field value is required';\n }\n\n return {\n valid: Object.keys(errors).length === 0,\n errors\n };\n },\n sanitize: (formData: SetContactField): void => {\n if (formData.value && typeof formData.value === 'string') {\n formData.value = formData.value.trim();\n }\n }\n};\n"]}
1
+ {"version":3,"file":"set_contact_field.js","sourceRoot":"","sources":["../../../../src/flow/actions/set_contact_field.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAChC,OAAO,EAAgB,aAAa,EAAY,MAAM,UAAU,CAAC;AAGjE,MAAM,CAAC,MAAM,iBAAiB,GAAiB;IAC7C,IAAI,EAAE,cAAc;IACpB,KAAK,EAAE,aAAa,CAAC,QAAQ;IAC7B,MAAM,EAAE,CAAC,KAAW,EAAE,MAAuB,EAAE,EAAE;QAC/C,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;YACjB,OAAO,IAAI,CAAA;sBACK,MAAM,CAAC,KAAK,CAAC,IAAI;kBACrB,MAAM,CAAC,KAAK;aACjB,CAAC;QACV,CAAC;aAAM,CAAC;YACN,OAAO,IAAI,CAAA,sBAAsB,MAAM,CAAC,KAAK,CAAC,IAAI,iBAAiB,CAAC;QACtE,CAAC;IACH,CAAC;IACD,IAAI,EAAE;QACJ,KAAK,EAAE;YACL,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,OAAO;YACd,QAAQ,EAAE,IAAI;YACd,UAAU,EAAE,IAAI;YAChB,SAAS,EAAE,KAAK;YAChB,WAAW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,CAAC;IACH,CAAC;CACF,CAAC","sourcesContent":["import { html } from 'lit-html';\nimport { ActionConfig, ACTION_GROUPS, FormData } from '../types';\nimport { Node, SetContactField } from '../../store/flow-definition';\n\nexport const set_contact_field: ActionConfig = {\n name: 'Update Field',\n group: ACTION_GROUPS.contacts,\n render: (_node: Node, action: SetContactField) => {\n if (action.value) {\n return html`<div>\n Set <strong>${action.field.name}</strong> to\n <strong>${action.value}</strong>\n </div>`;\n } else {\n return html`<div>Clear <strong>${action.field.name}</strong></div>`;\n }\n },\n form: {\n field: {\n type: 'select',\n label: 'Field',\n required: true,\n searchable: true,\n clearable: false,\n placeholder: 'Search for contact fields...',\n nameKey: 'name',\n valueKey: 'key',\n endpoint: '/api/v2/fields.json',\n helpText: 'Select the contact field to update',\n allowCreate: true,\n createArbitraryOption: (input: string) => ({ key: input, name: input })\n },\n value: {\n type: 'text',\n label: 'Value',\n placeholder: 'Enter field value...',\n evaluated: true,\n helpText:\n 'The new value for the contact field. You can use expressions like @contact.name'\n }\n },\n toFormData: (action: SetContactField) => {\n return {\n uuid: action.uuid,\n field: action.field ? [action.field] : null,\n value: action.value\n };\n },\n fromFormData: (formData: FormData): SetContactField => {\n const field = formData.field[0];\n return {\n uuid: formData.uuid,\n type: 'set_contact_field',\n field: { name: field.name, key: field.key },\n value: formData.value\n };\n },\n sanitize: (formData: FormData): void => {\n if (formData.value && typeof formData.value === 'string') {\n formData.value = formData.value.trim();\n }\n }\n};\n"]}
@@ -1,9 +1,9 @@
1
1
  import { html } from 'lit-html';
2
- import { COLORS } from '../types';
2
+ import { ACTION_GROUPS } from '../types';
3
3
  import { getStore } from '../../store/Store';
4
4
  export const set_contact_language = {
5
5
  name: 'Update Language',
6
- color: COLORS.update,
6
+ group: ACTION_GROUPS.contacts,
7
7
  render: (_node, action) => {
8
8
  const languageNames = new Intl.DisplayNames(['en'], {
9
9
  type: 'language'
@@ -1 +1 @@
1
- {"version":3,"file":"set_contact_language.js","sourceRoot":"","sources":["../../../../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EAAE,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,KAAK,CAAC;YACvC,MAAM;SACP,CAAC;IACJ,CAAC;CACF,CAAC","sourcesContent":["import { html } from 'lit-html';\nimport { ActionConfig, COLORS, ValidationResult } from '../types';\nimport { Node, SetContactLanguage } from '../../store/flow-definition';\nimport { getStore } from '../../store/Store';\n\nexport const set_contact_language: ActionConfig = {\n name: 'Update Language',\n color: COLORS.update,\n render: (_node: Node, action: SetContactLanguage) => {\n const languageNames = new Intl.DisplayNames(['en'], {\n type: 'language'\n });\n return html`<div>\n Set to <strong>${languageNames.of(action.language)}</strong>\n </div>`;\n },\n form: {\n language: {\n type: 'select',\n label: 'Language',\n required: true,\n searchable: true,\n clearable: false,\n valueKey: 'value',\n nameKey: 'name',\n helpText: 'Select the language to set for the contact',\n getDynamicOptions: () => {\n const store = getStore();\n const workspace = store?.getState().workspace;\n if (workspace?.languages && Array.isArray(workspace.languages)) {\n const languageNames = new Intl.DisplayNames(['en'], {\n type: 'language'\n });\n return workspace.languages.map((languageCode: string) => ({\n value: languageCode,\n name: languageNames.of(languageCode) || languageCode\n }));\n }\n return [];\n }\n }\n },\n toFormData: (action: SetContactLanguage) => {\n // Convert the language code back to the option object format expected by the form\n if (action.language) {\n const languageNames = new Intl.DisplayNames(['en'], {\n type: 'language'\n });\n return {\n language: [\n {\n value: action.language,\n name: languageNames.of(action.language) || action.language\n }\n ],\n uuid: action.uuid\n };\n }\n return {\n language: null,\n uuid: action.uuid\n };\n },\n fromFormData: (formData: any): SetContactLanguage => {\n return {\n uuid: formData.uuid,\n type: 'set_contact_language',\n language: formData.language[0].value\n };\n },\n\n validate: (formData: any): ValidationResult => {\n const errors: { [key: string]: string } = {};\n\n if (!formData.language) {\n errors.language = 'Language is required';\n }\n\n return {\n valid: Object.keys(errors).length === 0,\n errors\n };\n }\n};\n"]}
1
+ {"version":3,"file":"set_contact_language.js","sourceRoot":"","sources":["../../../../src/flow/actions/set_contact_language.ts"],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I,CAAC,MAAM,CAAC,CAAC,MAAM,KAAK,CAAC;YACvC,MAAM;SACP,CAAC;IACJ,CAAC;CACF,CAAC","sourcesContent":["import { html } from 'lit-html';\nimport {\n ActionConfig,\n ACTION_GROUPS,\n FormData,\n ValidationResult\n} from '../types';\nimport { Node, SetContactLanguage } from '../../store/flow-definition';\nimport { getStore } from '../../store/Store';\n\nexport const set_contact_language: ActionConfig = {\n name: 'Update Language',\n group: ACTION_GROUPS.contacts,\n render: (_node: Node, action: SetContactLanguage) => {\n const languageNames = new Intl.DisplayNames(['en'], {\n type: 'language'\n });\n return html`<div>\n Set to <strong>${languageNames.of(action.language)}</strong>\n </div>`;\n },\n form: {\n language: {\n type: 'select',\n label: 'Language',\n required: true,\n searchable: true,\n clearable: false,\n valueKey: 'value',\n nameKey: 'name',\n helpText: 'Select the language to set for the contact',\n getDynamicOptions: () => {\n const store = getStore();\n const workspace = store?.getState().workspace;\n if (workspace?.languages && Array.isArray(workspace.languages)) {\n const languageNames = new Intl.DisplayNames(['en'], {\n type: 'language'\n });\n return workspace.languages.map((languageCode: string) => ({\n value: languageCode,\n name: languageNames.of(languageCode) || languageCode\n }));\n }\n return [];\n }\n }\n },\n toFormData: (action: SetContactLanguage) => {\n // Convert the language code back to the option object format expected by the form\n if (action.language) {\n const languageNames = new Intl.DisplayNames(['en'], {\n type: 'language'\n });\n return {\n language: [\n {\n value: action.language,\n name: languageNames.of(action.language) || action.language\n }\n ],\n uuid: action.uuid\n };\n }\n return {\n language: null,\n uuid: action.uuid\n };\n },\n fromFormData: (formData: FormData): SetContactLanguage => {\n return {\n uuid: formData.uuid,\n type: 'set_contact_language',\n language: formData.language[0].value\n };\n },\n\n validate: (formData: FormData): ValidationResult => {\n const errors: { [key: string]: string } = {};\n\n if (!formData.language) {\n errors.language = 'Language is required';\n }\n\n return {\n valid: Object.keys(errors).length === 0,\n errors\n };\n }\n};\n"]}
@@ -1,8 +1,8 @@
1
1
  import { html } from 'lit-html';
2
- import { COLORS } from '../types';
2
+ import { ACTION_GROUPS } from '../types';
3
3
  export const set_contact_name = {
4
4
  name: 'Update Name',
5
- color: COLORS.update,
5
+ group: ACTION_GROUPS.contacts,
6
6
  render: (_node, action) => {
7
7
  return html `<div>Set to <strong>${action.name}</strong></div>`;
8
8
  },
@@ -16,16 +16,6 @@ export const set_contact_name = {
16
16
  helpText: 'The new name for the contact. You can use expressions like @contact.name'
17
17
  }
18
18
  },
19
- validate: (formData) => {
20
- const errors = {};
21
- if (!formData.name || formData.name.trim() === '') {
22
- errors.name = 'Name is required';
23
- }
24
- return {
25
- valid: Object.keys(errors).length === 0,
26
- errors
27
- };
28
- },
29
19
  sanitize: (formData) => {
30
20
  if (formData.name && typeof formData.name === 'string') {
31
21
  formData.name = formData.name.trim();
@@ -1 +1 @@
1
- {"version":3,"file":"set_contact_name.js","sourceRoot":"","sources":["../../../../src/flow/actions/set_contact_name.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAChC,OAAO,EAAgB,MAAM,EAAoB,MAAM,UAAU,CAAC;AAGlE,MAAM,CAAC,MAAM,gBAAgB,GAAiB;IAC5C,IAAI,EAAE,aAAa;IACnB,KAAK,EAAE,MAAM,CAAC,MAAM;IACpB,MAAM,EAAE,CAAC,KAAW,EAAE,MAAsB,EAAE,EAAE;QAC9C,OAAO,IAAI,CAAA,uBAAuB,MAAM,CAAC,IAAI,iBAAiB,CAAC;IACjE,CAAC;IACD,IAAI,EAAE;QACJ,IAAI,EAAE;YACJ,IAAI,EAAE,MAAM;YACZ,KAAK,EAAE,MAAM;YACb,WAAW,EAAE,uBAAuB;YACpC,QAAQ,EAAE,IAAI;YACd,SAAS,EAAE,IAAI;YACf,QAAQ,EACN,0EAA0E;SAC7E;KACF;IACD,QAAQ,EAAE,CAAC,QAAwB,EAAoB,EAAE;QACvD,MAAM,MAAM,GAA8B,EAAE,CAAC;QAE7C,IAAI,CAAC,QAAQ,CAAC,IAAI,IAAI,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;YAClD,MAAM,CAAC,IAAI,GAAG,kBAAkB,CAAC;QACnC,CAAC;QAED,OAAO;YACL,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,KAAK,CAAC;YACvC,MAAM;SACP,CAAC;IACJ,CAAC;IACD,QAAQ,EAAE,CAAC,QAAwB,EAAQ,EAAE;QAC3C,IAAI,QAAQ,CAAC,IAAI,IAAI,OAAO,QAAQ,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;YACvD,QAAQ,CAAC,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;QACvC,CAAC;IACH,CAAC;CACF,CAAC","sourcesContent":["import { html } from 'lit-html';\nimport { ActionConfig, COLORS, ValidationResult } from '../types';\nimport { Node, SetContactName } from '../../store/flow-definition';\n\nexport const set_contact_name: ActionConfig = {\n name: 'Update Name',\n color: COLORS.update,\n render: (_node: Node, action: SetContactName) => {\n return html`<div>Set to <strong>${action.name}</strong></div>`;\n },\n form: {\n name: {\n type: 'text',\n label: 'Name',\n placeholder: 'Enter contact name...',\n required: true,\n evaluated: true,\n helpText:\n 'The new name for the contact. You can use expressions like @contact.name'\n }\n },\n validate: (formData: SetContactName): ValidationResult => {\n const errors: { [key: string]: string } = {};\n\n if (!formData.name || formData.name.trim() === '') {\n errors.name = 'Name is required';\n }\n\n return {\n valid: Object.keys(errors).length === 0,\n errors\n };\n },\n sanitize: (formData: SetContactName): void => {\n if (formData.name && typeof formData.name === 'string') {\n formData.name = formData.name.trim();\n }\n }\n};\n"]}
1
+ {"version":3,"file":"set_contact_name.js","sourceRoot":"","sources":["../../../../src/flow/actions/set_contact_name.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAChC,OAAO,EAAgB,aAAa,EAAY,MAAM,UAAU,CAAC;AAGjE,MAAM,CAAC,MAAM,gBAAgB,GAAiB;IAC5C,IAAI,EAAE,aAAa;IACnB,KAAK,EAAE,aAAa,CAAC,QAAQ;IAC7B,MAAM,EAAE,CAAC,KAAW,EAAE,MAAsB,EAAE,EAAE;QAC9C,OAAO,IAAI,CAAA,uBAAuB,MAAM,CAAC,IAAI,iBAAiB,CAAC;IACjE,CAAC;IACD,IAAI,EAAE;QACJ,IAAI,EAAE;YACJ,IAAI,EAAE,MAAM;YACZ,KAAK,EAAE,MAAM;YACb,WAAW,EAAE,uBAAuB;YACpC,QAAQ,EAAE,IAAI;YACd,SAAS,EAAE,IAAI;YACf,QAAQ,EACN,0EAA0E;SAC7E;KACF;IACD,QAAQ,EAAE,CAAC,QAAkB,EAAQ,EAAE;QACrC,IAAI,QAAQ,CAAC,IAAI,IAAI,OAAO,QAAQ,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;YACvD,QAAQ,CAAC,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;QACvC,CAAC;IACH,CAAC;CACF,CAAC","sourcesContent":["import { html } from 'lit-html';\nimport { ActionConfig, ACTION_GROUPS, FormData } from '../types';\nimport { Node, SetContactName } from '../../store/flow-definition';\n\nexport const set_contact_name: ActionConfig = {\n name: 'Update Name',\n group: ACTION_GROUPS.contacts,\n render: (_node: Node, action: SetContactName) => {\n return html`<div>Set to <strong>${action.name}</strong></div>`;\n },\n form: {\n name: {\n type: 'text',\n label: 'Name',\n placeholder: 'Enter contact name...',\n required: true,\n evaluated: true,\n helpText:\n 'The new name for the contact. You can use expressions like @contact.name'\n }\n },\n sanitize: (formData: FormData): void => {\n if (formData.name && typeof formData.name === 'string') {\n formData.name = formData.name.trim();\n }\n }\n};\n"]}
@@ -1,9 +1,9 @@
1
1
  import { html } from 'lit-html';
2
- import { COLORS } from '../types';
2
+ import { ACTION_GROUPS } from '../types';
3
3
  import { titleCase } from '../../utils';
4
4
  export const set_contact_status = {
5
5
  name: 'Update Status',
6
- color: COLORS.update,
6
+ group: ACTION_GROUPS.contacts,
7
7
  render: (_node, action) => {
8
8
  return html `<div>Set to <strong>${titleCase(action.status)}</strong></div>`;
9
9
  },
@@ -1 +1 @@
1
- {"version":3,"file":"set_contact_status.js","sourceRoot":"","sources":["../../../../src/flow/actions/set_contact_status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAChC,OAAO,EAAgB,MAAM,EAAE,MAAM,UAAU,CAAC;AAEhD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,MAAM,CAAC,MAAM,kBAAkB,GAAiB;IAC9C,IAAI,EAAE,eAAe;IACrB,KAAK,EAAE,MAAM,CAAC,MAAM;IACpB,MAAM,EAAE,CAAC,KAAW,EAAE,MAAwB,EAAE,EAAE;QAChD,OAAO,IAAI,CAAA,uBAAuB,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,iBAAiB,CAAC;IAC9E,CAAC;IACD,UAAU,EAAE,CAAC,MAAwB,EAAE,EAAE;QACvC,OAAO;YACL,GAAG,MAAM;YACT,MAAM,EAAE;gBACN,IAAI,EAAE,SAAS,CAAC,MAAM,CAAC,MAAM,IAAI,QAAQ,CAAC;gBAC1C,KAAK,EAAE,MAAM,CAAC,MAAM,IAAI,QAAQ;aACjC;SACF,CAAC;IACJ,CAAC;IACD,YAAY,EAAE,CAAC,QAAa,EAAoB,EAAE;QAChD,OAAO;YACL,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK;YAChC,IAAI,EAAE,oBAAoB;YAC1B,IAAI,EAAE,QAAQ,CAAC,IAAI;SACpB,CAAC;IACJ,CAAC;IACD,IAAI,EAAE;QACJ,MAAM,EAAE;YACN,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,QAAQ;YACf,QAAQ,EAAE,IAAI;YACd,UAAU,EAAE,KAAK;YACjB,SAAS,EAAE,KAAK;YAChB,OAAO,EAAE;gBACP,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE;gBACnC,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,UAAU,EAAE;gBACvC,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE;gBACrC,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE;aACtC;YACD,QAAQ,EAAE,0CAA0C;SACrD;KACF;CACF,CAAC","sourcesContent":["import { html } from 'lit-html';\nimport { ActionConfig, COLORS } from '../types';\nimport { Node, SetContactStatus } from '../../store/flow-definition';\nimport { titleCase } from '../../utils';\n\nexport const set_contact_status: ActionConfig = {\n name: 'Update Status',\n color: COLORS.update,\n render: (_node: Node, action: SetContactStatus) => {\n return html`<div>Set to <strong>${titleCase(action.status)}</strong></div>`;\n },\n toFormData: (action: SetContactStatus) => {\n return {\n ...action,\n status: {\n name: titleCase(action.status || 'active'),\n value: action.status || 'active'\n }\n };\n },\n fromFormData: (formData: any): SetContactStatus => {\n return {\n status: formData.status[0].value,\n type: 'set_contact_status',\n uuid: formData.uuid\n };\n },\n form: {\n status: {\n type: 'select',\n label: 'Status',\n required: true,\n searchable: false,\n clearable: false,\n options: [\n { value: 'active', name: 'Active' },\n { value: 'archived', name: 'Archived' },\n { value: 'stopped', name: 'Stopped' },\n { value: 'blocked', name: 'Blocked' }\n ],\n helpText: 'Select the status to set for the contact'\n }\n }\n};\n"]}
1
+ {"version":3,"file":"set_contact_status.js","sourceRoot":"","sources":["../../../../src/flow/actions/set_contact_status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAChC,OAAO,EAAgB,aAAa,EAAY,MAAM,UAAU,CAAC;AAEjE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,MAAM,CAAC,MAAM,kBAAkB,GAAiB;IAC9C,IAAI,EAAE,eAAe;IACrB,KAAK,EAAE,aAAa,CAAC,QAAQ;IAC7B,MAAM,EAAE,CAAC,KAAW,EAAE,MAAwB,EAAE,EAAE;QAChD,OAAO,IAAI,CAAA,uBAAuB,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,iBAAiB,CAAC;IAC9E,CAAC;IACD,UAAU,EAAE,CAAC,MAAwB,EAAE,EAAE;QACvC,OAAO;YACL,GAAG,MAAM;YACT,MAAM,EAAE;gBACN,IAAI,EAAE,SAAS,CAAC,MAAM,CAAC,MAAM,IAAI,QAAQ,CAAC;gBAC1C,KAAK,EAAE,MAAM,CAAC,MAAM,IAAI,QAAQ;aACjC;SACF,CAAC;IACJ,CAAC;IACD,YAAY,EAAE,CAAC,QAAkB,EAAoB,EAAE;QACrD,OAAO;YACL,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK;YAChC,IAAI,EAAE,oBAAoB;YAC1B,IAAI,EAAE,QAAQ,CAAC,IAAI;SACpB,CAAC;IACJ,CAAC;IACD,IAAI,EAAE;QACJ,MAAM,EAAE;YACN,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,QAAQ;YACf,QAAQ,EAAE,IAAI;YACd,UAAU,EAAE,KAAK;YACjB,SAAS,EAAE,KAAK;YAChB,OAAO,EAAE;gBACP,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE;gBACnC,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,UAAU,EAAE;gBACvC,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE;gBACrC,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE;aACtC;YACD,QAAQ,EAAE,0CAA0C;SACrD;KACF;CACF,CAAC","sourcesContent":["import { html } from 'lit-html';\nimport { ActionConfig, ACTION_GROUPS, FormData } from '../types';\nimport { Node, SetContactStatus } from '../../store/flow-definition';\nimport { titleCase } from '../../utils';\n\nexport const set_contact_status: ActionConfig = {\n name: 'Update Status',\n group: ACTION_GROUPS.contacts,\n render: (_node: Node, action: SetContactStatus) => {\n return html`<div>Set to <strong>${titleCase(action.status)}</strong></div>`;\n },\n toFormData: (action: SetContactStatus) => {\n return {\n ...action,\n status: {\n name: titleCase(action.status || 'active'),\n value: action.status || 'active'\n }\n };\n },\n fromFormData: (formData: FormData): SetContactStatus => {\n return {\n status: formData.status[0].value,\n type: 'set_contact_status',\n uuid: formData.uuid\n };\n },\n form: {\n status: {\n type: 'select',\n label: 'Status',\n required: true,\n searchable: false,\n clearable: false,\n options: [\n { value: 'active', name: 'Active' },\n { value: 'archived', name: 'Archived' },\n { value: 'stopped', name: 'Stopped' },\n { value: 'blocked', name: 'Blocked' }\n ],\n helpText: 'Select the status to set for the contact'\n }\n }\n};\n"]}
@@ -1,9 +1,9 @@
1
1
  import { html } from 'lit-html';
2
- import { COLORS } from '../types';
2
+ import { ACTION_GROUPS } from '../types';
3
3
  import { getStore } from '../../store/Store';
4
4
  export const set_run_result = {
5
5
  name: 'Save Flow Result',
6
- color: COLORS.save,
6
+ group: ACTION_GROUPS.save,
7
7
  render: (_node, action) => {
8
8
  return html `<div>
9
9
  Save <strong>${action.value}</strong> as <strong>${action.name}</strong>
@@ -55,7 +55,7 @@ export const set_run_result = {
55
55
  toFormData: (action) => {
56
56
  return {
57
57
  uuid: action.uuid,
58
- name: action.name ? [{ name: action.name, value: action.name }] : [],
58
+ name: action.name ? [{ name: action.name, value: action.name }] : null,
59
59
  value: action.value || '',
60
60
  category: action.category || ''
61
61
  };
@@ -1 +1 @@
1
- {"version":3,"file":"set_run_result.js","sourceRoot":"","sources":["../../../../src/flow/actions/set_run_result.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAChC,OAAO,EAAgB,MAAM,EAAE,MAAM,UAAU,CAAC;AAEhD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,MAAM,CAAC,MAAM,cAAc,GAAiB;IAC1C,IAAI,EAAE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AI,KAAK,QAAQ,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;YAC1C,0DAA0D;YAC1D,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QACnB,CAAC;QAED,OAAO;YACL,IAAI,EAAE,QAAQ,CAAC,IAAI;YACnB,IAAI,EAAE,gBAAgB;YACtB,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE,8BAA8B;YAClD,KAAK,EAAE,QAAQ,CAAC,KAAK,IAAI,EAAE;YAC3B,QAAQ,EAAE,QAAQ,CAAC,QAAQ,IAAI,EAAE;SAClC,CAAC;IACJ,CAAC;CACF,CAAC","sourcesContent":["import { html } from 'lit-html';\nimport { ActionConfig, COLORS } from '../types';\nimport { Node, SetRunResult } from '../../store/flow-definition';\nimport { getStore } from '../../store/Store';\n\nexport const set_run_result: ActionConfig = {\n name: 'Save Flow Result',\n color: COLORS.save,\n render: (_node: Node, action: SetRunResult) => {\n return html`<div>\n Save <strong>${action.value}</strong> as <strong>${action.name}</strong>\n </div>`;\n },\n form: {\n name: {\n type: 'select',\n label: 'Result Name',\n helpText: 'Select an existing result name or type a new one',\n required: true,\n placeholder: 'Select or enter result name...',\n createArbitraryOption: (input, options) => {\n const exists = options.some(\n (option: any) =>\n option.value.toLowerCase() === input.toLowerCase() ||\n option.name.toLowerCase() === input.toLowerCase()\n );\n return !exists && input.trim().length > 0\n ? { value: input, name: input }\n : null;\n },\n searchable: true,\n clearable: false,\n getDynamicOptions: () => {\n const store = getStore();\n return store\n ? store\n .getState()\n .getFlowResults()\n .map((r) => ({ value: r.name, name: r.name }))\n : [];\n }\n },\n value: {\n type: 'text',\n label: 'Value',\n helpText: 'The value to save for this result (can use expressions)',\n required: false,\n evaluated: true,\n placeholder: 'Enter value...'\n },\n category: {\n type: 'text',\n label: 'Category',\n helpText: 'Optional category for this result',\n required: false,\n placeholder: 'Enter category...'\n }\n },\n layout: ['name', 'value', 'category'],\n toFormData: (action: SetRunResult) => {\n return {\n uuid: action.uuid,\n name: action.name ? [{ name: action.name, value: action.name }] : [],\n value: action.value || '',\n category: action.category || ''\n };\n },\n fromFormData: (formData: any): SetRunResult => {\n // Ensure name is a simple string, handling both direct values and select option objects\n let name = formData.name || '';\n if (Array.isArray(name) && name.length > 0) {\n // If it's an array (from multi-select), take the first item\n name = name[0];\n }\n if (typeof name === 'object' && name.value) {\n // If it's an option object, extract the value\n name = name.value;\n }\n if (typeof name === 'object' && name.name) {\n // If it's an option object with name property, extract it\n name = name.name;\n }\n\n return {\n uuid: formData.uuid,\n type: 'set_run_result',\n name: String(name), // Ensure it's always a string\n value: formData.value || '',\n category: formData.category || ''\n };\n }\n};\n"]}
1
+ {"version":3,"file":"set_run_result.js","sourceRoot":"","sources":["../../../../src/flow/actions/set_run_result.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAChC,OAAO,EAAgB,aAAa,EAAY,MAAM,UAAU,CAAC;AAEjE,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,MAAM,CAAC,MAAM,cAAc,GAAiB;IAC1C,IAAI,EAAE,kBAAkB;IACxB,KAAK,EAAE,aAAa,CAAC,IAAI;IACzB,MAAM,EAAE,CAAC,KAAW,EAAE,MAAoB,EAAE,EAAE;QAC5C,OAAO,IAAI,CAAA;qBACM,MAAM,CAAC,KAAK,wBAAwB,MAAM,CAAC,IAAI;WACzD,CAAC;IACV,CAAC;IACD,IAAI,EAAE;QACJ,IAAI,EAAE;YACJ,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,aAAa;YACpB,QAAQ,EAAE,kDAAkD;YAC5D,QAAQ,EAAE,IAAI;YACd,WAAW,EAAE,gCAAgC;YAC7C,qBAAqB,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;gBACxC,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CACzB,CAAC,MAAW,EAAE,EAAE,CACd,MAAM,CAAC,KAAK,CAAC,WAAW,EAAE,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AAC,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI;YACtE,KAAK,EAAE,MAAM,CAAC,KAAK,IAAI,EAAE;YACzB,QAAQ,EAAE,MAAM,CAAC,QAAQ,IAAI,EAAE;SAChC,CAAC;IACJ,CAAC;IACD,YAAY,EAAE,CAAC,QAAkB,EAAgB,EAAE;QACjD,wFAAwF;QACxF,IAAI,IAAI,GAAG,QAAQ,CAAC,IAAI,IAAI,EAAE,CAAC;QAC/B,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC3C,4DAA4D;YAC5D,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QACjB,CAAC;QACD,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YAC3C,8CAA8C;YAC9C,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC;QACpB,CAAC;QACD,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;YAC1C,0DAA0D;YAC1D,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QACnB,CAAC;QAED,OAAO;YACL,IAAI,EAAE,QAAQ,CAAC,IAAI;YACnB,IAAI,EAAE,gBAAgB;YACtB,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE,8BAA8B;YAClD,KAAK,EAAE,QAAQ,CAAC,KAAK,IAAI,EAAE;YAC3B,QAAQ,EAAE,QAAQ,CAAC,QAAQ,IAAI,EAAE;SAClC,CAAC;IACJ,CAAC;CACF,CAAC","sourcesContent":["import { html } from 'lit-html';\nimport { ActionConfig, ACTION_GROUPS, FormData } from '../types';\nimport { Node, SetRunResult } from '../../store/flow-definition';\nimport { getStore } from '../../store/Store';\n\nexport const set_run_result: ActionConfig = {\n name: 'Save Flow Result',\n group: ACTION_GROUPS.save,\n render: (_node: Node, action: SetRunResult) => {\n return html`<div>\n Save <strong>${action.value}</strong> as <strong>${action.name}</strong>\n </div>`;\n },\n form: {\n name: {\n type: 'select',\n label: 'Result Name',\n helpText: 'Select an existing result name or type a new one',\n required: true,\n placeholder: 'Select or enter result name...',\n createArbitraryOption: (input, options) => {\n const exists = options.some(\n (option: any) =>\n option.value.toLowerCase() === input.toLowerCase() ||\n option.name.toLowerCase() === input.toLowerCase()\n );\n return !exists && input.trim().length > 0\n ? { value: input, name: input }\n : null;\n },\n searchable: true,\n clearable: false,\n getDynamicOptions: () => {\n const store = getStore();\n return store\n ? store\n .getState()\n .getFlowResults()\n .map((r) => ({ value: r.name, name: r.name }))\n : [];\n }\n },\n value: {\n type: 'text',\n label: 'Value',\n helpText: 'The value to save for this result (can use expressions)',\n required: false,\n evaluated: true,\n placeholder: 'Enter value...'\n },\n category: {\n type: 'text',\n label: 'Category',\n helpText: 'Optional category for this result',\n required: false,\n placeholder: 'Enter category...'\n }\n },\n layout: ['name', 'value', 'category'],\n toFormData: (action: SetRunResult) => {\n return {\n uuid: action.uuid,\n name: action.name ? [{ name: action.name, value: action.name }] : null,\n value: action.value || '',\n category: action.category || ''\n };\n },\n fromFormData: (formData: FormData): SetRunResult => {\n // Ensure name is a simple string, handling both direct values and select option objects\n let name = formData.name || '';\n if (Array.isArray(name) && name.length > 0) {\n // If it's an array (from multi-select), take the first item\n name = name[0];\n }\n if (typeof name === 'object' && name.value) {\n // If it's an option object, extract the value\n name = name.value;\n }\n if (typeof name === 'object' && name.name) {\n // If it's an option object with name property, extract it\n name = name.name;\n }\n\n return {\n uuid: formData.uuid,\n type: 'set_run_result',\n name: String(name), // Ensure it's always a string\n value: formData.value || '',\n category: formData.category || ''\n };\n }\n};\n"]}
@@ -1,11 +1,185 @@
1
1
  import { html } from 'lit-html';
2
- import { COLORS } from '../types';
2
+ import { ACTION_GROUPS } from '../types';
3
+ import { renderNamedObjects } from '../utils';
3
4
  export const start_session = {
4
- name: 'Start Session',
5
- color: COLORS.execute,
6
- render: (_node, _action) => {
7
- // This will need to be implemented based on the actual render logic
8
- return html `<div>Start Session</div>`;
5
+ name: 'Start Flow',
6
+ group: ACTION_GROUPS.broadcast,
7
+ render: (_node, action) => {
8
+ const hasGroups = action.groups && action.groups.length > 0;
9
+ const hasContacts = action.contacts && action.contacts.length > 0;
10
+ const hasRecipients = hasGroups || hasContacts;
11
+ // Build the recipients display
12
+ let recipientsDisplay = html ``;
13
+ if (action.create_contact) {
14
+ recipientsDisplay = html `Create a new contact`;
15
+ }
16
+ else if (action.contact_query) {
17
+ recipientsDisplay = html `${action.contact_query}`;
18
+ }
19
+ else if (hasRecipients) {
20
+ const allRecipients = [
21
+ ...(action.contacts || []),
22
+ ...(action.groups || [])
23
+ ];
24
+ recipientsDisplay = html `${renderNamedObjects(allRecipients, hasGroups ? 'group' : 'contact')}`;
25
+ }
26
+ return html `
27
+ <div>
28
+ <div
29
+ style="padding: 3px 10px; background: #f5f5f5; padding-bottom: 0px; font-size: 11px; border-radius: var(--curvature); margin-bottom: 10px;"
30
+ >
31
+ ${recipientsDisplay}
32
+ </div>
33
+ <div style="padding: 0px 10px;">
34
+ ${renderNamedObjects([action.flow], 'flow')}
35
+ </div>
36
+ </div>
37
+ `;
38
+ },
39
+ toFormData: (action) => {
40
+ var _a;
41
+ const extendedAction = action;
42
+ // Determine start type based on action properties
43
+ let startTypeValue = 'manual';
44
+ if (action.create_contact) {
45
+ startTypeValue = 'create';
46
+ }
47
+ else if (extendedAction.contact_query) {
48
+ startTypeValue = 'query';
49
+ }
50
+ // Map value to full option object for proper display
51
+ const startTypeOptions = [
52
+ { value: 'manual', name: 'Select recipients manually' },
53
+ { value: 'query', name: 'Select a contact with a query' },
54
+ { value: 'create', name: 'Create a new contact' }
55
+ ];
56
+ const startType = startTypeOptions.find((opt) => opt.value === startTypeValue) ||
57
+ startTypeOptions[0];
58
+ return {
59
+ flow: action.flow ? [action.flow] : null,
60
+ recipients: [...(action.contacts || []), ...(action.groups || [])],
61
+ startType: [startType],
62
+ contactQuery: extendedAction.contact_query || '',
63
+ skipContactsInFlow: ((_a = extendedAction.exclusions) === null || _a === void 0 ? void 0 : _a.in_a_flow) || false,
64
+ uuid: action.uuid
65
+ };
66
+ },
67
+ form: {
68
+ flow: {
69
+ type: 'select',
70
+ label: 'Flow',
71
+ helpText: 'Select the flow to start',
72
+ required: true,
73
+ searchable: true,
74
+ endpoint: '/api/v2/flows.json',
75
+ valueKey: 'uuid',
76
+ nameKey: 'name',
77
+ placeholder: 'Select a flow...'
78
+ },
79
+ startType: {
80
+ type: 'select',
81
+ label: 'Start Type',
82
+ helpText: 'How should contacts be selected?',
83
+ required: true,
84
+ options: [
85
+ { value: 'manual', name: 'Select recipients manually' },
86
+ { value: 'query', name: 'Select a contact with a query' },
87
+ { value: 'create', name: 'Create a new contact' }
88
+ ]
89
+ },
90
+ recipients: {
91
+ type: 'select',
92
+ label: 'Recipients',
93
+ helpText: 'Select who should be started in the flow',
94
+ options: [],
95
+ multi: true,
96
+ searchable: true,
97
+ endpoint: '/api/v2/contacts.json',
98
+ valueKey: 'uuid',
99
+ nameKey: 'name',
100
+ placeholder: 'Search for contacts or groups...',
101
+ conditions: {
102
+ visible: (formData) => {
103
+ var _a, _b;
104
+ const startType = (_b = (_a = formData.startType) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.value;
105
+ return startType === 'manual';
106
+ }
107
+ }
108
+ },
109
+ contactQuery: {
110
+ type: 'text',
111
+ evaluated: true,
112
+ label: 'Contact Query',
113
+ helpText: 'Only one matching contact will be started',
114
+ placeholder: 'household_id = @fields.household_id',
115
+ conditions: {
116
+ visible: (formData) => {
117
+ var _a, _b;
118
+ const startType = (_b = (_a = formData.startType) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.value;
119
+ return startType === 'query';
120
+ }
121
+ }
122
+ },
123
+ skipContactsInFlow: {
124
+ type: 'checkbox',
125
+ label: 'Skip contacts currently in a flow',
126
+ helpText: 'Avoid interrupting a contact who is already in a flow'
127
+ }
128
+ },
129
+ layout: [
130
+ 'flow',
131
+ 'startType',
132
+ 'recipients',
133
+ 'contactQuery',
134
+ 'skipContactsInFlow'
135
+ ],
136
+ validate: (formData) => {
137
+ var _a, _b;
138
+ const errors = {};
139
+ const startType = (_b = (_a = formData.startType) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.value;
140
+ // Check if manual selection has recipients
141
+ if (startType === 'manual' &&
142
+ (!formData.recipients || formData.recipients.length === 0)) {
143
+ errors.recipients = 'At least one contact or group must be selected';
144
+ }
145
+ // Check if query has a query string
146
+ if (startType === 'query' &&
147
+ (!formData.contactQuery || !formData.contactQuery.trim())) {
148
+ errors.contactQuery = 'Contact query is required';
149
+ }
150
+ return {
151
+ valid: Object.keys(errors).length === 0,
152
+ errors
153
+ };
154
+ },
155
+ fromFormData: (formData) => {
156
+ const action = {
157
+ uuid: formData.uuid,
158
+ type: 'start_session',
159
+ flow: formData.flow[0],
160
+ groups: [],
161
+ contacts: []
162
+ };
163
+ // Get the start type value from array
164
+ const startTypeValue = formData.startType[0].value;
165
+ // Handle different start types
166
+ if (startTypeValue === 'create') {
167
+ action.create_contact = true;
168
+ }
169
+ else if (startTypeValue === 'query') {
170
+ action.contact_query = formData.contactQuery || '';
171
+ }
172
+ else {
173
+ // Manual selection - separate contacts and groups
174
+ const recipients = formData.recipients || [];
175
+ action.contacts = recipients.filter((r) => !r.group);
176
+ action.groups = recipients.filter((r) => r.group);
177
+ }
178
+ // Add exclusions if set
179
+ if (formData.skipContactsInFlow) {
180
+ action.exclusions = { in_a_flow: true };
181
+ }
182
+ return action;
9
183
  }
10
184
  };
11
185
  //# sourceMappingURL=start_session.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"start_session.js","sourceRoot":"","sources":["../../../../src/flow/actions/start_session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAChC,OAAO,EAAgB,MAAM,EAAE,MAAM,UAAU,CAAC;AAGhD,MAAM,CAAC,MAAM,aAAa,GAAiB;IACzC,IAAI,EAAE,eAAe;IACrB,KAAK,EAAE,MAAM,CAAC,OAAO;IACrB,MAAM,EAAE,CAAC,KAAW,EAAE,OAAqB,EAAE,EAAE;QAC7C,oEAAoE;QACpE,OAAO,IAAI,CAAA,0BAA0B,CAAC;IACxC,CAAC;CACF,CAAC","sourcesContent":["import { html } from 'lit-html';\nimport { ActionConfig, COLORS } from '../types';\nimport { Node, StartSession } from '../../store/flow-definition';\n\nexport const start_session: ActionConfig = {\n name: 'Start Session',\n color: COLORS.execute,\n render: (_node: Node, _action: StartSession) => {\n // This will need to be implemented based on the actual render logic\n return html`<div>Start Session</div>`;\n }\n};\n"]}
1
+ {"version":3,"file":"start_session.js","sourceRoot":"","sources":["../../../../src/flow/actions/start_session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAChC,OAAO,EAEL,aAAa,EAGd,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAE9C,MAAM,CAAC,MAAM,aAAa,GAAiB;IACzC,IAAI,EAAE,YAAY;IAClB,KAAK,EAAE,aAAa,CAAC,SAAS;IAC9B,MAAM,EAAE,CAAC,KAAW,EAAE,MAAoB,EAAE,EAAE;QAC5C,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;QAC5D,MAAM,WAAW,GAAG,MAAM,CAAC,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC;QAClE,MAAM,aAAa,GAAG,SAAS,IAAI,WAAW,CAAC;QAE/C,+BAA+B;QAC/B,IAAI,iBAAiB,GAAG,IAAI,CAAA,EAAE,CAAC;QAC/B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,CAAC,CAAC,CAAM,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;YAC1D,MAAM,CAAC,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,CAAM,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QACzD,CAAC;QAED,wBAAwB;QACxB,IAAI,QAAQ,CAAC,kBAAkB,EAAE,CAAC;YAChC,MAAM,CAAC,UAAU,GAAG,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;QAC1C,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CACF,CAAC","sourcesContent":["import { html } from 'lit-html';\nimport {\n ActionConfig,\n ACTION_GROUPS,\n FormData,\n ValidationResult\n} from '../types';\nimport { Node, StartSession } from '../../store/flow-definition';\nimport { renderNamedObjects } from '../utils';\n\nexport const start_session: ActionConfig = {\n name: 'Start Flow',\n group: ACTION_GROUPS.broadcast,\n render: (_node: Node, action: StartSession) => {\n const hasGroups = action.groups && action.groups.length > 0;\n const hasContacts = action.contacts && action.contacts.length > 0;\n const hasRecipients = hasGroups || hasContacts;\n\n // Build the recipients display\n let recipientsDisplay = html``;\n if (action.create_contact) {\n recipientsDisplay = html`Create a new contact`;\n } else if ((action as any).contact_query) {\n recipientsDisplay = html`${(action as any).contact_query}`;\n } else if (hasRecipients) {\n const allRecipients = [\n ...(action.contacts || []),\n ...(action.groups || [])\n ];\n recipientsDisplay = html`${renderNamedObjects(\n allRecipients,\n hasGroups ? 'group' : 'contact'\n )}`;\n }\n\n return html`\n <div>\n <div\n style=\"padding: 3px 10px; background: #f5f5f5; padding-bottom: 0px; font-size: 11px; border-radius: var(--curvature); margin-bottom: 10px;\"\n >\n ${recipientsDisplay}\n </div>\n <div style=\"padding: 0px 10px;\">\n ${renderNamedObjects([action.flow], 'flow')}\n </div>\n </div>\n `;\n },\n\n toFormData: (action: StartSession) => {\n const extendedAction = action as StartSession & {\n contact_query?: string;\n exclusions?: { in_a_flow?: boolean };\n };\n\n // Determine start type based on action properties\n let startTypeValue = 'manual';\n if (action.create_contact) {\n startTypeValue = 'create';\n } else if (extendedAction.contact_query) {\n startTypeValue = 'query';\n }\n\n // Map value to full option object for proper display\n const startTypeOptions = [\n { value: 'manual', name: 'Select recipients manually' },\n { value: 'query', name: 'Select a contact with a query' },\n { value: 'create', name: 'Create a new contact' }\n ];\n const startType =\n startTypeOptions.find((opt) => opt.value === startTypeValue) ||\n startTypeOptions[0];\n\n return {\n flow: action.flow ? [action.flow] : null,\n recipients: [...(action.contacts || []), ...(action.groups || [])],\n startType: [startType],\n contactQuery: extendedAction.contact_query || '',\n skipContactsInFlow: extendedAction.exclusions?.in_a_flow || false,\n uuid: action.uuid\n };\n },\n\n form: {\n flow: {\n type: 'select',\n label: 'Flow',\n helpText: 'Select the flow to start',\n required: true,\n searchable: true,\n endpoint: '/api/v2/flows.json',\n valueKey: 'uuid',\n nameKey: 'name',\n placeholder: 'Select a flow...'\n },\n startType: {\n type: 'select',\n label: 'Start Type',\n helpText: 'How should contacts be selected?',\n required: true,\n options: [\n { value: 'manual', name: 'Select recipients manually' },\n { value: 'query', name: 'Select a contact with a query' },\n { value: 'create', name: 'Create a new contact' }\n ]\n },\n recipients: {\n type: 'select',\n label: 'Recipients',\n helpText: 'Select who should be started in the flow',\n options: [],\n multi: true,\n searchable: true,\n endpoint: '/api/v2/contacts.json',\n valueKey: 'uuid',\n nameKey: 'name',\n placeholder: 'Search for contacts or groups...',\n conditions: {\n visible: (formData: FormData) => {\n const startType = formData.startType?.[0]?.value;\n return startType === 'manual';\n }\n }\n },\n contactQuery: {\n type: 'text',\n evaluated: true,\n label: 'Contact Query',\n helpText: 'Only one matching contact will be started',\n placeholder: 'household_id = @fields.household_id',\n conditions: {\n visible: (formData: FormData) => {\n const startType = formData.startType?.[0]?.value;\n return startType === 'query';\n }\n }\n },\n skipContactsInFlow: {\n type: 'checkbox',\n label: 'Skip contacts currently in a flow',\n helpText: 'Avoid interrupting a contact who is already in a flow'\n }\n },\n\n layout: [\n 'flow',\n 'startType',\n 'recipients',\n 'contactQuery',\n 'skipContactsInFlow'\n ],\n\n validate: (formData: FormData): ValidationResult => {\n const errors: { [key: string]: string } = {};\n\n const startType = formData.startType?.[0]?.value;\n\n // Check if manual selection has recipients\n if (\n startType === 'manual' &&\n (!formData.recipients || formData.recipients.length === 0)\n ) {\n errors.recipients = 'At least one contact or group must be selected';\n }\n\n // Check if query has a query string\n if (\n startType === 'query' &&\n (!formData.contactQuery || !formData.contactQuery.trim())\n ) {\n errors.contactQuery = 'Contact query is required';\n }\n\n return {\n valid: Object.keys(errors).length === 0,\n errors\n };\n },\n\n fromFormData: (formData: FormData): StartSession => {\n const action: StartSession & {\n contact_query?: string;\n exclusions?: { in_a_flow: boolean };\n } = {\n uuid: formData.uuid,\n type: 'start_session',\n flow: formData.flow[0],\n groups: [],\n contacts: []\n };\n\n // Get the start type value from array\n const startTypeValue = formData.startType[0].value;\n\n // Handle different start types\n if (startTypeValue === 'create') {\n action.create_contact = true;\n } else if (startTypeValue === 'query') {\n action.contact_query = formData.contactQuery || '';\n } else {\n // Manual selection - separate contacts and groups\n const recipients = formData.recipients || [];\n action.contacts = recipients.filter((r: any) => !r.group);\n action.groups = recipients.filter((r: any) => r.group);\n }\n\n // Add exclusions if set\n if (formData.skipContactsInFlow) {\n action.exclusions = { in_a_flow: true };\n }\n\n return action;\n }\n};\n"]}
@@ -12,9 +12,6 @@ import { set_run_result } from './actions/set_run_result';
12
12
  import { send_msg } from './actions/send_msg';
13
13
  import { send_email } from './actions/send_email';
14
14
  import { start_session } from './actions/start_session';
15
- import { call_classifier } from './actions/call_classifier';
16
- import { call_resthook } from './actions/call_resthook';
17
- import { transfer_airtime } from './actions/transfer_airtime';
18
15
  import { set_contact_name } from './actions/set_contact_name';
19
16
  import { add_contact_groups } from './actions/add_contact_groups';
20
17
  import { remove_contact_groups } from './actions/remove_contact_groups';
@@ -33,6 +30,7 @@ import { split_by_scheme } from './nodes/split_by_scheme';
33
30
  import { split_by_subflow } from './nodes/split_by_subflow';
34
31
  import { split_by_ticket } from './nodes/split_by_ticket';
35
32
  import { split_by_webhook } from './nodes/split_by_webhook';
33
+ import { split_by_resthook } from './nodes/split_by_resthook';
36
34
  import { split_by_llm } from './nodes/split_by_llm';
37
35
  import { split_by_llm_categorize } from './nodes/split_by_llm_categorize';
38
36
  import { wait_for_audio } from './nodes/wait_for_audio';
@@ -43,30 +41,26 @@ import { wait_for_menu } from './nodes/wait_for_menu';
43
41
  import { wait_for_response } from './nodes/wait_for_response';
44
42
  import { wait_for_video } from './nodes/wait_for_video';
45
43
  export const ACTION_CONFIG = {
46
- add_input_labels,
47
- add_contact_urn,
48
44
  set_contact_field,
49
- set_contact_channel,
50
- set_contact_language,
51
- set_contact_status,
52
45
  send_broadcast,
53
46
  set_run_result,
54
47
  send_msg,
55
48
  send_email,
56
49
  start_session,
57
- call_classifier,
58
- call_resthook,
59
- transfer_airtime,
60
50
  set_contact_name,
61
51
  add_contact_groups,
62
52
  remove_contact_groups,
63
- request_optin,
53
+ set_contact_channel,
54
+ set_contact_language,
55
+ set_contact_status,
64
56
  say_msg,
65
- play_audio
57
+ play_audio,
58
+ add_contact_urn,
59
+ add_input_labels,
60
+ request_optin
66
61
  };
67
62
  export const NODE_CONFIG = {
68
63
  execute_actions,
69
- split_by_airtime,
70
64
  split_by_contact_field,
71
65
  split_by_expression,
72
66
  split_by_groups,
@@ -78,12 +72,14 @@ export const NODE_CONFIG = {
78
72
  split_by_subflow,
79
73
  split_by_ticket,
80
74
  split_by_webhook,
75
+ split_by_resthook,
81
76
  wait_for_audio,
82
77
  wait_for_digits,
83
78
  wait_for_image,
84
79
  wait_for_location,
85
80
  wait_for_menu,
86
81
  wait_for_response,
87
- wait_for_video
82
+ wait_for_video,
83
+ split_by_airtime
88
84
  };
89
85
  //# sourceMappingURL=config.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/flow/config.ts"],"names":[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C;AAEF,MAAM,CAAC,MAAM,WAAW,GAEpB;IACF,eAAe;IACf,gBAAgB;IAChB,sBAAsB;IACtB,mBAAmB;IACnB,eAAe;IACf,YAAY;IACZ,uBAAuB;IACvB,eAAe;IACf,mBAAmB;IACnB,eAAe;IACf,gBAAgB;IAChB,eAAe;IACf,gBAAgB;IAChB,cAAc;IACd,eAAe;IACf,cAAc;IACd,iBAAiB;IACjB,aAAa;IACb,iBAAiB;IACjB,cAAc;CACf,CAAC","sourcesContent":["// Re-export all types and utilities\nexport * from './types';\nimport type { ActionConfig, NodeConfig } from './types';\n\n// Import all action configurations\nimport { add_input_labels } from './actions/add_input_labels';\nimport { add_contact_urn } from './actions/add_contact_urn';\nimport { set_contact_field } from './actions/set_contact_field';\nimport { set_contact_channel } from './actions/set_contact_channel';\nimport { set_contact_language } from './actions/set_contact_language';\nimport { set_contact_status } from './actions/set_contact_status';\nimport { send_broadcast } from './actions/send_broadcast';\nimport { set_run_result } from './actions/set_run_result';\nimport { send_msg } from './actions/send_msg';\nimport { send_email } from './actions/send_email';\nimport { start_session } from './actions/start_session';\nimport { call_classifier } from './actions/call_classifier';\nimport { call_resthook } from './actions/call_resthook';\nimport { transfer_airtime } from './actions/transfer_airtime';\nimport { set_contact_name } from './actions/set_contact_name';\nimport { add_contact_groups } from './actions/add_contact_groups';\nimport { remove_contact_groups } from './actions/remove_contact_groups';\nimport { request_optin } from './actions/request_optin';\nimport { say_msg } from './actions/say_msg';\nimport { play_audio } from './actions/play_audio';\n\n// Import all node configurations\nimport { execute_actions } from './nodes/execute_actions';\nimport { split_by_airtime } from './nodes/split_by_airtime';\nimport { split_by_contact_field } from './nodes/split_by_contact_field';\nimport { split_by_expression } from './nodes/split_by_expression';\nimport { split_by_groups } from './nodes/split_by_groups';\nimport { split_by_random } from './nodes/split_by_random';\nimport { split_by_run_result } from './nodes/split_by_run_result';\nimport { split_by_scheme } from './nodes/split_by_scheme';\nimport { split_by_subflow } from './nodes/split_by_subflow';\nimport { split_by_ticket } from './nodes/split_by_ticket';\nimport { split_by_webhook } from './nodes/split_by_webhook';\nimport { split_by_llm } from './nodes/split_by_llm';\nimport { split_by_llm_categorize } from './nodes/split_by_llm_categorize';\nimport { wait_for_audio } from './nodes/wait_for_audio';\nimport { wait_for_digits } from './nodes/wait_for_digits';\nimport { wait_for_image } from './nodes/wait_for_image';\nimport { wait_for_location } from './nodes/wait_for_location';\nimport { wait_for_menu } from './nodes/wait_for_menu';\nimport { wait_for_response } from './nodes/wait_for_response';\nimport { wait_for_video } from './nodes/wait_for_video';\n\nexport const ACTION_CONFIG: {\n [key: string]: ActionConfig;\n} = {\n add_input_labels,\n add_contact_urn,\n set_contact_field,\n set_contact_channel,\n set_contact_language,\n set_contact_status,\n send_broadcast,\n set_run_result,\n send_msg,\n send_email,\n start_session,\n call_classifier,\n call_resthook,\n transfer_airtime,\n set_contact_name,\n add_contact_groups,\n remove_contact_groups,\n request_optin,\n say_msg,\n play_audio\n};\n\nexport const NODE_CONFIG: {\n [key: string]: NodeConfig;\n} = {\n execute_actions,\n split_by_airtime,\n split_by_contact_field,\n split_by_expression,\n split_by_groups,\n split_by_llm,\n split_by_llm_categorize,\n split_by_random,\n split_by_run_result,\n split_by_scheme,\n split_by_subflow,\n split_by_ticket,\n split_by_webhook,\n wait_for_audio,\n wait_for_digits,\n wait_for_image,\n wait_for_location,\n wait_for_menu,\n wait_for_response,\n wait_for_video\n};\n"]}
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/flow/config.ts"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,cAAc,SAAS,CAAC;AAGxB,mCAAmC;AACnC,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EA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E,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAExD,MAAM,CAAC,MAAM,aAAa,GAEtB;IACF,iBAAiB;IAEjB,cAAc;IACd,cAAc;IACd,QAAQ;IACR,UAAU;IACV,aAAa;IACb,gBAAgB;IAChB,kBAAkB;IAClB,qBAAqB;IACrB,mBAAmB;IACnB,oBAAoB;IACpB,kBAAkB;IAClB,OAAO;IACP,UAAU;IACV,eAAe;IACf,gBAAgB;IAChB,aAAa;CACd,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAEpB;IACF,eAAe;IAEf,sBAAsB;IACtB,mBAAmB;IACnB,eAAe;IACf,YAAY;IACZ,uBAAuB;IACvB,eAAe;IACf,mBAAmB;IACnB,eAAe;IACf,gBAAgB;IAChB,eAAe;IACf,gBAAgB;IAChB,iBAAiB;IACjB,cAAc;IACd,eAAe;IACf,cAAc;IACd,iBAAiB;IACjB,aAAa;IACb,iBAAiB;IACjB,cAAc;IACd,gBAAgB;CACjB,CAAC","sourcesContent":["// Re-export all types and utilities\nexport * from './types';\nimport type { ActionConfig, NodeConfig } from './types';\n\n// Import all action configurations\nimport { add_input_labels } from './actions/add_input_labels';\nimport { add_contact_urn } from './actions/add_contact_urn';\nimport { set_contact_field } from './actions/set_contact_field';\nimport { set_contact_channel } from './actions/set_contact_channel';\nimport { set_contact_language } from './actions/set_contact_language';\nimport { set_contact_status } from './actions/set_contact_status';\nimport { send_broadcast } from './actions/send_broadcast';\nimport { set_run_result } from './actions/set_run_result';\nimport { send_msg } from './actions/send_msg';\nimport { send_email } from './actions/send_email';\nimport { start_session } from './actions/start_session';\nimport { set_contact_name } from './actions/set_contact_name';\nimport { add_contact_groups } from './actions/add_contact_groups';\nimport { remove_contact_groups } from './actions/remove_contact_groups';\nimport { request_optin } from './actions/request_optin';\nimport { say_msg } from './actions/say_msg';\nimport { play_audio } from './actions/play_audio';\n\n// Import all node configurations\nimport { execute_actions } from './nodes/execute_actions';\nimport { split_by_airtime } from './nodes/split_by_airtime';\nimport { split_by_contact_field } from './nodes/split_by_contact_field';\nimport { split_by_expression } from './nodes/split_by_expression';\nimport { split_by_groups } from './nodes/split_by_groups';\nimport { split_by_random } from './nodes/split_by_random';\nimport { split_by_run_result } from './nodes/split_by_run_result';\nimport { split_by_scheme } from './nodes/split_by_scheme';\nimport { split_by_subflow } from './nodes/split_by_subflow';\nimport { split_by_ticket } from './nodes/split_by_ticket';\nimport { split_by_webhook } from './nodes/split_by_webhook';\nimport { split_by_resthook } from './nodes/split_by_resthook';\nimport { split_by_llm } from './nodes/split_by_llm';\nimport { split_by_llm_categorize } from './nodes/split_by_llm_categorize';\nimport { wait_for_audio } from './nodes/wait_for_audio';\nimport { wait_for_digits } from './nodes/wait_for_digits';\nimport { wait_for_image } from './nodes/wait_for_image';\nimport { wait_for_location } from './nodes/wait_for_location';\nimport { wait_for_menu } from './nodes/wait_for_menu';\nimport { wait_for_response } from './nodes/wait_for_response';\nimport { wait_for_video } from './nodes/wait_for_video';\n\nexport const ACTION_CONFIG: {\n [key: string]: ActionConfig;\n} = {\n set_contact_field,\n\n send_broadcast,\n set_run_result,\n send_msg,\n send_email,\n start_session,\n set_contact_name,\n add_contact_groups,\n remove_contact_groups,\n set_contact_channel,\n set_contact_language,\n set_contact_status,\n say_msg,\n play_audio,\n add_contact_urn,\n add_input_labels,\n request_optin\n};\n\nexport const NODE_CONFIG: {\n [key: string]: NodeConfig;\n} = {\n execute_actions,\n\n split_by_contact_field,\n split_by_expression,\n split_by_groups,\n split_by_llm,\n split_by_llm_categorize,\n split_by_random,\n split_by_run_result,\n split_by_scheme,\n split_by_subflow,\n split_by_ticket,\n split_by_webhook,\n split_by_resthook,\n wait_for_audio,\n wait_for_digits,\n wait_for_image,\n wait_for_location,\n wait_for_menu,\n wait_for_response,\n wait_for_video,\n split_by_airtime\n};\n"]}