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/pb-ui.js CHANGED
@@ -667,6 +667,7 @@
667
667
  const [playbookType, setPlaybookType] = React.useState();
668
668
  const [chatlabsId, setChatlabsId] = React.useState();
669
669
  const finalPageData = React.useMemo(() => pageData !== null && pageData !== void 0 ? pageData : data, [pageData, data]);
670
+ const pixelPvStatusRef = React.useRef(false);
670
671
  const isShowConsent = React.useMemo(() => {
671
672
  var _a, _b, _c, _d;
672
673
  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) &&
@@ -1013,7 +1014,7 @@
1013
1014
  return jsonParams;
1014
1015
  }, [fakeUserId]);
1015
1016
  const bffFbReport = React.useCallback(({ eventName, product }) => {
1016
- var _a, _b, _c, _d, _e, _f;
1017
+ var _a, _b, _c, _d, _e, _f, _g, _h;
1017
1018
  if (!enableReportEvent || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview)) {
1018
1019
  return;
1019
1020
  }
@@ -1030,6 +1031,10 @@
1030
1031
  }
1031
1032
  }
1032
1033
  if (eventName === 'PageView' && (pixelEventParamsJson === null || pixelEventParamsJson === void 0 ? void 0 : pixelEventParamsJson.event_name) === 'PageView') {
1034
+ if (!pixelPvStatusRef.current) {
1035
+ pixelPvStatusRef.current = true;
1036
+ return;
1037
+ }
1033
1038
  const currentUrl = window.location.href;
1034
1039
  const newUrl = updateQueryStringParameter(currentUrl, 'timestamp', Date.now());
1035
1040
  history.pushState({ path: newUrl }, '', newUrl);
@@ -1046,25 +1051,27 @@
1046
1051
  window === null || window === void 0 ? void 0 : window.gtag('event', 'page_view');
1047
1052
  }
1048
1053
  const tiktokPixelEventParamsJson = (_b = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.tiktokPixel) === null || _b === void 0 ? void 0 : _b[eventName];
1049
- if ((tiktokPixelEventParamsJson === null || tiktokPixelEventParamsJson === void 0 ? void 0 : tiktokPixelEventParamsJson.event_name) && typeof (window === null || window === void 0 ? void 0 : window.ttq) === 'function') {
1050
- window === null || window === void 0 ? void 0 : window.ttq.track(tiktokPixelEventParamsJson === null || tiktokPixelEventParamsJson === void 0 ? void 0 : tiktokPixelEventParamsJson.event_name, tiktokPixelEventParamsJson);
1054
+ if ((tiktokPixelEventParamsJson === null || tiktokPixelEventParamsJson === void 0 ? void 0 : tiktokPixelEventParamsJson.event_name) &&
1055
+ typeof (window === null || window === void 0 ? void 0 : window.ttq) === 'object' &&
1056
+ typeof ((_c = window === null || window === void 0 ? void 0 : window.ttq) === null || _c === void 0 ? void 0 : _c.track) === 'function') {
1057
+ (_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);
1051
1058
  }
1052
- const snapchatPixelEventParamsJson = (_c = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.snapchatPixel) === null || _c === void 0 ? void 0 : _c[eventName];
1059
+ const snapchatPixelEventParamsJson = (_e = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.snapchatPixel) === null || _e === void 0 ? void 0 : _e[eventName];
1053
1060
  if ((snapchatPixelEventParamsJson === null || snapchatPixelEventParamsJson === void 0 ? void 0 : snapchatPixelEventParamsJson.event_name) && typeof (window === null || window === void 0 ? void 0 : window.snaptr) === 'function') {
1054
1061
  window === null || window === void 0 ? void 0 : window.snaptr('track', snapchatPixelEventParamsJson === null || snapchatPixelEventParamsJson === void 0 ? void 0 : snapchatPixelEventParamsJson.event_name, snapchatPixelEventParamsJson);
1055
1062
  }
1056
- const converApiEventParamsJson = (_d = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.converApi) === null || _d === void 0 ? void 0 : _d[eventName];
1063
+ const converApiEventParamsJson = (_f = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.converApi) === null || _f === void 0 ? void 0 : _f[eventName];
1057
1064
  if (enabledMetaConversionApi && converApiEventParamsJson) {
1058
1065
  const body = getEventParamsByJson(converApiEventParamsJson, product);
1059
1066
  const params = {};
1060
1067
  const queryString = location.search.slice(1);
1061
- (_e = splitUrlParams(queryString)) === null || _e === void 0 ? void 0 : _e.forEach((val) => {
1068
+ (_g = splitUrlParams(queryString)) === null || _g === void 0 ? void 0 : _g.forEach((val) => {
1062
1069
  const key = val.split('=')[0];
1063
1070
  const value = val.split('=')[1];
1064
1071
  params[key] = value;
1065
1072
  });
1066
1073
  const cl_source = params === null || params === void 0 ? void 0 : params.cl_source;
1067
- 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)}` : ''}`, {
1074
+ 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)}` : ''}`, {
1068
1075
  method: 'POST',
1069
1076
  body,
1070
1077
  type: 'beacon'