@ray-js/lock-sdk 1.2.0-beta.9 → 1.2.0

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.
Files changed (231) hide show
  1. package/lib/api/fit.d.ts +55 -2
  2. package/lib/api/fit.js +43 -1
  3. package/lib/api/gesture.d.ts +11 -0
  4. package/lib/api/gesture.js +18 -0
  5. package/lib/api/log.d.ts +52 -4
  6. package/lib/api/log.js +22 -0
  7. package/lib/api/temp.d.ts +21 -0
  8. package/lib/api/temp.js +24 -0
  9. package/lib/config/dp-code/index.d.ts +1 -1
  10. package/lib/config/dp-code/index.js +1 -0
  11. package/lib/entries/main/bootstrap/bootstrap-lock-instance.d.ts +2 -1
  12. package/lib/entries/main/bootstrap/bootstrap-lock-instance.js +23 -8
  13. package/lib/entries/main/bootstrap/bootstrap.d.ts +3 -2
  14. package/lib/entries/main/bootstrap/bootstrap.js +10 -6
  15. package/lib/entries/main/bootstrap/primary-instance.d.ts +1 -2
  16. package/lib/entries/main/bootstrap/primary-instance.js +1 -1
  17. package/lib/entries/main/bootstrap/resolve-runtime-from-export-this.js +1 -1
  18. package/lib/entries/main/build-instance.d.ts +6 -3
  19. package/lib/entries/main/build-instance.js +13 -1
  20. package/lib/entries/main/exports/capability.d.ts +2 -0
  21. package/lib/entries/main/exports/capability.js +7 -1
  22. package/lib/entries/main/exports/fit-sdk/binding.d.ts +10 -0
  23. package/lib/entries/{fit/exports → main/exports/fit-sdk}/binding.js +6 -3
  24. package/lib/entries/{fit/exports → main/exports/fit-sdk}/device.d.ts +11 -10
  25. package/lib/entries/{fit/exports → main/exports/fit-sdk}/device.js +20 -20
  26. package/lib/entries/{fit/exports → main/exports/fit-sdk}/index.d.ts +1 -0
  27. package/lib/entries/{fit/exports → main/exports/fit-sdk}/index.js +1 -0
  28. package/lib/entries/main/exports/fit-sdk/log.d.ts +3 -0
  29. package/lib/entries/main/exports/fit-sdk/log.js +5 -0
  30. package/lib/entries/main/exports/fit-sdk/temp.d.ts +40 -0
  31. package/lib/entries/main/exports/fit-sdk/temp.js +59 -0
  32. package/lib/entries/main/exports/gesture.d.ts +6 -0
  33. package/lib/entries/main/exports/gesture.js +8 -0
  34. package/lib/entries/main/exports/index.d.ts +5 -0
  35. package/lib/entries/main/exports/index.js +5 -0
  36. package/lib/entries/main/exports/log.d.ts +2 -0
  37. package/lib/entries/main/exports/log.js +7 -1
  38. package/lib/entries/main/exports/misc.d.ts +4 -2
  39. package/lib/entries/main/exports/misc.js +2 -2
  40. package/lib/entries/main/index.d.ts +3 -3
  41. package/lib/entries/main/index.js +11 -5
  42. package/lib/feature/fit/bind-lock-to-fit.d.ts +1 -0
  43. package/lib/feature/fit/bind-lock-to-fit.js +53 -0
  44. package/lib/feature/fit/ble-key.d.ts +10 -4
  45. package/lib/feature/fit/ble-key.js +145 -4
  46. package/lib/feature/fit/device-bv.d.ts +2 -0
  47. package/lib/feature/fit/device-bv.js +15 -0
  48. package/lib/feature/fit/invalid-password.d.ts +10 -0
  49. package/lib/feature/fit/invalid-password.js +43 -0
  50. package/lib/feature/fit/list.d.ts +12 -2
  51. package/lib/feature/fit/list.js +54 -5
  52. package/lib/feature/fit/log.d.ts +7 -0
  53. package/lib/feature/fit/log.js +123 -0
  54. package/lib/feature/fit/method/add-flow.js +2 -2
  55. package/lib/feature/fit/method/add-password.js +2 -2
  56. package/lib/feature/fit/method/update-remove.js +40 -14
  57. package/lib/feature/fit/password-list.d.ts +37 -0
  58. package/lib/feature/fit/password-list.js +44 -1
  59. package/lib/feature/fit/security-channel.d.ts +3 -0
  60. package/lib/feature/fit/security-channel.js +43 -0
  61. package/lib/feature/fit/shared.d.ts +8 -0
  62. package/lib/feature/fit/shared.js +40 -1
  63. package/lib/feature/fit/sync.d.ts +4 -2
  64. package/lib/feature/fit/sync.js +63 -22
  65. package/lib/feature/fit/temp-password.d.ts +23 -0
  66. package/lib/feature/fit/temp-password.js +95 -3
  67. package/lib/feature/fit/users.d.ts +1 -0
  68. package/lib/feature/fit/users.js +1 -0
  69. package/lib/feature/gesture/gesture.d.ts +6 -0
  70. package/lib/feature/gesture/gesture.js +3 -0
  71. package/lib/feature/log/log.d.ts +5 -1
  72. package/lib/feature/log/log.js +53 -6
  73. package/lib/feature/misc/ble-control.js +2 -2
  74. package/lib/feature/misc/capability.d.ts +2 -0
  75. package/lib/feature/misc/capability.js +33 -31
  76. package/lib/feature/misc/connect-device.d.ts +1 -1
  77. package/lib/feature/misc/connect-device.js +7 -6
  78. package/lib/feature/misc/is-use-near-channel-for-runtime.js +8 -1
  79. package/lib/feature/password/temporary/offline-create.d.ts +14 -0
  80. package/lib/feature/password/temporary/offline-create.js +77 -1
  81. package/lib/feature/service/goto-service.d.ts +1 -1
  82. package/lib/feature/state/clear.js +1 -0
  83. package/lib/feature/state/device-status.js +17 -6
  84. package/lib/feature/state/init-state.js +17 -9
  85. package/lib/feature/state/platform-routing.js +12 -3
  86. package/lib/feature/state/remote-permissions.js +2 -1
  87. package/lib/feature/state/sync/remote-serect-key.js +7 -0
  88. package/lib/feature/storage/swr-cache.d.ts +7 -0
  89. package/lib/feature/storage/swr-cache.js +54 -0
  90. package/lib/feature/unlock/method/add-flow.js +2 -2
  91. package/lib/feature/unlock/method/add-password.js +2 -2
  92. package/lib/feature/user/sync-user.js +4 -2
  93. package/lib/feature/utils/index.d.ts +1 -0
  94. package/lib/feature/utils/index.js +1 -0
  95. package/lib/interface.d.ts +23 -1
  96. package/lib/platform/device.d.ts +4 -3
  97. package/lib/platform/ipc.d.ts +3 -0
  98. package/lib/platform/ipc.js +13 -0
  99. package/lib/platform/storage.d.ts +1 -1
  100. package/lib/runtime/LockDeviceRuntime.js +3 -0
  101. package/lib/runtime/lock-config.d.ts +3 -0
  102. package/lib/runtime/lock-config.js +5 -0
  103. package/lib/runtime/runtime-state-types.d.ts +6 -0
  104. package/lib/utils/constant.d.ts +1 -0
  105. package/lib/utils/constant.js +6 -0
  106. package/lib/utils/index.d.ts +2 -1
  107. package/lib/utils/index.js +1 -0
  108. package/package.json +1 -11
  109. package/lib/bootstrap/bootstrap-lock-instance.d.ts +0 -7
  110. package/lib/bootstrap/bootstrap-lock-instance.js +0 -16
  111. package/lib/bootstrap/bootstrap.d.ts +0 -4
  112. package/lib/bootstrap/bootstrap.js +0 -53
  113. package/lib/bootstrap/lock-instance-runtime-ref.d.ts +0 -3
  114. package/lib/bootstrap/lock-instance-runtime-ref.js +0 -7
  115. package/lib/bootstrap/primary-instance.d.ts +0 -6
  116. package/lib/bootstrap/primary-instance.js +0 -24
  117. package/lib/bootstrap/resolve-runtime-from-export-this.d.ts +0 -5
  118. package/lib/bootstrap/resolve-runtime-from-export-this.js +0 -29
  119. package/lib/bootstrap/top-level-runtime.d.ts +0 -2
  120. package/lib/bootstrap/top-level-runtime.js +0 -9
  121. package/lib/entries/ble/bootstrap/bootstrap-lock-instance.d.ts +0 -7
  122. package/lib/entries/ble/bootstrap/bootstrap-lock-instance.js +0 -12
  123. package/lib/entries/ble/bootstrap/bootstrap.d.ts +0 -4
  124. package/lib/entries/ble/bootstrap/bootstrap.js +0 -53
  125. package/lib/entries/ble/bootstrap/lock-instance-runtime-ref.d.ts +0 -3
  126. package/lib/entries/ble/bootstrap/lock-instance-runtime-ref.js +0 -7
  127. package/lib/entries/ble/bootstrap/primary-instance.d.ts +0 -6
  128. package/lib/entries/ble/bootstrap/primary-instance.js +0 -24
  129. package/lib/entries/ble/bootstrap/resolve-runtime-from-export-this.d.ts +0 -5
  130. package/lib/entries/ble/bootstrap/resolve-runtime-from-export-this.js +0 -29
  131. package/lib/entries/ble/bootstrap/top-level-runtime.d.ts +0 -2
  132. package/lib/entries/ble/bootstrap/top-level-runtime.js +0 -9
  133. package/lib/entries/ble/build-instance.d.ts +0 -9
  134. package/lib/entries/ble/build-instance.js +0 -50
  135. package/lib/entries/ble/exports/capability.d.ts +0 -6
  136. package/lib/entries/ble/exports/capability.js +0 -17
  137. package/lib/entries/ble/exports/config.d.ts +0 -3
  138. package/lib/entries/ble/exports/config.js +0 -5
  139. package/lib/entries/ble/exports/dp.d.ts +0 -9
  140. package/lib/entries/ble/exports/dp.js +0 -13
  141. package/lib/entries/ble/exports/index.d.ts +0 -16
  142. package/lib/entries/ble/exports/index.js +0 -16
  143. package/lib/entries/ble/exports/linkage.d.ts +0 -5
  144. package/lib/entries/ble/exports/linkage.js +0 -15
  145. package/lib/entries/ble/exports/log.d.ts +0 -9
  146. package/lib/entries/ble/exports/log.js +0 -21
  147. package/lib/entries/ble/exports/media.d.ts +0 -4
  148. package/lib/entries/ble/exports/media.js +0 -12
  149. package/lib/entries/ble/exports/misc.d.ts +0 -19
  150. package/lib/entries/ble/exports/misc.js +0 -30
  151. package/lib/entries/ble/exports/offline-dps.d.ts +0 -8
  152. package/lib/entries/ble/exports/offline-dps.js +0 -24
  153. package/lib/entries/ble/exports/open/do-open-close-action.d.ts +0 -2
  154. package/lib/entries/ble/exports/open/do-open-close-action.js +0 -36
  155. package/lib/entries/ble/exports/open/index.d.ts +0 -18
  156. package/lib/entries/ble/exports/open/index.js +0 -45
  157. package/lib/entries/ble/exports/signal.d.ts +0 -6
  158. package/lib/entries/ble/exports/signal.js +0 -14
  159. package/lib/entries/ble/exports/sleep.d.ts +0 -13
  160. package/lib/entries/ble/exports/sleep.js +0 -31
  161. package/lib/entries/ble/exports/state.d.ts +0 -6
  162. package/lib/entries/ble/exports/state.js +0 -19
  163. package/lib/entries/ble/exports/temporary.d.ts +0 -31
  164. package/lib/entries/ble/exports/temporary.js +0 -91
  165. package/lib/entries/ble/exports/unlock/sync.d.ts +0 -1
  166. package/lib/entries/ble/exports/unlock/sync.js +0 -5
  167. package/lib/entries/ble/exports/unlock-method.d.ts +0 -19
  168. package/lib/entries/ble/exports/unlock-method.js +0 -58
  169. package/lib/entries/ble/exports/user/index.d.ts +0 -23
  170. package/lib/entries/ble/exports/user/index.js +0 -22
  171. package/lib/entries/ble/exports/user/sync.d.ts +0 -1
  172. package/lib/entries/ble/exports/user/sync.js +0 -5
  173. package/lib/entries/ble/index.d.ts +0 -8
  174. package/lib/entries/ble/index.js +0 -39
  175. package/lib/entries/fit/bootstrap/bootstrap-lock-instance.d.ts +0 -7
  176. package/lib/entries/fit/bootstrap/bootstrap-lock-instance.js +0 -12
  177. package/lib/entries/fit/bootstrap/bootstrap.d.ts +0 -4
  178. package/lib/entries/fit/bootstrap/bootstrap.js +0 -69
  179. package/lib/entries/fit/bootstrap/lock-instance-runtime-ref.d.ts +0 -3
  180. package/lib/entries/fit/bootstrap/lock-instance-runtime-ref.js +0 -7
  181. package/lib/entries/fit/bootstrap/primary-instance.d.ts +0 -6
  182. package/lib/entries/fit/bootstrap/primary-instance.js +0 -24
  183. package/lib/entries/fit/bootstrap/resolve-runtime-from-export-this.d.ts +0 -5
  184. package/lib/entries/fit/bootstrap/resolve-runtime-from-export-this.js +0 -29
  185. package/lib/entries/fit/bootstrap/top-level-runtime.d.ts +0 -2
  186. package/lib/entries/fit/bootstrap/top-level-runtime.js +0 -9
  187. package/lib/entries/fit/build-instance.d.ts +0 -9
  188. package/lib/entries/fit/build-instance.js +0 -57
  189. package/lib/entries/fit/exports/binding.d.ts +0 -8
  190. package/lib/entries/fit/exports/temp.d.ts +0 -19
  191. package/lib/entries/fit/exports/temp.js +0 -18
  192. package/lib/entries/fit/index.d.ts +0 -8
  193. package/lib/entries/fit/index.js +0 -36
  194. package/lib/entries/main/exports/open.d.ts +0 -16
  195. package/lib/entries/main/exports/open.js +0 -44
  196. package/lib/entries/screen/bootstrap/bootstrap-lock-instance.d.ts +0 -7
  197. package/lib/entries/screen/bootstrap/bootstrap-lock-instance.js +0 -12
  198. package/lib/entries/screen/bootstrap/bootstrap.d.ts +0 -4
  199. package/lib/entries/screen/bootstrap/bootstrap.js +0 -69
  200. package/lib/entries/screen/bootstrap/lock-instance-runtime-ref.d.ts +0 -3
  201. package/lib/entries/screen/bootstrap/lock-instance-runtime-ref.js +0 -7
  202. package/lib/entries/screen/bootstrap/primary-instance.d.ts +0 -6
  203. package/lib/entries/screen/bootstrap/primary-instance.js +0 -24
  204. package/lib/entries/screen/bootstrap/resolve-runtime-from-export-this.d.ts +0 -5
  205. package/lib/entries/screen/bootstrap/resolve-runtime-from-export-this.js +0 -29
  206. package/lib/entries/screen/bootstrap/top-level-runtime.d.ts +0 -2
  207. package/lib/entries/screen/bootstrap/top-level-runtime.js +0 -9
  208. package/lib/entries/screen/build-instance.d.ts +0 -9
  209. package/lib/entries/screen/build-instance.js +0 -57
  210. package/lib/entries/screen/exports/bind-events.d.ts +0 -4
  211. package/lib/entries/screen/exports/bind-events.js +0 -8
  212. package/lib/entries/screen/exports/binding.d.ts +0 -6
  213. package/lib/entries/screen/exports/binding.js +0 -15
  214. package/lib/entries/screen/exports/device.d.ts +0 -16
  215. package/lib/entries/screen/exports/device.js +0 -41
  216. package/lib/entries/screen/exports/event.d.ts +0 -3
  217. package/lib/entries/screen/exports/event.js +0 -5
  218. package/lib/entries/screen/exports/index.d.ts +0 -5
  219. package/lib/entries/screen/exports/index.js +0 -5
  220. package/lib/entries/screen/exports/user.d.ts +0 -2
  221. package/lib/entries/screen/exports/user.js +0 -8
  222. package/lib/entries/screen/index.d.ts +0 -8
  223. package/lib/entries/screen/index.js +0 -36
  224. package/lib/feature/unlock/door/door-action.d.ts +0 -2
  225. package/lib/feature/unlock/door/door-action.js +0 -32
  226. package/lib/fit.d.ts +0 -4
  227. package/lib/fit.js +0 -3
  228. package/lib/runtime/device-status/compute-device-status.d.ts +0 -25
  229. package/lib/runtime/device-status/compute-device-status.js +0 -94
  230. package/lib/screen.d.ts +0 -4
  231. package/lib/screen.js +0 -3
@@ -3,10 +3,12 @@ import { deleteUserForRuntime } from "./delete-user-dp";
3
3
  import { isUseNearChannelForRuntime } from "../misc/is-use-near-channel-for-runtime";
4
4
  import { publishDpsOnlyWithRuntime, } from "../dp/publish-dps";
5
5
  import dpCodes from "../../config/dp-code";
6
- import { isBlePureDeviceForRuntime } from "../misc/capability";
6
+ import { hasCapabilityForRuntime, isBlePureDeviceForRuntime } from "../misc/capability";
7
7
  import { sdkLog } from "../../utils/sdk-log";
8
+ import { ProductCommunicationType } from "../../constant";
8
9
  export async function syncDeleteUsersWithRuntime(runtime) {
9
- if (runtime.config.devInfo.wifiEnableState !== 1) {
10
+ const hasWifi = hasCapabilityForRuntime(runtime, ProductCommunicationType.WIFI);
11
+ if (hasWifi && runtime.config.devInfo.wifiEnableState !== 1) {
10
12
  sdkLog("debug", "syncUser", "deleteUsersSkipped", {
11
13
  devId: runtime.devId,
12
14
  data: { reason: "wifiActive" },
@@ -1,5 +1,6 @@
1
1
  import type { UnlockMethodConfig } from "../../interface";
2
2
  import type { LockDeviceRuntime } from "../../runtime/LockDeviceRuntime";
3
+ export declare const unlockMethodDpCodes: string[];
3
4
  export declare const getUnlockMethodTypeByDpCodeForRuntime: (rt: LockDeviceRuntime, dpCode: string) => UnlockMethodConfig;
4
5
  export declare const getUnlockMethodTypeByIdForRuntime: (rt: LockDeviceRuntime, id: number | string) => UnlockMethodConfig;
5
6
  export declare const getUnlockMethodTypeByTypeForRuntime: (rt: LockDeviceRuntime, type: string) => UnlockMethodConfig;
@@ -33,6 +33,7 @@ const unlockMethodConfigs = [
33
33
  id: 6,
34
34
  },
35
35
  ];
36
+ export const unlockMethodDpCodes = unlockMethodConfigs.reduce((res, item) => res.concat(item.codes), []);
36
37
  const getUnlockMethodTypeForRuntime = (rt, cb) => {
37
38
  const result = unlockMethodConfigs.find(cb);
38
39
  if (result) {
@@ -12,9 +12,12 @@ export interface LockSDKOption {
12
12
  supportMultipleFace?: boolean;
13
13
  supportOfflineDps?: boolean;
14
14
  preFetch?: boolean;
15
+ localCache?: boolean;
16
+ notSupportWake?: boolean;
15
17
  logLevel?: SDKLogLevel;
16
18
  logger?: SDKLogSink;
17
19
  logToConsole?: boolean;
20
+ kind?: "lock" | "fit" | "screen";
18
21
  }
19
22
  export interface ErrorData {
20
23
  errorCode: number;
@@ -180,6 +183,16 @@ export interface EffectiveConfig {
180
183
  effectiveTime?: number;
181
184
  expiredTime?: number;
182
185
  }
186
+ export interface FitBleKeyItem {
187
+ id: string;
188
+ unlockBindingId: string;
189
+ name: string;
190
+ opModeSubType?: number;
191
+ effectiveConfig: EffectiveConfig;
192
+ sn?: number;
193
+ userName?: string;
194
+ devNameList?: string[];
195
+ }
183
196
  export interface UnBindUnlockMethod {
184
197
  dpId: number;
185
198
  dpCode: string;
@@ -204,6 +217,8 @@ export interface DeviceStatus {
204
217
  };
205
218
  isWifiActive: boolean;
206
219
  isWifiMatter: boolean;
220
+ isActiveThread: boolean;
221
+ isShareThread: boolean;
207
222
  }
208
223
  export interface UnionUnlockInfo {
209
224
  userId: string;
@@ -254,6 +269,11 @@ export interface MediaInfo {
254
269
  fileUrl: string;
255
270
  mediaBucket: string;
256
271
  mediaKey: string;
272
+ width: number;
273
+ height: number;
274
+ angle: number;
275
+ position: number;
276
+ isVR: boolean;
257
277
  }
258
278
  export type LogType = "alarm_record" | "close_record" | "unlock_record" | "operation" | "local_operation";
259
279
  export type CloseValue = "UNDEFINED" | "VOICE_REMOTE" | "APP_REMOTE" | "AUTO" | "LOCAL_MANUAL" | "FITTINGS" | "APP" | "GEO_FENCE";
@@ -269,6 +289,8 @@ export interface LogData {
269
289
  dpCode: string;
270
290
  data: any;
271
291
  userName: string;
292
+ avatarUrl?: string;
293
+ relateDevName?: string;
272
294
  bindable: boolean;
273
295
  unlockName: string;
274
296
  mediaInfo?: MediaInfo[];
@@ -407,6 +429,6 @@ export interface CameraConfig {
407
429
  width: number;
408
430
  height: number;
409
431
  rotate: number;
410
- localtion: number;
432
+ location: number;
411
433
  }
412
434
  export {};
@@ -52,7 +52,7 @@ export declare const getSystemInfoSync: () => {
52
52
  locationEnabled: boolean;
53
53
  wifiEnabled: boolean;
54
54
  theme?: ty.Themes;
55
- deviceOrientation?: ty.Orientation;
55
+ deviceOrientation?: ty.PhoneOrientation;
56
56
  deviceLevel: string;
57
57
  isSupportPinShortcut?: boolean;
58
58
  deviceType?: string;
@@ -74,9 +74,10 @@ export declare const requestCloud: <T>(options: {
74
74
  export declare const getLaunchOptionsSync: () => {
75
75
  path: string;
76
76
  scene?: ty.MiniAppScene;
77
- query: any;
77
+ query: Record<string, any>;
78
78
  referrerInfo: ty.ReferrerInfo;
79
79
  apiCategory?: string;
80
+ extraQuery?: Record<string, any>;
80
81
  };
81
82
  export declare function encrypt(deviceId: string, plaintext: string): Promise<string>;
82
83
  export declare function decrypt(deviceId: string, plaintext: string): Promise<string>;
@@ -219,7 +220,7 @@ export declare const onResetMemberName: (cb: HomeMemberListener) => void;
219
220
  export declare const offResetMemberName: (cb: HomeMemberListener) => void;
220
221
  export declare const onResetMemberRole: (cb: HomeMemberListener) => void;
221
222
  export declare const offResetMemberRole: (cb: HomeMemberListener) => void;
222
- export declare const getLogManager: () => ty.GetLogManagerTask;
223
+ export declare const getLogManager: () => ty.LogManager;
223
224
  export declare const getAppUserInfo: () => Promise<{
224
225
  nickName: string;
225
226
  avatarUrl: string;
@@ -10,5 +10,8 @@ declare const _default: {
10
10
  getCurrentSupportedTalkMode: (deviceId: string) => Promise<{
11
11
  talkbackMode: number;
12
12
  }>;
13
+ getTTTAbilityKeyList: (key: string) => Promise<{
14
+ abilityList: string[];
15
+ }>;
13
16
  };
14
17
  export default _default;
@@ -31,10 +31,23 @@ const getCurrentSupportedTalkMode = (deviceId) => {
31
31
  }
32
32
  return Promise.reject(new Error("not support"));
33
33
  };
34
+ const getTTTAbilityKeyList = (key) => {
35
+ if (ty.ipc.getTTTAbilityKeyList) {
36
+ return new Promise((resolve, reject) => {
37
+ ty.ipc.getTTTAbilityKeyList({
38
+ key,
39
+ success: resolve,
40
+ fail: reject,
41
+ });
42
+ });
43
+ }
44
+ return Promise.resolve({ abilityList: [] });
45
+ };
34
46
  export default {
35
47
  wakeUpDoorBell,
36
48
  isConnected,
37
49
  isConnecting,
38
50
  connect,
39
51
  getCurrentSupportedTalkMode,
52
+ getTTTAbilityKeyList,
40
53
  };
@@ -1,3 +1,3 @@
1
- export declare const setStorageSync: (key: string, data: unknown) => void;
1
+ export declare const setStorageSync: (key: string, data: string) => void;
2
2
  export declare const getStorageSync: (key: string) => any;
3
3
  export declare const removeStorageSync: (key: string) => void;
@@ -14,6 +14,7 @@ export class LockDeviceRuntime {
14
14
  offlineDpCache: undefined,
15
15
  isActiveThreadCache: false,
16
16
  deviceAdvanceAbilityCache: undefined,
17
+ fitDeviceBvCache: undefined,
17
18
  };
18
19
  this.sync = {
19
20
  hasSyncedT0: false,
@@ -21,6 +22,8 @@ export class LockDeviceRuntime {
21
22
  unlockMethodAutoSyncEnabled: true,
22
23
  tempAutoSyncEnabled: true,
23
24
  tempPayloadSyncing: false,
25
+ fitSyncReportHandler: null,
26
+ fitBindingsSyncStarted: false,
24
27
  };
25
28
  this.infra = {
26
29
  eventsRegistered: false,
@@ -21,9 +21,12 @@ export type LockConfigState = {
21
21
  supportMultipleFace: boolean;
22
22
  supportOfflineDps: boolean;
23
23
  preFetch: boolean;
24
+ localCache: boolean;
24
25
  supportTalk: boolean;
25
26
  isTwoWayTalk: boolean;
26
27
  cameraConfig: CameraConfig[];
28
+ notSupportWake: boolean;
29
+ isFitting: boolean;
27
30
  };
28
31
  export declare function createDefaultDeviceStatus(): DeviceStatus;
29
32
  export declare function createLockConfigState(): LockConfigState;
@@ -7,6 +7,8 @@ export function createDefaultDeviceStatus() {
7
7
  onlineTypes: [],
8
8
  isWifiActive: false,
9
9
  isWifiMatter: false,
10
+ isActiveThread: false,
11
+ isShareThread: false,
10
12
  };
11
13
  }
12
14
  export function createLockConfigState() {
@@ -31,8 +33,11 @@ export function createLockConfigState() {
31
33
  supportMultipleFace: false,
32
34
  supportOfflineDps: false,
33
35
  preFetch: false,
36
+ localCache: true,
34
37
  supportTalk: false,
35
38
  isTwoWayTalk: false,
36
39
  cameraConfig: [],
40
+ notSupportWake: false,
41
+ isFitting: false
37
42
  };
38
43
  }
@@ -5,6 +5,7 @@ export interface LockRuntimeCacheFields {
5
5
  offlineDpCache: OfflineDps | undefined;
6
6
  isActiveThreadCache: boolean;
7
7
  deviceAdvanceAbilityCache: DeviceAdvancedAbility | undefined;
8
+ fitDeviceBvCache: Promise<number> | undefined;
8
9
  }
9
10
  export interface LockRuntimeSyncFlags {
10
11
  hasSyncedT0: boolean;
@@ -12,6 +13,11 @@ export interface LockRuntimeSyncFlags {
12
13
  unlockMethodAutoSyncEnabled: boolean;
13
14
  tempAutoSyncEnabled: boolean;
14
15
  tempPayloadSyncing: boolean;
16
+ fitSyncReportHandler: ((data: {
17
+ deviceId?: string;
18
+ data?: string;
19
+ }) => void) | null;
20
+ fitBindingsSyncStarted: boolean;
15
21
  }
16
22
  export interface LockRuntimeInfraFields {
17
23
  eventsRegistered: boolean;
@@ -12,3 +12,4 @@ export declare enum LoopTypes {
12
12
  WEEK = 2,
13
13
  MONTH = 3
14
14
  }
15
+ export declare const cameraPositionMap: Record<number, number>;
@@ -14,3 +14,9 @@ export var LoopTypes;
14
14
  LoopTypes[LoopTypes["WEEK"] = 2] = "WEEK";
15
15
  LoopTypes[LoopTypes["MONTH"] = 3] = "MONTH";
16
16
  })(LoopTypes || (LoopTypes = {}));
17
+ export const cameraPositionMap = {
18
+ 0: 4,
19
+ 1: 3,
20
+ 2: 5,
21
+ 3: 6,
22
+ };
@@ -32,7 +32,7 @@ export declare const getSystemInfo: () => {
32
32
  locationEnabled: boolean;
33
33
  wifiEnabled: boolean;
34
34
  theme?: ty.Themes;
35
- deviceOrientation?: ty.Orientation;
35
+ deviceOrientation?: ty.PhoneOrientation;
36
36
  deviceLevel: string;
37
37
  isSupportPinShortcut?: boolean;
38
38
  deviceType?: string;
@@ -121,6 +121,7 @@ export declare function getCapabilities(capability: number): ({
121
121
  readonly short: "thread";
122
122
  })[];
123
123
  export declare const formatWeek: (value: number[]) => number;
124
+ export declare const formatCloudUnlockId: (dpId: number | string, sn: number) => string;
124
125
  export declare const parseWeek: (value: number) => Week;
125
126
  export declare const getPermanentSetting: () => {
126
127
  startTime: number;
@@ -56,6 +56,7 @@ export const formatWeek = (value) => {
56
56
  const temp = value.slice(0, 7);
57
57
  return parseInt(temp.reverse().join(""), 2);
58
58
  };
59
+ export const formatCloudUnlockId = (dpId, sn) => `${dpId}-${sn.toString(16).padStart(2, "0")}`;
59
60
  export const parseWeek = (value) => {
60
61
  return Number(value)
61
62
  .toString(2)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/lock-sdk",
3
- "version": "1.2.0-beta.9",
3
+ "version": "1.2.0",
4
4
  "files": [
5
5
  "lib",
6
6
  "LICENSE.md"
@@ -12,16 +12,6 @@
12
12
  "types": "./lib/index.d.ts",
13
13
  "import": "./lib/index.js",
14
14
  "default": "./lib/index.js"
15
- },
16
- "./fit": {
17
- "types": "./lib/fit.d.ts",
18
- "import": "./lib/fit.js",
19
- "default": "./lib/fit.js"
20
- },
21
- "./screen": {
22
- "types": "./lib/screen.d.ts",
23
- "import": "./lib/screen.js",
24
- "default": "./lib/screen.js"
25
15
  }
26
16
  },
27
17
  "scripts": {
@@ -1,7 +0,0 @@
1
- import type { LockSDKOption } from "../interface";
2
- import type { LockDeviceRuntime } from "../runtime/LockDeviceRuntime";
3
- import { type LockSDKInstance } from "../entries/main/build-instance";
4
- export declare function bootstrapRegisteredLockInstance(options?: LockSDKOption): Promise<{
5
- runtime: LockDeviceRuntime;
6
- instance: LockSDKInstance;
7
- }>;
@@ -1,16 +0,0 @@
1
- import { addEvents } from "../feature/state/platform-routing";
2
- import { initState } from "../feature/state/init-state";
3
- import { registerRuntime } from "../runtime/registry";
4
- import { buildLockSDKInstance, } from "../entries/main/build-instance";
5
- import * as MainDeviceExports from "../entries/main/exports";
6
- import { createBootstrappedRuntime } from "./bootstrap";
7
- export async function bootstrapRegisteredLockInstance(options) {
8
- const runtime = await createBootstrappedRuntime(options);
9
- registerRuntime(runtime);
10
- addEvents(runtime);
11
- await initState(runtime);
12
- return {
13
- runtime,
14
- instance: buildLockSDKInstance(runtime, MainDeviceExports),
15
- };
16
- }
@@ -1,4 +0,0 @@
1
- import type { LockSDKOption } from "../interface";
2
- import { LockDeviceRuntime } from "../runtime/LockDeviceRuntime";
3
- export declare function applyLockOptionsToRuntime(runtime: LockDeviceRuntime, options?: LockSDKOption): Promise<void>;
4
- export declare function createBootstrappedRuntime(options?: LockSDKOption): Promise<LockDeviceRuntime>;
@@ -1,53 +0,0 @@
1
- import dpCodes from "../config/dp-code";
2
- import { getCapabilities } from "../utils";
3
- import { getDeviceInfo, trackEvent } from "../platform/device";
4
- import { LockDeviceRuntime } from "../runtime/LockDeviceRuntime";
5
- export async function applyLockOptionsToRuntime(runtime, options) {
6
- const { config } = runtime;
7
- let { devInfo, deviceId } = options || {};
8
- if (!devInfo && !deviceId) {
9
- throw new Error("deviceId is required in lock sdk");
10
- }
11
- if (deviceId && (!devInfo || devInfo.devId !== deviceId)) {
12
- devInfo = await getDeviceInfo(deviceId);
13
- }
14
- let dpSchema = {};
15
- const codesById = {};
16
- const idsByCode = {};
17
- if (devInfo.schema) {
18
- dpSchema = devInfo.schema.reduce((acc, cur) => {
19
- acc[cur.code] = cur;
20
- codesById[cur.id] = cur.code;
21
- idsByCode[cur.code] = cur.id;
22
- return acc;
23
- }, {});
24
- }
25
- else if (devInfo.dpSchema) {
26
- dpSchema = devInfo.dpSchema;
27
- Object.keys(dpSchema).forEach((key) => {
28
- const item = dpSchema[key];
29
- codesById[item.id] = item.code;
30
- idsByCode[item.code] = item.id;
31
- });
32
- }
33
- config.strictMode = options?.strictMode ?? true;
34
- config.passwordDigitalBase = options?.passwordDigitalBase ?? 10;
35
- config.passwordSupportZero = options?.passwordSupportZero ?? true;
36
- config.supportMultipleFace = options?.supportMultipleFace ?? false;
37
- config.supportOfflineDps = options?.supportOfflineDps ?? false;
38
- config.devInfo = devInfo;
39
- config.dpSchema = dpSchema;
40
- config.codesById = codesById;
41
- config.idsByCode = idsByCode;
42
- config.supportBigData = !!dpSchema[dpCodes.synchMethodW];
43
- config.preFetch = options?.preFetch ?? false;
44
- config.communication = getCapabilities(devInfo.capability).map((item) => item.id);
45
- trackEvent("t$y_UztB3Lj9Qns375R0r7dA0L5Kr2VytH3J".replace("$", ""), {
46
- pid: devInfo.productId,
47
- });
48
- }
49
- export async function createBootstrappedRuntime(options) {
50
- const runtime = new LockDeviceRuntime();
51
- await applyLockOptionsToRuntime(runtime, options);
52
- return runtime;
53
- }
@@ -1,3 +0,0 @@
1
- import type { LockDeviceRuntime } from "../runtime/LockDeviceRuntime";
2
- export declare function registerLockSDKInstanceRuntime(instance: object, runtime: LockDeviceRuntime): void;
3
- export declare function getRuntimeForLockSDKInstance(instance: object): LockDeviceRuntime | undefined;
@@ -1,7 +0,0 @@
1
- const runtimeByInstance = new WeakMap();
2
- export function registerLockSDKInstanceRuntime(instance, runtime) {
3
- runtimeByInstance.set(instance, runtime);
4
- }
5
- export function getRuntimeForLockSDKInstance(instance) {
6
- return runtimeByInstance.get(instance);
7
- }
@@ -1,6 +0,0 @@
1
- import type { LockDeviceRuntime } from "../runtime/LockDeviceRuntime";
2
- import type { LockSDKInstance } from "../entries/main/build-instance";
3
- export declare function setPrimaryLockSDKInstance(instance: LockSDKInstance): void;
4
- export declare function getPrimaryLockSDKRuntime(): LockDeviceRuntime | null;
5
- export declare function clearPrimaryLockSDKInstance(): void;
6
- export declare function clearPrimaryLockSDKInstanceIfDevId(devId: string): void;
@@ -1,24 +0,0 @@
1
- import { getRuntimeForLockSDKInstance } from "./lock-instance-runtime-ref";
2
- let primaryDevId = null;
3
- let primaryRuntime = null;
4
- export function setPrimaryLockSDKInstance(instance) {
5
- const runtime = getRuntimeForLockSDKInstance(instance);
6
- if (!runtime) {
7
- throw new Error("setPrimaryLockSDKInstance: instance must be returned by createLockSDK or init");
8
- }
9
- primaryDevId = runtime.devId;
10
- primaryRuntime = runtime;
11
- }
12
- export function getPrimaryLockSDKRuntime() {
13
- return primaryRuntime;
14
- }
15
- export function clearPrimaryLockSDKInstance() {
16
- primaryDevId = null;
17
- primaryRuntime = null;
18
- }
19
- export function clearPrimaryLockSDKInstanceIfDevId(devId) {
20
- if (primaryDevId === devId) {
21
- primaryDevId = null;
22
- primaryRuntime = null;
23
- }
24
- }
@@ -1,5 +0,0 @@
1
- import type { LockDeviceRuntime } from "../runtime/LockDeviceRuntime";
2
- export type LockSdkBoundExportThis = {
3
- devId: string;
4
- };
5
- export declare function resolveRuntimeFromExportThis(thisArg: unknown): LockDeviceRuntime;
@@ -1,29 +0,0 @@
1
- import { getRuntimeByDevId } from "../runtime/registry";
2
- import { getRuntimeForLockSDKInstance } from "./lock-instance-runtime-ref";
3
- import { resolveTopLevelTargetRuntime } from "./top-level-runtime";
4
- export function resolveRuntimeFromExportThis(thisArg) {
5
- if (thisArg !== null &&
6
- thisArg !== undefined &&
7
- typeof thisArg === "object") {
8
- const rtFromInstance = getRuntimeForLockSDKInstance(thisArg);
9
- if (rtFromInstance) {
10
- return rtFromInstance;
11
- }
12
- }
13
- if (thisArg !== null &&
14
- thisArg !== undefined &&
15
- typeof thisArg === "object" &&
16
- "devId" in thisArg &&
17
- typeof thisArg.devId === "string") {
18
- const devId = thisArg.devId;
19
- if (devId.length === 0) {
20
- throw new Error("Lock SDK: bound context devId must be non-empty");
21
- }
22
- const rt = getRuntimeByDevId(devId);
23
- if (!rt) {
24
- throw new Error(`Lock SDK: no registered runtime for devId "${devId}"; use createLockSDK or init first`);
25
- }
26
- return rt;
27
- }
28
- return resolveTopLevelTargetRuntime();
29
- }
@@ -1,2 +0,0 @@
1
- import type { LockDeviceRuntime } from "../runtime/LockDeviceRuntime";
2
- export declare function resolveTopLevelTargetRuntime(): LockDeviceRuntime;
@@ -1,9 +0,0 @@
1
- import { getError } from "../utils/errors";
2
- import { getPrimaryLockSDKRuntime } from "./primary-instance";
3
- export function resolveTopLevelTargetRuntime() {
4
- const primary = getPrimaryLockSDKRuntime();
5
- if (!primary) {
6
- throw getError(1071);
7
- }
8
- return primary;
9
- }
@@ -1,7 +0,0 @@
1
- import type { LockSDKOption } from "../../../interface";
2
- import type { LockDeviceRuntime } from "../../../runtime/LockDeviceRuntime";
3
- import { type LockSDKInstance } from "../build-instance";
4
- export declare function bootstrapRegisteredLockInstance(options?: LockSDKOption): Promise<{
5
- runtime: LockDeviceRuntime;
6
- instance: LockSDKInstance;
7
- }>;
@@ -1,12 +0,0 @@
1
- import { addEvents } from "../../../feature/state/platform-routing";
2
- import { initState } from "../../../feature/state/init-state";
3
- import { registerRuntime } from "../../../runtime/registry";
4
- import { buildLockSDKInstance, } from "../build-instance";
5
- import { createBootstrappedRuntime } from "./bootstrap";
6
- export async function bootstrapRegisteredLockInstance(options) {
7
- const runtime = await createBootstrappedRuntime(options);
8
- registerRuntime(runtime);
9
- addEvents(runtime);
10
- await initState(runtime);
11
- return { runtime, instance: buildLockSDKInstance(runtime) };
12
- }
@@ -1,4 +0,0 @@
1
- import type { LockSDKOption } from "../../../interface";
2
- import { LockDeviceRuntime } from "../../../runtime/LockDeviceRuntime";
3
- export declare function applyLockOptionsToRuntime(runtime: LockDeviceRuntime, options?: LockSDKOption): Promise<void>;
4
- export declare function createBootstrappedRuntime(options?: LockSDKOption): Promise<LockDeviceRuntime>;
@@ -1,53 +0,0 @@
1
- import dpCodes from "../../../config/dp-code";
2
- import { getCapabilities } from "../../../utils";
3
- import { getDeviceInfo, trackEvent, } from "../../../platform/device";
4
- import { LockDeviceRuntime } from "../../../runtime/LockDeviceRuntime";
5
- export async function applyLockOptionsToRuntime(runtime, options) {
6
- const { config } = runtime;
7
- let { devInfo, deviceId } = options || {};
8
- if (!devInfo && !deviceId) {
9
- throw new Error("deviceId is required in lock sdk");
10
- }
11
- if (deviceId && (!devInfo || devInfo.devId !== deviceId)) {
12
- devInfo = await getDeviceInfo(deviceId);
13
- }
14
- let dpSchema = {};
15
- const codesById = {};
16
- const idsByCode = {};
17
- if (devInfo.schema) {
18
- dpSchema = devInfo.schema.reduce((acc, cur) => {
19
- acc[cur.code] = cur;
20
- codesById[cur.id] = cur.code;
21
- idsByCode[cur.code] = cur.id;
22
- return acc;
23
- }, {});
24
- }
25
- else if (devInfo.dpSchema) {
26
- dpSchema = devInfo.dpSchema;
27
- Object.keys(dpSchema).forEach((key) => {
28
- const item = dpSchema[key];
29
- codesById[item.id] = item.code;
30
- idsByCode[item.code] = item.id;
31
- });
32
- }
33
- config.strictMode = options?.strictMode ?? true;
34
- config.passwordDigitalBase = options?.passwordDigitalBase ?? 10;
35
- config.passwordSupportZero = options?.passwordSupportZero ?? true;
36
- config.supportMultipleFace = options?.supportMultipleFace ?? false;
37
- config.supportOfflineDps = options?.supportOfflineDps ?? false;
38
- config.devInfo = devInfo;
39
- config.dpSchema = dpSchema;
40
- config.codesById = codesById;
41
- config.idsByCode = idsByCode;
42
- config.supportBigData = !!dpSchema[dpCodes.synchMethodW];
43
- config.preFetch = options?.preFetch ?? false;
44
- config.communication = getCapabilities(devInfo.capability).map((item) => item.id);
45
- trackEvent("t$y_UztB3Lj9Qns375R0r7dA0L5Kr2VytH3J".replace("$", ""), {
46
- pid: devInfo.productId,
47
- });
48
- }
49
- export async function createBootstrappedRuntime(options) {
50
- const runtime = new LockDeviceRuntime();
51
- await applyLockOptionsToRuntime(runtime, options);
52
- return runtime;
53
- }
@@ -1,3 +0,0 @@
1
- import type { LockDeviceRuntime } from "../../../runtime/LockDeviceRuntime";
2
- export declare function registerLockSDKInstanceRuntime(instance: object, runtime: LockDeviceRuntime): void;
3
- export declare function getRuntimeForLockSDKInstance(instance: object): LockDeviceRuntime | undefined;
@@ -1,7 +0,0 @@
1
- const runtimeByInstance = new WeakMap();
2
- export function registerLockSDKInstanceRuntime(instance, runtime) {
3
- runtimeByInstance.set(instance, runtime);
4
- }
5
- export function getRuntimeForLockSDKInstance(instance) {
6
- return runtimeByInstance.get(instance);
7
- }
@@ -1,6 +0,0 @@
1
- import type { LockDeviceRuntime } from "../../../runtime/LockDeviceRuntime";
2
- import type { LockSDKInstance } from "../build-instance";
3
- export declare function setPrimaryLockSDKInstance(instance: LockSDKInstance): void;
4
- export declare function getPrimaryLockSDKRuntime(): LockDeviceRuntime | null;
5
- export declare function clearPrimaryLockSDKInstance(): void;
6
- export declare function clearPrimaryLockSDKInstanceIfDevId(devId: string): void;
@@ -1,24 +0,0 @@
1
- import { getRuntimeForLockSDKInstance } from "./lock-instance-runtime-ref";
2
- let primaryDevId = null;
3
- let primaryRuntime = null;
4
- export function setPrimaryLockSDKInstance(instance) {
5
- const runtime = getRuntimeForLockSDKInstance(instance);
6
- if (!runtime) {
7
- throw new Error("setPrimaryLockSDKInstance: instance must be returned by createLockSDK or init");
8
- }
9
- primaryDevId = runtime.devId;
10
- primaryRuntime = runtime;
11
- }
12
- export function getPrimaryLockSDKRuntime() {
13
- return primaryRuntime;
14
- }
15
- export function clearPrimaryLockSDKInstance() {
16
- primaryDevId = null;
17
- primaryRuntime = null;
18
- }
19
- export function clearPrimaryLockSDKInstanceIfDevId(devId) {
20
- if (primaryDevId === devId) {
21
- primaryDevId = null;
22
- primaryRuntime = null;
23
- }
24
- }
@@ -1,5 +0,0 @@
1
- import type { LockDeviceRuntime } from "../../../runtime/LockDeviceRuntime";
2
- export type LockSdkBoundExportThis = {
3
- devId: string;
4
- };
5
- export declare function resolveRuntimeFromExportThis(thisArg: unknown): LockDeviceRuntime;