UNPKG

@onereach/channel-transformer

Version:

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

38 lines (33 loc) 1.08 kB
import { IGenericScheduler, IGenericOptions} from "../../../../generic/types"; import { IRWCAnswerComponent } from "../../../types"; export const transformScheduler = (msg: IRWCAnswerComponent): IGenericScheduler => { const { workingHours: value = {}, allowMultiselect: multiple = false, options: ops = [], disableByMf = false, disableByFunction = false, disableByManually = false, disableFunction = null, disableManual = [], multiselectQuantity = "`2`" } = msg.vBind; const options: Array<IGenericOptions> = ops.map(({value, label}) => ({ value, label, key: value})); const props: any = { value, options, multiple, rwc: { disableByFunction, disableByMf, disableByManually, multiselectQuantity } }; if (disableByFunction) props.rwc.disableFunction = disableFunction; if (disableByManually) props.rwc.disableManual = disableManual; return { type: 'scheduler', props, }; };