@nyaruka/temba-components 0.131.1 → 0.131.3
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 +75 -1
- package/demo/components/floating-tabs/example.html +400 -0
- package/demo/components/flow/index.html +1 -1
- package/demo/data/flows/food-order.json +2 -2
- package/demo/data/flows/sample-flow.json +113 -125
- package/demo/data/flows/voicemail.json +613 -0
- package/demo/index.html +6 -0
- package/dist/locales/es.js +5 -5
- package/dist/locales/es.js.map +1 -1
- package/dist/locales/fr.js +5 -5
- package/dist/locales/fr.js.map +1 -1
- package/dist/locales/locale-codes.js +11 -2
- package/dist/locales/locale-codes.js.map +1 -1
- package/dist/locales/pt.js +5 -5
- package/dist/locales/pt.js.map +1 -1
- package/dist/static/svg/index.svg +1 -1
- package/dist/temba-components.js +1773 -662
- 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/display/FloatingTab.js +167 -0
- package/out-tsc/src/display/FloatingTab.js.map +1 -0
- package/out-tsc/src/display/ProgressBar.js +22 -2
- package/out-tsc/src/display/ProgressBar.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 +489 -47
- package/out-tsc/src/flow/CanvasNode.js.map +1 -1
- package/out-tsc/src/flow/Editor.js +1417 -67
- package/out-tsc/src/flow/Editor.js.map +1 -1
- package/out-tsc/src/flow/NodeEditor.js +479 -112
- package/out-tsc/src/flow/NodeEditor.js.map +1 -1
- package/out-tsc/src/flow/NodeTypeSelector.js +540 -0
- package/out-tsc/src/flow/NodeTypeSelector.js.map +1 -0
- package/out-tsc/src/flow/StickyNote.js +12 -3
- package/out-tsc/src/flow/StickyNote.js.map +1 -1
- package/out-tsc/src/flow/actions/add_contact_groups.js +4 -3
- package/out-tsc/src/flow/actions/add_contact_groups.js.map +1 -1
- package/out-tsc/src/flow/actions/add_contact_urn.js +63 -4
- package/out-tsc/src/flow/actions/add_contact_urn.js.map +1 -1
- package/out-tsc/src/flow/actions/add_input_labels.js +4 -3
- package/out-tsc/src/flow/actions/add_input_labels.js.map +1 -1
- package/out-tsc/src/flow/actions/play_audio.js +3 -2
- package/out-tsc/src/flow/actions/play_audio.js.map +1 -1
- package/out-tsc/src/flow/actions/remove_contact_groups.js +7 -5
- package/out-tsc/src/flow/actions/remove_contact_groups.js.map +1 -1
- package/out-tsc/src/flow/actions/request_optin.js +3 -2
- package/out-tsc/src/flow/actions/request_optin.js.map +1 -1
- package/out-tsc/src/flow/actions/say_msg.js +3 -2
- package/out-tsc/src/flow/actions/say_msg.js.map +1 -1
- package/out-tsc/src/flow/actions/send_broadcast.js +77 -23
- package/out-tsc/src/flow/actions/send_broadcast.js.map +1 -1
- package/out-tsc/src/flow/actions/send_email.js +5 -5
- package/out-tsc/src/flow/actions/send_email.js.map +1 -1
- package/out-tsc/src/flow/actions/send_msg.js +101 -21
- package/out-tsc/src/flow/actions/send_msg.js.map +1 -1
- package/out-tsc/src/flow/actions/set_contact_channel.js +6 -9
- package/out-tsc/src/flow/actions/set_contact_channel.js.map +1 -1
- package/out-tsc/src/flow/actions/set_contact_field.js +20 -20
- package/out-tsc/src/flow/actions/set_contact_field.js.map +1 -1
- package/out-tsc/src/flow/actions/set_contact_language.js +3 -2
- package/out-tsc/src/flow/actions/set_contact_language.js.map +1 -1
- package/out-tsc/src/flow/actions/set_contact_name.js +3 -12
- package/out-tsc/src/flow/actions/set_contact_name.js.map +1 -1
- package/out-tsc/src/flow/actions/set_contact_status.js +3 -2
- package/out-tsc/src/flow/actions/set_contact_status.js.map +1 -1
- package/out-tsc/src/flow/actions/set_run_result.js +4 -3
- package/out-tsc/src/flow/actions/set_run_result.js.map +1 -1
- package/out-tsc/src/flow/actions/start_session.js +181 -6
- package/out-tsc/src/flow/actions/start_session.js.map +1 -1
- package/out-tsc/src/flow/config.js +11 -23
- 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 +71 -0
- package/out-tsc/src/flow/nodes/shared.js.map +1 -0
- package/out-tsc/src/flow/nodes/split_by_airtime.js +211 -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 +152 -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 +73 -2
- package/out-tsc/src/flow/nodes/split_by_expression.js.map +1 -1
- package/out-tsc/src/flow/nodes/split_by_groups.js +18 -10
- package/out-tsc/src/flow/nodes/split_by_groups.js.map +1 -1
- package/out-tsc/src/flow/nodes/split_by_intent.js +8 -0
- package/out-tsc/src/flow/nodes/split_by_intent.js.map +1 -0
- package/out-tsc/src/flow/nodes/split_by_llm.js +11 -3
- package/out-tsc/src/flow/nodes/split_by_llm.js.map +1 -1
- package/out-tsc/src/flow/nodes/split_by_llm_categorize.js +10 -3
- package/out-tsc/src/flow/nodes/split_by_llm_categorize.js.map +1 -1
- package/out-tsc/src/flow/nodes/split_by_random.js +10 -4
- package/out-tsc/src/flow/nodes/split_by_random.js.map +1 -1
- package/out-tsc/src/flow/nodes/split_by_resthook.js +113 -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 +211 -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 +158 -2
- package/out-tsc/src/flow/nodes/split_by_scheme.js.map +1 -1
- package/out-tsc/src/flow/nodes/split_by_subflow.js +13 -5
- package/out-tsc/src/flow/nodes/split_by_subflow.js.map +1 -1
- package/out-tsc/src/flow/nodes/split_by_ticket.js +10 -3
- package/out-tsc/src/flow/nodes/split_by_ticket.js.map +1 -1
- package/out-tsc/src/flow/nodes/split_by_webhook.js +10 -3
- package/out-tsc/src/flow/nodes/split_by_webhook.js.map +1 -1
- package/out-tsc/src/flow/nodes/wait_for_digits.js +3 -2
- package/out-tsc/src/flow/nodes/wait_for_digits.js.map +1 -1
- package/out-tsc/src/flow/nodes/wait_for_menu.js +3 -2
- package/out-tsc/src/flow/nodes/wait_for_menu.js.map +1 -1
- package/out-tsc/src/flow/nodes/wait_for_response.js +38 -568
- package/out-tsc/src/flow/nodes/wait_for_response.js.map +1 -1
- package/out-tsc/src/flow/types.js +86 -12
- package/out-tsc/src/flow/types.js.map +1 -1
- package/out-tsc/src/flow/utils.js +101 -14
- package/out-tsc/src/flow/utils.js.map +1 -1
- package/out-tsc/src/form/FieldRenderer.js +2 -4
- package/out-tsc/src/form/FieldRenderer.js.map +1 -1
- package/out-tsc/src/interfaces.js +3 -0
- package/out-tsc/src/interfaces.js.map +1 -1
- package/out-tsc/src/layout/FloatingWindow.js +346 -0
- package/out-tsc/src/layout/FloatingWindow.js.map +1 -0
- 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 +6 -25
- package/out-tsc/src/live/ContactChat.js.map +1 -1
- package/out-tsc/src/locales/es.js +5 -5
- package/out-tsc/src/locales/es.js.map +1 -1
- package/out-tsc/src/locales/fr.js +5 -5
- package/out-tsc/src/locales/fr.js.map +1 -1
- package/out-tsc/src/locales/locale-codes.js +11 -2
- package/out-tsc/src/locales/locale-codes.js.map +1 -1
- package/out-tsc/src/locales/pt.js +5 -5
- package/out-tsc/src/locales/pt.js.map +1 -1
- package/out-tsc/src/store/AppState.js +120 -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 +8 -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-floating-tab.test.js +91 -0
- package/out-tsc/test/temba-floating-tab.test.js.map +1 -0
- package/out-tsc/test/temba-floating-window.test.js +301 -0
- package/out-tsc/test/temba-floating-window.test.js.map +1 -0
- package/out-tsc/test/temba-flow-editor-node.test.js +202 -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-localization.test.js +471 -0
- package/out-tsc/test/temba-localization.test.js.map +1 -0
- 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 +265 -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 +20 -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/floating-tab/default.png +0 -0
- package/screenshots/truth/floating-tab/gray.png +0 -0
- package/screenshots/truth/floating-tab/green.png +0 -0
- package/screenshots/truth/floating-tab/hidden.png +0 -0
- package/screenshots/truth/floating-tab/hover.png +0 -0
- package/screenshots/truth/floating-tab/purple.png +0 -0
- package/screenshots/truth/floating-window/chromeless.png +0 -0
- package/screenshots/truth/floating-window/custom-size.png +0 -0
- package/screenshots/truth/floating-window/default.png +0 -0
- package/screenshots/truth/floating-window/with-header.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/display/FloatingTab.ts +174 -0
- package/src/display/ProgressBar.ts +22 -2
- package/src/events.ts +2 -8
- package/src/flow/CanvasMenu.ts +217 -0
- package/src/flow/CanvasNode.ts +596 -40
- package/src/flow/Editor.ts +1721 -45
- package/src/flow/NodeEditor.ts +621 -144
- package/src/flow/NodeTypeSelector.ts +636 -0
- package/src/flow/StickyNote.ts +12 -3
- package/src/flow/actions/add_contact_groups.ts +5 -4
- package/src/flow/actions/add_contact_urn.ts +78 -4
- package/src/flow/actions/add_input_labels.ts +5 -4
- package/src/flow/actions/play_audio.ts +3 -2
- package/src/flow/actions/remove_contact_groups.ts +16 -6
- package/src/flow/actions/request_optin.ts +3 -2
- package/src/flow/actions/say_msg.ts +3 -2
- package/src/flow/actions/send_broadcast.ts +86 -23
- package/src/flow/actions/send_email.ts +12 -6
- package/src/flow/actions/send_msg.ts +155 -34
- package/src/flow/actions/set_contact_channel.ts +6 -11
- package/src/flow/actions/set_contact_field.ts +21 -25
- package/src/flow/actions/set_contact_language.ts +11 -4
- package/src/flow/actions/set_contact_name.ts +4 -15
- package/src/flow/actions/set_contact_status.ts +4 -3
- package/src/flow/actions/set_run_result.ts +5 -4
- package/src/flow/actions/start_session.ts +210 -6
- package/src/flow/config.ts +11 -23
- package/src/flow/currencies.ts +51 -0
- package/src/flow/nodes/shared-rules.ts +301 -0
- package/src/flow/nodes/shared.ts +87 -0
- package/src/flow/nodes/split_by_airtime.ts +255 -5
- package/src/flow/nodes/split_by_contact_field.ts +195 -3
- package/src/flow/nodes/split_by_expression.ts +104 -2
- package/src/flow/nodes/split_by_groups.ts +26 -11
- package/src/flow/nodes/split_by_intent.ts +8 -0
- package/src/flow/nodes/split_by_llm.ts +22 -4
- package/src/flow/nodes/split_by_llm_categorize.ts +22 -5
- package/src/flow/nodes/split_by_random.ts +16 -6
- package/src/flow/nodes/split_by_resthook.ts +140 -0
- package/src/flow/nodes/split_by_run_result.ts +259 -3
- package/src/flow/nodes/split_by_scheme.ts +202 -2
- package/src/flow/nodes/split_by_subflow.ts +17 -5
- package/src/flow/nodes/split_by_ticket.ts +15 -4
- package/src/flow/nodes/split_by_webhook.ts +17 -6
- package/src/flow/nodes/wait_for_digits.ts +3 -2
- package/src/flow/nodes/wait_for_menu.ts +3 -2
- package/src/flow/nodes/wait_for_response.ts +59 -680
- package/src/flow/types.ts +156 -23
- package/src/flow/utils.ts +108 -14
- package/src/form/FieldRenderer.ts +2 -4
- package/src/interfaces.ts +3 -0
- package/src/layout/FloatingWindow.ts +386 -0
- package/src/list/SortableList.ts +109 -34
- package/src/live/ContactChat.ts +7 -25
- package/src/locales/es.ts +18 -13
- package/src/locales/fr.ts +18 -13
- package/src/locales/locale-codes.ts +11 -2
- package/src/locales/pt.ts +18 -13
- package/src/store/AppState.ts +173 -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/llms.json +18 -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 +8 -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-floating-tab.test.ts +110 -0
- package/test/temba-floating-window.test.ts +477 -0
- package/test/temba-flow-editor-node.test.ts +246 -2
- package/test/temba-flow-editor.test.ts +7 -8
- package/test/temba-localization.test.ts +611 -0
- package/test/temba-node-editor.test.ts +3 -1
- package/test/temba-node-type-selector.test.ts +355 -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 +22 -0
- package/test-assets/contacts/history.json +14 -21
- package/test-assets/select/llms.json +2 -2
- package/web-dev-server.config.mjs +49 -1
- package/web-test-runner.config.mjs +0 -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/out-tsc/src/flow/nodes/wait_for_audio.js +0 -7
- package/out-tsc/src/flow/nodes/wait_for_audio.js.map +0 -1
- package/out-tsc/src/flow/nodes/wait_for_image.js +0 -7
- package/out-tsc/src/flow/nodes/wait_for_image.js.map +0 -1
- package/out-tsc/src/flow/nodes/wait_for_location.js +0 -7
- package/out-tsc/src/flow/nodes/wait_for_location.js.map +0 -1
- package/out-tsc/src/flow/nodes/wait_for_video.js +0 -7
- package/out-tsc/src/flow/nodes/wait_for_video.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
- package/src/flow/nodes/wait_for_audio.ts +0 -7
- package/src/flow/nodes/wait_for_image.ts +0 -7
- package/src/flow/nodes/wait_for_location.ts +0 -7
- package/src/flow/nodes/wait_for_video.ts +0 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"temba-omnibox.test.js","sourceRoot":"","sources":["../../test/temba-omnibox.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAE3C,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,QAAa,EAAE,IAAI,EAAE,YAAY,EAAE,EAAU,EAAE;IACrE,MAAM,UAAU,GAAG;kBACH,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC;SAC/B,GAAG,CAAC,CAAC,IAAY,EAAE,EAAE;QACpB,mCAAmC;QACnC,IAAI,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,QAAQ,EAAE,CAAC;YACp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CAAC,WAAW,CAAC,MAAM,EAAE,wBAAwB,CAAC,CAAC;QAErD,MAAM,gBAAgB,CAAC,kBAAkB,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;IAC/D,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { fixture, assert } from '@open-wc/testing';\nimport { Omnibox } from '../src/form/select/Omnibox';\nimport { assertScreenshot, getClip, openAndClick } from './utils.test';\nimport { useFakeTimers, spy } from 'sinon';\n\nexport const getHTML = (attrs: any = { name: 'recipients' }): string => {\n const selectHTML = `\n <temba-omnibox${Object.keys(attrs)\n .map((name: string) => {\n // check if it's a string attribute\n if (typeof attrs[name] === 'string') {\n return ` ${name}=\"${attrs[name].replace(/\"/g, '"')}\"`;\n }\n return ` ${name}=\"${attrs[name]}\"`;\n })\n .join(' ')}>\n </temba-select>`;\n return selectHTML;\n};\n\nexport const createOmnibox = async (\n clock: any,\n attrs: any = {}\n): Promise<Omnibox> => {\n const parentNode = document.createElement('div');\n parentNode.setAttribute('style', 'width: 400px;');\n\n const omnibox: Omnibox = await fixture(getHTML(attrs), { parentNode });\n clock.runAll();\n await omnibox.updateComplete;\n return omnibox;\n};\n\ndescribe('temba-omnibox', () => {\n let clock: any;\n beforeEach(function () {\n clock = useFakeTimers();\n setViewport({ width: 500, height: 1000, deviceScaleFactor: 2 });\n });\n\n afterEach(function () {\n clock.restore();\n });\n\n it('can be created', async () => {\n const omnibox: Omnibox = await fixture(\n getHTML({ endpoint: '/test-assets/select/omnibox.json' })\n );\n assert.instanceOf(omnibox, Omnibox);\n });\n\n // TODO: make this pass reliably on CI\n xit('fires change events on selection', async () => {\n const omnibox: Omnibox = await createOmnibox(clock, {\n endpoint: '/test-assets/select/omnibox.json'\n });\n\n const changeEvent = spy();\n omnibox.addEventListener('change', changeEvent);\n\n clock.runAll();\n await omnibox.updateComplete;\n clock.runAll();\n\n await openAndClick(clock, omnibox, 0);\n clock.runAll();\n assert(changeEvent.called, 'change event not fired');\n\n await assertScreenshot('omnibox/selected', getClip(omnibox));\n });\n});\n"]}
|
|
@@ -120,5 +120,56 @@ describe('temba-sortable-list', () => {
|
|
|
120
120
|
const changeEvent = await updated;
|
|
121
121
|
expect(changeEvent.type).to.equal('change');
|
|
122
122
|
});
|
|
123
|
+
it('detects external drag when dragging outside container', async () => {
|
|
124
|
+
const list = await createSorter(BORING_LIST);
|
|
125
|
+
list.externalDrag = true;
|
|
126
|
+
await list.updateComplete;
|
|
127
|
+
const bounds = list.getBoundingClientRect();
|
|
128
|
+
// track external drag events
|
|
129
|
+
let externalDragFired = false;
|
|
130
|
+
let internalDragFired = false;
|
|
131
|
+
list.addEventListener(CustomEventType.DragExternal, () => {
|
|
132
|
+
externalDragFired = true;
|
|
133
|
+
});
|
|
134
|
+
list.addEventListener(CustomEventType.DragInternal, () => {
|
|
135
|
+
internalDragFired = true;
|
|
136
|
+
});
|
|
137
|
+
// start dragging an item
|
|
138
|
+
await moveMouse(bounds.left + 20, bounds.bottom - 10);
|
|
139
|
+
await mouseDown();
|
|
140
|
+
// drag outside the container (far to the right)
|
|
141
|
+
await moveMouse(bounds.right + 100, bounds.top + 10);
|
|
142
|
+
clock.runAll();
|
|
143
|
+
// should have fired external drag event
|
|
144
|
+
expect(externalDragFired).to.be.true;
|
|
145
|
+
// drag back inside
|
|
146
|
+
externalDragFired = false; // reset
|
|
147
|
+
await moveMouse(bounds.left + 20, bounds.top + 10);
|
|
148
|
+
clock.runAll();
|
|
149
|
+
// should have fired internal drag event
|
|
150
|
+
expect(internalDragFired).to.be.true;
|
|
151
|
+
// clean up
|
|
152
|
+
await mouseUp();
|
|
153
|
+
clock.runAll();
|
|
154
|
+
});
|
|
155
|
+
it('fires DragStop with isExternal=true when dropped outside container', async () => {
|
|
156
|
+
const list = await createSorter(BORING_LIST);
|
|
157
|
+
list.externalDrag = true;
|
|
158
|
+
await list.updateComplete;
|
|
159
|
+
const bounds = list.getBoundingClientRect();
|
|
160
|
+
// start dragging an item
|
|
161
|
+
await moveMouse(bounds.left + 20, bounds.bottom - 10);
|
|
162
|
+
await mouseDown();
|
|
163
|
+
// drag outside the container
|
|
164
|
+
await moveMouse(bounds.right + 100, bounds.top + 10);
|
|
165
|
+
clock.runAll();
|
|
166
|
+
// listen for drag stop event
|
|
167
|
+
const dragStop = oneEvent(list, CustomEventType.DragStop, false);
|
|
168
|
+
// drop outside
|
|
169
|
+
await mouseUp();
|
|
170
|
+
clock.runAll();
|
|
171
|
+
const dragStopEvent = await dragStop;
|
|
172
|
+
expect(dragStopEvent.detail.isExternal).to.be.true;
|
|
173
|
+
});
|
|
123
174
|
});
|
|
124
175
|
//# sourceMappingURL=temba-sortable-list.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"temba-sortable-list.test.js","sourceRoot":"","sources":["../../test/temba-sortable-list.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,IAAI,EAAkB,MAAM,KAAK,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACzD,OAAc,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE7C,MAAM,WAAW,GAAG,IAAI,CAAA;;;;;;;;;;;;;;CAcvB,CAAC;AAEF,MAAM,eAAe,GAAG,IAAI,CAAA;;;;;;;;;;;;;;;;CAgB3B,CAAC;AAEF,MAAM,YAAY,GAAG,KAAK,EAAE,GAAmB,EAAE,EAAE;IACjD,MAAM,UAAU,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IACjD,UAAU,CAAC,YAAY,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;IAClD,OAAO,CAAC,MAAM,OAAO,CAAC,GAAG,EAAE,EAAE,UAAU,EAAE,CAAC,CAAiB,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EH,MAAM,gBAAgB,CAAC,uBAAuB,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;QAE/D,gCAAgC;QAChC,MAAM,WAAW,GAAG,MAAM,OAAO,CAAC;QAClC,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IAC9C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { expect, fixture, oneEvent } from '@open-wc/testing';\nimport { html, TemplateResult } from 'lit';\nimport { CustomEventType } from '../src/interfaces';\nimport { SortableList } from '../src/list/SortableList';\nimport { assertScreenshot, getClip } from './utils.test';\nimport Sinon, { useFakeTimers } from 'sinon';\n\nconst BORING_LIST = html`\n <temba-sortable-list>\n <style>\n .sortable {\n display: flex;\n align-items: center;\n justify-content: center;\n text-align: center;\n height: 20px;\n }\n </style>\n <div class=\"sortable\" id=\"chicken\" style=\"\">Chicken</div>\n <div class=\"sortable\" id=\"fish\">Fish</div>\n </temba-sortable-list>\n`;\n\nconst HORIZONTAL_LIST = html`\n <temba-sortable-list horizontal>\n <style>\n .sortable {\n display: flex;\n align-items: center;\n justify-content: center;\n text-align: center;\n height: 20px;\n width: 50px;\n }\n </style>\n <div class=\"sortable\" id=\"red\">Red</div>\n <div class=\"sortable\" id=\"blue\">Blue</div>\n <div class=\"sortable\" id=\"green\">Green</div>\n </temba-sortable-list>\n`;\n\nconst createSorter = async (def: TemplateResult) => {\n const parentNode = document.createElement('div');\n parentNode.setAttribute('style', 'width: 100px;');\n return (await fixture(def, { parentNode })) as SortableList;\n};\n\ndescribe('temba-sortable-list', () => {\n let clock: Sinon.SinonFakeTimers;\n beforeEach(function () {\n clock = useFakeTimers();\n clock.runAll();\n });\n\n afterEach(function () {\n clock.restore();\n });\n\n it('renders default', async () => {\n const list: SortableList = await createSorter(BORING_LIST);\n await assertScreenshot('list/sortable', getClip(list));\n });\n\n it('can get ids of sortable elements', async () => {\n const list: SortableList = await createSorter(BORING_LIST);\n await list.updateComplete;\n\n const ids = list.getIds();\n expect(ids).to.deep.equal(['chicken', 'fish']);\n });\n\n it('works with horizontal layout', async () => {\n const list: SortableList = await createSorter(HORIZONTAL_LIST);\n await list.updateComplete;\n\n const ids = list.getIds();\n expect(ids).to.deep.equal(['red', 'blue', 'green']);\n\n // Test horizontal drag behavior\n const bounds = list.getBoundingClientRect();\n const orderChanged = oneEvent(list, CustomEventType.OrderChanged, false);\n\n // Drag the first item (red) to after the second item (blue)\n await moveMouse(bounds.left + 10, bounds.top + 10);\n await mouseDown();\n await moveMouse(bounds.left + 80, bounds.top + 10);\n await mouseUp();\n clock.runAll();\n\n const orderEvent = await orderChanged;\n expect(orderEvent.detail).to.deep.equal({\n swap: [0, 2]\n });\n });\n\n it('handles prepareGhost callback', async () => {\n const list: SortableList = await createSorter(BORING_LIST);\n let ghostPrepared = false;\n\n list.prepareGhost = (ghost: HTMLElement) => {\n ghostPrepared = true;\n ghost.style.backgroundColor = 'red';\n };\n\n const bounds = list.getBoundingClientRect();\n\n // Start dragging to trigger ghost creation\n await moveMouse(bounds.left + 20, bounds.bottom - 10);\n await mouseDown();\n await moveMouse(bounds.left + 30, bounds.bottom - 10);\n\n expect(ghostPrepared).to.be.true;\n\n // Clean up\n await mouseUp();\n clock.runAll();\n });\n\n it('drags', async () => {\n const list: SortableList = await createSorter(BORING_LIST);\n const updated = oneEvent(list, 'change', false);\n\n const bounds = list.getBoundingClientRect();\n\n await moveMouse(bounds.left + 20, bounds.bottom - 10);\n await mouseDown();\n await moveMouse(bounds.left + 20, bounds.top + 5);\n\n // should be hovered\n await assertScreenshot('list/sortable-dragging', getClip(list));\n\n // now lets drop - this will fire the order changed event\n const orderChanged = oneEvent(list, CustomEventType.OrderChanged, false);\n await mouseUp();\n clock.runAll();\n await list.updateComplete;\n clock.runAll();\n\n // we should fire an order changed event on drop\n const orderEvent = await orderChanged;\n expect(orderEvent.detail).to.deep.equal({\n swap: [1, 0]\n });\n\n await assertScreenshot('list/sortable-dropped', getClip(list));\n\n // we should fire a change event\n const changeEvent = await updated;\n expect(changeEvent.type).to.equal('change');\n });\n});\n"]}
|
|
1
|
+
{"version":3,"file":"temba-sortable-list.test.js","sourceRoot":"","sources":["../../test/temba-sortable-list.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,IAAI,EAAkB,MAAM,KAAK,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACzD,OAAc,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE7C,MAAM,WAAW,GAAG,IAAI,CAAA;;;;;;;;;;;;;;CAcvB,CAAC;AAEF,MAAM,eAAe,GAAG,IAAI,CAAA;;;;;;;;;;;;;;;;CAgB3B,CAAC;AAEF,MAAM,YAAY,GAAG,KAAK,EAAE,GAAmB,EAAE,EAAE;IACjD,MAAM,UAAU,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IACjD,UAAU,CAAC,YAAY,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;IAClD,OAAO,CAAC,MAAM,OAAO,CAAC,GAAG,EAAE,EAAE,UAAU,EAAE,CAAC,CAAiB,CAAC;AAC9D,CAAC,CAAC;AAEF,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE;IACnC,IAAI,KAA4B,CAAC;IACjC,UAAU,CAAC;QACT,KAAK,GAAG,aAAa,EAAE,CAAC;QACxB,KAAK,CAAC,MAAM,EAAE,CAAC;IACjB,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC;QACR,KAAK,CAAC,OAAO,EAAE,CAAC;IAClB,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,iBAAiB,EAAE,KAAK,IAAI,EAAE;QAC/B,MAAM,IAAI,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EAAE,CAAC;IACjB,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,oEAAoE,EAAE,KAAK,IAAI,EAAE;QAClF,MAAM,IAAI,GAAiB,MAAM,YAAY,CAAC,WAAW,CAAC,CAAC;QAC3D,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;QACzB,MAAM,IAAI,CAAC,cAAc,CAAC;QAE1B,MAAM,MAAM,GAAG,IAAI,CAAC,qBAAqB,EAAE,CAAC;QAE5C,yBAAyB;QACzB,MAAM,SAAS,CAAC,MAAM,CAAC,IAAI,GAAG,EAAE,EAAE,MAAM,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;QACtD,MAAM,SAAS,EAAE,CAAC;QAElB,6BAA6B;QAC7B,MAAM,SAAS,CAAC,MAAM,CAAC,KAAK,GAAG,GAAG,EAAE,MAAM,CAAC,GAAG,GAAG,EAAE,CAAC,CAAC;QACrD,KAAK,CAAC,MAAM,EAAE,CAAC;QAEf,6BAA6B;QAC7B,MAAM,QAAQ,GAAG,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;QAEjE,eAAe;QACf,MAAM,OAAO,EAAE,CAAC;QAChB,KAAK,CAAC,MAAM,EAAE,CAAC;QAEf,MAAM,aAAa,GAAG,MAAM,QAAQ,CAAC;QACrC,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC;IACrD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { expect, fixture, oneEvent } from '@open-wc/testing';\nimport { html, TemplateResult } from 'lit';\nimport { CustomEventType } from '../src/interfaces';\nimport { SortableList } from '../src/list/SortableList';\nimport { assertScreenshot, getClip } from './utils.test';\nimport Sinon, { useFakeTimers } from 'sinon';\n\nconst BORING_LIST = html`\n <temba-sortable-list>\n <style>\n .sortable {\n display: flex;\n align-items: center;\n justify-content: center;\n text-align: center;\n height: 20px;\n }\n </style>\n <div class=\"sortable\" id=\"chicken\" style=\"\">Chicken</div>\n <div class=\"sortable\" id=\"fish\">Fish</div>\n </temba-sortable-list>\n`;\n\nconst HORIZONTAL_LIST = html`\n <temba-sortable-list horizontal>\n <style>\n .sortable {\n display: flex;\n align-items: center;\n justify-content: center;\n text-align: center;\n height: 20px;\n width: 50px;\n }\n </style>\n <div class=\"sortable\" id=\"red\">Red</div>\n <div class=\"sortable\" id=\"blue\">Blue</div>\n <div class=\"sortable\" id=\"green\">Green</div>\n </temba-sortable-list>\n`;\n\nconst createSorter = async (def: TemplateResult) => {\n const parentNode = document.createElement('div');\n parentNode.setAttribute('style', 'width: 100px;');\n return (await fixture(def, { parentNode })) as SortableList;\n};\n\ndescribe('temba-sortable-list', () => {\n let clock: Sinon.SinonFakeTimers;\n beforeEach(function () {\n clock = useFakeTimers();\n clock.runAll();\n });\n\n afterEach(function () {\n clock.restore();\n });\n\n it('renders default', async () => {\n const list: SortableList = await createSorter(BORING_LIST);\n await assertScreenshot('list/sortable', getClip(list));\n });\n\n it('can get ids of sortable elements', async () => {\n const list: SortableList = await createSorter(BORING_LIST);\n await list.updateComplete;\n\n const ids = list.getIds();\n expect(ids).to.deep.equal(['chicken', 'fish']);\n });\n\n it('works with horizontal layout', async () => {\n const list: SortableList = await createSorter(HORIZONTAL_LIST);\n await list.updateComplete;\n\n const ids = list.getIds();\n expect(ids).to.deep.equal(['red', 'blue', 'green']);\n\n // Test horizontal drag behavior\n const bounds = list.getBoundingClientRect();\n const orderChanged = oneEvent(list, CustomEventType.OrderChanged, false);\n\n // Drag the first item (red) to after the second item (blue)\n await moveMouse(bounds.left + 10, bounds.top + 10);\n await mouseDown();\n await moveMouse(bounds.left + 80, bounds.top + 10);\n await mouseUp();\n clock.runAll();\n\n const orderEvent = await orderChanged;\n expect(orderEvent.detail).to.deep.equal({\n swap: [0, 2]\n });\n });\n\n it('handles prepareGhost callback', async () => {\n const list: SortableList = await createSorter(BORING_LIST);\n let ghostPrepared = false;\n\n list.prepareGhost = (ghost: HTMLElement) => {\n ghostPrepared = true;\n ghost.style.backgroundColor = 'red';\n };\n\n const bounds = list.getBoundingClientRect();\n\n // Start dragging to trigger ghost creation\n await moveMouse(bounds.left + 20, bounds.bottom - 10);\n await mouseDown();\n await moveMouse(bounds.left + 30, bounds.bottom - 10);\n\n expect(ghostPrepared).to.be.true;\n\n // Clean up\n await mouseUp();\n clock.runAll();\n });\n\n it('drags', async () => {\n const list: SortableList = await createSorter(BORING_LIST);\n const updated = oneEvent(list, 'change', false);\n\n const bounds = list.getBoundingClientRect();\n\n await moveMouse(bounds.left + 20, bounds.bottom - 10);\n await mouseDown();\n await moveMouse(bounds.left + 20, bounds.top + 5);\n\n // should be hovered\n await assertScreenshot('list/sortable-dragging', getClip(list));\n\n // now lets drop - this will fire the order changed event\n const orderChanged = oneEvent(list, CustomEventType.OrderChanged, false);\n await mouseUp();\n clock.runAll();\n await list.updateComplete;\n clock.runAll();\n\n // we should fire an order changed event on drop\n const orderEvent = await orderChanged;\n expect(orderEvent.detail).to.deep.equal({\n swap: [1, 0]\n });\n\n await assertScreenshot('list/sortable-dropped', getClip(list));\n\n // we should fire a change event\n const changeEvent = await updated;\n expect(changeEvent.type).to.equal('change');\n });\n\n it('detects external drag when dragging outside container', async () => {\n const list: SortableList = await createSorter(BORING_LIST);\n list.externalDrag = true;\n await list.updateComplete;\n\n const bounds = list.getBoundingClientRect();\n\n // track external drag events\n let externalDragFired = false;\n let internalDragFired = false;\n\n list.addEventListener(CustomEventType.DragExternal, () => {\n externalDragFired = true;\n });\n\n list.addEventListener(CustomEventType.DragInternal, () => {\n internalDragFired = true;\n });\n\n // start dragging an item\n await moveMouse(bounds.left + 20, bounds.bottom - 10);\n await mouseDown();\n\n // drag outside the container (far to the right)\n await moveMouse(bounds.right + 100, bounds.top + 10);\n clock.runAll();\n\n // should have fired external drag event\n expect(externalDragFired).to.be.true;\n\n // drag back inside\n externalDragFired = false; // reset\n await moveMouse(bounds.left + 20, bounds.top + 10);\n clock.runAll();\n\n // should have fired internal drag event\n expect(internalDragFired).to.be.true;\n\n // clean up\n await mouseUp();\n clock.runAll();\n });\n\n it('fires DragStop with isExternal=true when dropped outside container', async () => {\n const list: SortableList = await createSorter(BORING_LIST);\n list.externalDrag = true;\n await list.updateComplete;\n\n const bounds = list.getBoundingClientRect();\n\n // start dragging an item\n await moveMouse(bounds.left + 20, bounds.bottom - 10);\n await mouseDown();\n\n // drag outside the container\n await moveMouse(bounds.right + 100, bounds.top + 10);\n clock.runAll();\n\n // listen for drag stop event\n const dragStop = oneEvent(list, CustomEventType.DragStop, false);\n\n // drop outside\n await mouseUp();\n clock.runAll();\n\n const dragStopEvent = await dragStop;\n expect(dragStopEvent.detail.isExternal).to.be.true;\n });\n});\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { expect, fixture, html } from '@open-wc/testing';
|
|
2
2
|
import { stub } from 'sinon';
|
|
3
|
-
import { log, getHTTPCookie, getHeaders, getClasses, plural, range, hexToRgb, truncate, oxford, oxfordFn, oxfordNamed, capitalize, formatFileType, formatFileSize, isImageAttachment, stopEvent, hslToHex, hashCode, showModax, debounce, throttle, timeSince, isDate, getCookie, getCookieBoolean, setCookie, serialize, renderIf, getElementOffset, isElementVisible, getScrollParent, stubbable, renderAvatar, fillTemplate,
|
|
3
|
+
import { log, getHTTPCookie, getHeaders, getClasses, plural, range, hexToRgb, truncate, oxford, oxfordFn, oxfordNamed, capitalize, formatFileType, formatFileSize, isImageAttachment, stopEvent, hslToHex, hashCode, showModax, debounce, throttle, timeSince, isDate, getCookie, getCookieBoolean, setCookie, serialize, renderIf, getElementOffset, isElementVisible, getScrollParent, stubbable, renderAvatar, fillTemplate, getUrl, postUrl, postJSON, postFormData, postForm, fetchResultsPage, fetchResults, getAssetPage, getAssets, getDialog, DEFAULT_MEDIA_ENDPOINT, Color, COOKIE_KEYS } from '../src/utils';
|
|
4
4
|
import { mockGET, mockPOST, clearMockPosts } from './utils.test';
|
|
5
5
|
describe('utils/index', () => {
|
|
6
6
|
describe('constants', () => {
|
|
@@ -822,32 +822,6 @@ describe('utils/index', () => {
|
|
|
822
822
|
expect(result.strings).to.exist;
|
|
823
823
|
});
|
|
824
824
|
});
|
|
825
|
-
describe('spreadAttributes', () => {
|
|
826
|
-
it('spreads regular attributes', () => {
|
|
827
|
-
const attrs = { id: 'test', class: 'example' };
|
|
828
|
-
const result = spreadAttributes(attrs);
|
|
829
|
-
expect(Array.isArray(result)).to.be.true;
|
|
830
|
-
expect(result.length).to.equal(2);
|
|
831
|
-
});
|
|
832
|
-
it('handles event attributes with @', () => {
|
|
833
|
-
const attrs = { '@click': 'handleClick' };
|
|
834
|
-
const result = spreadAttributes(attrs);
|
|
835
|
-
expect(Array.isArray(result)).to.be.true;
|
|
836
|
-
expect(result.length).to.equal(1);
|
|
837
|
-
});
|
|
838
|
-
it('handles property attributes with .', () => {
|
|
839
|
-
const attrs = { '.value': 'test' };
|
|
840
|
-
const result = spreadAttributes(attrs);
|
|
841
|
-
expect(Array.isArray(result)).to.be.true;
|
|
842
|
-
expect(result.length).to.equal(1);
|
|
843
|
-
});
|
|
844
|
-
it('handles mixed attribute types', () => {
|
|
845
|
-
const attrs = { id: 'test', '@click': 'handler', '.prop': 'value' };
|
|
846
|
-
const result = spreadAttributes(attrs);
|
|
847
|
-
expect(Array.isArray(result)).to.be.true;
|
|
848
|
-
expect(result.length).to.equal(3);
|
|
849
|
-
});
|
|
850
|
-
});
|
|
851
825
|
describe('renderAvatar', () => {
|
|
852
826
|
it('renders avatar with name only', () => {
|
|
853
827
|
const result = renderAvatar({ name: 'John Doe' });
|