pb-sxp-ui 1.7.4 → 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 (31) hide show
  1. package/dist/index.cjs +13 -26
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.js +13 -26
  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 +13 -26
  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 +0 -1
  16. package/es/core/components/SxpPageRender/PictureGroup/index.js +0 -3
  17. package/es/core/components/SxpPageRender/RenderCard.js +2 -1
  18. package/es/core/components/SxpPageRender/VideoWidget/index.js +8 -9
  19. package/es/core/components/SxpPageRender/index.js +0 -1
  20. package/es/core/utils/tool.d.ts +1 -2
  21. package/es/core/utils/tool.js +1 -11
  22. package/lib/core/components/SxpPageRender/Modal/index.d.ts +1 -0
  23. package/lib/core/components/SxpPageRender/Modal/index.js +2 -2
  24. package/lib/core/components/SxpPageRender/PictureGroup/index.d.ts +0 -1
  25. package/lib/core/components/SxpPageRender/PictureGroup/index.js +0 -3
  26. package/lib/core/components/SxpPageRender/RenderCard.js +2 -1
  27. package/lib/core/components/SxpPageRender/VideoWidget/index.js +8 -9
  28. package/lib/core/components/SxpPageRender/index.js +0 -1
  29. package/lib/core/utils/tool.d.ts +1 -2
  30. package/lib/core/utils/tool.js +1 -12
  31. package/package.json +1 -1
@@ -9,6 +9,7 @@ interface IModalProps {
9
9
  schema?: any;
10
10
  fullHeight?: number;
11
11
  isFullScreen?: boolean;
12
+ openState?: IPopupType;
12
13
  }
13
14
  declare const _default: React.NamedExoticComponent<React.PropsWithChildren<IModalProps>>;
14
15
  export default _default;
@@ -3,7 +3,7 @@ import React, { memo, useCallback, useEffect, useMemo, useRef, useState } from '
3
3
  import * as ReactDOM from 'react-dom';
4
4
  import { useEditor, useSxpDataSource } from '../../../../core/hooks';
5
5
  const closeIcon = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAjhJREFUWEfFlztOw0AQhmeWiJ4CCmpQ5DiRQsIJyAWg5A0lR0AIChDiCJS8ER0cADgBeRSxt4CCDgkaKiq8i+zYeWx2413HEWmiJJv9v535Z2aN8M8vFPT9z3zETD0aAUChUJjwvPFHAJhBhB3Hqd6OAsK2yyucwykAvP38eJX398Z3AJDLlVYR8ToU9Rhj25TWr9KEsKy5dULIGQCMtfZly45TvwsAstm56UwG6wA4FUFwzrdctxZBDcWSy5XWEPG8I84/GcMipdWPtgcsaz5PCHtKG0IuTiqUvjT9U/WYMG2IOPE+AP+LtCB0xKUAAyA2Xbd2o2OG0NQXvTnvhL17D7EPtH9TRCIWwkRcGYGIQgYBABuqPuHXOQBc6pw80lBGwBQiiXhsBHQhkoprA6iM6acjhDQKu5YJZW6XeOI3XJdpvfsdTu52VfXEekD8owQiXGIubpSCbhDbLu8DwKEAd+A41SOdPpE4BS0viFOtvV2iKWqUgn5x/tmS70xR01GuDSCKc86/OCcLgTyyZ0ScDGNhFAktAJV4NFJ9YyaFiAWIE+9uVkkgBgLoig8DMWAa9ro9ynkUdlW5maZDCmB6clmz0k1HH4Cs1Ezbq2p2yEpUuBOKTSZZex00RUWIrltxuuK6EOGDSbGIOPZicpMx6fny650377qNRgBgWeVFQuA+6UjVgREhGIMlSqsPUQqIbZdOOIdZQmCv2axRnU1N1+TzJYsxOEaEV8ep7frPZ7Gd0FTEdP0ft0/kMNdg0eoAAAAASUVORK5CYII=';
6
- const Modal = ({ visible, onClose, children, modalStyle, padding, popup, schema, fullHeight = window.innerHeight, isFullScreen = false }) => {
6
+ const Modal = ({ visible, onClose, children, modalStyle, padding, popup, schema, fullHeight = window.innerHeight, isFullScreen = false, openState }) => {
7
7
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
8
8
  const touchRef = useRef(null);
9
9
  const fTouchRef = useRef(null);
@@ -55,7 +55,7 @@ const Modal = ({ visible, onClose, children, modalStyle, padding, popup, schema,
55
55
  }, [isOpen, popup]);
56
56
  const child = useCallback(() => {
57
57
  return children;
58
- }, [_popup]);
58
+ }, [_popup, openState]);
59
59
  if (!modalEleRef.current)
60
60
  return null;
61
61
  const handleClose = debounce(() => {
@@ -9,7 +9,6 @@ interface IPictureGroupProps {
9
9
  index: number;
10
10
  onViewImageEndEvent: (rec: RecItemType) => void;
11
11
  onViewImageStartEvent: (index: number, imgInfo?: {
12
- contentSize: string;
13
12
  loadTime: string;
14
13
  }, enableCapi?: boolean) => void;
15
14
  imgUrlsPostConfig?: postConfigType;
@@ -6,7 +6,6 @@ import Picture from './Picture';
6
6
  import { useSxpDataSource } from '../../../../core/hooks';
7
7
  import { css } from '@emotion/css';
8
8
  import SXP_EVENT_BUS, { SXP_EVENT_TYPE } from '../../../../core/utils/event';
9
- import { getResFileSizeFromSrc } from '../../../../core/utils/tool';
10
9
  const PictureGroup = ({ imgUrls, width, height, rec, index, onViewImageEndEvent, onViewImageStartEvent, imgUrlsPostConfig }) => {
11
10
  var _a, _b;
12
11
  const ref = useRef();
@@ -31,9 +30,7 @@ const PictureGroup = ({ imgUrls, width, height, rec, index, onViewImageEndEvent,
31
30
  }, [rec, isActive, onViewImageEndEvent, openHashtag, index, onViewImageStartEvent, isLoad, imgInfo]);
32
31
  const showFirstImageFn = useCallback((e) => __awaiter(void 0, void 0, void 0, function* () {
33
32
  if (!isLoad) {
34
- const contentSize = yield getResFileSizeFromSrc(e.src);
35
33
  setImgInfo({
36
- contentSize,
37
34
  loadTime: (new Date() - initTime).toFixed(2) + ''
38
35
  });
39
36
  setIsLoad(true);
@@ -2,6 +2,7 @@ import React, { memo, useMemo } from 'react';
2
2
  import './index.less';
3
3
  import withBindDataSource from '../../../core/hoc/withBindDataSource';
4
4
  import { useEditor } from '../../../core/hooks';
5
+ import { cloneDeep } from 'lodash';
5
6
  const RenderCard = ({ rec, index, tempMap, resolver, includesCtaType, isActive }) => {
6
7
  var _a, _b, _c, _d, _e;
7
8
  const { schema } = useEditor();
@@ -49,7 +50,7 @@ const RenderCard = ({ rec, index, tempMap, resolver, includesCtaType, isActive }
49
50
  const Component = withBindDataSource(t);
50
51
  const defaulSetting = (_z = t === null || t === void 0 ? void 0 : t.extend) === null || _z === void 0 ? void 0 : _z.defaulSetting;
51
52
  const isExternalLink = ((_2 = (_1 = (_0 = value === null || value === void 0 ? void 0 : value.item) === null || _0 === void 0 ? void 0 : _0.event) === null || _1 === void 0 ? void 0 : _1.onClick) === null || _2 === void 0 ? void 0 : _2.linkType) === 'externalLink';
52
- let style = (_3 = value === null || value === void 0 ? void 0 : value.item) === null || _3 === void 0 ? void 0 : _3.style;
53
+ let style = cloneDeep((_3 = value === null || value === void 0 ? void 0 : value.item) === null || _3 === void 0 ? void 0 : _3.style);
53
54
  if (style.hasOwnProperty('backdropFilter')) {
54
55
  let sbf = style['backdropFilter'];
55
56
  style['backdropFilter'] = `blur(${sbf !== null && sbf !== void 0 ? sbf : 0}px)`;
@@ -7,7 +7,6 @@ import { useSxpDataSource } from '../../../../core/hooks';
7
7
  import SXP_EVENT_BUS, { SXP_EVENT_TYPE } from '../../../../core/utils/event';
8
8
  import loading_gif from './loading.gif';
9
9
  import { mountVideoPlayerAtNode } from './VideoPlayer';
10
- import { getResFileSizeFromSrc } from '../../../../core/utils/tool';
11
10
  const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostConfig, videoPlayIcon }) => {
12
11
  const [isPauseVideo, setIsPauseVideo] = useState(false);
13
12
  const { bffEventReport, sxpParameter, waterFallData, openHashtag, bffFbReport } = useSxpDataSource();
@@ -23,6 +22,7 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
23
22
  const videoEleRef = useRef(null);
24
23
  const hlsRef = useRef(null);
25
24
  const initTimeRef = useRef();
25
+ const loadedTimeRef = useRef();
26
26
  const blur = useMemo(() => {
27
27
  return (videoPostConfig === null || videoPostConfig === void 0 ? void 0 : videoPostConfig.mode) === '2';
28
28
  }, [videoPostConfig]);
@@ -69,7 +69,7 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
69
69
  setIsLoadFinish(true);
70
70
  }, []);
71
71
  const handleStartPlay = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
72
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
72
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
73
73
  if (!(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current))
74
74
  return;
75
75
  setIsPauseVideo(false);
@@ -79,22 +79,20 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
79
79
  const videoDuration = ((_d = (_c = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _c === void 0 ? void 0 : _c.duration) !== null && _d !== void 0 ? _d : 0).toFixed(2);
80
80
  const videoCurrentTime = ((_f = (_e = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _e === void 0 ? void 0 : _e.currentTime) !== null && _f !== void 0 ? _f : 0).toFixed(2);
81
81
  const playType = isFirstPlay ? '0' : '1';
82
- const contentSize = yield getResFileSizeFromSrc((_g = item === null || item === void 0 ? void 0 : item.video) === null || _g === void 0 ? void 0 : _g.url);
83
82
  bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
84
83
  eventInfo: {
85
84
  eventSubject: 'playVideo',
86
85
  eventDescription: 'User played the video',
87
- contentId: (_j = (_h = item === null || item === void 0 ? void 0 : item.video) === null || _h === void 0 ? void 0 : _h.itemId) !== null && _j !== void 0 ? _j : '',
88
- contentName: (_l = (_k = item === null || item === void 0 ? void 0 : item.video) === null || _k === void 0 ? void 0 : _k.title) !== null && _l !== void 0 ? _l : '',
86
+ contentId: (_h = (_g = item === null || item === void 0 ? void 0 : item.video) === null || _g === void 0 ? void 0 : _g.itemId) !== null && _h !== void 0 ? _h : '',
87
+ contentName: (_k = (_j = item === null || item === void 0 ? void 0 : item.video) === null || _j === void 0 ? void 0 : _j.title) !== null && _k !== void 0 ? _k : '',
89
88
  playType,
90
89
  startTime: videoCurrentTime,
91
90
  videoDuration,
92
- contentTags: JSON.stringify((_o = (_m = item === null || item === void 0 ? void 0 : item.video) === null || _m === void 0 ? void 0 : _m.tags) !== null && _o !== void 0 ? _o : []),
91
+ contentTags: JSON.stringify((_m = (_l = item === null || item === void 0 ? void 0 : item.video) === null || _l === void 0 ? void 0 : _l.tags) !== null && _m !== void 0 ? _m : []),
93
92
  position: index + '',
94
93
  contentFormat: 'video',
95
- traceInfo: (_p = item === null || item === void 0 ? void 0 : item.video) === null || _p === void 0 ? void 0 : _p.traceInfo,
96
- contentSize,
97
- loadTime: (new Date() - (initTimeRef === null || initTimeRef === void 0 ? void 0 : initTimeRef.current)).toFixed(2) + ''
94
+ traceInfo: (_o = item === null || item === void 0 ? void 0 : item.video) === null || _o === void 0 ? void 0 : _o.traceInfo,
95
+ loadTime: ((loadedTimeRef === null || loadedTimeRef === void 0 ? void 0 : loadedTimeRef.current) - (initTimeRef === null || initTimeRef === void 0 ? void 0 : initTimeRef.current)).toFixed(2) + ''
98
96
  }
99
97
  });
100
98
  setIsFirstPlay(false);
@@ -125,6 +123,7 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
125
123
  const handleLoadedmetadata = useCallback(() => {
126
124
  if (!videoRef.current)
127
125
  return;
126
+ loadedTimeRef.current = new Date();
128
127
  handleStartPlay();
129
128
  handLoadeddata();
130
129
  }, [videoRef.current, handLoadeddata, handleStartPlay]);
@@ -435,7 +435,6 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
435
435
  position: activeIndex + '',
436
436
  contentFormat: 'image',
437
437
  traceInfo: item === null || item === void 0 ? void 0 : item.video.traceInfo,
438
- contentSize: imgInfo === null || imgInfo === void 0 ? void 0 : imgInfo.contentSize,
439
438
  loadTime: imgInfo === null || imgInfo === void 0 ? void 0 : imgInfo.loadTime
440
439
  }
441
440
  });
@@ -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 };
@@ -156,14 +156,4 @@ function getCookie(val) {
156
156
  });
157
157
  return value !== null && value !== void 0 ? value : '';
158
158
  }
159
- const getResFileSizeFromSrc = (imageSrc) => {
160
- if (!imageSrc)
161
- return '';
162
- return fetch(imageSrc)
163
- .then((response) => response.blob())
164
- .then((blob) => {
165
- const fileSizeInMB = blob.size / (1024 * 1024);
166
- return fileSizeInMB.toFixed(2) + '';
167
- });
168
- };
169
- export { uuid, getIndexByblockType, getBrowserInfo, getDevice, getSystem, getCookie, getResFileSizeFromSrc };
159
+ export { uuid, getIndexByblockType, getBrowserInfo, getDevice, getSystem, getCookie };
@@ -9,6 +9,7 @@ interface IModalProps {
9
9
  schema?: any;
10
10
  fullHeight?: number;
11
11
  isFullScreen?: boolean;
12
+ openState?: IPopupType;
12
13
  }
13
14
  declare const _default: React.NamedExoticComponent<React.PropsWithChildren<IModalProps>>;
14
15
  export default _default;
@@ -6,7 +6,7 @@ const react_1 = tslib_1.__importStar(require("react"));
6
6
  const ReactDOM = tslib_1.__importStar(require("react-dom"));
7
7
  const hooks_1 = require("../../../../core/hooks");
8
8
  const closeIcon = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAjhJREFUWEfFlztOw0AQhmeWiJ4CCmpQ5DiRQsIJyAWg5A0lR0AIChDiCJS8ER0cADgBeRSxt4CCDgkaKiq8i+zYeWx2413HEWmiJJv9v535Z2aN8M8vFPT9z3zETD0aAUChUJjwvPFHAJhBhB3Hqd6OAsK2yyucwykAvP38eJX398Z3AJDLlVYR8ToU9Rhj25TWr9KEsKy5dULIGQCMtfZly45TvwsAstm56UwG6wA4FUFwzrdctxZBDcWSy5XWEPG8I84/GcMipdWPtgcsaz5PCHtKG0IuTiqUvjT9U/WYMG2IOPE+AP+LtCB0xKUAAyA2Xbd2o2OG0NQXvTnvhL17D7EPtH9TRCIWwkRcGYGIQgYBABuqPuHXOQBc6pw80lBGwBQiiXhsBHQhkoprA6iM6acjhDQKu5YJZW6XeOI3XJdpvfsdTu52VfXEekD8owQiXGIubpSCbhDbLu8DwKEAd+A41SOdPpE4BS0viFOtvV2iKWqUgn5x/tmS70xR01GuDSCKc86/OCcLgTyyZ0ScDGNhFAktAJV4NFJ9YyaFiAWIE+9uVkkgBgLoig8DMWAa9ro9ynkUdlW5maZDCmB6clmz0k1HH4Cs1Ezbq2p2yEpUuBOKTSZZex00RUWIrltxuuK6EOGDSbGIOPZicpMx6fny650377qNRgBgWeVFQuA+6UjVgREhGIMlSqsPUQqIbZdOOIdZQmCv2axRnU1N1+TzJYsxOEaEV8ep7frPZ7Gd0FTEdP0ft0/kMNdg0eoAAAAASUVORK5CYII=';
9
- const Modal = ({ visible, onClose, children, modalStyle, padding, popup, schema, fullHeight = window.innerHeight, isFullScreen = false }) => {
9
+ const Modal = ({ visible, onClose, children, modalStyle, padding, popup, schema, fullHeight = window.innerHeight, isFullScreen = false, openState }) => {
10
10
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
11
11
  const touchRef = (0, react_1.useRef)(null);
12
12
  const fTouchRef = (0, react_1.useRef)(null);
@@ -58,7 +58,7 @@ const Modal = ({ visible, onClose, children, modalStyle, padding, popup, schema,
58
58
  }, [isOpen, popup]);
59
59
  const child = (0, react_1.useCallback)(() => {
60
60
  return children;
61
- }, [_popup]);
61
+ }, [_popup, openState]);
62
62
  if (!modalEleRef.current)
63
63
  return null;
64
64
  const handleClose = (0, lodash_1.debounce)(() => {
@@ -9,7 +9,6 @@ interface IPictureGroupProps {
9
9
  index: number;
10
10
  onViewImageEndEvent: (rec: RecItemType) => void;
11
11
  onViewImageStartEvent: (index: number, imgInfo?: {
12
- contentSize: string;
13
12
  loadTime: string;
14
13
  }, enableCapi?: boolean) => void;
15
14
  imgUrlsPostConfig?: postConfigType;
@@ -8,7 +8,6 @@ const Picture_1 = tslib_1.__importDefault(require("./Picture"));
8
8
  const hooks_1 = require("../../../../core/hooks");
9
9
  const css_1 = require("@emotion/css");
10
10
  const event_1 = tslib_1.__importStar(require("../../../../core/utils/event"));
11
- const tool_1 = require("../../../../core/utils/tool");
12
11
  const PictureGroup = ({ imgUrls, width, height, rec, index, onViewImageEndEvent, onViewImageStartEvent, imgUrlsPostConfig }) => {
13
12
  var _a, _b;
14
13
  const ref = (0, react_1.useRef)();
@@ -33,9 +32,7 @@ const PictureGroup = ({ imgUrls, width, height, rec, index, onViewImageEndEvent,
33
32
  }, [rec, isActive, onViewImageEndEvent, openHashtag, index, onViewImageStartEvent, isLoad, imgInfo]);
34
33
  const showFirstImageFn = (0, react_1.useCallback)((e) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
35
34
  if (!isLoad) {
36
- const contentSize = yield (0, tool_1.getResFileSizeFromSrc)(e.src);
37
35
  setImgInfo({
38
- contentSize,
39
36
  loadTime: (new Date() - initTime).toFixed(2) + ''
40
37
  });
41
38
  setIsLoad(true);
@@ -5,6 +5,7 @@ const react_1 = tslib_1.__importStar(require("react"));
5
5
  require("./index.less");
6
6
  const withBindDataSource_1 = tslib_1.__importDefault(require("../../../core/hoc/withBindDataSource"));
7
7
  const hooks_1 = require("../../../core/hooks");
8
+ const lodash_1 = require("lodash");
8
9
  const RenderCard = ({ rec, index, tempMap, resolver, includesCtaType, isActive }) => {
9
10
  var _a, _b, _c, _d, _e;
10
11
  const { schema } = (0, hooks_1.useEditor)();
@@ -52,7 +53,7 @@ const RenderCard = ({ rec, index, tempMap, resolver, includesCtaType, isActive }
52
53
  const Component = (0, withBindDataSource_1.default)(t);
53
54
  const defaulSetting = (_z = t === null || t === void 0 ? void 0 : t.extend) === null || _z === void 0 ? void 0 : _z.defaulSetting;
54
55
  const isExternalLink = ((_2 = (_1 = (_0 = value === null || value === void 0 ? void 0 : value.item) === null || _0 === void 0 ? void 0 : _0.event) === null || _1 === void 0 ? void 0 : _1.onClick) === null || _2 === void 0 ? void 0 : _2.linkType) === 'externalLink';
55
- let style = (_3 = value === null || value === void 0 ? void 0 : value.item) === null || _3 === void 0 ? void 0 : _3.style;
56
+ let style = (0, lodash_1.cloneDeep)((_3 = value === null || value === void 0 ? void 0 : value.item) === null || _3 === void 0 ? void 0 : _3.style);
56
57
  if (style.hasOwnProperty('backdropFilter')) {
57
58
  let sbf = style['backdropFilter'];
58
59
  style['backdropFilter'] = `blur(${sbf !== null && sbf !== void 0 ? sbf : 0}px)`;
@@ -9,7 +9,6 @@ const hooks_1 = require("../../../../core/hooks");
9
9
  const event_1 = tslib_1.__importStar(require("../../../../core/utils/event"));
10
10
  const loading_gif_1 = tslib_1.__importDefault(require("./loading.gif"));
11
11
  const VideoPlayer_1 = require("./VideoPlayer");
12
- const tool_1 = require("../../../../core/utils/tool");
13
12
  const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostConfig, videoPlayIcon }) => {
14
13
  const [isPauseVideo, setIsPauseVideo] = (0, react_1.useState)(false);
15
14
  const { bffEventReport, sxpParameter, waterFallData, openHashtag, bffFbReport } = (0, hooks_1.useSxpDataSource)();
@@ -25,6 +24,7 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
25
24
  const videoEleRef = (0, react_1.useRef)(null);
26
25
  const hlsRef = (0, react_1.useRef)(null);
27
26
  const initTimeRef = (0, react_1.useRef)();
27
+ const loadedTimeRef = (0, react_1.useRef)();
28
28
  const blur = (0, react_1.useMemo)(() => {
29
29
  return (videoPostConfig === null || videoPostConfig === void 0 ? void 0 : videoPostConfig.mode) === '2';
30
30
  }, [videoPostConfig]);
@@ -71,7 +71,7 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
71
71
  setIsLoadFinish(true);
72
72
  }, []);
73
73
  const handleStartPlay = (0, react_1.useCallback)(() => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
74
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
74
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
75
75
  if (!(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current))
76
76
  return;
77
77
  setIsPauseVideo(false);
@@ -81,22 +81,20 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
81
81
  const videoDuration = ((_d = (_c = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _c === void 0 ? void 0 : _c.duration) !== null && _d !== void 0 ? _d : 0).toFixed(2);
82
82
  const videoCurrentTime = ((_f = (_e = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _e === void 0 ? void 0 : _e.currentTime) !== null && _f !== void 0 ? _f : 0).toFixed(2);
83
83
  const playType = isFirstPlay ? '0' : '1';
84
- const contentSize = yield (0, tool_1.getResFileSizeFromSrc)((_g = item === null || item === void 0 ? void 0 : item.video) === null || _g === void 0 ? void 0 : _g.url);
85
84
  bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
86
85
  eventInfo: {
87
86
  eventSubject: 'playVideo',
88
87
  eventDescription: 'User played the video',
89
- contentId: (_j = (_h = item === null || item === void 0 ? void 0 : item.video) === null || _h === void 0 ? void 0 : _h.itemId) !== null && _j !== void 0 ? _j : '',
90
- contentName: (_l = (_k = item === null || item === void 0 ? void 0 : item.video) === null || _k === void 0 ? void 0 : _k.title) !== null && _l !== void 0 ? _l : '',
88
+ contentId: (_h = (_g = item === null || item === void 0 ? void 0 : item.video) === null || _g === void 0 ? void 0 : _g.itemId) !== null && _h !== void 0 ? _h : '',
89
+ contentName: (_k = (_j = item === null || item === void 0 ? void 0 : item.video) === null || _j === void 0 ? void 0 : _j.title) !== null && _k !== void 0 ? _k : '',
91
90
  playType,
92
91
  startTime: videoCurrentTime,
93
92
  videoDuration,
94
- contentTags: JSON.stringify((_o = (_m = item === null || item === void 0 ? void 0 : item.video) === null || _m === void 0 ? void 0 : _m.tags) !== null && _o !== void 0 ? _o : []),
93
+ contentTags: JSON.stringify((_m = (_l = item === null || item === void 0 ? void 0 : item.video) === null || _l === void 0 ? void 0 : _l.tags) !== null && _m !== void 0 ? _m : []),
95
94
  position: index + '',
96
95
  contentFormat: 'video',
97
- traceInfo: (_p = item === null || item === void 0 ? void 0 : item.video) === null || _p === void 0 ? void 0 : _p.traceInfo,
98
- contentSize,
99
- loadTime: (new Date() - (initTimeRef === null || initTimeRef === void 0 ? void 0 : initTimeRef.current)).toFixed(2) + ''
96
+ traceInfo: (_o = item === null || item === void 0 ? void 0 : item.video) === null || _o === void 0 ? void 0 : _o.traceInfo,
97
+ loadTime: ((loadedTimeRef === null || loadedTimeRef === void 0 ? void 0 : loadedTimeRef.current) - (initTimeRef === null || initTimeRef === void 0 ? void 0 : initTimeRef.current)).toFixed(2) + ''
100
98
  }
101
99
  });
102
100
  setIsFirstPlay(false);
@@ -127,6 +125,7 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
127
125
  const handleLoadedmetadata = (0, react_1.useCallback)(() => {
128
126
  if (!videoRef.current)
129
127
  return;
128
+ loadedTimeRef.current = new Date();
130
129
  handleStartPlay();
131
130
  handLoadeddata();
132
131
  }, [videoRef.current, handLoadeddata, handleStartPlay]);
@@ -438,7 +438,6 @@ 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
  });
@@ -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.4",
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",