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/index.js
CHANGED
@@ -916,7 +916,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
916
916
|
external_id: fakeUserId,
|
917
917
|
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 : '',
|
918
918
|
fbc: fbclid ? `fb.2.${new Date().getTime()}.${fbclid}` : '',
|
919
|
-
fbp: getCookie('_fbp') ?
|
919
|
+
fbp: getCookie('_fbp') ? `${getCookie('_fbp')}` : '',
|
920
920
|
time: Math.floor(Date.now() / 1000)
|
921
921
|
};
|
922
922
|
const regex = /\{\{(.*?)\}\}/g;
|
@@ -968,18 +968,12 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
968
968
|
return jsonParams;
|
969
969
|
}, [fakeUserId]);
|
970
970
|
const bffFbReport = useCallback(({ eventName, product }) => {
|
971
|
-
var _a, _b, _c, _d
|
971
|
+
var _a, _b, _c, _d;
|
972
972
|
if (!enableReportEvent || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview)) {
|
973
973
|
return;
|
974
974
|
}
|
975
|
-
|
976
|
-
|
977
|
-
page_location: (_a = window === null || window === void 0 ? void 0 : window.location) === null || _a === void 0 ? void 0 : _a.href,
|
978
|
-
page_title: document === null || document === void 0 ? void 0 : document.title
|
979
|
-
});
|
980
|
-
}
|
981
|
-
const pixelEventParamsJson = (_b = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.pixel) === null || _b === void 0 ? void 0 : _b[eventName];
|
982
|
-
if (pixelEventParamsJson && typeof (window === null || window === void 0 ? void 0 : window.fbq) === 'function') {
|
975
|
+
const pixelEventParamsJson = (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.pixel) === null || _a === void 0 ? void 0 : _a[eventName];
|
976
|
+
if ((pixelEventParamsJson === null || pixelEventParamsJson === void 0 ? void 0 : pixelEventParamsJson.event_name) && typeof (window === null || window === void 0 ? void 0 : window.fbq) === 'function') {
|
983
977
|
function updateQueryStringParameter(uri, key, value) {
|
984
978
|
const re = new RegExp('([?&])' + key + '=.*?(&|$)', 'i');
|
985
979
|
const separator = uri.indexOf('?') !== -1 ? '&' : '?';
|
@@ -990,24 +984,29 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
990
984
|
return uri + separator + key + '=' + value;
|
991
985
|
}
|
992
986
|
}
|
993
|
-
|
994
|
-
|
995
|
-
|
987
|
+
if (eventName === 'PageView') {
|
988
|
+
const currentUrl = window.location.href;
|
989
|
+
const newUrl = updateQueryStringParameter(currentUrl, 'timestamp', Date.now());
|
990
|
+
history.pushState({ path: newUrl }, '', newUrl);
|
991
|
+
}
|
996
992
|
const body = getEventParamsByJson(pixelEventParamsJson);
|
997
|
-
window === null || window === void 0 ? void 0 : window.fbq('track',
|
993
|
+
window === null || window === void 0 ? void 0 : window.fbq('track', pixelEventParamsJson === null || pixelEventParamsJson === void 0 ? void 0 : pixelEventParamsJson.event_name, body);
|
994
|
+
}
|
995
|
+
else if (eventName === 'PageView' && typeof (window === null || window === void 0 ? void 0 : window.gtag) === 'function') {
|
996
|
+
window === null || window === void 0 ? void 0 : window.gtag('event', 'page_view');
|
998
997
|
}
|
999
|
-
const converApiEventParamsJson = (
|
998
|
+
const converApiEventParamsJson = (_b = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.converApi) === null || _b === void 0 ? void 0 : _b[eventName];
|
1000
999
|
if (enabledMetaConversionApi && converApiEventParamsJson) {
|
1001
1000
|
const body = getEventParamsByJson(converApiEventParamsJson, product);
|
1002
1001
|
const params = {};
|
1003
1002
|
const queryString = location.search.slice(1);
|
1004
|
-
(
|
1003
|
+
(_c = splitUrlParams(queryString)) === null || _c === void 0 ? void 0 : _c.forEach((val) => {
|
1005
1004
|
const key = val.split('=')[0];
|
1006
1005
|
const value = val.split('=')[1];
|
1007
1006
|
params[key] = value;
|
1008
1007
|
});
|
1009
1008
|
const cl_source = params === null || params === void 0 ? void 0 : params.cl_source;
|
1010
|
-
bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch(`v2/fb/${(
|
1009
|
+
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)}` : ''}`, {
|
1011
1010
|
method: 'POST',
|
1012
1011
|
body,
|
1013
1012
|
type: 'beacon'
|