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
@@ -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
|
} | {
|
@@ -5,14 +5,15 @@ import './index.less';
|
|
5
5
|
import { useSxpDataSource } from '../../../../core/hooks';
|
6
6
|
const Iframe = (_a) => {
|
7
7
|
var _b, _c;
|
8
|
-
var { content, btnText, style, icon, isPopup, isExternalLink, onClose, onClick, submitButtonStyle, contentStyle } = _a, props = __rest(_a, ["content", "btnText", "style", "icon", "isPopup", "isExternalLink", "onClose", "onClick", "submitButtonStyle", "contentStyle"]);
|
8
|
+
var { content, btnText, style, icon, isPopup, isExternalLink, onClose, onClick, submitButtonStyle, contentStyle, isTel } = _a, props = __rest(_a, ["content", "btnText", "style", "icon", "isPopup", "isExternalLink", "onClose", "onClick", "submitButtonStyle", "contentStyle", "isTel"]);
|
9
9
|
const { popupDetailData } = useSxpDataSource();
|
10
10
|
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;
|
11
|
-
return (React.createElement("div", Object.assign({ className: `${css(Object.assign({}, style)
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
11
|
+
return (React.createElement("div", Object.assign({ className: `${css(Object.assign(Object.assign({}, style), { height: isTel ? 664 : window === null || window === void 0 ? void 0 : window.innerHeight }))}` }, props),
|
12
|
+
React.createElement("iframe", { src: iframeUrl, style: {
|
13
|
+
width: '100%',
|
14
|
+
height: 'calc(100% - 50px)',
|
15
|
+
marginTop: '40px',
|
16
|
+
border: 'none'
|
17
|
+
} })));
|
17
18
|
};
|
18
19
|
export default memo(Iframe);
|
@@ -7,7 +7,7 @@ const ReactDOM = tslib_1.__importStar(require("react-dom"));
|
|
7
7
|
const hooks_1 = require("../../../../core/hooks");
|
8
8
|
const closeIcon = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAjhJREFUWEfFlztOw0AQhmeWiJ4CCmpQ5DiRQsIJyAWg5A0lR0AIChDiCJS8ER0cADgBeRSxt4CCDgkaKiq8i+zYeWx2413HEWmiJJv9v535Z2aN8M8vFPT9z3zETD0aAUChUJjwvPFHAJhBhB3Hqd6OAsK2yyucwykAvP38eJX398Z3AJDLlVYR8ToU9Rhj25TWr9KEsKy5dULIGQCMtfZly45TvwsAstm56UwG6wA4FUFwzrdctxZBDcWSy5XWEPG8I84/GcMipdWPtgcsaz5PCHtKG0IuTiqUvjT9U/WYMG2IOPE+AP+LtCB0xKUAAyA2Xbd2o2OG0NQXvTnvhL17D7EPtH9TRCIWwkRcGYGIQgYBABuqPuHXOQBc6pw80lBGwBQiiXhsBHQhkoprA6iM6acjhDQKu5YJZW6XeOI3XJdpvfsdTu52VfXEekD8owQiXGIubpSCbhDbLu8DwKEAd+A41SOdPpE4BS0viFOtvV2iKWqUgn5x/tmS70xR01GuDSCKc86/OCcLgTyyZ0ScDGNhFAktAJV4NFJ9YyaFiAWIE+9uVkkgBgLoig8DMWAa9ro9ynkUdlW5maZDCmB6clmz0k1HH4Cs1Ezbq2p2yEpUuBOKTSZZex00RUWIrltxuuK6EOGDSbGIOPZicpMx6fny650377qNRgBgWeVFQuA+6UjVgREhGIMlSqsPUQqIbZdOOIdZQmCv2axRnU1N1+TzJYsxOEaEV8ep7frPZ7Gd0FTEdP0ft0/kMNdg0eoAAAAASUVORK5CYII=';
|
9
9
|
const Modal = ({ visible, onClose, children, modalStyle, padding, popup, schema, fullHeight = window.innerHeight, isFullScreen = false }) => {
|
10
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
|
10
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
|
11
11
|
const touchRef = (0, react_1.useRef)(null);
|
12
12
|
const fTouchRef = (0, react_1.useRef)(null);
|
13
13
|
const touchMoveRef = (0, react_1.useRef)(null);
|
@@ -129,8 +129,8 @@ const Modal = ({ visible, onClose, children, modalStyle, padding, popup, schema,
|
|
129
129
|
react_1.default.createElement("div", { onClick: onClose, className: 'modal-icon-wrapper' },
|
130
130
|
react_1.default.createElement("img", { src: (_t = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.popupCloseIcon) !== null && _t !== void 0 ? _t : closeIcon, alt: 'close', className: 'modal-icon' })),
|
131
131
|
react_1.default.createElement("div", { ref: ref, style: {
|
132
|
-
height: (isScrollFullScreen ? fullHeight : MODAL_DEF_CON_H) -
|
133
|
-
((_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),
|
132
|
+
height: (_x = (isScrollFullScreen ? fullHeight : MODAL_DEF_CON_H) -
|
133
|
+
((_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,
|
134
134
|
overflow: (isScrollFullScreen && modalTrans <= 0) || !isScrollFullScreen ? 'auto' : 'hidden'
|
135
135
|
} }, children)))))), modalEleRef.current);
|
136
136
|
};
|
@@ -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;
|
@@ -21,43 +21,33 @@ const RenderCard = ({ rec, index, tempMap, resolver, includesCtaType, isActive }
|
|
21
21
|
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;
|
22
22
|
}
|
23
23
|
const value = tempMap === null || tempMap === void 0 ? void 0 : tempMap[cta];
|
24
|
-
const renderComp = (0, react_1.
|
25
|
-
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
|
24
|
+
const renderComp = (0, react_1.useCallback)(() => {
|
25
|
+
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;
|
26
26
|
if (!(rec === null || rec === void 0 ? void 0 : rec.video))
|
27
27
|
return null;
|
28
|
-
|
29
|
-
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) {
|
30
|
-
cta = '多商品CTA';
|
31
|
-
}
|
32
|
-
else if ((_c = rec === null || rec === void 0 ? void 0 : rec.video) === null || _c === void 0 ? void 0 : _c.bindProduct) {
|
33
|
-
cta = '商品CTA';
|
34
|
-
}
|
35
|
-
else {
|
36
|
-
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;
|
37
|
-
}
|
38
|
-
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)))
|
28
|
+
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)))
|
39
29
|
return;
|
40
|
-
if (!includesCtaType && ((
|
30
|
+
if (!includesCtaType && ((_b = value === null || value === void 0 ? void 0 : value.item) === null || _b === void 0 ? void 0 : _b.category) === 'cta')
|
41
31
|
return;
|
42
|
-
if ((((
|
43
|
-
(((
|
44
|
-
(((
|
45
|
-
(((
|
46
|
-
(((
|
47
|
-
(((
|
32
|
+
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)) ||
|
33
|
+
(((_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)) ||
|
34
|
+
(((_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)) ||
|
35
|
+
(((_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)) ||
|
36
|
+
(((_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)) ||
|
37
|
+
(((_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))) {
|
48
38
|
return null;
|
49
39
|
}
|
50
40
|
if (value && resolver) {
|
51
|
-
const t = resolver[(
|
41
|
+
const t = resolver[(_t = value === null || value === void 0 ? void 0 : value.item) === null || _t === void 0 ? void 0 : _t.type];
|
52
42
|
const Component = (0, withBindDataSource_1.default)(t);
|
53
|
-
const defaulSetting = (
|
54
|
-
const isExternalLink = ((
|
55
|
-
return (react_1.default.createElement(Component, Object.assign({ style: Object.assign(Object.assign(Object.assign({}, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.style), (
|
43
|
+
const defaulSetting = (_u = t === null || t === void 0 ? void 0 : t.extend) === null || _u === void 0 ? void 0 : _u.defaulSetting;
|
44
|
+
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';
|
45
|
+
return (react_1.default.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 })));
|
56
46
|
}
|
57
47
|
else {
|
58
48
|
return null;
|
59
49
|
}
|
60
50
|
}, [rec, resolver, tempMap, schema, value === null || value === void 0 ? void 0 : value.id, isActive]);
|
61
|
-
return react_1.default.createElement(react_1.default.Fragment, null, renderComp);
|
51
|
+
return react_1.default.createElement(react_1.default.Fragment, null, renderComp());
|
62
52
|
};
|
63
|
-
exports.default =
|
53
|
+
exports.default = RenderCard;
|
@@ -10,6 +10,7 @@ const css_1 = require("@emotion/css");
|
|
10
10
|
const tool_1 = require("../../../../core/utils/tool");
|
11
11
|
const useEventReport_1 = require("../../../../core/hooks/useEventReport");
|
12
12
|
const WaterfallFlowItem = (props) => {
|
13
|
+
var _a;
|
13
14
|
const { rec, index, list, reportTagsView, textStyles, space } = props;
|
14
15
|
const { swiperRef, setRtcList, setOpenHashtag, sxpParameter } = (0, hooks_1.useSxpDataSource)();
|
15
16
|
const [showVideo, setShowVideo] = (0, react_1.useState)(false);
|
@@ -38,16 +39,19 @@ const WaterfallFlowItem = (props) => {
|
|
38
39
|
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;
|
39
40
|
}, [rec]);
|
40
41
|
const priceText = (0, react_1.useMemo)(() => {
|
41
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
42
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
43
|
+
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);
|
44
|
+
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)) {
|
45
|
+
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
|
46
|
+
? (_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', {
|
47
|
+
minimumFractionDigits: 0
|
48
|
+
})) !== null && _l !== void 0 ? _l : ''
|
49
|
+
: (_m = rec === null || rec === void 0 ? void 0 : rec.product) === null || _m === void 0 ? void 0 : _m.price}`;
|
46
50
|
}
|
47
51
|
else {
|
48
52
|
return null;
|
49
53
|
}
|
50
|
-
}, [rec]);
|
54
|
+
}, [rec, (_a = textStyles === null || textStyles === void 0 ? void 0 : textStyles.price) === null || _a === void 0 ? void 0 : _a.enableFormattedPrice]);
|
51
55
|
(0, react_1.useEffect)(() => {
|
52
56
|
const observer = new IntersectionObserver((entries) => {
|
53
57
|
entries.forEach((entry) => {
|
@@ -132,22 +136,27 @@ function WaterfallList(_a) {
|
|
132
136
|
const containerRef = (0, react_1.useRef)(null);
|
133
137
|
const [isLoadMore, setIsLoadMore] = (0, react_1.useState)(false);
|
134
138
|
const loadMoreData = (0, react_1.useCallback)(() => {
|
135
|
-
var _a, _b, _c, _d;
|
136
139
|
if (isLoadMore)
|
137
140
|
return;
|
138
141
|
setIsLoadMore(true);
|
139
142
|
waterFallData &&
|
140
|
-
(getRecommendVideos === null || getRecommendVideos === void 0 ? void 0 : getRecommendVideos(
|
143
|
+
(getRecommendVideos === null || getRecommendVideos === void 0 ? void 0 : getRecommendVideos({
|
144
|
+
hashTag: waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.hashTag
|
145
|
+
}).then((res) => {
|
141
146
|
var _a;
|
142
147
|
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 : []));
|
143
148
|
setIsLoadMore(false);
|
144
149
|
}));
|
145
150
|
}, [waterFallData, getRecommendVideos, list, isLoadMore]);
|
146
151
|
(0, react_1.useEffect)(() => {
|
147
|
-
var _a, _b
|
152
|
+
var _a, _b;
|
148
153
|
setIsLoadingData(true);
|
149
154
|
waterFallData &&
|
150
|
-
(getRecommendVideos === null || getRecommendVideos === void 0 ? void 0 : getRecommendVideos(
|
155
|
+
(getRecommendVideos === null || getRecommendVideos === void 0 ? void 0 : getRecommendVideos({
|
156
|
+
hashTag: waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.hashTag,
|
157
|
+
defaultSize: hashTagSize,
|
158
|
+
maxSize: hashTagSize
|
159
|
+
}).then((res) => {
|
151
160
|
var _a, _b;
|
152
161
|
setData(res);
|
153
162
|
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 : []);
|
@@ -156,7 +165,7 @@ function WaterfallList(_a) {
|
|
156
165
|
if (isOpenHashTag) {
|
157
166
|
const res = preview_json_1.default;
|
158
167
|
setData(res);
|
159
|
-
setList((
|
168
|
+
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 : []);
|
160
169
|
setIsLoadingData(false);
|
161
170
|
}
|
162
171
|
}, [waterFallData, getRecommendVideos, hashTagSize, isOpenHashTag]);
|
@@ -10,6 +10,7 @@ const css_1 = require("@emotion/css");
|
|
10
10
|
const tool_1 = require("../../../../core/utils/tool");
|
11
11
|
const useEventReport_1 = require("../../../../core/hooks/useEventReport");
|
12
12
|
const WaterfallFlowItem = (props) => {
|
13
|
+
var _a;
|
13
14
|
const { rec, style = {}, sizeChange = () => { }, unitWidth, index, showBorder, list, reportTagsView, textStyles, space } = props;
|
14
15
|
const { swiperRef, setRtcList, setOpenHashtag, sxpParameter } = (0, hooks_1.useSxpDataSource)();
|
15
16
|
const [showVideo, setShowVideo] = (0, react_1.useState)(false);
|
@@ -61,16 +62,19 @@ const WaterfallFlowItem = (props) => {
|
|
61
62
|
}
|
62
63
|
}, [top, showBorder]);
|
63
64
|
const priceText = (0, react_1.useMemo)(() => {
|
64
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
65
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
66
|
+
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);
|
67
|
+
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)) {
|
68
|
+
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
|
69
|
+
? (_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', {
|
70
|
+
minimumFractionDigits: 0
|
71
|
+
})) !== null && _l !== void 0 ? _l : ''
|
72
|
+
: (_m = rec === null || rec === void 0 ? void 0 : rec.product) === null || _m === void 0 ? void 0 : _m.price}`;
|
69
73
|
}
|
70
74
|
else {
|
71
75
|
return null;
|
72
76
|
}
|
73
|
-
}, [rec]);
|
77
|
+
}, [rec, (_a = textStyles === null || textStyles === void 0 ? void 0 : textStyles.price) === null || _a === void 0 ? void 0 : _a.enableFormattedPrice]);
|
74
78
|
(0, react_1.useEffect)(() => {
|
75
79
|
if (imgDom.current === null || src === '') {
|
76
80
|
return;
|
@@ -211,10 +215,14 @@ function WaterfallList(_a) {
|
|
211
215
|
styleListRef.current = getStyleList();
|
212
216
|
}, [unitWidth, rowsNum, list]);
|
213
217
|
(0, react_1.useEffect)(() => {
|
214
|
-
var _a, _b
|
218
|
+
var _a, _b;
|
215
219
|
setIsLoadingData(true);
|
216
220
|
waterFallData &&
|
217
|
-
(getRecommendVideos === null || getRecommendVideos === void 0 ? void 0 : getRecommendVideos(
|
221
|
+
(getRecommendVideos === null || getRecommendVideos === void 0 ? void 0 : getRecommendVideos({
|
222
|
+
hashTag: waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.hashTag,
|
223
|
+
defaultSize: hashTagSize,
|
224
|
+
maxSize: hashTagSize
|
225
|
+
}).then((res) => {
|
218
226
|
var _a, _b;
|
219
227
|
setData(res);
|
220
228
|
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 : []);
|
@@ -223,7 +231,7 @@ function WaterfallList(_a) {
|
|
223
231
|
if (isOpenHashTag) {
|
224
232
|
const res = preview_json_1.default;
|
225
233
|
setData(res);
|
226
|
-
setList((
|
234
|
+
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 : []);
|
227
235
|
setIsLoadingData(false);
|
228
236
|
}
|
229
237
|
}, [waterFallData, getRecommendVideos, hashTagSize, isOpenHashTag]);
|
@@ -248,10 +256,11 @@ function WaterfallList(_a) {
|
|
248
256
|
};
|
249
257
|
}, [onResize]);
|
250
258
|
const loadMoreData = (0, react_1.useCallback)(() => {
|
251
|
-
var _a, _b, _c, _d;
|
252
259
|
setIsLoadingData(true);
|
253
260
|
waterFallData &&
|
254
|
-
(getRecommendVideos === null || getRecommendVideos === void 0 ? void 0 : getRecommendVideos(
|
261
|
+
(getRecommendVideos === null || getRecommendVideos === void 0 ? void 0 : getRecommendVideos({
|
262
|
+
hashTag: waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.hashTag
|
263
|
+
}).then((res) => {
|
255
264
|
var _a, _b;
|
256
265
|
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 : []));
|
257
266
|
setIsLoadingData(false);
|
@@ -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) {
|
@@ -190,8 +193,8 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
190
193
|
return null;
|
191
194
|
}
|
192
195
|
});
|
193
|
-
return !waterFallData ? list.concat([{ loading: true }]) : list;
|
194
|
-
}, [data, activeIndex, waterFallData]);
|
196
|
+
return !waterFallData && !isEditor ? list.concat([{ loading: true }]) : list;
|
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)) {
|
@@ -354,7 +357,6 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
354
357
|
};
|
355
358
|
const handleScrollEvent = (swiper) => {
|
356
359
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
357
|
-
viewTime.current = new Date();
|
358
360
|
const item = data[swiper.previousIndex];
|
359
361
|
if (!item)
|
360
362
|
return;
|
@@ -392,6 +394,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
392
394
|
eventName: 'ProductView'
|
393
395
|
});
|
394
396
|
}
|
397
|
+
viewTime.current = new Date();
|
395
398
|
};
|
396
399
|
const handleReportProductView = (item) => {
|
397
400
|
var _a, _b, _c;
|
@@ -401,8 +404,12 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
401
404
|
};
|
402
405
|
(0, react_1.useEffect)(() => {
|
403
406
|
const item = data[activeIndex];
|
404
|
-
if (openHashtag)
|
407
|
+
if (openHashtag) {
|
405
408
|
handleReportProductView(item);
|
409
|
+
}
|
410
|
+
else {
|
411
|
+
viewTime.current = new Date();
|
412
|
+
}
|
406
413
|
}, [openHashtag, data, activeIndex]);
|
407
414
|
const handleViewImageStartEvent = (activeIndex) => {
|
408
415
|
var _a, _b, _c, _d, _e, _f;
|
@@ -436,6 +443,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
436
443
|
position: (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconFixed) ? 'fixed' : 'absolute',
|
437
444
|
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
445
|
zIndex: 999,
|
446
|
+
transform: 'translate3d(0px,0px,0px)',
|
439
447
|
[(_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
448
|
[(_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
449
|
}, 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 +462,10 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
454
462
|
alignItems: 'center'
|
455
463
|
} },
|
456
464
|
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
465
|
renderLikeButton(rec, index, !(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIconFixed)),
|
460
|
-
renderToggleButton(!(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconFixed))
|
466
|
+
renderToggleButton(!(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconFixed)),
|
467
|
+
renderBottom(rec, index),
|
468
|
+
renderContent(rec, index)))))));
|
461
469
|
});
|
462
470
|
}, [
|
463
471
|
containerWidth,
|
@@ -492,9 +500,9 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
492
500
|
if (openHashtag)
|
493
501
|
return;
|
494
502
|
handleScrollEvent(swiper);
|
495
|
-
if (waterFallData)
|
503
|
+
if (waterFallData || isEditor)
|
496
504
|
return;
|
497
|
-
if ((swiper === null || swiper === void 0 ? void 0 : swiper.activeIndex) +
|
505
|
+
if ((swiper === null || swiper === void 0 ? void 0 : swiper.activeIndex) + 1 >= (data === null || data === void 0 ? void 0 : data.length)) {
|
498
506
|
if (!isLoadMore) {
|
499
507
|
setIsLoadMore(true);
|
500
508
|
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 {
|