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 CHANGED
@@ -157,6 +157,13 @@ const getSxpTokenInfo = (builder, dataId) => __awaiter(void 0, void 0, void 0, f
157
157
  return tokenData;
158
158
  });
159
159
 
160
+ /*
161
+ * @Author : haocanweng@chatlabs.cn
162
+ * @Date : 2023-08-21 16:58:40
163
+ * @LastEditors: binruan@chatlabs.com
164
+ * @LastEditTime: 2024-11-20 18:26:50
165
+ * @FilePath: \pb-sxp-ui\src\core\utils\tool.ts
166
+ */
160
167
  // 生成uuid
161
168
  function uuid(len, radix) {
162
169
  const chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split('');
@@ -211,8 +218,8 @@ const setFontForText = (textContent, style) => {
211
218
  const cnStyle = `font-family:${cn !== null && cn !== void 0 ? cn : 'inherit'}`;
212
219
  const enStyle = `font-family:${en !== null && en !== void 0 ? en : 'inherit'}`;
213
220
  const fn = (str) => {
214
- let chineseStartIndex = str.search(chineseRegex);
215
- let englishStartIndex = str.search(englishRegex);
221
+ const chineseStartIndex = str.search(chineseRegex);
222
+ const englishStartIndex = str.search(englishRegex);
216
223
  if (chineseStartIndex !== -1 && englishStartIndex !== -1 && chineseStartIndex < englishStartIndex) {
217
224
  content += `<span style="${cnStyle}">${str.substring(chineseStartIndex, englishStartIndex)}</span>`;
218
225
  text = str.substring(englishStartIndex, str === null || str === void 0 ? void 0 : str.length);
@@ -257,7 +264,7 @@ function getCookie(val) {
257
264
  return value !== null && value !== void 0 ? value : '';
258
265
  }
259
266
  function getScreenReader() {
260
- let userAgent = self.navigator.userAgent;
267
+ const userAgent = self.navigator.userAgent;
261
268
  if (!userAgent)
262
269
  return false;
263
270
  return (/TalkBack/i.test(userAgent) ||
@@ -267,6 +274,30 @@ function getScreenReader() {
267
274
  /JAWS/i.test(userAgent) ||
268
275
  /ChromeVox/i.test(userAgent));
269
276
  }
277
+ function splitUrlParams(urlParams) {
278
+ if (!urlParams)
279
+ return;
280
+ const indList = [];
281
+ for (let i = 0; i < urlParams.length; i++) {
282
+ const item = urlParams[i];
283
+ const curStr = urlParams.substring(i + 1, urlParams.length);
284
+ if (item === '&' &&
285
+ (curStr === null || curStr === void 0 ? void 0 : curStr.indexOf('=')) !== -1 &&
286
+ ((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)) {
287
+ indList.push(i);
288
+ }
289
+ }
290
+ const splitList = indList.length > 0 ? [] : [urlParams];
291
+ let lastIndex = 0;
292
+ indList === null || indList === void 0 ? void 0 : indList.map((i) => {
293
+ splitList === null || splitList === void 0 ? void 0 : splitList.push(urlParams.substring(lastIndex, i));
294
+ lastIndex = i + 1;
295
+ if (i === indList[indList.length - 1] && i < urlParams.length) {
296
+ splitList === null || splitList === void 0 ? void 0 : splitList.push(urlParams.substring(lastIndex, urlParams.length));
297
+ }
298
+ });
299
+ return splitList !== null && splitList !== void 0 ? splitList : [];
300
+ }
270
301
 
271
302
  function unzip(b64Data) {
272
303
  const strData = atob(b64Data);
@@ -520,15 +551,21 @@ var SXP_EVENT_TYPE;
520
551
  * @Author: binruan@chatlabs.com
521
552
  * @Date: 2024-06-13 15:16:53
522
553
  * @LastEditors: binruan@chatlabs.com
523
- * @LastEditTime: 2024-06-19 14:13:50
554
+ * @LastEditTime: 2025-01-24 14:56:51
524
555
  * @FilePath: \pb-sxp-ui\src\core\components\Consent\index.tsx
525
556
  *
526
557
  */
527
558
  const Consent$3 = ({ width = window.innerWidth, height = window.innerHeight, privacy_title, privacy_context, privacy_policy_url, privacy_policy_title }) => {
528
559
  const { setIsAgreePolicy, bffEventReport } = useSxpDataSource();
529
560
  const channelObj = React.useMemo(() => {
561
+ var _a;
530
562
  const queryString = location.search.slice(1);
531
- const params = qs.parse(queryString.replace(/\+/g, '%2B'));
563
+ const params = {};
564
+ (_a = splitUrlParams(queryString.replace(/\+/g, '%2B'))) === null || _a === void 0 ? void 0 : _a.map((val) => {
565
+ const key = val.split('=')[0];
566
+ const value = val.split('=')[1];
567
+ params[key] = value;
568
+ });
532
569
  for (const key in params) {
533
570
  params[key] = params[key].replace(/%2B/g, '+');
534
571
  }
@@ -703,30 +740,6 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
703
740
  .then((res) => res.json())
704
741
  .catch((err) => Promise.reject(err));
705
742
  }, [bffDataSource]);
706
- function splitUrlParams(urlParams) {
707
- if (!urlParams)
708
- return;
709
- const indList = [];
710
- for (let i = 0; i < urlParams.length; i++) {
711
- const item = urlParams[i];
712
- const curStr = urlParams.substring(i + 1, urlParams.length);
713
- if (item === '&' &&
714
- (curStr === null || curStr === void 0 ? void 0 : curStr.indexOf('=')) !== -1 &&
715
- ((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)) {
716
- indList.push(i);
717
- }
718
- }
719
- const splitList = indList.length > 0 ? [] : [urlParams];
720
- let lastIndex = 0;
721
- indList === null || indList === void 0 ? void 0 : indList.map((i) => {
722
- splitList === null || splitList === void 0 ? void 0 : splitList.push(urlParams.substring(lastIndex, i));
723
- lastIndex = i + 1;
724
- if (i === indList[indList.length - 1] && i < urlParams.length) {
725
- splitList === null || splitList === void 0 ? void 0 : splitList.push(urlParams.substring(lastIndex, urlParams.length));
726
- }
727
- });
728
- return splitList !== null && splitList !== void 0 ? splitList : [];
729
- }
730
743
  // 获取推荐视频数据
731
744
  const getRecommendVideos = React.useCallback((query) => __awaiter(void 0, void 0, void 0, function* () {
732
745
  var _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
@@ -988,9 +1001,14 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
988
1001
  });
989
1002
  }, [bffEventReport, isFromHashtag]);
990
1003
  const h5EnterLink = React.useCallback(() => {
991
- var _a, _b;
1004
+ var _a, _b, _c;
992
1005
  const queryString = location.search.slice(1);
993
- const params = qs.parse(queryString.replace(/\+/g, '%2B'));
1006
+ const params = {};
1007
+ (_a = splitUrlParams(queryString.replace(/\+/g, '%2B'))) === null || _a === void 0 ? void 0 : _a.map((val) => {
1008
+ const key = val.split('=')[0];
1009
+ const value = val.split('=')[1];
1010
+ params[key] = value;
1011
+ });
994
1012
  for (const key in params) {
995
1013
  params[key] = params[key].replace(/%2B/g, '+');
996
1014
  }
@@ -1008,7 +1026,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
1008
1026
  utmContent: getVal('utm_content'),
1009
1027
  enterTime: Math.floor(time / 1000) + '',
1010
1028
  requestId: null,
1011
- 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 : '',
1029
+ 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 : '',
1012
1030
  clSource: getVal('cl_source')
1013
1031
  },
1014
1032
  reportLayId: false