pb-sxp-ui 1.15.13-alpha.3 → 1.15.13-alpha.4
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 +120 -84
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +120 -84
- package/dist/index.js.map +1 -1
- package/dist/index.min.cjs +6 -6
- package/dist/index.min.cjs.map +1 -1
- package/dist/index.min.js +6 -6
- package/dist/index.min.js.map +1 -1
- package/dist/pb-ui.js +120 -84
- package/dist/pb-ui.js.map +1 -1
- package/dist/pb-ui.min.js +6 -6
- package/dist/pb-ui.min.js.map +1 -1
- package/es/core/components/DiyStoryPreview/VideoWidget.d.ts +2 -0
- package/es/core/components/DiyStoryPreview/VideoWidget.js +6 -4
- package/es/core/components/DiyStoryPreview/index.d.ts +2 -0
- package/es/core/components/DiyStoryPreview/index.js +20 -15
- package/es/core/components/SxpPageCore/index.js +5 -5
- package/es/core/context/EditorContext.js +1 -1
- package/es/core/context/SxpDataSourceProvider.d.ts +1 -1
- package/es/core/context/SxpDataSourceProvider.js +21 -22
- package/lib/core/components/DiyStoryPreview/VideoWidget.d.ts +2 -0
- package/lib/core/components/DiyStoryPreview/VideoWidget.js +6 -4
- package/lib/core/components/DiyStoryPreview/index.d.ts +2 -0
- package/lib/core/components/DiyStoryPreview/index.js +18 -13
- package/lib/core/components/SxpPageCore/index.js +5 -5
- package/lib/core/context/EditorContext.js +1 -1
- package/lib/core/context/SxpDataSourceProvider.d.ts +1 -1
- package/lib/core/context/SxpDataSourceProvider.js +21 -22
- package/package.json +1 -1
@@ -12,6 +12,8 @@ interface IVideoWidgetProps {
|
|
12
12
|
videoPostConfig?: postConfigType;
|
13
13
|
swiperRef?: any;
|
14
14
|
loopPlay?: boolean;
|
15
|
+
videoPlayIcon?: string;
|
16
|
+
isPlay?: boolean;
|
15
17
|
}
|
16
18
|
declare const _default: React.NamedExoticComponent<IVideoWidgetProps>;
|
17
19
|
export default _default;
|
@@ -2,8 +2,9 @@ import React, { memo, useCallback, useEffect, useMemo, useRef, useState } from '
|
|
2
2
|
import { useSwiperSlide } from 'swiper/react';
|
3
3
|
import { useIconLink } from '../SxpPageRender/useIconLink';
|
4
4
|
import { mountVideoPlayerAtNode } from '../SxpPageRender/VideoWidget/VideoPlayer';
|
5
|
+
import FormatImage from '../SxpPageRender/FormatImage';
|
5
6
|
import { useSxpDataSource } from '../../../core/hooks';
|
6
|
-
const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostConfig, width, swiperRef, loopPlay }) => {
|
7
|
+
const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostConfig, width, swiperRef, loopPlay, videoPlayIcon, isPlay }) => {
|
7
8
|
const { isActive } = useSwiperSlide();
|
8
9
|
const [isPauseVideo, setIsPauseVideo] = useState(false);
|
9
10
|
const videoRef = useRef(null);
|
@@ -188,9 +189,10 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
188
189
|
position: 'relative',
|
189
190
|
width: '100%',
|
190
191
|
height,
|
191
|
-
overflow: 'hidden'
|
192
|
-
pointerEvents: 'none'
|
192
|
+
overflow: 'hidden'
|
193
193
|
} },
|
194
|
-
React.createElement("div", { className: 'n-full-screen', id: videoId, style: { width: '100%', height: '100%' } })
|
194
|
+
React.createElement("div", { className: 'n-full-screen', id: videoId, style: { width: '100%', height: '100%' } }),
|
195
|
+
renderPoster,
|
196
|
+
isPauseVideo && React.createElement(FormatImage, { className: 'clc-pb-video-pause', src: videoPlayIcon !== null && videoPlayIcon !== void 0 ? videoPlayIcon : PAUSE_ICON, alt: 'pause' })));
|
195
197
|
};
|
196
198
|
export default memo(VideoWidget);
|
@@ -15,6 +15,7 @@ export interface IScene {
|
|
15
15
|
startTime: number;
|
16
16
|
traceInfo: string;
|
17
17
|
bindProducts?: any[];
|
18
|
+
title?: string;
|
18
19
|
}
|
19
20
|
export type ScenesType = IScene[];
|
20
21
|
export type DiyStoryPreviewType = ISxpPageRenderProps & {
|
@@ -24,6 +25,7 @@ export type DiyStoryPreviewType = ISxpPageRenderProps & {
|
|
24
25
|
onActiveChange?: (v: number) => void;
|
25
26
|
loopPlay?: boolean;
|
26
27
|
pointerEvents?: any;
|
28
|
+
isPlay?: boolean;
|
27
29
|
};
|
28
30
|
declare const _default: React.NamedExoticComponent<DiyStoryPreviewType>;
|
29
31
|
export default _default;
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import React, { memo, useEffect, useMemo, useRef, useState } from 'react';
|
1
|
+
import React, { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
2
2
|
import { Swiper, SwiperSlide } from 'swiper/react';
|
3
|
-
import { cloneDeep } from 'lodash';
|
3
|
+
import { cloneDeep, debounce } from 'lodash';
|
4
4
|
import RenderCard from '../SxpPageRender/RenderCard';
|
5
5
|
import ExpandableText from '../SxpPageRender/ExpandableText';
|
6
6
|
import LikeButton from '../SxpPageRender/LikeButton';
|
@@ -194,7 +194,7 @@ Object.values(_materials_).forEach((v) => {
|
|
194
194
|
});
|
195
195
|
const defaultUnLikeIconPath = '/pb_static/f71266d2c64446c5ae6a5a7f5489cc0a.png';
|
196
196
|
const defaultLikeIconPath = '/pb_static/f07900fe3f0f4ae188ea1611d4801a44.png';
|
197
|
-
const DiyStoryPreview = ({ data = [], globalConfig, tipText, nudge, tempMap, descStyle, hashTagStyle, containerHeight = 664, containerWidth = 375, appDomain, tagList = [], scenes, onActiveChange, activeIndex, loopPlay = false, pointerEvents = 'none' }) => {
|
197
|
+
const DiyStoryPreview = ({ data = [], globalConfig, tipText, nudge, tempMap, descStyle, hashTagStyle, containerHeight = 664, containerWidth = 375, appDomain, tagList = [], scenes, onActiveChange, activeIndex, loopPlay = false, pointerEvents = 'none', isPlay }) => {
|
198
198
|
const [loopPlaySwiper, setLooPlaySwiper] = useState(loopPlay);
|
199
199
|
const swiperRef = useRef(null);
|
200
200
|
const height = useMemo(() => {
|
@@ -220,7 +220,7 @@ const DiyStoryPreview = ({ data = [], globalConfig, tipText, nudge, tempMap, des
|
|
220
220
|
const renderContent = (rec, index) => {
|
221
221
|
const isVideo = isVideoUrl(rec === null || rec === void 0 ? void 0 : rec.mediaUrl);
|
222
222
|
if (isVideo) {
|
223
|
-
return (React.createElement(VideoWidget, { rec: rec, index: index, muted: true, width: containerWidth, data: scenes !== null && scenes !== void 0 ? scenes : [], height: containerHeight, activeIndex: index, videoPostConfig: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.videoPost, swiperRef: swiperRef, loopPlay: loopPlaySwiper }));
|
223
|
+
return (React.createElement(VideoWidget, { isPlay: isPlay, rec: rec, index: index, muted: true, width: containerWidth, data: scenes !== null && scenes !== void 0 ? scenes : [], height: containerHeight, activeIndex: index, videoPostConfig: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.videoPost, videoPlayIcon: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.videoPlayIcon, swiperRef: swiperRef, loopPlay: loopPlaySwiper }));
|
224
224
|
}
|
225
225
|
else {
|
226
226
|
return (React.createElement(PictureGroup, { key: rec.itemId, imgUrls: [rec === null || rec === void 0 ? void 0 : rec.mediaUrl], width: containerWidth, height: containerHeight, rec: rec, index: index, imgUrlsPostConfig: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.imgUrlsPost, data: scenes !== null && scenes !== void 0 ? scenes : [], swiperRef: swiperRef, loopPlay: loopPlaySwiper }));
|
@@ -233,14 +233,6 @@ const DiyStoryPreview = ({ data = [], globalConfig, tipText, nudge, tempMap, des
|
|
233
233
|
}
|
234
234
|
return null;
|
235
235
|
}, [globalConfig]);
|
236
|
-
const CTA = (rec, index) => {
|
237
|
-
if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowCTA) === undefined || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowCTA)) {
|
238
|
-
console.log(globalConfig, rec, '111');
|
239
|
-
return (React.createElement("div", { className: 'clc-sxp-bottom-card' },
|
240
|
-
React.createElement(RenderCard, { rec: rec, index: index, tempMap: tempMap, resolver: RESOLVER })));
|
241
|
-
}
|
242
|
-
return null;
|
243
|
-
};
|
244
236
|
const renderBottom = (rec, index) => {
|
245
237
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
246
238
|
if (rec === null || rec === void 0 ? void 0 : rec.video) {
|
@@ -342,6 +334,7 @@ const DiyStoryPreview = ({ data = [], globalConfig, tipText, nudge, tempMap, des
|
|
342
334
|
var _a, _b, _c, _d;
|
343
335
|
const rec = cloneDeep(recData);
|
344
336
|
rec.video.bindProducts = item === null || item === void 0 ? void 0 : item.bindProducts;
|
337
|
+
rec.video.title = (item === null || item === void 0 ? void 0 : item.title) || '';
|
345
338
|
return (React.createElement("div", { style: { position: 'relative' } },
|
346
339
|
React.createElement(SwiperSlide, { key: index, virtualIndex: index, style: { overflow: 'hidden', position: 'relative' } },
|
347
340
|
renderBottom(rec, index),
|
@@ -363,14 +356,26 @@ const DiyStoryPreview = ({ data = [], globalConfig, tipText, nudge, tempMap, des
|
|
363
356
|
(_b = (_a = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _a === void 0 ? void 0 : _a.swiper) === null || _b === void 0 ? void 0 : _b.slideTo(activeIndex);
|
364
357
|
}, [activeIndex]);
|
365
358
|
useEffect(() => {
|
366
|
-
var _a, _b;
|
367
359
|
if (!(swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current))
|
368
360
|
return;
|
369
|
-
(
|
361
|
+
setLooPlaySwiper(loopPlay);
|
370
362
|
}, [loopPlay]);
|
363
|
+
const handleSessionExpire = useCallback(debounce(() => {
|
364
|
+
setLooPlaySwiper(false);
|
365
|
+
}, 1000), []);
|
366
|
+
useEffect(() => {
|
367
|
+
const events = ['touchstart', 'touchcancel'];
|
368
|
+
events.forEach((event) => {
|
369
|
+
window.addEventListener(event, handleSessionExpire);
|
370
|
+
});
|
371
|
+
return () => {
|
372
|
+
events.forEach((event) => {
|
373
|
+
window.removeEventListener(event, handleSessionExpire);
|
374
|
+
});
|
375
|
+
};
|
376
|
+
}, [handleSessionExpire]);
|
371
377
|
return (React.createElement("div", { id: 'sxp-render', style: { height: containerHeight, position: 'relative', pointerEvents } },
|
372
378
|
React.createElement(Swiper, { ref: swiperRef, allowTouchMove: pointerEvents !== 'none', onSlideChange: () => {
|
373
|
-
setLooPlaySwiper(false);
|
374
379
|
swiperRef.current.swiper.allowTouchMove = false;
|
375
380
|
setTimeout(() => {
|
376
381
|
swiperRef.current.swiper.allowTouchMove = true;
|
@@ -9,19 +9,19 @@ Object.values(_materials_).forEach((v) => {
|
|
9
9
|
RESOLVER[v.extend.type] = v;
|
10
10
|
});
|
11
11
|
const SxpPageCore = ({ data, maxSize = 10, defaultSize = 10, hashTagSize = 20, loadingImage, appDomain, enabledMetaConversionApi, dataList, pointerEvents }) => {
|
12
|
-
var _a, _b, _c, _d, _e, _f;
|
12
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
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
|
-
const [_schema, setSchema] = useState(data === null || data === void 0 ? void 0 : data.data);
|
18
|
+
const [_schema, setSchema] = useState((_a = data === null || data === void 0 ? void 0 : data.data) === null || _a === void 0 ? void 0 : _a.data);
|
19
19
|
const [channel, setChannel] = useState();
|
20
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: (
|
22
|
-
var _a;
|
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: (_c = (_b = data === null || data === void 0 ? void 0 : data.sxp_parameter) === null || _b === void 0 ? void 0 : _b.personalized_recommend) !== null && _c !== void 0 ? _c : maxSize, defaultSize: (_e = (_d = data === null || data === void 0 ? void 0 : data.sxp_parameter) === null || _d === void 0 ? void 0 : _d.default_recommend) !== null && _e !== void 0 ? _e : defaultSize, hashTagSize: (_g = (_f = data === null || data === void 0 ? void 0 : data.sxp_parameter) === null || _f === void 0 ? void 0 : _f.hash_tag_size) !== null && _g !== void 0 ? _g : hashTagSize, loadingImage: loadingImage, appDomain: appDomain, enabledMetaConversionApi: enabledMetaConversionApi, utmParameter: data === null || data === void 0 ? void 0 : data.utm_parameter, data: Object.assign(Object.assign({}, data), { data: (_h = data === null || data === void 0 ? void 0 : data.data) === null || _h === void 0 ? void 0 : _h.data }), dataList: dataList, onUpdateSchema: (d) => setSchema(d), onUpdateChannel: (d) => setChannel(d), render: ({ rtcList, tagList, pageData }) => {
|
22
|
+
var _a, _b;
|
23
23
|
return (React.createElement(React.Fragment, null,
|
24
|
-
React.createElement(DiyStoryPreview, Object.assign({ defaultData: data }, (
|
24
|
+
React.createElement(DiyStoryPreview, Object.assign({ defaultData: Object.assign(Object.assign({}, data), { data: (_a = data === null || data === void 0 ? void 0 : data.data) === null || _a === void 0 ? void 0 : _a.data }) }, (_b = pageData === null || pageData === void 0 ? void 0 : pageData.data) === null || _b === void 0 ? void 0 : _b.sxpPageConf, { tagList: tagList, scenes: rtcList, resolver: RESOLVER, containerHeight: window === null || window === void 0 ? void 0 : window.innerHeight, pointerEvents: pointerEvents, loopPlay: true })),
|
25
25
|
React.createElement(Popup, null)));
|
26
26
|
} })));
|
27
27
|
};
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import React, { forwardRef, useCallback, useEffect, useImperativeHandle, useState, useMemo } from 'react';
|
2
2
|
import { cloneDeep } from 'lodash';
|
3
|
+
import { setSlideSkipState } from '../utils/localStore';
|
3
4
|
import DataSourceProvider from './DataSourceProvider';
|
4
5
|
import { uuid } from '../../core/utils/tool';
|
5
|
-
import { setSlideSkipState } from '../utils/localStore';
|
6
6
|
const item = {
|
7
7
|
id: uuid(6, 10),
|
8
8
|
item: {
|
@@ -131,7 +131,7 @@ export interface SxpDataSourceProviderProps {
|
|
131
131
|
isEditor?: boolean;
|
132
132
|
utmParameter?: PageData['utm_parameter'];
|
133
133
|
channelQueryList?: any[];
|
134
|
-
data?:
|
134
|
+
data?: any;
|
135
135
|
dataList?: PageData[];
|
136
136
|
onUpdateSchema?: (d: PageData['data']) => void;
|
137
137
|
onUpdateChannel?: (d: string) => void;
|
@@ -144,16 +144,16 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
144
144
|
.catch((err) => Promise.reject(err));
|
145
145
|
}, [bffDataSource]);
|
146
146
|
const getRecommendVideos = useCallback((query) => __awaiter(void 0, void 0, void 0, function* () {
|
147
|
-
var _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s
|
148
|
-
query = Object.assign({ maxSize:
|
147
|
+
var _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
148
|
+
query = Object.assign({ maxSize: 50, defaultSize: 50, 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, pageNum: query === null || query === void 0 ? void 0 : query.pageNum, contentFilter: query === null || query === void 0 ? void 0 : query.contentFilter, productFilter: query === null || query === void 0 ? void 0 : query.productFilter }, (chatlabsId && { chatlabsId }));
|
149
149
|
if (channel) {
|
150
150
|
query = Object.assign(Object.assign({}, query), { channel: decodeURIComponent(channel) });
|
151
151
|
}
|
152
152
|
else if (utmVal) {
|
153
|
-
const val = (
|
153
|
+
const val = (_h = (_g = (_f = splitUrlParams(utmVal)) === null || _f === void 0 ? void 0 : _f.filter((val) => {
|
154
154
|
const key = val.split('=')[0];
|
155
155
|
return key;
|
156
|
-
})) === null ||
|
156
|
+
})) === null || _g === void 0 ? void 0 : _g.join('&')) !== null && _h !== void 0 ? _h : '';
|
157
157
|
if (val)
|
158
158
|
query = Object.assign(Object.assign({}, query), { channel: decodeURIComponent(val) });
|
159
159
|
}
|
@@ -167,19 +167,19 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
167
167
|
let list = [];
|
168
168
|
let result = null;
|
169
169
|
const recurveRecList = (query) => __awaiter(void 0, void 0, void 0, function* () {
|
170
|
-
var _v, _w, _x, _y
|
170
|
+
var _t, _u, _v, _w, _x, _y;
|
171
171
|
query.pageNum = pageNum;
|
172
172
|
result = yield (bffFetchAdmin === null || bffFetchAdmin === void 0 ? void 0 : bffFetchAdmin('recommend/direct_page', { method: 'POST', body: query }));
|
173
173
|
if (!(result === null || result === void 0 ? void 0 : result.success)) {
|
174
174
|
return undefined;
|
175
175
|
}
|
176
176
|
setLoading(false);
|
177
|
-
list = list.concat((
|
177
|
+
list = list.concat((_w = (_v = (_u = (_t = result === null || result === void 0 ? void 0 : result.data) === null || _t === void 0 ? void 0 : _t.recList) === null || _u === void 0 ? void 0 : _u.filter) === null || _v === void 0 ? void 0 : _v.call(_u, (item) => (item === null || item === void 0 ? void 0 : item.product) || (item === null || item === void 0 ? void 0 : item.video))) !== null && _w !== void 0 ? _w : []);
|
178
178
|
if ((rtcList === null || rtcList === void 0 ? void 0 : rtcList.length) === 0) {
|
179
179
|
setRtcList(getFilterRecList(Object.assign(Object.assign({}, result === null || result === void 0 ? void 0 : result.data), { recList: list })));
|
180
180
|
setCacheRtcList(getFilterRecList(Object.assign(Object.assign({}, result === null || result === void 0 ? void 0 : result.data), { recList: list })));
|
181
181
|
}
|
182
|
-
const isNotNullList = (
|
182
|
+
const isNotNullList = (_y = (_x = result === null || result === void 0 ? void 0 : result.data) === null || _x === void 0 ? void 0 : _x.recList) === null || _y === void 0 ? void 0 : _y.some((item) => (item === null || item === void 0 ? void 0 : item.product) || (item === null || item === void 0 ? void 0 : item.video));
|
183
183
|
if (isNotNullList) {
|
184
184
|
pageNum = pageNum + 1;
|
185
185
|
yield recurveRecList(query);
|
@@ -187,11 +187,11 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
187
187
|
});
|
188
188
|
yield recurveRecList(query);
|
189
189
|
if (!(query === null || query === void 0 ? void 0 : query.hashTag) && result)
|
190
|
-
setCurReqInfo({ rtc: (
|
190
|
+
setCurReqInfo({ rtc: (_j = result === null || result === void 0 ? void 0 : result.data) === null || _j === void 0 ? void 0 : _j.rtc, requestId: (_k = result === null || result === void 0 ? void 0 : result.data) === null || _k === void 0 ? void 0 : _k.requestId });
|
191
191
|
return Object.assign(Object.assign({}, result === null || result === void 0 ? void 0 : result.data), { recList: list });
|
192
192
|
}
|
193
193
|
if (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview) {
|
194
|
-
query = Object.assign(Object.assign({}, query), { directPage: true, level: 1, pageNum: (
|
194
|
+
query = Object.assign(Object.assign({}, query), { directPage: true, level: 1, pageNum: (_l = query === null || query === void 0 ? void 0 : query.pageNum) !== null && _l !== void 0 ? _l : 1 });
|
195
195
|
}
|
196
196
|
const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v3/recommend/direct', { method: 'POST', body: query }));
|
197
197
|
if (!(result === null || result === void 0 ? void 0 : result.success)) {
|
@@ -201,8 +201,8 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
201
201
|
setCurReqInfo({ rtc: result.data.rtc, requestId: result.data.requestId });
|
202
202
|
if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview) && !isEditor) {
|
203
203
|
let list = [];
|
204
|
-
list = list.concat((
|
205
|
-
const isNotNullList = (
|
204
|
+
list = list.concat((_q = (_p = (_o = (_m = result === null || result === void 0 ? void 0 : result.data) === null || _m === void 0 ? void 0 : _m.recList) === null || _o === void 0 ? void 0 : _o.filter) === null || _p === void 0 ? void 0 : _p.call(_o, (item) => (item === null || item === void 0 ? void 0 : item.product) || (item === null || item === void 0 ? void 0 : item.video))) !== null && _q !== void 0 ? _q : []);
|
205
|
+
const isNotNullList = (_s = (_r = result === null || result === void 0 ? void 0 : result.data) === null || _r === void 0 ? void 0 : _r.recList) === null || _s === void 0 ? void 0 : _s.some((item) => (item === null || item === void 0 ? void 0 : item.product) || (item === null || item === void 0 ? void 0 : item.video));
|
206
206
|
if (!isNotNullList) {
|
207
207
|
setIsNoMoreData(true);
|
208
208
|
}
|
@@ -211,12 +211,12 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
211
211
|
return result === null || result === void 0 ? void 0 : result.data;
|
212
212
|
}), [bffFetch, utmVal, maxSize, defaultSize, channelQueryList, channel, chatlabsId, bffFetchAdmin]);
|
213
213
|
const loadVideos = useCallback((pageNum) => __awaiter(void 0, void 0, void 0, function* () {
|
214
|
-
var
|
214
|
+
var _z, _0, _1, _2;
|
215
215
|
if (rtcList.length <= 0) {
|
216
216
|
return;
|
217
217
|
}
|
218
218
|
const lastItem = rtcList === null || rtcList === void 0 ? void 0 : rtcList[(rtcList === null || rtcList === void 0 ? void 0 : rtcList.length) - 1];
|
219
|
-
const data = yield getRecommendVideos(Object.assign(Object.assign(Object.assign(Object.assign({ hashTag: waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.hashTag }, (((
|
219
|
+
const data = yield getRecommendVideos(Object.assign(Object.assign(Object.assign(Object.assign({ hashTag: waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.hashTag }, (((_z = lastItem === null || lastItem === void 0 ? void 0 : lastItem.product) === null || _z === void 0 ? void 0 : _z.itemId) && { productFilter: [(_0 = lastItem === null || lastItem === void 0 ? void 0 : lastItem.product) === null || _0 === void 0 ? void 0 : _0.itemId] })), (((_1 = lastItem === null || lastItem === void 0 ? void 0 : lastItem.video) === null || _1 === void 0 ? void 0 : _1.itemId) && { contentFilter: [(_2 = lastItem === null || lastItem === void 0 ? void 0 : lastItem.video) === null || _2 === void 0 ? void 0 : _2.itemId] })), { themeTag: themeTag.current }), ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview) && !isEditor && { pageNum })));
|
220
220
|
setRtcList(rtcList.concat(getFilterRecList(data)));
|
221
221
|
setCacheRtcList(cacheRtcList.concat(getFilterRecList(data)));
|
222
222
|
return data;
|
@@ -375,18 +375,18 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
375
375
|
return res === null || res === void 0 ? void 0 : res.success;
|
376
376
|
}), [bffFetch]);
|
377
377
|
const bffGetTagList = useCallback((data) => __awaiter(void 0, void 0, void 0, function* () {
|
378
|
-
var _5, _6, _7, _8, _9, _10
|
379
|
-
const isShowTag = !!((
|
378
|
+
var _3, _4, _5, _6, _7, _8, _9, _10;
|
379
|
+
const isShowTag = !!((_5 = (_4 = (_3 = data === null || data === void 0 ? void 0 : data.data) === null || _3 === void 0 ? void 0 : _3.sxpPageConf) === null || _4 === void 0 ? void 0 : _4.globalConfig) === null || _5 === void 0 ? void 0 : _5.isShowTag);
|
380
380
|
if (!utmVal || !isShowTag)
|
381
381
|
return;
|
382
382
|
try {
|
383
|
-
const val = (
|
383
|
+
const val = (_8 = (_7 = (_6 = splitUrlParams(utmVal)) === null || _6 === void 0 ? void 0 : _6.filter((val) => {
|
384
384
|
var _a, _b;
|
385
385
|
const key = val.split('=')[0];
|
386
386
|
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);
|
387
|
-
})) === null ||
|
387
|
+
})) === null || _7 === void 0 ? void 0 : _7.join('&')) !== null && _8 !== void 0 ? _8 : '';
|
388
388
|
const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/tag/list', { method: 'GET', query: { channel: decodeURIComponent(val) } }));
|
389
|
-
setTagList((
|
389
|
+
setTagList((_10 = (_9 = result === null || result === void 0 ? void 0 : result.data) === null || _9 === void 0 ? void 0 : _9.tags) !== null && _10 !== void 0 ? _10 : []);
|
390
390
|
}
|
391
391
|
catch (e) {
|
392
392
|
console.log('e', e);
|
@@ -446,10 +446,10 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
446
446
|
});
|
447
447
|
}, [bffEventReport]);
|
448
448
|
const getAccount = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
449
|
-
var
|
449
|
+
var _11, _12;
|
450
450
|
const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/account', { method: 'GET' }));
|
451
|
-
setChatlabsId((
|
452
|
-
return ((
|
451
|
+
setChatlabsId((_11 = res === null || res === void 0 ? void 0 : res.data) === null || _11 === void 0 ? void 0 : _11.chatLabsId);
|
452
|
+
return ((_12 = res === null || res === void 0 ? void 0 : res.data) === null || _12 === void 0 ? void 0 : _12.consentResult) === 'true';
|
453
453
|
}), [bffFetch]);
|
454
454
|
const accountSonsent = useCallback((consentResult) => __awaiter(void 0, void 0, void 0, function* () {
|
455
455
|
const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/account/consent', {
|
@@ -464,7 +464,6 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
464
464
|
if (!isShowConsent)
|
465
465
|
h5EnterLink();
|
466
466
|
}, [isShowConsent]);
|
467
|
-
console.log(data, '111');
|
468
467
|
useEffect(() => {
|
469
468
|
if (isShowConsent || isPreview)
|
470
469
|
return;
|
@@ -12,6 +12,8 @@ interface IVideoWidgetProps {
|
|
12
12
|
videoPostConfig?: postConfigType;
|
13
13
|
swiperRef?: any;
|
14
14
|
loopPlay?: boolean;
|
15
|
+
videoPlayIcon?: string;
|
16
|
+
isPlay?: boolean;
|
15
17
|
}
|
16
18
|
declare const _default: React.NamedExoticComponent<IVideoWidgetProps>;
|
17
19
|
export default _default;
|
@@ -5,8 +5,9 @@ const react_1 = tslib_1.__importStar(require("react"));
|
|
5
5
|
const react_2 = require("swiper/react");
|
6
6
|
const useIconLink_1 = require("../SxpPageRender/useIconLink");
|
7
7
|
const VideoPlayer_1 = require("../SxpPageRender/VideoWidget/VideoPlayer");
|
8
|
+
const FormatImage_1 = tslib_1.__importDefault(require("../SxpPageRender/FormatImage"));
|
8
9
|
const hooks_1 = require("../../../core/hooks");
|
9
|
-
const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostConfig, width, swiperRef, loopPlay }) => {
|
10
|
+
const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostConfig, width, swiperRef, loopPlay, videoPlayIcon, isPlay }) => {
|
10
11
|
const { isActive } = (0, react_2.useSwiperSlide)();
|
11
12
|
const [isPauseVideo, setIsPauseVideo] = (0, react_1.useState)(false);
|
12
13
|
const videoRef = (0, react_1.useRef)(null);
|
@@ -191,9 +192,10 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
191
192
|
position: 'relative',
|
192
193
|
width: '100%',
|
193
194
|
height,
|
194
|
-
overflow: 'hidden'
|
195
|
-
pointerEvents: 'none'
|
195
|
+
overflow: 'hidden'
|
196
196
|
} },
|
197
|
-
react_1.default.createElement("div", { className: 'n-full-screen', id: videoId, style: { width: '100%', height: '100%' } })
|
197
|
+
react_1.default.createElement("div", { className: 'n-full-screen', id: videoId, style: { width: '100%', height: '100%' } }),
|
198
|
+
renderPoster,
|
199
|
+
isPauseVideo && react_1.default.createElement(FormatImage_1.default, { className: 'clc-pb-video-pause', src: videoPlayIcon !== null && videoPlayIcon !== void 0 ? videoPlayIcon : PAUSE_ICON, alt: 'pause' })));
|
198
200
|
};
|
199
201
|
exports.default = (0, react_1.memo)(VideoWidget);
|
@@ -15,6 +15,7 @@ export interface IScene {
|
|
15
15
|
startTime: number;
|
16
16
|
traceInfo: string;
|
17
17
|
bindProducts?: any[];
|
18
|
+
title?: string;
|
18
19
|
}
|
19
20
|
export type ScenesType = IScene[];
|
20
21
|
export type DiyStoryPreviewType = ISxpPageRenderProps & {
|
@@ -24,6 +25,7 @@ export type DiyStoryPreviewType = ISxpPageRenderProps & {
|
|
24
25
|
onActiveChange?: (v: number) => void;
|
25
26
|
loopPlay?: boolean;
|
26
27
|
pointerEvents?: any;
|
28
|
+
isPlay?: boolean;
|
27
29
|
};
|
28
30
|
declare const _default: React.NamedExoticComponent<DiyStoryPreviewType>;
|
29
31
|
export default _default;
|
@@ -197,7 +197,7 @@ Object.values(_materials_).forEach((v) => {
|
|
197
197
|
});
|
198
198
|
const defaultUnLikeIconPath = '/pb_static/f71266d2c64446c5ae6a5a7f5489cc0a.png';
|
199
199
|
const defaultLikeIconPath = '/pb_static/f07900fe3f0f4ae188ea1611d4801a44.png';
|
200
|
-
const DiyStoryPreview = ({ data = [], globalConfig, tipText, nudge, tempMap, descStyle, hashTagStyle, containerHeight = 664, containerWidth = 375, appDomain, tagList = [], scenes, onActiveChange, activeIndex, loopPlay = false, pointerEvents = 'none' }) => {
|
200
|
+
const DiyStoryPreview = ({ data = [], globalConfig, tipText, nudge, tempMap, descStyle, hashTagStyle, containerHeight = 664, containerWidth = 375, appDomain, tagList = [], scenes, onActiveChange, activeIndex, loopPlay = false, pointerEvents = 'none', isPlay }) => {
|
201
201
|
const [loopPlaySwiper, setLooPlaySwiper] = (0, react_1.useState)(loopPlay);
|
202
202
|
const swiperRef = (0, react_1.useRef)(null);
|
203
203
|
const height = (0, react_1.useMemo)(() => {
|
@@ -223,7 +223,7 @@ const DiyStoryPreview = ({ data = [], globalConfig, tipText, nudge, tempMap, des
|
|
223
223
|
const renderContent = (rec, index) => {
|
224
224
|
const isVideo = isVideoUrl(rec === null || rec === void 0 ? void 0 : rec.mediaUrl);
|
225
225
|
if (isVideo) {
|
226
|
-
return (react_1.default.createElement(VideoWidget_1.default, { rec: rec, index: index, muted: true, width: containerWidth, data: scenes !== null && scenes !== void 0 ? scenes : [], height: containerHeight, activeIndex: index, videoPostConfig: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.videoPost, swiperRef: swiperRef, loopPlay: loopPlaySwiper }));
|
226
|
+
return (react_1.default.createElement(VideoWidget_1.default, { isPlay: isPlay, rec: rec, index: index, muted: true, width: containerWidth, data: scenes !== null && scenes !== void 0 ? scenes : [], height: containerHeight, activeIndex: index, videoPostConfig: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.videoPost, videoPlayIcon: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.videoPlayIcon, swiperRef: swiperRef, loopPlay: loopPlaySwiper }));
|
227
227
|
}
|
228
228
|
else {
|
229
229
|
return (react_1.default.createElement(PictureGroup_1.default, { key: rec.itemId, imgUrls: [rec === null || rec === void 0 ? void 0 : rec.mediaUrl], width: containerWidth, height: containerHeight, rec: rec, index: index, imgUrlsPostConfig: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.imgUrlsPost, data: scenes !== null && scenes !== void 0 ? scenes : [], swiperRef: swiperRef, loopPlay: loopPlaySwiper }));
|
@@ -236,14 +236,6 @@ const DiyStoryPreview = ({ data = [], globalConfig, tipText, nudge, tempMap, des
|
|
236
236
|
}
|
237
237
|
return null;
|
238
238
|
}, [globalConfig]);
|
239
|
-
const CTA = (rec, index) => {
|
240
|
-
if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowCTA) === undefined || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowCTA)) {
|
241
|
-
console.log(globalConfig, rec, '111');
|
242
|
-
return (react_1.default.createElement("div", { className: 'clc-sxp-bottom-card' },
|
243
|
-
react_1.default.createElement(RenderCard_1.default, { rec: rec, index: index, tempMap: tempMap, resolver: RESOLVER })));
|
244
|
-
}
|
245
|
-
return null;
|
246
|
-
};
|
247
239
|
const renderBottom = (rec, index) => {
|
248
240
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
249
241
|
if (rec === null || rec === void 0 ? void 0 : rec.video) {
|
@@ -345,6 +337,7 @@ const DiyStoryPreview = ({ data = [], globalConfig, tipText, nudge, tempMap, des
|
|
345
337
|
var _a, _b, _c, _d;
|
346
338
|
const rec = (0, lodash_1.cloneDeep)(recData);
|
347
339
|
rec.video.bindProducts = item === null || item === void 0 ? void 0 : item.bindProducts;
|
340
|
+
rec.video.title = (item === null || item === void 0 ? void 0 : item.title) || '';
|
348
341
|
return (react_1.default.createElement("div", { style: { position: 'relative' } },
|
349
342
|
react_1.default.createElement(react_2.SwiperSlide, { key: index, virtualIndex: index, style: { overflow: 'hidden', position: 'relative' } },
|
350
343
|
renderBottom(rec, index),
|
@@ -366,14 +359,26 @@ const DiyStoryPreview = ({ data = [], globalConfig, tipText, nudge, tempMap, des
|
|
366
359
|
(_b = (_a = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _a === void 0 ? void 0 : _a.swiper) === null || _b === void 0 ? void 0 : _b.slideTo(activeIndex);
|
367
360
|
}, [activeIndex]);
|
368
361
|
(0, react_1.useEffect)(() => {
|
369
|
-
var _a, _b;
|
370
362
|
if (!(swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current))
|
371
363
|
return;
|
372
|
-
(
|
364
|
+
setLooPlaySwiper(loopPlay);
|
373
365
|
}, [loopPlay]);
|
366
|
+
const handleSessionExpire = (0, react_1.useCallback)((0, lodash_1.debounce)(() => {
|
367
|
+
setLooPlaySwiper(false);
|
368
|
+
}, 1000), []);
|
369
|
+
(0, react_1.useEffect)(() => {
|
370
|
+
const events = ['touchstart', 'touchcancel'];
|
371
|
+
events.forEach((event) => {
|
372
|
+
window.addEventListener(event, handleSessionExpire);
|
373
|
+
});
|
374
|
+
return () => {
|
375
|
+
events.forEach((event) => {
|
376
|
+
window.removeEventListener(event, handleSessionExpire);
|
377
|
+
});
|
378
|
+
};
|
379
|
+
}, [handleSessionExpire]);
|
374
380
|
return (react_1.default.createElement("div", { id: 'sxp-render', style: { height: containerHeight, position: 'relative', pointerEvents } },
|
375
381
|
react_1.default.createElement(react_2.Swiper, { ref: swiperRef, allowTouchMove: pointerEvents !== 'none', onSlideChange: () => {
|
376
|
-
setLooPlaySwiper(false);
|
377
382
|
swiperRef.current.swiper.allowTouchMove = false;
|
378
383
|
setTimeout(() => {
|
379
384
|
swiperRef.current.swiper.allowTouchMove = true;
|
@@ -12,19 +12,19 @@ Object.values(_materials_).forEach((v) => {
|
|
12
12
|
RESOLVER[v.extend.type] = v;
|
13
13
|
});
|
14
14
|
const SxpPageCore = ({ data, maxSize = 10, defaultSize = 10, hashTagSize = 20, loadingImage, appDomain, enabledMetaConversionApi, dataList, pointerEvents }) => {
|
15
|
-
var _a, _b, _c, _d, _e, _f;
|
15
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
16
16
|
const utmVal = (0, react_1.useMemo)(() => {
|
17
17
|
var _a;
|
18
18
|
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('?', '') : '';
|
19
19
|
return searchParams;
|
20
20
|
}, []);
|
21
|
-
const [_schema, setSchema] = (0, react_1.useState)(data === null || data === void 0 ? void 0 : data.data);
|
21
|
+
const [_schema, setSchema] = (0, react_1.useState)((_a = data === null || data === void 0 ? void 0 : data.data) === null || _a === void 0 ? void 0 : _a.data);
|
22
22
|
const [channel, setChannel] = (0, react_1.useState)();
|
23
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: (
|
25
|
-
var _a;
|
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: (_c = (_b = data === null || data === void 0 ? void 0 : data.sxp_parameter) === null || _b === void 0 ? void 0 : _b.personalized_recommend) !== null && _c !== void 0 ? _c : maxSize, defaultSize: (_e = (_d = data === null || data === void 0 ? void 0 : data.sxp_parameter) === null || _d === void 0 ? void 0 : _d.default_recommend) !== null && _e !== void 0 ? _e : defaultSize, hashTagSize: (_g = (_f = data === null || data === void 0 ? void 0 : data.sxp_parameter) === null || _f === void 0 ? void 0 : _f.hash_tag_size) !== null && _g !== void 0 ? _g : hashTagSize, loadingImage: loadingImage, appDomain: appDomain, enabledMetaConversionApi: enabledMetaConversionApi, utmParameter: data === null || data === void 0 ? void 0 : data.utm_parameter, data: Object.assign(Object.assign({}, data), { data: (_h = data === null || data === void 0 ? void 0 : data.data) === null || _h === void 0 ? void 0 : _h.data }), dataList: dataList, onUpdateSchema: (d) => setSchema(d), onUpdateChannel: (d) => setChannel(d), render: ({ rtcList, tagList, pageData }) => {
|
25
|
+
var _a, _b;
|
26
26
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
27
|
-
react_1.default.createElement(DiyStoryPreview_1.default, Object.assign({ defaultData: data }, (
|
27
|
+
react_1.default.createElement(DiyStoryPreview_1.default, Object.assign({ defaultData: Object.assign(Object.assign({}, data), { data: (_a = data === null || data === void 0 ? void 0 : data.data) === null || _a === void 0 ? void 0 : _a.data }) }, (_b = pageData === null || pageData === void 0 ? void 0 : pageData.data) === null || _b === void 0 ? void 0 : _b.sxpPageConf, { tagList: tagList, scenes: rtcList, resolver: RESOLVER, containerHeight: window === null || window === void 0 ? void 0 : window.innerHeight, pointerEvents: pointerEvents, loopPlay: true })),
|
28
28
|
react_1.default.createElement(Popup_1.default, null)));
|
29
29
|
} })));
|
30
30
|
};
|
@@ -4,9 +4,9 @@ exports.EditorCore = exports.EditorContext = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
5
5
|
const react_1 = tslib_1.__importStar(require("react"));
|
6
6
|
const lodash_1 = require("lodash");
|
7
|
+
const localStore_1 = require("../utils/localStore");
|
7
8
|
const DataSourceProvider_1 = tslib_1.__importDefault(require("./DataSourceProvider"));
|
8
9
|
const tool_1 = require("../../core/utils/tool");
|
9
|
-
const localStore_1 = require("../utils/localStore");
|
10
10
|
const item = {
|
11
11
|
id: (0, tool_1.uuid)(6, 10),
|
12
12
|
item: {
|
@@ -131,7 +131,7 @@ export interface SxpDataSourceProviderProps {
|
|
131
131
|
isEditor?: boolean;
|
132
132
|
utmParameter?: PageData['utm_parameter'];
|
133
133
|
channelQueryList?: any[];
|
134
|
-
data?:
|
134
|
+
data?: any;
|
135
135
|
dataList?: PageData[];
|
136
136
|
onUpdateSchema?: (d: PageData['data']) => void;
|
137
137
|
onUpdateChannel?: (d: string) => void;
|