@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,7 +1,199 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SPLIT_GROUPS, FormData, NodeConfig, FlowTypes } from '../types';
|
|
2
|
+
import { Node } from '../../store/flow-definition';
|
|
3
|
+
import { createRulesRouter } from '../../utils';
|
|
4
|
+
import {
|
|
5
|
+
getWaitForResponseOperators,
|
|
6
|
+
operatorsToSelectOptions,
|
|
7
|
+
getOperatorConfig
|
|
8
|
+
} from '../operators';
|
|
9
|
+
import {
|
|
10
|
+
resultNameField,
|
|
11
|
+
categoriesToLocalizationFormData,
|
|
12
|
+
localizationFormDataToCategories
|
|
13
|
+
} from './shared';
|
|
14
|
+
import {
|
|
15
|
+
createRulesArrayConfig,
|
|
16
|
+
extractUserRules,
|
|
17
|
+
casesToFormRules
|
|
18
|
+
} from './shared-rules';
|
|
19
|
+
import { SCHEMES } from '../utils';
|
|
20
|
+
import { html } from 'lit';
|
|
21
|
+
|
|
22
|
+
// System contact properties that can be split on
|
|
23
|
+
export const CONTACT_PROPERTIES = {
|
|
24
|
+
name: { id: 'name', name: 'Name', type: 'property' },
|
|
25
|
+
language: { id: 'language', name: 'Language', type: 'property' },
|
|
26
|
+
status: { id: 'status', name: 'Status', type: 'property' },
|
|
27
|
+
channel: { id: 'channel', name: 'Channel', type: 'property' }
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
// Helper to get operand for the selected field
|
|
31
|
+
const getOperandForField = (field: any): string => {
|
|
32
|
+
// For URN schemes, split on the URN path (the actual ID value like Facebook ID)
|
|
33
|
+
// Note: This is different from split_by_scheme which splits on the scheme type itself
|
|
34
|
+
if (field.type === 'scheme') {
|
|
35
|
+
// field.id or field.value will be the scheme name like 'facebook', 'whatsapp', etc
|
|
36
|
+
const schemeId = field.id || field.value;
|
|
37
|
+
return `@(default(urn_parts(urns.${schemeId}).path, ""))`;
|
|
38
|
+
}
|
|
39
|
+
// For system properties, use the id
|
|
40
|
+
if (field.type === 'property') {
|
|
41
|
+
return `@contact.${field.id}`;
|
|
42
|
+
}
|
|
43
|
+
// Fallback to key
|
|
44
|
+
return `@fields.${field.key}`;
|
|
45
|
+
};
|
|
2
46
|
|
|
3
47
|
export const split_by_contact_field: NodeConfig = {
|
|
4
48
|
type: 'split_by_contact_field',
|
|
5
|
-
name: 'Split by
|
|
6
|
-
|
|
49
|
+
name: 'Split by Contact Field',
|
|
50
|
+
group: SPLIT_GROUPS.split,
|
|
51
|
+
flowTypes: [FlowTypes.VOICE, FlowTypes.MESSAGE, FlowTypes.BACKGROUND],
|
|
52
|
+
dialogSize: 'large',
|
|
53
|
+
form: {
|
|
54
|
+
field: {
|
|
55
|
+
type: 'select',
|
|
56
|
+
required: true,
|
|
57
|
+
searchable: true,
|
|
58
|
+
clearable: false,
|
|
59
|
+
endpoint: '/api/v2/fields.json',
|
|
60
|
+
valueKey: 'key',
|
|
61
|
+
nameKey: 'name',
|
|
62
|
+
placeholder: 'Select a field...',
|
|
63
|
+
// Provide system properties as fixed options at the top
|
|
64
|
+
options: [
|
|
65
|
+
...Object.values(CONTACT_PROPERTIES).map((prop) => ({
|
|
66
|
+
value: prop.id,
|
|
67
|
+
name: prop.name,
|
|
68
|
+
type: prop.type
|
|
69
|
+
})),
|
|
70
|
+
// Add all URN scheme options (they represent splitting on the URN value, like Facebook ID)
|
|
71
|
+
...SCHEMES.filter((scheme) => !scheme.excludeFromSplit).map(
|
|
72
|
+
(scheme) => ({
|
|
73
|
+
value: scheme.scheme,
|
|
74
|
+
name: scheme.path,
|
|
75
|
+
type: 'scheme'
|
|
76
|
+
})
|
|
77
|
+
)
|
|
78
|
+
]
|
|
79
|
+
},
|
|
80
|
+
rules: createRulesArrayConfig(
|
|
81
|
+
operatorsToSelectOptions(getWaitForResponseOperators()),
|
|
82
|
+
'Define rules to split the contact field into categories'
|
|
83
|
+
),
|
|
84
|
+
result_name: resultNameField
|
|
85
|
+
},
|
|
86
|
+
layout: ['field', 'rules', 'result_name'],
|
|
87
|
+
validate: (formData: FormData) => {
|
|
88
|
+
const errors: { [key: string]: string } = {};
|
|
89
|
+
|
|
90
|
+
if (!formData.field || formData.field.length === 0) {
|
|
91
|
+
errors.field = 'A field is required';
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return {
|
|
95
|
+
valid: Object.keys(errors).length === 0,
|
|
96
|
+
errors
|
|
97
|
+
};
|
|
98
|
+
},
|
|
99
|
+
toFormData: (node: Node, nodeUI?: any) => {
|
|
100
|
+
// Get the field from the UI config operand (source of truth)
|
|
101
|
+
const field = nodeUI?.config?.operand || CONTACT_PROPERTIES.name;
|
|
102
|
+
|
|
103
|
+
// Extract rules from router cases using shared function
|
|
104
|
+
const rules = casesToFormRules(node);
|
|
105
|
+
|
|
106
|
+
return {
|
|
107
|
+
uuid: node.uuid,
|
|
108
|
+
field: [field],
|
|
109
|
+
rules: rules,
|
|
110
|
+
result_name: node.router?.result_name || ''
|
|
111
|
+
};
|
|
112
|
+
},
|
|
113
|
+
fromFormData: (formData: FormData, originalNode: Node): Node => {
|
|
114
|
+
// Get selected field (it's an array from the select component)
|
|
115
|
+
const selectedField = formData.field?.[0];
|
|
116
|
+
|
|
117
|
+
if (!selectedField) {
|
|
118
|
+
return originalNode;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// Get operand for the selected field
|
|
122
|
+
const operand = getOperandForField(selectedField);
|
|
123
|
+
|
|
124
|
+
// Get user rules using shared extraction function
|
|
125
|
+
const userRules = extractUserRules(formData);
|
|
126
|
+
|
|
127
|
+
// Get existing router data for preservation
|
|
128
|
+
const existingCategories = originalNode.router?.categories || [];
|
|
129
|
+
const existingExits = originalNode.exits || [];
|
|
130
|
+
const existingCases = originalNode.router?.cases || [];
|
|
131
|
+
|
|
132
|
+
// Create router and exits using existing data when possible
|
|
133
|
+
const { router, exits } = createRulesRouter(
|
|
134
|
+
operand,
|
|
135
|
+
userRules,
|
|
136
|
+
getOperatorConfig,
|
|
137
|
+
existingCategories,
|
|
138
|
+
existingExits,
|
|
139
|
+
existingCases
|
|
140
|
+
);
|
|
141
|
+
|
|
142
|
+
// Build final router with result_name
|
|
143
|
+
const finalRouter: any = {
|
|
144
|
+
...router
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
// Only set result_name if provided
|
|
148
|
+
if (formData.result_name && formData.result_name.trim() !== '') {
|
|
149
|
+
finalRouter.result_name = formData.result_name.trim();
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
return {
|
|
153
|
+
...originalNode,
|
|
154
|
+
router: finalRouter,
|
|
155
|
+
exits: exits
|
|
156
|
+
};
|
|
157
|
+
},
|
|
158
|
+
toUIConfig: (formData: FormData) => {
|
|
159
|
+
// Get selected field (it's an array from the select component)
|
|
160
|
+
const selectedField = formData.field?.[0];
|
|
161
|
+
|
|
162
|
+
if (!selectedField) {
|
|
163
|
+
return {};
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// For scheme types, the id should be the scheme name (facebook, whatsapp, etc)
|
|
167
|
+
// For custom fields, the id should be the field key
|
|
168
|
+
// For system properties, the id should be the property id
|
|
169
|
+
let operandId =
|
|
170
|
+
selectedField.id || selectedField.value || selectedField.key;
|
|
171
|
+
|
|
172
|
+
// If this is a scheme type, ensure we use the scheme name as the id
|
|
173
|
+
if (selectedField.type === 'scheme') {
|
|
174
|
+
operandId = selectedField.value || selectedField.id;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
let type = selectedField.type;
|
|
178
|
+
if (type !== 'property' && type !== 'scheme') {
|
|
179
|
+
type = 'field';
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
// Return UI config with operand information for persistence
|
|
183
|
+
return {
|
|
184
|
+
operand: {
|
|
185
|
+
id: operandId,
|
|
186
|
+
name: selectedField.name || selectedField.label,
|
|
187
|
+
type
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
},
|
|
191
|
+
renderTitle: (node: Node, nodeUI?: any) => {
|
|
192
|
+
return html`<div>Split by ${nodeUI.config.operand.name}</div>`;
|
|
193
|
+
},
|
|
194
|
+
|
|
195
|
+
// Localization support for categories
|
|
196
|
+
localizable: 'categories',
|
|
197
|
+
toLocalizationFormData: categoriesToLocalizationFormData,
|
|
198
|
+
fromLocalizationFormData: localizationFormDataToCategories
|
|
7
199
|
};
|
|
@@ -1,7 +1,109 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SPLIT_GROUPS, FormData, NodeConfig, FlowTypes } from '../types';
|
|
2
|
+
import { Node } from '../../store/flow-definition';
|
|
3
|
+
import { createRulesRouter } from '../../utils';
|
|
4
|
+
import {
|
|
5
|
+
getWaitForResponseOperators,
|
|
6
|
+
operatorsToSelectOptions,
|
|
7
|
+
getOperatorConfig
|
|
8
|
+
} from '../operators';
|
|
9
|
+
import {
|
|
10
|
+
resultNameField,
|
|
11
|
+
categoriesToLocalizationFormData,
|
|
12
|
+
localizationFormDataToCategories
|
|
13
|
+
} from './shared';
|
|
14
|
+
import {
|
|
15
|
+
createRulesArrayConfig,
|
|
16
|
+
extractUserRules,
|
|
17
|
+
casesToFormRules
|
|
18
|
+
} from './shared-rules';
|
|
2
19
|
|
|
3
20
|
export const split_by_expression: NodeConfig = {
|
|
4
21
|
type: 'split_by_expression',
|
|
5
22
|
name: 'Split by Expression',
|
|
6
|
-
|
|
23
|
+
group: SPLIT_GROUPS.split,
|
|
24
|
+
flowTypes: [FlowTypes.VOICE, FlowTypes.MESSAGE, FlowTypes.BACKGROUND],
|
|
25
|
+
dialogSize: 'large',
|
|
26
|
+
form: {
|
|
27
|
+
operand: {
|
|
28
|
+
type: 'text',
|
|
29
|
+
label: 'Expression',
|
|
30
|
+
helpText: 'The expression to evaluate and split on',
|
|
31
|
+
required: true,
|
|
32
|
+
evaluated: true,
|
|
33
|
+
placeholder: '@fields.age'
|
|
34
|
+
},
|
|
35
|
+
rules: createRulesArrayConfig(
|
|
36
|
+
operatorsToSelectOptions(getWaitForResponseOperators()),
|
|
37
|
+
'Define rules to categorize the expression result'
|
|
38
|
+
),
|
|
39
|
+
result_name: resultNameField
|
|
40
|
+
},
|
|
41
|
+
layout: ['operand', 'rules', 'result_name'],
|
|
42
|
+
validate: (formData: FormData) => {
|
|
43
|
+
const errors: { [key: string]: string } = {};
|
|
44
|
+
|
|
45
|
+
// Validate operand is provided
|
|
46
|
+
if (!formData.operand || formData.operand.trim() === '') {
|
|
47
|
+
errors.operand = 'Expression is required';
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return {
|
|
51
|
+
valid: Object.keys(errors).length === 0,
|
|
52
|
+
errors
|
|
53
|
+
};
|
|
54
|
+
},
|
|
55
|
+
toFormData: (node: Node) => {
|
|
56
|
+
// Extract rules from router cases using shared function
|
|
57
|
+
const rules = casesToFormRules(node);
|
|
58
|
+
|
|
59
|
+
return {
|
|
60
|
+
uuid: node.uuid,
|
|
61
|
+
operand: node.router?.operand || '@input.text',
|
|
62
|
+
rules: rules,
|
|
63
|
+
result_name: node.router?.result_name || ''
|
|
64
|
+
};
|
|
65
|
+
},
|
|
66
|
+
fromFormData: (formData: FormData, originalNode: Node): Node => {
|
|
67
|
+
// Get user rules using shared extraction function
|
|
68
|
+
const userRules = extractUserRules(formData);
|
|
69
|
+
|
|
70
|
+
// Get operand from form data
|
|
71
|
+
const operand = formData.operand?.trim() || '@input.text';
|
|
72
|
+
|
|
73
|
+
// Get existing router data for preservation
|
|
74
|
+
const existingCategories = originalNode.router?.categories || [];
|
|
75
|
+
const existingExits = originalNode.exits || [];
|
|
76
|
+
const existingCases = originalNode.router?.cases || [];
|
|
77
|
+
|
|
78
|
+
// Create router and exits using existing data when possible
|
|
79
|
+
const { router, exits } = createRulesRouter(
|
|
80
|
+
operand,
|
|
81
|
+
userRules,
|
|
82
|
+
getOperatorConfig,
|
|
83
|
+
existingCategories,
|
|
84
|
+
existingExits,
|
|
85
|
+
existingCases
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
// Build final router with result_name
|
|
89
|
+
const finalRouter: any = {
|
|
90
|
+
...router
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
// Only set result_name if provided
|
|
94
|
+
if (formData.result_name && formData.result_name.trim() !== '') {
|
|
95
|
+
finalRouter.result_name = formData.result_name.trim();
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
return {
|
|
99
|
+
...originalNode,
|
|
100
|
+
router: finalRouter,
|
|
101
|
+
exits: exits
|
|
102
|
+
};
|
|
103
|
+
},
|
|
104
|
+
|
|
105
|
+
// Localization support for categories
|
|
106
|
+
localizable: 'categories',
|
|
107
|
+
toLocalizationFormData: categoriesToLocalizationFormData,
|
|
108
|
+
fromLocalizationFormData: localizationFormDataToCategories
|
|
7
109
|
};
|
|
@@ -1,13 +1,19 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SPLIT_GROUPS, FormData, NodeConfig, FlowTypes } from '../types';
|
|
2
2
|
import { Node, Category, Exit, Case } from '../../store/flow-definition.d';
|
|
3
3
|
import { generateUUID } from '../../utils';
|
|
4
|
+
import {
|
|
5
|
+
resultNameField,
|
|
6
|
+
categoriesToLocalizationFormData,
|
|
7
|
+
localizationFormDataToCategories
|
|
8
|
+
} from './shared';
|
|
4
9
|
|
|
5
10
|
// Helper function to create a switch router with group cases
|
|
6
11
|
const createGroupRouter = (
|
|
7
12
|
userGroups: { uuid: string; name: string }[],
|
|
8
13
|
existingCategories: Category[] = [],
|
|
9
14
|
existingExits: Exit[] = [],
|
|
10
|
-
existingCases: Case[] = []
|
|
15
|
+
existingCases: Case[] = [],
|
|
16
|
+
resultName: string = ''
|
|
11
17
|
) => {
|
|
12
18
|
const categories: Category[] = [];
|
|
13
19
|
const exits: Exit[] = [];
|
|
@@ -82,7 +88,7 @@ const createGroupRouter = (
|
|
|
82
88
|
categories: categories,
|
|
83
89
|
default_category_uuid: otherCategoryUuid,
|
|
84
90
|
operand: '@contact.groups',
|
|
85
|
-
result_name:
|
|
91
|
+
result_name: resultName
|
|
86
92
|
},
|
|
87
93
|
exits: exits
|
|
88
94
|
};
|
|
@@ -91,7 +97,8 @@ const createGroupRouter = (
|
|
|
91
97
|
export const split_by_groups: NodeConfig = {
|
|
92
98
|
type: 'split_by_groups',
|
|
93
99
|
name: 'Split by Group',
|
|
94
|
-
|
|
100
|
+
group: SPLIT_GROUPS.split,
|
|
101
|
+
flowTypes: [FlowTypes.VOICE, FlowTypes.MESSAGE, FlowTypes.BACKGROUND],
|
|
95
102
|
form: {
|
|
96
103
|
groups: {
|
|
97
104
|
type: 'select',
|
|
@@ -121,10 +128,11 @@ export const split_by_groups: NodeConfig = {
|
|
|
121
128
|
}
|
|
122
129
|
return null;
|
|
123
130
|
}
|
|
124
|
-
}
|
|
131
|
+
},
|
|
132
|
+
result_name: resultNameField
|
|
125
133
|
},
|
|
126
|
-
layout: ['groups'],
|
|
127
|
-
validate: (formData:
|
|
134
|
+
layout: ['groups', 'result_name'],
|
|
135
|
+
validate: (formData: FormData) => {
|
|
128
136
|
const errors: { [key: string]: string } = {};
|
|
129
137
|
|
|
130
138
|
if (
|
|
@@ -157,10 +165,11 @@ export const split_by_groups: NodeConfig = {
|
|
|
157
165
|
|
|
158
166
|
return {
|
|
159
167
|
uuid: node.uuid,
|
|
160
|
-
groups: groups
|
|
168
|
+
groups: groups,
|
|
169
|
+
result_name: node.router?.result_name || ''
|
|
161
170
|
};
|
|
162
171
|
},
|
|
163
|
-
fromFormData: (formData:
|
|
172
|
+
fromFormData: (formData: FormData, originalNode: Node): Node => {
|
|
164
173
|
// Get selected groups
|
|
165
174
|
const selectedGroups = (formData.groups || [])
|
|
166
175
|
.filter((group: any) => group?.uuid || group?.arbitrary)
|
|
@@ -178,7 +187,8 @@ export const split_by_groups: NodeConfig = {
|
|
|
178
187
|
selectedGroups,
|
|
179
188
|
existingCategories,
|
|
180
189
|
existingExits,
|
|
181
|
-
existingCases
|
|
190
|
+
existingCases,
|
|
191
|
+
formData.result_name || ''
|
|
182
192
|
);
|
|
183
193
|
|
|
184
194
|
// Return the complete node
|
|
@@ -192,5 +202,10 @@ export const split_by_groups: NodeConfig = {
|
|
|
192
202
|
router: {
|
|
193
203
|
type: 'switch',
|
|
194
204
|
operand: '@contact.groups'
|
|
195
|
-
}
|
|
205
|
+
},
|
|
206
|
+
|
|
207
|
+
// Localization support for categories
|
|
208
|
+
localizable: 'categories',
|
|
209
|
+
toLocalizationFormData: categoriesToLocalizationFormData,
|
|
210
|
+
fromLocalizationFormData: localizationFormDataToCategories
|
|
196
211
|
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { NodeConfig, ACTION_GROUPS, FlowTypes } from '../types';
|
|
2
|
+
|
|
3
|
+
export const split_by_llm_categorize: NodeConfig = {
|
|
4
|
+
type: 'split_by_intent',
|
|
5
|
+
name: 'Call classifier',
|
|
6
|
+
group: ACTION_GROUPS.services,
|
|
7
|
+
flowTypes: [FlowTypes.VOICE, FlowTypes.MESSAGE, FlowTypes.BACKGROUND]
|
|
8
|
+
};
|
|
@@ -1,12 +1,25 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
ACTION_GROUPS,
|
|
3
|
+
FormData,
|
|
4
|
+
NodeConfig,
|
|
5
|
+
FlowTypes,
|
|
6
|
+
Features
|
|
7
|
+
} from '../types';
|
|
2
8
|
import { CallLLM, Node } from '../../store/flow-definition';
|
|
3
9
|
import { generateUUID, createSuccessFailureRouter } from '../../utils';
|
|
4
10
|
import { html } from 'lit';
|
|
11
|
+
import {
|
|
12
|
+
categoriesToLocalizationFormData,
|
|
13
|
+
localizationFormDataToCategories
|
|
14
|
+
} from './shared';
|
|
5
15
|
|
|
6
16
|
export const split_by_llm: NodeConfig = {
|
|
7
17
|
type: 'split_by_llm',
|
|
8
18
|
name: 'Call AI',
|
|
9
|
-
|
|
19
|
+
group: ACTION_GROUPS.services,
|
|
20
|
+
flowTypes: [FlowTypes.VOICE, FlowTypes.MESSAGE, FlowTypes.BACKGROUND],
|
|
21
|
+
features: [Features.AI],
|
|
22
|
+
showAsAction: true,
|
|
10
23
|
render: (node: Node) => {
|
|
11
24
|
const callLlmAction = node.actions?.find(
|
|
12
25
|
(action) => action.type === 'call_llm'
|
|
@@ -68,7 +81,7 @@ export const split_by_llm: NodeConfig = {
|
|
|
68
81
|
instructions: callLlmAction?.instructions || ''
|
|
69
82
|
};
|
|
70
83
|
},
|
|
71
|
-
fromFormData: (formData:
|
|
84
|
+
fromFormData: (formData: FormData, originalNode: Node): Node => {
|
|
72
85
|
// Get LLM selection
|
|
73
86
|
const llmSelection =
|
|
74
87
|
Array.isArray(formData.llm) && formData.llm.length > 0
|
|
@@ -116,5 +129,10 @@ export const split_by_llm: NodeConfig = {
|
|
|
116
129
|
router: router,
|
|
117
130
|
exits: exits
|
|
118
131
|
};
|
|
119
|
-
}
|
|
132
|
+
},
|
|
133
|
+
|
|
134
|
+
// Localization support for categories
|
|
135
|
+
localizable: 'categories',
|
|
136
|
+
toLocalizationFormData: categoriesToLocalizationFormData,
|
|
137
|
+
fromLocalizationFormData: localizationFormDataToCategories
|
|
120
138
|
};
|
|
@@ -1,12 +1,24 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
FormData,
|
|
3
|
+
NodeConfig,
|
|
4
|
+
ACTION_GROUPS,
|
|
5
|
+
FlowTypes,
|
|
6
|
+
Features
|
|
7
|
+
} from '../types';
|
|
2
8
|
import { CallLLM, Node } from '../../store/flow-definition';
|
|
3
9
|
import { generateUUID, createMultiCategoryRouter } from '../../utils';
|
|
4
10
|
import { html } from 'lit';
|
|
11
|
+
import {
|
|
12
|
+
categoriesToLocalizationFormData,
|
|
13
|
+
localizationFormDataToCategories
|
|
14
|
+
} from './shared';
|
|
5
15
|
|
|
6
16
|
export const split_by_llm_categorize: NodeConfig = {
|
|
7
17
|
type: 'split_by_llm_categorize',
|
|
8
18
|
name: 'Split by AI',
|
|
9
|
-
|
|
19
|
+
group: ACTION_GROUPS.services,
|
|
20
|
+
flowTypes: [FlowTypes.VOICE, FlowTypes.MESSAGE, FlowTypes.BACKGROUND],
|
|
21
|
+
features: [Features.AI],
|
|
10
22
|
form: {
|
|
11
23
|
llm: {
|
|
12
24
|
type: 'select',
|
|
@@ -48,7 +60,7 @@ export const split_by_llm_categorize: NodeConfig = {
|
|
|
48
60
|
}
|
|
49
61
|
},
|
|
50
62
|
layout: ['llm', 'input', 'categories'],
|
|
51
|
-
validate: (formData:
|
|
63
|
+
validate: (formData: FormData) => {
|
|
52
64
|
const errors: { [key: string]: string } = {};
|
|
53
65
|
|
|
54
66
|
// Check for duplicate category names
|
|
@@ -117,7 +129,7 @@ export const split_by_llm_categorize: NodeConfig = {
|
|
|
117
129
|
categories: categories
|
|
118
130
|
};
|
|
119
131
|
},
|
|
120
|
-
fromFormData: (formData:
|
|
132
|
+
fromFormData: (formData: FormData, originalNode: Node): Node => {
|
|
121
133
|
// Get LLM selection
|
|
122
134
|
const llmSelection =
|
|
123
135
|
Array.isArray(formData.llm) && formData.llm.length > 0
|
|
@@ -171,5 +183,10 @@ export const split_by_llm_categorize: NodeConfig = {
|
|
|
171
183
|
router: router,
|
|
172
184
|
exits: exits
|
|
173
185
|
};
|
|
174
|
-
}
|
|
186
|
+
},
|
|
187
|
+
|
|
188
|
+
// Localization support for categories
|
|
189
|
+
localizable: 'categories',
|
|
190
|
+
toLocalizationFormData: categoriesToLocalizationFormData,
|
|
191
|
+
fromLocalizationFormData: localizationFormDataToCategories
|
|
175
192
|
};
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SPLIT_GROUPS, FormData, NodeConfig, FlowTypes } from '../types';
|
|
2
2
|
import { Node, Category, Exit } from '../../store/flow-definition.d';
|
|
3
3
|
import { generateUUID } from '../../utils';
|
|
4
|
+
import {
|
|
5
|
+
categoriesToLocalizationFormData,
|
|
6
|
+
localizationFormDataToCategories
|
|
7
|
+
} from './shared';
|
|
4
8
|
|
|
5
9
|
// Helper function to create a random router with categories
|
|
6
10
|
const createRandomRouter = (
|
|
@@ -47,8 +51,9 @@ const createRandomRouter = (
|
|
|
47
51
|
|
|
48
52
|
export const split_by_random: NodeConfig = {
|
|
49
53
|
type: 'split_by_random',
|
|
50
|
-
name: 'Split
|
|
51
|
-
|
|
54
|
+
name: 'Random Split',
|
|
55
|
+
group: SPLIT_GROUPS.split,
|
|
56
|
+
flowTypes: [FlowTypes.VOICE, FlowTypes.MESSAGE, FlowTypes.BACKGROUND],
|
|
52
57
|
form: {
|
|
53
58
|
categories: {
|
|
54
59
|
type: 'array',
|
|
@@ -72,7 +77,7 @@ export const split_by_random: NodeConfig = {
|
|
|
72
77
|
}
|
|
73
78
|
},
|
|
74
79
|
layout: ['categories'],
|
|
75
|
-
validate: (formData:
|
|
80
|
+
validate: (formData: FormData) => {
|
|
76
81
|
const errors: { [key: string]: string } = {};
|
|
77
82
|
|
|
78
83
|
// Check for duplicate category names
|
|
@@ -129,7 +134,7 @@ export const split_by_random: NodeConfig = {
|
|
|
129
134
|
categories: categories
|
|
130
135
|
};
|
|
131
136
|
},
|
|
132
|
-
fromFormData: (formData:
|
|
137
|
+
fromFormData: (formData: FormData, originalNode: Node): Node => {
|
|
133
138
|
// Get user categories
|
|
134
139
|
const userCategories = (formData.categories || [])
|
|
135
140
|
.filter((item: any) => item?.name?.trim())
|
|
@@ -155,5 +160,10 @@ export const split_by_random: NodeConfig = {
|
|
|
155
160
|
},
|
|
156
161
|
router: {
|
|
157
162
|
type: 'random'
|
|
158
|
-
}
|
|
163
|
+
},
|
|
164
|
+
|
|
165
|
+
// Localization support for categories
|
|
166
|
+
localizable: 'categories',
|
|
167
|
+
toLocalizationFormData: categoriesToLocalizationFormData,
|
|
168
|
+
fromLocalizationFormData: localizationFormDataToCategories
|
|
159
169
|
};
|