pb-sxp-ui 1.15.15-alpha.1 → 1.15.15-alpha.2

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.
package/dist/pb-ui.js CHANGED
@@ -19480,11 +19480,11 @@ Made in Italy` })));
19480
19480
  const [isPauseVideo, setIsPauseVideo] = React.useState(false);
19481
19481
  const videoRef = React.useRef(null);
19482
19482
  const { bffEventReport, sxpParameter, waterFallData, openHashtag } = useSxpDataSource();
19483
- const videoStartTime = React.useRef(0);
19483
+ React.useRef(0);
19484
19484
  const [isLoadFinish, setIsLoadFinish] = React.useState(false);
19485
- const [isFirstPlay, setIsFirstPlay] = React.useState(true);
19486
- const canvasRef = React.useRef(null);
19487
- const [firstFrameSrc, setFirstFrameSrc] = React.useState('');
19485
+ React.useState(true);
19486
+ React.useRef(null);
19487
+ React.useState('');
19488
19488
  const videoId = `pb-cache-video-${index}`;
19489
19489
  const hlsRef = React.useRef(null);
19490
19490
  const loopPlayRef = React.useRef(loopPlay);
@@ -19509,8 +19509,6 @@ Made in Italy` })));
19509
19509
  setIsPauseVideo(true);
19510
19510
  },
19511
19511
  setLoopPlay(v) {
19512
- if (!videoRef.current)
19513
- return;
19514
19512
  loopPlayRef.current = v;
19515
19513
  },
19516
19514
  isPlaying() {
@@ -19524,22 +19522,7 @@ Made in Italy` })));
19524
19522
  return;
19525
19523
  videoRef.current.muted = muted;
19526
19524
  }, [muted]);
19527
- React.useCallback(() => {
19528
- var _a;
19529
- (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.play();
19530
- }, []);
19531
19525
  const PAUSE_ICON = useIconLink('/pb_static/06f28a2025c74c1cb49be6767316d827.png');
19532
- React.useCallback(() => {
19533
- var _a, _b, _c, _d, _e, _f;
19534
- setIsPauseVideo(false);
19535
- const item = data[index];
19536
- if (item && ((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.duration)) {
19537
- videoStartTime.current = ((_b = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _b === void 0 ? void 0 : _b.currentTime) || 0;
19538
- ((_d = (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.duration) !== null && _d !== void 0 ? _d : 0).toFixed(2);
19539
- ((_f = (_e = videoRef.current) === null || _e === void 0 ? void 0 : _e.currentTime) !== null && _f !== void 0 ? _f : 0).toFixed(2);
19540
- setIsFirstPlay(false);
19541
- }
19542
- }, [bffEventReport, data, index, isFirstPlay]);
19543
19526
  const handleLoadedMetadata = React.useCallback(() => {
19544
19527
  var _a;
19545
19528
  videoRef.current.currentTime = rec === null || rec === void 0 ? void 0 : rec.startTime;
@@ -19581,50 +19564,24 @@ Made in Italy` })));
19581
19564
  const blur = React.useMemo(() => {
19582
19565
  return (videoPostConfig === null || videoPostConfig === void 0 ? void 0 : videoPostConfig.mode) === '2';
19583
19566
  }, [videoPostConfig]);
19584
- React.useMemo(() => {
19585
- var _a;
19586
- return (videoPostConfig === null || videoPostConfig === void 0 ? void 0 : videoPostConfig.mode) === '2'
19587
- ? `translateY(-${50 + ((_a = videoPostConfig === null || videoPostConfig === void 0 ? void 0 : videoPostConfig.offsetTop) !== null && _a !== void 0 ? _a : 0)}%) translate3d(0px, 0px, 0px)`
19588
- : 'translateY(-50%)';
19589
- }, [videoPostConfig]);
19590
- React.useCallback(() => {
19591
- if (!canvasRef || !videoRef || !videoRef.current || !canvasRef.current)
19592
- return;
19593
- const video = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current;
19594
- const canvas = canvasRef === null || canvasRef === void 0 ? void 0 : canvasRef.current;
19595
- const ctx = canvas.getContext('2d');
19596
- const targetWidth = window === null || window === void 0 ? void 0 : window.innerWidth;
19597
- const targetHeight = window === null || window === void 0 ? void 0 : window.innerHeight;
19598
- canvas.height = targetHeight;
19599
- canvas.width = targetWidth;
19600
- ctx === null || ctx === void 0 ? void 0 : ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
19601
- setFirstFrameSrc(canvas.toDataURL());
19602
- }, []);
19603
- const handleTimeUpload = React.useCallback(() => {
19604
- var _a;
19567
+ const handleTimeUpload = () => {
19605
19568
  if (!videoRef.current)
19606
19569
  return;
19607
- const localTime = ((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.currentTime) - (rec === null || rec === void 0 ? void 0 : rec.startTime);
19608
- onUpdateTimeLine === null || onUpdateTimeLine === void 0 ? void 0 : onUpdateTimeLine(index, localTime);
19609
19570
  setTimeout(() => {
19610
- var _a, _b;
19571
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
19611
19572
  if (((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.currentTime) >= ((_b = rec === null || rec === void 0 ? void 0 : rec.endTime) !== null && _b !== void 0 ? _b : 0)) {
19612
- slideSwiper();
19573
+ (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.pause();
19574
+ if (!loopPlayRef.current)
19575
+ return;
19576
+ if (index === (data === null || data === void 0 ? void 0 : data.length) - 1) {
19577
+ (_e = (_d = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _d === void 0 ? void 0 : _d.swiper) === null || _e === void 0 ? void 0 : _e.slideTo(0);
19578
+ }
19579
+ else {
19580
+ const i = (_g = (_f = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _f === void 0 ? void 0 : _f.swiper) === null || _g === void 0 ? void 0 : _g.activeIndex;
19581
+ (_j = (_h = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _h === void 0 ? void 0 : _h.swiper) === null || _j === void 0 ? void 0 : _j.slideTo(i + 1);
19582
+ }
19613
19583
  }
19614
19584
  });
19615
- }, []);
19616
- const slideSwiper = () => {
19617
- var _a, _b, _c, _d, _e, _f, _g;
19618
- (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.pause();
19619
- if (!loopPlayRef.current)
19620
- return;
19621
- if (index === (data === null || data === void 0 ? void 0 : data.length) - 1) {
19622
- (_c = (_b = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _b === void 0 ? void 0 : _b.swiper) === null || _c === void 0 ? void 0 : _c.slideTo(0);
19623
- }
19624
- else {
19625
- const i = (_e = (_d = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _d === void 0 ? void 0 : _d.swiper) === null || _e === void 0 ? void 0 : _e.activeIndex;
19626
- (_g = (_f = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _f === void 0 ? void 0 : _f.swiper) === null || _g === void 0 ? void 0 : _g.slideTo(i + 1);
19627
- }
19628
19585
  };
19629
19586
  const handlePause = () => {
19630
19587
  setIsPauseVideo(true);
@@ -19736,7 +19693,7 @@ Made in Italy` })));
19736
19693
  * @Author: binruan@chatlabs.com
19737
19694
  * @Date: 2025-03-25 13:54:27
19738
19695
  * @LastEditors: binruan@chatlabs.com
19739
- * @LastEditTime: 2025-04-01 17:54:08
19696
+ * @LastEditTime: 2025-04-02 13:53:15
19740
19697
  * @FilePath: \pb-sxp-ui\src\core\components\DiyStoryPreview\index.tsx
19741
19698
  *
19742
19699
  */
@@ -20039,7 +19996,7 @@ Made in Italy` })));
20039
19996
  const renderLikeButton = (rec, index) => {
20040
19997
  var _a, _b, _c, _d;
20041
19998
  if (!(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowLike))
20042
- return;
19999
+ return null;
20043
20000
  let top = (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIconY) !== null && _a !== void 0 ? _a : 400;
20044
20001
  if (top < 40) {
20045
20002
  top += 40;
@@ -20069,12 +20026,12 @@ Made in Italy` })));
20069
20026
  const renderToggleButton = (visible) => {
20070
20027
  var _a, _b, _c, _d;
20071
20028
  if (!visible)
20072
- return;
20029
+ return null;
20073
20030
  let top = (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconY) !== null && _a !== void 0 ? _a : 23;
20074
20031
  if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconYPosit) === 'top') {
20075
20032
  top += 45;
20076
20033
  }
20077
- return (((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowMute) === undefined || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowMute) === true) && (React.createElement(ToggleButton$1, { style: {
20034
+ return (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowMute) === undefined || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowMute) === true ? (React.createElement(ToggleButton$1, { style: {
20078
20035
  position: 'absolute',
20079
20036
  visibility: 'visible',
20080
20037
  zIndex: 999,
@@ -20088,7 +20045,7 @@ Made in Italy` })));
20088
20045
  border: 'none',
20089
20046
  boxSizing: 'content-box',
20090
20047
  padding: 0
20091
- }, defaultValue: true, activeIcon: (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.unMuteIcon) ? globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.unMuteIcon : mutedIcon, unactiveIcon: (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIcon) ? globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIcon : unmutedIcon })));
20048
+ }, defaultValue: true, activeIcon: (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.unMuteIcon) ? globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.unMuteIcon : mutedIcon, unactiveIcon: (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIcon) ? globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIcon : unmutedIcon })) : null;
20092
20049
  };
20093
20050
  const renderView = (item, index) => {
20094
20051
  var _a, _b, _c, _d;