@botonic/plugin-flow-builder 0.57.0-rslib-esm.0 → 0.57.0-rslib-esm.1
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/action/ai-agent-from-user-input.js.map +1 -0
- package/lib/action/context.js.map +1 -0
- package/lib/action/fallback.js.map +1 -0
- package/lib/action/first-interaction.js.map +1 -0
- package/lib/action/get-contents.js.map +1 -0
- package/lib/action/index.js.map +1 -0
- package/lib/action/payload.js.map +1 -0
- package/lib/api.js.map +1 -0
- package/lib/constants.js.map +1 -0
- package/lib/content-fields/content-fields-base.js.map +1 -0
- package/lib/content-fields/custom-conditional/custom-conditional-v2-evaluators.js.map +1 -0
- package/lib/content-fields/custom-conditional/custom-conditional-v2-resolver.js.map +1 -0
- package/lib/{esm/content-fields → content-fields}/custom-conditional/flow-custom-condition-v2.d.ts +1 -1
- package/lib/content-fields/custom-conditional/flow-custom-condition-v2.js.map +1 -0
- package/lib/content-fields/flow-ai-agent-base.js.map +1 -0
- package/lib/content-fields/flow-ai-agent-router.js.map +1 -0
- package/lib/content-fields/flow-ai-agent.js.map +1 -0
- package/lib/content-fields/flow-bot-action.js.map +1 -0
- package/lib/content-fields/flow-button.js.map +1 -0
- package/lib/content-fields/flow-capture-user-input.js.map +1 -0
- package/lib/content-fields/flow-carousel.js.map +1 -0
- package/lib/content-fields/flow-channel-conditional.js.map +1 -0
- package/lib/content-fields/flow-country-conditional.js.map +1 -0
- package/lib/{esm/content-fields → content-fields}/flow-custom-conditional.d.ts +1 -1
- package/lib/content-fields/flow-custom-conditional.js.map +1 -0
- package/lib/content-fields/flow-element.js.map +1 -0
- package/lib/content-fields/flow-go-to-flow.js.map +1 -0
- package/lib/content-fields/flow-handoff.js.map +1 -0
- package/lib/content-fields/flow-image.js.map +1 -0
- package/lib/content-fields/flow-queue-status-conditional.js.map +1 -0
- package/lib/content-fields/flow-rating.js.map +1 -0
- package/lib/content-fields/flow-text.js.map +1 -0
- package/lib/content-fields/flow-video.js.map +1 -0
- package/lib/content-fields/flow-webview.js.map +1 -0
- package/lib/content-fields/flow-whatsapp-cta-url-button.js.map +1 -0
- package/lib/content-fields/flow-whatsapp-request-contact-info.js.map +1 -0
- package/lib/content-fields/flow-whatsapp-template.js.map +1 -0
- package/lib/content-fields/hubtype-fields/ai-agent-router.js.map +1 -0
- package/lib/content-fields/hubtype-fields/ai-agent.js.map +1 -0
- package/lib/content-fields/hubtype-fields/bot-action.js.map +1 -0
- package/lib/content-fields/hubtype-fields/button.js.map +1 -0
- package/lib/content-fields/hubtype-fields/capture-user-input.js.map +1 -0
- package/lib/content-fields/hubtype-fields/carousel.js.map +1 -0
- package/lib/content-fields/hubtype-fields/channel-conditional.js.map +1 -0
- package/lib/content-fields/hubtype-fields/common.js.map +1 -0
- package/lib/content-fields/hubtype-fields/country-conditional.js.map +1 -0
- package/lib/content-fields/hubtype-fields/custom-conditional-v2.js.map +1 -0
- package/lib/content-fields/hubtype-fields/custom-conditional.js.map +1 -0
- package/lib/content-fields/hubtype-fields/fallback.js.map +1 -0
- package/lib/content-fields/hubtype-fields/function.js.map +1 -0
- package/lib/content-fields/hubtype-fields/go-to-flow.js.map +1 -0
- package/lib/content-fields/hubtype-fields/handoff.js.map +1 -0
- package/lib/content-fields/hubtype-fields/image.js.map +1 -0
- package/lib/content-fields/hubtype-fields/index.js.map +1 -0
- package/lib/content-fields/hubtype-fields/keyword.js.map +1 -0
- package/lib/content-fields/hubtype-fields/node-types.js.map +1 -0
- package/lib/content-fields/hubtype-fields/nodes.js.map +1 -0
- package/lib/content-fields/hubtype-fields/payload.js.map +1 -0
- package/lib/content-fields/hubtype-fields/queue-status-conditional.js.map +1 -0
- package/lib/content-fields/hubtype-fields/rating.js.map +1 -0
- package/lib/content-fields/hubtype-fields/smart-intent.js.map +1 -0
- package/lib/content-fields/hubtype-fields/text.js.map +1 -0
- package/lib/content-fields/hubtype-fields/url.js.map +1 -0
- package/lib/content-fields/hubtype-fields/video.js.map +1 -0
- package/lib/content-fields/hubtype-fields/webview.js.map +1 -0
- package/lib/content-fields/hubtype-fields/whatsapp-button-list.js.map +1 -0
- package/lib/content-fields/hubtype-fields/whatsapp-cta-url-button.js.map +1 -0
- package/lib/content-fields/hubtype-fields/whatsapp-request-contact-info.js.map +1 -0
- package/lib/content-fields/hubtype-fields/whatsapp-template.js.map +1 -0
- package/lib/{esm/content-fields → content-fields}/index.d.ts +1 -1
- package/lib/content-fields/index.js.map +1 -0
- package/lib/content-fields/whatsapp-button-list/flow-whatsapp-button-list-row.js.map +1 -0
- package/lib/content-fields/whatsapp-button-list/flow-whatsapp-button-list-section.js.map +1 -0
- package/lib/content-fields/whatsapp-button-list/flow-whatsapp-button-list.js.map +1 -0
- package/lib/content-fields/whatsapp-button-list/index.js.map +1 -0
- package/lib/filters/index.js.map +1 -0
- package/lib/flow-factory.js.map +1 -0
- package/lib/functions/index.js.map +1 -0
- package/lib/index.js.map +1 -0
- package/lib/services/hubtype-queues-api.js.map +1 -0
- package/lib/structured-output/flow-builder-content.js.map +1 -0
- package/lib/tracking.js.map +1 -0
- package/lib/types.js.map +1 -0
- package/lib/user-input/capture-user-input-api.js.map +1 -0
- package/lib/user-input/index.js.map +1 -0
- package/lib/user-input/keyword.js.map +1 -0
- package/lib/user-input/smart-intent.js.map +1 -0
- package/lib/utils/ai-agent.js.map +1 -0
- package/lib/utils/authentication.js.map +1 -0
- package/lib/utils/flow-locale.js.map +1 -0
- package/lib/utils/get-flow-builder-plugin.js.map +1 -0
- package/lib/utils/hubtype-assistant-content.js.map +1 -0
- package/lib/utils/input.js.map +1 -0
- package/lib/webview/contents-context.js.map +1 -0
- package/lib/webview/index.js.map +1 -0
- package/lib/webview/types.js.map +1 -0
- package/lib/webview/use-webview-contents.js.map +1 -0
- package/package.json +8 -7
- package/src/content-fields/index.ts +2 -2
- package/lib/esm/action/ai-agent-from-user-input.js.map +0 -1
- package/lib/esm/action/context.js.map +0 -1
- package/lib/esm/action/fallback.js.map +0 -1
- package/lib/esm/action/first-interaction.js.map +0 -1
- package/lib/esm/action/get-contents.js.map +0 -1
- package/lib/esm/action/index.js.map +0 -1
- package/lib/esm/action/payload.js.map +0 -1
- package/lib/esm/api.js.map +0 -1
- package/lib/esm/constants.js.map +0 -1
- package/lib/esm/content-fields/content-fields-base.js.map +0 -1
- package/lib/esm/content-fields/custom-conditional/custom-conditional-v2-evaluators.js.map +0 -1
- package/lib/esm/content-fields/custom-conditional/custom-conditional-v2-resolver.js.map +0 -1
- package/lib/esm/content-fields/custom-conditional/flow-custom-condition-v2.js.map +0 -1
- package/lib/esm/content-fields/flow-ai-agent-base.js.map +0 -1
- package/lib/esm/content-fields/flow-ai-agent-router.js.map +0 -1
- package/lib/esm/content-fields/flow-ai-agent.js.map +0 -1
- package/lib/esm/content-fields/flow-bot-action.js.map +0 -1
- package/lib/esm/content-fields/flow-button.js.map +0 -1
- package/lib/esm/content-fields/flow-capture-user-input.js.map +0 -1
- package/lib/esm/content-fields/flow-carousel.js.map +0 -1
- package/lib/esm/content-fields/flow-channel-conditional.js.map +0 -1
- package/lib/esm/content-fields/flow-country-conditional.js.map +0 -1
- package/lib/esm/content-fields/flow-custom-conditional.js.map +0 -1
- package/lib/esm/content-fields/flow-element.js.map +0 -1
- package/lib/esm/content-fields/flow-go-to-flow.js.map +0 -1
- package/lib/esm/content-fields/flow-handoff.js.map +0 -1
- package/lib/esm/content-fields/flow-image.js.map +0 -1
- package/lib/esm/content-fields/flow-queue-status-conditional.js.map +0 -1
- package/lib/esm/content-fields/flow-rating.js.map +0 -1
- package/lib/esm/content-fields/flow-text.js.map +0 -1
- package/lib/esm/content-fields/flow-video.js.map +0 -1
- package/lib/esm/content-fields/flow-webview.js.map +0 -1
- package/lib/esm/content-fields/flow-whatsapp-cta-url-button.js.map +0 -1
- package/lib/esm/content-fields/flow-whatsapp-request-contact-info.js.map +0 -1
- package/lib/esm/content-fields/flow-whatsapp-template.js.map +0 -1
- package/lib/esm/content-fields/hubtype-fields/ai-agent-router.js.map +0 -1
- package/lib/esm/content-fields/hubtype-fields/ai-agent.js.map +0 -1
- package/lib/esm/content-fields/hubtype-fields/bot-action.js.map +0 -1
- package/lib/esm/content-fields/hubtype-fields/button.js.map +0 -1
- package/lib/esm/content-fields/hubtype-fields/capture-user-input.js.map +0 -1
- package/lib/esm/content-fields/hubtype-fields/carousel.js.map +0 -1
- package/lib/esm/content-fields/hubtype-fields/channel-conditional.js.map +0 -1
- package/lib/esm/content-fields/hubtype-fields/common.js.map +0 -1
- package/lib/esm/content-fields/hubtype-fields/country-conditional.js.map +0 -1
- package/lib/esm/content-fields/hubtype-fields/custom-conditional-v2.js.map +0 -1
- package/lib/esm/content-fields/hubtype-fields/custom-conditional.js.map +0 -1
- package/lib/esm/content-fields/hubtype-fields/fallback.js.map +0 -1
- package/lib/esm/content-fields/hubtype-fields/function.js.map +0 -1
- package/lib/esm/content-fields/hubtype-fields/go-to-flow.js.map +0 -1
- package/lib/esm/content-fields/hubtype-fields/handoff.js.map +0 -1
- package/lib/esm/content-fields/hubtype-fields/image.js.map +0 -1
- package/lib/esm/content-fields/hubtype-fields/index.js.map +0 -1
- package/lib/esm/content-fields/hubtype-fields/keyword.js.map +0 -1
- package/lib/esm/content-fields/hubtype-fields/node-types.js.map +0 -1
- package/lib/esm/content-fields/hubtype-fields/nodes.js.map +0 -1
- package/lib/esm/content-fields/hubtype-fields/payload.js.map +0 -1
- package/lib/esm/content-fields/hubtype-fields/queue-status-conditional.js.map +0 -1
- package/lib/esm/content-fields/hubtype-fields/rating.js.map +0 -1
- package/lib/esm/content-fields/hubtype-fields/smart-intent.js.map +0 -1
- package/lib/esm/content-fields/hubtype-fields/text.js.map +0 -1
- package/lib/esm/content-fields/hubtype-fields/url.js.map +0 -1
- package/lib/esm/content-fields/hubtype-fields/video.js.map +0 -1
- package/lib/esm/content-fields/hubtype-fields/webview.js.map +0 -1
- package/lib/esm/content-fields/hubtype-fields/whatsapp-button-list.js.map +0 -1
- package/lib/esm/content-fields/hubtype-fields/whatsapp-cta-url-button.js.map +0 -1
- package/lib/esm/content-fields/hubtype-fields/whatsapp-request-contact-info.js.map +0 -1
- package/lib/esm/content-fields/hubtype-fields/whatsapp-template.js.map +0 -1
- package/lib/esm/content-fields/index.js.map +0 -1
- package/lib/esm/content-fields/whatsapp-button-list/flow-whatsapp-button-list-row.js.map +0 -1
- package/lib/esm/content-fields/whatsapp-button-list/flow-whatsapp-button-list-section.js.map +0 -1
- package/lib/esm/content-fields/whatsapp-button-list/flow-whatsapp-button-list.js.map +0 -1
- package/lib/esm/content-fields/whatsapp-button-list/index.js.map +0 -1
- package/lib/esm/filters/index.js.map +0 -1
- package/lib/esm/flow-factory.js.map +0 -1
- package/lib/esm/functions/index.js.map +0 -1
- package/lib/esm/index.js.map +0 -1
- package/lib/esm/package.json +0 -3
- package/lib/esm/services/hubtype-queues-api.js.map +0 -1
- package/lib/esm/structured-output/flow-builder-content.js.map +0 -1
- package/lib/esm/tracking.js.map +0 -1
- package/lib/esm/types.js.map +0 -1
- package/lib/esm/user-input/capture-user-input-api.js.map +0 -1
- package/lib/esm/user-input/index.js.map +0 -1
- package/lib/esm/user-input/keyword.js.map +0 -1
- package/lib/esm/user-input/smart-intent.js.map +0 -1
- package/lib/esm/utils/ai-agent.js.map +0 -1
- package/lib/esm/utils/authentication.js.map +0 -1
- package/lib/esm/utils/flow-locale.js.map +0 -1
- package/lib/esm/utils/get-flow-builder-plugin.js.map +0 -1
- package/lib/esm/utils/hubtype-assistant-content.js.map +0 -1
- package/lib/esm/utils/input.js.map +0 -1
- package/lib/esm/webview/contents-context.js.map +0 -1
- package/lib/esm/webview/index.js.map +0 -1
- package/lib/esm/webview/types.js.map +0 -1
- package/lib/esm/webview/use-webview-contents.js.map +0 -1
- /package/lib/{esm/action → action}/ai-agent-from-user-input.d.ts +0 -0
- /package/lib/{esm/action → action}/ai-agent-from-user-input.js +0 -0
- /package/lib/{esm/action → action}/context.d.ts +0 -0
- /package/lib/{esm/action → action}/context.js +0 -0
- /package/lib/{esm/action → action}/fallback.d.ts +0 -0
- /package/lib/{esm/action → action}/fallback.js +0 -0
- /package/lib/{esm/action → action}/first-interaction.d.ts +0 -0
- /package/lib/{esm/action → action}/first-interaction.js +0 -0
- /package/lib/{esm/action → action}/get-contents.d.ts +0 -0
- /package/lib/{esm/action → action}/get-contents.js +0 -0
- /package/lib/{esm/action → action}/index.d.ts +0 -0
- /package/lib/{esm/action → action}/index.js +0 -0
- /package/lib/{esm/action → action}/payload.d.ts +0 -0
- /package/lib/{esm/action → action}/payload.js +0 -0
- /package/lib/{esm/api.d.ts → api.d.ts} +0 -0
- /package/lib/{esm/api.js → api.js} +0 -0
- /package/lib/{esm/constants.d.ts → constants.d.ts} +0 -0
- /package/lib/{esm/constants.js → constants.js} +0 -0
- /package/lib/{esm/content-fields → content-fields}/content-fields-base.d.ts +0 -0
- /package/lib/{esm/content-fields → content-fields}/content-fields-base.js +0 -0
- /package/lib/{esm/content-fields → content-fields}/custom-conditional/custom-conditional-v2-evaluators.d.ts +0 -0
- /package/lib/{esm/content-fields → content-fields}/custom-conditional/custom-conditional-v2-evaluators.js +0 -0
- /package/lib/{esm/content-fields → content-fields}/custom-conditional/custom-conditional-v2-resolver.d.ts +0 -0
- /package/lib/{esm/content-fields → content-fields}/custom-conditional/custom-conditional-v2-resolver.js +0 -0
- /package/lib/{esm/content-fields → content-fields}/custom-conditional/flow-custom-condition-v2.js +0 -0
- /package/lib/{esm/content-fields → content-fields}/flow-ai-agent-base.d.ts +0 -0
- /package/lib/{esm/content-fields → content-fields}/flow-ai-agent-base.js +0 -0
- /package/lib/{esm/content-fields → content-fields}/flow-ai-agent-router.d.ts +0 -0
- /package/lib/{esm/content-fields → content-fields}/flow-ai-agent-router.js +0 -0
- /package/lib/{esm/content-fields → content-fields}/flow-ai-agent.d.ts +0 -0
- /package/lib/{esm/content-fields → content-fields}/flow-ai-agent.js +0 -0
- /package/lib/{esm/content-fields → content-fields}/flow-bot-action.d.ts +0 -0
- /package/lib/{esm/content-fields → content-fields}/flow-bot-action.js +0 -0
- /package/lib/{esm/content-fields → content-fields}/flow-button.d.ts +0 -0
- /package/lib/{esm/content-fields → content-fields}/flow-button.js +0 -0
- /package/lib/{esm/content-fields → content-fields}/flow-capture-user-input.d.ts +0 -0
- /package/lib/{esm/content-fields → content-fields}/flow-capture-user-input.js +0 -0
- /package/lib/{esm/content-fields → content-fields}/flow-carousel.d.ts +0 -0
- /package/lib/{esm/content-fields → content-fields}/flow-carousel.js +0 -0
- /package/lib/{esm/content-fields → content-fields}/flow-channel-conditional.d.ts +0 -0
- /package/lib/{esm/content-fields → content-fields}/flow-channel-conditional.js +0 -0
- /package/lib/{esm/content-fields → content-fields}/flow-country-conditional.d.ts +0 -0
- /package/lib/{esm/content-fields → content-fields}/flow-country-conditional.js +0 -0
- /package/lib/{esm/content-fields → content-fields}/flow-custom-conditional.js +0 -0
- /package/lib/{esm/content-fields → content-fields}/flow-element.d.ts +0 -0
- /package/lib/{esm/content-fields → content-fields}/flow-element.js +0 -0
- /package/lib/{esm/content-fields → content-fields}/flow-go-to-flow.d.ts +0 -0
- /package/lib/{esm/content-fields → content-fields}/flow-go-to-flow.js +0 -0
- /package/lib/{esm/content-fields → content-fields}/flow-handoff.d.ts +0 -0
- /package/lib/{esm/content-fields → content-fields}/flow-handoff.js +0 -0
- /package/lib/{esm/content-fields → content-fields}/flow-image.d.ts +0 -0
- /package/lib/{esm/content-fields → content-fields}/flow-image.js +0 -0
- /package/lib/{esm/content-fields → content-fields}/flow-queue-status-conditional.d.ts +0 -0
- /package/lib/{esm/content-fields → content-fields}/flow-queue-status-conditional.js +0 -0
- /package/lib/{esm/content-fields → content-fields}/flow-rating.d.ts +0 -0
- /package/lib/{esm/content-fields → content-fields}/flow-rating.js +0 -0
- /package/lib/{esm/content-fields → content-fields}/flow-text.d.ts +0 -0
- /package/lib/{esm/content-fields → content-fields}/flow-text.js +0 -0
- /package/lib/{esm/content-fields → content-fields}/flow-video.d.ts +0 -0
- /package/lib/{esm/content-fields → content-fields}/flow-video.js +0 -0
- /package/lib/{esm/content-fields → content-fields}/flow-webview.d.ts +0 -0
- /package/lib/{esm/content-fields → content-fields}/flow-webview.js +0 -0
- /package/lib/{esm/content-fields → content-fields}/flow-whatsapp-cta-url-button.d.ts +0 -0
- /package/lib/{esm/content-fields → content-fields}/flow-whatsapp-cta-url-button.js +0 -0
- /package/lib/{esm/content-fields → content-fields}/flow-whatsapp-request-contact-info.d.ts +0 -0
- /package/lib/{esm/content-fields → content-fields}/flow-whatsapp-request-contact-info.js +0 -0
- /package/lib/{esm/content-fields → content-fields}/flow-whatsapp-template.d.ts +0 -0
- /package/lib/{esm/content-fields → content-fields}/flow-whatsapp-template.js +0 -0
- /package/lib/{esm/content-fields → content-fields}/hubtype-fields/ai-agent-router.d.ts +0 -0
- /package/lib/{esm/content-fields → content-fields}/hubtype-fields/ai-agent-router.js +0 -0
- /package/lib/{esm/content-fields → content-fields}/hubtype-fields/ai-agent.d.ts +0 -0
- /package/lib/{esm/content-fields → content-fields}/hubtype-fields/ai-agent.js +0 -0
- /package/lib/{esm/content-fields → content-fields}/hubtype-fields/bot-action.d.ts +0 -0
- /package/lib/{esm/content-fields → content-fields}/hubtype-fields/bot-action.js +0 -0
- /package/lib/{esm/content-fields → content-fields}/hubtype-fields/button.d.ts +0 -0
- /package/lib/{esm/content-fields → content-fields}/hubtype-fields/button.js +0 -0
- /package/lib/{esm/content-fields → content-fields}/hubtype-fields/capture-user-input.d.ts +0 -0
- /package/lib/{esm/content-fields → content-fields}/hubtype-fields/capture-user-input.js +0 -0
- /package/lib/{esm/content-fields → content-fields}/hubtype-fields/carousel.d.ts +0 -0
- /package/lib/{esm/content-fields → content-fields}/hubtype-fields/carousel.js +0 -0
- /package/lib/{esm/content-fields → content-fields}/hubtype-fields/channel-conditional.d.ts +0 -0
- /package/lib/{esm/content-fields → content-fields}/hubtype-fields/channel-conditional.js +0 -0
- /package/lib/{esm/content-fields → content-fields}/hubtype-fields/common.d.ts +0 -0
- /package/lib/{esm/content-fields → content-fields}/hubtype-fields/common.js +0 -0
- /package/lib/{esm/content-fields → content-fields}/hubtype-fields/country-conditional.d.ts +0 -0
- /package/lib/{esm/content-fields → content-fields}/hubtype-fields/country-conditional.js +0 -0
- /package/lib/{esm/content-fields → content-fields}/hubtype-fields/custom-conditional-v2.d.ts +0 -0
- /package/lib/{esm/content-fields → content-fields}/hubtype-fields/custom-conditional-v2.js +0 -0
- /package/lib/{esm/content-fields → content-fields}/hubtype-fields/custom-conditional.d.ts +0 -0
- /package/lib/{esm/content-fields → content-fields}/hubtype-fields/custom-conditional.js +0 -0
- /package/lib/{esm/content-fields → content-fields}/hubtype-fields/fallback.d.ts +0 -0
- /package/lib/{esm/content-fields → content-fields}/hubtype-fields/fallback.js +0 -0
- /package/lib/{esm/content-fields → content-fields}/hubtype-fields/function.d.ts +0 -0
- /package/lib/{esm/content-fields → content-fields}/hubtype-fields/function.js +0 -0
- /package/lib/{esm/content-fields → content-fields}/hubtype-fields/go-to-flow.d.ts +0 -0
- /package/lib/{esm/content-fields → content-fields}/hubtype-fields/go-to-flow.js +0 -0
- /package/lib/{esm/content-fields → content-fields}/hubtype-fields/handoff.d.ts +0 -0
- /package/lib/{esm/content-fields → content-fields}/hubtype-fields/handoff.js +0 -0
- /package/lib/{esm/content-fields → content-fields}/hubtype-fields/image.d.ts +0 -0
- /package/lib/{esm/content-fields → content-fields}/hubtype-fields/image.js +0 -0
- /package/lib/{esm/content-fields → content-fields}/hubtype-fields/index.d.ts +0 -0
- /package/lib/{esm/content-fields → content-fields}/hubtype-fields/index.js +0 -0
- /package/lib/{esm/content-fields → content-fields}/hubtype-fields/keyword.d.ts +0 -0
- /package/lib/{esm/content-fields → content-fields}/hubtype-fields/keyword.js +0 -0
- /package/lib/{esm/content-fields → content-fields}/hubtype-fields/node-types.d.ts +0 -0
- /package/lib/{esm/content-fields → content-fields}/hubtype-fields/node-types.js +0 -0
- /package/lib/{esm/content-fields → content-fields}/hubtype-fields/nodes.d.ts +0 -0
- /package/lib/{esm/content-fields → content-fields}/hubtype-fields/nodes.js +0 -0
- /package/lib/{esm/content-fields → content-fields}/hubtype-fields/payload.d.ts +0 -0
- /package/lib/{esm/content-fields → content-fields}/hubtype-fields/payload.js +0 -0
- /package/lib/{esm/content-fields → content-fields}/hubtype-fields/queue-status-conditional.d.ts +0 -0
- /package/lib/{esm/content-fields → content-fields}/hubtype-fields/queue-status-conditional.js +0 -0
- /package/lib/{esm/content-fields → content-fields}/hubtype-fields/rating.d.ts +0 -0
- /package/lib/{esm/content-fields → content-fields}/hubtype-fields/rating.js +0 -0
- /package/lib/{esm/content-fields → content-fields}/hubtype-fields/smart-intent.d.ts +0 -0
- /package/lib/{esm/content-fields → content-fields}/hubtype-fields/smart-intent.js +0 -0
- /package/lib/{esm/content-fields → content-fields}/hubtype-fields/text.d.ts +0 -0
- /package/lib/{esm/content-fields → content-fields}/hubtype-fields/text.js +0 -0
- /package/lib/{esm/content-fields → content-fields}/hubtype-fields/url.d.ts +0 -0
- /package/lib/{esm/content-fields → content-fields}/hubtype-fields/url.js +0 -0
- /package/lib/{esm/content-fields → content-fields}/hubtype-fields/video.d.ts +0 -0
- /package/lib/{esm/content-fields → content-fields}/hubtype-fields/video.js +0 -0
- /package/lib/{esm/content-fields → content-fields}/hubtype-fields/webview.d.ts +0 -0
- /package/lib/{esm/content-fields → content-fields}/hubtype-fields/webview.js +0 -0
- /package/lib/{esm/content-fields → content-fields}/hubtype-fields/whatsapp-button-list.d.ts +0 -0
- /package/lib/{esm/content-fields → content-fields}/hubtype-fields/whatsapp-button-list.js +0 -0
- /package/lib/{esm/content-fields → content-fields}/hubtype-fields/whatsapp-cta-url-button.d.ts +0 -0
- /package/lib/{esm/content-fields → content-fields}/hubtype-fields/whatsapp-cta-url-button.js +0 -0
- /package/lib/{esm/content-fields → content-fields}/hubtype-fields/whatsapp-request-contact-info.d.ts +0 -0
- /package/lib/{esm/content-fields → content-fields}/hubtype-fields/whatsapp-request-contact-info.js +0 -0
- /package/lib/{esm/content-fields → content-fields}/hubtype-fields/whatsapp-template.d.ts +0 -0
- /package/lib/{esm/content-fields → content-fields}/hubtype-fields/whatsapp-template.js +0 -0
- /package/lib/{esm/content-fields → content-fields}/index.js +0 -0
- /package/lib/{esm/content-fields → content-fields}/whatsapp-button-list/flow-whatsapp-button-list-row.d.ts +0 -0
- /package/lib/{esm/content-fields → content-fields}/whatsapp-button-list/flow-whatsapp-button-list-row.js +0 -0
- /package/lib/{esm/content-fields → content-fields}/whatsapp-button-list/flow-whatsapp-button-list-section.d.ts +0 -0
- /package/lib/{esm/content-fields → content-fields}/whatsapp-button-list/flow-whatsapp-button-list-section.js +0 -0
- /package/lib/{esm/content-fields → content-fields}/whatsapp-button-list/flow-whatsapp-button-list.d.ts +0 -0
- /package/lib/{esm/content-fields → content-fields}/whatsapp-button-list/flow-whatsapp-button-list.js +0 -0
- /package/lib/{esm/content-fields → content-fields}/whatsapp-button-list/index.d.ts +0 -0
- /package/lib/{esm/content-fields → content-fields}/whatsapp-button-list/index.js +0 -0
- /package/lib/{esm/filters → filters}/index.d.ts +0 -0
- /package/lib/{esm/filters → filters}/index.js +0 -0
- /package/lib/{esm/flow-factory.d.ts → flow-factory.d.ts} +0 -0
- /package/lib/{esm/flow-factory.js → flow-factory.js} +0 -0
- /package/lib/{esm/functions → functions}/index.d.ts +0 -0
- /package/lib/{esm/functions → functions}/index.js +0 -0
- /package/lib/{esm/index.d.ts → index.d.ts} +0 -0
- /package/lib/{esm/index.js → index.js} +0 -0
- /package/lib/{esm/services → services}/hubtype-queues-api.d.ts +0 -0
- /package/lib/{esm/services → services}/hubtype-queues-api.js +0 -0
- /package/lib/{esm/structured-output → structured-output}/flow-builder-content.d.ts +0 -0
- /package/lib/{esm/structured-output → structured-output}/flow-builder-content.js +0 -0
- /package/lib/{esm/tracking.d.ts → tracking.d.ts} +0 -0
- /package/lib/{esm/tracking.js → tracking.js} +0 -0
- /package/lib/{esm/types.d.ts → types.d.ts} +0 -0
- /package/lib/{esm/types.js → types.js} +0 -0
- /package/lib/{esm/user-input → user-input}/capture-user-input-api.d.ts +0 -0
- /package/lib/{esm/user-input → user-input}/capture-user-input-api.js +0 -0
- /package/lib/{esm/user-input → user-input}/index.d.ts +0 -0
- /package/lib/{esm/user-input → user-input}/index.js +0 -0
- /package/lib/{esm/user-input → user-input}/keyword.d.ts +0 -0
- /package/lib/{esm/user-input → user-input}/keyword.js +0 -0
- /package/lib/{esm/user-input → user-input}/smart-intent.d.ts +0 -0
- /package/lib/{esm/user-input → user-input}/smart-intent.js +0 -0
- /package/lib/{esm/utils → utils}/ai-agent.d.ts +0 -0
- /package/lib/{esm/utils → utils}/ai-agent.js +0 -0
- /package/lib/{esm/utils → utils}/authentication.d.ts +0 -0
- /package/lib/{esm/utils → utils}/authentication.js +0 -0
- /package/lib/{esm/utils → utils}/flow-locale.d.ts +0 -0
- /package/lib/{esm/utils → utils}/flow-locale.js +0 -0
- /package/lib/{esm/utils → utils}/get-flow-builder-plugin.d.ts +0 -0
- /package/lib/{esm/utils → utils}/get-flow-builder-plugin.js +0 -0
- /package/lib/{esm/utils → utils}/hubtype-assistant-content.d.ts +0 -0
- /package/lib/{esm/utils → utils}/hubtype-assistant-content.js +0 -0
- /package/lib/{esm/utils → utils}/input.d.ts +0 -0
- /package/lib/{esm/utils → utils}/input.js +0 -0
- /package/lib/{esm/webview → webview}/contents-context.d.ts +0 -0
- /package/lib/{esm/webview → webview}/contents-context.js +0 -0
- /package/lib/{esm/webview → webview}/index.d.ts +0 -0
- /package/lib/{esm/webview → webview}/index.js +0 -0
- /package/lib/{esm/webview → webview}/types.d.ts +0 -0
- /package/lib/{esm/webview → webview}/types.js +0 -0
- /package/lib/{esm/webview → webview}/use-webview-contents.d.ts +0 -0
- /package/lib/{esm/webview → webview}/use-webview-contents.js +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"content-fields/flow-image.js","sources":["../../../src/content-fields/flow-image.tsx"],"sourcesContent":["import type { BotContext } from '@botonic/core'\nimport { Image } from '@botonic/react'\n\nimport { trackOneContent } from '../tracking'\nimport { ContentFieldsBase } from './content-fields-base'\nimport type { HtImageNode } from './hubtype-fields'\n\nexport class FlowImage extends ContentFieldsBase {\n public src = ''\n\n static fromHubtypeCMS(component: HtImageNode, locale: string): FlowImage {\n const newImage = new FlowImage(component.id)\n newImage.code = component.code\n newImage.src = FlowImage.getAssetByLocale(locale, component.content.image)\n newImage.followUp = component.follow_up\n\n return newImage\n }\n\n async trackFlow(botContext: BotContext): Promise<void> {\n await trackOneContent(botContext, this)\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(): JSX.Element {\n return <Image key={this.id} src={this.src} />\n }\n}\n"],"names":["Image","trackOneContent","ContentFieldsBase","FlowImage","component","locale","newImage","botContext"],"mappings":";;;;;;;;;;AACsC;AAEO;AACY;AAGlD,MAAMG,SAASA,SAASD,iBAAiBA;IAG9C,OAAO,eAAeE,SAAsB,EAAEC,MAAc,EAAa;QACvE,MAAMC,WAAW,IAAIH,SAASA,CAACC,UAAU,EAAE;QAC3CE,SAAS,IAAI,GAAGF,UAAU,IAAI;QAC9BE,SAAS,GAAG,GAAGH,SAASA,CAAC,gBAAgB,CAACE,QAAQD,UAAU,OAAO,CAAC,KAAK;QACzEE,SAAS,QAAQ,GAAGF,UAAU,SAAS;QAEvC,OAAOE;IACT;IAEA,MAAM,UAAUC,UAAsB,EAAiB;QACrD,MAAMN,eAAeA,CAACM,YAAY,IAAI;IACxC;IAEA,MAAM,eAAeA,UAAsB,EAAiB;QAC1D,MAAM,IAAI,CAAC,aAAa,CAACA,YAAY,IAAI;QACzC,MAAM,IAAI,CAAC,SAAS,CAACA;QACrB;IACF;IAEA,YAAyB;QACvB,qBAAO,IAACP,KAAKA;YAAe,KAAK,IAAI,CAAC,GAAG;WAAtB,IAAI,CAAC,EAAE;IAC5B;;QAxBK,qBACE,MAAM;;AAwBf"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"content-fields/flow-queue-status-conditional.js","sources":["../../../src/content-fields/flow-queue-status-conditional.tsx"],"sourcesContent":["import {\n type BotContext,\n EventAction,\n type EventConditionalQueueStatus,\n} from '@botonic/core'\n\nimport { getArgumentsByLocale } from '../functions'\nimport { HubtypeQueuesApi } from '../services/hubtype-queues-api'\nimport {\n getCommonFlowContentEventArgsForContentId,\n trackEvent,\n} from '../tracking'\nimport { ContentFieldsBase } from './content-fields-base'\nimport type {\n HtFunctionArguments,\n HtFunctionResult,\n} from './hubtype-fields/function'\nimport type {\n HtQueueStatusConditionalNode,\n HtQueueStatusConditionalResultMapping,\n} from './hubtype-fields/queue-status-conditional'\n\nenum QueueStatusResult {\n OPEN = 'open',\n CLOSED = 'closed',\n OPEN_WITHOUT_AGENTS = 'open-without-agents',\n}\n\ntype ConditionalQueueStatusArgs = {\n queueId: string\n queueName: string\n checkAvailableAgents: boolean\n}\n\nexport class FlowQueueStatusConditional extends ContentFieldsBase {\n public arguments: HtFunctionArguments[] = []\n public resultMapping: HtQueueStatusConditionalResultMapping\n public conditionalResult?: HtFunctionResult\n public queueId: string = ''\n public queueName: string = ''\n public isQueueOpen: boolean = false\n public isAvailableAgent: boolean = false\n\n static async fromHubtypeCMS(\n component: HtQueueStatusConditionalNode,\n locale: string\n ): Promise<FlowQueueStatusConditional> {\n const newChannelConditional = new FlowQueueStatusConditional(component.id)\n newChannelConditional.code = component.code\n newChannelConditional.arguments = component.content.arguments\n newChannelConditional.resultMapping = component.content\n .result_mapping as HtQueueStatusConditionalResultMapping\n await newChannelConditional.setConditionalResult(locale)\n\n return newChannelConditional\n }\n\n async setConditionalResult(locale: string): Promise<void> {\n const args = getArgumentsByLocale(this.arguments, locale)\n\n const queueId = args.find(arg => arg.name === 'queue_id')?.value || ''\n const queueName = args.find(arg => arg.name === 'queue_name')?.value || ''\n const checkAvailableAgents =\n (args.find(arg => arg.name === 'check_available_agents')\n ?.value as unknown as boolean) || false\n\n const queueStatus = await this.conditionalQueueStatus({\n queueId,\n queueName,\n checkAvailableAgents,\n })\n\n const conditionalResult = this.resultMapping.find(\n rMap => rMap.result === queueStatus\n )\n\n if (!conditionalResult) {\n throw new Error(\n `No conditional result found for node ${this.code} with queue: ${queueName}`\n )\n }\n this.conditionalResult = conditionalResult\n this.followUp = conditionalResult.target\n }\n\n async conditionalQueueStatus({\n queueId,\n checkAvailableAgents,\n queueName,\n }: ConditionalQueueStatusArgs): Promise<QueueStatusResult> {\n const queuesApi = new HubtypeQueuesApi(queueId, checkAvailableAgents)\n const data = await queuesApi.getAvailability()\n this.queueId = queueId\n this.queueName = queueName\n this.isQueueOpen = data.open\n this.isAvailableAgent = data.available_agents > 0\n\n if (checkAvailableAgents && data.open && data.available_agents === 0) {\n return QueueStatusResult.OPEN_WITHOUT_AGENTS\n }\n\n return data.open ? QueueStatusResult.OPEN : QueueStatusResult.CLOSED\n }\n\n async trackFlow(botContext: BotContext): Promise<void> {\n const { flowThreadId, flowId, flowName, flowNodeId, flowNodeContentId } =\n getCommonFlowContentEventArgsForContentId(botContext, this.id)\n if (!this.conditionalResult?.result) {\n console.warn(\n `Tracking event for node ${this.code} but no conditional result found`\n )\n }\n const eventQueueStatusConditional: EventConditionalQueueStatus = {\n action: EventAction.ConditionalQueueStatus,\n flowThreadId,\n flowId,\n flowName,\n flowNodeId,\n flowNodeContentId,\n flowNodeIsMeaningful: false,\n queueId: this.queueId,\n queueName: this.queueName,\n isQueueOpen: this.isQueueOpen,\n isAvailableAgent: this.isAvailableAgent,\n }\n const { action, ...eventArgs } = eventQueueStatusConditional\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(): JSX.Element {\n return <></>\n }\n}\n"],"names":["EventAction","getArgumentsByLocale","HubtypeQueuesApi","getCommonFlowContentEventArgsForContentId","trackEvent","ContentFieldsBase","QueueStatusResult","FlowQueueStatusConditional","component","locale","newChannelConditional","args","queueId","arg","queueName","checkAvailableAgents","queueStatus","conditionalResult","rMap","Error","queuesApi","data","botContext","flowThreadId","flowId","flowName","flowNodeId","flowNodeContentId","console","eventQueueStatusConditional","action","eventArgs"],"mappings":";;;;;;;;;;;;;;AAIsB;AAE6B;AACc;AAI7C;AACqC;AAUzD,IAAKM,+CAAiBA,iBAAjBA,gDAAAA,SAAAA;;;;WAAAA;EAAAA,+CAAiBA,OAAjBA,EAAAA;AAYE,MAAMC,0BAA0BA,SAASF,iBAAiBA;IAS/D,aAAa,eACXG,SAAuC,EACvCC,MAAc,EACuB;QACrC,MAAMC,wBAAwB,IAAIH,0BAA0BA,CAACC,UAAU,EAAE;QACzEE,sBAAsB,IAAI,GAAGF,UAAU,IAAI;QAC3CE,sBAAsB,SAAS,GAAGF,UAAU,OAAO,CAAC,SAAS;QAC7DE,sBAAsB,aAAa,GAAGF,UAAU,OAAO,CACpD,cAAc;QACjB,MAAME,sBAAsB,oBAAoB,CAACD;QAEjD,OAAOC;IACT;IAEA,MAAM,qBAAqBD,MAAc,EAAiB;QACxD,MAAME,OAAOV,oBAAoBA,CAAC,IAAI,CAAC,SAAS,EAAEQ;QAElD,MAAMG,UAAUD,KAAK,IAAI,CAACE,CAAAA,MAAOA,IAAI,IAAI,KAAK,aAAa,SAAS;QACpE,MAAMC,YAAYH,KAAK,IAAI,CAACE,CAAAA,MAAOA,IAAI,IAAI,KAAK,eAAe,SAAS;QACxE,MAAME,uBACHJ,KAAK,IAAI,CAACE,CAAAA,MAAOA,IAAI,IAAI,KAAK,2BAC3B,SAAgC;QAEtC,MAAMG,cAAc,MAAM,IAAI,CAAC,sBAAsB,CAAC;YACpDJ;YACAE;YACAC;QACF;QAEA,MAAME,oBAAoB,IAAI,CAAC,aAAa,CAAC,IAAI,CAC/CC,CAAAA,OAAQA,KAAK,MAAM,KA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,GAAGF;QACjC,MAAMzB,UAAUA,CAACkB,YAAYQ,QAAQC;IACvC;IAEA,MAAM,eAAeT,UAAsB,EAAiB;QAC1D,MAAM,IAAI,CAAC,aAAa,CAACA,YAAY,IAAI;QACzC,MAAM,IAAI,CAAC,SAAS,CAACA;QACrB;IACF;IAEA,YAAyB;QACvB,qBAAO;IACT;;QAvGK,qBACE,YAAmC,EAAE,OAGrC,UAAkB,SAClB,YAAoB,SACpB,cAAuB,YACvB,mBAA4B;;AAiGrC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"content-fields/flow-rating.js","sources":["../../../src/content-fields/flow-rating.tsx"],"sourcesContent":["import { type BotContext, isDev, isWebchat, isWhatsapp } from '@botonic/core'\nimport { CustomRatingMessage, Text, WhatsappButtonList } from '@botonic/react'\n\nimport { trackOneContent } from '../tracking'\nimport { getFlowBuilderPlugin } from '../utils/get-flow-builder-plugin'\nimport { ContentFieldsBase } from './content-fields-base'\nimport { FlowButton } from './flow-button'\nimport { type HtRatingNode, RatingType } from './hubtype-fields'\n\nexport class FlowRating extends ContentFieldsBase {\n public text = ''\n public sendButtonText = ''\n public ratingType = RatingType.Stars\n public buttons: FlowButton[] = []\n public openListButtonText = ''\n\n static fromHubtypeCMS(cmsText: HtRatingNode, locale: string): FlowRating {\n const newRating = new FlowRating(cmsText.id)\n newRating.code = cmsText.code\n newRating.text = FlowRating.getTextByLocale(locale, cmsText.content.text)\n newRating.sendButtonText = FlowRating.getTextByLocale(\n locale,\n cmsText.content.send_button_text\n )\n newRating.ratingType = cmsText.content.rating_type\n newRating.buttons = cmsText.content.buttons.map(button =>\n FlowButton.fromRating(button)\n )\n newRating.openListButtonText = FlowRating.getTextByLocale(\n locale,\n cmsText.content.open_list_button_text\n )\n newRating.followUp = cmsText.follow_up\n\n return newRating\n }\n\n async trackFlow(botContext: BotContext): Promise<void> {\n await trackOneContent(botContext, this)\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(botContext: BotContext): JSX.Element {\n const flowBuilderPlugin = getFlowBuilderPlugin(botContext.plugins)\n const customRatingMessageEnabled =\n flowBuilderPlugin.customRatingMessageEnabled\n const replacedText = this.replaceVariables(this.text, botContext)\n\n if (isWhatsapp(botContext.session)) {\n return (\n <WhatsappButtonList\n body={replacedText}\n button={this.openListButtonText}\n sections={[\n {\n rows: this.buttons.map(button => ({\n id: button.payload as string,\n title: button.text,\n })),\n },\n ]}\n />\n )\n }\n\n if (\n (isWebchat(botContext.session) || isDev(botContext.session)) &&\n customRatingMessageEnabled\n ) {\n const payloads = this.buttons\n .map(button => button.payload)\n .slice()\n .reverse()\n\n return (\n <CustomRatingMessage\n alt={replacedText}\n payloads={payloads}\n messageText={replacedText}\n buttonText={this.sendButtonText}\n ratingType={this.ratingType}\n />\n )\n }\n\n return (\n <Text key={this.id}>\n {replacedText}\n {this.buttons.map((button, buttonIndex) =>\n button.renderButton(buttonIndex)\n )}\n </Text>\n )\n }\n}\n"],"names":["isDev","isWebchat","isWhatsapp","CustomRatingMessage","Text","WhatsappButtonList","trackOneContent","getFlowBuilderPlugin","ContentFieldsBase","FlowButton","RatingType","FlowRating","cmsText","locale","newRating","button","botContext","flowBuilderPlugin","customRatingMessageEnabled","replacedText","payloads","buttonIndex"],"mappings":";;;;;;;;;;;;;;;;;;AAA6E;AACC;AAEjC;AAC0B;AACd;AACf;AACsB;AAEzD,MAAMW,UAAUA,SAASH,iBAAiBA;IAO/C,OAAO,eAAeI,OAAqB,EAAEC,MAAc,EAAc;QACvE,MAAMC,YAAY,IAAIH,UAAUA,CAACC,QAAQ,EAAE;QAC3CE,UAAU,IAAI,GAAGF,QAAQ,IAAI;QAC7BE,UAAU,IAAI,GAAGH,UAAUA,CAAC,eAAe,CAACE,QAAQD,QAAQ,OAAO,CAAC,IAAI;QACxEE,UAAU,cAAc,GAAGH,UAAUA,CAAC,eAAe,CACnDE,QACAD,QAAQ,O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AAKgB;gBACL,UAAUC;gBACV,aAAaD;gBACb,YAAY,IAAI,CAAC,cAAc;gBAC/B,YAAY,IAAI,CAAC,UAAU;;QAGjC;QAEA,qBACE,KAACf,IAAIA;;gBACFe;gBACA,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAACJ,QAAQM,cACzBN,OAAO,YAAY,CAACM;;WAHb,IAAI,CAAC,EAAE;IAOtB;;QAzFK,qBACE,OAAO,SACP,iBAAiB,SACjB,aAAaX,gBAAgB,OAC7B,UAAwB,EAAE,OAC1B,qBAAqB;;AAqF9B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"content-fields/flow-text.js","sources":["../../../src/content-fields/flow-text.tsx"],"sourcesContent":["import type {\n BotContext,\n BotExecutorMessage,\n TextMessage,\n TextWithButtonsMessage,\n} from '@botonic/core'\nimport { Text } from '@botonic/react'\n\nimport type { FlowBuilderApi } from '../api'\nimport { EMPTY_PAYLOAD, SOURCE_INFO_SEPARATOR } from '../constants'\nimport { trackOneContent } from '../tracking'\nimport { ContentFieldsBase } from './content-fields-base'\nimport { FlowButton } from './flow-button'\nimport { HtButtonStyle, type HtTextNode } from './hubtype-fields'\n\nexport class FlowText extends ContentFieldsBase {\n public text = ''\n public buttons: FlowButton[] = []\n public buttonStyle = HtButtonStyle.BUTTON\n\n static fromHubtypeCMS(\n cmsText: HtTextNode,\n locale: string,\n cmsApi: FlowBuilderApi,\n botContext: BotContext\n ): FlowText {\n const newText = new FlowText(cmsText.id)\n newText.code = cmsText.code\n newText.buttonStyle = cmsText.content.buttons_style || HtButtonStyle.BUTTON\n newText.text = FlowText.getTextByLocale(locale, cmsText.content.text)\n newText.buttons = cmsText.content.buttons.map(button =>\n FlowButton.fromHubtypeCMS(button, locale, cmsApi, botContext)\n )\n newText.followUp = cmsText.follow_up\n\n return newText\n }\n\n async trackFlow(botContext: BotContext): Promise<void> {\n await trackOneContent(botContext, this)\n for (const button of this.buttons) {\n await button.trackFlow(botContext)\n }\n }\n\n static fromAIAgent(\n id: string,\n textMessage: TextMessage | TextWithButtonsMessage | BotExecutorMessage\n ): JSX.Element {\n if (textMessage.type === 'text') {\n return <Text key={id}>{textMessage.content.text}</Text>\n }\n\n return (\n <Text key={id}>\n {textMessage.content.text}\n {textMessage.content.buttons.map((button, buttonIndex) => {\n const buttonData = {\n id: `${id}-button-${buttonIndex}`,\n text: button.text,\n url: button.url,\n target: button.target,\n payload:\n button.payload ||\n `${EMPTY_PAYLOAD}${SOURCE_INFO_SEPARATOR}${buttonIndex}`,\n }\n return FlowButton.fromAIAgent(buttonData).renderButton(buttonIndex)\n })}\n </Text>\n )\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(botContext: BotContext): JSX.Element {\n const replacedText = this.replaceVariables(this.text, botContext)\n return (\n <Text key={this.id}>\n {replacedText}\n {this.buttons.map((button, buttonIndex) =>\n button.renderButton(buttonIndex, this.buttonStyle)\n )}\n </Text>\n )\n }\n}\n"],"names":["Text","EMPTY_PAYLOAD","SOURCE_INFO_SEPARATOR","trackOneContent","ContentFieldsBase","FlowButton","HtButtonStyle","FlowText","cmsText","locale","cmsApi","botContext","newText","button","id","textMessage","buttonIndex","buttonData","replacedText"],"mappings":";;;;;;;;;;;;;;;;AAMqC;AAG8B;AACtB;AACY;AACf;AACuB;AAE1D,MAAMO,QAAQA,SAASH,iBAAiBA;IAK7C,OAAO,eACLI,OAAmB,EACnBC,MAAc,EACdC,MAAsB,EACtBC,UAAsB,EACZ;QACV,MAAMC,UAAU,IAAIL,QAAQA,CAACC,QAAQ,EAAE;QACvCI,QAAQ,IAAI,GAAGJ,QAAQ,IAAI;QAC3BI,QAAQ,WAAW,GAAGJ,QAAQ,OAAO,CAAC,aAAa,IAAIF,oBAAoB;QAC3EM,QAAQ,IAAI,GAAGL,QAAQA,CAAC,eAAe,CAACE,QAAQD,QAAQ,OAAO,CAAC,IAAI;QACpEI,Q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QAAQG,cACzBH,OAAO,YAAY,CAACG,aAAa,IAAI,CAAC,WAAW;;WAH1C,IAAI,CAAC,EAAE;IAOtB;;QAzEK,qBACE,OAAO,SACP,UAAwB,EAAE,OAC1B,cAAcV,oBAAoB;;AAuE3C"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"content-fields/flow-video.js","sources":["../../../src/content-fields/flow-video.tsx"],"sourcesContent":["import type { BotContext } from '@botonic/core'\nimport { Video } from '@botonic/react'\n\nimport { trackOneContent } from '../tracking'\nimport { ContentFieldsBase } from './content-fields-base'\nimport type { HtVideoNode } from './hubtype-fields'\n\nexport class FlowVideo extends ContentFieldsBase {\n public src = ''\n\n static fromHubtypeCMS(component: HtVideoNode, locale: string): FlowVideo {\n const newVideo = new FlowVideo(component.id)\n newVideo.code = component.code\n newVideo.src = FlowVideo.getVideoByLocale(locale, component.content.video)\n newVideo.followUp = component.follow_up\n\n return newVideo\n }\n\n async trackFlow(botContext: BotContext): Promise<void> {\n await trackOneContent(botContext, this)\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(): JSX.Element {\n return <Video key={this.id} src={this.src} />\n }\n}\n"],"names":["Video","trackOneContent","ContentFieldsBase","FlowVideo","component","locale","newVideo","botContext"],"mappings":";;;;;;;;;;AACsC;AAEO;AACY;AAGlD,MAAMG,SAASA,SAASD,iBAAiBA;IAG9C,OAAO,eAAeE,SAAsB,EAAEC,MAAc,EAAa;QACvE,MAAMC,WAAW,IAAIH,SAASA,CAACC,UAAU,EAAE;QAC3CE,SAAS,IAAI,GAAGF,UAAU,IAAI;QAC9BE,SAAS,GAAG,GAAGH,SAASA,CAAC,gBAAgB,CAACE,QAAQD,UAAU,OAAO,CAAC,KAAK;QACzEE,SAAS,QAAQ,GAAGF,UAAU,SAAS;QAEvC,OAAOE;IACT;IAEA,MAAM,UAAUC,UAAsB,EAAiB;QACrD,MAAMN,eAAeA,CAACM,YAAY,IAAI;IACxC;IAEA,MAAM,eAAeA,UAAsB,EAAiB;QAC1D,MAAM,IAAI,CAAC,aAAa,CAACA,YAAY,IAAI;QACzC,MAAM,IAAI,CAAC,SAAS,CAACA;QACrB;IACF;IAEA,YAAyB;QACvB,qBAAO,IAACP,KAAKA;YAAe,KAAK,IAAI,CAAC,GAAG;WAAtB,IAAI,CAAC,EAAE;IAC5B;;QAxBK,qBACE,MAAM;;AAwBf"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"content-fields/flow-webview.js","sources":["../../../src/content-fields/flow-webview.tsx"],"sourcesContent":["import {\n type BotContext,\n EventAction,\n type EventWebviewActionTriggered,\n} from '@botonic/core'\n\nimport type { FlowBuilderApi } from '../api'\nimport {\n getCommonFlowContentEventArgsForContentId,\n trackEvent,\n} from '../tracking'\nimport { getFlowBuilderPlugin } from '../utils/get-flow-builder-plugin'\nimport { ContentFieldsBase } from './content-fields-base'\nimport type {\n HtNodeWithContent,\n HtWebviewExits,\n HtWebviewNode,\n} from './hubtype-fields'\n\nexport class FlowWebview extends ContentFieldsBase {\n public webviewTargetId: string = ''\n public webviewName: string = ''\n public webviewComponentName: string = ''\n public webviewParams: Record<string, string> = {}\n public exits: HtWebviewExits[] = []\n\n static fromHubtypeCMS(component: HtWebviewNode): FlowWebview {\n const newWebview = new FlowWebview(component.id)\n newWebview.webviewTargetId = component.content.webview_target_id\n newWebview.webviewName = component.content.webview_name\n newWebview.webviewComponentName = component.content.webview_component_name\n newWebview.webviewParams = component.content.webview_params ?? {}\n newWebview.exits = component.content.exits\n newWebview.followUp = component.follow_up\n\n return newWebview\n }\n\n getParams(botContext: BotContext): Record<string, string> {\n const flowBuilderPlugin = getFlowBuilderPlugin(botContext.plugins)\n const cmsApi = flowBuilderPlugin.cmsApi\n\n const params: Record<string, string> = {\n webviewId: this.webviewTargetId,\n t: Date.now().toString(),\n ...this.getResolvedWebviewParams(botContext),\n }\n const exitSuccessContentID = this.getExitSuccessContentID(cmsApi)\n\n if (exitSuccessContentID) {\n params.exitSuccessContentID = exitSuccessContentID\n }\n return params\n }\n\n private getResolvedWebviewParams(\n botContext: BotContext\n ): Record<string, string> {\n return Object.fromEntries(\n Object.entries(this.webviewParams).map(([key, value]) => [\n key,\n this.replaceVariables(value, botContext),\n ])\n )\n }\n\n private getExitSuccessContentID(cmsApi: FlowBuilderApi): string | undefined {\n const webviewSuccessExit = this.exits?.find(exit => exit.name === 'Success')\n const exitSuccessId = webviewSuccessExit?.target?.id\n if (!exitSuccessId) {\n return undefined\n }\n const exitNode = cmsApi.getNodeById<HtNodeWithContent>(exitSuccessId)\n\n return exitNode.code\n }\n\n async trackFlow(botContext: BotContext): Promise<void> {\n const { flowThreadId, flowId, flowName, flowNodeId, flowNodeContentId } =\n getCommonFlowContentEventArgsForContentId(botContext, this.id)\n\n const eventWebviewActionTriggered: EventWebviewActionTriggered = {\n action: EventAction.WebviewActionTriggered,\n flowThreadId,\n flowId,\n flowName,\n flowNodeId,\n flowNodeContentId,\n flowNodeIsMeaningful: false,\n webviewTargetId: this.webviewTargetId,\n webviewName: this.webviewName,\n webviewParams: this.getParams(botContext),\n }\n const { action, ...eventArgs } = eventWebviewActionTriggered\n await trackEvent(botContext, action, eventArgs)\n }\n\n async processContent(): Promise<void> {\n return\n }\n}\n"],"names":["EventAction","getCommonFlowContentEventArgsForContentId","trackEvent","getFlowBuilderPlugin","ContentFieldsBase","FlowWebview","component","newWebview","botContext","flowBuilderPlugin","cmsApi","params","Date","exitSuccessContentID","Object","key","value","webviewSuccessExit","exit","exitSuccessId","undefined","exitNode","flowThreadId","flowId","flowName","flowNodeId","flowNodeContentId","eventWebviewActionTriggered","action","eventArgs"],"mappings":";;;;;;;;;AAIsB;AAMF;AACmD;AACd;AAOlD,MAAMK,WAAWA,SAASD,iBAAiBA;IAOhD,OAAO,eAAeE,SAAwB,EAAe;QAC3D,MAAMC,aAAa,IAAIF,WAAWA,CAACC,UAAU,EAAE;QA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AEc,YAAY,EAAEC,MAAM,EAAEC,QAAQ,EAAEC,UAAU,EAAEC,iBAAiB,EAAE,GACrEzB,yCAAyCA,CAACO,YAAY,IAAI,CAAC,EAAE;QAE/D,MAAMmB,8BAA2D;YAC/D,QAAQ3B,kCAAkC;YAC1CsB;YACAC;YACAC;YACAC;YACAC;YACA,sBAAsB;YACtB,iBAAiB,IAAI,CAAC,eAAe;YACrC,aAAa,IAAI,CAAC,WAAW;YAC7B,eAAe,IAAI,CAAC,SAAS,CAAClB;QAChC;QACA,MAAM,EAAEoB,MAAM,EAAE,GAAGC,WAAW,GAAGF;QACjC,MAAMzB,UAAUA,CAACM,YAAYoB,QAAQC;IACvC;IAEA,MAAM,iBAAgC;QACpC;IACF;;QAhFK,qBACE,kBAA0B,SAC1B,cAAsB,SACtB,uBAA+B,SAC/B,gBAAwC,CAAC,QACzC,QAA0B,EAAE;;AA4ErC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"content-fields/flow-whatsapp-cta-url-button.js","sources":["../../../src/content-fields/flow-whatsapp-cta-url-button.tsx"],"sourcesContent":["import { type BotContext, isWhatsapp } from '@botonic/core'\nimport {\n Button,\n Text,\n WhatsappCTAUrlButton,\n WhatsappCTAUrlHeaderType,\n} from '@botonic/react'\n\nimport type { FlowBuilderApi } from '../api'\nimport { trackOneContent } from '../tracking'\nimport { ContentFieldsBase } from './content-fields-base'\nimport { FlowButton } from './flow-button'\nimport type { HtUrlNode, HtWhatsappCTAUrlButtonNode } from './hubtype-fields'\n\nexport class FlowWhatsappCtaUrlButtonNode extends ContentFieldsBase {\n public text = ''\n public header?: string\n public headerType?: WhatsappCTAUrlHeaderType\n public headerImage?: string\n public headerVideo?: string\n public headerDocument?: string\n public footer?: string\n public displayText = ''\n public url: string = ''\n\n static fromHubtypeCMS(\n component: HtWhatsappCTAUrlButtonNode,\n locale: string,\n cmsApi: FlowBuilderApi,\n botContext: BotContext\n ): FlowWhatsappCtaUrlButtonNode {\n const whatsappCtaUrlButton = new FlowWhatsappCtaUrlButtonNode(component.id)\n whatsappCtaUrlButton.code = component.code\n whatsappCtaUrlButton.text = FlowWhatsappCtaUrlButtonNode.getTextByLocale(\n locale,\n component.content.text\n )\n FlowWhatsappCtaUrlButtonNode.setHeader(\n whatsappCtaUrlButton,\n component,\n locale\n )\n whatsappCtaUrlButton.footer = FlowWhatsappCtaUrlButtonNode.getTextByLocale(\n locale,\n component.content.footer\n )\n const button = FlowButton.fromHubtypeCMS(\n component.content.button,\n locale,\n cmsApi,\n botContext\n )\n whatsappCtaUrlButton.displayText = button.text\n const urlId = FlowButton.getUrlId(component.content.button, locale)\n if (urlId) {\n const urlNode = cmsApi.getNodeById<HtUrlNode>(urlId)\n whatsappCtaUrlButton.url = urlNode.content.url\n }\n whatsappCtaUrlButton.followUp = component.follow_up\n\n return whatsappCtaUrlButton\n }\n\n private static setHeader(\n whatsappCtaUrlButton: FlowWhatsappCtaUrlButtonNode,\n component: HtWhatsappCTAUrlButtonNode,\n locale: string\n ) {\n // If header is set, set header_type to text, this is need to be compatible with the old version of the component\n if (component.content.header.length > 0) {\n component.content.header_type = WhatsappCTAUrlHeaderType.Text\n }\n\n whatsappCtaUrlButton.headerType = component.content\n .header_type as WhatsappCTAUrlHeaderType\n\n if (component.content.header_type === WhatsappCTAUrlHeaderType.Text) {\n whatsappCtaUrlButton.header =\n FlowWhatsappCtaUrlButtonNode.getTextByLocale(\n locale,\n component.content.header\n )\n }\n\n if (\n component.content.header_type === WhatsappCTAUrlHeaderType.Image &&\n component.content.header_image\n ) {\n whatsappCtaUrlButton.headerImage =\n FlowWhatsappCtaUrlButtonNode.getAssetByLocale(\n locale,\n component.content.header_image\n )\n }\n\n if (\n component.content.header_type === WhatsappCTAUrlHeaderType.Video &&\n component.content.header_video\n ) {\n whatsappCtaUrlButton.headerVideo =\n FlowWhatsappCtaUrlButtonNode.getAssetByLocale(\n locale,\n component.content.header_video\n )\n }\n\n if (\n component.content.header_type === WhatsappCTAUrlHeaderType.Document &&\n component.content.header_document\n ) {\n whatsappCtaUrlButton.headerDocument =\n FlowWhatsappCtaUrlButtonNode.getAssetByLocale(\n locale,\n component.content.header_document\n )\n }\n }\n\n async trackFlow(botContext: BotContext): Promise<void> {\n await trackOneContent(botContext, this)\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(botContext: BotContext): JSX.Element {\n const replacedText = this.replaceVariables(this.text, botContext)\n\n if (!isWhatsapp(botContext.session)) {\n return (\n <Text>\n {replacedText}\n <Button url={this.url}>{this.displayText}</Button>\n </Text>\n )\n }\n\n if (\n this.headerType === WhatsappCTAUrlHeaderType.Image &&\n this.headerImage\n ) {\n return (\n <WhatsappCTAUrlButton\n key={this.id}\n body={replacedText}\n headerType={this.headerType}\n headerImage={this.headerImage}\n footer={this.footer}\n displayText={this.displayText}\n url={this.url}\n />\n )\n }\n\n if (\n this.headerType === WhatsappCTAUrlHeaderType.Video &&\n this.headerVideo\n ) {\n return (\n <WhatsappCTAUrlButton\n key={this.id}\n body={replacedText}\n headerType={this.headerType}\n headerVideo={this.headerVideo}\n footer={this.footer}\n displayText={this.displayText}\n url={this.url}\n />\n )\n }\n\n if (\n this.headerType === WhatsappCTAUrlHeaderType.Document &&\n this.headerDocument\n ) {\n return (\n <WhatsappCTAUrlButton\n key={this.id}\n body={replacedText}\n headerType={this.headerType}\n headerDocument={this.headerDocument}\n footer={this.footer}\n displayText={this.displayText}\n url={this.url}\n />\n )\n }\n\n if (this.headerType === WhatsappCTAUrlHeaderType.Text && this.header) {\n return (\n <WhatsappCTAUrlButton\n key={this.id}\n body={replacedText}\n header={this.header}\n headerType={this.headerType}\n footer={this.footer}\n displayText={this.displayText}\n url={this.url}\n />\n )\n }\n\n return (\n <WhatsappCTAUrlButton\n key={this.id}\n body={replacedText}\n footer={this.footer}\n displayText={this.displayText}\n url={this.url}\n />\n )\n }\n}\n"],"names":["isWhatsapp","Button","Text","WhatsappCTAUrlButton","WhatsappCTAUrlHeaderType","trackOneContent","ContentFieldsBase","FlowButton","FlowWhatsappCtaUrlButtonNode","component","locale","cmsApi","botContext","whatsappCtaUrlButton","button","urlId","urlNode","replacedText"],"mappings":";;;;;;;;;;;;;;AAA2D;AAMpC;AAGsB;AACY;AACf;AAGnC,MAAMQ,4BAA4BA,SAASF,iBAAiBA;IAWjE,OAAO,eACLG,SAAqC,EACrCC,MAAc,EACdC,MAAsB,EACtBC,UAAsB,EACQ;QAC9B,MAAMC,uBAAuB,IAAIL,4BAA4BA,CAACC,UAAU,EAAE;QAC1EI,qBAAqB,IAAI,GAAGJ,UAAU,IAAI;QAC1CI,qBAAqB,IAAI,GAAGL,4BAA4BA,CAAC,eAAe,CACtEE,QACAD,UAAU,OAAO,CAAC,IAAI;QAExBD,4BAA4BA,CAAC,SAAS,CACpCK,sBACAJ,WACAC;QAEFG,qBAAqB,MAAM,GAAGL,4BAA4BA,CAAC,eAAe,CACxEE,QACAD,UAAU,OAAO,CAAC,MAAM;QAE1B,MAAMK,SAASP,yBAAyB,CACtCE,UAAU,OAAO,CAAC,MAAM,EACxBC,QACAC,QACAC;QAEFC,qBAAqB,WAAW,GAAGC,OAAO,IAAI;QAC9C,MAAMC,QAAQR,mBAAmB,CAACE,UAAU,OAAO,CAAC,MAAM,EAAEC;QAC5D,IAAIK,OAAO;YACT,MAAMC,UAAUL,OAAO,WAAW,CAAYI;YAC9CF,qBAAqB,GAAG,GAAGG,QAAQ,OAAO,CAAC,GAAG;QAChD;QACAH,qBAAqB,QAAQ,GAAGJ,UAAU,SAAS;QAEnD,OAAOI;IACT;IAEA,OAAe,UACbA,oBAAkD,EAClDJ,SAAqC,EACrCC,MAAc,EACd;QACA,iHAAiH;QACjH,IAAID,UAAU,OAAO,CAAC,MAAM,CAAC,MAAM,GAAG,GAAG;YACvCA,UAAU,OAAO,CAAC,WAAW,GAAGL,6BAA6B;QAC/D;QAEAS,qBAAqB,UAAU,GAAGJ,U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IAACd,oBAAoBA;YAEnB,MAAMc;YACN,QAAQ,IAAI,CAAC,MAAM;YACnB,aAAa,IAAI,CAAC,WAAW;YAC7B,KAAK,IAAI,CAAC,GAAG;WAJR,IAAI,CAAC,EAAE;IAOlB;;QAxMK,qBACE,OAAO,SAOP,cAAc,SACd,MAAc;;AAgMvB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"content-fields/flow-whatsapp-request-contact-info.js","sources":["../../../src/content-fields/flow-whatsapp-request-contact-info.tsx"],"sourcesContent":["import { type BotContext, isWhatsapp } from '@botonic/core'\nimport { Text, WhatsappRequestContactInfo } from '@botonic/react'\n\nimport { trackOneContent } from '../tracking'\nimport { ContentFieldsBase } from './content-fields-base'\nimport type { HtWhatsappRequestContactInfoNode } from './hubtype-fields'\n\nexport class FlowWhatsappRequestContactInfoNode extends ContentFieldsBase {\n public text = ''\n\n static fromHubtypeCMS(\n component: HtWhatsappRequestContactInfoNode,\n locale: string\n ): FlowWhatsappRequestContactInfoNode {\n const requestContactInfo = new FlowWhatsappRequestContactInfoNode(\n component.id\n )\n requestContactInfo.code = component.code\n requestContactInfo.text =\n FlowWhatsappRequestContactInfoNode.getTextByLocale(\n locale,\n component.content.text\n )\n requestContactInfo.followUp = component.follow_up\n\n return requestContactInfo\n }\n\n async trackFlow(botContext: BotContext): Promise<void> {\n await trackOneContent(botContext, this)\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(botContext: BotContext): JSX.Element {\n const replacedText = this.replaceVariables(this.text, botContext)\n\n if (!isWhatsapp(botContext.session)) {\n return <Text>{replacedText}</Text>\n }\n\n return <WhatsappRequestContactInfo key={this.id} body={replacedText} />\n }\n}\n"],"names":["isWhatsapp","Text","WhatsappRequestContactInfo","trackOneContent","ContentFieldsBase","FlowWhatsappRequestContactInfoNode","component","locale","requestContactInfo","botContext","replacedText"],"mappings":";;;;;;;;;;;;AAA2D;AACM;AAEpB;AACY;AAGlD,MAAMK,kCAAkCA,SAASD,iBAAiBA;IAGvE,OAAO,eACLE,SAA2C,EAC3CC,MAAc,EACsB;QACpC,MAAMC,qBAAqB,IAAIH,kCAAkCA,CAC/DC,UAAU,EAAE;QAEdE,mBAAmB,IAAI,GAAGF,UAAU,IAAI;QACxCE,mBAAmB,IAAI,GACrBH,kCAAkCA,CAAC,eAAe,CAChDE,QACAD,UAAU,OAAO,CAAC,IAAI;QAE1BE,mBAAmB,QAAQ,GAAGF,UAAU,SAAS;QAEjD,OAAOE;IACT;IAEA,MAAM,UAAUC,UAAsB,EAAiB;QACrD,MAAMN,eAAeA,CAACM,YAAY,IAAI;IACxC;IAEA,MAAM,eAAeA,UAAsB,EAAiB;QAC1D,MAAM,IAAI,CAAC,aAAa,CAACA,YAAY,IAAI;QACzC,MAAM,IAAI,CAAC,SAAS,CAACA;QACrB;IACF;IAEA,UAAUA,UAAsB,EAAe;QAC7C,MAAMC,eAAe,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,EAAED;QAEtD,IAAI,CAACT,UAAUA,CAACS,WAAW,OAAO,GAAG;YACnC,qBAAO,IAACR,IAAIA;0BAAES;;QAChB;QAEA,qBAAO,IAACR,0BAA0BA;YAAe,MAAMQ;WAAf,IAAI,CAAC,EAAE;IACjD;;QAvCK,qBACE,OAAO;;AAuChB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"content-fields/flow-whatsapp-template.js","sources":["../../../src/content-fields/flow-whatsapp-template.tsx"],"sourcesContent":["import { type BotContext, isWhatsapp } from '@botonic/core'\nimport {\n Text,\n WhatsAppTemplateButtonSubType,\n WhatsAppTemplateComponentType,\n WhatsAppTemplateParameterType,\n WhatsappTemplate,\n type WhatsappTemplateButton,\n type WhatsappTemplateComponentBody,\n type WhatsappTemplateComponentButtons,\n type WhatsappTemplateComponentHeader,\n type WhatsappTemplateFlowAction,\n type WhatsappTemplateFlowButton,\n type WhatsappTemplatePhoneNumberButton,\n type WhatsappTemplateQuickReplyButton,\n type WhatsappTemplateRequestContactInfoButton,\n type WhatsappTemplateUrlButton,\n type WhatsappTemplateVoiceCallButton,\n} from '@botonic/react'\n\nimport { trackOneContent } from '../tracking'\nimport { getFlowBuilderPlugin } from '../utils/get-flow-builder-plugin'\nimport { ContentFieldsBase } from './content-fields-base'\nimport {\n type HtButton,\n type HtFlowButtonActionValue,\n type HtMediaFileLocale,\n type HtWhatsAppTemplate,\n type HtWhatsAppTemplateButtonsComponent,\n HtWhatsAppTemplateFlowActionType,\n type HtWhatsAppTemplateHeaderComponent,\n type HtWhatsappTemplateContentByLocale,\n type HtWhatsappTemplateNode,\n} from './hubtype-fields'\n\ninterface HeaderVariables {\n type: WhatsAppTemplateParameterType\n text?: Record<string, string>\n media?: HtMediaFileLocale[]\n}\n\nexport class FlowWhatsappTemplate extends ContentFieldsBase {\n public htWhatsappTemplate: HtWhatsAppTemplate\n public variableValues: Record<string, string> = {}\n public headerVariables?: HeaderVariables\n public buttons?: HtButton[]\n public urlVariableValues?: Record<string, string>\n public flowButtonActionValues?: Record<string, HtFlowButtonActionValue>\n\n static fromHubtypeCMS(\n component: HtWhatsappTemplateNode,\n currentLocale: string\n ): FlowWhatsappTemplate {\n const whatsappTemplate = new FlowWhatsappTemplate(component.id)\n whatsappTemplate.code = component.code\n whatsappTemplate.buttons = component.content.buttons\n const contentByLocale = FlowWhatsappTemplate.getContentByLocale(\n component,\n currentLocale\n )\n\n if (!contentByLocale.template) {\n throw new Error(\n `Whatsapp template not configured for locale: ${currentLocale}`\n )\n }\n\n whatsappTemplate.htWhatsappTemplate = contentByLocale.template\n whatsappTemplate.headerVariables = contentByLocale.header_variables\n whatsappTemplate.variableValues = contentByLocale.variable_values || {}\n whatsappTemplate.urlVariableValues = contentByLocale.url_variable_values\n whatsappTemplate.flowButtonActionValues =\n contentByLocale.flow_button_action_values\n\n whatsappTemplate.followUp = component.follow_up\n\n return whatsappTemplate\n }\n\n private static getContentByLocale(\n component: HtWhatsappTemplateNode,\n currentLocale: string\n ) {\n const content: HtWhatsappTemplateContentByLocale | undefined =\n component.content.by_locale[currentLocale]\n if (!content) {\n throw new Error(\n `Whatsapp template content not found for locale: ${currentLocale}`\n )\n }\n return content\n }\n\n private getHeaderComponent(\n whatsappTemplate: HtWhatsAppTemplate,\n headerVariables: HeaderVariables,\n locale: string,\n botContext: BotContext\n ): WhatsappTemplateComponentHeader | undefined {\n const headerComponent = whatsappTemplate.components.find(\n component => component.type === WhatsAppTemplateComponentType.HEADER\n ) as HtWhatsAppTemplateHeaderComponent | undefined\n\n if (\n headerComponent &&\n headerComponent.format === WhatsAppTemplateParameterType.TEXT\n ) {\n return this.createHeaderTextComponent(headerVariables, botContext)\n }\n\n if (\n headerComponent &&\n headerComponent.format === WhatsAppTemplateParameterType.IMAGE\n ) {\n return this.createHeaderImageComponent(headerVariables, locale)\n }\n\n if (\n headerComponent &&\n headerComponent.format === WhatsAppTemplateParameterType.VIDEO\n ) {\n return this.createHeaderVideoComponent(headerVariables, locale)\n }\n\n return undefined\n }\n\n private createHeaderTextComponent(\n headerVariables: HeaderVariables,\n botContext: BotContext\n ): WhatsappTemplateComponentHeader {\n return {\n type: WhatsAppTemplateComponentType.HEADER,\n parameters: Object.values(headerVariables.text || {}).map(value => {\n const valueVariable = this.replaceVariables(value, botContext)\n return {\n type: WhatsAppTemplateParameterType.TEXT,\n text: valueVariable,\n }\n }),\n }\n }\n\n private createHeaderImageComponent(\n headerVariables: HeaderVariables,\n locale: string\n ): WhatsappTemplateComponentHeader {\n return {\n type: WhatsAppTemplateComponentType.HEADER,\n parameters: [\n {\n type: WhatsAppTemplateParameterType.IMAGE,\n image: {\n link:\n headerVariables.media?.find(m => m.locale === locale)?.file || '',\n },\n },\n ],\n }\n }\n\n private createHeaderVideoComponent(\n headerVariables: HeaderVariables,\n locale: string\n ): WhatsappTemplateComponentHeader {\n return {\n type: WhatsAppTemplateComponentType.HEADER,\n parameters: [\n {\n type: WhatsAppTemplateParameterType.VIDEO,\n video: {\n link:\n headerVariables.media?.find(m => m.locale === locale)?.file || '',\n },\n },\n ],\n }\n }\n\n // TODO: To use named variables (contact_info_fields) we need to take it from botContext.session.user.contact_info, this only be able in toBotonic method\n private getBodyComponent(\n variableValues: Record<string, string>,\n botContext: BotContext\n ): WhatsappTemplateComponentBody {\n return {\n type: WhatsAppTemplateComponentType.BODY,\n parameters: Object.entries(variableValues).map(([key, value]) => {\n const valueVariable = this.replaceVariables(value, botContext)\n return {\n type: WhatsAppTemplateParameterType.TEXT,\n parameter_name: key,\n text: valueVariable,\n }\n }),\n }\n }\n\n private getButtons(\n whatsappTemplate: HtWhatsAppTemplate,\n buttonNodes: HtButton[],\n urlVariableValues: Record<string, string>,\n flowButtonActionValues: Record<string, HtFlowButtonActionValue>,\n botContext: BotContext\n ): WhatsappTemplateComponentButtons | undefined {\n const htWhatsappTemplateButtons = whatsappTemplate.components.find(\n component => component.type === WhatsAppTemplateComponentType.BUTTONS\n ) as HtWhatsAppTemplateButtonsComponent | undefined\n\n if (!htWhatsappTemplateButtons) {\n return undefined\n }\n\n const buttons = htWhatsappTemplateButtons.buttons\n .map((button, index) =>\n this.mapTemplateButton(\n button,\n index,\n whatsappTemplate.name,\n buttonNodes,\n urlVariableValues,\n flowButtonActionValues,\n botContext\n )\n )\n .filter(button => button !== null)\n\n return {\n type: WhatsAppTemplateComponentType.BUTTONS,\n buttons: buttons as WhatsappTemplateButton[],\n }\n }\n\n private mapTemplateButton(\n button: HtWhatsAppTemplateButtonsComponent['buttons'][number],\n index: number,\n templateName: string,\n buttonNodes: HtButton[],\n urlVariableValues: Record<string, string>,\n flowButtonActionValues: Record<string, HtFlowButtonActionValue>,\n botContext: BotContext\n ): WhatsappTemplateButton | null {\n if (button.type === WhatsAppTemplateButtonSubType.URL) {\n const urlParam: string | undefined = urlVariableValues?.[String(index)]\n if (!urlParam) {\n return null\n }\n return this.createUrlButtonComponent(index, urlParam, botContext)\n }\n\n if (button.type === WhatsAppTemplateButtonSubType.QUICK_REPLY) {\n const payload = buttonNodes[index].target?.id || ''\n return this.createQuickReplyButtonComponent(index, payload)\n }\n\n if (button.type === WhatsAppTemplateButtonSubType.PHONE_NUMBER) {\n return this.createPhoneNumberButtonComponent(index)\n }\n\n if (button.type === WhatsAppTemplateButtonSubType.VOICE_CALL) {\n return this.createVoiceCallButtonComponent(index)\n }\n\n if (button.type === WhatsAppTemplateButtonSubType.REQUEST_CONTACT_INFO) {\n return this.createRequestContactInfoButtonComponent(index)\n }\n\n if (button.type === WhatsAppTemplateButtonSubType.FLOW) {\n const actionValue = flowButtonActionValues?.[String(index)]\n if (!actionValue) {\n throw new Error(\n `WhatsApp template '${templateName}' FLOW button at index ${index} requires flow_button_action_values`\n )\n }\n return this.createFlowButtonComponent(\n index,\n button,\n actionValue,\n botContext,\n templateName\n )\n }\n\n throw new Error(\n `WhatsApp template '${templateName}' has unsupported button at index ${index}`\n )\n }\n\n private createUrlButtonComponent(\n index: number,\n urlParam: string,\n botContext: BotContext\n ): WhatsappTemplateUrlButton {\n const variableUrlParam = this.replaceVariables(urlParam, botContext)\n return {\n type: WhatsAppTemplateComponentType.BUTTON,\n sub_type: WhatsAppTemplateButtonSubType.URL,\n index: index,\n parameters: urlParam\n ? [\n {\n type: WhatsAppTemplateParameterType.TEXT,\n text: variableUrlParam,\n },\n ]\n : [],\n }\n }\n\n private createQuickReplyButtonComponent(\n index: number,\n payload: string\n ): WhatsappTemplateQuickReplyButton {\n return {\n type: WhatsAppTemplateComponentType.BUTTON,\n sub_type: WhatsAppTemplateButtonSubType.QUICK_REPLY,\n index: index,\n parameters: [\n {\n type: WhatsAppTemplateParameterType.PAYLOAD,\n payload: payload,\n },\n ],\n }\n }\n\n private createVoiceCallButtonComponent(\n index: number\n ): WhatsappTemplateVoiceCallButton {\n return {\n type: WhatsAppTemplateComponentType.BUTTON,\n sub_type: WhatsAppTemplateButtonSubType.VOICE_CALL,\n index: index,\n parameters: [],\n }\n }\n\n private createPhoneNumberButtonComponent(\n index: number\n ): WhatsappTemplatePhoneNumberButton {\n return {\n type: WhatsAppTemplateComponentType.BUTTON,\n sub_type: WhatsAppTemplateButtonSubType.PHONE_NUMBER,\n index: index,\n parameters: [],\n }\n }\n\n private createRequestContactInfoButtonComponent(\n index: number\n ): WhatsappTemplateRequestContactInfoButton {\n return {\n type: WhatsAppTemplateComponentType.BUTTON,\n sub_type: WhatsAppTemplateButtonSubType.REQUEST_CONTACT_INFO,\n index: index,\n parameters: [],\n }\n }\n\n private resolveFlowActionData(\n flowActionData: Record<string, string> | undefined,\n botContext: BotContext\n ): Record<string, string> | undefined {\n if (!flowActionData) {\n return undefined\n }\n\n const resolvedData = Object.fromEntries(\n Object.entries(flowActionData).map(([key, value]) => [\n key,\n this.replaceVariables(value, botContext),\n ])\n )\n\n return Object.keys(resolvedData).length > 0 ? resolvedData : undefined\n }\n\n private createFlowButtonComponent(\n index: number,\n templateButton: Extract<\n HtWhatsAppTemplateButtonsComponent['buttons'][number],\n { type: WhatsAppTemplateButtonSubType.FLOW }\n >,\n actionValue: HtFlowButtonActionValue,\n botContext: BotContext,\n templateName: string\n ): WhatsappTemplateFlowButton {\n const flowToken = this.replaceVariables(actionValue.flow_token, botContext)\n if (!flowToken.trim()) {\n throw new Error(\n `WhatsApp template '${templateName}' FLOW button at index ${index} requires a non-empty flow_token`\n )\n }\n\n const action: WhatsappTemplateFlowAction = {\n flow_token: flowToken,\n }\n\n if (\n templateButton.flow_action !==\n HtWhatsAppTemplateFlowActionType.DATA_EXCHANGE\n ) {\n const flowActionData = this.resolveFlowActionData(\n actionValue.flow_action_data,\n botContext\n )\n if (flowActionData) {\n action.flow_action_data = flowActionData\n }\n }\n\n return {\n type: WhatsAppTemplateComponentType.BUTTON,\n sub_type: WhatsAppTemplateButtonSubType.FLOW,\n index: String(index),\n parameters: [\n {\n type: WhatsAppTemplateParameterType.ACTION,\n action,\n },\n ],\n }\n }\n\n async trackFlow(botContext: BotContext): Promise<void> {\n await trackOneContent(botContext, this)\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(botContext: BotContext): JSX.Element {\n const templateName = this.htWhatsappTemplate.name\n const templateLanguage = this.htWhatsappTemplate.language\n const body = this.getBodyComponent(this.variableValues, botContext)\n const pluginFlowBuilder = getFlowBuilderPlugin(botContext.plugins)\n const resolvedLocale = pluginFlowBuilder.cmsApi.getResolvedLocale()\n\n const header = this.getHeaderComponent(\n this.htWhatsappTemplate,\n this.headerVariables || ({} as HeaderVariables),\n resolvedLocale,\n botContext\n )\n const buttons = this.getButtons(\n this.htWhatsappTemplate,\n this.buttons || [],\n this.urlVariableValues || {},\n this.flowButtonActionValues || {},\n botContext\n )\n\n if (isWhatsapp(botContext.session)) {\n return (\n <WhatsappTemplate\n key={this.id}\n name={templateName}\n language={templateLanguage}\n header={header}\n body={body}\n buttons={buttons}\n />\n )\n }\n\n return (\n <Text key={this.id}>\n {`WhatsApp Template: ${templateName} (${templateLanguage})`}\n {header && `${JSON.stringify(header, null, 2)}`}\n {body && `${JSON.stringify(body, null, 2)}`}\n {buttons && `${JSON.stringify(buttons, null, 2)}`}\n </Text>\n )\n }\n}\n"],"names":["isWhatsapp","Text","WhatsAppTemplateButtonSubType","WhatsAppTemplateComponentType","WhatsAppTemplateParameterType","WhatsappTemplate","trackOneContent","getFlowBuilderPlugin","ContentFieldsBase","HtWhatsAppTemplateFlowActionType","FlowWhatsappTemplate","component","currentLocale","whatsappTemplate","contentByLocale","Error","content","headerVariables","locale","botContext","headerComponent","undefined","Object","value","valueVariable","m","variableValues","key","buttonNodes","urlVariableValues","flowButtonActionValues","htWhatsappTemplateButtons","buttons","button","index","templateName","urlParam","String","payload","actionValue","variableUrlParam","flowActionData","resolvedData","templateButton","flowToken","action","templateLanguage","body","pluginFlowBuilder","resolvedLocale","header","JSON"],"mappings":";;;;;;;;;;;;;;;;AAA2D;AAkBpC;AAEsB;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|
|
1
|
-
{"version":3,"file":"content-fields/hubtype-fields/ai-agent-router.js","sources":["../../../../src/content-fields/hubtype-fields/ai-agent-router.ts"],"sourcesContent":["import type { VerbosityLevel } from '@botonic/core'\nimport type { HtInputGuardrailRule } from './ai-agent'\nimport type { HtBaseNode, HtNodeLink } from './common'\nimport type { HtNodeWithContentType } from './node-types'\n\nexport interface HtAiAgentSpecialistNode {\n id: string\n target: HtNodeLink\n name?: string\n description?: string\n}\n\nexport interface HtAiAgentRouterNode extends HtBaseNode {\n type: HtNodeWithContentType.AI_AGENT_ROUTER\n content: {\n name: string\n instructions: string\n model: string\n verbosity: VerbosityLevel\n available_specialists: HtAiAgentSpecialistNode[]\n input_guardrail_rules?: HtInputGuardrailRule[]\n }\n}\n"],"names":[],"mappings":"AAsBC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"content-fields/hubtype-fields/ai-agent.js","sources":["../../../../src/content-fields/hubtype-fields/ai-agent.ts"],"sourcesContent":["import type { VerbosityLevel } from '@botonic/core'\nimport type { HtBaseNode } from './common'\nimport type { HtNodeWithContentType } from './node-types'\n\nexport interface HtInputGuardrailRule {\n name: string\n description: string\n is_active: boolean\n}\n\nexport interface HtAiAgentNode extends HtBaseNode {\n type: HtNodeWithContentType.AI_AGENT\n content: {\n name: string\n instructions: string\n model: string\n verbosity: VerbosityLevel\n active_tools?: { name: string }[]\n input_guardrail_rules?: HtInputGuardrailRule[]\n sources?: { id: string; name: string }[]\n }\n}\n"],"names":[],"mappings":"AAqBC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"content-fields/hubtype-fields/bot-action.js","sources":["../../../../src/content-fields/hubtype-fields/bot-action.ts"],"sourcesContent":["import type { HtBaseNode } from './common'\nimport type { HtNodeWithContentType } from './node-types'\n\nexport interface HtBotActionNode extends HtBaseNode {\n id: string\n type: HtNodeWithContentType.BOT_ACTION\n content: {\n payload_id: string\n payload_params?: string\n }\n}\n"],"names":[],"mappings":"AAUC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"content-fields/hubtype-fields/button.js","sources":["../../../../src/content-fields/hubtype-fields/button.ts"],"sourcesContent":["import type { HtNodeLink, HtTextLocale, HtUrlLocale } from './common'\n\nexport interface HtButton {\n id: string\n text: HtTextLocale[]\n url: HtUrlLocale[]\n target?: HtNodeLink\n hidden: string[]\n}\n"],"names":[],"mappings":"AAQC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"content-fields/hubtype-fields/capture-user-input.js","sources":["../../../../src/content-fields/hubtype-fields/capture-user-input.ts"],"sourcesContent":["import type { HtBaseNode, HtNodeLink } from './common'\nimport type { HtNodeWithContentType } from './node-types'\n\nexport enum HtAiValidationType {\n NONE = 'none',\n NAME = 'name',\n EMAIL = 'email',\n PHONE = 'phone',\n CUSTOM = 'custom',\n}\n\nexport interface HtCaptureUserInputNode extends HtBaseNode {\n type: HtNodeWithContentType.CAPTURE_USER_INPUT\n content: {\n field_name: string\n ai_validation_type?: HtAiValidationType\n ai_validation_instructions?: string\n capture_success: HtNodeLink\n capture_fail: HtNodeLink\n }\n}\n"],"names":["HtAiValidationType"],"mappings":"AAGO,IAAKA,qCAAkBA,0BAAlBA;;;;;;WAAAA;MAMX"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"content-fields/hubtype-fields/carousel.js","sources":["../../../../src/content-fields/hubtype-fields/carousel.ts"],"sourcesContent":["import type { HtButton } from './button'\nimport type { HtBaseNode, HtMediaFileLocale, HtTextLocale } from './common'\nimport type { HtNodeWithContentType } from './node-types'\n\nexport interface HtCarouselElement {\n id: string\n title: HtTextLocale[]\n subtitle: HtTextLocale[]\n image: HtMediaFileLocale[]\n button: HtButton\n}\n\nexport interface HtCarouselNode extends HtBaseNode {\n type: HtNodeWithContentType.CAROUSEL\n content: {\n whatsapp_text: HtTextLocale[]\n elements: HtCarouselElement[]\n }\n}\n"],"names":[],"mappings":"AAkBC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"content-fields/hubtype-fields/channel-conditional.js","sources":["../../../../src/content-fields/hubtype-fields/channel-conditional.ts"],"sourcesContent":["import type { HtBaseNode } from './common'\nimport type { HtFunctionResult } from './function'\nimport type { HtNodeWithContentType } from './node-types'\n\nexport interface HtChannelConditionalNode extends HtBaseNode {\n type: HtNodeWithContentType.FUNCTION\n content: {\n action: string //'get-channel-type'\n result_mapping: HtFunctionResult[]\n }\n}\n"],"names":[],"mappings":"AAUC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"content-fields/hubtype-fields/common.js","sources":["../../../../src/content-fields/hubtype-fields/common.ts"],"sourcesContent":["import type {\n HtNodeWithContentType,\n HtNodeWithoutContentType,\n} from './node-types'\nimport type { HtNodeComponent } from './nodes'\n\nexport interface HtFlowBuilderData {\n version: string\n name: string\n locales: string[]\n default_locale_code: string\n start_node_id?: string\n ai_model_id?: string\n is_ai_agent_active?: boolean\n nodes: HtNodeComponent[]\n flows: HtFlows[]\n webviews: HtFlowWebview[]\n campaigns: HtCampaign[]\n bot_variable_definitions: HtBotVariableDefinition[]\n}\n\nexport interface HtFlows {\n id: string\n name: string\n start_node_id: string\n}\n\nexport interface HtFlowWebview {\n id: string\n name: string\n component_name: string\n}\n\nexport interface HtCampaign {\n id: string\n name: string\n start_node_id: string\n}\n\nexport interface HtBotVariableDefinition {\n key_path: string\n is_from_bot_config: boolean\n type?: string\n}\n\nexport interface HtNodeLink {\n id: string\n type: HtNodeWithContentType | HtNodeWithoutContentType\n}\n\nexport interface HtBaseNode {\n id: string\n code: string\n meta: {\n x: number\n y: number\n }\n follow_up?: HtNodeLink\n target?: HtNodeLink\n flow_id: string // TODO: Review if this field is necessary in all HtBaseNode\n is_meaningful?: boolean\n}\n\nexport interface HtTextLocale {\n message: string\n locale: string\n}\n\nexport interface HtMediaFileLocale {\n id: string\n file: string\n locale: string\n}\n\nexport interface HtVideoLocale {\n url: string\n is_embedded: boolean\n locale: string\n}\n\nexport interface HtQueueLocale {\n id: string\n name: string\n locale: string\n}\n\nexport interface HtInputLocale {\n values: string[]\n locale: string\n}\n\nexport interface HtUrlLocale {\n id: string\n locale: string\n}\n\nexport interface HtPayloadLocale {\n id: string\n locale: string\n}\n"],"names":[],"mappings":"AAmGC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"content-fields/hubtype-fields/country-conditional.js","sources":["../../../../src/content-fields/hubtype-fields/country-conditional.ts"],"sourcesContent":["import type { HtBaseNode } from './common'\nimport type { HtFunctionResult } from './function'\nimport type { HtNodeWithContentType } from './node-types'\n\nexport interface HtCountryConditionalNode extends HtBaseNode {\n type: HtNodeWithContentType.FUNCTION\n content: {\n action: string //'check-country'\n result_mapping: HtFunctionResult[]\n }\n}\n"],"names":[],"mappings":"AAUC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"content-fields/hubtype-fields/custom-conditional-v2.js","sources":["../../../../src/content-fields/hubtype-fields/custom-conditional-v2.ts"],"sourcesContent":["import type { HtBaseNode, HtNodeLink } from './common'\nimport type { HtNodeWithContentType } from './node-types'\n\nexport enum VariableFormat {\n Boolean = 'boolean',\n Number = 'number',\n String = 'string',\n}\n\nexport enum StringConditionOperator {\n Contains = 'contains',\n NotContains = 'notContains',\n EqualsTo = 'equalsTo',\n NotEqualsTo = 'notEqualsTo',\n StartsWith = 'startsWith',\n NotStartsWith = 'notStartsWith',\n EndsWith = 'endsWith',\n NotEndsWith = 'notEndsWith',\n}\n\nexport interface HtStringCondition {\n operator: StringConditionOperator\n value?: string\n target?: HtNodeLink\n}\n\nexport enum NumberConditionOperator {\n EqualsTo = 'equalsTo',\n NotEqualsTo = 'notEqualsTo',\n GreaterThan = 'greaterThan',\n LessThan = 'lessThan',\n GreaterThanOrEqualTo = 'greaterThanOrEqualTo',\n LessThanOrEqualTo = 'lessThanOrEqualTo',\n Between = 'between',\n NotBetween = 'notBetween',\n}\n\nexport interface HtNumberCondition {\n operator: NumberConditionOperator\n value?: number\n min?: number\n max?: number\n target?: HtNodeLink\n}\n\nexport enum BooleanConditionOperator {\n IsTruthy = 'isTruthy',\n}\n\nexport interface HtBooleanCondition {\n operator: BooleanConditionOperator\n target?: HtNodeLink\n}\n\nexport type HtCondition =\n | HtStringCondition\n | HtNumberCondition\n | HtBooleanCondition\n\nexport interface HtCustomConditionalV2Node extends HtBaseNode {\n type: HtNodeWithContentType.CUSTOM_CONDITION\n content: {\n type: VariableFormat\n key_path: string\n conditions: HtCondition[]\n default_target: HtNodeLink\n }\n}\n"],"names":["VariableFormat","StringConditionOperator","NumberConditionOperator","BooleanConditionOperator"],"mappings":"AAGO,IAAKA,oCAAcA,0BAAdA;;;;WAAAA;MAIX;AAEM,IAAKC,6CAAuBA,0BAAvBA;;;;;;;;;WAAAA;MASX;AAQM,IAAKC,6CAAuBA,0BAAvBA;;;;;;;;;WAAAA;MASX;AAUM,IAAKC,8CAAwBA,0BAAxBA;;WAAAA;MAEX"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"content-fields/hubtype-fields/custom-conditional.js","sources":["../../../../src/content-fields/hubtype-fields/custom-conditional.ts"],"sourcesContent":["import type { HtBaseNode } from './common'\nimport type { HtFunctionArguments, HtFunctionResult } from './function'\nimport type { HtNodeWithContentType } from './node-types'\n\nexport interface HtCustomConditionalNode extends HtBaseNode {\n type: HtNodeWithContentType.FUNCTION\n content: {\n action: string //'check-bot-variable'\n arguments: HtFunctionArguments[]\n result_mapping: HtFunctionResult[]\n }\n}\n"],"names":[],"mappings":"AAWC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"content-fields/hubtype-fields/fallback.js","sources":["../../../../src/content-fields/hubtype-fields/fallback.ts"],"sourcesContent":["import type { HtBaseNode, HtNodeLink } from './common'\nimport type { HtNodeWithContentType } from './node-types'\n\nexport interface HtFallbackNode extends HtBaseNode {\n type: HtNodeWithContentType.FALLBACK\n content: {\n first_message?: HtNodeLink\n second_message?: HtNodeLink\n }\n}\n"],"names":[],"mappings":"AASC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"content-fields/hubtype-fields/function.js","sources":["../../../../src/content-fields/hubtype-fields/function.ts"],"sourcesContent":["import type { HtBaseNode, HtNodeLink } from './common'\nimport type { HtNodeWithContentType } from './node-types'\n\nexport enum HtArgumentType {\n BOOLEAN = 'boolean',\n NUMBER = 'number',\n STRING = 'string',\n JSON = 'json',\n}\n\nexport interface HtFunctionArgument {\n type: HtArgumentType\n name: string\n value: string\n}\n\nexport interface HtFunctionArgumentLocale {\n locale: string\n values: HtFunctionArgument[]\n}\n\nexport interface HtFunctionResult {\n result: string | boolean | number\n target?: HtNodeLink\n}\n\nexport type HtFunctionArguments = HtFunctionArgumentLocale | HtFunctionArgument\n\nexport interface HtFunctionNode extends HtBaseNode {\n type: HtNodeWithContentType.FUNCTION\n content: {\n action: string\n arguments: HtFunctionArguments[]\n result_mapping: HtFunctionResult[]\n }\n}\n"],"names":["HtArgumentType"],"mappings":"AAGO,IAAKA,uBAAcA,0BAAdA;;;;;WAAAA;MAKX"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"content-fields/hubtype-fields/go-to-flow.js","sources":["../../../../src/content-fields/hubtype-fields/go-to-flow.ts"],"sourcesContent":["import type { HtBaseNode } from './common'\nimport type { HtNodeWithContentType } from './node-types'\n\nexport interface HtGoToFlow extends HtBaseNode {\n id: string\n type: HtNodeWithContentType.GO_TO_FLOW\n content: {\n flow_id: string\n }\n}\n"],"names":[],"mappings":"AASC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"content-fields/hubtype-fields/handoff.js","sources":["../../../../src/content-fields/hubtype-fields/handoff.ts"],"sourcesContent":["import type { HtBaseNode, HtPayloadLocale, HtQueueLocale } from './common'\nimport type { HtNodeWithContentType } from './node-types'\n\nexport interface HtHandoffNode extends HtBaseNode {\n type: HtNodeWithContentType.HANDOFF\n content: {\n queue: HtQueueLocale[]\n payload: HtPayloadLocale[]\n has_auto_assign: boolean\n has_queue_position_changed_notifications_enabled: boolean\n }\n}\n"],"names":[],"mappings":"AAWC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"content-fields/hubtype-fields/image.js","sources":["../../../../src/content-fields/hubtype-fields/image.ts"],"sourcesContent":["import type { HtBaseNode, HtMediaFileLocale } from './common'\nimport type { HtNodeWithContentType } from './node-types'\n\nexport interface HtImageNode extends HtBaseNode {\n type: HtNodeWithContentType.IMAGE\n content: {\n image: HtMediaFileLocale[]\n }\n}\n"],"names":[],"mappings":"AAQC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"content-fields/hubtype-fields/index.js","sources":["../../../../src/content-fields/hubtype-fields/index.ts"],"sourcesContent":["export * from './ai-agent'\nexport * from './ai-agent-router'\nexport * from './bot-action'\nexport * from './button'\nexport * from './capture-user-input'\nexport * from './carousel'\nexport * from './common'\nexport * from './custom-conditional-v2'\nexport * from './fallback'\nexport * from './function'\nexport * from './go-to-flow'\nexport * from './handoff'\nexport * from './image'\nexport * from './keyword'\nexport * from './node-types'\nexport * from './nodes'\nexport * from './payload'\nexport * from './rating'\nexport * from './smart-intent'\nexport * from './text'\nexport * from './url'\nexport * from './video'\nexport * from './webview'\nexport * from './whatsapp-button-list'\nexport * from './whatsapp-cta-url-button'\nexport * from './whatsapp-request-contact-info'\nexport * from './whatsapp-template'\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAA0B;AACO;AACL;AACJ;AACY;AACV;AACF;AACe;AACb;AACA;AACE;AACH;AACF;AACE;AACG;AACL;AACE;AACD;AACM;AACR;AACD;AACE;AACE;AACa;AACG;AACM;AACZ"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"content-fields/hubtype-fields/keyword.js","sources":["../../../../src/content-fields/hubtype-fields/keyword.ts"],"sourcesContent":["import type { HtBaseNode, HtInputLocale, HtTextLocale } from './common'\nimport type { HtNodeWithContentType } from './node-types'\n\nexport interface HtKeywordNode extends HtBaseNode {\n type: HtNodeWithContentType.KEYWORD\n content: {\n title: HtTextLocale[]\n keywords: HtInputLocale[]\n }\n}\n"],"names":[],"mappings":"AASC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"content-fields/hubtype-fields/node-types.js","sources":["../../../../src/content-fields/hubtype-fields/node-types.ts"],"sourcesContent":["export enum HtNodeWithContentType {\n CAROUSEL = 'carousel',\n HANDOFF = 'handoff',\n IMAGE = 'image',\n TEXT = 'text',\n KEYWORD = 'keyword',\n SMART_INTENT = 'smart-intent',\n FUNCTION = 'function',\n FALLBACK = 'fallback',\n VIDEO = 'video',\n WHATSAPP_BUTTON_LIST = 'whatsapp-button-list',\n WHATSAPP_CTA_URL_BUTTON = 'whatsapp-cta-url-button',\n WHATSAPP_REQUEST_CONTACT_INFO = 'whatsapp-request-contact-info',\n WHATSAPP_TEMPLATE = 'whatsapp-template',\n BOT_ACTION = 'bot-action',\n AI_AGENT = 'ai-agent',\n AI_AGENT_ROUTER = 'ai-agent-router',\n RATING = 'rating',\n WEBVIEW = 'webview',\n GO_TO_FLOW = 'go-to-flow',\n CAPTURE_USER_INPUT = 'capture-user-input',\n CUSTOM_CONDITION = 'custom-condition',\n}\n\nexport enum HtNodeWithoutContentType {\n URL = 'url',\n PAYLOAD = 'payload',\n}\n\nexport enum HtButtonStyle {\n BUTTON = 'button',\n QUICK_REPLY = 'quick-reply',\n}\n"],"names":["HtNodeWithContentType","HtNodeWithoutContentType","HtButtonStyle"],"mappings":"AAAO,IAAKA,gCAAqBA,0BAArBA;;;;;;;;;;;;;;;;;;;;;;WAAAA;MAsBX;AAEM,IAAKC,mCAAwBA,0BAAxBA;;;WAAAA;MAGX;AAEM,IAAKC,wBAAaA,0BAAbA;;;WAAAA;MAGX"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"content-fields/hubtype-fields/nodes.js","sources":["../../../../src/content-fields/hubtype-fields/nodes.ts"],"sourcesContent":["import type { HtAiAgentNode } from './ai-agent'\nimport type { HtAiAgentRouterNode } from './ai-agent-router'\nimport type { HtBotActionNode } from './bot-action'\nimport type { HtCaptureUserInputNode } from './capture-user-input'\nimport type { HtCarouselNode } from './carousel'\nimport type { HtCustomConditionalV2Node } from './custom-conditional-v2'\n// import { HtChannelConditionalNode } from './channel-conditional'\n// import { HtCountryConditionalNode } from './country-conditional'\n// import { HtCustomConditionalNode } from './custom-conditional'\nimport type { HtFallbackNode } from './fallback'\nimport type { HtFunctionNode } from './function'\nimport type { HtGoToFlow } from './go-to-flow'\nimport type { HtHandoffNode } from './handoff'\nimport type { HtImageNode } from './image'\nimport type { HtKeywordNode } from './keyword'\nimport type { HtPayloadNode } from './payload'\n// import { HtQueueStatusConditionalNode } from './queue-status-conditional'\nimport type { HtRatingNode } from './rating'\nimport type { HtSmartIntentNode } from './smart-intent'\nimport type { HtTextNode } from './text'\nimport type { HtUrlNode } from './url'\nimport type { HtVideoNode } from './video'\nimport type { HtWebviewNode } from './webview'\nimport type { HtWhatsappButtonListNode } from './whatsapp-button-list'\nimport type { HtWhatsappCTAUrlButtonNode } from './whatsapp-cta-url-button'\nimport type { HtWhatsappRequestContactInfoNode } from './whatsapp-request-contact-info'\nimport type { HtWhatsappTemplateNode } from './whatsapp-template'\n\nexport type HtNodeWithContent =\n | HtTextNode\n | HtImageNode\n | HtVideoNode\n | HtCarouselNode\n | HtHandoffNode\n | HtKeywordNode\n | HtFunctionNode\n | HtFallbackNode\n | HtWhatsappButtonListNode\n | HtWhatsappCTAUrlButtonNode\n | HtWhatsappRequestContactInfoNode\n | HtSmartIntentNode\n | HtBotActionNode\n | HtAiAgentNode\n | HtAiAgentRouterNode\n | HtRatingNode\n | HtWebviewNode\n | HtGoToFlow\n | HtWhatsappTemplateNode\n | HtCaptureUserInputNode\n | HtCustomConditionalV2Node\n// | HtChannelConditionalNode\n// | HtCountryConditionalNode\n// | HtCustomConditionalNode\n// | HtQueueStatusConditionalNode\n\nexport type HtNodeWithoutContent = HtUrlNode | HtPayloadNode\n\nexport type HtNodeComponent = HtNodeWithContent | HtNodeWithoutContent\n"],"names":[],"mappings":"AAyDsE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"content-fields/hubtype-fields/payload.js","sources":["../../../../src/content-fields/hubtype-fields/payload.ts"],"sourcesContent":["import type { HtNodeWithoutContentType } from './node-types'\n\nexport interface HtPayloadNode {\n id: string\n type: HtNodeWithoutContentType.PAYLOAD\n content: {\n payload: string\n }\n}\n"],"names":[],"mappings":"AAQC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"content-fields/hubtype-fields/queue-status-conditional.js","sources":["../../../../src/content-fields/hubtype-fields/queue-status-conditional.ts"],"sourcesContent":["import type { HtBaseNode, HtNodeLink } from './common'\nimport type { HtFunctionArguments, HtFunctionResult } from './function'\nimport type { HtNodeWithContentType } from './node-types'\n\n/* TODO: In the future, refactor the conditional nodes so they are not of type FUNCTION and can use type-hints for all exact arguments and results. */\n\n// interface HtQueueArgument {\n// locale: string\n// values: [\n// {\n// type: 'string'\n// name: 'queue_id'\n// value: string\n// },\n// {\n// type: 'string'\n// name: 'queue_name'\n// value: string\n// },\n// ]\n// }\n\n// interface HtCheckAvailableAgentsArgument {\n// type: 'boolean'\n// name: 'check_available_agents'\n// value: boolean\n// }\n\n// export interface HtQueueStatusConditionalArguments {\n// values: HtQueueArgument[] | HtCheckAvailableAgentsArgument[]\n// }\n\nexport type HtQueueStatusConditionalResultMapping = [\n {\n result: 'open'\n target: HtNodeLink\n },\n {\n result: 'closed'\n target: HtNodeLink\n },\n {\n result: 'open-without-agents'\n target: HtNodeLink\n },\n]\n\nexport interface HtQueueStatusConditionalNode extends HtBaseNode {\n type: HtNodeWithContentType.FUNCTION\n content: {\n action: string //'get-channel-type'\n arguments: HtFunctionArguments[]\n result_mapping: HtFunctionResult[]\n }\n}\n"],"names":[],"mappings":"AAsDC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"content-fields/hubtype-fields/rating.js","sources":["../../../../src/content-fields/hubtype-fields/rating.ts"],"sourcesContent":["import type { HtBaseNode, HtNodeLink, HtTextLocale } from './common'\nimport type { HtNodeWithContentType } from './node-types'\n\nexport enum RatingType {\n Stars = 'stars',\n Smileys = 'smileys',\n}\n\nexport interface HtRatingButton {\n id: string\n text: string\n payload: string\n value: number\n target?: HtNodeLink\n}\n\nexport interface HtRatingNode extends HtBaseNode {\n type: HtNodeWithContentType.RATING\n content: {\n text: HtTextLocale[]\n buttons: HtRatingButton[]\n rating_type: RatingType\n send_button_text: HtTextLocale[]\n open_list_button_text: HtTextLocale[]\n }\n}\n"],"names":["RatingType"],"mappings":"AAGO,IAAKA,iBAAUA,0BAAVA;;;WAAAA;MAGX"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"content-fields/hubtype-fields/smart-intent.js","sources":["../../../../src/content-fields/hubtype-fields/smart-intent.ts"],"sourcesContent":["import type { HtBaseNode } from './common'\nimport type { HtNodeWithContentType } from './node-types'\n\ninterface SmartIntent {\n title: string\n description: string\n is_active?: boolean\n}\n\nexport interface HtSmartIntentNode extends HtBaseNode {\n type: HtNodeWithContentType.SMART_INTENT\n content: SmartIntent\n}\n"],"names":[],"mappings":"AAYC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"content-fields/hubtype-fields/text.js","sources":["../../../../src/content-fields/hubtype-fields/text.ts"],"sourcesContent":["import type { HtButton } from './button'\nimport type { HtBaseNode, HtTextLocale } from './common'\nimport type { HtButtonStyle, HtNodeWithContentType } from './node-types'\n\nexport interface HtTextNode extends HtBaseNode {\n type: HtNodeWithContentType.TEXT\n content: {\n text: HtTextLocale[]\n buttons_style?: HtButtonStyle\n buttons: HtButton[]\n }\n}\n"],"names":[],"mappings":"AAWC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"content-fields/hubtype-fields/url.js","sources":["../../../../src/content-fields/hubtype-fields/url.ts"],"sourcesContent":["import type { HtNodeWithoutContentType } from './node-types'\n\nexport interface HtUrlNode {\n id: string\n type: HtNodeWithoutContentType.URL\n content: {\n url: string\n }\n}\n"],"names":[],"mappings":"AAQC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"content-fields/hubtype-fields/video.js","sources":["../../../../src/content-fields/hubtype-fields/video.ts"],"sourcesContent":["import type { HtBaseNode, HtVideoLocale } from './common'\nimport type { HtNodeWithContentType } from './node-types'\n\nexport interface HtVideoNode extends HtBaseNode {\n type: HtNodeWithContentType.VIDEO\n content: {\n video: HtVideoLocale[]\n }\n}\n"],"names":[],"mappings":"AAQC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"content-fields/hubtype-fields/webview.js","sources":["../../../../src/content-fields/hubtype-fields/webview.ts"],"sourcesContent":["import type { HtBaseNode, HtNodeLink } from './common'\nimport type { HtNodeWithContentType } from './node-types'\n\nexport interface HtWebviewExits {\n id: string\n name: string\n target?: HtNodeLink\n}\n\nexport interface HtWebviewNode extends HtBaseNode {\n type: HtNodeWithContentType.WEBVIEW\n content: {\n webview_target_id: string\n webview_name: string\n webview_component_name: string\n webview_params: Record<string, string>\n exits: HtWebviewExits[]\n }\n}\n"],"names":[],"mappings":"AAkBC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"content-fields/hubtype-fields/whatsapp-button-list.js","sources":["../../../../src/content-fields/hubtype-fields/whatsapp-button-list.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\nimport type { HtBaseNode, HtNodeLink, HtTextLocale } from './common'\nimport type { HtNodeWithContentType } from './node-types'\n\nexport interface HtWhatsappButtonListRow {\n id: string\n text: HtTextLocale[]\n description: HtTextLocale[]\n target?: HtNodeLink\n}\n\nexport interface HtWhatsappButtonListSection {\n id: string\n title: HtTextLocale[]\n rows: HtWhatsappButtonListRow[]\n}\n\nexport interface HtWhatsappButtonListNode extends HtBaseNode {\n type: HtNodeWithContentType.WHATSAPP_BUTTON_LIST\n content: {\n text: HtTextLocale[]\n button_text: HtTextLocale[]\n sections: HtWhatsappButtonListSection[]\n }\n}\n"],"names":[],"mappings":"AAAA,uDAAuD,GAwBtD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"content-fields/hubtype-fields/whatsapp-cta-url-button.js","sources":["../../../../src/content-fields/hubtype-fields/whatsapp-cta-url-button.ts"],"sourcesContent":["import type { WhatsappCTAUrlHeaderType } from '@botonic/react'\n\nimport type { HtButton } from './button'\nimport type { HtBaseNode, HtMediaFileLocale, HtTextLocale } from './common'\nimport type { HtNodeWithContentType } from './node-types'\n\nexport interface HtWhatsappCTAUrlButtonNode extends HtBaseNode {\n type: HtNodeWithContentType.WHATSAPP_CTA_URL_BUTTON\n content: {\n text: HtTextLocale[]\n header: HtTextLocale[]\n header_type?: WhatsappCTAUrlHeaderType\n header_image?: HtMediaFileLocale[]\n header_video?: HtMediaFileLocale[]\n header_document?: HtMediaFileLocale[]\n footer: HtTextLocale[]\n button: HtButton\n }\n}\n"],"names":[],"mappings":"AAkBC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"content-fields/hubtype-fields/whatsapp-request-contact-info.js","sources":["../../../../src/content-fields/hubtype-fields/whatsapp-request-contact-info.ts"],"sourcesContent":["import type { HtBaseNode, HtTextLocale } from './common'\nimport type { HtNodeWithContentType } from './node-types'\n\nexport interface HtWhatsappRequestContactInfoNode extends HtBaseNode {\n type: HtNodeWithContentType.WHATSAPP_REQUEST_CONTACT_INFO\n content: {\n text: HtTextLocale[]\n }\n}\n"],"names":[],"mappings":"AAQC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"content-fields/hubtype-fields/whatsapp-template.js","sources":["../../../../src/content-fields/hubtype-fields/whatsapp-template.ts"],"sourcesContent":["import type {\n WhatsAppTemplateButtonSubType,\n WhatsAppTemplateComponentType,\n WhatsAppTemplateParameterType,\n} from '@botonic/react'\n\nimport type { HtButton } from './button'\nimport type { HtBaseNode, HtMediaFileLocale } from './common'\nimport type { HtNodeWithContentType } from './node-types'\n\nexport enum HtWhatsAppTemplateFlowActionType {\n NAVIGATE = 'navigate',\n DATA_EXCHANGE = 'data_exchange',\n}\n\ntype HtWhatsAppTemplateButton =\n | {\n type: WhatsAppTemplateButtonSubType.URL\n text: string\n url?: string\n index: number\n }\n | {\n type: WhatsAppTemplateButtonSubType.QUICK_REPLY\n text: string\n id: string\n index: number\n }\n | {\n type: WhatsAppTemplateButtonSubType.PHONE_NUMBER\n text: string\n phone_number: string\n index: number\n }\n | {\n type: WhatsAppTemplateButtonSubType.VOICE_CALL\n text: string\n index: number\n }\n | {\n type: WhatsAppTemplateButtonSubType.REQUEST_CONTACT_INFO\n text?: string\n index: number\n }\n | {\n type: WhatsAppTemplateButtonSubType.FLOW\n text: string\n flow_id: string\n flow_action?: HtWhatsAppTemplateFlowActionType\n navigate_screen?: string\n index: number\n }\n\nexport interface HtFlowButtonActionValue {\n flow_token: string\n flow_action_data?: Record<string, string>\n}\n\nexport interface HtWhatsAppTemplateHeaderComponent {\n type: WhatsAppTemplateComponentType.HEADER\n format:\n | WhatsAppTemplateParameterType.TEXT\n | WhatsAppTemplateParameterType.IMAGE\n | WhatsAppTemplateParameterType.VIDEO\n text?: string\n image?: { link: string }\n video?: { link: string }\n}\n\nexport interface HtWhatsAppTemplateBodyComponent {\n type: WhatsAppTemplateComponentType.BODY\n text: string\n}\n\nexport interface HtWhatsAppTemplateFooterComponent {\n type: WhatsAppTemplateComponentType.FOOTER\n text: string\n}\n\nexport interface HtWhatsAppTemplateButtonsComponent {\n type: WhatsAppTemplateComponentType.BUTTONS\n buttons: HtWhatsAppTemplateButton[]\n}\nexport type HtWhatsAppTemplateComponent =\n | HtWhatsAppTemplateHeaderComponent\n | HtWhatsAppTemplateBodyComponent\n | HtWhatsAppTemplateFooterComponent\n | HtWhatsAppTemplateButtonsComponent\n\nexport interface HtWhatsAppTemplate {\n id: string\n name: string\n language: string\n status: string\n category: string\n components: HtWhatsAppTemplateComponent[]\n namespace: string\n parameter_format: string\n}\n\nexport interface HtWhatsappTemplateContentByLocale {\n template?: HtWhatsAppTemplate\n header_variables?: {\n type: WhatsAppTemplateParameterType\n text?: Record<string, string>\n media?: HtMediaFileLocale[]\n }\n variable_values?: Record<string, string>\n url_variable_values?: Record<string, string>\n flow_button_action_values?: Record<string, HtFlowButtonActionValue>\n}\n\nexport interface HtWhatsappTemplateNode extends HtBaseNode {\n type: HtNodeWithContentType.WHATSAPP_TEMPLATE\n content: {\n by_locale: Record<string, HtWhatsappTemplateContentByLocale>\n buttons: HtButton[]\n }\n}\n"],"names":["HtWhatsAppTemplateFlowActionType"],"mappings":"AAUO,IAAKA,kDAAgCA,0BAAhCA;;;WAAAA;MAGX"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"content-fields/index.js","sources":["../../../src/content-fields/index.ts"],"sourcesContent":["import { FlowCustomConditionalV2 } from './custom-conditional/flow-custom-condition-v2'\nimport { FlowAiAgent } from './flow-ai-agent'\nimport { FlowAiAgentRouter } from './flow-ai-agent-router'\nimport { FlowBotAction } from './flow-bot-action'\nimport { FlowCaptureUserInput } from './flow-capture-user-input'\nimport { FlowCarousel } from './flow-carousel'\nimport { FlowChannelConditional } from './flow-channel-conditional'\nimport { FlowCountryConditional } from './flow-country-conditional'\nimport { FlowCustomConditional } from './flow-custom-conditional'\nimport { FlowGoToFlow } from './flow-go-to-flow'\nimport { FlowHandoff } from './flow-handoff'\nimport { FlowImage } from './flow-image'\nimport { FlowQueueStatusConditional } from './flow-queue-status-conditional'\nimport { FlowRating } from './flow-rating'\nimport { FlowText } from './flow-text'\nimport { FlowVideo } from './flow-video'\nimport { FlowWhatsappCtaUrlButtonNode } from './flow-whatsapp-cta-url-button'\nimport { FlowWhatsappRequestContactInfoNode } from './flow-whatsapp-request-contact-info'\nimport { FlowWhatsappTemplate } from './flow-whatsapp-template'\nimport {\n FlowWhatsappButtonList,\n FlowWhatsappButtonListRow,\n FlowWhatsappButtonListSection,\n} from './whatsapp-button-list'\n\nexport { ContentFieldsBase } from './content-fields-base'\nexport { FlowButton } from './flow-button'\nexport { FlowElement } from './flow-element'\nexport {\n FlowAiAgentRouter,\n FlowAiAgent,\n FlowBotAction,\n FlowCaptureUserInput,\n FlowCarousel,\n FlowChannelConditional,\n FlowCountryConditional,\n FlowCustomConditional,\n FlowGoToFlow,\n FlowHandoff,\n FlowImage,\n FlowQueueStatusConditional,\n FlowRating,\n FlowText,\n FlowVideo,\n FlowWhatsappButtonList,\n FlowWhatsappButtonListRow,\n FlowWhatsappButtonListSection,\n FlowWhatsappCtaUrlButtonNode,\n FlowWhatsappRequestContactInfoNode,\n FlowWhatsappTemplate,\n FlowCustomConditionalV2,\n}\n\nexport type FlowContent =\n | FlowCarousel\n | FlowImage\n | FlowText\n | FlowVideo\n | FlowWhatsappButtonList\n | FlowWhatsappCtaUrlButtonNode\n | FlowWhatsappRequestContactInfoNode\n | FlowWhatsappTemplate\n | FlowHandoff\n | FlowBotAction\n | FlowAiAgent\n | FlowRating\n | FlowCountryConditional\n | FlowChannelConditional\n | FlowQueueStatusConditional\n | FlowCustomConditional\n | FlowGoToFlow\n | FlowCaptureUserInput\n | FlowAiAgentRouter\n | FlowCustomConditionalV2\n"],"names":["FlowCustomConditionalV2","FlowAiAgent","FlowAiAgentRouter","FlowBotAction","FlowCaptureUserInput","FlowCarousel","FlowChannelConditional","FlowCountryConditional","FlowCustomConditional","FlowGoToFlow","FlowHandoff","FlowImage","FlowQueueStatusConditional","FlowRating","FlowText","FlowVideo","FlowWhatsappCtaUrlButtonNode","FlowWhatsappRequestContactInfoNode","FlowWhatsappTemplate","FlowWhatsappButtonList","FlowWhatsappButtonListRow","FlowWhatsappButtonListSection","ContentFieldsBase","FlowButton","FlowElement"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAuF;AAC1C;AACa;AACT;AACe;AAClB;AACqB;AACA;AACF;AACjB;AACJ;AACJ;AACoC;AAClC;AACJ;AACE;AACqC;AACY;AAC1B;AAKhC;AAE0B;AACf;AACE;AAwB3C"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"content-fields/whatsapp-button-list/flow-whatsapp-button-list-row.js","sources":["../../../../src/content-fields/whatsapp-button-list/flow-whatsapp-button-list-row.tsx"],"sourcesContent":["import type { WhatsappButtonListRowProps } from '@botonic/react'\n\nimport type { FlowBuilderApi } from '../../api'\nimport { SOURCE_INFO_SEPARATOR } from '../../constants'\nimport { ContentFieldsBase } from '../content-fields-base'\nimport type { HtWhatsappButtonListRow } from '../hubtype-fields'\n\nexport class FlowWhatsappButtonListRow extends ContentFieldsBase {\n public title = ''\n public description = ''\n public targetId?: string\n\n static fromHubtypeCMS(\n component: HtWhatsappButtonListRow,\n locale: string,\n cmsApi: FlowBuilderApi\n ): FlowWhatsappButtonListRow {\n const newRow = new FlowWhatsappButtonListRow(component.id)\n newRow.title = FlowWhatsappButtonListRow.getTextByLocale(\n locale,\n component.text\n )\n newRow.description = FlowWhatsappButtonListRow.getTextByLocale(\n locale,\n component.description\n )\n newRow.targetId = cmsApi.getPayload(component.target)\n\n return newRow\n }\n\n async trackFlow(): Promise<void> {\n return\n }\n\n async processContent(): Promise<void> {\n return\n }\n\n renderRow(\n rowIndex: number,\n sectionIndex: number\n ): WhatsappButtonListRowProps | undefined {\n if (!this.targetId) {\n console.error(`Row with title: '${this.title}' has no target`)\n return undefined\n }\n return {\n id: this.getRowId(rowIndex, sectionIndex),\n title: this.title,\n description: this.description,\n }\n }\n\n private getRowId(rowIndex: number, sectionIndex: number): string {\n return `${this.targetId}${SOURCE_INFO_SEPARATOR}${sectionIndex}.${rowIndex}`\n }\n}\n"],"names":["SOURCE_INFO_SEPARATOR","ContentFieldsBase","FlowWhatsappButtonListRow","component","locale","cmsApi","newRow","rowIndex","sectionIndex","console","undefined"],"mappings":";;;;;AAGuD;AACG;AAGnD,MAAME,yBAAyBA,SAASD,iBAAiBA;IAK9D,OAAO,eACLE,SAAkC,EAClCC,MAAc,EACdC,MAAsB,EACK;QAC3B,MAAMC,SAAS,IAAIJ,yBAAyBA,CAACC,UAAU,EAAE;QACzDG,OAAO,KAAK,GAAGJ,yBAAyBA,CAAC,eAAe,CACtDE,QACAD,UAAU,IAAI;QAEhBG,OAAO,WAAW,GAAGJ,yBAAyBA,CAAC,eAAe,CAC5DE,QACAD,UAAU,WAAW;QAEvBG,OAAO,QAAQ,GAAGD,OAAO,UAAU,CAACF,UAAU,MAAM;QAEpD,OAAOG;IACT;IAEA,MAAM,YAA2B;QAC/B;IACF;IAEA,MAAM,iBAAgC;QACpC;IACF;IAEA,UACEC,QAAgB,EAChBC,YAAoB,EACoB;QACxC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;YAClBC,QAAQ,KAAK,CAAC,CAAC,iBAAiB,EAAE,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC;YAC7D,OAAOC;QACT;QACA,OAAO;YACL,IAAI,IAAI,CAAC,QAAQ,CAACH,UAAUC;YAC5B,OAAO,IAAI,CAAC,KAAK;YACjB,aAAa,IAAI,CAAC,WAAW;QAC/B;IACF;IAEQ,SAASD,QAAgB,EAAEC,YAAoB,EAAU;QAC/D,OAAO,GAAG,IAAI,CAAC,QAAQ,GAAGR,qBAAqBA,GAAGQ,aAAa,CAAC,EAAED,UAAU;IAC9E;;QAjDK,qBACE,QAAQ,SACR,cAAc;;AAgDvB"}
|
package/lib/esm/content-fields/whatsapp-button-list/flow-whatsapp-button-list-section.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"content-fields/whatsapp-button-list/flow-whatsapp-button-list-section.js","sources":["../../../../src/content-fields/whatsapp-button-list/flow-whatsapp-button-list-section.tsx"],"sourcesContent":["import type {\n WhatsappButtonListRowProps,\n WhatsappButtonListSectionProps,\n} from '@botonic/react'\n\nimport type { FlowBuilderApi } from '../../api'\nimport { ContentFieldsBase } from '../content-fields-base'\nimport type { HtWhatsappButtonListSection } from '../hubtype-fields'\nimport { FlowWhatsappButtonListRow } from './flow-whatsapp-button-list-row'\n\nexport class FlowWhatsappButtonListSection extends ContentFieldsBase {\n public title = ''\n public rows: FlowWhatsappButtonListRow[] = []\n\n static fromHubtypeCMS(\n component: HtWhatsappButtonListSection,\n locale: string,\n cmsApi: FlowBuilderApi\n ): FlowWhatsappButtonListSection {\n const newButton = new FlowWhatsappButtonListSection(component.id)\n newButton.title = FlowWhatsappButtonListSection.getTextByLocale(\n locale,\n component.title\n )\n newButton.rows = component.rows.map(row =>\n FlowWhatsappButtonListRow.fromHubtypeCMS(row, locale, cmsApi)\n )\n return newButton\n }\n\n async trackFlow(): Promise<void> {\n return\n }\n\n async processContent(): Promise<void> {\n return\n }\n\n renderSection(sectionIndex: number): WhatsappButtonListSectionProps {\n const rows = this.rows.reduce(\n (acc: WhatsappButtonListRowProps[], row, rowIndex) => {\n const botonicRow = row.renderRow(rowIndex, sectionIndex)\n if (botonicRow) {\n acc.push(botonicRow)\n }\n return acc\n },\n []\n )\n\n return { title: this.title, rows }\n }\n}\n"],"names":["ContentFieldsBase","FlowWhatsappButtonListRow","FlowWhatsappButtonListSection","component","locale","cmsApi","newButton","row","sectionIndex","rows","acc","rowIndex","botonicRow"],"mappings":";;;;;AAM0D;AAEiB;AAEpE,MAAME,6BAA6BA,SAASF,iBAAiBA;IAIlE,OAAO,eACLG,SAAsC,EACtCC,MAAc,EACdC,MAAsB,EACS;QAC/B,MAAMC,YAAY,IAAIJ,6BAA6BA,CAACC,UAAU,EAAE;QAChEG,UAAU,KAAK,GAAGJ,6BAA6BA,CAAC,eAAe,CAC7DE,QACAD,UAAU,KAAK;QAEjBG,UAAU,IAAI,GAAGH,UAAU,IAAI,CAAC,GAAG,CAACI,CAAAA,MAClCN,wCAAwC,CAACM,KAAKH,QAAQC;QAExD,OAAOC;IACT;IAEA,MAAM,YAA2B;QAC/B;IACF;IAEA,MAAM,iBAAgC;QACpC;IACF;IAEA,cAAcE,YAAoB,EAAkC;QAClE,MAAMC,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,CAC3B,CAACC,KAAmCH,KAAKI;YACvC,MAAMC,aAAaL,IAAI,SAAS,CAACI,UAAUH;YAC3C,IAAII,YAAY;gBACdF,IAAI,IAAI,CAACE;YACX;YACA,OAAOF;QACT,GACA,EAAE;QAGJ,OAAO;YAAE,OAAO,IAAI,CAAC,KAAK;YAAED;QAAK;IACnC;;QAzCK,qBACE,QAAQ,SACR,OAAoC,EAAE;;AAwC/C"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"content-fields/whatsapp-button-list/flow-whatsapp-button-list.js","sources":["../../../../src/content-fields/whatsapp-button-list/flow-whatsapp-button-list.tsx"],"sourcesContent":["import { type BotContext, isWhatsapp } from '@botonic/core'\nimport { Button, Text, WhatsappButtonList } from '@botonic/react'\n\nimport type { FlowBuilderApi } from '../../api'\nimport { trackOneContent } from '../../tracking'\nimport { ContentFieldsBase } from '../content-fields-base'\nimport type { HtWhatsappButtonListNode } from '../hubtype-fields'\nimport { FlowWhatsappButtonListSection } from './flow-whatsapp-button-list-section'\n\nexport class FlowWhatsappButtonList extends ContentFieldsBase {\n public text = ''\n public listButtonText = ''\n public sections: FlowWhatsappButtonListSection[] = []\n\n static fromHubtypeCMS(\n component: HtWhatsappButtonListNode,\n locale: string,\n cmsApi: FlowBuilderApi\n ): FlowWhatsappButtonList {\n const newWhatsappButtonList = new FlowWhatsappButtonList(component.id)\n newWhatsappButtonList.code = component.code\n newWhatsappButtonList.text = FlowWhatsappButtonList.getTextByLocale(\n locale,\n component.content.text\n )\n newWhatsappButtonList.listButtonText =\n FlowWhatsappButtonList.getTextByLocale(\n locale,\n component.content.button_text\n )\n newWhatsappButtonList.sections = component.content.sections.map(section =>\n FlowWhatsappButtonListSection.fromHubtypeCMS(section, locale, cmsApi)\n )\n newWhatsappButtonList.followUp = component.follow_up\n\n return newWhatsappButtonList\n }\n\n async trackFlow(botContext: BotContext): Promise<void> {\n await trackOneContent(botContext, this)\n }\n\n async processContent(botContext: BotContext): Promise<void> {\n await this.trackFlow(botContext)\n await this.filterContent(botContext, this)\n return\n }\n\n toBotonic(botContext: BotContext): JSX.Element {\n const replacedText = this.replaceVariables(this.text, botContext)\n\n if (!isWhatsapp(botContext.session)) {\n const rows = this.sections.flatMap(section => section.rows)\n const buttons = rows.map(row => (\n <Button key={row.id} payload={row.targetId}>\n {row.title}\n </Button>\n ))\n\n return (\n <Text>\n {replacedText}\n {buttons}\n </Text>\n )\n }\n\n return (\n <WhatsappButtonList\n key={this.id}\n body={replacedText}\n button={this.listButtonText}\n sections={this.sections.map((section, sectionIndex) =>\n section.renderSection(sectionIndex)\n )}\n />\n )\n }\n}\n"],"names":["isWhatsapp","Button","Text","WhatsappButtonList","trackOneContent","ContentFieldsBase","FlowWhatsappButtonListSection","FlowWhatsappButtonList","component","locale","cmsApi","newWhatsappButtonList","section","botContext","replacedText","rows","buttons","row","sectionIndex"],"mappings":";;;;;;;;;;;;;;AAA2D;AACM;AAGjB;AACU;AAEyB;AAE5E,MAAMO,sBAAsBA,SAASF,iBAAiBA;IAK3D,OAAO,eACLG,SAAmC,EACnCC,MAAc,EACdC,MAAsB,EACE;QACxB,MAAMC,wBAAwB,IAAIJ,sBAAsBA,CAACC,UAAU,EAAE;QACrEG,sBAAsB,IAAI,GAAGH,UAAU,IAAI;QAC3CG,sBAAsB,IAAI,GAAGJ,sBAAsBA,CAAC,eAAe,CACjEE,QACAD,UAAU,OAAO,CAAC,IAAI;QAExBG,sBAAsB,cAAc,GAClCJ,sBAAsBA,CAAC,eAAe,CACpCE,QACAD,UAAU,OAAO,CAAC,WAAW;QAEjCG,sBAAsB,QAAQ,GAAGH,UAAU,OAAO,CAAC,QAAQ,CAAC,GAAG,CAACI,CAAAA,UAC9DN,4CAA4C,CAACM,SAASH,QAAQC;QAEhEC,sBAAsB,QAAQ,GAAGH,UAAU,SAAS;QAEpD,OAAOG;IACT;IAEA,MAAM,UAAUE,UAAsB,EAAiB;QACrD,MAAMT,eAAeA,CAACS,YAAY,IAAI;IACxC;IAEA,MAAM,eAAeA,UAAsB,EAAiB;QAC1D,MAAM,IAAI,CAAC,SAAS,CAACA;QACrB,MAAM,IAAI,CAAC,aAAa,CAACA,YAAY,IAAI;QACzC;IACF;IAEA,UAAUA,UAAsB,EAAe;QAC7C,MAAMC,eAAe,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,EAAED;QAEtD,IAAI,CAACb,UAAUA,CAACa,WAAW,OAAO,GAAG;YACnC,MAAME,OAAO,IAAI,CAAC,QAAQ,CAAC,OAAO,CAACH,CAAAA,UAAWA,QAAQ,IAAI;YAC1D,MAAMI,UAAUD,KAAK,GAAG,CAACE,CAAAA,oBACvB,IAAChB,MAAMA;oBAAc,SAASgB,IAAI,QAAQ;8BACvCA,IAAI,KAAK;mBADCA,IAAI,EAAE;YAKrB,qBACE,KAACf,IAAIA;;oBACFY;oBACAE;;;QAGP;QAEA,qBACE,IAACb,kBAAkBA;YAEjB,MAAMW;YACN,QAAQ,IAAI,CAAC,cAAc;YAC3B,UAAU,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAACF,SAASM,eACpCN,QAAQ,aAAa,CAACM;WAJnB,IAAI,CAAC,EAAE;IAQlB;;QApEK,qBACE,OAAO,SACP,iBAAiB,SACjB,WAA4C,EAAE;;AAkEvD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"content-fields/whatsapp-button-list/index.js","sources":["../../../../src/content-fields/whatsapp-button-list/index.ts"],"sourcesContent":["export { FlowWhatsappButtonList } from './flow-whatsapp-button-list'\nexport { FlowWhatsappButtonListRow } from './flow-whatsapp-button-list-row'\nexport { FlowWhatsappButtonListSection } from './flow-whatsapp-button-list-section'\n"],"names":["FlowWhatsappButtonList","FlowWhatsappButtonListRow","FlowWhatsappButtonListSection"],"mappings":";;;AAAoE;AACO;AACQ"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"filters/index.js","sources":["../../../src/filters/index.ts"],"sourcesContent":["import type { BotContext } from '@botonic/core'\n\nimport type { FlowContent } from '../content-fields'\nimport type { ContentFilter } from '../types'\n\ninterface ContentFilterExecutorOptions {\n filters: ContentFilter[]\n}\n\nexport class ContentFilterExecutor {\n private filters: ContentFilter[] = []\n\n constructor(options: ContentFilterExecutorOptions) {\n this.filters = options.filters\n }\n\n async filter(\n request: BotContext,\n content: FlowContent\n ): Promise<FlowContent> {\n for (const filter of this.filters) {\n content = await filter(request, content)\n }\n\n return content\n }\n}\n"],"names":["ContentFilterExecutor","request","content","filter","options"],"mappings":"AASO,MAAMA,qBAAqBA;IAOhC,MAAM,OACJC,OAAmB,EACnBC,OAAoB,EACE;QACtB,KAAK,MAAMC,UAAU,IAAI,CAAC,OAAO,CAAE;YACjCD,UAAU,MAAMC,OAAOF,SAASC;QAClC;QAEA,OAAOA;IACT;IAbA,YAAYE,OAAqC,CAAE;aAF3C,UAA2B,EAAE;QAGnC,IAAI,CAAC,OAAO,GAAGA,QAAQ,OAAO;IAChC;AAYF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"flow-factory.js","sources":["../../src/flow-factory.ts"],"sourcesContent":["import type { BotContext } from '@botonic/core'\n\nimport type { FlowBuilderApi } from './api'\nimport {\n FlowAiAgent,\n FlowAiAgentRouter,\n FlowBotAction,\n FlowCarousel,\n FlowChannelConditional,\n type FlowContent,\n FlowCountryConditional,\n FlowCustomConditional,\n FlowCustomConditionalV2,\n FlowGoToFlow,\n FlowHandoff,\n FlowImage,\n FlowQueueStatusConditional,\n FlowRating,\n FlowText,\n FlowVideo,\n FlowWhatsappButtonList,\n FlowWhatsappCtaUrlButtonNode,\n FlowWhatsappRequestContactInfoNode,\n FlowWhatsappTemplate,\n} from './content-fields'\nimport { FlowCaptureUserInput } from './content-fields/flow-capture-user-input'\nimport {\n type HtFunctionNode,\n type HtNodeComponent,\n HtNodeWithContentType,\n} from './content-fields/hubtype-fields'\n\nexport class FlowFactory {\n public botContext: BotContext\n public cmsApi: FlowBuilderApi\n public locale: string\n\n constructor(botContext: BotContext, cmsApi: FlowBuilderApi, locale: string) {\n this.botContext = botContext\n this.cmsApi = cmsApi\n this.locale = locale\n }\n\n async getFlowContent(\n hubtypeContent: HtNodeComponent\n ): Promise<FlowContent | undefined> {\n switch (hubtypeContent.type) {\n case HtNodeWithContentType.TEXT:\n return FlowText.fromHubtypeCMS(\n hubtypeContent,\n this.locale,\n this.cmsApi,\n this.botContext\n )\n case HtNodeWithContentType.IMAGE:\n return FlowImage.fromHubtypeCMS(hubtypeContent, this.locale)\n case HtNodeWithContentType.CAROUSEL:\n return FlowCarousel.fromHubtypeCMS(\n hubtypeContent,\n this.locale,\n this.cmsApi,\n this.botContext\n )\n case HtNodeWithContentType.VIDEO:\n return FlowVideo.fromHubtypeCMS(hubtypeContent, this.locale)\n case HtNodeWithContentType.WHATSAPP_BUTTON_LIST:\n return FlowWhatsappButtonList.fromHubtypeCMS(\n hubtypeContent,\n this.locale,\n this.cmsApi\n )\n case HtNodeWithContentType.WHATSAPP_CTA_URL_BUTTON:\n return FlowWhatsappCtaUrlButtonNode.fromHubtypeCMS(\n hubtypeContent,\n this.locale,\n this.cmsApi,\n this.botContext\n )\n case HtNodeWithContentType.WHATSAPP_REQUEST_CONTACT_INFO:\n return FlowWhatsappRequestContactInfoNode.fromHubtypeCMS(\n hubtypeContent,\n this.locale\n )\n case HtNodeWithContentType.HANDOFF:\n return FlowHandoff.fromHubtypeCMS(\n hubtypeContent,\n this.locale,\n this.cmsApi\n )\n\n case HtNodeWithContentType.AI_AGENT_ROUTER:\n return FlowAiAgentRouter.fromHubtypeCMS(hubtypeContent, this.botContext)\n\n case HtNodeWithContentType.AI_AGENT:\n return FlowAiAgent.fromHubtypeCMS(hubtypeContent, this.botContext)\n\n case HtNodeWithContentType.RATING:\n return FlowRating.fromHubtypeCMS(hubtypeContent, this.locale)\n\n case HtNodeWithContentType.BOT_ACTION:\n return FlowBotAction.fromHubtypeCMS(hubtypeContent, this.cmsApi)\n\n case HtNodeWithContentType.FUNCTION:\n return this.resolveFlowFunctionContent(hubtypeContent)\n\n case HtNodeWithContentType.GO_TO_FLOW:\n return FlowGoToFlow.fromHubtypeCMS(hubtypeContent, this.cmsApi)\n\n case HtNodeWithContentType.WHATSAPP_TEMPLATE:\n return FlowWhatsappTemplate.fromHubtypeCMS(hubtypeContent, this.locale)\n\n case HtNodeWithContentType.CAPTURE_USER_INPUT:\n return FlowCaptureUserInput.fromHubtypeCMS(hubtypeContent)\n\n case HtNodeWithContentType.CUSTOM_CONDITION:\n return FlowCustomConditionalV2.fromHubtypeCMS(\n hubtypeContent,\n this.botContext\n )\n\n default:\n return undefined\n }\n }\n\n private async resolveFlowFunctionContent(\n hubtypeContent: HtFunctionNode\n ): Promise<FlowContent | undefined> {\n switch (hubtypeContent.content.action) {\n case 'check-country':\n return FlowCountryConditional.fromHubtypeCMS(\n hubtypeContent,\n this.botContext\n )\n case 'get-channel-type':\n return FlowChannelConditional.fromHubtypeCMS(\n hubtypeContent,\n this.botContext\n )\n case 'check-queue-status':\n return FlowQueueStatusConditional.fromHubtypeCMS(\n hubtypeContent,\n this.locale\n )\n case 'check-bot-variable':\n return FlowCustomConditional.fromHubtypeCMS(\n hubtypeContent,\n this.botContext\n )\n default:\n return undefined\n }\n }\n}\n"],"names":["FlowAiAgent","FlowAiAgentRouter","FlowBotAction","FlowCarousel","FlowChannelConditional","FlowCountryConditional","FlowCustomConditional","FlowCustomConditionalV2","FlowGoToFlow","FlowHandoff","FlowImage","FlowQueueStatusConditional","FlowRating","FlowText","FlowVideo","FlowWhatsappButtonList","FlowWhatsappCtaUrlButtonNode","FlowWhatsappRequestContactInfoNode","FlowWhatsappTemplate","FlowCaptureUserInput","HtNodeWithContentType","FlowFactory","hubtypeContent","undefined","botContext","cmsApi","locale"],"mappings":";;;;;;;AAwByB;AACsD;AAKvC;AAEjC,MAAMqB,WAAWA;IAWtB,MAAM,eACJC,cAA+B,EACG;QAClC,OAAQA,eAAe,IAAI;YACzB,KAAKF,0BAA0B;gBAC7B,OAAOP,uBAAuB,CAC5BS,gBACA,IAAI,CAAC,MAAM,EACX,IAAI,CAAC,MAAM,EACX,IAAI,CAAC,UAAU;YAEnB,KAAKF,2BAA2B;gBAC9B,OAAOV,wBAAwB,CAACY,gBAAgB,IAAI,CAAC,MAAM;YAC7D,KAAKF,8BAA8B;gBACjC,OAAOjB,2BAA2B,CAChCmB,gBACA,IAAI,CAAC,MAAM,EACX,IAAI,CAAC,MAAM,EACX,IAAI,CAAC,UAAU;YAEnB,KAAKF,2BAA2B;gBAC9B,OAAON,wBAAwB,CAACQ,gBAAgB,IAAI,CAAC,MAAM;YAC7D,KAAKF,0CAA0C;gBAC7C,OAAOL,qCAAqC,CAC1CO,gBACA,IAAI,CAAC,MAAM,EACX,IAAI,CAAC,MAAM;YAEf,KAAKF,6CAA6C;gBAChD,OAAOJ,2CAA2C,CAChDM,gBACA,IAAI,CAAC,MAAM,EACX,IAAI,CAAC,MAAM,EACX,IAAI,CAAC,UAAU;YAEnB,KAAKF,mDAAmD;gBACtD,OAAOH,iDAAiD,CACtDK,gBACA,IAAI,CAAC,MAAM;YAEf,KAAKF,6BAA6B;gBAChC,OAAOX,0BAA0B,CAC/Ba,gBACA,IAAI,CAAC,MAAM,EACX,IAAI,CAAC,MAAM;YAGf,KAAKF,qCAAqC;gBACxC,OAAOnB,gCAAgC,CAACqB,gBAAgB,IAAI,CAAC,UAAU;YAEzE,KAAKF,8BAA8B;gBACjC,OAAOpB,0BAA0B,CAACsB,gBAAgB,IAAI,CAAC,UAAU;YAEnE,KAAKF,4BAA4B;gBAC/B,OAAOR,yBAAyB,CAACU,gBAAgB,IAAI,CAAC,MAAM;YAE9D,KAAKF,gCAAgC;gBACnC,OAAOlB,4BAA4B,CAACoB,gBAAgB,IAAI,CAAC,MAAM;YAEjE,KAAKF,8BAA8B;gBACjC,OAAO,IAAI,CAAC,0BAA0B,CAACE;YAEzC,KAAKF,gCAAgC;gBACnC,OAAOZ,2BAA2B,CAACc,gBAAgB,IAAI,CAAC,MAAM;YAEhE,KAAKF,uCAAuC;gBAC1C,OAAOF,mCAAmC,CAACI,gBAAgB,IAAI,CAAC,MAAM;YAExE,KAAKF,wCAAwC;gBAC3C,OAAOD,mCAAmC,CAACG;YAE7C,KAAKF,sCAAsC;gBACzC,OAAOb,sCAAsC,CAC3Ce,gBACA,IAAI,CAAC,UAAU;YAGnB;gBACE,OAAOC;QACX;IACF;IAEA,MAAc,2BACZD,cAA8B,EACI;QAClC,OAAQA,eAAe,OAAO,CAAC,MAAM;YACnC,KAAK;gBACH,OAAOjB,qCAAqC,CAC1CiB,gBACA,IAAI,CAAC,UAAU;YAEnB,KAAK;gBACH,OAAOlB,qCAAqC,CAC1CkB,gBACA,IAAI,CAAC,UAAU;YAEnB,KAAK;gBACH,OAAOX,yCAAyC,CAC9CW,gBACA,IAAI,CAAC,MAAM;YAEf,KAAK;gBACH,OAAOhB,oCAAoC,CACzCgB,gBACA,IAAI,CAAC,UAAU;YAEnB;gBACE,OAAOC;QACX;IACF;IAnHA,YAAYC,UAAsB,EAAEC,MAAsB,EAAEC,MAAc,CAAE;QAC1E,IAAI,CAAC,UAAU,GAAGF;QAClB,IAAI,CAAC,MAAM,GAAGC;QACd,IAAI,CAAC,MAAM,GAAGC;IAChB;AAgHF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"functions/index.js","sources":["../../../src/functions/index.ts"],"sourcesContent":["import type { ActionRequest } from '@botonic/react'\n\nimport type {\n HtFunctionArgument,\n HtFunctionArguments,\n HtFunctionNode,\n} from '../content-fields/hubtype-fields'\n\nexport const DEFAULT_FUNCTION_NAMES = [\n 'check-queue-status',\n 'get-channel-type',\n 'check-country',\n 'check-bot-variable',\n]\n\nexport class CustomFunction {\n public functions: Record<any, any>\n public currentRequest: ActionRequest\n public locale: string\n\n constructor(\n functions: Record<any, any>,\n currentRequest: ActionRequest,\n locale: string\n ) {\n this.functions = functions\n this.currentRequest = currentRequest\n this.locale = locale\n }\n\n async call(functionNode: HtFunctionNode): Promise<string> {\n const functionNodeId = functionNode.id\n const functionArguments = getArgumentsByLocale(\n functionNode.content.arguments,\n this.locale\n )\n const nameValues = functionArguments.map(arg => {\n return { [arg.name]: arg.value }\n })\n\n const args = Object.assign(\n {\n request: this.currentRequest,\n results: functionNode.content.result_mapping.map(r => r.result),\n },\n ...nameValues\n )\n const functionResult =\n await this.functions[functionNode.content.action](args)\n // TODO define result_mapping per locale??\n const result = functionNode.content.result_mapping.find(\n r => r.result === functionResult\n )\n if (!result?.target) {\n throw new Error(\n `No result found for result_mapping for node with id: ${functionNodeId}`\n )\n }\n return result.target.id\n }\n}\n\nexport function getArgumentsByLocale(\n args: HtFunctionArguments[],\n locale: string\n): HtFunctionArgument[] {\n let resultArguments: HtFunctionArgument[] = []\n for (const arg of args) {\n if ('locale' in arg && arg.locale === locale) {\n resultArguments = [...resultArguments, ...arg.values]\n }\n if ('type' in arg) {\n resultArguments = [...resultArguments, arg]\n }\n }\n\n return resultArguments\n}\n"],"names":["DEFAULT_FUNCTION_NAMES","CustomFunction","functionNode","functionNodeId","functionArguments","getArgumentsByLocale","nameValues","arg","args","Object","r","functionResult","result","Error","functions","currentRequest","locale","resultArguments"],"mappings":"AAQO,MAAMA,sBAAsBA,GAAG;IACpC;IACA;IACA;IACA;CACD;AAEM,MAAMC,cAAcA;IAezB,MAAM,KAAKC,YAA4B,EAAmB;QACxD,MAAMC,iBAAiBD,aAAa,EAAE;QACtC,MAAME,oBAAoBC,oBAAoBA,CAC5CH,aAAa,OAAO,CAAC,SAAS,EAC9B,IAAI,CAAC,MAAM;QAEb,MAAMI,aAAaF,kBAAkB,GAAG,CAACG,CAAAA;YACvC,OAAO;gBAAE,CAACA,IAAI,IAAI,CAAC,EAAEA,IAAI,KAAK;YAAC;QACjC;QAEA,MAAMC,OAAOC,OAAO,MAAM,CACxB;YACE,SAAS,IAAI,CAAC,cAAc;YAC5B,SAASP,aAAa,OAAO,CAAC,cAAc,CAAC,GAAG,CAACQ,CAAAA,IAAKA,EAAE,MAAM;QAChE,MACGJ;QAEL,MAAMK,iBACJ,MAAM,IAAI,CAAC,SAAS,CAACT,aAAa,OAAO,CAAC,MAAM,CAAC,CAACM;QACpD,0CAA0C;QAC1C,MAAMI,SAASV,aAAa,OAAO,CAAC,cAAc,CAAC,IAAI,CACrDQ,CAAAA,IAAKA,EAAE,MAAM,KAAKC;QAEpB,IAAI,CAACC,QAAQ,QAAQ;YACnB,MAAM,IAAIC,MACR,CAAC,qDAAqD,EAAEV,gBAAgB;QAE5E;QACA,OAAOS,OAAO,MAAM,CAAC,EAAE;IACzB;IAvCA,YACEE,SAA2B,EAC3BC,cAA6B,EAC7BC,MAAc,CACd;QACA,IAAI,CAAC,SAAS,GAAGF;QACjB,IAAI,CAAC,cAAc,GAAGC;QACtB,IAAI,CAAC,MAAM,GAAGC;IAChB;AAgCF;AAEO,SAASX,oBAAoBA,CAClCG,IAA2B,EAC3BQ,MAAc;IAEd,IAAIC,kBAAwC,EAAE;IAC9C,KAAK,MAAMV,OAAOC,KAAM;QACtB,IAAI,YAAYD,OAAOA,IAAI,MAAM,KAAKS,QAAQ;YAC5CC,kBAAkB;mBAAIA;mBAAoBV,IAAI,MAAM;aAAC;QACvD;QACA,IAAI,UAAUA,KAAK;YACjBU,kBAAkB;mBAAIA;gBAAiBV;aAAI;QAC7C;IACF;IAEA,OAAOU;AACT"}
|
package/lib/esm/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/index.ts"],"sourcesContent":["import {\n INPUT,\n type Plugin,\n type PluginPreRequest,\n PROVIDER,\n type ResolvedPlugins,\n type Session,\n} from '@botonic/core'\nimport type { ActionRequest } from '@botonic/react'\nimport { v7 as uuidv7 } from 'uuid'\n\nimport { FlowBuilderApi } from './api'\nimport {\n EMPTY_PAYLOAD,\n FLOW_BUILDER_API_URL_PROD,\n SEPARATOR,\n SOURCE_INFO_SEPARATOR,\n} from './constants'\nimport type { FlowContent } from './content-fields'\nimport {\n type HtBotActionNode,\n type HtFlowBuilderData,\n type HtNodeWithContent,\n HtNodeWithContentType,\n} from './content-fields/hubtype-fields'\nimport { FlowFactory } from './flow-factory'\nimport { CustomFunction, DEFAULT_FUNCTION_NAMES } from './functions'\nimport {\n type AiAgentFunction,\n type BotonicPluginFlowBuilderOptions,\n type ContentFilter,\n FlowBuilderJSONVersion,\n type InShadowingConfig,\n type PayloadParamsBase,\n type RatingSubmittedInfo,\n type TrackEventFunction,\n} from './types'\nimport { getNextPayloadByUserInput } from './user-input'\nimport type { SmartIntentsInferenceConfig } from './user-input/smart-intent'\nimport { resolveGetAccessToken } from './utils/authentication'\nimport { inputHasTextOrTranscript } from './utils/input'\n\n// TODO: Create a proper service to wrap all calls and allow api versioning\n\nexport default class BotonicPluginFlowBuilder implements Plugin {\n public cmsApi: FlowBuilderApi\n private flow?: HtFlowBuilderData\n private functions: Record<any, any>\n private currentRequest: PluginPreRequest\n public getAccessToken: (session: Session) => string\n public trackEvent?: TrackEventFunction\n public getAiAgentResponse?: AiAgentFunction\n public smartIntentsConfig: SmartIntentsInferenceConfig\n public inShadowing: InShadowingConfig\n public contentFilters: ContentFilter[]\n\n // TODO: Rethink how we construct FlowBuilderApi to be simpler\n public jsonVersion: FlowBuilderJSONVersion\n public apiUrl: string\n public customRatingMessageEnabled: boolean\n public disableAIAgentInFirstInteraction: boolean\n\n constructor(options: BotonicPluginFlowBuilderOptions<ResolvedPlugins, any>) {\n this.apiUrl = options.apiUrl || FLOW_BUILDER_API_URL_PROD\n this.jsonVersion = options.jsonVersion || FlowBuilderJSONVersion.LATEST\n this.flow = options.flow\n this.getAccessToken = resolveGetAccessToken(options.getAccessToken)\n this.trackEvent = options.trackEvent\n this.getAiAgentResponse = options.getAiAgentResponse\n this.smartIntentsConfig = {\n ...options?.smartIntentsConfig,\n useLatest: this.jsonVersion === FlowBuilderJSONVersion.LATEST,\n }\n const customFunctions = options.customFunctions || {}\n this.functions = customFunctions\n this.inShadowing = {\n allowKeywords: options.inShadowing?.allowKeywords || false,\n allowSmartIntents: options.inShadowing?.allowSmartIntents || false,\n allowAiAgents: options.inShadowing?.allowAiAgents || false,\n }\n this.contentFilters = options.contentFilters || []\n this.customRatingMessageEnabled =\n options.customRatingMessageEnabled || false\n this.disableAIAgentInFirstInteraction =\n options.disableAIAgentInFirstInteraction || false\n }\n\n resolveFlowUrl(request: PluginPreRequest): string {\n if (request.session.is_test_integration) {\n return `${this.apiUrl}/v1/bot_flows/{bot_id}/versions/${FlowBuilderJSONVersion.DRAFT}/`\n }\n return `${this.apiUrl}/v1/bot_flows/{bot_id}/versions/${this.jsonVersion}/`\n }\n\n async pre(request: PluginPreRequest): Promise<void> {\n // When AI Agent is executed in Whatsapp, button payloads come as referral and must be converted to text being processed by the agent.\n this.convertWhatsappAiAgentEmptyPayloads(request)\n\n this.currentRequest = request\n this.cmsApi = await FlowBuilderApi.create({\n flowUrl: this.resolveFlowUrl(request),\n url: this.apiUrl,\n flow: this.flow,\n accessToken: this.getAccessToken(request.session),\n request: this.currentRequest,\n })\n\n const checkUserTextInput =\n inputHasTextOrTranscript(request.input) && !request.input.payload\n\n if (checkUserTextInput) {\n const resolvedLocale = this.cmsApi.getResolvedLocale()\n const nextPayload = await getNextPayloadByUserInput(\n this.cmsApi,\n resolvedLocale,\n request as unknown as ActionRequest,\n this.smartIntentsConfig\n )\n request.input.payload = nextPayload\n }\n\n await this.updateRequestBeforeRoutes(request)\n }\n\n private convertWhatsappAiAgentEmptyPayloads(request: PluginPreRequest): void {\n if (request.session.user.provider === PROVIDER.WHATSAPP) {\n const shouldUseReferral =\n request.input.referral &&\n request.input.payload?.startsWith(EMPTY_PAYLOAD)\n\n if (shouldUseReferral) {\n request.input.type = INPUT.TEXT\n request.input.data = request.input.referral\n }\n }\n }\n\n private async updateRequestBeforeRoutes(\n request: PluginPreRequest\n ): Promise<void> {\n this.cmsApi.removeCaptureUserInputId()\n if (request.input.payload) {\n request.input.payload = this.removeSourceSuffix(request.input.payload)\n\n if (this.cmsApi.isBotAction(request.input.payload)) {\n const cmsBotAction = this.cmsApi.getNodeById<HtBotActionNode>(\n request.input.payload\n )\n\n request.input.payload =\n this.cmsApi.createPayloadWithParams(cmsBotAction)\n\n // Re-execute convertWhatsappAiAgentEmptyPayloads function to handle\n // the case that a BotAction has a payload equals to EMPTY_PAYLOAD\n this.convertWhatsappAiAgentEmptyPayloads(request)\n }\n }\n }\n\n private removeSourceSuffix(payload: string): string {\n return payload.split(SOURCE_INFO_SEPARATOR)[0]\n }\n\n post(request: PluginPreRequest): void {\n request.input.nluResolution = undefined\n delete request.session.user.system_locale_updated\n }\n\n async getContentsByContentID(\n contentID: string,\n prevContents?: FlowContent[]\n ): Promise<FlowContent[]> {\n const node = this.cmsApi.getNodeByContentID(contentID) as HtNodeWithContent\n return await this.getContentsByNode(node, prevContents)\n }\n\n getUUIDByContentID(contentID: string): string {\n const node = this.cmsApi.getNodeByContentID(contentID)\n return node.id\n }\n\n private async getContentsById(\n id: string,\n prevContents?: FlowContent[]\n ): Promise<FlowContent[]> {\n const node = this.cmsApi.getNodeById(id) as HtNodeWithContent\n return await this.getContentsByNode(node, prevContents)\n }\n\n async getStartContents(): Promise<FlowContent[]> {\n const startNode = this.cmsApi.getStartNode()\n this.currentRequest.session.flow_thread_id = uuidv7()\n return await this.getContentsByNode(startNode)\n }\n\n async getContentsByNode(\n node: HtNodeWithContent,\n prevContents?: FlowContent[]\n ): Promise<FlowContent[]> {\n const contents = prevContents || []\n const resolvedLocale = this.cmsApi.getResolvedLocale()\n\n if (\n node.type === HtNodeWithContentType.FUNCTION &&\n !DEFAULT_FUNCTION_NAMES.includes(node.content.action)\n ) {\n const customFunctionResolver = new CustomFunction(\n this.functions,\n this.currentRequest,\n resolvedLocale\n )\n const targetId = await customFunctionResolver.call(node)\n return this.getContentsById(targetId, contents)\n }\n\n const flowFactory = new FlowFactory(\n this.currentRequest,\n this.cmsApi,\n resolvedLocale\n )\n const content = await flowFactory.getFlowContent(node)\n if (content) {\n contents.push(content)\n }\n\n // If node is BOT_ACTION not add more contents to render, next nodes render after execute action\n if (node.type === HtNodeWithContentType.BOT_ACTION) {\n return contents\n }\n\n // TODO: prevent infinite recursive calls\n if (content?.followUp) {\n return this.getContentsById(content.followUp.id, contents)\n } else if (node.follow_up) {\n console.log('FOLLOWUP FROM NODE-------> OLD SYSTEM')\n return this.getContentsById(node.follow_up.id, contents)\n }\n\n return contents\n }\n\n getPayloadParams<T extends PayloadParamsBase>(payload: string): T {\n const payloadParams = JSON.parse(payload.split(SEPARATOR)[1] || '{}')\n return payloadParams\n }\n\n getFlowName(flowId: string): string {\n return this.cmsApi.getFlowName(flowId)\n }\n\n getRatingSubmittedInfo(payload: string): RatingSubmittedInfo {\n const buttonId = payload?.split(SEPARATOR)[1]\n const ratingNode = this.cmsApi.getRatingNodeByButtonId(buttonId)\n\n const ratingButton = this.cmsApi.getRatingButtonById(ratingNode, buttonId)\n const possibleOptions = ratingNode.content.buttons.map(\n button => button.text\n )\n const possibleValues = ratingNode.content.buttons.map(\n button => button.value\n )\n\n return {\n ...ratingButton,\n possibleOptions,\n possibleValues,\n }\n }\n\n setInShadowing(inShadowing: InShadowingConfig): void {\n this.inShadowing = inShadowing\n }\n}\n\nexport * from './action'\nexport { AGENT_RATING_PAYLOAD, EMPTY_PAYLOAD } from './constants'\nexport * from './content-fields'\nexport type { HtBotActionNode } from './content-fields/hubtype-fields'\nexport {\n getCommonFlowContentEventArgsForContentId,\n trackFlowContent,\n} from './tracking'\nexport {\n type BotonicPluginFlowBuilderOptions,\n type ContentFilter,\n FlowBuilderJSONVersion,\n type PayloadParamsBase,\n type RatingSubmittedInfo,\n} from './types'\nexport * from './webview'\n"],"names":["INPUT","PROVIDER","v7","uuidv7","FlowBuilderApi","EMPTY_PAYLOAD","FLOW_BUILDER_API_URL_PROD","SEPARATOR","SOURCE_INFO_SEPARATOR","HtNodeWithContentType","FlowFactory","CustomFunction","DEFAULT_FUNCTION_NAMES","FlowBuilderJSONVersion","getNextPayloadByUserInput","resolveGetAccessToken","inputHasTextOrTranscript","BotonicPluginFlowBuilder","request","checkUserTextInput","resolvedLocale","nextPayload","shouldUseReferral","cmsBotAction","payload","undefined","contentID","prevContents","node","id","startNode","contents","customFunctionResolver","targetId","flowFactory","content","console","payloadParams","JSON","flowId","buttonId","ratingNode","ratingButton","possibleOptions","button","possibleValues","inShadowing","options","customFunctions","AGENT_RATING_PAYLOAD","getCommonFlowContentEventArgsForContentId","trackFlowContent"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAOsB;AAEa;AAEG;AAMlB;AAOoB;AACI;AACwB;AAUpD;AACwC;AAEM;AACN;AAIzC,MAAMiB,wBAAwBA;IA2C3C,eAAeC,OAAyB,EAAU;QAChD,IAAIA,QAAQ,OAAO,CAAC,mBAAmB,EAAE;YACvC,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,gCAAgC,EAAEL,4BAA4B,CAAC,CAAC,CAAC;QACzF;QACA,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,gCAAgC,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;IAC7E;IAEA,MAAM,IAAIK,OAAyB,EAAiB;QAClD,sIAAsI;QACtI,IAAI,CAAC,mCAAmC,CAACA;QAEzC,IAAI,CAAC,cAAc,GAAGA;QACtB,IAAI,CAAC,MAAM,GAAG,MAAMd,qBAAqB,CAAC;YACxC,SAAS,IAAI,CAAC,cAAc,CAACc;YAC7B,KAAK,IAAI,CAAC,MAAM;YAChB,MAAM,IAAI,CAAC,IAAI;YACf,aA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js","sources":["../../../src/services/hubtype-queues-api.ts"],"sourcesContent":["import axios from 'axios'\n\nconst HUBTYPE_API_URL = process.env.HUBTYPE_API_URL || 'https://api.hubtype.com'\n\nexport interface AvailabilityData {\n available: boolean\n waiting_cases: number\n availability_threshold_waiting_cases: number\n open: boolean\n name: string\n available_agents: number\n}\nexport class HubtypeQueuesApi {\n public queueId: string\n public checkAvailableAgents: boolean\n\n constructor(queueId: string, checkAvailableAgents?: boolean) {\n this.queueId = queueId\n this.checkAvailableAgents = checkAvailableAgents || false\n }\n\n async getAvailability(): Promise<AvailabilityData> {\n const response = await axios.get(\n `${HUBTYPE_API_URL}/external/v1/queues/${this.queueId}/availability/`,\n // TODO: Make it configurable in the future\n {\n params: {\n check_queue_schedule: true,\n check_waiting_cases: false,\n check_available_agents: this.checkAvailableAgents,\n },\n }\n )\n return response.data\n }\n}\n"],"names":["axios","HUBTYPE_API_URL","process","HubtypeQueuesApi","response","queueId","checkAvailableAgents"],"mappings":";;;AAAyB;AAEzB,MAAMC,eAAeA,GAAGC,QAAQ,GAAG,CAAC,eAAe,IAAI;AAUhD,MAAMC,gBAAgBA;IAS3B,MAAM,kBAA6C;QACjD,MAAMC,WAAW,MAAMJ,SAAS,CAC9B,GAAGC,eAAeA,CAAC,oBAAoB,EAAE,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,EACrE,2CAA2C;QAC3C;YACE,QAAQ;gBACN,sBAAsB;gBACtB,qBAAqB;gBACrB,wBAAwB,IAAI,CAAC,oBAAoB;YACnD;QACF;QAEF,OAAOG,SAAS,IAAI;IACtB;IAlBA,YAAYC,OAAe,EAAEC,oBAA8B,CAAE;QAC3D,IAAI,CAAC,OAAO,GAAGD;QACf,IAAI,CAAC,oBAAoB,GAAGC,wBAAwB;IACtD;AAgBF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"structured-output/flow-builder-content.js","sources":["../../../src/structured-output/flow-builder-content.ts"],"sourcesContent":["import type { BaseMessage } from '@botonic/core'\nimport { z } from 'zod'\n\nexport enum FlowBuilderOutputMessageType {\n FlowBuilderContent = 'flowBuilderContent',\n}\n\nexport interface FlowBuilderContentMessage\n extends BaseMessage<FlowBuilderOutputMessageType.FlowBuilderContent> {\n type: FlowBuilderOutputMessageType.FlowBuilderContent\n contentId: string\n}\n\nexport const FlowBuilderContentSchema = z\n .object({\n type: z.literal(FlowBuilderOutputMessageType.FlowBuilderContent),\n contentId: z.string(),\n })\n .describe(\n 'A Flow Builder content ID. Use it only when asked explicitly in the prompt'\n )\n"],"names":["z","FlowBuilderOutputMessageType","FlowBuilderContentSchema"],"mappings":";;;AACuB;AAEhB,IAAKC,iDAA4BA,0BAA5BA;;WAAAA;MAEX;AAQM,MAAMC,wBAAwBA,GAAGF,QAC/B,CAAC;IACN,MAAMA,SAAS;IACf,WAAWA,QAAQ;AACrB,GACC,QAAQ,CACP,8EACD"}
|
package/lib/esm/tracking.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tracking.js","sources":["../../src/tracking.ts"],"sourcesContent":["import { type BotContext, EventAction, type EventFlow } from '@botonic/core'\nimport type { ActionRequest } from '@botonic/react'\nimport { v7 as uuidv7 } from 'uuid'\n\nimport type { FlowBuilderApi } from './api'\nimport type { FlowContent } from './content-fields'\nimport {\n type HtNodeWithContent,\n HtNodeWithContentType,\n} from './content-fields/hubtype-fields'\nimport { getFlowBuilderPlugin } from './utils/get-flow-builder-plugin'\n\nexport async function trackEvent(\n request: ActionRequest,\n eventAction: EventAction,\n args?: Record<string, any>\n): Promise<void> {\n const flowBuilderPlugin = getFlowBuilderPlugin(request.plugins)\n if (flowBuilderPlugin.trackEvent) {\n await flowBuilderPlugin.trackEvent(request, eventAction, args)\n }\n return\n}\n\nexport async function trackFlowContent(\n request: ActionRequest,\n contents: FlowContent[]\n) {\n const flowBuilderPlugin = getFlowBuilderPlugin(request.plugins)\n const cmsApi = flowBuilderPlugin.cmsApi\n for (const content of contents) {\n await trackOneContent(request, content, cmsApi)\n }\n}\n\nexport async function trackOneContent(\n request: ActionRequest,\n content: FlowContent,\n cmsApi?: FlowBuilderApi\n) {\n if (!cmsApi) {\n const flowBuilderPlugin = getFlowBuilderPlugin(request.plugins)\n cmsApi = flowBuilderPlugin.cmsApi\n }\n\n const nodeContent = cmsApi.getNodeById<HtNodeWithContent>(content.id)\n if (nodeContent.type !== HtNodeWithContentType.AI_AGENT) {\n const event = getContentEventArgs(request, nodeContent)\n const { action, ...eventArgs } = event\n await trackEvent(request, action, eventArgs)\n }\n}\n\nfunction setSessionFlowThreadId(\n request: ActionRequest,\n flowThreadId: string\n): void {\n request.session.flow_thread_id = flowThreadId\n}\n\nfunction getContentEventArgs(\n request: ActionRequest,\n nodeContent: HtNodeWithContent\n): EventFlow {\n const { flowThreadId, flowId, flowName, flowNodeId, flowNodeContentId } =\n getCommonFlowContentEventArgs(request, nodeContent)\n\n setSessionFlowThreadId(request, flowThreadId)\n\n return {\n action: EventAction.FlowNode,\n flowId,\n flowName,\n flowNodeId,\n flowNodeContentId,\n flowThreadId,\n flowNodeIsMeaningful: nodeContent.is_meaningful ?? false,\n }\n}\n\ntype CommonFlowContentEventArgs = {\n flowThreadId: string\n flowId: string\n flowName: string\n flowNodeId: string\n flowNodeContentId: string\n}\n\nfunction getCommonFlowContentEventArgs(\n request: ActionRequest,\n nodeContent: HtNodeWithContent\n): CommonFlowContentEventArgs {\n const flowBuilderPlugin = getFlowBuilderPlugin(request.plugins)\n const flowName = flowBuilderPlugin.getFlowName(nodeContent.flow_id)\n const flowThreadId = request.session.flow_thread_id ?? uuidv7()\n\n return {\n flowThreadId,\n flowId: nodeContent.flow_id,\n flowName,\n flowNodeId: nodeContent.id,\n flowNodeContentId: nodeContent.code ?? '',\n }\n}\n\nexport function getCommonFlowContentEventArgsForContentId(\n botContext: BotContext,\n id: string\n): CommonFlowContentEventArgs {\n const flowBuilderPlugin = getFlowBuilderPlugin(botContext.plugins)\n const cmsApi = flowBuilderPlugin.cmsApi\n const nodeContent = cmsApi.getNodeById<HtNodeWithContent>(id)\n\n return getCommonFlowContentEventArgs(botContext, nodeContent)\n}\n"],"names":["EventAction","v7","uuidv7","HtNodeWithContentType","getFlowBuilderPlugin","trackEvent","request","eventAction","args","flowBuilderPlugin","trackFlowContent","contents","cmsApi","content","trackOneContent","nodeContent","event","getContentEventArgs","action","eventArgs","setSessionFlowThreadId","flowThreadId","flowId","flowName","flowNodeId","flowNodeContentId","getCommonFlowContentEventArgs","getCommonFlowContentEventArgsForContentId","botContext","id"],"mappings":";;;;;;;;;AAA4E;AAEzC;AAOK;AAC8B;AAE/D,eAAeK,UAAUA,CAC9BC,OAAsB,EACtBC,WAAwB,EACxBC,IAA0B;IAE1B,MAAMC,oBAAoBL,oBAAoBA,CAACE,QAAQ,OAAO;IAC9D,IAAIG,kBAAkB,UAAU,EAAE;QAChC,MAAMA,kBAAkB,UAAU,CAACH,SAASC,aAAaC;IAC3D;IACA;AACF;AAEO,eAAeE,gBAAgBA,CACpCJ,OAAsB,EACtBK,QAAuB;IAEvB,MAAMF,oBAAoBL,oBAAoBA,CAACE,QAAQ,OAAO;IAC9D,MAAMM,SAASH,kBAAkB,MAAM;IACvC,KAAK,MAAMI,WAAWF,SAAU;QAC9B,MAAMG,eAAeA,CAACR,SAASO,SAASD;IAC1C;AACF;AAEO,eAAeE,eAAeA,CACnCR,OAAsB,EACtBO,OAAoB,EACpBD,MAAuB;IAEvB,IAAI,CAACA,QAAQ;QACX,MAAMH,oBAAoBL,oBAAoBA,CAACE,QAAQ,OAAO;QAC9DM,SAASH,kBAAkB,MAAM;IACnC;IAEA,MAAMM,cAAcH,OAAO,WAAW,CAAoBC,QAAQ,EAAE;IACpE,IAAIE,YAAY,IAAI,KAAKZ,8BAA8B,EAAE;QACvD,MAAMa,QAAQC,mBAAmBA,CAACX,SAASS;QAC3C,MAAM,EAAEG,MAAM,EAAE,GAAGC,WAAW,GAAGH;QACjC,MAAMX,UAAUA,CAACC,SAASY,QAAQC;IACpC;AACF;AAEA,SAASC,sBAAsBA,CAC7Bd,OAAsB,EACtBe,YAAoB;IAEpBf,QAAQ,OAAO,CAAC,cAAc,GAAGe;AACnC;AAEA,SAASJ,mBAAmBA,CAC1BX,OAAsB,EACtBS,WAA8B;IAE9B,MAAM,EAAEM,YAAY,EAAEC,MAAM,EAAEC,QAAQ,EAAEC,UAAU,EAAEC,iBAAiB,EAAE,GACrEC,6BAA6BA,CAACpB,SAASS;IAEzCK,sBAAsBA,CAACd,SAASe;IAEhC,OAAO;QACL,QAAQrB,oBAAoB;QAC5BsB;QACAC;QACAC;QACAC;QACAJ;QACA,sBAAsBN,YAAY,aAAa,IAAI;IACrD;AACF;AAUA,SAASW,6BAA6BA,CACpCpB,OAAsB,EACtBS,WAA8B;IAE9B,MAAMN,oBAAoBL,oBAAoBA,CAACE,QAAQ,OAAO;IAC9D,MAAMiB,WAAWd,kBAAkB,WAAW,CAACM,YAAY,OAAO;IAClE,MAAMM,eAAef,QAAQ,OAAO,CAAC,cAAc,IAAIJ,EAAMA;IAE7D,OAAO;QACLmB;QACA,QAAQN,YAAY,OAAO;QAC3BQ;QACA,YAAYR,YAAY,EAAE;QAC1B,mBAAmBA,YAAY,IAAI,IAAI;IACzC;AACF;AAEO,SAASY,yCAAyCA,CACvDC,UAAsB,EACtBC,EAAU;IAEV,MAAMpB,oBAAoBL,oBAAoBA,CAACwB,WAAW,OAAO;IACjE,MAAMhB,SAASH,kBAAkB,MAAM;IACvC,MAAMM,cAAcH,OAAO,WAAW,CAAoBiB;IAE1D,OAAOH,6BAA6BA,CAACE,YAAYb;AACnD"}
|
package/lib/esm/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sources":["../../src/types.ts"],"sourcesContent":["import type {\n AiAgentArgs,\n BotContext,\n GuardrailRule,\n InferenceResponse,\n PluginPreRequest,\n ResolvedPlugins,\n} from '@botonic/core'\nimport type { FlowContent } from './content-fields'\nimport type {\n HtFlowBuilderData,\n HtRatingButton,\n} from './content-fields/hubtype-fields'\nimport type { FlowBuilderContentMessage } from './structured-output/flow-builder-content'\n\nexport interface InShadowingConfig {\n allowKeywords: boolean\n allowSmartIntents: boolean\n allowAiAgents: boolean\n}\n\nexport interface BotonicPluginFlowBuilderOptions<\n TPlugins extends ResolvedPlugins = ResolvedPlugins,\n TExtraData = any,\n> {\n apiUrl?: string\n jsonVersion?: FlowBuilderJSONVersion\n flow?: HtFlowBuilderData\n customFunctions?: Record<any, any>\n getAccessToken: () => string\n trackEvent?: TrackEventFunction<TPlugins, TExtraData>\n getAiAgentResponse?: AiAgentFunction<TPlugins, TExtraData>\n smartIntentsConfig?: { numSmartIntentsToUse: number }\n inShadowing?: Partial<InShadowingConfig>\n contentFilters?: ContentFilter<TPlugins, TExtraData>[]\n customRatingMessageEnabled?: boolean\n disableAIAgentInFirstInteraction?: boolean\n}\n\nexport type TrackEventFunction<\n TPlugins extends ResolvedPlugins = ResolvedPlugins,\n TExtraData = any,\n> = (\n request: BotContext<TPlugins, TExtraData>,\n eventAction: string,\n args?: Record<string, any>\n) => Promise<void>\n\nexport type AiAgentFunction<\n TPlugins extends ResolvedPlugins = ResolvedPlugins,\n TExtraData = any,\n> = (\n request: BotContext<TPlugins, TExtraData>,\n aiAgentArgs: AiAgentArgs\n) => Promise<InferenceResponse<FlowBuilderContentMessage>>\n\nexport type ContentFilter<\n TPlugins extends ResolvedPlugins = ResolvedPlugins,\n TExtraData = any,\n> = (\n request: BotContext<TPlugins, TExtraData>,\n content: FlowContent\n) => Promise<FlowContent> | FlowContent\n\nexport interface FlowBuilderApiOptions {\n url: string\n flowUrl: string\n flow?: HtFlowBuilderData\n accessToken: string\n request: PluginPreRequest\n}\n\nexport enum ProcessEnvNodeEnvs {\n PRODUCTION = 'production',\n DEVELOPMENT = 'development',\n}\n\nexport enum FlowBuilderJSONVersion {\n DRAFT = 'draft',\n LATEST = 'latest',\n}\n\nexport interface SmartIntentResponse {\n data: {\n smart_intent_title: string\n text: string\n smart_intents_used: {\n title: string\n description: string\n }[]\n }\n}\n\nexport interface PayloadParamsBase {\n contentID: string\n followUpContentID?: string\n}\n\nexport interface RatingSubmittedInfo extends HtRatingButton {\n possibleOptions: string[]\n possibleValues: number[]\n}\n\nexport type { AiAgentArgs, GuardrailRule }\n"],"names":["ProcessEnvNodeEnvs","FlowBuilderJSONVersion"],"mappings":"AAwEO,IAAKA,wBAAkBA,0BAAlBA;;;WAAAA;MAGX;AAEM,IAAKC,4BAAsBA,0BAAtBA;;;WAAAA;MAGX"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"user-input/capture-user-input-api.js","sources":["../../../src/user-input/capture-user-input-api.ts"],"sourcesContent":["import { EventAction, type EventCaptureUserInput } from '@botonic/core'\nimport type { ActionRequest } from '@botonic/react'\nimport axios from 'axios'\n\nimport type { FlowBuilderApi } from '../api'\nimport { FlowCaptureUserInput } from '../content-fields'\nimport {\n HtAiValidationType,\n type HtCaptureUserInputNode,\n} from '../content-fields/hubtype-fields'\nimport {\n getCommonFlowContentEventArgsForContentId,\n trackEvent,\n} from '../tracking'\nimport { getFlowBuilderPlugin } from '../utils/get-flow-builder-plugin'\nimport { inputHasTextOrTranscript } from '../utils/input'\n\ninterface AiCaptureResponseSuccess {\n success: true\n value: string\n}\n\ninterface AiCaptureResponseFailure {\n success: false\n}\n\ntype AiCaptureResponse = AiCaptureResponseSuccess | AiCaptureResponseFailure\n\nexport class CaptureUserInputApi {\n private cmsApi: FlowBuilderApi\n private request: ActionRequest\n private textOrTranscript: string\n\n constructor(\n cmsApi: FlowBuilderApi,\n request: ActionRequest,\n textOrTranscript: string\n ) {\n this.cmsApi = cmsApi\n this.request = request\n this.textOrTranscript = textOrTranscript\n }\n\n async getNextNodeId(): Promise<string | undefined> {\n if (\n inputHasTextOrTranscript(this.request.input) &&\n this.cmsApi.shouldCaptureUserInput()\n ) {\n const captureUserInputNode = this.cmsApi.getCaptureUserInputNode()\n if (!captureUserInputNode || !this.textOrTranscript) {\n return undefined\n }\n const captureUserInput =\n FlowCaptureUserInput.fromHubtypeCMS(captureUserInputNode)\n\n if (captureUserInput.aiValidationType === HtAiValidationType.NONE) {\n this.cmsApi.setUserExtraDataVariable(\n captureUserInputNode.content.field_name,\n this.textOrTranscript\n )\n await this.trackUserInputCapture(captureUserInputNode, true)\n return captureUserInput.captureSuccessId\n }\n\n const aiCaptureResponse =\n await this.getAiCaptureResponse(captureUserInputNode)\n if (!aiCaptureResponse.success) {\n await this.trackUserInputCapture(captureUserInputNode, false)\n return captureUserInput.captureFailId\n }\n\n this.cmsApi.setUserExtraDataVariable(\n captureUserInputNode.content.field_name,\n aiCaptureResponse.value\n )\n await this.trackUserInputCapture(captureUserInputNode, true)\n return captureUserInput.captureSuccessId\n }\n return undefined\n }\n\n async getAiCaptureResponse(\n captureUserInputNode: HtCaptureUserInputNode\n ): Promise<AiCaptureResponse> {\n try {\n const url = `${process.env.HUBTYPE_API_URL}/external/v1/capture_user_input/`\n const data = {\n field_name: captureUserInputNode.content.field_name,\n validation_instructions:\n captureUserInputNode.content.ai_validation_instructions,\n user_input: this.textOrTranscript,\n }\n const pluginFlowBuilder = getFlowBuilderPlugin(this.request.plugins)\n const token = pluginFlowBuilder.getAccessToken(this.request.session)\n\n const config = {\n headers: {\n 'Content-Type': 'application/json',\n Authorization: `Bearer ${token}`,\n },\n }\n\n const aiCaptureResponse = await axios.post<AiCaptureResponse>(\n url,\n data,\n config\n )\n\n return aiCaptureResponse.data\n } catch (error) {\n console.warn('Error getting ai/capture_user_input', error)\n }\n\n return {\n success: false,\n }\n }\n\n async trackUserInputCapture(\n captureUserInputNode: HtCaptureUserInputNode,\n captureSuccess: boolean\n ): Promise<void> {\n const { flowThreadId, flowId, flowName, flowNodeId, flowNodeContentId } =\n getCommonFlowContentEventArgsForContentId(\n this.request,\n captureUserInputNode.id\n )\n const event: EventCaptureUserInput = {\n action: EventAction.CaptureUserInput,\n flowThreadId,\n flowId,\n flowName,\n flowNodeId,\n flowNodeContentId,\n flowNodeIsMeaningful: false,\n fieldName: captureUserInputNode.content.field_name,\n userInput: this.textOrTranscript,\n captureSuccess,\n messageId: this.request.input.message_id,\n }\n const { action, ...eventArgs } = event\n await trackEvent(this.request, action, eventArgs)\n }\n}\n"],"names":["EventAction","axios","FlowCaptureUserInput","HtAiValidationType","getCommonFlowContentEventArgsForContentId","trackEvent","getFlowBuilderPlugin","inputHasTextOrTranscript","CaptureUserInputApi","captureUserInputNode","undefined","captureUserInput","aiCaptureResponse","url","process","data","pluginFlowBuilder","token","config","error","console","captureSuccess","flowThreadId","flowId","flowName","flowNodeId","flowNodeContentId","event","action","eventArgs","cmsApi","request","textOrTranscript"],"mappings":";;;;;;;;;;;;;;;AAAuE;AAE9C;AAG+B;AAIf;AAIrB;AACmD;AACd;AAalD,MAAMQ,mBAAmBA;IAe9B,MAAM,gBAA6C;QACjD,IACED,wBAAwBA,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,KAC3C,IAAI,CAAC,MAAM,CAAC,sBAAsB,IAClC;YACA,MAAME,uBAAuB,IAAI,CAAC,MAAM,CAAC,uBAAuB;YAChE,IAAI,CAACA,wBAAwB,CAAC,IAAI,CAAC,gBAAgB,EAAE;gBACnD,OAAOC;YACT;YACA,MAAMC,mBACJT,mCAAmC,CAACO;YAEtC,IAAIE,iBAAiB,gBAAgB,KAAKR,uBAAuB,EAAE;gBACjE,IAAI,CAAC,MAAM,CAAC,wBAAwB,CAClCM,qBAAqB,OAAO,CAAC,UAAU,EACvC,IAAI,CAAC,gBAAgB;gBAEvB,MAAM,IAAI,CAAC,qBAAqB,CAACA,sBAAsB;gBACvD,OAAOE,iBAAiB,gBAAgB;YAC1C;YAEA,MAAMC,oBACJ,MAAM,IAAI,CAAC,oBAAoB,CAACH;YAClC,IAAI,CAACG,kBAAkB,OAAO,EAAE;gBAC9B,MAAM,IAAI,CAAC,qBAAqB,CAACH,sBAAsB;gBACvD,OAAOE,iBAAiB,aAAa;YAC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AgB;YAChCY;YACA,WAAW,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,UAAU;QAC1C;QACA,MAAM,EAAEO,MAAM,EAAE,GAAGC,WAAW,GAAGF;QACjC,MAAMtB,UAAUA,CAAC,IAAI,CAAC,OAAO,EAAEuB,QAAQC;IACzC;IA7GA,YACEC,MAAsB,EACtBC,OAAsB,EACtBC,gBAAwB,CACxB;QACA,IAAI,CAAC,MAAM,GAAGF;QACd,IAAI,CAAC,OAAO,GAAGC;QACf,IAAI,CAAC,gBAAgB,GAAGC;IAC1B;AAsGF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"user-input/index.js","sources":["../../../src/user-input/index.ts"],"sourcesContent":["import type { ActionRequest } from '@botonic/react'\n\nimport type { FlowBuilderApi } from '../api'\nimport {\n getTextOrTranscript,\n isKeywordsAllowed,\n isSmartIntentsAllowed,\n} from '../utils/input'\nimport { CaptureUserInputApi } from './capture-user-input-api'\nimport { KeywordMatcher } from './keyword'\nimport {\n SmartIntentsApi,\n type SmartIntentsInferenceConfig,\n} from './smart-intent'\n\nexport async function getNextPayloadByUserInput(\n cmsApi: FlowBuilderApi,\n locale: string,\n request: ActionRequest,\n smartIntentsConfig: SmartIntentsInferenceConfig\n): Promise<string | undefined> {\n const userTextOrTranscript = getTextOrTranscript(request.input)\n if (userTextOrTranscript) {\n if (cmsApi.shouldCaptureUserInput()) {\n const captureUserInputApi = new CaptureUserInputApi(\n cmsApi,\n request,\n userTextOrTranscript\n )\n return await captureUserInputApi.getNextNodeId()\n }\n\n if (isKeywordsAllowed(request)) {\n const keywordMatcher = new KeywordMatcher({\n cmsApi,\n locale,\n request,\n userTextOrTranscript,\n })\n const keywordNode = await keywordMatcher.getNodeByInput()\n if (keywordNode) {\n return cmsApi.getPayload(keywordNode.target)\n }\n }\n\n if (isSmartIntentsAllowed(request)) {\n const smartIntentsApi = new SmartIntentsApi(\n cmsApi,\n request,\n smartIntentsConfig,\n userTextOrTranscript\n )\n const smartIntentNode = await smartIntentsApi.getNodeByInput()\n if (smartIntentNode) {\n return cmsApi.getPayload(smartIntentNode.target)\n }\n }\n }\n\n return undefined\n}\n"],"names":["getTextOrTranscript","isKeywordsAllowed","isSmartIntentsAllowed","CaptureUserInputApi","KeywordMatcher","SmartIntentsApi","getNextPayloadByUserInput","cmsApi","locale","request","smartIntentsConfig","userTextOrTranscript","captureUserInputApi","keywordMatcher","keywordNode","smartIntentsApi","smartIntentNode","undefined"],"mappings":";;;;;;;;;AAOuB;AACuC;AACpB;AAInB;AAEhB,eAAeM,yBAAyBA,CAC7CC,MAAsB,EACtBC,MAAc,EACdC,OAAsB,EACtBC,kBAA+C;IAE/C,MAAMC,uBAAuBX,mBAAmBA,CAACS,QAAQ,KAAK;IAC9D,IAAIE,sBAAsB;QACxB,IAAIJ,OAAO,sBAAsB,IAAI;YACnC,MAAMK,sBAAsB,IAAIT,mBAAmBA,CACjDI,QACAE,SACAE;YAEF,OAAO,MAAMC,oBAAoB,aAAa;QAChD;QAEA,IAAIX,iBAAiBA,CAACQ,UAAU;YAC9B,MAAMI,iBAAiB,IAAIT,cAAcA,CAAC;gBACxCG;gBACAC;gBACAC;gBACAE;YACF;YACA,MAAMG,cAAc,MAAMD,eAAe,cAAc;YACvD,IAAIC,aAAa;gBACf,OAAOP,OAAO,UAAU,CAACO,YAAY,MAAM;YAC7C;QACF;QAEA,IAAIZ,qBAAqBA,CAACO,UAAU;YAClC,MAAMM,kBAAkB,IAAIV,eAAeA,CACzCE,QACAE,SACAC,oBACAC;YAEF,MAAMK,kBAAkB,MAAMD,gBAAgB,cAAc;YAC5D,IAAIC,iBAAiB;gBACnB,OAAOT,OAAO,UAAU,CAACS,gBAAgB,MAAM;YACjD;QACF;IACF;IAEA,OAAOC;AACT"}
|