pb-sxp-ui 1.3.1 → 1.3.3
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 +238 -184
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.js +238 -184
- 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 +238 -184
- 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 +21 -13
- 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 +53 -35
- 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.d.ts +1 -0
- package/es/materials/sxp/popup/CommodityDetail/index.js +26 -27
- package/es/materials/sxp/popup/CommodityDetailDiroNew/index.d.ts +1 -0
- package/es/materials/sxp/popup/CommodityDetailDiroNew/index.js +30 -31
- 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 +21 -13
- 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 +53 -35
- 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.d.ts +1 -0
- package/lib/materials/sxp/popup/CommodityDetail/index.js +26 -27
- package/lib/materials/sxp/popup/CommodityDetailDiroNew/index.d.ts +1 -0
- package/lib/materials/sxp/popup/CommodityDetailDiroNew/index.js +30 -31
- 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) {
|
@@ -187,8 +190,8 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
187
190
|
return null;
|
188
191
|
}
|
189
192
|
});
|
190
|
-
return !waterFallData ? list.concat([{ loading: true }]) : list;
|
191
|
-
}, [data, activeIndex, waterFallData]);
|
193
|
+
return !waterFallData && !isEditor ? list.concat([{ loading: true }]) : list;
|
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)) {
|
@@ -351,7 +354,6 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
351
354
|
};
|
352
355
|
const handleScrollEvent = (swiper) => {
|
353
356
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
354
|
-
viewTime.current = new Date();
|
355
357
|
const item = data[swiper.previousIndex];
|
356
358
|
if (!item)
|
357
359
|
return;
|
@@ -389,6 +391,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
389
391
|
eventName: 'ProductView'
|
390
392
|
});
|
391
393
|
}
|
394
|
+
viewTime.current = new Date();
|
392
395
|
};
|
393
396
|
const handleReportProductView = (item) => {
|
394
397
|
var _a, _b, _c;
|
@@ -398,8 +401,12 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
398
401
|
};
|
399
402
|
useEffect(() => {
|
400
403
|
const item = data[activeIndex];
|
401
|
-
if (openHashtag)
|
404
|
+
if (openHashtag) {
|
402
405
|
handleReportProductView(item);
|
406
|
+
}
|
407
|
+
else {
|
408
|
+
viewTime.current = new Date();
|
409
|
+
}
|
403
410
|
}, [openHashtag, data, activeIndex]);
|
404
411
|
const handleViewImageStartEvent = (activeIndex) => {
|
405
412
|
var _a, _b, _c, _d, _e, _f;
|
@@ -433,6 +440,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
433
440
|
position: (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconFixed) ? 'fixed' : 'absolute',
|
434
441
|
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
442
|
zIndex: 999,
|
443
|
+
transform: 'translate3d(0px,0px,0px)',
|
436
444
|
[(_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
445
|
[(_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
446
|
}, 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 +459,10 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
451
459
|
alignItems: 'center'
|
452
460
|
} },
|
453
461
|
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
462
|
renderLikeButton(rec, index, !(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIconFixed)),
|
457
|
-
renderToggleButton(!(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconFixed))
|
463
|
+
renderToggleButton(!(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconFixed)),
|
464
|
+
renderBottom(rec, index),
|
465
|
+
renderContent(rec, index)))))));
|
458
466
|
});
|
459
467
|
}, [
|
460
468
|
containerWidth,
|
@@ -489,9 +497,9 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
489
497
|
if (openHashtag)
|
490
498
|
return;
|
491
499
|
handleScrollEvent(swiper);
|
492
|
-
if (waterFallData)
|
500
|
+
if (waterFallData || isEditor)
|
493
501
|
return;
|
494
|
-
if ((swiper === null || swiper === void 0 ? void 0 : swiper.activeIndex) +
|
502
|
+
if ((swiper === null || swiper === void 0 ? void 0 : swiper.activeIndex) + 1 >= (data === null || data === void 0 ? void 0 : data.length)) {
|
495
503
|
if (!isLoadMore) {
|
496
504
|
setIsLoadMore(true);
|
497
505
|
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 {
|