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
@@ -4,7 +4,7 @@ import * as ReactDOM from 'react-dom';
|
|
4
4
|
import { useEditor, useSxpDataSource } from '../../../../core/hooks';
|
5
5
|
const closeIcon = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAjhJREFUWEfFlztOw0AQhmeWiJ4CCmpQ5DiRQsIJyAWg5A0lR0AIChDiCJS8ER0cADgBeRSxt4CCDgkaKiq8i+zYeWx2413HEWmiJJv9v535Z2aN8M8vFPT9z3zETD0aAUChUJjwvPFHAJhBhB3Hqd6OAsK2yyucwykAvP38eJX398Z3AJDLlVYR8ToU9Rhj25TWr9KEsKy5dULIGQCMtfZly45TvwsAstm56UwG6wA4FUFwzrdctxZBDcWSy5XWEPG8I84/GcMipdWPtgcsaz5PCHtKG0IuTiqUvjT9U/WYMG2IOPE+AP+LtCB0xKUAAyA2Xbd2o2OG0NQXvTnvhL17D7EPtH9TRCIWwkRcGYGIQgYBABuqPuHXOQBc6pw80lBGwBQiiXhsBHQhkoprA6iM6acjhDQKu5YJZW6XeOI3XJdpvfsdTu52VfXEekD8owQiXGIubpSCbhDbLu8DwKEAd+A41SOdPpE4BS0viFOtvV2iKWqUgn5x/tmS70xR01GuDSCKc86/OCcLgTyyZ0ScDGNhFAktAJV4NFJ9YyaFiAWIE+9uVkkgBgLoig8DMWAa9ro9ynkUdlW5maZDCmB6clmz0k1HH4Cs1Ezbq2p2yEpUuBOKTSZZex00RUWIrltxuuK6EOGDSbGIOPZicpMx6fny650377qNRgBgWeVFQuA+6UjVgREhGIMlSqsPUQqIbZdOOIdZQmCv2axRnU1N1+TzJYsxOEaEV8ep7frPZ7Gd0FTEdP0ft0/kMNdg0eoAAAAASUVORK5CYII=';
|
6
6
|
const Modal = ({ visible, onClose, children, modalStyle, padding, popup, schema, fullHeight = window.innerHeight, isFullScreen = false }) => {
|
7
|
-
var _a, _b;
|
7
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
8
8
|
const touchRef = useRef(null);
|
9
9
|
const fTouchRef = useRef(null);
|
10
10
|
const touchMoveRef = useRef(null);
|
@@ -31,12 +31,16 @@ const Modal = ({ visible, onClose, children, modalStyle, padding, popup, schema,
|
|
31
31
|
const isOpen = useMemo(() => {
|
32
32
|
return ((popup === null || popup === void 0 ? void 0 : popup.id) && (popup === null || popup === void 0 ? void 0 : popup.id) !== '') || visible;
|
33
33
|
}, [visible, popup]);
|
34
|
-
const
|
35
|
-
var _a, _b, _c
|
34
|
+
const getPopupById = useMemo(() => {
|
35
|
+
var _a, _b, _c;
|
36
36
|
const schemaData = schema !== null && schema !== void 0 ? schema : _schema;
|
37
37
|
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));
|
38
|
-
return
|
38
|
+
return value;
|
39
39
|
}, [popup, schema, _schema]);
|
40
|
+
const isScrollFullScreen = useMemo(() => {
|
41
|
+
var _a, _b;
|
42
|
+
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;
|
43
|
+
}, [getPopupById]);
|
40
44
|
useEffect(() => {
|
41
45
|
if (isOpen) {
|
42
46
|
setIsShow(true);
|
@@ -100,21 +104,30 @@ const Modal = ({ visible, onClose, children, modalStyle, padding, popup, schema,
|
|
100
104
|
touchMoveRef.current = false;
|
101
105
|
};
|
102
106
|
return ReactDOM.createPortal(React.createElement(React.Fragment, null, isShow && (React.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 },
|
103
|
-
React.createElement("div",
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
107
|
+
React.createElement("div", { style: {
|
108
|
+
position: 'relative',
|
109
|
+
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`,
|
110
|
+
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`,
|
111
|
+
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`,
|
112
|
+
overflow: 'hidden',
|
113
|
+
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)`,
|
114
|
+
height: '100%'
|
115
|
+
} },
|
116
|
+
React.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 && {
|
117
|
+
transform: `translateY(${modalTrans}px)`
|
118
|
+
})), onClick: (e) => {
|
119
|
+
e.stopPropagation();
|
120
|
+
e.preventDefault();
|
121
|
+
} }, (isScrollFullScreen && {
|
122
|
+
onTouchMove: handleTouchMove,
|
123
|
+
onTouchStart: handleTouchStart,
|
124
|
+
onTouchEnd: handleTouchEnd
|
125
|
+
})),
|
126
|
+
React.createElement("div", { onClick: onClose, className: 'modal-icon-wrapper' },
|
127
|
+
React.createElement("img", { src: (_t = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.popupCloseIcon) !== null && _t !== void 0 ? _t : closeIcon, alt: 'close', className: 'modal-icon' })),
|
128
|
+
React.createElement("div", { ref: ref, style: {
|
129
|
+
height: isScrollFullScreen ? fullHeight : MODAL_DEF_CON_H,
|
130
|
+
overflow: (isScrollFullScreen && modalTrans <= 0) || !isScrollFullScreen ? 'auto' : 'hidden'
|
131
|
+
} }, children)))))), modalEleRef.current);
|
119
132
|
};
|
120
133
|
export default memo(Modal);
|
@@ -58,14 +58,14 @@ const Popup = () => {
|
|
58
58
|
const renderPopupDetail = useMemo(() => {
|
59
59
|
var _a, _b, _c;
|
60
60
|
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) => {
|
61
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p
|
61
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
62
62
|
if ((value === null || value === void 0 ? void 0 : value.id) === (popup === null || popup === void 0 ? void 0 : popup.id)) {
|
63
63
|
const t = resolver[(_a = value === null || value === void 0 ? void 0 : value.item) === null || _a === void 0 ? void 0 : _a.type];
|
64
64
|
const Component = withBindDataSource(t);
|
65
65
|
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';
|
66
66
|
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';
|
67
67
|
const defaulSetting = (_h = t === null || t === void 0 ? void 0 : t.extend) === null || _h === void 0 ? void 0 : _h.defaulSetting;
|
68
|
-
return (React.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), {
|
68
|
+
return (React.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 })));
|
69
69
|
}
|
70
70
|
else {
|
71
71
|
return React.createElement(React.Fragment, null);
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import React, { memo, useState } from 'react';
|
1
|
+
import React, { memo, useEffect, useState } from 'react';
|
2
2
|
const ToggleButton = ({ defaultValue, activeIcon, unactiveIcon, onChange, style }) => {
|
3
3
|
const [isTrue, setIsTure] = useState(defaultValue);
|
4
4
|
const handleClick = (e) => {
|
@@ -7,6 +7,9 @@ const ToggleButton = ({ defaultValue, activeIcon, unactiveIcon, onChange, style
|
|
7
7
|
setIsTure(result);
|
8
8
|
onChange === null || onChange === void 0 ? void 0 : onChange(result);
|
9
9
|
};
|
10
|
+
useEffect(() => {
|
11
|
+
setIsTure(defaultValue);
|
12
|
+
}, [defaultValue]);
|
10
13
|
return (React.createElement("button", { style: style, "aria-label": 'toggle button', className: 'pb-toggle-button', onClick: handleClick },
|
11
14
|
React.createElement("img", { className: 'pb-toggle-button-icon', alt: 'toggle image', src: isTrue ? activeIcon : unactiveIcon })));
|
12
15
|
};
|
@@ -128,31 +128,22 @@ export default function WaterfallList(_a) {
|
|
128
128
|
const containerRef = useRef(null);
|
129
129
|
const [isLoadMore, setIsLoadMore] = useState(false);
|
130
130
|
const loadMoreData = useCallback(() => {
|
131
|
+
var _a, _b, _c, _d;
|
131
132
|
if (isLoadMore)
|
132
133
|
return;
|
133
134
|
setIsLoadMore(true);
|
134
135
|
waterFallData &&
|
135
|
-
(getRecommendVideos === null || getRecommendVideos === void 0 ? void 0 : getRecommendVideos({
|
136
|
-
hashTag: waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.hashTag,
|
137
|
-
'itemFilter.itemId': waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.itemId,
|
138
|
-
'itemFilter.itemType': waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.itemType
|
139
|
-
}).then((res) => {
|
136
|
+
(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) => {
|
140
137
|
var _a;
|
141
138
|
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 : []));
|
142
139
|
setIsLoadMore(false);
|
143
140
|
}));
|
144
141
|
}, [waterFallData, getRecommendVideos, list, isLoadMore]);
|
145
142
|
useEffect(() => {
|
146
|
-
var _a, _b;
|
143
|
+
var _a, _b, _c, _d, _e, _f;
|
147
144
|
setIsLoadingData(true);
|
148
145
|
waterFallData &&
|
149
|
-
(getRecommendVideos === null || getRecommendVideos === void 0 ? void 0 : getRecommendVideos({
|
150
|
-
hashTag: waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.hashTag,
|
151
|
-
'itemFilter.itemId': waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.itemId,
|
152
|
-
'itemFilter.itemType': waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.itemType,
|
153
|
-
defaultSize: hashTagSize,
|
154
|
-
maxSize: hashTagSize
|
155
|
-
}).then((res) => {
|
146
|
+
(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) => {
|
156
147
|
var _a, _b;
|
157
148
|
setData(res);
|
158
149
|
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 : []);
|
@@ -161,7 +152,7 @@ export default function WaterfallList(_a) {
|
|
161
152
|
if (isOpenHashTag) {
|
162
153
|
const res = previewData;
|
163
154
|
setData(res);
|
164
|
-
setList((
|
155
|
+
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 : []);
|
165
156
|
setIsLoadingData(false);
|
166
157
|
}
|
167
158
|
}, [waterFallData, getRecommendVideos, hashTagSize, isOpenHashTag]);
|
@@ -207,16 +207,10 @@ export default function WaterfallList(_a) {
|
|
207
207
|
styleListRef.current = getStyleList();
|
208
208
|
}, [unitWidth, rowsNum, list]);
|
209
209
|
useEffect(() => {
|
210
|
-
var _a, _b;
|
210
|
+
var _a, _b, _c, _d, _e, _f;
|
211
211
|
setIsLoadingData(true);
|
212
212
|
waterFallData &&
|
213
|
-
(getRecommendVideos === null || getRecommendVideos === void 0 ? void 0 : getRecommendVideos({
|
214
|
-
hashTag: waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.hashTag,
|
215
|
-
'itemFilter.itemId': waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.itemId,
|
216
|
-
'itemFilter.itemType': waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.itemType,
|
217
|
-
defaultSize: hashTagSize,
|
218
|
-
maxSize: hashTagSize
|
219
|
-
}).then((res) => {
|
213
|
+
(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) => {
|
220
214
|
var _a, _b;
|
221
215
|
setData(res);
|
222
216
|
setList((_b = (_a = res === null || res === void 0 ? void 0 : res.recList) === null || _a === void 0 ? void 0 : _a.filter((item) => (item === null || item === void 0 ? void 0 : item.video) !== null || (item === null || item === void 0 ? void 0 : item.product) !== null)) !== null && _b !== void 0 ? _b : []);
|
@@ -225,7 +219,7 @@ export default function WaterfallList(_a) {
|
|
225
219
|
if (isOpenHashTag) {
|
226
220
|
const res = previewData;
|
227
221
|
setData(res);
|
228
|
-
setList((
|
222
|
+
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 : []);
|
229
223
|
setIsLoadingData(false);
|
230
224
|
}
|
231
225
|
}, [waterFallData, getRecommendVideos, hashTagSize, isOpenHashTag]);
|
@@ -250,13 +244,10 @@ export default function WaterfallList(_a) {
|
|
250
244
|
};
|
251
245
|
}, [onResize]);
|
252
246
|
const loadMoreData = useCallback(() => {
|
247
|
+
var _a, _b, _c, _d;
|
253
248
|
setIsLoadingData(true);
|
254
249
|
waterFallData &&
|
255
|
-
(getRecommendVideos === null || getRecommendVideos === void 0 ? void 0 : getRecommendVideos({
|
256
|
-
hashTag: waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.hashTag,
|
257
|
-
'itemFilter.itemId': waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.itemId,
|
258
|
-
'itemFilter.itemType': waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.itemType
|
259
|
-
}).then((res) => {
|
250
|
+
(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) => {
|
260
251
|
var _a, _b;
|
261
252
|
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 : []));
|
262
253
|
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;
|
@@ -22,7 +22,9 @@ import withBindDataSource from '../../../core/hoc/withBindDataSource';
|
|
22
22
|
import Tagbar from './Tagbar';
|
23
23
|
import { getFeUserId, getSlideSkipState, setSlideSkipState } from '../../../core/utils/localStore';
|
24
24
|
const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.innerHeight, containerWidth = window.innerWidth, tempMap, resolver, data = [], ctaType, tipText, nudge, _schema, hashTagStyle, tagList = [], licenseUrl }) => {
|
25
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j
|
25
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
26
|
+
const mutedIcon = useIconLink('/pb_static/5beaaa5ce7f3477b99db3838619cc471.png');
|
27
|
+
const unmutedIcon = useIconLink('/pb_static/fea8668a8a894e4aa3a86bcc775e895e.png');
|
26
28
|
const { schema } = useEditor();
|
27
29
|
const [activeIndex, setActiveIndex] = useState(0);
|
28
30
|
const viewImageStartTime = useRef(0);
|
@@ -36,8 +38,8 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
36
38
|
const { backMainFeed } = useEventReport();
|
37
39
|
const { productView } = useEventReport();
|
38
40
|
const isShowFingerTip = useMemo(() => {
|
39
|
-
return data.length > 0 && !loading && getFeUserId();
|
40
|
-
}, [data, loading]);
|
41
|
+
return data.length > 0 && !loading && (getFeUserId() || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enableSwiperTip));
|
42
|
+
}, [data, loading, globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enableSwiperTip]);
|
41
43
|
useEffect(() => {
|
42
44
|
refreshFeSessionId();
|
43
45
|
}, []);
|
@@ -65,14 +67,15 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
65
67
|
var _a;
|
66
68
|
const index = (data === null || data === void 0 ? void 0 : data.findIndex((item) => {
|
67
69
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
68
|
-
|
70
|
+
const ctaType0 = ctaType === null || ctaType === void 0 ? void 0 : ctaType[0];
|
71
|
+
if (ctaType0 === '多商品CTA') {
|
69
72
|
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;
|
70
73
|
}
|
71
|
-
else if (
|
74
|
+
else if (ctaType0 === '商品CTA') {
|
72
75
|
return (_d = item === null || item === void 0 ? void 0 : item.video) === null || _d === void 0 ? void 0 : _d.bindProduct;
|
73
76
|
}
|
74
77
|
else {
|
75
|
-
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) ===
|
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) === 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));
|
76
79
|
}
|
77
80
|
})) || 0;
|
78
81
|
(_a = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _a === void 0 ? void 0 : _a.swiper.slideTo(index);
|
@@ -174,8 +177,10 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
174
177
|
return containerHeight - minusHeight - tagHeight;
|
175
178
|
}, [globalConfig, containerHeight, tagHeight]);
|
176
179
|
const renderLogo = useMemo(() => {
|
180
|
+
var _a, _b;
|
177
181
|
if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.logoUrl) && (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowLogo)) {
|
178
|
-
|
182
|
+
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;
|
183
|
+
return (React.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)() })),
|
179
184
|
React.createElement("img", { src: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.logoUrl, alt: 'logo' })));
|
180
185
|
}
|
181
186
|
return null;
|
@@ -255,9 +260,9 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
255
260
|
isShowMore,
|
256
261
|
lineGradStyle
|
257
262
|
]);
|
258
|
-
const renderLikeButton = useCallback((rec, index) => {
|
263
|
+
const renderLikeButton = useCallback((rec, index, visible) => {
|
259
264
|
var _a, _b, _c, _d;
|
260
|
-
if (!(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowLike))
|
265
|
+
if (!(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowLike) || !visible)
|
261
266
|
return;
|
262
267
|
let top = (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIconY) !== null && _a !== void 0 ? _a : 400;
|
263
268
|
if (waterFallData && top < 40) {
|
@@ -265,6 +270,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
265
270
|
}
|
266
271
|
if (rec === null || rec === void 0 ? void 0 : rec.video) {
|
267
272
|
return (React.createElement(LikeButton, { 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: {
|
273
|
+
position: (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIconFixed) ? 'fixed' : 'absolute',
|
268
274
|
[(_b = globalConfig.likeIconXPosit) !== null && _b !== void 0 ? _b : 'right']: (_c = globalConfig.likeIconX) !== null && _c !== void 0 ? _c : 0,
|
269
275
|
[(_d = globalConfig.likeIconYPosit) !== null && _d !== void 0 ? _d : 'bottom']: top
|
270
276
|
}, position: index }));
|
@@ -411,6 +417,18 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
411
417
|
});
|
412
418
|
return !waterFallData ? list.concat([{ loading: true }]) : list;
|
413
419
|
}, [data, activeIndex, waterFallData]);
|
420
|
+
const renderToggleButton = useCallback((visible) => {
|
421
|
+
var _a, _b, _c, _d, _e, _f;
|
422
|
+
if (!visible)
|
423
|
+
return;
|
424
|
+
return (((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowMute) === undefined || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowMute) === true) && (React.createElement(ToggleButton, { style: {
|
425
|
+
position: (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconFixed) ? 'fixed' : 'absolute',
|
426
|
+
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',
|
427
|
+
zIndex: 999,
|
428
|
+
[(_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,
|
429
|
+
[(_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
|
430
|
+
}, 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 })));
|
431
|
+
}, [globalConfig, visList, activeIndex, isMuted]);
|
414
432
|
const renderView = useMemo(() => {
|
415
433
|
if (loading) {
|
416
434
|
return (React.createElement("div", { style: { height, width: containerWidth, display: 'flex', justifyContent: 'center', alignItems: 'center' } },
|
@@ -427,20 +445,30 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
427
445
|
React.createElement("img", { width: 64, height: 64, src: loadingImage, alt: 'loading...', style: { objectFit: 'contain' } }))) : (React.createElement(React.Fragment, null,
|
428
446
|
renderContent(rec, index),
|
429
447
|
renderBottom(rec, index),
|
430
|
-
renderLikeButton(rec, index))
|
448
|
+
renderLikeButton(rec, index, !(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIconFixed)),
|
449
|
+
renderToggleButton(!(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconFixed))))))));
|
431
450
|
});
|
432
|
-
}, [
|
433
|
-
|
434
|
-
|
451
|
+
}, [
|
452
|
+
containerWidth,
|
453
|
+
data,
|
454
|
+
height,
|
455
|
+
loading,
|
456
|
+
renderBottom,
|
457
|
+
renderContent,
|
458
|
+
visList,
|
459
|
+
loadingImage,
|
460
|
+
isReload,
|
461
|
+
renderToggleButton
|
462
|
+
]);
|
435
463
|
return (React.createElement("div", { id: 'sxp-render', className: 'clc-sxp-container' },
|
436
|
-
waterFallData && (React.createElement(Navbar, { icon: left, styles: { background: 'rgba(0,0,0,.3)', color: '#fff' }, onClose: () => {
|
464
|
+
waterFallData && (React.createElement(Navbar, { icon: left, 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: () => {
|
437
465
|
setOpenHashtag === null || setOpenHashtag === void 0 ? void 0 : setOpenHashtag(true);
|
438
466
|
} })),
|
439
467
|
renderLogo,
|
440
468
|
React.createElement(Tagbar, { tagList: tagList, setActiveIndex: setActiveIndex, style: {
|
441
469
|
top: minusHeight
|
442
470
|
} }),
|
443
|
-
isShowFingerTip ? (React.createElement(FingerSwipeTip, { imageUrl: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.swipeTipIcon, style: { top: `${50 - ((
|
471
|
+
isShowFingerTip ? (React.createElement(FingerSwipeTip, { 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,
|
444
472
|
React.createElement(Swiper, { style: {
|
445
473
|
marginTop: tagHeight
|
446
474
|
}, ref: swiperRef, onSlideChange: () => {
|
@@ -464,14 +492,9 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
464
492
|
}
|
465
493
|
}
|
466
494
|
}, direction: 'vertical', height: height },
|
467
|
-
(
|
468
|
-
|
469
|
-
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',
|
470
|
-
zIndex: 999,
|
471
|
-
[(_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,
|
472
|
-
[(_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
|
473
|
-
}, 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 })),
|
495
|
+
renderLikeButton(visList[activeIndex], activeIndex, !!(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIconFixed)),
|
496
|
+
renderToggleButton(!!(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconFixed)),
|
474
497
|
renderView),
|
475
|
-
React.createElement(WaterFall, Object.assign({}, (
|
498
|
+
React.createElement(WaterFall, 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))));
|
476
499
|
};
|
477
500
|
export 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>;
|
@@ -6,6 +6,7 @@ import { storeAndLoadFeUserId, AGREE_POLICY } from '../utils/localStore';
|
|
6
6
|
import { useIconLink } from '../components/SxpPageRender/useIconLink';
|
7
7
|
import SXP_EVENT_BUS, { SXP_EVENT_TYPE } from '../utils/event';
|
8
8
|
import Consent from '../components/Consent';
|
9
|
+
import { getBrowserInfo, getCookie, getDevice, getSystem } from '../utils/tool';
|
9
10
|
export const SxpDataSourceContext = createContext({
|
10
11
|
rtcList: [],
|
11
12
|
tagList: []
|
@@ -15,7 +16,7 @@ var DataSourceType;
|
|
15
16
|
DataSourceType[DataSourceType["BFF"] = 5] = "BFF";
|
16
17
|
})(DataSourceType || (DataSourceType = {}));
|
17
18
|
export const DEFAULT_TAG = 'FOR U';
|
18
|
-
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 }) => {
|
19
|
+
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 }) => {
|
19
20
|
var _a, _b, _c;
|
20
21
|
const [rtcList, setRtcList] = useState([]);
|
21
22
|
const [tagList, setTagList] = useState([]);
|
@@ -93,15 +94,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
93
94
|
}, [bffDataSource]);
|
94
95
|
const getRecommendVideos = useCallback((query) => __awaiter(void 0, void 0, void 0, function* () {
|
95
96
|
var _d, _e, _f, _g, _h;
|
96
|
-
query = {
|
97
|
-
maxSize: (_d = query === null || query === void 0 ? void 0 : query.maxSize) !== null && _d !== void 0 ? _d : maxSize,
|
98
|
-
defaultSize: (_e = query === null || query === void 0 ? void 0 : query.defaultSize) !== null && _e !== void 0 ? _e : defaultSize,
|
99
|
-
'itemFilter.itemId': query === null || query === void 0 ? void 0 : query['itemFilter.itemId'],
|
100
|
-
'itemFilter.itemType': query === null || query === void 0 ? void 0 : query['itemFilter.itemType'],
|
101
|
-
hashTag: query === null || query === void 0 ? void 0 : query.hashTag,
|
102
|
-
traceInfo: query === null || query === void 0 ? void 0 : query.traceInfo,
|
103
|
-
themeTag: query === null || query === void 0 ? void 0 : query.themeTag
|
104
|
-
};
|
97
|
+
query = Object.assign(Object.assign({ maxSize: (_d = query === null || query === void 0 ? void 0 : query.maxSize) !== null && _d !== void 0 ? _d : maxSize, defaultSize: (_e = query === null || query === void 0 ? void 0 : query.defaultSize) !== null && _e !== void 0 ? _e : defaultSize, hashTag: query === null || query === void 0 ? void 0 : query.hashTag, traceInfo: query === null || query === void 0 ? void 0 : query.traceInfo, themeTag: query === null || query === void 0 ? void 0 : query.themeTag }, ((query === null || query === void 0 ? void 0 : query.contentFilter) && { contentFilter: `[${query === null || query === void 0 ? void 0 : query.contentFilter}]` })), ((query === null || query === void 0 ? void 0 : query.productFilter) && { productFilter: `[${query === null || query === void 0 ? void 0 : query.productFilter}]` }));
|
105
98
|
if (utmVal) {
|
106
99
|
const val = (_h = (_g = (_f = utmVal === null || utmVal === void 0 ? void 0 : utmVal.split('&')) === null || _f === void 0 ? void 0 : _f.filter((val) => {
|
107
100
|
var _a, _b;
|
@@ -110,6 +103,9 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
110
103
|
})) === null || _g === void 0 ? void 0 : _g.join('&')) !== null && _h !== void 0 ? _h : '';
|
111
104
|
query = Object.assign(Object.assign({}, query), { channel: decodeURIComponent(val) });
|
112
105
|
}
|
106
|
+
if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview) || isEditor) {
|
107
|
+
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('&') }));
|
108
|
+
}
|
113
109
|
const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/recommend/list', { method: 'GET', query }));
|
114
110
|
if (!(result === null || result === void 0 ? void 0 : result.success)) {
|
115
111
|
return undefined;
|
@@ -117,29 +113,26 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
117
113
|
if (!(query === null || query === void 0 ? void 0 : query.hashTag))
|
118
114
|
setCurReqInfo({ rtc: result.data.rtc, requestId: result.data.requestId });
|
119
115
|
return result === null || result === void 0 ? void 0 : result.data;
|
120
|
-
}), [bffFetch, utmVal, maxSize, defaultSize]);
|
116
|
+
}), [bffFetch, utmVal, maxSize, defaultSize, globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview, channelQueryList, isEditor]);
|
121
117
|
const loadVideos = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
118
|
+
var _j, _k, _l, _m;
|
122
119
|
if (rtcList.length <= 0) {
|
123
120
|
return;
|
124
121
|
}
|
125
|
-
const
|
126
|
-
|
127
|
-
'itemFilter.itemId': waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.itemId,
|
128
|
-
'itemFilter.itemType': waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.itemType,
|
129
|
-
themeTag: themeTag.current
|
130
|
-
});
|
122
|
+
const lastItem = rtcList === null || rtcList === void 0 ? void 0 : rtcList[(rtcList === null || rtcList === void 0 ? void 0 : rtcList.length) - 1];
|
123
|
+
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 }));
|
131
124
|
setRtcList(rtcList.concat(getFilterRecList(data)));
|
132
125
|
setCacheRtcList(cacheRtcList.concat(getFilterRecList(data)));
|
133
126
|
}), [getRecommendVideos, rtcList, waterFallData, cacheRtcList]);
|
134
127
|
const bffEventReport = useCallback(({ userInfo, eventInfo }) => {
|
135
|
-
if (!enableReportEvent) {
|
128
|
+
if (!enableReportEvent || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview)) {
|
136
129
|
return;
|
137
130
|
}
|
138
131
|
if (!userInfo) {
|
139
132
|
userInfo = {};
|
140
133
|
}
|
141
134
|
const sessionID = storeAndLoadFeSessionId();
|
142
|
-
const ef = Object.assign({ sessionID, rtc: curReqInfo.rtc, requestId: curReqInfo.requestId }, eventInfo);
|
135
|
+
const ef = Object.assign(Object.assign({ sessionID, rtc: curReqInfo.rtc, requestId: curReqInfo.requestId }, eventInfo), { sxpDevice: getDevice(), sxpSystem: getSystem(), sxpBrowser: getBrowserInfo() });
|
143
136
|
const realUserInfo = Object.entries(userInfo).map(([k, v]) => ({ name: k, value: v }));
|
144
137
|
const realEventInfo = Object.entries(ef)
|
145
138
|
.map(([k, v]) => v && { name: k, value: v })
|
@@ -153,11 +146,11 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
153
146
|
body: { userInfo: realUserInfo, eventInfo: realEventInfo },
|
154
147
|
type: 'beacon'
|
155
148
|
});
|
156
|
-
}, [bffFetch, curReqInfo, enableReportEvent]);
|
149
|
+
}, [bffFetch, curReqInfo, enableReportEvent, globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview]);
|
157
150
|
const bffFbReport = useCallback((_a) => {
|
158
|
-
var _b;
|
151
|
+
var _b, _c;
|
159
152
|
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;
|
160
|
-
if (!enableReportEvent || !enabledMetaConversionApi) {
|
153
|
+
if (!enableReportEvent || !enabledMetaConversionApi || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview)) {
|
161
154
|
return;
|
162
155
|
}
|
163
156
|
const fakeUserId = storeAndLoadFeUserId();
|
@@ -168,12 +161,15 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
168
161
|
actionSource,
|
169
162
|
eventSourceUrl,
|
170
163
|
userData: {
|
171
|
-
externalId: fakeUserId
|
164
|
+
externalId: fakeUserId,
|
165
|
+
fbc: `fb.2.${new Date().getTime()}.${getCookie('_fbc')}`,
|
166
|
+
fbp: `fb.2.${new Date().getTime()}.${getCookie('_fbp')}`,
|
167
|
+
client_user_agent: (_c = window === null || window === void 0 ? void 0 : window.navigator) === null || _c === void 0 ? void 0 : _c.userAgent
|
172
168
|
}
|
173
169
|
},
|
174
170
|
type: 'beacon'
|
175
171
|
});
|
176
|
-
}, [bffFetch, enableReportEvent, enabledMetaConversionApi]);
|
172
|
+
}, [bffFetch, enableReportEvent, enabledMetaConversionApi, globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview]);
|
177
173
|
const bffMutateLike = useCallback((body) => __awaiter(void 0, void 0, void 0, function* () {
|
178
174
|
const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/recommend/like', { method: 'POST', body }));
|
179
175
|
return res === null || res === void 0 ? void 0 : res.success;
|
@@ -187,24 +183,24 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
187
183
|
return res === null || res === void 0 ? void 0 : res.success;
|
188
184
|
}), [bffFetch]);
|
189
185
|
const bffGetTagList = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
190
|
-
var
|
186
|
+
var _o, _p, _q, _r, _s;
|
191
187
|
if (!utmVal || !isShowTag)
|
192
188
|
return;
|
193
189
|
try {
|
194
|
-
const val = (
|
190
|
+
const val = (_q = (_p = (_o = utmVal === null || utmVal === void 0 ? void 0 : utmVal.split('&')) === null || _o === void 0 ? void 0 : _o.filter((val) => {
|
195
191
|
var _a, _b;
|
196
192
|
const key = val.split('=')[0];
|
197
193
|
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);
|
198
|
-
})) === null ||
|
194
|
+
})) === null || _p === void 0 ? void 0 : _p.join('&')) !== null && _q !== void 0 ? _q : '';
|
199
195
|
const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/tag/list', { method: 'GET', query: { channel: decodeURIComponent(val) } }));
|
200
|
-
setTagList((
|
196
|
+
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 : []);
|
201
197
|
}
|
202
198
|
catch (e) {
|
203
199
|
console.log('e', e);
|
204
200
|
}
|
205
201
|
}), [bffFetch, utmVal, isShowTag]);
|
206
202
|
const ctaEvent = useCallback((eventInfo, rec, product, position) => {
|
207
|
-
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;
|
203
|
+
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;
|
208
204
|
const cta = product === null || product === void 0 ? void 0 : product.bindCta;
|
209
205
|
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);
|
210
206
|
let fromKName = '';
|
@@ -217,8 +213,9 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
217
213
|
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) {
|
218
214
|
fromKName = 'imagePage';
|
219
215
|
}
|
216
|
+
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;
|
220
217
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
221
|
-
eventInfo: Object.assign(Object.assign({}, eventInfo), { ctaId: (
|
218
|
+
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 : '' })
|
222
219
|
});
|
223
220
|
}, [bffEventReport, isFromHashtag]);
|
224
221
|
const h5EnterLink = useCallback(() => {
|