pb-sxp-ui 1.15.16 → 1.15.18
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/pb-ui.js
CHANGED
@@ -931,7 +931,7 @@
|
|
931
931
|
external_id: fakeUserId,
|
932
932
|
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 : '',
|
933
933
|
fbc: fbclid ? `fb.2.${new Date().getTime()}.${fbclid}` : '',
|
934
|
-
fbp: getCookie('_fbp') ?
|
934
|
+
fbp: getCookie('_fbp') ? `${getCookie('_fbp')}` : '',
|
935
935
|
time: Math.floor(Date.now() / 1000)
|
936
936
|
};
|
937
937
|
const regex = /\{\{(.*?)\}\}/g;
|
@@ -983,18 +983,12 @@
|
|
983
983
|
return jsonParams;
|
984
984
|
}, [fakeUserId]);
|
985
985
|
const bffFbReport = React.useCallback(({ eventName, product }) => {
|
986
|
-
var _a, _b, _c, _d
|
986
|
+
var _a, _b, _c, _d;
|
987
987
|
if (!enableReportEvent || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview)) {
|
988
988
|
return;
|
989
989
|
}
|
990
|
-
|
991
|
-
|
992
|
-
page_location: (_a = window === null || window === void 0 ? void 0 : window.location) === null || _a === void 0 ? void 0 : _a.href,
|
993
|
-
page_title: document === null || document === void 0 ? void 0 : document.title
|
994
|
-
});
|
995
|
-
}
|
996
|
-
const pixelEventParamsJson = (_b = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.pixel) === null || _b === void 0 ? void 0 : _b[eventName];
|
997
|
-
if (pixelEventParamsJson && typeof (window === null || window === void 0 ? void 0 : window.fbq) === 'function') {
|
990
|
+
const pixelEventParamsJson = (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.pixel) === null || _a === void 0 ? void 0 : _a[eventName];
|
991
|
+
if ((pixelEventParamsJson === null || pixelEventParamsJson === void 0 ? void 0 : pixelEventParamsJson.event_name) && typeof (window === null || window === void 0 ? void 0 : window.fbq) === 'function') {
|
998
992
|
function updateQueryStringParameter(uri, key, value) {
|
999
993
|
const re = new RegExp('([?&])' + key + '=.*?(&|$)', 'i');
|
1000
994
|
const separator = uri.indexOf('?') !== -1 ? '&' : '?';
|
@@ -1005,24 +999,29 @@
|
|
1005
999
|
return uri + separator + key + '=' + value;
|
1006
1000
|
}
|
1007
1001
|
}
|
1008
|
-
|
1009
|
-
|
1010
|
-
|
1002
|
+
if (eventName === 'PageView') {
|
1003
|
+
const currentUrl = window.location.href;
|
1004
|
+
const newUrl = updateQueryStringParameter(currentUrl, 'timestamp', Date.now());
|
1005
|
+
history.pushState({ path: newUrl }, '', newUrl);
|
1006
|
+
}
|
1011
1007
|
const body = getEventParamsByJson(pixelEventParamsJson);
|
1012
|
-
window === null || window === void 0 ? void 0 : window.fbq('track',
|
1008
|
+
window === null || window === void 0 ? void 0 : window.fbq('track', pixelEventParamsJson === null || pixelEventParamsJson === void 0 ? void 0 : pixelEventParamsJson.event_name, body);
|
1009
|
+
}
|
1010
|
+
else if (eventName === 'PageView' && typeof (window === null || window === void 0 ? void 0 : window.gtag) === 'function') {
|
1011
|
+
window === null || window === void 0 ? void 0 : window.gtag('event', 'page_view');
|
1013
1012
|
}
|
1014
|
-
const converApiEventParamsJson = (
|
1013
|
+
const converApiEventParamsJson = (_b = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.converApi) === null || _b === void 0 ? void 0 : _b[eventName];
|
1015
1014
|
if (enabledMetaConversionApi && converApiEventParamsJson) {
|
1016
1015
|
const body = getEventParamsByJson(converApiEventParamsJson, product);
|
1017
1016
|
const params = {};
|
1018
1017
|
const queryString = location.search.slice(1);
|
1019
|
-
(
|
1018
|
+
(_c = splitUrlParams(queryString)) === null || _c === void 0 ? void 0 : _c.forEach((val) => {
|
1020
1019
|
const key = val.split('=')[0];
|
1021
1020
|
const value = val.split('=')[1];
|
1022
1021
|
params[key] = value;
|
1023
1022
|
});
|
1024
1023
|
const cl_source = params === null || params === void 0 ? void 0 : params.cl_source;
|
1025
|
-
bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch(`v2/fb/${(
|
1024
|
+
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)}` : ''}`, {
|
1026
1025
|
method: 'POST',
|
1027
1026
|
body,
|
1028
1027
|
type: 'beacon'
|