@botonic/plugin-flow-builder
Version:
Botonic plugin for **Hubtype Flow Builder**: run and bridge flow-driven logic from bots on the **current** line.
44 lines • 1.58 kB
JavaScript
import { __awaiter } from "tslib";
import { ContentFieldsBase } from './content-fields-base';
import { FlowButton } from './flow-button';
export class FlowElement extends ContentFieldsBase {
constructor() {
super(...arguments);
this.title = '';
this.subtitle = '';
this.image = '';
this.hidden = false;
}
static fromHubtypeCMS(component, locale, cmsApi) {
const newElement = new FlowElement(component.id);
newElement.title = this.getTextByLocale(locale, component.title);
newElement.subtitle = this.getTextByLocale(locale, component.subtitle);
newElement.image = this.getAssetByLocale(locale, component.image);
newElement.button = FlowButton.fromHubtypeCMS(component.button, locale, cmsApi);
return newElement;
}
trackFlow(botonicContext) {
return __awaiter(this, void 0, void 0, function* () {
if (this.button) {
yield this.button.trackFlow(botonicContext);
}
});
}
processContent(botonicContext) {
return __awaiter(this, void 0, void 0, function* () {
yield this.trackFlow(botonicContext);
return;
});
}
addElementToBotonic(botonicContext) {
return {
title: this.title,
subtitle: this.subtitle,
image: this.image,
buttons: this.button
? [this.button.addButtonToBotonic({ buttonIndex: 0, botonicContext })]
: [],
};
}
}
//# sourceMappingURL=flow-element.js.map