@nyaruka/temba-components 0.130.1 → 0.130.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (246) hide show
  1. package/CHANGELOG.md +28 -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 +764 -628
  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 +114 -34
  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/test/NodeHelper.js +25 -27
  59. package/out-tsc/test/NodeHelper.js.map +1 -1
  60. package/out-tsc/test/nodes/split_by_llm.test.js +12 -4
  61. package/out-tsc/test/nodes/split_by_llm.test.js.map +1 -1
  62. package/out-tsc/test/nodes/split_by_llm_categorize.test.js +101 -91
  63. package/out-tsc/test/nodes/split_by_llm_categorize.test.js.map +1 -1
  64. package/out-tsc/test/nodes/split_by_random.test.js +120 -112
  65. package/out-tsc/test/nodes/split_by_random.test.js.map +1 -1
  66. package/out-tsc/test/nodes/wait_for_digits.test.js +131 -111
  67. package/out-tsc/test/nodes/wait_for_digits.test.js.map +1 -1
  68. package/out-tsc/test/nodes/wait_for_response.test.js +549 -85
  69. package/out-tsc/test/nodes/wait_for_response.test.js.map +1 -1
  70. package/out-tsc/test/temba-checkbox.test.js +32 -32
  71. package/out-tsc/test/temba-checkbox.test.js.map +1 -1
  72. package/out-tsc/test/temba-contact-chat.test.js +2 -1
  73. package/out-tsc/test/temba-contact-chat.test.js.map +1 -1
  74. package/out-tsc/test/temba-dropdown.test.js +0 -4
  75. package/out-tsc/test/temba-dropdown.test.js.map +1 -1
  76. package/out-tsc/test/temba-flow-editor-node.test.js +9 -4
  77. package/out-tsc/test/temba-flow-editor-node.test.js.map +1 -1
  78. package/out-tsc/test/temba-integration-markdown.test.js +13 -15
  79. package/out-tsc/test/temba-integration-markdown.test.js.map +1 -1
  80. package/out-tsc/test/temba-node-editor.test.js +5 -38
  81. package/out-tsc/test/temba-node-editor.test.js.map +1 -1
  82. package/out-tsc/test/temba-run-list.test.js +2 -2
  83. package/out-tsc/test/temba-run-list.test.js.map +1 -1
  84. package/out-tsc/test/utils.test.js +2 -1
  85. package/out-tsc/test/utils.test.js.map +1 -1
  86. package/package.json +6 -2
  87. package/screenshots/truth/actions/add_contact_groups/editor/descriptive-group-names.png +0 -0
  88. package/screenshots/truth/actions/add_contact_groups/editor/long-group-names.png +0 -0
  89. package/screenshots/truth/actions/add_contact_groups/editor/many-groups.png +0 -0
  90. package/screenshots/truth/actions/add_contact_groups/editor/multiple-groups.png +0 -0
  91. package/screenshots/truth/actions/add_contact_groups/editor/single-group.png +0 -0
  92. package/screenshots/truth/actions/add_contact_groups/render/descriptive-group-names.png +0 -0
  93. package/screenshots/truth/actions/add_contact_groups/render/long-group-names.png +0 -0
  94. package/screenshots/truth/actions/add_contact_groups/render/many-groups.png +0 -0
  95. package/screenshots/truth/actions/add_contact_groups/render/multiple-groups.png +0 -0
  96. package/screenshots/truth/actions/add_contact_groups/render/single-group.png +0 -0
  97. package/screenshots/truth/actions/remove_contact_groups/editor/cleanup-groups.png +0 -0
  98. package/screenshots/truth/actions/remove_contact_groups/editor/long-descriptive-group-names.png +0 -0
  99. package/screenshots/truth/actions/remove_contact_groups/editor/many-groups.png +0 -0
  100. package/screenshots/truth/actions/remove_contact_groups/editor/multiple-groups.png +0 -0
  101. package/screenshots/truth/actions/remove_contact_groups/editor/remove-from-all-groups.png +0 -0
  102. package/screenshots/truth/actions/remove_contact_groups/editor/single-group.png +0 -0
  103. package/screenshots/truth/actions/remove_contact_groups/render/cleanup-groups.png +0 -0
  104. package/screenshots/truth/actions/remove_contact_groups/render/long-descriptive-group-names.png +0 -0
  105. package/screenshots/truth/actions/remove_contact_groups/render/many-groups.png +0 -0
  106. package/screenshots/truth/actions/remove_contact_groups/render/multiple-groups.png +0 -0
  107. package/screenshots/truth/actions/remove_contact_groups/render/remove-from-all-groups.png +0 -0
  108. package/screenshots/truth/actions/remove_contact_groups/render/single-group.png +0 -0
  109. package/screenshots/truth/actions/send_email/editor/complex-business-email.png +0 -0
  110. package/screenshots/truth/actions/send_email/editor/empty-body.png +0 -0
  111. package/screenshots/truth/actions/send_email/editor/empty-subject.png +0 -0
  112. package/screenshots/truth/actions/send_email/editor/long-subject.png +0 -0
  113. package/screenshots/truth/actions/send_email/editor/multiline-body.png +0 -0
  114. package/screenshots/truth/actions/send_email/editor/multiple-recipients.png +0 -0
  115. package/screenshots/truth/actions/send_email/editor/simple-email.png +0 -0
  116. package/screenshots/truth/actions/send_email/editor/with-expressions.png +0 -0
  117. package/screenshots/truth/actions/send_email/render/complex-business-email.png +0 -0
  118. package/screenshots/truth/actions/send_email/render/empty-body.png +0 -0
  119. package/screenshots/truth/actions/send_email/render/empty-subject.png +0 -0
  120. package/screenshots/truth/actions/send_email/render/long-subject.png +0 -0
  121. package/screenshots/truth/actions/send_email/render/multiline-body.png +0 -0
  122. package/screenshots/truth/actions/send_email/render/multiple-recipients.png +0 -0
  123. package/screenshots/truth/actions/send_email/render/simple-email.png +0 -0
  124. package/screenshots/truth/actions/send_email/render/with-expressions.png +0 -0
  125. package/screenshots/truth/actions/send_msg/editor/long-quick-replies.png +0 -0
  126. package/screenshots/truth/actions/send_msg/editor/multiline-text-with-replies.png +0 -0
  127. package/screenshots/truth/actions/send_msg/editor/simple-text.png +0 -0
  128. package/screenshots/truth/actions/send_msg/editor/text-with-linebreaks.png +0 -0
  129. package/screenshots/truth/actions/send_msg/editor/text-with-many-quick-replies.png +0 -0
  130. package/screenshots/truth/actions/send_msg/editor/text-with-quick-replies.png +0 -0
  131. package/screenshots/truth/actions/send_msg/editor/text-without-quick-replies.png +0 -0
  132. package/screenshots/truth/actions/send_msg/render/long-quick-replies.png +0 -0
  133. package/screenshots/truth/actions/send_msg/render/multiline-text-with-replies.png +0 -0
  134. package/screenshots/truth/actions/send_msg/render/simple-text.png +0 -0
  135. package/screenshots/truth/actions/send_msg/render/text-with-linebreaks.png +0 -0
  136. package/screenshots/truth/actions/send_msg/render/text-with-many-quick-replies.png +0 -0
  137. package/screenshots/truth/actions/send_msg/render/text-with-quick-replies.png +0 -0
  138. package/screenshots/truth/actions/send_msg/render/text-without-quick-replies.png +0 -0
  139. package/screenshots/truth/checkbox/checkbox-label-background-hover.png +0 -0
  140. package/screenshots/truth/checkbox/checkbox-whitespace-label-no-background-hover.png +0 -0
  141. package/screenshots/truth/checkbox/checkbox-with-help-text.png +0 -0
  142. package/screenshots/truth/checkbox/checked.png +0 -0
  143. package/screenshots/truth/checkbox/default.png +0 -0
  144. package/screenshots/truth/editor/wait.png +0 -0
  145. package/screenshots/truth/integration/textinput-markdown-errors.png +0 -0
  146. package/screenshots/truth/lightbox/img-zoomed.png +0 -0
  147. package/screenshots/truth/nodes/split_by_llm/editor/information-extraction.png +0 -0
  148. package/screenshots/truth/nodes/split_by_llm/editor/sentiment-analysis.png +0 -0
  149. package/screenshots/truth/nodes/split_by_llm/editor/summarization.png +0 -0
  150. package/screenshots/truth/nodes/split_by_llm/editor/translation-task.png +0 -0
  151. package/screenshots/truth/nodes/split_by_llm/render/information-extraction.png +0 -0
  152. package/screenshots/truth/nodes/split_by_llm/render/sentiment-analysis.png +0 -0
  153. package/screenshots/truth/nodes/split_by_llm/render/summarization.png +0 -0
  154. package/screenshots/truth/nodes/split_by_llm/render/translation-task.png +0 -0
  155. package/screenshots/truth/nodes/split_by_llm_categorize/editor/basic-categorization.png +0 -0
  156. package/screenshots/truth/nodes/split_by_llm_categorize/editor/custom-input-and-result-name.png +0 -0
  157. package/screenshots/truth/nodes/split_by_llm_categorize/editor/feedback-categorization.png +0 -0
  158. package/screenshots/truth/nodes/split_by_llm_categorize/editor/many-categories.png +0 -0
  159. package/screenshots/truth/nodes/split_by_llm_categorize/editor/minimal-categories.png +0 -0
  160. package/screenshots/truth/nodes/split_by_llm_categorize/render/basic-categorization.png +0 -0
  161. package/screenshots/truth/nodes/split_by_llm_categorize/render/custom-input-and-result-name.png +0 -0
  162. package/screenshots/truth/nodes/split_by_llm_categorize/render/feedback-categorization.png +0 -0
  163. package/screenshots/truth/nodes/split_by_llm_categorize/render/many-categories.png +0 -0
  164. package/screenshots/truth/nodes/split_by_llm_categorize/render/minimal-categories.png +0 -0
  165. package/screenshots/truth/nodes/split_by_random/editor/ab-test-multiple-variants.png +0 -0
  166. package/screenshots/truth/nodes/split_by_random/editor/sampling-split.png +0 -0
  167. package/screenshots/truth/nodes/split_by_random/editor/three-way-split.png +0 -0
  168. package/screenshots/truth/nodes/split_by_random/editor/two-bucket-split.png +0 -0
  169. package/screenshots/truth/nodes/split_by_random/render/ab-test-multiple-variants.png +0 -0
  170. package/screenshots/truth/nodes/split_by_random/render/sampling-split.png +0 -0
  171. package/screenshots/truth/nodes/split_by_random/render/three-way-split.png +0 -0
  172. package/screenshots/truth/nodes/split_by_random/render/two-bucket-split.png +0 -0
  173. package/screenshots/truth/nodes/wait_for_digits/editor/basic-digits-wait.png +0 -0
  174. package/screenshots/truth/nodes/wait_for_digits/editor/phone-number-collection.png +0 -0
  175. package/screenshots/truth/nodes/wait_for_digits/editor/single-digit-with-timeout.png +0 -0
  176. package/screenshots/truth/nodes/wait_for_digits/editor/verification-code.png +0 -0
  177. package/screenshots/truth/nodes/wait_for_digits/render/basic-digits-wait.png +0 -0
  178. package/screenshots/truth/nodes/wait_for_digits/render/phone-number-collection.png +0 -0
  179. package/screenshots/truth/nodes/wait_for_digits/render/single-digit-with-timeout.png +0 -0
  180. package/screenshots/truth/nodes/wait_for_digits/render/verification-code.png +0 -0
  181. package/screenshots/truth/nodes/wait_for_response/editor/basic-wait.png +0 -0
  182. package/screenshots/truth/nodes/wait_for_response/editor/custom-result-name.png +0 -0
  183. package/screenshots/truth/nodes/wait_for_response/editor/no-timeout.png +0 -0
  184. package/screenshots/truth/nodes/wait_for_response/editor/short-timeout.png +0 -0
  185. package/screenshots/truth/nodes/wait_for_response/render/basic-wait.png +0 -0
  186. package/screenshots/truth/nodes/wait_for_response/render/custom-result-name.png +0 -0
  187. package/screenshots/truth/nodes/wait_for_response/render/no-timeout.png +0 -0
  188. package/screenshots/truth/nodes/wait_for_response/render/short-timeout.png +0 -0
  189. package/screenshots/truth/run-list/basic.png +0 -0
  190. package/screenshots/truth/templates/default.png +0 -0
  191. package/screenshots/truth/wait-for-response/rules-editor.png +0 -0
  192. package/screenshots/truth/wait-for-response/timeout-editor-unchecked.png +0 -0
  193. package/screenshots/truth/wait-for-response/timeout-editor.png +0 -0
  194. package/scripts/dev-data-sync.mjs +182 -0
  195. package/src/display/Chat.ts +6 -4
  196. package/src/events.ts +6 -5
  197. package/src/flow/CanvasNode.ts +89 -79
  198. package/src/flow/Editor.ts +1 -0
  199. package/src/flow/NodeEditor.ts +55 -3
  200. package/src/flow/actions/add_contact_urn.ts +1 -1
  201. package/src/flow/actions/set_contact_channel.ts +1 -1
  202. package/src/flow/actions/set_contact_field.ts +2 -1
  203. package/src/flow/actions/set_contact_language.ts +3 -1
  204. package/src/flow/actions/set_contact_name.ts +1 -1
  205. package/src/flow/actions/set_contact_status.ts +18 -18
  206. package/src/flow/actions/set_run_result.ts +1 -1
  207. package/src/flow/nodes/split_by_llm.ts +14 -13
  208. package/src/flow/nodes/wait_for_response.ts +717 -5
  209. package/src/flow/operators.ts +215 -0
  210. package/src/flow/types.ts +10 -2
  211. package/src/form/ArrayEditor.ts +117 -37
  212. package/src/form/Checkbox.ts +12 -0
  213. package/src/form/FieldRenderer.ts +24 -3
  214. package/src/form/TextInput.ts +19 -1
  215. package/src/form/select/Select.ts +7 -0
  216. package/src/interfaces.ts +1 -1
  217. package/src/layout/Dialog.ts +4 -4
  218. package/src/list/RunList.ts +2 -2
  219. package/src/live/ContactChat.ts +144 -58
  220. package/src/live/ContactDetails.ts +7 -0
  221. package/src/live/ContactNameFetch.ts +1 -1
  222. package/static/api/labels.json +6 -1
  223. package/test/NodeHelper.ts +38 -40
  224. package/test/nodes/split_by_llm.test.ts +43 -32
  225. package/test/nodes/split_by_llm_categorize.test.ts +130 -120
  226. package/test/nodes/split_by_random.test.ts +136 -128
  227. package/test/nodes/wait_for_digits.test.ts +147 -127
  228. package/test/nodes/wait_for_response.test.ts +657 -104
  229. package/test/temba-checkbox.test.ts +36 -32
  230. package/test/temba-contact-chat.test.ts +2 -1
  231. package/test/temba-dropdown.test.ts +0 -12
  232. package/test/temba-flow-editor-node.test.ts +11 -4
  233. package/test/temba-integration-markdown.test.ts +16 -17
  234. package/test/temba-node-editor.test.ts +5 -43
  235. package/test/temba-run-list.test.ts +2 -2
  236. package/test/utils.test.ts +2 -1
  237. package/test-assets/list/runs.json +8 -8
  238. package/web-dev-mock.mjs +86 -30
  239. package/web-dev-server.config.mjs +272 -31
  240. package/screenshots/truth/dropdown/bottom-edge-collision.png +0 -0
  241. package/screenshots/truth/dropdown/right-edge-collision.png +0 -0
  242. package/screenshots/truth/editor/send_msg.png +0 -0
  243. package/screenshots/truth/editor/set_contact_language.png +0 -0
  244. package/screenshots/truth/editor/set_contact_name.png +0 -0
  245. package/screenshots/truth/editor/set_run_result.png +0 -0
  246. package/screenshots/truth/integration/checkbox-markdown-errors.png +0 -0
@@ -23,122 +23,130 @@ describe('split_by_random node config', () => {
23
23
  });
24
24
  });
25
25
  describe('node scenarios', () => {
26
- helper.testNode({
27
- uuid: 'test-random-node-1',
28
- actions: [],
29
- router: {
30
- type: 'random',
31
- categories: [
32
- {
33
- uuid: 'random-cat-1',
34
- name: 'Bucket A',
35
- exit_uuid: 'random-exit-1'
36
- },
37
- {
38
- uuid: 'random-cat-2',
39
- name: 'Bucket B',
40
- exit_uuid: 'random-exit-2'
41
- }
26
+ it('renders two bucket split', async () => {
27
+ await helper.testNode({
28
+ uuid: 'test-random-node-1',
29
+ actions: [],
30
+ router: {
31
+ type: 'random',
32
+ categories: [
33
+ {
34
+ uuid: 'random-cat-1',
35
+ name: 'Bucket A',
36
+ exit_uuid: 'random-exit-1'
37
+ },
38
+ {
39
+ uuid: 'random-cat-2',
40
+ name: 'Bucket B',
41
+ exit_uuid: 'random-exit-2'
42
+ }
43
+ ]
44
+ },
45
+ exits: [
46
+ { uuid: 'random-exit-1', destination_uuid: null },
47
+ { uuid: 'random-exit-2', destination_uuid: null }
42
48
  ]
43
- },
44
- exits: [
45
- { uuid: 'random-exit-1', destination_uuid: null },
46
- { uuid: 'random-exit-2', destination_uuid: null }
47
- ]
48
- }, { type: 'split_by_random' }, 'two-bucket-split');
49
- helper.testNode({
50
- uuid: 'test-random-node-2',
51
- actions: [],
52
- router: {
53
- type: 'random',
54
- categories: [
55
- {
56
- uuid: 'random-cat-1',
57
- name: 'Group A',
58
- exit_uuid: 'random-exit-1'
59
- },
60
- {
61
- uuid: 'random-cat-2',
62
- name: 'Group B',
63
- exit_uuid: 'random-exit-2'
64
- },
65
- {
66
- uuid: 'random-cat-3',
67
- name: 'Group C',
68
- exit_uuid: 'random-exit-3'
69
- }
49
+ }, { type: 'split_by_random' }, 'two-bucket-split');
50
+ });
51
+ it('renders three way split', async () => {
52
+ await helper.testNode({
53
+ uuid: 'test-random-node-2',
54
+ actions: [],
55
+ router: {
56
+ type: 'random',
57
+ categories: [
58
+ {
59
+ uuid: 'random-cat-1',
60
+ name: 'Group A',
61
+ exit_uuid: 'random-exit-1'
62
+ },
63
+ {
64
+ uuid: 'random-cat-2',
65
+ name: 'Group B',
66
+ exit_uuid: 'random-exit-2'
67
+ },
68
+ {
69
+ uuid: 'random-cat-3',
70
+ name: 'Group C',
71
+ exit_uuid: 'random-exit-3'
72
+ }
73
+ ]
74
+ },
75
+ exits: [
76
+ { uuid: 'random-exit-1', destination_uuid: null },
77
+ { uuid: 'random-exit-2', destination_uuid: null },
78
+ { uuid: 'random-exit-3', destination_uuid: null }
70
79
  ]
71
- },
72
- exits: [
73
- { uuid: 'random-exit-1', destination_uuid: null },
74
- { uuid: 'random-exit-2', destination_uuid: null },
75
- { uuid: 'random-exit-3', destination_uuid: null }
76
- ]
77
- }, { type: 'split_by_random' }, 'three-way-split');
78
- helper.testNode({
79
- uuid: 'test-random-node-3',
80
- actions: [],
81
- router: {
82
- type: 'random',
83
- categories: [
84
- {
85
- uuid: 'random-cat-1',
86
- name: 'Treatment',
87
- exit_uuid: 'random-exit-1'
88
- },
89
- {
90
- uuid: 'random-cat-2',
91
- name: 'Control',
92
- exit_uuid: 'random-exit-2'
93
- },
94
- {
95
- uuid: 'random-cat-3',
96
- name: 'Variant A',
97
- exit_uuid: 'random-exit-3'
98
- },
99
- {
100
- uuid: 'random-cat-4',
101
- name: 'Variant B',
102
- exit_uuid: 'random-exit-4'
103
- },
104
- {
105
- uuid: 'random-cat-5',
106
- name: 'Holdout',
107
- exit_uuid: 'random-exit-5'
108
- }
80
+ }, { type: 'split_by_random' }, 'three-way-split');
81
+ });
82
+ it('renders ab test multiple variants', async () => {
83
+ await helper.testNode({
84
+ uuid: 'test-random-node-3',
85
+ actions: [],
86
+ router: {
87
+ type: 'random',
88
+ categories: [
89
+ {
90
+ uuid: 'random-cat-1',
91
+ name: 'Treatment',
92
+ exit_uuid: 'random-exit-1'
93
+ },
94
+ {
95
+ uuid: 'random-cat-2',
96
+ name: 'Control',
97
+ exit_uuid: 'random-exit-2'
98
+ },
99
+ {
100
+ uuid: 'random-cat-3',
101
+ name: 'Variant A',
102
+ exit_uuid: 'random-exit-3'
103
+ },
104
+ {
105
+ uuid: 'random-cat-4',
106
+ name: 'Variant B',
107
+ exit_uuid: 'random-exit-4'
108
+ },
109
+ {
110
+ uuid: 'random-cat-5',
111
+ name: 'Holdout',
112
+ exit_uuid: 'random-exit-5'
113
+ }
114
+ ]
115
+ },
116
+ exits: [
117
+ { uuid: 'random-exit-1', destination_uuid: null },
118
+ { uuid: 'random-exit-2', destination_uuid: null },
119
+ { uuid: 'random-exit-3', destination_uuid: null },
120
+ { uuid: 'random-exit-4', destination_uuid: null },
121
+ { uuid: 'random-exit-5', destination_uuid: null }
109
122
  ]
110
- },
111
- exits: [
112
- { uuid: 'random-exit-1', destination_uuid: null },
113
- { uuid: 'random-exit-2', destination_uuid: null },
114
- { uuid: 'random-exit-3', destination_uuid: null },
115
- { uuid: 'random-exit-4', destination_uuid: null },
116
- { uuid: 'random-exit-5', destination_uuid: null }
117
- ]
118
- }, { type: 'split_by_random' }, 'ab-test-multiple-variants');
119
- helper.testNode({
120
- uuid: 'test-random-node-4',
121
- actions: [],
122
- router: {
123
- type: 'random',
124
- categories: [
125
- {
126
- uuid: 'random-cat-1',
127
- name: 'Sample Group',
128
- exit_uuid: 'random-exit-1'
129
- },
130
- {
131
- uuid: 'random-cat-2',
132
- name: 'Remaining Population',
133
- exit_uuid: 'random-exit-2'
134
- }
123
+ }, { type: 'split_by_random' }, 'ab-test-multiple-variants');
124
+ });
125
+ it('renders sampling split', async () => {
126
+ await helper.testNode({
127
+ uuid: 'test-random-node-4',
128
+ actions: [],
129
+ router: {
130
+ type: 'random',
131
+ categories: [
132
+ {
133
+ uuid: 'random-cat-1',
134
+ name: 'Sample Group',
135
+ exit_uuid: 'random-exit-1'
136
+ },
137
+ {
138
+ uuid: 'random-cat-2',
139
+ name: 'Remaining Population',
140
+ exit_uuid: 'random-exit-2'
141
+ }
142
+ ]
143
+ },
144
+ exits: [
145
+ { uuid: 'random-exit-1', destination_uuid: null },
146
+ { uuid: 'random-exit-2', destination_uuid: null }
135
147
  ]
136
- },
137
- exits: [
138
- { uuid: 'random-exit-1', destination_uuid: null },
139
- { uuid: 'random-exit-2', destination_uuid: null }
140
- ]
141
- }, { type: 'split_by_random' }, 'sampling-split');
148
+ }, { type: 'split_by_random' }, 'sampling-split');
149
+ });
142
150
  });
143
151
  });
144
152
  //# sourceMappingURL=split_by_random.test.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"split_by_random.test.js","sourceRoot":"","sources":["../../../test/nodes/split_by_random.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,CA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BAAgB,EAAE,IAAI,EAAE;gBACjD,EAAE,IAAI,EAAE,eAAe,EAAE,gBAAgB,EAAE,IAAI,EAAE;gBACjD,EAAE,IAAI,EAAE,eAAe,EAAE,gBAAgB,EAAE,IAAI,EAAE;aAClD;SACM,EACT,EAAE,IAAI,EAAE,iBAAiB,EAAE,EAC3B,2BAA2B,CAC5B,CAAC;QAEF,MAAM,CAAC,QAAQ,CACb;YACE,IAAI,EAAE,oBAAoB;YAC1B,OAAO,EAAE,EAAE;YACX,MAAM,EAAE;gBACN,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE;oBACV;wBACE,IAAI,EAAE,cAAc;wBACpB,IAAI,EAAE,cAAc;wBACpB,SAAS,EAAE,eAAe;qBAC3B;oBACD;wBACE,IAAI,EAAE,cAAc;wBACpB,IAAI,EAAE,sBAAsB;wBAC5B,SAAS,EAAE,eAAe;qBAC3B;iBACF;aACF;YACD,KAAK,EAAE;gBACL,EAAE,IAAI,EAAE,eAAe,EAAE,gBAAgB,EAAE,IAAI,EAAE;gBACjD,EAAE,IAAI,EAAE,eAAe,EAAE,gBAAgB,EAAE,IAAI,EAAE;aAClD;SACM,EACT,EAAE,IAAI,EAAE,iBAAiB,EAAE,EAC3B,gBAAgB,CACjB,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { expect } from '@open-wc/testing';\nimport { split_by_random } from '../../src/flow/nodes/split_by_random';\nimport { Node } from '../../src/store/flow-definition';\nimport { NodeTest } from '../NodeHelper';\n\n/**\n * Test suite for the split_by_random node configuration.\n */\ndescribe('split_by_random node config', () => {\n const helper = new NodeTest(split_by_random, 'split_by_random');\n\n describe('basic properties', () => {\n helper.testBasicProperties();\n\n it('has correct name', () => {\n expect(split_by_random.name).to.equal('Split by Random');\n });\n\n it('has correct type', () => {\n expect(split_by_random.type).to.equal('split_by_random');\n });\n\n it('has correct color', () => {\n expect(split_by_random.color).to.exist;\n });\n\n it('has router configuration', () => {\n expect(split_by_random.router).to.exist;\n expect(split_by_random.router.type).to.equal('random');\n });\n });\n\n describe('node scenarios', () => {\n helper.testNode(\n {\n uuid: 'test-random-node-1',\n actions: [],\n router: {\n type: 'random',\n categories: [\n {\n uuid: 'random-cat-1',\n name: 'Bucket A',\n exit_uuid: 'random-exit-1'\n },\n {\n uuid: 'random-cat-2',\n name: 'Bucket B',\n exit_uuid: 'random-exit-2'\n }\n ]\n },\n exits: [\n { uuid: 'random-exit-1', destination_uuid: null },\n { uuid: 'random-exit-2', destination_uuid: null }\n ]\n } as Node,\n { type: 'split_by_random' },\n 'two-bucket-split'\n );\n\n helper.testNode(\n {\n uuid: 'test-random-node-2',\n actions: [],\n router: {\n type: 'random',\n categories: [\n {\n uuid: 'random-cat-1',\n name: 'Group A',\n exit_uuid: 'random-exit-1'\n },\n {\n uuid: 'random-cat-2',\n name: 'Group B',\n exit_uuid: 'random-exit-2'\n },\n {\n uuid: 'random-cat-3',\n name: 'Group C',\n exit_uuid: 'random-exit-3'\n }\n ]\n },\n exits: [\n { uuid: 'random-exit-1', destination_uuid: null },\n { uuid: 'random-exit-2', destination_uuid: null },\n { uuid: 'random-exit-3', destination_uuid: null }\n ]\n } as Node,\n { type: 'split_by_random' },\n 'three-way-split'\n );\n\n helper.testNode(\n {\n uuid: 'test-random-node-3',\n actions: [],\n router: {\n type: 'random',\n categories: [\n {\n uuid: 'random-cat-1',\n name: 'Treatment',\n exit_uuid: 'random-exit-1'\n },\n {\n uuid: 'random-cat-2',\n name: 'Control',\n exit_uuid: 'random-exit-2'\n },\n {\n uuid: 'random-cat-3',\n name: 'Variant A',\n exit_uuid: 'random-exit-3'\n },\n {\n uuid: 'random-cat-4',\n name: 'Variant B',\n exit_uuid: 'random-exit-4'\n },\n {\n uuid: 'random-cat-5',\n name: 'Holdout',\n exit_uuid: 'random-exit-5'\n }\n ]\n },\n exits: [\n { uuid: 'random-exit-1', destination_uuid: null },\n { uuid: 'random-exit-2', destination_uuid: null },\n { uuid: 'random-exit-3', destination_uuid: null },\n { uuid: 'random-exit-4', destination_uuid: null },\n { uuid: 'random-exit-5', destination_uuid: null }\n ]\n } as Node,\n { type: 'split_by_random' },\n 'ab-test-multiple-variants'\n );\n\n helper.testNode(\n {\n uuid: 'test-random-node-4',\n actions: [],\n router: {\n type: 'random',\n categories: [\n {\n uuid: 'random-cat-1',\n name: 'Sample Group',\n exit_uuid: 'random-exit-1'\n },\n {\n uuid: 'random-cat-2',\n name: 'Remaining Population',\n exit_uuid: 'random-exit-2'\n }\n ]\n },\n exits: [\n { uuid: 'random-exit-1', destination_uuid: null },\n { uuid: 'random-exit-2', destination_uuid: null }\n ]\n } as Node,\n { type: 'split_by_random' },\n 'sampling-split'\n );\n });\n});\n"]}
1
+ {"version":3,"file":"split_by_random.test.js","sourceRoot":"","sources":["../../../test/nodes/split_by_random.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,CA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/testing';\nimport { split_by_random } from '../../src/flow/nodes/split_by_random';\nimport { Node } from '../../src/store/flow-definition';\nimport { NodeTest } from '../NodeHelper';\n\n/**\n * Test suite for the split_by_random node configuration.\n */\ndescribe('split_by_random node config', () => {\n const helper = new NodeTest(split_by_random, 'split_by_random');\n\n describe('basic properties', () => {\n helper.testBasicProperties();\n\n it('has correct name', () => {\n expect(split_by_random.name).to.equal('Split by Random');\n });\n\n it('has correct type', () => {\n expect(split_by_random.type).to.equal('split_by_random');\n });\n\n it('has correct color', () => {\n expect(split_by_random.color).to.exist;\n });\n\n it('has router configuration', () => {\n expect(split_by_random.router).to.exist;\n expect(split_by_random.router.type).to.equal('random');\n });\n });\n\n describe('node scenarios', () => {\n it('renders two bucket split', async () => {\n await helper.testNode(\n {\n uuid: 'test-random-node-1',\n actions: [],\n router: {\n type: 'random',\n categories: [\n {\n uuid: 'random-cat-1',\n name: 'Bucket A',\n exit_uuid: 'random-exit-1'\n },\n {\n uuid: 'random-cat-2',\n name: 'Bucket B',\n exit_uuid: 'random-exit-2'\n }\n ]\n },\n exits: [\n { uuid: 'random-exit-1', destination_uuid: null },\n { uuid: 'random-exit-2', destination_uuid: null }\n ]\n } as Node,\n { type: 'split_by_random' },\n 'two-bucket-split'\n );\n });\n\n it('renders three way split', async () => {\n await helper.testNode(\n {\n uuid: 'test-random-node-2',\n actions: [],\n router: {\n type: 'random',\n categories: [\n {\n uuid: 'random-cat-1',\n name: 'Group A',\n exit_uuid: 'random-exit-1'\n },\n {\n uuid: 'random-cat-2',\n name: 'Group B',\n exit_uuid: 'random-exit-2'\n },\n {\n uuid: 'random-cat-3',\n name: 'Group C',\n exit_uuid: 'random-exit-3'\n }\n ]\n },\n exits: [\n { uuid: 'random-exit-1', destination_uuid: null },\n { uuid: 'random-exit-2', destination_uuid: null },\n { uuid: 'random-exit-3', destination_uuid: null }\n ]\n } as Node,\n { type: 'split_by_random' },\n 'three-way-split'\n );\n });\n\n it('renders ab test multiple variants', async () => {\n await helper.testNode(\n {\n uuid: 'test-random-node-3',\n actions: [],\n router: {\n type: 'random',\n categories: [\n {\n uuid: 'random-cat-1',\n name: 'Treatment',\n exit_uuid: 'random-exit-1'\n },\n {\n uuid: 'random-cat-2',\n name: 'Control',\n exit_uuid: 'random-exit-2'\n },\n {\n uuid: 'random-cat-3',\n name: 'Variant A',\n exit_uuid: 'random-exit-3'\n },\n {\n uuid: 'random-cat-4',\n name: 'Variant B',\n exit_uuid: 'random-exit-4'\n },\n {\n uuid: 'random-cat-5',\n name: 'Holdout',\n exit_uuid: 'random-exit-5'\n }\n ]\n },\n exits: [\n { uuid: 'random-exit-1', destination_uuid: null },\n { uuid: 'random-exit-2', destination_uuid: null },\n { uuid: 'random-exit-3', destination_uuid: null },\n { uuid: 'random-exit-4', destination_uuid: null },\n { uuid: 'random-exit-5', destination_uuid: null }\n ]\n } as Node,\n { type: 'split_by_random' },\n 'ab-test-multiple-variants'\n );\n });\n\n it('renders sampling split', async () => {\n await helper.testNode(\n {\n uuid: 'test-random-node-4',\n actions: [],\n router: {\n type: 'random',\n categories: [\n {\n uuid: 'random-cat-1',\n name: 'Sample Group',\n exit_uuid: 'random-exit-1'\n },\n {\n uuid: 'random-cat-2',\n name: 'Remaining Population',\n exit_uuid: 'random-exit-2'\n }\n ]\n },\n exits: [\n { uuid: 'random-exit-1', destination_uuid: null },\n { uuid: 'random-exit-2', destination_uuid: null }\n ]\n } as Node,\n { type: 'split_by_random' },\n 'sampling-split'\n );\n });\n });\n});\n"]}
@@ -25,126 +25,146 @@ describe('wait_for_digits node config', () => {
25
25
  });
26
26
  });
27
27
  describe('node scenarios', () => {
28
- helper.testNode({
29
- uuid: 'test-digits-node-1',
30
- actions: [],
31
- router: {
32
- type: 'switch',
33
- wait: {
34
- type: 'msg',
35
- hint: {
36
- type: 'digits',
37
- count: 4
38
- }
39
- },
40
- result_name: 'digits',
41
- categories: [
42
- {
43
- uuid: 'digits-cat-1',
44
- name: 'Has Number',
45
- exit_uuid: 'digits-exit-1'
28
+ it('renders basic digits wait', async () => {
29
+ await helper.testNode({
30
+ uuid: 'test-digits-node-1',
31
+ actions: [],
32
+ router: {
33
+ type: 'switch',
34
+ wait: {
35
+ type: 'msg',
36
+ hint: {
37
+ type: 'digits',
38
+ count: 4
39
+ }
46
40
  },
47
- { uuid: 'digits-cat-2', name: 'Other', exit_uuid: 'digits-exit-2' }
41
+ result_name: 'digits',
42
+ categories: [
43
+ {
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'
52
+ }
53
+ ]
54
+ },
55
+ exits: [
56
+ { uuid: 'digits-exit-1', destination_uuid: null },
57
+ { uuid: 'digits-exit-2', destination_uuid: null }
48
58
  ]
49
- },
50
- exits: [
51
- { uuid: 'digits-exit-1', destination_uuid: null },
52
- { uuid: 'digits-exit-2', destination_uuid: null }
53
- ]
54
- }, { type: 'wait_for_digits' }, 'basic-digits-wait');
55
- helper.testNode({
56
- uuid: 'test-digits-node-2',
57
- actions: [],
58
- router: {
59
- type: 'switch',
60
- wait: {
61
- type: 'msg',
62
- hint: {
63
- type: 'digits',
64
- count: 1
59
+ }, { type: 'wait_for_digits' }, 'basic-digits-wait');
60
+ });
61
+ it('renders single digit with timeout', async () => {
62
+ await helper.testNode({
63
+ uuid: 'test-digits-node-2',
64
+ actions: [],
65
+ router: {
66
+ type: 'switch',
67
+ wait: {
68
+ type: 'msg',
69
+ hint: {
70
+ type: 'digits',
71
+ count: 1
72
+ },
73
+ timeout: {
74
+ category_uuid: 'timeout-cat',
75
+ seconds: 30
76
+ }
65
77
  },
66
- timeout: {
67
- category_uuid: 'timeout-cat',
68
- seconds: 30
69
- }
78
+ result_name: 'pin_digit',
79
+ categories: [
80
+ {
81
+ uuid: 'digits-cat-1',
82
+ name: 'Has Number',
83
+ exit_uuid: 'digits-exit-1'
84
+ },
85
+ {
86
+ uuid: 'timeout-cat',
87
+ name: 'No Response',
88
+ exit_uuid: 'timeout-exit'
89
+ },
90
+ {
91
+ uuid: 'digits-cat-2',
92
+ name: 'Other',
93
+ exit_uuid: 'digits-exit-2'
94
+ }
95
+ ]
70
96
  },
71
- result_name: 'pin_digit',
72
- categories: [
73
- {
74
- uuid: 'digits-cat-1',
75
- name: 'Has Number',
76
- exit_uuid: 'digits-exit-1'
77
- },
78
- {
79
- uuid: 'timeout-cat',
80
- name: 'No Response',
81
- exit_uuid: 'timeout-exit'
82
- },
83
- { uuid: 'digits-cat-2', name: 'Other', exit_uuid: 'digits-exit-2' }
97
+ exits: [
98
+ { uuid: 'digits-exit-1', destination_uuid: null },
99
+ { uuid: 'timeout-exit', destination_uuid: null },
100
+ { uuid: 'digits-exit-2', destination_uuid: null }
84
101
  ]
85
- },
86
- exits: [
87
- { uuid: 'digits-exit-1', destination_uuid: null },
88
- { uuid: 'timeout-exit', destination_uuid: null },
89
- { uuid: 'digits-exit-2', destination_uuid: null }
90
- ]
91
- }, { type: 'wait_for_digits' }, 'single-digit-with-timeout');
92
- helper.testNode({
93
- uuid: 'test-digits-node-3',
94
- actions: [],
95
- router: {
96
- type: 'switch',
97
- wait: {
98
- type: 'msg',
99
- hint: {
100
- type: 'digits',
101
- count: 10
102
- }
103
- },
104
- result_name: 'phone_number',
105
- categories: [
106
- {
107
- uuid: 'phone-cat-1',
108
- name: 'Valid Phone',
109
- exit_uuid: 'phone-exit-1'
102
+ }, { type: 'wait_for_digits' }, 'single-digit-with-timeout');
103
+ });
104
+ it('renders phone number collection', async () => {
105
+ await helper.testNode({
106
+ uuid: 'test-digits-node-3',
107
+ actions: [],
108
+ router: {
109
+ type: 'switch',
110
+ wait: {
111
+ type: 'msg',
112
+ hint: {
113
+ type: 'digits',
114
+ count: 10
115
+ }
110
116
  },
111
- { uuid: 'phone-cat-2', name: 'Invalid', exit_uuid: 'phone-exit-2' },
112
- { uuid: 'phone-cat-3', name: 'Other', exit_uuid: 'phone-exit-3' }
113
- ]
114
- },
115
- exits: [
116
- { uuid: 'phone-exit-1', destination_uuid: null },
117
- { uuid: 'phone-exit-2', destination_uuid: null },
118
- { uuid: 'phone-exit-3', destination_uuid: null }
119
- ]
120
- }, { type: 'wait_for_digits' }, 'phone-number-collection');
121
- helper.testNode({
122
- uuid: 'test-digits-node-4',
123
- actions: [],
124
- router: {
125
- type: 'switch',
126
- wait: {
127
- type: 'msg',
128
- hint: {
129
- type: 'digits',
130
- count: 6
131
- }
117
+ result_name: 'phone_number',
118
+ categories: [
119
+ {
120
+ uuid: 'phone-cat-1',
121
+ name: 'Valid Phone',
122
+ exit_uuid: 'phone-exit-1'
123
+ },
124
+ {
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' }
130
+ ]
132
131
  },
133
- result_name: 'verification_code',
134
- categories: [
135
- {
136
- uuid: 'code-cat-1',
137
- name: 'Valid Code',
138
- exit_uuid: 'code-exit-1'
132
+ 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 }
136
+ ]
137
+ }, { type: 'wait_for_digits' }, 'phone-number-collection');
138
+ });
139
+ it('renders verification code', async () => {
140
+ await helper.testNode({
141
+ uuid: 'test-digits-node-4',
142
+ actions: [],
143
+ router: {
144
+ type: 'switch',
145
+ wait: {
146
+ type: 'msg',
147
+ hint: {
148
+ type: 'digits',
149
+ count: 6
150
+ }
139
151
  },
140
- { uuid: 'code-cat-2', name: 'Other', exit_uuid: 'code-exit-2' }
152
+ result_name: 'verification_code',
153
+ categories: [
154
+ {
155
+ uuid: 'code-cat-1',
156
+ name: 'Valid Code',
157
+ exit_uuid: 'code-exit-1'
158
+ },
159
+ { uuid: 'code-cat-2', name: 'Other', exit_uuid: 'code-exit-2' }
160
+ ]
161
+ },
162
+ exits: [
163
+ { uuid: 'code-exit-1', destination_uuid: null },
164
+ { uuid: 'code-exit-2', destination_uuid: null }
141
165
  ]
142
- },
143
- exits: [
144
- { uuid: 'code-exit-1', destination_uuid: null },
145
- { uuid: 'code-exit-2', destination_uuid: null }
146
- ]
147
- }, { type: 'wait_for_digits' }, 'verification-code');
166
+ }, { type: 'wait_for_digits' }, 'verification-code');
167
+ });
148
168
  });
149
169
  });
150
170
  //# sourceMappingURL=wait_for_digits.test.js.map
@@ -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,eAAe,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,KAA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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 color', () => {\n expect(wait_for_digits.color).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 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 { uuid: 'digits-cat-2', name: 'Other', exit_uuid: 'digits-exit-2' }\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 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 { uuid: 'digits-cat-2', name: 'Other', exit_uuid: 'digits-exit-2' }\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 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 { uuid: 'phone-cat-2', name: 'Invalid', exit_uuid: 'phone-exit-2' },\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 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"]}
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,kBAA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E;qBAClE;iBACF;gBACD,KAAK,EAAE;oBACL,EAAE,IAAI,EAAE,cAAc,EAAE,gBAAgB,EAAE,IAAI,EAAE;oBAChD,EAAE,IAAI,EAAE,cAAc,EAAE,gBAAgB,EAAE,IAAI,EAAE;oBAChD,EAAE,IAAI,EAAE,cAAc,EAAE,gBAAgB,EAAE,IAAI,EAAE;iBACjD;aACM,EACT,EAAE,IAAI,EAAE,iBAAiB,EAAE,EAC3B,yBAAyB,CAC1B,CAAC;QACJ,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,2BAA2B,EAAE,KAAK,IAAI,EAAE;YACzC,MAAM,MAAM,CAAC,QAAQ,CACnB;gBACE,IAAI,EAAE,oBAAoB;gBAC1B,OAAO,EAAE,EAAE;gBACX,MAAM,EAAE;oBACN,IAAI,EAAE,QAAQ;oBACd,IAAI,EAAE;wBACJ,IAAI,EAAE,KAAK;wBACX,IAAI,EAAE;4BACJ,IAAI,EAAE,QAAQ;4BACd,KAAK,EAAE,CAAC;yBACT;qBACF;oBACD,WAAW,EAAE,mBAAmB;oBAChC,UAAU,EAAE;wBACV;4BACE,IAAI,EAAE,YAAY;4BAClB,IAAI,EAAE,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 color', () => {\n expect(wait_for_digits.color).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"]}