@ray-js/api 1.4.28 → 1.4.30
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/cloud/alarm.js +2 -2
- package/lib/cloud/core.js +1 -1
- package/lib/cloud/device.js +5 -5
- package/lib/cloud/linkage.js +8 -8
- package/lib/cloud/statistic.js +9 -9
- package/lib/cloud/timer.js +14 -14
- package/lib/getElementById/index.thing.js +1 -1
- package/lib/getElementById/index.wechat.js +1 -1
- package/lib/nativeRouters/index.d.ts +1 -0
- package/lib/nativeRouters/index.js +2 -1
- package/lib/nativeRouters/outdoors.d.ts +106 -0
- package/lib/nativeRouters/outdoors.js +172 -0
- package/lib/panel/i18n/index.js +13 -12
- package/lib/panel/i18n/index.wechat.js +13 -12
- package/lib/panel/publishDps.js +1 -1
- package/lib/redirectTo/index.js +1 -0
- package/lib/utils.js +5 -5
- package/lib/utils.wechat.js +5 -5
- package/package.json +5 -5
package/lib/cloud/alarm.js
CHANGED
@@ -8,7 +8,7 @@ import { THING } from '../constants';
|
|
8
8
|
*/
|
9
9
|
const getDevAlarmList = devId => {
|
10
10
|
return requestCloud({
|
11
|
-
api:
|
11
|
+
api: "".concat(THING, ".m.linkage.rule.product.query"),
|
12
12
|
version: '1.0',
|
13
13
|
data: {
|
14
14
|
devId
|
@@ -24,7 +24,7 @@ const getDevAlarmList = devId => {
|
|
24
24
|
*/
|
25
25
|
const setAlarmSwitch = params => {
|
26
26
|
return requestCloud({
|
27
|
-
api:
|
27
|
+
api: "".concat(THING, ".m.linkage.dev.warn.set"),
|
28
28
|
version: '1.0',
|
29
29
|
data: _objectSpread({}, params)
|
30
30
|
});
|
package/lib/cloud/core.js
CHANGED
package/lib/cloud/device.js
CHANGED
@@ -52,7 +52,7 @@ const getGroupDpsInfos = groupId => {
|
|
52
52
|
*/
|
53
53
|
const updateGroupDpName = params => {
|
54
54
|
return requestCloud({
|
55
|
-
api:
|
55
|
+
api: "".concat(THING, ".m.group.dpname.update"),
|
56
56
|
version: '1.0',
|
57
57
|
data: _objectSpread({}, params)
|
58
58
|
});
|
@@ -65,7 +65,7 @@ const updateGroupDpName = params => {
|
|
65
65
|
*/
|
66
66
|
const getWeatherQuality = params => {
|
67
67
|
return requestCloud({
|
68
|
-
api:
|
68
|
+
api: "".concat(THING, ".m.public.weather.get"),
|
69
69
|
version: '2.0',
|
70
70
|
data: _objectSpread({}, params)
|
71
71
|
});
|
@@ -78,7 +78,7 @@ const getWeatherQuality = params => {
|
|
78
78
|
*/
|
79
79
|
const getWeathers = params => {
|
80
80
|
return requestCloud({
|
81
|
-
api:
|
81
|
+
api: "".concat(THING, ".m.public.weathers.get"),
|
82
82
|
version: '2.0',
|
83
83
|
data: _objectSpread({}, params)
|
84
84
|
});
|
@@ -93,7 +93,7 @@ const getWeathers = params => {
|
|
93
93
|
*/
|
94
94
|
const saveCustomizePosition = params => {
|
95
95
|
return requestCloud({
|
96
|
-
api:
|
96
|
+
api: "".concat(THING, ".m.device.customize.position.save"),
|
97
97
|
version: '1.0',
|
98
98
|
data: _objectSpread({}, params)
|
99
99
|
});
|
@@ -105,7 +105,7 @@ const saveCustomizePosition = params => {
|
|
105
105
|
*/
|
106
106
|
const getCustomizePosition = params => {
|
107
107
|
return requestCloud({
|
108
|
-
api:
|
108
|
+
api: "".concat(THING, ".m.device.customize.position.get"),
|
109
109
|
version: '1.0',
|
110
110
|
data: _objectSpread({}, params)
|
111
111
|
});
|
package/lib/cloud/linkage.js
CHANGED
@@ -8,7 +8,7 @@ import { THING } from '../constants';
|
|
8
8
|
*/
|
9
9
|
const getLinkageDeviceList = params => {
|
10
10
|
return requestCloud({
|
11
|
-
api:
|
11
|
+
api: "".concat(THING, ".m.linkage.dev.list"),
|
12
12
|
version: '3.0',
|
13
13
|
data: _objectSpread({}, params)
|
14
14
|
});
|
@@ -23,7 +23,7 @@ const getSceneList = _ref => {
|
|
23
23
|
devId
|
24
24
|
} = _ref;
|
25
25
|
return requestCloud({
|
26
|
-
api:
|
26
|
+
api: "".concat(THING, ".m.linkage.rule.brief.query"),
|
27
27
|
version: '1.0',
|
28
28
|
data: {
|
29
29
|
devId
|
@@ -40,7 +40,7 @@ const getSceneList = _ref => {
|
|
40
40
|
|
41
41
|
const getBindRuleList = params => {
|
42
42
|
return requestCloud({
|
43
|
-
api:
|
43
|
+
api: "".concat(THING, ".m.linkage.associative.entity.id.category.query"),
|
44
44
|
version: '1.0',
|
45
45
|
data: _objectSpread({}, params)
|
46
46
|
});
|
@@ -65,7 +65,7 @@ const bindRule = _ref2 => {
|
|
65
65
|
bizDomain
|
66
66
|
} = _ref2;
|
67
67
|
return requestCloud({
|
68
|
-
api:
|
68
|
+
api: "".concat(THING, ".m.linkage.associative.entity.bind"),
|
69
69
|
version: '1.0',
|
70
70
|
data: {
|
71
71
|
relationExpr: {
|
@@ -102,7 +102,7 @@ const bindRule = _ref2 => {
|
|
102
102
|
*/
|
103
103
|
const removeRule = params => {
|
104
104
|
return requestCloud({
|
105
|
-
api:
|
105
|
+
api: "".concat(THING, ".m.linkage.associative.entity.remove"),
|
106
106
|
version: '1.0',
|
107
107
|
data: _objectSpread({}, params)
|
108
108
|
});
|
@@ -117,7 +117,7 @@ const triggerRule = _ref3 => {
|
|
117
117
|
ruleId
|
118
118
|
} = _ref3;
|
119
119
|
return requestCloud({
|
120
|
-
api:
|
120
|
+
api: "".concat(THING, ".m.linkage.rule.trigger"),
|
121
121
|
version: '1.0',
|
122
122
|
data: {
|
123
123
|
ruleId
|
@@ -134,7 +134,7 @@ const enableRule = _ref4 => {
|
|
134
134
|
ruleId
|
135
135
|
} = _ref4;
|
136
136
|
return requestCloud({
|
137
|
-
api:
|
137
|
+
api: "".concat(THING, ".m.linkage.rule.enable"),
|
138
138
|
version: '1.0',
|
139
139
|
data: {
|
140
140
|
ruleId
|
@@ -151,7 +151,7 @@ const disableRule = _ref5 => {
|
|
151
151
|
ruleId
|
152
152
|
} = _ref5;
|
153
153
|
return requestCloud({
|
154
|
-
api:
|
154
|
+
api: "".concat(THING, ".m.linkage.rule.disable"),
|
155
155
|
version: '1.0',
|
156
156
|
data: {
|
157
157
|
ruleId
|
package/lib/cloud/statistic.js
CHANGED
@@ -14,7 +14,7 @@ import { THING } from '../constants';
|
|
14
14
|
*/
|
15
15
|
const getLogInSpecifiedTime = params => {
|
16
16
|
return requestCloud({
|
17
|
-
api:
|
17
|
+
api: "".concat(THING, ".m.smart.operate.all.log"),
|
18
18
|
version: '1.0',
|
19
19
|
data: _objectSpread({}, params)
|
20
20
|
});
|
@@ -62,7 +62,7 @@ const getLogUserAction = params => {
|
|
62
62
|
*/
|
63
63
|
const getDpLogDays = params => {
|
64
64
|
return requestCloud({
|
65
|
-
api:
|
65
|
+
api: "".concat(THING, ".m.dp.stat.days.list"),
|
66
66
|
version: '1.0',
|
67
67
|
data: _objectSpread({}, params)
|
68
68
|
});
|
@@ -76,7 +76,7 @@ const getDpLogDays = params => {
|
|
76
76
|
*/
|
77
77
|
const getDpResultByMonth = params => {
|
78
78
|
return requestCloud({
|
79
|
-
api:
|
79
|
+
api: "".concat(THING, ".m.dp.stat.month.list"),
|
80
80
|
version: '1.0',
|
81
81
|
data: _objectSpread({}, params)
|
82
82
|
});
|
@@ -93,7 +93,7 @@ const getDpResultByMonth = params => {
|
|
93
93
|
*/
|
94
94
|
const getDpResultByHour = params => {
|
95
95
|
return requestCloud({
|
96
|
-
api:
|
96
|
+
api: "".concat(THING, ".m.dp.rang.stat.hour.list"),
|
97
97
|
version: '1.0',
|
98
98
|
data: _objectSpread({}, params)
|
99
99
|
});
|
@@ -111,7 +111,7 @@ const getDpResultByHour = params => {
|
|
111
111
|
*/
|
112
112
|
const getDataWithSpecified = params => {
|
113
113
|
return requestCloud({
|
114
|
-
api:
|
114
|
+
api: "".concat(THING, ".m.dp.rang.stat.day.list"),
|
115
115
|
version: '2.0',
|
116
116
|
data: _objectSpread({}, params)
|
117
117
|
});
|
@@ -127,7 +127,7 @@ const getDataWithSpecified = params => {
|
|
127
127
|
*/
|
128
128
|
const getWeekWithSpecified = params => {
|
129
129
|
return requestCloud({
|
130
|
-
api:
|
130
|
+
api: "".concat(THING, ".m.dp.rang.stat.week.list"),
|
131
131
|
version: '1.0',
|
132
132
|
data: _objectSpread({}, params)
|
133
133
|
});
|
@@ -145,7 +145,7 @@ const getWeekWithSpecified = params => {
|
|
145
145
|
*/
|
146
146
|
const getMonthWithSpecified = params => {
|
147
147
|
return requestCloud({
|
148
|
-
api:
|
148
|
+
api: "".concat(THING, ".m.dp.rang.stat.month.list"),
|
149
149
|
version: '2.0',
|
150
150
|
data: _objectSpread({}, params)
|
151
151
|
});
|
@@ -159,7 +159,7 @@ const getMonthWithSpecified = params => {
|
|
159
159
|
*/
|
160
160
|
const getDpAllStatistResult = params => {
|
161
161
|
return requestCloud({
|
162
|
-
api:
|
162
|
+
api: "".concat(THING, ".m.dp.stat.total"),
|
163
163
|
version: '1.0',
|
164
164
|
data: _objectSpread({}, params)
|
165
165
|
});
|
@@ -179,7 +179,7 @@ const getDpAllStatistResult = params => {
|
|
179
179
|
*/
|
180
180
|
const getMultiDpsAllResult = params => {
|
181
181
|
return requestCloud({
|
182
|
-
api:
|
182
|
+
api: "".concat(THING, ".m.device.query.device.log"),
|
183
183
|
version: '1.0',
|
184
184
|
data: _objectSpread({}, params)
|
185
185
|
});
|
package/lib/cloud/timer.js
CHANGED
@@ -15,7 +15,7 @@ import { THING } from '../constants';
|
|
15
15
|
*/
|
16
16
|
const addSingleTimer = params => {
|
17
17
|
return requestCloud({
|
18
|
-
api:
|
18
|
+
api: "".concat(THING, ".m.clock.dps.add"),
|
19
19
|
version: '1.0',
|
20
20
|
data: _objectSpread({}, params)
|
21
21
|
});
|
@@ -29,7 +29,7 @@ const addSingleTimer = params => {
|
|
29
29
|
*/
|
30
30
|
const queryTimerTasks = params => {
|
31
31
|
return requestCloud({
|
32
|
-
api:
|
32
|
+
api: "".concat(THING, ".m.clock.dps.list"),
|
33
33
|
version: '1.0',
|
34
34
|
data: _objectSpread({}, params)
|
35
35
|
});
|
@@ -48,7 +48,7 @@ const queryTimerTasks = params => {
|
|
48
48
|
*/
|
49
49
|
const modifySingleTimer = params => {
|
50
50
|
return requestCloud({
|
51
|
-
api:
|
51
|
+
api: "".concat(THING, ".m.clock.dps.update"),
|
52
52
|
version: '1.0',
|
53
53
|
data: _objectSpread({}, params)
|
54
54
|
});
|
@@ -67,7 +67,7 @@ const modifySingleTimer = params => {
|
|
67
67
|
*/
|
68
68
|
const addGroupTimer = params => {
|
69
69
|
return requestCloud({
|
70
|
-
api:
|
70
|
+
api: "".concat(THING, ".m.clock.dps.group.add"),
|
71
71
|
version: '1.0',
|
72
72
|
data: _objectSpread({}, params)
|
73
73
|
});
|
@@ -81,7 +81,7 @@ const addGroupTimer = params => {
|
|
81
81
|
*/
|
82
82
|
const queryGroupTimerTasks = params => {
|
83
83
|
return requestCloud({
|
84
|
-
api:
|
84
|
+
api: "".concat(THING, ".m.clock.dps.group.list"),
|
85
85
|
version: '1.0',
|
86
86
|
data: _objectSpread({}, params)
|
87
87
|
});
|
@@ -99,7 +99,7 @@ const queryGroupTimerTasks = params => {
|
|
99
99
|
*/
|
100
100
|
const modifyGroupTimer = params => {
|
101
101
|
return requestCloud({
|
102
|
-
api:
|
102
|
+
api: "".concat(THING, ".m.clock.dps.group.update"),
|
103
103
|
version: '1.0',
|
104
104
|
data: _objectSpread({}, params)
|
105
105
|
});
|
@@ -114,7 +114,7 @@ const modifyGroupTimer = params => {
|
|
114
114
|
*/
|
115
115
|
const modDeleteTaskByIds = params => {
|
116
116
|
return requestCloud({
|
117
|
-
api:
|
117
|
+
api: "".concat(THING, ".m.clock.batch.status.update"),
|
118
118
|
version: '1.0',
|
119
119
|
data: _objectSpread({}, params)
|
120
120
|
});
|
@@ -129,7 +129,7 @@ const modDeleteTaskByIds = params => {
|
|
129
129
|
*/
|
130
130
|
const modDeleteTaskByCategory = params => {
|
131
131
|
return requestCloud({
|
132
|
-
api:
|
132
|
+
api: "".concat(THING, ".m.clock.category.status.update"),
|
133
133
|
version: '1.0',
|
134
134
|
data: _objectSpread({}, params)
|
135
135
|
});
|
@@ -170,7 +170,7 @@ const getDpsLastTimer = params => {
|
|
170
170
|
*/
|
171
171
|
const getLastTimerPeriod = params => {
|
172
172
|
return requestCloud({
|
173
|
-
api:
|
173
|
+
api: "".concat(THING, ".m.timer.nearest.get"),
|
174
174
|
version: '1.0',
|
175
175
|
data: _objectSpread({}, params)
|
176
176
|
});
|
@@ -181,7 +181,7 @@ const getLastTimerPeriod = params => {
|
|
181
181
|
*/
|
182
182
|
const getAstronomicalList = params => {
|
183
183
|
return requestCloud({
|
184
|
-
api:
|
184
|
+
api: "".concat(THING, ".m.timer.astronomical.list"),
|
185
185
|
version: '1.0',
|
186
186
|
data: _objectSpread({}, params)
|
187
187
|
});
|
@@ -203,7 +203,7 @@ const getAstronomicalList = params => {
|
|
203
203
|
*/
|
204
204
|
const addAstronomical = params => {
|
205
205
|
return requestCloud({
|
206
|
-
api:
|
206
|
+
api: "".concat(THING, ".m.timer.astronomical.add"),
|
207
207
|
version: '1.0',
|
208
208
|
data: _objectSpread({}, params)
|
209
209
|
});
|
@@ -225,7 +225,7 @@ const addAstronomical = params => {
|
|
225
225
|
*/
|
226
226
|
const updateAstronomical = params => {
|
227
227
|
return requestCloud({
|
228
|
-
api:
|
228
|
+
api: "".concat(THING, ".m.timer.astronomical.update"),
|
229
229
|
version: '1.0',
|
230
230
|
data: _objectSpread({}, params)
|
231
231
|
});
|
@@ -238,7 +238,7 @@ const updateAstronomical = params => {
|
|
238
238
|
*/
|
239
239
|
const updateAstronomicalStatus = params => {
|
240
240
|
return requestCloud({
|
241
|
-
api:
|
241
|
+
api: "".concat(THING, ".m.timer.astronomical.status.update"),
|
242
242
|
version: '1.0',
|
243
243
|
data: _objectSpread({}, params)
|
244
244
|
});
|
@@ -250,7 +250,7 @@ const updateAstronomicalStatus = params => {
|
|
250
250
|
*/
|
251
251
|
const removeAstronomical = params => {
|
252
252
|
return requestCloud({
|
253
|
-
api:
|
253
|
+
api: "".concat(THING, ".m.timer.astronomical.remove"),
|
254
254
|
version: '1.0',
|
255
255
|
data: _objectSpread({}, params)
|
256
256
|
});
|
@@ -1 +1,2 @@
|
|
1
|
-
export * from './scene';
|
1
|
+
export * from './scene';
|
2
|
+
export * from './outdoors';
|
@@ -0,0 +1,106 @@
|
|
1
|
+
type OpenOutdoorCyclingNavigationParams = {
|
2
|
+
devId?: string;
|
3
|
+
success?: () => void;
|
4
|
+
fail?: (err?: {
|
5
|
+
errorMsg: string;
|
6
|
+
errorCode: string | number;
|
7
|
+
innerError: {
|
8
|
+
errorCode: string | number;
|
9
|
+
errorMsg: string;
|
10
|
+
};
|
11
|
+
}) => void;
|
12
|
+
complete?: () => void;
|
13
|
+
} & {
|
14
|
+
[key: string]: string | boolean | number;
|
15
|
+
};
|
16
|
+
/**
|
17
|
+
* 打开骑行导航页面
|
18
|
+
* @param params {devId: string}
|
19
|
+
* @returns
|
20
|
+
*/
|
21
|
+
export declare function openOutdoorCyclingNavigation(params: OpenOutdoorCyclingNavigationParams): Promise<void>;
|
22
|
+
type OpenAdditionalUnlockMethodsParams = {
|
23
|
+
devId?: string;
|
24
|
+
success?: () => void;
|
25
|
+
fail?: (err?: {
|
26
|
+
errorMsg: string;
|
27
|
+
errorCode: string | number;
|
28
|
+
innerError: {
|
29
|
+
errorCode: string | number;
|
30
|
+
errorMsg: string;
|
31
|
+
};
|
32
|
+
}) => void;
|
33
|
+
complete?: () => void;
|
34
|
+
} & {
|
35
|
+
[key: string]: string | boolean | number;
|
36
|
+
};
|
37
|
+
/**
|
38
|
+
* 打开氛围灯页面
|
39
|
+
* @param params {devId: string}
|
40
|
+
* @returns
|
41
|
+
*/
|
42
|
+
export declare function openAdditionalUnlockMethods(params: OpenAdditionalUnlockMethodsParams): Promise<void>;
|
43
|
+
type OpenOutdoorAmbientLightingParams = {
|
44
|
+
devId?: string;
|
45
|
+
success?: () => void;
|
46
|
+
fail?: (err?: {
|
47
|
+
errorMsg: string;
|
48
|
+
errorCode: string | number;
|
49
|
+
innerError: {
|
50
|
+
errorCode: string | number;
|
51
|
+
errorMsg: string;
|
52
|
+
};
|
53
|
+
}) => void;
|
54
|
+
complete?: () => void;
|
55
|
+
} & {
|
56
|
+
[key: string]: string | boolean | number;
|
57
|
+
};
|
58
|
+
/**
|
59
|
+
* 打开氛围灯页面
|
60
|
+
* @param params {devId: string}
|
61
|
+
* @returns
|
62
|
+
*/
|
63
|
+
export declare function openOutdoorAmbientLighting(params: OpenOutdoorAmbientLightingParams): Promise<void>;
|
64
|
+
type OpenOutdoorShortcutSiriParams = {
|
65
|
+
devId?: string;
|
66
|
+
success?: () => void;
|
67
|
+
fail?: (err?: {
|
68
|
+
errorMsg: string;
|
69
|
+
errorCode: string | number;
|
70
|
+
innerError: {
|
71
|
+
errorCode: string | number;
|
72
|
+
errorMsg: string;
|
73
|
+
};
|
74
|
+
}) => void;
|
75
|
+
complete?: () => void;
|
76
|
+
} & {
|
77
|
+
[key: string]: string | boolean | number;
|
78
|
+
};
|
79
|
+
/**
|
80
|
+
* 打开Siri页面,仅iOS
|
81
|
+
* @param params {devId: string}
|
82
|
+
* @returns
|
83
|
+
*/
|
84
|
+
export declare function openOutdoorShortcutSiri(params: OpenOutdoorShortcutSiriParams): Promise<void>;
|
85
|
+
type OpenOutdoorConfigDeviceHomeParams = {
|
86
|
+
productId?: string;
|
87
|
+
success?: () => void;
|
88
|
+
fail?: (err?: {
|
89
|
+
errorMsg: string;
|
90
|
+
errorCode: string | number;
|
91
|
+
innerError: {
|
92
|
+
errorCode: string | number;
|
93
|
+
errorMsg: string;
|
94
|
+
};
|
95
|
+
}) => void;
|
96
|
+
complete?: () => void;
|
97
|
+
} & {
|
98
|
+
[key: string]: string | boolean | number;
|
99
|
+
};
|
100
|
+
/**
|
101
|
+
* 打开配网
|
102
|
+
* @param params {devId: string}
|
103
|
+
* @returns
|
104
|
+
*/
|
105
|
+
export declare function openOutdoorConfigDeviceHome(params: OpenOutdoorConfigDeviceHomeParams): Promise<void>;
|
106
|
+
export {};
|
@@ -0,0 +1,172 @@
|
|
1
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
2
|
+
const _excluded = ["success", "fail", "complete"],
|
3
|
+
_excluded2 = ["success", "fail", "complete"],
|
4
|
+
_excluded3 = ["success", "fail", "complete"],
|
5
|
+
_excluded4 = ["success", "fail", "complete"],
|
6
|
+
_excluded5 = ["success", "fail", "complete"];
|
7
|
+
import { objectToUrlParams } from '../utils';
|
8
|
+
/**
|
9
|
+
* 打开骑行导航页面
|
10
|
+
* @param params {devId: string}
|
11
|
+
* @returns
|
12
|
+
*/
|
13
|
+
export function openOutdoorCyclingNavigation(params) {
|
14
|
+
const {
|
15
|
+
success,
|
16
|
+
fail,
|
17
|
+
complete
|
18
|
+
} = params,
|
19
|
+
rest = _objectWithoutProperties(params, _excluded);
|
20
|
+
let paramsStr = '';
|
21
|
+
if (Object.keys(rest).length > 0) {
|
22
|
+
paramsStr = '?' + objectToUrlParams(rest);
|
23
|
+
}
|
24
|
+
return new Promise((resolve, reject) => {
|
25
|
+
ty.router({
|
26
|
+
url: 'tuyaSmart://tsod_cycling_navigation' + paramsStr,
|
27
|
+
success() {
|
28
|
+
success === null || success === void 0 ? void 0 : success();
|
29
|
+
resolve();
|
30
|
+
},
|
31
|
+
fail(err) {
|
32
|
+
fail === null || fail === void 0 ? void 0 : fail(err);
|
33
|
+
reject(err);
|
34
|
+
},
|
35
|
+
complete() {
|
36
|
+
complete === null || complete === void 0 ? void 0 : complete();
|
37
|
+
}
|
38
|
+
});
|
39
|
+
});
|
40
|
+
}
|
41
|
+
/**
|
42
|
+
* 打开氛围灯页面
|
43
|
+
* @param params {devId: string}
|
44
|
+
* @returns
|
45
|
+
*/
|
46
|
+
export function openAdditionalUnlockMethods(params) {
|
47
|
+
const {
|
48
|
+
success,
|
49
|
+
fail,
|
50
|
+
complete
|
51
|
+
} = params,
|
52
|
+
rest = _objectWithoutProperties(params, _excluded2);
|
53
|
+
let paramsStr = '';
|
54
|
+
if (Object.keys(rest).length > 0) {
|
55
|
+
paramsStr = '?' + objectToUrlParams(rest);
|
56
|
+
}
|
57
|
+
return new Promise((resolve, reject) => {
|
58
|
+
ty.router({
|
59
|
+
url: 'tuyaSmart://tsod_additional_unlock_methods' + paramsStr,
|
60
|
+
success() {
|
61
|
+
success === null || success === void 0 ? void 0 : success();
|
62
|
+
resolve();
|
63
|
+
},
|
64
|
+
fail(err) {
|
65
|
+
fail === null || fail === void 0 ? void 0 : fail(err);
|
66
|
+
reject(err);
|
67
|
+
},
|
68
|
+
complete() {
|
69
|
+
complete === null || complete === void 0 ? void 0 : complete();
|
70
|
+
}
|
71
|
+
});
|
72
|
+
});
|
73
|
+
}
|
74
|
+
/**
|
75
|
+
* 打开氛围灯页面
|
76
|
+
* @param params {devId: string}
|
77
|
+
* @returns
|
78
|
+
*/
|
79
|
+
export function openOutdoorAmbientLighting(params) {
|
80
|
+
const {
|
81
|
+
success,
|
82
|
+
fail,
|
83
|
+
complete
|
84
|
+
} = params,
|
85
|
+
rest = _objectWithoutProperties(params, _excluded3);
|
86
|
+
let paramsStr = '';
|
87
|
+
if (Object.keys(rest).length > 0) {
|
88
|
+
paramsStr = '?' + objectToUrlParams(rest);
|
89
|
+
}
|
90
|
+
return new Promise((resolve, reject) => {
|
91
|
+
ty.router({
|
92
|
+
url: 'tuyaSmart://tsod_ambient_lighting' + paramsStr,
|
93
|
+
success() {
|
94
|
+
success === null || success === void 0 ? void 0 : success();
|
95
|
+
resolve();
|
96
|
+
},
|
97
|
+
fail(err) {
|
98
|
+
fail === null || fail === void 0 ? void 0 : fail(err);
|
99
|
+
reject(err);
|
100
|
+
},
|
101
|
+
complete() {
|
102
|
+
complete === null || complete === void 0 ? void 0 : complete();
|
103
|
+
}
|
104
|
+
});
|
105
|
+
});
|
106
|
+
}
|
107
|
+
/**
|
108
|
+
* 打开Siri页面,仅iOS
|
109
|
+
* @param params {devId: string}
|
110
|
+
* @returns
|
111
|
+
*/
|
112
|
+
export function openOutdoorShortcutSiri(params) {
|
113
|
+
const {
|
114
|
+
success,
|
115
|
+
fail,
|
116
|
+
complete
|
117
|
+
} = params,
|
118
|
+
rest = _objectWithoutProperties(params, _excluded4);
|
119
|
+
let paramsStr = '';
|
120
|
+
if (Object.keys(rest).length > 0) {
|
121
|
+
paramsStr = '?' + objectToUrlParams(rest);
|
122
|
+
}
|
123
|
+
return new Promise((resolve, reject) => {
|
124
|
+
ty.router({
|
125
|
+
url: 'tuyaSmart://tsod_shortcut_siri' + paramsStr,
|
126
|
+
success() {
|
127
|
+
success === null || success === void 0 ? void 0 : success();
|
128
|
+
resolve();
|
129
|
+
},
|
130
|
+
fail(err) {
|
131
|
+
fail === null || fail === void 0 ? void 0 : fail(err);
|
132
|
+
reject(err);
|
133
|
+
},
|
134
|
+
complete() {
|
135
|
+
complete === null || complete === void 0 ? void 0 : complete();
|
136
|
+
}
|
137
|
+
});
|
138
|
+
});
|
139
|
+
}
|
140
|
+
/**
|
141
|
+
* 打开配网
|
142
|
+
* @param params {devId: string}
|
143
|
+
* @returns
|
144
|
+
*/
|
145
|
+
export function openOutdoorConfigDeviceHome(params) {
|
146
|
+
const {
|
147
|
+
success,
|
148
|
+
fail,
|
149
|
+
complete
|
150
|
+
} = params,
|
151
|
+
rest = _objectWithoutProperties(params, _excluded5);
|
152
|
+
let paramsStr = '';
|
153
|
+
if (Object.keys(rest).length > 0) {
|
154
|
+
paramsStr = '?' + objectToUrlParams(rest);
|
155
|
+
}
|
156
|
+
return new Promise((resolve, reject) => {
|
157
|
+
ty.router({
|
158
|
+
url: 'tuyaSmart://config_device_home' + paramsStr,
|
159
|
+
success() {
|
160
|
+
success === null || success === void 0 ? void 0 : success();
|
161
|
+
resolve();
|
162
|
+
},
|
163
|
+
fail(err) {
|
164
|
+
fail === null || fail === void 0 ? void 0 : fail(err);
|
165
|
+
reject(err);
|
166
|
+
},
|
167
|
+
complete() {
|
168
|
+
complete === null || complete === void 0 ? void 0 : complete();
|
169
|
+
}
|
170
|
+
});
|
171
|
+
});
|
172
|
+
}
|
package/lib/panel/i18n/index.js
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
import "core-js/modules/es.string.replace.js";
|
1
2
|
import { requestCloud, getSystemInfoSync, THING } from '../..';
|
2
3
|
import { getBitValue } from '../utils';
|
3
4
|
export default class I18N {
|
@@ -10,7 +11,7 @@ export default class I18N {
|
|
10
11
|
}
|
11
12
|
forceUpdateNetworkLang(productId) {
|
12
13
|
requestCloud({
|
13
|
-
api:
|
14
|
+
api: "".concat(THING, ".m.i18n.get"),
|
14
15
|
version: '1.0',
|
15
16
|
data: {
|
16
17
|
productId,
|
@@ -101,14 +102,14 @@ export default class I18N {
|
|
101
102
|
formatString(str) {
|
102
103
|
let res = str;
|
103
104
|
for (let i = 0; i < (arguments.length <= 1 ? 0 : arguments.length - 1); i++) {
|
104
|
-
res = this._replaceAll(
|
105
|
+
res = this._replaceAll("{".concat(i, "}"), i + 1 < 1 || arguments.length <= i + 1 ? undefined : arguments[i + 1], res);
|
105
106
|
}
|
106
107
|
return res;
|
107
108
|
}
|
108
109
|
formatValue(key) {
|
109
110
|
let res = typeof this[key] !== 'undefined' ? this[key] : I18n.t(key);
|
110
111
|
for (let i = 0; i < (arguments.length <= 1 ? 0 : arguments.length - 1); i++) {
|
111
|
-
res = this._replaceAll(
|
112
|
+
res = this._replaceAll("{".concat(i, "}"), i + 1 < 1 || arguments.length <= i + 1 ? undefined : arguments[i + 1], res);
|
112
113
|
}
|
113
114
|
return res;
|
114
115
|
}
|
@@ -121,17 +122,17 @@ export default class I18N {
|
|
121
122
|
getDpLang(code, value) {
|
122
123
|
let key;
|
123
124
|
if (typeof value === 'undefined') {
|
124
|
-
key =
|
125
|
+
key = "dp_".concat(code).toLowerCase();
|
125
126
|
} else if (typeof value === 'boolean') {
|
126
127
|
const valStr = value ? 'on' : 'off';
|
127
|
-
key =
|
128
|
+
key = "dp_".concat(code, "_").concat(valStr).toLowerCase();
|
128
129
|
} else {
|
129
|
-
key =
|
130
|
+
key = "dp_".concat(code, "_").concat(value).toLowerCase();
|
130
131
|
}
|
131
132
|
return I18n.t(key) !== key ? I18n.t(key) : typeof this[key] !== 'undefined' ? this[key] : I18n.t(key);
|
132
133
|
}
|
133
134
|
getDpName(code, defaultName) {
|
134
|
-
const key =
|
135
|
+
const key = "dp_".concat(code).toLowerCase();
|
135
136
|
return I18n.t(key) !== key ? I18n.t(key) : typeof this[key] !== 'undefined' ? this[key] : defaultName;
|
136
137
|
}
|
137
138
|
getDpsLang(key) {
|
@@ -163,7 +164,7 @@ export default class I18N {
|
|
163
164
|
if (typeof schema === 'undefined') return result;
|
164
165
|
const lists = schema.range;
|
165
166
|
lists.map(v => {
|
166
|
-
const key =
|
167
|
+
const key = "dp_".concat(dpCode, "_").concat(v).toLowerCase();
|
167
168
|
result[v] = I18n.t(key) !== key ? I18n.t(key) : typeof this[key] !== 'undefined' ? this[key] : I18n.t(key);
|
168
169
|
return null;
|
169
170
|
});
|
@@ -177,12 +178,12 @@ export default class I18N {
|
|
177
178
|
* @param {*} power 设备当前的开关状态 (如果当前设备为开启状态, 则倒计时显示为关闭)
|
178
179
|
*/
|
179
180
|
parseCountdown(t, power) {
|
180
|
-
const h = parseFloat(
|
181
|
-
const m = parseFloat(
|
181
|
+
const h = parseFloat("".concat(t / 3600));
|
182
|
+
const m = parseFloat("".concat(t / 60 - h * 60));
|
182
183
|
const tHour = I18n.t('t_hour') !== 't_hour' ? I18n.t('t_hour') : typeof this.t_hour !== 'undefined' ? this.t_hour : I18n.t('t_hour');
|
183
184
|
const tMinute = I18n.t('t_minute') !== 't_minute' ? I18n.t('t_minute') : typeof this.t_minute !== 'undefined' ? this.t_minute : I18n.t('t_minute');
|
184
|
-
const time = h >= 1.0 ?
|
185
|
-
const key =
|
185
|
+
const time = h >= 1.0 ? "".concat(Math.round(h)).concat(tHour) : "".concat(Math.round(m)).concat(tMinute);
|
186
|
+
const key = "countdown_".concat(power ? 'on' : 'off');
|
186
187
|
const str = I18n.t(key) !== key ? I18n.t(key) : typeof this[key] !== 'undefined' ? this[key] : I18n.t(key);
|
187
188
|
return this.formatString(str, time);
|
188
189
|
}
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import "core-js/modules/es.string.replace.js";
|
1
2
|
import { requestCloud, getSystemInfoSync, THING } from '../..';
|
2
3
|
import { getBitValue } from '../utils';
|
3
4
|
|
@@ -15,7 +16,7 @@ export default class I18N {
|
|
15
16
|
}
|
16
17
|
forceUpdateNetworkLang(productId) {
|
17
18
|
requestCloud({
|
18
|
-
api:
|
19
|
+
api: "".concat(THING, ".m.i18n.get"),
|
19
20
|
version: '1.0',
|
20
21
|
data: {
|
21
22
|
productId,
|
@@ -106,14 +107,14 @@ export default class I18N {
|
|
106
107
|
formatString(str) {
|
107
108
|
let res = str;
|
108
109
|
for (let i = 0; i < (arguments.length <= 1 ? 0 : arguments.length - 1); i++) {
|
109
|
-
res = this._replaceAll(
|
110
|
+
res = this._replaceAll("{".concat(i, "}"), i + 1 < 1 || arguments.length <= i + 1 ? undefined : arguments[i + 1], res);
|
110
111
|
}
|
111
112
|
return res;
|
112
113
|
}
|
113
114
|
formatValue(key) {
|
114
115
|
let res = typeof this[key] !== 'undefined' ? this[key] : I18n.t(key);
|
115
116
|
for (let i = 0; i < (arguments.length <= 1 ? 0 : arguments.length - 1); i++) {
|
116
|
-
res = this._replaceAll(
|
117
|
+
res = this._replaceAll("{".concat(i, "}"), i + 1 < 1 || arguments.length <= i + 1 ? undefined : arguments[i + 1], res);
|
117
118
|
}
|
118
119
|
return res;
|
119
120
|
}
|
@@ -126,17 +127,17 @@ export default class I18N {
|
|
126
127
|
getDpLang(code, value) {
|
127
128
|
let key;
|
128
129
|
if (typeof value === 'undefined') {
|
129
|
-
key =
|
130
|
+
key = "dp_".concat(code).toLowerCase();
|
130
131
|
} else if (typeof value === 'boolean') {
|
131
132
|
const valStr = value ? 'on' : 'off';
|
132
|
-
key =
|
133
|
+
key = "dp_".concat(code, "_").concat(valStr).toLowerCase();
|
133
134
|
} else {
|
134
|
-
key =
|
135
|
+
key = "dp_".concat(code, "_").concat(value).toLowerCase();
|
135
136
|
}
|
136
137
|
return I18n.t(key) !== key ? I18n.t(key) : typeof this[key] !== 'undefined' ? this[key] : I18n.t(key);
|
137
138
|
}
|
138
139
|
getDpName(code, defaultName) {
|
139
|
-
const key =
|
140
|
+
const key = "dp_".concat(code).toLowerCase();
|
140
141
|
return I18n.t(key) !== key ? I18n.t(key) : typeof this[key] !== 'undefined' ? this[key] : defaultName;
|
141
142
|
}
|
142
143
|
getDpsLang(key) {
|
@@ -168,7 +169,7 @@ export default class I18N {
|
|
168
169
|
if (typeof schema === 'undefined') return result;
|
169
170
|
const lists = schema.range;
|
170
171
|
lists.map(v => {
|
171
|
-
const key =
|
172
|
+
const key = "dp_".concat(dpCode, "_").concat(v).toLowerCase();
|
172
173
|
result[v] = I18n.t(key) !== key ? I18n.t(key) : typeof this[key] !== 'undefined' ? this[key] : I18n.t(key);
|
173
174
|
return null;
|
174
175
|
});
|
@@ -182,12 +183,12 @@ export default class I18N {
|
|
182
183
|
* @param {*} power 设备当前的开关状态 (如果当前设备为开启状态, 则倒计时显示为关闭)
|
183
184
|
*/
|
184
185
|
parseCountdown(t, power) {
|
185
|
-
const h = parseFloat(
|
186
|
-
const m = parseFloat(
|
186
|
+
const h = parseFloat("".concat(t / 3600));
|
187
|
+
const m = parseFloat("".concat(t / 60 - h * 60));
|
187
188
|
const tHour = I18n.t('t_hour') !== 't_hour' ? I18n.t('t_hour') : typeof this.t_hour !== 'undefined' ? this.t_hour : I18n.t('t_hour');
|
188
189
|
const tMinute = I18n.t('t_minute') !== 't_minute' ? I18n.t('t_minute') : typeof this.t_minute !== 'undefined' ? this.t_minute : I18n.t('t_minute');
|
189
|
-
const time = h >= 1.0 ?
|
190
|
-
const key =
|
190
|
+
const time = h >= 1.0 ? "".concat(Math.round(h)).concat(tHour) : "".concat(Math.round(m)).concat(tMinute);
|
191
|
+
const key = "countdown_".concat(power ? 'on' : 'off');
|
191
192
|
const str = I18n.t(key) !== key ? I18n.t(key) : typeof this[key] !== 'undefined' ? this[key] : I18n.t(key);
|
192
193
|
return this.formatString(str, time);
|
193
194
|
}
|
package/lib/panel/publishDps.js
CHANGED
@@ -25,7 +25,7 @@ export function sendDps(data) {
|
|
25
25
|
const codeIds = (devInfo === null || devInfo === void 0 ? void 0 : devInfo.codeIds) || {};
|
26
26
|
Object.keys(data).forEach(code => {
|
27
27
|
if (codeIds[code] !== undefined) {
|
28
|
-
dps[
|
28
|
+
dps["".concat(codeIds[code])] = data[code];
|
29
29
|
} else {
|
30
30
|
dps[code] = data[code];
|
31
31
|
}
|
package/lib/redirectTo/index.js
CHANGED
package/lib/utils.js
CHANGED
@@ -3,12 +3,12 @@ export function factory(name) {
|
|
3
3
|
return function () {
|
4
4
|
var _inst$opts$namespace;
|
5
5
|
if (opts.deprecated) {
|
6
|
-
console.warn(
|
6
|
+
console.warn("\u8BE5\u65B9\u6CD5 ".concat(name, " \u5DF2\u5F03\u7528"));
|
7
7
|
}
|
8
8
|
const inst = typeof ty === 'undefined' ? {} : ty;
|
9
9
|
const method = opts.namespace ? ((_inst$opts$namespace = inst[opts.namespace]) !== null && _inst$opts$namespace !== void 0 ? _inst$opts$namespace : {})[name] : inst[name];
|
10
10
|
if (!method) {
|
11
|
-
console.warn(
|
11
|
+
console.warn("// TODO \u6682\u672A\u5B9E\u73B0\u65B9\u6CD5 ".concat(opts.namespace ? opts.namespace + '.' : '').concat(name));
|
12
12
|
return;
|
13
13
|
}
|
14
14
|
return method.apply(this, arguments);
|
@@ -17,11 +17,11 @@ export function factory(name) {
|
|
17
17
|
export function factoryContants(name) {
|
18
18
|
let opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
19
19
|
if (opts.deprecated) {
|
20
|
-
console.warn(
|
20
|
+
console.warn("\u8BE5\u53D8\u91CF ".concat(name, " \u5DF2\u5F03\u7528"));
|
21
21
|
}
|
22
22
|
const inst = typeof ty === 'undefined' ? {} : ty;
|
23
23
|
if (!inst[name]) {
|
24
|
-
console.warn(
|
24
|
+
console.warn("// TODO \u6682\u672A\u5B9E\u73B0\u53D8\u91CF ".concat(name));
|
25
25
|
return;
|
26
26
|
}
|
27
27
|
return inst[name];
|
@@ -34,7 +34,7 @@ export function objectToUrlParams(obj) {
|
|
34
34
|
const value = obj[key];
|
35
35
|
const encodedKey = encodeURIComponent(key);
|
36
36
|
const encodedValue = encodeURIComponent(value);
|
37
|
-
params.push(
|
37
|
+
params.push("".concat(encodedKey, "=").concat(encodedValue));
|
38
38
|
}
|
39
39
|
}
|
40
40
|
return params.join('&');
|
package/lib/utils.wechat.js
CHANGED
@@ -5,7 +5,7 @@ export function factory(name) {
|
|
5
5
|
if (/(set|get|remove|clear)+Storage(Sync)?$/.test(name)) {
|
6
6
|
return function (option) {
|
7
7
|
if (opts.deprecated) {
|
8
|
-
console.warn(
|
8
|
+
console.warn("\u8BE5\u65B9\u6CD5 ".concat(name, " \u5DF2\u5F03\u7528"));
|
9
9
|
}
|
10
10
|
// eslint-disable-next-line prefer-rest-params
|
11
11
|
return wx[name].call(this, option.key, option.data);
|
@@ -13,10 +13,10 @@ export function factory(name) {
|
|
13
13
|
}
|
14
14
|
return function () {
|
15
15
|
if (opts.deprecated) {
|
16
|
-
console.warn(
|
16
|
+
console.warn("\u8BE5\u65B9\u6CD5 ".concat(name, " \u5DF2\u5F03\u7528"));
|
17
17
|
}
|
18
18
|
if (!tyWx[name] && !wx[name]) {
|
19
|
-
console.warn(
|
19
|
+
console.warn("// TODO \u6682\u672A\u5B9E\u73B0\u65B9\u6CD5 wx.".concat(name));
|
20
20
|
return;
|
21
21
|
}
|
22
22
|
// 优先取得 TTT 能力的方法
|
@@ -30,11 +30,11 @@ export function factory(name) {
|
|
30
30
|
export function factoryContants(name) {
|
31
31
|
let opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
32
32
|
if (opts.deprecated) {
|
33
|
-
console.warn(
|
33
|
+
console.warn("\u8BE5\u53D8\u91CF ".concat(name, " \u5DF2\u5F03\u7528"));
|
34
34
|
}
|
35
35
|
const inst = typeof wx === 'undefined' ? {} : wx;
|
36
36
|
if (!inst[name]) {
|
37
|
-
console.warn(
|
37
|
+
console.warn("// TODO \u6682\u672A\u5B9E\u73B0\u53D8\u91CF ".concat(name));
|
38
38
|
return;
|
39
39
|
}
|
40
40
|
return inst[name];
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@ray-js/api",
|
3
|
-
"version": "1.4.
|
3
|
+
"version": "1.4.30",
|
4
4
|
"description": "Ray universal api",
|
5
5
|
"keywords": [
|
6
6
|
"ray"
|
@@ -29,13 +29,13 @@
|
|
29
29
|
"watch": "ray start --type=component"
|
30
30
|
},
|
31
31
|
"dependencies": {
|
32
|
-
"@ray-js/framework": "1.4.
|
33
|
-
"@ray-js/router": "1.4.
|
32
|
+
"@ray-js/framework": "^1.4.30",
|
33
|
+
"@ray-js/router": "^1.4.30",
|
34
34
|
"@ray-js/wechat": "^0.0.33",
|
35
35
|
"base64-browser": "^1.0.1"
|
36
36
|
},
|
37
37
|
"devDependencies": {
|
38
|
-
"@ray-js/cli": "1.4.
|
38
|
+
"@ray-js/cli": "^1.4.30",
|
39
39
|
"art-template": "^4.13.2",
|
40
40
|
"fs-extra": "^10.1.0",
|
41
41
|
"miniprogram-api-typings": "^3.12.2",
|
@@ -45,5 +45,5 @@
|
|
45
45
|
"access": "public",
|
46
46
|
"registry": "https://registry.npmjs.org"
|
47
47
|
},
|
48
|
-
"gitHead": "
|
48
|
+
"gitHead": "3fd8c1689f3cc6c461f192189056f67f6314f812"
|
49
49
|
}
|