pb-sxp-ui 1.3.1 → 1.3.2
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 +190 -146
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +190 -146
- 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 +190 -146
- 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/Modal/index.js +3 -3
- package/es/core/components/SxpPageRender/RenderCard.d.ts +3 -3
- package/es/core/components/SxpPageRender/RenderCard.js +17 -27
- package/es/core/components/SxpPageRender/WaterFall/List.js +20 -11
- package/es/core/components/SxpPageRender/WaterFall/WaterfallList.js +20 -11
- package/es/core/components/SxpPageRender/index.js +14 -10
- package/es/core/context/EditorDataProvider.d.ts +3 -0
- package/es/core/context/EditorDataProvider.js +2 -1
- package/es/core/context/SxpDataSourceProvider.d.ts +1 -0
- package/es/core/context/SxpDataSourceProvider.js +43 -31
- package/es/core/utils/tool.d.ts +3 -3
- package/es/core/utils/tool.js +6 -6
- package/es/materials/sxp/HashTag/index.d.ts +3 -1
- package/es/materials/sxp/HashTag/settingRender.d.ts +7 -0
- package/es/materials/sxp/HashTag/settingRender.js +6 -0
- package/es/materials/sxp/popup/CommodityDetail/index.js +13 -14
- package/es/materials/sxp/popup/CommodityDetailDiroNew/index.js +13 -14
- package/es/materials/sxp/popup/CommodityList/index.d.ts +3 -1
- package/es/materials/sxp/popup/CommodityList/index.js +11 -7
- package/es/materials/sxp/popup/CommodityList/settingRender.d.ts +7 -0
- package/es/materials/sxp/popup/CommodityList/settingRender.js +6 -0
- package/es/materials/sxp/popup/Iframe/index.d.ts +1 -0
- package/es/materials/sxp/popup/Iframe/index.js +8 -7
- package/lib/core/components/SxpPageRender/Modal/index.js +3 -3
- package/lib/core/components/SxpPageRender/RenderCard.d.ts +3 -3
- package/lib/core/components/SxpPageRender/RenderCard.js +16 -26
- package/lib/core/components/SxpPageRender/WaterFall/List.js +20 -11
- package/lib/core/components/SxpPageRender/WaterFall/WaterfallList.js +20 -11
- package/lib/core/components/SxpPageRender/index.js +14 -10
- package/lib/core/context/EditorDataProvider.d.ts +3 -0
- package/lib/core/context/EditorDataProvider.js +2 -1
- package/lib/core/context/SxpDataSourceProvider.d.ts +1 -0
- package/lib/core/context/SxpDataSourceProvider.js +43 -31
- package/lib/core/utils/tool.d.ts +3 -3
- package/lib/core/utils/tool.js +6 -6
- package/lib/materials/sxp/HashTag/index.d.ts +3 -1
- package/lib/materials/sxp/HashTag/settingRender.d.ts +7 -0
- package/lib/materials/sxp/HashTag/settingRender.js +6 -0
- package/lib/materials/sxp/popup/CommodityDetail/index.js +13 -14
- package/lib/materials/sxp/popup/CommodityDetailDiroNew/index.js +13 -14
- package/lib/materials/sxp/popup/CommodityList/index.d.ts +3 -1
- package/lib/materials/sxp/popup/CommodityList/index.js +11 -7
- package/lib/materials/sxp/popup/CommodityList/settingRender.d.ts +7 -0
- package/lib/materials/sxp/popup/CommodityList/settingRender.js +6 -0
- package/lib/materials/sxp/popup/Iframe/index.d.ts +1 -0
- package/lib/materials/sxp/popup/Iframe/index.js +8 -7
- package/package.json +1 -1
@@ -37,7 +37,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
37
37
|
const [isShowMore, setIsShowMore] = (0, react_1.useState)(false);
|
38
38
|
const [isReload, setIsReload] = (0, react_1.useState)(new Date().getTime());
|
39
39
|
const skipLinkRef = (0, react_1.useRef)(false);
|
40
|
-
const { loadVideos, bffEventReport, loading, setPopupDetailData, ctaEvent, swiperRef, waterFallData, setOpenHashtag, appDomain, openHashtag, loadingImage, isFromHashtag, popupDetailData, bffFbReport, curTime, h5EnterLink, isShowConsent, selectTag, isPreview } = (0, hooks_1.useSxpDataSource)();
|
40
|
+
const { loadVideos, bffEventReport, loading, setPopupDetailData, ctaEvent, swiperRef, waterFallData, setOpenHashtag, appDomain, openHashtag, loadingImage, isFromHashtag, popupDetailData, bffFbReport, curTime, h5EnterLink, isShowConsent, selectTag, isPreview, isEditor } = (0, hooks_1.useSxpDataSource)();
|
41
41
|
const { backMainFeed, productView, jumpToWeb } = (0, useEventReport_1.useEventReport)();
|
42
42
|
const isShowFingerTip = (0, react_1.useMemo)(() => {
|
43
43
|
return data.length > 0 && !loading && ((0, localStore_1.getFeUserId)() || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enableSwiperTip));
|
@@ -67,6 +67,8 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
67
67
|
}, [data.length, bffFbReport, h5EnterLink]);
|
68
68
|
(0, react_1.useEffect)(() => {
|
69
69
|
var _a;
|
70
|
+
if (!ctaType || (ctaType === null || ctaType === void 0 ? void 0 : ctaType.length) < 1)
|
71
|
+
return;
|
70
72
|
const index = (data === null || data === void 0 ? void 0 : data.findIndex((item) => {
|
71
73
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
72
74
|
const ctaType0 = ctaType === null || ctaType === void 0 ? void 0 : ctaType[0];
|
@@ -80,8 +82,9 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
80
82
|
return ((_f = (_e = item === null || item === void 0 ? void 0 : item.video) === null || _e === void 0 ? void 0 : _e.bindCta) === null || _f === void 0 ? void 0 : _f.itemId) === ctaType0 && (((_g = item === null || item === void 0 ? void 0 : item.video) === null || _g === void 0 ? void 0 : _g.url) || ((_j = (_h = item === null || item === void 0 ? void 0 : item.video) === null || _h === void 0 ? void 0 : _h.imgUrls) === null || _j === void 0 ? void 0 : _j.length));
|
81
83
|
}
|
82
84
|
})) || 0;
|
83
|
-
(
|
84
|
-
|
85
|
+
if (index !== -1)
|
86
|
+
(_a = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _a === void 0 ? void 0 : _a.swiper.slideTo(index);
|
87
|
+
}, [data, ctaType, swiperRef]);
|
85
88
|
(0, react_1.useEffect)(() => {
|
86
89
|
const item = data === null || data === void 0 ? void 0 : data[activeIndex];
|
87
90
|
const visibleChange = () => {
|
@@ -180,7 +183,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
180
183
|
}, [globalConfig, containerHeight, tagHeight]);
|
181
184
|
const visList = (0, react_1.useMemo)(() => {
|
182
185
|
var _a;
|
183
|
-
const list = activeIndex === 0 && !waterFallData
|
186
|
+
const list = activeIndex === 0 && !waterFallData && !isEditor
|
184
187
|
? [(_a = data === null || data === void 0 ? void 0 : data[0]) !== null && _a !== void 0 ? _a : null]
|
185
188
|
: data === null || data === void 0 ? void 0 : data.map((item, index) => {
|
186
189
|
if (activeIndex === index || index - 1 === activeIndex || index + 1 === activeIndex) {
|
@@ -191,7 +194,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
191
194
|
}
|
192
195
|
});
|
193
196
|
return !waterFallData ? list.concat([{ loading: true }]) : list;
|
194
|
-
}, [data, activeIndex, waterFallData]);
|
197
|
+
}, [data, activeIndex, waterFallData, isEditor]);
|
195
198
|
const renderLogo = (0, react_1.useMemo)(() => {
|
196
199
|
var _a, _b, _c, _d;
|
197
200
|
if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.logoUrl) && (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowLogo)) {
|
@@ -436,6 +439,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
436
439
|
position: (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconFixed) ? 'fixed' : 'absolute',
|
437
440
|
visibility: ((_b = (_a = visList === null || visList === void 0 ? void 0 : visList[activeIndex]) === null || _a === void 0 ? void 0 : _a.video) === null || _b === void 0 ? void 0 : _b.url) ? 'visible' : 'hidden',
|
438
441
|
zIndex: 999,
|
442
|
+
transform: 'translate3d(0px,0px,0px)',
|
439
443
|
[(_c = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconXPosit) !== null && _c !== void 0 ? _c : 'right']: (_d = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconX) !== null && _d !== void 0 ? _d : 0,
|
440
444
|
[(_e = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconYPosit) !== null && _e !== void 0 ? _e : 'bottom']: (_f = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconY) !== null && _f !== void 0 ? _f : 23
|
441
445
|
}, defaultValue: isMuted, activeIcon: (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.unMuteIcon) ? globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.unMuteIcon : mutedIcon, unactiveIcon: (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIcon) ? globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIcon : unmutedIcon, onChange: setIsMuted })));
|
@@ -454,10 +458,10 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
454
458
|
alignItems: 'center'
|
455
459
|
} },
|
456
460
|
react_1.default.createElement("img", { width: 64, height: 64, src: loadingImage, alt: 'loading...', style: { objectFit: 'contain' } }))) : (react_1.default.createElement(react_1.default.Fragment, null,
|
457
|
-
renderContent(rec, index),
|
458
|
-
renderBottom(rec, index),
|
459
461
|
renderLikeButton(rec, index, !(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIconFixed)),
|
460
|
-
renderToggleButton(!(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconFixed))
|
462
|
+
renderToggleButton(!(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconFixed)),
|
463
|
+
renderBottom(rec, index),
|
464
|
+
renderContent(rec, index)))))));
|
461
465
|
});
|
462
466
|
}, [
|
463
467
|
containerWidth,
|
@@ -492,9 +496,9 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
492
496
|
if (openHashtag)
|
493
497
|
return;
|
494
498
|
handleScrollEvent(swiper);
|
495
|
-
if (waterFallData)
|
499
|
+
if (waterFallData || isEditor)
|
496
500
|
return;
|
497
|
-
if ((swiper === null || swiper === void 0 ? void 0 : swiper.activeIndex) +
|
501
|
+
if ((swiper === null || swiper === void 0 ? void 0 : swiper.activeIndex) + 1 >= (data === null || data === void 0 ? void 0 : data.length)) {
|
498
502
|
if (!isLoadMore) {
|
499
503
|
setIsLoadMore(true);
|
500
504
|
loadVideos === null || loadVideos === void 0 ? void 0 : loadVideos(Math.ceil(activeIndex / 10) + 1).then(() => {
|
@@ -29,7 +29,8 @@ const EditorDataProvider = ({ children, data }) => {
|
|
29
29
|
setOpenHashtag,
|
30
30
|
openConsent,
|
31
31
|
setOpenConsent,
|
32
|
-
sxpFontLinks: data === null || data === void 0 ? void 0 : data.sxpFontLinks
|
32
|
+
sxpFontLinks: data === null || data === void 0 ? void 0 : data.sxpFontLinks,
|
33
|
+
utmParameter: data === null || data === void 0 ? void 0 : data.utm_parameter
|
33
34
|
} }, children));
|
34
35
|
};
|
35
36
|
function useEditorDataProvider() {
|
@@ -81,6 +81,7 @@ export interface ISxpDataSourceContext {
|
|
81
81
|
globalConfig?: ISxpPageRenderProps['globalConfig'];
|
82
82
|
popupCurTimeRef?: any;
|
83
83
|
checkCommodityIndexRef?: any;
|
84
|
+
isEditor?: boolean;
|
84
85
|
}
|
85
86
|
export declare const SxpDataSourceContext: React.Context<ISxpDataSourceContext>;
|
86
87
|
export interface SxpDataSourceProviderProps {
|
@@ -96,8 +96,8 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
96
96
|
.catch((err) => Promise.reject(err));
|
97
97
|
}, [bffDataSource]);
|
98
98
|
const getRecommendVideos = (0, react_1.useCallback)((query) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
99
|
-
var _d, _e, _f, _g, _h, _j, _k;
|
100
|
-
query = Object.assign(Object.assign({ maxSize: (_d = query === null || query === void 0 ? void 0 : query.maxSize) !== null && _d !== void 0 ? _d : maxSize, defaultSize: (_e = query === null || query === void 0 ? void 0 : query.defaultSize) !== null && _e !== void 0 ? _e : defaultSize, hashTag: query === null || query === void 0 ? void 0 : query.hashTag, traceInfo: query === null || query === void 0 ? void 0 : query.traceInfo, themeTag: query === null || query === void 0 ? void 0 : query.themeTag }, ((query === null || query === void 0 ? void 0 : query.contentFilter) && { contentFilter: `[${query === null || query === void 0 ? void 0 : query.contentFilter}]` })), ((query === null || query === void 0 ? void 0 : query.productFilter) && { productFilter: `[${query === null || query === void 0 ? void 0 : query.productFilter}]` }));
|
99
|
+
var _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
100
|
+
query = Object.assign(Object.assign(Object.assign({ maxSize: (_d = query === null || query === void 0 ? void 0 : query.maxSize) !== null && _d !== void 0 ? _d : maxSize, defaultSize: (_e = query === null || query === void 0 ? void 0 : query.defaultSize) !== null && _e !== void 0 ? _e : defaultSize, hashTag: query === null || query === void 0 ? void 0 : query.hashTag, traceInfo: query === null || query === void 0 ? void 0 : query.traceInfo, themeTag: query === null || query === void 0 ? void 0 : query.themeTag }, ((query === null || query === void 0 ? void 0 : query.contentFilter) && { contentFilter: `[${query === null || query === void 0 ? void 0 : query.contentFilter}]` })), ((query === null || query === void 0 ? void 0 : query.productFilter) && { productFilter: `[${query === null || query === void 0 ? void 0 : query.productFilter}]` })), { pageNum: query === null || query === void 0 ? void 0 : query.pageNum });
|
101
101
|
if (utmVal) {
|
102
102
|
const val = (_h = (_g = (_f = utmVal === null || utmVal === void 0 ? void 0 : utmVal.split('&')) === null || _f === void 0 ? void 0 : _f.filter((val) => {
|
103
103
|
var _a, _b;
|
@@ -106,30 +106,34 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
106
106
|
})) === null || _g === void 0 ? void 0 : _g.join('&')) !== null && _h !== void 0 ? _h : '';
|
107
107
|
query = Object.assign(Object.assign({}, query), { channel: decodeURIComponent(val) });
|
108
108
|
}
|
109
|
-
if (
|
110
|
-
query = Object.assign(Object.assign(
|
111
|
-
|
109
|
+
if (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview) {
|
110
|
+
query = Object.assign(Object.assign({}, query), { directPage: true, level: 1, pageNum: (_j = query === null || query === void 0 ? void 0 : query.pageNum) !== null && _j !== void 0 ? _j : 1 });
|
111
|
+
}
|
112
|
+
if (isEditor) {
|
113
|
+
let pageNum = 1;
|
114
|
+
query = Object.assign(Object.assign({}, query), (!utmVal && channelQueryList && (channelQueryList === null || channelQueryList === void 0 ? void 0 : channelQueryList.length) > 0 && { channel: channelQueryList === null || channelQueryList === void 0 ? void 0 : channelQueryList[0] }));
|
115
|
+
if (!(query === null || query === void 0 ? void 0 : query.channel) || isInit.current)
|
112
116
|
return;
|
117
|
+
isInit.current = true;
|
113
118
|
let list = [];
|
114
119
|
let result = null;
|
115
|
-
let pageNum = 1;
|
116
120
|
const recurveRecList = (query) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
117
|
-
var
|
121
|
+
var _r, _s, _t, _u, _v, _w;
|
118
122
|
query.pageNum = pageNum;
|
119
123
|
result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/recommend/list', { method: 'GET', query }));
|
120
124
|
if (!(result === null || result === void 0 ? void 0 : result.success)) {
|
121
125
|
return undefined;
|
122
126
|
}
|
123
|
-
const
|
124
|
-
list = list.concat((
|
125
|
-
if (
|
127
|
+
const isNotNullList = (_s = (_r = result === null || result === void 0 ? void 0 : result.data) === null || _r === void 0 ? void 0 : _r.recList) === null || _s === void 0 ? void 0 : _s.every((item) => (item === null || item === void 0 ? void 0 : item.product) || (item === null || item === void 0 ? void 0 : item.video));
|
128
|
+
list = list.concat((_w = (_v = (_u = (_t = result === null || result === void 0 ? void 0 : result.data) === null || _t === void 0 ? void 0 : _t.recList) === null || _u === void 0 ? void 0 : _u.filter) === null || _v === void 0 ? void 0 : _v.call(_u, (item) => (item === null || item === void 0 ? void 0 : item.product) || (item === null || item === void 0 ? void 0 : item.video))) !== null && _w !== void 0 ? _w : []);
|
129
|
+
if (isNotNullList) {
|
126
130
|
pageNum = pageNum + 1;
|
127
131
|
yield recurveRecList(query);
|
128
132
|
}
|
129
133
|
});
|
130
134
|
yield recurveRecList(query);
|
131
135
|
if (!(query === null || query === void 0 ? void 0 : query.hashTag) && result)
|
132
|
-
setCurReqInfo({ rtc: (
|
136
|
+
setCurReqInfo({ rtc: (_k = result === null || result === void 0 ? void 0 : result.data) === null || _k === void 0 ? void 0 : _k.rtc, requestId: (_l = result === null || result === void 0 ? void 0 : result.data) === null || _l === void 0 ? void 0 : _l.requestId });
|
133
137
|
return Object.assign(Object.assign({}, result.data), { recList: list });
|
134
138
|
}
|
135
139
|
const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/recommend/list', { method: 'GET', query }));
|
@@ -138,15 +142,20 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
138
142
|
}
|
139
143
|
if (!(query === null || query === void 0 ? void 0 : query.hashTag))
|
140
144
|
setCurReqInfo({ rtc: result.data.rtc, requestId: result.data.requestId });
|
145
|
+
if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview) && !isEditor) {
|
146
|
+
let list = [];
|
147
|
+
list = list.concat((_q = (_p = (_o = (_m = result === null || result === void 0 ? void 0 : result.data) === null || _m === void 0 ? void 0 : _m.recList) === null || _o === void 0 ? void 0 : _o.filter) === null || _p === void 0 ? void 0 : _p.call(_o, (item) => (item === null || item === void 0 ? void 0 : item.product) || (item === null || item === void 0 ? void 0 : item.video))) !== null && _q !== void 0 ? _q : []);
|
148
|
+
return Object.assign(Object.assign({}, result.data), { recList: list });
|
149
|
+
}
|
141
150
|
return result === null || result === void 0 ? void 0 : result.data;
|
142
|
-
}), [bffFetch, utmVal, maxSize, defaultSize,
|
143
|
-
const loadVideos = (0, react_1.useCallback)(() => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
144
|
-
var
|
151
|
+
}), [bffFetch, utmVal, maxSize, defaultSize, channelQueryList]);
|
152
|
+
const loadVideos = (0, react_1.useCallback)((pageNum) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
153
|
+
var _x, _y, _z, _0;
|
145
154
|
if (rtcList.length <= 0) {
|
146
155
|
return;
|
147
156
|
}
|
148
157
|
const lastItem = rtcList === null || rtcList === void 0 ? void 0 : rtcList[(rtcList === null || rtcList === void 0 ? void 0 : rtcList.length) - 1];
|
149
|
-
const data = yield getRecommendVideos(Object.assign(Object.assign(Object.assign({ hashTag: waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.hashTag }, (((
|
158
|
+
const data = yield getRecommendVideos(Object.assign(Object.assign(Object.assign(Object.assign({ hashTag: waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.hashTag }, (((_x = lastItem === null || lastItem === void 0 ? void 0 : lastItem.product) === null || _x === void 0 ? void 0 : _x.itemId) && { productFilter: (_y = lastItem === null || lastItem === void 0 ? void 0 : lastItem.product) === null || _y === void 0 ? void 0 : _y.itemId })), (((_z = lastItem === null || lastItem === void 0 ? void 0 : lastItem.video) === null || _z === void 0 ? void 0 : _z.itemId) && { contentFilter: (_0 = lastItem === null || lastItem === void 0 ? void 0 : lastItem.video) === null || _0 === void 0 ? void 0 : _0.itemId })), { themeTag: themeTag.current }), ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview) && !isEditor && { pageNum })));
|
150
159
|
setRtcList(rtcList.concat(getFilterRecList(data)));
|
151
160
|
setCacheRtcList(cacheRtcList.concat(getFilterRecList(data)));
|
152
161
|
}), [getRecommendVideos, rtcList, waterFallData, cacheRtcList]);
|
@@ -158,7 +167,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
158
167
|
userInfo = {};
|
159
168
|
}
|
160
169
|
const sessionID = (0, sessionStore_1.storeAndLoadFeSessionId)();
|
161
|
-
const ef = Object.assign(Object.assign({ sessionID, rtc: curReqInfo.rtc, requestId: curReqInfo.requestId }, eventInfo), { sxpDevice: (0, tool_1.getDevice)(), sxpSystem: (0, tool_1.getSystem)(), sxpBrowser: (0, tool_1.getBrowserInfo)() });
|
170
|
+
const ef = Object.assign(Object.assign(Object.assign(Object.assign({ sessionID, rtc: curReqInfo.rtc, requestId: curReqInfo.requestId }, eventInfo), ((0, tool_1.getDevice)() && { sxpDevice: (0, tool_1.getDevice)() })), ((0, tool_1.getSystem)() && { sxpSystem: (0, tool_1.getSystem)() })), ((0, tool_1.getBrowserInfo)() && { sxpBrowser: (0, tool_1.getBrowserInfo)() }));
|
162
171
|
const realUserInfo = Object.entries(userInfo).map(([k, v]) => ({ name: k, value: v }));
|
163
172
|
const realEventInfo = Object.entries(ef)
|
164
173
|
.map(([k, v]) => v && { name: k, value: v })
|
@@ -174,24 +183,21 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
174
183
|
});
|
175
184
|
}, [bffFetch, curReqInfo, enableReportEvent, globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview]);
|
176
185
|
const bffFbReport = (0, react_1.useCallback)((_a) => {
|
177
|
-
var _b, _c;
|
186
|
+
var _b, _c, _d;
|
178
187
|
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;
|
179
188
|
if (!enableReportEvent || !enabledMetaConversionApi || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview)) {
|
180
189
|
return;
|
181
190
|
}
|
182
191
|
const fakeUserId = (0, localStore_1.storeAndLoadFeUserId)();
|
192
|
+
const urlParams = new URLSearchParams(window.location.search);
|
193
|
+
const fbclid = urlParams.get('fbclid');
|
183
194
|
return bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/fb/events', {
|
184
195
|
method: 'POST',
|
185
196
|
body: {
|
186
197
|
eventName,
|
187
198
|
actionSource,
|
188
199
|
eventSourceUrl,
|
189
|
-
userData: {
|
190
|
-
externalId: fakeUserId,
|
191
|
-
fbc: `fb.2.${new Date().getTime()}.${(0, tool_1.getCookie)('_fbc')}`,
|
192
|
-
fbp: `fb.2.${new Date().getTime()}.${(0, tool_1.getCookie)('_fbp')}`,
|
193
|
-
client_user_agent: (_c = window === null || window === void 0 ? void 0 : window.navigator) === null || _c === void 0 ? void 0 : _c.userAgent
|
194
|
-
}
|
200
|
+
userData: Object.assign(Object.assign(Object.assign({ externalId: fakeUserId }, (fbclid && { fbc: `fb.2.${new Date().getTime()}.${fbclid}` })), ((0, tool_1.getCookie)('_fbp') && { fbp: `fb.2.${new Date().getTime()}.${(0, tool_1.getCookie)('_fbp')}` })), { 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 : '' })
|
195
201
|
},
|
196
202
|
type: 'beacon'
|
197
203
|
});
|
@@ -209,17 +215,17 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
209
215
|
return res === null || res === void 0 ? void 0 : res.success;
|
210
216
|
}), [bffFetch]);
|
211
217
|
const bffGetTagList = (0, react_1.useCallback)(() => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
212
|
-
var
|
218
|
+
var _1, _2, _3, _4, _5;
|
213
219
|
if (!utmVal || !isShowTag)
|
214
220
|
return;
|
215
221
|
try {
|
216
|
-
const val = (
|
222
|
+
const val = (_3 = (_2 = (_1 = utmVal === null || utmVal === void 0 ? void 0 : utmVal.split('&')) === null || _1 === void 0 ? void 0 : _1.filter((val) => {
|
217
223
|
var _a, _b;
|
218
224
|
const key = val.split('=')[0];
|
219
225
|
return (_b = ((_a = utmParameter === null || utmParameter === void 0 ? void 0 : utmParameter.channels) !== null && _a !== void 0 ? _a : [])) === null || _b === void 0 ? void 0 : _b.includes(key);
|
220
|
-
})) === null ||
|
226
|
+
})) === null || _2 === void 0 ? void 0 : _2.join('&')) !== null && _3 !== void 0 ? _3 : '';
|
221
227
|
const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/tag/list', { method: 'GET', query: { channel: decodeURIComponent(val) } }));
|
222
|
-
setTagList((
|
228
|
+
setTagList((_5 = (_4 = result === null || result === void 0 ? void 0 : result.data) === null || _4 === void 0 ? void 0 : _4.tags) !== null && _5 !== void 0 ? _5 : []);
|
223
229
|
}
|
224
230
|
catch (e) {
|
225
231
|
console.log('e', e);
|
@@ -292,11 +298,10 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
292
298
|
}
|
293
299
|
});
|
294
300
|
setLoading(false);
|
295
|
-
isInit.current = true;
|
296
301
|
});
|
297
302
|
}, [isShowConsent]);
|
298
303
|
(0, react_1.useEffect)(() => {
|
299
|
-
if (!
|
304
|
+
if (!isPreview)
|
300
305
|
return;
|
301
306
|
setLoading(true);
|
302
307
|
bffGetTagList();
|
@@ -306,9 +311,15 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
306
311
|
setCacheRtcList(getFilterRecList(data));
|
307
312
|
})
|
308
313
|
.finally(() => {
|
314
|
+
bffEventReport({
|
315
|
+
eventInfo: {
|
316
|
+
eventSubject: 'apiRequest',
|
317
|
+
eventDescription: 'api request succeed'
|
318
|
+
}
|
319
|
+
});
|
309
320
|
setLoading(false);
|
310
321
|
});
|
311
|
-
}, [
|
322
|
+
}, [getRecommendVideos, bffGetTagList]);
|
312
323
|
const defaultLoadingImage = (0, useIconLink_1.useIconLink)('/pb_static/a65d23c5893c49d7aaaa81681d3179e2.gif', appDomain);
|
313
324
|
return (react_1.default.createElement(exports.SxpDataSourceContext.Provider, { value: {
|
314
325
|
rtcList,
|
@@ -356,7 +367,8 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
356
367
|
setSelectTag,
|
357
368
|
globalConfig,
|
358
369
|
popupCurTimeRef,
|
359
|
-
checkCommodityIndexRef
|
370
|
+
checkCommodityIndexRef,
|
371
|
+
isEditor
|
360
372
|
} }, isShowConsent ? (react_1.default.createElement(Consent_1.default, Object.assign({}, (_c = (_b = (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.consent) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.item) === null || _c === void 0 ? void 0 : _c.props))) : (render({
|
361
373
|
rtcList,
|
362
374
|
mutateLike: bffMutateLike,
|
package/lib/core/utils/tool.d.ts
CHANGED
@@ -7,8 +7,8 @@ interface IfontType {
|
|
7
7
|
'fontFamily-en': string;
|
8
8
|
}
|
9
9
|
export declare const setFontForText: (textContent?: string | null, style?: IfontType | any) => string;
|
10
|
-
declare function getBrowserInfo(): string;
|
11
|
-
declare function getSystem(): string;
|
12
|
-
declare function getDevice(): string;
|
10
|
+
declare function getBrowserInfo(): string | null;
|
11
|
+
declare function getSystem(): string | null;
|
12
|
+
declare function getDevice(): string | null;
|
13
13
|
declare function getCookie(val: string): string;
|
14
14
|
export { uuid, getIndexByblockType, getBrowserInfo, getDevice, getSystem, getCookie };
|
package/lib/core/utils/tool.js
CHANGED
@@ -100,7 +100,7 @@ function getBrowserInfo() {
|
|
100
100
|
var _a, _b, _c, _d, _e, _f, _g;
|
101
101
|
let userAgent = self.navigator.userAgent;
|
102
102
|
if (!userAgent)
|
103
|
-
return
|
103
|
+
return null;
|
104
104
|
if (/edge\/([\d\.]+)/i.exec(userAgent))
|
105
105
|
return `Edge ${(_a = /edge\/([\d\.]+)/i.exec(userAgent)) === null || _a === void 0 ? void 0 : _a[1]}`;
|
106
106
|
if (/edg\/([\d\.]+)/i.exec(userAgent))
|
@@ -115,14 +115,14 @@ function getBrowserInfo() {
|
|
115
115
|
return `Firefox ${(_f = /firefox\/([\d\.]+)/i.exec(userAgent)) === null || _f === void 0 ? void 0 : _f[1]}`;
|
116
116
|
if (/safari/i.test(userAgent))
|
117
117
|
return `Safari ${(_g = /version\/([\d\.]+)/i.exec(userAgent)) === null || _g === void 0 ? void 0 : _g[1]}`;
|
118
|
-
return
|
118
|
+
return null;
|
119
119
|
}
|
120
120
|
exports.getBrowserInfo = getBrowserInfo;
|
121
121
|
function getSystem() {
|
122
122
|
var _a, _b, _c;
|
123
123
|
let userAgent = self.navigator.userAgent;
|
124
124
|
if (!userAgent)
|
125
|
-
return
|
125
|
+
return null;
|
126
126
|
if (/iphone/i.test(userAgent))
|
127
127
|
return `IOS ${(_a = userAgent.match(/OS\s(.*?)\slike/)) === null || _a === void 0 ? void 0 : _a[1]}`;
|
128
128
|
if (/android/i.test(userAgent))
|
@@ -131,13 +131,13 @@ function getSystem() {
|
|
131
131
|
return `Windows ${(_c = userAgent.match(/Windows\s(.*?)\;/)) === null || _c === void 0 ? void 0 : _c[1]}`;
|
132
132
|
if (/mac/i.test(userAgent))
|
133
133
|
return `Mac OS`;
|
134
|
-
return
|
134
|
+
return null;
|
135
135
|
}
|
136
136
|
exports.getSystem = getSystem;
|
137
137
|
function getDevice() {
|
138
138
|
let userAgent = self.navigator.userAgent;
|
139
139
|
if (!userAgent)
|
140
|
-
return
|
140
|
+
return null;
|
141
141
|
if (/iphone/i.test(userAgent))
|
142
142
|
return `iPhone`;
|
143
143
|
if (/android/i.test(userAgent)) {
|
@@ -152,7 +152,7 @@ function getDevice() {
|
|
152
152
|
return `Windows`;
|
153
153
|
if (/mac/i.test(userAgent))
|
154
154
|
return `Mac`;
|
155
|
-
return
|
155
|
+
return null;
|
156
156
|
}
|
157
157
|
exports.getDevice = getDevice;
|
158
158
|
function getCookie(val) {
|
@@ -8,7 +8,9 @@ export interface IHashTagProps {
|
|
8
8
|
hashTagDesc: CSSProperties;
|
9
9
|
hashTagLink: CSSProperties;
|
10
10
|
title: CSSProperties;
|
11
|
-
price: CSSProperties
|
11
|
+
price: CSSProperties & {
|
12
|
+
enableFormattedPrice?: boolean;
|
13
|
+
};
|
12
14
|
};
|
13
15
|
buttonBgStyle: CSSProperties;
|
14
16
|
showBanner?: boolean;
|
@@ -61,6 +61,13 @@ declare const _default: ({
|
|
61
61
|
name?: undefined;
|
62
62
|
initialValue?: undefined;
|
63
63
|
child?: undefined;
|
64
|
+
} | {
|
65
|
+
label: string;
|
66
|
+
type: string;
|
67
|
+
name: string[];
|
68
|
+
initialValue: boolean;
|
69
|
+
options?: undefined;
|
70
|
+
child?: undefined;
|
64
71
|
})[];
|
65
72
|
}[];
|
66
73
|
} | {
|
@@ -171,20 +171,19 @@ const CommodityDetail = (_a) => {
|
|
171
171
|
width: '100%',
|
172
172
|
height: '100%'
|
173
173
|
}), src: (_5 = sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) !== null && _5 !== void 0 ? _5 : bottom_image, alt: 'pdp image' }))),
|
174
|
-
(iframeUrl && iframeIcon
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
react_1.default.createElement("span", { style: { fontSize: '12px' } }, "Try in 3D"))))),
|
174
|
+
(iframeUrl || !product) && iframeIcon && (react_1.default.createElement("div", { style: {
|
175
|
+
padding: '5px 10px',
|
176
|
+
display: 'flex',
|
177
|
+
alignItems: 'center',
|
178
|
+
position: 'absolute',
|
179
|
+
right: '10px',
|
180
|
+
bottom: '10px',
|
181
|
+
zIndex: 1,
|
182
|
+
background: '#fff',
|
183
|
+
borderRadius: '3px'
|
184
|
+
}, onClick: () => setShow3DModal(true) },
|
185
|
+
react_1.default.createElement("img", { src: iframeIcon, alt: '3d', width: '20px', height: '20px', style: { marginRight: '5px' } }),
|
186
|
+
react_1.default.createElement("span", { style: { fontSize: '12px' } }, "Try in 3D")))),
|
188
187
|
renderCommodityGroup(),
|
189
188
|
react_1.default.createElement("div", { className: 'pb-commondity-content' }, renderContent({ isPost }))),
|
190
189
|
renderBtn(),
|
@@ -154,20 +154,19 @@ Made in Italy` })));
|
|
154
154
|
width: '100%',
|
155
155
|
height: '100%'
|
156
156
|
}), src: (_5 = sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) !== null && _5 !== void 0 ? _5 : bottom_image, alt: 'pdp image' }))),
|
157
|
-
(iframeUrl && iframeIcon
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
react_1.default.createElement("span", { style: { fontSize: '12px' } }, "Try in 3D"))))),
|
157
|
+
(iframeUrl || !product) && iframeIcon && (react_1.default.createElement("div", { style: {
|
158
|
+
padding: '5px 10px',
|
159
|
+
display: 'flex',
|
160
|
+
alignItems: 'center',
|
161
|
+
position: 'absolute',
|
162
|
+
right: '10px',
|
163
|
+
bottom: '10px',
|
164
|
+
zIndex: 1,
|
165
|
+
background: '#fff',
|
166
|
+
borderRadius: '3px'
|
167
|
+
}, onClick: () => setShow3DModal(true) },
|
168
|
+
react_1.default.createElement("img", { src: iframeIcon, alt: '3d', width: '20px', height: '20px', style: { marginRight: '5px' } }),
|
169
|
+
react_1.default.createElement("span", { style: { fontSize: '12px' } }, "Try in 3D")))),
|
171
170
|
renderCommodityGroup(),
|
172
171
|
react_1.default.createElement("div", { className: 'pb-commondityDiroNew-content' },
|
173
172
|
react_1.default.createElement("div", { className: 'pb-commondityDiroNew-content-top' },
|
@@ -16,7 +16,9 @@ export interface ICommodityListProps {
|
|
16
16
|
commodityStyles?: {
|
17
17
|
title: CSSProperties;
|
18
18
|
collection: CSSProperties;
|
19
|
-
price: CSSProperties
|
19
|
+
price: CSSProperties & {
|
20
|
+
enableFormattedPrice?: boolean;
|
21
|
+
};
|
20
22
|
};
|
21
23
|
buttonStyle?: CSSProperties;
|
22
24
|
translateY?: number;
|
@@ -10,7 +10,7 @@ const tool_1 = require("../../../../core/utils/tool");
|
|
10
10
|
const Img_1 = tslib_1.__importDefault(require("../../template/components/Img"));
|
11
11
|
const lodash_1 = require("lodash");
|
12
12
|
const CommodityList = (_a) => {
|
13
|
-
var _b, _c;
|
13
|
+
var _b, _c, _d;
|
14
14
|
var { style, isDefault, rec, viewTime, isPost, bottom_image, commodityStyles, buttonStyle, translateY = 0, commodityPicture, isExternalLink, onClick } = _a, props = tslib_1.__rest(_a, ["style", "isDefault", "rec", "viewTime", "isPost", "bottom_image", "commodityStyles", "buttonStyle", "translateY", "commodityPicture", "isExternalLink", "onClick"]);
|
15
15
|
const { sxpParameter, popupDetailData, setPopupDetailData, ctaEvent } = (0, hooks_1.useSxpDataSource)();
|
16
16
|
const { jumpToWeb } = (0, useEventReport_1.useEventReport)();
|
@@ -19,16 +19,20 @@ const CommodityList = (_a) => {
|
|
19
19
|
const product = (_c = (_b = recData === null || recData === void 0 ? void 0 : recData.video) === null || _b === void 0 ? void 0 : _b.bindProducts) !== null && _c !== void 0 ? _c : [null, null, null, null];
|
20
20
|
const index = popupDetailData === null || popupDetailData === void 0 ? void 0 : popupDetailData.index;
|
21
21
|
const priceText = (0, react_1.useCallback)((product) => {
|
22
|
-
var _a, _b, _c, _d, _e;
|
22
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
23
|
+
const isToLocStr = ((_a = commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price) === null || _a === void 0 ? void 0 : _a.enableFormattedPrice) === undefined || ((_b = commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price) === null || _b === void 0 ? void 0 : _b.enableFormattedPrice);
|
23
24
|
if ((product === null || product === void 0 ? void 0 : product.currency) && (product === null || product === void 0 ? void 0 : product.price)) {
|
24
|
-
return `${(
|
25
|
-
|
26
|
-
|
25
|
+
return `${(_e = (_d = (_c = product === null || product === void 0 ? void 0 : product.currency) === null || _c === void 0 ? void 0 : _c.split('-')[1]) === null || _d === void 0 ? void 0 : _d.toUpperCase()) !== null && _e !== void 0 ? _e : ''}${isToLocStr
|
26
|
+
? (_g = (_f = product === null || product === void 0 ? void 0 : product.price) === null || _f === void 0 ? void 0 : _f.toLocaleString('zh', {
|
27
|
+
minimumFractionDigits: 0
|
28
|
+
})) !== null && _g !== void 0 ? _g : ''
|
29
|
+
: product === null || product === void 0 ? void 0 : product.price}`;
|
27
30
|
}
|
28
31
|
else {
|
29
|
-
|
32
|
+
const p = 7000;
|
33
|
+
return `$${isToLocStr ? p === null || p === void 0 ? void 0 : p.toLocaleString() : p}`;
|
30
34
|
}
|
31
|
-
}, []);
|
35
|
+
}, [(_d = commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price) === null || _d === void 0 ? void 0 : _d.enableFormattedPrice]);
|
32
36
|
const handleClick = (0, lodash_1.throttle)((item, multiCheckIndex) => {
|
33
37
|
ctaEvent === null || ctaEvent === void 0 ? void 0 : ctaEvent({
|
34
38
|
eventSubject: 'clickCta',
|
@@ -95,6 +95,13 @@ declare const _default: ({
|
|
95
95
|
name?: undefined;
|
96
96
|
initialValue?: undefined;
|
97
97
|
child?: undefined;
|
98
|
+
} | {
|
99
|
+
label: string;
|
100
|
+
type: string;
|
101
|
+
name: string[];
|
102
|
+
initialValue: boolean;
|
103
|
+
options?: undefined;
|
104
|
+
child?: undefined;
|
98
105
|
})[];
|
99
106
|
}[];
|
100
107
|
} | {
|
@@ -7,14 +7,15 @@ require("./index.less");
|
|
7
7
|
const hooks_1 = require("../../../../core/hooks");
|
8
8
|
const Iframe = (_a) => {
|
9
9
|
var _b, _c;
|
10
|
-
var { content, btnText, style, icon, isPopup, isExternalLink, onClose, onClick, submitButtonStyle, contentStyle } = _a, props = tslib_1.__rest(_a, ["content", "btnText", "style", "icon", "isPopup", "isExternalLink", "onClose", "onClick", "submitButtonStyle", "contentStyle"]);
|
10
|
+
var { content, btnText, style, icon, isPopup, isExternalLink, onClose, onClick, submitButtonStyle, contentStyle, isTel } = _a, props = tslib_1.__rest(_a, ["content", "btnText", "style", "icon", "isPopup", "isExternalLink", "onClose", "onClick", "submitButtonStyle", "contentStyle", "isTel"]);
|
11
11
|
const { popupDetailData } = (0, hooks_1.useSxpDataSource)();
|
12
12
|
const iframeUrl = (_c = (_b = popupDetailData === null || popupDetailData === void 0 ? void 0 : popupDetailData.video) === null || _b === void 0 ? void 0 : _b.bindCta) === null || _c === void 0 ? void 0 : _c.remark;
|
13
|
-
return (react_1.default.createElement("div", Object.assign({ className: `${(0, css_1.css)(Object.assign({}, style)
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
13
|
+
return (react_1.default.createElement("div", Object.assign({ className: `${(0, css_1.css)(Object.assign(Object.assign({}, style), { height: isTel ? 664 : '100%' }))}` }, props),
|
14
|
+
react_1.default.createElement("iframe", { src: iframeUrl, style: {
|
15
|
+
width: '100%',
|
16
|
+
height: 'calc(100% - 50px)',
|
17
|
+
marginTop: '40px',
|
18
|
+
border: 'none'
|
19
|
+
} })));
|
19
20
|
};
|
20
21
|
exports.default = (0, react_1.memo)(Iframe);
|