pb-sxp-ui 1.0.3-alpha.2 → 1.0.3-alpha.3

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
@@ -8836,11 +8836,12 @@ Made in Italy` })));
8836
8836
  }), src: (_j = sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) !== null && _j !== void 0 ? _j : bottom_image, alt: '' }))),
8837
8837
  React.createElement("div", { className: 'pb-commondityDiroNew-content' },
8838
8838
  React.createElement("div", { className: 'pb-commondityDiroNew-content-top' },
8839
- React.createElement("div", { className: 'pb-commondityDiroNew-content-top-title', style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.title }, (_k = product === null || product === void 0 ? void 0 : product.title) !== null && _k !== void 0 ? _k : 'Large Dior Toujours Bag'),
8840
- React.createElement("div", { className: '' },
8839
+ React.createElement("div", null,
8840
+ React.createElement("div", { className: 'pb-commondityDiroNew-content-top-title', style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.title }, (_k = product === null || product === void 0 ? void 0 : product.title) !== null && _k !== void 0 ? _k : 'Large Dior Toujours Bag'),
8841
+ React.createElement("div", { className: 'pb-commondityDiroNew-content-collection', hidden: !!product && (!(product === null || product === void 0 ? void 0 : product.collection) || (product === null || product === void 0 ? void 0 : product.collection) === ''), style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.collection }, (product === null || product === void 0 ? void 0 : product.collection) || 'Black Macrocannage Calfskin')),
8842
+ React.createElement("div", null,
8841
8843
  React.createElement("div", { className: 'pb-commondityDiroNew-content-top-price', hidden: !!product && !(product === null || product === void 0 ? void 0 : product.price), style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price }, priceText),
8842
8844
  React.createElement("div", { className: 'pb-commondityDiroNew-content-top-price', hidden: !!product && !(product === null || product === void 0 ? void 0 : product.taxInfo), style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.taxInfo }, (_l = product === null || product === void 0 ? void 0 : product.taxInfo) !== null && _l !== void 0 ? _l : '税费'))),
8843
- React.createElement("div", { className: 'pb-commondityDiroNew-content-collection', hidden: !!product && (!(product === null || product === void 0 ? void 0 : product.collection) || (product === null || product === void 0 ? void 0 : product.collection) === ''), style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.collection }, (product === null || product === void 0 ? void 0 : product.collection) || 'Black Macrocannage Calfskin'),
8844
8845
  (!product || (product === null || product === void 0 ? void 0 : product.link)) && (React.createElement("button", { onClick: handleLink, className: 'pb-commondityDiroNew-btn', style: buttonStyle }, (_m = cta === null || cta === void 0 ? void 0 : cta.enTitle) !== null && _m !== void 0 ? _m : 'Shop now')),
8845
8846
  productInfoText({ isPost }))),
8846
8847
  React.createElement(Modal$1, { visible: showModal, onClose: () => setShowModal(false) }, productInfoText({ isPost: false }))));
@@ -11541,7 +11542,7 @@ const WaterfallFlowItem = (props) => {
11541
11542
  React.createElement("img", { className: 'list-content-listItem-picture-img', loading: 'lazy', ref: imgDom })),
11542
11543
  React.createElement("div", { className: 'list-content-listItem-info' },
11543
11544
  React.createElement("div", { className: `${'list-content-listItem-info-title'} ${priceText ? 'list-content-listItem-info-nowrap' : ''}`, style: textStyles === null || textStyles === void 0 ? void 0 : textStyles.title }, title && title),
11544
- React.createElement("div", { className: 'list-content-listItem-info-price', style: textStyles.price, hidden: !priceText }, priceText))));
11545
+ React.createElement("div", { className: 'list-content-listItem-info-price', style: textStyles === null || textStyles === void 0 ? void 0 : textStyles.price, hidden: !priceText }, priceText))));
11545
11546
  };
11546
11547
  function WaterfallList(_a) {
11547
11548
  var _b, _c, _d, _e, _f, _g, _h;
@@ -11903,10 +11904,8 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex }) => {
11903
11904
  videoRef.current.muted = muted;
11904
11905
  }, [muted]);
11905
11906
  const handleVideoStart = React.useCallback(() => {
11906
- var _a, _b;
11907
- if (!(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) || ((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.readyState) < 2)
11908
- return;
11909
- (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.play();
11907
+ var _a;
11908
+ (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.play();
11910
11909
  }, []);
11911
11910
  const PAUSE_ICON = useIconLink('/pb_static/06f28a2025c74c1cb49be6767316d827.png');
11912
11911
  const handlePlaying = React.useCallback(() => {
@@ -11963,38 +11962,37 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex }) => {
11963
11962
  });
11964
11963
  }
11965
11964
  setTimeout(() => {
11966
- var _a, _b;
11967
- if (!(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) || ((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.readyState) < 2)
11968
- return;
11969
- (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.play();
11965
+ var _a;
11966
+ (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.play();
11970
11967
  }, 0);
11971
11968
  }, [index, bffEventReport, data, isLoad]);
11972
11969
  const handleClickVideo = React.useCallback((type) => () => {
11973
- var _a, _b, _c, _d, _e, _f;
11974
- if (!(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) || ((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.readyState) < 2)
11975
- return;
11970
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
11976
11971
  if (!isLoad)
11977
11972
  return;
11978
- const isPause = (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.paused;
11973
+ data[index];
11974
+ ((_b = (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.duration) !== null && _b !== void 0 ? _b : 0).toFixed(2);
11975
+ ((_d = (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.currentTime) !== null && _d !== void 0 ? _d : 0).toFixed(2);
11976
+ const isPause = (_e = videoRef.current) === null || _e === void 0 ? void 0 : _e.paused;
11979
11977
  switch (type) {
11980
11978
  case 'start':
11981
11979
  if (!isPause)
11982
11980
  return;
11983
- (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.play();
11981
+ (_f = videoRef.current) === null || _f === void 0 ? void 0 : _f.play();
11984
11982
  setIsPauseVideo(false);
11985
11983
  break;
11986
11984
  case 'pause':
11987
11985
  if (isPause)
11988
11986
  return;
11989
- (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.pause();
11987
+ (_g = videoRef.current) === null || _g === void 0 ? void 0 : _g.pause();
11990
11988
  setIsPauseVideo(true);
11991
11989
  break;
11992
11990
  default:
11993
11991
  if (isPause) {
11994
- (_e = videoRef.current) === null || _e === void 0 ? void 0 : _e.play();
11992
+ (_h = videoRef.current) === null || _h === void 0 ? void 0 : _h.play();
11995
11993
  }
11996
11994
  else {
11997
- (_f = videoRef.current) === null || _f === void 0 ? void 0 : _f.pause();
11995
+ (_j = videoRef.current) === null || _j === void 0 ? void 0 : _j.pause();
11998
11996
  }
11999
11997
  setIsPauseVideo(!isPause);
12000
11998
  break;
@@ -12025,16 +12023,14 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex }) => {
12025
12023
  }
12026
12024
  }, [data, index, bffEventReport]);
12027
12025
  React.useEffect(() => {
12028
- var _a, _b, _c, _d, _e, _f;
12026
+ var _a, _b, _c;
12029
12027
  if (data.length <= 0)
12030
12028
  return;
12031
12029
  if (!videoRef.current)
12032
12030
  return;
12033
- const isPause = (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.paused;
12034
12031
  setIsPauseVideo(false);
12035
12032
  if (!isActive) {
12036
- if (!isPause && ((_b = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _b === void 0 ? void 0 : _b.readyState) >= 2)
12037
- (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.pause();
12033
+ (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.pause();
12038
12034
  return;
12039
12035
  }
12040
12036
  if (!videoRef.current.src) {
@@ -12057,12 +12053,10 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex }) => {
12057
12053
  videoRef.current.setAttribute('webkit-playsinline', 'true');
12058
12054
  }
12059
12055
  else {
12060
- if (((_d = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _d === void 0 ? void 0 : _d.readyState) < 2)
12061
- return;
12062
12056
  videoRef.current.play();
12063
12057
  }
12064
- (_e = videoRef.current) === null || _e === void 0 ? void 0 : _e.addEventListener('canplay', handleLoadedMetadata);
12065
- (_f = videoRef.current) === null || _f === void 0 ? void 0 : _f.addEventListener('playing', handlePlaying);
12058
+ (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.addEventListener('canplay', handleLoadedMetadata);
12059
+ (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.addEventListener('playing', handlePlaying);
12066
12060
  return () => {
12067
12061
  var _a, _b;
12068
12062
  (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('canplay', handleLoadedMetadata);
@@ -12073,17 +12067,15 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex }) => {
12073
12067
  打开/关闭hashtag暂停/播放视频
12074
12068
  */
12075
12069
  React.useEffect(() => {
12076
- var _a, _b, _c, _d;
12077
- if (!(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) || ((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.readyState) < 2)
12078
- return;
12079
- const isPause = (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.paused;
12070
+ var _a, _b, _c;
12071
+ const isPause = (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.paused;
12080
12072
  if (!isActive)
12081
12073
  return;
12082
12074
  if (!isPause && openHashtag) {
12083
- (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.pause();
12075
+ (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.pause();
12084
12076
  }
12085
12077
  else if (!openHashtag) {
12086
- (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.play();
12078
+ (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.play();
12087
12079
  }
12088
12080
  }, [openHashtag, isActive]);
12089
12081
  React.useEffect(() => {
@@ -12175,10 +12167,35 @@ const FingerSwipeTip = ({ imageUrl }) => {
12175
12167
  React.createElement("img", { src: imageUrl || FINGER_SWIPE_ICON })));
12176
12168
  };
12177
12169
 
12170
+ /*
12171
+ * @Author: binruan@chatlabs.com
12172
+ * @Date: 2024-03-20 10:27:31
12173
+ * @LastEditors: binruan@chatlabs.com
12174
+ * @LastEditTime: 2024-04-08 18:44:58
12175
+ * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\PictureGroup\Picture.tsx
12176
+ *
12177
+ */
12178
12178
  const Picture = (props) => {
12179
12179
  const { src, height, width } = props;
12180
+ const [blur, setBlur] = React.useState(false);
12180
12181
  const imgDom = React.useRef(null);
12181
12182
  const { sxpParameter } = useSxpDataSource();
12183
+ React.useEffect(() => {
12184
+ if (imgDom.current === null || src === '') {
12185
+ return;
12186
+ }
12187
+ const img = new Image();
12188
+ img.src = src;
12189
+ img.onload = () => {
12190
+ const aspectRatio = img.height / img.width;
12191
+ const targetAspectRatio = 16 / 9;
12192
+ const tolerance = 0.05; // 允许的宽高比误差范围
12193
+ if (Math.abs(aspectRatio - targetAspectRatio) > tolerance) {
12194
+ setBlur(true);
12195
+ }
12196
+ };
12197
+ imgDom.current.src = src;
12198
+ }, [src]);
12182
12199
  return (React.createElement("div", { style: {
12183
12200
  overflow: 'hidden',
12184
12201
  height,
@@ -12188,8 +12205,19 @@ const Picture = (props) => {
12188
12205
  React.createElement("img", { ref: imgDom, loading: 'lazy', src: src !== null && src !== void 0 ? src : sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.placeholder_image, style: {
12189
12206
  height: '100%',
12190
12207
  width: '100%',
12191
- objectFit: 'cover'
12192
- } })));
12208
+ objectFit: 'cover',
12209
+ filter: blur ? 'blur(10px)' : 'none',
12210
+ transform: blur ? 'scale(1.2)' : 'none'
12211
+ } }),
12212
+ blur && (React.createElement("img", { ref: imgDom, src: src, loading: 'lazy', style: {
12213
+ width: '100%',
12214
+ objectFit: 'contain',
12215
+ position: 'absolute',
12216
+ top: '50%',
12217
+ transform: 'translateY(-50%)',
12218
+ left: 0,
12219
+ right: 0
12220
+ } }))));
12193
12221
  };
12194
12222
 
12195
12223
  /*