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/pb-ui.js CHANGED
@@ -922,26 +922,33 @@
922
922
  bffDataSource
923
923
  ]);
924
924
  const bffFbReport = React.useCallback(({ eventName, product }) => {
925
- var _a, _b, _c, _d, _e, _f, _g;
925
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
926
926
  if (eventName === 'PageView' && typeof (window === null || window === void 0 ? void 0 : window.gtag) === 'function') {
927
927
  window === null || window === void 0 ? void 0 : window.gtag('event', 'page_view', {
928
- page_location: window.location.href,
929
- page_title: document.title
928
+ page_location: (_a = window === null || window === void 0 ? void 0 : window.location) === null || _a === void 0 ? void 0 : _a.href,
929
+ page_title: document === null || document === void 0 ? void 0 : document.title
930
+ });
931
+ }
932
+ if (eventName && typeof (window === null || window === void 0 ? void 0 : window.fbq) === 'function') {
933
+ window === null || window === void 0 ? void 0 : window.fbq('track', eventName, {
934
+ page_path: (_b = window === null || window === void 0 ? void 0 : window.location) === null || _b === void 0 ? void 0 : _b.pathname,
935
+ page_location: (_c = window === null || window === void 0 ? void 0 : window.location) === null || _c === void 0 ? void 0 : _c.href,
936
+ page_title: document === null || document === void 0 ? void 0 : document.title
930
937
  });
931
938
  }
932
939
  if (!enableReportEvent ||
933
940
  !enabledMetaConversionApi ||
934
941
  (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview) ||
935
- !((_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.converApi) === null || _a === void 0 ? void 0 : _a[eventName])) {
942
+ !((_d = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.converApi) === null || _d === void 0 ? void 0 : _d[eventName])) {
936
943
  return;
937
944
  }
938
- const jsonParams = lodash.cloneDeep((_b = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.converApi) === null || _b === void 0 ? void 0 : _b[eventName]);
945
+ const jsonParams = lodash.cloneDeep((_e = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.converApi) === null || _e === void 0 ? void 0 : _e[eventName]);
939
946
  const urlParams = new URLSearchParams(window.location.search);
940
947
  const fbclid = urlParams === null || urlParams === void 0 ? void 0 : urlParams.get('fbclid');
941
948
  const fix_par = {
942
- event_source_url: (_c = window === null || window === void 0 ? void 0 : window.location) === null || _c === void 0 ? void 0 : _c.href,
949
+ event_source_url: (_f = window === null || window === void 0 ? void 0 : window.location) === null || _f === void 0 ? void 0 : _f.href,
943
950
  external_id: fakeUserId,
944
- 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 : '',
951
+ 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 : '',
945
952
  fbc: fbclid ? `fb.2.${new Date().getTime()}.${fbclid}` : '',
946
953
  fbp: getCookie('_fbp') ? `fb.2.${new Date().getTime()}.${getCookie('_fbp')}` : '',
947
954
  time: Math.floor(Date.now() / 1000)
@@ -994,13 +1001,13 @@
994
1001
  getEventParams(jsonParams);
995
1002
  const params = {};
996
1003
  const queryString = location.search.slice(1);
997
- (_f = splitUrlParams(queryString)) === null || _f === void 0 ? void 0 : _f.map((val) => {
1004
+ (_j = splitUrlParams(queryString)) === null || _j === void 0 ? void 0 : _j.map((val) => {
998
1005
  const key = val.split('=')[0];
999
1006
  const value = val.split('=')[1];
1000
1007
  params[key] = value;
1001
1008
  });
1002
1009
  const cl_source = params === null || params === void 0 ? void 0 : params.cl_source;
1003
- 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)}` : ''}`, {
1010
+ 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)}` : ''}`, {
1004
1011
  method: 'POST',
1005
1012
  body: jsonParams,
1006
1013
  type: 'beacon'