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.css
CHANGED
package/dist/index.js
CHANGED
@@ -797,64 +797,23 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
797
797
|
type: 'beacon'
|
798
798
|
});
|
799
799
|
}, [bffFetch, curReqInfo, enableReportEvent, globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview]);
|
800
|
-
const bffFbReport = useCallback((
|
801
|
-
var
|
800
|
+
const bffFbReport = useCallback((_a) => {
|
801
|
+
var _b, _c, _d;
|
802
|
+
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;
|
802
803
|
if (!enableReportEvent || !enabledMetaConversionApi || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview)) {
|
803
804
|
return;
|
804
805
|
}
|
805
|
-
|
806
|
+
const fakeUserId = storeAndLoadFeUserId();
|
806
807
|
const urlParams = new URLSearchParams(window.location.search);
|
807
|
-
const fbclid = urlParams
|
808
|
-
const fix_par = {
|
809
|
-
event_source_url: (_b = window === null || window === void 0 ? void 0 : window.location) === null || _b === void 0 ? void 0 : _b.href,
|
810
|
-
external_id: storeAndLoadFeUserId(),
|
811
|
-
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 : '',
|
812
|
-
fbc: fbclid ? `fb.2.${new Date().getTime()}.${fbclid}` : '',
|
813
|
-
fbp: getCookie('_fbp') ? `fb.2.${new Date().getTime()}.${getCookie('_fbp')}` : '',
|
814
|
-
time: new Date().getTime()
|
815
|
-
};
|
816
|
-
const regex = /\{\{(.*?)\}\}/g;
|
817
|
-
const getEventParams = (obj) => {
|
818
|
-
if (!obj)
|
819
|
-
return;
|
820
|
-
if (obj instanceof Array) {
|
821
|
-
obj === null || obj === void 0 ? void 0 : obj.map((item) => getEventParams(item));
|
822
|
-
}
|
823
|
-
else {
|
824
|
-
for (const key in obj) {
|
825
|
-
if (obj.hasOwnProperty(key)) {
|
826
|
-
const value = obj === null || obj === void 0 ? void 0 : obj[key];
|
827
|
-
if (typeof value === 'object') {
|
828
|
-
getEventParams(value);
|
829
|
-
}
|
830
|
-
else if (typeof value === 'string') {
|
831
|
-
const matches = value === null || value === void 0 ? void 0 : value.match(regex);
|
832
|
-
if (matches) {
|
833
|
-
matches.forEach((match) => {
|
834
|
-
const prop = match.substring(2, match.length - 2);
|
835
|
-
try {
|
836
|
-
const replaceValue = new Function('fix_par', 'product', `return ${prop}`)(fix_par, product);
|
837
|
-
if (replaceValue) {
|
838
|
-
obj[key] = replaceValue;
|
839
|
-
}
|
840
|
-
else {
|
841
|
-
delete obj[key];
|
842
|
-
}
|
843
|
-
}
|
844
|
-
catch (error) {
|
845
|
-
console.error('An error occurred:', error === null || error === void 0 ? void 0 : error.message);
|
846
|
-
}
|
847
|
-
});
|
848
|
-
}
|
849
|
-
}
|
850
|
-
}
|
851
|
-
}
|
852
|
-
}
|
853
|
-
};
|
854
|
-
getEventParams(jsonParams);
|
808
|
+
const fbclid = urlParams.get('fbclid');
|
855
809
|
return bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/fb/events', {
|
856
810
|
method: 'POST',
|
857
|
-
body:
|
811
|
+
body: {
|
812
|
+
eventName,
|
813
|
+
actionSource,
|
814
|
+
eventSourceUrl,
|
815
|
+
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 : '' })
|
816
|
+
},
|
858
817
|
type: 'beacon'
|
859
818
|
});
|
860
819
|
}, [bffFetch, enableReportEvent, enabledMetaConversionApi, globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview]);
|
@@ -9383,14 +9342,9 @@ const CommodityDetail$1 = (_a) => {
|
|
9383
9342
|
useEffect(() => {
|
9384
9343
|
if (!isPost) {
|
9385
9344
|
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
9386
|
-
eventName: 'ProductView'
|
9387
|
-
product
|
9345
|
+
eventName: 'ProductView'
|
9388
9346
|
});
|
9389
9347
|
}
|
9390
|
-
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
9391
|
-
eventName: 'PageView',
|
9392
|
-
product
|
9393
|
-
});
|
9394
9348
|
}, [isPost, bffFbReport]);
|
9395
9349
|
useEffect(() => {
|
9396
9350
|
const initTime = () => {
|
@@ -10269,12 +10223,7 @@ const CommodityDetailDiroNew$1 = (_a) => {
|
|
10269
10223
|
useEffect(() => {
|
10270
10224
|
if (!isPost) {
|
10271
10225
|
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
10272
|
-
eventName: 'ProductView'
|
10273
|
-
product
|
10274
|
-
});
|
10275
|
-
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
10276
|
-
eventName: 'PageView',
|
10277
|
-
product
|
10226
|
+
eventName: 'ProductView'
|
10278
10227
|
});
|
10279
10228
|
}
|
10280
10229
|
}, [isPost, bffFbReport]);
|
@@ -10899,7 +10848,7 @@ var Img$1 = memo(Img);
|
|
10899
10848
|
const CommodityList$1 = (_a) => {
|
10900
10849
|
var _b, _c, _d;
|
10901
10850
|
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"]);
|
10902
|
-
const { sxpParameter, popupDetailData, setPopupDetailData, ctaEvent, globalConfig
|
10851
|
+
const { sxpParameter, popupDetailData, setPopupDetailData, ctaEvent, globalConfig } = useSxpDataSource();
|
10903
10852
|
const { jumpToWeb } = useEventReport();
|
10904
10853
|
const { popup } = useEditor();
|
10905
10854
|
const recData = isPost ? rec : popupDetailData;
|
@@ -10929,11 +10878,6 @@ const CommodityList$1 = (_a) => {
|
|
10929
10878
|
onClick === null || onClick === void 0 ? void 0 : onClick();
|
10930
10879
|
}
|
10931
10880
|
}, popup === null || popup === void 0 ? void 0 : popup.duration);
|
10932
|
-
useEffect(() => {
|
10933
|
-
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
10934
|
-
eventName: 'PageView'
|
10935
|
-
});
|
10936
|
-
}, []);
|
10937
10881
|
return (React.createElement("div", { className: 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) => {
|
10938
10882
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
10939
10883
|
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({
|
@@ -14451,22 +14395,17 @@ function WaterfallList(_a) {
|
|
14451
14395
|
* @Author: binruan@chatlabs.com
|
14452
14396
|
* @Date: 2024-01-10 10:58:24
|
14453
14397
|
* @LastEditors: binruan@chatlabs.com
|
14454
|
-
* @LastEditTime: 2024-10-
|
14398
|
+
* @LastEditTime: 2024-10-11 13:43:22
|
14455
14399
|
* @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\WaterFall\index.tsx
|
14456
14400
|
*
|
14457
14401
|
*/
|
14458
14402
|
const WaterFall = (props) => {
|
14459
14403
|
var _a;
|
14460
|
-
const { waterFallData, setOpenHashtag, openHashtag, swiperRef, setWaterFallData, cacheRtcList, setRtcList, cacheActiveIndex, rtcList, setCacheRtcList, setIsFromHashtag, isFromHashtag, bffEventReport, themeTag, selectTag
|
14404
|
+
const { waterFallData, setOpenHashtag, openHashtag, swiperRef, setWaterFallData, cacheRtcList, setRtcList, cacheActiveIndex, rtcList, setCacheRtcList, setIsFromHashtag, isFromHashtag, bffEventReport, themeTag, selectTag } = useSxpDataSource();
|
14461
14405
|
const { backMainFeed } = useEventReport();
|
14462
14406
|
useRef(null);
|
14463
14407
|
const modalEleRef = useRef(null);
|
14464
14408
|
const [viewTime, setViewTime] = useState();
|
14465
|
-
useEffect(() => {
|
14466
|
-
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
14467
|
-
eventName: 'PageView'
|
14468
|
-
});
|
14469
|
-
}, []);
|
14470
14409
|
useEffect(() => {
|
14471
14410
|
const parentNode = document.getElementById('sxp-render');
|
14472
14411
|
const node = document.getElementById('water-fall');
|
@@ -15841,18 +15780,17 @@ const VideoWidget$2 = ({ rec, index, height, data, muted, activeIndex, videoPost
|
|
15841
15780
|
};
|
15842
15781
|
}, [isActive]);
|
15843
15782
|
useEffect(() => {
|
15844
|
-
var _a, _b
|
15783
|
+
var _a, _b;
|
15845
15784
|
if (!(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) || !isLoadFinish)
|
15846
15785
|
return;
|
15847
15786
|
if (isActive) {
|
15848
15787
|
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
15849
|
-
eventName: 'ViewContent'
|
15850
|
-
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
|
15788
|
+
eventName: 'ViewContent'
|
15851
15789
|
});
|
15852
|
-
(
|
15790
|
+
(_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.play();
|
15853
15791
|
}
|
15854
15792
|
else {
|
15855
|
-
(
|
15793
|
+
(_b = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _b === void 0 ? void 0 : _b.pause();
|
15856
15794
|
}
|
15857
15795
|
}, [isActive, isLoadFinish, videoRef === null || videoRef === void 0 ? void 0 : videoRef.current]);
|
15858
15796
|
/*
|
@@ -15874,11 +15812,9 @@ const VideoWidget$2 = ({ rec, index, height, data, muted, activeIndex, videoPost
|
|
15874
15812
|
if (!isActive)
|
15875
15813
|
return;
|
15876
15814
|
const onShow = () => {
|
15877
|
-
var _a, _b;
|
15878
15815
|
handleClickVideo('start')();
|
15879
15816
|
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
15880
|
-
eventName: 'ViewContent'
|
15881
|
-
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
|
15817
|
+
eventName: 'ViewContent'
|
15882
15818
|
});
|
15883
15819
|
};
|
15884
15820
|
const onHide = handleClickVideo('pause');
|
@@ -16365,7 +16301,7 @@ var Tagbar$1 = memo(Tagbar);
|
|
16365
16301
|
* @Author: binruan@chatlabs.com
|
16366
16302
|
* @Date: 2024-01-15 19:03:09
|
16367
16303
|
* @LastEditors: binruan@chatlabs.com
|
16368
|
-
* @LastEditTime: 2024-10-
|
16304
|
+
* @LastEditTime: 2024-10-17 17:16:42
|
16369
16305
|
* @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\index.tsx
|
16370
16306
|
*
|
16371
16307
|
*/
|
@@ -16395,6 +16331,9 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
16395
16331
|
if ((data === null || data === void 0 ? void 0 : data.length) > 0) {
|
16396
16332
|
const now = new Date();
|
16397
16333
|
viewTime.current = now;
|
16334
|
+
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
16335
|
+
eventName: 'PageView'
|
16336
|
+
});
|
16398
16337
|
}
|
16399
16338
|
}, [data === null || data === void 0 ? void 0 : data.length]);
|
16400
16339
|
const handleH5EnterLink = useCallback(() => {
|
@@ -16403,8 +16342,11 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
16403
16342
|
if (data.length > 0) {
|
16404
16343
|
const now = new Date();
|
16405
16344
|
viewTime.current = now;
|
16345
|
+
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
16346
|
+
eventName: 'PageView'
|
16347
|
+
});
|
16406
16348
|
}
|
16407
|
-
}, [data.length, h5EnterLink]);
|
16349
|
+
}, [data.length, bffFbReport, h5EnterLink]);
|
16408
16350
|
useEffect(() => {
|
16409
16351
|
var _a;
|
16410
16352
|
if (!ctaType || (ctaType === null || ctaType === void 0 ? void 0 : ctaType.length) < 1)
|
@@ -16709,7 +16651,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
16709
16651
|
}
|
16710
16652
|
};
|
16711
16653
|
const handleScrollEvent = (swiper) => {
|
16712
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s
|
16654
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
16713
16655
|
const item = data[swiper.previousIndex];
|
16714
16656
|
if (!item)
|
16715
16657
|
return;
|
@@ -16756,8 +16698,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
16756
16698
|
const curItem = data[swiper.activeIndex];
|
16757
16699
|
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)) {
|
16758
16700
|
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
16759
|
-
eventName: 'ProductView'
|
16760
|
-
product: (_t = curItem === null || curItem === void 0 ? void 0 : curItem.video) === null || _t === void 0 ? void 0 : _t.bindProduct
|
16701
|
+
eventName: 'ProductView'
|
16761
16702
|
});
|
16762
16703
|
}
|
16763
16704
|
viewTime.current = new Date();
|
@@ -16778,7 +16719,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
16778
16719
|
}
|
16779
16720
|
}, [openHashtag, data, activeIndex]);
|
16780
16721
|
const handleViewImageStartEvent = (activeIndex) => {
|
16781
|
-
var _a, _b, _c, _d, _e, _f
|
16722
|
+
var _a, _b, _c, _d, _e, _f;
|
16782
16723
|
const item = data[activeIndex];
|
16783
16724
|
// 如果是图片集则上报事件
|
16784
16725
|
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)) {
|
@@ -16798,8 +16739,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
16798
16739
|
}
|
16799
16740
|
});
|
16800
16741
|
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
16801
|
-
eventName: 'ViewContent'
|
16802
|
-
product: (_g = item === null || item === void 0 ? void 0 : item.video) === null || _g === void 0 ? void 0 : _g.bindProduct
|
16742
|
+
eventName: 'ViewContent'
|
16803
16743
|
});
|
16804
16744
|
}
|
16805
16745
|
};
|