pb-sxp-ui 1.2.6 → 1.2.7
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 +53 -37
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +1 -3
- package/dist/index.js +53 -37
- 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 +53 -37
- 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/FormatImage.js +7 -3
- package/es/core/components/SxpPageRender/Popup/index.js +5 -5
- package/es/core/components/SxpPageRender/index.js +5 -5
- package/es/core/context/SxpDataSourceProvider.js +25 -15
- package/es/core/hooks/useEventReport.js +4 -4
- package/es/materials/sxp/popup/CommodityList/index.d.ts +0 -1
- package/es/materials/sxp/popup/CommodityList/index.js +2 -1
- package/es/materials/sxp/template/components/CommodityGroup.d.ts +1 -1
- package/es/materials/sxp/template/components/CommodityGroup.js +2 -1
- package/lib/core/components/SxpPageRender/FormatImage.js +7 -3
- package/lib/core/components/SxpPageRender/Popup/index.js +5 -5
- package/lib/core/components/SxpPageRender/index.js +5 -5
- package/lib/core/context/SxpDataSourceProvider.js +25 -15
- package/lib/core/hooks/useEventReport.js +4 -4
- package/lib/materials/sxp/popup/CommodityList/index.d.ts +0 -1
- package/lib/materials/sxp/popup/CommodityList/index.js +2 -1
- package/lib/materials/sxp/template/components/CommodityGroup.d.ts +1 -1
- package/lib/materials/sxp/template/components/CommodityGroup.js +2 -1
- package/package.json +1 -1
@@ -2,6 +2,7 @@ import React, { forwardRef, memo, useEffect, useImperativeHandle, useRef, useSta
|
|
2
2
|
const FormatImage = forwardRef((props, ref) => {
|
3
3
|
const { src, onLoad, style, className, loading } = props;
|
4
4
|
const [imgSrc, setImgSrc] = useState();
|
5
|
+
const imgRef = useRef(null);
|
5
6
|
useImperativeHandle(ref, () => ({
|
6
7
|
setSrc: (v) => {
|
7
8
|
setImgSrc(v);
|
@@ -10,14 +11,17 @@ const FormatImage = forwardRef((props, ref) => {
|
|
10
11
|
useEffect(() => {
|
11
12
|
setImgSrc(src);
|
12
13
|
}, [src]);
|
13
|
-
const imgRef = useRef(null);
|
14
14
|
return (React.createElement(React.Fragment, null, (imgSrc === null || imgSrc === void 0 ? void 0 : imgSrc.includes('.avif')) ? (React.createElement("picture", null,
|
15
15
|
React.createElement("source", { type: 'image/avif', srcSet: imgSrc }),
|
16
16
|
React.createElement("source", { type: 'image/webp', srcSet: `${imgSrc}?imageMogr2/format/webp` }),
|
17
17
|
React.createElement("source", { type: 'image/jpeg', srcSet: `${imgSrc}?imageMogr2/format/jpg` }),
|
18
|
-
React.createElement("img", { className: className, src: imgSrc, style: style, loading: loading, onLoad: (e) => {
|
18
|
+
React.createElement("img", { ref: imgRef, className: className, src: imgSrc, style: Object.assign(Object.assign({}, style), { display: 'none' }), loading: loading, onLoad: (e) => {
|
19
|
+
if (imgRef.current)
|
20
|
+
imgRef.current.style.display = 'block';
|
19
21
|
onLoad === null || onLoad === void 0 ? void 0 : onLoad(e.target);
|
20
|
-
}, alt: 'image' }))) : (React.createElement("img", { className: className, src: imgSrc, style: style, loading: loading, onLoad: (e) => {
|
22
|
+
}, alt: 'image' }))) : (React.createElement("img", { ref: imgRef, className: className, src: imgSrc, style: Object.assign(Object.assign({}, style), { display: 'none' }), loading: loading, onLoad: (e) => {
|
23
|
+
if (imgRef.current)
|
24
|
+
imgRef.current.style.display = 'block';
|
21
25
|
onLoad === null || onLoad === void 0 ? void 0 : onLoad(e.target);
|
22
26
|
}, alt: 'image' }))));
|
23
27
|
});
|
@@ -25,7 +25,7 @@ const Popup = () => {
|
|
25
25
|
}
|
26
26
|
}, [popup]);
|
27
27
|
const handleClose = () => {
|
28
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
28
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
29
29
|
if (!popup ||
|
30
30
|
(popup === null || popup === void 0 ? void 0 : popup.id) === '' ||
|
31
31
|
!visible ||
|
@@ -36,10 +36,10 @@ const Popup = () => {
|
|
36
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
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
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 = (
|
39
|
+
let product = (_h = (_g = data === null || data === void 0 ? void 0 : data.video) === null || _g === void 0 ? void 0 : _g.bindProduct) !== null && _h !== void 0 ? _h : (_k = (_j = data === null || data === void 0 ? void 0 : data.video) === null || _j === void 0 ? void 0 : _j.bindProducts) === null || _k === void 0 ? void 0 : _k[0];
|
40
|
+
let cta = (_o = (_m = (_l = data === null || data === void 0 ? void 0 : data.video) === null || _l === void 0 ? void 0 : _l.bindProduct) === null || _m === void 0 ? void 0 : _m.bindCta) !== null && _o !== void 0 ? _o : (_r = (_q = (_p = data === null || data === void 0 ? void 0 : data.video) === null || _p === void 0 ? void 0 : _p.bindProducts) === null || _q === void 0 ? void 0 : _q[0]) === null || _r === void 0 ? void 0 : _r.bindCta;
|
41
41
|
if ((checkCommodityIndexRef === null || checkCommodityIndexRef === void 0 ? void 0 : checkCommodityIndexRef.current) >= 0) {
|
42
|
-
const p = (
|
42
|
+
const p = (_t = (_s = data === null || data === void 0 ? void 0 : data.video) === null || _s === void 0 ? void 0 : _s.bindProducts) === null || _t === void 0 ? void 0 : _t[checkCommodityIndexRef === null || checkCommodityIndexRef === void 0 ? void 0 : checkCommodityIndexRef.current];
|
43
43
|
if (p) {
|
44
44
|
product = p;
|
45
45
|
cta = p === null || p === void 0 ? void 0 : p.bindCta;
|
@@ -65,7 +65,7 @@ const Popup = () => {
|
|
65
65
|
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';
|
66
66
|
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';
|
67
67
|
const defaulSetting = (_h = t === null || t === void 0 ? void 0 : t.extend) === null || _h === void 0 ? void 0 : _h.defaulSetting;
|
68
|
-
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
|
68
|
+
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 })));
|
69
69
|
}
|
70
70
|
else {
|
71
71
|
return React.createElement(React.Fragment, null);
|
@@ -78,7 +78,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
78
78
|
useEffect(() => {
|
79
79
|
const item = data === null || data === void 0 ? void 0 : data[activeIndex];
|
80
80
|
const visibleChange = () => {
|
81
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
81
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
|
82
82
|
const repCond = !openHashtag && !isShowConsent;
|
83
83
|
if (document.visibilityState === 'hidden') {
|
84
84
|
if (repCond) {
|
@@ -116,7 +116,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
116
116
|
fromKName,
|
117
117
|
fromKPage: location === null || location === void 0 ? void 0 : location.href,
|
118
118
|
ctatId: (_r = (_q = (_p = item === null || item === void 0 ? void 0 : item.video) === null || _p === void 0 ? void 0 : _p.bindCta) === null || _q === void 0 ? void 0 : _q.itemId) !== null && _r !== void 0 ? _r : '',
|
119
|
-
traceInfo: (_t = (_s = item === null || item === void 0 ? void 0 : item.video) === null || _s === void 0 ? void 0 : _s.traceInfo) !== null && _t !== void 0 ? _t : ''
|
119
|
+
traceInfo: (_v = (_t = (_s = item === null || item === void 0 ? void 0 : item.video) === null || _s === void 0 ? void 0 : _s.traceInfo) !== null && _t !== void 0 ? _t : (_u = item === null || item === void 0 ? void 0 : item.product) === null || _u === void 0 ? void 0 : _u.traceInfo) !== null && _v !== void 0 ? _v : ''
|
120
120
|
}
|
121
121
|
});
|
122
122
|
}
|
@@ -160,7 +160,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
160
160
|
const minusHeight = useMemo(() => {
|
161
161
|
let minusHeight = 0;
|
162
162
|
if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.logoUrl) && (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowLogo)) {
|
163
|
-
minusHeight +=
|
163
|
+
minusHeight += 56;
|
164
164
|
}
|
165
165
|
return minusHeight;
|
166
166
|
}, []);
|
@@ -286,7 +286,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
286
286
|
}
|
287
287
|
};
|
288
288
|
const handleSlideSkip = (item, position) => {
|
289
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
289
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
290
290
|
if (isPreview || waterFallData)
|
291
291
|
return;
|
292
292
|
const t = new Date() - curTime.current;
|
@@ -305,7 +305,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
305
305
|
contentTags: (product === null || product === void 0 ? void 0 : product.tags) ? JSON.stringify(product === null || product === void 0 ? void 0 : product.tags) : '',
|
306
306
|
position: position + '',
|
307
307
|
contentId: (_q = (_p = item === null || item === void 0 ? void 0 : item.video) === null || _p === void 0 ? void 0 : _p.itemId) !== null && _q !== void 0 ? _q : '',
|
308
|
-
traceInfo: (_s = (_r = item === null || item === void 0 ? void 0 : item.video) === null || _r === void 0 ? void 0 : _r.traceInfo) !== null && _s !== void 0 ? _s : ''
|
308
|
+
traceInfo: (_u = (_s = (_r = item === null || item === void 0 ? void 0 : item.video) === null || _r === void 0 ? void 0 : _r.traceInfo) !== null && _s !== void 0 ? _s : (_t = item === null || item === void 0 ? void 0 : item.product) === null || _t === void 0 ? void 0 : _t.traceInfo) !== null && _u !== void 0 ? _u : ''
|
309
309
|
}
|
310
310
|
});
|
311
311
|
setSlideSkipState();
|
@@ -40,6 +40,19 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
40
40
|
var _a, _b, _c, _d;
|
41
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;
|
42
42
|
}, [isAgreePolicy, globalConfig, isOpenConsent, isEditor]);
|
43
|
+
const getFilterRecList = useCallback((data) => {
|
44
|
+
var _a;
|
45
|
+
const recList = data === null || data === void 0 ? void 0 : data.recList;
|
46
|
+
const nList = (_a = recList === null || recList === void 0 ? void 0 : recList.map((item) => {
|
47
|
+
var _a, _b, _c, _d, _e, _f;
|
48
|
+
if (((_a = item === null || item === void 0 ? void 0 : item.video) === null || _a === void 0 ? void 0 : _a.bindProducts) && ((_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.length) > 0) {
|
49
|
+
const bindProducts = (_f = (_e = (_d = item === null || item === void 0 ? void 0 : item.video) === null || _d === void 0 ? void 0 : _d.bindProducts) === null || _e === void 0 ? void 0 : _e.filter((item) => !!(item === null || item === void 0 ? void 0 : item.bindCta))) !== null && _f !== void 0 ? _f : [];
|
50
|
+
return Object.assign(Object.assign({}, item), { video: Object.assign(Object.assign({}, item === null || item === void 0 ? void 0 : item.video), { bindProducts }) });
|
51
|
+
}
|
52
|
+
return item;
|
53
|
+
})) !== null && _a !== void 0 ? _a : [];
|
54
|
+
return nList;
|
55
|
+
}, []);
|
43
56
|
useEffect(() => {
|
44
57
|
const handleChangeThemeTag = (tag) => {
|
45
58
|
themeTag.current = tag;
|
@@ -106,7 +119,6 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
106
119
|
return result === null || result === void 0 ? void 0 : result.data;
|
107
120
|
}), [bffFetch, utmVal, maxSize, defaultSize]);
|
108
121
|
const loadVideos = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
109
|
-
var _j, _k;
|
110
122
|
if (rtcList.length <= 0) {
|
111
123
|
return;
|
112
124
|
}
|
@@ -116,8 +128,8 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
116
128
|
'itemFilter.itemType': waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.itemType,
|
117
129
|
themeTag: themeTag.current
|
118
130
|
});
|
119
|
-
setRtcList(
|
120
|
-
setCacheRtcList(
|
131
|
+
setRtcList(getFilterRecList(data));
|
132
|
+
setCacheRtcList(getFilterRecList(data));
|
121
133
|
}), [getRecommendVideos, rtcList, waterFallData, cacheRtcList]);
|
122
134
|
const bffEventReport = useCallback(({ userInfo, eventInfo }) => {
|
123
135
|
if (!enableReportEvent) {
|
@@ -175,24 +187,24 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
175
187
|
return res === null || res === void 0 ? void 0 : res.success;
|
176
188
|
}), [bffFetch]);
|
177
189
|
const bffGetTagList = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
178
|
-
var
|
190
|
+
var _j, _k, _l, _m, _o;
|
179
191
|
if (!utmVal || !isShowTag)
|
180
192
|
return;
|
181
193
|
try {
|
182
|
-
const val = (
|
194
|
+
const val = (_l = (_k = (_j = utmVal === null || utmVal === void 0 ? void 0 : utmVal.split('&')) === null || _j === void 0 ? void 0 : _j.filter((val) => {
|
183
195
|
var _a, _b;
|
184
196
|
const key = val.split('=')[0];
|
185
197
|
return (_b = ((_a = utmParameter === null || utmParameter === void 0 ? void 0 : utmParameter.channels) !== null && _a !== void 0 ? _a : [])) === null || _b === void 0 ? void 0 : _b.includes(key);
|
186
|
-
})) === null ||
|
198
|
+
})) === null || _k === void 0 ? void 0 : _k.join('&')) !== null && _l !== void 0 ? _l : '';
|
187
199
|
const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/tag/list', { method: 'GET', query: { channel: decodeURIComponent(val) } }));
|
188
|
-
setTagList((
|
200
|
+
setTagList((_o = (_m = result === null || result === void 0 ? void 0 : result.data) === null || _m === void 0 ? void 0 : _m.tags) !== null && _o !== void 0 ? _o : []);
|
189
201
|
}
|
190
202
|
catch (e) {
|
191
203
|
console.log('e', e);
|
192
204
|
}
|
193
205
|
}), [bffFetch, utmVal, isShowTag]);
|
194
206
|
const ctaEvent = useCallback((eventInfo, rec, product, position) => {
|
195
|
-
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;
|
207
|
+
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;
|
196
208
|
const cta = product === null || product === void 0 ? void 0 : product.bindCta;
|
197
209
|
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);
|
198
210
|
let fromKName = '';
|
@@ -206,7 +218,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
206
218
|
fromKName = 'imagePage';
|
207
219
|
}
|
208
220
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
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: (
|
221
|
+
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: (_2 = (_z = (_u = (_q = (_m = cta === null || cta === void 0 ? void 0 : cta.traceInfo) !== null && _m !== void 0 ? _m : (_p = (_o = rec === null || rec === void 0 ? void 0 : rec.video) === null || _o === void 0 ? void 0 : _o.bindCta) === null || _p === void 0 ? void 0 : _p.traceInfo) !== null && _q !== void 0 ? _q : (_t = (_s = (_r = rec === null || rec === void 0 ? void 0 : rec.video) === null || _r === void 0 ? void 0 : _r.bindProduct) === null || _s === void 0 ? void 0 : _s.bindCta) === null || _t === void 0 ? void 0 : _t.traceInfo) !== null && _u !== void 0 ? _u : (_y = (_x = (_w = (_v = rec === null || rec === void 0 ? void 0 : rec.video) === null || _v === void 0 ? void 0 : _v.bindProducts) === null || _w === void 0 ? void 0 : _w[0]) === null || _x === void 0 ? void 0 : _x.bindCta) === null || _y === void 0 ? void 0 : _y.traceInfo) !== null && _z !== void 0 ? _z : (_1 = (_0 = rec === null || rec === void 0 ? void 0 : rec.product) === null || _0 === void 0 ? void 0 : _0.bindCta) === null || _1 === void 0 ? void 0 : _1.traceInfo) !== null && _2 !== void 0 ? _2 : '', fromKName, fromKPage: (_3 = location === null || location === void 0 ? void 0 : location.href) !== null && _3 !== void 0 ? _3 : '' })
|
210
222
|
});
|
211
223
|
}, [bffEventReport, isFromHashtag]);
|
212
224
|
const h5EnterLink = useCallback(() => {
|
@@ -246,9 +258,8 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
246
258
|
bffGetTagList();
|
247
259
|
getRecommendVideos()
|
248
260
|
.then((data) => {
|
249
|
-
|
250
|
-
|
251
|
-
setCacheRtcList((_b = data === null || data === void 0 ? void 0 : data.recList) !== null && _b !== void 0 ? _b : []);
|
261
|
+
setRtcList(getFilterRecList(data));
|
262
|
+
setCacheRtcList(getFilterRecList(data));
|
252
263
|
})
|
253
264
|
.finally(() => {
|
254
265
|
bffEventReport({
|
@@ -268,9 +279,8 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
268
279
|
bffGetTagList();
|
269
280
|
getRecommendVideos()
|
270
281
|
.then((data) => {
|
271
|
-
|
272
|
-
|
273
|
-
setCacheRtcList((_b = data === null || data === void 0 ? void 0 : data.recList) !== null && _b !== void 0 ? _b : []);
|
282
|
+
setRtcList(getFilterRecList(data));
|
283
|
+
setCacheRtcList(getFilterRecList(data));
|
274
284
|
})
|
275
285
|
.finally(() => {
|
276
286
|
setLoading(false);
|
@@ -4,7 +4,7 @@ import { DEFAULT_TAG } from '../context/SxpDataSourceProvider';
|
|
4
4
|
export function useEventReport() {
|
5
5
|
const { bffEventReport, popupDetailData, waterFallData, isFromHashtag } = useSxpDataSource();
|
6
6
|
const jumpToWeb = useCallback((data, product, cta, position) => {
|
7
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
|
7
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1;
|
8
8
|
let fromKName = '';
|
9
9
|
if (popupDetailData && (((_b = (_a = data === null || data === void 0 ? void 0 : data.video) === null || _a === void 0 ? void 0 : _a.bindProducts) === null || _b === void 0 ? void 0 : _b.length) || ((_c = data === null || data === void 0 ? void 0 : data.video) === null || _c === void 0 ? void 0 : _c.bindProduct))) {
|
10
10
|
fromKName = 'pdpPage';
|
@@ -35,12 +35,12 @@ export function useEventReport() {
|
|
35
35
|
position: position + '',
|
36
36
|
contentId: (_m = (_l = data === null || data === void 0 ? void 0 : data.video) === null || _l === void 0 ? void 0 : _l.itemId) !== null && _m !== void 0 ? _m : '',
|
37
37
|
ctatId: (_o = cta === null || cta === void 0 ? void 0 : cta.itemId) !== null && _o !== void 0 ? _o : '',
|
38
|
-
traceInfo: (
|
38
|
+
traceInfo: (_1 = (_y = (_w = (_s = (_p = product === null || product === void 0 ? void 0 : product.traceInfo) !== null && _p !== void 0 ? _p : (_r = (_q = data === null || data === void 0 ? void 0 : data.video) === null || _q === void 0 ? void 0 : _q.bindProduct) === null || _r === void 0 ? void 0 : _r.traceInfo) !== null && _s !== void 0 ? _s : (_v = (_u = (_t = data === null || data === void 0 ? void 0 : data.video) === null || _t === void 0 ? void 0 : _t.bindProducts) === null || _u === void 0 ? void 0 : _u[0]) === null || _v === void 0 ? void 0 : _v.traceInfo) !== null && _w !== void 0 ? _w : (_x = data === null || data === void 0 ? void 0 : data.product) === null || _x === void 0 ? void 0 : _x.traceInfo) !== null && _y !== void 0 ? _y : (_0 = (_z = data === null || data === void 0 ? void 0 : data.video) === null || _z === void 0 ? void 0 : _z.bindCta) === null || _0 === void 0 ? void 0 : _0.traceInfo) !== null && _1 !== void 0 ? _1 : ''
|
39
39
|
}
|
40
40
|
});
|
41
41
|
}, [bffEventReport, popupDetailData, isFromHashtag]);
|
42
42
|
const productView = useCallback((data, product, cta, viewTime, position) => {
|
43
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
43
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
44
44
|
let fromKName = '';
|
45
45
|
if (popupDetailData && (((_b = (_a = data === null || data === void 0 ? void 0 : data.video) === null || _a === void 0 ? void 0 : _a.bindProducts) === null || _b === void 0 ? void 0 : _b.length) || ((_c = data === null || data === void 0 ? void 0 : data.video) === null || _c === void 0 ? void 0 : _c.bindProduct))) {
|
46
46
|
fromKName = 'pdpPage';
|
@@ -60,7 +60,7 @@ export function useEventReport() {
|
|
60
60
|
position: position + '',
|
61
61
|
contentId: (_d = data === null || data === void 0 ? void 0 : data.video) === null || _d === void 0 ? void 0 : _d.itemId,
|
62
62
|
ctatId: cta === null || cta === void 0 ? void 0 : cta.itemId,
|
63
|
-
traceInfo: (
|
63
|
+
traceInfo: (_p = (_m = (_h = (_e = product === null || product === void 0 ? void 0 : product.traceInfo) !== null && _e !== void 0 ? _e : (_g = (_f = data === null || data === void 0 ? void 0 : data.video) === null || _f === void 0 ? void 0 : _f.bindProduct) === null || _g === void 0 ? void 0 : _g.traceInfo) !== null && _h !== void 0 ? _h : (_l = (_k = (_j = data === null || data === void 0 ? void 0 : data.video) === null || _j === void 0 ? void 0 : _j.bindProducts) === null || _k === void 0 ? void 0 : _k[0]) === null || _l === void 0 ? void 0 : _l.traceInfo) !== null && _m !== void 0 ? _m : (_o = data === null || data === void 0 ? void 0 : data.product) === null || _o === void 0 ? void 0 : _o.traceInfo) !== null && _p !== void 0 ? _p : '',
|
64
64
|
timeOnSite: Math.floor((new Date() - viewTime) / 1000) + '',
|
65
65
|
eventSubject: 'productView',
|
66
66
|
eventDescription: 'User browsed the product'
|
@@ -9,12 +9,13 @@ import Img from '../../template/components/Img';
|
|
9
9
|
import { throttle } from 'lodash';
|
10
10
|
const CommodityList = (_a) => {
|
11
11
|
var _b, _c;
|
12
|
-
var { style, isDefault, rec, viewTime, isPost, bottom_image, commodityStyles, buttonStyle,
|
12
|
+
var { style, isDefault, rec, viewTime, isPost, bottom_image, commodityStyles, buttonStyle, translateY = 0, commodityPicture, isExternalLink, onClick } = _a, props = __rest(_a, ["style", "isDefault", "rec", "viewTime", "isPost", "bottom_image", "commodityStyles", "buttonStyle", "translateY", "commodityPicture", "isExternalLink", "onClick"]);
|
13
13
|
const { sxpParameter, popupDetailData, setPopupDetailData, ctaEvent } = useSxpDataSource();
|
14
14
|
const { jumpToWeb } = useEventReport();
|
15
15
|
const { popup } = useEditor();
|
16
16
|
const recData = isPost ? rec : popupDetailData;
|
17
17
|
const product = (_c = (_b = recData === null || recData === void 0 ? void 0 : recData.video) === null || _b === void 0 ? void 0 : _b.bindProducts) !== null && _c !== void 0 ? _c : [null, null, null, null];
|
18
|
+
const index = popupDetailData === null || popupDetailData === void 0 ? void 0 : popupDetailData.index;
|
18
19
|
const priceText = useCallback((product) => {
|
19
20
|
var _a, _b, _c, _d, _e;
|
20
21
|
if ((product === null || product === void 0 ? void 0 : product.currency) && (product === null || product === void 0 ? void 0 : product.price)) {
|
@@ -12,7 +12,7 @@ interface ICommodityGroupProps {
|
|
12
12
|
style?: CSSProperties;
|
13
13
|
onCLick?: (i: number) => void;
|
14
14
|
popupDetailData?: ISxpDataSourceContext['popupDetailData'];
|
15
|
-
check
|
15
|
+
check: number;
|
16
16
|
}
|
17
17
|
declare const _default: React.NamedExoticComponent<ICommodityGroupProps>;
|
18
18
|
export default _default;
|
@@ -12,7 +12,8 @@ const CommodityGroup = ({ products, data, defImg, style, onCLick, popupDetailDat
|
|
12
12
|
const handleClick = (item, index) => {
|
13
13
|
if (check === index)
|
14
14
|
return;
|
15
|
-
|
15
|
+
const prevItem = products === null || products === void 0 ? void 0 : products[check];
|
16
|
+
productView(popupDetailData, prevItem, prevItem === null || prevItem === void 0 ? void 0 : prevItem.bindCta, popupCurTimeRef.current, popupDetailData === null || popupDetailData === void 0 ? void 0 : popupDetailData.index);
|
16
17
|
onCLick === null || onCLick === void 0 ? void 0 : onCLick(index);
|
17
18
|
};
|
18
19
|
return (React.createElement(React.Fragment, null, (data === null || data === void 0 ? void 0 : data.open) && ((products && (products === null || products === void 0 ? void 0 : products.length) > 1) || !popupDetailData) && (React.createElement(Scroll, { enableSlideActive: true, isPadding: false, style: Object.assign(Object.assign({}, style), data === null || data === void 0 ? void 0 : data.style) }, (_a = (popupDetailData ? products : [0, 1, 2, 3])) === null || _a === void 0 ? void 0 : _a.map((item, index) => {
|
@@ -5,6 +5,7 @@ const react_1 = tslib_1.__importStar(require("react"));
|
|
5
5
|
const FormatImage = (0, react_1.forwardRef)((props, ref) => {
|
6
6
|
const { src, onLoad, style, className, loading } = props;
|
7
7
|
const [imgSrc, setImgSrc] = (0, react_1.useState)();
|
8
|
+
const imgRef = (0, react_1.useRef)(null);
|
8
9
|
(0, react_1.useImperativeHandle)(ref, () => ({
|
9
10
|
setSrc: (v) => {
|
10
11
|
setImgSrc(v);
|
@@ -13,14 +14,17 @@ const FormatImage = (0, react_1.forwardRef)((props, ref) => {
|
|
13
14
|
(0, react_1.useEffect)(() => {
|
14
15
|
setImgSrc(src);
|
15
16
|
}, [src]);
|
16
|
-
const imgRef = (0, react_1.useRef)(null);
|
17
17
|
return (react_1.default.createElement(react_1.default.Fragment, null, (imgSrc === null || imgSrc === void 0 ? void 0 : imgSrc.includes('.avif')) ? (react_1.default.createElement("picture", null,
|
18
18
|
react_1.default.createElement("source", { type: 'image/avif', srcSet: imgSrc }),
|
19
19
|
react_1.default.createElement("source", { type: 'image/webp', srcSet: `${imgSrc}?imageMogr2/format/webp` }),
|
20
20
|
react_1.default.createElement("source", { type: 'image/jpeg', srcSet: `${imgSrc}?imageMogr2/format/jpg` }),
|
21
|
-
react_1.default.createElement("img", { className: className, src: imgSrc, style: style, loading: loading, onLoad: (e) => {
|
21
|
+
react_1.default.createElement("img", { ref: imgRef, className: className, src: imgSrc, style: Object.assign(Object.assign({}, style), { display: 'none' }), loading: loading, onLoad: (e) => {
|
22
|
+
if (imgRef.current)
|
23
|
+
imgRef.current.style.display = 'block';
|
22
24
|
onLoad === null || onLoad === void 0 ? void 0 : onLoad(e.target);
|
23
|
-
}, alt: 'image' }))) : (react_1.default.createElement("img", { className: className, src: imgSrc, style: style, loading: loading, onLoad: (e) => {
|
25
|
+
}, alt: 'image' }))) : (react_1.default.createElement("img", { ref: imgRef, className: className, src: imgSrc, style: Object.assign(Object.assign({}, style), { display: 'none' }), loading: loading, onLoad: (e) => {
|
26
|
+
if (imgRef.current)
|
27
|
+
imgRef.current.style.display = 'block';
|
24
28
|
onLoad === null || onLoad === void 0 ? void 0 : onLoad(e.target);
|
25
29
|
}, alt: 'image' }))));
|
26
30
|
});
|
@@ -28,7 +28,7 @@ const Popup = () => {
|
|
28
28
|
}
|
29
29
|
}, [popup]);
|
30
30
|
const handleClose = () => {
|
31
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
31
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
32
32
|
if (!popup ||
|
33
33
|
(popup === null || popup === void 0 ? void 0 : popup.id) === '' ||
|
34
34
|
!visible ||
|
@@ -39,10 +39,10 @@ const Popup = () => {
|
|
39
39
|
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));
|
40
40
|
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') {
|
41
41
|
const data = popupDetailData;
|
42
|
-
let product = (_g = data === null || data === void 0 ? void 0 : data.video) === null || _g === void 0 ? void 0 : _g.bindProduct;
|
43
|
-
let cta = (
|
42
|
+
let product = (_h = (_g = data === null || data === void 0 ? void 0 : data.video) === null || _g === void 0 ? void 0 : _g.bindProduct) !== null && _h !== void 0 ? _h : (_k = (_j = data === null || data === void 0 ? void 0 : data.video) === null || _j === void 0 ? void 0 : _j.bindProducts) === null || _k === void 0 ? void 0 : _k[0];
|
43
|
+
let cta = (_o = (_m = (_l = data === null || data === void 0 ? void 0 : data.video) === null || _l === void 0 ? void 0 : _l.bindProduct) === null || _m === void 0 ? void 0 : _m.bindCta) !== null && _o !== void 0 ? _o : (_r = (_q = (_p = data === null || data === void 0 ? void 0 : data.video) === null || _p === void 0 ? void 0 : _p.bindProducts) === null || _q === void 0 ? void 0 : _q[0]) === null || _r === void 0 ? void 0 : _r.bindCta;
|
44
44
|
if ((checkCommodityIndexRef === null || checkCommodityIndexRef === void 0 ? void 0 : checkCommodityIndexRef.current) >= 0) {
|
45
|
-
const p = (
|
45
|
+
const p = (_t = (_s = data === null || data === void 0 ? void 0 : data.video) === null || _s === void 0 ? void 0 : _s.bindProducts) === null || _t === void 0 ? void 0 : _t[checkCommodityIndexRef === null || checkCommodityIndexRef === void 0 ? void 0 : checkCommodityIndexRef.current];
|
46
46
|
if (p) {
|
47
47
|
product = p;
|
48
48
|
cta = p === null || p === void 0 ? void 0 : p.bindCta;
|
@@ -68,7 +68,7 @@ const Popup = () => {
|
|
68
68
|
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';
|
69
69
|
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';
|
70
70
|
const defaulSetting = (_h = t === null || t === void 0 ? void 0 : t.extend) === null || _h === void 0 ? void 0 : _h.defaulSetting;
|
71
|
-
return (react_1.default.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
|
71
|
+
return (react_1.default.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 })));
|
72
72
|
}
|
73
73
|
else {
|
74
74
|
return react_1.default.createElement(react_1.default.Fragment, null);
|
@@ -81,7 +81,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
81
81
|
(0, react_1.useEffect)(() => {
|
82
82
|
const item = data === null || data === void 0 ? void 0 : data[activeIndex];
|
83
83
|
const visibleChange = () => {
|
84
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
84
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
|
85
85
|
const repCond = !openHashtag && !isShowConsent;
|
86
86
|
if (document.visibilityState === 'hidden') {
|
87
87
|
if (repCond) {
|
@@ -119,7 +119,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
119
119
|
fromKName,
|
120
120
|
fromKPage: location === null || location === void 0 ? void 0 : location.href,
|
121
121
|
ctatId: (_r = (_q = (_p = item === null || item === void 0 ? void 0 : item.video) === null || _p === void 0 ? void 0 : _p.bindCta) === null || _q === void 0 ? void 0 : _q.itemId) !== null && _r !== void 0 ? _r : '',
|
122
|
-
traceInfo: (_t = (_s = item === null || item === void 0 ? void 0 : item.video) === null || _s === void 0 ? void 0 : _s.traceInfo) !== null && _t !== void 0 ? _t : ''
|
122
|
+
traceInfo: (_v = (_t = (_s = item === null || item === void 0 ? void 0 : item.video) === null || _s === void 0 ? void 0 : _s.traceInfo) !== null && _t !== void 0 ? _t : (_u = item === null || item === void 0 ? void 0 : item.product) === null || _u === void 0 ? void 0 : _u.traceInfo) !== null && _v !== void 0 ? _v : ''
|
123
123
|
}
|
124
124
|
});
|
125
125
|
}
|
@@ -163,7 +163,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
163
163
|
const minusHeight = (0, react_1.useMemo)(() => {
|
164
164
|
let minusHeight = 0;
|
165
165
|
if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.logoUrl) && (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowLogo)) {
|
166
|
-
minusHeight +=
|
166
|
+
minusHeight += 56;
|
167
167
|
}
|
168
168
|
return minusHeight;
|
169
169
|
}, []);
|
@@ -289,7 +289,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
289
289
|
}
|
290
290
|
};
|
291
291
|
const handleSlideSkip = (item, position) => {
|
292
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
292
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
293
293
|
if (isPreview || waterFallData)
|
294
294
|
return;
|
295
295
|
const t = new Date() - curTime.current;
|
@@ -308,7 +308,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
308
308
|
contentTags: (product === null || product === void 0 ? void 0 : product.tags) ? JSON.stringify(product === null || product === void 0 ? void 0 : product.tags) : '',
|
309
309
|
position: position + '',
|
310
310
|
contentId: (_q = (_p = item === null || item === void 0 ? void 0 : item.video) === null || _p === void 0 ? void 0 : _p.itemId) !== null && _q !== void 0 ? _q : '',
|
311
|
-
traceInfo: (_s = (_r = item === null || item === void 0 ? void 0 : item.video) === null || _r === void 0 ? void 0 : _r.traceInfo) !== null && _s !== void 0 ? _s : ''
|
311
|
+
traceInfo: (_u = (_s = (_r = item === null || item === void 0 ? void 0 : item.video) === null || _r === void 0 ? void 0 : _r.traceInfo) !== null && _s !== void 0 ? _s : (_t = item === null || item === void 0 ? void 0 : item.product) === null || _t === void 0 ? void 0 : _t.traceInfo) !== null && _u !== void 0 ? _u : ''
|
312
312
|
}
|
313
313
|
});
|
314
314
|
(0, localStore_1.setSlideSkipState)();
|
@@ -43,6 +43,19 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
43
43
|
var _a, _b, _c, _d;
|
44
44
|
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;
|
45
45
|
}, [isAgreePolicy, globalConfig, isOpenConsent, isEditor]);
|
46
|
+
const getFilterRecList = (0, react_1.useCallback)((data) => {
|
47
|
+
var _a;
|
48
|
+
const recList = data === null || data === void 0 ? void 0 : data.recList;
|
49
|
+
const nList = (_a = recList === null || recList === void 0 ? void 0 : recList.map((item) => {
|
50
|
+
var _a, _b, _c, _d, _e, _f;
|
51
|
+
if (((_a = item === null || item === void 0 ? void 0 : item.video) === null || _a === void 0 ? void 0 : _a.bindProducts) && ((_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.length) > 0) {
|
52
|
+
const bindProducts = (_f = (_e = (_d = item === null || item === void 0 ? void 0 : item.video) === null || _d === void 0 ? void 0 : _d.bindProducts) === null || _e === void 0 ? void 0 : _e.filter((item) => !!(item === null || item === void 0 ? void 0 : item.bindCta))) !== null && _f !== void 0 ? _f : [];
|
53
|
+
return Object.assign(Object.assign({}, item), { video: Object.assign(Object.assign({}, item === null || item === void 0 ? void 0 : item.video), { bindProducts }) });
|
54
|
+
}
|
55
|
+
return item;
|
56
|
+
})) !== null && _a !== void 0 ? _a : [];
|
57
|
+
return nList;
|
58
|
+
}, []);
|
46
59
|
(0, react_1.useEffect)(() => {
|
47
60
|
const handleChangeThemeTag = (tag) => {
|
48
61
|
themeTag.current = tag;
|
@@ -109,7 +122,6 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
109
122
|
return result === null || result === void 0 ? void 0 : result.data;
|
110
123
|
}), [bffFetch, utmVal, maxSize, defaultSize]);
|
111
124
|
const loadVideos = (0, react_1.useCallback)(() => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
112
|
-
var _j, _k;
|
113
125
|
if (rtcList.length <= 0) {
|
114
126
|
return;
|
115
127
|
}
|
@@ -119,8 +131,8 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
119
131
|
'itemFilter.itemType': waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.itemType,
|
120
132
|
themeTag: themeTag.current
|
121
133
|
});
|
122
|
-
setRtcList(
|
123
|
-
setCacheRtcList(
|
134
|
+
setRtcList(getFilterRecList(data));
|
135
|
+
setCacheRtcList(getFilterRecList(data));
|
124
136
|
}), [getRecommendVideos, rtcList, waterFallData, cacheRtcList]);
|
125
137
|
const bffEventReport = (0, react_1.useCallback)(({ userInfo, eventInfo }) => {
|
126
138
|
if (!enableReportEvent) {
|
@@ -178,24 +190,24 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
178
190
|
return res === null || res === void 0 ? void 0 : res.success;
|
179
191
|
}), [bffFetch]);
|
180
192
|
const bffGetTagList = (0, react_1.useCallback)(() => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
181
|
-
var
|
193
|
+
var _j, _k, _l, _m, _o;
|
182
194
|
if (!utmVal || !isShowTag)
|
183
195
|
return;
|
184
196
|
try {
|
185
|
-
const val = (
|
197
|
+
const val = (_l = (_k = (_j = utmVal === null || utmVal === void 0 ? void 0 : utmVal.split('&')) === null || _j === void 0 ? void 0 : _j.filter((val) => {
|
186
198
|
var _a, _b;
|
187
199
|
const key = val.split('=')[0];
|
188
200
|
return (_b = ((_a = utmParameter === null || utmParameter === void 0 ? void 0 : utmParameter.channels) !== null && _a !== void 0 ? _a : [])) === null || _b === void 0 ? void 0 : _b.includes(key);
|
189
|
-
})) === null ||
|
201
|
+
})) === null || _k === void 0 ? void 0 : _k.join('&')) !== null && _l !== void 0 ? _l : '';
|
190
202
|
const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/tag/list', { method: 'GET', query: { channel: decodeURIComponent(val) } }));
|
191
|
-
setTagList((
|
203
|
+
setTagList((_o = (_m = result === null || result === void 0 ? void 0 : result.data) === null || _m === void 0 ? void 0 : _m.tags) !== null && _o !== void 0 ? _o : []);
|
192
204
|
}
|
193
205
|
catch (e) {
|
194
206
|
console.log('e', e);
|
195
207
|
}
|
196
208
|
}), [bffFetch, utmVal, isShowTag]);
|
197
209
|
const ctaEvent = (0, react_1.useCallback)((eventInfo, rec, product, position) => {
|
198
|
-
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;
|
210
|
+
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;
|
199
211
|
const cta = product === null || product === void 0 ? void 0 : product.bindCta;
|
200
212
|
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);
|
201
213
|
let fromKName = '';
|
@@ -209,7 +221,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
209
221
|
fromKName = 'imagePage';
|
210
222
|
}
|
211
223
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
212
|
-
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: (
|
224
|
+
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: (_2 = (_z = (_u = (_q = (_m = cta === null || cta === void 0 ? void 0 : cta.traceInfo) !== null && _m !== void 0 ? _m : (_p = (_o = rec === null || rec === void 0 ? void 0 : rec.video) === null || _o === void 0 ? void 0 : _o.bindCta) === null || _p === void 0 ? void 0 : _p.traceInfo) !== null && _q !== void 0 ? _q : (_t = (_s = (_r = rec === null || rec === void 0 ? void 0 : rec.video) === null || _r === void 0 ? void 0 : _r.bindProduct) === null || _s === void 0 ? void 0 : _s.bindCta) === null || _t === void 0 ? void 0 : _t.traceInfo) !== null && _u !== void 0 ? _u : (_y = (_x = (_w = (_v = rec === null || rec === void 0 ? void 0 : rec.video) === null || _v === void 0 ? void 0 : _v.bindProducts) === null || _w === void 0 ? void 0 : _w[0]) === null || _x === void 0 ? void 0 : _x.bindCta) === null || _y === void 0 ? void 0 : _y.traceInfo) !== null && _z !== void 0 ? _z : (_1 = (_0 = rec === null || rec === void 0 ? void 0 : rec.product) === null || _0 === void 0 ? void 0 : _0.bindCta) === null || _1 === void 0 ? void 0 : _1.traceInfo) !== null && _2 !== void 0 ? _2 : '', fromKName, fromKPage: (_3 = location === null || location === void 0 ? void 0 : location.href) !== null && _3 !== void 0 ? _3 : '' })
|
213
225
|
});
|
214
226
|
}, [bffEventReport, isFromHashtag]);
|
215
227
|
const h5EnterLink = (0, react_1.useCallback)(() => {
|
@@ -249,9 +261,8 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
249
261
|
bffGetTagList();
|
250
262
|
getRecommendVideos()
|
251
263
|
.then((data) => {
|
252
|
-
|
253
|
-
|
254
|
-
setCacheRtcList((_b = data === null || data === void 0 ? void 0 : data.recList) !== null && _b !== void 0 ? _b : []);
|
264
|
+
setRtcList(getFilterRecList(data));
|
265
|
+
setCacheRtcList(getFilterRecList(data));
|
255
266
|
})
|
256
267
|
.finally(() => {
|
257
268
|
bffEventReport({
|
@@ -271,9 +282,8 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
271
282
|
bffGetTagList();
|
272
283
|
getRecommendVideos()
|
273
284
|
.then((data) => {
|
274
|
-
|
275
|
-
|
276
|
-
setCacheRtcList((_b = data === null || data === void 0 ? void 0 : data.recList) !== null && _b !== void 0 ? _b : []);
|
285
|
+
setRtcList(getFilterRecList(data));
|
286
|
+
setCacheRtcList(getFilterRecList(data));
|
277
287
|
})
|
278
288
|
.finally(() => {
|
279
289
|
setLoading(false);
|
@@ -7,7 +7,7 @@ const SxpDataSourceProvider_1 = require("../context/SxpDataSourceProvider");
|
|
7
7
|
function useEventReport() {
|
8
8
|
const { bffEventReport, popupDetailData, waterFallData, isFromHashtag } = (0, useSxpDataSource_1.useSxpDataSource)();
|
9
9
|
const jumpToWeb = (0, react_1.useCallback)((data, product, cta, position) => {
|
10
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
|
10
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1;
|
11
11
|
let fromKName = '';
|
12
12
|
if (popupDetailData && (((_b = (_a = data === null || data === void 0 ? void 0 : data.video) === null || _a === void 0 ? void 0 : _a.bindProducts) === null || _b === void 0 ? void 0 : _b.length) || ((_c = data === null || data === void 0 ? void 0 : data.video) === null || _c === void 0 ? void 0 : _c.bindProduct))) {
|
13
13
|
fromKName = 'pdpPage';
|
@@ -38,12 +38,12 @@ function useEventReport() {
|
|
38
38
|
position: position + '',
|
39
39
|
contentId: (_m = (_l = data === null || data === void 0 ? void 0 : data.video) === null || _l === void 0 ? void 0 : _l.itemId) !== null && _m !== void 0 ? _m : '',
|
40
40
|
ctatId: (_o = cta === null || cta === void 0 ? void 0 : cta.itemId) !== null && _o !== void 0 ? _o : '',
|
41
|
-
traceInfo: (
|
41
|
+
traceInfo: (_1 = (_y = (_w = (_s = (_p = product === null || product === void 0 ? void 0 : product.traceInfo) !== null && _p !== void 0 ? _p : (_r = (_q = data === null || data === void 0 ? void 0 : data.video) === null || _q === void 0 ? void 0 : _q.bindProduct) === null || _r === void 0 ? void 0 : _r.traceInfo) !== null && _s !== void 0 ? _s : (_v = (_u = (_t = data === null || data === void 0 ? void 0 : data.video) === null || _t === void 0 ? void 0 : _t.bindProducts) === null || _u === void 0 ? void 0 : _u[0]) === null || _v === void 0 ? void 0 : _v.traceInfo) !== null && _w !== void 0 ? _w : (_x = data === null || data === void 0 ? void 0 : data.product) === null || _x === void 0 ? void 0 : _x.traceInfo) !== null && _y !== void 0 ? _y : (_0 = (_z = data === null || data === void 0 ? void 0 : data.video) === null || _z === void 0 ? void 0 : _z.bindCta) === null || _0 === void 0 ? void 0 : _0.traceInfo) !== null && _1 !== void 0 ? _1 : ''
|
42
42
|
}
|
43
43
|
});
|
44
44
|
}, [bffEventReport, popupDetailData, isFromHashtag]);
|
45
45
|
const productView = (0, react_1.useCallback)((data, product, cta, viewTime, position) => {
|
46
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
46
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
47
47
|
let fromKName = '';
|
48
48
|
if (popupDetailData && (((_b = (_a = data === null || data === void 0 ? void 0 : data.video) === null || _a === void 0 ? void 0 : _a.bindProducts) === null || _b === void 0 ? void 0 : _b.length) || ((_c = data === null || data === void 0 ? void 0 : data.video) === null || _c === void 0 ? void 0 : _c.bindProduct))) {
|
49
49
|
fromKName = 'pdpPage';
|
@@ -63,7 +63,7 @@ function useEventReport() {
|
|
63
63
|
position: position + '',
|
64
64
|
contentId: (_d = data === null || data === void 0 ? void 0 : data.video) === null || _d === void 0 ? void 0 : _d.itemId,
|
65
65
|
ctatId: cta === null || cta === void 0 ? void 0 : cta.itemId,
|
66
|
-
traceInfo: (
|
66
|
+
traceInfo: (_p = (_m = (_h = (_e = product === null || product === void 0 ? void 0 : product.traceInfo) !== null && _e !== void 0 ? _e : (_g = (_f = data === null || data === void 0 ? void 0 : data.video) === null || _f === void 0 ? void 0 : _f.bindProduct) === null || _g === void 0 ? void 0 : _g.traceInfo) !== null && _h !== void 0 ? _h : (_l = (_k = (_j = data === null || data === void 0 ? void 0 : data.video) === null || _j === void 0 ? void 0 : _j.bindProducts) === null || _k === void 0 ? void 0 : _k[0]) === null || _l === void 0 ? void 0 : _l.traceInfo) !== null && _m !== void 0 ? _m : (_o = data === null || data === void 0 ? void 0 : data.product) === null || _o === void 0 ? void 0 : _o.traceInfo) !== null && _p !== void 0 ? _p : '',
|
67
67
|
timeOnSite: Math.floor((new Date() - viewTime) / 1000) + '',
|
68
68
|
eventSubject: 'productView',
|
69
69
|
eventDescription: 'User browsed the product'
|