pb-sxp-ui 1.15.33 → 1.15.34
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 +5 -37
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +5 -37
- 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 +5 -37
- 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 +3 -31
- package/lib/core/context/SxpDataSourceProvider.js +3 -31
- package/package.json +1 -1
@@ -106,7 +106,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
106
106
|
return ((_a = bffDataSource === null || bffDataSource === void 0 ? void 0 : bffDataSource.headers) === null || _a === void 0 ? void 0 : _a['x-app-id']) + storeAndLoadFeUserId();
|
107
107
|
}, [bffDataSource]);
|
108
108
|
const bffFetch = useCallback((path, options) => {
|
109
|
-
var _a
|
109
|
+
var _a;
|
110
110
|
if (!bffDataSource)
|
111
111
|
return;
|
112
112
|
const url = bffDataSource.url;
|
@@ -114,7 +114,6 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
114
114
|
const queryString = qs.stringify(options.query);
|
115
115
|
path = `${path}?${queryString}`;
|
116
116
|
}
|
117
|
-
let isTikTokChannel = false;
|
118
117
|
const params = {};
|
119
118
|
const queryString = location.search.slice(1);
|
120
119
|
(_a = splitUrlParams(queryString)) === null || _a === void 0 ? void 0 : _a.forEach((val) => {
|
@@ -122,39 +121,12 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
122
121
|
const value = val.split('=')[1];
|
123
122
|
params[key] = value;
|
124
123
|
});
|
125
|
-
const cl_source = params === null || params === void 0 ? void 0 : params.cl_source;
|
126
|
-
if (cl_source &&
|
127
|
-
((_b = [
|
128
|
-
'40A-SPRK--DRESS_EYEWEAR-',
|
129
|
-
'41A-SPRK--MADRAGUE-',
|
130
|
-
'42A-SPRK--MOOD-',
|
131
|
-
'43A-SPRK--SUMMER-',
|
132
|
-
'44A-SPRK--DRESS_EYEWEAR-',
|
133
|
-
'45A-SPRK--MADRAGUE-',
|
134
|
-
'46A-SPRK--MOOD-',
|
135
|
-
'47A-SPRK--SUMMER-',
|
136
|
-
'48A-SPRK--DRESS_EYEWEAR-',
|
137
|
-
'49A-SPRK--MADRAGUE-',
|
138
|
-
'50A-SPRK--MOOD-',
|
139
|
-
'51A-SPRK--SUMMER-'
|
140
|
-
]) === null || _b === void 0 ? void 0 : _b.includes(cl_source))) {
|
141
|
-
isTikTokChannel = true;
|
142
|
-
}
|
143
|
-
if (options.type === 'beacon' && navigator.sendBeacon && !isTikTokChannel) {
|
144
|
-
return navigator.sendBeacon(`${url}/api/${path}`, new Blob([
|
145
|
-
JSON.stringify({
|
146
|
-
body: btoa(encodeURIComponent(JSON.stringify(Object.assign(Object.assign(Object.assign({}, options.body), bffDataSource.headers), { 'x-user-id': fakeUserId }))))
|
147
|
-
})
|
148
|
-
], {
|
149
|
-
type: 'application/json;charset=UTF-8'
|
150
|
-
}));
|
151
|
-
}
|
152
124
|
return window
|
153
|
-
.fetch(`${url}/api/${path}`, Object.assign({ headers: Object.assign({ 'Content-Type': 'application/json', 'x-user-id': fakeUserId }, bffDataSource.headers), method: options.method, body:
|
125
|
+
.fetch(`${url}/api/${path}`, Object.assign({ headers: Object.assign({ 'Content-Type': 'application/json', 'x-user-id': fakeUserId }, bffDataSource.headers), method: options.method, body: options.type === 'beacon'
|
154
126
|
? JSON.stringify({
|
155
127
|
body: btoa(encodeURIComponent(JSON.stringify(Object.assign(Object.assign(Object.assign({}, options.body), bffDataSource.headers), { 'x-user-id': fakeUserId }))))
|
156
128
|
})
|
157
|
-
: JSON.stringify(options.body) }, (
|
129
|
+
: JSON.stringify(options.body) }, (options.type === 'beacon' && { keepalive: true })))
|
158
130
|
.then((res) => res.json())
|
159
131
|
.catch((err) => Promise.reject(err));
|
160
132
|
}, [bffDataSource, fakeUserId]);
|
@@ -109,7 +109,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
109
109
|
return ((_a = bffDataSource === null || bffDataSource === void 0 ? void 0 : bffDataSource.headers) === null || _a === void 0 ? void 0 : _a['x-app-id']) + (0, localStore_1.storeAndLoadFeUserId)();
|
110
110
|
}, [bffDataSource]);
|
111
111
|
const bffFetch = (0, react_1.useCallback)((path, options) => {
|
112
|
-
var _a
|
112
|
+
var _a;
|
113
113
|
if (!bffDataSource)
|
114
114
|
return;
|
115
115
|
const url = bffDataSource.url;
|
@@ -117,7 +117,6 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
117
117
|
const queryString = qs_1.default.stringify(options.query);
|
118
118
|
path = `${path}?${queryString}`;
|
119
119
|
}
|
120
|
-
let isTikTokChannel = false;
|
121
120
|
const params = {};
|
122
121
|
const queryString = location.search.slice(1);
|
123
122
|
(_a = (0, tool_1.splitUrlParams)(queryString)) === null || _a === void 0 ? void 0 : _a.forEach((val) => {
|
@@ -125,39 +124,12 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
125
124
|
const value = val.split('=')[1];
|
126
125
|
params[key] = value;
|
127
126
|
});
|
128
|
-
const cl_source = params === null || params === void 0 ? void 0 : params.cl_source;
|
129
|
-
if (cl_source &&
|
130
|
-
((_b = [
|
131
|
-
'40A-SPRK--DRESS_EYEWEAR-',
|
132
|
-
'41A-SPRK--MADRAGUE-',
|
133
|
-
'42A-SPRK--MOOD-',
|
134
|
-
'43A-SPRK--SUMMER-',
|
135
|
-
'44A-SPRK--DRESS_EYEWEAR-',
|
136
|
-
'45A-SPRK--MADRAGUE-',
|
137
|
-
'46A-SPRK--MOOD-',
|
138
|
-
'47A-SPRK--SUMMER-',
|
139
|
-
'48A-SPRK--DRESS_EYEWEAR-',
|
140
|
-
'49A-SPRK--MADRAGUE-',
|
141
|
-
'50A-SPRK--MOOD-',
|
142
|
-
'51A-SPRK--SUMMER-'
|
143
|
-
]) === null || _b === void 0 ? void 0 : _b.includes(cl_source))) {
|
144
|
-
isTikTokChannel = true;
|
145
|
-
}
|
146
|
-
if (options.type === 'beacon' && navigator.sendBeacon && !isTikTokChannel) {
|
147
|
-
return navigator.sendBeacon(`${url}/api/${path}`, new Blob([
|
148
|
-
JSON.stringify({
|
149
|
-
body: btoa(encodeURIComponent(JSON.stringify(Object.assign(Object.assign(Object.assign({}, options.body), bffDataSource.headers), { 'x-user-id': fakeUserId }))))
|
150
|
-
})
|
151
|
-
], {
|
152
|
-
type: 'application/json;charset=UTF-8'
|
153
|
-
}));
|
154
|
-
}
|
155
127
|
return window
|
156
|
-
.fetch(`${url}/api/${path}`, Object.assign({ headers: Object.assign({ 'Content-Type': 'application/json', 'x-user-id': fakeUserId }, bffDataSource.headers), method: options.method, body:
|
128
|
+
.fetch(`${url}/api/${path}`, Object.assign({ headers: Object.assign({ 'Content-Type': 'application/json', 'x-user-id': fakeUserId }, bffDataSource.headers), method: options.method, body: options.type === 'beacon'
|
157
129
|
? JSON.stringify({
|
158
130
|
body: btoa(encodeURIComponent(JSON.stringify(Object.assign(Object.assign(Object.assign({}, options.body), bffDataSource.headers), { 'x-user-id': fakeUserId }))))
|
159
131
|
})
|
160
|
-
: JSON.stringify(options.body) }, (
|
132
|
+
: JSON.stringify(options.body) }, (options.type === 'beacon' && { keepalive: true })))
|
161
133
|
.then((res) => res.json())
|
162
134
|
.catch((err) => Promise.reject(err));
|
163
135
|
}, [bffDataSource, fakeUserId]);
|