@nyaruka/temba-components 0.130.1 → 0.130.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 (250) hide show
  1. package/CHANGELOG.md +34 -4
  2. package/DEV_DATA.md +89 -0
  3. package/demo/data/flows/food-order.json +4 -4
  4. package/demo/data/flows/sample-flow.json +132 -147
  5. package/dist/temba-components.js +787 -659
  6. package/dist/temba-components.js.map +1 -1
  7. package/out-tsc/src/display/Chat.js +5 -3
  8. package/out-tsc/src/display/Chat.js.map +1 -1
  9. package/out-tsc/src/events.js.map +1 -1
  10. package/out-tsc/src/flow/CanvasNode.js +83 -78
  11. package/out-tsc/src/flow/CanvasNode.js.map +1 -1
  12. package/out-tsc/src/flow/Editor.js +1 -0
  13. package/out-tsc/src/flow/Editor.js.map +1 -1
  14. package/out-tsc/src/flow/NodeEditor.js +47 -3
  15. package/out-tsc/src/flow/NodeEditor.js.map +1 -1
  16. package/out-tsc/src/flow/actions/add_contact_urn.js +1 -1
  17. package/out-tsc/src/flow/actions/add_contact_urn.js.map +1 -1
  18. package/out-tsc/src/flow/actions/set_contact_channel.js +1 -1
  19. package/out-tsc/src/flow/actions/set_contact_channel.js.map +1 -1
  20. package/out-tsc/src/flow/actions/set_contact_field.js +2 -1
  21. package/out-tsc/src/flow/actions/set_contact_field.js.map +1 -1
  22. package/out-tsc/src/flow/actions/set_contact_language.js +3 -1
  23. package/out-tsc/src/flow/actions/set_contact_language.js.map +1 -1
  24. package/out-tsc/src/flow/actions/set_contact_name.js +1 -1
  25. package/out-tsc/src/flow/actions/set_contact_name.js.map +1 -1
  26. package/out-tsc/src/flow/actions/set_contact_status.js +17 -14
  27. package/out-tsc/src/flow/actions/set_contact_status.js.map +1 -1
  28. package/out-tsc/src/flow/actions/set_run_result.js +1 -1
  29. package/out-tsc/src/flow/actions/set_run_result.js.map +1 -1
  30. package/out-tsc/src/flow/nodes/split_by_llm.js +12 -12
  31. package/out-tsc/src/flow/nodes/split_by_llm.js.map +1 -1
  32. package/out-tsc/src/flow/nodes/wait_for_response.js +609 -6
  33. package/out-tsc/src/flow/nodes/wait_for_response.js.map +1 -1
  34. package/out-tsc/src/flow/operators.js +194 -0
  35. package/out-tsc/src/flow/operators.js.map +1 -0
  36. package/out-tsc/src/flow/types.js.map +1 -1
  37. package/out-tsc/src/form/ArrayEditor.js +84 -19
  38. package/out-tsc/src/form/ArrayEditor.js.map +1 -1
  39. package/out-tsc/src/form/Checkbox.js +12 -0
  40. package/out-tsc/src/form/Checkbox.js.map +1 -1
  41. package/out-tsc/src/form/FieldRenderer.js +13 -3
  42. package/out-tsc/src/form/FieldRenderer.js.map +1 -1
  43. package/out-tsc/src/form/TextInput.js +20 -1
  44. package/out-tsc/src/form/TextInput.js.map +1 -1
  45. package/out-tsc/src/form/select/Select.js +7 -0
  46. package/out-tsc/src/form/select/Select.js.map +1 -1
  47. package/out-tsc/src/interfaces.js.map +1 -1
  48. package/out-tsc/src/layout/Dialog.js +3 -4
  49. package/out-tsc/src/layout/Dialog.js.map +1 -1
  50. package/out-tsc/src/list/RunList.js +2 -2
  51. package/out-tsc/src/list/RunList.js.map +1 -1
  52. package/out-tsc/src/live/ContactChat.js +101 -44
  53. package/out-tsc/src/live/ContactChat.js.map +1 -1
  54. package/out-tsc/src/live/ContactDetails.js +7 -0
  55. package/out-tsc/src/live/ContactDetails.js.map +1 -1
  56. package/out-tsc/src/live/ContactNameFetch.js +1 -1
  57. package/out-tsc/src/live/ContactNameFetch.js.map +1 -1
  58. package/out-tsc/src/webchat/index.js +0 -11
  59. package/out-tsc/src/webchat/index.js.map +1 -1
  60. package/out-tsc/test/NodeHelper.js +25 -27
  61. package/out-tsc/test/NodeHelper.js.map +1 -1
  62. package/out-tsc/test/nodes/split_by_llm.test.js +12 -4
  63. package/out-tsc/test/nodes/split_by_llm.test.js.map +1 -1
  64. package/out-tsc/test/nodes/split_by_llm_categorize.test.js +101 -91
  65. package/out-tsc/test/nodes/split_by_llm_categorize.test.js.map +1 -1
  66. package/out-tsc/test/nodes/split_by_random.test.js +120 -112
  67. package/out-tsc/test/nodes/split_by_random.test.js.map +1 -1
  68. package/out-tsc/test/nodes/wait_for_digits.test.js +131 -111
  69. package/out-tsc/test/nodes/wait_for_digits.test.js.map +1 -1
  70. package/out-tsc/test/nodes/wait_for_response.test.js +549 -85
  71. package/out-tsc/test/nodes/wait_for_response.test.js.map +1 -1
  72. package/out-tsc/test/temba-checkbox.test.js +32 -32
  73. package/out-tsc/test/temba-checkbox.test.js.map +1 -1
  74. package/out-tsc/test/temba-contact-chat.test.js +2 -1
  75. package/out-tsc/test/temba-contact-chat.test.js.map +1 -1
  76. package/out-tsc/test/temba-dropdown.test.js +0 -4
  77. package/out-tsc/test/temba-dropdown.test.js.map +1 -1
  78. package/out-tsc/test/temba-flow-editor-node.test.js +9 -4
  79. package/out-tsc/test/temba-flow-editor-node.test.js.map +1 -1
  80. package/out-tsc/test/temba-integration-markdown.test.js +13 -15
  81. package/out-tsc/test/temba-integration-markdown.test.js.map +1 -1
  82. package/out-tsc/test/temba-node-editor.test.js +5 -38
  83. package/out-tsc/test/temba-node-editor.test.js.map +1 -1
  84. package/out-tsc/test/temba-run-list.test.js +2 -2
  85. package/out-tsc/test/temba-run-list.test.js.map +1 -1
  86. package/out-tsc/test/utils.test.js +2 -1
  87. package/out-tsc/test/utils.test.js.map +1 -1
  88. package/package.json +6 -2
  89. package/screenshots/truth/actions/add_contact_groups/editor/descriptive-group-names.png +0 -0
  90. package/screenshots/truth/actions/add_contact_groups/editor/long-group-names.png +0 -0
  91. package/screenshots/truth/actions/add_contact_groups/editor/many-groups.png +0 -0
  92. package/screenshots/truth/actions/add_contact_groups/editor/multiple-groups.png +0 -0
  93. package/screenshots/truth/actions/add_contact_groups/editor/single-group.png +0 -0
  94. package/screenshots/truth/actions/add_contact_groups/render/descriptive-group-names.png +0 -0
  95. package/screenshots/truth/actions/add_contact_groups/render/long-group-names.png +0 -0
  96. package/screenshots/truth/actions/add_contact_groups/render/many-groups.png +0 -0
  97. package/screenshots/truth/actions/add_contact_groups/render/multiple-groups.png +0 -0
  98. package/screenshots/truth/actions/add_contact_groups/render/single-group.png +0 -0
  99. package/screenshots/truth/actions/remove_contact_groups/editor/cleanup-groups.png +0 -0
  100. package/screenshots/truth/actions/remove_contact_groups/editor/long-descriptive-group-names.png +0 -0
  101. package/screenshots/truth/actions/remove_contact_groups/editor/many-groups.png +0 -0
  102. package/screenshots/truth/actions/remove_contact_groups/editor/multiple-groups.png +0 -0
  103. package/screenshots/truth/actions/remove_contact_groups/editor/remove-from-all-groups.png +0 -0
  104. package/screenshots/truth/actions/remove_contact_groups/editor/single-group.png +0 -0
  105. package/screenshots/truth/actions/remove_contact_groups/render/cleanup-groups.png +0 -0
  106. package/screenshots/truth/actions/remove_contact_groups/render/long-descriptive-group-names.png +0 -0
  107. package/screenshots/truth/actions/remove_contact_groups/render/many-groups.png +0 -0
  108. package/screenshots/truth/actions/remove_contact_groups/render/multiple-groups.png +0 -0
  109. package/screenshots/truth/actions/remove_contact_groups/render/remove-from-all-groups.png +0 -0
  110. package/screenshots/truth/actions/remove_contact_groups/render/single-group.png +0 -0
  111. package/screenshots/truth/actions/send_email/editor/complex-business-email.png +0 -0
  112. package/screenshots/truth/actions/send_email/editor/empty-body.png +0 -0
  113. package/screenshots/truth/actions/send_email/editor/empty-subject.png +0 -0
  114. package/screenshots/truth/actions/send_email/editor/long-subject.png +0 -0
  115. package/screenshots/truth/actions/send_email/editor/multiline-body.png +0 -0
  116. package/screenshots/truth/actions/send_email/editor/multiple-recipients.png +0 -0
  117. package/screenshots/truth/actions/send_email/editor/simple-email.png +0 -0
  118. package/screenshots/truth/actions/send_email/editor/with-expressions.png +0 -0
  119. package/screenshots/truth/actions/send_email/render/complex-business-email.png +0 -0
  120. package/screenshots/truth/actions/send_email/render/empty-body.png +0 -0
  121. package/screenshots/truth/actions/send_email/render/empty-subject.png +0 -0
  122. package/screenshots/truth/actions/send_email/render/long-subject.png +0 -0
  123. package/screenshots/truth/actions/send_email/render/multiline-body.png +0 -0
  124. package/screenshots/truth/actions/send_email/render/multiple-recipients.png +0 -0
  125. package/screenshots/truth/actions/send_email/render/simple-email.png +0 -0
  126. package/screenshots/truth/actions/send_email/render/with-expressions.png +0 -0
  127. package/screenshots/truth/actions/send_msg/editor/long-quick-replies.png +0 -0
  128. package/screenshots/truth/actions/send_msg/editor/multiline-text-with-replies.png +0 -0
  129. package/screenshots/truth/actions/send_msg/editor/simple-text.png +0 -0
  130. package/screenshots/truth/actions/send_msg/editor/text-with-linebreaks.png +0 -0
  131. package/screenshots/truth/actions/send_msg/editor/text-with-many-quick-replies.png +0 -0
  132. package/screenshots/truth/actions/send_msg/editor/text-with-quick-replies.png +0 -0
  133. package/screenshots/truth/actions/send_msg/editor/text-without-quick-replies.png +0 -0
  134. package/screenshots/truth/actions/send_msg/render/long-quick-replies.png +0 -0
  135. package/screenshots/truth/actions/send_msg/render/multiline-text-with-replies.png +0 -0
  136. package/screenshots/truth/actions/send_msg/render/simple-text.png +0 -0
  137. package/screenshots/truth/actions/send_msg/render/text-with-linebreaks.png +0 -0
  138. package/screenshots/truth/actions/send_msg/render/text-with-many-quick-replies.png +0 -0
  139. package/screenshots/truth/actions/send_msg/render/text-with-quick-replies.png +0 -0
  140. package/screenshots/truth/actions/send_msg/render/text-without-quick-replies.png +0 -0
  141. package/screenshots/truth/checkbox/checkbox-label-background-hover.png +0 -0
  142. package/screenshots/truth/checkbox/checkbox-whitespace-label-no-background-hover.png +0 -0
  143. package/screenshots/truth/checkbox/checkbox-with-help-text.png +0 -0
  144. package/screenshots/truth/checkbox/checked.png +0 -0
  145. package/screenshots/truth/checkbox/default.png +0 -0
  146. package/screenshots/truth/editor/wait.png +0 -0
  147. package/screenshots/truth/integration/textinput-markdown-errors.png +0 -0
  148. package/screenshots/truth/lightbox/img-zoomed.png +0 -0
  149. package/screenshots/truth/nodes/split_by_llm/editor/information-extraction.png +0 -0
  150. package/screenshots/truth/nodes/split_by_llm/editor/sentiment-analysis.png +0 -0
  151. package/screenshots/truth/nodes/split_by_llm/editor/summarization.png +0 -0
  152. package/screenshots/truth/nodes/split_by_llm/editor/translation-task.png +0 -0
  153. package/screenshots/truth/nodes/split_by_llm/render/information-extraction.png +0 -0
  154. package/screenshots/truth/nodes/split_by_llm/render/sentiment-analysis.png +0 -0
  155. package/screenshots/truth/nodes/split_by_llm/render/summarization.png +0 -0
  156. package/screenshots/truth/nodes/split_by_llm/render/translation-task.png +0 -0
  157. package/screenshots/truth/nodes/split_by_llm_categorize/editor/basic-categorization.png +0 -0
  158. package/screenshots/truth/nodes/split_by_llm_categorize/editor/custom-input-and-result-name.png +0 -0
  159. package/screenshots/truth/nodes/split_by_llm_categorize/editor/feedback-categorization.png +0 -0
  160. package/screenshots/truth/nodes/split_by_llm_categorize/editor/many-categories.png +0 -0
  161. package/screenshots/truth/nodes/split_by_llm_categorize/editor/minimal-categories.png +0 -0
  162. package/screenshots/truth/nodes/split_by_llm_categorize/render/basic-categorization.png +0 -0
  163. package/screenshots/truth/nodes/split_by_llm_categorize/render/custom-input-and-result-name.png +0 -0
  164. package/screenshots/truth/nodes/split_by_llm_categorize/render/feedback-categorization.png +0 -0
  165. package/screenshots/truth/nodes/split_by_llm_categorize/render/many-categories.png +0 -0
  166. package/screenshots/truth/nodes/split_by_llm_categorize/render/minimal-categories.png +0 -0
  167. package/screenshots/truth/nodes/split_by_random/editor/ab-test-multiple-variants.png +0 -0
  168. package/screenshots/truth/nodes/split_by_random/editor/sampling-split.png +0 -0
  169. package/screenshots/truth/nodes/split_by_random/editor/three-way-split.png +0 -0
  170. package/screenshots/truth/nodes/split_by_random/editor/two-bucket-split.png +0 -0
  171. package/screenshots/truth/nodes/split_by_random/render/ab-test-multiple-variants.png +0 -0
  172. package/screenshots/truth/nodes/split_by_random/render/sampling-split.png +0 -0
  173. package/screenshots/truth/nodes/split_by_random/render/three-way-split.png +0 -0
  174. package/screenshots/truth/nodes/split_by_random/render/two-bucket-split.png +0 -0
  175. package/screenshots/truth/nodes/wait_for_digits/editor/basic-digits-wait.png +0 -0
  176. package/screenshots/truth/nodes/wait_for_digits/editor/phone-number-collection.png +0 -0
  177. package/screenshots/truth/nodes/wait_for_digits/editor/single-digit-with-timeout.png +0 -0
  178. package/screenshots/truth/nodes/wait_for_digits/editor/verification-code.png +0 -0
  179. package/screenshots/truth/nodes/wait_for_digits/render/basic-digits-wait.png +0 -0
  180. package/screenshots/truth/nodes/wait_for_digits/render/phone-number-collection.png +0 -0
  181. package/screenshots/truth/nodes/wait_for_digits/render/single-digit-with-timeout.png +0 -0
  182. package/screenshots/truth/nodes/wait_for_digits/render/verification-code.png +0 -0
  183. package/screenshots/truth/nodes/wait_for_response/editor/basic-wait.png +0 -0
  184. package/screenshots/truth/nodes/wait_for_response/editor/custom-result-name.png +0 -0
  185. package/screenshots/truth/nodes/wait_for_response/editor/no-timeout.png +0 -0
  186. package/screenshots/truth/nodes/wait_for_response/editor/short-timeout.png +0 -0
  187. package/screenshots/truth/nodes/wait_for_response/render/basic-wait.png +0 -0
  188. package/screenshots/truth/nodes/wait_for_response/render/custom-result-name.png +0 -0
  189. package/screenshots/truth/nodes/wait_for_response/render/no-timeout.png +0 -0
  190. package/screenshots/truth/nodes/wait_for_response/render/short-timeout.png +0 -0
  191. package/screenshots/truth/run-list/basic.png +0 -0
  192. package/screenshots/truth/templates/default.png +0 -0
  193. package/screenshots/truth/wait-for-response/rules-editor.png +0 -0
  194. package/screenshots/truth/wait-for-response/timeout-editor-unchecked.png +0 -0
  195. package/screenshots/truth/wait-for-response/timeout-editor.png +0 -0
  196. package/scripts/dev-data-sync.mjs +182 -0
  197. package/src/display/Chat.ts +6 -4
  198. package/src/events.ts +6 -6
  199. package/src/flow/CanvasNode.ts +89 -79
  200. package/src/flow/Editor.ts +1 -0
  201. package/src/flow/NodeEditor.ts +55 -3
  202. package/src/flow/actions/add_contact_urn.ts +1 -1
  203. package/src/flow/actions/set_contact_channel.ts +1 -1
  204. package/src/flow/actions/set_contact_field.ts +2 -1
  205. package/src/flow/actions/set_contact_language.ts +3 -1
  206. package/src/flow/actions/set_contact_name.ts +1 -1
  207. package/src/flow/actions/set_contact_status.ts +18 -18
  208. package/src/flow/actions/set_run_result.ts +1 -1
  209. package/src/flow/nodes/split_by_llm.ts +14 -13
  210. package/src/flow/nodes/wait_for_response.ts +717 -5
  211. package/src/flow/operators.ts +215 -0
  212. package/src/flow/types.ts +10 -2
  213. package/src/form/ArrayEditor.ts +117 -37
  214. package/src/form/Checkbox.ts +12 -0
  215. package/src/form/FieldRenderer.ts +24 -3
  216. package/src/form/TextInput.ts +19 -1
  217. package/src/form/select/Select.ts +7 -0
  218. package/src/interfaces.ts +1 -1
  219. package/src/layout/Dialog.ts +4 -4
  220. package/src/list/RunList.ts +2 -2
  221. package/src/live/ContactChat.ts +128 -67
  222. package/src/live/ContactDetails.ts +7 -0
  223. package/src/live/ContactNameFetch.ts +1 -1
  224. package/src/webchat/index.ts +0 -16
  225. package/static/api/labels.json +6 -1
  226. package/test/NodeHelper.ts +38 -40
  227. package/test/nodes/split_by_llm.test.ts +43 -32
  228. package/test/nodes/split_by_llm_categorize.test.ts +130 -120
  229. package/test/nodes/split_by_random.test.ts +136 -128
  230. package/test/nodes/wait_for_digits.test.ts +147 -127
  231. package/test/nodes/wait_for_response.test.ts +657 -104
  232. package/test/temba-checkbox.test.ts +36 -32
  233. package/test/temba-contact-chat.test.ts +2 -1
  234. package/test/temba-dropdown.test.ts +0 -12
  235. package/test/temba-flow-editor-node.test.ts +11 -4
  236. package/test/temba-integration-markdown.test.ts +16 -17
  237. package/test/temba-node-editor.test.ts +5 -43
  238. package/test/temba-run-list.test.ts +2 -2
  239. package/test/utils.test.ts +2 -1
  240. package/test-assets/contacts/history.json +4 -7
  241. package/test-assets/list/runs.json +8 -8
  242. package/web-dev-mock.mjs +86 -30
  243. package/web-dev-server.config.mjs +272 -31
  244. package/screenshots/truth/dropdown/bottom-edge-collision.png +0 -0
  245. package/screenshots/truth/dropdown/right-edge-collision.png +0 -0
  246. package/screenshots/truth/editor/send_msg.png +0 -0
  247. package/screenshots/truth/editor/set_contact_language.png +0 -0
  248. package/screenshots/truth/editor/set_contact_name.png +0 -0
  249. package/screenshots/truth/editor/set_run_result.png +0 -0
  250. package/screenshots/truth/integration/checkbox-markdown-errors.png +0 -0
@@ -33,144 +33,164 @@ describe('wait_for_digits node config', () => {
33
33
  });
34
34
 
35
35
  describe('node scenarios', () => {
36
- helper.testNode(
37
- {
38
- uuid: 'test-digits-node-1',
39
- actions: [],
40
- router: {
41
- type: 'switch',
42
- wait: {
43
- type: 'msg',
44
- hint: {
45
- type: 'digits',
46
- count: 4
47
- }
48
- },
49
- result_name: 'digits',
50
- categories: [
51
- {
52
- uuid: 'digits-cat-1',
53
- name: 'Has Number',
54
- exit_uuid: 'digits-exit-1'
36
+ it('renders basic digits wait', async () => {
37
+ await helper.testNode(
38
+ {
39
+ uuid: 'test-digits-node-1',
40
+ actions: [],
41
+ router: {
42
+ type: 'switch',
43
+ wait: {
44
+ type: 'msg',
45
+ hint: {
46
+ type: 'digits',
47
+ count: 4
48
+ }
55
49
  },
56
- { uuid: 'digits-cat-2', name: 'Other', exit_uuid: 'digits-exit-2' }
50
+ result_name: 'digits',
51
+ categories: [
52
+ {
53
+ uuid: 'digits-cat-1',
54
+ name: 'Has Number',
55
+ exit_uuid: 'digits-exit-1'
56
+ },
57
+ {
58
+ uuid: 'digits-cat-2',
59
+ name: 'Other',
60
+ exit_uuid: 'digits-exit-2'
61
+ }
62
+ ]
63
+ },
64
+ exits: [
65
+ { uuid: 'digits-exit-1', destination_uuid: null },
66
+ { uuid: 'digits-exit-2', destination_uuid: null }
57
67
  ]
58
- },
59
- exits: [
60
- { uuid: 'digits-exit-1', destination_uuid: null },
61
- { uuid: 'digits-exit-2', destination_uuid: null }
62
- ]
63
- } as Node,
64
- { type: 'wait_for_digits' },
65
- 'basic-digits-wait'
66
- );
68
+ } as Node,
69
+ { type: 'wait_for_digits' },
70
+ 'basic-digits-wait'
71
+ );
72
+ });
67
73
 
68
- helper.testNode(
69
- {
70
- uuid: 'test-digits-node-2',
71
- actions: [],
72
- router: {
73
- type: 'switch',
74
- wait: {
75
- type: 'msg',
76
- hint: {
77
- type: 'digits',
78
- count: 1
74
+ it('renders single digit with timeout', async () => {
75
+ await helper.testNode(
76
+ {
77
+ uuid: 'test-digits-node-2',
78
+ actions: [],
79
+ router: {
80
+ type: 'switch',
81
+ wait: {
82
+ type: 'msg',
83
+ hint: {
84
+ type: 'digits',
85
+ count: 1
86
+ },
87
+ timeout: {
88
+ category_uuid: 'timeout-cat',
89
+ seconds: 30
90
+ }
79
91
  },
80
- timeout: {
81
- category_uuid: 'timeout-cat',
82
- seconds: 30
83
- }
92
+ result_name: 'pin_digit',
93
+ categories: [
94
+ {
95
+ uuid: 'digits-cat-1',
96
+ name: 'Has Number',
97
+ exit_uuid: 'digits-exit-1'
98
+ },
99
+ {
100
+ uuid: 'timeout-cat',
101
+ name: 'No Response',
102
+ exit_uuid: 'timeout-exit'
103
+ },
104
+ {
105
+ uuid: 'digits-cat-2',
106
+ name: 'Other',
107
+ exit_uuid: 'digits-exit-2'
108
+ }
109
+ ]
84
110
  },
85
- result_name: 'pin_digit',
86
- categories: [
87
- {
88
- uuid: 'digits-cat-1',
89
- name: 'Has Number',
90
- exit_uuid: 'digits-exit-1'
91
- },
92
- {
93
- uuid: 'timeout-cat',
94
- name: 'No Response',
95
- exit_uuid: 'timeout-exit'
96
- },
97
- { uuid: 'digits-cat-2', name: 'Other', exit_uuid: 'digits-exit-2' }
111
+ exits: [
112
+ { uuid: 'digits-exit-1', destination_uuid: null },
113
+ { uuid: 'timeout-exit', destination_uuid: null },
114
+ { uuid: 'digits-exit-2', destination_uuid: null }
98
115
  ]
99
- },
100
- exits: [
101
- { uuid: 'digits-exit-1', destination_uuid: null },
102
- { uuid: 'timeout-exit', destination_uuid: null },
103
- { uuid: 'digits-exit-2', destination_uuid: null }
104
- ]
105
- } as Node,
106
- { type: 'wait_for_digits' },
107
- 'single-digit-with-timeout'
108
- );
116
+ } as Node,
117
+ { type: 'wait_for_digits' },
118
+ 'single-digit-with-timeout'
119
+ );
120
+ });
109
121
 
110
- helper.testNode(
111
- {
112
- uuid: 'test-digits-node-3',
113
- actions: [],
114
- router: {
115
- type: 'switch',
116
- wait: {
117
- type: 'msg',
118
- hint: {
119
- type: 'digits',
120
- count: 10
121
- }
122
- },
123
- result_name: 'phone_number',
124
- categories: [
125
- {
126
- uuid: 'phone-cat-1',
127
- name: 'Valid Phone',
128
- exit_uuid: 'phone-exit-1'
122
+ it('renders phone number collection', async () => {
123
+ await helper.testNode(
124
+ {
125
+ uuid: 'test-digits-node-3',
126
+ actions: [],
127
+ router: {
128
+ type: 'switch',
129
+ wait: {
130
+ type: 'msg',
131
+ hint: {
132
+ type: 'digits',
133
+ count: 10
134
+ }
129
135
  },
130
- { uuid: 'phone-cat-2', name: 'Invalid', exit_uuid: 'phone-exit-2' },
131
- { uuid: 'phone-cat-3', name: 'Other', exit_uuid: 'phone-exit-3' }
136
+ result_name: 'phone_number',
137
+ categories: [
138
+ {
139
+ uuid: 'phone-cat-1',
140
+ name: 'Valid Phone',
141
+ exit_uuid: 'phone-exit-1'
142
+ },
143
+ {
144
+ uuid: 'phone-cat-2',
145
+ name: 'Invalid',
146
+ exit_uuid: 'phone-exit-2'
147
+ },
148
+ { uuid: 'phone-cat-3', name: 'Other', exit_uuid: 'phone-exit-3' }
149
+ ]
150
+ },
151
+ exits: [
152
+ { uuid: 'phone-exit-1', destination_uuid: null },
153
+ { uuid: 'phone-exit-2', destination_uuid: null },
154
+ { uuid: 'phone-exit-3', destination_uuid: null }
132
155
  ]
133
- },
134
- exits: [
135
- { uuid: 'phone-exit-1', destination_uuid: null },
136
- { uuid: 'phone-exit-2', destination_uuid: null },
137
- { uuid: 'phone-exit-3', destination_uuid: null }
138
- ]
139
- } as Node,
140
- { type: 'wait_for_digits' },
141
- 'phone-number-collection'
142
- );
156
+ } as Node,
157
+ { type: 'wait_for_digits' },
158
+ 'phone-number-collection'
159
+ );
160
+ });
143
161
 
144
- helper.testNode(
145
- {
146
- uuid: 'test-digits-node-4',
147
- actions: [],
148
- router: {
149
- type: 'switch',
150
- wait: {
151
- type: 'msg',
152
- hint: {
153
- type: 'digits',
154
- count: 6
155
- }
156
- },
157
- result_name: 'verification_code',
158
- categories: [
159
- {
160
- uuid: 'code-cat-1',
161
- name: 'Valid Code',
162
- exit_uuid: 'code-exit-1'
162
+ it('renders verification code', async () => {
163
+ await helper.testNode(
164
+ {
165
+ uuid: 'test-digits-node-4',
166
+ actions: [],
167
+ router: {
168
+ type: 'switch',
169
+ wait: {
170
+ type: 'msg',
171
+ hint: {
172
+ type: 'digits',
173
+ count: 6
174
+ }
163
175
  },
164
- { uuid: 'code-cat-2', name: 'Other', exit_uuid: 'code-exit-2' }
176
+ result_name: 'verification_code',
177
+ categories: [
178
+ {
179
+ uuid: 'code-cat-1',
180
+ name: 'Valid Code',
181
+ exit_uuid: 'code-exit-1'
182
+ },
183
+ { uuid: 'code-cat-2', name: 'Other', exit_uuid: 'code-exit-2' }
184
+ ]
185
+ },
186
+ exits: [
187
+ { uuid: 'code-exit-1', destination_uuid: null },
188
+ { uuid: 'code-exit-2', destination_uuid: null }
165
189
  ]
166
- },
167
- exits: [
168
- { uuid: 'code-exit-1', destination_uuid: null },
169
- { uuid: 'code-exit-2', destination_uuid: null }
170
- ]
171
- } as Node,
172
- { type: 'wait_for_digits' },
173
- 'verification-code'
174
- );
190
+ } as Node,
191
+ { type: 'wait_for_digits' },
192
+ 'verification-code'
193
+ );
194
+ });
175
195
  });
176
196
  });