@botonic/plugin-flow-builder 0.57.0-rslib-esm.1 → 0.57.0
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/README.md +1 -1
- package/lib/cjs/action/ai-agent-from-user-input.d.ts +3 -0
- package/lib/cjs/action/ai-agent-from-user-input.js +38 -0
- package/lib/cjs/action/ai-agent-from-user-input.js.map +1 -0
- package/lib/cjs/action/context.d.ts +11 -0
- package/lib/cjs/action/context.js +17 -0
- package/lib/cjs/action/context.js.map +1 -0
- package/lib/cjs/action/fallback.d.ts +3 -0
- package/lib/cjs/action/fallback.js +36 -0
- package/lib/cjs/action/fallback.js.map +1 -0
- package/lib/cjs/action/first-interaction.d.ts +3 -0
- package/lib/cjs/action/first-interaction.js +93 -0
- package/lib/cjs/action/first-interaction.js.map +1 -0
- package/lib/cjs/action/get-contents.d.ts +3 -0
- package/lib/cjs/action/get-contents.js +44 -0
- package/lib/cjs/action/get-contents.js.map +1 -0
- package/lib/cjs/action/index.d.ts +25 -0
- package/lib/cjs/action/index.js +95 -0
- package/lib/cjs/action/index.js.map +1 -0
- package/lib/cjs/action/payload.d.ts +3 -0
- package/lib/cjs/action/payload.js +74 -0
- package/lib/cjs/action/payload.js.map +1 -0
- package/lib/cjs/api.d.ts +45 -0
- package/lib/cjs/api.js +227 -0
- package/lib/cjs/api.js.map +1 -0
- package/lib/cjs/bot-context-manager.d.ts +17 -0
- package/lib/cjs/bot-context-manager.js +93 -0
- package/lib/cjs/bot-context-manager.js.map +1 -0
- package/lib/cjs/constants.d.ts +14 -0
- package/lib/cjs/constants.js +20 -0
- package/lib/cjs/constants.js.map +1 -0
- package/lib/cjs/content-fields/contact-reasons-conditional-matcher.d.ts +4 -0
- package/lib/cjs/content-fields/contact-reasons-conditional-matcher.js +12 -0
- package/lib/cjs/content-fields/contact-reasons-conditional-matcher.js.map +1 -0
- package/lib/cjs/content-fields/content-fields-base.d.ts +20 -0
- package/lib/cjs/content-fields/content-fields-base.js +74 -0
- package/lib/cjs/content-fields/content-fields-base.js.map +1 -0
- package/lib/cjs/content-fields/custom-conditional/custom-conditional-v2-evaluators.d.ts +15 -0
- package/lib/cjs/content-fields/custom-conditional/custom-conditional-v2-evaluators.js +71 -0
- package/lib/cjs/content-fields/custom-conditional/custom-conditional-v2-evaluators.js.map +1 -0
- package/lib/cjs/content-fields/custom-conditional/custom-conditional-v2-resolver.d.ts +9 -0
- package/lib/cjs/content-fields/custom-conditional/custom-conditional-v2-resolver.js +58 -0
- package/lib/cjs/content-fields/custom-conditional/custom-conditional-v2-resolver.js.map +1 -0
- package/lib/cjs/content-fields/custom-conditional/flow-custom-condition-v2.d.ts +17 -0
- package/lib/cjs/content-fields/custom-conditional/flow-custom-condition-v2.js +79 -0
- package/lib/cjs/content-fields/custom-conditional/flow-custom-condition-v2.js.map +1 -0
- package/lib/cjs/content-fields/flow-ai-agent-base.d.ts +25 -0
- package/lib/cjs/content-fields/flow-ai-agent-base.js +97 -0
- package/lib/cjs/content-fields/flow-ai-agent-base.js.map +1 -0
- package/lib/cjs/content-fields/flow-ai-agent-router.d.ts +21 -0
- package/lib/cjs/content-fields/flow-ai-agent-router.js +126 -0
- package/lib/cjs/content-fields/flow-ai-agent-router.js.map +1 -0
- package/lib/cjs/content-fields/flow-ai-agent.d.ts +17 -0
- package/lib/cjs/content-fields/flow-ai-agent.js +65 -0
- package/lib/cjs/content-fields/flow-ai-agent.js.map +1 -0
- package/lib/cjs/content-fields/flow-bot-action.d.ts +14 -0
- package/lib/cjs/content-fields/flow-bot-action.js +45 -0
- package/lib/cjs/content-fields/flow-bot-action.js.map +1 -0
- package/lib/cjs/content-fields/flow-button.d.ts +31 -0
- package/lib/cjs/content-fields/flow-button.js +86 -0
- package/lib/cjs/content-fields/flow-button.js.map +1 -0
- package/lib/cjs/content-fields/flow-capture-user-input.d.ts +14 -0
- package/lib/cjs/content-fields/flow-capture-user-input.js +45 -0
- package/lib/cjs/content-fields/flow-capture-user-input.js.map +1 -0
- package/lib/cjs/content-fields/flow-carousel.d.ts +22 -0
- package/lib/cjs/content-fields/flow-carousel.js +152 -0
- package/lib/cjs/content-fields/flow-carousel.js.map +1 -0
- package/lib/cjs/content-fields/flow-channel-conditional.d.ts +14 -0
- package/lib/cjs/content-fields/flow-channel-conditional.js +57 -0
- package/lib/cjs/content-fields/flow-channel-conditional.js.map +1 -0
- package/lib/cjs/content-fields/flow-contact-reasons-conditional.d.ts +14 -0
- package/lib/cjs/content-fields/flow-contact-reasons-conditional.js +65 -0
- package/lib/cjs/content-fields/flow-contact-reasons-conditional.js.map +1 -0
- package/lib/cjs/content-fields/flow-country-conditional.d.ts +13 -0
- package/lib/cjs/content-fields/flow-country-conditional.js +59 -0
- package/lib/cjs/content-fields/flow-country-conditional.js.map +1 -0
- package/lib/cjs/content-fields/flow-custom-conditional.d.ts +17 -0
- package/lib/cjs/content-fields/flow-custom-conditional.js +89 -0
- package/lib/cjs/content-fields/flow-custom-conditional.js.map +1 -0
- package/lib/cjs/content-fields/flow-do-nothing.d.ts +9 -0
- package/lib/cjs/content-fields/flow-do-nothing.js +27 -0
- package/lib/cjs/content-fields/flow-do-nothing.js.map +1 -0
- package/lib/cjs/content-fields/flow-element.d.ts +22 -0
- package/lib/cjs/content-fields/flow-element.js +50 -0
- package/lib/cjs/content-fields/flow-element.js.map +1 -0
- package/lib/cjs/content-fields/flow-go-to-flow.d.ts +13 -0
- package/lib/cjs/content-fields/flow-go-to-flow.js +51 -0
- package/lib/cjs/content-fields/flow-go-to-flow.js.map +1 -0
- package/lib/cjs/content-fields/flow-handoff.d.ts +23 -0
- package/lib/cjs/content-fields/flow-handoff.js +104 -0
- package/lib/cjs/content-fields/flow-handoff.js.map +1 -0
- package/lib/cjs/content-fields/flow-image.d.ts +10 -0
- package/lib/cjs/content-fields/flow-image.js +33 -0
- package/lib/cjs/content-fields/flow-image.js.map +1 -0
- package/lib/cjs/content-fields/flow-queue-status-conditional.d.ts +30 -0
- package/lib/cjs/content-fields/flow-queue-status-conditional.js +95 -0
- package/lib/cjs/content-fields/flow-queue-status-conditional.js.map +1 -0
- package/lib/cjs/content-fields/flow-rating.d.ts +15 -0
- package/lib/cjs/content-fields/flow-rating.js +66 -0
- package/lib/cjs/content-fields/flow-rating.js.map +1 -0
- package/lib/cjs/content-fields/flow-text.d.ts +15 -0
- package/lib/cjs/content-fields/flow-text.js +60 -0
- package/lib/cjs/content-fields/flow-text.js.map +1 -0
- package/lib/cjs/content-fields/flow-video.d.ts +10 -0
- package/lib/cjs/content-fields/flow-video.js +33 -0
- package/lib/cjs/content-fields/flow-video.js.map +1 -0
- package/lib/cjs/content-fields/flow-webview.d.ts +16 -0
- package/lib/cjs/content-fields/flow-webview.js +78 -0
- package/lib/cjs/content-fields/flow-webview.js.map +1 -0
- package/lib/cjs/content-fields/flow-whatsapp-cta-url-button.d.ts +21 -0
- package/lib/cjs/content-fields/flow-whatsapp-cta-url-button.js +92 -0
- package/lib/cjs/content-fields/flow-whatsapp-cta-url-button.js.map +1 -0
- package/lib/cjs/content-fields/flow-whatsapp-request-contact-info.d.ts +11 -0
- package/lib/cjs/content-fields/flow-whatsapp-request-contact-info.js +46 -0
- package/lib/cjs/content-fields/flow-whatsapp-request-contact-info.js.map +1 -0
- package/lib/cjs/content-fields/flow-whatsapp-template.d.ts +37 -0
- package/lib/cjs/content-fields/flow-whatsapp-template.js +264 -0
- package/lib/cjs/content-fields/flow-whatsapp-template.js.map +1 -0
- package/lib/cjs/content-fields/hubtype-fields/ai-agent-router.d.ts +21 -0
- package/lib/cjs/content-fields/hubtype-fields/ai-agent-router.js +3 -0
- package/lib/cjs/content-fields/hubtype-fields/ai-agent-router.js.map +1 -0
- package/lib/cjs/content-fields/hubtype-fields/ai-agent.d.ts +25 -0
- package/lib/cjs/content-fields/hubtype-fields/ai-agent.js +3 -0
- package/lib/cjs/content-fields/hubtype-fields/ai-agent.js.map +1 -0
- package/lib/cjs/content-fields/hubtype-fields/bot-action.d.ts +10 -0
- package/lib/cjs/content-fields/hubtype-fields/bot-action.js +3 -0
- package/lib/cjs/content-fields/hubtype-fields/bot-action.js.map +1 -0
- package/lib/cjs/content-fields/hubtype-fields/button.d.ts +8 -0
- package/lib/cjs/content-fields/hubtype-fields/button.js +3 -0
- package/lib/cjs/content-fields/hubtype-fields/button.js.map +1 -0
- package/lib/cjs/content-fields/hubtype-fields/capture-user-input.d.ts +19 -0
- package/lib/cjs/content-fields/hubtype-fields/capture-user-input.js +12 -0
- package/lib/cjs/content-fields/hubtype-fields/capture-user-input.js.map +1 -0
- package/lib/cjs/content-fields/hubtype-fields/carousel.d.ts +17 -0
- package/lib/cjs/content-fields/hubtype-fields/carousel.js +3 -0
- package/lib/cjs/content-fields/hubtype-fields/carousel.js.map +1 -0
- package/lib/cjs/content-fields/hubtype-fields/channel-conditional.d.ts +10 -0
- package/lib/cjs/content-fields/hubtype-fields/channel-conditional.js +3 -0
- package/lib/cjs/content-fields/hubtype-fields/channel-conditional.js.map +1 -0
- package/lib/cjs/content-fields/hubtype-fields/common.d.ts +83 -0
- package/lib/cjs/content-fields/hubtype-fields/common.js +3 -0
- package/lib/cjs/content-fields/hubtype-fields/common.js.map +1 -0
- package/lib/cjs/content-fields/hubtype-fields/contact-reasons-conditional.d.ts +16 -0
- package/lib/cjs/content-fields/hubtype-fields/contact-reasons-conditional.js +3 -0
- package/lib/cjs/content-fields/hubtype-fields/contact-reasons-conditional.js.map +1 -0
- package/lib/cjs/content-fields/hubtype-fields/country-conditional.d.ts +10 -0
- package/lib/cjs/content-fields/hubtype-fields/country-conditional.js +3 -0
- package/lib/cjs/content-fields/hubtype-fields/country-conditional.js.map +1 -0
- package/lib/cjs/content-fields/hubtype-fields/custom-conditional-v2.d.ts +56 -0
- package/lib/cjs/content-fields/hubtype-fields/custom-conditional-v2.js +36 -0
- package/lib/cjs/content-fields/hubtype-fields/custom-conditional-v2.js.map +1 -0
- package/lib/cjs/content-fields/hubtype-fields/custom-conditional.d.ts +11 -0
- package/lib/cjs/content-fields/hubtype-fields/custom-conditional.js +3 -0
- package/lib/cjs/content-fields/hubtype-fields/custom-conditional.js.map +1 -0
- package/lib/cjs/content-fields/hubtype-fields/do-nothing.d.ts +6 -0
- package/lib/cjs/content-fields/hubtype-fields/do-nothing.js +3 -0
- package/lib/cjs/content-fields/hubtype-fields/do-nothing.js.map +1 -0
- package/lib/cjs/content-fields/hubtype-fields/fallback.d.ts +9 -0
- package/lib/cjs/content-fields/hubtype-fields/fallback.js +3 -0
- package/lib/cjs/content-fields/hubtype-fields/fallback.js.map +1 -0
- package/lib/cjs/content-fields/hubtype-fields/function.d.ts +30 -0
- package/lib/cjs/content-fields/hubtype-fields/function.js +11 -0
- package/lib/cjs/content-fields/hubtype-fields/function.js.map +1 -0
- package/lib/cjs/content-fields/hubtype-fields/go-to-flow.d.ts +9 -0
- package/lib/cjs/content-fields/hubtype-fields/go-to-flow.js +3 -0
- package/lib/cjs/content-fields/hubtype-fields/go-to-flow.js.map +1 -0
- package/lib/cjs/content-fields/hubtype-fields/handoff.d.ts +21 -0
- package/lib/cjs/content-fields/hubtype-fields/handoff.js +10 -0
- package/lib/cjs/content-fields/hubtype-fields/handoff.js.map +1 -0
- package/lib/cjs/content-fields/hubtype-fields/image.d.ts +8 -0
- package/lib/cjs/content-fields/hubtype-fields/image.js +3 -0
- package/lib/cjs/content-fields/hubtype-fields/image.js.map +1 -0
- package/lib/cjs/content-fields/hubtype-fields/index.d.ts +28 -0
- package/lib/cjs/content-fields/hubtype-fields/index.js +32 -0
- package/lib/cjs/content-fields/hubtype-fields/index.js.map +1 -0
- package/lib/cjs/content-fields/hubtype-fields/keyword.d.ts +9 -0
- package/lib/cjs/content-fields/hubtype-fields/keyword.js +3 -0
- package/lib/cjs/content-fields/hubtype-fields/keyword.js.map +1 -0
- package/lib/cjs/content-fields/hubtype-fields/node-types.d.ts +33 -0
- package/lib/cjs/content-fields/hubtype-fields/node-types.js +40 -0
- package/lib/cjs/content-fields/hubtype-fields/node-types.js.map +1 -0
- package/lib/cjs/content-fields/hubtype-fields/nodes.d.ts +28 -0
- package/lib/cjs/content-fields/hubtype-fields/nodes.js +3 -0
- package/lib/cjs/content-fields/hubtype-fields/nodes.js.map +1 -0
- package/lib/cjs/content-fields/hubtype-fields/payload.d.ts +8 -0
- package/lib/cjs/content-fields/hubtype-fields/payload.js +3 -0
- package/lib/cjs/content-fields/hubtype-fields/payload.js.map +1 -0
- package/lib/cjs/content-fields/hubtype-fields/queue-status-conditional.d.ts +25 -0
- package/lib/cjs/content-fields/hubtype-fields/queue-status-conditional.js +3 -0
- package/lib/cjs/content-fields/hubtype-fields/queue-status-conditional.js.map +1 -0
- package/lib/cjs/content-fields/hubtype-fields/rating.d.ts +23 -0
- package/lib/cjs/content-fields/hubtype-fields/rating.js +9 -0
- package/lib/cjs/content-fields/hubtype-fields/rating.js.map +1 -0
- package/lib/cjs/content-fields/hubtype-fields/smart-intent.d.ts +12 -0
- package/lib/cjs/content-fields/hubtype-fields/smart-intent.js +3 -0
- package/lib/cjs/content-fields/hubtype-fields/smart-intent.js.map +1 -0
- package/lib/cjs/content-fields/hubtype-fields/text.d.ts +11 -0
- package/lib/cjs/content-fields/hubtype-fields/text.js +3 -0
- package/lib/cjs/content-fields/hubtype-fields/text.js.map +1 -0
- package/lib/cjs/content-fields/hubtype-fields/url.d.ts +8 -0
- package/lib/cjs/content-fields/hubtype-fields/url.js +3 -0
- package/lib/cjs/content-fields/hubtype-fields/url.js.map +1 -0
- package/lib/cjs/content-fields/hubtype-fields/video.d.ts +8 -0
- package/lib/cjs/content-fields/hubtype-fields/video.js +3 -0
- package/lib/cjs/content-fields/hubtype-fields/video.js.map +1 -0
- package/lib/cjs/content-fields/hubtype-fields/webview.d.ts +17 -0
- package/lib/cjs/content-fields/hubtype-fields/webview.js +3 -0
- package/lib/cjs/content-fields/hubtype-fields/webview.js.map +1 -0
- package/lib/cjs/content-fields/hubtype-fields/whatsapp-button-list.d.ts +21 -0
- package/lib/cjs/content-fields/hubtype-fields/whatsapp-button-list.js +3 -0
- package/lib/cjs/content-fields/hubtype-fields/whatsapp-button-list.js.map +1 -0
- package/lib/cjs/content-fields/hubtype-fields/whatsapp-cta-url-button.d.ts +17 -0
- package/lib/cjs/content-fields/hubtype-fields/whatsapp-cta-url-button.js +3 -0
- package/lib/cjs/content-fields/hubtype-fields/whatsapp-cta-url-button.js.map +1 -0
- package/lib/cjs/content-fields/hubtype-fields/whatsapp-request-contact-info.d.ts +10 -0
- package/lib/cjs/content-fields/hubtype-fields/whatsapp-request-contact-info.js +3 -0
- package/lib/cjs/content-fields/hubtype-fields/whatsapp-request-contact-info.js.map +1 -0
- package/lib/cjs/content-fields/hubtype-fields/whatsapp-template.d.ts +96 -0
- package/lib/cjs/content-fields/hubtype-fields/whatsapp-template.js +9 -0
- package/lib/cjs/content-fields/hubtype-fields/whatsapp-template.js.map +1 -0
- package/lib/cjs/content-fields/index.d.ts +27 -0
- package/lib/cjs/content-fields/index.js +56 -0
- package/lib/cjs/content-fields/index.js.map +1 -0
- package/lib/cjs/content-fields/whatsapp-button-list/flow-whatsapp-button-list-row.d.ts +14 -0
- package/lib/cjs/content-fields/whatsapp-button-list/flow-whatsapp-button-list-row.js +41 -0
- package/lib/cjs/content-fields/whatsapp-button-list/flow-whatsapp-button-list-row.js.map +1 -0
- package/lib/cjs/content-fields/whatsapp-button-list/flow-whatsapp-button-list-section.d.ts +13 -0
- package/lib/cjs/content-fields/whatsapp-button-list/flow-whatsapp-button-list-section.js +36 -0
- package/lib/cjs/content-fields/whatsapp-button-list/flow-whatsapp-button-list-section.js.map +1 -0
- package/lib/cjs/content-fields/whatsapp-button-list/flow-whatsapp-button-list.d.ts +14 -0
- package/lib/cjs/content-fields/whatsapp-button-list/flow-whatsapp-button-list.js +46 -0
- package/lib/cjs/content-fields/whatsapp-button-list/flow-whatsapp-button-list.js.map +1 -0
- package/lib/cjs/content-fields/whatsapp-button-list/index.d.ts +3 -0
- package/lib/cjs/content-fields/whatsapp-button-list/index.js +10 -0
- package/lib/cjs/content-fields/whatsapp-button-list/index.js.map +1 -0
- package/lib/cjs/filters/index.d.ts +12 -0
- package/lib/cjs/filters/index.js +17 -0
- package/lib/cjs/filters/index.js.map +1 -0
- package/lib/cjs/flow-factory.d.ts +12 -0
- package/lib/cjs/flow-factory.js +73 -0
- package/lib/cjs/flow-factory.js.map +1 -0
- package/lib/cjs/functions/index.d.ts +11 -0
- package/lib/cjs/functions/index.js +49 -0
- package/lib/cjs/functions/index.js.map +1 -0
- package/lib/cjs/index.d.ts +42 -0
- package/lib/cjs/index.js +142 -0
- package/lib/cjs/index.js.map +1 -0
- package/lib/cjs/services/hubtype-queues-api.js +26 -0
- package/lib/cjs/services/hubtype-queues-api.js.map +1 -0
- package/lib/cjs/structured-output/flow-builder-content.js +15 -0
- package/lib/cjs/structured-output/flow-builder-content.js.map +1 -0
- package/lib/cjs/tracking.d.ts +16 -0
- package/lib/cjs/tracking.js +71 -0
- package/lib/cjs/tracking.js.map +1 -0
- package/lib/cjs/types.d.ts +62 -0
- package/lib/cjs/types.js +14 -0
- package/lib/cjs/types.js.map +1 -0
- package/lib/cjs/user-input/capture-user-input-api.d.ts +21 -0
- package/lib/cjs/user-input/capture-user-input-api.js +88 -0
- package/lib/cjs/user-input/capture-user-input-api.js.map +1 -0
- package/lib/cjs/user-input/index.d.ts +4 -0
- package/lib/cjs/user-input/index.js +37 -0
- package/lib/cjs/user-input/index.js.map +1 -0
- package/lib/cjs/user-input/keyword.d.ts +27 -0
- package/lib/cjs/user-input/keyword.js +84 -0
- package/lib/cjs/user-input/keyword.js.map +1 -0
- package/lib/cjs/user-input/smart-intent.d.ts +24 -0
- package/lib/cjs/user-input/smart-intent.js +89 -0
- package/lib/cjs/user-input/smart-intent.js.map +1 -0
- package/lib/cjs/utils/ai-agent.d.ts +11 -0
- package/lib/cjs/utils/ai-agent.js +28 -0
- package/lib/cjs/utils/ai-agent.js.map +1 -0
- package/lib/cjs/utils/authentication.js +21 -0
- package/lib/cjs/utils/authentication.js.map +1 -0
- package/lib/cjs/utils/flow-locale.js +79 -0
- package/lib/cjs/utils/flow-locale.js.map +1 -0
- package/lib/cjs/utils/get-flow-builder-plugin.d.ts +3 -0
- package/lib/cjs/utils/get-flow-builder-plugin.js +16 -0
- package/lib/cjs/utils/get-flow-builder-plugin.js.map +1 -0
- package/lib/cjs/utils/hubtype-assistant-content.d.ts +13 -0
- package/lib/cjs/utils/hubtype-assistant-content.js +184 -0
- package/lib/cjs/utils/hubtype-assistant-content.js.map +1 -0
- package/lib/cjs/utils/input.js +35 -0
- package/lib/cjs/utils/input.js.map +1 -0
- package/lib/cjs/webview/contents-context.d.ts +2 -0
- package/lib/cjs/webview/contents-context.js +12 -0
- package/lib/cjs/webview/contents-context.js.map +1 -0
- package/lib/cjs/webview/index.d.ts +3 -0
- package/lib/cjs/webview/index.js +10 -0
- package/lib/cjs/webview/index.js.map +1 -0
- package/lib/cjs/webview/types.d.ts +47 -0
- package/lib/cjs/webview/types.js +9 -0
- package/lib/cjs/webview/types.js.map +1 -0
- package/lib/cjs/webview/use-webview-contents.d.ts +2 -0
- package/lib/cjs/webview/use-webview-contents.js +83 -0
- package/lib/cjs/webview/use-webview-contents.js.map +1 -0
- package/lib/esm/action/ai-agent-from-user-input.d.ts +3 -0
- package/lib/esm/action/ai-agent-from-user-input.js +38 -0
- package/lib/esm/action/ai-agent-from-user-input.js.map +1 -0
- package/lib/esm/action/context.d.ts +11 -0
- package/lib/esm/action/context.js +17 -0
- package/lib/esm/action/context.js.map +1 -0
- package/lib/esm/action/fallback.d.ts +3 -0
- package/lib/esm/action/fallback.js +36 -0
- package/lib/esm/action/fallback.js.map +1 -0
- package/lib/esm/action/first-interaction.d.ts +3 -0
- package/lib/esm/action/first-interaction.js +93 -0
- package/lib/esm/action/first-interaction.js.map +1 -0
- package/lib/esm/action/get-contents.d.ts +3 -0
- package/lib/esm/action/get-contents.js +44 -0
- package/lib/esm/action/get-contents.js.map +1 -0
- package/lib/esm/action/index.d.ts +25 -0
- package/lib/esm/action/index.js +95 -0
- package/lib/esm/action/index.js.map +1 -0
- package/lib/esm/action/payload.d.ts +3 -0
- package/lib/esm/action/payload.js +74 -0
- package/lib/esm/action/payload.js.map +1 -0
- package/lib/esm/api.d.ts +45 -0
- package/lib/esm/api.js +227 -0
- package/lib/esm/api.js.map +1 -0
- package/lib/esm/bot-context-manager.d.ts +17 -0
- package/lib/esm/bot-context-manager.js +93 -0
- package/lib/esm/bot-context-manager.js.map +1 -0
- package/lib/esm/constants.d.ts +14 -0
- package/lib/esm/constants.js +20 -0
- package/lib/esm/constants.js.map +1 -0
- package/lib/esm/content-fields/contact-reasons-conditional-matcher.d.ts +4 -0
- package/lib/esm/content-fields/contact-reasons-conditional-matcher.js +12 -0
- package/lib/esm/content-fields/contact-reasons-conditional-matcher.js.map +1 -0
- package/lib/esm/content-fields/content-fields-base.d.ts +20 -0
- package/lib/esm/content-fields/content-fields-base.js +74 -0
- package/lib/esm/content-fields/content-fields-base.js.map +1 -0
- package/lib/esm/content-fields/custom-conditional/custom-conditional-v2-evaluators.d.ts +15 -0
- package/lib/esm/content-fields/custom-conditional/custom-conditional-v2-evaluators.js +71 -0
- package/lib/esm/content-fields/custom-conditional/custom-conditional-v2-evaluators.js.map +1 -0
- package/lib/esm/content-fields/custom-conditional/custom-conditional-v2-resolver.d.ts +9 -0
- package/lib/esm/content-fields/custom-conditional/custom-conditional-v2-resolver.js +58 -0
- package/lib/esm/content-fields/custom-conditional/custom-conditional-v2-resolver.js.map +1 -0
- package/lib/esm/content-fields/custom-conditional/flow-custom-condition-v2.d.ts +17 -0
- package/lib/esm/content-fields/custom-conditional/flow-custom-condition-v2.js +79 -0
- package/lib/esm/content-fields/custom-conditional/flow-custom-condition-v2.js.map +1 -0
- package/lib/esm/content-fields/flow-ai-agent-base.d.ts +25 -0
- package/lib/esm/content-fields/flow-ai-agent-base.js +97 -0
- package/lib/esm/content-fields/flow-ai-agent-base.js.map +1 -0
- package/lib/esm/content-fields/flow-ai-agent-router.d.ts +21 -0
- package/lib/esm/content-fields/flow-ai-agent-router.js +126 -0
- package/lib/esm/content-fields/flow-ai-agent-router.js.map +1 -0
- package/lib/esm/content-fields/flow-ai-agent.d.ts +17 -0
- package/lib/esm/content-fields/flow-ai-agent.js +65 -0
- package/lib/esm/content-fields/flow-ai-agent.js.map +1 -0
- package/lib/esm/content-fields/flow-bot-action.d.ts +14 -0
- package/lib/esm/content-fields/flow-bot-action.js +45 -0
- package/lib/esm/content-fields/flow-bot-action.js.map +1 -0
- package/lib/esm/content-fields/flow-button.d.ts +31 -0
- package/lib/esm/content-fields/flow-button.js +86 -0
- package/lib/esm/content-fields/flow-button.js.map +1 -0
- package/lib/esm/content-fields/flow-capture-user-input.d.ts +14 -0
- package/lib/esm/content-fields/flow-capture-user-input.js +45 -0
- package/lib/esm/content-fields/flow-capture-user-input.js.map +1 -0
- package/lib/esm/content-fields/flow-carousel.d.ts +22 -0
- package/lib/esm/content-fields/flow-carousel.js +152 -0
- package/lib/esm/content-fields/flow-carousel.js.map +1 -0
- package/lib/esm/content-fields/flow-channel-conditional.d.ts +14 -0
- package/lib/esm/content-fields/flow-channel-conditional.js +57 -0
- package/lib/esm/content-fields/flow-channel-conditional.js.map +1 -0
- package/lib/esm/content-fields/flow-contact-reasons-conditional.d.ts +14 -0
- package/lib/esm/content-fields/flow-contact-reasons-conditional.js +65 -0
- package/lib/esm/content-fields/flow-contact-reasons-conditional.js.map +1 -0
- package/lib/esm/content-fields/flow-country-conditional.d.ts +13 -0
- package/lib/esm/content-fields/flow-country-conditional.js +59 -0
- package/lib/esm/content-fields/flow-country-conditional.js.map +1 -0
- package/lib/esm/content-fields/flow-custom-conditional.d.ts +17 -0
- package/lib/esm/content-fields/flow-custom-conditional.js +89 -0
- package/lib/esm/content-fields/flow-custom-conditional.js.map +1 -0
- package/lib/esm/content-fields/flow-do-nothing.d.ts +9 -0
- package/lib/esm/content-fields/flow-do-nothing.js +27 -0
- package/lib/esm/content-fields/flow-do-nothing.js.map +1 -0
- package/lib/esm/content-fields/flow-element.d.ts +22 -0
- package/lib/esm/content-fields/flow-element.js +50 -0
- package/lib/esm/content-fields/flow-element.js.map +1 -0
- package/lib/esm/content-fields/flow-go-to-flow.d.ts +13 -0
- package/lib/esm/content-fields/flow-go-to-flow.js +51 -0
- package/lib/esm/content-fields/flow-go-to-flow.js.map +1 -0
- package/lib/esm/content-fields/flow-handoff.d.ts +23 -0
- package/lib/esm/content-fields/flow-handoff.js +104 -0
- package/lib/esm/content-fields/flow-handoff.js.map +1 -0
- package/lib/esm/content-fields/flow-image.d.ts +10 -0
- package/lib/esm/content-fields/flow-image.js +33 -0
- package/lib/esm/content-fields/flow-image.js.map +1 -0
- package/lib/esm/content-fields/flow-queue-status-conditional.d.ts +30 -0
- package/lib/esm/content-fields/flow-queue-status-conditional.js +95 -0
- package/lib/esm/content-fields/flow-queue-status-conditional.js.map +1 -0
- package/lib/esm/content-fields/flow-rating.d.ts +15 -0
- package/lib/esm/content-fields/flow-rating.js +66 -0
- package/lib/esm/content-fields/flow-rating.js.map +1 -0
- package/lib/esm/content-fields/flow-text.d.ts +15 -0
- package/lib/esm/content-fields/flow-text.js +60 -0
- package/lib/esm/content-fields/flow-text.js.map +1 -0
- package/lib/esm/content-fields/flow-video.d.ts +10 -0
- package/lib/esm/content-fields/flow-video.js +33 -0
- package/lib/esm/content-fields/flow-video.js.map +1 -0
- package/lib/esm/content-fields/flow-webview.d.ts +16 -0
- package/lib/esm/content-fields/flow-webview.js +78 -0
- package/lib/esm/content-fields/flow-webview.js.map +1 -0
- package/lib/esm/content-fields/flow-whatsapp-cta-url-button.d.ts +21 -0
- package/lib/esm/content-fields/flow-whatsapp-cta-url-button.js +92 -0
- package/lib/esm/content-fields/flow-whatsapp-cta-url-button.js.map +1 -0
- package/lib/esm/content-fields/flow-whatsapp-request-contact-info.d.ts +11 -0
- package/lib/esm/content-fields/flow-whatsapp-request-contact-info.js +46 -0
- package/lib/esm/content-fields/flow-whatsapp-request-contact-info.js.map +1 -0
- package/lib/esm/content-fields/flow-whatsapp-template.d.ts +37 -0
- package/lib/esm/content-fields/flow-whatsapp-template.js +264 -0
- package/lib/esm/content-fields/flow-whatsapp-template.js.map +1 -0
- package/lib/esm/content-fields/hubtype-fields/ai-agent-router.d.ts +21 -0
- package/lib/esm/content-fields/hubtype-fields/ai-agent-router.js +3 -0
- package/lib/esm/content-fields/hubtype-fields/ai-agent-router.js.map +1 -0
- package/lib/esm/content-fields/hubtype-fields/ai-agent.d.ts +25 -0
- package/lib/esm/content-fields/hubtype-fields/ai-agent.js +3 -0
- package/lib/esm/content-fields/hubtype-fields/ai-agent.js.map +1 -0
- package/lib/esm/content-fields/hubtype-fields/bot-action.d.ts +10 -0
- package/lib/esm/content-fields/hubtype-fields/bot-action.js +3 -0
- package/lib/esm/content-fields/hubtype-fields/bot-action.js.map +1 -0
- package/lib/esm/content-fields/hubtype-fields/button.d.ts +8 -0
- package/lib/esm/content-fields/hubtype-fields/button.js +3 -0
- package/lib/esm/content-fields/hubtype-fields/button.js.map +1 -0
- package/lib/esm/content-fields/hubtype-fields/capture-user-input.d.ts +19 -0
- package/lib/esm/content-fields/hubtype-fields/capture-user-input.js +12 -0
- package/lib/esm/content-fields/hubtype-fields/capture-user-input.js.map +1 -0
- package/lib/esm/content-fields/hubtype-fields/carousel.d.ts +17 -0
- package/lib/esm/content-fields/hubtype-fields/carousel.js +3 -0
- package/lib/esm/content-fields/hubtype-fields/carousel.js.map +1 -0
- package/lib/esm/content-fields/hubtype-fields/channel-conditional.d.ts +10 -0
- package/lib/esm/content-fields/hubtype-fields/channel-conditional.js +3 -0
- package/lib/esm/content-fields/hubtype-fields/channel-conditional.js.map +1 -0
- package/lib/esm/content-fields/hubtype-fields/common.d.ts +83 -0
- package/lib/esm/content-fields/hubtype-fields/common.js +3 -0
- package/lib/esm/content-fields/hubtype-fields/common.js.map +1 -0
- package/lib/esm/content-fields/hubtype-fields/contact-reasons-conditional.d.ts +16 -0
- package/lib/esm/content-fields/hubtype-fields/contact-reasons-conditional.js +3 -0
- package/lib/esm/content-fields/hubtype-fields/contact-reasons-conditional.js.map +1 -0
- package/lib/esm/content-fields/hubtype-fields/country-conditional.d.ts +10 -0
- package/lib/esm/content-fields/hubtype-fields/country-conditional.js +3 -0
- package/lib/esm/content-fields/hubtype-fields/country-conditional.js.map +1 -0
- package/lib/esm/content-fields/hubtype-fields/custom-conditional-v2.d.ts +56 -0
- package/lib/esm/content-fields/hubtype-fields/custom-conditional-v2.js +36 -0
- package/lib/esm/content-fields/hubtype-fields/custom-conditional-v2.js.map +1 -0
- package/lib/esm/content-fields/hubtype-fields/custom-conditional.d.ts +11 -0
- package/lib/esm/content-fields/hubtype-fields/custom-conditional.js +3 -0
- package/lib/esm/content-fields/hubtype-fields/custom-conditional.js.map +1 -0
- package/lib/esm/content-fields/hubtype-fields/do-nothing.d.ts +6 -0
- package/lib/esm/content-fields/hubtype-fields/do-nothing.js +3 -0
- package/lib/esm/content-fields/hubtype-fields/do-nothing.js.map +1 -0
- package/lib/esm/content-fields/hubtype-fields/fallback.d.ts +9 -0
- package/lib/esm/content-fields/hubtype-fields/fallback.js +3 -0
- package/lib/esm/content-fields/hubtype-fields/fallback.js.map +1 -0
- package/lib/esm/content-fields/hubtype-fields/function.d.ts +30 -0
- package/lib/esm/content-fields/hubtype-fields/function.js +11 -0
- package/lib/esm/content-fields/hubtype-fields/function.js.map +1 -0
- package/lib/esm/content-fields/hubtype-fields/go-to-flow.d.ts +9 -0
- package/lib/esm/content-fields/hubtype-fields/go-to-flow.js +3 -0
- package/lib/esm/content-fields/hubtype-fields/go-to-flow.js.map +1 -0
- package/lib/esm/content-fields/hubtype-fields/handoff.d.ts +21 -0
- package/lib/esm/content-fields/hubtype-fields/handoff.js +10 -0
- package/lib/esm/content-fields/hubtype-fields/handoff.js.map +1 -0
- package/lib/esm/content-fields/hubtype-fields/image.d.ts +8 -0
- package/lib/esm/content-fields/hubtype-fields/image.js +3 -0
- package/lib/esm/content-fields/hubtype-fields/image.js.map +1 -0
- package/lib/esm/content-fields/hubtype-fields/index.d.ts +28 -0
- package/lib/esm/content-fields/hubtype-fields/index.js +32 -0
- package/lib/esm/content-fields/hubtype-fields/index.js.map +1 -0
- package/lib/esm/content-fields/hubtype-fields/keyword.d.ts +9 -0
- package/lib/esm/content-fields/hubtype-fields/keyword.js +3 -0
- package/lib/esm/content-fields/hubtype-fields/keyword.js.map +1 -0
- package/lib/esm/content-fields/hubtype-fields/node-types.d.ts +33 -0
- package/lib/esm/content-fields/hubtype-fields/node-types.js +40 -0
- package/lib/esm/content-fields/hubtype-fields/node-types.js.map +1 -0
- package/lib/esm/content-fields/hubtype-fields/nodes.d.ts +28 -0
- package/lib/esm/content-fields/hubtype-fields/nodes.js +3 -0
- package/lib/esm/content-fields/hubtype-fields/nodes.js.map +1 -0
- package/lib/esm/content-fields/hubtype-fields/payload.d.ts +8 -0
- package/lib/esm/content-fields/hubtype-fields/payload.js +3 -0
- package/lib/esm/content-fields/hubtype-fields/payload.js.map +1 -0
- package/lib/esm/content-fields/hubtype-fields/queue-status-conditional.d.ts +25 -0
- package/lib/esm/content-fields/hubtype-fields/queue-status-conditional.js +3 -0
- package/lib/esm/content-fields/hubtype-fields/queue-status-conditional.js.map +1 -0
- package/lib/esm/content-fields/hubtype-fields/rating.d.ts +23 -0
- package/lib/esm/content-fields/hubtype-fields/rating.js +9 -0
- package/lib/esm/content-fields/hubtype-fields/rating.js.map +1 -0
- package/lib/esm/content-fields/hubtype-fields/smart-intent.d.ts +12 -0
- package/lib/esm/content-fields/hubtype-fields/smart-intent.js +3 -0
- package/lib/esm/content-fields/hubtype-fields/smart-intent.js.map +1 -0
- package/lib/esm/content-fields/hubtype-fields/text.d.ts +11 -0
- package/lib/esm/content-fields/hubtype-fields/text.js +3 -0
- package/lib/esm/content-fields/hubtype-fields/text.js.map +1 -0
- package/lib/esm/content-fields/hubtype-fields/url.d.ts +8 -0
- package/lib/esm/content-fields/hubtype-fields/url.js +3 -0
- package/lib/esm/content-fields/hubtype-fields/url.js.map +1 -0
- package/lib/esm/content-fields/hubtype-fields/video.d.ts +8 -0
- package/lib/esm/content-fields/hubtype-fields/video.js +3 -0
- package/lib/esm/content-fields/hubtype-fields/video.js.map +1 -0
- package/lib/esm/content-fields/hubtype-fields/webview.d.ts +17 -0
- package/lib/esm/content-fields/hubtype-fields/webview.js +3 -0
- package/lib/esm/content-fields/hubtype-fields/webview.js.map +1 -0
- package/lib/esm/content-fields/hubtype-fields/whatsapp-button-list.d.ts +21 -0
- package/lib/esm/content-fields/hubtype-fields/whatsapp-button-list.js +3 -0
- package/lib/esm/content-fields/hubtype-fields/whatsapp-button-list.js.map +1 -0
- package/lib/esm/content-fields/hubtype-fields/whatsapp-cta-url-button.d.ts +17 -0
- package/lib/esm/content-fields/hubtype-fields/whatsapp-cta-url-button.js +3 -0
- package/lib/esm/content-fields/hubtype-fields/whatsapp-cta-url-button.js.map +1 -0
- package/lib/esm/content-fields/hubtype-fields/whatsapp-request-contact-info.d.ts +10 -0
- package/lib/esm/content-fields/hubtype-fields/whatsapp-request-contact-info.js +3 -0
- package/lib/esm/content-fields/hubtype-fields/whatsapp-request-contact-info.js.map +1 -0
- package/lib/esm/content-fields/hubtype-fields/whatsapp-template.d.ts +96 -0
- package/lib/esm/content-fields/hubtype-fields/whatsapp-template.js +9 -0
- package/lib/esm/content-fields/hubtype-fields/whatsapp-template.js.map +1 -0
- package/lib/esm/content-fields/index.d.ts +27 -0
- package/lib/esm/content-fields/index.js +56 -0
- package/lib/esm/content-fields/index.js.map +1 -0
- package/lib/esm/content-fields/whatsapp-button-list/flow-whatsapp-button-list-row.d.ts +14 -0
- package/lib/esm/content-fields/whatsapp-button-list/flow-whatsapp-button-list-row.js +41 -0
- package/lib/esm/content-fields/whatsapp-button-list/flow-whatsapp-button-list-row.js.map +1 -0
- package/lib/esm/content-fields/whatsapp-button-list/flow-whatsapp-button-list-section.d.ts +13 -0
- package/lib/esm/content-fields/whatsapp-button-list/flow-whatsapp-button-list-section.js +36 -0
- package/lib/esm/content-fields/whatsapp-button-list/flow-whatsapp-button-list-section.js.map +1 -0
- package/lib/esm/content-fields/whatsapp-button-list/flow-whatsapp-button-list.d.ts +14 -0
- package/lib/esm/content-fields/whatsapp-button-list/flow-whatsapp-button-list.js +46 -0
- package/lib/esm/content-fields/whatsapp-button-list/flow-whatsapp-button-list.js.map +1 -0
- package/lib/esm/content-fields/whatsapp-button-list/index.d.ts +3 -0
- package/lib/esm/content-fields/whatsapp-button-list/index.js +10 -0
- package/lib/esm/content-fields/whatsapp-button-list/index.js.map +1 -0
- package/lib/esm/filters/index.d.ts +12 -0
- package/lib/esm/filters/index.js +17 -0
- package/lib/esm/filters/index.js.map +1 -0
- package/lib/esm/flow-factory.d.ts +12 -0
- package/lib/esm/flow-factory.js +73 -0
- package/lib/esm/flow-factory.js.map +1 -0
- package/lib/esm/functions/index.d.ts +11 -0
- package/lib/esm/functions/index.js +49 -0
- package/lib/esm/functions/index.js.map +1 -0
- package/lib/esm/index.d.ts +42 -0
- package/lib/esm/index.js +142 -0
- package/lib/esm/index.js.map +1 -0
- package/lib/esm/services/hubtype-queues-api.d.ts +14 -0
- package/lib/esm/services/hubtype-queues-api.js +26 -0
- package/lib/esm/services/hubtype-queues-api.js.map +1 -0
- package/lib/esm/structured-output/flow-builder-content.d.ts +13 -0
- package/lib/esm/structured-output/flow-builder-content.js +15 -0
- package/lib/esm/structured-output/flow-builder-content.js.map +1 -0
- package/lib/esm/tracking.d.ts +16 -0
- package/lib/esm/tracking.js +71 -0
- package/lib/esm/tracking.js.map +1 -0
- package/lib/esm/types.d.ts +62 -0
- package/lib/esm/types.js +14 -0
- package/lib/esm/types.js.map +1 -0
- package/lib/esm/user-input/capture-user-input-api.d.ts +21 -0
- package/lib/esm/user-input/capture-user-input-api.js +88 -0
- package/lib/esm/user-input/capture-user-input-api.js.map +1 -0
- package/lib/esm/user-input/index.d.ts +4 -0
- package/lib/esm/user-input/index.js +37 -0
- package/lib/esm/user-input/index.js.map +1 -0
- package/lib/esm/user-input/keyword.d.ts +27 -0
- package/lib/esm/user-input/keyword.js +84 -0
- package/lib/esm/user-input/keyword.js.map +1 -0
- package/lib/esm/user-input/smart-intent.d.ts +24 -0
- package/lib/esm/user-input/smart-intent.js +89 -0
- package/lib/esm/user-input/smart-intent.js.map +1 -0
- package/lib/esm/utils/ai-agent.d.ts +11 -0
- package/lib/esm/utils/ai-agent.js +28 -0
- package/lib/esm/utils/ai-agent.js.map +1 -0
- package/lib/esm/utils/authentication.d.ts +2 -0
- package/lib/esm/utils/authentication.js +21 -0
- package/lib/esm/utils/authentication.js.map +1 -0
- package/lib/esm/utils/flow-locale.d.ts +22 -0
- package/lib/esm/utils/flow-locale.js +79 -0
- package/lib/esm/utils/flow-locale.js.map +1 -0
- package/lib/esm/utils/get-flow-builder-plugin.d.ts +3 -0
- package/lib/esm/utils/get-flow-builder-plugin.js +16 -0
- package/lib/esm/utils/get-flow-builder-plugin.js.map +1 -0
- package/lib/esm/utils/hubtype-assistant-content.d.ts +13 -0
- package/lib/esm/utils/hubtype-assistant-content.js +184 -0
- package/lib/esm/utils/hubtype-assistant-content.js.map +1 -0
- package/lib/esm/utils/input.d.ts +6 -0
- package/lib/esm/utils/input.js +35 -0
- package/lib/esm/utils/input.js.map +1 -0
- package/lib/esm/webview/contents-context.d.ts +2 -0
- package/lib/esm/webview/contents-context.js +12 -0
- package/lib/esm/webview/contents-context.js.map +1 -0
- package/lib/esm/webview/index.d.ts +3 -0
- package/lib/esm/webview/index.js +10 -0
- package/lib/esm/webview/index.js.map +1 -0
- package/lib/esm/webview/types.d.ts +47 -0
- package/lib/esm/webview/types.js +9 -0
- package/lib/esm/webview/types.js.map +1 -0
- package/lib/esm/webview/use-webview-contents.d.ts +2 -0
- package/lib/esm/webview/use-webview-contents.js +83 -0
- package/lib/esm/webview/use-webview-contents.js.map +1 -0
- package/package.json +9 -11
- package/src/action/ai-agent-from-user-input.ts +7 -0
- package/src/action/first-interaction.ts +6 -0
- package/src/action/get-contents.ts +17 -2
- package/src/action/index.tsx +7 -0
- package/src/api.ts +52 -15
- package/src/bot-context-manager.ts +153 -0
- package/src/constants.ts +2 -1
- package/src/content-fields/contact-reasons-conditional-matcher.ts +24 -0
- package/src/content-fields/flow-ai-agent-base.tsx +12 -1
- package/src/content-fields/flow-ai-agent-router.tsx +1 -0
- package/src/content-fields/flow-ai-agent.tsx +1 -0
- package/src/content-fields/flow-contact-reasons-conditional.tsx +90 -0
- package/src/content-fields/flow-do-nothing.tsx +29 -0
- package/src/content-fields/flow-handoff.tsx +54 -7
- package/src/content-fields/flow-whatsapp-request-contact-info.tsx +19 -1
- package/src/content-fields/hubtype-fields/contact-reasons-conditional.ts +18 -0
- package/src/content-fields/hubtype-fields/do-nothing.ts +7 -0
- package/src/content-fields/hubtype-fields/handoff.ts +17 -1
- package/src/content-fields/hubtype-fields/index.ts +1 -0
- package/src/content-fields/hubtype-fields/node-types.ts +2 -0
- package/src/content-fields/hubtype-fields/nodes.ts +4 -0
- package/src/content-fields/hubtype-fields/whatsapp-request-contact-info.ts +2 -0
- package/src/content-fields/index.ts +6 -0
- package/src/flow-factory.ts +11 -0
- package/src/index.ts +26 -88
- package/src/types.ts +1 -2
- package/src/utils/hubtype-assistant-content.ts +14 -0
- package/lib/action/ai-agent-from-user-input.d.ts +0 -3
- package/lib/action/ai-agent-from-user-input.js +0 -35
- package/lib/action/ai-agent-from-user-input.js.map +0 -1
- package/lib/action/context.d.ts +0 -11
- package/lib/action/context.js +0 -20
- package/lib/action/context.js.map +0 -1
- package/lib/action/fallback.d.ts +0 -3
- package/lib/action/fallback.js +0 -41
- package/lib/action/fallback.js.map +0 -1
- package/lib/action/first-interaction.d.ts +0 -3
- package/lib/action/first-interaction.js +0 -100
- package/lib/action/first-interaction.js.map +0 -1
- package/lib/action/get-contents.d.ts +0 -3
- package/lib/action/get-contents.js +0 -56
- package/lib/action/get-contents.js.map +0 -1
- package/lib/action/index.d.ts +0 -25
- package/lib/action/index.js +0 -126
- package/lib/action/index.js.map +0 -1
- package/lib/action/payload.d.ts +0 -3
- package/lib/action/payload.js +0 -78
- package/lib/action/payload.js.map +0 -1
- package/lib/api.d.ts +0 -40
- package/lib/api.js +0 -216
- package/lib/api.js.map +0 -1
- package/lib/constants.d.ts +0 -13
- package/lib/constants.js +0 -17
- package/lib/constants.js.map +0 -1
- package/lib/content-fields/content-fields-base.d.ts +0 -20
- package/lib/content-fields/content-fields-base.js +0 -78
- package/lib/content-fields/content-fields-base.js.map +0 -1
- package/lib/content-fields/custom-conditional/custom-conditional-v2-evaluators.d.ts +0 -15
- package/lib/content-fields/custom-conditional/custom-conditional-v2-evaluators.js +0 -73
- package/lib/content-fields/custom-conditional/custom-conditional-v2-evaluators.js.map +0 -1
- package/lib/content-fields/custom-conditional/custom-conditional-v2-resolver.d.ts +0 -9
- package/lib/content-fields/custom-conditional/custom-conditional-v2-resolver.js +0 -58
- package/lib/content-fields/custom-conditional/custom-conditional-v2-resolver.js.map +0 -1
- package/lib/content-fields/custom-conditional/flow-custom-condition-v2.d.ts +0 -17
- package/lib/content-fields/custom-conditional/flow-custom-condition-v2.js +0 -94
- package/lib/content-fields/custom-conditional/flow-custom-condition-v2.js.map +0 -1
- package/lib/content-fields/flow-ai-agent-base.d.ts +0 -25
- package/lib/content-fields/flow-ai-agent-base.js +0 -100
- package/lib/content-fields/flow-ai-agent-base.js.map +0 -1
- package/lib/content-fields/flow-ai-agent-router.d.ts +0 -21
- package/lib/content-fields/flow-ai-agent-router.js +0 -136
- package/lib/content-fields/flow-ai-agent-router.js.map +0 -1
- package/lib/content-fields/flow-ai-agent.d.ts +0 -17
- package/lib/content-fields/flow-ai-agent.js +0 -75
- package/lib/content-fields/flow-ai-agent.js.map +0 -1
- package/lib/content-fields/flow-bot-action.d.ts +0 -14
- package/lib/content-fields/flow-bot-action.js +0 -53
- package/lib/content-fields/flow-bot-action.js.map +0 -1
- package/lib/content-fields/flow-button.d.ts +0 -31
- package/lib/content-fields/flow-button.js +0 -105
- package/lib/content-fields/flow-button.js.map +0 -1
- package/lib/content-fields/flow-capture-user-input.d.ts +0 -14
- package/lib/content-fields/flow-capture-user-input.js +0 -46
- package/lib/content-fields/flow-capture-user-input.js.map +0 -1
- package/lib/content-fields/flow-carousel.d.ts +0 -22
- package/lib/content-fields/flow-carousel.js +0 -193
- package/lib/content-fields/flow-carousel.js.map +0 -1
- package/lib/content-fields/flow-channel-conditional.d.ts +0 -14
- package/lib/content-fields/flow-channel-conditional.js +0 -61
- package/lib/content-fields/flow-channel-conditional.js.map +0 -1
- package/lib/content-fields/flow-country-conditional.d.ts +0 -13
- package/lib/content-fields/flow-country-conditional.js +0 -64
- package/lib/content-fields/flow-country-conditional.js.map +0 -1
- package/lib/content-fields/flow-custom-conditional.d.ts +0 -17
- package/lib/content-fields/flow-custom-conditional.js +0 -87
- package/lib/content-fields/flow-custom-conditional.js.map +0 -1
- package/lib/content-fields/flow-element.d.ts +0 -22
- package/lib/content-fields/flow-element.js +0 -67
- package/lib/content-fields/flow-element.js.map +0 -1
- package/lib/content-fields/flow-go-to-flow.d.ts +0 -13
- package/lib/content-fields/flow-go-to-flow.js +0 -56
- package/lib/content-fields/flow-go-to-flow.js.map +0 -1
- package/lib/content-fields/flow-handoff.d.ts +0 -17
- package/lib/content-fields/flow-handoff.js +0 -79
- package/lib/content-fields/flow-handoff.js.map +0 -1
- package/lib/content-fields/flow-image.d.ts +0 -10
- package/lib/content-fields/flow-image.js +0 -42
- package/lib/content-fields/flow-image.js.map +0 -1
- package/lib/content-fields/flow-queue-status-conditional.d.ts +0 -30
- package/lib/content-fields/flow-queue-status-conditional.js +0 -100
- package/lib/content-fields/flow-queue-status-conditional.js.map +0 -1
- package/lib/content-fields/flow-rating.d.ts +0 -15
- package/lib/content-fields/flow-rating.js +0 -88
- package/lib/content-fields/flow-rating.js.map +0 -1
- package/lib/content-fields/flow-text.d.ts +0 -15
- package/lib/content-fields/flow-text.js +0 -82
- package/lib/content-fields/flow-text.js.map +0 -1
- package/lib/content-fields/flow-video.d.ts +0 -10
- package/lib/content-fields/flow-video.js +0 -42
- package/lib/content-fields/flow-video.js.map +0 -1
- package/lib/content-fields/flow-webview.d.ts +0 -16
- package/lib/content-fields/flow-webview.js +0 -81
- package/lib/content-fields/flow-webview.js.map +0 -1
- package/lib/content-fields/flow-whatsapp-cta-url-button.d.ts +0 -21
- package/lib/content-fields/flow-whatsapp-cta-url-button.js +0 -131
- package/lib/content-fields/flow-whatsapp-cta-url-button.js.map +0 -1
- package/lib/content-fields/flow-whatsapp-request-contact-info.d.ts +0 -10
- package/lib/content-fields/flow-whatsapp-request-contact-info.js +0 -51
- package/lib/content-fields/flow-whatsapp-request-contact-info.js.map +0 -1
- package/lib/content-fields/flow-whatsapp-template.d.ts +0 -37
- package/lib/content-fields/flow-whatsapp-template.js +0 -281
- package/lib/content-fields/flow-whatsapp-template.js.map +0 -1
- package/lib/content-fields/hubtype-fields/ai-agent-router.d.ts +0 -21
- package/lib/content-fields/hubtype-fields/ai-agent-router.js +0 -4
- package/lib/content-fields/hubtype-fields/ai-agent-router.js.map +0 -1
- package/lib/content-fields/hubtype-fields/ai-agent.d.ts +0 -25
- package/lib/content-fields/hubtype-fields/ai-agent.js +0 -4
- package/lib/content-fields/hubtype-fields/ai-agent.js.map +0 -1
- package/lib/content-fields/hubtype-fields/bot-action.d.ts +0 -10
- package/lib/content-fields/hubtype-fields/bot-action.js +0 -4
- package/lib/content-fields/hubtype-fields/bot-action.js.map +0 -1
- package/lib/content-fields/hubtype-fields/button.d.ts +0 -8
- package/lib/content-fields/hubtype-fields/button.js +0 -4
- package/lib/content-fields/hubtype-fields/button.js.map +0 -1
- package/lib/content-fields/hubtype-fields/capture-user-input.d.ts +0 -19
- package/lib/content-fields/hubtype-fields/capture-user-input.js +0 -12
- package/lib/content-fields/hubtype-fields/capture-user-input.js.map +0 -1
- package/lib/content-fields/hubtype-fields/carousel.d.ts +0 -17
- package/lib/content-fields/hubtype-fields/carousel.js +0 -4
- package/lib/content-fields/hubtype-fields/carousel.js.map +0 -1
- package/lib/content-fields/hubtype-fields/channel-conditional.d.ts +0 -10
- package/lib/content-fields/hubtype-fields/channel-conditional.js +0 -4
- package/lib/content-fields/hubtype-fields/channel-conditional.js.map +0 -1
- package/lib/content-fields/hubtype-fields/common.d.ts +0 -83
- package/lib/content-fields/hubtype-fields/common.js +0 -4
- package/lib/content-fields/hubtype-fields/common.js.map +0 -1
- package/lib/content-fields/hubtype-fields/country-conditional.d.ts +0 -10
- package/lib/content-fields/hubtype-fields/country-conditional.js +0 -4
- package/lib/content-fields/hubtype-fields/country-conditional.js.map +0 -1
- package/lib/content-fields/hubtype-fields/custom-conditional-v2.d.ts +0 -56
- package/lib/content-fields/hubtype-fields/custom-conditional-v2.js +0 -36
- package/lib/content-fields/hubtype-fields/custom-conditional-v2.js.map +0 -1
- package/lib/content-fields/hubtype-fields/custom-conditional.d.ts +0 -11
- package/lib/content-fields/hubtype-fields/custom-conditional.js +0 -4
- package/lib/content-fields/hubtype-fields/custom-conditional.js.map +0 -1
- package/lib/content-fields/hubtype-fields/fallback.d.ts +0 -9
- package/lib/content-fields/hubtype-fields/fallback.js +0 -4
- package/lib/content-fields/hubtype-fields/fallback.js.map +0 -1
- package/lib/content-fields/hubtype-fields/function.d.ts +0 -30
- package/lib/content-fields/hubtype-fields/function.js +0 -11
- package/lib/content-fields/hubtype-fields/function.js.map +0 -1
- package/lib/content-fields/hubtype-fields/go-to-flow.d.ts +0 -9
- package/lib/content-fields/hubtype-fields/go-to-flow.js +0 -4
- package/lib/content-fields/hubtype-fields/go-to-flow.js.map +0 -1
- package/lib/content-fields/hubtype-fields/handoff.d.ts +0 -11
- package/lib/content-fields/hubtype-fields/handoff.js +0 -4
- package/lib/content-fields/hubtype-fields/handoff.js.map +0 -1
- package/lib/content-fields/hubtype-fields/image.d.ts +0 -8
- package/lib/content-fields/hubtype-fields/image.js +0 -4
- package/lib/content-fields/hubtype-fields/image.js.map +0 -1
- package/lib/content-fields/hubtype-fields/index.d.ts +0 -27
- package/lib/content-fields/hubtype-fields/index.js +0 -57
- package/lib/content-fields/hubtype-fields/index.js.map +0 -1
- package/lib/content-fields/hubtype-fields/keyword.d.ts +0 -9
- package/lib/content-fields/hubtype-fields/keyword.js +0 -4
- package/lib/content-fields/hubtype-fields/keyword.js.map +0 -1
- package/lib/content-fields/hubtype-fields/node-types.d.ts +0 -31
- package/lib/content-fields/hubtype-fields/node-types.js +0 -38
- package/lib/content-fields/hubtype-fields/node-types.js.map +0 -1
- package/lib/content-fields/hubtype-fields/nodes.d.ts +0 -26
- package/lib/content-fields/hubtype-fields/nodes.js +0 -4
- package/lib/content-fields/hubtype-fields/nodes.js.map +0 -1
- package/lib/content-fields/hubtype-fields/payload.d.ts +0 -8
- package/lib/content-fields/hubtype-fields/payload.js +0 -4
- package/lib/content-fields/hubtype-fields/payload.js.map +0 -1
- package/lib/content-fields/hubtype-fields/queue-status-conditional.d.ts +0 -25
- package/lib/content-fields/hubtype-fields/queue-status-conditional.js +0 -4
- package/lib/content-fields/hubtype-fields/queue-status-conditional.js.map +0 -1
- package/lib/content-fields/hubtype-fields/rating.d.ts +0 -23
- package/lib/content-fields/hubtype-fields/rating.js +0 -9
- package/lib/content-fields/hubtype-fields/rating.js.map +0 -1
- package/lib/content-fields/hubtype-fields/smart-intent.d.ts +0 -12
- package/lib/content-fields/hubtype-fields/smart-intent.js +0 -4
- package/lib/content-fields/hubtype-fields/smart-intent.js.map +0 -1
- package/lib/content-fields/hubtype-fields/text.d.ts +0 -11
- package/lib/content-fields/hubtype-fields/text.js +0 -4
- package/lib/content-fields/hubtype-fields/text.js.map +0 -1
- package/lib/content-fields/hubtype-fields/url.d.ts +0 -8
- package/lib/content-fields/hubtype-fields/url.js +0 -4
- package/lib/content-fields/hubtype-fields/url.js.map +0 -1
- package/lib/content-fields/hubtype-fields/video.d.ts +0 -8
- package/lib/content-fields/hubtype-fields/video.js +0 -4
- package/lib/content-fields/hubtype-fields/video.js.map +0 -1
- package/lib/content-fields/hubtype-fields/webview.d.ts +0 -17
- package/lib/content-fields/hubtype-fields/webview.js +0 -4
- package/lib/content-fields/hubtype-fields/webview.js.map +0 -1
- package/lib/content-fields/hubtype-fields/whatsapp-button-list.d.ts +0 -21
- package/lib/content-fields/hubtype-fields/whatsapp-button-list.js +0 -4
- package/lib/content-fields/hubtype-fields/whatsapp-button-list.js.map +0 -1
- package/lib/content-fields/hubtype-fields/whatsapp-cta-url-button.d.ts +0 -17
- package/lib/content-fields/hubtype-fields/whatsapp-cta-url-button.js +0 -4
- package/lib/content-fields/hubtype-fields/whatsapp-cta-url-button.js.map +0 -1
- package/lib/content-fields/hubtype-fields/whatsapp-request-contact-info.d.ts +0 -8
- package/lib/content-fields/hubtype-fields/whatsapp-request-contact-info.js +0 -4
- package/lib/content-fields/hubtype-fields/whatsapp-request-contact-info.js.map +0 -1
- package/lib/content-fields/hubtype-fields/whatsapp-template.d.ts +0 -96
- package/lib/content-fields/hubtype-fields/whatsapp-template.js +0 -9
- package/lib/content-fields/hubtype-fields/whatsapp-template.js.map +0 -1
- package/lib/content-fields/index.d.ts +0 -25
- package/lib/content-fields/index.js +0 -73
- package/lib/content-fields/index.js.map +0 -1
- package/lib/content-fields/whatsapp-button-list/flow-whatsapp-button-list-row.d.ts +0 -14
- package/lib/content-fields/whatsapp-button-list/flow-whatsapp-button-list-row.js +0 -43
- package/lib/content-fields/whatsapp-button-list/flow-whatsapp-button-list-row.js.map +0 -1
- package/lib/content-fields/whatsapp-button-list/flow-whatsapp-button-list-section.d.ts +0 -13
- package/lib/content-fields/whatsapp-button-list/flow-whatsapp-button-list-section.js +0 -41
- package/lib/content-fields/whatsapp-button-list/flow-whatsapp-button-list-section.js.map +0 -1
- package/lib/content-fields/whatsapp-button-list/flow-whatsapp-button-list.d.ts +0 -14
- package/lib/content-fields/whatsapp-button-list/flow-whatsapp-button-list.js +0 -66
- package/lib/content-fields/whatsapp-button-list/flow-whatsapp-button-list.js.map +0 -1
- package/lib/content-fields/whatsapp-button-list/index.d.ts +0 -3
- package/lib/content-fields/whatsapp-button-list/index.js +0 -12
- package/lib/content-fields/whatsapp-button-list/index.js.map +0 -1
- package/lib/filters/index.d.ts +0 -12
- package/lib/filters/index.js +0 -16
- package/lib/filters/index.js.map +0 -1
- package/lib/flow-factory.d.ts +0 -12
- package/lib/flow-factory.js +0 -75
- package/lib/flow-factory.js.map +0 -1
- package/lib/functions/index.d.ts +0 -11
- package/lib/functions/index.js +0 -55
- package/lib/functions/index.js.map +0 -1
- package/lib/index.d.ts +0 -45
- package/lib/index.js +0 -195
- package/lib/index.js.map +0 -1
- package/lib/services/hubtype-queues-api.js +0 -26
- package/lib/services/hubtype-queues-api.js.map +0 -1
- package/lib/structured-output/flow-builder-content.js +0 -16
- package/lib/structured-output/flow-builder-content.js.map +0 -1
- package/lib/tracking.d.ts +0 -16
- package/lib/tracking.js +0 -77
- package/lib/tracking.js.map +0 -1
- package/lib/types.d.ts +0 -62
- package/lib/types.js +0 -14
- package/lib/types.js.map +0 -1
- package/lib/user-input/capture-user-input-api.d.ts +0 -21
- package/lib/user-input/capture-user-input-api.js +0 -99
- package/lib/user-input/capture-user-input-api.js.map +0 -1
- package/lib/user-input/index.d.ts +0 -4
- package/lib/user-input/index.js +0 -46
- package/lib/user-input/index.js.map +0 -1
- package/lib/user-input/keyword.d.ts +0 -27
- package/lib/user-input/keyword.js +0 -89
- package/lib/user-input/keyword.js.map +0 -1
- package/lib/user-input/smart-intent.d.ts +0 -24
- package/lib/user-input/smart-intent.js +0 -93
- package/lib/user-input/smart-intent.js.map +0 -1
- package/lib/utils/ai-agent.d.ts +0 -11
- package/lib/utils/ai-agent.js +0 -33
- package/lib/utils/ai-agent.js.map +0 -1
- package/lib/utils/authentication.js +0 -24
- package/lib/utils/authentication.js.map +0 -1
- package/lib/utils/flow-locale.js +0 -75
- package/lib/utils/flow-locale.js.map +0 -1
- package/lib/utils/get-flow-builder-plugin.d.ts +0 -3
- package/lib/utils/get-flow-builder-plugin.js +0 -16
- package/lib/utils/get-flow-builder-plugin.js.map +0 -1
- package/lib/utils/hubtype-assistant-content.d.ts +0 -12
- package/lib/utils/hubtype-assistant-content.js +0 -187
- package/lib/utils/hubtype-assistant-content.js.map +0 -1
- package/lib/utils/input.js +0 -37
- package/lib/utils/input.js.map +0 -1
- package/lib/webview/contents-context.d.ts +0 -2
- package/lib/webview/contents-context.js +0 -14
- package/lib/webview/contents-context.js.map +0 -1
- package/lib/webview/index.d.ts +0 -3
- package/lib/webview/index.js +0 -11
- package/lib/webview/index.js.map +0 -1
- package/lib/webview/types.d.ts +0 -47
- package/lib/webview/types.js +0 -9
- package/lib/webview/types.js.map +0 -1
- package/lib/webview/use-webview-contents.d.ts +0 -2
- package/lib/webview/use-webview-contents.js +0 -90
- package/lib/webview/use-webview-contents.js.map +0 -1
- /package/lib/{services → cjs/services}/hubtype-queues-api.d.ts +0 -0
- /package/lib/{structured-output → cjs/structured-output}/flow-builder-content.d.ts +0 -0
- /package/lib/{utils → cjs/utils}/authentication.d.ts +0 -0
- /package/lib/{utils → cjs/utils}/flow-locale.d.ts +0 -0
- /package/lib/{utils → cjs/utils}/input.d.ts +0 -0
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { ACCESS_TOKEN_VARIABLE_KEY, VARIABLE_PATTERN_GLOBAL } from "../constants.js";
|
|
2
|
-
import { ContentFilterExecutor } from "../filters/index.js";
|
|
3
|
-
import { getFlowBuilderPlugin } from "../utils/get-flow-builder-plugin.js";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
class ContentFieldsBase {
|
|
12
|
-
async filterContent(botContext, content) {
|
|
13
|
-
const flowBuilderPlugin = getFlowBuilderPlugin(botContext.plugins);
|
|
14
|
-
const contentFilters = flowBuilderPlugin.contentFilters;
|
|
15
|
-
const contentFilterExecutor = new ContentFilterExecutor({
|
|
16
|
-
filters: contentFilters
|
|
17
|
-
});
|
|
18
|
-
const filteredContent = await contentFilterExecutor.filter(botContext, content);
|
|
19
|
-
return filteredContent;
|
|
20
|
-
}
|
|
21
|
-
static getTextByLocale(locale, text) {
|
|
22
|
-
const result = text.find((t)=>t.locale === locale);
|
|
23
|
-
return result?.message ?? '';
|
|
24
|
-
}
|
|
25
|
-
static getAssetByLocale(locale, asset) {
|
|
26
|
-
const result = asset.find((i)=>i.locale === locale);
|
|
27
|
-
return result?.file ?? '';
|
|
28
|
-
}
|
|
29
|
-
static getVideoByLocale(locale, video) {
|
|
30
|
-
const result = video.find((v)=>v.locale === locale);
|
|
31
|
-
return result?.url ?? '';
|
|
32
|
-
}
|
|
33
|
-
static getQueueByLocale(locale, queues) {
|
|
34
|
-
return queues.find((queue)=>queue.locale === locale);
|
|
35
|
-
}
|
|
36
|
-
replaceVariables(text, botContext) {
|
|
37
|
-
if (!botContext) {
|
|
38
|
-
return text;
|
|
39
|
-
}
|
|
40
|
-
return text.replace(VARIABLE_PATTERN_GLOBAL, (match)=>{
|
|
41
|
-
// remove \\ ( escape for _ ) added by text node with markdown
|
|
42
|
-
const keyPath = match.slice(1, -1).replaceAll('\\', '');
|
|
43
|
-
const botVariable = keyPath.endsWith(ACCESS_TOKEN_VARIABLE_KEY) ? match : this.getValueFromKeyPath(botContext, keyPath);
|
|
44
|
-
return this.isValidType(botVariable) ? String(botVariable) : match;
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
getValueFromKeyPath(botContext, keyPath) {
|
|
48
|
-
if (keyPath.startsWith('session.user.contact_info.')) {
|
|
49
|
-
const name = keyPath.split('.').at(-1);
|
|
50
|
-
return botContext.session.user.contact_info?.find((contact)=>contact.name === name)?.value;
|
|
51
|
-
}
|
|
52
|
-
if (keyPath.startsWith('input.') || keyPath.startsWith('session.')) {
|
|
53
|
-
return keyPath.split('.').reduce((object, key)=>this.resolveObjectKey(object, key), botContext);
|
|
54
|
-
}
|
|
55
|
-
return keyPath.split('.').reduce((object, key)=>this.resolveObjectKey(object, key), botContext.session.user.extra_data);
|
|
56
|
-
}
|
|
57
|
-
resolveObjectKey(object, key) {
|
|
58
|
-
if (object && object[key] !== undefined) {
|
|
59
|
-
return object[key];
|
|
60
|
-
}
|
|
61
|
-
return undefined;
|
|
62
|
-
}
|
|
63
|
-
isValidType(botVariable) {
|
|
64
|
-
const validTypes = [
|
|
65
|
-
'boolean',
|
|
66
|
-
'string',
|
|
67
|
-
'number'
|
|
68
|
-
];
|
|
69
|
-
return validTypes.includes(typeof botVariable);
|
|
70
|
-
}
|
|
71
|
-
constructor(id){
|
|
72
|
-
this.id = id;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
export { ContentFieldsBase };
|
|
77
|
-
|
|
78
|
-
//# sourceMappingURL=content-fields-base.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"content-fields/content-fields-base.js","sources":["../../src/content-fields/content-fields-base.ts"],"sourcesContent":["import type { BotContext } from '@botonic/core'\nimport {\n ACCESS_TOKEN_VARIABLE_KEY,\n VARIABLE_PATTERN_GLOBAL,\n} from '../constants'\nimport { ContentFilterExecutor } from '../filters'\nimport { getFlowBuilderPlugin } from '../utils/get-flow-builder-plugin'\nimport type {\n HtMediaFileLocale,\n HtNodeLink,\n HtQueueLocale,\n HtTextLocale,\n HtVideoLocale,\n} from './hubtype-fields'\nimport type { FlowContent } from './index'\n\nexport abstract class ContentFieldsBase {\n public code: string\n public followUp?: HtNodeLink\n\n constructor(public readonly id: string) {}\n\n abstract trackFlow(botContext: BotContext): Promise<void>\n\n abstract processContent(botContext: BotContext): Promise<void>\n\n async filterContent(\n botContext: BotContext,\n content: FlowContent\n ): Promise<FlowContent> {\n const flowBuilderPlugin = getFlowBuilderPlugin(botContext.plugins)\n const contentFilters = flowBuilderPlugin.contentFilters\n const contentFilterExecutor = new ContentFilterExecutor({\n filters: contentFilters,\n })\n const filteredContent = await contentFilterExecutor.filter(\n botContext,\n content\n )\n return filteredContent\n }\n\n static getTextByLocale(locale: string, text: HtTextLocale[]): string {\n const result = text.find(t => t.locale === locale)\n return result?.message ?? ''\n }\n\n static getAssetByLocale(locale: string, asset: HtMediaFileLocale[]): string {\n const result = asset.find(i => i.locale === locale)\n return result?.file ?? ''\n }\n\n static getVideoByLocale(locale: string, video: HtVideoLocale[]): string {\n const result = video.find(v => v.locale === locale)\n return result?.url ?? ''\n }\n\n static getQueueByLocale(\n locale: string,\n queues: HtQueueLocale[]\n ): HtQueueLocale | undefined {\n return queues.find(queue => queue.locale === locale)\n }\n\n replaceVariables(text: string, botContext: BotContext): string {\n if (!botContext) {\n return text\n }\n\n return text.replace(VARIABLE_PATTERN_GLOBAL, match => {\n // remove \\\\ ( escape for _ ) added by text node with markdown\n const keyPath = match.slice(1, -1).replaceAll('\\\\', '')\n\n const botVariable = keyPath.endsWith(ACCESS_TOKEN_VARIABLE_KEY)\n ? match\n : this.getValueFromKeyPath(botContext, keyPath)\n\n return this.isValidType(botVariable) ? String(botVariable) : match\n })\n }\n\n getValueFromKeyPath(botContext: BotContext, keyPath: string): any {\n if (keyPath.startsWith('session.user.contact_info.')) {\n const name = keyPath.split('.').at(-1)\n return botContext.session.user.contact_info?.find(\n contact => contact.name === name\n )?.value\n }\n\n if (keyPath.startsWith('input.') || keyPath.startsWith('session.')) {\n return keyPath\n .split('.')\n .reduce((object, key) => this.resolveObjectKey(object, key), botContext)\n }\n\n return keyPath\n .split('.')\n .reduce(\n (object, key) => this.resolveObjectKey(object, key),\n botContext.session.user.extra_data\n )\n }\n\n private resolveObjectKey(object: any, key: string): any {\n if (object && object[key] !== undefined) {\n return object[key]\n }\n return undefined\n }\n\n private isValidType(botVariable: any): boolean {\n const validTypes = ['boolean', 'string', 'number']\n return validTypes.includes(typeof botVariable)\n }\n}\n"],"names":["ACCESS_TOKEN_VARIABLE_KEY","VARIABLE_PATTERN_GLOBAL","ContentFilterExecutor","getFlowBuilderPlugin","ContentFieldsBase","botContext","content","flowBuilderPlugin","contentFilters","contentFilterExecutor","filteredContent","locale","text","result","t","asset","i","video","v","queues","queue","match","keyPath","botVariable","String","name","contact","object","key","undefined","validTypes","id"],"mappings":";;;;;;;AAIqB;AAC6B;AACqB;AAUhE,MAAeI,iBAAiBA;IAUrC,MAAM,cACJC,UAAsB,EACtBC,OAAoB,EACE;QACtB,MAAMC,oBAAoBJ,oBAAoBA,CAACE,WAAW,OAAO;QACjE,MAAMG,iBAAiBD,kBAAkB,cAAc;QACvD,MAAME,wBAAwB,IAAIP,qBAAqBA,CAAC;YACtD,SAASM;QACX;QACA,MAAME,kBAAkB,MAAMD,sBAAsB,MAAM,CACxDJ,YACAC;QAEF,OAAOI;IACT;IAEA,OAAO,gBAAgBC,MAAc,EAAEC,IAAoB,EAAU;QACnE,MAAMC,SAASD,KAAK,IAAI,CAACE,CAAAA,IAAKA,EAAE,MAAM,KAAKH;QAC3C,OAAOE,QAAQ,WAAW;IAC5B;IAEA,OAAO,iBAAiBF,MAAc,EAAEI,KAA0B,EAAU;QAC1E,MAAMF,SAASE,MAAM,IAAI,CAACC,CAAAA,IAAKA,EAAE,MAAM,KAAKL;QAC5C,OAAOE,QAAQ,QAAQ;IACzB;IAEA,OAAO,iBAAiBF,MAAc,EAAEM,KAAsB,EAAU;QACtE,MAAMJ,SAASI,MAAM,IAAI,CAACC,CAAAA,IAAKA,EAAE,MAAM,KAAKP;QAC5C,OAAOE,QAAQ,OAAO;IACxB;IAEA,OAAO,iBACLF,MAAc,EACdQ,MAAuB,EACI;QAC3B,OAAOA,OAAO,IAAI,CAACC,CAAAA,QAASA,MAAM,MAAM,KAAKT;IAC/C;IAEA,iBAAiBC,IAAY,EAAEP,UAAsB,EAAU;QAC7D,IAAI,CAACA,YAAY;YACf,OAAOO;QACT;QAEA,OAAOA,KAAK,OAAO,CAACX,uBAAuBA,EAAEoB,CAAAA;YAC3C,8DAA8D;YAC9D,MAAMC,UAAUD,MAAM,KAAK,CAAC,GAAG,CAAC,GAAG,UAAU,CAAC,MAAM;YAEpD,MAAME,cAAcD,QAAQ,QAAQ,CAACtB,yBAAyBA,IAC1DqB,QACA,IAAI,CAAC,mBAAmB,CAAChB,YAAYiB;YAEzC,OAAO,IAAI,CAAC,WAAW,CAACC,eAAeC,OAAOD,eAAeF;QAC/D;IACF;IAEA,oBAAoBhB,UAAsB,EAAEiB,OAAe,EAAO;QAChE,IAAIA,QAAQ,UAAU,CAAC,+BAA+B;YACpD,MAAMG,OAAOH,QAAQ,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC;YACpC,OAAOjB,WAAW,OAAO,CAAC,IAAI,CAAC,YAAY,EAAE,KAC3CqB,CAAAA,UAAWA,QAAQ,IAAI,KAAKD,OAC3B;QACL;QAEA,IAAIH,QAAQ,UAAU,CAAC,aAAaA,QAAQ,UAAU,CAAC,aAAa;YAClE,OAAOA,QACJ,KAAK,CAAC,KACN,MAAM,CAAC,CAACK,QAAQC,MAAQ,IAAI,CAAC,gBAAgB,CAACD,QAAQC,MAAMvB;QACjE;QAEA,OAAOiB,QACJ,KAAK,CAAC,KACN,MAAM,CACL,CAACK,QAAQC,MAAQ,IAAI,CAAC,gBAAgB,CAACD,QAAQC,MAC/CvB,WAAW,OAAO,CAAC,IAAI,CAAC,UAAU;IAExC;IAEQ,iBAAiBsB,MAAW,EAAEC,GAAW,EAAO;QACtD,IAAID,UAAUA,MAAM,CAACC,IAAI,KAAKC,WAAW;YACvC,OAAOF,MAAM,CAACC,IAAI;QACpB;QACA,OAAOC;IACT;IAEQ,YAAYN,WAAgB,EAAW;QAC7C,MAAMO,aAAa;YAAC;YAAW;YAAU;SAAS;QAClD,OAAOA,WAAW,QAAQ,CAAC,OAAOP;IACpC;IA7FA,YAA4BQ,EAAU,CAAE;aAAZA,KAAAA;IAAa;AA8F3C"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { BooleanConditionOperator, type HtBooleanCondition, type HtNumberCondition, type HtStringCondition, NumberConditionOperator, StringConditionOperator } from '../hubtype-fields/index.js';
|
|
2
|
-
type StringEvaluator = (variable: string, value: string) => boolean;
|
|
3
|
-
type NumberEvaluator = (variable: number, value: number, condition: HtNumberCondition) => boolean;
|
|
4
|
-
type BooleanEvaluator = (variable: boolean) => boolean;
|
|
5
|
-
export declare function getMinAndMax(condition: HtNumberCondition): {
|
|
6
|
-
min: number;
|
|
7
|
-
max: number;
|
|
8
|
-
};
|
|
9
|
-
export declare const STRING_CONDITION_EVALUATORS: Record<StringConditionOperator, StringEvaluator>;
|
|
10
|
-
export declare const NUMBER_CONDITION_EVALUATORS: Record<NumberConditionOperator, NumberEvaluator>;
|
|
11
|
-
export declare const BOOLEAN_CONDITION_EVALUATORS: Record<BooleanConditionOperator, BooleanEvaluator>;
|
|
12
|
-
export declare function evaluateStringCondition(variable: string, condition: HtStringCondition): boolean;
|
|
13
|
-
export declare function evaluateNumberCondition(variable: number, condition: HtNumberCondition): boolean;
|
|
14
|
-
export declare function evaluateBooleanCondition(variable: boolean, condition: HtBooleanCondition): boolean;
|
|
15
|
-
export {};
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { BooleanConditionOperator, NumberConditionOperator, StringConditionOperator } from "../hubtype-fields/index.js";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
function getMinAndMax(condition) {
|
|
6
|
-
if (condition.min !== undefined && condition.max !== undefined) {
|
|
7
|
-
return {
|
|
8
|
-
min: condition.min,
|
|
9
|
-
max: condition.max
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
throw new Error(`Min or max not found for number condition ${condition.operator}`);
|
|
13
|
-
}
|
|
14
|
-
const STRING_CONDITION_EVALUATORS = {
|
|
15
|
-
[StringConditionOperator.Contains]: (variable, value)=>variable.includes(value),
|
|
16
|
-
[StringConditionOperator.NotContains]: (variable, value)=>!variable.includes(value),
|
|
17
|
-
[StringConditionOperator.EqualsTo]: (variable, value)=>variable === value,
|
|
18
|
-
[StringConditionOperator.NotEqualsTo]: (variable, value)=>variable !== value,
|
|
19
|
-
[StringConditionOperator.StartsWith]: (variable, value)=>variable.startsWith(value),
|
|
20
|
-
[StringConditionOperator.NotStartsWith]: (variable, value)=>!variable.startsWith(value),
|
|
21
|
-
[StringConditionOperator.EndsWith]: (variable, value)=>variable.endsWith(value),
|
|
22
|
-
[StringConditionOperator.NotEndsWith]: (variable, value)=>!variable.endsWith(value)
|
|
23
|
-
};
|
|
24
|
-
const NUMBER_CONDITION_EVALUATORS = {
|
|
25
|
-
[NumberConditionOperator.EqualsTo]: (variable, value)=>variable === value,
|
|
26
|
-
[NumberConditionOperator.NotEqualsTo]: (variable, value)=>variable !== value,
|
|
27
|
-
[NumberConditionOperator.GreaterThan]: (variable, value)=>variable > value,
|
|
28
|
-
[NumberConditionOperator.LessThan]: (variable, value)=>variable < value,
|
|
29
|
-
[NumberConditionOperator.GreaterThanOrEqualTo]: (variable, value)=>variable >= value,
|
|
30
|
-
[NumberConditionOperator.LessThanOrEqualTo]: (variable, value)=>variable <= value,
|
|
31
|
-
[NumberConditionOperator.Between]: (variable, _value, condition)=>{
|
|
32
|
-
const { min, max } = getMinAndMax(condition);
|
|
33
|
-
return variable >= min && variable <= max;
|
|
34
|
-
},
|
|
35
|
-
[NumberConditionOperator.NotBetween]: (variable, _value, condition)=>{
|
|
36
|
-
const { min, max } = getMinAndMax(condition);
|
|
37
|
-
return variable < min || variable > max;
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
const BOOLEAN_CONDITION_EVALUATORS = {
|
|
41
|
-
[BooleanConditionOperator.IsTruthy]: (variable)=>!!variable
|
|
42
|
-
};
|
|
43
|
-
function evaluateStringCondition(variable, condition) {
|
|
44
|
-
if (condition.value === undefined) {
|
|
45
|
-
throw new Error(`Value not found for string condition ${condition.operator}`);
|
|
46
|
-
}
|
|
47
|
-
const evaluator = STRING_CONDITION_EVALUATORS[condition.operator];
|
|
48
|
-
if (!evaluator) {
|
|
49
|
-
throw new Error(`Invalid string condition operator ${condition.operator}`);
|
|
50
|
-
}
|
|
51
|
-
return evaluator(variable, condition.value);
|
|
52
|
-
}
|
|
53
|
-
function evaluateNumberCondition(variable, condition) {
|
|
54
|
-
if (condition.value === undefined) {
|
|
55
|
-
throw new Error(`Value not found for number condition ${condition.operator}`);
|
|
56
|
-
}
|
|
57
|
-
const evaluator = NUMBER_CONDITION_EVALUATORS[condition.operator];
|
|
58
|
-
if (!evaluator) {
|
|
59
|
-
throw new Error(`Invalid number condition operator ${condition.operator}`);
|
|
60
|
-
}
|
|
61
|
-
return evaluator(variable, condition.value, condition);
|
|
62
|
-
}
|
|
63
|
-
function evaluateBooleanCondition(variable, condition) {
|
|
64
|
-
const evaluator = BOOLEAN_CONDITION_EVALUATORS[condition.operator];
|
|
65
|
-
if (!evaluator) {
|
|
66
|
-
throw new Error(`Invalid boolean condition operator ${condition.operator}`);
|
|
67
|
-
}
|
|
68
|
-
return evaluator(variable);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
export { BOOLEAN_CONDITION_EVALUATORS, NUMBER_CONDITION_EVALUATORS, STRING_CONDITION_EVALUATORS, evaluateBooleanCondition, evaluateNumberCondition, evaluateStringCondition, getMinAndMax };
|
|
72
|
-
|
|
73
|
-
//# sourceMappingURL=custom-conditional-v2-evaluators.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"content-fields/custom-conditional/custom-conditional-v2-evaluators.js","sources":["../../../src/content-fields/custom-conditional/custom-conditional-v2-evaluators.ts"],"sourcesContent":["import {\n BooleanConditionOperator,\n type HtBooleanCondition,\n type HtNumberCondition,\n type HtStringCondition,\n NumberConditionOperator,\n StringConditionOperator,\n} from '../hubtype-fields'\n\ntype StringEvaluator = (variable: string, value: string) => boolean\n\ntype NumberEvaluator = (\n variable: number,\n value: number,\n condition: HtNumberCondition\n) => boolean\n\ntype BooleanEvaluator = (variable: boolean) => boolean\n\nexport function getMinAndMax(condition: HtNumberCondition): {\n min: number\n max: number\n} {\n if (condition.min !== undefined && condition.max !== undefined) {\n return { min: condition.min, max: condition.max }\n }\n throw new Error(\n `Min or max not found for number condition ${condition.operator}`\n )\n}\n\nexport const STRING_CONDITION_EVALUATORS: Record<\n StringConditionOperator,\n StringEvaluator\n> = {\n [StringConditionOperator.Contains]: (variable, value) =>\n variable.includes(value),\n [StringConditionOperator.NotContains]: (variable, value) =>\n !variable.includes(value),\n [StringConditionOperator.EqualsTo]: (variable, value) => variable === value,\n [StringConditionOperator.NotEqualsTo]: (variable, value) =>\n variable !== value,\n [StringConditionOperator.StartsWith]: (variable, value) =>\n variable.startsWith(value),\n [StringConditionOperator.NotStartsWith]: (variable, value) =>\n !variable.startsWith(value),\n [StringConditionOperator.EndsWith]: (variable, value) =>\n variable.endsWith(value),\n [StringConditionOperator.NotEndsWith]: (variable, value) =>\n !variable.endsWith(value),\n}\n\nexport const NUMBER_CONDITION_EVALUATORS: Record<\n NumberConditionOperator,\n NumberEvaluator\n> = {\n [NumberConditionOperator.EqualsTo]: (variable, value) => variable === value,\n [NumberConditionOperator.NotEqualsTo]: (variable, value) =>\n variable !== value,\n [NumberConditionOperator.GreaterThan]: (variable, value) => variable > value,\n [NumberConditionOperator.LessThan]: (variable, value) => variable < value,\n [NumberConditionOperator.GreaterThanOrEqualTo]: (variable, value) =>\n variable >= value,\n [NumberConditionOperator.LessThanOrEqualTo]: (variable, value) =>\n variable <= value,\n [NumberConditionOperator.Between]: (variable, _value, condition) => {\n const { min, max } = getMinAndMax(condition)\n return variable >= min && variable <= max\n },\n [NumberConditionOperator.NotBetween]: (variable, _value, condition) => {\n const { min, max } = getMinAndMax(condition)\n return variable < min || variable > max\n },\n}\n\nexport const BOOLEAN_CONDITION_EVALUATORS: Record<\n BooleanConditionOperator,\n BooleanEvaluator\n> = {\n [BooleanConditionOperator.IsTruthy]: variable => !!variable,\n}\n\nexport function evaluateStringCondition(\n variable: string,\n condition: HtStringCondition\n): boolean {\n if (condition.value === undefined) {\n throw new Error(\n `Value not found for string condition ${condition.operator}`\n )\n }\n const evaluator = STRING_CONDITION_EVALUATORS[condition.operator]\n if (!evaluator) {\n throw new Error(`Invalid string condition operator ${condition.operator}`)\n }\n return evaluator(variable, condition.value)\n}\n\nexport function evaluateNumberCondition(\n variable: number,\n condition: HtNumberCondition\n): boolean {\n if (condition.value === undefined) {\n throw new Error(\n `Value not found for number condition ${condition.operator}`\n )\n }\n const evaluator = NUMBER_CONDITION_EVALUATORS[condition.operator]\n if (!evaluator) {\n throw new Error(`Invalid number condition operator ${condition.operator}`)\n }\n return evaluator(variable, condition.value, condition)\n}\n\nexport function evaluateBooleanCondition(\n variable: boolean,\n condition: HtBooleanCondition\n): boolean {\n const evaluator = BOOLEAN_CONDITION_EVALUATORS[condition.operator]\n if (!evaluator) {\n throw new Error(`Invalid boolean condition operator ${condition.operator}`)\n }\n return evaluator(variable)\n}\n"],"names":["BooleanConditionOperator","NumberConditionOperator","StringConditionOperator","getMinAndMax","condition","undefined","Error","STRING_CONDITION_EVALUATORS","variable","value","NUMBER_CONDITION_EVALUATORS","_value","min","max","BOOLEAN_CONDITION_EVALUATORS","evaluateStringCondition","evaluator","evaluateNumberCondition","evaluateBooleanCondition"],"mappings":";;;AAO0B;AAYnB,SAASG,YAAYA,CAACC,SAA4B;IAIvD,IAAIA,UAAU,GAAG,KAAKC,aAAaD,UAAU,GAAG,KAAKC,WAAW;QAC9D,OAAO;YAAE,KAAKD,UAAU,GAAG;YAAE,KAAKA,UAAU,GAAG;QAAC;IAClD;IACA,MAAM,IAAIE,MACR,CAAC,0CAA0C,EAAEF,UAAU,QAAQ,EAAE;AAErE;AAEO,MAAMG,2BAA2BA,GAGpC;IACF,CAACL,gCAAgC,CAAC,EAAE,CAACM,UAAUC,QAC7CD,SAAS,QAAQ,CAACC;IACpB,CAACP,mCAAmC,CAAC,EAAE,CAACM,UAAUC,QAChD,CAACD,SAAS,QAAQ,CAACC;IACrB,CAACP,gCAAgC,CAAC,EAAE,CAACM,UAAUC,QAAUD,aAAaC;IACtE,CAACP,mCAAmC,CAAC,EAAE,CAACM,UAAUC,QAChDD,aAAaC;IACf,CAACP,kCAAkC,CAAC,EAAE,CAACM,UAAUC,QAC/CD,SAAS,UAAU,CAACC;IACtB,CAACP,qCAAqC,CAAC,EAAE,CAACM,UAAUC,QAClD,CAACD,SAAS,UAAU,CAACC;IACvB,CAACP,gCAAgC,CAAC,EAAE,CAACM,UAAUC,QAC7CD,SAAS,QAAQ,CAACC;IACpB,CAACP,mCAAmC,CAAC,EAAE,CAACM,UAAUC,QAChD,CAACD,SAAS,QAAQ,CAACC;AACvB,EAAC;AAEM,MAAMC,2BAA2BA,GAGpC;IACF,CAACT,gCAAgC,CAAC,EAAE,CAACO,UAAUC,QAAUD,aAAaC;IACtE,CAACR,mCAAmC,CAAC,EAAE,CAACO,UAAUC,QAChDD,aAAaC;IACf,CAACR,mCAAmC,CAAC,EAAE,CAACO,UAAUC,QAAUD,WAAWC;IACvE,CAACR,gCAAgC,CAAC,EAAE,CAACO,UAAUC,QAAUD,WAAWC;IACpE,CAACR,4CAA4C,CAAC,EAAE,CAACO,UAAUC,QACzDD,YAAYC;IACd,CAACR,yCAAyC,CAAC,EAAE,CAACO,UAAUC,QACtDD,YAAYC;IACd,CAACR,+BAA+B,CAAC,EAAE,CAACO,UAAUG,QAAQP;QACpD,MAAM,EAAEQ,GAAG,EAAEC,GAAG,EAAE,GAAGV,YAAYA,CAACC;QAClC,OAAOI,YAAYI,OAAOJ,YAAYK;IACxC;IACA,CAACZ,kCAAkC,CAAC,EAAE,CAACO,UAAUG,QAAQP;QACvD,MAAM,EAAEQ,GAAG,EAAEC,GAAG,EAAE,GAAGV,YAAYA,CAACC;QAClC,OAAOI,WAAWI,OAAOJ,WAAWK;IACtC;AACF,EAAC;AAEM,MAAMC,4BAA4BA,GAGrC;IACF,CAACd,iCAAiC,CAAC,EAAEQ,CAAAA,WAAY,CAAC,CAACA;AACrD,EAAC;AAEM,SAASO,uBAAuBA,CACrCP,QAAgB,EAChBJ,SAA4B;IAE5B,IAAIA,UAAU,KAAK,KAAKC,WAAW;QACjC,MAAM,IAAIC,MACR,CAAC,qCAAqC,EAAEF,UAAU,QAAQ,EAAE;IAEhE;IACA,MAAMY,YAAYT,2BAA2B,CAACH,UAAU,QAAQ,CAAC;IACjE,IAAI,CAACY,WAAW;QACd,MAAM,IAAIV,MAAM,CAAC,kCAAkC,EAAEF,UAAU,QAAQ,EAAE;IAC3E;IACA,OAAOY,UAAUR,UAAUJ,UAAU,KAAK;AAC5C;AAEO,SAASa,uBAAuBA,CACrCT,QAAgB,EAChBJ,SAA4B;IAE5B,IAAIA,UAAU,KAAK,KAAKC,WAAW;QACjC,MAAM,IAAIC,MACR,CAAC,qCAAqC,EAAEF,UAAU,QAAQ,EAAE;IAEhE;IACA,MAAMY,YAAYN,2BAA2B,CAACN,UAAU,QAAQ,CAAC;IACjE,IAAI,CAACY,WAAW;QACd,MAAM,IAAIV,MAAM,CAAC,kCAAkC,EAAEF,UAAU,QAAQ,EAAE;IAC3E;IACA,OAAOY,UAAUR,UAAUJ,UAAU,KAAK,EAAEA;AAC9C;AAEO,SAASc,wBAAwBA,CACtCV,QAAiB,EACjBJ,SAA6B;IAE7B,MAAMY,YAAYF,4BAA4B,CAACV,UAAU,QAAQ,CAAC;IAClE,IAAI,CAACY,WAAW;QACd,MAAM,IAAIV,MAAM,CAAC,mCAAmC,EAAEF,UAAU,QAAQ,EAAE;IAC5E;IACA,OAAOY,UAAUR;AACnB"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { type HtCondition, type HtNodeLink, VariableFormat } from '../hubtype-fields/index.js';
|
|
2
|
-
export type ConditionMatch = {
|
|
3
|
-
customResult: string;
|
|
4
|
-
target: HtNodeLink;
|
|
5
|
-
operator: string;
|
|
6
|
-
};
|
|
7
|
-
export declare function getConditionCustomResult(condition: HtCondition, variableFormat: VariableFormat): string;
|
|
8
|
-
export declare function findLastMatchingCondition<T extends HtCondition>(conditions: T[], variable: unknown, variableFormat: VariableFormat, evaluate: (variable: unknown, condition: T) => boolean): ConditionMatch | undefined;
|
|
9
|
-
export declare function resolveWithDefaultTarget(match: ConditionMatch | undefined, defaultTarget: HtNodeLink, nodeCode: string, defaultCustomResult?: string): ConditionMatch;
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { NumberConditionOperator, VariableFormat } from "../hubtype-fields/index.js";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
function getConditionCustomResult(condition, variableFormat) {
|
|
6
|
-
switch(variableFormat){
|
|
7
|
-
case VariableFormat.String:
|
|
8
|
-
return String(condition.value);
|
|
9
|
-
case VariableFormat.Number:
|
|
10
|
-
return getNumberConditionCustomResult(condition);
|
|
11
|
-
case VariableFormat.Boolean:
|
|
12
|
-
// Only reached after evaluateBooleanCondition succeeds; today that is isTruthy → 'true'
|
|
13
|
-
return 'true';
|
|
14
|
-
default:
|
|
15
|
-
throw new Error(`Invalid variable format ${variableFormat}`);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
function getNumberConditionCustomResult(condition) {
|
|
19
|
-
const numberCondition = condition;
|
|
20
|
-
if (numberCondition.operator === NumberConditionOperator.Between || numberCondition.operator === NumberConditionOperator.NotBetween) {
|
|
21
|
-
return `min: ${numberCondition.min} - max: ${numberCondition.max}`;
|
|
22
|
-
}
|
|
23
|
-
return String(numberCondition.value);
|
|
24
|
-
}
|
|
25
|
-
function findLastMatchingCondition(conditions, variable, variableFormat, evaluate) {
|
|
26
|
-
let lastMatch;
|
|
27
|
-
for (const condition of conditions){
|
|
28
|
-
if (!evaluate(variable, condition)) {
|
|
29
|
-
continue;
|
|
30
|
-
}
|
|
31
|
-
if (!condition.target) {
|
|
32
|
-
continue;
|
|
33
|
-
}
|
|
34
|
-
lastMatch = {
|
|
35
|
-
customResult: getConditionCustomResult(condition, variableFormat),
|
|
36
|
-
target: condition.target,
|
|
37
|
-
operator: condition.operator
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
return lastMatch;
|
|
41
|
-
}
|
|
42
|
-
function resolveWithDefaultTarget(match, defaultTarget, nodeCode, defaultCustomResult = 'default') {
|
|
43
|
-
if (match) {
|
|
44
|
-
return match;
|
|
45
|
-
}
|
|
46
|
-
if (!defaultTarget) {
|
|
47
|
-
throw new Error(`Default target not found for custom condition node ${nodeCode}`);
|
|
48
|
-
}
|
|
49
|
-
return {
|
|
50
|
-
customResult: defaultCustomResult,
|
|
51
|
-
target: defaultTarget,
|
|
52
|
-
operator: ''
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export { findLastMatchingCondition, getConditionCustomResult, resolveWithDefaultTarget };
|
|
57
|
-
|
|
58
|
-
//# sourceMappingURL=custom-conditional-v2-resolver.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"content-fields/custom-conditional/custom-conditional-v2-resolver.js","sources":["../../../src/content-fields/custom-conditional/custom-conditional-v2-resolver.ts"],"sourcesContent":["import {\n type HtCondition,\n type HtNodeLink,\n type HtNumberCondition,\n type HtStringCondition,\n NumberConditionOperator,\n VariableFormat,\n} from '../hubtype-fields'\n\nexport type ConditionMatch = {\n customResult: string\n target: HtNodeLink\n operator: string\n}\n\nexport function getConditionCustomResult(\n condition: HtCondition,\n variableFormat: VariableFormat\n): string {\n switch (variableFormat) {\n case VariableFormat.String:\n return String((condition as HtStringCondition).value)\n case VariableFormat.Number:\n return getNumberConditionCustomResult(condition as HtNumberCondition)\n case VariableFormat.Boolean:\n // Only reached after evaluateBooleanCondition succeeds; today that is isTruthy → 'true'\n return 'true'\n default:\n throw new Error(`Invalid variable format ${variableFormat}`)\n }\n}\n\nfunction getNumberConditionCustomResult(condition: HtNumberCondition): string {\n const numberCondition = condition as HtNumberCondition\n if (\n numberCondition.operator === NumberConditionOperator.Between ||\n numberCondition.operator === NumberConditionOperator.NotBetween\n ) {\n return `min: ${numberCondition.min} - max: ${numberCondition.max}`\n }\n return String(numberCondition.value)\n}\n\nexport function findLastMatchingCondition<T extends HtCondition>(\n conditions: T[],\n variable: unknown,\n variableFormat: VariableFormat,\n evaluate: (variable: unknown, condition: T) => boolean\n): ConditionMatch | undefined {\n let lastMatch: ConditionMatch | undefined\n\n for (const condition of conditions) {\n if (!evaluate(variable, condition)) {\n continue\n }\n\n if (!condition.target) {\n continue\n }\n\n lastMatch = {\n customResult: getConditionCustomResult(condition, variableFormat),\n target: condition.target,\n operator: condition.operator,\n }\n }\n\n return lastMatch\n}\n\nexport function resolveWithDefaultTarget(\n match: ConditionMatch | undefined,\n defaultTarget: HtNodeLink,\n nodeCode: string,\n defaultCustomResult: string = 'default'\n): ConditionMatch {\n if (match) {\n return match\n }\n\n if (!defaultTarget) {\n throw new Error(\n `Default target not found for custom condition node ${nodeCode}`\n )\n }\n\n return {\n customResult: defaultCustomResult,\n target: defaultTarget,\n operator: '',\n }\n}\n"],"names":["NumberConditionOperator","VariableFormat","getConditionCustomResult","condition","variableFormat","String","getNumberConditionCustomResult","Error","numberCondition","findLastMatchingCondition","conditions","variable","evaluate","lastMatch","resolveWithDefaultTarget","match","defaultTarget","nodeCode","defaultCustomResult"],"mappings":";;;AAO0B;AAQnB,SAASE,wBAAwBA,CACtCC,SAAsB,EACtBC,cAA8B;IAE9B,OAAQA;QACN,KAAKH,qBAAqB;YACxB,OAAOI,OAAQF,UAAgC,KAAK;QACtD,KAAKF,qBAAqB;YACxB,OAAOK,8BAA8BA,CAACH;QACxC,KAAKF,sBAAsB;YACzB,wFAAwF;YACxF,OAAO;QACT;YACE,MAAM,IAAIM,MAAM,CAAC,wBAAwB,EAAEH,gBAAgB;IAC/D;AACF;AAEA,SAASE,8BAA8BA,CAACH,SAA4B;IAClE,MAAMK,kBAAkBL;IACxB,IACEK,gBAAgB,QAAQ,KAAKR,+BAA+B,IAC5DQ,gBAAgB,QAAQ,KAAKR,kCAAkC,EAC/D;QACA,OAAO,CAAC,KAAK,EAAEQ,gBAAgB,GAAG,CAAC,QAAQ,EAAEA,gBAAgB,GAAG,EAAE;IACpE;IACA,OAAOH,OAAOG,gBAAgB,KAAK;AACrC;AAEO,SAASC,yBAAyBA,CACvCC,UAAe,EACfC,QAAiB,EACjBP,cAA8B,EAC9BQ,QAAsD;IAEtD,IAAIC;IAEJ,KAAK,MAAMV,aAAaO,WAAY;QAClC,IAAI,CAACE,SAASD,UAAUR,YAAY;YAClC;QACF;QAEA,IAAI,CAACA,UAAU,MAAM,EAAE;YACrB;QACF;QAEAU,YAAY;YACV,cAAcX,wBAAwBA,CAACC,WAAWC;YAClD,QAAQD,UAAU,MAAM;YACxB,UAAUA,UAAU,QAAQ;QAC9B;IACF;IAEA,OAAOU;AACT;AAEO,SAASC,wBAAwBA,CACtCC,KAAiC,EACjCC,aAAyB,EACzBC,QAAgB,EAChBC,sBAA8B,SAAS;IAEvC,IAAIH,OAAO;QACT,OAAOA;IACT;IAEA,IAAI,CAACC,eAAe;QAClB,MAAM,IAAIT,MACR,CAAC,mDAAmD,EAAEU,UAAU;IAEpE;IAEA,OAAO;QACL,cAAcC;QACd,QAAQF;QACR,UAAU;IACZ;AACF"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { type BotContext } from '@botonic/core';
|
|
2
|
-
import { ContentFieldsBase } from '../content-fields-base.js';
|
|
3
|
-
import { type HtCondition, type HtCustomConditionalV2Node, type HtNodeLink, VariableFormat } from '../hubtype-fields/index.js';
|
|
4
|
-
export declare class FlowCustomConditionalV2 extends ContentFieldsBase {
|
|
5
|
-
variableFormat: VariableFormat;
|
|
6
|
-
keyPath: string;
|
|
7
|
-
conditions: HtCondition[];
|
|
8
|
-
defaultTarget: HtNodeLink;
|
|
9
|
-
customResult: string;
|
|
10
|
-
resolvedOperator: string;
|
|
11
|
-
static fromHubtypeCMS(component: HtCustomConditionalV2Node, botContext: BotContext): FlowCustomConditionalV2;
|
|
12
|
-
private setFollowUp;
|
|
13
|
-
private evaluateConditions;
|
|
14
|
-
trackFlow(botContext: BotContext): Promise<void>;
|
|
15
|
-
processContent(botContext: BotContext): Promise<void>;
|
|
16
|
-
toBotonic(): import("react").JSX.Element;
|
|
17
|
-
}
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import { Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { EventAction } from "@botonic/core";
|
|
3
|
-
import { getCommonFlowContentEventArgsForContentId, trackEvent } from "../../tracking.js";
|
|
4
|
-
import { ContentFieldsBase } from "../content-fields-base.js";
|
|
5
|
-
import { VariableFormat } from "../hubtype-fields/index.js";
|
|
6
|
-
import { evaluateBooleanCondition, evaluateNumberCondition, evaluateStringCondition } from "./custom-conditional-v2-evaluators.js";
|
|
7
|
-
import { findLastMatchingCondition, resolveWithDefaultTarget } from "./custom-conditional-v2-resolver.js";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
class FlowCustomConditionalV2 extends ContentFieldsBase {
|
|
24
|
-
static fromHubtypeCMS(component, botContext) {
|
|
25
|
-
const newCustomConditionalV2 = new FlowCustomConditionalV2(component.id);
|
|
26
|
-
newCustomConditionalV2.code = component.code;
|
|
27
|
-
newCustomConditionalV2.variableFormat = component.content.type;
|
|
28
|
-
newCustomConditionalV2.keyPath = component.content.key_path;
|
|
29
|
-
newCustomConditionalV2.conditions = component.content.conditions;
|
|
30
|
-
newCustomConditionalV2.defaultTarget = component.content.default_target;
|
|
31
|
-
newCustomConditionalV2.setFollowUp(botContext);
|
|
32
|
-
return newCustomConditionalV2;
|
|
33
|
-
}
|
|
34
|
-
setFollowUp(botContext) {
|
|
35
|
-
const botVariable = this.getValueFromKeyPath(botContext, this.keyPath);
|
|
36
|
-
const resolved = this.evaluateConditions(botVariable);
|
|
37
|
-
this.customResult = resolved.customResult;
|
|
38
|
-
this.resolvedOperator = resolved.operator;
|
|
39
|
-
this.followUp = resolved.target;
|
|
40
|
-
}
|
|
41
|
-
evaluateConditions(botVariable) {
|
|
42
|
-
switch(this.variableFormat){
|
|
43
|
-
case VariableFormat.String:
|
|
44
|
-
{
|
|
45
|
-
const match = findLastMatchingCondition(this.conditions, botVariable, this.variableFormat, (variable, condition)=>evaluateStringCondition(variable, condition));
|
|
46
|
-
return resolveWithDefaultTarget(match, this.defaultTarget, this.code);
|
|
47
|
-
}
|
|
48
|
-
case VariableFormat.Number:
|
|
49
|
-
{
|
|
50
|
-
const match = findLastMatchingCondition(this.conditions, botVariable, this.variableFormat, (variable, condition)=>evaluateNumberCondition(variable, condition));
|
|
51
|
-
return resolveWithDefaultTarget(match, this.defaultTarget, this.code);
|
|
52
|
-
}
|
|
53
|
-
case VariableFormat.Boolean:
|
|
54
|
-
{
|
|
55
|
-
const match = findLastMatchingCondition(this.conditions, botVariable, this.variableFormat, (variable, condition)=>evaluateBooleanCondition(variable, condition));
|
|
56
|
-
return resolveWithDefaultTarget(match, this.defaultTarget, this.code, 'false');
|
|
57
|
-
}
|
|
58
|
-
default:
|
|
59
|
-
throw new Error(`Invalid variable format ${this.variableFormat} for custom condition node ${this.code}`);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
async trackFlow(botContext) {
|
|
63
|
-
const { flowThreadId, flowId, flowName, flowNodeId, flowNodeContentId } = getCommonFlowContentEventArgsForContentId(botContext, this.id);
|
|
64
|
-
const eventCustomConditional = {
|
|
65
|
-
action: EventAction.ConditionalCustom,
|
|
66
|
-
flowThreadId,
|
|
67
|
-
flowId,
|
|
68
|
-
flowName,
|
|
69
|
-
flowNodeId,
|
|
70
|
-
flowNodeContentId,
|
|
71
|
-
flowNodeIsMeaningful: false,
|
|
72
|
-
conditionalVariable: this.customResult,
|
|
73
|
-
variableFormat: this.variableFormat,
|
|
74
|
-
operator: this.resolvedOperator
|
|
75
|
-
};
|
|
76
|
-
const { action, ...eventArgs } = eventCustomConditional;
|
|
77
|
-
await trackEvent(botContext, action, eventArgs);
|
|
78
|
-
}
|
|
79
|
-
async processContent(botContext) {
|
|
80
|
-
await this.filterContent(botContext, this);
|
|
81
|
-
await this.trackFlow(botContext);
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
|
-
toBotonic() {
|
|
85
|
-
return /*#__PURE__*/ jsx(Fragment, {});
|
|
86
|
-
}
|
|
87
|
-
constructor(...args){
|
|
88
|
-
super(...args), this.customResult = '', this.resolvedOperator = '';
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
export { FlowCustomConditionalV2 };
|
|
93
|
-
|
|
94
|
-
//# sourceMappingURL=flow-custom-condition-v2.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"content-fields/custom-conditional/flow-custom-condition-v2.js","sources":["../../../src/content-fields/custom-conditional/flow-custom-condition-v2.tsx"],"sourcesContent":["import {\n type BotContext,\n EventAction,\n type EventConditionalCustom,\n} from '@botonic/core'\nimport {\n getCommonFlowContentEventArgsForContentId,\n trackEvent,\n} from '../../tracking'\nimport { ContentFieldsBase } from '../content-fields-base'\nimport {\n type HtBooleanCondition,\n type HtCondition,\n type HtCustomConditionalV2Node,\n type HtNodeLink,\n type HtNumberCondition,\n type HtStringCondition,\n VariableFormat,\n} from '../hubtype-fields'\nimport {\n evaluateBooleanCondition,\n evaluateNumberCondition,\n evaluateStringCondition,\n} from './custom-conditional-v2-evaluators'\nimport {\n type ConditionMatch,\n findLastMatchingCondition,\n resolveWithDefaultTarget,\n} from './custom-conditional-v2-resolver'\n\nexport class FlowCustomConditionalV2 extends ContentFieldsBase {\n public variableFormat: VariableFormat\n public keyPath: string\n public conditions: HtCondition[]\n public defaultTarget: HtNodeLink\n public customResult = ''\n public resolvedOperator = ''\n\n static fromHubtypeCMS(\n component: HtCustomConditionalV2Node,\n botContext: BotContext\n ): FlowCustomConditionalV2 {\n const newCustomConditionalV2 = new FlowCustomConditionalV2(component.id)\n newCustomConditionalV2.code = component.code\n newCustomConditionalV2.variableFormat = component.content.type\n newCustomConditionalV2.keyPath = component.content.key_path\n newCustomConditionalV2.conditions = component.content.conditions\n newCustomConditionalV2.defaultTarget = component.content.default_target\n newCustomConditionalV2.setFollowUp(botContext)\n\n return newCustomConditionalV2\n }\n\n private setFollowUp(botContext: BotContext): void {\n const botVariable = this.getValueFromKeyPath(botContext, this.keyPath)\n const resolved = this.evaluateConditions(botVariable)\n\n this.customResult = resolved.customResult\n this.resolvedOperator = resolved.operator\n this.followUp = resolved.target\n }\n\n private evaluateConditions(botVariable: unknown): ConditionMatch {\n switch (this.variableFormat) {\n case VariableFormat.String: {\n const match = findLastMatchingCondition(\n this.conditions as HtStringCondition[],\n botVariable,\n this.variableFormat,\n (variable, condition) =>\n evaluateStringCondition(variable as string, condition)\n )\n return resolveWithDefaultTarget(match, this.defaultTarget, this.code)\n }\n case VariableFormat.Number: {\n const match = findLastMatchingCondition(\n this.conditions as HtNumberCondition[],\n botVariable,\n this.variableFormat,\n (variable, condition) =>\n evaluateNumberCondition(variable as number, condition)\n )\n return resolveWithDefaultTarget(match, this.defaultTarget, this.code)\n }\n case VariableFormat.Boolean: {\n const match = findLastMatchingCondition(\n this.conditions as HtBooleanCondition[],\n botVariable,\n this.variableFormat,\n (variable, condition) =>\n evaluateBooleanCondition(variable as boolean, condition)\n )\n return resolveWithDefaultTarget(\n match,\n this.defaultTarget,\n this.code,\n 'false'\n )\n }\n default:\n throw new Error(\n `Invalid variable format ${this.variableFormat} for custom condition node ${this.code}`\n )\n }\n }\n\n async trackFlow(botContext: BotContext): Promise<void> {\n const { flowThreadId, flowId, flowName, flowNodeId, flowNodeContentId } =\n getCommonFlowContentEventArgsForContentId(botContext, this.id)\n\n const eventCustomConditional: EventConditionalCustom = {\n action: EventAction.ConditionalCustom,\n flowThreadId,\n flowId,\n flowName,\n flowNodeId,\n flowNodeContentId,\n flowNodeIsMeaningful: false,\n conditionalVariable: this.customResult,\n variableFormat: this.variableFormat,\n operator: this.resolvedOperator,\n }\n const { action, ...eventArgs } = eventCustomConditional\n await trackEvent(botContext, action, eventArgs)\n }\n\n async processContent(botContext: BotContext): Promise<void> {\n await this.filterContent(botContext, this)\n await this.trackFlow(botContext)\n return\n }\n\n toBotonic() {\n return <></>\n }\n}\n"],"names":["EventAction","getCommonFlowContentEventArgsForContentId","trackEvent","ContentFieldsBase","VariableFormat","evaluateBooleanCondition","evaluateNumberCondition","evaluateStringCondition","findLastMatchingCondition","resolveWithDefaultTarget","FlowCustomConditionalV2","component","botContext","newCustomConditionalV2","botVariable","resolved","match","variable","condition","Error","flowThreadId","flowId","flowName","flowNodeId","flowNodeContentId","eventCustomConditional","action","eventArgs"],"mappings":";;;;;;;;;;;;;;;;AAIsB;AAIC;AACmC;AAShC;AAKiB;AAKF;AAElC,MAAMU,uBAAuBA,SAASP,iBAAiBA;IAQ5D,OAAO,eACLQ,SAAoC,EACpCC,UAAsB,EACG;QACzB,MAAMC,yBAAyB,IAAIH,uBAAuBA,CAACC,UAAU,EAAE;QACvEE,uBAAuB,IAAI,GAAGF,UAAU,IAAI;QAC5CE,uBAAuB,cAAc,GAAGF,UAAU,OAAO,CAAC,IAAI;QAC9DE,uBAAuB,OAAO,GAAGF,UAAU,OAAO,CAAC,QAAQ;QAC3DE,uBAAuB,UAAU,GAAGF,UAAU,OAAO,CAAC,UAAU;QAChEE,uBAAuB,aAAa,GAAGF,UAAU,OAAO,CAAC,cAAc;QACvEE,uBAAuB,WAAW,CAACD;QAEnC,OAAOC;IACT;IAEQ,YAAYD,UAAsB,EAAQ;QAChD,MAAME,cAAc,IAAI,CAAC,mBAAmB,CAACF,YAAY,IAAI,CAAC,OAAO;QACrE,MAAMG,WAAW,IAAI,CAAC,kBAAkB,CAACD;QAEzC,IAAI,CAAC,YAAY,GAAGC,SAAS,YAAY;QACzC,IAAI,CAAC,gBAAgB,GAAGA,SAAS,QAAQ;QACzC,IAAI,CAAC,QAAQ,GAAGA,SAAS,MAAM;IACjC;IAEQ,mBAAmBD,WAAoB,EAAkB;QAC/D,OAAQ,IAAI,CAAC,cAAc;YACzB,KAAKV,qBAAqB;gBAAE;oBAC1B,MAAMY,QAAQR,yBAAyBA,CACrC,IAAI,CAAC,UAAU,EACfM,aACA,IAAI,CAAC,cAAc,EACnB,CAACG,UAAUC,YACTX,uBAAuBA,CAACU,UAAoBC;oBAEhD,OAAOT,wBAAwBA,CAACO,OAAO,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,IAAI;gBACtE;YACA,KAAKZ,qBAAqB;gBAAE;oBAC1B,MAAMY,QAAQR,yBAAyBA,CACrC,IAAI,CAAC,UAAU,EACfM,aACA,IAAI,CAAC,cAAc,EACnB,CAACG,UAAUC,YACTZ,uBAAuBA,CAACW,UAAoBC;oBAEhD,OAAOT,wBAAwBA,CAACO,OAAO,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,IAAI;gBACtE;YACA,KAAKZ,sBAAsB;gBAAE;oBAC3B,MAAMY,QAAQR,yBAAyBA,CACrC,IAAI,CAAC,UAAU,EACfM,aACA,IAAI,CAAC,cAAc,EACnB,CAACG,UAAUC,YACTb,wBAAwBA,CAACY,UAAqBC;oBAElD,OAAOT,wBAAwBA,CAC7BO,OACA,IAAI,CAAC,aAAa,EAClB,IAAI,CAAC,IAAI,EACT;gBAEJ;YACA;gBACE,MAAM,IAAIG,MACR,CAAC,wBAAwB,EAAE,IAAI,CAAC,cAAc,CAAC,2BAA2B,EAAE,IAAI,CAAC,IAAI,EAAE;QAE7F;IACF;IAEA,MAAM,UAAUP,UAAsB,EAAiB;QACrD,MAAM,EAAEQ,YAAY,EAAEC,MAAM,EAAEC,QAAQ,EAAEC,UAAU,EAAEC,iBAAiB,EAAE,GACrEvB,yCAAyCA,CAACW,YAAY,IAAI,CAAC,EAAE;QAE/D,MAAMa,yBAAiD;YACrD,QAAQzB,6BAA6B;YACrCoB;YACAC;YACAC;YACAC;YACAC;YACA,sBAAsB;YACtB,qBAAqB,IAAI,CAAC,YAAY;YACtC,gBAAgB,IAAI,CAAC,cAAc;YACnC,UAAU,IAAI,CAAC,gBAAgB;QACjC;QACA,MAAM,EAAEE,MAAM,EAAE,GAAGC,WAAW,GAAGF;QACjC,MAAMvB,UAAUA,CAACU,YAAYc,QAAQC;IACvC;IAEA,MAAM,eAAef,UAAsB,EAAiB;QAC1D,MAAM,IAAI,CAAC,aAAa,CAACA,YAAY,IAAI;QACzC,MAAM,IAAI,CAAC,SAAS,CAACA;QACrB;IACF;IAEA,YAAY;QACV,qBAAO;IACT;;QAxGK,qBAKE,eAAe,SACf,mBAAmB;;AAmG5B"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { type AgenticOutputMessage, type BotContext, type GuardrailRule, type HubtypeAssistantMessage, type InferenceResponse, VerbosityLevel } from '@botonic/core';
|
|
2
|
-
import { type FlowBuilderContentMessage } from '../structured-output/flow-builder-content.js';
|
|
3
|
-
import { ContentFieldsBase } from './content-fields-base.js';
|
|
4
|
-
import type { HtInputGuardrailRule } from './hubtype-fields/index.js';
|
|
5
|
-
import type { FlowContent } from './index.js';
|
|
6
|
-
export declare abstract class FlowAiAgentBase extends ContentFieldsBase {
|
|
7
|
-
name: string;
|
|
8
|
-
instructions: string;
|
|
9
|
-
model: string;
|
|
10
|
-
verbosity: VerbosityLevel;
|
|
11
|
-
inputGuardrailRules: HtInputGuardrailRule[];
|
|
12
|
-
aiAgentResponse?: InferenceResponse<FlowBuilderContentMessage>;
|
|
13
|
-
messages: AgenticOutputMessage<FlowBuilderContentMessage>[];
|
|
14
|
-
jsxElements: JSX.Element[];
|
|
15
|
-
abstract getAIAgentResponse(botContext: BotContext, previousContents?: FlowContent[]): Promise<InferenceResponse<FlowBuilderContentMessage> | undefined>;
|
|
16
|
-
abstract trackAiAgentResponse(botContext: BotContext): Promise<void>;
|
|
17
|
-
resolveAIAgentResponse(botContext: BotContext, previousContents?: FlowContent[]): Promise<InferenceResponse<FlowBuilderContentMessage> | undefined>;
|
|
18
|
-
trackFlow(_botContext: BotContext): Promise<void>;
|
|
19
|
-
getFlowContentsByContentId(botContext: BotContext, contentId: string): Promise<FlowContent[]>;
|
|
20
|
-
messagesToBotonicJSXElements(botContext: BotContext): Promise<void>;
|
|
21
|
-
processContent(botContext: BotContext, previousContents?: FlowContent[]): Promise<void>;
|
|
22
|
-
toBotonic(): JSX.Element;
|
|
23
|
-
protected getPreviousHubtypeContents(previousContents?: FlowContent[]): HubtypeAssistantMessage[];
|
|
24
|
-
protected getActiveInputGuardrailRules(inputGuardrailRules: HtInputGuardrailRule[]): GuardrailRule[];
|
|
25
|
-
}
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import { Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { OutputMessageType, VerbosityLevel } from "@botonic/core";
|
|
3
|
-
import { FlowBuilderOutputMessageType } from "../structured-output/flow-builder-content.js";
|
|
4
|
-
import { getFlowBuilderPlugin } from "../utils/get-flow-builder-plugin.js";
|
|
5
|
-
import { HubtypeAssistantContent } from "../utils/hubtype-assistant-content.js";
|
|
6
|
-
import { ContentFieldsBase } from "./content-fields-base.js";
|
|
7
|
-
import { FlowCarousel } from "./flow-carousel.js";
|
|
8
|
-
import { FlowText } from "./flow-text.js";
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
class FlowAiAgentBase extends ContentFieldsBase {
|
|
27
|
-
async resolveAIAgentResponse(botContext, previousContents) {
|
|
28
|
-
const aiAgentResponse = await this.getAIAgentResponse(botContext, previousContents);
|
|
29
|
-
if (aiAgentResponse) {
|
|
30
|
-
this.aiAgentResponse = aiAgentResponse;
|
|
31
|
-
await this.trackAiAgentResponse(botContext);
|
|
32
|
-
this.messages = aiAgentResponse.messages;
|
|
33
|
-
}
|
|
34
|
-
return aiAgentResponse;
|
|
35
|
-
}
|
|
36
|
-
async trackFlow(_botContext) {
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
async getFlowContentsByContentId(botContext, contentId) {
|
|
40
|
-
const flowBuilderPlugin = getFlowBuilderPlugin(botContext.plugins);
|
|
41
|
-
const cmsApi = flowBuilderPlugin.cmsApi;
|
|
42
|
-
const node = cmsApi.getNodeByContentID(contentId);
|
|
43
|
-
const flowContents = await flowBuilderPlugin.getContentsByNode(node);
|
|
44
|
-
return flowContents;
|
|
45
|
-
}
|
|
46
|
-
async messagesToBotonicJSXElements(botContext) {
|
|
47
|
-
for (const message of this.messages){
|
|
48
|
-
if (message.type === OutputMessageType.Text || message.type === OutputMessageType.TextWithButtons || message.type === OutputMessageType.BotExecutor) {
|
|
49
|
-
this.jsxElements.push(FlowText.fromAIAgent(this.id, message));
|
|
50
|
-
}
|
|
51
|
-
if (message.type === OutputMessageType.Carousel) {
|
|
52
|
-
this.jsxElements.push(FlowCarousel.fromAIAgent(this.id, message, botContext));
|
|
53
|
-
}
|
|
54
|
-
if (message.type === FlowBuilderOutputMessageType.FlowBuilderContent) {
|
|
55
|
-
const flowContents = await this.getFlowContentsByContentId(botContext, message.contentId);
|
|
56
|
-
for (const content of flowContents){
|
|
57
|
-
await content.processContent(botContext);
|
|
58
|
-
this.jsxElements.push(content.toBotonic(botContext));
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
async processContent(botContext, previousContents) {
|
|
65
|
-
if (this.messages.length === 0) {
|
|
66
|
-
await this.resolveAIAgentResponse(botContext, previousContents);
|
|
67
|
-
}
|
|
68
|
-
if (this.jsxElements.length === 0) {
|
|
69
|
-
await this.filterContent(botContext, this);
|
|
70
|
-
await this.messagesToBotonicJSXElements(botContext);
|
|
71
|
-
}
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
toBotonic() {
|
|
75
|
-
return /*#__PURE__*/ jsx(Fragment, {
|
|
76
|
-
children: this.jsxElements
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
getPreviousHubtypeContents(previousContents) {
|
|
80
|
-
return previousContents?.map((content)=>{
|
|
81
|
-
return {
|
|
82
|
-
role: 'assistant',
|
|
83
|
-
content: HubtypeAssistantContent.adapt(content)
|
|
84
|
-
};
|
|
85
|
-
}) || [];
|
|
86
|
-
}
|
|
87
|
-
getActiveInputGuardrailRules(inputGuardrailRules) {
|
|
88
|
-
return inputGuardrailRules?.filter((rule)=>rule.is_active)?.map((rule)=>({
|
|
89
|
-
name: rule.name,
|
|
90
|
-
description: rule.description
|
|
91
|
-
})) || [];
|
|
92
|
-
}
|
|
93
|
-
constructor(...args){
|
|
94
|
-
super(...args), this.name = '', this.instructions = '', this.model = '', this.verbosity = VerbosityLevel.Medium, this.inputGuardrailRules = [], this.messages = [], this.jsxElements = [];
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
export { FlowAiAgentBase };
|
|
99
|
-
|
|
100
|
-
//# sourceMappingURL=flow-ai-agent-base.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"content-fields/flow-ai-agent-base.js","sources":["../../src/content-fields/flow-ai-agent-base.tsx"],"sourcesContent":["import {\n type AgenticOutputMessage,\n type BotContext,\n type GuardrailRule,\n type HubtypeAssistantMessage,\n type InferenceResponse,\n OutputMessageType,\n VerbosityLevel,\n} from '@botonic/core'\nimport {\n type FlowBuilderContentMessage,\n FlowBuilderOutputMessageType,\n} from '../structured-output/flow-builder-content'\nimport { getFlowBuilderPlugin } from '../utils/get-flow-builder-plugin'\nimport { HubtypeAssistantContent } from '../utils/hubtype-assistant-content'\nimport { ContentFieldsBase } from './content-fields-base'\nimport { FlowCarousel } from './flow-carousel'\nimport { FlowText } from './flow-text'\nimport type { HtInputGuardrailRule, HtNodeWithContent } from './hubtype-fields'\nimport type { FlowContent } from './index'\n\nexport abstract class FlowAiAgentBase extends ContentFieldsBase {\n public name: string = ''\n public instructions: string = ''\n public model: string = ''\n public verbosity: VerbosityLevel = VerbosityLevel.Medium\n public inputGuardrailRules: HtInputGuardrailRule[] = []\n\n public aiAgentResponse?: InferenceResponse<FlowBuilderContentMessage>\n public messages: AgenticOutputMessage<FlowBuilderContentMessage>[] = []\n public jsxElements: JSX.Element[] = []\n\n abstract getAIAgentResponse(\n botContext: BotContext,\n previousContents?: FlowContent[]\n ): Promise<InferenceResponse<FlowBuilderContentMessage> | undefined>\n\n abstract trackAiAgentResponse(botContext: BotContext): Promise<void>\n\n async resolveAIAgentResponse(\n botContext: BotContext,\n previousContents?: FlowContent[]\n ): Promise<InferenceResponse<FlowBuilderContentMessage> | undefined> {\n const aiAgentResponse = await this.getAIAgentResponse(\n botContext,\n previousContents\n )\n\n if (aiAgentResponse) {\n this.aiAgentResponse = aiAgentResponse\n await this.trackAiAgentResponse(botContext)\n this.messages = aiAgentResponse.messages\n }\n\n return aiAgentResponse\n }\n\n async trackFlow(_botContext: BotContext): Promise<void> {\n return\n }\n\n async getFlowContentsByContentId(\n botContext: BotContext,\n contentId: string\n ): Promise<FlowContent[]> {\n const flowBuilderPlugin = getFlowBuilderPlugin(botContext.plugins)\n const cmsApi = flowBuilderPlugin.cmsApi\n const node = cmsApi.getNodeByContentID(contentId)\n const flowContents = await flowBuilderPlugin.getContentsByNode(\n node as HtNodeWithContent\n )\n\n return flowContents\n }\n\n async messagesToBotonicJSXElements(botContext: BotContext): Promise<void> {\n for (const message of this.messages) {\n if (\n message.type === OutputMessageType.Text ||\n message.type === OutputMessageType.TextWithButtons ||\n message.type === OutputMessageType.BotExecutor\n ) {\n this.jsxElements.push(FlowText.fromAIAgent(this.id, message))\n }\n\n if (message.type === OutputMessageType.Carousel) {\n this.jsxElements.push(\n FlowCarousel.fromAIAgent(this.id, message, botContext)\n )\n }\n\n if (message.type === FlowBuilderOutputMessageType.FlowBuilderContent) {\n const flowContents = await this.getFlowContentsByContentId(\n botContext,\n message.contentId\n )\n for (const content of flowContents) {\n await content.processContent(botContext)\n this.jsxElements.push(content.toBotonic(botContext))\n }\n }\n }\n return\n }\n\n async processContent(\n botContext: BotContext,\n previousContents?: FlowContent[]\n ): Promise<void> {\n if (this.messages.length === 0) {\n await this.resolveAIAgentResponse(botContext, previousContents)\n }\n if (this.jsxElements.length === 0) {\n await this.filterContent(botContext, this as unknown as FlowContent)\n await this.messagesToBotonicJSXElements(botContext)\n }\n return\n }\n\n toBotonic(): JSX.Element {\n return <>{this.jsxElements}</>\n }\n\n protected getPreviousHubtypeContents(\n previousContents?: FlowContent[]\n ): HubtypeAssistantMessage[] {\n return (\n previousContents?.map(content => {\n return {\n role: 'assistant',\n content: HubtypeAssistantContent.adapt(content),\n }\n }) || []\n )\n }\n\n protected getActiveInputGuardrailRules(\n inputGuardrailRules: HtInputGuardrailRule[]\n ): GuardrailRule[] {\n return (\n inputGuardrailRules\n ?.filter(rule => rule.is_active)\n ?.map(rule => ({\n name: rule.name,\n description: rule.description,\n })) || []\n )\n }\n}\n"],"names":["OutputMessageType","VerbosityLevel","FlowBuilderOutputMessageType","getFlowBuilderPlugin","HubtypeAssistantContent","ContentFieldsBase","FlowCarousel","FlowText","FlowAiAgentBase","botContext","previousContents","aiAgentResponse","_botContext","contentId","flowBuilderPlugin","cmsApi","node","flowContents","message","content","inputGuardrailRules","rule"],"mappings":";;;;;;;;;;;;;;;;;;AAQsB;AAI4B;AACqB;AACK;AACnB;AACX;AACR;AAI/B,MAAeQ,eAAeA,SAASH,iBAAiBA;IAkB7D,MAAM,uBACJI,UAAsB,EACtBC,gBAAgC,EACmC;QACnE,MAAMC,kBAAkB,MAAM,IAAI,CAAC,kBAAkB,CACnDF,YACAC;QAGF,IAAIC,iBAAiB;YACnB,IAAI,CAAC,eAAe,GAAGA;YACvB,MAAM,IAAI,CAAC,oBAAoB,CAACF;YAChC,IAAI,CAAC,QAAQ,GAAGE,gBAAgB,QAAQ;QAC1C;QAEA,OAAOA;IACT;IAEA,MAAM,UAAUC,WAAuB,EAAiB;QACtD;IACF;IAEA,MAAM,2BACJH,UAAsB,EACtBI,SAAiB,EACO;QACxB,MAAMC,oBAAoBX,oBAAoBA,CAACM,WAAW,OAAO;QACjE,MAAMM,SAASD,kBAAkB,MAAM;QACvC,MAAME,OAAOD,OAAO,kBAAkB,CAACF;QACvC,MAAMI,eAAe,MAAMH,kBAAkB,iBAAiB,CAC5DE;QAGF,OAAOC;IACT;IAEA,MAAM,6BAA6BR,UAAsB,EAAiB;QACxE,KAAK,MAAMS,WAAW,IAAI,CAAC,QAAQ,CAAE;YACnC,IACEA,QAAQ,IAAI,KAAKlB,sBAAsB,IACvCkB,QAAQ,IAAI,KAAKlB,iCAAiC,IAClDkB,QAAQ,IAAI,KAAKlB,6BAA6B,EAC9C;gBACA,IAAI,CAAC,WAAW,CAAC,IAAI,CAACO,oBAAoB,CAAC,IAAI,CAAC,EAAE,EAAEW;YACtD;YAEA,IAAIA,QAAQ,IAAI,KAAKlB,0BAA0B,EAAE;gBAC/C,IAAI,CAAC,WAAW,CAAC,IAAI,CACnBM,wBAAwB,CAAC,IAAI,CAAC,EAAE,EAAEY,SAAST;YAE/C;YAEA,IAAIS,QAAQ,IAAI,KAAKhB,+CAA+C,EAAE;gBACpE,MAAMe,eAAe,MAAM,IAAI,CAAC,0BAA0B,CACxDR,YACAS,QAAQ,SAAS;gBAEnB,KAAK,MAAMC,WAAWF,aAAc;oBAClC,MAAME,QAAQ,cAAc,CAACV;oBAC7B,IAAI,CAAC,WAAW,CAAC,IAAI,CAACU,QAAQ,SAAS,CAACV;gBAC1C;YACF;QACF;QACA;IACF;IAEA,MAAM,eACJA,UAAsB,EACtBC,gBAAgC,EACjB;QACf,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,KAAK,GAAG;YAC9B,MAAM,IAAI,CAAC,sBAAsB,CAACD,YAAYC;QAChD;QACA,IAAI,IAAI,CAAC,WAAW,CAAC,MAAM,KAAK,GAAG;YACjC,MAAM,IAAI,CAAC,aAAa,CAACD,YAAY,IAAI;YACzC,MAAM,IAAI,CAAC,4BAA4B,CAACA;QAC1C;QACA;IACF;IAEA,YAAyB;QACvB,qBAAO;sBAAG,IAAI,CAAC,WAAW;;IAC5B;IAEU,2BACRC,gBAAgC,EACL;QAC3B,OACEA,kBAAkB,IAAIS,CAAAA;YACpB,OAAO;gBACL,MAAM;gBACN,SAASf,6BAA6B,CAACe;YACzC;QACF,MAAM,EAAE;IAEZ;IAEU,6BACRC,mBAA2C,EAC1B;QACjB,OACEA,qBACI,OAAOC,CAAAA,OAAQA,KAAK,SAAS,GAC7B,IAAIA,CAAAA,OAAS;gBACb,MAAMA,KAAK,IAAI;gBACf,aAAaA,KAAK,WAAW;YAC/B,OAAO,EAAE;IAEf;;QA9HK,qBACE,OAAe,SACf,eAAuB,SACvB,QAAgB,SAChB,YAA4BpB,qBAAqB,OACjD,sBAA8C,EAAE,OAGhD,WAA8D,EAAE,OAChE,cAA6B,EAAE;;AAsHxC"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { type BotContext, type InferenceResponse } from '@botonic/core';
|
|
2
|
-
import { type FlowBuilderContentMessage } from '../structured-output/flow-builder-content.js';
|
|
3
|
-
import { FlowAiAgent } from './flow-ai-agent.js';
|
|
4
|
-
import { FlowAiAgentBase } from './flow-ai-agent-base.js';
|
|
5
|
-
import type { HtAiAgentRouterNode } from './hubtype-fields/index.js';
|
|
6
|
-
import type { FlowContent } from './index.js';
|
|
7
|
-
export interface AvailableSpecialists {
|
|
8
|
-
agent: FlowAiAgent;
|
|
9
|
-
description: string;
|
|
10
|
-
name: string;
|
|
11
|
-
}
|
|
12
|
-
export declare class FlowAiAgentRouter extends FlowAiAgentBase {
|
|
13
|
-
availableSpecialists: AvailableSpecialists[];
|
|
14
|
-
static fromHubtypeCMS(component: HtAiAgentRouterNode, botContext: BotContext): FlowAiAgentRouter;
|
|
15
|
-
private static getAvailableSpecialistsFromHubtypeCMS;
|
|
16
|
-
private static specialistAgentBaseName;
|
|
17
|
-
getAIAgentResponse(botContext: BotContext, previousContents?: FlowContent[]): Promise<InferenceResponse<FlowBuilderContentMessage> | undefined>;
|
|
18
|
-
trackAiAgentResponse(botContext: BotContext): Promise<void>;
|
|
19
|
-
private trackAIAgentRouterEvent;
|
|
20
|
-
private trackAIAgentSpecialistEvent;
|
|
21
|
-
}
|