@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
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { css, html, PropertyValueMap, TemplateResult } from 'lit';
|
|
2
|
+
import { property } from 'lit/decorators.js';
|
|
3
|
+
import { RapidElement } from '../RapidElement';
|
|
4
|
+
import { CustomEventType } from '../interfaces';
|
|
5
|
+
import { getClasses } from '../utils';
|
|
6
|
+
|
|
7
|
+
export class FloatingTab extends RapidElement {
|
|
8
|
+
static get styles() {
|
|
9
|
+
return css`
|
|
10
|
+
.tab.hidden {
|
|
11
|
+
transform: translateX(100%);
|
|
12
|
+
}
|
|
13
|
+
.tab {
|
|
14
|
+
position: fixed;
|
|
15
|
+
right: 0;
|
|
16
|
+
z-index: 9998;
|
|
17
|
+
transition: transform var(--transition-duration, 300ms) ease-in-out;
|
|
18
|
+
display: flex;
|
|
19
|
+
align-items: center;
|
|
20
|
+
padding: 12px;
|
|
21
|
+
border-top-left-radius: 8px;
|
|
22
|
+
border-bottom-left-radius: 8px;
|
|
23
|
+
cursor: pointer;
|
|
24
|
+
box-shadow: -2px 2px 8px rgba(0, 0, 0, 0.2);
|
|
25
|
+
transition: all calc(var(--transition-duration, 300ms) * 0.7)
|
|
26
|
+
ease-in-out;
|
|
27
|
+
user-select: none;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.tab:hover {
|
|
31
|
+
padding-right: 16px;
|
|
32
|
+
box-shadow: -4px 4px 12px rgba(0, 0, 0, 0.3);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.icon-container {
|
|
36
|
+
display: flex;
|
|
37
|
+
align-items: center;
|
|
38
|
+
justify-content: center;
|
|
39
|
+
width: 32px;
|
|
40
|
+
height: 32px;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
temba-icon {
|
|
44
|
+
--icon-color: white;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.label {
|
|
48
|
+
color: white;
|
|
49
|
+
font-weight: 500;
|
|
50
|
+
font-size: 16px;
|
|
51
|
+
max-width: 0;
|
|
52
|
+
overflow: hidden;
|
|
53
|
+
white-space: nowrap;
|
|
54
|
+
margin-left: 0;
|
|
55
|
+
opacity: 0;
|
|
56
|
+
transition: all var(--transition-duration, 300ms) ease-in-out;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.tab:hover .label {
|
|
60
|
+
max-width: 200px;
|
|
61
|
+
margin-left: 12px;
|
|
62
|
+
opacity: 1;
|
|
63
|
+
}
|
|
64
|
+
`;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
static TAB_HEIGHT = 56; // height of tab for auto-stacking
|
|
68
|
+
static allTabs: FloatingTab[] = [];
|
|
69
|
+
|
|
70
|
+
@property({ type: String })
|
|
71
|
+
icon: string;
|
|
72
|
+
|
|
73
|
+
@property({ type: String })
|
|
74
|
+
label: string;
|
|
75
|
+
|
|
76
|
+
@property({ type: String })
|
|
77
|
+
color = '#6B7280';
|
|
78
|
+
|
|
79
|
+
@property({ type: Number })
|
|
80
|
+
top = -1; // -1 means auto-calculate position
|
|
81
|
+
|
|
82
|
+
@property({ type: Boolean })
|
|
83
|
+
hidden = false;
|
|
84
|
+
|
|
85
|
+
connectedCallback() {
|
|
86
|
+
super.connectedCallback();
|
|
87
|
+
FloatingTab.allTabs.push(this);
|
|
88
|
+
this.updatePosition();
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
disconnectedCallback() {
|
|
92
|
+
super.disconnectedCallback();
|
|
93
|
+
const index = FloatingTab.allTabs.indexOf(this);
|
|
94
|
+
if (index > -1) {
|
|
95
|
+
FloatingTab.allTabs.splice(index, 1);
|
|
96
|
+
}
|
|
97
|
+
// update positions of remaining tabs
|
|
98
|
+
FloatingTab.allTabs.forEach((tab) => tab.updatePosition());
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
private updatePosition() {
|
|
102
|
+
// if top is manually set, use it
|
|
103
|
+
if (this.top !== -1) {
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// auto-calculate position based on index
|
|
108
|
+
const index = FloatingTab.allTabs.indexOf(this);
|
|
109
|
+
if (index === -1) {
|
|
110
|
+
this.top = 100; // default fallback
|
|
111
|
+
} else {
|
|
112
|
+
// start at 100px and stack with 10px gap between tabs
|
|
113
|
+
this.top = 100 + index * (FloatingTab.TAB_HEIGHT + 10);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
public updated(
|
|
118
|
+
changes: PropertyValueMap<any> | Map<PropertyKey, unknown>
|
|
119
|
+
): void {
|
|
120
|
+
super.updated(changes);
|
|
121
|
+
if (changes.has('hidden')) {
|
|
122
|
+
this.classList.toggle('hidden', this.hidden);
|
|
123
|
+
}
|
|
124
|
+
if (changes.has('top')) {
|
|
125
|
+
this.updatePosition();
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
private handleClick() {
|
|
130
|
+
// hide all tabs when one is clicked
|
|
131
|
+
FloatingTab.allTabs.forEach((tab) => {
|
|
132
|
+
tab.hidden = true;
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
this.fireCustomEvent(CustomEventType.ButtonClicked, {
|
|
136
|
+
action: 'toggle'
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
public static showAllTabs() {
|
|
141
|
+
FloatingTab.allTabs.forEach((tab) => {
|
|
142
|
+
tab.hidden = false;
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
public static hideAllTabs() {
|
|
147
|
+
FloatingTab.allTabs.forEach((tab) => {
|
|
148
|
+
tab.hidden = true;
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
public render(): TemplateResult {
|
|
153
|
+
const tabStyle = `
|
|
154
|
+
background-color: ${this.color};
|
|
155
|
+
top: ${this.top}px;
|
|
156
|
+
`;
|
|
157
|
+
|
|
158
|
+
const classes = getClasses({
|
|
159
|
+
tab: true,
|
|
160
|
+
hidden: this.hidden
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
return html`
|
|
164
|
+
<div class="${classes}" style="${tabStyle}" @click=${this.handleClick}>
|
|
165
|
+
<div class="icon-container">
|
|
166
|
+
${this.icon
|
|
167
|
+
? html`<temba-icon size="2" name="${this.icon}"></temba-icon>`
|
|
168
|
+
: ''}
|
|
169
|
+
</div>
|
|
170
|
+
<div class="label">${this.label}</div>
|
|
171
|
+
</div>
|
|
172
|
+
`;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
@@ -77,6 +77,15 @@ export class ProgressBar extends RapidElement {
|
|
|
77
77
|
display: none;
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
+
.meter.static > span:after {
|
|
81
|
+
display: none;
|
|
82
|
+
animation: none;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.meter.static > span {
|
|
86
|
+
background-image: none;
|
|
87
|
+
}
|
|
88
|
+
|
|
80
89
|
@keyframes move {
|
|
81
90
|
0% {
|
|
82
91
|
background-position: 0 0;
|
|
@@ -154,6 +163,9 @@ export class ProgressBar extends RapidElement {
|
|
|
154
163
|
@property({ type: String })
|
|
155
164
|
message: string;
|
|
156
165
|
|
|
166
|
+
@property({ type: Boolean })
|
|
167
|
+
animated = true;
|
|
168
|
+
|
|
157
169
|
public updated(
|
|
158
170
|
changes: PropertyValueMap<any> | Map<PropertyKey, unknown>
|
|
159
171
|
): void {
|
|
@@ -162,7 +174,7 @@ export class ProgressBar extends RapidElement {
|
|
|
162
174
|
this.showEstimatedCompletion = this.estimatedCompletionDate > new Date();
|
|
163
175
|
}
|
|
164
176
|
|
|
165
|
-
if (changes.has('current')) {
|
|
177
|
+
if (changes.has('current') || changes.has('total')) {
|
|
166
178
|
const pct = Math.floor(Math.min((this.current / this.total) * 100, 100));
|
|
167
179
|
if (Number.isNaN(pct)) {
|
|
168
180
|
this.showPercentage = false;
|
|
@@ -176,8 +188,16 @@ export class ProgressBar extends RapidElement {
|
|
|
176
188
|
}
|
|
177
189
|
|
|
178
190
|
public render(): TemplateResult {
|
|
191
|
+
const meterClasses = [
|
|
192
|
+
'meter',
|
|
193
|
+
this.done ? 'done' : '',
|
|
194
|
+
this.animated ? '' : 'static'
|
|
195
|
+
]
|
|
196
|
+
.filter(Boolean)
|
|
197
|
+
.join(' ');
|
|
198
|
+
|
|
179
199
|
return html`<div class="wrapper ${this.done ? 'complete' : ''}">
|
|
180
|
-
<div class="
|
|
200
|
+
<div class="${meterClasses}">
|
|
181
201
|
${this.message
|
|
182
202
|
? html`<div class="message">${this.message}</div>`
|
|
183
203
|
: null}
|
package/src/events.ts
CHANGED
|
@@ -10,7 +10,6 @@ export interface ContactEvent {
|
|
|
10
10
|
uuid?: string;
|
|
11
11
|
type: string;
|
|
12
12
|
created_on: string;
|
|
13
|
-
created_by?: User; // deprecated
|
|
14
13
|
_user?: ObjectReference;
|
|
15
14
|
}
|
|
16
15
|
|
|
@@ -58,12 +57,8 @@ export interface ChatStartedEvent extends ContactEvent {
|
|
|
58
57
|
export interface MsgEvent extends ContactEvent {
|
|
59
58
|
msg: Msg;
|
|
60
59
|
optin?: ObjectReference;
|
|
61
|
-
_status?: string;
|
|
62
|
-
_failed_reason?: string;
|
|
60
|
+
_status?: { created_on: string; status: string; reason: string };
|
|
63
61
|
_logs_url?: string;
|
|
64
|
-
status?: string; // deprecated
|
|
65
|
-
failed_reason_display?: string; // deprecated
|
|
66
|
-
logs_url?: string; // deprecated
|
|
67
62
|
}
|
|
68
63
|
|
|
69
64
|
export interface RunEvent extends ContactEvent {
|
|
@@ -111,10 +106,9 @@ export interface AirtimeTransferredEvent extends ContactEvent {
|
|
|
111
106
|
export type CallStartedEvent = ContactEvent;
|
|
112
107
|
|
|
113
108
|
export interface ContactHistoryPage {
|
|
109
|
+
events: ContactEvent[];
|
|
114
110
|
has_older: boolean;
|
|
115
111
|
recent_only: boolean;
|
|
116
112
|
next_before: number;
|
|
117
113
|
next_after: number;
|
|
118
|
-
start_date: Date;
|
|
119
|
-
events: ContactEvent[];
|
|
120
114
|
}
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import { css, html, PropertyValueMap, TemplateResult } from 'lit';
|
|
2
|
+
import { property, state } from 'lit/decorators.js';
|
|
3
|
+
import { RapidElement } from '../RapidElement';
|
|
4
|
+
import { CustomEventType } from '../interfaces';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Event detail for canvas menu selection
|
|
8
|
+
*/
|
|
9
|
+
export interface CanvasMenuSelection {
|
|
10
|
+
action: 'sticky' | 'action' | 'split';
|
|
11
|
+
position: { x: number; y: number };
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* CanvasMenu - A popup menu for adding items to the flow canvas
|
|
16
|
+
* Displayed when double-clicking on empty canvas space
|
|
17
|
+
*/
|
|
18
|
+
export class CanvasMenu extends RapidElement {
|
|
19
|
+
static get styles() {
|
|
20
|
+
return css`
|
|
21
|
+
:host {
|
|
22
|
+
position: fixed;
|
|
23
|
+
z-index: 10000;
|
|
24
|
+
display: block;
|
|
25
|
+
pointer-events: none;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.menu {
|
|
29
|
+
position: fixed;
|
|
30
|
+
background: white;
|
|
31
|
+
border-radius: var(--curvature);
|
|
32
|
+
box-shadow: var(--dropdown-shadow);
|
|
33
|
+
padding: 0.5em 0;
|
|
34
|
+
width: 265px;
|
|
35
|
+
pointer-events: auto;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.menu-item {
|
|
39
|
+
padding: 0.75em 1.5em;
|
|
40
|
+
cursor: pointer;
|
|
41
|
+
display: flex;
|
|
42
|
+
align-items: flex-start;
|
|
43
|
+
gap: 0.75em;
|
|
44
|
+
transition: background-color 0.15s ease;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.menu-item:hover {
|
|
48
|
+
background-color: rgba(0, 0, 0, 0.05);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.menu-item temba-icon {
|
|
52
|
+
--icon-color: var(--color-text);
|
|
53
|
+
margin-top: 0.15em;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.menu-item-content {
|
|
57
|
+
display: flex;
|
|
58
|
+
flex-direction: column;
|
|
59
|
+
gap: 0.15em;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.menu-item-title {
|
|
63
|
+
font-weight: 500;
|
|
64
|
+
font-size: 1rem;
|
|
65
|
+
color: var(--color-text-dark);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.menu-item-description {
|
|
69
|
+
font-size: 0.85rem;
|
|
70
|
+
color: var(--color-text);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.divider {
|
|
74
|
+
height: 1px;
|
|
75
|
+
background: rgba(0, 0, 0, 0.1);
|
|
76
|
+
margin: 0.5em 0;
|
|
77
|
+
}
|
|
78
|
+
`;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
@property({ type: Number })
|
|
82
|
+
public x = 0;
|
|
83
|
+
|
|
84
|
+
@property({ type: Number })
|
|
85
|
+
public y = 0;
|
|
86
|
+
|
|
87
|
+
@property({ type: Boolean })
|
|
88
|
+
public open = false;
|
|
89
|
+
|
|
90
|
+
@state()
|
|
91
|
+
private clickPosition = { x: 0, y: 0 };
|
|
92
|
+
|
|
93
|
+
protected firstUpdated(
|
|
94
|
+
_changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>
|
|
95
|
+
): void {
|
|
96
|
+
super.firstUpdated(_changedProperties);
|
|
97
|
+
|
|
98
|
+
// Close menu when clicking outside
|
|
99
|
+
const handleClickOutside = (e: MouseEvent) => {
|
|
100
|
+
if (this.open && !this.contains(e.target as Node)) {
|
|
101
|
+
this.close();
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
document.addEventListener('click', handleClickOutside);
|
|
106
|
+
|
|
107
|
+
// Store cleanup function
|
|
108
|
+
(this as any)._clickOutsideHandler = handleClickOutside;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
disconnectedCallback(): void {
|
|
112
|
+
super.disconnectedCallback();
|
|
113
|
+
if ((this as any)._clickOutsideHandler) {
|
|
114
|
+
document.removeEventListener('click', (this as any)._clickOutsideHandler);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
public show(x: number, y: number, clickPosition: { x: number; y: number }) {
|
|
119
|
+
this.x = x;
|
|
120
|
+
this.y = y;
|
|
121
|
+
this.clickPosition = clickPosition;
|
|
122
|
+
this.open = true;
|
|
123
|
+
|
|
124
|
+
// Adjust position after menu renders to ensure it fits on screen
|
|
125
|
+
requestAnimationFrame(() => {
|
|
126
|
+
this.adjustPosition();
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
private adjustPosition(): void {
|
|
131
|
+
const menuElement = this.shadowRoot?.querySelector('.menu') as HTMLElement;
|
|
132
|
+
if (!menuElement) return;
|
|
133
|
+
|
|
134
|
+
const menuRect = menuElement.getBoundingClientRect();
|
|
135
|
+
const viewportWidth = window.innerWidth;
|
|
136
|
+
const viewportHeight = window.innerHeight;
|
|
137
|
+
const margin = 10; // margin from viewport edges
|
|
138
|
+
|
|
139
|
+
let adjustedX = this.x;
|
|
140
|
+
let adjustedY = this.y;
|
|
141
|
+
|
|
142
|
+
// Check if menu goes off the right edge
|
|
143
|
+
if (this.x + menuRect.width + margin > viewportWidth) {
|
|
144
|
+
adjustedX = viewportWidth - menuRect.width - margin;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// Check if menu goes off the bottom edge
|
|
148
|
+
if (this.y + menuRect.height + margin > viewportHeight) {
|
|
149
|
+
adjustedY = viewportHeight - menuRect.height - margin;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// Update position if needed
|
|
153
|
+
if (adjustedX !== this.x || adjustedY !== this.y) {
|
|
154
|
+
this.x = adjustedX;
|
|
155
|
+
this.y = adjustedY;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
public close() {
|
|
160
|
+
this.open = false;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
private handleMenuItemClick(action: 'sticky' | 'action' | 'split') {
|
|
164
|
+
this.fireCustomEvent(CustomEventType.Selection, {
|
|
165
|
+
action,
|
|
166
|
+
position: this.clickPosition
|
|
167
|
+
} as CanvasMenuSelection);
|
|
168
|
+
this.close();
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
public render(): TemplateResult {
|
|
172
|
+
if (!this.open) {
|
|
173
|
+
return html``;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
return html`
|
|
177
|
+
<div class="menu" style="left: ${this.x}px; top: ${this.y}px;">
|
|
178
|
+
<div
|
|
179
|
+
class="menu-item"
|
|
180
|
+
@click=${() => this.handleMenuItemClick('action')}
|
|
181
|
+
>
|
|
182
|
+
<temba-icon name="action" size="1.25"></temba-icon>
|
|
183
|
+
<div class="menu-item-content">
|
|
184
|
+
<div class="menu-item-title">Add Action</div>
|
|
185
|
+
<div class="menu-item-description">
|
|
186
|
+
Send messages, update contacts
|
|
187
|
+
</div>
|
|
188
|
+
</div>
|
|
189
|
+
</div>
|
|
190
|
+
|
|
191
|
+
<div
|
|
192
|
+
class="menu-item"
|
|
193
|
+
@click=${() => this.handleMenuItemClick('split')}
|
|
194
|
+
>
|
|
195
|
+
<temba-icon name="split" size="1.25"></temba-icon>
|
|
196
|
+
<div class="menu-item-content">
|
|
197
|
+
<div class="menu-item-title">Add Split</div>
|
|
198
|
+
<div class="menu-item-description">Branch based on conditions</div>
|
|
199
|
+
</div>
|
|
200
|
+
</div>
|
|
201
|
+
|
|
202
|
+
<div class="divider"></div>
|
|
203
|
+
|
|
204
|
+
<div
|
|
205
|
+
class="menu-item"
|
|
206
|
+
@click=${() => this.handleMenuItemClick('sticky')}
|
|
207
|
+
>
|
|
208
|
+
<temba-icon name="note" size="1.25"></temba-icon>
|
|
209
|
+
<div class="menu-item-content">
|
|
210
|
+
<div class="menu-item-title">Add Sticky Note</div>
|
|
211
|
+
<div class="menu-item-description">Add a note to the canvas</div>
|
|
212
|
+
</div>
|
|
213
|
+
</div>
|
|
214
|
+
</div>
|
|
215
|
+
`;
|
|
216
|
+
}
|
|
217
|
+
}
|