pb-sxp-ui 1.0.87 → 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 (45) hide show
  1. package/dist/index.cjs +297 -353
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.js +298 -354
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.min.cjs +3 -3
  6. package/dist/index.min.cjs.map +1 -1
  7. package/dist/index.min.js +3 -3
  8. package/dist/index.min.js.map +1 -1
  9. package/dist/pb-ui.js +300 -356
  10. package/dist/pb-ui.js.map +1 -1
  11. package/dist/pb-ui.min.js +3 -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 +78 -91
  16. package/es/core/context/SxpDataSourceProvider.js +19 -16
  17. package/es/materials/sxp/popup/AppointForm/index.js +1 -3
  18. package/es/materials/sxp/template/Appoint/index.js +7 -6
  19. package/es/materials/sxp/template/Commodity/index.js +7 -14
  20. package/es/materials/sxp/template/CommodityDiro/index.js +7 -14
  21. package/es/materials/sxp/template/CommodityDiroNew/index.js +7 -14
  22. package/es/materials/sxp/template/Link/index.js +5 -5
  23. package/es/materials/sxp/template/MultiCommodity/index.js +3 -6
  24. package/es/materials/sxp/template/MultiCommodityDiro/index.js +3 -6
  25. package/es/materials/sxp/template/MultiCommodityDiroNew/index.js +3 -6
  26. package/es/materials/sxp/template/components/EventProvider.js +1 -13
  27. package/es/materials/sxp/template/components/Img.d.ts +5 -3
  28. package/es/materials/sxp/template/components/Img.js +4 -3
  29. package/lib/core/components/SxpPageRender/FormatImage.js +2 -7
  30. package/lib/core/components/SxpPageRender/VideoWidget/index.js +39 -31
  31. package/lib/core/components/SxpPageRender/index.js +78 -91
  32. package/lib/core/context/SxpDataSourceProvider.js +19 -16
  33. package/lib/materials/sxp/popup/AppointForm/index.js +1 -3
  34. package/lib/materials/sxp/template/Appoint/index.js +7 -6
  35. package/lib/materials/sxp/template/Commodity/index.js +7 -14
  36. package/lib/materials/sxp/template/CommodityDiro/index.js +7 -14
  37. package/lib/materials/sxp/template/CommodityDiroNew/index.js +7 -14
  38. package/lib/materials/sxp/template/Link/index.js +5 -5
  39. package/lib/materials/sxp/template/MultiCommodity/index.js +3 -6
  40. package/lib/materials/sxp/template/MultiCommodityDiro/index.js +3 -6
  41. package/lib/materials/sxp/template/MultiCommodityDiroNew/index.js +3 -6
  42. package/lib/materials/sxp/template/components/EventProvider.js +0 -12
  43. package/lib/materials/sxp/template/components/Img.d.ts +5 -3
  44. package/lib/materials/sxp/template/components/Img.js +4 -3
  45. package/package.json +2 -4
@@ -4,22 +4,15 @@ import React, { memo } from 'react';
4
4
  import EventProvider from '../components/EventProvider';
5
5
  import styles from './index.module.less';
6
6
  import { useSxpDataSource } from '../../../../core/hooks';
7
- import FormatImage from '../../../../core/components/SxpPageRender/FormatImage';
7
+ import Img from '../components/Img';
8
8
  const CommodityDiro = (_a) => {
9
- var _b, _c, _d, _e, _f, _g, _h, _j;
10
- var { content, style, bgImg, recData, bottom_image, ctaTempStyles, isExternalLink, translateY = 0 } = _a, props = __rest(_a, ["content", "style", "bgImg", "recData", "bottom_image", "ctaTempStyles", "isExternalLink", "translateY"]);
9
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
10
+ 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"]);
11
11
  const { sxpParameter } = useSxpDataSource();
12
12
  const product = (_b = recData === null || recData === void 0 ? void 0 : recData.video) === null || _b === void 0 ? void 0 : _b.bindProduct;
13
13
  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;
14
- return (React.createElement(EventProvider, Object.assign({ isExternalLink: isExternalLink, rec: recData, className: css(Object.assign({}, style)), style: { display: 'flex' } }, props),
15
- React.createElement("div", { className: css(Object.assign({ overflow: 'hidden', flexShrink: 0, backgroundColor: '#f2f2f2' }, ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.img)) },
16
- React.createElement(FormatImage, { className: css({
17
- width: '100%',
18
- objectFit: 'cover',
19
- height: '100%',
20
- display: 'block',
21
- objectPosition: `50% ${translateY ? -translateY + 50 : 50}%`
22
- }), src: src })),
14
+ return (React.createElement(EventProvider, Object.assign({ isExternalLink: isExternalLink, rec: recData, className: css(Object.assign({}, style)), style: { display: 'flex' }, index: index }, props),
15
+ React.createElement(Img, { 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 }),
23
16
  React.createElement("div", { className: css({
24
17
  color: '#fff',
25
18
  display: 'flex',
@@ -28,7 +21,7 @@ const CommodityDiro = (_a) => {
28
21
  width: '100%',
29
22
  overflow: 'hidden'
30
23
  }) },
31
- React.createElement("div", { className: styles['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'),
32
- 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'))));
24
+ React.createElement("div", { className: styles['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'),
25
+ 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'))));
33
26
  };
34
27
  export default memo(CommodityDiro);
@@ -4,22 +4,15 @@ import React, { memo } from 'react';
4
4
  import EventProvider from '../components/EventProvider';
5
5
  import styles from './index.module.less';
6
6
  import { useSxpDataSource } from '../../../../core/hooks';
7
- import FormatImage from '../../../../core/components/SxpPageRender/FormatImage';
7
+ import Img from '../components/Img';
8
8
  const CommodityDiroNew = (_a) => {
9
- var _b, _c, _d, _e, _f, _g, _h, _j;
10
- var { content, style, bgImg, recData, bottom_image, ctaTempStyles, isExternalLink, translateY = 0 } = _a, props = __rest(_a, ["content", "style", "bgImg", "recData", "bottom_image", "ctaTempStyles", "isExternalLink", "translateY"]);
9
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
10
+ 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"]);
11
11
  const { sxpParameter } = useSxpDataSource();
12
12
  const product = (_b = recData === null || recData === void 0 ? void 0 : recData.video) === null || _b === void 0 ? void 0 : _b.bindProduct;
13
13
  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;
14
- return (React.createElement(EventProvider, Object.assign({ isExternalLink: isExternalLink, rec: recData, className: css(Object.assign({}, style)), style: { display: 'flex' } }, props),
15
- React.createElement("div", { className: css(Object.assign({ overflow: 'hidden', flexShrink: 0, backgroundColor: '#f2f2f2' }, ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.img)) },
16
- React.createElement(FormatImage, { className: css({
17
- width: '100%',
18
- objectFit: 'cover',
19
- height: '100%',
20
- display: 'block',
21
- objectPosition: `50% ${translateY ? -translateY + 50 : 50}%`
22
- }), src: src })),
14
+ return (React.createElement(EventProvider, Object.assign({ isExternalLink: isExternalLink, rec: recData, className: css(Object.assign({}, style)), style: { display: 'flex' }, index: index }, props),
15
+ React.createElement(Img, { 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 }),
23
16
  React.createElement("div", { className: css({
24
17
  color: '#fff',
25
18
  display: 'flex',
@@ -28,7 +21,7 @@ const CommodityDiroNew = (_a) => {
28
21
  width: '100%',
29
22
  overflow: 'hidden'
30
23
  }) },
31
- React.createElement("div", { className: styles['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'),
32
- 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'))));
24
+ React.createElement("div", { className: styles['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'),
25
+ 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'))));
33
26
  };
34
27
  export default memo(CommodityDiroNew);
@@ -5,9 +5,9 @@ import EventProvider from '../components/EventProvider';
5
5
  import styles from './index.module.less';
6
6
  import { useSxpDataSource } from '../../../../core/hooks';
7
7
  import { useEventReport } from '../../../../core/hooks/useEventReport';
8
- import FormatImage from '../../../../core/components/SxpPageRender/FormatImage';
8
+ import Img from '../components/Img';
9
9
  const Link = (_a) => {
10
- var _b, _c, _d, _e, _f;
10
+ var _b, _c, _d, _e, _f, _g, _h;
11
11
  var { content, style, bgImg, recData, bottom_image, ctaTempStyles, index } = _a, props = __rest(_a, ["content", "style", "bgImg", "recData", "bottom_image", "ctaTempStyles", "index"]);
12
12
  const { sxpParameter, bffEventReport } = useSxpDataSource();
13
13
  const { jumpToWeb } = useEventReport();
@@ -19,15 +19,15 @@ const Link = (_a) => {
19
19
  window.location.href = window.getJointUtmLink(cta.link);
20
20
  }
21
21
  };
22
+ 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;
22
23
  return (React.createElement(EventProvider, Object.assign({ index: index, rec: recData, className: css(Object.assign({ alignItems: 'center' }, style)), style: { display: 'flex' } }, props, { onClick: handleTo }),
23
- React.createElement("div", { className: css(Object.assign({ backgroundColor: '#f2f2f2', overflow: 'hidden', flexShrink: 0 }, ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.img)) },
24
- React.createElement(FormatImage, { 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 })),
24
+ React.createElement(Img, { 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 }),
25
25
  React.createElement("div", { className: css({
26
26
  display: 'flex',
27
27
  alignItems: 'center',
28
28
  width: '100%',
29
29
  overflow: 'hidden'
30
30
  }) },
31
- React.createElement("div", { className: styles['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'))));
31
+ React.createElement("div", { className: styles['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'))));
32
32
  };
33
33
  export default memo(Link);
@@ -34,11 +34,8 @@ const MultiCommodity = (_a) => {
34
34
  }, popup === null || popup === void 0 ? void 0 : popup.duration);
35
35
  return (React.createElement(Scroll, { isPadding: !!recData }, products === null || products === void 0 ? void 0 : products.map((item) => {
36
36
  var _a, _b, _c, _d, _e, _f, _g;
37
- 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) }),
38
- React.createElement("div", { className: css(Object.assign({ overflow: 'hidden', flexShrink: 0, backgroundColor: '#f2f2f2' }, ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.img)) },
39
- React.createElement(Img, { 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: {
40
- objectPosition: `50% ${translateY ? -translateY + 50 : 50}%`
41
- } })),
37
+ 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) }),
38
+ React.createElement(Img, { 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 }),
42
39
  React.createElement("div", { className: css({
43
40
  color: '#fff',
44
41
  display: 'flex',
@@ -48,7 +45,7 @@ const MultiCommodity = (_a) => {
48
45
  overflow: 'hidden'
49
46
  }) },
50
47
  React.createElement("div", { className: styles['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'),
51
- 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'))));
48
+ 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'))))));
52
49
  })));
53
50
  };
54
51
  export default memo(MultiCommodity);
@@ -33,11 +33,8 @@ const MultiCommodityDiro = (_a) => {
33
33
  }, popup === null || popup === void 0 ? void 0 : popup.duration);
34
34
  return (React.createElement(Scroll, { isPadding: !!recData }, products === null || products === void 0 ? void 0 : products.map((item) => {
35
35
  var _a, _b, _c, _d, _e, _f, _g;
36
- 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) }),
37
- React.createElement("div", { className: css(Object.assign({ overflow: 'hidden', flexShrink: 0, backgroundColor: '#f2f2f2' }, ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.img)) },
38
- React.createElement(Img, { 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: {
39
- objectPosition: `50% ${translateY ? -translateY + 50 : 50}%`
40
- } })),
36
+ 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) }),
37
+ React.createElement(Img, { 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 }),
41
38
  React.createElement("div", { className: css({
42
39
  color: '#000',
43
40
  display: 'flex',
@@ -47,7 +44,7 @@ const MultiCommodityDiro = (_a) => {
47
44
  overflow: 'hidden'
48
45
  }) },
49
46
  React.createElement("div", { className: styles['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'),
50
- 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'))));
47
+ 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'))))));
51
48
  })));
52
49
  };
53
50
  export default memo(MultiCommodityDiro);
@@ -33,11 +33,8 @@ const MultiCommodityDiroNew = (_a) => {
33
33
  }, popup === null || popup === void 0 ? void 0 : popup.duration);
34
34
  return (React.createElement(Scroll, { isPadding: !!recData }, products === null || products === void 0 ? void 0 : products.map((item) => {
35
35
  var _a, _b, _c, _d, _e, _f, _g;
36
- 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) }),
37
- React.createElement("div", { className: css(Object.assign({ overflow: 'hidden', flexShrink: 0, backgroundColor: '#f2f2f2' }, ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.img)) },
38
- React.createElement(Img, { 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: {
39
- objectPosition: `50% ${translateY ? -translateY + 50 : 50}%`
40
- } })),
36
+ 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) }),
37
+ React.createElement(Img, { 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 }),
41
38
  React.createElement("div", { className: css({
42
39
  color: '#fff',
43
40
  display: 'flex',
@@ -48,7 +45,7 @@ const MultiCommodityDiroNew = (_a) => {
48
45
  lineHeight: '20px'
49
46
  }) },
50
47
  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'),
51
- 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'))));
48
+ 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'))))));
52
49
  })));
53
50
  };
54
51
  export default memo(MultiCommodityDiroNew);
@@ -1,26 +1,14 @@
1
1
  import { __rest } from "tslib";
2
- import React, { memo, useEffect, useRef } from 'react';
2
+ import React, { memo, useRef } from 'react';
3
3
  import { throttle } from 'lodash';
4
- import useOnScreen from '../../../../core/hooks/useOnScreen';
5
4
  import { useEditor, useSxpDataSource } from '../../../../core/hooks';
6
5
  import { useEventReport } from '../../../../core/hooks/useEventReport';
7
6
  const EventProvider = (_a) => {
8
7
  var { rec, children, className, onClick, style, isExternalLink = false, index } = _a, props = __rest(_a, ["rec", "children", "className", "onClick", "style", "isExternalLink", "index"]);
9
8
  const ref = useRef(null);
10
- const isOnScreen = useOnScreen(ref);
11
9
  const { popup } = useEditor();
12
10
  const { setPopupDetailData, ctaEvent } = useSxpDataSource();
13
11
  const { jumpToWeb } = useEventReport();
14
- useEffect(() => {
15
- var _a, _b;
16
- if (isOnScreen && (ref === null || ref === void 0 ? void 0 : ref.current)) {
17
- 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;
18
- ctaEvent === null || ctaEvent === void 0 ? void 0 : ctaEvent({
19
- eventSubject: 'ctaExposure',
20
- eventDescription: 'The cta was shown to the user'
21
- }, rec, item, index);
22
- }
23
- }, [isOnScreen, ref, rec, ctaEvent, index]);
24
12
  const handleClick = throttle(() => {
25
13
  var _a, _b, _c, _d, _e, _f, _g, _h;
26
14
  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;
@@ -1,11 +1,13 @@
1
1
  import React, { CSSProperties } from 'react';
2
- import { ProductInfoType, RecItemType } from '../../../../core/components/SxpPageRender/typing';
2
+ import { ProductInfoType, RecItemType, VideoInfoType } from '../../../../core/components/SxpPageRender/typing';
3
3
  export interface IImgProps {
4
- src: string;
4
+ src?: string;
5
5
  rec?: RecItemType;
6
- item?: ProductInfoType;
6
+ item?: ProductInfoType | VideoInfoType | null;
7
7
  index?: number;
8
8
  style?: CSSProperties;
9
+ translateY?: number;
10
+ imgStyle?: CSSProperties;
9
11
  }
10
12
  declare const _default: React.NamedExoticComponent<IImgProps>;
11
13
  export default _default;
@@ -3,7 +3,7 @@ import React, { memo, useEffect, useRef } from 'react';
3
3
  import useOnScreen from '../../../../core/hooks/useOnScreen';
4
4
  import { useSxpDataSource } from '../../../../core/hooks';
5
5
  import FormatImage from '../../../../core/components/SxpPageRender/FormatImage';
6
- const Img = ({ src, rec, item, index, style }) => {
6
+ const Img = ({ src, rec, item, index, style, translateY, imgStyle }) => {
7
7
  const ref = useRef(null);
8
8
  const isOnScreen = useOnScreen(ref);
9
9
  const { ctaEvent } = useSxpDataSource();
@@ -15,7 +15,8 @@ const Img = ({ src, rec, item, index, style }) => {
15
15
  }, rec, item, index);
16
16
  }
17
17
  }, [isOnScreen, src, ref, rec, ctaEvent, item, index]);
18
- return (React.createElement("div", { ref: ref, hidden: !src, className: css({ width: '100%', height: '100%' }) },
19
- React.createElement(FormatImage, { className: css(Object.assign({ width: '100%', objectFit: 'cover', height: '100%', display: 'block' }, style)), src: src })));
18
+ return (React.createElement("div", { className: css(Object.assign({ overflow: 'hidden', flexShrink: 0, backgroundColor: '#f2f2f2' }, imgStyle)) },
19
+ React.createElement("div", { ref: ref, hidden: !src, className: css({ width: '100%', height: '100%' }) },
20
+ React.createElement(FormatImage, { className: css(Object.assign({ width: '100%', objectFit: 'cover', height: '100%', display: 'block', objectPosition: `50% ${translateY ? -translateY + 50 : 50}%` }, style)), src: `${src}?imrquality/rquality/40` }))));
20
21
  };
21
22
  export default memo(Img);
@@ -2,22 +2,17 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  const react_1 = tslib_1.__importStar(require("react"));
5
- const hooks_1 = require("../../../core/hooks");
6
5
  const FormatImage = (0, react_1.forwardRef)((props, ref) => {
7
6
  const { src, onLoad, style, className, loading } = props;
8
7
  const [imgSrc, setImgSrc] = (0, react_1.useState)();
9
- const { swiperRef } = (0, hooks_1.useSxpDataSource)();
10
8
  (0, react_1.useImperativeHandle)(ref, () => ({
11
9
  setSrc: (v) => {
12
10
  setImgSrc(v);
13
11
  }
14
12
  }));
15
13
  (0, react_1.useEffect)(() => {
16
- var _a, _b;
17
- 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;
18
- if (index === 0 || index > 0)
19
- setImgSrc(src);
20
- }, [src, swiperRef]);
14
+ setImgSrc(src);
15
+ }, [src]);
21
16
  const imgRef = (0, react_1.useRef)(null);
22
17
  return (react_1.default.createElement(react_1.default.Fragment, null, (imgSrc === null || imgSrc === void 0 ? void 0 : imgSrc.includes('.avif')) ? (react_1.default.createElement("picture", null,
23
18
  react_1.default.createElement("source", { type: 'image/avif', srcSet: imgSrc }),
@@ -7,6 +7,7 @@ const useIconLink_1 = require("../useIconLink");
7
7
  const FormatImage_1 = tslib_1.__importDefault(require("../FormatImage"));
8
8
  const hooks_1 = require("../../../../core/hooks");
9
9
  const event_1 = tslib_1.__importStar(require("../../../../core/utils/event"));
10
+ const hls_js_1 = tslib_1.__importDefault(require("hls.js"));
10
11
  const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostConfig, videoRef }) => {
11
12
  const [isPauseVideo, setIsPauseVideo] = (0, react_1.useState)(false);
12
13
  const { bffEventReport, sxpParameter, waterFallData, openHashtag, bffFbReport } = (0, hooks_1.useSxpDataSource)();
@@ -48,7 +49,7 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
48
49
  (0, react_1.useEffect)(() => {
49
50
  if (!videoRef)
50
51
  return;
51
- videoRef === null || videoRef === void 0 ? void 0 : videoRef.muted(muted);
52
+ videoRef.muted = muted;
52
53
  }, [muted, videoRef]);
53
54
  const handleEnded = (0, react_1.useCallback)(() => {
54
55
  if (!videoRef)
@@ -63,10 +64,10 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
63
64
  setIsLoadFinish(true);
64
65
  setIsPauseVideo(false);
65
66
  const item = data[index];
66
- if (item && (videoRef === null || videoRef === void 0 ? void 0 : videoRef.duration())) {
67
- videoStartTime.current = (videoRef === null || videoRef === void 0 ? void 0 : videoRef.currentTime()) || 0;
68
- const videoDuration = ((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.duration()) !== null && _a !== void 0 ? _a : 0).toFixed(2);
69
- const videoCurrentTime = ((_b = videoRef === null || videoRef === void 0 ? void 0 : videoRef.currentTime()) !== null && _b !== void 0 ? _b : 0).toFixed(2);
67
+ if (item && (videoRef === null || videoRef === void 0 ? void 0 : videoRef.duration)) {
68
+ videoStartTime.current = (videoRef === null || videoRef === void 0 ? void 0 : videoRef.currentTime) || 0;
69
+ const videoDuration = ((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.duration) !== null && _a !== void 0 ? _a : 0).toFixed(2);
70
+ const videoCurrentTime = ((_b = videoRef === null || videoRef === void 0 ? void 0 : videoRef.currentTime) !== null && _b !== void 0 ? _b : 0).toFixed(2);
70
71
  const playType = isFirstPlay ? '0' : '1';
71
72
  bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
72
73
  eventInfo: {
@@ -90,21 +91,17 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
90
91
  var _a;
91
92
  if (!videoRef || firstFrameSrc || !blur)
92
93
  return;
93
- const videoDomRef = document.getElementById('player-container-id_html5_api');
94
- if (!videoDomRef)
95
- return;
96
- videoDomRef.style.objectFit = 'contain';
94
+ videoRef.style.objectFit = 'contain';
97
95
  if (((_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.cover) || !canvasRef || !canvasRef.current || isBgColor)
98
96
  return;
99
97
  const setFrameImg = () => {
100
- const video = videoDomRef;
101
98
  const canvas = canvasRef === null || canvasRef === void 0 ? void 0 : canvasRef.current;
102
99
  const ctx = canvas.getContext('2d');
103
100
  const targetWidth = window === null || window === void 0 ? void 0 : window.innerWidth;
104
101
  const targetHeight = window === null || window === void 0 ? void 0 : window.innerHeight;
105
102
  canvas.height = targetHeight;
106
103
  canvas.width = targetWidth;
107
- ctx === null || ctx === void 0 ? void 0 : ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
104
+ ctx === null || ctx === void 0 ? void 0 : ctx.drawImage(videoRef, 0, 0, canvas.width, canvas.height);
108
105
  setFirstFrameSrc(canvas.toDataURL());
109
106
  };
110
107
  setFrameImg();
@@ -117,15 +114,12 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
117
114
  return;
118
115
  handLoadeddata();
119
116
  }, [videoRef, handLoadeddata]);
120
- const handleCanplay = (0, react_1.useCallback)(() => {
121
- setIsLoadFinish(true);
122
- }, []);
123
117
  const handleClickVideo = (0, react_1.useCallback)((type) => () => {
124
118
  if (!videoRef)
125
119
  return;
126
120
  if (!isLoadFinish)
127
121
  return;
128
- const isPause = videoRef === null || videoRef === void 0 ? void 0 : videoRef.paused();
122
+ const isPause = videoRef === null || videoRef === void 0 ? void 0 : videoRef.paused;
129
123
  switch (type) {
130
124
  case 'start':
131
125
  if (!isPause)
@@ -157,10 +151,10 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
157
151
  if (activeIndex !== index)
158
152
  return;
159
153
  const item = data[index];
160
- const videoDuration = ((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.duration()) !== null && _a !== void 0 ? _a : 0).toFixed(2);
161
- const videoCurrentTime = ((_b = videoRef === null || videoRef === void 0 ? void 0 : videoRef.currentTime()) !== null && _b !== void 0 ? _b : 0).toFixed(2);
162
- if (videoRef === null || videoRef === void 0 ? void 0 : videoRef.duration()) {
163
- const playDuration = ((videoRef === null || videoRef === void 0 ? void 0 : videoRef.currentTime()) - videoStartTime.current).toFixed(2);
154
+ const videoDuration = ((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.duration) !== null && _a !== void 0 ? _a : 0).toFixed(2);
155
+ const videoCurrentTime = ((_b = videoRef === null || videoRef === void 0 ? void 0 : videoRef.currentTime) !== null && _b !== void 0 ? _b : 0).toFixed(2);
156
+ if (videoRef === null || videoRef === void 0 ? void 0 : videoRef.duration) {
157
+ const playDuration = ((videoRef === null || videoRef === void 0 ? void 0 : videoRef.currentTime) - videoStartTime.current).toFixed(2);
164
158
  bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
165
159
  eventInfo: {
166
160
  eventSubject: 'playOverVideo',
@@ -184,7 +178,19 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
184
178
  const videoSrc = rec === null || rec === void 0 ? void 0 : rec.video.url;
185
179
  if (!videoSrc)
186
180
  return;
187
- videoRef === null || videoRef === void 0 ? void 0 : videoRef.src(videoSrc);
181
+ if (videoSrc.includes('.m3u8')) {
182
+ if (hls_js_1.default.isSupported()) {
183
+ const hls = new hls_js_1.default();
184
+ hls.loadSource(videoSrc);
185
+ hls.attachMedia(videoRef.current);
186
+ }
187
+ else {
188
+ videoRef.src = videoSrc;
189
+ }
190
+ }
191
+ else {
192
+ videoRef.src = videoSrc;
193
+ }
188
194
  setIsPauseVideo(false);
189
195
  const videoPlayerWrapperNode = document.querySelector(`#${videoId}`);
190
196
  const dom = document.querySelector('#player-container-id');
@@ -192,18 +198,20 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
192
198
  if (!dom && !dom2)
193
199
  return;
194
200
  videoPlayerWrapperNode === null || videoPlayerWrapperNode === void 0 ? void 0 : videoPlayerWrapperNode.appendChild(dom || dom2);
195
- videoRef === null || videoRef === void 0 ? void 0 : videoRef.on('loadedmetadata', handleLoadedmetadata);
196
- videoRef === null || videoRef === void 0 ? void 0 : videoRef.on('loadeddata', handLoadeddata);
197
- videoRef === null || videoRef === void 0 ? void 0 : videoRef.on('playing', handlePlaying);
198
- videoRef === null || videoRef === void 0 ? void 0 : videoRef.on('pause', handlePause);
199
- videoRef === null || videoRef === void 0 ? void 0 : videoRef.on('ended', handleEnded);
201
+ videoRef.setAttribute('x5-playsinline', 'true');
202
+ videoRef.setAttribute('webkit-playsinline', 'true');
203
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.addEventListener('loadedmetadata', handleLoadedmetadata);
204
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.addEventListener('loadeddata', handLoadeddata);
205
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.addEventListener('playing', handlePlaying);
206
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.addEventListener('pause', handlePause);
207
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.addEventListener('ended', handleEnded);
200
208
  return () => {
201
209
  dom2 === null || dom2 === void 0 ? void 0 : dom2.appendChild(dom);
202
- videoRef === null || videoRef === void 0 ? void 0 : videoRef.off('loadedmetadata', handleLoadedmetadata);
203
- videoRef === null || videoRef === void 0 ? void 0 : videoRef.off('loadeddata', handLoadeddata);
204
- videoRef === null || videoRef === void 0 ? void 0 : videoRef.off('playing', handlePlaying);
205
- videoRef === null || videoRef === void 0 ? void 0 : videoRef.off('pause', handlePause);
206
- videoRef === null || videoRef === void 0 ? void 0 : videoRef.off('ended', handleEnded);
210
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.removeEventListener('loadedmetadata', handleLoadedmetadata);
211
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.removeEventListener('loadeddata', handLoadeddata);
212
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.removeEventListener('playing', handlePlaying);
213
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.removeEventListener('pause', handlePause);
214
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.removeEventListener('ended', handleEnded);
207
215
  };
208
216
  }, [isActive, videoId, rec, videoRef]);
209
217
  (0, react_1.useEffect)(() => {
@@ -222,7 +230,7 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
222
230
  (0, react_1.useEffect)(() => {
223
231
  if (!isActive || !videoRef)
224
232
  return;
225
- const isPause = videoRef === null || videoRef === void 0 ? void 0 : videoRef.paused();
233
+ const isPause = videoRef === null || videoRef === void 0 ? void 0 : videoRef.paused;
226
234
  if (!isPause && openHashtag) {
227
235
  videoRef === null || videoRef === void 0 ? void 0 : videoRef.pause();
228
236
  }