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.cjs CHANGED
@@ -7,10 +7,10 @@ var uuid$1 = require('uuid');
7
7
  var pako = require('pako');
8
8
  var React = require('react');
9
9
  var qs = require('qs');
10
+ var EventEmitter = require('eventemitter3');
10
11
  var css = require('@emotion/css');
11
12
  var proComponents = require('@ant-design/pro-components');
12
13
  var ReactDOM = require('react-dom');
13
- var EventEmitter = require('eventemitter3');
14
14
  var Hls = require('hls.js');
15
15
 
16
16
  function _interopNamespaceDefault(e) {
@@ -430,6 +430,14 @@ function useIconLink(path, domain) {
430
430
  }, [appDomain, path, domain]);
431
431
  }
432
432
 
433
+ const SXP_EVENT_BUS = new EventEmitter();
434
+ var SXP_EVENT_TYPE;
435
+ (function (SXP_EVENT_TYPE) {
436
+ SXP_EVENT_TYPE["PAGE_DID_SHOW"] = "pageDidShow";
437
+ SXP_EVENT_TYPE["PAGE_DID_HIDE"] = "pageDidHide";
438
+ SXP_EVENT_TYPE["CHANGE_THEME_TAG"] = "changeThemeTag";
439
+ })(SXP_EVENT_TYPE || (SXP_EVENT_TYPE = {}));
440
+
433
441
  const SxpDataSourceContext = React.createContext({
434
442
  rtcList: [],
435
443
  tagList: []
@@ -454,6 +462,16 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
454
462
  const [cacheActiveIndex, setCacheActiveIndex] = React.useState(0);
455
463
  const [isFromHashtag, setIsFromHashtag] = React.useState(false);
456
464
  const [videoRef, setVideoRef] = React.useState(null);
465
+ const themeTag = React.useRef();
466
+ React.useEffect(() => {
467
+ const handleChangeThemeTag = (tag) => {
468
+ themeTag.current = tag;
469
+ };
470
+ SXP_EVENT_BUS.on(SXP_EVENT_TYPE.CHANGE_THEME_TAG, handleChangeThemeTag);
471
+ return () => {
472
+ SXP_EVENT_BUS.off(SXP_EVENT_TYPE.CHANGE_THEME_TAG, handleChangeThemeTag);
473
+ };
474
+ }, []);
457
475
  React.useEffect(() => {
458
476
  setOpenHashtag(isOpenHashTag);
459
477
  }, [isOpenHashTag]);
@@ -496,7 +514,8 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
496
514
  'itemFilter.itemId': query === null || query === void 0 ? void 0 : query['itemFilter.itemId'],
497
515
  'itemFilter.itemType': query === null || query === void 0 ? void 0 : query['itemFilter.itemType'],
498
516
  hashTag: query === null || query === void 0 ? void 0 : query.hashTag,
499
- traceInfo: query === null || query === void 0 ? void 0 : query.traceInfo
517
+ traceInfo: query === null || query === void 0 ? void 0 : query.traceInfo,
518
+ themeTag: query === null || query === void 0 ? void 0 : query.themeTag
500
519
  };
501
520
  if (utmVal) {
502
521
  const val = (_e = (_d = (_c = utmVal === null || utmVal === void 0 ? void 0 : utmVal.split('&')) === null || _c === void 0 ? void 0 : _c.filter((val) => {
@@ -521,7 +540,8 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
521
540
  const data = yield getRecommendVideos({
522
541
  hashTag: waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.hashTag,
523
542
  'itemFilter.itemId': waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.itemId,
524
- 'itemFilter.itemType': waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.itemType
543
+ 'itemFilter.itemType': waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.itemType,
544
+ themeTag: themeTag.current
525
545
  });
526
546
  setRtcList(rtcList.concat((_f = data === null || data === void 0 ? void 0 : data.recList) !== null && _f !== void 0 ? _f : []));
527
547
  setCacheRtcList(cacheRtcList.concat((_g = data === null || data === void 0 ? void 0 : data.recList) !== null && _g !== void 0 ? _g : []));
@@ -9325,7 +9345,7 @@ const EventProvider = (_a) => {
9325
9345
  }
9326
9346
  }, [isOnScreen, ref, rec, ctaEvent, index]);
9327
9347
  const handleClick = lodash.throttle(() => {
9328
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
9348
+ var _a, _b, _c, _d, _e, _f, _g, _h;
9329
9349
  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;
9330
9350
  ctaEvent === null || ctaEvent === void 0 ? void 0 : ctaEvent({
9331
9351
  eventSubject: 'clickCta',
@@ -9337,8 +9357,7 @@ const EventProvider = (_a) => {
9337
9357
  const cta = (_e = rec === null || rec === void 0 ? void 0 : rec.video) === null || _e === void 0 ? void 0 : _e.bindCta;
9338
9358
  const product = (_f = rec === null || rec === void 0 ? void 0 : rec.video) === null || _f === void 0 ? void 0 : _f.bindProduct;
9339
9359
  jumpToWeb(rec, product, cta, index);
9340
- 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;
9341
- 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);
9360
+ 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);
9342
9361
  }
9343
9362
  }
9344
9363
  else {
@@ -12109,13 +12128,6 @@ const LikeButton = (_a) => {
12109
12128
  };
12110
12129
  var LikeButton$1 = React.memo(LikeButton);
12111
12130
 
12112
- const SXP_EVENT_BUS = new EventEmitter();
12113
- var SXP_EVENT_TYPE;
12114
- (function (SXP_EVENT_TYPE) {
12115
- SXP_EVENT_TYPE["PAGE_DID_SHOW"] = "pageDidShow";
12116
- SXP_EVENT_TYPE["PAGE_DID_HIDE"] = "pageDidHide";
12117
- })(SXP_EVENT_TYPE || (SXP_EVENT_TYPE = {}));
12118
-
12119
12131
  const VideoWidget$2 = ({ rec, index, height, data, muted, activeIndex, videoPostConfig, videoRef }) => {
12120
12132
  const [isPauseVideo, setIsPauseVideo] = React.useState(false);
12121
12133
  const { bffEventReport, sxpParameter, waterFallData, openHashtag, bffFbReport } = useSxpDataSource();
@@ -12723,7 +12735,7 @@ const Nudge = ({ nudge }) => {
12723
12735
  const DEFAULT_TAG = 'FOR U';
12724
12736
  const Tagbar = ({ tagList = [], setActiveIndex }) => {
12725
12737
  const [selectTag, setSelectTag] = React.useState(DEFAULT_TAG);
12726
- const { getRecommendVideos, setRtcList, setCacheRtcList, setCacheActiveIndex, setLoading, swiperRef } = useSxpDataSource();
12738
+ const { getRecommendVideos, setRtcList, setCacheRtcList, setCacheActiveIndex, setLoading, swiperRef, waterFallData } = useSxpDataSource();
12727
12739
  const realTagList = React.useMemo(() => {
12728
12740
  return [DEFAULT_TAG, ...tagList];
12729
12741
  }, [tagList]);
@@ -12737,6 +12749,7 @@ const Tagbar = ({ tagList = [], setActiveIndex }) => {
12737
12749
  setLoading === null || setLoading === void 0 ? void 0 : setLoading(true);
12738
12750
  getRecommendVideos === null || getRecommendVideos === void 0 ? void 0 : getRecommendVideos({ themeTag }).then((res) => {
12739
12751
  var _a, _b, _c, _d;
12752
+ SXP_EVENT_BUS.emit(SXP_EVENT_TYPE.CHANGE_THEME_TAG, themeTag);
12740
12753
  setRtcList === null || setRtcList === void 0 ? void 0 : setRtcList((_a = res === null || res === void 0 ? void 0 : res.recList) !== null && _a !== void 0 ? _a : []);
12741
12754
  setCacheRtcList === null || setCacheRtcList === void 0 ? void 0 : setCacheRtcList((_b = res === null || res === void 0 ? void 0 : res.recList) !== null && _b !== void 0 ? _b : []);
12742
12755
  setActiveIndex === null || setActiveIndex === void 0 ? void 0 : setActiveIndex(0);
@@ -12747,7 +12760,7 @@ const Tagbar = ({ tagList = [], setActiveIndex }) => {
12747
12760
  });
12748
12761
  setSelectTag(tag);
12749
12762
  };
12750
- if (tagList.length <= 0)
12763
+ if (waterFallData || tagList.length <= 0)
12751
12764
  return null;
12752
12765
  return (React.createElement("div", { className: 'clc-sxp-tagbar' },
12753
12766
  React.createElement("ul", { className: 'clc-sxp-tagbar-list', style: { margin: 'auto', gap: 24 } }, realTagList.map((tag) => {
@@ -12939,9 +12952,12 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
12939
12952
  }
12940
12953
  if (tagList.length > 0) {
12941
12954
  minusHeight += 45;
12955
+ if (waterFallData) {
12956
+ minusHeight -= 45;
12957
+ }
12942
12958
  }
12943
12959
  return containerHeight - minusHeight;
12944
- }, [globalConfig, containerHeight, tagList]);
12960
+ }, [globalConfig, containerHeight, tagList, waterFallData]);
12945
12961
  const renderLogo = React.useMemo(() => {
12946
12962
  if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.logoUrl) && (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowLogo)) {
12947
12963
  return (React.createElement("div", { className: 'clc-sxp-logo-banner', style: { backgroundColor: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.color } },