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/index.cjs
CHANGED
|
@@ -307,33 +307,6 @@ function deleteCookie(name, path = '/', domain = '') {
|
|
|
307
307
|
document.cookie = `${name}=; ${expiration}${pathPart}${domainPart}`;
|
|
308
308
|
console.log(`已尝试删除Cookie: ${name}`);
|
|
309
309
|
}
|
|
310
|
-
function setCookie(name, value, days = 0, path = '/', domain = '', secure = false, sameSite = 'Lax') {
|
|
311
|
-
let cookieString = `${encodeURIComponent(name)}=${encodeURIComponent(value)}`;
|
|
312
|
-
// 设置过期时间
|
|
313
|
-
if (days) {
|
|
314
|
-
const date = new Date();
|
|
315
|
-
date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000);
|
|
316
|
-
cookieString += `; expires=${date.toUTCString()}`;
|
|
317
|
-
}
|
|
318
|
-
// 设置路径
|
|
319
|
-
if (path) {
|
|
320
|
-
cookieString += `; path=${path}`;
|
|
321
|
-
}
|
|
322
|
-
// 设置域名
|
|
323
|
-
if (domain) {
|
|
324
|
-
cookieString += `; domain=${domain}`;
|
|
325
|
-
}
|
|
326
|
-
// 设置Secure标志
|
|
327
|
-
if (secure) {
|
|
328
|
-
cookieString += '; secure';
|
|
329
|
-
}
|
|
330
|
-
// 设置SameSite属性
|
|
331
|
-
if (sameSite) {
|
|
332
|
-
cookieString += `; samesite=${sameSite}`;
|
|
333
|
-
}
|
|
334
|
-
// 设置Cookie
|
|
335
|
-
document.cookie = cookieString;
|
|
336
|
-
}
|
|
337
310
|
|
|
338
311
|
function unzip(b64Data) {
|
|
339
312
|
const strData = atob(b64Data);
|
|
@@ -772,7 +745,27 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
772
745
|
return ((_a = bffDataSource === null || bffDataSource === void 0 ? void 0 : bffDataSource.headers) === null || _a === void 0 ? void 0 : _a['x-app-id']) + storeAndLoadFeUserId();
|
|
773
746
|
}, [bffDataSource]);
|
|
774
747
|
const getTargetingCookie = () => {
|
|
775
|
-
var _a;
|
|
748
|
+
var _a, _b;
|
|
749
|
+
function isTargetingRejected(cookieValue) {
|
|
750
|
+
// 1. 从Cookie字符串中提取groups部分
|
|
751
|
+
const groupsMatch = cookieValue.match(/groups=([^&]+)/);
|
|
752
|
+
if (!groupsMatch || !groupsMatch[1]) {
|
|
753
|
+
return false;
|
|
754
|
+
}
|
|
755
|
+
const groupsString = groupsMatch[1];
|
|
756
|
+
// 2. 将groups字符串拆分为键值对数组
|
|
757
|
+
const groupsPairs = groupsString.split(',');
|
|
758
|
+
// 3. 遍历查找第四个类别(Targeting)的状态
|
|
759
|
+
for (const pair of groupsPairs) {
|
|
760
|
+
const [category, status] = pair.split(':');
|
|
761
|
+
if (category === '4') {
|
|
762
|
+
// 找到第四个类别,检查其状态
|
|
763
|
+
return status === '0'; // 如果状态为0则返回true
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
// 如果没有找到第四个类别
|
|
767
|
+
return false;
|
|
768
|
+
}
|
|
776
769
|
function getCookie(name) {
|
|
777
770
|
var _a;
|
|
778
771
|
const value = `; ${document.cookie}`;
|
|
@@ -781,9 +774,8 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
781
774
|
return (_a = parts.pop()) === null || _a === void 0 ? void 0 : _a.split(';').shift();
|
|
782
775
|
return '';
|
|
783
776
|
}
|
|
784
|
-
decodeURIComponent((_a = getCookie('OptanonConsent')) !== null && _a !== void 0 ? _a : '');
|
|
785
|
-
|
|
786
|
-
if (((window === null || window === void 0 ? void 0 : window.OnetrustActiveGroups) && !(window === null || window === void 0 ? void 0 : window.OnetrustActiveGroups.includes('4')))) {
|
|
777
|
+
const OptanonConsent = decodeURIComponent((_a = getCookie('OptanonConsent')) !== null && _a !== void 0 ? _a : '');
|
|
778
|
+
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))) {
|
|
787
779
|
return true;
|
|
788
780
|
}
|
|
789
781
|
return false;
|
|
@@ -19024,6 +19016,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
|
19024
19016
|
const [isReload, setIsReload] = React.useState(new Date().getTime());
|
|
19025
19017
|
const skipLinkRef = React.useRef(false);
|
|
19026
19018
|
const [pageNum, setPageNum] = React.useState(2);
|
|
19019
|
+
const [isShowCookieSetting, setIsShowCookieSetting] = React.useState(false);
|
|
19027
19020
|
const videoWidgetRef = React.useRef(null);
|
|
19028
19021
|
const fbcRef = React.useRef('');
|
|
19029
19022
|
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();
|
|
@@ -19473,30 +19466,46 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
|
19473
19466
|
if (!(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enableCookieSetting))
|
|
19474
19467
|
return;
|
|
19475
19468
|
window.OptanonWrapper = function () {
|
|
19476
|
-
var _a
|
|
19477
|
-
|
|
19478
|
-
if (
|
|
19479
|
-
|
|
19480
|
-
if (activeGroups === null || activeGroups === void 0 ? void 0 : activeGroups.includes('4')) {
|
|
19481
|
-
if (fbcRef.current) {
|
|
19482
|
-
setCookie('_fbc', fbcRef.current, 90);
|
|
19483
|
-
}
|
|
19469
|
+
var _a;
|
|
19470
|
+
console.log('OptanonWrapper');
|
|
19471
|
+
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) {
|
|
19472
|
+
setIsShowCookieSetting(true);
|
|
19484
19473
|
}
|
|
19485
|
-
|
|
19486
|
-
|
|
19487
|
-
|
|
19488
|
-
|
|
19489
|
-
|
|
19490
|
-
|
|
19491
|
-
|
|
19492
|
-
|
|
19493
|
-
|
|
19494
|
-
|
|
19495
|
-
|
|
19496
|
-
|
|
19497
|
-
|
|
19474
|
+
};
|
|
19475
|
+
const handleClick = (event) => {
|
|
19476
|
+
var _a, _b;
|
|
19477
|
+
const beForeactiveGroups = window === null || window === void 0 ? void 0 : window.OnetrustActiveGroups;
|
|
19478
|
+
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'))) {
|
|
19479
|
+
window.OptanonWrapper = function () {
|
|
19480
|
+
var _a, _b;
|
|
19481
|
+
// 这里可以添加保存选择后的处理逻辑
|
|
19482
|
+
const activeGroups = window === null || window === void 0 ? void 0 : window.OnetrustActiveGroups;
|
|
19483
|
+
if (!activeGroups)
|
|
19484
|
+
return;
|
|
19485
|
+
if (activeGroups === null || activeGroups === void 0 ? void 0 : activeGroups.includes('4')) {
|
|
19486
|
+
if (fbcRef.current && !(beForeactiveGroups === null || beForeactiveGroups === void 0 ? void 0 : beForeactiveGroups.includes('4'))) ;
|
|
19487
|
+
}
|
|
19488
|
+
else if (beForeactiveGroups === null || beForeactiveGroups === void 0 ? void 0 : beForeactiveGroups.includes('4')) {
|
|
19489
|
+
fbcRef.current = getCookie('_fbp');
|
|
19490
|
+
deleteCookie('_fbp');
|
|
19491
|
+
const item = data[activeIndex];
|
|
19492
|
+
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) || '';
|
|
19493
|
+
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
|
19494
|
+
eventInfo: {
|
|
19495
|
+
eventSubject: 'refuseCookie',
|
|
19496
|
+
eventDescription: 'refuseCookie',
|
|
19497
|
+
traceInfo
|
|
19498
|
+
},
|
|
19499
|
+
isActiveTargetingCookie: false
|
|
19500
|
+
});
|
|
19501
|
+
}
|
|
19502
|
+
};
|
|
19498
19503
|
}
|
|
19499
19504
|
};
|
|
19505
|
+
document.addEventListener('click', handleClick);
|
|
19506
|
+
return () => {
|
|
19507
|
+
document.removeEventListener('click', handleClick);
|
|
19508
|
+
};
|
|
19500
19509
|
}, [globalConfig, bffEventReport, data, activeIndex]);
|
|
19501
19510
|
const handleViewImageStartEvent = (activeIndex, imgInfo, enableCapi) => {
|
|
19502
19511
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
@@ -19645,7 +19654,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
|
19645
19654
|
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)),
|
|
19646
19655
|
React.createElement(ConsentPopup, { resolver: resolver, globalConfig: globalConfig }),
|
|
19647
19656
|
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 } }))))),
|
|
19648
|
-
|
|
19657
|
+
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 } },
|
|
19649
19658
|
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")))));
|
|
19650
19659
|
};
|
|
19651
19660
|
var SxpPageRender$1 = React.memo(SxpPageRender);
|