@botonic/plugin-flow-builder
Version:
Botonic plugin for **Hubtype Flow Builder**: run and bridge flow-driven logic from bots on the **current** line.
46 lines • 1.95 kB
JavaScript
import { __awaiter } from "tslib";
import { getFlowBuilderPlugin } from '../utils/get-flow-builder-plugin';
import { ContentFieldsBase } from './content-fields-base';
import { HtAiValidationType, } from './hubtype-fields/capture-user-input';
export class FlowCaptureUserInput extends ContentFieldsBase {
constructor() {
super(...arguments);
this.fieldName = '';
this.aiValidationType = HtAiValidationType.NONE;
this.aiValidationInstructions = '';
this.captureSuccessId = '';
this.captureFailId = '';
}
static fromHubtypeCMS(cmsText) {
const newCaptureUserInput = new FlowCaptureUserInput(cmsText.id);
newCaptureUserInput.code = cmsText.code;
newCaptureUserInput.fieldName = cmsText.content.field_name;
newCaptureUserInput.aiValidationType =
cmsText.content.ai_validation_type || HtAiValidationType.NONE;
newCaptureUserInput.aiValidationInstructions =
cmsText.content.ai_validation_instructions || '';
newCaptureUserInput.captureSuccessId = cmsText.content.capture_success.id;
newCaptureUserInput.captureFailId = cmsText.content.capture_fail.id;
newCaptureUserInput.followUp = undefined;
return newCaptureUserInput;
}
trackFlow() {
return __awaiter(this, void 0, void 0, function* () {
return;
});
}
processContent(botonicContext) {
return __awaiter(this, void 0, void 0, function* () {
return this.filterContent(botonicContext, this);
});
}
toBotonic(botonicContext) {
return __awaiter(this, void 0, void 0, function* () {
const flowBuilderPlugin = getFlowBuilderPlugin(botonicContext.plugins);
const cmsApi = flowBuilderPlugin.cmsApi;
yield cmsApi.setCaptureUserInputId(this.id);
return;
});
}
}
//# sourceMappingURL=flow-capture-user-input.js.map