pb-sxp-ui 1.16.24-alpha.2 → 1.16.25
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 +193 -138
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +193 -138
- package/dist/index.js.map +1 -1
- package/dist/index.min.cjs +6 -6
- package/dist/index.min.cjs.map +1 -1
- package/dist/index.min.js +6 -6
- package/dist/index.min.js.map +1 -1
- package/dist/pb-ui.js +193 -138
- package/dist/pb-ui.js.map +1 -1
- package/dist/pb-ui.min.js +6 -6
- package/dist/pb-ui.min.js.map +1 -1
- package/es/core/components/DiyPortalPreview/VideoWidget.js +10 -8
- package/es/core/components/SxpPageRender/LikeButton/index.js +18 -16
- package/es/core/components/SxpPageRender/PictureGroup/index.d.ts +5 -0
- package/es/core/components/SxpPageRender/PictureGroup/index.js +39 -13
- package/es/core/components/SxpPageRender/VideoWidget/index.js +32 -45
- package/es/core/components/SxpPageRender/WaterFall/index.js +4 -3
- package/es/core/components/SxpPageRender/index.js +53 -37
- package/es/core/context/SxpDataSourceProvider.d.ts +5 -12
- package/es/core/context/SxpDataSourceProvider.js +32 -10
- package/es/core/hooks/useEventReport.js +6 -5
- package/lib/core/components/DiyPortalPreview/VideoWidget.js +10 -8
- package/lib/core/components/SxpPageRender/LikeButton/index.js +18 -16
- package/lib/core/components/SxpPageRender/PictureGroup/index.d.ts +5 -0
- package/lib/core/components/SxpPageRender/PictureGroup/index.js +38 -12
- package/lib/core/components/SxpPageRender/VideoWidget/index.js +32 -45
- package/lib/core/components/SxpPageRender/WaterFall/index.js +4 -3
- package/lib/core/components/SxpPageRender/index.js +53 -37
- package/lib/core/context/SxpDataSourceProvider.d.ts +5 -12
- package/lib/core/context/SxpDataSourceProvider.js +32 -10
- package/lib/core/hooks/useEventReport.js +6 -5
- package/package.json +1 -1
@@ -45,6 +45,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
45
45
|
const skipLinkRef = (0, react_1.useRef)(false);
|
46
46
|
const [pageNum, setPageNum] = (0, react_1.useState)(2);
|
47
47
|
const videoWidgetRef = (0, react_1.useRef)(null);
|
48
|
+
const pictureGroupRef = (0, react_1.useRef)(null);
|
48
49
|
const { loadVideos, bffEventReport, loading, setPopupDetailData, ctaEvent, swiperRef, waterFallData, setOpenHashtag, appDomain, openHashtag, loadingImage, isFromHashtag, popupDetailData, bffFbReport, curTime, h5EnterLink, isShowConsent, selectTag, isPreview, isEditor, cacheRtcList, setRtcList, cacheActiveIndex, rtcList, isNoMoreData, channel, refreshFeSession, isDiyH5 } = (0, hooks_1.useSxpDataSource)();
|
49
50
|
const { backMainFeed, productView, jumpToWeb } = (0, useEventReport_1.useEventReport)();
|
50
51
|
const isShowFingerTip = (0, react_1.useMemo)(() => {
|
@@ -92,7 +93,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
92
93
|
(_a = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _a === void 0 ? void 0 : _a.swiper.slideTo(index);
|
93
94
|
}, [data, ctaType, swiperRef]);
|
94
95
|
const handleSessionCompleted = (0, react_1.useCallback)((fk) => {
|
95
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
|
96
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
|
96
97
|
const item = data === null || data === void 0 ? void 0 : data[activeIndex];
|
97
98
|
let fromKName = '';
|
98
99
|
if (popupDetailData && (((_b = (_a = item === null || item === void 0 ? void 0 : item.video) === null || _a === void 0 ? void 0 : _a.bindProducts) === null || _b === void 0 ? void 0 : _b.length) || ((_c = item === null || item === void 0 ? void 0 : item.video) === null || _c === void 0 ? void 0 : _c.bindProduct))) {
|
@@ -119,12 +120,13 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
119
120
|
eventSubject: 'sessionCompleted',
|
120
121
|
eventDescription: 'Session completed',
|
121
122
|
contentId: (_m = item === null || item === void 0 ? void 0 : item.video) === null || _m === void 0 ? void 0 : _m.itemId,
|
122
|
-
|
123
|
+
sceneId: (_q = (_p = (_o = item === null || item === void 0 ? void 0 : item.video) === null || _o === void 0 ? void 0 : _o.scene) === null || _p === void 0 ? void 0 : _p.sceneId) !== null && _q !== void 0 ? _q : '',
|
124
|
+
productId: (_r = item === null || item === void 0 ? void 0 : item.product) === null || _r === void 0 ? void 0 : _r.itemId,
|
123
125
|
position: activeIndex + '',
|
124
126
|
fromKName: fk || fromKName,
|
125
127
|
fromKPage: location === null || location === void 0 ? void 0 : location.href,
|
126
|
-
ctatId: (
|
127
|
-
traceInfo: (
|
128
|
+
ctatId: (_u = (_t = (_s = item === null || item === void 0 ? void 0 : item.video) === null || _s === void 0 ? void 0 : _s.bindCta) === null || _t === void 0 ? void 0 : _t.itemId) !== null && _u !== void 0 ? _u : '',
|
129
|
+
traceInfo: (_y = (_w = (_v = item === null || item === void 0 ? void 0 : item.video) === null || _v === void 0 ? void 0 : _v.traceInfo) !== null && _w !== void 0 ? _w : (_x = item === null || item === void 0 ? void 0 : item.product) === null || _x === void 0 ? void 0 : _x.traceInfo) !== null && _y !== void 0 ? _y : ''
|
128
130
|
}
|
129
131
|
});
|
130
132
|
}, [data, bffEventReport, activeIndex, popupDetailData, tempMap, isFromHashtag, curTime]);
|
@@ -180,8 +182,9 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
180
182
|
refreshFeSession
|
181
183
|
]);
|
182
184
|
const handleSessionExpire = (0, react_1.useCallback)((0, lodash_1.debounce)(() => {
|
183
|
-
var _a;
|
185
|
+
var _a, _b;
|
184
186
|
(_a = videoWidgetRef.current) === null || _a === void 0 ? void 0 : _a.setLoopPlay(false);
|
187
|
+
(_b = pictureGroupRef.current) === null || _b === void 0 ? void 0 : _b.setLoopPlay(false);
|
185
188
|
refreshFeSession === null || refreshFeSession === void 0 ? void 0 : refreshFeSession(false, handleSessionCompleted);
|
186
189
|
}, 1000), [handleSessionCompleted, refreshFeSession]);
|
187
190
|
(0, react_1.useEffect)(() => {
|
@@ -251,18 +254,18 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
251
254
|
return null;
|
252
255
|
}, [globalConfig, activeIndex, visList]);
|
253
256
|
const renderContent = (0, react_1.useCallback)((rec, index) => {
|
254
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
257
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
255
258
|
if (rec === 'organic menu') {
|
256
259
|
return (react_1.default.createElement(MultiPosts_1.default, Object.assign({ recData: data === null || data === void 0 ? void 0 : data[1] }, (_c = (_b = (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.multiPosts) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.item) === null || _c === void 0 ? void 0 : _c.props, (_f = (_e = (_d = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.multiPosts) === null || _d === void 0 ? void 0 : _d[0]) === null || _e === void 0 ? void 0 : _e.item) === null || _f === void 0 ? void 0 : _f.event)));
|
257
260
|
}
|
258
|
-
if ((_g = rec === null || rec === void 0 ? void 0 : rec.video) === null ||
|
261
|
+
if (((_h = (_g = rec.video) === null || _g === void 0 ? void 0 : _g.scene) === null || _h === void 0 ? void 0 : _h.mediaUrl) || ((_j = rec === null || rec === void 0 ? void 0 : rec.video) === null || _j === void 0 ? void 0 : _j.url)) {
|
259
262
|
return (react_1.default.createElement(VideoWidget_1.default, Object.assign({ key: isReload }, (activeIndex === index && { ref: videoWidgetRef }), { rec: rec, index: index, muted: isMuted, data: data, height: height, activeIndex: activeIndex, videoPostConfig: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.videoPost, videoPlayIcon: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.videoPlayIcon, loopPlay: true, swiperRef: swiperRef })));
|
260
263
|
}
|
261
|
-
if ((
|
262
|
-
return (react_1.default.createElement(PictureGroup_1.default, { key: rec === null || rec === void 0 ? void 0 : rec.video.itemId, imgUrls: rec === null || rec === void 0 ? void 0 : rec.video.imgUrls, width: containerWidth, height: height, rec: rec, index: index, onViewImageEndEvent: handleViewImageStartEnd, onViewImageStartEvent: handleViewImageStartEvent, imgUrlsPostConfig: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.imgUrlsPost }));
|
264
|
+
if ((_k = rec === null || rec === void 0 ? void 0 : rec.video) === null || _k === void 0 ? void 0 : _k.imgUrls) {
|
265
|
+
return (react_1.default.createElement(PictureGroup_1.default, Object.assign({ data: data }, (activeIndex === index && { ref: pictureGroupRef }), { key: rec === null || rec === void 0 ? void 0 : rec.video.itemId, imgUrls: rec === null || rec === void 0 ? void 0 : rec.video.imgUrls, width: containerWidth, height: height, rec: rec, index: index, onViewImageEndEvent: handleViewImageStartEnd, onViewImageStartEvent: handleViewImageStartEvent, imgUrlsPostConfig: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.imgUrlsPost, swiperRef: swiperRef })));
|
263
266
|
}
|
264
|
-
if (rec.product && Array.isArray(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.productPost) && ((
|
265
|
-
return (
|
267
|
+
if (rec.product && Array.isArray(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.productPost) && ((_l = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.productPost) === null || _l === void 0 ? void 0 : _l.length) > 0) {
|
268
|
+
return (_m = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.productPost) === null || _m === void 0 ? void 0 : _m.map((value, idx) => {
|
266
269
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
267
270
|
const t = resolver[(_a = value === null || value === void 0 ? void 0 : value.item) === null || _a === void 0 ? void 0 : _a.type];
|
268
271
|
const Component = (0, withBindDataSource_1.default)(t);
|
@@ -300,7 +303,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
300
303
|
};
|
301
304
|
}, [isShowMore]);
|
302
305
|
const renderBottom = (0, react_1.useCallback)((rec, index) => {
|
303
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
306
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
304
307
|
if (rec === null || rec === void 0 ? void 0 : rec.video) {
|
305
308
|
let cta = null;
|
306
309
|
if ((_b = (_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.bindProducts) === null || _b === void 0 ? void 0 : _b.length) {
|
@@ -309,24 +312,27 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
309
312
|
else if ((_c = rec === null || rec === void 0 ? void 0 : rec.video) === null || _c === void 0 ? void 0 : _c.bindProduct) {
|
310
313
|
cta = '商品CTA';
|
311
314
|
}
|
315
|
+
else if (tempMap && ((_d = Object.keys(tempMap)) === null || _d === void 0 ? void 0 : _d.includes('服务CTA')) && ((_f = (_e = rec === null || rec === void 0 ? void 0 : rec.video) === null || _e === void 0 ? void 0 : _e.bindCta) === null || _f === void 0 ? void 0 : _f.itemId)) {
|
316
|
+
cta = '服务CTA';
|
317
|
+
}
|
312
318
|
else {
|
313
|
-
cta = (
|
319
|
+
cta = (_h = (_g = rec === null || rec === void 0 ? void 0 : rec.video) === null || _g === void 0 ? void 0 : _g.bindCta) === null || _h === void 0 ? void 0 : _h.itemId;
|
314
320
|
}
|
315
321
|
const value = tempMap === null || tempMap === void 0 ? void 0 : tempMap[cta];
|
316
322
|
const isNineProduct = (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.nineProductEnable) &&
|
317
323
|
index === ((rtcList === null || rtcList === void 0 ? void 0 : rtcList[0]) === 'organic menu' ? 2 : 1) &&
|
318
|
-
((
|
324
|
+
((_j = ['MultiCommodity', 'MultiCommodityDiro', 'MultiCommodityDiroNew']) === null || _j === void 0 ? void 0 : _j.includes((_k = value === null || value === void 0 ? void 0 : value.item) === null || _k === void 0 ? void 0 : _k.type));
|
319
325
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
320
326
|
isNineProduct && (react_1.default.createElement(RenderCard_1.default, { rec: rec, index: index, tempMap: tempMap, resolver: resolver, isActive: index === activeIndex, value: value, isNineProduct: isNineProduct })),
|
321
|
-
((
|
322
|
-
react_1.default.createElement("div", { className: 'clc-sxp-bottom', style: { marginBottom: `${(
|
327
|
+
((_l = rec === null || rec === void 0 ? void 0 : rec.video) === null || _l === void 0 ? void 0 : _l.title) && !isShowMore && react_1.default.createElement("div", { className: 'clc-sxp-bottom-shadow' }),
|
328
|
+
react_1.default.createElement("div", { className: 'clc-sxp-bottom', style: { marginBottom: `${(_m = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.bottomInfoDist) !== null && _m !== void 0 ? _m : 40}px` } },
|
323
329
|
react_1.default.createElement(Nudge_1.default, { nudge: nudge }),
|
324
330
|
((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowCTA) === undefined || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowCTA)) && !isNineProduct ? (react_1.default.createElement("div", { className: 'clc-sxp-bottom-card' },
|
325
331
|
react_1.default.createElement(RenderCard_1.default, { rec: rec, index: index, tempMap: tempMap, resolver: resolver, isActive: index === activeIndex, value: value }))) : null,
|
326
332
|
react_1.default.createElement("div", null,
|
327
|
-
react_1.default.createElement(ExpandableText_1.default, { className: 'clc-sxp-bottom-text', isPost: true, foldText: tipText === null || tipText === void 0 ? void 0 : tipText.foldText, unfoldText: tipText === null || tipText === void 0 ? void 0 : tipText.unfoldText, text: (
|
333
|
+
react_1.default.createElement(ExpandableText_1.default, { className: 'clc-sxp-bottom-text', isPost: true, foldText: tipText === null || tipText === void 0 ? void 0 : tipText.foldText, unfoldText: tipText === null || tipText === void 0 ? void 0 : tipText.unfoldText, text: (_p = (_o = rec === null || rec === void 0 ? void 0 : rec.video) === null || _o === void 0 ? void 0 : _o.title) !== null && _p !== void 0 ? _p : '', style: Object.assign(Object.assign({}, descStyle), { textShadow: (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isOpenTextShadow) ? '2px 2px 4px rgba(0, 0, 0, 0.5)' : 'none' }), onChange: onExpandableChange }),
|
328
334
|
react_1.default.createElement(RenderCard_1.default, { rec: rec, index: index, tempMap: tempMap, resolver: resolver, includesCtaType: ['AniLink'], isActive: index === activeIndex, value: value }),
|
329
|
-
react_1.default.createElement(Hashtag_1.default, { index: activeIndex, tags: (
|
335
|
+
react_1.default.createElement(Hashtag_1.default, { index: activeIndex, tags: (_r = (_q = rec === null || rec === void 0 ? void 0 : rec.video) === null || _q === void 0 ? void 0 : _q.hashTags) !== null && _r !== void 0 ? _r : [], itemId: (_s = rec === null || rec === void 0 ? void 0 : rec.video) === null || _s === void 0 ? void 0 : _s.itemId, itemType: ((_t = rec === null || rec === void 0 ? void 0 : rec.video) === null || _t === void 0 ? void 0 : _t.itemId) ? 'VIDEO' : null, rec: rec, hashTagStyle: hashTagStyle, hashTagRightMargin: containerWidth - (hashTagRightMargin !== null && hashTagRightMargin !== void 0 ? hashTagRightMargin : 0) }))),
|
330
336
|
react_1.default.createElement(RenderCard_1.default, { rec: rec, index: index, tempMap: tempMap, resolver: resolver, includesCtaType: ['AniLinkPopup'], isActive: index === activeIndex, value: value })));
|
331
337
|
}
|
332
338
|
return null;
|
@@ -365,7 +371,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
365
371
|
return null;
|
366
372
|
}, [globalConfig, waterFallData]);
|
367
373
|
const handleViewImageStartEnd = (item) => {
|
368
|
-
var _a, _b, _c, _d, _e, _f;
|
374
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
369
375
|
if (!((_a = item === null || item === void 0 ? void 0 : item.video) === null || _a === void 0 ? void 0 : _a.url) && ((_b = item === null || item === void 0 ? void 0 : item.video) === null || _b === void 0 ? void 0 : _b.imgUrls)) {
|
370
376
|
const endTime = Date.now();
|
371
377
|
const duration = viewImageStartTime.current === 0 ? 0 : (endTime - viewImageStartTime.current) / 1000;
|
@@ -374,10 +380,11 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
374
380
|
eventSubject: 'viewImageCarouselEnd',
|
375
381
|
eventDescription: 'User end view the image carousel',
|
376
382
|
contentId: (_d = (_c = item === null || item === void 0 ? void 0 : item.video) === null || _c === void 0 ? void 0 : _c.itemId) !== null && _d !== void 0 ? _d : '',
|
377
|
-
|
383
|
+
sceneId: (_g = (_f = (_e = item === null || item === void 0 ? void 0 : item.video) === null || _e === void 0 ? void 0 : _e.scene) === null || _f === void 0 ? void 0 : _f.sceneId) !== null && _g !== void 0 ? _g : '',
|
384
|
+
contentName: (_h = item === null || item === void 0 ? void 0 : item.video.title) !== null && _h !== void 0 ? _h : '',
|
378
385
|
imageEndTime: `${endTime}`,
|
379
386
|
playDuration: `${duration}`,
|
380
|
-
contentTags: JSON.stringify((
|
387
|
+
contentTags: JSON.stringify((_j = item === null || item === void 0 ? void 0 : item.video.tags) !== null && _j !== void 0 ? _j : []),
|
381
388
|
position: activeIndex + '',
|
382
389
|
contentFormat: 'image',
|
383
390
|
traceInfo: item === null || item === void 0 ? void 0 : item.video.traceInfo
|
@@ -386,7 +393,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
386
393
|
}
|
387
394
|
};
|
388
395
|
const handleSlideSkip = (item, position) => {
|
389
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
|
396
|
+
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;
|
390
397
|
if (isPreview || waterFallData)
|
391
398
|
return;
|
392
399
|
const t = new Date() - curTime.current;
|
@@ -412,7 +419,8 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
412
419
|
contentTags: (product === null || product === void 0 ? void 0 : product.tags) ? JSON.stringify(product === null || product === void 0 ? void 0 : product.tags) : '',
|
413
420
|
position: position + '',
|
414
421
|
contentId: (_t = (_s = item === null || item === void 0 ? void 0 : item.video) === null || _s === void 0 ? void 0 : _s.itemId) !== null && _t !== void 0 ? _t : '',
|
415
|
-
|
422
|
+
sceneId: (_w = (_v = (_u = item === null || item === void 0 ? void 0 : item.video) === null || _u === void 0 ? void 0 : _u.scene) === null || _v === void 0 ? void 0 : _v.sceneId) !== null && _w !== void 0 ? _w : '',
|
423
|
+
traceInfo: (_0 = (_y = (_x = item === null || item === void 0 ? void 0 : item.video) === null || _x === void 0 ? void 0 : _x.traceInfo) !== null && _y !== void 0 ? _y : (_z = item === null || item === void 0 ? void 0 : item.product) === null || _z === void 0 ? void 0 : _z.traceInfo) !== null && _0 !== void 0 ? _0 : '',
|
416
424
|
contentFormat
|
417
425
|
}
|
418
426
|
});
|
@@ -422,7 +430,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
422
430
|
}
|
423
431
|
};
|
424
432
|
const handleScrollEvent = (swiper) => {
|
425
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
|
433
|
+
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;
|
426
434
|
const item = data[swiper.previousIndex];
|
427
435
|
if (!item)
|
428
436
|
return;
|
@@ -439,11 +447,12 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
439
447
|
eventSubject: 'scrollDown',
|
440
448
|
eventDescription: 'User scroll down',
|
441
449
|
contentId: (_e = (_d = item === null || item === void 0 ? void 0 : item.video) === null || _d === void 0 ? void 0 : _d.itemId) !== null && _e !== void 0 ? _e : '',
|
442
|
-
|
450
|
+
sceneId: (_h = (_g = (_f = item === null || item === void 0 ? void 0 : item.video) === null || _f === void 0 ? void 0 : _f.scene) === null || _g === void 0 ? void 0 : _g.sceneId) !== null && _h !== void 0 ? _h : '',
|
451
|
+
productId: (_k = (_j = item === null || item === void 0 ? void 0 : item.product) === null || _j === void 0 ? void 0 : _j.itemId) !== null && _k !== void 0 ? _k : '',
|
443
452
|
requestId: null,
|
444
|
-
traceInfo: (
|
453
|
+
traceInfo: (_p = (_m = (_l = item === null || item === void 0 ? void 0 : item.video) === null || _l === void 0 ? void 0 : _l.traceInfo) !== null && _m !== void 0 ? _m : (_o = item === null || item === void 0 ? void 0 : item.product) === null || _o === void 0 ? void 0 : _o.traceInfo) !== null && _p !== void 0 ? _p : '',
|
445
454
|
contentFormat,
|
446
|
-
position: ((
|
455
|
+
position: ((_q = swiper.previousIndex) !== null && _q !== void 0 ? _q : 0) + ''
|
447
456
|
}
|
448
457
|
});
|
449
458
|
handleViewImageStartEnd(item);
|
@@ -454,12 +463,13 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
454
463
|
eventInfo: {
|
455
464
|
eventSubject: 'scrollUp',
|
456
465
|
eventDescription: 'User scroll up',
|
457
|
-
contentId: (
|
458
|
-
|
466
|
+
contentId: (_s = (_r = item === null || item === void 0 ? void 0 : item.video) === null || _r === void 0 ? void 0 : _r.itemId) !== null && _s !== void 0 ? _s : '',
|
467
|
+
sceneId: (_v = (_u = (_t = item === null || item === void 0 ? void 0 : item.video) === null || _t === void 0 ? void 0 : _t.scene) === null || _u === void 0 ? void 0 : _u.sceneId) !== null && _v !== void 0 ? _v : '',
|
468
|
+
productId: (_x = (_w = item.product) === null || _w === void 0 ? void 0 : _w.itemId) !== null && _x !== void 0 ? _x : '',
|
459
469
|
requestId: null,
|
460
|
-
traceInfo: (
|
470
|
+
traceInfo: (_1 = (_z = (_y = item === null || item === void 0 ? void 0 : item.video) === null || _y === void 0 ? void 0 : _y.traceInfo) !== null && _z !== void 0 ? _z : (_0 = item === null || item === void 0 ? void 0 : item.product) === null || _0 === void 0 ? void 0 : _0.traceInfo) !== null && _1 !== void 0 ? _1 : '',
|
461
471
|
contentFormat,
|
462
|
-
position: ((
|
472
|
+
position: ((_2 = swiper.previousIndex) !== null && _2 !== void 0 ? _2 : 0) + ''
|
463
473
|
}
|
464
474
|
});
|
465
475
|
handleViewImageStartEnd(item);
|
@@ -483,7 +493,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
483
493
|
}
|
484
494
|
}, [openHashtag, data, activeIndex]);
|
485
495
|
const handleViewImageStartEvent = (activeIndex, imgInfo, enableCapi) => {
|
486
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
496
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
487
497
|
const item = data[activeIndex];
|
488
498
|
if (!((_a = item === null || item === void 0 ? void 0 : item.video) === null || _a === void 0 ? void 0 : _a.url) && ((_b = item === null || item === void 0 ? void 0 : item.video) === null || _b === void 0 ? void 0 : _b.imgUrls)) {
|
489
499
|
const startTime = Date.now();
|
@@ -493,9 +503,10 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
493
503
|
eventSubject: 'viewImageCarouselStart',
|
494
504
|
eventDescription: 'User start view the image carousel',
|
495
505
|
contentId: (_d = (_c = item === null || item === void 0 ? void 0 : item.video) === null || _c === void 0 ? void 0 : _c.itemId) !== null && _d !== void 0 ? _d : '',
|
496
|
-
|
506
|
+
sceneId: (_g = (_f = (_e = item === null || item === void 0 ? void 0 : item.video) === null || _e === void 0 ? void 0 : _e.scene) === null || _f === void 0 ? void 0 : _f.sceneId) !== null && _g !== void 0 ? _g : '',
|
507
|
+
contentName: (_h = item === null || item === void 0 ? void 0 : item.video.title) !== null && _h !== void 0 ? _h : '',
|
497
508
|
imageStartTime: `${startTime}`,
|
498
|
-
contentTags: JSON.stringify((
|
509
|
+
contentTags: JSON.stringify((_j = item === null || item === void 0 ? void 0 : item.video.tags) !== null && _j !== void 0 ? _j : []),
|
499
510
|
position: activeIndex + '',
|
500
511
|
contentFormat: 'image',
|
501
512
|
traceInfo: item === null || item === void 0 ? void 0 : item.video.traceInfo,
|
@@ -505,11 +516,11 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
505
516
|
if (enableCapi) {
|
506
517
|
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
507
518
|
eventName: 'ViewContent',
|
508
|
-
product: (
|
519
|
+
product: (_k = item === null || item === void 0 ? void 0 : item.video) === null || _k === void 0 ? void 0 : _k.bindProduct
|
509
520
|
});
|
510
521
|
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
511
522
|
eventName: 'PageView',
|
512
|
-
product: (
|
523
|
+
product: (_l = item === null || item === void 0 ? void 0 : item.video) === null || _l === void 0 ? void 0 : _l.bindProduct
|
513
524
|
});
|
514
525
|
}
|
515
526
|
}
|
@@ -601,14 +612,19 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
601
612
|
swiperRef.current.swiper.allowTouchMove = true;
|
602
613
|
}, 500);
|
603
614
|
}, onActiveIndexChange: (swiper) => {
|
615
|
+
var _a, _b;
|
604
616
|
setActiveIndex(swiper.activeIndex);
|
605
617
|
if (openHashtag)
|
606
618
|
return;
|
607
619
|
handleScrollEvent(swiper);
|
608
|
-
if (waterFallData || isEditor
|
620
|
+
if (waterFallData || isEditor)
|
609
621
|
return;
|
610
622
|
if ((swiper === null || swiper === void 0 ? void 0 : swiper.activeIndex) + 1 >= (data === null || data === void 0 ? void 0 : data.length)) {
|
611
623
|
if (!isLoadMore) {
|
624
|
+
if (isDiyH5) {
|
625
|
+
(_a = videoWidgetRef.current) === null || _a === void 0 ? void 0 : _a.setLoopPlay(false);
|
626
|
+
(_b = pictureGroupRef.current) === null || _b === void 0 ? void 0 : _b.setLoopPlay(false);
|
627
|
+
}
|
612
628
|
setIsLoadMore(true);
|
613
629
|
loadVideos === null || loadVideos === void 0 ? void 0 : loadVideos(pageNum).then((res) => {
|
614
630
|
var _a;
|
@@ -21,12 +21,8 @@ export interface ISxpDataSourceContext {
|
|
21
21
|
value: string;
|
22
22
|
}>;
|
23
23
|
}) => Promise<boolean | undefined>;
|
24
|
-
mutateUnlike?: (body:
|
25
|
-
|
26
|
-
}) => Promise<boolean>;
|
27
|
-
mutateLike?: (body: {
|
28
|
-
content: string;
|
29
|
-
}) => Promise<boolean>;
|
24
|
+
mutateUnlike?: (body: Record<string, any>) => Promise<boolean>;
|
25
|
+
mutateLike?: (body: Record<string, any>) => Promise<boolean>;
|
30
26
|
popupDetailData?: RecItemType;
|
31
27
|
setPopupDetailData?: React.Dispatch<React.SetStateAction<any | null>>;
|
32
28
|
loadVideos?: (page: number) => Promise<RecommendVideoResultType | undefined>;
|
@@ -93,6 +89,7 @@ export interface ISxpDataSourceContext {
|
|
93
89
|
getAccount?: () => Promise<any>;
|
94
90
|
accountSonsent?: (v: boolean) => Promise<boolean>;
|
95
91
|
isDiyH5?: boolean;
|
92
|
+
firstRtcList?: RecItemType[];
|
96
93
|
}
|
97
94
|
export declare const SxpDataSourceContext: React.Context<ISxpDataSourceContext>;
|
98
95
|
export interface SxpDataSourceProviderProps {
|
@@ -106,12 +103,8 @@ export interface SxpDataSourceProviderProps {
|
|
106
103
|
value: string;
|
107
104
|
}>;
|
108
105
|
}) => Promise<boolean | undefined>;
|
109
|
-
mutateUnlike: (body:
|
110
|
-
|
111
|
-
}) => Promise<boolean>;
|
112
|
-
mutateLike: (body: {
|
113
|
-
content: string;
|
114
|
-
}) => Promise<boolean>;
|
106
|
+
mutateUnlike: (body: Record<string, any>) => Promise<boolean>;
|
107
|
+
mutateLike: (body: Record<string, any>) => Promise<boolean>;
|
115
108
|
pageData?: PageData;
|
116
109
|
}) => ReactNode;
|
117
110
|
utmVal?: string;
|
@@ -23,6 +23,7 @@ exports.DEFAULT_TAG = 'FOR U';
|
|
23
23
|
const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent = true, maxSize, defaultSize, isPreview = false, sxpParameter, appDomain, hashTagSize, loadingImage, isOpenHashTag = false, enabledMetaConversionApi = false, consentHeight, consentWidth, isOpenConsent = false, isEditor = false, utmParameter, channelQueryList, data, dataList, isDiyH5, onUpdateSchema, onUpdateChannel }) => {
|
24
24
|
var _a, _b, _c, _d, _e;
|
25
25
|
const [rtcList, setRtcList] = (0, react_1.useState)([]);
|
26
|
+
const [firstRtcList, setFirstRtcList] = (0, react_1.useState)([]);
|
26
27
|
const [tagList, setTagList] = (0, react_1.useState)([]);
|
27
28
|
const [loading, setLoading] = (0, react_1.useState)(true);
|
28
29
|
const [curReqInfo, setCurReqInfo] = (0, react_1.useState)({ rtc: '', requestId: '' });
|
@@ -109,7 +110,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
109
110
|
return ((_a = bffDataSource === null || bffDataSource === void 0 ? void 0 : bffDataSource.headers) === null || _a === void 0 ? void 0 : _a['x-app-id']) + (0, localStore_1.storeAndLoadFeUserId)();
|
110
111
|
}, [bffDataSource]);
|
111
112
|
const bffFetch = (0, react_1.useCallback)((path, options, isBota = true) => {
|
112
|
-
var _a;
|
113
|
+
var _a, _b;
|
113
114
|
if (!bffDataSource)
|
114
115
|
return;
|
115
116
|
const url = bffDataSource.url;
|
@@ -124,8 +125,9 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
124
125
|
const value = val.split('=')[1];
|
125
126
|
params[key] = value;
|
126
127
|
});
|
128
|
+
options.body = Object.assign(Object.assign({}, options.body), { productUserId: fakeUserId });
|
127
129
|
return window
|
128
|
-
.fetch(`${url}/api/${path}`, Object.assign({ headers: Object.assign({ 'Content-Type': 'application/json', 'x-user-id': fakeUserId }, bffDataSource.headers), method: options.method, body: options.type === 'beacon' && isBota
|
130
|
+
.fetch(`${url}/api/${path}`, Object.assign({ headers: Object.assign({ 'Content-Type': 'application/json', 'x-user-id': fakeUserId, 'tenant-id': (_b = bffDataSource === null || bffDataSource === void 0 ? void 0 : bffDataSource.headers) === null || _b === void 0 ? void 0 : _b['x-app-id'] }, bffDataSource.headers), method: options.method, body: options.type === 'beacon' && isBota
|
129
131
|
? JSON.stringify({
|
130
132
|
body: btoa(encodeURIComponent(JSON.stringify(Object.assign(Object.assign(Object.assign({}, options.body), bffDataSource.headers), { 'x-user-id': fakeUserId }))))
|
131
133
|
})
|
@@ -381,6 +383,9 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
381
383
|
if ((rtcList === null || rtcList === void 0 ? void 0 : rtcList.length) === 0) {
|
382
384
|
setRtcList(getFilterRecList(Object.assign(Object.assign({}, result === null || result === void 0 ? void 0 : result.data), { recList: list })));
|
383
385
|
setCacheRtcList(getFilterRecList(Object.assign(Object.assign({}, result === null || result === void 0 ? void 0 : result.data), { recList: list })));
|
386
|
+
if (isDiyH5) {
|
387
|
+
setFirstRtcList(getFilterRecList(Object.assign(Object.assign({}, result === null || result === void 0 ? void 0 : result.data), { recList: list })));
|
388
|
+
}
|
384
389
|
}
|
385
390
|
const isNotNullList = (_0 = (_z = result === null || result === void 0 ? void 0 : result.data) === null || _z === void 0 ? void 0 : _z.recList) === null || _0 === void 0 ? void 0 : _0.some((item) => (item === null || item === void 0 ? void 0 : item.product) || (item === null || item === void 0 ? void 0 : item.video));
|
386
391
|
if (isNotNullList) {
|
@@ -420,12 +425,17 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
420
425
|
if (rtcList.length <= 0) {
|
421
426
|
return;
|
422
427
|
}
|
428
|
+
if (isDiyH5 && (firstRtcList === null || firstRtcList === void 0 ? void 0 : firstRtcList.length) > 0) {
|
429
|
+
setRtcList(rtcList.concat(firstRtcList));
|
430
|
+
setCacheRtcList(cacheRtcList.concat(firstRtcList));
|
431
|
+
return;
|
432
|
+
}
|
423
433
|
const lastItem = rtcList === null || rtcList === void 0 ? void 0 : rtcList[(rtcList === null || rtcList === void 0 ? void 0 : rtcList.length) - 1];
|
424
434
|
const data = yield getRecommendVideos(Object.assign(Object.assign(Object.assign(Object.assign({ hashTag: waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.hashTag }, (((_1 = lastItem === null || lastItem === void 0 ? void 0 : lastItem.product) === null || _1 === void 0 ? void 0 : _1.itemId) && { productFilter: [(_2 = lastItem === null || lastItem === void 0 ? void 0 : lastItem.product) === null || _2 === void 0 ? void 0 : _2.itemId] })), (((_3 = lastItem === null || lastItem === void 0 ? void 0 : lastItem.video) === null || _3 === void 0 ? void 0 : _3.itemId) && { contentFilter: [(_4 = lastItem === null || lastItem === void 0 ? void 0 : lastItem.video) === null || _4 === void 0 ? void 0 : _4.itemId] })), { themeTag: themeTag.current }), ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview) && !isEditor && { pageNum })));
|
425
435
|
setRtcList(rtcList.concat(getFilterRecList(data)));
|
426
436
|
setCacheRtcList(cacheRtcList.concat(getFilterRecList(data)));
|
427
437
|
return data;
|
428
|
-
}), [getRecommendVideos, rtcList, waterFallData, cacheRtcList]);
|
438
|
+
}), [getRecommendVideos, rtcList, waterFallData, cacheRtcList, isDiyH5, firstRtcList]);
|
429
439
|
const refreshFeSession = (0, react_1.useCallback)((enableReSid, event) => {
|
430
440
|
var _a, _b, _c, _d, _e;
|
431
441
|
let expire = false;
|
@@ -453,7 +463,9 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
453
463
|
return;
|
454
464
|
}
|
455
465
|
if (!userInfo) {
|
456
|
-
userInfo = {
|
466
|
+
userInfo = {
|
467
|
+
productUserId: fakeUserId
|
468
|
+
};
|
457
469
|
}
|
458
470
|
const sessionID = (0, sessionStore_1.storeAndLoadFeSessionId)();
|
459
471
|
const params = {};
|
@@ -486,7 +498,8 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
486
498
|
layoutVariantId,
|
487
499
|
globalConfig,
|
488
500
|
playbookType,
|
489
|
-
bffDataSource
|
501
|
+
bffDataSource,
|
502
|
+
fakeUserId
|
490
503
|
]);
|
491
504
|
const getEventParamsByJson = (0, react_1.useCallback)((json, product) => {
|
492
505
|
var _a, _b, _c;
|
@@ -619,13 +632,15 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
619
632
|
}
|
620
633
|
}, [bffFetch, enableReportEvent, enabledMetaConversionApi, globalConfig, bffDataSource, getEventParamsByJson]);
|
621
634
|
const bffMutateLike = (0, react_1.useCallback)((body) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
635
|
+
body = Object.assign(Object.assign({}, body), { productUserId: fakeUserId });
|
622
636
|
const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/recommend/like', { method: 'POST', body }));
|
623
637
|
return res === null || res === void 0 ? void 0 : res.success;
|
624
|
-
}), [bffFetch]);
|
638
|
+
}), [bffFetch, fakeUserId]);
|
625
639
|
const bffMutateUnlike = (0, react_1.useCallback)((body) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
640
|
+
body = Object.assign(Object.assign({}, body), { productUserId: fakeUserId });
|
626
641
|
const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/recommend/unlike', { method: 'POST', body }));
|
627
642
|
return res === null || res === void 0 ? void 0 : res.success;
|
628
|
-
}), [bffFetch]);
|
643
|
+
}), [bffFetch, fakeUserId]);
|
629
644
|
const bffSubmitForm = (0, react_1.useCallback)((body) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
630
645
|
const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/customform', { method: 'POST', body }));
|
631
646
|
return res === null || res === void 0 ? void 0 : res.success;
|
@@ -649,7 +664,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
649
664
|
}
|
650
665
|
}), [bffFetch, utmVal]);
|
651
666
|
const ctaEvent = (0, react_1.useCallback)((eventInfo, rec, product, position) => {
|
652
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11;
|
667
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14;
|
653
668
|
const cta = product === null || product === void 0 ? void 0 : product.bindCta;
|
654
669
|
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);
|
655
670
|
let fromKName = '';
|
@@ -667,7 +682,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
667
682
|
}
|
668
683
|
const contentTags = (_p = (_m = (_h = product === null || product === void 0 ? void 0 : product.tags) !== null && _h !== void 0 ? _h : (_l = (_k = (_j = rec === null || rec === void 0 ? void 0 : rec.video) === null || _j === void 0 ? void 0 : _j.bindProducts) === null || _k === void 0 ? void 0 : _k[0]) === null || _l === void 0 ? void 0 : _l.tags) !== null && _m !== void 0 ? _m : (_o = rec === null || rec === void 0 ? void 0 : rec.video) === null || _o === void 0 ? void 0 : _o.tags) !== null && _p !== void 0 ? _p : (_q = rec === null || rec === void 0 ? void 0 : rec.product) === null || _q === void 0 ? void 0 : _q.tags;
|
669
684
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
670
|
-
eventInfo: Object.assign(Object.assign({}, eventInfo), { ctaId: (_r = cta === null || cta === void 0 ? void 0 : cta.itemId) !== null && _r !== void 0 ? _r : '', ctaName: (_s = cta === null || cta === void 0 ? void 0 : cta.title) !== null && _s !== void 0 ? _s : '', contentTags: contentTags ? JSON.stringify(contentTags) : '', position: position + '', contentId: (_u = (_t = rec === null || rec === void 0 ? void 0 : rec.video) === null || _t === void 0 ? void 0 : _t.itemId) !== null && _u !== void 0 ? _u : '', productId: isProd ? product === null || product === void 0 ? void 0 : product.itemId : '', traceInfo: (
|
685
|
+
eventInfo: Object.assign(Object.assign({}, eventInfo), { ctaId: (_r = cta === null || cta === void 0 ? void 0 : cta.itemId) !== null && _r !== void 0 ? _r : '', ctaName: (_s = cta === null || cta === void 0 ? void 0 : cta.title) !== null && _s !== void 0 ? _s : '', contentTags: contentTags ? JSON.stringify(contentTags) : '', position: position + '', contentId: (_u = (_t = rec === null || rec === void 0 ? void 0 : rec.video) === null || _t === void 0 ? void 0 : _t.itemId) !== null && _u !== void 0 ? _u : '', sceneId: (_x = (_w = (_v = rec === null || rec === void 0 ? void 0 : rec.video) === null || _v === void 0 ? void 0 : _v.scene) === null || _w === void 0 ? void 0 : _w.sceneId) !== null && _x !== void 0 ? _x : '', productId: isProd ? product === null || product === void 0 ? void 0 : product.itemId : '', traceInfo: (_13 = (_10 = (_5 = (_1 = (_y = cta === null || cta === void 0 ? void 0 : cta.traceInfo) !== null && _y !== void 0 ? _y : (_0 = (_z = rec === null || rec === void 0 ? void 0 : rec.video) === null || _z === void 0 ? void 0 : _z.bindCta) === null || _0 === void 0 ? void 0 : _0.traceInfo) !== null && _1 !== void 0 ? _1 : (_4 = (_3 = (_2 = rec === null || rec === void 0 ? void 0 : rec.video) === null || _2 === void 0 ? void 0 : _2.bindProduct) === null || _3 === void 0 ? void 0 : _3.bindCta) === null || _4 === void 0 ? void 0 : _4.traceInfo) !== null && _5 !== void 0 ? _5 : (_9 = (_8 = (_7 = (_6 = rec === null || rec === void 0 ? void 0 : rec.video) === null || _6 === void 0 ? void 0 : _6.bindProducts) === null || _7 === void 0 ? void 0 : _7[0]) === null || _8 === void 0 ? void 0 : _8.bindCta) === null || _9 === void 0 ? void 0 : _9.traceInfo) !== null && _10 !== void 0 ? _10 : (_12 = (_11 = rec === null || rec === void 0 ? void 0 : rec.product) === null || _11 === void 0 ? void 0 : _11.bindCta) === null || _12 === void 0 ? void 0 : _12.traceInfo) !== null && _13 !== void 0 ? _13 : '', fromKName, fromKPage: (_14 = location === null || location === void 0 ? void 0 : location.href) !== null && _14 !== void 0 ? _14 : '', contentFormat })
|
671
686
|
});
|
672
687
|
}, [bffEventReport, isFromHashtag]);
|
673
688
|
const h5EnterLink = (0, react_1.useCallback)(() => {
|
@@ -769,6 +784,9 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
769
784
|
}
|
770
785
|
setRtcList(list);
|
771
786
|
setCacheRtcList(list);
|
787
|
+
if (isDiyH5) {
|
788
|
+
setFirstRtcList(list);
|
789
|
+
}
|
772
790
|
bffGetTagList(curData !== null && curData !== void 0 ? curData : finalPageData);
|
773
791
|
if (channel) {
|
774
792
|
const item = list === null || list === void 0 ? void 0 : list[0];
|
@@ -803,6 +821,9 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
803
821
|
}
|
804
822
|
setRtcList(list);
|
805
823
|
setCacheRtcList(list);
|
824
|
+
if (isDiyH5) {
|
825
|
+
setFirstRtcList(list);
|
826
|
+
}
|
806
827
|
}
|
807
828
|
})
|
808
829
|
.finally(() => {
|
@@ -866,7 +887,8 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
866
887
|
refreshFeSession,
|
867
888
|
getAccount,
|
868
889
|
accountSonsent,
|
869
|
-
isDiyH5
|
890
|
+
isDiyH5,
|
891
|
+
firstRtcList
|
870
892
|
} }, isShowConsent ? (react_1.default.createElement(Consent_1.default, Object.assign({}, (_e = (_d = (_c = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.consent) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.item) === null || _e === void 0 ? void 0 : _e.props))) : (render({
|
871
893
|
rtcList,
|
872
894
|
mutateLike: bffMutateLike,
|
@@ -2,12 +2,12 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.useEventReport = void 0;
|
4
4
|
const react_1 = require("react");
|
5
|
-
const useSxpDataSource_1 = require("./useSxpDataSource");
|
6
5
|
const SxpDataSourceProvider_1 = require("../context/SxpDataSourceProvider");
|
6
|
+
const useSxpDataSource_1 = require("./useSxpDataSource");
|
7
7
|
function useEventReport() {
|
8
8
|
const { bffEventReport, popupDetailData, isFromHashtag, eventTimeList, setEventTimeList } = (0, useSxpDataSource_1.useSxpDataSource)();
|
9
9
|
const jumpToWeb = (0, react_1.useCallback)((e, data, product, cta, position, traceInfo) => {
|
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, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13;
|
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, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16;
|
11
11
|
const i = eventTimeList === null || eventTimeList === void 0 ? void 0 : eventTimeList.findIndex((item) => item.target === (e === null || e === void 0 ? void 0 : e.target));
|
12
12
|
if (i !== -1) {
|
13
13
|
return;
|
@@ -40,11 +40,11 @@ function useEventReport() {
|
|
40
40
|
contentFormat = 'image';
|
41
41
|
}
|
42
42
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
43
|
-
eventInfo: Object.assign({ eventSubject: 'jumpToWeb', eventDescription: 'User jumped to website', productId: (_v = product === null || product === void 0 ? void 0 : product.itemId) !== null && _v !== void 0 ? _v : '', productName: (_w = product === null || product === void 0 ? void 0 : product.title) !== null && _w !== void 0 ? _w : '', price: (product === null || product === void 0 ? void 0 : product.price) ? (product === null || product === void 0 ? void 0 : product.price) + '' : '0', productCollection: (_x = product === null || product === void 0 ? void 0 : product.collection) !== null && _x !== void 0 ? _x : '', fromKName, fromKPage: location === null || location === void 0 ? void 0 : location.href, contentTags: contentTags ? JSON.stringify(contentTags) : '', position: position + '', contentId: (_z = (_y = data === null || data === void 0 ? void 0 : data.video) === null || _y === void 0 ? void 0 : _y.itemId) !== null && _z !== void 0 ? _z : '',
|
43
|
+
eventInfo: Object.assign({ eventSubject: 'jumpToWeb', eventDescription: 'User jumped to website', productId: (_v = product === null || product === void 0 ? void 0 : product.itemId) !== null && _v !== void 0 ? _v : '', productName: (_w = product === null || product === void 0 ? void 0 : product.title) !== null && _w !== void 0 ? _w : '', price: (product === null || product === void 0 ? void 0 : product.price) ? (product === null || product === void 0 ? void 0 : product.price) + '' : '0', productCollection: (_x = product === null || product === void 0 ? void 0 : product.collection) !== null && _x !== void 0 ? _x : '', fromKName, fromKPage: location === null || location === void 0 ? void 0 : location.href, contentTags: contentTags ? JSON.stringify(contentTags) : '', position: position + '', contentId: (_z = (_y = data === null || data === void 0 ? void 0 : data.video) === null || _y === void 0 ? void 0 : _y.itemId) !== null && _z !== void 0 ? _z : '', sceneId: (_2 = (_1 = (_0 = data === null || data === void 0 ? void 0 : data.video) === null || _0 === void 0 ? void 0 : _0.scene) === null || _1 === void 0 ? void 0 : _1.sceneId) !== null && _2 !== void 0 ? _2 : '', ctatId: (_3 = cta === null || cta === void 0 ? void 0 : cta.itemId) !== null && _3 !== void 0 ? _3 : '', traceInfo: (_16 = (_13 = (_11 = (_7 = (_4 = traceInfo !== null && traceInfo !== void 0 ? traceInfo : product === null || product === void 0 ? void 0 : product.traceInfo) !== null && _4 !== void 0 ? _4 : (_6 = (_5 = data === null || data === void 0 ? void 0 : data.video) === null || _5 === void 0 ? void 0 : _5.bindProduct) === null || _6 === void 0 ? void 0 : _6.traceInfo) !== null && _7 !== void 0 ? _7 : (_10 = (_9 = (_8 = data === null || data === void 0 ? void 0 : data.video) === null || _8 === void 0 ? void 0 : _8.bindProducts) === null || _9 === void 0 ? void 0 : _9[0]) === null || _10 === void 0 ? void 0 : _10.traceInfo) !== null && _11 !== void 0 ? _11 : (_12 = data === null || data === void 0 ? void 0 : data.product) === null || _12 === void 0 ? void 0 : _12.traceInfo) !== null && _13 !== void 0 ? _13 : (_15 = (_14 = data === null || data === void 0 ? void 0 : data.video) === null || _14 === void 0 ? void 0 : _14.bindCta) === null || _15 === void 0 ? void 0 : _15.traceInfo) !== null && _16 !== void 0 ? _16 : '' }, (contentFormat && { contentFormat }))
|
44
44
|
});
|
45
45
|
}, [bffEventReport, popupDetailData, isFromHashtag, eventTimeList]);
|
46
46
|
const productView = (0, react_1.useCallback)((data, product, cta, viewTime, position) => {
|
47
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
47
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
48
48
|
let fromKName = '';
|
49
49
|
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))) {
|
50
50
|
fromKName = 'pdpPage';
|
@@ -63,8 +63,9 @@ function useEventReport() {
|
|
63
63
|
contentTags: JSON.stringify(product === null || product === void 0 ? void 0 : product.tags),
|
64
64
|
position: position + '',
|
65
65
|
contentId: (_d = data === null || data === void 0 ? void 0 : data.video) === null || _d === void 0 ? void 0 : _d.itemId,
|
66
|
+
sceneId: (_g = (_f = (_e = data === null || data === void 0 ? void 0 : data.video) === null || _e === void 0 ? void 0 : _e.scene) === null || _f === void 0 ? void 0 : _f.sceneId) !== null && _g !== void 0 ? _g : '',
|
66
67
|
ctatId: cta === null || cta === void 0 ? void 0 : cta.itemId,
|
67
|
-
traceInfo: (
|
68
|
+
traceInfo: (_s = (_q = (_l = (_h = product === null || product === void 0 ? void 0 : product.traceInfo) !== null && _h !== void 0 ? _h : (_k = (_j = data === null || data === void 0 ? void 0 : data.video) === null || _j === void 0 ? void 0 : _j.bindProduct) === null || _k === void 0 ? void 0 : _k.traceInfo) !== null && _l !== void 0 ? _l : (_p = (_o = (_m = data === null || data === void 0 ? void 0 : data.video) === null || _m === void 0 ? void 0 : _m.bindProducts) === null || _o === void 0 ? void 0 : _o[0]) === null || _p === void 0 ? void 0 : _p.traceInfo) !== null && _q !== void 0 ? _q : (_r = data === null || data === void 0 ? void 0 : data.product) === null || _r === void 0 ? void 0 : _r.traceInfo) !== null && _s !== void 0 ? _s : '',
|
68
69
|
timeOnSite: Math.floor((new Date() - viewTime) / 1000) + '',
|
69
70
|
eventSubject: 'productView',
|
70
71
|
eventDescription: 'User browsed the product'
|