@nyaruka/temba-components 0.131.1 → 0.131.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/.github/workflows/publish.yml +4 -1
- package/CHANGELOG.md +61 -1
- package/demo/data/flows/food-order.json +2 -2
- package/demo/data/flows/sample-flow.json +74 -125
- package/dist/static/svg/index.svg +1 -1
- package/dist/temba-components.js +1155 -618
- package/dist/temba-components.js.map +1 -1
- package/out-tsc/src/Icons.js +4 -1
- package/out-tsc/src/Icons.js.map +1 -1
- package/out-tsc/src/events.js.map +1 -1
- package/out-tsc/src/flow/CanvasMenu.js +200 -0
- package/out-tsc/src/flow/CanvasMenu.js.map +1 -0
- package/out-tsc/src/flow/CanvasNode.js +327 -19
- package/out-tsc/src/flow/CanvasNode.js.map +1 -1
- package/out-tsc/src/flow/Editor.js +562 -66
- package/out-tsc/src/flow/Editor.js.map +1 -1
- package/out-tsc/src/flow/NodeEditor.js +240 -93
- package/out-tsc/src/flow/NodeEditor.js.map +1 -1
- package/out-tsc/src/flow/NodeTypeSelector.js +499 -0
- package/out-tsc/src/flow/NodeTypeSelector.js.map +1 -0
- package/out-tsc/src/flow/actions/add_contact_groups.js +3 -3
- package/out-tsc/src/flow/actions/add_contact_groups.js.map +1 -1
- package/out-tsc/src/flow/actions/add_contact_urn.js +62 -4
- package/out-tsc/src/flow/actions/add_contact_urn.js.map +1 -1
- package/out-tsc/src/flow/actions/add_input_labels.js +3 -3
- package/out-tsc/src/flow/actions/add_input_labels.js.map +1 -1
- package/out-tsc/src/flow/actions/play_audio.js +2 -2
- package/out-tsc/src/flow/actions/play_audio.js.map +1 -1
- package/out-tsc/src/flow/actions/remove_contact_groups.js +6 -5
- package/out-tsc/src/flow/actions/remove_contact_groups.js.map +1 -1
- package/out-tsc/src/flow/actions/request_optin.js +2 -2
- package/out-tsc/src/flow/actions/request_optin.js.map +1 -1
- package/out-tsc/src/flow/actions/say_msg.js +2 -2
- package/out-tsc/src/flow/actions/say_msg.js.map +1 -1
- package/out-tsc/src/flow/actions/send_broadcast.js +76 -23
- package/out-tsc/src/flow/actions/send_broadcast.js.map +1 -1
- package/out-tsc/src/flow/actions/send_email.js +4 -5
- package/out-tsc/src/flow/actions/send_email.js.map +1 -1
- package/out-tsc/src/flow/actions/send_msg.js +9 -19
- package/out-tsc/src/flow/actions/send_msg.js.map +1 -1
- package/out-tsc/src/flow/actions/set_contact_channel.js +5 -9
- package/out-tsc/src/flow/actions/set_contact_channel.js.map +1 -1
- package/out-tsc/src/flow/actions/set_contact_field.js +19 -20
- package/out-tsc/src/flow/actions/set_contact_field.js.map +1 -1
- package/out-tsc/src/flow/actions/set_contact_language.js +2 -2
- package/out-tsc/src/flow/actions/set_contact_language.js.map +1 -1
- package/out-tsc/src/flow/actions/set_contact_name.js +2 -12
- package/out-tsc/src/flow/actions/set_contact_name.js.map +1 -1
- package/out-tsc/src/flow/actions/set_contact_status.js +2 -2
- package/out-tsc/src/flow/actions/set_contact_status.js.map +1 -1
- package/out-tsc/src/flow/actions/set_run_result.js +3 -3
- package/out-tsc/src/flow/actions/set_run_result.js.map +1 -1
- package/out-tsc/src/flow/actions/start_session.js +180 -6
- package/out-tsc/src/flow/actions/start_session.js.map +1 -1
- package/out-tsc/src/flow/config.js +11 -15
- package/out-tsc/src/flow/config.js.map +1 -1
- package/out-tsc/src/flow/currencies.js +45 -0
- package/out-tsc/src/flow/currencies.js.map +1 -0
- package/out-tsc/src/flow/nodes/shared-rules.js +257 -0
- package/out-tsc/src/flow/nodes/shared-rules.js.map +1 -0
- package/out-tsc/src/flow/nodes/shared.js +17 -0
- package/out-tsc/src/flow/nodes/shared.js.map +1 -0
- package/out-tsc/src/flow/nodes/split_by_airtime.js +205 -5
- package/out-tsc/src/flow/nodes/split_by_airtime.js.map +1 -1
- package/out-tsc/src/flow/nodes/split_by_contact_field.js +147 -3
- package/out-tsc/src/flow/nodes/split_by_contact_field.js.map +1 -1
- package/out-tsc/src/flow/nodes/split_by_expression.js +68 -2
- package/out-tsc/src/flow/nodes/split_by_expression.js.map +1 -1
- package/out-tsc/src/flow/nodes/split_by_groups.js +12 -9
- package/out-tsc/src/flow/nodes/split_by_groups.js.map +1 -1
- package/out-tsc/src/flow/nodes/split_by_intent.js +7 -0
- package/out-tsc/src/flow/nodes/split_by_intent.js.map +1 -0
- package/out-tsc/src/flow/nodes/split_by_llm.js +3 -2
- package/out-tsc/src/flow/nodes/split_by_llm.js.map +1 -1
- package/out-tsc/src/flow/nodes/split_by_llm_categorize.js +2 -2
- package/out-tsc/src/flow/nodes/split_by_llm_categorize.js.map +1 -1
- package/out-tsc/src/flow/nodes/split_by_random.js +3 -3
- package/out-tsc/src/flow/nodes/split_by_random.js.map +1 -1
- package/out-tsc/src/flow/nodes/split_by_resthook.js +108 -0
- package/out-tsc/src/flow/nodes/split_by_resthook.js.map +1 -0
- package/out-tsc/src/flow/nodes/split_by_run_result.js +206 -3
- package/out-tsc/src/flow/nodes/split_by_run_result.js.map +1 -1
- package/out-tsc/src/flow/nodes/split_by_scheme.js +153 -2
- package/out-tsc/src/flow/nodes/split_by_scheme.js.map +1 -1
- package/out-tsc/src/flow/nodes/split_by_subflow.js +6 -4
- package/out-tsc/src/flow/nodes/split_by_subflow.js.map +1 -1
- package/out-tsc/src/flow/nodes/split_by_ticket.js +3 -2
- package/out-tsc/src/flow/nodes/split_by_ticket.js.map +1 -1
- package/out-tsc/src/flow/nodes/split_by_webhook.js +3 -2
- package/out-tsc/src/flow/nodes/split_by_webhook.js.map +1 -1
- package/out-tsc/src/flow/nodes/wait_for_audio.js +2 -2
- package/out-tsc/src/flow/nodes/wait_for_audio.js.map +1 -1
- package/out-tsc/src/flow/nodes/wait_for_digits.js +2 -2
- package/out-tsc/src/flow/nodes/wait_for_digits.js.map +1 -1
- package/out-tsc/src/flow/nodes/wait_for_image.js +2 -2
- package/out-tsc/src/flow/nodes/wait_for_image.js.map +1 -1
- package/out-tsc/src/flow/nodes/wait_for_location.js +2 -2
- package/out-tsc/src/flow/nodes/wait_for_location.js.map +1 -1
- package/out-tsc/src/flow/nodes/wait_for_menu.js +2 -2
- package/out-tsc/src/flow/nodes/wait_for_menu.js.map +1 -1
- package/out-tsc/src/flow/nodes/wait_for_response.js +32 -567
- package/out-tsc/src/flow/nodes/wait_for_response.js.map +1 -1
- package/out-tsc/src/flow/nodes/wait_for_video.js +2 -2
- package/out-tsc/src/flow/nodes/wait_for_video.js.map +1 -1
- package/out-tsc/src/flow/types.js +71 -12
- package/out-tsc/src/flow/types.js.map +1 -1
- package/out-tsc/src/flow/utils.js +101 -14
- package/out-tsc/src/flow/utils.js.map +1 -1
- package/out-tsc/src/form/FieldRenderer.js +2 -4
- package/out-tsc/src/form/FieldRenderer.js.map +1 -1
- package/out-tsc/src/interfaces.js +3 -0
- package/out-tsc/src/interfaces.js.map +1 -1
- package/out-tsc/src/list/SortableList.js +98 -33
- package/out-tsc/src/list/SortableList.js.map +1 -1
- package/out-tsc/src/live/ContactChat.js +15 -18
- package/out-tsc/src/live/ContactChat.js.map +1 -1
- package/out-tsc/src/store/AppState.js +53 -0
- package/out-tsc/src/store/AppState.js.map +1 -1
- package/out-tsc/src/utils.js +254 -13
- package/out-tsc/src/utils.js.map +1 -1
- package/out-tsc/temba-modules.js +4 -0
- package/out-tsc/temba-modules.js.map +1 -1
- package/out-tsc/test/ActionHelper.js +3 -3
- package/out-tsc/test/ActionHelper.js.map +1 -1
- package/out-tsc/test/NodeHelper.js +6 -3
- package/out-tsc/test/NodeHelper.js.map +1 -1
- package/out-tsc/test/actions/add_contact_urn.test.js +202 -0
- package/out-tsc/test/actions/add_contact_urn.test.js.map +1 -0
- package/out-tsc/test/actions/send_broadcast.test.js +148 -0
- package/out-tsc/test/actions/send_broadcast.test.js.map +1 -0
- package/out-tsc/test/actions/send_email.test.js +17 -23
- package/out-tsc/test/actions/send_email.test.js.map +1 -1
- package/out-tsc/test/actions/send_msg.test.js +33 -15
- package/out-tsc/test/actions/send_msg.test.js.map +1 -1
- package/out-tsc/test/actions/start_session.test.js +116 -0
- package/out-tsc/test/actions/start_session.test.js.map +1 -0
- package/out-tsc/test/nodes/split_by_airtime.test.js +604 -0
- package/out-tsc/test/nodes/split_by_airtime.test.js.map +1 -0
- package/out-tsc/test/nodes/split_by_contact_field.test.js +387 -0
- package/out-tsc/test/nodes/split_by_contact_field.test.js.map +1 -0
- package/out-tsc/test/nodes/split_by_expression.test.js +614 -0
- package/out-tsc/test/nodes/split_by_expression.test.js.map +1 -0
- package/out-tsc/test/nodes/split_by_random.test.js +3 -3
- package/out-tsc/test/nodes/split_by_random.test.js.map +1 -1
- package/out-tsc/test/nodes/split_by_resthook.test.js +337 -0
- package/out-tsc/test/nodes/split_by_resthook.test.js.map +1 -0
- package/out-tsc/test/nodes/split_by_run_result.test.js +920 -0
- package/out-tsc/test/nodes/split_by_run_result.test.js.map +1 -0
- package/out-tsc/test/nodes/split_by_scheme.test.js +399 -0
- package/out-tsc/test/nodes/split_by_scheme.test.js.map +1 -0
- package/out-tsc/test/nodes/split_by_subflow.test.js +333 -0
- package/out-tsc/test/nodes/split_by_subflow.test.js.map +1 -0
- package/out-tsc/test/nodes/wait_for_digits.test.js +2 -2
- package/out-tsc/test/nodes/wait_for_digits.test.js.map +1 -1
- package/out-tsc/test/nodes/wait_for_response.test.js +2 -1
- package/out-tsc/test/nodes/wait_for_response.test.js.map +1 -1
- package/out-tsc/test/temba-action-drag-between-nodes.test.js +252 -0
- package/out-tsc/test/temba-action-drag-between-nodes.test.js.map +1 -0
- package/out-tsc/test/temba-canvas-menu.test.js +122 -0
- package/out-tsc/test/temba-canvas-menu.test.js.map +1 -0
- package/out-tsc/test/temba-flow-editor-node.test.js +85 -2
- package/out-tsc/test/temba-flow-editor-node.test.js.map +1 -1
- package/out-tsc/test/temba-flow-editor.test.js +7 -8
- package/out-tsc/test/temba-flow-editor.test.js.map +1 -1
- package/out-tsc/test/temba-node-editor.test.js +3 -1
- package/out-tsc/test/temba-node-editor.test.js.map +1 -1
- package/out-tsc/test/temba-node-type-selector.test.js +115 -0
- package/out-tsc/test/temba-node-type-selector.test.js.map +1 -0
- package/out-tsc/test/temba-omnibox.test.js +2 -1
- package/out-tsc/test/temba-omnibox.test.js.map +1 -1
- package/out-tsc/test/temba-sortable-list.test.js +51 -0
- package/out-tsc/test/temba-sortable-list.test.js.map +1 -1
- package/out-tsc/test/temba-utils-index.test.js +1 -27
- package/out-tsc/test/temba-utils-index.test.js.map +1 -1
- package/out-tsc/test/utils.test.js +2 -0
- package/out-tsc/test/utils.test.js.map +1 -1
- package/package.json +2 -1
- 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/add_contact_urn/editor/expression-facebook.png +0 -0
- package/screenshots/truth/actions/add_contact_urn/editor/expression-phone.png +0 -0
- package/screenshots/truth/actions/add_contact_urn/editor/facebook-id.png +0 -0
- package/screenshots/truth/actions/add_contact_urn/editor/instagram-handle.png +0 -0
- package/screenshots/truth/actions/add_contact_urn/editor/line-id.png +0 -0
- package/screenshots/truth/actions/add_contact_urn/editor/phone-number.png +0 -0
- package/screenshots/truth/actions/add_contact_urn/editor/telegram-id.png +0 -0
- package/screenshots/truth/actions/add_contact_urn/editor/viber-id.png +0 -0
- package/screenshots/truth/actions/add_contact_urn/editor/wechat-id.png +0 -0
- package/screenshots/truth/actions/add_contact_urn/editor/whatsapp.png +0 -0
- package/screenshots/truth/actions/add_contact_urn/render/expression-facebook.png +0 -0
- package/screenshots/truth/actions/add_contact_urn/render/expression-phone.png +0 -0
- package/screenshots/truth/actions/add_contact_urn/render/facebook-id.png +0 -0
- package/screenshots/truth/actions/add_contact_urn/render/instagram-handle.png +0 -0
- package/screenshots/truth/actions/add_contact_urn/render/line-id.png +0 -0
- package/screenshots/truth/actions/add_contact_urn/render/phone-number.png +0 -0
- package/screenshots/truth/actions/add_contact_urn/render/telegram-id.png +0 -0
- package/screenshots/truth/actions/add_contact_urn/render/viber-id.png +0 -0
- package/screenshots/truth/actions/add_contact_urn/render/wechat-id.png +0 -0
- package/screenshots/truth/actions/add_contact_urn/render/whatsapp.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_broadcast/editor/contacts-only.png +0 -0
- package/screenshots/truth/actions/send_broadcast/editor/groups-and-contacts.png +0 -0
- package/screenshots/truth/actions/send_broadcast/editor/groups-only.png +0 -0
- package/screenshots/truth/actions/send_broadcast/editor/many-groups.png +0 -0
- package/screenshots/truth/actions/send_broadcast/editor/multiline-text.png +0 -0
- package/screenshots/truth/actions/send_broadcast/editor/with-attachments.png +0 -0
- package/screenshots/truth/actions/send_broadcast/render/contacts-only.png +0 -0
- package/screenshots/truth/actions/send_broadcast/render/groups-and-contacts.png +0 -0
- package/screenshots/truth/actions/send_broadcast/render/groups-only.png +0 -0
- package/screenshots/truth/actions/send_broadcast/render/many-groups.png +0 -0
- package/screenshots/truth/actions/send_broadcast/render/multiline-text.png +0 -0
- package/screenshots/truth/actions/send_broadcast/render/with-attachments.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/actions/start_session/editor/contact-query.png +0 -0
- package/screenshots/truth/actions/start_session/editor/contacts-only.png +0 -0
- package/screenshots/truth/actions/start_session/editor/create-contact.png +0 -0
- package/screenshots/truth/actions/start_session/editor/groups-and-contacts.png +0 -0
- package/screenshots/truth/actions/start_session/editor/groups-only.png +0 -0
- package/screenshots/truth/actions/start_session/editor/many-recipients.png +0 -0
- package/screenshots/truth/actions/start_session/render/contact-query.png +0 -0
- package/screenshots/truth/actions/start_session/render/contacts-only.png +0 -0
- package/screenshots/truth/actions/start_session/render/create-contact.png +0 -0
- package/screenshots/truth/actions/start_session/render/groups-and-contacts.png +0 -0
- package/screenshots/truth/actions/start_session/render/groups-only.png +0 -0
- package/screenshots/truth/actions/start_session/render/many-recipients.png +0 -0
- package/screenshots/truth/canvas-menu/open.png +0 -0
- package/screenshots/truth/editor/router.png +0 -0
- package/screenshots/truth/editor/wait.png +0 -0
- package/screenshots/truth/list/fields-dragging.png +0 -0
- package/screenshots/truth/list/sortable-dragging.png +0 -0
- package/screenshots/truth/node-type-selector/action-mode.png +0 -0
- package/screenshots/truth/node-type-selector/split-mode.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/src/Icons.ts +4 -1
- package/src/events.ts +2 -6
- package/src/flow/CanvasMenu.ts +217 -0
- package/src/flow/CanvasNode.ts +408 -10
- package/src/flow/Editor.ts +683 -44
- package/src/flow/NodeEditor.ts +304 -125
- package/src/flow/NodeTypeSelector.ts +592 -0
- package/src/flow/actions/add_contact_groups.ts +4 -4
- package/src/flow/actions/add_contact_urn.ts +76 -4
- package/src/flow/actions/add_input_labels.ts +4 -4
- package/src/flow/actions/play_audio.ts +2 -2
- package/src/flow/actions/remove_contact_groups.ts +14 -6
- package/src/flow/actions/request_optin.ts +2 -2
- package/src/flow/actions/say_msg.ts +2 -2
- package/src/flow/actions/send_broadcast.ts +85 -23
- package/src/flow/actions/send_email.ts +10 -6
- package/src/flow/actions/send_msg.ts +22 -32
- package/src/flow/actions/set_contact_channel.ts +5 -11
- package/src/flow/actions/set_contact_field.ts +20 -25
- package/src/flow/actions/set_contact_language.ts +9 -4
- package/src/flow/actions/set_contact_name.ts +3 -15
- package/src/flow/actions/set_contact_status.ts +3 -3
- package/src/flow/actions/set_run_result.ts +4 -4
- package/src/flow/actions/start_session.ts +208 -6
- package/src/flow/config.ts +13 -15
- package/src/flow/currencies.ts +51 -0
- package/src/flow/nodes/shared-rules.ts +301 -0
- package/src/flow/nodes/shared.ts +18 -0
- package/src/flow/nodes/split_by_airtime.ts +238 -5
- package/src/flow/nodes/split_by_contact_field.ts +185 -3
- package/src/flow/nodes/split_by_expression.ts +94 -2
- package/src/flow/nodes/split_by_groups.ts +15 -10
- package/src/flow/nodes/split_by_intent.ts +7 -0
- package/src/flow/nodes/split_by_llm.ts +4 -3
- package/src/flow/nodes/split_by_llm_categorize.ts +4 -4
- package/src/flow/nodes/split_by_random.ts +5 -5
- package/src/flow/nodes/split_by_resthook.ts +130 -0
- package/src/flow/nodes/split_by_run_result.ts +249 -3
- package/src/flow/nodes/split_by_scheme.ts +192 -2
- package/src/flow/nodes/split_by_subflow.ts +6 -4
- package/src/flow/nodes/split_by_ticket.ts +4 -3
- package/src/flow/nodes/split_by_webhook.ts +6 -5
- package/src/flow/nodes/wait_for_audio.ts +2 -2
- package/src/flow/nodes/wait_for_digits.ts +2 -2
- package/src/flow/nodes/wait_for_image.ts +2 -2
- package/src/flow/nodes/wait_for_location.ts +2 -2
- package/src/flow/nodes/wait_for_menu.ts +2 -2
- package/src/flow/nodes/wait_for_response.ts +48 -679
- package/src/flow/nodes/wait_for_video.ts +2 -2
- package/src/flow/types.ts +109 -23
- package/src/flow/utils.ts +108 -14
- package/src/form/FieldRenderer.ts +2 -4
- package/src/interfaces.ts +3 -0
- package/src/list/SortableList.ts +109 -34
- package/src/live/ContactChat.ts +15 -18
- package/src/store/AppState.ts +69 -0
- package/src/store/flow-definition.d.ts +2 -5
- package/src/utils.ts +332 -12
- package/static/api/channels.json +46 -0
- package/static/api/resthooks.json +31 -0
- package/static/svg/index.svg +1 -1
- package/static/svg/work/traced/lightning-02.svg +1 -0
- package/static/svg/work/used/lightning-02.svg +3 -0
- package/temba-modules.ts +4 -0
- package/test/ActionHelper.ts +3 -3
- package/test/NodeHelper.ts +6 -3
- package/test/actions/add_contact_urn.test.ts +287 -0
- package/test/actions/send_broadcast.test.ts +190 -0
- package/test/actions/send_email.test.ts +17 -23
- package/test/actions/send_msg.test.ts +39 -15
- package/test/actions/start_session.test.ts +151 -0
- package/test/nodes/split_by_airtime.test.ts +673 -0
- package/test/nodes/split_by_contact_field.test.ts +451 -0
- package/test/nodes/split_by_expression.test.ts +751 -0
- package/test/nodes/split_by_random.test.ts +3 -3
- package/test/nodes/split_by_resthook.test.ts +398 -0
- package/test/nodes/split_by_run_result.test.ts +1109 -0
- package/test/nodes/split_by_scheme.test.ts +486 -0
- package/test/nodes/split_by_subflow.test.ts +381 -0
- package/test/nodes/wait_for_digits.test.ts +2 -2
- package/test/nodes/wait_for_response.test.ts +2 -1
- package/test/temba-action-drag-between-nodes.test.ts +301 -0
- package/test/temba-canvas-menu.test.ts +156 -0
- package/test/temba-flow-editor-node.test.ts +102 -2
- package/test/temba-flow-editor.test.ts +7 -8
- package/test/temba-node-editor.test.ts +3 -1
- package/test/temba-node-type-selector.test.ts +152 -0
- package/test/temba-omnibox.test.ts +2 -1
- package/test/temba-sortable-list.test.ts +69 -0
- package/test/temba-utils-index.test.ts +0 -35
- package/test/utils.test.ts +2 -0
- package/test-assets/contacts/history.json +14 -20
- package/web-dev-server.config.mjs +3 -1
- package/out-tsc/src/flow/actions/call_classifier.js +0 -11
- package/out-tsc/src/flow/actions/call_classifier.js.map +0 -1
- package/out-tsc/src/flow/actions/call_resthook.js +0 -11
- package/out-tsc/src/flow/actions/call_resthook.js.map +0 -1
- package/out-tsc/src/flow/actions/split_by_expression_example.js +0 -77
- package/out-tsc/src/flow/actions/split_by_expression_example.js.map +0 -1
- package/out-tsc/src/flow/actions/transfer_airtime.js +0 -11
- package/out-tsc/src/flow/actions/transfer_airtime.js.map +0 -1
- package/src/flow/actions/call_classifier.ts +0 -12
- package/src/flow/actions/call_resthook.ts +0 -12
- package/src/flow/actions/split_by_expression_example.ts +0 -88
- package/src/flow/actions/transfer_airtime.ts +0 -12
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
import { expect } from '@open-wc/testing';
|
|
2
|
+
import { split_by_subflow } from '../../src/flow/nodes/split_by_subflow';
|
|
3
|
+
import { NodeTest } from '../NodeHelper';
|
|
4
|
+
/**
|
|
5
|
+
* Test suite for the split_by_subflow node configuration.
|
|
6
|
+
*/
|
|
7
|
+
describe('split_by_subflow node config', () => {
|
|
8
|
+
const helper = new NodeTest(split_by_subflow, 'split_by_subflow');
|
|
9
|
+
describe('basic properties', () => {
|
|
10
|
+
helper.testBasicProperties();
|
|
11
|
+
it('has correct name', () => {
|
|
12
|
+
expect(split_by_subflow.name).to.equal('Enter a Flow');
|
|
13
|
+
});
|
|
14
|
+
it('has correct type', () => {
|
|
15
|
+
expect(split_by_subflow.type).to.equal('split_by_subflow');
|
|
16
|
+
});
|
|
17
|
+
it('has showAsAction set to true', () => {
|
|
18
|
+
expect(split_by_subflow.showAsAction).to.be.true;
|
|
19
|
+
});
|
|
20
|
+
it('has form configuration', () => {
|
|
21
|
+
expect(split_by_subflow.form).to.exist;
|
|
22
|
+
expect(split_by_subflow.form.flow).to.exist;
|
|
23
|
+
expect(split_by_subflow.form.flow.type).to.equal('select');
|
|
24
|
+
expect(split_by_subflow.form.flow.required).to.be.true;
|
|
25
|
+
});
|
|
26
|
+
it('has layout configuration', () => {
|
|
27
|
+
expect(split_by_subflow.layout).to.exist;
|
|
28
|
+
expect(split_by_subflow.layout).to.deep.equal(['flow']);
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
describe('toFormData', () => {
|
|
32
|
+
it('extracts data from node with enter_flow action', () => {
|
|
33
|
+
const node = {
|
|
34
|
+
uuid: 'test-node',
|
|
35
|
+
actions: [
|
|
36
|
+
{
|
|
37
|
+
uuid: 'test-action',
|
|
38
|
+
type: 'enter_flow',
|
|
39
|
+
flow: { uuid: 'flow-123', name: 'Registration Flow' }
|
|
40
|
+
}
|
|
41
|
+
],
|
|
42
|
+
router: {
|
|
43
|
+
type: 'switch',
|
|
44
|
+
operand: '@child.status',
|
|
45
|
+
cases: [
|
|
46
|
+
{
|
|
47
|
+
uuid: 'case-1',
|
|
48
|
+
type: 'has_only_text',
|
|
49
|
+
arguments: ['completed'],
|
|
50
|
+
category_uuid: 'cat-1'
|
|
51
|
+
}
|
|
52
|
+
],
|
|
53
|
+
categories: [
|
|
54
|
+
{ uuid: 'cat-1', name: 'Complete', exit_uuid: 'exit-1' },
|
|
55
|
+
{ uuid: 'cat-2', name: 'Expired', exit_uuid: 'exit-2' }
|
|
56
|
+
],
|
|
57
|
+
default_category_uuid: 'cat-2'
|
|
58
|
+
},
|
|
59
|
+
exits: [
|
|
60
|
+
{ uuid: 'exit-1', destination_uuid: null },
|
|
61
|
+
{ uuid: 'exit-2', destination_uuid: null }
|
|
62
|
+
]
|
|
63
|
+
};
|
|
64
|
+
const formData = split_by_subflow.toFormData(node);
|
|
65
|
+
expect(formData.uuid).to.equal('test-node');
|
|
66
|
+
expect(formData.flow).to.be.an('array');
|
|
67
|
+
expect(formData.flow).to.have.lengthOf(1);
|
|
68
|
+
expect(formData.flow[0]).to.deep.equal({
|
|
69
|
+
uuid: 'flow-123',
|
|
70
|
+
name: 'Registration Flow'
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
it('handles empty node', () => {
|
|
74
|
+
const node = {
|
|
75
|
+
uuid: 'test-node',
|
|
76
|
+
actions: [],
|
|
77
|
+
exits: []
|
|
78
|
+
};
|
|
79
|
+
const formData = split_by_subflow.toFormData(node);
|
|
80
|
+
expect(formData.uuid).to.equal('test-node');
|
|
81
|
+
expect(formData.flow).to.be.an('array');
|
|
82
|
+
expect(formData.flow).to.have.lengthOf(0);
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
describe('fromFormData', () => {
|
|
86
|
+
it('creates node with enter_flow action and router from form data', () => {
|
|
87
|
+
const formData = {
|
|
88
|
+
uuid: 'test-node',
|
|
89
|
+
flow: [{ uuid: 'flow-123', name: 'Registration Flow' }]
|
|
90
|
+
};
|
|
91
|
+
const originalNode = {
|
|
92
|
+
uuid: 'test-node',
|
|
93
|
+
actions: [],
|
|
94
|
+
exits: []
|
|
95
|
+
};
|
|
96
|
+
const node = split_by_subflow.fromFormData(formData, originalNode);
|
|
97
|
+
// Check node structure
|
|
98
|
+
expect(node.uuid).to.equal('test-node');
|
|
99
|
+
expect(node.actions).to.have.length(1);
|
|
100
|
+
expect(node.actions[0].type).to.equal('enter_flow');
|
|
101
|
+
// Check enter_flow action has properly formatted flow
|
|
102
|
+
const enterFlowAction = node.actions[0];
|
|
103
|
+
expect(enterFlowAction.flow).to.exist;
|
|
104
|
+
expect(enterFlowAction.flow.uuid).to.equal('flow-123');
|
|
105
|
+
expect(enterFlowAction.flow.name).to.equal('Registration Flow');
|
|
106
|
+
// Check router
|
|
107
|
+
expect(node.router).to.exist;
|
|
108
|
+
expect(node.router.type).to.equal('switch');
|
|
109
|
+
expect(node.router.operand).to.equal('@child.status');
|
|
110
|
+
expect(node.router.categories).to.have.length(2);
|
|
111
|
+
expect(node.router.categories[0].name).to.equal('Complete');
|
|
112
|
+
expect(node.router.categories[1].name).to.equal('Expired');
|
|
113
|
+
// Check exits
|
|
114
|
+
expect(node.exits).to.have.length(2);
|
|
115
|
+
});
|
|
116
|
+
it('handles empty flow selection', () => {
|
|
117
|
+
const formData = {
|
|
118
|
+
uuid: 'test-node',
|
|
119
|
+
flow: []
|
|
120
|
+
};
|
|
121
|
+
const originalNode = {
|
|
122
|
+
uuid: 'test-node',
|
|
123
|
+
actions: [],
|
|
124
|
+
exits: []
|
|
125
|
+
};
|
|
126
|
+
const node = split_by_subflow.fromFormData(formData, originalNode);
|
|
127
|
+
// Should still create the node structure
|
|
128
|
+
expect(node.actions).to.have.length(1);
|
|
129
|
+
const enterFlowAction = node.actions[0];
|
|
130
|
+
expect(enterFlowAction.flow.uuid).to.equal('');
|
|
131
|
+
expect(enterFlowAction.flow.name).to.equal('');
|
|
132
|
+
});
|
|
133
|
+
it('preserves UUIDs when editing existing node', () => {
|
|
134
|
+
const existingNode = {
|
|
135
|
+
uuid: 'test-node',
|
|
136
|
+
actions: [
|
|
137
|
+
{
|
|
138
|
+
uuid: 'existing-action-uuid',
|
|
139
|
+
type: 'enter_flow',
|
|
140
|
+
flow: { uuid: 'flow-old', name: 'Old Flow' }
|
|
141
|
+
}
|
|
142
|
+
],
|
|
143
|
+
router: {
|
|
144
|
+
type: 'switch',
|
|
145
|
+
operand: '@child.status',
|
|
146
|
+
cases: [
|
|
147
|
+
{
|
|
148
|
+
uuid: 'existing-case-uuid',
|
|
149
|
+
type: 'has_only_text',
|
|
150
|
+
arguments: ['completed'],
|
|
151
|
+
category_uuid: 'existing-cat-1'
|
|
152
|
+
}
|
|
153
|
+
],
|
|
154
|
+
categories: [
|
|
155
|
+
{
|
|
156
|
+
uuid: 'existing-cat-1',
|
|
157
|
+
name: 'Complete',
|
|
158
|
+
exit_uuid: 'existing-exit-1'
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
uuid: 'existing-cat-2',
|
|
162
|
+
name: 'Expired',
|
|
163
|
+
exit_uuid: 'existing-exit-2'
|
|
164
|
+
}
|
|
165
|
+
],
|
|
166
|
+
default_category_uuid: 'existing-cat-2'
|
|
167
|
+
},
|
|
168
|
+
exits: [
|
|
169
|
+
{ uuid: 'existing-exit-1', destination_uuid: null },
|
|
170
|
+
{ uuid: 'existing-exit-2', destination_uuid: null }
|
|
171
|
+
]
|
|
172
|
+
};
|
|
173
|
+
const formData = {
|
|
174
|
+
uuid: 'test-node',
|
|
175
|
+
flow: [{ uuid: 'flow-new', name: 'New Flow' }]
|
|
176
|
+
};
|
|
177
|
+
const node = split_by_subflow.fromFormData(formData, existingNode);
|
|
178
|
+
// Should preserve action UUID
|
|
179
|
+
expect(node.actions[0].uuid).to.equal('existing-action-uuid');
|
|
180
|
+
// Should preserve router structure UUIDs
|
|
181
|
+
expect(node.router.categories[0].uuid).to.equal('existing-cat-1');
|
|
182
|
+
expect(node.router.categories[1].uuid).to.equal('existing-cat-2');
|
|
183
|
+
expect(node.exits[0].uuid).to.equal('existing-exit-1');
|
|
184
|
+
expect(node.exits[1].uuid).to.equal('existing-exit-2');
|
|
185
|
+
// But should update the flow
|
|
186
|
+
const enterFlowAction = node.actions[0];
|
|
187
|
+
expect(enterFlowAction.flow.uuid).to.equal('flow-new');
|
|
188
|
+
expect(enterFlowAction.flow.name).to.equal('New Flow');
|
|
189
|
+
});
|
|
190
|
+
});
|
|
191
|
+
describe('round-trip transformation', () => {
|
|
192
|
+
it('should preserve node structure through toFormData -> fromFormData', () => {
|
|
193
|
+
const originalNode = {
|
|
194
|
+
uuid: 'test-node-uuid',
|
|
195
|
+
actions: [
|
|
196
|
+
{
|
|
197
|
+
uuid: 'action-uuid',
|
|
198
|
+
type: 'enter_flow',
|
|
199
|
+
flow: { uuid: 'flow-456', name: 'My Subflow' }
|
|
200
|
+
}
|
|
201
|
+
],
|
|
202
|
+
router: {
|
|
203
|
+
type: 'switch',
|
|
204
|
+
operand: '@child.status',
|
|
205
|
+
cases: [
|
|
206
|
+
{
|
|
207
|
+
uuid: 'case-uuid',
|
|
208
|
+
type: 'has_only_text',
|
|
209
|
+
arguments: ['completed'],
|
|
210
|
+
category_uuid: 'cat-complete'
|
|
211
|
+
}
|
|
212
|
+
],
|
|
213
|
+
categories: [
|
|
214
|
+
{
|
|
215
|
+
uuid: 'cat-complete',
|
|
216
|
+
name: 'Complete',
|
|
217
|
+
exit_uuid: 'exit-complete'
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
uuid: 'cat-expired',
|
|
221
|
+
name: 'Expired',
|
|
222
|
+
exit_uuid: 'exit-expired'
|
|
223
|
+
}
|
|
224
|
+
],
|
|
225
|
+
default_category_uuid: 'cat-expired'
|
|
226
|
+
},
|
|
227
|
+
exits: [
|
|
228
|
+
{ uuid: 'exit-complete', destination_uuid: null },
|
|
229
|
+
{ uuid: 'exit-expired', destination_uuid: null }
|
|
230
|
+
]
|
|
231
|
+
};
|
|
232
|
+
// Convert to form data
|
|
233
|
+
const formData = split_by_subflow.toFormData(originalNode);
|
|
234
|
+
// Convert back to node
|
|
235
|
+
const resultNode = split_by_subflow.fromFormData(formData, originalNode);
|
|
236
|
+
// Should match the original structure
|
|
237
|
+
expect(resultNode).to.deep.equal(originalNode);
|
|
238
|
+
});
|
|
239
|
+
});
|
|
240
|
+
describe('NodeEditor integration', () => {
|
|
241
|
+
it('should properly use node fromFormData when formDataToNode is called', async () => {
|
|
242
|
+
// This test simulates the bug where node.fromFormData should be used
|
|
243
|
+
// to create the entire node (including actions), not action.fromFormData
|
|
244
|
+
const { fixture, html } = await import('@open-wc/testing');
|
|
245
|
+
await import('../../temba-modules');
|
|
246
|
+
const originalNode = {
|
|
247
|
+
uuid: 'test-node-uuid',
|
|
248
|
+
actions: [
|
|
249
|
+
{
|
|
250
|
+
uuid: 'action-uuid',
|
|
251
|
+
type: 'enter_flow',
|
|
252
|
+
flow: { uuid: 'flow-old', name: 'Old Flow' }
|
|
253
|
+
}
|
|
254
|
+
],
|
|
255
|
+
router: {
|
|
256
|
+
type: 'switch',
|
|
257
|
+
operand: '@child.status',
|
|
258
|
+
cases: [
|
|
259
|
+
{
|
|
260
|
+
uuid: 'case-uuid',
|
|
261
|
+
type: 'has_only_text',
|
|
262
|
+
arguments: ['completed'],
|
|
263
|
+
category_uuid: 'cat-complete'
|
|
264
|
+
}
|
|
265
|
+
],
|
|
266
|
+
categories: [
|
|
267
|
+
{
|
|
268
|
+
uuid: 'cat-complete',
|
|
269
|
+
name: 'Complete',
|
|
270
|
+
exit_uuid: 'exit-complete'
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
uuid: 'cat-expired',
|
|
274
|
+
name: 'Expired',
|
|
275
|
+
exit_uuid: 'exit-expired'
|
|
276
|
+
}
|
|
277
|
+
],
|
|
278
|
+
default_category_uuid: 'cat-expired'
|
|
279
|
+
},
|
|
280
|
+
exits: [
|
|
281
|
+
{ uuid: 'exit-complete', destination_uuid: null },
|
|
282
|
+
{ uuid: 'exit-expired', destination_uuid: null }
|
|
283
|
+
]
|
|
284
|
+
};
|
|
285
|
+
const nodeUI = {
|
|
286
|
+
type: 'split_by_subflow',
|
|
287
|
+
position: { left: 50, top: 50 }
|
|
288
|
+
};
|
|
289
|
+
// Create the node editor
|
|
290
|
+
const nodeEditor = (await fixture(html `
|
|
291
|
+
<temba-node-editor
|
|
292
|
+
.node=${originalNode}
|
|
293
|
+
.nodeUI=${nodeUI}
|
|
294
|
+
.action=${originalNode.actions[0]}
|
|
295
|
+
.isOpen=${true}
|
|
296
|
+
></temba-node-editor>
|
|
297
|
+
`));
|
|
298
|
+
await nodeEditor.updateComplete;
|
|
299
|
+
await new Promise((resolve) => setTimeout(resolve, 200));
|
|
300
|
+
await nodeEditor.updateComplete;
|
|
301
|
+
// Get the initial formData to verify toFormData was called
|
|
302
|
+
const initialFormData = nodeEditor.formData;
|
|
303
|
+
expect(initialFormData.flow).to.exist;
|
|
304
|
+
expect(initialFormData.flow).to.have.lengthOf(1);
|
|
305
|
+
expect(initialFormData.flow[0].uuid).to.equal('flow-old');
|
|
306
|
+
// Simulate changing the flow selection
|
|
307
|
+
const newFormData = {
|
|
308
|
+
...initialFormData,
|
|
309
|
+
flow: [{ uuid: 'flow-new', name: 'New Flow' }]
|
|
310
|
+
};
|
|
311
|
+
// Call formDataToNode directly to test the transformation
|
|
312
|
+
const resultNode = nodeEditor.formDataToNode(newFormData);
|
|
313
|
+
// Verify that the result node has the new flow properly formatted
|
|
314
|
+
expect(resultNode).to.exist;
|
|
315
|
+
expect(resultNode.actions).to.have.length(1);
|
|
316
|
+
const enterFlowAction = resultNode.actions[0];
|
|
317
|
+
expect(enterFlowAction.type).to.equal('enter_flow');
|
|
318
|
+
// This is the key assertion - the flow should be properly formatted
|
|
319
|
+
// as created by node's fromFormData, not by action's fromFormData
|
|
320
|
+
expect(enterFlowAction.flow).to.exist;
|
|
321
|
+
expect(enterFlowAction.flow.uuid).to.equal('flow-new');
|
|
322
|
+
expect(enterFlowAction.flow.name).to.equal('New Flow');
|
|
323
|
+
// The flow should NOT have extra properties that might come from the select component
|
|
324
|
+
expect(enterFlowAction.flow).to.not.have.property('value');
|
|
325
|
+
// Verify router structure was also created properly by node's fromFormData
|
|
326
|
+
expect(resultNode.router).to.exist;
|
|
327
|
+
expect(resultNode.router.type).to.equal('switch');
|
|
328
|
+
expect(resultNode.router.categories).to.have.length(2);
|
|
329
|
+
expect(resultNode.exits).to.have.length(2);
|
|
330
|
+
});
|
|
331
|
+
});
|
|
332
|
+
});
|
|
333
|
+
//# sourceMappingURL=split_by_subflow.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"split_by_subflow.test.js","sourceRoot":"","sources":["../../../test/nodes/split_by_subflow.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAC;AAEzE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC;;GAEG;AACH,QAAQ,CAAC,8BAA8B,EAAE,GAAG,EAAE;IAC5C,MAAM,MAAM,GAAG,IAAI,QAAQ,CAAC,gBAAgB,EAAE,kBAAkB,CAAC,CAAC;IAElE,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;QAChC,MAAM,CAAC,mBAAmB,EAAE,CAAC;QAE7B,EAAE,CAAC,kBAAkB,EAAE,GAAG,EAAE;YAC1B,MAAM,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;QACzD,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,kBAAkB,EAAE,GAAG,EAAE;YAC1B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C,UAAU,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;YACvD,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QAC7C,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { expect } from '@open-wc/testing';\nimport { split_by_subflow } from '../../src/flow/nodes/split_by_subflow';\nimport { Node } from '../../src/store/flow-definition';\nimport { NodeTest } from '../NodeHelper';\n\n/**\n * Test suite for the split_by_subflow node configuration.\n */\ndescribe('split_by_subflow node config', () => {\n const helper = new NodeTest(split_by_subflow, 'split_by_subflow');\n\n describe('basic properties', () => {\n helper.testBasicProperties();\n\n it('has correct name', () => {\n expect(split_by_subflow.name).to.equal('Enter a Flow');\n });\n\n it('has correct type', () => {\n expect(split_by_subflow.type).to.equal('split_by_subflow');\n });\n\n it('has showAsAction set to true', () => {\n expect(split_by_subflow.showAsAction).to.be.true;\n });\n\n it('has form configuration', () => {\n expect(split_by_subflow.form).to.exist;\n expect(split_by_subflow.form.flow).to.exist;\n expect(split_by_subflow.form.flow.type).to.equal('select');\n expect(split_by_subflow.form.flow.required).to.be.true;\n });\n\n it('has layout configuration', () => {\n expect(split_by_subflow.layout).to.exist;\n expect(split_by_subflow.layout).to.deep.equal(['flow']);\n });\n });\n\n describe('toFormData', () => {\n it('extracts data from node with enter_flow action', () => {\n const node: Node = {\n uuid: 'test-node',\n actions: [\n {\n uuid: 'test-action',\n type: 'enter_flow',\n flow: { uuid: 'flow-123', name: 'Registration Flow' }\n } as any\n ],\n router: {\n type: 'switch',\n operand: '@child.status',\n cases: [\n {\n uuid: 'case-1',\n type: 'has_only_text',\n arguments: ['completed'],\n category_uuid: 'cat-1'\n }\n ],\n categories: [\n { uuid: 'cat-1', name: 'Complete', exit_uuid: 'exit-1' },\n { uuid: 'cat-2', name: 'Expired', exit_uuid: 'exit-2' }\n ],\n default_category_uuid: 'cat-2'\n },\n exits: [\n { uuid: 'exit-1', destination_uuid: null },\n { uuid: 'exit-2', destination_uuid: null }\n ]\n };\n\n const formData = split_by_subflow.toFormData(node);\n\n expect(formData.uuid).to.equal('test-node');\n expect(formData.flow).to.be.an('array');\n expect(formData.flow).to.have.lengthOf(1);\n expect(formData.flow[0]).to.deep.equal({\n uuid: 'flow-123',\n name: 'Registration Flow'\n });\n });\n\n it('handles empty node', () => {\n const node: Node = {\n uuid: 'test-node',\n actions: [],\n exits: []\n };\n\n const formData = split_by_subflow.toFormData(node);\n\n expect(formData.uuid).to.equal('test-node');\n expect(formData.flow).to.be.an('array');\n expect(formData.flow).to.have.lengthOf(0);\n });\n });\n\n describe('fromFormData', () => {\n it('creates node with enter_flow action and router from form data', () => {\n const formData = {\n uuid: 'test-node',\n flow: [{ uuid: 'flow-123', name: 'Registration Flow' }]\n };\n\n const originalNode: Node = {\n uuid: 'test-node',\n actions: [],\n exits: []\n };\n\n const node = split_by_subflow.fromFormData(formData, originalNode);\n\n // Check node structure\n expect(node.uuid).to.equal('test-node');\n expect(node.actions).to.have.length(1);\n expect(node.actions[0].type).to.equal('enter_flow');\n\n // Check enter_flow action has properly formatted flow\n const enterFlowAction = node.actions[0] as any;\n expect(enterFlowAction.flow).to.exist;\n expect(enterFlowAction.flow.uuid).to.equal('flow-123');\n expect(enterFlowAction.flow.name).to.equal('Registration Flow');\n\n // Check router\n expect(node.router).to.exist;\n expect(node.router.type).to.equal('switch');\n expect(node.router.operand).to.equal('@child.status');\n expect(node.router.categories).to.have.length(2);\n expect(node.router.categories[0].name).to.equal('Complete');\n expect(node.router.categories[1].name).to.equal('Expired');\n\n // Check exits\n expect(node.exits).to.have.length(2);\n });\n\n it('handles empty flow selection', () => {\n const formData = {\n uuid: 'test-node',\n flow: []\n };\n\n const originalNode: Node = {\n uuid: 'test-node',\n actions: [],\n exits: []\n };\n\n const node = split_by_subflow.fromFormData(formData, originalNode);\n\n // Should still create the node structure\n expect(node.actions).to.have.length(1);\n const enterFlowAction = node.actions[0] as any;\n expect(enterFlowAction.flow.uuid).to.equal('');\n expect(enterFlowAction.flow.name).to.equal('');\n });\n\n it('preserves UUIDs when editing existing node', () => {\n const existingNode: Node = {\n uuid: 'test-node',\n actions: [\n {\n uuid: 'existing-action-uuid',\n type: 'enter_flow',\n flow: { uuid: 'flow-old', name: 'Old Flow' }\n } as any\n ],\n router: {\n type: 'switch',\n operand: '@child.status',\n cases: [\n {\n uuid: 'existing-case-uuid',\n type: 'has_only_text',\n arguments: ['completed'],\n category_uuid: 'existing-cat-1'\n }\n ],\n categories: [\n {\n uuid: 'existing-cat-1',\n name: 'Complete',\n exit_uuid: 'existing-exit-1'\n },\n {\n uuid: 'existing-cat-2',\n name: 'Expired',\n exit_uuid: 'existing-exit-2'\n }\n ],\n default_category_uuid: 'existing-cat-2'\n },\n exits: [\n { uuid: 'existing-exit-1', destination_uuid: null },\n { uuid: 'existing-exit-2', destination_uuid: null }\n ]\n };\n\n const formData = {\n uuid: 'test-node',\n flow: [{ uuid: 'flow-new', name: 'New Flow' }]\n };\n\n const node = split_by_subflow.fromFormData(formData, existingNode);\n\n // Should preserve action UUID\n expect(node.actions[0].uuid).to.equal('existing-action-uuid');\n\n // Should preserve router structure UUIDs\n expect(node.router.categories[0].uuid).to.equal('existing-cat-1');\n expect(node.router.categories[1].uuid).to.equal('existing-cat-2');\n expect(node.exits[0].uuid).to.equal('existing-exit-1');\n expect(node.exits[1].uuid).to.equal('existing-exit-2');\n\n // But should update the flow\n const enterFlowAction = node.actions[0] as any;\n expect(enterFlowAction.flow.uuid).to.equal('flow-new');\n expect(enterFlowAction.flow.name).to.equal('New Flow');\n });\n });\n\n describe('round-trip transformation', () => {\n it('should preserve node structure through toFormData -> fromFormData', () => {\n const originalNode: Node = {\n uuid: 'test-node-uuid',\n actions: [\n {\n uuid: 'action-uuid',\n type: 'enter_flow',\n flow: { uuid: 'flow-456', name: 'My Subflow' }\n } as any\n ],\n router: {\n type: 'switch',\n operand: '@child.status',\n cases: [\n {\n uuid: 'case-uuid',\n type: 'has_only_text',\n arguments: ['completed'],\n category_uuid: 'cat-complete'\n }\n ],\n categories: [\n {\n uuid: 'cat-complete',\n name: 'Complete',\n exit_uuid: 'exit-complete'\n },\n {\n uuid: 'cat-expired',\n name: 'Expired',\n exit_uuid: 'exit-expired'\n }\n ],\n default_category_uuid: 'cat-expired'\n },\n exits: [\n { uuid: 'exit-complete', destination_uuid: null },\n { uuid: 'exit-expired', destination_uuid: null }\n ]\n };\n\n // Convert to form data\n const formData = split_by_subflow.toFormData(originalNode);\n\n // Convert back to node\n const resultNode = split_by_subflow.fromFormData(formData, originalNode);\n\n // Should match the original structure\n expect(resultNode).to.deep.equal(originalNode);\n });\n });\n\n describe('NodeEditor integration', () => {\n it('should properly use node fromFormData when formDataToNode is called', async () => {\n // This test simulates the bug where node.fromFormData should be used\n // to create the entire node (including actions), not action.fromFormData\n\n const { fixture, html } = await import('@open-wc/testing');\n await import('../../temba-modules');\n\n const originalNode: Node = {\n uuid: 'test-node-uuid',\n actions: [\n {\n uuid: 'action-uuid',\n type: 'enter_flow',\n flow: { uuid: 'flow-old', name: 'Old Flow' }\n } as any\n ],\n router: {\n type: 'switch',\n operand: '@child.status',\n cases: [\n {\n uuid: 'case-uuid',\n type: 'has_only_text',\n arguments: ['completed'],\n category_uuid: 'cat-complete'\n }\n ],\n categories: [\n {\n uuid: 'cat-complete',\n name: 'Complete',\n exit_uuid: 'exit-complete'\n },\n {\n uuid: 'cat-expired',\n name: 'Expired',\n exit_uuid: 'exit-expired'\n }\n ],\n default_category_uuid: 'cat-expired'\n },\n exits: [\n { uuid: 'exit-complete', destination_uuid: null },\n { uuid: 'exit-expired', destination_uuid: null }\n ]\n };\n\n const nodeUI = {\n type: 'split_by_subflow',\n position: { left: 50, top: 50 }\n };\n\n // Create the node editor\n const nodeEditor = (await fixture(html`\n <temba-node-editor\n .node=${originalNode}\n .nodeUI=${nodeUI}\n .action=${originalNode.actions[0]}\n .isOpen=${true}\n ></temba-node-editor>\n `)) as any;\n\n await nodeEditor.updateComplete;\n await new Promise((resolve) => setTimeout(resolve, 200));\n await nodeEditor.updateComplete;\n\n // Get the initial formData to verify toFormData was called\n const initialFormData = nodeEditor.formData;\n expect(initialFormData.flow).to.exist;\n expect(initialFormData.flow).to.have.lengthOf(1);\n expect(initialFormData.flow[0].uuid).to.equal('flow-old');\n\n // Simulate changing the flow selection\n const newFormData = {\n ...initialFormData,\n flow: [{ uuid: 'flow-new', name: 'New Flow' }]\n };\n\n // Call formDataToNode directly to test the transformation\n const resultNode = nodeEditor.formDataToNode(newFormData);\n\n // Verify that the result node has the new flow properly formatted\n expect(resultNode).to.exist;\n expect(resultNode.actions).to.have.length(1);\n\n const enterFlowAction = resultNode.actions[0] as any;\n expect(enterFlowAction.type).to.equal('enter_flow');\n\n // This is the key assertion - the flow should be properly formatted\n // as created by node's fromFormData, not by action's fromFormData\n expect(enterFlowAction.flow).to.exist;\n expect(enterFlowAction.flow.uuid).to.equal('flow-new');\n expect(enterFlowAction.flow.name).to.equal('New Flow');\n\n // The flow should NOT have extra properties that might come from the select component\n expect(enterFlowAction.flow).to.not.have.property('value');\n\n // Verify router structure was also created properly by node's fromFormData\n expect(resultNode.router).to.exist;\n expect(resultNode.router.type).to.equal('switch');\n expect(resultNode.router.categories).to.have.length(2);\n expect(resultNode.exits).to.have.length(2);\n });\n });\n});\n"]}
|
|
@@ -14,8 +14,8 @@ describe('wait_for_digits node config', () => {
|
|
|
14
14
|
it('has correct type', () => {
|
|
15
15
|
expect(wait_for_digits.type).to.equal('wait_for_digits');
|
|
16
16
|
});
|
|
17
|
-
it('has correct
|
|
18
|
-
expect(wait_for_digits.
|
|
17
|
+
it('has correct group', () => {
|
|
18
|
+
expect(wait_for_digits.group).to.exist;
|
|
19
19
|
});
|
|
20
20
|
it('is a simple node config without form or layout', () => {
|
|
21
21
|
expect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iB,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"]}
|
|
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,EAAE,CAAC,SAAS,CA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ChD;aACM,EACT,EAAE,IAAI,EAAE,iBAAiB,EAAE,EAC3B,mBAAmB,CACpB,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { expect } from '@open-wc/testing';\nimport { wait_for_digits } from '../../src/flow/nodes/wait_for_digits';\nimport { Node } from '../../src/store/flow-definition';\nimport { NodeTest } from '../NodeHelper';\n\n/**\n * Test suite for the wait_for_digits node configuration.\n */\ndescribe('wait_for_digits node config', () => {\n const helper = new NodeTest(wait_for_digits, 'wait_for_digits');\n\n describe('basic properties', () => {\n helper.testBasicProperties();\n\n it('has correct name', () => {\n expect(wait_for_digits.name).to.equal('Wait for Digits');\n });\n\n it('has correct type', () => {\n expect(wait_for_digits.type).to.equal('wait_for_digits');\n });\n\n it('has correct group', () => {\n expect(wait_for_digits.group).to.exist;\n });\n\n it('is a simple node config without form or layout', () => {\n expect(wait_for_digits.form).to.be.undefined;\n expect(wait_for_digits.layout).to.be.undefined;\n expect(wait_for_digits.toFormData).to.be.undefined;\n expect(wait_for_digits.fromFormData).to.be.undefined;\n });\n });\n\n describe('node scenarios', () => {\n it('renders basic digits wait', async () => {\n await helper.testNode(\n {\n uuid: 'test-digits-node-1',\n actions: [],\n router: {\n type: 'switch',\n wait: {\n type: 'msg',\n hint: {\n type: 'digits',\n count: 4\n }\n },\n result_name: 'digits',\n categories: [\n {\n uuid: 'digits-cat-1',\n name: 'Has Number',\n exit_uuid: 'digits-exit-1'\n },\n {\n uuid: 'digits-cat-2',\n name: 'Other',\n exit_uuid: 'digits-exit-2'\n }\n ]\n },\n exits: [\n { uuid: 'digits-exit-1', destination_uuid: null },\n { uuid: 'digits-exit-2', destination_uuid: null }\n ]\n } as Node,\n { type: 'wait_for_digits' },\n 'basic-digits-wait'\n );\n });\n\n it('renders single digit with timeout', async () => {\n await helper.testNode(\n {\n uuid: 'test-digits-node-2',\n actions: [],\n router: {\n type: 'switch',\n wait: {\n type: 'msg',\n hint: {\n type: 'digits',\n count: 1\n },\n timeout: {\n category_uuid: 'timeout-cat',\n seconds: 30\n }\n },\n result_name: 'pin_digit',\n categories: [\n {\n uuid: 'digits-cat-1',\n name: 'Has Number',\n exit_uuid: 'digits-exit-1'\n },\n {\n uuid: 'timeout-cat',\n name: 'No Response',\n exit_uuid: 'timeout-exit'\n },\n {\n uuid: 'digits-cat-2',\n name: 'Other',\n exit_uuid: 'digits-exit-2'\n }\n ]\n },\n exits: [\n { uuid: 'digits-exit-1', destination_uuid: null },\n { uuid: 'timeout-exit', destination_uuid: null },\n { uuid: 'digits-exit-2', destination_uuid: null }\n ]\n } as Node,\n { type: 'wait_for_digits' },\n 'single-digit-with-timeout'\n );\n });\n\n it('renders phone number collection', async () => {\n await helper.testNode(\n {\n uuid: 'test-digits-node-3',\n actions: [],\n router: {\n type: 'switch',\n wait: {\n type: 'msg',\n hint: {\n type: 'digits',\n count: 10\n }\n },\n result_name: 'phone_number',\n categories: [\n {\n uuid: 'phone-cat-1',\n name: 'Valid Phone',\n exit_uuid: 'phone-exit-1'\n },\n {\n uuid: 'phone-cat-2',\n name: 'Invalid',\n exit_uuid: 'phone-exit-2'\n },\n { uuid: 'phone-cat-3', name: 'Other', exit_uuid: 'phone-exit-3' }\n ]\n },\n exits: [\n { uuid: 'phone-exit-1', destination_uuid: null },\n { uuid: 'phone-exit-2', destination_uuid: null },\n { uuid: 'phone-exit-3', destination_uuid: null }\n ]\n } as Node,\n { type: 'wait_for_digits' },\n 'phone-number-collection'\n );\n });\n\n it('renders verification code', async () => {\n await helper.testNode(\n {\n uuid: 'test-digits-node-4',\n actions: [],\n router: {\n type: 'switch',\n wait: {\n type: 'msg',\n hint: {\n type: 'digits',\n count: 6\n }\n },\n result_name: 'verification_code',\n categories: [\n {\n uuid: 'code-cat-1',\n name: 'Valid Code',\n exit_uuid: 'code-exit-1'\n },\n { uuid: 'code-cat-2', name: 'Other', exit_uuid: 'code-exit-2' }\n ]\n },\n exits: [\n { uuid: 'code-exit-1', destination_uuid: null },\n { uuid: 'code-exit-2', destination_uuid: null }\n ]\n } as Node,\n { type: 'wait_for_digits' },\n 'verification-code'\n );\n });\n });\n});\n"]}
|
|
@@ -326,7 +326,8 @@ describe('wait_for_response node config', () => {
|
|
|
326
326
|
};
|
|
327
327
|
const result = wait_for_response.fromFormData(formData, originalNode);
|
|
328
328
|
expect(result.uuid).to.equal('test-node');
|
|
329
|
-
|
|
329
|
+
// When no result_name is provided, it should not be set
|
|
330
|
+
expect((_a = result.router) === null || _a === void 0 ? void 0 : _a.result_name).to.be.undefined;
|
|
330
331
|
});
|
|
331
332
|
it('handles operators with no operands correctly', () => {
|
|
332
333
|
var _a, _b, _c;
|