UNPKG

prodap-chatbot-domain

Version:

Classes utilizadas na resposta de todas as Intents do Assistente Virtual

40 lines 1.41 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const Message_1 = require("../base/Message"); const MessageTypes_1 = require("../types/MessageTypes"); class FormAbstract extends Message_1.default { constructor(props, formType) { const { option, placeholder, style, subtitle, title, tooltip, url, filter, intent } = props; super('', MessageTypes_1.default.FORM); this.formType = formType; this.option = option ? this.setOptions(option) : undefined; this.placeholder = placeholder; this.style = style; this.subtitle = subtitle; this.title = this.setTitle(title); this.tooltip = tooltip; this.url = url; this.filter = filter; this.intent = intent; } setCode(prop) { return prop.code ? prop.code : ''; } setColor(prop) { return typeof prop === 'object' ? (prop.color ? prop.color : '') : prop; } setName(prop) { return prop ? prop.name : ''; } setOptions(prop) { return { name: this.setName(prop), code: this.setCode(prop) }; } setTitle(prop) { return { value: this.setValue(prop), color: this.setColor(prop) }; } setValue(prop) { return typeof prop === 'object' ? (prop.value ? prop.value : '') : prop; } } exports.default = FormAbstract; //# sourceMappingURL=FormAbstract.js.map