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.
@@ -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, _b;
489
- const activeGroups = window === null || window === void 0 ? void 0 : window.OnetrustActiveGroups;
490
- if (!activeGroups)
491
- return;
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
- else {
498
- fbcRef.current = getCookie('_fbc');
499
- deleteCookie('_fbc');
500
- const item = data[activeIndex];
501
- 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) || '';
502
- bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
503
- eventInfo: {
504
- eventSubject: 'refuseCookie',
505
- eventDescription: 'refuseCookie',
506
- traceInfo
507
- },
508
- isActiveTargetingCookie: false
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
- (window === null || window === void 0 ? void 0 : window.OnetrustActiveGroups) && (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 } },
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
- console.log('OptanonConsent:', window === null || window === void 0 ? void 0 : window.OnetrustActiveGroups);
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, _b;
492
- const activeGroups = window === null || window === void 0 ? void 0 : window.OnetrustActiveGroups;
493
- if (!activeGroups)
494
- return;
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
- else {
501
- fbcRef.current = (0, tool_1.getCookie)('_fbc');
502
- (0, tool_1.deleteCookie)('_fbc');
503
- const item = data[activeIndex];
504
- 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) || '';
505
- bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
506
- eventInfo: {
507
- eventSubject: 'refuseCookie',
508
- eventDescription: 'refuseCookie',
509
- traceInfo
510
- },
511
- isActiveTargetingCookie: false
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
- (window === null || window === void 0 ? void 0 : window.OnetrustActiveGroups) && (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 } },
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
- console.log('OptanonConsent:', window === null || window === void 0 ? void 0 : window.OnetrustActiveGroups);
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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pb-sxp-ui",
3
- "version": "1.19.0-alpha.3",
3
+ "version": "1.19.0-alpha.4",
4
4
  "description": "React enterprise-class UI components",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",