pb-sxp-ui 1.15.14 → 1.15.15-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 +824 -129
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +822 -128
- 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 +824 -129
- 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/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 +239 -0
- package/es/core/components/DiyStoryPreview/index.d.ts +51 -0
- package/es/core/components/DiyStoryPreview/index.js +411 -0
- package/es/core/components/SxpPageCore/index.d.ts +1 -0
- package/es/core/components/SxpPageCore/index.js +7 -7
- package/es/core/components/SxpPageRender/ExpandableText.js +10 -2
- package/es/core/components/SxpPageRender/RenderCard.js +4 -4
- package/es/core/context/EditorContext.js +1 -1
- package/es/core/context/SxpDataSourceProvider.d.ts +1 -1
- package/es/core/context/SxpDataSourceProvider.js +28 -41
- package/es/index.d.ts +1 -0
- package/es/index.js +1 -0
- package/es/materials/sxp/template/MultiCommodity/index.js +1 -1
- package/es/materials/sxp/template/MultiCommodityDiro/index.js +2 -1
- package/es/materials/sxp/template/MultiCommodityDiroNew/index.js +2 -1
- package/es/materials/sxp/template/components/EventProvider.js +2 -2
- 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 +242 -0
- package/lib/core/components/DiyStoryPreview/index.d.ts +51 -0
- package/lib/core/components/DiyStoryPreview/index.js +414 -0
- package/lib/core/components/SxpPageCore/index.d.ts +1 -0
- package/lib/core/components/SxpPageCore/index.js +7 -7
- package/lib/core/components/SxpPageRender/ExpandableText.js +10 -2
- package/lib/core/components/SxpPageRender/RenderCard.js +4 -4
- package/lib/core/context/EditorContext.js +1 -1
- package/lib/core/context/SxpDataSourceProvider.d.ts +1 -1
- package/lib/core/context/SxpDataSourceProvider.js +28 -41
- package/lib/index.d.ts +1 -0
- package/lib/index.js +3 -1
- package/lib/materials/sxp/template/MultiCommodity/index.js +1 -1
- package/lib/materials/sxp/template/MultiCommodityDiro/index.js +2 -1
- package/lib/materials/sxp/template/MultiCommodityDiroNew/index.js +2 -1
- package/lib/materials/sxp/template/components/EventProvider.js +2 -2
- package/package.json +1 -1
@@ -114,12 +114,8 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
114
114
|
}
|
115
115
|
if (options.type === 'beacon' && navigator.sendBeacon) {
|
116
116
|
return navigator.sendBeacon(`${url}/api/${path}`, new Blob([
|
117
|
-
JSON.stringify({
|
118
|
-
|
119
|
-
})
|
120
|
-
], {
|
121
|
-
type: 'application/json;charset=UTF-8'
|
122
|
-
}));
|
117
|
+
JSON.stringify(Object.assign(Object.assign(Object.assign({}, options.body), bffDataSource.headers), { 'x-user-id': fakeUserId }))
|
118
|
+
], { type: 'application/json;charset=UTF-8' }));
|
123
119
|
}
|
124
120
|
return window
|
125
121
|
.fetch(`${url}/api/${path}`, {
|
@@ -148,17 +144,16 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
148
144
|
.catch((err) => Promise.reject(err));
|
149
145
|
}, [bffDataSource]);
|
150
146
|
const getRecommendVideos = useCallback((query) => __awaiter(void 0, void 0, void 0, function* () {
|
151
|
-
var _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s
|
152
|
-
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 }));
|
153
149
|
if (channel) {
|
154
150
|
query = Object.assign(Object.assign({}, query), { channel: decodeURIComponent(channel) });
|
155
151
|
}
|
156
152
|
else if (utmVal) {
|
157
|
-
const val = (
|
158
|
-
var _a, _b;
|
153
|
+
const val = (_h = (_g = (_f = splitUrlParams(utmVal)) === null || _f === void 0 ? void 0 : _f.filter((val) => {
|
159
154
|
const key = val.split('=')[0];
|
160
|
-
return
|
161
|
-
})) === null ||
|
155
|
+
return key;
|
156
|
+
})) === null || _g === void 0 ? void 0 : _g.join('&')) !== null && _h !== void 0 ? _h : '';
|
162
157
|
if (val)
|
163
158
|
query = Object.assign(Object.assign({}, query), { channel: decodeURIComponent(val) });
|
164
159
|
}
|
@@ -172,19 +167,19 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
172
167
|
let list = [];
|
173
168
|
let result = null;
|
174
169
|
const recurveRecList = (query) => __awaiter(void 0, void 0, void 0, function* () {
|
175
|
-
var _v, _w, _x, _y
|
170
|
+
var _t, _u, _v, _w, _x, _y;
|
176
171
|
query.pageNum = pageNum;
|
177
172
|
result = yield (bffFetchAdmin === null || bffFetchAdmin === void 0 ? void 0 : bffFetchAdmin('recommend/direct_page', { method: 'POST', body: query }));
|
178
173
|
if (!(result === null || result === void 0 ? void 0 : result.success)) {
|
179
174
|
return undefined;
|
180
175
|
}
|
181
176
|
setLoading(false);
|
182
|
-
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 : []);
|
183
178
|
if ((rtcList === null || rtcList === void 0 ? void 0 : rtcList.length) === 0) {
|
184
179
|
setRtcList(getFilterRecList(Object.assign(Object.assign({}, result === null || result === void 0 ? void 0 : result.data), { recList: list })));
|
185
180
|
setCacheRtcList(getFilterRecList(Object.assign(Object.assign({}, result === null || result === void 0 ? void 0 : result.data), { recList: list })));
|
186
181
|
}
|
187
|
-
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));
|
188
183
|
if (isNotNullList) {
|
189
184
|
pageNum = pageNum + 1;
|
190
185
|
yield recurveRecList(query);
|
@@ -192,13 +187,13 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
192
187
|
});
|
193
188
|
yield recurveRecList(query);
|
194
189
|
if (!(query === null || query === void 0 ? void 0 : query.hashTag) && result)
|
195
|
-
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 });
|
196
191
|
return Object.assign(Object.assign({}, result === null || result === void 0 ? void 0 : result.data), { recList: list });
|
197
192
|
}
|
198
193
|
if (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview) {
|
199
|
-
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 });
|
200
195
|
}
|
201
|
-
const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('
|
196
|
+
const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v3/recommend/direct', { method: 'POST', body: query }));
|
202
197
|
if (!(result === null || result === void 0 ? void 0 : result.success)) {
|
203
198
|
return undefined;
|
204
199
|
}
|
@@ -206,8 +201,8 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
206
201
|
setCurReqInfo({ rtc: result.data.rtc, requestId: result.data.requestId });
|
207
202
|
if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview) && !isEditor) {
|
208
203
|
let list = [];
|
209
|
-
list = list.concat((
|
210
|
-
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));
|
211
206
|
if (!isNotNullList) {
|
212
207
|
setIsNoMoreData(true);
|
213
208
|
}
|
@@ -216,12 +211,12 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
216
211
|
return result === null || result === void 0 ? void 0 : result.data;
|
217
212
|
}), [bffFetch, utmVal, maxSize, defaultSize, channelQueryList, channel, chatlabsId, bffFetchAdmin]);
|
218
213
|
const loadVideos = useCallback((pageNum) => __awaiter(void 0, void 0, void 0, function* () {
|
219
|
-
var
|
214
|
+
var _z, _0, _1, _2;
|
220
215
|
if (rtcList.length <= 0) {
|
221
216
|
return;
|
222
217
|
}
|
223
218
|
const lastItem = rtcList === null || rtcList === void 0 ? void 0 : rtcList[(rtcList === null || rtcList === void 0 ? void 0 : rtcList.length) - 1];
|
224
|
-
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 })));
|
225
220
|
setRtcList(rtcList.concat(getFilterRecList(data)));
|
226
221
|
setCacheRtcList(cacheRtcList.concat(getFilterRecList(data)));
|
227
222
|
return data;
|
@@ -273,7 +268,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
273
268
|
console.log('userInfo:', userInfo);
|
274
269
|
console.log('eventInfo:', ef);
|
275
270
|
console.log('========= 结束 =========');
|
276
|
-
return bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch(`v2/
|
271
|
+
return bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch(`v2/event/report/CLD/${(_b = bffDataSource === null || bffDataSource === void 0 ? void 0 : bffDataSource.headers) === null || _b === void 0 ? void 0 : _b['x-app-id']}/${eventInfo === null || eventInfo === void 0 ? void 0 : eventInfo.eventSubject}`, {
|
277
272
|
method: 'POST',
|
278
273
|
body: { userInfo: realUserInfo, eventInfo: realEventInfo },
|
279
274
|
type: 'beacon'
|
@@ -289,7 +284,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
289
284
|
bffDataSource
|
290
285
|
]);
|
291
286
|
const bffFbReport = useCallback(({ eventName, product }) => {
|
292
|
-
var _a, _b, _c, _d, _e, _f
|
287
|
+
var _a, _b, _c, _d, _e, _f;
|
293
288
|
if (!enableReportEvent ||
|
294
289
|
!enabledMetaConversionApi ||
|
295
290
|
(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview) ||
|
@@ -353,15 +348,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
353
348
|
}
|
354
349
|
};
|
355
350
|
getEventParams(jsonParams);
|
356
|
-
|
357
|
-
const queryString = location.search.slice(1);
|
358
|
-
(_f = splitUrlParams(queryString)) === null || _f === void 0 ? void 0 : _f.map((val) => {
|
359
|
-
const key = val.split('=')[0];
|
360
|
-
const value = val.split('=')[1];
|
361
|
-
params[key] = value;
|
362
|
-
});
|
363
|
-
const cl_source = params === null || params === void 0 ? void 0 : params.cl_source;
|
364
|
-
return bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch(`v2/fb/${(_g = bffDataSource === null || bffDataSource === void 0 ? void 0 : bffDataSource.headers) === null || _g === void 0 ? void 0 : _g['x-app-id']}/${eventName}${cl_source ? `/${decodeURIComponent(cl_source)}` : ''}`, {
|
351
|
+
return bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch(`v2/event/report/FB/${(_f = bffDataSource === null || bffDataSource === void 0 ? void 0 : bffDataSource.headers) === null || _f === void 0 ? void 0 : _f['x-app-id']}/${eventName}`, {
|
365
352
|
method: 'POST',
|
366
353
|
body: jsonParams,
|
367
354
|
type: 'beacon'
|
@@ -388,18 +375,18 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
388
375
|
return res === null || res === void 0 ? void 0 : res.success;
|
389
376
|
}), [bffFetch]);
|
390
377
|
const bffGetTagList = useCallback((data) => __awaiter(void 0, void 0, void 0, function* () {
|
391
|
-
var _5, _6, _7, _8, _9, _10
|
392
|
-
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);
|
393
380
|
if (!utmVal || !isShowTag)
|
394
381
|
return;
|
395
382
|
try {
|
396
|
-
const val = (
|
383
|
+
const val = (_8 = (_7 = (_6 = splitUrlParams(utmVal)) === null || _6 === void 0 ? void 0 : _6.filter((val) => {
|
397
384
|
var _a, _b;
|
398
385
|
const key = val.split('=')[0];
|
399
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);
|
400
|
-
})) === null ||
|
387
|
+
})) === null || _7 === void 0 ? void 0 : _7.join('&')) !== null && _8 !== void 0 ? _8 : '';
|
401
388
|
const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/tag/list', { method: 'GET', query: { channel: decodeURIComponent(val) } }));
|
402
|
-
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 : []);
|
403
390
|
}
|
404
391
|
catch (e) {
|
405
392
|
console.log('e', e);
|
@@ -459,10 +446,10 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
459
446
|
});
|
460
447
|
}, [bffEventReport]);
|
461
448
|
const getAccount = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
462
|
-
var
|
449
|
+
var _11, _12;
|
463
450
|
const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/account', { method: 'GET' }));
|
464
|
-
setChatlabsId((
|
465
|
-
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';
|
466
453
|
}), [bffFetch]);
|
467
454
|
const accountSonsent = useCallback((consentResult) => __awaiter(void 0, void 0, void 0, function* () {
|
468
455
|
const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/account/consent', {
|
package/es/index.d.ts
CHANGED
@@ -4,6 +4,7 @@ export * as core from './core';
|
|
4
4
|
export * as materials from './materials';
|
5
5
|
export { default as SxpPageRender } from './core/components/SxpPageRender';
|
6
6
|
export { default as DiyPortalPreview } from './core/components/DiyPortalPreview';
|
7
|
+
export { default as DiyStoryPreview } from './core/components/DiyStoryPreview';
|
7
8
|
export { default as Modal } from './core/components/SxpPageRender/Modal';
|
8
9
|
export { default as SxpDataSourceProvider } from './core/context/SxpDataSourceProvider';
|
9
10
|
export { default as SxpPageCore } from './core/components/SxpPageCore';
|
package/es/index.js
CHANGED
@@ -6,6 +6,7 @@ import * as materials_1 from './materials';
|
|
6
6
|
export { materials_1 as materials };
|
7
7
|
export { default as SxpPageRender } from './core/components/SxpPageRender';
|
8
8
|
export { default as DiyPortalPreview } from './core/components/DiyPortalPreview';
|
9
|
+
export { default as DiyStoryPreview } from './core/components/DiyStoryPreview';
|
9
10
|
export { default as Modal } from './core/components/SxpPageRender/Modal';
|
10
11
|
export { default as SxpDataSourceProvider } from './core/context/SxpDataSourceProvider';
|
11
12
|
export { default as SxpPageCore } from './core/components/SxpPageCore';
|
@@ -4,10 +4,10 @@ import React, { memo, useState } from 'react';
|
|
4
4
|
import { SwiperSlide } from 'swiper/react';
|
5
5
|
import Img from '../components/Img';
|
6
6
|
import Scroll from '../components/Scroll';
|
7
|
+
import EventProvider from '../components/EventProvider';
|
7
8
|
import styles from './index.module.less';
|
8
9
|
import { useSxpDataSource } from '../../../../core/hooks';
|
9
10
|
import { setFontForText } from '../../../../core/utils/tool';
|
10
|
-
import EventProvider from '../components/EventProvider';
|
11
11
|
const MultiCommodity = (_a) => {
|
12
12
|
var _b, _c;
|
13
13
|
var { content, style, bgImg, recData, bottom_image, ctaTempStyles, translateY = 0, isActive, index } = _a, props = __rest(_a, ["content", "style", "bgImg", "recData", "bottom_image", "ctaTempStyles", "translateY", "isActive", "index"]);
|
@@ -4,15 +4,16 @@ import React, { memo, useState } from 'react';
|
|
4
4
|
import { SwiperSlide } from 'swiper/react';
|
5
5
|
import Scroll from '../components/Scroll';
|
6
6
|
import Img from '../components/Img';
|
7
|
+
import EventProvider from '../components/EventProvider';
|
7
8
|
import styles from './index.module.less';
|
8
9
|
import { useSxpDataSource } from '../../../../core/hooks';
|
9
10
|
import { setFontForText } from '../../../../core/utils/tool';
|
10
|
-
import EventProvider from '../components/EventProvider';
|
11
11
|
const MultiCommodityDiro = (_a) => {
|
12
12
|
var _b, _c;
|
13
13
|
var { content, style, bgImg, recData, bottom_image, ctaTempStyles, translateY = 0, isActive, index } = _a, props = __rest(_a, ["content", "style", "bgImg", "recData", "bottom_image", "ctaTempStyles", "translateY", "isActive", "index"]);
|
14
14
|
const { sxpParameter } = useSxpDataSource();
|
15
15
|
const [products] = useState((_c = (_b = recData === null || recData === void 0 ? void 0 : recData.video) === null || _b === void 0 ? void 0 : _b.bindProducts) !== null && _c !== void 0 ? _c : [1, 2]);
|
16
|
+
console.log(recData, '222');
|
16
17
|
return (React.createElement(Scroll, { isPadding: !!recData }, products === null || products === void 0 ? void 0 : products.map((item, itemIndex) => {
|
17
18
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
18
19
|
return (React.createElement(React.Fragment, null, recData && !(item === null || item === void 0 ? void 0 : item.bindCta) ? null : (React.createElement(SwiperSlide, { key: itemIndex, className: css(Object.assign(Object.assign({}, style), { flexShrink: 0, marginLeft: 0, marginRight: '8px' })), tag: 'li', role: 'listitem' },
|
@@ -4,15 +4,16 @@ import React, { memo, useState } from 'react';
|
|
4
4
|
import { SwiperSlide } from 'swiper/react';
|
5
5
|
import Scroll from '../components/Scroll';
|
6
6
|
import Img from '../components/Img';
|
7
|
+
import EventProvider from '../components/EventProvider';
|
7
8
|
import styles from './index.module.less';
|
8
9
|
import { useSxpDataSource } from '../../../../core/hooks';
|
9
10
|
import { setFontForText } from '../../../../core/utils/tool';
|
10
|
-
import EventProvider from '../components/EventProvider';
|
11
11
|
const MultiCommodityDiroNew = (_a) => {
|
12
12
|
var _b, _c;
|
13
13
|
var { content, style, bgImg, recData, bottom_image, ctaTempStyles, translateY = 0, isActive, index } = _a, props = __rest(_a, ["content", "style", "bgImg", "recData", "bottom_image", "ctaTempStyles", "translateY", "isActive", "index"]);
|
14
14
|
const { sxpParameter } = useSxpDataSource();
|
15
15
|
const [products] = useState((_c = (_b = recData === null || recData === void 0 ? void 0 : recData.video) === null || _b === void 0 ? void 0 : _b.bindProducts) !== null && _c !== void 0 ? _c : [1, 2]);
|
16
|
+
console.log(recData, '333');
|
16
17
|
return (React.createElement(Scroll, { isPadding: !!recData }, products === null || products === void 0 ? void 0 : products.map((item, itemIndex) => {
|
17
18
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
18
19
|
return (React.createElement(React.Fragment, null, recData && !(item === null || item === void 0 ? void 0 : item.bindCta) ? null : (React.createElement(SwiperSlide, { key: itemIndex, className: css(Object.assign(Object.assign({}, style), { flexShrink: 0, marginLeft: 0, marginRight: '8px' })), tag: 'li', role: 'listitem' },
|
@@ -13,7 +13,7 @@ const EventProvider = (_a) => {
|
|
13
13
|
const handleClick = throttle((e) => {
|
14
14
|
var _a, _b, _c, _d, _e, _f;
|
15
15
|
e.preventDefault();
|
16
|
-
const item = multItem
|
16
|
+
const item = multItem || ((_b = (_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.bindProduct) !== null && _b !== void 0 ? _b : rec === null || rec === void 0 ? void 0 : rec.video);
|
17
17
|
ctaEvent === null || ctaEvent === void 0 ? void 0 : ctaEvent({
|
18
18
|
eventSubject: 'clickCta',
|
19
19
|
eventDescription: 'User clicked the CTA'
|
@@ -40,6 +40,6 @@ const EventProvider = (_a) => {
|
|
40
40
|
setElement(null);
|
41
41
|
}
|
42
42
|
}, [element, popup]);
|
43
|
-
return (React.createElement("button", { ref: ref, className: className, style: Object.assign({ display: 'flex', alignItems: 'normal' }, style), onClick: handleClick, role: 'button', "aria-label": 'CTA', tabIndex: 0 }, children));
|
43
|
+
return (React.createElement("button", { ref: ref, className: className, style: Object.assign({ outline: 'none', border: 'none', boxSizing: 'content-box', padding: 0, background: 'transparent', display: 'flex', alignItems: 'normal' }, style), onClick: handleClick, role: 'button', "aria-label": 'CTA', tabIndex: 0 }, children));
|
44
44
|
};
|
45
45
|
export default memo(EventProvider);
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { postConfigType } from '../SxpPageRender';
|
3
|
+
import { IScene, ScenesType } from '.';
|
4
|
+
interface IPictureGroupProps {
|
5
|
+
imgUrls?: string[];
|
6
|
+
width: number;
|
7
|
+
height: number;
|
8
|
+
rec: IScene;
|
9
|
+
index: number;
|
10
|
+
imgUrlsPostConfig?: postConfigType;
|
11
|
+
swiperRef?: any;
|
12
|
+
data?: ScenesType;
|
13
|
+
loopPlay?: boolean;
|
14
|
+
}
|
15
|
+
declare const _default: React.NamedExoticComponent<IPictureGroupProps>;
|
16
|
+
export default _default;
|
@@ -0,0 +1,37 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
const tslib_1 = require("tslib");
|
4
|
+
const react_1 = tslib_1.__importStar(require("react"));
|
5
|
+
const modules_1 = require("swiper/modules");
|
6
|
+
const react_2 = require("swiper/react");
|
7
|
+
const Picture_1 = tslib_1.__importDefault(require("../SxpPageRender/PictureGroup/Picture"));
|
8
|
+
const PictureGroup = ({ imgUrls, width, height, imgUrlsPostConfig, rec, index, swiperRef, data = [], loopPlay }) => {
|
9
|
+
const { isActive } = (0, react_2.useSwiperSlide)();
|
10
|
+
const [isload, setIsLoad] = (0, react_1.useState)(false);
|
11
|
+
(0, react_1.useEffect)(() => {
|
12
|
+
if (isActive && isload && loopPlay) {
|
13
|
+
setTimeout(() => {
|
14
|
+
var _a, _b, _c, _d;
|
15
|
+
if (index === (data === null || data === void 0 ? void 0 : data.length) - 1) {
|
16
|
+
(_a = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _a === void 0 ? void 0 : _a.swiper.slideTo(0);
|
17
|
+
}
|
18
|
+
else {
|
19
|
+
const i = (_c = (_b = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _b === void 0 ? void 0 : _b.swiper) === null || _c === void 0 ? void 0 : _c.activeIndex;
|
20
|
+
(_d = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _d === void 0 ? void 0 : _d.swiper.slideTo(i + 1);
|
21
|
+
}
|
22
|
+
}, 3000);
|
23
|
+
}
|
24
|
+
}, [isActive, isload, data, index, swiperRef, loopPlay]);
|
25
|
+
const loadFinishImage = () => {
|
26
|
+
setIsLoad(true);
|
27
|
+
};
|
28
|
+
return (react_1.default.createElement(react_2.Swiper, { defaultValue: 0, direction: 'horizontal', modules: [modules_1.Pagination, modules_1.Autoplay], pagination: {
|
29
|
+
clickable: true,
|
30
|
+
bulletActiveClass: 'swipe-item-active-bullet',
|
31
|
+
bulletElement: 'button'
|
32
|
+
}, height: height, style: { width }, loop: true, autoplay: false }, imgUrls === null || imgUrls === void 0 ? void 0 : imgUrls.map((url) => {
|
33
|
+
return (react_1.default.createElement(react_2.SwiperSlide, { key: url },
|
34
|
+
react_1.default.createElement(Picture_1.default, { src: url, height: height, imgUrlsPostConfig: imgUrlsPostConfig, onShowFirstImage: loadFinishImage })));
|
35
|
+
})));
|
36
|
+
};
|
37
|
+
exports.default = (0, react_1.memo)(PictureGroup);
|
@@ -0,0 +1,27 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { postConfigType } from '../SxpPageRender';
|
3
|
+
import { IScene, ScenesType } from '.';
|
4
|
+
interface IVideoWidgetProps {
|
5
|
+
rec: IScene;
|
6
|
+
index: number;
|
7
|
+
height: number;
|
8
|
+
width: number;
|
9
|
+
data: ScenesType;
|
10
|
+
muted: boolean;
|
11
|
+
activeIndex?: number;
|
12
|
+
videoPostConfig?: postConfigType;
|
13
|
+
swiperRef?: any;
|
14
|
+
videoPlayIcon?: string;
|
15
|
+
onUpdateTimeLine?: (index: number, v: number) => void;
|
16
|
+
loopPlay: any;
|
17
|
+
onPlay?: (index: number, v: number) => void;
|
18
|
+
onPause?: () => void;
|
19
|
+
}
|
20
|
+
export interface IVideoWidgetRef {
|
21
|
+
play: () => void;
|
22
|
+
pause: () => void;
|
23
|
+
setLoopPlay: (v: boolean) => void;
|
24
|
+
isPlaying: () => boolean;
|
25
|
+
}
|
26
|
+
declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<IVideoWidgetProps & React.RefAttributes<IVideoWidgetRef>>>;
|
27
|
+
export default _default;
|
@@ -0,0 +1,242 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
const tslib_1 = require("tslib");
|
4
|
+
const react_1 = tslib_1.__importStar(require("react"));
|
5
|
+
const react_2 = require("swiper/react");
|
6
|
+
const useIconLink_1 = require("../SxpPageRender/useIconLink");
|
7
|
+
const VideoPlayer_1 = require("../SxpPageRender/VideoWidget/VideoPlayer");
|
8
|
+
const FormatImage_1 = tslib_1.__importDefault(require("../SxpPageRender/FormatImage"));
|
9
|
+
const hooks_1 = require("../../../core/hooks");
|
10
|
+
const VideoWidget = (0, react_1.forwardRef)(({ rec, index, height, data, muted, activeIndex, videoPostConfig, width, swiperRef, videoPlayIcon, onUpdateTimeLine, loopPlay, onPlay, onPause }, ref) => {
|
11
|
+
const { isActive } = (0, react_2.useSwiperSlide)();
|
12
|
+
const [isPauseVideo, setIsPauseVideo] = (0, react_1.useState)(false);
|
13
|
+
const videoRef = (0, react_1.useRef)(null);
|
14
|
+
const { bffEventReport, sxpParameter, waterFallData, openHashtag } = (0, hooks_1.useSxpDataSource)();
|
15
|
+
const videoStartTime = (0, react_1.useRef)(0);
|
16
|
+
const [isLoadFinish, setIsLoadFinish] = (0, react_1.useState)(false);
|
17
|
+
const [isFirstPlay, setIsFirstPlay] = (0, react_1.useState)(true);
|
18
|
+
const canvasRef = (0, react_1.useRef)(null);
|
19
|
+
const [firstFrameSrc, setFirstFrameSrc] = (0, react_1.useState)('');
|
20
|
+
const videoId = `pb-cache-video-${index}`;
|
21
|
+
const hlsRef = (0, react_1.useRef)(null);
|
22
|
+
const loopPlayRef = (0, react_1.useRef)(loopPlay);
|
23
|
+
(0, react_1.useEffect)(() => {
|
24
|
+
loopPlayRef.current = loopPlay;
|
25
|
+
}, [loopPlay]);
|
26
|
+
(0, react_1.useImperativeHandle)(ref, () => {
|
27
|
+
return {
|
28
|
+
play() {
|
29
|
+
var _a;
|
30
|
+
if (!videoRef.current)
|
31
|
+
return;
|
32
|
+
handleTimeUpload();
|
33
|
+
(_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.play();
|
34
|
+
setIsPauseVideo(false);
|
35
|
+
},
|
36
|
+
pause() {
|
37
|
+
var _a;
|
38
|
+
if (!videoRef.current)
|
39
|
+
return;
|
40
|
+
(_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.pause();
|
41
|
+
setIsPauseVideo(true);
|
42
|
+
},
|
43
|
+
setLoopPlay(v) {
|
44
|
+
if (!videoRef.current)
|
45
|
+
return;
|
46
|
+
loopPlayRef.current = v;
|
47
|
+
},
|
48
|
+
isPlaying() {
|
49
|
+
var _a;
|
50
|
+
return !((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.paused);
|
51
|
+
}
|
52
|
+
};
|
53
|
+
});
|
54
|
+
(0, react_1.useEffect)(() => {
|
55
|
+
if (!videoRef.current)
|
56
|
+
return;
|
57
|
+
videoRef.current.muted = muted;
|
58
|
+
}, [muted]);
|
59
|
+
const handleVideoStart = (0, react_1.useCallback)(() => {
|
60
|
+
var _a;
|
61
|
+
(_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.play();
|
62
|
+
}, []);
|
63
|
+
const PAUSE_ICON = (0, useIconLink_1.useIconLink)('/pb_static/06f28a2025c74c1cb49be6767316d827.png');
|
64
|
+
const handlePlaying = (0, react_1.useCallback)(() => {
|
65
|
+
var _a, _b, _c, _d, _e, _f;
|
66
|
+
setIsPauseVideo(false);
|
67
|
+
const item = data[index];
|
68
|
+
if (item && ((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.duration)) {
|
69
|
+
videoStartTime.current = ((_b = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _b === void 0 ? void 0 : _b.currentTime) || 0;
|
70
|
+
const videoDuration = ((_d = (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.duration) !== null && _d !== void 0 ? _d : 0).toFixed(2);
|
71
|
+
const videoCurrentTime = ((_f = (_e = videoRef.current) === null || _e === void 0 ? void 0 : _e.currentTime) !== null && _f !== void 0 ? _f : 0).toFixed(2);
|
72
|
+
const playType = isFirstPlay ? '0' : '1';
|
73
|
+
setIsFirstPlay(false);
|
74
|
+
}
|
75
|
+
}, [bffEventReport, data, index, isFirstPlay]);
|
76
|
+
const handleLoadedMetadata = (0, react_1.useCallback)(() => {
|
77
|
+
var _a;
|
78
|
+
videoRef.current.currentTime = rec === null || rec === void 0 ? void 0 : rec.startTime;
|
79
|
+
(_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.play();
|
80
|
+
setIsLoadFinish(true);
|
81
|
+
}, []);
|
82
|
+
const handleClickVideo = (0, react_1.useCallback)((type) => () => {
|
83
|
+
var _a, _b, _c, _d, _e, _f;
|
84
|
+
if (!isActive || !(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) || !isLoadFinish)
|
85
|
+
return;
|
86
|
+
const isPause = (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.paused;
|
87
|
+
switch (type) {
|
88
|
+
case 'start':
|
89
|
+
if (!isPause)
|
90
|
+
return;
|
91
|
+
(_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.play();
|
92
|
+
setIsPauseVideo(false);
|
93
|
+
break;
|
94
|
+
case 'pause':
|
95
|
+
if (isPause)
|
96
|
+
return;
|
97
|
+
(_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.pause();
|
98
|
+
setIsPauseVideo(true);
|
99
|
+
break;
|
100
|
+
default:
|
101
|
+
if (isPause) {
|
102
|
+
if (((_d = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _d === void 0 ? void 0 : _d.currentTime) >= (rec === null || rec === void 0 ? void 0 : rec.endTime)) {
|
103
|
+
videoRef.current.currentTime = rec === null || rec === void 0 ? void 0 : rec.startTime;
|
104
|
+
}
|
105
|
+
(_e = videoRef.current) === null || _e === void 0 ? void 0 : _e.play();
|
106
|
+
}
|
107
|
+
else {
|
108
|
+
(_f = videoRef.current) === null || _f === void 0 ? void 0 : _f.pause();
|
109
|
+
}
|
110
|
+
setIsPauseVideo(!isPause);
|
111
|
+
break;
|
112
|
+
}
|
113
|
+
}, [isLoadFinish]);
|
114
|
+
const blur = (0, react_1.useMemo)(() => {
|
115
|
+
return (videoPostConfig === null || videoPostConfig === void 0 ? void 0 : videoPostConfig.mode) === '2';
|
116
|
+
}, [videoPostConfig]);
|
117
|
+
const translateY = (0, react_1.useMemo)(() => {
|
118
|
+
var _a;
|
119
|
+
return (videoPostConfig === null || videoPostConfig === void 0 ? void 0 : videoPostConfig.mode) === '2'
|
120
|
+
? `translateY(-${50 + ((_a = videoPostConfig === null || videoPostConfig === void 0 ? void 0 : videoPostConfig.offsetTop) !== null && _a !== void 0 ? _a : 0)}%) translate3d(0px, 0px, 0px)`
|
121
|
+
: 'translateY(-50%)';
|
122
|
+
}, [videoPostConfig]);
|
123
|
+
const handLoadeddata = (0, react_1.useCallback)(() => {
|
124
|
+
if (!canvasRef || !videoRef || !videoRef.current || !canvasRef.current)
|
125
|
+
return;
|
126
|
+
const video = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current;
|
127
|
+
const canvas = canvasRef === null || canvasRef === void 0 ? void 0 : canvasRef.current;
|
128
|
+
const ctx = canvas.getContext('2d');
|
129
|
+
const targetWidth = window === null || window === void 0 ? void 0 : window.innerWidth;
|
130
|
+
const targetHeight = window === null || window === void 0 ? void 0 : window.innerHeight;
|
131
|
+
canvas.height = targetHeight;
|
132
|
+
canvas.width = targetWidth;
|
133
|
+
ctx === null || ctx === void 0 ? void 0 : ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
|
134
|
+
setFirstFrameSrc(canvas.toDataURL());
|
135
|
+
}, []);
|
136
|
+
const handleTimeUpload = (0, react_1.useCallback)(() => {
|
137
|
+
var _a;
|
138
|
+
if (!videoRef.current)
|
139
|
+
return;
|
140
|
+
const localTime = ((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.currentTime) - (rec === null || rec === void 0 ? void 0 : rec.startTime);
|
141
|
+
onUpdateTimeLine === null || onUpdateTimeLine === void 0 ? void 0 : onUpdateTimeLine(index, localTime);
|
142
|
+
setTimeout(() => {
|
143
|
+
var _a, _b;
|
144
|
+
if (((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.currentTime) >= ((_b = rec === null || rec === void 0 ? void 0 : rec.endTime) !== null && _b !== void 0 ? _b : 0)) {
|
145
|
+
slideSwiper();
|
146
|
+
}
|
147
|
+
});
|
148
|
+
}, []);
|
149
|
+
const slideSwiper = () => {
|
150
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
151
|
+
(_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.pause();
|
152
|
+
if (!loopPlayRef.current)
|
153
|
+
return;
|
154
|
+
if (index === (data === null || data === void 0 ? void 0 : data.length) - 1) {
|
155
|
+
(_c = (_b = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _b === void 0 ? void 0 : _b.swiper) === null || _c === void 0 ? void 0 : _c.slideTo(0);
|
156
|
+
}
|
157
|
+
else {
|
158
|
+
const i = (_e = (_d = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _d === void 0 ? void 0 : _d.swiper) === null || _e === void 0 ? void 0 : _e.activeIndex;
|
159
|
+
(_g = (_f = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _f === void 0 ? void 0 : _f.swiper) === null || _g === void 0 ? void 0 : _g.slideTo(i + 1);
|
160
|
+
}
|
161
|
+
};
|
162
|
+
const handlePause = () => {
|
163
|
+
setIsPauseVideo(true);
|
164
|
+
onPause === null || onPause === void 0 ? void 0 : onPause();
|
165
|
+
};
|
166
|
+
const handlePlay = () => {
|
167
|
+
var _a;
|
168
|
+
const localTime = ((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.currentTime) - (rec === null || rec === void 0 ? void 0 : rec.startTime);
|
169
|
+
onPlay === null || onPlay === void 0 ? void 0 : onPlay(index, localTime);
|
170
|
+
};
|
171
|
+
(0, react_1.useEffect)(() => {
|
172
|
+
var _a, _b, _c, _d;
|
173
|
+
if (!isActive)
|
174
|
+
return;
|
175
|
+
const videoSrc = rec === null || rec === void 0 ? void 0 : rec.mediaUrl;
|
176
|
+
if (!videoSrc)
|
177
|
+
return;
|
178
|
+
setIsPauseVideo(false);
|
179
|
+
const videoPlayerWrapperNode = document.querySelector(`#${videoId}`);
|
180
|
+
if (!videoPlayerWrapperNode)
|
181
|
+
return;
|
182
|
+
videoRef.current = VideoPlayer_1.mountVideoPlayerAtNode === null || VideoPlayer_1.mountVideoPlayerAtNode === void 0 ? void 0 : (0, VideoPlayer_1.mountVideoPlayerAtNode)(videoPlayerWrapperNode);
|
183
|
+
if (!(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current))
|
184
|
+
return;
|
185
|
+
const Hls = window === null || window === void 0 ? void 0 : window.Hls;
|
186
|
+
let hls = hlsRef === null || hlsRef === void 0 ? void 0 : hlsRef.current;
|
187
|
+
if (videoSrc.includes('.m3u8') && Hls && Hls.isSupported()) {
|
188
|
+
hls = new Hls();
|
189
|
+
hls === null || hls === void 0 ? void 0 : hls.loadSource(videoSrc);
|
190
|
+
hls === null || hls === void 0 ? void 0 : hls.attachMedia(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current);
|
191
|
+
hls === null || hls === void 0 ? void 0 : hls.on(Hls.Events.MANIFEST_PARSED, function () {
|
192
|
+
var _a;
|
193
|
+
videoRef.current.currentTime = rec === null || rec === void 0 ? void 0 : rec.startTime;
|
194
|
+
(_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.play();
|
195
|
+
});
|
196
|
+
}
|
197
|
+
else {
|
198
|
+
videoRef.current.src = videoSrc;
|
199
|
+
}
|
200
|
+
(_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.addEventListener('loadedmetadata', handleLoadedMetadata);
|
201
|
+
(_b = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _b === void 0 ? void 0 : _b.addEventListener('pause', handlePause);
|
202
|
+
(_c = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _c === void 0 ? void 0 : _c.addEventListener('play', handlePlay);
|
203
|
+
(_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.addEventListener('timeupdate', handleTimeUpload);
|
204
|
+
return () => {
|
205
|
+
var _a, _b, _c, _d, _e;
|
206
|
+
if (hlsRef === null || hlsRef === void 0 ? void 0 : hlsRef.current)
|
207
|
+
(_a = hlsRef === null || hlsRef === void 0 ? void 0 : hlsRef.current) === null || _a === void 0 ? void 0 : _a.destroy();
|
208
|
+
setIsLoadFinish(false);
|
209
|
+
(_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.removeEventListener('loadedmetadata', handleLoadedMetadata);
|
210
|
+
(_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.removeEventListener('pause', handlePause);
|
211
|
+
(_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.removeEventListener('play', handlePlay);
|
212
|
+
(_e = videoRef.current) === null || _e === void 0 ? void 0 : _e.removeEventListener('timeupdate', handleTimeUpload);
|
213
|
+
};
|
214
|
+
}, [isActive]);
|
215
|
+
const renderPoster = (0, react_1.useMemo)(() => {
|
216
|
+
if (!(sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.placeholder_image) || isLoadFinish) {
|
217
|
+
return null;
|
218
|
+
}
|
219
|
+
return (react_1.default.createElement("img", { style: { position: 'absolute', left: 0, top: 0, width: '100%', height: '100%', objectFit: 'cover' }, src: sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.placeholder_image, alt: 'video poster' }));
|
220
|
+
}, [isLoadFinish, sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.placeholder_image]);
|
221
|
+
const blurStyle = (0, react_1.useMemo)(() => {
|
222
|
+
return blur
|
223
|
+
? {
|
224
|
+
filter: 'blur(10px)',
|
225
|
+
transform: 'translate3d(0px, 0px, 0px) scale(1.2)'
|
226
|
+
}
|
227
|
+
: {};
|
228
|
+
}, [blur]);
|
229
|
+
if (!(rec === null || rec === void 0 ? void 0 : rec.mediaUrl)) {
|
230
|
+
return null;
|
231
|
+
}
|
232
|
+
return (react_1.default.createElement("div", { className: 'video-container', key: rec.itemId, style: {
|
233
|
+
position: 'relative',
|
234
|
+
width: '100%',
|
235
|
+
height,
|
236
|
+
overflow: 'hidden'
|
237
|
+
}, onClick: handleClickVideo() },
|
238
|
+
react_1.default.createElement("div", { className: 'n-full-screen', id: videoId, style: { width: '100%', height: '100%' } }),
|
239
|
+
renderPoster,
|
240
|
+
isPauseVideo && react_1.default.createElement(FormatImage_1.default, { className: 'clc-pb-video-pause', src: videoPlayIcon !== null && videoPlayIcon !== void 0 ? videoPlayIcon : PAUSE_ICON, alt: 'pause' })));
|
241
|
+
});
|
242
|
+
exports.default = (0, react_1.memo)(VideoWidget);
|