pb-sxp-ui 1.0.62 → 1.0.64

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
@@ -7,7 +7,6 @@ import EventEmitter from 'eventemitter3';
7
7
  import { css } from '@emotion/css';
8
8
  import { BetaSchemaForm } from '@ant-design/pro-components';
9
9
  import * as ReactDOM from 'react-dom';
10
- import Hls from 'hls.js';
11
10
 
12
11
  /******************************************************************************
13
12
  Copyright (c) Microsoft Corporation.
@@ -577,12 +576,16 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
577
576
  }), [bffFetch]);
578
577
  // 获取 Tag
579
578
  const bffGetTagList = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
580
- var _h, _j;
579
+ var _h, _j, _k, _l, _m;
581
580
  if (!utmVal)
582
581
  return;
583
582
  try {
584
- const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/tag/list', { method: 'GET', query: { channel: utmVal } }));
585
- 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 : []);
583
+ const val = (_k = (_j = (_h = utmVal === null || utmVal === void 0 ? void 0 : utmVal.split('&')) === null || _h === void 0 ? void 0 : _h.filter((val) => {
584
+ const key = val.split('=')[0];
585
+ return UTM_KEYS.includes(key);
586
+ })) === null || _j === void 0 ? void 0 : _j.join('&')) !== null && _k !== void 0 ? _k : '';
587
+ const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/tag/list', { method: 'GET', query: { channel: decodeURIComponent(val) } }));
588
+ 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 : []);
586
589
  }
587
590
  catch (e) {
588
591
  console.log('e', e);
@@ -8365,7 +8368,7 @@ var ExpandableText$1 = memo(ExpandableText);
8365
8368
  * @Author: binruan@chatlabs.com
8366
8369
  * @Date: 2024-03-20 10:27:31
8367
8370
  * @LastEditors: binruan@chatlabs.com
8368
- * @LastEditTime: 2024-04-19 14:12:55
8371
+ * @LastEditTime: 2024-05-17 16:53:11
8369
8372
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\FormatImage.tsx
8370
8373
  *
8371
8374
  */
@@ -8377,10 +8380,32 @@ const FormatImage = forwardRef((props, ref) => {
8377
8380
  setImgSrc(v);
8378
8381
  }
8379
8382
  }));
8383
+ // useEffect(() => {
8384
+ // setImgSrc(src);
8385
+ // }, [src]);
8386
+ const imgRef = useRef(null);
8380
8387
  useEffect(() => {
8381
- setImgSrc(src);
8388
+ let observer = null;
8389
+ const { current } = imgRef;
8390
+ if (current) {
8391
+ observer = new IntersectionObserver((entries) => {
8392
+ entries.forEach((entry) => {
8393
+ if (entry.isIntersecting) {
8394
+ setImgSrc(src);
8395
+ observer.unobserve(current);
8396
+ }
8397
+ });
8398
+ }, { threshold: 0.1 } // 触发阈值,可根据需要调整
8399
+ );
8400
+ observer.observe(current);
8401
+ }
8402
+ return () => {
8403
+ if (observer && current) {
8404
+ observer.unobserve(current);
8405
+ }
8406
+ };
8382
8407
  }, [src]);
8383
- return (React.createElement(React.Fragment, null, (imgSrc === null || imgSrc === void 0 ? void 0 : imgSrc.includes('.avif')) ? (React.createElement("picture", null,
8408
+ return (React.createElement("div", { ref: imgRef }, (imgSrc === null || imgSrc === void 0 ? void 0 : imgSrc.includes('.avif')) ? (React.createElement("picture", null,
8384
8409
  React.createElement("source", { type: 'image/avif', srcSet: imgSrc }),
8385
8410
  React.createElement("source", { type: 'image/webp', srcSet: `${imgSrc}?imageMogr2/format/webp` }),
8386
8411
  React.createElement("source", { type: 'image/jpeg', srcSet: `${imgSrc}?imageMogr2/format/jpg` }),
@@ -8449,10 +8474,10 @@ const CommodityDetail$1 = (_a) => {
8449
8474
  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'),
8450
8475
  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),
8451
8476
  React.createElement("div", { hidden: !!product && (!(product === null || product === void 0 ? void 0 : product.info) || (product === null || product === void 0 ? void 0 : product.info) === '') },
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
8477
+ 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
8478
+ bold and avant-garde visual design interprets the emotional bond connecting my heart. The Tiffany Lock
8479
+ collection is unisex and is inspired by the padlock pattern found in the Tiffany Antique Collection. This
8480
+ necklace features a stylish and eye-catching oval clasp chain decorated with a lock pattern. Crafted from
8456
8481
  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 }))));
8457
8482
  };
8458
8483
  const renderBtn = () => {
@@ -8922,7 +8947,7 @@ const CommodityDetailDiroNew$1 = (_a) => {
8922
8947
  const productInfoText = ({ isPost }) => {
8923
8948
  return (React.createElement("div", { hidden: !!product && (!(product === null || product === void 0 ? void 0 : product.info) || (product === null || product === void 0 ? void 0 : product.info) === '') },
8924
8949
  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) ||
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
8950
+ `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
8926
8951
  Made in Italy` })));
8927
8952
  };
8928
8953
  return (React.createElement("div", { className: 'pb-commondityDiroNew' },
@@ -12287,6 +12312,7 @@ const VideoWidget$2 = ({ rec, index, height, data, muted, activeIndex, videoPost
12287
12312
  const videoSrc = rec.video.url;
12288
12313
  if (!videoSrc)
12289
12314
  return;
12315
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.src(videoSrc);
12290
12316
  setIsPauseVideo(false);
12291
12317
  const videoPlayerWrapperNode = document.querySelector(`#${videoId}`);
12292
12318
  const dom = document.querySelector('#player-container-id');
@@ -12294,7 +12320,6 @@ const VideoWidget$2 = ({ rec, index, height, data, muted, activeIndex, videoPost
12294
12320
  if (!dom && !dom2)
12295
12321
  return;
12296
12322
  videoPlayerWrapperNode === null || videoPlayerWrapperNode === void 0 ? void 0 : videoPlayerWrapperNode.appendChild(dom || dom2);
12297
- videoRef === null || videoRef === void 0 ? void 0 : videoRef.src(videoSrc);
12298
12323
  videoRef === null || videoRef === void 0 ? void 0 : videoRef.on('loadedmetadata', handleLoadedmetadata);
12299
12324
  videoRef === null || videoRef === void 0 ? void 0 : videoRef.on('loadeddata', handLoadeddata);
12300
12325
  // videoRef?.on('canplay', handleCanplay);
@@ -13367,8 +13392,8 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
13367
13392
  if (!videoRef.current.src) {
13368
13393
  const videoSrc = rec.video.url;
13369
13394
  if (videoSrc.includes('.m3u8')) {
13370
- if (Hls.isSupported()) {
13371
- const hls = new Hls();
13395
+ if (typeof window !== 'undefined' && (window === null || window === void 0 ? void 0 : window.Hls.isSupported())) {
13396
+ const hls = new window.Hls();
13372
13397
  hls.loadSource(videoSrc);
13373
13398
  hls.attachMedia(videoRef.current);
13374
13399
  }