@nyaruka/temba-components 0.139.0 → 0.141.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 (385) hide show
  1. package/.github/workflows/cla.yml +1 -1
  2. package/.github/workflows/copilot-setup-steps.yml +6 -1
  3. package/.lintstagedrc.js +10 -0
  4. package/CHANGELOG.md +32 -0
  5. package/demo/data/flows/sample-flow.json +24 -0
  6. package/dist/locales/es.js +5 -5
  7. package/dist/locales/es.js.map +1 -1
  8. package/dist/locales/fr.js +5 -5
  9. package/dist/locales/fr.js.map +1 -1
  10. package/dist/locales/locale-codes.js +11 -2
  11. package/dist/locales/locale-codes.js.map +1 -1
  12. package/dist/locales/pt.js +5 -5
  13. package/dist/locales/pt.js.map +1 -1
  14. package/dist/temba-components.js +702 -338
  15. package/dist/temba-components.js.map +1 -1
  16. package/out-tsc/src/display/Chat.js +10 -7
  17. package/out-tsc/src/display/Chat.js.map +1 -1
  18. package/out-tsc/src/display/Dropdown.js +3 -1
  19. package/out-tsc/src/display/Dropdown.js.map +1 -1
  20. package/out-tsc/src/display/FloatingTab.js +4 -4
  21. package/out-tsc/src/display/FloatingTab.js.map +1 -1
  22. package/out-tsc/src/display/Thumbnail.js +163 -5
  23. package/out-tsc/src/display/Thumbnail.js.map +1 -1
  24. package/out-tsc/src/flow/CanvasNode.js +65 -23
  25. package/out-tsc/src/flow/CanvasNode.js.map +1 -1
  26. package/out-tsc/src/flow/Editor.js +369 -49
  27. package/out-tsc/src/flow/Editor.js.map +1 -1
  28. package/out-tsc/src/flow/NodeEditor.js +118 -10
  29. package/out-tsc/src/flow/NodeEditor.js.map +1 -1
  30. package/out-tsc/src/flow/Plumber.js +61 -14
  31. package/out-tsc/src/flow/Plumber.js.map +1 -1
  32. package/out-tsc/src/flow/StickyNote.js +13 -4
  33. package/out-tsc/src/flow/StickyNote.js.map +1 -1
  34. package/out-tsc/src/flow/actions/add_contact_groups.js +4 -1
  35. package/out-tsc/src/flow/actions/add_contact_groups.js.map +1 -1
  36. package/out-tsc/src/flow/actions/add_input_labels.js +4 -1
  37. package/out-tsc/src/flow/actions/add_input_labels.js.map +1 -1
  38. package/out-tsc/src/flow/actions/audio-player.js +112 -0
  39. package/out-tsc/src/flow/actions/audio-player.js.map +1 -0
  40. package/out-tsc/src/flow/actions/enter_flow.js +43 -0
  41. package/out-tsc/src/flow/actions/enter_flow.js.map +1 -0
  42. package/out-tsc/src/flow/actions/play_audio.js +57 -4
  43. package/out-tsc/src/flow/actions/play_audio.js.map +1 -1
  44. package/out-tsc/src/flow/actions/remove_contact_groups.js +6 -1
  45. package/out-tsc/src/flow/actions/remove_contact_groups.js.map +1 -1
  46. package/out-tsc/src/flow/actions/say_msg.js +86 -3
  47. package/out-tsc/src/flow/actions/say_msg.js.map +1 -1
  48. package/out-tsc/src/flow/actions/send_broadcast.js +6 -2
  49. package/out-tsc/src/flow/actions/send_broadcast.js.map +1 -1
  50. package/out-tsc/src/flow/actions/set_contact_channel.js +13 -0
  51. package/out-tsc/src/flow/actions/set_contact_channel.js.map +1 -1
  52. package/out-tsc/src/flow/actions/set_contact_status.js +7 -5
  53. package/out-tsc/src/flow/actions/set_contact_status.js.map +1 -1
  54. package/out-tsc/src/flow/actions/start_session.js +10 -3
  55. package/out-tsc/src/flow/actions/start_session.js.map +1 -1
  56. package/out-tsc/src/flow/config.js +11 -3
  57. package/out-tsc/src/flow/config.js.map +1 -1
  58. package/out-tsc/src/flow/nodes/shared-rules.js +1 -1
  59. package/out-tsc/src/flow/nodes/shared-rules.js.map +1 -1
  60. package/out-tsc/src/flow/nodes/split_by_contact_field.js +18 -5
  61. package/out-tsc/src/flow/nodes/split_by_contact_field.js.map +1 -1
  62. package/out-tsc/src/flow/nodes/split_by_expression.js +1 -1
  63. package/out-tsc/src/flow/nodes/split_by_expression.js.map +1 -1
  64. package/out-tsc/src/flow/nodes/split_by_llm_categorize.js +0 -1
  65. package/out-tsc/src/flow/nodes/split_by_llm_categorize.js.map +1 -1
  66. package/out-tsc/src/flow/nodes/split_by_random.js +0 -1
  67. package/out-tsc/src/flow/nodes/split_by_random.js.map +1 -1
  68. package/out-tsc/src/flow/nodes/split_by_run_result.js +10 -4
  69. package/out-tsc/src/flow/nodes/split_by_run_result.js.map +1 -1
  70. package/out-tsc/src/flow/nodes/terminal.js +7 -0
  71. package/out-tsc/src/flow/nodes/terminal.js.map +1 -0
  72. package/out-tsc/src/flow/nodes/wait_for_audio.js +77 -0
  73. package/out-tsc/src/flow/nodes/wait_for_audio.js.map +1 -0
  74. package/out-tsc/src/flow/nodes/wait_for_dial.js +151 -0
  75. package/out-tsc/src/flow/nodes/wait_for_dial.js.map +1 -0
  76. package/out-tsc/src/flow/nodes/wait_for_digits.js +61 -1
  77. package/out-tsc/src/flow/nodes/wait_for_digits.js.map +1 -1
  78. package/out-tsc/src/flow/nodes/wait_for_menu.js +173 -2
  79. package/out-tsc/src/flow/nodes/wait_for_menu.js.map +1 -1
  80. package/out-tsc/src/flow/nodes/wait_for_response.js +1 -1
  81. package/out-tsc/src/flow/nodes/wait_for_response.js.map +1 -1
  82. package/out-tsc/src/flow/operators.js +21 -5
  83. package/out-tsc/src/flow/operators.js.map +1 -1
  84. package/out-tsc/src/flow/types.js.map +1 -1
  85. package/out-tsc/src/flow/utils.js +79 -3
  86. package/out-tsc/src/flow/utils.js.map +1 -1
  87. package/out-tsc/src/form/ArrayEditor.js +4 -2
  88. package/out-tsc/src/form/ArrayEditor.js.map +1 -1
  89. package/out-tsc/src/form/FieldRenderer.js +56 -0
  90. package/out-tsc/src/form/FieldRenderer.js.map +1 -1
  91. package/out-tsc/src/interfaces.js +1 -0
  92. package/out-tsc/src/interfaces.js.map +1 -1
  93. package/out-tsc/src/layout/Dialog.js +51 -7
  94. package/out-tsc/src/layout/Dialog.js.map +1 -1
  95. package/out-tsc/src/layout/Modax.js +20 -2
  96. package/out-tsc/src/layout/Modax.js.map +1 -1
  97. package/out-tsc/src/list/ContentMenu.js +14 -1
  98. package/out-tsc/src/list/ContentMenu.js.map +1 -1
  99. package/out-tsc/src/locales/es.js +5 -5
  100. package/out-tsc/src/locales/es.js.map +1 -1
  101. package/out-tsc/src/locales/fr.js +5 -5
  102. package/out-tsc/src/locales/fr.js.map +1 -1
  103. package/out-tsc/src/locales/locale-codes.js +11 -2
  104. package/out-tsc/src/locales/locale-codes.js.map +1 -1
  105. package/out-tsc/src/locales/pt.js +5 -5
  106. package/out-tsc/src/locales/pt.js.map +1 -1
  107. package/out-tsc/src/simulator/Simulator.js +21 -4
  108. package/out-tsc/src/simulator/Simulator.js.map +1 -1
  109. package/out-tsc/src/store/AppState.js +102 -3
  110. package/out-tsc/src/store/AppState.js.map +1 -1
  111. package/out-tsc/test/actions/add_contact_groups.test.js +35 -0
  112. package/out-tsc/test/actions/add_contact_groups.test.js.map +1 -1
  113. package/out-tsc/test/actions/add_input_labels.test.js +53 -0
  114. package/out-tsc/test/actions/add_input_labels.test.js.map +1 -0
  115. package/out-tsc/test/actions/enter_flow.test.js +71 -0
  116. package/out-tsc/test/actions/enter_flow.test.js.map +1 -0
  117. package/out-tsc/test/actions/play_audio.test.js +118 -0
  118. package/out-tsc/test/actions/play_audio.test.js.map +1 -0
  119. package/out-tsc/test/actions/remove_contact_groups.test.js +24 -0
  120. package/out-tsc/test/actions/remove_contact_groups.test.js.map +1 -1
  121. package/out-tsc/test/actions/say_msg.test.js +158 -0
  122. package/out-tsc/test/actions/say_msg.test.js.map +1 -0
  123. package/out-tsc/test/actions/send_broadcast.test.js +41 -0
  124. package/out-tsc/test/actions/send_broadcast.test.js.map +1 -1
  125. package/out-tsc/test/actions/set_contact_channel.test.js +67 -0
  126. package/out-tsc/test/actions/set_contact_channel.test.js.map +1 -0
  127. package/out-tsc/test/actions/set_contact_field.test.js +52 -0
  128. package/out-tsc/test/actions/set_contact_field.test.js.map +1 -0
  129. package/out-tsc/test/actions/set_contact_language.test.js +39 -0
  130. package/out-tsc/test/actions/set_contact_language.test.js.map +1 -0
  131. package/out-tsc/test/actions/set_contact_name.test.js +28 -0
  132. package/out-tsc/test/actions/set_contact_name.test.js.map +1 -0
  133. package/out-tsc/test/actions/set_contact_status.test.js +44 -0
  134. package/out-tsc/test/actions/set_contact_status.test.js.map +1 -0
  135. package/out-tsc/test/actions/set_run_result.test.js +47 -0
  136. package/out-tsc/test/actions/set_run_result.test.js.map +1 -0
  137. package/out-tsc/test/actions/start_session.test.js +76 -0
  138. package/out-tsc/test/actions/start_session.test.js.map +1 -1
  139. package/out-tsc/test/nodes/split_by_contact_field.test.js +50 -0
  140. package/out-tsc/test/nodes/split_by_contact_field.test.js.map +1 -1
  141. package/out-tsc/test/nodes/split_by_run_result.test.js +82 -0
  142. package/out-tsc/test/nodes/split_by_run_result.test.js.map +1 -1
  143. package/out-tsc/test/nodes/split_by_ticket.test.js +139 -0
  144. package/out-tsc/test/nodes/split_by_ticket.test.js.map +1 -0
  145. package/out-tsc/test/nodes/split_by_webhook.test.js +111 -0
  146. package/out-tsc/test/nodes/split_by_webhook.test.js.map +1 -0
  147. package/out-tsc/test/nodes/wait_for_audio.test.js +156 -0
  148. package/out-tsc/test/nodes/wait_for_audio.test.js.map +1 -0
  149. package/out-tsc/test/nodes/wait_for_dial.test.js +336 -0
  150. package/out-tsc/test/nodes/wait_for_dial.test.js.map +1 -0
  151. package/out-tsc/test/nodes/wait_for_digits.test.js +198 -84
  152. package/out-tsc/test/nodes/wait_for_digits.test.js.map +1 -1
  153. package/out-tsc/test/nodes/wait_for_menu.test.js +340 -0
  154. package/out-tsc/test/nodes/wait_for_menu.test.js.map +1 -0
  155. package/out-tsc/test/temba-flow-collision.test.js +261 -6
  156. package/out-tsc/test/temba-flow-collision.test.js.map +1 -1
  157. package/out-tsc/test/temba-flow-editor.test.js +187 -0
  158. package/out-tsc/test/temba-flow-editor.test.js.map +1 -1
  159. package/out-tsc/test/temba-flow-plumber.test.js +19 -0
  160. package/out-tsc/test/temba-flow-plumber.test.js.map +1 -1
  161. package/out-tsc/test/temba-node-type-selector.test.js +6 -6
  162. package/out-tsc/test/temba-node-type-selector.test.js.map +1 -1
  163. package/out-tsc/test/temba-select.test.js +4 -1
  164. package/out-tsc/test/temba-select.test.js.map +1 -1
  165. package/out-tsc/test/utils.test.js +4 -2
  166. package/out-tsc/test/utils.test.js.map +1 -1
  167. package/package.json +3 -9
  168. package/screenshots/truth/actions/add_contact_groups/render/descriptive-group-names.png +0 -0
  169. package/screenshots/truth/actions/add_contact_groups/render/long-group-names.png +0 -0
  170. package/screenshots/truth/actions/add_contact_groups/render/many-groups.png +0 -0
  171. package/screenshots/truth/actions/add_contact_groups/render/multiple-groups.png +0 -0
  172. package/screenshots/truth/actions/add_contact_groups/render/single-group.png +0 -0
  173. package/screenshots/truth/actions/add_contact_urn/render/expression-facebook.png +0 -0
  174. package/screenshots/truth/actions/add_contact_urn/render/expression-phone.png +0 -0
  175. package/screenshots/truth/actions/add_contact_urn/render/facebook-id.png +0 -0
  176. package/screenshots/truth/actions/add_contact_urn/render/instagram-handle.png +0 -0
  177. package/screenshots/truth/actions/add_contact_urn/render/line-id.png +0 -0
  178. package/screenshots/truth/actions/add_contact_urn/render/phone-number.png +0 -0
  179. package/screenshots/truth/actions/add_contact_urn/render/telegram-id.png +0 -0
  180. package/screenshots/truth/actions/add_contact_urn/render/viber-id.png +0 -0
  181. package/screenshots/truth/actions/add_contact_urn/render/wechat-id.png +0 -0
  182. package/screenshots/truth/actions/add_contact_urn/render/whatsapp.png +0 -0
  183. package/screenshots/truth/actions/add_input_labels/editor/multiple-labels.png +0 -0
  184. package/screenshots/truth/actions/add_input_labels/editor/single-label.png +0 -0
  185. package/screenshots/truth/actions/add_input_labels/render/multiple-labels.png +0 -0
  186. package/screenshots/truth/actions/add_input_labels/render/single-label.png +0 -0
  187. package/screenshots/truth/actions/enter_flow/editor/basic-flow.png +0 -0
  188. package/screenshots/truth/actions/enter_flow/editor/long-flow-name.png +0 -0
  189. package/screenshots/truth/actions/enter_flow/render/basic-flow.png +0 -0
  190. package/screenshots/truth/actions/enter_flow/render/long-flow-name.png +0 -0
  191. package/screenshots/truth/actions/play_audio/editor/expression-url.png +0 -0
  192. package/screenshots/truth/actions/play_audio/editor/static-url.png +0 -0
  193. package/screenshots/truth/actions/play_audio/render/expression-url.png +0 -0
  194. package/screenshots/truth/actions/play_audio/render/static-url.png +0 -0
  195. package/screenshots/truth/actions/remove_contact_groups/render/cleanup-groups.png +0 -0
  196. package/screenshots/truth/actions/remove_contact_groups/render/long-descriptive-group-names.png +0 -0
  197. package/screenshots/truth/actions/remove_contact_groups/render/many-groups.png +0 -0
  198. package/screenshots/truth/actions/remove_contact_groups/render/multiple-groups.png +0 -0
  199. package/screenshots/truth/actions/remove_contact_groups/render/remove-from-all-groups.png +0 -0
  200. package/screenshots/truth/actions/remove_contact_groups/render/single-group.png +0 -0
  201. package/screenshots/truth/actions/say_msg/editor/multiline-text.png +0 -0
  202. package/screenshots/truth/actions/say_msg/editor/simple-text.png +0 -0
  203. package/screenshots/truth/actions/say_msg/editor/text-with-audio-url.png +0 -0
  204. package/screenshots/truth/actions/say_msg/render/multiline-text.png +0 -0
  205. package/screenshots/truth/actions/say_msg/render/simple-text.png +0 -0
  206. package/screenshots/truth/actions/say_msg/render/text-with-audio-url.png +0 -0
  207. package/screenshots/truth/actions/send_broadcast/render/contacts-only.png +0 -0
  208. package/screenshots/truth/actions/send_broadcast/render/groups-and-contacts.png +0 -0
  209. package/screenshots/truth/actions/send_broadcast/render/groups-only.png +0 -0
  210. package/screenshots/truth/actions/send_broadcast/render/many-groups.png +0 -0
  211. package/screenshots/truth/actions/send_broadcast/render/multiline-text.png +0 -0
  212. package/screenshots/truth/actions/send_email/render/complex-business-email.png +0 -0
  213. package/screenshots/truth/actions/send_email/render/empty-body.png +0 -0
  214. package/screenshots/truth/actions/send_email/render/empty-subject.png +0 -0
  215. package/screenshots/truth/actions/send_email/render/long-subject.png +0 -0
  216. package/screenshots/truth/actions/send_email/render/multiline-body.png +0 -0
  217. package/screenshots/truth/actions/send_email/render/multiple-recipients.png +0 -0
  218. package/screenshots/truth/actions/send_email/render/simple-email.png +0 -0
  219. package/screenshots/truth/actions/send_email/render/with-expressions.png +0 -0
  220. package/screenshots/truth/actions/send_msg/render/long-quick-replies.png +0 -0
  221. package/screenshots/truth/actions/send_msg/render/multiline-text-with-replies.png +0 -0
  222. package/screenshots/truth/actions/send_msg/render/simple-text.png +0 -0
  223. package/screenshots/truth/actions/send_msg/render/text-with-linebreaks.png +0 -0
  224. package/screenshots/truth/actions/send_msg/render/text-with-many-quick-replies.png +0 -0
  225. package/screenshots/truth/actions/send_msg/render/text-with-quick-replies.png +0 -0
  226. package/screenshots/truth/actions/send_msg/render/text-without-quick-replies.png +0 -0
  227. package/screenshots/truth/actions/set_contact_channel/editor/sms-channel.png +0 -0
  228. package/screenshots/truth/actions/set_contact_channel/editor/whatsapp-channel.png +0 -0
  229. package/screenshots/truth/actions/set_contact_channel/render/sms-channel.png +0 -0
  230. package/screenshots/truth/actions/set_contact_channel/render/whatsapp-channel.png +0 -0
  231. package/screenshots/truth/actions/set_contact_field/editor/clear-value.png +0 -0
  232. package/screenshots/truth/actions/set_contact_field/editor/set-value.png +0 -0
  233. package/screenshots/truth/actions/set_contact_field/render/clear-value.png +0 -0
  234. package/screenshots/truth/actions/set_contact_field/render/set-value.png +0 -0
  235. package/screenshots/truth/actions/set_contact_language/editor/english.png +0 -0
  236. package/screenshots/truth/actions/set_contact_language/editor/french.png +0 -0
  237. package/screenshots/truth/actions/set_contact_language/render/english.png +0 -0
  238. package/screenshots/truth/actions/set_contact_language/render/french.png +0 -0
  239. package/screenshots/truth/actions/set_contact_name/editor/expression-name.png +0 -0
  240. package/screenshots/truth/actions/set_contact_name/editor/static-name.png +0 -0
  241. package/screenshots/truth/actions/set_contact_name/render/expression-name.png +0 -0
  242. package/screenshots/truth/actions/set_contact_name/render/static-name.png +0 -0
  243. package/screenshots/truth/actions/set_contact_status/editor/active.png +0 -0
  244. package/screenshots/truth/actions/set_contact_status/editor/archived.png +0 -0
  245. package/screenshots/truth/actions/set_contact_status/editor/blocked.png +0 -0
  246. package/screenshots/truth/actions/set_contact_status/render/active.png +0 -0
  247. package/screenshots/truth/actions/set_contact_status/render/archived.png +0 -0
  248. package/screenshots/truth/actions/set_contact_status/render/blocked.png +0 -0
  249. package/screenshots/truth/actions/set_run_result/editor/expression-value.png +0 -0
  250. package/screenshots/truth/actions/set_run_result/editor/with-category.png +0 -0
  251. package/screenshots/truth/actions/set_run_result/render/expression-value.png +0 -0
  252. package/screenshots/truth/actions/set_run_result/render/with-category.png +0 -0
  253. package/screenshots/truth/actions/start_session/render/contact-query.png +0 -0
  254. package/screenshots/truth/actions/start_session/render/contacts-only.png +0 -0
  255. package/screenshots/truth/actions/start_session/render/create-contact.png +0 -0
  256. package/screenshots/truth/actions/start_session/render/groups-and-contacts.png +0 -0
  257. package/screenshots/truth/actions/start_session/render/groups-only.png +0 -0
  258. package/screenshots/truth/actions/start_session/render/many-recipients.png +0 -0
  259. package/screenshots/truth/editor/router.png +0 -0
  260. package/screenshots/truth/editor/wait.png +0 -0
  261. package/screenshots/truth/nodes/split_by_llm/render/information-extraction.png +0 -0
  262. package/screenshots/truth/nodes/split_by_llm/render/sentiment-analysis.png +0 -0
  263. package/screenshots/truth/nodes/split_by_llm/render/summarization.png +0 -0
  264. package/screenshots/truth/nodes/split_by_llm/render/translation-task.png +0 -0
  265. package/screenshots/truth/nodes/split_by_llm_categorize/editor/basic-categorization.png +0 -0
  266. package/screenshots/truth/nodes/split_by_llm_categorize/editor/custom-input-and-result-name.png +0 -0
  267. package/screenshots/truth/nodes/split_by_llm_categorize/editor/feedback-categorization.png +0 -0
  268. package/screenshots/truth/nodes/split_by_llm_categorize/editor/many-categories.png +0 -0
  269. package/screenshots/truth/nodes/split_by_llm_categorize/editor/minimal-categories.png +0 -0
  270. package/screenshots/truth/nodes/split_by_llm_categorize/render/basic-categorization.png +0 -0
  271. package/screenshots/truth/nodes/split_by_llm_categorize/render/custom-input-and-result-name.png +0 -0
  272. package/screenshots/truth/nodes/split_by_llm_categorize/render/feedback-categorization.png +0 -0
  273. package/screenshots/truth/nodes/split_by_llm_categorize/render/many-categories.png +0 -0
  274. package/screenshots/truth/nodes/split_by_llm_categorize/render/minimal-categories.png +0 -0
  275. package/screenshots/truth/nodes/split_by_random/editor/ab-test-multiple-variants.png +0 -0
  276. package/screenshots/truth/nodes/split_by_random/editor/sampling-split.png +0 -0
  277. package/screenshots/truth/nodes/split_by_random/editor/three-way-split.png +0 -0
  278. package/screenshots/truth/nodes/split_by_random/editor/two-bucket-split.png +0 -0
  279. package/screenshots/truth/nodes/split_by_random/render/ab-test-multiple-variants.png +0 -0
  280. package/screenshots/truth/nodes/split_by_random/render/sampling-split.png +0 -0
  281. package/screenshots/truth/nodes/split_by_random/render/three-way-split.png +0 -0
  282. package/screenshots/truth/nodes/split_by_random/render/two-bucket-split.png +0 -0
  283. package/screenshots/truth/nodes/wait_for_audio/editor/basic-audio-wait.png +0 -0
  284. package/screenshots/truth/nodes/wait_for_audio/render/basic-audio-wait.png +0 -0
  285. package/screenshots/truth/nodes/wait_for_dial/editor/basic-dial.png +0 -0
  286. package/screenshots/truth/nodes/wait_for_dial/editor/dial-with-limits.png +0 -0
  287. package/screenshots/truth/nodes/wait_for_dial/render/basic-dial.png +0 -0
  288. package/screenshots/truth/nodes/wait_for_dial/render/dial-with-limits.png +0 -0
  289. package/screenshots/truth/nodes/wait_for_digits/editor/basic-digits-wait.png +0 -0
  290. package/screenshots/truth/nodes/wait_for_digits/editor/digits-with-rules.png +0 -0
  291. package/screenshots/truth/nodes/wait_for_digits/render/basic-digits-wait.png +0 -0
  292. package/screenshots/truth/nodes/wait_for_digits/render/digits-with-rules.png +0 -0
  293. package/screenshots/truth/nodes/wait_for_menu/editor/menu-with-digits.png +0 -0
  294. package/screenshots/truth/nodes/wait_for_menu/render/menu-with-digits.png +0 -0
  295. package/screenshots/truth/nodes/wait_for_response/editor/basic-wait.png +0 -0
  296. package/screenshots/truth/nodes/wait_for_response/editor/custom-result-name.png +0 -0
  297. package/screenshots/truth/nodes/wait_for_response/editor/no-timeout.png +0 -0
  298. package/screenshots/truth/nodes/wait_for_response/editor/short-timeout.png +0 -0
  299. package/screenshots/truth/nodes/wait_for_response/render/basic-wait.png +0 -0
  300. package/screenshots/truth/nodes/wait_for_response/render/custom-result-name.png +0 -0
  301. package/screenshots/truth/nodes/wait_for_response/render/no-timeout.png +0 -0
  302. package/screenshots/truth/nodes/wait_for_response/render/short-timeout.png +0 -0
  303. package/src/display/Chat.ts +13 -7
  304. package/src/display/Dropdown.ts +3 -1
  305. package/src/display/FloatingTab.ts +4 -4
  306. package/src/display/Thumbnail.ts +162 -2
  307. package/src/flow/CanvasNode.ts +70 -24
  308. package/src/flow/Editor.ts +440 -99
  309. package/src/flow/NodeEditor.ts +137 -9
  310. package/src/flow/Plumber.ts +89 -14
  311. package/src/flow/StickyNote.ts +14 -4
  312. package/src/flow/actions/add_contact_groups.ts +4 -1
  313. package/src/flow/actions/add_input_labels.ts +4 -1
  314. package/src/flow/actions/audio-player.ts +127 -0
  315. package/src/flow/actions/enter_flow.ts +44 -0
  316. package/src/flow/actions/play_audio.ts +64 -5
  317. package/src/flow/actions/remove_contact_groups.ts +6 -1
  318. package/src/flow/actions/say_msg.ts +94 -4
  319. package/src/flow/actions/send_broadcast.ts +6 -2
  320. package/src/flow/actions/set_contact_channel.ts +13 -1
  321. package/src/flow/actions/set_contact_status.ts +7 -5
  322. package/src/flow/actions/start_session.ts +10 -3
  323. package/src/flow/config.ts +11 -3
  324. package/src/flow/nodes/shared-rules.ts +1 -1
  325. package/src/flow/nodes/split_by_contact_field.ts +16 -5
  326. package/src/flow/nodes/split_by_expression.ts +1 -1
  327. package/src/flow/nodes/split_by_llm_categorize.ts +0 -1
  328. package/src/flow/nodes/split_by_random.ts +0 -1
  329. package/src/flow/nodes/split_by_run_result.ts +10 -4
  330. package/src/flow/nodes/terminal.ts +9 -0
  331. package/src/flow/nodes/wait_for_audio.ts +88 -0
  332. package/src/flow/nodes/wait_for_dial.ts +176 -0
  333. package/src/flow/nodes/wait_for_digits.ts +87 -2
  334. package/src/flow/nodes/wait_for_menu.ts +209 -3
  335. package/src/flow/nodes/wait_for_response.ts +1 -1
  336. package/src/flow/operators.ts +23 -5
  337. package/src/flow/types.ts +23 -1
  338. package/src/flow/utils.ts +82 -3
  339. package/src/form/ArrayEditor.ts +4 -2
  340. package/src/form/FieldRenderer.ts +71 -1
  341. package/src/interfaces.ts +2 -1
  342. package/src/layout/Dialog.ts +52 -7
  343. package/src/layout/Modax.ts +19 -2
  344. package/src/list/ContentMenu.ts +15 -1
  345. package/src/locales/es.ts +18 -13
  346. package/src/locales/fr.ts +18 -13
  347. package/src/locales/locale-codes.ts +11 -2
  348. package/src/locales/pt.ts +18 -13
  349. package/src/simulator/Simulator.ts +25 -4
  350. package/src/store/AppState.ts +120 -1
  351. package/src/store/flow-definition.d.ts +2 -0
  352. package/test/actions/add_contact_groups.test.ts +38 -0
  353. package/test/actions/add_input_labels.test.ts +67 -0
  354. package/test/actions/enter_flow.test.ts +88 -0
  355. package/test/actions/play_audio.test.ts +155 -0
  356. package/test/actions/remove_contact_groups.test.ts +29 -0
  357. package/test/actions/say_msg.test.ts +196 -0
  358. package/test/actions/send_broadcast.test.ts +44 -0
  359. package/test/actions/set_contact_channel.test.ts +88 -0
  360. package/test/actions/set_contact_field.test.ts +68 -0
  361. package/test/actions/set_contact_language.test.ts +55 -0
  362. package/test/actions/set_contact_name.test.ts +39 -0
  363. package/test/actions/set_contact_status.test.ts +64 -0
  364. package/test/actions/set_run_result.test.ts +61 -0
  365. package/test/actions/start_session.test.ts +82 -0
  366. package/test/nodes/split_by_contact_field.test.ts +59 -0
  367. package/test/nodes/split_by_run_result.test.ts +100 -0
  368. package/test/nodes/split_by_ticket.test.ts +157 -0
  369. package/test/nodes/split_by_webhook.test.ts +131 -0
  370. package/test/nodes/wait_for_audio.test.ts +182 -0
  371. package/test/nodes/wait_for_dial.test.ts +382 -0
  372. package/test/nodes/wait_for_digits.test.ts +233 -109
  373. package/test/nodes/wait_for_menu.test.ts +383 -0
  374. package/test/temba-flow-collision.test.ts +286 -6
  375. package/test/temba-flow-editor.test.ts +240 -0
  376. package/test/temba-flow-plumber.test.ts +62 -0
  377. package/test/temba-node-type-selector.test.ts +6 -6
  378. package/test/temba-select.test.ts +6 -1
  379. package/test/utils.test.ts +4 -2
  380. package/screenshots/truth/nodes/wait_for_digits/editor/phone-number-collection.png +0 -0
  381. package/screenshots/truth/nodes/wait_for_digits/editor/single-digit-with-timeout.png +0 -0
  382. package/screenshots/truth/nodes/wait_for_digits/editor/verification-code.png +0 -0
  383. package/screenshots/truth/nodes/wait_for_digits/render/phone-number-collection.png +0 -0
  384. package/screenshots/truth/nodes/wait_for_digits/render/single-digit-with-timeout.png +0 -0
  385. package/screenshots/truth/nodes/wait_for_digits/render/verification-code.png +0 -0
@@ -1,6 +1,7 @@
1
1
  import { expect } from '@open-wc/testing';
2
2
  import { wait_for_digits } from '../../src/flow/nodes/wait_for_digits';
3
3
  import { NodeTest } from '../NodeHelper';
4
+ import { createOperatorOption } from '../../src/flow/operators';
4
5
  /**
5
6
  * Test suite for the wait_for_digits node configuration.
6
7
  */
@@ -14,14 +15,26 @@ describe('wait_for_digits node config', () => {
14
15
  it('has correct type', () => {
15
16
  expect(wait_for_digits.type).to.equal('wait_for_digits');
16
17
  });
17
- it('has correct group', () => {
18
- expect(wait_for_digits.group).to.exist;
18
+ it('is voice-only', () => {
19
+ expect(wait_for_digits.flowTypes).to.deep.equal(['voice']);
19
20
  });
20
- it('is a simple node config without form or layout', () => {
21
- expect(wait_for_digits.form).to.be.undefined;
22
- expect(wait_for_digits.layout).to.be.undefined;
23
- expect(wait_for_digits.toFormData).to.be.undefined;
24
- expect(wait_for_digits.fromFormData).to.be.undefined;
21
+ it('has form with rules and result_name', () => {
22
+ expect(wait_for_digits.form).to.exist;
23
+ expect(wait_for_digits.form.rules).to.exist;
24
+ expect(wait_for_digits.form.result_name).to.exist;
25
+ });
26
+ it('has layout configuration', () => {
27
+ expect(wait_for_digits.layout).to.deep.equal([
28
+ {
29
+ type: 'text',
30
+ text: 'Rules match against all digits pressed by the caller followed by the # sign.'
31
+ },
32
+ 'rules',
33
+ 'result_name'
34
+ ]);
35
+ });
36
+ it('has large dialog size', () => {
37
+ expect(wait_for_digits.dialogSize).to.equal('large');
25
38
  });
26
39
  });
27
40
  describe('node scenarios', () => {
@@ -31,139 +44,240 @@ describe('wait_for_digits node config', () => {
31
44
  actions: [],
32
45
  router: {
33
46
  type: 'switch',
47
+ operand: '@input.text',
34
48
  wait: {
35
49
  type: 'msg',
36
50
  hint: {
37
- type: 'digits',
38
- count: 4
51
+ type: 'digits'
39
52
  }
40
53
  },
41
54
  result_name: 'digits',
55
+ default_category_uuid: 'all-cat',
56
+ cases: [],
42
57
  categories: [
43
58
  {
44
- uuid: 'digits-cat-1',
45
- name: 'Has Number',
46
- exit_uuid: 'digits-exit-1'
47
- },
48
- {
49
- uuid: 'digits-cat-2',
50
- name: 'Other',
51
- exit_uuid: 'digits-exit-2'
59
+ uuid: 'all-cat',
60
+ name: 'All Responses',
61
+ exit_uuid: 'all-exit'
52
62
  }
53
63
  ]
54
64
  },
55
- exits: [
56
- { uuid: 'digits-exit-1', destination_uuid: null },
57
- { uuid: 'digits-exit-2', destination_uuid: null }
58
- ]
65
+ exits: [{ uuid: 'all-exit', destination_uuid: null }]
59
66
  }, { type: 'wait_for_digits' }, 'basic-digits-wait');
60
67
  });
61
- it('renders single digit with timeout', async () => {
68
+ it('renders digits with rules', async () => {
62
69
  await helper.testNode({
63
70
  uuid: 'test-digits-node-2',
64
71
  actions: [],
65
72
  router: {
66
73
  type: 'switch',
74
+ operand: '@input.text',
67
75
  wait: {
68
76
  type: 'msg',
69
77
  hint: {
70
- type: 'digits',
71
- count: 1
72
- },
73
- timeout: {
74
- category_uuid: 'timeout-cat',
75
- seconds: 30
78
+ type: 'digits'
76
79
  }
77
80
  },
78
- result_name: 'pin_digit',
79
- categories: [
81
+ result_name: 'pin',
82
+ default_category_uuid: 'other-cat',
83
+ cases: [
80
84
  {
81
- uuid: 'digits-cat-1',
82
- name: 'Has Number',
83
- exit_uuid: 'digits-exit-1'
84
- },
85
+ uuid: 'case-1',
86
+ type: 'has_number_eq',
87
+ arguments: ['1234'],
88
+ category_uuid: 'valid-cat'
89
+ }
90
+ ],
91
+ categories: [
85
92
  {
86
- uuid: 'timeout-cat',
87
- name: 'No Response',
88
- exit_uuid: 'timeout-exit'
93
+ uuid: 'valid-cat',
94
+ name: 'Valid PIN',
95
+ exit_uuid: 'valid-exit'
89
96
  },
90
97
  {
91
- uuid: 'digits-cat-2',
98
+ uuid: 'other-cat',
92
99
  name: 'Other',
93
- exit_uuid: 'digits-exit-2'
100
+ exit_uuid: 'other-exit'
94
101
  }
95
102
  ]
96
103
  },
97
104
  exits: [
98
- { uuid: 'digits-exit-1', destination_uuid: null },
99
- { uuid: 'timeout-exit', destination_uuid: null },
100
- { uuid: 'digits-exit-2', destination_uuid: null }
105
+ { uuid: 'valid-exit', destination_uuid: null },
106
+ { uuid: 'other-exit', destination_uuid: null }
101
107
  ]
102
- }, { type: 'wait_for_digits' }, 'single-digit-with-timeout');
108
+ }, { type: 'wait_for_digits' }, 'digits-with-rules');
103
109
  });
104
- it('renders phone number collection', async () => {
105
- await helper.testNode({
106
- uuid: 'test-digits-node-3',
110
+ });
111
+ describe('data transformation', () => {
112
+ it('converts node to form data', () => {
113
+ const node = {
114
+ uuid: 'test-node',
107
115
  actions: [],
108
116
  router: {
109
117
  type: 'switch',
110
- wait: {
111
- type: 'msg',
112
- hint: {
113
- type: 'digits',
114
- count: 10
115
- }
116
- },
117
- result_name: 'phone_number',
118
+ result_name: 'digits',
119
+ operand: '@input.text',
118
120
  categories: [
119
121
  {
120
- uuid: 'phone-cat-1',
121
- name: 'Valid Phone',
122
- exit_uuid: 'phone-exit-1'
122
+ uuid: 'valid-cat',
123
+ name: 'Valid',
124
+ exit_uuid: 'valid-exit'
123
125
  },
124
126
  {
125
- uuid: 'phone-cat-2',
126
- name: 'Invalid',
127
- exit_uuid: 'phone-exit-2'
128
- },
129
- { uuid: 'phone-cat-3', name: 'Other', exit_uuid: 'phone-exit-3' }
127
+ uuid: 'other-cat',
128
+ name: 'Other',
129
+ exit_uuid: 'other-exit'
130
+ }
131
+ ],
132
+ cases: [
133
+ {
134
+ uuid: 'case-1',
135
+ type: 'has_number_eq',
136
+ arguments: ['1234'],
137
+ category_uuid: 'valid-cat'
138
+ }
130
139
  ]
131
140
  },
132
141
  exits: [
133
- { uuid: 'phone-exit-1', destination_uuid: null },
134
- { uuid: 'phone-exit-2', destination_uuid: null },
135
- { uuid: 'phone-exit-3', destination_uuid: null }
142
+ { uuid: 'valid-exit', destination_uuid: null },
143
+ { uuid: 'other-exit', destination_uuid: null }
136
144
  ]
137
- }, { type: 'wait_for_digits' }, 'phone-number-collection');
145
+ };
146
+ const formData = wait_for_digits.toFormData(node);
147
+ expect(formData.uuid).to.equal('test-node');
148
+ expect(formData.result_name).to.equal('digits');
149
+ expect(formData.rules).to.have.length(1);
150
+ expect(formData.rules[0]).to.deep.equal({
151
+ operator: createOperatorOption('has_number_eq'),
152
+ value1: '1234',
153
+ value2: '',
154
+ category: 'Valid'
155
+ });
138
156
  });
139
- it('renders verification code', async () => {
140
- await helper.testNode({
141
- uuid: 'test-digits-node-4',
157
+ it('converts node with no rules to form data', () => {
158
+ const node = {
159
+ uuid: 'test-node',
160
+ actions: [],
161
+ router: {
162
+ type: 'switch',
163
+ result_name: 'digits',
164
+ categories: []
165
+ },
166
+ exits: []
167
+ };
168
+ const formData = wait_for_digits.toFormData(node);
169
+ expect(formData.rules).to.deep.equal([]);
170
+ expect(formData.result_name).to.equal('digits');
171
+ });
172
+ it('converts form data to node with rules', () => {
173
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
174
+ const formData = {
175
+ uuid: 'test-node',
176
+ result_name: 'digits',
177
+ rules: [
178
+ {
179
+ operator: { value: 'has_number_eq', name: 'is equal to' },
180
+ value1: '1234',
181
+ value2: '',
182
+ category: 'Valid PIN'
183
+ }
184
+ ]
185
+ };
186
+ const originalNode = {
187
+ uuid: 'test-node',
188
+ actions: [],
189
+ exits: [],
190
+ router: { type: 'switch', categories: [] }
191
+ };
192
+ const result = wait_for_digits.fromFormData(formData, originalNode);
193
+ expect(result.uuid).to.equal('test-node');
194
+ expect((_a = result.router) === null || _a === void 0 ? void 0 : _a.result_name).to.equal('digits');
195
+ expect((_b = result.router) === null || _b === void 0 ? void 0 : _b.operand).to.equal('@input.text');
196
+ expect((_c = result.router) === null || _c === void 0 ? void 0 : _c.categories).to.have.length(2); // Valid PIN, Other
197
+ expect((_d = result.router) === null || _d === void 0 ? void 0 : _d.cases).to.have.length(1);
198
+ expect(result.exits).to.have.length(2);
199
+ // Check wait config has digits hint (without count)
200
+ expect((_f = (_e = result.router) === null || _e === void 0 ? void 0 : _e.wait) === null || _f === void 0 ? void 0 : _f.type).to.equal('msg');
201
+ expect((_j = (_h = (_g = result.router) === null || _g === void 0 ? void 0 : _g.wait) === null || _h === void 0 ? void 0 : _h.hint) === null || _j === void 0 ? void 0 : _j.type).to.equal('digits');
202
+ expect((_m = (_l = (_k = result.router) === null || _k === void 0 ? void 0 : _k.wait) === null || _l === void 0 ? void 0 : _l.hint) === null || _m === void 0 ? void 0 : _m.count).to.be.undefined;
203
+ });
204
+ it('converts form data with no rules', () => {
205
+ var _a, _b, _c, _d, _e;
206
+ const formData = {
207
+ uuid: 'test-node',
208
+ result_name: 'digits',
209
+ rules: []
210
+ };
211
+ const originalNode = {
212
+ uuid: 'test-node',
213
+ actions: [],
214
+ exits: [],
215
+ router: { type: 'switch', categories: [] }
216
+ };
217
+ const result = wait_for_digits.fromFormData(formData, originalNode);
218
+ // Should have just "All Responses" default category (no user rules)
219
+ expect((_a = result.router) === null || _a === void 0 ? void 0 : _a.categories).to.have.length(1);
220
+ expect(result.router.categories[0].name).to.equal('All Responses');
221
+ expect((_b = result.router) === null || _b === void 0 ? void 0 : _b.cases).to.have.length(0);
222
+ expect((_e = (_d = (_c = result.router) === null || _c === void 0 ? void 0 : _c.wait) === null || _d === void 0 ? void 0 : _d.hint) === null || _e === void 0 ? void 0 : _e.type).to.equal('digits');
223
+ });
224
+ it('preserves category UUIDs', () => {
225
+ const formData = {
226
+ uuid: 'test-node',
227
+ result_name: 'digits',
228
+ rules: [
229
+ {
230
+ operator: { value: 'has_number_eq', name: 'is equal to' },
231
+ value1: '1234',
232
+ value2: '',
233
+ category: 'Valid'
234
+ }
235
+ ]
236
+ };
237
+ const originalNode = {
238
+ uuid: 'test-node',
142
239
  actions: [],
143
240
  router: {
144
241
  type: 'switch',
145
- wait: {
146
- type: 'msg',
147
- hint: {
148
- type: 'digits',
149
- count: 6
150
- }
151
- },
152
- result_name: 'verification_code',
153
242
  categories: [
154
243
  {
155
- uuid: 'code-cat-1',
156
- name: 'Valid Code',
157
- exit_uuid: 'code-exit-1'
244
+ uuid: 'orig-valid',
245
+ name: 'Valid',
246
+ exit_uuid: 'orig-valid-exit'
158
247
  },
159
- { uuid: 'code-cat-2', name: 'Other', exit_uuid: 'code-exit-2' }
248
+ {
249
+ uuid: 'orig-other',
250
+ name: 'Other',
251
+ exit_uuid: 'orig-other-exit'
252
+ }
253
+ ],
254
+ cases: [
255
+ {
256
+ uuid: 'orig-case',
257
+ type: 'has_number_eq',
258
+ arguments: ['1234'],
259
+ category_uuid: 'orig-valid'
260
+ }
160
261
  ]
161
262
  },
162
263
  exits: [
163
- { uuid: 'code-exit-1', destination_uuid: null },
164
- { uuid: 'code-exit-2', destination_uuid: null }
264
+ { uuid: 'orig-valid-exit', destination_uuid: 'dest-1' },
265
+ { uuid: 'orig-other-exit', destination_uuid: null }
165
266
  ]
166
- }, { type: 'wait_for_digits' }, 'verification-code');
267
+ };
268
+ const result = wait_for_digits.fromFormData(formData, originalNode);
269
+ const valid = result.router.categories.find((c) => c.name === 'Valid');
270
+ expect(valid === null || valid === void 0 ? void 0 : valid.uuid).to.equal('orig-valid');
271
+ expect(valid === null || valid === void 0 ? void 0 : valid.exit_uuid).to.equal('orig-valid-exit');
272
+ const other = result.router.categories.find((c) => c.name === 'Other');
273
+ expect(other === null || other === void 0 ? void 0 : other.uuid).to.equal('orig-other');
274
+ });
275
+ });
276
+ describe('validation', () => {
277
+ it('validates with no errors', () => {
278
+ const formData = { rules: [] };
279
+ const result = wait_for_digits.validate(formData);
280
+ expect(result.valid).to.be.true;
167
281
  });
168
282
  });
169
283
  });
@@ -1 +1 @@
1
- {"version":3,"file":"wait_for_digits.test.js","sourceRoot":"","sources":["../../../test/nodes/wait_for_digits.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AAEvE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC;;GAEG;AACH,QAAQ,CAAC,6BAA6B,EAAE,GAAG,EAAE;IAC3C,MAAM,MAAM,GAAG,IAAI,QAAQ,CAAC,eAAe,EAAE,iBAAiB,CAAC,CAAC;IAEhE,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;QAChC,MAAM,CAAC,mBAAmB,EAAE,CAAC;QAE7B,EAAE,CAAC,kBAAkB,EAAE,GAAG,EAAE;YAC1B,MAAM,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;QAC3D,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,kBAAkB,EAAE,GAAG,EAAE;YAC1B,MAAM,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;QAC3D,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,mBAAmB,EAAE,GAAG,EAAE;YAC3B,MAAM,CAAC,e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E,YAAY;4BAClB,SAAS,EAAE,aAAa;yBACzB;wBACD,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE;qBAChE;iBACF;gBACD,KAAK,EAAE;oBACL,EAAE,IAAI,EAAE,aAAa,EAAE,gBAAgB,EAAE,IAAI,EAAE;oBAC/C,EAAE,IAAI,EAAE,aAAa,EAAE,gBAAgB,EAAE,IAAI,EAAE;iBAChD;aACM,EACT,EAAE,IAAI,EAAE,iBAAiB,EAAE,EAC3B,mBAAmB,CACpB,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { expect } from '@open-wc/testing';\nimport { wait_for_digits } from '../../src/flow/nodes/wait_for_digits';\nimport { Node } from '../../src/store/flow-definition';\nimport { NodeTest } from '../NodeHelper';\n\n/**\n * Test suite for the wait_for_digits node configuration.\n */\ndescribe('wait_for_digits node config', () => {\n const helper = new NodeTest(wait_for_digits, 'wait_for_digits');\n\n describe('basic properties', () => {\n helper.testBasicProperties();\n\n it('has correct name', () => {\n expect(wait_for_digits.name).to.equal('Wait for Digits');\n });\n\n it('has correct type', () => {\n expect(wait_for_digits.type).to.equal('wait_for_digits');\n });\n\n it('has correct group', () => {\n expect(wait_for_digits.group).to.exist;\n });\n\n it('is a simple node config without form or layout', () => {\n expect(wait_for_digits.form).to.be.undefined;\n expect(wait_for_digits.layout).to.be.undefined;\n expect(wait_for_digits.toFormData).to.be.undefined;\n expect(wait_for_digits.fromFormData).to.be.undefined;\n });\n });\n\n describe('node scenarios', () => {\n it('renders basic digits wait', async () => {\n await helper.testNode(\n {\n uuid: 'test-digits-node-1',\n actions: [],\n router: {\n type: 'switch',\n wait: {\n type: 'msg',\n hint: {\n type: 'digits',\n count: 4\n }\n },\n result_name: 'digits',\n categories: [\n {\n uuid: 'digits-cat-1',\n name: 'Has Number',\n exit_uuid: 'digits-exit-1'\n },\n {\n uuid: 'digits-cat-2',\n name: 'Other',\n exit_uuid: 'digits-exit-2'\n }\n ]\n },\n exits: [\n { uuid: 'digits-exit-1', destination_uuid: null },\n { uuid: 'digits-exit-2', destination_uuid: null }\n ]\n } as Node,\n { type: 'wait_for_digits' },\n 'basic-digits-wait'\n );\n });\n\n it('renders single digit with timeout', async () => {\n await helper.testNode(\n {\n uuid: 'test-digits-node-2',\n actions: [],\n router: {\n type: 'switch',\n wait: {\n type: 'msg',\n hint: {\n type: 'digits',\n count: 1\n },\n timeout: {\n category_uuid: 'timeout-cat',\n seconds: 30\n }\n },\n result_name: 'pin_digit',\n categories: [\n {\n uuid: 'digits-cat-1',\n name: 'Has Number',\n exit_uuid: 'digits-exit-1'\n },\n {\n uuid: 'timeout-cat',\n name: 'No Response',\n exit_uuid: 'timeout-exit'\n },\n {\n uuid: 'digits-cat-2',\n name: 'Other',\n exit_uuid: 'digits-exit-2'\n }\n ]\n },\n exits: [\n { uuid: 'digits-exit-1', destination_uuid: null },\n { uuid: 'timeout-exit', destination_uuid: null },\n { uuid: 'digits-exit-2', destination_uuid: null }\n ]\n } as Node,\n { type: 'wait_for_digits' },\n 'single-digit-with-timeout'\n );\n });\n\n it('renders phone number collection', async () => {\n await helper.testNode(\n {\n uuid: 'test-digits-node-3',\n actions: [],\n router: {\n type: 'switch',\n wait: {\n type: 'msg',\n hint: {\n type: 'digits',\n count: 10\n }\n },\n result_name: 'phone_number',\n categories: [\n {\n uuid: 'phone-cat-1',\n name: 'Valid Phone',\n exit_uuid: 'phone-exit-1'\n },\n {\n uuid: 'phone-cat-2',\n name: 'Invalid',\n exit_uuid: 'phone-exit-2'\n },\n { uuid: 'phone-cat-3', name: 'Other', exit_uuid: 'phone-exit-3' }\n ]\n },\n exits: [\n { uuid: 'phone-exit-1', destination_uuid: null },\n { uuid: 'phone-exit-2', destination_uuid: null },\n { uuid: 'phone-exit-3', destination_uuid: null }\n ]\n } as Node,\n { type: 'wait_for_digits' },\n 'phone-number-collection'\n );\n });\n\n it('renders verification code', async () => {\n await helper.testNode(\n {\n uuid: 'test-digits-node-4',\n actions: [],\n router: {\n type: 'switch',\n wait: {\n type: 'msg',\n hint: {\n type: 'digits',\n count: 6\n }\n },\n result_name: 'verification_code',\n categories: [\n {\n uuid: 'code-cat-1',\n name: 'Valid Code',\n exit_uuid: 'code-exit-1'\n },\n { uuid: 'code-cat-2', name: 'Other', exit_uuid: 'code-exit-2' }\n ]\n },\n exits: [\n { uuid: 'code-exit-1', destination_uuid: null },\n { uuid: 'code-exit-2', destination_uuid: null }\n ]\n } as Node,\n { type: 'wait_for_digits' },\n 'verification-code'\n );\n });\n });\n});\n"]}
1
+ {"version":3,"file":"wait_for_digits.test.js","sourceRoot":"","sources":["../../../test/nodes/wait_for_digits.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AAEvE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAEhE;;GAEG;AACH,QAAQ,CAAC,6BAA6B,EAAE,GAAG,EAAE;IAC3C,MAAM,MAAM,GAAG,IAAI,QAAQ,CAAC,eAAe,EAAE,iBAAiB,CAAC,CAAC;IAEhE,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;QAChC,MAAM,CAAC,mBAAmB,EAAE,CAAC;QAE7B,EAAE,CAAC,kBAAkB,EAAE,GAAG,EAAE;YAC1B,MAAM,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;QAC3D,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,kBAAkB,EAAE,GAAG,EAAE;YAC1B,MAAM,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;QAC3D,C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,CAAC;YAC3C,MAAM,CAAC,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,SAAS,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;YAErD,MAAM,KAAK,GAAG,MAAM,CAAC,MAAO,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC;YACxE,MAAM,CAAC,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,IAAI,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;QAC7C,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,YAAY,EAAE,GAAG,EAAE;QAC1B,EAAE,CAAC,0BAA0B,EAAE,GAAG,EAAE;YAClC,MAAM,QAAQ,GAAG,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;YAC/B,MAAM,MAAM,GAAG,eAAe,CAAC,QAAS,CAAC,QAAQ,CAAC,CAAC;YACnD,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC;QAClC,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { expect } from '@open-wc/testing';\nimport { wait_for_digits } from '../../src/flow/nodes/wait_for_digits';\nimport { Node } from '../../src/store/flow-definition';\nimport { NodeTest } from '../NodeHelper';\nimport { createOperatorOption } from '../../src/flow/operators';\n\n/**\n * Test suite for the wait_for_digits node configuration.\n */\ndescribe('wait_for_digits node config', () => {\n const helper = new NodeTest(wait_for_digits, 'wait_for_digits');\n\n describe('basic properties', () => {\n helper.testBasicProperties();\n\n it('has correct name', () => {\n expect(wait_for_digits.name).to.equal('Wait for Digits');\n });\n\n it('has correct type', () => {\n expect(wait_for_digits.type).to.equal('wait_for_digits');\n });\n\n it('is voice-only', () => {\n expect(wait_for_digits.flowTypes).to.deep.equal(['voice']);\n });\n\n it('has form with rules and result_name', () => {\n expect(wait_for_digits.form).to.exist;\n expect(wait_for_digits.form!.rules).to.exist;\n expect(wait_for_digits.form!.result_name).to.exist;\n });\n\n it('has layout configuration', () => {\n expect(wait_for_digits.layout).to.deep.equal([\n {\n type: 'text',\n text: 'Rules match against all digits pressed by the caller followed by the # sign.'\n },\n 'rules',\n 'result_name'\n ]);\n });\n\n it('has large dialog size', () => {\n expect(wait_for_digits.dialogSize).to.equal('large');\n });\n });\n\n describe('node scenarios', () => {\n it('renders basic digits wait', async () => {\n await helper.testNode(\n {\n uuid: 'test-digits-node-1',\n actions: [],\n router: {\n type: 'switch',\n operand: '@input.text',\n wait: {\n type: 'msg',\n hint: {\n type: 'digits'\n }\n },\n result_name: 'digits',\n default_category_uuid: 'all-cat',\n cases: [],\n categories: [\n {\n uuid: 'all-cat',\n name: 'All Responses',\n exit_uuid: 'all-exit'\n }\n ]\n },\n exits: [{ uuid: 'all-exit', destination_uuid: null }]\n } as Node,\n { type: 'wait_for_digits' },\n 'basic-digits-wait'\n );\n });\n\n it('renders digits with rules', async () => {\n await helper.testNode(\n {\n uuid: 'test-digits-node-2',\n actions: [],\n router: {\n type: 'switch',\n operand: '@input.text',\n wait: {\n type: 'msg',\n hint: {\n type: 'digits'\n }\n },\n result_name: 'pin',\n default_category_uuid: 'other-cat',\n cases: [\n {\n uuid: 'case-1',\n type: 'has_number_eq',\n arguments: ['1234'],\n category_uuid: 'valid-cat'\n }\n ],\n categories: [\n {\n uuid: 'valid-cat',\n name: 'Valid PIN',\n exit_uuid: 'valid-exit'\n },\n {\n uuid: 'other-cat',\n name: 'Other',\n exit_uuid: 'other-exit'\n }\n ]\n },\n exits: [\n { uuid: 'valid-exit', destination_uuid: null },\n { uuid: 'other-exit', destination_uuid: null }\n ]\n } as Node,\n { type: 'wait_for_digits' },\n 'digits-with-rules'\n );\n });\n });\n\n describe('data transformation', () => {\n it('converts node to form data', () => {\n const node: Node = {\n uuid: 'test-node',\n actions: [],\n router: {\n type: 'switch',\n result_name: 'digits',\n operand: '@input.text',\n categories: [\n {\n uuid: 'valid-cat',\n name: 'Valid',\n exit_uuid: 'valid-exit'\n },\n {\n uuid: 'other-cat',\n name: 'Other',\n exit_uuid: 'other-exit'\n }\n ],\n cases: [\n {\n uuid: 'case-1',\n type: 'has_number_eq',\n arguments: ['1234'],\n category_uuid: 'valid-cat'\n }\n ]\n },\n exits: [\n { uuid: 'valid-exit', destination_uuid: null },\n { uuid: 'other-exit', destination_uuid: null }\n ]\n };\n\n const formData = wait_for_digits.toFormData!(node);\n\n expect(formData.uuid).to.equal('test-node');\n expect(formData.result_name).to.equal('digits');\n expect(formData.rules).to.have.length(1);\n expect(formData.rules[0]).to.deep.equal({\n operator: createOperatorOption('has_number_eq'),\n value1: '1234',\n value2: '',\n category: 'Valid'\n });\n });\n\n it('converts node with no rules to form data', () => {\n const node: Node = {\n uuid: 'test-node',\n actions: [],\n router: {\n type: 'switch',\n result_name: 'digits',\n categories: []\n },\n exits: []\n };\n\n const formData = wait_for_digits.toFormData!(node);\n expect(formData.rules).to.deep.equal([]);\n expect(formData.result_name).to.equal('digits');\n });\n\n it('converts form data to node with rules', () => {\n const formData = {\n uuid: 'test-node',\n result_name: 'digits',\n rules: [\n {\n operator: { value: 'has_number_eq', name: 'is equal to' },\n value1: '1234',\n value2: '',\n category: 'Valid PIN'\n }\n ]\n };\n\n const originalNode: Node = {\n uuid: 'test-node',\n actions: [],\n exits: [],\n router: { type: 'switch', categories: [] }\n };\n\n const result = wait_for_digits.fromFormData!(formData, originalNode);\n\n expect(result.uuid).to.equal('test-node');\n expect(result.router?.result_name).to.equal('digits');\n expect(result.router?.operand).to.equal('@input.text');\n expect(result.router?.categories).to.have.length(2); // Valid PIN, Other\n expect(result.router?.cases).to.have.length(1);\n expect(result.exits).to.have.length(2);\n\n // Check wait config has digits hint (without count)\n expect(result.router?.wait?.type).to.equal('msg');\n expect(result.router?.wait?.hint?.type).to.equal('digits');\n expect(result.router?.wait?.hint?.count).to.be.undefined;\n });\n\n it('converts form data with no rules', () => {\n const formData = {\n uuid: 'test-node',\n result_name: 'digits',\n rules: []\n };\n\n const originalNode: Node = {\n uuid: 'test-node',\n actions: [],\n exits: [],\n router: { type: 'switch', categories: [] }\n };\n\n const result = wait_for_digits.fromFormData!(formData, originalNode);\n\n // Should have just \"All Responses\" default category (no user rules)\n expect(result.router?.categories).to.have.length(1);\n expect(result.router!.categories[0].name).to.equal('All Responses');\n expect(result.router?.cases).to.have.length(0);\n expect(result.router?.wait?.hint?.type).to.equal('digits');\n });\n\n it('preserves category UUIDs', () => {\n const formData = {\n uuid: 'test-node',\n result_name: 'digits',\n rules: [\n {\n operator: { value: 'has_number_eq', name: 'is equal to' },\n value1: '1234',\n value2: '',\n category: 'Valid'\n }\n ]\n };\n\n const originalNode: Node = {\n uuid: 'test-node',\n actions: [],\n router: {\n type: 'switch',\n categories: [\n {\n uuid: 'orig-valid',\n name: 'Valid',\n exit_uuid: 'orig-valid-exit'\n },\n {\n uuid: 'orig-other',\n name: 'Other',\n exit_uuid: 'orig-other-exit'\n }\n ],\n cases: [\n {\n uuid: 'orig-case',\n type: 'has_number_eq',\n arguments: ['1234'],\n category_uuid: 'orig-valid'\n }\n ]\n },\n exits: [\n { uuid: 'orig-valid-exit', destination_uuid: 'dest-1' },\n { uuid: 'orig-other-exit', destination_uuid: null }\n ]\n };\n\n const result = wait_for_digits.fromFormData!(formData, originalNode);\n\n const valid = result.router!.categories.find((c) => c.name === 'Valid');\n expect(valid?.uuid).to.equal('orig-valid');\n expect(valid?.exit_uuid).to.equal('orig-valid-exit');\n\n const other = result.router!.categories.find((c) => c.name === 'Other');\n expect(other?.uuid).to.equal('orig-other');\n });\n });\n\n describe('validation', () => {\n it('validates with no errors', () => {\n const formData = { rules: [] };\n const result = wait_for_digits.validate!(formData);\n expect(result.valid).to.be.true;\n });\n });\n});\n"]}