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 +16 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +16 -9
- package/dist/index.js.map +1 -1
- package/dist/index.min.cjs +4 -4
- package/dist/index.min.cjs.map +1 -1
- package/dist/index.min.js +4 -4
- package/dist/index.min.js.map +1 -1
- package/dist/pb-ui.js +16 -9
- package/dist/pb-ui.js.map +1 -1
- package/dist/pb-ui.min.js +4 -4
- package/dist/pb-ui.min.js.map +1 -1
- package/es/core/context/SxpDataSourceProvider.js +16 -9
- package/lib/core/context/SxpDataSourceProvider.js +16 -9
- package/package.json +1 -1
@@ -289,26 +289,33 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
289
289
|
bffDataSource
|
290
290
|
]);
|
291
291
|
const bffFbReport = useCallback(({ eventName, product }) => {
|
292
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
292
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
293
293
|
if (eventName === 'PageView' && typeof (window === null || window === void 0 ? void 0 : window.gtag) === 'function') {
|
294
294
|
window === null || window === void 0 ? void 0 : window.gtag('event', 'page_view', {
|
295
|
-
page_location: window.location.href,
|
296
|
-
page_title: document.title
|
295
|
+
page_location: (_a = window === null || window === void 0 ? void 0 : window.location) === null || _a === void 0 ? void 0 : _a.href,
|
296
|
+
page_title: document === null || document === void 0 ? void 0 : document.title
|
297
|
+
});
|
298
|
+
}
|
299
|
+
if (eventName && typeof (window === null || window === void 0 ? void 0 : window.fbq) === 'function') {
|
300
|
+
window === null || window === void 0 ? void 0 : window.fbq('track', eventName, {
|
301
|
+
page_path: (_b = window === null || window === void 0 ? void 0 : window.location) === null || _b === void 0 ? void 0 : _b.pathname,
|
302
|
+
page_location: (_c = window === null || window === void 0 ? void 0 : window.location) === null || _c === void 0 ? void 0 : _c.href,
|
303
|
+
page_title: document === null || document === void 0 ? void 0 : document.title
|
297
304
|
});
|
298
305
|
}
|
299
306
|
if (!enableReportEvent ||
|
300
307
|
!enabledMetaConversionApi ||
|
301
308
|
(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview) ||
|
302
|
-
!((
|
309
|
+
!((_d = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.converApi) === null || _d === void 0 ? void 0 : _d[eventName])) {
|
303
310
|
return;
|
304
311
|
}
|
305
|
-
const jsonParams = cloneDeep((
|
312
|
+
const jsonParams = cloneDeep((_e = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.converApi) === null || _e === void 0 ? void 0 : _e[eventName]);
|
306
313
|
const urlParams = new URLSearchParams(window.location.search);
|
307
314
|
const fbclid = urlParams === null || urlParams === void 0 ? void 0 : urlParams.get('fbclid');
|
308
315
|
const fix_par = {
|
309
|
-
event_source_url: (
|
316
|
+
event_source_url: (_f = window === null || window === void 0 ? void 0 : window.location) === null || _f === void 0 ? void 0 : _f.href,
|
310
317
|
external_id: fakeUserId,
|
311
|
-
client_user_agent: (
|
318
|
+
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 : '',
|
312
319
|
fbc: fbclid ? `fb.2.${new Date().getTime()}.${fbclid}` : '',
|
313
320
|
fbp: getCookie('_fbp') ? `fb.2.${new Date().getTime()}.${getCookie('_fbp')}` : '',
|
314
321
|
time: Math.floor(Date.now() / 1000)
|
@@ -361,13 +368,13 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
361
368
|
getEventParams(jsonParams);
|
362
369
|
const params = {};
|
363
370
|
const queryString = location.search.slice(1);
|
364
|
-
(
|
371
|
+
(_j = splitUrlParams(queryString)) === null || _j === void 0 ? void 0 : _j.map((val) => {
|
365
372
|
const key = val.split('=')[0];
|
366
373
|
const value = val.split('=')[1];
|
367
374
|
params[key] = value;
|
368
375
|
});
|
369
376
|
const cl_source = params === null || params === void 0 ? void 0 : params.cl_source;
|
370
|
-
return bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch(`v2/fb/${(
|
377
|
+
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)}` : ''}`, {
|
371
378
|
method: 'POST',
|
372
379
|
body: jsonParams,
|
373
380
|
type: 'beacon'
|
@@ -292,26 +292,33 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
292
292
|
bffDataSource
|
293
293
|
]);
|
294
294
|
const bffFbReport = (0, react_1.useCallback)(({ eventName, product }) => {
|
295
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
295
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
296
296
|
if (eventName === 'PageView' && typeof (window === null || window === void 0 ? void 0 : window.gtag) === 'function') {
|
297
297
|
window === null || window === void 0 ? void 0 : window.gtag('event', 'page_view', {
|
298
|
-
page_location: window.location.href,
|
299
|
-
page_title: document.title
|
298
|
+
page_location: (_a = window === null || window === void 0 ? void 0 : window.location) === null || _a === void 0 ? void 0 : _a.href,
|
299
|
+
page_title: document === null || document === void 0 ? void 0 : document.title
|
300
|
+
});
|
301
|
+
}
|
302
|
+
if (eventName && typeof (window === null || window === void 0 ? void 0 : window.fbq) === 'function') {
|
303
|
+
window === null || window === void 0 ? void 0 : window.fbq('track', eventName, {
|
304
|
+
page_path: (_b = window === null || window === void 0 ? void 0 : window.location) === null || _b === void 0 ? void 0 : _b.pathname,
|
305
|
+
page_location: (_c = window === null || window === void 0 ? void 0 : window.location) === null || _c === void 0 ? void 0 : _c.href,
|
306
|
+
page_title: document === null || document === void 0 ? void 0 : document.title
|
300
307
|
});
|
301
308
|
}
|
302
309
|
if (!enableReportEvent ||
|
303
310
|
!enabledMetaConversionApi ||
|
304
311
|
(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview) ||
|
305
|
-
!((
|
312
|
+
!((_d = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.converApi) === null || _d === void 0 ? void 0 : _d[eventName])) {
|
306
313
|
return;
|
307
314
|
}
|
308
|
-
const jsonParams = (0, lodash_1.cloneDeep)((
|
315
|
+
const jsonParams = (0, lodash_1.cloneDeep)((_e = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.converApi) === null || _e === void 0 ? void 0 : _e[eventName]);
|
309
316
|
const urlParams = new URLSearchParams(window.location.search);
|
310
317
|
const fbclid = urlParams === null || urlParams === void 0 ? void 0 : urlParams.get('fbclid');
|
311
318
|
const fix_par = {
|
312
|
-
event_source_url: (
|
319
|
+
event_source_url: (_f = window === null || window === void 0 ? void 0 : window.location) === null || _f === void 0 ? void 0 : _f.href,
|
313
320
|
external_id: fakeUserId,
|
314
|
-
client_user_agent: (
|
321
|
+
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 : '',
|
315
322
|
fbc: fbclid ? `fb.2.${new Date().getTime()}.${fbclid}` : '',
|
316
323
|
fbp: (0, tool_1.getCookie)('_fbp') ? `fb.2.${new Date().getTime()}.${(0, tool_1.getCookie)('_fbp')}` : '',
|
317
324
|
time: Math.floor(Date.now() / 1000)
|
@@ -364,13 +371,13 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
364
371
|
getEventParams(jsonParams);
|
365
372
|
const params = {};
|
366
373
|
const queryString = location.search.slice(1);
|
367
|
-
(
|
374
|
+
(_j = (0, tool_1.splitUrlParams)(queryString)) === null || _j === void 0 ? void 0 : _j.map((val) => {
|
368
375
|
const key = val.split('=')[0];
|
369
376
|
const value = val.split('=')[1];
|
370
377
|
params[key] = value;
|
371
378
|
});
|
372
379
|
const cl_source = params === null || params === void 0 ? void 0 : params.cl_source;
|
373
|
-
return bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch(`v2/fb/${(
|
380
|
+
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)}` : ''}`, {
|
374
381
|
method: 'POST',
|
375
382
|
body: jsonParams,
|
376
383
|
type: 'beacon'
|