UNPKG

@onereach/channel-transformer

Version:

Convert data model between different channels (Slack, Microsoft Teams, Generic...)

24 lines (20 loc) 567 B
import { IGenericSection, IGenericButton } from "../../../../generic/types"; import { IRWCAnswerComponent } from "../../../types"; export const transformButtonList = (msg: IRWCAnswerComponent): IGenericSection => { const btns = msg.vBind?.options || []; const children: Array<IGenericButton> = btns.map(btn => ({ type: 'button', props: { label: btn.label, value: btn.value, rwc: { buttonStyle: btn.buttonStyle } } })); const result: IGenericSection = { type: 'section', children }; return result; };