@ray-js/lock-sdk 1.2.0-beta.10 → 1.2.0-beta.11

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.
@@ -18,7 +18,7 @@ export const initFit = async (options) => {
18
18
  const { devInfo, deviceId } = opts;
19
19
  if (!devInfo && !deviceId) {
20
20
  const { query } = getLaunchOptionsSync();
21
- opts.deviceId = query.deviceId;
21
+ opts.deviceId = query['deviceId'];
22
22
  if (!opts.deviceId) {
23
23
  throw getError(1000);
24
24
  }
@@ -47,6 +47,7 @@ export async function applyLockOptionsToRuntime(runtime, options) {
47
47
  config.idsByCode = idsByCode;
48
48
  config.supportBigData = !!dpSchema[dpCodes.synchMethodW];
49
49
  config.preFetch = options?.preFetch ?? false;
50
+ config.notSupportWake = options?.notSupportWake ?? false;
50
51
  config.communication = getCapabilities(devInfo.capability).map((item) => item.id);
51
52
  sdkLog("info", "bootstrap", "applyOptions", {
52
53
  devId: config.devInfo.devId,
@@ -14,5 +14,5 @@ export interface UpdateDpPeriodTimeOption {
14
14
  }
15
15
  export declare function updateDpPeriodTime(dpCode: string, data: UpdateDpPeriodTimeParams, option?: UpdateDpPeriodTimeOption): Promise<void>;
16
16
  export declare function connectDevice(): Promise<true>;
17
- export declare function gotoService(params?: GotoServiceParams): Promise<unknown>;
17
+ export declare function gotoService(params?: GotoServiceParams): Promise<void>;
18
18
  export declare function validatePwdComplexity(password: string): Promise<boolean>;
@@ -18,7 +18,7 @@ export const init = async (options) => {
18
18
  const { devInfo, deviceId } = opts;
19
19
  if (!devInfo && !deviceId) {
20
20
  const { query } = getLaunchOptionsSync();
21
- opts.deviceId = query.deviceId;
21
+ opts.deviceId = query['deviceId'];
22
22
  if (!opts.deviceId) {
23
23
  throw getError(1000);
24
24
  }
@@ -1,6 +1,7 @@
1
1
  import { getDeviceAdvancedAbility, getProductAbilities } from "../../api";
2
2
  import { ProductCommunicationType } from "../../constant";
3
3
  import { checkShowMatterMutilpleShare } from "../../platform/device";
4
+ import { ipc } from "../../platform";
4
5
  export const hasCapabilityForRuntime = (runtime, capability) => runtime.config.communication.includes(capability);
5
6
  export const isBlePureDeviceForRuntime = (rt) => hasCapabilityForRuntime(rt, ProductCommunicationType.BLUETOOTH) &&
6
7
  rt.config.communication.length === 1;
@@ -56,7 +57,7 @@ export const getDeviceAdvancedAbilitiesForRuntime = async (rt) => {
56
57
  if (rt.cache.deviceAdvanceAbilityCache) {
57
58
  return rt.cache.deviceAdvanceAbilityCache;
58
59
  }
59
- const [productAbilitiesRes, deviceAdvancedAbilityRes] = await Promise.allSettled([
60
+ const [productAbilitiesRes, deviceAdvancedAbilityRes, tttList] = await Promise.allSettled([
60
61
  getProductAbilities(rt.config.devInfo.devId, [
61
62
  "tyabi4ucx5",
62
63
  "tyabis9tpe",
@@ -66,11 +67,13 @@ export const getDeviceAdvancedAbilitiesForRuntime = async (rt) => {
66
67
  "visual_door_lock_cloud_store",
67
68
  ]),
68
69
  getDeviceAdvancedAbility(rt.config.devInfo.devId),
70
+ ipc.getTTTAbilityKeyList("isSupportedVRMode"),
69
71
  ]);
70
72
  const productAbilities = productAbilitiesRes.status === "fulfilled" ? productAbilitiesRes.value : [];
71
73
  const deviceAdvancedAbility = deviceAdvancedAbilityRes.status === "fulfilled"
72
74
  ? deviceAdvancedAbilityRes.value
73
75
  : undefined;
76
+ const tttAbList = tttList.status === "fulfilled" ? tttList.value.abilityList : [];
74
77
  const deviceAdvanceAbilityCache = {
75
78
  cloudStorage: {
76
79
  support: deviceAdvancedAbility?.types?.includes(0) ?? false,
@@ -127,26 +130,9 @@ export const getDeviceAdvancedAbilitiesForRuntime = async (rt) => {
127
130
  petRecognition ||
128
131
  voice ||
129
132
  message;
130
- deviceAdvanceAbilityCache.vr.support = !!data?.lock_VR;
133
+ deviceAdvanceAbilityCache.vr.support =
134
+ !!data?.lock_VR && tttAbList.length > 0;
131
135
  if (deviceAdvanceAbilityCache.vr.support) {
132
- const modeMap = {
133
- original: {
134
- mode: "original",
135
- value: 0,
136
- },
137
- VR: {
138
- mode: "VR",
139
- value: 1,
140
- },
141
- horizontal: {
142
- mode: "horizontal",
143
- value: 2,
144
- },
145
- vertical: {
146
- mode: "vertical",
147
- value: 3,
148
- },
149
- };
150
136
  deviceAdvanceAbilityCache.vr.modes = allModes.filter((item) => {
151
137
  return data?.modes?.includes(item.mode);
152
138
  });
@@ -154,7 +140,7 @@ export const getDeviceAdvancedAbilitiesForRuntime = async (rt) => {
154
140
  const exist = deviceAdvanceAbilityCache.vr.modes.find((x) => x.mode === deviceAdvanceAbilityCache.vr.defaultMode);
155
141
  if (!exist) {
156
142
  deviceAdvanceAbilityCache.vr.defaultMode =
157
- deviceAdvanceAbilityCache.vr.modes?.[0].mode;
143
+ deviceAdvanceAbilityCache.vr.modes?.[0]?.mode;
158
144
  }
159
145
  deviceAdvanceAbilityCache.vr.coverMode = data.photo_cover_format;
160
146
  }
@@ -154,10 +154,11 @@ export async function connectDeviceForRuntime(rt) {
154
154
  data: {
155
155
  statusType: deviceStatus.type,
156
156
  onlineTypes: deviceStatus.onlineTypes,
157
+ connectEnable: deviceStatus.connectEnable,
157
158
  hasWirelessAwakeDp,
158
159
  },
159
160
  });
160
- if (hasWirelessAwakeDp) {
161
+ if (deviceStatus.connectEnable && hasWirelessAwakeDp) {
161
162
  if (cfg.devInfo.isCloudOnline && !getDpValueForRuntime(rt, wirelessAwake)) {
162
163
  const result = await awakeDevice(devId);
163
164
  sdkLog("info", "connectDevice", "success", {
@@ -3,4 +3,4 @@ export interface GotoServiceParams {
3
3
  tab?: "cloudStorage" | "AI" | "voip";
4
4
  showGift?: boolean;
5
5
  }
6
- export declare function gotoServiceForRuntime(rt: LockDeviceRuntime, params?: GotoServiceParams): Promise<unknown>;
6
+ export declare function gotoServiceForRuntime(rt: LockDeviceRuntime, params?: GotoServiceParams): Promise<void>;
@@ -23,7 +23,7 @@ export const updateOnlineType = async (runtime) => {
23
23
  updateDeviceStatus(runtime);
24
24
  };
25
25
  export const getDeviceStatusForRuntime = (runtime) => {
26
- const { onlineType, devInfo: { isCloudOnline, isOnline, wifiEnableState, isMatter }, } = runtime.config;
26
+ const { onlineType, notSupportWake, devInfo: { isCloudOnline, isOnline, wifiEnableState, isMatter }, } = runtime.config;
27
27
  const supportWifi = hasCapabilityForRuntime(runtime, ProductCommunicationType.WIFI);
28
28
  const supportBle = hasCapabilityForRuntime(runtime, ProductCommunicationType.BLUETOOTH);
29
29
  const supportThread = hasCapabilityForRuntime(runtime, ProductCommunicationType.THREAD);
@@ -38,7 +38,7 @@ export const getDeviceStatusForRuntime = (runtime) => {
38
38
  const isMatterLocal = isOnlineByType(onlineType, 8);
39
39
  const isBleOnline = isOnlineByType(onlineType, 2);
40
40
  const isLocalOnline = !isCloudOnline && isOnlineByType(onlineType, 1);
41
- const hasWirelessAwakeDp = hasDpForRuntime(runtime, dpCodes.wirelessAwake);
41
+ const hasWirelessAwakeDp = !notSupportWake && hasDpForRuntime(runtime, dpCodes.wirelessAwake);
42
42
  const wirelessAwake = getDpValueForRuntime(runtime, dpCodes.wirelessAwake);
43
43
  status.connectEnable = isSupportBleControlForRuntime(runtime) && !isOnline;
44
44
  if (supportWifi) {
@@ -12,6 +12,7 @@ export interface LockSDKOption {
12
12
  supportMultipleFace?: boolean;
13
13
  supportOfflineDps?: boolean;
14
14
  preFetch?: boolean;
15
+ notSupportWake?: boolean;
15
16
  logLevel?: SDKLogLevel;
16
17
  logger?: SDKLogSink;
17
18
  logToConsole?: boolean;
@@ -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;
@@ -24,6 +24,7 @@ export type LockConfigState = {
24
24
  supportTalk: boolean;
25
25
  isTwoWayTalk: boolean;
26
26
  cameraConfig: CameraConfig[];
27
+ notSupportWake: boolean;
27
28
  };
28
29
  export declare function createDefaultDeviceStatus(): DeviceStatus;
29
30
  export declare function createLockConfigState(): LockConfigState;
@@ -34,5 +34,6 @@ export function createLockConfigState() {
34
34
  supportTalk: false,
35
35
  isTwoWayTalk: false,
36
36
  cameraConfig: [],
37
+ notSupportWake: false
37
38
  };
38
39
  }
@@ -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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/lock-sdk",
3
- "version": "1.2.0-beta.10",
3
+ "version": "1.2.0-beta.11",
4
4
  "files": [
5
5
  "lib",
6
6
  "LICENSE.md"