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
@@ -4,7 +4,7 @@ import * as ReactDOM from 'react-dom';
|
|
4
4
|
import { useEditor, useSxpDataSource } from '../../../../core/hooks';
|
5
5
|
const closeIcon = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAjhJREFUWEfFlztOw0AQhmeWiJ4CCmpQ5DiRQsIJyAWg5A0lR0AIChDiCJS8ER0cADgBeRSxt4CCDgkaKiq8i+zYeWx2413HEWmiJJv9v535Z2aN8M8vFPT9z3zETD0aAUChUJjwvPFHAJhBhB3Hqd6OAsK2yyucwykAvP38eJX398Z3AJDLlVYR8ToU9Rhj25TWr9KEsKy5dULIGQCMtfZly45TvwsAstm56UwG6wA4FUFwzrdctxZBDcWSy5XWEPG8I84/GcMipdWPtgcsaz5PCHtKG0IuTiqUvjT9U/WYMG2IOPE+AP+LtCB0xKUAAyA2Xbd2o2OG0NQXvTnvhL17D7EPtH9TRCIWwkRcGYGIQgYBABuqPuHXOQBc6pw80lBGwBQiiXhsBHQhkoprA6iM6acjhDQKu5YJZW6XeOI3XJdpvfsdTu52VfXEekD8owQiXGIubpSCbhDbLu8DwKEAd+A41SOdPpE4BS0viFOtvV2iKWqUgn5x/tmS70xR01GuDSCKc86/OCcLgTyyZ0ScDGNhFAktAJV4NFJ9YyaFiAWIE+9uVkkgBgLoig8DMWAa9ro9ynkUdlW5maZDCmB6clmz0k1HH4Cs1Ezbq2p2yEpUuBOKTSZZex00RUWIrltxuuK6EOGDSbGIOPZicpMx6fny650377qNRgBgWeVFQuA+6UjVgREhGIMlSqsPUQqIbZdOOIdZQmCv2axRnU1N1+TzJYsxOEaEV8ep7frPZ7Gd0FTEdP0ft0/kMNdg0eoAAAAASUVORK5CYII=';
|
6
6
|
const Modal = ({ visible, onClose, children, modalStyle, padding, popup, schema, fullHeight = window.innerHeight, isFullScreen = false }) => {
|
7
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
|
7
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
|
8
8
|
const touchRef = useRef(null);
|
9
9
|
const fTouchRef = useRef(null);
|
10
10
|
const touchMoveRef = useRef(null);
|
@@ -126,8 +126,8 @@ const Modal = ({ visible, onClose, children, modalStyle, padding, popup, schema,
|
|
126
126
|
React.createElement("div", { onClick: onClose, className: 'modal-icon-wrapper' },
|
127
127
|
React.createElement("img", { src: (_t = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.popupCloseIcon) !== null && _t !== void 0 ? _t : closeIcon, alt: 'close', className: 'modal-icon' })),
|
128
128
|
React.createElement("div", { ref: ref, style: {
|
129
|
-
height: (isScrollFullScreen ? fullHeight : MODAL_DEF_CON_H) -
|
130
|
-
((_w = (_v = (_u = getPopupById === null || getPopupById === void 0 ? void 0 : getPopupById.item) === null || _u === void 0 ? void 0 : _u.props) === null || _v === void 0 ? void 0 : _v.popupBg) === null || _w === void 0 ? void 0 : _w.bottomMargin),
|
129
|
+
height: (_x = (isScrollFullScreen ? fullHeight : MODAL_DEF_CON_H) -
|
130
|
+
((_w = (_v = (_u = getPopupById === null || getPopupById === void 0 ? void 0 : getPopupById.item) === null || _u === void 0 ? void 0 : _u.props) === null || _v === void 0 ? void 0 : _v.popupBg) === null || _w === void 0 ? void 0 : _w.bottomMargin)) !== null && _x !== void 0 ? _x : 0,
|
131
131
|
overflow: (isScrollFullScreen && modalTrans <= 0) || !isScrollFullScreen ? 'auto' : 'hidden'
|
132
132
|
} }, children)))))), modalEleRef.current);
|
133
133
|
};
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import
|
1
|
+
import { FC } from 'react';
|
2
2
|
import './index.less';
|
3
3
|
import { RecItemType } from './typing';
|
4
4
|
interface IRenderCardProps {
|
@@ -9,5 +9,5 @@ interface IRenderCardProps {
|
|
9
9
|
includesCtaType?: string[];
|
10
10
|
isActive?: boolean;
|
11
11
|
}
|
12
|
-
declare const
|
13
|
-
export default
|
12
|
+
declare const RenderCard: FC<IRenderCardProps>;
|
13
|
+
export default RenderCard;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import React, {
|
1
|
+
import React, { useCallback } from 'react';
|
2
2
|
import './index.less';
|
3
3
|
import withBindDataSource from '../../../core/hoc/withBindDataSource';
|
4
4
|
import { useEditor } from '../../../core/hooks';
|
@@ -18,43 +18,33 @@ const RenderCard = ({ rec, index, tempMap, resolver, includesCtaType, isActive }
|
|
18
18
|
cta = (_e = (_d = rec === null || rec === void 0 ? void 0 : rec.video) === null || _d === void 0 ? void 0 : _d.bindCta) === null || _e === void 0 ? void 0 : _e.itemId;
|
19
19
|
}
|
20
20
|
const value = tempMap === null || tempMap === void 0 ? void 0 : tempMap[cta];
|
21
|
-
const renderComp =
|
22
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3
|
21
|
+
const renderComp = useCallback(() => {
|
22
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3;
|
23
23
|
if (!(rec === null || rec === void 0 ? void 0 : rec.video))
|
24
24
|
return null;
|
25
|
-
|
26
|
-
if ((_b = (_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.bindProducts) === null || _b === void 0 ? void 0 : _b.length) {
|
27
|
-
cta = '多商品CTA';
|
28
|
-
}
|
29
|
-
else if ((_c = rec === null || rec === void 0 ? void 0 : rec.video) === null || _c === void 0 ? void 0 : _c.bindProduct) {
|
30
|
-
cta = '商品CTA';
|
31
|
-
}
|
32
|
-
else {
|
33
|
-
cta = (_e = (_d = rec === null || rec === void 0 ? void 0 : rec.video) === null || _d === void 0 ? void 0 : _d.bindCta) === null || _e === void 0 ? void 0 : _e.itemId;
|
34
|
-
}
|
35
|
-
if (includesCtaType && !(includesCtaType === null || includesCtaType === void 0 ? void 0 : includesCtaType.includes((_f = value === null || value === void 0 ? void 0 : value.item) === null || _f === void 0 ? void 0 : _f.type)))
|
25
|
+
if (includesCtaType && !(includesCtaType === null || includesCtaType === void 0 ? void 0 : includesCtaType.includes((_a = value === null || value === void 0 ? void 0 : value.item) === null || _a === void 0 ? void 0 : _a.type)))
|
36
26
|
return;
|
37
|
-
if (!includesCtaType && ((
|
27
|
+
if (!includesCtaType && ((_b = value === null || value === void 0 ? void 0 : value.item) === null || _b === void 0 ? void 0 : _b.category) === 'cta')
|
38
28
|
return;
|
39
|
-
if ((((
|
40
|
-
(((
|
41
|
-
(((
|
42
|
-
(((
|
43
|
-
(((
|
44
|
-
(((
|
29
|
+
if ((((_c = value === null || value === void 0 ? void 0 : value.item) === null || _c === void 0 ? void 0 : _c.type) === 'CommodityDiro' && !((_d = rec === null || rec === void 0 ? void 0 : rec.video) === null || _d === void 0 ? void 0 : _d.bindProduct)) ||
|
30
|
+
(((_e = value === null || value === void 0 ? void 0 : value.item) === null || _e === void 0 ? void 0 : _e.type) === 'Commodity' && !((_f = rec === null || rec === void 0 ? void 0 : rec.video) === null || _f === void 0 ? void 0 : _f.bindProduct)) ||
|
31
|
+
(((_g = value === null || value === void 0 ? void 0 : value.item) === null || _g === void 0 ? void 0 : _g.type) === 'CommodityDiroNew' && !((_h = rec === null || rec === void 0 ? void 0 : rec.video) === null || _h === void 0 ? void 0 : _h.bindProduct)) ||
|
32
|
+
(((_j = value === null || value === void 0 ? void 0 : value.item) === null || _j === void 0 ? void 0 : _j.type) === 'MultiCommodity' && !((_l = (_k = rec === null || rec === void 0 ? void 0 : rec.video) === null || _k === void 0 ? void 0 : _k.bindProducts) === null || _l === void 0 ? void 0 : _l.length)) ||
|
33
|
+
(((_m = value === null || value === void 0 ? void 0 : value.item) === null || _m === void 0 ? void 0 : _m.type) === 'MultiCommodityDiro' && !((_p = (_o = rec === null || rec === void 0 ? void 0 : rec.video) === null || _o === void 0 ? void 0 : _o.bindProducts) === null || _p === void 0 ? void 0 : _p.length)) ||
|
34
|
+
(((_q = value === null || value === void 0 ? void 0 : value.item) === null || _q === void 0 ? void 0 : _q.type) === 'MultiCommodityDiroNew' && !((_s = (_r = rec === null || rec === void 0 ? void 0 : rec.video) === null || _r === void 0 ? void 0 : _r.bindProducts) === null || _s === void 0 ? void 0 : _s.length))) {
|
45
35
|
return null;
|
46
36
|
}
|
47
37
|
if (value && resolver) {
|
48
|
-
const t = resolver[(
|
38
|
+
const t = resolver[(_t = value === null || value === void 0 ? void 0 : value.item) === null || _t === void 0 ? void 0 : _t.type];
|
49
39
|
const Component = withBindDataSource(t);
|
50
|
-
const defaulSetting = (
|
51
|
-
const isExternalLink = ((
|
52
|
-
return (React.createElement(Component, Object.assign({ style: Object.assign(Object.assign(Object.assign({}, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.style), (
|
40
|
+
const defaulSetting = (_u = t === null || t === void 0 ? void 0 : t.extend) === null || _u === void 0 ? void 0 : _u.defaulSetting;
|
41
|
+
const isExternalLink = ((_x = (_w = (_v = value === null || value === void 0 ? void 0 : value.item) === null || _v === void 0 ? void 0 : _v.event) === null || _w === void 0 ? void 0 : _w.onClick) === null || _x === void 0 ? void 0 : _x.linkType) === 'externalLink';
|
42
|
+
return (React.createElement(Component, Object.assign({ style: Object.assign(Object.assign(Object.assign({}, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.style), (_y = value === null || value === void 0 ? void 0 : value.item) === null || _y === void 0 ? void 0 : _y.style), { zIndex: 50, marginLeft: '20px', boxSizing: 'border-box', transform: 'translate3d(0px, 0px, 0px)' }), textStyle: Object.assign(Object.assign({}, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.textStyle), (_z = value === null || value === void 0 ? void 0 : value.item) === null || _z === void 0 ? void 0 : _z.textStyle), bindDatas: (_1 = (_0 = value === null || value === void 0 ? void 0 : value.item) === null || _0 === void 0 ? void 0 : _0.bindDatas) !== null && _1 !== void 0 ? _1 : [] }, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.props, (_2 = value === null || value === void 0 ? void 0 : value.item) === null || _2 === void 0 ? void 0 : _2.props, { event: ((_3 = value === null || value === void 0 ? void 0 : value.item) === null || _3 === void 0 ? void 0 : _3.event) || {}, schema: schema, id: value === null || value === void 0 ? void 0 : value.id, key: value === null || value === void 0 ? void 0 : value.id, recData: rec, isExternalLink: isExternalLink, index: index, isActive: isActive })));
|
53
43
|
}
|
54
44
|
else {
|
55
45
|
return null;
|
56
46
|
}
|
57
47
|
}, [rec, resolver, tempMap, schema, value === null || value === void 0 ? void 0 : value.id, isActive]);
|
58
|
-
return React.createElement(React.Fragment, null, renderComp);
|
48
|
+
return React.createElement(React.Fragment, null, renderComp());
|
59
49
|
};
|
60
|
-
export default
|
50
|
+
export default RenderCard;
|
@@ -8,6 +8,7 @@ import { css } from '@emotion/css';
|
|
8
8
|
import { setFontForText } from '../../../../core/utils/tool';
|
9
9
|
import { useEventReport } from '../../../../core/hooks/useEventReport';
|
10
10
|
const WaterfallFlowItem = (props) => {
|
11
|
+
var _a;
|
11
12
|
const { rec, index, list, reportTagsView, textStyles, space } = props;
|
12
13
|
const { swiperRef, setRtcList, setOpenHashtag, sxpParameter } = useSxpDataSource();
|
13
14
|
const [showVideo, setShowVideo] = useState(false);
|
@@ -36,16 +37,19 @@ const WaterfallFlowItem = (props) => {
|
|
36
37
|
return ((_a = rec === null || rec === void 0 ? void 0 : rec.product) === null || _a === void 0 ? void 0 : _a.title) || ((_b = rec === null || rec === void 0 ? void 0 : rec.video) === null || _b === void 0 ? void 0 : _b.title) || null;
|
37
38
|
}, [rec]);
|
38
39
|
const priceText = useMemo(() => {
|
39
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
40
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
41
|
+
const isToLocStr = ((_a = textStyles === null || textStyles === void 0 ? void 0 : textStyles.price) === null || _a === void 0 ? void 0 : _a.enableFormattedPrice) === undefined || ((_b = textStyles === null || textStyles === void 0 ? void 0 : textStyles.price) === null || _b === void 0 ? void 0 : _b.enableFormattedPrice);
|
42
|
+
if (((_c = rec === null || rec === void 0 ? void 0 : rec.product) === null || _c === void 0 ? void 0 : _c.currency) && ((_d = rec === null || rec === void 0 ? void 0 : rec.product) === null || _d === void 0 ? void 0 : _d.price)) {
|
43
|
+
return `${(_h = (_g = (_f = (_e = rec === null || rec === void 0 ? void 0 : rec.product) === null || _e === void 0 ? void 0 : _e.currency) === null || _f === void 0 ? void 0 : _f.split('-')[1]) === null || _g === void 0 ? void 0 : _g.toUpperCase()) !== null && _h !== void 0 ? _h : ''}${isToLocStr
|
44
|
+
? (_l = (_k = (_j = rec === null || rec === void 0 ? void 0 : rec.product) === null || _j === void 0 ? void 0 : _j.price) === null || _k === void 0 ? void 0 : _k.toLocaleString('zh', {
|
45
|
+
minimumFractionDigits: 0
|
46
|
+
})) !== null && _l !== void 0 ? _l : ''
|
47
|
+
: (_m = rec === null || rec === void 0 ? void 0 : rec.product) === null || _m === void 0 ? void 0 : _m.price}`;
|
44
48
|
}
|
45
49
|
else {
|
46
50
|
return null;
|
47
51
|
}
|
48
|
-
}, [rec]);
|
52
|
+
}, [rec, (_a = textStyles === null || textStyles === void 0 ? void 0 : textStyles.price) === null || _a === void 0 ? void 0 : _a.enableFormattedPrice]);
|
49
53
|
useEffect(() => {
|
50
54
|
const observer = new IntersectionObserver((entries) => {
|
51
55
|
entries.forEach((entry) => {
|
@@ -130,22 +134,27 @@ export default function WaterfallList(_a) {
|
|
130
134
|
const containerRef = useRef(null);
|
131
135
|
const [isLoadMore, setIsLoadMore] = useState(false);
|
132
136
|
const loadMoreData = useCallback(() => {
|
133
|
-
var _a, _b, _c, _d;
|
134
137
|
if (isLoadMore)
|
135
138
|
return;
|
136
139
|
setIsLoadMore(true);
|
137
140
|
waterFallData &&
|
138
|
-
(getRecommendVideos === null || getRecommendVideos === void 0 ? void 0 : getRecommendVideos(
|
141
|
+
(getRecommendVideos === null || getRecommendVideos === void 0 ? void 0 : getRecommendVideos({
|
142
|
+
hashTag: waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.hashTag
|
143
|
+
}).then((res) => {
|
139
144
|
var _a;
|
140
145
|
setList(list === null || list === void 0 ? void 0 : list.concat((_a = res === null || res === void 0 ? void 0 : res.recList) !== null && _a !== void 0 ? _a : []));
|
141
146
|
setIsLoadMore(false);
|
142
147
|
}));
|
143
148
|
}, [waterFallData, getRecommendVideos, list, isLoadMore]);
|
144
149
|
useEffect(() => {
|
145
|
-
var _a, _b
|
150
|
+
var _a, _b;
|
146
151
|
setIsLoadingData(true);
|
147
152
|
waterFallData &&
|
148
|
-
(getRecommendVideos === null || getRecommendVideos === void 0 ? void 0 : getRecommendVideos(
|
153
|
+
(getRecommendVideos === null || getRecommendVideos === void 0 ? void 0 : getRecommendVideos({
|
154
|
+
hashTag: waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.hashTag,
|
155
|
+
defaultSize: hashTagSize,
|
156
|
+
maxSize: hashTagSize
|
157
|
+
}).then((res) => {
|
149
158
|
var _a, _b;
|
150
159
|
setData(res);
|
151
160
|
setList((_b = (_a = res === null || res === void 0 ? void 0 : res.recList) === null || _a === void 0 ? void 0 : _a.filter((item) => (item === null || item === void 0 ? void 0 : item.video) !== null || (item === null || item === void 0 ? void 0 : item.product) !== null)) !== null && _b !== void 0 ? _b : []);
|
@@ -154,7 +163,7 @@ export default function WaterfallList(_a) {
|
|
154
163
|
if (isOpenHashTag) {
|
155
164
|
const res = previewData;
|
156
165
|
setData(res);
|
157
|
-
setList((
|
166
|
+
setList((_b = (_a = res === null || res === void 0 ? void 0 : res.recList) === null || _a === void 0 ? void 0 : _a.filter((item) => (item === null || item === void 0 ? void 0 : item.video) !== null || (item === null || item === void 0 ? void 0 : item.product) !== null)) !== null && _b !== void 0 ? _b : []);
|
158
167
|
setIsLoadingData(false);
|
159
168
|
}
|
160
169
|
}, [waterFallData, getRecommendVideos, hashTagSize, isOpenHashTag]);
|
@@ -8,6 +8,7 @@ import { css } from '@emotion/css';
|
|
8
8
|
import { setFontForText } from '../../../../core/utils/tool';
|
9
9
|
import { useEventReport } from '../../../../core/hooks/useEventReport';
|
10
10
|
const WaterfallFlowItem = (props) => {
|
11
|
+
var _a;
|
11
12
|
const { rec, style = {}, sizeChange = () => { }, unitWidth, index, showBorder, list, reportTagsView, textStyles, space } = props;
|
12
13
|
const { swiperRef, setRtcList, setOpenHashtag, sxpParameter } = useSxpDataSource();
|
13
14
|
const [showVideo, setShowVideo] = useState(false);
|
@@ -59,16 +60,19 @@ const WaterfallFlowItem = (props) => {
|
|
59
60
|
}
|
60
61
|
}, [top, showBorder]);
|
61
62
|
const priceText = useMemo(() => {
|
62
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
63
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
64
|
+
const isToLocStr = ((_a = textStyles === null || textStyles === void 0 ? void 0 : textStyles.price) === null || _a === void 0 ? void 0 : _a.enableFormattedPrice) === undefined || ((_b = textStyles === null || textStyles === void 0 ? void 0 : textStyles.price) === null || _b === void 0 ? void 0 : _b.enableFormattedPrice);
|
65
|
+
if (((_c = rec === null || rec === void 0 ? void 0 : rec.product) === null || _c === void 0 ? void 0 : _c.currency) && ((_d = rec === null || rec === void 0 ? void 0 : rec.product) === null || _d === void 0 ? void 0 : _d.price)) {
|
66
|
+
return `${(_h = (_g = (_f = (_e = rec === null || rec === void 0 ? void 0 : rec.product) === null || _e === void 0 ? void 0 : _e.currency) === null || _f === void 0 ? void 0 : _f.split('-')[1]) === null || _g === void 0 ? void 0 : _g.toUpperCase()) !== null && _h !== void 0 ? _h : ''}${isToLocStr
|
67
|
+
? (_l = (_k = (_j = rec === null || rec === void 0 ? void 0 : rec.product) === null || _j === void 0 ? void 0 : _j.price) === null || _k === void 0 ? void 0 : _k.toLocaleString('zh', {
|
68
|
+
minimumFractionDigits: 0
|
69
|
+
})) !== null && _l !== void 0 ? _l : ''
|
70
|
+
: (_m = rec === null || rec === void 0 ? void 0 : rec.product) === null || _m === void 0 ? void 0 : _m.price}`;
|
67
71
|
}
|
68
72
|
else {
|
69
73
|
return null;
|
70
74
|
}
|
71
|
-
}, [rec]);
|
75
|
+
}, [rec, (_a = textStyles === null || textStyles === void 0 ? void 0 : textStyles.price) === null || _a === void 0 ? void 0 : _a.enableFormattedPrice]);
|
72
76
|
useEffect(() => {
|
73
77
|
if (imgDom.current === null || src === '') {
|
74
78
|
return;
|
@@ -209,10 +213,14 @@ export default function WaterfallList(_a) {
|
|
209
213
|
styleListRef.current = getStyleList();
|
210
214
|
}, [unitWidth, rowsNum, list]);
|
211
215
|
useEffect(() => {
|
212
|
-
var _a, _b
|
216
|
+
var _a, _b;
|
213
217
|
setIsLoadingData(true);
|
214
218
|
waterFallData &&
|
215
|
-
(getRecommendVideos === null || getRecommendVideos === void 0 ? void 0 : getRecommendVideos(
|
219
|
+
(getRecommendVideos === null || getRecommendVideos === void 0 ? void 0 : getRecommendVideos({
|
220
|
+
hashTag: waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.hashTag,
|
221
|
+
defaultSize: hashTagSize,
|
222
|
+
maxSize: hashTagSize
|
223
|
+
}).then((res) => {
|
216
224
|
var _a, _b;
|
217
225
|
setData(res);
|
218
226
|
setList((_b = (_a = res === null || res === void 0 ? void 0 : res.recList) === null || _a === void 0 ? void 0 : _a.filter((item) => (item === null || item === void 0 ? void 0 : item.video) !== null || (item === null || item === void 0 ? void 0 : item.product) !== null)) !== null && _b !== void 0 ? _b : []);
|
@@ -221,7 +229,7 @@ export default function WaterfallList(_a) {
|
|
221
229
|
if (isOpenHashTag) {
|
222
230
|
const res = previewData;
|
223
231
|
setData(res);
|
224
|
-
setList((
|
232
|
+
setList((_b = (_a = res === null || res === void 0 ? void 0 : res.recList) === null || _a === void 0 ? void 0 : _a.filter((item) => (item === null || item === void 0 ? void 0 : item.video) !== null || (item === null || item === void 0 ? void 0 : item.product) !== null)) !== null && _b !== void 0 ? _b : []);
|
225
233
|
setIsLoadingData(false);
|
226
234
|
}
|
227
235
|
}, [waterFallData, getRecommendVideos, hashTagSize, isOpenHashTag]);
|
@@ -246,10 +254,11 @@ export default function WaterfallList(_a) {
|
|
246
254
|
};
|
247
255
|
}, [onResize]);
|
248
256
|
const loadMoreData = useCallback(() => {
|
249
|
-
var _a, _b, _c, _d;
|
250
257
|
setIsLoadingData(true);
|
251
258
|
waterFallData &&
|
252
|
-
(getRecommendVideos === null || getRecommendVideos === void 0 ? void 0 : getRecommendVideos(
|
259
|
+
(getRecommendVideos === null || getRecommendVideos === void 0 ? void 0 : getRecommendVideos({
|
260
|
+
hashTag: waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.hashTag
|
261
|
+
}).then((res) => {
|
253
262
|
var _a, _b;
|
254
263
|
setList(list === null || list === void 0 ? void 0 : list.concat((_b = (_a = res === null || res === void 0 ? void 0 : res.recList) === null || _a === void 0 ? void 0 : _a.filter((item) => !(item === null || item === void 0 ? void 0 : item.video))) !== null && _b !== void 0 ? _b : []));
|
255
264
|
setIsLoadingData(false);
|
@@ -34,7 +34,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
34
34
|
const [isShowMore, setIsShowMore] = useState(false);
|
35
35
|
const [isReload, setIsReload] = useState(new Date().getTime());
|
36
36
|
const skipLinkRef = useRef(false);
|
37
|
-
const { loadVideos, bffEventReport, loading, setPopupDetailData, ctaEvent, swiperRef, waterFallData, setOpenHashtag, appDomain, openHashtag, loadingImage, isFromHashtag, popupDetailData, bffFbReport, curTime, h5EnterLink, isShowConsent, selectTag, isPreview } = useSxpDataSource();
|
37
|
+
const { loadVideos, bffEventReport, loading, setPopupDetailData, ctaEvent, swiperRef, waterFallData, setOpenHashtag, appDomain, openHashtag, loadingImage, isFromHashtag, popupDetailData, bffFbReport, curTime, h5EnterLink, isShowConsent, selectTag, isPreview, isEditor } = useSxpDataSource();
|
38
38
|
const { backMainFeed, productView, jumpToWeb } = useEventReport();
|
39
39
|
const isShowFingerTip = useMemo(() => {
|
40
40
|
return data.length > 0 && !loading && (getFeUserId() || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enableSwiperTip));
|
@@ -64,6 +64,8 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
64
64
|
}, [data.length, bffFbReport, h5EnterLink]);
|
65
65
|
useEffect(() => {
|
66
66
|
var _a;
|
67
|
+
if (!ctaType || (ctaType === null || ctaType === void 0 ? void 0 : ctaType.length) < 1)
|
68
|
+
return;
|
67
69
|
const index = (data === null || data === void 0 ? void 0 : data.findIndex((item) => {
|
68
70
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
69
71
|
const ctaType0 = ctaType === null || ctaType === void 0 ? void 0 : ctaType[0];
|
@@ -77,8 +79,9 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
77
79
|
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));
|
78
80
|
}
|
79
81
|
})) || 0;
|
80
|
-
(
|
81
|
-
|
82
|
+
if (index !== -1)
|
83
|
+
(_a = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _a === void 0 ? void 0 : _a.swiper.slideTo(index);
|
84
|
+
}, [data, ctaType, swiperRef]);
|
82
85
|
useEffect(() => {
|
83
86
|
const item = data === null || data === void 0 ? void 0 : data[activeIndex];
|
84
87
|
const visibleChange = () => {
|
@@ -177,7 +180,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
177
180
|
}, [globalConfig, containerHeight, tagHeight]);
|
178
181
|
const visList = useMemo(() => {
|
179
182
|
var _a;
|
180
|
-
const list = activeIndex === 0 && !waterFallData
|
183
|
+
const list = activeIndex === 0 && !waterFallData && !isEditor
|
181
184
|
? [(_a = data === null || data === void 0 ? void 0 : data[0]) !== null && _a !== void 0 ? _a : null]
|
182
185
|
: data === null || data === void 0 ? void 0 : data.map((item, index) => {
|
183
186
|
if (activeIndex === index || index - 1 === activeIndex || index + 1 === activeIndex) {
|
@@ -188,7 +191,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
188
191
|
}
|
189
192
|
});
|
190
193
|
return !waterFallData ? list.concat([{ loading: true }]) : list;
|
191
|
-
}, [data, activeIndex, waterFallData]);
|
194
|
+
}, [data, activeIndex, waterFallData, isEditor]);
|
192
195
|
const renderLogo = useMemo(() => {
|
193
196
|
var _a, _b, _c, _d;
|
194
197
|
if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.logoUrl) && (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowLogo)) {
|
@@ -433,6 +436,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
433
436
|
position: (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconFixed) ? 'fixed' : 'absolute',
|
434
437
|
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',
|
435
438
|
zIndex: 999,
|
439
|
+
transform: 'translate3d(0px,0px,0px)',
|
436
440
|
[(_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,
|
437
441
|
[(_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
|
438
442
|
}, 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 })));
|
@@ -451,10 +455,10 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
451
455
|
alignItems: 'center'
|
452
456
|
} },
|
453
457
|
React.createElement("img", { width: 64, height: 64, src: loadingImage, alt: 'loading...', style: { objectFit: 'contain' } }))) : (React.createElement(React.Fragment, null,
|
454
|
-
renderContent(rec, index),
|
455
|
-
renderBottom(rec, index),
|
456
458
|
renderLikeButton(rec, index, !(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIconFixed)),
|
457
|
-
renderToggleButton(!(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconFixed))
|
459
|
+
renderToggleButton(!(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconFixed)),
|
460
|
+
renderBottom(rec, index),
|
461
|
+
renderContent(rec, index)))))));
|
458
462
|
});
|
459
463
|
}, [
|
460
464
|
containerWidth,
|
@@ -489,9 +493,9 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
489
493
|
if (openHashtag)
|
490
494
|
return;
|
491
495
|
handleScrollEvent(swiper);
|
492
|
-
if (waterFallData)
|
496
|
+
if (waterFallData || isEditor)
|
493
497
|
return;
|
494
|
-
if ((swiper === null || swiper === void 0 ? void 0 : swiper.activeIndex) +
|
498
|
+
if ((swiper === null || swiper === void 0 ? void 0 : swiper.activeIndex) + 1 >= (data === null || data === void 0 ? void 0 : data.length)) {
|
495
499
|
if (!isLoadMore) {
|
496
500
|
setIsLoadMore(true);
|
497
501
|
loadVideos === null || loadVideos === void 0 ? void 0 : loadVideos(Math.ceil(activeIndex / 10) + 1).then(() => {
|
@@ -25,7 +25,8 @@ const EditorDataProvider = ({ children, data }) => {
|
|
25
25
|
setOpenHashtag,
|
26
26
|
openConsent,
|
27
27
|
setOpenConsent,
|
28
|
-
sxpFontLinks: data === null || data === void 0 ? void 0 : data.sxpFontLinks
|
28
|
+
sxpFontLinks: data === null || data === void 0 ? void 0 : data.sxpFontLinks,
|
29
|
+
utmParameter: data === null || data === void 0 ? void 0 : data.utm_parameter
|
29
30
|
} }, children));
|
30
31
|
};
|
31
32
|
export 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 {
|
@@ -93,8 +93,8 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
93
93
|
.catch((err) => Promise.reject(err));
|
94
94
|
}, [bffDataSource]);
|
95
95
|
const getRecommendVideos = useCallback((query) => __awaiter(void 0, void 0, void 0, function* () {
|
96
|
-
var _d, _e, _f, _g, _h, _j, _k;
|
97
|
-
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}]` }));
|
96
|
+
var _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
97
|
+
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 });
|
98
98
|
if (utmVal) {
|
99
99
|
const val = (_h = (_g = (_f = utmVal === null || utmVal === void 0 ? void 0 : utmVal.split('&')) === null || _f === void 0 ? void 0 : _f.filter((val) => {
|
100
100
|
var _a, _b;
|
@@ -103,30 +103,34 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
103
103
|
})) === null || _g === void 0 ? void 0 : _g.join('&')) !== null && _h !== void 0 ? _h : '';
|
104
104
|
query = Object.assign(Object.assign({}, query), { channel: decodeURIComponent(val) });
|
105
105
|
}
|
106
|
-
if (
|
107
|
-
query = Object.assign(Object.assign(
|
108
|
-
|
106
|
+
if (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview) {
|
107
|
+
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 });
|
108
|
+
}
|
109
|
+
if (isEditor) {
|
110
|
+
let pageNum = 1;
|
111
|
+
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] }));
|
112
|
+
if (!(query === null || query === void 0 ? void 0 : query.channel) || isInit.current)
|
109
113
|
return;
|
114
|
+
isInit.current = true;
|
110
115
|
let list = [];
|
111
116
|
let result = null;
|
112
|
-
let pageNum = 1;
|
113
117
|
const recurveRecList = (query) => __awaiter(void 0, void 0, void 0, function* () {
|
114
|
-
var
|
118
|
+
var _r, _s, _t, _u, _v, _w;
|
115
119
|
query.pageNum = pageNum;
|
116
120
|
result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/recommend/list', { method: 'GET', query }));
|
117
121
|
if (!(result === null || result === void 0 ? void 0 : result.success)) {
|
118
122
|
return undefined;
|
119
123
|
}
|
120
|
-
const
|
121
|
-
list = list.concat((
|
122
|
-
if (
|
124
|
+
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));
|
125
|
+
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 : []);
|
126
|
+
if (isNotNullList) {
|
123
127
|
pageNum = pageNum + 1;
|
124
128
|
yield recurveRecList(query);
|
125
129
|
}
|
126
130
|
});
|
127
131
|
yield recurveRecList(query);
|
128
132
|
if (!(query === null || query === void 0 ? void 0 : query.hashTag) && result)
|
129
|
-
setCurReqInfo({ rtc: (
|
133
|
+
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 });
|
130
134
|
return Object.assign(Object.assign({}, result.data), { recList: list });
|
131
135
|
}
|
132
136
|
const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/recommend/list', { method: 'GET', query }));
|
@@ -135,15 +139,20 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
135
139
|
}
|
136
140
|
if (!(query === null || query === void 0 ? void 0 : query.hashTag))
|
137
141
|
setCurReqInfo({ rtc: result.data.rtc, requestId: result.data.requestId });
|
142
|
+
if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview) && !isEditor) {
|
143
|
+
let list = [];
|
144
|
+
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 : []);
|
145
|
+
return Object.assign(Object.assign({}, result.data), { recList: list });
|
146
|
+
}
|
138
147
|
return result === null || result === void 0 ? void 0 : result.data;
|
139
|
-
}), [bffFetch, utmVal, maxSize, defaultSize,
|
140
|
-
const loadVideos = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
141
|
-
var
|
148
|
+
}), [bffFetch, utmVal, maxSize, defaultSize, channelQueryList]);
|
149
|
+
const loadVideos = useCallback((pageNum) => __awaiter(void 0, void 0, void 0, function* () {
|
150
|
+
var _x, _y, _z, _0;
|
142
151
|
if (rtcList.length <= 0) {
|
143
152
|
return;
|
144
153
|
}
|
145
154
|
const lastItem = rtcList === null || rtcList === void 0 ? void 0 : rtcList[(rtcList === null || rtcList === void 0 ? void 0 : rtcList.length) - 1];
|
146
|
-
const data = yield getRecommendVideos(Object.assign(Object.assign(Object.assign({ hashTag: waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.hashTag }, (((
|
155
|
+
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 })));
|
147
156
|
setRtcList(rtcList.concat(getFilterRecList(data)));
|
148
157
|
setCacheRtcList(cacheRtcList.concat(getFilterRecList(data)));
|
149
158
|
}), [getRecommendVideos, rtcList, waterFallData, cacheRtcList]);
|
@@ -155,7 +164,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
155
164
|
userInfo = {};
|
156
165
|
}
|
157
166
|
const sessionID = storeAndLoadFeSessionId();
|
158
|
-
const ef = Object.assign(Object.assign({ sessionID, rtc: curReqInfo.rtc, requestId: curReqInfo.requestId }, eventInfo), { sxpDevice: getDevice(), sxpSystem: getSystem(), sxpBrowser: getBrowserInfo() });
|
167
|
+
const ef = Object.assign(Object.assign(Object.assign(Object.assign({ sessionID, rtc: curReqInfo.rtc, requestId: curReqInfo.requestId }, eventInfo), (getDevice() && { sxpDevice: getDevice() })), (getSystem() && { sxpSystem: getSystem() })), (getBrowserInfo() && { sxpBrowser: getBrowserInfo() }));
|
159
168
|
const realUserInfo = Object.entries(userInfo).map(([k, v]) => ({ name: k, value: v }));
|
160
169
|
const realEventInfo = Object.entries(ef)
|
161
170
|
.map(([k, v]) => v && { name: k, value: v })
|
@@ -171,24 +180,21 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
171
180
|
});
|
172
181
|
}, [bffFetch, curReqInfo, enableReportEvent, globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview]);
|
173
182
|
const bffFbReport = useCallback((_a) => {
|
174
|
-
var _b, _c;
|
183
|
+
var _b, _c, _d;
|
175
184
|
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;
|
176
185
|
if (!enableReportEvent || !enabledMetaConversionApi || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview)) {
|
177
186
|
return;
|
178
187
|
}
|
179
188
|
const fakeUserId = storeAndLoadFeUserId();
|
189
|
+
const urlParams = new URLSearchParams(window.location.search);
|
190
|
+
const fbclid = urlParams.get('fbclid');
|
180
191
|
return bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/fb/events', {
|
181
192
|
method: 'POST',
|
182
193
|
body: {
|
183
194
|
eventName,
|
184
195
|
actionSource,
|
185
196
|
eventSourceUrl,
|
186
|
-
userData: {
|
187
|
-
externalId: fakeUserId,
|
188
|
-
fbc: `fb.2.${new Date().getTime()}.${getCookie('_fbc')}`,
|
189
|
-
fbp: `fb.2.${new Date().getTime()}.${getCookie('_fbp')}`,
|
190
|
-
client_user_agent: (_c = window === null || window === void 0 ? void 0 : window.navigator) === null || _c === void 0 ? void 0 : _c.userAgent
|
191
|
-
}
|
197
|
+
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')}` })), { 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 : '' })
|
192
198
|
},
|
193
199
|
type: 'beacon'
|
194
200
|
});
|
@@ -206,17 +212,17 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
206
212
|
return res === null || res === void 0 ? void 0 : res.success;
|
207
213
|
}), [bffFetch]);
|
208
214
|
const bffGetTagList = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
209
|
-
var
|
215
|
+
var _1, _2, _3, _4, _5;
|
210
216
|
if (!utmVal || !isShowTag)
|
211
217
|
return;
|
212
218
|
try {
|
213
|
-
const val = (
|
219
|
+
const val = (_3 = (_2 = (_1 = utmVal === null || utmVal === void 0 ? void 0 : utmVal.split('&')) === null || _1 === void 0 ? void 0 : _1.filter((val) => {
|
214
220
|
var _a, _b;
|
215
221
|
const key = val.split('=')[0];
|
216
222
|
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);
|
217
|
-
})) === null ||
|
223
|
+
})) === null || _2 === void 0 ? void 0 : _2.join('&')) !== null && _3 !== void 0 ? _3 : '';
|
218
224
|
const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/tag/list', { method: 'GET', query: { channel: decodeURIComponent(val) } }));
|
219
|
-
setTagList((
|
225
|
+
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 : []);
|
220
226
|
}
|
221
227
|
catch (e) {
|
222
228
|
console.log('e', e);
|
@@ -289,11 +295,10 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
289
295
|
}
|
290
296
|
});
|
291
297
|
setLoading(false);
|
292
|
-
isInit.current = true;
|
293
298
|
});
|
294
299
|
}, [isShowConsent]);
|
295
300
|
useEffect(() => {
|
296
|
-
if (!
|
301
|
+
if (!isPreview)
|
297
302
|
return;
|
298
303
|
setLoading(true);
|
299
304
|
bffGetTagList();
|
@@ -303,9 +308,15 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
303
308
|
setCacheRtcList(getFilterRecList(data));
|
304
309
|
})
|
305
310
|
.finally(() => {
|
311
|
+
bffEventReport({
|
312
|
+
eventInfo: {
|
313
|
+
eventSubject: 'apiRequest',
|
314
|
+
eventDescription: 'api request succeed'
|
315
|
+
}
|
316
|
+
});
|
306
317
|
setLoading(false);
|
307
318
|
});
|
308
|
-
}, [
|
319
|
+
}, [getRecommendVideos, bffGetTagList]);
|
309
320
|
const defaultLoadingImage = useIconLink('/pb_static/a65d23c5893c49d7aaaa81681d3179e2.gif', appDomain);
|
310
321
|
return (React.createElement(SxpDataSourceContext.Provider, { value: {
|
311
322
|
rtcList,
|
@@ -353,7 +364,8 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
353
364
|
setSelectTag,
|
354
365
|
globalConfig,
|
355
366
|
popupCurTimeRef,
|
356
|
-
checkCommodityIndexRef
|
367
|
+
checkCommodityIndexRef,
|
368
|
+
isEditor
|
357
369
|
} }, isShowConsent ? (React.createElement(Consent, 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({
|
358
370
|
rtcList,
|
359
371
|
mutateLike: bffMutateLike,
|
package/es/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 };
|