@ilo-home/react-native-tuya
Version:
React Native bindings for the Tuya SDK
3 lines (2 loc) • 6.11 kB
JavaScript
;Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("react-native"),r=t.NativeModules.TuyaActivatorModule,o=t.NativeModules.TuyaBLEActivatorModule,n=t.NativeModules.TuyaBLEScannerModule;(e=exports.ActivatorType||(exports.ActivatorType={})).AP="THING_AP",e.EZ="THING_EZ",e.AP_4G_GATEWAY="THING_4G_GATEWAY",e.QR="THING_QR";var i=new t.NativeEventEmitter(t.NativeModules.TuyaRNEventEmitter);function u(e,t){return i.addListener(e,t)}var s=function(e,t){return e+"//"+t},a=t.NativeModules.TuyaDeviceModule,c={};function d(){return(d=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)({}).hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e}).apply(null,arguments)}var m,p=t.NativeModules.TuyaHomeModule,l=t.NativeModules.TuyaHomeDataManagerModule,f=t.NativeModules.TuyaHomeManagerModule,v=t.NativeModules.TuyaHomeMemberModule,T=t.NativeModules.TuyaDeviceModule,x=t.NativeModules.TuyaTimerModule,h=t.NativeModules.TuyaUserModule;(m=exports.ValidateCodeType||(exports.ValidateCodeType={}))[m.REGISTER=1]="REGISTER",m[m.LOGIN=2]="LOGIN",m[m.RESET_PASSWORD=3]="RESET_PASSWORD",exports.DEVLISTENER="devListener",exports.GROUPLISTENER="groupListener",exports.HARDWAREUPGRADELISTENER="hardwareUpgradeListener",exports.HOMECHANGE="homeChange",exports.HOMESTATUS="homeStatus",exports.SINGLETRANSFER="SingleTransfer",exports.SUBDEVLISTENER="subDevListener",exports.addEvent=u,exports.addMember=function(e){return v.addMember(e)},exports.addTimerWithTask=function(e){return x.addTimerWithTask(e)},exports.bridge=s,exports.cancelAccount=function(){return h.cancelAccount()},exports.checkValidateCode=function(e){return h.checkValidateCode(e)},exports.createHome=function(e){return f.createHome(e)},exports.destroyActivator=function(){return r.destroyActivator()},exports.dismissHome=function(e){return p.dismissHome(e)},exports.getAllTimerWithDeviceId=function(e){try{return Promise.resolve(x.getAllTimerWithDeviceId(e)).then((function(e){return e.forEach((function(e){e.timerTaskStatus.open=!!e.timerTaskStatus.open,e.timerList=e.timerList.map((function(e){return d({},e,{status:!!e.status,dps:"android"===t.Platform.OS?JSON.parse(e.value):e.dps})}))})),e}))}catch(e){return Promise.reject(e)}},exports.getCurrentUser=function(){try{return Promise.resolve(h.getCurrentUser()).then((function(e){return e||null}))}catch(e){return Promise.reject(e)}},exports.getCurrentWifi=function(e,t){return r.getCurrentWifi({},e,t)},exports.getDataPointStat=function(e){return a.getDataPointStat(e)},exports.getHomeDetail=function(e){try{return Promise.resolve(p.getHomeDetail(e)).then((function(e){return"android"===t.Platform.OS&&(e.deviceList=e.deviceList.map((function(e){return d({},e,{homeId:parseInt(e.ownerId),category:e.deviceCategory})}))),e}))}catch(e){return Promise.reject(e)}},exports.getOtaInfo=function(e){return T.getOtaInfo(e)},exports.getRoomDeviceList=function(e){return l.getRoomDeviceList(e)},exports.getTimerTaskStatusWithDeviceId=function(e){return x.getTimerTaskStatusWithDeviceId(e)},exports.getTimerWithTask=function(e){try{return Promise.resolve(x.getTimerWithTask(e)).then((function(e){return e.forEach((function(e){e.timerTaskStatus.open=!!e.timerTaskStatus.open,e.timerList=e.timerList.map((function(e){return d({},e,{status:!!e.status,dps:"android"===t.Platform.OS?JSON.parse(e.value):e.dps})}))})),e}))}catch(e){return Promise.reject(e)}},exports.getValidateCode=function(e){return h.getValidateCode(e)},exports.initActivator=function(e){return r.initActivator(e)},exports.initBluetoothDualModeActivator=function(e){return"ios"===t.Platform.OS?o.initActivator(e):r.initBluetoothDualModeActivator(e)},exports.joinFamily=function(e){return f.joinFamily(e)},exports.loginOrRegisterWithUid=function(e){return h.loginOrRegisterWithUid(e)},exports.loginWithEmailPassword=function(e){return h.loginWithEmailPassword(e)},exports.logout=function(){return h.logout()},exports.openNetworkSettings=function(){return r.openNetworkSettings({})},exports.queryHomeList=function(){try{return Promise.resolve(f.queryHomeList()).then((function(e){return"android"===t.Platform.OS&&(e=e.map((function(e){return d({},e,{dealStatus:e.homeStatus})}))),e}))}catch(e){return Promise.reject(e)}},exports.queryMemberList=function(e){try{return Promise.resolve(v.queryMemberList(e)).then((function(e){return"android"===t.Platform.OS&&(e=e.map((function(e){return{admin:e.admin,username:e.account,id:e.memberId,dealStatus:e.memberStatus}}))),e}))}catch(e){return Promise.reject(e)}},exports.queryRoomList=function(e){return p.queryRoomList(e)},exports.registerAccountWithEmail=function(e){return h.registerAccountWithEmail(e)},exports.registerDevListener=function(e,t,r){a.registerDevListener(e);var o=u(s("devListener",e.devId),(function(e){e.type===t&&r(e)}));c[e.devId]=o},exports.removeDevice=function(e){return a.removeDevice(e)},exports.removeMember=function(e){return v.removeMember(e)},exports.removeTimerWithTask=function(e){return x.removeTimerWithTask(e)},exports.renameDevice=function(e){return a.renameDevice(e)},exports.resetEmailPassword=function(e){return h.resetEmailPassword(e)},exports.send=function(e){return a.send(e)},exports.sortRoom=function(e){return p.sortRoom(e)},exports.startBluetoothScan=function(){return"ios"===t.Platform.OS?n.startBluetoothScan():r.startBluetoothScan()},exports.startOta=function(e,t,r,o){return T.startOta(e),u(s("hardwareUpgradeListener",e.devId),(function(e){"onSuccess"===e.type?t(e):"onFailure"===e.type?r(e):"onProgress"===e.type&&o(e)}))},exports.stopActivator=function(){return r.stopActivator()},exports.unRegisterAllDevListeners=function(){for(var e in c)c[e].remove(),a.unRegisterDevListener({devId:e});c={}},exports.updateHome=function(e){return p.updateHome(e)},exports.updateTimerStatusWithTask=function(e){return x.updateTimerStatusWithTask(e)},exports.updateTimerTaskStatusWithTask=function(e){return x.updateTimerTaskStatusWithTask(e)},exports.updateTimerWithTask=function(e){return x.updateTimerWithTask(e)};
//# sourceMappingURL=react-native-tuya.cjs.production.min.js.map