@ray-js/lock-sdk 1.1.1-beta.2 → 1.1.1-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/api/index.d.ts +8 -0
- package/lib/api/index.js +10 -0
- package/lib/capability.js +44 -18
- package/lib/config/index.d.ts +2 -1
- package/lib/config/index.js +1 -0
- package/lib/index.js +1 -0
- package/lib/interface.d.ts +12 -1
- package/lib/open.js +9 -9
- package/lib/state.js +17 -12
- package/lib/temporary.js +1 -1
- package/lib/unlock-method.d.ts +3 -1
- package/lib/unlock-method.js +57 -6
- package/lib/user.js +3 -6
- package/lib/utils/errors.js +1 -0
- package/lib/utils/index.js +13 -11
- package/package.json +1 -1
package/lib/api/index.d.ts
CHANGED
|
@@ -27,4 +27,12 @@ export declare const fetchOfflineDpData: (deviceId: string) => Promise<{
|
|
|
27
27
|
}[]>;
|
|
28
28
|
export declare const publishOfflineDpData: (deviceId: string, dpData: Record<string, DpValue>) => Promise<unknown>;
|
|
29
29
|
export declare const clearOfflineDpData: (deviceId: string) => Promise<unknown>;
|
|
30
|
+
export declare const getFileRemoteUrl: ({ biz, resources, }: {
|
|
31
|
+
biz: string;
|
|
32
|
+
resources: {
|
|
33
|
+
objectKey: string;
|
|
34
|
+
}[];
|
|
35
|
+
}) => Promise<{
|
|
36
|
+
signedUrls: Record<string, string>;
|
|
37
|
+
}>;
|
|
30
38
|
export {};
|
package/lib/api/index.js
CHANGED
|
@@ -70,3 +70,13 @@ export const clearOfflineDpData = async (deviceId) => {
|
|
|
70
70
|
version: "1.0",
|
|
71
71
|
});
|
|
72
72
|
};
|
|
73
|
+
export const getFileRemoteUrl = ({ biz, resources, }) => {
|
|
74
|
+
return requestApi({
|
|
75
|
+
api: `${THING}.web.fastroute.download.sign`,
|
|
76
|
+
version: "2.0",
|
|
77
|
+
data: {
|
|
78
|
+
biz,
|
|
79
|
+
signedRequest: { resources },
|
|
80
|
+
},
|
|
81
|
+
});
|
|
82
|
+
};
|
package/lib/capability.js
CHANGED
|
@@ -45,6 +45,7 @@ export const getDeviceAdvancedAbilities = async () => {
|
|
|
45
45
|
"tyabi4ucx5",
|
|
46
46
|
"tyabis9tpe",
|
|
47
47
|
"tyabiwxrn9",
|
|
48
|
+
"tyabipd4hh",
|
|
48
49
|
]),
|
|
49
50
|
getDeviceAdvancedAbility(config.devInfo.devId),
|
|
50
51
|
]);
|
|
@@ -68,27 +69,52 @@ export const getDeviceAdvancedAbilities = async () => {
|
|
|
68
69
|
support: false,
|
|
69
70
|
config: {},
|
|
70
71
|
},
|
|
72
|
+
unlockGuide: {
|
|
73
|
+
support: false,
|
|
74
|
+
config: {},
|
|
75
|
+
},
|
|
71
76
|
};
|
|
72
77
|
productAbilities.forEach((item) => {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
78
|
+
try {
|
|
79
|
+
if (item.isOpen) {
|
|
80
|
+
const data = JSON.parse(item.extConfig);
|
|
81
|
+
switch (item.abilityCode) {
|
|
82
|
+
case "tyabi4ucx5": {
|
|
83
|
+
deviceAdvanceAbilityCache.ai.config = data;
|
|
84
|
+
const dataReport = data?.ai_data_report ?? false;
|
|
85
|
+
const itemRecognition = data?.ai_recognition?.[0]?.item_recognition ?? false;
|
|
86
|
+
const petRecognition = data?.ai_recognition?.[0]?.pet_recognition ?? false;
|
|
87
|
+
const voice = data?.ai_voice ?? false;
|
|
88
|
+
const message = data?.ai_message ?? false;
|
|
89
|
+
deviceAdvanceAbilityCache.ai.support =
|
|
90
|
+
dataReport ||
|
|
91
|
+
itemRecognition ||
|
|
92
|
+
petRecognition ||
|
|
93
|
+
voice ||
|
|
94
|
+
message;
|
|
95
|
+
break;
|
|
96
|
+
}
|
|
97
|
+
case "tyabis9tpe": {
|
|
98
|
+
deviceAdvanceAbilityCache.wechat.support = true;
|
|
99
|
+
deviceAdvanceAbilityCache.wechat.config = data;
|
|
100
|
+
break;
|
|
101
|
+
}
|
|
102
|
+
case "tyabiwxrn9": {
|
|
103
|
+
deviceAdvanceAbilityCache.wechatVoip.support =
|
|
104
|
+
!!data?.voipType?.includes("0");
|
|
105
|
+
deviceAdvanceAbilityCache.wechatVoip.config = data;
|
|
106
|
+
break;
|
|
107
|
+
}
|
|
108
|
+
case "tyabipd4hh": {
|
|
109
|
+
deviceAdvanceAbilityCache.unlockGuide.support = true;
|
|
110
|
+
deviceAdvanceAbilityCache.unlockGuide.config = data;
|
|
111
|
+
break;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
87
115
|
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
!!data?.voipType?.includes("0");
|
|
91
|
-
deviceAdvanceAbilityCache.wechatVoip.config = data;
|
|
116
|
+
catch (error) {
|
|
117
|
+
console.warn(`setting [${item.abilityCode}] config error`, error);
|
|
92
118
|
}
|
|
93
119
|
});
|
|
94
120
|
return deviceAdvanceAbilityCache;
|
package/lib/config/index.d.ts
CHANGED
|
@@ -18,9 +18,10 @@ declare const config: {
|
|
|
18
18
|
videoAngle: number;
|
|
19
19
|
supportMultipleFace: boolean;
|
|
20
20
|
supportOfflineDps: boolean;
|
|
21
|
+
preFetch: boolean;
|
|
21
22
|
deviceStatus: DeviceStatus;
|
|
22
23
|
};
|
|
23
|
-
type UpdateConfigParams = Omit<LockSDKOption, "devInfo" | "deviceId">;
|
|
24
|
+
type UpdateConfigParams = Omit<LockSDKOption, "devInfo" | "deviceId" | "preFetch">;
|
|
24
25
|
export declare const updateConfig: (options: UpdateConfigParams) => void;
|
|
25
26
|
export declare const hasCapability: (capability: ProductCommunicationType) => boolean;
|
|
26
27
|
export declare const hasDp: (dpCode: string) => boolean;
|
package/lib/config/index.js
CHANGED
package/lib/index.js
CHANGED
|
@@ -60,6 +60,7 @@ export const init = async (options) => {
|
|
|
60
60
|
config.codesById = codesById;
|
|
61
61
|
config.idsByCode = idsByCode;
|
|
62
62
|
config.supportBigData = !!dpSchema[dpCodes.synchMethodW];
|
|
63
|
+
config.preFetch = options?.preFetch ?? false;
|
|
63
64
|
config.communication = getCapabilities(devInfo.capability).map((item) => item.id);
|
|
64
65
|
addEvents();
|
|
65
66
|
await initState();
|
package/lib/interface.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export interface LockSDKOption {
|
|
|
10
10
|
passwordSupportZero?: boolean;
|
|
11
11
|
supportMultipleFace?: boolean;
|
|
12
12
|
supportOfflineDps?: boolean;
|
|
13
|
+
preFetch?: boolean;
|
|
13
14
|
}
|
|
14
15
|
export interface ErrorData {
|
|
15
16
|
errorCode: number;
|
|
@@ -81,7 +82,7 @@ export interface CurrentUser {
|
|
|
81
82
|
permanent: boolean;
|
|
82
83
|
}
|
|
83
84
|
export interface UnlockMethodBaseInfo {
|
|
84
|
-
unlockId:
|
|
85
|
+
unlockId: number;
|
|
85
86
|
unlockName: string;
|
|
86
87
|
isBound: boolean;
|
|
87
88
|
id: number;
|
|
@@ -143,6 +144,7 @@ export type DpMapDataType<T extends DpMapType> = {
|
|
|
143
144
|
};
|
|
144
145
|
export interface NotifyInfo {
|
|
145
146
|
appSend?: boolean;
|
|
147
|
+
msgSend?: boolean;
|
|
146
148
|
msgPhone?: string;
|
|
147
149
|
countryCode?: string;
|
|
148
150
|
}
|
|
@@ -312,6 +314,10 @@ export interface DeviceAdvancedAbility {
|
|
|
312
314
|
support: boolean;
|
|
313
315
|
config: Record<string, any>;
|
|
314
316
|
};
|
|
317
|
+
unlockGuide: {
|
|
318
|
+
support: boolean;
|
|
319
|
+
config: Record<string, any>;
|
|
320
|
+
};
|
|
315
321
|
}
|
|
316
322
|
export interface OfflineDpInfo {
|
|
317
323
|
value: DpValue;
|
|
@@ -320,4 +326,9 @@ export interface OfflineDpInfo {
|
|
|
320
326
|
export interface OfflineDps {
|
|
321
327
|
[code: string]: OfflineDpInfo;
|
|
322
328
|
}
|
|
329
|
+
export interface UnlockGuide {
|
|
330
|
+
videoUrl: string;
|
|
331
|
+
picUrl: string;
|
|
332
|
+
expireTime: number;
|
|
333
|
+
}
|
|
323
334
|
export {};
|
package/lib/open.js
CHANGED
|
@@ -42,18 +42,18 @@ export const checkRemoteEnabled = parallelMerge(async () => {
|
|
|
42
42
|
if (deviceStatus.type !== "online") {
|
|
43
43
|
throw getError(1001);
|
|
44
44
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
const isLocalOnline = deviceStatus.onlineTypes.length === 1 &&
|
|
46
|
+
deviceStatus.onlineTypes.includes("local");
|
|
47
|
+
const isThreadLocalOnline = hasThread && isLocalOnline;
|
|
48
|
+
if (isThreadLocalOnline || deviceStatus.onlineTypes.includes("ble")) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
if (isLocalOnline) {
|
|
52
|
+
throw getError(1064);
|
|
49
53
|
}
|
|
50
54
|
if (dpSchema[dpCodes.remoteNoDpKey] === undefined) {
|
|
51
55
|
throw getError(1045);
|
|
52
56
|
}
|
|
53
|
-
if ((hasThread && deviceStatus.onlineType === "local") ||
|
|
54
|
-
deviceStatus.onlineType === "ble") {
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
57
|
if (!remoteOpenEnabled) {
|
|
58
58
|
throw getError(1046);
|
|
59
59
|
}
|
|
@@ -65,7 +65,7 @@ export const checkRemoteEnabled = parallelMerge(async () => {
|
|
|
65
65
|
}
|
|
66
66
|
});
|
|
67
67
|
const _doAction = async (isOpen, timeout) => {
|
|
68
|
-
const { devInfo,
|
|
68
|
+
const { devInfo, communication } = config;
|
|
69
69
|
await checkRemoteEnabled();
|
|
70
70
|
const deviceStatus = getDeviceStatus();
|
|
71
71
|
const hasThread = hasCapability(ProductCommunicationType.THREAD);
|
package/lib/state.js
CHANGED
|
@@ -38,7 +38,7 @@ const updateOnlineType = async () => {
|
|
|
38
38
|
updateDeviceStatus();
|
|
39
39
|
};
|
|
40
40
|
export const getDeviceStatus = () => {
|
|
41
|
-
const { onlineType,
|
|
41
|
+
const { onlineType, devInfo: { isCloudOnline, isOnline, wifiEnableState }, } = config;
|
|
42
42
|
const status = {
|
|
43
43
|
type: isOnline ? "online" : "offline",
|
|
44
44
|
connectEnable: false,
|
|
@@ -46,7 +46,7 @@ export const getDeviceStatus = () => {
|
|
|
46
46
|
onlineTypes: [],
|
|
47
47
|
isWifiActive: wifiEnableState !== 1,
|
|
48
48
|
};
|
|
49
|
-
const isBleOnline =
|
|
49
|
+
const isBleOnline = isOnlineByType(onlineType, 2);
|
|
50
50
|
const isLocalOnline = !isCloudOnline && isOnlineByType(onlineType, 1);
|
|
51
51
|
const supportWifi = hasCapability(ProductCommunicationType.WIFI);
|
|
52
52
|
const supportBle = hasCapability(ProductCommunicationType.BLUETOOTH);
|
|
@@ -199,24 +199,29 @@ export const permissions = [
|
|
|
199
199
|
"everyOne",
|
|
200
200
|
"noOne",
|
|
201
201
|
];
|
|
202
|
+
var DeviceProperties;
|
|
203
|
+
(function (DeviceProperties) {
|
|
204
|
+
DeviceProperties["REMOTE_UNLOCK_AUTH"] = "REMOTE_UNLOCK_AUTH";
|
|
205
|
+
DeviceProperties["UNLOCK_PHONE_REMOTE"] = "UNLOCK_PHONE_REMOTE";
|
|
206
|
+
})(DeviceProperties || (DeviceProperties = {}));
|
|
207
|
+
const propsList = [
|
|
208
|
+
DeviceProperties.REMOTE_UNLOCK_AUTH,
|
|
209
|
+
DeviceProperties.UNLOCK_PHONE_REMOTE,
|
|
210
|
+
];
|
|
202
211
|
const fetchDeviceProperties = async (isForce) => {
|
|
203
212
|
let result = null;
|
|
204
213
|
if (isForce) {
|
|
205
|
-
result = await getDeviceProperties(config.devInfo.devId,
|
|
206
|
-
"REMOTE_UNLOCK_AUTH",
|
|
207
|
-
"UNLOCK_PHONE_REMOTE",
|
|
208
|
-
]);
|
|
214
|
+
result = await getDeviceProperties(config.devInfo.devId, propsList);
|
|
209
215
|
}
|
|
210
216
|
else {
|
|
211
217
|
result = await getDataWithPreFetch("getDeviceProperties", () => {
|
|
212
|
-
return getDeviceProperties(config.devInfo.devId,
|
|
213
|
-
"REMOTE_UNLOCK_AUTH",
|
|
214
|
-
"UNLOCK_PHONE_REMOTE",
|
|
215
|
-
]);
|
|
218
|
+
return getDeviceProperties(config.devInfo.devId, propsList);
|
|
216
219
|
});
|
|
217
220
|
}
|
|
218
|
-
config.remoteOpenEnabled =
|
|
219
|
-
|
|
221
|
+
config.remoteOpenEnabled =
|
|
222
|
+
result[DeviceProperties.UNLOCK_PHONE_REMOTE] === "true";
|
|
223
|
+
config.remoteOpenPermission =
|
|
224
|
+
permissions[+result[DeviceProperties.REMOTE_UNLOCK_AUTH] || 0];
|
|
220
225
|
};
|
|
221
226
|
export const initState = async () => {
|
|
222
227
|
const { devInfo: { dps, devId }, dpSchema, } = config;
|
package/lib/temporary.js
CHANGED
|
@@ -83,7 +83,7 @@ export const createTempCustom = parallelOnly(async (params) => {
|
|
|
83
83
|
endTime: effective.expiredDate,
|
|
84
84
|
loop: loopType,
|
|
85
85
|
loopConfig: 0,
|
|
86
|
-
weeks: effective.weeks
|
|
86
|
+
weeks: effective.weeks ? [...effective.weeks] : [0, 0, 0, 0, 0, 0, 0],
|
|
87
87
|
days: [],
|
|
88
88
|
startHour: Math.floor(effectiveTime / 60),
|
|
89
89
|
startMinute: effectiveTime % 60,
|
package/lib/unlock-method.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { ErrorData, UnBindUnlockMethodGroup, UnlockMethodDetail, UnlockMethodType } from "./interface";
|
|
1
|
+
import { ErrorData, UnBindUnlockMethodGroup, UnlockGuide, UnlockMethodDetail, UnlockMethodType } from "./interface";
|
|
2
2
|
export interface SpecialUnlockMethodInfo {
|
|
3
3
|
appSend?: boolean;
|
|
4
|
+
msgSend?: boolean;
|
|
4
5
|
msgPhone?: string;
|
|
5
6
|
verifyCode?: string;
|
|
6
7
|
countryCode?: string;
|
|
@@ -85,4 +86,5 @@ export type AddUnlockMethodEvent = StepEvent | SuccessEvent | ErrorEvent;
|
|
|
85
86
|
export type AddUnlockMethodListener = (event: AddUnlockMethodEvent) => void;
|
|
86
87
|
export declare const onAddUnlockMethod: (listener: AddUnlockMethodListener) => void;
|
|
87
88
|
export declare const offAddUnlockMethod: (listener: AddUnlockMethodListener) => void;
|
|
89
|
+
export declare const getUnlockGuide: (type: UnlockMethodType) => Promise<UnlockGuide | null>;
|
|
88
90
|
export {};
|
package/lib/unlock-method.js
CHANGED
|
@@ -12,8 +12,9 @@ import { publishDps } from "./utils/publishDps";
|
|
|
12
12
|
import { encrypt } from "./utils/device";
|
|
13
13
|
import emitter from "./utils/event";
|
|
14
14
|
import { DPCHANGE, UNLOCK_METHOD_EVENT } from "./utils/constant";
|
|
15
|
-
import { sendPhoneVerifyCode } from "./api";
|
|
15
|
+
import { getFileRemoteUrl, sendPhoneVerifyCode } from "./api";
|
|
16
16
|
import { getUserInfo } from "./user";
|
|
17
|
+
import { getDeviceAdvancedAbilities } from "./capability";
|
|
17
18
|
const getAddUnlockError = (status) => {
|
|
18
19
|
if (status >= 0 && status <= 10) {
|
|
19
20
|
return getError(1015 + status);
|
|
@@ -41,6 +42,7 @@ export const getUnlockMethodDetail = async (id) => {
|
|
|
41
42
|
userType: cloudData.userType,
|
|
42
43
|
notifyInfo: {
|
|
43
44
|
appSend: !!cloudData.notifyInfo?.appSend,
|
|
45
|
+
msgSend: !!cloudData.notifyInfo?.msgPhone,
|
|
44
46
|
msgPhone: cloudData.notifyInfo?.msgPhone,
|
|
45
47
|
countryCode: cloudData.notifyInfo?.countryCode,
|
|
46
48
|
},
|
|
@@ -104,11 +106,14 @@ const checkSpecial = (isSpecial, params, oldSetting) => {
|
|
|
104
106
|
if (!supportedPhone) {
|
|
105
107
|
throw getError(1057);
|
|
106
108
|
}
|
|
107
|
-
else if (!params?.
|
|
109
|
+
else if (!params?.msgSend) {
|
|
108
110
|
throw getError(1058);
|
|
109
111
|
}
|
|
110
112
|
}
|
|
111
|
-
if (supportedPhone && params?.
|
|
113
|
+
if (supportedPhone && params?.msgSend) {
|
|
114
|
+
if (!params.msgPhone) {
|
|
115
|
+
throw getError(1066);
|
|
116
|
+
}
|
|
112
117
|
if (!params.countryCode) {
|
|
113
118
|
throw getError(1056);
|
|
114
119
|
}
|
|
@@ -121,9 +126,9 @@ const checkSpecial = (isSpecial, params, oldSetting) => {
|
|
|
121
126
|
unlockAttr: isSpecial ? 1 : 0,
|
|
122
127
|
notifyInfo: {
|
|
123
128
|
appSend: !!params?.appSend,
|
|
124
|
-
msgPhone: supportedPhone ? params?.msgPhone : undefined,
|
|
125
|
-
countryCode: supportedPhone ? params?.countryCode : undefined,
|
|
126
|
-
msgPhoneVerifyCode: supportedPhone ? params?.verifyCode : undefined,
|
|
129
|
+
msgPhone: supportedPhone && params?.msgSend ? params?.msgPhone : undefined,
|
|
130
|
+
countryCode: supportedPhone && params?.msgSend ? params?.countryCode : undefined,
|
|
131
|
+
msgPhoneVerifyCode: supportedPhone && params?.msgSend ? params?.verifyCode : undefined,
|
|
127
132
|
},
|
|
128
133
|
};
|
|
129
134
|
};
|
|
@@ -560,3 +565,49 @@ export const onAddUnlockMethod = (listener) => {
|
|
|
560
565
|
export const offAddUnlockMethod = (listener) => {
|
|
561
566
|
emitter.off(UNLOCK_METHOD_EVENT, listener);
|
|
562
567
|
};
|
|
568
|
+
const guileTypeMap = {
|
|
569
|
+
card: ["addCard", "addCardPic"],
|
|
570
|
+
finger: ["addFingerprint", "addFingerprintPic"],
|
|
571
|
+
face: ["addFace", "addFacePic"],
|
|
572
|
+
fingerVein: ["addFingervein", "addFingerveinPic"],
|
|
573
|
+
hand: ["addPalmvein", "addPalmveinPic"],
|
|
574
|
+
eye: ["addIris", "addIrisPic"],
|
|
575
|
+
};
|
|
576
|
+
export const getUnlockGuide = async (type) => {
|
|
577
|
+
if (type === "password") {
|
|
578
|
+
return null;
|
|
579
|
+
}
|
|
580
|
+
const { unlockGuide } = await getDeviceAdvancedAbilities();
|
|
581
|
+
if (unlockGuide.support) {
|
|
582
|
+
const [videoKey, picKey] = guileTypeMap[type] || ["", ""];
|
|
583
|
+
const resources = [];
|
|
584
|
+
let videoUrlPath = "";
|
|
585
|
+
let picUrlPath = "";
|
|
586
|
+
if (unlockGuide.config[picKey]) {
|
|
587
|
+
picUrlPath = unlockGuide.config[picKey].url;
|
|
588
|
+
resources.push({
|
|
589
|
+
objectKey: picUrlPath,
|
|
590
|
+
});
|
|
591
|
+
}
|
|
592
|
+
if (unlockGuide.config[videoKey]) {
|
|
593
|
+
videoUrlPath = unlockGuide.config[videoKey].url;
|
|
594
|
+
resources.push({
|
|
595
|
+
objectKey: videoUrlPath,
|
|
596
|
+
});
|
|
597
|
+
}
|
|
598
|
+
if (resources.length === 0) {
|
|
599
|
+
return null;
|
|
600
|
+
}
|
|
601
|
+
const { signedUrls } = await getFileRemoteUrl({
|
|
602
|
+
biz: "hulk_video_tutorial_video",
|
|
603
|
+
resources,
|
|
604
|
+
});
|
|
605
|
+
const expireTime = Date.now() + 30 * 60 * 1000;
|
|
606
|
+
return {
|
|
607
|
+
videoUrl: signedUrls[videoUrlPath],
|
|
608
|
+
picUrl: signedUrls[picUrlPath],
|
|
609
|
+
expireTime,
|
|
610
|
+
};
|
|
611
|
+
}
|
|
612
|
+
return null;
|
|
613
|
+
};
|
package/lib/user.js
CHANGED
|
@@ -38,7 +38,7 @@ const concactUserList = (list, result) => {
|
|
|
38
38
|
let unlockDetails = unlockDetail.map((detail) => {
|
|
39
39
|
const unlockList = detail.unlockList.map((unlockItem) => {
|
|
40
40
|
return {
|
|
41
|
-
unlockId: unlockItem.unlockId.split("-")[1],
|
|
41
|
+
unlockId: +unlockItem.unlockId.split("-")[1],
|
|
42
42
|
unlockName: unlockItem.unlockName,
|
|
43
43
|
id: unlockItem.opModeId,
|
|
44
44
|
isBound: unlockItem.allocateFlag === 1,
|
|
@@ -145,7 +145,7 @@ export const updateUserLimitTime = async (params) => {
|
|
|
145
145
|
loopConfig: 0,
|
|
146
146
|
weeks: effective?.repeat !== "week" || effective?.weeks === undefined
|
|
147
147
|
? [0, 0, 0, 0, 0, 0, 0]
|
|
148
|
-
: effective.weeks,
|
|
148
|
+
: [...effective.weeks],
|
|
149
149
|
days: [],
|
|
150
150
|
startHour: Math.floor(effectiveTime / 60),
|
|
151
151
|
startMinute: effectiveTime % 60,
|
|
@@ -241,11 +241,8 @@ export const openFamilyUserDetail = async (userId) => {
|
|
|
241
241
|
const url = `tuyaSmart://member_info?homeId=${homeId}&memberId=${userId}&role=${role}`;
|
|
242
242
|
ty.router({
|
|
243
243
|
url: url,
|
|
244
|
-
success: (d) => {
|
|
245
|
-
console.log("openFamilyUserDetail success");
|
|
246
|
-
},
|
|
247
244
|
fail: (e) => {
|
|
248
|
-
console.
|
|
245
|
+
console.error("openFamilyUserDetail fail", e);
|
|
249
246
|
},
|
|
250
247
|
});
|
|
251
248
|
return;
|
package/lib/utils/errors.js
CHANGED
|
@@ -64,6 +64,7 @@ const errors = {
|
|
|
64
64
|
1063: "Password length only supports 4-6 digits",
|
|
65
65
|
1064: "Non-thread device, not supported in LAN connection to open and close locks",
|
|
66
66
|
1065: "Cloud side has been deleted, but device side synchronization deletion failed",
|
|
67
|
+
1066: "Phone number cannot be empty",
|
|
67
68
|
};
|
|
68
69
|
export const getError = (code, ...places) => {
|
|
69
70
|
if (errors[code]) {
|
package/lib/utils/index.js
CHANGED
|
@@ -258,18 +258,20 @@ onBackgroundFetchData(preFetchKeys, (res) => {
|
|
|
258
258
|
});
|
|
259
259
|
});
|
|
260
260
|
export const getDataWithPreFetch = async (key, apiCb) => {
|
|
261
|
-
if (
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
result
|
|
268
|
-
|
|
269
|
-
|
|
261
|
+
if (config.preFetch) {
|
|
262
|
+
if (preFetchData[key]) {
|
|
263
|
+
return preFetchData[key];
|
|
264
|
+
}
|
|
265
|
+
try {
|
|
266
|
+
const result = await getBackgroundFetchData([key]);
|
|
267
|
+
if (result &&
|
|
268
|
+
result.fetchedData[key] &&
|
|
269
|
+
result.fetchedData[key].fetchedData) {
|
|
270
|
+
return result.fetchedData[key].fetchedData;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
catch {
|
|
270
274
|
}
|
|
271
|
-
}
|
|
272
|
-
catch {
|
|
273
275
|
}
|
|
274
276
|
return apiCb();
|
|
275
277
|
};
|