pb-sxp-ui 1.15.20 → 1.15.22-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/dist/index.cjs +7705 -7259
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.css +46 -46
  4. package/dist/index.js +7705 -7260
  5. package/dist/index.js.map +1 -1
  6. package/dist/index.min.cjs +6 -6
  7. package/dist/index.min.cjs.map +1 -1
  8. package/dist/index.min.js +6 -6
  9. package/dist/index.min.js.map +1 -1
  10. package/dist/pb-ui.js +7705 -7259
  11. package/dist/pb-ui.js.map +1 -1
  12. package/dist/pb-ui.min.js +6 -6
  13. package/dist/pb-ui.min.js.map +1 -1
  14. package/es/core/Pagebuilder/type.d.ts +10 -5
  15. package/es/core/components/DiyStoryPreview/PictureGroup.d.ts +16 -0
  16. package/es/core/components/DiyStoryPreview/PictureGroup.js +34 -0
  17. package/es/core/components/DiyStoryPreview/VideoWidget.d.ts +27 -0
  18. package/es/core/components/DiyStoryPreview/VideoWidget.js +197 -0
  19. package/es/core/components/DiyStoryPreview/index.d.ts +32 -0
  20. package/es/core/components/DiyStoryPreview/index.js +410 -0
  21. package/es/core/components/SxpPageCore/index.js +6 -4
  22. package/es/core/components/SxpPageRender/index.d.ts +0 -1
  23. package/es/core/components/SxpPageRender/typing.d.ts +19 -0
  24. package/es/core/context/SxpDataSourceProvider.d.ts +2 -1
  25. package/es/core/context/SxpDataSourceProvider.js +48 -97
  26. package/es/index.d.ts +1 -0
  27. package/es/index.js +1 -0
  28. package/es/materials/sxp/popup/CommodityDetail/index.js +2 -2
  29. package/es/materials/sxp/popup/CommodityDetailDiroNew/index.js +1 -1
  30. package/lib/core/Pagebuilder/type.d.ts +10 -5
  31. package/lib/core/components/DiyStoryPreview/PictureGroup.d.ts +16 -0
  32. package/lib/core/components/DiyStoryPreview/PictureGroup.js +37 -0
  33. package/lib/core/components/DiyStoryPreview/VideoWidget.d.ts +27 -0
  34. package/lib/core/components/DiyStoryPreview/VideoWidget.js +200 -0
  35. package/lib/core/components/DiyStoryPreview/index.d.ts +32 -0
  36. package/lib/core/components/DiyStoryPreview/index.js +413 -0
  37. package/lib/core/components/SxpPageCore/index.js +6 -4
  38. package/lib/core/components/SxpPageRender/index.d.ts +0 -1
  39. package/lib/core/components/SxpPageRender/typing.d.ts +19 -0
  40. package/lib/core/context/SxpDataSourceProvider.d.ts +2 -1
  41. package/lib/core/context/SxpDataSourceProvider.js +48 -97
  42. package/lib/index.d.ts +1 -0
  43. package/lib/index.js +3 -1
  44. package/lib/materials/sxp/popup/CommodityDetail/index.js +2 -2
  45. package/lib/materials/sxp/popup/CommodityDetailDiroNew/index.js +1 -1
  46. package/package.json +1 -1
@@ -17,7 +17,7 @@ var DataSourceType;
17
17
  DataSourceType[DataSourceType["BFF"] = 5] = "BFF";
18
18
  })(DataSourceType || (DataSourceType = {}));
19
19
  export const DEFAULT_TAG = 'FOR U';
20
- const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent = true, maxSize, defaultSize, isPreview = false, sxpParameter, appDomain, hashTagSize, loadingImage, isOpenHashTag = false, enabledMetaConversionApi = false, consentHeight, consentWidth, isOpenConsent = false, isEditor = false, utmParameter, channelQueryList, data, dataList, onUpdateSchema, onUpdateChannel }) => {
20
+ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent = true, maxSize, defaultSize, isPreview = false, sxpParameter, appDomain, hashTagSize, loadingImage, isOpenHashTag = false, enabledMetaConversionApi = false, consentHeight, consentWidth, isOpenConsent = false, isEditor = false, utmParameter, channelQueryList, data, dataList, isDiyH5, onUpdateSchema, onUpdateChannel }) => {
21
21
  var _a, _b, _c, _d, _e;
22
22
  const [rtcList, setRtcList] = useState([]);
23
23
  const [tagList, setTagList] = useState([]);
@@ -105,7 +105,6 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
105
105
  return ((_a = bffDataSource === null || bffDataSource === void 0 ? void 0 : bffDataSource.headers) === null || _a === void 0 ? void 0 : _a['x-app-id']) + storeAndLoadFeUserId();
106
106
  }, [bffDataSource]);
107
107
  const bffFetch = useCallback((path, options) => {
108
- var _a, _b;
109
108
  if (!bffDataSource)
110
109
  return;
111
110
  const url = bffDataSource.url;
@@ -113,33 +112,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
113
112
  const queryString = qs.stringify(options.query);
114
113
  path = `${path}?${queryString}`;
115
114
  }
116
- let isTikTokChannel = false;
117
- const params = {};
118
- const queryString = location.search.slice(1);
119
- (_a = splitUrlParams(queryString)) === null || _a === void 0 ? void 0 : _a.forEach((val) => {
120
- const key = val.split('=')[0];
121
- const value = val.split('=')[1];
122
- params[key] = value;
123
- });
124
- const cl_source = params === null || params === void 0 ? void 0 : params.cl_source;
125
- if (cl_source &&
126
- ((_b = [
127
- '40A-SPRK--DRESS_EYEWEAR-',
128
- '41A-SPRK--MADRAGUE-',
129
- '42A-SPRK--MOOD-',
130
- '43A-SPRK--SUMMER-',
131
- '44A-SPRK--DRESS_EYEWEAR-',
132
- '45A-SPRK--MADRAGUE-',
133
- '46A-SPRK--MOOD-',
134
- '47A-SPRK--SUMMER-',
135
- '48A-SPRK--DRESS_EYEWEAR-',
136
- '49A-SPRK--MADRAGUE-',
137
- '50A-SPRK--MOOD-',
138
- '51A-SPRK--SUMMER-'
139
- ]) === null || _b === void 0 ? void 0 : _b.includes(cl_source))) {
140
- isTikTokChannel = true;
141
- }
142
- if (options.type === 'beacon' && navigator.sendBeacon && !isTikTokChannel) {
115
+ if (options.type === 'beacon' && navigator.sendBeacon) {
143
116
  return navigator.sendBeacon(`${url}/api/${path}`, new Blob([
144
117
  JSON.stringify({
145
118
  body: btoa(encodeURIComponent(JSON.stringify(Object.assign(Object.assign(Object.assign({}, options.body), bffDataSource.headers), { 'x-user-id': fakeUserId }))))
@@ -149,11 +122,11 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
149
122
  }));
150
123
  }
151
124
  return window
152
- .fetch(`${url}/api/${path}`, Object.assign({ headers: Object.assign({ 'Content-Type': 'application/json', 'x-user-id': fakeUserId }, bffDataSource.headers), method: options.method, body: isTikTokChannel
153
- ? JSON.stringify({
154
- body: btoa(encodeURIComponent(JSON.stringify(options.body)))
155
- })
156
- : JSON.stringify(options.body) }, (isTikTokChannel && { keepalive: true })))
125
+ .fetch(`${url}/api/${path}`, {
126
+ headers: Object.assign({ 'Content-Type': 'application/json', 'x-user-id': fakeUserId }, bffDataSource.headers),
127
+ method: options.method,
128
+ body: JSON.stringify(options.body)
129
+ })
157
130
  .then((res) => res.json())
158
131
  .catch((err) => Promise.reject(err));
159
132
  }, [bffDataSource, fakeUserId]);
@@ -176,7 +149,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
176
149
  }, [bffDataSource]);
177
150
  const getRecommendVideos = useCallback((query) => __awaiter(void 0, void 0, void 0, function* () {
178
151
  var _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
179
- 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
+ query = Object.assign(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 })), (isDiyH5 && { type: 'story' }));
180
153
  if (channel) {
181
154
  query = Object.assign(Object.assign({}, query), { channel: decodeURIComponent(channel) });
182
155
  }
@@ -225,7 +198,10 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
225
198
  if (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview) {
226
199
  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 });
227
200
  }
228
- const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/recommend/list', { method: 'POST', body: query }));
201
+ const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/recommend/list', {
202
+ method: 'POST',
203
+ body: query
204
+ }));
229
205
  if (!(result === null || result === void 0 ? void 0 : result.success)) {
230
206
  return undefined;
231
207
  }
@@ -285,7 +261,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
285
261
  const sessionID = storeAndLoadFeSessionId();
286
262
  const params = {};
287
263
  const queryString = location.search.slice(1);
288
- (_a = splitUrlParams(queryString)) === null || _a === void 0 ? void 0 : _a.map((val) => {
264
+ (_a = splitUrlParams(queryString)) === null || _a === void 0 ? void 0 : _a.forEach((val) => {
289
265
  const key = val.split('=')[0];
290
266
  const value = val.split('=')[1];
291
267
  params[key] = value;
@@ -315,17 +291,23 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
315
291
  playbookType,
316
292
  bffDataSource
317
293
  ]);
318
- const getEventParamsByJson = useCallback((json, product) => {
319
- var _a, _b, _c;
320
- const jsonParams = cloneDeep(json);
294
+ const bffFbReport = useCallback(({ eventName, product }) => {
295
+ var _a, _b, _c, _d, _e, _f, _g;
296
+ if (!enableReportEvent ||
297
+ !enabledMetaConversionApi ||
298
+ (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview) ||
299
+ !((_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.converApi) === null || _a === void 0 ? void 0 : _a[eventName])) {
300
+ return;
301
+ }
302
+ const jsonParams = cloneDeep((_b = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.converApi) === null || _b === void 0 ? void 0 : _b[eventName]);
321
303
  const urlParams = new URLSearchParams(window.location.search);
322
304
  const fbclid = urlParams === null || urlParams === void 0 ? void 0 : urlParams.get('fbclid');
323
305
  const fix_par = {
324
- event_source_url: (_a = window === null || window === void 0 ? void 0 : window.location) === null || _a === void 0 ? void 0 : _a.href,
306
+ event_source_url: (_c = window === null || window === void 0 ? void 0 : window.location) === null || _c === void 0 ? void 0 : _c.href,
325
307
  external_id: fakeUserId,
326
- client_user_agent: (_c = (_b = window === null || window === void 0 ? void 0 : window.navigator) === null || _b === void 0 ? void 0 : _b.userAgent) !== null && _c !== void 0 ? _c : '',
308
+ 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 : '',
327
309
  fbc: fbclid ? `fb.2.${new Date().getTime()}.${fbclid}` : '',
328
- fbp: getCookie('_fbp') ? `${getCookie('_fbp')}` : '',
310
+ fbp: getCookie('_fbp') ? `fb.2.${new Date().getTime()}.${getCookie('_fbp')}` : '',
329
311
  time: Math.floor(Date.now() / 1000)
330
312
  };
331
313
  const regex = /\{\{(.*?)\}\}/g;
@@ -337,7 +319,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
337
319
  }
338
320
  else {
339
321
  for (const key in obj) {
340
- if (Object.prototype.hasOwnProperty.call(obj, key)) {
322
+ if (obj.hasOwnProperty(key)) {
341
323
  const value = obj === null || obj === void 0 ? void 0 : obj[key];
342
324
  if (typeof value === 'object') {
343
325
  getEventParams(value);
@@ -374,59 +356,28 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
374
356
  }
375
357
  };
376
358
  getEventParams(jsonParams);
377
- return jsonParams;
378
- }, [fakeUserId]);
379
- const bffFbReport = useCallback(({ eventName, product }) => {
380
- var _a, _b, _c, _d;
381
- if (!enableReportEvent || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview)) {
382
- return;
383
- }
384
- const pixelEventParamsJson = (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.pixel) === null || _a === void 0 ? void 0 : _a[eventName];
385
- if ((pixelEventParamsJson === null || pixelEventParamsJson === void 0 ? void 0 : pixelEventParamsJson.event_name) && typeof (window === null || window === void 0 ? void 0 : window.fbq) === 'function') {
386
- function updateQueryStringParameter(uri, key, value) {
387
- const re = new RegExp('([?&])' + key + '=.*?(&|$)', 'i');
388
- const separator = uri.indexOf('?') !== -1 ? '&' : '?';
389
- if (uri.match(re)) {
390
- return uri.replace(re, '$1' + key + '=' + value + '$2');
391
- }
392
- else {
393
- return uri + separator + key + '=' + value;
394
- }
395
- }
396
- if (eventName === 'PageView' && (pixelEventParamsJson === null || pixelEventParamsJson === void 0 ? void 0 : pixelEventParamsJson.event_name) === 'PageView') {
397
- const currentUrl = window.location.href;
398
- const newUrl = updateQueryStringParameter(currentUrl, 'timestamp', Date.now());
399
- history.pushState({ path: newUrl }, '', newUrl);
400
- }
401
- else {
402
- const body = getEventParamsByJson(pixelEventParamsJson);
403
- window === null || window === void 0 ? void 0 : window.fbq('track', pixelEventParamsJson === null || pixelEventParamsJson === void 0 ? void 0 : pixelEventParamsJson.event_name, body);
404
- if (eventName === 'PageView' && typeof (window === null || window === void 0 ? void 0 : window.gtag) === 'function') {
405
- window === null || window === void 0 ? void 0 : window.gtag('event', 'page_view');
406
- }
407
- }
408
- }
409
- else if (eventName === 'PageView' && typeof (window === null || window === void 0 ? void 0 : window.gtag) === 'function') {
410
- window === null || window === void 0 ? void 0 : window.gtag('event', 'page_view');
411
- }
412
- const converApiEventParamsJson = (_b = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.converApi) === null || _b === void 0 ? void 0 : _b[eventName];
413
- if (enabledMetaConversionApi && converApiEventParamsJson) {
414
- const body = getEventParamsByJson(converApiEventParamsJson, product);
415
- const params = {};
416
- const queryString = location.search.slice(1);
417
- (_c = splitUrlParams(queryString)) === null || _c === void 0 ? void 0 : _c.forEach((val) => {
418
- const key = val.split('=')[0];
419
- const value = val.split('=')[1];
420
- params[key] = value;
421
- });
422
- const cl_source = params === null || params === void 0 ? void 0 : params.cl_source;
423
- bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch(`v2/fb/${(_d = bffDataSource === null || bffDataSource === void 0 ? void 0 : bffDataSource.headers) === null || _d === void 0 ? void 0 : _d['x-app-id']}/${eventName}${cl_source ? `/${decodeURIComponent(cl_source)}` : ''}`, {
424
- method: 'POST',
425
- body,
426
- type: 'beacon'
427
- });
428
- }
429
- }, [bffFetch, enableReportEvent, enabledMetaConversionApi, globalConfig, bffDataSource, getEventParamsByJson]);
359
+ const params = {};
360
+ const queryString = location.search.slice(1);
361
+ (_f = splitUrlParams(queryString)) === null || _f === void 0 ? void 0 : _f.map((val) => {
362
+ const key = val.split('=')[0];
363
+ const value = val.split('=')[1];
364
+ params[key] = value;
365
+ });
366
+ const cl_source = params === null || params === void 0 ? void 0 : params.cl_source;
367
+ 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)}` : ''}`, {
368
+ method: 'POST',
369
+ body: jsonParams,
370
+ type: 'beacon'
371
+ });
372
+ }, [
373
+ bffFetch,
374
+ enableReportEvent,
375
+ enabledMetaConversionApi,
376
+ globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview,
377
+ globalConfig,
378
+ fakeUserId,
379
+ bffDataSource
380
+ ]);
430
381
  const bffMutateLike = useCallback((body) => __awaiter(void 0, void 0, void 0, function* () {
431
382
  const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/recommend/like', { method: 'POST', body }));
432
383
  return res === null || res === void 0 ? void 0 : res.success;
package/es/index.d.ts CHANGED
@@ -4,6 +4,7 @@ export * as core from './core';
4
4
  export * as materials from './materials';
5
5
  export { default as SxpPageRender } from './core/components/SxpPageRender';
6
6
  export { default as DiyPortalPreview } from './core/components/DiyPortalPreview';
7
+ export { default as DiyStoryPreview } from './core/components/DiyStoryPreview';
7
8
  export { default as Modal } from './core/components/SxpPageRender/Modal';
8
9
  export { default as SxpDataSourceProvider } from './core/context/SxpDataSourceProvider';
9
10
  export { default as SxpPageCore } from './core/components/SxpPageCore';
package/es/index.js CHANGED
@@ -6,6 +6,7 @@ import * as materials_1 from './materials';
6
6
  export { materials_1 as materials };
7
7
  export { default as SxpPageRender } from './core/components/SxpPageRender';
8
8
  export { default as DiyPortalPreview } from './core/components/DiyPortalPreview';
9
+ export { default as DiyStoryPreview } from './core/components/DiyStoryPreview';
9
10
  export { default as Modal } from './core/components/SxpPageRender/Modal';
10
11
  export { default as SxpDataSourceProvider } from './core/context/SxpDataSourceProvider';
11
12
  export { default as SxpPageCore } from './core/components/SxpPageCore';
@@ -1,7 +1,6 @@
1
1
  import { __rest } from "tslib";
2
2
  import { css } from '@emotion/css';
3
3
  import React, { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react';
4
- import CommodityGroup from '../../template/components/CommodityGroup';
5
4
  import { useSxpDataSource } from '../../../../core/hooks';
6
5
  import './index.less';
7
6
  import { A11y, Autoplay, Keyboard, Mousewheel, Navigation, Pagination } from 'swiper/modules';
@@ -11,6 +10,7 @@ import Modal from '../../../../core/components/SxpPageRender/Modal';
11
10
  import ExpandableText from '../../../../core/components/SxpPageRender/ExpandableText';
12
11
  import FormatImage from '../../../../core/components/SxpPageRender/FormatImage';
13
12
  import { getScreenReader, setFontForText } from '../../../../core/utils/tool';
13
+ import CommodityGroup from '../../template/components/CommodityGroup';
14
14
  import { getPriceText } from '../../../../core/utils/materials';
15
15
  const CommodityDetail = (_a) => {
16
16
  var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
@@ -67,7 +67,7 @@ const CommodityDetail = (_a) => {
67
67
  };
68
68
  }, []);
69
69
  const priceText = getPriceText({
70
- product,
70
+ product: product,
71
71
  enableFormattedPrice: (_t = commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price) === null || _t === void 0 ? void 0 : _t.enableFormattedPrice,
72
72
  globalConfig,
73
73
  style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price
@@ -1,7 +1,6 @@
1
1
  import { __rest } from "tslib";
2
2
  import { css } from '@emotion/css';
3
3
  import React, { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react';
4
- import CommodityGroup from '../../template/components/CommodityGroup';
5
4
  import { useSxpDataSource } from '../../../../core/hooks';
6
5
  import './index.less';
7
6
  import { Autoplay, Pagination, Navigation, A11y, Mousewheel, Keyboard } from 'swiper/modules';
@@ -11,6 +10,7 @@ import ExpandableText from '../../../../core/components/SxpPageRender/Expandable
11
10
  import { useEventReport } from '../../../../core/hooks/useEventReport';
12
11
  import FormatImage from '../../../../core/components/SxpPageRender/FormatImage';
13
12
  import { getScreenReader, setFontForText } from '../../../../core/utils/tool';
13
+ import CommodityGroup from '../../template/components/CommodityGroup';
14
14
  import { getPriceText } from '../../../../core/utils/materials';
15
15
  const CommodityDetailDiroNew = (_a) => {
16
16
  var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4;
@@ -50,11 +50,16 @@ export interface SeoParameter {
50
50
  key_word: string;
51
51
  }
52
52
  export interface UtmParameter {
53
- utm_source: string;
54
- utm_medium: string;
55
- utm_campaign: string;
56
- channels?: string[];
57
- enabled_meta_conversion_api?: boolean;
53
+ channels: string[];
54
+ enabled_meta_conversion_api: boolean;
55
+ values: string[];
56
+ cos_path: string;
57
+ enabled_google_no_index: boolean;
58
+ enabled_google_analytics: boolean;
59
+ enabled_gtm: boolean;
60
+ enabled_alibaba_cloud: boolean;
61
+ enabled_uptime: boolean;
62
+ experience_id: string | null;
58
63
  }
59
64
  interface PagebuilderProps {
60
65
  init: (e: initParams) => void;
@@ -0,0 +1,16 @@
1
+ import React from 'react';
2
+ import { postConfigType } from '../SxpPageRender';
3
+ import { RecItemType } from '../SxpPageRender/typing';
4
+ interface IPictureGroupProps {
5
+ imgUrls?: string[];
6
+ width: number;
7
+ height: number;
8
+ rec: RecItemType;
9
+ index: number;
10
+ imgUrlsPostConfig?: postConfigType;
11
+ swiperRef?: any;
12
+ data?: RecItemType[];
13
+ loopPlay?: boolean;
14
+ }
15
+ declare const _default: React.NamedExoticComponent<IPictureGroupProps>;
16
+ export default _default;
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const react_1 = tslib_1.__importStar(require("react"));
5
+ const modules_1 = require("swiper/modules");
6
+ const react_2 = require("swiper/react");
7
+ const Picture_1 = tslib_1.__importDefault(require("../SxpPageRender/PictureGroup/Picture"));
8
+ const PictureGroup = ({ imgUrls, width, height, imgUrlsPostConfig, rec, index, swiperRef, data = [], loopPlay }) => {
9
+ const { isActive } = (0, react_2.useSwiperSlide)();
10
+ const [isload, setIsLoad] = (0, react_1.useState)(false);
11
+ (0, react_1.useEffect)(() => {
12
+ if (isActive && isload && loopPlay) {
13
+ setTimeout(() => {
14
+ var _a, _b, _c, _d;
15
+ if (index === (data === null || data === void 0 ? void 0 : data.length) - 1) {
16
+ (_a = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _a === void 0 ? void 0 : _a.swiper.slideTo(0);
17
+ }
18
+ else {
19
+ const i = (_c = (_b = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _b === void 0 ? void 0 : _b.swiper) === null || _c === void 0 ? void 0 : _c.activeIndex;
20
+ (_d = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _d === void 0 ? void 0 : _d.swiper.slideTo(i + 1);
21
+ }
22
+ }, 3000);
23
+ }
24
+ }, [isActive, isload, data, index, swiperRef, loopPlay]);
25
+ const loadFinishImage = () => {
26
+ setIsLoad(true);
27
+ };
28
+ return (react_1.default.createElement(react_2.Swiper, { defaultValue: 0, direction: 'horizontal', modules: [modules_1.Pagination, modules_1.Autoplay], pagination: {
29
+ clickable: true,
30
+ bulletActiveClass: 'swipe-item-active-bullet',
31
+ bulletElement: 'button'
32
+ }, height: height, style: { width }, loop: true, autoplay: false }, imgUrls === null || imgUrls === void 0 ? void 0 : imgUrls.map((url) => {
33
+ return (react_1.default.createElement(react_2.SwiperSlide, { key: url },
34
+ react_1.default.createElement(Picture_1.default, { src: url, height: height, imgUrlsPostConfig: imgUrlsPostConfig, onShowFirstImage: loadFinishImage })));
35
+ })));
36
+ };
37
+ exports.default = (0, react_1.memo)(PictureGroup);
@@ -0,0 +1,27 @@
1
+ import React from 'react';
2
+ import { postConfigType } from '../SxpPageRender';
3
+ import { RecItemType } from '../SxpPageRender/typing';
4
+ interface IVideoWidgetProps {
5
+ rec: RecItemType;
6
+ index: number;
7
+ height: number;
8
+ width: number;
9
+ data: RecItemType[];
10
+ muted: boolean;
11
+ activeIndex?: number;
12
+ videoPostConfig?: postConfigType;
13
+ swiperRef?: any;
14
+ videoPlayIcon?: string;
15
+ onUpdateTimeLine?: (index: number, v: number) => void;
16
+ loopPlay: any;
17
+ onPlay?: (index: number, v: number) => void;
18
+ onPause?: () => void;
19
+ }
20
+ export interface IVideoWidgetRef {
21
+ play: () => void;
22
+ pause: () => void;
23
+ setLoopPlay: (v: boolean) => void;
24
+ isPlaying: () => boolean;
25
+ }
26
+ declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<IVideoWidgetProps & React.RefAttributes<IVideoWidgetRef>>>;
27
+ export default _default;
@@ -0,0 +1,200 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const react_1 = tslib_1.__importStar(require("react"));
5
+ const react_2 = require("swiper/react");
6
+ const useIconLink_1 = require("../SxpPageRender/useIconLink");
7
+ const VideoPlayer_1 = require("../SxpPageRender/VideoWidget/VideoPlayer");
8
+ const FormatImage_1 = tslib_1.__importDefault(require("../SxpPageRender/FormatImage"));
9
+ const hooks_1 = require("../../../core/hooks");
10
+ const VideoWidget = (0, react_1.forwardRef)(({ rec, index, height, data, muted, activeIndex, videoPostConfig, width, swiperRef, videoPlayIcon, onUpdateTimeLine, loopPlay, onPlay, onPause }, ref) => {
11
+ const { isActive } = (0, react_2.useSwiperSlide)();
12
+ const [isPauseVideo, setIsPauseVideo] = (0, react_1.useState)(false);
13
+ const videoRef = (0, react_1.useRef)(null);
14
+ const { bffEventReport, sxpParameter, waterFallData, openHashtag } = (0, hooks_1.useSxpDataSource)();
15
+ const videoStartTime = (0, react_1.useRef)(0);
16
+ const [isLoadFinish, setIsLoadFinish] = (0, react_1.useState)(false);
17
+ const [isFirstPlay, setIsFirstPlay] = (0, react_1.useState)(true);
18
+ const canvasRef = (0, react_1.useRef)(null);
19
+ const [firstFrameSrc, setFirstFrameSrc] = (0, react_1.useState)('');
20
+ const videoId = `pb-cache-video-${index}`;
21
+ const hlsRef = (0, react_1.useRef)(null);
22
+ const loopPlayRef = (0, react_1.useRef)(loopPlay);
23
+ const scene = rec.video.scene;
24
+ (0, react_1.useEffect)(() => {
25
+ loopPlayRef.current = loopPlay;
26
+ }, [loopPlay]);
27
+ (0, react_1.useImperativeHandle)(ref, () => {
28
+ return {
29
+ play() {
30
+ var _a;
31
+ if (!videoRef.current)
32
+ return;
33
+ handleTimeUpload();
34
+ (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.play();
35
+ setIsPauseVideo(false);
36
+ },
37
+ pause() {
38
+ var _a;
39
+ if (!videoRef.current)
40
+ return;
41
+ (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.pause();
42
+ setIsPauseVideo(true);
43
+ },
44
+ setLoopPlay(v) {
45
+ loopPlayRef.current = v;
46
+ },
47
+ isPlaying() {
48
+ var _a;
49
+ return !((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.paused);
50
+ }
51
+ };
52
+ });
53
+ (0, react_1.useEffect)(() => {
54
+ if (!videoRef.current)
55
+ return;
56
+ videoRef.current.muted = muted;
57
+ }, [muted]);
58
+ const PAUSE_ICON = (0, useIconLink_1.useIconLink)('/pb_static/06f28a2025c74c1cb49be6767316d827.png');
59
+ const handleLoadedMetadata = (0, react_1.useCallback)(() => {
60
+ var _a;
61
+ videoRef.current.currentTime = scene === null || scene === void 0 ? void 0 : scene.startTime;
62
+ (_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.play();
63
+ setIsLoadFinish(true);
64
+ }, []);
65
+ const handleClickVideo = (0, react_1.useCallback)((type) => () => {
66
+ var _a, _b, _c, _d, _e, _f;
67
+ if (!isActive || !(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) || !isLoadFinish)
68
+ return;
69
+ const isPause = (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.paused;
70
+ switch (type) {
71
+ case 'start':
72
+ if (!isPause)
73
+ return;
74
+ (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.play();
75
+ setIsPauseVideo(false);
76
+ break;
77
+ case 'pause':
78
+ if (isPause)
79
+ return;
80
+ (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.pause();
81
+ setIsPauseVideo(true);
82
+ break;
83
+ default:
84
+ if (isPause) {
85
+ if (((_d = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _d === void 0 ? void 0 : _d.currentTime) >= (scene === null || scene === void 0 ? void 0 : scene.endTime)) {
86
+ videoRef.current.currentTime = scene === null || scene === void 0 ? void 0 : scene.startTime;
87
+ }
88
+ (_e = videoRef.current) === null || _e === void 0 ? void 0 : _e.play();
89
+ }
90
+ else {
91
+ (_f = videoRef.current) === null || _f === void 0 ? void 0 : _f.pause();
92
+ }
93
+ setIsPauseVideo(!isPause);
94
+ break;
95
+ }
96
+ }, [isLoadFinish]);
97
+ const blur = (0, react_1.useMemo)(() => {
98
+ return (videoPostConfig === null || videoPostConfig === void 0 ? void 0 : videoPostConfig.mode) === '2';
99
+ }, [videoPostConfig]);
100
+ const handleTimeUpload = () => {
101
+ if (!videoRef.current)
102
+ return;
103
+ setTimeout(() => {
104
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
105
+ if (((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.currentTime) >= ((_b = scene === null || scene === void 0 ? void 0 : scene.endTime) !== null && _b !== void 0 ? _b : 0)) {
106
+ (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.pause();
107
+ if (!loopPlayRef.current)
108
+ return;
109
+ if (index === (data === null || data === void 0 ? void 0 : data.length) - 1) {
110
+ (_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);
111
+ }
112
+ else {
113
+ 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;
114
+ (_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);
115
+ }
116
+ }
117
+ });
118
+ };
119
+ const handlePause = () => {
120
+ setIsPauseVideo(true);
121
+ onPause === null || onPause === void 0 ? void 0 : onPause();
122
+ };
123
+ const handlePlay = () => {
124
+ var _a;
125
+ const localTime = ((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.currentTime) - (scene === null || scene === void 0 ? void 0 : scene.startTime);
126
+ onPlay === null || onPlay === void 0 ? void 0 : onPlay(index, localTime);
127
+ };
128
+ (0, react_1.useEffect)(() => {
129
+ var _a, _b, _c, _d;
130
+ if (!isActive)
131
+ return;
132
+ const videoSrc = scene === null || scene === void 0 ? void 0 : scene.mediaUrl;
133
+ if (!videoSrc)
134
+ return;
135
+ setIsPauseVideo(false);
136
+ const videoPlayerWrapperNode = document.querySelector(`#${videoId}`);
137
+ if (!videoPlayerWrapperNode)
138
+ return;
139
+ videoRef.current = VideoPlayer_1.mountVideoPlayerAtNode === null || VideoPlayer_1.mountVideoPlayerAtNode === void 0 ? void 0 : (0, VideoPlayer_1.mountVideoPlayerAtNode)(videoPlayerWrapperNode);
140
+ if (!(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current))
141
+ return;
142
+ const Hls = window === null || window === void 0 ? void 0 : window.Hls;
143
+ let hls = hlsRef === null || hlsRef === void 0 ? void 0 : hlsRef.current;
144
+ if (videoSrc.includes('.m3u8') && Hls && Hls.isSupported()) {
145
+ hls = new Hls();
146
+ hls === null || hls === void 0 ? void 0 : hls.loadSource(videoSrc);
147
+ hls === null || hls === void 0 ? void 0 : hls.attachMedia(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current);
148
+ hls === null || hls === void 0 ? void 0 : hls.on(Hls.Events.MANIFEST_PARSED, function () {
149
+ var _a;
150
+ videoRef.current.currentTime = scene === null || scene === void 0 ? void 0 : scene.startTime;
151
+ (_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.play();
152
+ });
153
+ }
154
+ else {
155
+ videoRef.current.src = videoSrc;
156
+ }
157
+ (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.addEventListener('loadedmetadata', handleLoadedMetadata);
158
+ (_b = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _b === void 0 ? void 0 : _b.addEventListener('pause', handlePause);
159
+ (_c = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _c === void 0 ? void 0 : _c.addEventListener('play', handlePlay);
160
+ (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.addEventListener('timeupdate', handleTimeUpload);
161
+ return () => {
162
+ var _a, _b, _c, _d, _e;
163
+ if (hlsRef === null || hlsRef === void 0 ? void 0 : hlsRef.current)
164
+ (_a = hlsRef === null || hlsRef === void 0 ? void 0 : hlsRef.current) === null || _a === void 0 ? void 0 : _a.destroy();
165
+ setIsLoadFinish(false);
166
+ (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.removeEventListener('loadedmetadata', handleLoadedMetadata);
167
+ (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.removeEventListener('pause', handlePause);
168
+ (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.removeEventListener('play', handlePlay);
169
+ (_e = videoRef.current) === null || _e === void 0 ? void 0 : _e.removeEventListener('timeupdate', handleTimeUpload);
170
+ };
171
+ }, [isActive]);
172
+ const renderPoster = (0, react_1.useMemo)(() => {
173
+ var _a;
174
+ if (!(sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.placeholder_image) || isLoadFinish) {
175
+ return null;
176
+ }
177
+ return (react_1.default.createElement("img", { style: { position: 'absolute', left: 0, top: 0, width: '100%', height: '100%', objectFit: 'cover' }, src: ((_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.cover) || (sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.placeholder_image), alt: 'video poster' }));
178
+ }, [isLoadFinish, sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.placeholder_image]);
179
+ const blurStyle = (0, react_1.useMemo)(() => {
180
+ return blur
181
+ ? {
182
+ filter: 'blur(10px)',
183
+ transform: 'translate3d(0px, 0px, 0px) scale(1.2)'
184
+ }
185
+ : {};
186
+ }, [blur]);
187
+ if (!(scene === null || scene === void 0 ? void 0 : scene.mediaUrl)) {
188
+ return null;
189
+ }
190
+ return (react_1.default.createElement("div", { className: 'video-container', key: scene.itemId, style: {
191
+ position: 'relative',
192
+ width: '100%',
193
+ height,
194
+ overflow: 'hidden'
195
+ }, onClick: handleClickVideo() },
196
+ react_1.default.createElement("div", { className: 'n-full-screen', id: videoId, style: { width: '100%', height: '100%' } }),
197
+ renderPoster,
198
+ isPauseVideo && react_1.default.createElement(FormatImage_1.default, { className: 'clc-pb-video-pause', src: videoPlayIcon !== null && videoPlayIcon !== void 0 ? videoPlayIcon : PAUSE_ICON, alt: 'pause' })));
199
+ });
200
+ exports.default = (0, react_1.memo)(VideoWidget);
@@ -0,0 +1,32 @@
1
+ import React from 'react';
2
+ import { ISxpPageRenderProps } from '../SxpPageRender';
3
+ import '../SxpPageRender/index.less';
4
+ export type DiyStoryPreviewType = ISxpPageRenderProps & {
5
+ appDomain?: string;
6
+ activeIndex?: number;
7
+ onActiveChange?: (v: number) => void;
8
+ loopPlay?: boolean;
9
+ pointerEvents?: any;
10
+ onUpdateTimeLine: (index: number, curTime: number) => void;
11
+ onPlay: (index: number, curTime: number) => void;
12
+ onPause: () => void;
13
+ disabledListener?: boolean;
14
+ };
15
+ export interface IDiyStoryPreviewRef {
16
+ play: () => void;
17
+ pause: () => void;
18
+ slideTo: (n: number) => void;
19
+ isPlaying: () => boolean;
20
+ }
21
+ declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<ISxpPageRenderProps & {
22
+ appDomain?: string | undefined;
23
+ activeIndex?: number | undefined;
24
+ onActiveChange?: ((v: number) => void) | undefined;
25
+ loopPlay?: boolean | undefined;
26
+ pointerEvents?: any;
27
+ onUpdateTimeLine: (index: number, curTime: number) => void;
28
+ onPlay: (index: number, curTime: number) => void;
29
+ onPause: () => void;
30
+ disabledListener?: boolean | undefined;
31
+ } & React.RefAttributes<IDiyStoryPreviewRef>>>;
32
+ export default _default;