pb-sxp-ui 1.0.27 → 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/index.cjs CHANGED
@@ -12093,13 +12093,24 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
12093
12093
  });
12094
12094
  }
12095
12095
  }, [data, index, bffEventReport]);
12096
+ const blur = React.useMemo(() => {
12097
+ return (videoPostConfig === null || videoPostConfig === void 0 ? void 0 : videoPostConfig.mode) === '2';
12098
+ }, [videoPostConfig]);
12099
+ const translateY = React.useMemo(() => {
12100
+ var _a;
12101
+ return (videoPostConfig === null || videoPostConfig === void 0 ? void 0 : videoPostConfig.mode) === '2'
12102
+ ? `translateY(-${50 + ((_a = videoPostConfig === null || videoPostConfig === void 0 ? void 0 : videoPostConfig.offsetTop) !== null && _a !== void 0 ? _a : 0)}%)`
12103
+ : 'translateY(-50%)';
12104
+ }, [videoPostConfig]);
12105
+ const blurBgSrc = React.useMemo(() => {
12106
+ var _a;
12107
+ return ((_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.cover) || firstFrameSrc;
12108
+ }, [firstFrameSrc, rec]);
12096
12109
  const handLoadeddata = React.useCallback(() => {
12097
- const video = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current;
12098
- if (!video)
12110
+ if (!canvasRef || !videoRef || !videoRef.current || !canvasRef.current)
12099
12111
  return;
12112
+ const video = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current;
12100
12113
  const canvas = canvasRef === null || canvasRef === void 0 ? void 0 : canvasRef.current;
12101
- if (!canvas)
12102
- return;
12103
12114
  const ctx = canvas.getContext('2d');
12104
12115
  const targetWidth = window === null || window === void 0 ? void 0 : window.innerWidth;
12105
12116
  const targetHeight = window === null || window === void 0 ? void 0 : window.innerHeight;
@@ -12107,10 +12118,9 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
12107
12118
  canvas.width = targetWidth;
12108
12119
  ctx === null || ctx === void 0 ? void 0 : ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
12109
12120
  setFirstFrameSrc(canvas.toDataURL());
12110
- canvas.remove();
12111
12121
  }, []);
12112
12122
  React.useEffect(() => {
12113
- var _a, _b, _c;
12123
+ var _a, _b, _c, _d;
12114
12124
  if (!videoRef.current)
12115
12125
  return;
12116
12126
  setIsPauseVideo(false);
@@ -12133,14 +12143,16 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
12133
12143
  videoRef.current.setAttribute('x5-playsinline', 'true');
12134
12144
  videoRef.current.setAttribute('webkit-playsinline', 'true');
12135
12145
  }
12136
- (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.addEventListener('canplay', handleLoadedMetadata);
12137
- (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.addEventListener('playing', handlePlaying);
12138
- (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.addEventListener('loadeddata', handLoadeddata);
12146
+ (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.addEventListener('loadedmetadata', handleLoadedMetadata);
12147
+ (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.addEventListener('canplay', handleLoadedMetadata);
12148
+ (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.addEventListener('playing', handlePlaying);
12149
+ (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.addEventListener('loadeddata', handLoadeddata);
12139
12150
  return () => {
12140
- var _a, _b, _c;
12141
- (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('canplay', handleLoadedMetadata);
12142
- (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.removeEventListener('playing', handlePlaying);
12143
- (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.removeEventListener('loadeddata', handLoadeddata);
12151
+ var _a, _b, _c, _d;
12152
+ (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('loadedmetadata', handleLoadedMetadata);
12153
+ (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.removeEventListener('canplay', handleLoadedMetadata);
12154
+ (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.removeEventListener('playing', handlePlaying);
12155
+ (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.removeEventListener('loadeddata', handLoadeddata);
12144
12156
  };
12145
12157
  }, [handleLoadedMetadata, handlePlaying, rec.video, handLoadeddata]);
12146
12158
  React.useEffect(() => {
@@ -12199,19 +12211,6 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
12199
12211
  window.removeEventListener('beforeunload', handleBeforeUnload);
12200
12212
  };
12201
12213
  }, [activeIndex, index, rec, videoRef, handleClickVideo, isPauseVideo]);
12202
- const blur = React.useMemo(() => {
12203
- return (videoPostConfig === null || videoPostConfig === void 0 ? void 0 : videoPostConfig.mode) === '2';
12204
- }, [videoPostConfig]);
12205
- const translateY = React.useMemo(() => {
12206
- var _a;
12207
- return (videoPostConfig === null || videoPostConfig === void 0 ? void 0 : videoPostConfig.mode) === '2'
12208
- ? `translateY(-${50 + ((_a = videoPostConfig === null || videoPostConfig === void 0 ? void 0 : videoPostConfig.offsetTop) !== null && _a !== void 0 ? _a : 0)}%)`
12209
- : 'translateY(-50%)';
12210
- }, [videoPostConfig]);
12211
- const blurBgSrc = React.useMemo(() => {
12212
- var _a;
12213
- return ((_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.cover) || firstFrameSrc;
12214
- }, [firstFrameSrc, rec]);
12215
12214
  if (!rec.video) {
12216
12215
  return null;
12217
12216
  }
@@ -12239,7 +12238,9 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
12239
12238
  right: 0
12240
12239
  } },
12241
12240
  React.createElement("div", { style: { position: 'relative' } },
12242
- 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: {
12241
+ React.createElement("video", { id: `pb-video-${index}`, className: 'clc-pb-video', ref: videoRef, crossOrigin: 'anonymous',
12242
+ // poster={sxpParameter?.placeholder_image}
12243
+ muted: true, controls: false, playsInline: true, preload: 'auto', onPause: onPause, onEnded: handleVideoStart, style: {
12243
12244
  width: '100%',
12244
12245
  height: 'auto',
12245
12246
  objectFit: 'contain'
@@ -12251,7 +12252,9 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
12251
12252
  height,
12252
12253
  overflow: 'hidden'
12253
12254
  } },
12254
- 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 }),
12255
+ React.createElement("video", { id: `pb-video-${index}`, className: 'clc-pb-video', ref: videoRef, crossOrigin: 'anonymous',
12256
+ // poster={sxpParameter?.placeholder_image}
12257
+ muted: true, controls: false, playsInline: true, preload: 'auto', onPause: onPause, onEnded: handleVideoStart }),
12255
12258
  renderPoster,
12256
12259
  React.createElement("img", { hidden: !isPauseVideo, className: 'clc-pb-video-pause', src: PAUSE_ICON })))));
12257
12260
  };
@@ -13113,3 +13116,4 @@ exports.default = Pagebuilder;
13113
13116
  exports.defaultSetting = defaultSetting;
13114
13117
  exports.materials = _materials_;
13115
13118
  exports.useEditorDataProvider = useEditorDataProvider;
13119
+ //# sourceMappingURL=index.cjs.map