@nyaruka/temba-components 0.129.10 → 0.130.0

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 (316) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/demo/components/flow/example.html +5 -1
  3. package/demo/data/flows/sample-flow.json +217 -113
  4. package/dist/temba-components.js +310 -356
  5. package/dist/temba-components.js.map +1 -1
  6. package/out-tsc/src/events.js.map +1 -1
  7. package/out-tsc/src/flow/CanvasNode.js +3 -35
  8. package/out-tsc/src/flow/CanvasNode.js.map +1 -1
  9. package/out-tsc/src/flow/Editor.js +9 -6
  10. package/out-tsc/src/flow/Editor.js.map +1 -1
  11. package/out-tsc/src/flow/NodeEditor.js +44 -11
  12. package/out-tsc/src/flow/NodeEditor.js.map +1 -1
  13. package/out-tsc/src/flow/actions/add_contact_groups.js +1 -1
  14. package/out-tsc/src/flow/actions/add_contact_groups.js.map +1 -1
  15. package/out-tsc/src/flow/actions/add_contact_urn.js +1 -1
  16. package/out-tsc/src/flow/actions/add_contact_urn.js.map +1 -1
  17. package/out-tsc/src/flow/actions/add_input_labels.js +1 -1
  18. package/out-tsc/src/flow/actions/add_input_labels.js.map +1 -1
  19. package/out-tsc/src/flow/actions/remove_contact_groups.js +1 -1
  20. package/out-tsc/src/flow/actions/remove_contact_groups.js.map +1 -1
  21. package/out-tsc/src/flow/actions/send_email.js +9 -0
  22. package/out-tsc/src/flow/actions/send_email.js.map +1 -1
  23. package/out-tsc/src/flow/actions/send_msg.js +7 -8
  24. package/out-tsc/src/flow/actions/send_msg.js.map +1 -1
  25. package/out-tsc/src/flow/actions/set_contact_channel.js +25 -4
  26. package/out-tsc/src/flow/actions/set_contact_channel.js.map +1 -1
  27. package/out-tsc/src/flow/actions/set_contact_field.js +51 -1
  28. package/out-tsc/src/flow/actions/set_contact_field.js.map +1 -1
  29. package/out-tsc/src/flow/actions/set_contact_language.js +70 -2
  30. package/out-tsc/src/flow/actions/set_contact_language.js.map +1 -1
  31. package/out-tsc/src/flow/actions/set_contact_name.js +27 -2
  32. package/out-tsc/src/flow/actions/set_contact_name.js.map +1 -1
  33. package/out-tsc/src/flow/actions/set_contact_status.js +32 -2
  34. package/out-tsc/src/flow/actions/set_contact_status.js.map +1 -1
  35. package/out-tsc/src/flow/actions/set_run_result.js +13 -11
  36. package/out-tsc/src/flow/actions/set_run_result.js.map +1 -1
  37. package/out-tsc/src/flow/actions/split_by_expression_example.js +4 -4
  38. package/out-tsc/src/flow/actions/split_by_expression_example.js.map +1 -1
  39. package/out-tsc/src/flow/config.js +2 -8
  40. package/out-tsc/src/flow/config.js.map +1 -1
  41. package/out-tsc/src/flow/forms/index.js +2 -0
  42. package/out-tsc/src/flow/forms/index.js.map +1 -0
  43. package/out-tsc/src/flow/nodes/split_by_llm.js +101 -0
  44. package/out-tsc/src/flow/nodes/split_by_llm.js.map +1 -0
  45. package/out-tsc/src/flow/nodes/split_by_llm_categorize.js +4 -89
  46. package/out-tsc/src/flow/nodes/split_by_llm_categorize.js.map +1 -1
  47. package/out-tsc/src/flow/nodes/split_by_random.js +117 -0
  48. package/out-tsc/src/flow/nodes/split_by_random.js.map +1 -1
  49. package/out-tsc/src/flow/nodes/split_by_subflow.js +123 -3
  50. package/out-tsc/src/flow/nodes/split_by_subflow.js.map +1 -1
  51. package/out-tsc/src/flow/nodes/split_by_ticket.js +114 -13
  52. package/out-tsc/src/flow/nodes/split_by_ticket.js.map +1 -1
  53. package/out-tsc/src/flow/nodes/split_by_webhook.js +158 -12
  54. package/out-tsc/src/flow/nodes/split_by_webhook.js.map +1 -1
  55. package/out-tsc/src/flow/types.js.map +1 -1
  56. package/out-tsc/src/form/ArrayEditor.js +9 -25
  57. package/out-tsc/src/form/ArrayEditor.js.map +1 -1
  58. package/out-tsc/src/form/FieldRenderer.js +6 -64
  59. package/out-tsc/src/form/FieldRenderer.js.map +1 -1
  60. package/out-tsc/src/form/select/Select.js +29 -58
  61. package/out-tsc/src/form/select/Select.js.map +1 -1
  62. package/out-tsc/src/live/ContactChat.js +48 -66
  63. package/out-tsc/src/live/ContactChat.js.map +1 -1
  64. package/out-tsc/src/utils.js +118 -0
  65. package/out-tsc/src/utils.js.map +1 -1
  66. package/out-tsc/test/nodes/split_by_llm.test.js +174 -0
  67. package/out-tsc/test/nodes/split_by_llm.test.js.map +1 -0
  68. package/out-tsc/test/nodes/split_by_random.test.js +0 -6
  69. package/out-tsc/test/nodes/split_by_random.test.js.map +1 -1
  70. package/out-tsc/test/temba-field-renderer.test.js +6 -3
  71. package/out-tsc/test/temba-field-renderer.test.js.map +1 -1
  72. package/out-tsc/test/utils.test.js +18 -0
  73. package/out-tsc/test/utils.test.js.map +1 -1
  74. package/package.json +1 -1
  75. package/screenshots/truth/actions/add_contact_groups/editor/descriptive-group-names.png +0 -0
  76. package/screenshots/truth/actions/add_contact_groups/editor/long-group-names.png +0 -0
  77. package/screenshots/truth/actions/add_contact_groups/editor/many-groups.png +0 -0
  78. package/screenshots/truth/actions/add_contact_groups/editor/multiple-groups.png +0 -0
  79. package/screenshots/truth/actions/add_contact_groups/editor/single-group.png +0 -0
  80. package/screenshots/truth/actions/add_contact_groups/render/descriptive-group-names.png +0 -0
  81. package/screenshots/truth/actions/add_contact_groups/render/long-group-names.png +0 -0
  82. package/screenshots/truth/actions/add_contact_groups/render/many-groups.png +0 -0
  83. package/screenshots/truth/actions/add_contact_groups/render/multiple-groups.png +0 -0
  84. package/screenshots/truth/actions/add_contact_groups/render/single-group.png +0 -0
  85. package/screenshots/truth/actions/call_llm/editor/information-extraction.png +0 -0
  86. package/screenshots/truth/actions/call_llm/editor/sentiment-analysis.png +0 -0
  87. package/screenshots/truth/actions/call_llm/editor/summarization.png +0 -0
  88. package/screenshots/truth/actions/call_llm/editor/translation-task.png +0 -0
  89. package/screenshots/truth/actions/remove_contact_groups/editor/cleanup-groups.png +0 -0
  90. package/screenshots/truth/actions/remove_contact_groups/editor/long-descriptive-group-names.png +0 -0
  91. package/screenshots/truth/actions/remove_contact_groups/editor/many-groups.png +0 -0
  92. package/screenshots/truth/actions/remove_contact_groups/editor/multiple-groups.png +0 -0
  93. package/screenshots/truth/actions/remove_contact_groups/editor/remove-from-all-groups.png +0 -0
  94. package/screenshots/truth/actions/remove_contact_groups/editor/single-group.png +0 -0
  95. package/screenshots/truth/actions/remove_contact_groups/render/cleanup-groups.png +0 -0
  96. package/screenshots/truth/actions/remove_contact_groups/render/long-descriptive-group-names.png +0 -0
  97. package/screenshots/truth/actions/remove_contact_groups/render/many-groups.png +0 -0
  98. package/screenshots/truth/actions/remove_contact_groups/render/multiple-groups.png +0 -0
  99. package/screenshots/truth/actions/remove_contact_groups/render/remove-from-all-groups.png +0 -0
  100. package/screenshots/truth/actions/remove_contact_groups/render/single-group.png +0 -0
  101. package/screenshots/truth/actions/send_email/editor/complex-business-email.png +0 -0
  102. package/screenshots/truth/actions/send_email/editor/empty-body.png +0 -0
  103. package/screenshots/truth/actions/send_email/editor/empty-subject.png +0 -0
  104. package/screenshots/truth/actions/send_email/editor/long-subject.png +0 -0
  105. package/screenshots/truth/actions/send_email/editor/multiline-body.png +0 -0
  106. package/screenshots/truth/actions/send_email/editor/multiple-recipients.png +0 -0
  107. package/screenshots/truth/actions/send_email/editor/simple-email.png +0 -0
  108. package/screenshots/truth/actions/send_email/editor/with-expressions.png +0 -0
  109. package/screenshots/truth/actions/send_msg/editor/long-quick-replies.png +0 -0
  110. package/screenshots/truth/actions/send_msg/editor/multiline-text-with-replies.png +0 -0
  111. package/screenshots/truth/actions/send_msg/editor/simple-text.png +0 -0
  112. package/screenshots/truth/actions/send_msg/editor/text-with-linebreaks.png +0 -0
  113. package/screenshots/truth/actions/send_msg/editor/text-with-many-quick-replies.png +0 -0
  114. package/screenshots/truth/actions/send_msg/editor/text-with-quick-replies.png +0 -0
  115. package/screenshots/truth/actions/send_msg/editor/text-without-quick-replies.png +0 -0
  116. package/screenshots/truth/checkbox/checkbox-label-background-hover.png +0 -0
  117. package/screenshots/truth/checkbox/checkbox-no-label-no-background-hover.png +0 -0
  118. package/screenshots/truth/checkbox/checkbox-whitespace-label-no-background-hover.png +0 -0
  119. package/screenshots/truth/checkbox/checkbox-with-help-text.png +0 -0
  120. package/screenshots/truth/checkbox/checked.png +0 -0
  121. package/screenshots/truth/checkbox/default.png +0 -0
  122. package/screenshots/truth/colorpicker/default.png +0 -0
  123. package/screenshots/truth/colorpicker/focused.png +0 -0
  124. package/screenshots/truth/colorpicker/initialized.png +0 -0
  125. package/screenshots/truth/colorpicker/selected.png +0 -0
  126. package/screenshots/truth/compose/attachments-tab.png +0 -0
  127. package/screenshots/truth/compose/attachments-with-files.png +0 -0
  128. package/screenshots/truth/compose/intial-text.png +0 -0
  129. package/screenshots/truth/compose/no-counter.png +0 -0
  130. package/screenshots/truth/compose/wraps-text-and-spaces.png +0 -0
  131. package/screenshots/truth/compose/wraps-text-and-url.png +0 -0
  132. package/screenshots/truth/compose/wraps-text-no-spaces.png +0 -0
  133. package/screenshots/truth/contacts/chat-failure.png +0 -0
  134. package/screenshots/truth/contacts/chat-for-active-contact.png +0 -0
  135. package/screenshots/truth/contacts/chat-sends-attachments-only.png +0 -0
  136. package/screenshots/truth/contacts/chat-sends-text-and-attachments.png +0 -0
  137. package/screenshots/truth/contacts/chat-sends-text-only.png +0 -0
  138. package/screenshots/truth/counter/summary.png +0 -0
  139. package/screenshots/truth/counter/text.png +0 -0
  140. package/screenshots/truth/counter/unicode-variables.png +0 -0
  141. package/screenshots/truth/counter/unicode.png +0 -0
  142. package/screenshots/truth/counter/variable.png +0 -0
  143. package/screenshots/truth/datepicker/date-truncated-time.png +0 -0
  144. package/screenshots/truth/datepicker/date.png +0 -0
  145. package/screenshots/truth/datepicker/initial-timezone.png +0 -0
  146. package/screenshots/truth/datepicker/range-picker-editing-start.png +0 -0
  147. package/screenshots/truth/datepicker/updated-keyboard-date.png +0 -0
  148. package/screenshots/truth/dialog/focused.png +0 -0
  149. package/screenshots/truth/dropdown/right-edge-collision.png +0 -0
  150. package/screenshots/truth/editor/router.png +0 -0
  151. package/screenshots/truth/editor/send_msg.png +0 -0
  152. package/screenshots/truth/editor/set_contact_language.png +0 -0
  153. package/screenshots/truth/editor/set_contact_name.png +0 -0
  154. package/screenshots/truth/editor/set_run_result.png +0 -0
  155. package/screenshots/truth/editor/wait.png +0 -0
  156. package/screenshots/truth/field-renderer/checkbox-checked.png +0 -0
  157. package/screenshots/truth/field-renderer/checkbox-unchecked.png +0 -0
  158. package/screenshots/truth/field-renderer/checkbox-with-errors.png +0 -0
  159. package/screenshots/truth/field-renderer/context-comparison.png +0 -0
  160. package/screenshots/truth/field-renderer/key-value-with-label.png +0 -0
  161. package/screenshots/truth/field-renderer/message-editor-with-label.png +0 -0
  162. package/screenshots/truth/field-renderer/select-multi.png +0 -0
  163. package/screenshots/truth/field-renderer/select-no-label.png +0 -0
  164. package/screenshots/truth/field-renderer/select-with-label.png +0 -0
  165. package/screenshots/truth/field-renderer/text-evaluated.png +0 -0
  166. package/screenshots/truth/field-renderer/text-no-label.png +0 -0
  167. package/screenshots/truth/field-renderer/text-with-errors.png +0 -0
  168. package/screenshots/truth/field-renderer/text-with-label.png +0 -0
  169. package/screenshots/truth/field-renderer/textarea-evaluated.png +0 -0
  170. package/screenshots/truth/field-renderer/textarea-with-label.png +0 -0
  171. package/screenshots/truth/integration/checkbox-markdown-errors.png +0 -0
  172. package/screenshots/truth/list/fields-dragging.png +0 -0
  173. package/screenshots/truth/list/fields-filtered.png +0 -0
  174. package/screenshots/truth/list/fields-hovered.png +0 -0
  175. package/screenshots/truth/list/fields.png +0 -0
  176. package/screenshots/truth/list/items-selected.png +0 -0
  177. package/screenshots/truth/list/items-updated.png +0 -0
  178. package/screenshots/truth/list/items.png +0 -0
  179. package/screenshots/truth/menu/menu-focused-with items.png +0 -0
  180. package/screenshots/truth/menu/menu-refresh-1.png +0 -0
  181. package/screenshots/truth/menu/menu-refresh-2.png +0 -0
  182. package/screenshots/truth/menu/menu-submenu.png +0 -0
  183. package/screenshots/truth/menu/menu-tasks-nextup.png +0 -0
  184. package/screenshots/truth/menu/menu-tasks.png +0 -0
  185. package/screenshots/truth/message-editor/autogrow-initial-content.png +0 -0
  186. package/screenshots/truth/message-editor/default.png +0 -0
  187. package/screenshots/truth/message-editor/drag-highlight.png +0 -0
  188. package/screenshots/truth/message-editor/filtered-attachments.png +0 -0
  189. package/screenshots/truth/message-editor/with-completion.png +0 -0
  190. package/screenshots/truth/message-editor/with-properties.png +0 -0
  191. package/screenshots/truth/modax/form.png +0 -0
  192. package/screenshots/truth/modax/simple.png +0 -0
  193. package/screenshots/truth/nodes/split_by_llm/editor/information-extraction.png +0 -0
  194. package/screenshots/truth/nodes/split_by_llm/editor/sentiment-analysis.png +0 -0
  195. package/screenshots/truth/nodes/split_by_llm/editor/summarization.png +0 -0
  196. package/screenshots/truth/nodes/split_by_llm/editor/translation-task.png +0 -0
  197. package/screenshots/truth/nodes/split_by_llm/render/information-extraction.png +0 -0
  198. package/screenshots/truth/nodes/split_by_llm/render/sentiment-analysis.png +0 -0
  199. package/screenshots/truth/nodes/split_by_llm/render/summarization.png +0 -0
  200. package/screenshots/truth/nodes/split_by_llm/render/translation-task.png +0 -0
  201. package/screenshots/truth/nodes/split_by_llm_categorize/editor/basic-categorization.png +0 -0
  202. package/screenshots/truth/nodes/split_by_llm_categorize/editor/custom-input-and-result-name.png +0 -0
  203. package/screenshots/truth/nodes/split_by_llm_categorize/editor/feedback-categorization.png +0 -0
  204. package/screenshots/truth/nodes/split_by_llm_categorize/editor/many-categories.png +0 -0
  205. package/screenshots/truth/nodes/split_by_llm_categorize/editor/minimal-categories.png +0 -0
  206. package/screenshots/truth/nodes/split_by_random/editor/ab-test-multiple-variants.png +0 -0
  207. package/screenshots/truth/nodes/split_by_random/editor/sampling-split.png +0 -0
  208. package/screenshots/truth/nodes/split_by_random/editor/three-way-split.png +0 -0
  209. package/screenshots/truth/nodes/split_by_random/editor/two-bucket-split.png +0 -0
  210. package/screenshots/truth/nodes/wait_for_digits/editor/basic-digits-wait.png +0 -0
  211. package/screenshots/truth/nodes/wait_for_digits/editor/phone-number-collection.png +0 -0
  212. package/screenshots/truth/nodes/wait_for_digits/editor/single-digit-with-timeout.png +0 -0
  213. package/screenshots/truth/nodes/wait_for_digits/editor/verification-code.png +0 -0
  214. package/screenshots/truth/nodes/wait_for_response/editor/basic-wait.png +0 -0
  215. package/screenshots/truth/nodes/wait_for_response/editor/custom-result-name.png +0 -0
  216. package/screenshots/truth/nodes/wait_for_response/editor/no-timeout.png +0 -0
  217. package/screenshots/truth/nodes/wait_for_response/editor/short-timeout.png +0 -0
  218. package/screenshots/truth/omnibox/selected.png +0 -0
  219. package/screenshots/truth/options/block.png +0 -0
  220. package/screenshots/truth/run-list/basic.png +0 -0
  221. package/screenshots/truth/select/disabled-multi-selection.png +0 -0
  222. package/screenshots/truth/select/disabled-selection.png +0 -0
  223. package/screenshots/truth/select/disabled.png +0 -0
  224. package/screenshots/truth/select/embedded.png +0 -0
  225. package/screenshots/truth/select/empty-options.png +0 -0
  226. package/screenshots/truth/select/expression-selected.png +0 -0
  227. package/screenshots/truth/select/expressions.png +0 -0
  228. package/screenshots/truth/select/functions.png +0 -0
  229. package/screenshots/truth/select/local-options.png +0 -0
  230. package/screenshots/truth/select/multi-with-endpoint.png +0 -0
  231. package/screenshots/truth/select/multiple-initial-values.png +0 -0
  232. package/screenshots/truth/select/remote-options.png +0 -0
  233. package/screenshots/truth/select/search-enabled.png +0 -0
  234. package/screenshots/truth/select/search-multi-no-matches.png +0 -0
  235. package/screenshots/truth/select/search-selected-focus.png +0 -0
  236. package/screenshots/truth/select/search-selected.png +0 -0
  237. package/screenshots/truth/select/search-with-selected.png +0 -0
  238. package/screenshots/truth/select/searching.png +0 -0
  239. package/screenshots/truth/select/selected-multi-maxitems-reached.png +0 -0
  240. package/screenshots/truth/select/selected-multi.png +0 -0
  241. package/screenshots/truth/select/selected-single.png +0 -0
  242. package/screenshots/truth/select/selection-clearable.png +0 -0
  243. package/screenshots/truth/select/static-initial-value.png +0 -0
  244. package/screenshots/truth/select/static-initial-via-selected.png +0 -0
  245. package/screenshots/truth/select/truncated-selection.png +0 -0
  246. package/screenshots/truth/select/with-placeholder.png +0 -0
  247. package/screenshots/truth/select/without-placeholder.png +0 -0
  248. package/screenshots/truth/slider/update-slider-on-circle-dragged.png +0 -0
  249. package/screenshots/truth/templates/default.png +0 -0
  250. package/screenshots/truth/templates/unapproved.png +0 -0
  251. package/screenshots/truth/textinput/autogrow-initial.png +0 -0
  252. package/screenshots/truth/textinput/input-disabled.png +0 -0
  253. package/screenshots/truth/textinput/input-focused.png +0 -0
  254. package/screenshots/truth/textinput/input-form.png +0 -0
  255. package/screenshots/truth/textinput/input-inserted.png +0 -0
  256. package/screenshots/truth/textinput/input-placeholder.png +0 -0
  257. package/screenshots/truth/textinput/input-updated.png +0 -0
  258. package/screenshots/truth/textinput/input.png +0 -0
  259. package/screenshots/truth/textinput/textarea-focused.png +0 -0
  260. package/screenshots/truth/textinput/textarea.png +0 -0
  261. package/src/events.ts +4 -2
  262. package/src/flow/CanvasNode.ts +2 -39
  263. package/src/flow/Editor.ts +6 -3
  264. package/src/flow/NodeEditor.ts +54 -13
  265. package/src/flow/actions/add_contact_groups.ts +1 -1
  266. package/src/flow/actions/add_contact_urn.ts +1 -1
  267. package/src/flow/actions/add_input_labels.ts +1 -1
  268. package/src/flow/actions/remove_contact_groups.ts +1 -1
  269. package/src/flow/actions/send_email.ts +11 -1
  270. package/src/flow/actions/send_msg.ts +20 -11
  271. package/src/flow/actions/set_contact_channel.ts +28 -5
  272. package/src/flow/actions/set_contact_field.ts +56 -2
  273. package/src/flow/actions/set_contact_language.ts +74 -3
  274. package/src/flow/actions/set_contact_name.ts +31 -3
  275. package/src/flow/actions/set_contact_status.ts +36 -3
  276. package/src/flow/actions/set_run_result.ts +13 -15
  277. package/src/flow/actions/split_by_expression_example.ts +4 -4
  278. package/src/flow/config.ts +2 -8
  279. package/src/flow/forms/index.ts +1 -0
  280. package/src/flow/nodes/split_by_llm.ts +119 -0
  281. package/src/flow/nodes/split_by_llm_categorize.ts +13 -116
  282. package/src/flow/nodes/split_by_random.ts +148 -0
  283. package/src/flow/nodes/split_by_subflow.ts +153 -3
  284. package/src/flow/nodes/split_by_ticket.ts +134 -12
  285. package/src/flow/nodes/split_by_webhook.ts +185 -12
  286. package/src/flow/types.ts +2 -1
  287. package/src/form/ArrayEditor.ts +6 -20
  288. package/src/form/FieldRenderer.ts +6 -65
  289. package/src/form/select/Select.ts +34 -66
  290. package/src/live/ContactChat.ts +56 -58
  291. package/src/store/flow-definition.d.ts +8 -2
  292. package/src/utils.ts +196 -0
  293. package/static/api/fields.json +93 -1208
  294. package/static/api/workspace.json +23 -0
  295. package/test/nodes/split_by_llm.test.ts +232 -0
  296. package/test/nodes/split_by_random.test.ts +0 -7
  297. package/test/temba-field-renderer.test.ts +26 -13
  298. package/test/utils.test.ts +20 -0
  299. package/test-assets/style.css +36 -234
  300. package/web-dev-server.config.mjs +28 -0
  301. package/web-test-runner.config.mjs +38 -1
  302. package/out-tsc/src/flow/actions/call_llm.js +0 -64
  303. package/out-tsc/src/flow/actions/call_llm.js.map +0 -1
  304. package/out-tsc/src/flow/actions/call_webhook.js +0 -131
  305. package/out-tsc/src/flow/actions/call_webhook.js.map +0 -1
  306. package/out-tsc/src/flow/actions/enter_flow.js +0 -14
  307. package/out-tsc/src/flow/actions/enter_flow.js.map +0 -1
  308. package/out-tsc/src/flow/actions/open_ticket.js +0 -73
  309. package/out-tsc/src/flow/actions/open_ticket.js.map +0 -1
  310. package/out-tsc/test/actions/call_llm.test.js +0 -103
  311. package/out-tsc/test/actions/call_llm.test.js.map +0 -1
  312. package/src/flow/actions/call_llm.ts +0 -66
  313. package/src/flow/actions/call_webhook.ts +0 -143
  314. package/src/flow/actions/enter_flow.ts +0 -15
  315. package/src/flow/actions/open_ticket.ts +0 -83
  316. package/test/actions/call_llm.test.ts +0 -137
@@ -1 +1 @@
1
- {"version":3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E,EAAE,CAAC;YAC5B,MAAM,iBAAiB,GAAG,WAAW,CAAC,MAAM,CAC1C,CAAC,UAAU,EAAE,EAAE,CACb,OAAO,UAAU,KAAK,QAAQ;gBAC9B,UAAU,CAAC,SAAS,CAAC,CAAC,EAAE,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CACjE,CAAC;YAEF,MAAM,kBAAkB,GAAG,WAAW,CAAC,MAAM,CAC3C,CAAC,UAAU,EAAE,EAAE,CACb,OAAO,UAAU,KAAK,QAAQ;gBAC9B,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,EAAE,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAClE,CAAC;YAEF,IAAI,kBAAkB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAClC,MAAM,CAAC,mBAAmB;oBACxB,iDAAiD,CAAC;YACtD,CAAC;YAED,IAAI,iBAAiB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACjC,MAAM,OAAO,GAAG,uDAAuD,CAAC;gBACxE,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;oBAChB,MAAM,CAAC,IAAI,IAAI,IAAI,OAAO,EAAE,CAAC;gBAC/B,CAAC;qBAAM,CAAC;oBACN,MAAM,CAAC,IAAI,GAAG,OAAO,CAAC;gBACxB,CAAC;YACH,CAAC;QACH,CAAC;QAED,OAAO;YACL,KAAK,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 { unsafeHTML } from 'lit-html/directives/unsafe-html.js';\nimport { ActionConfig, COLORS, ValidationResult } from '../types';\nimport { Node, SendMsg } from '../../store/flow-definition';\n\nexport const send_msg: ActionConfig = {\n name: 'Send Message',\n color: COLORS.send,\n render: (_node: Node, action: SendMsg) => {\n const text = action.text.replace(/\\n/g, '<br>');\n return html`\n ${unsafeHTML(text)}\n ${action.quick_replies?.length > 0\n ? html`<div class=\"quick-replies\">\n ${action.quick_replies.map((reply) => {\n return html`<div class=\"quick-reply\">${reply}</div>`;\n })}\n ${action.template\n ? html`<div\n style=\"border: 1px solid var(--color-widget-border);padding: 0.5em;margin-top: 1em;border-radius: var(--curvature); display:flex;background: rgba(0,0,0,.03);\"\n >\n <temba-icon name=\"channel_wac\"></temba-icon>\n <div style=\"margin-left:0.5em\">${action.template.name}</div>\n </div>`\n : null}\n </div>`\n : null}\n `;\n },\n form: {\n text: {\n type: 'message-editor',\n label: 'Message',\n helpText:\n 'Enter the message to send with optional attachments. You can use expressions like @contact.name',\n required: true,\n evaluated: true,\n placeholder: 'Type your message here...',\n maxAttachments: 10,\n accept: '',\n endpoint: '/api/v2/media.json',\n counter: 'temba-charcount',\n gsm: true,\n autogrow: true\n },\n quick_replies: {\n type: 'select',\n options: [],\n multi: true,\n tags: true,\n searchable: true,\n placeholder: 'Add quick replies...',\n maxItems: 10,\n evaluated: true\n },\n runtime_attachments: {\n type: 'array',\n helpText: 'Add dynamic attachments using expressions',\n itemLabel: 'Attachment',\n maxItems: 10,\n isEmptyItem: (item: any) => {\n return !item.expression || item.expression.trim() === '';\n },\n itemConfig: {\n type: {\n type: 'select',\n options: [\n { value: 'image', label: 'Image' },\n { value: 'audio', label: 'Audio' },\n { value: 'video', label: 'Video' },\n { value: 'document', label: 'Document' }\n ],\n required: true,\n searchable: false\n },\n expression: {\n type: 'text',\n placeholder: 'Expression (e.g. @contact.photo)',\n required: true,\n evaluated: true\n }\n }\n }\n },\n layout: [\n 'text',\n {\n type: 'group',\n label: 'Quick Replies',\n items: ['quick_replies'],\n collapsible: true,\n collapsed: (formData: any) => {\n // Collapse only if there are no quick replies\n return !formData.quick_replies || formData.quick_replies.length === 0;\n },\n getGroupValueCount: (formData: any) => {\n return formData.quick_replies?.length || 0;\n }\n },\n {\n type: 'group',\n label: 'Runtime Attachments',\n items: ['runtime_attachments'],\n collapsible: true,\n collapsed: true,\n helpText: 'Add dynamic attachments that are evaluated at runtime',\n getGroupValueCount: (formData: any) => {\n return (\n formData.runtime_attachments?.filter(\n (item: any) =>\n item && item.expression && item.expression.trim() !== ''\n ).length || 0\n );\n }\n }\n ],\n toFormData: (action: SendMsg) => {\n // Extract runtime attachments from the text field attachments\n const runtimeAttachments: { type: string; expression: string }[] = [];\n const staticAttachments: string[] = [];\n\n if (action.attachments && Array.isArray(action.attachments)) {\n action.attachments.forEach((attachment) => {\n if (typeof attachment === 'string' && attachment.includes(':')) {\n const colonIndex = attachment.indexOf(':');\n const contentType = attachment.substring(0, colonIndex);\n const value = attachment.substring(colonIndex + 1);\n\n if (!contentType.includes('/')) {\n // This is a runtime attachment\n runtimeAttachments.push({\n type: contentType,\n expression: value\n });\n } else {\n // This is a static attachment\n staticAttachments.push(attachment);\n }\n }\n });\n }\n\n return {\n uuid: action.uuid,\n text: action.text || '',\n attachments: staticAttachments,\n runtime_attachments: runtimeAttachments,\n quick_replies: (action.quick_replies || []).map((reply) => ({\n name: reply,\n value: reply\n }))\n };\n },\n fromFormData: (data: Record<string, any>) => {\n const result = {\n uuid: data.uuid,\n type: 'send_msg',\n text: data.text || '',\n attachments: [],\n quick_replies: (data.quick_replies || []).map((reply: any) =>\n typeof reply === 'string' ? reply : reply.value || reply.name || reply\n )\n };\n\n // Combine static attachments from text field with runtime attachments\n const staticAttachments = data.attachments || [];\n const runtimeAttachments = (data.runtime_attachments || [])\n .filter((item: any) => item && item.type && item.expression) // Filter out invalid items\n .map(\n (item: { type: string; expression: string }) =>\n `${item.type}:${item.expression}`\n );\n\n result.attachments = [...staticAttachments, ...runtimeAttachments];\n\n // Remove quick_replies if empty to match original format\n if (result.quick_replies.length === 0) {\n delete (result as any).quick_replies;\n }\n\n return result as SendMsg;\n },\n sanitize: (formData: any): void => {\n if (formData.text && typeof formData.text === 'string') {\n formData.text = formData.text.trim();\n }\n },\n validate: (action: SendMsg): ValidationResult => {\n const errors: { [key: string]: string } = {};\n\n if (!action.text || action.text.trim() === '') {\n errors.text = 'Message text is required';\n }\n\n const attachments = action.attachments || [];\n if (attachments.length > 10) {\n const staticAttachments = attachments.filter(\n (attachment) =>\n typeof attachment === 'string' &&\n attachment.substring(0, attachment.indexOf(':')).includes('/')\n );\n\n const runtimeAttachments = attachments.filter(\n (attachment) =>\n typeof attachment === 'string' &&\n !attachment.substring(0, attachment.indexOf(':')).includes('/')\n );\n\n if (runtimeAttachments.length > 0) {\n errors.runtime_attachments =\n 'Each message can only have up to 10 attachments';\n }\n\n if (staticAttachments.length > 0) {\n const message = 'Each message can only have up to 10 total attachments';\n if (errors.text) {\n errors.text += ` ${message}`;\n } else {\n errors.text = message;\n }\n }\n }\n\n return {\n valid: Object.keys(errors).length === 0,\n errors\n };\n }\n};\n"]}
1
+ {"version":3,"file":"send_msg.js","sourceRoot":"","sources":["../../../../src/flow/actions/send_msg.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAChE,OAAO,EAAgB,MAAM,EAAoB,MAAM,UAAU,CAAC;AAElE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,MAAM,CAAC,MAAM,QAAQ,GAAiB;IACpC,IAAI,EAAE,cAAc;IACpB,KAAK,EAAE,MAAM,CAAC,IAAI;IAClB,MAAM,EAAE,CAAC,KAAW,EAAE,MAAe,EAAE,EAAE;;QACvC,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QAChD,OAAO,IAAI,CAAA;QACP,UAAU,CAAC,IAAI,CAAC;QAChB,CAAA,MAAA,MAAM,CAAC,aAAa,0CAAE,MAAM,IAAG,CAAC;YAChC,CAAC,CAAC,IAAI,CAAA;cACA,MAAM,CAA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M,CAAC,mBAAmB;oBACxB,iDAAiD,CAAC;YACtD,CAAC;YAED,IAAI,iBAAiB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACjC,MAAM,OAAO,GAAG,uDAAuD,CAAC;gBACxE,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;oBAChB,MAAM,CAAC,IAAI,IAAI,IAAI,OAAO,EAAE,CAAC;gBAC/B,CAAC;qBAAM,CAAC;oBACN,MAAM,CAAC,IAAI,GAAG,OAAO,CAAC;gBACxB,CAAC;YACH,CAAC;QACH,CAAC;QAED,OAAO;YACL,KAAK,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 { unsafeHTML } from 'lit-html/directives/unsafe-html.js';\nimport { ActionConfig, COLORS, ValidationResult } from '../types';\nimport { Node, SendMsg } from '../../store/flow-definition';\nimport { titleCase } from '../../utils';\n\nexport const send_msg: ActionConfig = {\n name: 'Send Message',\n color: COLORS.send,\n render: (_node: Node, action: SendMsg) => {\n const text = action.text.replace(/\\n/g, '<br>');\n return html`\n ${unsafeHTML(text)}\n ${action.quick_replies?.length > 0\n ? html`<div class=\"quick-replies\">\n ${action.quick_replies.map((reply) => {\n return html`<div class=\"quick-reply\">${reply}</div>`;\n })}\n ${action.template\n ? html`<div\n style=\"border: 1px solid var(--color-widget-border);padding: 0.5em;margin-top: 1em;border-radius: var(--curvature); display:flex;background: rgba(0,0,0,.03);\"\n >\n <temba-icon name=\"channel_wac\"></temba-icon>\n <div style=\"margin-left:0.5em\">${action.template.name}</div>\n </div>`\n : null}\n </div>`\n : null}\n `;\n },\n form: {\n text: {\n type: 'message-editor',\n label: 'Message',\n helpText:\n 'Enter the message to send with optional attachments. You can use expressions like @contact.name',\n required: true,\n evaluated: true,\n placeholder: 'Type your message here...',\n maxAttachments: 10,\n accept: '',\n endpoint: '/api/v2/media.json',\n counter: 'temba-charcount',\n gsm: true,\n autogrow: true\n },\n quick_replies: {\n type: 'select',\n options: [],\n multi: true,\n tags: true,\n searchable: true,\n placeholder: 'Add quick replies...',\n maxItems: 10,\n evaluated: true\n },\n runtime_attachments: {\n type: 'array',\n helpText: 'Add dynamic attachments using expressions',\n itemLabel: 'Attachment',\n maxItems: 10,\n isEmptyItem: (item: any) => {\n return !item.expression || item.expression.trim() === '';\n },\n itemConfig: {\n type: {\n type: 'select',\n options: [\n { value: 'image', name: 'Image' },\n { value: 'audio', name: 'Audio' },\n { value: 'video', name: 'Video' },\n { value: 'document', name: 'Document' }\n ],\n required: true,\n searchable: false\n },\n expression: {\n type: 'text',\n placeholder: 'Expression (e.g. @contact.photo)',\n required: true,\n evaluated: true\n }\n }\n }\n },\n layout: [\n 'text',\n {\n type: 'group',\n label: 'Quick Replies',\n items: ['quick_replies'],\n collapsible: true,\n collapsed: (formData: any) => {\n // Collapse only if there are no quick replies\n return !formData.quick_replies || formData.quick_replies.length === 0;\n },\n getGroupValueCount: (formData: any) => {\n return formData.quick_replies?.length || 0;\n }\n },\n {\n type: 'group',\n label: 'Runtime Attachments',\n items: ['runtime_attachments'],\n collapsible: true,\n collapsed: true,\n helpText: 'Add dynamic attachments that are evaluated at runtime',\n getGroupValueCount: (formData: any) => {\n return (\n formData.runtime_attachments?.filter(\n (item: any) =>\n item && item.expression && item.expression.trim() !== ''\n ).length || 0\n );\n }\n }\n ],\n toFormData: (action: SendMsg) => {\n // Extract runtime attachments from the text field attachments\n const runtimeAttachments: {\n type: { name: string; value: string };\n expression: string;\n }[] = [];\n const staticAttachments: string[] = [];\n\n if (action.attachments && Array.isArray(action.attachments)) {\n action.attachments.forEach((attachment) => {\n if (typeof attachment === 'string' && attachment.includes(':')) {\n const colonIndex = attachment.indexOf(':');\n const contentType = attachment.substring(0, colonIndex);\n const value = attachment.substring(colonIndex + 1);\n\n if (!contentType.includes('/')) {\n runtimeAttachments.push({\n type: { name: titleCase(contentType), value: contentType },\n expression: value\n });\n } else {\n staticAttachments.push(attachment);\n }\n }\n });\n }\n\n return {\n uuid: action.uuid,\n text: action.text || '',\n attachments: staticAttachments,\n runtime_attachments: runtimeAttachments,\n quick_replies: (action.quick_replies || []).map((reply) => ({\n name: reply,\n value: reply\n }))\n };\n },\n fromFormData: (data: Record<string, any>) => {\n const result = {\n uuid: data.uuid,\n type: 'send_msg',\n text: data.text || '',\n attachments: [],\n quick_replies: (data.quick_replies || []).map((reply: any) =>\n typeof reply === 'string' ? reply : reply.value || reply.name || reply\n )\n };\n\n // Combine static attachments from text field with runtime attachments\n const staticAttachments = data.attachments || [];\n const runtimeAttachments = (data.runtime_attachments || [])\n .filter(\n (item: {\n type: [{ name: string; value: string }];\n expression: string;\n }) => item && item.type && item.expression\n ) // Filter out invalid items\n .map(\n (item: {\n type: [{ name: string; value: string }];\n expression: string;\n }) => `${item.type[0].value}:${item.expression}`\n );\n\n result.attachments = [...staticAttachments, ...runtimeAttachments];\n\n // Remove quick_replies if empty to match original format\n if (result.quick_replies.length === 0) {\n delete (result as any).quick_replies;\n }\n\n return result as SendMsg;\n },\n sanitize: (formData: any): void => {\n if (formData.text && typeof formData.text === 'string') {\n formData.text = formData.text.trim();\n }\n },\n validate: (action: SendMsg): ValidationResult => {\n const errors: { [key: string]: string } = {};\n\n if (!action.text || action.text.trim() === '') {\n errors.text = 'Message text is required';\n }\n\n const attachments = action.attachments || [];\n if (attachments.length > 10) {\n const staticAttachments = attachments.filter(\n (attachment) =>\n typeof attachment === 'string' &&\n attachment.substring(0, attachment.indexOf(':')).includes('/')\n );\n\n const runtimeAttachments = attachments.filter(\n (attachment) =>\n typeof attachment === 'string' &&\n !attachment.substring(0, attachment.indexOf(':')).includes('/')\n );\n\n if (runtimeAttachments.length > 0) {\n errors.runtime_attachments =\n 'Each message can only have up to 10 attachments';\n }\n\n if (staticAttachments.length > 0) {\n const message = 'Each message can only have up to 10 total attachments';\n if (errors.text) {\n errors.text += ` ${message}`;\n } else {\n errors.text = message;\n }\n }\n }\n\n return {\n valid: Object.keys(errors).length === 0,\n errors\n };\n }\n};\n"]}
@@ -1,12 +1,33 @@
1
1
  import { html } from 'lit-html';
2
2
  import { COLORS } from '../types';
3
3
  export const set_contact_channel = {
4
- name: 'Update Contact Channel',
4
+ name: 'Update Channel',
5
5
  color: COLORS.update,
6
6
  render: (_node, action) => {
7
- return html `<div>
8
- Set contact channel to <b>${action.channel.name}</b>
9
- </div>`;
7
+ return html `<div>Set to <b>${action.channel.name}</b></div>`;
8
+ },
9
+ form: {
10
+ channel: {
11
+ type: 'select',
12
+ label: 'Channel',
13
+ required: true,
14
+ searchable: true,
15
+ clearable: false,
16
+ endpoint: '/api/v2/channels.json',
17
+ valueKey: 'uuid',
18
+ nameKey: 'name',
19
+ helpText: 'Select the channel to set for the contact'
20
+ }
21
+ },
22
+ validate: (formData) => {
23
+ const errors = {};
24
+ if (!formData.channel) {
25
+ errors.channel = 'Channel is required';
26
+ }
27
+ return {
28
+ valid: Object.keys(errors).length === 0,
29
+ errors
30
+ };
10
31
  }
11
32
  };
12
33
  //# sourceMappingURL=set_contact_channel.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"set_contact_channel.js","sourceRoot":"","sources":["../../../../src/flow/actions/set_contact_channel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAChC,OAAO,EAAgB,MAAM,EAAE,MAAM,UAAU,CAAC;AAGhD,MAAM,CAAC,MAAM,mBAAmB,GAAiB;IAC/C,IAAI,EAAE,wBAAwB;IAC9B,KAAK,EAAE,MAAM,CAAC,MAAM;IACpB,MAAM,EAAE,CAAC,KAAW,EAAE,MAAyB,EAAE,EAAE;QACjD,OAAO,IAAI,CAAA;kCACmB,MAAM,CAAC,OAAO,CAAC,IAAI;WAC1C,CAAC;IACV,CAAC;CACF,CAAC","sourcesContent":["import { html } from 'lit-html';\nimport { ActionConfig, COLORS } from '../types';\nimport { Node, SetContactChannel } from '../../store/flow-definition';\n\nexport const set_contact_channel: ActionConfig = {\n name: 'Update Contact Channel',\n color: COLORS.update,\n render: (_node: Node, action: SetContactChannel) => {\n return html`<div>\n Set contact channel to <b>${action.channel.name}</b>\n </div>`;\n }\n};\n"]}
1
+ {"version":3,"file":"set_contact_channel.js","sourceRoot":"","sources":["../../../../src/flow/actions/set_contact_channel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAChC,OAAO,EAAgB,MAAM,EAAoB,MAAM,UAAU,CAAC;AAGlE,MAAM,CAAC,MAAM,mBAAmB,GAAiB;IAC/C,IAAI,EAAE,gBAAgB;IACtB,KAAK,EAAE,MAAM,CAAC,MAAM;IACpB,MAAM,EAAE,CAAC,KAAW,EAAE,MAAyB,EAAE,EAAE;QACjD,OAAO,IAAI,CAAA,kBAAkB,MAAM,CAAC,OAAO,CAAC,IAAI,YAAY,CAAC;IAC/D,CAAC;IACD,IAAI,EAAE;QACJ,OAAO,EAAE;YACP,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,SAAS;YAChB,QAAQ,EAAE,IAAI;YACd,UAAU,EAAE,IAAI;YAChB,SAAS,EAAE,KAAK;YAChB,QAAQ,EAAE,uBAAuB;YACjC,QAAQ,EAAE,MAAM;YAChB,OAAO,EAAE,MAAM;YACf,QAAQ,EAAE,2CAA2C;SACtD;KACF;IACD,QAAQ,EAAE,CAAC,QAA2B,EAAoB,EAAE;QAC1D,MAAM,MAAM,GAA8B,EAAE,CAAC;QAE7C,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;YACtB,MAAM,CAAC,OAAO,GAAG,qBAAqB,CAAC;QACzC,CAAC;QAED,OAAO;YACL,KAAK,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, SetContactChannel } from '../../store/flow-definition';\n\nexport const set_contact_channel: ActionConfig = {\n name: 'Update Channel',\n color: COLORS.update,\n render: (_node: Node, action: SetContactChannel) => {\n return html`<div>Set to <b>${action.channel.name}</b></div>`;\n },\n form: {\n channel: {\n type: 'select',\n label: 'Channel',\n required: true,\n searchable: true,\n clearable: false,\n endpoint: '/api/v2/channels.json',\n valueKey: 'uuid',\n nameKey: 'name',\n helpText: 'Select the channel to set for the contact'\n }\n },\n validate: (formData: SetContactChannel): ValidationResult => {\n const errors: { [key: string]: string } = {};\n\n if (!formData.channel) {\n errors.channel = 'Channel is required';\n }\n\n return {\n valid: Object.keys(errors).length === 0,\n errors\n };\n }\n};\n"]}
@@ -1,12 +1,62 @@
1
1
  import { html } from 'lit-html';
2
2
  import { COLORS } from '../types';
3
3
  export const set_contact_field = {
4
- name: 'Update Contact Field',
4
+ name: 'Update Field',
5
5
  color: COLORS.update,
6
6
  render: (_node, action) => {
7
7
  return html `<div>
8
8
  Set <b>${action.field.name}</b> to <b>${action.value}</b>
9
9
  </div>`;
10
+ },
11
+ form: {
12
+ field: {
13
+ type: 'select',
14
+ label: 'Field',
15
+ required: true,
16
+ searchable: true,
17
+ clearable: false,
18
+ nameKey: 'name',
19
+ valueKey: 'key',
20
+ endpoint: '/api/v2/fields.json',
21
+ helpText: 'Select the contact field to update',
22
+ allowCreate: true,
23
+ createArbitraryOption: (input) => ({ key: input, name: input })
24
+ },
25
+ value: {
26
+ type: 'text',
27
+ label: 'Value',
28
+ placeholder: 'Enter field value...',
29
+ required: true,
30
+ evaluated: true,
31
+ helpText: 'The new value for the contact field. You can use expressions like @contact.name'
32
+ }
33
+ },
34
+ fromFormData: (formData) => {
35
+ const field = formData.field[0];
36
+ return {
37
+ uuid: formData.uuid,
38
+ type: 'set_contact_field',
39
+ field: { name: field.name, key: field.key },
40
+ value: formData.value
41
+ };
42
+ },
43
+ validate: (formData) => {
44
+ const errors = {};
45
+ if (!formData.field) {
46
+ errors.field = 'Field is required';
47
+ }
48
+ if (!formData.value || formData.value.trim() === '') {
49
+ errors.value = 'Field value is required';
50
+ }
51
+ return {
52
+ valid: Object.keys(errors).length === 0,
53
+ errors
54
+ };
55
+ },
56
+ sanitize: (formData) => {
57
+ if (formData.value && typeof formData.value === 'string') {
58
+ formData.value = formData.value.trim();
59
+ }
10
60
  }
11
61
  };
12
62
  //# sourceMappingURL=set_contact_field.js.map
@@ -1 +1 @@
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,MAAM,EAAE,MAAM,UAAU,CAAC;AAGhD,MAAM,CAAC,MAAM,iBAAiB,GAAiB;IAC7C,IAAI,EAAE,sBAAsB;IAC5B,KAAK,EAAE,MAAM,CAAC,MAAM;IACpB,MAAM,EAAE,CAAC,KAAW,EAAE,MAAuB,EAAE,EAAE;QAC/C,OAAO,IAAI,CAAA;eACA,MAAM,CAAC,KAAK,CAAC,IAAI,cAAc,MAAM,CAAC,KAAK;WAC/C,CAAC;IACV,CAAC;CACF,CAAC","sourcesContent":["import { html } from 'lit-html';\nimport { ActionConfig, COLORS } from '../types';\nimport { Node, SetContactField } from '../../store/flow-definition';\n\nexport const set_contact_field: ActionConfig = {\n name: 'Update Contact Field',\n color: COLORS.update,\n render: (_node: Node, action: SetContactField) => {\n return html`<div>\n Set <b>${action.field.name}</b> to <b>${action.value}</b>\n </div>`;\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,MAAM,EAAoB,MAAM,UAAU,CAAC;AAGlE,MAAM,CAAC,MAAM,iBAAiB,GAAiB;IAC7C,IAAI,EAAE,cAAc;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AAC,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 <b>${action.field.name}</b> to <b>${action.value}</b>\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,10 +1,78 @@
1
1
  import { html } from 'lit-html';
2
2
  import { COLORS } from '../types';
3
+ import { getStore } from '../../store/Store';
3
4
  export const set_contact_language = {
4
- name: 'Update Contact Language',
5
+ name: 'Update Language',
5
6
  color: COLORS.update,
6
7
  render: (_node, action) => {
7
- return html `<div>Set contact language to <b>${action.language}</b></div>`;
8
+ const languageNames = new Intl.DisplayNames(['en'], {
9
+ type: 'language'
10
+ });
11
+ return html `<div>Set to <b>${languageNames.of(action.language)}</b></div>`;
12
+ },
13
+ form: {
14
+ language: {
15
+ type: 'select',
16
+ label: 'Language',
17
+ required: true,
18
+ searchable: true,
19
+ clearable: false,
20
+ valueKey: 'value',
21
+ nameKey: 'name',
22
+ helpText: 'Select the language to set for the contact',
23
+ getDynamicOptions: () => {
24
+ const store = getStore();
25
+ const workspace = store === null || store === void 0 ? void 0 : store.getState().workspace;
26
+ if ((workspace === null || workspace === void 0 ? void 0 : workspace.languages) && Array.isArray(workspace.languages)) {
27
+ const languageNames = new Intl.DisplayNames(['en'], {
28
+ type: 'language'
29
+ });
30
+ return workspace.languages.map((languageCode) => ({
31
+ value: languageCode,
32
+ name: languageNames.of(languageCode) || languageCode
33
+ }));
34
+ }
35
+ return [];
36
+ }
37
+ }
38
+ },
39
+ toFormData: (action) => {
40
+ // Convert the language code back to the option object format expected by the form
41
+ if (action.language) {
42
+ const languageNames = new Intl.DisplayNames(['en'], {
43
+ type: 'language'
44
+ });
45
+ return {
46
+ language: [
47
+ {
48
+ value: action.language,
49
+ name: languageNames.of(action.language) || action.language
50
+ }
51
+ ],
52
+ uuid: action.uuid
53
+ };
54
+ }
55
+ return {
56
+ language: null,
57
+ uuid: action.uuid
58
+ };
59
+ },
60
+ fromFormData: (formData) => {
61
+ return {
62
+ uuid: formData.uuid,
63
+ type: 'set_contact_language',
64
+ language: formData.language[0].value
65
+ };
66
+ },
67
+ validate: (formData) => {
68
+ const errors = {};
69
+ if (!formData.language) {
70
+ errors.language = 'Language is required';
71
+ }
72
+ return {
73
+ valid: Object.keys(errors).length === 0,
74
+ errors
75
+ };
8
76
  }
9
77
  };
10
78
  //# sourceMappingURL=set_contact_language.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"set_contact_language.js","sourceRoot":"","sources":["../../../../src/flow/actions/set_contact_language.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAChC,OAAO,EAAgB,MAAM,EAAE,MAAM,UAAU,CAAC;AAGhD,MAAM,CAAC,MAAM,oBAAoB,GAAiB;IAChD,IAAI,EAAE,yBAAyB;IAC/B,KAAK,EAAE,MAAM,CAAC,MAAM;IACpB,MAAM,EAAE,CAAC,KAAW,EAAE,MAA0B,EAAE,EAAE;QAClD,OAAO,IAAI,CAAA,mCAAmC,MAAM,CAAC,QAAQ,YAAY,CAAC;IAC5E,CAAC;CACF,CAAC","sourcesContent":["import { html } from 'lit-html';\nimport { ActionConfig, COLORS } from '../types';\nimport { Node, SetContactLanguage } from '../../store/flow-definition';\n\nexport const set_contact_language: ActionConfig = {\n name: 'Update Contact Language',\n color: COLORS.update,\n render: (_node: Node, action: SetContactLanguage) => {\n return html`<div>Set contact language to <b>${action.language}</b></div>`;\n }\n};\n"]}
1
+ {"version":3,"file":"set_contact_language.js","sourceRoot":"","sources":["../../../../src/flow/actions/set_contact_language.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAChC,OAAO,EAAgB,MAAM,EAAoB,MAAM,UAAU,CAAC;AAElE,OAAO,EAAE,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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>Set to <b>${languageNames.of(action.language)}</b></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,10 +1,35 @@
1
1
  import { html } from 'lit-html';
2
2
  import { COLORS } from '../types';
3
3
  export const set_contact_name = {
4
- name: 'Update Contact',
4
+ name: 'Update Name',
5
5
  color: COLORS.update,
6
6
  render: (_node, action) => {
7
- return html `<div>Set contact name to <b>${action.name}</b></div>`;
7
+ return html `<div>Set to <b>${action.name}</b></div>`;
8
+ },
9
+ form: {
10
+ name: {
11
+ type: 'text',
12
+ label: 'Name',
13
+ placeholder: 'Enter contact name...',
14
+ required: true,
15
+ evaluated: true,
16
+ helpText: 'The new name for the contact. You can use expressions like @contact.name'
17
+ }
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
+ sanitize: (formData) => {
30
+ if (formData.name && typeof formData.name === 'string') {
31
+ formData.name = formData.name.trim();
32
+ }
8
33
  }
9
34
  };
10
35
  //# sourceMappingURL=set_contact_name.js.map
@@ -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,EAAE,MAAM,UAAU,CAAC;AAGhD,MAAM,CAAC,MAAM,gBAAgB,GAAiB;IAC5C,IAAI,EAAE,gBAAgB;IACtB,KAAK,EAAE,MAAM,CAAC,MAAM;IACpB,MAAM,EAAE,CAAC,KAAW,EAAE,MAAsB,EAAE,EAAE;QAC9C,OAAO,IAAI,CAAA,+BAA+B,MAAM,CAAC,IAAI,YAAY,CAAC;IACpE,CAAC;CACF,CAAC","sourcesContent":["import { html } from 'lit-html';\nimport { ActionConfig, COLORS } from '../types';\nimport { Node, SetContactName } from '../../store/flow-definition';\n\nexport const set_contact_name: ActionConfig = {\n name: 'Update Contact',\n color: COLORS.update,\n render: (_node: Node, action: SetContactName) => {\n return html`<div>Set contact name to <b>${action.name}</b></div>`;\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,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,kBAAkB,MAAM,CAAC,IAAI,YAAY,CAAC;IACvD,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 <b>${action.name}</b></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,10 +1,40 @@
1
1
  import { html } from 'lit-html';
2
2
  import { COLORS } from '../types';
3
+ import { titleCase } from '../../utils';
3
4
  export const set_contact_status = {
4
- name: 'Update Contact Status',
5
+ name: 'Update Status',
5
6
  color: COLORS.update,
6
7
  render: (_node, action) => {
7
- return html `<div>Set contact status to <b>${action.status}</b></div>`;
8
+ return html `<div>Set to <b>${titleCase(action.status)}</b></div>`;
9
+ },
10
+ form: {
11
+ status: {
12
+ type: 'select',
13
+ label: 'Status',
14
+ required: true,
15
+ searchable: false,
16
+ clearable: false,
17
+ options: [
18
+ { value: 'active', name: 'Active' },
19
+ { value: 'archived', name: 'Archived' },
20
+ { value: 'stopped', name: 'Stopped' },
21
+ { value: 'blocked', name: 'Blocked' }
22
+ ],
23
+ helpText: 'Select the status to set for the contact'
24
+ }
25
+ },
26
+ validate: (formData) => {
27
+ const errors = {};
28
+ if (!formData.status) {
29
+ errors.status = 'Status is required';
30
+ }
31
+ else if (!['active', 'archived', 'stopped', 'blocked'].includes(formData.status)) {
32
+ errors.status = 'Invalid status selected';
33
+ }
34
+ return {
35
+ valid: Object.keys(errors).length === 0,
36
+ errors
37
+ };
8
38
  }
9
39
  };
10
40
  //# sourceMappingURL=set_contact_status.js.map
@@ -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;AAGhD,MAAM,CAAC,MAAM,kBAAkB,GAAiB;IAC9C,IAAI,EAAE,uBAAuB;IAC7B,KAAK,EAAE,MAAM,CAAC,MAAM;IACpB,MAAM,EAAE,CAAC,KAAW,EAAE,MAAwB,EAAE,EAAE;QAChD,OAAO,IAAI,CAAA,iCAAiC,MAAM,CAAC,MAAM,YAAY,CAAC;IACxE,CAAC;CACF,CAAC","sourcesContent":["import { html } from 'lit-html';\nimport { ActionConfig, COLORS } from '../types';\nimport { Node, SetContactStatus } from '../../store/flow-definition';\n\nexport const set_contact_status: ActionConfig = {\n name: 'Update Contact Status',\n color: COLORS.update,\n render: (_node: Node, action: SetContactStatus) => {\n return html`<div>Set contact status to <b>${action.status}</b></div>`;\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,MAAM,EAAoB,MAAM,UAAU,CAAC;AAElE,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,kBAAkB,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC;IACpE,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;IACD,QAAQ,EAAE,CAAC,QAA0B,EAAoB,EAAE;QACzD,MAAM,MAAM,GAA8B,EAAE,CAAC;QAE7C,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;YACrB,MAAM,CAAC,MAAM,GAAG,oBAAoB,CAAC;QACvC,CAAC;aAAM,IACL,CAAC,CAAC,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,EACvE,CAAC;YACD,MAAM,CAAC,MAAM,GAAG,yBAAyB,CAAC;QAC5C,CAAC;QAED,OAAO;YACL,KAAK,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, 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 <b>${titleCase(action.status)}</b></div>`;\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 validate: (formData: SetContactStatus): ValidationResult => {\n const errors: { [key: string]: string } = {};\n\n if (!formData.status) {\n errors.status = 'Status is required';\n } else if (\n !['active', 'archived', 'stopped', 'blocked'].includes(formData.status)\n ) {\n errors.status = 'Invalid status selected';\n }\n\n return {\n valid: Object.keys(errors).length === 0,\n errors\n };\n }\n};\n"]}
@@ -5,7 +5,9 @@ export const set_run_result = {
5
5
  name: 'Save Flow Result',
6
6
  color: COLORS.save,
7
7
  render: (_node, action) => {
8
- return html `<div>Save ${action.value} as <b>${action.name}</b></div>`;
8
+ return html `<div>
9
+ Save <b>${action.value}</b> as <b>${action.name}</b>
10
+ </div>`;
9
11
  },
10
12
  form: {
11
13
  name: {
@@ -23,7 +25,15 @@ export const set_run_result = {
23
25
  },
24
26
  searchable: true,
25
27
  clearable: false,
26
- options: []
28
+ getDynamicOptions: () => {
29
+ const store = getStore();
30
+ return store
31
+ ? store
32
+ .getState()
33
+ .getFlowResults()
34
+ .map((r) => ({ value: r.name, name: r.name }))
35
+ : [];
36
+ }
27
37
  },
28
38
  value: {
29
39
  type: 'text',
@@ -43,17 +53,9 @@ export const set_run_result = {
43
53
  },
44
54
  layout: ['name', 'value', 'category'],
45
55
  toFormData: (action) => {
46
- // Get existing flow results to populate the select options
47
- const store = getStore();
48
- const flowResults = store ? store.getState().getFlowResults() : [];
49
- // Update the form configuration with dynamic options
50
- const config = set_run_result;
51
- if (config.form && config.form.name && config.form.name.type === 'select') {
52
- config.form.name.options = flowResults.map((result) => result.name);
53
- }
54
56
  return {
55
57
  uuid: action.uuid,
56
- name: action.name || '',
58
+ name: action.name ? [{ name: action.name, value: action.name }] : [],
57
59
  value: action.value || '',
58
60
  category: action.category || ''
59
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,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AI,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, 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>Save ${action.value} as <b>${action.name}</b></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 options: []\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 // Get existing flow results to populate the select options\n const store = getStore();\n const flowResults = store ? store.getState().getFlowResults() : [];\n\n // Update the form configuration with dynamic options\n const config = set_run_result;\n if (config.form && config.form.name && config.form.name.type === 'select') {\n (config.form.name as any).options = flowResults.map(\n (result) => result.name\n );\n }\n\n return {\n uuid: action.uuid,\n name: 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,MAAM,EAAE,MAAM,UAAU,CAAC;AAEhD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,MAAM,CAAC,MAAM,cAAc,GAAiB;IAC1C,IAAI,EAAE,kBAAkB;IACxB,KAAK,EAAE,MAAM,CAAC,IAAI;IAClB,MAAM,EAAE,CAAC,KAAW,EAAE,MAAoB,EAAE,EAAE;QAC5C,OAAO,IAAI,CAAA;gBACC,MAAM,CAAC,KAAK,cAAc,MAAM,CAAC,IAAI;WAC1C,CAAC;IACV,CAAC;IACD,IAAI,EAAE;QACJ,IAAI,EAAE;YACJ,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,aAAa;YACpB,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K,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 <b>${action.value}</b> as <b>${action.name}</b>\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"]}
@@ -34,10 +34,10 @@ export const split_by_expression = {
34
34
  label: 'Operator',
35
35
  required: true,
36
36
  options: [
37
- { value: 'contains', label: 'contains' },
38
- { value: 'equals', label: 'equals' },
39
- { value: 'starts_with', label: 'starts with' },
40
- { value: 'regex', label: 'regex' }
37
+ { value: 'contains', name: 'contains' },
38
+ { value: 'equals', name: 'equals' },
39
+ { value: 'starts_with', name: 'starts with' },
40
+ { value: 'regex', name: 'regex' }
41
41
  ]
42
42
  },
43
43
  operand: {
@@ -1 +1 @@
1
- {"version":3,"file":"split_by_expression_example.js","sourceRoot":"","sources":["../../../../src/flow/actions/split_by_expression_example.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAChC,OAAO,EAAgB,MAAM,EAAE,MAAM,UAAU,CAAC;AAEhD,qDAAqD;AACrD,MAAM,2BAA2B,GAAG,CAAC,OAAe,EAAU,EAAE;IAC9D,IAAI,CAAC,OAAO;QAAE,OAAO,EAAE,CAAC;IAExB,0DAA0D;IAC1D,OAAO,OAAO;SACX,WAAW,EAAE;SACb,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC,uBAAuB;SACnD,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,kCAAkC;SACvD,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,eAAe;AAClC,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAiB;IAC/C,IAAI,EAAE,qBAAqB;IAC3B,KAAK,EAAE,MAAM,CAAC,KAAK;IACnB,IAAI,EAAE;QACJ,OAAO,EAAE;YACP,IAAI,EAAE,MAAM;YACZ,KAAK,EAAE,UAAU;YACjB,QAAQ,EAAE,IAAI;YACd,SAAS,EAAE,IAAI;YACf,WAAW,EAAE,8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,EAAE,KAAK,EAAE,CAAC,EAC/C,CAAC;oBACD,IAAI,CAAC,QAAQ,GAAG,2BAA2B,CAAC,KAAK,CAAC,CAAC;gBACrD,CAAC;gBAED,YAAY,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC;gBAC/B,OAAO,YAAY,CAAC;YACtB,CAAC;SACF;KACF;IACD,MAAM,EAAE,CAAC,KAAU,EAAE,MAAW,EAAE,EAAE;QAClC,OAAO,IAAI,CAAA,QAAQ,MAAM,CAAC,OAAO,IAAI,qBAAqB,QAAQ,CAAC;IACrE,CAAC;CACF,CAAC","sourcesContent":["import { html } from 'lit-html';\nimport { ActionConfig, COLORS } from '../types';\n\n// utility function to generate category from operand\nconst generateCategoryFromOperand = (operand: string): string => {\n if (!operand) return '';\n\n // clean up the operand to make a reasonable category name\n return operand\n .toLowerCase()\n .replace(/[^a-z0-9\\s]/g, '') // remove special chars\n .replace(/\\s+/g, '_') // replace spaces with underscores\n .slice(0, 20); // limit length\n};\n\nexport const split_by_expression: ActionConfig = {\n name: 'Split by Expression',\n color: COLORS.split,\n form: {\n operand: {\n type: 'text',\n label: 'Split by',\n required: true,\n evaluated: true,\n placeholder: 'Enter expression to evaluate'\n },\n rules: {\n type: 'array',\n label: 'Rules',\n sortable: true,\n minItems: 1,\n itemLabel: 'Rule',\n itemConfig: {\n operator: {\n type: 'select',\n label: 'Operator',\n required: true,\n options: [\n { value: 'contains', label: 'contains' },\n { value: 'equals', label: 'equals' },\n { value: 'starts_with', label: 'starts with' },\n { value: 'regex', label: 'regex' }\n ]\n },\n operand: {\n type: 'text',\n label: 'Value',\n required: true,\n evaluated: true,\n placeholder: 'Value to compare against'\n },\n category: {\n type: 'text',\n label: 'Category',\n required: true,\n placeholder: 'Category name for this rule'\n }\n },\n // handle changes at the item level\n onItemChange: (\n itemIndex: number,\n field: string,\n value: any,\n allItems: any[]\n ) => {\n const updatedItems = [...allItems];\n const item = { ...updatedItems[itemIndex] };\n\n // update the changed field\n item[field] = value;\n\n // if operand changed and category is empty, auto-generate category\n if (\n field === 'operand' &&\n (!item.category || item.category.trim() === '')\n ) {\n item.category = generateCategoryFromOperand(value);\n }\n\n updatedItems[itemIndex] = item;\n return updatedItems;\n }\n }\n },\n render: (_node: any, action: any) => {\n return html`<div>${action.operand || 'Split by expression'}</div>`;\n }\n};\n"]}
1
+ {"version":3,"file":"split_by_expression_example.js","sourceRoot":"","sources":["../../../../src/flow/actions/split_by_expression_example.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAChC,OAAO,EAAgB,MAAM,EAAE,MAAM,UAAU,CAAC;AAEhD,qDAAqD;AACrD,MAAM,2BAA2B,GAAG,CAAC,OAAe,EAAU,EAAE;IAC9D,IAAI,CAAC,OAAO;QAAE,OAAO,EAAE,CAAC;IAExB,0DAA0D;IAC1D,OAAO,OAAO;SACX,WAAW,EAAE;SACb,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC,uBAAuB;SACnD,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,kCAAkC;SACvD,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,eAAe;AAClC,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAiB;IAC/C,IAAI,EAAE,qBAAqB;IAC3B,KAAK,EAAE,MAAM,CAAC,KAAK;IACnB,IAAI,EAAE;QACJ,OAAO,EAAE;YACP,IAAI,EAAE,MAAM;YACZ,KAAK,EAAE,UAAU;YACjB,QAAQ,EAAE,IAAI;YACd,SAAS,EAAE,IAAI;YACf,WAAW,EAAE,8BAA8B;SAC5C;QACD,KAAK,EAAE;YACL,IAAI,EAAE,OAAO;YACb,KAAK,EAAE,OAAO;YACd,QAAQ,EAAE,IAAI;YACd,QAAQ,EAAE,CAAC;YACX,SAAS,EAAE,MAAM;YACjB,UAAU,EAAE;gBACV,QAAQ,EAAE;oBACR,IAAI,EAAE,QAAQ;oBACd,KAAK,EAAE,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CAAC,KAAU,EAAE,MAAW,EAAE,EAAE;QAClC,OAAO,IAAI,CAAA,QAAQ,MAAM,CAAC,OAAO,IAAI,qBAAqB,QAAQ,CAAC;IACrE,CAAC;CACF,CAAC","sourcesContent":["import { html } from 'lit-html';\nimport { ActionConfig, COLORS } from '../types';\n\n// utility function to generate category from operand\nconst generateCategoryFromOperand = (operand: string): string => {\n if (!operand) return '';\n\n // clean up the operand to make a reasonable category name\n return operand\n .toLowerCase()\n .replace(/[^a-z0-9\\s]/g, '') // remove special chars\n .replace(/\\s+/g, '_') // replace spaces with underscores\n .slice(0, 20); // limit length\n};\n\nexport const split_by_expression: ActionConfig = {\n name: 'Split by Expression',\n color: COLORS.split,\n form: {\n operand: {\n type: 'text',\n label: 'Split by',\n required: true,\n evaluated: true,\n placeholder: 'Enter expression to evaluate'\n },\n rules: {\n type: 'array',\n label: 'Rules',\n sortable: true,\n minItems: 1,\n itemLabel: 'Rule',\n itemConfig: {\n operator: {\n type: 'select',\n label: 'Operator',\n required: true,\n options: [\n { value: 'contains', name: 'contains' },\n { value: 'equals', name: 'equals' },\n { value: 'starts_with', name: 'starts with' },\n { value: 'regex', name: 'regex' }\n ]\n },\n operand: {\n type: 'text',\n label: 'Value',\n required: true,\n evaluated: true,\n placeholder: 'Value to compare against'\n },\n category: {\n type: 'text',\n label: 'Category',\n required: true,\n placeholder: 'Category name for this rule'\n }\n },\n // handle changes at the item level\n onItemChange: (\n itemIndex: number,\n field: string,\n value: any,\n allItems: any[]\n ) => {\n const updatedItems = [...allItems];\n const item = { ...updatedItems[itemIndex] };\n\n // update the changed field\n item[field] = value;\n\n // if operand changed and category is empty, auto-generate category\n if (\n field === 'operand' &&\n (!item.category || item.category.trim() === '')\n ) {\n item.category = generateCategoryFromOperand(value);\n }\n\n updatedItems[itemIndex] = item;\n return updatedItems;\n }\n }\n },\n render: (_node: any, action: any) => {\n return html`<div>${action.operand || 'Split by expression'}</div>`;\n }\n};\n"]}
@@ -12,11 +12,8 @@ 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 { open_ticket } from './actions/open_ticket';
16
- import { call_webhook } from './actions/call_webhook';
17
15
  import { call_classifier } from './actions/call_classifier';
18
16
  import { call_resthook } from './actions/call_resthook';
19
- import { call_llm } from './actions/call_llm';
20
17
  import { transfer_airtime } from './actions/transfer_airtime';
21
18
  import { set_contact_name } from './actions/set_contact_name';
22
19
  import { add_contact_groups } from './actions/add_contact_groups';
@@ -24,7 +21,6 @@ import { remove_contact_groups } from './actions/remove_contact_groups';
24
21
  import { request_optin } from './actions/request_optin';
25
22
  import { say_msg } from './actions/say_msg';
26
23
  import { play_audio } from './actions/play_audio';
27
- import { enter_flow } from './actions/enter_flow';
28
24
  // Import all node configurations
29
25
  import { execute_actions } from './nodes/execute_actions';
30
26
  import { split_by_airtime } from './nodes/split_by_airtime';
@@ -37,6 +33,7 @@ import { split_by_scheme } from './nodes/split_by_scheme';
37
33
  import { split_by_subflow } from './nodes/split_by_subflow';
38
34
  import { split_by_ticket } from './nodes/split_by_ticket';
39
35
  import { split_by_webhook } from './nodes/split_by_webhook';
36
+ import { split_by_llm } from './nodes/split_by_llm';
40
37
  import { split_by_llm_categorize } from './nodes/split_by_llm_categorize';
41
38
  import { wait_for_audio } from './nodes/wait_for_audio';
42
39
  import { wait_for_digits } from './nodes/wait_for_digits';
@@ -57,12 +54,8 @@ export const ACTION_CONFIG = {
57
54
  send_msg,
58
55
  send_email,
59
56
  start_session,
60
- open_ticket,
61
- call_webhook,
62
57
  call_classifier,
63
58
  call_resthook,
64
- call_llm,
65
- enter_flow,
66
59
  transfer_airtime,
67
60
  set_contact_name,
68
61
  add_contact_groups,
@@ -77,6 +70,7 @@ export const NODE_CONFIG = {
77
70
  split_by_contact_field,
78
71
  split_by_expression,
79
72
  split_by_groups,
73
+ split_by_llm,
80
74
  split_by_llm_categorize,
81
75
  split_by_random,
82
76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eAAe;IACf,iBAAiB;IACjB,mBAAmB;IACnB,oBAAoB;IACpB,kBAAkB;IAClB,cAAc;IACd,cAAc;IACd,QAAQ;IACR,UAAU;IACV,aAAa;IACb,WAAW;IACX,YAAY;IACZ,eAAe;IACf,aAAa;IACb,QAAQ;IACR,UAAU;IACV,gBAAgB;IAChB,gBAAgB;IAChB,kBAAkB;IAClB,qBAAqB;IACrB,aAAa;IACb,OAAO;IACP,UAAU;CACX,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAEpB;IACF,eAAe;IACf,gBAAgB;IAChB,sBAAsB;IACtB,mBAAmB;IACnB,eAAe;IACf,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 { open_ticket } from './actions/open_ticket';\nimport { call_webhook } from './actions/call_webhook';\nimport { call_classifier } from './actions/call_classifier';\nimport { call_resthook } from './actions/call_resthook';\nimport { call_llm } from './actions/call_llm';\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';\nimport { enter_flow } from './actions/enter_flow';\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_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 open_ticket,\n call_webhook,\n call_classifier,\n call_resthook,\n call_llm,\n enter_flow,\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_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_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AChB,gBAAgB;IAChB,kBAAkB;IAClB,qBAAqB;IACrB,aAAa;IACb,OAAO;IACP,UAAU;CACX,CAAC;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"]}
@@ -0,0 +1,2 @@
1
+ // No unified contact form exports - each action has its own form configuration
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/flow/forms/index.ts"],"names":[],"mappings":"AAAA,+EAA+E","sourcesContent":["// No unified contact form exports - each action has its own form configuration\n"]}