pb-sxp-ui 1.2.4 → 1.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/dist/index.cjs +231 -151
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.css +2 -2
  4. package/dist/index.js +231 -151
  5. package/dist/index.js.map +1 -1
  6. package/dist/index.min.cjs +3 -3
  7. package/dist/index.min.cjs.map +1 -1
  8. package/dist/index.min.js +3 -3
  9. package/dist/index.min.js.map +1 -1
  10. package/dist/pb-ui.js +231 -151
  11. package/dist/pb-ui.js.map +1 -1
  12. package/dist/pb-ui.min.js +3 -3
  13. package/dist/pb-ui.min.js.map +1 -1
  14. package/es/core/components/SxpPageRender/LikeButton/index.js +34 -15
  15. package/es/core/components/SxpPageRender/Popup/index.js +23 -12
  16. package/es/core/components/SxpPageRender/RenderCard.d.ts +1 -0
  17. package/es/core/components/SxpPageRender/RenderCard.js +3 -3
  18. package/es/core/components/SxpPageRender/index.js +2 -2
  19. package/es/core/components/SxpPageRender/typing.d.ts +1 -0
  20. package/es/core/context/SxpDataSourceProvider.d.ts +3 -3
  21. package/es/core/context/SxpDataSourceProvider.js +7 -3
  22. package/es/materials/sxp/cta/AniLink/index.js +2 -1
  23. package/es/materials/sxp/cta/AniLinkPopup/index.d.ts +1 -0
  24. package/es/materials/sxp/cta/AniLinkPopup/index.js +11 -20
  25. package/es/materials/sxp/popup/CommodityDetail/index.js +25 -13
  26. package/es/materials/sxp/popup/CommodityDetailDiroNew/index.js +28 -17
  27. package/es/materials/sxp/popup/CommodityList/index.js +28 -10
  28. package/es/materials/sxp/popup/CommodityList/material.js +1 -0
  29. package/es/materials/sxp/popup/CommodityList/settingRender.js +5 -0
  30. package/es/materials/sxp/template/MultiCommodity/index.js +3 -3
  31. package/es/materials/sxp/template/MultiCommodityDiro/index.js +3 -3
  32. package/es/materials/sxp/template/components/CommodityGroup.d.ts +4 -0
  33. package/es/materials/sxp/template/components/CommodityGroup.js +12 -15
  34. package/es/materials/sxp/template/components/Img.d.ts +1 -0
  35. package/es/materials/sxp/template/components/Img.js +3 -3
  36. package/es/materials/sxp/template/components/Scroll.d.ts +1 -0
  37. package/es/materials/sxp/template/components/Scroll.js +5 -4
  38. package/lib/core/components/SxpPageRender/LikeButton/index.js +34 -15
  39. package/lib/core/components/SxpPageRender/Popup/index.js +22 -11
  40. package/lib/core/components/SxpPageRender/RenderCard.d.ts +1 -0
  41. package/lib/core/components/SxpPageRender/RenderCard.js +3 -3
  42. package/lib/core/components/SxpPageRender/index.js +2 -2
  43. package/lib/core/components/SxpPageRender/typing.d.ts +1 -0
  44. package/lib/core/context/SxpDataSourceProvider.d.ts +3 -3
  45. package/lib/core/context/SxpDataSourceProvider.js +7 -3
  46. package/lib/materials/sxp/cta/AniLink/index.js +2 -1
  47. package/lib/materials/sxp/cta/AniLinkPopup/index.d.ts +1 -0
  48. package/lib/materials/sxp/cta/AniLinkPopup/index.js +10 -19
  49. package/lib/materials/sxp/popup/CommodityDetail/index.js +24 -12
  50. package/lib/materials/sxp/popup/CommodityDetailDiroNew/index.js +28 -17
  51. package/lib/materials/sxp/popup/CommodityList/index.js +27 -9
  52. package/lib/materials/sxp/popup/CommodityList/material.js +1 -0
  53. package/lib/materials/sxp/popup/CommodityList/settingRender.js +5 -0
  54. package/lib/materials/sxp/template/MultiCommodity/index.js +3 -3
  55. package/lib/materials/sxp/template/MultiCommodityDiro/index.js +3 -3
  56. package/lib/materials/sxp/template/components/CommodityGroup.d.ts +4 -0
  57. package/lib/materials/sxp/template/components/CommodityGroup.js +11 -14
  58. package/lib/materials/sxp/template/components/Img.d.ts +1 -0
  59. package/lib/materials/sxp/template/components/Img.js +3 -3
  60. package/lib/materials/sxp/template/components/Scroll.d.ts +1 -0
  61. package/lib/materials/sxp/template/components/Scroll.js +5 -4
  62. package/package.json +1 -1
@@ -12,21 +12,28 @@ import FormatImage from '../../../../core/components/SxpPageRender/FormatImage';
12
12
  import { setFontForText } from '../../../../core/utils/tool';
13
13
  import CommodityGroup from '../../template/components/CommodityGroup';
14
14
  const CommodityDetailDiroNew = (_a) => {
15
- var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
15
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1;
16
16
  var { style, isDefault, rec, viewTime, isPost, bottom_image, tipText, swiper, commodityStyles, buttonStyle, index, commodityGroup } = _a, props = __rest(_a, ["style", "isDefault", "rec", "viewTime", "isPost", "bottom_image", "tipText", "swiper", "commodityStyles", "buttonStyle", "index", "commodityGroup"]);
17
17
  const [spread, setSpread] = useState(true);
18
- const { sxpParameter } = useSxpDataSource();
19
- const { popupDetailData, bffEventReport, isPreview, swiperRef, bffFbReport } = useSxpDataSource();
18
+ const { sxpParameter, popupCurTimeRef, popupDetailData, isPreview, bffFbReport } = useSxpDataSource();
20
19
  const { jumpToWeb, productView } = useEventReport();
21
20
  const [stopSlide, setStopSlide] = useState(false);
22
21
  const [isBottom, setIsBottom] = useState(false);
23
22
  const [isTop, setIsTop] = useState(true);
24
23
  const [showModal, setShowModal] = useState(false);
25
24
  const curTimeRef = useRef(null);
25
+ const [checkCommodityIndex, setCheckCommodityIndex] = useState((_b = popupDetailData === null || popupDetailData === void 0 ? void 0 : popupDetailData.multiCheckIndex) !== null && _b !== void 0 ? _b : 0);
26
26
  const data = isPost ? rec : popupDetailData;
27
- const product = isPost ? data === null || data === void 0 ? void 0 : data.product : (_b = data === null || data === void 0 ? void 0 : data.video) === null || _b === void 0 ? void 0 : _b.bindProduct;
28
- const cta = isPost ? (_c = data === null || data === void 0 ? void 0 : data.product) === null || _c === void 0 ? void 0 : _c.bindCta : (_e = (_d = data === null || data === void 0 ? void 0 : data.video) === null || _d === void 0 ? void 0 : _d.bindProduct) === null || _e === void 0 ? void 0 : _e.bindCta;
27
+ let product = isPost ? data === null || data === void 0 ? void 0 : data.product : (_d = (_c = data === null || data === void 0 ? void 0 : data.video) === null || _c === void 0 ? void 0 : _c.bindProduct) !== null && _d !== void 0 ? _d : (_f = (_e = data === null || data === void 0 ? void 0 : data.video) === null || _e === void 0 ? void 0 : _e.bindProducts) === null || _f === void 0 ? void 0 : _f[0];
28
+ let cta = isPost
29
+ ? (_g = data === null || data === void 0 ? void 0 : data.product) === null || _g === void 0 ? void 0 : _g.bindCta
30
+ : (_k = (_j = (_h = data === null || data === void 0 ? void 0 : data.video) === null || _h === void 0 ? void 0 : _h.bindProduct) === null || _j === void 0 ? void 0 : _j.bindCta) !== null && _k !== void 0 ? _k : (_o = (_m = (_l = data === null || data === void 0 ? void 0 : data.video) === null || _l === void 0 ? void 0 : _l.bindProducts) === null || _m === void 0 ? void 0 : _m[0]) === null || _o === void 0 ? void 0 : _o.bindCta;
29
31
  const position = isPost ? index : popupDetailData === null || popupDetailData === void 0 ? void 0 : popupDetailData.index;
32
+ if (!isPost && (commodityGroup === null || commodityGroup === void 0 ? void 0 : commodityGroup.open) && ((_p = data === null || data === void 0 ? void 0 : data.video) === null || _p === void 0 ? void 0 : _p.bindProducts) && ((_r = (_q = data === null || data === void 0 ? void 0 : data.video) === null || _q === void 0 ? void 0 : _q.bindProducts) === null || _r === void 0 ? void 0 : _r.length) > 0) {
33
+ const p = (_s = data === null || data === void 0 ? void 0 : data.video) === null || _s === void 0 ? void 0 : _s.bindProducts[checkCommodityIndex];
34
+ product = p;
35
+ cta = p === null || p === void 0 ? void 0 : p.bindCta;
36
+ }
30
37
  const handleLink = () => {
31
38
  if (product === null || product === void 0 ? void 0 : product.link) {
32
39
  jumpToWeb(data, product, cta, position);
@@ -64,7 +71,7 @@ const CommodityDetailDiroNew = (_a) => {
64
71
  return '£102,300.00';
65
72
  }
66
73
  }, [product === null || product === void 0 ? void 0 : product.price, product === null || product === void 0 ? void 0 : product.currency]);
67
- const width = isPreview ? 375 : (_f = style === null || style === void 0 ? void 0 : style.width) !== null && _f !== void 0 ? _f : window.innerWidth;
74
+ const width = isPreview ? 375 : (_t = style === null || style === void 0 ? void 0 : style.width) !== null && _t !== void 0 ? _t : window.innerWidth;
68
75
  const handleClickCollapse = () => {
69
76
  setSpread(!spread);
70
77
  };
@@ -80,15 +87,19 @@ Made in Italy` })));
80
87
  }
81
88
  return style;
82
89
  }, []);
90
+ const handleClick = useCallback((index) => {
91
+ popupCurTimeRef.current = new Date();
92
+ setCheckCommodityIndex(index);
93
+ }, []);
83
94
  const renderCommodityGroup = useCallback(() => {
84
95
  var _a, _b, _c;
85
96
  if (isPost)
86
97
  return;
87
- return (React.createElement(CommodityGroup, { products: (_a = data === null || data === void 0 ? void 0 : data.video) === null || _a === void 0 ? void 0 : _a.bindProducts, data: commodityGroup, defImg: (_c = (_b = sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) !== null && _b !== void 0 ? _b : bottom_image) !== null && _c !== void 0 ? _c : '', style: { padding: '0 19px' } }));
88
- }, []);
98
+ return (React.createElement(CommodityGroup, { products: (_a = data === null || data === void 0 ? void 0 : data.video) === null || _a === void 0 ? void 0 : _a.bindProducts, data: commodityGroup, defImg: (_c = (_b = sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) !== null && _b !== void 0 ? _b : bottom_image) !== null && _c !== void 0 ? _c : '', style: { padding: '0 19px' }, onCLick: handleClick, popupDetailData: popupDetailData, check: checkCommodityIndex }));
99
+ }, [checkCommodityIndex]);
89
100
  return (React.createElement("div", { className: 'pb-commondityDiroNew' },
90
- React.createElement("div", Object.assign({ className: css(Object.assign({}, style)) }, props),
91
- product && ((_g = product === null || product === void 0 ? void 0 : product.homePage) === null || _g === void 0 ? void 0 : _g.length) > 0 && (React.createElement(Swiper, { height: width, modules: [Pagination, Autoplay], pagination: {
101
+ React.createElement("div", Object.assign({ className: css(Object.assign(Object.assign({}, style), { transform: 'translate3d(0px, 0px, 0px)' })) }, props),
102
+ product && ((_u = product === null || product === void 0 ? void 0 : product.homePage) === null || _u === void 0 ? void 0 : _u.length) > 0 && (React.createElement(Swiper, { height: width, modules: [Pagination, Autoplay], pagination: {
92
103
  clickable: true,
93
104
  bulletActiveClass: 'commondityDiroNew-swipe-item-active-bullet',
94
105
  clickableClass: (swiper === null || swiper === void 0 ? void 0 : swiper.dotsAlign) === 'left'
@@ -96,7 +107,7 @@ Made in Italy` })));
96
107
  : 'commondityDiroNew-swiper-clickable-center'
97
108
  }, loop: true, autoplay: {
98
109
  delay: (swiper === null || swiper === void 0 ? void 0 : swiper.delay) * 1000
99
- } }, (_h = product === null || product === void 0 ? void 0 : product.homePage) === null || _h === void 0 ? void 0 : _h.map((src) => {
110
+ } }, (_v = product === null || product === void 0 ? void 0 : product.homePage) === null || _v === void 0 ? void 0 : _v.map((src) => {
100
111
  return (React.createElement(SwiperSlide, { key: src },
101
112
  React.createElement("div", { style: {
102
113
  overflow: 'hidden',
@@ -111,7 +122,7 @@ Made in Italy` })));
111
122
  objectPosition: `50% ${(swiper === null || swiper === void 0 ? void 0 : swiper.translateY) ? (swiper === null || swiper === void 0 ? void 0 : swiper.translateY) + 50 : 50}%`
112
123
  }, src: src }))));
113
124
  }))),
114
- !((_j = product === null || product === void 0 ? void 0 : product.homePage) === null || _j === void 0 ? void 0 : _j.length) && (React.createElement("div", { className: css({
125
+ !((_w = product === null || product === void 0 ? void 0 : product.homePage) === null || _w === void 0 ? void 0 : _w.length) && (React.createElement("div", { className: css({
115
126
  position: 'relative',
116
127
  height: 0,
117
128
  width: '100%',
@@ -124,13 +135,13 @@ Made in Italy` })));
124
135
  top: 0,
125
136
  objectFit: 'cover',
126
137
  width: '100%'
127
- }), src: (_k = sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) !== null && _k !== void 0 ? _k : bottom_image, alt: 'pdp image' }))),
138
+ }), src: (_x = sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) !== null && _x !== void 0 ? _x : bottom_image, alt: 'pdp image' }))),
128
139
  renderCommodityGroup(),
129
140
  React.createElement("div", { className: 'pb-commondityDiroNew-content' },
130
141
  React.createElement("div", { className: 'pb-commondityDiroNew-content-top' },
131
142
  React.createElement("div", { className: 'pb-commondityDiroNew-content-top-left' },
132
143
  React.createElement("div", { className: 'pb-commondityDiroNew-content-top-left-title', style: getStyle(commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.title), dangerouslySetInnerHTML: {
133
- __html: setFontForText((_l = product === null || product === void 0 ? void 0 : product.title) !== null && _l !== void 0 ? _l : 'Large Dior Toujours BagLarge', commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.title)
144
+ __html: setFontForText((_y = product === null || product === void 0 ? void 0 : product.title) !== null && _y !== void 0 ? _y : 'Large Dior Toujours BagLarge', commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.title)
134
145
  } }),
135
146
  React.createElement("div", { className: 'pb-commondityDiroNew-content-collection', hidden: !!product && (!(product === null || product === void 0 ? void 0 : product.collection) || (product === null || product === void 0 ? void 0 : product.collection) === ''), style: getStyle(commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.collection), dangerouslySetInnerHTML: {
136
147
  __html: setFontForText((product === null || product === void 0 ? void 0 : product.collection) || 'Black Macrocannage CalfskinLarge', commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.collection)
@@ -140,11 +151,11 @@ Made in Italy` })));
140
151
  __html: setFontForText(priceText, commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price)
141
152
  } }),
142
153
  React.createElement("div", { className: 'pb-commondityDiroNew-content-top-right-price', hidden: !!product && !(product === null || product === void 0 ? void 0 : product.taxInfo), style: getStyle(commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.taxInfo), dangerouslySetInnerHTML: {
143
- __html: setFontForText((_m = product === null || product === void 0 ? void 0 : product.taxInfo) !== null && _m !== void 0 ? _m : '税费', commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.taxInfo)
154
+ __html: setFontForText((_z = product === null || product === void 0 ? void 0 : product.taxInfo) !== null && _z !== void 0 ? _z : '税费', commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.taxInfo)
144
155
  } }))),
145
- (!product || (product === null || product === void 0 ? void 0 : product.link)) && (React.createElement("button", { "aria-label": (_o = cta === null || cta === void 0 ? void 0 : cta.enTitle) !== null && _o !== void 0 ? _o : 'Shop now', onClick: handleLink, className: 'pb-commondityDiroNew-btn', style: buttonStyle },
156
+ (!product || (product === null || product === void 0 ? void 0 : product.link)) && (React.createElement("button", { "aria-label": (_0 = cta === null || cta === void 0 ? void 0 : cta.enTitle) !== null && _0 !== void 0 ? _0 : 'Shop now', onClick: handleLink, className: 'pb-commondityDiroNew-btn', style: buttonStyle },
146
157
  React.createElement("span", { dangerouslySetInnerHTML: {
147
- __html: setFontForText((_p = cta === null || cta === void 0 ? void 0 : cta.enTitle) !== null && _p !== void 0 ? _p : 'Shop now', buttonStyle)
158
+ __html: setFontForText((_1 = cta === null || cta === void 0 ? void 0 : cta.enTitle) !== null && _1 !== void 0 ? _1 : 'Shop now', buttonStyle)
148
159
  } }))),
149
160
  productInfoText({ isPost }))),
150
161
  React.createElement(Modal, { visible: showModal, onClose: () => setShowModal(false) }, productInfoText({ isPost: false }))));
@@ -1,16 +1,18 @@
1
1
  import { __rest } from "tslib";
2
2
  import { css } from '@emotion/css';
3
3
  import React, { memo, useCallback } from 'react';
4
- import { useSxpDataSource } from '../../../../core/hooks';
4
+ import { useEditor, useSxpDataSource } from '../../../../core/hooks';
5
5
  import './index.less';
6
+ import { useEventReport } from '../../../../core/hooks/useEventReport';
6
7
  import { setFontForText } from '../../../../core/utils/tool';
7
8
  import Img from '../../template/components/Img';
8
- import EventProvider from '../../template/components/EventProvider';
9
+ import { throttle } from 'lodash';
9
10
  const CommodityList = (_a) => {
10
11
  var _b, _c;
11
- var { style, isDefault, rec, viewTime, isPost, bottom_image, commodityStyles, buttonStyle, index, translateY = 0, commodityPicture, isExternalLink } = _a, props = __rest(_a, ["style", "isDefault", "rec", "viewTime", "isPost", "bottom_image", "commodityStyles", "buttonStyle", "index", "translateY", "commodityPicture", "isExternalLink"]);
12
- const { sxpParameter } = useSxpDataSource();
13
- const { popupDetailData, bffEventReport, isPreview, swiperRef, bffFbReport } = useSxpDataSource();
12
+ var { style, isDefault, rec, viewTime, isPost, bottom_image, commodityStyles, buttonStyle, index, translateY = 0, commodityPicture, isExternalLink, onClick } = _a, props = __rest(_a, ["style", "isDefault", "rec", "viewTime", "isPost", "bottom_image", "commodityStyles", "buttonStyle", "index", "translateY", "commodityPicture", "isExternalLink", "onClick"]);
13
+ const { sxpParameter, popupDetailData, setPopupDetailData, ctaEvent } = useSxpDataSource();
14
+ const { jumpToWeb } = useEventReport();
15
+ const { popup } = useEditor();
14
16
  const recData = isPost ? rec : popupDetailData;
15
17
  const product = (_c = (_b = recData === null || recData === void 0 ? void 0 : recData.video) === null || _b === void 0 ? void 0 : _b.bindProducts) !== null && _c !== void 0 ? _c : [null, null, null, null];
16
18
  const priceText = useCallback((product) => {
@@ -24,12 +26,28 @@ const CommodityList = (_a) => {
24
26
  return '$7,000';
25
27
  }
26
28
  }, []);
29
+ const handleClick = throttle((item, multiCheckIndex) => {
30
+ ctaEvent === null || ctaEvent === void 0 ? void 0 : ctaEvent({
31
+ eventSubject: 'clickCta',
32
+ eventDescription: 'User clicked the CTA'
33
+ }, recData, item, index);
34
+ setPopupDetailData === null || setPopupDetailData === void 0 ? void 0 : setPopupDetailData(Object.assign(Object.assign({}, recData), { video: Object.assign(Object.assign({}, recData === null || recData === void 0 ? void 0 : recData.video), { bindProduct: item }), index, multiCheckIndex }));
35
+ if (isExternalLink) {
36
+ if (item === null || item === void 0 ? void 0 : item.link) {
37
+ jumpToWeb(recData, item, item.bindCta, index);
38
+ window.location.href = window.getJointUtmLink(item.link);
39
+ }
40
+ }
41
+ else {
42
+ onClick === null || onClick === void 0 ? void 0 : onClick();
43
+ }
44
+ }, popup === null || popup === void 0 ? void 0 : popup.duration);
27
45
  return (React.createElement("div", { className: css(Object.assign(Object.assign({}, style), { display: 'flex', flexDirection: 'column', gap: '10px', padding: '0 20px', marginTop: '50px' })) }, product === null || product === void 0 ? void 0 : product.map((item, index) => {
28
46
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
29
- return (React.createElement(EventProvider, Object.assign({ key: index, isExternalLink: isExternalLink, rec: recData, index: index }, props, { className: css({
47
+ return (React.createElement(React.Fragment, null, recData && !(item === null || item === void 0 ? void 0 : item.bindCta) ? null : (React.createElement("div", Object.assign({ key: index }, props, { className: css({
30
48
  display: 'flex'
31
- }) }),
32
- 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: commodityPicture }),
49
+ }), onClick: () => handleClick(item, index) }),
50
+ 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: commodityPicture, enableEventReport: false }),
33
51
  React.createElement("div", { style: {
34
52
  flex: 1,
35
53
  width: `calc(100% - ${(_e = commodityPicture === null || commodityPicture === void 0 ? void 0 : commodityPicture.width) !== null && _e !== void 0 ? _e : 0}px - ${(_f = commodityPicture === null || commodityPicture === void 0 ? void 0 : commodityPicture.marginRight) !== null && _f !== void 0 ? _f : 0}px - ${(_g = style === null || style === void 0 ? void 0 : style.padding) !== null && _g !== void 0 ? _g : 0}px)`,
@@ -54,9 +72,9 @@ const CommodityList = (_a) => {
54
72
  React.createElement("div", { style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price, hidden: !!item && !(item === null || item === void 0 ? void 0 : item.price), dangerouslySetInnerHTML: {
55
73
  __html: setFontForText(priceText(item), commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price)
56
74
  } }),
57
- React.createElement("div", { className: 'one-line-ellipsis', style: Object.assign(Object.assign({}, buttonStyle), { padding: '0 15px', maxWidth: '100px' }), dangerouslySetInnerHTML: {
75
+ React.createElement("div", { className: 'one-line-ellipsis', style: Object.assign(Object.assign({}, buttonStyle), { padding: '0 15px' }), dangerouslySetInnerHTML: {
58
76
  __html: setFontForText((_l = (_k = item === null || item === void 0 ? void 0 : item.bindCta) === null || _k === void 0 ? void 0 : _k.enTitle) !== null && _l !== void 0 ? _l : 'Shop Now', buttonStyle)
59
- } })))));
77
+ } })))))));
60
78
  })));
61
79
  };
62
80
  export default memo(CommodityList);
@@ -37,6 +37,7 @@ const CommodityList = createMaterial(CommodityListComponent, {
37
37
  backgroundColor: '#000',
38
38
  fontSize: 12,
39
39
  height: 30,
40
+ width: 100,
40
41
  textAlign: 'center',
41
42
  color: '#fff',
42
43
  lineHeight: 2.5
@@ -133,6 +133,11 @@ export default [
133
133
  type: 'Group',
134
134
  label: '尺寸',
135
135
  child: [
136
+ {
137
+ type: 'Number',
138
+ name: ['props', 'buttonStyle', 'width'],
139
+ addonAfter: 'W'
140
+ },
136
141
  {
137
142
  type: 'Number',
138
143
  name: ['props', 'buttonStyle', 'height'],
@@ -17,12 +17,12 @@ const MultiCommodity = (_a) => {
17
17
  const { popup } = useEditor();
18
18
  const [products, setProducts] = useState((_c = (_b = recData === null || recData === void 0 ? void 0 : recData.video) === null || _b === void 0 ? void 0 : _b.bindProducts) !== null && _c !== void 0 ? _c : [1, 2]);
19
19
  const { jumpToWeb } = useEventReport();
20
- const handleClick = throttle((item) => {
20
+ const handleClick = throttle((item, multiCheckIndex) => {
21
21
  ctaEvent === null || ctaEvent === void 0 ? void 0 : ctaEvent({
22
22
  eventSubject: 'clickCta',
23
23
  eventDescription: 'User clicked the CTA'
24
24
  }, recData, item, index);
25
- setPopupDetailData === null || setPopupDetailData === void 0 ? void 0 : setPopupDetailData(Object.assign(Object.assign({}, recData), { video: Object.assign(Object.assign({}, recData === null || recData === void 0 ? void 0 : recData.video), { bindProduct: item }), index }));
25
+ setPopupDetailData === null || setPopupDetailData === void 0 ? void 0 : setPopupDetailData(Object.assign(Object.assign({}, recData), { video: Object.assign(Object.assign({}, recData === null || recData === void 0 ? void 0 : recData.video), { bindProduct: item }), index, multiCheckIndex }));
26
26
  if (isExternalLink) {
27
27
  if (item === null || item === void 0 ? void 0 : item.link) {
28
28
  jumpToWeb(recData, item, item.bindCta, index);
@@ -35,7 +35,7 @@ const MultiCommodity = (_a) => {
35
35
  }, popup === null || popup === void 0 ? void 0 : popup.duration);
36
36
  return (React.createElement(Scroll, { isPadding: !!recData }, products === null || products === void 0 ? void 0 : products.map((item, index) => {
37
37
  var _a, _b, _c, _d, _e, _f, _g, _h;
38
- return (React.createElement(React.Fragment, null, recData && !(item === null || item === void 0 ? void 0 : item.bindCta) ? null : (React.createElement(SwiperSlide, Object.assign({ key: index, className: css(Object.assign(Object.assign({}, style), { display: 'flex', flexShrink: 0, marginLeft: 0, marginRight: '8px' })) }, props, { onClick: () => handleClick(item) }),
38
+ return (React.createElement(React.Fragment, null, recData && !(item === null || item === void 0 ? void 0 : item.bindCta) ? null : (React.createElement(SwiperSlide, Object.assign({ key: index, className: css(Object.assign(Object.assign({}, style), { display: 'flex', flexShrink: 0, marginLeft: 0, marginRight: '8px' })) }, props, { onClick: () => handleClick(item, index) }),
39
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, translateY: translateY, imgStyle: ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.img }),
40
40
  React.createElement("div", { className: css({
41
41
  color: '#fff',
@@ -16,12 +16,12 @@ const MultiCommodityDiro = (_a) => {
16
16
  const { popup } = useEditor();
17
17
  const { jumpToWeb } = useEventReport();
18
18
  const [products, setProducts] = useState((_c = (_b = recData === null || recData === void 0 ? void 0 : recData.video) === null || _b === void 0 ? void 0 : _b.bindProducts) !== null && _c !== void 0 ? _c : [1, 2]);
19
- const handleClick = throttle((item) => {
19
+ const handleClick = throttle((item, multiCheckIndex) => {
20
20
  ctaEvent === null || ctaEvent === void 0 ? void 0 : ctaEvent({
21
21
  eventSubject: 'clickCta',
22
22
  eventDescription: 'User clicked the CTA'
23
23
  }, recData, item, index);
24
- setPopupDetailData === null || setPopupDetailData === void 0 ? void 0 : setPopupDetailData(Object.assign(Object.assign({}, recData), { video: Object.assign(Object.assign({}, recData === null || recData === void 0 ? void 0 : recData.video), { bindProduct: item }), index }));
24
+ setPopupDetailData === null || setPopupDetailData === void 0 ? void 0 : setPopupDetailData(Object.assign(Object.assign({}, recData), { video: Object.assign(Object.assign({}, recData === null || recData === void 0 ? void 0 : recData.video), { bindProduct: item }), index, multiCheckIndex }));
25
25
  if (isExternalLink) {
26
26
  if (item === null || item === void 0 ? void 0 : item.link) {
27
27
  jumpToWeb(recData, item, item.bindCta, index);
@@ -34,7 +34,7 @@ const MultiCommodityDiro = (_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, index) => {
36
36
  var _a, _b, _c, _d, _e, _f, _g, _h;
37
- return (React.createElement(React.Fragment, null, recData && !(item === null || item === void 0 ? void 0 : item.bindCta) ? null : (React.createElement(SwiperSlide, Object.assign({ key: index, className: css(Object.assign(Object.assign({}, style), { display: 'flex', flexShrink: 0, marginLeft: 0, marginRight: '8px' })) }, props, { onClick: () => handleClick(item) }),
37
+ return (React.createElement(React.Fragment, null, recData && !(item === null || item === void 0 ? void 0 : item.bindCta) ? null : (React.createElement(SwiperSlide, Object.assign({ key: index, className: css(Object.assign(Object.assign({}, style), { display: 'flex', flexShrink: 0, marginLeft: 0, marginRight: '8px' })) }, props, { onClick: () => handleClick(item, index) }),
38
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 }),
39
39
  React.createElement("div", { className: css({
40
40
  color: '#000',
@@ -1,5 +1,6 @@
1
1
  import { VideoInfoType } from '../../../../core/components/SxpPageRender/typing';
2
2
  import React, { CSSProperties } from 'react';
3
+ import { ISxpDataSourceContext } from '../../../../core/context/SxpDataSourceProvider';
3
4
  interface ICommodityGroupProps {
4
5
  products?: VideoInfoType['bindProducts'];
5
6
  data?: {
@@ -9,6 +10,9 @@ interface ICommodityGroupProps {
9
10
  };
10
11
  defImg: string;
11
12
  style?: CSSProperties;
13
+ onCLick?: (i: number) => void;
14
+ popupDetailData?: ISxpDataSourceContext['popupDetailData'];
15
+ check?: number;
12
16
  }
13
17
  declare const _default: React.NamedExoticComponent<ICommodityGroupProps>;
14
18
  export default _default;
@@ -1,31 +1,28 @@
1
- import React, { memo, useState, useCallback } from 'react';
1
+ import React, { memo } from 'react';
2
2
  import Scroll from './Scroll';
3
3
  import FormatImage from '../../../../core/components/SxpPageRender/FormatImage';
4
- import { useSxpDataSource } from '../../../../core/hooks';
5
4
  import { SwiperSlide } from 'swiper/react';
6
5
  import { css } from '@emotion/css';
7
- const CommodityGroup = ({ products, data, defImg, style }) => {
8
- var _a, _b;
9
- const { setPopupDetailData, popupDetailData } = useSxpDataSource();
10
- const [check, setCheck] = useState((_a = popupDetailData === null || popupDetailData === void 0 ? void 0 : popupDetailData.multiCheckIndex) !== null && _a !== void 0 ? _a : 0);
11
- const handleClick = useCallback((index) => {
12
- setPopupDetailData === null || setPopupDetailData === void 0 ? void 0 : setPopupDetailData((val) => (Object.assign(Object.assign({}, val), { video: Object.assign(Object.assign({}, val === null || val === void 0 ? void 0 : val.video), { bindProduct: products === null || products === void 0 ? void 0 : products[index] }), multiCheckIndex: index })));
13
- }, []);
14
- return (React.createElement(React.Fragment, null, (data === null || data === void 0 ? void 0 : data.open) && ((products && (products === null || products === void 0 ? void 0 : products.length) > 0) || !popupDetailData) && (React.createElement(Scroll, { isPadding: false, style: Object.assign(Object.assign({}, style), data === null || data === void 0 ? void 0 : data.style) }, (_b = (popupDetailData ? products : [0, 1, 2, 3])) === null || _b === void 0 ? void 0 : _b.map((item, index) => {
6
+ const CommodityGroup = ({ products, data, defImg, style, onCLick, popupDetailData, check }) => {
7
+ var _a;
8
+ return (React.createElement(React.Fragment, null, (data === null || data === void 0 ? void 0 : data.open) && ((products && (products === null || products === void 0 ? void 0 : products.length) > 1) || !popupDetailData) && (React.createElement(Scroll, { enableSlideActive: true, isPadding: false, style: Object.assign(Object.assign({}, style), data === null || data === void 0 ? void 0 : data.style) }, (_a = (popupDetailData ? products : [0, 1, 2, 3])) === null || _a === void 0 ? void 0 : _a.map((item, index) => {
15
9
  var _a, _b, _c;
16
- return (React.createElement(SwiperSlide, { className: css({
10
+ return (React.createElement(React.Fragment, null, (item === null || item === void 0 ? void 0 : item.bindCta) ? (React.createElement(SwiperSlide, { className: css({
17
11
  width: '50px',
18
12
  height: '50px',
19
13
  marginRight: '10px'
20
- }), onClick: () => handleClick(index), key: index },
14
+ }), onClick: () => {
15
+ onCLick === null || onCLick === void 0 ? void 0 : onCLick(index);
16
+ }, key: index },
21
17
  React.createElement(FormatImage, { style: {
22
18
  height: '100%',
23
19
  width: '100%',
24
20
  objectFit: 'cover',
25
21
  display: 'block',
26
- objectPosition: `50% ${(data === null || data === void 0 ? void 0 : data.translateY) ? -(data === null || data === void 0 ? void 0 : data.translateY) + 50 : 50}%`,
27
- border: check === index ? '1px solid #000' : '1px solid #f2f2f2'
28
- }, src: (_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 : defImg })));
22
+ objectPosition: `50% ${(data === null || data === void 0 ? void 0 : data.translateY) ? (data === null || data === void 0 ? void 0 : data.translateY) + 50 : 50}%`,
23
+ border: check === index ? '1px solid #000' : '1px solid #f2f2f2',
24
+ boxSizing: 'border-box'
25
+ }, src: (_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 : defImg }))) : null));
29
26
  })))));
30
27
  };
31
28
  export default memo(CommodityGroup);
@@ -8,6 +8,7 @@ export interface IImgProps {
8
8
  style?: CSSProperties;
9
9
  translateY?: number;
10
10
  imgStyle?: CSSProperties;
11
+ enableEventReport?: boolean;
11
12
  }
12
13
  declare const _default: React.NamedExoticComponent<IImgProps>;
13
14
  export default _default;
@@ -3,18 +3,18 @@ import React, { memo, useEffect, useMemo, 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, translateY, imgStyle }) => {
6
+ const Img = ({ src, rec, item, index, style, translateY, imgStyle, enableEventReport = true }) => {
7
7
  const ref = useRef(null);
8
8
  const isOnScreen = useOnScreen(ref);
9
9
  const { ctaEvent } = useSxpDataSource();
10
10
  useEffect(() => {
11
- if (isOnScreen && src && (ref === null || ref === void 0 ? void 0 : ref.current)) {
11
+ if (isOnScreen && src && (ref === null || ref === void 0 ? void 0 : ref.current) && enableEventReport) {
12
12
  ctaEvent === null || ctaEvent === void 0 ? void 0 : ctaEvent({
13
13
  eventSubject: 'ctaExposure',
14
14
  eventDescription: 'The cta was shown to the user'
15
15
  }, rec, item, index);
16
16
  }
17
- }, [isOnScreen, src, ref, rec, ctaEvent, item, index]);
17
+ }, [isOnScreen, src, ref, rec, ctaEvent, item, index, enableEventReport]);
18
18
  const imgSrc = useMemo(() => {
19
19
  return (src === null || src === void 0 ? void 0 : src.includes('.avif')) ? src : `${src}?imrquality/rquality/20`;
20
20
  }, [src]);
@@ -6,6 +6,7 @@ interface IScrollProps {
6
6
  children: any;
7
7
  isPadding?: boolean;
8
8
  style?: CSSProperties;
9
+ enableSlideActive?: boolean;
9
10
  }
10
11
  declare const _default: React.NamedExoticComponent<IScrollProps>;
11
12
  export default _default;
@@ -5,13 +5,14 @@ import 'swiper/css/free-mode';
5
5
  import 'swiper/css/scrollbar';
6
6
  import { FreeMode, Scrollbar, Mousewheel } from 'swiper/modules';
7
7
  import { useSxpDataSource } from '../../../../core/hooks';
8
- const Scroll = ({ children, isPadding = true, style }) => {
8
+ const Scroll = ({ children, isPadding = true, style, enableSlideActive = false }) => {
9
9
  const ref = useRef();
10
10
  const { popupDetailData } = useSxpDataSource();
11
11
  useEffect(() => {
12
- var _a;
13
- (_a = ref === null || ref === void 0 ? void 0 : ref.current) === null || _a === void 0 ? void 0 : _a.swiper.slideTo(popupDetailData === null || popupDetailData === void 0 ? void 0 : popupDetailData.multiCheckIndex);
14
- }, [popupDetailData]);
12
+ var _a, _b;
13
+ if (enableSlideActive)
14
+ (_a = ref === null || ref === void 0 ? void 0 : ref.current) === null || _a === void 0 ? void 0 : _a.swiper.slideTo((_b = popupDetailData === null || popupDetailData === void 0 ? void 0 : popupDetailData.multiCheckIndex) !== null && _b !== void 0 ? _b : 0);
15
+ }, [popupDetailData, enableSlideActive]);
15
16
  return (React.createElement(Swiper, { ref: ref, direction: 'horizontal', slidesPerView: 'auto', freeMode: true, mousewheel: true, modules: [FreeMode, Scrollbar, Mousewheel], style: Object.assign({ padding: isPadding ? '0 12px 0 20px' : 0 }, style) }, children));
16
17
  };
17
18
  export default memo(Scroll);
@@ -8,50 +8,69 @@ const hooks_1 = require("../../../../core/hooks");
8
8
  const defaultUnLikeIconPath = '/pb_static/f71266d2c64446c5ae6a5a7f5489cc0a.png';
9
9
  const defaultLikeIconPath = '/pb_static/f07900fe3f0f4ae188ea1611d4801a44.png';
10
10
  const LikeButton = (_a) => {
11
+ var _b;
11
12
  var { active, activeIcon, unActicveIcon, recData, position } = _a, props = tslib_1.__rest(_a, ["active", "activeIcon", "unActicveIcon", "recData", "position"]);
12
- const { mutateLike, mutateUnlike, bffEventReport } = (0, hooks_1.useSxpDataSource)();
13
- const [state, setState] = (0, react_1.useState)(active);
13
+ const { mutateLike, mutateUnlike, bffEventReport, setCacheRtcList, cacheRtcList } = (0, hooks_1.useSxpDataSource)();
14
+ const [state, setState] = (0, react_1.useState)((_b = cacheRtcList === null || cacheRtcList === void 0 ? void 0 : cacheRtcList[position]) === null || _b === void 0 ? void 0 : _b.isCollected);
14
15
  const likeIcon = (0, useIconLink_1.useIconLink)(defaultLikeIconPath);
15
16
  const unlikeIcon = (0, useIconLink_1.useIconLink)(defaultUnLikeIconPath);
16
17
  const handleClick = (0, lodash_1.debounce)(() => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
17
- var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
18
+ var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
18
19
  if (state) {
19
20
  setState(false);
20
- const result = (_d = (yield (mutateUnlike === null || mutateUnlike === void 0 ? void 0 : mutateUnlike({ videoItemId: (_c = (_b = recData === null || recData === void 0 ? void 0 : recData.video) === null || _b === void 0 ? void 0 : _b.itemId) !== null && _c !== void 0 ? _c : '' })))) !== null && _d !== void 0 ? _d : false;
21
+ const result = (_e = (yield (mutateUnlike === null || mutateUnlike === void 0 ? void 0 : mutateUnlike({ videoItemId: (_d = (_c = recData === null || recData === void 0 ? void 0 : recData.video) === null || _c === void 0 ? void 0 : _c.itemId) !== null && _d !== void 0 ? _d : '' })))) !== null && _e !== void 0 ? _e : false;
21
22
  bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
22
23
  eventInfo: {
23
24
  eventSubject: 'favoriteContentCanceled',
24
25
  eventDescription: 'This content was unfavorite by the user',
25
- contentId: (_f = (_e = recData === null || recData === void 0 ? void 0 : recData.video) === null || _e === void 0 ? void 0 : _e.itemId) !== null && _f !== void 0 ? _f : '',
26
- contentName: (_h = (_g = recData === null || recData === void 0 ? void 0 : recData.video) === null || _g === void 0 ? void 0 : _g.title) !== null && _h !== void 0 ? _h : '',
27
- contentTags: JSON.stringify((_k = (_j = recData === null || recData === void 0 ? void 0 : recData.video) === null || _j === void 0 ? void 0 : _j.tags) !== null && _k !== void 0 ? _k : []),
26
+ contentId: (_g = (_f = recData === null || recData === void 0 ? void 0 : recData.video) === null || _f === void 0 ? void 0 : _f.itemId) !== null && _g !== void 0 ? _g : '',
27
+ contentName: (_j = (_h = recData === null || recData === void 0 ? void 0 : recData.video) === null || _h === void 0 ? void 0 : _h.title) !== null && _j !== void 0 ? _j : '',
28
+ contentTags: JSON.stringify((_l = (_k = recData === null || recData === void 0 ? void 0 : recData.video) === null || _k === void 0 ? void 0 : _k.tags) !== null && _l !== void 0 ? _l : []),
28
29
  position: position + '',
29
- contentFormat: ((_l = recData === null || recData === void 0 ? void 0 : recData.video) === null || _l === void 0 ? void 0 : _l.url) ? 'video' : 'image',
30
- traceInfo: (_m = recData === null || recData === void 0 ? void 0 : recData.video) === null || _m === void 0 ? void 0 : _m.traceInfo
30
+ contentFormat: ((_m = recData === null || recData === void 0 ? void 0 : recData.video) === null || _m === void 0 ? void 0 : _m.url) ? 'video' : 'image',
31
+ traceInfo: (_o = recData === null || recData === void 0 ? void 0 : recData.video) === null || _o === void 0 ? void 0 : _o.traceInfo
31
32
  }
32
33
  });
33
34
  if (!result) {
34
35
  setState(true);
35
36
  }
37
+ else {
38
+ const nRtcList = (_p = cacheRtcList === null || cacheRtcList === void 0 ? void 0 : cacheRtcList.map((item, index) => {
39
+ if (index === position) {
40
+ item.isCollected = false;
41
+ }
42
+ return item;
43
+ })) !== null && _p !== void 0 ? _p : [];
44
+ setCacheRtcList === null || setCacheRtcList === void 0 ? void 0 : setCacheRtcList(nRtcList);
45
+ }
36
46
  }
37
47
  else {
38
48
  setState(true);
39
- const result = (_o = (yield (mutateLike === null || mutateLike === void 0 ? void 0 : mutateLike({ content: JSON.stringify(recData) })))) !== null && _o !== void 0 ? _o : false;
49
+ const result = (_q = (yield (mutateLike === null || mutateLike === void 0 ? void 0 : mutateLike({ content: JSON.stringify(recData) })))) !== null && _q !== void 0 ? _q : false;
40
50
  bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
41
51
  eventInfo: {
42
52
  eventSubject: 'favoriteContent',
43
53
  eventDescription: 'This content was favorite by the user',
44
- contentId: (_q = (_p = recData === null || recData === void 0 ? void 0 : recData.video) === null || _p === void 0 ? void 0 : _p.itemId) !== null && _q !== void 0 ? _q : '',
45
- contentName: (_s = (_r = recData === null || recData === void 0 ? void 0 : recData.video) === null || _r === void 0 ? void 0 : _r.title) !== null && _s !== void 0 ? _s : '',
46
- contentTags: JSON.stringify((_u = (_t = recData === null || recData === void 0 ? void 0 : recData.video) === null || _t === void 0 ? void 0 : _t.tags) !== null && _u !== void 0 ? _u : []),
54
+ contentId: (_s = (_r = recData === null || recData === void 0 ? void 0 : recData.video) === null || _r === void 0 ? void 0 : _r.itemId) !== null && _s !== void 0 ? _s : '',
55
+ contentName: (_u = (_t = recData === null || recData === void 0 ? void 0 : recData.video) === null || _t === void 0 ? void 0 : _t.title) !== null && _u !== void 0 ? _u : '',
56
+ contentTags: JSON.stringify((_w = (_v = recData === null || recData === void 0 ? void 0 : recData.video) === null || _v === void 0 ? void 0 : _v.tags) !== null && _w !== void 0 ? _w : []),
47
57
  position: position + '',
48
- contentFormat: ((_v = recData === null || recData === void 0 ? void 0 : recData.video) === null || _v === void 0 ? void 0 : _v.url) ? 'video' : 'image',
49
- traceInfo: (_w = recData === null || recData === void 0 ? void 0 : recData.video) === null || _w === void 0 ? void 0 : _w.traceInfo
58
+ contentFormat: ((_x = recData === null || recData === void 0 ? void 0 : recData.video) === null || _x === void 0 ? void 0 : _x.url) ? 'video' : 'image',
59
+ traceInfo: (_y = recData === null || recData === void 0 ? void 0 : recData.video) === null || _y === void 0 ? void 0 : _y.traceInfo
50
60
  }
51
61
  });
52
62
  if (!result) {
53
63
  setState(false);
54
64
  }
65
+ else {
66
+ const nRtcList = (_z = cacheRtcList === null || cacheRtcList === void 0 ? void 0 : cacheRtcList.map((item, index) => {
67
+ if (index === position) {
68
+ item.isCollected = true;
69
+ }
70
+ return item;
71
+ })) !== null && _z !== void 0 ? _z : [];
72
+ setCacheRtcList === null || setCacheRtcList === void 0 ? void 0 : setCacheRtcList(nRtcList);
73
+ }
55
74
  }
56
75
  }), 200);
57
76
  return (react_1.default.createElement("button", Object.assign({}, props, { "aria-label": 'like', onClick: handleClick }),
@@ -8,13 +8,12 @@ const withBindDataSource_1 = tslib_1.__importDefault(require("../../../../core/h
8
8
  const useEventReport_1 = require("../../../../core/hooks/useEventReport");
9
9
  const Popup = () => {
10
10
  const { schema, resolver, popup } = (0, hooks_1.useEditor)();
11
- const { setPopupDetailData, popupDetailData, bffEventReport } = (0, hooks_1.useSxpDataSource)();
11
+ const { setPopupDetailData, popupDetailData, popupCurTimeRef, checkCommodityIndexRef } = (0, hooks_1.useSxpDataSource)();
12
12
  const { productView } = (0, useEventReport_1.useEventReport)();
13
13
  const [visible, setVisible] = (0, react_1.useState)();
14
- const curTimeRef = (0, react_1.useRef)(null);
15
14
  (0, react_1.useEffect)(() => {
16
15
  const initTime = () => {
17
- curTimeRef.current = new Date();
16
+ popupCurTimeRef.current = new Date();
18
17
  };
19
18
  initTime();
20
19
  window.addEventListener('pageshow', initTime);
@@ -24,25 +23,37 @@ const Popup = () => {
24
23
  }, []);
25
24
  (0, react_1.useEffect)(() => {
26
25
  if (popup && (popup === null || popup === void 0 ? void 0 : popup.id) && (popup === null || popup === void 0 ? void 0 : popup.id) !== '') {
27
- curTimeRef.current = new Date();
26
+ popupCurTimeRef.current = new Date();
28
27
  setVisible(popup);
29
28
  }
30
29
  }, [popup]);
31
30
  const handleClose = () => {
32
- var _a, _b, _c, _d;
33
- if (!popup || (popup === null || popup === void 0 ? void 0 : popup.id) === '' || !visible || new Date() - curTimeRef.current < ((_a = popup === null || popup === void 0 ? void 0 : popup.duration) !== null && _a !== void 0 ? _a : 0)) {
31
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
32
+ if (!popup ||
33
+ (popup === null || popup === void 0 ? void 0 : popup.id) === '' ||
34
+ !visible ||
35
+ new Date() - popupCurTimeRef.current < ((_a = popup === null || popup === void 0 ? void 0 : popup.duration) !== null && _a !== void 0 ? _a : 0)) {
34
36
  return;
35
37
  }
36
38
  setVisible(Object.assign(Object.assign({}, popup), { id: '' }));
37
- const data = popupDetailData;
38
- const product = (_b = data === null || data === void 0 ? void 0 : data.video) === null || _b === void 0 ? void 0 : _b.bindProduct;
39
- const cta = (_d = (_c = data === null || data === void 0 ? void 0 : data.video) === null || _c === void 0 ? void 0 : _c.bindProduct) === null || _d === void 0 ? void 0 : _d.bindCta;
40
- if (product && cta) {
41
- productView(data, product, cta, curTimeRef.current, popupDetailData === null || popupDetailData === void 0 ? void 0 : popupDetailData.index);
39
+ const value = (_d = (_c = (_b = schema === null || schema === void 0 ? void 0 : schema.sxpPageConf) === null || _b === void 0 ? void 0 : _b.globalConfig) === null || _c === void 0 ? void 0 : _c.popupList) === null || _d === void 0 ? void 0 : _d.find((item) => (item === null || item === void 0 ? void 0 : item.id) === (popup === null || popup === void 0 ? void 0 : popup.id));
40
+ if (((_e = value === null || value === void 0 ? void 0 : value.item) === null || _e === void 0 ? void 0 : _e.type) === 'CommodityDetail' || ((_f = value === null || value === void 0 ? void 0 : value.item) === null || _f === void 0 ? void 0 : _f.type) === 'CommodityDetailDiroNew') {
41
+ const data = popupDetailData;
42
+ let product = (_g = data === null || data === void 0 ? void 0 : data.video) === null || _g === void 0 ? void 0 : _g.bindProduct;
43
+ let cta = (_j = (_h = data === null || data === void 0 ? void 0 : data.video) === null || _h === void 0 ? void 0 : _h.bindProduct) === null || _j === void 0 ? void 0 : _j.bindCta;
44
+ if ((checkCommodityIndexRef === null || checkCommodityIndexRef === void 0 ? void 0 : checkCommodityIndexRef.current) >= 0) {
45
+ const p = (_k = data === null || data === void 0 ? void 0 : data.video) === null || _k === void 0 ? void 0 : _k.bindProducts[checkCommodityIndexRef === null || checkCommodityIndexRef === void 0 ? void 0 : checkCommodityIndexRef.current];
46
+ product = p;
47
+ cta = p === null || p === void 0 ? void 0 : p.bindCta;
48
+ }
49
+ if (product && cta) {
50
+ productView(data, product, cta, popupCurTimeRef.current, popupDetailData === null || popupDetailData === void 0 ? void 0 : popupDetailData.index);
51
+ }
42
52
  }
43
53
  setTimeout(() => {
44
54
  window === null || window === void 0 ? void 0 : window.sxpPopup('');
45
55
  setPopupDetailData === null || setPopupDetailData === void 0 ? void 0 : setPopupDetailData(null);
56
+ checkCommodityIndexRef.current = -1;
46
57
  }, popup === null || popup === void 0 ? void 0 : popup.duration);
47
58
  };
48
59
  const renderPopupDetail = (0, react_1.useMemo)(() => {
@@ -7,6 +7,7 @@ interface IRenderCardProps {
7
7
  tempMap?: Record<string, any>;
8
8
  resolver: any;
9
9
  includesCtaType?: string[];
10
+ isActive?: boolean;
10
11
  }
11
12
  declare const _default: React.NamedExoticComponent<IRenderCardProps>;
12
13
  export default _default;
@@ -5,7 +5,7 @@ const react_1 = tslib_1.__importStar(require("react"));
5
5
  require("./index.less");
6
6
  const withBindDataSource_1 = tslib_1.__importDefault(require("../../../core/hoc/withBindDataSource"));
7
7
  const hooks_1 = require("../../../core/hooks");
8
- const RenderCard = ({ rec, index, tempMap, resolver, includesCtaType }) => {
8
+ const RenderCard = ({ rec, index, tempMap, resolver, includesCtaType, isActive }) => {
9
9
  var _a, _b, _c, _d, _e;
10
10
  const { schema } = (0, hooks_1.useEditor)();
11
11
  if (!(rec === null || rec === void 0 ? void 0 : rec.video))
@@ -52,12 +52,12 @@ const RenderCard = ({ rec, index, tempMap, resolver, includesCtaType }) => {
52
52
  const Component = (0, withBindDataSource_1.default)(t);
53
53
  const defaulSetting = (_z = t === null || t === void 0 ? void 0 : t.extend) === null || _z === void 0 ? void 0 : _z.defaulSetting;
54
54
  const isExternalLink = ((_2 = (_1 = (_0 = value === null || value === void 0 ? void 0 : value.item) === null || _0 === void 0 ? void 0 : _0.event) === null || _1 === void 0 ? void 0 : _1.onClick) === null || _2 === void 0 ? void 0 : _2.linkType) === 'externalLink';
55
- return (react_1.default.createElement(Component, Object.assign({ style: Object.assign(Object.assign(Object.assign({}, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.style), (_3 = value === null || value === void 0 ? void 0 : value.item) === null || _3 === void 0 ? void 0 : _3.style), { zIndex: 50, marginLeft: '20px', boxSizing: 'border-box', transform: 'translate3d(0px, 0px, 0px)' }), textStyle: Object.assign(Object.assign({}, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.textStyle), (_4 = value === null || value === void 0 ? void 0 : value.item) === null || _4 === void 0 ? void 0 : _4.textStyle), bindDatas: (_6 = (_5 = value === null || value === void 0 ? void 0 : value.item) === null || _5 === void 0 ? void 0 : _5.bindDatas) !== null && _6 !== void 0 ? _6 : [] }, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.props, (_7 = value === null || value === void 0 ? void 0 : value.item) === null || _7 === void 0 ? void 0 : _7.props, { event: ((_8 = value === null || value === void 0 ? void 0 : value.item) === null || _8 === void 0 ? void 0 : _8.event) || {}, schema: schema, id: value === null || value === void 0 ? void 0 : value.id, key: value === null || value === void 0 ? void 0 : value.id, recData: rec, isExternalLink: isExternalLink, index: index })));
55
+ return (react_1.default.createElement(Component, Object.assign({ style: Object.assign(Object.assign(Object.assign({}, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.style), (_3 = value === null || value === void 0 ? void 0 : value.item) === null || _3 === void 0 ? void 0 : _3.style), { zIndex: 50, marginLeft: '20px', boxSizing: 'border-box', transform: 'translate3d(0px, 0px, 0px)' }), textStyle: Object.assign(Object.assign({}, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.textStyle), (_4 = value === null || value === void 0 ? void 0 : value.item) === null || _4 === void 0 ? void 0 : _4.textStyle), bindDatas: (_6 = (_5 = value === null || value === void 0 ? void 0 : value.item) === null || _5 === void 0 ? void 0 : _5.bindDatas) !== null && _6 !== void 0 ? _6 : [] }, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.props, (_7 = value === null || value === void 0 ? void 0 : value.item) === null || _7 === void 0 ? void 0 : _7.props, { event: ((_8 = value === null || value === void 0 ? void 0 : value.item) === null || _8 === void 0 ? void 0 : _8.event) || {}, schema: schema, id: value === null || value === void 0 ? void 0 : value.id, key: value === null || value === void 0 ? void 0 : value.id, recData: rec, isExternalLink: isExternalLink, index: index, isActive: isActive })));
56
56
  }
57
57
  else {
58
58
  return null;
59
59
  }
60
- }, [rec, resolver, tempMap, schema, value === null || value === void 0 ? void 0 : value.id]);
60
+ }, [rec, resolver, tempMap, schema, value === null || value === void 0 ? void 0 : value.id, isActive]);
61
61
  return react_1.default.createElement(react_1.default.Fragment, null, renderComp);
62
62
  };
63
63
  exports.default = (0, react_1.memo)(RenderCard);