@ray-js/lock-sdk 1.1.1-beta.3 → 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/interface.d.ts +2 -1
- package/lib/temporary.js +1 -1
- package/lib/unlock-method.d.ts +1 -0
- package/lib/unlock-method.js +9 -5
- package/lib/user.js +3 -6
- package/lib/utils/errors.js +1 -0
- package/package.json +1 -1
package/lib/interface.d.ts
CHANGED
|
@@ -82,7 +82,7 @@ export interface CurrentUser {
|
|
|
82
82
|
permanent: boolean;
|
|
83
83
|
}
|
|
84
84
|
export interface UnlockMethodBaseInfo {
|
|
85
|
-
unlockId:
|
|
85
|
+
unlockId: number;
|
|
86
86
|
unlockName: string;
|
|
87
87
|
isBound: boolean;
|
|
88
88
|
id: number;
|
|
@@ -144,6 +144,7 @@ export type DpMapDataType<T extends DpMapType> = {
|
|
|
144
144
|
};
|
|
145
145
|
export interface NotifyInfo {
|
|
146
146
|
appSend?: boolean;
|
|
147
|
+
msgSend?: boolean;
|
|
147
148
|
msgPhone?: string;
|
|
148
149
|
countryCode?: string;
|
|
149
150
|
}
|
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
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;
|
package/lib/unlock-method.js
CHANGED
|
@@ -42,6 +42,7 @@ export const getUnlockMethodDetail = async (id) => {
|
|
|
42
42
|
userType: cloudData.userType,
|
|
43
43
|
notifyInfo: {
|
|
44
44
|
appSend: !!cloudData.notifyInfo?.appSend,
|
|
45
|
+
msgSend: !!cloudData.notifyInfo?.msgPhone,
|
|
45
46
|
msgPhone: cloudData.notifyInfo?.msgPhone,
|
|
46
47
|
countryCode: cloudData.notifyInfo?.countryCode,
|
|
47
48
|
},
|
|
@@ -105,11 +106,14 @@ const checkSpecial = (isSpecial, params, oldSetting) => {
|
|
|
105
106
|
if (!supportedPhone) {
|
|
106
107
|
throw getError(1057);
|
|
107
108
|
}
|
|
108
|
-
else if (!params?.
|
|
109
|
+
else if (!params?.msgSend) {
|
|
109
110
|
throw getError(1058);
|
|
110
111
|
}
|
|
111
112
|
}
|
|
112
|
-
if (supportedPhone && params?.
|
|
113
|
+
if (supportedPhone && params?.msgSend) {
|
|
114
|
+
if (!params.msgPhone) {
|
|
115
|
+
throw getError(1066);
|
|
116
|
+
}
|
|
113
117
|
if (!params.countryCode) {
|
|
114
118
|
throw getError(1056);
|
|
115
119
|
}
|
|
@@ -122,9 +126,9 @@ const checkSpecial = (isSpecial, params, oldSetting) => {
|
|
|
122
126
|
unlockAttr: isSpecial ? 1 : 0,
|
|
123
127
|
notifyInfo: {
|
|
124
128
|
appSend: !!params?.appSend,
|
|
125
|
-
msgPhone: supportedPhone ? params?.msgPhone : undefined,
|
|
126
|
-
countryCode: supportedPhone ? params?.countryCode : undefined,
|
|
127
|
-
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,
|
|
128
132
|
},
|
|
129
133
|
};
|
|
130
134
|
};
|
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]) {
|