pb-sxp-ui 1.14.1 → 1.15.1

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.
Files changed (34) hide show
  1. package/dist/index.cjs +66 -24
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.css +13 -0
  4. package/dist/index.js +66 -24
  5. package/dist/index.js.map +1 -1
  6. package/dist/index.min.cjs +5 -5
  7. package/dist/index.min.cjs.map +1 -1
  8. package/dist/index.min.js +5 -5
  9. package/dist/index.min.js.map +1 -1
  10. package/dist/pb-ui.js +66 -24
  11. package/dist/pb-ui.js.map +1 -1
  12. package/dist/pb-ui.min.js +5 -5
  13. package/dist/pb-ui.min.js.map +1 -1
  14. package/es/core/components/Consent/index.js +8 -2
  15. package/es/core/components/SxpPageRender/WaterFall/List.js +3 -3
  16. package/es/core/components/SxpPageRender/WaterFall/index.js +2 -2
  17. package/es/core/context/SxpDataSourceProvider.js +13 -8
  18. package/es/core/utils/tool.d.ts +2 -1
  19. package/es/core/utils/tool.js +38 -14
  20. package/es/materials/sxp/HashTag/index.d.ts +4 -1
  21. package/es/materials/sxp/HashTag/material.js +2 -1
  22. package/es/materials/sxp/HashTag/settingRender.d.ts +0 -2
  23. package/es/materials/sxp/HashTag/settingRender.js +2 -3
  24. package/lib/core/components/Consent/index.js +8 -2
  25. package/lib/core/components/SxpPageRender/WaterFall/List.js +3 -3
  26. package/lib/core/components/SxpPageRender/WaterFall/index.js +2 -2
  27. package/lib/core/context/SxpDataSourceProvider.js +12 -7
  28. package/lib/core/utils/tool.d.ts +2 -1
  29. package/lib/core/utils/tool.js +39 -14
  30. package/lib/materials/sxp/HashTag/index.d.ts +4 -1
  31. package/lib/materials/sxp/HashTag/material.js +2 -1
  32. package/lib/materials/sxp/HashTag/settingRender.d.ts +0 -2
  33. package/lib/materials/sxp/HashTag/settingRender.js +2 -3
  34. package/package.json +1 -1
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
  }
@@ -720,7 +757,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
720
757
  query = Object.assign(Object.assign({}, query), { channel: decodeURIComponent(channel) });
721
758
  }
722
759
  else if (utmVal) {
723
- const val = (_k = (_j = (_h = utmVal === null || utmVal === void 0 ? void 0 : utmVal.split('&')) === null || _h === void 0 ? void 0 : _h.filter((val) => {
760
+ const val = (_k = (_j = (_h = splitUrlParams(utmVal)) === null || _h === void 0 ? void 0 : _h.filter((val) => {
724
761
  var _a, _b;
725
762
  const key = val.split('=')[0];
726
763
  return (_b = ((_a = utmParameter === null || utmParameter === void 0 ? void 0 : utmParameter.channels) !== null && _a !== void 0 ? _a : [])) === null || _b === void 0 ? void 0 : _b.includes(key);
@@ -847,7 +884,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
847
884
  !((_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.converApi) === null || _a === void 0 ? void 0 : _a[eventName])) {
848
885
  return;
849
886
  }
850
- let jsonParams = lodash.cloneDeep((_b = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.converApi) === null || _b === void 0 ? void 0 : _b[eventName]);
887
+ const jsonParams = lodash.cloneDeep((_b = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.converApi) === null || _b === void 0 ? void 0 : _b[eventName]);
851
888
  const urlParams = new URLSearchParams(window.location.search);
852
889
  const fbclid = urlParams === null || urlParams === void 0 ? void 0 : urlParams.get('fbclid');
853
890
  const fix_par = {
@@ -929,7 +966,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
929
966
  if (!utmVal || !isShowTag)
930
967
  return;
931
968
  try {
932
- const val = (_10 = (_9 = (_8 = utmVal === null || utmVal === void 0 ? void 0 : utmVal.split('&')) === null || _8 === void 0 ? void 0 : _8.filter((val) => {
969
+ const val = (_10 = (_9 = (_8 = splitUrlParams(utmVal)) === null || _8 === void 0 ? void 0 : _8.filter((val) => {
933
970
  var _a, _b;
934
971
  const key = val.split('=')[0];
935
972
  return (_b = ((_a = utmParameter === null || utmParameter === void 0 ? void 0 : utmParameter.channels) !== null && _a !== void 0 ? _a : [])) === null || _b === void 0 ? void 0 : _b.includes(key);
@@ -964,9 +1001,14 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
964
1001
  });
965
1002
  }, [bffEventReport, isFromHashtag]);
966
1003
  const h5EnterLink = React.useCallback(() => {
967
- var _a, _b;
1004
+ var _a, _b, _c;
968
1005
  const queryString = location.search.slice(1);
969
- 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
+ });
970
1012
  for (const key in params) {
971
1013
  params[key] = params[key].replace(/%2B/g, '+');
972
1014
  }
@@ -984,7 +1026,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
984
1026
  utmContent: getVal('utm_content'),
985
1027
  enterTime: Math.floor(time / 1000) + '',
986
1028
  requestId: null,
987
- 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 : '',
988
1030
  clSource: getVal('cl_source')
989
1031
  },
990
1032
  reportLayId: false
@@ -13277,7 +13319,7 @@ const MultiCommodityDiroNew = createMaterial(MultiCommodityDiroNewComponent, {
13277
13319
  * @Author: binruan@chatlabs.com
13278
13320
  * @Date: 2024-04-07 14:07:12
13279
13321
  * @LastEditors: binruan@chatlabs.com
13280
- * @LastEditTime: 2024-08-22 10:14:36
13322
+ * @LastEditTime: 2025-02-17 17:16:56
13281
13323
  * @FilePath: \pb-sxp-ui\src\materials\sxp\HashTag\settingRender.tsx
13282
13324
  *
13283
13325
  */
@@ -13302,10 +13344,9 @@ var settingRender$5 = [
13302
13344
  addonAfter: 'px'
13303
13345
  },
13304
13346
  {
13305
- type: 'Switch',
13347
+ type: 'HashTagFixedSize',
13306
13348
  label: '固定宽高',
13307
- name: ['props', 'openFixedSize'],
13308
- initialValue: true
13349
+ name: ['props', 'openFixedSize']
13309
13350
  }
13310
13351
  ]
13311
13352
  },
@@ -15113,7 +15154,7 @@ var img$4 = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeA
15113
15154
 
15114
15155
  const WaterfallFlowItem = (props) => {
15115
15156
  var _a;
15116
- const { rec, index, list, reportTagsView, textStyles, space } = props;
15157
+ const { rec, index, list, reportTagsView, textStyles, space, openFixedSize } = props;
15117
15158
  const { swiperRef, setRtcList, setOpenHashtag, sxpParameter, globalConfig } = useSxpDataSource();
15118
15159
  const [showVideo, setShowVideo] = React.useState(false);
15119
15160
  const imgDom = React.useRef(null);
@@ -15222,11 +15263,11 @@ const WaterfallFlowItem = (props) => {
15222
15263
  }, 0);
15223
15264
  };
15224
15265
  return (React.createElement("div", { ref: ref, className: 'list-content-listItem', key: index, onClick: handleClickToDetail, style: { marginBottom: space } },
15225
- React.createElement("div", { className: 'list-content-listItem-picture' },
15266
+ React.createElement("div", { className: (openFixedSize === null || openFixedSize === void 0 ? void 0 : openFixedSize.ratio) === '1' ? 'list-content-listItem-picture' : 'list-content-listItem-picture1609' },
15226
15267
  showVideo && (React.createElement("div", { style: { display: 'none' } },
15227
15268
  React.createElement("video", { ref: videoDom, crossOrigin: 'anonymous', className: 'list-content-listItem-picture-img' }),
15228
15269
  React.createElement("canvas", { ref: canvasRef }))),
15229
- React.createElement(FormatImage$1, { loading: 'lazy', className: 'list-content-listItem-picture-img', ref: imgDom })),
15270
+ React.createElement(FormatImage$1, { loading: 'lazy', className: (openFixedSize === null || openFixedSize === void 0 ? void 0 : openFixedSize.ratio) === '1' ? 'list-content-listItem-picture-img' : 'list-content-listItem-picture1609-img', ref: imgDom })),
15230
15271
  React.createElement("div", { className: 'list-content-listItem-info' },
15231
15272
  React.createElement("div", { className: `${'list-content-listItem-info-title'} ${priceText ? 'list-content-listItem-info-nowrap' : ''}`, style: textStyles === null || textStyles === void 0 ? void 0 : textStyles.title, dangerouslySetInnerHTML: {
15232
15273
  __html: setFontForText(title, textStyles === null || textStyles === void 0 ? void 0 : textStyles.title)
@@ -15337,12 +15378,12 @@ function WaterfallList(_a) {
15337
15378
  * @Author: binruan@chatlabs.com
15338
15379
  * @Date: 2024-01-10 10:58:24
15339
15380
  * @LastEditors: binruan@chatlabs.com
15340
- * @LastEditTime: 2024-12-09 11:18:32
15381
+ * @LastEditTime: 2025-02-17 16:25:30
15341
15382
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\WaterFall\index.tsx
15342
15383
  *
15343
15384
  */
15344
15385
  const WaterFall = (props) => {
15345
- var _a;
15386
+ var _a, _b;
15346
15387
  const { waterFallData, setOpenHashtag, openHashtag, swiperRef, setWaterFallData, cacheRtcList, setRtcList, cacheActiveIndex, rtcList, setCacheRtcList, setIsFromHashtag, isFromHashtag, bffEventReport, themeTag, selectTag, bffFbReport } = useSxpDataSource();
15347
15388
  const { backMainFeed } = useEventReport();
15348
15389
  const modalEleRef = React.useRef(null);
@@ -15431,7 +15472,7 @@ const WaterFall = (props) => {
15431
15472
  display: openHashtag ? 'block' : 'none'
15432
15473
  } },
15433
15474
  React.createElement(Navbar$1, { icon: img$4, styles: { top: '32px' }, textStyle: (_a = props === null || props === void 0 ? void 0 : props.textStyles) === null || _a === void 0 ? void 0 : _a.hashTagTitle, onClose: handleClose }),
15434
- (props === null || props === void 0 ? void 0 : props.openFixedSize) === true || (props === null || props === void 0 ? void 0 : props.openFixedSize) === undefined ? (React.createElement(WaterfallList, Object.assign({ key: waterFallData, reportTagsView: reportTagsView }, props))) : (React.createElement(WaterfallList$1, Object.assign({ key: waterFallData, reportTagsView: reportTagsView }, props)))), modalEleRef.current);
15475
+ ((_b = props === null || props === void 0 ? void 0 : props.openFixedSize) === null || _b === void 0 ? void 0 : _b.open) === true || (props === null || props === void 0 ? void 0 : props.openFixedSize) === undefined ? (React.createElement(WaterfallList, Object.assign({ key: waterFallData, reportTagsView: reportTagsView }, props))) : (React.createElement(WaterfallList$1, Object.assign({ key: waterFallData, reportTagsView: reportTagsView }, props)))), modalEleRef.current);
15435
15476
  };
15436
15477
  var WaterFall$1 = React.memo(WaterFall);
15437
15478
 
@@ -15439,7 +15480,7 @@ var WaterFall$1 = React.memo(WaterFall);
15439
15480
  * @Author: binruan@chatlabs.com
15440
15481
  * @Date: 2024-01-15 19:03:09
15441
15482
  * @LastEditors: binruan@chatlabs.com
15442
- * @LastEditTime: 2024-08-22 10:15:23
15483
+ * @LastEditTime: 2025-02-17 16:24:14
15443
15484
  * @FilePath: \pb-sxp-ui\src\materials\sxp\HashTag\index.tsx
15444
15485
  *
15445
15486
  */
@@ -15452,7 +15493,7 @@ var HashTagComponent = React.memo(HashTag$1);
15452
15493
  * @Author: binruan@chatlabs.com
15453
15494
  * @Date: 2023-07-28 18:29:57
15454
15495
  * @LastEditors: binruan@chatlabs.com
15455
- * @LastEditTime: 2024-09-18 10:48:44
15496
+ * @LastEditTime: 2025-02-17 17:45:40
15456
15497
  * @FilePath: \pb-sxp-ui\src\materials\sxp\HashTag\material.tsx
15457
15498
  *
15458
15499
  */
@@ -15511,7 +15552,8 @@ const HashTag = createMaterial(HashTagComponent, {
15511
15552
  paddingLeft: 20,
15512
15553
  paddingRight: 20,
15513
15554
  paddingBottom: 20
15514
- }
15555
+ },
15556
+ openFixedSize: { open: true, ratio: '1' }
15515
15557
  }
15516
15558
  },
15517
15559
  w: 100,