pb-sxp-ui 1.6.6 → 1.7.0
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 +93 -33
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +93 -33
- 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 +93 -33
- 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 +8 -5
- package/es/core/components/SxpPageRender/WaterFall/index.js +6 -1
- package/es/core/components/SxpPageRender/index.d.ts +1 -0
- package/es/core/components/SxpPageRender/index.js +7 -11
- package/es/core/context/SxpDataSourceProvider.d.ts +2 -4
- package/es/core/context/SxpDataSourceProvider.js +52 -11
- package/es/materials/sxp/popup/CommodityDetail/index.js +6 -1
- package/es/materials/sxp/popup/CommodityDetailDiro/index.js +6 -1
- package/es/materials/sxp/popup/CommodityDetailDiroNew/index.js +6 -1
- package/es/materials/sxp/popup/CommodityList/index.js +7 -2
- package/lib/core/components/SxpPageRender/VideoWidget/index.js +8 -5
- package/lib/core/components/SxpPageRender/WaterFall/index.js +6 -1
- package/lib/core/components/SxpPageRender/index.d.ts +1 -0
- package/lib/core/components/SxpPageRender/index.js +7 -11
- package/lib/core/context/SxpDataSourceProvider.d.ts +2 -4
- package/lib/core/context/SxpDataSourceProvider.js +52 -11
- package/lib/materials/sxp/popup/CommodityDetail/index.js +6 -1
- package/lib/materials/sxp/popup/CommodityDetailDiro/index.js +6 -1
- package/lib/materials/sxp/popup/CommodityDetailDiroNew/index.js +6 -1
- package/lib/materials/sxp/popup/CommodityList/index.js +6 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
@@ -819,23 +819,64 @@ 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 _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;
|
822
|
+
const bffFbReport = React.useCallback(({ eventName, product }) => {
|
823
|
+
var _a, _b, _c, _d;
|
825
824
|
if (!enableReportEvent || !enabledMetaConversionApi || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview)) {
|
826
825
|
return;
|
827
826
|
}
|
828
|
-
|
827
|
+
let jsonParams = (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.converApi) === null || _a === void 0 ? void 0 : _a[eventName];
|
829
828
|
const urlParams = new URLSearchParams(window.location.search);
|
830
|
-
const fbclid = urlParams.get('fbclid');
|
829
|
+
const fbclid = urlParams === null || urlParams === void 0 ? void 0 : urlParams.get('fbclid');
|
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);
|
831
877
|
return bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/fb/events', {
|
832
878
|
method: 'POST',
|
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
|
-
},
|
879
|
+
body: jsonParams,
|
839
880
|
type: 'beacon'
|
840
881
|
});
|
841
882
|
}, [bffFetch, enableReportEvent, enabledMetaConversionApi, globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview]);
|
@@ -9364,9 +9405,14 @@ const CommodityDetail$1 = (_a) => {
|
|
9364
9405
|
React.useEffect(() => {
|
9365
9406
|
if (!isPost) {
|
9366
9407
|
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
9367
|
-
eventName: 'ProductView'
|
9408
|
+
eventName: 'ProductView',
|
9409
|
+
product
|
9368
9410
|
});
|
9369
9411
|
}
|
9412
|
+
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
9413
|
+
eventName: 'PageView',
|
9414
|
+
product
|
9415
|
+
});
|
9370
9416
|
}, [isPost, bffFbReport]);
|
9371
9417
|
React.useEffect(() => {
|
9372
9418
|
const initTime = () => {
|
@@ -10245,7 +10291,12 @@ const CommodityDetailDiroNew$1 = (_a) => {
|
|
10245
10291
|
React.useEffect(() => {
|
10246
10292
|
if (!isPost) {
|
10247
10293
|
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
10248
|
-
eventName: 'ProductView'
|
10294
|
+
eventName: 'ProductView',
|
10295
|
+
product
|
10296
|
+
});
|
10297
|
+
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
10298
|
+
eventName: 'PageView',
|
10299
|
+
product
|
10249
10300
|
});
|
10250
10301
|
}
|
10251
10302
|
}, [isPost, bffFbReport]);
|
@@ -10870,7 +10921,7 @@ var Img$1 = React.memo(Img);
|
|
10870
10921
|
const CommodityList$1 = (_a) => {
|
10871
10922
|
var _b, _c, _d;
|
10872
10923
|
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"]);
|
10873
|
-
const { sxpParameter, popupDetailData, setPopupDetailData, ctaEvent, globalConfig } = useSxpDataSource();
|
10924
|
+
const { sxpParameter, popupDetailData, setPopupDetailData, ctaEvent, globalConfig, bffFbReport } = useSxpDataSource();
|
10874
10925
|
const { jumpToWeb } = useEventReport();
|
10875
10926
|
const { popup } = useEditor();
|
10876
10927
|
const recData = isPost ? rec : popupDetailData;
|
@@ -10900,6 +10951,11 @@ const CommodityList$1 = (_a) => {
|
|
10900
10951
|
onClick === null || onClick === void 0 ? void 0 : onClick();
|
10901
10952
|
}
|
10902
10953
|
}, 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
|
+
}, []);
|
10903
10959
|
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) => {
|
10904
10960
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
10905
10961
|
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({
|
@@ -14417,17 +14473,22 @@ function WaterfallList(_a) {
|
|
14417
14473
|
* @Author: binruan@chatlabs.com
|
14418
14474
|
* @Date: 2024-01-10 10:58:24
|
14419
14475
|
* @LastEditors: binruan@chatlabs.com
|
14420
|
-
* @LastEditTime: 2024-10-
|
14476
|
+
* @LastEditTime: 2024-10-18 18:59:47
|
14421
14477
|
* @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\WaterFall\index.tsx
|
14422
14478
|
*
|
14423
14479
|
*/
|
14424
14480
|
const WaterFall = (props) => {
|
14425
14481
|
var _a;
|
14426
|
-
const { waterFallData, setOpenHashtag, openHashtag, swiperRef, setWaterFallData, cacheRtcList, setRtcList, cacheActiveIndex, rtcList, setCacheRtcList, setIsFromHashtag, isFromHashtag, bffEventReport, themeTag, selectTag } = useSxpDataSource();
|
14482
|
+
const { waterFallData, setOpenHashtag, openHashtag, swiperRef, setWaterFallData, cacheRtcList, setRtcList, cacheActiveIndex, rtcList, setCacheRtcList, setIsFromHashtag, isFromHashtag, bffEventReport, themeTag, selectTag, bffFbReport } = useSxpDataSource();
|
14427
14483
|
const { backMainFeed } = useEventReport();
|
14428
14484
|
React.useRef(null);
|
14429
14485
|
const modalEleRef = React.useRef(null);
|
14430
14486
|
const [viewTime, setViewTime] = React.useState();
|
14487
|
+
React.useEffect(() => {
|
14488
|
+
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
14489
|
+
eventName: 'PageView'
|
14490
|
+
});
|
14491
|
+
}, []);
|
14431
14492
|
React.useEffect(() => {
|
14432
14493
|
const parentNode = document.getElementById('sxp-render');
|
14433
14494
|
const node = document.getElementById('water-fall');
|
@@ -15802,17 +15863,18 @@ const VideoWidget$2 = ({ rec, index, height, data, muted, activeIndex, videoPost
|
|
15802
15863
|
};
|
15803
15864
|
}, [isActive]);
|
15804
15865
|
React.useEffect(() => {
|
15805
|
-
var _a, _b;
|
15866
|
+
var _a, _b, _c, _d;
|
15806
15867
|
if (!(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) || !isLoadFinish)
|
15807
15868
|
return;
|
15808
15869
|
if (isActive) {
|
15809
15870
|
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
15810
|
-
eventName: 'ViewContent'
|
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
|
15811
15873
|
});
|
15812
|
-
(
|
15874
|
+
(_c = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _c === void 0 ? void 0 : _c.play();
|
15813
15875
|
}
|
15814
15876
|
else {
|
15815
|
-
(
|
15877
|
+
(_d = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _d === void 0 ? void 0 : _d.pause();
|
15816
15878
|
}
|
15817
15879
|
}, [isActive, isLoadFinish, videoRef === null || videoRef === void 0 ? void 0 : videoRef.current]);
|
15818
15880
|
/*
|
@@ -15834,9 +15896,11 @@ const VideoWidget$2 = ({ rec, index, height, data, muted, activeIndex, videoPost
|
|
15834
15896
|
if (!isActive)
|
15835
15897
|
return;
|
15836
15898
|
const onShow = () => {
|
15899
|
+
var _a, _b;
|
15837
15900
|
handleClickVideo('start')();
|
15838
15901
|
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
15839
|
-
eventName: 'ViewContent'
|
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
|
15840
15904
|
});
|
15841
15905
|
};
|
15842
15906
|
const onHide = handleClickVideo('pause');
|
@@ -16323,7 +16387,7 @@ var Tagbar$1 = React.memo(Tagbar);
|
|
16323
16387
|
* @Author: binruan@chatlabs.com
|
16324
16388
|
* @Date: 2024-01-15 19:03:09
|
16325
16389
|
* @LastEditors: binruan@chatlabs.com
|
16326
|
-
* @LastEditTime: 2024-10-
|
16390
|
+
* @LastEditTime: 2024-10-18 18:54:40
|
16327
16391
|
* @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\index.tsx
|
16328
16392
|
*
|
16329
16393
|
*/
|
@@ -16353,9 +16417,6 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
16353
16417
|
if ((data === null || data === void 0 ? void 0 : data.length) > 0) {
|
16354
16418
|
const now = new Date();
|
16355
16419
|
viewTime.current = now;
|
16356
|
-
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
16357
|
-
eventName: 'PageView'
|
16358
|
-
});
|
16359
16420
|
}
|
16360
16421
|
}, [data === null || data === void 0 ? void 0 : data.length]);
|
16361
16422
|
const handleH5EnterLink = React.useCallback(() => {
|
@@ -16364,11 +16425,8 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
16364
16425
|
if (data.length > 0) {
|
16365
16426
|
const now = new Date();
|
16366
16427
|
viewTime.current = now;
|
16367
|
-
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
16368
|
-
eventName: 'PageView'
|
16369
|
-
});
|
16370
16428
|
}
|
16371
|
-
}, [data.length,
|
16429
|
+
}, [data.length, h5EnterLink]);
|
16372
16430
|
React.useEffect(() => {
|
16373
16431
|
var _a;
|
16374
16432
|
if (!ctaType || (ctaType === null || ctaType === void 0 ? void 0 : ctaType.length) < 1)
|
@@ -16673,7 +16731,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
16673
16731
|
}
|
16674
16732
|
};
|
16675
16733
|
const handleScrollEvent = (swiper) => {
|
16676
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
16734
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
16677
16735
|
const item = data[swiper.previousIndex];
|
16678
16736
|
if (!item)
|
16679
16737
|
return;
|
@@ -16720,7 +16778,8 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
16720
16778
|
const curItem = data[swiper.activeIndex];
|
16721
16779
|
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)) {
|
16722
16780
|
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
16723
|
-
eventName: 'ProductView'
|
16781
|
+
eventName: 'ProductView',
|
16782
|
+
product: (_t = curItem === null || curItem === void 0 ? void 0 : curItem.video) === null || _t === void 0 ? void 0 : _t.bindProduct
|
16724
16783
|
});
|
16725
16784
|
}
|
16726
16785
|
viewTime.current = new Date();
|
@@ -16741,7 +16800,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
16741
16800
|
}
|
16742
16801
|
}, [openHashtag, data, activeIndex]);
|
16743
16802
|
const handleViewImageStartEvent = (activeIndex) => {
|
16744
|
-
var _a, _b, _c, _d, _e, _f;
|
16803
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
16745
16804
|
const item = data[activeIndex];
|
16746
16805
|
// 如果是图片集则上报事件
|
16747
16806
|
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)) {
|
@@ -16761,7 +16820,8 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
16761
16820
|
}
|
16762
16821
|
});
|
16763
16822
|
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
16764
|
-
eventName: 'ViewContent'
|
16823
|
+
eventName: 'ViewContent',
|
16824
|
+
product: (_g = item === null || item === void 0 ? void 0 : item.video) === null || _g === void 0 ? void 0 : _g.bindProduct
|
16765
16825
|
});
|
16766
16826
|
}
|
16767
16827
|
};
|