@nyaruka/temba-components 0.129.2 → 0.129.4
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/.eslintrc.js +1 -0
- package/.github/workflows/build.yml +141 -8
- package/CHANGELOG.md +40 -0
- package/README.md +6 -0
- package/check-coverage.js +133 -0
- package/demo/data/flows/sample-flow.json +158 -128
- package/demo/field-config-demo.html +135 -0
- package/dist/temba-components.js +1750 -751
- package/dist/temba-components.js.map +1 -1
- package/docs/ActionEditor-Migration.md +118 -0
- package/generate-coverage-badge.sh +69 -0
- package/out-tsc/src/{vectoricon/index.js → Icons.js} +1 -1
- package/out-tsc/src/Icons.js.map +1 -0
- package/out-tsc/src/display/Alert.js.map +1 -0
- package/out-tsc/src/display/Anchor.js.map +1 -0
- package/out-tsc/src/display/Button.js.map +1 -0
- package/out-tsc/src/{charcount → display}/CharCount.js +159 -2
- package/out-tsc/src/display/CharCount.js.map +1 -0
- package/out-tsc/src/display/Chat.js.map +1 -0
- package/out-tsc/src/display/ContactName.js.map +1 -0
- package/out-tsc/src/display/ContactUrn.js.map +1 -0
- package/out-tsc/src/display/Dropdown.js.map +1 -0
- package/out-tsc/src/{vectoricon/VectorIcon.js → display/Icon.js} +2 -2
- package/out-tsc/src/display/Icon.js.map +1 -0
- package/out-tsc/src/display/Label.js.map +1 -0
- package/out-tsc/src/{leafletmap → display}/LeafletMap.js +16 -1
- package/out-tsc/src/display/LeafletMap.js.map +1 -0
- package/out-tsc/src/display/Lightbox.js.map +1 -0
- package/out-tsc/src/{loading → display}/Loading.js.map +1 -1
- package/out-tsc/src/{options → display}/Options.js.map +1 -1
- package/out-tsc/src/display/ProgressBar.js.map +1 -0
- package/out-tsc/src/display/TembaDate.js.map +1 -0
- package/out-tsc/src/display/TembaUser.js.map +1 -0
- package/out-tsc/src/display/Thumbnail.js.map +1 -0
- package/out-tsc/src/{tip → display}/Tip.js +1 -2
- package/out-tsc/src/display/Tip.js.map +1 -0
- package/out-tsc/src/display/Toast.js.map +1 -0
- package/out-tsc/src/display/sms/gsmsplitter.js.map +1 -0
- package/out-tsc/src/display/sms/gsmvalidator.js.map +1 -0
- package/out-tsc/src/display/sms/index.js.map +1 -0
- package/out-tsc/src/display/sms/unicodesplitter.js.map +1 -0
- package/out-tsc/src/events.js +2 -0
- package/out-tsc/src/events.js.map +1 -0
- package/out-tsc/src/excellent/ExcellentParser.js.map +1 -0
- package/out-tsc/src/excellent/helpers.js.map +1 -0
- package/out-tsc/src/flow/CanvasNode.js +861 -0
- package/out-tsc/src/flow/CanvasNode.js.map +1 -0
- package/out-tsc/src/flow/Editor.js +640 -143
- package/out-tsc/src/flow/Editor.js.map +1 -1
- package/out-tsc/src/flow/NodeEditor.js +1200 -0
- package/out-tsc/src/flow/NodeEditor.js.map +1 -0
- package/out-tsc/src/flow/Plumber.js +148 -74
- package/out-tsc/src/flow/Plumber.js.map +1 -1
- package/out-tsc/src/flow/StickyNote.js +153 -9
- package/out-tsc/src/flow/StickyNote.js.map +1 -1
- package/out-tsc/src/flow/actions/add_contact_groups.js +40 -0
- package/out-tsc/src/flow/actions/add_contact_groups.js.map +1 -0
- package/out-tsc/src/flow/actions/add_contact_urn.js +16 -0
- package/out-tsc/src/flow/actions/add_contact_urn.js.map +1 -0
- package/out-tsc/src/flow/actions/add_input_labels.js +11 -0
- package/out-tsc/src/flow/actions/add_input_labels.js.map +1 -0
- package/out-tsc/src/flow/actions/call_classifier.js +11 -0
- package/out-tsc/src/flow/actions/call_classifier.js.map +1 -0
- package/out-tsc/src/flow/actions/call_llm.js +11 -0
- package/out-tsc/src/flow/actions/call_llm.js.map +1 -0
- package/out-tsc/src/flow/actions/call_resthook.js +11 -0
- package/out-tsc/src/flow/actions/call_resthook.js.map +1 -0
- package/out-tsc/src/flow/actions/call_webhook.js +122 -0
- package/out-tsc/src/flow/actions/call_webhook.js.map +1 -0
- package/out-tsc/src/flow/actions/enter_flow.js +14 -0
- package/out-tsc/src/flow/actions/enter_flow.js.map +1 -0
- package/out-tsc/src/flow/actions/open_ticket.js +11 -0
- package/out-tsc/src/flow/actions/open_ticket.js.map +1 -0
- package/out-tsc/src/flow/actions/play_audio.js +11 -0
- package/out-tsc/src/flow/actions/play_audio.js.map +1 -0
- package/out-tsc/src/flow/actions/remove_contact_groups.js +62 -0
- package/out-tsc/src/flow/actions/remove_contact_groups.js.map +1 -0
- package/out-tsc/src/flow/actions/request_optin.js +11 -0
- package/out-tsc/src/flow/actions/request_optin.js.map +1 -0
- package/out-tsc/src/flow/actions/say_msg.js +11 -0
- package/out-tsc/src/flow/actions/say_msg.js.map +1 -0
- package/out-tsc/src/flow/actions/send_broadcast.js +33 -0
- package/out-tsc/src/flow/actions/send_broadcast.js.map +1 -0
- package/out-tsc/src/flow/actions/send_email.js +56 -0
- package/out-tsc/src/flow/actions/send_email.js.map +1 -0
- package/out-tsc/src/flow/actions/send_msg.js +55 -0
- package/out-tsc/src/flow/actions/send_msg.js.map +1 -0
- package/out-tsc/src/flow/actions/set_contact_channel.js +12 -0
- package/out-tsc/src/flow/actions/set_contact_channel.js.map +1 -0
- package/out-tsc/src/flow/actions/set_contact_field.js +12 -0
- package/out-tsc/src/flow/actions/set_contact_field.js.map +1 -0
- package/out-tsc/src/flow/actions/set_contact_language.js +10 -0
- package/out-tsc/src/flow/actions/set_contact_language.js.map +1 -0
- package/out-tsc/src/flow/actions/set_contact_name.js +10 -0
- package/out-tsc/src/flow/actions/set_contact_name.js.map +1 -0
- package/out-tsc/src/flow/actions/set_contact_status.js +10 -0
- package/out-tsc/src/flow/actions/set_contact_status.js.map +1 -0
- package/out-tsc/src/flow/actions/set_run_result.js +10 -0
- package/out-tsc/src/flow/actions/set_run_result.js.map +1 -0
- package/out-tsc/src/flow/actions/split_by_expression_example.js +77 -0
- package/out-tsc/src/flow/actions/split_by_expression_example.js.map +1 -0
- package/out-tsc/src/flow/actions/start_session.js +11 -0
- package/out-tsc/src/flow/actions/start_session.js.map +1 -0
- package/out-tsc/src/flow/actions/transfer_airtime.js +11 -0
- package/out-tsc/src/flow/actions/transfer_airtime.js.map +1 -0
- package/out-tsc/src/flow/config.js +88 -123
- package/out-tsc/src/flow/config.js.map +1 -1
- package/out-tsc/src/flow/nodes/execute_actions.js +4 -0
- package/out-tsc/src/flow/nodes/execute_actions.js.map +1 -0
- package/out-tsc/src/flow/nodes/split_by_airtime.js +9 -0
- package/out-tsc/src/flow/nodes/split_by_airtime.js.map +1 -0
- package/out-tsc/src/flow/nodes/split_by_contact_field.js +7 -0
- package/out-tsc/src/flow/nodes/split_by_contact_field.js.map +1 -0
- package/out-tsc/src/flow/nodes/split_by_expression.js +7 -0
- package/out-tsc/src/flow/nodes/split_by_expression.js.map +1 -0
- package/out-tsc/src/flow/nodes/split_by_groups.js +7 -0
- package/out-tsc/src/flow/nodes/split_by_groups.js.map +1 -0
- package/out-tsc/src/flow/nodes/split_by_random.js +10 -0
- package/out-tsc/src/flow/nodes/split_by_random.js.map +1 -0
- package/out-tsc/src/flow/nodes/split_by_run_result.js +7 -0
- package/out-tsc/src/flow/nodes/split_by_run_result.js.map +1 -0
- package/out-tsc/src/flow/nodes/split_by_scheme.js +7 -0
- package/out-tsc/src/flow/nodes/split_by_scheme.js.map +1 -0
- package/out-tsc/src/flow/nodes/split_by_subflow.js +9 -0
- package/out-tsc/src/flow/nodes/split_by_subflow.js.map +1 -0
- package/out-tsc/src/flow/nodes/split_by_webhook.js +18 -0
- package/out-tsc/src/flow/nodes/split_by_webhook.js.map +1 -0
- package/out-tsc/src/flow/nodes/wait_for_audio.js +7 -0
- package/out-tsc/src/flow/nodes/wait_for_audio.js.map +1 -0
- package/out-tsc/src/flow/nodes/wait_for_digits.js +7 -0
- package/out-tsc/src/flow/nodes/wait_for_digits.js.map +1 -0
- package/out-tsc/src/flow/nodes/wait_for_image.js +7 -0
- package/out-tsc/src/flow/nodes/wait_for_image.js.map +1 -0
- package/out-tsc/src/flow/nodes/wait_for_location.js +7 -0
- package/out-tsc/src/flow/nodes/wait_for_location.js.map +1 -0
- package/out-tsc/src/flow/nodes/wait_for_menu.js +7 -0
- package/out-tsc/src/flow/nodes/wait_for_menu.js.map +1 -0
- package/out-tsc/src/flow/nodes/wait_for_response.js +7 -0
- package/out-tsc/src/flow/nodes/wait_for_response.js.map +1 -0
- package/out-tsc/src/flow/nodes/wait_for_video.js +7 -0
- package/out-tsc/src/flow/nodes/wait_for_video.js.map +1 -0
- package/out-tsc/src/flow/types.js +79 -0
- package/out-tsc/src/flow/types.js.map +1 -0
- package/out-tsc/src/flow/utils.js +65 -0
- package/out-tsc/src/flow/utils.js.map +1 -0
- package/out-tsc/src/form/ArrayEditor.js +199 -0
- package/out-tsc/src/form/ArrayEditor.js.map +1 -0
- package/out-tsc/src/form/BaseListEditor.js +128 -0
- package/out-tsc/src/form/BaseListEditor.js.map +1 -0
- package/out-tsc/src/{checkbox → form}/Checkbox.js +19 -4
- package/out-tsc/src/form/Checkbox.js.map +1 -0
- package/out-tsc/src/{colorpicker → form}/ColorPicker.js +1 -1
- package/out-tsc/src/form/ColorPicker.js.map +1 -0
- package/out-tsc/src/{completion → form}/Completion.js +8 -2
- package/out-tsc/src/form/Completion.js.map +1 -0
- package/out-tsc/src/{compose → form}/Compose.js +1 -1
- package/out-tsc/src/form/Compose.js.map +1 -0
- package/out-tsc/src/{contactsearch → form}/ContactSearch.js +2 -2
- package/out-tsc/src/form/ContactSearch.js.map +1 -0
- package/out-tsc/src/form/CroppieCSS.js.map +1 -0
- package/out-tsc/src/{datepicker → form}/DatePicker.js +1 -1
- package/out-tsc/src/form/DatePicker.js.map +1 -0
- package/out-tsc/src/{FormElement.js → form/FormElement.js} +1 -1
- package/out-tsc/src/form/FormElement.js.map +1 -0
- package/out-tsc/src/form/FormField.js +243 -0
- package/out-tsc/src/form/FormField.js.map +1 -0
- package/out-tsc/src/{imagepicker → form}/ImagePicker.js +2 -2
- package/out-tsc/src/form/ImagePicker.js.map +1 -0
- package/out-tsc/src/form/KeyValueEditor.js +223 -0
- package/out-tsc/src/form/KeyValueEditor.js.map +1 -0
- package/out-tsc/src/{mediapicker → form}/MediaPicker.js +1 -1
- package/out-tsc/src/form/MediaPicker.js.map +1 -0
- package/out-tsc/src/form/RangePicker.js.map +1 -0
- package/out-tsc/src/{slider → form}/TembaSlider.js +1 -1
- package/out-tsc/src/form/TembaSlider.js.map +1 -0
- package/out-tsc/src/{templates → form}/TemplateEditor.js +1 -1
- package/out-tsc/src/form/TemplateEditor.js.map +1 -0
- package/out-tsc/src/{textinput → form}/TextInput.js +3 -3
- package/out-tsc/src/form/TextInput.js.map +1 -0
- package/out-tsc/src/{omnibox → form/select}/Omnibox.js +2 -2
- package/out-tsc/src/form/select/Omnibox.js.map +1 -0
- package/out-tsc/src/{select → form/select}/PopupSelect.js +1 -1
- package/out-tsc/src/form/select/PopupSelect.js.map +1 -0
- package/out-tsc/src/{select → form/select}/Select.js +157 -113
- package/out-tsc/src/form/select/Select.js.map +1 -0
- package/out-tsc/src/{select → form/select}/UserSelect.js +1 -1
- package/out-tsc/src/form/select/UserSelect.js.map +1 -0
- package/out-tsc/src/{select → form/select}/WorkspaceSelect.js +1 -1
- package/out-tsc/src/form/select/WorkspaceSelect.js.map +1 -0
- package/out-tsc/src/interfaces.js +7 -0
- package/out-tsc/src/interfaces.js.map +1 -1
- package/out-tsc/src/layout/Dialog.js.map +1 -0
- package/out-tsc/src/layout/Mask.js.map +1 -0
- package/out-tsc/src/{dialog → layout}/Modax.js.map +1 -1
- package/out-tsc/src/layout/Resizer.js.map +1 -0
- package/out-tsc/src/layout/Tab.js.map +1 -0
- package/out-tsc/src/layout/TabPane.js.map +1 -0
- package/out-tsc/src/list/NotificationList.js +1 -1
- package/out-tsc/src/list/NotificationList.js.map +1 -1
- package/out-tsc/src/list/RunList.js +1 -1
- package/out-tsc/src/list/RunList.js.map +1 -1
- package/out-tsc/src/list/ShortcutList.js.map +1 -1
- package/out-tsc/src/list/TembaMenu.js +1 -1
- package/out-tsc/src/list/TembaMenu.js.map +1 -1
- package/out-tsc/src/list/TicketList.js +1 -1
- package/out-tsc/src/list/TicketList.js.map +1 -1
- package/out-tsc/src/{aliaseditor → live}/AliasEditor.js +1 -1
- package/out-tsc/src/live/AliasEditor.js.map +1 -0
- package/out-tsc/src/{contacts → live}/ContactBadges.js +1 -1
- package/out-tsc/src/live/ContactBadges.js.map +1 -0
- package/out-tsc/src/{contacts → live}/ContactChat.js +80 -78
- package/out-tsc/src/live/ContactChat.js.map +1 -0
- package/out-tsc/src/{contacts → live}/ContactDetails.js +1 -1
- package/out-tsc/src/live/ContactDetails.js.map +1 -0
- package/out-tsc/src/{contacts → live}/ContactFieldEditor.js +2 -2
- package/out-tsc/src/live/ContactFieldEditor.js.map +1 -0
- package/out-tsc/src/live/ContactFields.js.map +1 -0
- package/out-tsc/src/live/ContactNameFetch.js.map +1 -0
- package/out-tsc/src/{contacts → live}/ContactNotepad.js +1 -1
- package/out-tsc/src/{contacts → live}/ContactNotepad.js.map +1 -1
- package/out-tsc/src/{contacts → live}/ContactPending.js +1 -1
- package/out-tsc/src/live/ContactPending.js.map +1 -0
- package/out-tsc/src/live/ContactStoreElement.js.map +1 -0
- package/out-tsc/src/live/FieldManager.js.map +1 -0
- package/out-tsc/src/live/StartProgress.js.map +1 -0
- package/out-tsc/src/live/TembaChart.js.map +1 -0
- package/out-tsc/src/store/AppState.js +54 -24
- package/out-tsc/src/store/AppState.js.map +1 -1
- package/out-tsc/src/store/Store.js +1 -1
- package/out-tsc/src/store/Store.js.map +1 -1
- package/out-tsc/src/{utils/index.js → utils.js} +22 -1
- package/out-tsc/src/utils.js.map +1 -0
- package/out-tsc/src/webchat/WebChat.js +1 -1
- package/out-tsc/src/webchat/WebChat.js.map +1 -1
- package/out-tsc/temba-components.js +2 -2
- package/out-tsc/temba-components.js.map +1 -1
- package/out-tsc/temba-modules.js +63 -56
- package/out-tsc/temba-modules.js.map +1 -1
- package/out-tsc/temba-webchat.js +2 -2
- package/out-tsc/temba-webchat.js.map +1 -1
- package/out-tsc/test/ActionHelper.js +116 -0
- package/out-tsc/test/ActionHelper.js.map +1 -0
- package/out-tsc/test/actions/add_contact_groups.test.js +66 -0
- package/out-tsc/test/actions/add_contact_groups.test.js.map +1 -0
- package/out-tsc/test/actions/remove_contact_groups.test.js +226 -0
- package/out-tsc/test/actions/remove_contact_groups.test.js.map +1 -0
- package/out-tsc/test/actions/send_email.test.js +160 -0
- package/out-tsc/test/actions/send_email.test.js.map +1 -0
- package/out-tsc/test/actions/send_msg.test.js +95 -0
- package/out-tsc/test/actions/send_msg.test.js.map +1 -0
- package/out-tsc/test/temba-action-editing-integration.test.js +183 -0
- package/out-tsc/test/temba-action-editing-integration.test.js.map +1 -0
- package/out-tsc/test/temba-alert.test.js +1 -1
- package/out-tsc/test/temba-alert.test.js.map +1 -1
- package/out-tsc/test/temba-appstate-language.test.js +90 -0
- package/out-tsc/test/temba-appstate-language.test.js.map +1 -1
- package/out-tsc/test/temba-charcount.test.js.map +1 -1
- package/out-tsc/test/temba-chart.test.js +1 -1
- package/out-tsc/test/temba-chart.test.js.map +1 -1
- package/out-tsc/test/temba-checkbox.test.js +1 -1
- package/out-tsc/test/temba-checkbox.test.js.map +1 -1
- package/out-tsc/test/temba-color-picker.test.js +1 -1
- package/out-tsc/test/temba-color-picker.test.js.map +1 -1
- package/out-tsc/test/temba-completion.test.js +1 -1
- package/out-tsc/test/temba-completion.test.js.map +1 -1
- package/out-tsc/test/temba-compose.test.js +1 -1
- package/out-tsc/test/temba-compose.test.js.map +1 -1
- package/out-tsc/test/temba-contact-badges.test.js +1 -1
- package/out-tsc/test/temba-contact-badges.test.js.map +1 -1
- package/out-tsc/test/temba-contact-chat.test.js +3 -1
- package/out-tsc/test/temba-contact-chat.test.js.map +1 -1
- package/out-tsc/test/temba-contact-details.test.js +1 -1
- package/out-tsc/test/temba-contact-details.test.js.map +1 -1
- package/out-tsc/test/temba-contact-fields.test.js +1 -1
- package/out-tsc/test/temba-contact-fields.test.js.map +1 -1
- package/out-tsc/test/temba-contact-search.test.js +1 -1
- package/out-tsc/test/temba-contact-search.test.js.map +1 -1
- package/out-tsc/test/temba-date.test.js +5 -1
- package/out-tsc/test/temba-date.test.js.map +1 -1
- package/out-tsc/test/temba-datepicker.test.js +1 -1
- package/out-tsc/test/temba-datepicker.test.js.map +1 -1
- package/out-tsc/test/temba-dialog.test.js +1 -1
- package/out-tsc/test/temba-dialog.test.js.map +1 -1
- package/out-tsc/test/temba-dropdown.test.js +1 -1
- package/out-tsc/test/temba-dropdown.test.js.map +1 -1
- package/out-tsc/test/temba-excellent-helpers.test.js +316 -0
- package/out-tsc/test/temba-excellent-helpers.test.js.map +1 -0
- package/out-tsc/test/temba-field-config.test.js +133 -0
- package/out-tsc/test/temba-field-config.test.js.map +1 -0
- package/out-tsc/test/temba-field-manager.test.js.map +1 -1
- package/out-tsc/test/temba-flow-editor-node.test.js +426 -13
- package/out-tsc/test/temba-flow-editor-node.test.js.map +1 -1
- package/out-tsc/test/temba-flow-editor.test.js +185 -0
- package/out-tsc/test/temba-flow-editor.test.js.map +1 -1
- package/out-tsc/test/temba-flow-plumber-connections.test.js +113 -0
- package/out-tsc/test/temba-flow-plumber-connections.test.js.map +1 -0
- package/out-tsc/test/temba-flow-plumber.test.js +73 -93
- package/out-tsc/test/temba-flow-plumber.test.js.map +1 -1
- package/out-tsc/test/temba-flow-self-routing.test.js +172 -0
- package/out-tsc/test/temba-flow-self-routing.test.js.map +1 -0
- package/out-tsc/test/temba-formfield.test.js.map +1 -1
- package/out-tsc/test/temba-icon.test.js +1 -1
- package/out-tsc/test/temba-icon.test.js.map +1 -1
- package/out-tsc/test/temba-integration-markdown.test.js.map +1 -1
- package/out-tsc/test/temba-label.test.js +1 -1
- package/out-tsc/test/temba-label.test.js.map +1 -1
- package/out-tsc/test/temba-lightbox.test.js +1 -1
- package/out-tsc/test/temba-lightbox.test.js.map +1 -1
- package/out-tsc/test/temba-markdown.test.js +127 -0
- package/out-tsc/test/temba-markdown.test.js.map +1 -0
- package/out-tsc/test/temba-menu.test.js +1 -1
- package/out-tsc/test/temba-menu.test.js.map +1 -1
- package/out-tsc/test/temba-modax.test.js +1 -1
- package/out-tsc/test/temba-modax.test.js.map +1 -1
- package/out-tsc/test/temba-modules.test.js +47 -0
- package/out-tsc/test/temba-modules.test.js.map +1 -0
- package/out-tsc/test/temba-node-editor.test.js +283 -0
- package/out-tsc/test/temba-node-editor.test.js.map +1 -0
- package/out-tsc/test/temba-omnibox.test.js +1 -1
- package/out-tsc/test/temba-omnibox.test.js.map +1 -1
- package/out-tsc/test/temba-options.test.js.map +1 -1
- package/out-tsc/test/temba-range-picker.test.js +9 -2
- package/out-tsc/test/temba-range-picker.test.js.map +1 -1
- package/out-tsc/test/temba-rapid-element.test.js +273 -0
- package/out-tsc/test/temba-rapid-element.test.js.map +1 -0
- package/out-tsc/test/temba-resize-element.test.js +85 -0
- package/out-tsc/test/temba-resize-element.test.js.map +1 -0
- package/out-tsc/test/temba-select.test.js +87 -2
- package/out-tsc/test/temba-select.test.js.map +1 -1
- package/out-tsc/test/temba-slider.test.js.map +1 -1
- package/out-tsc/test/temba-sticky-note.test.js +194 -0
- package/out-tsc/test/temba-sticky-note.test.js.map +1 -0
- package/out-tsc/test/temba-template-editor.test.js.map +1 -1
- package/out-tsc/test/temba-textinput.test.js +1 -1
- package/out-tsc/test/temba-textinput.test.js.map +1 -1
- package/out-tsc/test/temba-tip.test.js +1 -1
- package/out-tsc/test/temba-tip.test.js.map +1 -1
- package/out-tsc/test/temba-toast.test.js +1 -1
- package/out-tsc/test/temba-toast.test.js.map +1 -1
- package/out-tsc/test/temba-utils-index.test.js +1 -1
- package/out-tsc/test/temba-utils-index.test.js.map +1 -1
- package/out-tsc/test/temba-utils-uuid.test.js +38 -0
- package/out-tsc/test/temba-utils-uuid.test.js.map +1 -0
- package/out-tsc/test/temba-webchat.test.js +28 -12
- package/out-tsc/test/temba-webchat.test.js.map +1 -1
- package/out-tsc/test/utils.test.js +2 -6
- package/out-tsc/test/utils.test.js.map +1 -1
- package/package.json +18 -9
- package/rollup.components.mjs +1 -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/remove_contact_groups/editor/cleanup-groups.png +0 -0
- package/screenshots/truth/actions/remove_contact_groups/editor/long-descriptive-group-names.png +0 -0
- package/screenshots/truth/actions/remove_contact_groups/editor/many-groups.png +0 -0
- package/screenshots/truth/actions/remove_contact_groups/editor/multiple-groups.png +0 -0
- package/screenshots/truth/actions/remove_contact_groups/editor/remove-from-all-groups.png +0 -0
- package/screenshots/truth/actions/remove_contact_groups/editor/single-group.png +0 -0
- package/screenshots/truth/actions/remove_contact_groups/render/cleanup-groups.png +0 -0
- package/screenshots/truth/actions/remove_contact_groups/render/long-descriptive-group-names.png +0 -0
- package/screenshots/truth/actions/remove_contact_groups/render/many-groups.png +0 -0
- package/screenshots/truth/actions/remove_contact_groups/render/multiple-groups.png +0 -0
- package/screenshots/truth/actions/remove_contact_groups/render/remove-from-all-groups.png +0 -0
- package/screenshots/truth/actions/remove_contact_groups/render/single-group.png +0 -0
- package/screenshots/truth/actions/send_email/editor/complex-business-email.png +0 -0
- package/screenshots/truth/actions/send_email/editor/empty-body.png +0 -0
- package/screenshots/truth/actions/send_email/editor/empty-subject.png +0 -0
- package/screenshots/truth/actions/send_email/editor/long-subject.png +0 -0
- package/screenshots/truth/actions/send_email/editor/multiline-body.png +0 -0
- package/screenshots/truth/actions/send_email/editor/multiple-recipients.png +0 -0
- package/screenshots/truth/actions/send_email/editor/simple-email.png +0 -0
- package/screenshots/truth/actions/send_email/editor/with-expressions.png +0 -0
- package/screenshots/truth/actions/send_email/render/complex-business-email.png +0 -0
- package/screenshots/truth/actions/send_email/render/empty-body.png +0 -0
- package/screenshots/truth/actions/send_email/render/empty-subject.png +0 -0
- package/screenshots/truth/actions/send_email/render/long-subject.png +0 -0
- package/screenshots/truth/actions/send_email/render/multiline-body.png +0 -0
- package/screenshots/truth/actions/send_email/render/multiple-recipients.png +0 -0
- package/screenshots/truth/actions/send_email/render/simple-email.png +0 -0
- package/screenshots/truth/actions/send_email/render/with-expressions.png +0 -0
- package/screenshots/truth/actions/send_msg/editor/long-quick-replies.png +0 -0
- package/screenshots/truth/actions/send_msg/editor/multiline-text-with-replies.png +0 -0
- package/screenshots/truth/actions/send_msg/editor/simple-text.png +0 -0
- package/screenshots/truth/actions/send_msg/editor/text-with-linebreaks.png +0 -0
- package/screenshots/truth/actions/send_msg/editor/text-with-many-quick-replies.png +0 -0
- package/screenshots/truth/actions/send_msg/editor/text-with-quick-replies.png +0 -0
- package/screenshots/truth/actions/send_msg/editor/text-without-quick-replies.png +0 -0
- package/screenshots/truth/actions/send_msg/render/long-quick-replies.png +0 -0
- package/screenshots/truth/actions/send_msg/render/multiline-text-with-replies.png +0 -0
- package/screenshots/truth/actions/send_msg/render/simple-text.png +0 -0
- package/screenshots/truth/actions/send_msg/render/text-with-linebreaks.png +0 -0
- package/screenshots/truth/actions/send_msg/render/text-with-many-quick-replies.png +0 -0
- package/screenshots/truth/actions/send_msg/render/text-with-quick-replies.png +0 -0
- package/screenshots/truth/actions/send_msg/render/text-without-quick-replies.png +0 -0
- package/screenshots/truth/datepicker/range-picker-all.png +0 -0
- package/screenshots/truth/datepicker/range-picker-button-states.png +0 -0
- package/screenshots/truth/datepicker/range-picker-default.png +0 -0
- package/screenshots/truth/datepicker/range-picker-editing-start.png +0 -0
- package/screenshots/truth/datepicker/range-picker-initial-values.png +0 -0
- package/screenshots/truth/datepicker/range-picker-week.png +0 -0
- package/screenshots/truth/datepicker/range-picker-year.png +0 -0
- package/screenshots/truth/editor/router.png +0 -0
- package/screenshots/truth/editor/send_msg.png +0 -0
- package/screenshots/truth/editor/set_contact_language.png +0 -0
- package/screenshots/truth/editor/set_contact_name.png +0 -0
- package/screenshots/truth/editor/set_run_result.png +0 -0
- package/screenshots/truth/editor/wait.png +0 -0
- package/screenshots/truth/formfield/markdown-errors.png +0 -0
- package/screenshots/truth/formfield/plain-text-errors.png +0 -0
- package/screenshots/truth/formfield/widget-only-markdown-errors.png +0 -0
- package/screenshots/truth/integration/checkbox-markdown-errors.png +0 -0
- package/screenshots/truth/sticky-note/blue-color.png +0 -0
- package/screenshots/truth/sticky-note/blue.png +0 -0
- package/screenshots/truth/sticky-note/color-picker-expanded.png +0 -0
- package/screenshots/truth/sticky-note/default.png +0 -0
- package/screenshots/truth/sticky-note/gray-color.png +0 -0
- package/screenshots/truth/sticky-note/gray.png +0 -0
- package/screenshots/truth/sticky-note/green-color.png +0 -0
- package/screenshots/truth/sticky-note/green.png +0 -0
- package/screenshots/truth/sticky-note/pink-color.png +0 -0
- package/screenshots/truth/sticky-note/pink.png +0 -0
- package/screenshots/truth/sticky-note/yellow-color.png +0 -0
- package/screenshots/truth/sticky-note/yellow.png +0 -0
- package/src/{charcount → display}/CharCount.ts +164 -2
- package/src/{vectoricon/VectorIcon.ts → display/Icon.ts} +1 -1
- package/src/{leafletmap → display}/LeafletMap.ts +19 -1
- package/src/{thumbnail → display}/Thumbnail.ts +1 -1
- package/src/{tip → display}/Tip.ts +1 -2
- package/src/events.ts +108 -0
- package/src/flow/CanvasNode.ts +1009 -0
- package/src/flow/Editor.ts +795 -169
- package/src/flow/NodeEditor.ts +1443 -0
- package/src/flow/Plumber.ts +177 -79
- package/src/flow/StickyNote.ts +165 -9
- package/src/flow/actions/add_contact_groups.ts +42 -0
- package/src/flow/actions/add_contact_urn.ts +17 -0
- package/src/flow/actions/add_input_labels.ts +12 -0
- package/src/flow/actions/call_classifier.ts +12 -0
- package/src/flow/actions/call_llm.ts +12 -0
- package/src/flow/actions/call_resthook.ts +12 -0
- package/src/flow/actions/call_webhook.ts +133 -0
- package/src/flow/actions/enter_flow.ts +15 -0
- package/src/flow/actions/open_ticket.ts +12 -0
- package/src/flow/actions/play_audio.ts +12 -0
- package/src/flow/actions/remove_contact_groups.ts +66 -0
- package/src/flow/actions/request_optin.ts +12 -0
- package/src/flow/actions/say_msg.ts +12 -0
- package/src/flow/actions/send_broadcast.ts +35 -0
- package/src/flow/actions/send_email.ts +60 -0
- package/src/flow/actions/send_msg.ts +58 -0
- package/src/flow/actions/set_contact_channel.ts +13 -0
- package/src/flow/actions/set_contact_field.ts +13 -0
- package/src/flow/actions/set_contact_language.ts +11 -0
- package/src/flow/actions/set_contact_name.ts +11 -0
- package/src/flow/actions/set_contact_status.ts +11 -0
- package/src/flow/actions/set_run_result.ts +11 -0
- package/src/flow/actions/split_by_expression_example.ts +88 -0
- package/src/flow/actions/start_session.ts +12 -0
- package/src/flow/actions/transfer_airtime.ts +12 -0
- package/src/flow/config.ts +93 -136
- package/src/flow/nodes/execute_actions.ts +5 -0
- package/src/flow/nodes/split_by_airtime.ts +9 -0
- package/src/flow/nodes/split_by_contact_field.ts +7 -0
- package/src/flow/nodes/split_by_expression.ts +7 -0
- package/src/flow/nodes/split_by_groups.ts +7 -0
- package/src/flow/nodes/split_by_random.ts +10 -0
- package/src/flow/nodes/split_by_run_result.ts +7 -0
- package/src/flow/nodes/split_by_scheme.ts +7 -0
- package/src/flow/nodes/split_by_subflow.ts +9 -0
- package/src/flow/nodes/split_by_webhook.ts +19 -0
- package/src/flow/nodes/wait_for_audio.ts +7 -0
- package/src/flow/nodes/wait_for_digits.ts +7 -0
- package/src/flow/nodes/wait_for_image.ts +7 -0
- package/src/flow/nodes/wait_for_location.ts +7 -0
- package/src/flow/nodes/wait_for_menu.ts +7 -0
- package/src/flow/nodes/wait_for_response.ts +7 -0
- package/src/flow/nodes/wait_for_video.ts +7 -0
- package/src/flow/types.ts +352 -0
- package/src/flow/utils.ts +76 -0
- package/src/form/ArrayEditor.ts +240 -0
- package/src/form/BaseListEditor.ts +177 -0
- package/src/{checkbox → form}/Checkbox.ts +24 -5
- package/src/{colorpicker → form}/ColorPicker.ts +2 -2
- package/src/{completion → form}/Completion.ts +9 -3
- package/src/{compose → form}/Compose.ts +7 -7
- package/src/{contactsearch → form}/ContactSearch.ts +6 -6
- package/src/{datepicker → form}/DatePicker.ts +1 -1
- package/src/{FormElement.ts → form/FormElement.ts} +1 -1
- package/src/form/FormField.ts +238 -0
- package/src/{imagepicker → form}/ImagePicker.ts +2 -2
- package/src/form/KeyValueEditor.ts +251 -0
- package/src/{mediapicker → form}/MediaPicker.ts +1 -1
- package/src/{slider → form}/TembaSlider.ts +1 -1
- package/src/{templates → form}/TemplateEditor.ts +2 -2
- package/src/{textinput → form}/TextInput.ts +5 -5
- package/src/{omnibox → form/select}/Omnibox.ts +2 -2
- package/src/{select → form/select}/PopupSelect.ts +1 -1
- package/src/{select → form/select}/Select.ts +207 -152
- package/src/{select → form/select}/UserSelect.ts +1 -1
- package/src/{select → form/select}/WorkspaceSelect.ts +1 -1
- package/src/interfaces.ts +8 -2
- package/src/{dialog → layout}/Dialog.ts +1 -1
- package/src/list/NotificationList.ts +2 -2
- package/src/list/RunList.ts +3 -3
- package/src/list/ShortcutList.ts +1 -1
- package/src/list/TembaMenu.ts +2 -2
- package/src/list/TicketList.ts +1 -1
- package/src/{aliaseditor → live}/AliasEditor.ts +3 -3
- package/src/{contacts → live}/ContactBadges.ts +1 -1
- package/src/{contacts → live}/ContactChat.ts +120 -104
- package/src/{contacts → live}/ContactDetails.ts +1 -1
- package/src/{contacts → live}/ContactFieldEditor.ts +4 -4
- package/src/{contacts → live}/ContactFields.ts +1 -1
- package/src/{contacts → live}/ContactNotepad.ts +1 -1
- package/src/{contacts → live}/ContactPending.ts +1 -1
- package/src/{chart → live}/TembaChart.ts +1 -1
- package/src/store/AppState.ts +75 -29
- package/src/store/Store.ts +1 -1
- package/src/store/flow-definition.d.ts +131 -1
- package/src/{utils/index.ts → utils.ts} +26 -10
- package/src/webchat/WebChat.ts +1 -1
- package/static/api/contacts.json +30 -0
- package/static/api/groups.json +4 -426
- package/static/api/locations.json +24 -0
- package/static/api/media.json +5 -0
- package/static/api/optins.json +16 -0
- package/static/api/orgs.json +13 -0
- package/static/api/topics.json +21 -0
- package/static/api/users.json +26 -0
- package/static/css/temba-components.css +4 -6
- package/svg.js +1 -4
- package/temba-components.ts +2 -2
- package/temba-modules.ts +63 -56
- package/temba-webchat.ts +2 -2
- package/test/ActionHelper.ts +142 -0
- package/test/actions/add_contact_groups.test.ts +89 -0
- package/test/actions/remove_contact_groups.test.ts +265 -0
- package/test/actions/send_email.test.ts +214 -0
- package/test/actions/send_msg.test.ts +130 -0
- package/test/temba-action-editing-integration.test.ts +240 -0
- package/test/temba-alert.test.ts +1 -1
- package/test/temba-appstate-language.test.ts +108 -0
- package/test/temba-charcount.test.ts +1 -1
- package/test/temba-chart.test.ts +1 -1
- package/test/temba-checkbox.test.ts +2 -2
- package/test/temba-color-picker.test.ts +1 -1
- package/test/temba-completion.test.ts +1 -1
- package/test/temba-compose.test.ts +1 -1
- package/test/temba-contact-badges.test.ts +1 -1
- package/test/temba-contact-chat.test.ts +6 -4
- package/test/temba-contact-details.test.ts +1 -1
- package/test/temba-contact-fields.test.ts +1 -1
- package/test/temba-contact-search.test.ts +2 -2
- package/test/temba-date.test.ts +8 -3
- package/test/temba-datepicker.test.ts +1 -1
- package/test/temba-dialog.test.ts +1 -1
- package/test/temba-dropdown.test.ts +1 -1
- package/test/temba-excellent-helpers.test.ts +417 -0
- package/test/temba-field-config.test.ts +152 -0
- package/test/temba-field-manager.test.ts +2 -2
- package/test/temba-flow-editor-node.test.ts +551 -16
- package/test/temba-flow-editor.test.ts +224 -0
- package/test/temba-flow-editor.test.ts.backup +563 -0
- package/test/temba-flow-plumber-connections.test.ts +142 -0
- package/test/temba-flow-plumber.test.ts +83 -120
- package/test/temba-flow-self-routing.test.ts +215 -0
- package/test/temba-formfield.test.ts +1 -1
- package/test/temba-icon.test.ts +1 -1
- package/test/temba-integration-markdown.test.ts +1 -1
- package/test/temba-label.test.ts +1 -1
- package/test/temba-lightbox.test.ts +1 -1
- package/test/temba-markdown.test.ts +162 -0
- package/test/temba-menu.test.ts +1 -1
- package/test/temba-modax.test.ts +2 -2
- package/test/temba-modules.test.ts +56 -0
- package/test/temba-node-editor.test.ts +353 -0
- package/test/temba-omnibox.test.ts +1 -1
- package/test/temba-options.test.ts +1 -1
- package/test/temba-range-picker.test.ts +17 -2
- package/test/temba-rapid-element.test.ts +341 -0
- package/test/temba-resize-element.test.ts +104 -0
- package/test/temba-select.test.ts +129 -2
- package/test/temba-slider.test.ts +1 -1
- package/test/temba-sticky-note.test.ts +281 -0
- package/test/temba-template-editor.test.ts +1 -1
- package/test/temba-textinput.test.ts +1 -1
- package/test/temba-tip.test.ts +1 -1
- package/test/temba-toast.test.ts +1 -1
- package/test/temba-utils-index.test.ts +1 -1
- package/test/temba-utils-index.test.ts.backup +1737 -0
- package/test/temba-utils-uuid.test.ts +48 -0
- package/test/temba-webchat.test.ts +30 -12
- package/test/utils.test.ts +5 -9
- package/test-assets/contacts/history.json +11 -33
- package/web-dev-server.config.mjs +35 -1
- package/demo/sticky-note-demo.html +0 -155
- package/out-tsc/src/FormElement.js.map +0 -1
- package/out-tsc/src/alert/Alert.js.map +0 -1
- package/out-tsc/src/aliaseditor/AliasEditor.js.map +0 -1
- package/out-tsc/src/anchor/Anchor.js.map +0 -1
- package/out-tsc/src/button/Button.js.map +0 -1
- package/out-tsc/src/charcount/CharCount.js.map +0 -1
- package/out-tsc/src/charcount/helpers.js +0 -159
- package/out-tsc/src/charcount/helpers.js.map +0 -1
- package/out-tsc/src/chart/TembaChart.js.map +0 -1
- package/out-tsc/src/chat/Chat.js.map +0 -1
- package/out-tsc/src/checkbox/Checkbox.js.map +0 -1
- package/out-tsc/src/colorpicker/ColorPicker.js.map +0 -1
- package/out-tsc/src/completion/Completion.js.map +0 -1
- package/out-tsc/src/completion/ExcellentParser.js.map +0 -1
- package/out-tsc/src/completion/helpers.js.map +0 -1
- package/out-tsc/src/compose/Compose.js.map +0 -1
- package/out-tsc/src/contacts/ContactBadges.js.map +0 -1
- package/out-tsc/src/contacts/ContactChat.js.map +0 -1
- package/out-tsc/src/contacts/ContactDetails.js.map +0 -1
- package/out-tsc/src/contacts/ContactFieldEditor.js.map +0 -1
- package/out-tsc/src/contacts/ContactFields.js.map +0 -1
- package/out-tsc/src/contacts/ContactName.js.map +0 -1
- package/out-tsc/src/contacts/ContactNameFetch.js.map +0 -1
- package/out-tsc/src/contacts/ContactPending.js.map +0 -1
- package/out-tsc/src/contacts/ContactStoreElement.js.map +0 -1
- package/out-tsc/src/contacts/ContactUrn.js.map +0 -1
- package/out-tsc/src/contacts/events.js +0 -65
- package/out-tsc/src/contacts/events.js.map +0 -1
- package/out-tsc/src/contacts/helpers.js +0 -77
- package/out-tsc/src/contacts/helpers.js.map +0 -1
- package/out-tsc/src/contactsearch/ContactSearch.js.map +0 -1
- package/out-tsc/src/date/TembaDate.js.map +0 -1
- package/out-tsc/src/datepicker/DatePicker.js.map +0 -1
- package/out-tsc/src/datepicker/RangePicker.js.map +0 -1
- package/out-tsc/src/dialog/Dialog.js.map +0 -1
- package/out-tsc/src/dropdown/Dropdown.js.map +0 -1
- package/out-tsc/src/fields/FieldManager.js.map +0 -1
- package/out-tsc/src/flow/EditorNode.js +0 -291
- package/out-tsc/src/flow/EditorNode.js.map +0 -1
- package/out-tsc/src/flow/render.js +0 -41
- package/out-tsc/src/flow/render.js.map +0 -1
- package/out-tsc/src/formfield/FormField.js +0 -144
- package/out-tsc/src/formfield/FormField.js.map +0 -1
- package/out-tsc/src/imagepicker/CroppieCSS.js.map +0 -1
- package/out-tsc/src/imagepicker/ImagePicker.js.map +0 -1
- package/out-tsc/src/label/Label.js.map +0 -1
- package/out-tsc/src/leafletmap/LeafletMap.js.map +0 -1
- package/out-tsc/src/leafletmap/helpers.js +0 -17
- package/out-tsc/src/leafletmap/helpers.js.map +0 -1
- package/out-tsc/src/lightbox/Lightbox.js.map +0 -1
- package/out-tsc/src/mask/Mask.js.map +0 -1
- package/out-tsc/src/mediapicker/MediaPicker.js.map +0 -1
- package/out-tsc/src/omnibox/Omnibox.js.map +0 -1
- package/out-tsc/src/options/helpers.js +0 -28
- package/out-tsc/src/options/helpers.js.map +0 -1
- package/out-tsc/src/progress/ProgressBar.js.map +0 -1
- package/out-tsc/src/progress/StartProgress.js.map +0 -1
- package/out-tsc/src/resizer/Resizer.js.map +0 -1
- package/out-tsc/src/select/PopupSelect.js.map +0 -1
- package/out-tsc/src/select/Select.js.map +0 -1
- package/out-tsc/src/select/UserSelect.js.map +0 -1
- package/out-tsc/src/select/WorkspaceSelect.js.map +0 -1
- package/out-tsc/src/select/helpers.js +0 -1
- package/out-tsc/src/select/helpers.js.map +0 -1
- package/out-tsc/src/shadowless/Shadowless.js +0 -33
- package/out-tsc/src/shadowless/Shadowless.js.map +0 -1
- package/out-tsc/src/slider/TembaSlider.js.map +0 -1
- package/out-tsc/src/sms/gsmsplitter.js.map +0 -1
- package/out-tsc/src/sms/gsmvalidator.js.map +0 -1
- package/out-tsc/src/sms/index.js.map +0 -1
- package/out-tsc/src/sms/unicodesplitter.js.map +0 -1
- package/out-tsc/src/tabpane/Tab.js.map +0 -1
- package/out-tsc/src/tabpane/TabPane.js.map +0 -1
- package/out-tsc/src/templates/TemplateEditor.js.map +0 -1
- package/out-tsc/src/textinput/TextInput.js.map +0 -1
- package/out-tsc/src/textinput/helpers.js +0 -12
- package/out-tsc/src/textinput/helpers.js.map +0 -1
- package/out-tsc/src/thumbnail/Thumbnail.js.map +0 -1
- package/out-tsc/src/tip/Tip.js.map +0 -1
- package/out-tsc/src/tip/helpers.js +0 -7
- package/out-tsc/src/tip/helpers.js.map +0 -1
- package/out-tsc/src/toast/Toast.js.map +0 -1
- package/out-tsc/src/user/TembaUser.js.map +0 -1
- package/out-tsc/src/utils/index.js.map +0 -1
- package/out-tsc/src/vectoricon/VectorIcon.js.map +0 -1
- package/out-tsc/src/vectoricon/index.js.map +0 -1
- package/out-tsc/test/temba-flow-render.test.js +0 -171
- package/out-tsc/test/temba-flow-render.test.js.map +0 -1
- package/src/charcount/helpers.ts +0 -162
- package/src/contacts/events.ts +0 -210
- package/src/contacts/helpers.ts +0 -103
- package/src/flow/EditorNode.ts +0 -318
- package/src/flow/render.ts +0 -56
- package/src/formfield/FormField.ts +0 -134
- package/src/leafletmap/helpers.ts +0 -18
- package/src/options/helpers.ts +0 -37
- package/src/select/helpers.ts +0 -0
- package/src/shadowless/Shadowless.ts +0 -32
- package/src/textinput/helpers.ts +0 -11
- package/src/tip/helpers.ts +0 -7
- package/test/temba-flow-render.test.ts +0 -220
- /package/out-tsc/src/{alert → display}/Alert.js +0 -0
- /package/out-tsc/src/{anchor → display}/Anchor.js +0 -0
- /package/out-tsc/src/{button → display}/Button.js +0 -0
- /package/out-tsc/src/{chat → display}/Chat.js +0 -0
- /package/out-tsc/src/{contacts → display}/ContactName.js +0 -0
- /package/out-tsc/src/{contacts → display}/ContactUrn.js +0 -0
- /package/out-tsc/src/{dropdown → display}/Dropdown.js +0 -0
- /package/out-tsc/src/{label → display}/Label.js +0 -0
- /package/out-tsc/src/{lightbox → display}/Lightbox.js +0 -0
- /package/out-tsc/src/{loading → display}/Loading.js +0 -0
- /package/out-tsc/src/{options → display}/Options.js +0 -0
- /package/out-tsc/src/{progress → display}/ProgressBar.js +0 -0
- /package/out-tsc/src/{date → display}/TembaDate.js +0 -0
- /package/out-tsc/src/{user → display}/TembaUser.js +0 -0
- /package/out-tsc/src/{thumbnail → display}/Thumbnail.js +0 -0
- /package/out-tsc/src/{toast → display}/Toast.js +0 -0
- /package/out-tsc/src/{sms → display/sms}/gsmsplitter.js +0 -0
- /package/out-tsc/src/{sms → display/sms}/gsmvalidator.js +0 -0
- /package/out-tsc/src/{sms → display/sms}/index.js +0 -0
- /package/out-tsc/src/{sms → display/sms}/unicodesplitter.js +0 -0
- /package/out-tsc/src/{completion → excellent}/ExcellentParser.js +0 -0
- /package/out-tsc/src/{completion → excellent}/helpers.js +0 -0
- /package/out-tsc/src/{imagepicker → form}/CroppieCSS.js +0 -0
- /package/out-tsc/src/{datepicker → form}/RangePicker.js +0 -0
- /package/out-tsc/src/{dialog → layout}/Dialog.js +0 -0
- /package/out-tsc/src/{mask → layout}/Mask.js +0 -0
- /package/out-tsc/src/{dialog → layout}/Modax.js +0 -0
- /package/out-tsc/src/{resizer → layout}/Resizer.js +0 -0
- /package/out-tsc/src/{tabpane → layout}/Tab.js +0 -0
- /package/out-tsc/src/{tabpane → layout}/TabPane.js +0 -0
- /package/out-tsc/src/{contacts → live}/ContactFields.js +0 -0
- /package/out-tsc/src/{contacts → live}/ContactNameFetch.js +0 -0
- /package/out-tsc/src/{contacts → live}/ContactStoreElement.js +0 -0
- /package/out-tsc/src/{fields → live}/FieldManager.js +0 -0
- /package/out-tsc/src/{progress → live}/StartProgress.js +0 -0
- /package/out-tsc/src/{chart → live}/TembaChart.js +0 -0
- /package/src/{vectoricon/index.ts → Icons.ts} +0 -0
- /package/src/{alert → display}/Alert.ts +0 -0
- /package/src/{anchor → display}/Anchor.ts +0 -0
- /package/src/{button → display}/Button.ts +0 -0
- /package/src/{chat → display}/Chat.ts +0 -0
- /package/src/{contacts → display}/ContactName.ts +0 -0
- /package/src/{contacts → display}/ContactUrn.ts +0 -0
- /package/src/{dropdown → display}/Dropdown.ts +0 -0
- /package/src/{label → display}/Label.ts +0 -0
- /package/src/{lightbox → display}/Lightbox.ts +0 -0
- /package/src/{loading → display}/Loading.ts +0 -0
- /package/src/{options → display}/Options.ts +0 -0
- /package/src/{progress → display}/ProgressBar.ts +0 -0
- /package/src/{date → display}/TembaDate.ts +0 -0
- /package/src/{user → display}/TembaUser.ts +0 -0
- /package/src/{toast → display}/Toast.ts +0 -0
- /package/src/{sms → display/sms}/gsmsplitter.ts +0 -0
- /package/src/{sms → display/sms}/gsmvalidator.ts +0 -0
- /package/src/{sms → display/sms}/index.ts +0 -0
- /package/src/{sms → display/sms}/unicodesplitter.ts +0 -0
- /package/src/{completion → excellent}/ExcellentParser.ts +0 -0
- /package/src/{completion → excellent}/helpers.ts +0 -0
- /package/src/{imagepicker → form}/CroppieCSS.ts +0 -0
- /package/src/{datepicker → form}/RangePicker.ts +0 -0
- /package/src/{mask → layout}/Mask.ts +0 -0
- /package/src/{dialog → layout}/Modax.ts +0 -0
- /package/src/{resizer → layout}/Resizer.ts +0 -0
- /package/src/{tabpane → layout}/Tab.ts +0 -0
- /package/src/{tabpane → layout}/TabPane.ts +0 -0
- /package/src/{contacts → live}/ContactNameFetch.ts +0 -0
- /package/src/{contacts → live}/ContactStoreElement.ts +0 -0
- /package/src/{fields → live}/FieldManager.ts +0 -0
- /package/src/{progress → live}/StartProgress.ts +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import '../temba-modules';
|
|
2
2
|
import { html, fixture, expect } from '@open-wc/testing';
|
|
3
|
-
import {
|
|
3
|
+
import { CanvasNode } from '../src/flow/CanvasNode';
|
|
4
4
|
import {
|
|
5
5
|
Node,
|
|
6
6
|
NodeUI,
|
|
@@ -8,11 +8,11 @@ import {
|
|
|
8
8
|
Exit,
|
|
9
9
|
Router
|
|
10
10
|
} from '../src/store/flow-definition.d';
|
|
11
|
-
import { stub, restore } from 'sinon';
|
|
11
|
+
import { stub, restore, useFakeTimers } from 'sinon';
|
|
12
12
|
import { CustomEventType } from '../src/interfaces';
|
|
13
13
|
|
|
14
14
|
describe('EditorNode', () => {
|
|
15
|
-
let editorNode:
|
|
15
|
+
let editorNode: CanvasNode;
|
|
16
16
|
let mockPlumber: any;
|
|
17
17
|
|
|
18
18
|
beforeEach(async () => {
|
|
@@ -30,14 +30,14 @@ describe('EditorNode', () => {
|
|
|
30
30
|
|
|
31
31
|
describe('basic functionality', () => {
|
|
32
32
|
it('creates render root as element itself', () => {
|
|
33
|
-
const editorNode = new
|
|
33
|
+
const editorNode = new CanvasNode();
|
|
34
34
|
expect(editorNode.createRenderRoot()).to.equal(editorNode);
|
|
35
35
|
});
|
|
36
36
|
});
|
|
37
37
|
|
|
38
38
|
describe('renderAction', () => {
|
|
39
39
|
beforeEach(() => {
|
|
40
|
-
editorNode = new
|
|
40
|
+
editorNode = new CanvasNode();
|
|
41
41
|
});
|
|
42
42
|
|
|
43
43
|
it('renders action with known config', () => {
|
|
@@ -77,7 +77,7 @@ describe('EditorNode', () => {
|
|
|
77
77
|
|
|
78
78
|
describe('renderRouter', () => {
|
|
79
79
|
beforeEach(() => {
|
|
80
|
-
editorNode = new
|
|
80
|
+
editorNode = new CanvasNode();
|
|
81
81
|
});
|
|
82
82
|
|
|
83
83
|
it('renders router with result name', () => {
|
|
@@ -129,7 +129,7 @@ describe('EditorNode', () => {
|
|
|
129
129
|
|
|
130
130
|
describe('renderCategories', () => {
|
|
131
131
|
beforeEach(() => {
|
|
132
|
-
editorNode = new
|
|
132
|
+
editorNode = new CanvasNode();
|
|
133
133
|
});
|
|
134
134
|
|
|
135
135
|
it('returns null when no router', () => {
|
|
@@ -179,7 +179,7 @@ describe('EditorNode', () => {
|
|
|
179
179
|
|
|
180
180
|
describe('renderExit', () => {
|
|
181
181
|
beforeEach(() => {
|
|
182
|
-
editorNode = new
|
|
182
|
+
editorNode = new CanvasNode();
|
|
183
183
|
});
|
|
184
184
|
|
|
185
185
|
it('renders exit with connected class when destination exists', async () => {
|
|
@@ -214,7 +214,7 @@ describe('EditorNode', () => {
|
|
|
214
214
|
|
|
215
215
|
describe('renderTitle', () => {
|
|
216
216
|
beforeEach(() => {
|
|
217
|
-
editorNode = new
|
|
217
|
+
editorNode = new CanvasNode();
|
|
218
218
|
});
|
|
219
219
|
|
|
220
220
|
it('renders title with config color and name', async () => {
|
|
@@ -235,7 +235,7 @@ describe('EditorNode', () => {
|
|
|
235
235
|
|
|
236
236
|
describe('updated lifecycle', () => {
|
|
237
237
|
it('handles updated without node changes', () => {
|
|
238
|
-
editorNode = new
|
|
238
|
+
editorNode = new CanvasNode();
|
|
239
239
|
(editorNode as any).plumber = mockPlumber;
|
|
240
240
|
|
|
241
241
|
const changes = new Map();
|
|
@@ -250,12 +250,12 @@ describe('EditorNode', () => {
|
|
|
250
250
|
});
|
|
251
251
|
|
|
252
252
|
it('verifies updated method exists', () => {
|
|
253
|
-
editorNode = new
|
|
253
|
+
editorNode = new CanvasNode();
|
|
254
254
|
expect(typeof (editorNode as any).updated).to.equal('function');
|
|
255
255
|
});
|
|
256
256
|
|
|
257
257
|
it('processes node changes and calls plumber methods', () => {
|
|
258
|
-
editorNode = new
|
|
258
|
+
editorNode = new CanvasNode();
|
|
259
259
|
(editorNode as any).plumber = mockPlumber;
|
|
260
260
|
|
|
261
261
|
const mockNode: Node = {
|
|
@@ -321,7 +321,7 @@ describe('EditorNode', () => {
|
|
|
321
321
|
};
|
|
322
322
|
|
|
323
323
|
// Test individual render methods work
|
|
324
|
-
editorNode = new
|
|
324
|
+
editorNode = new CanvasNode();
|
|
325
325
|
|
|
326
326
|
// Test renderAction
|
|
327
327
|
const actionResult = (editorNode as any).renderAction(
|
|
@@ -343,10 +343,10 @@ describe('EditorNode', () => {
|
|
|
343
343
|
});
|
|
344
344
|
|
|
345
345
|
describe('drag and drop functionality', () => {
|
|
346
|
-
let editorNode:
|
|
346
|
+
let editorNode: CanvasNode;
|
|
347
347
|
|
|
348
348
|
beforeEach(() => {
|
|
349
|
-
editorNode = new
|
|
349
|
+
editorNode = new CanvasNode();
|
|
350
350
|
});
|
|
351
351
|
|
|
352
352
|
it('renders actions with sortable class and proper IDs', async () => {
|
|
@@ -414,7 +414,7 @@ describe('EditorNode', () => {
|
|
|
414
414
|
exits: []
|
|
415
415
|
};
|
|
416
416
|
|
|
417
|
-
let editorNode:
|
|
417
|
+
let editorNode: CanvasNode = await fixture(
|
|
418
418
|
html`<temba-flow-node
|
|
419
419
|
.node=${mockNode}
|
|
420
420
|
.ui=${{ position: { left: 0, top: 0 } }}
|
|
@@ -657,4 +657,539 @@ describe('EditorNode', () => {
|
|
|
657
657
|
expect(dragHandles).to.have.length(3);
|
|
658
658
|
});
|
|
659
659
|
});
|
|
660
|
+
|
|
661
|
+
describe('exit disconnection', () => {
|
|
662
|
+
let mockStore: any;
|
|
663
|
+
let mockUpdateNode: any;
|
|
664
|
+
|
|
665
|
+
beforeEach(() => {
|
|
666
|
+
mockUpdateNode = stub();
|
|
667
|
+
mockStore = {
|
|
668
|
+
getState: stub().returns({
|
|
669
|
+
updateNode: mockUpdateNode
|
|
670
|
+
})
|
|
671
|
+
};
|
|
672
|
+
|
|
673
|
+
// Mock the plumber with disconnect capabilities
|
|
674
|
+
mockPlumber = {
|
|
675
|
+
makeTarget: stub(),
|
|
676
|
+
makeSource: stub(),
|
|
677
|
+
connectIds: stub(),
|
|
678
|
+
removeExitConnection: stub().returns(true),
|
|
679
|
+
setConnectionRemovingState: stub().returns(true)
|
|
680
|
+
};
|
|
681
|
+
|
|
682
|
+
(window as any).getStore = () => mockStore;
|
|
683
|
+
|
|
684
|
+
editorNode = new CanvasNode();
|
|
685
|
+
(editorNode as any).plumber = mockPlumber;
|
|
686
|
+
});
|
|
687
|
+
|
|
688
|
+
afterEach(() => {
|
|
689
|
+
// Restore any stubbed functions
|
|
690
|
+
if ((window as any).originalGetStore) {
|
|
691
|
+
(window as any).getStore = (window as any).originalGetStore;
|
|
692
|
+
}
|
|
693
|
+
});
|
|
694
|
+
|
|
695
|
+
it('handles exit click to initiate disconnection', async () => {
|
|
696
|
+
// Create a node with a connected exit
|
|
697
|
+
const mockNode: Node = {
|
|
698
|
+
uuid: 'test-node',
|
|
699
|
+
actions: [],
|
|
700
|
+
exits: [{ uuid: 'exit-1', destination_uuid: 'target-node' }]
|
|
701
|
+
};
|
|
702
|
+
|
|
703
|
+
const mockUI: NodeUI = {
|
|
704
|
+
position: { left: 100, top: 200 },
|
|
705
|
+
type: 'execute_actions'
|
|
706
|
+
};
|
|
707
|
+
|
|
708
|
+
(editorNode as any).node = mockNode;
|
|
709
|
+
(editorNode as any).ui = mockUI;
|
|
710
|
+
|
|
711
|
+
// Mock querySelector to return the exit element
|
|
712
|
+
const exitElement = document.createElement('div');
|
|
713
|
+
exitElement.id = 'exit-1';
|
|
714
|
+
exitElement.classList.add('exit', 'connected');
|
|
715
|
+
(editorNode as any).querySelector = stub().returns(exitElement);
|
|
716
|
+
|
|
717
|
+
// Create a mock event
|
|
718
|
+
const mockEvent = {
|
|
719
|
+
preventDefault: stub(),
|
|
720
|
+
stopPropagation: stub(),
|
|
721
|
+
currentTarget: exitElement
|
|
722
|
+
} as any;
|
|
723
|
+
|
|
724
|
+
// Mock getStore directly in the disconnectExit method
|
|
725
|
+
const originalDisconnectExit = (editorNode as any).disconnectExit;
|
|
726
|
+
(editorNode as any).disconnectExit = function (exit: any) {
|
|
727
|
+
// Call original but override the store logic
|
|
728
|
+
this.plumber.removeExitConnection(exit.uuid);
|
|
729
|
+
mockUpdateNode.call(null, this.node.uuid, {
|
|
730
|
+
...this.node,
|
|
731
|
+
exits: this.node.exits.map((e: any) =>
|
|
732
|
+
e.uuid === exit.uuid ? { ...e, destination_uuid: null } : e
|
|
733
|
+
)
|
|
734
|
+
});
|
|
735
|
+
};
|
|
736
|
+
|
|
737
|
+
// Call the click handler directly to initiate removal
|
|
738
|
+
(editorNode as any).handleExitClick(mockEvent, mockNode.exits[0]);
|
|
739
|
+
|
|
740
|
+
// Verify the exit is marked for removal in the component state
|
|
741
|
+
expect((editorNode as any).exitRemovingState.has('exit-1')).to.be.true;
|
|
742
|
+
|
|
743
|
+
// Verify a timeout was set
|
|
744
|
+
expect((editorNode as any).exitRemovalTimeouts.has('exit-1')).to.be.true;
|
|
745
|
+
|
|
746
|
+
// Now click again to confirm disconnection
|
|
747
|
+
(editorNode as any).handleExitClick(mockEvent, mockNode.exits[0]);
|
|
748
|
+
|
|
749
|
+
// Verify the plumber was called to remove the connection
|
|
750
|
+
expect(mockPlumber.removeExitConnection).to.have.been.calledWith(
|
|
751
|
+
'exit-1'
|
|
752
|
+
);
|
|
753
|
+
|
|
754
|
+
// Verify the node was updated with disconnected exit
|
|
755
|
+
expect(mockUpdateNode).to.have.been.called;
|
|
756
|
+
|
|
757
|
+
// Restore original method
|
|
758
|
+
(editorNode as any).disconnectExit = originalDisconnectExit;
|
|
759
|
+
});
|
|
760
|
+
|
|
761
|
+
it('cancels disconnection after timeout', async () => {
|
|
762
|
+
// Create a fake timer for this test
|
|
763
|
+
const clock = useFakeTimers();
|
|
764
|
+
|
|
765
|
+
try {
|
|
766
|
+
// Create a node with a connected exit
|
|
767
|
+
const mockNode: Node = {
|
|
768
|
+
uuid: 'test-node',
|
|
769
|
+
actions: [],
|
|
770
|
+
exits: [{ uuid: 'exit-1', destination_uuid: 'target-node' }]
|
|
771
|
+
};
|
|
772
|
+
|
|
773
|
+
const mockUI: NodeUI = {
|
|
774
|
+
position: { left: 100, top: 200 },
|
|
775
|
+
type: 'execute_actions'
|
|
776
|
+
};
|
|
777
|
+
|
|
778
|
+
(editorNode as any).node = mockNode;
|
|
779
|
+
(editorNode as any).ui = mockUI;
|
|
780
|
+
|
|
781
|
+
// Mock querySelector to return the exit element
|
|
782
|
+
const exitElement = document.createElement('div');
|
|
783
|
+
exitElement.id = 'exit-1';
|
|
784
|
+
exitElement.classList.add('exit', 'connected');
|
|
785
|
+
(editorNode as any).querySelector = stub().returns(exitElement);
|
|
786
|
+
|
|
787
|
+
// Create a mock event
|
|
788
|
+
const mockEvent = {
|
|
789
|
+
preventDefault: stub(),
|
|
790
|
+
stopPropagation: stub(),
|
|
791
|
+
currentTarget: exitElement
|
|
792
|
+
} as any;
|
|
793
|
+
|
|
794
|
+
// Call the click handler to initiate disconnection
|
|
795
|
+
(editorNode as any).handleExitClick(mockEvent, mockNode.exits[0]);
|
|
796
|
+
|
|
797
|
+
// Verify the exit is marked for removal
|
|
798
|
+
expect((editorNode as any).exitRemovingState.has('exit-1')).to.be.true;
|
|
799
|
+
|
|
800
|
+
// Advance the clock past the timeout (1500ms is the default timeout)
|
|
801
|
+
clock.tick(1501);
|
|
802
|
+
|
|
803
|
+
// Verify the removing state is cleared after the timeout
|
|
804
|
+
expect((editorNode as any).exitRemovingState.has('exit-1')).to.be.false;
|
|
805
|
+
expect(mockPlumber.setConnectionRemovingState).to.have.been.calledWith(
|
|
806
|
+
'exit-1',
|
|
807
|
+
false
|
|
808
|
+
);
|
|
809
|
+
} finally {
|
|
810
|
+
// Always restore the clock
|
|
811
|
+
clock.restore();
|
|
812
|
+
}
|
|
813
|
+
});
|
|
814
|
+
});
|
|
815
|
+
|
|
816
|
+
describe('action removal', () => {
|
|
817
|
+
let editorNode: CanvasNode;
|
|
818
|
+
let mockPlumber: any;
|
|
819
|
+
let getStoreStub: any;
|
|
820
|
+
|
|
821
|
+
beforeEach(() => {
|
|
822
|
+
editorNode = new CanvasNode();
|
|
823
|
+
|
|
824
|
+
// Mock plumber
|
|
825
|
+
mockPlumber = {
|
|
826
|
+
makeTarget: stub(),
|
|
827
|
+
makeSource: stub(),
|
|
828
|
+
connectIds: stub(),
|
|
829
|
+
removeExitConnection: stub()
|
|
830
|
+
};
|
|
831
|
+
editorNode['plumber'] = mockPlumber;
|
|
832
|
+
});
|
|
833
|
+
|
|
834
|
+
afterEach(() => {
|
|
835
|
+
if (getStoreStub) {
|
|
836
|
+
getStoreStub.restore();
|
|
837
|
+
}
|
|
838
|
+
});
|
|
839
|
+
|
|
840
|
+
it('handles action removal state management', async () => {
|
|
841
|
+
const mockNode: Node = {
|
|
842
|
+
uuid: 'test-node',
|
|
843
|
+
actions: [
|
|
844
|
+
{
|
|
845
|
+
type: 'send_msg',
|
|
846
|
+
uuid: 'action-1',
|
|
847
|
+
text: 'Hello',
|
|
848
|
+
quick_replies: []
|
|
849
|
+
} as any,
|
|
850
|
+
{
|
|
851
|
+
type: 'send_msg',
|
|
852
|
+
uuid: 'action-2',
|
|
853
|
+
text: 'World',
|
|
854
|
+
quick_replies: []
|
|
855
|
+
} as any
|
|
856
|
+
],
|
|
857
|
+
exits: [{ uuid: 'exit-1', destination_uuid: null }]
|
|
858
|
+
};
|
|
859
|
+
|
|
860
|
+
editorNode['node'] = mockNode;
|
|
861
|
+
|
|
862
|
+
const mockEvent = {
|
|
863
|
+
preventDefault: stub(),
|
|
864
|
+
stopPropagation: stub()
|
|
865
|
+
} as any;
|
|
866
|
+
|
|
867
|
+
// Initially, no action should be in removing state
|
|
868
|
+
expect((editorNode as any).actionRemovingState.has('action-1')).to.be
|
|
869
|
+
.false;
|
|
870
|
+
|
|
871
|
+
// Call the click handler to initiate removal
|
|
872
|
+
(editorNode as any).handleActionRemoveClick(
|
|
873
|
+
mockEvent,
|
|
874
|
+
mockNode.actions[0],
|
|
875
|
+
0
|
|
876
|
+
);
|
|
877
|
+
|
|
878
|
+
// Verify the action is marked for removal
|
|
879
|
+
expect((editorNode as any).actionRemovingState.has('action-1')).to.be
|
|
880
|
+
.true;
|
|
881
|
+
expect((editorNode as any).actionRemovalTimeouts.has('action-1')).to.be
|
|
882
|
+
.true;
|
|
883
|
+
|
|
884
|
+
// Verify event handlers were called
|
|
885
|
+
expect(mockEvent.preventDefault).to.have.been.called;
|
|
886
|
+
expect(mockEvent.stopPropagation).to.have.been.called;
|
|
887
|
+
});
|
|
888
|
+
|
|
889
|
+
it('cancels action removal after timeout', async () => {
|
|
890
|
+
const clock = useFakeTimers();
|
|
891
|
+
|
|
892
|
+
try {
|
|
893
|
+
const mockNode: Node = {
|
|
894
|
+
uuid: 'test-node',
|
|
895
|
+
actions: [
|
|
896
|
+
{
|
|
897
|
+
type: 'send_msg',
|
|
898
|
+
uuid: 'action-1',
|
|
899
|
+
text: 'Hello',
|
|
900
|
+
quick_replies: []
|
|
901
|
+
} as any
|
|
902
|
+
],
|
|
903
|
+
exits: [{ uuid: 'exit-1', destination_uuid: null }]
|
|
904
|
+
};
|
|
905
|
+
|
|
906
|
+
editorNode['node'] = mockNode;
|
|
907
|
+
|
|
908
|
+
const mockEvent = {
|
|
909
|
+
preventDefault: stub(),
|
|
910
|
+
stopPropagation: stub()
|
|
911
|
+
} as any;
|
|
912
|
+
|
|
913
|
+
// Call the click handler to initiate removal
|
|
914
|
+
(editorNode as any).handleActionRemoveClick(
|
|
915
|
+
mockEvent,
|
|
916
|
+
mockNode.actions[0],
|
|
917
|
+
0
|
|
918
|
+
);
|
|
919
|
+
|
|
920
|
+
// Verify the action is marked for removal
|
|
921
|
+
expect((editorNode as any).actionRemovingState.has('action-1')).to.be
|
|
922
|
+
.true;
|
|
923
|
+
|
|
924
|
+
// Advance the clock past the timeout (1000ms is the action removal timeout)
|
|
925
|
+
clock.tick(1001);
|
|
926
|
+
|
|
927
|
+
// Verify the removing state is cleared after the timeout
|
|
928
|
+
expect((editorNode as any).actionRemovingState.has('action-1')).to.be
|
|
929
|
+
.false;
|
|
930
|
+
expect((editorNode as any).actionRemovalTimeouts.has('action-1')).to.be
|
|
931
|
+
.false;
|
|
932
|
+
} finally {
|
|
933
|
+
// Always restore the clock
|
|
934
|
+
clock.restore();
|
|
935
|
+
}
|
|
936
|
+
});
|
|
937
|
+
|
|
938
|
+
it('clears timeouts on disconnect', async () => {
|
|
939
|
+
const mockNode: Node = {
|
|
940
|
+
uuid: 'test-node',
|
|
941
|
+
actions: [
|
|
942
|
+
{
|
|
943
|
+
type: 'send_msg',
|
|
944
|
+
uuid: 'action-1',
|
|
945
|
+
text: 'Hello',
|
|
946
|
+
quick_replies: []
|
|
947
|
+
} as any
|
|
948
|
+
],
|
|
949
|
+
exits: []
|
|
950
|
+
};
|
|
951
|
+
|
|
952
|
+
editorNode['node'] = mockNode;
|
|
953
|
+
|
|
954
|
+
const mockEvent = {
|
|
955
|
+
preventDefault: stub(),
|
|
956
|
+
stopPropagation: stub()
|
|
957
|
+
} as any;
|
|
958
|
+
|
|
959
|
+
// Start a removal process
|
|
960
|
+
(editorNode as any).handleActionRemoveClick(
|
|
961
|
+
mockEvent,
|
|
962
|
+
mockNode.actions[0],
|
|
963
|
+
0
|
|
964
|
+
);
|
|
965
|
+
|
|
966
|
+
expect((editorNode as any).actionRemovingState.has('action-1')).to.be
|
|
967
|
+
.true;
|
|
968
|
+
expect((editorNode as any).actionRemovalTimeouts.has('action-1')).to.be
|
|
969
|
+
.true;
|
|
970
|
+
|
|
971
|
+
// Disconnect the component
|
|
972
|
+
editorNode.disconnectedCallback();
|
|
973
|
+
|
|
974
|
+
// Verify all state is cleared
|
|
975
|
+
expect((editorNode as any).actionRemovingState.size).to.equal(0);
|
|
976
|
+
expect((editorNode as any).actionRemovalTimeouts.size).to.equal(0);
|
|
977
|
+
});
|
|
978
|
+
|
|
979
|
+
it('renders action with remove button', async () => {
|
|
980
|
+
const mockNode: Node = {
|
|
981
|
+
uuid: 'test-node',
|
|
982
|
+
actions: [
|
|
983
|
+
{
|
|
984
|
+
type: 'send_msg',
|
|
985
|
+
uuid: 'action-1',
|
|
986
|
+
text: 'Hello',
|
|
987
|
+
quick_replies: []
|
|
988
|
+
} as any
|
|
989
|
+
],
|
|
990
|
+
exits: []
|
|
991
|
+
};
|
|
992
|
+
|
|
993
|
+
editorNode['node'] = mockNode;
|
|
994
|
+
|
|
995
|
+
// Test that renderAction includes remove button
|
|
996
|
+
const result = (editorNode as any).renderAction(
|
|
997
|
+
mockNode,
|
|
998
|
+
mockNode.actions[0],
|
|
999
|
+
0
|
|
1000
|
+
);
|
|
1001
|
+
|
|
1002
|
+
expect(result).to.exist;
|
|
1003
|
+
|
|
1004
|
+
// Render the template to check the actual DOM
|
|
1005
|
+
const container = await fixture(html`<div>${result}</div>`);
|
|
1006
|
+
const removeButton = container.querySelector('.remove-button');
|
|
1007
|
+
|
|
1008
|
+
expect(removeButton).to.exist;
|
|
1009
|
+
expect(removeButton?.textContent?.trim()).to.equal('✕');
|
|
1010
|
+
expect(removeButton?.getAttribute('title')).to.equal('Remove action');
|
|
1011
|
+
});
|
|
1012
|
+
|
|
1013
|
+
it('shows removing state in UI', async () => {
|
|
1014
|
+
const mockNode: Node = {
|
|
1015
|
+
uuid: 'test-node',
|
|
1016
|
+
actions: [
|
|
1017
|
+
{
|
|
1018
|
+
type: 'send_msg',
|
|
1019
|
+
uuid: 'action-1',
|
|
1020
|
+
text: 'Hello',
|
|
1021
|
+
quick_replies: []
|
|
1022
|
+
} as any
|
|
1023
|
+
],
|
|
1024
|
+
exits: []
|
|
1025
|
+
};
|
|
1026
|
+
|
|
1027
|
+
editorNode['node'] = mockNode;
|
|
1028
|
+
|
|
1029
|
+
// Set action to removing state
|
|
1030
|
+
(editorNode as any).actionRemovingState.add('action-1');
|
|
1031
|
+
|
|
1032
|
+
// Test that renderAction shows removing state
|
|
1033
|
+
const result = (editorNode as any).renderAction(
|
|
1034
|
+
mockNode,
|
|
1035
|
+
mockNode.actions[0],
|
|
1036
|
+
0
|
|
1037
|
+
);
|
|
1038
|
+
|
|
1039
|
+
expect(result).to.exist;
|
|
1040
|
+
|
|
1041
|
+
// Render the template to check the actual DOM
|
|
1042
|
+
const container = await fixture(html`<div>${result}</div>`);
|
|
1043
|
+
const actionElement = container.querySelector('.action');
|
|
1044
|
+
|
|
1045
|
+
expect(actionElement).to.exist;
|
|
1046
|
+
expect(actionElement?.classList.contains('removing')).to.be.true;
|
|
1047
|
+
|
|
1048
|
+
// Check that title shows "Remove?"
|
|
1049
|
+
const titleElement = container.querySelector('.title .name');
|
|
1050
|
+
expect(titleElement?.textContent?.trim()).to.equal('Remove?');
|
|
1051
|
+
});
|
|
1052
|
+
|
|
1053
|
+
it('handles multiple action removal states independently', async () => {
|
|
1054
|
+
const mockNode: Node = {
|
|
1055
|
+
uuid: 'test-node',
|
|
1056
|
+
actions: [
|
|
1057
|
+
{
|
|
1058
|
+
type: 'send_msg',
|
|
1059
|
+
uuid: 'action-1',
|
|
1060
|
+
text: 'Hello',
|
|
1061
|
+
quick_replies: []
|
|
1062
|
+
} as any,
|
|
1063
|
+
{
|
|
1064
|
+
type: 'send_msg',
|
|
1065
|
+
uuid: 'action-2',
|
|
1066
|
+
text: 'World',
|
|
1067
|
+
quick_replies: []
|
|
1068
|
+
} as any
|
|
1069
|
+
],
|
|
1070
|
+
exits: []
|
|
1071
|
+
};
|
|
1072
|
+
|
|
1073
|
+
editorNode['node'] = mockNode;
|
|
1074
|
+
|
|
1075
|
+
const mockEvent = {
|
|
1076
|
+
preventDefault: stub(),
|
|
1077
|
+
stopPropagation: stub()
|
|
1078
|
+
} as any;
|
|
1079
|
+
|
|
1080
|
+
// Start removal for first action
|
|
1081
|
+
(editorNode as any).handleActionRemoveClick(
|
|
1082
|
+
mockEvent,
|
|
1083
|
+
mockNode.actions[0],
|
|
1084
|
+
0
|
|
1085
|
+
);
|
|
1086
|
+
expect((editorNode as any).actionRemovingState.has('action-1')).to.be
|
|
1087
|
+
.true;
|
|
1088
|
+
expect((editorNode as any).actionRemovingState.has('action-2')).to.be
|
|
1089
|
+
.false;
|
|
1090
|
+
|
|
1091
|
+
// Start removal for second action
|
|
1092
|
+
(editorNode as any).handleActionRemoveClick(
|
|
1093
|
+
mockEvent,
|
|
1094
|
+
mockNode.actions[1],
|
|
1095
|
+
1
|
|
1096
|
+
);
|
|
1097
|
+
expect((editorNode as any).actionRemovingState.has('action-1')).to.be
|
|
1098
|
+
.true;
|
|
1099
|
+
expect((editorNode as any).actionRemovingState.has('action-2')).to.be
|
|
1100
|
+
.true;
|
|
1101
|
+
|
|
1102
|
+
// Both actions should have timeouts
|
|
1103
|
+
expect((editorNode as any).actionRemovalTimeouts.has('action-1')).to.be
|
|
1104
|
+
.true;
|
|
1105
|
+
expect((editorNode as any).actionRemovalTimeouts.has('action-2')).to.be
|
|
1106
|
+
.true;
|
|
1107
|
+
});
|
|
1108
|
+
|
|
1109
|
+
it('properly reroutes JSPlumb connections when removing node with connections', async () => {
|
|
1110
|
+
// This test verifies that the connection rerouting logic works correctly
|
|
1111
|
+
// by testing the specific logic within removeNodeWithConnections
|
|
1112
|
+
|
|
1113
|
+
const mockNode: Node = {
|
|
1114
|
+
uuid: 'test-node',
|
|
1115
|
+
actions: [
|
|
1116
|
+
{
|
|
1117
|
+
type: 'send_msg',
|
|
1118
|
+
uuid: 'action-1',
|
|
1119
|
+
text: 'Hello',
|
|
1120
|
+
quick_replies: []
|
|
1121
|
+
} as any
|
|
1122
|
+
],
|
|
1123
|
+
exits: [{ uuid: 'exit-after', destination_uuid: 'node-after' }]
|
|
1124
|
+
};
|
|
1125
|
+
|
|
1126
|
+
editorNode['node'] = mockNode;
|
|
1127
|
+
|
|
1128
|
+
// Mock the flow definition that would be returned by getStore
|
|
1129
|
+
const mockFlowDefinition = {
|
|
1130
|
+
nodes: [
|
|
1131
|
+
{
|
|
1132
|
+
uuid: 'node-before',
|
|
1133
|
+
exits: [
|
|
1134
|
+
{ uuid: 'exit-before-1', destination_uuid: 'test-node' },
|
|
1135
|
+
{ uuid: 'exit-before-2', destination_uuid: 'test-node' }
|
|
1136
|
+
]
|
|
1137
|
+
},
|
|
1138
|
+
mockNode,
|
|
1139
|
+
{
|
|
1140
|
+
uuid: 'node-after',
|
|
1141
|
+
exits: []
|
|
1142
|
+
}
|
|
1143
|
+
]
|
|
1144
|
+
};
|
|
1145
|
+
|
|
1146
|
+
// Test the connection rerouting logic directly by simulating what happens
|
|
1147
|
+
// when a node with incoming and outgoing connections is removed
|
|
1148
|
+
const nodeUuid = mockNode.uuid;
|
|
1149
|
+
const incomingConnections: {
|
|
1150
|
+
exitUuid: string;
|
|
1151
|
+
sourceNodeUuid: string;
|
|
1152
|
+
}[] = [];
|
|
1153
|
+
const outgoingExits = mockNode.exits.filter(
|
|
1154
|
+
(exit) => exit.destination_uuid
|
|
1155
|
+
);
|
|
1156
|
+
|
|
1157
|
+
// Find incoming connections (same logic as in removeNodeWithConnections)
|
|
1158
|
+
for (const node of mockFlowDefinition.nodes) {
|
|
1159
|
+
if (node.uuid !== nodeUuid) {
|
|
1160
|
+
for (const exit of node.exits) {
|
|
1161
|
+
if (exit.destination_uuid === nodeUuid) {
|
|
1162
|
+
incomingConnections.push({
|
|
1163
|
+
exitUuid: exit.uuid,
|
|
1164
|
+
sourceNodeUuid: node.uuid
|
|
1165
|
+
});
|
|
1166
|
+
}
|
|
1167
|
+
}
|
|
1168
|
+
}
|
|
1169
|
+
}
|
|
1170
|
+
|
|
1171
|
+
// Verify we found the expected incoming connections
|
|
1172
|
+
expect(incomingConnections).to.have.length(2);
|
|
1173
|
+
expect(incomingConnections[0].exitUuid).to.equal('exit-before-1');
|
|
1174
|
+
expect(incomingConnections[1].exitUuid).to.equal('exit-before-2');
|
|
1175
|
+
|
|
1176
|
+
// Verify we found the expected outgoing connections
|
|
1177
|
+
expect(outgoingExits).to.have.length(1);
|
|
1178
|
+
expect(outgoingExits[0].destination_uuid).to.equal('node-after');
|
|
1179
|
+
|
|
1180
|
+
// Simulate the rerouting logic
|
|
1181
|
+
if (incomingConnections.length > 0 && outgoingExits.length > 0) {
|
|
1182
|
+
const firstDestination = outgoingExits[0].destination_uuid;
|
|
1183
|
+
|
|
1184
|
+
// Verify the destination is correct for rerouting
|
|
1185
|
+
expect(firstDestination).to.equal('node-after');
|
|
1186
|
+
}
|
|
1187
|
+
|
|
1188
|
+
// This test verifies the rerouting logic is correct. The actual fix ensures that:
|
|
1189
|
+
// 1. Old JSPlumb connections are removed with removeExitConnection
|
|
1190
|
+
// 2. Store is updated with updateConnection
|
|
1191
|
+
// 3. New JSPlumb connections are created with connectIds
|
|
1192
|
+
// This sequence ensures JSPlumb visuals stay in sync with the flow definition
|
|
1193
|
+
});
|
|
1194
|
+
});
|
|
660
1195
|
});
|