pb-sxp-ui 1.2.3 → 1.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +276 -172
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +2 -2
- package/dist/index.js +276 -172
- 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 +276 -172
- 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/Hashtag/index.js +0 -1
- package/es/core/components/SxpPageRender/LikeButton/index.js +34 -15
- package/es/core/components/SxpPageRender/Modal/index.js +16 -8
- package/es/core/components/SxpPageRender/Popup/index.js +24 -13
- package/es/core/components/SxpPageRender/RenderCard.d.ts +1 -0
- package/es/core/components/SxpPageRender/RenderCard.js +17 -4
- package/es/core/components/SxpPageRender/index.js +3 -3
- package/es/core/components/SxpPageRender/typing.d.ts +1 -0
- package/es/core/context/SxpDataSourceProvider.d.ts +3 -3
- package/es/core/context/SxpDataSourceProvider.js +7 -3
- package/es/materials/sxp/cta/AniLink/index.js +5 -1
- package/es/materials/sxp/cta/AniLinkPopup/index.d.ts +1 -0
- package/es/materials/sxp/cta/AniLinkPopup/index.js +12 -18
- package/es/materials/sxp/cta/AniLinkPopup/settingRender.js +1 -1
- package/es/materials/sxp/popup/CommodityDetail/index.js +25 -13
- package/es/materials/sxp/popup/CommodityDetailDiroNew/index.js +28 -17
- package/es/materials/sxp/popup/CommodityList/index.js +28 -10
- package/es/materials/sxp/popup/CommodityList/material.js +1 -0
- package/es/materials/sxp/popup/CommodityList/settingRender.js +5 -0
- package/es/materials/sxp/template/MultiCommodity/index.js +3 -3
- package/es/materials/sxp/template/MultiCommodityDiro/index.js +3 -3
- package/es/materials/sxp/template/components/CommodityGroup.d.ts +4 -0
- package/es/materials/sxp/template/components/CommodityGroup.js +12 -15
- package/es/materials/sxp/template/components/Img.d.ts +1 -0
- package/es/materials/sxp/template/components/Img.js +3 -3
- package/es/materials/sxp/template/components/Scroll.d.ts +1 -0
- package/es/materials/sxp/template/components/Scroll.js +5 -4
- package/lib/core/components/SxpPageRender/Hashtag/index.js +0 -1
- package/lib/core/components/SxpPageRender/LikeButton/index.js +34 -15
- package/lib/core/components/SxpPageRender/Modal/index.js +16 -8
- package/lib/core/components/SxpPageRender/Popup/index.js +23 -12
- package/lib/core/components/SxpPageRender/RenderCard.d.ts +1 -0
- package/lib/core/components/SxpPageRender/RenderCard.js +17 -4
- package/lib/core/components/SxpPageRender/index.js +3 -3
- package/lib/core/components/SxpPageRender/typing.d.ts +1 -0
- package/lib/core/context/SxpDataSourceProvider.d.ts +3 -3
- package/lib/core/context/SxpDataSourceProvider.js +7 -3
- package/lib/materials/sxp/cta/AniLink/index.js +5 -1
- package/lib/materials/sxp/cta/AniLinkPopup/index.d.ts +1 -0
- package/lib/materials/sxp/cta/AniLinkPopup/index.js +11 -17
- package/lib/materials/sxp/cta/AniLinkPopup/settingRender.js +1 -1
- package/lib/materials/sxp/popup/CommodityDetail/index.js +24 -12
- package/lib/materials/sxp/popup/CommodityDetailDiroNew/index.js +28 -17
- package/lib/materials/sxp/popup/CommodityList/index.js +27 -9
- package/lib/materials/sxp/popup/CommodityList/material.js +1 -0
- package/lib/materials/sxp/popup/CommodityList/settingRender.js +5 -0
- package/lib/materials/sxp/template/MultiCommodity/index.js +3 -3
- package/lib/materials/sxp/template/MultiCommodityDiro/index.js +3 -3
- package/lib/materials/sxp/template/components/CommodityGroup.d.ts +4 -0
- package/lib/materials/sxp/template/components/CommodityGroup.js +11 -14
- package/lib/materials/sxp/template/components/Img.d.ts +1 -0
- package/lib/materials/sxp/template/components/Img.js +3 -3
- package/lib/materials/sxp/template/components/Scroll.d.ts +1 -0
- package/lib/materials/sxp/template/components/Scroll.js +5 -4
- package/package.json +1 -1
@@ -36,7 +36,6 @@ const Hashtag = ({ tags, itemId, itemType, index, rec, hashTagStyle }) => {
|
|
36
36
|
}
|
37
37
|
return (React.createElement("span", { style: { textDecoration: 'underline', cursor: 'pointer', color: '#fff' }, onClick: () => setIsShowMore(!isShowMore) }, isShowMore ? 'show less' : 'show more'));
|
38
38
|
}, [isShowMore, tags]);
|
39
|
-
console.log(hashTagStyle, '111');
|
40
39
|
return (React.createElement("div", { className: 'clc-sxp-bottom-hashtag', style: { marginTop: `${(_a = hashTagStyle === null || hashTagStyle === void 0 ? void 0 : hashTagStyle.marginTop) !== null && _a !== void 0 ? _a : 16}px` } },
|
41
40
|
React.createElement(Scroll, null, tags === null || tags === void 0 ? void 0 : tags.map((item, index) => (React.createElement(SwiperSlide, { key: index, hidden: !isShowMore ? index >= 6 : false, className: 'clc-sxp-bottom-hashtag-item', style: hashTagStyle, onClick: () => handleClickTag(item) },
|
42
41
|
React.createElement("div", { dangerouslySetInnerHTML: { __html: setFontForText(`#${item}`, hashTagStyle) } })))))));
|
@@ -6,50 +6,69 @@ import { useSxpDataSource } from '../../../../core/hooks';
|
|
6
6
|
const defaultUnLikeIconPath = '/pb_static/f71266d2c64446c5ae6a5a7f5489cc0a.png';
|
7
7
|
const defaultLikeIconPath = '/pb_static/f07900fe3f0f4ae188ea1611d4801a44.png';
|
8
8
|
const LikeButton = (_a) => {
|
9
|
+
var _b;
|
9
10
|
var { active, activeIcon, unActicveIcon, recData, position } = _a, props = __rest(_a, ["active", "activeIcon", "unActicveIcon", "recData", "position"]);
|
10
|
-
const { mutateLike, mutateUnlike, bffEventReport } = useSxpDataSource();
|
11
|
-
const [state, setState] = useState(
|
11
|
+
const { mutateLike, mutateUnlike, bffEventReport, setCacheRtcList, cacheRtcList } = useSxpDataSource();
|
12
|
+
const [state, setState] = useState((_b = cacheRtcList === null || cacheRtcList === void 0 ? void 0 : cacheRtcList[position]) === null || _b === void 0 ? void 0 : _b.isCollected);
|
12
13
|
const likeIcon = useIconLink(defaultLikeIconPath);
|
13
14
|
const unlikeIcon = useIconLink(defaultUnLikeIconPath);
|
14
15
|
const handleClick = debounce(() => __awaiter(void 0, void 0, void 0, function* () {
|
15
|
-
var
|
16
|
+
var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
|
16
17
|
if (state) {
|
17
18
|
setState(false);
|
18
|
-
const result = (
|
19
|
+
const result = (_e = (yield (mutateUnlike === null || mutateUnlike === void 0 ? void 0 : mutateUnlike({ videoItemId: (_d = (_c = recData === null || recData === void 0 ? void 0 : recData.video) === null || _c === void 0 ? void 0 : _c.itemId) !== null && _d !== void 0 ? _d : '' })))) !== null && _e !== void 0 ? _e : false;
|
19
20
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
20
21
|
eventInfo: {
|
21
22
|
eventSubject: 'favoriteContentCanceled',
|
22
23
|
eventDescription: 'This content was unfavorite by the user',
|
23
|
-
contentId: (
|
24
|
-
contentName: (
|
25
|
-
contentTags: JSON.stringify((
|
24
|
+
contentId: (_g = (_f = recData === null || recData === void 0 ? void 0 : recData.video) === null || _f === void 0 ? void 0 : _f.itemId) !== null && _g !== void 0 ? _g : '',
|
25
|
+
contentName: (_j = (_h = recData === null || recData === void 0 ? void 0 : recData.video) === null || _h === void 0 ? void 0 : _h.title) !== null && _j !== void 0 ? _j : '',
|
26
|
+
contentTags: JSON.stringify((_l = (_k = recData === null || recData === void 0 ? void 0 : recData.video) === null || _k === void 0 ? void 0 : _k.tags) !== null && _l !== void 0 ? _l : []),
|
26
27
|
position: position + '',
|
27
|
-
contentFormat: ((
|
28
|
-
traceInfo: (
|
28
|
+
contentFormat: ((_m = recData === null || recData === void 0 ? void 0 : recData.video) === null || _m === void 0 ? void 0 : _m.url) ? 'video' : 'image',
|
29
|
+
traceInfo: (_o = recData === null || recData === void 0 ? void 0 : recData.video) === null || _o === void 0 ? void 0 : _o.traceInfo
|
29
30
|
}
|
30
31
|
});
|
31
32
|
if (!result) {
|
32
33
|
setState(true);
|
33
34
|
}
|
35
|
+
else {
|
36
|
+
const nRtcList = (_p = cacheRtcList === null || cacheRtcList === void 0 ? void 0 : cacheRtcList.map((item, index) => {
|
37
|
+
if (index === position) {
|
38
|
+
item.isCollected = false;
|
39
|
+
}
|
40
|
+
return item;
|
41
|
+
})) !== null && _p !== void 0 ? _p : [];
|
42
|
+
setCacheRtcList === null || setCacheRtcList === void 0 ? void 0 : setCacheRtcList(nRtcList);
|
43
|
+
}
|
34
44
|
}
|
35
45
|
else {
|
36
46
|
setState(true);
|
37
|
-
const result = (
|
47
|
+
const result = (_q = (yield (mutateLike === null || mutateLike === void 0 ? void 0 : mutateLike({ content: JSON.stringify(recData) })))) !== null && _q !== void 0 ? _q : false;
|
38
48
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
39
49
|
eventInfo: {
|
40
50
|
eventSubject: 'favoriteContent',
|
41
51
|
eventDescription: 'This content was favorite by the user',
|
42
|
-
contentId: (
|
43
|
-
contentName: (
|
44
|
-
contentTags: JSON.stringify((
|
52
|
+
contentId: (_s = (_r = recData === null || recData === void 0 ? void 0 : recData.video) === null || _r === void 0 ? void 0 : _r.itemId) !== null && _s !== void 0 ? _s : '',
|
53
|
+
contentName: (_u = (_t = recData === null || recData === void 0 ? void 0 : recData.video) === null || _t === void 0 ? void 0 : _t.title) !== null && _u !== void 0 ? _u : '',
|
54
|
+
contentTags: JSON.stringify((_w = (_v = recData === null || recData === void 0 ? void 0 : recData.video) === null || _v === void 0 ? void 0 : _v.tags) !== null && _w !== void 0 ? _w : []),
|
45
55
|
position: position + '',
|
46
|
-
contentFormat: ((
|
47
|
-
traceInfo: (
|
56
|
+
contentFormat: ((_x = recData === null || recData === void 0 ? void 0 : recData.video) === null || _x === void 0 ? void 0 : _x.url) ? 'video' : 'image',
|
57
|
+
traceInfo: (_y = recData === null || recData === void 0 ? void 0 : recData.video) === null || _y === void 0 ? void 0 : _y.traceInfo
|
48
58
|
}
|
49
59
|
});
|
50
60
|
if (!result) {
|
51
61
|
setState(false);
|
52
62
|
}
|
63
|
+
else {
|
64
|
+
const nRtcList = (_z = cacheRtcList === null || cacheRtcList === void 0 ? void 0 : cacheRtcList.map((item, index) => {
|
65
|
+
if (index === position) {
|
66
|
+
item.isCollected = true;
|
67
|
+
}
|
68
|
+
return item;
|
69
|
+
})) !== null && _z !== void 0 ? _z : [];
|
70
|
+
setCacheRtcList === null || setCacheRtcList === void 0 ? void 0 : setCacheRtcList(nRtcList);
|
71
|
+
}
|
53
72
|
}
|
54
73
|
}), 200);
|
55
74
|
return (React.createElement("button", Object.assign({}, props, { "aria-label": 'like', onClick: handleClick }),
|
@@ -54,19 +54,23 @@ const Modal = ({ visible, onClose, children, modalStyle, padding, popup, schema,
|
|
54
54
|
onClose === null || onClose === void 0 ? void 0 : onClose();
|
55
55
|
}, 300);
|
56
56
|
const handleTouchStart = (event) => {
|
57
|
-
event.
|
58
|
-
|
59
|
-
fTouchRef.current = event.touches[0].clientY;
|
57
|
+
touchRef.current = event.touches[0];
|
58
|
+
fTouchRef.current = event.touches[0];
|
60
59
|
touchMoveRef.current = true;
|
61
60
|
};
|
62
61
|
const handleTouchMove = (event) => {
|
63
|
-
event.stopPropagation();
|
64
62
|
requestAnimationFrame(() => {
|
65
63
|
var _a;
|
66
64
|
if (touchMoveRef.current && ((_a = ref === null || ref === void 0 ? void 0 : ref.current) === null || _a === void 0 ? void 0 : _a.scrollTop) === 0) {
|
67
65
|
const currentY = event.touches[0].clientY;
|
68
|
-
const
|
69
|
-
touchRef.current
|
66
|
+
const currentX = event.touches[0].clientX;
|
67
|
+
const diff = touchRef.current.clientY - currentY;
|
68
|
+
touchRef.current = event.touches[0];
|
69
|
+
const diffY = currentY - fTouchRef.current.clientY;
|
70
|
+
const diffX = currentX - fTouchRef.current.clientX;
|
71
|
+
if (Math.abs(diffX) > Math.abs(diffY)) {
|
72
|
+
return;
|
73
|
+
}
|
70
74
|
const ts = modalTrans - diff;
|
71
75
|
if (ts > 0) {
|
72
76
|
setModalTrans(ts);
|
@@ -76,9 +80,13 @@ const Modal = ({ visible, onClose, children, modalStyle, padding, popup, schema,
|
|
76
80
|
};
|
77
81
|
const handleTouchEnd = (event) => {
|
78
82
|
var _a;
|
79
|
-
event.stopPropagation();
|
80
83
|
if (touchMoveRef.current && ((_a = ref === null || ref === void 0 ? void 0 : ref.current) === null || _a === void 0 ? void 0 : _a.scrollTop) === 0) {
|
81
|
-
const
|
84
|
+
const diffY = event.changedTouches[0].clientY - fTouchRef.current.clientY;
|
85
|
+
const diffX = event.changedTouches[0].clientX - fTouchRef.current.clientX;
|
86
|
+
if (Math.abs(diffX) > Math.abs(diffY)) {
|
87
|
+
return;
|
88
|
+
}
|
89
|
+
const diff = fTouchRef.current.clientY - touchRef.current.clientY;
|
82
90
|
if (diff > 0) {
|
83
91
|
setModalTrans(0);
|
84
92
|
}
|
@@ -1,17 +1,16 @@
|
|
1
|
-
import React, { useEffect, useMemo,
|
1
|
+
import React, { useEffect, useMemo, useState } from 'react';
|
2
2
|
import Modal from '../Modal';
|
3
3
|
import { useEditor, useSxpDataSource } from '../../../../core/hooks';
|
4
4
|
import withBindDataSource from '../../../../core/hoc/withBindDataSource';
|
5
5
|
import { useEventReport } from '../../../../core/hooks/useEventReport';
|
6
6
|
const Popup = () => {
|
7
7
|
const { schema, resolver, popup } = useEditor();
|
8
|
-
const { setPopupDetailData, popupDetailData,
|
8
|
+
const { setPopupDetailData, popupDetailData, popupCurTimeRef, checkCommodityIndexRef } = useSxpDataSource();
|
9
9
|
const { productView } = useEventReport();
|
10
10
|
const [visible, setVisible] = useState();
|
11
|
-
const curTimeRef = useRef(null);
|
12
11
|
useEffect(() => {
|
13
12
|
const initTime = () => {
|
14
|
-
|
13
|
+
popupCurTimeRef.current = new Date();
|
15
14
|
};
|
16
15
|
initTime();
|
17
16
|
window.addEventListener('pageshow', initTime);
|
@@ -21,25 +20,37 @@ const Popup = () => {
|
|
21
20
|
}, []);
|
22
21
|
useEffect(() => {
|
23
22
|
if (popup && (popup === null || popup === void 0 ? void 0 : popup.id) && (popup === null || popup === void 0 ? void 0 : popup.id) !== '') {
|
24
|
-
|
23
|
+
popupCurTimeRef.current = new Date();
|
25
24
|
setVisible(popup);
|
26
25
|
}
|
27
26
|
}, [popup]);
|
28
27
|
const handleClose = () => {
|
29
|
-
var _a, _b, _c, _d;
|
30
|
-
if (!popup ||
|
28
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
29
|
+
if (!popup ||
|
30
|
+
(popup === null || popup === void 0 ? void 0 : popup.id) === '' ||
|
31
|
+
!visible ||
|
32
|
+
new Date() - popupCurTimeRef.current < ((_a = popup === null || popup === void 0 ? void 0 : popup.duration) !== null && _a !== void 0 ? _a : 0)) {
|
31
33
|
return;
|
32
34
|
}
|
33
35
|
setVisible(Object.assign(Object.assign({}, popup), { id: '' }));
|
34
|
-
const
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
36
|
+
const value = (_d = (_c = (_b = schema === null || schema === void 0 ? void 0 : schema.sxpPageConf) === null || _b === void 0 ? void 0 : _b.globalConfig) === null || _c === void 0 ? void 0 : _c.popupList) === null || _d === void 0 ? void 0 : _d.find((item) => (item === null || item === void 0 ? void 0 : item.id) === (popup === null || popup === void 0 ? void 0 : popup.id));
|
37
|
+
if (((_e = value === null || value === void 0 ? void 0 : value.item) === null || _e === void 0 ? void 0 : _e.type) === 'CommodityDetail' || ((_f = value === null || value === void 0 ? void 0 : value.item) === null || _f === void 0 ? void 0 : _f.type) === 'CommodityDetailDiroNew') {
|
38
|
+
const data = popupDetailData;
|
39
|
+
let product = (_g = data === null || data === void 0 ? void 0 : data.video) === null || _g === void 0 ? void 0 : _g.bindProduct;
|
40
|
+
let cta = (_j = (_h = data === null || data === void 0 ? void 0 : data.video) === null || _h === void 0 ? void 0 : _h.bindProduct) === null || _j === void 0 ? void 0 : _j.bindCta;
|
41
|
+
if ((checkCommodityIndexRef === null || checkCommodityIndexRef === void 0 ? void 0 : checkCommodityIndexRef.current) >= 0) {
|
42
|
+
const p = (_k = data === null || data === void 0 ? void 0 : data.video) === null || _k === void 0 ? void 0 : _k.bindProducts[checkCommodityIndexRef === null || checkCommodityIndexRef === void 0 ? void 0 : checkCommodityIndexRef.current];
|
43
|
+
product = p;
|
44
|
+
cta = p === null || p === void 0 ? void 0 : p.bindCta;
|
45
|
+
}
|
46
|
+
if (product && cta) {
|
47
|
+
productView(data, product, cta, popupCurTimeRef.current, popupDetailData === null || popupDetailData === void 0 ? void 0 : popupDetailData.index);
|
48
|
+
}
|
39
49
|
}
|
40
50
|
setTimeout(() => {
|
41
51
|
window === null || window === void 0 ? void 0 : window.sxpPopup('');
|
42
52
|
setPopupDetailData === null || setPopupDetailData === void 0 ? void 0 : setPopupDetailData(null);
|
53
|
+
checkCommodityIndexRef.current = -1;
|
43
54
|
}, popup === null || popup === void 0 ? void 0 : popup.duration);
|
44
55
|
};
|
45
56
|
const renderPopupDetail = useMemo(() => {
|
@@ -52,7 +63,7 @@ const Popup = () => {
|
|
52
63
|
const isExternalLink = ((_d = (_c = (_b = value === null || value === void 0 ? void 0 : value.item) === null || _b === void 0 ? void 0 : _b.event) === null || _c === void 0 ? void 0 : _c.onClick) === null || _d === void 0 ? void 0 : _d.linkType) === 'externalLink';
|
53
64
|
const isPopup = ((_g = (_f = (_e = value === null || value === void 0 ? void 0 : value.item) === null || _e === void 0 ? void 0 : _e.event) === null || _f === void 0 ? void 0 : _f.onClick) === null || _g === void 0 ? void 0 : _g.linkType) === 'popup';
|
54
65
|
const defaulSetting = (_h = t === null || t === void 0 ? void 0 : t.extend) === null || _h === void 0 ? void 0 : _h.defaulSetting;
|
55
|
-
return (React.createElement(Component, Object.assign({ key: index, style: Object.assign(Object.assign(Object.assign({}, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.style), (_j = value === null || value === void 0 ? void 0 : value.item) === null || _j === void 0 ? void 0 : _j.style), { width: (_k = window.innerWidth) !== null && _k !== void 0 ? _k : '100vw' }), textStyle: Object.assign(Object.assign({}, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.textStyle), (_l = value === null || value === void 0 ? void 0 : value.item) === null || _l === void 0 ? void 0 : _l.textStyle), bindDatas: (_o = (_m = value === null || value === void 0 ? void 0 : value.item) === null || _m === void 0 ? void 0 : _m.bindDatas) !== null && _o !== void 0 ? _o : [] }, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.props, (_p = value === null || value === void 0 ? void 0 : value.item) === null || _p === void 0 ? void 0 : _p.props, { event: ((_q = value === null || value === void 0 ? void 0 : value.item) === null || _q === void 0 ? void 0 : _q.event) || {}, schema: schema, id: value === null || value === void 0 ? void 0 : value.id, isExternalLink: isExternalLink, isPopup: isPopup, onClose: handleClose })));
|
66
|
+
return (React.createElement(Component, Object.assign({ key: index, style: Object.assign(Object.assign(Object.assign({}, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.style), (_j = value === null || value === void 0 ? void 0 : value.item) === null || _j === void 0 ? void 0 : _j.style), { width: (_k = window.innerWidth) !== null && _k !== void 0 ? _k : '100vw', height: '100%' }), textStyle: Object.assign(Object.assign({}, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.textStyle), (_l = value === null || value === void 0 ? void 0 : value.item) === null || _l === void 0 ? void 0 : _l.textStyle), bindDatas: (_o = (_m = value === null || value === void 0 ? void 0 : value.item) === null || _m === void 0 ? void 0 : _m.bindDatas) !== null && _o !== void 0 ? _o : [] }, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.props, (_p = value === null || value === void 0 ? void 0 : value.item) === null || _p === void 0 ? void 0 : _p.props, { event: ((_q = value === null || value === void 0 ? void 0 : value.item) === null || _q === void 0 ? void 0 : _q.event) || {}, schema: schema, id: value === null || value === void 0 ? void 0 : value.id, isExternalLink: isExternalLink, isPopup: isPopup, onClose: handleClose })));
|
56
67
|
}
|
57
68
|
else {
|
58
69
|
return React.createElement(React.Fragment, null);
|
@@ -2,8 +2,22 @@ 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
|
-
const RenderCard = ({ rec, index, tempMap, resolver, includesCtaType }) => {
|
5
|
+
const RenderCard = ({ rec, index, tempMap, resolver, includesCtaType, isActive }) => {
|
6
|
+
var _a, _b, _c, _d, _e;
|
6
7
|
const { schema } = useEditor();
|
8
|
+
if (!(rec === null || rec === void 0 ? void 0 : rec.video))
|
9
|
+
return null;
|
10
|
+
let cta = null;
|
11
|
+
if ((_b = (_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.bindProducts) === null || _b === void 0 ? void 0 : _b.length) {
|
12
|
+
cta = '多商品CTA';
|
13
|
+
}
|
14
|
+
else if ((_c = rec === null || rec === void 0 ? void 0 : rec.video) === null || _c === void 0 ? void 0 : _c.bindProduct) {
|
15
|
+
cta = '商品CTA';
|
16
|
+
}
|
17
|
+
else {
|
18
|
+
cta = (_e = (_d = rec === null || rec === void 0 ? void 0 : rec.video) === null || _d === void 0 ? void 0 : _d.bindCta) === null || _e === void 0 ? void 0 : _e.itemId;
|
19
|
+
}
|
20
|
+
const value = tempMap === null || tempMap === void 0 ? void 0 : tempMap[cta];
|
7
21
|
const renderComp = useMemo(() => {
|
8
22
|
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, _1, _2, _3, _4, _5, _6, _7, _8;
|
9
23
|
if (!(rec === null || rec === void 0 ? void 0 : rec.video))
|
@@ -18,7 +32,6 @@ const RenderCard = ({ rec, index, tempMap, resolver, includesCtaType }) => {
|
|
18
32
|
else {
|
19
33
|
cta = (_e = (_d = rec === null || rec === void 0 ? void 0 : rec.video) === null || _d === void 0 ? void 0 : _d.bindCta) === null || _e === void 0 ? void 0 : _e.itemId;
|
20
34
|
}
|
21
|
-
const value = tempMap === null || tempMap === void 0 ? void 0 : tempMap[cta];
|
22
35
|
if (includesCtaType && !(includesCtaType === null || includesCtaType === void 0 ? void 0 : includesCtaType.includes((_f = value === null || value === void 0 ? void 0 : value.item) === null || _f === void 0 ? void 0 : _f.type)))
|
23
36
|
return;
|
24
37
|
if (!includesCtaType && ((_g = value === null || value === void 0 ? void 0 : value.item) === null || _g === void 0 ? void 0 : _g.category) === 'cta')
|
@@ -36,12 +49,12 @@ const RenderCard = ({ rec, index, tempMap, resolver, includesCtaType }) => {
|
|
36
49
|
const Component = withBindDataSource(t);
|
37
50
|
const defaulSetting = (_z = t === null || t === void 0 ? void 0 : t.extend) === null || _z === void 0 ? void 0 : _z.defaulSetting;
|
38
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';
|
39
|
-
return (React.createElement(Component, Object.assign({ style: Object.assign(Object.assign(Object.assign({}, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.style), (_3 = value === null || value === void 0 ? void 0 : value.item) === null || _3 === void 0 ? void 0 : _3.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 })));
|
52
|
+
return (React.createElement(Component, Object.assign({ style: Object.assign(Object.assign(Object.assign({}, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.style), (_3 = value === null || value === void 0 ? void 0 : value.item) === null || _3 === void 0 ? void 0 : _3.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 })));
|
40
53
|
}
|
41
54
|
else {
|
42
55
|
return null;
|
43
56
|
}
|
44
|
-
}, [rec, resolver, tempMap, schema]);
|
57
|
+
}, [rec, resolver, tempMap, schema, value === null || value === void 0 ? void 0 : value.id, isActive]);
|
45
58
|
return React.createElement(React.Fragment, null, renderComp);
|
46
59
|
};
|
47
60
|
export default memo(RenderCard);
|
@@ -232,7 +232,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
232
232
|
React.createElement(ExpandableText, { className: 'clc-sxp-bottom-text', isPost: true, foldText: tipText === null || tipText === void 0 ? void 0 : tipText.foldText, unfoldText: tipText === null || tipText === void 0 ? void 0 : tipText.unfoldText, text: (_d = (_c = rec === null || rec === void 0 ? void 0 : rec.video) === null || _c === void 0 ? void 0 : _c.title) !== null && _d !== void 0 ? _d : '', style: Object.assign(Object.assign({}, descStyle), { textShadow: (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isOpenTextShadow) ? '2px 2px 4px rgba(0, 0, 0, 0.5)' : 'none' }), onChange: onExpandableChange }),
|
233
233
|
React.createElement(RenderCard, { rec: rec, index: index, tempMap: tempMap, resolver: resolver, includesCtaType: ['AniLink'] }),
|
234
234
|
React.createElement(Hashtag, { index: activeIndex, tags: (_f = (_e = rec === null || rec === void 0 ? void 0 : rec.video) === null || _e === void 0 ? void 0 : _e.hashTags) !== null && _f !== void 0 ? _f : [], itemId: (_g = rec === null || rec === void 0 ? void 0 : rec.video) === null || _g === void 0 ? void 0 : _g.itemId, itemType: ((_h = rec === null || rec === void 0 ? void 0 : rec.video) === null || _h === void 0 ? void 0 : _h.itemId) ? 'VIDEO' : null, rec: rec, hashTagStyle: hashTagStyle }))),
|
235
|
-
React.createElement(RenderCard, { rec: rec, index: index, tempMap: tempMap, resolver: resolver, includesCtaType: ['AniLinkPopup'] })));
|
235
|
+
React.createElement(RenderCard, { rec: rec, index: index, tempMap: tempMap, resolver: resolver, includesCtaType: ['AniLinkPopup'], isActive: index === activeIndex })));
|
236
236
|
}
|
237
237
|
return null;
|
238
238
|
}, [
|
@@ -287,11 +287,11 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
287
287
|
};
|
288
288
|
const handleSlideSkip = (item, position) => {
|
289
289
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
290
|
-
if (isPreview)
|
290
|
+
if (isPreview || waterFallData)
|
291
291
|
return;
|
292
292
|
const t = new Date() - curTime.current;
|
293
293
|
if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.openSlideSkip) && t >= ((_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.slideSkipStartTime) !== null && _a !== void 0 ? _a : 0) && getSlideSkipState() && item) {
|
294
|
-
const link = ((_c = (_b = item === null || item === void 0 ? void 0 : item.video) === null || _b === void 0 ? void 0 : _b.
|
294
|
+
const link = ((_d = (_c = (_b = item === null || item === void 0 ? void 0 : item.video) === null || _b === void 0 ? void 0 : _b.bindProducts) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.link) || ((_f = (_e = item === null || item === void 0 ? void 0 : item.video) === null || _e === void 0 ? void 0 : _e.bindProduct) === null || _f === void 0 ? void 0 : _f.link) || ((_g = item === null || item === void 0 ? void 0 : item.product) === null || _g === void 0 ? void 0 : _g.link);
|
295
295
|
const product = (item === null || item === void 0 ? void 0 : item.product) || ((_h = item === null || item === void 0 ? void 0 : item.video) === null || _h === void 0 ? void 0 : _h.bindProduct) || ((_k = (_j = item === null || item === void 0 ? void 0 : item.video) === null || _j === void 0 ? void 0 : _j.bindProducts) === null || _k === void 0 ? void 0 : _k[0]);
|
296
296
|
if (link) {
|
297
297
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
@@ -23,9 +23,7 @@ export interface ISxpDataSourceContext {
|
|
23
23
|
mutateLike?: (body: {
|
24
24
|
content: string;
|
25
25
|
}) => Promise<boolean>;
|
26
|
-
popupDetailData?: RecItemType
|
27
|
-
index: number;
|
28
|
-
};
|
26
|
+
popupDetailData?: RecItemType;
|
29
27
|
setPopupDetailData?: React.Dispatch<React.SetStateAction<any | null>>;
|
30
28
|
loadVideos?: (page: number) => Promise<void>;
|
31
29
|
getRecommendVideos?: (query?: {
|
@@ -81,6 +79,8 @@ export interface ISxpDataSourceContext {
|
|
81
79
|
selectTag?: string;
|
82
80
|
setSelectTag?: React.Dispatch<React.SetStateAction<string>>;
|
83
81
|
globalConfig?: ISxpPageRenderProps['globalConfig'];
|
82
|
+
popupCurTimeRef?: any;
|
83
|
+
checkCommodityIndexRef?: any;
|
84
84
|
}
|
85
85
|
export declare const SxpDataSourceContext: React.Context<ISxpDataSourceContext>;
|
86
86
|
export interface SxpDataSourceProviderProps {
|
@@ -34,6 +34,8 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
34
34
|
const themeTag = useRef();
|
35
35
|
const curTime = useRef();
|
36
36
|
const [selectTag, setSelectTag] = useState(DEFAULT_TAG);
|
37
|
+
const checkCommodityIndexRef = useRef();
|
38
|
+
const popupCurTimeRef = useRef(null);
|
37
39
|
const isShowConsent = useMemo(() => {
|
38
40
|
var _a, _b, _c, _d;
|
39
41
|
return (((_d = (_c = (_b = (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.consent) === 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.privacy_necessity) && !isAgreePolicy && !isEditor) || isOpenConsent;
|
@@ -190,7 +192,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
190
192
|
}
|
191
193
|
}), [bffFetch, utmVal, isShowTag]);
|
192
194
|
const ctaEvent = useCallback((eventInfo, rec, product, position) => {
|
193
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
195
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
194
196
|
const cta = product === null || product === void 0 ? void 0 : product.bindCta;
|
195
197
|
const isProd = ((_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.bindProduct) || (((_b = rec === null || rec === void 0 ? void 0 : rec.video) === null || _b === void 0 ? void 0 : _b.bindProducts) && ((_d = (_c = rec === null || rec === void 0 ? void 0 : rec.video) === null || _c === void 0 ? void 0 : _c.bindProducts) === null || _d === void 0 ? void 0 : _d.length) > 0);
|
196
198
|
let fromKName = '';
|
@@ -204,7 +206,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
204
206
|
fromKName = 'imagePage';
|
205
207
|
}
|
206
208
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
207
|
-
eventInfo: Object.assign(Object.assign({}, eventInfo), { ctaId: (_h = cta === null || cta === void 0 ? void 0 : cta.itemId) !== null && _h !== void 0 ? _h : '', ctaName: (_j = cta === null || cta === void 0 ? void 0 : cta.title) !== null && _j !== void 0 ? _j : '', contentTags: JSON.stringify(cta === null || cta === void 0 ? void 0 : cta.tags), position: position + '', contentId: (_l = (_k = rec === null || rec === void 0 ? void 0 : rec.video) === null || _k === void 0 ? void 0 : _k.itemId) !== null && _l !== void 0 ? _l : '', productId: isProd ? product === null || product === void 0 ? void 0 : product.itemId : '', traceInfo: (_m = cta === null || cta === void 0 ? void 0 : cta.traceInfo) !== null && _m !== void 0 ? _m : '', fromKName })
|
209
|
+
eventInfo: Object.assign(Object.assign({}, eventInfo), { ctaId: (_h = cta === null || cta === void 0 ? void 0 : cta.itemId) !== null && _h !== void 0 ? _h : '', ctaName: (_j = cta === null || cta === void 0 ? void 0 : cta.title) !== null && _j !== void 0 ? _j : '', contentTags: JSON.stringify(cta === null || cta === void 0 ? void 0 : cta.tags), position: position + '', contentId: (_l = (_k = rec === null || rec === void 0 ? void 0 : rec.video) === null || _k === void 0 ? void 0 : _k.itemId) !== null && _l !== void 0 ? _l : '', productId: isProd ? product === null || product === void 0 ? void 0 : product.itemId : '', traceInfo: (_m = cta === null || cta === void 0 ? void 0 : cta.traceInfo) !== null && _m !== void 0 ? _m : '', fromKName, fromKPage: (_o = location === null || location === void 0 ? void 0 : location.href) !== null && _o !== void 0 ? _o : '' })
|
208
210
|
});
|
209
211
|
}, [bffEventReport, isFromHashtag]);
|
210
212
|
const h5EnterLink = useCallback(() => {
|
@@ -319,7 +321,9 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
319
321
|
isShowConsent,
|
320
322
|
selectTag,
|
321
323
|
setSelectTag,
|
322
|
-
globalConfig
|
324
|
+
globalConfig,
|
325
|
+
popupCurTimeRef,
|
326
|
+
checkCommodityIndexRef
|
323
327
|
} }, isShowConsent ? (React.createElement(Consent, Object.assign({}, (_c = (_b = (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.consent) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.item) === null || _c === void 0 ? void 0 : _c.props))) : (render({
|
324
328
|
rtcList,
|
325
329
|
mutateLike: bffMutateLike,
|
@@ -51,17 +51,21 @@ const AniLink = (_a) => {
|
|
51
51
|
}
|
52
52
|
}, [event === null || event === void 0 ? void 0 : event.animation]);
|
53
53
|
useEffect(() => {
|
54
|
+
var _a, _b, _c;
|
54
55
|
if (isOnScreen && (ref === null || ref === void 0 ? void 0 : ref.current)) {
|
55
56
|
ctaEvent === null || ctaEvent === void 0 ? void 0 : ctaEvent({
|
56
57
|
eventSubject: 'ctaExposure',
|
57
58
|
eventDescription: 'The cta was shown to the user'
|
58
|
-
}, recData,
|
59
|
+
}, recData, ((_b = (_a = recData === null || recData === void 0 ? void 0 : recData.video) === null || _a === void 0 ? void 0 : _a.bindProducts) === null || _b === void 0 ? void 0 : _b[0]) || ((_c = recData === null || recData === void 0 ? void 0 : recData.video) === null || _c === void 0 ? void 0 : _c.bindProduct) || (recData === null || recData === void 0 ? void 0 : recData.video), index);
|
59
60
|
}
|
60
61
|
}, [isOnScreen]);
|
61
62
|
useEffect(() => {
|
62
63
|
if (isOnScreen) {
|
63
64
|
setVisible(true);
|
64
65
|
}
|
66
|
+
else {
|
67
|
+
setVisible(false);
|
68
|
+
}
|
65
69
|
}, [isOnScreen]);
|
66
70
|
const aniNamStyle = useMemo(() => {
|
67
71
|
if (!visible)
|
@@ -1,23 +1,19 @@
|
|
1
1
|
import { __rest } from "tslib";
|
2
2
|
import { css } from '@emotion/css';
|
3
|
-
import React, { memo, useEffect, useMemo,
|
3
|
+
import React, { memo, useEffect, useMemo, useState } from 'react';
|
4
4
|
import { useSxpDataSource } from '../../../../core/hooks';
|
5
5
|
import { useEventReport } from '../../../../core/hooks/useEventReport';
|
6
6
|
import Img from '../../template/components/Img';
|
7
7
|
import { setFontForText } from '../../../../core/utils/tool';
|
8
8
|
import styles from './index.module.less';
|
9
|
-
import useOnScreen from '../../../../core/hooks/useOnScreen';
|
10
9
|
const closeIcon = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAjhJREFUWEfFlztOw0AQhmeWiJ4CCmpQ5DiRQsIJyAWg5A0lR0AIChDiCJS8ER0cADgBeRSxt4CCDgkaKiq8i+zYeWx2413HEWmiJJv9v535Z2aN8M8vFPT9z3zETD0aAUChUJjwvPFHAJhBhB3Hqd6OAsK2yyucwykAvP38eJX398Z3AJDLlVYR8ToU9Rhj25TWr9KEsKy5dULIGQCMtfZly45TvwsAstm56UwG6wA4FUFwzrdctxZBDcWSy5XWEPG8I84/GcMipdWPtgcsaz5PCHtKG0IuTiqUvjT9U/WYMG2IOPE+AP+LtCB0xKUAAyA2Xbd2o2OG0NQXvTnvhL17D7EPtH9TRCIWwkRcGYGIQgYBABuqPuHXOQBc6pw80lBGwBQiiXhsBHQhkoprA6iM6acjhDQKu5YJZW6XeOI3XJdpvfsdTu52VfXEekD8owQiXGIubpSCbhDbLu8DwKEAd+A41SOdPpE4BS0viFOtvV2iKWqUgn5x/tmS70xR01GuDSCKc86/OCcLgTyyZ0ScDGNhFAktAJV4NFJ9YyaFiAWIE+9uVkkgBgLoig8DMWAa9ro9ynkUdlW5maZDCmB6clmz0k1HH4Cs1Ezbq2p2yEpUuBOKTSZZex00RUWIrltxuuK6EOGDSbGIOPZicpMx6fny650377qNRgBgWeVFQuA+6UjVgREhGIMlSqsPUQqIbZdOOIdZQmCv2axRnU1N1+TzJYsxOEaEV8ep7frPZ7Gd0FTEdP0ft0/kMNdg0eoAAAAASUVORK5CYII=';
|
11
10
|
const AniLinkPopup = (_a) => {
|
12
11
|
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
|
13
|
-
var { style, recData, ctaTempStyles, index, event, bottom_image, translateY, isTel, onClick, isExternalLink = false } = _a, props = __rest(_a, ["style", "recData", "ctaTempStyles", "index", "event", "bottom_image", "translateY", "isTel", "onClick", "isExternalLink"]);
|
12
|
+
var { style, recData, ctaTempStyles, index, event, bottom_image, translateY, isTel, onClick, isExternalLink = false, isActive } = _a, props = __rest(_a, ["style", "recData", "ctaTempStyles", "index", "event", "bottom_image", "translateY", "isTel", "onClick", "isExternalLink", "isActive"]);
|
14
13
|
style === null || style === void 0 ? true : delete style.transform;
|
15
14
|
const { sxpParameter, globalConfig, ctaEvent, setPopupDetailData } = useSxpDataSource();
|
16
15
|
const { jumpToWeb } = useEventReport();
|
17
|
-
const
|
18
|
-
const isOnScreen = useOnScreen(ref);
|
19
|
-
const [visible, setVisible] = useState(false);
|
20
|
-
const [startAni, setStartAni] = useState(true);
|
16
|
+
const [visible, setVisible] = useState(true);
|
21
17
|
const cta = ((_d = (_c = (_b = recData === null || recData === void 0 ? void 0 : recData.video) === null || _b === void 0 ? void 0 : _b.bindProducts) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.bindCta) || ((_f = (_e = recData === null || recData === void 0 ? void 0 : recData.video) === null || _e === void 0 ? void 0 : _e.bindProduct) === null || _f === void 0 ? void 0 : _f.bindCta) || ((_g = recData === null || recData === void 0 ? void 0 : recData.video) === null || _g === void 0 ? void 0 : _g.bindCta);
|
22
18
|
const product = ((_j = (_h = recData === null || recData === void 0 ? void 0 : recData.video) === null || _h === void 0 ? void 0 : _h.bindProducts) === null || _j === void 0 ? void 0 : _j[0]) || ((_k = recData === null || recData === void 0 ? void 0 : recData.video) === null || _k === void 0 ? void 0 : _k.bindProduct);
|
23
19
|
const handleTo = () => {
|
@@ -53,29 +49,27 @@ const AniLinkPopup = (_a) => {
|
|
53
49
|
const src = (_q = (_p = (_o = (_l = product === null || product === void 0 ? void 0 : product.cover) !== null && _l !== void 0 ? _l : (_m = product === null || product === void 0 ? void 0 : product.homePage) === null || _m === void 0 ? void 0 : _m[0]) !== null && _o !== void 0 ? _o : cta === null || cta === void 0 ? void 0 : cta.icon) !== null && _p !== void 0 ? _p : sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) !== null && _q !== void 0 ? _q : bottom_image;
|
54
50
|
const onClose = (event) => {
|
55
51
|
event.stopPropagation();
|
56
|
-
|
52
|
+
setVisible(false);
|
57
53
|
};
|
58
54
|
useEffect(() => {
|
59
|
-
|
60
|
-
|
61
|
-
}
|
62
|
-
}, [isOnScreen]);
|
55
|
+
setVisible(true);
|
56
|
+
}, [isActive]);
|
63
57
|
const aniNamStyle = useMemo(() => {
|
64
|
-
if (!
|
58
|
+
if (!isActive)
|
65
59
|
return null;
|
66
|
-
return
|
67
|
-
}, [
|
60
|
+
return visible ? styles['animated-fadeIn'] : null;
|
61
|
+
}, [isActive, visible]);
|
68
62
|
return (React.createElement(React.Fragment, null, isTel ? (React.createElement("div", { style: {
|
69
63
|
height: '40px',
|
70
64
|
lineHeight: '40px',
|
71
65
|
paddingLeft: '6px'
|
72
|
-
} }, "Cta Title")) : (React.createElement("div", Object.assign({
|
66
|
+
} }, "Cta Title")) : (React.createElement("div", Object.assign({}, props, { className: `${css(Object.assign(Object.assign({}, style), { '--transY': `translateY(calc(100% + ${(_r = style === null || style === void 0 ? void 0 : style.margin) !== null && _r !== void 0 ? _r : 0}px))` }))} ${styles['aniLinkPopup']} ${aniNamStyle} ${css(aniTimStyle)}`, onClick: handleTo }),
|
73
67
|
React.createElement("div", { onClick: onClose, className: styles['modal-icon-wrapper'], style: { padding: (_s = style === null || style === void 0 ? void 0 : style['padding']) !== null && _s !== void 0 ? _s : 0 } },
|
74
68
|
React.createElement("img", { src: (_t = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.popupCloseIcon) !== null && _t !== void 0 ? _t : closeIcon, alt: 'close', className: styles['modal-icon-wrapper-img'] })),
|
75
69
|
React.createElement(Img, { src: src, rec: recData, item: (_y = (_w = (_v = (_u = recData === null || recData === void 0 ? void 0 : recData.video) === null || _u === void 0 ? void 0 : _u.bindProducts) === null || _v === void 0 ? void 0 : _v[0]) !== null && _w !== void 0 ? _w : (_x = recData === null || recData === void 0 ? void 0 : recData.video) === null || _x === void 0 ? void 0 : _x.bindProduct) !== null && _y !== void 0 ? _y : recData === null || recData === void 0 ? void 0 : recData.video, index: index, translateY: translateY, imgStyle: ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.img }),
|
76
|
-
|
70
|
+
(!recData || (product === null || product === void 0 ? void 0 : product.title)) && (React.createElement("div", { className: styles['two-line-ellipsis'], style: ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.title, dangerouslySetInnerHTML: {
|
77
71
|
__html: setFontForText((_z = product === null || product === void 0 ? void 0 : product.title) !== null && _z !== void 0 ? _z : 'Product Name', ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.title)
|
78
|
-
} }),
|
72
|
+
} })),
|
79
73
|
React.createElement("div", { className: styles['one-line-ellipsis'], style: Object.assign(Object.assign({}, ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.ctaTitle), { lineHeight: ((_0 = ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.ctaTitle) === null || _0 === void 0 ? void 0 : _0.height) + 'px' }), dangerouslySetInnerHTML: {
|
80
74
|
__html: setFontForText(title, ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.ctaTitle)
|
81
75
|
} })))));
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { __rest } from "tslib";
|
2
2
|
import { css } from '@emotion/css';
|
3
3
|
import React, { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
4
|
-
import { useSxpDataSource } from '../../../../core/hooks';
|
4
|
+
import { useEditor, useSxpDataSource } from '../../../../core/hooks';
|
5
5
|
import './index.less';
|
6
6
|
import { Autoplay, Pagination } from 'swiper/modules';
|
7
7
|
import { Swiper, SwiperSlide } from 'swiper/react';
|
@@ -12,18 +12,26 @@ import FormatImage from '../../../../core/components/SxpPageRender/FormatImage';
|
|
12
12
|
import { setFontForText } from '../../../../core/utils/tool';
|
13
13
|
import CommodityGroup from '../../template/components/CommodityGroup';
|
14
14
|
const CommodityDetail = (_a) => {
|
15
|
-
var _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
15
|
+
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
|
16
16
|
var { content, style, bgImg, onClick, schema, isDefault, bottom_image, tipText, isPost, viewTime, rec, swiper, commodityStyles, buttonStyle, index, commodityGroup } = _a, props = __rest(_a, ["content", "style", "bgImg", "onClick", "schema", "isDefault", "bottom_image", "tipText", "isPost", "viewTime", "rec", "swiper", "commodityStyles", "buttonStyle", "index", "commodityGroup"]);
|
17
|
-
const { sxpParameter } = useSxpDataSource();
|
18
|
-
const {
|
17
|
+
const { sxpParameter, popupDetailData, isPreview, bffFbReport, popupCurTimeRef } = useSxpDataSource();
|
18
|
+
const { popup } = useEditor();
|
19
19
|
const { jumpToWeb, productView } = useEventReport();
|
20
20
|
const curTimeRef = useRef(null);
|
21
21
|
const [showModal, setShowModal] = useState(false);
|
22
22
|
const [show3DModal, setShow3DModal] = useState(false);
|
23
|
+
const [checkCommodityIndex, setCheckCommodityIndex] = useState((_b = popupDetailData === null || popupDetailData === void 0 ? void 0 : popupDetailData.multiCheckIndex) !== null && _b !== void 0 ? _b : 0);
|
23
24
|
const data = isPost ? rec : popupDetailData;
|
24
|
-
|
25
|
-
|
25
|
+
let product = isPost ? data === null || data === void 0 ? void 0 : data.product : (_d = (_c = data === null || data === void 0 ? void 0 : data.video) === null || _c === void 0 ? void 0 : _c.bindProduct) !== null && _d !== void 0 ? _d : (_f = (_e = data === null || data === void 0 ? void 0 : data.video) === null || _e === void 0 ? void 0 : _e.bindProducts) === null || _f === void 0 ? void 0 : _f[0];
|
26
|
+
let cta = isPost
|
27
|
+
? (_g = data === null || data === void 0 ? void 0 : data.product) === null || _g === void 0 ? void 0 : _g.bindCta
|
28
|
+
: (_k = (_j = (_h = data === null || data === void 0 ? void 0 : data.video) === null || _h === void 0 ? void 0 : _h.bindProduct) === null || _j === void 0 ? void 0 : _j.bindCta) !== null && _k !== void 0 ? _k : (_o = (_m = (_l = data === null || data === void 0 ? void 0 : data.video) === null || _l === void 0 ? void 0 : _l.bindProducts) === null || _m === void 0 ? void 0 : _m[0]) === null || _o === void 0 ? void 0 : _o.bindCta;
|
26
29
|
const position = isPost ? index : popupDetailData === null || popupDetailData === void 0 ? void 0 : popupDetailData.index;
|
30
|
+
if (!isPost && (commodityGroup === null || commodityGroup === void 0 ? void 0 : commodityGroup.open) && ((_p = data === null || data === void 0 ? void 0 : data.video) === null || _p === void 0 ? void 0 : _p.bindProducts) && ((_r = (_q = data === null || data === void 0 ? void 0 : data.video) === null || _q === void 0 ? void 0 : _q.bindProducts) === null || _r === void 0 ? void 0 : _r.length) > 0) {
|
31
|
+
const p = (_s = data === null || data === void 0 ? void 0 : data.video) === null || _s === void 0 ? void 0 : _s.bindProducts[checkCommodityIndex];
|
32
|
+
product = p;
|
33
|
+
cta = p === null || p === void 0 ? void 0 : p.bindCta;
|
34
|
+
}
|
27
35
|
const handleLink = () => {
|
28
36
|
if (product === null || product === void 0 ? void 0 : product.link) {
|
29
37
|
jumpToWeb(data, product, cta, position);
|
@@ -61,7 +69,7 @@ const CommodityDetail = (_a) => {
|
|
61
69
|
return '$7,000';
|
62
70
|
}
|
63
71
|
}, [product === null || product === void 0 ? void 0 : product.price, product === null || product === void 0 ? void 0 : product.currency]);
|
64
|
-
const width = isPreview ? 375 : (
|
72
|
+
const width = isPreview ? 375 : (_t = style === null || style === void 0 ? void 0 : style.width) !== null && _t !== void 0 ? _t : window.innerWidth;
|
65
73
|
const renderContent = ({ isPost }) => {
|
66
74
|
var _a, _b, _c;
|
67
75
|
return (React.createElement("div", null,
|
@@ -94,15 +102,19 @@ const CommodityDetail = (_a) => {
|
|
94
102
|
}
|
95
103
|
return style;
|
96
104
|
}, []);
|
105
|
+
const handleClick = useCallback((index) => {
|
106
|
+
popupCurTimeRef.current = new Date();
|
107
|
+
setCheckCommodityIndex(index);
|
108
|
+
}, []);
|
97
109
|
const renderCommodityGroup = useCallback(() => {
|
98
110
|
var _a, _b, _c;
|
99
111
|
if (isPost)
|
100
112
|
return;
|
101
|
-
return (React.createElement(CommodityGroup, { products: (_a = data === null || data === void 0 ? void 0 : data.video) === null || _a === void 0 ? void 0 : _a.bindProducts, data: commodityGroup, defImg: (_c = (_b = sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) !== null && _b !== void 0 ? _b : bottom_image) !== null && _c !== void 0 ? _c : '', style: { padding: '0 19px' } }));
|
102
|
-
}, []);
|
113
|
+
return (React.createElement(CommodityGroup, { products: (_a = data === null || data === void 0 ? void 0 : data.video) === null || _a === void 0 ? void 0 : _a.bindProducts, data: commodityGroup, defImg: (_c = (_b = sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) !== null && _b !== void 0 ? _b : bottom_image) !== null && _c !== void 0 ? _c : '', style: { padding: '0 19px' }, onCLick: handleClick, popupDetailData: popupDetailData, check: checkCommodityIndex }));
|
114
|
+
}, [checkCommodityIndex]);
|
103
115
|
return (React.createElement(React.Fragment, null,
|
104
116
|
React.createElement("div", Object.assign({ className: css(Object.assign({}, style)) }, props),
|
105
|
-
product && ((
|
117
|
+
product && ((_u = product === null || product === void 0 ? void 0 : product.homePage) === null || _u === void 0 ? void 0 : _u.length) > 0 && (React.createElement("div", { style: { position: 'relative' } },
|
106
118
|
React.createElement(Swiper, { height: width, modules: [Pagination, Autoplay], pagination: {
|
107
119
|
clickable: true,
|
108
120
|
bulletActiveClass: 'swipe-item-active-bullet',
|
@@ -112,7 +124,7 @@ const CommodityDetail = (_a) => {
|
|
112
124
|
}, loop: true, autoplay: {
|
113
125
|
delay: (swiper === null || swiper === void 0 ? void 0 : swiper.delay) * 1000
|
114
126
|
} },
|
115
|
-
React.createElement(React.Fragment, null, (
|
127
|
+
React.createElement(React.Fragment, null, (_v = product === null || product === void 0 ? void 0 : product.homePage) === null || _v === void 0 ? void 0 : _v.map((src) => {
|
116
128
|
return (React.createElement(SwiperSlide, { key: src },
|
117
129
|
React.createElement("div", { style: {
|
118
130
|
overflow: 'hidden',
|
@@ -127,7 +139,7 @@ const CommodityDetail = (_a) => {
|
|
127
139
|
objectPosition: `50% ${(swiper === null || swiper === void 0 ? void 0 : swiper.translateY) ? (swiper === null || swiper === void 0 ? void 0 : swiper.translateY) + 50 : 50}%`
|
128
140
|
}, src: src }))));
|
129
141
|
}))))),
|
130
|
-
!((
|
142
|
+
!((_w = product === null || product === void 0 ? void 0 : product.homePage) === null || _w === void 0 ? void 0 : _w.length) && (React.createElement("div", { className: css({
|
131
143
|
position: 'relative',
|
132
144
|
height: 0,
|
133
145
|
width: '100%',
|
@@ -140,7 +152,7 @@ const CommodityDetail = (_a) => {
|
|
140
152
|
top: 0,
|
141
153
|
objectFit: 'cover',
|
142
154
|
width: '100%'
|
143
|
-
}), src: (
|
155
|
+
}), src: (_x = sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) !== null && _x !== void 0 ? _x : bottom_image, alt: 'pdp image' }))),
|
144
156
|
renderCommodityGroup(),
|
145
157
|
React.createElement("div", { className: 'pb-commondity-content' }, renderContent({ isPost }))),
|
146
158
|
renderBtn(),
|