@nyaruka/temba-components 0.129.8 → 0.129.10

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 (282) hide show
  1. package/CHANGELOG.md +37 -3
  2. package/demo/data/flows/sample-flow.json +186 -96
  3. package/demo/test-colorpicker.html +30 -0
  4. package/dist/temba-components.js +1126 -1111
  5. package/dist/temba-components.js.map +1 -1
  6. package/out-tsc/src/events.js.map +1 -1
  7. package/out-tsc/src/excellent/helpers.js +2 -2
  8. package/out-tsc/src/excellent/helpers.js.map +1 -1
  9. package/out-tsc/src/flow/CanvasNode.js +25 -7
  10. package/out-tsc/src/flow/CanvasNode.js.map +1 -1
  11. package/out-tsc/src/flow/Editor.js +11 -1
  12. package/out-tsc/src/flow/Editor.js.map +1 -1
  13. package/out-tsc/src/flow/NodeEditor.js +133 -290
  14. package/out-tsc/src/flow/NodeEditor.js.map +1 -1
  15. package/out-tsc/src/flow/actions/add_input_labels.js +40 -0
  16. package/out-tsc/src/flow/actions/add_input_labels.js.map +1 -1
  17. package/out-tsc/src/flow/actions/call_llm.js +56 -3
  18. package/out-tsc/src/flow/actions/call_llm.js.map +1 -1
  19. package/out-tsc/src/flow/actions/call_webhook.js +1 -1
  20. package/out-tsc/src/flow/actions/call_webhook.js.map +1 -1
  21. package/out-tsc/src/flow/actions/open_ticket.js +65 -3
  22. package/out-tsc/src/flow/actions/open_ticket.js.map +1 -1
  23. package/out-tsc/src/flow/actions/set_run_result.js +75 -0
  24. package/out-tsc/src/flow/actions/set_run_result.js.map +1 -1
  25. package/out-tsc/src/flow/config.js +4 -0
  26. package/out-tsc/src/flow/config.js.map +1 -1
  27. package/out-tsc/src/flow/nodes/split_by_llm_categorize.js +227 -0
  28. package/out-tsc/src/flow/nodes/split_by_llm_categorize.js.map +1 -0
  29. package/out-tsc/src/flow/nodes/split_by_ticket.js +18 -0
  30. package/out-tsc/src/flow/nodes/split_by_ticket.js.map +1 -0
  31. package/out-tsc/src/flow/nodes/wait_for_response.js +27 -1
  32. package/out-tsc/src/flow/nodes/wait_for_response.js.map +1 -1
  33. package/out-tsc/src/flow/types.js +0 -65
  34. package/out-tsc/src/flow/types.js.map +1 -1
  35. package/out-tsc/src/form/ArrayEditor.js +63 -117
  36. package/out-tsc/src/form/ArrayEditor.js.map +1 -1
  37. package/out-tsc/src/form/BaseListEditor.js +4 -3
  38. package/out-tsc/src/form/BaseListEditor.js.map +1 -1
  39. package/out-tsc/src/form/Checkbox.js +77 -24
  40. package/out-tsc/src/form/Checkbox.js.map +1 -1
  41. package/out-tsc/src/form/ColorPicker.js +28 -40
  42. package/out-tsc/src/form/ColorPicker.js.map +1 -1
  43. package/out-tsc/src/form/Completion.js +44 -53
  44. package/out-tsc/src/form/Completion.js.map +1 -1
  45. package/out-tsc/src/form/Compose.js +7 -8
  46. package/out-tsc/src/form/Compose.js.map +1 -1
  47. package/out-tsc/src/form/ContactSearch.js +3 -4
  48. package/out-tsc/src/form/ContactSearch.js.map +1 -1
  49. package/out-tsc/src/form/DatePicker.js +29 -36
  50. package/out-tsc/src/form/DatePicker.js.map +1 -1
  51. package/out-tsc/src/form/{FormField.js → FieldElement.js} +81 -53
  52. package/out-tsc/src/form/FieldElement.js.map +1 -0
  53. package/out-tsc/src/form/FieldRenderer.js +306 -0
  54. package/out-tsc/src/form/FieldRenderer.js.map +1 -0
  55. package/out-tsc/src/form/ImagePicker.js +122 -126
  56. package/out-tsc/src/form/ImagePicker.js.map +1 -1
  57. package/out-tsc/src/form/KeyValueEditor.js +41 -37
  58. package/out-tsc/src/form/KeyValueEditor.js.map +1 -1
  59. package/out-tsc/src/form/MessageEditor.js +55 -63
  60. package/out-tsc/src/form/MessageEditor.js.map +1 -1
  61. package/out-tsc/src/form/TembaSlider.js +3 -3
  62. package/out-tsc/src/form/TembaSlider.js.map +1 -1
  63. package/out-tsc/src/form/TemplateEditor.js +3 -3
  64. package/out-tsc/src/form/TemplateEditor.js.map +1 -1
  65. package/out-tsc/src/form/TextInput.js +23 -27
  66. package/out-tsc/src/form/TextInput.js.map +1 -1
  67. package/out-tsc/src/form/select/Select.js +57 -35
  68. package/out-tsc/src/form/select/Select.js.map +1 -1
  69. package/out-tsc/src/form/select/UserSelect.js +8 -9
  70. package/out-tsc/src/form/select/UserSelect.js.map +1 -1
  71. package/out-tsc/src/form/select/WorkspaceSelect.js +7 -8
  72. package/out-tsc/src/form/select/WorkspaceSelect.js.map +1 -1
  73. package/out-tsc/src/live/ContactChat.js +62 -44
  74. package/out-tsc/src/live/ContactChat.js.map +1 -1
  75. package/out-tsc/src/live/ContactFieldEditor.js.map +1 -1
  76. package/out-tsc/src/markdown.js +13 -11
  77. package/out-tsc/src/markdown.js.map +1 -1
  78. package/out-tsc/temba-modules.js +3 -2
  79. package/out-tsc/temba-modules.js.map +1 -1
  80. package/out-tsc/test/ActionHelper.js +2 -0
  81. package/out-tsc/test/ActionHelper.js.map +1 -1
  82. package/out-tsc/test/NodeHelper.js +148 -0
  83. package/out-tsc/test/NodeHelper.js.map +1 -0
  84. package/out-tsc/test/actions/call_llm.test.js +103 -0
  85. package/out-tsc/test/actions/call_llm.test.js.map +1 -0
  86. package/out-tsc/test/nodes/split_by_llm_categorize.test.js +532 -0
  87. package/out-tsc/test/nodes/split_by_llm_categorize.test.js.map +1 -0
  88. package/out-tsc/test/nodes/split_by_random.test.js +150 -0
  89. package/out-tsc/test/nodes/split_by_random.test.js.map +1 -0
  90. package/out-tsc/test/nodes/wait_for_digits.test.js +150 -0
  91. package/out-tsc/test/nodes/wait_for_digits.test.js.map +1 -0
  92. package/out-tsc/test/nodes/wait_for_response.test.js +171 -0
  93. package/out-tsc/test/nodes/wait_for_response.test.js.map +1 -0
  94. package/out-tsc/test/temba-add-input-labels.test.js +70 -0
  95. package/out-tsc/test/temba-add-input-labels.test.js.map +1 -0
  96. package/out-tsc/test/temba-checkbox.test.js +16 -0
  97. package/out-tsc/test/temba-checkbox.test.js.map +1 -1
  98. package/out-tsc/test/temba-field-renderer.test.js +296 -0
  99. package/out-tsc/test/temba-field-renderer.test.js.map +1 -0
  100. package/out-tsc/test/temba-integration-markdown.test.js +2 -4
  101. package/out-tsc/test/temba-integration-markdown.test.js.map +1 -1
  102. package/out-tsc/test/temba-markdown.test.js +1 -1
  103. package/out-tsc/test/temba-markdown.test.js.map +1 -1
  104. package/out-tsc/test/temba-node-editor.test.js +400 -0
  105. package/out-tsc/test/temba-node-editor.test.js.map +1 -1
  106. package/out-tsc/test/temba-select.test.js +6 -3
  107. package/out-tsc/test/temba-select.test.js.map +1 -1
  108. package/out-tsc/test/temba-slider.test.js +0 -1
  109. package/out-tsc/test/temba-slider.test.js.map +1 -1
  110. package/out-tsc/test/temba-webchat.test.js +1 -1
  111. package/out-tsc/test/temba-webchat.test.js.map +1 -1
  112. package/package.json +1 -1
  113. package/screenshots/truth/actions/add_contact_groups/editor/descriptive-group-names.png +0 -0
  114. package/screenshots/truth/actions/add_contact_groups/editor/long-group-names.png +0 -0
  115. package/screenshots/truth/actions/add_contact_groups/editor/many-groups.png +0 -0
  116. package/screenshots/truth/actions/call_llm/editor/information-extraction.png +0 -0
  117. package/screenshots/truth/actions/call_llm/editor/sentiment-analysis.png +0 -0
  118. package/screenshots/truth/actions/call_llm/editor/summarization.png +0 -0
  119. package/screenshots/truth/actions/call_llm/editor/translation-task.png +0 -0
  120. package/screenshots/truth/actions/call_llm/render/information-extraction.png +0 -0
  121. package/screenshots/truth/actions/call_llm/render/sentiment-analysis.png +0 -0
  122. package/screenshots/truth/actions/call_llm/render/summarization.png +0 -0
  123. package/screenshots/truth/actions/call_llm/render/translation-task.png +0 -0
  124. package/screenshots/truth/actions/remove_contact_groups/editor/cleanup-groups.png +0 -0
  125. package/screenshots/truth/actions/remove_contact_groups/editor/long-descriptive-group-names.png +0 -0
  126. package/screenshots/truth/actions/remove_contact_groups/editor/many-groups.png +0 -0
  127. package/screenshots/truth/actions/remove_contact_groups/editor/multiple-groups.png +0 -0
  128. package/screenshots/truth/actions/remove_contact_groups/editor/remove-from-all-groups.png +0 -0
  129. package/screenshots/truth/actions/remove_contact_groups/editor/single-group.png +0 -0
  130. package/screenshots/truth/actions/send_email/editor/complex-business-email.png +0 -0
  131. package/screenshots/truth/actions/send_email/editor/multiple-recipients.png +0 -0
  132. package/screenshots/truth/actions/send_msg/editor/long-quick-replies.png +0 -0
  133. package/screenshots/truth/actions/send_msg/editor/multiline-text-with-replies.png +0 -0
  134. package/screenshots/truth/actions/send_msg/editor/simple-text.png +0 -0
  135. package/screenshots/truth/actions/send_msg/editor/text-with-linebreaks.png +0 -0
  136. package/screenshots/truth/actions/send_msg/editor/text-with-many-quick-replies.png +0 -0
  137. package/screenshots/truth/actions/send_msg/editor/text-with-quick-replies.png +0 -0
  138. package/screenshots/truth/actions/send_msg/editor/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-no-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/colorpicker/default.png +0 -0
  145. package/screenshots/truth/colorpicker/focused.png +0 -0
  146. package/screenshots/truth/colorpicker/initialized.png +0 -0
  147. package/screenshots/truth/colorpicker/selected.png +0 -0
  148. package/screenshots/truth/editor/router.png +0 -0
  149. package/screenshots/truth/editor/send_msg.png +0 -0
  150. package/screenshots/truth/editor/set_contact_language.png +0 -0
  151. package/screenshots/truth/editor/set_contact_name.png +0 -0
  152. package/screenshots/truth/editor/set_run_result.png +0 -0
  153. package/screenshots/truth/editor/wait.png +0 -0
  154. package/screenshots/truth/field-renderer/checkbox-checked.png +0 -0
  155. package/screenshots/truth/field-renderer/checkbox-unchecked.png +0 -0
  156. package/screenshots/truth/field-renderer/checkbox-with-errors.png +0 -0
  157. package/screenshots/truth/field-renderer/context-comparison.png +0 -0
  158. package/screenshots/truth/field-renderer/key-value-with-label.png +0 -0
  159. package/screenshots/truth/field-renderer/message-editor-with-label.png +0 -0
  160. package/screenshots/truth/field-renderer/select-multi.png +0 -0
  161. package/screenshots/truth/field-renderer/select-no-label.png +0 -0
  162. package/screenshots/truth/field-renderer/select-with-label.png +0 -0
  163. package/screenshots/truth/field-renderer/text-evaluated.png +0 -0
  164. package/screenshots/truth/field-renderer/text-no-label.png +0 -0
  165. package/screenshots/truth/field-renderer/text-with-errors.png +0 -0
  166. package/screenshots/truth/field-renderer/text-with-label.png +0 -0
  167. package/screenshots/truth/field-renderer/textarea-evaluated.png +0 -0
  168. package/screenshots/truth/field-renderer/textarea-with-label.png +0 -0
  169. package/screenshots/truth/integration/checkbox-markdown-errors.png +0 -0
  170. package/screenshots/truth/nodes/split_by_llm_categorize/editor/basic-categorization.png +0 -0
  171. package/screenshots/truth/nodes/split_by_llm_categorize/editor/custom-input-and-result-name.png +0 -0
  172. package/screenshots/truth/nodes/split_by_llm_categorize/editor/feedback-categorization.png +0 -0
  173. package/screenshots/truth/nodes/split_by_llm_categorize/editor/many-categories.png +0 -0
  174. package/screenshots/truth/nodes/split_by_llm_categorize/editor/minimal-categories.png +0 -0
  175. package/screenshots/truth/nodes/split_by_llm_categorize/render/basic-categorization.png +0 -0
  176. package/screenshots/truth/nodes/split_by_llm_categorize/render/custom-input-and-result-name.png +0 -0
  177. package/screenshots/truth/nodes/split_by_llm_categorize/render/feedback-categorization.png +0 -0
  178. package/screenshots/truth/nodes/split_by_llm_categorize/render/many-categories.png +0 -0
  179. package/screenshots/truth/nodes/split_by_llm_categorize/render/minimal-categories.png +0 -0
  180. package/screenshots/truth/nodes/split_by_random/editor/ab-test-multiple-variants.png +0 -0
  181. package/screenshots/truth/nodes/split_by_random/editor/sampling-split.png +0 -0
  182. package/screenshots/truth/nodes/split_by_random/editor/three-way-split.png +0 -0
  183. package/screenshots/truth/nodes/split_by_random/editor/two-bucket-split.png +0 -0
  184. package/screenshots/truth/nodes/split_by_random/render/ab-test-multiple-variants.png +0 -0
  185. package/screenshots/truth/nodes/split_by_random/render/sampling-split.png +0 -0
  186. package/screenshots/truth/nodes/split_by_random/render/three-way-split.png +0 -0
  187. package/screenshots/truth/nodes/split_by_random/render/two-bucket-split.png +0 -0
  188. package/screenshots/truth/nodes/wait_for_digits/editor/basic-digits-wait.png +0 -0
  189. package/screenshots/truth/nodes/wait_for_digits/editor/phone-number-collection.png +0 -0
  190. package/screenshots/truth/nodes/wait_for_digits/editor/single-digit-with-timeout.png +0 -0
  191. package/screenshots/truth/nodes/wait_for_digits/editor/verification-code.png +0 -0
  192. package/screenshots/truth/nodes/wait_for_digits/render/basic-digits-wait.png +0 -0
  193. package/screenshots/truth/nodes/wait_for_digits/render/phone-number-collection.png +0 -0
  194. package/screenshots/truth/nodes/wait_for_digits/render/single-digit-with-timeout.png +0 -0
  195. package/screenshots/truth/nodes/wait_for_digits/render/verification-code.png +0 -0
  196. package/screenshots/truth/nodes/wait_for_response/editor/basic-wait.png +0 -0
  197. package/screenshots/truth/nodes/wait_for_response/editor/custom-result-name.png +0 -0
  198. package/screenshots/truth/nodes/wait_for_response/editor/no-timeout.png +0 -0
  199. package/screenshots/truth/nodes/wait_for_response/editor/short-timeout.png +0 -0
  200. package/screenshots/truth/nodes/wait_for_response/render/basic-wait.png +0 -0
  201. package/screenshots/truth/nodes/wait_for_response/render/custom-result-name.png +0 -0
  202. package/screenshots/truth/nodes/wait_for_response/render/no-timeout.png +0 -0
  203. package/screenshots/truth/nodes/wait_for_response/render/short-timeout.png +0 -0
  204. package/screenshots/truth/omnibox/selected.png +0 -0
  205. package/screenshots/truth/run-list/basic.png +0 -0
  206. package/screenshots/truth/select/functions.png +0 -0
  207. package/screenshots/truth/select/multi-with-endpoint.png +0 -0
  208. package/screenshots/truth/select/search-enabled.png +0 -0
  209. package/src/events.ts +12 -6
  210. package/src/excellent/helpers.ts +2 -2
  211. package/src/flow/CanvasNode.ts +22 -1
  212. package/src/flow/Editor.ts +12 -1
  213. package/src/flow/NodeEditor.ts +186 -374
  214. package/src/flow/actions/add_input_labels.ts +45 -0
  215. package/src/flow/actions/call_llm.ts +57 -3
  216. package/src/flow/actions/call_webhook.ts +1 -1
  217. package/src/flow/actions/open_ticket.ts +74 -3
  218. package/src/flow/actions/set_run_result.ts +83 -0
  219. package/src/flow/config.ts +4 -0
  220. package/src/flow/nodes/split_by_llm_categorize.ts +277 -0
  221. package/src/flow/nodes/split_by_ticket.ts +19 -0
  222. package/src/flow/nodes/wait_for_response.ts +28 -1
  223. package/src/flow/types.ts +26 -127
  224. package/src/form/ArrayEditor.ts +79 -139
  225. package/src/form/BaseListEditor.ts +4 -4
  226. package/src/form/Checkbox.ts +81 -24
  227. package/src/form/ColorPicker.ts +31 -43
  228. package/src/form/Completion.ts +49 -56
  229. package/src/form/Compose.ts +8 -8
  230. package/src/form/ContactSearch.ts +3 -4
  231. package/src/form/DatePicker.ts +32 -38
  232. package/src/form/{FormField.ts → FieldElement.ts} +108 -55
  233. package/src/form/FieldRenderer.ts +466 -0
  234. package/src/form/ImagePicker.ts +107 -110
  235. package/src/form/KeyValueEditor.ts +43 -39
  236. package/src/form/MessageEditor.ts +61 -67
  237. package/src/form/TembaSlider.ts +3 -3
  238. package/src/form/TemplateEditor.ts +3 -3
  239. package/src/form/TextInput.ts +26 -29
  240. package/src/form/select/Select.ts +63 -37
  241. package/src/form/select/UserSelect.ts +10 -11
  242. package/src/form/select/WorkspaceSelect.ts +9 -10
  243. package/src/live/ContactChat.ts +62 -47
  244. package/src/live/ContactFieldEditor.ts +2 -2
  245. package/src/markdown.ts +19 -11
  246. package/src/store/flow-definition.d.ts +5 -2
  247. package/static/api/labels.json +31 -0
  248. package/static/api/topics.json +24 -9
  249. package/static/api/users.json +35 -16
  250. package/static/css/temba-components.css +3 -3
  251. package/stress-test.js +18 -13
  252. package/temba-modules.ts +3 -2
  253. package/test/ActionHelper.ts +2 -0
  254. package/test/NodeHelper.ts +184 -0
  255. package/test/actions/call_llm.test.ts +137 -0
  256. package/test/nodes/README.md +78 -0
  257. package/test/nodes/split_by_llm_categorize.test.ts +698 -0
  258. package/test/nodes/split_by_random.test.ts +177 -0
  259. package/test/nodes/wait_for_digits.test.ts +176 -0
  260. package/test/nodes/wait_for_response.test.ts +206 -0
  261. package/test/temba-add-input-labels.test.ts +87 -0
  262. package/test/temba-checkbox.test.ts +26 -0
  263. package/test/temba-field-renderer.test.ts +482 -0
  264. package/test/temba-integration-markdown.test.ts +2 -4
  265. package/test/temba-markdown.test.ts +1 -1
  266. package/test/temba-node-editor.test.ts +496 -0
  267. package/test/temba-select.test.ts +6 -6
  268. package/test/temba-slider.test.ts +0 -1
  269. package/test/temba-webchat.test.ts +1 -1
  270. package/test-assets/contacts/history.json +7 -20
  271. package/test-assets/select/llms.json +18 -0
  272. package/web-dev-mock.mjs +96 -6
  273. package/web-dev-server.config.mjs +29 -7
  274. package/out-tsc/src/form/FormElement.js +0 -67
  275. package/out-tsc/src/form/FormElement.js.map +0 -1
  276. package/out-tsc/src/form/FormField.js.map +0 -1
  277. package/out-tsc/test/temba-formfield.test.js +0 -94
  278. package/out-tsc/test/temba-formfield.test.js.map +0 -1
  279. package/src/form/FormElement.ts +0 -69
  280. package/test/temba-flow-editor.test.ts.backup +0 -563
  281. package/test/temba-formfield.test.ts +0 -121
  282. package/test/temba-utils-index.test.ts.backup +0 -1737
@@ -0,0 +1,150 @@
1
+ import { expect } from '@open-wc/testing';
2
+ import { split_by_random } from '../../src/flow/nodes/split_by_random';
3
+ import { NodeTest } from '../NodeHelper';
4
+ /**
5
+ * Test suite for the split_by_random node configuration.
6
+ */
7
+ describe('split_by_random node config', () => {
8
+ const helper = new NodeTest(split_by_random, 'split_by_random');
9
+ describe('basic properties', () => {
10
+ helper.testBasicProperties();
11
+ it('has correct name', () => {
12
+ expect(split_by_random.name).to.equal('Split by Random');
13
+ });
14
+ it('has correct type', () => {
15
+ expect(split_by_random.type).to.equal('split_by_random');
16
+ });
17
+ it('has correct color', () => {
18
+ expect(split_by_random.color).to.exist;
19
+ });
20
+ it('has router configuration', () => {
21
+ expect(split_by_random.router).to.exist;
22
+ expect(split_by_random.router.type).to.equal('random');
23
+ });
24
+ it('is a simple node config without form or layout', () => {
25
+ expect(split_by_random.form).to.be.undefined;
26
+ expect(split_by_random.layout).to.be.undefined;
27
+ expect(split_by_random.toFormData).to.be.undefined;
28
+ expect(split_by_random.fromFormData).to.be.undefined;
29
+ });
30
+ });
31
+ describe('node scenarios', () => {
32
+ helper.testNode({
33
+ uuid: 'test-random-node-1',
34
+ actions: [],
35
+ router: {
36
+ type: 'random',
37
+ categories: [
38
+ {
39
+ uuid: 'random-cat-1',
40
+ name: 'Bucket A',
41
+ exit_uuid: 'random-exit-1'
42
+ },
43
+ {
44
+ uuid: 'random-cat-2',
45
+ name: 'Bucket B',
46
+ exit_uuid: 'random-exit-2'
47
+ }
48
+ ]
49
+ },
50
+ exits: [
51
+ { uuid: 'random-exit-1', destination_uuid: null },
52
+ { uuid: 'random-exit-2', destination_uuid: null }
53
+ ]
54
+ }, { type: 'split_by_random' }, 'two-bucket-split');
55
+ helper.testNode({
56
+ uuid: 'test-random-node-2',
57
+ actions: [],
58
+ router: {
59
+ type: 'random',
60
+ categories: [
61
+ {
62
+ uuid: 'random-cat-1',
63
+ name: 'Group A',
64
+ exit_uuid: 'random-exit-1'
65
+ },
66
+ {
67
+ uuid: 'random-cat-2',
68
+ name: 'Group B',
69
+ exit_uuid: 'random-exit-2'
70
+ },
71
+ {
72
+ uuid: 'random-cat-3',
73
+ name: 'Group C',
74
+ exit_uuid: 'random-exit-3'
75
+ }
76
+ ]
77
+ },
78
+ exits: [
79
+ { uuid: 'random-exit-1', destination_uuid: null },
80
+ { uuid: 'random-exit-2', destination_uuid: null },
81
+ { uuid: 'random-exit-3', destination_uuid: null }
82
+ ]
83
+ }, { type: 'split_by_random' }, 'three-way-split');
84
+ helper.testNode({
85
+ uuid: 'test-random-node-3',
86
+ actions: [],
87
+ router: {
88
+ type: 'random',
89
+ categories: [
90
+ {
91
+ uuid: 'random-cat-1',
92
+ name: 'Treatment',
93
+ exit_uuid: 'random-exit-1'
94
+ },
95
+ {
96
+ uuid: 'random-cat-2',
97
+ name: 'Control',
98
+ exit_uuid: 'random-exit-2'
99
+ },
100
+ {
101
+ uuid: 'random-cat-3',
102
+ name: 'Variant A',
103
+ exit_uuid: 'random-exit-3'
104
+ },
105
+ {
106
+ uuid: 'random-cat-4',
107
+ name: 'Variant B',
108
+ exit_uuid: 'random-exit-4'
109
+ },
110
+ {
111
+ uuid: 'random-cat-5',
112
+ name: 'Holdout',
113
+ exit_uuid: 'random-exit-5'
114
+ }
115
+ ]
116
+ },
117
+ exits: [
118
+ { uuid: 'random-exit-1', destination_uuid: null },
119
+ { uuid: 'random-exit-2', destination_uuid: null },
120
+ { uuid: 'random-exit-3', destination_uuid: null },
121
+ { uuid: 'random-exit-4', destination_uuid: null },
122
+ { uuid: 'random-exit-5', destination_uuid: null }
123
+ ]
124
+ }, { type: 'split_by_random' }, 'ab-test-multiple-variants');
125
+ helper.testNode({
126
+ uuid: 'test-random-node-4',
127
+ actions: [],
128
+ router: {
129
+ type: 'random',
130
+ categories: [
131
+ {
132
+ uuid: 'random-cat-1',
133
+ name: 'Sample Group',
134
+ exit_uuid: 'random-exit-1'
135
+ },
136
+ {
137
+ uuid: 'random-cat-2',
138
+ name: 'Remaining Population',
139
+ exit_uuid: 'random-exit-2'
140
+ }
141
+ ]
142
+ },
143
+ exits: [
144
+ { uuid: 'random-exit-1', destination_uuid: null },
145
+ { uuid: 'random-exit-2', destination_uuid: null }
146
+ ]
147
+ }, { type: 'split_by_random' }, 'sampling-split');
148
+ });
149
+ });
150
+ //# sourceMappingURL=split_by_random.test.js.map
@@ -0,0 +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;A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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 it('is a simple node config without form or layout', () => {\n expect(split_by_random.form).to.be.undefined;\n expect(split_by_random.layout).to.be.undefined;\n expect(split_by_random.toFormData).to.be.undefined;\n expect(split_by_random.fromFormData).to.be.undefined;\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"]}
@@ -0,0 +1,150 @@
1
+ import { expect } from '@open-wc/testing';
2
+ import { wait_for_digits } from '../../src/flow/nodes/wait_for_digits';
3
+ import { NodeTest } from '../NodeHelper';
4
+ /**
5
+ * Test suite for the wait_for_digits node configuration.
6
+ */
7
+ describe('wait_for_digits node config', () => {
8
+ const helper = new NodeTest(wait_for_digits, 'wait_for_digits');
9
+ describe('basic properties', () => {
10
+ helper.testBasicProperties();
11
+ it('has correct name', () => {
12
+ expect(wait_for_digits.name).to.equal('Wait for Digits');
13
+ });
14
+ it('has correct type', () => {
15
+ expect(wait_for_digits.type).to.equal('wait_for_digits');
16
+ });
17
+ it('has correct color', () => {
18
+ expect(wait_for_digits.color).to.exist;
19
+ });
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;
25
+ });
26
+ });
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'
46
+ },
47
+ { uuid: 'digits-cat-2', name: 'Other', exit_uuid: 'digits-exit-2' }
48
+ ]
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
65
+ },
66
+ timeout: {
67
+ category_uuid: 'timeout-cat',
68
+ seconds: 30
69
+ }
70
+ },
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' }
84
+ ]
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'
110
+ },
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
+ }
132
+ },
133
+ result_name: 'verification_code',
134
+ categories: [
135
+ {
136
+ uuid: 'code-cat-1',
137
+ name: 'Valid Code',
138
+ exit_uuid: 'code-exit-1'
139
+ },
140
+ { uuid: 'code-cat-2', name: 'Other', exit_uuid: 'code-exit-2' }
141
+ ]
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');
148
+ });
149
+ });
150
+ //# sourceMappingURL=wait_for_digits.test.js.map
@@ -0,0 +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;QAE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EAAE;oBACV;wBACE,IAAI,EAAE,YAAY;wBAClB,IAAI,EAAE,YAAY;wBAClB,SAAS,EAAE,aAAa;qBACzB;oBACD,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE;iBAChE;aACF;YACD,KAAK,EAAE;gBACL,EAAE,IAAI,EAAE,aAAa,EAAE,gBAAgB,EAAE,IAAI,EAAE;gBAC/C,EAAE,IAAI,EAAE,aAAa,EAAE,gBAAgB,EAAE,IAAI,EAAE;aAChD;SACM,EACT,EAAE,IAAI,EAAE,iBAAiB,EAAE,EAC3B,mBAAmB,CACpB,CAAC;IACJ,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 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"]}
@@ -0,0 +1,171 @@
1
+ import { expect } from '@open-wc/testing';
2
+ import { wait_for_response } from '../../src/flow/nodes/wait_for_response';
3
+ import { NodeTest } from '../NodeHelper';
4
+ /**
5
+ * Test suite for the wait_for_response node configuration.
6
+ */
7
+ describe('wait_for_response node config', () => {
8
+ const helper = new NodeTest(wait_for_response, 'wait_for_response');
9
+ describe('basic properties', () => {
10
+ helper.testBasicProperties();
11
+ it('has correct name', () => {
12
+ expect(wait_for_response.name).to.equal('Wait for Response');
13
+ });
14
+ it('has correct type', () => {
15
+ expect(wait_for_response.type).to.equal('wait_for_response');
16
+ });
17
+ it('has form configuration', () => {
18
+ expect(wait_for_response.form).to.exist;
19
+ expect(wait_for_response.form.result_name).to.exist;
20
+ });
21
+ it('has layout configuration', () => {
22
+ expect(wait_for_response.layout).to.exist;
23
+ expect(wait_for_response.layout).to.deep.equal([
24
+ 'timeout',
25
+ 'result_name'
26
+ ]);
27
+ });
28
+ });
29
+ describe('node scenarios', () => {
30
+ helper.testNode({
31
+ uuid: 'test-wait-node-1',
32
+ actions: [],
33
+ router: {
34
+ type: 'switch',
35
+ wait: {
36
+ type: 'msg',
37
+ timeout: {
38
+ category_uuid: 'timeout-cat-1',
39
+ seconds: 300
40
+ }
41
+ },
42
+ result_name: 'response',
43
+ categories: [
44
+ {
45
+ uuid: 'timeout-cat-1',
46
+ name: 'No Response',
47
+ exit_uuid: 'timeout-exit-1'
48
+ }
49
+ ]
50
+ },
51
+ exits: [{ uuid: 'timeout-exit-1', destination_uuid: null }]
52
+ }, { type: 'wait_for_response' }, 'basic-wait');
53
+ helper.testNode({
54
+ uuid: 'test-wait-node-2',
55
+ actions: [],
56
+ router: {
57
+ type: 'switch',
58
+ wait: {
59
+ type: 'msg',
60
+ timeout: {
61
+ category_uuid: 'timeout-cat-2',
62
+ seconds: 1800
63
+ }
64
+ },
65
+ result_name: 'user_input',
66
+ categories: [
67
+ {
68
+ uuid: 'timeout-cat-2',
69
+ name: 'No Response',
70
+ exit_uuid: 'timeout-exit-2'
71
+ }
72
+ ]
73
+ },
74
+ exits: [{ uuid: 'timeout-exit-2', destination_uuid: null }]
75
+ }, { type: 'wait_for_response' }, 'custom-result-name');
76
+ helper.testNode({
77
+ uuid: 'test-wait-node-3',
78
+ actions: [],
79
+ router: {
80
+ type: 'switch',
81
+ wait: {
82
+ type: 'msg',
83
+ timeout: {
84
+ category_uuid: 'timeout-cat-3',
85
+ seconds: 60
86
+ }
87
+ },
88
+ result_name: 'quick_response',
89
+ categories: [
90
+ {
91
+ uuid: 'timeout-cat-3',
92
+ name: 'No Response',
93
+ exit_uuid: 'timeout-exit-3'
94
+ }
95
+ ]
96
+ },
97
+ exits: [{ uuid: 'timeout-exit-3', destination_uuid: null }]
98
+ }, { type: 'wait_for_response' }, 'short-timeout');
99
+ helper.testNode({
100
+ uuid: 'test-wait-node-4',
101
+ actions: [],
102
+ router: {
103
+ type: 'switch',
104
+ wait: {
105
+ type: 'msg'
106
+ // No timeout specified
107
+ },
108
+ result_name: 'response',
109
+ categories: []
110
+ },
111
+ exits: []
112
+ }, { type: 'wait_for_response' }, 'no-timeout');
113
+ });
114
+ describe('data transformation', () => {
115
+ it('converts node to form data correctly', () => {
116
+ const node = {
117
+ uuid: 'test-node',
118
+ actions: [],
119
+ router: {
120
+ type: 'switch',
121
+ result_name: 'user_response',
122
+ categories: []
123
+ },
124
+ exits: []
125
+ };
126
+ const formData = wait_for_response.toFormData(node);
127
+ expect(formData.uuid).to.equal('test-node');
128
+ expect(formData.result_name).to.equal('user_response');
129
+ });
130
+ it('converts form data to node correctly', () => {
131
+ var _a;
132
+ const formData = {
133
+ uuid: 'test-node',
134
+ result_name: 'custom_response'
135
+ };
136
+ const originalNode = {
137
+ uuid: 'test-node',
138
+ actions: [],
139
+ exits: [],
140
+ router: {
141
+ type: 'switch',
142
+ result_name: 'response',
143
+ categories: []
144
+ }
145
+ };
146
+ const result = wait_for_response.fromFormData(formData, originalNode);
147
+ expect(result.uuid).to.equal('test-node');
148
+ expect((_a = result.router) === null || _a === void 0 ? void 0 : _a.result_name).to.equal('custom_response');
149
+ });
150
+ it('handles default result name', () => {
151
+ var _a;
152
+ const formData = {
153
+ uuid: 'test-node'
154
+ // No result_name specified
155
+ };
156
+ const originalNode = {
157
+ uuid: 'test-node',
158
+ actions: [],
159
+ exits: [],
160
+ router: {
161
+ type: 'switch',
162
+ categories: []
163
+ }
164
+ };
165
+ const result = wait_for_response.fromFormData(formData, originalNode);
166
+ expect(result.uuid).to.equal('test-node');
167
+ expect((_a = result.router) === null || _a === void 0 ? void 0 : _a.result_name).to.equal('response');
168
+ });
169
+ });
170
+ });
171
+ //# sourceMappingURL=wait_for_response.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wait_for_response.test.js","sourceRoot":"","sources":["../../../test/nodes/wait_for_response.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAE3E,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC;;GAEG;AACH,QAAQ,CAAC,+BAA+B,EAAE,GAAG,EAAE;IAC7C,MAAM,MAAM,GAAG,IAAI,QAAQ,CAAC,iBAAiB,EAAE,mBAAmB,CAAC,CAAC;IAEpE,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;QAChC,MAAM,CAAC,mBAAmB,EAAE,CAAC;QAE7B,EAAE,CAAC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E,EAAE;gBACT,MAAM,EAAE;oBACN,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,UAAU;oBACvB,UAAU,EAAE,EAAE;iBACf;aACF,CAAC;YAEF,MAAM,MAAM,GAAG,iBAAiB,CAAC,YAAa,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;YAEvE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;YAC1C,MAAM,CAAC,MAAA,MAAM,CAAC,MAAM,0CAAE,WAAW,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;QACjE,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,6BAA6B,EAAE,GAAG,EAAE;;YACrC,MAAM,QAAQ,GAAG;gBACf,IAAI,EAAE,WAAW;gBACjB,2BAA2B;aAC5B,CAAC;YAEF,MAAM,YAAY,GAAS;gBACzB,IAAI,EAAE,WAAW;gBACjB,OAAO,EAAE,EAAE;gBACX,KAAK,EAAE,EAAE;gBACT,MAAM,EAAE;oBACN,IAAI,EAAE,QAAQ;oBACd,UAAU,EAAE,EAAE;iBACf;aACF,CAAC;YAEF,MAAM,MAAM,GAAG,iBAAiB,CAAC,YAAa,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;YAEvE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;YAC1C,MAAM,CAAC,MAAA,MAAM,CAAC,MAAM,0CAAE,WAAW,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;QAC1D,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { expect } from '@open-wc/testing';\nimport { wait_for_response } from '../../src/flow/nodes/wait_for_response';\nimport { Node } from '../../src/store/flow-definition';\nimport { NodeTest } from '../NodeHelper';\n\n/**\n * Test suite for the wait_for_response node configuration.\n */\ndescribe('wait_for_response node config', () => {\n const helper = new NodeTest(wait_for_response, 'wait_for_response');\n\n describe('basic properties', () => {\n helper.testBasicProperties();\n\n it('has correct name', () => {\n expect(wait_for_response.name).to.equal('Wait for Response');\n });\n\n it('has correct type', () => {\n expect(wait_for_response.type).to.equal('wait_for_response');\n });\n\n it('has form configuration', () => {\n expect(wait_for_response.form).to.exist;\n expect(wait_for_response.form.result_name).to.exist;\n });\n\n it('has layout configuration', () => {\n expect(wait_for_response.layout).to.exist;\n expect(wait_for_response.layout).to.deep.equal([\n 'timeout',\n 'result_name'\n ]);\n });\n });\n\n describe('node scenarios', () => {\n helper.testNode(\n {\n uuid: 'test-wait-node-1',\n actions: [],\n router: {\n type: 'switch',\n wait: {\n type: 'msg',\n timeout: {\n category_uuid: 'timeout-cat-1',\n seconds: 300\n }\n },\n result_name: 'response',\n categories: [\n {\n uuid: 'timeout-cat-1',\n name: 'No Response',\n exit_uuid: 'timeout-exit-1'\n }\n ]\n },\n exits: [{ uuid: 'timeout-exit-1', destination_uuid: null }]\n } as Node,\n { type: 'wait_for_response' },\n 'basic-wait'\n );\n\n helper.testNode(\n {\n uuid: 'test-wait-node-2',\n actions: [],\n router: {\n type: 'switch',\n wait: {\n type: 'msg',\n timeout: {\n category_uuid: 'timeout-cat-2',\n seconds: 1800\n }\n },\n result_name: 'user_input',\n categories: [\n {\n uuid: 'timeout-cat-2',\n name: 'No Response',\n exit_uuid: 'timeout-exit-2'\n }\n ]\n },\n exits: [{ uuid: 'timeout-exit-2', destination_uuid: null }]\n } as Node,\n { type: 'wait_for_response' },\n 'custom-result-name'\n );\n\n helper.testNode(\n {\n uuid: 'test-wait-node-3',\n actions: [],\n router: {\n type: 'switch',\n wait: {\n type: 'msg',\n timeout: {\n category_uuid: 'timeout-cat-3',\n seconds: 60\n }\n },\n result_name: 'quick_response',\n categories: [\n {\n uuid: 'timeout-cat-3',\n name: 'No Response',\n exit_uuid: 'timeout-exit-3'\n }\n ]\n },\n exits: [{ uuid: 'timeout-exit-3', destination_uuid: null }]\n } as Node,\n { type: 'wait_for_response' },\n 'short-timeout'\n );\n\n helper.testNode(\n {\n uuid: 'test-wait-node-4',\n actions: [],\n router: {\n type: 'switch',\n wait: {\n type: 'msg'\n // No timeout specified\n },\n result_name: 'response',\n categories: []\n },\n exits: []\n } as Node,\n { type: 'wait_for_response' },\n 'no-timeout'\n );\n });\n\n describe('data transformation', () => {\n it('converts node to form data correctly', () => {\n const node: Node = {\n uuid: 'test-node',\n actions: [],\n router: {\n type: 'switch',\n result_name: 'user_response',\n categories: []\n },\n exits: []\n };\n\n const formData = wait_for_response.toFormData!(node);\n\n expect(formData.uuid).to.equal('test-node');\n expect(formData.result_name).to.equal('user_response');\n });\n\n it('converts form data to node correctly', () => {\n const formData = {\n uuid: 'test-node',\n result_name: 'custom_response'\n };\n\n const originalNode: Node = {\n uuid: 'test-node',\n actions: [],\n exits: [],\n router: {\n type: 'switch',\n result_name: 'response',\n categories: []\n }\n };\n\n const result = wait_for_response.fromFormData!(formData, originalNode);\n\n expect(result.uuid).to.equal('test-node');\n expect(result.router?.result_name).to.equal('custom_response');\n });\n\n it('handles default result name', () => {\n const formData = {\n uuid: 'test-node'\n // No result_name specified\n };\n\n const originalNode: Node = {\n uuid: 'test-node',\n actions: [],\n exits: [],\n router: {\n type: 'switch',\n categories: []\n }\n };\n\n const result = wait_for_response.fromFormData!(formData, originalNode);\n\n expect(result.uuid).to.equal('test-node');\n expect(result.router?.result_name).to.equal('response');\n });\n });\n});\n"]}
@@ -0,0 +1,70 @@
1
+ import { fixture, expect } from '@open-wc/testing';
2
+ import { html } from 'lit';
3
+ import { NodeEditor } from '../src/flow/NodeEditor';
4
+ // Register the component
5
+ customElements.define('temba-node-editor', NodeEditor);
6
+ describe('add_input_labels action editor', () => {
7
+ it('renders form editor for add_input_labels action', async () => {
8
+ const action = {
9
+ uuid: 'test-action-uuid',
10
+ type: 'add_input_labels',
11
+ labels: [
12
+ { uuid: 'label-1', name: 'Important' },
13
+ { uuid: 'label-2', name: 'Spam' }
14
+ ]
15
+ };
16
+ const el = (await fixture(html `
17
+ <temba-node-editor .action=${action} .isOpen=${true}></temba-node-editor>
18
+ `));
19
+ await el.updateComplete;
20
+ expect(el.shadowRoot).to.not.be.null;
21
+ expect(el.action).to.equal(action);
22
+ });
23
+ it('can create new labels through the multi-select', async () => {
24
+ var _a;
25
+ const action = {
26
+ uuid: 'test-action-uuid',
27
+ type: 'add_input_labels',
28
+ labels: []
29
+ };
30
+ const el = (await fixture(html `
31
+ <temba-node-editor .action=${action} .isOpen=${true}></temba-node-editor>
32
+ `));
33
+ await el.updateComplete;
34
+ // Find the select element for labels
35
+ const selectElement = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('temba-select[name="labels"]');
36
+ expect(selectElement).to.not.be.null;
37
+ // Verify it has the correct configuration (no longer checking for tags)
38
+ expect(selectElement === null || selectElement === void 0 ? void 0 : selectElement.getAttribute('multi')).to.not.be.null;
39
+ expect(selectElement === null || selectElement === void 0 ? void 0 : selectElement.getAttribute('searchable')).to.not.be.null;
40
+ expect(selectElement === null || selectElement === void 0 ? void 0 : selectElement.getAttribute('endpoint')).to.equal('/api/v2/labels.json');
41
+ });
42
+ it('transforms form data correctly', async () => {
43
+ const action = {
44
+ uuid: 'test-action-uuid',
45
+ type: 'add_input_labels',
46
+ labels: [
47
+ { uuid: 'label-1', name: 'Important' },
48
+ { uuid: 'label-2', name: 'Follow Up' }
49
+ ]
50
+ };
51
+ const el = (await fixture(html `
52
+ <temba-node-editor .action=${action} .isOpen=${true}></temba-node-editor>
53
+ `));
54
+ await el.updateComplete;
55
+ // Test toFormData transformation
56
+ const expectedFormData = {
57
+ labels: [
58
+ { uuid: 'label-1', name: 'Important' },
59
+ { uuid: 'label-2', name: 'Follow Up' }
60
+ ],
61
+ uuid: 'test-action-uuid'
62
+ };
63
+ // Access the private formData property
64
+ const formData = el.formData;
65
+ expect(formData).to.not.be.undefined;
66
+ expect(formData.labels).to.deep.equal(expectedFormData.labels);
67
+ expect(formData.uuid).to.equal(expectedFormData.uuid);
68
+ });
69
+ });
70
+ //# sourceMappingURL=temba-add-input-labels.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"temba-add-input-labels.test.js","sourceRoot":"","sources":["../../test/temba-add-input-labels.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAGpD,yBAAyB;AACzB,cAAc,CAAC,MAAM,CAAC,mBAAmB,EAAE,UAAU,CAAC,CAAC;AAEvD,QAAQ,CAAC,gCAAgC,EAAE,GAAG,EAAE;IAC9C,EAAE,CAAC,iDAAiD,EAAE,KAAK,IAAI,EAAE;QAC/D,MAAM,MAAM,GAAmB;YAC7B,IAAI,EAAE,kBAAkB;YACxB,IAAI,EAAE,kBAAkB;YACxB,MAAM,EAAE;gBACN,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,WAAW,EAAE;gBACtC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE;aAClC;SACF,CAAC;QAEF,MAAM,EAAE,GAAG,CAAC,MAAM,OAAO,CAAC,IAAI,CAAA;mCACC,MAAM,YAAY,IAAI;KACpD,CAAC,CAAe,CAAC;QAElB,MAAM,EAAE,CAAC,cAAc,CAAC;QACxB,MAAM,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC;QACrC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IACrC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,gDAAgD,EAAE,KAAK,IAAI,EAAE;;QAC9D,MAAM,MAAM,GAA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MAAM,YAAY,IAAI;KACpD,CAAC,CAAe,CAAC;QAElB,MAAM,EAAE,CAAC,cAAc,CAAC;QAExB,iCAAiC;QACjC,MAAM,gBAAgB,GAAG;YACvB,MAAM,EAAE;gBACN,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,WAAW,EAAE;gBACtC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,WAAW,EAAE;aACvC;YACD,IAAI,EAAE,kBAAkB;SACzB,CAAC;QAEF,uCAAuC;QACvC,MAAM,QAAQ,GAAI,EAAU,CAAC,QAAQ,CAAC;QACtC,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,SAAS,CAAC;QACrC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;QAC/D,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;IACxD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { fixture, expect } from '@open-wc/testing';\nimport { html } from 'lit';\nimport { NodeEditor } from '../src/flow/NodeEditor';\nimport { AddInputLabels } from '../src/store/flow-definition';\n\n// Register the component\ncustomElements.define('temba-node-editor', NodeEditor);\n\ndescribe('add_input_labels action editor', () => {\n it('renders form editor for add_input_labels action', async () => {\n const action: AddInputLabels = {\n uuid: 'test-action-uuid',\n type: 'add_input_labels',\n labels: [\n { uuid: 'label-1', name: 'Important' },\n { uuid: 'label-2', name: 'Spam' }\n ]\n };\n\n const el = (await fixture(html`\n <temba-node-editor .action=${action} .isOpen=${true}></temba-node-editor>\n `)) as NodeEditor;\n\n await el.updateComplete;\n expect(el.shadowRoot).to.not.be.null;\n expect(el.action).to.equal(action);\n });\n\n it('can create new labels through the multi-select', async () => {\n const action: AddInputLabels = {\n uuid: 'test-action-uuid',\n type: 'add_input_labels',\n labels: []\n };\n\n const el = (await fixture(html`\n <temba-node-editor .action=${action} .isOpen=${true}></temba-node-editor>\n `)) as NodeEditor;\n\n await el.updateComplete;\n\n // Find the select element for labels\n const selectElement = el.shadowRoot?.querySelector(\n 'temba-select[name=\"labels\"]'\n );\n expect(selectElement).to.not.be.null;\n\n // Verify it has the correct configuration (no longer checking for tags)\n expect(selectElement?.getAttribute('multi')).to.not.be.null;\n expect(selectElement?.getAttribute('searchable')).to.not.be.null;\n expect(selectElement?.getAttribute('endpoint')).to.equal(\n '/api/v2/labels.json'\n );\n });\n\n it('transforms form data correctly', async () => {\n const action: AddInputLabels = {\n uuid: 'test-action-uuid',\n type: 'add_input_labels',\n labels: [\n { uuid: 'label-1', name: 'Important' },\n { uuid: 'label-2', name: 'Follow Up' }\n ]\n };\n\n const el = (await fixture(html`\n <temba-node-editor .action=${action} .isOpen=${true}></temba-node-editor>\n `)) as NodeEditor;\n\n await el.updateComplete;\n\n // Test toFormData transformation\n const expectedFormData = {\n labels: [\n { uuid: 'label-1', name: 'Important' },\n { uuid: 'label-2', name: 'Follow Up' }\n ],\n uuid: 'test-action-uuid'\n };\n\n // Access the private formData property\n const formData = (el as any).formData;\n expect(formData).to.not.be.undefined;\n expect(formData.labels).to.deep.equal(expectedFormData.labels);\n expect(formData.uuid).to.equal(expectedFormData.uuid);\n });\n});\n"]}
@@ -125,5 +125,21 @@ describe('temba-checkbox', () => {
125
125
  data = new FormData(form);
126
126
  expect(data.get('my-cb')).to.equal('5');
127
127
  });
128
+ it('aligns help text with label when both are present', async () => {
129
+ const el = await fixture(html `
130
+ <temba-checkbox
131
+ label="Checkbox with help"
132
+ help_text="This help text should align with the label text"
133
+ >
134
+ </temba-checkbox>
135
+ `);
136
+ expect(el.label).to.equal('Checkbox with help');
137
+ expect(el.helpText).to.equal('This help text should align with the label text');
138
+ // Verify help text element exists and has proper alignment styles
139
+ const helpTextEl = el.shadowRoot.querySelector('.checkbox-help-text');
140
+ expect(helpTextEl).to.not.be.null;
141
+ expect(helpTextEl.textContent.trim()).to.equal('This help text should align with the label text');
142
+ await assertScreenshot('checkbox/checkbox-with-help-text', getClip(el));
143
+ });
128
144
  });
129
145
  //# sourceMappingURL=temba-checkbox.test.js.map