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/pb-ui.js CHANGED
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('lodash'), require('uuid'), require('pako'), require('react'), require('qs'), require('eventemitter3'), require('@emotion/css'), require('@ant-design/pro-components'), require('react-dom'), require('hls.js')) :
3
- typeof define === 'function' && define.amd ? define(['exports', 'lodash', 'uuid', 'pako', 'react', 'qs', 'eventemitter3', '@emotion/css', '@ant-design/pro-components', 'react-dom', 'hls.js'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.PUI = {}, global.lodash, global.uuid$1, global.pako, global.React, global.qs, global.EventEmitter, global.css, global.proComponents, global.ReactDOM, global.Hls));
5
- })(this, (function (exports, lodash, uuid$1, pako, React, qs, EventEmitter, css, proComponents, ReactDOM, Hls) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('lodash'), require('uuid'), require('pako'), require('react'), require('qs'), require('eventemitter3'), require('@emotion/css'), require('@ant-design/pro-components'), require('react-dom')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', 'lodash', 'uuid', 'pako', 'react', 'qs', 'eventemitter3', '@emotion/css', '@ant-design/pro-components', 'react-dom'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.PUI = {}, global.lodash, global.uuid$1, global.pako, global.React, global.qs, global.EventEmitter, global.css, global.proComponents, global.ReactDOM));
5
+ })(this, (function (exports, lodash, uuid$1, pako, React, qs, EventEmitter, css, proComponents, ReactDOM) { 'use strict';
6
6
 
7
7
  function _interopNamespaceDefault(e) {
8
8
  var n = Object.create(null);
@@ -591,12 +591,16 @@
591
591
  }), [bffFetch]);
592
592
  // 获取 Tag
593
593
  const bffGetTagList = React.useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
594
- var _h, _j;
594
+ var _h, _j, _k, _l, _m;
595
595
  if (!utmVal)
596
596
  return;
597
597
  try {
598
- const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/tag/list', { method: 'GET', query: { channel: utmVal } }));
599
- 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 : []);
598
+ const val = (_k = (_j = (_h = utmVal === null || utmVal === void 0 ? void 0 : utmVal.split('&')) === null || _h === void 0 ? void 0 : _h.filter((val) => {
599
+ const key = val.split('=')[0];
600
+ return UTM_KEYS.includes(key);
601
+ })) === null || _j === void 0 ? void 0 : _j.join('&')) !== null && _k !== void 0 ? _k : '';
602
+ const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/tag/list', { method: 'GET', query: { channel: decodeURIComponent(val) } }));
603
+ 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 : []);
600
604
  }
601
605
  catch (e) {
602
606
  console.log('e', e);
@@ -8379,7 +8383,7 @@
8379
8383
  * @Author: binruan@chatlabs.com
8380
8384
  * @Date: 2024-03-20 10:27:31
8381
8385
  * @LastEditors: binruan@chatlabs.com
8382
- * @LastEditTime: 2024-04-19 14:12:55
8386
+ * @LastEditTime: 2024-05-17 16:53:11
8383
8387
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\FormatImage.tsx
8384
8388
  *
8385
8389
  */
@@ -8391,10 +8395,32 @@
8391
8395
  setImgSrc(v);
8392
8396
  }
8393
8397
  }));
8398
+ // useEffect(() => {
8399
+ // setImgSrc(src);
8400
+ // }, [src]);
8401
+ const imgRef = React.useRef(null);
8394
8402
  React.useEffect(() => {
8395
- setImgSrc(src);
8403
+ let observer = null;
8404
+ const { current } = imgRef;
8405
+ if (current) {
8406
+ observer = new IntersectionObserver((entries) => {
8407
+ entries.forEach((entry) => {
8408
+ if (entry.isIntersecting) {
8409
+ setImgSrc(src);
8410
+ observer.unobserve(current);
8411
+ }
8412
+ });
8413
+ }, { threshold: 0.1 } // 触发阈值,可根据需要调整
8414
+ );
8415
+ observer.observe(current);
8416
+ }
8417
+ return () => {
8418
+ if (observer && current) {
8419
+ observer.unobserve(current);
8420
+ }
8421
+ };
8396
8422
  }, [src]);
8397
- return (React.createElement(React.Fragment, null, (imgSrc === null || imgSrc === void 0 ? void 0 : imgSrc.includes('.avif')) ? (React.createElement("picture", null,
8423
+ return (React.createElement("div", { ref: imgRef }, (imgSrc === null || imgSrc === void 0 ? void 0 : imgSrc.includes('.avif')) ? (React.createElement("picture", null,
8398
8424
  React.createElement("source", { type: 'image/avif', srcSet: imgSrc }),
8399
8425
  React.createElement("source", { type: 'image/webp', srcSet: `${imgSrc}?imageMogr2/format/webp` }),
8400
8426
  React.createElement("source", { type: 'image/jpeg', srcSet: `${imgSrc}?imageMogr2/format/jpg` }),
@@ -8463,10 +8489,10 @@
8463
8489
  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'),
8464
8490
  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),
8465
8491
  React.createElement("div", { hidden: !!product && (!(product === null || product === void 0 ? void 0 : product.info) || (product === null || product === void 0 ? void 0 : product.info) === '') },
8466
- 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
8467
- bold and avant-garde visual design interprets the emotional bond connecting my heart. The Tiffany Lock
8468
- collection is unisex and is inspired by the padlock pattern found in the Tiffany Antique Collection. This
8469
- necklace features a stylish and eye-catching oval clasp chain decorated with a lock pattern. Crafted from
8492
+ 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
8493
+ bold and avant-garde visual design interprets the emotional bond connecting my heart. The Tiffany Lock
8494
+ collection is unisex and is inspired by the padlock pattern found in the Tiffany Antique Collection. This
8495
+ necklace features a stylish and eye-catching oval clasp chain decorated with a lock pattern. Crafted from
8470
8496
  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 }))));
8471
8497
  };
8472
8498
  const renderBtn = () => {
@@ -8936,7 +8962,7 @@
8936
8962
  const productInfoText = ({ isPost }) => {
8937
8963
  return (React.createElement("div", { hidden: !!product && (!(product === null || product === void 0 ? void 0 : product.info) || (product === null || product === void 0 ? void 0 : product.info) === '') },
8938
8964
  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) ||
8939
- `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
8965
+ `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
8940
8966
  Made in Italy` })));
8941
8967
  };
8942
8968
  return (React.createElement("div", { className: 'pb-commondityDiroNew' },
@@ -12301,6 +12327,7 @@ Made in Italy` })));
12301
12327
  const videoSrc = rec.video.url;
12302
12328
  if (!videoSrc)
12303
12329
  return;
12330
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.src(videoSrc);
12304
12331
  setIsPauseVideo(false);
12305
12332
  const videoPlayerWrapperNode = document.querySelector(`#${videoId}`);
12306
12333
  const dom = document.querySelector('#player-container-id');
@@ -12308,7 +12335,6 @@ Made in Italy` })));
12308
12335
  if (!dom && !dom2)
12309
12336
  return;
12310
12337
  videoPlayerWrapperNode === null || videoPlayerWrapperNode === void 0 ? void 0 : videoPlayerWrapperNode.appendChild(dom || dom2);
12311
- videoRef === null || videoRef === void 0 ? void 0 : videoRef.src(videoSrc);
12312
12338
  videoRef === null || videoRef === void 0 ? void 0 : videoRef.on('loadedmetadata', handleLoadedmetadata);
12313
12339
  videoRef === null || videoRef === void 0 ? void 0 : videoRef.on('loadeddata', handLoadeddata);
12314
12340
  // videoRef?.on('canplay', handleCanplay);
@@ -13381,8 +13407,8 @@ Made in Italy` })));
13381
13407
  if (!videoRef.current.src) {
13382
13408
  const videoSrc = rec.video.url;
13383
13409
  if (videoSrc.includes('.m3u8')) {
13384
- if (Hls.isSupported()) {
13385
- const hls = new Hls();
13410
+ if (typeof window !== 'undefined' && (window === null || window === void 0 ? void 0 : window.Hls.isSupported())) {
13411
+ const hls = new window.Hls();
13386
13412
  hls.loadSource(videoSrc);
13387
13413
  hls.attachMedia(videoRef.current);
13388
13414
  }