pb-sxp-ui 1.7.2 → 1.7.4
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 +147 -82
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +147 -82
- package/dist/index.js.map +1 -1
- package/dist/index.min.cjs +3 -3
- package/dist/index.min.cjs.map +1 -1
- package/dist/index.min.js +3 -3
- package/dist/index.min.js.map +1 -1
- package/dist/pb-ui.js +147 -82
- package/dist/pb-ui.js.map +1 -1
- package/dist/pb-ui.min.js +3 -3
- package/dist/pb-ui.min.js.map +1 -1
- package/es/core/components/SxpPageRender/PictureGroup/Picture.d.ts +1 -1
- package/es/core/components/SxpPageRender/PictureGroup/index.d.ts +5 -2
- package/es/core/components/SxpPageRender/PictureGroup/index.js +26 -6
- package/es/core/components/SxpPageRender/RenderCard.js +6 -1
- package/es/core/components/SxpPageRender/VideoWidget/index.js +21 -15
- package/es/core/components/SxpPageRender/WaterFall/List.js +3 -2
- package/es/core/components/SxpPageRender/WaterFall/WaterfallList.js +3 -2
- package/es/core/components/SxpPageRender/index.d.ts +1 -0
- package/es/core/components/SxpPageRender/index.js +36 -28
- package/es/core/context/SxpDataSourceProvider.js +9 -6
- package/es/core/utils/materials.d.ts +7 -1
- package/es/core/utils/materials.js +5 -2
- package/es/core/utils/tool.d.ts +2 -1
- package/es/core/utils/tool.js +11 -1
- package/es/materials/sxp/cta/AniLink/settingRender.d.ts +11 -0
- package/es/materials/sxp/cta/AniLink/settingRender.js +6 -0
- package/es/materials/sxp/cta/AniLinkPopup/settingRender.d.ts +1 -1
- package/es/materials/sxp/cta/AniLinkPopup/settingRender.js +6 -0
- package/es/materials/sxp/popup/CommodityDetail/index.js +3 -2
- package/es/materials/sxp/popup/CommodityDetailDiroNew/index.js +3 -2
- package/es/materials/sxp/popup/CommodityList/index.js +5 -4
- package/es/materials/sxp/template/components/settingRender.d.ts +1 -1
- package/es/materials/sxp/template/components/settingRender.js +6 -0
- package/lib/core/components/SxpPageRender/PictureGroup/Picture.d.ts +1 -1
- package/lib/core/components/SxpPageRender/PictureGroup/index.d.ts +5 -2
- package/lib/core/components/SxpPageRender/PictureGroup/index.js +25 -6
- package/lib/core/components/SxpPageRender/RenderCard.js +6 -1
- package/lib/core/components/SxpPageRender/VideoWidget/index.js +20 -15
- package/lib/core/components/SxpPageRender/WaterFall/List.js +3 -2
- package/lib/core/components/SxpPageRender/WaterFall/WaterfallList.js +3 -2
- package/lib/core/components/SxpPageRender/index.d.ts +1 -0
- package/lib/core/components/SxpPageRender/index.js +36 -28
- package/lib/core/context/SxpDataSourceProvider.js +9 -6
- package/lib/core/utils/materials.d.ts +7 -1
- package/lib/core/utils/materials.js +5 -2
- package/lib/core/utils/tool.d.ts +2 -1
- package/lib/core/utils/tool.js +12 -1
- package/lib/materials/sxp/cta/AniLink/settingRender.d.ts +11 -0
- package/lib/materials/sxp/cta/AniLink/settingRender.js +6 -0
- package/lib/materials/sxp/cta/AniLinkPopup/settingRender.d.ts +1 -1
- package/lib/materials/sxp/cta/AniLinkPopup/settingRender.js +6 -0
- package/lib/materials/sxp/popup/CommodityDetail/index.js +3 -2
- package/lib/materials/sxp/popup/CommodityDetailDiroNew/index.js +3 -2
- package/lib/materials/sxp/popup/CommodityList/index.js +5 -4
- package/lib/materials/sxp/template/components/settingRender.d.ts +1 -1
- package/lib/materials/sxp/template/components/settingRender.js +6 -0
- package/package.json +1 -1
@@ -4,7 +4,7 @@ interface IPictureProps {
|
|
4
4
|
src: string;
|
5
5
|
height?: number;
|
6
6
|
imgUrlsPostConfig?: postConfigType;
|
7
|
-
onShowFirstImage?: () => void;
|
7
|
+
onShowFirstImage?: (e: any) => void;
|
8
8
|
}
|
9
9
|
declare const Picture: (props: IPictureProps) => React.JSX.Element;
|
10
10
|
export default Picture;
|
@@ -7,8 +7,11 @@ interface IPictureGroupProps {
|
|
7
7
|
height: number;
|
8
8
|
rec: RecItemType;
|
9
9
|
index: number;
|
10
|
-
|
11
|
-
onViewImageStartEvent: (index: number
|
10
|
+
onViewImageEndEvent: (rec: RecItemType) => void;
|
11
|
+
onViewImageStartEvent: (index: number, imgInfo?: {
|
12
|
+
contentSize: string;
|
13
|
+
loadTime: string;
|
14
|
+
}, enableCapi?: boolean) => void;
|
12
15
|
imgUrlsPostConfig?: postConfigType;
|
13
16
|
}
|
14
17
|
declare const _default: React.NamedExoticComponent<IPictureGroupProps>;
|
@@ -1,34 +1,54 @@
|
|
1
|
+
import { __awaiter } from "tslib";
|
1
2
|
import React, { memo, useCallback, useEffect, useRef, useState } from 'react';
|
2
3
|
import { Autoplay, Pagination } from 'swiper/modules';
|
3
4
|
import { Swiper, SwiperSlide, useSwiperSlide } from 'swiper/react';
|
4
5
|
import Picture from './Picture';
|
5
6
|
import { useSxpDataSource } from '../../../../core/hooks';
|
6
7
|
import { css } from '@emotion/css';
|
7
|
-
|
8
|
+
import SXP_EVENT_BUS, { SXP_EVENT_TYPE } from '../../../../core/utils/event';
|
9
|
+
import { getResFileSizeFromSrc } from '../../../../core/utils/tool';
|
10
|
+
const PictureGroup = ({ imgUrls, width, height, rec, index, onViewImageEndEvent, onViewImageStartEvent, imgUrlsPostConfig }) => {
|
8
11
|
var _a, _b;
|
9
12
|
const ref = useRef();
|
10
13
|
const { isActive } = useSwiperSlide();
|
11
14
|
const { sxpParameter, openHashtag } = useSxpDataSource();
|
12
15
|
const [isLoad, setIsLoad] = useState(false);
|
16
|
+
const [imgInfo, setImgInfo] = useState();
|
17
|
+
const initTime = new Date();
|
13
18
|
useEffect(() => {
|
14
19
|
if (isLoad && isActive) {
|
15
20
|
(ref === null || ref === void 0 ? void 0 : ref.current) && ref.current.swiper.autoplay.start();
|
16
21
|
if (openHashtag) {
|
17
|
-
|
22
|
+
onViewImageEndEvent(rec);
|
18
23
|
}
|
19
24
|
else {
|
20
|
-
onViewImageStartEvent(index);
|
25
|
+
onViewImageStartEvent(index, imgInfo, true);
|
21
26
|
}
|
22
27
|
}
|
23
28
|
else {
|
24
29
|
(ref === null || ref === void 0 ? void 0 : ref.current) && ref.current.swiper.autoplay.stop();
|
25
30
|
}
|
26
|
-
}, [rec, isActive,
|
27
|
-
const showFirstImageFn = useCallback(() => {
|
31
|
+
}, [rec, isActive, onViewImageEndEvent, openHashtag, index, onViewImageStartEvent, isLoad, imgInfo]);
|
32
|
+
const showFirstImageFn = useCallback((e) => __awaiter(void 0, void 0, void 0, function* () {
|
28
33
|
if (!isLoad) {
|
34
|
+
const contentSize = yield getResFileSizeFromSrc(e.src);
|
35
|
+
setImgInfo({
|
36
|
+
contentSize,
|
37
|
+
loadTime: (new Date() - initTime).toFixed(2) + ''
|
38
|
+
});
|
29
39
|
setIsLoad(true);
|
30
40
|
}
|
31
|
-
}, [isLoad]);
|
41
|
+
}), [isLoad]);
|
42
|
+
useEffect(() => {
|
43
|
+
const onShow = () => onViewImageStartEvent(index, imgInfo);
|
44
|
+
const onHide = () => onViewImageEndEvent(rec);
|
45
|
+
SXP_EVENT_BUS.on(SXP_EVENT_TYPE.PAGE_DID_SHOW, onShow);
|
46
|
+
SXP_EVENT_BUS.on(SXP_EVENT_TYPE.PAGE_DID_HIDE, onHide);
|
47
|
+
return () => {
|
48
|
+
SXP_EVENT_BUS.off(SXP_EVENT_TYPE.PAGE_DID_SHOW, onShow);
|
49
|
+
SXP_EVENT_BUS.off(SXP_EVENT_TYPE.PAGE_DID_HIDE, onHide);
|
50
|
+
};
|
51
|
+
}, [imgInfo]);
|
32
52
|
return (React.createElement(Swiper, { ref: ref, defaultValue: 0, direction: 'horizontal', modules: [Pagination, Autoplay], pagination: {
|
33
53
|
clickable: true,
|
34
54
|
bulletActiveClass: 'swipe-item-active-bullet',
|
@@ -49,7 +49,12 @@ const RenderCard = ({ rec, index, tempMap, resolver, includesCtaType, isActive }
|
|
49
49
|
const Component = withBindDataSource(t);
|
50
50
|
const defaulSetting = (_z = t === null || t === void 0 ? void 0 : t.extend) === null || _z === void 0 ? void 0 : _z.defaulSetting;
|
51
51
|
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
|
-
|
52
|
+
let style = (_3 = value === null || value === void 0 ? void 0 : value.item) === null || _3 === void 0 ? void 0 : _3.style;
|
53
|
+
if (style.hasOwnProperty('backdropFilter')) {
|
54
|
+
let sbf = style['backdropFilter'];
|
55
|
+
style['backdropFilter'] = `blur(${sbf !== null && sbf !== void 0 ? sbf : 0}px)`;
|
56
|
+
}
|
57
|
+
return (React.createElement(Component, Object.assign({ style: Object.assign(Object.assign(Object.assign({}, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.style), style), { zIndex: 50, marginLeft: '20px', boxSizing: 'border-box', transform: 'translate3d(0px, 0px, 0px)' }), textStyle: Object.assign(Object.assign({}, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.textStyle), (_4 = value === null || value === void 0 ? void 0 : value.item) === null || _4 === void 0 ? void 0 : _4.textStyle), bindDatas: (_6 = (_5 = value === null || value === void 0 ? void 0 : value.item) === null || _5 === void 0 ? void 0 : _5.bindDatas) !== null && _6 !== void 0 ? _6 : [] }, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.props, (_7 = value === null || value === void 0 ? void 0 : value.item) === null || _7 === void 0 ? void 0 : _7.props, { event: ((_8 = value === null || value === void 0 ? void 0 : value.item) === null || _8 === void 0 ? void 0 : _8.event) || {}, schema: schema, id: value === null || value === void 0 ? void 0 : value.id, key: value === null || value === void 0 ? void 0 : value.id, recData: rec, isExternalLink: isExternalLink, index: index, isActive: isActive })));
|
53
58
|
}
|
54
59
|
else {
|
55
60
|
return null;
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import { __awaiter } from "tslib";
|
1
2
|
import React, { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
2
3
|
import { useSwiperSlide } from 'swiper/react';
|
3
4
|
import { useIconLink } from '../useIconLink';
|
@@ -6,6 +7,7 @@ import { useSxpDataSource } from '../../../../core/hooks';
|
|
6
7
|
import SXP_EVENT_BUS, { SXP_EVENT_TYPE } from '../../../../core/utils/event';
|
7
8
|
import loading_gif from './loading.gif';
|
8
9
|
import { mountVideoPlayerAtNode } from './VideoPlayer';
|
10
|
+
import { getResFileSizeFromSrc } from '../../../../core/utils/tool';
|
9
11
|
const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostConfig, videoPlayIcon }) => {
|
10
12
|
const [isPauseVideo, setIsPauseVideo] = useState(false);
|
11
13
|
const { bffEventReport, sxpParameter, waterFallData, openHashtag, bffFbReport } = useSxpDataSource();
|
@@ -20,6 +22,7 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
20
22
|
const videoId = `pb-cache-video-${index}`;
|
21
23
|
const videoEleRef = useRef(null);
|
22
24
|
const hlsRef = useRef(null);
|
25
|
+
const initTimeRef = useRef();
|
23
26
|
const blur = useMemo(() => {
|
24
27
|
return (videoPostConfig === null || videoPostConfig === void 0 ? void 0 : videoPostConfig.mode) === '2';
|
25
28
|
}, [videoPostConfig]);
|
@@ -65,8 +68,8 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
65
68
|
setWaiting(false);
|
66
69
|
setIsLoadFinish(true);
|
67
70
|
}, []);
|
68
|
-
const handleStartPlay = useCallback(() => {
|
69
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
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;
|
70
73
|
if (!(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current))
|
71
74
|
return;
|
72
75
|
setIsPauseVideo(false);
|
@@ -76,24 +79,27 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
76
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);
|
77
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);
|
78
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);
|
79
83
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
80
84
|
eventInfo: {
|
81
85
|
eventSubject: 'playVideo',
|
82
86
|
eventDescription: 'User played the video',
|
83
|
-
contentId: (
|
84
|
-
contentName: (
|
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 : '',
|
85
89
|
playType,
|
86
90
|
startTime: videoCurrentTime,
|
87
91
|
videoDuration,
|
88
|
-
contentTags: JSON.stringify((
|
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 : []),
|
89
93
|
position: index + '',
|
90
94
|
contentFormat: 'video',
|
91
|
-
traceInfo: (
|
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) + ''
|
92
98
|
}
|
93
99
|
});
|
94
100
|
setIsFirstPlay(false);
|
95
101
|
}
|
96
|
-
}, [bffEventReport, data, index, isFirstPlay, videoRef === null || videoRef === void 0 ? void 0 : videoRef.current]);
|
102
|
+
}), [bffEventReport, data, index, isFirstPlay, videoRef === null || videoRef === void 0 ? void 0 : videoRef.current]);
|
97
103
|
const handLoadeddata = useCallback(() => {
|
98
104
|
var _a;
|
99
105
|
if (!(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) || firstFrameSrc || !blur)
|
@@ -197,6 +203,7 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
197
203
|
videoRef.current = mountVideoPlayerAtNode === null || mountVideoPlayerAtNode === void 0 ? void 0 : mountVideoPlayerAtNode(videoPlayerWrapperNode);
|
198
204
|
if (!(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current))
|
199
205
|
return;
|
206
|
+
initTimeRef.current = new Date();
|
200
207
|
const Hls = window === null || window === void 0 ? void 0 : window.Hls;
|
201
208
|
let hls = hlsRef === null || hlsRef === void 0 ? void 0 : hlsRef.current;
|
202
209
|
if (videoSrc.includes('.m3u8') && Hls && Hls.isSupported()) {
|
@@ -240,7 +247,7 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
240
247
|
};
|
241
248
|
}, [isActive]);
|
242
249
|
useEffect(() => {
|
243
|
-
var _a, _b, _c, _d;
|
250
|
+
var _a, _b, _c, _d, _e, _f;
|
244
251
|
if (!(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) || !isLoadFinish)
|
245
252
|
return;
|
246
253
|
if (isActive) {
|
@@ -248,10 +255,14 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
248
255
|
eventName: 'ViewContent',
|
249
256
|
product: (_b = (_a = data === null || data === void 0 ? void 0 : data[index]) === null || _a === void 0 ? void 0 : _a.video) === null || _b === void 0 ? void 0 : _b.bindProduct
|
250
257
|
});
|
251
|
-
|
258
|
+
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
259
|
+
eventName: 'PageView',
|
260
|
+
product: (_d = (_c = data === null || data === void 0 ? void 0 : data[index]) === null || _c === void 0 ? void 0 : _c.video) === null || _d === void 0 ? void 0 : _d.bindProduct
|
261
|
+
});
|
262
|
+
(_e = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _e === void 0 ? void 0 : _e.play();
|
252
263
|
}
|
253
264
|
else {
|
254
|
-
(
|
265
|
+
(_f = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _f === void 0 ? void 0 : _f.pause();
|
255
266
|
}
|
256
267
|
}, [isActive, isLoadFinish, videoRef === null || videoRef === void 0 ? void 0 : videoRef.current]);
|
257
268
|
useEffect(() => {
|
@@ -270,12 +281,7 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
270
281
|
if (!isActive)
|
271
282
|
return;
|
272
283
|
const onShow = () => {
|
273
|
-
var _a, _b;
|
274
284
|
handleClickVideo('start')();
|
275
|
-
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
276
|
-
eventName: 'ViewContent',
|
277
|
-
product: (_b = (_a = data === null || data === void 0 ? void 0 : data[index]) === null || _a === void 0 ? void 0 : _a.video) === null || _b === void 0 ? void 0 : _b.bindProduct
|
278
|
-
});
|
279
285
|
};
|
280
286
|
const onHide = handleClickVideo('pause');
|
281
287
|
SXP_EVENT_BUS.on(SXP_EVENT_TYPE.PAGE_DID_SHOW, onShow);
|
@@ -41,7 +41,8 @@ const WaterfallFlowItem = (props) => {
|
|
41
41
|
product: rec === null || rec === void 0 ? void 0 : rec.product,
|
42
42
|
enableFormattedPrice: (_a = textStyles === null || textStyles === void 0 ? void 0 : textStyles.price) === null || _a === void 0 ? void 0 : _a.enableFormattedPrice,
|
43
43
|
globalConfig,
|
44
|
-
isHiddenDef: true
|
44
|
+
isHiddenDef: true,
|
45
|
+
style: textStyles === null || textStyles === void 0 ? void 0 : textStyles.price
|
45
46
|
});
|
46
47
|
useEffect(() => {
|
47
48
|
const observer = new IntersectionObserver((entries) => {
|
@@ -113,7 +114,7 @@ const WaterfallFlowItem = (props) => {
|
|
113
114
|
__html: setFontForText(title, textStyles === null || textStyles === void 0 ? void 0 : textStyles.title)
|
114
115
|
} }),
|
115
116
|
React.createElement("div", { className: 'list-content-listItem-info-price', style: textStyles === null || textStyles === void 0 ? void 0 : textStyles.price, hidden: !priceText, dangerouslySetInnerHTML: {
|
116
|
-
__html:
|
117
|
+
__html: priceText !== null && priceText !== void 0 ? priceText : ''
|
117
118
|
} }))));
|
118
119
|
};
|
119
120
|
export default function WaterfallList(_a) {
|
@@ -64,7 +64,8 @@ const WaterfallFlowItem = (props) => {
|
|
64
64
|
product: rec === null || rec === void 0 ? void 0 : rec.product,
|
65
65
|
enableFormattedPrice: (_a = textStyles === null || textStyles === void 0 ? void 0 : textStyles.price) === null || _a === void 0 ? void 0 : _a.enableFormattedPrice,
|
66
66
|
globalConfig,
|
67
|
-
isHiddenDef: true
|
67
|
+
isHiddenDef: true,
|
68
|
+
style: textStyles === null || textStyles === void 0 ? void 0 : textStyles.price
|
68
69
|
});
|
69
70
|
useEffect(() => {
|
70
71
|
if (imgDom.current === null || src === '') {
|
@@ -105,7 +106,7 @@ const WaterfallFlowItem = (props) => {
|
|
105
106
|
__html: setFontForText(title, textStyles === null || textStyles === void 0 ? void 0 : textStyles.title)
|
106
107
|
} }),
|
107
108
|
React.createElement("div", { className: 'waterFallList-content-listItem-info-price', hidden: !priceText, style: textStyles.price, dangerouslySetInnerHTML: {
|
108
|
-
__html:
|
109
|
+
__html: priceText !== null && priceText !== void 0 ? priceText : ''
|
109
110
|
} }))));
|
110
111
|
};
|
111
112
|
export default function WaterfallList(_a) {
|
@@ -86,7 +86,6 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
86
86
|
if (document.visibilityState === 'hidden') {
|
87
87
|
if (repCond) {
|
88
88
|
SXP_EVENT_BUS.emit(SXP_EVENT_TYPE.PAGE_DID_HIDE, item);
|
89
|
-
handleReportViewImageEnd(item);
|
90
89
|
handleReportProductView(item);
|
91
90
|
}
|
92
91
|
let fromKName = '';
|
@@ -130,7 +129,6 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
130
129
|
}
|
131
130
|
handleH5EnterLink();
|
132
131
|
if (repCond) {
|
133
|
-
handleViewImageStartEvent(activeIndex);
|
134
132
|
SXP_EVENT_BUS.emit(SXP_EVENT_TYPE.PAGE_DID_SHOW, item);
|
135
133
|
backMainFeed('external', selectTag);
|
136
134
|
}
|
@@ -215,7 +213,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
215
213
|
return (React.createElement(VideoWidget, { 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 }));
|
216
214
|
}
|
217
215
|
if ((_b = rec === null || rec === void 0 ? void 0 : rec.video) === null || _b === void 0 ? void 0 : _b.imgUrls) {
|
218
|
-
return (React.createElement(PictureGroup, { 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,
|
216
|
+
return (React.createElement(PictureGroup, { 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 }));
|
219
217
|
}
|
220
218
|
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) {
|
221
219
|
return (_d = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.productPost) === null || _d === void 0 ? void 0 : _d.map((value, idx) => {
|
@@ -289,7 +287,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
289
287
|
if (!(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowLike) || !visible)
|
290
288
|
return;
|
291
289
|
let top = (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIconY) !== null && _a !== void 0 ? _a : 400;
|
292
|
-
if (waterFallData && top < 40) {
|
290
|
+
if (waterFallData && top < 40 && globalConfig.likeIconYPosit === 'top') {
|
293
291
|
top += 40;
|
294
292
|
}
|
295
293
|
if (rec === null || rec === void 0 ? void 0 : rec.video) {
|
@@ -301,7 +299,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
301
299
|
}
|
302
300
|
return null;
|
303
301
|
}, [globalConfig, waterFallData]);
|
304
|
-
const
|
302
|
+
const handleViewImageStartEnd = (item) => {
|
305
303
|
var _a, _b, _c, _d, _e, _f;
|
306
304
|
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)) {
|
307
305
|
const endTime = Date.now();
|
@@ -359,7 +357,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
359
357
|
}
|
360
358
|
};
|
361
359
|
const handleScrollEvent = (swiper) => {
|
362
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
360
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
363
361
|
const item = data[swiper.previousIndex];
|
364
362
|
if (!item)
|
365
363
|
return;
|
@@ -380,10 +378,11 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
380
378
|
productId: (_g = (_f = item === null || item === void 0 ? void 0 : item.product) === null || _f === void 0 ? void 0 : _f.itemId) !== null && _g !== void 0 ? _g : '',
|
381
379
|
requestId: null,
|
382
380
|
traceInfo: (_j = (_h = item === null || item === void 0 ? void 0 : item.video) === null || _h === void 0 ? void 0 : _h.traceInfo) !== null && _j !== void 0 ? _j : '',
|
383
|
-
contentFormat
|
381
|
+
contentFormat,
|
382
|
+
position: ((_k = swiper.previousIndex) !== null && _k !== void 0 ? _k : 0) + ''
|
384
383
|
}
|
385
384
|
});
|
386
|
-
|
385
|
+
handleViewImageStartEnd(item);
|
387
386
|
handleSlideSkip(item, swiper.previousIndex);
|
388
387
|
}
|
389
388
|
else {
|
@@ -391,14 +390,15 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
391
390
|
eventInfo: {
|
392
391
|
eventSubject: 'scrollUp',
|
393
392
|
eventDescription: 'User scroll up',
|
394
|
-
contentId: (
|
395
|
-
productId: (
|
393
|
+
contentId: (_m = (_l = item === null || item === void 0 ? void 0 : item.video) === null || _l === void 0 ? void 0 : _l.itemId) !== null && _m !== void 0 ? _m : '',
|
394
|
+
productId: (_p = (_o = item.product) === null || _o === void 0 ? void 0 : _o.itemId) !== null && _p !== void 0 ? _p : '',
|
396
395
|
requestId: null,
|
397
|
-
traceInfo: (
|
398
|
-
contentFormat
|
396
|
+
traceInfo: (_r = (_q = item === null || item === void 0 ? void 0 : item.video) === null || _q === void 0 ? void 0 : _q.traceInfo) !== null && _r !== void 0 ? _r : '',
|
397
|
+
contentFormat,
|
398
|
+
position: ((_s = swiper.previousIndex) !== null && _s !== void 0 ? _s : 0) + ''
|
399
399
|
}
|
400
400
|
});
|
401
|
-
|
401
|
+
handleViewImageStartEnd(item);
|
402
402
|
}
|
403
403
|
handleReportProductView(item);
|
404
404
|
viewTime.current = new Date();
|
@@ -418,7 +418,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
418
418
|
viewTime.current = new Date();
|
419
419
|
}
|
420
420
|
}, [openHashtag, data, activeIndex]);
|
421
|
-
const handleViewImageStartEvent = (activeIndex) => {
|
421
|
+
const handleViewImageStartEvent = (activeIndex, imgInfo, enableCapi) => {
|
422
422
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
423
423
|
const item = data[activeIndex];
|
424
424
|
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)) {
|
@@ -434,32 +434,40 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
434
434
|
contentTags: JSON.stringify((_f = item === null || item === void 0 ? void 0 : item.video.tags) !== null && _f !== void 0 ? _f : []),
|
435
435
|
position: activeIndex + '',
|
436
436
|
contentFormat: 'image',
|
437
|
-
traceInfo: item === null || item === void 0 ? void 0 : item.video.traceInfo
|
437
|
+
traceInfo: item === null || item === void 0 ? void 0 : item.video.traceInfo,
|
438
|
+
contentSize: imgInfo === null || imgInfo === void 0 ? void 0 : imgInfo.contentSize,
|
439
|
+
loadTime: imgInfo === null || imgInfo === void 0 ? void 0 : imgInfo.loadTime
|
438
440
|
}
|
439
441
|
});
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
442
|
+
if (enableCapi) {
|
443
|
+
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
444
|
+
eventName: 'ViewContent',
|
445
|
+
product: (_g = item === null || item === void 0 ? void 0 : item.video) === null || _g === void 0 ? void 0 : _g.bindProduct
|
446
|
+
});
|
447
|
+
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
448
|
+
eventName: 'PageView',
|
449
|
+
product: (_h = item === null || item === void 0 ? void 0 : item.video) === null || _h === void 0 ? void 0 : _h.bindProduct
|
450
|
+
});
|
451
|
+
}
|
448
452
|
}
|
449
453
|
};
|
450
454
|
const renderToggleButton = useCallback((visible) => {
|
451
455
|
var _a, _b, _c, _d, _e, _f;
|
452
456
|
if (!visible)
|
453
457
|
return;
|
458
|
+
let top = (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconY) !== null && _a !== void 0 ? _a : 23;
|
459
|
+
if (waterFallData && top < 40 && (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconYPosit) === 'top') {
|
460
|
+
top += 40;
|
461
|
+
}
|
454
462
|
return (((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowMute) === undefined || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowMute) === true) && (React.createElement(ToggleButton, { style: {
|
455
463
|
position: (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconFixed) ? 'fixed' : 'absolute',
|
456
|
-
visibility: ((
|
464
|
+
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',
|
457
465
|
zIndex: 999,
|
458
466
|
transform: 'translate3d(0px,0px,0px)',
|
459
|
-
[(
|
460
|
-
[(
|
467
|
+
[(_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,
|
468
|
+
[(_f = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconYPosit) !== null && _f !== void 0 ? _f : 'bottom']: top
|
461
469
|
}, 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 })));
|
462
|
-
}, [globalConfig, visList, activeIndex, isMuted]);
|
470
|
+
}, [globalConfig, visList, activeIndex, isMuted, waterFallData]);
|
463
471
|
const renderView = useMemo(() => {
|
464
472
|
if (loading) {
|
465
473
|
return (React.createElement("div", { style: { height, width: containerWidth, display: 'flex', justifyContent: 'center', alignItems: 'center' } },
|
@@ -492,7 +500,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
492
500
|
renderToggleButton
|
493
501
|
]);
|
494
502
|
return (React.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` })) },
|
495
|
-
waterFallData && (React.createElement(Navbar, { icon: left, 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: () => {
|
503
|
+
waterFallData && (React.createElement(Navbar, { icon: left, 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: () => {
|
496
504
|
const isEq = isEqual(rtcList, cacheRtcList);
|
497
505
|
if (!isEq && cacheRtcList && (cacheRtcList === null || cacheRtcList === void 0 ? void 0 : cacheRtcList.length)) {
|
498
506
|
setRtcList === null || setRtcList === void 0 ? void 0 : setRtcList(cacheRtcList);
|
@@ -190,17 +190,20 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
190
190
|
});
|
191
191
|
}, [bffFetch, curReqInfo, enableReportEvent, globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview]);
|
192
192
|
const bffFbReport = useCallback(({ eventName, product }) => {
|
193
|
-
var _a, _b, _c, _d;
|
194
|
-
if (!enableReportEvent ||
|
193
|
+
var _a, _b, _c, _d, _e;
|
194
|
+
if (!enableReportEvent ||
|
195
|
+
!enabledMetaConversionApi ||
|
196
|
+
(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview) ||
|
197
|
+
!((_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.converApi) === null || _a === void 0 ? void 0 : _a[eventName])) {
|
195
198
|
return;
|
196
199
|
}
|
197
|
-
let jsonParams = (
|
200
|
+
let jsonParams = JSON.parse(JSON.stringify((_b = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.converApi) === null || _b === void 0 ? void 0 : _b[eventName]));
|
198
201
|
const urlParams = new URLSearchParams(window.location.search);
|
199
202
|
const fbclid = urlParams === null || urlParams === void 0 ? void 0 : urlParams.get('fbclid');
|
200
203
|
const fix_par = {
|
201
|
-
event_source_url: (
|
204
|
+
event_source_url: (_c = window === null || window === void 0 ? void 0 : window.location) === null || _c === void 0 ? void 0 : _c.href,
|
202
205
|
external_id: storeAndLoadFeUserId(),
|
203
|
-
client_user_agent: (
|
206
|
+
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 : '',
|
204
207
|
fbc: fbclid ? `fb.2.${new Date().getTime()}.${fbclid}` : '',
|
205
208
|
fbp: getCookie('_fbp') ? `fb.2.${new Date().getTime()}.${getCookie('_fbp')}` : '',
|
206
209
|
time: new Date().getTime()
|
@@ -225,7 +228,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
225
228
|
matches.forEach((match) => {
|
226
229
|
const prop = match.substring(2, match.length - 2);
|
227
230
|
try {
|
228
|
-
|
231
|
+
let replaceValue = new Function('fix_par', 'product', `return ${prop}`)(fix_par, product);
|
229
232
|
if (replaceValue) {
|
230
233
|
obj[key] = replaceValue;
|
231
234
|
}
|
@@ -11,9 +11,15 @@ export declare const getBgStyleByImg: (data: any) => "" | {
|
|
11
11
|
backgroundRepeat: string;
|
12
12
|
backgroundSize: string;
|
13
13
|
};
|
14
|
-
|
14
|
+
interface IfontType {
|
15
|
+
'fontFamily-cn': string;
|
16
|
+
'fontFamily-en': string;
|
17
|
+
}
|
18
|
+
export declare const getPriceText: ({ product, enableFormattedPrice, globalConfig, isHiddenDef, style }: {
|
15
19
|
product: ProductInfoType | undefined | null;
|
16
20
|
enableFormattedPrice: boolean | undefined;
|
17
21
|
globalConfig: ISxpPageRenderProps['globalConfig'];
|
18
22
|
isHiddenDef?: boolean;
|
23
|
+
style?: IfontType | any;
|
19
24
|
}) => string | null;
|
25
|
+
export {};
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import { setFontForText } from './tool';
|
1
2
|
export const getMediaValueByMode = (obj) => {
|
2
3
|
var _a;
|
3
4
|
if (!obj || typeof obj !== 'object') {
|
@@ -29,8 +30,8 @@ export const getBgStyleByImg = (data) => {
|
|
29
30
|
const imgSrc = typeof bgImg === 'string' ? bgImg : getMediaValueByMode(bgImg);
|
30
31
|
return getBgStyle(imgSrc);
|
31
32
|
};
|
32
|
-
export const getPriceText = ({ product, enableFormattedPrice, globalConfig, isHiddenDef }) => {
|
33
|
-
var _a, _b, _c, _d, _e;
|
33
|
+
export const getPriceText = ({ product, enableFormattedPrice, globalConfig, isHiddenDef, style }) => {
|
34
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
34
35
|
if ((!(product === null || product === void 0 ? void 0 : product.currency) || !(product === null || product === void 0 ? void 0 : product.price)) && isHiddenDef)
|
35
36
|
return null;
|
36
37
|
let price = (product === null || product === void 0 ? void 0 : product.currency) && (product === null || product === void 0 ? void 0 : product.price) ? product === null || product === void 0 ? void 0 : product.price : 7000;
|
@@ -77,6 +78,8 @@ export const getPriceText = ({ product, enableFormattedPrice, globalConfig, isHi
|
|
77
78
|
}
|
78
79
|
});
|
79
80
|
}
|
81
|
+
currency = `<span style="font-family:${(_h = (_g = (_f = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.priceSymbol) === null || _f === void 0 ? void 0 : _f.fontFamily) !== null && _g !== void 0 ? _g : style === null || style === void 0 ? void 0 : style['fontFamily-en']) !== null && _h !== void 0 ? _h : 'inherit'}">${currency}</span>`;
|
82
|
+
text = setFontForText(text, style);
|
80
83
|
if ((priceSymbol === null || priceSymbol === void 0 ? void 0 : priceSymbol.currencyPosition) && (priceSymbol === null || priceSymbol === void 0 ? void 0 : priceSymbol.currencyPosition) !== 'none') {
|
81
84
|
text = (priceSymbol === null || priceSymbol === void 0 ? void 0 : priceSymbol.currencyPosition) === 'left' ? currency + text : text + currency;
|
82
85
|
}
|
package/es/core/utils/tool.d.ts
CHANGED
@@ -11,4 +11,5 @@ 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
|
-
|
14
|
+
declare const getResFileSizeFromSrc: (imageSrc?: string) => "" | Promise<string>;
|
15
|
+
export { uuid, getIndexByblockType, getBrowserInfo, getDevice, getSystem, getCookie, getResFileSizeFromSrc };
|
package/es/core/utils/tool.js
CHANGED
@@ -156,4 +156,14 @@ function getCookie(val) {
|
|
156
156
|
});
|
157
157
|
return value !== null && value !== void 0 ? value : '';
|
158
158
|
}
|
159
|
-
|
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 };
|
@@ -9,6 +9,7 @@ declare const _default: ({
|
|
9
9
|
addonAfter: string;
|
10
10
|
}[];
|
11
11
|
name?: undefined;
|
12
|
+
addonAfter?: undefined;
|
12
13
|
direction?: undefined;
|
13
14
|
} | {
|
14
15
|
type: string;
|
@@ -25,12 +26,21 @@ declare const _default: ({
|
|
25
26
|
max: number;
|
26
27
|
})[];
|
27
28
|
name?: undefined;
|
29
|
+
addonAfter?: undefined;
|
28
30
|
direction?: undefined;
|
29
31
|
} | {
|
30
32
|
type: string;
|
31
33
|
label: string;
|
32
34
|
name: string[];
|
33
35
|
child?: undefined;
|
36
|
+
addonAfter?: undefined;
|
37
|
+
direction?: undefined;
|
38
|
+
} | {
|
39
|
+
type: string;
|
40
|
+
label: string;
|
41
|
+
name: string[];
|
42
|
+
addonAfter: string;
|
43
|
+
child?: undefined;
|
34
44
|
direction?: undefined;
|
35
45
|
} | {
|
36
46
|
type: string;
|
@@ -38,6 +48,7 @@ declare const _default: ({
|
|
38
48
|
label: string;
|
39
49
|
direction: string;
|
40
50
|
child?: undefined;
|
51
|
+
addonAfter?: undefined;
|
41
52
|
})[];
|
42
53
|
} | {
|
43
54
|
title: string;
|