UNPKG

@onereach/channel-transformer

Version:

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

23 lines (18 loc) 655 B
import { IGenericInput } from '../../../../generic/types'; import { IRWCMessage, IRWCAnswerComponent } from '../../../types'; import { getAnswerComponent } from '../../../helpers/answer-types'; export const transformInput = ({ props }: IGenericInput): IRWCMessage => { const answerComponent: IRWCAnswerComponent = getAnswerComponent('or-textbox'); const defaultValue = props?.value || answerComponent.defaultValue; const placeholder = props?.placeholder; answerComponent.vBind = { ...props.rwc, defaultValue, placeholder }; const result: IRWCMessage = { message: props.label, answerComponent }; return result; };