pb-sxp-ui 1.15.31 → 1.15.33

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 CHANGED
@@ -674,6 +674,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
674
674
  const [playbookType, setPlaybookType] = React.useState();
675
675
  const [chatlabsId, setChatlabsId] = React.useState();
676
676
  const finalPageData = React.useMemo(() => pageData !== null && pageData !== void 0 ? pageData : data, [pageData, data]);
677
+ const pixelPvStatusRef = React.useRef(false);
677
678
  const isShowConsent = React.useMemo(() => {
678
679
  var _a, _b, _c, _d;
679
680
  return (((((_d = (_c = (_b = (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.consent) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.item) === null || _c === void 0 ? void 0 : _c.props) === null || _d === void 0 ? void 0 : _d.privacy_necessity) && !isAgreePolicy && !isEditor) || isOpenConsent) &&
@@ -1020,7 +1021,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
1020
1021
  return jsonParams;
1021
1022
  }, [fakeUserId]);
1022
1023
  const bffFbReport = React.useCallback(({ eventName, product }) => {
1023
- var _a, _b, _c, _d, _e, _f;
1024
+ var _a, _b, _c, _d, _e, _f, _g, _h;
1024
1025
  if (!enableReportEvent || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview)) {
1025
1026
  return;
1026
1027
  }
@@ -1037,6 +1038,10 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
1037
1038
  }
1038
1039
  }
1039
1040
  if (eventName === 'PageView' && (pixelEventParamsJson === null || pixelEventParamsJson === void 0 ? void 0 : pixelEventParamsJson.event_name) === 'PageView') {
1041
+ if (!pixelPvStatusRef.current) {
1042
+ pixelPvStatusRef.current = true;
1043
+ return;
1044
+ }
1040
1045
  const currentUrl = window.location.href;
1041
1046
  const newUrl = updateQueryStringParameter(currentUrl, 'timestamp', Date.now());
1042
1047
  history.pushState({ path: newUrl }, '', newUrl);
@@ -1053,25 +1058,27 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
1053
1058
  window === null || window === void 0 ? void 0 : window.gtag('event', 'page_view');
1054
1059
  }
1055
1060
  const tiktokPixelEventParamsJson = (_b = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.tiktokPixel) === null || _b === void 0 ? void 0 : _b[eventName];
1056
- if ((tiktokPixelEventParamsJson === null || tiktokPixelEventParamsJson === void 0 ? void 0 : tiktokPixelEventParamsJson.event_name) && typeof (window === null || window === void 0 ? void 0 : window.ttq) === 'function') {
1057
- window === null || window === void 0 ? void 0 : window.ttq.track(tiktokPixelEventParamsJson === null || tiktokPixelEventParamsJson === void 0 ? void 0 : tiktokPixelEventParamsJson.event_name, tiktokPixelEventParamsJson);
1061
+ if ((tiktokPixelEventParamsJson === null || tiktokPixelEventParamsJson === void 0 ? void 0 : tiktokPixelEventParamsJson.event_name) &&
1062
+ typeof (window === null || window === void 0 ? void 0 : window.ttq) === 'object' &&
1063
+ typeof ((_c = window === null || window === void 0 ? void 0 : window.ttq) === null || _c === void 0 ? void 0 : _c.track) === 'function') {
1064
+ (_d = window === null || window === void 0 ? void 0 : window.ttq) === null || _d === void 0 ? void 0 : _d.track(tiktokPixelEventParamsJson === null || tiktokPixelEventParamsJson === void 0 ? void 0 : tiktokPixelEventParamsJson.event_name, tiktokPixelEventParamsJson);
1058
1065
  }
1059
- const snapchatPixelEventParamsJson = (_c = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.snapchatPixel) === null || _c === void 0 ? void 0 : _c[eventName];
1066
+ const snapchatPixelEventParamsJson = (_e = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.snapchatPixel) === null || _e === void 0 ? void 0 : _e[eventName];
1060
1067
  if ((snapchatPixelEventParamsJson === null || snapchatPixelEventParamsJson === void 0 ? void 0 : snapchatPixelEventParamsJson.event_name) && typeof (window === null || window === void 0 ? void 0 : window.snaptr) === 'function') {
1061
1068
  window === null || window === void 0 ? void 0 : window.snaptr('track', snapchatPixelEventParamsJson === null || snapchatPixelEventParamsJson === void 0 ? void 0 : snapchatPixelEventParamsJson.event_name, snapchatPixelEventParamsJson);
1062
1069
  }
1063
- const converApiEventParamsJson = (_d = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.converApi) === null || _d === void 0 ? void 0 : _d[eventName];
1070
+ const converApiEventParamsJson = (_f = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.converApi) === null || _f === void 0 ? void 0 : _f[eventName];
1064
1071
  if (enabledMetaConversionApi && converApiEventParamsJson) {
1065
1072
  const body = getEventParamsByJson(converApiEventParamsJson, product);
1066
1073
  const params = {};
1067
1074
  const queryString = location.search.slice(1);
1068
- (_e = splitUrlParams(queryString)) === null || _e === void 0 ? void 0 : _e.forEach((val) => {
1075
+ (_g = splitUrlParams(queryString)) === null || _g === void 0 ? void 0 : _g.forEach((val) => {
1069
1076
  const key = val.split('=')[0];
1070
1077
  const value = val.split('=')[1];
1071
1078
  params[key] = value;
1072
1079
  });
1073
1080
  const cl_source = params === null || params === void 0 ? void 0 : params.cl_source;
1074
- bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch(`v2/fb/${(_f = bffDataSource === null || bffDataSource === void 0 ? void 0 : bffDataSource.headers) === null || _f === void 0 ? void 0 : _f['x-app-id']}/${eventName}${cl_source ? `/${decodeURIComponent(cl_source)}` : ''}`, {
1081
+ bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch(`v2/fb/${(_h = bffDataSource === null || bffDataSource === void 0 ? void 0 : bffDataSource.headers) === null || _h === void 0 ? void 0 : _h['x-app-id']}/${eventName}${cl_source ? `/${decodeURIComponent(cl_source)}` : ''}`, {
1075
1082
  method: 'POST',
1076
1083
  body,
1077
1084
  type: 'beacon'