pb-sxp-ui 1.0.61 → 1.0.63

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 : []));
@@ -557,12 +577,16 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
557
577
  }), [bffFetch]);
558
578
  // 获取 Tag
559
579
  const bffGetTagList = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
560
- var _h, _j;
580
+ var _h, _j, _k, _l, _m;
561
581
  if (!utmVal)
562
582
  return;
563
583
  try {
564
- const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/tag/list', { method: 'GET', query: { channel: utmVal } }));
565
- setTagList((_j = (_h = result === null || result === void 0 ? void 0 : result.data) === null || _h === void 0 ? void 0 : _h.tags) !== null && _j !== void 0 ? _j : []);
584
+ const val = (_k = (_j = (_h = utmVal === null || utmVal === void 0 ? void 0 : utmVal.split('&')) === null || _h === void 0 ? void 0 : _h.filter((val) => {
585
+ const key = val.split('=')[0];
586
+ return UTM_KEYS.includes(key);
587
+ })) === null || _j === void 0 ? void 0 : _j.join('&')) !== null && _k !== void 0 ? _k : '';
588
+ const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/tag/list', { method: 'GET', query: { channel: decodeURIComponent(val) } }));
589
+ setTagList((_m = (_l = result === null || result === void 0 ? void 0 : result.data) === null || _l === void 0 ? void 0 : _l.tags) !== null && _m !== void 0 ? _m : []);
566
590
  }
567
591
  catch (e) {
568
592
  console.log('e', e);
@@ -8429,10 +8453,10 @@ const CommodityDetail$1 = (_a) => {
8429
8453
  React.createElement("div", { className: 'pb-commondity-content-title', style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.title, hidden: !!product && !(product === null || product === void 0 ? void 0 : product.title) }, (_b = product === null || product === void 0 ? void 0 : product.title) !== null && _b !== void 0 ? _b : 'Pendant in Yellow Gold with Diamonds, Medium'),
8430
8454
  React.createElement("div", { className: 'pb-commondity-content-price', style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price, hidden: !!product && !(product === null || product === void 0 ? void 0 : product.price) }, priceText),
8431
8455
  React.createElement("div", { hidden: !!product && (!(product === null || product === void 0 ? void 0 : product.info) || (product === null || product === void 0 ? void 0 : product.info) === '') },
8432
- React.createElement(ExpandableText$1, { foldText: tipText === null || tipText === void 0 ? void 0 : tipText.foldText, unfoldText: tipText === null || tipText === void 0 ? void 0 : tipText.unfoldText, onClick: () => setShowModal(true), isPost: isPost, text: (_c = product === null || product === void 0 ? void 0 : product.info) !== null && _c !== void 0 ? _c : `The design inspiration of Tiffany Lock series comes from the power of connection and inclusiveness, and the
8433
- bold and avant-garde visual design interprets the emotional bond connecting my heart. The Tiffany Lock
8434
- collection is unisex and is inspired by the padlock pattern found in the Tiffany Antique Collection. This
8435
- necklace features a stylish and eye-catching oval clasp chain decorated with a lock pattern. Crafted from
8456
+ React.createElement(ExpandableText$1, { foldText: tipText === null || tipText === void 0 ? void 0 : tipText.foldText, unfoldText: tipText === null || tipText === void 0 ? void 0 : tipText.unfoldText, onClick: () => setShowModal(true), isPost: isPost, text: (_c = product === null || product === void 0 ? void 0 : product.info) !== null && _c !== void 0 ? _c : `The design inspiration of Tiffany Lock series comes from the power of connection and inclusiveness, and the
8457
+ bold and avant-garde visual design interprets the emotional bond connecting my heart. The Tiffany Lock
8458
+ collection is unisex and is inspired by the padlock pattern found in the Tiffany Antique Collection. This
8459
+ necklace features a stylish and eye-catching oval clasp chain decorated with a lock pattern. Crafted from
8436
8460
  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 }))));
8437
8461
  };
8438
8462
  const renderBtn = () => {
@@ -8902,7 +8926,7 @@ const CommodityDetailDiroNew$1 = (_a) => {
8902
8926
  const productInfoText = ({ isPost }) => {
8903
8927
  return (React.createElement("div", { hidden: !!product && (!(product === null || product === void 0 ? void 0 : product.info) || (product === null || product === void 0 ? void 0 : product.info) === '') },
8904
8928
  React.createElement(ExpandableText$1, { isPost: isPost, onClick: () => setShowModal(true), className: 'pb-commondityDiroNew-info', style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.info, foldText: tipText === null || tipText === void 0 ? void 0 : tipText.foldText, unfoldText: tipText === null || tipText === void 0 ? void 0 : tipText.unfoldText, text: (product === null || product === void 0 ? void 0 : product.info) ||
8905
- `Unveiled at the Spring-Summer 2023 fashion show, the Dior Toujours bag is distinguished by a casual and practical design. Crafted in black calfskin with Macrocannage topstitching, it showcases a spacious interior compartment with a matching pouch to organize essentials. Its leather strap closure keeps items secure while the D of the CD Lock closure twists to adjust the sides and enhance the bag's silhouette. The leather handles can be adjusted using the small notches in order to be able to carry the large bag by hand or wear it over the shoulder. CD Lock and strap closures D.I.O.R. charms Removable interior pouch Adjustable leather handles Dust bag included
8929
+ `Unveiled at the Spring-Summer 2023 fashion show, the Dior Toujours bag is distinguished by a casual and practical design. Crafted in black calfskin with Macrocannage topstitching, it showcases a spacious interior compartment with a matching pouch to organize essentials. Its leather strap closure keeps items secure while the D of the CD Lock closure twists to adjust the sides and enhance the bag's silhouette. The leather handles can be adjusted using the small notches in order to be able to carry the large bag by hand or wear it over the shoulder. CD Lock and strap closures D.I.O.R. charms Removable interior pouch Adjustable leather handles Dust bag included
8906
8930
  Made in Italy` })));
8907
8931
  };
8908
8932
  return (React.createElement("div", { className: 'pb-commondityDiroNew' },
@@ -9302,7 +9326,7 @@ const EventProvider = (_a) => {
9302
9326
  }
9303
9327
  }, [isOnScreen, ref, rec, ctaEvent, index]);
9304
9328
  const handleClick = throttle(() => {
9305
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
9329
+ var _a, _b, _c, _d, _e, _f, _g, _h;
9306
9330
  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
9331
  ctaEvent === null || ctaEvent === void 0 ? void 0 : ctaEvent({
9308
9332
  eventSubject: 'clickCta',
@@ -9314,8 +9338,7 @@ const EventProvider = (_a) => {
9314
9338
  const cta = (_e = rec === null || rec === void 0 ? void 0 : rec.video) === null || _e === void 0 ? void 0 : _e.bindCta;
9315
9339
  const product = (_f = rec === null || rec === void 0 ? void 0 : rec.video) === null || _f === void 0 ? void 0 : _f.bindProduct;
9316
9340
  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);
9341
+ 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
9342
  }
9320
9343
  }
9321
9344
  else {
@@ -12086,13 +12109,6 @@ const LikeButton = (_a) => {
12086
12109
  };
12087
12110
  var LikeButton$1 = memo(LikeButton);
12088
12111
 
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
12112
  const VideoWidget$2 = ({ rec, index, height, data, muted, activeIndex, videoPostConfig, videoRef }) => {
12097
12113
  const [isPauseVideo, setIsPauseVideo] = useState(false);
12098
12114
  const { bffEventReport, sxpParameter, waterFallData, openHashtag, bffFbReport } = useSxpDataSource();
@@ -12700,7 +12716,7 @@ const Nudge = ({ nudge }) => {
12700
12716
  const DEFAULT_TAG = 'FOR U';
12701
12717
  const Tagbar = ({ tagList = [], setActiveIndex }) => {
12702
12718
  const [selectTag, setSelectTag] = useState(DEFAULT_TAG);
12703
- const { getRecommendVideos, setRtcList, setCacheRtcList, setCacheActiveIndex, setLoading, swiperRef } = useSxpDataSource();
12719
+ const { getRecommendVideos, setRtcList, setCacheRtcList, setCacheActiveIndex, setLoading, swiperRef, waterFallData } = useSxpDataSource();
12704
12720
  const realTagList = useMemo(() => {
12705
12721
  return [DEFAULT_TAG, ...tagList];
12706
12722
  }, [tagList]);
@@ -12714,6 +12730,7 @@ const Tagbar = ({ tagList = [], setActiveIndex }) => {
12714
12730
  setLoading === null || setLoading === void 0 ? void 0 : setLoading(true);
12715
12731
  getRecommendVideos === null || getRecommendVideos === void 0 ? void 0 : getRecommendVideos({ themeTag }).then((res) => {
12716
12732
  var _a, _b, _c, _d;
12733
+ SXP_EVENT_BUS.emit(SXP_EVENT_TYPE.CHANGE_THEME_TAG, themeTag);
12717
12734
  setRtcList === null || setRtcList === void 0 ? void 0 : setRtcList((_a = res === null || res === void 0 ? void 0 : res.recList) !== null && _a !== void 0 ? _a : []);
12718
12735
  setCacheRtcList === null || setCacheRtcList === void 0 ? void 0 : setCacheRtcList((_b = res === null || res === void 0 ? void 0 : res.recList) !== null && _b !== void 0 ? _b : []);
12719
12736
  setActiveIndex === null || setActiveIndex === void 0 ? void 0 : setActiveIndex(0);
@@ -12724,7 +12741,7 @@ const Tagbar = ({ tagList = [], setActiveIndex }) => {
12724
12741
  });
12725
12742
  setSelectTag(tag);
12726
12743
  };
12727
- if (tagList.length <= 0)
12744
+ if (waterFallData || tagList.length <= 0)
12728
12745
  return null;
12729
12746
  return (React.createElement("div", { className: 'clc-sxp-tagbar' },
12730
12747
  React.createElement("ul", { className: 'clc-sxp-tagbar-list', style: { margin: 'auto', gap: 24 } }, realTagList.map((tag) => {
@@ -12916,9 +12933,12 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
12916
12933
  }
12917
12934
  if (tagList.length > 0) {
12918
12935
  minusHeight += 45;
12936
+ if (waterFallData) {
12937
+ minusHeight -= 45;
12938
+ }
12919
12939
  }
12920
12940
  return containerHeight - minusHeight;
12921
- }, [globalConfig, containerHeight, tagList]);
12941
+ }, [globalConfig, containerHeight, tagList, waterFallData]);
12922
12942
  const renderLogo = useMemo(() => {
12923
12943
  if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.logoUrl) && (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowLogo)) {
12924
12944
  return (React.createElement("div", { className: 'clc-sxp-logo-banner', style: { backgroundColor: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.color } },