pb-sxp-ui 1.0.12 → 1.0.14
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 +74 -43
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +0 -1
- package/dist/index.js +74 -43
- 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 +74 -43
- 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/ExpandableText.d.ts +1 -0
- package/es/core/components/SxpPageRender/ExpandableText.js +6 -24
- package/es/core/components/SxpPageRender/PictureGroup/index.js +0 -3
- package/es/core/components/SxpPageRender/WaterFall/List.js +1 -1
- package/es/core/components/SxpPageRender/WaterFall/index.js +4 -4
- package/es/core/components/SxpPageRender/index.js +34 -5
- package/es/core/utils/localStore.d.ts +1 -0
- package/es/core/utils/localStore.js +4 -0
- package/lib/core/components/SxpPageRender/ExpandableText.d.ts +1 -0
- package/lib/core/components/SxpPageRender/ExpandableText.js +6 -24
- package/lib/core/components/SxpPageRender/PictureGroup/index.js +0 -3
- package/lib/core/components/SxpPageRender/WaterFall/List.js +1 -1
- package/lib/core/components/SxpPageRender/WaterFall/index.js +4 -4
- package/lib/core/components/SxpPageRender/index.js +34 -5
- package/lib/core/utils/localStore.d.ts +1 -0
- package/lib/core/utils/localStore.js +6 -1
- package/package.json +1 -1
@@ -15,47 +15,29 @@ const limitTextLastWholeWord = (originalText = '', limit) => {
|
|
15
15
|
const _words = newWords.length > 1 && newWords.length < words.length ? newWords.slice(0, newWords.length - 1) : newWords;
|
16
16
|
return _words.join(' ') + ' ';
|
17
17
|
};
|
18
|
-
const ExpandableText = ({ text, maxStr = 108, style, className, onClick, foldText, unfoldText, isPost }) => {
|
19
|
-
const [isShowMore, setIsShowMore] = useState(
|
18
|
+
const ExpandableText = ({ text, maxStr = 108, style, className, onClick, foldText, unfoldText, isPost, onChange }) => {
|
19
|
+
const [isShowMore, setIsShowMore] = useState(false);
|
20
20
|
const [isShow, setIsShow] = useState(false);
|
21
21
|
const lineClamp = Number((style === null || style === void 0 ? void 0 : style.lineClamp) || 2);
|
22
22
|
const multiRow = useRef(null);
|
23
23
|
const handleClick = useCallback(() => {
|
24
24
|
setIsShowMore(!isShowMore);
|
25
|
-
|
25
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(!isShowMore);
|
26
|
+
}, [isShowMore, onChange]);
|
26
27
|
const renderText = useMemo(() => {
|
27
28
|
return !isShowMore && text.length > maxStr ? limitTextLastWholeWord(text, maxStr) + '...' : text;
|
28
29
|
}, [text, maxStr, isShowMore]);
|
29
30
|
useEffect(() => {
|
30
|
-
if (multiRow.current && isPost) {
|
31
|
-
setIsShowMore(true);
|
32
|
-
setTimeout(() => {
|
33
|
-
var _a;
|
34
|
-
setIsShow(false);
|
35
|
-
try {
|
36
|
-
const cs = (_a = window === null || window === void 0 ? void 0 : window.getComputedStyle) === null || _a === void 0 ? void 0 : _a.call(window, multiRow.current);
|
37
|
-
const height = parseFloat(cs === null || cs === void 0 ? void 0 : cs.height);
|
38
|
-
const lh = parseFloat(cs === null || cs === void 0 ? void 0 : cs.lineHeight);
|
39
|
-
const fs = parseFloat(cs === null || cs === void 0 ? void 0 : cs.fontSize) + 6;
|
40
|
-
const lineHeight = isNaN(lh) ? fs : lh;
|
41
|
-
if (text && height > lineHeight * lineClamp) {
|
42
|
-
setIsShowMore(false);
|
43
|
-
setIsShow(true);
|
44
|
-
}
|
45
|
-
}
|
46
|
-
catch (_b) { }
|
47
|
-
}, 100);
|
48
|
-
}
|
49
31
|
}, [multiRow, text, lineClamp, style, isPost]);
|
50
32
|
return (React.createElement("div", { className: className, style: Object.assign({}, style), hidden: !text || text === '' },
|
51
33
|
React.createElement("div", { ref: multiRow, style: {
|
52
34
|
overflow: 'hidden',
|
53
|
-
WebkitLineClamp:
|
35
|
+
WebkitLineClamp: isShowMore ? '' : lineClamp,
|
54
36
|
textOverflow: 'ellipsis',
|
55
37
|
display: '-webkit-box',
|
56
38
|
WebkitBoxOrient: 'vertical',
|
57
39
|
wordBreak: 'break-word'
|
58
40
|
}, dangerouslySetInnerHTML: { __html: text === null || text === void 0 ? void 0 : text.replace(/\n/g, '</br>') } }),
|
59
|
-
|
41
|
+
text && isPost && (React.createElement("span", { style: { textDecoration: 'underline', cursor: 'pointer' }, onClick: onClick !== null && onClick !== void 0 ? onClick : handleClick }, isShowMore ? unfoldText || 'show less' : foldText || 'show more'))));
|
60
42
|
};
|
61
43
|
export default memo(ExpandableText);
|
@@ -20,9 +20,6 @@ const PictureGroup = ({ imgUrls, width, height, rec, index, onReportViewImageEnd
|
|
20
20
|
setIsLoad(true);
|
21
21
|
}
|
22
22
|
}, [rec, isActive, onReportViewImageEnd, openHashtag, index, onViewImageStartEvent, isLoad]);
|
23
|
-
if (!isActive) {
|
24
|
-
return React.createElement("img", { src: sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.placeholder_image, style: { width, height, objectFit: 'cover' } });
|
25
|
-
}
|
26
23
|
return (React.createElement(Swiper, { defaultValue: 0, direction: 'horizontal', modules: [Pagination, Autoplay], pagination: { clickable: true, bulletActiveClass: 'swipe-item-active-bullet' }, height: height, loop: true, autoplay: { delay: 3000 } }, imgUrls === null || imgUrls === void 0 ? void 0 : imgUrls.map((url) => {
|
27
24
|
return (React.createElement(SwiperSlide, { key: url },
|
28
25
|
React.createElement(Picture, { src: url, width: width, height: height })));
|
@@ -96,7 +96,7 @@ const WaterfallFlowItem = (props) => {
|
|
96
96
|
};
|
97
97
|
}, [src, showVideo]);
|
98
98
|
const handleClickToDetail = () => {
|
99
|
-
reportTagsView(
|
99
|
+
reportTagsView();
|
100
100
|
setRtcList === null || setRtcList === void 0 ? void 0 : setRtcList(list);
|
101
101
|
setTimeout(() => {
|
102
102
|
var _a;
|
@@ -29,7 +29,7 @@ const WaterFall = (props) => {
|
|
29
29
|
if (!isEq && cacheRtcList && (cacheRtcList === null || cacheRtcList === void 0 ? void 0 : cacheRtcList.length)) {
|
30
30
|
setRtcList === null || setRtcList === void 0 ? void 0 : setRtcList(cacheRtcList);
|
31
31
|
}
|
32
|
-
reportTagsView(
|
32
|
+
reportTagsView();
|
33
33
|
setWaterFallData === null || setWaterFallData === void 0 ? void 0 : setWaterFallData(undefined);
|
34
34
|
setIsFromHashtag === null || setIsFromHashtag === void 0 ? void 0 : setIsFromHashtag(false);
|
35
35
|
setTimeout(() => {
|
@@ -46,7 +46,7 @@ const WaterFall = (props) => {
|
|
46
46
|
setRecData(waterFallData);
|
47
47
|
}
|
48
48
|
}, [waterFallData]);
|
49
|
-
const reportTagsView = useCallback((
|
49
|
+
const reportTagsView = useCallback(() => {
|
50
50
|
var _a, _b, _c, _d, _e, _f;
|
51
51
|
const rec = recData === null || recData === void 0 ? void 0 : recData.rec;
|
52
52
|
if (!rec)
|
@@ -64,7 +64,7 @@ const WaterFall = (props) => {
|
|
64
64
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
65
65
|
eventInfo: {
|
66
66
|
relatedContentId: (_d = rec === null || rec === void 0 ? void 0 : rec.video) === null || _d === void 0 ? void 0 : _d.itemId,
|
67
|
-
position:
|
67
|
+
position: cacheActiveIndex + '',
|
68
68
|
contentTags: JSON.stringify((_e = rec === null || rec === void 0 ? void 0 : rec.video) === null || _e === void 0 ? void 0 : _e.tags),
|
69
69
|
traceInfo: (_f = rec === null || rec === void 0 ? void 0 : rec.video) === null || _f === void 0 ? void 0 : _f.traceInfo,
|
70
70
|
hashTags: JSON.stringify([recData === null || recData === void 0 ? void 0 : recData.hashTag]),
|
@@ -75,7 +75,7 @@ const WaterFall = (props) => {
|
|
75
75
|
eventDescription: 'User click tags view contents'
|
76
76
|
}
|
77
77
|
});
|
78
|
-
}, [recData, bffEventReport, viewTime, isFromHashtag]);
|
78
|
+
}, [recData, bffEventReport, viewTime, isFromHashtag, cacheActiveIndex]);
|
79
79
|
useEffect(() => {
|
80
80
|
if (openHashtag) {
|
81
81
|
setViewTime(new Date());
|
@@ -20,6 +20,7 @@ import { refreshFeSessionId } from '../../../core/utils/sessionStore';
|
|
20
20
|
import './index.less';
|
21
21
|
import { useEventReport } from '../../../core/hooks/useEventReport';
|
22
22
|
import withBindDataSource from '../../../core/hoc/withBindDataSource';
|
23
|
+
import { getFeUserId } from '../../../core/utils/localStore';
|
23
24
|
const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.innerHeight, containerWidth = window.innerWidth, tempMap, resolver, data = [], ctaType, tipText, nudge, _schema, hashTagStyle }) => {
|
24
25
|
var _a, _b, _c, _d, _e, _f, _g;
|
25
26
|
const { schema } = useEditor();
|
@@ -30,10 +31,11 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
30
31
|
const curTime = useRef();
|
31
32
|
const viewTime = useRef();
|
32
33
|
const [isLoadMore, setIsLoadMore] = useState(false);
|
34
|
+
const [isShowMore, setIsShowMore] = useState(false);
|
33
35
|
const { loadVideos, bffEventReport, loading, setPopupDetailData, ctaEvent, swiperRef, waterFallData, setOpenHashtag, appDomain, openHashtag, loadingImage, isFromHashtag, popupDetailData } = useSxpDataSource();
|
34
36
|
const { productView } = useEventReport();
|
35
37
|
const isShowFingerTip = useMemo(() => {
|
36
|
-
return data.length > 0 && !loading;
|
38
|
+
return data.length > 0 && !loading && !getFeUserId;
|
37
39
|
}, [data, loading]);
|
38
40
|
const handleH5EnterLink = useCallback(() => {
|
39
41
|
if (data.length <= 0) {
|
@@ -167,20 +169,47 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
167
169
|
}
|
168
170
|
return null;
|
169
171
|
}, [containerWidth, data, height, isMuted, activeIndex, globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.productPost, viewTime, tipText, resolver, schema]);
|
172
|
+
const onExpandableChange = useCallback((v) => {
|
173
|
+
setIsShowMore(v);
|
174
|
+
}, []);
|
175
|
+
const lineGradStyle = useMemo(() => {
|
176
|
+
return !isShowMore
|
177
|
+
? {
|
178
|
+
padding: '20px 0'
|
179
|
+
}
|
180
|
+
: {
|
181
|
+
background: 'linear-gradient( 180deg, rgba(129,129,129,0) 0%, rgba(121,121,121,0.5) 5%, #616161 100%)',
|
182
|
+
paddingTop: 20,
|
183
|
+
paddingBottom: 20
|
184
|
+
};
|
185
|
+
}, [isShowMore]);
|
170
186
|
const renderBottom = useCallback((rec, index) => {
|
171
187
|
var _a, _b, _c, _d, _e, _f, _g;
|
172
188
|
if (rec.video) {
|
173
189
|
return (React.createElement(React.Fragment, null,
|
174
|
-
((_a = rec.video) === null || _a === void 0 ? void 0 : _a.title) && React.createElement("div", { className: 'clc-sxp-bottom-shadow' }),
|
190
|
+
((_a = rec.video) === null || _a === void 0 ? void 0 : _a.title) && !isShowMore && React.createElement("div", { className: 'clc-sxp-bottom-shadow' }),
|
175
191
|
React.createElement("div", { className: 'clc-sxp-bottom' },
|
176
192
|
React.createElement(Nudge, { nudge: nudge }),
|
177
193
|
React.createElement("div", { className: 'clc-sxp-bottom-card' },
|
178
194
|
React.createElement(RenderCard, { rec: rec, index: index, tempMap: tempMap, resolver: resolver })),
|
179
|
-
React.createElement(
|
180
|
-
|
195
|
+
React.createElement("div", { style: lineGradStyle },
|
196
|
+
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: (_c = (_b = rec.video) === null || _b === void 0 ? void 0 : _b.title) !== null && _c !== void 0 ? _c : '', 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 }),
|
197
|
+
React.createElement(Hashtag, { index: activeIndex, tags: (_e = (_d = rec === null || rec === void 0 ? void 0 : rec.video) === null || _d === void 0 ? void 0 : _d.hashTags) !== null && _e !== void 0 ? _e : [], itemId: (_f = rec === null || rec === void 0 ? void 0 : rec.video) === null || _f === void 0 ? void 0 : _f.itemId, itemType: ((_g = rec.video) === null || _g === void 0 ? void 0 : _g.url) ? 'VIDEO' : null, rec: rec, hashTagStyle: hashTagStyle })))));
|
181
198
|
}
|
182
199
|
return null;
|
183
|
-
}, [
|
200
|
+
}, [
|
201
|
+
descStyle,
|
202
|
+
activeIndex,
|
203
|
+
tempMap,
|
204
|
+
resolver,
|
205
|
+
tipText,
|
206
|
+
nudge,
|
207
|
+
hashTagStyle,
|
208
|
+
globalConfig,
|
209
|
+
onExpandableChange,
|
210
|
+
isShowMore,
|
211
|
+
lineGradStyle
|
212
|
+
]);
|
184
213
|
const renderLikeButton = useCallback((rec, index) => {
|
185
214
|
var _a, _b;
|
186
215
|
if (!(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowLike))
|
@@ -12,3 +12,7 @@ export const storeAndLoadFeUserId = () => {
|
|
12
12
|
export const removeFeUserId = () => {
|
13
13
|
window.localStorage.removeItem(FAKE_USER_KEY);
|
14
14
|
};
|
15
|
+
export const getFeUserId = () => {
|
16
|
+
const fakeUserId = window.localStorage.getItem(FAKE_USER_KEY);
|
17
|
+
return isEmpty(fakeUserId);
|
18
|
+
};
|
@@ -18,47 +18,29 @@ const limitTextLastWholeWord = (originalText = '', limit) => {
|
|
18
18
|
const _words = newWords.length > 1 && newWords.length < words.length ? newWords.slice(0, newWords.length - 1) : newWords;
|
19
19
|
return _words.join(' ') + ' ';
|
20
20
|
};
|
21
|
-
const ExpandableText = ({ text, maxStr = 108, style, className, onClick, foldText, unfoldText, isPost }) => {
|
22
|
-
const [isShowMore, setIsShowMore] = (0, react_1.useState)(
|
21
|
+
const ExpandableText = ({ text, maxStr = 108, style, className, onClick, foldText, unfoldText, isPost, onChange }) => {
|
22
|
+
const [isShowMore, setIsShowMore] = (0, react_1.useState)(false);
|
23
23
|
const [isShow, setIsShow] = (0, react_1.useState)(false);
|
24
24
|
const lineClamp = Number((style === null || style === void 0 ? void 0 : style.lineClamp) || 2);
|
25
25
|
const multiRow = (0, react_1.useRef)(null);
|
26
26
|
const handleClick = (0, react_1.useCallback)(() => {
|
27
27
|
setIsShowMore(!isShowMore);
|
28
|
-
|
28
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(!isShowMore);
|
29
|
+
}, [isShowMore, onChange]);
|
29
30
|
const renderText = (0, react_1.useMemo)(() => {
|
30
31
|
return !isShowMore && text.length > maxStr ? limitTextLastWholeWord(text, maxStr) + '...' : text;
|
31
32
|
}, [text, maxStr, isShowMore]);
|
32
33
|
(0, react_1.useEffect)(() => {
|
33
|
-
if (multiRow.current && isPost) {
|
34
|
-
setIsShowMore(true);
|
35
|
-
setTimeout(() => {
|
36
|
-
var _a;
|
37
|
-
setIsShow(false);
|
38
|
-
try {
|
39
|
-
const cs = (_a = window === null || window === void 0 ? void 0 : window.getComputedStyle) === null || _a === void 0 ? void 0 : _a.call(window, multiRow.current);
|
40
|
-
const height = parseFloat(cs === null || cs === void 0 ? void 0 : cs.height);
|
41
|
-
const lh = parseFloat(cs === null || cs === void 0 ? void 0 : cs.lineHeight);
|
42
|
-
const fs = parseFloat(cs === null || cs === void 0 ? void 0 : cs.fontSize) + 6;
|
43
|
-
const lineHeight = isNaN(lh) ? fs : lh;
|
44
|
-
if (text && height > lineHeight * lineClamp) {
|
45
|
-
setIsShowMore(false);
|
46
|
-
setIsShow(true);
|
47
|
-
}
|
48
|
-
}
|
49
|
-
catch (_b) { }
|
50
|
-
}, 100);
|
51
|
-
}
|
52
34
|
}, [multiRow, text, lineClamp, style, isPost]);
|
53
35
|
return (react_1.default.createElement("div", { className: className, style: Object.assign({}, style), hidden: !text || text === '' },
|
54
36
|
react_1.default.createElement("div", { ref: multiRow, style: {
|
55
37
|
overflow: 'hidden',
|
56
|
-
WebkitLineClamp:
|
38
|
+
WebkitLineClamp: isShowMore ? '' : lineClamp,
|
57
39
|
textOverflow: 'ellipsis',
|
58
40
|
display: '-webkit-box',
|
59
41
|
WebkitBoxOrient: 'vertical',
|
60
42
|
wordBreak: 'break-word'
|
61
43
|
}, dangerouslySetInnerHTML: { __html: text === null || text === void 0 ? void 0 : text.replace(/\n/g, '</br>') } }),
|
62
|
-
|
44
|
+
text && isPost && (react_1.default.createElement("span", { style: { textDecoration: 'underline', cursor: 'pointer' }, onClick: onClick !== null && onClick !== void 0 ? onClick : handleClick }, isShowMore ? unfoldText || 'show less' : foldText || 'show more'))));
|
63
45
|
};
|
64
46
|
exports.default = (0, react_1.memo)(ExpandableText);
|
@@ -23,9 +23,6 @@ const PictureGroup = ({ imgUrls, width, height, rec, index, onReportViewImageEnd
|
|
23
23
|
setIsLoad(true);
|
24
24
|
}
|
25
25
|
}, [rec, isActive, onReportViewImageEnd, openHashtag, index, onViewImageStartEvent, isLoad]);
|
26
|
-
if (!isActive) {
|
27
|
-
return react_1.default.createElement("img", { src: sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.placeholder_image, style: { width, height, objectFit: 'cover' } });
|
28
|
-
}
|
29
26
|
return (react_1.default.createElement(react_2.Swiper, { defaultValue: 0, direction: 'horizontal', modules: [modules_1.Pagination, modules_1.Autoplay], pagination: { clickable: true, bulletActiveClass: 'swipe-item-active-bullet' }, height: height, loop: true, autoplay: { delay: 3000 } }, imgUrls === null || imgUrls === void 0 ? void 0 : imgUrls.map((url) => {
|
30
27
|
return (react_1.default.createElement(react_2.SwiperSlide, { key: url },
|
31
28
|
react_1.default.createElement(Picture_1.default, { src: url, width: width, height: height })));
|
@@ -98,7 +98,7 @@ const WaterfallFlowItem = (props) => {
|
|
98
98
|
};
|
99
99
|
}, [src, showVideo]);
|
100
100
|
const handleClickToDetail = () => {
|
101
|
-
reportTagsView(
|
101
|
+
reportTagsView();
|
102
102
|
setRtcList === null || setRtcList === void 0 ? void 0 : setRtcList(list);
|
103
103
|
setTimeout(() => {
|
104
104
|
var _a;
|
@@ -32,7 +32,7 @@ const WaterFall = (props) => {
|
|
32
32
|
if (!isEq && cacheRtcList && (cacheRtcList === null || cacheRtcList === void 0 ? void 0 : cacheRtcList.length)) {
|
33
33
|
setRtcList === null || setRtcList === void 0 ? void 0 : setRtcList(cacheRtcList);
|
34
34
|
}
|
35
|
-
reportTagsView(
|
35
|
+
reportTagsView();
|
36
36
|
setWaterFallData === null || setWaterFallData === void 0 ? void 0 : setWaterFallData(undefined);
|
37
37
|
setIsFromHashtag === null || setIsFromHashtag === void 0 ? void 0 : setIsFromHashtag(false);
|
38
38
|
setTimeout(() => {
|
@@ -49,7 +49,7 @@ const WaterFall = (props) => {
|
|
49
49
|
setRecData(waterFallData);
|
50
50
|
}
|
51
51
|
}, [waterFallData]);
|
52
|
-
const reportTagsView = (0, react_1.useCallback)((
|
52
|
+
const reportTagsView = (0, react_1.useCallback)(() => {
|
53
53
|
var _a, _b, _c, _d, _e, _f;
|
54
54
|
const rec = recData === null || recData === void 0 ? void 0 : recData.rec;
|
55
55
|
if (!rec)
|
@@ -67,7 +67,7 @@ const WaterFall = (props) => {
|
|
67
67
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
68
68
|
eventInfo: {
|
69
69
|
relatedContentId: (_d = rec === null || rec === void 0 ? void 0 : rec.video) === null || _d === void 0 ? void 0 : _d.itemId,
|
70
|
-
position:
|
70
|
+
position: cacheActiveIndex + '',
|
71
71
|
contentTags: JSON.stringify((_e = rec === null || rec === void 0 ? void 0 : rec.video) === null || _e === void 0 ? void 0 : _e.tags),
|
72
72
|
traceInfo: (_f = rec === null || rec === void 0 ? void 0 : rec.video) === null || _f === void 0 ? void 0 : _f.traceInfo,
|
73
73
|
hashTags: JSON.stringify([recData === null || recData === void 0 ? void 0 : recData.hashTag]),
|
@@ -78,7 +78,7 @@ const WaterFall = (props) => {
|
|
78
78
|
eventDescription: 'User click tags view contents'
|
79
79
|
}
|
80
80
|
});
|
81
|
-
}, [recData, bffEventReport, viewTime, isFromHashtag]);
|
81
|
+
}, [recData, bffEventReport, viewTime, isFromHashtag, cacheActiveIndex]);
|
82
82
|
(0, react_1.useEffect)(() => {
|
83
83
|
if (openHashtag) {
|
84
84
|
setViewTime(new Date());
|
@@ -23,6 +23,7 @@ const sessionStore_1 = require("../../../core/utils/sessionStore");
|
|
23
23
|
require("./index.less");
|
24
24
|
const useEventReport_1 = require("../../../core/hooks/useEventReport");
|
25
25
|
const withBindDataSource_1 = tslib_1.__importDefault(require("../../../core/hoc/withBindDataSource"));
|
26
|
+
const localStore_1 = require("../../../core/utils/localStore");
|
26
27
|
const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.innerHeight, containerWidth = window.innerWidth, tempMap, resolver, data = [], ctaType, tipText, nudge, _schema, hashTagStyle }) => {
|
27
28
|
var _a, _b, _c, _d, _e, _f, _g;
|
28
29
|
const { schema } = (0, hooks_1.useEditor)();
|
@@ -33,10 +34,11 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
33
34
|
const curTime = (0, react_1.useRef)();
|
34
35
|
const viewTime = (0, react_1.useRef)();
|
35
36
|
const [isLoadMore, setIsLoadMore] = (0, react_1.useState)(false);
|
37
|
+
const [isShowMore, setIsShowMore] = (0, react_1.useState)(false);
|
36
38
|
const { loadVideos, bffEventReport, loading, setPopupDetailData, ctaEvent, swiperRef, waterFallData, setOpenHashtag, appDomain, openHashtag, loadingImage, isFromHashtag, popupDetailData } = (0, hooks_1.useSxpDataSource)();
|
37
39
|
const { productView } = (0, useEventReport_1.useEventReport)();
|
38
40
|
const isShowFingerTip = (0, react_1.useMemo)(() => {
|
39
|
-
return data.length > 0 && !loading;
|
41
|
+
return data.length > 0 && !loading && !localStore_1.getFeUserId;
|
40
42
|
}, [data, loading]);
|
41
43
|
const handleH5EnterLink = (0, react_1.useCallback)(() => {
|
42
44
|
if (data.length <= 0) {
|
@@ -170,20 +172,47 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
170
172
|
}
|
171
173
|
return null;
|
172
174
|
}, [containerWidth, data, height, isMuted, activeIndex, globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.productPost, viewTime, tipText, resolver, schema]);
|
175
|
+
const onExpandableChange = (0, react_1.useCallback)((v) => {
|
176
|
+
setIsShowMore(v);
|
177
|
+
}, []);
|
178
|
+
const lineGradStyle = (0, react_1.useMemo)(() => {
|
179
|
+
return !isShowMore
|
180
|
+
? {
|
181
|
+
padding: '20px 0'
|
182
|
+
}
|
183
|
+
: {
|
184
|
+
background: 'linear-gradient( 180deg, rgba(129,129,129,0) 0%, rgba(121,121,121,0.5) 5%, #616161 100%)',
|
185
|
+
paddingTop: 20,
|
186
|
+
paddingBottom: 20
|
187
|
+
};
|
188
|
+
}, [isShowMore]);
|
173
189
|
const renderBottom = (0, react_1.useCallback)((rec, index) => {
|
174
190
|
var _a, _b, _c, _d, _e, _f, _g;
|
175
191
|
if (rec.video) {
|
176
192
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
177
|
-
((_a = rec.video) === null || _a === void 0 ? void 0 : _a.title) && react_1.default.createElement("div", { className: 'clc-sxp-bottom-shadow' }),
|
193
|
+
((_a = rec.video) === null || _a === void 0 ? void 0 : _a.title) && !isShowMore && react_1.default.createElement("div", { className: 'clc-sxp-bottom-shadow' }),
|
178
194
|
react_1.default.createElement("div", { className: 'clc-sxp-bottom' },
|
179
195
|
react_1.default.createElement(Nudge_1.default, { nudge: nudge }),
|
180
196
|
react_1.default.createElement("div", { className: 'clc-sxp-bottom-card' },
|
181
197
|
react_1.default.createElement(RenderCard_1.default, { rec: rec, index: index, tempMap: tempMap, resolver: resolver })),
|
182
|
-
react_1.default.createElement(
|
183
|
-
|
198
|
+
react_1.default.createElement("div", { style: lineGradStyle },
|
199
|
+
react_1.default.createElement(ExpandableText_1.default, { 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: (_c = (_b = rec.video) === null || _b === void 0 ? void 0 : _b.title) !== null && _c !== void 0 ? _c : '', 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 }),
|
200
|
+
react_1.default.createElement(Hashtag_1.default, { index: activeIndex, tags: (_e = (_d = rec === null || rec === void 0 ? void 0 : rec.video) === null || _d === void 0 ? void 0 : _d.hashTags) !== null && _e !== void 0 ? _e : [], itemId: (_f = rec === null || rec === void 0 ? void 0 : rec.video) === null || _f === void 0 ? void 0 : _f.itemId, itemType: ((_g = rec.video) === null || _g === void 0 ? void 0 : _g.url) ? 'VIDEO' : null, rec: rec, hashTagStyle: hashTagStyle })))));
|
184
201
|
}
|
185
202
|
return null;
|
186
|
-
}, [
|
203
|
+
}, [
|
204
|
+
descStyle,
|
205
|
+
activeIndex,
|
206
|
+
tempMap,
|
207
|
+
resolver,
|
208
|
+
tipText,
|
209
|
+
nudge,
|
210
|
+
hashTagStyle,
|
211
|
+
globalConfig,
|
212
|
+
onExpandableChange,
|
213
|
+
isShowMore,
|
214
|
+
lineGradStyle
|
215
|
+
]);
|
187
216
|
const renderLikeButton = (0, react_1.useCallback)((rec, index) => {
|
188
217
|
var _a, _b;
|
189
218
|
if (!(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowLike))
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.removeFeUserId = exports.storeAndLoadFeUserId = exports.FAKE_USER_KEY = void 0;
|
3
|
+
exports.getFeUserId = exports.removeFeUserId = exports.storeAndLoadFeUserId = exports.FAKE_USER_KEY = void 0;
|
4
4
|
const lodash_1 = require("lodash");
|
5
5
|
const tool_1 = require("./tool");
|
6
6
|
exports.FAKE_USER_KEY = 'SXP_FAKE_USER_ID';
|
@@ -17,3 +17,8 @@ const removeFeUserId = () => {
|
|
17
17
|
window.localStorage.removeItem(exports.FAKE_USER_KEY);
|
18
18
|
};
|
19
19
|
exports.removeFeUserId = removeFeUserId;
|
20
|
+
const getFeUserId = () => {
|
21
|
+
const fakeUserId = window.localStorage.getItem(exports.FAKE_USER_KEY);
|
22
|
+
return (0, lodash_1.isEmpty)(fakeUserId);
|
23
|
+
};
|
24
|
+
exports.getFeUserId = getFeUserId;
|