pb-sxp-ui 1.15.20 → 1.15.22-alpha.1
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 +7705 -7259
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +46 -46
- package/dist/index.js +7705 -7260
- 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 +7705 -7259
- 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/Pagebuilder/type.d.ts +10 -5
- package/es/core/components/DiyStoryPreview/PictureGroup.d.ts +16 -0
- package/es/core/components/DiyStoryPreview/PictureGroup.js +34 -0
- package/es/core/components/DiyStoryPreview/VideoWidget.d.ts +27 -0
- package/es/core/components/DiyStoryPreview/VideoWidget.js +197 -0
- package/es/core/components/DiyStoryPreview/index.d.ts +32 -0
- package/es/core/components/DiyStoryPreview/index.js +410 -0
- package/es/core/components/SxpPageCore/index.js +6 -4
- package/es/core/components/SxpPageRender/index.d.ts +0 -1
- package/es/core/components/SxpPageRender/typing.d.ts +19 -0
- package/es/core/context/SxpDataSourceProvider.d.ts +2 -1
- package/es/core/context/SxpDataSourceProvider.js +48 -97
- package/es/index.d.ts +1 -0
- package/es/index.js +1 -0
- package/es/materials/sxp/popup/CommodityDetail/index.js +2 -2
- package/es/materials/sxp/popup/CommodityDetailDiroNew/index.js +1 -1
- package/lib/core/Pagebuilder/type.d.ts +10 -5
- package/lib/core/components/DiyStoryPreview/PictureGroup.d.ts +16 -0
- package/lib/core/components/DiyStoryPreview/PictureGroup.js +37 -0
- package/lib/core/components/DiyStoryPreview/VideoWidget.d.ts +27 -0
- package/lib/core/components/DiyStoryPreview/VideoWidget.js +200 -0
- package/lib/core/components/DiyStoryPreview/index.d.ts +32 -0
- package/lib/core/components/DiyStoryPreview/index.js +413 -0
- package/lib/core/components/SxpPageCore/index.js +6 -4
- package/lib/core/components/SxpPageRender/index.d.ts +0 -1
- package/lib/core/components/SxpPageRender/typing.d.ts +19 -0
- package/lib/core/context/SxpDataSourceProvider.d.ts +2 -1
- package/lib/core/context/SxpDataSourceProvider.js +48 -97
- package/lib/index.d.ts +1 -0
- package/lib/index.js +3 -1
- package/lib/materials/sxp/popup/CommodityDetail/index.js +2 -2
- package/lib/materials/sxp/popup/CommodityDetailDiroNew/index.js +1 -1
- package/package.json +1 -1
@@ -0,0 +1,410 @@
|
|
1
|
+
import React, { forwardRef, memo, useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
|
2
|
+
import { Swiper, SwiperSlide } from 'swiper/react';
|
3
|
+
import { debounce } from 'lodash';
|
4
|
+
import RenderCard from '../SxpPageRender/RenderCard';
|
5
|
+
import ExpandableText from '../SxpPageRender/ExpandableText';
|
6
|
+
import LikeButton from '../SxpPageRender/LikeButton';
|
7
|
+
import { useIconLink } from '../SxpPageRender/useIconLink';
|
8
|
+
import ToggleButton from '../SxpPageRender/ToggleButton';
|
9
|
+
import PictureGroup from './PictureGroup';
|
10
|
+
import VideoWidget from './VideoWidget';
|
11
|
+
import * as _materials_ from '../../../materials';
|
12
|
+
import '../SxpPageRender/index.less';
|
13
|
+
const recData = {
|
14
|
+
position: 0,
|
15
|
+
isCollected: false,
|
16
|
+
product: null,
|
17
|
+
video: {
|
18
|
+
appId: null,
|
19
|
+
itemId: 'VIDEOSsRgI1695278974368',
|
20
|
+
title: '8张尺寸不一样的图片8张尺寸不一样的图片8张尺寸不一样的图片8张尺寸不一样的图片8张尺寸不一样的图片8张尺寸不一样的图片8张尺寸不一样的图片8张尺寸不一样的图片8张尺寸不一样的图片8张尺寸不一样的图片8张尺寸不一样的图片',
|
21
|
+
enTitle: null,
|
22
|
+
icon: null,
|
23
|
+
cover: 'https://graff-cdn.chatlabs.net/dev/img/8922b5b8-a954-4a61-9ffc-80edebdf02b4/sxp-portal/20231017/fsJFWmW1dGyW7XmDspbJPTn5esL3U1697538777398.png',
|
24
|
+
link: null,
|
25
|
+
linkTitle: null,
|
26
|
+
linkType: null,
|
27
|
+
menuCategoryId: null,
|
28
|
+
remark: null,
|
29
|
+
tags: [
|
30
|
+
'Gift-Giving',
|
31
|
+
'Daily Wear',
|
32
|
+
'Business Formal',
|
33
|
+
'Sports/Casual',
|
34
|
+
'Anniversary Gifts',
|
35
|
+
'Wedding/Engagement',
|
36
|
+
'Formal Dinner/Party'
|
37
|
+
],
|
38
|
+
traceInfo: ':VIDEO:VIDEOSsRgI1695278974368:regular:1:VPRHSkRS1697701789894:main::0:EXPMW20250305155940:COMBTh20250305160047:',
|
39
|
+
value: 385,
|
40
|
+
weight: null,
|
41
|
+
bindCta: null,
|
42
|
+
bindProduct: null,
|
43
|
+
bindProducts: [
|
44
|
+
{
|
45
|
+
appId: 'wx448578f8851f3dce',
|
46
|
+
itemId: 'test02178888',
|
47
|
+
title: 'christian dior小包包 新CDN',
|
48
|
+
enTitle: null,
|
49
|
+
icon: null,
|
50
|
+
cover: 'https://graff-cdn.chatlabs.net/dev/img/8922b5b8-a954-4a61-9ffc-80edebdf02b4/sxp-portal/20240913/fs2jqiurjftpoaba67iiwr9jt5sc31726213277754.avif',
|
51
|
+
link: '/pages/details/index?spu_id=1702262707659534338',
|
52
|
+
linkTitle: '',
|
53
|
+
linkType: 'MP',
|
54
|
+
menuCategoryId: null,
|
55
|
+
remark: null,
|
56
|
+
tags: [],
|
57
|
+
traceInfo: ':PRODUCT:test02178888:regular:1:VPRHSkRS1697701789894:main::0:EXPMW20250305155940:COMBTh20250305160047:',
|
58
|
+
value: null,
|
59
|
+
weight: null,
|
60
|
+
bindCta: {
|
61
|
+
appId: 'wx448578f8851f3dce',
|
62
|
+
itemId: 'CTA3KofE1716186622249',
|
63
|
+
title: 'SHOP NOW 立即购买',
|
64
|
+
enTitle: 'BUY NOW立即购买,选择你所喜爱的;',
|
65
|
+
icon: 'https://graff-cdn.chatlabs.net/dev/img/8922b5b8-a954-4a61-9ffc-80edebdf02b4/sxp-portal/20240520/fssfxbmiwghixmgblz9uriwennd2r1716186615574.avif',
|
66
|
+
cover: null,
|
67
|
+
link: '/pages/details/index?spu_id=1702262707659534338',
|
68
|
+
linkTitle: '',
|
69
|
+
linkType: 'MP',
|
70
|
+
menuCategoryId: '64b60b202caf0e1c1ce1e17d',
|
71
|
+
remark: null,
|
72
|
+
tags: [
|
73
|
+
"Woman's Perfumes",
|
74
|
+
'Plates & Bowls',
|
75
|
+
'Glasses',
|
76
|
+
'Multicolor',
|
77
|
+
'Carafes',
|
78
|
+
'Tea & Coffee',
|
79
|
+
'Green',
|
80
|
+
'Grey',
|
81
|
+
'Cutlery'
|
82
|
+
],
|
83
|
+
traceInfo: ':CTA:CTA3KofE1716186622249:regular:1:VPRHSkRS1697701789894:main::0:EXPMW20250305155940:COMBTh20250305160047:',
|
84
|
+
value: null,
|
85
|
+
weight: null
|
86
|
+
},
|
87
|
+
collection: 'Ricco',
|
88
|
+
currency: 'INR-₹',
|
89
|
+
homePage: [
|
90
|
+
'https://graff-cdn.chatlabs.net/dev/img/8922b5b8-a954-4a61-9ffc-80edebdf02b4/sxp-portal/20240913/fs2jqiurjftpoaba67iiwr9jt5sc31726213277754.avif',
|
91
|
+
'https://graff-cdn.chatlabs.net/dev/img/8922b5b8-a954-4a61-9ffc-80edebdf02b4/sxp-portal/20240913/fsr9ttuzuljs85smqi6lsidovnyoy1726213285994.avif',
|
92
|
+
'https://graff-cdn.chatlabs.net/dev/img/8922b5b8-a954-4a61-9ffc-80edebdf02b4/sxp-portal/20240913/fsknmfhx2lxukxews05guwwxr8rju1726213281108.avif',
|
93
|
+
'https://graff-cdn.chatlabs.net/dev/img/8922b5b8-a954-4a61-9ffc-80edebdf02b4/sxp-portal/20240913/fs0acnua4f1clamdpwdsrh0v5dgc61726213289247.avif'
|
94
|
+
],
|
95
|
+
info: 'test',
|
96
|
+
price: 53200,
|
97
|
+
shippingInfo: null,
|
98
|
+
taxInfo: null
|
99
|
+
},
|
100
|
+
{
|
101
|
+
appId: null,
|
102
|
+
itemId: '113J631A0684_C520',
|
103
|
+
title: 'Sweatshirt à capuche Dior Oblique, coupe relax',
|
104
|
+
enTitle: null,
|
105
|
+
icon: null,
|
106
|
+
cover: 'https://graff-cdn.chatlabs.net/dev/img/8922b5b8-a954-4a61-9ffc-80edebdf02b4/sxp-portal/20241115/fsaf0xq8vx8gkkl30y1h1swpinmbt1731661943891.avif',
|
107
|
+
link: 'https://www.dior.com/fr_fr/fashion/products/113J631A0684_C520',
|
108
|
+
linkTitle: null,
|
109
|
+
linkType: 'WEB',
|
110
|
+
menuCategoryId: null,
|
111
|
+
remark: null,
|
112
|
+
tags: [],
|
113
|
+
traceInfo: ':PRODUCT:113J631A0684_C520:regular:1:VPRHSkRS1697701789894:main::0:EXPMW20250305155940:COMBTh20250305160047:',
|
114
|
+
value: null,
|
115
|
+
weight: null,
|
116
|
+
bindCta: {
|
117
|
+
appId: null,
|
118
|
+
itemId: 'CTAAfaKf1730796437032',
|
119
|
+
title: 'test',
|
120
|
+
enTitle: 'test',
|
121
|
+
icon: 'https://graff-cdn.chatlabs.net/dev/img/8922b5b8-a954-4a61-9ffc-80edebdf02b4/sxp-portal/20241105/fsjblxoud2tmehpiqqomh0oktwqrd1730796431496.avif',
|
122
|
+
cover: null,
|
123
|
+
link: null,
|
124
|
+
linkTitle: null,
|
125
|
+
linkType: null,
|
126
|
+
menuCategoryId: '64b60b202caf0e1c1ce1e17d',
|
127
|
+
remark: '',
|
128
|
+
tags: [],
|
129
|
+
traceInfo: ':CTA:CTAAfaKf1730796437032:regular:1:VPRHSkRS1697701789894:main::0:EXPMW20250305155940:COMBTh20250305160047:',
|
130
|
+
value: null,
|
131
|
+
weight: null
|
132
|
+
},
|
133
|
+
collection: 'Jacquard de coton éponge bleu',
|
134
|
+
currency: 'EUR-€',
|
135
|
+
homePage: [
|
136
|
+
'https://graff-cdn.chatlabs.net/dev/img/8922b5b8-a954-4a61-9ffc-80edebdf02b4/sxp-portal/20241115/fsaf0xq8vx8gkkl30y1h1swpinmbt1731661943891.avif',
|
137
|
+
'https://graff-cdn.chatlabs.net/dev/img/8922b5b8-a954-4a61-9ffc-80edebdf02b4/sxp-portal/20241115/fszxkdcjfjql2oiy90ffbal5tsfd81731661964913.avif',
|
138
|
+
'https://graff-cdn.chatlabs.net/dev/img/8922b5b8-a954-4a61-9ffc-80edebdf02b4/sxp-portal/20241115/fs1jhd9jwxvfqmrbjwy5abfzb0fde1731661994996.avif'
|
139
|
+
],
|
140
|
+
info: "Le sweatshirt à capuche bleu met à l'honneur l'emblématique motif dior oblique. Confectionné en jacquard de coton éponge bleu, il présente une coupe relax très confortable. Doté de poches latérales fendues, ce sweatshirt à capuche s'associera à tous vos jeans ou pantalons de survêtement pour un look décontracté.. Sweatshirt à capuche dior oblique, coupe relax Jacquard de coton éponge bleu",
|
141
|
+
price: 1800,
|
142
|
+
shippingInfo: null,
|
143
|
+
taxInfo: null
|
144
|
+
},
|
145
|
+
{
|
146
|
+
appId: null,
|
147
|
+
itemId: 'S5573CRIW_M928',
|
148
|
+
title: 'Mini Dior Book Tote',
|
149
|
+
enTitle: null,
|
150
|
+
icon: null,
|
151
|
+
cover: 'https://graff-cdn.chatlabs.net/dev/img/8922b5b8-a954-4a61-9ffc-80edebdf02b4/sxp-portal/20250213/fsvewk9etrawxrzznmvvewgt1bctu1739415576729.avif',
|
152
|
+
link: 'https://www.dior.com/en_gb/fashion/products/S5573CRIW_M928',
|
153
|
+
linkTitle: null,
|
154
|
+
linkType: 'WEB',
|
155
|
+
menuCategoryId: null,
|
156
|
+
remark: null,
|
157
|
+
tags: ['ダイヤモンド'],
|
158
|
+
traceInfo: ':PRODUCT:S5573CRIW_M928:regular:1:VPRHSkRS1697701789894:main::0:EXPMW20250305155940:COMBTh20250305160047:',
|
159
|
+
value: null,
|
160
|
+
weight: null,
|
161
|
+
bindCta: null,
|
162
|
+
collection: null,
|
163
|
+
currency: 'GBP-£',
|
164
|
+
homePage: [
|
165
|
+
'https://graff-cdn.chatlabs.net/dev/img/8922b5b8-a954-4a61-9ffc-80edebdf02b4/sxp-portal/20250213/fsvewk9etrawxrzznmvvewgt1bctu1739415576729.avif',
|
166
|
+
'https://graff-cdn.chatlabs.net/dev/img/8922b5b8-a954-4a61-9ffc-80edebdf02b4/sxp-portal/20250213/fsngtlvhid7xwt5if0viw7vqanm831739415582147.avif',
|
167
|
+
'https://graff-cdn.chatlabs.net/dev/img/8922b5b8-a954-4a61-9ffc-80edebdf02b4/sxp-portal/20250213/fs4hotdvyzjtnqb9vszlynuzplddc1739415586910.avif',
|
168
|
+
'https://graff-cdn.chatlabs.net/dev/img/8922b5b8-a954-4a61-9ffc-80edebdf02b4/sxp-portal/20250213/fswffx9kwexf3z3vcnxisut1qxtez1739415591629.avif',
|
169
|
+
'https://graff-cdn.chatlabs.net/dev/img/8922b5b8-a954-4a61-9ffc-80edebdf02b4/sxp-portal/20250213/fsbfsi7tttx1hnzldoiw7eoea7fvh1739415597388.avif'
|
170
|
+
],
|
171
|
+
info: "The Dior Book Tote is a House classic and original design by Maria Grazia Chiuri, Creative Director of Christian Dior. The style is fully embroidered with the House's hallmark blue Dior Oblique motif and showcases the Christian Dior Paris signature. Exemplifying House savoir-faire, the miniature style features an adjustable and removable strap that allows it to be carried by hand, worn over the shoulder or crossbody.",
|
172
|
+
price: 1950,
|
173
|
+
shippingInfo: null,
|
174
|
+
taxInfo: null
|
175
|
+
}
|
176
|
+
],
|
177
|
+
url: null,
|
178
|
+
blockCta: 1,
|
179
|
+
blockProduct: 1,
|
180
|
+
hashTags: [
|
181
|
+
'Sports/Casual',
|
182
|
+
'Formal Dinner/Party',
|
183
|
+
'Business Formal',
|
184
|
+
'Wedding/Engagement',
|
185
|
+
'Gift-Giving',
|
186
|
+
'Daily Wear',
|
187
|
+
'Anniversary Gifts'
|
188
|
+
]
|
189
|
+
}
|
190
|
+
};
|
191
|
+
const RESOLVER = {};
|
192
|
+
Object.values(_materials_).forEach((v) => {
|
193
|
+
RESOLVER[v.extend.type] = v;
|
194
|
+
});
|
195
|
+
const defaultUnLikeIconPath = '/pb_static/f71266d2c64446c5ae6a5a7f5489cc0a.png';
|
196
|
+
const defaultLikeIconPath = '/pb_static/f07900fe3f0f4ae188ea1611d4801a44.png';
|
197
|
+
const DiyStoryPreview = forwardRef(({ data = [], globalConfig, tipText, nudge, tempMap, descStyle, hashTagStyle, containerHeight = 664, containerWidth = 375, appDomain, tagList = [], onActiveChange, activeIndex, loopPlay = false, pointerEvents = 'none', onUpdateTimeLine, disabledListener, onPlay, onPause }, ref) => {
|
198
|
+
const videoWidgetRef = useRef(null);
|
199
|
+
const swiperRef = useRef(null);
|
200
|
+
const [curIndex, setCurIndex] = useState(0);
|
201
|
+
const height = useMemo(() => {
|
202
|
+
let minusHeight = 0;
|
203
|
+
if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.logoUrl) && (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowLogo)) {
|
204
|
+
minusHeight += 45;
|
205
|
+
}
|
206
|
+
if (tagList.length > 0) {
|
207
|
+
minusHeight += 45;
|
208
|
+
}
|
209
|
+
return containerHeight - minusHeight;
|
210
|
+
}, [globalConfig, containerHeight, tagList]);
|
211
|
+
useImperativeHandle(ref, () => {
|
212
|
+
return {
|
213
|
+
play() {
|
214
|
+
var _a;
|
215
|
+
(_a = videoWidgetRef === null || videoWidgetRef === void 0 ? void 0 : videoWidgetRef.current) === null || _a === void 0 ? void 0 : _a.play();
|
216
|
+
},
|
217
|
+
pause() {
|
218
|
+
var _a;
|
219
|
+
(_a = videoWidgetRef === null || videoWidgetRef === void 0 ? void 0 : videoWidgetRef.current) === null || _a === void 0 ? void 0 : _a.pause();
|
220
|
+
},
|
221
|
+
slideTo(n) {
|
222
|
+
var _a, _b;
|
223
|
+
if (!(swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current))
|
224
|
+
return;
|
225
|
+
(_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(n);
|
226
|
+
},
|
227
|
+
isPlaying() {
|
228
|
+
var _a, _b;
|
229
|
+
return (_b = (_a = videoWidgetRef === null || videoWidgetRef === void 0 ? void 0 : videoWidgetRef.current) === null || _a === void 0 ? void 0 : _a.isPlaying()) !== null && _b !== void 0 ? _b : false;
|
230
|
+
}
|
231
|
+
};
|
232
|
+
});
|
233
|
+
const isVideoUrl = (url) => {
|
234
|
+
if (url && url !== '' && typeof url === 'string') {
|
235
|
+
const imageExtensions = ['.mp4', '.m3u8'];
|
236
|
+
const lowerCaseUrl = url === null || url === void 0 ? void 0 : url.toLowerCase();
|
237
|
+
return imageExtensions.some((ext) => lowerCaseUrl === null || lowerCaseUrl === void 0 ? void 0 : lowerCaseUrl.endsWith(ext));
|
238
|
+
}
|
239
|
+
else {
|
240
|
+
return false;
|
241
|
+
}
|
242
|
+
};
|
243
|
+
const renderContent = (rec, index) => {
|
244
|
+
var _a, _b;
|
245
|
+
const scene = (_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.scene;
|
246
|
+
const isVideo = isVideoUrl(scene === null || scene === void 0 ? void 0 : scene.mediaUrl);
|
247
|
+
if (isVideo) {
|
248
|
+
return (React.createElement(VideoWidget, Object.assign({ key: index }, (curIndex === index && { ref: videoWidgetRef }), { rec: rec, index: index, muted: true, width: containerWidth, data: data, 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: loopPlay, onUpdateTimeLine: onUpdateTimeLine, onPlay: onPlay, onPause: onPause })));
|
249
|
+
}
|
250
|
+
else {
|
251
|
+
return (React.createElement(PictureGroup, { key: index, imgUrls: [(_b = scene === null || scene === void 0 ? void 0 : scene.mediaUrl) !== null && _b !== void 0 ? _b : ''], width: containerWidth, height: containerHeight, rec: rec, index: index, imgUrlsPostConfig: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.imgUrlsPost, data: data, swiperRef: swiperRef }));
|
252
|
+
}
|
253
|
+
};
|
254
|
+
const renderLogo = useMemo(() => {
|
255
|
+
if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.logoUrl) && (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowLogo)) {
|
256
|
+
return (React.createElement("div", { className: 'clc-sxp-logo-banner', style: { backgroundColor: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.color } },
|
257
|
+
React.createElement("img", { src: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.logoUrl, alt: 'logo' })));
|
258
|
+
}
|
259
|
+
return null;
|
260
|
+
}, [globalConfig]);
|
261
|
+
const renderBottom = (rec, index) => {
|
262
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
263
|
+
if (rec === null || rec === void 0 ? void 0 : rec.video) {
|
264
|
+
let cta = null;
|
265
|
+
if ((_b = (_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.bindProducts) === null || _b === void 0 ? void 0 : _b.length) {
|
266
|
+
cta = '多商品CTA';
|
267
|
+
}
|
268
|
+
else if ((_c = rec === null || rec === void 0 ? void 0 : rec.video) === null || _c === void 0 ? void 0 : _c.bindProduct) {
|
269
|
+
cta = '商品CTA';
|
270
|
+
}
|
271
|
+
else {
|
272
|
+
cta = (_e = (_d = rec === null || rec === void 0 ? void 0 : rec.video) === null || _d === void 0 ? void 0 : _d.bindCta) === null || _e === void 0 ? void 0 : _e.itemId;
|
273
|
+
}
|
274
|
+
const value = tempMap === null || tempMap === void 0 ? void 0 : tempMap[cta];
|
275
|
+
return (React.createElement(React.Fragment, null,
|
276
|
+
((_f = rec === null || rec === void 0 ? void 0 : rec.video) === null || _f === void 0 ? void 0 : _f.title) && (React.createElement("div", { style: {
|
277
|
+
background: 'repeating-linear-gradient(0deg, rgba(26, 26, 25, 0.7), hsla(0, 0%, 100%, 0))',
|
278
|
+
height: '130px',
|
279
|
+
position: 'absolute',
|
280
|
+
bottom: 0,
|
281
|
+
width: '100%',
|
282
|
+
willChange: 'transform',
|
283
|
+
zIndex: 2,
|
284
|
+
pointerEvents
|
285
|
+
} })),
|
286
|
+
React.createElement("div", { style: {
|
287
|
+
marginBottom: `${(_g = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.bottomInfoDist) !== null && _g !== void 0 ? _g : 40}px`,
|
288
|
+
zIndex: 999,
|
289
|
+
position: 'absolute',
|
290
|
+
bottom: 0,
|
291
|
+
left: 0,
|
292
|
+
right: 0,
|
293
|
+
paddingTop: '20px'
|
294
|
+
} },
|
295
|
+
(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowCTA) === undefined || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowCTA) ? (React.createElement("div", { style: {} },
|
296
|
+
React.createElement(RenderCard, { rec: rec, index: index, tempMap: tempMap, resolver: RESOLVER, isActive: index === activeIndex, value: value }))) : null,
|
297
|
+
React.createElement("div", null,
|
298
|
+
React.createElement(ExpandableText, { isPost: true, foldText: tipText === null || tipText === void 0 ? void 0 : tipText.foldText, unfoldText: tipText === null || tipText === void 0 ? void 0 : tipText.unfoldText, text: (_j = (_h = rec === null || rec === void 0 ? void 0 : rec.video) === null || _h === void 0 ? void 0 : _h.title) !== null && _j !== void 0 ? _j : '', style: Object.assign(Object.assign({}, descStyle), { textShadow: (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isOpenTextShadow) ? '2px 2px 4px rgba(0, 0, 0, 0.5)' : 'none', padding: '0 20px', fontSize: '12px' }) }),
|
299
|
+
React.createElement(RenderCard, { rec: rec, index: index, tempMap: tempMap, resolver: RESOLVER, includesCtaType: ['AniLink'], isActive: index === activeIndex, value: value }))),
|
300
|
+
React.createElement(RenderCard, { rec: rec, index: index, tempMap: tempMap, resolver: RESOLVER, includesCtaType: ['AniLinkPopup'], isActive: index === activeIndex, value: value })));
|
301
|
+
}
|
302
|
+
return null;
|
303
|
+
};
|
304
|
+
const likeIcon = useIconLink(defaultLikeIconPath, appDomain);
|
305
|
+
const unlikeIcon = useIconLink(defaultUnLikeIconPath, appDomain);
|
306
|
+
const renderLikeButton = (rec, index) => {
|
307
|
+
var _a, _b, _c, _d;
|
308
|
+
if (!(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowLike))
|
309
|
+
return null;
|
310
|
+
let top = (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIconY) !== null && _a !== void 0 ? _a : 400;
|
311
|
+
if (top < 40) {
|
312
|
+
top += 40;
|
313
|
+
}
|
314
|
+
if (rec === null || rec === void 0 ? void 0 : rec.video) {
|
315
|
+
return (React.createElement(LikeButton, { key: rec.position, activeIcon: (_b = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIcon) !== null && _b !== void 0 ? _b : likeIcon, unActicveIcon: (_c = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.unlikeIcon) !== null && _c !== void 0 ? _c : unlikeIcon, position: index, active: rec.isCollected, recData: rec, style: {
|
316
|
+
top,
|
317
|
+
right: (_d = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIconX) !== null && _d !== void 0 ? _d : 0,
|
318
|
+
position: 'absolute',
|
319
|
+
zIndex: 999,
|
320
|
+
backgroundColor: 'transparent',
|
321
|
+
width: '50px',
|
322
|
+
height: '50px',
|
323
|
+
outline: 'none',
|
324
|
+
border: 'none',
|
325
|
+
boxSizing: 'content-box',
|
326
|
+
padding: 0,
|
327
|
+
transform: 'translate3d(0px, 0px, 0px)'
|
328
|
+
} }));
|
329
|
+
}
|
330
|
+
return null;
|
331
|
+
};
|
332
|
+
const mutedIcon = useIconLink('/pb_static/5beaaa5ce7f3477b99db3838619cc471.png', appDomain);
|
333
|
+
const unmutedIcon = useIconLink('/pb_static/fea8668a8a894e4aa3a86bcc775e895e.png', appDomain);
|
334
|
+
const renderToggleButton = (visible) => {
|
335
|
+
var _a, _b, _c, _d;
|
336
|
+
if (!visible)
|
337
|
+
return null;
|
338
|
+
let top = (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconY) !== null && _a !== void 0 ? _a : 23;
|
339
|
+
if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconYPosit) === 'top') {
|
340
|
+
top += 45;
|
341
|
+
}
|
342
|
+
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: {
|
343
|
+
position: 'absolute',
|
344
|
+
visibility: 'visible',
|
345
|
+
zIndex: 999,
|
346
|
+
transform: 'translate3d(0px,0px,0px)',
|
347
|
+
[(_b = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconXPosit) !== null && _b !== void 0 ? _b : 'right']: (_c = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconX) !== null && _c !== void 0 ? _c : 0,
|
348
|
+
[(_d = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconYPosit) !== null && _d !== void 0 ? _d : 'bottom']: top,
|
349
|
+
backgroundColor: 'transparent',
|
350
|
+
width: '50px',
|
351
|
+
height: '50px',
|
352
|
+
outline: 'none',
|
353
|
+
border: 'none',
|
354
|
+
boxSizing: 'content-box',
|
355
|
+
padding: 0
|
356
|
+
}, defaultValue: true, 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 })) : null;
|
357
|
+
};
|
358
|
+
const renderView = (item, index) => {
|
359
|
+
var _a, _b, _c, _d;
|
360
|
+
return (React.createElement("div", { style: { position: 'relative' } },
|
361
|
+
React.createElement(SwiperSlide, { key: index, virtualIndex: index, style: { overflow: 'hidden', position: 'relative' } },
|
362
|
+
renderBottom(item, index),
|
363
|
+
renderLikeButton(item, index),
|
364
|
+
renderToggleButton(!(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconFixed)),
|
365
|
+
React.createElement(ToggleButton, { style: {
|
366
|
+
position: 'absolute',
|
367
|
+
right: (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconX) !== null && _a !== void 0 ? _a : 0,
|
368
|
+
visibility: ((_c = (_b = data === null || data === void 0 ? void 0 : data[index]) === null || _b === void 0 ? void 0 : _b.video) === null || _c === void 0 ? void 0 : _c.url) ? 'visible' : 'hidden',
|
369
|
+
bottom: (_d = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconY) !== null && _d !== void 0 ? _d : 23,
|
370
|
+
zIndex: 999
|
371
|
+
}, defaultValue: true, 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 }),
|
372
|
+
renderContent(item, index))));
|
373
|
+
};
|
374
|
+
useEffect(() => {
|
375
|
+
var _a, _b;
|
376
|
+
if (!(swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current))
|
377
|
+
return;
|
378
|
+
(_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);
|
379
|
+
}, [activeIndex]);
|
380
|
+
const handleSessionExpire = useCallback(debounce(() => {
|
381
|
+
var _a;
|
382
|
+
(_a = videoWidgetRef.current) === null || _a === void 0 ? void 0 : _a.setLoopPlay(false);
|
383
|
+
}, 1000), []);
|
384
|
+
useEffect(() => {
|
385
|
+
if (disabledListener)
|
386
|
+
return;
|
387
|
+
const events = ['touchstart', 'touchcancel'];
|
388
|
+
events.forEach((event) => {
|
389
|
+
window.addEventListener(event, handleSessionExpire);
|
390
|
+
});
|
391
|
+
return () => {
|
392
|
+
events.forEach((event) => {
|
393
|
+
window.removeEventListener(event, handleSessionExpire);
|
394
|
+
});
|
395
|
+
};
|
396
|
+
}, [handleSessionExpire, disabledListener]);
|
397
|
+
return (React.createElement("div", { id: 'sxp-render', style: { height: containerHeight, position: 'relative', pointerEvents } },
|
398
|
+
React.createElement(Swiper, { ref: swiperRef, allowTouchMove: pointerEvents !== 'none', onSlideChange: () => {
|
399
|
+
swiperRef.current.swiper.allowTouchMove = false;
|
400
|
+
setTimeout(() => {
|
401
|
+
swiperRef.current.swiper.allowTouchMove = true;
|
402
|
+
}, 500);
|
403
|
+
}, onActiveIndexChange: (swiper) => {
|
404
|
+
setCurIndex(swiper === null || swiper === void 0 ? void 0 : swiper.activeIndex);
|
405
|
+
onActiveChange === null || onActiveChange === void 0 ? void 0 : onActiveChange(swiper.activeIndex);
|
406
|
+
}, direction: 'vertical', style: { overflow: 'hidden', height: containerHeight }, height: containerHeight }, data === null || data === void 0 ? void 0 : data.map((rec, index) => {
|
407
|
+
return renderView(rec, index);
|
408
|
+
}))));
|
409
|
+
});
|
410
|
+
export default memo(DiyStoryPreview);
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import React, { memo, useMemo, useState } from 'react';
|
2
2
|
import SxpPageRender from '../SxpPageRender';
|
3
3
|
import Popup from '../SxpPageRender/Popup';
|
4
|
+
import DiyStoryPreview from '../DiyStoryPreview';
|
4
5
|
import * as _materials_ from '../../../materials';
|
5
6
|
import { EditorCore } from '../../../core';
|
6
7
|
import SxpDataSourceProvider from '../../../core/context/SxpDataSourceProvider';
|
@@ -9,7 +10,8 @@ Object.values(_materials_).forEach((v) => {
|
|
9
10
|
RESOLVER[v.extend.type] = v;
|
10
11
|
});
|
11
12
|
const SxpPageCore = ({ data, maxSize = 10, defaultSize = 10, hashTagSize = 20, loadingImage, appDomain, enabledMetaConversionApi, dataList }) => {
|
12
|
-
var _a, _b, _c, _d, _e, _f;
|
13
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
14
|
+
const isDiyH5 = ((_a = data === null || data === void 0 ? void 0 : data.page_type) === null || _a === void 0 ? void 0 : _a.path_type) === 5;
|
13
15
|
const utmVal = useMemo(() => {
|
14
16
|
var _a;
|
15
17
|
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('?', '') : '';
|
@@ -18,10 +20,10 @@ const SxpPageCore = ({ data, maxSize = 10, defaultSize = 10, hashTagSize = 20, l
|
|
18
20
|
const [_schema, setSchema] = useState(data === null || data === void 0 ? void 0 : data.data);
|
19
21
|
const [channel, setChannel] = useState();
|
20
22
|
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;
|
23
|
+
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: data, dataList: dataList, isDiyH5: isDiyH5, onUpdateSchema: (d) => setSchema(d), onUpdateChannel: (d) => setChannel(d), render: ({ rtcList, tagList, pageData }) => {
|
24
|
+
var _a, _b;
|
23
25
|
return (React.createElement(React.Fragment, null,
|
24
|
-
React.createElement(
|
26
|
+
isDiyH5 ? (React.createElement(DiyStoryPreview, Object.assign({ defaultData: data }, (_a = pageData === null || pageData === void 0 ? void 0 : pageData.data) === null || _a === void 0 ? void 0 : _a.sxpPageConf, { tagList: tagList, data: rtcList, resolver: RESOLVER, containerHeight: window === null || window === void 0 ? void 0 : window.innerHeight, pointerEvents: 'all', loopPlay: true }))) : (React.createElement(SxpPageRender, Object.assign({ defaultData: data }, (_b = pageData === null || pageData === void 0 ? void 0 : pageData.data) === null || _b === void 0 ? void 0 : _b.sxpPageConf, { tagList: tagList, data: rtcList, resolver: RESOLVER }))),
|
25
27
|
React.createElement(Popup, null)));
|
26
28
|
} })));
|
27
29
|
};
|
@@ -47,6 +47,24 @@ export type ProductInfoType = {
|
|
47
47
|
cover?: string;
|
48
48
|
remark?: string;
|
49
49
|
};
|
50
|
+
export interface IScene {
|
51
|
+
blueprintStep: number;
|
52
|
+
endTime: number;
|
53
|
+
itemId: string;
|
54
|
+
mediaFileNo: string;
|
55
|
+
mediaUrl: string;
|
56
|
+
position: number;
|
57
|
+
postId: string;
|
58
|
+
sceneId: string;
|
59
|
+
sceneInfo: string;
|
60
|
+
sceneTag: string;
|
61
|
+
startTime: number;
|
62
|
+
traceInfo: string;
|
63
|
+
cover: string;
|
64
|
+
bindProducts?: any[];
|
65
|
+
title?: string;
|
66
|
+
}
|
67
|
+
export type ScenesType = IScene[];
|
50
68
|
export type VideoInfoType = {
|
51
69
|
bindCtaId: string;
|
52
70
|
bindProductId: string;
|
@@ -65,6 +83,7 @@ export type VideoInfoType = {
|
|
65
83
|
bindProduct: ProductInfoType;
|
66
84
|
bindCta: CTAInfoType;
|
67
85
|
hashTags: string[];
|
86
|
+
scene: IScene;
|
68
87
|
};
|
69
88
|
export type RecommendVideoResultType = {
|
70
89
|
recList: Array<RecItemType>;
|
@@ -72,7 +72,7 @@ export interface ISxpDataSourceContext {
|
|
72
72
|
bffFbReport?: (body: {
|
73
73
|
eventName: 'PageView' | 'ProductView' | 'ViewContent';
|
74
74
|
product?: any;
|
75
|
-
}) =>
|
75
|
+
}) => Promise<any> | undefined | boolean;
|
76
76
|
curTime?: any;
|
77
77
|
h5EnterLink?: () => void;
|
78
78
|
themeTag?: any;
|
@@ -133,6 +133,7 @@ export interface SxpDataSourceProviderProps {
|
|
133
133
|
channelQueryList?: any[];
|
134
134
|
data?: PageData;
|
135
135
|
dataList?: PageData[];
|
136
|
+
isDiyH5?: boolean;
|
136
137
|
onUpdateSchema?: (d: PageData['data']) => void;
|
137
138
|
onUpdateChannel?: (d: string) => void;
|
138
139
|
}
|