@botonic/plugin-flow-builder
Version:
Use Flow Builder to show your contents
32 lines • 1.35 kB
JavaScript
import { __awaiter } from "tslib";
import { ContentFieldsBase } from '../content-fields-base';
import { FlowWhatsappButtonListRow } from './flow-whatsapp-button-list-row';
export class FlowWhatsappButtonListSection extends ContentFieldsBase {
constructor() {
super(...arguments);
this.title = '';
this.rows = [];
}
static fromHubtypeCMS(component, locale, cmsApi) {
const newButton = new FlowWhatsappButtonListSection(component.id);
newButton.title = this.getTextByLocale(locale, component.title);
newButton.rows = component.rows.map(row => FlowWhatsappButtonListRow.fromHubtypeCMS(row, locale, cmsApi));
return newButton;
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
trackFlow(_request) {
return __awaiter(this, void 0, void 0, function* () {
// Not apply for this content, because it is a child of the FlowWhatsappButtonList content
});
}
toBotonic(sectionIndex) {
const rows = this.rows.reduce((acc, row, rowIndex) => {
const botonicRow = row.toBotonic(rowIndex, sectionIndex);
if (botonicRow)
acc.push(botonicRow);
return acc;
}, []);
return { title: this.title, rows };
}
}
//# sourceMappingURL=flow-whatsapp-button-list-section.js.map