@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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"split_by_expression.test.js","sourceRoot":"","sources":["../../../test/nodes/split_by_expression.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAE/E,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC;;GAEG;AACH,QAAQ,CAAC,iCAAiC,EAAE,GAAG,EAAE;IAC/C,MAAM,MAAM,GAAG,IAAI,QAAQ,CAAC,mBAAmB,EAAE,qBAAqB,CAAC,CAAC;IAExE,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;QAChC,MAAM,CAAC,mBAAmB,EAAE,CAAC;QAE7B,EAAE,CAAC,kBAAkB,EAAE,GAAG,EAAE;YAC1B,MAAM,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC;QACnE,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,kBAAkB,EAAE,GAAG,EAAE;YAC1B,MAAM,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC;QACnE,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,YAAY,EAAE,GAAG,EAAE;QAC1B,EAAE,CAAC,yDAAyD,EAAE,GAAG,EAAE;YACjE,MAAM,IAAI,GAAS;gBACjB,IAAI,EAAE,gBAAgB;gBACtB,OAAO,EAAE,EAAE;gBACX,M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AK,KAAK,CAC5B,CAAC;YACF,MAAM,CAAC,WAAY,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;YAC9C,MAAM,CAAC,WAAY,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;YAEpD,mCAAmC;YACnC,MAAM,OAAO,GAAG,UAAU,CAAC,KAAM,CAAC,IAAI,CACpC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,UAAU,CACnC,CAAC;YACF,MAAM,CAAC,OAAQ,CAAC,gBAAgB,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QACvD,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { expect } from '@open-wc/testing';\nimport { split_by_expression } from '../../src/flow/nodes/split_by_expression';\nimport { Node } from '../../src/store/flow-definition';\nimport { NodeTest } from '../NodeHelper';\n\n/**\n * Test suite for the split_by_expression node configuration.\n */\ndescribe('split_by_expression node config', () => {\n const helper = new NodeTest(split_by_expression, 'split_by_expression');\n\n describe('basic properties', () => {\n helper.testBasicProperties();\n\n it('has correct name', () => {\n expect(split_by_expression.name).to.equal('Split by Expression');\n });\n\n it('has correct type', () => {\n expect(split_by_expression.type).to.equal('split_by_expression');\n });\n });\n\n describe('toFormData', () => {\n it('should transform node with rules to form data correctly', () => {\n const node: Node = {\n uuid: 'test-node-uuid',\n actions: [],\n router: {\n type: 'switch',\n operand: '@fields.age',\n cases: [\n {\n uuid: 'case-1',\n type: 'has_number_gte',\n arguments: ['18'],\n category_uuid: 'cat-1'\n },\n {\n uuid: 'case-2',\n type: 'has_number_between',\n arguments: ['13', '17'],\n category_uuid: 'cat-2'\n },\n {\n uuid: 'case-3',\n type: 'has_number_lt',\n arguments: ['13'],\n category_uuid: 'cat-3'\n }\n ],\n categories: [\n { uuid: 'cat-1', name: 'Adult', exit_uuid: 'exit-1' },\n { uuid: 'cat-2', name: 'Teen', exit_uuid: 'exit-2' },\n { uuid: 'cat-3', name: 'Child', exit_uuid: 'exit-3' },\n { uuid: 'cat-other', name: 'Other', exit_uuid: 'exit-other' }\n ],\n default_category_uuid: 'cat-other'\n },\n exits: [\n { uuid: 'exit-1', destination_uuid: null },\n { uuid: 'exit-2', destination_uuid: null },\n { uuid: 'exit-3', destination_uuid: null },\n { uuid: 'exit-other', destination_uuid: null }\n ]\n };\n\n const formData = split_by_expression.toFormData!(node);\n\n expect(formData.uuid).to.equal('test-node-uuid');\n expect(formData.operand).to.equal('@fields.age');\n expect(formData.rules).to.have.lengthOf(3);\n\n // Check first rule\n expect(formData.rules[0].operator.value).to.equal('has_number_gte');\n expect(formData.rules[0].value1).to.equal('18');\n expect(formData.rules[0].category).to.equal('Adult');\n\n // Check second rule (two operands)\n expect(formData.rules[1].operator.value).to.equal('has_number_between');\n expect(formData.rules[1].value1).to.equal('13');\n expect(formData.rules[1].value2).to.equal('17');\n expect(formData.rules[1].category).to.equal('Teen');\n\n // Check third rule\n expect(formData.rules[2].operator.value).to.equal('has_number_lt');\n expect(formData.rules[2].value1).to.equal('13');\n expect(formData.rules[2].category).to.equal('Child');\n });\n\n it('should transform node with no rules to form data correctly', () => {\n const node: Node = {\n uuid: 'test-node-uuid',\n actions: [],\n router: {\n type: 'switch',\n operand: '@input.text',\n cases: [],\n categories: [\n {\n uuid: 'cat-all',\n name: 'All Responses',\n exit_uuid: 'exit-all'\n }\n ],\n default_category_uuid: 'cat-all'\n },\n exits: [{ uuid: 'exit-all', destination_uuid: null }]\n };\n\n const formData = split_by_expression.toFormData!(node);\n\n expect(formData.uuid).to.equal('test-node-uuid');\n expect(formData.operand).to.equal('@input.text');\n expect(formData.rules).to.have.lengthOf(0);\n });\n\n it('should handle result_name in toFormData', () => {\n const node: Node = {\n uuid: 'test-node-uuid',\n actions: [],\n router: {\n type: 'switch',\n operand: '@fields.color',\n result_name: 'Color Choice',\n cases: [],\n categories: [\n {\n uuid: 'cat-all',\n name: 'All Responses',\n exit_uuid: 'exit-all'\n }\n ],\n default_category_uuid: 'cat-all'\n },\n exits: [{ uuid: 'exit-all', destination_uuid: null }]\n };\n\n const formData = split_by_expression.toFormData!(node);\n\n expect(formData.result_name).to.equal('Color Choice');\n });\n\n it('should handle zero-operand operators', () => {\n const node: Node = {\n uuid: 'test-node-uuid',\n actions: [],\n router: {\n type: 'switch',\n operand: '@input.text',\n cases: [\n {\n uuid: 'case-1',\n type: 'has_number',\n arguments: [],\n category_uuid: 'cat-1'\n }\n ],\n categories: [\n { uuid: 'cat-1', name: 'Has Number', exit_uuid: 'exit-1' },\n { uuid: 'cat-other', name: 'Other', exit_uuid: 'exit-other' }\n ],\n default_category_uuid: 'cat-other'\n },\n exits: [\n { uuid: 'exit-1', destination_uuid: null },\n { uuid: 'exit-other', destination_uuid: null }\n ]\n };\n\n const formData = split_by_expression.toFormData!(node);\n\n expect(formData.rules).to.have.lengthOf(1);\n expect(formData.rules[0].operator.value).to.equal('has_number');\n expect(formData.rules[0].value1).to.equal('');\n expect(formData.rules[0].value2).to.equal('');\n });\n });\n\n describe('fromFormData', () => {\n it('should transform form data with rules to node correctly', () => {\n const formData = {\n uuid: 'test-node-uuid',\n operand: '@fields.age',\n rules: [\n {\n operator: {\n value: 'has_number_gte',\n name: 'has a number at or above'\n },\n value1: '18',\n value2: '',\n category: 'Adult'\n },\n {\n operator: {\n value: 'has_number_between',\n name: 'has a number between'\n },\n value1: '13',\n value2: '17',\n category: 'Teen'\n }\n ],\n result_name: ''\n };\n\n const originalNode: Node = {\n uuid: 'test-node-uuid',\n actions: [],\n router: {\n type: 'switch',\n operand: '@input.text',\n cases: [],\n categories: [],\n default_category_uuid: ''\n },\n exits: []\n };\n\n const resultNode = split_by_expression.fromFormData!(\n formData,\n originalNode\n );\n\n expect(resultNode.uuid).to.equal('test-node-uuid');\n expect(resultNode.router).to.exist;\n expect(resultNode.router!.operand).to.equal('@fields.age');\n expect(resultNode.router!.type).to.equal('switch');\n expect(resultNode.router!.cases).to.have.lengthOf(2);\n expect(resultNode.router!.categories).to.have.lengthOf(3); // 2 rules + Other\n\n // Check first case\n const case1 = resultNode.router!.cases![0];\n expect(case1.type).to.equal('has_number_gte');\n expect(case1.arguments).to.deep.equal(['18']);\n\n // Check second case (should split into two arguments)\n const case2 = resultNode.router!.cases![1];\n expect(case2.type).to.equal('has_number_between');\n expect(case2.arguments).to.deep.equal(['13', '17']);\n\n // Check categories\n const adultCategory = resultNode.router!.categories!.find(\n (cat) => cat.name === 'Adult'\n );\n expect(adultCategory).to.exist;\n\n const teenCategory = resultNode.router!.categories!.find(\n (cat) => cat.name === 'Teen'\n );\n expect(teenCategory).to.exist;\n\n const otherCategory = resultNode.router!.categories!.find(\n (cat) => cat.name === 'Other'\n );\n expect(otherCategory).to.exist;\n\n // Check exits match categories\n expect(resultNode.exits).to.have.lengthOf(3);\n });\n\n it('should handle empty rules', () => {\n const formData = {\n uuid: 'test-node-uuid',\n operand: '@fields.status',\n rules: [],\n result_name: ''\n };\n\n const originalNode: Node = {\n uuid: 'test-node-uuid',\n actions: [],\n router: {\n type: 'switch',\n operand: '@input.text',\n cases: [],\n categories: [],\n default_category_uuid: ''\n },\n exits: []\n };\n\n const resultNode = split_by_expression.fromFormData!(\n formData,\n originalNode\n );\n\n expect(resultNode.router).to.exist;\n expect(resultNode.router!.operand).to.equal('@fields.status');\n expect(resultNode.router!.cases).to.have.lengthOf(0);\n expect(resultNode.router!.categories).to.have.lengthOf(1);\n expect(resultNode.router!.categories![0].name).to.equal('All Responses');\n });\n\n it('should preserve UUIDs when editing existing node', () => {\n const existingNode: Node = {\n uuid: 'test-node-uuid',\n actions: [],\n router: {\n type: 'switch',\n operand: '@fields.age',\n cases: [\n {\n uuid: 'existing-case-1',\n type: 'has_number_gte',\n arguments: ['18'],\n category_uuid: 'existing-cat-1'\n }\n ],\n categories: [\n {\n uuid: 'existing-cat-1',\n name: 'Adult',\n exit_uuid: 'existing-exit-1'\n },\n {\n uuid: 'existing-cat-other',\n name: 'Other',\n exit_uuid: 'existing-exit-other'\n }\n ],\n default_category_uuid: 'existing-cat-other'\n },\n exits: [\n { uuid: 'existing-exit-1', destination_uuid: 'next-node-1' },\n { uuid: 'existing-exit-other', destination_uuid: 'next-node-2' }\n ]\n };\n\n const formData = {\n uuid: 'test-node-uuid',\n operand: '@fields.age',\n rules: [\n {\n operator: {\n value: 'has_number_gte',\n name: 'has a number at or above'\n },\n value1: '18',\n value2: '',\n category: 'Adult'\n }\n ],\n result_name: ''\n };\n\n const resultNode = split_by_expression.fromFormData!(\n formData,\n existingNode\n );\n\n // Check that UUIDs are preserved\n const adultCategory = resultNode.router!.categories!.find(\n (cat) => cat.name === 'Adult'\n );\n expect(adultCategory!.uuid).to.equal('existing-cat-1');\n expect(adultCategory!.exit_uuid).to.equal('existing-exit-1');\n\n // Check that destination_uuid is preserved\n const adultExit = resultNode.exits!.find(\n (exit) => exit.uuid === 'existing-exit-1'\n );\n expect(adultExit!.destination_uuid).to.equal('next-node-1');\n\n // Check Other category UUID is preserved\n const otherCategory = resultNode.router!.categories!.find(\n (cat) => cat.name === 'Other'\n );\n expect(otherCategory!.uuid).to.equal('existing-cat-other');\n });\n\n it('should handle multiple rules with same category', () => {\n const formData = {\n uuid: 'test-node-uuid',\n operand: '@fields.color',\n rules: [\n {\n operator: { value: 'has_any_word', name: 'has any of the words' },\n value1: 'red',\n value2: '',\n category: 'Warm'\n },\n {\n operator: { value: 'has_any_word', name: 'has any of the words' },\n value1: 'orange',\n value2: '',\n category: 'Warm'\n },\n {\n operator: { value: 'has_any_word', name: 'has any of the words' },\n value1: 'blue',\n value2: '',\n category: 'Cool'\n }\n ],\n result_name: ''\n };\n\n const originalNode: Node = {\n uuid: 'test-node-uuid',\n actions: [],\n router: {\n type: 'switch',\n operand: '@input.text',\n cases: [],\n categories: [],\n default_category_uuid: ''\n },\n exits: []\n };\n\n const resultNode = split_by_expression.fromFormData!(\n formData,\n originalNode\n );\n\n // Should have 3 cases but only 3 categories (Warm, Cool, Other)\n expect(resultNode.router!.cases).to.have.lengthOf(3);\n expect(resultNode.router!.categories).to.have.lengthOf(3);\n\n // Check that both \"Warm\" rules point to the same category\n const warmCategory = resultNode.router!.categories!.find(\n (cat) => cat.name === 'Warm'\n );\n expect(warmCategory).to.exist;\n\n const warmCases = resultNode.router!.cases!.filter(\n (case_) => case_.category_uuid === warmCategory!.uuid\n );\n expect(warmCases).to.have.lengthOf(2);\n\n // Should only have 3 exits (Warm, Cool, Other)\n expect(resultNode.exits).to.have.lengthOf(3);\n });\n\n it('should handle result_name in fromFormData', () => {\n const formData = {\n uuid: 'test-node-uuid',\n operand: '@fields.priority',\n rules: [],\n result_name: 'Priority Level'\n };\n\n const originalNode: Node = {\n uuid: 'test-node-uuid',\n actions: [],\n router: {\n type: 'switch',\n operand: '@input.text',\n cases: [],\n categories: [],\n default_category_uuid: ''\n },\n exits: []\n };\n\n const resultNode = split_by_expression.fromFormData!(\n formData,\n originalNode\n );\n\n expect(resultNode.router!.result_name).to.equal('Priority Level');\n });\n\n it('should not set result_name if empty', () => {\n const formData = {\n uuid: 'test-node-uuid',\n operand: '@fields.status',\n rules: [],\n result_name: ''\n };\n\n const originalNode: Node = {\n uuid: 'test-node-uuid',\n actions: [],\n router: {\n type: 'switch',\n operand: '@input.text',\n cases: [],\n categories: [],\n default_category_uuid: ''\n },\n exits: []\n };\n\n const resultNode = split_by_expression.fromFormData!(\n formData,\n originalNode\n );\n\n expect(resultNode.router!.result_name).to.be.undefined;\n });\n\n it('should handle zero-operand operators in fromFormData', () => {\n const formData = {\n uuid: 'test-node-uuid',\n operand: '@input.text',\n rules: [\n {\n operator: { value: 'has_number', name: 'has a number' },\n value1: '',\n value2: '',\n category: 'Has Number'\n }\n ],\n result_name: ''\n };\n\n const originalNode: Node = {\n uuid: 'test-node-uuid',\n actions: [],\n router: {\n type: 'switch',\n operand: '@input.text',\n cases: [],\n categories: [],\n default_category_uuid: ''\n },\n exits: []\n };\n\n const resultNode = split_by_expression.fromFormData!(\n formData,\n originalNode\n );\n\n expect(resultNode.router!.cases).to.have.lengthOf(1);\n expect(resultNode.router!.cases![0].type).to.equal('has_number');\n expect(resultNode.router!.cases![0].arguments).to.deep.equal([]);\n });\n\n it('should filter out incomplete rules', () => {\n const formData = {\n uuid: 'test-node-uuid',\n operand: '@fields.age',\n rules: [\n {\n operator: {\n value: 'has_number_gte',\n name: 'has a number at or above'\n },\n value1: '18',\n value2: '',\n category: 'Adult'\n },\n {\n operator: { value: 'has_number_lt', name: 'has a number below' },\n value1: '', // Missing value1\n value2: '',\n category: 'Child'\n },\n {\n operator: {\n value: 'has_number_between',\n name: 'has a number between'\n },\n value1: '10',\n value2: '', // Missing value2 for 2-operand operator\n category: 'Teen'\n }\n ],\n result_name: ''\n };\n\n const originalNode: Node = {\n uuid: 'test-node-uuid',\n actions: [],\n router: {\n type: 'switch',\n operand: '@input.text',\n cases: [],\n categories: [],\n default_category_uuid: ''\n },\n exits: []\n };\n\n const resultNode = split_by_expression.fromFormData!(\n formData,\n originalNode\n );\n\n // Only the first complete rule should be included\n expect(resultNode.router!.cases).to.have.lengthOf(1);\n expect(resultNode.router!.cases![0].type).to.equal('has_number_gte');\n expect(resultNode.router!.categories).to.have.lengthOf(2); // Adult + Other\n });\n\n it('should handle string operator format', () => {\n const formData = {\n uuid: 'test-node-uuid',\n operand: '@fields.name',\n rules: [\n {\n operator: 'has_any_word', // String format instead of object\n value1: 'john',\n value2: '',\n category: 'Name'\n }\n ],\n result_name: ''\n };\n\n const originalNode: Node = {\n uuid: 'test-node-uuid',\n actions: [],\n router: {\n type: 'switch',\n operand: '@input.text',\n cases: [],\n categories: [],\n default_category_uuid: ''\n },\n exits: []\n };\n\n const resultNode = split_by_expression.fromFormData!(\n formData,\n originalNode\n );\n\n expect(resultNode.router!.cases).to.have.lengthOf(1);\n expect(resultNode.router!.cases![0].type).to.equal('has_any_word');\n expect(resultNode.router!.cases![0].arguments).to.deep.equal(['john']);\n });\n\n it('should default operand to @input.text if not provided', () => {\n const formData = {\n uuid: 'test-node-uuid',\n operand: '', // Empty operand\n rules: [],\n result_name: ''\n };\n\n const originalNode: Node = {\n uuid: 'test-node-uuid',\n actions: [],\n router: {\n type: 'switch',\n operand: '@input.text',\n cases: [],\n categories: [],\n default_category_uuid: ''\n },\n exits: []\n };\n\n const resultNode = split_by_expression.fromFormData!(\n formData,\n originalNode\n );\n\n expect(resultNode.router!.operand).to.equal('@input.text');\n });\n });\n\n describe('validate', () => {\n it('should validate that operand is required', () => {\n const formData = {\n operand: '',\n rules: []\n };\n\n const result = split_by_expression.validate!(formData);\n\n expect(result.valid).to.be.false;\n expect(result.errors.operand).to.exist;\n });\n\n it('should validate successfully with operand', () => {\n const formData = {\n operand: '@fields.age',\n rules: []\n };\n\n const result = split_by_expression.validate!(formData);\n\n expect(result.valid).to.be.true;\n expect(Object.keys(result.errors)).to.have.lengthOf(0);\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 router: {\n type: 'switch',\n operand: '@fields.temperature',\n result_name: 'Temp Category',\n cases: [\n {\n uuid: 'case-hot',\n type: 'has_number_gt',\n arguments: ['30'],\n category_uuid: 'cat-hot'\n },\n {\n uuid: 'case-cold',\n type: 'has_number_lt',\n arguments: ['10'],\n category_uuid: 'cat-cold'\n }\n ],\n categories: [\n { uuid: 'cat-hot', name: 'Hot', exit_uuid: 'exit-hot' },\n { uuid: 'cat-cold', name: 'Cold', exit_uuid: 'exit-cold' },\n { uuid: 'cat-other', name: 'Other', exit_uuid: 'exit-other' }\n ],\n default_category_uuid: 'cat-other'\n },\n exits: [\n { uuid: 'exit-hot', destination_uuid: 'next-1' },\n { uuid: 'exit-cold', destination_uuid: 'next-2' },\n { uuid: 'exit-other', destination_uuid: 'next-3' }\n ]\n };\n\n const formData = split_by_expression.toFormData!(originalNode);\n const resultNode = split_by_expression.fromFormData!(\n formData,\n originalNode\n );\n\n // Check basic structure\n expect(resultNode.uuid).to.equal(originalNode.uuid);\n expect(resultNode.router!.operand).to.equal(originalNode.router!.operand);\n expect(resultNode.router!.result_name).to.equal(\n originalNode.router!.result_name\n );\n\n // Check that all UUIDs are preserved\n expect(resultNode.router!.categories).to.have.lengthOf(3);\n expect(resultNode.exits).to.have.lengthOf(3);\n\n const hotCategory = resultNode.router!.categories!.find(\n (cat) => cat.name === 'Hot'\n );\n expect(hotCategory!.uuid).to.equal('cat-hot');\n expect(hotCategory!.exit_uuid).to.equal('exit-hot');\n\n // Check destinations are preserved\n const hotExit = resultNode.exits!.find(\n (exit) => exit.uuid === 'exit-hot'\n );\n expect(hotExit!.destination_uuid).to.equal('next-1');\n });\n });\n});\n"]}
|
|
@@ -9,13 +9,13 @@ describe('split_by_random node config', () => {
|
|
|
9
9
|
describe('basic properties', () => {
|
|
10
10
|
helper.testBasicProperties();
|
|
11
11
|
it('has correct name', () => {
|
|
12
|
-
expect(split_by_random.name).to.equal('Split
|
|
12
|
+
expect(split_by_random.name).to.equal('Random Split');
|
|
13
13
|
});
|
|
14
14
|
it('has correct type', () => {
|
|
15
15
|
expect(split_by_random.type).to.equal('split_by_random');
|
|
16
16
|
});
|
|
17
|
-
it('has correct
|
|
18
|
-
expect(split_by_random.
|
|
17
|
+
it('has correct group', () => {
|
|
18
|
+
expect(split_by_random.group).to.exist;
|
|
19
19
|
});
|
|
20
20
|
it('has router configuration', () => {
|
|
21
21
|
expect(split_by_random.router).to.exist;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"split_by_random.test.js","sourceRoot":"","sources":["../../../test/nodes/split_by_random.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AAEvE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;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E,IAAI,EAAE,eAAe,EAAE,gBAAgB,EAAE,IAAI,EAAE;oBACjD,EAAE,IAAI,EAAE,eAAe,EAAE,gBAAgB,EAAE,IAAI,EAAE;oBACjD,EAAE,IAAI,EAAE,eAAe,EAAE,gBAAgB,EAAE,IAAI,EAAE;oBACjD,EAAE,IAAI,EAAE,eAAe,EAAE,gBAAgB,EAAE,IAAI,EAAE;oBACjD,EAAE,IAAI,EAAE,eAAe,EAAE,gBAAgB,EAAE,IAAI,EAAE;iBAClD;aACM,EACT,EAAE,IAAI,EAAE,iBAAiB,EAAE,EAC3B,2BAA2B,CAC5B,CAAC;QACJ,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,wBAAwB,EAAE,KAAK,IAAI,EAAE;YACtC,MAAM,MAAM,CAAC,QAAQ,CACnB;gBACE,IAAI,EAAE,oBAAoB;gBAC1B,OAAO,EAAE,EAAE;gBACX,MAAM,EAAE;oBACN,IAAI,EAAE,QAAQ;oBACd,UAAU,EAAE;wBACV;4BACE,IAAI,EAAE,cAAc;4BACpB,IAAI,EAAE,cAAc;4BACpB,SAAS,EAAE,eAAe;yBAC3B;wBACD;4BACE,IAAI,EAAE,cAAc;4BACpB,IAAI,EAAE,sBAAsB;4BAC5B,SAAS,EAAE,eAAe;yBAC3B;qBACF;iBACF;gBACD,KAAK,EAAE;oBACL,EAAE,IAAI,EAAE,eAAe,EAAE,gBAAgB,EAAE,IAAI,EAAE;oBACjD,EAAE,IAAI,EAAE,eAAe,EAAE,gBAAgB,EAAE,IAAI,EAAE;iBAClD;aACM,EACT,EAAE,IAAI,EAAE,iBAAiB,EAAE,EAC3B,gBAAgB,CACjB,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { expect } from '@open-wc/testing';\nimport { split_by_random } from '../../src/flow/nodes/split_by_random';\nimport { Node } from '../../src/store/flow-definition';\nimport { NodeTest } from '../NodeHelper';\n\n/**\n * Test suite for the split_by_random node configuration.\n */\ndescribe('split_by_random node config', () => {\n const helper = new NodeTest(split_by_random, 'split_by_random');\n\n describe('basic properties', () => {\n helper.testBasicProperties();\n\n it('has correct name', () => {\n expect(split_by_random.name).to.equal('Random Split');\n });\n\n it('has correct type', () => {\n expect(split_by_random.type).to.equal('split_by_random');\n });\n\n it('has correct group', () => {\n expect(split_by_random.group).to.exist;\n });\n\n it('has router configuration', () => {\n expect(split_by_random.router).to.exist;\n expect(split_by_random.router.type).to.equal('random');\n });\n });\n\n describe('node scenarios', () => {\n it('renders two bucket split', async () => {\n await helper.testNode(\n {\n uuid: 'test-random-node-1',\n actions: [],\n router: {\n type: 'random',\n categories: [\n {\n uuid: 'random-cat-1',\n name: 'Bucket A',\n exit_uuid: 'random-exit-1'\n },\n {\n uuid: 'random-cat-2',\n name: 'Bucket B',\n exit_uuid: 'random-exit-2'\n }\n ]\n },\n exits: [\n { uuid: 'random-exit-1', destination_uuid: null },\n { uuid: 'random-exit-2', destination_uuid: null }\n ]\n } as Node,\n { type: 'split_by_random' },\n 'two-bucket-split'\n );\n });\n\n it('renders three way split', async () => {\n await helper.testNode(\n {\n uuid: 'test-random-node-2',\n actions: [],\n router: {\n type: 'random',\n categories: [\n {\n uuid: 'random-cat-1',\n name: 'Group A',\n exit_uuid: 'random-exit-1'\n },\n {\n uuid: 'random-cat-2',\n name: 'Group B',\n exit_uuid: 'random-exit-2'\n },\n {\n uuid: 'random-cat-3',\n name: 'Group C',\n exit_uuid: 'random-exit-3'\n }\n ]\n },\n exits: [\n { uuid: 'random-exit-1', destination_uuid: null },\n { uuid: 'random-exit-2', destination_uuid: null },\n { uuid: 'random-exit-3', destination_uuid: null }\n ]\n } as Node,\n { type: 'split_by_random' },\n 'three-way-split'\n );\n });\n\n it('renders ab test multiple variants', async () => {\n await helper.testNode(\n {\n uuid: 'test-random-node-3',\n actions: [],\n router: {\n type: 'random',\n categories: [\n {\n uuid: 'random-cat-1',\n name: 'Treatment',\n exit_uuid: 'random-exit-1'\n },\n {\n uuid: 'random-cat-2',\n name: 'Control',\n exit_uuid: 'random-exit-2'\n },\n {\n uuid: 'random-cat-3',\n name: 'Variant A',\n exit_uuid: 'random-exit-3'\n },\n {\n uuid: 'random-cat-4',\n name: 'Variant B',\n exit_uuid: 'random-exit-4'\n },\n {\n uuid: 'random-cat-5',\n name: 'Holdout',\n exit_uuid: 'random-exit-5'\n }\n ]\n },\n exits: [\n { uuid: 'random-exit-1', destination_uuid: null },\n { uuid: 'random-exit-2', destination_uuid: null },\n { uuid: 'random-exit-3', destination_uuid: null },\n { uuid: 'random-exit-4', destination_uuid: null },\n { uuid: 'random-exit-5', destination_uuid: null }\n ]\n } as Node,\n { type: 'split_by_random' },\n 'ab-test-multiple-variants'\n );\n });\n\n it('renders sampling split', async () => {\n await helper.testNode(\n {\n uuid: 'test-random-node-4',\n actions: [],\n router: {\n type: 'random',\n categories: [\n {\n uuid: 'random-cat-1',\n name: 'Sample Group',\n exit_uuid: 'random-exit-1'\n },\n {\n uuid: 'random-cat-2',\n name: 'Remaining Population',\n exit_uuid: 'random-exit-2'\n }\n ]\n },\n exits: [\n { uuid: 'random-exit-1', destination_uuid: null },\n { uuid: 'random-exit-2', destination_uuid: null }\n ]\n } as Node,\n { type: 'split_by_random' },\n 'sampling-split'\n );\n });\n });\n});\n"]}
|
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
import { expect } from '@open-wc/testing';
|
|
2
|
+
import { split_by_resthook } from '../../src/flow/nodes/split_by_resthook';
|
|
3
|
+
describe('temba-split-by-resthook', () => {
|
|
4
|
+
it('should transform from flow definition to form data correctly', () => {
|
|
5
|
+
const node = {
|
|
6
|
+
uuid: 'test-node-uuid',
|
|
7
|
+
actions: [
|
|
8
|
+
{
|
|
9
|
+
type: 'call_resthook',
|
|
10
|
+
uuid: 'action-uuid',
|
|
11
|
+
resthook: 'new-registration'
|
|
12
|
+
}
|
|
13
|
+
],
|
|
14
|
+
router: {
|
|
15
|
+
type: 'switch',
|
|
16
|
+
cases: [
|
|
17
|
+
{
|
|
18
|
+
uuid: 'case-1',
|
|
19
|
+
type: 'has_text',
|
|
20
|
+
arguments: [],
|
|
21
|
+
category_uuid: 'cat-success'
|
|
22
|
+
}
|
|
23
|
+
],
|
|
24
|
+
categories: [
|
|
25
|
+
{ uuid: 'cat-success', name: 'Success', exit_uuid: 'exit-success' },
|
|
26
|
+
{ uuid: 'cat-failure', name: 'Failure', exit_uuid: 'exit-failure' }
|
|
27
|
+
],
|
|
28
|
+
default_category_uuid: 'cat-failure',
|
|
29
|
+
operand: '@webhook.json.status'
|
|
30
|
+
},
|
|
31
|
+
exits: [
|
|
32
|
+
{ uuid: 'exit-success', destination_uuid: null },
|
|
33
|
+
{ uuid: 'exit-failure', destination_uuid: null }
|
|
34
|
+
]
|
|
35
|
+
};
|
|
36
|
+
const formData = split_by_resthook.toFormData(node);
|
|
37
|
+
expect(formData.uuid).to.equal('test-node-uuid');
|
|
38
|
+
expect(formData.resthook).to.have.lengthOf(1);
|
|
39
|
+
expect(formData.resthook[0]).to.deep.equal({
|
|
40
|
+
resthook: 'new-registration'
|
|
41
|
+
});
|
|
42
|
+
expect(formData.result_name).to.equal('');
|
|
43
|
+
});
|
|
44
|
+
it('should transform from flow definition to form data with result_name', () => {
|
|
45
|
+
const node = {
|
|
46
|
+
uuid: 'test-node-uuid',
|
|
47
|
+
actions: [
|
|
48
|
+
{
|
|
49
|
+
type: 'call_resthook',
|
|
50
|
+
uuid: 'action-uuid',
|
|
51
|
+
resthook: 'payment-received'
|
|
52
|
+
}
|
|
53
|
+
],
|
|
54
|
+
router: {
|
|
55
|
+
type: 'switch',
|
|
56
|
+
cases: [
|
|
57
|
+
{
|
|
58
|
+
uuid: 'case-1',
|
|
59
|
+
type: 'has_text',
|
|
60
|
+
arguments: [],
|
|
61
|
+
category_uuid: 'cat-success'
|
|
62
|
+
}
|
|
63
|
+
],
|
|
64
|
+
categories: [
|
|
65
|
+
{ uuid: 'cat-success', name: 'Success', exit_uuid: 'exit-success' },
|
|
66
|
+
{ uuid: 'cat-failure', name: 'Failure', exit_uuid: 'exit-failure' }
|
|
67
|
+
],
|
|
68
|
+
result_name: 'payment_status',
|
|
69
|
+
default_category_uuid: 'cat-failure',
|
|
70
|
+
operand: '@webhook.json.status'
|
|
71
|
+
},
|
|
72
|
+
exits: [
|
|
73
|
+
{ uuid: 'exit-success', destination_uuid: null },
|
|
74
|
+
{ uuid: 'exit-failure', destination_uuid: null }
|
|
75
|
+
]
|
|
76
|
+
};
|
|
77
|
+
const formData = split_by_resthook.toFormData(node);
|
|
78
|
+
expect(formData.result_name).to.equal('payment_status');
|
|
79
|
+
expect(formData.resthook).to.have.lengthOf(1);
|
|
80
|
+
expect(formData.resthook[0]).to.deep.equal({
|
|
81
|
+
resthook: 'payment-received'
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
it('should transform from form data to flow definition correctly', () => {
|
|
85
|
+
const originalNode = {
|
|
86
|
+
uuid: 'test-node-uuid',
|
|
87
|
+
actions: [],
|
|
88
|
+
exits: []
|
|
89
|
+
};
|
|
90
|
+
const formData = {
|
|
91
|
+
uuid: 'test-node-uuid',
|
|
92
|
+
resthook: [{ resthook: 'new-registration' }]
|
|
93
|
+
};
|
|
94
|
+
const resultNode = split_by_resthook.fromFormData(formData, originalNode);
|
|
95
|
+
expect(resultNode.uuid).to.equal('test-node-uuid');
|
|
96
|
+
expect(resultNode.actions).to.have.lengthOf(1);
|
|
97
|
+
const action = resultNode.actions[0];
|
|
98
|
+
expect(action.type).to.equal('call_resthook');
|
|
99
|
+
expect(resultNode.router.type).to.equal('switch');
|
|
100
|
+
expect(resultNode.router.operand).to.equal('@webhook.json.status');
|
|
101
|
+
expect(resultNode.router.categories).to.have.lengthOf(2); // Success + Failure
|
|
102
|
+
expect(resultNode.exits).to.have.lengthOf(2); // Success + Failure
|
|
103
|
+
// check success category
|
|
104
|
+
const successCategory = resultNode.router.categories.find((cat) => cat.name === 'Success');
|
|
105
|
+
expect(successCategory).to.exist;
|
|
106
|
+
// check failure category
|
|
107
|
+
const failureCategory = resultNode.router.categories.find((cat) => cat.name === 'Failure');
|
|
108
|
+
expect(failureCategory).to.exist;
|
|
109
|
+
expect(resultNode.router.default_category_uuid).to.equal(failureCategory.uuid);
|
|
110
|
+
});
|
|
111
|
+
it('should validate form data correctly', () => {
|
|
112
|
+
// valid form data
|
|
113
|
+
const validData = {
|
|
114
|
+
resthook: [{ resthook: 'new-registration' }]
|
|
115
|
+
};
|
|
116
|
+
const validResult = split_by_resthook.validate(validData);
|
|
117
|
+
expect(validResult.valid).to.be.true;
|
|
118
|
+
expect(Object.keys(validResult.errors)).to.have.lengthOf(0);
|
|
119
|
+
// invalid form data - no resthook
|
|
120
|
+
const invalidData = {
|
|
121
|
+
resthook: []
|
|
122
|
+
};
|
|
123
|
+
const invalidResult = split_by_resthook.validate(invalidData);
|
|
124
|
+
expect(invalidResult.valid).to.be.false;
|
|
125
|
+
expect(invalidResult.errors.resthook).to.equal('A resthook is required');
|
|
126
|
+
// invalid form data - missing resthook
|
|
127
|
+
const missingResthookData = {};
|
|
128
|
+
const missingResult = split_by_resthook.validate(missingResthookData);
|
|
129
|
+
expect(missingResult.valid).to.be.false;
|
|
130
|
+
expect(missingResult.errors.resthook).to.equal('A resthook is required');
|
|
131
|
+
});
|
|
132
|
+
it('should preserve existing UUIDs when editing', () => {
|
|
133
|
+
const originalNode = {
|
|
134
|
+
uuid: 'test-node-uuid',
|
|
135
|
+
actions: [
|
|
136
|
+
{
|
|
137
|
+
type: 'call_resthook',
|
|
138
|
+
uuid: 'existing-action-uuid',
|
|
139
|
+
resthook: 'new-registration'
|
|
140
|
+
}
|
|
141
|
+
],
|
|
142
|
+
router: {
|
|
143
|
+
type: 'switch',
|
|
144
|
+
cases: [
|
|
145
|
+
{
|
|
146
|
+
uuid: 'existing-case-uuid',
|
|
147
|
+
type: 'has_text',
|
|
148
|
+
arguments: [],
|
|
149
|
+
category_uuid: 'existing-success-uuid'
|
|
150
|
+
}
|
|
151
|
+
],
|
|
152
|
+
categories: [
|
|
153
|
+
{
|
|
154
|
+
uuid: 'existing-success-uuid',
|
|
155
|
+
name: 'Success',
|
|
156
|
+
exit_uuid: 'existing-success-exit-uuid'
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
uuid: 'existing-failure-uuid',
|
|
160
|
+
name: 'Failure',
|
|
161
|
+
exit_uuid: 'existing-failure-exit-uuid'
|
|
162
|
+
}
|
|
163
|
+
],
|
|
164
|
+
default_category_uuid: 'existing-failure-uuid',
|
|
165
|
+
operand: '@webhook.json.status'
|
|
166
|
+
},
|
|
167
|
+
exits: [
|
|
168
|
+
{
|
|
169
|
+
uuid: 'existing-success-exit-uuid',
|
|
170
|
+
destination_uuid: 'some-node-uuid'
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
uuid: 'existing-failure-exit-uuid',
|
|
174
|
+
destination_uuid: 'another-node-uuid'
|
|
175
|
+
}
|
|
176
|
+
]
|
|
177
|
+
};
|
|
178
|
+
// re-save with same resthook
|
|
179
|
+
const formData = {
|
|
180
|
+
uuid: 'test-node-uuid',
|
|
181
|
+
resthook: [{ resthook: 'new-registration' }],
|
|
182
|
+
result_name: ''
|
|
183
|
+
};
|
|
184
|
+
const resultNode = split_by_resthook.fromFormData(formData, originalNode);
|
|
185
|
+
// UUIDs should be preserved
|
|
186
|
+
expect(resultNode.actions[0].uuid).to.equal('existing-action-uuid');
|
|
187
|
+
expect(resultNode.router.cases[0].uuid).to.equal('existing-case-uuid');
|
|
188
|
+
expect(resultNode.router.categories[0].uuid).to.equal('existing-success-uuid');
|
|
189
|
+
expect(resultNode.exits[0].uuid).to.equal('existing-success-exit-uuid');
|
|
190
|
+
// destination connections should be preserved
|
|
191
|
+
expect(resultNode.exits[0].destination_uuid).to.equal('some-node-uuid');
|
|
192
|
+
expect(resultNode.exits[1].destination_uuid).to.equal('another-node-uuid');
|
|
193
|
+
});
|
|
194
|
+
it('should handle changing resthook while preserving structure', () => {
|
|
195
|
+
const originalNode = {
|
|
196
|
+
uuid: 'test-node-uuid',
|
|
197
|
+
actions: [
|
|
198
|
+
{
|
|
199
|
+
type: 'call_resthook',
|
|
200
|
+
uuid: 'existing-action-uuid',
|
|
201
|
+
resthook: 'new-registration'
|
|
202
|
+
}
|
|
203
|
+
],
|
|
204
|
+
router: {
|
|
205
|
+
type: 'switch',
|
|
206
|
+
cases: [
|
|
207
|
+
{
|
|
208
|
+
uuid: 'existing-case-uuid',
|
|
209
|
+
type: 'has_text',
|
|
210
|
+
arguments: [],
|
|
211
|
+
category_uuid: 'existing-success-uuid'
|
|
212
|
+
}
|
|
213
|
+
],
|
|
214
|
+
categories: [
|
|
215
|
+
{
|
|
216
|
+
uuid: 'existing-success-uuid',
|
|
217
|
+
name: 'Success',
|
|
218
|
+
exit_uuid: 'existing-success-exit-uuid'
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
uuid: 'existing-failure-uuid',
|
|
222
|
+
name: 'Failure',
|
|
223
|
+
exit_uuid: 'existing-failure-exit-uuid'
|
|
224
|
+
}
|
|
225
|
+
],
|
|
226
|
+
default_category_uuid: 'existing-failure-uuid',
|
|
227
|
+
operand: '@webhook.json.status'
|
|
228
|
+
},
|
|
229
|
+
exits: [
|
|
230
|
+
{
|
|
231
|
+
uuid: 'existing-success-exit-uuid',
|
|
232
|
+
destination_uuid: null
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
uuid: 'existing-failure-exit-uuid',
|
|
236
|
+
destination_uuid: null
|
|
237
|
+
}
|
|
238
|
+
]
|
|
239
|
+
};
|
|
240
|
+
// change to different resthook
|
|
241
|
+
const formData = {
|
|
242
|
+
uuid: 'test-node-uuid',
|
|
243
|
+
resthook: [{ resthook: 'payment-received' }]
|
|
244
|
+
};
|
|
245
|
+
const resultNode = split_by_resthook.fromFormData(formData, originalNode);
|
|
246
|
+
// action UUID should be preserved
|
|
247
|
+
expect(resultNode.actions[0].uuid).to.equal('existing-action-uuid');
|
|
248
|
+
// resthook should be updated
|
|
249
|
+
expect(resultNode.actions[0].resthook).to.equal('payment-received');
|
|
250
|
+
// structure should be preserved
|
|
251
|
+
expect(resultNode.router.categories).to.have.lengthOf(2);
|
|
252
|
+
expect(resultNode.exits).to.have.lengthOf(2);
|
|
253
|
+
});
|
|
254
|
+
it('should handle empty result_name by trimming it', () => {
|
|
255
|
+
const originalNode = {
|
|
256
|
+
uuid: 'test-node-uuid',
|
|
257
|
+
actions: [],
|
|
258
|
+
exits: []
|
|
259
|
+
};
|
|
260
|
+
const formData = {
|
|
261
|
+
uuid: 'test-node-uuid',
|
|
262
|
+
resthook: [{ resthook: 'new-registration' }],
|
|
263
|
+
result_name: ' '
|
|
264
|
+
};
|
|
265
|
+
const resultNode = split_by_resthook.fromFormData(formData, originalNode);
|
|
266
|
+
expect(resultNode.router.result_name).to.be.undefined;
|
|
267
|
+
});
|
|
268
|
+
it('should handle missing resthook selection gracefully', () => {
|
|
269
|
+
const originalNode = {
|
|
270
|
+
uuid: 'test-node-uuid',
|
|
271
|
+
actions: [],
|
|
272
|
+
exits: []
|
|
273
|
+
};
|
|
274
|
+
// missing resthook selection
|
|
275
|
+
const formData = {
|
|
276
|
+
uuid: 'test-node-uuid',
|
|
277
|
+
resthook: [],
|
|
278
|
+
result_name: ''
|
|
279
|
+
};
|
|
280
|
+
const resultNode = split_by_resthook.fromFormData(formData, originalNode);
|
|
281
|
+
// should return original node unchanged
|
|
282
|
+
expect(resultNode).to.equal(originalNode);
|
|
283
|
+
});
|
|
284
|
+
it('should handle null resthook selection', () => {
|
|
285
|
+
const originalNode = {
|
|
286
|
+
uuid: 'test-node-uuid',
|
|
287
|
+
actions: [],
|
|
288
|
+
exits: []
|
|
289
|
+
};
|
|
290
|
+
const formData = {
|
|
291
|
+
uuid: 'test-node-uuid',
|
|
292
|
+
resthook: null,
|
|
293
|
+
result_name: ''
|
|
294
|
+
};
|
|
295
|
+
const resultNode = split_by_resthook.fromFormData(formData, originalNode);
|
|
296
|
+
// should return original node unchanged
|
|
297
|
+
expect(resultNode).to.equal(originalNode);
|
|
298
|
+
});
|
|
299
|
+
it('should render the resthook name', () => {
|
|
300
|
+
const node = {
|
|
301
|
+
uuid: 'test-node-uuid',
|
|
302
|
+
actions: [
|
|
303
|
+
{
|
|
304
|
+
type: 'call_resthook',
|
|
305
|
+
uuid: 'action-uuid',
|
|
306
|
+
resthook: 'payment-received'
|
|
307
|
+
}
|
|
308
|
+
],
|
|
309
|
+
exits: []
|
|
310
|
+
};
|
|
311
|
+
const rendered = split_by_resthook.render(node);
|
|
312
|
+
// check that the rendered output includes the resthook name
|
|
313
|
+
expect(rendered.strings[0]).to.include('class="body"');
|
|
314
|
+
});
|
|
315
|
+
it('should handle missing resthook action when loading form data', () => {
|
|
316
|
+
const node = {
|
|
317
|
+
uuid: 'test-node-uuid',
|
|
318
|
+
actions: [],
|
|
319
|
+
exits: []
|
|
320
|
+
};
|
|
321
|
+
const formData = split_by_resthook.toFormData(node);
|
|
322
|
+
expect(formData.uuid).to.equal('test-node-uuid');
|
|
323
|
+
expect(formData.resthook).to.have.lengthOf(0);
|
|
324
|
+
expect(formData.result_name).to.equal('');
|
|
325
|
+
});
|
|
326
|
+
it('should render placeholder when no resthook configured', () => {
|
|
327
|
+
const node = {
|
|
328
|
+
uuid: 'test-node-uuid',
|
|
329
|
+
actions: [],
|
|
330
|
+
exits: []
|
|
331
|
+
};
|
|
332
|
+
const rendered = split_by_resthook.render(node);
|
|
333
|
+
// check that the rendered output includes placeholder text
|
|
334
|
+
expect(rendered.strings[0]).to.include('class="body"');
|
|
335
|
+
});
|
|
336
|
+
});
|
|
337
|
+
//# sourceMappingURL=split_by_resthook.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"split_by_resthook.test.js","sourceRoot":"","sources":["../../../test/nodes/split_by_resthook.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO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M,IAAI,GAAS;YACjB,IAAI,EAAE,gBAAgB;YACtB,OAAO,EAAE,EAAE;YACX,KAAK,EAAE,EAAE;SACV,CAAC;QAEF,MAAM,QAAQ,GAAG,iBAAiB,CAAC,UAAW,CAAC,IAAI,CAAC,CAAC;QAErD,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;QACjD,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;QAC9C,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAC5C,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,uDAAuD,EAAE,GAAG,EAAE;QAC/D,MAAM,IAAI,GAAS;YACjB,IAAI,EAAE,gBAAgB;YACtB,OAAO,EAAE,EAAE;YACX,KAAK,EAAE,EAAE;SACV,CAAC;QAEF,MAAM,QAAQ,GAAG,iBAAiB,CAAC,MAAO,CAAC,IAAI,CAAC,CAAC;QAEjD,2DAA2D;QAC3D,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;IACzD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { expect } from '@open-wc/testing';\nimport { split_by_resthook } from '../../src/flow/nodes/split_by_resthook';\nimport { Node, CallResthook } from '../../src/store/flow-definition.d';\n\ndescribe('temba-split-by-resthook', () => {\n it('should transform from flow definition to form data correctly', () => {\n const node: Node = {\n uuid: 'test-node-uuid',\n actions: [\n {\n type: 'call_resthook',\n uuid: 'action-uuid',\n resthook: 'new-registration'\n } as CallResthook\n ],\n router: {\n type: 'switch',\n cases: [\n {\n uuid: 'case-1',\n type: 'has_text',\n arguments: [],\n category_uuid: 'cat-success'\n }\n ],\n categories: [\n { uuid: 'cat-success', name: 'Success', exit_uuid: 'exit-success' },\n { uuid: 'cat-failure', name: 'Failure', exit_uuid: 'exit-failure' }\n ],\n default_category_uuid: 'cat-failure',\n operand: '@webhook.json.status'\n },\n exits: [\n { uuid: 'exit-success', destination_uuid: null },\n { uuid: 'exit-failure', destination_uuid: null }\n ]\n };\n\n const formData = split_by_resthook.toFormData!(node);\n\n expect(formData.uuid).to.equal('test-node-uuid');\n expect(formData.resthook).to.have.lengthOf(1);\n expect(formData.resthook[0]).to.deep.equal({\n resthook: 'new-registration'\n });\n expect(formData.result_name).to.equal('');\n });\n\n it('should transform from flow definition to form data with result_name', () => {\n const node: Node = {\n uuid: 'test-node-uuid',\n actions: [\n {\n type: 'call_resthook',\n uuid: 'action-uuid',\n resthook: 'payment-received'\n } as CallResthook\n ],\n router: {\n type: 'switch',\n cases: [\n {\n uuid: 'case-1',\n type: 'has_text',\n arguments: [],\n category_uuid: 'cat-success'\n }\n ],\n categories: [\n { uuid: 'cat-success', name: 'Success', exit_uuid: 'exit-success' },\n { uuid: 'cat-failure', name: 'Failure', exit_uuid: 'exit-failure' }\n ],\n result_name: 'payment_status',\n default_category_uuid: 'cat-failure',\n operand: '@webhook.json.status'\n },\n exits: [\n { uuid: 'exit-success', destination_uuid: null },\n { uuid: 'exit-failure', destination_uuid: null }\n ]\n };\n\n const formData = split_by_resthook.toFormData!(node);\n\n expect(formData.result_name).to.equal('payment_status');\n expect(formData.resthook).to.have.lengthOf(1);\n expect(formData.resthook[0]).to.deep.equal({\n resthook: 'payment-received'\n });\n });\n\n it('should transform from form data to flow definition correctly', () => {\n const originalNode: Node = {\n uuid: 'test-node-uuid',\n actions: [],\n exits: []\n };\n\n const formData = {\n uuid: 'test-node-uuid',\n resthook: [{ resthook: 'new-registration' }]\n };\n\n const resultNode = split_by_resthook.fromFormData!(formData, originalNode);\n\n expect(resultNode.uuid).to.equal('test-node-uuid');\n expect(resultNode.actions).to.have.lengthOf(1);\n\n const action = resultNode.actions![0];\n expect(action.type).to.equal('call_resthook');\n\n expect(resultNode.router!.type).to.equal('switch');\n expect(resultNode.router!.operand).to.equal('@webhook.json.status');\n expect(resultNode.router!.categories).to.have.lengthOf(2); // Success + Failure\n expect(resultNode.exits).to.have.lengthOf(2); // Success + Failure\n\n // check success category\n const successCategory = resultNode.router!.categories!.find(\n (cat) => cat.name === 'Success'\n );\n expect(successCategory).to.exist;\n\n // check failure category\n const failureCategory = resultNode.router!.categories!.find(\n (cat) => cat.name === 'Failure'\n );\n expect(failureCategory).to.exist;\n expect(resultNode.router!.default_category_uuid).to.equal(\n failureCategory!.uuid\n );\n });\n\n it('should validate form data correctly', () => {\n // valid form data\n const validData = {\n resthook: [{ resthook: 'new-registration' }]\n };\n\n const validResult = split_by_resthook.validate!(validData);\n expect(validResult.valid).to.be.true;\n expect(Object.keys(validResult.errors)).to.have.lengthOf(0);\n\n // invalid form data - no resthook\n const invalidData = {\n resthook: []\n };\n\n const invalidResult = split_by_resthook.validate!(invalidData);\n expect(invalidResult.valid).to.be.false;\n expect(invalidResult.errors.resthook).to.equal('A resthook is required');\n\n // invalid form data - missing resthook\n const missingResthookData = {};\n\n const missingResult = split_by_resthook.validate!(missingResthookData);\n expect(missingResult.valid).to.be.false;\n expect(missingResult.errors.resthook).to.equal('A resthook is required');\n });\n\n it('should preserve existing UUIDs when editing', () => {\n const originalNode: Node = {\n uuid: 'test-node-uuid',\n actions: [\n {\n type: 'call_resthook',\n uuid: 'existing-action-uuid',\n resthook: 'new-registration'\n } as CallResthook\n ],\n router: {\n type: 'switch',\n cases: [\n {\n uuid: 'existing-case-uuid',\n type: 'has_text',\n arguments: [],\n category_uuid: 'existing-success-uuid'\n }\n ],\n categories: [\n {\n uuid: 'existing-success-uuid',\n name: 'Success',\n exit_uuid: 'existing-success-exit-uuid'\n },\n {\n uuid: 'existing-failure-uuid',\n name: 'Failure',\n exit_uuid: 'existing-failure-exit-uuid'\n }\n ],\n default_category_uuid: 'existing-failure-uuid',\n operand: '@webhook.json.status'\n },\n exits: [\n {\n uuid: 'existing-success-exit-uuid',\n destination_uuid: 'some-node-uuid'\n },\n {\n uuid: 'existing-failure-exit-uuid',\n destination_uuid: 'another-node-uuid'\n }\n ]\n };\n\n // re-save with same resthook\n const formData = {\n uuid: 'test-node-uuid',\n resthook: [{ resthook: 'new-registration' }],\n result_name: ''\n };\n\n const resultNode = split_by_resthook.fromFormData!(formData, originalNode);\n\n // UUIDs should be preserved\n expect(resultNode.actions![0].uuid).to.equal('existing-action-uuid');\n expect(resultNode.router!.cases![0].uuid).to.equal('existing-case-uuid');\n expect(resultNode.router!.categories![0].uuid).to.equal(\n 'existing-success-uuid'\n );\n expect(resultNode.exits![0].uuid).to.equal('existing-success-exit-uuid');\n\n // destination connections should be preserved\n expect(resultNode.exits![0].destination_uuid).to.equal('some-node-uuid');\n expect(resultNode.exits![1].destination_uuid).to.equal('another-node-uuid');\n });\n\n it('should handle changing resthook while preserving structure', () => {\n const originalNode: Node = {\n uuid: 'test-node-uuid',\n actions: [\n {\n type: 'call_resthook',\n uuid: 'existing-action-uuid',\n resthook: 'new-registration'\n } as CallResthook\n ],\n router: {\n type: 'switch',\n cases: [\n {\n uuid: 'existing-case-uuid',\n type: 'has_text',\n arguments: [],\n category_uuid: 'existing-success-uuid'\n }\n ],\n categories: [\n {\n uuid: 'existing-success-uuid',\n name: 'Success',\n exit_uuid: 'existing-success-exit-uuid'\n },\n {\n uuid: 'existing-failure-uuid',\n name: 'Failure',\n exit_uuid: 'existing-failure-exit-uuid'\n }\n ],\n default_category_uuid: 'existing-failure-uuid',\n operand: '@webhook.json.status'\n },\n exits: [\n {\n uuid: 'existing-success-exit-uuid',\n destination_uuid: null\n },\n {\n uuid: 'existing-failure-exit-uuid',\n destination_uuid: null\n }\n ]\n };\n\n // change to different resthook\n const formData = {\n uuid: 'test-node-uuid',\n resthook: [{ resthook: 'payment-received' }]\n };\n\n const resultNode = split_by_resthook.fromFormData!(formData, originalNode);\n\n // action UUID should be preserved\n expect(resultNode.actions![0].uuid).to.equal('existing-action-uuid');\n\n // resthook should be updated\n expect((resultNode.actions![0] as any).resthook).to.equal(\n 'payment-received'\n );\n\n // structure should be preserved\n expect(resultNode.router!.categories).to.have.lengthOf(2);\n expect(resultNode.exits).to.have.lengthOf(2);\n });\n\n it('should handle empty result_name by trimming it', () => {\n const originalNode: Node = {\n uuid: 'test-node-uuid',\n actions: [],\n exits: []\n };\n\n const formData = {\n uuid: 'test-node-uuid',\n resthook: [{ resthook: 'new-registration' }],\n result_name: ' '\n };\n\n const resultNode = split_by_resthook.fromFormData!(formData, originalNode);\n expect(resultNode.router.result_name).to.be.undefined;\n });\n\n it('should handle missing resthook selection gracefully', () => {\n const originalNode: Node = {\n uuid: 'test-node-uuid',\n actions: [],\n exits: []\n };\n\n // missing resthook selection\n const formData = {\n uuid: 'test-node-uuid',\n resthook: [],\n result_name: ''\n };\n\n const resultNode = split_by_resthook.fromFormData!(formData, originalNode);\n\n // should return original node unchanged\n expect(resultNode).to.equal(originalNode);\n });\n\n it('should handle null resthook selection', () => {\n const originalNode: Node = {\n uuid: 'test-node-uuid',\n actions: [],\n exits: []\n };\n\n const formData = {\n uuid: 'test-node-uuid',\n resthook: null,\n result_name: ''\n };\n\n const resultNode = split_by_resthook.fromFormData!(formData, originalNode);\n\n // should return original node unchanged\n expect(resultNode).to.equal(originalNode);\n });\n\n it('should render the resthook name', () => {\n const node: Node = {\n uuid: 'test-node-uuid',\n actions: [\n {\n type: 'call_resthook',\n uuid: 'action-uuid',\n resthook: 'payment-received'\n } as CallResthook\n ],\n exits: []\n };\n\n const rendered = split_by_resthook.render!(node);\n\n // check that the rendered output includes the resthook name\n expect(rendered.strings[0]).to.include('class=\"body\"');\n });\n\n it('should handle missing resthook action when loading form data', () => {\n const node: Node = {\n uuid: 'test-node-uuid',\n actions: [],\n exits: []\n };\n\n const formData = split_by_resthook.toFormData!(node);\n\n expect(formData.uuid).to.equal('test-node-uuid');\n expect(formData.resthook).to.have.lengthOf(0);\n expect(formData.result_name).to.equal('');\n });\n\n it('should render placeholder when no resthook configured', () => {\n const node: Node = {\n uuid: 'test-node-uuid',\n actions: [],\n exits: []\n };\n\n const rendered = split_by_resthook.render!(node);\n\n // check that the rendered output includes placeholder text\n expect(rendered.strings[0]).to.include('class=\"body\"');\n });\n});\n"]}
|