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.js CHANGED
@@ -907,26 +907,33 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
907
907
  bffDataSource
908
908
  ]);
909
909
  const bffFbReport = useCallback(({ eventName, product }) => {
910
- var _a, _b, _c, _d, _e, _f, _g;
910
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
911
911
  if (eventName === 'PageView' && typeof (window === null || window === void 0 ? void 0 : window.gtag) === 'function') {
912
912
  window === null || window === void 0 ? void 0 : window.gtag('event', 'page_view', {
913
- page_location: window.location.href,
914
- page_title: document.title
913
+ page_location: (_a = window === null || window === void 0 ? void 0 : window.location) === null || _a === void 0 ? void 0 : _a.href,
914
+ page_title: document === null || document === void 0 ? void 0 : document.title
915
+ });
916
+ }
917
+ if (eventName && typeof (window === null || window === void 0 ? void 0 : window.fbq) === 'function') {
918
+ window === null || window === void 0 ? void 0 : window.fbq('track', eventName, {
919
+ page_path: (_b = window === null || window === void 0 ? void 0 : window.location) === null || _b === void 0 ? void 0 : _b.pathname,
920
+ page_location: (_c = window === null || window === void 0 ? void 0 : window.location) === null || _c === void 0 ? void 0 : _c.href,
921
+ page_title: document === null || document === void 0 ? void 0 : document.title
915
922
  });
916
923
  }
917
924
  if (!enableReportEvent ||
918
925
  !enabledMetaConversionApi ||
919
926
  (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview) ||
920
- !((_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.converApi) === null || _a === void 0 ? void 0 : _a[eventName])) {
927
+ !((_d = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.converApi) === null || _d === void 0 ? void 0 : _d[eventName])) {
921
928
  return;
922
929
  }
923
- const jsonParams = cloneDeep((_b = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.converApi) === null || _b === void 0 ? void 0 : _b[eventName]);
930
+ const jsonParams = cloneDeep((_e = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.converApi) === null || _e === void 0 ? void 0 : _e[eventName]);
924
931
  const urlParams = new URLSearchParams(window.location.search);
925
932
  const fbclid = urlParams === null || urlParams === void 0 ? void 0 : urlParams.get('fbclid');
926
933
  const fix_par = {
927
- event_source_url: (_c = window === null || window === void 0 ? void 0 : window.location) === null || _c === void 0 ? void 0 : _c.href,
934
+ event_source_url: (_f = window === null || window === void 0 ? void 0 : window.location) === null || _f === void 0 ? void 0 : _f.href,
928
935
  external_id: fakeUserId,
929
- 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 : '',
936
+ 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 : '',
930
937
  fbc: fbclid ? `fb.2.${new Date().getTime()}.${fbclid}` : '',
931
938
  fbp: getCookie('_fbp') ? `fb.2.${new Date().getTime()}.${getCookie('_fbp')}` : '',
932
939
  time: Math.floor(Date.now() / 1000)
@@ -979,13 +986,13 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
979
986
  getEventParams(jsonParams);
980
987
  const params = {};
981
988
  const queryString = location.search.slice(1);
982
- (_f = splitUrlParams(queryString)) === null || _f === void 0 ? void 0 : _f.map((val) => {
989
+ (_j = splitUrlParams(queryString)) === null || _j === void 0 ? void 0 : _j.map((val) => {
983
990
  const key = val.split('=')[0];
984
991
  const value = val.split('=')[1];
985
992
  params[key] = value;
986
993
  });
987
994
  const cl_source = params === null || params === void 0 ? void 0 : params.cl_source;
988
- 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)}` : ''}`, {
995
+ 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)}` : ''}`, {
989
996
  method: 'POST',
990
997
  body: jsonParams,
991
998
  type: 'beacon'