UNPKG

@botonic/plugin-flow-builder

Version:

Use Flow Builder to show your contents

32 lines 1.56 kB
import { jsx as _jsx } from "react/jsx-runtime"; import { WhatsappCTAUrlButton } from '@botonic/react'; import { ContentFieldsBase } from './content-fields-base'; import { FlowButton } from './flow-button'; export class FlowWhatsappCtaUrlButtonNode extends ContentFieldsBase { constructor() { super(...arguments); this.code = ''; this.text = ''; this.displayText = ''; this.url = ''; } static fromHubtypeCMS(component, locale, cmsApi) { const whatsappCtaUrlButton = new FlowWhatsappCtaUrlButtonNode(component.id); whatsappCtaUrlButton.code = component.code; whatsappCtaUrlButton.text = this.getTextByLocale(locale, component.content.text); whatsappCtaUrlButton.header = this.getTextByLocale(locale, component.content.header); whatsappCtaUrlButton.footer = this.getTextByLocale(locale, component.content.footer); const button = FlowButton.fromHubtypeCMS(component.content.button, locale, cmsApi); whatsappCtaUrlButton.displayText = button.text; const urlId = FlowButton.getUrlId(component.content.button, locale); if (urlId) { const urlNode = cmsApi.getNodeById(urlId); whatsappCtaUrlButton.url = urlNode.content.url; } return whatsappCtaUrlButton; } toBotonic(id) { return (_jsx(WhatsappCTAUrlButton, { body: this.text, header: this.header, footer: this.footer, displayText: this.displayText, url: this.url }, id)); } } //# sourceMappingURL=flow-whatsapp-cta-url-button.js.map