@nyaruka/temba-components 0.131.1 → 0.131.3

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 (485) hide show
  1. package/.github/workflows/publish.yml +4 -1
  2. package/CHANGELOG.md +75 -1
  3. package/demo/components/floating-tabs/example.html +400 -0
  4. package/demo/components/flow/index.html +1 -1
  5. package/demo/data/flows/food-order.json +2 -2
  6. package/demo/data/flows/sample-flow.json +113 -125
  7. package/demo/data/flows/voicemail.json +613 -0
  8. package/demo/index.html +6 -0
  9. package/dist/locales/es.js +5 -5
  10. package/dist/locales/es.js.map +1 -1
  11. package/dist/locales/fr.js +5 -5
  12. package/dist/locales/fr.js.map +1 -1
  13. package/dist/locales/locale-codes.js +11 -2
  14. package/dist/locales/locale-codes.js.map +1 -1
  15. package/dist/locales/pt.js +5 -5
  16. package/dist/locales/pt.js.map +1 -1
  17. package/dist/static/svg/index.svg +1 -1
  18. package/dist/temba-components.js +1773 -662
  19. package/dist/temba-components.js.map +1 -1
  20. package/out-tsc/src/Icons.js +4 -1
  21. package/out-tsc/src/Icons.js.map +1 -1
  22. package/out-tsc/src/display/FloatingTab.js +167 -0
  23. package/out-tsc/src/display/FloatingTab.js.map +1 -0
  24. package/out-tsc/src/display/ProgressBar.js +22 -2
  25. package/out-tsc/src/display/ProgressBar.js.map +1 -1
  26. package/out-tsc/src/events.js.map +1 -1
  27. package/out-tsc/src/flow/CanvasMenu.js +200 -0
  28. package/out-tsc/src/flow/CanvasMenu.js.map +1 -0
  29. package/out-tsc/src/flow/CanvasNode.js +489 -47
  30. package/out-tsc/src/flow/CanvasNode.js.map +1 -1
  31. package/out-tsc/src/flow/Editor.js +1417 -67
  32. package/out-tsc/src/flow/Editor.js.map +1 -1
  33. package/out-tsc/src/flow/NodeEditor.js +479 -112
  34. package/out-tsc/src/flow/NodeEditor.js.map +1 -1
  35. package/out-tsc/src/flow/NodeTypeSelector.js +540 -0
  36. package/out-tsc/src/flow/NodeTypeSelector.js.map +1 -0
  37. package/out-tsc/src/flow/StickyNote.js +12 -3
  38. package/out-tsc/src/flow/StickyNote.js.map +1 -1
  39. package/out-tsc/src/flow/actions/add_contact_groups.js +4 -3
  40. package/out-tsc/src/flow/actions/add_contact_groups.js.map +1 -1
  41. package/out-tsc/src/flow/actions/add_contact_urn.js +63 -4
  42. package/out-tsc/src/flow/actions/add_contact_urn.js.map +1 -1
  43. package/out-tsc/src/flow/actions/add_input_labels.js +4 -3
  44. package/out-tsc/src/flow/actions/add_input_labels.js.map +1 -1
  45. package/out-tsc/src/flow/actions/play_audio.js +3 -2
  46. package/out-tsc/src/flow/actions/play_audio.js.map +1 -1
  47. package/out-tsc/src/flow/actions/remove_contact_groups.js +7 -5
  48. package/out-tsc/src/flow/actions/remove_contact_groups.js.map +1 -1
  49. package/out-tsc/src/flow/actions/request_optin.js +3 -2
  50. package/out-tsc/src/flow/actions/request_optin.js.map +1 -1
  51. package/out-tsc/src/flow/actions/say_msg.js +3 -2
  52. package/out-tsc/src/flow/actions/say_msg.js.map +1 -1
  53. package/out-tsc/src/flow/actions/send_broadcast.js +77 -23
  54. package/out-tsc/src/flow/actions/send_broadcast.js.map +1 -1
  55. package/out-tsc/src/flow/actions/send_email.js +5 -5
  56. package/out-tsc/src/flow/actions/send_email.js.map +1 -1
  57. package/out-tsc/src/flow/actions/send_msg.js +101 -21
  58. package/out-tsc/src/flow/actions/send_msg.js.map +1 -1
  59. package/out-tsc/src/flow/actions/set_contact_channel.js +6 -9
  60. package/out-tsc/src/flow/actions/set_contact_channel.js.map +1 -1
  61. package/out-tsc/src/flow/actions/set_contact_field.js +20 -20
  62. package/out-tsc/src/flow/actions/set_contact_field.js.map +1 -1
  63. package/out-tsc/src/flow/actions/set_contact_language.js +3 -2
  64. package/out-tsc/src/flow/actions/set_contact_language.js.map +1 -1
  65. package/out-tsc/src/flow/actions/set_contact_name.js +3 -12
  66. package/out-tsc/src/flow/actions/set_contact_name.js.map +1 -1
  67. package/out-tsc/src/flow/actions/set_contact_status.js +3 -2
  68. package/out-tsc/src/flow/actions/set_contact_status.js.map +1 -1
  69. package/out-tsc/src/flow/actions/set_run_result.js +4 -3
  70. package/out-tsc/src/flow/actions/set_run_result.js.map +1 -1
  71. package/out-tsc/src/flow/actions/start_session.js +181 -6
  72. package/out-tsc/src/flow/actions/start_session.js.map +1 -1
  73. package/out-tsc/src/flow/config.js +11 -23
  74. package/out-tsc/src/flow/config.js.map +1 -1
  75. package/out-tsc/src/flow/currencies.js +45 -0
  76. package/out-tsc/src/flow/currencies.js.map +1 -0
  77. package/out-tsc/src/flow/nodes/shared-rules.js +257 -0
  78. package/out-tsc/src/flow/nodes/shared-rules.js.map +1 -0
  79. package/out-tsc/src/flow/nodes/shared.js +71 -0
  80. package/out-tsc/src/flow/nodes/shared.js.map +1 -0
  81. package/out-tsc/src/flow/nodes/split_by_airtime.js +211 -5
  82. package/out-tsc/src/flow/nodes/split_by_airtime.js.map +1 -1
  83. package/out-tsc/src/flow/nodes/split_by_contact_field.js +152 -3
  84. package/out-tsc/src/flow/nodes/split_by_contact_field.js.map +1 -1
  85. package/out-tsc/src/flow/nodes/split_by_expression.js +73 -2
  86. package/out-tsc/src/flow/nodes/split_by_expression.js.map +1 -1
  87. package/out-tsc/src/flow/nodes/split_by_groups.js +18 -10
  88. package/out-tsc/src/flow/nodes/split_by_groups.js.map +1 -1
  89. package/out-tsc/src/flow/nodes/split_by_intent.js +8 -0
  90. package/out-tsc/src/flow/nodes/split_by_intent.js.map +1 -0
  91. package/out-tsc/src/flow/nodes/split_by_llm.js +11 -3
  92. package/out-tsc/src/flow/nodes/split_by_llm.js.map +1 -1
  93. package/out-tsc/src/flow/nodes/split_by_llm_categorize.js +10 -3
  94. package/out-tsc/src/flow/nodes/split_by_llm_categorize.js.map +1 -1
  95. package/out-tsc/src/flow/nodes/split_by_random.js +10 -4
  96. package/out-tsc/src/flow/nodes/split_by_random.js.map +1 -1
  97. package/out-tsc/src/flow/nodes/split_by_resthook.js +113 -0
  98. package/out-tsc/src/flow/nodes/split_by_resthook.js.map +1 -0
  99. package/out-tsc/src/flow/nodes/split_by_run_result.js +211 -3
  100. package/out-tsc/src/flow/nodes/split_by_run_result.js.map +1 -1
  101. package/out-tsc/src/flow/nodes/split_by_scheme.js +158 -2
  102. package/out-tsc/src/flow/nodes/split_by_scheme.js.map +1 -1
  103. package/out-tsc/src/flow/nodes/split_by_subflow.js +13 -5
  104. package/out-tsc/src/flow/nodes/split_by_subflow.js.map +1 -1
  105. package/out-tsc/src/flow/nodes/split_by_ticket.js +10 -3
  106. package/out-tsc/src/flow/nodes/split_by_ticket.js.map +1 -1
  107. package/out-tsc/src/flow/nodes/split_by_webhook.js +10 -3
  108. package/out-tsc/src/flow/nodes/split_by_webhook.js.map +1 -1
  109. package/out-tsc/src/flow/nodes/wait_for_digits.js +3 -2
  110. package/out-tsc/src/flow/nodes/wait_for_digits.js.map +1 -1
  111. package/out-tsc/src/flow/nodes/wait_for_menu.js +3 -2
  112. package/out-tsc/src/flow/nodes/wait_for_menu.js.map +1 -1
  113. package/out-tsc/src/flow/nodes/wait_for_response.js +38 -568
  114. package/out-tsc/src/flow/nodes/wait_for_response.js.map +1 -1
  115. package/out-tsc/src/flow/types.js +86 -12
  116. package/out-tsc/src/flow/types.js.map +1 -1
  117. package/out-tsc/src/flow/utils.js +101 -14
  118. package/out-tsc/src/flow/utils.js.map +1 -1
  119. package/out-tsc/src/form/FieldRenderer.js +2 -4
  120. package/out-tsc/src/form/FieldRenderer.js.map +1 -1
  121. package/out-tsc/src/interfaces.js +3 -0
  122. package/out-tsc/src/interfaces.js.map +1 -1
  123. package/out-tsc/src/layout/FloatingWindow.js +346 -0
  124. package/out-tsc/src/layout/FloatingWindow.js.map +1 -0
  125. package/out-tsc/src/list/SortableList.js +98 -33
  126. package/out-tsc/src/list/SortableList.js.map +1 -1
  127. package/out-tsc/src/live/ContactChat.js +6 -25
  128. package/out-tsc/src/live/ContactChat.js.map +1 -1
  129. package/out-tsc/src/locales/es.js +5 -5
  130. package/out-tsc/src/locales/es.js.map +1 -1
  131. package/out-tsc/src/locales/fr.js +5 -5
  132. package/out-tsc/src/locales/fr.js.map +1 -1
  133. package/out-tsc/src/locales/locale-codes.js +11 -2
  134. package/out-tsc/src/locales/locale-codes.js.map +1 -1
  135. package/out-tsc/src/locales/pt.js +5 -5
  136. package/out-tsc/src/locales/pt.js.map +1 -1
  137. package/out-tsc/src/store/AppState.js +120 -0
  138. package/out-tsc/src/store/AppState.js.map +1 -1
  139. package/out-tsc/src/utils.js +254 -13
  140. package/out-tsc/src/utils.js.map +1 -1
  141. package/out-tsc/temba-modules.js +8 -0
  142. package/out-tsc/temba-modules.js.map +1 -1
  143. package/out-tsc/test/ActionHelper.js +3 -3
  144. package/out-tsc/test/ActionHelper.js.map +1 -1
  145. package/out-tsc/test/NodeHelper.js +6 -3
  146. package/out-tsc/test/NodeHelper.js.map +1 -1
  147. package/out-tsc/test/actions/add_contact_urn.test.js +202 -0
  148. package/out-tsc/test/actions/add_contact_urn.test.js.map +1 -0
  149. package/out-tsc/test/actions/send_broadcast.test.js +148 -0
  150. package/out-tsc/test/actions/send_broadcast.test.js.map +1 -0
  151. package/out-tsc/test/actions/send_email.test.js +17 -23
  152. package/out-tsc/test/actions/send_email.test.js.map +1 -1
  153. package/out-tsc/test/actions/send_msg.test.js +33 -15
  154. package/out-tsc/test/actions/send_msg.test.js.map +1 -1
  155. package/out-tsc/test/actions/start_session.test.js +116 -0
  156. package/out-tsc/test/actions/start_session.test.js.map +1 -0
  157. package/out-tsc/test/nodes/split_by_airtime.test.js +604 -0
  158. package/out-tsc/test/nodes/split_by_airtime.test.js.map +1 -0
  159. package/out-tsc/test/nodes/split_by_contact_field.test.js +387 -0
  160. package/out-tsc/test/nodes/split_by_contact_field.test.js.map +1 -0
  161. package/out-tsc/test/nodes/split_by_expression.test.js +614 -0
  162. package/out-tsc/test/nodes/split_by_expression.test.js.map +1 -0
  163. package/out-tsc/test/nodes/split_by_random.test.js +3 -3
  164. package/out-tsc/test/nodes/split_by_random.test.js.map +1 -1
  165. package/out-tsc/test/nodes/split_by_resthook.test.js +337 -0
  166. package/out-tsc/test/nodes/split_by_resthook.test.js.map +1 -0
  167. package/out-tsc/test/nodes/split_by_run_result.test.js +920 -0
  168. package/out-tsc/test/nodes/split_by_run_result.test.js.map +1 -0
  169. package/out-tsc/test/nodes/split_by_scheme.test.js +399 -0
  170. package/out-tsc/test/nodes/split_by_scheme.test.js.map +1 -0
  171. package/out-tsc/test/nodes/split_by_subflow.test.js +333 -0
  172. package/out-tsc/test/nodes/split_by_subflow.test.js.map +1 -0
  173. package/out-tsc/test/nodes/wait_for_digits.test.js +2 -2
  174. package/out-tsc/test/nodes/wait_for_digits.test.js.map +1 -1
  175. package/out-tsc/test/nodes/wait_for_response.test.js +2 -1
  176. package/out-tsc/test/nodes/wait_for_response.test.js.map +1 -1
  177. package/out-tsc/test/temba-action-drag-between-nodes.test.js +252 -0
  178. package/out-tsc/test/temba-action-drag-between-nodes.test.js.map +1 -0
  179. package/out-tsc/test/temba-canvas-menu.test.js +122 -0
  180. package/out-tsc/test/temba-canvas-menu.test.js.map +1 -0
  181. package/out-tsc/test/temba-floating-tab.test.js +91 -0
  182. package/out-tsc/test/temba-floating-tab.test.js.map +1 -0
  183. package/out-tsc/test/temba-floating-window.test.js +301 -0
  184. package/out-tsc/test/temba-floating-window.test.js.map +1 -0
  185. package/out-tsc/test/temba-flow-editor-node.test.js +202 -2
  186. package/out-tsc/test/temba-flow-editor-node.test.js.map +1 -1
  187. package/out-tsc/test/temba-flow-editor.test.js +7 -8
  188. package/out-tsc/test/temba-flow-editor.test.js.map +1 -1
  189. package/out-tsc/test/temba-localization.test.js +471 -0
  190. package/out-tsc/test/temba-localization.test.js.map +1 -0
  191. package/out-tsc/test/temba-node-editor.test.js +3 -1
  192. package/out-tsc/test/temba-node-editor.test.js.map +1 -1
  193. package/out-tsc/test/temba-node-type-selector.test.js +265 -0
  194. package/out-tsc/test/temba-node-type-selector.test.js.map +1 -0
  195. package/out-tsc/test/temba-omnibox.test.js +2 -1
  196. package/out-tsc/test/temba-omnibox.test.js.map +1 -1
  197. package/out-tsc/test/temba-sortable-list.test.js +51 -0
  198. package/out-tsc/test/temba-sortable-list.test.js.map +1 -1
  199. package/out-tsc/test/temba-utils-index.test.js +1 -27
  200. package/out-tsc/test/temba-utils-index.test.js.map +1 -1
  201. package/out-tsc/test/utils.test.js +20 -0
  202. package/out-tsc/test/utils.test.js.map +1 -1
  203. package/package.json +2 -1
  204. package/screenshots/truth/actions/add_contact_groups/editor/descriptive-group-names.png +0 -0
  205. package/screenshots/truth/actions/add_contact_groups/editor/long-group-names.png +0 -0
  206. package/screenshots/truth/actions/add_contact_groups/editor/many-groups.png +0 -0
  207. package/screenshots/truth/actions/add_contact_groups/editor/multiple-groups.png +0 -0
  208. package/screenshots/truth/actions/add_contact_groups/editor/single-group.png +0 -0
  209. package/screenshots/truth/actions/add_contact_groups/render/descriptive-group-names.png +0 -0
  210. package/screenshots/truth/actions/add_contact_groups/render/long-group-names.png +0 -0
  211. package/screenshots/truth/actions/add_contact_groups/render/many-groups.png +0 -0
  212. package/screenshots/truth/actions/add_contact_groups/render/multiple-groups.png +0 -0
  213. package/screenshots/truth/actions/add_contact_groups/render/single-group.png +0 -0
  214. package/screenshots/truth/actions/add_contact_urn/editor/expression-facebook.png +0 -0
  215. package/screenshots/truth/actions/add_contact_urn/editor/expression-phone.png +0 -0
  216. package/screenshots/truth/actions/add_contact_urn/editor/facebook-id.png +0 -0
  217. package/screenshots/truth/actions/add_contact_urn/editor/instagram-handle.png +0 -0
  218. package/screenshots/truth/actions/add_contact_urn/editor/line-id.png +0 -0
  219. package/screenshots/truth/actions/add_contact_urn/editor/phone-number.png +0 -0
  220. package/screenshots/truth/actions/add_contact_urn/editor/telegram-id.png +0 -0
  221. package/screenshots/truth/actions/add_contact_urn/editor/viber-id.png +0 -0
  222. package/screenshots/truth/actions/add_contact_urn/editor/wechat-id.png +0 -0
  223. package/screenshots/truth/actions/add_contact_urn/editor/whatsapp.png +0 -0
  224. package/screenshots/truth/actions/add_contact_urn/render/expression-facebook.png +0 -0
  225. package/screenshots/truth/actions/add_contact_urn/render/expression-phone.png +0 -0
  226. package/screenshots/truth/actions/add_contact_urn/render/facebook-id.png +0 -0
  227. package/screenshots/truth/actions/add_contact_urn/render/instagram-handle.png +0 -0
  228. package/screenshots/truth/actions/add_contact_urn/render/line-id.png +0 -0
  229. package/screenshots/truth/actions/add_contact_urn/render/phone-number.png +0 -0
  230. package/screenshots/truth/actions/add_contact_urn/render/telegram-id.png +0 -0
  231. package/screenshots/truth/actions/add_contact_urn/render/viber-id.png +0 -0
  232. package/screenshots/truth/actions/add_contact_urn/render/wechat-id.png +0 -0
  233. package/screenshots/truth/actions/add_contact_urn/render/whatsapp.png +0 -0
  234. package/screenshots/truth/actions/remove_contact_groups/editor/cleanup-groups.png +0 -0
  235. package/screenshots/truth/actions/remove_contact_groups/editor/long-descriptive-group-names.png +0 -0
  236. package/screenshots/truth/actions/remove_contact_groups/editor/many-groups.png +0 -0
  237. package/screenshots/truth/actions/remove_contact_groups/editor/multiple-groups.png +0 -0
  238. package/screenshots/truth/actions/remove_contact_groups/editor/remove-from-all-groups.png +0 -0
  239. package/screenshots/truth/actions/remove_contact_groups/editor/single-group.png +0 -0
  240. package/screenshots/truth/actions/remove_contact_groups/render/cleanup-groups.png +0 -0
  241. package/screenshots/truth/actions/remove_contact_groups/render/long-descriptive-group-names.png +0 -0
  242. package/screenshots/truth/actions/remove_contact_groups/render/many-groups.png +0 -0
  243. package/screenshots/truth/actions/remove_contact_groups/render/multiple-groups.png +0 -0
  244. package/screenshots/truth/actions/remove_contact_groups/render/remove-from-all-groups.png +0 -0
  245. package/screenshots/truth/actions/remove_contact_groups/render/single-group.png +0 -0
  246. package/screenshots/truth/actions/send_broadcast/editor/contacts-only.png +0 -0
  247. package/screenshots/truth/actions/send_broadcast/editor/groups-and-contacts.png +0 -0
  248. package/screenshots/truth/actions/send_broadcast/editor/groups-only.png +0 -0
  249. package/screenshots/truth/actions/send_broadcast/editor/many-groups.png +0 -0
  250. package/screenshots/truth/actions/send_broadcast/editor/multiline-text.png +0 -0
  251. package/screenshots/truth/actions/send_broadcast/editor/with-attachments.png +0 -0
  252. package/screenshots/truth/actions/send_broadcast/render/contacts-only.png +0 -0
  253. package/screenshots/truth/actions/send_broadcast/render/groups-and-contacts.png +0 -0
  254. package/screenshots/truth/actions/send_broadcast/render/groups-only.png +0 -0
  255. package/screenshots/truth/actions/send_broadcast/render/many-groups.png +0 -0
  256. package/screenshots/truth/actions/send_broadcast/render/multiline-text.png +0 -0
  257. package/screenshots/truth/actions/send_broadcast/render/with-attachments.png +0 -0
  258. package/screenshots/truth/actions/send_email/editor/complex-business-email.png +0 -0
  259. package/screenshots/truth/actions/send_email/editor/empty-body.png +0 -0
  260. package/screenshots/truth/actions/send_email/editor/empty-subject.png +0 -0
  261. package/screenshots/truth/actions/send_email/editor/long-subject.png +0 -0
  262. package/screenshots/truth/actions/send_email/editor/multiline-body.png +0 -0
  263. package/screenshots/truth/actions/send_email/editor/multiple-recipients.png +0 -0
  264. package/screenshots/truth/actions/send_email/editor/simple-email.png +0 -0
  265. package/screenshots/truth/actions/send_email/editor/with-expressions.png +0 -0
  266. package/screenshots/truth/actions/send_email/render/complex-business-email.png +0 -0
  267. package/screenshots/truth/actions/send_email/render/empty-body.png +0 -0
  268. package/screenshots/truth/actions/send_email/render/empty-subject.png +0 -0
  269. package/screenshots/truth/actions/send_email/render/long-subject.png +0 -0
  270. package/screenshots/truth/actions/send_email/render/multiline-body.png +0 -0
  271. package/screenshots/truth/actions/send_email/render/multiple-recipients.png +0 -0
  272. package/screenshots/truth/actions/send_email/render/simple-email.png +0 -0
  273. package/screenshots/truth/actions/send_email/render/with-expressions.png +0 -0
  274. package/screenshots/truth/actions/send_msg/editor/long-quick-replies.png +0 -0
  275. package/screenshots/truth/actions/send_msg/editor/multiline-text-with-replies.png +0 -0
  276. package/screenshots/truth/actions/send_msg/editor/simple-text.png +0 -0
  277. package/screenshots/truth/actions/send_msg/editor/text-with-linebreaks.png +0 -0
  278. package/screenshots/truth/actions/send_msg/editor/text-with-many-quick-replies.png +0 -0
  279. package/screenshots/truth/actions/send_msg/editor/text-with-quick-replies.png +0 -0
  280. package/screenshots/truth/actions/send_msg/editor/text-without-quick-replies.png +0 -0
  281. package/screenshots/truth/actions/send_msg/render/long-quick-replies.png +0 -0
  282. package/screenshots/truth/actions/send_msg/render/multiline-text-with-replies.png +0 -0
  283. package/screenshots/truth/actions/send_msg/render/simple-text.png +0 -0
  284. package/screenshots/truth/actions/send_msg/render/text-with-linebreaks.png +0 -0
  285. package/screenshots/truth/actions/send_msg/render/text-with-many-quick-replies.png +0 -0
  286. package/screenshots/truth/actions/send_msg/render/text-with-quick-replies.png +0 -0
  287. package/screenshots/truth/actions/send_msg/render/text-without-quick-replies.png +0 -0
  288. package/screenshots/truth/actions/start_session/editor/contact-query.png +0 -0
  289. package/screenshots/truth/actions/start_session/editor/contacts-only.png +0 -0
  290. package/screenshots/truth/actions/start_session/editor/create-contact.png +0 -0
  291. package/screenshots/truth/actions/start_session/editor/groups-and-contacts.png +0 -0
  292. package/screenshots/truth/actions/start_session/editor/groups-only.png +0 -0
  293. package/screenshots/truth/actions/start_session/editor/many-recipients.png +0 -0
  294. package/screenshots/truth/actions/start_session/render/contact-query.png +0 -0
  295. package/screenshots/truth/actions/start_session/render/contacts-only.png +0 -0
  296. package/screenshots/truth/actions/start_session/render/create-contact.png +0 -0
  297. package/screenshots/truth/actions/start_session/render/groups-and-contacts.png +0 -0
  298. package/screenshots/truth/actions/start_session/render/groups-only.png +0 -0
  299. package/screenshots/truth/actions/start_session/render/many-recipients.png +0 -0
  300. package/screenshots/truth/canvas-menu/open.png +0 -0
  301. package/screenshots/truth/editor/router.png +0 -0
  302. package/screenshots/truth/editor/wait.png +0 -0
  303. package/screenshots/truth/floating-tab/default.png +0 -0
  304. package/screenshots/truth/floating-tab/gray.png +0 -0
  305. package/screenshots/truth/floating-tab/green.png +0 -0
  306. package/screenshots/truth/floating-tab/hidden.png +0 -0
  307. package/screenshots/truth/floating-tab/hover.png +0 -0
  308. package/screenshots/truth/floating-tab/purple.png +0 -0
  309. package/screenshots/truth/floating-window/chromeless.png +0 -0
  310. package/screenshots/truth/floating-window/custom-size.png +0 -0
  311. package/screenshots/truth/floating-window/default.png +0 -0
  312. package/screenshots/truth/floating-window/with-header.png +0 -0
  313. package/screenshots/truth/list/fields-dragging.png +0 -0
  314. package/screenshots/truth/list/sortable-dragging.png +0 -0
  315. package/screenshots/truth/node-type-selector/action-mode.png +0 -0
  316. package/screenshots/truth/node-type-selector/split-mode.png +0 -0
  317. package/screenshots/truth/nodes/split_by_llm/editor/information-extraction.png +0 -0
  318. package/screenshots/truth/nodes/split_by_llm/editor/sentiment-analysis.png +0 -0
  319. package/screenshots/truth/nodes/split_by_llm/editor/summarization.png +0 -0
  320. package/screenshots/truth/nodes/split_by_llm/editor/translation-task.png +0 -0
  321. package/screenshots/truth/nodes/split_by_llm/render/information-extraction.png +0 -0
  322. package/screenshots/truth/nodes/split_by_llm/render/sentiment-analysis.png +0 -0
  323. package/screenshots/truth/nodes/split_by_llm/render/summarization.png +0 -0
  324. package/screenshots/truth/nodes/split_by_llm/render/translation-task.png +0 -0
  325. package/screenshots/truth/nodes/split_by_llm_categorize/editor/basic-categorization.png +0 -0
  326. package/screenshots/truth/nodes/split_by_llm_categorize/editor/custom-input-and-result-name.png +0 -0
  327. package/screenshots/truth/nodes/split_by_llm_categorize/editor/feedback-categorization.png +0 -0
  328. package/screenshots/truth/nodes/split_by_llm_categorize/editor/many-categories.png +0 -0
  329. package/screenshots/truth/nodes/split_by_llm_categorize/editor/minimal-categories.png +0 -0
  330. package/screenshots/truth/nodes/split_by_llm_categorize/render/basic-categorization.png +0 -0
  331. package/screenshots/truth/nodes/split_by_llm_categorize/render/custom-input-and-result-name.png +0 -0
  332. package/screenshots/truth/nodes/split_by_llm_categorize/render/feedback-categorization.png +0 -0
  333. package/screenshots/truth/nodes/split_by_llm_categorize/render/many-categories.png +0 -0
  334. package/screenshots/truth/nodes/split_by_llm_categorize/render/minimal-categories.png +0 -0
  335. package/screenshots/truth/nodes/split_by_random/editor/ab-test-multiple-variants.png +0 -0
  336. package/screenshots/truth/nodes/split_by_random/editor/sampling-split.png +0 -0
  337. package/screenshots/truth/nodes/split_by_random/editor/three-way-split.png +0 -0
  338. package/screenshots/truth/nodes/split_by_random/editor/two-bucket-split.png +0 -0
  339. package/screenshots/truth/nodes/split_by_random/render/ab-test-multiple-variants.png +0 -0
  340. package/screenshots/truth/nodes/split_by_random/render/sampling-split.png +0 -0
  341. package/screenshots/truth/nodes/split_by_random/render/three-way-split.png +0 -0
  342. package/screenshots/truth/nodes/split_by_random/render/two-bucket-split.png +0 -0
  343. package/screenshots/truth/nodes/wait_for_digits/editor/basic-digits-wait.png +0 -0
  344. package/screenshots/truth/nodes/wait_for_digits/editor/phone-number-collection.png +0 -0
  345. package/screenshots/truth/nodes/wait_for_digits/editor/single-digit-with-timeout.png +0 -0
  346. package/screenshots/truth/nodes/wait_for_digits/editor/verification-code.png +0 -0
  347. package/screenshots/truth/nodes/wait_for_digits/render/basic-digits-wait.png +0 -0
  348. package/screenshots/truth/nodes/wait_for_digits/render/phone-number-collection.png +0 -0
  349. package/screenshots/truth/nodes/wait_for_digits/render/single-digit-with-timeout.png +0 -0
  350. package/screenshots/truth/nodes/wait_for_digits/render/verification-code.png +0 -0
  351. package/screenshots/truth/nodes/wait_for_response/editor/basic-wait.png +0 -0
  352. package/screenshots/truth/nodes/wait_for_response/editor/custom-result-name.png +0 -0
  353. package/screenshots/truth/nodes/wait_for_response/editor/no-timeout.png +0 -0
  354. package/screenshots/truth/nodes/wait_for_response/editor/short-timeout.png +0 -0
  355. package/screenshots/truth/nodes/wait_for_response/render/basic-wait.png +0 -0
  356. package/screenshots/truth/nodes/wait_for_response/render/custom-result-name.png +0 -0
  357. package/screenshots/truth/nodes/wait_for_response/render/no-timeout.png +0 -0
  358. package/screenshots/truth/nodes/wait_for_response/render/short-timeout.png +0 -0
  359. package/src/Icons.ts +4 -1
  360. package/src/display/FloatingTab.ts +174 -0
  361. package/src/display/ProgressBar.ts +22 -2
  362. package/src/events.ts +2 -8
  363. package/src/flow/CanvasMenu.ts +217 -0
  364. package/src/flow/CanvasNode.ts +596 -40
  365. package/src/flow/Editor.ts +1721 -45
  366. package/src/flow/NodeEditor.ts +621 -144
  367. package/src/flow/NodeTypeSelector.ts +636 -0
  368. package/src/flow/StickyNote.ts +12 -3
  369. package/src/flow/actions/add_contact_groups.ts +5 -4
  370. package/src/flow/actions/add_contact_urn.ts +78 -4
  371. package/src/flow/actions/add_input_labels.ts +5 -4
  372. package/src/flow/actions/play_audio.ts +3 -2
  373. package/src/flow/actions/remove_contact_groups.ts +16 -6
  374. package/src/flow/actions/request_optin.ts +3 -2
  375. package/src/flow/actions/say_msg.ts +3 -2
  376. package/src/flow/actions/send_broadcast.ts +86 -23
  377. package/src/flow/actions/send_email.ts +12 -6
  378. package/src/flow/actions/send_msg.ts +155 -34
  379. package/src/flow/actions/set_contact_channel.ts +6 -11
  380. package/src/flow/actions/set_contact_field.ts +21 -25
  381. package/src/flow/actions/set_contact_language.ts +11 -4
  382. package/src/flow/actions/set_contact_name.ts +4 -15
  383. package/src/flow/actions/set_contact_status.ts +4 -3
  384. package/src/flow/actions/set_run_result.ts +5 -4
  385. package/src/flow/actions/start_session.ts +210 -6
  386. package/src/flow/config.ts +11 -23
  387. package/src/flow/currencies.ts +51 -0
  388. package/src/flow/nodes/shared-rules.ts +301 -0
  389. package/src/flow/nodes/shared.ts +87 -0
  390. package/src/flow/nodes/split_by_airtime.ts +255 -5
  391. package/src/flow/nodes/split_by_contact_field.ts +195 -3
  392. package/src/flow/nodes/split_by_expression.ts +104 -2
  393. package/src/flow/nodes/split_by_groups.ts +26 -11
  394. package/src/flow/nodes/split_by_intent.ts +8 -0
  395. package/src/flow/nodes/split_by_llm.ts +22 -4
  396. package/src/flow/nodes/split_by_llm_categorize.ts +22 -5
  397. package/src/flow/nodes/split_by_random.ts +16 -6
  398. package/src/flow/nodes/split_by_resthook.ts +140 -0
  399. package/src/flow/nodes/split_by_run_result.ts +259 -3
  400. package/src/flow/nodes/split_by_scheme.ts +202 -2
  401. package/src/flow/nodes/split_by_subflow.ts +17 -5
  402. package/src/flow/nodes/split_by_ticket.ts +15 -4
  403. package/src/flow/nodes/split_by_webhook.ts +17 -6
  404. package/src/flow/nodes/wait_for_digits.ts +3 -2
  405. package/src/flow/nodes/wait_for_menu.ts +3 -2
  406. package/src/flow/nodes/wait_for_response.ts +59 -680
  407. package/src/flow/types.ts +156 -23
  408. package/src/flow/utils.ts +108 -14
  409. package/src/form/FieldRenderer.ts +2 -4
  410. package/src/interfaces.ts +3 -0
  411. package/src/layout/FloatingWindow.ts +386 -0
  412. package/src/list/SortableList.ts +109 -34
  413. package/src/live/ContactChat.ts +7 -25
  414. package/src/locales/es.ts +18 -13
  415. package/src/locales/fr.ts +18 -13
  416. package/src/locales/locale-codes.ts +11 -2
  417. package/src/locales/pt.ts +18 -13
  418. package/src/store/AppState.ts +173 -0
  419. package/src/store/flow-definition.d.ts +2 -5
  420. package/src/utils.ts +332 -12
  421. package/static/api/channels.json +46 -0
  422. package/static/api/llms.json +18 -0
  423. package/static/api/resthooks.json +31 -0
  424. package/static/svg/index.svg +1 -1
  425. package/static/svg/work/traced/lightning-02.svg +1 -0
  426. package/static/svg/work/used/lightning-02.svg +3 -0
  427. package/temba-modules.ts +8 -0
  428. package/test/ActionHelper.ts +3 -3
  429. package/test/NodeHelper.ts +6 -3
  430. package/test/actions/add_contact_urn.test.ts +287 -0
  431. package/test/actions/send_broadcast.test.ts +190 -0
  432. package/test/actions/send_email.test.ts +17 -23
  433. package/test/actions/send_msg.test.ts +39 -15
  434. package/test/actions/start_session.test.ts +151 -0
  435. package/test/nodes/split_by_airtime.test.ts +673 -0
  436. package/test/nodes/split_by_contact_field.test.ts +451 -0
  437. package/test/nodes/split_by_expression.test.ts +751 -0
  438. package/test/nodes/split_by_random.test.ts +3 -3
  439. package/test/nodes/split_by_resthook.test.ts +398 -0
  440. package/test/nodes/split_by_run_result.test.ts +1109 -0
  441. package/test/nodes/split_by_scheme.test.ts +486 -0
  442. package/test/nodes/split_by_subflow.test.ts +381 -0
  443. package/test/nodes/wait_for_digits.test.ts +2 -2
  444. package/test/nodes/wait_for_response.test.ts +2 -1
  445. package/test/temba-action-drag-between-nodes.test.ts +301 -0
  446. package/test/temba-canvas-menu.test.ts +156 -0
  447. package/test/temba-floating-tab.test.ts +110 -0
  448. package/test/temba-floating-window.test.ts +477 -0
  449. package/test/temba-flow-editor-node.test.ts +246 -2
  450. package/test/temba-flow-editor.test.ts +7 -8
  451. package/test/temba-localization.test.ts +611 -0
  452. package/test/temba-node-editor.test.ts +3 -1
  453. package/test/temba-node-type-selector.test.ts +355 -0
  454. package/test/temba-omnibox.test.ts +2 -1
  455. package/test/temba-sortable-list.test.ts +69 -0
  456. package/test/temba-utils-index.test.ts +0 -35
  457. package/test/utils.test.ts +22 -0
  458. package/test-assets/contacts/history.json +14 -21
  459. package/test-assets/select/llms.json +2 -2
  460. package/web-dev-server.config.mjs +49 -1
  461. package/web-test-runner.config.mjs +0 -1
  462. package/out-tsc/src/flow/actions/call_classifier.js +0 -11
  463. package/out-tsc/src/flow/actions/call_classifier.js.map +0 -1
  464. package/out-tsc/src/flow/actions/call_resthook.js +0 -11
  465. package/out-tsc/src/flow/actions/call_resthook.js.map +0 -1
  466. package/out-tsc/src/flow/actions/split_by_expression_example.js +0 -77
  467. package/out-tsc/src/flow/actions/split_by_expression_example.js.map +0 -1
  468. package/out-tsc/src/flow/actions/transfer_airtime.js +0 -11
  469. package/out-tsc/src/flow/actions/transfer_airtime.js.map +0 -1
  470. package/out-tsc/src/flow/nodes/wait_for_audio.js +0 -7
  471. package/out-tsc/src/flow/nodes/wait_for_audio.js.map +0 -1
  472. package/out-tsc/src/flow/nodes/wait_for_image.js +0 -7
  473. package/out-tsc/src/flow/nodes/wait_for_image.js.map +0 -1
  474. package/out-tsc/src/flow/nodes/wait_for_location.js +0 -7
  475. package/out-tsc/src/flow/nodes/wait_for_location.js.map +0 -1
  476. package/out-tsc/src/flow/nodes/wait_for_video.js +0 -7
  477. package/out-tsc/src/flow/nodes/wait_for_video.js.map +0 -1
  478. package/src/flow/actions/call_classifier.ts +0 -12
  479. package/src/flow/actions/call_resthook.ts +0 -12
  480. package/src/flow/actions/split_by_expression_example.ts +0 -88
  481. package/src/flow/actions/transfer_airtime.ts +0 -12
  482. package/src/flow/nodes/wait_for_audio.ts +0 -7
  483. package/src/flow/nodes/wait_for_image.ts +0 -7
  484. package/src/flow/nodes/wait_for_location.ts +0 -7
  485. package/src/flow/nodes/wait_for_video.ts +0 -7
@@ -1,11 +1,186 @@
1
1
  import { html } from 'lit-html';
2
- import { COLORS } from '../types';
2
+ import { ACTION_GROUPS, FlowTypes } 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
+ flowTypes: [FlowTypes.VOICE, FlowTypes.MESSAGE, FlowTypes.BACKGROUND],
8
+ render: (_node, action) => {
9
+ const hasGroups = action.groups && action.groups.length > 0;
10
+ const hasContacts = action.contacts && action.contacts.length > 0;
11
+ const hasRecipients = hasGroups || hasContacts;
12
+ // Build the recipients display
13
+ let recipientsDisplay = html ``;
14
+ if (action.create_contact) {
15
+ recipientsDisplay = html `Create a new contact`;
16
+ }
17
+ else if (action.contact_query) {
18
+ recipientsDisplay = html `${action.contact_query}`;
19
+ }
20
+ else if (hasRecipients) {
21
+ const allRecipients = [
22
+ ...(action.contacts || []),
23
+ ...(action.groups || [])
24
+ ];
25
+ recipientsDisplay = html `${renderNamedObjects(allRecipients, hasGroups ? 'group' : 'contact')}`;
26
+ }
27
+ return html `
28
+ <div>
29
+ <div
30
+ style="padding: 3px 10px; background: #f5f5f5; padding-bottom: 0px; font-size: 11px; border-radius: var(--curvature); margin-bottom: 10px;"
31
+ >
32
+ ${recipientsDisplay}
33
+ </div>
34
+ <div style="padding: 0px 10px;">
35
+ ${renderNamedObjects([action.flow], 'flow')}
36
+ </div>
37
+ </div>
38
+ `;
39
+ },
40
+ toFormData: (action) => {
41
+ var _a;
42
+ const extendedAction = action;
43
+ // Determine start type based on action properties
44
+ let startTypeValue = 'manual';
45
+ if (action.create_contact) {
46
+ startTypeValue = 'create';
47
+ }
48
+ else if (extendedAction.contact_query) {
49
+ startTypeValue = 'query';
50
+ }
51
+ // Map value to full option object for proper display
52
+ const startTypeOptions = [
53
+ { value: 'manual', name: 'Select recipients manually' },
54
+ { value: 'query', name: 'Select a contact with a query' },
55
+ { value: 'create', name: 'Create a new contact' }
56
+ ];
57
+ const startType = startTypeOptions.find((opt) => opt.value === startTypeValue) ||
58
+ startTypeOptions[0];
59
+ return {
60
+ flow: action.flow ? [action.flow] : null,
61
+ recipients: [...(action.contacts || []), ...(action.groups || [])],
62
+ startType: [startType],
63
+ contactQuery: extendedAction.contact_query || '',
64
+ skipContactsInFlow: ((_a = extendedAction.exclusions) === null || _a === void 0 ? void 0 : _a.in_a_flow) || false,
65
+ uuid: action.uuid
66
+ };
67
+ },
68
+ form: {
69
+ flow: {
70
+ type: 'select',
71
+ label: 'Flow',
72
+ helpText: 'Select the flow to start',
73
+ required: true,
74
+ searchable: true,
75
+ endpoint: '/api/v2/flows.json',
76
+ valueKey: 'uuid',
77
+ nameKey: 'name',
78
+ placeholder: 'Select a flow...'
79
+ },
80
+ startType: {
81
+ type: 'select',
82
+ label: 'Start Type',
83
+ helpText: 'How should contacts be selected?',
84
+ required: true,
85
+ options: [
86
+ { value: 'manual', name: 'Select recipients manually' },
87
+ { value: 'query', name: 'Select a contact with a query' },
88
+ { value: 'create', name: 'Create a new contact' }
89
+ ]
90
+ },
91
+ recipients: {
92
+ type: 'select',
93
+ label: 'Recipients',
94
+ helpText: 'Select who should be started in the flow',
95
+ options: [],
96
+ multi: true,
97
+ searchable: true,
98
+ endpoint: '/api/v2/contacts.json',
99
+ valueKey: 'uuid',
100
+ nameKey: 'name',
101
+ placeholder: 'Search for contacts or groups...',
102
+ conditions: {
103
+ visible: (formData) => {
104
+ var _a, _b;
105
+ const startType = (_b = (_a = formData.startType) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.value;
106
+ return startType === 'manual';
107
+ }
108
+ }
109
+ },
110
+ contactQuery: {
111
+ type: 'text',
112
+ evaluated: true,
113
+ label: 'Contact Query',
114
+ helpText: 'Only one matching contact will be started',
115
+ placeholder: 'household_id = @fields.household_id',
116
+ conditions: {
117
+ visible: (formData) => {
118
+ var _a, _b;
119
+ const startType = (_b = (_a = formData.startType) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.value;
120
+ return startType === 'query';
121
+ }
122
+ }
123
+ },
124
+ skipContactsInFlow: {
125
+ type: 'checkbox',
126
+ label: 'Skip contacts currently in a flow',
127
+ helpText: 'Avoid interrupting a contact who is already in a flow'
128
+ }
129
+ },
130
+ layout: [
131
+ 'flow',
132
+ 'startType',
133
+ 'recipients',
134
+ 'contactQuery',
135
+ 'skipContactsInFlow'
136
+ ],
137
+ validate: (formData) => {
138
+ var _a, _b;
139
+ const errors = {};
140
+ const startType = (_b = (_a = formData.startType) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.value;
141
+ // Check if manual selection has recipients
142
+ if (startType === 'manual' &&
143
+ (!formData.recipients || formData.recipients.length === 0)) {
144
+ errors.recipients = 'At least one contact or group must be selected';
145
+ }
146
+ // Check if query has a query string
147
+ if (startType === 'query' &&
148
+ (!formData.contactQuery || !formData.contactQuery.trim())) {
149
+ errors.contactQuery = 'Contact query is required';
150
+ }
151
+ return {
152
+ valid: Object.keys(errors).length === 0,
153
+ errors
154
+ };
155
+ },
156
+ fromFormData: (formData) => {
157
+ const action = {
158
+ uuid: formData.uuid,
159
+ type: 'start_session',
160
+ flow: formData.flow[0],
161
+ groups: [],
162
+ contacts: []
163
+ };
164
+ // Get the start type value from array
165
+ const startTypeValue = formData.startType[0].value;
166
+ // Handle different start types
167
+ if (startTypeValue === 'create') {
168
+ action.create_contact = true;
169
+ }
170
+ else if (startTypeValue === 'query') {
171
+ action.contact_query = formData.contactQuery || '';
172
+ }
173
+ else {
174
+ // Manual selection - separate contacts and groups
175
+ const recipients = formData.recipients || [];
176
+ action.contacts = recipients.filter((r) => !r.group);
177
+ action.groups = recipients.filter((r) => r.group);
178
+ }
179
+ // Add exclusions if set
180
+ if (formData.skipContactsInFlow) {
181
+ action.exclusions = { in_a_flow: true };
182
+ }
183
+ return action;
9
184
  }
10
185
  };
11
186
  //# 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>`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import {\n ActionConfig,\n ACTION_GROUPS,\n FormData,\n ValidationResult,\n FlowTypes\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 flowTypes: [FlowTypes.VOICE, FlowTypes.MESSAGE, FlowTypes.BACKGROUND],\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,40 +30,33 @@ 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
- import { wait_for_audio } from './nodes/wait_for_audio';
39
36
  import { wait_for_digits } from './nodes/wait_for_digits';
40
- import { wait_for_image } from './nodes/wait_for_image';
41
- import { wait_for_location } from './nodes/wait_for_location';
42
37
  import { wait_for_menu } from './nodes/wait_for_menu';
43
38
  import { wait_for_response } from './nodes/wait_for_response';
44
- import { wait_for_video } from './nodes/wait_for_video';
45
39
  export const ACTION_CONFIG = {
46
- add_input_labels,
47
- add_contact_urn,
40
+ say_msg,
41
+ play_audio,
48
42
  set_contact_field,
49
- set_contact_channel,
50
- set_contact_language,
51
- set_contact_status,
52
43
  send_broadcast,
53
44
  set_run_result,
54
45
  send_msg,
55
46
  send_email,
56
47
  start_session,
57
- call_classifier,
58
- call_resthook,
59
- transfer_airtime,
60
48
  set_contact_name,
61
49
  add_contact_groups,
62
50
  remove_contact_groups,
63
- request_optin,
64
- say_msg,
65
- play_audio
51
+ set_contact_channel,
52
+ set_contact_language,
53
+ set_contact_status,
54
+ add_contact_urn,
55
+ add_input_labels,
56
+ request_optin
66
57
  };
67
58
  export const NODE_CONFIG = {
68
59
  execute_actions,
69
- split_by_airtime,
70
60
  split_by_contact_field,
71
61
  split_by_expression,
72
62
  split_by_groups,
@@ -78,12 +68,10 @@ export const NODE_CONFIG = {
78
68
  split_by_subflow,
79
69
  split_by_ticket,
80
70
  split_by_webhook,
81
- wait_for_audio,
71
+ split_by_resthook,
82
72
  wait_for_digits,
83
- wait_for_image,
84
- wait_for_location,
85
73
  wait_for_menu,
86
74
  wait_for_response,
87
- wait_for_video
75
+ split_by_airtime
88
76
  };
89
77
  //# sourceMappingURL=config.js.map
@@ -1 +1 @@
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,CAA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AAiB;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,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,UAAU,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BAAuB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAE9D,MAAM,CAAC,MAAM,aAAa,GAEtB;IACF,OAAO;IACP,UAAU;IACV,iBAAiB;IACjB,cAAc;IACd,cAAc;IACd,QAAQ;IACR,UAAU;IACV,aAAa;IACb,gBAAgB;IAChB,kBAAkB;IAClB,qBAAqB;IACrB,mBAAmB;IACnB,oBAAoB;IACpB,kBAAkB;IAClB,eAAe;IACf,gBAAgB;IAChB,aAAa;CACd,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAEpB;IACF,eAAe;IACf,sBAAsB;IACtB,mBAAmB;IACnB,eAAe;IACf,YAAY;IACZ,uBAAuB;IACvB,eAAe;IACf,mBAAmB;IACnB,eAAe;IACf,gBAAgB;IAChB,eAAe;IACf,gBAAgB;IAChB,iBAAiB;IACjB,eAAe;IACf,aAAa;IACb,iBAAiB;IACjB,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_digits } from './nodes/wait_for_digits';\nimport { wait_for_menu } from './nodes/wait_for_menu';\nimport { wait_for_response } from './nodes/wait_for_response';\n\nexport const ACTION_CONFIG: {\n [key: string]: ActionConfig;\n} = {\n say_msg,\n play_audio,\n set_contact_field,\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 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 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_digits,\n wait_for_menu,\n wait_for_response,\n split_by_airtime\n};\n"]}
@@ -0,0 +1,45 @@
1
+ // Currency definitions for airtime transfers
2
+ // Based on the original React implementation
3
+ export const CURRENCIES = {
4
+ ARS: { code: 'ARS', name: 'Argentine Peso' },
5
+ AUD: { code: 'AUD', name: 'Australian Dollar' },
6
+ BIF: { code: 'BIF', name: 'Burundi Franc' },
7
+ BRL: { code: 'BRL', name: 'Brazilian Real' },
8
+ CAD: { code: 'CAD', name: 'Canadian Dollar' },
9
+ CDF: { code: 'CDF', name: 'Congolese Franc' },
10
+ CLP: { code: 'CLP', name: 'Chilean Peso' },
11
+ COP: { code: 'COP', name: 'Colombian Peso' },
12
+ DJF: { code: 'DJF', name: 'Djibouti Franc' },
13
+ DOP: { code: 'DOP', name: 'Dominican Peso' },
14
+ DZD: { code: 'DZD', name: 'Algerian Dinar' },
15
+ EUR: { code: 'EUR', name: 'Euro' },
16
+ GBP: { code: 'GBP', name: 'Pound Sterling' },
17
+ GHS: { code: 'GHS', name: 'Ghana Cedi' },
18
+ GNF: { code: 'GNF', name: 'Guinean Franc' },
19
+ KES: { code: 'KES', name: 'Kenyan Shilling' },
20
+ LBP: { code: 'LBP', name: 'Lebanese Pound' },
21
+ LKR: { code: 'LKR', name: 'Sri Lanka Rupee' },
22
+ LRD: { code: 'LRD', name: 'Liberian Dollar' },
23
+ MWK: { code: 'MWK', name: 'Malawian Kwacha' },
24
+ MXN: { code: 'MXN', name: 'Mexican Peso' },
25
+ MZN: { code: 'MZN', name: 'Mozambican Metical' },
26
+ NAD: { code: 'NAD', name: 'Namibian Dollar' },
27
+ NGN: { code: 'NGN', name: 'Nigerian Naira' },
28
+ PEN: { code: 'PEN', name: 'Peruvian Sol' },
29
+ PHP: { code: 'PHP', name: 'Philippine Peso' },
30
+ RWF: { code: 'RWF', name: 'Rwandan Franc' },
31
+ SZL: { code: 'SZL', name: 'Swazi Lilangeni' },
32
+ TZS: { code: 'TZS', name: 'Tanzanian Shilling' },
33
+ UGX: { code: 'UGX', name: 'Ugandan Shilling' },
34
+ USD: { code: 'USD', name: 'US Dollar' },
35
+ XAF: { code: 'XAF', name: 'Central African CFA Franc' },
36
+ XOF: { code: 'XOF', name: 'West African CFA Franc' },
37
+ ZAR: { code: 'ZAR', name: 'South African Rand' },
38
+ ZMW: { code: 'ZMW', name: 'Zambian Kwacha' }
39
+ };
40
+ // Convert currencies to select options format
41
+ export const CURRENCY_OPTIONS = Object.values(CURRENCIES).map((currency) => ({
42
+ value: currency.code,
43
+ name: `${currency.name} (${currency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AE,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE;IACvC,GAAG,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,2BAA2B,EAAE;IACvD,GAAG,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,wBAAwB,EAAE;IACpD,GAAG,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,oBAAoB,EAAE;IAChD,GAAG,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,gBAAgB,EAAE;CAC7C,CAAC;AAEF,8CAA8C;AAC9C,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;IAC3E,KAAK,EAAE,QAAQ,CAAC,IAAI;IACpB,IAAI,EAAE,GAAG,QAAQ,CAAC,IAAI,KAAK,QAAQ,CAAC,IAAI,GAAG;CAC5C,CAAC,CAAC,CAAC","sourcesContent":["// Currency definitions for airtime transfers\n// Based on the original React implementation\n\nexport interface Currency {\n code: string;\n name: string;\n}\n\nexport const CURRENCIES: Record<string, Currency> = {\n ARS: { code: 'ARS', name: 'Argentine Peso' },\n AUD: { code: 'AUD', name: 'Australian Dollar' },\n BIF: { code: 'BIF', name: 'Burundi Franc' },\n BRL: { code: 'BRL', name: 'Brazilian Real' },\n CAD: { code: 'CAD', name: 'Canadian Dollar' },\n CDF: { code: 'CDF', name: 'Congolese Franc' },\n CLP: { code: 'CLP', name: 'Chilean Peso' },\n COP: { code: 'COP', name: 'Colombian Peso' },\n DJF: { code: 'DJF', name: 'Djibouti Franc' },\n DOP: { code: 'DOP', name: 'Dominican Peso' },\n DZD: { code: 'DZD', name: 'Algerian Dinar' },\n EUR: { code: 'EUR', name: 'Euro' },\n GBP: { code: 'GBP', name: 'Pound Sterling' },\n GHS: { code: 'GHS', name: 'Ghana Cedi' },\n GNF: { code: 'GNF', name: 'Guinean Franc' },\n KES: { code: 'KES', name: 'Kenyan Shilling' },\n LBP: { code: 'LBP', name: 'Lebanese Pound' },\n LKR: { code: 'LKR', name: 'Sri Lanka Rupee' },\n LRD: { code: 'LRD', name: 'Liberian Dollar' },\n MWK: { code: 'MWK', name: 'Malawian Kwacha' },\n MXN: { code: 'MXN', name: 'Mexican Peso' },\n MZN: { code: 'MZN', name: 'Mozambican Metical' },\n NAD: { code: 'NAD', name: 'Namibian Dollar' },\n NGN: { code: 'NGN', name: 'Nigerian Naira' },\n PEN: { code: 'PEN', name: 'Peruvian Sol' },\n PHP: { code: 'PHP', name: 'Philippine Peso' },\n RWF: { code: 'RWF', name: 'Rwandan Franc' },\n SZL: { code: 'SZL', name: 'Swazi Lilangeni' },\n TZS: { code: 'TZS', name: 'Tanzanian Shilling' },\n UGX: { code: 'UGX', name: 'Ugandan Shilling' },\n USD: { code: 'USD', name: 'US Dollar' },\n XAF: { code: 'XAF', name: 'Central African CFA Franc' },\n XOF: { code: 'XOF', name: 'West African CFA Franc' },\n ZAR: { code: 'ZAR', name: 'South African Rand' },\n ZMW: { code: 'ZMW', name: 'Zambian Kwacha' }\n};\n\n// Convert currencies to select options format\nexport const CURRENCY_OPTIONS = Object.values(CURRENCIES).map((currency) => ({\n value: currency.code,\n name: `${currency.name} (${currency.code})`\n}));\n"]}
@@ -0,0 +1,257 @@
1
+ import { getOperatorConfig } from '../operators';
2
+ import { generateDefaultCategoryName } from '../../utils';
3
+ /**
4
+ * Shared helper function to get operator value from various formats.
5
+ * Handles string, object, and array formats that can come from the form system.
6
+ */
7
+ export const getOperatorValue = (operator) => {
8
+ if (typeof operator === 'string') {
9
+ return operator.trim();
10
+ }
11
+ else if (Array.isArray(operator) && operator.length > 0) {
12
+ const firstOperator = operator[0];
13
+ if (firstOperator &&
14
+ typeof firstOperator === 'object' &&
15
+ firstOperator.value) {
16
+ return firstOperator.value.trim();
17
+ }
18
+ }
19
+ else if (operator && typeof operator === 'object' && operator.value) {
20
+ return operator.value.trim();
21
+ }
22
+ return '';
23
+ };
24
+ /**
25
+ * Shared isEmptyItem function for rules array.
26
+ * Determines if a rule item is considered empty and should be filtered out.
27
+ */
28
+ export const isEmptyRuleItem = (item) => {
29
+ // Check if operator and category are provided
30
+ const operatorValue = getOperatorValue(item.operator);
31
+ if (!operatorValue || !item.category || item.category.trim() === '') {
32
+ return true;
33
+ }
34
+ // Check if value is required based on operator configuration
35
+ const operatorConfig = getOperatorConfig(operatorValue);
36
+ if (operatorConfig && operatorConfig.operands === 1) {
37
+ return !item.value1 || item.value1.trim() === '';
38
+ }
39
+ else if (operatorConfig && operatorConfig.operands === 2) {
40
+ return (!item.value1 ||
41
+ item.value1.trim() === '' ||
42
+ !item.value2 ||
43
+ item.value2.trim() === '');
44
+ }
45
+ return false;
46
+ };
47
+ /**
48
+ * Shared onItemChange function for rules array.
49
+ * Handles auto-updating category names based on operator and value changes.
50
+ */
51
+ export const createRuleItemChangeHandler = () => {
52
+ return (itemIndex, field, value, allItems) => {
53
+ const updatedItems = [...allItems];
54
+ const item = { ...updatedItems[itemIndex] };
55
+ // Update the changed field
56
+ item[field] = value;
57
+ // Get operator values (before and after the change)
58
+ const oldItem = allItems[itemIndex] || {};
59
+ const oldOperatorValue = field === 'operator'
60
+ ? getOperatorValue(oldItem.operator)
61
+ : getOperatorValue(item.operator);
62
+ const newOperatorValue = getOperatorValue(item.operator);
63
+ // Calculate what the default category name should be before the change
64
+ const oldDefaultCategory = generateDefaultCategoryName(oldOperatorValue, getOperatorConfig, field === 'value1' ? oldItem.value1 : item.value1, field === 'value2' ? oldItem.value2 : item.value2);
65
+ // Calculate what the new default category name should be after the change
66
+ const newDefaultCategory = generateDefaultCategoryName(newOperatorValue, getOperatorConfig, item.value1, item.value2);
67
+ // Determine if we should auto-update the category
68
+ const shouldUpdateCategory = !item.category ||
69
+ item.category.trim() === '' ||
70
+ item.category === oldDefaultCategory;
71
+ // Auto-populate or update category if conditions are met
72
+ if (shouldUpdateCategory && newDefaultCategory) {
73
+ item.category = newDefaultCategory;
74
+ }
75
+ updatedItems[itemIndex] = item;
76
+ return updatedItems;
77
+ };
78
+ };
79
+ /**
80
+ * Shared visibility condition for value1 field.
81
+ */
82
+ export const value1VisibilityCondition = (formData) => {
83
+ const operatorValue = getOperatorValue(formData.operator);
84
+ const operatorConfig = getOperatorConfig(operatorValue);
85
+ return operatorConfig ? operatorConfig.operands >= 1 : true;
86
+ };
87
+ /**
88
+ * Shared visibility condition for value2 field.
89
+ */
90
+ export const value2VisibilityCondition = (formData) => {
91
+ const operatorValue = getOperatorValue(formData.operator);
92
+ const operatorConfig = getOperatorConfig(operatorValue);
93
+ return operatorConfig ? operatorConfig.operands === 2 : false;
94
+ };
95
+ /**
96
+ * Shared item configuration for rules array.
97
+ * This defines the operator, value1, value2, and category fields.
98
+ */
99
+ export const createRulesItemConfig = () => ({
100
+ operator: {
101
+ type: 'select',
102
+ required: true,
103
+ multi: false,
104
+ options: [], // Will be set by the caller
105
+ flavor: 'xsmall',
106
+ width: '200px'
107
+ },
108
+ value1: {
109
+ type: 'text',
110
+ flavor: 'xsmall',
111
+ conditions: {
112
+ visible: value1VisibilityCondition
113
+ }
114
+ },
115
+ value2: {
116
+ type: 'text',
117
+ flavor: 'xsmall',
118
+ conditions: {
119
+ visible: value2VisibilityCondition
120
+ }
121
+ },
122
+ category: {
123
+ type: 'text',
124
+ placeholder: 'Category',
125
+ required: true,
126
+ maxWidth: '120px',
127
+ flavor: 'xsmall'
128
+ }
129
+ });
130
+ /**
131
+ * Shared function to extract rules from form data.
132
+ * Filters and transforms form rules into the format expected by createRulesRouter.
133
+ */
134
+ export const extractUserRules = (formData) => {
135
+ return (formData.rules || [])
136
+ .filter((rule) => {
137
+ const operatorValue = getOperatorValue(rule === null || rule === void 0 ? void 0 : rule.operator);
138
+ if (!operatorValue ||
139
+ !(rule === null || rule === void 0 ? void 0 : rule.category) ||
140
+ operatorValue === '' ||
141
+ rule.category.trim() === '') {
142
+ return false;
143
+ }
144
+ const operatorConfig = getOperatorConfig(operatorValue);
145
+ if (operatorConfig && operatorConfig.operands === 1) {
146
+ return (rule === null || rule === void 0 ? void 0 : rule.value1) && rule.value1.trim() !== '';
147
+ }
148
+ else if (operatorConfig && operatorConfig.operands === 2) {
149
+ return ((rule === null || rule === void 0 ? void 0 : rule.value1) &&
150
+ rule.value1.trim() !== '' &&
151
+ (rule === null || rule === void 0 ? void 0 : rule.value2) &&
152
+ rule.value2.trim() !== '');
153
+ }
154
+ return true;
155
+ })
156
+ .map((rule) => {
157
+ const operatorValue = getOperatorValue(rule.operator);
158
+ const operatorConfig = getOperatorConfig(operatorValue);
159
+ let value = '';
160
+ if (operatorConfig && operatorConfig.operands === 1) {
161
+ value = rule.value1 ? rule.value1.trim() : '';
162
+ }
163
+ else if (operatorConfig && operatorConfig.operands === 2) {
164
+ const val1 = rule.value1 ? rule.value1.trim() : '';
165
+ const val2 = rule.value2 ? rule.value2.trim() : '';
166
+ value = `${val1} ${val2}`.trim();
167
+ }
168
+ else {
169
+ value = '';
170
+ }
171
+ return {
172
+ operator: operatorValue,
173
+ value: value,
174
+ category: rule.category.trim()
175
+ };
176
+ });
177
+ };
178
+ /**
179
+ * Shared function to transform router cases to form rules.
180
+ * Converts node router cases back into the form data structure.
181
+ */
182
+ export const casesToFormRules = (node) => {
183
+ var _a, _b;
184
+ const rules = [];
185
+ if (((_a = node.router) === null || _a === void 0 ? void 0 : _a.cases) && ((_b = node.router) === null || _b === void 0 ? void 0 : _b.categories)) {
186
+ node.router.cases.forEach((case_) => {
187
+ // Find the category for this case
188
+ const category = node.router.categories.find((cat) => cat.uuid === case_.category_uuid);
189
+ // Skip system categories
190
+ if (category && !isSystemCategory(category.name)) {
191
+ // Handle different operator types
192
+ const operatorConfig = getOperatorConfig(case_.type);
193
+ const operatorDisplayName = operatorConfig
194
+ ? operatorConfig.name
195
+ : case_.type;
196
+ let value1 = '';
197
+ let value2 = '';
198
+ if (operatorConfig && operatorConfig.operands === 0) {
199
+ value1 = '';
200
+ value2 = '';
201
+ }
202
+ else if (operatorConfig && operatorConfig.operands === 1) {
203
+ value1 = case_.arguments.join(' ');
204
+ value2 = '';
205
+ }
206
+ else if (operatorConfig && operatorConfig.operands === 2) {
207
+ value1 = case_.arguments[0] || '';
208
+ value2 = case_.arguments[1] || '';
209
+ }
210
+ else {
211
+ value1 = case_.arguments.join(' ');
212
+ value2 = '';
213
+ }
214
+ rules.push({
215
+ operator: { value: case_.type, name: operatorDisplayName },
216
+ value1: value1,
217
+ value2: value2,
218
+ category: category.name
219
+ });
220
+ }
221
+ });
222
+ }
223
+ return rules;
224
+ };
225
+ /**
226
+ * Helper to check if a category is a system category
227
+ */
228
+ function isSystemCategory(categoryName) {
229
+ return ['No Response', 'Other', 'All Responses', 'Timeout'].includes(categoryName);
230
+ }
231
+ /**
232
+ * Creates a complete rules array configuration for forms.
233
+ * This is the shared configuration used by both wait_for_response and split_by_expression.
234
+ *
235
+ * @param operatorOptions - The operator options to use (from operatorsToSelectOptions)
236
+ * @param helpText - The help text to display for the rules array
237
+ * @returns A complete array field configuration object
238
+ */
239
+ export const createRulesArrayConfig = (operatorOptions, helpText = 'Define rules to categorize responses') => ({
240
+ type: 'array',
241
+ helpText,
242
+ itemLabel: 'Rule',
243
+ minItems: 0,
244
+ maxItems: 100,
245
+ sortable: true,
246
+ maintainEmptyItem: true,
247
+ isEmptyItem: isEmptyRuleItem,
248
+ onItemChange: createRuleItemChangeHandler(),
249
+ itemConfig: {
250
+ ...createRulesItemConfig(),
251
+ operator: {
252
+ ...createRulesItemConfig().operator,
253
+ options: operatorOptions
254
+ }
255
+ }
256
+ });
257
+ //# sourceMappingURL=shared-rules.js.map