@onereach/channel-transformer
Version:
Convert data model between different channels (Slack, Microsoft Teams, Generic...)
21 lines (16 loc) • 624 B
text/typescript
import { IGenericLocation } from '../../../../generic/types';
import { IRWCMessage, IRWCAnswerComponent } from '../../../types';
import { getAnswerComponent } from '../../../helpers/answer-types';
export const transformLocation = ({ props }: IGenericLocation): IRWCMessage => {
const answerComponent: IRWCAnswerComponent = getAnswerComponent('rwc-location');
const defaultValue = props?.value || answerComponent.defaultValue;
const buttonLabel = props?.label || "``";
answerComponent.vBind = {
defaultValue,
buttonLabel
};
const result: IRWCMessage = {
answerComponent
};
return result;
};