pb-sxp-ui 1.0.60 → 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.
Files changed (33) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +111 -111
  3. package/dist/index.cjs +40 -24
  4. package/dist/index.cjs.map +1 -1
  5. package/dist/index.js +40 -24
  6. package/dist/index.js.map +1 -1
  7. package/dist/index.min.cjs +3 -3
  8. package/dist/index.min.cjs.map +1 -1
  9. package/dist/index.min.js +3 -3
  10. package/dist/index.min.js.map +1 -1
  11. package/dist/pb-ui.js +43 -27
  12. package/dist/pb-ui.js.map +1 -1
  13. package/dist/pb-ui.min.js +3 -3
  14. package/dist/pb-ui.min.js.map +1 -1
  15. package/es/core/components/SxpPageRender/Tagbar.js +7 -5
  16. package/es/core/components/SxpPageRender/index.js +4 -1
  17. package/es/core/context/SxpDataSourceProvider.d.ts +1 -0
  18. package/es/core/context/SxpDataSourceProvider.js +15 -2
  19. package/es/core/utils/event.d.ts +2 -1
  20. package/es/core/utils/event.js +1 -0
  21. package/es/materials/sxp/popup/CommodityDetail/index.js +4 -4
  22. package/es/materials/sxp/popup/CommodityDetailDiroNew/index.js +1 -1
  23. package/es/materials/sxp/template/components/EventProvider.js +2 -3
  24. package/lib/core/components/SxpPageRender/Tagbar.js +7 -5
  25. package/lib/core/components/SxpPageRender/index.js +4 -1
  26. package/lib/core/context/SxpDataSourceProvider.d.ts +1 -0
  27. package/lib/core/context/SxpDataSourceProvider.js +15 -2
  28. package/lib/core/utils/event.d.ts +2 -1
  29. package/lib/core/utils/event.js +1 -0
  30. package/lib/materials/sxp/popup/CommodityDetail/index.js +4 -4
  31. package/lib/materials/sxp/popup/CommodityDetailDiroNew/index.js +1 -1
  32. package/lib/materials/sxp/template/components/EventProvider.js +2 -3
  33. package/package.json +115 -115
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 : []));
@@ -8429,10 +8449,10 @@ const CommodityDetail$1 = (_a) => {
8429
8449
  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
8450
  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
8451
  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
8452
+ 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
8453
+ bold and avant-garde visual design interprets the emotional bond connecting my heart. The Tiffany Lock
8454
+ collection is unisex and is inspired by the padlock pattern found in the Tiffany Antique Collection. This
8455
+ necklace features a stylish and eye-catching oval clasp chain decorated with a lock pattern. Crafted from
8436
8456
  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
8457
  };
8438
8458
  const renderBtn = () => {
@@ -8902,7 +8922,7 @@ const CommodityDetailDiroNew$1 = (_a) => {
8902
8922
  const productInfoText = ({ isPost }) => {
8903
8923
  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
8924
  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
8925
+ `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
8926
  Made in Italy` })));
8907
8927
  };
8908
8928
  return (React.createElement("div", { className: 'pb-commondityDiroNew' },
@@ -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,20 +12712,21 @@ 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]);
12707
12719
  const handleSelectTag = (tag) => () => {
12708
12720
  if (tag === selectTag)
12709
12721
  return;
12710
- let hashTag;
12722
+ let themeTag;
12711
12723
  if (tag !== DEFAULT_TAG) {
12712
- hashTag = tag;
12724
+ themeTag = tag;
12713
12725
  }
12714
12726
  setLoading === null || setLoading === void 0 ? void 0 : setLoading(true);
12715
- getRecommendVideos === null || getRecommendVideos === void 0 ? void 0 : getRecommendVideos({ hashTag }).then((res) => {
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 } },