pb-sxp-ui 1.19.0-alpha.3 → 1.19.0-alpha.5
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 +62 -53
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +62 -53
- 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 +62 -53
- 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 -23
- package/es/core/context/SxpDataSourceProvider.js +2 -3
- package/lib/core/components/SxpPageRender/index.js +39 -22
- package/lib/core/context/SxpDataSourceProvider.js +2 -3
- package/package.json +1 -1
package/dist/pb-ui.js
CHANGED
|
@@ -300,33 +300,6 @@
|
|
|
300
300
|
document.cookie = `${name}=; ${expiration}${pathPart}${domainPart}`;
|
|
301
301
|
console.log(`已尝试删除Cookie: ${name}`);
|
|
302
302
|
}
|
|
303
|
-
function setCookie(name, value, days = 0, path = '/', domain = '', secure = false, sameSite = 'Lax') {
|
|
304
|
-
let cookieString = `${encodeURIComponent(name)}=${encodeURIComponent(value)}`;
|
|
305
|
-
// 设置过期时间
|
|
306
|
-
if (days) {
|
|
307
|
-
const date = new Date();
|
|
308
|
-
date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000);
|
|
309
|
-
cookieString += `; expires=${date.toUTCString()}`;
|
|
310
|
-
}
|
|
311
|
-
// 设置路径
|
|
312
|
-
if (path) {
|
|
313
|
-
cookieString += `; path=${path}`;
|
|
314
|
-
}
|
|
315
|
-
// 设置域名
|
|
316
|
-
if (domain) {
|
|
317
|
-
cookieString += `; domain=${domain}`;
|
|
318
|
-
}
|
|
319
|
-
// 设置Secure标志
|
|
320
|
-
if (secure) {
|
|
321
|
-
cookieString += '; secure';
|
|
322
|
-
}
|
|
323
|
-
// 设置SameSite属性
|
|
324
|
-
if (sameSite) {
|
|
325
|
-
cookieString += `; samesite=${sameSite}`;
|
|
326
|
-
}
|
|
327
|
-
// 设置Cookie
|
|
328
|
-
document.cookie = cookieString;
|
|
329
|
-
}
|
|
330
303
|
|
|
331
304
|
function unzip(b64Data) {
|
|
332
305
|
const strData = atob(b64Data);
|
|
@@ -765,7 +738,27 @@
|
|
|
765
738
|
return ((_a = bffDataSource === null || bffDataSource === void 0 ? void 0 : bffDataSource.headers) === null || _a === void 0 ? void 0 : _a['x-app-id']) + storeAndLoadFeUserId();
|
|
766
739
|
}, [bffDataSource]);
|
|
767
740
|
const getTargetingCookie = () => {
|
|
768
|
-
var _a;
|
|
741
|
+
var _a, _b;
|
|
742
|
+
function isTargetingRejected(cookieValue) {
|
|
743
|
+
// 1. 从Cookie字符串中提取groups部分
|
|
744
|
+
const groupsMatch = cookieValue.match(/groups=([^&]+)/);
|
|
745
|
+
if (!groupsMatch || !groupsMatch[1]) {
|
|
746
|
+
return false;
|
|
747
|
+
}
|
|
748
|
+
const groupsString = groupsMatch[1];
|
|
749
|
+
// 2. 将groups字符串拆分为键值对数组
|
|
750
|
+
const groupsPairs = groupsString.split(',');
|
|
751
|
+
// 3. 遍历查找第四个类别(Targeting)的状态
|
|
752
|
+
for (const pair of groupsPairs) {
|
|
753
|
+
const [category, status] = pair.split(':');
|
|
754
|
+
if (category === '4') {
|
|
755
|
+
// 找到第四个类别,检查其状态
|
|
756
|
+
return status === '0'; // 如果状态为0则返回true
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
// 如果没有找到第四个类别
|
|
760
|
+
return false;
|
|
761
|
+
}
|
|
769
762
|
function getCookie(name) {
|
|
770
763
|
var _a;
|
|
771
764
|
const value = `; ${document.cookie}`;
|
|
@@ -774,9 +767,8 @@
|
|
|
774
767
|
return (_a = parts.pop()) === null || _a === void 0 ? void 0 : _a.split(';').shift();
|
|
775
768
|
return '';
|
|
776
769
|
}
|
|
777
|
-
decodeURIComponent((_a = getCookie('OptanonConsent')) !== null && _a !== void 0 ? _a : '');
|
|
778
|
-
|
|
779
|
-
if (((window === null || window === void 0 ? void 0 : window.OnetrustActiveGroups) && !(window === null || window === void 0 ? void 0 : window.OnetrustActiveGroups.includes('4')))) {
|
|
770
|
+
const OptanonConsent = decodeURIComponent((_a = getCookie('OptanonConsent')) !== null && _a !== void 0 ? _a : '');
|
|
771
|
+
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))) {
|
|
780
772
|
return true;
|
|
781
773
|
}
|
|
782
774
|
return false;
|
|
@@ -19017,6 +19009,7 @@ Made in Italy` })));
|
|
|
19017
19009
|
const [isReload, setIsReload] = React.useState(new Date().getTime());
|
|
19018
19010
|
const skipLinkRef = React.useRef(false);
|
|
19019
19011
|
const [pageNum, setPageNum] = React.useState(2);
|
|
19012
|
+
const [isShowCookieSetting, setIsShowCookieSetting] = React.useState(false);
|
|
19020
19013
|
const videoWidgetRef = React.useRef(null);
|
|
19021
19014
|
const fbcRef = React.useRef('');
|
|
19022
19015
|
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();
|
|
@@ -19466,30 +19459,46 @@ Made in Italy` })));
|
|
|
19466
19459
|
if (!(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enableCookieSetting))
|
|
19467
19460
|
return;
|
|
19468
19461
|
window.OptanonWrapper = function () {
|
|
19469
|
-
var _a
|
|
19470
|
-
|
|
19471
|
-
if (
|
|
19472
|
-
|
|
19473
|
-
if (activeGroups === null || activeGroups === void 0 ? void 0 : activeGroups.includes('4')) {
|
|
19474
|
-
if (fbcRef.current) {
|
|
19475
|
-
setCookie('_fbc', fbcRef.current, 90);
|
|
19476
|
-
}
|
|
19462
|
+
var _a;
|
|
19463
|
+
console.log('OptanonWrapper');
|
|
19464
|
+
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) {
|
|
19465
|
+
setIsShowCookieSetting(true);
|
|
19477
19466
|
}
|
|
19478
|
-
|
|
19479
|
-
|
|
19480
|
-
|
|
19481
|
-
|
|
19482
|
-
|
|
19483
|
-
|
|
19484
|
-
|
|
19485
|
-
|
|
19486
|
-
|
|
19487
|
-
|
|
19488
|
-
|
|
19489
|
-
|
|
19490
|
-
|
|
19467
|
+
};
|
|
19468
|
+
const handleClick = (event) => {
|
|
19469
|
+
var _a, _b;
|
|
19470
|
+
const beForeactiveGroups = window === null || window === void 0 ? void 0 : window.OnetrustActiveGroups;
|
|
19471
|
+
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'))) {
|
|
19472
|
+
window.OptanonWrapper = function () {
|
|
19473
|
+
var _a, _b;
|
|
19474
|
+
// 这里可以添加保存选择后的处理逻辑
|
|
19475
|
+
const activeGroups = window === null || window === void 0 ? void 0 : window.OnetrustActiveGroups;
|
|
19476
|
+
if (!activeGroups)
|
|
19477
|
+
return;
|
|
19478
|
+
if (activeGroups === null || activeGroups === void 0 ? void 0 : activeGroups.includes('4')) {
|
|
19479
|
+
if (fbcRef.current && !(beForeactiveGroups === null || beForeactiveGroups === void 0 ? void 0 : beForeactiveGroups.includes('4'))) ;
|
|
19480
|
+
}
|
|
19481
|
+
else if (beForeactiveGroups === null || beForeactiveGroups === void 0 ? void 0 : beForeactiveGroups.includes('4')) {
|
|
19482
|
+
fbcRef.current = getCookie('_fbp');
|
|
19483
|
+
deleteCookie('_fbp');
|
|
19484
|
+
const item = data[activeIndex];
|
|
19485
|
+
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) || '';
|
|
19486
|
+
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
|
19487
|
+
eventInfo: {
|
|
19488
|
+
eventSubject: 'refuseCookie',
|
|
19489
|
+
eventDescription: 'refuseCookie',
|
|
19490
|
+
traceInfo
|
|
19491
|
+
},
|
|
19492
|
+
isActiveTargetingCookie: false
|
|
19493
|
+
});
|
|
19494
|
+
}
|
|
19495
|
+
};
|
|
19491
19496
|
}
|
|
19492
19497
|
};
|
|
19498
|
+
document.addEventListener('click', handleClick);
|
|
19499
|
+
return () => {
|
|
19500
|
+
document.removeEventListener('click', handleClick);
|
|
19501
|
+
};
|
|
19493
19502
|
}, [globalConfig, bffEventReport, data, activeIndex]);
|
|
19494
19503
|
const handleViewImageStartEvent = (activeIndex, imgInfo, enableCapi) => {
|
|
19495
19504
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
@@ -19638,7 +19647,7 @@ Made in Italy` })));
|
|
|
19638
19647
|
React.createElement(WaterFall$1, 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)),
|
|
19639
19648
|
React.createElement(ConsentPopup, { resolver: resolver, globalConfig: globalConfig }),
|
|
19640
19649
|
openMultiPosts && (React.createElement(MultiPosts$2, 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 } }))))),
|
|
19641
|
-
|
|
19650
|
+
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 } },
|
|
19642
19651
|
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")))));
|
|
19643
19652
|
};
|
|
19644
19653
|
var SxpPageRender$1 = React.memo(SxpPageRender);
|