pb-sxp-ui 1.0.85 → 1.0.87

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 (61) hide show
  1. package/dist/index.cjs +218 -270
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.js +219 -271
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.min.cjs +3 -3
  6. package/dist/index.min.cjs.map +1 -1
  7. package/dist/index.min.js +3 -3
  8. package/dist/index.min.js.map +1 -1
  9. package/dist/pb-ui.js +218 -270
  10. package/dist/pb-ui.js.map +1 -1
  11. package/dist/pb-ui.min.js +3 -3
  12. package/dist/pb-ui.min.js.map +1 -1
  13. package/es/core/components/Consent/index.js +3 -3
  14. package/es/core/components/DiyPortalPreview/VideoWidget.js +3 -3
  15. package/es/core/components/SxpPageRender/FingerSwipeTip/index.js +1 -1
  16. package/es/core/components/SxpPageRender/FormatImage.js +2 -2
  17. package/es/core/components/SxpPageRender/LikeButton/index.js +1 -1
  18. package/es/core/components/SxpPageRender/Navbar.js +1 -1
  19. package/es/core/components/SxpPageRender/Nudge/index.js +1 -1
  20. package/es/core/components/SxpPageRender/Tagbar.js +6 -7
  21. package/es/core/components/SxpPageRender/ToggleButton/index.js +2 -2
  22. package/es/core/components/SxpPageRender/VideoWidget/index.js +3 -3
  23. package/es/core/components/SxpPageRender/WaterFall/List.js +2 -2
  24. package/es/core/components/SxpPageRender/WaterFall/WaterfallList.js +18 -53
  25. package/es/core/components/SxpPageRender/WaterFall/index.js +2 -4
  26. package/es/core/components/SxpPageRender/index.js +56 -55
  27. package/es/core/context/SxpDataSourceProvider.d.ts +4 -0
  28. package/es/core/context/SxpDataSourceProvider.js +20 -17
  29. package/es/core/hooks/useEventReport.d.ts +1 -1
  30. package/es/core/hooks/useEventReport.js +13 -10
  31. package/es/materials/sxp/popup/AppointForm/index.js +1 -1
  32. package/es/materials/sxp/popup/CommodityDetail/index.js +3 -3
  33. package/es/materials/sxp/popup/CommodityDetailDiro/index.js +4 -4
  34. package/es/materials/sxp/popup/CommodityDetailDiroNew/index.js +3 -3
  35. package/es/materials/sxp/popup/Prompt/index.js +2 -2
  36. package/es/materials/sxp/template/Appoint/index.js +1 -1
  37. package/lib/core/components/Consent/index.js +3 -3
  38. package/lib/core/components/DiyPortalPreview/VideoWidget.js +3 -3
  39. package/lib/core/components/SxpPageRender/FingerSwipeTip/index.js +1 -1
  40. package/lib/core/components/SxpPageRender/FormatImage.js +2 -2
  41. package/lib/core/components/SxpPageRender/LikeButton/index.js +1 -1
  42. package/lib/core/components/SxpPageRender/Navbar.js +1 -1
  43. package/lib/core/components/SxpPageRender/Nudge/index.js +1 -1
  44. package/lib/core/components/SxpPageRender/Tagbar.js +7 -8
  45. package/lib/core/components/SxpPageRender/ToggleButton/index.js +2 -2
  46. package/lib/core/components/SxpPageRender/VideoWidget/index.js +3 -3
  47. package/lib/core/components/SxpPageRender/WaterFall/List.js +2 -2
  48. package/lib/core/components/SxpPageRender/WaterFall/WaterfallList.js +18 -53
  49. package/lib/core/components/SxpPageRender/WaterFall/index.js +2 -4
  50. package/lib/core/components/SxpPageRender/index.js +56 -55
  51. package/lib/core/context/SxpDataSourceProvider.d.ts +4 -0
  52. package/lib/core/context/SxpDataSourceProvider.js +21 -18
  53. package/lib/core/hooks/useEventReport.d.ts +1 -1
  54. package/lib/core/hooks/useEventReport.js +13 -10
  55. package/lib/materials/sxp/popup/AppointForm/index.js +1 -1
  56. package/lib/materials/sxp/popup/CommodityDetail/index.js +3 -3
  57. package/lib/materials/sxp/popup/CommodityDetailDiro/index.js +4 -4
  58. package/lib/materials/sxp/popup/CommodityDetailDiroNew/index.js +3 -3
  59. package/lib/materials/sxp/popup/Prompt/index.js +2 -2
  60. package/lib/materials/sxp/template/Appoint/index.js +1 -1
  61. package/package.json +1 -1
@@ -38,7 +38,7 @@ const Consent = ({ width = window.innerWidth, height = window.innerHeight, priva
38
38
  eventSubject: 'userConsent',
39
39
  eventDescription: '用户授权【操作结果】',
40
40
  consentResult: '0',
41
- consentTags: '[]',
41
+ consentTags: '["系统运营"]',
42
42
  rtc: null,
43
43
  requestId: null,
44
44
  sessionID: null
@@ -53,7 +53,7 @@ const Consent = ({ width = window.innerWidth, height = window.innerHeight, priva
53
53
  React.createElement("div", { className: 'consent-title' }, privacy_title !== null && privacy_title !== void 0 ? privacy_title : 'Privacy Policy'),
54
54
  React.createElement("div", { className: 'consent-content' }, privacy_context !== null && privacy_context !== void 0 ? privacy_context : 'This site uses cookies to improve your online experience. By continuing to use the site please agree the policy first.')),
55
55
  React.createElement("div", { className: 'consent-col' },
56
- React.createElement("button", { className: 'consent-btn', onClick: handleAgree }, "Agree"),
57
- React.createElement("a", { className: 'consent-policy', target: '_blank', href: privacy_policy_url }, privacy_policy_title !== null && privacy_policy_title !== void 0 ? privacy_policy_title : 'More information')))));
56
+ React.createElement("button", { "aria-label": 'agree', className: 'consent-btn', onClick: handleAgree }, "Agree"),
57
+ React.createElement("a", { className: 'consent-policy', target: '_blank', href: privacy_policy_url ? `https://${privacy_policy_url}` : undefined }, privacy_policy_title !== null && privacy_policy_title !== void 0 ? privacy_policy_title : 'More information')))));
58
58
  };
59
59
  export default memo(Consent);
@@ -172,7 +172,7 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
172
172
  if (!(sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.placeholder_image) || isLoadFinish) {
173
173
  return null;
174
174
  }
175
- return (React.createElement("img", { style: { position: 'absolute', left: 0, top: 0, width: '100%', height: '100%', objectFit: 'cover' }, src: sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.placeholder_image }));
175
+ return (React.createElement("img", { style: { position: 'absolute', left: 0, top: 0, width: '100%', height: '100%', objectFit: 'cover' }, src: sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.placeholder_image, alt: 'video poster' }));
176
176
  }, [isLoadFinish, sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.placeholder_image]);
177
177
  useEffect(() => {
178
178
  const handleBeforeUnload = () => {
@@ -221,7 +221,7 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
221
221
  height,
222
222
  objectFit: 'contain'
223
223
  } }),
224
- React.createElement("img", { hidden: !isPauseVideo, className: 'clc-pb-video-pause', src: PAUSE_ICON }))),
224
+ React.createElement("img", { hidden: !isPauseVideo, className: 'clc-pb-video-pause', src: PAUSE_ICON, alt: 'video pause image' }))),
225
225
  renderPoster)) : (React.createElement("div", { className: 'video-container', key: rec === null || rec === void 0 ? void 0 : rec.video.itemId, onClick: handleClickVideo(), style: {
226
226
  position: 'relative',
227
227
  width,
@@ -230,6 +230,6 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
230
230
  } },
231
231
  React.createElement("video", { id: `pb-video-${index}`, className: 'clc-pb-video', style: { width: '100%' }, ref: videoRef, crossOrigin: 'anonymous', muted: true, autoPlay: true, controls: false, playsInline: true, preload: 'auto', onPause: onPause, onEnded: handleVideoStart }),
232
232
  renderPoster,
233
- React.createElement("img", { hidden: !isPauseVideo, className: 'clc-pb-video-pause', src: PAUSE_ICON })))));
233
+ React.createElement("img", { hidden: !isPauseVideo, className: 'clc-pb-video-pause', src: PAUSE_ICON, alt: 'video pause image' })))));
234
234
  };
235
235
  export default memo(VideoWidget);
@@ -14,6 +14,6 @@ const FingerSwipeTip = ({ imageUrl, style }) => {
14
14
  return show ? 'pb-fadeIn' : 'pb-fadeOut';
15
15
  }, [show]);
16
16
  return (React.createElement("div", { hidden: !show, className: `pb-finger-wrap ${animationCls}`, style: style },
17
- React.createElement("img", { src: imageUrl || FINGER_SWIPE_ICON })));
17
+ React.createElement("img", { src: imageUrl || FINGER_SWIPE_ICON, alt: 'finger swiper' })));
18
18
  };
19
19
  export default FingerSwipeTip;
@@ -22,8 +22,8 @@ const FormatImage = forwardRef((props, ref) => {
22
22
  React.createElement("source", { type: 'image/jpeg', srcSet: `${imgSrc}?imageMogr2/format/jpg` }),
23
23
  React.createElement("img", { className: className, src: imgSrc, style: style, loading: loading, onLoad: (e) => {
24
24
  onLoad === null || onLoad === void 0 ? void 0 : onLoad(e.target);
25
- } }))) : (React.createElement("img", { className: className, src: imgSrc, style: style, loading: loading, onLoad: (e) => {
25
+ }, alt: 'image' }))) : (React.createElement("img", { className: className, src: imgSrc, style: style, loading: loading, onLoad: (e) => {
26
26
  onLoad === null || onLoad === void 0 ? void 0 : onLoad(e.target);
27
- } }))));
27
+ }, alt: 'image' }))));
28
28
  });
29
29
  export default memo(FormatImage);
@@ -52,7 +52,7 @@ const LikeButton = (_a) => {
52
52
  }
53
53
  }
54
54
  }), 200);
55
- return (React.createElement("button", Object.assign({}, props, { onClick: handleClick }),
55
+ return (React.createElement("button", Object.assign({}, props, { "aria-label": 'like', onClick: handleClick }),
56
56
  React.createElement("img", { style: { width: '100%', height: '100%', objectFit: 'contain' }, src: state ? activeIcon || likeIcon : unActicveIcon || unlikeIcon, alt: 'icon' })));
57
57
  };
58
58
  export default memo(LikeButton);
@@ -4,7 +4,7 @@ const Navbar = ({ icon, styles, textStyle, onClose }) => {
4
4
  var _a;
5
5
  const { waterFallData, setOpenHashtag } = useSxpDataSource();
6
6
  return (React.createElement("div", { className: 'clc-sxp-nav', style: styles },
7
- React.createElement("img", { className: 'clc-sxp-nav-left', src: icon, alt: '', onClick: onClose }),
7
+ React.createElement("img", { className: 'clc-sxp-nav-left', src: icon, alt: 'back button', onClick: onClose }),
8
8
  React.createElement("div", { className: 'clc-sxp-nav-title', style: textStyle }, `#${(_a = waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.hashTag) !== null && _a !== void 0 ? _a : '标题'}`)));
9
9
  };
10
10
  export default memo(Navbar);
@@ -8,7 +8,7 @@ const Nudge = ({ nudge }) => {
8
8
  backgroundColor: nudge === null || nudge === void 0 ? void 0 : nudge.backgroundColor,
9
9
  borderRadius: (_f = nudge === null || nudge === void 0 ? void 0 : nudge.borderRadius) !== null && _f !== void 0 ? _f : 4
10
10
  } },
11
- (nudge === null || nudge === void 0 ? void 0 : nudge.icon) ? React.createElement("img", { src: nudge.icon, style: { height: '100%', objectFit: 'cover', flexShrink: 0 } }) : null,
11
+ (nudge === null || nudge === void 0 ? void 0 : nudge.icon) ? (React.createElement("img", { src: nudge.icon, alt: 'nudge icon', style: { height: '100%', objectFit: 'cover', flexShrink: 0 } })) : null,
12
12
  React.createElement("p", { style: Object.assign(Object.assign({}, nudge === null || nudge === void 0 ? void 0 : nudge.textStyle), { textWrap: 'nowrap', textOverflow: 'ellipsis', overflow: 'hidden', whiteSpace: 'nowrap', flex: 1, marginBottom: 0 }) }, (_g = nudge === null || nudge === void 0 ? void 0 : nudge.content) !== null && _g !== void 0 ? _g : '')))));
13
13
  };
14
14
  export default Nudge;
@@ -1,11 +1,10 @@
1
- import React, { memo, useMemo, useState } from 'react';
1
+ import React, { memo, useMemo } from 'react';
2
2
  import { useSxpDataSource } from '../../../core/hooks';
3
3
  import SXP_EVENT_BUS, { SXP_EVENT_TYPE } from '../../../core/utils/event';
4
4
  import { useEventReport } from '../../../core/hooks/useEventReport';
5
- const DEFAULT_TAG = 'FOR U';
5
+ import { DEFAULT_TAG } from '../../../core/context/SxpDataSourceProvider';
6
6
  const Tagbar = ({ tagList = [], setActiveIndex }) => {
7
- const [selectTag, setSelectTag] = useState(DEFAULT_TAG);
8
- const { getRecommendVideos, setRtcList, setCacheRtcList, setCacheActiveIndex, setLoading, swiperRef, waterFallData, bffEventReport } = useSxpDataSource();
7
+ const { getRecommendVideos, setRtcList, setCacheRtcList, setCacheActiveIndex, setLoading, swiperRef, waterFallData, bffEventReport, selectTag, setSelectTag } = useSxpDataSource();
9
8
  const { backMainFeed } = useEventReport();
10
9
  const realTagList = useMemo(() => {
11
10
  return [DEFAULT_TAG, ...tagList];
@@ -18,12 +17,12 @@ const Tagbar = ({ tagList = [], setActiveIndex }) => {
18
17
  eventInfo: {
19
18
  eventSubject: 'clickThemeTagsViewContents',
20
19
  eventDescription: 'click Theme Tags View Contents',
21
- themeTags: `[${tag}]`
20
+ themeTags: `['${tag}']`
22
21
  }
23
22
  });
24
23
  }
25
24
  else {
26
- backMainFeed('theme', selectTag);
25
+ backMainFeed('theme', tag, selectTag);
27
26
  }
28
27
  let themeTag;
29
28
  if (tag !== DEFAULT_TAG) {
@@ -41,7 +40,7 @@ const Tagbar = ({ tagList = [], setActiveIndex }) => {
41
40
  }).finally(() => {
42
41
  setLoading === null || setLoading === void 0 ? void 0 : setLoading(false);
43
42
  });
44
- setSelectTag(tag);
43
+ setSelectTag === null || setSelectTag === void 0 ? void 0 : setSelectTag(tag);
45
44
  };
46
45
  if (waterFallData || tagList.length <= 0)
47
46
  return null;
@@ -7,7 +7,7 @@ const ToggleButton = ({ defaultValue, activeIcon, unactiveIcon, onChange, style
7
7
  setIsTure(result);
8
8
  onChange === null || onChange === void 0 ? void 0 : onChange(result);
9
9
  };
10
- return (React.createElement("button", { style: style, className: 'pb-toggle-button', onClick: handleClick },
11
- React.createElement("img", { className: 'pb-toggle-button-icon', src: isTrue ? activeIcon : unactiveIcon })));
10
+ return (React.createElement("button", { style: style, "aria-label": 'toggle button', className: 'pb-toggle-button', onClick: handleClick },
11
+ React.createElement("img", { className: 'pb-toggle-button-icon', alt: 'toggle image', src: isTrue ? activeIcon : unactiveIcon })));
12
12
  };
13
13
  export default memo(ToggleButton);
@@ -248,7 +248,7 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
248
248
  if (!(sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.placeholder_image) || isLoadFinish) {
249
249
  return null;
250
250
  }
251
- return (React.createElement("img", { style: { position: 'absolute', left: 0, top: 0, width: '100%', height: '100%', objectFit: 'cover' }, src: sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.placeholder_image }));
251
+ return (React.createElement("img", { style: { position: 'absolute', left: 0, top: 0, width: '100%', height: '100%', objectFit: 'cover' }, src: sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.placeholder_image, alt: 'placeholder image' }));
252
252
  }, [isLoadFinish, sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.placeholder_image]);
253
253
  useEffect(() => {
254
254
  if (!videoRef)
@@ -281,7 +281,7 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
281
281
  } },
282
282
  React.createElement("div", { style: { position: 'relative', width: '100%', height: '100%' } },
283
283
  React.createElement("div", { className: 'n-full-screen', ref: videoEleRef, id: videoId, style: { width: '100%', height: '100%' } }),
284
- React.createElement("img", { hidden: !isPauseVideo, className: 'clc-pb-video-pause', src: PAUSE_ICON }))),
284
+ React.createElement("img", { hidden: !isPauseVideo, className: 'clc-pb-video-pause', alt: 'pause', src: PAUSE_ICON }))),
285
285
  renderPoster)) : (React.createElement("div", { className: 'video-container', key: rec === null || rec === void 0 ? void 0 : rec.video.itemId, style: {
286
286
  position: 'relative',
287
287
  width: '100%',
@@ -290,6 +290,6 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
290
290
  }, onClick: handleClickVideo() },
291
291
  React.createElement("div", { className: 'n-full-screen', ref: videoEleRef, id: videoId, style: { width: '100%', height: '100%' } }),
292
292
  renderPoster,
293
- React.createElement("img", { hidden: !isPauseVideo, className: 'clc-pb-video-pause', src: PAUSE_ICON })))));
293
+ React.createElement("img", { hidden: !isPauseVideo, className: 'clc-pb-video-pause', src: PAUSE_ICON, alt: 'pause' })))));
294
294
  };
295
295
  export default memo(VideoWidget);
@@ -114,7 +114,7 @@ const WaterfallFlowItem = (props) => {
114
114
  React.createElement("div", { className: 'list-content-listItem-info-price', style: textStyles === null || textStyles === void 0 ? void 0 : textStyles.price, hidden: !priceText }, priceText))));
115
115
  };
116
116
  export default function WaterfallList(_a) {
117
- var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
117
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
118
118
  var { reportTagsView, showBanner } = _a, props = __rest(_a, ["reportTagsView", "showBanner"]);
119
119
  const { waterFallData, getRecommendVideos, hashTagSize, loadingImage, isOpenHashTag } = useSxpDataSource();
120
120
  const [list, setList] = useState();
@@ -187,5 +187,5 @@ export default function WaterfallList(_a) {
187
187
  } })),
188
188
  React.createElement("div", { className: 'list-bottom', hidden: !((_o = data === null || data === void 0 ? void 0 : data.tag) === null || _o === void 0 ? void 0 : _o.link), style: props === null || props === void 0 ? void 0 : props.buttonBgStyle }),
189
189
  React.createElement("div", { hidden: !((_p = data === null || data === void 0 ? void 0 : data.tag) === null || _p === void 0 ? void 0 : _p.link), className: 'list-btn-wrap', style: Object.assign(Object.assign({}, props === null || props === void 0 ? void 0 : props.buttonBgStyle), { height: 'auto', backgroundColor: 'transparent' }) },
190
- React.createElement("button", { className: 'list-btn', style: props === null || props === void 0 ? void 0 : props.buttonStyle, onClick: handleClickLink }, ((_q = data === null || data === void 0 ? void 0 : data.tag) === null || _q === void 0 ? void 0 : _q.linkTitle) || 'Shop the collection'))))));
190
+ React.createElement("button", { "aria-label": ((_q = data === null || data === void 0 ? void 0 : data.tag) === null || _q === void 0 ? void 0 : _q.linkTitle) || 'Shop the collection', className: 'list-btn', style: props === null || props === void 0 ? void 0 : props.buttonStyle, onClick: handleClickLink }, ((_r = data === null || data === void 0 ? void 0 : data.tag) === null || _r === void 0 ? void 0 : _r.linkTitle) || 'Shop the collection'))))));
191
191
  }
@@ -71,56 +71,24 @@ const WaterfallFlowItem = (props) => {
71
71
  if (imgDom.current === null || src === '') {
72
72
  return;
73
73
  }
74
- const img = new Image();
74
+ let imgSrc = null;
75
75
  if (showVideo && firstFrameSrc) {
76
- img.src = firstFrameSrc;
76
+ imgSrc = firstFrameSrc;
77
77
  }
78
78
  else {
79
- img.src = src;
79
+ imgSrc = src;
80
80
  }
81
- img.onload = () => {
82
- setImgInfo({
83
- height: img.height,
84
- width: img.width
85
- });
86
- setIsLoading(true);
87
- };
88
- imgDom.current.setSrc(img.src);
89
- }, [src, showVideo, firstFrameSrc, isImgShow]);
90
- useEffect(() => {
91
- const height = imgInfo.height * (unitWidth / imgInfo.width);
92
- if (isLoading) {
93
- sizeChange(height + 76 + space, index);
94
- }
95
- }, [imgInfo, index, unitWidth, isLoading, space]);
96
- const calculateHeightForWidth = (videoWidth, videoHeight, targetWidth) => {
97
- const aspectRatio = videoWidth / videoHeight;
98
- const targetHeight = targetWidth / aspectRatio;
99
- return targetHeight;
100
- };
101
- useEffect(() => {
102
- const video = videoDom === null || videoDom === void 0 ? void 0 : videoDom.current;
103
- if (video === null || src === '' || !showVideo) {
104
- return;
105
- }
106
- video.src = src;
107
- video.currentTime = 1;
108
- video.crossOrigin = 'anonymous';
109
- video.onloadeddata = () => {
110
- const canvas = canvasRef === null || canvasRef === void 0 ? void 0 : canvasRef.current;
111
- if (!canvas)
112
- return;
113
- const ctx = canvas.getContext('2d');
114
- const targetWidth = (window === null || window === void 0 ? void 0 : window.innerWidth) / 2;
115
- const targetHeight = calculateHeightForWidth(video.videoWidth, video.videoHeight, targetWidth);
116
- canvas.height = targetHeight;
117
- canvas.width = targetWidth;
118
- ctx === null || ctx === void 0 ? void 0 : ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
119
- setFirstFrameSrc(canvas.toDataURL());
120
- video.remove();
121
- canvas.remove();
122
- };
123
- }, [src, showVideo]);
81
+ if (imgSrc)
82
+ imgDom.current.setSrc(imgSrc);
83
+ }, [src, showVideo, firstFrameSrc]);
84
+ const pictRef = useRef();
85
+ const imgLoad = useCallback((img) => {
86
+ setTimeout(() => {
87
+ var _a;
88
+ const height = (_a = pictRef === null || pictRef === void 0 ? void 0 : pictRef.current) === null || _a === void 0 ? void 0 : _a.offsetHeight;
89
+ sizeChange(height + 56 + space, index);
90
+ }, 0);
91
+ }, [space, sizeChange, index, unitWidth, pictRef]);
124
92
  const handleClickToDetail = () => {
125
93
  reportTagsView();
126
94
  setRtcList === null || setRtcList === void 0 ? void 0 : setRtcList(list);
@@ -131,17 +99,14 @@ const WaterfallFlowItem = (props) => {
131
99
  }, 0);
132
100
  };
133
101
  return (React.createElement("div", { ref: ref, style: Object.assign({}, style), className: 'waterFallList-content-listItem', key: index, onClick: handleClickToDetail },
134
- React.createElement("div", { className: 'waterFallList-content-listItem-picture' },
135
- showVideo && (React.createElement("div", { style: { display: 'none' } },
136
- React.createElement("video", { ref: videoDom, src: src, crossOrigin: 'anonymous', className: 'waterFallList-content-listItem-picture-img' }),
137
- React.createElement("canvas", { ref: canvasRef }))),
138
- React.createElement(FormatImage, { loading: 'lazy', className: 'waterFallList-content-listItem-picture-img', ref: imgDom })),
102
+ React.createElement("div", { className: 'waterFallList-content-listItem-picture', ref: pictRef },
103
+ React.createElement(FormatImage, { loading: 'lazy', className: 'waterFallList-content-listItem-picture-img', onLoad: imgLoad, ref: imgDom })),
139
104
  React.createElement("div", { className: 'waterFallList-content-listItem-info' },
140
105
  React.createElement("div", { className: `${'waterFallList-content-listItem-info-title'} ${priceText ? 'waterFallList-content-listItem-info-nowrap' : ''}`, style: Object.assign({}, textStyles === null || textStyles === void 0 ? void 0 : textStyles.title) }, title && title),
141
106
  React.createElement("div", { className: 'waterFallList-content-listItem-info-price', hidden: !priceText, style: textStyles.price }, priceText))));
142
107
  };
143
108
  export default function WaterfallList(_a) {
144
- var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
109
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
145
110
  var { reportTagsView, showBanner } = _a, props = __rest(_a, ["reportTagsView", "showBanner"]);
146
111
  const { waterFallData, getRecommendVideos, hashTagSize, loadingImage, isOpenHashTag } = useSxpDataSource();
147
112
  const scrollParent = useRef(null);
@@ -337,5 +302,5 @@ export default function WaterfallList(_a) {
337
302
  } }))),
338
303
  React.createElement("div", { className: 'waterFallList-bottom', hidden: !((_t = data === null || data === void 0 ? void 0 : data.tag) === null || _t === void 0 ? void 0 : _t.link), style: props === null || props === void 0 ? void 0 : props.buttonBgStyle }),
339
304
  React.createElement("div", { ref: buttonRef, hidden: !((_u = data === null || data === void 0 ? void 0 : data.tag) === null || _u === void 0 ? void 0 : _u.link), className: 'waterFallList-btn-wrap', style: Object.assign(Object.assign({}, props === null || props === void 0 ? void 0 : props.buttonBgStyle), { height: 'auto', backgroundColor: 'transparent' }) },
340
- React.createElement("button", { className: 'waterFallList-btn', style: props === null || props === void 0 ? void 0 : props.buttonStyle, onClick: handleClickLink }, ((_v = data === null || data === void 0 ? void 0 : data.tag) === null || _v === void 0 ? void 0 : _v.linkTitle) || 'Shop the collection'))))));
305
+ React.createElement("button", { "aria-label": ((_v = data === null || data === void 0 ? void 0 : data.tag) === null || _v === void 0 ? void 0 : _v.linkTitle) || 'Shop the collection', className: 'waterFallList-btn', style: props === null || props === void 0 ? void 0 : props.buttonStyle, onClick: handleClickLink }, ((_w = data === null || data === void 0 ? void 0 : data.tag) === null || _w === void 0 ? void 0 : _w.linkTitle) || 'Shop the collection'))))));
341
306
  }
@@ -10,7 +10,7 @@ import { useSxpDataSource } from '../../../../core/hooks';
10
10
  import { useEventReport } from '../../../../core/hooks/useEventReport';
11
11
  const WaterFall = (props) => {
12
12
  var _a;
13
- const { waterFallData, setOpenHashtag, openHashtag, swiperRef, setWaterFallData, cacheRtcList, setRtcList, cacheActiveIndex, rtcList, setCacheRtcList, setIsFromHashtag, isFromHashtag, bffEventReport, themeTag } = useSxpDataSource();
13
+ const { waterFallData, setOpenHashtag, openHashtag, swiperRef, setWaterFallData, cacheRtcList, setRtcList, cacheActiveIndex, rtcList, setCacheRtcList, setIsFromHashtag, isFromHashtag, bffEventReport, themeTag, selectTag } = useSxpDataSource();
14
14
  const { backMainFeed } = useEventReport();
15
15
  const ref = useRef(null);
16
16
  const modalEleRef = useRef(null);
@@ -32,9 +32,7 @@ const WaterFall = (props) => {
32
32
  if (!isEq && cacheRtcList && (cacheRtcList === null || cacheRtcList === void 0 ? void 0 : cacheRtcList.length)) {
33
33
  setRtcList === null || setRtcList === void 0 ? void 0 : setRtcList(cacheRtcList);
34
34
  }
35
- if (!(themeTag === null || themeTag === void 0 ? void 0 : themeTag.current)) {
36
- backMainFeed('branch', themeTag === null || themeTag === void 0 ? void 0 : themeTag.current, waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.hashTag);
37
- }
35
+ backMainFeed('branch', selectTag, undefined, waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.hashTag);
38
36
  reportTagsView();
39
37
  setWaterFallData === null || setWaterFallData === void 0 ? void 0 : setWaterFallData(undefined);
40
38
  setIsFromHashtag === null || setIsFromHashtag === void 0 ? void 0 : setIsFromHashtag(false);
@@ -21,8 +21,9 @@ import { useEventReport } from '../../../core/hooks/useEventReport';
21
21
  import withBindDataSource from '../../../core/hoc/withBindDataSource';
22
22
  import Tagbar from './Tagbar';
23
23
  import { getFeUserId } from '../../../core/utils/localStore';
24
+ import Consent from '../Consent';
24
25
  const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.innerHeight, containerWidth = window.innerWidth, tempMap, resolver, data = [], ctaType, tipText, nudge, _schema, hashTagStyle, tagList = [], licenseUrl }) => {
25
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
26
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
26
27
  const { schema } = useEditor();
27
28
  const [activeIndex, setActiveIndex] = useState(0);
28
29
  const viewImageStartTime = useRef(0);
@@ -31,7 +32,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
31
32
  const viewTime = useRef();
32
33
  const [isLoadMore, setIsLoadMore] = useState(false);
33
34
  const [isShowMore, setIsShowMore] = useState(false);
34
- const { loadVideos, bffEventReport, loading, setPopupDetailData, ctaEvent, swiperRef, waterFallData, setOpenHashtag, appDomain, openHashtag, loadingImage, isFromHashtag, popupDetailData, bffFbReport, curTime, h5EnterLink } = useSxpDataSource();
35
+ const { loadVideos, bffEventReport, loading, setPopupDetailData, ctaEvent, swiperRef, waterFallData, setOpenHashtag, appDomain, openHashtag, loadingImage, isFromHashtag, popupDetailData, bffFbReport, curTime, h5EnterLink, isShowConsent, selectTag } = useSxpDataSource();
35
36
  const { backMainFeed } = useEventReport();
36
37
  const [videoRef, setVideoRef] = useState(null);
37
38
  const playerRef = useRef();
@@ -105,10 +106,13 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
105
106
  const item = data === null || data === void 0 ? void 0 : data[activeIndex];
106
107
  const visibleChange = () => {
107
108
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
109
+ const repCond = !openHashtag && !isShowConsent;
108
110
  if (document.visibilityState === 'hidden') {
109
- SXP_EVENT_BUS.emit(SXP_EVENT_TYPE.PAGE_DID_HIDE, item);
110
- handleReportViewImageEnd(item);
111
- handleReportProductView(item);
111
+ if (repCond) {
112
+ SXP_EVENT_BUS.emit(SXP_EVENT_TYPE.PAGE_DID_HIDE, item);
113
+ handleReportViewImageEnd(item);
114
+ handleReportProductView(item);
115
+ }
112
116
  let fromKName = '';
113
117
  if (popupDetailData && (((_b = (_a = item === null || item === void 0 ? void 0 : item.video) === null || _a === void 0 ? void 0 : _a.bindProducts) === null || _b === void 0 ? void 0 : _b.length) || ((_c = item === null || item === void 0 ? void 0 : item.video) === null || _c === void 0 ? void 0 : _c.bindProduct))) {
114
118
  fromKName = 'pdpPage';
@@ -144,9 +148,11 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
144
148
  }
145
149
  else if (document.visibilityState === 'visible') {
146
150
  handleH5EnterLink();
147
- handleViewImageStartEvent(activeIndex);
148
- SXP_EVENT_BUS.emit(SXP_EVENT_TYPE.PAGE_DID_SHOW, item);
149
- backMainFeed('external');
151
+ if (repCond) {
152
+ handleViewImageStartEvent(activeIndex);
153
+ SXP_EVENT_BUS.emit(SXP_EVENT_TYPE.PAGE_DID_SHOW, item);
154
+ backMainFeed('external', selectTag);
155
+ }
150
156
  }
151
157
  };
152
158
  document.addEventListener('visibilitychange', visibleChange);
@@ -162,17 +168,11 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
162
168
  isFromHashtag,
163
169
  tempMap,
164
170
  curTime,
165
- backMainFeed
171
+ backMainFeed,
172
+ openHashtag,
173
+ isShowConsent,
174
+ selectTag
166
175
  ]);
167
- useEffect(() => {
168
- const initTime = () => {
169
- backMainFeed('external');
170
- };
171
- window.addEventListener('pageshow', initTime);
172
- return () => {
173
- window.removeEventListener('pageshow', initTime);
174
- };
175
- }, []);
176
176
  const tagHeight = useMemo(() => {
177
177
  let h = 0;
178
178
  if (tagList.length > 0) {
@@ -412,44 +412,45 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
412
412
  const mutedIcon = useIconLink('/pb_static/5beaaa5ce7f3477b99db3838619cc471.png');
413
413
  const unmutedIcon = useIconLink('/pb_static/fea8668a8a894e4aa3a86bcc775e895e.png');
414
414
  return (React.createElement("div", { id: 'sxp-render', className: 'clc-sxp-container' },
415
- waterFallData && (React.createElement(Navbar, { icon: left, styles: { background: 'rgba(0,0,0,.3)', color: '#fff' }, onClose: () => {
416
- setOpenHashtag === null || setOpenHashtag === void 0 ? void 0 : setOpenHashtag(true);
417
- } })),
418
- renderLogo,
419
- React.createElement(Tagbar, { tagList: tagList, setActiveIndex: setActiveIndex }),
420
- isShowFingerTip ? (React.createElement(FingerSwipeTip, { imageUrl: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.swipeTipIcon, style: { top: `${50 + ((_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.swipeTipOffset) !== null && _a !== void 0 ? _a : 0)}%` } })) : null,
421
- React.createElement(Swiper, { style: {
422
- marginTop: tagHeight
423
- }, ref: swiperRef, onSlideChange: () => {
424
- swiperRef.current.swiper.allowTouchMove = false;
425
- setTimeout(() => {
426
- swiperRef.current.swiper.allowTouchMove = true;
427
- }, 500);
428
- }, onActiveIndexChange: (swiper) => {
429
- setActiveIndex(swiper.activeIndex);
430
- if (openHashtag)
431
- return;
432
- handleScrollEvent(swiper);
433
- if (waterFallData)
434
- return;
435
- if ((swiper === null || swiper === void 0 ? void 0 : swiper.activeIndex) + 2 >= (data === null || data === void 0 ? void 0 : data.length)) {
436
- if (!isLoadMore) {
437
- setIsLoadMore(true);
438
- loadVideos === null || loadVideos === void 0 ? void 0 : loadVideos(Math.ceil(activeIndex / 10) + 1).then(() => {
439
- setIsLoadMore(false);
440
- });
415
+ 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))) : (React.createElement(React.Fragment, null,
416
+ waterFallData && (React.createElement(Navbar, { icon: left, styles: { background: 'rgba(0,0,0,.3)', color: '#fff' }, onClose: () => {
417
+ setOpenHashtag === null || setOpenHashtag === void 0 ? void 0 : setOpenHashtag(true);
418
+ } })),
419
+ renderLogo,
420
+ React.createElement(Tagbar, { tagList: tagList, setActiveIndex: setActiveIndex }),
421
+ isShowFingerTip ? (React.createElement(FingerSwipeTip, { imageUrl: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.swipeTipIcon, style: { top: `${50 + ((_d = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.swipeTipOffset) !== null && _d !== void 0 ? _d : 0)}%` } })) : null,
422
+ React.createElement(Swiper, { style: {
423
+ marginTop: tagHeight
424
+ }, ref: swiperRef, onSlideChange: () => {
425
+ swiperRef.current.swiper.allowTouchMove = false;
426
+ setTimeout(() => {
427
+ swiperRef.current.swiper.allowTouchMove = true;
428
+ }, 500);
429
+ }, onActiveIndexChange: (swiper) => {
430
+ setActiveIndex(swiper.activeIndex);
431
+ if (openHashtag)
432
+ return;
433
+ handleScrollEvent(swiper);
434
+ if (waterFallData)
435
+ return;
436
+ if ((swiper === null || swiper === void 0 ? void 0 : swiper.activeIndex) + 2 >= (data === null || data === void 0 ? void 0 : data.length)) {
437
+ if (!isLoadMore) {
438
+ setIsLoadMore(true);
439
+ loadVideos === null || loadVideos === void 0 ? void 0 : loadVideos(Math.ceil(activeIndex / 10) + 1).then(() => {
440
+ setIsLoadMore(false);
441
+ });
442
+ }
441
443
  }
442
- }
443
- }, direction: 'vertical', height: height },
444
- React.createElement(ToggleButton, { style: {
445
- position: 'fixed',
446
- visibility: ((_c = (_b = data === null || data === void 0 ? void 0 : data[activeIndex]) === null || _b === void 0 ? void 0 : _b.video) === null || _c === void 0 ? void 0 : _c.url) ? 'visible' : 'hidden',
447
- zIndex: 999,
448
- [(_d = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconXPosit) !== null && _d !== void 0 ? _d : 'right']: (_e = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconX) !== null && _e !== void 0 ? _e : 0,
449
- [(_f = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconYPosit) !== null && _f !== void 0 ? _f : 'bottom']: (_g = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconY) !== null && _g !== void 0 ? _g : 23
450
- }, defaultValue: isMuted, activeIcon: (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.unMuteIcon) ? globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.unMuteIcon : mutedIcon, unactiveIcon: (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIcon) ? globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIcon : unmutedIcon, onChange: setIsMuted }),
451
- renderView),
452
- React.createElement(WaterFall, Object.assign({}, (_k = (_j = (_h = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.hashTag) === null || _h === void 0 ? void 0 : _h[0]) === null || _j === void 0 ? void 0 : _j.item) === null || _k === void 0 ? void 0 : _k.props)),
444
+ }, direction: 'vertical', height: height },
445
+ React.createElement(ToggleButton, { style: {
446
+ position: 'fixed',
447
+ visibility: ((_f = (_e = data === null || data === void 0 ? void 0 : data[activeIndex]) === null || _e === void 0 ? void 0 : _e.video) === null || _f === void 0 ? void 0 : _f.url) ? 'visible' : 'hidden',
448
+ zIndex: 999,
449
+ [(_g = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconXPosit) !== null && _g !== void 0 ? _g : 'right']: (_h = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconX) !== null && _h !== void 0 ? _h : 0,
450
+ [(_j = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconYPosit) !== null && _j !== void 0 ? _j : 'bottom']: (_k = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconY) !== null && _k !== void 0 ? _k : 23
451
+ }, defaultValue: isMuted, activeIcon: (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.unMuteIcon) ? globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.unMuteIcon : mutedIcon, unactiveIcon: (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIcon) ? globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIcon : unmutedIcon, onChange: setIsMuted }),
452
+ renderView))),
453
+ React.createElement(WaterFall, Object.assign({}, (_o = (_m = (_l = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.hashTag) === null || _l === void 0 ? void 0 : _l[0]) === null || _m === void 0 ? void 0 : _m.item) === null || _o === void 0 ? void 0 : _o.props)),
453
454
  React.createElement("div", { style: { position: 'absolute', zIndex: -100 } },
454
455
  React.createElement("video", { ref: playerRef, id: 'player-container-id', playsInline: true, crossOrigin: 'anonymous', style: {
455
456
  backgroundColor: 'transparent',
@@ -77,6 +77,9 @@ export interface ISxpDataSourceContext {
77
77
  curTime?: any;
78
78
  h5EnterLink?: () => void;
79
79
  themeTag?: any;
80
+ isShowConsent?: boolean;
81
+ selectTag?: string;
82
+ setSelectTag?: React.Dispatch<React.SetStateAction<string>>;
80
83
  }
81
84
  export declare const SxpDataSourceContext: React.Context<ISxpDataSourceContext>;
82
85
  export interface SxpDataSourceProviderProps {
@@ -115,5 +118,6 @@ export interface SxpDataSourceProviderProps {
115
118
  globalConfig?: ISxpPageRenderProps['globalConfig'];
116
119
  isEditor?: boolean;
117
120
  }
121
+ export declare const DEFAULT_TAG = "FOR U";
118
122
  declare const _default: React.NamedExoticComponent<SxpDataSourceProviderProps>;
119
123
  export default _default;