@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.
- package/CHANGELOG.md +28 -4
- package/DEV_DATA.md +89 -0
- package/demo/data/flows/food-order.json +4 -4
- package/demo/data/flows/sample-flow.json +132 -147
- package/dist/temba-components.js +764 -628
- package/dist/temba-components.js.map +1 -1
- package/out-tsc/src/display/Chat.js +5 -3
- package/out-tsc/src/display/Chat.js.map +1 -1
- package/out-tsc/src/events.js.map +1 -1
- package/out-tsc/src/flow/CanvasNode.js +83 -78
- package/out-tsc/src/flow/CanvasNode.js.map +1 -1
- package/out-tsc/src/flow/Editor.js +1 -0
- package/out-tsc/src/flow/Editor.js.map +1 -1
- package/out-tsc/src/flow/NodeEditor.js +47 -3
- package/out-tsc/src/flow/NodeEditor.js.map +1 -1
- package/out-tsc/src/flow/actions/add_contact_urn.js +1 -1
- package/out-tsc/src/flow/actions/add_contact_urn.js.map +1 -1
- package/out-tsc/src/flow/actions/set_contact_channel.js +1 -1
- package/out-tsc/src/flow/actions/set_contact_channel.js.map +1 -1
- package/out-tsc/src/flow/actions/set_contact_field.js +2 -1
- package/out-tsc/src/flow/actions/set_contact_field.js.map +1 -1
- package/out-tsc/src/flow/actions/set_contact_language.js +3 -1
- package/out-tsc/src/flow/actions/set_contact_language.js.map +1 -1
- package/out-tsc/src/flow/actions/set_contact_name.js +1 -1
- package/out-tsc/src/flow/actions/set_contact_name.js.map +1 -1
- package/out-tsc/src/flow/actions/set_contact_status.js +17 -14
- package/out-tsc/src/flow/actions/set_contact_status.js.map +1 -1
- package/out-tsc/src/flow/actions/set_run_result.js +1 -1
- package/out-tsc/src/flow/actions/set_run_result.js.map +1 -1
- package/out-tsc/src/flow/nodes/split_by_llm.js +12 -12
- package/out-tsc/src/flow/nodes/split_by_llm.js.map +1 -1
- package/out-tsc/src/flow/nodes/wait_for_response.js +609 -6
- package/out-tsc/src/flow/nodes/wait_for_response.js.map +1 -1
- package/out-tsc/src/flow/operators.js +194 -0
- package/out-tsc/src/flow/operators.js.map +1 -0
- package/out-tsc/src/flow/types.js.map +1 -1
- package/out-tsc/src/form/ArrayEditor.js +84 -19
- package/out-tsc/src/form/ArrayEditor.js.map +1 -1
- package/out-tsc/src/form/Checkbox.js +12 -0
- package/out-tsc/src/form/Checkbox.js.map +1 -1
- package/out-tsc/src/form/FieldRenderer.js +13 -3
- package/out-tsc/src/form/FieldRenderer.js.map +1 -1
- package/out-tsc/src/form/TextInput.js +20 -1
- package/out-tsc/src/form/TextInput.js.map +1 -1
- package/out-tsc/src/form/select/Select.js +7 -0
- package/out-tsc/src/form/select/Select.js.map +1 -1
- package/out-tsc/src/interfaces.js.map +1 -1
- package/out-tsc/src/layout/Dialog.js +3 -4
- package/out-tsc/src/layout/Dialog.js.map +1 -1
- package/out-tsc/src/list/RunList.js +2 -2
- package/out-tsc/src/list/RunList.js.map +1 -1
- package/out-tsc/src/live/ContactChat.js +114 -34
- package/out-tsc/src/live/ContactChat.js.map +1 -1
- package/out-tsc/src/live/ContactDetails.js +7 -0
- package/out-tsc/src/live/ContactDetails.js.map +1 -1
- package/out-tsc/src/live/ContactNameFetch.js +1 -1
- package/out-tsc/src/live/ContactNameFetch.js.map +1 -1
- package/out-tsc/test/NodeHelper.js +25 -27
- package/out-tsc/test/NodeHelper.js.map +1 -1
- package/out-tsc/test/nodes/split_by_llm.test.js +12 -4
- package/out-tsc/test/nodes/split_by_llm.test.js.map +1 -1
- package/out-tsc/test/nodes/split_by_llm_categorize.test.js +101 -91
- package/out-tsc/test/nodes/split_by_llm_categorize.test.js.map +1 -1
- package/out-tsc/test/nodes/split_by_random.test.js +120 -112
- package/out-tsc/test/nodes/split_by_random.test.js.map +1 -1
- package/out-tsc/test/nodes/wait_for_digits.test.js +131 -111
- package/out-tsc/test/nodes/wait_for_digits.test.js.map +1 -1
- package/out-tsc/test/nodes/wait_for_response.test.js +549 -85
- package/out-tsc/test/nodes/wait_for_response.test.js.map +1 -1
- package/out-tsc/test/temba-checkbox.test.js +32 -32
- package/out-tsc/test/temba-checkbox.test.js.map +1 -1
- package/out-tsc/test/temba-contact-chat.test.js +2 -1
- package/out-tsc/test/temba-contact-chat.test.js.map +1 -1
- package/out-tsc/test/temba-dropdown.test.js +0 -4
- package/out-tsc/test/temba-dropdown.test.js.map +1 -1
- package/out-tsc/test/temba-flow-editor-node.test.js +9 -4
- package/out-tsc/test/temba-flow-editor-node.test.js.map +1 -1
- package/out-tsc/test/temba-integration-markdown.test.js +13 -15
- package/out-tsc/test/temba-integration-markdown.test.js.map +1 -1
- package/out-tsc/test/temba-node-editor.test.js +5 -38
- package/out-tsc/test/temba-node-editor.test.js.map +1 -1
- package/out-tsc/test/temba-run-list.test.js +2 -2
- package/out-tsc/test/temba-run-list.test.js.map +1 -1
- package/out-tsc/test/utils.test.js +2 -1
- package/out-tsc/test/utils.test.js.map +1 -1
- package/package.json +6 -2
- package/screenshots/truth/actions/add_contact_groups/editor/descriptive-group-names.png +0 -0
- package/screenshots/truth/actions/add_contact_groups/editor/long-group-names.png +0 -0
- package/screenshots/truth/actions/add_contact_groups/editor/many-groups.png +0 -0
- package/screenshots/truth/actions/add_contact_groups/editor/multiple-groups.png +0 -0
- package/screenshots/truth/actions/add_contact_groups/editor/single-group.png +0 -0
- package/screenshots/truth/actions/add_contact_groups/render/descriptive-group-names.png +0 -0
- package/screenshots/truth/actions/add_contact_groups/render/long-group-names.png +0 -0
- package/screenshots/truth/actions/add_contact_groups/render/many-groups.png +0 -0
- package/screenshots/truth/actions/add_contact_groups/render/multiple-groups.png +0 -0
- package/screenshots/truth/actions/add_contact_groups/render/single-group.png +0 -0
- package/screenshots/truth/actions/remove_contact_groups/editor/cleanup-groups.png +0 -0
- package/screenshots/truth/actions/remove_contact_groups/editor/long-descriptive-group-names.png +0 -0
- package/screenshots/truth/actions/remove_contact_groups/editor/many-groups.png +0 -0
- package/screenshots/truth/actions/remove_contact_groups/editor/multiple-groups.png +0 -0
- package/screenshots/truth/actions/remove_contact_groups/editor/remove-from-all-groups.png +0 -0
- package/screenshots/truth/actions/remove_contact_groups/editor/single-group.png +0 -0
- package/screenshots/truth/actions/remove_contact_groups/render/cleanup-groups.png +0 -0
- package/screenshots/truth/actions/remove_contact_groups/render/long-descriptive-group-names.png +0 -0
- package/screenshots/truth/actions/remove_contact_groups/render/many-groups.png +0 -0
- package/screenshots/truth/actions/remove_contact_groups/render/multiple-groups.png +0 -0
- package/screenshots/truth/actions/remove_contact_groups/render/remove-from-all-groups.png +0 -0
- package/screenshots/truth/actions/remove_contact_groups/render/single-group.png +0 -0
- package/screenshots/truth/actions/send_email/editor/complex-business-email.png +0 -0
- package/screenshots/truth/actions/send_email/editor/empty-body.png +0 -0
- package/screenshots/truth/actions/send_email/editor/empty-subject.png +0 -0
- package/screenshots/truth/actions/send_email/editor/long-subject.png +0 -0
- package/screenshots/truth/actions/send_email/editor/multiline-body.png +0 -0
- package/screenshots/truth/actions/send_email/editor/multiple-recipients.png +0 -0
- package/screenshots/truth/actions/send_email/editor/simple-email.png +0 -0
- package/screenshots/truth/actions/send_email/editor/with-expressions.png +0 -0
- package/screenshots/truth/actions/send_email/render/complex-business-email.png +0 -0
- package/screenshots/truth/actions/send_email/render/empty-body.png +0 -0
- package/screenshots/truth/actions/send_email/render/empty-subject.png +0 -0
- package/screenshots/truth/actions/send_email/render/long-subject.png +0 -0
- package/screenshots/truth/actions/send_email/render/multiline-body.png +0 -0
- package/screenshots/truth/actions/send_email/render/multiple-recipients.png +0 -0
- package/screenshots/truth/actions/send_email/render/simple-email.png +0 -0
- package/screenshots/truth/actions/send_email/render/with-expressions.png +0 -0
- package/screenshots/truth/actions/send_msg/editor/long-quick-replies.png +0 -0
- package/screenshots/truth/actions/send_msg/editor/multiline-text-with-replies.png +0 -0
- package/screenshots/truth/actions/send_msg/editor/simple-text.png +0 -0
- package/screenshots/truth/actions/send_msg/editor/text-with-linebreaks.png +0 -0
- package/screenshots/truth/actions/send_msg/editor/text-with-many-quick-replies.png +0 -0
- package/screenshots/truth/actions/send_msg/editor/text-with-quick-replies.png +0 -0
- package/screenshots/truth/actions/send_msg/editor/text-without-quick-replies.png +0 -0
- package/screenshots/truth/actions/send_msg/render/long-quick-replies.png +0 -0
- package/screenshots/truth/actions/send_msg/render/multiline-text-with-replies.png +0 -0
- package/screenshots/truth/actions/send_msg/render/simple-text.png +0 -0
- package/screenshots/truth/actions/send_msg/render/text-with-linebreaks.png +0 -0
- package/screenshots/truth/actions/send_msg/render/text-with-many-quick-replies.png +0 -0
- package/screenshots/truth/actions/send_msg/render/text-with-quick-replies.png +0 -0
- package/screenshots/truth/actions/send_msg/render/text-without-quick-replies.png +0 -0
- package/screenshots/truth/checkbox/checkbox-label-background-hover.png +0 -0
- package/screenshots/truth/checkbox/checkbox-whitespace-label-no-background-hover.png +0 -0
- package/screenshots/truth/checkbox/checkbox-with-help-text.png +0 -0
- package/screenshots/truth/checkbox/checked.png +0 -0
- package/screenshots/truth/checkbox/default.png +0 -0
- package/screenshots/truth/editor/wait.png +0 -0
- package/screenshots/truth/integration/textinput-markdown-errors.png +0 -0
- package/screenshots/truth/lightbox/img-zoomed.png +0 -0
- package/screenshots/truth/nodes/split_by_llm/editor/information-extraction.png +0 -0
- package/screenshots/truth/nodes/split_by_llm/editor/sentiment-analysis.png +0 -0
- package/screenshots/truth/nodes/split_by_llm/editor/summarization.png +0 -0
- package/screenshots/truth/nodes/split_by_llm/editor/translation-task.png +0 -0
- package/screenshots/truth/nodes/split_by_llm/render/information-extraction.png +0 -0
- package/screenshots/truth/nodes/split_by_llm/render/sentiment-analysis.png +0 -0
- package/screenshots/truth/nodes/split_by_llm/render/summarization.png +0 -0
- package/screenshots/truth/nodes/split_by_llm/render/translation-task.png +0 -0
- package/screenshots/truth/nodes/split_by_llm_categorize/editor/basic-categorization.png +0 -0
- package/screenshots/truth/nodes/split_by_llm_categorize/editor/custom-input-and-result-name.png +0 -0
- package/screenshots/truth/nodes/split_by_llm_categorize/editor/feedback-categorization.png +0 -0
- package/screenshots/truth/nodes/split_by_llm_categorize/editor/many-categories.png +0 -0
- package/screenshots/truth/nodes/split_by_llm_categorize/editor/minimal-categories.png +0 -0
- package/screenshots/truth/nodes/split_by_llm_categorize/render/basic-categorization.png +0 -0
- package/screenshots/truth/nodes/split_by_llm_categorize/render/custom-input-and-result-name.png +0 -0
- package/screenshots/truth/nodes/split_by_llm_categorize/render/feedback-categorization.png +0 -0
- package/screenshots/truth/nodes/split_by_llm_categorize/render/many-categories.png +0 -0
- package/screenshots/truth/nodes/split_by_llm_categorize/render/minimal-categories.png +0 -0
- package/screenshots/truth/nodes/split_by_random/editor/ab-test-multiple-variants.png +0 -0
- package/screenshots/truth/nodes/split_by_random/editor/sampling-split.png +0 -0
- package/screenshots/truth/nodes/split_by_random/editor/three-way-split.png +0 -0
- package/screenshots/truth/nodes/split_by_random/editor/two-bucket-split.png +0 -0
- package/screenshots/truth/nodes/split_by_random/render/ab-test-multiple-variants.png +0 -0
- package/screenshots/truth/nodes/split_by_random/render/sampling-split.png +0 -0
- package/screenshots/truth/nodes/split_by_random/render/three-way-split.png +0 -0
- package/screenshots/truth/nodes/split_by_random/render/two-bucket-split.png +0 -0
- package/screenshots/truth/nodes/wait_for_digits/editor/basic-digits-wait.png +0 -0
- package/screenshots/truth/nodes/wait_for_digits/editor/phone-number-collection.png +0 -0
- package/screenshots/truth/nodes/wait_for_digits/editor/single-digit-with-timeout.png +0 -0
- package/screenshots/truth/nodes/wait_for_digits/editor/verification-code.png +0 -0
- package/screenshots/truth/nodes/wait_for_digits/render/basic-digits-wait.png +0 -0
- package/screenshots/truth/nodes/wait_for_digits/render/phone-number-collection.png +0 -0
- package/screenshots/truth/nodes/wait_for_digits/render/single-digit-with-timeout.png +0 -0
- package/screenshots/truth/nodes/wait_for_digits/render/verification-code.png +0 -0
- package/screenshots/truth/nodes/wait_for_response/editor/basic-wait.png +0 -0
- package/screenshots/truth/nodes/wait_for_response/editor/custom-result-name.png +0 -0
- package/screenshots/truth/nodes/wait_for_response/editor/no-timeout.png +0 -0
- package/screenshots/truth/nodes/wait_for_response/editor/short-timeout.png +0 -0
- package/screenshots/truth/nodes/wait_for_response/render/basic-wait.png +0 -0
- package/screenshots/truth/nodes/wait_for_response/render/custom-result-name.png +0 -0
- package/screenshots/truth/nodes/wait_for_response/render/no-timeout.png +0 -0
- package/screenshots/truth/nodes/wait_for_response/render/short-timeout.png +0 -0
- package/screenshots/truth/run-list/basic.png +0 -0
- package/screenshots/truth/templates/default.png +0 -0
- package/screenshots/truth/wait-for-response/rules-editor.png +0 -0
- package/screenshots/truth/wait-for-response/timeout-editor-unchecked.png +0 -0
- package/screenshots/truth/wait-for-response/timeout-editor.png +0 -0
- package/scripts/dev-data-sync.mjs +182 -0
- package/src/display/Chat.ts +6 -4
- package/src/events.ts +6 -5
- package/src/flow/CanvasNode.ts +89 -79
- package/src/flow/Editor.ts +1 -0
- package/src/flow/NodeEditor.ts +55 -3
- package/src/flow/actions/add_contact_urn.ts +1 -1
- package/src/flow/actions/set_contact_channel.ts +1 -1
- package/src/flow/actions/set_contact_field.ts +2 -1
- package/src/flow/actions/set_contact_language.ts +3 -1
- package/src/flow/actions/set_contact_name.ts +1 -1
- package/src/flow/actions/set_contact_status.ts +18 -18
- package/src/flow/actions/set_run_result.ts +1 -1
- package/src/flow/nodes/split_by_llm.ts +14 -13
- package/src/flow/nodes/wait_for_response.ts +717 -5
- package/src/flow/operators.ts +215 -0
- package/src/flow/types.ts +10 -2
- package/src/form/ArrayEditor.ts +117 -37
- package/src/form/Checkbox.ts +12 -0
- package/src/form/FieldRenderer.ts +24 -3
- package/src/form/TextInput.ts +19 -1
- package/src/form/select/Select.ts +7 -0
- package/src/interfaces.ts +1 -1
- package/src/layout/Dialog.ts +4 -4
- package/src/list/RunList.ts +2 -2
- package/src/live/ContactChat.ts +144 -58
- package/src/live/ContactDetails.ts +7 -0
- package/src/live/ContactNameFetch.ts +1 -1
- package/static/api/labels.json +6 -1
- package/test/NodeHelper.ts +38 -40
- package/test/nodes/split_by_llm.test.ts +43 -32
- package/test/nodes/split_by_llm_categorize.test.ts +130 -120
- package/test/nodes/split_by_random.test.ts +136 -128
- package/test/nodes/wait_for_digits.test.ts +147 -127
- package/test/nodes/wait_for_response.test.ts +657 -104
- package/test/temba-checkbox.test.ts +36 -32
- package/test/temba-contact-chat.test.ts +2 -1
- package/test/temba-dropdown.test.ts +0 -12
- package/test/temba-flow-editor-node.test.ts +11 -4
- package/test/temba-integration-markdown.test.ts +16 -17
- package/test/temba-node-editor.test.ts +5 -43
- package/test/temba-run-list.test.ts +2 -2
- package/test/utils.test.ts +2 -1
- package/test-assets/list/runs.json +8 -8
- package/web-dev-mock.mjs +86 -30
- package/web-dev-server.config.mjs +272 -31
- package/screenshots/truth/dropdown/bottom-edge-collision.png +0 -0
- package/screenshots/truth/dropdown/right-edge-collision.png +0 -0
- package/screenshots/truth/editor/send_msg.png +0 -0
- package/screenshots/truth/editor/set_contact_language.png +0 -0
- package/screenshots/truth/editor/set_contact_name.png +0 -0
- package/screenshots/truth/editor/set_run_result.png +0 -0
- 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
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
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
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
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
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
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
|
-
|
|
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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AAC","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 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
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
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
|
-
|
|
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
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
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
|
-
|
|
67
|
-
|
|
68
|
-
|
|
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
|
-
|
|
72
|
-
|
|
73
|
-
{
|
|
74
|
-
|
|
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
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
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
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
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
|
-
|
|
134
|
-
|
|
135
|
-
{
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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,KAAK,CAAC;QACzC,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,gDAAgD,EAAE,GAAG,EAAE;YACxD,MAAM,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,SAAS,CAAC;YAC7C,MAAM,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC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;aACF;YACD,KAAK,EAAE;gBACL,EAAE,IAAI,EAAE,cAAc,EAAE,gBAAgB,EAAE,IAAI,EAAE;gBAChD,EAAE,IAAI,EAAE,cAAc,EAAE,gBAAgB,EAAE,IAAI,EAAE;gBAChD,EAAE,IAAI,EAAE,cAAc,EAAE,gBAAgB,EAAE,IAAI,EAAE;aACjD;SACM,EACT,EAAE,IAAI,EAAE,iBAAiB,EAAE,EAC3B,yBAAyB,CAC1B,CAAC;QAEF,MAAM,CAAC,QAAQ,CACb;YACE,IAAI,EAAE,oBAAoB;YAC1B,OAAO,EAAE,EAAE;YACX,MAAM,EAAE;gBACN,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE;oBACJ,IAAI,EAAE,KAAK;oBACX,IAAI,EAAE;wBACJ,IAAI,EAAE,QAAQ;wBACd,KAAK,EAAE,CAAC;qBACT;iBACF;gBACD,WAAW,EAAE,mBAAmB;gBAChC,UAAU,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"]}
|
|
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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AI,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"]}
|