@ray-js/ipc-player-integration 0.0.35-beta.5 → 0.0.35-beta.7

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.
@@ -52,7 +52,6 @@ export async function initPlayerWidgets(ctx, options) {
52
52
  newDefaultBottomLeftContent[magnificationIndex].hidden = false;
53
53
  }
54
54
  }
55
- console.log('res===1', newDefaultBottomLeftContent);
56
55
  ctx.addContent('bottomLeft', newDefaultBottomLeftContent);
57
56
  const newDefaultBottomRightContent = _cloneDeep(options.bottomRightContent || defaultBottomRightContent);
58
57
  const fullScreenIndex = newDefaultBottomRightContent.findIndex(item => item.id === 'FullScreen');
@@ -96,6 +96,7 @@ const BottomLeftContent = _ref => {
96
96
  style: {
97
97
  paddingBottom: screenType === 'vertical' ? '14px' : '32px',
98
98
  paddingLeft: `${paddingLeftPx}px`,
99
+ paddingRight: '16px',
99
100
  width: '100%',
100
101
  overflowX: 'auto',
101
102
  overflowY: 'hidden',
package/lib/ui/ui.js CHANGED
@@ -22,7 +22,6 @@ import { useMemoizedFn } from '../hooks';
22
22
  import { Storage } from '../utils/storage';
23
23
  import './ui.less';
24
24
  import { updatePlayerWidgetProps } from '../features';
25
- import { isSmallScreen } from '../utils';
26
25
  import { getSmartImageQualityState } from '../utils/ttt';
27
26
  function getCtxInstance(instance, devId) {
28
27
  if (instance) return instance;
@@ -104,18 +103,31 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
104
103
  useImperativeHandle(eventRefProp, () => eventRef.current, [eventRef.current]);
105
104
  const timer = useRef();
106
105
  const reGetOrientationTimer = useRef(null);
107
- const [scaleMultiple, setScaleMultiple] = useState(playerFit === 'contain' ? 1 : -2);
108
- const [currentZoomLevel, setCurrentZoomLevel] = useState(playerFit === 'contain' ? 1 : -2);
106
+ // 统一调整为1倍缩放,保证画面展示完全
107
+ const [scaleMultiple, setScaleMultiple] = useState(1);
108
+ // 统一调整为1倍缩放,保证画面展示完全
109
+ const [currentZoomLevel, setCurrentZoomLevel] = useState(1);
109
110
  const [createCtx, setCreateCtx] = useState(false);
110
111
  // 是否需要忽略进入后台停止预览
111
112
  const [ignoreStopOnHide, setIgnoreStopOnHide] = useState(ignoreHideStopPreview);
112
113
  const [verticalCoverZoom, setVerticalCoverZoom] = useState(-2);
113
- // const [verticalCoverZoom, setVerticalCoverZoom] = useState(-2);
114
- // const [verticalZoomLevel, setVerticalZoomLevel] = useState(playerFit === 'contain' ? 1 : -2);
115
114
 
116
115
  // 展示顶部内容
117
116
  const [showTopContent, setShowTopContent] = useState(true);
118
117
 
118
+ // pad / 折叠屏小窗口展示面板的情况;getSystemInfoSync 在 onLoad 之后才有准确值,
119
+ // 这里给安全默认 false,由 onLoad / onResize 实际计算并更新
120
+ const [isSmallScreen, setIsSmallScreen] = useState(false);
121
+ const computeIsSmallScreen = useMemoizedFn(() => {
122
+ const {
123
+ windowWidth,
124
+ screenWidth,
125
+ windowHeight
126
+ } = getSystemInfoSync();
127
+ // 取小屏值判断是最准确的 pad / 折叠屏小窗口情况
128
+ return !(screenWidth === windowWidth || screenWidth === windowHeight);
129
+ });
130
+
119
131
  // 外部传入的ignoreHideStopPreview变化时,同步更新
120
132
  useEffect(() => {
121
133
  setIgnoreStopOnHide(ignoreHideStopPreview);
@@ -407,8 +419,8 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
407
419
  eventRef.current.emit(showAllComponent);
408
420
  eventRef.current.emit('disablePlayerTap', true);
409
421
  eventRef.current.emit(pauseTimeToHideAllComponent);
410
- // 按宽填充,保证播放流宽度为屏幕宽度,高度自适应
411
- setScaleMultiple(-1);
422
+ // 按宽填充,保证播放流宽度为屏幕宽度,高度自适应设为1倍
423
+ setScaleMultiple(1);
412
424
  } else {
413
425
  // 短屏或横屏时,恢复自动隐藏
414
426
  eventRef.current.emit('disablePlayerTap', false);
@@ -417,8 +429,9 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
417
429
  }, [isVerticalFullLayout, screenType, playerFit]);
418
430
  useEffect(() => {
419
431
  if (createCtx) {
420
- setScaleMultiple(playerFit === 'contain' ? 1 : -2);
421
- setCurrentZoomLevel(playerFit === 'contain' ? 1 : -2);
432
+ // 统一调整为1倍缩放,保证画面展示完全
433
+ setScaleMultiple(1);
434
+ setCurrentZoomLevel(1);
422
435
  }
423
436
  }, [playerFit, createCtx]);
424
437
  useEffect(() => {
@@ -427,10 +440,14 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
427
440
  }, [brandColor, verticalMic]);
428
441
  const refreshSmartImageQuality = useMemoizedFn(() => {
429
442
  getSmartImageQualityState(devId).then(res => {
443
+ if (res === undefined) return;
430
444
  updatePlayerWidgetProps(instance, 'bottomLeft', 'TryExperience', {
445
+ isPurchase: res.isPurchase,
431
446
  buttonState: res.buttonState,
432
447
  trialRemainingSec: res.trialRemainingSec,
433
448
  refreshToken: Date.now()
449
+ }).catch(() => {
450
+ // ignore
434
451
  });
435
452
  });
436
453
  });
@@ -468,6 +485,13 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
468
485
  * 监听播放器实例创建完成
469
486
  */
470
487
 
488
+ /**
489
+ * 页面 onLoad 后才能拿到准确的 systemInfo,这里第一次确定小屏状态
490
+ */
491
+ usePageEvent('onLoad', () => {
492
+ setIsSmallScreen(computeIsSmallScreen());
493
+ });
494
+
471
495
  /**
472
496
  * 监听屏幕布局变化
473
497
  */
@@ -481,8 +505,13 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
481
505
  const {
482
506
  type
483
507
  } = sizeData;
508
+
509
+ // 折叠屏展开/收起、pad 多窗口拖拽等场景,需要重新计算并同步
510
+ const small = computeIsSmallScreen();
511
+ setIsSmallScreen(small);
512
+
484
513
  // 针对pad 和折叠屏展开的情况暂不支持横屏,且在ios pad模式下 会触发onResize事件, 待解决
485
- if (isSmallScreen) {
514
+ if (small) {
486
515
  setScreenType('vertical');
487
516
  } else {
488
517
  setScreenType(type === 'landscape' ? 'full' : 'vertical');
@@ -497,19 +526,8 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
497
526
  }
498
527
  triggerEvent(showAllComponent);
499
528
  }
500
- // 若为全屏模式并且要求按宽填充,即横屏时充满,主动设置模式为-1即可
501
- if (type === 'landscape' && landscapeMode === 'fill') {
502
- console.log(scaleMultiple, '===========fill');
503
- setScaleMultiple(-1);
504
- } else if (type === 'landscape' && landscapeMode === 'standard') {
505
- console.log(scaleMultiple, '===========landscape');
506
- setScaleMultiple(-2);
507
- } else {
508
- // 竖屏时 将屏幕播放比例设为按宽按高
509
-
510
- console.log(scaleMultiple, '===========landscape');
511
- setScaleMultiple(playerFit === 'contain' ? scaleMultiple === 1 ? -1 : 1 : -2);
512
- }
529
+ // 横屏(fill/standard)与竖屏均统一调整为 1 倍缩放,保证画面完整展示
530
+ setScaleMultiple(1);
513
531
  } catch (err) {
514
532
  console.log(err, 'err');
515
533
  }
@@ -673,10 +691,12 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
673
691
  }
674
692
  }
675
693
  if (playState === PlayState.PLAYING) {
676
- // 仅在第一次播放成功时,针对竖屏并且为cover模式时,设置为-2
694
+ // 仅在第一次播放成功时,针对竖屏并且为cover模式时,设置为-2 修改为只针对第一次播放成功时
677
695
  console.log('Playing状态');
678
- if (screenType === 'vertical' && playerFit === 'cover' && !hasPlayedRef.current) {
679
- setScaleMultiple(-2);
696
+ // if (screenType === 'vertical' && playerFit === 'cover' && !hasPlayedRef.current) {
697
+ if (!hasPlayedRef.current) {
698
+ // 统一调整为1倍缩放,保证画面展示完全
699
+ setScaleMultiple(1);
680
700
  hasPlayedRef.current = true;
681
701
  }
682
702
  }
@@ -792,14 +812,6 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
792
812
  /**
793
813
  * 监听当前的zoom比例状态
794
814
  */
795
- // useEffect(() => {
796
- // if (screenType === 'vertical') {
797
- // console.log(currentZoomLevel, '竖屏时的缩放比例');
798
- // setVerticalZoomLevel(currentZoomLevel);
799
- // // setScaleMultiple(currentZoomLevel);
800
- // }
801
- // }, [screenType, currentZoomLevel]);
802
-
803
815
  const onZoomChange = useMemoizedFn(data => {
804
816
  const {
805
817
  zoomLevel,
@@ -810,30 +822,19 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
810
822
  if (zoomLevel === 0) {
811
823
  return false;
812
824
  }
813
- /**
814
- * 针对竖屏为cover模式时,横屏为standard模式时,主动设置缩放比例,避免因值不能正常变化
815
- */
816
- if (scaleMode === -2 && playerFit === 'cover' && screenType === 'vertical' && landscapeMode === 'standard') {
817
- console.log('dsadsadsad----', zoomLevel);
818
- setScaleMultiple(zoomLevel);
819
- }
820
825
  /**
821
826
  * 针对竖屏为contain模式时,横屏为fill模式时,主动设置缩放比例,避免因值不能正常变化
822
827
  */
823
- if (scaleMode === -1 && playerFit === 'contain' && screenType === 'vertical' && landscapeMode === 'fill') {
824
- setVerticalCoverZoom(zoomLevel);
825
- }
828
+ // if (
829
+ // scaleMode === -1 &&
830
+ // playerFit === 'contain' &&
831
+ // screenType === 'vertical' &&
832
+ // landscapeMode === 'fill'
833
+ // ) {
834
+ // setVerticalCoverZoom(zoomLevel);
835
+ // }
826
836
 
827
- /**
828
- * 横屏情况下 针对竖屏为contain模式时,横屏为fill模式时,主动设置缩放比例,避免因值不能正常变化
829
- */
830
- if (scaleMode === -2 && playerFit === 'cover' && screenType !== 'vertical' && landscapeMode === 'standard') {
831
- setScaleMultiple(zoomLevel);
832
- }
833
- if (scaleMode === -1 && playerFit === 'contain' && screenType !== 'vertical' && landscapeMode === 'fill') {
834
- setVerticalCoverZoom(zoomLevel);
835
- setScaleMultiple(zoomLevel);
836
- }
837
+ // 直接记录当前缩放比例
837
838
  setCurrentZoomLevel(zoomLevel);
838
839
  instance.event.emit(zoomLevelChange, zoomLevel);
839
840
  return false;
@@ -1,5 +1,4 @@
1
1
  /// <reference types="jest" />
2
- export declare const isSmallScreen: boolean;
3
2
  /**
4
3
  * 麦克风对讲按钮径向渐变
5
4
  */
@@ -1,14 +1,4 @@
1
1
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
- import { getSystemInfoSync } from '@ray-js/ray';
3
- const {
4
- windowWidth,
5
- screenWidth,
6
- windowHeight
7
- } = getSystemInfoSync();
8
-
9
- // pad和折叠屏小窗口展示面板的情况
10
- export const isSmallScreen = !(screenWidth === windowWidth || screenWidth === windowHeight);
11
-
12
2
  /**
13
3
  * 麦克风对讲按钮径向渐变
14
4
  */
@@ -4,3 +4,4 @@ export declare const miniIdLabs: {
4
4
  };
5
5
  export declare function gotoAIDrawMiniProgram(devId: string, brandColor: string): void;
6
6
  export declare function gotoSecurityCloudService(homeId: string, uuid: string): Promise<void>;
7
+ export declare function gotoSecurityCloudService2(devId: string): Promise<import("@ray-js/ray-ipc-utils/lib/interface").IRes<unknown>>;
@@ -1,4 +1,4 @@
1
- import { goToMiniProgramByShortLink } from '@ray-js/ray-ipc-utils';
1
+ import { getServiceUrl, goToMiniProgramByShortLink } from '@ray-js/ray-ipc-utils';
2
2
  import Color from 'color';
3
3
 
4
4
  // 小程序ID集合
@@ -17,4 +17,7 @@ export function gotoAIDrawMiniProgram(devId, brandColor) {
17
17
  export async function gotoSecurityCloudService(homeId, uuid) {
18
18
  const url = `godzilla://${miniIdLabs.securityCloudService}${'/pages/serviceList/index'}?homeId=${homeId}&deviceId=${uuid}&categoryCode=${'security_cloud_service'}`;
19
19
  goToMiniProgramByShortLink(url, 'right');
20
+ }
21
+ export async function gotoSecurityCloudService2(devId) {
22
+ return getServiceUrl(devId, 'security_cloud_service', {}, true);
20
23
  }
@@ -37,3 +37,4 @@ export declare function getAIFrameFeature(devId: string): Promise<GetAIFrameFeat
37
37
  export declare function setAIFrameFeature(params: SetAIFrameFeatureParams): Promise<any>;
38
38
  export declare function getDeviceInfoRay(devId: string): Promise<unknown>;
39
39
  export declare function getCurrentHomeInfoRay(): Promise<unknown>;
40
+ export declare function setTrailFinish(devId: string): Promise<unknown>;
package/lib/utils/ttt.js CHANGED
@@ -1,11 +1,6 @@
1
1
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
2
  export function getSmartImageQualityState(devId) {
3
- return new Promise((resolve, reject) => {
4
- var _ty;
5
- if (typeof ((_ty = ty) === null || _ty === void 0 || (_ty = _ty.ipc) === null || _ty === void 0 ? void 0 : _ty.getSmartImageQualityState) !== 'function') {
6
- reject(new Error('getSmartImageQualityState is not supported'));
7
- return;
8
- }
3
+ return new Promise(resolve => {
9
4
  try {
10
5
  ty.ipc.getSmartImageQualityState({
11
6
  devId,
@@ -14,24 +9,17 @@ export function getSmartImageQualityState(devId) {
14
9
  console.log('res===getSmartImageQualityState data', data);
15
10
  resolve(data);
16
11
  },
17
- fail: e => {
18
- console.warn('res===getSmartImageQualityState fail', e);
19
- reject(e);
12
+ fail: () => {
13
+ resolve(undefined);
20
14
  }
21
15
  });
22
16
  } catch (e) {
23
- console.warn('res===getSmartImageQualityState exception', e);
24
- reject(e);
17
+ resolve(undefined);
25
18
  }
26
19
  });
27
20
  }
28
21
  export function getAIFrameFeature(devId) {
29
- return new Promise((resolve, reject) => {
30
- var _ty2;
31
- if (typeof ((_ty2 = ty) === null || _ty2 === void 0 || (_ty2 = _ty2.ipc) === null || _ty2 === void 0 ? void 0 : _ty2.getAIFrameFeature) !== 'function') {
32
- reject(new Error('getAIFrameFeature is not supported'));
33
- return;
34
- }
22
+ return new Promise(resolve => {
35
23
  try {
36
24
  ty.ipc.getAIFrameFeature({
37
25
  devId,
@@ -41,22 +29,16 @@ export function getAIFrameFeature(devId) {
41
29
  },
42
30
  fail: e => {
43
31
  console.warn('res===getAIFrameFeature fail', e);
44
- reject(e);
32
+ resolve(undefined);
45
33
  }
46
34
  });
47
35
  } catch (e) {
48
- console.warn('res===getAIFrameFeature exception', e);
49
- reject(e);
36
+ resolve(undefined);
50
37
  }
51
38
  });
52
39
  }
53
40
  export function setAIFrameFeature(params) {
54
- return new Promise((resolve, reject) => {
55
- var _ty3;
56
- if (typeof ((_ty3 = ty) === null || _ty3 === void 0 || (_ty3 = _ty3.ipc) === null || _ty3 === void 0 ? void 0 : _ty3.setAIFrameFeature) !== 'function') {
57
- reject(new Error('setAIFrameFeature is not supported'));
58
- return;
59
- }
41
+ return new Promise(resolve => {
60
42
  try {
61
43
  ty.ipc.setAIFrameFeature(_objectSpread(_objectSpread({}, params), {}, {
62
44
  success: data => {
@@ -65,55 +47,61 @@ export function setAIFrameFeature(params) {
65
47
  },
66
48
  fail: e => {
67
49
  console.warn('res===setAIFrameFeature fail', e);
68
- reject(e);
50
+ resolve(undefined);
69
51
  }
70
52
  }));
71
53
  } catch (e) {
72
- console.warn('res===setAIFrameFeature exception', e);
73
- reject(e);
54
+ resolve(undefined);
74
55
  }
75
56
  });
76
57
  }
77
58
  export function getDeviceInfoRay(devId) {
78
- return new Promise((resolve, reject) => {
79
- var _ty4;
80
- if (typeof ((_ty4 = ty) === null || _ty4 === void 0 || (_ty4 = _ty4.device) === null || _ty4 === void 0 ? void 0 : _ty4.getDeviceInfo) !== 'function') {
81
- reject(new Error('getDeviceInfo is not supported'));
82
- return;
83
- }
59
+ return new Promise(resolve => {
84
60
  try {
85
61
  ty.device.getDeviceInfo({
86
62
  deviceId: devId,
87
63
  success: res => {
88
64
  resolve(res);
89
65
  },
90
- fail: error => {
91
- reject(error);
66
+ fail: () => {
67
+ resolve(undefined);
92
68
  }
93
69
  });
94
70
  } catch (e) {
95
- reject(e);
71
+ resolve(undefined);
96
72
  }
97
73
  });
98
74
  }
99
75
  export function getCurrentHomeInfoRay() {
100
- return new Promise((resolve, reject) => {
101
- var _ty5;
102
- if (typeof ((_ty5 = ty) === null || _ty5 === void 0 || (_ty5 = _ty5.home) === null || _ty5 === void 0 ? void 0 : _ty5.getCurrentHomeInfo) !== 'function') {
103
- reject(new Error('getCurrentHomeInfo is not supported'));
104
- return;
105
- }
76
+ return new Promise(resolve => {
106
77
  try {
107
78
  ty.home.getCurrentHomeInfo({
108
79
  success: res => {
109
80
  resolve(res);
110
81
  },
111
- fail: error => {
112
- reject(error);
82
+ fail: () => {
83
+ resolve(undefined);
84
+ }
85
+ });
86
+ } catch (e) {
87
+ resolve(undefined);
88
+ }
89
+ });
90
+ }
91
+ export function setTrailFinish(devId) {
92
+ return new Promise(resolve => {
93
+ try {
94
+ ty.ipc.setTrailFinish({
95
+ devId,
96
+ success: res => {
97
+ resolve(res);
98
+ },
99
+ fail: () => {
100
+ resolve(undefined);
113
101
  }
114
102
  });
115
103
  } catch (e) {
116
- reject(e);
104
+ resolve(undefined);
117
105
  }
118
106
  });
119
107
  }
@@ -1,6 +1,6 @@
1
1
  import { useCallback, useEffect, useState } from 'react';
2
- import { getCurrentHomeInfoRay, getDeviceInfoRay } from '../../utils/ttt';
3
- import { gotoSecurityCloudService } from '../../utils';
2
+ import { setTrailFinish } from '../../utils/ttt';
3
+ import { gotoSecurityCloudService2 } from '../../utils';
4
4
  import { trialCountdownEnd } from '../../ui/constant';
5
5
  import Strings from '../../i18n';
6
6
  export const useTrialBadge = (event, devId, trialRemainingSec) => {
@@ -12,12 +12,14 @@ export const useTrialBadge = (event, devId, trialRemainingSec) => {
12
12
  }, [trialRemainingSec]);
13
13
  const handleTrialSubscribe = useCallback(async () => {
14
14
  try {
15
- const homeInfo = await getCurrentHomeInfoRay();
16
- const deviceInfo = await getDeviceInfoRay(devId);
17
- console.log('res===', deviceInfo, homeInfo);
18
- gotoSecurityCloudService(homeInfo.homeId, deviceInfo.uuid);
15
+ // const homeInfo = await getCurrentHomeInfoRay();
16
+ // const deviceInfo = await getDeviceInfoRay(devId);
17
+ // if (homeInfo !== undefined && deviceInfo !== undefined) {
18
+ // console.log('res===', deviceInfo, homeInfo);
19
+ // gotoSecurityCloudService(homeInfo.homeId, deviceInfo.uuid);
20
+ const res = await gotoSecurityCloudService2(devId);
21
+ console.log('res===gotoSecurityCloudService2', res);
19
22
  } catch (error) {
20
- console.log('res===handleTrialSubscribe error', error);
21
23
  ty.showToast({
22
24
  title: Strings.getLang('ipc_player_fetch_error'),
23
25
  icon: 'none'
@@ -26,9 +28,9 @@ export const useTrialBadge = (event, devId, trialRemainingSec) => {
26
28
  }, [devId]);
27
29
  const handleCountdownEnd = useCallback(async () => {
28
30
  try {
29
- console.log('res===handleCountdownEnd');
30
31
  setShowTrialBadge(false);
31
32
  event.emit(trialCountdownEnd);
33
+ await setTrailFinish(devId);
32
34
  } catch (error) {
33
35
  ty.showToast({
34
36
  title: Strings.getLang('ipc_player_fetch_error'),
@@ -5,6 +5,8 @@ type Props = ComponentConfigProps & {
5
5
  className?: string;
6
6
  hideTryExperienceMenu?: boolean;
7
7
  buttonState?: number;
8
+ trialRemainingSec?: number;
9
+ isPurchase?: boolean;
8
10
  };
9
11
  export declare const TryExperience: (props: Props) => React.JSX.Element | null;
10
12
  export {};
@@ -1,6 +1,6 @@
1
1
  import { View, Image, getSystemInfoSync } from '@ray-js/ray';
2
2
  import clsx from 'clsx';
3
- import React from 'react';
3
+ import React, { useState, useEffect } from 'react';
4
4
  import { useStore } from '../../ctx/store';
5
5
  import { gotoAIDrawMiniProgram } from '../../utils';
6
6
  import tryZh from '../../res/try/try_zh.png';
@@ -41,27 +41,41 @@ export const TryExperience = props => {
41
41
  const {
42
42
  className,
43
43
  hideTryExperienceMenu,
44
- buttonState
44
+ buttonState,
45
+ trialRemainingSec,
46
+ isPurchase
45
47
  } = props;
46
48
  const {
47
49
  brandColor
48
50
  } = useStore({
49
51
  brandColor: props.brandColor
50
52
  });
53
+ const [imgSrc, setImgSrc] = useState();
54
+ useEffect(() => {
55
+ const iconUrl = pickIconByStatus(buttonState);
56
+ setImgSrc(iconUrl);
57
+ }, [buttonState]);
51
58
  if (hideTryExperienceMenu) {
52
59
  return null;
53
60
  }
54
- const iconUrl = pickIconByStatus(buttonState);
55
61
  return /*#__PURE__*/React.createElement(View, {
56
62
  className: clsx(className),
57
63
  onClick: () => {
58
- gotoAIDrawMiniProgram(props.devId, brandColor);
64
+ if (buttonState === TryExperienceStatus.Open) {
65
+ setImgSrc(tryOpen);
66
+ } else if (buttonState === TryExperienceStatus.Close && isPurchase) {
67
+ setImgSrc(tryClose);
68
+ } else if (buttonState === TryExperienceStatus.Close && trialRemainingSec < 300 && trialRemainingSec > 0) {
69
+ setImgSrc(tryClose);
70
+ } else {
71
+ gotoAIDrawMiniProgram(props.devId, brandColor);
72
+ }
59
73
  }
60
74
  }, /*#__PURE__*/React.createElement(View, {
61
75
  className: "try-experience-box"
62
- }, /*#__PURE__*/React.createElement(Image, {
76
+ }, imgSrc && /*#__PURE__*/React.createElement(Image, {
63
77
  className: "try-experience-icon",
64
- src: iconUrl,
78
+ src: imgSrc,
65
79
  mode: "heightFix"
66
80
  })));
67
81
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/ipc-player-integration",
3
- "version": "0.0.35-beta.5",
3
+ "version": "0.0.35-beta.7",
4
4
  "description": "IPC 融合播放器",
5
5
  "main": "lib/index",
6
6
  "files": [
@@ -64,7 +64,7 @@
64
64
  "husky": {
65
65
  "hooks": {
66
66
  "commit-msg": "commitlint -E HUSKY_GIT_PARAMS --config commitlint.config.js",
67
- "pre-commit": "lint-staged"
67
+ "pre-commit": "node ./scripts/check-protected-files.js && lint-staged"
68
68
  }
69
69
  },
70
70
  "lint-staged": {