pb-sxp-ui 1.19.0-alpha.3 → 1.19.0-alpha.4
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 +64 -26
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +64 -26
- package/dist/index.js.map +1 -1
- package/dist/index.min.cjs +4 -4
- package/dist/index.min.cjs.map +1 -1
- package/dist/index.min.js +4 -4
- package/dist/index.min.js.map +1 -1
- package/dist/pb-ui.js +64 -26
- package/dist/pb-ui.js.map +1 -1
- package/dist/pb-ui.min.js +4 -4
- package/dist/pb-ui.min.js.map +1 -1
- package/es/core/components/SxpPageRender/index.js +40 -22
- package/es/core/context/SxpDataSourceProvider.js +2 -3
- package/lib/core/components/SxpPageRender/index.js +40 -22
- package/lib/core/context/SxpDataSourceProvider.js +2 -3
- package/package.json +1 -1
|
@@ -42,6 +42,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
|
42
42
|
const [isReload, setIsReload] = useState(new Date().getTime());
|
|
43
43
|
const skipLinkRef = useRef(false);
|
|
44
44
|
const [pageNum, setPageNum] = useState(2);
|
|
45
|
+
const [isShowCookieSetting, setIsShowCookieSetting] = useState(false);
|
|
45
46
|
const videoWidgetRef = useRef(null);
|
|
46
47
|
const fbcRef = useRef('');
|
|
47
48
|
const { loadVideos, bffEventReport, loading, setPopupDetailData, ctaEvent, swiperRef, waterFallData, setOpenHashtag, appDomain, openHashtag, loadingImage, isFromHashtag, popupDetailData, bffFbReport, curTime, h5EnterLink, isShowConsent, selectTag, isPreview, isEditor, cacheRtcList, setRtcList, cacheActiveIndex, rtcList, isNoMoreData, channel, refreshFeSession, isDiyH5 } = useSxpDataSource();
|
|
@@ -485,30 +486,47 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
|
485
486
|
if (!(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enableCookieSetting))
|
|
486
487
|
return;
|
|
487
488
|
window.OptanonWrapper = function () {
|
|
488
|
-
var _a
|
|
489
|
-
|
|
490
|
-
if (
|
|
491
|
-
|
|
492
|
-
if (activeGroups === null || activeGroups === void 0 ? void 0 : activeGroups.includes('4')) {
|
|
493
|
-
if (fbcRef.current) {
|
|
494
|
-
setCookie('_fbc', fbcRef.current, 90);
|
|
495
|
-
}
|
|
489
|
+
var _a;
|
|
490
|
+
console.log('OptanonWrapper');
|
|
491
|
+
if ((window === null || window === void 0 ? void 0 : window.OnetrustActiveGroups) && ((_a = window === null || window === void 0 ? void 0 : window.OnetrustActiveGroups) === null || _a === void 0 ? void 0 : _a.length) > 2) {
|
|
492
|
+
setIsShowCookieSetting(true);
|
|
496
493
|
}
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
494
|
+
};
|
|
495
|
+
const handleClick = (event) => {
|
|
496
|
+
var _a, _b;
|
|
497
|
+
const beForeactiveGroups = window === null || window === void 0 ? void 0 : window.OnetrustActiveGroups;
|
|
498
|
+
if (((_a = event.target) === null || _a === void 0 ? void 0 : _a.closest('.ot-pc-refuse-all-handler')) || ((_b = event.target) === null || _b === void 0 ? void 0 : _b.closest('.save-preference-btn-handler'))) {
|
|
499
|
+
window.OptanonWrapper = function () {
|
|
500
|
+
var _a, _b;
|
|
501
|
+
const activeGroups = window === null || window === void 0 ? void 0 : window.OnetrustActiveGroups;
|
|
502
|
+
if (!activeGroups)
|
|
503
|
+
return;
|
|
504
|
+
if (activeGroups === null || activeGroups === void 0 ? void 0 : activeGroups.includes('4')) {
|
|
505
|
+
if (fbcRef.current && !(beForeactiveGroups === null || beForeactiveGroups === void 0 ? void 0 : beForeactiveGroups.includes('4'))) {
|
|
506
|
+
setCookie('_fbp', fbcRef.current, 90);
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
else if (beForeactiveGroups === null || beForeactiveGroups === void 0 ? void 0 : beForeactiveGroups.includes('4')) {
|
|
510
|
+
fbcRef.current = getCookie('_fbc');
|
|
511
|
+
deleteCookie('_fbc');
|
|
512
|
+
const item = data[activeIndex];
|
|
513
|
+
const traceInfo = ((_a = item === null || item === void 0 ? void 0 : item.video) === null || _a === void 0 ? void 0 : _a.traceInfo) || ((_b = item === null || item === void 0 ? void 0 : item.product) === null || _b === void 0 ? void 0 : _b.traceInfo) || '';
|
|
514
|
+
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
|
515
|
+
eventInfo: {
|
|
516
|
+
eventSubject: 'refuseCookie',
|
|
517
|
+
eventDescription: 'refuseCookie',
|
|
518
|
+
traceInfo
|
|
519
|
+
},
|
|
520
|
+
isActiveTargetingCookie: false
|
|
521
|
+
});
|
|
522
|
+
}
|
|
523
|
+
};
|
|
510
524
|
}
|
|
511
525
|
};
|
|
526
|
+
document.addEventListener('click', handleClick);
|
|
527
|
+
return () => {
|
|
528
|
+
document.removeEventListener('click', handleClick);
|
|
529
|
+
};
|
|
512
530
|
}, [globalConfig, bffEventReport, data, activeIndex]);
|
|
513
531
|
const handleViewImageStartEvent = (activeIndex, imgInfo, enableCapi) => {
|
|
514
532
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
@@ -655,7 +673,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
|
655
673
|
React.createElement(WaterFall, Object.assign({}, (_u = (_t = (_s = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.hashTag) === null || _s === void 0 ? void 0 : _s[0]) === null || _t === void 0 ? void 0 : _t.item) === null || _u === void 0 ? void 0 : _u.props)),
|
|
656
674
|
React.createElement(ConsentPopup, { resolver: resolver, globalConfig: globalConfig }),
|
|
657
675
|
openMultiPosts && (React.createElement(MultiPosts, Object.assign({}, (_x = (_w = (_v = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.multiPosts) === null || _v === void 0 ? void 0 : _v[0]) === null || _w === void 0 ? void 0 : _w.item) === null || _x === void 0 ? void 0 : _x.props, (_0 = (_z = (_y = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.multiPosts) === null || _y === void 0 ? void 0 : _y[0]) === null || _z === void 0 ? void 0 : _z.item) === null || _0 === void 0 ? void 0 : _0.event, { style: { position: 'fixed', top: 0, left: 0, right: 0 } }))))),
|
|
658
|
-
|
|
676
|
+
isShowCookieSetting && (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enableCookieSetting) && (React.createElement("div", { style: { position: 'fixed', bottom: 0, left: 0, right: 0, width: '100%', zIndex: 10, backgroundColor: '#000', fontSize: 0 } },
|
|
659
677
|
React.createElement("button", { id: 'ot-sdk-btn', className: 'ot-sdk-show-settings', style: { textDecoration: 'underline', width: 'fit-content', border: 'none', lineHeight: '24px', fontSize: '10px', color: '#fff', padding: '0 20px' } }, "Cookie settings")))));
|
|
660
678
|
};
|
|
661
679
|
export default memo(SxpPageRender);
|
|
@@ -106,7 +106,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
106
106
|
return ((_a = bffDataSource === null || bffDataSource === void 0 ? void 0 : bffDataSource.headers) === null || _a === void 0 ? void 0 : _a['x-app-id']) + storeAndLoadFeUserId();
|
|
107
107
|
}, [bffDataSource]);
|
|
108
108
|
const getTargetingCookie = () => {
|
|
109
|
-
var _a;
|
|
109
|
+
var _a, _b;
|
|
110
110
|
function isTargetingRejected(cookieValue) {
|
|
111
111
|
const groupsMatch = cookieValue.match(/groups=([^&]+)/);
|
|
112
112
|
if (!groupsMatch || !groupsMatch[1]) {
|
|
@@ -131,8 +131,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
131
131
|
return '';
|
|
132
132
|
}
|
|
133
133
|
const OptanonConsent = decodeURIComponent((_a = getCookie('OptanonConsent')) !== null && _a !== void 0 ? _a : '');
|
|
134
|
-
|
|
135
|
-
if (((window === null || window === void 0 ? void 0 : window.OnetrustActiveGroups) && !(window === null || window === void 0 ? void 0 : window.OnetrustActiveGroups.includes('4')))) {
|
|
134
|
+
if (((window === null || window === void 0 ? void 0 : window.OnetrustActiveGroups) && ((_b = window === null || window === void 0 ? void 0 : window.OnetrustActiveGroups) === null || _b === void 0 ? void 0 : _b.length) > 2 && !(window === null || window === void 0 ? void 0 : window.OnetrustActiveGroups.includes('4')) && isTargetingRejected(OptanonConsent))) {
|
|
136
135
|
return true;
|
|
137
136
|
}
|
|
138
137
|
return false;
|
|
@@ -45,6 +45,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
|
45
45
|
const [isReload, setIsReload] = (0, react_1.useState)(new Date().getTime());
|
|
46
46
|
const skipLinkRef = (0, react_1.useRef)(false);
|
|
47
47
|
const [pageNum, setPageNum] = (0, react_1.useState)(2);
|
|
48
|
+
const [isShowCookieSetting, setIsShowCookieSetting] = (0, react_1.useState)(false);
|
|
48
49
|
const videoWidgetRef = (0, react_1.useRef)(null);
|
|
49
50
|
const fbcRef = (0, react_1.useRef)('');
|
|
50
51
|
const { loadVideos, bffEventReport, loading, setPopupDetailData, ctaEvent, swiperRef, waterFallData, setOpenHashtag, appDomain, openHashtag, loadingImage, isFromHashtag, popupDetailData, bffFbReport, curTime, h5EnterLink, isShowConsent, selectTag, isPreview, isEditor, cacheRtcList, setRtcList, cacheActiveIndex, rtcList, isNoMoreData, channel, refreshFeSession, isDiyH5 } = (0, hooks_1.useSxpDataSource)();
|
|
@@ -488,30 +489,47 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
|
488
489
|
if (!(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enableCookieSetting))
|
|
489
490
|
return;
|
|
490
491
|
window.OptanonWrapper = function () {
|
|
491
|
-
var _a
|
|
492
|
-
|
|
493
|
-
if (
|
|
494
|
-
|
|
495
|
-
if (activeGroups === null || activeGroups === void 0 ? void 0 : activeGroups.includes('4')) {
|
|
496
|
-
if (fbcRef.current) {
|
|
497
|
-
(0, tool_1.setCookie)('_fbc', fbcRef.current, 90);
|
|
498
|
-
}
|
|
492
|
+
var _a;
|
|
493
|
+
console.log('OptanonWrapper');
|
|
494
|
+
if ((window === null || window === void 0 ? void 0 : window.OnetrustActiveGroups) && ((_a = window === null || window === void 0 ? void 0 : window.OnetrustActiveGroups) === null || _a === void 0 ? void 0 : _a.length) > 2) {
|
|
495
|
+
setIsShowCookieSetting(true);
|
|
499
496
|
}
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
497
|
+
};
|
|
498
|
+
const handleClick = (event) => {
|
|
499
|
+
var _a, _b;
|
|
500
|
+
const beForeactiveGroups = window === null || window === void 0 ? void 0 : window.OnetrustActiveGroups;
|
|
501
|
+
if (((_a = event.target) === null || _a === void 0 ? void 0 : _a.closest('.ot-pc-refuse-all-handler')) || ((_b = event.target) === null || _b === void 0 ? void 0 : _b.closest('.save-preference-btn-handler'))) {
|
|
502
|
+
window.OptanonWrapper = function () {
|
|
503
|
+
var _a, _b;
|
|
504
|
+
const activeGroups = window === null || window === void 0 ? void 0 : window.OnetrustActiveGroups;
|
|
505
|
+
if (!activeGroups)
|
|
506
|
+
return;
|
|
507
|
+
if (activeGroups === null || activeGroups === void 0 ? void 0 : activeGroups.includes('4')) {
|
|
508
|
+
if (fbcRef.current && !(beForeactiveGroups === null || beForeactiveGroups === void 0 ? void 0 : beForeactiveGroups.includes('4'))) {
|
|
509
|
+
(0, tool_1.setCookie)('_fbp', fbcRef.current, 90);
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
else if (beForeactiveGroups === null || beForeactiveGroups === void 0 ? void 0 : beForeactiveGroups.includes('4')) {
|
|
513
|
+
fbcRef.current = (0, tool_1.getCookie)('_fbc');
|
|
514
|
+
(0, tool_1.deleteCookie)('_fbc');
|
|
515
|
+
const item = data[activeIndex];
|
|
516
|
+
const traceInfo = ((_a = item === null || item === void 0 ? void 0 : item.video) === null || _a === void 0 ? void 0 : _a.traceInfo) || ((_b = item === null || item === void 0 ? void 0 : item.product) === null || _b === void 0 ? void 0 : _b.traceInfo) || '';
|
|
517
|
+
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
|
518
|
+
eventInfo: {
|
|
519
|
+
eventSubject: 'refuseCookie',
|
|
520
|
+
eventDescription: 'refuseCookie',
|
|
521
|
+
traceInfo
|
|
522
|
+
},
|
|
523
|
+
isActiveTargetingCookie: false
|
|
524
|
+
});
|
|
525
|
+
}
|
|
526
|
+
};
|
|
513
527
|
}
|
|
514
528
|
};
|
|
529
|
+
document.addEventListener('click', handleClick);
|
|
530
|
+
return () => {
|
|
531
|
+
document.removeEventListener('click', handleClick);
|
|
532
|
+
};
|
|
515
533
|
}, [globalConfig, bffEventReport, data, activeIndex]);
|
|
516
534
|
const handleViewImageStartEvent = (activeIndex, imgInfo, enableCapi) => {
|
|
517
535
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
@@ -658,7 +676,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
|
658
676
|
react_1.default.createElement(WaterFall_1.default, Object.assign({}, (_u = (_t = (_s = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.hashTag) === null || _s === void 0 ? void 0 : _s[0]) === null || _t === void 0 ? void 0 : _t.item) === null || _u === void 0 ? void 0 : _u.props)),
|
|
659
677
|
react_1.default.createElement(ConsentPopup_1.default, { resolver: resolver, globalConfig: globalConfig }),
|
|
660
678
|
openMultiPosts && (react_1.default.createElement(MultiPosts_1.default, Object.assign({}, (_x = (_w = (_v = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.multiPosts) === null || _v === void 0 ? void 0 : _v[0]) === null || _w === void 0 ? void 0 : _w.item) === null || _x === void 0 ? void 0 : _x.props, (_0 = (_z = (_y = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.multiPosts) === null || _y === void 0 ? void 0 : _y[0]) === null || _z === void 0 ? void 0 : _z.item) === null || _0 === void 0 ? void 0 : _0.event, { style: { position: 'fixed', top: 0, left: 0, right: 0 } }))))),
|
|
661
|
-
|
|
679
|
+
isShowCookieSetting && (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enableCookieSetting) && (react_1.default.createElement("div", { style: { position: 'fixed', bottom: 0, left: 0, right: 0, width: '100%', zIndex: 10, backgroundColor: '#000', fontSize: 0 } },
|
|
662
680
|
react_1.default.createElement("button", { id: 'ot-sdk-btn', className: 'ot-sdk-show-settings', style: { textDecoration: 'underline', width: 'fit-content', border: 'none', lineHeight: '24px', fontSize: '10px', color: '#fff', padding: '0 20px' } }, "Cookie settings")))));
|
|
663
681
|
};
|
|
664
682
|
exports.default = (0, react_1.memo)(SxpPageRender);
|
|
@@ -109,7 +109,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
109
109
|
return ((_a = bffDataSource === null || bffDataSource === void 0 ? void 0 : bffDataSource.headers) === null || _a === void 0 ? void 0 : _a['x-app-id']) + (0, localStore_1.storeAndLoadFeUserId)();
|
|
110
110
|
}, [bffDataSource]);
|
|
111
111
|
const getTargetingCookie = () => {
|
|
112
|
-
var _a;
|
|
112
|
+
var _a, _b;
|
|
113
113
|
function isTargetingRejected(cookieValue) {
|
|
114
114
|
const groupsMatch = cookieValue.match(/groups=([^&]+)/);
|
|
115
115
|
if (!groupsMatch || !groupsMatch[1]) {
|
|
@@ -134,8 +134,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
134
134
|
return '';
|
|
135
135
|
}
|
|
136
136
|
const OptanonConsent = decodeURIComponent((_a = getCookie('OptanonConsent')) !== null && _a !== void 0 ? _a : '');
|
|
137
|
-
|
|
138
|
-
if (((window === null || window === void 0 ? void 0 : window.OnetrustActiveGroups) && !(window === null || window === void 0 ? void 0 : window.OnetrustActiveGroups.includes('4')))) {
|
|
137
|
+
if (((window === null || window === void 0 ? void 0 : window.OnetrustActiveGroups) && ((_b = window === null || window === void 0 ? void 0 : window.OnetrustActiveGroups) === null || _b === void 0 ? void 0 : _b.length) > 2 && !(window === null || window === void 0 ? void 0 : window.OnetrustActiveGroups.includes('4')) && isTargetingRejected(OptanonConsent))) {
|
|
139
138
|
return true;
|
|
140
139
|
}
|
|
141
140
|
return false;
|