@botonic/plugin-flow-builder
Version:
Use Flow Builder to show your contents
35 lines • 1.41 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.FlowWhatsappButtonListRow = void 0;
const constants_1 = require("../../constants");
const content_fields_base_1 = require("../content-fields-base");
class FlowWhatsappButtonListRow extends content_fields_base_1.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}${constants_1.SOURCE_INFO_SEPARATOR}${sectionIndex}.${rowIndex}`;
}
}
exports.FlowWhatsappButtonListRow = FlowWhatsappButtonListRow;
//# sourceMappingURL=flow-whatsapp-button-list-row.js.map