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
@@ -92,7 +92,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
92
92
|
(_a = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _a === void 0 ? void 0 : _a.swiper.slideTo(index);
|
93
93
|
}, [data, ctaType, swiperRef]);
|
94
94
|
const handleSessionCompleted = (0, react_1.useCallback)((fk) => {
|
95
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
|
95
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
|
96
96
|
const item = data === null || data === void 0 ? void 0 : data[activeIndex];
|
97
97
|
let fromKName = '';
|
98
98
|
if (popupDetailData && (((_b = (_a = item === null || item === void 0 ? void 0 : item.video) === null || _a === void 0 ? void 0 : _a.bindProducts) === null || _b === void 0 ? void 0 : _b.length) || ((_c = item === null || item === void 0 ? void 0 : item.video) === null || _c === void 0 ? void 0 : _c.bindProduct))) {
|
@@ -119,12 +119,13 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
119
119
|
eventSubject: 'sessionCompleted',
|
120
120
|
eventDescription: 'Session completed',
|
121
121
|
contentId: (_m = item === null || item === void 0 ? void 0 : item.video) === null || _m === void 0 ? void 0 : _m.itemId,
|
122
|
-
|
122
|
+
sceneId: (_q = (_p = (_o = item === null || item === void 0 ? void 0 : item.video) === null || _o === void 0 ? void 0 : _o.scene) === null || _p === void 0 ? void 0 : _p.sceneId) !== null && _q !== void 0 ? _q : '',
|
123
|
+
productId: (_r = item === null || item === void 0 ? void 0 : item.product) === null || _r === void 0 ? void 0 : _r.itemId,
|
123
124
|
position: activeIndex + '',
|
124
125
|
fromKName: fk || fromKName,
|
125
126
|
fromKPage: location === null || location === void 0 ? void 0 : location.href,
|
126
|
-
ctatId: (
|
127
|
-
traceInfo: (
|
127
|
+
ctatId: (_u = (_t = (_s = item === null || item === void 0 ? void 0 : item.video) === null || _s === void 0 ? void 0 : _s.bindCta) === null || _t === void 0 ? void 0 : _t.itemId) !== null && _u !== void 0 ? _u : '',
|
128
|
+
traceInfo: (_y = (_w = (_v = item === null || item === void 0 ? void 0 : item.video) === null || _v === void 0 ? void 0 : _v.traceInfo) !== null && _w !== void 0 ? _w : (_x = item === null || item === void 0 ? void 0 : item.product) === null || _x === void 0 ? void 0 : _x.traceInfo) !== null && _y !== void 0 ? _y : ''
|
128
129
|
}
|
129
130
|
});
|
130
131
|
}, [data, bffEventReport, activeIndex, popupDetailData, tempMap, isFromHashtag, curTime]);
|
@@ -251,18 +252,18 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
251
252
|
return null;
|
252
253
|
}, [globalConfig, activeIndex, visList]);
|
253
254
|
const renderContent = (0, react_1.useCallback)((rec, index) => {
|
254
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
255
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
255
256
|
if (rec === 'organic menu') {
|
256
257
|
return (react_1.default.createElement(MultiPosts_1.default, Object.assign({ recData: data === null || data === void 0 ? void 0 : data[1] }, (_c = (_b = (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.multiPosts) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.item) === null || _c === void 0 ? void 0 : _c.props, (_f = (_e = (_d = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.multiPosts) === null || _d === void 0 ? void 0 : _d[0]) === null || _e === void 0 ? void 0 : _e.item) === null || _f === void 0 ? void 0 : _f.event)));
|
257
258
|
}
|
258
|
-
if ((_g = rec === null || rec === void 0 ? void 0 : rec.video) === null ||
|
259
|
+
if (((_h = (_g = rec.video) === null || _g === void 0 ? void 0 : _g.scene) === null || _h === void 0 ? void 0 : _h.mediaUrl) || ((_j = rec === null || rec === void 0 ? void 0 : rec.video) === null || _j === void 0 ? void 0 : _j.url)) {
|
259
260
|
return (react_1.default.createElement(VideoWidget_1.default, Object.assign({ key: isReload }, (activeIndex === index && { ref: videoWidgetRef }), { rec: rec, index: index, muted: isMuted, data: data, height: height, activeIndex: activeIndex, videoPostConfig: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.videoPost, videoPlayIcon: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.videoPlayIcon, loopPlay: true, swiperRef: swiperRef })));
|
260
261
|
}
|
261
|
-
if ((
|
262
|
+
if ((_k = rec === null || rec === void 0 ? void 0 : rec.video) === null || _k === void 0 ? void 0 : _k.imgUrls) {
|
262
263
|
return (react_1.default.createElement(PictureGroup_1.default, { key: rec === null || rec === void 0 ? void 0 : rec.video.itemId, imgUrls: rec === null || rec === void 0 ? void 0 : rec.video.imgUrls, width: containerWidth, height: height, rec: rec, index: index, onViewImageEndEvent: handleViewImageStartEnd, onViewImageStartEvent: handleViewImageStartEvent, imgUrlsPostConfig: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.imgUrlsPost }));
|
263
264
|
}
|
264
|
-
if (rec.product && Array.isArray(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.productPost) && ((
|
265
|
-
return (
|
265
|
+
if (rec.product && Array.isArray(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.productPost) && ((_l = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.productPost) === null || _l === void 0 ? void 0 : _l.length) > 0) {
|
266
|
+
return (_m = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.productPost) === null || _m === void 0 ? void 0 : _m.map((value, idx) => {
|
266
267
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
267
268
|
const t = resolver[(_a = value === null || value === void 0 ? void 0 : value.item) === null || _a === void 0 ? void 0 : _a.type];
|
268
269
|
const Component = (0, withBindDataSource_1.default)(t);
|
@@ -300,7 +301,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
300
301
|
};
|
301
302
|
}, [isShowMore]);
|
302
303
|
const renderBottom = (0, react_1.useCallback)((rec, index) => {
|
303
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
304
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
304
305
|
if (rec === null || rec === void 0 ? void 0 : rec.video) {
|
305
306
|
let cta = null;
|
306
307
|
if ((_b = (_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.bindProducts) === null || _b === void 0 ? void 0 : _b.length) {
|
@@ -309,20 +310,23 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
309
310
|
else if ((_c = rec === null || rec === void 0 ? void 0 : rec.video) === null || _c === void 0 ? void 0 : _c.bindProduct) {
|
310
311
|
cta = '商品CTA';
|
311
312
|
}
|
313
|
+
else if (tempMap && ((_d = Object.keys(tempMap)) === null || _d === void 0 ? void 0 : _d.includes('服务CTA')) && ((_f = (_e = rec === null || rec === void 0 ? void 0 : rec.video) === null || _e === void 0 ? void 0 : _e.bindCta) === null || _f === void 0 ? void 0 : _f.itemId)) {
|
314
|
+
cta = '服务CTA';
|
315
|
+
}
|
312
316
|
else {
|
313
|
-
cta = (
|
317
|
+
cta = (_h = (_g = rec === null || rec === void 0 ? void 0 : rec.video) === null || _g === void 0 ? void 0 : _g.bindCta) === null || _h === void 0 ? void 0 : _h.itemId;
|
314
318
|
}
|
315
319
|
const value = tempMap === null || tempMap === void 0 ? void 0 : tempMap[cta];
|
316
320
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
317
|
-
((
|
318
|
-
react_1.default.createElement("div", { className: 'clc-sxp-bottom', style: { marginBottom: `${(
|
321
|
+
((_j = rec === null || rec === void 0 ? void 0 : rec.video) === null || _j === void 0 ? void 0 : _j.title) && !isShowMore && react_1.default.createElement("div", { className: 'clc-sxp-bottom-shadow' }),
|
322
|
+
react_1.default.createElement("div", { className: 'clc-sxp-bottom', style: { marginBottom: `${(_k = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.bottomInfoDist) !== null && _k !== void 0 ? _k : 40}px` } },
|
319
323
|
react_1.default.createElement(Nudge_1.default, { nudge: nudge }),
|
320
324
|
(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowCTA) === undefined || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowCTA) ? (react_1.default.createElement("div", { className: 'clc-sxp-bottom-card' },
|
321
325
|
react_1.default.createElement(RenderCard_1.default, { rec: rec, index: index, tempMap: tempMap, resolver: resolver, isActive: index === activeIndex, value: value }))) : null,
|
322
326
|
react_1.default.createElement("div", null,
|
323
|
-
react_1.default.createElement(ExpandableText_1.default, { className: 'clc-sxp-bottom-text', isPost: true, foldText: tipText === null || tipText === void 0 ? void 0 : tipText.foldText, unfoldText: tipText === null || tipText === void 0 ? void 0 : tipText.unfoldText, text: (
|
327
|
+
react_1.default.createElement(ExpandableText_1.default, { className: 'clc-sxp-bottom-text', isPost: true, foldText: tipText === null || tipText === void 0 ? void 0 : tipText.foldText, unfoldText: tipText === null || tipText === void 0 ? void 0 : tipText.unfoldText, text: (_m = (_l = rec === null || rec === void 0 ? void 0 : rec.video) === null || _l === void 0 ? void 0 : _l.title) !== null && _m !== void 0 ? _m : '', style: Object.assign(Object.assign({}, descStyle), { textShadow: (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isOpenTextShadow) ? '2px 2px 4px rgba(0, 0, 0, 0.5)' : 'none' }), onChange: onExpandableChange }),
|
324
328
|
react_1.default.createElement(RenderCard_1.default, { rec: rec, index: index, tempMap: tempMap, resolver: resolver, includesCtaType: ['AniLink'], isActive: index === activeIndex, value: value }),
|
325
|
-
react_1.default.createElement(Hashtag_1.default, { index: activeIndex, tags: (
|
329
|
+
react_1.default.createElement(Hashtag_1.default, { index: activeIndex, tags: (_p = (_o = rec === null || rec === void 0 ? void 0 : rec.video) === null || _o === void 0 ? void 0 : _o.hashTags) !== null && _p !== void 0 ? _p : [], itemId: (_q = rec === null || rec === void 0 ? void 0 : rec.video) === null || _q === void 0 ? void 0 : _q.itemId, itemType: ((_r = rec === null || rec === void 0 ? void 0 : rec.video) === null || _r === void 0 ? void 0 : _r.itemId) ? 'VIDEO' : null, rec: rec, hashTagStyle: hashTagStyle, hashTagRightMargin: containerWidth - (hashTagRightMargin !== null && hashTagRightMargin !== void 0 ? hashTagRightMargin : 0) }))),
|
326
330
|
react_1.default.createElement(RenderCard_1.default, { rec: rec, index: index, tempMap: tempMap, resolver: resolver, includesCtaType: ['AniLinkPopup'], isActive: index === activeIndex, value: value })));
|
327
331
|
}
|
328
332
|
return null;
|
@@ -360,7 +364,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
360
364
|
return null;
|
361
365
|
}, [globalConfig, waterFallData]);
|
362
366
|
const handleViewImageStartEnd = (item) => {
|
363
|
-
var _a, _b, _c, _d, _e, _f;
|
367
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
364
368
|
if (!((_a = item === null || item === void 0 ? void 0 : item.video) === null || _a === void 0 ? void 0 : _a.url) && ((_b = item === null || item === void 0 ? void 0 : item.video) === null || _b === void 0 ? void 0 : _b.imgUrls)) {
|
365
369
|
const endTime = Date.now();
|
366
370
|
const duration = viewImageStartTime.current === 0 ? 0 : (endTime - viewImageStartTime.current) / 1000;
|
@@ -369,10 +373,11 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
369
373
|
eventSubject: 'viewImageCarouselEnd',
|
370
374
|
eventDescription: 'User end view the image carousel',
|
371
375
|
contentId: (_d = (_c = item === null || item === void 0 ? void 0 : item.video) === null || _c === void 0 ? void 0 : _c.itemId) !== null && _d !== void 0 ? _d : '',
|
372
|
-
|
376
|
+
sceneId: (_g = (_f = (_e = item === null || item === void 0 ? void 0 : item.video) === null || _e === void 0 ? void 0 : _e.scene) === null || _f === void 0 ? void 0 : _f.sceneId) !== null && _g !== void 0 ? _g : '',
|
377
|
+
contentName: (_h = item === null || item === void 0 ? void 0 : item.video.title) !== null && _h !== void 0 ? _h : '',
|
373
378
|
imageEndTime: `${endTime}`,
|
374
379
|
playDuration: `${duration}`,
|
375
|
-
contentTags: JSON.stringify((
|
380
|
+
contentTags: JSON.stringify((_j = item === null || item === void 0 ? void 0 : item.video.tags) !== null && _j !== void 0 ? _j : []),
|
376
381
|
position: activeIndex + '',
|
377
382
|
contentFormat: 'image',
|
378
383
|
traceInfo: item === null || item === void 0 ? void 0 : item.video.traceInfo
|
@@ -381,7 +386,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
381
386
|
}
|
382
387
|
};
|
383
388
|
const handleSlideSkip = (item, position) => {
|
384
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
|
389
|
+
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;
|
385
390
|
if (isPreview || waterFallData)
|
386
391
|
return;
|
387
392
|
const t = new Date() - curTime.current;
|
@@ -407,7 +412,8 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
407
412
|
contentTags: (product === null || product === void 0 ? void 0 : product.tags) ? JSON.stringify(product === null || product === void 0 ? void 0 : product.tags) : '',
|
408
413
|
position: position + '',
|
409
414
|
contentId: (_t = (_s = item === null || item === void 0 ? void 0 : item.video) === null || _s === void 0 ? void 0 : _s.itemId) !== null && _t !== void 0 ? _t : '',
|
410
|
-
|
415
|
+
sceneId: (_w = (_v = (_u = item === null || item === void 0 ? void 0 : item.video) === null || _u === void 0 ? void 0 : _u.scene) === null || _v === void 0 ? void 0 : _v.sceneId) !== null && _w !== void 0 ? _w : '',
|
416
|
+
traceInfo: (_0 = (_y = (_x = item === null || item === void 0 ? void 0 : item.video) === null || _x === void 0 ? void 0 : _x.traceInfo) !== null && _y !== void 0 ? _y : (_z = item === null || item === void 0 ? void 0 : item.product) === null || _z === void 0 ? void 0 : _z.traceInfo) !== null && _0 !== void 0 ? _0 : '',
|
411
417
|
contentFormat
|
412
418
|
}
|
413
419
|
});
|
@@ -417,7 +423,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
417
423
|
}
|
418
424
|
};
|
419
425
|
const handleScrollEvent = (swiper) => {
|
420
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
|
426
|
+
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;
|
421
427
|
const item = data[swiper.previousIndex];
|
422
428
|
if (!item)
|
423
429
|
return;
|
@@ -434,11 +440,12 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
434
440
|
eventSubject: 'scrollDown',
|
435
441
|
eventDescription: 'User scroll down',
|
436
442
|
contentId: (_e = (_d = item === null || item === void 0 ? void 0 : item.video) === null || _d === void 0 ? void 0 : _d.itemId) !== null && _e !== void 0 ? _e : '',
|
437
|
-
|
443
|
+
sceneId: (_h = (_g = (_f = item === null || item === void 0 ? void 0 : item.video) === null || _f === void 0 ? void 0 : _f.scene) === null || _g === void 0 ? void 0 : _g.sceneId) !== null && _h !== void 0 ? _h : '',
|
444
|
+
productId: (_k = (_j = item === null || item === void 0 ? void 0 : item.product) === null || _j === void 0 ? void 0 : _j.itemId) !== null && _k !== void 0 ? _k : '',
|
438
445
|
requestId: null,
|
439
|
-
traceInfo: (
|
446
|
+
traceInfo: (_p = (_m = (_l = item === null || item === void 0 ? void 0 : item.video) === null || _l === void 0 ? void 0 : _l.traceInfo) !== null && _m !== void 0 ? _m : (_o = item === null || item === void 0 ? void 0 : item.product) === null || _o === void 0 ? void 0 : _o.traceInfo) !== null && _p !== void 0 ? _p : '',
|
440
447
|
contentFormat,
|
441
|
-
position: ((
|
448
|
+
position: ((_q = swiper.previousIndex) !== null && _q !== void 0 ? _q : 0) + ''
|
442
449
|
}
|
443
450
|
});
|
444
451
|
handleViewImageStartEnd(item);
|
@@ -449,12 +456,13 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
449
456
|
eventInfo: {
|
450
457
|
eventSubject: 'scrollUp',
|
451
458
|
eventDescription: 'User scroll up',
|
452
|
-
contentId: (
|
453
|
-
|
459
|
+
contentId: (_s = (_r = item === null || item === void 0 ? void 0 : item.video) === null || _r === void 0 ? void 0 : _r.itemId) !== null && _s !== void 0 ? _s : '',
|
460
|
+
sceneId: (_v = (_u = (_t = item === null || item === void 0 ? void 0 : item.video) === null || _t === void 0 ? void 0 : _t.scene) === null || _u === void 0 ? void 0 : _u.sceneId) !== null && _v !== void 0 ? _v : '',
|
461
|
+
productId: (_x = (_w = item.product) === null || _w === void 0 ? void 0 : _w.itemId) !== null && _x !== void 0 ? _x : '',
|
454
462
|
requestId: null,
|
455
|
-
traceInfo: (
|
463
|
+
traceInfo: (_1 = (_z = (_y = item === null || item === void 0 ? void 0 : item.video) === null || _y === void 0 ? void 0 : _y.traceInfo) !== null && _z !== void 0 ? _z : (_0 = item === null || item === void 0 ? void 0 : item.product) === null || _0 === void 0 ? void 0 : _0.traceInfo) !== null && _1 !== void 0 ? _1 : '',
|
456
464
|
contentFormat,
|
457
|
-
position: ((
|
465
|
+
position: ((_2 = swiper.previousIndex) !== null && _2 !== void 0 ? _2 : 0) + ''
|
458
466
|
}
|
459
467
|
});
|
460
468
|
handleViewImageStartEnd(item);
|
@@ -478,7 +486,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
478
486
|
}
|
479
487
|
}, [openHashtag, data, activeIndex]);
|
480
488
|
const handleViewImageStartEvent = (activeIndex, imgInfo, enableCapi) => {
|
481
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
489
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
482
490
|
const item = data[activeIndex];
|
483
491
|
if (!((_a = item === null || item === void 0 ? void 0 : item.video) === null || _a === void 0 ? void 0 : _a.url) && ((_b = item === null || item === void 0 ? void 0 : item.video) === null || _b === void 0 ? void 0 : _b.imgUrls)) {
|
484
492
|
const startTime = Date.now();
|
@@ -488,9 +496,10 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
488
496
|
eventSubject: 'viewImageCarouselStart',
|
489
497
|
eventDescription: 'User start view the image carousel',
|
490
498
|
contentId: (_d = (_c = item === null || item === void 0 ? void 0 : item.video) === null || _c === void 0 ? void 0 : _c.itemId) !== null && _d !== void 0 ? _d : '',
|
491
|
-
|
499
|
+
sceneId: (_g = (_f = (_e = item === null || item === void 0 ? void 0 : item.video) === null || _e === void 0 ? void 0 : _e.scene) === null || _f === void 0 ? void 0 : _f.sceneId) !== null && _g !== void 0 ? _g : '',
|
500
|
+
contentName: (_h = item === null || item === void 0 ? void 0 : item.video.title) !== null && _h !== void 0 ? _h : '',
|
492
501
|
imageStartTime: `${startTime}`,
|
493
|
-
contentTags: JSON.stringify((
|
502
|
+
contentTags: JSON.stringify((_j = item === null || item === void 0 ? void 0 : item.video.tags) !== null && _j !== void 0 ? _j : []),
|
494
503
|
position: activeIndex + '',
|
495
504
|
contentFormat: 'image',
|
496
505
|
traceInfo: item === null || item === void 0 ? void 0 : item.video.traceInfo,
|
@@ -500,11 +509,11 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
500
509
|
if (enableCapi) {
|
501
510
|
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
502
511
|
eventName: 'ViewContent',
|
503
|
-
product: (
|
512
|
+
product: (_k = item === null || item === void 0 ? void 0 : item.video) === null || _k === void 0 ? void 0 : _k.bindProduct
|
504
513
|
});
|
505
514
|
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
506
515
|
eventName: 'PageView',
|
507
|
-
product: (
|
516
|
+
product: (_l = item === null || item === void 0 ? void 0 : item.video) === null || _l === void 0 ? void 0 : _l.bindProduct
|
508
517
|
});
|
509
518
|
}
|
510
519
|
}
|
@@ -72,7 +72,7 @@ export interface ISxpDataSourceContext {
|
|
72
72
|
bffFbReport?: (body: {
|
73
73
|
eventName: 'PageView' | 'ProductView' | 'ViewContent';
|
74
74
|
product?: any;
|
75
|
-
}) =>
|
75
|
+
}) => void;
|
76
76
|
curTime?: any;
|
77
77
|
h5EnterLink?: () => void;
|
78
78
|
themeTag?: any;
|
@@ -108,6 +108,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
108
108
|
return ((_a = bffDataSource === null || bffDataSource === void 0 ? void 0 : bffDataSource.headers) === null || _a === void 0 ? void 0 : _a['x-app-id']) + (0, localStore_1.storeAndLoadFeUserId)();
|
109
109
|
}, [bffDataSource]);
|
110
110
|
const bffFetch = (0, react_1.useCallback)((path, options) => {
|
111
|
+
var _a, _b;
|
111
112
|
if (!bffDataSource)
|
112
113
|
return;
|
113
114
|
const url = bffDataSource.url;
|
@@ -115,7 +116,33 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
115
116
|
const queryString = qs_1.default.stringify(options.query);
|
116
117
|
path = `${path}?${queryString}`;
|
117
118
|
}
|
118
|
-
|
119
|
+
let isTikTokChannel = false;
|
120
|
+
const params = {};
|
121
|
+
const queryString = location.search.slice(1);
|
122
|
+
(_a = (0, tool_1.splitUrlParams)(queryString)) === null || _a === void 0 ? void 0 : _a.forEach((val) => {
|
123
|
+
const key = val.split('=')[0];
|
124
|
+
const value = val.split('=')[1];
|
125
|
+
params[key] = value;
|
126
|
+
});
|
127
|
+
const cl_source = params === null || params === void 0 ? void 0 : params.cl_source;
|
128
|
+
if (cl_source &&
|
129
|
+
((_b = [
|
130
|
+
'40A-SPRK--DRESS_EYEWEAR-',
|
131
|
+
'41A-SPRK--MADRAGUE-',
|
132
|
+
'42A-SPRK--MOOD-',
|
133
|
+
'43A-SPRK--SUMMER-',
|
134
|
+
'44A-SPRK--DRESS_EYEWEAR-',
|
135
|
+
'45A-SPRK--MADRAGUE-',
|
136
|
+
'46A-SPRK--MOOD-',
|
137
|
+
'47A-SPRK--SUMMER-',
|
138
|
+
'48A-SPRK--DRESS_EYEWEAR-',
|
139
|
+
'49A-SPRK--MADRAGUE-',
|
140
|
+
'50A-SPRK--MOOD-',
|
141
|
+
'51A-SPRK--SUMMER-'
|
142
|
+
]) === null || _b === void 0 ? void 0 : _b.includes(cl_source))) {
|
143
|
+
isTikTokChannel = true;
|
144
|
+
}
|
145
|
+
if (options.type === 'beacon' && navigator.sendBeacon && !isTikTokChannel) {
|
119
146
|
return navigator.sendBeacon(`${url}/api/${path}`, new Blob([
|
120
147
|
JSON.stringify({
|
121
148
|
body: btoa(encodeURIComponent(JSON.stringify(Object.assign(Object.assign(Object.assign({}, options.body), bffDataSource.headers), { 'x-user-id': fakeUserId }))))
|
@@ -125,11 +152,11 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
125
152
|
}));
|
126
153
|
}
|
127
154
|
return window
|
128
|
-
.fetch(`${url}/api/${path}`, {
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
155
|
+
.fetch(`${url}/api/${path}`, Object.assign({ headers: Object.assign({ 'Content-Type': 'application/json', 'x-user-id': fakeUserId }, bffDataSource.headers), method: options.method, body: isTikTokChannel
|
156
|
+
? JSON.stringify({
|
157
|
+
body: btoa(encodeURIComponent(JSON.stringify(Object.assign(Object.assign(Object.assign({}, options.body), bffDataSource.headers), { 'x-user-id': fakeUserId }))))
|
158
|
+
})
|
159
|
+
: JSON.stringify(options.body) }, (isTikTokChannel && { keepalive: true })))
|
133
160
|
.then((res) => res.json())
|
134
161
|
.catch((err) => Promise.reject(err));
|
135
162
|
}, [bffDataSource, fakeUserId]);
|
@@ -294,23 +321,17 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
294
321
|
playbookType,
|
295
322
|
bffDataSource
|
296
323
|
]);
|
297
|
-
const
|
298
|
-
var _a, _b, _c
|
299
|
-
|
300
|
-
!enabledMetaConversionApi ||
|
301
|
-
(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview) ||
|
302
|
-
!((_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.converApi) === null || _a === void 0 ? void 0 : _a[eventName])) {
|
303
|
-
return;
|
304
|
-
}
|
305
|
-
const jsonParams = (0, lodash_1.cloneDeep)((_b = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.converApi) === null || _b === void 0 ? void 0 : _b[eventName]);
|
324
|
+
const getEventParamsByJson = (0, react_1.useCallback)((json, product) => {
|
325
|
+
var _a, _b, _c;
|
326
|
+
const jsonParams = (0, lodash_1.cloneDeep)(json);
|
306
327
|
const urlParams = new URLSearchParams(window.location.search);
|
307
328
|
const fbclid = urlParams === null || urlParams === void 0 ? void 0 : urlParams.get('fbclid');
|
308
329
|
const fix_par = {
|
309
|
-
event_source_url: (
|
330
|
+
event_source_url: (_a = window === null || window === void 0 ? void 0 : window.location) === null || _a === void 0 ? void 0 : _a.href,
|
310
331
|
external_id: fakeUserId,
|
311
|
-
client_user_agent: (
|
332
|
+
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 : '',
|
312
333
|
fbc: fbclid ? `fb.2.${new Date().getTime()}.${fbclid}` : '',
|
313
|
-
fbp: (0, tool_1.getCookie)('_fbp') ?
|
334
|
+
fbp: (0, tool_1.getCookie)('_fbp') ? `${(0, tool_1.getCookie)('_fbp')}` : '',
|
314
335
|
time: Math.floor(Date.now() / 1000)
|
315
336
|
};
|
316
337
|
const regex = /\{\{(.*?)\}\}/g;
|
@@ -322,7 +343,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
322
343
|
}
|
323
344
|
else {
|
324
345
|
for (const key in obj) {
|
325
|
-
if (
|
346
|
+
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
326
347
|
const value = obj === null || obj === void 0 ? void 0 : obj[key];
|
327
348
|
if (typeof value === 'object') {
|
328
349
|
getEventParams(value);
|
@@ -359,28 +380,59 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
359
380
|
}
|
360
381
|
};
|
361
382
|
getEventParams(jsonParams);
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
}
|
369
|
-
const
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
383
|
+
return jsonParams;
|
384
|
+
}, [fakeUserId]);
|
385
|
+
const bffFbReport = (0, react_1.useCallback)(({ eventName, product }) => {
|
386
|
+
var _a, _b, _c, _d;
|
387
|
+
if (!enableReportEvent || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview)) {
|
388
|
+
return;
|
389
|
+
}
|
390
|
+
const pixelEventParamsJson = (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.pixel) === null || _a === void 0 ? void 0 : _a[eventName];
|
391
|
+
if ((pixelEventParamsJson === null || pixelEventParamsJson === void 0 ? void 0 : pixelEventParamsJson.event_name) && typeof (window === null || window === void 0 ? void 0 : window.fbq) === 'function') {
|
392
|
+
function updateQueryStringParameter(uri, key, value) {
|
393
|
+
const re = new RegExp('([?&])' + key + '=.*?(&|$)', 'i');
|
394
|
+
const separator = uri.indexOf('?') !== -1 ? '&' : '?';
|
395
|
+
if (uri.match(re)) {
|
396
|
+
return uri.replace(re, '$1' + key + '=' + value + '$2');
|
397
|
+
}
|
398
|
+
else {
|
399
|
+
return uri + separator + key + '=' + value;
|
400
|
+
}
|
401
|
+
}
|
402
|
+
if (eventName === 'PageView' && (pixelEventParamsJson === null || pixelEventParamsJson === void 0 ? void 0 : pixelEventParamsJson.event_name) === 'PageView') {
|
403
|
+
const currentUrl = window.location.href;
|
404
|
+
const newUrl = updateQueryStringParameter(currentUrl, 'timestamp', Date.now());
|
405
|
+
history.pushState({ path: newUrl }, '', newUrl);
|
406
|
+
}
|
407
|
+
else {
|
408
|
+
const body = getEventParamsByJson(pixelEventParamsJson);
|
409
|
+
window === null || window === void 0 ? void 0 : window.fbq('track', pixelEventParamsJson === null || pixelEventParamsJson === void 0 ? void 0 : pixelEventParamsJson.event_name, body);
|
410
|
+
if (eventName === 'PageView' && typeof (window === null || window === void 0 ? void 0 : window.gtag) === 'function') {
|
411
|
+
window === null || window === void 0 ? void 0 : window.gtag('event', 'page_view');
|
412
|
+
}
|
413
|
+
}
|
414
|
+
}
|
415
|
+
else if (eventName === 'PageView' && typeof (window === null || window === void 0 ? void 0 : window.gtag) === 'function') {
|
416
|
+
window === null || window === void 0 ? void 0 : window.gtag('event', 'page_view');
|
417
|
+
}
|
418
|
+
const converApiEventParamsJson = (_b = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.converApi) === null || _b === void 0 ? void 0 : _b[eventName];
|
419
|
+
if (enabledMetaConversionApi && converApiEventParamsJson) {
|
420
|
+
const body = getEventParamsByJson(converApiEventParamsJson, product);
|
421
|
+
const params = {};
|
422
|
+
const queryString = location.search.slice(1);
|
423
|
+
(_c = (0, tool_1.splitUrlParams)(queryString)) === null || _c === void 0 ? void 0 : _c.forEach((val) => {
|
424
|
+
const key = val.split('=')[0];
|
425
|
+
const value = val.split('=')[1];
|
426
|
+
params[key] = value;
|
427
|
+
});
|
428
|
+
const cl_source = params === null || params === void 0 ? void 0 : params.cl_source;
|
429
|
+
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)}` : ''}`, {
|
430
|
+
method: 'POST',
|
431
|
+
body,
|
432
|
+
type: 'beacon'
|
433
|
+
});
|
434
|
+
}
|
435
|
+
}, [bffFetch, enableReportEvent, enabledMetaConversionApi, globalConfig, bffDataSource, getEventParamsByJson]);
|
384
436
|
const bffMutateLike = (0, react_1.useCallback)((body) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
385
437
|
const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/recommend/like', { method: 'POST', body }));
|
386
438
|
return res === null || res === void 0 ? void 0 : res.success;
|
@@ -412,7 +464,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
412
464
|
}
|
413
465
|
}), [bffFetch, utmVal]);
|
414
466
|
const ctaEvent = (0, react_1.useCallback)((eventInfo, rec, product, position) => {
|
415
|
-
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;
|
467
|
+
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;
|
416
468
|
const cta = product === null || product === void 0 ? void 0 : product.bindCta;
|
417
469
|
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);
|
418
470
|
let fromKName = '';
|
@@ -430,7 +482,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
430
482
|
}
|
431
483
|
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;
|
432
484
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
433
|
-
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: (
|
485
|
+
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 })
|
434
486
|
});
|
435
487
|
}, [bffEventReport, isFromHashtag]);
|
436
488
|
const h5EnterLink = (0, react_1.useCallback)(() => {
|
@@ -2,12 +2,12 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.useEventReport = void 0;
|
4
4
|
const react_1 = require("react");
|
5
|
-
const useSxpDataSource_1 = require("./useSxpDataSource");
|
6
5
|
const SxpDataSourceProvider_1 = require("../context/SxpDataSourceProvider");
|
6
|
+
const useSxpDataSource_1 = require("./useSxpDataSource");
|
7
7
|
function useEventReport() {
|
8
8
|
const { bffEventReport, popupDetailData, isFromHashtag, eventTimeList, setEventTimeList } = (0, useSxpDataSource_1.useSxpDataSource)();
|
9
9
|
const jumpToWeb = (0, react_1.useCallback)((e, data, product, cta, position, traceInfo) => {
|
10
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13;
|
10
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16;
|
11
11
|
const i = eventTimeList === null || eventTimeList === void 0 ? void 0 : eventTimeList.findIndex((item) => item.target === (e === null || e === void 0 ? void 0 : e.target));
|
12
12
|
if (i !== -1) {
|
13
13
|
return;
|
@@ -40,11 +40,11 @@ function useEventReport() {
|
|
40
40
|
contentFormat = 'image';
|
41
41
|
}
|
42
42
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
43
|
-
eventInfo: Object.assign({ eventSubject: 'jumpToWeb', eventDescription: 'User jumped to website', productId: (_v = product === null || product === void 0 ? void 0 : product.itemId) !== null && _v !== void 0 ? _v : '', productName: (_w = product === null || product === void 0 ? void 0 : product.title) !== null && _w !== void 0 ? _w : '', price: (product === null || product === void 0 ? void 0 : product.price) ? (product === null || product === void 0 ? void 0 : product.price) + '' : '0', productCollection: (_x = product === null || product === void 0 ? void 0 : product.collection) !== null && _x !== void 0 ? _x : '', fromKName, fromKPage: location === null || location === void 0 ? void 0 : location.href, contentTags: contentTags ? JSON.stringify(contentTags) : '', position: position + '', contentId: (_z = (_y = data === null || data === void 0 ? void 0 : data.video) === null || _y === void 0 ? void 0 : _y.itemId) !== null && _z !== void 0 ? _z : '',
|
43
|
+
eventInfo: Object.assign({ eventSubject: 'jumpToWeb', eventDescription: 'User jumped to website', productId: (_v = product === null || product === void 0 ? void 0 : product.itemId) !== null && _v !== void 0 ? _v : '', productName: (_w = product === null || product === void 0 ? void 0 : product.title) !== null && _w !== void 0 ? _w : '', price: (product === null || product === void 0 ? void 0 : product.price) ? (product === null || product === void 0 ? void 0 : product.price) + '' : '0', productCollection: (_x = product === null || product === void 0 ? void 0 : product.collection) !== null && _x !== void 0 ? _x : '', fromKName, fromKPage: location === null || location === void 0 ? void 0 : location.href, contentTags: contentTags ? JSON.stringify(contentTags) : '', position: position + '', contentId: (_z = (_y = data === null || data === void 0 ? void 0 : data.video) === null || _y === void 0 ? void 0 : _y.itemId) !== null && _z !== void 0 ? _z : '', sceneId: (_2 = (_1 = (_0 = data === null || data === void 0 ? void 0 : data.video) === null || _0 === void 0 ? void 0 : _0.scene) === null || _1 === void 0 ? void 0 : _1.sceneId) !== null && _2 !== void 0 ? _2 : '', ctatId: (_3 = cta === null || cta === void 0 ? void 0 : cta.itemId) !== null && _3 !== void 0 ? _3 : '', traceInfo: (_16 = (_13 = (_11 = (_7 = (_4 = traceInfo !== null && traceInfo !== void 0 ? traceInfo : product === null || product === void 0 ? void 0 : product.traceInfo) !== null && _4 !== void 0 ? _4 : (_6 = (_5 = data === null || data === void 0 ? void 0 : data.video) === null || _5 === void 0 ? void 0 : _5.bindProduct) === null || _6 === void 0 ? void 0 : _6.traceInfo) !== null && _7 !== void 0 ? _7 : (_10 = (_9 = (_8 = data === null || data === void 0 ? void 0 : data.video) === null || _8 === void 0 ? void 0 : _8.bindProducts) === null || _9 === void 0 ? void 0 : _9[0]) === null || _10 === void 0 ? void 0 : _10.traceInfo) !== null && _11 !== void 0 ? _11 : (_12 = data === null || data === void 0 ? void 0 : data.product) === null || _12 === void 0 ? void 0 : _12.traceInfo) !== null && _13 !== void 0 ? _13 : (_15 = (_14 = data === null || data === void 0 ? void 0 : data.video) === null || _14 === void 0 ? void 0 : _14.bindCta) === null || _15 === void 0 ? void 0 : _15.traceInfo) !== null && _16 !== void 0 ? _16 : '' }, (contentFormat && { contentFormat }))
|
44
44
|
});
|
45
45
|
}, [bffEventReport, popupDetailData, isFromHashtag, eventTimeList]);
|
46
46
|
const productView = (0, react_1.useCallback)((data, product, cta, viewTime, position) => {
|
47
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
47
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
48
48
|
let fromKName = '';
|
49
49
|
if (popupDetailData && (((_b = (_a = data === null || data === void 0 ? void 0 : data.video) === null || _a === void 0 ? void 0 : _a.bindProducts) === null || _b === void 0 ? void 0 : _b.length) || ((_c = data === null || data === void 0 ? void 0 : data.video) === null || _c === void 0 ? void 0 : _c.bindProduct))) {
|
50
50
|
fromKName = 'pdpPage';
|
@@ -63,8 +63,9 @@ function useEventReport() {
|
|
63
63
|
contentTags: JSON.stringify(product === null || product === void 0 ? void 0 : product.tags),
|
64
64
|
position: position + '',
|
65
65
|
contentId: (_d = data === null || data === void 0 ? void 0 : data.video) === null || _d === void 0 ? void 0 : _d.itemId,
|
66
|
+
sceneId: (_g = (_f = (_e = data === null || data === void 0 ? void 0 : data.video) === null || _e === void 0 ? void 0 : _e.scene) === null || _f === void 0 ? void 0 : _f.sceneId) !== null && _g !== void 0 ? _g : '',
|
66
67
|
ctatId: cta === null || cta === void 0 ? void 0 : cta.itemId,
|
67
|
-
traceInfo: (
|
68
|
+
traceInfo: (_s = (_q = (_l = (_h = product === null || product === void 0 ? void 0 : product.traceInfo) !== null && _h !== void 0 ? _h : (_k = (_j = data === null || data === void 0 ? void 0 : data.video) === null || _j === void 0 ? void 0 : _j.bindProduct) === null || _k === void 0 ? void 0 : _k.traceInfo) !== null && _l !== void 0 ? _l : (_p = (_o = (_m = data === null || data === void 0 ? void 0 : data.video) === null || _m === void 0 ? void 0 : _m.bindProducts) === null || _o === void 0 ? void 0 : _o[0]) === null || _p === void 0 ? void 0 : _p.traceInfo) !== null && _q !== void 0 ? _q : (_r = data === null || data === void 0 ? void 0 : data.product) === null || _r === void 0 ? void 0 : _r.traceInfo) !== null && _s !== void 0 ? _s : '',
|
68
69
|
timeOnSite: Math.floor((new Date() - viewTime) / 1000) + '',
|
69
70
|
eventSubject: 'productView',
|
70
71
|
eventDescription: 'User browsed the product'
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
4
4
|
const css_1 = require("@emotion/css");
|
5
5
|
const react_1 = tslib_1.__importStar(require("react"));
|
6
|
+
const CommodityGroup_1 = tslib_1.__importDefault(require("../../template/components/CommodityGroup"));
|
6
7
|
const hooks_1 = require("../../../../core/hooks");
|
7
8
|
require("./index.less");
|
8
9
|
const modules_1 = require("swiper/modules");
|
@@ -12,7 +13,6 @@ const Modal_1 = tslib_1.__importDefault(require("../../../../core/components/Sxp
|
|
12
13
|
const ExpandableText_1 = tslib_1.__importDefault(require("../../../../core/components/SxpPageRender/ExpandableText"));
|
13
14
|
const FormatImage_1 = tslib_1.__importDefault(require("../../../../core/components/SxpPageRender/FormatImage"));
|
14
15
|
const tool_1 = require("../../../../core/utils/tool");
|
15
|
-
const CommodityGroup_1 = tslib_1.__importDefault(require("../../template/components/CommodityGroup"));
|
16
16
|
const materials_1 = require("../../../../core/utils/materials");
|
17
17
|
const CommodityDetail = (_a) => {
|
18
18
|
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;
|
@@ -69,7 +69,7 @@ const CommodityDetail = (_a) => {
|
|
69
69
|
};
|
70
70
|
}, []);
|
71
71
|
const priceText = (0, materials_1.getPriceText)({
|
72
|
-
product
|
72
|
+
product,
|
73
73
|
enableFormattedPrice: (_t = commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price) === null || _t === void 0 ? void 0 : _t.enableFormattedPrice,
|
74
74
|
globalConfig,
|
75
75
|
style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
4
4
|
const css_1 = require("@emotion/css");
|
5
5
|
const react_1 = tslib_1.__importStar(require("react"));
|
6
|
+
const CommodityGroup_1 = tslib_1.__importDefault(require("../../template/components/CommodityGroup"));
|
6
7
|
const hooks_1 = require("../../../../core/hooks");
|
7
8
|
require("./index.less");
|
8
9
|
const modules_1 = require("swiper/modules");
|
@@ -12,7 +13,6 @@ const ExpandableText_1 = tslib_1.__importDefault(require("../../../../core/compo
|
|
12
13
|
const useEventReport_1 = require("../../../../core/hooks/useEventReport");
|
13
14
|
const FormatImage_1 = tslib_1.__importDefault(require("../../../../core/components/SxpPageRender/FormatImage"));
|
14
15
|
const tool_1 = require("../../../../core/utils/tool");
|
15
|
-
const CommodityGroup_1 = tslib_1.__importDefault(require("../../template/components/CommodityGroup"));
|
16
16
|
const materials_1 = require("../../../../core/utils/materials");
|
17
17
|
const CommodityDetailDiroNew = (_a) => {
|
18
18
|
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;
|