@ray-js/lock-sdk 1.2.0-beta.2 → 1.2.0-beta.21

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 (80) hide show
  1. package/lib/api/gesture.d.ts +11 -0
  2. package/lib/api/gesture.js +18 -0
  3. package/lib/api/log.d.ts +21 -4
  4. package/lib/api/notify.d.ts +28 -0
  5. package/lib/api/notify.js +17 -0
  6. package/lib/api/service.d.ts +26 -0
  7. package/lib/api/service.js +25 -0
  8. package/lib/api/video.d.ts +9 -0
  9. package/lib/api/video.js +30 -0
  10. package/lib/api/voip.d.ts +10 -0
  11. package/lib/api/voip.js +17 -0
  12. package/lib/config/dp-code/index.d.ts +1 -0
  13. package/lib/config/dp-code/index.js +1 -0
  14. package/lib/config/dp-map/media.d.ts +13 -0
  15. package/lib/config/dp-map/media.js +19 -0
  16. package/lib/entries/fit/bootstrap/bootstrap-lock-instance.js +16 -5
  17. package/lib/entries/fit/index.js +1 -1
  18. package/lib/entries/main/bootstrap/bootstrap-lock-instance.js +16 -5
  19. package/lib/entries/main/bootstrap/bootstrap.js +2 -0
  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/gesture.d.ts +6 -0
  23. package/lib/entries/main/exports/gesture.js +8 -0
  24. package/lib/entries/main/exports/index.d.ts +4 -0
  25. package/lib/entries/main/exports/index.js +4 -0
  26. package/lib/entries/main/exports/media.d.ts +10 -1
  27. package/lib/entries/main/exports/media.js +29 -1
  28. package/lib/entries/main/exports/misc.d.ts +1 -1
  29. package/lib/entries/main/exports/notify.d.ts +7 -0
  30. package/lib/entries/main/exports/notify.js +8 -0
  31. package/lib/entries/main/exports/service.d.ts +4 -0
  32. package/lib/entries/main/exports/service.js +11 -0
  33. package/lib/entries/main/exports/voip.d.ts +3 -0
  34. package/lib/entries/main/exports/voip.js +8 -0
  35. package/lib/entries/main/index.js +1 -1
  36. package/lib/feature/gesture/gesture.d.ts +6 -0
  37. package/lib/feature/gesture/gesture.js +3 -0
  38. package/lib/feature/log/log.js +34 -2
  39. package/lib/feature/media/camera.d.ts +18 -0
  40. package/lib/feature/media/camera.js +36 -0
  41. package/lib/feature/media/media.d.ts +10 -0
  42. package/lib/feature/media/media.js +31 -0
  43. package/lib/feature/misc/ble-control.js +1 -1
  44. package/lib/feature/misc/capability.d.ts +2 -0
  45. package/lib/feature/misc/capability.js +77 -10
  46. package/lib/feature/misc/connect-device.js +2 -1
  47. package/lib/feature/notify/notify.d.ts +4 -0
  48. package/lib/feature/notify/notify.js +3 -0
  49. package/lib/feature/password/temporary/custom-dp.js +59 -54
  50. package/lib/feature/service/goto-service.d.ts +3 -2
  51. package/lib/feature/service/goto-service.js +7 -1
  52. package/lib/feature/service/value-added.d.ts +4 -0
  53. package/lib/feature/service/value-added.js +4 -0
  54. package/lib/feature/state/device-status.js +2 -2
  55. package/lib/feature/state/init-state.js +17 -11
  56. package/lib/feature/state/platform-routing.js +8 -2
  57. package/lib/feature/state/remote-permissions.js +17 -0
  58. package/lib/feature/storage/index.d.ts +5 -0
  59. package/lib/feature/storage/index.js +32 -0
  60. package/lib/feature/storage/swr-cache.d.ts +7 -0
  61. package/lib/feature/storage/swr-cache.js +54 -0
  62. package/lib/feature/unlock/sync/unlock-method.js +3 -0
  63. package/lib/feature/voip/voip.d.ts +3 -0
  64. package/lib/feature/voip/voip.js +3 -0
  65. package/lib/interface.d.ts +27 -1
  66. package/lib/platform/device.d.ts +4 -3
  67. package/lib/platform/index.d.ts +1 -0
  68. package/lib/platform/index.js +1 -0
  69. package/lib/platform/ipc.d.ts +3 -0
  70. package/lib/platform/ipc.js +13 -0
  71. package/lib/platform/storage.d.ts +3 -0
  72. package/lib/platform/storage.js +9 -0
  73. package/lib/runtime/lock-config.d.ts +4 -1
  74. package/lib/runtime/lock-config.js +3 -0
  75. package/lib/utils/constant.d.ts +1 -0
  76. package/lib/utils/constant.js +6 -0
  77. package/lib/utils/errors.js +3 -1
  78. package/lib/utils/index.d.ts +1 -1
  79. package/lib/utils/parse.js +1 -1
  80. package/package.json +1 -1
@@ -6,6 +6,7 @@ import { LOGCHANGE } from "../../utils/constant";
6
6
  import emitter from "../../utils/event";
7
7
  import { handleLocalOperation } from "../../utils/log";
8
8
  import { parseWeek } from "../../utils";
9
+ import { cameraPositionMap } from "../../utils/constant";
9
10
  export function getLogsRefreshEvent(runtime) {
10
11
  return `${LOGCHANGE}_${runtime.devId}`;
11
12
  }
@@ -152,7 +153,20 @@ function handleLockLogs(list, cfg) {
152
153
  userId: item.userId,
153
154
  userName: userName || "",
154
155
  unlockName: unlockName || "",
155
- mediaInfo: item.mediaInfoList,
156
+ mediaInfo: item.mediaInfoList?.map?.(item => {
157
+ return {
158
+ mediaPath: item.mediaPath,
159
+ fileKey: item.fileKey,
160
+ fileUrl: item.fileUrl,
161
+ mediaBucket: item.mediaBucket,
162
+ mediaKey: item.mediaKey,
163
+ width: item.positionWidth,
164
+ height: item.positionHeight,
165
+ angle: item.positionAngle,
166
+ isVR: !!item.positionVr,
167
+ position: item.position,
168
+ };
169
+ }),
156
170
  localRecord: handleLocalOperation(item.localOperateRecordInfo, itemData),
157
171
  unionUnlockInfo: item.unionUnlockInfo?.map((item1) => {
158
172
  return {
@@ -285,7 +299,20 @@ export async function getLogsForRuntime(rt, params) {
285
299
  dpCode,
286
300
  userName,
287
301
  unlockName,
288
- mediaInfo: record.mediaInfoList,
302
+ mediaInfo: record.mediaInfoList?.map?.(item => {
303
+ return {
304
+ mediaPath: item.mediaPath,
305
+ fileKey: item.fileKey,
306
+ fileUrl: item.fileUrl,
307
+ mediaBucket: item.mediaBucket,
308
+ mediaKey: item.mediaKey,
309
+ width: item.positionWidth,
310
+ height: item.positionHeight,
311
+ angle: item.positionAngle,
312
+ isVR: !!item.positionVr,
313
+ position: item.position,
314
+ };
315
+ }),
289
316
  unionUnlockInfo: record.unionUnlockInfo?.map((item) => ({
290
317
  userId: item.userId,
291
318
  userName: item.userName,
@@ -418,6 +445,11 @@ export async function getAlbumsForRuntime(rt, params) {
418
445
  })),
419
446
  type: item.eventType,
420
447
  createTime: item.uploadMilTime,
448
+ width: item.width,
449
+ height: item.height,
450
+ angle: item.angle,
451
+ position: cameraPositionMap[item.position],
452
+ isVR: !!item.vr,
421
453
  })),
422
454
  allAitypes: data.allAitypes,
423
455
  types: data.eventTypes,
@@ -0,0 +1,18 @@
1
+ import type { LockDeviceRuntime } from "../../runtime/LockDeviceRuntime";
2
+ import type { CameraConfig, DpMapDataType } from "../../interface";
3
+ import { locationSelectReportMap } from "../../config/dp-map/media";
4
+ export type CameraInfo = DpMapDataType<typeof locationSelectReportMap>;
5
+ export declare const isSupportMultiCameraForRuntime: (runtime: LockDeviceRuntime) => boolean;
6
+ interface CameraItem {
7
+ index: number;
8
+ type: number;
9
+ }
10
+ export interface CameraDpInfo {
11
+ status: number;
12
+ list: CameraItem[];
13
+ }
14
+ export declare const getCameraInfoForRuntime: (runtime: LockDeviceRuntime) => CameraDpInfo | undefined;
15
+ export declare const queryCameraInfoForRuntime: (runtime: LockDeviceRuntime) => Promise<CameraInfo | undefined>;
16
+ export declare const switchCameraForRuntime: (runtime: LockDeviceRuntime, index: number) => Promise<true>;
17
+ export declare const getCameraConfigForRuntime: (runtime: LockDeviceRuntime) => CameraConfig[];
18
+ export {};
@@ -0,0 +1,36 @@
1
+ import dpUtils from "@ray-js/tuya-dp-transform";
2
+ import dpCodes from "../../config/dp-code";
3
+ import { locationSelectReportMap } from "../../config/dp-map/media";
4
+ import { getDpValueForRuntime } from "../dp/get-dp-value";
5
+ import { hasDpForRuntime } from "../dp/has-dp";
6
+ import { publishDpsForRuntime } from "../dp/publish-dps";
7
+ import { getError } from "../../utils/errors";
8
+ export const isSupportMultiCameraForRuntime = (runtime) => hasDpForRuntime(runtime, dpCodes.locationSelect);
9
+ export const getCameraInfoForRuntime = (runtime) => {
10
+ const raw = getDpValueForRuntime(runtime, dpCodes.locationSelect);
11
+ if (!raw) {
12
+ return undefined;
13
+ }
14
+ return dpUtils.parse(raw, locationSelectReportMap);
15
+ };
16
+ export const queryCameraInfoForRuntime = async (runtime) => {
17
+ await publishDpsForRuntime(runtime, { [dpCodes.locationSelect]: "ff" });
18
+ return getCameraInfoForRuntime(runtime);
19
+ };
20
+ export const switchCameraForRuntime = async (runtime, index) => {
21
+ const value = index.toString(16).padStart(2, "0");
22
+ await publishDpsForRuntime(runtime, { [dpCodes.locationSelect]: value });
23
+ const info = getCameraInfoForRuntime(runtime);
24
+ switch (info?.status) {
25
+ case 0:
26
+ return true;
27
+ case 2:
28
+ throw getError(1105);
29
+ case 1:
30
+ default:
31
+ throw getError(1104);
32
+ }
33
+ };
34
+ export const getCameraConfigForRuntime = (runtime) => {
35
+ return runtime.config.cameraConfig;
36
+ };
@@ -1,4 +1,5 @@
1
1
  import type { LockDeviceRuntime } from "../../runtime/LockDeviceRuntime";
2
+ import { MediaViewTimesResult, getAlbumDateListResult } from "../../api/video";
2
3
  export interface GetMediaUrlParams {
3
4
  mediaPath: string;
4
5
  mediaBucket: string;
@@ -19,6 +20,12 @@ export interface OpenLocalAlbumParams {
19
20
  serviceCode?: string;
20
21
  }
21
22
  export declare const openLocalAlbumForRuntime: (runtime: LockDeviceRuntime, params?: OpenLocalAlbumParams) => Promise<void>;
23
+ export interface GotoPlaybackParams {
24
+ tabs?: ("local" | "cloud")[];
25
+ isLowPower?: boolean;
26
+ rotate?: number;
27
+ }
28
+ export declare const gotoPlaybackForRuntime: (runtime: LockDeviceRuntime, params?: GotoPlaybackParams) => Promise<void>;
22
29
  export interface MediaInfo {
23
30
  imageAngle: number;
24
31
  videoAngle: number;
@@ -29,3 +36,6 @@ export interface MediaInfo {
29
36
  isTwoWayTalk: boolean;
30
37
  }
31
38
  export declare const getMediaInfoForRuntime: (runtime: LockDeviceRuntime) => MediaInfo;
39
+ export declare const getMediaViewTimesForRuntime: (runtime: LockDeviceRuntime) => Promise<MediaViewTimesResult>;
40
+ export declare const setMediaViewTimesForRuntime: (runtime: LockDeviceRuntime) => Promise<MediaViewTimesResult>;
41
+ export declare const getAlbumDateListForRuntime: (runtime: LockDeviceRuntime) => Promise<getAlbumDateListResult>;
@@ -4,6 +4,7 @@ import dpCodes from "../../config/dp-code";
4
4
  import { RotateType, VedioType } from "../../constant";
5
5
  import { isSupportShortLink } from "../../platform";
6
6
  import { getError } from "../../utils/errors";
7
+ import { getMediaViewTimes, setMediaViewTimes, getAlbumDateList, } from "../../api/video";
7
8
  export const getMediaUrlForRuntime = async (runtime, params) => {
8
9
  const devId = runtime.config.devInfo.devId;
9
10
  if ("mediaPath" in params && "mediaBucket" in params) {
@@ -52,6 +53,27 @@ export const openLocalAlbumForRuntime = async (runtime, params) => {
52
53
  }
53
54
  return Promise.reject(getError(1013));
54
55
  };
56
+ export const gotoPlaybackForRuntime = async (runtime, params) => {
57
+ const link = await isSupportShortLink("camera_playbacks_panel");
58
+ if (!link) {
59
+ return Promise.reject(getError(1013));
60
+ }
61
+ const tabs = params?.tabs && params.tabs.length ? params.tabs : ["local"];
62
+ let url = `tuyaSmart://${link}?extra_camera_uuid=${runtime.devId}&devId=${runtime.devId}&bizType=doorLock&defaultShowTabs=true&theme=1&tabs=${JSON.stringify(tabs)}`;
63
+ if (params?.isLowPower) {
64
+ url += `&isLowPowerDevice=true`;
65
+ }
66
+ if (params?.rotate !== undefined) {
67
+ url += `&rotate=${params.rotate}`;
68
+ }
69
+ return new Promise((resolve, reject) => {
70
+ ty.router({
71
+ url,
72
+ success: () => resolve(),
73
+ fail: (e) => reject(e),
74
+ });
75
+ });
76
+ };
55
77
  export const getMediaInfoForRuntime = (runtime) => {
56
78
  const isSEI = runtime.config.capabilities?.rotateType === RotateType.SEI;
57
79
  return {
@@ -64,3 +86,12 @@ export const getMediaInfoForRuntime = (runtime) => {
64
86
  isTwoWayTalk: runtime.config.isTwoWayTalk,
65
87
  };
66
88
  };
89
+ export const getMediaViewTimesForRuntime = (runtime) => {
90
+ return getMediaViewTimes(runtime.config.devInfo.devId);
91
+ };
92
+ export const setMediaViewTimesForRuntime = (runtime) => {
93
+ return setMediaViewTimes(runtime.config.devInfo.devId);
94
+ };
95
+ export const getAlbumDateListForRuntime = (runtime) => {
96
+ return getAlbumDateList(runtime.config.devInfo.devId);
97
+ };
@@ -29,7 +29,7 @@ export const isSupportBleControlForRuntime = (rt) => {
29
29
  const hasReportTime = !reportTIme ||
30
30
  Math.floor(Number(reportTIme) / 1000) <= devInfo.activeTime;
31
31
  const bleVal = rt.cache.dpState[dpCodes.bleControl];
32
- if (!bleVal || !hasReportTime) {
32
+ if (!hasReportTime) {
33
33
  return true;
34
34
  }
35
35
  return bleVal;
@@ -5,4 +5,6 @@ export declare const hasCapabilityForRuntime: (runtime: LockDeviceRuntime, capab
5
5
  export declare const isBlePureDeviceForRuntime: (rt: LockDeviceRuntime) => boolean;
6
6
  export declare const isShareTheadForRuntime: (rt: LockDeviceRuntime) => boolean;
7
7
  export declare const isActiveThreadForRuntime: (rt: LockDeviceRuntime) => Promise<boolean>;
8
+ export declare const getDeviceAdvancedAbilitiesSyncForRuntime: (rt: LockDeviceRuntime) => DeviceAdvancedAbility | undefined;
8
9
  export declare const getDeviceAdvancedAbilitiesForRuntime: (rt: LockDeviceRuntime) => Promise<DeviceAdvancedAbility>;
10
+ export declare const getDeviceCapabilitiesForRuntime: (rt: LockDeviceRuntime) => import("../../interface").CapabilityInfo | null;
@@ -1,6 +1,8 @@
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";
5
+ import { getWithLocalCache } from "../storage/swr-cache";
4
6
  export const hasCapabilityForRuntime = (runtime, capability) => runtime.config.communication.includes(capability);
5
7
  export const isBlePureDeviceForRuntime = (rt) => hasCapabilityForRuntime(rt, ProductCommunicationType.BLUETOOTH) &&
6
8
  rt.config.communication.length === 1;
@@ -34,23 +36,55 @@ export const isActiveThreadForRuntime = async (rt) => {
34
36
  }
35
37
  return false;
36
38
  };
39
+ const allModes = [
40
+ {
41
+ mode: "VR",
42
+ value: 1,
43
+ },
44
+ {
45
+ mode: "original",
46
+ value: 0,
47
+ },
48
+ {
49
+ mode: "vertical",
50
+ value: 3,
51
+ },
52
+ {
53
+ mode: "horizontal",
54
+ value: 2,
55
+ },
56
+ ];
57
+ export const getDeviceAdvancedAbilitiesSyncForRuntime = (rt) => {
58
+ return rt.cache.deviceAdvanceAbilityCache;
59
+ };
37
60
  export const getDeviceAdvancedAbilitiesForRuntime = async (rt) => {
38
61
  if (rt.cache.deviceAdvanceAbilityCache) {
39
62
  return rt.cache.deviceAdvanceAbilityCache;
40
63
  }
41
- const [productAbilities, deviceAdvancedAbility] = await Promise.all([
42
- getProductAbilities(rt.config.devInfo.devId, [
64
+ const devId = rt.config.devInfo.devId;
65
+ const [productAbilitiesRes, deviceAdvancedAbilityRes, tttList] = await Promise.allSettled([
66
+ getWithLocalCache(rt, "productAbilities", () => getProductAbilities(devId, [
43
67
  "tyabi4ucx5",
44
68
  "tyabis9tpe",
45
69
  "tyabiwxrn9",
46
70
  "tyabipd4hh",
47
71
  "tyabin4u5v",
48
- ]),
49
- getDeviceAdvancedAbility(rt.config.devInfo.devId),
72
+ "visual_door_lock_cloud_store",
73
+ ])),
74
+ getWithLocalCache(rt, "deviceAdvancedAbility", () => getDeviceAdvancedAbility(devId)),
75
+ ipc.getTTTAbilityKeyList("isSupportedVRMode"),
50
76
  ]);
77
+ const productAbilities = productAbilitiesRes.status === "fulfilled" ? productAbilitiesRes.value : [];
78
+ const tttAbList = tttList.status === "fulfilled" ? tttList.value.abilityList : [];
51
79
  const deviceAdvanceAbilityCache = {
52
80
  cloudStorage: {
53
- support: deviceAdvancedAbility.types.includes(0),
81
+ support: false,
82
+ },
83
+ vr: {
84
+ support: false,
85
+ defaultMode: "VR",
86
+ modes: [],
87
+ coverMode: "VR",
54
88
  },
55
89
  ai: {
56
90
  support: false,
@@ -61,12 +95,12 @@ export const getDeviceAdvancedAbilitiesForRuntime = async (rt) => {
61
95
  config: {},
62
96
  },
63
97
  voip: {
64
- support: deviceAdvancedAbility.types.includes(1),
98
+ support: false,
65
99
  config: {},
66
100
  },
67
101
  wechatVoip: {
68
102
  support: false,
69
- config: {},
103
+ isPublice: true,
70
104
  },
71
105
  unlockGuide: {
72
106
  support: false,
@@ -80,8 +114,11 @@ export const getDeviceAdvancedAbilitiesForRuntime = async (rt) => {
80
114
  productAbilities.forEach((item) => {
81
115
  try {
82
116
  if (item.isOpen) {
83
- const data = JSON.parse(item.extConfig);
117
+ const data = item.extConfig ? JSON.parse(item.extConfig) : {};
84
118
  switch (item.abilityCode) {
119
+ case "visual_door_lock_cloud_store":
120
+ deviceAdvanceAbilityCache.cloudStorage.support = true;
121
+ break;
85
122
  case "tyabi4ucx5": {
86
123
  deviceAdvanceAbilityCache.ai.config = data;
87
124
  const dataReport = data?.ai_data_report ?? false;
@@ -95,6 +132,20 @@ export const getDeviceAdvancedAbilitiesForRuntime = async (rt) => {
95
132
  petRecognition ||
96
133
  voice ||
97
134
  message;
135
+ deviceAdvanceAbilityCache.vr.support =
136
+ !!data?.lock_VR && tttAbList.length > 0;
137
+ if (deviceAdvanceAbilityCache.vr.support) {
138
+ deviceAdvanceAbilityCache.vr.modes = allModes.filter((item) => {
139
+ return data?.modes?.includes(item.mode);
140
+ });
141
+ deviceAdvanceAbilityCache.vr.defaultMode = data.default_mode;
142
+ const exist = deviceAdvanceAbilityCache.vr.modes.find((x) => x.mode === deviceAdvanceAbilityCache.vr.defaultMode);
143
+ if (!exist) {
144
+ deviceAdvanceAbilityCache.vr.defaultMode =
145
+ deviceAdvanceAbilityCache.vr.modes?.[0]?.mode;
146
+ }
147
+ deviceAdvanceAbilityCache.vr.coverMode = data.photo_cover_format;
148
+ }
98
149
  break;
99
150
  }
100
151
  case "tyabis9tpe": {
@@ -103,9 +154,15 @@ export const getDeviceAdvancedAbilitiesForRuntime = async (rt) => {
103
154
  break;
104
155
  }
105
156
  case "tyabiwxrn9": {
106
- deviceAdvanceAbilityCache.wechatVoip.support =
157
+ deviceAdvanceAbilityCache.wechatVoip.isPublice =
158
+ data?.WechatType === "0";
159
+ if (!deviceAdvanceAbilityCache.wechatVoip.isPublice) {
160
+ deviceAdvanceAbilityCache.wechatVoip.appId =
161
+ data["WechatMPAppid"];
162
+ deviceAdvanceAbilityCache.wechatVoip.modeId = data["WechatMPMid"];
163
+ }
164
+ deviceAdvanceAbilityCache.voip.support =
107
165
  !!data?.voipType?.includes("0");
108
- deviceAdvanceAbilityCache.wechatVoip.config = data;
109
166
  break;
110
167
  }
111
168
  case "tyabipd4hh": {
@@ -126,6 +183,16 @@ export const getDeviceAdvancedAbilitiesForRuntime = async (rt) => {
126
183
  console.warn(`setting [${item.abilityCode}] config error`, error);
127
184
  }
128
185
  });
186
+ if (deviceAdvancedAbilityRes.status === "fulfilled") {
187
+ const res = deviceAdvancedAbilityRes.value;
188
+ deviceAdvanceAbilityCache.cloudStorage.support =
189
+ res.types?.includes(0) ?? false;
190
+ deviceAdvanceAbilityCache.wechatVoip.support =
191
+ res.types?.includes(1) ?? false;
192
+ }
129
193
  rt.cache.deviceAdvanceAbilityCache = deviceAdvanceAbilityCache;
130
194
  return deviceAdvanceAbilityCache;
131
195
  };
196
+ export const getDeviceCapabilitiesForRuntime = (rt) => {
197
+ return rt.config.capabilities;
198
+ };
@@ -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", {
@@ -0,0 +1,4 @@
1
+ import { type UpdateVasNotifyConfigParams } from "../../api/notify";
2
+ import type { LockDeviceRuntime } from "../../runtime/LockDeviceRuntime";
3
+ export declare const getVasNotifyConfigForRuntime: (rt: LockDeviceRuntime) => Promise<import("../../api/notify").VasNotifyConfig>;
4
+ export declare const updateVasNotifyConfigForRuntime: (rt: LockDeviceRuntime, params: UpdateVasNotifyConfigParams) => Promise<import("../../api/notify").VasNotifyConfig>;
@@ -0,0 +1,3 @@
1
+ import { getVasNotifyConfigApi, updateVasNotifyConfigApi, } from "../../api/notify";
2
+ export const getVasNotifyConfigForRuntime = (rt) => getVasNotifyConfigApi(rt.config.devInfo.devId);
3
+ export const updateVasNotifyConfigForRuntime = (rt, params) => updateVasNotifyConfigApi(rt.config.devInfo.devId, params);
@@ -52,67 +52,72 @@ export const createTempCustomForRuntime = parallelOnlyForRuntime(async function
52
52
  throw handleCloudError(error);
53
53
  }
54
54
  }
55
- await isValidPassword(baseData);
56
- const { tyNum, name: createdName } = await createTemporaryPassword({
57
- ...baseData,
58
- sn: 0,
59
- availTime: 0,
60
- symbolic: false,
61
- dpTunnel: 2,
62
- });
63
- if (!tyNum) {
64
- const error = getError(1043);
65
- sdkLog("warn", "tempPassword", "createCustomMissingCloudNo", {
55
+ try {
56
+ await isValidPassword(baseData);
57
+ const { tyNum, name: createdName } = await createTemporaryPassword({
58
+ ...baseData,
59
+ sn: 0,
60
+ availTime: 0,
61
+ symbolic: false,
62
+ dpTunnel: 2,
63
+ });
64
+ if (!tyNum) {
65
+ const error = getError(1043);
66
+ sdkLog("warn", "tempPassword", "createCustomMissingCloudNo", {
67
+ devId: rt.devId,
68
+ duration: Date.now() - startedAt,
69
+ error,
70
+ });
71
+ throw error;
72
+ }
73
+ const targetDpCode = cfg.supportBigData
74
+ ? dpCodes.tempPwdCreateW
75
+ : dpCodes.tempPwdCreate;
76
+ const dpPayload = dpUtils.format({
77
+ cloudNo: tyNum,
78
+ valid: true,
79
+ validConfig,
80
+ validNum: 0,
81
+ pwdLength: params.password.length,
82
+ pwd: params.password.split("").map(Number),
83
+ }, (cfg.supportBigData ? addTempPwdBigDpMap : addTempPwdDpMap));
84
+ const result = await publishDpsForRuntime(rt, {
85
+ [targetDpCode]: dpPayload,
86
+ }, {
87
+ checkReport: (dpsIn) => {
88
+ const dpDataRow = dpsIn;
89
+ const reportData = dpDataRow[targetDpCode];
90
+ if (reportData) {
91
+ const data = dpUtils.parse(dpDataRow[targetDpCode], (cfg.supportBigData
92
+ ? reportAddTempPwdDBigpMap
93
+ : reportAddTempPwdDpMap));
94
+ if (data.cloudNo === tyNum) {
95
+ return data;
96
+ }
97
+ }
98
+ return false;
99
+ },
100
+ });
101
+ if (result.status === 0) {
102
+ sdkLog("info", "tempPassword", "createCustomSuccess", {
103
+ devId: rt.devId,
104
+ duration: Date.now() - startedAt,
105
+ data: { route: "nearDp" },
106
+ });
107
+ return buildTempCustomCreateResult(createdName, params.password, result.unlockBindingId, effective);
108
+ }
109
+ const error = getError(result.status === 2 ? 1041 : 1042);
110
+ sdkLog("warn", "tempPassword", "createCustomDpFail", {
66
111
  devId: rt.devId,
67
112
  duration: Date.now() - startedAt,
113
+ data: { status: result.status },
68
114
  error,
69
115
  });
70
116
  throw error;
71
117
  }
72
- const targetDpCode = cfg.supportBigData
73
- ? dpCodes.tempPwdCreateW
74
- : dpCodes.tempPwdCreate;
75
- const dpPayload = dpUtils.format({
76
- cloudNo: tyNum,
77
- valid: true,
78
- validConfig,
79
- validNum: 0,
80
- pwdLength: params.password.length,
81
- pwd: params.password.split("").map(Number),
82
- }, (cfg.supportBigData ? addTempPwdBigDpMap : addTempPwdDpMap));
83
- const result = await publishDpsForRuntime(rt, {
84
- [targetDpCode]: dpPayload,
85
- }, {
86
- checkReport: (dpsIn) => {
87
- const dpDataRow = dpsIn;
88
- const reportData = dpDataRow[targetDpCode];
89
- if (reportData) {
90
- const data = dpUtils.parse(dpDataRow[targetDpCode], (cfg.supportBigData
91
- ? reportAddTempPwdDBigpMap
92
- : reportAddTempPwdDpMap));
93
- if (data.cloudNo === tyNum) {
94
- return data;
95
- }
96
- }
97
- return false;
98
- },
99
- });
100
- if (result.status === 0) {
101
- sdkLog("info", "tempPassword", "createCustomSuccess", {
102
- devId: rt.devId,
103
- duration: Date.now() - startedAt,
104
- data: { route: "nearDp" },
105
- });
106
- return buildTempCustomCreateResult(createdName, params.password, result.unlockBindingId, effective);
118
+ catch (er) {
119
+ throw handleCloudError(er);
107
120
  }
108
- const error = getError(result.status === 2 ? 1041 : 1042);
109
- sdkLog("warn", "tempPassword", "createCustomDpFail", {
110
- devId: rt.devId,
111
- duration: Date.now() - startedAt,
112
- data: { status: result.status },
113
- error,
114
- });
115
- throw error;
116
121
  });
117
122
  export async function removeTempCustomForRuntime(rt, params) {
118
123
  const cfg = rt.config;
@@ -1,5 +1,6 @@
1
1
  import type { LockDeviceRuntime } from "../../runtime/LockDeviceRuntime";
2
2
  export interface GotoServiceParams {
3
- tab?: "cloudStorage" | "AI";
3
+ tab?: "cloudStorage" | "AI" | "voip";
4
+ showGift?: boolean;
4
5
  }
5
- export declare function gotoServiceForRuntime(rt: LockDeviceRuntime, params?: GotoServiceParams): Promise<unknown>;
6
+ export declare function gotoServiceForRuntime(rt: LockDeviceRuntime, params?: GotoServiceParams): Promise<void>;
@@ -4,8 +4,14 @@ export function gotoServiceForRuntime(rt, params) {
4
4
  if (params?.tab === "AI") {
5
5
  type = 3;
6
6
  }
7
+ else if (params?.tab === "voip") {
8
+ type = 1;
9
+ }
7
10
  return new Promise((resolve, reject) => {
8
- const url = `godzilla://tyawqoyej4wi3pqebb?deviceId=${rt.config.devInfo.devId}&commodityType=${type}`;
11
+ let url = `godzilla://tyawqoyej4wi3pqebb?deviceId=${rt.config.devInfo.devId}&commodityType=${type}`;
12
+ if (params?.showGift) {
13
+ url += `&showGift=true`;
14
+ }
9
15
  navigateToMiniProgram({
10
16
  position: "bottom",
11
17
  shortLink: url,
@@ -0,0 +1,4 @@
1
+ import type { LockDeviceRuntime } from "../../runtime/LockDeviceRuntime";
2
+ export declare const getCloudServiceStatusForRuntime: (rt: LockDeviceRuntime) => Promise<import("../../api/service").CloudServiceStatus>;
3
+ export declare const getServicePopupListForRuntime: (rt: LockDeviceRuntime) => Promise<import("../../api/service").ServiceBenefitPopupItem[]>;
4
+ export declare const claimServiceForRuntime: (rt: LockDeviceRuntime, batchId: string) => Promise<import("../../api/service").ClaimResultItem[]>;
@@ -0,0 +1,4 @@
1
+ import { getCloudServiceStatusApi, getServicePopupListApi, claimServiceApi, } from "../../api/service";
2
+ export const getCloudServiceStatusForRuntime = (rt) => getCloudServiceStatusApi(rt.config.devInfo.devId);
3
+ export const getServicePopupListForRuntime = (rt) => getServicePopupListApi(rt.config.devInfo.devId);
4
+ export const claimServiceForRuntime = (rt, batchId) => claimServiceApi(rt.config.devInfo.devId, batchId);
@@ -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) {