@botonic/plugin-flow-builder
Version:
Use Flow Builder to show your contents
29 lines • 1.59 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.FlowWhatsappButtonList = void 0;
const jsx_runtime_1 = require("react/jsx-runtime");
const react_1 = require("@botonic/react");
const content_fields_base_1 = require("../content-fields-base");
const flow_whatsapp_button_list_section_1 = require("./flow-whatsapp-button-list-section");
class FlowWhatsappButtonList extends content_fields_base_1.ContentFieldsBase {
constructor() {
super(...arguments);
this.code = '';
this.text = '';
this.listButtonText = '';
this.sections = [];
}
static fromHubtypeCMS(component, locale, cmsApi) {
const newWhatsappButtonList = new FlowWhatsappButtonList(component.id);
newWhatsappButtonList.code = component.code;
newWhatsappButtonList.text = this.getTextByLocale(locale, component.content.text);
newWhatsappButtonList.listButtonText = this.getTextByLocale(locale, component.content.button_text);
newWhatsappButtonList.sections = component.content.sections.map(section => flow_whatsapp_button_list_section_1.FlowWhatsappButtonListSection.fromHubtypeCMS(section, locale, cmsApi));
return newWhatsappButtonList;
}
toBotonic(id) {
return ((0, jsx_runtime_1.jsx)(react_1.WhatsappButtonList, { body: this.text, button: this.listButtonText, sections: this.sections.map((section, sectionIndex) => section.toBotonic(sectionIndex)) }, id));
}
}
exports.FlowWhatsappButtonList = FlowWhatsappButtonList;
//# sourceMappingURL=flow-whatsapp-button-list.js.map