@botonic/plugin-flow-builder 0.57.0-rslib-esm.2 → 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 +10 -12
- 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 +1 -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 +2 -0
- 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/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 -106
- 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 -11
- package/lib/content-fields/flow-whatsapp-request-contact-info.js +0 -61
- 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 -13
- package/lib/utils/hubtype-assistant-content.js +0 -200
- 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
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getContentsByFirstInteraction = getContentsByFirstInteraction;
|
|
4
|
+
const core_1 = require("@botonic/core");
|
|
5
|
+
const constants_1 = require("../constants");
|
|
6
|
+
const content_fields_1 = require("../content-fields");
|
|
7
|
+
const input_1 = require("../utils/input");
|
|
8
|
+
const ai_agent_from_user_input_1 = require("./ai-agent-from-user-input");
|
|
9
|
+
const payload_1 = require("./payload");
|
|
10
|
+
async function getContentsByFirstInteraction(context) {
|
|
11
|
+
const { contentID, flowBuilderPlugin, request } = context;
|
|
12
|
+
/*
|
|
13
|
+
* If the contentID is provided, the firstInteractionContents are obtained even if they are not used
|
|
14
|
+
* because when obtain this firstInteractionContents is when the session.flow_thread_id is updated.
|
|
15
|
+
* This is needed for example when send a WhatsApp campaign is sent,
|
|
16
|
+
* the bot not receives the message because this message is sent directly by the backend
|
|
17
|
+
* we expect the bot to respond only with the contents of the contentID and not with the firstInteractionContents.
|
|
18
|
+
*/
|
|
19
|
+
const firstInteractionContents = await flowBuilderPlugin.getStartContents();
|
|
20
|
+
if (contentID) {
|
|
21
|
+
try {
|
|
22
|
+
const contentsByContentID = await flowBuilderPlugin.getContentsByContentID(contentID);
|
|
23
|
+
if (contentsByContentID.length > 0) {
|
|
24
|
+
return contentsByContentID;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
catch (_error) {
|
|
28
|
+
console.warn(`The contentID ${contentID} is not found. Returning the firstInteractionContents`);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
// Bot actions and AI agents already consume the user input. Matching
|
|
32
|
+
// keywords/intents/KB/AI-agent-from-user-input on top would duplicate replies
|
|
33
|
+
// (e.g. Main start → Go to flow → AI Agents).
|
|
34
|
+
if (startContentsAlreadyHandleUserInput(firstInteractionContents)) {
|
|
35
|
+
return firstInteractionContents;
|
|
36
|
+
}
|
|
37
|
+
if (request.input.nluResolution || (0, input_1.inputHasTextOrTranscript)(request.input)) {
|
|
38
|
+
const contentsByUserInput = await getContentsByUserInput(context);
|
|
39
|
+
if (request.input.nluResolution?.type === core_1.NluType.AiAgent) {
|
|
40
|
+
const startContents = await flowBuilderPlugin.getStartContents();
|
|
41
|
+
return [...startContents, ...contentsByUserInput];
|
|
42
|
+
}
|
|
43
|
+
return [...firstInteractionContents, ...contentsByUserInput];
|
|
44
|
+
}
|
|
45
|
+
return firstInteractionContents;
|
|
46
|
+
}
|
|
47
|
+
function startContentsAlreadyHandleUserInput(contents) {
|
|
48
|
+
if (contents.at(-1) instanceof content_fields_1.FlowBotAction) {
|
|
49
|
+
return true;
|
|
50
|
+
}
|
|
51
|
+
// To avoid duplicated ai agent response, we check if there is an ai agent or ai agent router in the first interaction contents.
|
|
52
|
+
return contents.some(content => content instanceof content_fields_1.FlowAiAgent || content instanceof content_fields_1.FlowAiAgentRouter);
|
|
53
|
+
}
|
|
54
|
+
async function getContentsByUserInput(context) {
|
|
55
|
+
const { cmsApi, flowBuilderPlugin, request, resolvedLocale } = context;
|
|
56
|
+
const payloadByNlu = request.input.nluResolution?.payload;
|
|
57
|
+
if (payloadByNlu) {
|
|
58
|
+
request.input.payload = payloadByNlu;
|
|
59
|
+
const conversationStartId = getConversationStartId(cmsApi);
|
|
60
|
+
if (request.input.payload === conversationStartId) {
|
|
61
|
+
return [];
|
|
62
|
+
}
|
|
63
|
+
const contentsByKeywordsOrIntents = await (0, payload_1.getContentsByPayload)({
|
|
64
|
+
cmsApi,
|
|
65
|
+
flowBuilderPlugin,
|
|
66
|
+
request,
|
|
67
|
+
resolvedLocale,
|
|
68
|
+
});
|
|
69
|
+
const hasRepeatedContent = await checkRepeatedContents(flowBuilderPlugin, contentsByKeywordsOrIntents);
|
|
70
|
+
if (hasRepeatedContent) {
|
|
71
|
+
return [];
|
|
72
|
+
}
|
|
73
|
+
if (contentsByKeywordsOrIntents.length > 0) {
|
|
74
|
+
return contentsByKeywordsOrIntents;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
if (!flowBuilderPlugin.disableAIAgentInFirstInteraction) {
|
|
78
|
+
const contentsByAiAgent = await (0, ai_agent_from_user_input_1.getContentsByAiAgentFromUserInput)(context);
|
|
79
|
+
return contentsByAiAgent;
|
|
80
|
+
}
|
|
81
|
+
return [];
|
|
82
|
+
}
|
|
83
|
+
function getConversationStartId(cmsApi) {
|
|
84
|
+
const conversationStartId = cmsApi.flow.flows.find(flow => flow.name === constants_1.MAIN_FLOW_NAME)?.start_node_id;
|
|
85
|
+
return conversationStartId;
|
|
86
|
+
}
|
|
87
|
+
async function checkRepeatedContents(flowBuilderPlugin, contentsByKeywordsOrIntents) {
|
|
88
|
+
const startContents = await flowBuilderPlugin.getStartContents();
|
|
89
|
+
const contentIds = new Set(contentsByKeywordsOrIntents.map(content => content.id));
|
|
90
|
+
const hasRepeatedContent = startContents.some(content => contentIds.has(content.id));
|
|
91
|
+
return hasRepeatedContent;
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=first-interaction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"first-interaction.js","sourceRoot":"","sources":["../../../src/action/first-interaction.ts"],"names":[],"mappings":";;AAeA,sEAgDC;AA/DD,wCAAuC;AAEvC,4CAA6C;AAC7C,sDAK0B;AAE1B,0CAAyD;AACzD,yEAA8E;AAE9E,uCAAgD;AAEzC,KAAK,UAAU,6BAA6B,CACjD,OAA2B;IAE3B,MAAM,EAAE,SAAS,EAAE,iBAAiB,EAAE,OAAO,EAAE,GAAG,OAAO,CAAA;IAEzD;;;;;;OAMG;IACH,MAAM,wBAAwB,GAAG,MAAM,iBAAiB,CAAC,gBAAgB,EAAE,CAAA;IAE3E,IAAI,SAAS,EAAE,CAAC;QACd,IAAI,CAAC;YACH,MAAM,mBAAmB,GACvB,MAAM,iBAAiB,CAAC,sBAAsB,CAAC,SAAS,CAAC,CAAA;YAE3D,IAAI,mBAAmB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACnC,OAAO,mBAAmB,CAAA;YAC5B,CAAC;QACH,CAAC;QAAC,OAAO,MAAM,EAAE,CAAC;YAChB,OAAO,CAAC,IAAI,CACV,iBAAiB,SAAS,uDAAuD,CAClF,CAAA;QACH,CAAC;IACH,CAAC;IAED,qEAAqE;IACrE,8EAA8E;IAC9E,8CAA8C;IAC9C,IAAI,mCAAmC,CAAC,wBAAwB,CAAC,EAAE,CAAC;QAClE,OAAO,wBAAwB,CAAA;IACjC,CAAC;IAED,IAAI,OAAO,CAAC,KAAK,CAAC,aAAa,IAAI,IAAA,gCAAwB,EAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QAC3E,MAAM,mBAAmB,GAAG,MAAM,sBAAsB,CAAC,OAAO,CAAC,CAAA;QAEjE,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AqB,CACpD,iBAAiB,EACjB,2BAA2B,CAC5B,CAAA;QAED,IAAI,kBAAkB,EAAE,CAAC;YACvB,OAAO,EAAE,CAAA;QACX,CAAC;QAED,IAAI,2BAA2B,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC3C,OAAO,2BAA2B,CAAA;QACpC,CAAC;IACH,CAAC;IAED,IAAI,CAAC,iBAAiB,CAAC,gCAAgC,EAAE,CAAC;QACxD,MAAM,iBAAiB,GAAG,MAAM,IAAA,4DAAiC,EAAC,OAAO,CAAC,CAAA;QAC1E,OAAO,iBAAiB,CAAA;IAC1B,CAAC;IAED,OAAO,EAAE,CAAA;AACX,CAAC;AAED,SAAS,sBAAsB,CAAC,MAAsB;IACpD,MAAM,mBAAmB,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAChD,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,0BAAc,CACrC,EAAE,aAAa,CAAA;IAEhB,OAAO,mBAAmB,CAAA;AAC5B,CAAC;AAED,KAAK,UAAU,qBAAqB,CAClC,iBAA2C,EAC3C,2BAA0C;IAE1C,MAAM,aAAa,GAAG,MAAM,iBAAiB,CAAC,gBAAgB,EAAE,CAAA;IAChE,MAAM,UAAU,GAAG,IAAI,GAAG,CACxB,2BAA2B,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,CACvD,CAAA;IACD,MAAM,kBAAkB,GAAG,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CACtD,UAAU,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,CAC3B,CAAA;IAED,OAAO,kBAAkB,CAAA;AAC3B,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getContents = getContents;
|
|
4
|
+
const core_1 = require("@botonic/core");
|
|
5
|
+
const constants_1 = require("../constants");
|
|
6
|
+
const input_1 = require("../utils/input");
|
|
7
|
+
const ai_agent_from_user_input_1 = require("./ai-agent-from-user-input");
|
|
8
|
+
const context_1 = require("./context");
|
|
9
|
+
const fallback_1 = require("./fallback");
|
|
10
|
+
const first_interaction_1 = require("./first-interaction");
|
|
11
|
+
const payload_1 = require("./payload");
|
|
12
|
+
async function getContents(botContext, contentID) {
|
|
13
|
+
const context = (0, context_1.getFlowBuilderActionContext)(botContext, contentID);
|
|
14
|
+
if (botContext.session.is_first_interaction) {
|
|
15
|
+
return await (0, first_interaction_1.getContentsByFirstInteraction)(context);
|
|
16
|
+
}
|
|
17
|
+
// TODO: Add needed logic when we can define contents for multi locale queue position message
|
|
18
|
+
if (botContext.input.type === core_1.INPUT.EVENT_QUEUE_POSITION_CHANGED) {
|
|
19
|
+
return [];
|
|
20
|
+
}
|
|
21
|
+
if (botContext.input.payload?.startsWith(constants_1.EMPTY_PAYLOAD)) {
|
|
22
|
+
botContext.input.payload = undefined;
|
|
23
|
+
}
|
|
24
|
+
if (botContext.input.payload || contentID) {
|
|
25
|
+
const contentsByPayload = await (0, payload_1.getContentsByPayload)(context);
|
|
26
|
+
if (contentsByPayload.length > 0) {
|
|
27
|
+
return contentsByPayload;
|
|
28
|
+
}
|
|
29
|
+
return await (0, fallback_1.getContentsByFallback)(context);
|
|
30
|
+
}
|
|
31
|
+
if ((0, input_1.inputHasTextOrTranscript)(botContext.input) ||
|
|
32
|
+
isContactRequested(botContext.input)) {
|
|
33
|
+
const aiAgentContents = await (0, ai_agent_from_user_input_1.getContentsByAiAgentFromUserInput)(context);
|
|
34
|
+
if (aiAgentContents.length > 0) {
|
|
35
|
+
return aiAgentContents;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return await (0, fallback_1.getContentsByFallback)(context);
|
|
39
|
+
}
|
|
40
|
+
function isContactRequested(input) {
|
|
41
|
+
return (input.type === core_1.INPUT.CONTACT &&
|
|
42
|
+
input.origin === core_1.WhatsappInputOrigin.ContactRequest);
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=get-contents.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-contents.js","sourceRoot":"","sources":["../../../src/action/get-contents.ts"],"names":[],"mappings":";;AAeA,kCAsCC;AArDD,wCAKsB;AACtB,4CAA4C;AAE5C,0CAAyD;AACzD,yEAA8E;AAC9E,uCAAuD;AACvD,yCAAkD;AAClD,2DAAmE;AACnE,uCAAgD;AAEzC,KAAK,UAAU,WAAW,CAC/B,UAAsB,EACtB,SAAkB;IAElB,MAAM,OAAO,GAAG,IAAA,qCAA2B,EAAC,UAAU,EAAE,SAAS,CAAC,CAAA;IAElE,IAAI,UAAU,CAAC,OAAO,CAAC,oBAAoB,EAAE,CAAC;QAC5C,OAAO,MAAM,IAAA,iDAA6B,EAAC,OAAO,CAAC,CAAA;IACrD,CAAC;IACD,6FAA6F;IAC7F,IAAI,UAAU,CAAC,KAAK,CAAC,IAAI,KAAK,YAAK,CAAC,4BAA4B,EAAE,CAAC;QACjE,OAAO,EAAE,CAAA;IACX,CAAC;IAED,IAAI,UAAU,CAAC,KAAK,CAAC,OAAO,EAAE,UAAU,CAAC,yBAAa,CAAC,EAAE,CAAC;QACxD,UAAU,CAAC,KAAK,CAAC,OAAO,GAAG,SAAS,CAAA;IACtC,CAAC;IAED,IAAI,UAAU,CAAC,KAAK,CAAC,OAAO,IAAI,SAAS,EAAE,CAAC;QAC1C,MAAM,iBAAiB,GAAG,MAAM,IAAA,8BAAoB,EAAC,OAAO,CAAC,CAAA;QAC7D,IAAI,iBAAiB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACjC,OAAO,iBAAiB,CAAA;QAC1B,CAAC;QAED,OAAO,MAAM,IAAA,gCAAqB,EAAC,OAAO,CAAC,CAAA;IAC7C,CAAC;IAED,IACE,IAAA,gCAAwB,EAAC,UAAU,CAAC,KAAK,CAAC;QAC1C,kBAAkB,CAAC,UAAU,CAAC,KAAK,CAAC,EACpC,CAAC;QACD,MAAM,eAAe,GAAG,MAAM,IAAA,4DAAiC,EAAC,OAAO,CAAC,CAAA;QACxE,IAAI,eAAe,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC/B,OAAO,eAAe,CAAA;QACxB,CAAC;IACH,CAAC;IAED,OAAO,MAAM,IAAA,gCAAqB,EAAC,OAAO,CAAC,CAAA;AAC7C,CAAC;AAED,SAAS,kBAAkB,CAAC,KAAY;IACtC,OAAO,CACL,KAAK,CAAC,IAAI,KAAK,YAAK,CAAC,OAAO;QAC5B,KAAK,CAAC,MAAM,KAAK,0BAAmB,CAAC,cAAc,CACpD,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type BotContext } from '@botonic/core';
|
|
2
|
+
import { RequestContext, type WebchatSettingsProps } from '@botonic/react';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { type FlowContent } from '../content-fields';
|
|
5
|
+
export type FlowBuilderActionProps = {
|
|
6
|
+
contents: FlowContent[];
|
|
7
|
+
webchatSettingsParams?: WebchatSettingsProps;
|
|
8
|
+
};
|
|
9
|
+
export declare class FlowBuilderAction extends React.Component<FlowBuilderActionProps> {
|
|
10
|
+
static contextType: React.Context<import("@botonic/react").ActionRequest>;
|
|
11
|
+
context: React.ContextType<typeof RequestContext>;
|
|
12
|
+
static executeConversationStart(botContext: BotContext): Promise<FlowBuilderActionProps>;
|
|
13
|
+
static botonicInit(botContext: BotContext, contentID?: string): Promise<FlowBuilderActionProps>;
|
|
14
|
+
static prepareContentsToRender(botContext: BotContext, contents: FlowContent[]): Promise<FlowContent[]>;
|
|
15
|
+
private static isAiAgentContent;
|
|
16
|
+
private static processAiAgentContent;
|
|
17
|
+
protected getWebchatSettingsParams(botContext: BotContext): {
|
|
18
|
+
shouldSendWebchatSettings: boolean;
|
|
19
|
+
webchatSettingsParams?: WebchatSettingsProps;
|
|
20
|
+
};
|
|
21
|
+
render(): JSX.Element | JSX.Element[];
|
|
22
|
+
}
|
|
23
|
+
export declare class FlowBuilderMultichannelAction extends FlowBuilderAction {
|
|
24
|
+
render(): JSX.Element | JSX.Element[];
|
|
25
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FlowBuilderMultichannelAction = exports.FlowBuilderAction = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const core_1 = require("@botonic/core");
|
|
7
|
+
const react_1 = require("@botonic/react");
|
|
8
|
+
const react_2 = tslib_1.__importDefault(require("react"));
|
|
9
|
+
const content_fields_1 = require("../content-fields");
|
|
10
|
+
const ai_agent_1 = require("../utils/ai-agent");
|
|
11
|
+
const get_flow_builder_plugin_1 = require("../utils/get-flow-builder-plugin");
|
|
12
|
+
const context_1 = require("./context");
|
|
13
|
+
const first_interaction_1 = require("./first-interaction");
|
|
14
|
+
const get_contents_1 = require("./get-contents");
|
|
15
|
+
class FlowBuilderAction extends react_2.default.Component {
|
|
16
|
+
static async executeConversationStart(botContext) {
|
|
17
|
+
const context = (0, context_1.getFlowBuilderActionContext)(botContext);
|
|
18
|
+
const contents = await (0, first_interaction_1.getContentsByFirstInteraction)(context);
|
|
19
|
+
const filteredContents = await FlowBuilderAction.prepareContentsToRender(botContext, contents);
|
|
20
|
+
return { contents: filteredContents };
|
|
21
|
+
}
|
|
22
|
+
static async botonicInit(botContext, contentID) {
|
|
23
|
+
const contents = await (0, get_contents_1.getContents)(botContext, contentID);
|
|
24
|
+
const contentsToRender = await FlowBuilderAction.prepareContentsToRender(botContext, contents);
|
|
25
|
+
return { contents: contentsToRender };
|
|
26
|
+
}
|
|
27
|
+
static async prepareContentsToRender(botContext, contents) {
|
|
28
|
+
for (const content of contents) {
|
|
29
|
+
if (FlowBuilderAction.isAiAgentContent(content)) {
|
|
30
|
+
await FlowBuilderAction.processAiAgentContent(botContext, contents);
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
await content.processContent(botContext);
|
|
34
|
+
if (content instanceof content_fields_1.FlowWhatsappRequestContactInfoNode) {
|
|
35
|
+
const flowBuilderPlugin = (0, get_flow_builder_plugin_1.getFlowBuilderPlugin)(botContext.plugins);
|
|
36
|
+
flowBuilderPlugin.cmsApi.setWhatsappRequestContactId(content.id);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return contents;
|
|
40
|
+
}
|
|
41
|
+
static isAiAgentContent(content) {
|
|
42
|
+
return (content instanceof content_fields_1.FlowAiAgent || content instanceof content_fields_1.FlowAiAgentRouter);
|
|
43
|
+
}
|
|
44
|
+
// TODO: Refactor this to be more generic and reusable
|
|
45
|
+
static async processAiAgentContent(botContext, contents) {
|
|
46
|
+
const splitContents = (0, ai_agent_1.splitAiAgentContents)(contents);
|
|
47
|
+
if (!splitContents) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
if ('aiAgentRouterContent' in splitContents) {
|
|
51
|
+
const { aiAgentRouterContent, contentsBeforeAiAgentRouter } = splitContents;
|
|
52
|
+
await aiAgentRouterContent.processContent(botContext, contentsBeforeAiAgentRouter);
|
|
53
|
+
}
|
|
54
|
+
if ('aiAgentWorkerContent' in splitContents) {
|
|
55
|
+
const { aiAgentWorkerContent, contentsBeforeAiAgentWorker } = splitContents;
|
|
56
|
+
await aiAgentWorkerContent.processContent(botContext, contentsBeforeAiAgentWorker);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
getWebchatSettingsParams(botContext) {
|
|
60
|
+
let { webchatSettingsParams } = this.props;
|
|
61
|
+
if (botContext.session.user.system_locale_updated) {
|
|
62
|
+
webchatSettingsParams = {
|
|
63
|
+
...webchatSettingsParams,
|
|
64
|
+
user: {
|
|
65
|
+
...webchatSettingsParams?.user,
|
|
66
|
+
system_locale: botContext.session.user.system_locale,
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
const shouldSendWebchatSettings = ((0, core_1.isWebchat)(botContext.session) || (0, core_1.isDev)(botContext.session)) &&
|
|
71
|
+
!!webchatSettingsParams;
|
|
72
|
+
return {
|
|
73
|
+
shouldSendWebchatSettings,
|
|
74
|
+
webchatSettingsParams,
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
render() {
|
|
78
|
+
const { contents } = this.props;
|
|
79
|
+
const botContext = this.context;
|
|
80
|
+
const { shouldSendWebchatSettings, webchatSettingsParams } = this.getWebchatSettingsParams(botContext);
|
|
81
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [shouldSendWebchatSettings && ((0, jsx_runtime_1.jsx)(react_1.WebchatSettings, { ...webchatSettingsParams })), contents.map(content => content.toBotonic(botContext))] }));
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
exports.FlowBuilderAction = FlowBuilderAction;
|
|
85
|
+
FlowBuilderAction.contextType = react_1.RequestContext;
|
|
86
|
+
class FlowBuilderMultichannelAction extends FlowBuilderAction {
|
|
87
|
+
render() {
|
|
88
|
+
const { contents } = this.props;
|
|
89
|
+
const botContext = this.context;
|
|
90
|
+
const { shouldSendWebchatSettings, webchatSettingsParams } = this.getWebchatSettingsParams(botContext);
|
|
91
|
+
return ((0, jsx_runtime_1.jsxs)(react_1.Multichannel, { text: { buttonsAsText: false }, children: [shouldSendWebchatSettings && ((0, jsx_runtime_1.jsx)(react_1.WebchatSettings, { ...webchatSettingsParams })), contents.map(content => content.toBotonic(botContext))] }));
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
exports.FlowBuilderMultichannelAction = FlowBuilderMultichannelAction;
|
|
95
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/action/index.tsx"],"names":[],"mappings":";;;;;AAAA,wCAAiE;AACjE,0CAKuB;AACvB,0DAAyB;AA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AgBC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getContentsByPayload = getContentsByPayload;
|
|
4
|
+
const core_1 = require("@botonic/core");
|
|
5
|
+
const uuid_1 = require("uuid");
|
|
6
|
+
const constants_1 = require("../constants");
|
|
7
|
+
const tracking_1 = require("../tracking");
|
|
8
|
+
async function getContentsByPayload(context) {
|
|
9
|
+
const { cmsApi, flowBuilderPlugin, request, contentID } = context;
|
|
10
|
+
if (request.input.payload?.startsWith(constants_1.AGENT_RATING_PAYLOAD)) {
|
|
11
|
+
return await resolveRatingPayload(context);
|
|
12
|
+
}
|
|
13
|
+
if (request.input.payload?.startsWith(constants_1.PUSH_FLOW_PAYLOAD)) {
|
|
14
|
+
return await resolvePushFlowPayload(context);
|
|
15
|
+
}
|
|
16
|
+
const id = contentID
|
|
17
|
+
? cmsApi.getNodeByContentID(contentID)?.id
|
|
18
|
+
: request.input.payload;
|
|
19
|
+
const targetNode = id ? cmsApi.getNodeById(id) : undefined;
|
|
20
|
+
if (targetNode) {
|
|
21
|
+
return await flowBuilderPlugin.getContentsByNode(targetNode);
|
|
22
|
+
}
|
|
23
|
+
return [];
|
|
24
|
+
}
|
|
25
|
+
async function resolveRatingPayload(context) {
|
|
26
|
+
const { cmsApi, flowBuilderPlugin, request } = context;
|
|
27
|
+
if (!request.input.payload) {
|
|
28
|
+
return [];
|
|
29
|
+
}
|
|
30
|
+
const { target, text, value, possibleOptions, possibleValues } = flowBuilderPlugin.getRatingSubmittedInfo(request.input.payload);
|
|
31
|
+
if (request.session._hubtype_case_id) {
|
|
32
|
+
const event = {
|
|
33
|
+
action: core_1.EventAction.FeedbackCase,
|
|
34
|
+
feedbackTargetId: request.session._hubtype_case_id,
|
|
35
|
+
feedbackGroupId: (0, uuid_1.v7)().toString(),
|
|
36
|
+
possibleOptions,
|
|
37
|
+
possibleValues,
|
|
38
|
+
option: text,
|
|
39
|
+
value,
|
|
40
|
+
};
|
|
41
|
+
await (0, core_1.storeCaseRating)(request.session, value);
|
|
42
|
+
await (0, tracking_1.trackEvent)(request, core_1.EventAction.FeedbackCase, event);
|
|
43
|
+
}
|
|
44
|
+
const targetNode = target
|
|
45
|
+
? cmsApi.getNodeById(target.id)
|
|
46
|
+
: undefined;
|
|
47
|
+
if (targetNode) {
|
|
48
|
+
return await flowBuilderPlugin.getContentsByNode(targetNode);
|
|
49
|
+
}
|
|
50
|
+
return [];
|
|
51
|
+
}
|
|
52
|
+
async function resolvePushFlowPayload(context) {
|
|
53
|
+
const { cmsApi, flowBuilderPlugin, request } = context;
|
|
54
|
+
if (!request.input.payload) {
|
|
55
|
+
return [];
|
|
56
|
+
}
|
|
57
|
+
const parts = request.input.payload.split(constants_1.SEPARATOR);
|
|
58
|
+
const pushFlowId = parts.length > 1 ? parts[1] : '';
|
|
59
|
+
if (!pushFlowId) {
|
|
60
|
+
return [];
|
|
61
|
+
}
|
|
62
|
+
try {
|
|
63
|
+
const pushFlowNode = cmsApi.getNodeByCampaignId(pushFlowId);
|
|
64
|
+
if (!pushFlowNode) {
|
|
65
|
+
return [];
|
|
66
|
+
}
|
|
67
|
+
return await flowBuilderPlugin.getContentsByNode(pushFlowNode);
|
|
68
|
+
}
|
|
69
|
+
catch {
|
|
70
|
+
// Campaign not found - return empty to trigger fallback
|
|
71
|
+
return [];
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=payload.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payload.js","sourceRoot":"","sources":["../../../src/action/payload.ts"],"names":[],"mappings":";;AAaA,oDAqBC;AAlCD,wCAAgF;AAChF,+BAAiC;AAEjC,4CAIqB;AAGrB,0CAAwC;AAGjC,KAAK,UAAU,oBAAoB,CACxC,OAA2B;IAE3B,MAAM,EAAE,MAAM,EAAE,iBAAiB,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,OAAO,CA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AA;QACX,CAAC;QAED,OAAO,MAAM,iBAAiB,CAAC,iBAAiB,CAAC,YAAY,CAAC,CAAA;IAChE,CAAC;IAAC,MAAM,CAAC;QACP,wDAAwD;QACxD,OAAO,EAAE,CAAA;IACX,CAAC;AACH,CAAC"}
|
package/lib/esm/api.d.ts
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { BotContext } from '@botonic/core';
|
|
2
|
+
import { type HtBotActionNode, type HtCaptureUserInputNode, type HtFlowBuilderData, type HtFlowWebview, type HtKeywordNode, type HtNodeComponent, type HtNodeLink, type HtNodeWithContent, type HtRatingButton, type HtRatingNode, type HtSmartIntentNode, type HtWhatsappRequestContactInfoNode } from './content-fields/hubtype-fields';
|
|
3
|
+
import { type FlowBuilderApiOptions } from './types';
|
|
4
|
+
export declare class FlowBuilderApi {
|
|
5
|
+
url: string;
|
|
6
|
+
flowUrl: string;
|
|
7
|
+
flow: HtFlowBuilderData;
|
|
8
|
+
botContext: BotContext;
|
|
9
|
+
private constructor();
|
|
10
|
+
static create(options: FlowBuilderApiOptions): Promise<FlowBuilderApi>;
|
|
11
|
+
private getFlow;
|
|
12
|
+
private updateSessionWithUserInfo;
|
|
13
|
+
getNodeByFlowId(id: string): HtNodeWithContent;
|
|
14
|
+
getNodeByCampaignId<T extends HtNodeComponent>(id: string): T;
|
|
15
|
+
getNodeById<T extends HtNodeComponent>(id: string): T;
|
|
16
|
+
getRatingNodeByButtonId(id: string): HtRatingNode;
|
|
17
|
+
getRatingButtonById(ratingNode: HtRatingNode, id: string): HtRatingButton;
|
|
18
|
+
getNodeByContentID(contentID: string): HtNodeComponent;
|
|
19
|
+
getStartNode(): HtNodeWithContent;
|
|
20
|
+
getFallbackNode(alternate: boolean): HtNodeWithContent;
|
|
21
|
+
getSmartIntentNodes(): HtSmartIntentNode[];
|
|
22
|
+
getKeywordNodes(): HtKeywordNode[];
|
|
23
|
+
getPayload(target?: HtNodeLink): string | undefined;
|
|
24
|
+
isBotAction(id: string): boolean;
|
|
25
|
+
private isUUID;
|
|
26
|
+
createPayloadWithParams(botActionNode: HtBotActionNode): string;
|
|
27
|
+
private getFollowUpContentID;
|
|
28
|
+
getFlowName(flowId: string): string;
|
|
29
|
+
getCampaignFlowName(campaignId: string): string;
|
|
30
|
+
getStartNodeAiAgentFlow(): HtNodeWithContent | undefined;
|
|
31
|
+
isAiAgentEnabled(): boolean;
|
|
32
|
+
getWebviewById(id: string): HtFlowWebview | undefined;
|
|
33
|
+
shouldCaptureUserInput(): boolean;
|
|
34
|
+
getCaptureUserInputId(): string | undefined;
|
|
35
|
+
setCaptureUserInputId(id: string): void;
|
|
36
|
+
removeCaptureUserInputId(): void;
|
|
37
|
+
setUserExtraDataVariable(key: string, value: string): void;
|
|
38
|
+
getCaptureUserInputNode(): HtCaptureUserInputNode | undefined;
|
|
39
|
+
getSessionWhatsappRequestContactId(): string | undefined;
|
|
40
|
+
setWhatsappRequestContactId(id: string): void;
|
|
41
|
+
removeWhatsappRequestContactId(): void;
|
|
42
|
+
getWhatsappRequestContactInfoNode(): HtWhatsappRequestContactInfoNode | undefined;
|
|
43
|
+
getResolvedLocale(): string;
|
|
44
|
+
isPushFlowPayload(payload?: string): boolean;
|
|
45
|
+
}
|
package/lib/esm/api.js
ADDED
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FlowBuilderApi = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const axios_1 = tslib_1.__importDefault(require("axios"));
|
|
6
|
+
const constants_1 = require("./constants");
|
|
7
|
+
const hubtype_fields_1 = require("./content-fields/hubtype-fields");
|
|
8
|
+
const types_1 = require("./types");
|
|
9
|
+
const flow_locale_1 = require("./utils/flow-locale");
|
|
10
|
+
class FlowBuilderApi {
|
|
11
|
+
constructor() { }
|
|
12
|
+
static async create(options) {
|
|
13
|
+
const newApi = new FlowBuilderApi();
|
|
14
|
+
newApi.url = options.url;
|
|
15
|
+
newApi.botContext = options.botContext;
|
|
16
|
+
// TODO: Refactor later to combine logic from `FlowBuilderApi.create`, `resolveFlowUrl` and `getAccessToken` to be in one place
|
|
17
|
+
if (process.env.NODE_ENV === types_1.ProcessEnvNodeEnvs.DEVELOPMENT) {
|
|
18
|
+
await newApi.updateSessionWithUserInfo(options.accessToken);
|
|
19
|
+
}
|
|
20
|
+
const updatedRequest = newApi.botContext;
|
|
21
|
+
newApi.flowUrl = options.flowUrl.replace('{bot_id}', updatedRequest.session.bot.id);
|
|
22
|
+
newApi.flow = options.flow ?? (await newApi.getFlow(options.accessToken));
|
|
23
|
+
return newApi;
|
|
24
|
+
}
|
|
25
|
+
async getFlow(token) {
|
|
26
|
+
const { data } = await axios_1.default.get(this.flowUrl, {
|
|
27
|
+
headers: { Authorization: `Bearer ${token}` },
|
|
28
|
+
});
|
|
29
|
+
return data;
|
|
30
|
+
}
|
|
31
|
+
async updateSessionWithUserInfo(token) {
|
|
32
|
+
const url = `${this.url}/v1/flow_builder/user_info/`;
|
|
33
|
+
const response = await axios_1.default.get(url, {
|
|
34
|
+
headers: { Authorization: `Bearer ${token}` },
|
|
35
|
+
});
|
|
36
|
+
this.botContext.session.organization_id = response.data.organization_id;
|
|
37
|
+
this.botContext.session.bot.id = response.data.bot_id;
|
|
38
|
+
}
|
|
39
|
+
getNodeByFlowId(id) {
|
|
40
|
+
const subFlow = this.flow.flows.find(subFlow => subFlow.id === id);
|
|
41
|
+
if (!subFlow) {
|
|
42
|
+
throw Error(`SubFlow with id: '${id}' not found`);
|
|
43
|
+
}
|
|
44
|
+
return this.getNodeById(subFlow.start_node_id);
|
|
45
|
+
}
|
|
46
|
+
getNodeByCampaignId(id) {
|
|
47
|
+
const campaign = this.flow.campaigns.find(campaign => campaign.id === id);
|
|
48
|
+
if (!campaign) {
|
|
49
|
+
throw Error(`Campaign with id: '${id}' not found`);
|
|
50
|
+
}
|
|
51
|
+
return this.getNodeById(campaign.start_node_id);
|
|
52
|
+
}
|
|
53
|
+
getNodeById(id) {
|
|
54
|
+
const node = this.flow.nodes.find(node => node.id === id);
|
|
55
|
+
if (!node) {
|
|
56
|
+
console.error(`Node with id: '${id}' not found`);
|
|
57
|
+
}
|
|
58
|
+
return node;
|
|
59
|
+
}
|
|
60
|
+
getRatingNodeByButtonId(id) {
|
|
61
|
+
const ratingNodes = this.flow.nodes.filter(node => node.type === hubtype_fields_1.HtNodeWithContentType.RATING);
|
|
62
|
+
const ratingNode = ratingNodes.find(node => node.content.buttons.some(button => button.id === id));
|
|
63
|
+
if (!ratingNode) {
|
|
64
|
+
throw Error(`Rating node with button id: '${id}' not found`);
|
|
65
|
+
}
|
|
66
|
+
return ratingNode;
|
|
67
|
+
}
|
|
68
|
+
getRatingButtonById(ratingNode, id) {
|
|
69
|
+
const ratingButton = ratingNode.content.buttons.find(button => button.id === id);
|
|
70
|
+
if (!ratingButton) {
|
|
71
|
+
throw Error(`Rating button with id: '${id}' not found`);
|
|
72
|
+
}
|
|
73
|
+
return ratingButton;
|
|
74
|
+
}
|
|
75
|
+
getNodeByContentID(contentID) {
|
|
76
|
+
const content = this.flow.nodes.find(node => 'code' in node ? node.code === contentID : false);
|
|
77
|
+
if (!content) {
|
|
78
|
+
throw Error(`Node with contentID: '${contentID}' not found`);
|
|
79
|
+
}
|
|
80
|
+
return content;
|
|
81
|
+
}
|
|
82
|
+
getStartNode() {
|
|
83
|
+
const startNodeId = this.flow.start_node_id;
|
|
84
|
+
if (!startNodeId) {
|
|
85
|
+
throw new Error('Start node id must be defined');
|
|
86
|
+
}
|
|
87
|
+
return this.getNodeById(startNodeId);
|
|
88
|
+
}
|
|
89
|
+
getFallbackNode(alternate) {
|
|
90
|
+
const fallbackNode = this.flow.nodes.find(node => node.type === hubtype_fields_1.HtNodeWithContentType.FALLBACK);
|
|
91
|
+
if (!fallbackNode) {
|
|
92
|
+
throw new Error('Fallback node must be defined');
|
|
93
|
+
}
|
|
94
|
+
const fallbackFirstMessage = fallbackNode.content.first_message;
|
|
95
|
+
if (!fallbackFirstMessage) {
|
|
96
|
+
throw new Error('Fallback 1st message must be defined');
|
|
97
|
+
}
|
|
98
|
+
const fallbackSecondMessage = fallbackNode.content.second_message;
|
|
99
|
+
if (!fallbackSecondMessage) {
|
|
100
|
+
return this.getNodeById(fallbackFirstMessage.id);
|
|
101
|
+
}
|
|
102
|
+
return alternate
|
|
103
|
+
? this.getNodeById(fallbackFirstMessage.id)
|
|
104
|
+
: this.getNodeById(fallbackSecondMessage.id);
|
|
105
|
+
}
|
|
106
|
+
getSmartIntentNodes() {
|
|
107
|
+
return this.flow.nodes.filter(node => node.type === hubtype_fields_1.HtNodeWithContentType.SMART_INTENT);
|
|
108
|
+
}
|
|
109
|
+
getKeywordNodes() {
|
|
110
|
+
return this.flow.nodes.filter(node => node.type === hubtype_fields_1.HtNodeWithContentType.KEYWORD);
|
|
111
|
+
}
|
|
112
|
+
getPayload(target) {
|
|
113
|
+
if (!target) {
|
|
114
|
+
return undefined;
|
|
115
|
+
}
|
|
116
|
+
return target.id;
|
|
117
|
+
}
|
|
118
|
+
isBotAction(id) {
|
|
119
|
+
if (!this.isUUID(id)) {
|
|
120
|
+
return false;
|
|
121
|
+
}
|
|
122
|
+
const node = this.getNodeById(id);
|
|
123
|
+
return node?.type === hubtype_fields_1.HtNodeWithContentType.BOT_ACTION;
|
|
124
|
+
}
|
|
125
|
+
isUUID(str) {
|
|
126
|
+
return constants_1.UUID_REGEXP.test(str);
|
|
127
|
+
}
|
|
128
|
+
createPayloadWithParams(botActionNode) {
|
|
129
|
+
const payloadId = botActionNode.content.payload_id;
|
|
130
|
+
const payloadNode = this.getNodeById(payloadId);
|
|
131
|
+
const customParams = JSON.parse(botActionNode.content.payload_params || '{}');
|
|
132
|
+
const contentID = botActionNode.code;
|
|
133
|
+
const followUpContentID = this.getFollowUpContentID(botActionNode.follow_up?.id);
|
|
134
|
+
const payloadParams = {
|
|
135
|
+
contentID,
|
|
136
|
+
followUpContentID,
|
|
137
|
+
};
|
|
138
|
+
const payloadJson = JSON.stringify({
|
|
139
|
+
...customParams,
|
|
140
|
+
...payloadParams,
|
|
141
|
+
});
|
|
142
|
+
return `${payloadNode.content.payload}${constants_1.SEPARATOR}${payloadJson}`;
|
|
143
|
+
}
|
|
144
|
+
getFollowUpContentID(id) {
|
|
145
|
+
const followUpNode = id
|
|
146
|
+
? this.getNodeById(id)
|
|
147
|
+
: undefined;
|
|
148
|
+
return followUpNode?.code;
|
|
149
|
+
}
|
|
150
|
+
getFlowName(flowId) {
|
|
151
|
+
const flow = this.flow.flows.find(flow => flow.id === flowId);
|
|
152
|
+
return flow ? flow.name : this.getCampaignFlowName(flowId);
|
|
153
|
+
}
|
|
154
|
+
getCampaignFlowName(campaignId) {
|
|
155
|
+
const campaign = this.flow.campaigns.find(campaign => campaign.id === campaignId);
|
|
156
|
+
return campaign ? campaign.name : '';
|
|
157
|
+
}
|
|
158
|
+
getStartNodeAiAgentFlow() {
|
|
159
|
+
const aiAgentFlow = this.flow.flows.find(flow => flow.name === constants_1.AI_AGENTS_FLOW_NAME);
|
|
160
|
+
if (!aiAgentFlow) {
|
|
161
|
+
return undefined;
|
|
162
|
+
}
|
|
163
|
+
return this.getNodeById(aiAgentFlow.start_node_id);
|
|
164
|
+
}
|
|
165
|
+
isAiAgentEnabled() {
|
|
166
|
+
return this.flow.is_ai_agent_active || false;
|
|
167
|
+
}
|
|
168
|
+
getWebviewById(id) {
|
|
169
|
+
return this.flow.webviews.find(webview => webview.id === id);
|
|
170
|
+
}
|
|
171
|
+
shouldCaptureUserInput() {
|
|
172
|
+
return !!this.getCaptureUserInputId();
|
|
173
|
+
}
|
|
174
|
+
getCaptureUserInputId() {
|
|
175
|
+
return this.botContext.session.capture_user_input?.node_id;
|
|
176
|
+
}
|
|
177
|
+
setCaptureUserInputId(id) {
|
|
178
|
+
if (this.botContext.session.capture_user_input) {
|
|
179
|
+
this.botContext.session.capture_user_input.node_id = id;
|
|
180
|
+
}
|
|
181
|
+
this.botContext.session.capture_user_input = { node_id: id };
|
|
182
|
+
}
|
|
183
|
+
removeCaptureUserInputId() {
|
|
184
|
+
this.botContext.session.capture_user_input = undefined;
|
|
185
|
+
}
|
|
186
|
+
setUserExtraDataVariable(key, value) {
|
|
187
|
+
if (this.botContext.session.user.extra_data) {
|
|
188
|
+
this.botContext.session.user.extra_data[key] = value;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
getCaptureUserInputNode() {
|
|
192
|
+
const captureUserInputId = this.getCaptureUserInputId();
|
|
193
|
+
if (!captureUserInputId) {
|
|
194
|
+
return undefined;
|
|
195
|
+
}
|
|
196
|
+
return this.getNodeById(captureUserInputId);
|
|
197
|
+
}
|
|
198
|
+
getSessionWhatsappRequestContactId() {
|
|
199
|
+
return this.botContext.session.whatsapp_request_contact?.id;
|
|
200
|
+
}
|
|
201
|
+
setWhatsappRequestContactId(id) {
|
|
202
|
+
if (this.botContext.session.whatsapp_request_contact) {
|
|
203
|
+
this.botContext.session.whatsapp_request_contact.id = id;
|
|
204
|
+
}
|
|
205
|
+
this.botContext.session.whatsapp_request_contact = { id };
|
|
206
|
+
}
|
|
207
|
+
removeWhatsappRequestContactId() {
|
|
208
|
+
this.botContext.session.whatsapp_request_contact = undefined;
|
|
209
|
+
}
|
|
210
|
+
getWhatsappRequestContactInfoNode() {
|
|
211
|
+
const whatsappRequestContactId = this.getSessionWhatsappRequestContactId();
|
|
212
|
+
if (!whatsappRequestContactId) {
|
|
213
|
+
return undefined;
|
|
214
|
+
}
|
|
215
|
+
return this.getNodeById(whatsappRequestContactId);
|
|
216
|
+
}
|
|
217
|
+
getResolvedLocale() {
|
|
218
|
+
const flowLocales = this.flow.locales;
|
|
219
|
+
const defaultLocaleCode = this.flow.default_locale_code;
|
|
220
|
+
return new flow_locale_1.FlowLocale(this.botContext, flowLocales, defaultLocaleCode).resolve();
|
|
221
|
+
}
|
|
222
|
+
isPushFlowPayload(payload) {
|
|
223
|
+
return payload?.startsWith(constants_1.PUSH_FLOW_PAYLOAD) ?? false;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
exports.FlowBuilderApi = FlowBuilderApi;
|
|
227
|
+
//# sourceMappingURL=api.js.map
|