pb-sxp-ui 1.15.16-alpha.1 → 1.15.16-alpha.2

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
@@ -929,26 +929,33 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
929
929
  bffDataSource
930
930
  ]);
931
931
  const bffFbReport = React.useCallback(({ eventName, product }) => {
932
- var _a, _b, _c, _d, _e, _f, _g;
932
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
933
933
  if (eventName === 'PageView' && typeof (window === null || window === void 0 ? void 0 : window.gtag) === 'function') {
934
934
  window === null || window === void 0 ? void 0 : window.gtag('event', 'page_view', {
935
- page_location: window.location.href,
936
- page_title: document.title
935
+ page_location: (_a = window === null || window === void 0 ? void 0 : window.location) === null || _a === void 0 ? void 0 : _a.href,
936
+ page_title: document === null || document === void 0 ? void 0 : document.title
937
+ });
938
+ }
939
+ if (eventName && typeof (window === null || window === void 0 ? void 0 : window.fbq) === 'function') {
940
+ window === null || window === void 0 ? void 0 : window.fbq('track', eventName, {
941
+ page_path: (_b = window === null || window === void 0 ? void 0 : window.location) === null || _b === void 0 ? void 0 : _b.pathname,
942
+ page_location: (_c = window === null || window === void 0 ? void 0 : window.location) === null || _c === void 0 ? void 0 : _c.href,
943
+ page_title: document === null || document === void 0 ? void 0 : document.title
937
944
  });
938
945
  }
939
946
  if (!enableReportEvent ||
940
947
  !enabledMetaConversionApi ||
941
948
  (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview) ||
942
- !((_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.converApi) === null || _a === void 0 ? void 0 : _a[eventName])) {
949
+ !((_d = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.converApi) === null || _d === void 0 ? void 0 : _d[eventName])) {
943
950
  return;
944
951
  }
945
- const jsonParams = lodash.cloneDeep((_b = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.converApi) === null || _b === void 0 ? void 0 : _b[eventName]);
952
+ const jsonParams = lodash.cloneDeep((_e = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.converApi) === null || _e === void 0 ? void 0 : _e[eventName]);
946
953
  const urlParams = new URLSearchParams(window.location.search);
947
954
  const fbclid = urlParams === null || urlParams === void 0 ? void 0 : urlParams.get('fbclid');
948
955
  const fix_par = {
949
- event_source_url: (_c = window === null || window === void 0 ? void 0 : window.location) === null || _c === void 0 ? void 0 : _c.href,
956
+ event_source_url: (_f = window === null || window === void 0 ? void 0 : window.location) === null || _f === void 0 ? void 0 : _f.href,
950
957
  external_id: fakeUserId,
951
- client_user_agent: (_e = (_d = window === null || window === void 0 ? void 0 : window.navigator) === null || _d === void 0 ? void 0 : _d.userAgent) !== null && _e !== void 0 ? _e : '',
958
+ client_user_agent: (_h = (_g = window === null || window === void 0 ? void 0 : window.navigator) === null || _g === void 0 ? void 0 : _g.userAgent) !== null && _h !== void 0 ? _h : '',
952
959
  fbc: fbclid ? `fb.2.${new Date().getTime()}.${fbclid}` : '',
953
960
  fbp: getCookie('_fbp') ? `fb.2.${new Date().getTime()}.${getCookie('_fbp')}` : '',
954
961
  time: Math.floor(Date.now() / 1000)
@@ -1001,13 +1008,13 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
1001
1008
  getEventParams(jsonParams);
1002
1009
  const params = {};
1003
1010
  const queryString = location.search.slice(1);
1004
- (_f = splitUrlParams(queryString)) === null || _f === void 0 ? void 0 : _f.map((val) => {
1011
+ (_j = splitUrlParams(queryString)) === null || _j === void 0 ? void 0 : _j.map((val) => {
1005
1012
  const key = val.split('=')[0];
1006
1013
  const value = val.split('=')[1];
1007
1014
  params[key] = value;
1008
1015
  });
1009
1016
  const cl_source = params === null || params === void 0 ? void 0 : params.cl_source;
1010
- return bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch(`v2/fb/${(_g = bffDataSource === null || bffDataSource === void 0 ? void 0 : bffDataSource.headers) === null || _g === void 0 ? void 0 : _g['x-app-id']}/${eventName}${cl_source ? `/${decodeURIComponent(cl_source)}` : ''}`, {
1017
+ return bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch(`v2/fb/${(_k = bffDataSource === null || bffDataSource === void 0 ? void 0 : bffDataSource.headers) === null || _k === void 0 ? void 0 : _k['x-app-id']}/${eventName}${cl_source ? `/${decodeURIComponent(cl_source)}` : ''}`, {
1011
1018
  method: 'POST',
1012
1019
  body: jsonParams,
1013
1020
  type: 'beacon'