pb-sxp-ui 1.7.0 → 1.7.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 +33 -93
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +1 -0
- package/dist/index.js +33 -93
- package/dist/index.js.map +1 -1
- package/dist/index.min.cjs +3 -3
- package/dist/index.min.cjs.map +1 -1
- package/dist/index.min.js +3 -3
- package/dist/index.min.js.map +1 -1
- package/dist/pb-ui.js +33 -93
- package/dist/pb-ui.js.map +1 -1
- package/dist/pb-ui.min.js +3 -3
- package/dist/pb-ui.min.js.map +1 -1
- package/es/core/components/SxpPageRender/VideoWidget/index.js +5 -8
- package/es/core/components/SxpPageRender/WaterFall/index.js +1 -6
- package/es/core/components/SxpPageRender/index.d.ts +0 -1
- package/es/core/components/SxpPageRender/index.js +11 -7
- package/es/core/context/SxpDataSourceProvider.d.ts +4 -2
- package/es/core/context/SxpDataSourceProvider.js +11 -52
- package/es/materials/sxp/popup/CommodityDetail/index.js +1 -6
- package/es/materials/sxp/popup/CommodityDetailDiro/index.js +1 -6
- package/es/materials/sxp/popup/CommodityDetailDiroNew/index.js +1 -6
- package/es/materials/sxp/popup/CommodityList/index.js +2 -7
- package/lib/core/components/SxpPageRender/VideoWidget/index.js +5 -8
- package/lib/core/components/SxpPageRender/WaterFall/index.js +1 -6
- package/lib/core/components/SxpPageRender/index.d.ts +0 -1
- package/lib/core/components/SxpPageRender/index.js +11 -7
- package/lib/core/context/SxpDataSourceProvider.d.ts +4 -2
- package/lib/core/context/SxpDataSourceProvider.js +11 -52
- package/lib/materials/sxp/popup/CommodityDetail/index.js +1 -6
- package/lib/materials/sxp/popup/CommodityDetailDiro/index.js +1 -6
- package/lib/materials/sxp/popup/CommodityDetailDiroNew/index.js +1 -6
- package/lib/materials/sxp/popup/CommodityList/index.js +1 -6
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
@@ -819,64 +819,23 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
819
819
|
type: 'beacon'
|
820
820
|
});
|
821
821
|
}, [bffFetch, curReqInfo, enableReportEvent, globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview]);
|
822
|
-
const bffFbReport = React.useCallback((
|
823
|
-
var
|
822
|
+
const bffFbReport = React.useCallback((_a) => {
|
823
|
+
var _b, _c, _d;
|
824
|
+
var { eventName, actionSource = 'website', eventSourceUrl = (_b = window === null || window === void 0 ? void 0 : window.location) === null || _b === void 0 ? void 0 : _b.href, externalId } = _a;
|
824
825
|
if (!enableReportEvent || !enabledMetaConversionApi || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview)) {
|
825
826
|
return;
|
826
827
|
}
|
827
|
-
|
828
|
+
const fakeUserId = storeAndLoadFeUserId();
|
828
829
|
const urlParams = new URLSearchParams(window.location.search);
|
829
|
-
const fbclid = urlParams
|
830
|
-
const fix_par = {
|
831
|
-
event_source_url: (_b = window === null || window === void 0 ? void 0 : window.location) === null || _b === void 0 ? void 0 : _b.href,
|
832
|
-
external_id: storeAndLoadFeUserId(),
|
833
|
-
client_user_agent: (_d = (_c = window === null || window === void 0 ? void 0 : window.navigator) === null || _c === void 0 ? void 0 : _c.userAgent) !== null && _d !== void 0 ? _d : '',
|
834
|
-
fbc: fbclid ? `fb.2.${new Date().getTime()}.${fbclid}` : '',
|
835
|
-
fbp: getCookie('_fbp') ? `fb.2.${new Date().getTime()}.${getCookie('_fbp')}` : '',
|
836
|
-
time: new Date().getTime()
|
837
|
-
};
|
838
|
-
const regex = /\{\{(.*?)\}\}/g;
|
839
|
-
const getEventParams = (obj) => {
|
840
|
-
if (!obj)
|
841
|
-
return;
|
842
|
-
if (obj instanceof Array) {
|
843
|
-
obj === null || obj === void 0 ? void 0 : obj.map((item) => getEventParams(item));
|
844
|
-
}
|
845
|
-
else {
|
846
|
-
for (const key in obj) {
|
847
|
-
if (obj.hasOwnProperty(key)) {
|
848
|
-
const value = obj === null || obj === void 0 ? void 0 : obj[key];
|
849
|
-
if (typeof value === 'object') {
|
850
|
-
getEventParams(value);
|
851
|
-
}
|
852
|
-
else if (typeof value === 'string') {
|
853
|
-
const matches = value === null || value === void 0 ? void 0 : value.match(regex);
|
854
|
-
if (matches) {
|
855
|
-
matches.forEach((match) => {
|
856
|
-
const prop = match.substring(2, match.length - 2);
|
857
|
-
try {
|
858
|
-
const replaceValue = new Function('fix_par', 'product', `return ${prop}`)(fix_par, product);
|
859
|
-
if (replaceValue) {
|
860
|
-
obj[key] = replaceValue;
|
861
|
-
}
|
862
|
-
else {
|
863
|
-
delete obj[key];
|
864
|
-
}
|
865
|
-
}
|
866
|
-
catch (error) {
|
867
|
-
console.error('An error occurred:', error === null || error === void 0 ? void 0 : error.message);
|
868
|
-
}
|
869
|
-
});
|
870
|
-
}
|
871
|
-
}
|
872
|
-
}
|
873
|
-
}
|
874
|
-
}
|
875
|
-
};
|
876
|
-
getEventParams(jsonParams);
|
830
|
+
const fbclid = urlParams.get('fbclid');
|
877
831
|
return bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/fb/events', {
|
878
832
|
method: 'POST',
|
879
|
-
body:
|
833
|
+
body: {
|
834
|
+
eventName,
|
835
|
+
actionSource,
|
836
|
+
eventSourceUrl,
|
837
|
+
userData: Object.assign(Object.assign(Object.assign({ externalId: fakeUserId }, (fbclid && { fbc: `fb.2.${new Date().getTime()}.${fbclid}` })), (getCookie('_fbp') && { fbp: `fb.2.${new Date().getTime()}.${getCookie('_fbp')}` })), { clientUserAgent: (_d = (_c = window === null || window === void 0 ? void 0 : window.navigator) === null || _c === void 0 ? void 0 : _c.userAgent) !== null && _d !== void 0 ? _d : '' })
|
838
|
+
},
|
880
839
|
type: 'beacon'
|
881
840
|
});
|
882
841
|
}, [bffFetch, enableReportEvent, enabledMetaConversionApi, globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview]);
|
@@ -9405,14 +9364,9 @@ const CommodityDetail$1 = (_a) => {
|
|
9405
9364
|
React.useEffect(() => {
|
9406
9365
|
if (!isPost) {
|
9407
9366
|
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
9408
|
-
eventName: 'ProductView'
|
9409
|
-
product
|
9367
|
+
eventName: 'ProductView'
|
9410
9368
|
});
|
9411
9369
|
}
|
9412
|
-
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
9413
|
-
eventName: 'PageView',
|
9414
|
-
product
|
9415
|
-
});
|
9416
9370
|
}, [isPost, bffFbReport]);
|
9417
9371
|
React.useEffect(() => {
|
9418
9372
|
const initTime = () => {
|
@@ -10291,12 +10245,7 @@ const CommodityDetailDiroNew$1 = (_a) => {
|
|
10291
10245
|
React.useEffect(() => {
|
10292
10246
|
if (!isPost) {
|
10293
10247
|
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
10294
|
-
eventName: 'ProductView'
|
10295
|
-
product
|
10296
|
-
});
|
10297
|
-
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
10298
|
-
eventName: 'PageView',
|
10299
|
-
product
|
10248
|
+
eventName: 'ProductView'
|
10300
10249
|
});
|
10301
10250
|
}
|
10302
10251
|
}, [isPost, bffFbReport]);
|
@@ -10921,7 +10870,7 @@ var Img$1 = React.memo(Img);
|
|
10921
10870
|
const CommodityList$1 = (_a) => {
|
10922
10871
|
var _b, _c, _d;
|
10923
10872
|
var { style, isDefault, rec, viewTime, isPost, bottom_image, commodityStyles, buttonStyle, translateY = 0, commodityPicture, isExternalLink, onClick } = _a, props = __rest(_a, ["style", "isDefault", "rec", "viewTime", "isPost", "bottom_image", "commodityStyles", "buttonStyle", "translateY", "commodityPicture", "isExternalLink", "onClick"]);
|
10924
|
-
const { sxpParameter, popupDetailData, setPopupDetailData, ctaEvent, globalConfig
|
10873
|
+
const { sxpParameter, popupDetailData, setPopupDetailData, ctaEvent, globalConfig } = useSxpDataSource();
|
10925
10874
|
const { jumpToWeb } = useEventReport();
|
10926
10875
|
const { popup } = useEditor();
|
10927
10876
|
const recData = isPost ? rec : popupDetailData;
|
@@ -10951,11 +10900,6 @@ const CommodityList$1 = (_a) => {
|
|
10951
10900
|
onClick === null || onClick === void 0 ? void 0 : onClick();
|
10952
10901
|
}
|
10953
10902
|
}, popup === null || popup === void 0 ? void 0 : popup.duration);
|
10954
|
-
React.useEffect(() => {
|
10955
|
-
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
10956
|
-
eventName: 'PageView'
|
10957
|
-
});
|
10958
|
-
}, []);
|
10959
10903
|
return (React.createElement("div", { className: css.css(Object.assign(Object.assign({}, style), { display: 'flex', flexDirection: 'column', gap: '10px', padding: '0 20px', marginTop: '50px', boxSizing: 'border-box' })) }, product === null || product === void 0 ? void 0 : product.map((item, index) => {
|
10960
10904
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
10961
10905
|
return (React.createElement(React.Fragment, null, recData && !(item === null || item === void 0 ? void 0 : item.bindCta) ? null : (React.createElement("div", Object.assign({ key: index }, props, { className: css.css({
|
@@ -14473,22 +14417,17 @@ function WaterfallList(_a) {
|
|
14473
14417
|
* @Author: binruan@chatlabs.com
|
14474
14418
|
* @Date: 2024-01-10 10:58:24
|
14475
14419
|
* @LastEditors: binruan@chatlabs.com
|
14476
|
-
* @LastEditTime: 2024-10-
|
14420
|
+
* @LastEditTime: 2024-10-11 13:43:22
|
14477
14421
|
* @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\WaterFall\index.tsx
|
14478
14422
|
*
|
14479
14423
|
*/
|
14480
14424
|
const WaterFall = (props) => {
|
14481
14425
|
var _a;
|
14482
|
-
const { waterFallData, setOpenHashtag, openHashtag, swiperRef, setWaterFallData, cacheRtcList, setRtcList, cacheActiveIndex, rtcList, setCacheRtcList, setIsFromHashtag, isFromHashtag, bffEventReport, themeTag, selectTag
|
14426
|
+
const { waterFallData, setOpenHashtag, openHashtag, swiperRef, setWaterFallData, cacheRtcList, setRtcList, cacheActiveIndex, rtcList, setCacheRtcList, setIsFromHashtag, isFromHashtag, bffEventReport, themeTag, selectTag } = useSxpDataSource();
|
14483
14427
|
const { backMainFeed } = useEventReport();
|
14484
14428
|
React.useRef(null);
|
14485
14429
|
const modalEleRef = React.useRef(null);
|
14486
14430
|
const [viewTime, setViewTime] = React.useState();
|
14487
|
-
React.useEffect(() => {
|
14488
|
-
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
14489
|
-
eventName: 'PageView'
|
14490
|
-
});
|
14491
|
-
}, []);
|
14492
14431
|
React.useEffect(() => {
|
14493
14432
|
const parentNode = document.getElementById('sxp-render');
|
14494
14433
|
const node = document.getElementById('water-fall');
|
@@ -15863,18 +15802,17 @@ const VideoWidget$2 = ({ rec, index, height, data, muted, activeIndex, videoPost
|
|
15863
15802
|
};
|
15864
15803
|
}, [isActive]);
|
15865
15804
|
React.useEffect(() => {
|
15866
|
-
var _a, _b
|
15805
|
+
var _a, _b;
|
15867
15806
|
if (!(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) || !isLoadFinish)
|
15868
15807
|
return;
|
15869
15808
|
if (isActive) {
|
15870
15809
|
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
15871
|
-
eventName: 'ViewContent'
|
15872
|
-
product: (_b = (_a = data === null || data === void 0 ? void 0 : data[index]) === null || _a === void 0 ? void 0 : _a.video) === null || _b === void 0 ? void 0 : _b.bindProduct
|
15810
|
+
eventName: 'ViewContent'
|
15873
15811
|
});
|
15874
|
-
(
|
15812
|
+
(_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.play();
|
15875
15813
|
}
|
15876
15814
|
else {
|
15877
|
-
(
|
15815
|
+
(_b = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _b === void 0 ? void 0 : _b.pause();
|
15878
15816
|
}
|
15879
15817
|
}, [isActive, isLoadFinish, videoRef === null || videoRef === void 0 ? void 0 : videoRef.current]);
|
15880
15818
|
/*
|
@@ -15896,11 +15834,9 @@ const VideoWidget$2 = ({ rec, index, height, data, muted, activeIndex, videoPost
|
|
15896
15834
|
if (!isActive)
|
15897
15835
|
return;
|
15898
15836
|
const onShow = () => {
|
15899
|
-
var _a, _b;
|
15900
15837
|
handleClickVideo('start')();
|
15901
15838
|
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
15902
|
-
eventName: 'ViewContent'
|
15903
|
-
product: (_b = (_a = data === null || data === void 0 ? void 0 : data[index]) === null || _a === void 0 ? void 0 : _a.video) === null || _b === void 0 ? void 0 : _b.bindProduct
|
15839
|
+
eventName: 'ViewContent'
|
15904
15840
|
});
|
15905
15841
|
};
|
15906
15842
|
const onHide = handleClickVideo('pause');
|
@@ -16387,7 +16323,7 @@ var Tagbar$1 = React.memo(Tagbar);
|
|
16387
16323
|
* @Author: binruan@chatlabs.com
|
16388
16324
|
* @Date: 2024-01-15 19:03:09
|
16389
16325
|
* @LastEditors: binruan@chatlabs.com
|
16390
|
-
* @LastEditTime: 2024-10-
|
16326
|
+
* @LastEditTime: 2024-10-17 17:16:42
|
16391
16327
|
* @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\index.tsx
|
16392
16328
|
*
|
16393
16329
|
*/
|
@@ -16417,6 +16353,9 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
16417
16353
|
if ((data === null || data === void 0 ? void 0 : data.length) > 0) {
|
16418
16354
|
const now = new Date();
|
16419
16355
|
viewTime.current = now;
|
16356
|
+
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
16357
|
+
eventName: 'PageView'
|
16358
|
+
});
|
16420
16359
|
}
|
16421
16360
|
}, [data === null || data === void 0 ? void 0 : data.length]);
|
16422
16361
|
const handleH5EnterLink = React.useCallback(() => {
|
@@ -16425,8 +16364,11 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
16425
16364
|
if (data.length > 0) {
|
16426
16365
|
const now = new Date();
|
16427
16366
|
viewTime.current = now;
|
16367
|
+
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
16368
|
+
eventName: 'PageView'
|
16369
|
+
});
|
16428
16370
|
}
|
16429
|
-
}, [data.length, h5EnterLink]);
|
16371
|
+
}, [data.length, bffFbReport, h5EnterLink]);
|
16430
16372
|
React.useEffect(() => {
|
16431
16373
|
var _a;
|
16432
16374
|
if (!ctaType || (ctaType === null || ctaType === void 0 ? void 0 : ctaType.length) < 1)
|
@@ -16731,7 +16673,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
16731
16673
|
}
|
16732
16674
|
};
|
16733
16675
|
const handleScrollEvent = (swiper) => {
|
16734
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s
|
16676
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
16735
16677
|
const item = data[swiper.previousIndex];
|
16736
16678
|
if (!item)
|
16737
16679
|
return;
|
@@ -16778,8 +16720,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
16778
16720
|
const curItem = data[swiper.activeIndex];
|
16779
16721
|
if (!((_r = curItem === null || curItem === void 0 ? void 0 : curItem.video) === null || _r === void 0 ? void 0 : _r.url) && !((_s = curItem === null || curItem === void 0 ? void 0 : curItem.video) === null || _s === void 0 ? void 0 : _s.imgUrls) && (curItem === null || curItem === void 0 ? void 0 : curItem.product)) {
|
16780
16722
|
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
16781
|
-
eventName: 'ProductView'
|
16782
|
-
product: (_t = curItem === null || curItem === void 0 ? void 0 : curItem.video) === null || _t === void 0 ? void 0 : _t.bindProduct
|
16723
|
+
eventName: 'ProductView'
|
16783
16724
|
});
|
16784
16725
|
}
|
16785
16726
|
viewTime.current = new Date();
|
@@ -16800,7 +16741,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
16800
16741
|
}
|
16801
16742
|
}, [openHashtag, data, activeIndex]);
|
16802
16743
|
const handleViewImageStartEvent = (activeIndex) => {
|
16803
|
-
var _a, _b, _c, _d, _e, _f
|
16744
|
+
var _a, _b, _c, _d, _e, _f;
|
16804
16745
|
const item = data[activeIndex];
|
16805
16746
|
// 如果是图片集则上报事件
|
16806
16747
|
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)) {
|
@@ -16820,8 +16761,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
16820
16761
|
}
|
16821
16762
|
});
|
16822
16763
|
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
16823
|
-
eventName: 'ViewContent'
|
16824
|
-
product: (_g = item === null || item === void 0 ? void 0 : item.video) === null || _g === void 0 ? void 0 : _g.bindProduct
|
16764
|
+
eventName: 'ViewContent'
|
16825
16765
|
});
|
16826
16766
|
}
|
16827
16767
|
};
|