pb-sxp-ui 1.0.86 → 1.0.88

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 +113 -166
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.js +113 -166
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.min.cjs +3 -4
  6. package/dist/index.min.cjs.map +1 -1
  7. package/dist/index.min.js +3 -4
  8. package/dist/index.min.js.map +1 -1
  9. package/dist/pb-ui.js +113 -166
  10. package/dist/pb-ui.js.map +1 -1
  11. package/dist/pb-ui.min.js +3 -4
  12. package/dist/pb-ui.min.js.map +1 -1
  13. package/es/core/components/Consent/index.js +2 -2
  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 +17 -52
  25. package/es/core/components/SxpPageRender/WaterFall/index.js +2 -4
  26. package/es/core/components/SxpPageRender/index.js +28 -30
  27. package/es/core/context/SxpDataSourceProvider.d.ts +4 -0
  28. package/es/core/context/SxpDataSourceProvider.js +9 -3
  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 +2 -2
  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 +17 -52
  49. package/lib/core/components/SxpPageRender/WaterFall/index.js +2 -4
  50. package/lib/core/components/SxpPageRender/index.js +28 -30
  51. package/lib/core/context/SxpDataSourceProvider.d.ts +4 -0
  52. package/lib/core/context/SxpDataSourceProvider.js +10 -4
  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
package/dist/index.cjs CHANGED
@@ -442,7 +442,7 @@ var SXP_EVENT_TYPE;
442
442
  * @Author: binruan@chatlabs.com
443
443
  * @Date: 2024-06-13 15:16:53
444
444
  * @LastEditors: binruan@chatlabs.com
445
- * @LastEditTime: 2024-06-18 16:06:16
445
+ * @LastEditTime: 2024-06-19 14:13:50
446
446
  * @FilePath: \pb-sxp-ui\src\core\components\Consent\index.tsx
447
447
  *
448
448
  */
@@ -497,8 +497,8 @@ const Consent$2 = ({ width = window.innerWidth, height = window.innerHeight, pri
497
497
  React.createElement("div", { className: 'consent-title' }, privacy_title !== null && privacy_title !== void 0 ? privacy_title : 'Privacy Policy'),
498
498
  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.')),
499
499
  React.createElement("div", { className: 'consent-col' },
500
- React.createElement("button", { className: 'consent-btn', onClick: handleAgree }, "Agree"),
501
- 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')))));
500
+ React.createElement("button", { "aria-label": 'agree', className: 'consent-btn', onClick: handleAgree }, "Agree"),
501
+ 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')))));
502
502
  };
503
503
  var Consent$3 = React.memo(Consent$2);
504
504
 
@@ -511,6 +511,7 @@ var DataSourceType;
511
511
  DataSourceType[DataSourceType["BFF"] = 5] = "BFF";
512
512
  })(DataSourceType || (DataSourceType = {}));
513
513
  const UTM_KEYS = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_id', 'utm_content', 'cl_source'];
514
+ const DEFAULT_TAG = 'FOR U';
514
515
  const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent = true, maxSize, defaultSize, isPreview = false, sxpParameter, appDomain, hashTagSize, loadingImage, isOpenHashTag = false, enabledMetaConversionApi = false, consentHeight, consentWidth, isShowTag = true, isOpenConsent = false, globalConfig, isEditor = false }) => {
515
516
  var _a, _b, _c;
516
517
  const [rtcList, setRtcList] = React.useState([]);
@@ -530,6 +531,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
530
531
  const [videoRef, setVideoRef] = React.useState(null);
531
532
  const themeTag = React.useRef();
532
533
  const curTime = React.useRef();
534
+ const [selectTag, setSelectTag] = React.useState(DEFAULT_TAG);
533
535
  const isShowConsent = React.useMemo(() => {
534
536
  var _a, _b, _c, _d;
535
537
  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;
@@ -739,8 +741,9 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
739
741
  });
740
742
  }, [bffEventReport]);
741
743
  React.useEffect(() => {
742
- h5EnterLink();
743
- }, []);
744
+ if (!isShowConsent)
745
+ h5EnterLink();
746
+ }, [isShowConsent]);
744
747
  React.useEffect(() => {
745
748
  if (isShowConsent)
746
749
  return;
@@ -819,7 +822,10 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
819
822
  setIsAgreePolicy,
820
823
  curTime,
821
824
  h5EnterLink,
822
- themeTag
825
+ themeTag,
826
+ isShowConsent,
827
+ selectTag,
828
+ setSelectTag
823
829
  } }, isShowConsent ? (React.createElement(Consent$3, 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({
824
830
  rtcList,
825
831
  mutateLike: bffMutateLike,
@@ -1230,7 +1236,7 @@ var settingRender$6 = [
1230
1236
  * @Author: binruan@chatlabs.com
1231
1237
  * @Date: 2024-03-12 10:59:06
1232
1238
  * @LastEditors: binruan@chatlabs.com
1233
- * @LastEditTime: 2024-06-12 10:53:57
1239
+ * @LastEditTime: 2024-06-20 13:39:07
1234
1240
  * @FilePath: \pb-sxp-ui\src\core\hooks\useEventReport.ts
1235
1241
  *
1236
1242
  */
@@ -1300,16 +1306,18 @@ function useEventReport() {
1300
1306
  }
1301
1307
  });
1302
1308
  }, [bffEventReport, popupDetailData]);
1303
- const backMainFeed = React.useCallback((lastFeed, themeTag, hashTag) => {
1304
- bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
1305
- eventInfo: {
1306
- lastFeed,
1307
- themeTags: themeTag ? `[${themeTag}]` : '',
1308
- hashTags: hashTag ? `[${hashTag}]` : '',
1309
- eventSubject: 'backMainFeed',
1310
- eventDescription: 'back Main Feed'
1311
- }
1312
- });
1309
+ const backMainFeed = React.useCallback((lastFeed, selectTag, themeTag, hashTag) => {
1310
+ if (selectTag && selectTag === DEFAULT_TAG) {
1311
+ bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
1312
+ eventInfo: {
1313
+ lastFeed,
1314
+ themeTags: themeTag ? `['${themeTag}']` : '',
1315
+ hashTags: hashTag ? `['${hashTag}']` : '',
1316
+ eventSubject: 'backMainFeed',
1317
+ eventDescription: 'back Main Feed'
1318
+ }
1319
+ });
1320
+ }
1313
1321
  }, [bffEventReport]);
1314
1322
  return {
1315
1323
  jumpToWeb,
@@ -1396,7 +1404,7 @@ const AppointForm$1 = (_a) => {
1396
1404
  React.createElement("div", { className: 'pb-appoint-form-container' },
1397
1405
  React.createElement(proComponents.BetaSchemaForm, { columns: columnsData, submitter: false, layout: layoutType, autoFocusFirstInput: false, size: 'large', formRef: formRef, className: 'panel-reset' }))),
1398
1406
  React.createElement("div", { className: 'pb-appoint-form-btn-wrapper' },
1399
- React.createElement("button", { onClick: handleSubmit, className: 'pb-appoint-form-btn', style: Object.assign({ color: submitColor, background: submitBgColor }, submitButtonStyle) }, loading ? React.createElement(React.Fragment, null, "loading...") : submitText))));
1407
+ React.createElement("button", { "aria-label": submitText, onClick: handleSubmit, className: 'pb-appoint-form-btn', style: Object.assign({ color: submitColor, background: submitBgColor }, submitButtonStyle) }, loading ? React.createElement(React.Fragment, null, "loading...") : submitText))));
1400
1408
  };
1401
1409
  var AppointFormComponent = React.memo(AppointForm$1);
1402
1410
 
@@ -8588,7 +8596,7 @@ var ExpandableText$1 = React.memo(ExpandableText);
8588
8596
  * @Author: binruan@chatlabs.com
8589
8597
  * @Date: 2024-03-20 10:27:31
8590
8598
  * @LastEditors: binruan@chatlabs.com
8591
- * @LastEditTime: 2024-05-27 09:47:19
8599
+ * @LastEditTime: 2024-06-19 16:25:46
8592
8600
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\FormatImage.tsx
8593
8601
  *
8594
8602
  */
@@ -8638,9 +8646,9 @@ const FormatImage = React.forwardRef((props, ref) => {
8638
8646
  React.createElement("source", { type: 'image/jpeg', srcSet: `${imgSrc}?imageMogr2/format/jpg` }),
8639
8647
  React.createElement("img", { className: className, src: imgSrc, style: style, loading: loading, onLoad: (e) => {
8640
8648
  onLoad === null || onLoad === void 0 ? void 0 : onLoad(e.target);
8641
- } }))) : (React.createElement("img", { className: className, src: imgSrc, style: style, loading: loading, onLoad: (e) => {
8649
+ }, alt: 'image' }))) : (React.createElement("img", { className: className, src: imgSrc, style: style, loading: loading, onLoad: (e) => {
8642
8650
  onLoad === null || onLoad === void 0 ? void 0 : onLoad(e.target);
8643
- } }))));
8651
+ }, alt: 'image' }))));
8644
8652
  });
8645
8653
  var FormatImage$1 = React.memo(FormatImage);
8646
8654
 
@@ -8708,8 +8716,8 @@ const CommodityDetail$1 = (_a) => {
8708
8716
  18-karat gold, this necklace is embellished with hand-set diamonds.`, maxStr: 79, className: 'pb-commondity-content-info', style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.info }))));
8709
8717
  };
8710
8718
  const renderBtn = () => {
8711
- var _a;
8712
- return (React.createElement(React.Fragment, null, (isDefault || (product === null || product === void 0 ? void 0 : product.link)) && (React.createElement("button", { onClick: handleLink, className: 'pb-commondity-btn', style: buttonStyle }, (_a = cta === null || cta === void 0 ? void 0 : cta.enTitle) !== null && _a !== void 0 ? _a : 'Purchase on Website'))));
8719
+ var _a, _b;
8720
+ return (React.createElement(React.Fragment, null, (isDefault || (product === null || product === void 0 ? void 0 : product.link)) && (React.createElement("button", { "aria-label": (_a = cta === null || cta === void 0 ? void 0 : cta.enTitle) !== null && _a !== void 0 ? _a : 'Purchase on Website', onClick: handleLink, className: 'pb-commondity-btn', style: buttonStyle }, (_b = cta === null || cta === void 0 ? void 0 : cta.enTitle) !== null && _b !== void 0 ? _b : 'Purchase on Website'))));
8713
8721
  };
8714
8722
  const getStyle = React.useCallback((style) => {
8715
8723
  if (style === null || style === void 0 ? void 0 : style.lineClamp) {
@@ -8755,7 +8763,7 @@ const CommodityDetail$1 = (_a) => {
8755
8763
  top: 0,
8756
8764
  objectFit: 'cover',
8757
8765
  width: '100%'
8758
- }), src: (_k = sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) !== null && _k !== void 0 ? _k : bottom_image, alt: '' }))),
8766
+ }), src: (_k = sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) !== null && _k !== void 0 ? _k : bottom_image, alt: 'pdp image' }))),
8759
8767
  React.createElement("div", { className: 'pb-commondity-content' }, renderContent({ isPost }))),
8760
8768
  renderBtn(),
8761
8769
  React.createElement(Modal$1, { visible: showModal, onClose: () => setShowModal(false) },
@@ -8959,9 +8967,9 @@ const Prompt$1 = (_a) => {
8959
8967
  };
8960
8968
  return (React.createElement("div", Object.assign({ className: `pb-prompt ${css.css(Object.assign({}, style))}` }, props),
8961
8969
  React.createElement("div", { className: 'pb-prompt-icon' },
8962
- React.createElement("img", { width: '100%', src: iconSrc !== null && iconSrc !== void 0 ? iconSrc : img$2 })),
8970
+ React.createElement("img", { width: '100%', src: iconSrc !== null && iconSrc !== void 0 ? iconSrc : img$2, alt: 'success image' })),
8963
8971
  React.createElement("div", { className: 'pb-prompt-content' }, content),
8964
- React.createElement("button", { className: 'pb-prompt-btn', style: submitButtonStyle, onClick: handleOk }, btnText)));
8972
+ React.createElement("button", { "aria-label": btnText, className: 'pb-prompt-btn', style: submitButtonStyle, onClick: handleOk }, btnText)));
8965
8973
  };
8966
8974
  var PromptComponent = React.memo(Prompt$1);
8967
8975
 
@@ -9185,7 +9193,7 @@ var settingRender$3 = [
9185
9193
  ];
9186
9194
 
9187
9195
  const CommodityDetailDiroNew$1 = (_a) => {
9188
- var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
9196
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
9189
9197
  var { style, isDefault, rec, viewTime, isPost, bottom_image, tipText, swiper, commodityStyles, buttonStyle, index } = _a, props = __rest(_a, ["style", "isDefault", "rec", "viewTime", "isPost", "bottom_image", "tipText", "swiper", "commodityStyles", "buttonStyle", "index"]);
9190
9198
  React.useState(true);
9191
9199
  const { sxpParameter } = useSxpDataSource();
@@ -9291,7 +9299,7 @@ Made in Italy` })));
9291
9299
  top: 0,
9292
9300
  objectFit: 'cover',
9293
9301
  width: '100%'
9294
- }), src: (_k = sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) !== null && _k !== void 0 ? _k : bottom_image, alt: '' }))),
9302
+ }), src: (_k = sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) !== null && _k !== void 0 ? _k : bottom_image, alt: 'pdp image' }))),
9295
9303
  React.createElement("div", { className: 'pb-commondityDiroNew-content' },
9296
9304
  React.createElement("div", { className: 'pb-commondityDiroNew-content-top' },
9297
9305
  React.createElement("div", { className: 'pb-commondityDiroNew-content-top-left' },
@@ -9300,7 +9308,7 @@ Made in Italy` })));
9300
9308
  React.createElement("div", { className: 'pb-commondityDiroNew-content-top-right' },
9301
9309
  React.createElement("div", { className: 'pb-commondityDiroNew-content-top-right-price', hidden: !!product && !(product === null || product === void 0 ? void 0 : product.price), style: getStyle(commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price) }, priceText),
9302
9310
  React.createElement("div", { className: 'pb-commondityDiroNew-content-top-right-price', hidden: !!product && !(product === null || product === void 0 ? void 0 : product.taxInfo), style: getStyle(commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.taxInfo) }, (_m = product === null || product === void 0 ? void 0 : product.taxInfo) !== null && _m !== void 0 ? _m : '税费'))),
9303
- (!product || (product === null || product === void 0 ? void 0 : product.link)) && (React.createElement("button", { onClick: handleLink, className: 'pb-commondityDiroNew-btn', style: buttonStyle }, (_o = cta === null || cta === void 0 ? void 0 : cta.enTitle) !== null && _o !== void 0 ? _o : 'Shop now')),
9311
+ (!product || (product === null || product === void 0 ? void 0 : product.link)) && (React.createElement("button", { "aria-label": (_o = cta === null || cta === void 0 ? void 0 : cta.enTitle) !== null && _o !== void 0 ? _o : 'Shop now', onClick: handleLink, className: 'pb-commondityDiroNew-btn', style: buttonStyle }, (_p = cta === null || cta === void 0 ? void 0 : cta.enTitle) !== null && _p !== void 0 ? _p : 'Shop now')),
9304
9312
  productInfoText({ isPost }))),
9305
9313
  React.createElement(Modal$1, { visible: showModal, onClose: () => setShowModal(false) }, productInfoText({ isPost: false }))));
9306
9314
  };
@@ -9792,7 +9800,7 @@ const Appoint$1 = (_a) => {
9792
9800
  const cta = (_b = recData === null || recData === void 0 ? void 0 : recData.video) === null || _b === void 0 ? void 0 : _b.bindCta;
9793
9801
  return (React.createElement(EventProvider$1, Object.assign({ isExternalLink: isExternalLink, rec: recData, className: css.css(Object.assign({ alignItems: 'center' }, style)), style: { display: 'flex' } }, props),
9794
9802
  React.createElement("div", { className: css.css(Object.assign({ overflow: 'hidden', flexShrink: 0, backgroundColor: '#f2f2f2' }, ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.img)) },
9795
- React.createElement("img", { className: css.css({ width: '100%', objectFit: 'cover', height: '100%', display: 'block' }), src: (_d = (_c = cta === null || cta === void 0 ? void 0 : cta.icon) !== null && _c !== void 0 ? _c : sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) !== null && _d !== void 0 ? _d : bottom_image, alt: '' })),
9803
+ React.createElement("img", { className: css.css({ width: '100%', objectFit: 'cover', height: '100%', display: 'block' }), src: (_d = (_c = cta === null || cta === void 0 ? void 0 : cta.icon) !== null && _c !== void 0 ? _c : sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) !== null && _d !== void 0 ? _d : bottom_image, alt: 'cta image' })),
9796
9804
  React.createElement("div", { className: css.css(Object.assign({ overflow: 'hidden', textOverflow: 'ellipsis' }, ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.ctaTitle)) }, (_e = cta === null || cta === void 0 ? void 0 : cta.enTitle) !== null && _e !== void 0 ? _e : 'Product Name')));
9797
9805
  };
9798
9806
  var AppointComponent = React.memo(Appoint$1);
@@ -10710,7 +10718,7 @@ const Navbar = ({ icon, styles, textStyle, onClose }) => {
10710
10718
  var _a;
10711
10719
  const { waterFallData, setOpenHashtag } = useSxpDataSource();
10712
10720
  return (React.createElement("div", { className: 'clc-sxp-nav', style: styles },
10713
- React.createElement("img", { className: 'clc-sxp-nav-left', src: icon, alt: '', onClick: onClose }),
10721
+ React.createElement("img", { className: 'clc-sxp-nav-left', src: icon, alt: 'back button', onClick: onClose }),
10714
10722
  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 : '标题'}`)));
10715
10723
  };
10716
10724
  var Navbar$1 = React.memo(Navbar);
@@ -12002,15 +12010,15 @@ const WaterfallFlowItem$1 = (props) => {
12002
12010
  const { rec, style = {}, sizeChange = () => { }, unitWidth, index, showBorder, list, reportTagsView, textStyles, space } = props;
12003
12011
  const { swiperRef, setRtcList, setOpenHashtag, sxpParameter } = useSxpDataSource();
12004
12012
  const [showVideo, setShowVideo] = React.useState(false);
12005
- const [isLoading, setIsLoading] = React.useState(false);
12006
- const [imgInfo, setImgInfo] = React.useState({
12013
+ React.useState(false);
12014
+ React.useState({
12007
12015
  height: 1,
12008
12016
  width: 1
12009
12017
  });
12010
12018
  const imgDom = React.useRef(null);
12011
12019
  const ref = React.useRef(null);
12012
- const videoDom = React.useRef(null);
12013
- const canvasRef = React.useRef(null);
12020
+ React.useRef(null);
12021
+ React.useRef(null);
12014
12022
  const [firstFrameSrc, setFirstFrameSrc] = React.useState('');
12015
12023
  const src = React.useMemo(() => {
12016
12024
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
@@ -12040,7 +12048,7 @@ const WaterfallFlowItem$1 = (props) => {
12040
12048
  return y;
12041
12049
  }, [style]);
12042
12050
  /** 是否加载图片 */
12043
- const isImgShow = React.useMemo(() => {
12051
+ React.useMemo(() => {
12044
12052
  if (top === undefined) {
12045
12053
  return false;
12046
12054
  }
@@ -12066,58 +12074,25 @@ const WaterfallFlowItem$1 = (props) => {
12066
12074
  if (imgDom.current === null || src === '') {
12067
12075
  return;
12068
12076
  }
12069
- const img = new Image();
12077
+ let imgSrc = null;
12070
12078
  if (showVideo && firstFrameSrc) {
12071
- img.src = firstFrameSrc;
12079
+ imgSrc = firstFrameSrc;
12072
12080
  }
12073
12081
  else {
12074
- img.src = src;
12082
+ imgSrc = src;
12075
12083
  }
12076
- img.onload = () => {
12077
- setImgInfo({
12078
- height: img.height,
12079
- width: img.width
12080
- });
12081
- setIsLoading(true);
12082
- };
12083
- imgDom.current.setSrc(img.src);
12084
- }, [src, showVideo, firstFrameSrc, isImgShow]);
12085
- React.useEffect(() => {
12086
- // 通过宽度比例获取图片高度
12087
- const height = imgInfo.height * (unitWidth / imgInfo.width);
12088
- if (isLoading) {
12084
+ if (imgSrc)
12085
+ imgDom.current.setSrc(imgSrc);
12086
+ }, [src, showVideo, firstFrameSrc]);
12087
+ const pictRef = React.useRef();
12088
+ const imgLoad = React.useCallback((img) => {
12089
+ setTimeout(() => {
12090
+ var _a;
12091
+ const height = (_a = pictRef === null || pictRef === void 0 ? void 0 : pictRef.current) === null || _a === void 0 ? void 0 : _a.offsetHeight;
12089
12092
  // 加56是因为下方文字部分高度为56,可以自己设置
12090
12093
  sizeChange(height + 56 + space, index);
12091
- }
12092
- }, [imgInfo, index, unitWidth, isLoading, space]); /* 增加sizeChange依赖项会导致在admin预览编辑时无限刷新 */
12093
- const calculateHeightForWidth = (videoWidth, videoHeight, targetWidth) => {
12094
- const aspectRatio = videoWidth / videoHeight;
12095
- const targetHeight = targetWidth / aspectRatio;
12096
- return targetHeight;
12097
- };
12098
- React.useEffect(() => {
12099
- const video = videoDom === null || videoDom === void 0 ? void 0 : videoDom.current;
12100
- if (video === null || src === '' || !showVideo) {
12101
- return;
12102
- }
12103
- video.src = src;
12104
- video.currentTime = 1;
12105
- video.crossOrigin = 'anonymous';
12106
- video.onloadeddata = () => {
12107
- const canvas = canvasRef === null || canvasRef === void 0 ? void 0 : canvasRef.current;
12108
- if (!canvas)
12109
- return;
12110
- const ctx = canvas.getContext('2d');
12111
- const targetWidth = (window === null || window === void 0 ? void 0 : window.innerWidth) / 2;
12112
- const targetHeight = calculateHeightForWidth(video.videoWidth, video.videoHeight, targetWidth);
12113
- canvas.height = targetHeight;
12114
- canvas.width = targetWidth;
12115
- ctx === null || ctx === void 0 ? void 0 : ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
12116
- setFirstFrameSrc(canvas.toDataURL());
12117
- video.remove();
12118
- canvas.remove();
12119
- };
12120
- }, [src, showVideo]);
12094
+ }, 0);
12095
+ }, [space, sizeChange, index, unitWidth, pictRef]);
12121
12096
  const handleClickToDetail = () => {
12122
12097
  reportTagsView();
12123
12098
  setRtcList === null || setRtcList === void 0 ? void 0 : setRtcList(list);
@@ -12128,17 +12103,14 @@ const WaterfallFlowItem$1 = (props) => {
12128
12103
  }, 0);
12129
12104
  };
12130
12105
  return (React.createElement("div", { ref: ref, style: Object.assign({}, style), className: 'waterFallList-content-listItem', key: index, onClick: handleClickToDetail },
12131
- React.createElement("div", { className: 'waterFallList-content-listItem-picture' },
12132
- showVideo && (React.createElement("div", { style: { display: 'none' } },
12133
- React.createElement("video", { ref: videoDom, src: src, crossOrigin: 'anonymous', className: 'waterFallList-content-listItem-picture-img' }),
12134
- React.createElement("canvas", { ref: canvasRef }))),
12135
- React.createElement(FormatImage$1, { loading: 'lazy', className: 'waterFallList-content-listItem-picture-img', ref: imgDom })),
12106
+ React.createElement("div", { className: 'waterFallList-content-listItem-picture', ref: pictRef },
12107
+ React.createElement(FormatImage$1, { loading: 'lazy', className: 'waterFallList-content-listItem-picture-img', onLoad: imgLoad, ref: imgDom })),
12136
12108
  React.createElement("div", { className: 'waterFallList-content-listItem-info' },
12137
12109
  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),
12138
12110
  React.createElement("div", { className: 'waterFallList-content-listItem-info-price', hidden: !priceText, style: textStyles.price }, priceText))));
12139
12111
  };
12140
12112
  function WaterfallList$1(_a) {
12141
- var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
12113
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
12142
12114
  var { reportTagsView, showBanner } = _a, props = __rest(_a, ["reportTagsView", "showBanner"]);
12143
12115
  const { waterFallData, getRecommendVideos, hashTagSize, loadingImage, isOpenHashTag } = useSxpDataSource();
12144
12116
  /** 滚动的父元素 */
@@ -12190,7 +12162,6 @@ function WaterfallList$1(_a) {
12190
12162
  for (let i = 0; i < (list === null || list === void 0 ? void 0 : list.length); i++) {
12191
12163
  // 原本应对应的行数
12192
12164
  const currentRow = Math.floor(i / rowsNum);
12193
- //
12194
12165
  const remainder = (i % rowsNum) + 1;
12195
12166
  // 最低item下标
12196
12167
  let minHeightInd = 0;
@@ -12367,7 +12338,7 @@ function WaterfallList$1(_a) {
12367
12338
  } }))),
12368
12339
  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 }),
12369
12340
  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' }) },
12370
- 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'))))));
12341
+ 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'))))));
12371
12342
  }
12372
12343
 
12373
12344
  var img$1 = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAAXNSR0IArs4c6QAAAaZJREFUeF7t2jFKBEEQRuG3mSJeQTARURDMTL2EqXfwAnoKD6FHMDEzNVIw2tzQC2gFggyDrExX1V92T7wz9PumFnqbXdH5teq8nwEwJqBzgfEVKDYAW8Ae8NZq3ZUm4Aa4AnaBR+C8BUIVAIu/ngSfAs9LESoAWLgB/LzWwP7SeLtfHWAu3tZ9Adz/dwD3eOUJCIlXBQiLVwQIjVcDCI9XAkiJVwFIi1cASI3PBpjb3jbd5GyyUcraCUrEZ02ATHwGgFR8NIBcfCSAZHwUgGx8BIB0vDeAfLwnQIl4L4Ay8R4ApeJbA2wD78DOZA/e7ABzk739Xz/T8rfAIfA6WYCd3BqA7NUSwCKfgLNKCK0BjoC7rzP74yoIrQGsuxSCB0ApBC+AMgieACUQvAHkESIApBGiAGQRIgEkEaIB5BAyAKQQsgBkEDIBJBCyAdIRFABSEVQA0hCUAFIQ1ADCERQBQhFUAcIQlAFCENQBfkOwg9eXpeftFQDmEOzv8ifARy8A3wiXwAHwANwujbf7q0xAi9bZZwwAN9oiDx4TUORFuS2z+wn4BAiAaEHnKChjAAAAAElFTkSuQmCC";
@@ -12496,7 +12467,7 @@ const WaterfallFlowItem = (props) => {
12496
12467
  React.createElement("div", { className: 'list-content-listItem-info-price', style: textStyles === null || textStyles === void 0 ? void 0 : textStyles.price, hidden: !priceText }, priceText))));
12497
12468
  };
12498
12469
  function WaterfallList(_a) {
12499
- var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
12470
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
12500
12471
  var { reportTagsView, showBanner } = _a, props = __rest(_a, ["reportTagsView", "showBanner"]);
12501
12472
  const { waterFallData, getRecommendVideos, hashTagSize, loadingImage, isOpenHashTag } = useSxpDataSource();
12502
12473
  const [list, setList] = React.useState();
@@ -12585,20 +12556,20 @@ function WaterfallList(_a) {
12585
12556
  } })),
12586
12557
  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 }),
12587
12558
  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' }) },
12588
- 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'))))));
12559
+ 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'))))));
12589
12560
  }
12590
12561
 
12591
12562
  /*
12592
12563
  * @Author: binruan@chatlabs.com
12593
12564
  * @Date: 2024-01-10 10:58:24
12594
12565
  * @LastEditors: binruan@chatlabs.com
12595
- * @LastEditTime: 2024-06-12 14:18:56
12566
+ * @LastEditTime: 2024-06-20 12:45:26
12596
12567
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\WaterFall\index.tsx
12597
12568
  *
12598
12569
  */
12599
12570
  const WaterFall = (props) => {
12600
12571
  var _a;
12601
- const { waterFallData, setOpenHashtag, openHashtag, swiperRef, setWaterFallData, cacheRtcList, setRtcList, cacheActiveIndex, rtcList, setCacheRtcList, setIsFromHashtag, isFromHashtag, bffEventReport, themeTag } = useSxpDataSource();
12572
+ const { waterFallData, setOpenHashtag, openHashtag, swiperRef, setWaterFallData, cacheRtcList, setRtcList, cacheActiveIndex, rtcList, setCacheRtcList, setIsFromHashtag, isFromHashtag, bffEventReport, themeTag, selectTag } = useSxpDataSource();
12602
12573
  const { backMainFeed } = useEventReport();
12603
12574
  React.useRef(null);
12604
12575
  const modalEleRef = React.useRef(null);
@@ -12620,9 +12591,7 @@ const WaterFall = (props) => {
12620
12591
  if (!isEq && cacheRtcList && (cacheRtcList === null || cacheRtcList === void 0 ? void 0 : cacheRtcList.length)) {
12621
12592
  setRtcList === null || setRtcList === void 0 ? void 0 : setRtcList(cacheRtcList);
12622
12593
  }
12623
- if (!(themeTag === null || themeTag === void 0 ? void 0 : themeTag.current)) {
12624
- backMainFeed('branch', themeTag === null || themeTag === void 0 ? void 0 : themeTag.current, waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.hashTag);
12625
- }
12594
+ backMainFeed('branch', selectTag, undefined, waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.hashTag);
12626
12595
  reportTagsView();
12627
12596
  setWaterFallData === null || setWaterFallData === void 0 ? void 0 : setWaterFallData(undefined);
12628
12597
  setIsFromHashtag === null || setIsFromHashtag === void 0 ? void 0 : setIsFromHashtag(false);
@@ -12934,7 +12903,7 @@ const LikeButton = (_a) => {
12934
12903
  }
12935
12904
  }
12936
12905
  }), 200);
12937
- return (React.createElement("button", Object.assign({}, props, { onClick: handleClick }),
12906
+ return (React.createElement("button", Object.assign({}, props, { "aria-label": 'like', onClick: handleClick }),
12938
12907
  React.createElement("img", { style: { width: '100%', height: '100%', objectFit: 'contain' }, src: state ? activeIcon || likeIcon : unActicveIcon || unlikeIcon, alt: 'icon' })));
12939
12908
  };
12940
12909
  var LikeButton$1 = React.memo(LikeButton);
@@ -13193,7 +13162,7 @@ const VideoWidget$2 = ({ rec, index, height, data, muted, activeIndex, videoPost
13193
13162
  if (!(sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.placeholder_image) || isLoadFinish) {
13194
13163
  return null;
13195
13164
  }
13196
- 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 }));
13165
+ 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' }));
13197
13166
  }, [isLoadFinish, sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.placeholder_image]);
13198
13167
  React.useEffect(() => {
13199
13168
  if (!videoRef)
@@ -13226,7 +13195,7 @@ const VideoWidget$2 = ({ rec, index, height, data, muted, activeIndex, videoPost
13226
13195
  } },
13227
13196
  React.createElement("div", { style: { position: 'relative', width: '100%', height: '100%' } },
13228
13197
  React.createElement("div", { className: 'n-full-screen', ref: videoEleRef, id: videoId, style: { width: '100%', height: '100%' } }),
13229
- React.createElement("img", { hidden: !isPauseVideo, className: 'clc-pb-video-pause', src: PAUSE_ICON }))),
13198
+ React.createElement("img", { hidden: !isPauseVideo, className: 'clc-pb-video-pause', alt: 'pause', src: PAUSE_ICON }))),
13230
13199
  renderPoster)) : (React.createElement("div", { className: 'video-container', key: rec === null || rec === void 0 ? void 0 : rec.video.itemId, style: {
13231
13200
  position: 'relative',
13232
13201
  width: '100%',
@@ -13235,7 +13204,7 @@ const VideoWidget$2 = ({ rec, index, height, data, muted, activeIndex, videoPost
13235
13204
  }, onClick: handleClickVideo() },
13236
13205
  React.createElement("div", { className: 'n-full-screen', ref: videoEleRef, id: videoId, style: { width: '100%', height: '100%' } }),
13237
13206
  renderPoster,
13238
- React.createElement("img", { hidden: !isPauseVideo, className: 'clc-pb-video-pause', src: PAUSE_ICON })))));
13207
+ React.createElement("img", { hidden: !isPauseVideo, className: 'clc-pb-video-pause', src: PAUSE_ICON, alt: 'pause' })))));
13239
13208
  };
13240
13209
  var VideoWidget$3 = React.memo(VideoWidget$2);
13241
13210
 
@@ -13255,8 +13224,8 @@ const ToggleButton = ({ defaultValue, activeIcon, unactiveIcon, onChange, style
13255
13224
  setIsTure(result);
13256
13225
  onChange === null || onChange === void 0 ? void 0 : onChange(result);
13257
13226
  };
13258
- return (React.createElement("button", { style: style, className: 'pb-toggle-button', onClick: handleClick },
13259
- React.createElement("img", { className: 'pb-toggle-button-icon', src: isTrue ? activeIcon : unactiveIcon })));
13227
+ return (React.createElement("button", { style: style, "aria-label": 'toggle button', className: 'pb-toggle-button', onClick: handleClick },
13228
+ React.createElement("img", { className: 'pb-toggle-button-icon', alt: 'toggle image', src: isTrue ? activeIcon : unactiveIcon })));
13260
13229
  };
13261
13230
  var ToggleButton$1 = React.memo(ToggleButton);
13262
13231
 
@@ -13281,7 +13250,7 @@ const FingerSwipeTip = ({ imageUrl, style }) => {
13281
13250
  return show ? 'pb-fadeIn' : 'pb-fadeOut';
13282
13251
  }, [show]);
13283
13252
  return (React.createElement("div", { hidden: !show, className: `pb-finger-wrap ${animationCls}`, style: style },
13284
- React.createElement("img", { src: imageUrl || FINGER_SWIPE_ICON })));
13253
+ React.createElement("img", { src: imageUrl || FINGER_SWIPE_ICON, alt: 'finger swiper' })));
13285
13254
  };
13286
13255
 
13287
13256
  /*
@@ -13543,7 +13512,7 @@ const Nudge = ({ nudge }) => {
13543
13512
  backgroundColor: nudge === null || nudge === void 0 ? void 0 : nudge.backgroundColor,
13544
13513
  borderRadius: (_f = nudge === null || nudge === void 0 ? void 0 : nudge.borderRadius) !== null && _f !== void 0 ? _f : 4
13545
13514
  } },
13546
- (nudge === null || nudge === void 0 ? void 0 : nudge.icon) ? React.createElement("img", { src: nudge.icon, style: { height: '100%', objectFit: 'cover', flexShrink: 0 } }) : null,
13515
+ (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,
13547
13516
  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 : '')))));
13548
13517
  };
13549
13518
 
@@ -13551,14 +13520,12 @@ const Nudge = ({ nudge }) => {
13551
13520
  * @Author: binruan@chatlabs.com
13552
13521
  * @Date: 2024-04-29 16:32:21
13553
13522
  * @LastEditors: binruan@chatlabs.com
13554
- * @LastEditTime: 2024-06-12 11:01:48
13523
+ * @LastEditTime: 2024-06-20 10:53:08
13555
13524
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\Tagbar.tsx
13556
13525
  *
13557
13526
  */
13558
- const DEFAULT_TAG = 'FOR U';
13559
13527
  const Tagbar = ({ tagList = [], setActiveIndex }) => {
13560
- const [selectTag, setSelectTag] = React.useState(DEFAULT_TAG);
13561
- const { getRecommendVideos, setRtcList, setCacheRtcList, setCacheActiveIndex, setLoading, swiperRef, waterFallData, bffEventReport } = useSxpDataSource();
13528
+ const { getRecommendVideos, setRtcList, setCacheRtcList, setCacheActiveIndex, setLoading, swiperRef, waterFallData, bffEventReport, selectTag, setSelectTag } = useSxpDataSource();
13562
13529
  const { backMainFeed } = useEventReport();
13563
13530
  const realTagList = React.useMemo(() => {
13564
13531
  return [DEFAULT_TAG, ...tagList];
@@ -13571,12 +13538,12 @@ const Tagbar = ({ tagList = [], setActiveIndex }) => {
13571
13538
  eventInfo: {
13572
13539
  eventSubject: 'clickThemeTagsViewContents',
13573
13540
  eventDescription: 'click Theme Tags View Contents',
13574
- themeTags: `[${tag}]`
13541
+ themeTags: `['${tag}']`
13575
13542
  }
13576
13543
  });
13577
13544
  }
13578
13545
  else {
13579
- backMainFeed('theme', selectTag);
13546
+ backMainFeed('theme', tag, selectTag);
13580
13547
  }
13581
13548
  let themeTag;
13582
13549
  if (tag !== DEFAULT_TAG) {
@@ -13594,7 +13561,7 @@ const Tagbar = ({ tagList = [], setActiveIndex }) => {
13594
13561
  }).finally(() => {
13595
13562
  setLoading === null || setLoading === void 0 ? void 0 : setLoading(false);
13596
13563
  });
13597
- setSelectTag(tag);
13564
+ setSelectTag === null || setSelectTag === void 0 ? void 0 : setSelectTag(tag);
13598
13565
  };
13599
13566
  if (waterFallData || tagList.length <= 0)
13600
13567
  return null;
@@ -13609,7 +13576,7 @@ var Tagbar$1 = React.memo(Tagbar);
13609
13576
  * @Author: binruan@chatlabs.com
13610
13577
  * @Date: 2024-01-15 19:03:09
13611
13578
  * @LastEditors: binruan@chatlabs.com
13612
- * @LastEditTime: 2024-06-18 11:50:31
13579
+ * @LastEditTime: 2024-06-20 15:54:53
13613
13580
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\index.tsx
13614
13581
  *
13615
13582
  */
@@ -13618,12 +13585,12 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
13618
13585
  const { schema } = useEditor();
13619
13586
  const [activeIndex, setActiveIndex] = React.useState(0);
13620
13587
  const viewImageStartTime = React.useRef(0);
13621
- const [isInit, setIsInit] = React.useState(false);
13588
+ React.useState(false);
13622
13589
  const [isMuted, setIsMuted] = React.useState(true);
13623
13590
  const viewTime = React.useRef();
13624
13591
  const [isLoadMore, setIsLoadMore] = React.useState(false);
13625
13592
  const [isShowMore, setIsShowMore] = React.useState(false);
13626
- const { loadVideos, bffEventReport, loading, setPopupDetailData, ctaEvent, swiperRef, waterFallData, setOpenHashtag, appDomain, openHashtag, loadingImage, isFromHashtag, popupDetailData, bffFbReport, curTime, h5EnterLink } = useSxpDataSource();
13593
+ const { loadVideos, bffEventReport, loading, setPopupDetailData, ctaEvent, swiperRef, waterFallData, setOpenHashtag, appDomain, openHashtag, loadingImage, isFromHashtag, popupDetailData, bffFbReport, curTime, h5EnterLink, isShowConsent, selectTag } = useSxpDataSource();
13627
13594
  const { backMainFeed } = useEventReport();
13628
13595
  const [videoRef, setVideoRef] = React.useState(null);
13629
13596
  const playerRef = React.useRef();
@@ -13631,21 +13598,29 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
13631
13598
  const isShowFingerTip = React.useMemo(() => {
13632
13599
  return data.length > 0 && !loading && getFeUserId();
13633
13600
  }, [data, loading]);
13634
- const handleH5EnterLink = React.useCallback(() => {
13635
- if (data.length <= 0) {
13636
- return;
13601
+ React.useEffect(() => {
13602
+ refreshFeSessionId();
13603
+ }, []);
13604
+ React.useEffect(() => {
13605
+ if ((data === null || data === void 0 ? void 0 : data.length) > 0) {
13606
+ const now = new Date();
13607
+ viewTime.current = now;
13608
+ bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
13609
+ eventName: 'PageView'
13610
+ });
13637
13611
  }
13612
+ }, [data === null || data === void 0 ? void 0 : data.length]);
13613
+ const handleH5EnterLink = React.useCallback(() => {
13638
13614
  refreshFeSessionId();
13639
- const now = new Date();
13640
- viewTime.current = now;
13641
- if (isInit) {
13642
- h5EnterLink === null || h5EnterLink === void 0 ? void 0 : h5EnterLink();
13615
+ h5EnterLink === null || h5EnterLink === void 0 ? void 0 : h5EnterLink();
13616
+ if (data.length > 0) {
13617
+ const now = new Date();
13618
+ viewTime.current = now;
13619
+ bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
13620
+ eventName: 'PageView'
13621
+ });
13643
13622
  }
13644
- bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
13645
- eventName: 'PageView'
13646
- });
13647
- setIsInit(true);
13648
- }, [data.length, bffFbReport, h5EnterLink, isInit]);
13623
+ }, [data.length, bffFbReport, h5EnterLink]);
13649
13624
  const firstRef = React.useRef();
13650
13625
  React.useEffect(() => {
13651
13626
  var _a, _b, _c, _d;
@@ -13673,10 +13648,6 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
13673
13648
  });
13674
13649
  }
13675
13650
  }, [videoRef, licenseUrl, data]);
13676
- React.useEffect(() => {
13677
- if (!isInit)
13678
- handleH5EnterLink();
13679
- }, [handleH5EnterLink, isInit]);
13680
13651
  React.useEffect(() => {
13681
13652
  var _a;
13682
13653
  const index = (data === null || data === void 0 ? void 0 : data.findIndex((item) => {
@@ -13697,10 +13668,11 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
13697
13668
  const item = data === null || data === void 0 ? void 0 : data[activeIndex];
13698
13669
  const visibleChange = () => {
13699
13670
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
13671
+ const repCond = !openHashtag && !isShowConsent;
13700
13672
  if (document.visibilityState === 'hidden') {
13701
13673
  // 当用户导航到新页面、切换标签页、关闭标签页、最小化或关闭浏览器、刷新原页面(即离开原页面时),或者在移动设备上从浏览器切换到不同的应用程序时
13702
13674
  // 移动端h5直接杀掉浏览器或宿主app时不会触发,pc端直接杀掉标签页时能触发
13703
- if (!openHashtag) {
13675
+ if (repCond) {
13704
13676
  SXP_EVENT_BUS.emit(SXP_EVENT_TYPE.PAGE_DID_HIDE, item);
13705
13677
  handleReportViewImageEnd(item);
13706
13678
  handleReportProductView(item);
@@ -13741,11 +13713,11 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
13741
13713
  else if (document.visibilityState === 'visible') {
13742
13714
  // 页面可见时触发,注意页面初始化时不会触发
13743
13715
  handleH5EnterLink();
13744
- if (!openHashtag) {
13716
+ if (repCond) {
13745
13717
  handleViewImageStartEvent(activeIndex);
13746
13718
  SXP_EVENT_BUS.emit(SXP_EVENT_TYPE.PAGE_DID_SHOW, item);
13719
+ backMainFeed('external', selectTag);
13747
13720
  }
13748
- backMainFeed('external');
13749
13721
  }
13750
13722
  };
13751
13723
  document.addEventListener('visibilitychange', visibleChange);
@@ -13762,17 +13734,10 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
13762
13734
  tempMap,
13763
13735
  curTime,
13764
13736
  backMainFeed,
13765
- openHashtag
13737
+ openHashtag,
13738
+ isShowConsent,
13739
+ selectTag
13766
13740
  ]);
13767
- React.useEffect(() => {
13768
- const initTime = () => {
13769
- backMainFeed('external');
13770
- };
13771
- window.addEventListener('pageshow', initTime);
13772
- return () => {
13773
- window.removeEventListener('pageshow', initTime);
13774
- };
13775
- }, []);
13776
13741
  const tagHeight = React.useMemo(() => {
13777
13742
  let h = 0;
13778
13743
  if (tagList.length > 0) {
@@ -14045,24 +14010,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
14045
14010
  });
14046
14011
  }
14047
14012
  }
14048
- },
14049
- // style={{
14050
- // pointerEvents: canSwiper ? 'auto' : 'none'
14051
- // }}
14052
- // onReachEnd={() => {
14053
- // // 由hashtaglist跳转过来时不执行下面的方法
14054
- // if (waterFallData) return;
14055
- // if (!isLoadMore) {
14056
- // console.log('trigger load 2');
14057
- // setIsLoadMore(true);
14058
- // loadVideos?.(Math.ceil(activeIndex / 10) + 1).then(() => {
14059
- // setIsLoadMore(false);
14060
- // });
14061
- // }
14062
- // }}
14063
- // modules={[Virtual]}
14064
- // virtual={{ enabled: true, cache: true }}
14065
- direction: 'vertical', height: height },
14013
+ }, direction: 'vertical', height: height },
14066
14014
  React.createElement(ToggleButton$1, { style: {
14067
14015
  position: 'fixed',
14068
14016
  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',
@@ -14261,7 +14209,7 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
14261
14209
  if (!(sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.placeholder_image) || isLoadFinish) {
14262
14210
  return null;
14263
14211
  }
14264
- 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 }));
14212
+ 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' }));
14265
14213
  }, [isLoadFinish, sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.placeholder_image]);
14266
14214
  React.useEffect(() => {
14267
14215
  const handleBeforeUnload = () => {
@@ -14310,7 +14258,7 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
14310
14258
  height,
14311
14259
  objectFit: 'contain'
14312
14260
  } }),
14313
- React.createElement("img", { hidden: !isPauseVideo, className: 'clc-pb-video-pause', src: PAUSE_ICON }))),
14261
+ React.createElement("img", { hidden: !isPauseVideo, className: 'clc-pb-video-pause', src: PAUSE_ICON, alt: 'video pause image' }))),
14314
14262
  renderPoster)) : (React.createElement("div", { className: 'video-container', key: rec === null || rec === void 0 ? void 0 : rec.video.itemId, onClick: handleClickVideo(), style: {
14315
14263
  position: 'relative',
14316
14264
  width,
@@ -14319,7 +14267,7 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
14319
14267
  } },
14320
14268
  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 }),
14321
14269
  renderPoster,
14322
- React.createElement("img", { hidden: !isPauseVideo, className: 'clc-pb-video-pause', src: PAUSE_ICON })))));
14270
+ React.createElement("img", { hidden: !isPauseVideo, className: 'clc-pb-video-pause', src: PAUSE_ICON, alt: 'video pause image' })))));
14323
14271
  };
14324
14272
  var VideoWidget$1 = React.memo(VideoWidget);
14325
14273
 
@@ -14606,4 +14554,3 @@ exports.default = Pagebuilder;
14606
14554
  exports.defaultSetting = defaultSetting;
14607
14555
  exports.materials = _materials_;
14608
14556
  exports.useEditorDataProvider = useEditorDataProvider;
14609
- //# sourceMappingURL=index.cjs.map