pb-sxp-ui 1.0.26 → 1.0.28

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
@@ -12085,13 +12085,24 @@ Made in Italy` })));
12085
12085
  });
12086
12086
  }
12087
12087
  }, [data, index, bffEventReport]);
12088
+ const blur = React.useMemo(() => {
12089
+ return (videoPostConfig === null || videoPostConfig === void 0 ? void 0 : videoPostConfig.mode) === '2';
12090
+ }, [videoPostConfig]);
12091
+ const translateY = React.useMemo(() => {
12092
+ var _a;
12093
+ return (videoPostConfig === null || videoPostConfig === void 0 ? void 0 : videoPostConfig.mode) === '2'
12094
+ ? `translateY(-${50 + ((_a = videoPostConfig === null || videoPostConfig === void 0 ? void 0 : videoPostConfig.offsetTop) !== null && _a !== void 0 ? _a : 0)}%)`
12095
+ : 'translateY(-50%)';
12096
+ }, [videoPostConfig]);
12097
+ const blurBgSrc = React.useMemo(() => {
12098
+ var _a;
12099
+ return ((_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.cover) || firstFrameSrc;
12100
+ }, [firstFrameSrc, rec]);
12088
12101
  const handLoadeddata = React.useCallback(() => {
12089
- const video = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current;
12090
- if (!video)
12102
+ if (!canvasRef || !videoRef || !videoRef.current || !canvasRef.current)
12091
12103
  return;
12104
+ const video = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current;
12092
12105
  const canvas = canvasRef === null || canvasRef === void 0 ? void 0 : canvasRef.current;
12093
- if (!canvas)
12094
- return;
12095
12106
  const ctx = canvas.getContext('2d');
12096
12107
  const targetWidth = window === null || window === void 0 ? void 0 : window.innerWidth;
12097
12108
  const targetHeight = window === null || window === void 0 ? void 0 : window.innerHeight;
@@ -12099,10 +12110,9 @@ Made in Italy` })));
12099
12110
  canvas.width = targetWidth;
12100
12111
  ctx === null || ctx === void 0 ? void 0 : ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
12101
12112
  setFirstFrameSrc(canvas.toDataURL());
12102
- canvas.remove();
12103
12113
  }, []);
12104
12114
  React.useEffect(() => {
12105
- var _a, _b, _c;
12115
+ var _a, _b, _c, _d;
12106
12116
  if (!videoRef.current)
12107
12117
  return;
12108
12118
  setIsPauseVideo(false);
@@ -12125,14 +12135,16 @@ Made in Italy` })));
12125
12135
  videoRef.current.setAttribute('x5-playsinline', 'true');
12126
12136
  videoRef.current.setAttribute('webkit-playsinline', 'true');
12127
12137
  }
12128
- (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.addEventListener('canplay', handleLoadedMetadata);
12129
- (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.addEventListener('playing', handlePlaying);
12130
- (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.addEventListener('loadeddata', handLoadeddata);
12138
+ (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.addEventListener('loadedmetadata', handleLoadedMetadata);
12139
+ (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.addEventListener('canplay', handleLoadedMetadata);
12140
+ (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.addEventListener('playing', handlePlaying);
12141
+ (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.addEventListener('loadeddata', handLoadeddata);
12131
12142
  return () => {
12132
- var _a, _b, _c;
12133
- (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('canplay', handleLoadedMetadata);
12134
- (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.removeEventListener('playing', handlePlaying);
12135
- (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.removeEventListener('loadeddata', handLoadeddata);
12143
+ var _a, _b, _c, _d;
12144
+ (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('loadedmetadata', handleLoadedMetadata);
12145
+ (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.removeEventListener('canplay', handleLoadedMetadata);
12146
+ (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.removeEventListener('playing', handlePlaying);
12147
+ (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.removeEventListener('loadeddata', handLoadeddata);
12136
12148
  };
12137
12149
  }, [handleLoadedMetadata, handlePlaying, rec.video, handLoadeddata]);
12138
12150
  React.useEffect(() => {
@@ -12191,19 +12203,6 @@ Made in Italy` })));
12191
12203
  window.removeEventListener('beforeunload', handleBeforeUnload);
12192
12204
  };
12193
12205
  }, [activeIndex, index, rec, videoRef, handleClickVideo, isPauseVideo]);
12194
- const blur = React.useMemo(() => {
12195
- return (videoPostConfig === null || videoPostConfig === void 0 ? void 0 : videoPostConfig.mode) === '2';
12196
- }, [videoPostConfig]);
12197
- const translateY = React.useMemo(() => {
12198
- var _a;
12199
- return (videoPostConfig === null || videoPostConfig === void 0 ? void 0 : videoPostConfig.mode) === '2'
12200
- ? `translateY(-${50 + ((_a = videoPostConfig === null || videoPostConfig === void 0 ? void 0 : videoPostConfig.offsetTop) !== null && _a !== void 0 ? _a : 0)}%)`
12201
- : 'translateY(-50%)';
12202
- }, [videoPostConfig]);
12203
- const blurBgSrc = React.useMemo(() => {
12204
- var _a;
12205
- return ((_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.cover) || firstFrameSrc;
12206
- }, [firstFrameSrc, rec]);
12207
12206
  if (!rec.video) {
12208
12207
  return null;
12209
12208
  }
@@ -12231,19 +12230,23 @@ Made in Italy` })));
12231
12230
  right: 0
12232
12231
  } },
12233
12232
  React.createElement("div", { style: { position: 'relative' } },
12234
- React.createElement("video", { id: `pb-video-${index}`, className: 'clc-pb-video', ref: videoRef, crossOrigin: 'anonymous', poster: sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.placeholder_image, muted: true, controls: false, playsInline: true, preload: 'auto', onPause: onPause, onEnded: handleVideoStart, style: {
12233
+ React.createElement("video", { id: `pb-video-${index}`, className: 'clc-pb-video', ref: videoRef, crossOrigin: 'anonymous',
12234
+ // poster={sxpParameter?.placeholder_image}
12235
+ muted: true, controls: false, playsInline: true, preload: 'auto', onPause: onPause, onEnded: handleVideoStart, style: {
12235
12236
  width: '100%',
12236
12237
  height: 'auto',
12237
12238
  objectFit: 'contain'
12238
12239
  } }),
12239
- renderPoster,
12240
- React.createElement("img", { hidden: !isPauseVideo, className: 'clc-pb-video-pause', src: PAUSE_ICON }))))) : (React.createElement("div", { className: 'video-container', key: rec.video.itemId, onClick: handleClickVideo(), style: {
12240
+ React.createElement("img", { hidden: !isPauseVideo, className: 'clc-pb-video-pause', src: PAUSE_ICON }))),
12241
+ renderPoster)) : (React.createElement("div", { className: 'video-container', key: rec.video.itemId, onClick: handleClickVideo(), style: {
12241
12242
  position: 'relative',
12242
12243
  width: '100%',
12243
12244
  height,
12244
12245
  overflow: 'hidden'
12245
12246
  } },
12246
- React.createElement("video", { id: `pb-video-${index}`, className: 'clc-pb-video', ref: videoRef, crossOrigin: 'anonymous', poster: sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.placeholder_image, muted: true, controls: false, playsInline: true, preload: 'auto', onPause: onPause, onEnded: handleVideoStart }),
12247
+ React.createElement("video", { id: `pb-video-${index}`, className: 'clc-pb-video', ref: videoRef, crossOrigin: 'anonymous',
12248
+ // poster={sxpParameter?.placeholder_image}
12249
+ muted: true, controls: false, playsInline: true, preload: 'auto', onPause: onPause, onEnded: handleVideoStart }),
12247
12250
  renderPoster,
12248
12251
  React.createElement("img", { hidden: !isPauseVideo, className: 'clc-pb-video-pause', src: PAUSE_ICON })))));
12249
12252
  };