pb-sxp-ui 1.15.16 → 1.15.17
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 -17
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +16 -17
- 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 -17
- 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 -17
- package/lib/core/context/SxpDataSourceProvider.js +16 -17
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
@@ -938,7 +938,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
938
938
|
external_id: fakeUserId,
|
939
939
|
client_user_agent: (_c = (_b = window === null || window === void 0 ? void 0 : window.navigator) === null || _b === void 0 ? void 0 : _b.userAgent) !== null && _c !== void 0 ? _c : '',
|
940
940
|
fbc: fbclid ? `fb.2.${new Date().getTime()}.${fbclid}` : '',
|
941
|
-
fbp: getCookie('_fbp') ?
|
941
|
+
fbp: getCookie('_fbp') ? `${getCookie('_fbp')}` : '',
|
942
942
|
time: Math.floor(Date.now() / 1000)
|
943
943
|
};
|
944
944
|
const regex = /\{\{(.*?)\}\}/g;
|
@@ -990,18 +990,12 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
990
990
|
return jsonParams;
|
991
991
|
}, [fakeUserId]);
|
992
992
|
const bffFbReport = React.useCallback(({ eventName, product }) => {
|
993
|
-
var _a, _b, _c, _d
|
993
|
+
var _a, _b, _c, _d;
|
994
994
|
if (!enableReportEvent || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview)) {
|
995
995
|
return;
|
996
996
|
}
|
997
|
-
|
998
|
-
|
999
|
-
page_location: (_a = window === null || window === void 0 ? void 0 : window.location) === null || _a === void 0 ? void 0 : _a.href,
|
1000
|
-
page_title: document === null || document === void 0 ? void 0 : document.title
|
1001
|
-
});
|
1002
|
-
}
|
1003
|
-
const pixelEventParamsJson = (_b = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.pixel) === null || _b === void 0 ? void 0 : _b[eventName];
|
1004
|
-
if (pixelEventParamsJson && typeof (window === null || window === void 0 ? void 0 : window.fbq) === 'function') {
|
997
|
+
const pixelEventParamsJson = (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.pixel) === null || _a === void 0 ? void 0 : _a[eventName];
|
998
|
+
if ((pixelEventParamsJson === null || pixelEventParamsJson === void 0 ? void 0 : pixelEventParamsJson.event_name) && typeof (window === null || window === void 0 ? void 0 : window.fbq) === 'function') {
|
1005
999
|
function updateQueryStringParameter(uri, key, value) {
|
1006
1000
|
const re = new RegExp('([?&])' + key + '=.*?(&|$)', 'i');
|
1007
1001
|
const separator = uri.indexOf('?') !== -1 ? '&' : '?';
|
@@ -1012,24 +1006,29 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
1012
1006
|
return uri + separator + key + '=' + value;
|
1013
1007
|
}
|
1014
1008
|
}
|
1015
|
-
|
1016
|
-
|
1017
|
-
|
1009
|
+
if ((pixelEventParamsJson === null || pixelEventParamsJson === void 0 ? void 0 : pixelEventParamsJson.event_name) === 'PageView') {
|
1010
|
+
const currentUrl = window.location.href;
|
1011
|
+
const newUrl = updateQueryStringParameter(currentUrl, 'timestamp', Date.now());
|
1012
|
+
history.pushState({ path: newUrl }, '', newUrl);
|
1013
|
+
}
|
1018
1014
|
const body = getEventParamsByJson(pixelEventParamsJson);
|
1019
|
-
window === null || window === void 0 ? void 0 : window.fbq('track',
|
1015
|
+
window === null || window === void 0 ? void 0 : window.fbq('track', pixelEventParamsJson === null || pixelEventParamsJson === void 0 ? void 0 : pixelEventParamsJson.event_name, body);
|
1016
|
+
}
|
1017
|
+
else if (eventName === 'PageView' && typeof (window === null || window === void 0 ? void 0 : window.gtag) === 'function') {
|
1018
|
+
window === null || window === void 0 ? void 0 : window.gtag('event', 'page_view');
|
1020
1019
|
}
|
1021
|
-
const converApiEventParamsJson = (
|
1020
|
+
const converApiEventParamsJson = (_b = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.converApi) === null || _b === void 0 ? void 0 : _b[eventName];
|
1022
1021
|
if (enabledMetaConversionApi && converApiEventParamsJson) {
|
1023
1022
|
const body = getEventParamsByJson(converApiEventParamsJson, product);
|
1024
1023
|
const params = {};
|
1025
1024
|
const queryString = location.search.slice(1);
|
1026
|
-
(
|
1025
|
+
(_c = splitUrlParams(queryString)) === null || _c === void 0 ? void 0 : _c.forEach((val) => {
|
1027
1026
|
const key = val.split('=')[0];
|
1028
1027
|
const value = val.split('=')[1];
|
1029
1028
|
params[key] = value;
|
1030
1029
|
});
|
1031
1030
|
const cl_source = params === null || params === void 0 ? void 0 : params.cl_source;
|
1032
|
-
bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch(`v2/fb/${(
|
1031
|
+
bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch(`v2/fb/${(_d = bffDataSource === null || bffDataSource === void 0 ? void 0 : bffDataSource.headers) === null || _d === void 0 ? void 0 : _d['x-app-id']}/${eventName}${cl_source ? `/${decodeURIComponent(cl_source)}` : ''}`, {
|
1033
1032
|
method: 'POST',
|
1034
1033
|
body,
|
1035
1034
|
type: 'beacon'
|