pb-sxp-ui 1.15.15-alpha.2 → 1.15.16-alpha.2

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 +146 -785
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.js +145 -783
  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 +146 -785
  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 +58 -32
  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 +58 -32
  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 -195
  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 -198
  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,20 +292,33 @@ 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, _h, _j, _k;
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: (_a = window === null || window === void 0 ? void 0 : window.location) === null || _a === void 0 ? void 0 : _a.href,
299
+ page_title: document === null || document === void 0 ? void 0 : document.title
300
+ });
301
+ }
302
+ if (eventName && typeof (window === null || window === void 0 ? void 0 : window.fbq) === 'function') {
303
+ window === null || window === void 0 ? void 0 : window.fbq('track', eventName, {
304
+ page_path: (_b = window === null || window === void 0 ? void 0 : window.location) === null || _b === void 0 ? void 0 : _b.pathname,
305
+ page_location: (_c = window === null || window === void 0 ? void 0 : window.location) === null || _c === void 0 ? void 0 : _c.href,
306
+ page_title: document === null || document === void 0 ? void 0 : document.title
307
+ });
308
+ }
291
309
  if (!enableReportEvent ||
292
310
  !enabledMetaConversionApi ||
293
311
  (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview) ||
294
- !((_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.converApi) === null || _a === void 0 ? void 0 : _a[eventName])) {
312
+ !((_d = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.converApi) === null || _d === void 0 ? void 0 : _d[eventName])) {
295
313
  return;
296
314
  }
297
- const jsonParams = (0, lodash_1.cloneDeep)((_b = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.converApi) === null || _b === void 0 ? void 0 : _b[eventName]);
315
+ const jsonParams = (0, lodash_1.cloneDeep)((_e = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.converApi) === null || _e === void 0 ? void 0 : _e[eventName]);
298
316
  const urlParams = new URLSearchParams(window.location.search);
299
317
  const fbclid = urlParams === null || urlParams === void 0 ? void 0 : urlParams.get('fbclid');
300
318
  const fix_par = {
301
- event_source_url: (_c = window === null || window === void 0 ? void 0 : window.location) === null || _c === void 0 ? void 0 : _c.href,
319
+ event_source_url: (_f = window === null || window === void 0 ? void 0 : window.location) === null || _f === void 0 ? void 0 : _f.href,
302
320
  external_id: fakeUserId,
303
- client_user_agent: (_e = (_d = window === null || window === void 0 ? void 0 : window.navigator) === null || _d === void 0 ? void 0 : _d.userAgent) !== null && _e !== void 0 ? _e : '',
321
+ client_user_agent: (_h = (_g = window === null || window === void 0 ? void 0 : window.navigator) === null || _g === void 0 ? void 0 : _g.userAgent) !== null && _h !== void 0 ? _h : '',
304
322
  fbc: fbclid ? `fb.2.${new Date().getTime()}.${fbclid}` : '',
305
323
  fbp: (0, tool_1.getCookie)('_fbp') ? `fb.2.${new Date().getTime()}.${(0, tool_1.getCookie)('_fbp')}` : '',
306
324
  time: Math.floor(Date.now() / 1000)
@@ -351,7 +369,15 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
351
369
  }
352
370
  };
353
371
  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}`, {
372
+ const params = {};
373
+ const queryString = location.search.slice(1);
374
+ (_j = (0, tool_1.splitUrlParams)(queryString)) === null || _j === void 0 ? void 0 : _j.map((val) => {
375
+ const key = val.split('=')[0];
376
+ const value = val.split('=')[1];
377
+ params[key] = value;
378
+ });
379
+ const cl_source = params === null || params === void 0 ? void 0 : params.cl_source;
380
+ return bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch(`v2/fb/${(_k = bffDataSource === null || bffDataSource === void 0 ? void 0 : bffDataSource.headers) === null || _k === void 0 ? void 0 : _k['x-app-id']}/${eventName}${cl_source ? `/${decodeURIComponent(cl_source)}` : ''}`, {
355
381
  method: 'POST',
356
382
  body: jsonParams,
357
383
  type: 'beacon'
@@ -378,18 +404,18 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
378
404
  return res === null || res === void 0 ? void 0 : res.success;
379
405
  }), [bffFetch]);
380
406
  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);
407
+ var _5, _6, _7, _8, _9, _10, _11, _12;
408
+ 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
409
  if (!utmVal || !isShowTag)
384
410
  return;
385
411
  try {
386
- const val = (_8 = (_7 = (_6 = (0, tool_1.splitUrlParams)(utmVal)) === null || _6 === void 0 ? void 0 : _6.filter((val) => {
412
+ const val = (_10 = (_9 = (_8 = (0, tool_1.splitUrlParams)(utmVal)) === null || _8 === void 0 ? void 0 : _8.filter((val) => {
387
413
  var _a, _b;
388
414
  const key = val.split('=')[0];
389
415
  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 : '';
416
+ })) === null || _9 === void 0 ? void 0 : _9.join('&')) !== null && _10 !== void 0 ? _10 : '';
391
417
  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 : []);
418
+ 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
419
  }
394
420
  catch (e) {
395
421
  console.log('e', e);
@@ -449,10 +475,10 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
449
475
  });
450
476
  }, [bffEventReport]);
451
477
  const getAccount = (0, react_1.useCallback)(() => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
452
- var _11, _12;
478
+ var _13, _14;
453
479
  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';
480
+ setChatlabsId((_13 = res === null || res === void 0 ? void 0 : res.data) === null || _13 === void 0 ? void 0 : _13.chatLabsId);
481
+ return ((_14 = res === null || res === void 0 ? void 0 : res.data) === null || _14 === void 0 ? void 0 : _14.consentResult) === 'true';
456
482
  }), [bffFetch]);
457
483
  const accountSonsent = (0, react_1.useCallback)((consentResult) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
458
484
  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.2",
3
+ "version": "1.15.16-alpha.2",
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,195 +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
- loopPlayRef.current = v;
42
- },
43
- isPlaying() {
44
- var _a;
45
- return !((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.paused);
46
- }
47
- };
48
- });
49
- useEffect(() => {
50
- if (!videoRef.current)
51
- return;
52
- videoRef.current.muted = muted;
53
- }, [muted]);
54
- const PAUSE_ICON = useIconLink('/pb_static/06f28a2025c74c1cb49be6767316d827.png');
55
- const handleLoadedMetadata = useCallback(() => {
56
- var _a;
57
- videoRef.current.currentTime = rec === null || rec === void 0 ? void 0 : rec.startTime;
58
- (_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.play();
59
- setIsLoadFinish(true);
60
- }, []);
61
- const handleClickVideo = useCallback((type) => () => {
62
- var _a, _b, _c, _d, _e, _f;
63
- if (!isActive || !(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) || !isLoadFinish)
64
- return;
65
- const isPause = (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.paused;
66
- switch (type) {
67
- case 'start':
68
- if (!isPause)
69
- return;
70
- (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.play();
71
- setIsPauseVideo(false);
72
- break;
73
- case 'pause':
74
- if (isPause)
75
- return;
76
- (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.pause();
77
- setIsPauseVideo(true);
78
- break;
79
- default:
80
- if (isPause) {
81
- 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)) {
82
- videoRef.current.currentTime = rec === null || rec === void 0 ? void 0 : rec.startTime;
83
- }
84
- (_e = videoRef.current) === null || _e === void 0 ? void 0 : _e.play();
85
- }
86
- else {
87
- (_f = videoRef.current) === null || _f === void 0 ? void 0 : _f.pause();
88
- }
89
- setIsPauseVideo(!isPause);
90
- break;
91
- }
92
- }, [isLoadFinish]);
93
- const blur = useMemo(() => {
94
- return (videoPostConfig === null || videoPostConfig === void 0 ? void 0 : videoPostConfig.mode) === '2';
95
- }, [videoPostConfig]);
96
- const handleTimeUpload = () => {
97
- if (!videoRef.current)
98
- return;
99
- setTimeout(() => {
100
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
101
- 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)) {
102
- (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.pause();
103
- if (!loopPlayRef.current)
104
- return;
105
- if (index === (data === null || data === void 0 ? void 0 : data.length) - 1) {
106
- (_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.slideTo(0);
107
- }
108
- else {
109
- const i = (_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.activeIndex;
110
- (_j = (_h = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _h === void 0 ? void 0 : _h.swiper) === null || _j === void 0 ? void 0 : _j.slideTo(i + 1);
111
- }
112
- }
113
- });
114
- };
115
- const handlePause = () => {
116
- setIsPauseVideo(true);
117
- onPause === null || onPause === void 0 ? void 0 : onPause();
118
- };
119
- const handlePlay = () => {
120
- var _a;
121
- 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);
122
- onPlay === null || onPlay === void 0 ? void 0 : onPlay(index, localTime);
123
- };
124
- useEffect(() => {
125
- var _a, _b, _c, _d;
126
- if (!isActive)
127
- return;
128
- const videoSrc = rec === null || rec === void 0 ? void 0 : rec.mediaUrl;
129
- if (!videoSrc)
130
- return;
131
- setIsPauseVideo(false);
132
- const videoPlayerWrapperNode = document.querySelector(`#${videoId}`);
133
- if (!videoPlayerWrapperNode)
134
- return;
135
- videoRef.current = mountVideoPlayerAtNode === null || mountVideoPlayerAtNode === void 0 ? void 0 : mountVideoPlayerAtNode(videoPlayerWrapperNode);
136
- if (!(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current))
137
- return;
138
- const Hls = window === null || window === void 0 ? void 0 : window.Hls;
139
- let hls = hlsRef === null || hlsRef === void 0 ? void 0 : hlsRef.current;
140
- if (videoSrc.includes('.m3u8') && Hls && Hls.isSupported()) {
141
- hls = new Hls();
142
- hls === null || hls === void 0 ? void 0 : hls.loadSource(videoSrc);
143
- hls === null || hls === void 0 ? void 0 : hls.attachMedia(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current);
144
- hls === null || hls === void 0 ? void 0 : hls.on(Hls.Events.MANIFEST_PARSED, function () {
145
- var _a;
146
- videoRef.current.currentTime = rec === null || rec === void 0 ? void 0 : rec.startTime;
147
- (_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.play();
148
- });
149
- }
150
- else {
151
- videoRef.current.src = videoSrc;
152
- }
153
- (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.addEventListener('loadedmetadata', handleLoadedMetadata);
154
- (_b = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _b === void 0 ? void 0 : _b.addEventListener('pause', handlePause);
155
- (_c = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _c === void 0 ? void 0 : _c.addEventListener('play', handlePlay);
156
- (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.addEventListener('timeupdate', handleTimeUpload);
157
- return () => {
158
- var _a, _b, _c, _d, _e;
159
- if (hlsRef === null || hlsRef === void 0 ? void 0 : hlsRef.current)
160
- (_a = hlsRef === null || hlsRef === void 0 ? void 0 : hlsRef.current) === null || _a === void 0 ? void 0 : _a.destroy();
161
- setIsLoadFinish(false);
162
- (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.removeEventListener('loadedmetadata', handleLoadedMetadata);
163
- (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.removeEventListener('pause', handlePause);
164
- (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.removeEventListener('play', handlePlay);
165
- (_e = videoRef.current) === null || _e === void 0 ? void 0 : _e.removeEventListener('timeupdate', handleTimeUpload);
166
- };
167
- }, [isActive]);
168
- const renderPoster = useMemo(() => {
169
- if (!(sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.placeholder_image) || isLoadFinish) {
170
- return null;
171
- }
172
- 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' }));
173
- }, [isLoadFinish, sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.placeholder_image]);
174
- const blurStyle = useMemo(() => {
175
- return blur
176
- ? {
177
- filter: 'blur(10px)',
178
- transform: 'translate3d(0px, 0px, 0px) scale(1.2)'
179
- }
180
- : {};
181
- }, [blur]);
182
- if (!(rec === null || rec === void 0 ? void 0 : rec.mediaUrl)) {
183
- return null;
184
- }
185
- return (React.createElement("div", { className: 'video-container', key: rec.itemId, style: {
186
- position: 'relative',
187
- width: '100%',
188
- height,
189
- overflow: 'hidden'
190
- }, onClick: handleClickVideo() },
191
- React.createElement("div", { className: 'n-full-screen', id: videoId, style: { width: '100%', height: '100%' } }),
192
- renderPoster,
193
- isPauseVideo && React.createElement(FormatImage, { className: 'clc-pb-video-pause', src: videoPlayIcon !== null && videoPlayIcon !== void 0 ? videoPlayIcon : PAUSE_ICON, alt: 'pause' })));
194
- });
195
- export default memo(VideoWidget);