@onereach/channel-transformer
Version:
Convert data model between different channels (Slack, Microsoft Teams, Generic...)
20 lines (16 loc) • 541 B
text/typescript
import { IGenericLocation } from "../../../../generic/types";
import { IRWCAnswerComponent } from "../../../types";
export const transformGeoLocation = (msg: IRWCAnswerComponent): IGenericLocation => {
const result: IGenericLocation = {
type: 'location',
props: {
label: msg.vBind?.buttonLabel,
}
};
if (msg.vBind?.useDefault) {
const defaultLat = msg.vBind?.defaultLat || 0;
const defaultLng = msg.vBind?.defaultLng || 0;
result.props.value = [defaultLat, defaultLng];
}
return result;
};