UNPKG

@onereach/channel-transformer

Version:

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

20 lines (16 loc) 541 B
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; };