@botonic/plugin-flow-builder 0.55.2 → 0.57.0-rslib-esm.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/esm/action/ai-agent-from-user-input.d.ts +2 -2
- package/lib/esm/action/ai-agent-from-user-input.js +9 -6
- package/lib/esm/action/ai-agent-from-user-input.js.map +1 -1
- package/lib/esm/action/context.d.ts +2 -2
- package/lib/esm/action/context.js +9 -6
- package/lib/esm/action/context.js.map +1 -1
- package/lib/esm/action/fallback.d.ts +2 -2
- package/lib/esm/action/fallback.js +16 -11
- package/lib/esm/action/fallback.js.map +1 -1
- package/lib/esm/action/first-interaction.d.ts +2 -2
- package/lib/esm/action/first-interaction.js +39 -27
- package/lib/esm/action/first-interaction.js.map +1 -1
- package/lib/esm/action/get-contents.d.ts +1 -1
- package/lib/esm/action/get-contents.js +37 -20
- package/lib/esm/action/get-contents.js.map +1 -1
- package/lib/esm/action/index.d.ts +1 -1
- package/lib/esm/action/index.js +68 -32
- package/lib/esm/action/index.js.map +1 -1
- package/lib/esm/action/payload.d.ts +2 -2
- package/lib/esm/action/payload.js +27 -23
- package/lib/esm/action/payload.js.map +1 -1
- package/lib/esm/api.d.ts +2 -2
- package/lib/esm/api.js +55 -44
- package/lib/esm/api.js.map +1 -1
- package/lib/esm/constants.js +16 -18
- package/lib/esm/constants.js.map +1 -1
- package/lib/esm/content-fields/content-fields-base.d.ts +2 -2
- package/lib/esm/content-fields/content-fields-base.js +33 -29
- package/lib/esm/content-fields/content-fields-base.js.map +1 -1
- package/lib/esm/content-fields/custom-conditional/custom-conditional-v2-evaluators.d.ts +1 -1
- package/lib/esm/content-fields/custom-conditional/custom-conditional-v2-evaluators.js +35 -33
- package/lib/esm/content-fields/custom-conditional/custom-conditional-v2-evaluators.js.map +1 -1
- package/lib/esm/content-fields/custom-conditional/custom-conditional-v2-resolver.d.ts +1 -1
- package/lib/esm/content-fields/custom-conditional/custom-conditional-v2-resolver.js +15 -15
- package/lib/esm/content-fields/custom-conditional/custom-conditional-v2-resolver.js.map +1 -1
- package/lib/esm/content-fields/custom-conditional/flow-custom-condition-v2.d.ts +2 -2
- package/lib/esm/content-fields/custom-conditional/flow-custom-condition-v2.js +50 -35
- package/lib/esm/content-fields/custom-conditional/flow-custom-condition-v2.js.map +1 -1
- package/lib/esm/content-fields/flow-ai-agent-base.d.ts +4 -4
- package/lib/esm/content-fields/flow-ai-agent-base.js +50 -43
- package/lib/esm/content-fields/flow-ai-agent-base.js.map +1 -1
- package/lib/esm/content-fields/flow-ai-agent-router.d.ts +5 -5
- package/lib/esm/content-fields/flow-ai-agent-router.js +57 -46
- package/lib/esm/content-fields/flow-ai-agent-router.js.map +1 -1
- package/lib/esm/content-fields/flow-ai-agent.d.ts +4 -4
- package/lib/esm/content-fields/flow-ai-agent.js +33 -22
- package/lib/esm/content-fields/flow-ai-agent.js.map +1 -1
- package/lib/esm/content-fields/flow-bot-action.d.ts +3 -3
- package/lib/esm/content-fields/flow-bot-action.js +23 -15
- package/lib/esm/content-fields/flow-bot-action.js.map +1 -1
- package/lib/esm/content-fields/flow-button.d.ts +5 -5
- package/lib/esm/content-fields/flow-button.js +48 -29
- package/lib/esm/content-fields/flow-button.js.map +1 -1
- package/lib/esm/content-fields/flow-capture-user-input.d.ts +2 -2
- package/lib/esm/content-fields/flow-capture-user-input.js +24 -23
- package/lib/esm/content-fields/flow-capture-user-input.js.map +1 -1
- package/lib/esm/content-fields/flow-carousel.d.ts +4 -4
- package/lib/esm/content-fields/flow-carousel.js +99 -58
- package/lib/esm/content-fields/flow-carousel.js.map +1 -1
- package/lib/esm/content-fields/flow-channel-conditional.d.ts +3 -3
- package/lib/esm/content-fields/flow-channel-conditional.js +26 -22
- package/lib/esm/content-fields/flow-channel-conditional.js.map +1 -1
- package/lib/esm/content-fields/flow-country-conditional.d.ts +3 -3
- package/lib/esm/content-fields/flow-country-conditional.js +26 -21
- package/lib/esm/content-fields/flow-country-conditional.js.map +1 -1
- package/lib/esm/content-fields/flow-custom-conditional.d.ts +3 -3
- package/lib/esm/content-fields/flow-custom-conditional.js +31 -33
- package/lib/esm/content-fields/flow-custom-conditional.js.map +1 -1
- package/lib/esm/content-fields/flow-element.d.ts +4 -4
- package/lib/esm/content-fields/flow-element.js +37 -20
- package/lib/esm/content-fields/flow-element.js.map +1 -1
- package/lib/esm/content-fields/flow-go-to-flow.d.ts +3 -3
- package/lib/esm/content-fields/flow-go-to-flow.js +25 -20
- package/lib/esm/content-fields/flow-go-to-flow.js.map +1 -1
- package/lib/esm/content-fields/flow-handoff.d.ts +3 -3
- package/lib/esm/content-fields/flow-handoff.js +30 -19
- package/lib/esm/content-fields/flow-handoff.js.map +1 -1
- package/lib/esm/content-fields/flow-image.d.ts +2 -2
- package/lib/esm/content-fields/flow-image.js +24 -15
- package/lib/esm/content-fields/flow-image.js.map +1 -1
- package/lib/esm/content-fields/flow-queue-status-conditional.d.ts +3 -3
- package/lib/esm/content-fields/flow-queue-status-conditional.js +45 -40
- package/lib/esm/content-fields/flow-queue-status-conditional.js.map +1 -1
- package/lib/esm/content-fields/flow-rating.d.ts +3 -3
- package/lib/esm/content-fields/flow-rating.js +62 -40
- package/lib/esm/content-fields/flow-rating.js.map +1 -1
- package/lib/esm/content-fields/flow-text.d.ts +4 -4
- package/lib/esm/content-fields/flow-text.js +51 -29
- package/lib/esm/content-fields/flow-text.js.map +1 -1
- package/lib/esm/content-fields/flow-video.d.ts +2 -2
- package/lib/esm/content-fields/flow-video.js +24 -15
- package/lib/esm/content-fields/flow-video.js.map +1 -1
- package/lib/esm/content-fields/flow-webview.d.ts +2 -2
- package/lib/esm/content-fields/flow-webview.js +31 -28
- package/lib/esm/content-fields/flow-webview.js.map +1 -1
- package/lib/esm/content-fields/flow-whatsapp-cta-url-button.d.ts +3 -3
- package/lib/esm/content-fields/flow-whatsapp-cta-url-button.js +91 -52
- package/lib/esm/content-fields/flow-whatsapp-cta-url-button.js.map +1 -1
- package/lib/esm/content-fields/flow-whatsapp-request-contact-info.d.ts +10 -0
- package/lib/esm/content-fields/flow-whatsapp-request-contact-info.js +51 -0
- package/lib/esm/content-fields/flow-whatsapp-request-contact-info.js.map +1 -0
- package/lib/esm/content-fields/flow-whatsapp-template.d.ts +3 -2
- package/lib/esm/content-fields/flow-whatsapp-template.js +126 -98
- package/lib/esm/content-fields/flow-whatsapp-template.js.map +1 -1
- package/lib/esm/content-fields/hubtype-fields/ai-agent-router.d.ts +3 -3
- package/lib/esm/content-fields/hubtype-fields/ai-agent-router.js +3 -2
- package/lib/esm/content-fields/hubtype-fields/ai-agent-router.js.map +1 -1
- package/lib/esm/content-fields/hubtype-fields/ai-agent.d.ts +2 -2
- package/lib/esm/content-fields/hubtype-fields/ai-agent.js +3 -2
- package/lib/esm/content-fields/hubtype-fields/ai-agent.js.map +1 -1
- package/lib/esm/content-fields/hubtype-fields/bot-action.d.ts +2 -2
- package/lib/esm/content-fields/hubtype-fields/bot-action.js +3 -2
- package/lib/esm/content-fields/hubtype-fields/bot-action.js.map +1 -1
- package/lib/esm/content-fields/hubtype-fields/button.d.ts +1 -1
- package/lib/esm/content-fields/hubtype-fields/button.js +3 -2
- package/lib/esm/content-fields/hubtype-fields/button.js.map +1 -1
- package/lib/esm/content-fields/hubtype-fields/capture-user-input.d.ts +2 -2
- package/lib/esm/content-fields/hubtype-fields/capture-user-input.js +6 -6
- package/lib/esm/content-fields/hubtype-fields/capture-user-input.js.map +1 -1
- package/lib/esm/content-fields/hubtype-fields/carousel.d.ts +3 -3
- package/lib/esm/content-fields/hubtype-fields/carousel.js +3 -2
- package/lib/esm/content-fields/hubtype-fields/carousel.js.map +1 -1
- package/lib/esm/content-fields/hubtype-fields/channel-conditional.d.ts +3 -3
- package/lib/esm/content-fields/hubtype-fields/channel-conditional.js +3 -2
- package/lib/esm/content-fields/hubtype-fields/channel-conditional.js.map +1 -1
- package/lib/esm/content-fields/hubtype-fields/common.d.ts +2 -2
- package/lib/esm/content-fields/hubtype-fields/common.js +3 -2
- package/lib/esm/content-fields/hubtype-fields/common.js.map +1 -1
- package/lib/esm/content-fields/hubtype-fields/country-conditional.d.ts +3 -3
- package/lib/esm/content-fields/hubtype-fields/country-conditional.js +3 -2
- package/lib/esm/content-fields/hubtype-fields/country-conditional.js.map +1 -1
- package/lib/esm/content-fields/hubtype-fields/custom-conditional-v2.d.ts +2 -2
- package/lib/esm/content-fields/hubtype-fields/custom-conditional-v2.js +15 -15
- package/lib/esm/content-fields/hubtype-fields/custom-conditional-v2.js.map +1 -1
- package/lib/esm/content-fields/hubtype-fields/custom-conditional.d.ts +3 -3
- package/lib/esm/content-fields/hubtype-fields/custom-conditional.js +3 -2
- package/lib/esm/content-fields/hubtype-fields/custom-conditional.js.map +1 -1
- package/lib/esm/content-fields/hubtype-fields/fallback.d.ts +2 -2
- package/lib/esm/content-fields/hubtype-fields/fallback.js +3 -2
- package/lib/esm/content-fields/hubtype-fields/fallback.js.map +1 -1
- package/lib/esm/content-fields/hubtype-fields/function.d.ts +2 -2
- package/lib/esm/content-fields/hubtype-fields/function.js +6 -6
- package/lib/esm/content-fields/hubtype-fields/function.js.map +1 -1
- package/lib/esm/content-fields/hubtype-fields/go-to-flow.d.ts +2 -2
- package/lib/esm/content-fields/hubtype-fields/go-to-flow.js +3 -2
- package/lib/esm/content-fields/hubtype-fields/go-to-flow.js.map +1 -1
- package/lib/esm/content-fields/hubtype-fields/handoff.d.ts +2 -2
- package/lib/esm/content-fields/hubtype-fields/handoff.js +3 -2
- package/lib/esm/content-fields/hubtype-fields/handoff.js.map +1 -1
- package/lib/esm/content-fields/hubtype-fields/image.d.ts +2 -2
- package/lib/esm/content-fields/hubtype-fields/image.js +3 -2
- package/lib/esm/content-fields/hubtype-fields/image.js.map +1 -1
- package/lib/esm/content-fields/hubtype-fields/index.d.ts +27 -26
- package/lib/esm/content-fields/hubtype-fields/index.js +56 -29
- package/lib/esm/content-fields/hubtype-fields/index.js.map +1 -1
- package/lib/esm/content-fields/hubtype-fields/keyword.d.ts +2 -2
- package/lib/esm/content-fields/hubtype-fields/keyword.js +3 -2
- package/lib/esm/content-fields/hubtype-fields/keyword.js.map +1 -1
- package/lib/esm/content-fields/hubtype-fields/node-types.d.ts +1 -0
- package/lib/esm/content-fields/hubtype-fields/node-types.js +13 -12
- package/lib/esm/content-fields/hubtype-fields/node-types.js.map +1 -1
- package/lib/esm/content-fields/hubtype-fields/nodes.d.ts +24 -23
- package/lib/esm/content-fields/hubtype-fields/nodes.js +3 -2
- package/lib/esm/content-fields/hubtype-fields/nodes.js.map +1 -1
- package/lib/esm/content-fields/hubtype-fields/payload.d.ts +1 -1
- package/lib/esm/content-fields/hubtype-fields/payload.js +3 -2
- package/lib/esm/content-fields/hubtype-fields/payload.js.map +1 -1
- package/lib/esm/content-fields/hubtype-fields/queue-status-conditional.d.ts +3 -3
- package/lib/esm/content-fields/hubtype-fields/queue-status-conditional.js +3 -2
- package/lib/esm/content-fields/hubtype-fields/queue-status-conditional.js.map +1 -1
- package/lib/esm/content-fields/hubtype-fields/rating.d.ts +2 -2
- package/lib/esm/content-fields/hubtype-fields/rating.js +6 -6
- package/lib/esm/content-fields/hubtype-fields/rating.js.map +1 -1
- package/lib/esm/content-fields/hubtype-fields/smart-intent.d.ts +2 -2
- package/lib/esm/content-fields/hubtype-fields/smart-intent.js +3 -2
- package/lib/esm/content-fields/hubtype-fields/smart-intent.js.map +1 -1
- package/lib/esm/content-fields/hubtype-fields/text.d.ts +3 -3
- package/lib/esm/content-fields/hubtype-fields/text.js +3 -2
- package/lib/esm/content-fields/hubtype-fields/text.js.map +1 -1
- package/lib/esm/content-fields/hubtype-fields/url.d.ts +1 -1
- package/lib/esm/content-fields/hubtype-fields/url.js +3 -2
- package/lib/esm/content-fields/hubtype-fields/url.js.map +1 -1
- package/lib/esm/content-fields/hubtype-fields/video.d.ts +2 -2
- package/lib/esm/content-fields/hubtype-fields/video.js +3 -2
- package/lib/esm/content-fields/hubtype-fields/video.js.map +1 -1
- package/lib/esm/content-fields/hubtype-fields/webview.d.ts +2 -2
- package/lib/esm/content-fields/hubtype-fields/webview.js +3 -2
- package/lib/esm/content-fields/hubtype-fields/webview.js.map +1 -1
- package/lib/esm/content-fields/hubtype-fields/whatsapp-button-list.d.ts +2 -2
- package/lib/esm/content-fields/hubtype-fields/whatsapp-button-list.js +3 -2
- package/lib/esm/content-fields/hubtype-fields/whatsapp-button-list.js.map +1 -1
- package/lib/esm/content-fields/hubtype-fields/whatsapp-cta-url-button.d.ts +3 -3
- package/lib/esm/content-fields/hubtype-fields/whatsapp-cta-url-button.js +3 -2
- package/lib/esm/content-fields/hubtype-fields/whatsapp-cta-url-button.js.map +1 -1
- package/lib/esm/content-fields/hubtype-fields/whatsapp-request-contact-info.d.ts +8 -0
- package/lib/esm/content-fields/hubtype-fields/whatsapp-request-contact-info.js +4 -0
- package/lib/esm/content-fields/hubtype-fields/whatsapp-request-contact-info.js.map +1 -0
- package/lib/esm/content-fields/hubtype-fields/whatsapp-template.d.ts +7 -3
- package/lib/esm/content-fields/hubtype-fields/whatsapp-template.js +6 -6
- package/lib/esm/content-fields/hubtype-fields/whatsapp-template.js.map +1 -1
- package/lib/esm/content-fields/index.d.ts +25 -24
- package/lib/esm/content-fields/index.js +72 -49
- package/lib/esm/content-fields/index.js.map +1 -1
- package/lib/esm/content-fields/whatsapp-button-list/flow-whatsapp-button-list-row.d.ts +3 -3
- package/lib/esm/content-fields/whatsapp-button-list/flow-whatsapp-button-list-row.js +16 -14
- package/lib/esm/content-fields/whatsapp-button-list/flow-whatsapp-button-list-row.js.map +1 -1
- package/lib/esm/content-fields/whatsapp-button-list/flow-whatsapp-button-list-section.d.ts +4 -4
- package/lib/esm/content-fields/whatsapp-button-list/flow-whatsapp-button-list-section.js +20 -15
- package/lib/esm/content-fields/whatsapp-button-list/flow-whatsapp-button-list-section.js.map +1 -1
- package/lib/esm/content-fields/whatsapp-button-list/flow-whatsapp-button-list.d.ts +4 -4
- package/lib/esm/content-fields/whatsapp-button-list/flow-whatsapp-button-list.js +46 -26
- package/lib/esm/content-fields/whatsapp-button-list/flow-whatsapp-button-list.js.map +1 -1
- package/lib/esm/content-fields/whatsapp-button-list/index.d.ts +3 -3
- package/lib/esm/content-fields/whatsapp-button-list/index.js +11 -9
- package/lib/esm/content-fields/whatsapp-button-list/index.js.map +1 -1
- package/lib/esm/filters/index.d.ts +2 -2
- package/lib/esm/filters/index.js +8 -9
- package/lib/esm/filters/index.js.map +1 -1
- package/lib/esm/flow-factory.d.ts +3 -3
- package/lib/esm/flow-factory.js +57 -49
- package/lib/esm/flow-factory.js.map +1 -1
- package/lib/esm/functions/index.d.ts +1 -1
- package/lib/esm/functions/index.js +25 -19
- package/lib/esm/functions/index.js.map +1 -1
- package/lib/esm/index.d.ts +12 -12
- package/lib/esm/index.js +94 -77
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/package.json +3 -0
- package/lib/esm/services/hubtype-queues-api.js +14 -14
- package/lib/esm/services/hubtype-queues-api.js.map +1 -1
- package/lib/esm/structured-output/flow-builder-content.js +14 -13
- package/lib/esm/structured-output/flow-builder-content.js.map +1 -1
- package/lib/esm/tracking.d.ts +2 -2
- package/lib/esm/tracking.js +27 -21
- package/lib/esm/tracking.js.map +1 -1
- package/lib/esm/types.d.ts +5 -5
- package/lib/esm/types.js +9 -9
- package/lib/esm/types.js.map +1 -1
- package/lib/esm/user-input/capture-user-input-api.d.ts +2 -2
- package/lib/esm/user-input/capture-user-input-api.js +44 -33
- package/lib/esm/user-input/capture-user-input-api.js.map +1 -1
- package/lib/esm/user-input/index.d.ts +2 -2
- package/lib/esm/user-input/index.js +23 -14
- package/lib/esm/user-input/index.js.map +1 -1
- package/lib/esm/user-input/keyword.d.ts +2 -2
- package/lib/esm/user-input/keyword.js +31 -26
- package/lib/esm/user-input/keyword.js.map +1 -1
- package/lib/esm/user-input/smart-intent.d.ts +2 -2
- package/lib/esm/user-input/smart-intent.js +36 -32
- package/lib/esm/user-input/smart-intent.js.map +1 -1
- package/lib/esm/utils/ai-agent.d.ts +3 -3
- package/lib/esm/utils/ai-agent.js +17 -12
- package/lib/esm/utils/ai-agent.js.map +1 -1
- package/lib/esm/utils/authentication.js +10 -7
- package/lib/esm/utils/authentication.js.map +1 -1
- package/lib/esm/utils/flow-locale.js +14 -18
- package/lib/esm/utils/flow-locale.js.map +1 -1
- package/lib/esm/utils/get-flow-builder-plugin.d.ts +1 -1
- package/lib/esm/utils/get-flow-builder-plugin.js +4 -4
- package/lib/esm/utils/get-flow-builder-plugin.js.map +1 -1
- package/lib/esm/utils/hubtype-assistant-content.d.ts +1 -1
- package/lib/esm/utils/hubtype-assistant-content.js +57 -43
- package/lib/esm/utils/hubtype-assistant-content.js.map +1 -1
- package/lib/esm/utils/input.js +16 -14
- package/lib/esm/utils/input.js.map +1 -1
- package/lib/esm/webview/contents-context.d.ts +1 -1
- package/lib/esm/webview/contents-context.js +13 -11
- package/lib/esm/webview/contents-context.js.map +1 -1
- package/lib/esm/webview/index.d.ts +3 -3
- package/lib/esm/webview/index.js +10 -9
- package/lib/esm/webview/index.js.map +1 -1
- package/lib/esm/webview/types.d.ts +1 -1
- package/lib/esm/webview/types.js +6 -6
- package/lib/esm/webview/types.js.map +1 -1
- package/lib/esm/webview/use-webview-contents.d.ts +1 -1
- package/lib/esm/webview/use-webview-contents.js +46 -39
- package/lib/esm/webview/use-webview-contents.js.map +1 -1
- package/package.json +8 -7
- package/src/content-fields/flow-whatsapp-request-contact-info.tsx +48 -0
- package/src/content-fields/flow-whatsapp-template.tsx +16 -0
- package/src/content-fields/hubtype-fields/index.ts +1 -0
- package/src/content-fields/hubtype-fields/node-types.ts +1 -0
- package/src/content-fields/hubtype-fields/nodes.ts +2 -0
- package/src/content-fields/hubtype-fields/whatsapp-request-contact-info.ts +9 -0
- package/src/content-fields/hubtype-fields/whatsapp-template.ts +5 -0
- package/src/content-fields/index.ts +3 -0
- package/src/flow-factory.ts +6 -0
- package/src/index.ts +5 -5
- package/src/types.ts +6 -6
- package/lib/cjs/action/ai-agent-from-user-input.d.ts +0 -3
- package/lib/cjs/action/ai-agent-from-user-input.js +0 -32
- package/lib/cjs/action/ai-agent-from-user-input.js.map +0 -1
- package/lib/cjs/action/context.d.ts +0 -11
- package/lib/cjs/action/context.js +0 -17
- package/lib/cjs/action/context.js.map +0 -1
- package/lib/cjs/action/fallback.d.ts +0 -3
- package/lib/cjs/action/fallback.js +0 -36
- package/lib/cjs/action/fallback.js.map +0 -1
- package/lib/cjs/action/first-interaction.d.ts +0 -3
- package/lib/cjs/action/first-interaction.js +0 -88
- package/lib/cjs/action/first-interaction.js.map +0 -1
- package/lib/cjs/action/get-contents.d.ts +0 -3
- package/lib/cjs/action/get-contents.js +0 -39
- package/lib/cjs/action/get-contents.js.map +0 -1
- package/lib/cjs/action/index.d.ts +0 -25
- package/lib/cjs/action/index.js +0 -90
- package/lib/cjs/action/index.js.map +0 -1
- package/lib/cjs/action/payload.d.ts +0 -3
- package/lib/cjs/action/payload.js +0 -74
- package/lib/cjs/action/payload.js.map +0 -1
- package/lib/cjs/api.d.ts +0 -40
- package/lib/cjs/api.js +0 -205
- package/lib/cjs/api.js.map +0 -1
- package/lib/cjs/constants.d.ts +0 -13
- package/lib/cjs/constants.js +0 -19
- package/lib/cjs/constants.js.map +0 -1
- package/lib/cjs/content-fields/content-fields-base.d.ts +0 -20
- package/lib/cjs/content-fields/content-fields-base.js +0 -74
- package/lib/cjs/content-fields/content-fields-base.js.map +0 -1
- package/lib/cjs/content-fields/custom-conditional/custom-conditional-v2-evaluators.d.ts +0 -15
- package/lib/cjs/content-fields/custom-conditional/custom-conditional-v2-evaluators.js +0 -71
- package/lib/cjs/content-fields/custom-conditional/custom-conditional-v2-evaluators.js.map +0 -1
- package/lib/cjs/content-fields/custom-conditional/custom-conditional-v2-resolver.d.ts +0 -9
- package/lib/cjs/content-fields/custom-conditional/custom-conditional-v2-resolver.js +0 -58
- package/lib/cjs/content-fields/custom-conditional/custom-conditional-v2-resolver.js.map +0 -1
- package/lib/cjs/content-fields/custom-conditional/flow-custom-condition-v2.d.ts +0 -17
- package/lib/cjs/content-fields/custom-conditional/flow-custom-condition-v2.js +0 -79
- package/lib/cjs/content-fields/custom-conditional/flow-custom-condition-v2.js.map +0 -1
- package/lib/cjs/content-fields/flow-ai-agent-base.d.ts +0 -25
- package/lib/cjs/content-fields/flow-ai-agent-base.js +0 -93
- package/lib/cjs/content-fields/flow-ai-agent-base.js.map +0 -1
- package/lib/cjs/content-fields/flow-ai-agent-router.d.ts +0 -21
- package/lib/cjs/content-fields/flow-ai-agent-router.js +0 -125
- package/lib/cjs/content-fields/flow-ai-agent-router.js.map +0 -1
- package/lib/cjs/content-fields/flow-ai-agent.d.ts +0 -17
- package/lib/cjs/content-fields/flow-ai-agent.js +0 -64
- package/lib/cjs/content-fields/flow-ai-agent.js.map +0 -1
- package/lib/cjs/content-fields/flow-bot-action.d.ts +0 -14
- package/lib/cjs/content-fields/flow-bot-action.js +0 -45
- package/lib/cjs/content-fields/flow-bot-action.js.map +0 -1
- package/lib/cjs/content-fields/flow-button.d.ts +0 -31
- package/lib/cjs/content-fields/flow-button.js +0 -86
- package/lib/cjs/content-fields/flow-button.js.map +0 -1
- package/lib/cjs/content-fields/flow-capture-user-input.d.ts +0 -14
- package/lib/cjs/content-fields/flow-capture-user-input.js +0 -45
- package/lib/cjs/content-fields/flow-capture-user-input.js.map +0 -1
- package/lib/cjs/content-fields/flow-carousel.d.ts +0 -22
- package/lib/cjs/content-fields/flow-carousel.js +0 -152
- package/lib/cjs/content-fields/flow-carousel.js.map +0 -1
- package/lib/cjs/content-fields/flow-channel-conditional.d.ts +0 -14
- package/lib/cjs/content-fields/flow-channel-conditional.js +0 -57
- package/lib/cjs/content-fields/flow-channel-conditional.js.map +0 -1
- package/lib/cjs/content-fields/flow-country-conditional.d.ts +0 -13
- package/lib/cjs/content-fields/flow-country-conditional.js +0 -59
- package/lib/cjs/content-fields/flow-country-conditional.js.map +0 -1
- package/lib/cjs/content-fields/flow-custom-conditional.d.ts +0 -17
- package/lib/cjs/content-fields/flow-custom-conditional.js +0 -89
- package/lib/cjs/content-fields/flow-custom-conditional.js.map +0 -1
- package/lib/cjs/content-fields/flow-element.d.ts +0 -22
- package/lib/cjs/content-fields/flow-element.js +0 -50
- package/lib/cjs/content-fields/flow-element.js.map +0 -1
- package/lib/cjs/content-fields/flow-go-to-flow.d.ts +0 -13
- package/lib/cjs/content-fields/flow-go-to-flow.js +0 -51
- package/lib/cjs/content-fields/flow-go-to-flow.js.map +0 -1
- package/lib/cjs/content-fields/flow-handoff.d.ts +0 -17
- package/lib/cjs/content-fields/flow-handoff.js +0 -68
- package/lib/cjs/content-fields/flow-handoff.js.map +0 -1
- package/lib/cjs/content-fields/flow-image.d.ts +0 -10
- package/lib/cjs/content-fields/flow-image.js +0 -33
- package/lib/cjs/content-fields/flow-image.js.map +0 -1
- package/lib/cjs/content-fields/flow-queue-status-conditional.d.ts +0 -30
- package/lib/cjs/content-fields/flow-queue-status-conditional.js +0 -95
- package/lib/cjs/content-fields/flow-queue-status-conditional.js.map +0 -1
- package/lib/cjs/content-fields/flow-rating.d.ts +0 -15
- package/lib/cjs/content-fields/flow-rating.js +0 -66
- package/lib/cjs/content-fields/flow-rating.js.map +0 -1
- package/lib/cjs/content-fields/flow-text.d.ts +0 -15
- package/lib/cjs/content-fields/flow-text.js +0 -60
- package/lib/cjs/content-fields/flow-text.js.map +0 -1
- package/lib/cjs/content-fields/flow-video.d.ts +0 -10
- package/lib/cjs/content-fields/flow-video.js +0 -33
- package/lib/cjs/content-fields/flow-video.js.map +0 -1
- package/lib/cjs/content-fields/flow-webview.d.ts +0 -16
- package/lib/cjs/content-fields/flow-webview.js +0 -78
- package/lib/cjs/content-fields/flow-webview.js.map +0 -1
- package/lib/cjs/content-fields/flow-whatsapp-cta-url-button.d.ts +0 -21
- package/lib/cjs/content-fields/flow-whatsapp-cta-url-button.js +0 -92
- package/lib/cjs/content-fields/flow-whatsapp-cta-url-button.js.map +0 -1
- package/lib/cjs/content-fields/flow-whatsapp-template.d.ts +0 -36
- package/lib/cjs/content-fields/flow-whatsapp-template.js +0 -253
- package/lib/cjs/content-fields/flow-whatsapp-template.js.map +0 -1
- package/lib/cjs/content-fields/hubtype-fields/ai-agent-router.d.ts +0 -21
- package/lib/cjs/content-fields/hubtype-fields/ai-agent-router.js +0 -3
- package/lib/cjs/content-fields/hubtype-fields/ai-agent-router.js.map +0 -1
- package/lib/cjs/content-fields/hubtype-fields/ai-agent.d.ts +0 -25
- package/lib/cjs/content-fields/hubtype-fields/ai-agent.js +0 -3
- package/lib/cjs/content-fields/hubtype-fields/ai-agent.js.map +0 -1
- package/lib/cjs/content-fields/hubtype-fields/bot-action.d.ts +0 -10
- package/lib/cjs/content-fields/hubtype-fields/bot-action.js +0 -3
- package/lib/cjs/content-fields/hubtype-fields/bot-action.js.map +0 -1
- package/lib/cjs/content-fields/hubtype-fields/button.d.ts +0 -8
- package/lib/cjs/content-fields/hubtype-fields/button.js +0 -3
- package/lib/cjs/content-fields/hubtype-fields/button.js.map +0 -1
- package/lib/cjs/content-fields/hubtype-fields/capture-user-input.d.ts +0 -19
- package/lib/cjs/content-fields/hubtype-fields/capture-user-input.js +0 -12
- package/lib/cjs/content-fields/hubtype-fields/capture-user-input.js.map +0 -1
- package/lib/cjs/content-fields/hubtype-fields/carousel.d.ts +0 -17
- package/lib/cjs/content-fields/hubtype-fields/carousel.js +0 -3
- package/lib/cjs/content-fields/hubtype-fields/carousel.js.map +0 -1
- package/lib/cjs/content-fields/hubtype-fields/channel-conditional.d.ts +0 -10
- package/lib/cjs/content-fields/hubtype-fields/channel-conditional.js +0 -3
- package/lib/cjs/content-fields/hubtype-fields/channel-conditional.js.map +0 -1
- package/lib/cjs/content-fields/hubtype-fields/common.d.ts +0 -83
- package/lib/cjs/content-fields/hubtype-fields/common.js +0 -3
- package/lib/cjs/content-fields/hubtype-fields/common.js.map +0 -1
- package/lib/cjs/content-fields/hubtype-fields/country-conditional.d.ts +0 -10
- package/lib/cjs/content-fields/hubtype-fields/country-conditional.js +0 -3
- package/lib/cjs/content-fields/hubtype-fields/country-conditional.js.map +0 -1
- package/lib/cjs/content-fields/hubtype-fields/custom-conditional-v2.d.ts +0 -56
- package/lib/cjs/content-fields/hubtype-fields/custom-conditional-v2.js +0 -36
- package/lib/cjs/content-fields/hubtype-fields/custom-conditional-v2.js.map +0 -1
- package/lib/cjs/content-fields/hubtype-fields/custom-conditional.d.ts +0 -11
- package/lib/cjs/content-fields/hubtype-fields/custom-conditional.js +0 -3
- package/lib/cjs/content-fields/hubtype-fields/custom-conditional.js.map +0 -1
- package/lib/cjs/content-fields/hubtype-fields/fallback.d.ts +0 -9
- package/lib/cjs/content-fields/hubtype-fields/fallback.js +0 -3
- package/lib/cjs/content-fields/hubtype-fields/fallback.js.map +0 -1
- package/lib/cjs/content-fields/hubtype-fields/function.d.ts +0 -30
- package/lib/cjs/content-fields/hubtype-fields/function.js +0 -11
- package/lib/cjs/content-fields/hubtype-fields/function.js.map +0 -1
- package/lib/cjs/content-fields/hubtype-fields/go-to-flow.d.ts +0 -9
- package/lib/cjs/content-fields/hubtype-fields/go-to-flow.js +0 -3
- package/lib/cjs/content-fields/hubtype-fields/go-to-flow.js.map +0 -1
- package/lib/cjs/content-fields/hubtype-fields/handoff.d.ts +0 -11
- package/lib/cjs/content-fields/hubtype-fields/handoff.js +0 -3
- package/lib/cjs/content-fields/hubtype-fields/handoff.js.map +0 -1
- package/lib/cjs/content-fields/hubtype-fields/image.d.ts +0 -8
- package/lib/cjs/content-fields/hubtype-fields/image.js +0 -3
- package/lib/cjs/content-fields/hubtype-fields/image.js.map +0 -1
- package/lib/cjs/content-fields/hubtype-fields/index.d.ts +0 -26
- package/lib/cjs/content-fields/hubtype-fields/index.js +0 -30
- package/lib/cjs/content-fields/hubtype-fields/index.js.map +0 -1
- package/lib/cjs/content-fields/hubtype-fields/keyword.d.ts +0 -9
- package/lib/cjs/content-fields/hubtype-fields/keyword.js +0 -3
- package/lib/cjs/content-fields/hubtype-fields/keyword.js.map +0 -1
- package/lib/cjs/content-fields/hubtype-fields/node-types.d.ts +0 -30
- package/lib/cjs/content-fields/hubtype-fields/node-types.js +0 -37
- package/lib/cjs/content-fields/hubtype-fields/node-types.js.map +0 -1
- package/lib/cjs/content-fields/hubtype-fields/nodes.d.ts +0 -25
- package/lib/cjs/content-fields/hubtype-fields/nodes.js +0 -3
- package/lib/cjs/content-fields/hubtype-fields/nodes.js.map +0 -1
- package/lib/cjs/content-fields/hubtype-fields/payload.d.ts +0 -8
- package/lib/cjs/content-fields/hubtype-fields/payload.js +0 -3
- package/lib/cjs/content-fields/hubtype-fields/payload.js.map +0 -1
- package/lib/cjs/content-fields/hubtype-fields/queue-status-conditional.d.ts +0 -25
- package/lib/cjs/content-fields/hubtype-fields/queue-status-conditional.js +0 -3
- package/lib/cjs/content-fields/hubtype-fields/queue-status-conditional.js.map +0 -1
- package/lib/cjs/content-fields/hubtype-fields/rating.d.ts +0 -23
- package/lib/cjs/content-fields/hubtype-fields/rating.js +0 -9
- package/lib/cjs/content-fields/hubtype-fields/rating.js.map +0 -1
- package/lib/cjs/content-fields/hubtype-fields/smart-intent.d.ts +0 -12
- package/lib/cjs/content-fields/hubtype-fields/smart-intent.js +0 -3
- package/lib/cjs/content-fields/hubtype-fields/smart-intent.js.map +0 -1
- package/lib/cjs/content-fields/hubtype-fields/text.d.ts +0 -11
- package/lib/cjs/content-fields/hubtype-fields/text.js +0 -3
- package/lib/cjs/content-fields/hubtype-fields/text.js.map +0 -1
- package/lib/cjs/content-fields/hubtype-fields/url.d.ts +0 -8
- package/lib/cjs/content-fields/hubtype-fields/url.js +0 -3
- package/lib/cjs/content-fields/hubtype-fields/url.js.map +0 -1
- package/lib/cjs/content-fields/hubtype-fields/video.d.ts +0 -8
- package/lib/cjs/content-fields/hubtype-fields/video.js +0 -3
- package/lib/cjs/content-fields/hubtype-fields/video.js.map +0 -1
- package/lib/cjs/content-fields/hubtype-fields/webview.d.ts +0 -17
- package/lib/cjs/content-fields/hubtype-fields/webview.js +0 -3
- package/lib/cjs/content-fields/hubtype-fields/webview.js.map +0 -1
- package/lib/cjs/content-fields/hubtype-fields/whatsapp-button-list.d.ts +0 -21
- package/lib/cjs/content-fields/hubtype-fields/whatsapp-button-list.js +0 -3
- package/lib/cjs/content-fields/hubtype-fields/whatsapp-button-list.js.map +0 -1
- package/lib/cjs/content-fields/hubtype-fields/whatsapp-cta-url-button.d.ts +0 -17
- package/lib/cjs/content-fields/hubtype-fields/whatsapp-cta-url-button.js +0 -3
- package/lib/cjs/content-fields/hubtype-fields/whatsapp-cta-url-button.js.map +0 -1
- package/lib/cjs/content-fields/hubtype-fields/whatsapp-template.d.ts +0 -92
- package/lib/cjs/content-fields/hubtype-fields/whatsapp-template.js +0 -9
- package/lib/cjs/content-fields/hubtype-fields/whatsapp-template.js.map +0 -1
- package/lib/cjs/content-fields/index.d.ts +0 -24
- package/lib/cjs/content-fields/index.js +0 -50
- package/lib/cjs/content-fields/index.js.map +0 -1
- package/lib/cjs/content-fields/whatsapp-button-list/flow-whatsapp-button-list-row.d.ts +0 -14
- package/lib/cjs/content-fields/whatsapp-button-list/flow-whatsapp-button-list-row.js +0 -41
- package/lib/cjs/content-fields/whatsapp-button-list/flow-whatsapp-button-list-row.js.map +0 -1
- package/lib/cjs/content-fields/whatsapp-button-list/flow-whatsapp-button-list-section.d.ts +0 -13
- package/lib/cjs/content-fields/whatsapp-button-list/flow-whatsapp-button-list-section.js +0 -36
- package/lib/cjs/content-fields/whatsapp-button-list/flow-whatsapp-button-list-section.js.map +0 -1
- package/lib/cjs/content-fields/whatsapp-button-list/flow-whatsapp-button-list.d.ts +0 -14
- package/lib/cjs/content-fields/whatsapp-button-list/flow-whatsapp-button-list.js +0 -46
- package/lib/cjs/content-fields/whatsapp-button-list/flow-whatsapp-button-list.js.map +0 -1
- package/lib/cjs/content-fields/whatsapp-button-list/index.d.ts +0 -3
- package/lib/cjs/content-fields/whatsapp-button-list/index.js +0 -10
- package/lib/cjs/content-fields/whatsapp-button-list/index.js.map +0 -1
- package/lib/cjs/filters/index.d.ts +0 -12
- package/lib/cjs/filters/index.js +0 -17
- package/lib/cjs/filters/index.js.map +0 -1
- package/lib/cjs/flow-factory.d.ts +0 -12
- package/lib/cjs/flow-factory.js +0 -67
- package/lib/cjs/flow-factory.js.map +0 -1
- package/lib/cjs/functions/index.d.ts +0 -11
- package/lib/cjs/functions/index.js +0 -49
- package/lib/cjs/functions/index.js.map +0 -1
- package/lib/cjs/index.d.ts +0 -45
- package/lib/cjs/index.js +0 -178
- package/lib/cjs/index.js.map +0 -1
- package/lib/cjs/services/hubtype-queues-api.d.ts +0 -14
- package/lib/cjs/services/hubtype-queues-api.js +0 -26
- package/lib/cjs/services/hubtype-queues-api.js.map +0 -1
- package/lib/cjs/structured-output/flow-builder-content.d.ts +0 -13
- package/lib/cjs/structured-output/flow-builder-content.js +0 -15
- package/lib/cjs/structured-output/flow-builder-content.js.map +0 -1
- package/lib/cjs/tracking.d.ts +0 -16
- package/lib/cjs/tracking.js +0 -71
- package/lib/cjs/tracking.js.map +0 -1
- package/lib/cjs/types.d.ts +0 -62
- package/lib/cjs/types.js +0 -14
- package/lib/cjs/types.js.map +0 -1
- package/lib/cjs/user-input/capture-user-input-api.d.ts +0 -21
- package/lib/cjs/user-input/capture-user-input-api.js +0 -88
- package/lib/cjs/user-input/capture-user-input-api.js.map +0 -1
- package/lib/cjs/user-input/index.d.ts +0 -4
- package/lib/cjs/user-input/index.js +0 -37
- package/lib/cjs/user-input/index.js.map +0 -1
- package/lib/cjs/user-input/keyword.d.ts +0 -27
- package/lib/cjs/user-input/keyword.js +0 -84
- package/lib/cjs/user-input/keyword.js.map +0 -1
- package/lib/cjs/user-input/smart-intent.d.ts +0 -24
- package/lib/cjs/user-input/smart-intent.js +0 -89
- package/lib/cjs/user-input/smart-intent.js.map +0 -1
- package/lib/cjs/utils/ai-agent.d.ts +0 -11
- package/lib/cjs/utils/ai-agent.js +0 -28
- package/lib/cjs/utils/ai-agent.js.map +0 -1
- package/lib/cjs/utils/authentication.d.ts +0 -2
- package/lib/cjs/utils/authentication.js +0 -21
- package/lib/cjs/utils/authentication.js.map +0 -1
- package/lib/cjs/utils/flow-locale.d.ts +0 -22
- package/lib/cjs/utils/flow-locale.js +0 -79
- package/lib/cjs/utils/flow-locale.js.map +0 -1
- package/lib/cjs/utils/get-flow-builder-plugin.d.ts +0 -3
- package/lib/cjs/utils/get-flow-builder-plugin.js +0 -16
- package/lib/cjs/utils/get-flow-builder-plugin.js.map +0 -1
- package/lib/cjs/utils/hubtype-assistant-content.d.ts +0 -12
- package/lib/cjs/utils/hubtype-assistant-content.js +0 -173
- package/lib/cjs/utils/hubtype-assistant-content.js.map +0 -1
- package/lib/cjs/utils/input.d.ts +0 -6
- package/lib/cjs/utils/input.js +0 -35
- package/lib/cjs/utils/input.js.map +0 -1
- package/lib/cjs/webview/contents-context.d.ts +0 -2
- package/lib/cjs/webview/contents-context.js +0 -12
- package/lib/cjs/webview/contents-context.js.map +0 -1
- package/lib/cjs/webview/index.d.ts +0 -3
- package/lib/cjs/webview/index.js +0 -10
- package/lib/cjs/webview/index.js.map +0 -1
- package/lib/cjs/webview/types.d.ts +0 -47
- package/lib/cjs/webview/types.js +0 -9
- package/lib/cjs/webview/types.js.map +0 -1
- package/lib/cjs/webview/use-webview-contents.d.ts +0 -2
- package/lib/cjs/webview/use-webview-contents.js +0 -83
- package/lib/cjs/webview/use-webview-contents.js.map +0 -1
package/lib/esm/utils/input.js
CHANGED
|
@@ -1,21 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const get_flow_builder_plugin_1 = require("./get-flow-builder-plugin");
|
|
1
|
+
import { INPUT } from "@botonic/core";
|
|
2
|
+
import { getFlowBuilderPlugin } from "./get-flow-builder-plugin.js";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
9
8
|
function inputHasTextOrTranscript(input) {
|
|
10
|
-
const isTextInput = Boolean(input.data) && input.type ===
|
|
11
|
-
const isTranscriptText = Boolean(input.transcript) && input.type ===
|
|
9
|
+
const isTextInput = Boolean(input.data) && input.type === INPUT.TEXT;
|
|
10
|
+
const isTranscriptText = Boolean(input.transcript) && input.type === INPUT.AUDIO;
|
|
12
11
|
return isTextInput || isTranscriptText;
|
|
13
12
|
}
|
|
14
13
|
function getTextOrTranscript(input) {
|
|
15
|
-
if (input.type ===
|
|
14
|
+
if (input.type === INPUT.TEXT && input.data) {
|
|
16
15
|
return input.data;
|
|
17
16
|
}
|
|
18
|
-
if (input.type ===
|
|
17
|
+
if (input.type === INPUT.AUDIO && input.transcript) {
|
|
19
18
|
return input.transcript;
|
|
20
19
|
}
|
|
21
20
|
console.error('No text or transcript found in input', input);
|
|
@@ -23,8 +22,8 @@ function getTextOrTranscript(input) {
|
|
|
23
22
|
}
|
|
24
23
|
function isNluAllowed(request, nluFlag) {
|
|
25
24
|
const shadowing = Boolean(request.session._shadowing);
|
|
26
|
-
const flowBuilderPlugin =
|
|
27
|
-
return !shadowing ||
|
|
25
|
+
const flowBuilderPlugin = getFlowBuilderPlugin(request.plugins);
|
|
26
|
+
return !shadowing || shadowing && flowBuilderPlugin.inShadowing[nluFlag];
|
|
28
27
|
}
|
|
29
28
|
function isKeywordsAllowed(request) {
|
|
30
29
|
return isNluAllowed(request, 'allowKeywords');
|
|
@@ -32,4 +31,7 @@ function isKeywordsAllowed(request) {
|
|
|
32
31
|
function isSmartIntentsAllowed(request) {
|
|
33
32
|
return isNluAllowed(request, 'allowSmartIntents');
|
|
34
33
|
}
|
|
34
|
+
|
|
35
|
+
export { getTextOrTranscript, inputHasTextOrTranscript, isKeywordsAllowed, isSmartIntentsAllowed };
|
|
36
|
+
|
|
35
37
|
//# sourceMappingURL=input.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.js","
|
|
1
|
+
{"version":3,"file":"utils/input.js","sources":["../../../src/utils/input.ts"],"sourcesContent":["import { INPUT, type Input } from '@botonic/core'\nimport type { ActionRequest } from '@botonic/react'\n\nimport type { InShadowingConfig } from '../types'\nimport { getFlowBuilderPlugin } from './get-flow-builder-plugin'\n\nexport function inputHasTextOrTranscript(input: Input): boolean {\n const isTextInput = Boolean(input.data) && input.type === INPUT.TEXT\n const isTranscriptText =\n Boolean(input.transcript) && input.type === INPUT.AUDIO\n\n return isTextInput || isTranscriptText\n}\n\nexport function getTextOrTranscript(input: Input): string | undefined {\n if (input.type === INPUT.TEXT && input.data) {\n return input.data\n }\n if (input.type === INPUT.AUDIO && input.transcript) {\n return input.transcript\n }\n\n console.error('No text or transcript found in input', input)\n return undefined\n}\n\nfunction isNluAllowed(\n request: ActionRequest,\n nluFlag: keyof InShadowingConfig\n): boolean {\n const shadowing = Boolean(request.session._shadowing)\n const flowBuilderPlugin = getFlowBuilderPlugin(request.plugins)\n return !shadowing || (shadowing && flowBuilderPlugin.inShadowing[nluFlag])\n}\n\nexport function isKeywordsAllowed(request: ActionRequest): boolean {\n return isNluAllowed(request, 'allowKeywords')\n}\n\nexport function isSmartIntentsAllowed(request: ActionRequest): boolean {\n return isNluAllowed(request, 'allowSmartIntents')\n}\n"],"names":["INPUT","getFlowBuilderPlugin","inputHasTextOrTranscript","input","isTextInput","Boolean","isTranscriptText","getTextOrTranscript","console","undefined","isNluAllowed","request","nluFlag","shadowing","flowBuilderPlugin","isKeywordsAllowed","isSmartIntentsAllowed"],"mappings":";;;;;AAAiD;AAIe;AAEzD,SAASE,wBAAwBA,CAACC,KAAY;IACnD,MAAMC,cAAcC,QAAQF,MAAM,IAAI,KAAKA,MAAM,IAAI,KAAKH,UAAU;IACpE,MAAMM,mBACJD,QAAQF,MAAM,UAAU,KAAKA,MAAM,IAAI,KAAKH,WAAW;IAEzD,OAAOI,eAAeE;AACxB;AAEO,SAASC,mBAAmBA,CAACJ,KAAY;IAC9C,IAAIA,MAAM,IAAI,KAAKH,UAAU,IAAIG,MAAM,IAAI,EAAE;QAC3C,OAAOA,MAAM,IAAI;IACnB;IACA,IAAIA,MAAM,IAAI,KAAKH,WAAW,IAAIG,MAAM,UAAU,EAAE;QAClD,OAAOA,MAAM,UAAU;IACzB;IAEAK,QAAQ,KAAK,CAAC,wCAAwCL;IACtD,OAAOM;AACT;AAEA,SAASC,YAAYA,CACnBC,OAAsB,EACtBC,OAAgC;IAEhC,MAAMC,YAAYR,QAAQM,QAAQ,OAAO,CAAC,UAAU;IACpD,MAAMG,oBAAoBb,oBAAoBA,CAACU,QAAQ,OAAO;IAC9D,OAAO,CAACE,aAAcA,aAAaC,kBAAkB,WAAW,CAACF,QAAQ;AAC3E;AAEO,SAASG,iBAAiBA,CAACJ,OAAsB;IACtD,OAAOD,YAAYA,CAACC,SAAS;AAC/B;AAEO,SAASK,qBAAqBA,CAACL,OAAsB;IAC1D,OAAOD,YAAYA,CAACC,SAAS;AAC/B"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { MapContentsType, WebviewContentsContextType } from './types';
|
|
1
|
+
import type { MapContentsType, WebviewContentsContextType } from './types.js';
|
|
2
2
|
export declare const createWebviewContentsContext: <T extends MapContentsType>() => import("react").Context<WebviewContentsContextType<T>>;
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const createWebviewContentsContext = ()
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
});
|
|
11
|
-
|
|
1
|
+
import { createContext } from "react";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
const createWebviewContentsContext = ()=>createContext({
|
|
6
|
+
getTextContent: ()=>'',
|
|
7
|
+
getImageSrc: ()=>'',
|
|
8
|
+
setCurrentLocale: ()=>undefined,
|
|
9
|
+
contents: {}
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
export { createWebviewContentsContext };
|
|
13
|
+
|
|
12
14
|
//# sourceMappingURL=contents-context.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contents-context.js","
|
|
1
|
+
{"version":3,"file":"webview/contents-context.js","sources":["../../../src/webview/contents-context.ts"],"sourcesContent":["import { createContext } from 'react'\n\nimport type { MapContentsType, WebviewContentsContextType } from './types'\n\nexport const createWebviewContentsContext = <T extends MapContentsType>() =>\n createContext<WebviewContentsContextType<T>>({\n getTextContent: () => '',\n getImageSrc: () => '',\n setCurrentLocale: () => undefined,\n contents: {} as Record<keyof T, string>,\n })\n"],"names":["createContext","createWebviewContentsContext","undefined"],"mappings":";;;AAAqC;AAI9B,MAAMC,4BAA4BA,GAAG,IAC1CD,aAAaA,CAAgC;QAC3C,gBAAgB,IAAM;QACtB,aAAa,IAAM;QACnB,kBAAkB,IAAME;QACxB,UAAU,CAAC;IACb,GAAE"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { createWebviewContentsContext } from './contents-context';
|
|
2
|
-
export * from './types';
|
|
3
|
-
export { useWebviewContents } from './use-webview-contents';
|
|
1
|
+
export { createWebviewContentsContext } from './contents-context.js';
|
|
2
|
+
export * from './types.js';
|
|
3
|
+
export { useWebviewContents } from './use-webview-contents.js';
|
package/lib/esm/webview/index.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
export * from "./types.js";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
export { createWebviewContentsContext } from "./contents-context.js";
|
|
9
|
+
export { useWebviewContents } from "./use-webview-contents.js";
|
|
10
|
+
|
|
10
11
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","
|
|
1
|
+
{"version":3,"file":"webview/index.js","sources":["../../../src/webview/index.ts"],"sourcesContent":["export { createWebviewContentsContext } from './contents-context'\nexport * from './types'\nexport { useWebviewContents } from './use-webview-contents'\n"],"names":["createWebviewContentsContext","useWebviewContents"],"mappings":";;;AAAiE;AAC1C;AACoC"}
|
package/lib/esm/webview/types.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WebviewContentType = void 0;
|
|
4
|
-
var WebviewContentType;
|
|
5
|
-
(function (WebviewContentType) {
|
|
1
|
+
var types_WebviewContentType = /*#__PURE__*/ function(WebviewContentType) {
|
|
6
2
|
WebviewContentType["TEXT"] = "webview-text";
|
|
7
3
|
WebviewContentType["IMAGE"] = "webview-image";
|
|
8
|
-
|
|
4
|
+
return WebviewContentType;
|
|
5
|
+
}({});
|
|
6
|
+
|
|
7
|
+
export { types_WebviewContentType as WebviewContentType };
|
|
8
|
+
|
|
9
9
|
//# sourceMappingURL=types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","
|
|
1
|
+
{"version":3,"file":"webview/types.js","sources":["../../../src/webview/types.ts"],"sourcesContent":["import type { FlowBuilderJSONVersion } from '../types'\n\nexport enum WebviewContentType {\n TEXT = 'webview-text',\n IMAGE = 'webview-image',\n}\n\nexport type WebviewContentsResponse = (\n | WebviewTextContent\n | WebviewImageContent\n)[]\n\nexport interface WebviewTextContent {\n code: string\n type: WebviewContentType.TEXT\n content: {\n text: { message: string; locale: string }[]\n }\n}\n\nexport interface WebviewImageContent {\n code: string\n type: WebviewContentType.IMAGE\n content: {\n image: { file: string; locale: string }[]\n }\n}\n\nexport type MapContentsType = Record<string, string>\n\nexport interface UseWebviewContentsProps<T extends MapContentsType> {\n apiUrl?: string\n version?: FlowBuilderJSONVersion\n botId: string\n webviewId: string\n providerId: string\n locale: string\n mapContents: Record<keyof T, string>\n}\n\nexport interface UseWebviewContents<T extends MapContentsType> {\n isLoading: boolean\n error: boolean\n webviewContentsContext: WebviewContentsContextType<T>\n}\n\nexport interface WebviewContentsContextType<T extends MapContentsType> {\n getTextContent: (code: string) => string\n getImageSrc: (code: string) => string\n setCurrentLocale: (locale: string) => void\n contents: Record<keyof T, string>\n}\n"],"names":["WebviewContentType"],"mappings":"AAEO,IAAKA,wBAAkBA,0BAAlBA;;;WAAAA;MAGX"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { type MapContentsType, type UseWebviewContents, type UseWebviewContentsProps } from './types';
|
|
1
|
+
import { type MapContentsType, type UseWebviewContents, type UseWebviewContentsProps } from './types.js';
|
|
2
2
|
export declare function useWebviewContents<T extends MapContentsType>({ apiUrl, version, botId, webviewId, providerId, locale, mapContents, }: UseWebviewContentsProps<T>): UseWebviewContents<T>;
|
|
@@ -1,24 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
import axios from "axios";
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
import { FLOW_BUILDER_API_URL_PROD } from "../constants.js";
|
|
4
|
+
import { FlowBuilderJSONVersion } from "../types.js";
|
|
5
|
+
import { WebviewContentType } from "./types.js";
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
function useWebviewContents({ apiUrl = FLOW_BUILDER_API_URL_PROD, version = FlowBuilderJSONVersion.LATEST, botId, webviewId, providerId, locale, mapContents }) {
|
|
18
|
+
const [textContents, setTextContents] = useState();
|
|
19
|
+
const [imageContents, setImageContents] = useState();
|
|
20
|
+
const [contents, setContents] = useState({});
|
|
21
|
+
const [currentLocale, setCurrentLocale] = useState(locale);
|
|
22
|
+
const [error, setError] = useState(false);
|
|
23
|
+
const updateCurrentLocale = (textContents)=>{
|
|
17
24
|
if (!textContents || textContents.length === 0) {
|
|
18
25
|
console.log('There is no text contents to check the locale');
|
|
19
26
|
return;
|
|
20
27
|
}
|
|
21
|
-
const locales = textContents[0].content.text.map(text
|
|
28
|
+
const locales = textContents[0].content.text.map((text)=>text.locale);
|
|
22
29
|
const language = currentLocale.split('-')[0];
|
|
23
30
|
if (locales.includes(currentLocale)) {
|
|
24
31
|
setCurrentLocale(currentLocale);
|
|
@@ -30,39 +37,36 @@ function useWebviewContents({ apiUrl = constants_1.FLOW_BUILDER_API_URL_PROD, ve
|
|
|
30
37
|
}
|
|
31
38
|
console.error(`locale: ${currentLocale} cannot be resolved with: ${locales.join(', ')}`);
|
|
32
39
|
};
|
|
33
|
-
const getTextContent = (contentID)
|
|
34
|
-
return (
|
|
35
|
-
?.find(textContent => textContent.code === contentID)
|
|
36
|
-
?.content.text.find(text => text.locale === currentLocale)?.message ||
|
|
37
|
-
'');
|
|
40
|
+
const getTextContent = (contentID)=>{
|
|
41
|
+
return textContents?.find((textContent)=>textContent.code === contentID)?.content.text.find((text)=>text.locale === currentLocale)?.message || '';
|
|
38
42
|
};
|
|
39
|
-
const getImageSrc = (contentID)
|
|
40
|
-
return (
|
|
41
|
-
?.find(imageContent => imageContent.code === contentID)
|
|
42
|
-
?.content.image.find(image => image.locale === currentLocale)?.file ||
|
|
43
|
-
'');
|
|
43
|
+
const getImageSrc = (contentID)=>{
|
|
44
|
+
return imageContents?.find((imageContent)=>imageContent.code === contentID)?.content.image.find((image)=>image.locale === currentLocale)?.file || '';
|
|
44
45
|
};
|
|
45
|
-
|
|
46
|
+
useEffect(()=>{
|
|
46
47
|
if (textContents || imageContents) {
|
|
47
48
|
const contentsObject = {};
|
|
48
|
-
for (const [key, value] of Object.entries(mapContents))
|
|
49
|
+
for (const [key, value] of Object.entries(mapContents)){
|
|
49
50
|
contentsObject[key] = getTextContent(value) || getImageSrc(value);
|
|
50
51
|
}
|
|
51
52
|
setContents(contentsObject);
|
|
52
53
|
}
|
|
53
|
-
}, [
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
}, [
|
|
55
|
+
textContents,
|
|
56
|
+
imageContents,
|
|
57
|
+
currentLocale
|
|
58
|
+
]);
|
|
59
|
+
useEffect(()=>{
|
|
60
|
+
const getResponseContents = async ()=>{
|
|
56
61
|
const url = `${apiUrl}/v1/bot_flows/${botId}/versions/${version}/webviews/${webviewId}/?provider_id=${providerId}`;
|
|
57
62
|
try {
|
|
58
|
-
const response = await
|
|
59
|
-
const textResponseContents = response.data.filter(webviewContent
|
|
63
|
+
const response = await axios.get(url);
|
|
64
|
+
const textResponseContents = response.data.filter((webviewContent)=>webviewContent.type === WebviewContentType.TEXT);
|
|
60
65
|
setTextContents(textResponseContents);
|
|
61
|
-
const imageResponseContents = response.data.filter(webviewContent
|
|
66
|
+
const imageResponseContents = response.data.filter((webviewContent)=>webviewContent.type === WebviewContentType.IMAGE);
|
|
62
67
|
setImageContents(imageResponseContents);
|
|
63
68
|
updateCurrentLocale(textResponseContents);
|
|
64
|
-
}
|
|
65
|
-
catch (error) {
|
|
69
|
+
} catch (error) {
|
|
66
70
|
console.error('Error fetching webview contents:', error);
|
|
67
71
|
setError(true);
|
|
68
72
|
}
|
|
@@ -76,8 +80,11 @@ function useWebviewContents({ apiUrl = constants_1.FLOW_BUILDER_API_URL_PROD, ve
|
|
|
76
80
|
getTextContent,
|
|
77
81
|
getImageSrc,
|
|
78
82
|
setCurrentLocale,
|
|
79
|
-
contents
|
|
80
|
-
}
|
|
83
|
+
contents
|
|
84
|
+
}
|
|
81
85
|
};
|
|
82
86
|
}
|
|
87
|
+
|
|
88
|
+
export { useWebviewContents };
|
|
89
|
+
|
|
83
90
|
//# sourceMappingURL=use-webview-contents.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-webview-contents.js","
|
|
1
|
+
{"version":3,"file":"webview/use-webview-contents.js","sources":["../../../src/webview/use-webview-contents.ts"],"sourcesContent":["import axios from 'axios'\nimport { useEffect, useState } from 'react'\n\nimport { FLOW_BUILDER_API_URL_PROD } from '../constants'\nimport { FlowBuilderJSONVersion } from '../types'\nimport {\n type MapContentsType,\n type UseWebviewContents,\n type UseWebviewContentsProps,\n type WebviewContentsResponse,\n WebviewContentType,\n type WebviewImageContent,\n type WebviewTextContent,\n} from './types'\n\nexport function useWebviewContents<T extends MapContentsType>({\n apiUrl = FLOW_BUILDER_API_URL_PROD,\n version = FlowBuilderJSONVersion.LATEST,\n botId,\n webviewId,\n providerId,\n locale,\n mapContents,\n}: UseWebviewContentsProps<T>): UseWebviewContents<T> {\n const [textContents, setTextContents] = useState<WebviewTextContent[]>()\n const [imageContents, setImageContents] = useState<WebviewImageContent[]>()\n const [contents, setContents] = useState<Record<keyof T, string>>(\n {} as Record<keyof T, string>\n )\n const [currentLocale, setCurrentLocale] = useState(locale)\n const [error, setError] = useState(false)\n\n const updateCurrentLocale = (textContents?: WebviewTextContent[]) => {\n if (!textContents || textContents.length === 0) {\n console.log('There is no text contents to check the locale')\n return\n }\n\n const locales = textContents[0].content.text.map(text => text.locale)\n const language = currentLocale.split('-')[0]\n\n if (locales.includes(currentLocale)) {\n setCurrentLocale(currentLocale)\n return\n }\n\n if (locales.includes(language)) {\n setCurrentLocale(language)\n return\n }\n\n console.error(\n `locale: ${currentLocale} cannot be resolved with: ${locales.join(', ')}`\n )\n }\n\n const getTextContent = (contentID: string): string => {\n return (\n textContents\n ?.find(textContent => textContent.code === contentID)\n ?.content.text.find(text => text.locale === currentLocale)?.message ||\n ''\n )\n }\n\n const getImageSrc = (contentID: string): string => {\n return (\n imageContents\n ?.find(imageContent => imageContent.code === contentID)\n ?.content.image.find(image => image.locale === currentLocale)?.file ||\n ''\n )\n }\n\n useEffect(() => {\n if (textContents || imageContents) {\n const contentsObject = {}\n for (const [key, value] of Object.entries<string>(mapContents)) {\n contentsObject[key] = getTextContent(value) || getImageSrc(value)\n }\n setContents(contentsObject as Record<keyof T, string>)\n }\n }, [textContents, imageContents, currentLocale])\n\n useEffect(() => {\n const getResponseContents = async () => {\n const url = `${apiUrl}/v1/bot_flows/${botId}/versions/${version}/webviews/${webviewId}/?provider_id=${providerId}`\n try {\n const response = await axios.get<WebviewContentsResponse>(url)\n\n const textResponseContents = response.data.filter(\n webviewContent => webviewContent.type === WebviewContentType.TEXT\n ) as WebviewTextContent[]\n setTextContents(textResponseContents)\n\n const imageResponseContents = response.data.filter(\n webviewContent => webviewContent.type === WebviewContentType.IMAGE\n ) as WebviewImageContent[]\n setImageContents(imageResponseContents)\n\n updateCurrentLocale(textResponseContents)\n } catch (error) {\n console.error('Error fetching webview contents:', error)\n setError(true)\n }\n }\n getResponseContents()\n }, [])\n\n return {\n isLoading: Object.keys(contents).length === 0,\n error,\n webviewContentsContext: {\n getTextContent,\n getImageSrc,\n setCurrentLocale,\n contents,\n },\n }\n}\n"],"names":["axios","useEffect","useState","FLOW_BUILDER_API_URL_PROD","FlowBuilderJSONVersion","WebviewContentType","useWebviewContents","apiUrl","version","botId","webviewId","providerId","locale","mapContents","textContents","setTextContents","imageContents","setImageContents","contents","setContents","currentLocale","setCurrentLocale","error","setError","updateCurrentLocale","console","locales","text","language","getTextContent","contentID","textContent","getImageSrc","imageContent","image","contentsObject","key","value","Object","getResponseContents","url","response","textResponseContents","webviewContent","imageResponseContents"],"mappings":";;;;;;;;;;;AAAyB;AACkB;AAEa;AACP;AASjC;AAET,SAASM,kBAAkBA,CAA4B,EAC5DC,SAASJ,yBAAyB,EAClCK,UAAUJ,6BAA6B,EACvCK,KAAK,EACLC,SAAS,EACTC,UAAU,EACVC,MAAM,EACNC,WAAW,EACgB;IAC3B,MAAM,CAACC,cAAcC,gBAAgB,GAAGb,QAAQA;IAChD,MAAM,CAACc,eAAeC,iBAAiB,GAAGf,QAAQA;IAClD,MAAM,CAACgB,UAAUC,YAAY,GAAGjB,QAAQA,CACtC,CAAC;IAEH,MAAM,CAACkB,eAAeC,iBAAiB,GAAGnB,QAAQA,CAACU;IACnD,MAAM,CAACU,OAAOC,SAAS,GAAGrB,QAAQA,CAAC;IAEnC,MAAMsB,sBAAsB,CAACV;QAC3B,IAAI,CAACA,gBAAgBA,aAAa,MAAM,KAAK,GAAG;YAC9CW,QAAQ,GAAG,CAAC;YACZ;QACF;QAEA,MAAMC,UAAUZ,YAAY,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAACa,CAAAA,OAAQA,KAAK,MAAM;QACpE,MAAMC,WAAWR,cAAc,KAAK,CAAC,IAAI,CAAC,EAAE;QAE5C,IAAIM,QAAQ,QAAQ,CAACN,gBAAgB;YACnCC,iBAAiBD;YACjB;QACF;QAEA,IAAIM,QAAQ,QAAQ,CAACE,WAAW;YAC9BP,iBAAiBO;YACjB;QACF;QAEAH,QAAQ,KAAK,CACX,CAAC,QAAQ,EAAEL,cAAc,0BAA0B,EAAEM,QAAQ,IAAI,CAAC,OAAO;IAE7E;IAEA,MAAMG,iBAAiB,CAACC;QACtB,OACEhB,cACI,KAAKiB,CAAAA,cAAeA,YAAY,IAAI,KAAKD,YACzC,QAAQ,KAAK,KAAKH,CAAAA,OAAQA,KAAK,MAAM,KAAKP,gBAAgB,WAC9D;IAEJ;IAEA,MAAMY,cAAc,CAACF;QACnB,OACEd,eACI,KAAKiB,CAAAA,eAAgBA,aAAa,IAAI,KAAKH,YAC3C,QAAQ,MAAM,KAAKI,CAAAA,QAASA,MAAM,MAAM,KAAKd,gBAAgB,QACjE;IAEJ;IAEAnB,SAASA,CAAC;QACR,IAAIa,gBAAgBE,eAAe;YACjC,MAAMmB,iBAAiB,CAAC;YACxB,KAAK,MAAM,CAACC,KAAKC,MAAM,IAAIC,OAAO,OAAO,CAASzB,aAAc;gBAC9DsB,cAAc,CAACC,IAAI,GAAGP,eAAeQ,UAAUL,YAAYK;YAC7D;YACAlB,YAAYgB;QACd;IACF,GAAG;QAACrB;QAAcE;QAAeI;KAAc;IAE/CnB,SAASA,CAAC;QACR,MAAMsC,sBAAsB;YAC1B,MAAMC,MAAM,GAAGjC,OAAO,cAAc,EAAEE,MAAM,UAAU,EAAED,QAAQ,UAAU,EAAEE,UAAU,cAAc,EAAEC,YAAY;YAClH,IAAI;gBACF,MAAM8B,WAAW,MAAMzC,SAAS,CAA0BwC;gBAE1D,MAAME,uBAAuBD,SAAS,IAAI,CAAC,MAAM,CAC/CE,CAAAA,iBAAkBA,eAAe,IAAI,KAAKtC,uBAAuB;gBAEnEU,gBAAgB2B;gBAEhB,MAAME,wBAAwBH,SAAS,IAAI,CAAC,MAAM,CAChDE,CAAAA,iBAAkBA,eAAe,IAAI,KAAKtC,wBAAwB;gBAEpEY,iBAAiB2B;gBAEjBpB,oBAAoBkB;YACtB,EAAE,OAAOpB,OAAO;gBACdG,QAAQ,KAAK,CAAC,oCAAoCH;gBAClDC,SAAS;YACX;QACF;QACAgB;IACF,GAAG,EAAE;IAEL,OAAO;QACL,WAAWD,OAAO,IAAI,CAACpB,UAAU,MAAM,KAAK;QAC5CI;QACA,wBAAwB;YACtBO;YACAG;YACAX;YACAH;QACF;IACF;AACF"}
|
package/package.json
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@botonic/plugin-flow-builder",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"main": "./lib/
|
|
3
|
+
"version": "0.57.0-rslib-esm.0",
|
|
4
|
+
"main": "./lib/esm/index.js",
|
|
5
5
|
"module": "./lib/esm/index.js",
|
|
6
6
|
"description": "Use Flow Builder to show your contents",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"build": "
|
|
9
|
-
"build:watch": "
|
|
8
|
+
"build": "node ../../scripts/build/clean.mjs && rslib build --no-env",
|
|
9
|
+
"build:watch": "node ../../scripts/build/clean.mjs && rslib build --watch --no-env",
|
|
10
10
|
"test": "../../node_modules/.bin/jest --coverage",
|
|
11
11
|
"cloc": "../../scripts/qa/cloc-package.sh .",
|
|
12
|
-
"prepublishOnly": "
|
|
12
|
+
"prepublishOnly": "npm run build && npm run test && npm run lint",
|
|
13
13
|
"lint": "biome check --write src/ tests/",
|
|
14
14
|
"lint:check": "biome check src/ tests/",
|
|
15
15
|
"format": "biome format --write src/ tests/"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@botonic/react": "^0.
|
|
18
|
+
"@botonic/react": "^0.57.0-rslib-esm.0",
|
|
19
19
|
"axios": "^1.18.1",
|
|
20
20
|
"uuid": "^10.0.0"
|
|
21
21
|
},
|
|
@@ -46,5 +46,6 @@
|
|
|
46
46
|
],
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@types/uuid": "^10.0.0"
|
|
49
|
-
}
|
|
49
|
+
},
|
|
50
|
+
"types": "./lib/esm/index.d.ts"
|
|
50
51
|
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { type BotContext, isWhatsapp } from '@botonic/core'
|
|
2
|
+
import { Text, WhatsappRequestContactInfo } from '@botonic/react'
|
|
3
|
+
|
|
4
|
+
import { trackOneContent } from '../tracking'
|
|
5
|
+
import { ContentFieldsBase } from './content-fields-base'
|
|
6
|
+
import type { HtWhatsappRequestContactInfoNode } from './hubtype-fields'
|
|
7
|
+
|
|
8
|
+
export class FlowWhatsappRequestContactInfoNode extends ContentFieldsBase {
|
|
9
|
+
public text = ''
|
|
10
|
+
|
|
11
|
+
static fromHubtypeCMS(
|
|
12
|
+
component: HtWhatsappRequestContactInfoNode,
|
|
13
|
+
locale: string
|
|
14
|
+
): FlowWhatsappRequestContactInfoNode {
|
|
15
|
+
const requestContactInfo = new FlowWhatsappRequestContactInfoNode(
|
|
16
|
+
component.id
|
|
17
|
+
)
|
|
18
|
+
requestContactInfo.code = component.code
|
|
19
|
+
requestContactInfo.text =
|
|
20
|
+
FlowWhatsappRequestContactInfoNode.getTextByLocale(
|
|
21
|
+
locale,
|
|
22
|
+
component.content.text
|
|
23
|
+
)
|
|
24
|
+
requestContactInfo.followUp = component.follow_up
|
|
25
|
+
|
|
26
|
+
return requestContactInfo
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
async trackFlow(botContext: BotContext): Promise<void> {
|
|
30
|
+
await trackOneContent(botContext, this)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
async processContent(botContext: BotContext): Promise<void> {
|
|
34
|
+
await this.filterContent(botContext, this)
|
|
35
|
+
await this.trackFlow(botContext)
|
|
36
|
+
return
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
toBotonic(botContext: BotContext): JSX.Element {
|
|
40
|
+
const replacedText = this.replaceVariables(this.text, botContext)
|
|
41
|
+
|
|
42
|
+
if (!isWhatsapp(botContext.session)) {
|
|
43
|
+
return <Text>{replacedText}</Text>
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return <WhatsappRequestContactInfo key={this.id} body={replacedText} />
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
type WhatsappTemplateFlowButton,
|
|
14
14
|
type WhatsappTemplatePhoneNumberButton,
|
|
15
15
|
type WhatsappTemplateQuickReplyButton,
|
|
16
|
+
type WhatsappTemplateRequestContactInfoButton,
|
|
16
17
|
type WhatsappTemplateUrlButton,
|
|
17
18
|
type WhatsappTemplateVoiceCallButton,
|
|
18
19
|
} from '@botonic/react'
|
|
@@ -259,6 +260,10 @@ export class FlowWhatsappTemplate extends ContentFieldsBase {
|
|
|
259
260
|
return this.createVoiceCallButtonComponent(index)
|
|
260
261
|
}
|
|
261
262
|
|
|
263
|
+
if (button.type === WhatsAppTemplateButtonSubType.REQUEST_CONTACT_INFO) {
|
|
264
|
+
return this.createRequestContactInfoButtonComponent(index)
|
|
265
|
+
}
|
|
266
|
+
|
|
262
267
|
if (button.type === WhatsAppTemplateButtonSubType.FLOW) {
|
|
263
268
|
const actionValue = flowButtonActionValues?.[String(index)]
|
|
264
269
|
if (!actionValue) {
|
|
@@ -340,6 +345,17 @@ export class FlowWhatsappTemplate extends ContentFieldsBase {
|
|
|
340
345
|
}
|
|
341
346
|
}
|
|
342
347
|
|
|
348
|
+
private createRequestContactInfoButtonComponent(
|
|
349
|
+
index: number
|
|
350
|
+
): WhatsappTemplateRequestContactInfoButton {
|
|
351
|
+
return {
|
|
352
|
+
type: WhatsAppTemplateComponentType.BUTTON,
|
|
353
|
+
sub_type: WhatsAppTemplateButtonSubType.REQUEST_CONTACT_INFO,
|
|
354
|
+
index: index,
|
|
355
|
+
parameters: [],
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
|
|
343
359
|
private resolveFlowActionData(
|
|
344
360
|
flowActionData: Record<string, string> | undefined,
|
|
345
361
|
botContext: BotContext
|
|
@@ -10,6 +10,7 @@ export enum HtNodeWithContentType {
|
|
|
10
10
|
VIDEO = 'video',
|
|
11
11
|
WHATSAPP_BUTTON_LIST = 'whatsapp-button-list',
|
|
12
12
|
WHATSAPP_CTA_URL_BUTTON = 'whatsapp-cta-url-button',
|
|
13
|
+
WHATSAPP_REQUEST_CONTACT_INFO = 'whatsapp-request-contact-info',
|
|
13
14
|
WHATSAPP_TEMPLATE = 'whatsapp-template',
|
|
14
15
|
BOT_ACTION = 'bot-action',
|
|
15
16
|
AI_AGENT = 'ai-agent',
|
|
@@ -23,6 +23,7 @@ import type { HtVideoNode } from './video'
|
|
|
23
23
|
import type { HtWebviewNode } from './webview'
|
|
24
24
|
import type { HtWhatsappButtonListNode } from './whatsapp-button-list'
|
|
25
25
|
import type { HtWhatsappCTAUrlButtonNode } from './whatsapp-cta-url-button'
|
|
26
|
+
import type { HtWhatsappRequestContactInfoNode } from './whatsapp-request-contact-info'
|
|
26
27
|
import type { HtWhatsappTemplateNode } from './whatsapp-template'
|
|
27
28
|
|
|
28
29
|
export type HtNodeWithContent =
|
|
@@ -36,6 +37,7 @@ export type HtNodeWithContent =
|
|
|
36
37
|
| HtFallbackNode
|
|
37
38
|
| HtWhatsappButtonListNode
|
|
38
39
|
| HtWhatsappCTAUrlButtonNode
|
|
40
|
+
| HtWhatsappRequestContactInfoNode
|
|
39
41
|
| HtSmartIntentNode
|
|
40
42
|
| HtBotActionNode
|
|
41
43
|
| HtAiAgentNode
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { HtBaseNode, HtTextLocale } from './common'
|
|
2
|
+
import type { HtNodeWithContentType } from './node-types'
|
|
3
|
+
|
|
4
|
+
export interface HtWhatsappRequestContactInfoNode extends HtBaseNode {
|
|
5
|
+
type: HtNodeWithContentType.WHATSAPP_REQUEST_CONTACT_INFO
|
|
6
|
+
content: {
|
|
7
|
+
text: HtTextLocale[]
|
|
8
|
+
}
|
|
9
|
+
}
|
|
@@ -15,6 +15,7 @@ import { FlowRating } from './flow-rating'
|
|
|
15
15
|
import { FlowText } from './flow-text'
|
|
16
16
|
import { FlowVideo } from './flow-video'
|
|
17
17
|
import { FlowWhatsappCtaUrlButtonNode } from './flow-whatsapp-cta-url-button'
|
|
18
|
+
import { FlowWhatsappRequestContactInfoNode } from './flow-whatsapp-request-contact-info'
|
|
18
19
|
import { FlowWhatsappTemplate } from './flow-whatsapp-template'
|
|
19
20
|
import {
|
|
20
21
|
FlowWhatsappButtonList,
|
|
@@ -45,6 +46,7 @@ export {
|
|
|
45
46
|
FlowWhatsappButtonListRow,
|
|
46
47
|
FlowWhatsappButtonListSection,
|
|
47
48
|
FlowWhatsappCtaUrlButtonNode,
|
|
49
|
+
FlowWhatsappRequestContactInfoNode,
|
|
48
50
|
FlowWhatsappTemplate,
|
|
49
51
|
FlowCustomConditionalV2,
|
|
50
52
|
}
|
|
@@ -56,6 +58,7 @@ export type FlowContent =
|
|
|
56
58
|
| FlowVideo
|
|
57
59
|
| FlowWhatsappButtonList
|
|
58
60
|
| FlowWhatsappCtaUrlButtonNode
|
|
61
|
+
| FlowWhatsappRequestContactInfoNode
|
|
59
62
|
| FlowWhatsappTemplate
|
|
60
63
|
| FlowHandoff
|
|
61
64
|
| FlowBotAction
|
package/src/flow-factory.ts
CHANGED
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
FlowVideo,
|
|
21
21
|
FlowWhatsappButtonList,
|
|
22
22
|
FlowWhatsappCtaUrlButtonNode,
|
|
23
|
+
FlowWhatsappRequestContactInfoNode,
|
|
23
24
|
FlowWhatsappTemplate,
|
|
24
25
|
} from './content-fields'
|
|
25
26
|
import { FlowCaptureUserInput } from './content-fields/flow-capture-user-input'
|
|
@@ -75,6 +76,11 @@ export class FlowFactory {
|
|
|
75
76
|
this.cmsApi,
|
|
76
77
|
this.botContext
|
|
77
78
|
)
|
|
79
|
+
case HtNodeWithContentType.WHATSAPP_REQUEST_CONTACT_INFO:
|
|
80
|
+
return FlowWhatsappRequestContactInfoNode.fromHubtypeCMS(
|
|
81
|
+
hubtypeContent,
|
|
82
|
+
this.locale
|
|
83
|
+
)
|
|
78
84
|
case HtNodeWithContentType.HANDOFF:
|
|
79
85
|
return FlowHandoff.fromHubtypeCMS(
|
|
80
86
|
hubtypeContent,
|
package/src/index.ts
CHANGED
|
@@ -275,16 +275,16 @@ export default class BotonicPluginFlowBuilder implements Plugin {
|
|
|
275
275
|
export * from './action'
|
|
276
276
|
export { AGENT_RATING_PAYLOAD, EMPTY_PAYLOAD } from './constants'
|
|
277
277
|
export * from './content-fields'
|
|
278
|
-
export { HtBotActionNode } from './content-fields/hubtype-fields'
|
|
278
|
+
export type { HtBotActionNode } from './content-fields/hubtype-fields'
|
|
279
279
|
export {
|
|
280
280
|
getCommonFlowContentEventArgsForContentId,
|
|
281
281
|
trackFlowContent,
|
|
282
282
|
} from './tracking'
|
|
283
283
|
export {
|
|
284
|
-
BotonicPluginFlowBuilderOptions,
|
|
285
|
-
ContentFilter,
|
|
284
|
+
type BotonicPluginFlowBuilderOptions,
|
|
285
|
+
type ContentFilter,
|
|
286
286
|
FlowBuilderJSONVersion,
|
|
287
|
-
PayloadParamsBase,
|
|
288
|
-
RatingSubmittedInfo,
|
|
287
|
+
type PayloadParamsBase,
|
|
288
|
+
type RatingSubmittedInfo,
|
|
289
289
|
} from './types'
|
|
290
290
|
export * from './webview'
|
package/src/types.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type {
|
|
2
2
|
AiAgentArgs,
|
|
3
|
-
|
|
3
|
+
BotContext,
|
|
4
4
|
GuardrailRule,
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
InferenceResponse,
|
|
6
|
+
PluginPreRequest,
|
|
7
|
+
ResolvedPlugins,
|
|
8
8
|
} from '@botonic/core'
|
|
9
9
|
import type { FlowContent } from './content-fields'
|
|
10
10
|
import type {
|
|
@@ -101,4 +101,4 @@ export interface RatingSubmittedInfo extends HtRatingButton {
|
|
|
101
101
|
possibleValues: number[]
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
export { AiAgentArgs, GuardrailRule }
|
|
104
|
+
export type { AiAgentArgs, GuardrailRule }
|