pb-sxp-ui 14.0.4 → 14.0.5
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 +50 -32
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +50 -32
- 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 +50 -32
- 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/components/Consent/index.js +8 -2
- package/es/core/context/SxpDataSourceProvider.js +9 -28
- package/es/core/utils/tool.d.ts +2 -1
- package/es/core/utils/tool.js +38 -14
- package/lib/core/components/Consent/index.js +8 -2
- package/lib/core/context/SxpDataSourceProvider.js +10 -29
- package/lib/core/utils/tool.d.ts +2 -1
- package/lib/core/utils/tool.js +39 -14
- package/package.json +1 -1
package/dist/index.js
CHANGED
@@ -135,6 +135,13 @@ const getSxpTokenInfo = (builder, dataId) => __awaiter(void 0, void 0, void 0, f
|
|
135
135
|
return tokenData;
|
136
136
|
});
|
137
137
|
|
138
|
+
/*
|
139
|
+
* @Author : haocanweng@chatlabs.cn
|
140
|
+
* @Date : 2023-08-21 16:58:40
|
141
|
+
* @LastEditors: binruan@chatlabs.com
|
142
|
+
* @LastEditTime: 2024-11-20 18:26:50
|
143
|
+
* @FilePath: \pb-sxp-ui\src\core\utils\tool.ts
|
144
|
+
*/
|
138
145
|
// 生成uuid
|
139
146
|
function uuid(len, radix) {
|
140
147
|
const chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split('');
|
@@ -189,8 +196,8 @@ const setFontForText = (textContent, style) => {
|
|
189
196
|
const cnStyle = `font-family:${cn !== null && cn !== void 0 ? cn : 'inherit'}`;
|
190
197
|
const enStyle = `font-family:${en !== null && en !== void 0 ? en : 'inherit'}`;
|
191
198
|
const fn = (str) => {
|
192
|
-
|
193
|
-
|
199
|
+
const chineseStartIndex = str.search(chineseRegex);
|
200
|
+
const englishStartIndex = str.search(englishRegex);
|
194
201
|
if (chineseStartIndex !== -1 && englishStartIndex !== -1 && chineseStartIndex < englishStartIndex) {
|
195
202
|
content += `<span style="${cnStyle}">${str.substring(chineseStartIndex, englishStartIndex)}</span>`;
|
196
203
|
text = str.substring(englishStartIndex, str === null || str === void 0 ? void 0 : str.length);
|
@@ -235,7 +242,7 @@ function getCookie(val) {
|
|
235
242
|
return value !== null && value !== void 0 ? value : '';
|
236
243
|
}
|
237
244
|
function getScreenReader() {
|
238
|
-
|
245
|
+
const userAgent = self.navigator.userAgent;
|
239
246
|
if (!userAgent)
|
240
247
|
return false;
|
241
248
|
return (/TalkBack/i.test(userAgent) ||
|
@@ -245,6 +252,30 @@ function getScreenReader() {
|
|
245
252
|
/JAWS/i.test(userAgent) ||
|
246
253
|
/ChromeVox/i.test(userAgent));
|
247
254
|
}
|
255
|
+
function splitUrlParams(urlParams) {
|
256
|
+
if (!urlParams)
|
257
|
+
return;
|
258
|
+
const indList = [];
|
259
|
+
for (let i = 0; i < urlParams.length; i++) {
|
260
|
+
const item = urlParams[i];
|
261
|
+
const curStr = urlParams.substring(i + 1, urlParams.length);
|
262
|
+
if (item === '&' &&
|
263
|
+
(curStr === null || curStr === void 0 ? void 0 : curStr.indexOf('=')) !== -1 &&
|
264
|
+
((curStr === null || curStr === void 0 ? void 0 : curStr.indexOf('=')) < (curStr === null || curStr === void 0 ? void 0 : curStr.indexOf('&')) || (curStr === null || curStr === void 0 ? void 0 : curStr.indexOf('&')) === -1)) {
|
265
|
+
indList.push(i);
|
266
|
+
}
|
267
|
+
}
|
268
|
+
const splitList = indList.length > 0 ? [] : [urlParams];
|
269
|
+
let lastIndex = 0;
|
270
|
+
indList === null || indList === void 0 ? void 0 : indList.map((i) => {
|
271
|
+
splitList === null || splitList === void 0 ? void 0 : splitList.push(urlParams.substring(lastIndex, i));
|
272
|
+
lastIndex = i + 1;
|
273
|
+
if (i === indList[indList.length - 1] && i < urlParams.length) {
|
274
|
+
splitList === null || splitList === void 0 ? void 0 : splitList.push(urlParams.substring(lastIndex, urlParams.length));
|
275
|
+
}
|
276
|
+
});
|
277
|
+
return splitList !== null && splitList !== void 0 ? splitList : [];
|
278
|
+
}
|
248
279
|
|
249
280
|
function unzip(b64Data) {
|
250
281
|
const strData = atob(b64Data);
|
@@ -498,15 +529,21 @@ var SXP_EVENT_TYPE;
|
|
498
529
|
* @Author: binruan@chatlabs.com
|
499
530
|
* @Date: 2024-06-13 15:16:53
|
500
531
|
* @LastEditors: binruan@chatlabs.com
|
501
|
-
* @LastEditTime:
|
532
|
+
* @LastEditTime: 2025-01-24 14:56:51
|
502
533
|
* @FilePath: \pb-sxp-ui\src\core\components\Consent\index.tsx
|
503
534
|
*
|
504
535
|
*/
|
505
536
|
const Consent$3 = ({ width = window.innerWidth, height = window.innerHeight, privacy_title, privacy_context, privacy_policy_url, privacy_policy_title }) => {
|
506
537
|
const { setIsAgreePolicy, bffEventReport } = useSxpDataSource();
|
507
538
|
const channelObj = useMemo(() => {
|
539
|
+
var _a;
|
508
540
|
const queryString = location.search.slice(1);
|
509
|
-
const params =
|
541
|
+
const params = {};
|
542
|
+
(_a = splitUrlParams(queryString.replace(/\+/g, '%2B'))) === null || _a === void 0 ? void 0 : _a.map((val) => {
|
543
|
+
const key = val.split('=')[0];
|
544
|
+
const value = val.split('=')[1];
|
545
|
+
params[key] = value;
|
546
|
+
});
|
510
547
|
for (const key in params) {
|
511
548
|
params[key] = params[key].replace(/%2B/g, '+');
|
512
549
|
}
|
@@ -681,30 +718,6 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
681
718
|
.then((res) => res.json())
|
682
719
|
.catch((err) => Promise.reject(err));
|
683
720
|
}, [bffDataSource]);
|
684
|
-
function splitUrlParams(urlParams) {
|
685
|
-
if (!urlParams)
|
686
|
-
return;
|
687
|
-
const indList = [];
|
688
|
-
for (let i = 0; i < urlParams.length; i++) {
|
689
|
-
const item = urlParams[i];
|
690
|
-
const curStr = urlParams.substring(i + 1, urlParams.length);
|
691
|
-
if (item === '&' &&
|
692
|
-
(curStr === null || curStr === void 0 ? void 0 : curStr.indexOf('=')) !== -1 &&
|
693
|
-
((curStr === null || curStr === void 0 ? void 0 : curStr.indexOf('=')) < (curStr === null || curStr === void 0 ? void 0 : curStr.indexOf('&')) || (curStr === null || curStr === void 0 ? void 0 : curStr.indexOf('&')) === -1)) {
|
694
|
-
indList.push(i);
|
695
|
-
}
|
696
|
-
}
|
697
|
-
const splitList = indList.length > 0 ? [] : [urlParams];
|
698
|
-
let lastIndex = 0;
|
699
|
-
indList === null || indList === void 0 ? void 0 : indList.map((i) => {
|
700
|
-
splitList === null || splitList === void 0 ? void 0 : splitList.push(urlParams.substring(lastIndex, i));
|
701
|
-
lastIndex = i + 1;
|
702
|
-
if (i === indList[indList.length - 1] && i < urlParams.length) {
|
703
|
-
splitList === null || splitList === void 0 ? void 0 : splitList.push(urlParams.substring(lastIndex, urlParams.length));
|
704
|
-
}
|
705
|
-
});
|
706
|
-
return splitList !== null && splitList !== void 0 ? splitList : [];
|
707
|
-
}
|
708
721
|
// 获取推荐视频数据
|
709
722
|
const getRecommendVideos = useCallback((query) => __awaiter(void 0, void 0, void 0, function* () {
|
710
723
|
var _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
@@ -966,9 +979,14 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
966
979
|
});
|
967
980
|
}, [bffEventReport, isFromHashtag]);
|
968
981
|
const h5EnterLink = useCallback(() => {
|
969
|
-
var _a, _b;
|
982
|
+
var _a, _b, _c;
|
970
983
|
const queryString = location.search.slice(1);
|
971
|
-
const params =
|
984
|
+
const params = {};
|
985
|
+
(_a = splitUrlParams(queryString.replace(/\+/g, '%2B'))) === null || _a === void 0 ? void 0 : _a.map((val) => {
|
986
|
+
const key = val.split('=')[0];
|
987
|
+
const value = val.split('=')[1];
|
988
|
+
params[key] = value;
|
989
|
+
});
|
972
990
|
for (const key in params) {
|
973
991
|
params[key] = params[key].replace(/%2B/g, '+');
|
974
992
|
}
|
@@ -986,7 +1004,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
986
1004
|
utmContent: getVal('utm_content'),
|
987
1005
|
enterTime: Math.floor(time / 1000) + '',
|
988
1006
|
requestId: null,
|
989
|
-
enterUrl: (
|
1007
|
+
enterUrl: (_c = (_b = window === null || window === void 0 ? void 0 : window.location) === null || _b === void 0 ? void 0 : _b.href) !== null && _c !== void 0 ? _c : '',
|
990
1008
|
clSource: getVal('cl_source')
|
991
1009
|
},
|
992
1010
|
reportLayId: false
|