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/pb-ui.js
CHANGED
@@ -812,23 +812,64 @@
|
|
812
812
|
type: 'beacon'
|
813
813
|
});
|
814
814
|
}, [bffFetch, curReqInfo, enableReportEvent, globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview]);
|
815
|
-
const bffFbReport = React.useCallback((
|
816
|
-
var _b, _c, _d;
|
817
|
-
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;
|
815
|
+
const bffFbReport = React.useCallback(({ eventName, product }) => {
|
816
|
+
var _a, _b, _c, _d;
|
818
817
|
if (!enableReportEvent || !enabledMetaConversionApi || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview)) {
|
819
818
|
return;
|
820
819
|
}
|
821
|
-
|
820
|
+
let jsonParams = (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.converApi) === null || _a === void 0 ? void 0 : _a[eventName];
|
822
821
|
const urlParams = new URLSearchParams(window.location.search);
|
823
|
-
const fbclid = urlParams.get('fbclid');
|
822
|
+
const fbclid = urlParams === null || urlParams === void 0 ? void 0 : urlParams.get('fbclid');
|
823
|
+
const fix_par = {
|
824
|
+
event_source_url: (_b = window === null || window === void 0 ? void 0 : window.location) === null || _b === void 0 ? void 0 : _b.href,
|
825
|
+
external_id: storeAndLoadFeUserId(),
|
826
|
+
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 : '',
|
827
|
+
fbc: fbclid ? `fb.2.${new Date().getTime()}.${fbclid}` : '',
|
828
|
+
fbp: getCookie('_fbp') ? `fb.2.${new Date().getTime()}.${getCookie('_fbp')}` : '',
|
829
|
+
time: new Date().getTime()
|
830
|
+
};
|
831
|
+
const regex = /\{\{(.*?)\}\}/g;
|
832
|
+
const getEventParams = (obj) => {
|
833
|
+
if (!obj)
|
834
|
+
return;
|
835
|
+
if (obj instanceof Array) {
|
836
|
+
obj === null || obj === void 0 ? void 0 : obj.map((item) => getEventParams(item));
|
837
|
+
}
|
838
|
+
else {
|
839
|
+
for (const key in obj) {
|
840
|
+
if (obj.hasOwnProperty(key)) {
|
841
|
+
const value = obj === null || obj === void 0 ? void 0 : obj[key];
|
842
|
+
if (typeof value === 'object') {
|
843
|
+
getEventParams(value);
|
844
|
+
}
|
845
|
+
else if (typeof value === 'string') {
|
846
|
+
const matches = value === null || value === void 0 ? void 0 : value.match(regex);
|
847
|
+
if (matches) {
|
848
|
+
matches.forEach((match) => {
|
849
|
+
const prop = match.substring(2, match.length - 2);
|
850
|
+
try {
|
851
|
+
const replaceValue = new Function('fix_par', 'product', `return ${prop}`)(fix_par, product);
|
852
|
+
if (replaceValue) {
|
853
|
+
obj[key] = replaceValue;
|
854
|
+
}
|
855
|
+
else {
|
856
|
+
delete obj[key];
|
857
|
+
}
|
858
|
+
}
|
859
|
+
catch (error) {
|
860
|
+
console.error('An error occurred:', error === null || error === void 0 ? void 0 : error.message);
|
861
|
+
}
|
862
|
+
});
|
863
|
+
}
|
864
|
+
}
|
865
|
+
}
|
866
|
+
}
|
867
|
+
}
|
868
|
+
};
|
869
|
+
getEventParams(jsonParams);
|
824
870
|
return bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/fb/events', {
|
825
871
|
method: 'POST',
|
826
|
-
body:
|
827
|
-
eventName,
|
828
|
-
actionSource,
|
829
|
-
eventSourceUrl,
|
830
|
-
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 : '' })
|
831
|
-
},
|
872
|
+
body: jsonParams,
|
832
873
|
type: 'beacon'
|
833
874
|
});
|
834
875
|
}, [bffFetch, enableReportEvent, enabledMetaConversionApi, globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview]);
|
@@ -9357,9 +9398,14 @@
|
|
9357
9398
|
React.useEffect(() => {
|
9358
9399
|
if (!isPost) {
|
9359
9400
|
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
9360
|
-
eventName: 'ProductView'
|
9401
|
+
eventName: 'ProductView',
|
9402
|
+
product
|
9361
9403
|
});
|
9362
9404
|
}
|
9405
|
+
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
9406
|
+
eventName: 'PageView',
|
9407
|
+
product
|
9408
|
+
});
|
9363
9409
|
}, [isPost, bffFbReport]);
|
9364
9410
|
React.useEffect(() => {
|
9365
9411
|
const initTime = () => {
|
@@ -10238,7 +10284,12 @@
|
|
10238
10284
|
React.useEffect(() => {
|
10239
10285
|
if (!isPost) {
|
10240
10286
|
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
10241
|
-
eventName: 'ProductView'
|
10287
|
+
eventName: 'ProductView',
|
10288
|
+
product
|
10289
|
+
});
|
10290
|
+
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
10291
|
+
eventName: 'PageView',
|
10292
|
+
product
|
10242
10293
|
});
|
10243
10294
|
}
|
10244
10295
|
}, [isPost, bffFbReport]);
|
@@ -10863,7 +10914,7 @@ Made in Italy` })));
|
|
10863
10914
|
const CommodityList$1 = (_a) => {
|
10864
10915
|
var _b, _c, _d;
|
10865
10916
|
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"]);
|
10866
|
-
const { sxpParameter, popupDetailData, setPopupDetailData, ctaEvent, globalConfig } = useSxpDataSource();
|
10917
|
+
const { sxpParameter, popupDetailData, setPopupDetailData, ctaEvent, globalConfig, bffFbReport } = useSxpDataSource();
|
10867
10918
|
const { jumpToWeb } = useEventReport();
|
10868
10919
|
const { popup } = useEditor();
|
10869
10920
|
const recData = isPost ? rec : popupDetailData;
|
@@ -10893,6 +10944,11 @@ Made in Italy` })));
|
|
10893
10944
|
onClick === null || onClick === void 0 ? void 0 : onClick();
|
10894
10945
|
}
|
10895
10946
|
}, popup === null || popup === void 0 ? void 0 : popup.duration);
|
10947
|
+
React.useEffect(() => {
|
10948
|
+
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
10949
|
+
eventName: 'PageView'
|
10950
|
+
});
|
10951
|
+
}, []);
|
10896
10952
|
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) => {
|
10897
10953
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
10898
10954
|
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({
|
@@ -14410,17 +14466,22 @@ Made in Italy` })));
|
|
14410
14466
|
* @Author: binruan@chatlabs.com
|
14411
14467
|
* @Date: 2024-01-10 10:58:24
|
14412
14468
|
* @LastEditors: binruan@chatlabs.com
|
14413
|
-
* @LastEditTime: 2024-10-
|
14469
|
+
* @LastEditTime: 2024-10-18 18:59:47
|
14414
14470
|
* @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\WaterFall\index.tsx
|
14415
14471
|
*
|
14416
14472
|
*/
|
14417
14473
|
const WaterFall = (props) => {
|
14418
14474
|
var _a;
|
14419
|
-
const { waterFallData, setOpenHashtag, openHashtag, swiperRef, setWaterFallData, cacheRtcList, setRtcList, cacheActiveIndex, rtcList, setCacheRtcList, setIsFromHashtag, isFromHashtag, bffEventReport, themeTag, selectTag } = useSxpDataSource();
|
14475
|
+
const { waterFallData, setOpenHashtag, openHashtag, swiperRef, setWaterFallData, cacheRtcList, setRtcList, cacheActiveIndex, rtcList, setCacheRtcList, setIsFromHashtag, isFromHashtag, bffEventReport, themeTag, selectTag, bffFbReport } = useSxpDataSource();
|
14420
14476
|
const { backMainFeed } = useEventReport();
|
14421
14477
|
React.useRef(null);
|
14422
14478
|
const modalEleRef = React.useRef(null);
|
14423
14479
|
const [viewTime, setViewTime] = React.useState();
|
14480
|
+
React.useEffect(() => {
|
14481
|
+
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
14482
|
+
eventName: 'PageView'
|
14483
|
+
});
|
14484
|
+
}, []);
|
14424
14485
|
React.useEffect(() => {
|
14425
14486
|
const parentNode = document.getElementById('sxp-render');
|
14426
14487
|
const node = document.getElementById('water-fall');
|
@@ -15795,17 +15856,18 @@ Made in Italy` })));
|
|
15795
15856
|
};
|
15796
15857
|
}, [isActive]);
|
15797
15858
|
React.useEffect(() => {
|
15798
|
-
var _a, _b;
|
15859
|
+
var _a, _b, _c, _d;
|
15799
15860
|
if (!(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) || !isLoadFinish)
|
15800
15861
|
return;
|
15801
15862
|
if (isActive) {
|
15802
15863
|
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
15803
|
-
eventName: 'ViewContent'
|
15864
|
+
eventName: 'ViewContent',
|
15865
|
+
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
|
15804
15866
|
});
|
15805
|
-
(
|
15867
|
+
(_c = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _c === void 0 ? void 0 : _c.play();
|
15806
15868
|
}
|
15807
15869
|
else {
|
15808
|
-
(
|
15870
|
+
(_d = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _d === void 0 ? void 0 : _d.pause();
|
15809
15871
|
}
|
15810
15872
|
}, [isActive, isLoadFinish, videoRef === null || videoRef === void 0 ? void 0 : videoRef.current]);
|
15811
15873
|
/*
|
@@ -15827,9 +15889,11 @@ Made in Italy` })));
|
|
15827
15889
|
if (!isActive)
|
15828
15890
|
return;
|
15829
15891
|
const onShow = () => {
|
15892
|
+
var _a, _b;
|
15830
15893
|
handleClickVideo('start')();
|
15831
15894
|
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
15832
|
-
eventName: 'ViewContent'
|
15895
|
+
eventName: 'ViewContent',
|
15896
|
+
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
|
15833
15897
|
});
|
15834
15898
|
};
|
15835
15899
|
const onHide = handleClickVideo('pause');
|
@@ -16316,7 +16380,7 @@ Made in Italy` })));
|
|
16316
16380
|
* @Author: binruan@chatlabs.com
|
16317
16381
|
* @Date: 2024-01-15 19:03:09
|
16318
16382
|
* @LastEditors: binruan@chatlabs.com
|
16319
|
-
* @LastEditTime: 2024-10-
|
16383
|
+
* @LastEditTime: 2024-10-18 18:54:40
|
16320
16384
|
* @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\index.tsx
|
16321
16385
|
*
|
16322
16386
|
*/
|
@@ -16346,9 +16410,6 @@ Made in Italy` })));
|
|
16346
16410
|
if ((data === null || data === void 0 ? void 0 : data.length) > 0) {
|
16347
16411
|
const now = new Date();
|
16348
16412
|
viewTime.current = now;
|
16349
|
-
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
16350
|
-
eventName: 'PageView'
|
16351
|
-
});
|
16352
16413
|
}
|
16353
16414
|
}, [data === null || data === void 0 ? void 0 : data.length]);
|
16354
16415
|
const handleH5EnterLink = React.useCallback(() => {
|
@@ -16357,11 +16418,8 @@ Made in Italy` })));
|
|
16357
16418
|
if (data.length > 0) {
|
16358
16419
|
const now = new Date();
|
16359
16420
|
viewTime.current = now;
|
16360
|
-
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
16361
|
-
eventName: 'PageView'
|
16362
|
-
});
|
16363
16421
|
}
|
16364
|
-
}, [data.length,
|
16422
|
+
}, [data.length, h5EnterLink]);
|
16365
16423
|
React.useEffect(() => {
|
16366
16424
|
var _a;
|
16367
16425
|
if (!ctaType || (ctaType === null || ctaType === void 0 ? void 0 : ctaType.length) < 1)
|
@@ -16666,7 +16724,7 @@ Made in Italy` })));
|
|
16666
16724
|
}
|
16667
16725
|
};
|
16668
16726
|
const handleScrollEvent = (swiper) => {
|
16669
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
16727
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
16670
16728
|
const item = data[swiper.previousIndex];
|
16671
16729
|
if (!item)
|
16672
16730
|
return;
|
@@ -16713,7 +16771,8 @@ Made in Italy` })));
|
|
16713
16771
|
const curItem = data[swiper.activeIndex];
|
16714
16772
|
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)) {
|
16715
16773
|
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
16716
|
-
eventName: 'ProductView'
|
16774
|
+
eventName: 'ProductView',
|
16775
|
+
product: (_t = curItem === null || curItem === void 0 ? void 0 : curItem.video) === null || _t === void 0 ? void 0 : _t.bindProduct
|
16717
16776
|
});
|
16718
16777
|
}
|
16719
16778
|
viewTime.current = new Date();
|
@@ -16734,7 +16793,7 @@ Made in Italy` })));
|
|
16734
16793
|
}
|
16735
16794
|
}, [openHashtag, data, activeIndex]);
|
16736
16795
|
const handleViewImageStartEvent = (activeIndex) => {
|
16737
|
-
var _a, _b, _c, _d, _e, _f;
|
16796
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
16738
16797
|
const item = data[activeIndex];
|
16739
16798
|
// 如果是图片集则上报事件
|
16740
16799
|
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)) {
|
@@ -16754,7 +16813,8 @@ Made in Italy` })));
|
|
16754
16813
|
}
|
16755
16814
|
});
|
16756
16815
|
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
16757
|
-
eventName: 'ViewContent'
|
16816
|
+
eventName: 'ViewContent',
|
16817
|
+
product: (_g = item === null || item === void 0 ? void 0 : item.video) === null || _g === void 0 ? void 0 : _g.bindProduct
|
16758
16818
|
});
|
16759
16819
|
}
|
16760
16820
|
};
|