pb-sxp-ui 1.0.63 → 1.0.65
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 +36 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +36 -15
- package/dist/index.js.map +1 -1
- package/dist/index.min.cjs +3 -3
- package/dist/index.min.cjs.map +1 -1
- package/dist/index.min.js +3 -3
- package/dist/index.min.js.map +1 -1
- package/dist/pb-ui.js +40 -18
- package/dist/pb-ui.js.map +1 -1
- package/dist/pb-ui.min.js +3 -3
- package/dist/pb-ui.min.js.map +1 -1
- package/es/core/components/DiyPortalPreview/VideoWidget.js +2 -3
- package/es/core/components/SxpPageCore/index.js +2 -2
- package/es/core/components/SxpPageRender/FormatImage.js +21 -3
- package/es/core/components/SxpPageRender/VideoWidget/index.js +1 -1
- package/es/core/components/SxpPageRender/index.js +1 -1
- package/es/core/context/SxpDataSourceProvider.d.ts +1 -0
- package/es/core/context/SxpDataSourceProvider.js +3 -3
- package/lib/core/components/DiyPortalPreview/VideoWidget.js +2 -3
- package/lib/core/components/SxpPageCore/index.js +2 -2
- package/lib/core/components/SxpPageRender/FormatImage.js +20 -2
- package/lib/core/components/SxpPageRender/VideoWidget/index.js +1 -1
- package/lib/core/components/SxpPageRender/index.js +1 -1
- package/lib/core/context/SxpDataSourceProvider.d.ts +1 -0
- package/lib/core/context/SxpDataSourceProvider.js +3 -3
- package/package.json +1 -2
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.
|
@@ -424,7 +423,7 @@ var DataSourceType;
|
|
424
423
|
DataSourceType[DataSourceType["BFF"] = 5] = "BFF";
|
425
424
|
})(DataSourceType || (DataSourceType = {}));
|
426
425
|
const UTM_KEYS = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_id', 'utm_content', 'cl_source'];
|
427
|
-
const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent = true, maxSize, defaultSize, isPreview = false, sxpParameter, appDomain, hashTagSize, loadingImage, isOpenHashTag = false, enabledMetaConversionApi = false }) => {
|
426
|
+
const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent = true, maxSize, defaultSize, isPreview = false, sxpParameter, appDomain, hashTagSize, loadingImage, isOpenHashTag = false, enabledMetaConversionApi = false, isShowTag = true }) => {
|
428
427
|
const [rtcList, setRtcList] = useState([]);
|
429
428
|
const [tagList, setTagList] = useState([]);
|
430
429
|
const [loading, setLoading] = useState(false);
|
@@ -578,7 +577,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
578
577
|
// 获取 Tag
|
579
578
|
const bffGetTagList = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
580
579
|
var _h, _j, _k, _l, _m;
|
581
|
-
if (!utmVal)
|
580
|
+
if (!utmVal || !isShowTag)
|
582
581
|
return;
|
583
582
|
try {
|
584
583
|
const val = (_k = (_j = (_h = utmVal === null || utmVal === void 0 ? void 0 : utmVal.split('&')) === null || _h === void 0 ? void 0 : _h.filter((val) => {
|
@@ -591,7 +590,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
591
590
|
catch (e) {
|
592
591
|
console.log('e', e);
|
593
592
|
}
|
594
|
-
}), [bffFetch, utmVal]);
|
593
|
+
}), [bffFetch, utmVal, isShowTag]);
|
595
594
|
const ctaEvent = useCallback((eventInfo, rec, product, position) => {
|
596
595
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
597
596
|
const cta = product === null || product === void 0 ? void 0 : product.bindCta;
|
@@ -8369,7 +8368,7 @@ var ExpandableText$1 = memo(ExpandableText);
|
|
8369
8368
|
* @Author: binruan@chatlabs.com
|
8370
8369
|
* @Date: 2024-03-20 10:27:31
|
8371
8370
|
* @LastEditors: binruan@chatlabs.com
|
8372
|
-
* @LastEditTime: 2024-
|
8371
|
+
* @LastEditTime: 2024-05-17 16:53:11
|
8373
8372
|
* @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\FormatImage.tsx
|
8374
8373
|
*
|
8375
8374
|
*/
|
@@ -8381,10 +8380,32 @@ const FormatImage = forwardRef((props, ref) => {
|
|
8381
8380
|
setImgSrc(v);
|
8382
8381
|
}
|
8383
8382
|
}));
|
8383
|
+
// useEffect(() => {
|
8384
|
+
// setImgSrc(src);
|
8385
|
+
// }, [src]);
|
8386
|
+
const imgRef = useRef(null);
|
8384
8387
|
useEffect(() => {
|
8385
|
-
|
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
|
+
};
|
8386
8407
|
}, [src]);
|
8387
|
-
return (React.createElement(
|
8408
|
+
return (React.createElement("div", { ref: imgRef }, (imgSrc === null || imgSrc === void 0 ? void 0 : imgSrc.includes('.avif')) ? (React.createElement("picture", null,
|
8388
8409
|
React.createElement("source", { type: 'image/avif', srcSet: imgSrc }),
|
8389
8410
|
React.createElement("source", { type: 'image/webp', srcSet: `${imgSrc}?imageMogr2/format/webp` }),
|
8390
8411
|
React.createElement("source", { type: 'image/jpeg', srcSet: `${imgSrc}?imageMogr2/format/jpg` }),
|
@@ -12291,6 +12312,7 @@ const VideoWidget$2 = ({ rec, index, height, data, muted, activeIndex, videoPost
|
|
12291
12312
|
const videoSrc = rec.video.url;
|
12292
12313
|
if (!videoSrc)
|
12293
12314
|
return;
|
12315
|
+
videoRef === null || videoRef === void 0 ? void 0 : videoRef.src(videoSrc);
|
12294
12316
|
setIsPauseVideo(false);
|
12295
12317
|
const videoPlayerWrapperNode = document.querySelector(`#${videoId}`);
|
12296
12318
|
const dom = document.querySelector('#player-container-id');
|
@@ -12298,7 +12320,6 @@ const VideoWidget$2 = ({ rec, index, height, data, muted, activeIndex, videoPost
|
|
12298
12320
|
if (!dom && !dom2)
|
12299
12321
|
return;
|
12300
12322
|
videoPlayerWrapperNode === null || videoPlayerWrapperNode === void 0 ? void 0 : videoPlayerWrapperNode.appendChild(dom || dom2);
|
12301
|
-
videoRef === null || videoRef === void 0 ? void 0 : videoRef.src(videoSrc);
|
12302
12323
|
videoRef === null || videoRef === void 0 ? void 0 : videoRef.on('loadedmetadata', handleLoadedmetadata);
|
12303
12324
|
videoRef === null || videoRef === void 0 ? void 0 : videoRef.on('loadeddata', handLoadeddata);
|
12304
12325
|
// videoRef?.on('canplay', handleCanplay);
|
@@ -12754,7 +12775,7 @@ var Tagbar$1 = memo(Tagbar);
|
|
12754
12775
|
* @Author: binruan@chatlabs.com
|
12755
12776
|
* @Date: 2024-01-15 19:03:09
|
12756
12777
|
* @LastEditors: binruan@chatlabs.com
|
12757
|
-
* @LastEditTime: 2024-05-
|
12778
|
+
* @LastEditTime: 2024-05-20 10:04:39
|
12758
12779
|
* @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\index.tsx
|
12759
12780
|
*
|
12760
12781
|
*/
|
@@ -12814,7 +12835,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
12814
12835
|
};
|
12815
12836
|
const firstRef = useRef();
|
12816
12837
|
useEffect(() => {
|
12817
|
-
if (!firstRef.current && !videoRef) {
|
12838
|
+
if (!firstRef.current && !videoRef && (playerRef === null || playerRef === void 0 ? void 0 : playerRef.current)) {
|
12818
12839
|
firstRef.current = true;
|
12819
12840
|
const player = TCPlayer('player-container-id', {
|
12820
12841
|
licenseUrl, // license 地址,参考准备工作部分,在视立方控制台申请 license 后可获得 licenseUrl
|
@@ -13371,8 +13392,8 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
13371
13392
|
if (!videoRef.current.src) {
|
13372
13393
|
const videoSrc = rec.video.url;
|
13373
13394
|
if (videoSrc.includes('.m3u8')) {
|
13374
|
-
if (Hls.isSupported()) {
|
13375
|
-
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();
|
13376
13397
|
hls.loadSource(videoSrc);
|
13377
13398
|
hls.attachMedia(videoRef.current);
|
13378
13399
|
}
|
@@ -13658,7 +13679,7 @@ const Popup = () => {
|
|
13658
13679
|
* @Author: binruan@chatlabs.com
|
13659
13680
|
* @Date: 2024-01-15 19:03:09
|
13660
13681
|
* @LastEditors: binruan@chatlabs.com
|
13661
|
-
* @LastEditTime: 2024-05-
|
13682
|
+
* @LastEditTime: 2024-05-17 18:41:05
|
13662
13683
|
* @FilePath: \pb-sxp-ui\src\core\components\SxpPageCore\index.tsx
|
13663
13684
|
*
|
13664
13685
|
*/
|
@@ -13675,14 +13696,14 @@ Object.values(_materials_).forEach((v) => {
|
|
13675
13696
|
RESOLVER[v.extend.type] = v;
|
13676
13697
|
});
|
13677
13698
|
const SxpPageCore = ({ data, maxSize = 10, defaultSize = 10, hashTagSize = 20, loadingImage, appDomain, licenseUrl, enabledMetaConversionApi }) => {
|
13678
|
-
var _a, _b, _c, _d, _e, _f;
|
13699
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
13679
13700
|
const utmVal = useMemo(() => {
|
13680
13701
|
var _a;
|
13681
13702
|
const searchParams = (location === null || location === void 0 ? void 0 : location.search) ? (_a = location === null || location === void 0 ? void 0 : location.search) === null || _a === void 0 ? void 0 : _a.replace('?', '') : '';
|
13682
13703
|
return searchParams;
|
13683
13704
|
}, []);
|
13684
13705
|
return (React.createElement(EditorCore, { resolver: RESOLVER, enableDataSource: false, schema: data === null || data === void 0 ? void 0 : data.data, utmVal: utmVal },
|
13685
|
-
React.createElement(SxpDataSourceProvider$1, { utmVal: utmVal, dataSources: data === null || data === void 0 ? void 0 : data.data_sources, sxpParameter: data === null || data === void 0 ? void 0 : data.sxp_parameter, maxSize: (_b = (_a = data === null || data === void 0 ? void 0 : data.sxp_parameter) === null || _a === void 0 ? void 0 : _a.personalized_recommend) !== null && _b !== void 0 ? _b : maxSize, defaultSize: (_d = (_c = data === null || data === void 0 ? void 0 : data.sxp_parameter) === null || _c === void 0 ? void 0 : _c.default_recommend) !== null && _d !== void 0 ? _d : defaultSize, hashTagSize: (_f = (_e = data === null || data === void 0 ? void 0 : data.sxp_parameter) === null || _e === void 0 ? void 0 : _e.hash_tag_size) !== null && _f !== void 0 ? _f : hashTagSize, loadingImage: loadingImage, appDomain: appDomain, enabledMetaConversionApi: enabledMetaConversionApi, render: ({ rtcList, tagList }) => {
|
13706
|
+
React.createElement(SxpDataSourceProvider$1, { utmVal: utmVal, dataSources: data === null || data === void 0 ? void 0 : data.data_sources, sxpParameter: data === null || data === void 0 ? void 0 : data.sxp_parameter, maxSize: (_b = (_a = data === null || data === void 0 ? void 0 : data.sxp_parameter) === null || _a === void 0 ? void 0 : _a.personalized_recommend) !== null && _b !== void 0 ? _b : maxSize, defaultSize: (_d = (_c = data === null || data === void 0 ? void 0 : data.sxp_parameter) === null || _c === void 0 ? void 0 : _c.default_recommend) !== null && _d !== void 0 ? _d : defaultSize, hashTagSize: (_f = (_e = data === null || data === void 0 ? void 0 : data.sxp_parameter) === null || _e === void 0 ? void 0 : _e.hash_tag_size) !== null && _f !== void 0 ? _f : hashTagSize, loadingImage: loadingImage, appDomain: appDomain, enabledMetaConversionApi: enabledMetaConversionApi, isShowTag: (_j = (_h = (_g = data === null || data === void 0 ? void 0 : data.data) === null || _g === void 0 ? void 0 : _g.sxpPageConf) === null || _h === void 0 ? void 0 : _h.globalConfig) === null || _j === void 0 ? void 0 : _j.isShowTag, render: ({ rtcList, tagList }) => {
|
13686
13707
|
var _a;
|
13687
13708
|
return (React.createElement(React.Fragment, null,
|
13688
13709
|
React.createElement(SxpPageRender, Object.assign({}, (_a = data === null || data === void 0 ? void 0 : data.data) === null || _a === void 0 ? void 0 : _a.sxpPageConf, { tagList: tagList, data: rtcList, resolver: RESOLVER, licenseUrl: licenseUrl })),
|