import { encode } from '../security' export async function iotGenScheduleUrl (options, identifier: string, version: string): Promise { let urlKey = '' const isDebug = localStorage['__isDebug'] === 'true' const isTest = window['__isTest'] if (!identifier || !version) { console.error('请添加业务唯一标识符 https://lark.alipay.com/tmall-iot/framework/schedule') urlKey = 'iot-order' } else { if (isDebug || isTest) { urlKey = 'iot-schedule-test' } else { urlKey = 'iot-schedule' } } const base = `https://ju.taobao.com/m/jusp/alone/${urlKey}/mtp.htm` const url = `${base}?` + `_ali_new_window_open_=true&` + `_ali_status_bar_=false&` + `_ali_nav_bar_=false&` + `_ali_bounce_=false&` + `version=${version}&` + // `_ali_full_screen_=true` + `${isDebug ? '&debug=true' : ''}` + `#/?upstream=` + encode(JSON.stringify({ timerType: 'genie', // device | x1 | bt' // productKey: '', // devId: '', // title: '', // maxListLen: 5, // skillId: 515, deviceTimerOption: { // key: 'AppointmentTime' // 预约时间的key }, timerOffset: { // deltaT: 0, // min: 120, // max: 720 }, assets: { js: [] }, modules: [], ...options })) return url }