pb-sxp-ui 1.0.84 → 1.0.86
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 +37 -28
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +37 -28
- 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 +37 -28
- 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/Consent/index.js +1 -1
- package/es/core/components/SxpPageRender/WaterFall/WaterfallList.js +1 -1
- package/es/core/components/SxpPageRender/index.js +11 -6
- package/es/core/context/SxpDataSourceProvider.d.ts +1 -0
- package/es/core/context/SxpDataSourceProvider.js +21 -17
- package/lib/core/components/Consent/index.js +1 -1
- package/lib/core/components/SxpPageRender/WaterFall/WaterfallList.js +1 -1
- package/lib/core/components/SxpPageRender/index.js +11 -6
- package/lib/core/context/SxpDataSourceProvider.d.ts +1 -0
- package/lib/core/context/SxpDataSourceProvider.js +21 -17
- package/package.json +1 -1
package/dist/pb-ui.js
CHANGED
@@ -434,7 +434,7 @@
|
|
434
434
|
* @Author: binruan@chatlabs.com
|
435
435
|
* @Date: 2024-06-13 15:16:53
|
436
436
|
* @LastEditors: binruan@chatlabs.com
|
437
|
-
* @LastEditTime: 2024-06-
|
437
|
+
* @LastEditTime: 2024-06-18 16:06:16
|
438
438
|
* @FilePath: \pb-sxp-ui\src\core\components\Consent\index.tsx
|
439
439
|
*
|
440
440
|
*/
|
@@ -474,7 +474,7 @@
|
|
474
474
|
eventSubject: 'userConsent',
|
475
475
|
eventDescription: '用户授权【操作结果】',
|
476
476
|
consentResult: '0',
|
477
|
-
consentTags: '[]',
|
477
|
+
consentTags: '["系统运营"]',
|
478
478
|
rtc: null,
|
479
479
|
requestId: null,
|
480
480
|
sessionID: null
|
@@ -503,8 +503,8 @@
|
|
503
503
|
DataSourceType[DataSourceType["BFF"] = 5] = "BFF";
|
504
504
|
})(DataSourceType || (DataSourceType = {}));
|
505
505
|
const UTM_KEYS = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_id', 'utm_content', 'cl_source'];
|
506
|
-
const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent = true, maxSize, defaultSize, isPreview = false, sxpParameter, appDomain, hashTagSize, loadingImage, isOpenHashTag = false, enabledMetaConversionApi = false, consentHeight, consentWidth, isShowTag = true, isOpenConsent = false, globalConfig }) => {
|
507
|
-
var _a, _b, _c
|
506
|
+
const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent = true, maxSize, defaultSize, isPreview = false, sxpParameter, appDomain, hashTagSize, loadingImage, isOpenHashTag = false, enabledMetaConversionApi = false, consentHeight, consentWidth, isShowTag = true, isOpenConsent = false, globalConfig, isEditor = false }) => {
|
507
|
+
var _a, _b, _c;
|
508
508
|
const [rtcList, setRtcList] = React.useState([]);
|
509
509
|
const [tagList, setTagList] = React.useState([]);
|
510
510
|
const [loading, setLoading] = React.useState(false);
|
@@ -522,6 +522,10 @@
|
|
522
522
|
const [videoRef, setVideoRef] = React.useState(null);
|
523
523
|
const themeTag = React.useRef();
|
524
524
|
const curTime = React.useRef();
|
525
|
+
const isShowConsent = React.useMemo(() => {
|
526
|
+
var _a, _b, _c, _d;
|
527
|
+
return (((_d = (_c = (_b = (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.consent) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.item) === null || _c === void 0 ? void 0 : _c.props) === null || _d === void 0 ? void 0 : _d.privacy_necessity) && !isAgreePolicy && !isEditor) || isOpenConsent;
|
528
|
+
}, [isAgreePolicy, globalConfig, isOpenConsent, isEditor]);
|
525
529
|
React.useEffect(() => {
|
526
530
|
const handleChangeThemeTag = (tag) => {
|
527
531
|
themeTag.current = tag;
|
@@ -566,10 +570,10 @@
|
|
566
570
|
}, [bffDataSource]);
|
567
571
|
// 获取推荐视频数据
|
568
572
|
const getRecommendVideos = React.useCallback((query) => __awaiter(void 0, void 0, void 0, function* () {
|
569
|
-
var
|
573
|
+
var _d, _e, _f, _g, _h;
|
570
574
|
query = {
|
571
|
-
maxSize: (
|
572
|
-
defaultSize: (
|
575
|
+
maxSize: (_d = query === null || query === void 0 ? void 0 : query.maxSize) !== null && _d !== void 0 ? _d : maxSize,
|
576
|
+
defaultSize: (_e = query === null || query === void 0 ? void 0 : query.defaultSize) !== null && _e !== void 0 ? _e : defaultSize,
|
573
577
|
'itemFilter.itemId': query === null || query === void 0 ? void 0 : query['itemFilter.itemId'],
|
574
578
|
'itemFilter.itemType': query === null || query === void 0 ? void 0 : query['itemFilter.itemType'],
|
575
579
|
hashTag: query === null || query === void 0 ? void 0 : query.hashTag,
|
@@ -577,10 +581,10 @@
|
|
577
581
|
themeTag: query === null || query === void 0 ? void 0 : query.themeTag
|
578
582
|
};
|
579
583
|
if (utmVal) {
|
580
|
-
const val = (
|
584
|
+
const val = (_h = (_g = (_f = utmVal === null || utmVal === void 0 ? void 0 : utmVal.split('&')) === null || _f === void 0 ? void 0 : _f.filter((val) => {
|
581
585
|
const key = val.split('=')[0];
|
582
586
|
return UTM_KEYS.includes(key);
|
583
|
-
})) === null ||
|
587
|
+
})) === null || _g === void 0 ? void 0 : _g.join('&')) !== null && _h !== void 0 ? _h : '';
|
584
588
|
query = Object.assign(Object.assign({}, query), { channel: decodeURIComponent(val) });
|
585
589
|
}
|
586
590
|
const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/recommend/list', { method: 'GET', query }));
|
@@ -592,7 +596,7 @@
|
|
592
596
|
return result === null || result === void 0 ? void 0 : result.data;
|
593
597
|
}), [bffFetch, utmVal, maxSize, defaultSize]);
|
594
598
|
const loadVideos = React.useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
595
|
-
var
|
599
|
+
var _j, _k;
|
596
600
|
if (rtcList.length <= 0) {
|
597
601
|
return;
|
598
602
|
}
|
@@ -602,8 +606,8 @@
|
|
602
606
|
'itemFilter.itemType': waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.itemType,
|
603
607
|
themeTag: themeTag.current
|
604
608
|
});
|
605
|
-
setRtcList(rtcList.concat((
|
606
|
-
setCacheRtcList(cacheRtcList.concat((
|
609
|
+
setRtcList(rtcList.concat((_j = data === null || data === void 0 ? void 0 : data.recList) !== null && _j !== void 0 ? _j : []));
|
610
|
+
setCacheRtcList(cacheRtcList.concat((_k = data === null || data === void 0 ? void 0 : data.recList) !== null && _k !== void 0 ? _k : []));
|
607
611
|
}), [getRecommendVideos, rtcList, waterFallData, cacheRtcList]);
|
608
612
|
const bffEventReport = React.useCallback(({ userInfo, eventInfo }) => {
|
609
613
|
// 关闭 BFF 事件上报
|
@@ -667,16 +671,16 @@
|
|
667
671
|
}), [bffFetch]);
|
668
672
|
// 获取 Tag
|
669
673
|
const bffGetTagList = React.useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
670
|
-
var
|
674
|
+
var _l, _m, _o, _p, _q;
|
671
675
|
if (!utmVal || !isShowTag)
|
672
676
|
return;
|
673
677
|
try {
|
674
|
-
const val = (
|
678
|
+
const val = (_o = (_m = (_l = utmVal === null || utmVal === void 0 ? void 0 : utmVal.split('&')) === null || _l === void 0 ? void 0 : _l.filter((val) => {
|
675
679
|
const key = val.split('=')[0];
|
676
680
|
return UTM_KEYS.includes(key);
|
677
|
-
})) === null ||
|
681
|
+
})) === null || _m === void 0 ? void 0 : _m.join('&')) !== null && _o !== void 0 ? _o : '';
|
678
682
|
const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/tag/list', { method: 'GET', query: { channel: decodeURIComponent(val) } }));
|
679
|
-
setTagList((
|
683
|
+
setTagList((_q = (_p = result === null || result === void 0 ? void 0 : result.data) === null || _p === void 0 ? void 0 : _p.tags) !== null && _q !== void 0 ? _q : []);
|
680
684
|
}
|
681
685
|
catch (e) {
|
682
686
|
console.log('e', e);
|
@@ -730,7 +734,7 @@
|
|
730
734
|
h5EnterLink();
|
731
735
|
}, []);
|
732
736
|
React.useEffect(() => {
|
733
|
-
if (
|
737
|
+
if (isShowConsent)
|
734
738
|
return;
|
735
739
|
setLoading(true);
|
736
740
|
bffGetTagList();
|
@@ -750,7 +754,7 @@
|
|
750
754
|
setLoading(false);
|
751
755
|
isInit.current = true;
|
752
756
|
});
|
753
|
-
}, [
|
757
|
+
}, [isShowConsent]);
|
754
758
|
React.useEffect(() => {
|
755
759
|
if (!isInit.current)
|
756
760
|
return;
|
@@ -808,7 +812,7 @@
|
|
808
812
|
curTime,
|
809
813
|
h5EnterLink,
|
810
814
|
themeTag
|
811
|
-
} },
|
815
|
+
} }, isShowConsent ? (React.createElement(Consent$3, Object.assign({}, (_c = (_b = (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.consent) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.item) === null || _c === void 0 ? void 0 : _c.props))) : (render({
|
812
816
|
rtcList,
|
813
817
|
mutateLike: bffMutateLike,
|
814
818
|
mutateUnlike: bffMutateUnlike,
|
@@ -12074,8 +12078,8 @@ Made in Italy` })));
|
|
12074
12078
|
// 通过宽度比例获取图片高度
|
12075
12079
|
const height = imgInfo.height * (unitWidth / imgInfo.width);
|
12076
12080
|
if (isLoading) {
|
12077
|
-
// 加
|
12078
|
-
sizeChange(height +
|
12081
|
+
// 加56是因为下方文字部分高度为56,可以自己设置
|
12082
|
+
sizeChange(height + 56 + space, index);
|
12079
12083
|
}
|
12080
12084
|
}, [imgInfo, index, unitWidth, isLoading, space]); /* 增加sizeChange依赖项会导致在admin预览编辑时无限刷新 */
|
12081
12085
|
const calculateHeightForWidth = (videoWidth, videoHeight, targetWidth) => {
|
@@ -13597,7 +13601,7 @@ Made in Italy` })));
|
|
13597
13601
|
* @Author: binruan@chatlabs.com
|
13598
13602
|
* @Date: 2024-01-15 19:03:09
|
13599
13603
|
* @LastEditors: binruan@chatlabs.com
|
13600
|
-
* @LastEditTime: 2024-06-
|
13604
|
+
* @LastEditTime: 2024-06-18 11:50:31
|
13601
13605
|
* @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\index.tsx
|
13602
13606
|
*
|
13603
13607
|
*/
|
@@ -13688,9 +13692,11 @@ Made in Italy` })));
|
|
13688
13692
|
if (document.visibilityState === 'hidden') {
|
13689
13693
|
// 当用户导航到新页面、切换标签页、关闭标签页、最小化或关闭浏览器、刷新原页面(即离开原页面时),或者在移动设备上从浏览器切换到不同的应用程序时
|
13690
13694
|
// 移动端h5直接杀掉浏览器或宿主app时不会触发,pc端直接杀掉标签页时能触发
|
13691
|
-
|
13692
|
-
|
13693
|
-
|
13695
|
+
if (!openHashtag) {
|
13696
|
+
SXP_EVENT_BUS.emit(SXP_EVENT_TYPE.PAGE_DID_HIDE, item);
|
13697
|
+
handleReportViewImageEnd(item);
|
13698
|
+
handleReportProductView(item);
|
13699
|
+
}
|
13694
13700
|
let fromKName = '';
|
13695
13701
|
if (popupDetailData && (((_b = (_a = item === null || item === void 0 ? void 0 : item.video) === null || _a === void 0 ? void 0 : _a.bindProducts) === null || _b === void 0 ? void 0 : _b.length) || ((_c = item === null || item === void 0 ? void 0 : item.video) === null || _c === void 0 ? void 0 : _c.bindProduct))) {
|
13696
13702
|
fromKName = 'pdpPage';
|
@@ -13727,8 +13733,10 @@ Made in Italy` })));
|
|
13727
13733
|
else if (document.visibilityState === 'visible') {
|
13728
13734
|
// 页面可见时触发,注意页面初始化时不会触发
|
13729
13735
|
handleH5EnterLink();
|
13730
|
-
|
13731
|
-
|
13736
|
+
if (!openHashtag) {
|
13737
|
+
handleViewImageStartEvent(activeIndex);
|
13738
|
+
SXP_EVENT_BUS.emit(SXP_EVENT_TYPE.PAGE_DID_SHOW, item);
|
13739
|
+
}
|
13732
13740
|
backMainFeed('external');
|
13733
13741
|
}
|
13734
13742
|
};
|
@@ -13745,7 +13753,8 @@ Made in Italy` })));
|
|
13745
13753
|
isFromHashtag,
|
13746
13754
|
tempMap,
|
13747
13755
|
curTime,
|
13748
|
-
backMainFeed
|
13756
|
+
backMainFeed,
|
13757
|
+
openHashtag
|
13749
13758
|
]);
|
13750
13759
|
React.useEffect(() => {
|
13751
13760
|
const initTime = () => {
|