UNPKG

@botonic/plugin-flow-builder

Version:

Use Flow Builder to show your contents

30 lines 1.24 kB
import { __awaiter } from "tslib"; import { inputHasTextData, isKeywordsAllowed, isSmartIntentsAllowed, } from '../utils'; import { KeywordMatcher } from './keyword'; import { SmartIntentsApi } from './smart-intent'; export function getNodeByUserInput(cmsApi, locale, request, smartIntentsConfig) { return __awaiter(this, void 0, void 0, function* () { if (inputHasTextData(request.input)) { if (isKeywordsAllowed(request)) { const keywordMatcher = new KeywordMatcher({ cmsApi, locale, request, }); const keywordNode = yield keywordMatcher.getNodeByInput(request.input.data); if (keywordNode) { return keywordNode; } } if (isSmartIntentsAllowed(request)) { const smartIntentsApi = new SmartIntentsApi(cmsApi, request, smartIntentsConfig); const smartIntentNode = yield smartIntentsApi.getNodeByInput(); if (smartIntentNode) { return smartIntentNode; } } } return undefined; }); } //# sourceMappingURL=index.js.map