pb-sxp-ui 1.15.22-alpha.5 → 1.15.23-alpha.1
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 +6690 -6621
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +46 -46
- package/dist/index.js +6690 -6621
- package/dist/index.js.map +1 -1
- package/dist/index.min.cjs +4 -4
- package/dist/index.min.cjs.map +1 -1
- package/dist/index.min.js +4 -4
- package/dist/index.min.js.map +1 -1
- package/dist/pb-ui.js +6690 -6621
- package/dist/pb-ui.js.map +1 -1
- package/dist/pb-ui.min.js +4 -4
- 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 +17 -15
- package/es/core/components/SxpPageRender/VideoWidget/index.js +20 -18
- package/es/core/components/SxpPageRender/WaterFall/index.js +4 -3
- package/es/core/components/SxpPageRender/index.d.ts +1 -0
- package/es/core/components/SxpPageRender/index.js +42 -33
- package/es/core/context/SxpDataSourceProvider.d.ts +1 -1
- package/es/core/context/SxpDataSourceProvider.js +95 -43
- package/es/core/hooks/useEventReport.js +6 -5
- package/es/materials/sxp/popup/CommodityDetail/index.js +2 -2
- package/es/materials/sxp/popup/CommodityDetailDiroNew/index.js +1 -1
- package/lib/core/components/DiyPortalPreview/VideoWidget.js +10 -8
- package/lib/core/components/SxpPageRender/LikeButton/index.js +17 -15
- package/lib/core/components/SxpPageRender/VideoWidget/index.js +20 -18
- package/lib/core/components/SxpPageRender/WaterFall/index.js +4 -3
- package/lib/core/components/SxpPageRender/index.d.ts +1 -0
- package/lib/core/components/SxpPageRender/index.js +42 -33
- package/lib/core/context/SxpDataSourceProvider.d.ts +1 -1
- package/lib/core/context/SxpDataSourceProvider.js +95 -43
- package/lib/core/hooks/useEventReport.js +6 -5
- package/lib/materials/sxp/popup/CommodityDetail/index.js +2 -2
- package/lib/materials/sxp/popup/CommodityDetailDiroNew/index.js +1 -1
- package/package.json +1 -1
@@ -105,6 +105,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
105
105
|
return ((_a = bffDataSource === null || bffDataSource === void 0 ? void 0 : bffDataSource.headers) === null || _a === void 0 ? void 0 : _a['x-app-id']) + storeAndLoadFeUserId();
|
106
106
|
}, [bffDataSource]);
|
107
107
|
const bffFetch = useCallback((path, options) => {
|
108
|
+
var _a, _b;
|
108
109
|
if (!bffDataSource)
|
109
110
|
return;
|
110
111
|
const url = bffDataSource.url;
|
@@ -112,7 +113,33 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
112
113
|
const queryString = qs.stringify(options.query);
|
113
114
|
path = `${path}?${queryString}`;
|
114
115
|
}
|
115
|
-
|
116
|
+
let isTikTokChannel = false;
|
117
|
+
const params = {};
|
118
|
+
const queryString = location.search.slice(1);
|
119
|
+
(_a = splitUrlParams(queryString)) === null || _a === void 0 ? void 0 : _a.forEach((val) => {
|
120
|
+
const key = val.split('=')[0];
|
121
|
+
const value = val.split('=')[1];
|
122
|
+
params[key] = value;
|
123
|
+
});
|
124
|
+
const cl_source = params === null || params === void 0 ? void 0 : params.cl_source;
|
125
|
+
if (cl_source &&
|
126
|
+
((_b = [
|
127
|
+
'40A-SPRK--DRESS_EYEWEAR-',
|
128
|
+
'41A-SPRK--MADRAGUE-',
|
129
|
+
'42A-SPRK--MOOD-',
|
130
|
+
'43A-SPRK--SUMMER-',
|
131
|
+
'44A-SPRK--DRESS_EYEWEAR-',
|
132
|
+
'45A-SPRK--MADRAGUE-',
|
133
|
+
'46A-SPRK--MOOD-',
|
134
|
+
'47A-SPRK--SUMMER-',
|
135
|
+
'48A-SPRK--DRESS_EYEWEAR-',
|
136
|
+
'49A-SPRK--MADRAGUE-',
|
137
|
+
'50A-SPRK--MOOD-',
|
138
|
+
'51A-SPRK--SUMMER-'
|
139
|
+
]) === null || _b === void 0 ? void 0 : _b.includes(cl_source))) {
|
140
|
+
isTikTokChannel = true;
|
141
|
+
}
|
142
|
+
if (options.type === 'beacon' && navigator.sendBeacon && !isTikTokChannel) {
|
116
143
|
return navigator.sendBeacon(`${url}/api/${path}`, new Blob([
|
117
144
|
JSON.stringify({
|
118
145
|
body: btoa(encodeURIComponent(JSON.stringify(Object.assign(Object.assign(Object.assign({}, options.body), bffDataSource.headers), { 'x-user-id': fakeUserId }))))
|
@@ -122,11 +149,11 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
122
149
|
}));
|
123
150
|
}
|
124
151
|
return window
|
125
|
-
.fetch(`${url}/api/${path}`, {
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
152
|
+
.fetch(`${url}/api/${path}`, Object.assign({ headers: Object.assign({ 'Content-Type': 'application/json', 'x-user-id': fakeUserId }, bffDataSource.headers), method: options.method, body: isTikTokChannel
|
153
|
+
? JSON.stringify({
|
154
|
+
body: btoa(encodeURIComponent(JSON.stringify(Object.assign(Object.assign(Object.assign({}, options.body), bffDataSource.headers), { 'x-user-id': fakeUserId }))))
|
155
|
+
})
|
156
|
+
: JSON.stringify(options.body) }, (isTikTokChannel && { keepalive: true })))
|
130
157
|
.then((res) => res.json())
|
131
158
|
.catch((err) => Promise.reject(err));
|
132
159
|
}, [bffDataSource, fakeUserId]);
|
@@ -291,23 +318,17 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
291
318
|
playbookType,
|
292
319
|
bffDataSource
|
293
320
|
]);
|
294
|
-
const
|
295
|
-
var _a, _b, _c
|
296
|
-
|
297
|
-
!enabledMetaConversionApi ||
|
298
|
-
(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview) ||
|
299
|
-
!((_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.converApi) === null || _a === void 0 ? void 0 : _a[eventName])) {
|
300
|
-
return;
|
301
|
-
}
|
302
|
-
const jsonParams = cloneDeep((_b = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.converApi) === null || _b === void 0 ? void 0 : _b[eventName]);
|
321
|
+
const getEventParamsByJson = useCallback((json, product) => {
|
322
|
+
var _a, _b, _c;
|
323
|
+
const jsonParams = cloneDeep(json);
|
303
324
|
const urlParams = new URLSearchParams(window.location.search);
|
304
325
|
const fbclid = urlParams === null || urlParams === void 0 ? void 0 : urlParams.get('fbclid');
|
305
326
|
const fix_par = {
|
306
|
-
event_source_url: (
|
327
|
+
event_source_url: (_a = window === null || window === void 0 ? void 0 : window.location) === null || _a === void 0 ? void 0 : _a.href,
|
307
328
|
external_id: fakeUserId,
|
308
|
-
client_user_agent: (
|
329
|
+
client_user_agent: (_c = (_b = window === null || window === void 0 ? void 0 : window.navigator) === null || _b === void 0 ? void 0 : _b.userAgent) !== null && _c !== void 0 ? _c : '',
|
309
330
|
fbc: fbclid ? `fb.2.${new Date().getTime()}.${fbclid}` : '',
|
310
|
-
fbp: getCookie('_fbp') ?
|
331
|
+
fbp: getCookie('_fbp') ? `${getCookie('_fbp')}` : '',
|
311
332
|
time: Math.floor(Date.now() / 1000)
|
312
333
|
};
|
313
334
|
const regex = /\{\{(.*?)\}\}/g;
|
@@ -319,7 +340,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
319
340
|
}
|
320
341
|
else {
|
321
342
|
for (const key in obj) {
|
322
|
-
if (
|
343
|
+
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
323
344
|
const value = obj === null || obj === void 0 ? void 0 : obj[key];
|
324
345
|
if (typeof value === 'object') {
|
325
346
|
getEventParams(value);
|
@@ -356,28 +377,59 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
356
377
|
}
|
357
378
|
};
|
358
379
|
getEventParams(jsonParams);
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
}
|
366
|
-
const
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
380
|
+
return jsonParams;
|
381
|
+
}, [fakeUserId]);
|
382
|
+
const bffFbReport = useCallback(({ eventName, product }) => {
|
383
|
+
var _a, _b, _c, _d;
|
384
|
+
if (!enableReportEvent || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview)) {
|
385
|
+
return;
|
386
|
+
}
|
387
|
+
const pixelEventParamsJson = (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.pixel) === null || _a === void 0 ? void 0 : _a[eventName];
|
388
|
+
if ((pixelEventParamsJson === null || pixelEventParamsJson === void 0 ? void 0 : pixelEventParamsJson.event_name) && typeof (window === null || window === void 0 ? void 0 : window.fbq) === 'function') {
|
389
|
+
function updateQueryStringParameter(uri, key, value) {
|
390
|
+
const re = new RegExp('([?&])' + key + '=.*?(&|$)', 'i');
|
391
|
+
const separator = uri.indexOf('?') !== -1 ? '&' : '?';
|
392
|
+
if (uri.match(re)) {
|
393
|
+
return uri.replace(re, '$1' + key + '=' + value + '$2');
|
394
|
+
}
|
395
|
+
else {
|
396
|
+
return uri + separator + key + '=' + value;
|
397
|
+
}
|
398
|
+
}
|
399
|
+
if (eventName === 'PageView' && (pixelEventParamsJson === null || pixelEventParamsJson === void 0 ? void 0 : pixelEventParamsJson.event_name) === 'PageView') {
|
400
|
+
const currentUrl = window.location.href;
|
401
|
+
const newUrl = updateQueryStringParameter(currentUrl, 'timestamp', Date.now());
|
402
|
+
history.pushState({ path: newUrl }, '', newUrl);
|
403
|
+
}
|
404
|
+
else {
|
405
|
+
const body = getEventParamsByJson(pixelEventParamsJson);
|
406
|
+
window === null || window === void 0 ? void 0 : window.fbq('track', pixelEventParamsJson === null || pixelEventParamsJson === void 0 ? void 0 : pixelEventParamsJson.event_name, body);
|
407
|
+
if (eventName === 'PageView' && typeof (window === null || window === void 0 ? void 0 : window.gtag) === 'function') {
|
408
|
+
window === null || window === void 0 ? void 0 : window.gtag('event', 'page_view');
|
409
|
+
}
|
410
|
+
}
|
411
|
+
}
|
412
|
+
else if (eventName === 'PageView' && typeof (window === null || window === void 0 ? void 0 : window.gtag) === 'function') {
|
413
|
+
window === null || window === void 0 ? void 0 : window.gtag('event', 'page_view');
|
414
|
+
}
|
415
|
+
const converApiEventParamsJson = (_b = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.converApi) === null || _b === void 0 ? void 0 : _b[eventName];
|
416
|
+
if (enabledMetaConversionApi && converApiEventParamsJson) {
|
417
|
+
const body = getEventParamsByJson(converApiEventParamsJson, product);
|
418
|
+
const params = {};
|
419
|
+
const queryString = location.search.slice(1);
|
420
|
+
(_c = splitUrlParams(queryString)) === null || _c === void 0 ? void 0 : _c.forEach((val) => {
|
421
|
+
const key = val.split('=')[0];
|
422
|
+
const value = val.split('=')[1];
|
423
|
+
params[key] = value;
|
424
|
+
});
|
425
|
+
const cl_source = params === null || params === void 0 ? void 0 : params.cl_source;
|
426
|
+
bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch(`v2/fb/${(_d = bffDataSource === null || bffDataSource === void 0 ? void 0 : bffDataSource.headers) === null || _d === void 0 ? void 0 : _d['x-app-id']}/${eventName}${cl_source ? `/${decodeURIComponent(cl_source)}` : ''}`, {
|
427
|
+
method: 'POST',
|
428
|
+
body,
|
429
|
+
type: 'beacon'
|
430
|
+
});
|
431
|
+
}
|
432
|
+
}, [bffFetch, enableReportEvent, enabledMetaConversionApi, globalConfig, bffDataSource, getEventParamsByJson]);
|
381
433
|
const bffMutateLike = useCallback((body) => __awaiter(void 0, void 0, void 0, function* () {
|
382
434
|
const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/recommend/like', { method: 'POST', body }));
|
383
435
|
return res === null || res === void 0 ? void 0 : res.success;
|
@@ -409,7 +461,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
409
461
|
}
|
410
462
|
}), [bffFetch, utmVal]);
|
411
463
|
const ctaEvent = useCallback((eventInfo, rec, product, position) => {
|
412
|
-
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;
|
464
|
+
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;
|
413
465
|
const cta = product === null || product === void 0 ? void 0 : product.bindCta;
|
414
466
|
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);
|
415
467
|
let fromKName = '';
|
@@ -427,7 +479,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
427
479
|
}
|
428
480
|
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;
|
429
481
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
430
|
-
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: (
|
482
|
+
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 })
|
431
483
|
});
|
432
484
|
}, [bffEventReport, isFromHashtag]);
|
433
485
|
const h5EnterLink = useCallback(() => {
|
@@ -1,10 +1,10 @@
|
|
1
1
|
import { useCallback } from 'react';
|
2
|
-
import { useSxpDataSource } from './useSxpDataSource';
|
3
2
|
import { DEFAULT_TAG } from '../context/SxpDataSourceProvider';
|
3
|
+
import { useSxpDataSource } from './useSxpDataSource';
|
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, _14, _15, _16;
|
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 : '', 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 }))
|
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, _q, _r, _s;
|
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,8 +60,9 @@ 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 : '',
|
63
64
|
ctatId: cta === null || cta === void 0 ? void 0 : cta.itemId,
|
64
|
-
traceInfo: (
|
65
|
+
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 : '',
|
65
66
|
timeOnSite: Math.floor((new Date() - viewTime) / 1000) + '',
|
66
67
|
eventSubject: 'productView',
|
67
68
|
eventDescription: 'User browsed the product'
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { __rest } from "tslib";
|
2
2
|
import { css } from '@emotion/css';
|
3
3
|
import React, { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
4
|
+
import CommodityGroup from '../../template/components/CommodityGroup';
|
4
5
|
import { useSxpDataSource } from '../../../../core/hooks';
|
5
6
|
import './index.less';
|
6
7
|
import { A11y, Autoplay, Keyboard, Mousewheel, Navigation, Pagination } from 'swiper/modules';
|
@@ -10,7 +11,6 @@ import Modal from '../../../../core/components/SxpPageRender/Modal';
|
|
10
11
|
import ExpandableText from '../../../../core/components/SxpPageRender/ExpandableText';
|
11
12
|
import FormatImage from '../../../../core/components/SxpPageRender/FormatImage';
|
12
13
|
import { getScreenReader, setFontForText } from '../../../../core/utils/tool';
|
13
|
-
import CommodityGroup from '../../template/components/CommodityGroup';
|
14
14
|
import { getPriceText } from '../../../../core/utils/materials';
|
15
15
|
const CommodityDetail = (_a) => {
|
16
16
|
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
|
@@ -67,7 +67,7 @@ const CommodityDetail = (_a) => {
|
|
67
67
|
};
|
68
68
|
}, []);
|
69
69
|
const priceText = getPriceText({
|
70
|
-
product
|
70
|
+
product,
|
71
71
|
enableFormattedPrice: (_t = commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price) === null || _t === void 0 ? void 0 : _t.enableFormattedPrice,
|
72
72
|
globalConfig,
|
73
73
|
style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { __rest } from "tslib";
|
2
2
|
import { css } from '@emotion/css';
|
3
3
|
import React, { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
4
|
+
import CommodityGroup from '../../template/components/CommodityGroup';
|
4
5
|
import { useSxpDataSource } from '../../../../core/hooks';
|
5
6
|
import './index.less';
|
6
7
|
import { Autoplay, Pagination, Navigation, A11y, Mousewheel, Keyboard } from 'swiper/modules';
|
@@ -10,7 +11,6 @@ import ExpandableText from '../../../../core/components/SxpPageRender/Expandable
|
|
10
11
|
import { useEventReport } from '../../../../core/hooks/useEventReport';
|
11
12
|
import FormatImage from '../../../../core/components/SxpPageRender/FormatImage';
|
12
13
|
import { getScreenReader, setFontForText } from '../../../../core/utils/tool';
|
13
|
-
import CommodityGroup from '../../template/components/CommodityGroup';
|
14
14
|
import { getPriceText } from '../../../../core/utils/materials';
|
15
15
|
const CommodityDetailDiroNew = (_a) => {
|
16
16
|
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4;
|
@@ -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, _p, _q, _r;
|
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,14 +38,15 @@ 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
|
-
|
41
|
+
sceneId: (_l = (_k = (_j = item === null || item === void 0 ? void 0 : item.video) === null || _j === void 0 ? void 0 : _j.scene) === null || _k === void 0 ? void 0 : _k.sceneId) !== null && _l !== void 0 ? _l : '',
|
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 : '',
|
42
43
|
playType,
|
43
44
|
startTime: videoCurrentTime,
|
44
45
|
videoDuration,
|
45
|
-
contentTags: JSON.stringify((
|
46
|
+
contentTags: JSON.stringify((_q = (_p = item === null || item === void 0 ? void 0 : item.video) === null || _p === void 0 ? void 0 : _p.tags) !== null && _q !== void 0 ? _q : []),
|
46
47
|
position: index + '',
|
47
48
|
contentFormat: 'video',
|
48
|
-
traceInfo: (
|
49
|
+
traceInfo: (_r = item === null || item === void 0 ? void 0 : item.video) === null || _r === void 0 ? void 0 : _r.traceInfo
|
49
50
|
}
|
50
51
|
});
|
51
52
|
setIsFirstPlay(false);
|
@@ -84,7 +85,7 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
84
85
|
}
|
85
86
|
}, [isLoadFinish]);
|
86
87
|
const onPause = (0, react_1.useCallback)(() => {
|
87
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
88
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
88
89
|
const item = data[index];
|
89
90
|
const videoDuration = ((_b = (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.duration) !== null && _b !== void 0 ? _b : 0).toFixed(2);
|
90
91
|
const videoCurrentTime = ((_d = (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.currentTime) !== null && _d !== void 0 ? _d : 0).toFixed(2);
|
@@ -95,14 +96,15 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
95
96
|
eventSubject: 'playOverVideo',
|
96
97
|
eventDescription: 'User finished playing the video',
|
97
98
|
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 : '',
|
98
|
-
|
99
|
+
sceneId: (_l = (_k = (_j = item === null || item === void 0 ? void 0 : item.video) === null || _j === void 0 ? void 0 : _j.scene) === null || _k === void 0 ? void 0 : _k.sceneId) !== null && _l !== void 0 ? _l : '',
|
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 : '',
|
99
101
|
endTime: videoCurrentTime,
|
100
102
|
videoDuration,
|
101
103
|
playDuration,
|
102
|
-
contentTags: JSON.stringify((
|
104
|
+
contentTags: JSON.stringify((_q = (_p = item === null || item === void 0 ? void 0 : item.video) === null || _p === void 0 ? void 0 : _p.tags) !== null && _q !== void 0 ? _q : []),
|
103
105
|
position: index + '',
|
104
106
|
contentFormat: 'video',
|
105
|
-
traceInfo: (
|
107
|
+
traceInfo: (_r = item === null || item === void 0 ? void 0 : item.video) === null || _r === void 0 ? void 0 : _r.traceInfo
|
106
108
|
}
|
107
109
|
});
|
108
110
|
}
|
@@ -15,7 +15,7 @@ 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;
|
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, _3, _4, _5;
|
19
19
|
if (state) {
|
20
20
|
setState(false);
|
21
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;
|
@@ -24,51 +24,53 @@ const LikeButton = (_a) => {
|
|
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
|
-
|
27
|
+
sceneId: (_k = (_j = (_h = recData === null || recData === void 0 ? void 0 : recData.video) === null || _h === void 0 ? void 0 : _h.scene) === null || _j === void 0 ? void 0 : _j.sceneId) !== null && _k !== void 0 ? _k : '',
|
28
|
+
contentName: (_m = (_l = recData === null || recData === void 0 ? void 0 : recData.video) === null || _l === void 0 ? void 0 : _l.title) !== null && _m !== void 0 ? _m : '',
|
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 : []),
|
29
30
|
position: position + '',
|
30
|
-
contentFormat: ((
|
31
|
-
traceInfo: (
|
31
|
+
contentFormat: ((_q = recData === null || recData === void 0 ? void 0 : recData.video) === null || _q === void 0 ? void 0 : _q.url) ? 'video' : 'image',
|
32
|
+
traceInfo: (_r = recData === null || recData === void 0 ? void 0 : recData.video) === null || _r === void 0 ? void 0 : _r.traceInfo
|
32
33
|
}
|
33
34
|
});
|
34
35
|
if (!result) {
|
35
36
|
setState(true);
|
36
37
|
}
|
37
38
|
else {
|
38
|
-
const nRtcList = (
|
39
|
+
const nRtcList = (_s = cacheRtcList === null || cacheRtcList === void 0 ? void 0 : cacheRtcList.map((item, index) => {
|
39
40
|
if (index === position) {
|
40
41
|
item.isCollected = false;
|
41
42
|
}
|
42
43
|
return item;
|
43
|
-
})) !== null &&
|
44
|
+
})) !== null && _s !== void 0 ? _s : [];
|
44
45
|
setCacheRtcList === null || setCacheRtcList === void 0 ? void 0 : setCacheRtcList(nRtcList);
|
45
46
|
}
|
46
47
|
}
|
47
48
|
else {
|
48
49
|
setState(true);
|
49
|
-
const result = (
|
50
|
+
const result = (_t = (yield (mutateLike === null || mutateLike === void 0 ? void 0 : mutateLike({ content: JSON.stringify(recData) })))) !== null && _t !== void 0 ? _t : false;
|
50
51
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
51
52
|
eventInfo: {
|
52
53
|
eventSubject: 'favoriteContent',
|
53
54
|
eventDescription: 'This content was favorite by the user',
|
54
|
-
contentId: (
|
55
|
-
|
56
|
-
|
55
|
+
contentId: (_v = (_u = recData === null || recData === void 0 ? void 0 : recData.video) === null || _u === void 0 ? void 0 : _u.itemId) !== null && _v !== void 0 ? _v : '',
|
56
|
+
sceneId: (_y = (_x = (_w = recData === null || recData === void 0 ? void 0 : recData.video) === null || _w === void 0 ? void 0 : _w.scene) === null || _x === void 0 ? void 0 : _x.sceneId) !== null && _y !== void 0 ? _y : '',
|
57
|
+
contentName: (_0 = (_z = recData === null || recData === void 0 ? void 0 : recData.video) === null || _z === void 0 ? void 0 : _z.title) !== null && _0 !== void 0 ? _0 : '',
|
58
|
+
contentTags: JSON.stringify((_2 = (_1 = recData === null || recData === void 0 ? void 0 : recData.video) === null || _1 === void 0 ? void 0 : _1.tags) !== null && _2 !== void 0 ? _2 : []),
|
57
59
|
position: position + '',
|
58
|
-
contentFormat: ((
|
59
|
-
traceInfo: (
|
60
|
+
contentFormat: ((_3 = recData === null || recData === void 0 ? void 0 : recData.video) === null || _3 === void 0 ? void 0 : _3.url) ? 'video' : 'image',
|
61
|
+
traceInfo: (_4 = recData === null || recData === void 0 ? void 0 : recData.video) === null || _4 === void 0 ? void 0 : _4.traceInfo
|
60
62
|
}
|
61
63
|
});
|
62
64
|
if (!result) {
|
63
65
|
setState(false);
|
64
66
|
}
|
65
67
|
else {
|
66
|
-
const nRtcList = (
|
68
|
+
const nRtcList = (_5 = cacheRtcList === null || cacheRtcList === void 0 ? void 0 : cacheRtcList.map((item, index) => {
|
67
69
|
if (index === position) {
|
68
70
|
item.isCollected = true;
|
69
71
|
}
|
70
72
|
return item;
|
71
|
-
})) !== null &&
|
73
|
+
})) !== null && _5 !== void 0 ? _5 : [];
|
72
74
|
setCacheRtcList === null || setCacheRtcList === void 0 ? void 0 : setCacheRtcList(nRtcList);
|
73
75
|
}
|
74
76
|
}
|
@@ -86,7 +86,7 @@ const VideoWidget = (0, react_1.forwardRef)(({ rec, index, height, data, muted,
|
|
86
86
|
setIsLoadFinish(true);
|
87
87
|
}, []);
|
88
88
|
const handleStartPlay = (0, react_1.useCallback)(() => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
89
|
-
var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
89
|
+
var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
90
90
|
if (!(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current))
|
91
91
|
return;
|
92
92
|
setIsPauseVideo(false);
|
@@ -97,14 +97,15 @@ const VideoWidget = (0, react_1.forwardRef)(({ rec, index, height, data, muted,
|
|
97
97
|
const videoCurrentTime = ((_h = (_g = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _g === void 0 ? void 0 : _g.currentTime) !== null && _h !== void 0 ? _h : 0).toFixed(2);
|
98
98
|
const playType = (isFirstPlayRef === null || isFirstPlayRef === void 0 ? void 0 : isFirstPlayRef.current) ? '0' : '1';
|
99
99
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
100
|
-
eventInfo: Object.assign({ eventSubject: 'playVideo', eventDescription: 'User played the video', contentId: (_k = (_j = item === null || item === void 0 ? void 0 : item.video) === null || _j === void 0 ? void 0 : _j.itemId) !== null && _k !== void 0 ? _k : '',
|
100
|
+
eventInfo: Object.assign({ eventSubject: 'playVideo', eventDescription: 'User played the video', contentId: (_k = (_j = item === null || item === void 0 ? void 0 : item.video) === null || _j === void 0 ? void 0 : _j.itemId) !== null && _k !== void 0 ? _k : '', sceneId: (_o = (_m = (_l = item === null || item === void 0 ? void 0 : item.video) === null || _l === void 0 ? void 0 : _l.scene) === null || _m === void 0 ? void 0 : _m.sceneId) !== null && _o !== void 0 ? _o : '', contentName: (_q = (_p = item === null || item === void 0 ? void 0 : item.video) === null || _p === void 0 ? void 0 : _p.title) !== null && _q !== void 0 ? _q : '', playType, startTime: videoCurrentTime, videoDuration, contentTags: JSON.stringify((_s = (_r = item === null || item === void 0 ? void 0 : item.video) === null || _r === void 0 ? void 0 : _r.tags) !== null && _s !== void 0 ? _s : []), position: index + '', contentFormat: 'video', traceInfo: (_t = item === null || item === void 0 ? void 0 : item.video) === null || _t === void 0 ? void 0 : _t.traceInfo }, ((isFirstPlayRef === null || isFirstPlayRef === void 0 ? void 0 : isFirstPlayRef.current) && { loadTime: (loadedTimeRef === null || loadedTimeRef === void 0 ? void 0 : loadedTimeRef.current) - (initTimeRef === null || initTimeRef === void 0 ? void 0 : initTimeRef.current) + '' }))
|
101
101
|
});
|
102
102
|
isFirstPlayRef.current = false;
|
103
103
|
}
|
104
104
|
}), [bffEventReport, data, index, isFirstPlayRef, videoRef === null || videoRef === void 0 ? void 0 : videoRef.current]);
|
105
105
|
const setCurrentTimeByStartTime = (0, react_1.useCallback)(() => {
|
106
|
+
var _a;
|
106
107
|
if (isDiyH5) {
|
107
|
-
videoRef.current.currentTime = scene === null || scene === void 0 ? void 0 : scene.startTime;
|
108
|
+
videoRef.current.currentTime = (_a = scene === null || scene === void 0 ? void 0 : scene.startTime) !== null && _a !== void 0 ? _a : 0;
|
108
109
|
}
|
109
110
|
}, []);
|
110
111
|
const handLoadeddata = (0, react_1.useCallback)(() => {
|
@@ -137,7 +138,7 @@ const VideoWidget = (0, react_1.forwardRef)(({ rec, index, height, data, muted,
|
|
137
138
|
handLoadeddata();
|
138
139
|
}, [videoRef.current, handLoadeddata, handleStartPlay]);
|
139
140
|
const handleClickVideo = (0, react_1.useCallback)((type) => () => {
|
140
|
-
var _a, _b, _c, _d, _e, _f;
|
141
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
141
142
|
if (!videoRef.current)
|
142
143
|
return;
|
143
144
|
if (!isLoadFinish)
|
@@ -158,20 +159,20 @@ const VideoWidget = (0, react_1.forwardRef)(({ rec, index, height, data, muted,
|
|
158
159
|
break;
|
159
160
|
default:
|
160
161
|
if (isPause) {
|
161
|
-
if (
|
162
|
-
|
162
|
+
if (Math.round((_d = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _d === void 0 ? void 0 : _d.currentTime) >= ((_e = scene === null || scene === void 0 ? void 0 : scene.endTime) !== null && _e !== void 0 ? _e : (_f = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _f === void 0 ? void 0 : _f.duration)) {
|
163
|
+
setCurrentTimeByStartTime();
|
163
164
|
}
|
164
|
-
(
|
165
|
+
(_g = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _g === void 0 ? void 0 : _g.play();
|
165
166
|
}
|
166
167
|
else {
|
167
|
-
(
|
168
|
+
(_h = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _h === void 0 ? void 0 : _h.pause();
|
168
169
|
}
|
169
170
|
setIsPauseVideo(!isPause);
|
170
171
|
break;
|
171
172
|
}
|
172
173
|
}, [isLoadFinish, videoRef === null || videoRef === void 0 ? void 0 : videoRef.current]);
|
173
174
|
const handlePause = (0, react_1.useCallback)(() => {
|
174
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
175
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
175
176
|
if (!(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current))
|
176
177
|
return;
|
177
178
|
if (activeIndex !== index)
|
@@ -187,14 +188,15 @@ const VideoWidget = (0, react_1.forwardRef)(({ rec, index, height, data, muted,
|
|
187
188
|
eventSubject: 'playOverVideo',
|
188
189
|
eventDescription: 'User finished playing the video',
|
189
190
|
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 : '',
|
190
|
-
|
191
|
+
sceneId: (_l = (_k = (_j = item === null || item === void 0 ? void 0 : item.video) === null || _j === void 0 ? void 0 : _j.scene) === null || _k === void 0 ? void 0 : _k.sceneId) !== null && _l !== void 0 ? _l : '',
|
192
|
+
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 : '',
|
191
193
|
endTime: videoCurrentTime,
|
192
194
|
videoDuration,
|
193
195
|
playDuration,
|
194
|
-
contentTags: JSON.stringify((
|
196
|
+
contentTags: JSON.stringify((_q = (_p = item === null || item === void 0 ? void 0 : item.video) === null || _p === void 0 ? void 0 : _p.tags) !== null && _q !== void 0 ? _q : []),
|
195
197
|
position: index + '',
|
196
198
|
contentFormat: 'video',
|
197
|
-
traceInfo: (
|
199
|
+
traceInfo: (_r = item === null || item === void 0 ? void 0 : item.video) === null || _r === void 0 ? void 0 : _r.traceInfo
|
198
200
|
}
|
199
201
|
});
|
200
202
|
}
|
@@ -206,17 +208,17 @@ const VideoWidget = (0, react_1.forwardRef)(({ rec, index, height, data, muted,
|
|
206
208
|
if (!videoRef.current || !isDiyH5)
|
207
209
|
return;
|
208
210
|
setTimeout(() => {
|
209
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
210
|
-
if (Math.round((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.currentTime) >= ((_b = scene === null || scene === void 0 ? void 0 : scene.endTime) !== null && _b !== void 0 ? _b : 0)) {
|
211
|
-
(
|
211
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
212
|
+
if (Math.round((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.currentTime) >= ((_b = scene === null || scene === void 0 ? void 0 : scene.endTime) !== null && _b !== void 0 ? _b : (_c = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _c === void 0 ? void 0 : _c.duration)) {
|
213
|
+
(_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.pause();
|
212
214
|
if (!loopPlayRef.current)
|
213
215
|
return;
|
214
216
|
if (index === (data === null || data === void 0 ? void 0 : data.length) - 1) {
|
215
|
-
(
|
217
|
+
(_f = (_e = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _e === void 0 ? void 0 : _e.swiper) === null || _f === void 0 ? void 0 : _f.slideTo(0);
|
216
218
|
}
|
217
219
|
else {
|
218
|
-
const i = (
|
219
|
-
(
|
220
|
+
const i = (_h = (_g = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _g === void 0 ? void 0 : _g.swiper) === null || _h === void 0 ? void 0 : _h.activeIndex;
|
221
|
+
(_k = (_j = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _j === void 0 ? void 0 : _j.swiper) === null || _k === void 0 ? void 0 : _k.slideTo(i + 1);
|
220
222
|
}
|
221
223
|
}
|
222
224
|
});
|
@@ -44,7 +44,7 @@ const WaterFall = (props) => {
|
|
44
44
|
}
|
45
45
|
}, [waterFallData]);
|
46
46
|
const reportTagsView = (0, react_1.useCallback)(() => {
|
47
|
-
var _a, _b, _c, _d, _e, _f;
|
47
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
48
48
|
const rec = recData === null || recData === void 0 ? void 0 : recData.rec;
|
49
49
|
if (!rec)
|
50
50
|
return;
|
@@ -64,9 +64,10 @@ const WaterFall = (props) => {
|
|
64
64
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
65
65
|
eventInfo: {
|
66
66
|
contentId: (_d = rec === null || rec === void 0 ? void 0 : rec.video) === null || _d === void 0 ? void 0 : _d.itemId,
|
67
|
+
sceneId: (_g = (_f = (_e = rec === null || rec === void 0 ? void 0 : rec.video) === null || _e === void 0 ? void 0 : _e.scene) === null || _f === void 0 ? void 0 : _f.sceneId) !== null && _g !== void 0 ? _g : '',
|
67
68
|
position: cacheActiveIndex + '',
|
68
|
-
contentTags: JSON.stringify((
|
69
|
-
traceInfo: (
|
69
|
+
contentTags: JSON.stringify((_h = rec === null || rec === void 0 ? void 0 : rec.video) === null || _h === void 0 ? void 0 : _h.tags),
|
70
|
+
traceInfo: (_j = rec === null || rec === void 0 ? void 0 : rec.video) === null || _j === void 0 ? void 0 : _j.traceInfo,
|
70
71
|
hashTags: JSON.stringify([recData === null || recData === void 0 ? void 0 : recData.hashTag]),
|
71
72
|
fromKName,
|
72
73
|
fromKPage: location === null || location === void 0 ? void 0 : location.href,
|