pb-sxp-ui 1.9.7 → 1.10.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 +525 -167
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +35 -0
- package/dist/index.js +525 -167
- package/dist/index.js.map +1 -1
- package/dist/index.min.cjs +7 -3
- package/dist/index.min.cjs.map +1 -1
- package/dist/index.min.js +7 -3
- package/dist/index.min.js.map +1 -1
- package/dist/pb-ui.js +525 -167
- package/dist/pb-ui.js.map +1 -1
- package/dist/pb-ui.min.js +7 -3
- package/dist/pb-ui.min.js.map +1 -1
- package/es/core/Pagebuilder/index.js +3 -4
- package/es/core/components/SxpPageCore/index.d.ts +1 -1
- package/es/core/components/SxpPageCore/index.js +7 -6
- package/es/core/components/SxpPageRender/NavBack.d.ts +9 -0
- package/es/core/components/SxpPageRender/NavBack.js +16 -0
- package/es/core/components/SxpPageRender/PictureGroup/index.js +3 -1
- package/es/core/components/SxpPageRender/index.d.ts +2 -0
- package/es/core/components/SxpPageRender/index.js +30 -22
- package/es/core/components/SxpPageRender/typing.d.ts +1 -0
- package/es/core/context/EditorContext.d.ts +2 -0
- package/es/core/context/EditorContext.js +9 -3
- package/es/core/context/EditorDataProvider.d.ts +2 -0
- package/es/core/context/EditorDataProvider.js +4 -1
- package/es/core/context/SxpDataSourceProvider.d.ts +4 -2
- package/es/core/context/SxpDataSourceProvider.js +83 -52
- package/es/core/utils/materials.d.ts +1 -1
- package/es/materials/sxp/MultiPosts/index.d.ts +26 -0
- package/es/materials/sxp/MultiPosts/index.js +98 -0
- package/es/materials/sxp/MultiPosts/interactionRender.d.ts +9 -0
- package/es/materials/sxp/MultiPosts/interactionRender.js +42 -0
- package/es/materials/sxp/MultiPosts/material.d.ts +2 -0
- package/es/materials/sxp/MultiPosts/material.js +22 -0
- package/es/materials/sxp/MultiPosts/settingRender.d.ts +73 -0
- package/es/materials/sxp/MultiPosts/settingRender.js +115 -0
- package/es/materials/sxp/index.d.ts +1 -0
- package/es/materials/sxp/index.js +1 -0
- package/es/materials/sxp/template/components/EventProvider.js +5 -5
- package/lib/core/Pagebuilder/index.js +3 -4
- package/lib/core/components/SxpPageCore/index.d.ts +1 -1
- package/lib/core/components/SxpPageCore/index.js +6 -5
- package/lib/core/components/SxpPageRender/NavBack.d.ts +9 -0
- package/lib/core/components/SxpPageRender/NavBack.js +19 -0
- package/lib/core/components/SxpPageRender/PictureGroup/index.js +3 -1
- package/lib/core/components/SxpPageRender/index.d.ts +2 -0
- package/lib/core/components/SxpPageRender/index.js +30 -22
- package/lib/core/components/SxpPageRender/typing.d.ts +1 -0
- package/lib/core/context/EditorContext.d.ts +2 -0
- package/lib/core/context/EditorContext.js +9 -3
- package/lib/core/context/EditorDataProvider.d.ts +2 -0
- package/lib/core/context/EditorDataProvider.js +4 -1
- package/lib/core/context/SxpDataSourceProvider.d.ts +4 -2
- package/lib/core/context/SxpDataSourceProvider.js +83 -52
- package/lib/core/utils/materials.d.ts +1 -1
- package/lib/materials/sxp/MultiPosts/index.d.ts +26 -0
- package/lib/materials/sxp/MultiPosts/index.js +100 -0
- package/lib/materials/sxp/MultiPosts/interactionRender.d.ts +9 -0
- package/lib/materials/sxp/MultiPosts/interactionRender.js +44 -0
- package/lib/materials/sxp/MultiPosts/material.d.ts +2 -0
- package/lib/materials/sxp/MultiPosts/material.js +26 -0
- package/lib/materials/sxp/MultiPosts/settingRender.d.ts +73 -0
- package/lib/materials/sxp/MultiPosts/settingRender.js +117 -0
- package/lib/materials/sxp/index.d.ts +1 -0
- package/lib/materials/sxp/index.js +1 -0
- package/lib/materials/sxp/template/components/EventProvider.js +5 -5
- package/package.json +1 -1
@@ -48,7 +48,7 @@ const Pagebuilder = {
|
|
48
48
|
const tenantId = builder.getTenantId();
|
49
49
|
const appId = builder.getAppId();
|
50
50
|
const apiUrl = builder.getApiUrl();
|
51
|
-
return fetch(`${apiUrl}/storefront/v1/page?id=` + id, {
|
51
|
+
return fetch(`${apiUrl}/storefront/v1/page/build?id=` + id, {
|
52
52
|
method: 'get',
|
53
53
|
headers: {
|
54
54
|
'x-tenant-id': tenantId || '',
|
@@ -60,9 +60,8 @@ const Pagebuilder = {
|
|
60
60
|
if (!result.success) {
|
61
61
|
return undefined;
|
62
62
|
}
|
63
|
-
const
|
64
|
-
|
65
|
-
return result.data;
|
63
|
+
const dataList = (_a = result === null || result === void 0 ? void 0 : result.data) === null || _a === void 0 ? void 0 : _a.map((item) => (Object.assign(Object.assign({}, item), { data: unzip(item === null || item === void 0 ? void 0 : item.data) })));
|
64
|
+
return dataList;
|
66
65
|
}));
|
67
66
|
}),
|
68
67
|
getSxpRecommendVideoData: (dataId) => __awaiter(void 0, void 0, void 0, function* () {
|
@@ -7,8 +7,8 @@ export interface ISxpPageCoreProps {
|
|
7
7
|
hashTagSize?: number;
|
8
8
|
loadingImage?: string;
|
9
9
|
appDomain?: string;
|
10
|
-
licenseUrl?: String;
|
11
10
|
enabledMetaConversionApi?: boolean;
|
11
|
+
dataList?: PageData[];
|
12
12
|
}
|
13
13
|
declare const _default: React.NamedExoticComponent<ISxpPageCoreProps>;
|
14
14
|
export default _default;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import React, { memo, useMemo } from 'react';
|
1
|
+
import React, { memo, useMemo, useState } from 'react';
|
2
2
|
import SxpPageRender from '../SxpPageRender';
|
3
3
|
import Popup from '../SxpPageRender/Popup';
|
4
4
|
import * as _materials_ from '../../../materials';
|
@@ -8,18 +8,19 @@ const RESOLVER = {};
|
|
8
8
|
Object.values(_materials_).forEach((v) => {
|
9
9
|
RESOLVER[v.extend.type] = v;
|
10
10
|
});
|
11
|
-
const SxpPageCore = ({ data, maxSize = 10, defaultSize = 10, hashTagSize = 20, loadingImage, appDomain,
|
12
|
-
var _a, _b, _c, _d, _e, _f
|
11
|
+
const SxpPageCore = ({ data, maxSize = 10, defaultSize = 10, hashTagSize = 20, loadingImage, appDomain, enabledMetaConversionApi, dataList }) => {
|
12
|
+
var _a, _b, _c, _d, _e, _f;
|
13
13
|
const utmVal = useMemo(() => {
|
14
14
|
var _a;
|
15
15
|
const searchParams = (location === null || location === void 0 ? void 0 : location.search) ? (_a = location === null || location === void 0 ? void 0 : location.search) === null || _a === void 0 ? void 0 : _a.replace('?', '') : '';
|
16
16
|
return searchParams;
|
17
17
|
}, []);
|
18
|
-
|
19
|
-
|
18
|
+
const [_schema, setSchema] = useState(data === null || data === void 0 ? void 0 : data.data);
|
19
|
+
return (React.createElement(EditorCore, { resolver: RESOLVER, enableDataSource: false, schema: _schema, utmVal: utmVal },
|
20
|
+
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), render: ({ rtcList, tagList, pageData }) => {
|
20
21
|
var _a;
|
21
22
|
return (React.createElement(React.Fragment, null,
|
22
|
-
React.createElement(SxpPageRender, Object.assign({}, (_a =
|
23
|
+
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 })),
|
23
24
|
React.createElement(Popup, null)));
|
24
25
|
} })));
|
25
26
|
};
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import React, { memo } from 'react';
|
2
|
+
import left from './left.png';
|
3
|
+
const NavBack = ({ data, minusHeight, tagHeight, onClick }) => {
|
4
|
+
var _a, _b, _c, _d, _e;
|
5
|
+
return (React.createElement("button", { style: {
|
6
|
+
position: 'absolute',
|
7
|
+
[(_a = data === null || data === void 0 ? void 0 : data.xPosit) !== null && _a !== void 0 ? _a : 'left']: (_c = (_b = data === null || data === void 0 ? void 0 : data.backButton) === null || _b === void 0 ? void 0 : _b.x) !== null && _c !== void 0 ? _c : 0,
|
8
|
+
[(_d = data === null || data === void 0 ? void 0 : data.yPosit) !== null && _d !== void 0 ? _d : 'top']: ((data === null || data === void 0 ? void 0 : data.yPosit) == 'top' ? minusHeight + tagHeight : 0) + ((_e = data === null || data === void 0 ? void 0 : data.y) !== null && _e !== void 0 ? _e : 0),
|
9
|
+
zIndex: 8,
|
10
|
+
border: 'none',
|
11
|
+
padding: 0,
|
12
|
+
background: 'transparent'
|
13
|
+
}, role: 'button', "aria-label": 'back button', onClick: onClick },
|
14
|
+
React.createElement("img", { src: (data === null || data === void 0 ? void 0 : data.icon) || left, alt: 'back button', width: 100, style: { objectFit: 'cover' } })));
|
15
|
+
};
|
16
|
+
export default memo(NavBack);
|
@@ -39,6 +39,8 @@ const PictureGroup = ({ imgUrls, width, height, rec, index, onViewImageEndEvent,
|
|
39
39
|
}
|
40
40
|
}), [isLoad]);
|
41
41
|
useEffect(() => {
|
42
|
+
if (!isActive)
|
43
|
+
return;
|
42
44
|
const onShow = () => onViewImageStartEvent(index, imgInfo);
|
43
45
|
const onHide = () => onViewImageEndEvent(rec);
|
44
46
|
SXP_EVENT_BUS.on(SXP_EVENT_TYPE.PAGE_DID_SHOW, onShow);
|
@@ -47,7 +49,7 @@ const PictureGroup = ({ imgUrls, width, height, rec, index, onViewImageEndEvent,
|
|
47
49
|
SXP_EVENT_BUS.off(SXP_EVENT_TYPE.PAGE_DID_SHOW, onShow);
|
48
50
|
SXP_EVENT_BUS.off(SXP_EVENT_TYPE.PAGE_DID_HIDE, onHide);
|
49
51
|
};
|
50
|
-
}, [imgInfo]);
|
52
|
+
}, [isActive, imgInfo]);
|
51
53
|
const handleMouseEnter = useCallback(() => {
|
52
54
|
if (swiperRef.current && swiperRef.current.swiper && isAlly) {
|
53
55
|
swiperRef.current.swiper.autoplay.stop();
|
@@ -23,11 +23,15 @@ import Tagbar from './Tagbar';
|
|
23
23
|
import { getFeUserState, getSlideSkipState } from '../../../core/utils/localStore';
|
24
24
|
import { isEqual } from 'lodash';
|
25
25
|
import ConsentPopup from './ConsentPopup';
|
26
|
+
import MultiPosts from '../../../materials/sxp/MultiPosts';
|
27
|
+
import { useEditorDataProvider } from '../../../core/context/EditorDataProvider';
|
28
|
+
import NavBack from './NavBack';
|
26
29
|
const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.innerHeight, containerWidth = window.innerWidth, tempMap, resolver, data = [], ctaType, tipText, nudge, _schema, hashTagStyle, hashTagRightMargin, tagList = [], licenseUrl }) => {
|
27
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
|
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;
|
28
31
|
const mutedIcon = useIconLink('/pb_static/5beaaa5ce7f3477b99db3838619cc471.png');
|
29
32
|
const unmutedIcon = useIconLink('/pb_static/fea8668a8a894e4aa3a86bcc775e895e.png');
|
30
|
-
const { schema } = useEditor();
|
33
|
+
const { schema, channel } = useEditor();
|
34
|
+
const { openMultiPosts } = useEditorDataProvider();
|
31
35
|
const [activeIndex, setActiveIndex] = useState(0);
|
32
36
|
const viewImageStartTime = useRef(0);
|
33
37
|
const [isMuted, setIsMuted] = useState(true);
|
@@ -209,15 +213,18 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
209
213
|
return null;
|
210
214
|
}, [globalConfig, activeIndex, visList]);
|
211
215
|
const renderContent = useCallback((rec, index) => {
|
212
|
-
var _a, _b, _c, _d;
|
213
|
-
if (
|
216
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
217
|
+
if (rec === 'organic menu') {
|
218
|
+
return (React.createElement(MultiPosts, Object.assign({ recData: data === null || data === void 0 ? void 0 : data[1] }, (_c = (_b = (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.multiPosts) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.item) === null || _c === void 0 ? void 0 : _c.props, (_f = (_e = (_d = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.multiPosts) === null || _d === void 0 ? void 0 : _d[0]) === null || _e === void 0 ? void 0 : _e.item) === null || _f === void 0 ? void 0 : _f.event)));
|
219
|
+
}
|
220
|
+
if ((_g = rec === null || rec === void 0 ? void 0 : rec.video) === null || _g === void 0 ? void 0 : _g.url) {
|
214
221
|
return (React.createElement(VideoWidget, { key: isReload, rec: rec, index: index, muted: isMuted, data: data, height: height, activeIndex: activeIndex, videoPostConfig: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.videoPost, videoPlayIcon: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.videoPlayIcon }));
|
215
222
|
}
|
216
|
-
if ((
|
223
|
+
if ((_h = rec === null || rec === void 0 ? void 0 : rec.video) === null || _h === void 0 ? void 0 : _h.imgUrls) {
|
217
224
|
return (React.createElement(PictureGroup, { key: rec === null || rec === void 0 ? void 0 : rec.video.itemId, imgUrls: rec === null || rec === void 0 ? void 0 : rec.video.imgUrls, width: containerWidth, height: height, rec: rec, index: index, onViewImageEndEvent: handleViewImageStartEnd, onViewImageStartEvent: handleViewImageStartEvent, imgUrlsPostConfig: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.imgUrlsPost }));
|
218
225
|
}
|
219
|
-
if (rec.product && Array.isArray(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.productPost) && ((
|
220
|
-
return (
|
226
|
+
if (rec.product && Array.isArray(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.productPost) && ((_j = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.productPost) === null || _j === void 0 ? void 0 : _j.length) > 0) {
|
227
|
+
return (_k = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.productPost) === null || _k === void 0 ? void 0 : _k.map((value, idx) => {
|
221
228
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
222
229
|
const t = resolver[(_a = value === null || value === void 0 ? void 0 : value.item) === null || _a === void 0 ? void 0 : _a.type];
|
223
230
|
const Component = withBindDataSource(t);
|
@@ -373,7 +380,6 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
373
380
|
const item = data[swiper.previousIndex];
|
374
381
|
if (!item)
|
375
382
|
return;
|
376
|
-
let fromKName = '';
|
377
383
|
let contentFormat = null;
|
378
384
|
if ((_a = item === null || item === void 0 ? void 0 : item.video) === null || _a === void 0 ? void 0 : _a.url) {
|
379
385
|
contentFormat = 'video';
|
@@ -522,18 +528,19 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
522
528
|
React.createElement(Tagbar, { tagList: tagList, setActiveIndex: setActiveIndex, style: {
|
523
529
|
top: minusHeight
|
524
530
|
} }),
|
525
|
-
((_f = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.backButton) === null || _f === void 0 ? void 0 : _f.enable) && (React.createElement(
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
531
|
+
((_f = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.backButton) === null || _f === void 0 ? void 0 : _f.enable) && !channel && (React.createElement(NavBack, { data: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.backButton, minusHeight: minusHeight, tagHeight: tagHeight, onClick: () => history === null || history === void 0 ? void 0 : history.back() })),
|
532
|
+
((_l = (_k = (_j = (_h = (_g = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.multiPosts) === null || _g === void 0 ? void 0 : _g[0]) === null || _h === void 0 ? void 0 : _h.item) === null || _j === void 0 ? void 0 : _j.props) === null || _k === void 0 ? void 0 : _k.backButton) === null || _l === void 0 ? void 0 : _l.enable) && channel && (React.createElement(NavBack, { data: (_q = (_p = (_o = (_m = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.multiPosts) === null || _m === void 0 ? void 0 : _m[0]) === null || _o === void 0 ? void 0 : _o.item) === null || _p === void 0 ? void 0 : _p.props) === null || _q === void 0 ? void 0 : _q.backButton, minusHeight: minusHeight, tagHeight: tagHeight, onClick: () => {
|
533
|
+
var _a, _b, _c;
|
534
|
+
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
535
|
+
eventInfo: {
|
536
|
+
eventSubject: 'backMultiPostClick',
|
537
|
+
eventDescription: 'backMultiPostClick',
|
538
|
+
traceinfo: (_c = (_b = (_a = data === null || data === void 0 ? void 0 : data[0]) === null || _a === void 0 ? void 0 : _a.video) === null || _b === void 0 ? void 0 : _b.traceInfo) !== null && _c !== void 0 ? _c : ''
|
539
|
+
}
|
540
|
+
});
|
541
|
+
location === null || location === void 0 ? void 0 : location.reload();
|
542
|
+
} })),
|
543
|
+
isShowFingerTip ? (React.createElement(FingerSwipeTip, { imageUrl: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.swipeTipIcon, style: { top: `${50 - ((_r = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.swipeTipOffset) !== null && _r !== void 0 ? _r : 0)}%` }, duration: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.swiperTipAniDur })) : null,
|
537
544
|
React.createElement(Swiper, { style: {
|
538
545
|
marginTop: tagHeight
|
539
546
|
}, ref: swiperRef, onSlideChange: () => {
|
@@ -564,7 +571,8 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
564
571
|
renderView,
|
565
572
|
renderLikeButton(visList[activeIndex], activeIndex, !!(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIconFixed)),
|
566
573
|
renderToggleButton(!!(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconFixed))),
|
567
|
-
React.createElement(WaterFall, Object.assign({}, (
|
568
|
-
React.createElement(ConsentPopup, { resolver: resolver, globalConfig: globalConfig })
|
574
|
+
React.createElement(WaterFall, Object.assign({}, (_u = (_t = (_s = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.hashTag) === null || _s === void 0 ? void 0 : _s[0]) === null || _t === void 0 ? void 0 : _t.item) === null || _u === void 0 ? void 0 : _u.props)),
|
575
|
+
React.createElement(ConsentPopup, { resolver: resolver, globalConfig: globalConfig }),
|
576
|
+
openMultiPosts && (React.createElement(MultiPosts, Object.assign({}, (_x = (_w = (_v = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.multiPosts) === null || _v === void 0 ? void 0 : _v[0]) === null || _w === void 0 ? void 0 : _w.item) === null || _x === void 0 ? void 0 : _x.props, (_0 = (_z = (_y = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.multiPosts) === null || _y === void 0 ? void 0 : _y[0]) === null || _z === void 0 ? void 0 : _z.item) === null || _0 === void 0 ? void 0 : _0.event, { style: { position: 'fixed', top: 0, left: 0, right: 0 } })))));
|
569
577
|
};
|
570
578
|
export default SxpPageRender;
|
@@ -62,6 +62,8 @@ 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>>;
|
65
67
|
}
|
66
68
|
export interface IEditorCoreProps {
|
67
69
|
resolver: Record<string, MaterialComponet>;
|
@@ -55,6 +55,7 @@ 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();
|
58
59
|
const [_schema, setSchema] = useState(schema || {
|
59
60
|
pointData: [item],
|
60
61
|
dataSource: [],
|
@@ -70,6 +71,9 @@ const EditorCore = forwardRef(({ children, resolver, isSsr, schema, enableDataSo
|
|
70
71
|
const [undoStack, setUndoStack] = useState([[item]]);
|
71
72
|
const [redoStack, setRedoStack] = useState([]);
|
72
73
|
const [popup, setPopup] = useState(popupInit);
|
74
|
+
const channelParams = useMemo(() => {
|
75
|
+
return channel || utmVal;
|
76
|
+
}, [channel, utmVal]);
|
73
77
|
typeof window !== 'undefined' &&
|
74
78
|
(window.sxpPopup = (type, aniType) => {
|
75
79
|
setPopup(Object.assign(Object.assign(Object.assign({}, popupInit), { id: type }), aniType));
|
@@ -78,10 +82,10 @@ const EditorCore = forwardRef(({ children, resolver, isSsr, schema, enableDataSo
|
|
78
82
|
(window.getJointUtmLink = (url) => {
|
79
83
|
setSlideSkipState();
|
80
84
|
if ((url === null || url === void 0 ? void 0 : url.indexOf('?')) !== -1) {
|
81
|
-
return url + (
|
85
|
+
return url + (channelParams ? '&' + channelParams : '');
|
82
86
|
}
|
83
87
|
else {
|
84
|
-
return url + (
|
88
|
+
return url + (channelParams ? '?' + channelParams : '');
|
85
89
|
}
|
86
90
|
});
|
87
91
|
useEffect(() => {
|
@@ -142,7 +146,9 @@ const EditorCore = forwardRef(({ children, resolver, isSsr, schema, enableDataSo
|
|
142
146
|
setUndoStack,
|
143
147
|
getCurPageConf,
|
144
148
|
popup,
|
145
|
-
setPopup
|
149
|
+
setPopup,
|
150
|
+
channel,
|
151
|
+
setChannel
|
146
152
|
} },
|
147
153
|
React.createElement(DataSourceProvider, { isSsr: isSsr, enable: enableDataSource }, children)));
|
148
154
|
});
|
@@ -26,6 +26,8 @@ interface IEditorDataContext {
|
|
26
26
|
};
|
27
27
|
consentPopupCate?: string;
|
28
28
|
setConsentPopupCate?: React.Dispatch<React.SetStateAction<string>>;
|
29
|
+
openMultiPosts?: boolean;
|
30
|
+
setOpenMultiPosts?: React.Dispatch<React.SetStateAction<boolean>>;
|
29
31
|
}
|
30
32
|
interface IEditorProviderProps {
|
31
33
|
data?: any;
|
@@ -5,6 +5,7 @@ const EditorDataProvider = ({ children, data }) => {
|
|
5
5
|
const [openHashtag, setOpenHashtag] = useState(false);
|
6
6
|
const [openConsent, setOpenConsent] = useState(false);
|
7
7
|
const [consentPopupCate, setConsentPopupCate] = useState('');
|
8
|
+
const [openMultiPosts, setOpenMultiPosts] = useState(false);
|
8
9
|
return (React.createElement(EditorDataContext.Provider, { value: {
|
9
10
|
sxpPrameter: {
|
10
11
|
bottomImage: (_a = data === null || data === void 0 ? void 0 : data.sxp_parameter) === null || _a === void 0 ? void 0 : _a.bottom_image,
|
@@ -29,7 +30,9 @@ const EditorDataProvider = ({ children, data }) => {
|
|
29
30
|
sxpFontLinks: data === null || data === void 0 ? void 0 : data.sxpFontLinks,
|
30
31
|
utmParameter: data === null || data === void 0 ? void 0 : data.utm_parameter,
|
31
32
|
consentPopupCate,
|
32
|
-
setConsentPopupCate
|
33
|
+
setConsentPopupCate,
|
34
|
+
openMultiPosts,
|
35
|
+
setOpenMultiPosts
|
33
36
|
} }, children));
|
34
37
|
};
|
35
38
|
export function useEditorDataProvider() {
|
@@ -36,7 +36,6 @@ export interface ISxpDataSourceContext {
|
|
36
36
|
contentFilter?: Array<string>;
|
37
37
|
productFilter?: Array<string>;
|
38
38
|
}) => Promise<RecommendVideoResultType | undefined>;
|
39
|
-
utmVal?: string;
|
40
39
|
bffEventReport?: (body: {
|
41
40
|
userInfo?: object;
|
42
41
|
eventInfo: object;
|
@@ -100,6 +99,7 @@ export interface SxpDataSourceProviderProps {
|
|
100
99
|
mutateLike: (body: {
|
101
100
|
content: string;
|
102
101
|
}) => Promise<boolean>;
|
102
|
+
pageData?: PageData;
|
103
103
|
}) => ReactNode;
|
104
104
|
utmVal?: string;
|
105
105
|
enableReportEvent?: boolean;
|
@@ -112,7 +112,6 @@ export interface SxpDataSourceProviderProps {
|
|
112
112
|
loadingImage?: string;
|
113
113
|
isOpenHashTag?: boolean;
|
114
114
|
enabledMetaConversionApi?: boolean;
|
115
|
-
isShowTag?: boolean;
|
116
115
|
consentWidth?: number;
|
117
116
|
consentHeight?: number;
|
118
117
|
isOpenConsent?: boolean;
|
@@ -120,6 +119,9 @@ export interface SxpDataSourceProviderProps {
|
|
120
119
|
isEditor?: boolean;
|
121
120
|
utmParameter?: PageData['utm_parameter'];
|
122
121
|
channelQueryList?: any[];
|
122
|
+
data?: PageData;
|
123
|
+
dataList?: PageData[];
|
124
|
+
onUpdateSchema?: (d: PageData['data']) => void;
|
123
125
|
}
|
124
126
|
export declare const DEFAULT_TAG = "FOR U";
|
125
127
|
declare const _default: React.NamedExoticComponent<SxpDataSourceProviderProps>;
|