pb-sxp-ui 1.0.88 → 1.0.90

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.js CHANGED
@@ -5,8 +5,8 @@ import React, { useContext, useMemo, memo, useEffect, createContext, useState, u
5
5
  import qs from 'qs';
6
6
  import EventEmitter from 'eventemitter3';
7
7
  import { css } from '@emotion/css';
8
- import { BetaSchemaForm } from '@ant-design/pro-components';
9
8
  import * as ReactDOM from 'react-dom';
9
+ import Hls from 'hls.js';
10
10
 
11
11
  /******************************************************************************
12
12
  Copyright (c) Microsoft Corporation.
@@ -1335,7 +1335,7 @@ const AppointForm$1 = (_a) => {
1335
1335
  key: '4'
1336
1336
  }
1337
1337
  ], []);
1338
- const columnsData = useMemo(() => {
1338
+ useMemo(() => {
1339
1339
  if (layoutType === undefined) {
1340
1340
  const list = cloneDeep(columns) || defaultColumns;
1341
1341
  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 } })));
@@ -1378,8 +1378,7 @@ const AppointForm$1 = (_a) => {
1378
1378
  return (React.createElement("div", { className: 'pb-appoint-form' },
1379
1379
  React.createElement("div", { className: `pb-appoint-form-title ${css(Object.assign({}, textStyle))}` }, title),
1380
1380
  React.createElement("div", Object.assign({ className: css(Object.assign({}, style)) }, props),
1381
- React.createElement("div", { className: 'pb-appoint-form-container' },
1382
- React.createElement(BetaSchemaForm, { columns: columnsData, submitter: false, layout: layoutType, autoFocusFirstInput: false, size: 'large', formRef: formRef, className: 'panel-reset' }))),
1381
+ React.createElement("div", { className: 'pb-appoint-form-container' })),
1383
1382
  React.createElement("div", { className: 'pb-appoint-form-btn-wrapper' },
1384
1383
  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))));
1385
1384
  };
@@ -8573,26 +8572,21 @@ var ExpandableText$1 = memo(ExpandableText);
8573
8572
  * @Author: binruan@chatlabs.com
8574
8573
  * @Date: 2024-03-20 10:27:31
8575
8574
  * @LastEditors: binruan@chatlabs.com
8576
- * @LastEditTime: 2024-06-19 16:25:46
8575
+ * @LastEditTime: 2024-06-20 18:56:52
8577
8576
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\FormatImage.tsx
8578
8577
  *
8579
8578
  */
8580
8579
  const FormatImage = forwardRef((props, ref) => {
8581
8580
  const { src, onLoad, style, className, loading } = props;
8582
8581
  const [imgSrc, setImgSrc] = useState();
8583
- const { swiperRef } = useSxpDataSource();
8584
8582
  useImperativeHandle(ref, () => ({
8585
8583
  setSrc: (v) => {
8586
8584
  setImgSrc(v);
8587
8585
  }
8588
8586
  }));
8589
8587
  useEffect(() => {
8590
- var _a, _b;
8591
- // 首屏不加载第二屏之后的图片
8592
- 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;
8593
- if (index === 0 || index > 0)
8594
- setImgSrc(src);
8595
- }, [src, swiperRef]);
8588
+ setImgSrc(src);
8589
+ }, [src]);
8596
8590
  useRef(null);
8597
8591
  // useEffect(() => {
8598
8592
  // let observer: any = null;
@@ -9604,6 +9598,38 @@ var interactionRender$6 = [
9604
9598
  }
9605
9599
  ];
9606
9600
 
9601
+ const EventProvider = (_a) => {
9602
+ var { rec, children, className, onClick, style, isExternalLink = false, index } = _a; __rest(_a, ["rec", "children", "className", "onClick", "style", "isExternalLink", "index"]);
9603
+ const ref = useRef(null);
9604
+ const { popup } = useEditor();
9605
+ const { setPopupDetailData, ctaEvent } = useSxpDataSource();
9606
+ const { jumpToWeb } = useEventReport();
9607
+ const handleClick = throttle(() => {
9608
+ var _a, _b, _c, _d, _e, _f, _g, _h;
9609
+ 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;
9610
+ ctaEvent === null || ctaEvent === void 0 ? void 0 : ctaEvent({
9611
+ eventSubject: 'clickCta',
9612
+ eventDescription: 'User clicked the CTA'
9613
+ }, rec, item, index);
9614
+ setPopupDetailData === null || setPopupDetailData === void 0 ? void 0 : setPopupDetailData(Object.assign(Object.assign({}, rec), { index }));
9615
+ if (isExternalLink) {
9616
+ 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) {
9617
+ const cta = (_e = rec === null || rec === void 0 ? void 0 : rec.video) === null || _e === void 0 ? void 0 : _e.bindCta;
9618
+ const product = (_f = rec === null || rec === void 0 ? void 0 : rec.video) === null || _f === void 0 ? void 0 : _f.bindProduct;
9619
+ jumpToWeb(rec, product, cta, index);
9620
+ 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);
9621
+ }
9622
+ }
9623
+ else {
9624
+ onClick === null || onClick === void 0 ? void 0 : onClick();
9625
+ }
9626
+ }, popup === null || popup === void 0 ? void 0 : popup.duration);
9627
+ return (React.createElement("div", { ref: ref, className: className, style: style, onClick: handleClick }, children));
9628
+ };
9629
+ var EventProvider$1 = memo(EventProvider);
9630
+
9631
+ var styles$6 = {"tow-line-ellipsis":"index-module_tow-line-ellipsis__3bKKx"};
9632
+
9607
9633
  /*
9608
9634
  * @Author: binruan@chatlabs.com
9609
9635
  * @Date: 2023-04-12 09:58:58
@@ -9631,64 +9657,40 @@ function useOnScreen(ref) {
9631
9657
  return isOnScreen;
9632
9658
  }
9633
9659
 
9634
- const EventProvider = (_a) => {
9635
- var { rec, children, className, onClick, style, isExternalLink = false, index } = _a; __rest(_a, ["rec", "children", "className", "onClick", "style", "isExternalLink", "index"]);
9660
+ /*
9661
+ * @Author: binruan@chatlabs.com
9662
+ * @Date: 2024-01-16 14:50:13
9663
+ * @LastEditors: binruan@chatlabs.com
9664
+ * @LastEditTime: 2024-06-21 11:59:25
9665
+ * @FilePath: \pb-sxp-ui\src\materials\sxp\template\components\Img.tsx
9666
+ *
9667
+ */
9668
+ const Img = ({ src, rec, item, index, style, translateY, imgStyle }) => {
9636
9669
  const ref = useRef(null);
9637
9670
  const isOnScreen = useOnScreen(ref);
9638
- const { popup } = useEditor();
9639
- const { setPopupDetailData, ctaEvent } = useSxpDataSource();
9640
- const { jumpToWeb } = useEventReport();
9671
+ const { ctaEvent } = useSxpDataSource();
9641
9672
  useEffect(() => {
9642
- var _a, _b;
9643
- if (isOnScreen && (ref === null || ref === void 0 ? void 0 : ref.current)) {
9644
- 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;
9673
+ if (isOnScreen && src && (ref === null || ref === void 0 ? void 0 : ref.current)) {
9645
9674
  ctaEvent === null || ctaEvent === void 0 ? void 0 : ctaEvent({
9646
9675
  eventSubject: 'ctaExposure',
9647
9676
  eventDescription: 'The cta was shown to the user'
9648
9677
  }, rec, item, index);
9649
9678
  }
9650
- }, [isOnScreen, ref, rec, ctaEvent, index]);
9651
- const handleClick = throttle(() => {
9652
- var _a, _b, _c, _d, _e, _f, _g, _h;
9653
- 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;
9654
- ctaEvent === null || ctaEvent === void 0 ? void 0 : ctaEvent({
9655
- eventSubject: 'clickCta',
9656
- eventDescription: 'User clicked the CTA'
9657
- }, rec, item, index);
9658
- setPopupDetailData === null || setPopupDetailData === void 0 ? void 0 : setPopupDetailData(Object.assign(Object.assign({}, rec), { index }));
9659
- if (isExternalLink) {
9660
- 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) {
9661
- const cta = (_e = rec === null || rec === void 0 ? void 0 : rec.video) === null || _e === void 0 ? void 0 : _e.bindCta;
9662
- const product = (_f = rec === null || rec === void 0 ? void 0 : rec.video) === null || _f === void 0 ? void 0 : _f.bindProduct;
9663
- jumpToWeb(rec, product, cta, index);
9664
- 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);
9665
- }
9666
- }
9667
- else {
9668
- onClick === null || onClick === void 0 ? void 0 : onClick();
9669
- }
9670
- }, popup === null || popup === void 0 ? void 0 : popup.duration);
9671
- return (React.createElement("div", { ref: ref, className: className, style: style, onClick: handleClick }, children));
9679
+ }, [isOnScreen, src, ref, rec, ctaEvent, item, index]);
9680
+ return (React.createElement("div", { className: css(Object.assign({ overflow: 'hidden', flexShrink: 0, backgroundColor: '#f2f2f2' }, imgStyle)) },
9681
+ React.createElement("div", { ref: ref, hidden: !src, className: css({ width: '100%', height: '100%' }) },
9682
+ React.createElement(FormatImage$1, { className: css(Object.assign({ width: '100%', objectFit: 'cover', height: '100%', display: 'block', objectPosition: `50% ${translateY ? -translateY + 50 : 50}%` }, style)), src: `${src}?imrquality/rquality/40` }))));
9672
9683
  };
9673
- var EventProvider$1 = memo(EventProvider);
9674
-
9675
- var styles$6 = {"tow-line-ellipsis":"index-module_tow-line-ellipsis__3bKKx"};
9684
+ var Img$1 = memo(Img);
9676
9685
 
9677
9686
  const Commodity$1 = (_a) => {
9678
- var _b, _c, _d, _e, _f, _g, _h, _j;
9679
- var { content, style, bgImg, recData, bottom_image, ctaTempStyles, isExternalLink, translateY = 0 } = _a, props = __rest(_a, ["content", "style", "bgImg", "recData", "bottom_image", "ctaTempStyles", "isExternalLink", "translateY"]);
9687
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
9688
+ 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"]);
9680
9689
  const { sxpParameter } = useSxpDataSource();
9681
9690
  const product = (_b = recData === null || recData === void 0 ? void 0 : recData.video) === null || _b === void 0 ? void 0 : _b.bindProduct;
9682
9691
  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;
9683
- return (React.createElement(EventProvider$1, Object.assign({ isExternalLink: isExternalLink, rec: recData, className: css(Object.assign({}, style)), style: { display: 'flex' } }, props),
9684
- React.createElement("div", { className: css(Object.assign({ overflow: 'hidden', flexShrink: 0, backgroundColor: '#f2f2f2' }, ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.img)) },
9685
- React.createElement(FormatImage$1, { className: css({
9686
- width: '100%',
9687
- objectFit: 'cover',
9688
- height: '100%',
9689
- display: 'block',
9690
- objectPosition: `50% ${translateY ? -translateY + 50 : 50}%`
9691
- }), src: src })),
9692
+ return (React.createElement(EventProvider$1, Object.assign({ isExternalLink: isExternalLink, rec: recData, className: css(Object.assign({}, style)), style: { display: 'flex' }, index: index }, props),
9693
+ 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 }),
9692
9694
  React.createElement("div", { className: css({
9693
9695
  color: '#fff',
9694
9696
  display: 'flex',
@@ -9697,8 +9699,8 @@ const Commodity$1 = (_a) => {
9697
9699
  width: '100%',
9698
9700
  overflow: 'hidden'
9699
9701
  }) },
9700
- 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'),
9701
- React.createElement("div", { className: 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'))));
9702
+ 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'),
9703
+ React.createElement("div", { className: 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'))));
9702
9704
  };
9703
9705
  var CommodityComponent = memo(Commodity$1);
9704
9706
 
@@ -9771,14 +9773,14 @@ var interactionRender$5 = [
9771
9773
  ];
9772
9774
 
9773
9775
  const Appoint$1 = (_a) => {
9774
- var _b, _c, _d, _e;
9775
- var { content, style, bgImg, recData, bottom_image, ctaTempStyles, isExternalLink } = _a, props = __rest(_a, ["content", "style", "bgImg", "recData", "bottom_image", "ctaTempStyles", "isExternalLink"]);
9776
+ var _b, _c, _d, _e, _f, _g;
9777
+ var { content, style, bgImg, recData, bottom_image, ctaTempStyles, isExternalLink, index } = _a, props = __rest(_a, ["content", "style", "bgImg", "recData", "bottom_image", "ctaTempStyles", "isExternalLink", "index"]);
9776
9778
  const { sxpParameter } = useSxpDataSource();
9777
9779
  const cta = (_b = recData === null || recData === void 0 ? void 0 : recData.video) === null || _b === void 0 ? void 0 : _b.bindCta;
9778
- return (React.createElement(EventProvider$1, Object.assign({ isExternalLink: isExternalLink, rec: recData, className: css(Object.assign({ alignItems: 'center' }, style)), style: { display: 'flex' } }, props),
9779
- React.createElement("div", { className: css(Object.assign({ overflow: 'hidden', flexShrink: 0, backgroundColor: '#f2f2f2' }, ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.img)) },
9780
- React.createElement("img", { className: 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' })),
9781
- React.createElement("div", { className: 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')));
9780
+ 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;
9781
+ return (React.createElement(EventProvider$1, Object.assign({ isExternalLink: isExternalLink, rec: recData, className: css(Object.assign({ alignItems: 'center' }, style)), style: { display: 'flex' }, index: index }, props),
9782
+ 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 }),
9783
+ React.createElement("div", { className: 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')));
9782
9784
  };
9783
9785
  var AppointComponent = memo(Appoint$1);
9784
9786
 
@@ -9835,7 +9837,7 @@ const Appoint = createMaterial(AppointComponent, {
9835
9837
  var styles$5 = {"tow-line-ellipsis":"index-module_tow-line-ellipsis__nkBlU"};
9836
9838
 
9837
9839
  const Link$1 = (_a) => {
9838
- var _b, _c, _d, _e, _f;
9840
+ var _b, _c, _d, _e, _f, _g, _h;
9839
9841
  var { content, style, bgImg, recData, bottom_image, ctaTempStyles, index } = _a, props = __rest(_a, ["content", "style", "bgImg", "recData", "bottom_image", "ctaTempStyles", "index"]);
9840
9842
  const { sxpParameter, bffEventReport } = useSxpDataSource();
9841
9843
  const { jumpToWeb } = useEventReport();
@@ -9847,16 +9849,16 @@ const Link$1 = (_a) => {
9847
9849
  window.location.href = window.getJointUtmLink(cta.link);
9848
9850
  }
9849
9851
  };
9852
+ 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;
9850
9853
  return (React.createElement(EventProvider$1, Object.assign({ index: index, rec: recData, className: css(Object.assign({ alignItems: 'center' }, style)), style: { display: 'flex' } }, props, { onClick: handleTo }),
9851
- React.createElement("div", { className: css(Object.assign({ backgroundColor: '#f2f2f2', overflow: 'hidden', flexShrink: 0 }, ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.img)) },
9852
- React.createElement(FormatImage$1, { className: 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 })),
9854
+ 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 }),
9853
9855
  React.createElement("div", { className: css({
9854
9856
  display: 'flex',
9855
9857
  alignItems: 'center',
9856
9858
  width: '100%',
9857
9859
  overflow: 'hidden'
9858
9860
  }) },
9859
- 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'))));
9861
+ 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'))));
9860
9862
  };
9861
9863
  var LinkComponent = memo(Link$1);
9862
9864
 
@@ -9924,20 +9926,13 @@ var interactionRender$4 = [
9924
9926
  var styles$4 = {"tow-line-ellipsis":"index-module_tow-line-ellipsis__yyHVb"};
9925
9927
 
9926
9928
  const CommodityDiro$1 = (_a) => {
9927
- var _b, _c, _d, _e, _f, _g, _h, _j;
9928
- var { content, style, bgImg, recData, bottom_image, ctaTempStyles, isExternalLink, translateY = 0 } = _a, props = __rest(_a, ["content", "style", "bgImg", "recData", "bottom_image", "ctaTempStyles", "isExternalLink", "translateY"]);
9929
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
9930
+ 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"]);
9929
9931
  const { sxpParameter } = useSxpDataSource();
9930
9932
  const product = (_b = recData === null || recData === void 0 ? void 0 : recData.video) === null || _b === void 0 ? void 0 : _b.bindProduct;
9931
9933
  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;
9932
- return (React.createElement(EventProvider$1, Object.assign({ isExternalLink: isExternalLink, rec: recData, className: css(Object.assign({}, style)), style: { display: 'flex' } }, props),
9933
- React.createElement("div", { className: css(Object.assign({ overflow: 'hidden', flexShrink: 0, backgroundColor: '#f2f2f2' }, ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.img)) },
9934
- React.createElement(FormatImage$1, { className: css({
9935
- width: '100%',
9936
- objectFit: 'cover',
9937
- height: '100%',
9938
- display: 'block',
9939
- objectPosition: `50% ${translateY ? -translateY + 50 : 50}%`
9940
- }), src: src })),
9934
+ return (React.createElement(EventProvider$1, Object.assign({ isExternalLink: isExternalLink, rec: recData, className: css(Object.assign({}, style)), style: { display: 'flex' }, index: index }, props),
9935
+ 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 }),
9941
9936
  React.createElement("div", { className: css({
9942
9937
  color: '#fff',
9943
9938
  display: 'flex',
@@ -9946,8 +9941,8 @@ const CommodityDiro$1 = (_a) => {
9946
9941
  width: '100%',
9947
9942
  overflow: 'hidden'
9948
9943
  }) },
9949
- 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'),
9950
- React.createElement("div", { className: 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'))));
9944
+ 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'),
9945
+ React.createElement("div", { className: 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'))));
9951
9946
  };
9952
9947
  var CommodityDiroComponent = memo(CommodityDiro$1);
9953
9948
 
@@ -10022,20 +10017,13 @@ var interactionRender$3 = [
10022
10017
  var styles$3 = {"tow-line-ellipsis":"index-module_tow-line-ellipsis__I-yCC"};
10023
10018
 
10024
10019
  const CommodityDiroNew$1 = (_a) => {
10025
- var _b, _c, _d, _e, _f, _g, _h, _j;
10026
- var { content, style, bgImg, recData, bottom_image, ctaTempStyles, isExternalLink, translateY = 0 } = _a, props = __rest(_a, ["content", "style", "bgImg", "recData", "bottom_image", "ctaTempStyles", "isExternalLink", "translateY"]);
10020
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
10021
+ 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"]);
10027
10022
  const { sxpParameter } = useSxpDataSource();
10028
10023
  const product = (_b = recData === null || recData === void 0 ? void 0 : recData.video) === null || _b === void 0 ? void 0 : _b.bindProduct;
10029
10024
  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;
10030
- return (React.createElement(EventProvider$1, Object.assign({ isExternalLink: isExternalLink, rec: recData, className: css(Object.assign({}, style)), style: { display: 'flex' } }, props),
10031
- React.createElement("div", { className: css(Object.assign({ overflow: 'hidden', flexShrink: 0, backgroundColor: '#f2f2f2' }, ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.img)) },
10032
- React.createElement(FormatImage$1, { className: css({
10033
- width: '100%',
10034
- objectFit: 'cover',
10035
- height: '100%',
10036
- display: 'block',
10037
- objectPosition: `50% ${translateY ? -translateY + 50 : 50}%`
10038
- }), src: src })),
10025
+ return (React.createElement(EventProvider$1, Object.assign({ isExternalLink: isExternalLink, rec: recData, className: css(Object.assign({}, style)), style: { display: 'flex' }, index: index }, props),
10026
+ 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 }),
10039
10027
  React.createElement("div", { className: css({
10040
10028
  color: '#fff',
10041
10029
  display: 'flex',
@@ -10044,8 +10032,8 @@ const CommodityDiroNew$1 = (_a) => {
10044
10032
  width: '100%',
10045
10033
  overflow: 'hidden'
10046
10034
  }) },
10047
- 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'),
10048
- React.createElement("div", { className: 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'))));
10035
+ 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'),
10036
+ React.createElement("div", { className: 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'))));
10049
10037
  };
10050
10038
  var CommodityDiroNewComponent = memo(CommodityDiroNew$1);
10051
10039
 
@@ -10123,31 +10111,6 @@ const Scroll = ({ children, isPadding = true }) => {
10123
10111
  };
10124
10112
  var Scroll$1 = memo(Scroll);
10125
10113
 
10126
- /*
10127
- * @Author: binruan@chatlabs.com
10128
- * @Date: 2024-01-16 14:50:13
10129
- * @LastEditors: binruan@chatlabs.com
10130
- * @LastEditTime: 2024-05-21 16:34:13
10131
- * @FilePath: \pb-sxp-ui\src\materials\sxp\template\components\Img.tsx
10132
- *
10133
- */
10134
- const Img = ({ src, rec, item, index, style }) => {
10135
- const ref = useRef(null);
10136
- const isOnScreen = useOnScreen(ref);
10137
- const { ctaEvent } = useSxpDataSource();
10138
- useEffect(() => {
10139
- if (isOnScreen && src && (ref === null || ref === void 0 ? void 0 : ref.current)) {
10140
- ctaEvent === null || ctaEvent === void 0 ? void 0 : ctaEvent({
10141
- eventSubject: 'ctaExposure',
10142
- eventDescription: 'The cta was shown to the user'
10143
- }, rec, item, index);
10144
- }
10145
- }, [isOnScreen, src, ref, rec, ctaEvent, item, index]);
10146
- return (React.createElement("div", { ref: ref, hidden: !src, className: css({ width: '100%', height: '100%' }) },
10147
- React.createElement(FormatImage$1, { className: css(Object.assign({ width: '100%', objectFit: 'cover', height: '100%', display: 'block' }, style)), src: src })));
10148
- };
10149
- var Img$1 = memo(Img);
10150
-
10151
10114
  var styles$2 = {"two-line-ellipsis":"index-module_two-line-ellipsis__SFQwJ"};
10152
10115
 
10153
10116
  const MultiCommodityDiro$1 = (_a) => {
@@ -10175,11 +10138,8 @@ const MultiCommodityDiro$1 = (_a) => {
10175
10138
  }, popup === null || popup === void 0 ? void 0 : popup.duration);
10176
10139
  return (React.createElement(Scroll$1, { isPadding: !!recData }, products === null || products === void 0 ? void 0 : products.map((item) => {
10177
10140
  var _a, _b, _c, _d, _e, _f, _g;
10178
- 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(Object.assign(Object.assign({}, style), { display: 'flex', flexShrink: 0, marginLeft: 0, marginRight: '8px' })) }, props, { onClick: () => handleClick(item) }),
10179
- React.createElement("div", { className: css(Object.assign({ overflow: 'hidden', flexShrink: 0, backgroundColor: '#f2f2f2' }, ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.img)) },
10180
- 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: {
10181
- objectPosition: `50% ${translateY ? -translateY + 50 : 50}%`
10182
- } })),
10141
+ 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(Object.assign(Object.assign({}, style), { display: 'flex', flexShrink: 0, marginLeft: 0, marginRight: '8px' })) }, props, { onClick: () => handleClick(item) }),
10142
+ 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 }),
10183
10143
  React.createElement("div", { className: css({
10184
10144
  color: '#000',
10185
10145
  display: 'flex',
@@ -10189,7 +10149,7 @@ const MultiCommodityDiro$1 = (_a) => {
10189
10149
  overflow: 'hidden'
10190
10150
  }) },
10191
10151
  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'),
10192
- React.createElement("div", { className: 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'))));
10152
+ React.createElement("div", { className: 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'))))));
10193
10153
  })));
10194
10154
  };
10195
10155
  var MultiCommodityDiroComponent = memo(MultiCommodityDiro$1);
@@ -10290,11 +10250,8 @@ const MultiCommodity$1 = (_a) => {
10290
10250
  }, popup === null || popup === void 0 ? void 0 : popup.duration);
10291
10251
  return (React.createElement(Scroll$1, { isPadding: !!recData }, products === null || products === void 0 ? void 0 : products.map((item) => {
10292
10252
  var _a, _b, _c, _d, _e, _f, _g;
10293
- return (React.createElement(SwiperSlide, Object.assign({ hidden: recData && !(item === null || item === void 0 ? void 0 : item.bindCta), key: item.itemId, className: css(Object.assign(Object.assign({}, style), { display: 'flex', flexShrink: 0, marginLeft: 0, marginRight: '8px' })) }, props, { onClick: () => handleClick(item) }),
10294
- React.createElement("div", { className: css(Object.assign({ overflow: 'hidden', flexShrink: 0, backgroundColor: '#f2f2f2' }, ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.img)) },
10295
- 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: {
10296
- objectPosition: `50% ${translateY ? -translateY + 50 : 50}%`
10297
- } })),
10253
+ 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(Object.assign(Object.assign({}, style), { display: 'flex', flexShrink: 0, marginLeft: 0, marginRight: '8px' })) }, props, { onClick: () => handleClick(item) }),
10254
+ 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 }),
10298
10255
  React.createElement("div", { className: css({
10299
10256
  color: '#fff',
10300
10257
  display: 'flex',
@@ -10304,7 +10261,7 @@ const MultiCommodity$1 = (_a) => {
10304
10261
  overflow: 'hidden'
10305
10262
  }) },
10306
10263
  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'),
10307
- React.createElement("div", { className: 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'))));
10264
+ React.createElement("div", { className: 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'))))));
10308
10265
  })));
10309
10266
  };
10310
10267
  var MultiCommodityComponent = memo(MultiCommodity$1);
@@ -10404,11 +10361,8 @@ const MultiCommodityDiroNew$1 = (_a) => {
10404
10361
  }, popup === null || popup === void 0 ? void 0 : popup.duration);
10405
10362
  return (React.createElement(Scroll$1, { isPadding: !!recData }, products === null || products === void 0 ? void 0 : products.map((item) => {
10406
10363
  var _a, _b, _c, _d, _e, _f, _g;
10407
- 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(Object.assign(Object.assign({}, style), { display: 'flex', flexShrink: 0, marginLeft: 0, marginRight: '8px' })) }, props, { onClick: () => handleClick(item) }),
10408
- React.createElement("div", { className: css(Object.assign({ overflow: 'hidden', flexShrink: 0, backgroundColor: '#f2f2f2' }, ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.img)) },
10409
- 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: {
10410
- objectPosition: `50% ${translateY ? -translateY + 50 : 50}%`
10411
- } })),
10364
+ 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(Object.assign(Object.assign({}, style), { display: 'flex', flexShrink: 0, marginLeft: 0, marginRight: '8px' })) }, props, { onClick: () => handleClick(item) }),
10365
+ 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 }),
10412
10366
  React.createElement("div", { className: css({
10413
10367
  color: '#fff',
10414
10368
  display: 'flex',
@@ -10419,7 +10373,7 @@ const MultiCommodityDiroNew$1 = (_a) => {
10419
10373
  lineHeight: '20px'
10420
10374
  }) },
10421
10375
  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'),
10422
- React.createElement("div", { className: 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'))));
10376
+ React.createElement("div", { className: 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'))))));
10423
10377
  })));
10424
10378
  };
10425
10379
  var MultiCommodityDiroNewComponent = memo(MultiCommodityDiroNew$1);
@@ -12926,7 +12880,7 @@ const VideoWidget$2 = ({ rec, index, height, data, muted, activeIndex, videoPost
12926
12880
  useEffect(() => {
12927
12881
  if (!videoRef)
12928
12882
  return;
12929
- videoRef === null || videoRef === void 0 ? void 0 : videoRef.muted(muted);
12883
+ videoRef.muted = muted;
12930
12884
  }, [muted, videoRef]);
12931
12885
  const handleEnded = useCallback(() => {
12932
12886
  if (!videoRef)
@@ -12941,10 +12895,10 @@ const VideoWidget$2 = ({ rec, index, height, data, muted, activeIndex, videoPost
12941
12895
  setIsLoadFinish(true);
12942
12896
  setIsPauseVideo(false);
12943
12897
  const item = data[index];
12944
- if (item && (videoRef === null || videoRef === void 0 ? void 0 : videoRef.duration())) {
12945
- videoStartTime.current = (videoRef === null || videoRef === void 0 ? void 0 : videoRef.currentTime()) || 0;
12946
- const videoDuration = ((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.duration()) !== null && _a !== void 0 ? _a : 0).toFixed(2);
12947
- const videoCurrentTime = ((_b = videoRef === null || videoRef === void 0 ? void 0 : videoRef.currentTime()) !== null && _b !== void 0 ? _b : 0).toFixed(2);
12898
+ if (item && (videoRef === null || videoRef === void 0 ? void 0 : videoRef.duration)) {
12899
+ videoStartTime.current = (videoRef === null || videoRef === void 0 ? void 0 : videoRef.currentTime) || 0;
12900
+ const videoDuration = ((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.duration) !== null && _a !== void 0 ? _a : 0).toFixed(2);
12901
+ const videoCurrentTime = ((_b = videoRef === null || videoRef === void 0 ? void 0 : videoRef.currentTime) !== null && _b !== void 0 ? _b : 0).toFixed(2);
12948
12902
  const playType = isFirstPlay ? '0' : '1';
12949
12903
  bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
12950
12904
  eventInfo: {
@@ -12968,21 +12922,17 @@ const VideoWidget$2 = ({ rec, index, height, data, muted, activeIndex, videoPost
12968
12922
  var _a;
12969
12923
  if (!videoRef || firstFrameSrc || !blur)
12970
12924
  return;
12971
- const videoDomRef = document.getElementById('player-container-id_html5_api');
12972
- if (!videoDomRef)
12973
- return;
12974
- videoDomRef.style.objectFit = 'contain';
12925
+ videoRef.style.objectFit = 'contain';
12975
12926
  if (((_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.cover) || !canvasRef || !canvasRef.current || isBgColor)
12976
12927
  return;
12977
12928
  const setFrameImg = () => {
12978
- const video = videoDomRef;
12979
12929
  const canvas = canvasRef === null || canvasRef === void 0 ? void 0 : canvasRef.current;
12980
12930
  const ctx = canvas.getContext('2d');
12981
12931
  const targetWidth = window === null || window === void 0 ? void 0 : window.innerWidth;
12982
12932
  const targetHeight = window === null || window === void 0 ? void 0 : window.innerHeight;
12983
12933
  canvas.height = targetHeight;
12984
12934
  canvas.width = targetWidth;
12985
- ctx === null || ctx === void 0 ? void 0 : ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
12935
+ ctx === null || ctx === void 0 ? void 0 : ctx.drawImage(videoRef, 0, 0, canvas.width, canvas.height);
12986
12936
  setFirstFrameSrc(canvas.toDataURL());
12987
12937
  };
12988
12938
  setFrameImg();
@@ -12994,21 +12944,13 @@ const VideoWidget$2 = ({ rec, index, height, data, muted, activeIndex, videoPost
12994
12944
  if (!videoRef)
12995
12945
  return;
12996
12946
  handLoadeddata();
12997
- // if (activeIndex !== index) {
12998
- // videoRef?.play();
12999
- // videoRef?.pause();
13000
- // }
13001
- // setIsLoadFinish(true);
13002
12947
  }, [videoRef, handLoadeddata]);
13003
- useCallback(() => {
13004
- setIsLoadFinish(true);
13005
- }, []);
13006
12948
  const handleClickVideo = useCallback((type) => () => {
13007
12949
  if (!videoRef)
13008
12950
  return;
13009
12951
  if (!isLoadFinish)
13010
12952
  return;
13011
- const isPause = videoRef === null || videoRef === void 0 ? void 0 : videoRef.paused();
12953
+ const isPause = videoRef === null || videoRef === void 0 ? void 0 : videoRef.paused;
13012
12954
  switch (type) {
13013
12955
  case 'start':
13014
12956
  if (!isPause)
@@ -13040,10 +12982,10 @@ const VideoWidget$2 = ({ rec, index, height, data, muted, activeIndex, videoPost
13040
12982
  if (activeIndex !== index)
13041
12983
  return;
13042
12984
  const item = data[index];
13043
- const videoDuration = ((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.duration()) !== null && _a !== void 0 ? _a : 0).toFixed(2);
13044
- const videoCurrentTime = ((_b = videoRef === null || videoRef === void 0 ? void 0 : videoRef.currentTime()) !== null && _b !== void 0 ? _b : 0).toFixed(2);
13045
- if (videoRef === null || videoRef === void 0 ? void 0 : videoRef.duration()) {
13046
- const playDuration = ((videoRef === null || videoRef === void 0 ? void 0 : videoRef.currentTime()) - videoStartTime.current).toFixed(2);
12985
+ const videoDuration = ((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.duration) !== null && _a !== void 0 ? _a : 0).toFixed(2);
12986
+ const videoCurrentTime = ((_b = videoRef === null || videoRef === void 0 ? void 0 : videoRef.currentTime) !== null && _b !== void 0 ? _b : 0).toFixed(2);
12987
+ if (videoRef === null || videoRef === void 0 ? void 0 : videoRef.duration) {
12988
+ const playDuration = ((videoRef === null || videoRef === void 0 ? void 0 : videoRef.currentTime) - videoStartTime.current).toFixed(2);
13047
12989
  bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
13048
12990
  eventInfo: {
13049
12991
  eventSubject: 'playOverVideo',
@@ -13067,7 +13009,19 @@ const VideoWidget$2 = ({ rec, index, height, data, muted, activeIndex, videoPost
13067
13009
  const videoSrc = rec === null || rec === void 0 ? void 0 : rec.video.url;
13068
13010
  if (!videoSrc)
13069
13011
  return;
13070
- videoRef === null || videoRef === void 0 ? void 0 : videoRef.src(videoSrc);
13012
+ if (videoSrc.includes('.m3u8')) {
13013
+ if (Hls.isSupported()) {
13014
+ const hls = new Hls();
13015
+ hls.loadSource(videoSrc);
13016
+ hls.attachMedia(videoRef);
13017
+ }
13018
+ else {
13019
+ videoRef.src = videoSrc;
13020
+ }
13021
+ }
13022
+ else {
13023
+ videoRef.src = videoSrc;
13024
+ }
13071
13025
  setIsPauseVideo(false);
13072
13026
  const videoPlayerWrapperNode = document.querySelector(`#${videoId}`);
13073
13027
  const dom = document.querySelector('#player-container-id');
@@ -13075,20 +13029,20 @@ const VideoWidget$2 = ({ rec, index, height, data, muted, activeIndex, videoPost
13075
13029
  if (!dom && !dom2)
13076
13030
  return;
13077
13031
  videoPlayerWrapperNode === null || videoPlayerWrapperNode === void 0 ? void 0 : videoPlayerWrapperNode.appendChild(dom || dom2);
13078
- videoRef === null || videoRef === void 0 ? void 0 : videoRef.on('loadedmetadata', handleLoadedmetadata);
13079
- videoRef === null || videoRef === void 0 ? void 0 : videoRef.on('loadeddata', handLoadeddata);
13080
- // videoRef?.on('canplay', handleCanplay);
13081
- videoRef === null || videoRef === void 0 ? void 0 : videoRef.on('playing', handlePlaying);
13082
- videoRef === null || videoRef === void 0 ? void 0 : videoRef.on('pause', handlePause);
13083
- videoRef === null || videoRef === void 0 ? void 0 : videoRef.on('ended', handleEnded);
13032
+ videoRef.setAttribute('x5-playsinline', 'true');
13033
+ videoRef.setAttribute('webkit-playsinline', 'true');
13034
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.addEventListener('loadedmetadata', handleLoadedmetadata);
13035
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.addEventListener('loadeddata', handLoadeddata);
13036
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.addEventListener('playing', handlePlaying);
13037
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.addEventListener('pause', handlePause);
13038
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.addEventListener('ended', handleEnded);
13084
13039
  return () => {
13085
13040
  dom2 === null || dom2 === void 0 ? void 0 : dom2.appendChild(dom);
13086
- videoRef === null || videoRef === void 0 ? void 0 : videoRef.off('loadedmetadata', handleLoadedmetadata);
13087
- videoRef === null || videoRef === void 0 ? void 0 : videoRef.off('loadeddata', handLoadeddata);
13088
- // videoRef?.off('canplay', handleCanplay);
13089
- videoRef === null || videoRef === void 0 ? void 0 : videoRef.off('playing', handlePlaying);
13090
- videoRef === null || videoRef === void 0 ? void 0 : videoRef.off('pause', handlePause);
13091
- videoRef === null || videoRef === void 0 ? void 0 : videoRef.off('ended', handleEnded);
13041
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.removeEventListener('loadedmetadata', handleLoadedmetadata);
13042
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.removeEventListener('loadeddata', handLoadeddata);
13043
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.removeEventListener('playing', handlePlaying);
13044
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.removeEventListener('pause', handlePause);
13045
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.removeEventListener('ended', handleEnded);
13092
13046
  };
13093
13047
  }, [isActive, videoId, rec, videoRef]);
13094
13048
  useEffect(() => {
@@ -13110,7 +13064,7 @@ const VideoWidget$2 = ({ rec, index, height, data, muted, activeIndex, videoPost
13110
13064
  useEffect(() => {
13111
13065
  if (!isActive || !videoRef)
13112
13066
  return;
13113
- const isPause = videoRef === null || videoRef === void 0 ? void 0 : videoRef.paused();
13067
+ const isPause = videoRef === null || videoRef === void 0 ? void 0 : videoRef.paused;
13114
13068
  if (!isPause && openHashtag) {
13115
13069
  videoRef === null || videoRef === void 0 ? void 0 : videoRef.pause();
13116
13070
  }
@@ -13553,7 +13507,7 @@ var Tagbar$1 = memo(Tagbar);
13553
13507
  * @Author: binruan@chatlabs.com
13554
13508
  * @Date: 2024-01-15 19:03:09
13555
13509
  * @LastEditors: binruan@chatlabs.com
13556
- * @LastEditTime: 2024-06-20 15:54:53
13510
+ * @LastEditTime: 2024-06-21 08:56:05
13557
13511
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\index.tsx
13558
13512
  *
13559
13513
  */
@@ -13569,8 +13523,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
13569
13523
  const [isShowMore, setIsShowMore] = useState(false);
13570
13524
  const { loadVideos, bffEventReport, loading, setPopupDetailData, ctaEvent, swiperRef, waterFallData, setOpenHashtag, appDomain, openHashtag, loadingImage, isFromHashtag, popupDetailData, bffFbReport, curTime, h5EnterLink, isShowConsent, selectTag } = useSxpDataSource();
13571
13525
  const { backMainFeed } = useEventReport();
13572
- const [videoRef, setVideoRef] = useState(null);
13573
- const playerRef = useRef();
13526
+ const videoRef = useRef();
13574
13527
  const { productView } = useEventReport();
13575
13528
  const isShowFingerTip = useMemo(() => {
13576
13529
  return data.length > 0 && !loading && getFeUserId();
@@ -13601,30 +13554,13 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
13601
13554
  const firstRef = useRef();
13602
13555
  useEffect(() => {
13603
13556
  var _a, _b, _c, _d;
13604
- if (!firstRef.current && !videoRef && (playerRef === null || playerRef === void 0 ? void 0 : playerRef.current) && (data === null || data === void 0 ? void 0 : data.length) > 0) {
13557
+ if (!firstRef.current && (videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) && (data === null || data === void 0 ? void 0 : data.length) > 0) {
13605
13558
  firstRef.current = true;
13606
- const player = TCPlayer('player-container-id', {
13607
- licenseUrl, // license 地址,参考准备工作部分,在视立方控制台申请 license 后可获得 licenseUrl
13608
- controls: false,
13609
- loop: false,
13610
- autoplay: true,
13611
- muted: true,
13612
- preload: 'auto',
13613
- posterImage: false,
13614
- bigPlayButton: true,
13615
- 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)
13616
- ? [
13617
- {
13618
- 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
13619
- }
13620
- ]
13621
- : []
13622
- });
13623
- player === null || player === void 0 ? void 0 : player.ready(() => {
13624
- setVideoRef(player);
13625
- });
13559
+ 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) {
13560
+ 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;
13561
+ }
13626
13562
  }
13627
- }, [videoRef, licenseUrl, data]);
13563
+ }, [videoRef, data]);
13628
13564
  useEffect(() => {
13629
13565
  var _a;
13630
13566
  const index = (data === null || data === void 0 ? void 0 : data.findIndex((item) => {
@@ -13742,7 +13678,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
13742
13678
  const renderContent = useCallback((rec, index) => {
13743
13679
  var _a, _b, _c, _d;
13744
13680
  if ((_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.url) {
13745
- 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 }));
13681
+ 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 }));
13746
13682
  }
13747
13683
  if ((_b = rec === null || rec === void 0 ? void 0 : rec.video) === null || _b === void 0 ? void 0 : _b.imgUrls) {
13748
13684
  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 }));
@@ -13768,7 +13704,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
13768
13704
  tipText,
13769
13705
  resolver,
13770
13706
  schema,
13771
- videoRef
13707
+ videoRef.current
13772
13708
  ]);
13773
13709
  const onExpandableChange = useCallback((v) => {
13774
13710
  setIsShowMore(v);
@@ -13926,14 +13862,17 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
13926
13862
  }
13927
13863
  };
13928
13864
  const visList = useMemo(() => {
13929
- const list = data === null || data === void 0 ? void 0 : data.map((item, index) => {
13930
- if (activeIndex === index || index - 1 === activeIndex || index + 1 === activeIndex) {
13931
- return item;
13932
- }
13933
- else {
13934
- return null;
13935
- }
13936
- });
13865
+ var _a;
13866
+ const list = activeIndex === 0
13867
+ ? [(_a = data === null || data === void 0 ? void 0 : data[0]) !== null && _a !== void 0 ? _a : null]
13868
+ : data === null || data === void 0 ? void 0 : data.map((item, index) => {
13869
+ if (activeIndex === index || index - 1 === activeIndex || index + 1 === activeIndex) {
13870
+ return item;
13871
+ }
13872
+ else {
13873
+ return null;
13874
+ }
13875
+ });
13937
13876
  return !waterFallData ? list.concat([{ loading: true }]) : list;
13938
13877
  }, [data, activeIndex, waterFallData]);
13939
13878
  const renderView = useMemo(() => {
@@ -13998,7 +13937,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
13998
13937
  renderView),
13999
13938
  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)),
14000
13939
  React.createElement("div", { style: { position: 'absolute', zIndex: -100 } },
14001
- React.createElement("video", { ref: playerRef, id: 'player-container-id', playsInline: true, crossOrigin: 'anonymous', style: {
13940
+ React.createElement("video", { ref: videoRef, id: 'player-container-id', playsInline: true, crossOrigin: 'anonymous', preload: 'auto', controls: false, muted: true, style: {
14002
13941
  backgroundColor: 'transparent',
14003
13942
  width: '100%',
14004
13943
  height: '100%',
@@ -14521,3 +14460,4 @@ function useEditorDataProvider() {
14521
14460
  */
14522
14461
 
14523
14462
  export { index$1 as DiyPortalPreview, EditorDataProvider, Modal$1 as Modal, SxpDataSourceProvider$1 as SxpDataSourceProvider, index as SxpPageCore, SxpPageRender, index$2 as core, Pagebuilder as default, defaultSetting, _materials_ as materials, useEditorDataProvider };
14463
+ //# sourceMappingURL=index.js.map