pb-sxp-ui 1.20.11 → 1.20.13
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 +177 -252
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +177 -252
- package/dist/index.js.map +1 -1
- package/dist/index.min.cjs +7 -7
- package/dist/index.min.cjs.map +1 -1
- package/dist/index.min.js +7 -7
- package/dist/index.min.js.map +1 -1
- package/dist/pb-ui.js +177 -252
- package/dist/pb-ui.js.map +1 -1
- package/dist/pb-ui.min.js +7 -7
- package/dist/pb-ui.min.js.map +1 -1
- package/es/core/components/DiyPortalPreview/VideoWidget.js +8 -10
- package/es/core/components/SxpPageRender/LikeButton/index.js +18 -20
- package/es/core/components/SxpPageRender/PictureGroup/index.d.ts +0 -5
- package/es/core/components/SxpPageRender/PictureGroup/index.js +13 -39
- package/es/core/components/SxpPageRender/VideoWidget/index.js +46 -33
- package/es/core/components/SxpPageRender/WaterFall/index.js +3 -4
- package/es/core/components/SxpPageRender/index.js +40 -56
- package/es/core/context/SxpDataSourceProvider.d.ts +12 -5
- package/es/core/context/SxpDataSourceProvider.js +43 -85
- package/es/core/hooks/useEventReport.js +5 -6
- package/lib/core/components/DiyPortalPreview/VideoWidget.js +8 -10
- package/lib/core/components/SxpPageRender/LikeButton/index.js +18 -20
- package/lib/core/components/SxpPageRender/PictureGroup/index.d.ts +0 -5
- package/lib/core/components/SxpPageRender/PictureGroup/index.js +12 -38
- package/lib/core/components/SxpPageRender/VideoWidget/index.js +46 -33
- package/lib/core/components/SxpPageRender/WaterFall/index.js +3 -4
- package/lib/core/components/SxpPageRender/index.js +40 -56
- package/lib/core/context/SxpDataSourceProvider.d.ts +12 -5
- package/lib/core/context/SxpDataSourceProvider.js +43 -85
- package/lib/core/hooks/useEventReport.js +5 -6
- package/package.json +1 -1
|
@@ -20,7 +20,6 @@ export const DEFAULT_TAG = 'FOR U';
|
|
|
20
20
|
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 }) => {
|
|
21
21
|
var _a, _b, _c, _d, _e;
|
|
22
22
|
const [rtcList, setRtcList] = useState([]);
|
|
23
|
-
const [firstRtcList, setFirstRtcList] = useState([]);
|
|
24
23
|
const [tagList, setTagList] = useState([]);
|
|
25
24
|
const [loading, setLoading] = useState(true);
|
|
26
25
|
const [curReqInfo, setCurReqInfo] = useState({ rtc: '', requestId: '' });
|
|
@@ -51,10 +50,6 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
51
50
|
const [chatlabsId, setChatlabsId] = useState();
|
|
52
51
|
const finalPageData = useMemo(() => pageData !== null && pageData !== void 0 ? pageData : data, [pageData, data]);
|
|
53
52
|
const pixelPvStatusRef = useRef(false);
|
|
54
|
-
const isDiyPage = useMemo(() => {
|
|
55
|
-
var _a, _b, _c;
|
|
56
|
-
return isDiyH5 && !((_c = (_b = (_a = finalPageData === null || finalPageData === void 0 ? void 0 : finalPageData.data) === null || _a === void 0 ? void 0 : _a.sxpPageConf) === null || _b === void 0 ? void 0 : _b.globalConfig) === null || _c === void 0 ? void 0 : _c.enablePreview);
|
|
57
|
-
}, [isDiyH5, finalPageData]);
|
|
58
53
|
useEffect(() => {
|
|
59
54
|
var _a, _b;
|
|
60
55
|
setGlobalConfig((_b = (_a = data === null || data === void 0 ? void 0 : data.data) === null || _a === void 0 ? void 0 : _a.sxpPageConf) === null || _b === void 0 ? void 0 : _b.globalConfig);
|
|
@@ -149,7 +144,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
149
144
|
return false;
|
|
150
145
|
};
|
|
151
146
|
const bffFetch = useCallback((path, options, isBota = true) => {
|
|
152
|
-
var _a
|
|
147
|
+
var _a;
|
|
153
148
|
if (!bffDataSource)
|
|
154
149
|
return;
|
|
155
150
|
const url = bffDataSource.url;
|
|
@@ -164,9 +159,8 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
164
159
|
const value = val.split('=')[1];
|
|
165
160
|
params[key] = value;
|
|
166
161
|
});
|
|
167
|
-
options.body = Object.assign(Object.assign({}, options.body), { productUserId: fakeUserId });
|
|
168
162
|
return window
|
|
169
|
-
.fetch(`${url}/api/${path}`, Object.assign({ headers: Object.assign({ 'Content-Type': 'application/json', 'x-user-id': fakeUserId
|
|
163
|
+
.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
|
|
170
164
|
? JSON.stringify({
|
|
171
165
|
body: btoa(encodeURIComponent(JSON.stringify(Object.assign(Object.assign(Object.assign({}, options.body), bffDataSource.headers), { 'x-user-id': fakeUserId }))))
|
|
172
166
|
})
|
|
@@ -424,8 +418,8 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
424
418
|
.catch((err) => Promise.reject(err));
|
|
425
419
|
}, [bffDataSource]);
|
|
426
420
|
const getRecommendVideos = useCallback((query) => __awaiter(void 0, void 0, void 0, function* () {
|
|
427
|
-
var _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u
|
|
428
|
-
query = Object.assign(Object.assign({ maxSize: (_f = query === null || query === void 0 ? void 0 : query.maxSize) !== null && _f !== void 0 ? _f : maxSize, defaultSize: (_g = query === null || query === void 0 ? void 0 : query.defaultSize) !== null && _g !== void 0 ? _g : defaultSize, hashTag: query === null || query === void 0 ? void 0 : query.hashTag, traceInfo: query === null || query === void 0 ? void 0 : query.traceInfo, themeTag: query === null || query === void 0 ? void 0 : query.themeTag, pageNum: query === null || query === void 0 ? void 0 : query.pageNum, contentFilter: query === null || query === void 0 ? void 0 : query.contentFilter, productFilter: query === null || query === void 0 ? void 0 : query.productFilter }, (chatlabsId && { chatlabsId })), (
|
|
421
|
+
var _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
|
422
|
+
query = Object.assign(Object.assign({ maxSize: (_f = query === null || query === void 0 ? void 0 : query.maxSize) !== null && _f !== void 0 ? _f : maxSize, defaultSize: (_g = query === null || query === void 0 ? void 0 : query.defaultSize) !== null && _g !== void 0 ? _g : defaultSize, hashTag: query === null || query === void 0 ? void 0 : query.hashTag, traceInfo: query === null || query === void 0 ? void 0 : query.traceInfo, themeTag: query === null || query === void 0 ? void 0 : query.themeTag, pageNum: query === null || query === void 0 ? void 0 : query.pageNum, contentFilter: query === null || query === void 0 ? void 0 : query.contentFilter, productFilter: query === null || query === void 0 ? void 0 : query.productFilter }, (chatlabsId && { chatlabsId })), (isDiyH5 && { type: 'story' }));
|
|
429
423
|
if (channel) {
|
|
430
424
|
query = Object.assign(Object.assign({}, query), { channel: decodeURIComponent(channel) });
|
|
431
425
|
}
|
|
@@ -438,10 +432,9 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
438
432
|
if (val)
|
|
439
433
|
query = Object.assign(Object.assign({}, query), { channel: decodeURIComponent(val) });
|
|
440
434
|
}
|
|
441
|
-
const isDiy = isDiyH5 && ((_o = (_m = (_l = finalPageData === null || finalPageData === void 0 ? void 0 : finalPageData.data) === null || _l === void 0 ? void 0 : _l.sxpPageConf) === null || _m === void 0 ? void 0 : _m.globalConfig) === null || _o === void 0 ? void 0 : _o.enablePreview);
|
|
442
435
|
if (isEditor) {
|
|
443
436
|
let pageNum = 1;
|
|
444
|
-
query = Object.assign(Object.assign(Object.assign(
|
|
437
|
+
query = Object.assign(Object.assign(Object.assign({}, query), { directPage: true, level: 1 }), (!utmVal && channelQueryList && (channelQueryList === null || channelQueryList === void 0 ? void 0 : channelQueryList.length) > 0 && { channel: channelQueryList === null || channelQueryList === void 0 ? void 0 : channelQueryList[0] }));
|
|
445
438
|
if (!(query === null || query === void 0 ? void 0 : query.channel) || isInit.current) {
|
|
446
439
|
return undefined;
|
|
447
440
|
}
|
|
@@ -449,24 +442,19 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
449
442
|
let list = [];
|
|
450
443
|
let result = null;
|
|
451
444
|
const recurveRecList = (query) => __awaiter(void 0, void 0, void 0, function* () {
|
|
452
|
-
var
|
|
445
|
+
var _v, _w, _x, _y, _z, _0;
|
|
453
446
|
query.pageNum = pageNum;
|
|
454
|
-
result =
|
|
455
|
-
? yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v3/recommend/direct/page/view', { method: 'POST', body: query }))
|
|
456
|
-
: yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('recommend/direct_page', { method: 'POST', body: query }));
|
|
447
|
+
result = yield (bffFetchAdmin === null || bffFetchAdmin === void 0 ? void 0 : bffFetchAdmin('recommend/direct_page', { method: 'POST', body: query }));
|
|
457
448
|
if (!(result === null || result === void 0 ? void 0 : result.success)) {
|
|
458
449
|
return undefined;
|
|
459
450
|
}
|
|
460
451
|
setLoading(false);
|
|
461
|
-
list = list.concat((
|
|
452
|
+
list = list.concat((_y = (_x = (_w = (_v = result === null || result === void 0 ? void 0 : result.data) === null || _v === void 0 ? void 0 : _v.recList) === null || _w === void 0 ? void 0 : _w.filter) === null || _x === void 0 ? void 0 : _x.call(_w, (item) => (item === null || item === void 0 ? void 0 : item.product) || (item === null || item === void 0 ? void 0 : item.video))) !== null && _y !== void 0 ? _y : []);
|
|
462
453
|
if ((rtcList === null || rtcList === void 0 ? void 0 : rtcList.length) === 0) {
|
|
463
454
|
setRtcList(getFilterRecList(Object.assign(Object.assign({}, result === null || result === void 0 ? void 0 : result.data), { recList: list })));
|
|
464
455
|
setCacheRtcList(getFilterRecList(Object.assign(Object.assign({}, result === null || result === void 0 ? void 0 : result.data), { recList: list })));
|
|
465
|
-
if (isDiyPage) {
|
|
466
|
-
setFirstRtcList(getFilterRecList(Object.assign(Object.assign({}, result === null || result === void 0 ? void 0 : result.data), { recList: list })));
|
|
467
|
-
}
|
|
468
456
|
}
|
|
469
|
-
const isNotNullList = (
|
|
457
|
+
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));
|
|
470
458
|
if (isNotNullList) {
|
|
471
459
|
pageNum = pageNum + 1;
|
|
472
460
|
yield recurveRecList(query);
|
|
@@ -474,61 +462,42 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
474
462
|
});
|
|
475
463
|
yield recurveRecList(query);
|
|
476
464
|
if (!(query === null || query === void 0 ? void 0 : query.hashTag) && result)
|
|
477
|
-
setCurReqInfo({ rtc: (
|
|
465
|
+
setCurReqInfo({ rtc: (_l = result === null || result === void 0 ? void 0 : result.data) === null || _l === void 0 ? void 0 : _l.rtc, requestId: (_m = result === null || result === void 0 ? void 0 : result.data) === null || _m === void 0 ? void 0 : _m.requestId });
|
|
478
466
|
return Object.assign(Object.assign({}, result === null || result === void 0 ? void 0 : result.data), { recList: list });
|
|
479
467
|
}
|
|
480
468
|
if (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview) {
|
|
481
|
-
query = Object.assign(Object.assign(
|
|
469
|
+
query = Object.assign(Object.assign({}, query), { directPage: true, level: 1, pageNum: (_o = query === null || query === void 0 ? void 0 : query.pageNum) !== null && _o !== void 0 ? _o : 1 });
|
|
482
470
|
}
|
|
483
|
-
const result =
|
|
484
|
-
|
|
485
|
-
:
|
|
486
|
-
|
|
487
|
-
body: query
|
|
488
|
-
}));
|
|
471
|
+
const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/recommend/list', {
|
|
472
|
+
method: 'POST',
|
|
473
|
+
body: query
|
|
474
|
+
}));
|
|
489
475
|
if (!(result === null || result === void 0 ? void 0 : result.success)) {
|
|
490
476
|
return undefined;
|
|
491
477
|
}
|
|
492
478
|
if (!(query === null || query === void 0 ? void 0 : query.hashTag))
|
|
493
479
|
setCurReqInfo({ rtc: result.data.rtc, requestId: result.data.requestId });
|
|
494
480
|
if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview) && !isEditor) {
|
|
495
|
-
const isNotNullList = (
|
|
481
|
+
const isNotNullList = (_q = (_p = result === null || result === void 0 ? void 0 : result.data) === null || _p === void 0 ? void 0 : _p.recList) === null || _q === void 0 ? void 0 : _q.some((item) => (item === null || item === void 0 ? void 0 : item.product) || (item === null || item === void 0 ? void 0 : item.video));
|
|
496
482
|
if (!isNotNullList) {
|
|
497
483
|
setIsNoMoreData(true);
|
|
498
484
|
}
|
|
499
485
|
}
|
|
500
486
|
let list = [];
|
|
501
|
-
list = list.concat((
|
|
487
|
+
list = list.concat((_u = (_t = (_s = (_r = result === null || result === void 0 ? void 0 : result.data) === null || _r === void 0 ? void 0 : _r.recList) === null || _s === void 0 ? void 0 : _s.filter) === null || _t === void 0 ? void 0 : _t.call(_s, (item) => (item === null || item === void 0 ? void 0 : item.product) || (item === null || item === void 0 ? void 0 : item.video))) !== null && _u !== void 0 ? _u : []);
|
|
502
488
|
return Object.assign(Object.assign({}, result.data), { recList: list });
|
|
503
|
-
}), [
|
|
504
|
-
bffFetch,
|
|
505
|
-
utmVal,
|
|
506
|
-
maxSize,
|
|
507
|
-
defaultSize,
|
|
508
|
-
channelQueryList,
|
|
509
|
-
channel,
|
|
510
|
-
chatlabsId,
|
|
511
|
-
bffFetchAdmin,
|
|
512
|
-
isDiyPage,
|
|
513
|
-
finalPageData,
|
|
514
|
-
isDiyH5
|
|
515
|
-
]);
|
|
489
|
+
}), [bffFetch, utmVal, maxSize, defaultSize, channelQueryList, channel, chatlabsId, bffFetchAdmin]);
|
|
516
490
|
const loadVideos = useCallback((pageNum) => __awaiter(void 0, void 0, void 0, function* () {
|
|
517
|
-
var
|
|
491
|
+
var _1, _2, _3, _4;
|
|
518
492
|
if (rtcList.length <= 0) {
|
|
519
493
|
return;
|
|
520
494
|
}
|
|
521
|
-
if (isDiyPage && (firstRtcList === null || firstRtcList === void 0 ? void 0 : firstRtcList.length) > 0) {
|
|
522
|
-
setRtcList(rtcList.concat(firstRtcList));
|
|
523
|
-
setCacheRtcList(cacheRtcList.concat(firstRtcList));
|
|
524
|
-
return;
|
|
525
|
-
}
|
|
526
495
|
const lastItem = rtcList === null || rtcList === void 0 ? void 0 : rtcList[(rtcList === null || rtcList === void 0 ? void 0 : rtcList.length) - 1];
|
|
527
|
-
const data = yield getRecommendVideos(Object.assign(Object.assign(Object.assign(Object.assign({ hashTag: waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.hashTag }, (((
|
|
496
|
+
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 })));
|
|
528
497
|
setRtcList(rtcList.concat(getFilterRecList(data)));
|
|
529
498
|
setCacheRtcList(cacheRtcList.concat(getFilterRecList(data)));
|
|
530
499
|
return data;
|
|
531
|
-
}), [getRecommendVideos, rtcList, waterFallData, cacheRtcList
|
|
500
|
+
}), [getRecommendVideos, rtcList, waterFallData, cacheRtcList]);
|
|
532
501
|
const refreshFeSession = useCallback((enableReSid, event) => {
|
|
533
502
|
var _a, _b, _c, _d, _e;
|
|
534
503
|
let expire = false;
|
|
@@ -556,9 +525,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
556
525
|
return;
|
|
557
526
|
}
|
|
558
527
|
if (!userInfo) {
|
|
559
|
-
userInfo = {
|
|
560
|
-
productUserId: fakeUserId
|
|
561
|
-
};
|
|
528
|
+
userInfo = {};
|
|
562
529
|
}
|
|
563
530
|
const sessionID = storeAndLoadFeSessionId();
|
|
564
531
|
const params = {};
|
|
@@ -591,8 +558,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
591
558
|
layoutVariantId,
|
|
592
559
|
globalConfig,
|
|
593
560
|
playbookType,
|
|
594
|
-
bffDataSource
|
|
595
|
-
fakeUserId
|
|
561
|
+
bffDataSource
|
|
596
562
|
]);
|
|
597
563
|
const getEventParamsByJson = useCallback((_a) => {
|
|
598
564
|
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
|
@@ -608,9 +574,9 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
608
574
|
fbp: getCookie('_fbp') ? `${getCookie('_fbp')}` : '',
|
|
609
575
|
time: Math.floor(Date.now() / 1000)
|
|
610
576
|
};
|
|
611
|
-
let customData = Object.assign({ content_ids: [(_e = rec === null || rec === void 0 ? void 0 : rec.video) === null || _e === void 0 ? void 0 : _e.itemId, ...((_f = product === null || product === void 0 ? void 0 : product.map((item) => item === null || item === void 0 ? void 0 : item.itemId)) !== null && _f !== void 0 ? _f : [])], content_type: contentType, content_name: (_g = rec === null || rec === void 0 ? void 0 : rec.video) === null || _g === void 0 ? void 0 : _g.title, total_posts: rtcList === null || rtcList === void 0 ? void 0 : rtcList.length, position, currency: (_k = (_j = (_h = product === null || product === void 0 ? void 0 : product[0]) === null || _h === void 0 ? void 0 : _h.currency) === null || _j === void 0 ? void 0 : _j.split('-')) === null || _k === void 0 ? void 0 : _k[0], contents: (_l = product === null || product === void 0 ? void 0 : product.map((item) => ({
|
|
577
|
+
let customData = Object.assign({ content_ids: [(_e = rec === null || rec === void 0 ? void 0 : rec.video) === null || _e === void 0 ? void 0 : _e.itemId, ...((_f = product === null || product === void 0 ? void 0 : product.map((item) => item === null || item === void 0 ? void 0 : item.itemId)) !== null && _f !== void 0 ? _f : [])], content_type: contentType, content_name: (_g = rec === null || rec === void 0 ? void 0 : rec.video) === null || _g === void 0 ? void 0 : _g.title, total_posts: rtcList === null || rtcList === void 0 ? void 0 : rtcList.length, position, currency: (_k = (_j = (_h = product === null || product === void 0 ? void 0 : product[0]) === null || _h === void 0 ? void 0 : _h.currency) === null || _j === void 0 ? void 0 : _j.split('-')) === null || _k === void 0 ? void 0 : _k[0], value: product === null || product === void 0 ? void 0 : product.reduce((acc, item) => acc + (item === null || item === void 0 ? void 0 : item.price), 0), contents: (_l = product === null || product === void 0 ? void 0 : product.map((item) => ({
|
|
612
578
|
id: item === null || item === void 0 ? void 0 : item.itemId,
|
|
613
|
-
|
|
579
|
+
item_price: item === null || item === void 0 ? void 0 : item.price
|
|
614
580
|
}))) !== null && _l !== void 0 ? _l : [], image_urls: (_o = (_m = rec === null || rec === void 0 ? void 0 : rec.video) === null || _m === void 0 ? void 0 : _m.imgUrls) !== null && _o !== void 0 ? _o : [], video_urls: (_p = rec === null || rec === void 0 ? void 0 : rec.video) === null || _p === void 0 ? void 0 : _p.url, headline: getUrlParamByKey('headline'), scene: getUrlParamByKey('scene'), campaign_id: getUrlParamByKey('campaign_id'), ad_id: getUrlParamByKey('ad_id'), utm_source: getUrlParamByKey('utm_source'), utm_medium: getUrlParamByKey('utm_medium'), utm_campaign: getUrlParamByKey('utm_campaign'), utm_content: getUrlParamByKey('utm_content') }, props);
|
|
615
581
|
if (!((_q = rec === null || rec === void 0 ? void 0 : rec.video) === null || _q === void 0 ? void 0 : _q.url) &&
|
|
616
582
|
!((_s = (_r = rec === null || rec === void 0 ? void 0 : rec.video) === null || _r === void 0 ? void 0 : _r.imgUrls) === null || _s === void 0 ? void 0 : _s.length) &&
|
|
@@ -625,7 +591,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
625
591
|
contents: [
|
|
626
592
|
{
|
|
627
593
|
id: product === null || product === void 0 ? void 0 : product.itemId,
|
|
628
|
-
|
|
594
|
+
item_price: product === null || product === void 0 ? void 0 : product.price
|
|
629
595
|
}
|
|
630
596
|
],
|
|
631
597
|
image_urls: (_u = product.homePage) !== null && _u !== void 0 ? _u : []
|
|
@@ -640,7 +606,8 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
640
606
|
'contents',
|
|
641
607
|
'image_urls',
|
|
642
608
|
'video_urls',
|
|
643
|
-
'prompt'
|
|
609
|
+
'prompt',
|
|
610
|
+
'value'
|
|
644
611
|
];
|
|
645
612
|
deleteKeys.forEach((key) => {
|
|
646
613
|
if (customData === null || customData === void 0 ? void 0 : customData[key])
|
|
@@ -772,39 +739,37 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
772
739
|
}
|
|
773
740
|
}, [bffFetch, enableReportEvent, enabledMetaConversionApi, globalConfig, bffDataSource, getEventParamsByJson]);
|
|
774
741
|
const bffMutateLike = useCallback((body) => __awaiter(void 0, void 0, void 0, function* () {
|
|
775
|
-
body = Object.assign(Object.assign({}, body), { productUserId: fakeUserId });
|
|
776
742
|
const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/recommend/like', { method: 'POST', body }));
|
|
777
743
|
return res === null || res === void 0 ? void 0 : res.success;
|
|
778
|
-
}), [bffFetch
|
|
744
|
+
}), [bffFetch]);
|
|
779
745
|
const bffMutateUnlike = useCallback((body) => __awaiter(void 0, void 0, void 0, function* () {
|
|
780
|
-
body = Object.assign(Object.assign({}, body), { productUserId: fakeUserId });
|
|
781
746
|
const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/recommend/unlike', { method: 'POST', body }));
|
|
782
747
|
return res === null || res === void 0 ? void 0 : res.success;
|
|
783
|
-
}), [bffFetch
|
|
748
|
+
}), [bffFetch]);
|
|
784
749
|
const bffSubmitForm = useCallback((body) => __awaiter(void 0, void 0, void 0, function* () {
|
|
785
750
|
const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/customform', { method: 'POST', body }));
|
|
786
751
|
return res === null || res === void 0 ? void 0 : res.success;
|
|
787
752
|
}), [bffFetch]);
|
|
788
753
|
const bffGetTagList = useCallback((data) => __awaiter(void 0, void 0, void 0, function* () {
|
|
789
|
-
var
|
|
790
|
-
const isShowTag = !!((
|
|
754
|
+
var _5, _6, _7, _8, _9, _10, _11, _12;
|
|
755
|
+
const isShowTag = !!((_7 = (_6 = (_5 = data === null || data === void 0 ? void 0 : data.data) === null || _5 === void 0 ? void 0 : _5.sxpPageConf) === null || _6 === void 0 ? void 0 : _6.globalConfig) === null || _7 === void 0 ? void 0 : _7.isShowTag);
|
|
791
756
|
if (!utmVal || !isShowTag)
|
|
792
757
|
return;
|
|
793
758
|
try {
|
|
794
|
-
const val = (
|
|
759
|
+
const val = (_10 = (_9 = (_8 = splitUrlParams(utmVal)) === null || _8 === void 0 ? void 0 : _8.filter((val) => {
|
|
795
760
|
var _a, _b;
|
|
796
761
|
const key = val.split('=')[0];
|
|
797
762
|
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);
|
|
798
|
-
})) === null ||
|
|
763
|
+
})) === null || _9 === void 0 ? void 0 : _9.join('&')) !== null && _10 !== void 0 ? _10 : '';
|
|
799
764
|
const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/tag/list', { method: 'GET', query: { channel: decodeURIComponent(val) } }));
|
|
800
|
-
setTagList((
|
|
765
|
+
setTagList((_12 = (_11 = result === null || result === void 0 ? void 0 : result.data) === null || _11 === void 0 ? void 0 : _11.tags) !== null && _12 !== void 0 ? _12 : []);
|
|
801
766
|
}
|
|
802
767
|
catch (e) {
|
|
803
768
|
console.log('e', e);
|
|
804
769
|
}
|
|
805
770
|
}), [bffFetch, utmVal]);
|
|
806
771
|
const ctaEvent = useCallback((eventInfo, rec, product, position, ctaActionType, targetUrl, contentType) => {
|
|
807
|
-
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
|
|
772
|
+
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;
|
|
808
773
|
const cta = product === null || product === void 0 ? void 0 : product.bindCta;
|
|
809
774
|
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);
|
|
810
775
|
let fromKName = '';
|
|
@@ -822,7 +787,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
822
787
|
}
|
|
823
788
|
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;
|
|
824
789
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
|
825
|
-
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 : '',
|
|
790
|
+
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: (_10 = (_7 = (_2 = (_y = (_v = cta === null || cta === void 0 ? void 0 : cta.traceInfo) !== null && _v !== void 0 ? _v : (_x = (_w = rec === null || rec === void 0 ? void 0 : rec.video) === null || _w === void 0 ? void 0 : _w.bindCta) === null || _x === void 0 ? void 0 : _x.traceInfo) !== null && _y !== void 0 ? _y : (_1 = (_0 = (_z = rec === null || rec === void 0 ? void 0 : rec.video) === null || _z === void 0 ? void 0 : _z.bindProduct) === null || _0 === void 0 ? void 0 : _0.bindCta) === null || _1 === void 0 ? void 0 : _1.traceInfo) !== null && _2 !== void 0 ? _2 : (_6 = (_5 = (_4 = (_3 = rec === null || rec === void 0 ? void 0 : rec.video) === null || _3 === void 0 ? void 0 : _3.bindProducts) === null || _4 === void 0 ? void 0 : _4[0]) === null || _5 === void 0 ? void 0 : _5.bindCta) === null || _6 === void 0 ? void 0 : _6.traceInfo) !== null && _7 !== void 0 ? _7 : (_9 = (_8 = rec === null || rec === void 0 ? void 0 : rec.product) === null || _8 === void 0 ? void 0 : _8.bindCta) === null || _9 === void 0 ? void 0 : _9.traceInfo) !== null && _10 !== void 0 ? _10 : '', fromKName, fromKPage: (_11 = location === null || location === void 0 ? void 0 : location.href) !== null && _11 !== void 0 ? _11 : '', contentFormat })
|
|
826
791
|
});
|
|
827
792
|
}, [bffEventReport, isFromHashtag]);
|
|
828
793
|
const h5EnterLink = useCallback(() => {
|
|
@@ -846,10 +811,10 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
846
811
|
});
|
|
847
812
|
}, [bffEventReport]);
|
|
848
813
|
const getAccount = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
849
|
-
var
|
|
814
|
+
var _13, _14;
|
|
850
815
|
const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/account', { method: 'GET' }));
|
|
851
|
-
setChatlabsId((
|
|
852
|
-
return ((
|
|
816
|
+
setChatlabsId((_13 = res === null || res === void 0 ? void 0 : res.data) === null || _13 === void 0 ? void 0 : _13.chatLabsId);
|
|
817
|
+
return ((_14 = res === null || res === void 0 ? void 0 : res.data) === null || _14 === void 0 ? void 0 : _14.consentResult) === 'true';
|
|
853
818
|
}), [bffFetch]);
|
|
854
819
|
const accountSonsent = useCallback((consentResult) => __awaiter(void 0, void 0, void 0, function* () {
|
|
855
820
|
const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/account/consent', {
|
|
@@ -913,9 +878,6 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
913
878
|
}
|
|
914
879
|
setRtcList(list);
|
|
915
880
|
setCacheRtcList(list);
|
|
916
|
-
if (isDiyPage) {
|
|
917
|
-
setFirstRtcList(list);
|
|
918
|
-
}
|
|
919
881
|
bffGetTagList(curData !== null && curData !== void 0 ? curData : finalPageData);
|
|
920
882
|
if (channel) {
|
|
921
883
|
const item = list === null || list === void 0 ? void 0 : list[0];
|
|
@@ -935,7 +897,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
935
897
|
});
|
|
936
898
|
setLoading(false);
|
|
937
899
|
});
|
|
938
|
-
}, [isShowConsent, channel
|
|
900
|
+
}, [isShowConsent, channel]);
|
|
939
901
|
useEffect(() => {
|
|
940
902
|
if (!isPreview)
|
|
941
903
|
return;
|
|
@@ -950,15 +912,12 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
950
912
|
}
|
|
951
913
|
setRtcList(list);
|
|
952
914
|
setCacheRtcList(list);
|
|
953
|
-
if (isDiyPage) {
|
|
954
|
-
setFirstRtcList(list);
|
|
955
|
-
}
|
|
956
915
|
}
|
|
957
916
|
})
|
|
958
917
|
.finally(() => {
|
|
959
918
|
setLoading(false);
|
|
960
919
|
});
|
|
961
|
-
}, [getRecommendVideos, bffGetTagList, channel
|
|
920
|
+
}, [getRecommendVideos, bffGetTagList, channel]);
|
|
962
921
|
const defaultLoadingImage = useIconLink('/pb_static/a65d23c5893c49d7aaaa81681d3179e2.gif', appDomain);
|
|
963
922
|
return (React.createElement(SxpDataSourceContext.Provider, { value: {
|
|
964
923
|
rtcList,
|
|
@@ -1016,8 +975,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
1016
975
|
refreshFeSession,
|
|
1017
976
|
getAccount,
|
|
1018
977
|
accountSonsent,
|
|
1019
|
-
isDiyH5
|
|
1020
|
-
firstRtcList,
|
|
978
|
+
isDiyH5,
|
|
1021
979
|
pixelPvStatusRef
|
|
1022
980
|
} }, isShowConsent ? (React.createElement(Consent, 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({
|
|
1023
981
|
rtcList,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { useCallback } from 'react';
|
|
2
|
-
import { DEFAULT_TAG } from '../context/SxpDataSourceProvider';
|
|
3
2
|
import { useSxpDataSource } from './useSxpDataSource';
|
|
3
|
+
import { DEFAULT_TAG } from '../context/SxpDataSourceProvider';
|
|
4
4
|
export function useEventReport() {
|
|
5
5
|
const { bffEventReport, popupDetailData, isFromHashtag, eventTimeList, setEventTimeList } = useSxpDataSource();
|
|
6
6
|
const jumpToWeb = useCallback((e, data, product, cta, position, traceInfo) => {
|
|
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, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13
|
|
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, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13;
|
|
8
8
|
const i = eventTimeList === null || eventTimeList === void 0 ? void 0 : eventTimeList.findIndex((item) => item.target === (e === null || e === void 0 ? void 0 : e.target));
|
|
9
9
|
if (i !== -1) {
|
|
10
10
|
return;
|
|
@@ -37,11 +37,11 @@ export function useEventReport() {
|
|
|
37
37
|
contentFormat = 'image';
|
|
38
38
|
}
|
|
39
39
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
|
40
|
-
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 : '',
|
|
40
|
+
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 : '', ctatId: (_0 = cta === null || cta === void 0 ? void 0 : cta.itemId) !== null && _0 !== void 0 ? _0 : '', traceInfo: (_13 = (_10 = (_8 = (_4 = (_1 = traceInfo !== null && traceInfo !== void 0 ? traceInfo : product === null || product === void 0 ? void 0 : product.traceInfo) !== null && _1 !== void 0 ? _1 : (_3 = (_2 = data === null || data === void 0 ? void 0 : data.video) === null || _2 === void 0 ? void 0 : _2.bindProduct) === null || _3 === void 0 ? void 0 : _3.traceInfo) !== null && _4 !== void 0 ? _4 : (_7 = (_6 = (_5 = data === null || data === void 0 ? void 0 : data.video) === null || _5 === void 0 ? void 0 : _5.bindProducts) === null || _6 === void 0 ? void 0 : _6[0]) === null || _7 === void 0 ? void 0 : _7.traceInfo) !== null && _8 !== void 0 ? _8 : (_9 = data === null || data === void 0 ? void 0 : data.product) === null || _9 === void 0 ? void 0 : _9.traceInfo) !== null && _10 !== void 0 ? _10 : (_12 = (_11 = data === null || data === void 0 ? void 0 : data.video) === null || _11 === void 0 ? void 0 : _11.bindCta) === null || _12 === void 0 ? void 0 : _12.traceInfo) !== null && _13 !== void 0 ? _13 : '' }, (contentFormat && { contentFormat }))
|
|
41
41
|
});
|
|
42
42
|
}, [bffEventReport, popupDetailData, isFromHashtag, eventTimeList]);
|
|
43
43
|
const productView = useCallback((data, product, cta, viewTime, position) => {
|
|
44
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p
|
|
44
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
45
45
|
let fromKName = '';
|
|
46
46
|
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))) {
|
|
47
47
|
fromKName = 'pdpPage';
|
|
@@ -60,9 +60,8 @@ export function useEventReport() {
|
|
|
60
60
|
contentTags: JSON.stringify(product === null || product === void 0 ? void 0 : product.tags),
|
|
61
61
|
position: position + '',
|
|
62
62
|
contentId: (_d = data === null || data === void 0 ? void 0 : data.video) === null || _d === void 0 ? void 0 : _d.itemId,
|
|
63
|
-
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 : '',
|
|
64
63
|
ctatId: cta === null || cta === void 0 ? void 0 : cta.itemId,
|
|
65
|
-
traceInfo: (
|
|
64
|
+
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 : '',
|
|
66
65
|
timeOnSite: Math.floor((new Date() - viewTime) / 1000) + '',
|
|
67
66
|
eventSubject: 'productView',
|
|
68
67
|
eventDescription: 'User browsed the product'
|
|
@@ -25,7 +25,7 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
|
25
25
|
}, []);
|
|
26
26
|
const PAUSE_ICON = (0, useIconLink_1.useIconLink)('/pb_static/06f28a2025c74c1cb49be6767316d827.png');
|
|
27
27
|
const handlePlaying = (0, react_1.useCallback)(() => {
|
|
28
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o
|
|
28
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
29
29
|
setIsPauseVideo(false);
|
|
30
30
|
const item = data[index];
|
|
31
31
|
if (item && ((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.duration)) {
|
|
@@ -38,15 +38,14 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
|
38
38
|
eventSubject: 'playVideo',
|
|
39
39
|
eventDescription: 'User played the video',
|
|
40
40
|
contentId: (_h = (_g = item === null || item === void 0 ? void 0 : item.video) === null || _g === void 0 ? void 0 : _g.itemId) !== null && _h !== void 0 ? _h : '',
|
|
41
|
-
|
|
42
|
-
contentName: (_o = (_m = item === null || item === void 0 ? void 0 : item.video) === null || _m === void 0 ? void 0 : _m.title) !== null && _o !== void 0 ? _o : '',
|
|
41
|
+
contentName: (_k = (_j = item === null || item === void 0 ? void 0 : item.video) === null || _j === void 0 ? void 0 : _j.title) !== null && _k !== void 0 ? _k : '',
|
|
43
42
|
playType,
|
|
44
43
|
startTime: videoCurrentTime,
|
|
45
44
|
videoDuration,
|
|
46
|
-
contentTags: JSON.stringify((
|
|
45
|
+
contentTags: JSON.stringify((_m = (_l = item === null || item === void 0 ? void 0 : item.video) === null || _l === void 0 ? void 0 : _l.tags) !== null && _m !== void 0 ? _m : []),
|
|
47
46
|
position: index + '',
|
|
48
47
|
contentFormat: 'video',
|
|
49
|
-
traceInfo: (
|
|
48
|
+
traceInfo: (_o = item === null || item === void 0 ? void 0 : item.video) === null || _o === void 0 ? void 0 : _o.traceInfo
|
|
50
49
|
}
|
|
51
50
|
});
|
|
52
51
|
setIsFirstPlay(false);
|
|
@@ -85,7 +84,7 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
|
85
84
|
}
|
|
86
85
|
}, [isLoadFinish]);
|
|
87
86
|
const onPause = (0, react_1.useCallback)(() => {
|
|
88
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o
|
|
87
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
89
88
|
const item = data[index];
|
|
90
89
|
const videoDuration = ((_b = (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.duration) !== null && _b !== void 0 ? _b : 0).toFixed(2);
|
|
91
90
|
const videoCurrentTime = ((_d = (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.currentTime) !== null && _d !== void 0 ? _d : 0).toFixed(2);
|
|
@@ -96,15 +95,14 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
|
96
95
|
eventSubject: 'playOverVideo',
|
|
97
96
|
eventDescription: 'User finished playing the video',
|
|
98
97
|
contentId: (_h = (_g = item === null || item === void 0 ? void 0 : item.video) === null || _g === void 0 ? void 0 : _g.itemId) !== null && _h !== void 0 ? _h : '',
|
|
99
|
-
|
|
100
|
-
contentName: (_o = (_m = item === null || item === void 0 ? void 0 : item.video) === null || _m === void 0 ? void 0 : _m.title) !== null && _o !== void 0 ? _o : '',
|
|
98
|
+
contentName: (_k = (_j = item === null || item === void 0 ? void 0 : item.video) === null || _j === void 0 ? void 0 : _j.title) !== null && _k !== void 0 ? _k : '',
|
|
101
99
|
endTime: videoCurrentTime,
|
|
102
100
|
videoDuration,
|
|
103
101
|
playDuration,
|
|
104
|
-
contentTags: JSON.stringify((
|
|
102
|
+
contentTags: JSON.stringify((_m = (_l = item === null || item === void 0 ? void 0 : item.video) === null || _l === void 0 ? void 0 : _l.tags) !== null && _m !== void 0 ? _m : []),
|
|
105
103
|
position: index + '',
|
|
106
104
|
contentFormat: 'video',
|
|
107
|
-
traceInfo: (
|
|
105
|
+
traceInfo: (_o = item === null || item === void 0 ? void 0 : item.video) === null || _o === void 0 ? void 0 : _o.traceInfo
|
|
108
106
|
}
|
|
109
107
|
});
|
|
110
108
|
}
|
|
@@ -15,70 +15,68 @@ const LikeButton = (_a) => {
|
|
|
15
15
|
const likeIcon = (0, useIconLink_1.useIconLink)(defaultLikeIconPath);
|
|
16
16
|
const unlikeIcon = (0, useIconLink_1.useIconLink)(defaultUnLikeIconPath);
|
|
17
17
|
const handleClick = (0, lodash_1.debounce)(() => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
18
|
-
var _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
|
|
18
|
+
var _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;
|
|
19
19
|
if (state) {
|
|
20
20
|
setState(false);
|
|
21
|
-
const result = (_e = (yield (mutateUnlike === null || mutateUnlike === void 0 ? void 0 : mutateUnlike({
|
|
21
|
+
const result = (_e = (yield (mutateUnlike === null || mutateUnlike === void 0 ? void 0 : mutateUnlike({ videoItemId: (_d = (_c = recData === null || recData === void 0 ? void 0 : recData.video) === null || _c === void 0 ? void 0 : _c.itemId) !== null && _d !== void 0 ? _d : '' })))) !== null && _e !== void 0 ? _e : false;
|
|
22
22
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
|
23
23
|
eventInfo: {
|
|
24
24
|
eventSubject: 'favoriteContentCanceled',
|
|
25
25
|
eventDescription: 'This content was unfavorite by the user',
|
|
26
26
|
contentId: (_g = (_f = recData === null || recData === void 0 ? void 0 : recData.video) === null || _f === void 0 ? void 0 : _f.itemId) !== null && _g !== void 0 ? _g : '',
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
contentTags: JSON.stringify((_p = (_o = recData === null || recData === void 0 ? void 0 : recData.video) === null || _o === void 0 ? void 0 : _o.tags) !== null && _p !== void 0 ? _p : []),
|
|
27
|
+
contentName: (_j = (_h = recData === null || recData === void 0 ? void 0 : recData.video) === null || _h === void 0 ? void 0 : _h.title) !== null && _j !== void 0 ? _j : '',
|
|
28
|
+
contentTags: JSON.stringify((_l = (_k = recData === null || recData === void 0 ? void 0 : recData.video) === null || _k === void 0 ? void 0 : _k.tags) !== null && _l !== void 0 ? _l : []),
|
|
30
29
|
position: position + '',
|
|
31
|
-
contentFormat: ((
|
|
32
|
-
traceInfo: (
|
|
30
|
+
contentFormat: ((_m = recData === null || recData === void 0 ? void 0 : recData.video) === null || _m === void 0 ? void 0 : _m.url) ? 'video' : 'image',
|
|
31
|
+
traceInfo: (_o = recData === null || recData === void 0 ? void 0 : recData.video) === null || _o === void 0 ? void 0 : _o.traceInfo
|
|
33
32
|
}
|
|
34
33
|
});
|
|
35
34
|
if (!result) {
|
|
36
35
|
setState(true);
|
|
37
36
|
}
|
|
38
37
|
else {
|
|
39
|
-
const nRtcList = (
|
|
38
|
+
const nRtcList = (_p = cacheRtcList === null || cacheRtcList === void 0 ? void 0 : cacheRtcList.map((item, index) => {
|
|
40
39
|
if (index === position) {
|
|
41
40
|
item.isCollected = false;
|
|
42
41
|
}
|
|
43
42
|
return item;
|
|
44
|
-
})) !== null &&
|
|
43
|
+
})) !== null && _p !== void 0 ? _p : [];
|
|
45
44
|
setCacheRtcList === null || setCacheRtcList === void 0 ? void 0 : setCacheRtcList(nRtcList);
|
|
46
45
|
}
|
|
47
46
|
}
|
|
48
47
|
else {
|
|
49
48
|
setState(true);
|
|
50
|
-
const result = (
|
|
49
|
+
const result = (_q = (yield (mutateLike === null || mutateLike === void 0 ? void 0 : mutateLike({ content: JSON.stringify(recData) })))) !== null && _q !== void 0 ? _q : false;
|
|
51
50
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
|
52
51
|
eventInfo: {
|
|
53
52
|
eventSubject: 'favoriteContent',
|
|
54
53
|
eventDescription: 'This content was favorite by the user',
|
|
55
|
-
contentId: (
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
contentTags: JSON.stringify((_4 = (_3 = recData === null || recData === void 0 ? void 0 : recData.video) === null || _3 === void 0 ? void 0 : _3.tags) !== null && _4 !== void 0 ? _4 : []),
|
|
54
|
+
contentId: (_s = (_r = recData === null || recData === void 0 ? void 0 : recData.video) === null || _r === void 0 ? void 0 : _r.itemId) !== null && _s !== void 0 ? _s : '',
|
|
55
|
+
contentName: (_u = (_t = recData === null || recData === void 0 ? void 0 : recData.video) === null || _t === void 0 ? void 0 : _t.title) !== null && _u !== void 0 ? _u : '',
|
|
56
|
+
contentTags: JSON.stringify((_w = (_v = recData === null || recData === void 0 ? void 0 : recData.video) === null || _v === void 0 ? void 0 : _v.tags) !== null && _w !== void 0 ? _w : []),
|
|
59
57
|
position: position + '',
|
|
60
|
-
contentFormat: ((
|
|
61
|
-
traceInfo: (
|
|
58
|
+
contentFormat: ((_x = recData === null || recData === void 0 ? void 0 : recData.video) === null || _x === void 0 ? void 0 : _x.url) ? 'video' : 'image',
|
|
59
|
+
traceInfo: (_y = recData === null || recData === void 0 ? void 0 : recData.video) === null || _y === void 0 ? void 0 : _y.traceInfo
|
|
62
60
|
}
|
|
63
61
|
});
|
|
64
62
|
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
|
65
63
|
eventName: 'Engagement',
|
|
66
|
-
product: (
|
|
64
|
+
product: (_z = recData === null || recData === void 0 ? void 0 : recData.video) === null || _z === void 0 ? void 0 : _z.bindProducts,
|
|
67
65
|
rec: recData,
|
|
68
66
|
position,
|
|
69
|
-
content_id: (
|
|
67
|
+
content_id: (_1 = (_0 = recData === null || recData === void 0 ? void 0 : recData.video) === null || _0 === void 0 ? void 0 : _0.itemId) !== null && _1 !== void 0 ? _1 : '',
|
|
70
68
|
engagement_type: 'like'
|
|
71
69
|
});
|
|
72
70
|
if (!result) {
|
|
73
71
|
setState(false);
|
|
74
72
|
}
|
|
75
73
|
else {
|
|
76
|
-
const nRtcList = (
|
|
74
|
+
const nRtcList = (_2 = cacheRtcList === null || cacheRtcList === void 0 ? void 0 : cacheRtcList.map((item, index) => {
|
|
77
75
|
if (index === position) {
|
|
78
76
|
item.isCollected = true;
|
|
79
77
|
}
|
|
80
78
|
return item;
|
|
81
|
-
})) !== null &&
|
|
79
|
+
})) !== null && _2 !== void 0 ? _2 : [];
|
|
82
80
|
setCacheRtcList === null || setCacheRtcList === void 0 ? void 0 : setCacheRtcList(nRtcList);
|
|
83
81
|
}
|
|
84
82
|
}
|
|
@@ -12,11 +12,6 @@ interface IPictureGroupProps {
|
|
|
12
12
|
loadTime: string;
|
|
13
13
|
}, enableCapi?: boolean) => void;
|
|
14
14
|
imgUrlsPostConfig?: postConfigType;
|
|
15
|
-
data: RecItemType[];
|
|
16
|
-
swiperRef?: any;
|
|
17
|
-
}
|
|
18
|
-
export interface IPictureGroupRef {
|
|
19
|
-
setLoopPlay: (v: boolean) => void;
|
|
20
15
|
}
|
|
21
16
|
declare const _default: React.NamedExoticComponent<IPictureGroupProps>;
|
|
22
17
|
export default _default;
|