pb-sxp-ui 1.0.61 → 1.0.62

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.
package/dist/index.js CHANGED
@@ -3,10 +3,10 @@ import { v4 } from 'uuid';
3
3
  import pako from 'pako';
4
4
  import React, { useContext, useMemo, createContext, memo, useState, useRef, useEffect, useCallback, forwardRef, useImperativeHandle, useLayoutEffect } from 'react';
5
5
  import qs from 'qs';
6
+ import EventEmitter from 'eventemitter3';
6
7
  import { css } from '@emotion/css';
7
8
  import { BetaSchemaForm } from '@ant-design/pro-components';
8
9
  import * as ReactDOM from 'react-dom';
9
- import EventEmitter from 'eventemitter3';
10
10
  import Hls from 'hls.js';
11
11
 
12
12
  /******************************************************************************
@@ -407,6 +407,14 @@ function useIconLink(path, domain) {
407
407
  }, [appDomain, path, domain]);
408
408
  }
409
409
 
410
+ const SXP_EVENT_BUS = new EventEmitter();
411
+ var SXP_EVENT_TYPE;
412
+ (function (SXP_EVENT_TYPE) {
413
+ SXP_EVENT_TYPE["PAGE_DID_SHOW"] = "pageDidShow";
414
+ SXP_EVENT_TYPE["PAGE_DID_HIDE"] = "pageDidHide";
415
+ SXP_EVENT_TYPE["CHANGE_THEME_TAG"] = "changeThemeTag";
416
+ })(SXP_EVENT_TYPE || (SXP_EVENT_TYPE = {}));
417
+
410
418
  const SxpDataSourceContext = createContext({
411
419
  rtcList: [],
412
420
  tagList: []
@@ -431,6 +439,16 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
431
439
  const [cacheActiveIndex, setCacheActiveIndex] = useState(0);
432
440
  const [isFromHashtag, setIsFromHashtag] = useState(false);
433
441
  const [videoRef, setVideoRef] = useState(null);
442
+ const themeTag = useRef();
443
+ useEffect(() => {
444
+ const handleChangeThemeTag = (tag) => {
445
+ themeTag.current = tag;
446
+ };
447
+ SXP_EVENT_BUS.on(SXP_EVENT_TYPE.CHANGE_THEME_TAG, handleChangeThemeTag);
448
+ return () => {
449
+ SXP_EVENT_BUS.off(SXP_EVENT_TYPE.CHANGE_THEME_TAG, handleChangeThemeTag);
450
+ };
451
+ }, []);
434
452
  useEffect(() => {
435
453
  setOpenHashtag(isOpenHashTag);
436
454
  }, [isOpenHashTag]);
@@ -473,7 +491,8 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
473
491
  'itemFilter.itemId': query === null || query === void 0 ? void 0 : query['itemFilter.itemId'],
474
492
  'itemFilter.itemType': query === null || query === void 0 ? void 0 : query['itemFilter.itemType'],
475
493
  hashTag: query === null || query === void 0 ? void 0 : query.hashTag,
476
- traceInfo: query === null || query === void 0 ? void 0 : query.traceInfo
494
+ traceInfo: query === null || query === void 0 ? void 0 : query.traceInfo,
495
+ themeTag: query === null || query === void 0 ? void 0 : query.themeTag
477
496
  };
478
497
  if (utmVal) {
479
498
  const val = (_e = (_d = (_c = utmVal === null || utmVal === void 0 ? void 0 : utmVal.split('&')) === null || _c === void 0 ? void 0 : _c.filter((val) => {
@@ -498,7 +517,8 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
498
517
  const data = yield getRecommendVideos({
499
518
  hashTag: waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.hashTag,
500
519
  'itemFilter.itemId': waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.itemId,
501
- 'itemFilter.itemType': waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.itemType
520
+ 'itemFilter.itemType': waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.itemType,
521
+ themeTag: themeTag.current
502
522
  });
503
523
  setRtcList(rtcList.concat((_f = data === null || data === void 0 ? void 0 : data.recList) !== null && _f !== void 0 ? _f : []));
504
524
  setCacheRtcList(cacheRtcList.concat((_g = data === null || data === void 0 ? void 0 : data.recList) !== null && _g !== void 0 ? _g : []));
@@ -9302,7 +9322,7 @@ const EventProvider = (_a) => {
9302
9322
  }
9303
9323
  }, [isOnScreen, ref, rec, ctaEvent, index]);
9304
9324
  const handleClick = throttle(() => {
9305
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
9325
+ var _a, _b, _c, _d, _e, _f, _g, _h;
9306
9326
  const item = (_b = (_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.bindProduct) !== null && _b !== void 0 ? _b : rec === null || rec === void 0 ? void 0 : rec.video;
9307
9327
  ctaEvent === null || ctaEvent === void 0 ? void 0 : ctaEvent({
9308
9328
  eventSubject: 'clickCta',
@@ -9314,8 +9334,7 @@ const EventProvider = (_a) => {
9314
9334
  const cta = (_e = rec === null || rec === void 0 ? void 0 : rec.video) === null || _e === void 0 ? void 0 : _e.bindCta;
9315
9335
  const product = (_f = rec === null || rec === void 0 ? void 0 : rec.video) === null || _f === void 0 ? void 0 : _f.bindProduct;
9316
9336
  jumpToWeb(rec, product, cta, index);
9317
- window.location.href = (_h = (_g = rec === null || rec === void 0 ? void 0 : rec.video) === null || _g === void 0 ? void 0 : _g.bindProduct) === null || _h === void 0 ? void 0 : _h.link;
9318
- window.location.href = window.getJointUtmLink((_k = (_j = rec === null || rec === void 0 ? void 0 : rec.video) === null || _j === void 0 ? void 0 : _j.bindProduct) === null || _k === void 0 ? void 0 : _k.link);
9337
+ window.location.href = window.getJointUtmLink((_h = (_g = rec === null || rec === void 0 ? void 0 : rec.video) === null || _g === void 0 ? void 0 : _g.bindProduct) === null || _h === void 0 ? void 0 : _h.link);
9319
9338
  }
9320
9339
  }
9321
9340
  else {
@@ -12086,13 +12105,6 @@ const LikeButton = (_a) => {
12086
12105
  };
12087
12106
  var LikeButton$1 = memo(LikeButton);
12088
12107
 
12089
- const SXP_EVENT_BUS = new EventEmitter();
12090
- var SXP_EVENT_TYPE;
12091
- (function (SXP_EVENT_TYPE) {
12092
- SXP_EVENT_TYPE["PAGE_DID_SHOW"] = "pageDidShow";
12093
- SXP_EVENT_TYPE["PAGE_DID_HIDE"] = "pageDidHide";
12094
- })(SXP_EVENT_TYPE || (SXP_EVENT_TYPE = {}));
12095
-
12096
12108
  const VideoWidget$2 = ({ rec, index, height, data, muted, activeIndex, videoPostConfig, videoRef }) => {
12097
12109
  const [isPauseVideo, setIsPauseVideo] = useState(false);
12098
12110
  const { bffEventReport, sxpParameter, waterFallData, openHashtag, bffFbReport } = useSxpDataSource();
@@ -12700,7 +12712,7 @@ const Nudge = ({ nudge }) => {
12700
12712
  const DEFAULT_TAG = 'FOR U';
12701
12713
  const Tagbar = ({ tagList = [], setActiveIndex }) => {
12702
12714
  const [selectTag, setSelectTag] = useState(DEFAULT_TAG);
12703
- const { getRecommendVideos, setRtcList, setCacheRtcList, setCacheActiveIndex, setLoading, swiperRef } = useSxpDataSource();
12715
+ const { getRecommendVideos, setRtcList, setCacheRtcList, setCacheActiveIndex, setLoading, swiperRef, waterFallData } = useSxpDataSource();
12704
12716
  const realTagList = useMemo(() => {
12705
12717
  return [DEFAULT_TAG, ...tagList];
12706
12718
  }, [tagList]);
@@ -12714,6 +12726,7 @@ const Tagbar = ({ tagList = [], setActiveIndex }) => {
12714
12726
  setLoading === null || setLoading === void 0 ? void 0 : setLoading(true);
12715
12727
  getRecommendVideos === null || getRecommendVideos === void 0 ? void 0 : getRecommendVideos({ themeTag }).then((res) => {
12716
12728
  var _a, _b, _c, _d;
12729
+ SXP_EVENT_BUS.emit(SXP_EVENT_TYPE.CHANGE_THEME_TAG, themeTag);
12717
12730
  setRtcList === null || setRtcList === void 0 ? void 0 : setRtcList((_a = res === null || res === void 0 ? void 0 : res.recList) !== null && _a !== void 0 ? _a : []);
12718
12731
  setCacheRtcList === null || setCacheRtcList === void 0 ? void 0 : setCacheRtcList((_b = res === null || res === void 0 ? void 0 : res.recList) !== null && _b !== void 0 ? _b : []);
12719
12732
  setActiveIndex === null || setActiveIndex === void 0 ? void 0 : setActiveIndex(0);
@@ -12724,7 +12737,7 @@ const Tagbar = ({ tagList = [], setActiveIndex }) => {
12724
12737
  });
12725
12738
  setSelectTag(tag);
12726
12739
  };
12727
- if (tagList.length <= 0)
12740
+ if (waterFallData || tagList.length <= 0)
12728
12741
  return null;
12729
12742
  return (React.createElement("div", { className: 'clc-sxp-tagbar' },
12730
12743
  React.createElement("ul", { className: 'clc-sxp-tagbar-list', style: { margin: 'auto', gap: 24 } }, realTagList.map((tag) => {
@@ -12916,9 +12929,12 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
12916
12929
  }
12917
12930
  if (tagList.length > 0) {
12918
12931
  minusHeight += 45;
12932
+ if (waterFallData) {
12933
+ minusHeight -= 45;
12934
+ }
12919
12935
  }
12920
12936
  return containerHeight - minusHeight;
12921
- }, [globalConfig, containerHeight, tagList]);
12937
+ }, [globalConfig, containerHeight, tagList, waterFallData]);
12922
12938
  const renderLogo = useMemo(() => {
12923
12939
  if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.logoUrl) && (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowLogo)) {
12924
12940
  return (React.createElement("div", { className: 'clc-sxp-logo-banner', style: { backgroundColor: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.color } },