@onereach/channel-transformer
Version:
Convert data model between different channels (Slack, Microsoft Teams, Generic...)
15 lines (12 loc) • 517 B
text/typescript
import { IGenericLocation } from "../../../../generic/types";
import { IRWCAnswerComponent } from "../../../types";
import { RWCAnswerComponent } from "../../../classes/v5";
export const transformLocation = ({ props }: IGenericLocation): IRWCAnswerComponent => {
const result: any = {
buttonLabel: props.label,
useDefault: props.rwc?.useDefault
};
const type = 'rwc-location';
[result.defaultLat, result.defaultLng] = props.value;
return new RWCAnswerComponent(result, type);
};