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.js CHANGED
@@ -652,6 +652,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
652
652
  const [playbookType, setPlaybookType] = useState();
653
653
  const [chatlabsId, setChatlabsId] = useState();
654
654
  const finalPageData = useMemo(() => pageData !== null && pageData !== void 0 ? pageData : data, [pageData, data]);
655
+ const pixelPvStatusRef = useRef(false);
655
656
  const isShowConsent = useMemo(() => {
656
657
  var _a, _b, _c, _d;
657
658
  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) &&
@@ -998,7 +999,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
998
999
  return jsonParams;
999
1000
  }, [fakeUserId]);
1000
1001
  const bffFbReport = useCallback(({ eventName, product }) => {
1001
- var _a, _b, _c, _d, _e, _f;
1002
+ var _a, _b, _c, _d, _e, _f, _g, _h;
1002
1003
  if (!enableReportEvent || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview)) {
1003
1004
  return;
1004
1005
  }
@@ -1015,6 +1016,10 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
1015
1016
  }
1016
1017
  }
1017
1018
  if (eventName === 'PageView' && (pixelEventParamsJson === null || pixelEventParamsJson === void 0 ? void 0 : pixelEventParamsJson.event_name) === 'PageView') {
1019
+ if (!pixelPvStatusRef.current) {
1020
+ pixelPvStatusRef.current = true;
1021
+ return;
1022
+ }
1018
1023
  const currentUrl = window.location.href;
1019
1024
  const newUrl = updateQueryStringParameter(currentUrl, 'timestamp', Date.now());
1020
1025
  history.pushState({ path: newUrl }, '', newUrl);
@@ -1031,25 +1036,27 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
1031
1036
  window === null || window === void 0 ? void 0 : window.gtag('event', 'page_view');
1032
1037
  }
1033
1038
  const tiktokPixelEventParamsJson = (_b = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.tiktokPixel) === null || _b === void 0 ? void 0 : _b[eventName];
1034
- if ((tiktokPixelEventParamsJson === null || tiktokPixelEventParamsJson === void 0 ? void 0 : tiktokPixelEventParamsJson.event_name) && typeof (window === null || window === void 0 ? void 0 : window.ttq) === 'function') {
1035
- window === null || window === void 0 ? void 0 : window.ttq.track(tiktokPixelEventParamsJson === null || tiktokPixelEventParamsJson === void 0 ? void 0 : tiktokPixelEventParamsJson.event_name, tiktokPixelEventParamsJson);
1039
+ if ((tiktokPixelEventParamsJson === null || tiktokPixelEventParamsJson === void 0 ? void 0 : tiktokPixelEventParamsJson.event_name) &&
1040
+ typeof (window === null || window === void 0 ? void 0 : window.ttq) === 'object' &&
1041
+ typeof ((_c = window === null || window === void 0 ? void 0 : window.ttq) === null || _c === void 0 ? void 0 : _c.track) === 'function') {
1042
+ (_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);
1036
1043
  }
1037
- const snapchatPixelEventParamsJson = (_c = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.snapchatPixel) === null || _c === void 0 ? void 0 : _c[eventName];
1044
+ const snapchatPixelEventParamsJson = (_e = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.snapchatPixel) === null || _e === void 0 ? void 0 : _e[eventName];
1038
1045
  if ((snapchatPixelEventParamsJson === null || snapchatPixelEventParamsJson === void 0 ? void 0 : snapchatPixelEventParamsJson.event_name) && typeof (window === null || window === void 0 ? void 0 : window.snaptr) === 'function') {
1039
1046
  window === null || window === void 0 ? void 0 : window.snaptr('track', snapchatPixelEventParamsJson === null || snapchatPixelEventParamsJson === void 0 ? void 0 : snapchatPixelEventParamsJson.event_name, snapchatPixelEventParamsJson);
1040
1047
  }
1041
- const converApiEventParamsJson = (_d = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.converApi) === null || _d === void 0 ? void 0 : _d[eventName];
1048
+ const converApiEventParamsJson = (_f = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.converApi) === null || _f === void 0 ? void 0 : _f[eventName];
1042
1049
  if (enabledMetaConversionApi && converApiEventParamsJson) {
1043
1050
  const body = getEventParamsByJson(converApiEventParamsJson, product);
1044
1051
  const params = {};
1045
1052
  const queryString = location.search.slice(1);
1046
- (_e = splitUrlParams(queryString)) === null || _e === void 0 ? void 0 : _e.forEach((val) => {
1053
+ (_g = splitUrlParams(queryString)) === null || _g === void 0 ? void 0 : _g.forEach((val) => {
1047
1054
  const key = val.split('=')[0];
1048
1055
  const value = val.split('=')[1];
1049
1056
  params[key] = value;
1050
1057
  });
1051
1058
  const cl_source = params === null || params === void 0 ? void 0 : params.cl_source;
1052
- 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)}` : ''}`, {
1059
+ 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)}` : ''}`, {
1053
1060
  method: 'POST',
1054
1061
  body,
1055
1062
  type: 'beacon'