pb-sxp-ui 1.0.88 → 1.0.89

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 (43) hide show
  1. package/dist/index.cjs +151 -211
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.js +151 -211
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.min.cjs +4 -3
  6. package/dist/index.min.cjs.map +1 -1
  7. package/dist/index.min.js +4 -3
  8. package/dist/index.min.js.map +1 -1
  9. package/dist/pb-ui.js +154 -214
  10. package/dist/pb-ui.js.map +1 -1
  11. package/dist/pb-ui.min.js +4 -3
  12. package/dist/pb-ui.min.js.map +1 -1
  13. package/es/core/components/SxpPageRender/FormatImage.js +2 -7
  14. package/es/core/components/SxpPageRender/VideoWidget/index.js +39 -31
  15. package/es/core/components/SxpPageRender/index.js +20 -35
  16. package/es/materials/sxp/popup/AppointForm/index.js +1 -3
  17. package/es/materials/sxp/template/Appoint/index.js +7 -6
  18. package/es/materials/sxp/template/Commodity/index.js +7 -14
  19. package/es/materials/sxp/template/CommodityDiro/index.js +7 -14
  20. package/es/materials/sxp/template/CommodityDiroNew/index.js +7 -14
  21. package/es/materials/sxp/template/Link/index.js +5 -5
  22. package/es/materials/sxp/template/MultiCommodity/index.js +3 -6
  23. package/es/materials/sxp/template/MultiCommodityDiro/index.js +3 -6
  24. package/es/materials/sxp/template/MultiCommodityDiroNew/index.js +3 -6
  25. package/es/materials/sxp/template/components/EventProvider.js +1 -13
  26. package/es/materials/sxp/template/components/Img.d.ts +5 -3
  27. package/es/materials/sxp/template/components/Img.js +4 -3
  28. package/lib/core/components/SxpPageRender/FormatImage.js +2 -7
  29. package/lib/core/components/SxpPageRender/VideoWidget/index.js +39 -31
  30. package/lib/core/components/SxpPageRender/index.js +20 -35
  31. package/lib/materials/sxp/popup/AppointForm/index.js +1 -3
  32. package/lib/materials/sxp/template/Appoint/index.js +7 -6
  33. package/lib/materials/sxp/template/Commodity/index.js +7 -14
  34. package/lib/materials/sxp/template/CommodityDiro/index.js +7 -14
  35. package/lib/materials/sxp/template/CommodityDiroNew/index.js +7 -14
  36. package/lib/materials/sxp/template/Link/index.js +5 -5
  37. package/lib/materials/sxp/template/MultiCommodity/index.js +3 -6
  38. package/lib/materials/sxp/template/MultiCommodityDiro/index.js +3 -6
  39. package/lib/materials/sxp/template/MultiCommodityDiroNew/index.js +3 -6
  40. package/lib/materials/sxp/template/components/EventProvider.js +0 -12
  41. package/lib/materials/sxp/template/components/Img.d.ts +5 -3
  42. package/lib/materials/sxp/template/components/Img.js +4 -3
  43. package/package.json +2 -4
package/dist/index.cjs CHANGED
@@ -9,8 +9,8 @@ var React = require('react');
9
9
  var qs = require('qs');
10
10
  var EventEmitter = require('eventemitter3');
11
11
  var css = require('@emotion/css');
12
- var proComponents = require('@ant-design/pro-components');
13
12
  var ReactDOM = require('react-dom');
13
+ var Hls = require('hls.js');
14
14
 
15
15
  function _interopNamespaceDefault(e) {
16
16
  var n = Object.create(null);
@@ -1358,7 +1358,7 @@ const AppointForm$1 = (_a) => {
1358
1358
  key: '4'
1359
1359
  }
1360
1360
  ], []);
1361
- const columnsData = React.useMemo(() => {
1361
+ React.useMemo(() => {
1362
1362
  if (layoutType === undefined) {
1363
1363
  const list = lodash.cloneDeep(columns) || defaultColumns;
1364
1364
  return list === null || list === void 0 ? void 0 : list.map((obj) => (Object.assign(Object.assign({}, obj), { title: undefined, fieldProps: { placeholder: obj === null || obj === void 0 ? void 0 : obj.title } })));
@@ -1401,8 +1401,7 @@ const AppointForm$1 = (_a) => {
1401
1401
  return (React.createElement("div", { className: 'pb-appoint-form' },
1402
1402
  React.createElement("div", { className: `pb-appoint-form-title ${css.css(Object.assign({}, textStyle))}` }, title),
1403
1403
  React.createElement("div", Object.assign({ className: css.css(Object.assign({}, style)) }, props),
1404
- React.createElement("div", { className: 'pb-appoint-form-container' },
1405
- React.createElement(proComponents.BetaSchemaForm, { columns: columnsData, submitter: false, layout: layoutType, autoFocusFirstInput: false, size: 'large', formRef: formRef, className: 'panel-reset' }))),
1404
+ React.createElement("div", { className: 'pb-appoint-form-container' })),
1406
1405
  React.createElement("div", { className: 'pb-appoint-form-btn-wrapper' },
1407
1406
  React.createElement("button", { "aria-label": submitText, onClick: handleSubmit, className: 'pb-appoint-form-btn', style: Object.assign({ color: submitColor, background: submitBgColor }, submitButtonStyle) }, loading ? React.createElement(React.Fragment, null, "loading...") : submitText))));
1408
1407
  };
@@ -8596,26 +8595,21 @@ var ExpandableText$1 = React.memo(ExpandableText);
8596
8595
  * @Author: binruan@chatlabs.com
8597
8596
  * @Date: 2024-03-20 10:27:31
8598
8597
  * @LastEditors: binruan@chatlabs.com
8599
- * @LastEditTime: 2024-06-19 16:25:46
8598
+ * @LastEditTime: 2024-06-20 18:56:52
8600
8599
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\FormatImage.tsx
8601
8600
  *
8602
8601
  */
8603
8602
  const FormatImage = React.forwardRef((props, ref) => {
8604
8603
  const { src, onLoad, style, className, loading } = props;
8605
8604
  const [imgSrc, setImgSrc] = React.useState();
8606
- const { swiperRef } = useSxpDataSource();
8607
8605
  React.useImperativeHandle(ref, () => ({
8608
8606
  setSrc: (v) => {
8609
8607
  setImgSrc(v);
8610
8608
  }
8611
8609
  }));
8612
8610
  React.useEffect(() => {
8613
- var _a, _b;
8614
- // 首屏不加载第二屏之后的图片
8615
- const index = (_b = (_a = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _a === void 0 ? void 0 : _a.swiper) === null || _b === void 0 ? void 0 : _b.activeIndex;
8616
- if (index === 0 || index > 0)
8617
- setImgSrc(src);
8618
- }, [src, swiperRef]);
8611
+ setImgSrc(src);
8612
+ }, [src]);
8619
8613
  React.useRef(null);
8620
8614
  // useEffect(() => {
8621
8615
  // let observer: any = null;
@@ -9627,6 +9621,38 @@ var interactionRender$6 = [
9627
9621
  }
9628
9622
  ];
9629
9623
 
9624
+ const EventProvider = (_a) => {
9625
+ var { rec, children, className, onClick, style, isExternalLink = false, index } = _a; __rest(_a, ["rec", "children", "className", "onClick", "style", "isExternalLink", "index"]);
9626
+ const ref = React.useRef(null);
9627
+ const { popup } = useEditor();
9628
+ const { setPopupDetailData, ctaEvent } = useSxpDataSource();
9629
+ const { jumpToWeb } = useEventReport();
9630
+ const handleClick = lodash.throttle(() => {
9631
+ var _a, _b, _c, _d, _e, _f, _g, _h;
9632
+ const item = (_b = (_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.bindProduct) !== null && _b !== void 0 ? _b : rec === null || rec === void 0 ? void 0 : rec.video;
9633
+ ctaEvent === null || ctaEvent === void 0 ? void 0 : ctaEvent({
9634
+ eventSubject: 'clickCta',
9635
+ eventDescription: 'User clicked the CTA'
9636
+ }, rec, item, index);
9637
+ setPopupDetailData === null || setPopupDetailData === void 0 ? void 0 : setPopupDetailData(Object.assign(Object.assign({}, rec), { index }));
9638
+ if (isExternalLink) {
9639
+ if ((_d = (_c = rec === null || rec === void 0 ? void 0 : rec.video) === null || _c === void 0 ? void 0 : _c.bindProduct) === null || _d === void 0 ? void 0 : _d.link) {
9640
+ const cta = (_e = rec === null || rec === void 0 ? void 0 : rec.video) === null || _e === void 0 ? void 0 : _e.bindCta;
9641
+ const product = (_f = rec === null || rec === void 0 ? void 0 : rec.video) === null || _f === void 0 ? void 0 : _f.bindProduct;
9642
+ jumpToWeb(rec, product, cta, index);
9643
+ window.location.href = window.getJointUtmLink((_h = (_g = rec === null || rec === void 0 ? void 0 : rec.video) === null || _g === void 0 ? void 0 : _g.bindProduct) === null || _h === void 0 ? void 0 : _h.link);
9644
+ }
9645
+ }
9646
+ else {
9647
+ onClick === null || onClick === void 0 ? void 0 : onClick();
9648
+ }
9649
+ }, popup === null || popup === void 0 ? void 0 : popup.duration);
9650
+ return (React.createElement("div", { ref: ref, className: className, style: style, onClick: handleClick }, children));
9651
+ };
9652
+ var EventProvider$1 = React.memo(EventProvider);
9653
+
9654
+ var styles$6 = {"tow-line-ellipsis":"index-module_tow-line-ellipsis__3bKKx"};
9655
+
9630
9656
  /*
9631
9657
  * @Author: binruan@chatlabs.com
9632
9658
  * @Date: 2023-04-12 09:58:58
@@ -9654,64 +9680,40 @@ function useOnScreen(ref) {
9654
9680
  return isOnScreen;
9655
9681
  }
9656
9682
 
9657
- const EventProvider = (_a) => {
9658
- var { rec, children, className, onClick, style, isExternalLink = false, index } = _a; __rest(_a, ["rec", "children", "className", "onClick", "style", "isExternalLink", "index"]);
9683
+ /*
9684
+ * @Author: binruan@chatlabs.com
9685
+ * @Date: 2024-01-16 14:50:13
9686
+ * @LastEditors: binruan@chatlabs.com
9687
+ * @LastEditTime: 2024-06-21 11:59:25
9688
+ * @FilePath: \pb-sxp-ui\src\materials\sxp\template\components\Img.tsx
9689
+ *
9690
+ */
9691
+ const Img = ({ src, rec, item, index, style, translateY, imgStyle }) => {
9659
9692
  const ref = React.useRef(null);
9660
9693
  const isOnScreen = useOnScreen(ref);
9661
- const { popup } = useEditor();
9662
- const { setPopupDetailData, ctaEvent } = useSxpDataSource();
9663
- const { jumpToWeb } = useEventReport();
9694
+ const { ctaEvent } = useSxpDataSource();
9664
9695
  React.useEffect(() => {
9665
- var _a, _b;
9666
- if (isOnScreen && (ref === null || ref === void 0 ? void 0 : ref.current)) {
9667
- const item = (_b = (_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.bindProduct) !== null && _b !== void 0 ? _b : rec === null || rec === void 0 ? void 0 : rec.video;
9696
+ if (isOnScreen && src && (ref === null || ref === void 0 ? void 0 : ref.current)) {
9668
9697
  ctaEvent === null || ctaEvent === void 0 ? void 0 : ctaEvent({
9669
9698
  eventSubject: 'ctaExposure',
9670
9699
  eventDescription: 'The cta was shown to the user'
9671
9700
  }, rec, item, index);
9672
9701
  }
9673
- }, [isOnScreen, ref, rec, ctaEvent, index]);
9674
- const handleClick = lodash.throttle(() => {
9675
- var _a, _b, _c, _d, _e, _f, _g, _h;
9676
- const item = (_b = (_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.bindProduct) !== null && _b !== void 0 ? _b : rec === null || rec === void 0 ? void 0 : rec.video;
9677
- ctaEvent === null || ctaEvent === void 0 ? void 0 : ctaEvent({
9678
- eventSubject: 'clickCta',
9679
- eventDescription: 'User clicked the CTA'
9680
- }, rec, item, index);
9681
- setPopupDetailData === null || setPopupDetailData === void 0 ? void 0 : setPopupDetailData(Object.assign(Object.assign({}, rec), { index }));
9682
- if (isExternalLink) {
9683
- if ((_d = (_c = rec === null || rec === void 0 ? void 0 : rec.video) === null || _c === void 0 ? void 0 : _c.bindProduct) === null || _d === void 0 ? void 0 : _d.link) {
9684
- const cta = (_e = rec === null || rec === void 0 ? void 0 : rec.video) === null || _e === void 0 ? void 0 : _e.bindCta;
9685
- const product = (_f = rec === null || rec === void 0 ? void 0 : rec.video) === null || _f === void 0 ? void 0 : _f.bindProduct;
9686
- jumpToWeb(rec, product, cta, index);
9687
- window.location.href = window.getJointUtmLink((_h = (_g = rec === null || rec === void 0 ? void 0 : rec.video) === null || _g === void 0 ? void 0 : _g.bindProduct) === null || _h === void 0 ? void 0 : _h.link);
9688
- }
9689
- }
9690
- else {
9691
- onClick === null || onClick === void 0 ? void 0 : onClick();
9692
- }
9693
- }, popup === null || popup === void 0 ? void 0 : popup.duration);
9694
- return (React.createElement("div", { ref: ref, className: className, style: style, onClick: handleClick }, children));
9702
+ }, [isOnScreen, src, ref, rec, ctaEvent, item, index]);
9703
+ return (React.createElement("div", { className: css.css(Object.assign({ overflow: 'hidden', flexShrink: 0, backgroundColor: '#f2f2f2' }, imgStyle)) },
9704
+ React.createElement("div", { ref: ref, hidden: !src, className: css.css({ width: '100%', height: '100%' }) },
9705
+ React.createElement(FormatImage$1, { className: css.css(Object.assign({ width: '100%', objectFit: 'cover', height: '100%', display: 'block', objectPosition: `50% ${translateY ? -translateY + 50 : 50}%` }, style)), src: `${src}?imrquality/rquality/40` }))));
9695
9706
  };
9696
- var EventProvider$1 = React.memo(EventProvider);
9697
-
9698
- var styles$6 = {"tow-line-ellipsis":"index-module_tow-line-ellipsis__3bKKx"};
9707
+ var Img$1 = React.memo(Img);
9699
9708
 
9700
9709
  const Commodity$1 = (_a) => {
9701
- var _b, _c, _d, _e, _f, _g, _h, _j;
9702
- var { content, style, bgImg, recData, bottom_image, ctaTempStyles, isExternalLink, translateY = 0 } = _a, props = __rest(_a, ["content", "style", "bgImg", "recData", "bottom_image", "ctaTempStyles", "isExternalLink", "translateY"]);
9710
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
9711
+ var { content, style, bgImg, recData, bottom_image, ctaTempStyles, isExternalLink, translateY = 0, index } = _a, props = __rest(_a, ["content", "style", "bgImg", "recData", "bottom_image", "ctaTempStyles", "isExternalLink", "translateY", "index"]);
9703
9712
  const { sxpParameter } = useSxpDataSource();
9704
9713
  const product = (_b = recData === null || recData === void 0 ? void 0 : recData.video) === null || _b === void 0 ? void 0 : _b.bindProduct;
9705
9714
  const src = (_f = (_e = (_c = product === null || product === void 0 ? void 0 : product.cover) !== null && _c !== void 0 ? _c : (_d = product === null || product === void 0 ? void 0 : product.homePage) === null || _d === void 0 ? void 0 : _d[0]) !== null && _e !== void 0 ? _e : sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) !== null && _f !== void 0 ? _f : bottom_image;
9706
- return (React.createElement(EventProvider$1, Object.assign({ isExternalLink: isExternalLink, rec: recData, className: css.css(Object.assign({}, style)), style: { display: 'flex' } }, props),
9707
- React.createElement("div", { className: css.css(Object.assign({ overflow: 'hidden', flexShrink: 0, backgroundColor: '#f2f2f2' }, ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.img)) },
9708
- React.createElement(FormatImage$1, { className: css.css({
9709
- width: '100%',
9710
- objectFit: 'cover',
9711
- height: '100%',
9712
- display: 'block',
9713
- objectPosition: `50% ${translateY ? -translateY + 50 : 50}%`
9714
- }), src: src })),
9715
+ return (React.createElement(EventProvider$1, Object.assign({ isExternalLink: isExternalLink, rec: recData, className: css.css(Object.assign({}, style)), style: { display: 'flex' }, index: index }, props),
9716
+ React.createElement(Img$1, { src: src, rec: recData, item: (_h = (_g = recData === null || recData === void 0 ? void 0 : recData.video) === null || _g === void 0 ? void 0 : _g.bindProduct) !== null && _h !== void 0 ? _h : recData === null || recData === void 0 ? void 0 : recData.video, index: index, translateY: translateY, imgStyle: ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.img }),
9715
9717
  React.createElement("div", { className: css.css({
9716
9718
  color: '#fff',
9717
9719
  display: 'flex',
@@ -9720,8 +9722,8 @@ const Commodity$1 = (_a) => {
9720
9722
  width: '100%',
9721
9723
  overflow: 'hidden'
9722
9724
  }) },
9723
- React.createElement("div", { className: styles$6['tow-line-ellipsis'], style: ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.title }, (_g = product === null || product === void 0 ? void 0 : product.title) !== null && _g !== void 0 ? _g : 'Product Name'),
9724
- React.createElement("div", { className: css.css(Object.assign({ padding: '2px 7px', textOverflow: 'ellipsis', overflow: 'hidden', whiteSpace: 'nowrap' }, ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.ctaTitle)) }, (_j = (_h = product === null || product === void 0 ? void 0 : product.bindCta) === null || _h === void 0 ? void 0 : _h.enTitle) !== null && _j !== void 0 ? _j : 'Shop Now'))));
9725
+ React.createElement("div", { className: styles$6['tow-line-ellipsis'], style: ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.title }, (_j = product === null || product === void 0 ? void 0 : product.title) !== null && _j !== void 0 ? _j : 'Product Name'),
9726
+ React.createElement("div", { className: css.css(Object.assign({ padding: '2px 7px', textOverflow: 'ellipsis', overflow: 'hidden', whiteSpace: 'nowrap' }, ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.ctaTitle)) }, (_l = (_k = product === null || product === void 0 ? void 0 : product.bindCta) === null || _k === void 0 ? void 0 : _k.enTitle) !== null && _l !== void 0 ? _l : 'Shop Now'))));
9725
9727
  };
9726
9728
  var CommodityComponent = React.memo(Commodity$1);
9727
9729
 
@@ -9794,14 +9796,14 @@ var interactionRender$5 = [
9794
9796
  ];
9795
9797
 
9796
9798
  const Appoint$1 = (_a) => {
9797
- var _b, _c, _d, _e;
9798
- var { content, style, bgImg, recData, bottom_image, ctaTempStyles, isExternalLink } = _a, props = __rest(_a, ["content", "style", "bgImg", "recData", "bottom_image", "ctaTempStyles", "isExternalLink"]);
9799
+ var _b, _c, _d, _e, _f, _g;
9800
+ var { content, style, bgImg, recData, bottom_image, ctaTempStyles, isExternalLink, index } = _a, props = __rest(_a, ["content", "style", "bgImg", "recData", "bottom_image", "ctaTempStyles", "isExternalLink", "index"]);
9799
9801
  const { sxpParameter } = useSxpDataSource();
9800
9802
  const cta = (_b = recData === null || recData === void 0 ? void 0 : recData.video) === null || _b === void 0 ? void 0 : _b.bindCta;
9801
- return (React.createElement(EventProvider$1, Object.assign({ isExternalLink: isExternalLink, rec: recData, className: css.css(Object.assign({ alignItems: 'center' }, style)), style: { display: 'flex' } }, props),
9802
- React.createElement("div", { className: css.css(Object.assign({ overflow: 'hidden', flexShrink: 0, backgroundColor: '#f2f2f2' }, ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.img)) },
9803
- React.createElement("img", { className: css.css({ width: '100%', objectFit: 'cover', height: '100%', display: 'block' }), src: (_d = (_c = cta === null || cta === void 0 ? void 0 : cta.icon) !== null && _c !== void 0 ? _c : sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) !== null && _d !== void 0 ? _d : bottom_image, alt: 'cta image' })),
9804
- React.createElement("div", { className: css.css(Object.assign({ overflow: 'hidden', textOverflow: 'ellipsis' }, ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.ctaTitle)) }, (_e = cta === null || cta === void 0 ? void 0 : cta.enTitle) !== null && _e !== void 0 ? _e : 'Product Name')));
9803
+ const src = (_d = (_c = cta === null || cta === void 0 ? void 0 : cta.icon) !== null && _c !== void 0 ? _c : sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) !== null && _d !== void 0 ? _d : bottom_image;
9804
+ return (React.createElement(EventProvider$1, Object.assign({ isExternalLink: isExternalLink, rec: recData, className: css.css(Object.assign({ alignItems: 'center' }, style)), style: { display: 'flex' }, index: index }, props),
9805
+ React.createElement(Img$1, { src: src, rec: recData, item: (_f = (_e = recData === null || recData === void 0 ? void 0 : recData.video) === null || _e === void 0 ? void 0 : _e.bindProduct) !== null && _f !== void 0 ? _f : recData === null || recData === void 0 ? void 0 : recData.video, index: index, imgStyle: ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.img }),
9806
+ React.createElement("div", { className: css.css(Object.assign({ overflow: 'hidden', textOverflow: 'ellipsis' }, ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.ctaTitle)) }, (_g = cta === null || cta === void 0 ? void 0 : cta.enTitle) !== null && _g !== void 0 ? _g : 'Product Name')));
9805
9807
  };
9806
9808
  var AppointComponent = React.memo(Appoint$1);
9807
9809
 
@@ -9858,7 +9860,7 @@ const Appoint = createMaterial(AppointComponent, {
9858
9860
  var styles$5 = {"tow-line-ellipsis":"index-module_tow-line-ellipsis__nkBlU"};
9859
9861
 
9860
9862
  const Link$1 = (_a) => {
9861
- var _b, _c, _d, _e, _f;
9863
+ var _b, _c, _d, _e, _f, _g, _h;
9862
9864
  var { content, style, bgImg, recData, bottom_image, ctaTempStyles, index } = _a, props = __rest(_a, ["content", "style", "bgImg", "recData", "bottom_image", "ctaTempStyles", "index"]);
9863
9865
  const { sxpParameter, bffEventReport } = useSxpDataSource();
9864
9866
  const { jumpToWeb } = useEventReport();
@@ -9870,16 +9872,16 @@ const Link$1 = (_a) => {
9870
9872
  window.location.href = window.getJointUtmLink(cta.link);
9871
9873
  }
9872
9874
  };
9875
+ const src = (_e = (_d = cta === null || cta === void 0 ? void 0 : cta.icon) !== null && _d !== void 0 ? _d : sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) !== null && _e !== void 0 ? _e : bottom_image;
9873
9876
  return (React.createElement(EventProvider$1, Object.assign({ index: index, rec: recData, className: css.css(Object.assign({ alignItems: 'center' }, style)), style: { display: 'flex' } }, props, { onClick: handleTo }),
9874
- React.createElement("div", { className: css.css(Object.assign({ backgroundColor: '#f2f2f2', overflow: 'hidden', flexShrink: 0 }, ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.img)) },
9875
- React.createElement(FormatImage$1, { className: css.css({ width: '100%', objectFit: 'cover', height: '100%', display: 'block' }), src: (_e = (_d = cta === null || cta === void 0 ? void 0 : cta.icon) !== null && _d !== void 0 ? _d : sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) !== null && _e !== void 0 ? _e : bottom_image })),
9877
+ React.createElement(Img$1, { src: src, rec: recData, item: (_g = (_f = recData === null || recData === void 0 ? void 0 : recData.video) === null || _f === void 0 ? void 0 : _f.bindProduct) !== null && _g !== void 0 ? _g : recData === null || recData === void 0 ? void 0 : recData.video, index: index, imgStyle: ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.img }),
9876
9878
  React.createElement("div", { className: css.css({
9877
9879
  display: 'flex',
9878
9880
  alignItems: 'center',
9879
9881
  width: '100%',
9880
9882
  overflow: 'hidden'
9881
9883
  }) },
9882
- React.createElement("div", { className: styles$5['tow-line-ellipsis'], style: ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.ctaTitle }, (_f = cta === null || cta === void 0 ? void 0 : cta.enTitle) !== null && _f !== void 0 ? _f : 'Product Name'))));
9884
+ React.createElement("div", { className: styles$5['tow-line-ellipsis'], style: ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.ctaTitle }, (_h = cta === null || cta === void 0 ? void 0 : cta.enTitle) !== null && _h !== void 0 ? _h : 'Product Name'))));
9883
9885
  };
9884
9886
  var LinkComponent = React.memo(Link$1);
9885
9887
 
@@ -9947,20 +9949,13 @@ var interactionRender$4 = [
9947
9949
  var styles$4 = {"tow-line-ellipsis":"index-module_tow-line-ellipsis__yyHVb"};
9948
9950
 
9949
9951
  const CommodityDiro$1 = (_a) => {
9950
- var _b, _c, _d, _e, _f, _g, _h, _j;
9951
- var { content, style, bgImg, recData, bottom_image, ctaTempStyles, isExternalLink, translateY = 0 } = _a, props = __rest(_a, ["content", "style", "bgImg", "recData", "bottom_image", "ctaTempStyles", "isExternalLink", "translateY"]);
9952
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
9953
+ var { content, style, bgImg, recData, bottom_image, ctaTempStyles, isExternalLink, translateY = 0, index } = _a, props = __rest(_a, ["content", "style", "bgImg", "recData", "bottom_image", "ctaTempStyles", "isExternalLink", "translateY", "index"]);
9952
9954
  const { sxpParameter } = useSxpDataSource();
9953
9955
  const product = (_b = recData === null || recData === void 0 ? void 0 : recData.video) === null || _b === void 0 ? void 0 : _b.bindProduct;
9954
9956
  const src = (_f = (_e = (_c = product === null || product === void 0 ? void 0 : product.cover) !== null && _c !== void 0 ? _c : (_d = product === null || product === void 0 ? void 0 : product.homePage) === null || _d === void 0 ? void 0 : _d[0]) !== null && _e !== void 0 ? _e : sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) !== null && _f !== void 0 ? _f : bottom_image;
9955
- return (React.createElement(EventProvider$1, Object.assign({ isExternalLink: isExternalLink, rec: recData, className: css.css(Object.assign({}, style)), style: { display: 'flex' } }, props),
9956
- React.createElement("div", { className: css.css(Object.assign({ overflow: 'hidden', flexShrink: 0, backgroundColor: '#f2f2f2' }, ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.img)) },
9957
- React.createElement(FormatImage$1, { className: css.css({
9958
- width: '100%',
9959
- objectFit: 'cover',
9960
- height: '100%',
9961
- display: 'block',
9962
- objectPosition: `50% ${translateY ? -translateY + 50 : 50}%`
9963
- }), src: src })),
9957
+ return (React.createElement(EventProvider$1, Object.assign({ isExternalLink: isExternalLink, rec: recData, className: css.css(Object.assign({}, style)), style: { display: 'flex' }, index: index }, props),
9958
+ React.createElement(Img$1, { src: src, rec: recData, item: (_h = (_g = recData === null || recData === void 0 ? void 0 : recData.video) === null || _g === void 0 ? void 0 : _g.bindProduct) !== null && _h !== void 0 ? _h : recData === null || recData === void 0 ? void 0 : recData.video, index: index, translateY: translateY, imgStyle: ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.img }),
9964
9959
  React.createElement("div", { className: css.css({
9965
9960
  color: '#fff',
9966
9961
  display: 'flex',
@@ -9969,8 +9964,8 @@ const CommodityDiro$1 = (_a) => {
9969
9964
  width: '100%',
9970
9965
  overflow: 'hidden'
9971
9966
  }) },
9972
- React.createElement("div", { className: styles$4['tow-line-ellipsis'], style: ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.title }, (_g = product === null || product === void 0 ? void 0 : product.title) !== null && _g !== void 0 ? _g : 'Product Name'),
9973
- React.createElement("div", { className: css.css(Object.assign({ padding: '2px 7px', textOverflow: 'ellipsis', overflow: 'hidden', borderRadius: '25px', whiteSpace: 'nowrap' }, ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.ctaTitle)) }, (_j = (_h = product === null || product === void 0 ? void 0 : product.bindCta) === null || _h === void 0 ? void 0 : _h.enTitle) !== null && _j !== void 0 ? _j : 'Shop Now'))));
9967
+ React.createElement("div", { className: styles$4['tow-line-ellipsis'], style: ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.title }, (_j = product === null || product === void 0 ? void 0 : product.title) !== null && _j !== void 0 ? _j : 'Product Name'),
9968
+ React.createElement("div", { className: css.css(Object.assign({ padding: '2px 7px', textOverflow: 'ellipsis', overflow: 'hidden', borderRadius: '25px', whiteSpace: 'nowrap' }, ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.ctaTitle)) }, (_l = (_k = product === null || product === void 0 ? void 0 : product.bindCta) === null || _k === void 0 ? void 0 : _k.enTitle) !== null && _l !== void 0 ? _l : 'Shop Now'))));
9974
9969
  };
9975
9970
  var CommodityDiroComponent = React.memo(CommodityDiro$1);
9976
9971
 
@@ -10045,20 +10040,13 @@ var interactionRender$3 = [
10045
10040
  var styles$3 = {"tow-line-ellipsis":"index-module_tow-line-ellipsis__I-yCC"};
10046
10041
 
10047
10042
  const CommodityDiroNew$1 = (_a) => {
10048
- var _b, _c, _d, _e, _f, _g, _h, _j;
10049
- var { content, style, bgImg, recData, bottom_image, ctaTempStyles, isExternalLink, translateY = 0 } = _a, props = __rest(_a, ["content", "style", "bgImg", "recData", "bottom_image", "ctaTempStyles", "isExternalLink", "translateY"]);
10043
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
10044
+ var { content, style, bgImg, recData, bottom_image, ctaTempStyles, isExternalLink, translateY = 0, index } = _a, props = __rest(_a, ["content", "style", "bgImg", "recData", "bottom_image", "ctaTempStyles", "isExternalLink", "translateY", "index"]);
10050
10045
  const { sxpParameter } = useSxpDataSource();
10051
10046
  const product = (_b = recData === null || recData === void 0 ? void 0 : recData.video) === null || _b === void 0 ? void 0 : _b.bindProduct;
10052
10047
  const src = (_f = (_e = (_c = product === null || product === void 0 ? void 0 : product.cover) !== null && _c !== void 0 ? _c : (_d = product === null || product === void 0 ? void 0 : product.homePage) === null || _d === void 0 ? void 0 : _d[0]) !== null && _e !== void 0 ? _e : sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) !== null && _f !== void 0 ? _f : bottom_image;
10053
- return (React.createElement(EventProvider$1, Object.assign({ isExternalLink: isExternalLink, rec: recData, className: css.css(Object.assign({}, style)), style: { display: 'flex' } }, props),
10054
- React.createElement("div", { className: css.css(Object.assign({ overflow: 'hidden', flexShrink: 0, backgroundColor: '#f2f2f2' }, ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.img)) },
10055
- React.createElement(FormatImage$1, { className: css.css({
10056
- width: '100%',
10057
- objectFit: 'cover',
10058
- height: '100%',
10059
- display: 'block',
10060
- objectPosition: `50% ${translateY ? -translateY + 50 : 50}%`
10061
- }), src: src })),
10048
+ return (React.createElement(EventProvider$1, Object.assign({ isExternalLink: isExternalLink, rec: recData, className: css.css(Object.assign({}, style)), style: { display: 'flex' }, index: index }, props),
10049
+ React.createElement(Img$1, { src: src, rec: recData, item: (_h = (_g = recData === null || recData === void 0 ? void 0 : recData.video) === null || _g === void 0 ? void 0 : _g.bindProduct) !== null && _h !== void 0 ? _h : recData === null || recData === void 0 ? void 0 : recData.video, index: index, translateY: translateY, imgStyle: ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.img }),
10062
10050
  React.createElement("div", { className: css.css({
10063
10051
  color: '#fff',
10064
10052
  display: 'flex',
@@ -10067,8 +10055,8 @@ const CommodityDiroNew$1 = (_a) => {
10067
10055
  width: '100%',
10068
10056
  overflow: 'hidden'
10069
10057
  }) },
10070
- React.createElement("div", { className: styles$3['tow-line-ellipsis'], style: ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.title }, (_g = product === null || product === void 0 ? void 0 : product.title) !== null && _g !== void 0 ? _g : 'Product Name'),
10071
- React.createElement("div", { className: css.css(Object.assign({ textOverflow: 'ellipsis', overflow: 'hidden', whiteSpace: 'nowrap' }, ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.ctaTitle)) }, (_j = (_h = product === null || product === void 0 ? void 0 : product.bindCta) === null || _h === void 0 ? void 0 : _h.enTitle) !== null && _j !== void 0 ? _j : 'Shop now'))));
10058
+ React.createElement("div", { className: styles$3['tow-line-ellipsis'], style: ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.title }, (_j = product === null || product === void 0 ? void 0 : product.title) !== null && _j !== void 0 ? _j : 'Product Name'),
10059
+ React.createElement("div", { className: css.css(Object.assign({ textOverflow: 'ellipsis', overflow: 'hidden', whiteSpace: 'nowrap' }, ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.ctaTitle)) }, (_l = (_k = product === null || product === void 0 ? void 0 : product.bindCta) === null || _k === void 0 ? void 0 : _k.enTitle) !== null && _l !== void 0 ? _l : 'Shop now'))));
10072
10060
  };
10073
10061
  var CommodityDiroNewComponent = React.memo(CommodityDiroNew$1);
10074
10062
 
@@ -10146,31 +10134,6 @@ const Scroll = ({ children, isPadding = true }) => {
10146
10134
  };
10147
10135
  var Scroll$1 = React.memo(Scroll);
10148
10136
 
10149
- /*
10150
- * @Author: binruan@chatlabs.com
10151
- * @Date: 2024-01-16 14:50:13
10152
- * @LastEditors: binruan@chatlabs.com
10153
- * @LastEditTime: 2024-05-21 16:34:13
10154
- * @FilePath: \pb-sxp-ui\src\materials\sxp\template\components\Img.tsx
10155
- *
10156
- */
10157
- const Img = ({ src, rec, item, index, style }) => {
10158
- const ref = React.useRef(null);
10159
- const isOnScreen = useOnScreen(ref);
10160
- const { ctaEvent } = useSxpDataSource();
10161
- React.useEffect(() => {
10162
- if (isOnScreen && src && (ref === null || ref === void 0 ? void 0 : ref.current)) {
10163
- ctaEvent === null || ctaEvent === void 0 ? void 0 : ctaEvent({
10164
- eventSubject: 'ctaExposure',
10165
- eventDescription: 'The cta was shown to the user'
10166
- }, rec, item, index);
10167
- }
10168
- }, [isOnScreen, src, ref, rec, ctaEvent, item, index]);
10169
- return (React.createElement("div", { ref: ref, hidden: !src, className: css.css({ width: '100%', height: '100%' }) },
10170
- React.createElement(FormatImage$1, { className: css.css(Object.assign({ width: '100%', objectFit: 'cover', height: '100%', display: 'block' }, style)), src: src })));
10171
- };
10172
- var Img$1 = React.memo(Img);
10173
-
10174
10137
  var styles$2 = {"two-line-ellipsis":"index-module_two-line-ellipsis__SFQwJ"};
10175
10138
 
10176
10139
  const MultiCommodityDiro$1 = (_a) => {
@@ -10198,11 +10161,8 @@ const MultiCommodityDiro$1 = (_a) => {
10198
10161
  }, popup === null || popup === void 0 ? void 0 : popup.duration);
10199
10162
  return (React.createElement(Scroll$1, { isPadding: !!recData }, products === null || products === void 0 ? void 0 : products.map((item) => {
10200
10163
  var _a, _b, _c, _d, _e, _f, _g;
10201
- return (React.createElement(SwiperSlide, Object.assign({ hidden: recData && !(item === null || item === void 0 ? void 0 : item.bindCta), key: item === null || item === void 0 ? void 0 : item.itemId, className: css.css(Object.assign(Object.assign({}, style), { display: 'flex', flexShrink: 0, marginLeft: 0, marginRight: '8px' })) }, props, { onClick: () => handleClick(item) }),
10202
- React.createElement("div", { className: css.css(Object.assign({ overflow: 'hidden', flexShrink: 0, backgroundColor: '#f2f2f2' }, ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.img)) },
10203
- React.createElement(Img$1, { src: (_d = (_c = (_a = item === null || item === void 0 ? void 0 : item.cover) !== null && _a !== void 0 ? _a : (_b = item === null || item === void 0 ? void 0 : item.homePage) === null || _b === void 0 ? void 0 : _b[0]) !== null && _c !== void 0 ? _c : sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) !== null && _d !== void 0 ? _d : bottom_image, rec: recData, item: item, index: index, style: {
10204
- objectPosition: `50% ${translateY ? -translateY + 50 : 50}%`
10205
- } })),
10164
+ return (React.createElement(React.Fragment, null, recData && !(item === null || item === void 0 ? void 0 : item.bindCta) ? null : (React.createElement(SwiperSlide, Object.assign({ key: item === null || item === void 0 ? void 0 : item.itemId, className: css.css(Object.assign(Object.assign({}, style), { display: 'flex', flexShrink: 0, marginLeft: 0, marginRight: '8px' })) }, props, { onClick: () => handleClick(item) }),
10165
+ React.createElement(Img$1, { src: (_d = (_c = (_a = item === null || item === void 0 ? void 0 : item.cover) !== null && _a !== void 0 ? _a : (_b = item === null || item === void 0 ? void 0 : item.homePage) === null || _b === void 0 ? void 0 : _b[0]) !== null && _c !== void 0 ? _c : sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) !== null && _d !== void 0 ? _d : bottom_image, rec: recData, item: item, index: index, translateY: translateY, imgStyle: ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.img }),
10206
10166
  React.createElement("div", { className: css.css({
10207
10167
  color: '#000',
10208
10168
  display: 'flex',
@@ -10212,7 +10172,7 @@ const MultiCommodityDiro$1 = (_a) => {
10212
10172
  overflow: 'hidden'
10213
10173
  }) },
10214
10174
  React.createElement("div", { className: styles$2['two-line-ellipsis'], style: ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.title }, (_e = item === null || item === void 0 ? void 0 : item.title) !== null && _e !== void 0 ? _e : 'Product Name'),
10215
- React.createElement("div", { className: css.css(Object.assign({ padding: '2px 7px', textOverflow: 'ellipsis', overflow: 'hidden', borderRadius: '25px', whiteSpace: 'nowrap' }, ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.ctaTitle)) }, (_g = (_f = item === null || item === void 0 ? void 0 : item.bindCta) === null || _f === void 0 ? void 0 : _f.enTitle) !== null && _g !== void 0 ? _g : 'Shop Now'))));
10175
+ React.createElement("div", { className: css.css(Object.assign({ padding: '2px 7px', textOverflow: 'ellipsis', overflow: 'hidden', borderRadius: '25px', whiteSpace: 'nowrap' }, ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.ctaTitle)) }, (_g = (_f = item === null || item === void 0 ? void 0 : item.bindCta) === null || _f === void 0 ? void 0 : _f.enTitle) !== null && _g !== void 0 ? _g : 'Shop Now'))))));
10216
10176
  })));
10217
10177
  };
10218
10178
  var MultiCommodityDiroComponent = React.memo(MultiCommodityDiro$1);
@@ -10313,11 +10273,8 @@ const MultiCommodity$1 = (_a) => {
10313
10273
  }, popup === null || popup === void 0 ? void 0 : popup.duration);
10314
10274
  return (React.createElement(Scroll$1, { isPadding: !!recData }, products === null || products === void 0 ? void 0 : products.map((item) => {
10315
10275
  var _a, _b, _c, _d, _e, _f, _g;
10316
- return (React.createElement(SwiperSlide, Object.assign({ hidden: recData && !(item === null || item === void 0 ? void 0 : item.bindCta), key: item.itemId, className: css.css(Object.assign(Object.assign({}, style), { display: 'flex', flexShrink: 0, marginLeft: 0, marginRight: '8px' })) }, props, { onClick: () => handleClick(item) }),
10317
- React.createElement("div", { className: css.css(Object.assign({ overflow: 'hidden', flexShrink: 0, backgroundColor: '#f2f2f2' }, ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.img)) },
10318
- React.createElement(Img$1, { src: (_d = (_c = (_a = item === null || item === void 0 ? void 0 : item.cover) !== null && _a !== void 0 ? _a : (_b = item === null || item === void 0 ? void 0 : item.homePage) === null || _b === void 0 ? void 0 : _b[0]) !== null && _c !== void 0 ? _c : sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) !== null && _d !== void 0 ? _d : bottom_image, rec: recData, item: item, index: index, style: {
10319
- objectPosition: `50% ${translateY ? -translateY + 50 : 50}%`
10320
- } })),
10276
+ return (React.createElement(React.Fragment, null, recData && !(item === null || item === void 0 ? void 0 : item.bindCta) ? null : (React.createElement(SwiperSlide, Object.assign({ key: item.itemId, className: css.css(Object.assign(Object.assign({}, style), { display: 'flex', flexShrink: 0, marginLeft: 0, marginRight: '8px' })) }, props, { onClick: () => handleClick(item) }),
10277
+ React.createElement(Img$1, { src: (_d = (_c = (_a = item === null || item === void 0 ? void 0 : item.cover) !== null && _a !== void 0 ? _a : (_b = item === null || item === void 0 ? void 0 : item.homePage) === null || _b === void 0 ? void 0 : _b[0]) !== null && _c !== void 0 ? _c : sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) !== null && _d !== void 0 ? _d : bottom_image, rec: recData, item: item, index: index, translateY: translateY, imgStyle: ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.img }),
10321
10278
  React.createElement("div", { className: css.css({
10322
10279
  color: '#fff',
10323
10280
  display: 'flex',
@@ -10327,7 +10284,7 @@ const MultiCommodity$1 = (_a) => {
10327
10284
  overflow: 'hidden'
10328
10285
  }) },
10329
10286
  React.createElement("div", { className: styles$1['two-line-ellipsis'], style: ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.title }, (_e = item === null || item === void 0 ? void 0 : item.title) !== null && _e !== void 0 ? _e : 'Product Name'),
10330
- React.createElement("div", { className: css.css(Object.assign({ padding: '2px 7px', textOverflow: 'ellipsis', overflow: 'hidden', whiteSpace: 'nowrap' }, ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.ctaTitle)) }, (_g = (_f = item === null || item === void 0 ? void 0 : item.bindCta) === null || _f === void 0 ? void 0 : _f.enTitle) !== null && _g !== void 0 ? _g : 'Shop Now'))));
10287
+ React.createElement("div", { className: css.css(Object.assign({ padding: '2px 7px', textOverflow: 'ellipsis', overflow: 'hidden', whiteSpace: 'nowrap' }, ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.ctaTitle)) }, (_g = (_f = item === null || item === void 0 ? void 0 : item.bindCta) === null || _f === void 0 ? void 0 : _f.enTitle) !== null && _g !== void 0 ? _g : 'Shop Now'))))));
10331
10288
  })));
10332
10289
  };
10333
10290
  var MultiCommodityComponent = React.memo(MultiCommodity$1);
@@ -10427,11 +10384,8 @@ const MultiCommodityDiroNew$1 = (_a) => {
10427
10384
  }, popup === null || popup === void 0 ? void 0 : popup.duration);
10428
10385
  return (React.createElement(Scroll$1, { isPadding: !!recData }, products === null || products === void 0 ? void 0 : products.map((item) => {
10429
10386
  var _a, _b, _c, _d, _e, _f, _g;
10430
- return (React.createElement(SwiperSlide, Object.assign({ hidden: recData && !(item === null || item === void 0 ? void 0 : item.bindCta), key: item === null || item === void 0 ? void 0 : item.itemId, className: css.css(Object.assign(Object.assign({}, style), { display: 'flex', flexShrink: 0, marginLeft: 0, marginRight: '8px' })) }, props, { onClick: () => handleClick(item) }),
10431
- React.createElement("div", { className: css.css(Object.assign({ overflow: 'hidden', flexShrink: 0, backgroundColor: '#f2f2f2' }, ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.img)) },
10432
- React.createElement(Img$1, { src: (_d = (_c = (_a = item === null || item === void 0 ? void 0 : item.cover) !== null && _a !== void 0 ? _a : (_b = item === null || item === void 0 ? void 0 : item.homePage) === null || _b === void 0 ? void 0 : _b[0]) !== null && _c !== void 0 ? _c : sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) !== null && _d !== void 0 ? _d : bottom_image, rec: recData, item: item, index: index, style: {
10433
- objectPosition: `50% ${translateY ? -translateY + 50 : 50}%`
10434
- } })),
10387
+ return (React.createElement(React.Fragment, null, recData && !(item === null || item === void 0 ? void 0 : item.bindCta) ? null : (React.createElement(SwiperSlide, Object.assign({ key: item === null || item === void 0 ? void 0 : item.itemId, className: css.css(Object.assign(Object.assign({}, style), { display: 'flex', flexShrink: 0, marginLeft: 0, marginRight: '8px' })) }, props, { onClick: () => handleClick(item) }),
10388
+ React.createElement(Img$1, { src: (_d = (_c = (_a = item === null || item === void 0 ? void 0 : item.cover) !== null && _a !== void 0 ? _a : (_b = item === null || item === void 0 ? void 0 : item.homePage) === null || _b === void 0 ? void 0 : _b[0]) !== null && _c !== void 0 ? _c : sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) !== null && _d !== void 0 ? _d : bottom_image, rec: recData, item: item, index: index, translateY: translateY, imgStyle: ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.img }),
10435
10389
  React.createElement("div", { className: css.css({
10436
10390
  color: '#fff',
10437
10391
  display: 'flex',
@@ -10442,7 +10396,7 @@ const MultiCommodityDiroNew$1 = (_a) => {
10442
10396
  lineHeight: '20px'
10443
10397
  }) },
10444
10398
  React.createElement("div", { className: styles['tow-line-ellipsis'], style: ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.title }, (_e = item === null || item === void 0 ? void 0 : item.title) !== null && _e !== void 0 ? _e : 'Product Name'),
10445
- React.createElement("div", { className: css.css(Object.assign({ textOverflow: 'ellipsis', overflow: 'hidden', whiteSpace: 'nowrap' }, ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.ctaTitle)) }, (_g = (_f = item === null || item === void 0 ? void 0 : item.bindCta) === null || _f === void 0 ? void 0 : _f.enTitle) !== null && _g !== void 0 ? _g : 'Shop now'))));
10399
+ React.createElement("div", { className: css.css(Object.assign({ textOverflow: 'ellipsis', overflow: 'hidden', whiteSpace: 'nowrap' }, ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.ctaTitle)) }, (_g = (_f = item === null || item === void 0 ? void 0 : item.bindCta) === null || _f === void 0 ? void 0 : _f.enTitle) !== null && _g !== void 0 ? _g : 'Shop now'))))));
10446
10400
  })));
10447
10401
  };
10448
10402
  var MultiCommodityDiroNewComponent = React.memo(MultiCommodityDiroNew$1);
@@ -12949,7 +12903,7 @@ const VideoWidget$2 = ({ rec, index, height, data, muted, activeIndex, videoPost
12949
12903
  React.useEffect(() => {
12950
12904
  if (!videoRef)
12951
12905
  return;
12952
- videoRef === null || videoRef === void 0 ? void 0 : videoRef.muted(muted);
12906
+ videoRef.muted = muted;
12953
12907
  }, [muted, videoRef]);
12954
12908
  const handleEnded = React.useCallback(() => {
12955
12909
  if (!videoRef)
@@ -12964,10 +12918,10 @@ const VideoWidget$2 = ({ rec, index, height, data, muted, activeIndex, videoPost
12964
12918
  setIsLoadFinish(true);
12965
12919
  setIsPauseVideo(false);
12966
12920
  const item = data[index];
12967
- if (item && (videoRef === null || videoRef === void 0 ? void 0 : videoRef.duration())) {
12968
- videoStartTime.current = (videoRef === null || videoRef === void 0 ? void 0 : videoRef.currentTime()) || 0;
12969
- const videoDuration = ((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.duration()) !== null && _a !== void 0 ? _a : 0).toFixed(2);
12970
- const videoCurrentTime = ((_b = videoRef === null || videoRef === void 0 ? void 0 : videoRef.currentTime()) !== null && _b !== void 0 ? _b : 0).toFixed(2);
12921
+ if (item && (videoRef === null || videoRef === void 0 ? void 0 : videoRef.duration)) {
12922
+ videoStartTime.current = (videoRef === null || videoRef === void 0 ? void 0 : videoRef.currentTime) || 0;
12923
+ const videoDuration = ((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.duration) !== null && _a !== void 0 ? _a : 0).toFixed(2);
12924
+ const videoCurrentTime = ((_b = videoRef === null || videoRef === void 0 ? void 0 : videoRef.currentTime) !== null && _b !== void 0 ? _b : 0).toFixed(2);
12971
12925
  const playType = isFirstPlay ? '0' : '1';
12972
12926
  bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
12973
12927
  eventInfo: {
@@ -12991,21 +12945,17 @@ const VideoWidget$2 = ({ rec, index, height, data, muted, activeIndex, videoPost
12991
12945
  var _a;
12992
12946
  if (!videoRef || firstFrameSrc || !blur)
12993
12947
  return;
12994
- const videoDomRef = document.getElementById('player-container-id_html5_api');
12995
- if (!videoDomRef)
12996
- return;
12997
- videoDomRef.style.objectFit = 'contain';
12948
+ videoRef.style.objectFit = 'contain';
12998
12949
  if (((_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.cover) || !canvasRef || !canvasRef.current || isBgColor)
12999
12950
  return;
13000
12951
  const setFrameImg = () => {
13001
- const video = videoDomRef;
13002
12952
  const canvas = canvasRef === null || canvasRef === void 0 ? void 0 : canvasRef.current;
13003
12953
  const ctx = canvas.getContext('2d');
13004
12954
  const targetWidth = window === null || window === void 0 ? void 0 : window.innerWidth;
13005
12955
  const targetHeight = window === null || window === void 0 ? void 0 : window.innerHeight;
13006
12956
  canvas.height = targetHeight;
13007
12957
  canvas.width = targetWidth;
13008
- ctx === null || ctx === void 0 ? void 0 : ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
12958
+ ctx === null || ctx === void 0 ? void 0 : ctx.drawImage(videoRef, 0, 0, canvas.width, canvas.height);
13009
12959
  setFirstFrameSrc(canvas.toDataURL());
13010
12960
  };
13011
12961
  setFrameImg();
@@ -13017,21 +12967,13 @@ const VideoWidget$2 = ({ rec, index, height, data, muted, activeIndex, videoPost
13017
12967
  if (!videoRef)
13018
12968
  return;
13019
12969
  handLoadeddata();
13020
- // if (activeIndex !== index) {
13021
- // videoRef?.play();
13022
- // videoRef?.pause();
13023
- // }
13024
- // setIsLoadFinish(true);
13025
12970
  }, [videoRef, handLoadeddata]);
13026
- React.useCallback(() => {
13027
- setIsLoadFinish(true);
13028
- }, []);
13029
12971
  const handleClickVideo = React.useCallback((type) => () => {
13030
12972
  if (!videoRef)
13031
12973
  return;
13032
12974
  if (!isLoadFinish)
13033
12975
  return;
13034
- const isPause = videoRef === null || videoRef === void 0 ? void 0 : videoRef.paused();
12976
+ const isPause = videoRef === null || videoRef === void 0 ? void 0 : videoRef.paused;
13035
12977
  switch (type) {
13036
12978
  case 'start':
13037
12979
  if (!isPause)
@@ -13063,10 +13005,10 @@ const VideoWidget$2 = ({ rec, index, height, data, muted, activeIndex, videoPost
13063
13005
  if (activeIndex !== index)
13064
13006
  return;
13065
13007
  const item = data[index];
13066
- const videoDuration = ((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.duration()) !== null && _a !== void 0 ? _a : 0).toFixed(2);
13067
- const videoCurrentTime = ((_b = videoRef === null || videoRef === void 0 ? void 0 : videoRef.currentTime()) !== null && _b !== void 0 ? _b : 0).toFixed(2);
13068
- if (videoRef === null || videoRef === void 0 ? void 0 : videoRef.duration()) {
13069
- const playDuration = ((videoRef === null || videoRef === void 0 ? void 0 : videoRef.currentTime()) - videoStartTime.current).toFixed(2);
13008
+ const videoDuration = ((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.duration) !== null && _a !== void 0 ? _a : 0).toFixed(2);
13009
+ const videoCurrentTime = ((_b = videoRef === null || videoRef === void 0 ? void 0 : videoRef.currentTime) !== null && _b !== void 0 ? _b : 0).toFixed(2);
13010
+ if (videoRef === null || videoRef === void 0 ? void 0 : videoRef.duration) {
13011
+ const playDuration = ((videoRef === null || videoRef === void 0 ? void 0 : videoRef.currentTime) - videoStartTime.current).toFixed(2);
13070
13012
  bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
13071
13013
  eventInfo: {
13072
13014
  eventSubject: 'playOverVideo',
@@ -13090,7 +13032,19 @@ const VideoWidget$2 = ({ rec, index, height, data, muted, activeIndex, videoPost
13090
13032
  const videoSrc = rec === null || rec === void 0 ? void 0 : rec.video.url;
13091
13033
  if (!videoSrc)
13092
13034
  return;
13093
- videoRef === null || videoRef === void 0 ? void 0 : videoRef.src(videoSrc);
13035
+ if (videoSrc.includes('.m3u8')) {
13036
+ if (Hls.isSupported()) {
13037
+ const hls = new Hls();
13038
+ hls.loadSource(videoSrc);
13039
+ hls.attachMedia(videoRef.current);
13040
+ }
13041
+ else {
13042
+ videoRef.src = videoSrc;
13043
+ }
13044
+ }
13045
+ else {
13046
+ videoRef.src = videoSrc;
13047
+ }
13094
13048
  setIsPauseVideo(false);
13095
13049
  const videoPlayerWrapperNode = document.querySelector(`#${videoId}`);
13096
13050
  const dom = document.querySelector('#player-container-id');
@@ -13098,20 +13052,20 @@ const VideoWidget$2 = ({ rec, index, height, data, muted, activeIndex, videoPost
13098
13052
  if (!dom && !dom2)
13099
13053
  return;
13100
13054
  videoPlayerWrapperNode === null || videoPlayerWrapperNode === void 0 ? void 0 : videoPlayerWrapperNode.appendChild(dom || dom2);
13101
- videoRef === null || videoRef === void 0 ? void 0 : videoRef.on('loadedmetadata', handleLoadedmetadata);
13102
- videoRef === null || videoRef === void 0 ? void 0 : videoRef.on('loadeddata', handLoadeddata);
13103
- // videoRef?.on('canplay', handleCanplay);
13104
- videoRef === null || videoRef === void 0 ? void 0 : videoRef.on('playing', handlePlaying);
13105
- videoRef === null || videoRef === void 0 ? void 0 : videoRef.on('pause', handlePause);
13106
- videoRef === null || videoRef === void 0 ? void 0 : videoRef.on('ended', handleEnded);
13055
+ videoRef.setAttribute('x5-playsinline', 'true');
13056
+ videoRef.setAttribute('webkit-playsinline', 'true');
13057
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.addEventListener('loadedmetadata', handleLoadedmetadata);
13058
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.addEventListener('loadeddata', handLoadeddata);
13059
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.addEventListener('playing', handlePlaying);
13060
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.addEventListener('pause', handlePause);
13061
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.addEventListener('ended', handleEnded);
13107
13062
  return () => {
13108
13063
  dom2 === null || dom2 === void 0 ? void 0 : dom2.appendChild(dom);
13109
- videoRef === null || videoRef === void 0 ? void 0 : videoRef.off('loadedmetadata', handleLoadedmetadata);
13110
- videoRef === null || videoRef === void 0 ? void 0 : videoRef.off('loadeddata', handLoadeddata);
13111
- // videoRef?.off('canplay', handleCanplay);
13112
- videoRef === null || videoRef === void 0 ? void 0 : videoRef.off('playing', handlePlaying);
13113
- videoRef === null || videoRef === void 0 ? void 0 : videoRef.off('pause', handlePause);
13114
- videoRef === null || videoRef === void 0 ? void 0 : videoRef.off('ended', handleEnded);
13064
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.removeEventListener('loadedmetadata', handleLoadedmetadata);
13065
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.removeEventListener('loadeddata', handLoadeddata);
13066
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.removeEventListener('playing', handlePlaying);
13067
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.removeEventListener('pause', handlePause);
13068
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.removeEventListener('ended', handleEnded);
13115
13069
  };
13116
13070
  }, [isActive, videoId, rec, videoRef]);
13117
13071
  React.useEffect(() => {
@@ -13133,7 +13087,7 @@ const VideoWidget$2 = ({ rec, index, height, data, muted, activeIndex, videoPost
13133
13087
  React.useEffect(() => {
13134
13088
  if (!isActive || !videoRef)
13135
13089
  return;
13136
- const isPause = videoRef === null || videoRef === void 0 ? void 0 : videoRef.paused();
13090
+ const isPause = videoRef === null || videoRef === void 0 ? void 0 : videoRef.paused;
13137
13091
  if (!isPause && openHashtag) {
13138
13092
  videoRef === null || videoRef === void 0 ? void 0 : videoRef.pause();
13139
13093
  }
@@ -13576,7 +13530,7 @@ var Tagbar$1 = React.memo(Tagbar);
13576
13530
  * @Author: binruan@chatlabs.com
13577
13531
  * @Date: 2024-01-15 19:03:09
13578
13532
  * @LastEditors: binruan@chatlabs.com
13579
- * @LastEditTime: 2024-06-20 15:54:53
13533
+ * @LastEditTime: 2024-06-21 08:56:05
13580
13534
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\index.tsx
13581
13535
  *
13582
13536
  */
@@ -13592,8 +13546,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
13592
13546
  const [isShowMore, setIsShowMore] = React.useState(false);
13593
13547
  const { loadVideos, bffEventReport, loading, setPopupDetailData, ctaEvent, swiperRef, waterFallData, setOpenHashtag, appDomain, openHashtag, loadingImage, isFromHashtag, popupDetailData, bffFbReport, curTime, h5EnterLink, isShowConsent, selectTag } = useSxpDataSource();
13594
13548
  const { backMainFeed } = useEventReport();
13595
- const [videoRef, setVideoRef] = React.useState(null);
13596
- const playerRef = React.useRef();
13549
+ const videoRef = React.useRef();
13597
13550
  const { productView } = useEventReport();
13598
13551
  const isShowFingerTip = React.useMemo(() => {
13599
13552
  return data.length > 0 && !loading && getFeUserId();
@@ -13624,30 +13577,13 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
13624
13577
  const firstRef = React.useRef();
13625
13578
  React.useEffect(() => {
13626
13579
  var _a, _b, _c, _d;
13627
- if (!firstRef.current && !videoRef && (playerRef === null || playerRef === void 0 ? void 0 : playerRef.current) && (data === null || data === void 0 ? void 0 : data.length) > 0) {
13580
+ if (!firstRef.current && (videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) && (data === null || data === void 0 ? void 0 : data.length) > 0) {
13628
13581
  firstRef.current = true;
13629
- const player = TCPlayer('player-container-id', {
13630
- licenseUrl, // license 地址,参考准备工作部分,在视立方控制台申请 license 后可获得 licenseUrl
13631
- controls: false,
13632
- loop: false,
13633
- autoplay: true,
13634
- muted: true,
13635
- preload: 'auto',
13636
- posterImage: false,
13637
- bigPlayButton: true,
13638
- sources: ((_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.url)
13639
- ? [
13640
- {
13641
- src: (_d = (_c = data === null || data === void 0 ? void 0 : data[0]) === null || _c === void 0 ? void 0 : _c.video) === null || _d === void 0 ? void 0 : _d.url
13642
- }
13643
- ]
13644
- : []
13645
- });
13646
- player === null || player === void 0 ? void 0 : player.ready(() => {
13647
- setVideoRef(player);
13648
- });
13582
+ if ((_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.url) {
13583
+ videoRef.current.src = (_d = (_c = data === null || data === void 0 ? void 0 : data[0]) === null || _c === void 0 ? void 0 : _c.video) === null || _d === void 0 ? void 0 : _d.url;
13584
+ }
13649
13585
  }
13650
- }, [videoRef, licenseUrl, data]);
13586
+ }, [videoRef, data]);
13651
13587
  React.useEffect(() => {
13652
13588
  var _a;
13653
13589
  const index = (data === null || data === void 0 ? void 0 : data.findIndex((item) => {
@@ -13765,7 +13701,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
13765
13701
  const renderContent = React.useCallback((rec, index) => {
13766
13702
  var _a, _b, _c, _d;
13767
13703
  if ((_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.url) {
13768
- return (React.createElement(VideoWidget$3, { rec: rec, index: index, muted: isMuted, data: data, height: height, activeIndex: activeIndex, videoPostConfig: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.videoPost, videoRef: videoRef }));
13704
+ return (React.createElement(VideoWidget$3, { rec: rec, index: index, muted: isMuted, data: data, height: height, activeIndex: activeIndex, videoPostConfig: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.videoPost, videoRef: videoRef.current }));
13769
13705
  }
13770
13706
  if ((_b = rec === null || rec === void 0 ? void 0 : rec.video) === null || _b === void 0 ? void 0 : _b.imgUrls) {
13771
13707
  return (React.createElement(PictureGroup$3, { key: rec === null || rec === void 0 ? void 0 : rec.video.itemId, imgUrls: rec === null || rec === void 0 ? void 0 : rec.video.imgUrls, width: containerWidth, height: height, rec: rec, index: index, onReportViewImageEnd: handleReportViewImageEnd, onViewImageStartEvent: handleViewImageStartEvent, imgUrlsPostConfig: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.imgUrlsPost }));
@@ -13791,7 +13727,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
13791
13727
  tipText,
13792
13728
  resolver,
13793
13729
  schema,
13794
- videoRef
13730
+ videoRef.current
13795
13731
  ]);
13796
13732
  const onExpandableChange = React.useCallback((v) => {
13797
13733
  setIsShowMore(v);
@@ -13949,14 +13885,17 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
13949
13885
  }
13950
13886
  };
13951
13887
  const visList = React.useMemo(() => {
13952
- const list = data === null || data === void 0 ? void 0 : data.map((item, index) => {
13953
- if (activeIndex === index || index - 1 === activeIndex || index + 1 === activeIndex) {
13954
- return item;
13955
- }
13956
- else {
13957
- return null;
13958
- }
13959
- });
13888
+ var _a;
13889
+ const list = activeIndex === 0
13890
+ ? [(_a = data === null || data === void 0 ? void 0 : data[0]) !== null && _a !== void 0 ? _a : null]
13891
+ : data === null || data === void 0 ? void 0 : data.map((item, index) => {
13892
+ if (activeIndex === index || index - 1 === activeIndex || index + 1 === activeIndex) {
13893
+ return item;
13894
+ }
13895
+ else {
13896
+ return null;
13897
+ }
13898
+ });
13960
13899
  return !waterFallData ? list.concat([{ loading: true }]) : list;
13961
13900
  }, [data, activeIndex, waterFallData]);
13962
13901
  const renderView = React.useMemo(() => {
@@ -14021,7 +13960,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
14021
13960
  renderView),
14022
13961
  React.createElement(WaterFall$1, Object.assign({}, (_k = (_j = (_h = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.hashTag) === null || _h === void 0 ? void 0 : _h[0]) === null || _j === void 0 ? void 0 : _j.item) === null || _k === void 0 ? void 0 : _k.props)),
14023
13962
  React.createElement("div", { style: { position: 'absolute', zIndex: -100 } },
14024
- React.createElement("video", { ref: playerRef, id: 'player-container-id', playsInline: true, crossOrigin: 'anonymous', style: {
13963
+ React.createElement("video", { ref: videoRef, id: 'player-container-id', playsInline: true, crossOrigin: 'anonymous', preload: 'auto', controls: false, muted: true, style: {
14025
13964
  backgroundColor: 'transparent',
14026
13965
  width: '100%',
14027
13966
  height: '100%',
@@ -14554,3 +14493,4 @@ exports.default = Pagebuilder;
14554
14493
  exports.defaultSetting = defaultSetting;
14555
14494
  exports.materials = _materials_;
14556
14495
  exports.useEditorDataProvider = useEditorDataProvider;
14496
+ //# sourceMappingURL=index.cjs.map