UNPKG

@onereach/channel-transformer

Version:

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

23 lines (20 loc) 516 B
import { IGenericSection } from '../../../generic/types'; import { ISlackActions } from '../../types'; import { getMethods } from '../methods'; export const transformActions = ( { elements, block_id }: ISlackActions ): IGenericSection => { const res: IGenericSection = { type: 'section', children: elements.map(item => getMethods(item.type)(item)), props: { slack: { type: 'actions' } } }; if (block_id) { res.props.slack.block_id = block_id; } return res; };