@botonic/plugin-flow-builder
Version:
Use Flow Builder to show your contents
38 lines • 1.51 kB
JavaScript
import { __awaiter } from "tslib";
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;
}
// 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(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