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.
@@ -26,7 +26,7 @@ import ConsentPopup from './ConsentPopup';
26
26
  import MultiPosts from '../../../materials/sxp/MultiPosts';
27
27
  import { useEditorDataProvider } from '../../../core/context/EditorDataProvider';
28
28
  import NavBack from './NavBack';
29
- import { deleteCookie, getCookie, setCookie } from '../../../core/utils/tool';
29
+ import { deleteCookie, getCookie } from '../../../core/utils/tool';
30
30
  const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.innerHeight, containerWidth = window.innerWidth, tempMap, resolver, data = [], ctaType, tipText, nudge, _schema, hashTagStyle, hashTagRightMargin, tagList = [], defaultData }) => {
31
31
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
32
32
  const mutedIcon = useIconLink('/pb_static/5beaaa5ce7f3477b99db3838619cc471.png');
@@ -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,46 @@ 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
+ }
507
+ }
508
+ else if (beForeactiveGroups === null || beForeactiveGroups === void 0 ? void 0 : beForeactiveGroups.includes('4')) {
509
+ fbcRef.current = getCookie('_fbp');
510
+ deleteCookie('_fbp');
511
+ const item = data[activeIndex];
512
+ 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) || '';
513
+ bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
514
+ eventInfo: {
515
+ eventSubject: 'refuseCookie',
516
+ eventDescription: 'refuseCookie',
517
+ traceInfo
518
+ },
519
+ isActiveTargetingCookie: false
520
+ });
521
+ }
522
+ };
510
523
  }
511
524
  };
525
+ document.addEventListener('click', handleClick);
526
+ return () => {
527
+ document.removeEventListener('click', handleClick);
528
+ };
512
529
  }, [globalConfig, bffEventReport, data, activeIndex]);
513
530
  const handleViewImageStartEvent = (activeIndex, imgInfo, enableCapi) => {
514
531
  var _a, _b, _c, _d, _e, _f, _g, _h;
@@ -655,7 +672,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
655
672
  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
673
  React.createElement(ConsentPopup, { resolver: resolver, globalConfig: globalConfig }),
657
674
  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 } },
675
+ 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
676
  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
677
  };
661
678
  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,46 @@ 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
+ }
510
+ }
511
+ else if (beForeactiveGroups === null || beForeactiveGroups === void 0 ? void 0 : beForeactiveGroups.includes('4')) {
512
+ fbcRef.current = (0, tool_1.getCookie)('_fbp');
513
+ (0, tool_1.deleteCookie)('_fbp');
514
+ const item = data[activeIndex];
515
+ 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) || '';
516
+ bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
517
+ eventInfo: {
518
+ eventSubject: 'refuseCookie',
519
+ eventDescription: 'refuseCookie',
520
+ traceInfo
521
+ },
522
+ isActiveTargetingCookie: false
523
+ });
524
+ }
525
+ };
513
526
  }
514
527
  };
528
+ document.addEventListener('click', handleClick);
529
+ return () => {
530
+ document.removeEventListener('click', handleClick);
531
+ };
515
532
  }, [globalConfig, bffEventReport, data, activeIndex]);
516
533
  const handleViewImageStartEvent = (activeIndex, imgInfo, enableCapi) => {
517
534
  var _a, _b, _c, _d, _e, _f, _g, _h;
@@ -658,7 +675,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
658
675
  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
676
  react_1.default.createElement(ConsentPopup_1.default, { resolver: resolver, globalConfig: globalConfig }),
660
677
  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 } },
678
+ 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
679
  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
680
  };
664
681
  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.5",
4
4
  "description": "React enterprise-class UI components",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",