pb-sxp-ui 1.10.4 → 1.10.5

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.
Files changed (41) hide show
  1. package/dist/index.cjs +49 -25
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.js +49 -25
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.min.cjs +4 -4
  6. package/dist/index.min.cjs.map +1 -1
  7. package/dist/index.min.js +4 -4
  8. package/dist/index.min.js.map +1 -1
  9. package/dist/pb-ui.js +49 -25
  10. package/dist/pb-ui.js.map +1 -1
  11. package/dist/pb-ui.min.js +4 -4
  12. package/dist/pb-ui.min.js.map +1 -1
  13. package/es/core/components/SxpPageRender/FingerSwipeTip/index.js +2 -1
  14. package/es/core/components/SxpPageRender/FormatImage.js +9 -7
  15. package/es/core/components/SxpPageRender/LikeButton/index.js +2 -1
  16. package/es/core/components/SxpPageRender/Modal/index.js +2 -1
  17. package/es/core/components/SxpPageRender/NavBack.js +2 -1
  18. package/es/core/components/SxpPageRender/Nudge/index.js +2 -2
  19. package/es/core/components/SxpPageRender/ToggleButton/index.js +2 -1
  20. package/es/core/components/SxpPageRender/VideoWidget/index.js +3 -1
  21. package/es/core/components/SxpPageRender/index.js +5 -4
  22. package/es/core/context/EditorDataProvider.d.ts +2 -3
  23. package/es/core/utils/tool.d.ts +2 -1
  24. package/es/core/utils/tool.js +14 -1
  25. package/es/materials/sxp/MultiPosts/index.js +3 -1
  26. package/es/materials/sxp/cta/AniLinkPopup/index.js +2 -2
  27. package/lib/core/components/SxpPageRender/FingerSwipeTip/index.js +2 -1
  28. package/lib/core/components/SxpPageRender/FormatImage.js +9 -7
  29. package/lib/core/components/SxpPageRender/LikeButton/index.js +2 -1
  30. package/lib/core/components/SxpPageRender/Modal/index.js +2 -1
  31. package/lib/core/components/SxpPageRender/NavBack.js +2 -1
  32. package/lib/core/components/SxpPageRender/Nudge/index.js +1 -1
  33. package/lib/core/components/SxpPageRender/ToggleButton/index.js +2 -1
  34. package/lib/core/components/SxpPageRender/VideoWidget/index.js +3 -1
  35. package/lib/core/components/SxpPageRender/index.js +5 -4
  36. package/lib/core/context/EditorDataProvider.d.ts +2 -3
  37. package/lib/core/utils/tool.d.ts +2 -1
  38. package/lib/core/utils/tool.js +15 -1
  39. package/lib/materials/sxp/MultiPosts/index.js +3 -1
  40. package/lib/materials/sxp/cta/AniLinkPopup/index.js +1 -1
  41. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -331,6 +331,19 @@ function getScreenReader() {
331
331
  /JAWS/i.test(userAgent) ||
332
332
  /ChromeVox/i.test(userAgent));
333
333
  }
334
+ const getSpliceQueryUrl = (url) => {
335
+ if (!url)
336
+ return '';
337
+ if ((url === null || url === void 0 ? void 0 : url.indexOf('http')) === -1)
338
+ return url;
339
+ let query = 'x-im-piez=on';
340
+ if ((url === null || url === void 0 ? void 0 : url.indexOf('?')) !== -1) {
341
+ return url + ('&' + query );
342
+ }
343
+ else {
344
+ return url + ('?' + query );
345
+ }
346
+ };
334
347
 
335
348
  function unzip(b64Data) {
336
349
  const strData = atob(b64Data);
@@ -9787,7 +9800,7 @@ SwiperSlide.displayName = 'SwiperSlide';
9787
9800
  * @Author: binruan@chatlabs.com
9788
9801
  * @Date: 2023-11-02 18:34:34
9789
9802
  * @LastEditors: binruan@chatlabs.com
9790
- * @LastEditTime: 2024-11-20 18:37:10
9803
+ * @LastEditTime: 2024-12-04 11:34:20
9791
9804
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\Modal\index.tsx
9792
9805
  *
9793
9806
  */
@@ -9971,7 +9984,7 @@ const Modal = ({ visible, onClose, children, modalStyle, padding, popup, schema,
9971
9984
  }
9972
9985
  })), child()),
9973
9986
  React.createElement("button", { className: 'modal-icon-wrapper', role: 'button', "aria-label": 'close button', onClick: onClose, style: { top: scrollTop } },
9974
- React.createElement("img", { src: (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.popupCloseIcon) || closeIcon$1, alt: 'close button', className: 'modal-icon' }))))))), modalEleRef.current);
9987
+ React.createElement("img", { src: getSpliceQueryUrl((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.popupCloseIcon) || closeIcon$1), alt: 'close button', className: 'modal-icon' }))))))), modalEleRef.current);
9975
9988
  };
9976
9989
  var Modal$1 = React.memo(Modal);
9977
9990
 
@@ -10044,19 +10057,20 @@ var ExpandableText$1 = React.memo(ExpandableText);
10044
10057
 
10045
10058
  const FormatImage = React.forwardRef((props, ref) => {
10046
10059
  const { src, onLoad, style, className, loading, alt = 'image' } = props;
10047
- const [imgSrc, setImgSrc] = React.useState(src);
10060
+ const querySrc = src ? getSpliceQueryUrl(src) : '';
10061
+ const [imgSrc, setImgSrc] = React.useState(querySrc);
10048
10062
  const imgRef = React.useRef(null);
10049
10063
  const [visible, setVisible] = React.useState(false);
10050
10064
  React.useImperativeHandle(ref, () => ({
10051
10065
  setSrc: (v) => {
10052
10066
  if (v)
10053
- setImgSrc(v);
10067
+ setImgSrc(getSpliceQueryUrl(v));
10054
10068
  }
10055
10069
  }));
10056
10070
  React.useEffect(() => {
10057
- if (src)
10058
- setImgSrc(src);
10059
- }, [src]);
10071
+ if (querySrc)
10072
+ setImgSrc(querySrc);
10073
+ }, [querySrc]);
10060
10074
  React.useEffect(() => {
10061
10075
  const onShow = () => {
10062
10076
  if (src && !visible && imgRef.current) {
@@ -10073,8 +10087,8 @@ const FormatImage = React.forwardRef((props, ref) => {
10073
10087
  !visible && !imgSrc && React.createElement("div", { style: { width: '100%', height: '100%', zIndex: 1, backgroundColor: '#fff' } }),
10074
10088
  (imgSrc === null || imgSrc === void 0 ? void 0 : imgSrc.includes('.avif')) ? (React.createElement("picture", null,
10075
10089
  React.createElement("source", { type: 'image/avif', srcSet: imgSrc }),
10076
- React.createElement("source", { type: 'image/webp', srcSet: `${imgSrc}?imageMogr2/format/webp` }),
10077
- React.createElement("source", { type: 'image/jpeg', srcSet: `${imgSrc}?imageMogr2/format/jpg` }),
10090
+ React.createElement("source", { type: 'image/webp', srcSet: `${imgSrc}&imageMogr2/format/webp` }),
10091
+ React.createElement("source", { type: 'image/jpeg', srcSet: `${imgSrc}&imageMogr2/format/jpg` }),
10078
10092
  React.createElement("img", { ref: imgRef, className: className, src: imgSrc, style: Object.assign({}, style), loading: loading, onLoad: (e) => {
10079
10093
  setVisible(true);
10080
10094
  onLoad === null || onLoad === void 0 ? void 0 : onLoad(e.target);
@@ -16309,7 +16323,7 @@ const AniLinkPopup$1 = (_a) => {
16309
16323
  paddingLeft: '6px'
16310
16324
  } }, "Cta Title")) : (React.createElement("div", Object.assign({}, props, { className: `${css.css(Object.assign(Object.assign({}, style), { '--transY': `translateY(calc(100% + ${(_r = style === null || style === void 0 ? void 0 : style.margin) !== null && _r !== void 0 ? _r : 0}px))` }))} ${styles['aniLinkPopup']} ${aniNamStyle} ${css.css(aniTimStyle)}`, onClick: handleTo }),
16311
16325
  React.createElement("div", { onClick: onClose, className: styles['modal-icon-wrapper'], style: { padding: (_s = style === null || style === void 0 ? void 0 : style['padding']) !== null && _s !== void 0 ? _s : 0 } },
16312
- React.createElement("img", { src: (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.popupCloseIcon) || closeIcon, alt: 'close', className: styles['modal-icon-wrapper-img'] })),
16326
+ React.createElement("img", { src: getSpliceQueryUrl((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.popupCloseIcon) || closeIcon), alt: 'close', className: styles['modal-icon-wrapper-img'] })),
16313
16327
  React.createElement(Img$1, { src: src, rec: recData, item: (_x = (_v = (_u = (_t = recData === null || recData === void 0 ? void 0 : recData.video) === null || _t === void 0 ? void 0 : _t.bindProducts) === null || _u === void 0 ? void 0 : _u[0]) !== null && _v !== void 0 ? _v : (_w = recData === null || recData === void 0 ? void 0 : recData.video) === null || _w === void 0 ? void 0 : _w.bindProduct) !== null && _x !== void 0 ? _x : recData === null || recData === void 0 ? void 0 : recData.video, index: index, translateY: translateY, imgStyle: ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.img, isActive: isActive }),
16314
16328
  (!recData || (product === null || product === void 0 ? void 0 : product.title)) && (React.createElement("div", { className: styles['one-line-ellipsis'], style: ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.title, dangerouslySetInnerHTML: {
16315
16329
  __html: setFontForText((_y = product === null || product === void 0 ? void 0 : product.title) !== null && _y !== void 0 ? _y : 'Product Name', ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.title)
@@ -16620,7 +16634,7 @@ var settingRender$1 = [
16620
16634
  * @Author: binruan@chatlabs.com
16621
16635
  * @Date: 2023-12-26 10:38:53
16622
16636
  * @LastEditors: binruan@chatlabs.com
16623
- * @LastEditTime: 2024-10-29 18:04:27
16637
+ * @LastEditTime: 2024-12-03 16:43:47
16624
16638
  * @FilePath: \pb-sxp-ui\src\core\context\EditorDataProvider.tsx
16625
16639
  *
16626
16640
  */
@@ -16917,6 +16931,7 @@ const MultiPosts$1 = (_a) => {
16917
16931
  });
16918
16932
  }, []);
16919
16933
  const endMultiPost = React.useCallback((nextStep) => {
16934
+ curTime.current = new Date();
16920
16935
  bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
16921
16936
  eventInfo: {
16922
16937
  eventSubject: 'endMultiPost',
@@ -16952,7 +16967,7 @@ const MultiPosts$1 = (_a) => {
16952
16967
  }, [isActive]);
16953
16968
  return (React.createElement("div", { className: 'multiposts', style: Object.assign(Object.assign({}, style), getBgStyle(bgImgUrl)) }, Array.from({ length: 4 }, (_, index) => {
16954
16969
  return (React.createElement("button", { hidden: !getPropsVal(index, 'Url'), className: 'multiposts-btn', role: 'button', "aria-label": `multiposts-${index + 1}`, onClick: () => handleClick(index) },
16955
- React.createElement("img", { className: 'multiposts-btn-img', src: getPropsVal(index, 'Url'), alt: `multiposts-img-${index + 1}` })));
16970
+ React.createElement("img", { className: 'multiposts-btn-img', src: getSpliceQueryUrl(getPropsVal(index, 'Url')), alt: `multiposts-img-${index + 1}` })));
16956
16971
  })));
16957
16972
  };
16958
16973
  var MultiPosts$2 = React.memo(MultiPosts$1);
@@ -17139,7 +17154,7 @@ const LikeButton = (_a) => {
17139
17154
  }
17140
17155
  }), 200);
17141
17156
  return (React.createElement("button", Object.assign({}, props, { "aria-label": 'like', onClick: handleClick }),
17142
- React.createElement("img", { style: { width: '100%', height: '100%', objectFit: 'contain' }, src: state ? activeIcon || likeIcon : unActicveIcon || unlikeIcon, alt: 'icon' })));
17157
+ React.createElement("img", { style: { width: '100%', height: '100%', objectFit: 'contain' }, src: getSpliceQueryUrl(state ? activeIcon || likeIcon : unActicveIcon || unlikeIcon), alt: 'icon' })));
17143
17158
  };
17144
17159
  var LikeButton$1 = React.memo(LikeButton);
17145
17160
 
@@ -17353,9 +17368,10 @@ const VideoWidget$2 = ({ rec, index, height, data, muted, activeIndex, videoPost
17353
17368
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
17354
17369
  if (!isActive)
17355
17370
  return;
17356
- const videoSrc = rec === null || rec === void 0 ? void 0 : rec.video.url;
17371
+ let videoSrc = rec === null || rec === void 0 ? void 0 : rec.video.url;
17357
17372
  if (!videoSrc)
17358
17373
  return;
17374
+ videoSrc = getSpliceQueryUrl(videoSrc);
17359
17375
  const videoPlayerWrapperNode = document.querySelector(`#${videoId}`);
17360
17376
  if (!videoPlayerWrapperNode)
17361
17377
  return;
@@ -17539,7 +17555,7 @@ const ToggleButton = ({ defaultValue, activeIcon, unactiveIcon, onChange, style
17539
17555
  setIsTure(defaultValue);
17540
17556
  }, [defaultValue]);
17541
17557
  return (React.createElement("button", { style: style, "aria-label": 'toggle button', className: 'pb-toggle-button', onClick: handleClick },
17542
- React.createElement("img", { className: 'pb-toggle-button-icon', alt: 'toggle image', src: isTrue ? activeIcon : unactiveIcon })));
17558
+ React.createElement("img", { className: 'pb-toggle-button-icon', alt: 'toggle image', src: getSpliceQueryUrl(isTrue ? activeIcon : unactiveIcon) })));
17543
17559
  };
17544
17560
  var ToggleButton$1 = React.memo(ToggleButton);
17545
17561
 
@@ -17547,7 +17563,7 @@ var ToggleButton$1 = React.memo(ToggleButton);
17547
17563
  * @Author: binruan@chatlabs.com
17548
17564
  * @Date: 2024-01-15 19:03:09
17549
17565
  * @LastEditors: binruan@chatlabs.com
17550
- * @LastEditTime: 2024-07-11 18:19:29
17566
+ * @LastEditTime: 2024-12-04 11:24:16
17551
17567
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\FingerSwipeTip\index.tsx
17552
17568
  *
17553
17569
  */
@@ -17564,7 +17580,7 @@ const FingerSwipeTip = ({ imageUrl, style, duration = 2000 }) => {
17564
17580
  return show ? 'pb-fadeIn' : 'pb-fadeOut';
17565
17581
  }, [show]);
17566
17582
  return (React.createElement("div", { hidden: !show, className: `pb-finger-wrap ${animationCls}`, style: Object.assign(Object.assign({}, style), { animationDuration: `${duration / 1000}s` }) },
17567
- React.createElement("img", { src: imageUrl || FINGER_SWIPE_ICON, alt: 'finger swiper' })));
17583
+ React.createElement("img", { src: getSpliceQueryUrl(imageUrl || FINGER_SWIPE_ICON), alt: 'finger swiper' })));
17568
17584
  };
17569
17585
 
17570
17586
  /*
@@ -17871,7 +17887,7 @@ var RenderCard$1 = React.memo(RenderCard);
17871
17887
  * @Author: binruan@chatlabs.com
17872
17888
  * @Date: 2024-03-26 10:07:41
17873
17889
  * @LastEditors: binruan@chatlabs.com
17874
- * @LastEditTime: 2024-07-03 10:07:29
17890
+ * @LastEditTime: 2024-12-04 11:29:23
17875
17891
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\Nudge\index.tsx
17876
17892
  *
17877
17893
  */
@@ -17884,7 +17900,7 @@ const Nudge = ({ nudge }) => {
17884
17900
  backgroundColor: nudge === null || nudge === void 0 ? void 0 : nudge.backgroundColor,
17885
17901
  borderRadius: (_f = nudge === null || nudge === void 0 ? void 0 : nudge.borderRadius) !== null && _f !== void 0 ? _f : 4
17886
17902
  } },
17887
- (nudge === null || nudge === void 0 ? void 0 : nudge.icon) ? (React.createElement("img", { src: nudge.icon, alt: 'nudge icon', style: { height: '100%', objectFit: 'cover', flexShrink: 0 } })) : null,
17903
+ (nudge === null || nudge === void 0 ? void 0 : nudge.icon) ? (React.createElement("img", { src: getSpliceQueryUrl(nudge.icon), alt: 'nudge icon', style: { height: '100%', objectFit: 'cover', flexShrink: 0 } })) : null,
17888
17904
  React.createElement("p", { style: Object.assign(Object.assign({}, nudge === null || nudge === void 0 ? void 0 : nudge.textStyle), { textWrap: 'nowrap', textOverflow: 'ellipsis', overflow: 'hidden', whiteSpace: 'nowrap', flex: 1, marginBottom: 0, marginTop: 0 }), dangerouslySetInnerHTML: {
17889
17905
  __html: setFontForText(nudge === null || nudge === void 0 ? void 0 : nudge.content, nudge === null || nudge === void 0 ? void 0 : nudge.textStyle)
17890
17906
  } })))));
@@ -17977,7 +17993,7 @@ const NavBack = ({ data, minusHeight, tagHeight, onClick }) => {
17977
17993
  padding: 0,
17978
17994
  background: 'transparent'
17979
17995
  }, role: 'button', "aria-label": 'back button', onClick: onClick },
17980
- React.createElement("img", { src: (data === null || data === void 0 ? void 0 : data.icon) || img, alt: 'back button', width: 100, style: { objectFit: 'cover' } })));
17996
+ React.createElement("img", { src: getSpliceQueryUrl((data === null || data === void 0 ? void 0 : data.icon) || img), alt: 'back button', width: 100, style: { objectFit: 'cover' } })));
17981
17997
  };
17982
17998
  var NavBack$1 = React.memo(NavBack);
17983
17999
 
@@ -17985,7 +18001,15 @@ var NavBack$1 = React.memo(NavBack);
17985
18001
  * @Author: binruan@chatlabs.com
17986
18002
  * @Date: 2024-03-20 10:27:31
17987
18003
  * @LastEditors: binruan@chatlabs.com
17988
- * @LastEditTime: 2024-12-03 14:41:51
18004
+ * @LastEditTime: 2024-12-04 11:30:35
18005
+ * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\index.tsx
18006
+ *
18007
+ */
18008
+ /*
18009
+ * @Author: binruan@chatlabs.com
18010
+ * @Date: 2024-03-20 10:27:31
18011
+ * @LastEditors: binruan@chatlabs.com
18012
+ * @LastEditTime: 2024-12-03 15:27:20
17989
18013
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\index.tsx
17990
18014
  *
17991
18015
  */
@@ -18176,7 +18200,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
18176
18200
  new Function(link)();
18177
18201
  }
18178
18202
  })),
18179
- React.createElement("img", { src: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.logoUrl, alt: 'logo' })));
18203
+ React.createElement("img", { src: getSpliceQueryUrl(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.logoUrl), alt: 'logo' })));
18180
18204
  }
18181
18205
  return null;
18182
18206
  }, [globalConfig, activeIndex, visList]);
@@ -18466,7 +18490,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
18466
18490
  const renderView = React.useMemo(() => {
18467
18491
  if (loading) {
18468
18492
  return (React.createElement("div", { style: { height, width: containerWidth, display: 'flex', justifyContent: 'center', alignItems: 'center' } },
18469
- React.createElement("img", { width: 64, height: 64, src: loadingImage, alt: 'loading...', style: { objectFit: 'contain' } })));
18493
+ React.createElement("img", { width: 64, height: 64, src: getSpliceQueryUrl(loadingImage), alt: 'loading...', style: { objectFit: 'contain' } })));
18470
18494
  }
18471
18495
  return visList === null || visList === void 0 ? void 0 : visList.map((rec, index) => {
18472
18496
  return (React.createElement(SwiperSlide, { key: index, virtualIndex: index, style: { overflow: 'hidden' } }, rec && (React.createElement(React.Fragment, null, (rec === null || rec === void 0 ? void 0 : rec.loading) ? (React.createElement("div", { style: {
@@ -18476,7 +18500,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
18476
18500
  justifyContent: 'center',
18477
18501
  alignItems: 'center'
18478
18502
  } },
18479
- React.createElement("img", { width: 64, height: 64, src: loadingImage, alt: 'loading...', style: { objectFit: 'contain' } }))) : (React.createElement(React.Fragment, null,
18503
+ React.createElement("img", { width: 64, height: 64, src: getSpliceQueryUrl(loadingImage), alt: 'loading...', style: { objectFit: 'contain' } }))) : (React.createElement(React.Fragment, null,
18480
18504
  renderBottom(rec, index),
18481
18505
  renderLikeButton(rec, index, !(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIconFixed)),
18482
18506
  renderToggleButton(!(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconFixed)),
@@ -18513,7 +18537,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
18513
18537
  eventInfo: {
18514
18538
  eventSubject: 'backMultiPostClick',
18515
18539
  eventDescription: 'backMultiPostClick',
18516
- traceInfo: (_c = (_b = (_a = data === null || data === void 0 ? void 0 : data[0]) === null || _a === void 0 ? void 0 : _a.video) === null || _b === void 0 ? void 0 : _b.traceInfo) !== null && _c !== void 0 ? _c : ''
18540
+ traceInfo: (_c = (_b = (_a = data === null || data === void 0 ? void 0 : data[activeIndex]) === null || _a === void 0 ? void 0 : _a.video) === null || _b === void 0 ? void 0 : _b.traceInfo) !== null && _c !== void 0 ? _c : ''
18517
18541
  }
18518
18542
  });
18519
18543
  location === null || location === void 0 ? void 0 : location.reload();