@ray-js/ray-ipc-utils 1.1.6 → 1.1.8-beta-1

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.
@@ -142,3 +142,20 @@ export declare const getIsSupportedCloudStorageSync: (deviceId: string) => Promi
142
142
  * @returns true/false
143
143
  */
144
144
  export declare const ipcTTTOperatorLog: <T>(ipcLogString: string) => Promise<IRes<T>>;
145
+ /**
146
+ * 跳转 IPC 设置页小程序
147
+ * @param {string} deviceId - 设备ID
148
+ * @param {Object} options - 可选配置项
149
+ * @param {string} [options.position='right'] - 弹出位置,可选 'right' 或 'bottom'
150
+ */
151
+ export declare const goToIpcSettingMini: <T>(deviceId: string, options?: {
152
+ position?: 'right' | 'bottom';
153
+ }) => Promise<IRes<T>>;
154
+ /**
155
+ * 跳转 IPC 服务大厅小程序
156
+ * @param {Object} options - 可选配置项
157
+ * @param {string} [options.position='right'] - 弹出位置,可选
158
+ */
159
+ export declare const goToIpcServiceHallMini: <T>(options?: {
160
+ position?: 'right' | 'bottom';
161
+ }) => Promise<IRes<T>>;
@@ -840,4 +840,45 @@ export const ipcTTTOperatorLog = ipcLogString => {
840
840
  });
841
841
  }
842
842
  });
843
+ };
844
+
845
+ /**
846
+ * 跳转 IPC 设置页小程序
847
+ * @param {string} deviceId - 设备ID
848
+ * @param {Object} options - 可选配置项
849
+ * @param {string} [options.position='right'] - 弹出位置,可选 'right' 或 'bottom'
850
+ */
851
+ export const goToIpcSettingMini = async function (deviceId) {
852
+ let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
853
+ position: 'right'
854
+ };
855
+ try {
856
+ const result = await goToMiniProgramByShortLink(`godzilla://tycryc71qaug8at6yt/__functional__/tycryc71qaug8at6yt/pages/detail/index?deviceId=${deviceId}&customType=ipc`, options.position);
857
+ return result;
858
+ } catch (err) {
859
+ return {
860
+ code: -1,
861
+ msg: String(err)
862
+ };
863
+ }
864
+ };
865
+
866
+ /**
867
+ * 跳转 IPC 服务大厅小程序
868
+ * @param {Object} options - 可选配置项
869
+ * @param {string} [options.position='right'] - 弹出位置,可选
870
+ */
871
+ export const goToIpcServiceHallMini = async function () {
872
+ let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
873
+ position: 'right'
874
+ };
875
+ try {
876
+ const result = await goToMiniProgramByShortLink(`godzilla://tyhtutw16qihykz97n`, options.position);
877
+ return result;
878
+ } catch (err) {
879
+ return {
880
+ code: -1,
881
+ msg: String(err)
882
+ };
883
+ }
843
884
  };
@@ -46,3 +46,11 @@ export declare const addCollectionPointsInfo: <T>(deviceId: string, name: string
46
46
  *
47
47
  */
48
48
  export declare const getServiceUrl: <T>(deviceId: string, serveType: ServeTpe, paramData?: Record<string, any>, action?: boolean, utm_rtid?: string) => Promise<IRes<T>>;
49
+ /**
50
+ * @description: 获取增值服务是否开通
51
+ * @param string deviceId 设备id
52
+ * @param string categoryCode 增值服务大类 云存储 - security_cloud_service 视频巡检服务 - ai_inspection_service
53
+ * @param Record<string, any> extendParam 扩展参数
54
+ * @return Promise<boolean> 是否开通
55
+ */
56
+ export declare const getServiceIsOpen: (deviceId: string, categoryCode: string, extendParam?: Record<string, any>) => Promise<IRes<boolean>>;
@@ -4,7 +4,7 @@ import "core-js/modules/esnext.iterator.map.js";
4
4
  import "core-js/modules/esnext.iterator.some.js";
5
5
  /* eslint-disable camelcase */
6
6
  import _trim from 'lodash/trim';
7
- import { getIpcRtcConfig, getIpcPointList, updateIpcPointInfo, getVasUrlInfo } from '@ray-js/ray';
7
+ import { getIpcRtcConfig, getIpcPointList, updateIpcPointInfo, getVasUrlInfo, getDeviceDetailsById } from '@ray-js/ray';
8
8
  import Strings from '../i18n';
9
9
  import { JsonUtil, getInitUtmTid } from '../utils';
10
10
  import { getDevInfo, getNativeStorage, setNativeStorage, publishDps, getDpStateValue, getDpIdByCode, jumpToWebView, goToMiniProgramByShortLink, getCurrentSupportedTalkMode, ipcTTTOperatorLog } from '../kit';
@@ -415,16 +415,6 @@ export const addCollectionPointsInfo = async (deviceId, name) => {
415
415
  }
416
416
  // 2. 获取收藏点 dpCode: memory_point_set
417
417
  const memoryPointSetDpId = await getDpIdByCode(deviceId, 'memory_point_set');
418
- if ((cruiseSwitchInfo === null || cruiseSwitchInfo === void 0 ? void 0 : cruiseSwitchInfo.code) === -1) {
419
- ty.showToast({
420
- icon: 'error',
421
- title: cruiseSwitchInfo.msg
422
- });
423
- return {
424
- code: -1,
425
- msg: cruiseSwitchInfo.msg
426
- };
427
- }
428
418
  if (_trim(name) === '') {
429
419
  ty.showToast({
430
420
  icon: 'error',
@@ -533,4 +523,40 @@ export const getServiceUrl = async function (deviceId, serveType) {
533
523
  msg: err
534
524
  };
535
525
  }
526
+ };
527
+
528
+ /**
529
+ * @description: 获取增值服务是否开通
530
+ * @param string deviceId 设备id
531
+ * @param string categoryCode 增值服务大类 云存储 - security_cloud_service 视频巡检服务 - ai_inspection_service
532
+ * @param Record<string, any> extendParam 扩展参数
533
+ * @return Promise<boolean> 是否开通
534
+ */
535
+ export const getServiceIsOpen = async function (deviceId, categoryCode) {
536
+ let extendParam = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
537
+ try {
538
+ const {
539
+ homeId
540
+ } = await ty.home.getCurrentHomeInfo();
541
+ const {
542
+ data: {
543
+ uuid
544
+ }
545
+ } = await getDevInfo(deviceId);
546
+ const res = await getDeviceDetailsById(_objectSpread({
547
+ uuid,
548
+ homeId,
549
+ categoryCode
550
+ }, extendParam));
551
+ return {
552
+ code: 0,
553
+ data: (res === null || res === void 0 ? void 0 : res.isBind) === 1
554
+ };
555
+ } catch (err) {
556
+ return {
557
+ code: -1,
558
+ msg: err,
559
+ data: false
560
+ };
561
+ }
536
562
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/ray-ipc-utils",
3
- "version": "1.1.6",
3
+ "version": "1.1.8-beta-1",
4
4
  "description": "IPC 工具库",
5
5
  "main": "lib/index",
6
6
  "files": [