@botonic/plugin-flow-builder
Version:
Use Flow Builder to show your contents
31 lines • 1.2 kB
JavaScript
import { SOURCE_INFO_SEPARATOR } from '../../constants';
import { ContentFieldsBase } from '../content-fields-base';
export class FlowWhatsappButtonListRow extends ContentFieldsBase {
constructor() {
super(...arguments);
this.title = '';
this.description = '';
}
static fromHubtypeCMS(component, locale, cmsApi) {
const newRow = new FlowWhatsappButtonListRow(component.id);
newRow.title = this.getTextByLocale(locale, component.text);
newRow.description = this.getTextByLocale(locale, component.description);
newRow.targetId = cmsApi.getPayload(component.target);
return newRow;
}
toBotonic(rowIndex, sectionIndex) {
if (!this.targetId) {
console.error(`Row with title: '${this.title}' has no target`);
return undefined;
}
return {
id: this.getRowId(rowIndex, sectionIndex),
title: this.title,
description: this.description,
};
}
getRowId(rowIndex, sectionIndex) {
return `${this.targetId}${SOURCE_INFO_SEPARATOR}${sectionIndex}.${rowIndex}`;
}
}
//# sourceMappingURL=flow-whatsapp-button-list-row.js.map