pb-sxp-ui 1.2.4 → 1.2.6

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 (70) hide show
  1. package/dist/index.cjs +283 -175
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.css +11 -3
  4. package/dist/index.js +283 -175
  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 +283 -175
  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 +26 -13
  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 +4 -4
  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/core/hooks/useEventReport.js +4 -4
  23. package/es/materials/sxp/cta/AniLink/index.js +2 -1
  24. package/es/materials/sxp/cta/AniLinkPopup/index.d.ts +1 -0
  25. package/es/materials/sxp/cta/AniLinkPopup/index.js +11 -20
  26. package/es/materials/sxp/popup/CommodityDetail/index.d.ts +1 -0
  27. package/es/materials/sxp/popup/CommodityDetail/index.js +32 -15
  28. package/es/materials/sxp/popup/CommodityDetail/material.js +6 -0
  29. package/es/materials/sxp/popup/CommodityDetail/settingRender.js +4 -0
  30. package/es/materials/sxp/popup/CommodityDetailDiroNew/index.js +32 -18
  31. package/es/materials/sxp/popup/CommodityList/index.js +38 -20
  32. package/es/materials/sxp/popup/CommodityList/material.js +1 -0
  33. package/es/materials/sxp/popup/CommodityList/settingRender.js +5 -0
  34. package/es/materials/sxp/template/MultiCommodity/index.js +3 -3
  35. package/es/materials/sxp/template/MultiCommodityDiro/index.js +3 -3
  36. package/es/materials/sxp/template/components/CommodityGroup.d.ts +4 -0
  37. package/es/materials/sxp/template/components/CommodityGroup.js +21 -14
  38. package/es/materials/sxp/template/components/Img.d.ts +1 -0
  39. package/es/materials/sxp/template/components/Img.js +3 -3
  40. package/es/materials/sxp/template/components/Scroll.d.ts +1 -0
  41. package/es/materials/sxp/template/components/Scroll.js +5 -4
  42. package/lib/core/components/SxpPageRender/LikeButton/index.js +34 -15
  43. package/lib/core/components/SxpPageRender/Popup/index.js +25 -12
  44. package/lib/core/components/SxpPageRender/RenderCard.d.ts +1 -0
  45. package/lib/core/components/SxpPageRender/RenderCard.js +3 -3
  46. package/lib/core/components/SxpPageRender/index.js +4 -4
  47. package/lib/core/components/SxpPageRender/typing.d.ts +1 -0
  48. package/lib/core/context/SxpDataSourceProvider.d.ts +3 -3
  49. package/lib/core/context/SxpDataSourceProvider.js +7 -3
  50. package/lib/core/hooks/useEventReport.js +4 -4
  51. package/lib/materials/sxp/cta/AniLink/index.js +2 -1
  52. package/lib/materials/sxp/cta/AniLinkPopup/index.d.ts +1 -0
  53. package/lib/materials/sxp/cta/AniLinkPopup/index.js +10 -19
  54. package/lib/materials/sxp/popup/CommodityDetail/index.d.ts +1 -0
  55. package/lib/materials/sxp/popup/CommodityDetail/index.js +32 -15
  56. package/lib/materials/sxp/popup/CommodityDetail/material.js +6 -0
  57. package/lib/materials/sxp/popup/CommodityDetail/settingRender.js +4 -0
  58. package/lib/materials/sxp/popup/CommodityDetailDiroNew/index.js +32 -18
  59. package/lib/materials/sxp/popup/CommodityList/index.js +37 -19
  60. package/lib/materials/sxp/popup/CommodityList/material.js +1 -0
  61. package/lib/materials/sxp/popup/CommodityList/settingRender.js +5 -0
  62. package/lib/materials/sxp/template/MultiCommodity/index.js +3 -3
  63. package/lib/materials/sxp/template/MultiCommodityDiro/index.js +3 -3
  64. package/lib/materials/sxp/template/components/CommodityGroup.d.ts +4 -0
  65. package/lib/materials/sxp/template/components/CommodityGroup.js +20 -13
  66. package/lib/materials/sxp/template/components/Img.d.ts +1 -0
  67. package/lib/materials/sxp/template/components/Img.js +3 -3
  68. package/lib/materials/sxp/template/components/Scroll.d.ts +1 -0
  69. package/lib/materials/sxp/template/components/Scroll.js +5 -4
  70. package/package.json +1 -1
@@ -6,50 +6,69 @@ import { useSxpDataSource } from '../../../../core/hooks';
6
6
  const defaultUnLikeIconPath = '/pb_static/f71266d2c64446c5ae6a5a7f5489cc0a.png';
7
7
  const defaultLikeIconPath = '/pb_static/f07900fe3f0f4ae188ea1611d4801a44.png';
8
8
  const LikeButton = (_a) => {
9
+ var _b;
9
10
  var { active, activeIcon, unActicveIcon, recData, position } = _a, props = __rest(_a, ["active", "activeIcon", "unActicveIcon", "recData", "position"]);
10
- const { mutateLike, mutateUnlike, bffEventReport } = useSxpDataSource();
11
- const [state, setState] = useState(active);
11
+ const { mutateLike, mutateUnlike, bffEventReport, setCacheRtcList, cacheRtcList } = useSxpDataSource();
12
+ const [state, setState] = useState((_b = cacheRtcList === null || cacheRtcList === void 0 ? void 0 : cacheRtcList[position]) === null || _b === void 0 ? void 0 : _b.isCollected);
12
13
  const likeIcon = useIconLink(defaultLikeIconPath);
13
14
  const unlikeIcon = useIconLink(defaultUnLikeIconPath);
14
15
  const handleClick = debounce(() => __awaiter(void 0, void 0, void 0, function* () {
15
- var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
16
+ var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
16
17
  if (state) {
17
18
  setState(false);
18
- 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;
19
+ 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;
19
20
  bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
20
21
  eventInfo: {
21
22
  eventSubject: 'favoriteContentCanceled',
22
23
  eventDescription: 'This content was unfavorite by the user',
23
- 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 : '',
24
- 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 : '',
25
- 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 : []),
24
+ 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 : '',
25
+ 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 : '',
26
+ 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 : []),
26
27
  position: position + '',
27
- contentFormat: ((_l = recData === null || recData === void 0 ? void 0 : recData.video) === null || _l === void 0 ? void 0 : _l.url) ? 'video' : 'image',
28
- traceInfo: (_m = recData === null || recData === void 0 ? void 0 : recData.video) === null || _m === void 0 ? void 0 : _m.traceInfo
28
+ contentFormat: ((_m = recData === null || recData === void 0 ? void 0 : recData.video) === null || _m === void 0 ? void 0 : _m.url) ? 'video' : 'image',
29
+ traceInfo: (_o = recData === null || recData === void 0 ? void 0 : recData.video) === null || _o === void 0 ? void 0 : _o.traceInfo
29
30
  }
30
31
  });
31
32
  if (!result) {
32
33
  setState(true);
33
34
  }
35
+ else {
36
+ const nRtcList = (_p = cacheRtcList === null || cacheRtcList === void 0 ? void 0 : cacheRtcList.map((item, index) => {
37
+ if (index === position) {
38
+ item.isCollected = false;
39
+ }
40
+ return item;
41
+ })) !== null && _p !== void 0 ? _p : [];
42
+ setCacheRtcList === null || setCacheRtcList === void 0 ? void 0 : setCacheRtcList(nRtcList);
43
+ }
34
44
  }
35
45
  else {
36
46
  setState(true);
37
- const result = (_o = (yield (mutateLike === null || mutateLike === void 0 ? void 0 : mutateLike({ content: JSON.stringify(recData) })))) !== null && _o !== void 0 ? _o : false;
47
+ const result = (_q = (yield (mutateLike === null || mutateLike === void 0 ? void 0 : mutateLike({ content: JSON.stringify(recData) })))) !== null && _q !== void 0 ? _q : false;
38
48
  bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
39
49
  eventInfo: {
40
50
  eventSubject: 'favoriteContent',
41
51
  eventDescription: 'This content was favorite by the user',
42
- 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 : '',
43
- 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 : '',
44
- 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 : []),
52
+ 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 : '',
53
+ 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 : '',
54
+ 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 : []),
45
55
  position: position + '',
46
- contentFormat: ((_v = recData === null || recData === void 0 ? void 0 : recData.video) === null || _v === void 0 ? void 0 : _v.url) ? 'video' : 'image',
47
- traceInfo: (_w = recData === null || recData === void 0 ? void 0 : recData.video) === null || _w === void 0 ? void 0 : _w.traceInfo
56
+ contentFormat: ((_x = recData === null || recData === void 0 ? void 0 : recData.video) === null || _x === void 0 ? void 0 : _x.url) ? 'video' : 'image',
57
+ traceInfo: (_y = recData === null || recData === void 0 ? void 0 : recData.video) === null || _y === void 0 ? void 0 : _y.traceInfo
48
58
  }
49
59
  });
50
60
  if (!result) {
51
61
  setState(false);
52
62
  }
63
+ else {
64
+ const nRtcList = (_z = cacheRtcList === null || cacheRtcList === void 0 ? void 0 : cacheRtcList.map((item, index) => {
65
+ if (index === position) {
66
+ item.isCollected = true;
67
+ }
68
+ return item;
69
+ })) !== null && _z !== void 0 ? _z : [];
70
+ setCacheRtcList === null || setCacheRtcList === void 0 ? void 0 : setCacheRtcList(nRtcList);
71
+ }
53
72
  }
54
73
  }), 200);
55
74
  return (React.createElement("button", Object.assign({}, props, { "aria-label": 'like', onClick: handleClick }),
@@ -1,17 +1,16 @@
1
- import React, { useEffect, useMemo, useRef, useState } from 'react';
1
+ import React, { useEffect, useMemo, useState } from 'react';
2
2
  import Modal from '../Modal';
3
3
  import { useEditor, useSxpDataSource } from '../../../../core/hooks';
4
4
  import withBindDataSource from '../../../../core/hoc/withBindDataSource';
5
5
  import { useEventReport } from '../../../../core/hooks/useEventReport';
6
6
  const Popup = () => {
7
7
  const { schema, resolver, popup } = useEditor();
8
- const { setPopupDetailData, popupDetailData, bffEventReport } = useSxpDataSource();
8
+ const { setPopupDetailData, popupDetailData, popupCurTimeRef, checkCommodityIndexRef } = useSxpDataSource();
9
9
  const { productView } = useEventReport();
10
10
  const [visible, setVisible] = useState();
11
- const curTimeRef = useRef(null);
12
11
  useEffect(() => {
13
12
  const initTime = () => {
14
- curTimeRef.current = new Date();
13
+ popupCurTimeRef.current = new Date();
15
14
  };
16
15
  initTime();
17
16
  window.addEventListener('pageshow', initTime);
@@ -21,25 +20,39 @@ const Popup = () => {
21
20
  }, []);
22
21
  useEffect(() => {
23
22
  if (popup && (popup === null || popup === void 0 ? void 0 : popup.id) && (popup === null || popup === void 0 ? void 0 : popup.id) !== '') {
24
- curTimeRef.current = new Date();
23
+ popupCurTimeRef.current = new Date();
25
24
  setVisible(popup);
26
25
  }
27
26
  }, [popup]);
28
27
  const handleClose = () => {
29
- var _a, _b, _c, _d;
30
- 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)) {
28
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
29
+ if (!popup ||
30
+ (popup === null || popup === void 0 ? void 0 : popup.id) === '' ||
31
+ !visible ||
32
+ new Date() - popupCurTimeRef.current < ((_a = popup === null || popup === void 0 ? void 0 : popup.duration) !== null && _a !== void 0 ? _a : 0)) {
31
33
  return;
32
34
  }
33
35
  setVisible(Object.assign(Object.assign({}, popup), { id: '' }));
34
- const data = popupDetailData;
35
- const product = (_b = data === null || data === void 0 ? void 0 : data.video) === null || _b === void 0 ? void 0 : _b.bindProduct;
36
- 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;
37
- if (product && cta) {
38
- productView(data, product, cta, curTimeRef.current, popupDetailData === null || popupDetailData === void 0 ? void 0 : popupDetailData.index);
36
+ 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));
37
+ 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') {
38
+ const data = popupDetailData;
39
+ let product = (_g = data === null || data === void 0 ? void 0 : data.video) === null || _g === void 0 ? void 0 : _g.bindProduct;
40
+ 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;
41
+ if ((checkCommodityIndexRef === null || checkCommodityIndexRef === void 0 ? void 0 : checkCommodityIndexRef.current) >= 0) {
42
+ const p = (_l = (_k = data === null || data === void 0 ? void 0 : data.video) === null || _k === void 0 ? void 0 : _k.bindProducts) === null || _l === void 0 ? void 0 : _l[checkCommodityIndexRef === null || checkCommodityIndexRef === void 0 ? void 0 : checkCommodityIndexRef.current];
43
+ if (p) {
44
+ product = p;
45
+ cta = p === null || p === void 0 ? void 0 : p.bindCta;
46
+ }
47
+ }
48
+ if (product && cta) {
49
+ productView(data, product, cta, popupCurTimeRef.current, popupDetailData === null || popupDetailData === void 0 ? void 0 : popupDetailData.index);
50
+ }
39
51
  }
40
52
  setTimeout(() => {
41
53
  window === null || window === void 0 ? void 0 : window.sxpPopup('');
42
54
  setPopupDetailData === null || setPopupDetailData === void 0 ? void 0 : setPopupDetailData(null);
55
+ checkCommodityIndexRef.current = -1;
43
56
  }, popup === null || popup === void 0 ? void 0 : popup.duration);
44
57
  };
45
58
  const renderPopupDetail = useMemo(() => {
@@ -52,7 +65,7 @@ const Popup = () => {
52
65
  const isExternalLink = ((_d = (_c = (_b = value === null || value === void 0 ? void 0 : value.item) === null || _b === void 0 ? void 0 : _b.event) === null || _c === void 0 ? void 0 : _c.onClick) === null || _d === void 0 ? void 0 : _d.linkType) === 'externalLink';
53
66
  const isPopup = ((_g = (_f = (_e = value === null || value === void 0 ? void 0 : value.item) === null || _e === void 0 ? void 0 : _e.event) === null || _f === void 0 ? void 0 : _f.onClick) === null || _g === void 0 ? void 0 : _g.linkType) === 'popup';
54
67
  const defaulSetting = (_h = t === null || t === void 0 ? void 0 : t.extend) === null || _h === void 0 ? void 0 : _h.defaulSetting;
55
- return (React.createElement(Component, Object.assign({ key: index, style: Object.assign(Object.assign(Object.assign({}, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.style), (_j = value === null || value === void 0 ? void 0 : value.item) === null || _j === void 0 ? void 0 : _j.style), { width: (_k = window.innerWidth) !== null && _k !== void 0 ? _k : '100vw', height: '100%' }), textStyle: Object.assign(Object.assign({}, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.textStyle), (_l = value === null || value === void 0 ? void 0 : value.item) === null || _l === void 0 ? void 0 : _l.textStyle), bindDatas: (_o = (_m = value === null || value === void 0 ? void 0 : value.item) === null || _m === void 0 ? void 0 : _m.bindDatas) !== null && _o !== void 0 ? _o : [] }, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.props, (_p = value === null || value === void 0 ? void 0 : value.item) === null || _p === void 0 ? void 0 : _p.props, { event: ((_q = value === null || value === void 0 ? void 0 : value.item) === null || _q === void 0 ? void 0 : _q.event) || {}, schema: schema, id: value === null || value === void 0 ? void 0 : value.id, isExternalLink: isExternalLink, isPopup: isPopup, onClose: handleClose })));
68
+ return (React.createElement(Component, Object.assign({ key: index, style: Object.assign(Object.assign(Object.assign({}, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.style), (_j = value === null || value === void 0 ? void 0 : value.item) === null || _j === void 0 ? void 0 : _j.style), { width: (_k = window.innerWidth) !== null && _k !== void 0 ? _k : '100vw', height: '100%' }), textStyle: Object.assign(Object.assign({}, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.textStyle), (_l = value === null || value === void 0 ? void 0 : value.item) === null || _l === void 0 ? void 0 : _l.textStyle), bindDatas: (_o = (_m = value === null || value === void 0 ? void 0 : value.item) === null || _m === void 0 ? void 0 : _m.bindDatas) !== null && _o !== void 0 ? _o : [] }, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.props, (_p = value === null || value === void 0 ? void 0 : value.item) === null || _p === void 0 ? void 0 : _p.props, { event: ((_q = value === null || value === void 0 ? void 0 : value.item) === null || _q === void 0 ? void 0 : _q.event) || {}, schema: schema, id: value === null || value === void 0 ? void 0 : value.id, isExternalLink: isExternalLink, isPopup: isPopup, onClose: handleClose, index: index })));
56
69
  }
57
70
  else {
58
71
  return React.createElement(React.Fragment, null);
@@ -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;
@@ -2,7 +2,7 @@ import React, { memo, useMemo } from 'react';
2
2
  import './index.less';
3
3
  import withBindDataSource from '../../../core/hoc/withBindDataSource';
4
4
  import { useEditor } from '../../../core/hooks';
5
- const RenderCard = ({ rec, index, tempMap, resolver, includesCtaType }) => {
5
+ const RenderCard = ({ rec, index, tempMap, resolver, includesCtaType, isActive }) => {
6
6
  var _a, _b, _c, _d, _e;
7
7
  const { schema } = useEditor();
8
8
  if (!(rec === null || rec === void 0 ? void 0 : rec.video))
@@ -49,12 +49,12 @@ const RenderCard = ({ rec, index, tempMap, resolver, includesCtaType }) => {
49
49
  const Component = withBindDataSource(t);
50
50
  const defaulSetting = (_z = t === null || t === void 0 ? void 0 : t.extend) === null || _z === void 0 ? void 0 : _z.defaulSetting;
51
51
  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';
52
- return (React.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 })));
52
+ return (React.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 })));
53
53
  }
54
54
  else {
55
55
  return null;
56
56
  }
57
- }, [rec, resolver, tempMap, schema, value === null || value === void 0 ? void 0 : value.id]);
57
+ }, [rec, resolver, tempMap, schema, value === null || value === void 0 ? void 0 : value.id, isActive]);
58
58
  return React.createElement(React.Fragment, null, renderComp);
59
59
  };
60
60
  export default memo(RenderCard);
@@ -232,7 +232,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
232
232
  React.createElement(ExpandableText, { className: 'clc-sxp-bottom-text', isPost: true, foldText: tipText === null || tipText === void 0 ? void 0 : tipText.foldText, unfoldText: tipText === null || tipText === void 0 ? void 0 : tipText.unfoldText, text: (_d = (_c = rec === null || rec === void 0 ? void 0 : rec.video) === null || _c === void 0 ? void 0 : _c.title) !== null && _d !== void 0 ? _d : '', style: Object.assign(Object.assign({}, descStyle), { textShadow: (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isOpenTextShadow) ? '2px 2px 4px rgba(0, 0, 0, 0.5)' : 'none' }), onChange: onExpandableChange }),
233
233
  React.createElement(RenderCard, { rec: rec, index: index, tempMap: tempMap, resolver: resolver, includesCtaType: ['AniLink'] }),
234
234
  React.createElement(Hashtag, { index: activeIndex, tags: (_f = (_e = rec === null || rec === void 0 ? void 0 : rec.video) === null || _e === void 0 ? void 0 : _e.hashTags) !== null && _f !== void 0 ? _f : [], itemId: (_g = rec === null || rec === void 0 ? void 0 : rec.video) === null || _g === void 0 ? void 0 : _g.itemId, itemType: ((_h = rec === null || rec === void 0 ? void 0 : rec.video) === null || _h === void 0 ? void 0 : _h.itemId) ? 'VIDEO' : null, rec: rec, hashTagStyle: hashTagStyle }))),
235
- React.createElement(RenderCard, { rec: rec, index: index, tempMap: tempMap, resolver: resolver, includesCtaType: ['AniLinkPopup'] })));
235
+ React.createElement(RenderCard, { rec: rec, index: index, tempMap: tempMap, resolver: resolver, includesCtaType: ['AniLinkPopup'], isActive: index === activeIndex })));
236
236
  }
237
237
  return null;
238
238
  }, [
@@ -286,8 +286,8 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
286
286
  }
287
287
  };
288
288
  const handleSlideSkip = (item, position) => {
289
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
290
- if (isPreview)
289
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
290
+ if (isPreview || waterFallData)
291
291
  return;
292
292
  const t = new Date() - curTime.current;
293
293
  if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.openSlideSkip) && t >= ((_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.slideSkipStartTime) !== null && _a !== void 0 ? _a : 0) && getSlideSkipState() && item) {
@@ -305,7 +305,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
305
305
  contentTags: (product === null || product === void 0 ? void 0 : product.tags) ? JSON.stringify(product === null || product === void 0 ? void 0 : product.tags) : '',
306
306
  position: position + '',
307
307
  contentId: (_q = (_p = item === null || item === void 0 ? void 0 : item.video) === null || _p === void 0 ? void 0 : _p.itemId) !== null && _q !== void 0 ? _q : '',
308
- traceInfo: (_r = product === null || product === void 0 ? void 0 : product.traceInfo) !== null && _r !== void 0 ? _r : ''
308
+ traceInfo: (_s = (_r = item === null || item === void 0 ? void 0 : item.video) === null || _r === void 0 ? void 0 : _r.traceInfo) !== null && _s !== void 0 ? _s : ''
309
309
  }
310
310
  });
311
311
  setSlideSkipState();
@@ -14,6 +14,7 @@ export type RecItemType = {
14
14
  hashTags: string[];
15
15
  tags: string[];
16
16
  multiCheckIndex?: number;
17
+ index?: number;
17
18
  };
18
19
  export type CTAInfoType = {
19
20
  traceInfo: string;
@@ -23,9 +23,7 @@ export interface ISxpDataSourceContext {
23
23
  mutateLike?: (body: {
24
24
  content: string;
25
25
  }) => Promise<boolean>;
26
- popupDetailData?: RecItemType & {
27
- index: number;
28
- };
26
+ popupDetailData?: RecItemType;
29
27
  setPopupDetailData?: React.Dispatch<React.SetStateAction<any | null>>;
30
28
  loadVideos?: (page: number) => Promise<void>;
31
29
  getRecommendVideos?: (query?: {
@@ -81,6 +79,8 @@ export interface ISxpDataSourceContext {
81
79
  selectTag?: string;
82
80
  setSelectTag?: React.Dispatch<React.SetStateAction<string>>;
83
81
  globalConfig?: ISxpPageRenderProps['globalConfig'];
82
+ popupCurTimeRef?: any;
83
+ checkCommodityIndexRef?: any;
84
84
  }
85
85
  export declare const SxpDataSourceContext: React.Context<ISxpDataSourceContext>;
86
86
  export interface SxpDataSourceProviderProps {
@@ -34,6 +34,8 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
34
34
  const themeTag = useRef();
35
35
  const curTime = useRef();
36
36
  const [selectTag, setSelectTag] = useState(DEFAULT_TAG);
37
+ const checkCommodityIndexRef = useRef(-1);
38
+ const popupCurTimeRef = useRef(null);
37
39
  const isShowConsent = useMemo(() => {
38
40
  var _a, _b, _c, _d;
39
41
  return (((_d = (_c = (_b = (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.consent) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.item) === null || _c === void 0 ? void 0 : _c.props) === null || _d === void 0 ? void 0 : _d.privacy_necessity) && !isAgreePolicy && !isEditor) || isOpenConsent;
@@ -190,7 +192,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
190
192
  }
191
193
  }), [bffFetch, utmVal, isShowTag]);
192
194
  const ctaEvent = useCallback((eventInfo, rec, product, position) => {
193
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
195
+ var _a, _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, _2;
194
196
  const cta = product === null || product === void 0 ? void 0 : product.bindCta;
195
197
  const isProd = ((_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.bindProduct) || (((_b = rec === null || rec === void 0 ? void 0 : rec.video) === null || _b === void 0 ? void 0 : _b.bindProducts) && ((_d = (_c = rec === null || rec === void 0 ? void 0 : rec.video) === null || _c === void 0 ? void 0 : _c.bindProducts) === null || _d === void 0 ? void 0 : _d.length) > 0);
196
198
  let fromKName = '';
@@ -204,7 +206,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
204
206
  fromKName = 'imagePage';
205
207
  }
206
208
  bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
207
- eventInfo: Object.assign(Object.assign({}, eventInfo), { ctaId: (_h = cta === null || cta === void 0 ? void 0 : cta.itemId) !== null && _h !== void 0 ? _h : '', ctaName: (_j = cta === null || cta === void 0 ? void 0 : cta.title) !== null && _j !== void 0 ? _j : '', contentTags: JSON.stringify(cta === null || cta === void 0 ? void 0 : cta.tags), position: position + '', contentId: (_l = (_k = rec === null || rec === void 0 ? void 0 : rec.video) === null || _k === void 0 ? void 0 : _k.itemId) !== null && _l !== void 0 ? _l : '', productId: isProd ? product === null || product === void 0 ? void 0 : product.itemId : '', traceInfo: (_m = cta === null || cta === void 0 ? void 0 : cta.traceInfo) !== null && _m !== void 0 ? _m : '', fromKName })
209
+ eventInfo: Object.assign(Object.assign({}, eventInfo), { ctaId: (_h = cta === null || cta === void 0 ? void 0 : cta.itemId) !== null && _h !== void 0 ? _h : '', ctaName: (_j = cta === null || cta === void 0 ? void 0 : cta.title) !== null && _j !== void 0 ? _j : '', contentTags: JSON.stringify(cta === null || cta === void 0 ? void 0 : cta.tags), position: position + '', contentId: (_l = (_k = rec === null || rec === void 0 ? void 0 : rec.video) === null || _k === void 0 ? void 0 : _k.itemId) !== null && _l !== void 0 ? _l : '', productId: isProd ? product === null || product === void 0 ? void 0 : product.itemId : '', traceInfo: (_1 = (_y = (_t = (_p = (_o = (_m = rec === null || rec === void 0 ? void 0 : rec.video) === null || _m === void 0 ? void 0 : _m.bindCta) === null || _o === void 0 ? void 0 : _o.traceInfo) !== null && _p !== void 0 ? _p : (_s = (_r = (_q = rec === null || rec === void 0 ? void 0 : rec.video) === null || _q === void 0 ? void 0 : _q.bindProduct) === null || _r === void 0 ? void 0 : _r.bindCta) === null || _s === void 0 ? void 0 : _s.traceInfo) !== null && _t !== void 0 ? _t : (_x = (_w = (_v = (_u = rec === null || rec === void 0 ? void 0 : rec.video) === null || _u === void 0 ? void 0 : _u.bindProducts) === null || _v === void 0 ? void 0 : _v[0]) === null || _w === void 0 ? void 0 : _w.bindCta) === null || _x === void 0 ? void 0 : _x.traceInfo) !== null && _y !== void 0 ? _y : (_0 = (_z = rec === null || rec === void 0 ? void 0 : rec.product) === null || _z === void 0 ? void 0 : _z.bindCta) === null || _0 === void 0 ? void 0 : _0.traceInfo) !== null && _1 !== void 0 ? _1 : '', fromKName, fromKPage: (_2 = location === null || location === void 0 ? void 0 : location.href) !== null && _2 !== void 0 ? _2 : '' })
208
210
  });
209
211
  }, [bffEventReport, isFromHashtag]);
210
212
  const h5EnterLink = useCallback(() => {
@@ -319,7 +321,9 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
319
321
  isShowConsent,
320
322
  selectTag,
321
323
  setSelectTag,
322
- globalConfig
324
+ globalConfig,
325
+ popupCurTimeRef,
326
+ checkCommodityIndexRef
323
327
  } }, isShowConsent ? (React.createElement(Consent, Object.assign({}, (_c = (_b = (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.consent) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.item) === null || _c === void 0 ? void 0 : _c.props))) : (render({
324
328
  rtcList,
325
329
  mutateLike: bffMutateLike,
@@ -4,7 +4,7 @@ import { DEFAULT_TAG } from '../context/SxpDataSourceProvider';
4
4
  export function useEventReport() {
5
5
  const { bffEventReport, popupDetailData, waterFallData, isFromHashtag } = useSxpDataSource();
6
6
  const jumpToWeb = useCallback((data, product, cta, position) => {
7
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
7
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
8
8
  let fromKName = '';
9
9
  if (popupDetailData && (((_b = (_a = data === null || data === void 0 ? void 0 : data.video) === null || _a === void 0 ? void 0 : _a.bindProducts) === null || _b === void 0 ? void 0 : _b.length) || ((_c = data === null || data === void 0 ? void 0 : data.video) === null || _c === void 0 ? void 0 : _c.bindProduct))) {
10
10
  fromKName = 'pdpPage';
@@ -35,12 +35,12 @@ export function useEventReport() {
35
35
  position: position + '',
36
36
  contentId: (_m = (_l = data === null || data === void 0 ? void 0 : data.video) === null || _l === void 0 ? void 0 : _l.itemId) !== null && _m !== void 0 ? _m : '',
37
37
  ctatId: (_o = cta === null || cta === void 0 ? void 0 : cta.itemId) !== null && _o !== void 0 ? _o : '',
38
- traceInfo: (_p = product === null || product === void 0 ? void 0 : product.traceInfo) !== null && _p !== void 0 ? _p : ''
38
+ traceInfo: (_0 = (_x = (_v = (_r = (_q = (_p = data === null || data === void 0 ? void 0 : data.video) === null || _p === void 0 ? void 0 : _p.bindProduct) === null || _q === void 0 ? void 0 : _q.traceInfo) !== null && _r !== void 0 ? _r : (_u = (_t = (_s = data === null || data === void 0 ? void 0 : data.video) === null || _s === void 0 ? void 0 : _s.bindProducts) === null || _t === void 0 ? void 0 : _t[0]) === null || _u === void 0 ? void 0 : _u.traceInfo) !== null && _v !== void 0 ? _v : (_w = data === null || data === void 0 ? void 0 : data.product) === null || _w === void 0 ? void 0 : _w.traceInfo) !== null && _x !== void 0 ? _x : (_z = (_y = data === null || data === void 0 ? void 0 : data.video) === null || _y === void 0 ? void 0 : _y.bindCta) === null || _z === void 0 ? void 0 : _z.traceInfo) !== null && _0 !== void 0 ? _0 : ''
39
39
  }
40
40
  });
41
41
  }, [bffEventReport, popupDetailData, isFromHashtag]);
42
42
  const productView = useCallback((data, product, cta, viewTime, position) => {
43
- var _a, _b, _c, _d;
43
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
44
44
  let fromKName = '';
45
45
  if (popupDetailData && (((_b = (_a = data === null || data === void 0 ? void 0 : data.video) === null || _a === void 0 ? void 0 : _a.bindProducts) === null || _b === void 0 ? void 0 : _b.length) || ((_c = data === null || data === void 0 ? void 0 : data.video) === null || _c === void 0 ? void 0 : _c.bindProduct))) {
46
46
  fromKName = 'pdpPage';
@@ -60,7 +60,7 @@ export function useEventReport() {
60
60
  position: position + '',
61
61
  contentId: (_d = data === null || data === void 0 ? void 0 : data.video) === null || _d === void 0 ? void 0 : _d.itemId,
62
62
  ctatId: cta === null || cta === void 0 ? void 0 : cta.itemId,
63
- traceInfo: product === null || product === void 0 ? void 0 : product.traceInfo,
63
+ traceInfo: (_o = (_l = (_g = (_f = (_e = data === null || data === void 0 ? void 0 : data.video) === null || _e === void 0 ? void 0 : _e.bindProduct) === null || _f === void 0 ? void 0 : _f.traceInfo) !== null && _g !== void 0 ? _g : (_k = (_j = (_h = data === null || data === void 0 ? void 0 : data.video) === null || _h === void 0 ? void 0 : _h.bindProducts) === null || _j === void 0 ? void 0 : _j[0]) === null || _k === void 0 ? void 0 : _k.traceInfo) !== null && _l !== void 0 ? _l : (_m = data === null || data === void 0 ? void 0 : data.product) === null || _m === void 0 ? void 0 : _m.traceInfo) !== null && _o !== void 0 ? _o : '',
64
64
  timeOnSite: Math.floor((new Date() - viewTime) / 1000) + '',
65
65
  eventSubject: 'productView',
66
66
  eventDescription: 'User browsed the product'
@@ -51,11 +51,12 @@ const AniLink = (_a) => {
51
51
  }
52
52
  }, [event === null || event === void 0 ? void 0 : event.animation]);
53
53
  useEffect(() => {
54
+ var _a, _b, _c;
54
55
  if (isOnScreen && (ref === null || ref === void 0 ? void 0 : ref.current)) {
55
56
  ctaEvent === null || ctaEvent === void 0 ? void 0 : ctaEvent({
56
57
  eventSubject: 'ctaExposure',
57
58
  eventDescription: 'The cta was shown to the user'
58
- }, recData, product, index);
59
+ }, recData, ((_b = (_a = recData === null || recData === void 0 ? void 0 : recData.video) === null || _a === void 0 ? void 0 : _a.bindProducts) === null || _b === void 0 ? void 0 : _b[0]) || ((_c = recData === null || recData === void 0 ? void 0 : recData.video) === null || _c === void 0 ? void 0 : _c.bindProduct) || (recData === null || recData === void 0 ? void 0 : recData.video), index);
59
60
  }
60
61
  }, [isOnScreen]);
61
62
  useEffect(() => {
@@ -12,6 +12,7 @@ export interface IAniLinkPopupProps {
12
12
  isTel?: boolean;
13
13
  onClick?: () => void;
14
14
  isExternalLink?: boolean;
15
+ isActive?: boolean;
15
16
  }
16
17
  declare const _default: React.NamedExoticComponent<IAniLinkPopupProps>;
17
18
  export default _default;
@@ -1,23 +1,19 @@
1
1
  import { __rest } from "tslib";
2
2
  import { css } from '@emotion/css';
3
- import React, { memo, useEffect, useMemo, useRef, useState } from 'react';
3
+ import React, { memo, useEffect, useMemo, useState } from 'react';
4
4
  import { useSxpDataSource } from '../../../../core/hooks';
5
5
  import { useEventReport } from '../../../../core/hooks/useEventReport';
6
6
  import Img from '../../template/components/Img';
7
7
  import { setFontForText } from '../../../../core/utils/tool';
8
8
  import styles from './index.module.less';
9
- import useOnScreen from '../../../../core/hooks/useOnScreen';
10
9
  const closeIcon = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAjhJREFUWEfFlztOw0AQhmeWiJ4CCmpQ5DiRQsIJyAWg5A0lR0AIChDiCJS8ER0cADgBeRSxt4CCDgkaKiq8i+zYeWx2413HEWmiJJv9v535Z2aN8M8vFPT9z3zETD0aAUChUJjwvPFHAJhBhB3Hqd6OAsK2yyucwykAvP38eJX398Z3AJDLlVYR8ToU9Rhj25TWr9KEsKy5dULIGQCMtfZly45TvwsAstm56UwG6wA4FUFwzrdctxZBDcWSy5XWEPG8I84/GcMipdWPtgcsaz5PCHtKG0IuTiqUvjT9U/WYMG2IOPE+AP+LtCB0xKUAAyA2Xbd2o2OG0NQXvTnvhL17D7EPtH9TRCIWwkRcGYGIQgYBABuqPuHXOQBc6pw80lBGwBQiiXhsBHQhkoprA6iM6acjhDQKu5YJZW6XeOI3XJdpvfsdTu52VfXEekD8owQiXGIubpSCbhDbLu8DwKEAd+A41SOdPpE4BS0viFOtvV2iKWqUgn5x/tmS70xR01GuDSCKc86/OCcLgTyyZ0ScDGNhFAktAJV4NFJ9YyaFiAWIE+9uVkkgBgLoig8DMWAa9ro9ynkUdlW5maZDCmB6clmz0k1HH4Cs1Ezbq2p2yEpUuBOKTSZZex00RUWIrltxuuK6EOGDSbGIOPZicpMx6fny650377qNRgBgWeVFQuA+6UjVgREhGIMlSqsPUQqIbZdOOIdZQmCv2axRnU1N1+TzJYsxOEaEV8ep7frPZ7Gd0FTEdP0ft0/kMNdg0eoAAAAASUVORK5CYII=';
11
10
  const AniLinkPopup = (_a) => {
12
11
  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;
13
- var { style, recData, ctaTempStyles, index, event, bottom_image, translateY, isTel, onClick, isExternalLink = false } = _a, props = __rest(_a, ["style", "recData", "ctaTempStyles", "index", "event", "bottom_image", "translateY", "isTel", "onClick", "isExternalLink"]);
12
+ var { style, recData, ctaTempStyles, index, event, bottom_image, translateY, isTel, onClick, isExternalLink = false, isActive } = _a, props = __rest(_a, ["style", "recData", "ctaTempStyles", "index", "event", "bottom_image", "translateY", "isTel", "onClick", "isExternalLink", "isActive"]);
14
13
  style === null || style === void 0 ? true : delete style.transform;
15
14
  const { sxpParameter, globalConfig, ctaEvent, setPopupDetailData } = useSxpDataSource();
16
15
  const { jumpToWeb } = useEventReport();
17
- const ref = useRef(null);
18
- const isOnScreen = useOnScreen(ref);
19
- const [visible, setVisible] = useState(false);
20
- const [startAni, setStartAni] = useState(true);
16
+ const [visible, setVisible] = useState(true);
21
17
  const cta = ((_d = (_c = (_b = recData === null || recData === void 0 ? void 0 : recData.video) === null || _b === void 0 ? void 0 : _b.bindProducts) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.bindCta) || ((_f = (_e = recData === null || recData === void 0 ? void 0 : recData.video) === null || _e === void 0 ? void 0 : _e.bindProduct) === null || _f === void 0 ? void 0 : _f.bindCta) || ((_g = recData === null || recData === void 0 ? void 0 : recData.video) === null || _g === void 0 ? void 0 : _g.bindCta);
22
18
  const product = ((_j = (_h = recData === null || recData === void 0 ? void 0 : recData.video) === null || _h === void 0 ? void 0 : _h.bindProducts) === null || _j === void 0 ? void 0 : _j[0]) || ((_k = recData === null || recData === void 0 ? void 0 : recData.video) === null || _k === void 0 ? void 0 : _k.bindProduct);
23
19
  const handleTo = () => {
@@ -53,26 +49,21 @@ const AniLinkPopup = (_a) => {
53
49
  const src = (_q = (_p = (_o = (_l = product === null || product === void 0 ? void 0 : product.cover) !== null && _l !== void 0 ? _l : (_m = product === null || product === void 0 ? void 0 : product.homePage) === null || _m === void 0 ? void 0 : _m[0]) !== null && _o !== void 0 ? _o : cta === null || cta === void 0 ? void 0 : cta.icon) !== null && _p !== void 0 ? _p : sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) !== null && _q !== void 0 ? _q : bottom_image;
54
50
  const onClose = (event) => {
55
51
  event.stopPropagation();
56
- setStartAni(false);
52
+ setVisible(false);
57
53
  };
58
54
  useEffect(() => {
59
- if (isOnScreen) {
60
- setVisible(true);
61
- }
62
- else {
63
- setVisible(false);
64
- }
65
- }, [isOnScreen]);
55
+ setVisible(true);
56
+ }, [isActive]);
66
57
  const aniNamStyle = useMemo(() => {
67
- if (!visible)
58
+ if (!isActive)
68
59
  return null;
69
- return startAni ? styles['animated-fadeIn'] : null;
70
- }, [visible, startAni]);
60
+ return visible ? styles['animated-fadeIn'] : null;
61
+ }, [isActive, visible]);
71
62
  return (React.createElement(React.Fragment, null, isTel ? (React.createElement("div", { style: {
72
63
  height: '40px',
73
64
  lineHeight: '40px',
74
65
  paddingLeft: '6px'
75
- } }, "Cta Title")) : (React.createElement(React.Fragment, null, aniNamStyle ? (React.createElement("div", Object.assign({ ref: ref }, props, { className: `${css(Object.assign(Object.assign({}, style), { '--transY': `translateY(calc(100% + ${(_r = style === null || style === void 0 ? void 0 : style.margin) !== null && _r !== void 0 ? _r : 0}px))` }))} ${styles['aniLinkPopup']} ${aniNamStyle} ${css(aniTimStyle)}`, onClick: handleTo }),
66
+ } }, "Cta Title")) : (React.createElement("div", Object.assign({}, props, { className: `${css(Object.assign(Object.assign({}, style), { '--transY': `translateY(calc(100% + ${(_r = style === null || style === void 0 ? void 0 : style.margin) !== null && _r !== void 0 ? _r : 0}px))` }))} ${styles['aniLinkPopup']} ${aniNamStyle} ${css(aniTimStyle)}`, onClick: handleTo }),
76
67
  React.createElement("div", { onClick: onClose, className: styles['modal-icon-wrapper'], style: { padding: (_s = style === null || style === void 0 ? void 0 : style['padding']) !== null && _s !== void 0 ? _s : 0 } },
77
68
  React.createElement("img", { src: (_t = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.popupCloseIcon) !== null && _t !== void 0 ? _t : closeIcon, alt: 'close', className: styles['modal-icon-wrapper-img'] })),
78
69
  React.createElement(Img, { src: src, rec: recData, item: (_y = (_w = (_v = (_u = recData === null || recData === void 0 ? void 0 : recData.video) === null || _u === void 0 ? void 0 : _u.bindProducts) === null || _v === void 0 ? void 0 : _v[0]) !== null && _w !== void 0 ? _w : (_x = recData === null || recData === void 0 ? void 0 : recData.video) === null || _x === void 0 ? void 0 : _x.bindProduct) !== null && _y !== void 0 ? _y : recData === null || recData === void 0 ? void 0 : recData.video, index: index, translateY: translateY, imgStyle: ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.img }),
@@ -81,6 +72,6 @@ const AniLinkPopup = (_a) => {
81
72
  } })),
82
73
  React.createElement("div", { className: styles['one-line-ellipsis'], style: Object.assign(Object.assign({}, ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.ctaTitle), { lineHeight: ((_0 = ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.ctaTitle) === null || _0 === void 0 ? void 0 : _0.height) + 'px' }), dangerouslySetInnerHTML: {
83
74
  __html: setFontForText(title, ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.ctaTitle)
84
- } }))) : (React.createElement("div", { ref: ref, style: { position: 'absolute', height: '50px', width: '50px', bottom: 0, right: 0, zIndex: 1000 } }))))));
75
+ } })))));
85
76
  };
86
77
  export default memo(AniLinkPopup);
@@ -27,6 +27,7 @@ export interface ICommodityDetailProps {
27
27
  collection: CSSProperties;
28
28
  price: CSSProperties;
29
29
  info: CSSProperties;
30
+ taxInfo: CSSProperties;
30
31
  };
31
32
  buttonStyle?: CSSProperties;
32
33
  index?: number;
@@ -12,18 +12,26 @@ 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 CommodityDetail = (_a) => {
15
- var _b, _c, _d, _e, _f, _g, _h, _j, _k;
15
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
16
16
  var { content, style, bgImg, onClick, schema, isDefault, bottom_image, tipText, isPost, viewTime, rec, swiper, commodityStyles, buttonStyle, index, commodityGroup } = _a, props = __rest(_a, ["content", "style", "bgImg", "onClick", "schema", "isDefault", "bottom_image", "tipText", "isPost", "viewTime", "rec", "swiper", "commodityStyles", "buttonStyle", "index", "commodityGroup"]);
17
- const { sxpParameter } = useSxpDataSource();
18
- const { popupDetailData, bffEventReport, isPreview, bffFbReport } = useSxpDataSource();
17
+ const { sxpParameter, popupDetailData, isPreview, bffFbReport, popupCurTimeRef, checkCommodityIndexRef } = useSxpDataSource();
19
18
  const { jumpToWeb, productView } = useEventReport();
20
19
  const curTimeRef = useRef(null);
21
20
  const [showModal, setShowModal] = useState(false);
22
21
  const [show3DModal, setShow3DModal] = useState(false);
22
+ const [checkCommodityIndex, setCheckCommodityIndex] = useState((_b = popupDetailData === null || popupDetailData === void 0 ? void 0 : popupDetailData.multiCheckIndex) !== null && _b !== void 0 ? _b : 0);
23
23
  const data = isPost ? rec : popupDetailData;
24
- 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;
25
- 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;
24
+ 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];
25
+ let cta = isPost
26
+ ? (_g = data === null || data === void 0 ? void 0 : data.product) === null || _g === void 0 ? void 0 : _g.bindCta
27
+ : (_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;
26
28
  const position = isPost ? index : popupDetailData === null || popupDetailData === void 0 ? void 0 : popupDetailData.index;
29
+ 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) {
30
+ checkCommodityIndexRef.current = checkCommodityIndex;
31
+ const p = (_s = data === null || data === void 0 ? void 0 : data.video) === null || _s === void 0 ? void 0 : _s.bindProducts[checkCommodityIndex];
32
+ product = p;
33
+ cta = p === null || p === void 0 ? void 0 : p.bindCta;
34
+ }
27
35
  const handleLink = () => {
28
36
  if (product === null || product === void 0 ? void 0 : product.link) {
29
37
  jumpToWeb(data, product, cta, position);
@@ -61,9 +69,9 @@ const CommodityDetail = (_a) => {
61
69
  return '$7,000';
62
70
  }
63
71
  }, [product === null || product === void 0 ? void 0 : product.price, product === null || product === void 0 ? void 0 : product.currency]);
64
- const width = isPreview ? 375 : (_f = style === null || style === void 0 ? void 0 : style.width) !== null && _f !== void 0 ? _f : window.innerWidth;
72
+ const width = isPreview ? 375 : (_t = style === null || style === void 0 ? void 0 : style.width) !== null && _t !== void 0 ? _t : window.innerWidth;
65
73
  const renderContent = ({ isPost }) => {
66
- var _a, _b, _c;
74
+ var _a, _b, _c, _d;
67
75
  return (React.createElement("div", null,
68
76
  React.createElement("div", { className: 'pb-commondity-content-collection', style: getStyle(commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.collection), hidden: !!product && (!(product === null || product === void 0 ? void 0 : product.collection) || (product === null || product === void 0 ? void 0 : product.collection) === ''), dangerouslySetInnerHTML: {
69
77
  __html: setFontForText((_a = product === null || product === void 0 ? void 0 : product.collection) !== null && _a !== void 0 ? _a : 'Tiffany Lock', commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.collection)
@@ -74,8 +82,11 @@ const CommodityDetail = (_a) => {
74
82
  React.createElement("div", { className: 'pb-commondity-content-price', style: getStyle(commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price), hidden: !!product && !(product === null || product === void 0 ? void 0 : product.price), dangerouslySetInnerHTML: {
75
83
  __html: setFontForText(priceText, commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price)
76
84
  } }),
85
+ React.createElement("div", { hidden: !!product && !(product === null || product === void 0 ? void 0 : product.taxInfo), style: getStyle(commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.taxInfo), dangerouslySetInnerHTML: {
86
+ __html: setFontForText((_c = product === null || product === void 0 ? void 0 : product.taxInfo) !== null && _c !== void 0 ? _c : '税费', commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.taxInfo)
87
+ } }),
77
88
  React.createElement("div", { hidden: !!product && (!(product === null || product === void 0 ? void 0 : product.info) || (product === null || product === void 0 ? void 0 : product.info) === '') },
78
- React.createElement(ExpandableText, { foldText: tipText === null || tipText === void 0 ? void 0 : tipText.foldText, unfoldText: tipText === null || tipText === void 0 ? void 0 : tipText.unfoldText, onClick: () => setShowModal(true), isPost: isPost, text: (_c = product === null || product === void 0 ? void 0 : product.info) !== null && _c !== void 0 ? _c : `The design inspiration of Tiffany Lock series comes from the power of connection and inclusiveness, and the
89
+ React.createElement(ExpandableText, { foldText: tipText === null || tipText === void 0 ? void 0 : tipText.foldText, unfoldText: tipText === null || tipText === void 0 ? void 0 : tipText.unfoldText, onClick: () => setShowModal(true), isPost: isPost, text: (_d = product === null || product === void 0 ? void 0 : product.info) !== null && _d !== void 0 ? _d : `The design inspiration of Tiffany Lock series comes from the power of connection and inclusiveness, and the
79
90
  bold and avant-garde visual design interprets the emotional bond connecting my heart. The Tiffany Lock
80
91
  collection is unisex and is inspired by the padlock pattern found in the Tiffany Antique Collection. This
81
92
  necklace features a stylish and eye-catching oval clasp chain decorated with a lock pattern. Crafted from
@@ -94,15 +105,20 @@ const CommodityDetail = (_a) => {
94
105
  }
95
106
  return style;
96
107
  }, []);
108
+ const handleClick = useCallback((index) => {
109
+ popupCurTimeRef.current = new Date();
110
+ setCheckCommodityIndex(index);
111
+ checkCommodityIndexRef.current = index;
112
+ }, []);
97
113
  const renderCommodityGroup = useCallback(() => {
98
114
  var _a, _b, _c;
99
115
  if (isPost)
100
116
  return;
101
- 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' } }));
102
- }, []);
117
+ 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 }));
118
+ }, [checkCommodityIndex]);
103
119
  return (React.createElement(React.Fragment, null,
104
120
  React.createElement("div", Object.assign({ className: css(Object.assign({}, style)) }, props),
105
- product && ((_g = product === null || product === void 0 ? void 0 : product.homePage) === null || _g === void 0 ? void 0 : _g.length) > 0 && (React.createElement("div", { style: { position: 'relative' } },
121
+ product && ((_u = product === null || product === void 0 ? void 0 : product.homePage) === null || _u === void 0 ? void 0 : _u.length) > 0 && (React.createElement("div", { style: { position: 'relative' } },
106
122
  React.createElement(Swiper, { height: width, modules: [Pagination, Autoplay], pagination: {
107
123
  clickable: true,
108
124
  bulletActiveClass: 'swipe-item-active-bullet',
@@ -112,7 +128,8 @@ const CommodityDetail = (_a) => {
112
128
  }, loop: true, autoplay: {
113
129
  delay: (swiper === null || swiper === void 0 ? void 0 : swiper.delay) * 1000
114
130
  } },
115
- React.createElement(React.Fragment, null, (_h = product === null || product === void 0 ? void 0 : product.homePage) === null || _h === void 0 ? void 0 : _h.map((src) => {
131
+ React.createElement(React.Fragment, null, (_v = product === null || product === void 0 ? void 0 : product.homePage) === null || _v === void 0 ? void 0 : _v.map((src) => {
132
+ var _a;
116
133
  return (React.createElement(SwiperSlide, { key: src },
117
134
  React.createElement("div", { style: {
118
135
  overflow: 'hidden',
@@ -125,9 +142,9 @@ const CommodityDetail = (_a) => {
125
142
  objectFit: 'cover',
126
143
  display: 'block',
127
144
  objectPosition: `50% ${(swiper === null || swiper === void 0 ? void 0 : swiper.translateY) ? (swiper === null || swiper === void 0 ? void 0 : swiper.translateY) + 50 : 50}%`
128
- }, src: src }))));
145
+ }, src: (_a = src !== null && src !== void 0 ? src : sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) !== null && _a !== void 0 ? _a : bottom_image }))));
129
146
  }))))),
130
- !((_j = product === null || product === void 0 ? void 0 : product.homePage) === null || _j === void 0 ? void 0 : _j.length) && (React.createElement("div", { className: css({
147
+ !((_w = product === null || product === void 0 ? void 0 : product.homePage) === null || _w === void 0 ? void 0 : _w.length) && (React.createElement("div", { className: css({
131
148
  position: 'relative',
132
149
  height: 0,
133
150
  width: '100%',
@@ -140,7 +157,7 @@ const CommodityDetail = (_a) => {
140
157
  top: 0,
141
158
  objectFit: 'cover',
142
159
  width: '100%'
143
- }), src: (_k = sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) !== null && _k !== void 0 ? _k : bottom_image, alt: 'pdp image' }))),
160
+ }), src: (_x = sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) !== null && _x !== void 0 ? _x : bottom_image, alt: 'pdp image' }))),
144
161
  renderCommodityGroup(),
145
162
  React.createElement("div", { className: 'pb-commondity-content' }, renderContent({ isPost }))),
146
163
  renderBtn(),
@@ -36,6 +36,12 @@ const CommodityDetail = createMaterial(CommodityDetailComponent, {
36
36
  info: {
37
37
  color: 'gray',
38
38
  fontSize: 12
39
+ },
40
+ taxInfo: {
41
+ color: '#000',
42
+ fontSize: 13,
43
+ textAlign: 'left',
44
+ marginBottom: '10px'
39
45
  }
40
46
  },
41
47
  buttonStyle: {