UNPKG

@botonic/plugin-flow-builder

Version:

Botonic plugin for **Hubtype Flow Builder**: run and bridge flow-driven logic from bots on the **current** line.

32 lines 1.37 kB
import { MessageType } from '@botonic/shared'; import { getFlowBuilderPlugin } from './get-flow-builder-plugin'; export function inputHasTextOrTranscript(input) { const isTextInput = Boolean(input.text) && input.type === MessageType.Text; const isTranscriptText = Boolean(input.transcript) && input.type === MessageType.Audio; return isTextInput || isTranscriptText; } export function getTextOrTranscript(input) { if (input.type === MessageType.Text && input.text) { return input.text; } if (input.type === MessageType.Audio && input.transcript) { return input.transcript; } console.error('No text or transcript found in input', input); return undefined; } function isNluAllowed(botonicContext, nluFlag) { const shadowing = Boolean(botonicContext.session.shadowing); const flowBuilderPlugin = getFlowBuilderPlugin(botonicContext.plugins); return !shadowing || (shadowing && flowBuilderPlugin.inShadowing[nluFlag]); } export function isKeywordsAllowed(botonicContext) { return isNluAllowed(botonicContext, 'allowKeywords'); } export function isSmartIntentsAllowed(botonicContext) { return isNluAllowed(botonicContext, 'allowSmartIntents'); } export function isKnowledgeBasesAllowed(botonicContext) { return isNluAllowed(botonicContext, 'allowKnowledgeBases'); } //# sourceMappingURL=input.js.map