pb-sxp-ui 1.10.1 → 1.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +21 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +21 -21
- package/dist/index.js.map +1 -1
- package/dist/index.min.cjs +4 -4
- package/dist/index.min.cjs.map +1 -1
- package/dist/index.min.js +4 -4
- package/dist/index.min.js.map +1 -1
- package/dist/pb-ui.js +21 -21
- package/dist/pb-ui.js.map +1 -1
- package/dist/pb-ui.min.js +4 -4
- package/dist/pb-ui.min.js.map +1 -1
- package/es/core/components/SxpPageCore/index.js +3 -2
- package/es/core/components/SxpPageRender/index.js +2 -2
- package/es/core/context/EditorContext.d.ts +0 -2
- package/es/core/context/EditorContext.js +3 -9
- package/es/core/context/SxpDataSourceProvider.d.ts +3 -0
- package/es/core/context/SxpDataSourceProvider.js +9 -4
- package/es/materials/sxp/MultiPosts/index.js +3 -4
- package/lib/core/components/SxpPageCore/index.js +3 -2
- package/lib/core/components/SxpPageRender/index.js +2 -2
- package/lib/core/context/EditorContext.d.ts +0 -2
- package/lib/core/context/EditorContext.js +3 -9
- package/lib/core/context/SxpDataSourceProvider.d.ts +3 -0
- package/lib/core/context/SxpDataSourceProvider.js +9 -4
- package/lib/materials/sxp/MultiPosts/index.js +2 -3
- package/package.json +1 -1
@@ -16,8 +16,9 @@ const SxpPageCore = ({ data, maxSize = 10, defaultSize = 10, hashTagSize = 20, l
|
|
16
16
|
return searchParams;
|
17
17
|
}, []);
|
18
18
|
const [_schema, setSchema] = useState(data === null || data === void 0 ? void 0 : data.data);
|
19
|
-
|
20
|
-
|
19
|
+
const [channel, setChannel] = useState();
|
20
|
+
return (React.createElement(EditorCore, { resolver: RESOLVER, enableDataSource: false, schema: _schema, utmVal: channel || utmVal },
|
21
|
+
React.createElement(SxpDataSourceProvider, { utmVal: utmVal, dataSources: data === null || data === void 0 ? void 0 : data.data_sources, sxpParameter: data === null || data === void 0 ? void 0 : data.sxp_parameter, maxSize: (_b = (_a = data === null || data === void 0 ? void 0 : data.sxp_parameter) === null || _a === void 0 ? void 0 : _a.personalized_recommend) !== null && _b !== void 0 ? _b : maxSize, defaultSize: (_d = (_c = data === null || data === void 0 ? void 0 : data.sxp_parameter) === null || _c === void 0 ? void 0 : _c.default_recommend) !== null && _d !== void 0 ? _d : defaultSize, hashTagSize: (_f = (_e = data === null || data === void 0 ? void 0 : data.sxp_parameter) === null || _e === void 0 ? void 0 : _e.hash_tag_size) !== null && _f !== void 0 ? _f : hashTagSize, loadingImage: loadingImage, appDomain: appDomain, enabledMetaConversionApi: enabledMetaConversionApi, utmParameter: data === null || data === void 0 ? void 0 : data.utm_parameter, data: data, dataList: dataList, onUpdateSchema: (d) => setSchema(d), onUpdateChannel: (d) => setChannel(d), render: ({ rtcList, tagList, pageData }) => {
|
21
22
|
var _a;
|
22
23
|
return (React.createElement(React.Fragment, null,
|
23
24
|
React.createElement(SxpPageRender, Object.assign({}, (_a = pageData === null || pageData === void 0 ? void 0 : pageData.data) === null || _a === void 0 ? void 0 : _a.sxpPageConf, { tagList: tagList, data: rtcList, resolver: RESOLVER })),
|
@@ -30,7 +30,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
30
30
|
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;
|
31
31
|
const mutedIcon = useIconLink('/pb_static/5beaaa5ce7f3477b99db3838619cc471.png');
|
32
32
|
const unmutedIcon = useIconLink('/pb_static/fea8668a8a894e4aa3a86bcc775e895e.png');
|
33
|
-
const { schema
|
33
|
+
const { schema } = useEditor();
|
34
34
|
const { openMultiPosts } = useEditorDataProvider();
|
35
35
|
const [activeIndex, setActiveIndex] = useState(0);
|
36
36
|
const viewImageStartTime = useRef(0);
|
@@ -41,7 +41,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
41
41
|
const [isReload, setIsReload] = useState(new Date().getTime());
|
42
42
|
const skipLinkRef = useRef(false);
|
43
43
|
const [pageNum, setPageNum] = useState(2);
|
44
|
-
const { loadVideos, bffEventReport, loading, setPopupDetailData, ctaEvent, swiperRef, waterFallData, setOpenHashtag, appDomain, openHashtag, loadingImage, isFromHashtag, popupDetailData, bffFbReport, curTime, h5EnterLink, isShowConsent, selectTag, isPreview, isEditor, cacheRtcList, setRtcList, cacheActiveIndex, rtcList, isNoMoreData } = useSxpDataSource();
|
44
|
+
const { loadVideos, bffEventReport, loading, setPopupDetailData, ctaEvent, swiperRef, waterFallData, setOpenHashtag, appDomain, openHashtag, loadingImage, isFromHashtag, popupDetailData, bffFbReport, curTime, h5EnterLink, isShowConsent, selectTag, isPreview, isEditor, cacheRtcList, setRtcList, cacheActiveIndex, rtcList, isNoMoreData, channel } = useSxpDataSource();
|
45
45
|
const { backMainFeed, productView, jumpToWeb } = useEventReport();
|
46
46
|
const isShowFingerTip = useMemo(() => {
|
47
47
|
return data.length > 0 && !loading && (getFeUserState() || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enableSwiperTip));
|
@@ -62,8 +62,6 @@ export interface IEditorContext {
|
|
62
62
|
getCurPageConf?: any;
|
63
63
|
popup: IPopupType;
|
64
64
|
setPopup: React.Dispatch<React.SetStateAction<IPopupType>>;
|
65
|
-
channel?: string | undefined;
|
66
|
-
setChannel?: React.Dispatch<React.SetStateAction<string | undefined>>;
|
67
65
|
}
|
68
66
|
export interface IEditorCoreProps {
|
69
67
|
resolver: Record<string, MaterialComponet>;
|
@@ -55,7 +55,6 @@ export const EditorContext = React.createContext({
|
|
55
55
|
});
|
56
56
|
const EditorCore = forwardRef(({ children, resolver, isSsr, schema, enableDataSource = true, utmVal }, ref) => {
|
57
57
|
const [currentNode, setCurrentNode] = useState(null);
|
58
|
-
const [channel, setChannel] = useState();
|
59
58
|
const [_schema, setSchema] = useState(schema || {
|
60
59
|
pointData: [item],
|
61
60
|
dataSource: [],
|
@@ -71,9 +70,6 @@ const EditorCore = forwardRef(({ children, resolver, isSsr, schema, enableDataSo
|
|
71
70
|
const [undoStack, setUndoStack] = useState([[item]]);
|
72
71
|
const [redoStack, setRedoStack] = useState([]);
|
73
72
|
const [popup, setPopup] = useState(popupInit);
|
74
|
-
const channelParams = useMemo(() => {
|
75
|
-
return channel || utmVal;
|
76
|
-
}, [channel, utmVal]);
|
77
73
|
typeof window !== 'undefined' &&
|
78
74
|
(window.sxpPopup = (type, aniType) => {
|
79
75
|
setPopup(Object.assign(Object.assign(Object.assign({}, popupInit), { id: type }), aniType));
|
@@ -82,10 +78,10 @@ const EditorCore = forwardRef(({ children, resolver, isSsr, schema, enableDataSo
|
|
82
78
|
(window.getJointUtmLink = (url) => {
|
83
79
|
setSlideSkipState();
|
84
80
|
if ((url === null || url === void 0 ? void 0 : url.indexOf('?')) !== -1) {
|
85
|
-
return url + (
|
81
|
+
return url + (utmVal ? '&' + utmVal : '');
|
86
82
|
}
|
87
83
|
else {
|
88
|
-
return url + (
|
84
|
+
return url + (utmVal ? '?' + utmVal : '');
|
89
85
|
}
|
90
86
|
});
|
91
87
|
useEffect(() => {
|
@@ -146,9 +142,7 @@ const EditorCore = forwardRef(({ children, resolver, isSsr, schema, enableDataSo
|
|
146
142
|
setUndoStack,
|
147
143
|
getCurPageConf,
|
148
144
|
popup,
|
149
|
-
setPopup
|
150
|
-
channel,
|
151
|
-
setChannel
|
145
|
+
setPopup
|
152
146
|
} },
|
153
147
|
React.createElement(DataSourceProvider, { isSsr: isSsr, enable: enableDataSource }, children)));
|
154
148
|
});
|
@@ -80,6 +80,8 @@ export interface ISxpDataSourceContext {
|
|
80
80
|
checkCommodityIndexRef?: any;
|
81
81
|
isEditor?: boolean;
|
82
82
|
isNoMoreData?: boolean;
|
83
|
+
updateChannel?: (d: string) => void;
|
84
|
+
channel?: string;
|
83
85
|
}
|
84
86
|
export declare const SxpDataSourceContext: React.Context<ISxpDataSourceContext>;
|
85
87
|
export interface SxpDataSourceProviderProps {
|
@@ -122,6 +124,7 @@ export interface SxpDataSourceProviderProps {
|
|
122
124
|
data?: PageData;
|
123
125
|
dataList?: PageData[];
|
124
126
|
onUpdateSchema?: (d: PageData['data']) => void;
|
127
|
+
onUpdateChannel?: (d: string) => void;
|
125
128
|
}
|
126
129
|
export declare const DEFAULT_TAG = "FOR U";
|
127
130
|
declare const _default: React.NamedExoticComponent<SxpDataSourceProviderProps>;
|
@@ -8,7 +8,6 @@ import SXP_EVENT_BUS, { SXP_EVENT_TYPE } from '../utils/event';
|
|
8
8
|
import Consent from '../components/Consent';
|
9
9
|
import { getBrowserInfo, getCookie, getDevice, getSystem } from '../utils/tool';
|
10
10
|
import { cloneDeep } from 'lodash';
|
11
|
-
import { useEditor } from '../hooks/useEditor';
|
12
11
|
export const SxpDataSourceContext = createContext({
|
13
12
|
rtcList: [],
|
14
13
|
tagList: []
|
@@ -18,9 +17,8 @@ var DataSourceType;
|
|
18
17
|
DataSourceType[DataSourceType["BFF"] = 5] = "BFF";
|
19
18
|
})(DataSourceType || (DataSourceType = {}));
|
20
19
|
export const 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, isOpenConsent = false, isEditor = false, utmParameter, channelQueryList, data, dataList, onUpdateSchema }) => {
|
20
|
+
const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent = true, maxSize, defaultSize, isPreview = false, sxpParameter, appDomain, hashTagSize, loadingImage, isOpenHashTag = false, enabledMetaConversionApi = false, consentHeight, consentWidth, isOpenConsent = false, isEditor = false, utmParameter, channelQueryList, data, dataList, onUpdateSchema, onUpdateChannel }) => {
|
22
21
|
var _a, _b, _c, _d, _e;
|
23
|
-
const { channel } = useEditor();
|
24
22
|
const [rtcList, setRtcList] = useState([]);
|
25
23
|
const [tagList, setTagList] = useState([]);
|
26
24
|
const [loading, setLoading] = useState(false);
|
@@ -45,11 +43,16 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
45
43
|
const [pageData, setPageData] = useState(data);
|
46
44
|
const [showConsent, setShowConsent] = useState(false);
|
47
45
|
const [layoutVariantId, setLayoutVariantId] = useState();
|
46
|
+
const [channel, setChannel] = useState();
|
48
47
|
const isShowConsent = useMemo(() => {
|
49
48
|
var _a, _b, _c, _d;
|
50
49
|
return (((((_d = (_c = (_b = (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.consent) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.item) === null || _c === void 0 ? void 0 : _c.props) === null || _d === void 0 ? void 0 : _d.privacy_necessity) && !isAgreePolicy && !isEditor) || isOpenConsent) &&
|
51
50
|
showConsent);
|
52
51
|
}, [isAgreePolicy, globalConfig, isOpenConsent, isEditor, showConsent]);
|
52
|
+
const updateChannel = useCallback((d) => {
|
53
|
+
onUpdateChannel === null || onUpdateChannel === void 0 ? void 0 : onUpdateChannel(d);
|
54
|
+
setChannel(d);
|
55
|
+
}, []);
|
53
56
|
const getFilterRecList = useCallback((data) => {
|
54
57
|
var _a;
|
55
58
|
const recList = data === null || data === void 0 ? void 0 : data.recList;
|
@@ -478,7 +481,9 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
478
481
|
popupCurTimeRef,
|
479
482
|
checkCommodityIndexRef,
|
480
483
|
isEditor,
|
481
|
-
isNoMoreData
|
484
|
+
isNoMoreData,
|
485
|
+
updateChannel,
|
486
|
+
channel
|
482
487
|
} }, isShowConsent ? (React.createElement(Consent, Object.assign({}, (_e = (_d = (_c = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.consent) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.item) === null || _e === void 0 ? void 0 : _e.props))) : (render({
|
483
488
|
rtcList,
|
484
489
|
mutateLike: bffMutateLike,
|
@@ -2,14 +2,13 @@ import { __rest } from "tslib";
|
|
2
2
|
import { getBgStyle } from '../../../core/utils/materials';
|
3
3
|
import React, { memo, useCallback, useEffect, useRef } from 'react';
|
4
4
|
import './index.less';
|
5
|
-
import {
|
5
|
+
import { useSxpDataSource } from '../../../core/hooks';
|
6
6
|
import SXP_EVENT_BUS, { SXP_EVENT_TYPE } from '../../../core/utils/event';
|
7
7
|
import { useSwiperSlide } from 'swiper/react';
|
8
8
|
const MultiPosts = (_a) => {
|
9
9
|
var _b, _c;
|
10
10
|
var { bgImgUrl, style, recData } = _a, props = __rest(_a, ["bgImgUrl", "style", "recData"]);
|
11
|
-
const {
|
12
|
-
const { bffEventReport, curTime } = useSxpDataSource();
|
11
|
+
const { bffEventReport, curTime, updateChannel } = useSxpDataSource();
|
13
12
|
const { isActive } = useSwiperSlide() || {};
|
14
13
|
const initRef = useRef(false);
|
15
14
|
const viewTime = useRef();
|
@@ -39,7 +38,7 @@ const MultiPosts = (_a) => {
|
|
39
38
|
});
|
40
39
|
if ((v === null || v === void 0 ? void 0 : v.linkType) === 'recommendFlow') {
|
41
40
|
endMultiPost('multipostClick');
|
42
|
-
|
41
|
+
updateChannel === null || updateChannel === void 0 ? void 0 : updateChannel(value);
|
43
42
|
curTime.current = new Date();
|
44
43
|
}
|
45
44
|
else {
|
@@ -19,8 +19,9 @@ const SxpPageCore = ({ data, maxSize = 10, defaultSize = 10, hashTagSize = 20, l
|
|
19
19
|
return searchParams;
|
20
20
|
}, []);
|
21
21
|
const [_schema, setSchema] = (0, react_1.useState)(data === null || data === void 0 ? void 0 : data.data);
|
22
|
-
|
23
|
-
|
22
|
+
const [channel, setChannel] = (0, react_1.useState)();
|
23
|
+
return (react_1.default.createElement(core_1.EditorCore, { resolver: RESOLVER, enableDataSource: false, schema: _schema, utmVal: channel || utmVal },
|
24
|
+
react_1.default.createElement(SxpDataSourceProvider_1.default, { utmVal: utmVal, dataSources: data === null || data === void 0 ? void 0 : data.data_sources, sxpParameter: data === null || data === void 0 ? void 0 : data.sxp_parameter, maxSize: (_b = (_a = data === null || data === void 0 ? void 0 : data.sxp_parameter) === null || _a === void 0 ? void 0 : _a.personalized_recommend) !== null && _b !== void 0 ? _b : maxSize, defaultSize: (_d = (_c = data === null || data === void 0 ? void 0 : data.sxp_parameter) === null || _c === void 0 ? void 0 : _c.default_recommend) !== null && _d !== void 0 ? _d : defaultSize, hashTagSize: (_f = (_e = data === null || data === void 0 ? void 0 : data.sxp_parameter) === null || _e === void 0 ? void 0 : _e.hash_tag_size) !== null && _f !== void 0 ? _f : hashTagSize, loadingImage: loadingImage, appDomain: appDomain, enabledMetaConversionApi: enabledMetaConversionApi, utmParameter: data === null || data === void 0 ? void 0 : data.utm_parameter, data: data, dataList: dataList, onUpdateSchema: (d) => setSchema(d), onUpdateChannel: (d) => setChannel(d), render: ({ rtcList, tagList, pageData }) => {
|
24
25
|
var _a;
|
25
26
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
26
27
|
react_1.default.createElement(SxpPageRender_1.default, Object.assign({}, (_a = pageData === null || pageData === void 0 ? void 0 : pageData.data) === null || _a === void 0 ? void 0 : _a.sxpPageConf, { tagList: tagList, data: rtcList, resolver: RESOLVER })),
|
@@ -33,7 +33,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
33
33
|
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;
|
34
34
|
const mutedIcon = (0, useIconLink_1.useIconLink)('/pb_static/5beaaa5ce7f3477b99db3838619cc471.png');
|
35
35
|
const unmutedIcon = (0, useIconLink_1.useIconLink)('/pb_static/fea8668a8a894e4aa3a86bcc775e895e.png');
|
36
|
-
const { schema
|
36
|
+
const { schema } = (0, hooks_1.useEditor)();
|
37
37
|
const { openMultiPosts } = (0, EditorDataProvider_1.useEditorDataProvider)();
|
38
38
|
const [activeIndex, setActiveIndex] = (0, react_1.useState)(0);
|
39
39
|
const viewImageStartTime = (0, react_1.useRef)(0);
|
@@ -44,7 +44,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
44
44
|
const [isReload, setIsReload] = (0, react_1.useState)(new Date().getTime());
|
45
45
|
const skipLinkRef = (0, react_1.useRef)(false);
|
46
46
|
const [pageNum, setPageNum] = (0, react_1.useState)(2);
|
47
|
-
const { loadVideos, bffEventReport, loading, setPopupDetailData, ctaEvent, swiperRef, waterFallData, setOpenHashtag, appDomain, openHashtag, loadingImage, isFromHashtag, popupDetailData, bffFbReport, curTime, h5EnterLink, isShowConsent, selectTag, isPreview, isEditor, cacheRtcList, setRtcList, cacheActiveIndex, rtcList, isNoMoreData } = (0, hooks_1.useSxpDataSource)();
|
47
|
+
const { loadVideos, bffEventReport, loading, setPopupDetailData, ctaEvent, swiperRef, waterFallData, setOpenHashtag, appDomain, openHashtag, loadingImage, isFromHashtag, popupDetailData, bffFbReport, curTime, h5EnterLink, isShowConsent, selectTag, isPreview, isEditor, cacheRtcList, setRtcList, cacheActiveIndex, rtcList, isNoMoreData, channel } = (0, hooks_1.useSxpDataSource)();
|
48
48
|
const { backMainFeed, productView, jumpToWeb } = (0, useEventReport_1.useEventReport)();
|
49
49
|
const isShowFingerTip = (0, react_1.useMemo)(() => {
|
50
50
|
return data.length > 0 && !loading && ((0, localStore_1.getFeUserState)() || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enableSwiperTip));
|
@@ -62,8 +62,6 @@ export interface IEditorContext {
|
|
62
62
|
getCurPageConf?: any;
|
63
63
|
popup: IPopupType;
|
64
64
|
setPopup: React.Dispatch<React.SetStateAction<IPopupType>>;
|
65
|
-
channel?: string | undefined;
|
66
|
-
setChannel?: React.Dispatch<React.SetStateAction<string | undefined>>;
|
67
65
|
}
|
68
66
|
export interface IEditorCoreProps {
|
69
67
|
resolver: Record<string, MaterialComponet>;
|
@@ -59,7 +59,6 @@ exports.EditorContext = react_1.default.createContext({
|
|
59
59
|
});
|
60
60
|
const EditorCore = (0, react_1.forwardRef)(({ children, resolver, isSsr, schema, enableDataSource = true, utmVal }, ref) => {
|
61
61
|
const [currentNode, setCurrentNode] = (0, react_1.useState)(null);
|
62
|
-
const [channel, setChannel] = (0, react_1.useState)();
|
63
62
|
const [_schema, setSchema] = (0, react_1.useState)(schema || {
|
64
63
|
pointData: [item],
|
65
64
|
dataSource: [],
|
@@ -75,9 +74,6 @@ const EditorCore = (0, react_1.forwardRef)(({ children, resolver, isSsr, schema,
|
|
75
74
|
const [undoStack, setUndoStack] = (0, react_1.useState)([[item]]);
|
76
75
|
const [redoStack, setRedoStack] = (0, react_1.useState)([]);
|
77
76
|
const [popup, setPopup] = (0, react_1.useState)(popupInit);
|
78
|
-
const channelParams = (0, react_1.useMemo)(() => {
|
79
|
-
return channel || utmVal;
|
80
|
-
}, [channel, utmVal]);
|
81
77
|
typeof window !== 'undefined' &&
|
82
78
|
(window.sxpPopup = (type, aniType) => {
|
83
79
|
setPopup(Object.assign(Object.assign(Object.assign({}, popupInit), { id: type }), aniType));
|
@@ -86,10 +82,10 @@ const EditorCore = (0, react_1.forwardRef)(({ children, resolver, isSsr, schema,
|
|
86
82
|
(window.getJointUtmLink = (url) => {
|
87
83
|
(0, localStore_1.setSlideSkipState)();
|
88
84
|
if ((url === null || url === void 0 ? void 0 : url.indexOf('?')) !== -1) {
|
89
|
-
return url + (
|
85
|
+
return url + (utmVal ? '&' + utmVal : '');
|
90
86
|
}
|
91
87
|
else {
|
92
|
-
return url + (
|
88
|
+
return url + (utmVal ? '?' + utmVal : '');
|
93
89
|
}
|
94
90
|
});
|
95
91
|
(0, react_1.useEffect)(() => {
|
@@ -150,9 +146,7 @@ const EditorCore = (0, react_1.forwardRef)(({ children, resolver, isSsr, schema,
|
|
150
146
|
setUndoStack,
|
151
147
|
getCurPageConf,
|
152
148
|
popup,
|
153
|
-
setPopup
|
154
|
-
channel,
|
155
|
-
setChannel
|
149
|
+
setPopup
|
156
150
|
} },
|
157
151
|
react_1.default.createElement(DataSourceProvider_1.default, { isSsr: isSsr, enable: enableDataSource }, children)));
|
158
152
|
});
|
@@ -80,6 +80,8 @@ export interface ISxpDataSourceContext {
|
|
80
80
|
checkCommodityIndexRef?: any;
|
81
81
|
isEditor?: boolean;
|
82
82
|
isNoMoreData?: boolean;
|
83
|
+
updateChannel?: (d: string) => void;
|
84
|
+
channel?: string;
|
83
85
|
}
|
84
86
|
export declare const SxpDataSourceContext: React.Context<ISxpDataSourceContext>;
|
85
87
|
export interface SxpDataSourceProviderProps {
|
@@ -122,6 +124,7 @@ export interface SxpDataSourceProviderProps {
|
|
122
124
|
data?: PageData;
|
123
125
|
dataList?: PageData[];
|
124
126
|
onUpdateSchema?: (d: PageData['data']) => void;
|
127
|
+
onUpdateChannel?: (d: string) => void;
|
125
128
|
}
|
126
129
|
export declare const DEFAULT_TAG = "FOR U";
|
127
130
|
declare const _default: React.NamedExoticComponent<SxpDataSourceProviderProps>;
|
@@ -11,7 +11,6 @@ const event_1 = tslib_1.__importStar(require("../utils/event"));
|
|
11
11
|
const Consent_1 = tslib_1.__importDefault(require("../components/Consent"));
|
12
12
|
const tool_1 = require("../utils/tool");
|
13
13
|
const lodash_1 = require("lodash");
|
14
|
-
const useEditor_1 = require("../hooks/useEditor");
|
15
14
|
exports.SxpDataSourceContext = (0, react_1.createContext)({
|
16
15
|
rtcList: [],
|
17
16
|
tagList: []
|
@@ -21,9 +20,8 @@ var DataSourceType;
|
|
21
20
|
DataSourceType[DataSourceType["BFF"] = 5] = "BFF";
|
22
21
|
})(DataSourceType || (DataSourceType = {}));
|
23
22
|
exports.DEFAULT_TAG = 'FOR U';
|
24
|
-
const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent = true, maxSize, defaultSize, isPreview = false, sxpParameter, appDomain, hashTagSize, loadingImage, isOpenHashTag = false, enabledMetaConversionApi = false, consentHeight, consentWidth, isOpenConsent = false, isEditor = false, utmParameter, channelQueryList, data, dataList, onUpdateSchema }) => {
|
23
|
+
const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent = true, maxSize, defaultSize, isPreview = false, sxpParameter, appDomain, hashTagSize, loadingImage, isOpenHashTag = false, enabledMetaConversionApi = false, consentHeight, consentWidth, isOpenConsent = false, isEditor = false, utmParameter, channelQueryList, data, dataList, onUpdateSchema, onUpdateChannel }) => {
|
25
24
|
var _a, _b, _c, _d, _e;
|
26
|
-
const { channel } = (0, useEditor_1.useEditor)();
|
27
25
|
const [rtcList, setRtcList] = (0, react_1.useState)([]);
|
28
26
|
const [tagList, setTagList] = (0, react_1.useState)([]);
|
29
27
|
const [loading, setLoading] = (0, react_1.useState)(false);
|
@@ -48,11 +46,16 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
48
46
|
const [pageData, setPageData] = (0, react_1.useState)(data);
|
49
47
|
const [showConsent, setShowConsent] = (0, react_1.useState)(false);
|
50
48
|
const [layoutVariantId, setLayoutVariantId] = (0, react_1.useState)();
|
49
|
+
const [channel, setChannel] = (0, react_1.useState)();
|
51
50
|
const isShowConsent = (0, react_1.useMemo)(() => {
|
52
51
|
var _a, _b, _c, _d;
|
53
52
|
return (((((_d = (_c = (_b = (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.consent) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.item) === null || _c === void 0 ? void 0 : _c.props) === null || _d === void 0 ? void 0 : _d.privacy_necessity) && !isAgreePolicy && !isEditor) || isOpenConsent) &&
|
54
53
|
showConsent);
|
55
54
|
}, [isAgreePolicy, globalConfig, isOpenConsent, isEditor, showConsent]);
|
55
|
+
const updateChannel = (0, react_1.useCallback)((d) => {
|
56
|
+
onUpdateChannel === null || onUpdateChannel === void 0 ? void 0 : onUpdateChannel(d);
|
57
|
+
setChannel(d);
|
58
|
+
}, []);
|
56
59
|
const getFilterRecList = (0, react_1.useCallback)((data) => {
|
57
60
|
var _a;
|
58
61
|
const recList = data === null || data === void 0 ? void 0 : data.recList;
|
@@ -481,7 +484,9 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
481
484
|
popupCurTimeRef,
|
482
485
|
checkCommodityIndexRef,
|
483
486
|
isEditor,
|
484
|
-
isNoMoreData
|
487
|
+
isNoMoreData,
|
488
|
+
updateChannel,
|
489
|
+
channel
|
485
490
|
} }, isShowConsent ? (react_1.default.createElement(Consent_1.default, Object.assign({}, (_e = (_d = (_c = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.consent) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.item) === null || _e === void 0 ? void 0 : _e.props))) : (render({
|
486
491
|
rtcList,
|
487
492
|
mutateLike: bffMutateLike,
|
@@ -10,8 +10,7 @@ const react_2 = require("swiper/react");
|
|
10
10
|
const MultiPosts = (_a) => {
|
11
11
|
var _b, _c;
|
12
12
|
var { bgImgUrl, style, recData } = _a, props = tslib_1.__rest(_a, ["bgImgUrl", "style", "recData"]);
|
13
|
-
const {
|
14
|
-
const { bffEventReport, curTime } = (0, hooks_1.useSxpDataSource)();
|
13
|
+
const { bffEventReport, curTime, updateChannel } = (0, hooks_1.useSxpDataSource)();
|
15
14
|
const { isActive } = (0, react_2.useSwiperSlide)() || {};
|
16
15
|
const initRef = (0, react_1.useRef)(false);
|
17
16
|
const viewTime = (0, react_1.useRef)();
|
@@ -41,7 +40,7 @@ const MultiPosts = (_a) => {
|
|
41
40
|
});
|
42
41
|
if ((v === null || v === void 0 ? void 0 : v.linkType) === 'recommendFlow') {
|
43
42
|
endMultiPost('multipostClick');
|
44
|
-
|
43
|
+
updateChannel === null || updateChannel === void 0 ? void 0 : updateChannel(value);
|
45
44
|
curTime.current = new Date();
|
46
45
|
}
|
47
46
|
else {
|