@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,11 +1,12 @@
|
|
|
1
1
|
import { html } from 'lit-html';
|
|
2
|
-
import { ActionConfig,
|
|
2
|
+
import { ActionConfig, ACTION_GROUPS, FormData, FlowTypes } from '../types';
|
|
3
3
|
import { Node, AddToGroup } from '../../store/flow-definition';
|
|
4
4
|
import { renderNamedObjects } from '../utils';
|
|
5
5
|
|
|
6
6
|
export const add_contact_groups: ActionConfig = {
|
|
7
7
|
name: 'Add to Group',
|
|
8
|
-
|
|
8
|
+
group: ACTION_GROUPS.contacts,
|
|
9
|
+
flowTypes: [FlowTypes.VOICE, FlowTypes.MESSAGE, FlowTypes.BACKGROUND],
|
|
9
10
|
render: (_node: Node, action: AddToGroup) => {
|
|
10
11
|
return html`<div>${renderNamedObjects(action.groups, 'group')}</div>`;
|
|
11
12
|
},
|
|
@@ -13,7 +14,7 @@ export const add_contact_groups: ActionConfig = {
|
|
|
13
14
|
// Form-level transformations - default 1:1 mapping for this case
|
|
14
15
|
toFormData: (action: AddToGroup) => {
|
|
15
16
|
return {
|
|
16
|
-
groups: action.groups ||
|
|
17
|
+
groups: action.groups || null,
|
|
17
18
|
uuid: action.uuid
|
|
18
19
|
};
|
|
19
20
|
},
|
|
@@ -47,7 +48,7 @@ export const add_contact_groups: ActionConfig = {
|
|
|
47
48
|
}
|
|
48
49
|
}
|
|
49
50
|
},
|
|
50
|
-
fromFormData: (formData:
|
|
51
|
+
fromFormData: (formData: FormData): AddToGroup => {
|
|
51
52
|
return {
|
|
52
53
|
uuid: formData.uuid,
|
|
53
54
|
type: 'add_contact_groups',
|
|
@@ -1,17 +1,91 @@
|
|
|
1
1
|
import { html } from 'lit-html';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
ActionConfig,
|
|
4
|
+
ACTION_GROUPS,
|
|
5
|
+
FormData,
|
|
6
|
+
ValidationResult,
|
|
7
|
+
FlowTypes
|
|
8
|
+
} from '../types';
|
|
3
9
|
import { Node, AddContactUrn } from '../../store/flow-definition';
|
|
4
|
-
import {
|
|
10
|
+
import { SCHEMES } from '../utils';
|
|
5
11
|
|
|
6
12
|
export const add_contact_urn: ActionConfig = {
|
|
7
13
|
name: 'Add URN',
|
|
8
|
-
|
|
14
|
+
group: ACTION_GROUPS.contacts,
|
|
15
|
+
flowTypes: [FlowTypes.VOICE, FlowTypes.MESSAGE, FlowTypes.BACKGROUND],
|
|
9
16
|
render: (_node: Node, action: AddContactUrn) => {
|
|
10
|
-
const
|
|
17
|
+
const schemeObj = SCHEMES.find((s) => s.scheme === action.scheme);
|
|
18
|
+
const friendlyScheme = schemeObj?.path || action.scheme;
|
|
11
19
|
return html`<div
|
|
12
20
|
style="word-wrap: break-word; overflow-wrap: break-word; hyphens: auto;"
|
|
13
21
|
>
|
|
14
22
|
Add ${friendlyScheme} <strong>${action.path}</strong>
|
|
15
23
|
</div>`;
|
|
24
|
+
},
|
|
25
|
+
|
|
26
|
+
toFormData: (action: AddContactUrn) => {
|
|
27
|
+
const schemeObj = SCHEMES.find((s) => s.scheme === action.scheme);
|
|
28
|
+
return {
|
|
29
|
+
uuid: action.uuid,
|
|
30
|
+
scheme: schemeObj
|
|
31
|
+
? [{ name: schemeObj.path, value: action.scheme }]
|
|
32
|
+
: null,
|
|
33
|
+
path: action.path || ''
|
|
34
|
+
};
|
|
35
|
+
},
|
|
36
|
+
|
|
37
|
+
fromFormData: (formData: FormData): AddContactUrn => {
|
|
38
|
+
// Extract scheme value from select format
|
|
39
|
+
const schemeValue =
|
|
40
|
+
Array.isArray(formData.scheme) && formData.scheme.length > 0
|
|
41
|
+
? formData.scheme[0].value
|
|
42
|
+
: 'tel';
|
|
43
|
+
|
|
44
|
+
return {
|
|
45
|
+
uuid: formData.uuid,
|
|
46
|
+
type: 'add_contact_urn',
|
|
47
|
+
scheme: schemeValue,
|
|
48
|
+
path: formData.path || ''
|
|
49
|
+
};
|
|
50
|
+
},
|
|
51
|
+
|
|
52
|
+
form: {
|
|
53
|
+
scheme: {
|
|
54
|
+
type: 'select',
|
|
55
|
+
label: 'URN Type',
|
|
56
|
+
helpText: 'Select the type of URN to add to the contact',
|
|
57
|
+
required: true,
|
|
58
|
+
searchable: false,
|
|
59
|
+
multi: false,
|
|
60
|
+
options: SCHEMES.map((scheme) => ({
|
|
61
|
+
name: scheme.path,
|
|
62
|
+
value: scheme.scheme
|
|
63
|
+
}))
|
|
64
|
+
},
|
|
65
|
+
path: {
|
|
66
|
+
type: 'text',
|
|
67
|
+
label: 'URN Value',
|
|
68
|
+
helpText: 'Enter the URN value (e.g., phone number, Facebook ID, etc.)',
|
|
69
|
+
required: true,
|
|
70
|
+
placeholder: 'Enter the URN value...',
|
|
71
|
+
evaluated: true
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
|
|
75
|
+
validate: (formData: FormData): ValidationResult => {
|
|
76
|
+
const errors: { [key: string]: string } = {};
|
|
77
|
+
|
|
78
|
+
if (!formData.scheme || formData.scheme.length === 0) {
|
|
79
|
+
errors.scheme = 'URN type is required';
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if (!formData.path || formData.path.trim() === '') {
|
|
83
|
+
errors.path = 'URN value is required';
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return {
|
|
87
|
+
valid: Object.keys(errors).length === 0,
|
|
88
|
+
errors
|
|
89
|
+
};
|
|
16
90
|
}
|
|
17
91
|
};
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { html } from 'lit-html';
|
|
2
|
-
import { ActionConfig,
|
|
2
|
+
import { ActionConfig, ACTION_GROUPS, FormData, FlowTypes } from '../types';
|
|
3
3
|
import { Node, AddInputLabels } from '../../store/flow-definition';
|
|
4
4
|
import { renderNamedObjects } from '../utils';
|
|
5
5
|
|
|
6
6
|
export const add_input_labels: ActionConfig = {
|
|
7
7
|
name: 'Add Input Labels',
|
|
8
|
-
|
|
8
|
+
group: ACTION_GROUPS.save,
|
|
9
|
+
flowTypes: [FlowTypes.VOICE, FlowTypes.MESSAGE, FlowTypes.BACKGROUND],
|
|
9
10
|
render: (_node: Node, action: AddInputLabels) => {
|
|
10
11
|
return html`<div>${renderNamedObjects(action.labels, 'label')}</div>`;
|
|
11
12
|
},
|
|
@@ -13,7 +14,7 @@ export const add_input_labels: ActionConfig = {
|
|
|
13
14
|
// Form-level transformations
|
|
14
15
|
toFormData: (action: AddInputLabels) => {
|
|
15
16
|
return {
|
|
16
|
-
labels: action.labels ||
|
|
17
|
+
labels: action.labels || null,
|
|
17
18
|
uuid: action.uuid
|
|
18
19
|
};
|
|
19
20
|
},
|
|
@@ -48,7 +49,7 @@ export const add_input_labels: ActionConfig = {
|
|
|
48
49
|
}
|
|
49
50
|
}
|
|
50
51
|
},
|
|
51
|
-
fromFormData: (formData:
|
|
52
|
+
fromFormData: (formData: FormData): AddInputLabels => {
|
|
52
53
|
return {
|
|
53
54
|
uuid: formData.uuid,
|
|
54
55
|
type: 'add_input_labels',
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { html } from 'lit-html';
|
|
2
|
-
import { ActionConfig,
|
|
2
|
+
import { ActionConfig, ACTION_GROUPS, FlowTypes } from '../types';
|
|
3
3
|
import { Node, PlayAudio } from '../../store/flow-definition';
|
|
4
4
|
|
|
5
5
|
export const play_audio: ActionConfig = {
|
|
6
6
|
name: 'Play Audio',
|
|
7
|
-
|
|
7
|
+
group: ACTION_GROUPS.send,
|
|
8
|
+
flowTypes: [FlowTypes.VOICE],
|
|
8
9
|
render: (_node: Node, _action: PlayAudio) => {
|
|
9
10
|
// This will need to be implemented based on the actual render logic
|
|
10
11
|
return html`<div>Play Audio</div>`;
|
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
import { html } from 'lit-html';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
ActionConfig,
|
|
4
|
+
ACTION_GROUPS,
|
|
5
|
+
FormData,
|
|
6
|
+
ValidationResult,
|
|
7
|
+
FlowTypes
|
|
8
|
+
} from '../types';
|
|
3
9
|
import { Node, RemoveFromGroup } from '../../store/flow-definition';
|
|
4
10
|
import { renderNamedObjects } from '../utils';
|
|
5
11
|
|
|
6
12
|
export const remove_contact_groups: ActionConfig = {
|
|
7
13
|
name: 'Remove from Group',
|
|
8
|
-
|
|
14
|
+
group: ACTION_GROUPS.contacts,
|
|
15
|
+
flowTypes: [FlowTypes.VOICE, FlowTypes.MESSAGE, FlowTypes.BACKGROUND],
|
|
9
16
|
render: (_node: Node, action: RemoveFromGroup) => {
|
|
10
17
|
if (action.all_groups) {
|
|
11
18
|
return html`<div>Remove from all groups</div>`;
|
|
@@ -16,7 +23,7 @@ export const remove_contact_groups: ActionConfig = {
|
|
|
16
23
|
return {
|
|
17
24
|
uuid: action.uuid,
|
|
18
25
|
all_groups: action.all_groups || false,
|
|
19
|
-
groups: action.groups ||
|
|
26
|
+
groups: action.groups || null
|
|
20
27
|
};
|
|
21
28
|
},
|
|
22
29
|
form: {
|
|
@@ -42,10 +49,13 @@ export const remove_contact_groups: ActionConfig = {
|
|
|
42
49
|
'Check this to remove the contact from all groups instead of specific ones'
|
|
43
50
|
}
|
|
44
51
|
},
|
|
45
|
-
validate: (
|
|
52
|
+
validate: (formData: FormData): ValidationResult => {
|
|
46
53
|
const errors: { [key: string]: string } = {};
|
|
47
54
|
|
|
48
|
-
if (
|
|
55
|
+
if (
|
|
56
|
+
!formData.all_groups &&
|
|
57
|
+
(!formData.groups || formData.groups.length === 0)
|
|
58
|
+
) {
|
|
49
59
|
errors.groups =
|
|
50
60
|
'At least one group must be selected or check "Remove from All Groups"';
|
|
51
61
|
}
|
|
@@ -55,7 +65,7 @@ export const remove_contact_groups: ActionConfig = {
|
|
|
55
65
|
errors
|
|
56
66
|
};
|
|
57
67
|
},
|
|
58
|
-
fromFormData: (formData:
|
|
68
|
+
fromFormData: (formData: FormData): RemoveFromGroup => {
|
|
59
69
|
return {
|
|
60
70
|
uuid: formData.uuid,
|
|
61
71
|
type: 'remove_contact_groups',
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { html } from 'lit-html';
|
|
2
|
-
import { ActionConfig,
|
|
2
|
+
import { ActionConfig, ACTION_GROUPS } from '../types';
|
|
3
3
|
import { Node, RequestOptin } from '../../store/flow-definition';
|
|
4
4
|
|
|
5
5
|
export const request_optin: ActionConfig = {
|
|
6
6
|
name: 'Request Opt-in',
|
|
7
|
-
|
|
7
|
+
group: ACTION_GROUPS.send,
|
|
8
|
+
flowTypes: [],
|
|
8
9
|
render: (_node: Node, _action: RequestOptin) => {
|
|
9
10
|
// This will need to be implemented based on the actual render logic
|
|
10
11
|
return html`<div>Request Opt-in</div>`;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { html } from 'lit-html';
|
|
2
|
-
import { ActionConfig,
|
|
2
|
+
import { ActionConfig, ACTION_GROUPS, FlowTypes } from '../types';
|
|
3
3
|
import { Node, SayMsg } from '../../store/flow-definition';
|
|
4
4
|
|
|
5
5
|
export const say_msg: ActionConfig = {
|
|
6
6
|
name: 'Say Message',
|
|
7
|
-
|
|
7
|
+
group: ACTION_GROUPS.send,
|
|
8
|
+
flowTypes: [FlowTypes.VOICE],
|
|
8
9
|
render: (_node: Node, _action: SayMsg) => {
|
|
9
10
|
// This will need to be implemented based on the actual render logic
|
|
10
11
|
return html`<div>Say Message</div>`;
|
|
@@ -1,35 +1,98 @@
|
|
|
1
1
|
import { html } from 'lit-html';
|
|
2
|
-
import { ActionConfig,
|
|
2
|
+
import { ActionConfig, ACTION_GROUPS, FormData, FlowTypes } from '../types';
|
|
3
3
|
import { Node, SendBroadcast } from '../../store/flow-definition';
|
|
4
|
-
import {
|
|
4
|
+
import { renderStringList } from '../utils';
|
|
5
|
+
import { Icon } from '../../Icons';
|
|
5
6
|
|
|
6
7
|
export const send_broadcast: ActionConfig = {
|
|
7
8
|
name: 'Send Broadcast',
|
|
8
|
-
|
|
9
|
+
group: ACTION_GROUPS.broadcast,
|
|
10
|
+
flowTypes: [FlowTypes.VOICE, FlowTypes.MESSAGE, FlowTypes.BACKGROUND],
|
|
9
11
|
render: (_node: Node, action: SendBroadcast) => {
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
+
const recipients = [
|
|
13
|
+
...(action.contacts || []).map((c) => c.name),
|
|
14
|
+
...(action.groups || []).map((g) => g.name)
|
|
15
|
+
];
|
|
12
16
|
|
|
13
17
|
return html`<div>
|
|
14
|
-
<div
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
+
<div>${renderStringList(recipients, Icon.contacts)}</div>
|
|
19
|
+
<div style="margin-top: 0.5em">
|
|
20
|
+
<div
|
|
21
|
+
style="word-wrap: break-word; overflow-wrap: break-word; hyphens: auto;"
|
|
22
|
+
>
|
|
23
|
+
${action.text}
|
|
24
|
+
</div>
|
|
18
25
|
</div>
|
|
19
|
-
${hasGroups
|
|
20
|
-
? html`<div style="margin-bottom: 0.25em">
|
|
21
|
-
<div style="font-weight: bold; margin-bottom: 0.25em">Groups:</div>
|
|
22
|
-
${renderNamedObjects(action.groups, 'group')}
|
|
23
|
-
</div>`
|
|
24
|
-
: null}
|
|
25
|
-
${hasContacts
|
|
26
|
-
? html`<div>
|
|
27
|
-
<div style="font-weight: bold; margin-bottom: 0.25em">
|
|
28
|
-
Contacts:
|
|
29
|
-
</div>
|
|
30
|
-
${renderNamedObjects(action.contacts, 'contact')}
|
|
31
|
-
</div>`
|
|
32
|
-
: null}
|
|
33
26
|
</div>`;
|
|
27
|
+
},
|
|
28
|
+
|
|
29
|
+
form: {
|
|
30
|
+
recipients: {
|
|
31
|
+
type: 'select',
|
|
32
|
+
label: 'Recipients',
|
|
33
|
+
helpText: 'Select the contacts or groups to receive the broadcast',
|
|
34
|
+
options: [],
|
|
35
|
+
multi: true,
|
|
36
|
+
searchable: true,
|
|
37
|
+
endpoint: '/api/v2/contacts.json',
|
|
38
|
+
valueKey: 'uuid',
|
|
39
|
+
nameKey: 'name',
|
|
40
|
+
placeholder: 'Search for contacts or groups...',
|
|
41
|
+
required: true
|
|
42
|
+
},
|
|
43
|
+
text: {
|
|
44
|
+
type: 'message-editor',
|
|
45
|
+
label: 'Message',
|
|
46
|
+
helpText:
|
|
47
|
+
'Enter the message to send with optional attachments. You can use expressions like @contact.name',
|
|
48
|
+
required: true,
|
|
49
|
+
evaluated: true,
|
|
50
|
+
placeholder: 'Type your message here...',
|
|
51
|
+
maxAttachments: 10,
|
|
52
|
+
accept: '',
|
|
53
|
+
endpoint: '/api/v2/media.json',
|
|
54
|
+
counter: 'temba-charcount',
|
|
55
|
+
gsm: true,
|
|
56
|
+
autogrow: true
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
|
|
60
|
+
layout: ['recipients', 'text'],
|
|
61
|
+
|
|
62
|
+
toFormData: (action: SendBroadcast) => {
|
|
63
|
+
return {
|
|
64
|
+
uuid: action.uuid,
|
|
65
|
+
recipients: [...(action.contacts || []), ...(action.groups || [])],
|
|
66
|
+
text: action.text || '',
|
|
67
|
+
attachments: action.attachments || []
|
|
68
|
+
};
|
|
69
|
+
},
|
|
70
|
+
|
|
71
|
+
fromFormData: (formData: FormData): SendBroadcast => {
|
|
72
|
+
const recipients = formData.recipients || [];
|
|
73
|
+
const contacts = recipients.filter((r: any) => !r.group);
|
|
74
|
+
const groups = recipients.filter((r: any) => r.group);
|
|
75
|
+
|
|
76
|
+
const result: SendBroadcast = {
|
|
77
|
+
uuid: formData.uuid,
|
|
78
|
+
type: 'send_broadcast',
|
|
79
|
+
text: formData.text || '',
|
|
80
|
+
contacts,
|
|
81
|
+
groups,
|
|
82
|
+
attachments: formData.attachments || []
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
// Remove empty attachments array to match original format
|
|
86
|
+
if (result.attachments.length === 0) {
|
|
87
|
+
delete result.attachments;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return result;
|
|
91
|
+
},
|
|
92
|
+
|
|
93
|
+
sanitize: (formData: FormData): void => {
|
|
94
|
+
if (formData.text && typeof formData.text === 'string') {
|
|
95
|
+
formData.text = formData.text.trim();
|
|
96
|
+
}
|
|
34
97
|
}
|
|
35
98
|
};
|
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
import { html } from 'lit-html';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
ActionConfig,
|
|
4
|
+
ACTION_GROUPS,
|
|
5
|
+
FormData,
|
|
6
|
+
ValidationResult,
|
|
7
|
+
FlowTypes
|
|
8
|
+
} from '../types';
|
|
3
9
|
import { Node, SendEmail } from '../../store/flow-definition';
|
|
4
10
|
import { renderStringList } from '../utils';
|
|
5
11
|
import { Icon } from '../../Icons';
|
|
6
12
|
|
|
7
13
|
export const send_email: ActionConfig = {
|
|
8
14
|
name: 'Send Email',
|
|
9
|
-
|
|
15
|
+
group: ACTION_GROUPS.broadcast,
|
|
16
|
+
flowTypes: [FlowTypes.VOICE, FlowTypes.MESSAGE, FlowTypes.BACKGROUND],
|
|
10
17
|
render: (_node: Node, action: SendEmail) => {
|
|
11
18
|
return html`<div>
|
|
12
19
|
<div>${renderStringList(action.addresses, Icon.email)}</div>
|
|
@@ -23,7 +30,6 @@ export const send_email: ActionConfig = {
|
|
|
23
30
|
addresses: {
|
|
24
31
|
type: 'select',
|
|
25
32
|
label: 'Recipients',
|
|
26
|
-
options: [],
|
|
27
33
|
multi: true,
|
|
28
34
|
searchable: true,
|
|
29
35
|
placeholder: 'Search for contacts...',
|
|
@@ -43,7 +49,7 @@ export const send_email: ActionConfig = {
|
|
|
43
49
|
minHeight: 175
|
|
44
50
|
}
|
|
45
51
|
},
|
|
46
|
-
fromFormData: (formData:
|
|
52
|
+
fromFormData: (formData: FormData): SendEmail => {
|
|
47
53
|
return {
|
|
48
54
|
uuid: formData.uuid,
|
|
49
55
|
type: 'send_email',
|
|
@@ -54,10 +60,10 @@ export const send_email: ActionConfig = {
|
|
|
54
60
|
body: formData.body
|
|
55
61
|
};
|
|
56
62
|
},
|
|
57
|
-
validate: (
|
|
63
|
+
validate: (formData: FormData): ValidationResult => {
|
|
58
64
|
const errors: { [key: string]: string } = {};
|
|
59
65
|
|
|
60
|
-
if (!
|
|
66
|
+
if (!formData.addresses || formData.addresses.length === 0) {
|
|
61
67
|
errors.addresses = 'At least one recipient email address is required';
|
|
62
68
|
}
|
|
63
69
|
|
|
@@ -1,19 +1,26 @@
|
|
|
1
1
|
import { html } from 'lit-html';
|
|
2
2
|
import { unsafeHTML } from 'lit-html/directives/unsafe-html.js';
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
ActionConfig,
|
|
5
|
+
ACTION_GROUPS,
|
|
6
|
+
FormData,
|
|
7
|
+
ValidationResult,
|
|
8
|
+
FlowTypes
|
|
9
|
+
} from '../types';
|
|
4
10
|
import { Node, SendMsg } from '../../store/flow-definition';
|
|
5
11
|
import { titleCase } from '../../utils';
|
|
6
12
|
|
|
7
13
|
export const send_msg: ActionConfig = {
|
|
8
14
|
name: 'Send Message',
|
|
9
|
-
|
|
15
|
+
group: ACTION_GROUPS.send,
|
|
16
|
+
flowTypes: [FlowTypes.VOICE, FlowTypes.MESSAGE, FlowTypes.BACKGROUND],
|
|
10
17
|
render: (_node: Node, action: SendMsg) => {
|
|
11
18
|
const text = action.text.replace(/\n/g, '<br>');
|
|
12
19
|
return html`
|
|
13
20
|
${unsafeHTML(text)}
|
|
14
|
-
${action.quick_replies?.length > 0
|
|
21
|
+
${(action.quick_replies || [])?.length > 0
|
|
15
22
|
? html`<div class="quick-replies">
|
|
16
|
-
${action.quick_replies.map((reply) => {
|
|
23
|
+
${(action.quick_replies || []).map((reply) => {
|
|
17
24
|
return html`<div class="quick-reply">${reply}</div>`;
|
|
18
25
|
})}
|
|
19
26
|
${action.template
|
|
@@ -91,11 +98,11 @@ export const send_msg: ActionConfig = {
|
|
|
91
98
|
label: 'Quick Replies',
|
|
92
99
|
items: ['quick_replies'],
|
|
93
100
|
collapsible: true,
|
|
94
|
-
collapsed: (formData:
|
|
101
|
+
collapsed: (formData: FormData) => {
|
|
95
102
|
// Collapse only if there are no quick replies
|
|
96
103
|
return !formData.quick_replies || formData.quick_replies.length === 0;
|
|
97
104
|
},
|
|
98
|
-
getGroupValueCount: (formData:
|
|
105
|
+
getGroupValueCount: (formData: FormData) => {
|
|
99
106
|
return formData.quick_replies?.length || 0;
|
|
100
107
|
}
|
|
101
108
|
},
|
|
@@ -106,7 +113,7 @@ export const send_msg: ActionConfig = {
|
|
|
106
113
|
collapsible: true,
|
|
107
114
|
collapsed: true,
|
|
108
115
|
helpText: 'Add dynamic attachments that are evaluated at runtime',
|
|
109
|
-
getGroupValueCount: (formData:
|
|
116
|
+
getGroupValueCount: (formData: FormData) => {
|
|
110
117
|
return (
|
|
111
118
|
formData.runtime_attachments?.filter(
|
|
112
119
|
(item: any) =>
|
|
@@ -154,7 +161,7 @@ export const send_msg: ActionConfig = {
|
|
|
154
161
|
}))
|
|
155
162
|
};
|
|
156
163
|
},
|
|
157
|
-
fromFormData: (data:
|
|
164
|
+
fromFormData: (data: FormData) => {
|
|
158
165
|
const result = {
|
|
159
166
|
uuid: data.uuid,
|
|
160
167
|
type: 'send_msg',
|
|
@@ -190,44 +197,29 @@ export const send_msg: ActionConfig = {
|
|
|
190
197
|
|
|
191
198
|
return result as SendMsg;
|
|
192
199
|
},
|
|
193
|
-
sanitize: (formData:
|
|
200
|
+
sanitize: (formData: FormData): void => {
|
|
194
201
|
if (formData.text && typeof formData.text === 'string') {
|
|
195
202
|
formData.text = formData.text.trim();
|
|
196
203
|
}
|
|
197
204
|
},
|
|
198
|
-
validate: (
|
|
205
|
+
validate: (formData: FormData): ValidationResult => {
|
|
199
206
|
const errors: { [key: string]: string } = {};
|
|
200
207
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
if (attachments.length > 10) {
|
|
207
|
-
const staticAttachments = attachments.filter(
|
|
208
|
-
(attachment) =>
|
|
209
|
-
typeof attachment === 'string' &&
|
|
210
|
-
attachment.substring(0, attachment.indexOf(':')).includes('/')
|
|
211
|
-
);
|
|
212
|
-
|
|
213
|
-
const runtimeAttachments = attachments.filter(
|
|
214
|
-
(attachment) =>
|
|
215
|
-
typeof attachment === 'string' &&
|
|
216
|
-
!attachment.substring(0, attachment.indexOf(':')).includes('/')
|
|
217
|
-
);
|
|
208
|
+
// Check total attachment count (static + runtime should not exceed 10)
|
|
209
|
+
const staticAttachments = formData.attachments || [];
|
|
210
|
+
const runtimeAttachments = (formData.runtime_attachments || []).filter(
|
|
211
|
+
(item: any) => item && item.expression && item.expression.trim() !== ''
|
|
212
|
+
);
|
|
218
213
|
|
|
214
|
+
const totalAttachments =
|
|
215
|
+
staticAttachments.length + runtimeAttachments.length;
|
|
216
|
+
if (totalAttachments > 10) {
|
|
219
217
|
if (runtimeAttachments.length > 0) {
|
|
220
218
|
errors.runtime_attachments =
|
|
221
219
|
'Each message can only have up to 10 attachments';
|
|
222
220
|
}
|
|
223
|
-
|
|
224
221
|
if (staticAttachments.length > 0) {
|
|
225
|
-
|
|
226
|
-
if (errors.text) {
|
|
227
|
-
errors.text += ` ${message}`;
|
|
228
|
-
} else {
|
|
229
|
-
errors.text = message;
|
|
230
|
-
}
|
|
222
|
+
errors.text = 'Each message can only have up to 10 total attachments';
|
|
231
223
|
}
|
|
232
224
|
}
|
|
233
225
|
|
|
@@ -235,5 +227,134 @@ export const send_msg: ActionConfig = {
|
|
|
235
227
|
valid: Object.keys(errors).length === 0,
|
|
236
228
|
errors
|
|
237
229
|
};
|
|
230
|
+
},
|
|
231
|
+
localizable: ['text', 'quick_replies', 'attachments'],
|
|
232
|
+
toLocalizationFormData: (
|
|
233
|
+
action: SendMsg,
|
|
234
|
+
localization: Record<string, any>
|
|
235
|
+
) => {
|
|
236
|
+
// Convert localized values to form data format
|
|
237
|
+
// Localized values are stored as arrays even for single values
|
|
238
|
+
const formData: FormData = {
|
|
239
|
+
uuid: action.uuid
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
// Handle text (single value, but stored as array in localization)
|
|
243
|
+
if (localization.text && Array.isArray(localization.text)) {
|
|
244
|
+
formData.text = localization.text[0] || '';
|
|
245
|
+
} else {
|
|
246
|
+
// Fall back to empty string if no localization
|
|
247
|
+
formData.text = '';
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
// Handle attachments (already an array)
|
|
251
|
+
if (localization.attachments && Array.isArray(localization.attachments)) {
|
|
252
|
+
formData.attachments = localization.attachments;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
// Handle quick_replies (already an array)
|
|
256
|
+
if (
|
|
257
|
+
localization.quick_replies &&
|
|
258
|
+
Array.isArray(localization.quick_replies)
|
|
259
|
+
) {
|
|
260
|
+
formData.quick_replies = localization.quick_replies.map((reply) => ({
|
|
261
|
+
name: reply,
|
|
262
|
+
value: reply
|
|
263
|
+
}));
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
// Extract runtime attachments from localized attachments
|
|
267
|
+
const runtimeAttachments: {
|
|
268
|
+
type: { name: string; value: string };
|
|
269
|
+
expression: string;
|
|
270
|
+
}[] = [];
|
|
271
|
+
const staticAttachments: string[] = [];
|
|
272
|
+
|
|
273
|
+
if (formData.attachments && Array.isArray(formData.attachments)) {
|
|
274
|
+
formData.attachments.forEach((attachment) => {
|
|
275
|
+
if (typeof attachment === 'string' && attachment.includes(':')) {
|
|
276
|
+
const colonIndex = attachment.indexOf(':');
|
|
277
|
+
const contentType = attachment.substring(0, colonIndex);
|
|
278
|
+
const value = attachment.substring(colonIndex + 1);
|
|
279
|
+
|
|
280
|
+
if (!contentType.includes('/')) {
|
|
281
|
+
runtimeAttachments.push({
|
|
282
|
+
type: { name: titleCase(contentType), value: contentType },
|
|
283
|
+
expression: value
|
|
284
|
+
});
|
|
285
|
+
} else {
|
|
286
|
+
staticAttachments.push(attachment);
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
formData.attachments = staticAttachments;
|
|
293
|
+
formData.runtime_attachments = runtimeAttachments;
|
|
294
|
+
|
|
295
|
+
return formData;
|
|
296
|
+
},
|
|
297
|
+
fromLocalizationFormData: (formData: FormData, action: SendMsg) => {
|
|
298
|
+
// Convert form data to localization format
|
|
299
|
+
// All values must be stored as arrays
|
|
300
|
+
const localization: Record<string, any> = {};
|
|
301
|
+
|
|
302
|
+
// Handle text (store as single-element array)
|
|
303
|
+
// Only save if not empty and different from base action
|
|
304
|
+
if (formData.text && formData.text.trim() !== '') {
|
|
305
|
+
if (formData.text !== action.text) {
|
|
306
|
+
localization.text = [formData.text];
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
// Handle quick_replies (store as array)
|
|
311
|
+
const quickReplies = (formData.quick_replies || [])
|
|
312
|
+
.map((reply: any) =>
|
|
313
|
+
typeof reply === 'string' ? reply : reply.value || reply.name || reply
|
|
314
|
+
)
|
|
315
|
+
.filter((reply: string) => reply && reply.trim() !== '');
|
|
316
|
+
|
|
317
|
+
// Only save if there are quick replies and different from base action
|
|
318
|
+
if (quickReplies.length > 0) {
|
|
319
|
+
if (
|
|
320
|
+
JSON.stringify(quickReplies) !==
|
|
321
|
+
JSON.stringify(action.quick_replies || [])
|
|
322
|
+
) {
|
|
323
|
+
localization.quick_replies = quickReplies;
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
// Handle attachments (combine static and runtime attachments)
|
|
328
|
+
const staticAttachments = (formData.attachments || []).filter(
|
|
329
|
+
(att: string) => att && att.trim() !== ''
|
|
330
|
+
);
|
|
331
|
+
const runtimeAttachments = (formData.runtime_attachments || [])
|
|
332
|
+
.filter(
|
|
333
|
+
(item: {
|
|
334
|
+
type: [{ name: string; value: string }];
|
|
335
|
+
expression: string;
|
|
336
|
+
}) =>
|
|
337
|
+
item && item.type && item.expression && item.expression.trim() !== ''
|
|
338
|
+
)
|
|
339
|
+
.map(
|
|
340
|
+
(item: {
|
|
341
|
+
type: [{ name: string; value: string }];
|
|
342
|
+
expression: string;
|
|
343
|
+
}) => `${item.type[0].value}:${item.expression}`
|
|
344
|
+
);
|
|
345
|
+
|
|
346
|
+
const allAttachments = [...staticAttachments, ...runtimeAttachments];
|
|
347
|
+
|
|
348
|
+
// Only save if there are attachments and different from base action
|
|
349
|
+
if (allAttachments.length > 0) {
|
|
350
|
+
if (
|
|
351
|
+
JSON.stringify(allAttachments) !==
|
|
352
|
+
JSON.stringify(action.attachments || [])
|
|
353
|
+
) {
|
|
354
|
+
localization.attachments = allAttachments;
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
return localization;
|
|
238
359
|
}
|
|
239
360
|
};
|