pb-sxp-ui 1.7.3 → 1.7.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.
Files changed (33) hide show
  1. package/dist/index.cjs +60 -67
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.js +60 -67
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.min.cjs +3 -3
  6. package/dist/index.min.cjs.map +1 -1
  7. package/dist/index.min.js +3 -3
  8. package/dist/index.min.js.map +1 -1
  9. package/dist/pb-ui.js +60 -67
  10. package/dist/pb-ui.js.map +1 -1
  11. package/dist/pb-ui.min.js +3 -3
  12. package/dist/pb-ui.min.js.map +1 -1
  13. package/es/core/components/SxpPageRender/Modal/index.d.ts +1 -0
  14. package/es/core/components/SxpPageRender/Modal/index.js +2 -2
  15. package/es/core/components/SxpPageRender/PictureGroup/index.d.ts +2 -3
  16. package/es/core/components/SxpPageRender/PictureGroup/index.js +5 -8
  17. package/es/core/components/SxpPageRender/RenderCard.js +2 -1
  18. package/es/core/components/SxpPageRender/VideoWidget/index.js +15 -17
  19. package/es/core/components/SxpPageRender/index.js +25 -20
  20. package/es/core/context/SxpDataSourceProvider.js +9 -6
  21. package/es/core/utils/tool.d.ts +1 -2
  22. package/es/core/utils/tool.js +1 -11
  23. package/lib/core/components/SxpPageRender/Modal/index.d.ts +1 -0
  24. package/lib/core/components/SxpPageRender/Modal/index.js +2 -2
  25. package/lib/core/components/SxpPageRender/PictureGroup/index.d.ts +2 -3
  26. package/lib/core/components/SxpPageRender/PictureGroup/index.js +5 -8
  27. package/lib/core/components/SxpPageRender/RenderCard.js +2 -1
  28. package/lib/core/components/SxpPageRender/VideoWidget/index.js +15 -17
  29. package/lib/core/components/SxpPageRender/index.js +25 -20
  30. package/lib/core/context/SxpDataSourceProvider.js +9 -6
  31. package/lib/core/utils/tool.d.ts +1 -2
  32. package/lib/core/utils/tool.js +1 -12
  33. package/package.json +1 -1
@@ -216,7 +216,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
216
216
  return (react_1.default.createElement(VideoWidget_1.default, { key: isReload, rec: rec, index: index, muted: isMuted, data: data, height: height, activeIndex: activeIndex, videoPostConfig: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.videoPost, videoPlayIcon: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.videoPlayIcon }));
217
217
  }
218
218
  if ((_b = rec === null || rec === void 0 ? void 0 : rec.video) === null || _b === void 0 ? void 0 : _b.imgUrls) {
219
- return (react_1.default.createElement(PictureGroup_1.default, { key: rec === null || rec === void 0 ? void 0 : rec.video.itemId, imgUrls: rec === null || rec === void 0 ? void 0 : rec.video.imgUrls, width: containerWidth, height: height, rec: rec, index: index, onReportViewImageEnd: handleReportViewImageEnd, onViewImageStartEvent: handleViewImageStartEvent, imgUrlsPostConfig: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.imgUrlsPost }));
219
+ return (react_1.default.createElement(PictureGroup_1.default, { key: rec === null || rec === void 0 ? void 0 : rec.video.itemId, imgUrls: rec === null || rec === void 0 ? void 0 : rec.video.imgUrls, width: containerWidth, height: height, rec: rec, index: index, onViewImageEndEvent: handleViewImageStartEnd, onViewImageStartEvent: handleViewImageStartEvent, imgUrlsPostConfig: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.imgUrlsPost }));
220
220
  }
221
221
  if (rec.product && Array.isArray(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.productPost) && ((_c = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.productPost) === null || _c === void 0 ? void 0 : _c.length) > 0) {
222
222
  return (_d = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.productPost) === null || _d === void 0 ? void 0 : _d.map((value, idx) => {
@@ -290,7 +290,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
290
290
  if (!(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowLike) || !visible)
291
291
  return;
292
292
  let top = (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIconY) !== null && _a !== void 0 ? _a : 400;
293
- if (waterFallData && top < 40) {
293
+ if (waterFallData && top < 40 && globalConfig.likeIconYPosit === 'top') {
294
294
  top += 40;
295
295
  }
296
296
  if (rec === null || rec === void 0 ? void 0 : rec.video) {
@@ -302,7 +302,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
302
302
  }
303
303
  return null;
304
304
  }, [globalConfig, waterFallData]);
305
- const handleReportViewImageEnd = (item) => {
305
+ const handleViewImageStartEnd = (item) => {
306
306
  var _a, _b, _c, _d, _e, _f;
307
307
  if (!((_a = item === null || item === void 0 ? void 0 : item.video) === null || _a === void 0 ? void 0 : _a.url) && ((_b = item === null || item === void 0 ? void 0 : item.video) === null || _b === void 0 ? void 0 : _b.imgUrls)) {
308
308
  const endTime = Date.now();
@@ -385,7 +385,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
385
385
  position: ((_k = swiper.previousIndex) !== null && _k !== void 0 ? _k : 0) + ''
386
386
  }
387
387
  });
388
- handleReportViewImageEnd(item);
388
+ handleViewImageStartEnd(item);
389
389
  handleSlideSkip(item, swiper.previousIndex);
390
390
  }
391
391
  else {
@@ -401,7 +401,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
401
401
  position: ((_s = swiper.previousIndex) !== null && _s !== void 0 ? _s : 0) + ''
402
402
  }
403
403
  });
404
- handleReportViewImageEnd(item);
404
+ handleViewImageStartEnd(item);
405
405
  }
406
406
  handleReportProductView(item);
407
407
  viewTime.current = new Date();
@@ -421,7 +421,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
421
421
  viewTime.current = new Date();
422
422
  }
423
423
  }, [openHashtag, data, activeIndex]);
424
- const handleViewImageStartEvent = (activeIndex, imgInfo) => {
424
+ const handleViewImageStartEvent = (activeIndex, imgInfo, enableCapi) => {
425
425
  var _a, _b, _c, _d, _e, _f, _g, _h;
426
426
  const item = data[activeIndex];
427
427
  if (!((_a = item === null || item === void 0 ? void 0 : item.video) === null || _a === void 0 ? void 0 : _a.url) && ((_b = item === null || item === void 0 ? void 0 : item.video) === null || _b === void 0 ? void 0 : _b.imgUrls)) {
@@ -438,33 +438,38 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
438
438
  position: activeIndex + '',
439
439
  contentFormat: 'image',
440
440
  traceInfo: item === null || item === void 0 ? void 0 : item.video.traceInfo,
441
- contentSize: imgInfo === null || imgInfo === void 0 ? void 0 : imgInfo.contentSize,
442
441
  loadTime: imgInfo === null || imgInfo === void 0 ? void 0 : imgInfo.loadTime
443
442
  }
444
443
  });
445
- bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
446
- eventName: 'ViewContent',
447
- product: (_g = item === null || item === void 0 ? void 0 : item.video) === null || _g === void 0 ? void 0 : _g.bindProduct
448
- });
449
- bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
450
- eventName: 'PageView',
451
- product: (_h = item === null || item === void 0 ? void 0 : item.video) === null || _h === void 0 ? void 0 : _h.bindProduct
452
- });
444
+ if (enableCapi) {
445
+ bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
446
+ eventName: 'ViewContent',
447
+ product: (_g = item === null || item === void 0 ? void 0 : item.video) === null || _g === void 0 ? void 0 : _g.bindProduct
448
+ });
449
+ bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
450
+ eventName: 'PageView',
451
+ product: (_h = item === null || item === void 0 ? void 0 : item.video) === null || _h === void 0 ? void 0 : _h.bindProduct
452
+ });
453
+ }
453
454
  }
454
455
  };
455
456
  const renderToggleButton = (0, react_1.useCallback)((visible) => {
456
457
  var _a, _b, _c, _d, _e, _f;
457
458
  if (!visible)
458
459
  return;
460
+ let top = (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconY) !== null && _a !== void 0 ? _a : 23;
461
+ if (waterFallData && top < 40 && (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconYPosit) === 'top') {
462
+ top += 40;
463
+ }
459
464
  return (((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowMute) === undefined || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowMute) === true) && (react_1.default.createElement(ToggleButton_1.default, { style: {
460
465
  position: (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconFixed) ? 'fixed' : 'absolute',
461
- visibility: ((_b = (_a = visList === null || visList === void 0 ? void 0 : visList[activeIndex]) === null || _a === void 0 ? void 0 : _a.video) === null || _b === void 0 ? void 0 : _b.url) ? 'visible' : 'hidden',
466
+ visibility: ((_c = (_b = visList === null || visList === void 0 ? void 0 : visList[activeIndex]) === null || _b === void 0 ? void 0 : _b.video) === null || _c === void 0 ? void 0 : _c.url) ? 'visible' : 'hidden',
462
467
  zIndex: 999,
463
468
  transform: 'translate3d(0px,0px,0px)',
464
- [(_c = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconXPosit) !== null && _c !== void 0 ? _c : 'right']: (_d = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconX) !== null && _d !== void 0 ? _d : 0,
465
- [(_e = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconYPosit) !== null && _e !== void 0 ? _e : 'bottom']: (_f = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconY) !== null && _f !== void 0 ? _f : 23
469
+ [(_d = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconXPosit) !== null && _d !== void 0 ? _d : 'right']: (_e = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconX) !== null && _e !== void 0 ? _e : 0,
470
+ [(_f = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconYPosit) !== null && _f !== void 0 ? _f : 'bottom']: top
466
471
  }, defaultValue: isMuted, activeIcon: (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.unMuteIcon) ? globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.unMuteIcon : mutedIcon, unactiveIcon: (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIcon) ? globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIcon : unmutedIcon, onChange: setIsMuted })));
467
- }, [globalConfig, visList, activeIndex, isMuted]);
472
+ }, [globalConfig, visList, activeIndex, isMuted, waterFallData]);
468
473
  const renderView = (0, react_1.useMemo)(() => {
469
474
  if (loading) {
470
475
  return (react_1.default.createElement("div", { style: { height, width: containerWidth, display: 'flex', justifyContent: 'center', alignItems: 'center' } },
@@ -497,7 +502,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
497
502
  renderToggleButton
498
503
  ]);
499
504
  return (react_1.default.createElement("div", { id: 'sxp-render', className: 'clc-sxp-container', style: Object.assign({}, ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.textUnderlineOffset) && { textUnderlineOffset: `${globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.textUnderlineOffset}px` })) },
500
- waterFallData && (react_1.default.createElement(Navbar_1.default, { icon: left_png_1.default, styles: { background: 'rgba(0,0,0,.3)', color: '#fff' }, textStyle: Object.assign(Object.assign({}, (_e = (_d = (_c = (_b = (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.hashTag) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.item) === null || _c === void 0 ? void 0 : _c.props) === null || _d === void 0 ? void 0 : _d.textStyles) === null || _e === void 0 ? void 0 : _e.hashTagTitle), { color: '#fff' }), onClose: () => {
505
+ waterFallData && (react_1.default.createElement(Navbar_1.default, { icon: left_png_1.default, styles: { background: 'rgba(0,0,0,.3)', color: '#fff', top: `${minusHeight}px` }, textStyle: Object.assign(Object.assign({}, (_e = (_d = (_c = (_b = (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.hashTag) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.item) === null || _c === void 0 ? void 0 : _c.props) === null || _d === void 0 ? void 0 : _d.textStyles) === null || _e === void 0 ? void 0 : _e.hashTagTitle), { color: '#fff' }), onClose: () => {
501
506
  const isEq = (0, lodash_1.isEqual)(rtcList, cacheRtcList);
502
507
  if (!isEq && cacheRtcList && (cacheRtcList === null || cacheRtcList === void 0 ? void 0 : cacheRtcList.length)) {
503
508
  setRtcList === null || setRtcList === void 0 ? void 0 : setRtcList(cacheRtcList);
@@ -193,17 +193,20 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
193
193
  });
194
194
  }, [bffFetch, curReqInfo, enableReportEvent, globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview]);
195
195
  const bffFbReport = (0, react_1.useCallback)(({ eventName, product }) => {
196
- var _a, _b, _c, _d;
197
- if (!enableReportEvent || !enabledMetaConversionApi || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview)) {
196
+ var _a, _b, _c, _d, _e;
197
+ if (!enableReportEvent ||
198
+ !enabledMetaConversionApi ||
199
+ (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview) ||
200
+ !((_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.converApi) === null || _a === void 0 ? void 0 : _a[eventName])) {
198
201
  return;
199
202
  }
200
- let jsonParams = (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.converApi) === null || _a === void 0 ? void 0 : _a[eventName];
203
+ let jsonParams = JSON.parse(JSON.stringify((_b = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.converApi) === null || _b === void 0 ? void 0 : _b[eventName]));
201
204
  const urlParams = new URLSearchParams(window.location.search);
202
205
  const fbclid = urlParams === null || urlParams === void 0 ? void 0 : urlParams.get('fbclid');
203
206
  const fix_par = {
204
- event_source_url: (_b = window === null || window === void 0 ? void 0 : window.location) === null || _b === void 0 ? void 0 : _b.href,
207
+ event_source_url: (_c = window === null || window === void 0 ? void 0 : window.location) === null || _c === void 0 ? void 0 : _c.href,
205
208
  external_id: (0, localStore_1.storeAndLoadFeUserId)(),
206
- client_user_agent: (_d = (_c = window === null || window === void 0 ? void 0 : window.navigator) === null || _c === void 0 ? void 0 : _c.userAgent) !== null && _d !== void 0 ? _d : '',
209
+ client_user_agent: (_e = (_d = window === null || window === void 0 ? void 0 : window.navigator) === null || _d === void 0 ? void 0 : _d.userAgent) !== null && _e !== void 0 ? _e : '',
207
210
  fbc: fbclid ? `fb.2.${new Date().getTime()}.${fbclid}` : '',
208
211
  fbp: (0, tool_1.getCookie)('_fbp') ? `fb.2.${new Date().getTime()}.${(0, tool_1.getCookie)('_fbp')}` : '',
209
212
  time: new Date().getTime()
@@ -228,7 +231,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
228
231
  matches.forEach((match) => {
229
232
  const prop = match.substring(2, match.length - 2);
230
233
  try {
231
- const replaceValue = new Function('fix_par', 'product', `return ${prop}`)(fix_par, product);
234
+ let replaceValue = new Function('fix_par', 'product', `return ${prop}`)(fix_par, product);
232
235
  if (replaceValue) {
233
236
  obj[key] = replaceValue;
234
237
  }
@@ -11,5 +11,4 @@ declare function getBrowserInfo(): string | null;
11
11
  declare function getSystem(): string | null;
12
12
  declare function getDevice(): string | null;
13
13
  declare function getCookie(val: string): string;
14
- declare const getResFileSizeFromSrc: (imageSrc?: string) => "" | Promise<string>;
15
- export { uuid, getIndexByblockType, getBrowserInfo, getDevice, getSystem, getCookie, getResFileSizeFromSrc };
14
+ export { uuid, getIndexByblockType, getBrowserInfo, getDevice, getSystem, getCookie };
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getResFileSizeFromSrc = exports.getCookie = exports.getSystem = exports.getDevice = exports.getBrowserInfo = exports.getIndexByblockType = exports.uuid = exports.setFontForText = exports.getUid = exports.generateRandomString = void 0;
3
+ exports.getCookie = exports.getSystem = exports.getDevice = exports.getBrowserInfo = exports.getIndexByblockType = exports.uuid = exports.setFontForText = exports.getUid = exports.generateRandomString = void 0;
4
4
  const uuid_1 = require("uuid");
5
5
  function uuid(len, radix) {
6
6
  const chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split('');
@@ -168,14 +168,3 @@ function getCookie(val) {
168
168
  return value !== null && value !== void 0 ? value : '';
169
169
  }
170
170
  exports.getCookie = getCookie;
171
- const getResFileSizeFromSrc = (imageSrc) => {
172
- if (!imageSrc)
173
- return '';
174
- return fetch(imageSrc)
175
- .then((response) => response.blob())
176
- .then((blob) => {
177
- const fileSizeInMB = blob.size / (1024 * 1024);
178
- return fileSizeInMB.toFixed(2) + '';
179
- });
180
- };
181
- exports.getResFileSizeFromSrc = getResFileSizeFromSrc;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pb-sxp-ui",
3
- "version": "1.7.3",
3
+ "version": "1.7.5",
4
4
  "description": "React enterprise-class UI components",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",