@botonic/plugin-flow-builder
Version:
Use Flow Builder to show your contents
34 lines • 1.41 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getNodeByUserInput = void 0;
const tslib_1 = require("tslib");
const utils_1 = require("../utils");
const keyword_1 = require("./keyword");
const smart_intent_1 = require("./smart-intent");
function getNodeByUserInput(cmsApi, locale, request, smartIntentsConfig) {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
if ((0, utils_1.inputHasTextData)(request.input)) {
if ((0, utils_1.isKeywordsAllowed)(request)) {
const keywordMatcher = new keyword_1.KeywordMatcher({
cmsApi,
locale,
request,
});
const keywordNode = yield keywordMatcher.getNodeByInput(request.input.data);
if (keywordNode) {
return keywordNode;
}
}
if ((0, utils_1.isSmartIntentsAllowed)(request)) {
const smartIntentsApi = new smart_intent_1.SmartIntentsApi(cmsApi, request, smartIntentsConfig);
const smartIntentNode = yield smartIntentsApi.getNodeByInput();
if (smartIntentNode) {
return smartIntentNode;
}
}
}
return undefined;
});
}
exports.getNodeByUserInput = getNodeByUserInput;
//# sourceMappingURL=index.js.map