@nyaruka/temba-components 0.131.0 → 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 +67 -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 +1156 -619
- 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/ContactSearch.js +1 -1
- package/out-tsc/src/form/ContactSearch.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/ContactSearch.ts +1 -1
- 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
|
@@ -13,15 +13,15 @@ describe('split_by_random node config', () => {
|
|
|
13
13
|
helper.testBasicProperties();
|
|
14
14
|
|
|
15
15
|
it('has correct name', () => {
|
|
16
|
-
expect(split_by_random.name).to.equal('Split
|
|
16
|
+
expect(split_by_random.name).to.equal('Random Split');
|
|
17
17
|
});
|
|
18
18
|
|
|
19
19
|
it('has correct type', () => {
|
|
20
20
|
expect(split_by_random.type).to.equal('split_by_random');
|
|
21
21
|
});
|
|
22
22
|
|
|
23
|
-
it('has correct
|
|
24
|
-
expect(split_by_random.
|
|
23
|
+
it('has correct group', () => {
|
|
24
|
+
expect(split_by_random.group).to.exist;
|
|
25
25
|
});
|
|
26
26
|
|
|
27
27
|
it('has router configuration', () => {
|
|
@@ -0,0 +1,398 @@
|
|
|
1
|
+
import { expect } from '@open-wc/testing';
|
|
2
|
+
import { split_by_resthook } from '../../src/flow/nodes/split_by_resthook';
|
|
3
|
+
import { Node, CallResthook } from '../../src/store/flow-definition.d';
|
|
4
|
+
|
|
5
|
+
describe('temba-split-by-resthook', () => {
|
|
6
|
+
it('should transform from flow definition to form data correctly', () => {
|
|
7
|
+
const node: Node = {
|
|
8
|
+
uuid: 'test-node-uuid',
|
|
9
|
+
actions: [
|
|
10
|
+
{
|
|
11
|
+
type: 'call_resthook',
|
|
12
|
+
uuid: 'action-uuid',
|
|
13
|
+
resthook: 'new-registration'
|
|
14
|
+
} as CallResthook
|
|
15
|
+
],
|
|
16
|
+
router: {
|
|
17
|
+
type: 'switch',
|
|
18
|
+
cases: [
|
|
19
|
+
{
|
|
20
|
+
uuid: 'case-1',
|
|
21
|
+
type: 'has_text',
|
|
22
|
+
arguments: [],
|
|
23
|
+
category_uuid: 'cat-success'
|
|
24
|
+
}
|
|
25
|
+
],
|
|
26
|
+
categories: [
|
|
27
|
+
{ uuid: 'cat-success', name: 'Success', exit_uuid: 'exit-success' },
|
|
28
|
+
{ uuid: 'cat-failure', name: 'Failure', exit_uuid: 'exit-failure' }
|
|
29
|
+
],
|
|
30
|
+
default_category_uuid: 'cat-failure',
|
|
31
|
+
operand: '@webhook.json.status'
|
|
32
|
+
},
|
|
33
|
+
exits: [
|
|
34
|
+
{ uuid: 'exit-success', destination_uuid: null },
|
|
35
|
+
{ uuid: 'exit-failure', destination_uuid: null }
|
|
36
|
+
]
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const formData = split_by_resthook.toFormData!(node);
|
|
40
|
+
|
|
41
|
+
expect(formData.uuid).to.equal('test-node-uuid');
|
|
42
|
+
expect(formData.resthook).to.have.lengthOf(1);
|
|
43
|
+
expect(formData.resthook[0]).to.deep.equal({
|
|
44
|
+
resthook: 'new-registration'
|
|
45
|
+
});
|
|
46
|
+
expect(formData.result_name).to.equal('');
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it('should transform from flow definition to form data with result_name', () => {
|
|
50
|
+
const node: Node = {
|
|
51
|
+
uuid: 'test-node-uuid',
|
|
52
|
+
actions: [
|
|
53
|
+
{
|
|
54
|
+
type: 'call_resthook',
|
|
55
|
+
uuid: 'action-uuid',
|
|
56
|
+
resthook: 'payment-received'
|
|
57
|
+
} as CallResthook
|
|
58
|
+
],
|
|
59
|
+
router: {
|
|
60
|
+
type: 'switch',
|
|
61
|
+
cases: [
|
|
62
|
+
{
|
|
63
|
+
uuid: 'case-1',
|
|
64
|
+
type: 'has_text',
|
|
65
|
+
arguments: [],
|
|
66
|
+
category_uuid: 'cat-success'
|
|
67
|
+
}
|
|
68
|
+
],
|
|
69
|
+
categories: [
|
|
70
|
+
{ uuid: 'cat-success', name: 'Success', exit_uuid: 'exit-success' },
|
|
71
|
+
{ uuid: 'cat-failure', name: 'Failure', exit_uuid: 'exit-failure' }
|
|
72
|
+
],
|
|
73
|
+
result_name: 'payment_status',
|
|
74
|
+
default_category_uuid: 'cat-failure',
|
|
75
|
+
operand: '@webhook.json.status'
|
|
76
|
+
},
|
|
77
|
+
exits: [
|
|
78
|
+
{ uuid: 'exit-success', destination_uuid: null },
|
|
79
|
+
{ uuid: 'exit-failure', destination_uuid: null }
|
|
80
|
+
]
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
const formData = split_by_resthook.toFormData!(node);
|
|
84
|
+
|
|
85
|
+
expect(formData.result_name).to.equal('payment_status');
|
|
86
|
+
expect(formData.resthook).to.have.lengthOf(1);
|
|
87
|
+
expect(formData.resthook[0]).to.deep.equal({
|
|
88
|
+
resthook: 'payment-received'
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
it('should transform from form data to flow definition correctly', () => {
|
|
93
|
+
const originalNode: Node = {
|
|
94
|
+
uuid: 'test-node-uuid',
|
|
95
|
+
actions: [],
|
|
96
|
+
exits: []
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
const formData = {
|
|
100
|
+
uuid: 'test-node-uuid',
|
|
101
|
+
resthook: [{ resthook: 'new-registration' }]
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
const resultNode = split_by_resthook.fromFormData!(formData, originalNode);
|
|
105
|
+
|
|
106
|
+
expect(resultNode.uuid).to.equal('test-node-uuid');
|
|
107
|
+
expect(resultNode.actions).to.have.lengthOf(1);
|
|
108
|
+
|
|
109
|
+
const action = resultNode.actions![0];
|
|
110
|
+
expect(action.type).to.equal('call_resthook');
|
|
111
|
+
|
|
112
|
+
expect(resultNode.router!.type).to.equal('switch');
|
|
113
|
+
expect(resultNode.router!.operand).to.equal('@webhook.json.status');
|
|
114
|
+
expect(resultNode.router!.categories).to.have.lengthOf(2); // Success + Failure
|
|
115
|
+
expect(resultNode.exits).to.have.lengthOf(2); // Success + Failure
|
|
116
|
+
|
|
117
|
+
// check success category
|
|
118
|
+
const successCategory = resultNode.router!.categories!.find(
|
|
119
|
+
(cat) => cat.name === 'Success'
|
|
120
|
+
);
|
|
121
|
+
expect(successCategory).to.exist;
|
|
122
|
+
|
|
123
|
+
// check failure category
|
|
124
|
+
const failureCategory = resultNode.router!.categories!.find(
|
|
125
|
+
(cat) => cat.name === 'Failure'
|
|
126
|
+
);
|
|
127
|
+
expect(failureCategory).to.exist;
|
|
128
|
+
expect(resultNode.router!.default_category_uuid).to.equal(
|
|
129
|
+
failureCategory!.uuid
|
|
130
|
+
);
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
it('should validate form data correctly', () => {
|
|
134
|
+
// valid form data
|
|
135
|
+
const validData = {
|
|
136
|
+
resthook: [{ resthook: 'new-registration' }]
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
const validResult = split_by_resthook.validate!(validData);
|
|
140
|
+
expect(validResult.valid).to.be.true;
|
|
141
|
+
expect(Object.keys(validResult.errors)).to.have.lengthOf(0);
|
|
142
|
+
|
|
143
|
+
// invalid form data - no resthook
|
|
144
|
+
const invalidData = {
|
|
145
|
+
resthook: []
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
const invalidResult = split_by_resthook.validate!(invalidData);
|
|
149
|
+
expect(invalidResult.valid).to.be.false;
|
|
150
|
+
expect(invalidResult.errors.resthook).to.equal('A resthook is required');
|
|
151
|
+
|
|
152
|
+
// invalid form data - missing resthook
|
|
153
|
+
const missingResthookData = {};
|
|
154
|
+
|
|
155
|
+
const missingResult = split_by_resthook.validate!(missingResthookData);
|
|
156
|
+
expect(missingResult.valid).to.be.false;
|
|
157
|
+
expect(missingResult.errors.resthook).to.equal('A resthook is required');
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
it('should preserve existing UUIDs when editing', () => {
|
|
161
|
+
const originalNode: Node = {
|
|
162
|
+
uuid: 'test-node-uuid',
|
|
163
|
+
actions: [
|
|
164
|
+
{
|
|
165
|
+
type: 'call_resthook',
|
|
166
|
+
uuid: 'existing-action-uuid',
|
|
167
|
+
resthook: 'new-registration'
|
|
168
|
+
} as CallResthook
|
|
169
|
+
],
|
|
170
|
+
router: {
|
|
171
|
+
type: 'switch',
|
|
172
|
+
cases: [
|
|
173
|
+
{
|
|
174
|
+
uuid: 'existing-case-uuid',
|
|
175
|
+
type: 'has_text',
|
|
176
|
+
arguments: [],
|
|
177
|
+
category_uuid: 'existing-success-uuid'
|
|
178
|
+
}
|
|
179
|
+
],
|
|
180
|
+
categories: [
|
|
181
|
+
{
|
|
182
|
+
uuid: 'existing-success-uuid',
|
|
183
|
+
name: 'Success',
|
|
184
|
+
exit_uuid: 'existing-success-exit-uuid'
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
uuid: 'existing-failure-uuid',
|
|
188
|
+
name: 'Failure',
|
|
189
|
+
exit_uuid: 'existing-failure-exit-uuid'
|
|
190
|
+
}
|
|
191
|
+
],
|
|
192
|
+
default_category_uuid: 'existing-failure-uuid',
|
|
193
|
+
operand: '@webhook.json.status'
|
|
194
|
+
},
|
|
195
|
+
exits: [
|
|
196
|
+
{
|
|
197
|
+
uuid: 'existing-success-exit-uuid',
|
|
198
|
+
destination_uuid: 'some-node-uuid'
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
uuid: 'existing-failure-exit-uuid',
|
|
202
|
+
destination_uuid: 'another-node-uuid'
|
|
203
|
+
}
|
|
204
|
+
]
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
// re-save with same resthook
|
|
208
|
+
const formData = {
|
|
209
|
+
uuid: 'test-node-uuid',
|
|
210
|
+
resthook: [{ resthook: 'new-registration' }],
|
|
211
|
+
result_name: ''
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
const resultNode = split_by_resthook.fromFormData!(formData, originalNode);
|
|
215
|
+
|
|
216
|
+
// UUIDs should be preserved
|
|
217
|
+
expect(resultNode.actions![0].uuid).to.equal('existing-action-uuid');
|
|
218
|
+
expect(resultNode.router!.cases![0].uuid).to.equal('existing-case-uuid');
|
|
219
|
+
expect(resultNode.router!.categories![0].uuid).to.equal(
|
|
220
|
+
'existing-success-uuid'
|
|
221
|
+
);
|
|
222
|
+
expect(resultNode.exits![0].uuid).to.equal('existing-success-exit-uuid');
|
|
223
|
+
|
|
224
|
+
// destination connections should be preserved
|
|
225
|
+
expect(resultNode.exits![0].destination_uuid).to.equal('some-node-uuid');
|
|
226
|
+
expect(resultNode.exits![1].destination_uuid).to.equal('another-node-uuid');
|
|
227
|
+
});
|
|
228
|
+
|
|
229
|
+
it('should handle changing resthook while preserving structure', () => {
|
|
230
|
+
const originalNode: Node = {
|
|
231
|
+
uuid: 'test-node-uuid',
|
|
232
|
+
actions: [
|
|
233
|
+
{
|
|
234
|
+
type: 'call_resthook',
|
|
235
|
+
uuid: 'existing-action-uuid',
|
|
236
|
+
resthook: 'new-registration'
|
|
237
|
+
} as CallResthook
|
|
238
|
+
],
|
|
239
|
+
router: {
|
|
240
|
+
type: 'switch',
|
|
241
|
+
cases: [
|
|
242
|
+
{
|
|
243
|
+
uuid: 'existing-case-uuid',
|
|
244
|
+
type: 'has_text',
|
|
245
|
+
arguments: [],
|
|
246
|
+
category_uuid: 'existing-success-uuid'
|
|
247
|
+
}
|
|
248
|
+
],
|
|
249
|
+
categories: [
|
|
250
|
+
{
|
|
251
|
+
uuid: 'existing-success-uuid',
|
|
252
|
+
name: 'Success',
|
|
253
|
+
exit_uuid: 'existing-success-exit-uuid'
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
uuid: 'existing-failure-uuid',
|
|
257
|
+
name: 'Failure',
|
|
258
|
+
exit_uuid: 'existing-failure-exit-uuid'
|
|
259
|
+
}
|
|
260
|
+
],
|
|
261
|
+
default_category_uuid: 'existing-failure-uuid',
|
|
262
|
+
operand: '@webhook.json.status'
|
|
263
|
+
},
|
|
264
|
+
exits: [
|
|
265
|
+
{
|
|
266
|
+
uuid: 'existing-success-exit-uuid',
|
|
267
|
+
destination_uuid: null
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
uuid: 'existing-failure-exit-uuid',
|
|
271
|
+
destination_uuid: null
|
|
272
|
+
}
|
|
273
|
+
]
|
|
274
|
+
};
|
|
275
|
+
|
|
276
|
+
// change to different resthook
|
|
277
|
+
const formData = {
|
|
278
|
+
uuid: 'test-node-uuid',
|
|
279
|
+
resthook: [{ resthook: 'payment-received' }]
|
|
280
|
+
};
|
|
281
|
+
|
|
282
|
+
const resultNode = split_by_resthook.fromFormData!(formData, originalNode);
|
|
283
|
+
|
|
284
|
+
// action UUID should be preserved
|
|
285
|
+
expect(resultNode.actions![0].uuid).to.equal('existing-action-uuid');
|
|
286
|
+
|
|
287
|
+
// resthook should be updated
|
|
288
|
+
expect((resultNode.actions![0] as any).resthook).to.equal(
|
|
289
|
+
'payment-received'
|
|
290
|
+
);
|
|
291
|
+
|
|
292
|
+
// structure should be preserved
|
|
293
|
+
expect(resultNode.router!.categories).to.have.lengthOf(2);
|
|
294
|
+
expect(resultNode.exits).to.have.lengthOf(2);
|
|
295
|
+
});
|
|
296
|
+
|
|
297
|
+
it('should handle empty result_name by trimming it', () => {
|
|
298
|
+
const originalNode: Node = {
|
|
299
|
+
uuid: 'test-node-uuid',
|
|
300
|
+
actions: [],
|
|
301
|
+
exits: []
|
|
302
|
+
};
|
|
303
|
+
|
|
304
|
+
const formData = {
|
|
305
|
+
uuid: 'test-node-uuid',
|
|
306
|
+
resthook: [{ resthook: 'new-registration' }],
|
|
307
|
+
result_name: ' '
|
|
308
|
+
};
|
|
309
|
+
|
|
310
|
+
const resultNode = split_by_resthook.fromFormData!(formData, originalNode);
|
|
311
|
+
expect(resultNode.router.result_name).to.be.undefined;
|
|
312
|
+
});
|
|
313
|
+
|
|
314
|
+
it('should handle missing resthook selection gracefully', () => {
|
|
315
|
+
const originalNode: Node = {
|
|
316
|
+
uuid: 'test-node-uuid',
|
|
317
|
+
actions: [],
|
|
318
|
+
exits: []
|
|
319
|
+
};
|
|
320
|
+
|
|
321
|
+
// missing resthook selection
|
|
322
|
+
const formData = {
|
|
323
|
+
uuid: 'test-node-uuid',
|
|
324
|
+
resthook: [],
|
|
325
|
+
result_name: ''
|
|
326
|
+
};
|
|
327
|
+
|
|
328
|
+
const resultNode = split_by_resthook.fromFormData!(formData, originalNode);
|
|
329
|
+
|
|
330
|
+
// should return original node unchanged
|
|
331
|
+
expect(resultNode).to.equal(originalNode);
|
|
332
|
+
});
|
|
333
|
+
|
|
334
|
+
it('should handle null resthook selection', () => {
|
|
335
|
+
const originalNode: Node = {
|
|
336
|
+
uuid: 'test-node-uuid',
|
|
337
|
+
actions: [],
|
|
338
|
+
exits: []
|
|
339
|
+
};
|
|
340
|
+
|
|
341
|
+
const formData = {
|
|
342
|
+
uuid: 'test-node-uuid',
|
|
343
|
+
resthook: null,
|
|
344
|
+
result_name: ''
|
|
345
|
+
};
|
|
346
|
+
|
|
347
|
+
const resultNode = split_by_resthook.fromFormData!(formData, originalNode);
|
|
348
|
+
|
|
349
|
+
// should return original node unchanged
|
|
350
|
+
expect(resultNode).to.equal(originalNode);
|
|
351
|
+
});
|
|
352
|
+
|
|
353
|
+
it('should render the resthook name', () => {
|
|
354
|
+
const node: Node = {
|
|
355
|
+
uuid: 'test-node-uuid',
|
|
356
|
+
actions: [
|
|
357
|
+
{
|
|
358
|
+
type: 'call_resthook',
|
|
359
|
+
uuid: 'action-uuid',
|
|
360
|
+
resthook: 'payment-received'
|
|
361
|
+
} as CallResthook
|
|
362
|
+
],
|
|
363
|
+
exits: []
|
|
364
|
+
};
|
|
365
|
+
|
|
366
|
+
const rendered = split_by_resthook.render!(node);
|
|
367
|
+
|
|
368
|
+
// check that the rendered output includes the resthook name
|
|
369
|
+
expect(rendered.strings[0]).to.include('class="body"');
|
|
370
|
+
});
|
|
371
|
+
|
|
372
|
+
it('should handle missing resthook action when loading form data', () => {
|
|
373
|
+
const node: Node = {
|
|
374
|
+
uuid: 'test-node-uuid',
|
|
375
|
+
actions: [],
|
|
376
|
+
exits: []
|
|
377
|
+
};
|
|
378
|
+
|
|
379
|
+
const formData = split_by_resthook.toFormData!(node);
|
|
380
|
+
|
|
381
|
+
expect(formData.uuid).to.equal('test-node-uuid');
|
|
382
|
+
expect(formData.resthook).to.have.lengthOf(0);
|
|
383
|
+
expect(formData.result_name).to.equal('');
|
|
384
|
+
});
|
|
385
|
+
|
|
386
|
+
it('should render placeholder when no resthook configured', () => {
|
|
387
|
+
const node: Node = {
|
|
388
|
+
uuid: 'test-node-uuid',
|
|
389
|
+
actions: [],
|
|
390
|
+
exits: []
|
|
391
|
+
};
|
|
392
|
+
|
|
393
|
+
const rendered = split_by_resthook.render!(node);
|
|
394
|
+
|
|
395
|
+
// check that the rendered output includes placeholder text
|
|
396
|
+
expect(rendered.strings[0]).to.include('class="body"');
|
|
397
|
+
});
|
|
398
|
+
});
|