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/pb-ui.js CHANGED
@@ -150,6 +150,13 @@
150
150
  return tokenData;
151
151
  });
152
152
 
153
+ /*
154
+ * @Author : haocanweng@chatlabs.cn
155
+ * @Date : 2023-08-21 16:58:40
156
+ * @LastEditors: binruan@chatlabs.com
157
+ * @LastEditTime: 2024-11-20 18:26:50
158
+ * @FilePath: \pb-sxp-ui\src\core\utils\tool.ts
159
+ */
153
160
  // 生成uuid
154
161
  function uuid(len, radix) {
155
162
  const chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split('');
@@ -204,8 +211,8 @@
204
211
  const cnStyle = `font-family:${cn !== null && cn !== void 0 ? cn : 'inherit'}`;
205
212
  const enStyle = `font-family:${en !== null && en !== void 0 ? en : 'inherit'}`;
206
213
  const fn = (str) => {
207
- let chineseStartIndex = str.search(chineseRegex);
208
- let englishStartIndex = str.search(englishRegex);
214
+ const chineseStartIndex = str.search(chineseRegex);
215
+ const englishStartIndex = str.search(englishRegex);
209
216
  if (chineseStartIndex !== -1 && englishStartIndex !== -1 && chineseStartIndex < englishStartIndex) {
210
217
  content += `<span style="${cnStyle}">${str.substring(chineseStartIndex, englishStartIndex)}</span>`;
211
218
  text = str.substring(englishStartIndex, str === null || str === void 0 ? void 0 : str.length);
@@ -250,7 +257,7 @@
250
257
  return value !== null && value !== void 0 ? value : '';
251
258
  }
252
259
  function getScreenReader() {
253
- let userAgent = self.navigator.userAgent;
260
+ const userAgent = self.navigator.userAgent;
254
261
  if (!userAgent)
255
262
  return false;
256
263
  return (/TalkBack/i.test(userAgent) ||
@@ -260,6 +267,30 @@
260
267
  /JAWS/i.test(userAgent) ||
261
268
  /ChromeVox/i.test(userAgent));
262
269
  }
270
+ function splitUrlParams(urlParams) {
271
+ if (!urlParams)
272
+ return;
273
+ const indList = [];
274
+ for (let i = 0; i < urlParams.length; i++) {
275
+ const item = urlParams[i];
276
+ const curStr = urlParams.substring(i + 1, urlParams.length);
277
+ if (item === '&' &&
278
+ (curStr === null || curStr === void 0 ? void 0 : curStr.indexOf('=')) !== -1 &&
279
+ ((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)) {
280
+ indList.push(i);
281
+ }
282
+ }
283
+ const splitList = indList.length > 0 ? [] : [urlParams];
284
+ let lastIndex = 0;
285
+ indList === null || indList === void 0 ? void 0 : indList.map((i) => {
286
+ splitList === null || splitList === void 0 ? void 0 : splitList.push(urlParams.substring(lastIndex, i));
287
+ lastIndex = i + 1;
288
+ if (i === indList[indList.length - 1] && i < urlParams.length) {
289
+ splitList === null || splitList === void 0 ? void 0 : splitList.push(urlParams.substring(lastIndex, urlParams.length));
290
+ }
291
+ });
292
+ return splitList !== null && splitList !== void 0 ? splitList : [];
293
+ }
263
294
 
264
295
  function unzip(b64Data) {
265
296
  const strData = atob(b64Data);
@@ -513,15 +544,21 @@
513
544
  * @Author: binruan@chatlabs.com
514
545
  * @Date: 2024-06-13 15:16:53
515
546
  * @LastEditors: binruan@chatlabs.com
516
- * @LastEditTime: 2024-06-19 14:13:50
547
+ * @LastEditTime: 2025-01-24 14:56:51
517
548
  * @FilePath: \pb-sxp-ui\src\core\components\Consent\index.tsx
518
549
  *
519
550
  */
520
551
  const Consent$3 = ({ width = window.innerWidth, height = window.innerHeight, privacy_title, privacy_context, privacy_policy_url, privacy_policy_title }) => {
521
552
  const { setIsAgreePolicy, bffEventReport } = useSxpDataSource();
522
553
  const channelObj = React.useMemo(() => {
554
+ var _a;
523
555
  const queryString = location.search.slice(1);
524
- const params = qs.parse(queryString.replace(/\+/g, '%2B'));
556
+ const params = {};
557
+ (_a = splitUrlParams(queryString.replace(/\+/g, '%2B'))) === null || _a === void 0 ? void 0 : _a.map((val) => {
558
+ const key = val.split('=')[0];
559
+ const value = val.split('=')[1];
560
+ params[key] = value;
561
+ });
525
562
  for (const key in params) {
526
563
  params[key] = params[key].replace(/%2B/g, '+');
527
564
  }
@@ -696,30 +733,6 @@
696
733
  .then((res) => res.json())
697
734
  .catch((err) => Promise.reject(err));
698
735
  }, [bffDataSource]);
699
- function splitUrlParams(urlParams) {
700
- if (!urlParams)
701
- return;
702
- const indList = [];
703
- for (let i = 0; i < urlParams.length; i++) {
704
- const item = urlParams[i];
705
- const curStr = urlParams.substring(i + 1, urlParams.length);
706
- if (item === '&' &&
707
- (curStr === null || curStr === void 0 ? void 0 : curStr.indexOf('=')) !== -1 &&
708
- ((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)) {
709
- indList.push(i);
710
- }
711
- }
712
- const splitList = indList.length > 0 ? [] : [urlParams];
713
- let lastIndex = 0;
714
- indList === null || indList === void 0 ? void 0 : indList.map((i) => {
715
- splitList === null || splitList === void 0 ? void 0 : splitList.push(urlParams.substring(lastIndex, i));
716
- lastIndex = i + 1;
717
- if (i === indList[indList.length - 1] && i < urlParams.length) {
718
- splitList === null || splitList === void 0 ? void 0 : splitList.push(urlParams.substring(lastIndex, urlParams.length));
719
- }
720
- });
721
- return splitList !== null && splitList !== void 0 ? splitList : [];
722
- }
723
736
  // 获取推荐视频数据
724
737
  const getRecommendVideos = React.useCallback((query) => __awaiter(void 0, void 0, void 0, function* () {
725
738
  var _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
@@ -981,9 +994,14 @@
981
994
  });
982
995
  }, [bffEventReport, isFromHashtag]);
983
996
  const h5EnterLink = React.useCallback(() => {
984
- var _a, _b;
997
+ var _a, _b, _c;
985
998
  const queryString = location.search.slice(1);
986
- const params = qs.parse(queryString.replace(/\+/g, '%2B'));
999
+ const params = {};
1000
+ (_a = splitUrlParams(queryString.replace(/\+/g, '%2B'))) === null || _a === void 0 ? void 0 : _a.map((val) => {
1001
+ const key = val.split('=')[0];
1002
+ const value = val.split('=')[1];
1003
+ params[key] = value;
1004
+ });
987
1005
  for (const key in params) {
988
1006
  params[key] = params[key].replace(/%2B/g, '+');
989
1007
  }
@@ -1001,7 +1019,7 @@
1001
1019
  utmContent: getVal('utm_content'),
1002
1020
  enterTime: Math.floor(time / 1000) + '',
1003
1021
  requestId: null,
1004
- enterUrl: (_b = (_a = window === null || window === void 0 ? void 0 : window.location) === null || _a === void 0 ? void 0 : _a.href) !== null && _b !== void 0 ? _b : '',
1022
+ 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 : '',
1005
1023
  clSource: getVal('cl_source')
1006
1024
  },
1007
1025
  reportLayId: false