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