pb-sxp-ui 1.2.10 → 1.3.0
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 +595 -308
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +62 -2
- package/dist/index.js +595 -308
- 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 +595 -308
- 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/FormatImage.js +1 -1
- package/es/core/components/SxpPageRender/Modal/index.js +33 -20
- package/es/core/components/SxpPageRender/Popup/index.js +2 -2
- package/es/core/components/SxpPageRender/ToggleButton/index.js +4 -1
- package/es/core/components/SxpPageRender/WaterFall/List.js +5 -14
- package/es/core/components/SxpPageRender/WaterFall/WaterfallList.js +5 -14
- package/es/core/components/SxpPageRender/index.d.ts +6 -1
- package/es/core/components/SxpPageRender/index.js +46 -23
- package/es/core/components/SxpPageRender/typing.d.ts +2 -0
- package/es/core/context/SxpDataSourceProvider.d.ts +3 -2
- package/es/core/context/SxpDataSourceProvider.js +27 -30
- package/es/core/hooks/useEventReport.js +9 -8
- package/es/core/utils/tool.d.ts +5 -1
- package/es/core/utils/tool.js +69 -1
- package/es/materials/sxp/HashTag/settingRender.d.ts +7 -6
- package/es/materials/sxp/HashTag/settingRender.js +0 -9
- package/es/materials/sxp/cta/AniLink/settingRender.d.ts +0 -5
- package/es/materials/sxp/cta/AniLink/settingRender.js +0 -4
- package/es/materials/sxp/popup/AppointForm/settingRender.d.ts +5 -8
- package/es/materials/sxp/popup/AppointForm/settingRender.js +15 -12
- package/es/materials/sxp/popup/CommodityDetail/index.d.ts +10 -1
- package/es/materials/sxp/popup/CommodityDetail/index.js +46 -28
- package/es/materials/sxp/popup/CommodityDetail/material.js +4 -0
- package/es/materials/sxp/popup/CommodityDetail/settingRender.d.ts +19 -6
- package/es/materials/sxp/popup/CommodityDetail/settingRender.js +45 -8
- package/es/materials/sxp/popup/CommodityDetailDiroNew/index.d.ts +10 -1
- package/es/materials/sxp/popup/CommodityDetailDiroNew/index.js +72 -46
- package/es/materials/sxp/popup/CommodityDetailDiroNew/material.js +4 -0
- package/es/materials/sxp/popup/CommodityDetailDiroNew/settingRender.d.ts +19 -6
- package/es/materials/sxp/popup/CommodityDetailDiroNew/settingRender.js +45 -8
- package/es/materials/sxp/popup/CommodityList/settingRender.js +15 -4
- package/es/materials/sxp/popup/Iframe/index.d.ts +16 -0
- package/es/materials/sxp/popup/Iframe/index.js +18 -0
- package/es/materials/sxp/popup/Iframe/material.d.ts +2 -0
- package/es/materials/sxp/popup/Iframe/material.js +21 -0
- package/es/materials/sxp/popup/Iframe/settingRender.d.ts +9 -0
- package/es/materials/sxp/popup/Iframe/settingRender.js +12 -0
- package/es/materials/sxp/popup/Prompt/settingRender.js +16 -11
- package/es/materials/sxp/popup/index.d.ts +1 -0
- package/es/materials/sxp/popup/index.js +1 -0
- package/es/materials/sxp/template/Link/index.js +5 -11
- package/es/materials/sxp/template/Link/interactionRender.d.ts +8 -0
- package/es/materials/sxp/template/Link/interactionRender.js +11 -0
- package/es/materials/sxp/template/Link/material.js +3 -1
- package/es/materials/sxp/template/Link/settingRender.js +0 -5
- package/es/materials/sxp/template/components/EventProvider.d.ts +3 -2
- package/es/materials/sxp/template/components/EventProvider.js +3 -3
- package/lib/core/components/SxpPageRender/FormatImage.js +1 -1
- package/lib/core/components/SxpPageRender/Modal/index.js +33 -20
- package/lib/core/components/SxpPageRender/Popup/index.js +2 -2
- package/lib/core/components/SxpPageRender/ToggleButton/index.js +3 -0
- package/lib/core/components/SxpPageRender/WaterFall/List.js +5 -14
- package/lib/core/components/SxpPageRender/WaterFall/WaterfallList.js +5 -14
- package/lib/core/components/SxpPageRender/index.d.ts +6 -1
- package/lib/core/components/SxpPageRender/index.js +46 -23
- package/lib/core/components/SxpPageRender/typing.d.ts +2 -0
- package/lib/core/context/SxpDataSourceProvider.d.ts +3 -2
- package/lib/core/context/SxpDataSourceProvider.js +27 -30
- package/lib/core/hooks/useEventReport.js +9 -8
- package/lib/core/utils/tool.d.ts +5 -1
- package/lib/core/utils/tool.js +73 -1
- package/lib/materials/sxp/HashTag/settingRender.d.ts +7 -6
- package/lib/materials/sxp/HashTag/settingRender.js +0 -9
- package/lib/materials/sxp/cta/AniLink/settingRender.d.ts +0 -5
- package/lib/materials/sxp/cta/AniLink/settingRender.js +0 -4
- package/lib/materials/sxp/popup/AppointForm/settingRender.d.ts +5 -8
- package/lib/materials/sxp/popup/AppointForm/settingRender.js +15 -12
- package/lib/materials/sxp/popup/CommodityDetail/index.d.ts +10 -1
- package/lib/materials/sxp/popup/CommodityDetail/index.js +46 -28
- package/lib/materials/sxp/popup/CommodityDetail/material.js +4 -0
- package/lib/materials/sxp/popup/CommodityDetail/settingRender.d.ts +19 -6
- package/lib/materials/sxp/popup/CommodityDetail/settingRender.js +45 -8
- package/lib/materials/sxp/popup/CommodityDetailDiroNew/index.d.ts +10 -1
- package/lib/materials/sxp/popup/CommodityDetailDiroNew/index.js +72 -46
- package/lib/materials/sxp/popup/CommodityDetailDiroNew/material.js +4 -0
- package/lib/materials/sxp/popup/CommodityDetailDiroNew/settingRender.d.ts +19 -6
- package/lib/materials/sxp/popup/CommodityDetailDiroNew/settingRender.js +45 -8
- package/lib/materials/sxp/popup/CommodityList/settingRender.js +15 -4
- package/lib/materials/sxp/popup/Iframe/index.d.ts +16 -0
- package/lib/materials/sxp/popup/Iframe/index.js +20 -0
- package/lib/materials/sxp/popup/Iframe/material.d.ts +2 -0
- package/lib/materials/sxp/popup/Iframe/material.js +25 -0
- package/lib/materials/sxp/popup/Iframe/settingRender.d.ts +9 -0
- package/lib/materials/sxp/popup/Iframe/settingRender.js +14 -0
- package/lib/materials/sxp/popup/Prompt/settingRender.js +16 -11
- package/lib/materials/sxp/popup/index.d.ts +1 -0
- package/lib/materials/sxp/popup/index.js +1 -0
- package/lib/materials/sxp/template/Link/index.js +5 -11
- package/lib/materials/sxp/template/Link/interactionRender.d.ts +8 -0
- package/lib/materials/sxp/template/Link/interactionRender.js +13 -0
- package/lib/materials/sxp/template/Link/material.js +3 -1
- package/lib/materials/sxp/template/Link/settingRender.js +0 -5
- package/lib/materials/sxp/template/components/EventProvider.d.ts +3 -2
- package/lib/materials/sxp/template/components/EventProvider.js +3 -3
- package/package.json +1 -1
@@ -20,7 +20,7 @@ const FormatImage = (0, react_1.forwardRef)((props, ref) => {
|
|
20
20
|
}, [src]);
|
21
21
|
(0, react_1.useEffect)(() => {
|
22
22
|
const onShow = () => {
|
23
|
-
if (src && !visible) {
|
23
|
+
if (src && !visible && imgRef.current) {
|
24
24
|
imgRef.current.src = '';
|
25
25
|
imgRef.current.src = src;
|
26
26
|
}
|
@@ -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;
|
10
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
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);
|
@@ -34,12 +34,16 @@ const Modal = ({ visible, onClose, children, modalStyle, padding, popup, schema,
|
|
34
34
|
const isOpen = (0, react_1.useMemo)(() => {
|
35
35
|
return ((popup === null || popup === void 0 ? void 0 : popup.id) && (popup === null || popup === void 0 ? void 0 : popup.id) !== '') || visible;
|
36
36
|
}, [visible, popup]);
|
37
|
-
const
|
38
|
-
var _a, _b, _c
|
37
|
+
const getPopupById = (0, react_1.useMemo)(() => {
|
38
|
+
var _a, _b, _c;
|
39
39
|
const schemaData = schema !== null && schema !== void 0 ? schema : _schema;
|
40
40
|
const value = (_c = (_b = (_a = schemaData === null || schemaData === void 0 ? void 0 : schemaData.sxpPageConf) === null || _a === void 0 ? void 0 : _a.globalConfig) === null || _b === void 0 ? void 0 : _b.popupList) === null || _c === void 0 ? void 0 : _c.find((value) => (value === null || value === void 0 ? void 0 : value.id) === (popup === null || popup === void 0 ? void 0 : popup.id));
|
41
|
-
return
|
41
|
+
return value;
|
42
42
|
}, [popup, schema, _schema]);
|
43
|
+
const isScrollFullScreen = (0, react_1.useMemo)(() => {
|
44
|
+
var _a, _b;
|
45
|
+
return ((_b = (_a = getPopupById === null || getPopupById === void 0 ? void 0 : getPopupById.item) === null || _a === void 0 ? void 0 : _a.event) === null || _b === void 0 ? void 0 : _b.isScrollFullScreen) || false;
|
46
|
+
}, [getPopupById]);
|
43
47
|
(0, react_1.useEffect)(() => {
|
44
48
|
if (isOpen) {
|
45
49
|
setIsShow(true);
|
@@ -103,21 +107,30 @@ const Modal = ({ visible, onClose, children, modalStyle, padding, popup, schema,
|
|
103
107
|
touchMoveRef.current = false;
|
104
108
|
};
|
105
109
|
return ReactDOM.createPortal(react_1.default.createElement(react_1.default.Fragment, null, isShow && (react_1.default.createElement("div", { className: 'modal-bg', style: Object.assign({ display: 'flex', backgroundColor: isOpen ? 'rgba(0, 0, 0, 0.7)' : 'rgba(0, 0, 0, 0)' }, modalStyle), onClick: handleClose },
|
106
|
-
react_1.default.createElement("div",
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
110
|
+
react_1.default.createElement("div", { style: {
|
111
|
+
position: 'relative',
|
112
|
+
left: `${(_d = (_c = (_b = (_a = getPopupById === null || getPopupById === void 0 ? void 0 : getPopupById.item) === null || _a === void 0 ? void 0 : _a.props) === null || _b === void 0 ? void 0 : _b.popupBg) === null || _c === void 0 ? void 0 : _c.horizontalMargin) !== null && _d !== void 0 ? _d : 0}px`,
|
113
|
+
right: `${(_h = (_g = (_f = (_e = getPopupById === null || getPopupById === void 0 ? void 0 : getPopupById.item) === null || _e === void 0 ? void 0 : _e.props) === null || _f === void 0 ? void 0 : _f.popupBg) === null || _g === void 0 ? void 0 : _g.horizontalMargin) !== null && _h !== void 0 ? _h : 0}px`,
|
114
|
+
bottom: `${(_m = (_l = (_k = (_j = getPopupById === null || getPopupById === void 0 ? void 0 : getPopupById.item) === null || _j === void 0 ? void 0 : _j.props) === null || _k === void 0 ? void 0 : _k.popupBg) === null || _l === void 0 ? void 0 : _l.bottomMargin) !== null && _m !== void 0 ? _m : 0}px`,
|
115
|
+
overflow: 'hidden',
|
116
|
+
width: `calc(100% - ${((_r = (_q = (_p = (_o = getPopupById === null || getPopupById === void 0 ? void 0 : getPopupById.item) === null || _o === void 0 ? void 0 : _o.props) === null || _p === void 0 ? void 0 : _p.popupBg) === null || _q === void 0 ? void 0 : _q.horizontalMargin) !== null && _r !== void 0 ? _r : 0) * 2}px)`,
|
117
|
+
height: '100%'
|
118
|
+
} },
|
119
|
+
react_1.default.createElement("div", Object.assign({ className: `modal-container ${isOpen ? 'modal-popIn' : 'modal-popOut'}`, style: Object.assign({ padding, animationDuration: ((_s = popup === null || popup === void 0 ? void 0 : popup.duration) !== null && _s !== void 0 ? _s : 0) / 1000 + 's' }, (isScrollFullScreen && {
|
120
|
+
transform: `translateY(${modalTrans}px)`
|
121
|
+
})), onClick: (e) => {
|
122
|
+
e.stopPropagation();
|
123
|
+
e.preventDefault();
|
124
|
+
} }, (isScrollFullScreen && {
|
125
|
+
onTouchMove: handleTouchMove,
|
126
|
+
onTouchStart: handleTouchStart,
|
127
|
+
onTouchEnd: handleTouchEnd
|
128
|
+
})),
|
129
|
+
react_1.default.createElement("div", { onClick: onClose, className: 'modal-icon-wrapper' },
|
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
|
+
react_1.default.createElement("div", { ref: ref, style: {
|
132
|
+
height: isScrollFullScreen ? fullHeight : MODAL_DEF_CON_H,
|
133
|
+
overflow: (isScrollFullScreen && modalTrans <= 0) || !isScrollFullScreen ? 'auto' : 'hidden'
|
134
|
+
} }, children)))))), modalEleRef.current);
|
122
135
|
};
|
123
136
|
exports.default = (0, react_1.memo)(Modal);
|
@@ -61,14 +61,14 @@ const Popup = () => {
|
|
61
61
|
const renderPopupDetail = (0, react_1.useMemo)(() => {
|
62
62
|
var _a, _b, _c;
|
63
63
|
return (_c = (_b = (_a = schema === null || schema === void 0 ? void 0 : schema.sxpPageConf) === null || _a === void 0 ? void 0 : _a.globalConfig) === null || _b === void 0 ? void 0 : _b.popupList) === null || _c === void 0 ? void 0 : _c.map((value, index) => {
|
64
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p
|
64
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
65
65
|
if ((value === null || value === void 0 ? void 0 : value.id) === (popup === null || popup === void 0 ? void 0 : popup.id)) {
|
66
66
|
const t = resolver[(_a = value === null || value === void 0 ? void 0 : value.item) === null || _a === void 0 ? void 0 : _a.type];
|
67
67
|
const Component = (0, withBindDataSource_1.default)(t);
|
68
68
|
const isExternalLink = ((_d = (_c = (_b = value === null || value === void 0 ? void 0 : value.item) === null || _b === void 0 ? void 0 : _b.event) === null || _c === void 0 ? void 0 : _c.onClick) === null || _d === void 0 ? void 0 : _d.linkType) === 'externalLink';
|
69
69
|
const isPopup = ((_g = (_f = (_e = value === null || value === void 0 ? void 0 : value.item) === null || _e === void 0 ? void 0 : _e.event) === null || _f === void 0 ? void 0 : _f.onClick) === null || _g === void 0 ? void 0 : _g.linkType) === 'popup';
|
70
70
|
const defaulSetting = (_h = t === null || t === void 0 ? void 0 : t.extend) === null || _h === void 0 ? void 0 : _h.defaulSetting;
|
71
|
-
return (react_1.default.createElement(Component, Object.assign({ key: index, style: Object.assign(Object.assign(Object.assign({}, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.style), (_j = value === null || value === void 0 ? void 0 : value.item) === null || _j === void 0 ? void 0 : _j.style), {
|
71
|
+
return (react_1.default.createElement(Component, Object.assign({ key: index, style: Object.assign(Object.assign(Object.assign({}, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.style), (_j = value === null || value === void 0 ? void 0 : value.item) === null || _j === void 0 ? void 0 : _j.style), { height: '100%' }), textStyle: Object.assign(Object.assign({}, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.textStyle), (_k = value === null || value === void 0 ? void 0 : value.item) === null || _k === void 0 ? void 0 : _k.textStyle), bindDatas: (_m = (_l = value === null || value === void 0 ? void 0 : value.item) === null || _l === void 0 ? void 0 : _l.bindDatas) !== null && _m !== void 0 ? _m : [] }, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.props, (_o = value === null || value === void 0 ? void 0 : value.item) === null || _o === void 0 ? void 0 : _o.props, { event: ((_p = value === null || value === void 0 ? void 0 : value.item) === null || _p === void 0 ? void 0 : _p.event) || {}, schema: schema, id: value === null || value === void 0 ? void 0 : value.id, isExternalLink: isExternalLink, isPopup: isPopup, onClose: handleClose })));
|
72
72
|
}
|
73
73
|
else {
|
74
74
|
return react_1.default.createElement(react_1.default.Fragment, null);
|
@@ -10,6 +10,9 @@ const ToggleButton = ({ defaultValue, activeIcon, unactiveIcon, onChange, style
|
|
10
10
|
setIsTure(result);
|
11
11
|
onChange === null || onChange === void 0 ? void 0 : onChange(result);
|
12
12
|
};
|
13
|
+
(0, react_1.useEffect)(() => {
|
14
|
+
setIsTure(defaultValue);
|
15
|
+
}, [defaultValue]);
|
13
16
|
return (react_1.default.createElement("button", { style: style, "aria-label": 'toggle button', className: 'pb-toggle-button', onClick: handleClick },
|
14
17
|
react_1.default.createElement("img", { className: 'pb-toggle-button-icon', alt: 'toggle image', src: isTrue ? activeIcon : unactiveIcon })));
|
15
18
|
};
|
@@ -130,31 +130,22 @@ function WaterfallList(_a) {
|
|
130
130
|
const containerRef = (0, react_1.useRef)(null);
|
131
131
|
const [isLoadMore, setIsLoadMore] = (0, react_1.useState)(false);
|
132
132
|
const loadMoreData = (0, react_1.useCallback)(() => {
|
133
|
+
var _a, _b, _c, _d;
|
133
134
|
if (isLoadMore)
|
134
135
|
return;
|
135
136
|
setIsLoadMore(true);
|
136
137
|
waterFallData &&
|
137
|
-
(getRecommendVideos === null || getRecommendVideos === void 0 ? void 0 : getRecommendVideos({
|
138
|
-
hashTag: waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.hashTag,
|
139
|
-
'itemFilter.itemId': waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.itemId,
|
140
|
-
'itemFilter.itemType': waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.itemType
|
141
|
-
}).then((res) => {
|
138
|
+
(getRecommendVideos === null || getRecommendVideos === void 0 ? void 0 : getRecommendVideos(Object.assign(Object.assign({ hashTag: waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.hashTag }, (((_b = (_a = waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.rec) === null || _a === void 0 ? void 0 : _a.product) === null || _b === void 0 ? void 0 : _b.itemId) && { productFilter: (_d = (_c = waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.rec) === null || _c === void 0 ? void 0 : _c.product) === null || _d === void 0 ? void 0 : _d.itemId })), ((waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.itemId) && { contentFilter: waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.itemId }))).then((res) => {
|
142
139
|
var _a;
|
143
140
|
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 : []));
|
144
141
|
setIsLoadMore(false);
|
145
142
|
}));
|
146
143
|
}, [waterFallData, getRecommendVideos, list, isLoadMore]);
|
147
144
|
(0, react_1.useEffect)(() => {
|
148
|
-
var _a, _b;
|
145
|
+
var _a, _b, _c, _d, _e, _f;
|
149
146
|
setIsLoadingData(true);
|
150
147
|
waterFallData &&
|
151
|
-
(getRecommendVideos === null || getRecommendVideos === void 0 ? void 0 : getRecommendVideos({
|
152
|
-
hashTag: waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.hashTag,
|
153
|
-
'itemFilter.itemId': waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.itemId,
|
154
|
-
'itemFilter.itemType': waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.itemType,
|
155
|
-
defaultSize: hashTagSize,
|
156
|
-
maxSize: hashTagSize
|
157
|
-
}).then((res) => {
|
148
|
+
(getRecommendVideos === null || getRecommendVideos === void 0 ? void 0 : getRecommendVideos(Object.assign(Object.assign(Object.assign({ hashTag: waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.hashTag }, (((_b = (_a = waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.rec) === null || _a === void 0 ? void 0 : _a.product) === null || _b === void 0 ? void 0 : _b.itemId) && { productFilter: (_d = (_c = waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.rec) === null || _c === void 0 ? void 0 : _c.product) === null || _d === void 0 ? void 0 : _d.itemId })), ((waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.itemId) && { contentFilter: waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.itemId })), { defaultSize: hashTagSize, maxSize: hashTagSize })).then((res) => {
|
158
149
|
var _a, _b;
|
159
150
|
setData(res);
|
160
151
|
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 : []);
|
@@ -163,7 +154,7 @@ function WaterfallList(_a) {
|
|
163
154
|
if (isOpenHashTag) {
|
164
155
|
const res = preview_json_1.default;
|
165
156
|
setData(res);
|
166
|
-
setList((
|
157
|
+
setList((_f = (_e = res === null || res === void 0 ? void 0 : res.recList) === null || _e === void 0 ? void 0 : _e.filter((item) => (item === null || item === void 0 ? void 0 : item.video) !== null || (item === null || item === void 0 ? void 0 : item.product) !== null)) !== null && _f !== void 0 ? _f : []);
|
167
158
|
setIsLoadingData(false);
|
168
159
|
}
|
169
160
|
}, [waterFallData, getRecommendVideos, hashTagSize, isOpenHashTag]);
|
@@ -209,16 +209,10 @@ function WaterfallList(_a) {
|
|
209
209
|
styleListRef.current = getStyleList();
|
210
210
|
}, [unitWidth, rowsNum, list]);
|
211
211
|
(0, react_1.useEffect)(() => {
|
212
|
-
var _a, _b;
|
212
|
+
var _a, _b, _c, _d, _e, _f;
|
213
213
|
setIsLoadingData(true);
|
214
214
|
waterFallData &&
|
215
|
-
(getRecommendVideos === null || getRecommendVideos === void 0 ? void 0 : getRecommendVideos({
|
216
|
-
hashTag: waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.hashTag,
|
217
|
-
'itemFilter.itemId': waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.itemId,
|
218
|
-
'itemFilter.itemType': waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.itemType,
|
219
|
-
defaultSize: hashTagSize,
|
220
|
-
maxSize: hashTagSize
|
221
|
-
}).then((res) => {
|
215
|
+
(getRecommendVideos === null || getRecommendVideos === void 0 ? void 0 : getRecommendVideos(Object.assign(Object.assign({ hashTag: waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.hashTag, defaultSize: hashTagSize, maxSize: hashTagSize }, (((_b = (_a = waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.rec) === null || _a === void 0 ? void 0 : _a.product) === null || _b === void 0 ? void 0 : _b.itemId) && { productFilter: (_d = (_c = waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.rec) === null || _c === void 0 ? void 0 : _c.product) === null || _d === void 0 ? void 0 : _d.itemId })), ((waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.itemId) && { contentFilter: waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.itemId }))).then((res) => {
|
222
216
|
var _a, _b;
|
223
217
|
setData(res);
|
224
218
|
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,7 +221,7 @@ function WaterfallList(_a) {
|
|
227
221
|
if (isOpenHashTag) {
|
228
222
|
const res = preview_json_1.default;
|
229
223
|
setData(res);
|
230
|
-
setList((
|
224
|
+
setList((_f = (_e = res === null || res === void 0 ? void 0 : res.recList) === null || _e === void 0 ? void 0 : _e.filter((item) => (item === null || item === void 0 ? void 0 : item.video) !== null || (item === null || item === void 0 ? void 0 : item.product) !== null)) !== null && _f !== void 0 ? _f : []);
|
231
225
|
setIsLoadingData(false);
|
232
226
|
}
|
233
227
|
}, [waterFallData, getRecommendVideos, hashTagSize, isOpenHashTag]);
|
@@ -252,13 +246,10 @@ function WaterfallList(_a) {
|
|
252
246
|
};
|
253
247
|
}, [onResize]);
|
254
248
|
const loadMoreData = (0, react_1.useCallback)(() => {
|
249
|
+
var _a, _b, _c, _d;
|
255
250
|
setIsLoadingData(true);
|
256
251
|
waterFallData &&
|
257
|
-
(getRecommendVideos === null || getRecommendVideos === void 0 ? void 0 : getRecommendVideos({
|
258
|
-
hashTag: waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.hashTag,
|
259
|
-
'itemFilter.itemId': waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.itemId,
|
260
|
-
'itemFilter.itemType': waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.itemType
|
261
|
-
}).then((res) => {
|
252
|
+
(getRecommendVideos === null || getRecommendVideos === void 0 ? void 0 : getRecommendVideos(Object.assign(Object.assign({ hashTag: waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.hashTag }, (((_b = (_a = waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.rec) === null || _a === void 0 ? void 0 : _a.product) === null || _b === void 0 ? void 0 : _b.itemId) && { productFilter: (_d = (_c = waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.rec) === null || _c === void 0 ? void 0 : _c.product) === null || _d === void 0 ? void 0 : _d.itemId })), ((waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.itemId) && { contentFilter: waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.itemId }))).then((res) => {
|
262
253
|
var _a, _b;
|
263
254
|
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 : []));
|
264
255
|
setIsLoadingData(false);
|
@@ -43,6 +43,11 @@ export interface ISxpPageRenderProps {
|
|
43
43
|
popupCloseIcon?: string;
|
44
44
|
openSlideSkip?: boolean;
|
45
45
|
slideSkipStartTime?: number;
|
46
|
+
muteIconFixed?: boolean;
|
47
|
+
likeIconFixed?: boolean;
|
48
|
+
enablePreview?: boolean;
|
49
|
+
enableSwiperTip?: boolean;
|
50
|
+
logoBar?: any;
|
46
51
|
};
|
47
52
|
descStyle?: CSSProperties;
|
48
53
|
tipText?: {
|
@@ -74,7 +79,7 @@ export interface ISxpPageRenderProps {
|
|
74
79
|
data?: RecItemType[];
|
75
80
|
tagList?: string[];
|
76
81
|
resolver: any;
|
77
|
-
ctaType?: string
|
82
|
+
ctaType?: Array<string>;
|
78
83
|
_schema?: any;
|
79
84
|
hashTagStyle?: CSSProperties;
|
80
85
|
licenseUrl?: string;
|
@@ -25,7 +25,9 @@ const withBindDataSource_1 = tslib_1.__importDefault(require("../../../core/hoc/
|
|
25
25
|
const Tagbar_1 = tslib_1.__importDefault(require("./Tagbar"));
|
26
26
|
const localStore_1 = require("../../../core/utils/localStore");
|
27
27
|
const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.innerHeight, containerWidth = window.innerWidth, tempMap, resolver, data = [], ctaType, tipText, nudge, _schema, hashTagStyle, tagList = [], licenseUrl }) => {
|
28
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j
|
28
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
29
|
+
const mutedIcon = (0, useIconLink_1.useIconLink)('/pb_static/5beaaa5ce7f3477b99db3838619cc471.png');
|
30
|
+
const unmutedIcon = (0, useIconLink_1.useIconLink)('/pb_static/fea8668a8a894e4aa3a86bcc775e895e.png');
|
29
31
|
const { schema } = (0, hooks_1.useEditor)();
|
30
32
|
const [activeIndex, setActiveIndex] = (0, react_1.useState)(0);
|
31
33
|
const viewImageStartTime = (0, react_1.useRef)(0);
|
@@ -39,8 +41,8 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
39
41
|
const { backMainFeed } = (0, useEventReport_1.useEventReport)();
|
40
42
|
const { productView } = (0, useEventReport_1.useEventReport)();
|
41
43
|
const isShowFingerTip = (0, react_1.useMemo)(() => {
|
42
|
-
return data.length > 0 && !loading && (0, localStore_1.getFeUserId)();
|
43
|
-
}, [data, loading]);
|
44
|
+
return data.length > 0 && !loading && ((0, localStore_1.getFeUserId)() || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enableSwiperTip));
|
45
|
+
}, [data, loading, globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enableSwiperTip]);
|
44
46
|
(0, react_1.useEffect)(() => {
|
45
47
|
(0, sessionStore_1.refreshFeSessionId)();
|
46
48
|
}, []);
|
@@ -68,14 +70,15 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
68
70
|
var _a;
|
69
71
|
const index = (data === null || data === void 0 ? void 0 : data.findIndex((item) => {
|
70
72
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
71
|
-
|
73
|
+
const ctaType0 = ctaType === null || ctaType === void 0 ? void 0 : ctaType[0];
|
74
|
+
if (ctaType0 === '多商品CTA') {
|
72
75
|
return ((_a = item === null || item === void 0 ? void 0 : item.video) === null || _a === void 0 ? void 0 : _a.bindProducts) && ((_c = (_b = item === null || item === void 0 ? void 0 : item.video) === null || _b === void 0 ? void 0 : _b.bindProducts) === null || _c === void 0 ? void 0 : _c.length) > 0;
|
73
76
|
}
|
74
|
-
else if (
|
77
|
+
else if (ctaType0 === '商品CTA') {
|
75
78
|
return (_d = item === null || item === void 0 ? void 0 : item.video) === null || _d === void 0 ? void 0 : _d.bindProduct;
|
76
79
|
}
|
77
80
|
else {
|
78
|
-
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) ===
|
81
|
+
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));
|
79
82
|
}
|
80
83
|
})) || 0;
|
81
84
|
(_a = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _a === void 0 ? void 0 : _a.swiper.slideTo(index);
|
@@ -177,8 +180,10 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
177
180
|
return containerHeight - minusHeight - tagHeight;
|
178
181
|
}, [globalConfig, containerHeight, tagHeight]);
|
179
182
|
const renderLogo = (0, react_1.useMemo)(() => {
|
183
|
+
var _a, _b;
|
180
184
|
if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.logoUrl) && (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowLogo)) {
|
181
|
-
|
185
|
+
const link = (_b = (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.logoBar) === null || _a === void 0 ? void 0 : _a.onClick) === null || _b === void 0 ? void 0 : _b.value;
|
186
|
+
return (react_1.default.createElement("div", Object.assign({ className: 'clc-sxp-logo-banner', style: { backgroundColor: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.color } }, (link && { onClick: () => new Function(link)() })),
|
182
187
|
react_1.default.createElement("img", { src: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.logoUrl, alt: 'logo' })));
|
183
188
|
}
|
184
189
|
return null;
|
@@ -258,9 +263,9 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
258
263
|
isShowMore,
|
259
264
|
lineGradStyle
|
260
265
|
]);
|
261
|
-
const renderLikeButton = (0, react_1.useCallback)((rec, index) => {
|
266
|
+
const renderLikeButton = (0, react_1.useCallback)((rec, index, visible) => {
|
262
267
|
var _a, _b, _c, _d;
|
263
|
-
if (!(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowLike))
|
268
|
+
if (!(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowLike) || !visible)
|
264
269
|
return;
|
265
270
|
let top = (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIconY) !== null && _a !== void 0 ? _a : 400;
|
266
271
|
if (waterFallData && top < 40) {
|
@@ -268,6 +273,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
268
273
|
}
|
269
274
|
if (rec === null || rec === void 0 ? void 0 : rec.video) {
|
270
275
|
return (react_1.default.createElement(LikeButton_1.default, { key: rec.position, activeIcon: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIcon, unActicveIcon: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.unlikeIcon, active: rec.isCollected, recData: rec, className: 'clc-sxp-like-button', style: {
|
276
|
+
position: (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIconFixed) ? 'fixed' : 'absolute',
|
271
277
|
[(_b = globalConfig.likeIconXPosit) !== null && _b !== void 0 ? _b : 'right']: (_c = globalConfig.likeIconX) !== null && _c !== void 0 ? _c : 0,
|
272
278
|
[(_d = globalConfig.likeIconYPosit) !== null && _d !== void 0 ? _d : 'bottom']: top
|
273
279
|
}, position: index }));
|
@@ -414,6 +420,18 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
414
420
|
});
|
415
421
|
return !waterFallData ? list.concat([{ loading: true }]) : list;
|
416
422
|
}, [data, activeIndex, waterFallData]);
|
423
|
+
const renderToggleButton = (0, react_1.useCallback)((visible) => {
|
424
|
+
var _a, _b, _c, _d, _e, _f;
|
425
|
+
if (!visible)
|
426
|
+
return;
|
427
|
+
return (((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowMute) === undefined || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowMute) === true) && (react_1.default.createElement(ToggleButton_1.default, { style: {
|
428
|
+
position: (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconFixed) ? 'fixed' : 'absolute',
|
429
|
+
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',
|
430
|
+
zIndex: 999,
|
431
|
+
[(_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,
|
432
|
+
[(_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
|
433
|
+
}, 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 })));
|
434
|
+
}, [globalConfig, visList, activeIndex, isMuted]);
|
417
435
|
const renderView = (0, react_1.useMemo)(() => {
|
418
436
|
if (loading) {
|
419
437
|
return (react_1.default.createElement("div", { style: { height, width: containerWidth, display: 'flex', justifyContent: 'center', alignItems: 'center' } },
|
@@ -430,20 +448,30 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
430
448
|
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,
|
431
449
|
renderContent(rec, index),
|
432
450
|
renderBottom(rec, index),
|
433
|
-
renderLikeButton(rec, index))
|
451
|
+
renderLikeButton(rec, index, !(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIconFixed)),
|
452
|
+
renderToggleButton(!(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconFixed))))))));
|
434
453
|
});
|
435
|
-
}, [
|
436
|
-
|
437
|
-
|
454
|
+
}, [
|
455
|
+
containerWidth,
|
456
|
+
data,
|
457
|
+
height,
|
458
|
+
loading,
|
459
|
+
renderBottom,
|
460
|
+
renderContent,
|
461
|
+
visList,
|
462
|
+
loadingImage,
|
463
|
+
isReload,
|
464
|
+
renderToggleButton
|
465
|
+
]);
|
438
466
|
return (react_1.default.createElement("div", { id: 'sxp-render', className: 'clc-sxp-container' },
|
439
|
-
waterFallData && (react_1.default.createElement(Navbar_1.default, { icon: left_png_1.default, styles: { background: 'rgba(0,0,0,.3)', color: '#fff' }, onClose: () => {
|
467
|
+
waterFallData && (react_1.default.createElement(Navbar_1.default, { icon: left_png_1.default, styles: { background: 'rgba(0,0,0,.3)', color: '#fff' }, textStyle: Object.assign(Object.assign({}, (_e = (_d = (_c = (_b = (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.hashTag) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.item) === null || _c === void 0 ? void 0 : _c.props) === null || _d === void 0 ? void 0 : _d.textStyles) === null || _e === void 0 ? void 0 : _e.hashTagTitle), { color: '#fff' }), onClose: () => {
|
440
468
|
setOpenHashtag === null || setOpenHashtag === void 0 ? void 0 : setOpenHashtag(true);
|
441
469
|
} })),
|
442
470
|
renderLogo,
|
443
471
|
react_1.default.createElement(Tagbar_1.default, { tagList: tagList, setActiveIndex: setActiveIndex, style: {
|
444
472
|
top: minusHeight
|
445
473
|
} }),
|
446
|
-
isShowFingerTip ? (react_1.default.createElement(FingerSwipeTip_1.default, { imageUrl: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.swipeTipIcon, style: { top: `${50 - ((
|
474
|
+
isShowFingerTip ? (react_1.default.createElement(FingerSwipeTip_1.default, { imageUrl: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.swipeTipIcon, style: { top: `${50 - ((_f = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.swipeTipOffset) !== null && _f !== void 0 ? _f : 0)}%` }, duration: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.swiperTipAniDur })) : null,
|
447
475
|
react_1.default.createElement(react_2.Swiper, { style: {
|
448
476
|
marginTop: tagHeight
|
449
477
|
}, ref: swiperRef, onSlideChange: () => {
|
@@ -467,14 +495,9 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
467
495
|
}
|
468
496
|
}
|
469
497
|
}, direction: 'vertical', height: height },
|
470
|
-
(
|
471
|
-
|
472
|
-
visibility: ((_c = (_b = data === null || data === void 0 ? void 0 : data[activeIndex]) === null || _b === void 0 ? void 0 : _b.video) === null || _c === void 0 ? void 0 : _c.url) ? 'visible' : 'hidden',
|
473
|
-
zIndex: 999,
|
474
|
-
[(_d = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconXPosit) !== null && _d !== void 0 ? _d : 'right']: (_e = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconX) !== null && _e !== void 0 ? _e : 0,
|
475
|
-
[(_f = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconYPosit) !== null && _f !== void 0 ? _f : 'bottom']: (_g = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconY) !== null && _g !== void 0 ? _g : 23
|
476
|
-
}, 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 })),
|
498
|
+
renderLikeButton(visList[activeIndex], activeIndex, !!(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIconFixed)),
|
499
|
+
renderToggleButton(!!(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconFixed)),
|
477
500
|
renderView),
|
478
|
-
react_1.default.createElement(WaterFall_1.default, Object.assign({}, (
|
501
|
+
react_1.default.createElement(WaterFall_1.default, Object.assign({}, (_j = (_h = (_g = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.hashTag) === null || _g === void 0 ? void 0 : _g[0]) === null || _h === void 0 ? void 0 : _h.item) === null || _j === void 0 ? void 0 : _j.props))));
|
479
502
|
};
|
480
503
|
exports.default = SxpPageRender;
|
@@ -27,6 +27,7 @@ export type CTAInfoType = {
|
|
27
27
|
weight: number | null;
|
28
28
|
enTitle: string;
|
29
29
|
link: string | null;
|
30
|
+
remark?: string;
|
30
31
|
};
|
31
32
|
export type ProductInfoType = {
|
32
33
|
traceInfo?: string | null;
|
@@ -44,6 +45,7 @@ export type ProductInfoType = {
|
|
44
45
|
bindCta?: CTAInfoType;
|
45
46
|
taxInfo?: string;
|
46
47
|
cover?: string;
|
48
|
+
remark?: string;
|
47
49
|
};
|
48
50
|
export type VideoInfoType = {
|
49
51
|
bindCtaId: string;
|
@@ -31,10 +31,10 @@ export interface ISxpDataSourceContext {
|
|
31
31
|
defaultSize?: number;
|
32
32
|
channel?: string;
|
33
33
|
hashTag?: string;
|
34
|
-
'itemFilter.itemId'?: string;
|
35
|
-
'itemFilter.itemType'?: 'VIDEO' | 'PRODUCT' | null | undefined;
|
36
34
|
traceInfo?: string;
|
37
35
|
themeTag?: string;
|
36
|
+
contentFilter?: string;
|
37
|
+
productFilter?: string;
|
38
38
|
}) => Promise<RecommendVideoResultType | undefined>;
|
39
39
|
utmVal?: string;
|
40
40
|
bffEventReport?: (body: {
|
@@ -119,6 +119,7 @@ export interface SxpDataSourceProviderProps {
|
|
119
119
|
globalConfig?: ISxpPageRenderProps['globalConfig'];
|
120
120
|
isEditor?: boolean;
|
121
121
|
utmParameter?: PageData['utm_parameter'];
|
122
|
+
channelQueryList?: any[];
|
122
123
|
}
|
123
124
|
export declare const DEFAULT_TAG = "FOR U";
|
124
125
|
declare const _default: React.NamedExoticComponent<SxpDataSourceProviderProps>;
|
@@ -9,6 +9,7 @@ const localStore_1 = require("../utils/localStore");
|
|
9
9
|
const useIconLink_1 = require("../components/SxpPageRender/useIconLink");
|
10
10
|
const event_1 = tslib_1.__importStar(require("../utils/event"));
|
11
11
|
const Consent_1 = tslib_1.__importDefault(require("../components/Consent"));
|
12
|
+
const tool_1 = require("../utils/tool");
|
12
13
|
exports.SxpDataSourceContext = (0, react_1.createContext)({
|
13
14
|
rtcList: [],
|
14
15
|
tagList: []
|
@@ -18,7 +19,7 @@ var DataSourceType;
|
|
18
19
|
DataSourceType[DataSourceType["BFF"] = 5] = "BFF";
|
19
20
|
})(DataSourceType || (DataSourceType = {}));
|
20
21
|
exports.DEFAULT_TAG = 'FOR U';
|
21
|
-
const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent = true, maxSize, defaultSize, isPreview = false, sxpParameter, appDomain, hashTagSize, loadingImage, isOpenHashTag = false, enabledMetaConversionApi = false, consentHeight, consentWidth, isShowTag = true, isOpenConsent = false, globalConfig, isEditor = false, utmParameter }) => {
|
22
|
+
const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent = true, maxSize, defaultSize, isPreview = false, sxpParameter, appDomain, hashTagSize, loadingImage, isOpenHashTag = false, enabledMetaConversionApi = false, consentHeight, consentWidth, isShowTag = true, isOpenConsent = false, globalConfig, isEditor = false, utmParameter, channelQueryList }) => {
|
22
23
|
var _a, _b, _c;
|
23
24
|
const [rtcList, setRtcList] = (0, react_1.useState)([]);
|
24
25
|
const [tagList, setTagList] = (0, react_1.useState)([]);
|
@@ -96,15 +97,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
96
97
|
}, [bffDataSource]);
|
97
98
|
const getRecommendVideos = (0, react_1.useCallback)((query) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
98
99
|
var _d, _e, _f, _g, _h;
|
99
|
-
query = {
|
100
|
-
maxSize: (_d = query === null || query === void 0 ? void 0 : query.maxSize) !== null && _d !== void 0 ? _d : maxSize,
|
101
|
-
defaultSize: (_e = query === null || query === void 0 ? void 0 : query.defaultSize) !== null && _e !== void 0 ? _e : defaultSize,
|
102
|
-
'itemFilter.itemId': query === null || query === void 0 ? void 0 : query['itemFilter.itemId'],
|
103
|
-
'itemFilter.itemType': query === null || query === void 0 ? void 0 : query['itemFilter.itemType'],
|
104
|
-
hashTag: query === null || query === void 0 ? void 0 : query.hashTag,
|
105
|
-
traceInfo: query === null || query === void 0 ? void 0 : query.traceInfo,
|
106
|
-
themeTag: query === null || query === void 0 ? void 0 : query.themeTag
|
107
|
-
};
|
100
|
+
query = Object.assign(Object.assign({ maxSize: (_d = query === null || query === void 0 ? void 0 : query.maxSize) !== null && _d !== void 0 ? _d : maxSize, defaultSize: (_e = query === null || query === void 0 ? void 0 : query.defaultSize) !== null && _e !== void 0 ? _e : defaultSize, hashTag: query === null || query === void 0 ? void 0 : query.hashTag, traceInfo: query === null || query === void 0 ? void 0 : query.traceInfo, themeTag: query === null || query === void 0 ? void 0 : query.themeTag }, ((query === null || query === void 0 ? void 0 : query.contentFilter) && { contentFilter: `[${query === null || query === void 0 ? void 0 : query.contentFilter}]` })), ((query === null || query === void 0 ? void 0 : query.productFilter) && { productFilter: `[${query === null || query === void 0 ? void 0 : query.productFilter}]` }));
|
108
101
|
if (utmVal) {
|
109
102
|
const val = (_h = (_g = (_f = utmVal === null || utmVal === void 0 ? void 0 : utmVal.split('&')) === null || _f === void 0 ? void 0 : _f.filter((val) => {
|
110
103
|
var _a, _b;
|
@@ -113,6 +106,9 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
113
106
|
})) === null || _g === void 0 ? void 0 : _g.join('&')) !== null && _h !== void 0 ? _h : '';
|
114
107
|
query = Object.assign(Object.assign({}, query), { channel: decodeURIComponent(val) });
|
115
108
|
}
|
109
|
+
if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview) || isEditor) {
|
110
|
+
query = Object.assign(Object.assign(Object.assign({}, query), { directPage: true, level: 1, pageNum: 1 }), (!utmVal && channelQueryList && (channelQueryList === null || channelQueryList === void 0 ? void 0 : channelQueryList.length) > 0 && { channel: channelQueryList === null || channelQueryList === void 0 ? void 0 : channelQueryList.join('&') }));
|
111
|
+
}
|
116
112
|
const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/recommend/list', { method: 'GET', query }));
|
117
113
|
if (!(result === null || result === void 0 ? void 0 : result.success)) {
|
118
114
|
return undefined;
|
@@ -120,29 +116,26 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
120
116
|
if (!(query === null || query === void 0 ? void 0 : query.hashTag))
|
121
117
|
setCurReqInfo({ rtc: result.data.rtc, requestId: result.data.requestId });
|
122
118
|
return result === null || result === void 0 ? void 0 : result.data;
|
123
|
-
}), [bffFetch, utmVal, maxSize, defaultSize]);
|
119
|
+
}), [bffFetch, utmVal, maxSize, defaultSize, globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview, channelQueryList, isEditor]);
|
124
120
|
const loadVideos = (0, react_1.useCallback)(() => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
121
|
+
var _j, _k, _l, _m;
|
125
122
|
if (rtcList.length <= 0) {
|
126
123
|
return;
|
127
124
|
}
|
128
|
-
const
|
129
|
-
|
130
|
-
'itemFilter.itemId': waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.itemId,
|
131
|
-
'itemFilter.itemType': waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.itemType,
|
132
|
-
themeTag: themeTag.current
|
133
|
-
});
|
125
|
+
const lastItem = rtcList === null || rtcList === void 0 ? void 0 : rtcList[(rtcList === null || rtcList === void 0 ? void 0 : rtcList.length) - 1];
|
126
|
+
const data = yield getRecommendVideos(Object.assign(Object.assign(Object.assign({ hashTag: waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.hashTag }, (((_j = lastItem === null || lastItem === void 0 ? void 0 : lastItem.product) === null || _j === void 0 ? void 0 : _j.itemId) && { productFilter: (_k = lastItem === null || lastItem === void 0 ? void 0 : lastItem.product) === null || _k === void 0 ? void 0 : _k.itemId })), (((_l = lastItem === null || lastItem === void 0 ? void 0 : lastItem.video) === null || _l === void 0 ? void 0 : _l.itemId) && { contentFilter: (_m = lastItem === null || lastItem === void 0 ? void 0 : lastItem.video) === null || _m === void 0 ? void 0 : _m.itemId })), { themeTag: themeTag.current }));
|
134
127
|
setRtcList(rtcList.concat(getFilterRecList(data)));
|
135
128
|
setCacheRtcList(cacheRtcList.concat(getFilterRecList(data)));
|
136
129
|
}), [getRecommendVideos, rtcList, waterFallData, cacheRtcList]);
|
137
130
|
const bffEventReport = (0, react_1.useCallback)(({ userInfo, eventInfo }) => {
|
138
|
-
if (!enableReportEvent) {
|
131
|
+
if (!enableReportEvent || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview)) {
|
139
132
|
return;
|
140
133
|
}
|
141
134
|
if (!userInfo) {
|
142
135
|
userInfo = {};
|
143
136
|
}
|
144
137
|
const sessionID = (0, sessionStore_1.storeAndLoadFeSessionId)();
|
145
|
-
const ef = Object.assign({ sessionID, rtc: curReqInfo.rtc, requestId: curReqInfo.requestId }, eventInfo);
|
138
|
+
const ef = Object.assign(Object.assign({ sessionID, rtc: curReqInfo.rtc, requestId: curReqInfo.requestId }, eventInfo), { sxpDevice: (0, tool_1.getDevice)(), sxpSystem: (0, tool_1.getSystem)(), sxpBrowser: (0, tool_1.getBrowserInfo)() });
|
146
139
|
const realUserInfo = Object.entries(userInfo).map(([k, v]) => ({ name: k, value: v }));
|
147
140
|
const realEventInfo = Object.entries(ef)
|
148
141
|
.map(([k, v]) => v && { name: k, value: v })
|
@@ -156,11 +149,11 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
156
149
|
body: { userInfo: realUserInfo, eventInfo: realEventInfo },
|
157
150
|
type: 'beacon'
|
158
151
|
});
|
159
|
-
}, [bffFetch, curReqInfo, enableReportEvent]);
|
152
|
+
}, [bffFetch, curReqInfo, enableReportEvent, globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview]);
|
160
153
|
const bffFbReport = (0, react_1.useCallback)((_a) => {
|
161
|
-
var _b;
|
154
|
+
var _b, _c;
|
162
155
|
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;
|
163
|
-
if (!enableReportEvent || !enabledMetaConversionApi) {
|
156
|
+
if (!enableReportEvent || !enabledMetaConversionApi || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview)) {
|
164
157
|
return;
|
165
158
|
}
|
166
159
|
const fakeUserId = (0, localStore_1.storeAndLoadFeUserId)();
|
@@ -171,12 +164,15 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
171
164
|
actionSource,
|
172
165
|
eventSourceUrl,
|
173
166
|
userData: {
|
174
|
-
externalId: fakeUserId
|
167
|
+
externalId: fakeUserId,
|
168
|
+
fbc: `fb.2.${new Date().getTime()}.${(0, tool_1.getCookie)('_fbc')}`,
|
169
|
+
fbp: `fb.2.${new Date().getTime()}.${(0, tool_1.getCookie)('_fbp')}`,
|
170
|
+
client_user_agent: (_c = window === null || window === void 0 ? void 0 : window.navigator) === null || _c === void 0 ? void 0 : _c.userAgent
|
175
171
|
}
|
176
172
|
},
|
177
173
|
type: 'beacon'
|
178
174
|
});
|
179
|
-
}, [bffFetch, enableReportEvent, enabledMetaConversionApi]);
|
175
|
+
}, [bffFetch, enableReportEvent, enabledMetaConversionApi, globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview]);
|
180
176
|
const bffMutateLike = (0, react_1.useCallback)((body) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
181
177
|
const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/recommend/like', { method: 'POST', body }));
|
182
178
|
return res === null || res === void 0 ? void 0 : res.success;
|
@@ -190,24 +186,24 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
190
186
|
return res === null || res === void 0 ? void 0 : res.success;
|
191
187
|
}), [bffFetch]);
|
192
188
|
const bffGetTagList = (0, react_1.useCallback)(() => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
193
|
-
var
|
189
|
+
var _o, _p, _q, _r, _s;
|
194
190
|
if (!utmVal || !isShowTag)
|
195
191
|
return;
|
196
192
|
try {
|
197
|
-
const val = (
|
193
|
+
const val = (_q = (_p = (_o = utmVal === null || utmVal === void 0 ? void 0 : utmVal.split('&')) === null || _o === void 0 ? void 0 : _o.filter((val) => {
|
198
194
|
var _a, _b;
|
199
195
|
const key = val.split('=')[0];
|
200
196
|
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);
|
201
|
-
})) === null ||
|
197
|
+
})) === null || _p === void 0 ? void 0 : _p.join('&')) !== null && _q !== void 0 ? _q : '';
|
202
198
|
const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/tag/list', { method: 'GET', query: { channel: decodeURIComponent(val) } }));
|
203
|
-
setTagList((
|
199
|
+
setTagList((_s = (_r = result === null || result === void 0 ? void 0 : result.data) === null || _r === void 0 ? void 0 : _r.tags) !== null && _s !== void 0 ? _s : []);
|
204
200
|
}
|
205
201
|
catch (e) {
|
206
202
|
console.log('e', e);
|
207
203
|
}
|
208
204
|
}), [bffFetch, utmVal, isShowTag]);
|
209
205
|
const ctaEvent = (0, react_1.useCallback)((eventInfo, rec, product, position) => {
|
210
|
-
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;
|
206
|
+
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, _4, _5, _6, _7, _8, _9, _10, _11;
|
211
207
|
const cta = product === null || product === void 0 ? void 0 : product.bindCta;
|
212
208
|
const isProd = ((_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.bindProduct) || (((_b = rec === null || rec === void 0 ? void 0 : rec.video) === null || _b === void 0 ? void 0 : _b.bindProducts) && ((_d = (_c = rec === null || rec === void 0 ? void 0 : rec.video) === null || _c === void 0 ? void 0 : _c.bindProducts) === null || _d === void 0 ? void 0 : _d.length) > 0);
|
213
209
|
let fromKName = '';
|
@@ -220,8 +216,9 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
220
216
|
else if ((_g = (_f = rec === null || rec === void 0 ? void 0 : rec.video) === null || _f === void 0 ? void 0 : _f.imgUrls) === null || _g === void 0 ? void 0 : _g.length) {
|
221
217
|
fromKName = 'imagePage';
|
222
218
|
}
|
219
|
+
const contentTags = (_p = (_m = (_h = product === null || product === void 0 ? void 0 : product.tags) !== null && _h !== void 0 ? _h : (_l = (_k = (_j = rec === null || rec === void 0 ? void 0 : rec.video) === null || _j === void 0 ? void 0 : _j.bindProducts) === null || _k === void 0 ? void 0 : _k[0]) === null || _l === void 0 ? void 0 : _l.tags) !== null && _m !== void 0 ? _m : (_o = rec === null || rec === void 0 ? void 0 : rec.video) === null || _o === void 0 ? void 0 : _o.tags) !== null && _p !== void 0 ? _p : (_q = rec === null || rec === void 0 ? void 0 : rec.product) === null || _q === void 0 ? void 0 : _q.tags;
|
223
220
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
224
|
-
eventInfo: Object.assign(Object.assign({}, eventInfo), { ctaId: (
|
221
|
+
eventInfo: Object.assign(Object.assign({}, eventInfo), { ctaId: (_r = cta === null || cta === void 0 ? void 0 : cta.itemId) !== null && _r !== void 0 ? _r : '', ctaName: (_s = cta === null || cta === void 0 ? void 0 : cta.title) !== null && _s !== void 0 ? _s : '', contentTags: contentTags ? JSON.stringify(contentTags) : '', position: position + '', contentId: (_u = (_t = rec === null || rec === void 0 ? void 0 : rec.video) === null || _t === void 0 ? void 0 : _t.itemId) !== null && _u !== void 0 ? _u : '', productId: isProd ? product === null || product === void 0 ? void 0 : product.itemId : '', traceInfo: (_10 = (_7 = (_2 = (_y = (_v = cta === null || cta === void 0 ? void 0 : cta.traceInfo) !== null && _v !== void 0 ? _v : (_x = (_w = rec === null || rec === void 0 ? void 0 : rec.video) === null || _w === void 0 ? void 0 : _w.bindCta) === null || _x === void 0 ? void 0 : _x.traceInfo) !== null && _y !== void 0 ? _y : (_1 = (_0 = (_z = rec === null || rec === void 0 ? void 0 : rec.video) === null || _z === void 0 ? void 0 : _z.bindProduct) === null || _0 === void 0 ? void 0 : _0.bindCta) === null || _1 === void 0 ? void 0 : _1.traceInfo) !== null && _2 !== void 0 ? _2 : (_6 = (_5 = (_4 = (_3 = rec === null || rec === void 0 ? void 0 : rec.video) === null || _3 === void 0 ? void 0 : _3.bindProducts) === null || _4 === void 0 ? void 0 : _4[0]) === null || _5 === void 0 ? void 0 : _5.bindCta) === null || _6 === void 0 ? void 0 : _6.traceInfo) !== null && _7 !== void 0 ? _7 : (_9 = (_8 = rec === null || rec === void 0 ? void 0 : rec.product) === null || _8 === void 0 ? void 0 : _8.bindCta) === null || _9 === void 0 ? void 0 : _9.traceInfo) !== null && _10 !== void 0 ? _10 : '', fromKName, fromKPage: (_11 = location === null || location === void 0 ? void 0 : location.href) !== null && _11 !== void 0 ? _11 : '' })
|
225
222
|
});
|
226
223
|
}, [bffEventReport, isFromHashtag]);
|
227
224
|
const h5EnterLink = (0, react_1.useCallback)(() => {
|