@onereach/channel-transformer
Version:
Convert data model between different channels (Slack, Microsoft Teams, Generic...)
21 lines (17 loc) • 508 B
text/typescript
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
}
}));
const result: IGenericSection = {
type: 'section',
children
};
return result;
};