@onereach/channel-transformer
Version:
Convert data model between different channels (Slack, Microsoft Teams, Generic...)
30 lines (26 loc) • 640 B
text/typescript
import { IGenericSelect } from '../../../../generic/types/select';
import { ISlackOverflow } from '../../../types';
import { convertOptions } from '../helpers/convert-options';
import { transformConfirm } from '../confirm';
export const transformOverflow = ({
type,
action_id,
options,
confirm
}: ISlackOverflow): IGenericSelect => {
const res: IGenericSelect = {
type: 'select',
props: {
value: '',
options: convertOptions(options),
variableName: action_id,
slack: {
type
}
}
};
if (confirm) {
res.props.slack.confirm = transformConfirm(confirm);
}
return res;
};