pb-sxp-ui 1.20.70 → 1.20.72
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 +51 -34
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +51 -34
- package/dist/index.js.map +1 -1
- package/dist/index.min.cjs +6 -6
- package/dist/index.min.cjs.map +1 -1
- package/dist/index.min.js +6 -6
- package/dist/index.min.js.map +1 -1
- package/dist/pb-ui.js +51 -34
- package/dist/pb-ui.js.map +1 -1
- package/dist/pb-ui.min.js +6 -6
- package/dist/pb-ui.min.js.map +1 -1
- package/es/core/components/SxpPageRender/VideoWidget/index.js +21 -18
- package/es/materials/sxp/popup/CommodityDetail/index.js +13 -7
- package/es/materials/sxp/popup/CommodityDetailDiroNew/index.js +12 -8
- package/lib/core/components/SxpPageRender/VideoWidget/index.js +21 -17
- package/lib/materials/sxp/popup/CommodityDetail/index.js +13 -7
- package/lib/materials/sxp/popup/CommodityDetailDiroNew/index.js +12 -8
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -11335,8 +11335,8 @@ const CommodityDetail$1 = (_a) => {
|
|
|
11335
11335
|
product = p;
|
|
11336
11336
|
cta = p === null || p === void 0 ? void 0 : p.bindCta;
|
|
11337
11337
|
}
|
|
11338
|
-
// feed 流 Post 场景:SKU
|
|
11339
|
-
const isSkuBoundPost = isPost && !!(product === null || product === void 0 ? void 0 : product.variantId);
|
|
11338
|
+
// feed 流 Post 场景:SKU 层绑定时(Shopify 商品 + variantId),点击直接跳加购弹窗并预选该 SKU
|
|
11339
|
+
const isSkuBoundPost = isPost && !!(product === null || product === void 0 ? void 0 : product.shopifyId) && !!(product === null || product === void 0 ? void 0 : product.variantId);
|
|
11340
11340
|
const handleLink = (e) => {
|
|
11341
11341
|
// 如果启用了加购功能且配置了加购弹窗ID,检查是否是 Shopify 商品
|
|
11342
11342
|
if (enableAddToCart && addToCartPopupId) {
|
|
@@ -11476,15 +11476,21 @@ const CommodityDetail$1 = (_a) => {
|
|
|
11476
11476
|
};
|
|
11477
11477
|
}, [isActive, isPost, bffFbReport, data, product, position, curTimeRef]);
|
|
11478
11478
|
React.useEffect(() => {
|
|
11479
|
-
|
|
11480
|
-
|
|
11479
|
+
if (!isActive)
|
|
11480
|
+
return;
|
|
11481
|
+
curTimeRef.current = new Date();
|
|
11482
|
+
// 最小化再回来时,重置计时起点,使 productView 的 timeOnSite 只计算实际可见时间
|
|
11483
|
+
const handleVisibility = () => {
|
|
11484
|
+
if (document.visibilityState === 'hidden') ;
|
|
11485
|
+
else {
|
|
11486
|
+
curTimeRef.current = new Date();
|
|
11487
|
+
}
|
|
11481
11488
|
};
|
|
11482
|
-
|
|
11483
|
-
window.addEventListener('pageshow', initTime);
|
|
11489
|
+
document.addEventListener('visibilitychange', handleVisibility);
|
|
11484
11490
|
return () => {
|
|
11485
|
-
|
|
11491
|
+
document.removeEventListener('visibilitychange', handleVisibility);
|
|
11486
11492
|
};
|
|
11487
|
-
}, []);
|
|
11493
|
+
}, [isActive]);
|
|
11488
11494
|
const priceText = getPriceText({
|
|
11489
11495
|
product,
|
|
11490
11496
|
enableFormattedPrice: (_w = commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price) === null || _w === void 0 ? void 0 : _w.enableFormattedPrice,
|
|
@@ -12779,8 +12785,9 @@ const CommodityDetailDiroNew$1 = (_a) => {
|
|
|
12779
12785
|
product = p;
|
|
12780
12786
|
cta = p === null || p === void 0 ? void 0 : p.bindCta;
|
|
12781
12787
|
}
|
|
12782
|
-
// 是否为 SKU
|
|
12783
|
-
|
|
12788
|
+
// 是否为 SKU 层绑定(仅 Shopify 商品:shopifyId + variantId + variantOption 同时存在)
|
|
12789
|
+
// 非 Shopify 页面(shopify: null)即使有 variantId 也不走加购弹窗,避免空白
|
|
12790
|
+
const isSkuLevel = !!(product === null || product === void 0 ? void 0 : product.shopifyId) && !!(product === null || product === void 0 ? void 0 : product.variantId) && !!(product === null || product === void 0 ? void 0 : product.variantOption);
|
|
12784
12791
|
const handleOpenAddToCart = (variantId, isUserClick = false) => {
|
|
12785
12792
|
if (isUserClick) {
|
|
12786
12793
|
ctaEvent === null || ctaEvent === void 0 ? void 0 : ctaEvent({ eventSubject: 'clickCta', eventDescription: 'User clicked the CTA' }, data, product, position);
|
|
@@ -12893,15 +12900,19 @@ const CommodityDetailDiroNew$1 = (_a) => {
|
|
|
12893
12900
|
};
|
|
12894
12901
|
}, [isActive, isPost, bffFbReport, data, product, position, curTimeRef]);
|
|
12895
12902
|
React.useEffect(() => {
|
|
12896
|
-
|
|
12897
|
-
|
|
12898
|
-
|
|
12899
|
-
|
|
12903
|
+
if (!isActive)
|
|
12904
|
+
return;
|
|
12905
|
+
curTimeRef.current = new Date();
|
|
12906
|
+
// 最小化再回来时,重置计时起点,使 productView 的 timeOnSite 只计算实际可见时间
|
|
12907
|
+
const handleVisibility = () => {
|
|
12908
|
+
if (document.visibilityState === 'hidden') ;
|
|
12909
|
+
else {
|
|
12910
|
+
curTimeRef.current = new Date();
|
|
12911
|
+
}
|
|
12900
12912
|
};
|
|
12901
|
-
|
|
12902
|
-
window.addEventListener('pageshow', initTime);
|
|
12913
|
+
document.addEventListener('visibilitychange', handleVisibility);
|
|
12903
12914
|
return () => {
|
|
12904
|
-
|
|
12915
|
+
document.removeEventListener('visibilitychange', handleVisibility);
|
|
12905
12916
|
};
|
|
12906
12917
|
}, [isActive]);
|
|
12907
12918
|
const priceText = getPriceText({
|
|
@@ -23365,33 +23376,39 @@ const VideoWidget$4 = React.forwardRef(({ rec, index, height, data, muted, activ
|
|
|
23365
23376
|
}
|
|
23366
23377
|
};
|
|
23367
23378
|
const PAUSE_ICON = useIconLink('/pb_static/06f28a2025c74c1cb49be6767316d827.png');
|
|
23368
|
-
const
|
|
23369
|
-
|
|
23370
|
-
return;
|
|
23371
|
-
setWaiting(false);
|
|
23372
|
-
setIsLoadFinish(true);
|
|
23373
|
-
}, []);
|
|
23374
|
-
const handleStartPlay = React.useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
23375
|
-
var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
23376
|
-
if (!(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current))
|
|
23377
|
-
return;
|
|
23378
|
-
setIsPauseVideo(false);
|
|
23379
|
+
const reportPlayVideo = React.useCallback(() => {
|
|
23380
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
23379
23381
|
const item = data[index];
|
|
23380
23382
|
const now = Date.now();
|
|
23381
23383
|
if (now - lastPlayReportTimeRef.current < 500)
|
|
23382
23384
|
return;
|
|
23383
|
-
|
|
23384
|
-
|
|
23385
|
-
|
|
23386
|
-
|
|
23385
|
+
// duration 在 loadedmetadata 之后才有效,playing 事件触发时必然已有值
|
|
23386
|
+
const duration = (_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.duration;
|
|
23387
|
+
if (item && duration && isFinite(duration)) {
|
|
23388
|
+
videoStartTime.current = ((_b = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _b === void 0 ? void 0 : _b.currentTime) || 0;
|
|
23389
|
+
const videoDuration = duration.toFixed(2);
|
|
23390
|
+
const videoCurrentTime = ((_d = (_c = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _c === void 0 ? void 0 : _c.currentTime) !== null && _d !== void 0 ? _d : 0).toFixed(2);
|
|
23387
23391
|
const playType = (isFirstPlayRef === null || isFirstPlayRef === void 0 ? void 0 : isFirstPlayRef.current) ? '0' : '1';
|
|
23388
23392
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
|
23389
|
-
eventInfo: Object.assign({ eventSubject: 'playVideo', eventDescription: 'User played the video', contentId: (
|
|
23393
|
+
eventInfo: Object.assign({ eventSubject: 'playVideo', eventDescription: 'User played the video', contentId: (_f = (_e = item === null || item === void 0 ? void 0 : item.video) === null || _e === void 0 ? void 0 : _e.itemId) !== null && _f !== void 0 ? _f : '', sceneId: (_j = (_h = (_g = item === null || item === void 0 ? void 0 : item.video) === null || _g === void 0 ? void 0 : _g.scene) === null || _h === void 0 ? void 0 : _h.sceneId) !== null && _j !== void 0 ? _j : '', contentName: (_l = (_k = item === null || item === void 0 ? void 0 : item.video) === null || _k === void 0 ? void 0 : _k.title) !== null && _l !== void 0 ? _l : '', playType, startTime: videoCurrentTime, videoDuration, contentTags: JSON.stringify((_o = (_m = item === null || item === void 0 ? void 0 : item.video) === null || _m === void 0 ? void 0 : _m.tags) !== null && _o !== void 0 ? _o : []), position: index + '', contentFormat: 'video', traceInfo: (_p = item === null || item === void 0 ? void 0 : item.video) === null || _p === void 0 ? void 0 : _p.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) + '' }))
|
|
23390
23394
|
});
|
|
23391
23395
|
lastPlayReportTimeRef.current = Date.now();
|
|
23392
23396
|
isFirstPlayRef.current = false;
|
|
23393
23397
|
}
|
|
23394
|
-
}
|
|
23398
|
+
}, [bffEventReport, data, index, isFirstPlayRef, videoRef === null || videoRef === void 0 ? void 0 : videoRef.current]);
|
|
23399
|
+
const handleStartPlay = React.useCallback(() => {
|
|
23400
|
+
if (!(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current))
|
|
23401
|
+
return;
|
|
23402
|
+
setIsPauseVideo(false);
|
|
23403
|
+
}, [videoRef === null || videoRef === void 0 ? void 0 : videoRef.current]);
|
|
23404
|
+
const handlePlaying = React.useCallback(() => {
|
|
23405
|
+
if (!(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current))
|
|
23406
|
+
return;
|
|
23407
|
+
setWaiting(false);
|
|
23408
|
+
setIsLoadFinish(true);
|
|
23409
|
+
// playing 事件触发时 duration 已就绪,在此上报 playVideo
|
|
23410
|
+
reportPlayVideo();
|
|
23411
|
+
}, [reportPlayVideo]);
|
|
23395
23412
|
const handLoadeddata = React.useCallback(() => {
|
|
23396
23413
|
if (!(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) || firstFrameSrc || !blur)
|
|
23397
23414
|
return;
|