@ray-js/lock-sdk 1.2.0-beta.3 → 1.2.0-beta.30

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 (269) 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/notify.d.ts +28 -0
  8. package/lib/api/notify.js +17 -0
  9. package/lib/api/service.d.ts +26 -0
  10. package/lib/api/service.js +25 -0
  11. package/lib/api/temp.d.ts +21 -0
  12. package/lib/api/temp.js +24 -0
  13. package/lib/api/video.d.ts +9 -0
  14. package/lib/api/video.js +30 -0
  15. package/lib/api/voip.d.ts +10 -0
  16. package/lib/api/voip.js +17 -0
  17. package/lib/config/dp-code/index.d.ts +2 -1
  18. package/lib/config/dp-code/index.js +2 -0
  19. package/lib/config/dp-map/media.d.ts +13 -0
  20. package/lib/config/dp-map/media.js +19 -0
  21. package/lib/entries/main/bootstrap/bootstrap-lock-instance.d.ts +2 -1
  22. package/lib/entries/main/bootstrap/bootstrap-lock-instance.js +23 -8
  23. package/lib/entries/main/bootstrap/bootstrap.d.ts +3 -2
  24. package/lib/entries/main/bootstrap/bootstrap.js +10 -6
  25. package/lib/entries/main/bootstrap/primary-instance.d.ts +1 -2
  26. package/lib/entries/main/bootstrap/primary-instance.js +1 -1
  27. package/lib/entries/main/bootstrap/resolve-runtime-from-export-this.js +1 -1
  28. package/lib/entries/main/build-instance.d.ts +6 -3
  29. package/lib/entries/main/build-instance.js +13 -1
  30. package/lib/entries/main/exports/capability.d.ts +2 -0
  31. package/lib/entries/main/exports/capability.js +7 -1
  32. package/lib/entries/main/exports/fit-sdk/binding.d.ts +10 -0
  33. package/lib/entries/{fit/exports → main/exports/fit-sdk}/binding.js +6 -3
  34. package/lib/entries/{fit/exports → main/exports/fit-sdk}/device.d.ts +11 -10
  35. package/lib/entries/{fit/exports → main/exports/fit-sdk}/device.js +20 -20
  36. package/lib/entries/{fit/exports → main/exports/fit-sdk}/index.d.ts +1 -0
  37. package/lib/entries/{fit/exports → main/exports/fit-sdk}/index.js +1 -0
  38. package/lib/entries/main/exports/fit-sdk/log.d.ts +3 -0
  39. package/lib/entries/main/exports/fit-sdk/log.js +5 -0
  40. package/lib/entries/main/exports/fit-sdk/temp.d.ts +40 -0
  41. package/lib/entries/main/exports/fit-sdk/temp.js +59 -0
  42. package/lib/entries/main/exports/gesture.d.ts +6 -0
  43. package/lib/entries/main/exports/gesture.js +8 -0
  44. package/lib/entries/main/exports/index.d.ts +8 -0
  45. package/lib/entries/main/exports/index.js +8 -0
  46. package/lib/entries/main/exports/log.d.ts +2 -0
  47. package/lib/entries/main/exports/log.js +7 -1
  48. package/lib/entries/main/exports/media.d.ts +10 -1
  49. package/lib/entries/main/exports/media.js +29 -1
  50. package/lib/entries/main/exports/misc.d.ts +4 -2
  51. package/lib/entries/main/exports/misc.js +2 -2
  52. package/lib/entries/main/exports/notify.d.ts +7 -0
  53. package/lib/entries/main/exports/notify.js +8 -0
  54. package/lib/entries/main/exports/service.d.ts +4 -0
  55. package/lib/entries/main/exports/service.js +11 -0
  56. package/lib/entries/main/exports/voip.d.ts +3 -0
  57. package/lib/entries/main/exports/voip.js +8 -0
  58. package/lib/entries/main/index.d.ts +3 -3
  59. package/lib/entries/main/index.js +11 -5
  60. package/lib/feature/fit/bind-lock-to-fit.d.ts +1 -0
  61. package/lib/feature/fit/bind-lock-to-fit.js +53 -0
  62. package/lib/feature/fit/ble-key.d.ts +10 -4
  63. package/lib/feature/fit/ble-key.js +145 -4
  64. package/lib/feature/fit/device-bv.d.ts +2 -0
  65. package/lib/feature/fit/device-bv.js +15 -0
  66. package/lib/feature/fit/invalid-password.d.ts +10 -0
  67. package/lib/feature/fit/invalid-password.js +43 -0
  68. package/lib/feature/fit/list.d.ts +12 -2
  69. package/lib/feature/fit/list.js +54 -5
  70. package/lib/feature/fit/log.d.ts +7 -0
  71. package/lib/feature/fit/log.js +123 -0
  72. package/lib/feature/fit/method/add-flow.js +2 -2
  73. package/lib/feature/fit/method/add-password.js +2 -2
  74. package/lib/feature/fit/method/update-remove.js +40 -14
  75. package/lib/feature/fit/password-list.d.ts +37 -0
  76. package/lib/feature/fit/password-list.js +44 -1
  77. package/lib/feature/fit/security-channel.d.ts +3 -0
  78. package/lib/feature/fit/security-channel.js +43 -0
  79. package/lib/feature/fit/shared.d.ts +8 -0
  80. package/lib/feature/fit/shared.js +40 -1
  81. package/lib/feature/fit/sync.d.ts +4 -2
  82. package/lib/feature/fit/sync.js +63 -22
  83. package/lib/feature/fit/temp-password.d.ts +23 -0
  84. package/lib/feature/fit/temp-password.js +95 -3
  85. package/lib/feature/fit/users.d.ts +1 -0
  86. package/lib/feature/fit/users.js +1 -0
  87. package/lib/feature/gesture/gesture.d.ts +6 -0
  88. package/lib/feature/gesture/gesture.js +3 -0
  89. package/lib/feature/log/log.d.ts +5 -1
  90. package/lib/feature/log/log.js +53 -6
  91. package/lib/feature/media/camera.d.ts +18 -0
  92. package/lib/feature/media/camera.js +36 -0
  93. package/lib/feature/media/media.d.ts +10 -0
  94. package/lib/feature/media/media.js +31 -0
  95. package/lib/feature/misc/ble-control.js +2 -2
  96. package/lib/feature/misc/capability.d.ts +2 -0
  97. package/lib/feature/misc/capability.js +84 -11
  98. package/lib/feature/misc/connect-device.d.ts +1 -1
  99. package/lib/feature/misc/connect-device.js +7 -6
  100. package/lib/feature/misc/is-use-near-channel-for-runtime.js +8 -1
  101. package/lib/feature/notify/notify.d.ts +4 -0
  102. package/lib/feature/notify/notify.js +3 -0
  103. package/lib/feature/password/temporary/custom-dp.js +59 -54
  104. package/lib/feature/password/temporary/offline-create.d.ts +14 -0
  105. package/lib/feature/password/temporary/offline-create.js +77 -1
  106. package/lib/feature/service/goto-service.d.ts +3 -2
  107. package/lib/feature/service/goto-service.js +7 -1
  108. package/lib/feature/service/value-added.d.ts +4 -0
  109. package/lib/feature/service/value-added.js +4 -0
  110. package/lib/feature/state/clear.js +1 -0
  111. package/lib/feature/state/device-status.js +17 -6
  112. package/lib/feature/state/init-state.js +20 -12
  113. package/lib/feature/state/platform-routing.js +12 -3
  114. package/lib/feature/state/remote-permissions.js +17 -0
  115. package/lib/feature/state/sync/remote-serect-key.js +7 -0
  116. package/lib/feature/storage/index.d.ts +5 -0
  117. package/lib/feature/storage/index.js +32 -0
  118. package/lib/feature/storage/swr-cache.d.ts +7 -0
  119. package/lib/feature/storage/swr-cache.js +54 -0
  120. package/lib/feature/unlock/method/add-flow.js +2 -2
  121. package/lib/feature/unlock/method/add-password.js +2 -2
  122. package/lib/feature/unlock/sync/unlock-method.js +3 -0
  123. package/lib/feature/user/sync-user.js +4 -2
  124. package/lib/feature/utils/index.d.ts +1 -0
  125. package/lib/feature/utils/index.js +1 -0
  126. package/lib/feature/voip/voip.d.ts +3 -0
  127. package/lib/feature/voip/voip.js +3 -0
  128. package/lib/interface.d.ts +42 -1
  129. package/lib/platform/device.d.ts +4 -3
  130. package/lib/platform/index.d.ts +1 -0
  131. package/lib/platform/index.js +1 -0
  132. package/lib/platform/ipc.d.ts +3 -0
  133. package/lib/platform/ipc.js +13 -0
  134. package/lib/platform/storage.d.ts +3 -0
  135. package/lib/platform/storage.js +9 -0
  136. package/lib/runtime/LockDeviceRuntime.js +3 -0
  137. package/lib/runtime/lock-config.d.ts +5 -1
  138. package/lib/runtime/lock-config.js +6 -0
  139. package/lib/runtime/runtime-state-types.d.ts +6 -0
  140. package/lib/utils/constant.d.ts +1 -0
  141. package/lib/utils/constant.js +6 -0
  142. package/lib/utils/errors.js +3 -1
  143. package/lib/utils/index.d.ts +2 -1
  144. package/lib/utils/index.js +1 -0
  145. package/lib/utils/parse.js +1 -1
  146. package/package.json +1 -11
  147. package/lib/bootstrap/bootstrap-lock-instance.d.ts +0 -7
  148. package/lib/bootstrap/bootstrap-lock-instance.js +0 -16
  149. package/lib/bootstrap/bootstrap.d.ts +0 -4
  150. package/lib/bootstrap/bootstrap.js +0 -53
  151. package/lib/bootstrap/lock-instance-runtime-ref.d.ts +0 -3
  152. package/lib/bootstrap/lock-instance-runtime-ref.js +0 -7
  153. package/lib/bootstrap/primary-instance.d.ts +0 -6
  154. package/lib/bootstrap/primary-instance.js +0 -24
  155. package/lib/bootstrap/resolve-runtime-from-export-this.d.ts +0 -5
  156. package/lib/bootstrap/resolve-runtime-from-export-this.js +0 -29
  157. package/lib/bootstrap/top-level-runtime.d.ts +0 -2
  158. package/lib/bootstrap/top-level-runtime.js +0 -9
  159. package/lib/entries/ble/bootstrap/bootstrap-lock-instance.d.ts +0 -7
  160. package/lib/entries/ble/bootstrap/bootstrap-lock-instance.js +0 -12
  161. package/lib/entries/ble/bootstrap/bootstrap.d.ts +0 -4
  162. package/lib/entries/ble/bootstrap/bootstrap.js +0 -53
  163. package/lib/entries/ble/bootstrap/lock-instance-runtime-ref.d.ts +0 -3
  164. package/lib/entries/ble/bootstrap/lock-instance-runtime-ref.js +0 -7
  165. package/lib/entries/ble/bootstrap/primary-instance.d.ts +0 -6
  166. package/lib/entries/ble/bootstrap/primary-instance.js +0 -24
  167. package/lib/entries/ble/bootstrap/resolve-runtime-from-export-this.d.ts +0 -5
  168. package/lib/entries/ble/bootstrap/resolve-runtime-from-export-this.js +0 -29
  169. package/lib/entries/ble/bootstrap/top-level-runtime.d.ts +0 -2
  170. package/lib/entries/ble/bootstrap/top-level-runtime.js +0 -9
  171. package/lib/entries/ble/build-instance.d.ts +0 -9
  172. package/lib/entries/ble/build-instance.js +0 -50
  173. package/lib/entries/ble/exports/capability.d.ts +0 -6
  174. package/lib/entries/ble/exports/capability.js +0 -17
  175. package/lib/entries/ble/exports/config.d.ts +0 -3
  176. package/lib/entries/ble/exports/config.js +0 -5
  177. package/lib/entries/ble/exports/dp.d.ts +0 -9
  178. package/lib/entries/ble/exports/dp.js +0 -13
  179. package/lib/entries/ble/exports/index.d.ts +0 -16
  180. package/lib/entries/ble/exports/index.js +0 -16
  181. package/lib/entries/ble/exports/linkage.d.ts +0 -5
  182. package/lib/entries/ble/exports/linkage.js +0 -15
  183. package/lib/entries/ble/exports/log.d.ts +0 -9
  184. package/lib/entries/ble/exports/log.js +0 -21
  185. package/lib/entries/ble/exports/media.d.ts +0 -4
  186. package/lib/entries/ble/exports/media.js +0 -12
  187. package/lib/entries/ble/exports/misc.d.ts +0 -19
  188. package/lib/entries/ble/exports/misc.js +0 -30
  189. package/lib/entries/ble/exports/offline-dps.d.ts +0 -8
  190. package/lib/entries/ble/exports/offline-dps.js +0 -24
  191. package/lib/entries/ble/exports/open/do-open-close-action.d.ts +0 -2
  192. package/lib/entries/ble/exports/open/do-open-close-action.js +0 -36
  193. package/lib/entries/ble/exports/open/index.d.ts +0 -18
  194. package/lib/entries/ble/exports/open/index.js +0 -45
  195. package/lib/entries/ble/exports/signal.d.ts +0 -6
  196. package/lib/entries/ble/exports/signal.js +0 -14
  197. package/lib/entries/ble/exports/sleep.d.ts +0 -13
  198. package/lib/entries/ble/exports/sleep.js +0 -31
  199. package/lib/entries/ble/exports/state.d.ts +0 -6
  200. package/lib/entries/ble/exports/state.js +0 -19
  201. package/lib/entries/ble/exports/temporary.d.ts +0 -31
  202. package/lib/entries/ble/exports/temporary.js +0 -91
  203. package/lib/entries/ble/exports/unlock/sync.d.ts +0 -1
  204. package/lib/entries/ble/exports/unlock/sync.js +0 -5
  205. package/lib/entries/ble/exports/unlock-method.d.ts +0 -19
  206. package/lib/entries/ble/exports/unlock-method.js +0 -58
  207. package/lib/entries/ble/exports/user/index.d.ts +0 -23
  208. package/lib/entries/ble/exports/user/index.js +0 -22
  209. package/lib/entries/ble/exports/user/sync.d.ts +0 -1
  210. package/lib/entries/ble/exports/user/sync.js +0 -5
  211. package/lib/entries/ble/index.d.ts +0 -8
  212. package/lib/entries/ble/index.js +0 -39
  213. package/lib/entries/fit/bootstrap/bootstrap-lock-instance.d.ts +0 -7
  214. package/lib/entries/fit/bootstrap/bootstrap-lock-instance.js +0 -12
  215. package/lib/entries/fit/bootstrap/bootstrap.d.ts +0 -4
  216. package/lib/entries/fit/bootstrap/bootstrap.js +0 -69
  217. package/lib/entries/fit/bootstrap/lock-instance-runtime-ref.d.ts +0 -3
  218. package/lib/entries/fit/bootstrap/lock-instance-runtime-ref.js +0 -7
  219. package/lib/entries/fit/bootstrap/primary-instance.d.ts +0 -6
  220. package/lib/entries/fit/bootstrap/primary-instance.js +0 -24
  221. package/lib/entries/fit/bootstrap/resolve-runtime-from-export-this.d.ts +0 -5
  222. package/lib/entries/fit/bootstrap/resolve-runtime-from-export-this.js +0 -29
  223. package/lib/entries/fit/bootstrap/top-level-runtime.d.ts +0 -2
  224. package/lib/entries/fit/bootstrap/top-level-runtime.js +0 -9
  225. package/lib/entries/fit/build-instance.d.ts +0 -9
  226. package/lib/entries/fit/build-instance.js +0 -57
  227. package/lib/entries/fit/exports/binding.d.ts +0 -8
  228. package/lib/entries/fit/exports/temp.d.ts +0 -19
  229. package/lib/entries/fit/exports/temp.js +0 -18
  230. package/lib/entries/fit/index.d.ts +0 -8
  231. package/lib/entries/fit/index.js +0 -36
  232. package/lib/entries/main/exports/open.d.ts +0 -16
  233. package/lib/entries/main/exports/open.js +0 -44
  234. package/lib/entries/screen/bootstrap/bootstrap-lock-instance.d.ts +0 -7
  235. package/lib/entries/screen/bootstrap/bootstrap-lock-instance.js +0 -12
  236. package/lib/entries/screen/bootstrap/bootstrap.d.ts +0 -4
  237. package/lib/entries/screen/bootstrap/bootstrap.js +0 -69
  238. package/lib/entries/screen/bootstrap/lock-instance-runtime-ref.d.ts +0 -3
  239. package/lib/entries/screen/bootstrap/lock-instance-runtime-ref.js +0 -7
  240. package/lib/entries/screen/bootstrap/primary-instance.d.ts +0 -6
  241. package/lib/entries/screen/bootstrap/primary-instance.js +0 -24
  242. package/lib/entries/screen/bootstrap/resolve-runtime-from-export-this.d.ts +0 -5
  243. package/lib/entries/screen/bootstrap/resolve-runtime-from-export-this.js +0 -29
  244. package/lib/entries/screen/bootstrap/top-level-runtime.d.ts +0 -2
  245. package/lib/entries/screen/bootstrap/top-level-runtime.js +0 -9
  246. package/lib/entries/screen/build-instance.d.ts +0 -9
  247. package/lib/entries/screen/build-instance.js +0 -57
  248. package/lib/entries/screen/exports/bind-events.d.ts +0 -4
  249. package/lib/entries/screen/exports/bind-events.js +0 -8
  250. package/lib/entries/screen/exports/binding.d.ts +0 -6
  251. package/lib/entries/screen/exports/binding.js +0 -15
  252. package/lib/entries/screen/exports/device.d.ts +0 -16
  253. package/lib/entries/screen/exports/device.js +0 -41
  254. package/lib/entries/screen/exports/event.d.ts +0 -3
  255. package/lib/entries/screen/exports/event.js +0 -5
  256. package/lib/entries/screen/exports/index.d.ts +0 -5
  257. package/lib/entries/screen/exports/index.js +0 -5
  258. package/lib/entries/screen/exports/user.d.ts +0 -2
  259. package/lib/entries/screen/exports/user.js +0 -8
  260. package/lib/entries/screen/index.d.ts +0 -8
  261. package/lib/entries/screen/index.js +0 -36
  262. package/lib/feature/unlock/door/door-action.d.ts +0 -2
  263. package/lib/feature/unlock/door/door-action.js +0 -32
  264. package/lib/fit.d.ts +0 -4
  265. package/lib/fit.js +0 -3
  266. package/lib/runtime/device-status/compute-device-status.d.ts +0 -25
  267. package/lib/runtime/device-status/compute-device-status.js +0 -94
  268. package/lib/screen.d.ts +0 -4
  269. package/lib/screen.js +0 -3
@@ -1,18 +0,0 @@
1
- import { doOpenCloseAction } from "./do-open-close-action";
2
- import { getRemotePermissionList } from "../../../../feature/unlock/door/remote-permission";
3
- import { type OpenDoorCallOptions } from "../../../../feature/unlock/door/types";
4
- import { RemotePermissionType } from "../../../../constant";
5
- export { doOpenCloseAction as doOpenCloseActionForRuntime };
6
- export declare function checkRemoteEnabled(): Promise<void>;
7
- export declare function openDoor(option?: OpenDoorCallOptions): Promise<void>;
8
- export declare function closeDoor(option?: OpenDoorCallOptions): Promise<void>;
9
- export declare function remoteEnabled(state: boolean): Promise<void>;
10
- export declare function getRemoteEnabled(): boolean;
11
- export { getRemotePermissionList };
12
- export declare function getRemotePermission(): RemotePermissionType;
13
- export declare function updateRemotePermission(permission: RemotePermissionType): Promise<void>;
14
- export declare function agreeOpenDoor(option?: OpenDoorCallOptions): Promise<void>;
15
- export declare function rejectOpenDoor(option?: OpenDoorCallOptions): Promise<void>;
16
- export declare function getVoiceUnlockPwdEnabled(): Promise<boolean>;
17
- export declare function voiceUnlockPwdDisabled(): Promise<boolean>;
18
- export declare function updateVoiceUnlockPwd(password: string): Promise<boolean>;
@@ -1,45 +0,0 @@
1
- import { resolveRuntimeFromExportThis } from "../../bootstrap/resolve-runtime-from-export-this";
2
- import { checkRemoteEnabledForRuntime } from "../../../../feature/unlock/door/check-remote";
3
- import { doOpenCloseAction } from "./do-open-close-action";
4
- import { handleOpenDoorForRuntime } from "../../../../feature/unlock/door/wifi-pro-confirm";
5
- import { getRemotePermissionList, remoteEnabledForRuntime, updateRemotePermissionForRuntime, } from "../../../../feature/unlock/door/remote-permission";
6
- import { getVoiceUnlockPwdEnabledForRuntime, voiceUnlockPwdDisabledForRuntime, updateVoiceUnlockPwdForRuntime, } from "../../../../feature/unlock/door/voice-unlock-pwd";
7
- import { OPEN_CLOSE_ACTION_DEFAULT_TIMEOUT_MS, } from "../../../../feature/unlock/door/types";
8
- export { doOpenCloseAction as doOpenCloseActionForRuntime };
9
- export async function checkRemoteEnabled() {
10
- await checkRemoteEnabledForRuntime(resolveRuntimeFromExportThis(this));
11
- }
12
- export function openDoor(option) {
13
- return doOpenCloseAction(resolveRuntimeFromExportThis(this), true, option?.timeout ?? OPEN_CLOSE_ACTION_DEFAULT_TIMEOUT_MS);
14
- }
15
- export function closeDoor(option) {
16
- return doOpenCloseAction(resolveRuntimeFromExportThis(this), false, option?.timeout ?? OPEN_CLOSE_ACTION_DEFAULT_TIMEOUT_MS);
17
- }
18
- export async function remoteEnabled(state) {
19
- await remoteEnabledForRuntime(resolveRuntimeFromExportThis(this), state);
20
- }
21
- export function getRemoteEnabled() {
22
- return resolveRuntimeFromExportThis(this).config.remoteOpenEnabled;
23
- }
24
- export { getRemotePermissionList };
25
- export function getRemotePermission() {
26
- return resolveRuntimeFromExportThis(this).config.remoteOpenPermission;
27
- }
28
- export async function updateRemotePermission(permission) {
29
- await updateRemotePermissionForRuntime(resolveRuntimeFromExportThis(this), permission);
30
- }
31
- export function agreeOpenDoor(option) {
32
- return handleOpenDoorForRuntime(resolveRuntimeFromExportThis(this), true, option?.timeout ?? OPEN_CLOSE_ACTION_DEFAULT_TIMEOUT_MS);
33
- }
34
- export function rejectOpenDoor(option) {
35
- return handleOpenDoorForRuntime(resolveRuntimeFromExportThis(this), false, option?.timeout ?? OPEN_CLOSE_ACTION_DEFAULT_TIMEOUT_MS);
36
- }
37
- export async function getVoiceUnlockPwdEnabled() {
38
- return getVoiceUnlockPwdEnabledForRuntime(resolveRuntimeFromExportThis(this));
39
- }
40
- export async function voiceUnlockPwdDisabled() {
41
- return voiceUnlockPwdDisabledForRuntime(resolveRuntimeFromExportThis(this));
42
- }
43
- export async function updateVoiceUnlockPwd(password) {
44
- return updateVoiceUnlockPwdForRuntime(resolveRuntimeFromExportThis(this), password);
45
- }
@@ -1,6 +0,0 @@
1
- import type { WiFiSignalChangeListener } from "../../../feature/misc/signal";
2
- export type { WiFiSignalChangeListener } from "../../../feature/misc/signal";
3
- export declare function getWiFiSignal(): Promise<void>;
4
- export declare function getCurrentWiFiSignal(): number | "unknown";
5
- export declare function onWiFiSignalChange(cb: WiFiSignalChangeListener): void;
6
- export declare function offWiFiSignalChange(cb: WiFiSignalChangeListener): void;
@@ -1,14 +0,0 @@
1
- import { resolveRuntimeFromExportThis } from "../bootstrap/resolve-runtime-from-export-this";
2
- import { getWiFiSignalForRuntime, getCurrentWiFiSignalForRuntime, onWiFiSignalChangeForRuntime, offWiFiSignalChangeForRuntime, } from "../../../feature/misc/signal";
3
- export function getWiFiSignal() {
4
- return getWiFiSignalForRuntime(resolveRuntimeFromExportThis(this));
5
- }
6
- export function getCurrentWiFiSignal() {
7
- return getCurrentWiFiSignalForRuntime(resolveRuntimeFromExportThis(this));
8
- }
9
- export function onWiFiSignalChange(cb) {
10
- onWiFiSignalChangeForRuntime(resolveRuntimeFromExportThis(this), cb);
11
- }
12
- export function offWiFiSignalChange(cb) {
13
- offWiFiSignalChangeForRuntime(resolveRuntimeFromExportThis(this), cb);
14
- }
@@ -1,13 +0,0 @@
1
- import type { SleepStatusListener } from "../../../feature/misc/sleep";
2
- export declare function isSleep(): boolean;
3
- export declare function hasSleepAbility(): boolean;
4
- export declare function isEnabledSleep(): boolean;
5
- export declare function enableSleep(): Promise<void>;
6
- export declare function disableSleep(): Promise<void>;
7
- export declare function getSleepPeriod(): import("../../../feature/misc/dp-period").GetDpPeriodTimeResult;
8
- export declare function updateSleepPeriod(params: {
9
- start: number;
10
- end: number;
11
- }): Promise<void>;
12
- export declare function onSleepStatusChange(callback: SleepStatusListener): void;
13
- export declare function offSleepStatusChange(callback: SleepStatusListener): void;
@@ -1,31 +0,0 @@
1
- import dpCodes from "../../../config/dp-code";
2
- import { resolveRuntimeFromExportThis } from "../bootstrap/resolve-runtime-from-export-this";
3
- import { getDpPeriodTimeForRuntime, updateDpPeriodTimeForRuntime, } from "../../../feature/misc/dp-period";
4
- import { isSleepForRuntime, hasSleepAbilityForRuntime, getSwitchStatusForRuntime, setSleepStatusForRuntime, onSleepStatusChangeForRuntime, offSleepStatusChangeForRuntime, } from "../../../feature/misc/sleep";
5
- export function isSleep() {
6
- return isSleepForRuntime(resolveRuntimeFromExportThis(this));
7
- }
8
- export function hasSleepAbility() {
9
- return hasSleepAbilityForRuntime(resolveRuntimeFromExportThis(this));
10
- }
11
- export function isEnabledSleep() {
12
- return getSwitchStatusForRuntime(resolveRuntimeFromExportThis(this));
13
- }
14
- export async function enableSleep() {
15
- return setSleepStatusForRuntime(resolveRuntimeFromExportThis(this), true);
16
- }
17
- export async function disableSleep() {
18
- return setSleepStatusForRuntime(resolveRuntimeFromExportThis(this), false);
19
- }
20
- export function getSleepPeriod() {
21
- return getDpPeriodTimeForRuntime(resolveRuntimeFromExportThis(this), dpCodes.dormantTimeSet);
22
- }
23
- export function updateSleepPeriod(params) {
24
- return updateDpPeriodTimeForRuntime(resolveRuntimeFromExportThis(this), dpCodes.dormantTimeSet, params, { offlineDp: true });
25
- }
26
- export function onSleepStatusChange(callback) {
27
- onSleepStatusChangeForRuntime(resolveRuntimeFromExportThis(this), callback);
28
- }
29
- export function offSleepStatusChange(callback) {
30
- offSleepStatusChangeForRuntime(resolveRuntimeFromExportThis(this), callback);
31
- }
@@ -1,6 +0,0 @@
1
- import { type DeviceStatus } from "../../../interface";
2
- export declare function getCurrentUser(isForce?: boolean): Promise<import("../../../interface").CurrentUser>;
3
- export declare function getCurrentUserSync(): import("../../../interface").CurrentUser | null;
4
- export declare function getDeviceStatus(): DeviceStatus;
5
- export declare function onDeviceStatusChange(callback: (status: DeviceStatus) => void): void;
6
- export declare function offDeviceStatusChange(callback: (status: DeviceStatus) => void): void;
@@ -1,19 +0,0 @@
1
- import { resolveRuntimeFromExportThis } from "../bootstrap/resolve-runtime-from-export-this";
2
- import { getCurrentUserForRuntime } from "../../../feature/user/current-user";
3
- import { getDeviceStatusForRuntime } from "../../../feature/state/device-status";
4
- import { onDeviceStatusChangeForRuntime, offDeviceStatusChangeForRuntime, } from "../../../feature/state/device-status-events";
5
- export async function getCurrentUser(isForce) {
6
- return getCurrentUserForRuntime(resolveRuntimeFromExportThis(this), isForce);
7
- }
8
- export function getCurrentUserSync() {
9
- return resolveRuntimeFromExportThis(this).cache.currentUser;
10
- }
11
- export function getDeviceStatus() {
12
- return getDeviceStatusForRuntime(resolveRuntimeFromExportThis(this));
13
- }
14
- export function onDeviceStatusChange(callback) {
15
- onDeviceStatusChangeForRuntime(resolveRuntimeFromExportThis(this), callback);
16
- }
17
- export function offDeviceStatusChange(callback) {
18
- offDeviceStatusChangeForRuntime(resolveRuntimeFromExportThis(this), callback);
19
- }
@@ -1,31 +0,0 @@
1
- import type { CreateClearParams, CreateCustomParams, CreateLimitParams, CreateOfflineParams, CreateOnceParams, CreateOnlineUnlimitedParams, FreezeParams, GetInvalidListParams, OfflinePasswordType, RemoveCustomProps, RenameParams, UpdateTempPasswordParams } from "../../../feature/password/temporary/types";
2
- import type { TempPasswordResult } from "../../../interface";
3
- export type { EffectivePasswrodItem, InvalidPasswordItem, OfflinePasswordItem, OfflinePasswordType, OfflineTempResult, OfflineTempType, OnlinePasswordItem, } from "../../../feature/password/temporary/types";
4
- export declare function createTempCustom(params: CreateCustomParams): Promise<TempPasswordResult>;
5
- export declare function removeTempCustom(params: RemoveCustomProps): Promise<boolean>;
6
- export declare function updateTempCustom(params: UpdateTempPasswordParams): Promise<boolean>;
7
- export declare function getTempEffectiveList(): Promise<import("../../../feature/password/temporary/types").EffectivePasswrodItem[]>;
8
- export declare function getTempInvalidList(params?: GetInvalidListParams): Promise<{
9
- list: import("../../../feature/password/temporary/types").InvalidPasswordItem[];
10
- hasMore: boolean;
11
- total: number;
12
- }>;
13
- export declare function clearTempInvalidList(): Promise<boolean>;
14
- export declare function freezeTemp(params: FreezeParams): Promise<unknown>;
15
- export declare function unfreezeTemp(params: FreezeParams): Promise<unknown>;
16
- export declare function renameTemp(params: RenameParams): Promise<void>;
17
- export declare function saveTempOnlineUnlimited(params: CreateOnlineUnlimitedParams): Promise<{
18
- type: "custom";
19
- name: string;
20
- pwdId: string;
21
- effectiveConfig: import("../../../interface").EffectiveConfig;
22
- }>;
23
- export declare function removeTempOnlineUnlimited(id: string): Promise<void>;
24
- export declare function getTempOnlineUnlimitedList(): Promise<import("../../../feature/password/temporary/wifi-online").OnlinePasswordItem[]>;
25
- export declare function createTempOffline(params: CreateOfflineParams): Promise<import("../../../feature/password/temporary/types").OfflineTempResult>;
26
- export declare function getTempOfflineEffectiveList(pwdTypeCode: OfflinePasswordType): Promise<import("../../../api/temp").EffectivePasswrodItem[]>;
27
- export declare function getTempOfflineInvalidList(pwdTypeCode: OfflinePasswordType): Promise<import("../../../api/temp").EffectivePasswrodItem[]>;
28
- export declare function createTempLimit(params: CreateLimitParams): Promise<TempPasswordResult>;
29
- export declare function createTempOnce(params: CreateOnceParams): Promise<TempPasswordResult>;
30
- export declare function createTempDynamic(): Promise<TempPasswordResult>;
31
- export declare function createTempClear(params: CreateClearParams): Promise<TempPasswordResult>;
@@ -1,91 +0,0 @@
1
- import { resolveRuntimeFromExportThis } from "../bootstrap/resolve-runtime-from-export-this";
2
- import { createTempCustomForRuntime, removeTempCustomForRuntime, updateTempCustomForRuntime, } from "../../../feature/password/temporary/custom-dp";
3
- import { createTempCustomForRuntime as createTempCustomForRuntimeBle, updateTempCustomForRuntime as updateTempCustomForRuntimeBle, removeTempCustomForRuntime as removeTempCustomForRuntimeBle, freezeTempForRuntime as freezeTempForRuntimeBle, unfreezeTempForRuntime as unfreezeTempForRuntimeBle, } from "../../../feature/password/temporary/custom-dp-ble";
4
- import { createTempClearForRuntime, createTempDynamicForRuntime, createTempLimitForRuntime, createTempOnceForRuntime, } from "../../../feature/password/temporary/offline-create";
5
- import { clearTempInvalidListForRuntime, getTempEffectiveListForRuntime, getTempInvalidListForRuntime, } from "../../../feature/password/temporary/lists";
6
- import { freezeTempForRuntime, renameTempForRuntime, unfreezeTempForRuntime, } from "../../../feature/password/temporary/freeze-rename";
7
- import { getTempOnlineUnlimitedListForRuntime, removeTempOnlineUnlimitedForRuntime, saveTempOnlineUnlimitedForRuntime, } from "../../../feature/password/temporary/wifi-online";
8
- import { createTempOfflineForRuntime, getTempOfflineEffectiveListForRuntime, getTempOfflineInvalidListForRuntime, } from "../../../feature/password/temporary/wifi-offline";
9
- import { isBlePureDeviceForRuntime } from "../../../feature/misc/capability";
10
- export function createTempCustom(params) {
11
- const rt = resolveRuntimeFromExportThis(this);
12
- const isBlePureDevice = isBlePureDeviceForRuntime(rt);
13
- if (isBlePureDevice) {
14
- return createTempCustomForRuntimeBle(rt, params);
15
- }
16
- return createTempCustomForRuntime(rt, params);
17
- }
18
- export function removeTempCustom(params) {
19
- const rt = resolveRuntimeFromExportThis(this);
20
- const isBlePureDevice = isBlePureDeviceForRuntime(rt);
21
- if (isBlePureDevice) {
22
- return removeTempCustomForRuntimeBle(rt, params);
23
- }
24
- return removeTempCustomForRuntime(rt, params);
25
- }
26
- export function updateTempCustom(params) {
27
- const rt = resolveRuntimeFromExportThis(this);
28
- const isBlePureDevice = isBlePureDeviceForRuntime(rt);
29
- if (isBlePureDevice) {
30
- return updateTempCustomForRuntimeBle(rt, params);
31
- }
32
- return updateTempCustomForRuntime(rt, params);
33
- }
34
- export function getTempEffectiveList() {
35
- return getTempEffectiveListForRuntime(resolveRuntimeFromExportThis(this));
36
- }
37
- export function getTempInvalidList(params) {
38
- return getTempInvalidListForRuntime(resolveRuntimeFromExportThis(this), params);
39
- }
40
- export function clearTempInvalidList() {
41
- return clearTempInvalidListForRuntime(resolveRuntimeFromExportThis(this));
42
- }
43
- export function freezeTemp(params) {
44
- const rt = resolveRuntimeFromExportThis(this);
45
- const isBlePureDevice = isBlePureDeviceForRuntime(rt);
46
- if (isBlePureDevice) {
47
- return freezeTempForRuntimeBle(rt, params);
48
- }
49
- return freezeTempForRuntime(rt, params);
50
- }
51
- export function unfreezeTemp(params) {
52
- const rt = resolveRuntimeFromExportThis(this);
53
- const isBlePureDevice = isBlePureDeviceForRuntime(rt);
54
- if (isBlePureDevice) {
55
- return unfreezeTempForRuntimeBle(rt, params);
56
- }
57
- return unfreezeTempForRuntime(rt, params);
58
- }
59
- export function renameTemp(params) {
60
- return renameTempForRuntime(resolveRuntimeFromExportThis(this), params);
61
- }
62
- export function saveTempOnlineUnlimited(params) {
63
- return saveTempOnlineUnlimitedForRuntime(resolveRuntimeFromExportThis(this), params);
64
- }
65
- export function removeTempOnlineUnlimited(id) {
66
- return removeTempOnlineUnlimitedForRuntime(resolveRuntimeFromExportThis(this), id);
67
- }
68
- export function getTempOnlineUnlimitedList() {
69
- return getTempOnlineUnlimitedListForRuntime(resolveRuntimeFromExportThis(this));
70
- }
71
- export function createTempOffline(params) {
72
- return createTempOfflineForRuntime(resolveRuntimeFromExportThis(this), params);
73
- }
74
- export function getTempOfflineEffectiveList(pwdTypeCode) {
75
- return getTempOfflineEffectiveListForRuntime(resolveRuntimeFromExportThis(this), pwdTypeCode);
76
- }
77
- export function getTempOfflineInvalidList(pwdTypeCode) {
78
- return getTempOfflineInvalidListForRuntime(resolveRuntimeFromExportThis(this), pwdTypeCode);
79
- }
80
- export function createTempLimit(params) {
81
- return createTempLimitForRuntime(resolveRuntimeFromExportThis(this), params);
82
- }
83
- export function createTempOnce(params) {
84
- return createTempOnceForRuntime(resolveRuntimeFromExportThis(this), params);
85
- }
86
- export function createTempDynamic() {
87
- return createTempDynamicForRuntime(resolveRuntimeFromExportThis(this));
88
- }
89
- export function createTempClear(params) {
90
- return createTempClearForRuntime(resolveRuntimeFromExportThis(this), params);
91
- }
@@ -1 +0,0 @@
1
- export declare function syncUnlockMethod(): Promise<void>;
@@ -1,5 +0,0 @@
1
- import { resolveRuntimeFromExportThis } from "../../bootstrap/resolve-runtime-from-export-this";
2
- import { syncUnlockMethodWithRuntime } from "../../../../feature/unlock/sync/unlock-method";
3
- export async function syncUnlockMethod() {
4
- return syncUnlockMethodWithRuntime(resolveRuntimeFromExportThis(this));
5
- }
@@ -1,19 +0,0 @@
1
- import type { AddPasswordParams, AddUnlockMethodBaseParams, AddUnlockMethodEvent, AddUnlockMethodListener, BindUnlockMethodFromLogParams, BindUnlockMethodParams, CancelAddUnlockMethodParams, SendVerifyCodeParams, SpecialUnlockMethodInfo, StartAddUnlockMethodParams, updateUnlockMethodParams } from "../../../feature/unlock/method/types";
2
- import type { UnlockMethodType } from "../../../interface";
3
- export type { AddPasswordParams, AddUnlockMethodBaseParams, AddUnlockMethodEvent, AddUnlockMethodListener, SpecialUnlockMethodInfo, updateUnlockMethodParams, };
4
- export declare function getUnlockMethodDetail(id: number): Promise<import("../../../interface").UnlockMethodDetail>;
5
- export declare function checkSpecialSupportPhone(): boolean;
6
- export declare function addPassword(params: AddPasswordParams): Promise<import("../../../api/lock").CreateUnlockMethodResult>;
7
- export declare function startAddUnlockMethod(params: StartAddUnlockMethodParams): Promise<import("../../../feature/unlock/method/add-flow").StartAddUnlockMethodResult>;
8
- export declare function cancelAddUnlockMethod(params: CancelAddUnlockMethodParams): Promise<void>;
9
- export declare function updateUnlockMethod(params: updateUnlockMethodParams): Promise<void>;
10
- export declare function deleteUnlockMethod(id: number): Promise<void>;
11
- export declare function checkUnBindUnlockMethods(): Promise<boolean>;
12
- export declare function getUnbindUnlockMethods(): Promise<import("../../../interface").UnBindUnlockMethodGroup[]>;
13
- export declare function bindUnlockMethod(params: BindUnlockMethodParams): Promise<boolean>;
14
- export declare function unbindUnlockMethod(id: number): Promise<void>;
15
- export declare function bindUnlockMethodFromLog(params: BindUnlockMethodFromLogParams): Promise<boolean>;
16
- export declare function sendVerifyCode(params: SendVerifyCodeParams): Promise<void>;
17
- export declare function onAddUnlockMethod(listener: AddUnlockMethodListener): void;
18
- export declare function offAddUnlockMethod(listener: AddUnlockMethodListener): void;
19
- export declare function getUnlockGuide(type: UnlockMethodType): Promise<import("../../../interface").UnlockGuide | null>;
@@ -1,58 +0,0 @@
1
- import { resolveRuntimeFromExportThis } from "../bootstrap/resolve-runtime-from-export-this";
2
- import { addPasswordForRuntime } from "../../../feature/unlock/method/add-password";
3
- import { cancelAddUnlockMethodForRuntime, startAddUnlockMethodForRuntime, } from "../../../feature/unlock/method/add-flow";
4
- import { deleteUnlockMethodForRuntime, updateUnlockMethodForRuntime, } from "../../../feature/unlock/method/update-remove";
5
- import { bindUnlockMethodForRuntime, bindUnlockMethodFromLogForRuntime, checkUnBindUnlockMethodsForRuntime, getUnbindUnlockMethodsForRuntime, unbindUnlockMethodForRuntime, } from "../../../feature/unlock/method/bind-unbind";
6
- import { getUnlockMethodDetailForRuntime } from "../../../feature/unlock/method/detail";
7
- import { getUnlockGuideForRuntime } from "../../../feature/unlock/method/guide";
8
- import { checkSpecialSupportPhoneForRuntime } from "../../../feature/unlock/method/internal/special-check";
9
- import { sendVerifyCodeForRuntime } from "../../../feature/unlock/method/verify-code";
10
- import { onAddUnlockMethodForRuntime, offAddUnlockMethodForRuntime, } from "../../../feature/unlock/method/add-method-events";
11
- export function getUnlockMethodDetail(id) {
12
- return getUnlockMethodDetailForRuntime(resolveRuntimeFromExportThis(this), id);
13
- }
14
- export function checkSpecialSupportPhone() {
15
- return checkSpecialSupportPhoneForRuntime(resolveRuntimeFromExportThis(this));
16
- }
17
- export function addPassword(params) {
18
- return addPasswordForRuntime(resolveRuntimeFromExportThis(this), params);
19
- }
20
- export function startAddUnlockMethod(params) {
21
- return startAddUnlockMethodForRuntime(resolveRuntimeFromExportThis(this), params);
22
- }
23
- export function cancelAddUnlockMethod(params) {
24
- return cancelAddUnlockMethodForRuntime(resolveRuntimeFromExportThis(this), params);
25
- }
26
- export function updateUnlockMethod(params) {
27
- return updateUnlockMethodForRuntime(resolveRuntimeFromExportThis(this), params);
28
- }
29
- export function deleteUnlockMethod(id) {
30
- return deleteUnlockMethodForRuntime(resolveRuntimeFromExportThis(this), id);
31
- }
32
- export function checkUnBindUnlockMethods() {
33
- return checkUnBindUnlockMethodsForRuntime(resolveRuntimeFromExportThis(this));
34
- }
35
- export function getUnbindUnlockMethods() {
36
- return getUnbindUnlockMethodsForRuntime(resolveRuntimeFromExportThis(this));
37
- }
38
- export function bindUnlockMethod(params) {
39
- return bindUnlockMethodForRuntime(resolveRuntimeFromExportThis(this), params);
40
- }
41
- export function unbindUnlockMethod(id) {
42
- return unbindUnlockMethodForRuntime(resolveRuntimeFromExportThis(this), id);
43
- }
44
- export function bindUnlockMethodFromLog(params) {
45
- return bindUnlockMethodFromLogForRuntime(resolveRuntimeFromExportThis(this), params);
46
- }
47
- export function sendVerifyCode(params) {
48
- return sendVerifyCodeForRuntime(resolveRuntimeFromExportThis(this), params);
49
- }
50
- export function onAddUnlockMethod(listener) {
51
- onAddUnlockMethodForRuntime(resolveRuntimeFromExportThis(this), listener);
52
- }
53
- export function offAddUnlockMethod(listener) {
54
- offAddUnlockMethodForRuntime(resolveRuntimeFromExportThis(this), listener);
55
- }
56
- export function getUnlockGuide(type) {
57
- return getUnlockGuideForRuntime(resolveRuntimeFromExportThis(this), type);
58
- }
@@ -1,23 +0,0 @@
1
- import type { EffectiveConfig } from "../../../../interface";
2
- export { openAddFamilyUser } from "../../../../feature/user/user";
3
- export declare function getUsers(params?: {
4
- page?: number;
5
- pageSize?: number;
6
- keyword?: string;
7
- }): Promise<import("../../../../feature/user/user").getUsersResult>;
8
- export declare function getUserInfo(params: {
9
- userId: string;
10
- }): Promise<import("../../../../interface").UserInfo>;
11
- export declare function updateUserLimitTime(params: {
12
- userId: string;
13
- lockUserId: number;
14
- permanent: boolean;
15
- effective?: EffectiveConfig;
16
- offlineUnlock?: boolean;
17
- }): Promise<void>;
18
- export declare function openFamilyUserDetail(userId: string): Promise<void>;
19
- export declare function addUser(params: {
20
- name: string;
21
- }): Promise<void>;
22
- export declare function removeUser(userId: string): Promise<void>;
23
- export * from "./sync";
@@ -1,22 +0,0 @@
1
- import { resolveRuntimeFromExportThis } from "../../bootstrap/resolve-runtime-from-export-this";
2
- import { getUsersForRuntime, getUserInfoForRuntime, updateUserLimitTimeForRuntime, openFamilyUserDetailForRuntime, addUserForRuntime, removeUserForRuntime, } from "../../../../feature/user/user";
3
- export { openAddFamilyUser } from "../../../../feature/user/user";
4
- export async function getUsers(params) {
5
- return getUsersForRuntime(resolveRuntimeFromExportThis(this), params);
6
- }
7
- export async function getUserInfo(params) {
8
- return getUserInfoForRuntime(resolveRuntimeFromExportThis(this), params);
9
- }
10
- export async function updateUserLimitTime(params) {
11
- return updateUserLimitTimeForRuntime(resolveRuntimeFromExportThis(this), params);
12
- }
13
- export async function openFamilyUserDetail(userId) {
14
- return openFamilyUserDetailForRuntime(resolveRuntimeFromExportThis(this), userId);
15
- }
16
- export async function addUser(params) {
17
- return addUserForRuntime(resolveRuntimeFromExportThis(this), params);
18
- }
19
- export async function removeUser(userId) {
20
- return removeUserForRuntime(resolveRuntimeFromExportThis(this), userId);
21
- }
22
- export * from "./sync";
@@ -1 +0,0 @@
1
- export declare function syncDeleteUsers(): Promise<void>;
@@ -1,5 +0,0 @@
1
- import { resolveRuntimeFromExportThis } from "../../bootstrap/resolve-runtime-from-export-this";
2
- import { syncDeleteUsersWithRuntime } from "../../../../feature/user/sync-user";
3
- export async function syncDeleteUsers() {
4
- return syncDeleteUsersWithRuntime(resolveRuntimeFromExportThis(this));
5
- }
@@ -1,8 +0,0 @@
1
- import type { LockSDKOption } from "../../interface";
2
- import type { LockSDKInstance } from "./build-instance";
3
- export * from "./exports";
4
- export type { LockSDKInstance };
5
- export type { LockSdkBoundExportThis } from "./bootstrap/resolve-runtime-from-export-this";
6
- export declare const createLockSDK: (options?: Omit<LockSDKOption, "preFetch">) => Promise<LockSDKInstance>;
7
- export declare const init: (options?: LockSDKOption) => Promise<void>;
8
- export declare const destroy: () => void;
@@ -1,39 +0,0 @@
1
- import { clearStateForRuntime } from "../../feature/state/clear";
2
- import { removeEvents } from "../../feature/state/platform-routing";
3
- import { bootstrapRegisteredLockInstance } from "./bootstrap/bootstrap-lock-instance";
4
- import { clearPrimaryLockSDKInstance, setPrimaryLockSDKInstance, } from "./bootstrap/primary-instance";
5
- import { clearAllRuntimes, getRegisteredRuntimeCount, listRegisteredRuntimes, } from "../../runtime/registry";
6
- import { getLaunchOptionsSync } from "../../platform/device";
7
- import { getError } from "../../utils/errors";
8
- export * from "./exports";
9
- export const createLockSDK = async (options) => {
10
- const { instance } = await bootstrapRegisteredLockInstance({
11
- ...options,
12
- preFetch: false,
13
- });
14
- return instance;
15
- };
16
- export const init = async (options) => {
17
- if (getRegisteredRuntimeCount() >= 1) {
18
- destroy();
19
- }
20
- const opts = { ...options };
21
- const { devInfo, deviceId } = opts;
22
- if (!devInfo && !deviceId) {
23
- const { query } = getLaunchOptionsSync();
24
- opts.deviceId = query.deviceId;
25
- if (!opts.deviceId) {
26
- throw getError(1000);
27
- }
28
- }
29
- const { instance } = await bootstrapRegisteredLockInstance(opts);
30
- setPrimaryLockSDKInstance(instance);
31
- };
32
- export const destroy = () => {
33
- removeEvents();
34
- for (const rt of listRegisteredRuntimes()) {
35
- clearStateForRuntime(rt);
36
- }
37
- clearAllRuntimes();
38
- clearPrimaryLockSDKInstance();
39
- };
@@ -1,7 +0,0 @@
1
- import type { LockSDKOption } from "../../../interface";
2
- import type { LockDeviceRuntime } from "../../../runtime/LockDeviceRuntime";
3
- import { type FitSDKInstance } from "../build-instance";
4
- export declare function bootstrapRegisteredFitInstance(options?: LockSDKOption): Promise<{
5
- runtime: LockDeviceRuntime;
6
- instance: FitSDKInstance;
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 { buildFitSDKInstance } from "../build-instance";
5
- import { createBootstrappedRuntime } from "./bootstrap";
6
- export async function bootstrapRegisteredFitInstance(options) {
7
- const runtime = await createBootstrappedRuntime(options);
8
- registerRuntime(runtime);
9
- addEvents(runtime);
10
- await initState(runtime);
11
- return { runtime, instance: buildFitSDKInstance(runtime) };
12
- }
@@ -1,4 +0,0 @@
1
- import type { LockSDKOption } from "../../../interface";
2
- import { LockDeviceRuntime } from "../../../runtime/LockDeviceRuntime";
3
- export declare function applyFitOptionsToRuntime(runtime: LockDeviceRuntime, options?: LockSDKOption): Promise<void>;
4
- export declare function createBootstrappedRuntime(options?: LockSDKOption): Promise<LockDeviceRuntime>;
@@ -1,69 +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
- import { sdkLog, setSDKLogConfig } from "../../../utils/sdk-log";
6
- export async function applyFitOptionsToRuntime(runtime, options) {
7
- setSDKLogConfig({
8
- level: options?.logLevel ?? "warn",
9
- sink: options?.logger,
10
- console: options?.logToConsole ?? false,
11
- });
12
- const { config } = runtime;
13
- let { devInfo, deviceId } = options || {};
14
- if (!devInfo && !deviceId) {
15
- throw new Error("deviceId is required in fit sdk");
16
- }
17
- if (deviceId && (!devInfo || devInfo.devId !== deviceId)) {
18
- devInfo = await getDeviceInfo(deviceId);
19
- }
20
- let dpSchema = {};
21
- const codesById = {};
22
- const idsByCode = {};
23
- if (devInfo.schema) {
24
- dpSchema = devInfo.schema.reduce((acc, cur) => {
25
- acc[cur.code] = cur;
26
- codesById[cur.id] = cur.code;
27
- idsByCode[cur.code] = cur.id;
28
- return acc;
29
- }, {});
30
- }
31
- else if (devInfo.dpSchema) {
32
- dpSchema = devInfo.dpSchema;
33
- Object.keys(dpSchema).forEach((key) => {
34
- const item = dpSchema[key];
35
- codesById[item.id] = item.code;
36
- idsByCode[item.code] = item.id;
37
- });
38
- }
39
- config.strictMode = options?.strictMode ?? true;
40
- config.passwordDigitalBase = options?.passwordDigitalBase ?? 10;
41
- config.passwordSupportZero = options?.passwordSupportZero ?? true;
42
- config.supportMultipleFace = options?.supportMultipleFace ?? false;
43
- config.supportOfflineDps = options?.supportOfflineDps ?? false;
44
- config.devInfo = devInfo;
45
- config.dpSchema = dpSchema;
46
- config.codesById = codesById;
47
- config.idsByCode = idsByCode;
48
- config.supportBigData = !!dpSchema[dpCodes.synchMethodW];
49
- config.preFetch = options?.preFetch ?? false;
50
- config.communication = getCapabilities(devInfo.capability).map((item) => item.id);
51
- sdkLog("info", "fit-bootstrap", "applyOptions", {
52
- devId: config.devInfo.devId,
53
- data: {
54
- productId: config.devInfo.productId,
55
- strictMode: config.strictMode,
56
- supportOfflineDps: config.supportOfflineDps,
57
- supportBigData: config.supportBigData,
58
- communication: config.communication,
59
- },
60
- });
61
- trackEvent("t$y_UztB3Lj9Qns375R0r7dA0L5Kr2VytH3J".replace("$", ""), {
62
- pid: devInfo.productId,
63
- });
64
- }
65
- export async function createBootstrappedRuntime(options) {
66
- const runtime = new LockDeviceRuntime();
67
- await applyFitOptionsToRuntime(runtime, options);
68
- return runtime;
69
- }
@@ -1,3 +0,0 @@
1
- import type { LockDeviceRuntime } from "../../../runtime/LockDeviceRuntime";
2
- export declare function registerFitSDKInstanceRuntime(instance: object, runtime: LockDeviceRuntime): void;
3
- export declare function getRuntimeForFitSDKInstance(instance: object): LockDeviceRuntime | undefined;
@@ -1,7 +0,0 @@
1
- const runtimeByInstance = new WeakMap();
2
- export function registerFitSDKInstanceRuntime(instance, runtime) {
3
- runtimeByInstance.set(instance, runtime);
4
- }
5
- export function getRuntimeForFitSDKInstance(instance) {
6
- return runtimeByInstance.get(instance);
7
- }
@@ -1,6 +0,0 @@
1
- import type { LockDeviceRuntime } from "../../../runtime/LockDeviceRuntime";
2
- import type { FitSDKInstance } from "../build-instance";
3
- export declare function setPrimaryFitSDKInstance(instance: FitSDKInstance): void;
4
- export declare function getPrimaryFitSDKRuntime(): LockDeviceRuntime | null;
5
- export declare function clearPrimaryFitSDKInstance(): void;
6
- export declare function clearPrimaryFitSDKInstanceIfDevId(devId: string): void;
@@ -1,24 +0,0 @@
1
- import { getRuntimeForFitSDKInstance } from "./lock-instance-runtime-ref";
2
- let primaryDevId = null;
3
- let primaryRuntime = null;
4
- export function setPrimaryFitSDKInstance(instance) {
5
- const runtime = getRuntimeForFitSDKInstance(instance);
6
- if (!runtime) {
7
- throw new Error("setPrimaryFitSDKInstance: instance must be returned by createFitSDK or init");
8
- }
9
- primaryDevId = runtime.devId;
10
- primaryRuntime = runtime;
11
- }
12
- export function getPrimaryFitSDKRuntime() {
13
- return primaryRuntime;
14
- }
15
- export function clearPrimaryFitSDKInstance() {
16
- primaryDevId = null;
17
- primaryRuntime = null;
18
- }
19
- export function clearPrimaryFitSDKInstanceIfDevId(devId) {
20
- if (primaryDevId === devId) {
21
- primaryDevId = null;
22
- primaryRuntime = null;
23
- }
24
- }