@ray-js/api 1.5.0-beta.11 → 1.5.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 (136) hide show
  1. package/@types/BaseKit.d.ts +246 -126
  2. package/@types/BizKit.d.ts +1 -1
  3. package/@types/MapKit.d.ts +237 -1
  4. package/@types/MiniKit.d.ts +1 -1
  5. package/@types/OutdoorKit.d.ts +232 -0
  6. package/@types/P2PKit.d.ts +24 -2
  7. package/@types/all-kits.d.ts +1 -0
  8. package/@types/api-extend.d.ts +8 -2
  9. package/@types/index.d.ts +87 -0
  10. package/lib/{BaseKit-3.3.10.d.ts → BaseKit-3.11.0.d.ts} +1 -0
  11. package/lib/{BaseKit-3.3.10.js → BaseKit-3.11.0.js} +6 -2
  12. package/lib/BizKit-3.2.7.js +2 -1
  13. package/lib/DeviceKit-3.3.1.js +2 -1
  14. package/lib/HomeKit-3.1.4.js +2 -1
  15. package/lib/{MapKit-3.0.7.d.ts → MapKit-3.4.13.d.ts} +5 -0
  16. package/lib/{MapKit-3.0.7.js → MapKit-3.4.13.js} +19 -1
  17. package/lib/MiniKit-3.1.0.js +3 -2
  18. package/lib/OutdoorKit-1.0.4.d.ts +14 -0
  19. package/lib/OutdoorKit-1.0.4.js +39 -0
  20. package/lib/P2PKit-2.0.3.d.ts +1 -0
  21. package/lib/P2PKit-2.0.3.js +5 -1
  22. package/lib/PlayNetKit-1.1.3.d.ts +24 -25
  23. package/lib/PlayNetKit-1.1.3.js +2 -1
  24. package/lib/all-kits.d.ts +3 -2
  25. package/lib/all-kits.js +3 -2
  26. package/lib/cloud/device.d.ts +25 -1
  27. package/lib/cloud/device.js +15 -1
  28. package/lib/cloud/doorlock/README.md +62 -0
  29. package/lib/cloud/doorlock/auth.d.ts +235 -0
  30. package/lib/cloud/doorlock/auth.js +223 -0
  31. package/lib/cloud/doorlock/auth.md +323 -0
  32. package/lib/cloud/doorlock/device.d.ts +137 -0
  33. package/lib/cloud/doorlock/device.js +187 -0
  34. package/lib/cloud/doorlock/device.md +265 -0
  35. package/lib/cloud/doorlock/index.d.ts +10 -0
  36. package/lib/cloud/doorlock/index.js +20 -0
  37. package/lib/cloud/doorlock/log.d.ts +113 -0
  38. package/lib/cloud/doorlock/log.js +53 -0
  39. package/lib/cloud/doorlock/log.md +153 -0
  40. package/lib/cloud/doorlock/member-opmode.d.ts +121 -0
  41. package/lib/cloud/doorlock/member-opmode.js +104 -0
  42. package/lib/cloud/doorlock/member-opmode.md +279 -0
  43. package/lib/cloud/doorlock/member.d.ts +110 -0
  44. package/lib/cloud/doorlock/member.js +72 -0
  45. package/lib/cloud/doorlock/member.md +276 -0
  46. package/lib/cloud/doorlock/offline-pwd.d.ts +61 -0
  47. package/lib/cloud/doorlock/offline-pwd.js +67 -0
  48. package/lib/cloud/doorlock/offline-pwd.md +155 -0
  49. package/lib/cloud/doorlock/old.d.ts +36 -0
  50. package/lib/cloud/doorlock/old.js +102 -0
  51. package/lib/cloud/doorlock/temp-pwd.d.ts +194 -0
  52. package/lib/cloud/doorlock/temp-pwd.js +193 -0
  53. package/lib/cloud/doorlock/temp-pwd.md +362 -0
  54. package/lib/cloud/doorlock/unlock-method.d.ts +62 -0
  55. package/lib/cloud/doorlock/unlock-method.js +85 -0
  56. package/lib/cloud/doorlock/unlock-method.md +121 -0
  57. package/lib/cloud/doorlock/unlock.d.ts +89 -0
  58. package/lib/cloud/doorlock/unlock.js +76 -0
  59. package/lib/cloud/doorlock/unlock.md +222 -0
  60. package/lib/cloud/index.d.ts +4 -0
  61. package/lib/cloud/index.js +10 -1
  62. package/lib/cloud/interface.d.ts +39 -2
  63. package/lib/cloud/linkage.d.ts +8 -5
  64. package/lib/cloud/linkage.js +30 -9
  65. package/lib/cloud/outdoor.d.ts +15 -0
  66. package/lib/cloud/outdoor.js +25 -0
  67. package/lib/cloud/recipe/README.md +36 -0
  68. package/lib/cloud/recipe/basket.d.ts +220 -0
  69. package/lib/cloud/recipe/basket.js +328 -0
  70. package/lib/cloud/recipe/basket.md +431 -0
  71. package/lib/cloud/recipe/category-list.d.ts +71 -0
  72. package/lib/cloud/recipe/category-list.js +65 -0
  73. package/lib/cloud/recipe/category-list.md +132 -0
  74. package/lib/cloud/recipe/custom.d.ts +177 -0
  75. package/lib/cloud/recipe/custom.js +171 -0
  76. package/lib/cloud/recipe/custom.md +265 -0
  77. package/lib/cloud/recipe/index.d.ts +8 -0
  78. package/lib/cloud/recipe/index.js +8 -0
  79. package/lib/cloud/recipe/menu.d.ts +170 -0
  80. package/lib/cloud/recipe/menu.js +76 -0
  81. package/lib/cloud/recipe/menu.md +276 -0
  82. package/lib/cloud/recipe/query.d.ts +87 -0
  83. package/lib/cloud/recipe/query.js +101 -0
  84. package/lib/cloud/recipe/query.md +112 -0
  85. package/lib/cloud/recipe/record.d.ts +54 -0
  86. package/lib/cloud/recipe/record.js +87 -0
  87. package/lib/cloud/recipe/record.md +115 -0
  88. package/lib/cloud/recipe/score.d.ts +69 -0
  89. package/lib/cloud/recipe/score.js +106 -0
  90. package/lib/cloud/recipe/score.md +112 -0
  91. package/lib/cloud/recipe/star.d.ts +131 -0
  92. package/lib/cloud/recipe/star.js +151 -0
  93. package/lib/cloud/recipe/star.md +196 -0
  94. package/lib/cloud/recipe/types.d.ts +7 -0
  95. package/lib/cloud/recipe/types.js +0 -0
  96. package/lib/cloud/remoteGroup.d.ts +10 -0
  97. package/lib/cloud/remoteGroup.js +31 -0
  98. package/lib/constants.js +1 -1
  99. package/lib/errorCode.d.ts +4 -0
  100. package/lib/errorCode.js +3 -0
  101. package/lib/getCdnUrl/index.d.ts +2 -2
  102. package/lib/getCdnUrl/index.js +1 -2
  103. package/lib/getCdnUrl/index.wechat.d.ts +2 -2
  104. package/lib/getCdnUrl/index.wechat.js +1 -2
  105. package/lib/index.d.ts +1 -0
  106. package/lib/index.js +1 -0
  107. package/lib/nativeRouters/common.d.ts +15 -0
  108. package/lib/nativeRouters/common.js +38 -0
  109. package/lib/nativeRouters/device.d.ts +59 -0
  110. package/lib/nativeRouters/device.js +69 -0
  111. package/lib/nativeRouters/gw.d.ts +23 -0
  112. package/lib/nativeRouters/gw.js +27 -0
  113. package/lib/nativeRouters/index.d.ts +6 -1
  114. package/lib/nativeRouters/index.js +6 -1
  115. package/lib/nativeRouters/ipc.d.ts +30 -0
  116. package/lib/nativeRouters/ipc.js +44 -0
  117. package/lib/nativeRouters/outdoors.d.ts +47 -0
  118. package/lib/nativeRouters/outdoors.js +41 -0
  119. package/lib/nativeRouters/remoteGroup.d.ts +22 -0
  120. package/lib/nativeRouters/remoteGroup.js +11 -0
  121. package/lib/nativeRouters/root.d.ts +41 -0
  122. package/lib/nativeRouters/root.js +53 -0
  123. package/lib/openGroupCreate/index.js +3 -3
  124. package/lib/panel/i18n/index.d.ts +7 -6
  125. package/lib/panel/i18n/index.js +26 -11
  126. package/lib/panel/normalizeNetwork.js +1 -1
  127. package/lib/utils.d.ts +5 -2
  128. package/lib/utils.js +46 -20
  129. package/lib/utils.wechat.d.ts +3 -0
  130. package/lib/utils.wechat.js +17 -1
  131. package/lib/viewAPI.d.ts +1 -0
  132. package/lib/viewAPI.js +4 -3
  133. package/package.json +9 -8
  134. package/@types/PlayNetKit.d.ts +0 -444
  135. package/lib/nativeRouters/scene.d.ts +0 -34
  136. package/lib/nativeRouters/scene.js +0 -60
@@ -0,0 +1,59 @@
1
+ import { ICommon } from './common';
2
+ type OpenSceneCreateParams = {
3
+ devId?: string;
4
+ } & ICommon;
5
+ export declare function openSceneCreate(params?: OpenSceneCreateParams): Promise<void>;
6
+ export declare const openCreateScene: typeof openSceneCreate;
7
+ export declare function openUniversalCreateScene(params?: OpenSceneCreateParams): Promise<void>;
8
+ type OpenSceneEdit = {
9
+ devId?: string;
10
+ sceneId?: string;
11
+ } & ICommon;
12
+ export declare function openSceneEdit(params?: OpenSceneEdit): Promise<void>;
13
+ export declare const openEditScene: typeof openSceneEdit;
14
+ type OpenGuideScene = {
15
+ action?: 'add' | 'edit';
16
+ } & ICommon;
17
+ /**
18
+ * 打开APP引导场景页
19
+ * @param params { action?: 'add' | 'edit', success?: () => void, fail?: (err?: { errorMsg: string, errorCode: string | number, innerError: { errorCode: string | number, errorMsg: string } }) => void, complete?: () => void, [key: string]: string | boolean | number }
20
+ * @returns
21
+ */
22
+ export declare function openGuideScene(params?: OpenGuideScene): Promise<void>;
23
+ type OpenConfigDevice = {
24
+ devId?: string;
25
+ sceneId?: string;
26
+ } & ICommon;
27
+ /**
28
+ * 打开编辑场景页面
29
+ * @param params { devId?: string, sceneId?: string, success?: () => void, fail?: (err?: { errorMsg: string, errorCode: string | number, innerError: { errorCode: string | number, errorMsg: string } }) => void, complete?: () => void, [key: string]: string | boolean | number }
30
+ * @returns
31
+ */
32
+ export declare function openConfigDevice(params?: OpenConfigDevice): Promise<void>;
33
+ type OpenDevNetworkCheck = {} & ICommon;
34
+ /**
35
+ * 检测设备网络
36
+ * @param params { }
37
+ * @returns
38
+ */
39
+ export declare function openDevNetworkCheck(params?: OpenDevNetworkCheck): Promise<void>;
40
+ type OpenSmartScene = {} & ICommon;
41
+ /**
42
+ * 跳转场景
43
+ */
44
+ export declare function openSmartScene(params?: OpenSmartScene): Promise<void>;
45
+ type OpenDevManualAndSmart = {
46
+ devId?: string;
47
+ } & ICommon;
48
+ /**
49
+ * 打开 “一键执行”和“自动化”
50
+ */
51
+ export declare function openDevManualAndSmart(params?: OpenDevManualAndSmart): Promise<void>;
52
+ type OpenDeviceOnlySearchConfigGwSub = {
53
+ gwId?: string;
54
+ } & ICommon;
55
+ /**
56
+ * 搜索网关子设备
57
+ */
58
+ export declare function openDeviceOnlySearchConfigGwSub(params?: OpenDeviceOnlySearchConfigGwSub): Promise<void>;
59
+ export {};
@@ -0,0 +1,69 @@
1
+ import { nativeRouter } from './common';
2
+ export function openSceneCreate(params) {
3
+ return nativeRouter('createScene', params);
4
+ }
5
+ export const openCreateScene = openSceneCreate;
6
+
7
+ // 兼容Android 端仅支持 Zigbee 本地场景, Android使用createSmartScene
8
+ export function openUniversalCreateScene(params) {
9
+ const url = ty.getSystemInfoSync().platform === 'android' ? 'createSmartScene' : 'createScene';
10
+ return nativeRouter(url, params);
11
+ }
12
+ export function openSceneEdit(params) {
13
+ return nativeRouter('editScene', params);
14
+ }
15
+ export const openEditScene = openSceneEdit;
16
+ /**
17
+ * 打开APP引导场景页
18
+ * @param params { action?: 'add' | 'edit', success?: () => void, fail?: (err?: { errorMsg: string, errorCode: string | number, innerError: { errorCode: string | number, errorMsg: string } }) => void, complete?: () => void, [key: string]: string | boolean | number }
19
+ * @returns
20
+ */
21
+ export function openGuideScene(params) {
22
+ return nativeRouter('thing_add_scene', params);
23
+ }
24
+ /**
25
+ * 打开编辑场景页面
26
+ * @param params { devId?: string, sceneId?: string, success?: () => void, fail?: (err?: { errorMsg: string, errorCode: string | number, innerError: { errorCode: string | number, errorMsg: string } }) => void, complete?: () => void, [key: string]: string | boolean | number }
27
+ * @returns
28
+ */
29
+ export function openConfigDevice(params) {
30
+ return nativeRouter('config_device', params);
31
+ }
32
+
33
+ // dev_network_check
34
+
35
+ /**
36
+ * 检测设备网络
37
+ * @param params { }
38
+ * @returns
39
+ */
40
+ export function openDevNetworkCheck(params) {
41
+ return nativeRouter('dev_network_check', params);
42
+ }
43
+
44
+ // 跳转场景 smartScene
45
+
46
+ /**
47
+ * 跳转场景
48
+ */
49
+ export function openSmartScene(params) {
50
+ return nativeRouter('smartScene', params);
51
+ }
52
+
53
+ // 打开 “一键执行”和“自动化” devManualAndSmart
54
+
55
+ /**
56
+ * 打开 “一键执行”和“自动化”
57
+ */
58
+ export function openDevManualAndSmart(params) {
59
+ return nativeRouter('devManualAndSmart', params);
60
+ }
61
+
62
+ // device_only_search_config_gw_sub
63
+
64
+ /**
65
+ * 搜索网关子设备
66
+ */
67
+ export function openDeviceOnlySearchConfigGwSub(params) {
68
+ return nativeRouter('device_only_search_config_gw_sub', params);
69
+ }
@@ -0,0 +1,23 @@
1
+ import { ICommon } from './common';
2
+ type GwIdParams = {
3
+ gwId?: string;
4
+ } & ICommon;
5
+ /**
6
+ * 打开 ZigBee 网关面板配网子设备(旧版)
7
+ * @param params { gwId?: string }
8
+ * @returns
9
+ */
10
+ export declare function openPresentGatewayCategroy(params?: GwIdParams): Promise<void>;
11
+ /**
12
+ * 打开网关面板配网子设备 - 搜索配网(新版)
13
+ * @param params { gwId?: string }
14
+ * @returns
15
+ */
16
+ export declare function openDeviceGWSubSearchConfigure(params?: GwIdParams): Promise<void>;
17
+ /**
18
+ * 打开网关面板配网子设备 - 配网帮助列表(新版)
19
+ * @param params { gwId?: string }
20
+ * @returns
21
+ */
22
+ export declare function openDeviceGWSubHelpList(params?: GwIdParams): Promise<void>;
23
+ export {};
@@ -0,0 +1,27 @@
1
+ import { nativeRouter } from './common';
2
+ /**
3
+ * 打开 ZigBee 网关面板配网子设备(旧版)
4
+ * @param params { gwId?: string }
5
+ * @returns
6
+ */
7
+ export function openPresentGatewayCategroy(params) {
8
+ return nativeRouter('presentGatewayCategroy', params);
9
+ }
10
+
11
+ /**
12
+ * 打开网关面板配网子设备 - 搜索配网(新版)
13
+ * @param params { gwId?: string }
14
+ * @returns
15
+ */
16
+ export function openDeviceGWSubSearchConfigure(params) {
17
+ return nativeRouter('device_only_search_config_gw_sub', params);
18
+ }
19
+
20
+ /**
21
+ * 打开网关面板配网子设备 - 配网帮助列表(新版)
22
+ * @param params { gwId?: string }
23
+ * @returns
24
+ */
25
+ export function openDeviceGWSubHelpList(params) {
26
+ return nativeRouter('device_gw_sub_device_help_list', params);
27
+ }
@@ -1 +1,6 @@
1
- export * from './scene';
1
+ export * from './device';
2
+ export * from './outdoors';
3
+ export * from './root';
4
+ export * from './ipc';
5
+ export * from './gw';
6
+ export * from './remoteGroup';
@@ -1 +1,6 @@
1
- export * from './scene';
1
+ export * from './device';
2
+ export * from './outdoors';
3
+ export * from './root';
4
+ export * from './ipc';
5
+ export * from './gw';
6
+ export * from './remoteGroup';
@@ -0,0 +1,30 @@
1
+ import { ICommon } from './common';
2
+ type OpenIpcCameraPlayBack = {} & ICommon;
3
+ /**
4
+ * 打开IPC回访页
5
+ * @param params {}
6
+ * @returns
7
+ */
8
+ export declare function openIpcCameraPlayBack(params?: OpenIpcCameraPlayBack): Promise<void>;
9
+ type OpenIpcCameraAlbum = {} & ICommon;
10
+ /**
11
+ * 打开IPC相册页
12
+ * @param params {}
13
+ * @returns
14
+ */
15
+ export declare function openIpcCameraAlbum(params?: OpenIpcCameraAlbum): Promise<void>;
16
+ type OpenIpcCameraCloud = {} & ICommon;
17
+ /**
18
+ * 打开IPC云存储页
19
+ * @param params {}
20
+ * @returns
21
+ */
22
+ export declare function openIpcCameraCloud(params?: OpenIpcCameraCloud): Promise<void>;
23
+ type OpenIpcCameraModeSetting = {} & ICommon;
24
+ /**
25
+ * 打开IPC布撤防模式
26
+ * @param params {}
27
+ * @returns
28
+ */
29
+ export declare function openIpcModeSetting(params?: OpenIpcCameraModeSetting): Promise<void>;
30
+ export {};
@@ -0,0 +1,44 @@
1
+ import { nativeRouter } from './common';
2
+
3
+ // 打开IPC回访页 camera_playback_panel
4
+
5
+ /**
6
+ * 打开IPC回访页
7
+ * @param params {}
8
+ * @returns
9
+ */
10
+ export function openIpcCameraPlayBack(params) {
11
+ return nativeRouter('camera_playback_panel', params);
12
+ }
13
+ // 打开IPC相册页 ipc_album_panel
14
+
15
+ /**
16
+ * 打开IPC相册页
17
+ * @param params {}
18
+ * @returns
19
+ */
20
+ export function openIpcCameraAlbum(params) {
21
+ return nativeRouter('ipc_album_panel', params);
22
+ }
23
+
24
+ // 打开IPC云存储页 camera_cloud_panel
25
+
26
+ /**
27
+ * 打开IPC云存储页
28
+ * @param params {}
29
+ * @returns
30
+ */
31
+ export function openIpcCameraCloud(params) {
32
+ return nativeRouter('camera_cloud_panel', params);
33
+ }
34
+
35
+ // 打开IPC布撤防模式 camera_mode_setting
36
+
37
+ /**
38
+ * 打开IPC布撤防模式
39
+ * @param params {}
40
+ * @returns
41
+ */
42
+ export function openIpcModeSetting(params) {
43
+ return nativeRouter('modeSetting', params);
44
+ }
@@ -0,0 +1,47 @@
1
+ import { ICommon } from './common';
2
+ type OpenOutdoorCyclingNavigationParams = {
3
+ devId?: string;
4
+ } & ICommon;
5
+ /**
6
+ * 打开骑行导航页面
7
+ * @param params {devId: string}
8
+ * @returns
9
+ */
10
+ export declare function openOutdoorCyclingNavigation(params?: OpenOutdoorCyclingNavigationParams): Promise<void>;
11
+ type OpenAdditionalUnlockMethodsParams = {
12
+ devId?: string;
13
+ } & ICommon;
14
+ /**
15
+ * 打开车辆解锁方式页面
16
+ * @param params {devId: string}
17
+ * @returns
18
+ */
19
+ export declare function openAdditionalUnlockMethods(params: OpenAdditionalUnlockMethodsParams): Promise<void>;
20
+ type OpenOutdoorAmbientLightingParams = {
21
+ devId?: string;
22
+ } & ICommon;
23
+ /**
24
+ * 打开氛围灯页面
25
+ * @param params {devId: string}
26
+ * @returns
27
+ */
28
+ export declare function openOutdoorAmbientLighting(params?: OpenOutdoorAmbientLightingParams): Promise<void>;
29
+ type OpenOutdoorShortcutSiriParams = {
30
+ devId?: string;
31
+ } & ICommon;
32
+ /**
33
+ * 打开Siri页面,仅iOS
34
+ * @param params {devId: string}
35
+ * @returns
36
+ */
37
+ export declare function openOutdoorShortcutSiri(params: OpenOutdoorShortcutSiriParams): Promise<void>;
38
+ type OpenOutdoorConfigDeviceHomeParams = {
39
+ productId?: string;
40
+ } & ICommon;
41
+ /**
42
+ * 打开配网
43
+ * @param params {productId: string}
44
+ * @returns
45
+ */
46
+ export declare function openOutdoorConfigDeviceHome(params: OpenOutdoorConfigDeviceHomeParams): Promise<void>;
47
+ export {};
@@ -0,0 +1,41 @@
1
+ import { nativeRouter } from './common';
2
+ /**
3
+ * 打开骑行导航页面
4
+ * @param params {devId: string}
5
+ * @returns
6
+ */
7
+ export function openOutdoorCyclingNavigation(params) {
8
+ return nativeRouter('tsod_cycling_navigation', params);
9
+ }
10
+ /**
11
+ * 打开车辆解锁方式页面
12
+ * @param params {devId: string}
13
+ * @returns
14
+ */
15
+ export function openAdditionalUnlockMethods(params) {
16
+ return nativeRouter('tsod_additional_unlock_methods', params);
17
+ }
18
+ /**
19
+ * 打开氛围灯页面
20
+ * @param params {devId: string}
21
+ * @returns
22
+ */
23
+ export function openOutdoorAmbientLighting(params) {
24
+ return nativeRouter('tsod_ambient_lighting', params);
25
+ }
26
+ /**
27
+ * 打开Siri页面,仅iOS
28
+ * @param params {devId: string}
29
+ * @returns
30
+ */
31
+ export function openOutdoorShortcutSiri(params) {
32
+ return nativeRouter('tsod_shortcut_siri', params);
33
+ }
34
+ /**
35
+ * 打开配网
36
+ * @param params {productId: string}
37
+ * @returns
38
+ */
39
+ export function openOutdoorConfigDeviceHome(params) {
40
+ return nativeRouter('config_device_home', params);
41
+ }
@@ -0,0 +1,22 @@
1
+ import { ICommon } from './common';
2
+ type OpenZigbeeLocalGroupParams = {
3
+ /**
4
+ * 设备 ID
5
+ */
6
+ deviceId: string;
7
+ /**
8
+ * localId 群组本地标识
9
+ */
10
+ localId: string;
11
+ /**
12
+ * categoryCode 并非三级品类,与 localId 匹配范围为 7001-7008;
13
+ * localId 为云端分配,步长为 8,因此一个遥控器内部最多支持关联 8 个群组,localId 为初始值依次+1,与之匹配的 categoryCode 从 7001 依次 +1.
14
+ */
15
+ categoryCode: string;
16
+ /**
17
+ * 二级品类 code,用于进行设备列表筛选过滤
18
+ */
19
+ codes: string;
20
+ } & ICommon;
21
+ export declare function openZigbeeLocalGroup(params?: OpenZigbeeLocalGroupParams): Promise<void>;
22
+ export {};
@@ -0,0 +1,11 @@
1
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
+ import { nativeRouter } from './common';
3
+ export function openZigbeeLocalGroup(params) {
4
+ const realParams = _objectSpread({}, params);
5
+ // 统一成 TTT 的 deviceId 写法,但实际入参为 devId
6
+ if (params.deviceId) {
7
+ realParams.devId = params.deviceId;
8
+ delete realParams.deviceId;
9
+ }
10
+ return nativeRouter('zigbee_pair', realParams);
11
+ }
@@ -0,0 +1,41 @@
1
+ import { ICommon } from './common';
2
+ type OpenAppScanParams = {
3
+ gwId?: string;
4
+ source?: string;
5
+ } & ICommon;
6
+ /**
7
+ * 打开APP扫码
8
+ * @param params {gwId: string, source: string}
9
+ * @returns
10
+ */
11
+ export declare function openAppScan(params?: OpenAppScanParams): Promise<void>;
12
+ type OpenHelpAndFeedback = {} & ICommon;
13
+ /**
14
+ * 打开帮助与反馈
15
+ * @param params { }
16
+ * @returns
17
+ */
18
+ export declare function openHelpAndFeedback(params?: OpenHelpAndFeedback): Promise<void>;
19
+ type OpenMoreService = {} & ICommon;
20
+ /**
21
+ * 跳转到更多服务
22
+ */
23
+ export declare function openMoreService(params?: OpenMoreService): Promise<void>;
24
+ type OpenAppHelpCenter = {} & ICommon;
25
+ /**
26
+ * 跳转到App帮助与反馈页
27
+ */
28
+ export declare function openAppHelpCenter(params?: OpenAppHelpCenter): Promise<void>;
29
+ type OpenMessageCenter = {
30
+ category?: 0 | 1 | 2;
31
+ } & ICommon;
32
+ /**
33
+ * 跳转到消息中心
34
+ */
35
+ export declare function openMessageCenter(params?: OpenMessageCenter): Promise<void>;
36
+ type OpenCompleteUserInfo = {} & ICommon;
37
+ /**
38
+ * 完善用户信息
39
+ */
40
+ export declare function openCompleteUserInfo(params?: OpenCompleteUserInfo): Promise<void>;
41
+ export {};
@@ -0,0 +1,53 @@
1
+ import { nativeRouter } from './common';
2
+ /**
3
+ * 打开APP扫码
4
+ * @param params {gwId: string, source: string}
5
+ * @returns
6
+ */
7
+ export function openAppScan(params) {
8
+ return nativeRouter('scan', params);
9
+ }
10
+ /**
11
+ * 打开帮助与反馈
12
+ * @param params { }
13
+ * @returns
14
+ */
15
+ export function openHelpAndFeedback(params) {
16
+ return nativeRouter('helpAndFeedBack', params);
17
+ }
18
+
19
+ // more_service
20
+
21
+ /**
22
+ * 跳转到更多服务
23
+ */
24
+ export function openMoreService(params) {
25
+ return nativeRouter('more_service', params);
26
+ }
27
+
28
+ // helpCenter
29
+
30
+ /**
31
+ * 跳转到App帮助与反馈页
32
+ */
33
+ export function openAppHelpCenter(params) {
34
+ return nativeRouter('helpCenter', params);
35
+ }
36
+
37
+ // messageCenter
38
+
39
+ /**
40
+ * 跳转到消息中心
41
+ */
42
+ export function openMessageCenter(params) {
43
+ return nativeRouter('messageCenter', params);
44
+ }
45
+
46
+ // 完善用户信息 complete_user_information
47
+
48
+ /**
49
+ * 完善用户信息
50
+ */
51
+ export function openCompleteUserInfo(params) {
52
+ return nativeRouter('complete_user_information', params);
53
+ }
@@ -24,15 +24,15 @@ export function openGroupCreate(params) {
24
24
  }
25
25
  }, rest), {}, {
26
26
  success() {
27
- success === null || success === void 0 ? void 0 : success();
27
+ success === null || success === void 0 || success();
28
28
  resolve();
29
29
  },
30
30
  fail(err) {
31
- fail === null || fail === void 0 ? void 0 : fail(err);
31
+ fail === null || fail === void 0 || fail(err);
32
32
  reject(err);
33
33
  },
34
34
  complete() {
35
- complete === null || complete === void 0 ? void 0 : complete();
35
+ complete === null || complete === void 0 || complete();
36
36
  }
37
37
  }));
38
38
  });
@@ -1,27 +1,28 @@
1
1
  type LanguageMap = {
2
2
  [key: string]: Record<string, string>;
3
3
  };
4
- export default class I18N {
4
+ export declare const updateI18n: (data: LanguageMap) => void;
5
+ export default class I18N<LanMap extends LanguageMap, Lan extends LanMap[keyof LanMap] = LanMap[keyof LanMap]> {
5
6
  [x: string]: any;
6
- strings: LanguageMap;
7
+ strings: LanMap;
7
8
  defaultLang: string;
8
9
  __language: string;
9
- constructor(props: LanguageMap);
10
+ constructor(props: LanMap);
10
11
  forceUpdateNetworkLang(productId: string): void;
11
- mergeLanguage(L1: LanguageMap, L2: LanguageMap): LanguageMap;
12
+ mergeLanguage(L1: LanguageMap, L2: LanguageMap): any;
12
13
  isZh(language: string): boolean;
13
14
  setLanguage(language: string): void;
14
15
  buildLanguage(language: string): void;
15
16
  _getBestMatchingLanguage(language: string, props: LanguageMap): any;
16
17
  formatString(str: string, ...values: any[]): string;
17
- formatValue(key: string, ...values: any[]): any;
18
+ formatValue(key: keyof Lan, ...values: any[]): any;
18
19
  _replaceAll(find: string, replace: string, str: string): string;
19
20
  getDpLang(code: string | number, value?: undefined | boolean | string): any;
20
21
  getDpName(code: string, defaultName: string): any;
21
22
  getDpsLang(key: {
22
23
  [key: string]: string;
23
24
  }): {};
24
- getLang(key: string, defaultString?: string): any;
25
+ getLang(key: keyof Lan, defaultString?: string): any;
25
26
  /**
26
27
  * 获取picker标题
27
28
  * @param {*} dpCode
@@ -1,6 +1,21 @@
1
1
  import "core-js/modules/es.string.replace.js";
2
2
  import { requestCloud, getSystemInfoSync, THING } from '../..';
3
3
  import { getBitValue } from '../utils';
4
+
5
+ /**
6
+ * I18n 智能小程序中用来获取多语言的对象
7
+ * 文档: https://developer.tuya.com/cn/miniapp/framework/app/i18n
8
+ */
9
+
10
+ export const updateI18n = () => {
11
+ // 微信小程序中使用的方法,这里不需要实现
12
+ };
13
+ function hasKey(key) {
14
+ if (typeof I18n.has === 'function') {
15
+ return I18n.has(key);
16
+ }
17
+ return I18n.t(key) !== key;
18
+ }
4
19
  export default class I18N {
5
20
  constructor(props) {
6
21
  this.strings = this.mergeLanguage(props, {});
@@ -107,7 +122,7 @@ export default class I18N {
107
122
  return res;
108
123
  }
109
124
  formatValue(key) {
110
- let res = typeof this[key] !== 'undefined' ? this[key] : I18n.t(key);
125
+ let res = this.getLang(key);
111
126
  for (let i = 0; i < (arguments.length <= 1 ? 0 : arguments.length - 1); i++) {
112
127
  res = this._replaceAll("{".concat(i, "}"), i + 1 < 1 || arguments.length <= i + 1 ? undefined : arguments[i + 1], res);
113
128
  }
@@ -129,30 +144,30 @@ export default class I18N {
129
144
  } else {
130
145
  key = "dp_".concat(code, "_").concat(value).toLowerCase();
131
146
  }
132
- return I18n.t(key) !== key ? I18n.t(key) : typeof this[key] !== 'undefined' ? this[key] : I18n.t(key);
147
+ return hasKey(key) ? I18n.t(key) : typeof this[key] !== 'undefined' ? this[key] : I18n.t(key);
133
148
  }
134
149
  getDpName(code, defaultName) {
135
150
  const key = "dp_".concat(code).toLowerCase();
136
- return I18n.t(key) !== key ? I18n.t(key) : typeof this[key] !== 'undefined' ? this[key] : defaultName;
151
+ return hasKey(key) ? I18n.t(key) : typeof this[key] !== 'undefined' ? this[key] : defaultName;
137
152
  }
138
153
  getDpsLang(key) {
139
154
  let strs = {};
140
155
  if (typeof key === 'object') {
141
156
  if (typeof key.strKey === 'string') {
142
- strs = I18n.t(key.strKey) !== key.strKey ? I18n.t(key.strKey) : typeof this[key.strKey] !== 'undefined' ? this[key.strKey] : I18n.t(key.strKey);
157
+ strs = hasKey(key.strKey) ? I18n.t(key.strKey) : typeof this[key.strKey] !== 'undefined' ? this[key.strKey] : I18n.t(key.strKey);
143
158
  } else {
144
159
  Object.keys(key).map(i => {
145
- strs[key[i]] = I18n.t(key[i]) !== key[i] ? I18n.t(key[i]) : typeof this[key[i]] !== 'undefined' ? this[key[i]] : I18n.t(key[i]);
160
+ strs[key[i]] = hasKey(key[i]) ? I18n.t(key[i]) : typeof this[key[i]] !== 'undefined' ? this[key[i]] : I18n.t(key[i]);
146
161
  return null;
147
162
  });
148
163
  }
149
164
  } else {
150
- strs = I18n.t(key) !== key ? I18n.t(key) : typeof this[key] !== 'undefined' ? this[key] : I18n.t(key);
165
+ strs = hasKey(key) ? I18n.t(key) : typeof this[key] !== 'undefined' ? this[key] : I18n.t(key);
151
166
  }
152
167
  return strs;
153
168
  }
154
169
  getLang(key, defaultString) {
155
- return I18n.t(key) !== key ? I18n.t(key) : typeof this[key] !== 'undefined' ? this[key] : typeof defaultString !== 'undefined' ? defaultString : I18n.t(key);
170
+ return hasKey(key) ? I18n.t(key) : typeof this[key] !== 'undefined' ? this[key] : typeof defaultString !== 'undefined' ? defaultString : I18n.t(key);
156
171
  }
157
172
 
158
173
  /**
@@ -165,7 +180,7 @@ export default class I18N {
165
180
  const lists = schema.range;
166
181
  lists.map(v => {
167
182
  const key = "dp_".concat(dpCode, "_").concat(v).toLowerCase();
168
- result[v] = I18n.t(key) !== key ? I18n.t(key) : typeof this[key] !== 'undefined' ? this[key] : I18n.t(key);
183
+ result[v] = hasKey(key) ? I18n.t(key) : typeof this[key] !== 'undefined' ? this[key] : I18n.t(key);
169
184
  return null;
170
185
  });
171
186
  return result;
@@ -180,11 +195,11 @@ export default class I18N {
180
195
  parseCountdown(t, power) {
181
196
  const h = parseFloat("".concat(t / 3600));
182
197
  const m = parseFloat("".concat(t / 60 - h * 60));
183
- const tHour = I18n.t('t_hour') !== 't_hour' ? I18n.t('t_hour') : typeof this.t_hour !== 'undefined' ? this.t_hour : I18n.t('t_hour');
184
- const tMinute = I18n.t('t_minute') !== 't_minute' ? I18n.t('t_minute') : typeof this.t_minute !== 'undefined' ? this.t_minute : I18n.t('t_minute');
198
+ const tHour = hasKey('t_hour') ? I18n.t('t_hour') : typeof this.t_hour !== 'undefined' ? this.t_hour : I18n.t('t_hour');
199
+ const tMinute = hasKey('t_minute') ? I18n.t('t_minute') : typeof this.t_minute !== 'undefined' ? this.t_minute : I18n.t('t_minute');
185
200
  const time = h >= 1.0 ? "".concat(Math.round(h)).concat(tHour) : "".concat(Math.round(m)).concat(tMinute);
186
201
  const key = "countdown_".concat(power ? 'on' : 'off');
187
- const str = I18n.t(key) !== key ? I18n.t(key) : typeof this[key] !== 'undefined' ? this[key] : I18n.t(key);
202
+ const str = hasKey(key) ? I18n.t(key) : typeof this[key] !== 'undefined' ? this[key] : I18n.t(key);
188
203
  return this.formatString(str, time);
189
204
  }
190
205
  getFaultStrings(schema, faultCode, faultValue) {
@@ -11,7 +11,7 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
11
11
  export function normalizeNetwork(network, data) {
12
12
  var _result$networkType;
13
13
  const result = _objectSpread(_objectSpread({}, network), data);
14
- const networkType = result === null || result === void 0 ? void 0 : (_result$networkType = result.networkType) === null || _result$networkType === void 0 ? void 0 : _result$networkType.toUpperCase();
14
+ const networkType = result === null || result === void 0 || (_result$networkType = result.networkType) === null || _result$networkType === void 0 ? void 0 : _result$networkType.toUpperCase();
15
15
  result.networkType = networkType;
16
16
  if (typeof result.isConnected === 'undefined') {
17
17
  result.isConnected = networkType !== 'NONE';
package/lib/utils.d.ts CHANGED
@@ -1,8 +1,11 @@
1
+ import { UrlObject } from 'query-string';
1
2
  type Opts = {
2
3
  deprecated?: boolean;
3
4
  namespace?: string;
4
5
  };
6
+ export declare function createFactory(kitName: string): (name: string, opts?: Opts) => () => any;
5
7
  export declare function factory(name: string, opts?: Opts): () => any;
6
- export declare function factoryContants(name: string, opts?: Opts): any;
7
- export declare function objectToUrlParams(obj: Record<string, string | number | boolean>): string;
8
+ export declare function factoryConstants(name: string, opts?: Opts): any;
9
+ export declare const parseUrl: (url: string) => import("query-string").ParsedUrl;
10
+ export declare const stringifyUrl: (object: UrlObject) => string;
8
11
  export {};