pb-sxp-ui 1.2.5 → 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 +102 -58
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +10 -4
- package/dist/index.js +102 -58
- 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 +102 -58
- 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 +8 -6
- package/es/core/components/SxpPageRender/index.js +5 -5
- package/es/core/context/SxpDataSourceProvider.js +26 -16
- package/es/core/hooks/useEventReport.js +4 -4
- package/es/materials/sxp/popup/CommodityDetail/index.d.ts +1 -0
- package/es/materials/sxp/popup/CommodityDetail/index.js +11 -6
- package/es/materials/sxp/popup/CommodityDetail/material.js +6 -0
- package/es/materials/sxp/popup/CommodityDetail/settingRender.js +4 -0
- package/es/materials/sxp/popup/CommodityDetailDiroNew/index.js +5 -2
- package/es/materials/sxp/popup/CommodityList/index.d.ts +0 -1
- package/es/materials/sxp/popup/CommodityList/index.js +12 -11
- package/es/materials/sxp/template/components/CommodityGroup.d.ts +1 -1
- package/es/materials/sxp/template/components/CommodityGroup.js +12 -1
- package/lib/core/components/SxpPageRender/FormatImage.js +7 -3
- package/lib/core/components/SxpPageRender/Popup/index.js +8 -6
- package/lib/core/components/SxpPageRender/index.js +5 -5
- package/lib/core/context/SxpDataSourceProvider.js +26 -16
- package/lib/core/hooks/useEventReport.js +4 -4
- package/lib/materials/sxp/popup/CommodityDetail/index.d.ts +1 -0
- package/lib/materials/sxp/popup/CommodityDetail/index.js +10 -5
- package/lib/materials/sxp/popup/CommodityDetail/material.js +6 -0
- package/lib/materials/sxp/popup/CommodityDetail/settingRender.js +4 -0
- package/lib/materials/sxp/popup/CommodityDetailDiroNew/index.js +5 -2
- package/lib/materials/sxp/popup/CommodityList/index.d.ts +0 -1
- package/lib/materials/sxp/popup/CommodityList/index.js +12 -11
- package/lib/materials/sxp/template/components/CommodityGroup.d.ts +1 -1
- package/lib/materials/sxp/template/components/CommodityGroup.js +12 -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;
|
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,12 +36,14 @@ 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 = (
|
43
|
-
|
44
|
-
|
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
|
+
if (p) {
|
44
|
+
product = p;
|
45
|
+
cta = p === null || p === void 0 ? void 0 : p.bindCta;
|
46
|
+
}
|
45
47
|
}
|
46
48
|
if (product && cta) {
|
47
49
|
productView(data, product, cta, popupCurTimeRef.current, popupDetailData === null || popupDetailData === void 0 ? void 0 : popupDetailData.index);
|
@@ -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;
|
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: (_r =
|
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();
|
@@ -34,12 +34,25 @@ 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();
|
37
|
+
const checkCommodityIndexRef = useRef(-1);
|
38
38
|
const popupCurTimeRef = useRef(null);
|
39
39
|
const isShowConsent = useMemo(() => {
|
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;
|
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: (_m = cta === null || cta === void 0 ? void 0 : cta.traceInfo) !== null && _m !== void 0 ? _m : '', fromKName, fromKPage: (
|
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;
|
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: (_p = product === null || product === void 0 ? void 0 : product.traceInfo) !== null && _p !== void 0 ? _p : ''
|
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;
|
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: product === null || product === void 0 ? void 0 : product.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'
|
@@ -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 {
|
4
|
+
import { 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';
|
@@ -14,8 +14,7 @@ import CommodityGroup from '../../template/components/CommodityGroup';
|
|
14
14
|
const CommodityDetail = (_a) => {
|
15
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, popupDetailData, isPreview, bffFbReport, popupCurTimeRef } = useSxpDataSource();
|
18
|
-
const { popup } = useEditor();
|
17
|
+
const { sxpParameter, popupDetailData, isPreview, bffFbReport, popupCurTimeRef, checkCommodityIndexRef } = useSxpDataSource();
|
19
18
|
const { jumpToWeb, productView } = useEventReport();
|
20
19
|
const curTimeRef = useRef(null);
|
21
20
|
const [showModal, setShowModal] = useState(false);
|
@@ -28,6 +27,7 @@ const CommodityDetail = (_a) => {
|
|
28
27
|
: (_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;
|
29
28
|
const position = isPost ? index : popupDetailData === null || popupDetailData === void 0 ? void 0 : popupDetailData.index;
|
30
29
|
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) {
|
30
|
+
checkCommodityIndexRef.current = checkCommodityIndex;
|
31
31
|
const p = (_s = data === null || data === void 0 ? void 0 : data.video) === null || _s === void 0 ? void 0 : _s.bindProducts[checkCommodityIndex];
|
32
32
|
product = p;
|
33
33
|
cta = p === null || p === void 0 ? void 0 : p.bindCta;
|
@@ -71,7 +71,7 @@ const CommodityDetail = (_a) => {
|
|
71
71
|
}, [product === null || product === void 0 ? void 0 : product.price, product === null || product === void 0 ? void 0 : product.currency]);
|
72
72
|
const width = isPreview ? 375 : (_t = style === null || style === void 0 ? void 0 : style.width) !== null && _t !== void 0 ? _t : window.innerWidth;
|
73
73
|
const renderContent = ({ isPost }) => {
|
74
|
-
var _a, _b, _c;
|
74
|
+
var _a, _b, _c, _d;
|
75
75
|
return (React.createElement("div", null,
|
76
76
|
React.createElement("div", { className: 'pb-commondity-content-collection', style: getStyle(commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.collection), hidden: !!product && (!(product === null || product === void 0 ? void 0 : product.collection) || (product === null || product === void 0 ? void 0 : product.collection) === ''), dangerouslySetInnerHTML: {
|
77
77
|
__html: setFontForText((_a = product === null || product === void 0 ? void 0 : product.collection) !== null && _a !== void 0 ? _a : 'Tiffany Lock', commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.collection)
|
@@ -82,8 +82,11 @@ const CommodityDetail = (_a) => {
|
|
82
82
|
React.createElement("div", { className: 'pb-commondity-content-price', style: getStyle(commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price), hidden: !!product && !(product === null || product === void 0 ? void 0 : product.price), dangerouslySetInnerHTML: {
|
83
83
|
__html: setFontForText(priceText, commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price)
|
84
84
|
} }),
|
85
|
+
React.createElement("div", { hidden: !!product && !(product === null || product === void 0 ? void 0 : product.taxInfo), style: getStyle(commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.taxInfo), dangerouslySetInnerHTML: {
|
86
|
+
__html: setFontForText((_c = product === null || product === void 0 ? void 0 : product.taxInfo) !== null && _c !== void 0 ? _c : '税费', commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.taxInfo)
|
87
|
+
} }),
|
85
88
|
React.createElement("div", { hidden: !!product && (!(product === null || product === void 0 ? void 0 : product.info) || (product === null || product === void 0 ? void 0 : product.info) === '') },
|
86
|
-
React.createElement(ExpandableText, { foldText: tipText === null || tipText === void 0 ? void 0 : tipText.foldText, unfoldText: tipText === null || tipText === void 0 ? void 0 : tipText.unfoldText, onClick: () => setShowModal(true), isPost: isPost, text: (
|
89
|
+
React.createElement(ExpandableText, { foldText: tipText === null || tipText === void 0 ? void 0 : tipText.foldText, unfoldText: tipText === null || tipText === void 0 ? void 0 : tipText.unfoldText, onClick: () => setShowModal(true), isPost: isPost, text: (_d = product === null || product === void 0 ? void 0 : product.info) !== null && _d !== void 0 ? _d : `The design inspiration of Tiffany Lock series comes from the power of connection and inclusiveness, and the
|
87
90
|
bold and avant-garde visual design interprets the emotional bond connecting my heart. The Tiffany Lock
|
88
91
|
collection is unisex and is inspired by the padlock pattern found in the Tiffany Antique Collection. This
|
89
92
|
necklace features a stylish and eye-catching oval clasp chain decorated with a lock pattern. Crafted from
|
@@ -105,6 +108,7 @@ const CommodityDetail = (_a) => {
|
|
105
108
|
const handleClick = useCallback((index) => {
|
106
109
|
popupCurTimeRef.current = new Date();
|
107
110
|
setCheckCommodityIndex(index);
|
111
|
+
checkCommodityIndexRef.current = index;
|
108
112
|
}, []);
|
109
113
|
const renderCommodityGroup = useCallback(() => {
|
110
114
|
var _a, _b, _c;
|
@@ -125,6 +129,7 @@ const CommodityDetail = (_a) => {
|
|
125
129
|
delay: (swiper === null || swiper === void 0 ? void 0 : swiper.delay) * 1000
|
126
130
|
} },
|
127
131
|
React.createElement(React.Fragment, null, (_v = product === null || product === void 0 ? void 0 : product.homePage) === null || _v === void 0 ? void 0 : _v.map((src) => {
|
132
|
+
var _a;
|
128
133
|
return (React.createElement(SwiperSlide, { key: src },
|
129
134
|
React.createElement("div", { style: {
|
130
135
|
overflow: 'hidden',
|
@@ -137,7 +142,7 @@ const CommodityDetail = (_a) => {
|
|
137
142
|
objectFit: 'cover',
|
138
143
|
display: 'block',
|
139
144
|
objectPosition: `50% ${(swiper === null || swiper === void 0 ? void 0 : swiper.translateY) ? (swiper === null || swiper === void 0 ? void 0 : swiper.translateY) + 50 : 50}%`
|
140
|
-
}, src: src }))));
|
145
|
+
}, src: (_a = src !== null && src !== void 0 ? src : sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) !== null && _a !== void 0 ? _a : bottom_image }))));
|
141
146
|
}))))),
|
142
147
|
!((_w = product === null || product === void 0 ? void 0 : product.homePage) === null || _w === void 0 ? void 0 : _w.length) && (React.createElement("div", { className: css({
|
143
148
|
position: 'relative',
|
@@ -15,7 +15,7 @@ const CommodityDetailDiroNew = (_a) => {
|
|
15
15
|
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, _1;
|
16
16
|
var { style, isDefault, rec, viewTime, isPost, bottom_image, tipText, swiper, commodityStyles, buttonStyle, index, commodityGroup } = _a, props = __rest(_a, ["style", "isDefault", "rec", "viewTime", "isPost", "bottom_image", "tipText", "swiper", "commodityStyles", "buttonStyle", "index", "commodityGroup"]);
|
17
17
|
const [spread, setSpread] = useState(true);
|
18
|
-
const { sxpParameter, popupCurTimeRef, popupDetailData, isPreview, bffFbReport } = useSxpDataSource();
|
18
|
+
const { sxpParameter, popupCurTimeRef, popupDetailData, isPreview, bffFbReport, checkCommodityIndexRef } = useSxpDataSource();
|
19
19
|
const { jumpToWeb, productView } = useEventReport();
|
20
20
|
const [stopSlide, setStopSlide] = useState(false);
|
21
21
|
const [isBottom, setIsBottom] = useState(false);
|
@@ -30,6 +30,7 @@ const CommodityDetailDiroNew = (_a) => {
|
|
30
30
|
: (_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;
|
31
31
|
const position = isPost ? index : popupDetailData === null || popupDetailData === void 0 ? void 0 : popupDetailData.index;
|
32
32
|
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) {
|
33
|
+
checkCommodityIndexRef.current = checkCommodityIndex;
|
33
34
|
const p = (_s = data === null || data === void 0 ? void 0 : data.video) === null || _s === void 0 ? void 0 : _s.bindProducts[checkCommodityIndex];
|
34
35
|
product = p;
|
35
36
|
cta = p === null || p === void 0 ? void 0 : p.bindCta;
|
@@ -90,6 +91,7 @@ Made in Italy` })));
|
|
90
91
|
const handleClick = useCallback((index) => {
|
91
92
|
popupCurTimeRef.current = new Date();
|
92
93
|
setCheckCommodityIndex(index);
|
94
|
+
checkCommodityIndexRef.current = index;
|
93
95
|
}, []);
|
94
96
|
const renderCommodityGroup = useCallback(() => {
|
95
97
|
var _a, _b, _c;
|
@@ -108,6 +110,7 @@ Made in Italy` })));
|
|
108
110
|
}, loop: true, autoplay: {
|
109
111
|
delay: (swiper === null || swiper === void 0 ? void 0 : swiper.delay) * 1000
|
110
112
|
} }, (_v = product === null || product === void 0 ? void 0 : product.homePage) === null || _v === void 0 ? void 0 : _v.map((src) => {
|
113
|
+
var _a;
|
111
114
|
return (React.createElement(SwiperSlide, { key: src },
|
112
115
|
React.createElement("div", { style: {
|
113
116
|
overflow: 'hidden',
|
@@ -120,7 +123,7 @@ Made in Italy` })));
|
|
120
123
|
objectFit: 'cover',
|
121
124
|
display: 'block',
|
122
125
|
objectPosition: `50% ${(swiper === null || swiper === void 0 ? void 0 : swiper.translateY) ? (swiper === null || swiper === void 0 ? void 0 : swiper.translateY) + 50 : 50}%`
|
123
|
-
}, src: src }))));
|
126
|
+
}, src: (_a = src !== null && src !== void 0 ? src : sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) !== null && _a !== void 0 ? _a : bottom_image }))));
|
124
127
|
}))),
|
125
128
|
!((_w = product === null || product === void 0 ? void 0 : product.homePage) === null || _w === void 0 ? void 0 : _w.length) && (React.createElement("div", { className: css({
|
126
129
|
position: 'relative',
|
@@ -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)) {
|
@@ -42,25 +43,24 @@ const CommodityList = (_a) => {
|
|
42
43
|
onClick === null || onClick === void 0 ? void 0 : onClick();
|
43
44
|
}
|
44
45
|
}, popup === null || popup === void 0 ? void 0 : popup.duration);
|
45
|
-
return (React.createElement("div", { className: css(Object.assign(Object.assign({}, style), { display: 'flex', flexDirection: 'column', gap: '10px', padding: '0 20px', marginTop: '50px' })) }, product === null || product === void 0 ? void 0 : product.map((item, index) => {
|
46
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k
|
46
|
+
return (React.createElement("div", { className: css(Object.assign(Object.assign({}, style), { display: 'flex', flexDirection: 'column', gap: '10px', padding: '0 20px', marginTop: '50px', boxSizing: 'border-box' })) }, product === null || product === void 0 ? void 0 : product.map((item, index) => {
|
47
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
47
48
|
return (React.createElement(React.Fragment, null, recData && !(item === null || item === void 0 ? void 0 : item.bindCta) ? null : (React.createElement("div", Object.assign({ key: index }, props, { className: css({
|
48
49
|
display: 'flex'
|
49
50
|
}), onClick: () => handleClick(item, index) }),
|
50
51
|
React.createElement(Img, { src: (_d = (_c = (_a = item === null || item === void 0 ? void 0 : item.cover) !== null && _a !== void 0 ? _a : (_b = item === null || item === void 0 ? void 0 : item.homePage) === null || _b === void 0 ? void 0 : _b[0]) !== null && _c !== void 0 ? _c : sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) !== null && _d !== void 0 ? _d : bottom_image, rec: recData, item: item, index: index, translateY: translateY, imgStyle: commodityPicture, enableEventReport: false }),
|
51
52
|
React.createElement("div", { style: {
|
52
|
-
|
53
|
-
width: `calc(100% - ${(_e = commodityPicture === null || commodityPicture === void 0 ? void 0 : commodityPicture.width) !== null && _e !== void 0 ? _e : 0}px - ${(_f = commodityPicture === null || commodityPicture === void 0 ? void 0 : commodityPicture.marginRight) !== null && _f !== void 0 ? _f : 0}px - ${(_g = style === null || style === void 0 ? void 0 : style.padding) !== null && _g !== void 0 ? _g : 0}px)`,
|
53
|
+
width: `calc(100% - ${(_e = commodityPicture === null || commodityPicture === void 0 ? void 0 : commodityPicture.width) !== null && _e !== void 0 ? _e : 0}px - ${(_f = commodityPicture === null || commodityPicture === void 0 ? void 0 : commodityPicture.marginRight) !== null && _f !== void 0 ? _f : 0}px)`,
|
54
54
|
display: 'flex',
|
55
55
|
flexDirection: 'column',
|
56
56
|
justifyContent: 'space-between'
|
57
57
|
} },
|
58
58
|
React.createElement("div", null,
|
59
59
|
React.createElement("div", { className: 'one-line-ellipsis', style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.title, hidden: !!item && !(item === null || item === void 0 ? void 0 : item.title), dangerouslySetInnerHTML: {
|
60
|
-
__html: setFontForText((
|
60
|
+
__html: setFontForText((_g = item === null || item === void 0 ? void 0 : item.title) !== null && _g !== void 0 ? _g : 'Pendant in Yellow Gold with Diamonds, Medium', commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.title)
|
61
61
|
} }),
|
62
62
|
React.createElement("div", { className: 'two-line-ellipsis', style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.collection, hidden: !!item && (!(item === null || item === void 0 ? void 0 : item.collection) || (item === null || item === void 0 ? void 0 : item.collection) === ''), dangerouslySetInnerHTML: {
|
63
|
-
__html: setFontForText((
|
63
|
+
__html: setFontForText((_h = item === null || item === void 0 ? void 0 : item.collection) !== null && _h !== void 0 ? _h : 'Tiffany Lock', commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.collection)
|
64
64
|
} })),
|
65
65
|
React.createElement("div", { className: css({
|
66
66
|
display: 'flex',
|
@@ -69,11 +69,12 @@ const CommodityList = (_a) => {
|
|
69
69
|
width: '100%',
|
70
70
|
overflow: 'hidden'
|
71
71
|
}) },
|
72
|
-
React.createElement("div",
|
73
|
-
|
74
|
-
|
72
|
+
React.createElement("div", null,
|
73
|
+
React.createElement("div", { style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price, hidden: !!item && !(item === null || item === void 0 ? void 0 : item.price), dangerouslySetInnerHTML: {
|
74
|
+
__html: setFontForText(priceText(item), commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price)
|
75
|
+
} })),
|
75
76
|
React.createElement("div", { className: 'one-line-ellipsis', style: Object.assign(Object.assign({}, buttonStyle), { padding: '0 15px' }), dangerouslySetInnerHTML: {
|
76
|
-
__html: setFontForText((
|
77
|
+
__html: setFontForText((_k = (_j = item === null || item === void 0 ? void 0 : item.bindCta) === null || _j === void 0 ? void 0 : _j.enTitle) !== null && _k !== void 0 ? _k : 'Shop Now', buttonStyle)
|
77
78
|
} })))))));
|
78
79
|
})));
|
79
80
|
};
|
@@ -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;
|
@@ -1,10 +1,21 @@
|
|
1
1
|
import React, { memo } from 'react';
|
2
2
|
import Scroll from './Scroll';
|
3
3
|
import FormatImage from '../../../../core/components/SxpPageRender/FormatImage';
|
4
|
+
import { useSxpDataSource } from '../../../../core/hooks';
|
4
5
|
import { SwiperSlide } from 'swiper/react';
|
5
6
|
import { css } from '@emotion/css';
|
7
|
+
import { useEventReport } from '../../../../core/hooks/useEventReport';
|
6
8
|
const CommodityGroup = ({ products, data, defImg, style, onCLick, popupDetailData, check }) => {
|
7
9
|
var _a;
|
10
|
+
const { productView } = useEventReport();
|
11
|
+
const { popupCurTimeRef } = useSxpDataSource();
|
12
|
+
const handleClick = (item, index) => {
|
13
|
+
if (check === index)
|
14
|
+
return;
|
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);
|
17
|
+
onCLick === null || onCLick === void 0 ? void 0 : onCLick(index);
|
18
|
+
};
|
8
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) => {
|
9
20
|
var _a, _b, _c;
|
10
21
|
return (React.createElement(React.Fragment, null, (item === null || item === void 0 ? void 0 : item.bindCta) ? (React.createElement(SwiperSlide, { className: css({
|
@@ -12,7 +23,7 @@ const CommodityGroup = ({ products, data, defImg, style, onCLick, popupDetailDat
|
|
12
23
|
height: '50px',
|
13
24
|
marginRight: '10px'
|
14
25
|
}), onClick: () => {
|
15
|
-
|
26
|
+
handleClick(item, index);
|
16
27
|
}, key: index },
|
17
28
|
React.createElement(FormatImage, { style: {
|
18
29
|
height: '100%',
|
@@ -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;
|
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,12 +39,14 @@ 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 = (
|
46
|
-
|
47
|
-
|
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
|
+
if (p) {
|
47
|
+
product = p;
|
48
|
+
cta = p === null || p === void 0 ? void 0 : p.bindCta;
|
49
|
+
}
|
48
50
|
}
|
49
51
|
if (product && cta) {
|
50
52
|
productView(data, product, cta, popupCurTimeRef.current, popupDetailData === null || popupDetailData === void 0 ? void 0 : popupDetailData.index);
|