pb-sxp-ui 1.7.1 → 1.7.3

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 (73) hide show
  1. package/dist/index.cjs +222 -102
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.js +222 -102
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.min.cjs +3 -3
  6. package/dist/index.min.cjs.map +1 -1
  7. package/dist/index.min.js +3 -3
  8. package/dist/index.min.js.map +1 -1
  9. package/dist/pb-ui.js +222 -102
  10. package/dist/pb-ui.js.map +1 -1
  11. package/dist/pb-ui.min.js +3 -3
  12. package/dist/pb-ui.min.js.map +1 -1
  13. package/es/core/components/SxpPageRender/Modal/index.js +6 -3
  14. package/es/core/components/SxpPageRender/PictureGroup/Picture.d.ts +1 -1
  15. package/es/core/components/SxpPageRender/PictureGroup/index.d.ts +4 -1
  16. package/es/core/components/SxpPageRender/PictureGroup/index.js +24 -4
  17. package/es/core/components/SxpPageRender/RenderCard.js +6 -1
  18. package/es/core/components/SxpPageRender/VideoWidget/index.js +22 -12
  19. package/es/core/components/SxpPageRender/WaterFall/List.js +3 -2
  20. package/es/core/components/SxpPageRender/WaterFall/WaterfallList.js +3 -2
  21. package/es/core/components/SxpPageRender/WaterFall/index.js +5 -2
  22. package/es/core/components/SxpPageRender/index.d.ts +2 -0
  23. package/es/core/components/SxpPageRender/index.js +20 -25
  24. package/es/core/context/SxpDataSourceProvider.d.ts +2 -4
  25. package/es/core/context/SxpDataSourceProvider.js +53 -11
  26. package/es/core/utils/materials.d.ts +7 -1
  27. package/es/core/utils/materials.js +5 -2
  28. package/es/core/utils/tool.d.ts +2 -1
  29. package/es/core/utils/tool.js +11 -1
  30. package/es/materials/sxp/cta/AniLink/settingRender.d.ts +11 -0
  31. package/es/materials/sxp/cta/AniLink/settingRender.js +6 -0
  32. package/es/materials/sxp/cta/AniLinkPopup/settingRender.d.ts +1 -1
  33. package/es/materials/sxp/cta/AniLinkPopup/settingRender.js +6 -0
  34. package/es/materials/sxp/popup/CommodityDetail/index.d.ts +1 -0
  35. package/es/materials/sxp/popup/CommodityDetail/index.js +15 -9
  36. package/es/materials/sxp/popup/CommodityDetailDiro/index.d.ts +1 -0
  37. package/es/materials/sxp/popup/CommodityDetailDiro/index.js +15 -8
  38. package/es/materials/sxp/popup/CommodityDetailDiroNew/index.d.ts +1 -0
  39. package/es/materials/sxp/popup/CommodityDetailDiroNew/index.js +18 -10
  40. package/es/materials/sxp/popup/CommodityList/index.js +12 -6
  41. package/es/materials/sxp/template/components/settingRender.d.ts +1 -1
  42. package/es/materials/sxp/template/components/settingRender.js +6 -0
  43. package/lib/core/components/SxpPageRender/Modal/index.js +5 -2
  44. package/lib/core/components/SxpPageRender/PictureGroup/Picture.d.ts +1 -1
  45. package/lib/core/components/SxpPageRender/PictureGroup/index.d.ts +4 -1
  46. package/lib/core/components/SxpPageRender/PictureGroup/index.js +23 -4
  47. package/lib/core/components/SxpPageRender/RenderCard.js +6 -1
  48. package/lib/core/components/SxpPageRender/VideoWidget/index.js +21 -12
  49. package/lib/core/components/SxpPageRender/WaterFall/List.js +3 -2
  50. package/lib/core/components/SxpPageRender/WaterFall/WaterfallList.js +3 -2
  51. package/lib/core/components/SxpPageRender/WaterFall/index.js +5 -2
  52. package/lib/core/components/SxpPageRender/index.d.ts +2 -0
  53. package/lib/core/components/SxpPageRender/index.js +20 -25
  54. package/lib/core/context/SxpDataSourceProvider.d.ts +2 -4
  55. package/lib/core/context/SxpDataSourceProvider.js +53 -11
  56. package/lib/core/utils/materials.d.ts +7 -1
  57. package/lib/core/utils/materials.js +5 -2
  58. package/lib/core/utils/tool.d.ts +2 -1
  59. package/lib/core/utils/tool.js +12 -1
  60. package/lib/materials/sxp/cta/AniLink/settingRender.d.ts +11 -0
  61. package/lib/materials/sxp/cta/AniLink/settingRender.js +6 -0
  62. package/lib/materials/sxp/cta/AniLinkPopup/settingRender.d.ts +1 -1
  63. package/lib/materials/sxp/cta/AniLinkPopup/settingRender.js +6 -0
  64. package/lib/materials/sxp/popup/CommodityDetail/index.d.ts +1 -0
  65. package/lib/materials/sxp/popup/CommodityDetail/index.js +15 -9
  66. package/lib/materials/sxp/popup/CommodityDetailDiro/index.d.ts +1 -0
  67. package/lib/materials/sxp/popup/CommodityDetailDiro/index.js +15 -8
  68. package/lib/materials/sxp/popup/CommodityDetailDiroNew/index.d.ts +1 -0
  69. package/lib/materials/sxp/popup/CommodityDetailDiroNew/index.js +18 -10
  70. package/lib/materials/sxp/popup/CommodityList/index.js +11 -5
  71. package/lib/materials/sxp/template/components/settingRender.d.ts +1 -1
  72. package/lib/materials/sxp/template/components/settingRender.js +6 -0
  73. package/package.json +1 -1
@@ -12,7 +12,7 @@ const hooks_1 = require("../../../../core/hooks");
12
12
  const useEventReport_1 = require("../../../../core/hooks/useEventReport");
13
13
  const WaterFall = (props) => {
14
14
  var _a;
15
- const { waterFallData, setOpenHashtag, openHashtag, swiperRef, setWaterFallData, cacheRtcList, setRtcList, cacheActiveIndex, rtcList, setCacheRtcList, setIsFromHashtag, isFromHashtag, bffEventReport, themeTag, selectTag } = (0, hooks_1.useSxpDataSource)();
15
+ const { waterFallData, setOpenHashtag, openHashtag, swiperRef, setWaterFallData, cacheRtcList, setRtcList, cacheActiveIndex, rtcList, setCacheRtcList, setIsFromHashtag, isFromHashtag, bffEventReport, themeTag, selectTag, bffFbReport } = (0, hooks_1.useSxpDataSource)();
16
16
  const { backMainFeed } = (0, useEventReport_1.useEventReport)();
17
17
  const ref = (0, react_1.useRef)(null);
18
18
  const modalEleRef = (0, react_1.useRef)(null);
@@ -81,8 +81,11 @@ const WaterFall = (props) => {
81
81
  (0, react_1.useEffect)(() => {
82
82
  if (openHashtag) {
83
83
  setViewTime(new Date());
84
+ bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
85
+ eventName: 'PageView'
86
+ });
84
87
  }
85
- }, [openHashtag]);
88
+ }, [openHashtag, bffFbReport]);
86
89
  (0, react_1.useEffect)(() => {
87
90
  const initTime = () => {
88
91
  setViewTime(new Date());
@@ -56,6 +56,7 @@ export interface ISxpPageRenderProps {
56
56
  decimalPoint?: string;
57
57
  currencyPosition?: string;
58
58
  showTwoDecimalPoint?: boolean;
59
+ fontFamily?: string;
59
60
  };
60
61
  backButton?: {
61
62
  enable: boolean;
@@ -65,6 +66,7 @@ export interface ISxpPageRenderProps {
65
66
  yPosit: string;
66
67
  y: number;
67
68
  };
69
+ converApi?: any;
68
70
  };
69
71
  descStyle?: CSSProperties;
70
72
  tipText?: {
@@ -51,9 +51,6 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
51
51
  if ((data === null || data === void 0 ? void 0 : data.length) > 0) {
52
52
  const now = new Date();
53
53
  viewTime.current = now;
54
- bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
55
- eventName: 'PageView'
56
- });
57
54
  }
58
55
  }, [data === null || data === void 0 ? void 0 : data.length]);
59
56
  const handleH5EnterLink = (0, react_1.useCallback)(() => {
@@ -62,11 +59,8 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
62
59
  if (data.length > 0) {
63
60
  const now = new Date();
64
61
  viewTime.current = now;
65
- bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
66
- eventName: 'PageView'
67
- });
68
62
  }
69
- }, [data.length, bffFbReport, h5EnterLink]);
63
+ }, [data.length, h5EnterLink]);
70
64
  (0, react_1.useEffect)(() => {
71
65
  var _a;
72
66
  if (!ctaType || (ctaType === null || ctaType === void 0 ? void 0 : ctaType.length) < 1)
@@ -95,7 +89,6 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
95
89
  if (document.visibilityState === 'hidden') {
96
90
  if (repCond) {
97
91
  event_1.default.emit(event_1.SXP_EVENT_TYPE.PAGE_DID_HIDE, item);
98
- handleReportViewImageEnd(item);
99
92
  handleReportProductView(item);
100
93
  }
101
94
  let fromKName = '';
@@ -139,7 +132,6 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
139
132
  }
140
133
  handleH5EnterLink();
141
134
  if (repCond) {
142
- handleViewImageStartEvent(activeIndex);
143
135
  event_1.default.emit(event_1.SXP_EVENT_TYPE.PAGE_DID_SHOW, item);
144
136
  backMainFeed('external', selectTag);
145
137
  }
@@ -232,7 +224,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
232
224
  const t = resolver[(_a = value === null || value === void 0 ? void 0 : value.item) === null || _a === void 0 ? void 0 : _a.type];
233
225
  const Component = (0, withBindDataSource_1.default)(t);
234
226
  const defaulSetting = (_b = t === null || t === void 0 ? void 0 : t.extend) === null || _b === void 0 ? void 0 : _b.defaulSetting;
235
- return (react_1.default.createElement(Component, Object.assign({ key: `${index}${idx}`, textStyle: Object.assign(Object.assign({}, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.textStyle), (_c = value === null || value === void 0 ? void 0 : value.item) === null || _c === void 0 ? void 0 : _c.textStyle), bindDatas: (_e = (_d = value === null || value === void 0 ? void 0 : value.item) === null || _d === void 0 ? void 0 : _d.bindDatas) !== null && _e !== void 0 ? _e : [] }, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.props, (_f = value === null || value === void 0 ? void 0 : value.item) === null || _f === void 0 ? void 0 : _f.props, { event: ((_g = value === null || value === void 0 ? void 0 : value.item) === null || _g === void 0 ? void 0 : _g.event) || {}, schema: schema, id: value === null || value === void 0 ? void 0 : value.id, viewTime: viewTime.current, rec: rec, isPost: true, tipText: tipText, style: Object.assign(Object.assign(Object.assign({}, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.style), (_h = value === null || value === void 0 ? void 0 : value.item) === null || _h === void 0 ? void 0 : _h.style), { height: '100%', overflow: 'auto' }), index: index })));
227
+ return (react_1.default.createElement(Component, Object.assign({ key: `${index}${idx}`, textStyle: Object.assign(Object.assign({}, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.textStyle), (_c = value === null || value === void 0 ? void 0 : value.item) === null || _c === void 0 ? void 0 : _c.textStyle), bindDatas: (_e = (_d = value === null || value === void 0 ? void 0 : value.item) === null || _d === void 0 ? void 0 : _d.bindDatas) !== null && _e !== void 0 ? _e : [] }, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.props, (_f = value === null || value === void 0 ? void 0 : value.item) === null || _f === void 0 ? void 0 : _f.props, { event: ((_g = value === null || value === void 0 ? void 0 : value.item) === null || _g === void 0 ? void 0 : _g.event) || {}, schema: schema, id: value === null || value === void 0 ? void 0 : value.id, viewTime: viewTime.current, rec: rec, isPost: true, tipText: tipText, style: Object.assign(Object.assign(Object.assign({}, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.style), (_h = value === null || value === void 0 ? void 0 : value.item) === null || _h === void 0 ? void 0 : _h.style), { height: '100%', overflow: 'auto' }), index: index, isActive: activeIndex === index })));
236
228
  });
237
229
  }
238
230
  return null;
@@ -389,7 +381,8 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
389
381
  productId: (_g = (_f = item === null || item === void 0 ? void 0 : item.product) === null || _f === void 0 ? void 0 : _f.itemId) !== null && _g !== void 0 ? _g : '',
390
382
  requestId: null,
391
383
  traceInfo: (_j = (_h = item === null || item === void 0 ? void 0 : item.video) === null || _h === void 0 ? void 0 : _h.traceInfo) !== null && _j !== void 0 ? _j : '',
392
- contentFormat
384
+ contentFormat,
385
+ position: ((_k = swiper.previousIndex) !== null && _k !== void 0 ? _k : 0) + ''
393
386
  }
394
387
  });
395
388
  handleReportViewImageEnd(item);
@@ -400,22 +393,17 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
400
393
  eventInfo: {
401
394
  eventSubject: 'scrollUp',
402
395
  eventDescription: 'User scroll up',
403
- contentId: (_l = (_k = item === null || item === void 0 ? void 0 : item.video) === null || _k === void 0 ? void 0 : _k.itemId) !== null && _l !== void 0 ? _l : '',
404
- productId: (_o = (_m = item.product) === null || _m === void 0 ? void 0 : _m.itemId) !== null && _o !== void 0 ? _o : '',
396
+ contentId: (_m = (_l = item === null || item === void 0 ? void 0 : item.video) === null || _l === void 0 ? void 0 : _l.itemId) !== null && _m !== void 0 ? _m : '',
397
+ productId: (_p = (_o = item.product) === null || _o === void 0 ? void 0 : _o.itemId) !== null && _p !== void 0 ? _p : '',
405
398
  requestId: null,
406
- traceInfo: (_q = (_p = item === null || item === void 0 ? void 0 : item.video) === null || _p === void 0 ? void 0 : _p.traceInfo) !== null && _q !== void 0 ? _q : '',
407
- contentFormat
399
+ traceInfo: (_r = (_q = item === null || item === void 0 ? void 0 : item.video) === null || _q === void 0 ? void 0 : _q.traceInfo) !== null && _r !== void 0 ? _r : '',
400
+ contentFormat,
401
+ position: ((_s = swiper.previousIndex) !== null && _s !== void 0 ? _s : 0) + ''
408
402
  }
409
403
  });
410
404
  handleReportViewImageEnd(item);
411
405
  }
412
406
  handleReportProductView(item);
413
- const curItem = data[swiper.activeIndex];
414
- if (!((_r = curItem === null || curItem === void 0 ? void 0 : curItem.video) === null || _r === void 0 ? void 0 : _r.url) && !((_s = curItem === null || curItem === void 0 ? void 0 : curItem.video) === null || _s === void 0 ? void 0 : _s.imgUrls) && (curItem === null || curItem === void 0 ? void 0 : curItem.product)) {
415
- bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
416
- eventName: 'ProductView'
417
- });
418
- }
419
407
  viewTime.current = new Date();
420
408
  };
421
409
  const handleReportProductView = (item) => {
@@ -433,8 +421,8 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
433
421
  viewTime.current = new Date();
434
422
  }
435
423
  }, [openHashtag, data, activeIndex]);
436
- const handleViewImageStartEvent = (activeIndex) => {
437
- var _a, _b, _c, _d, _e, _f;
424
+ const handleViewImageStartEvent = (activeIndex, imgInfo) => {
425
+ var _a, _b, _c, _d, _e, _f, _g, _h;
438
426
  const item = data[activeIndex];
439
427
  if (!((_a = item === null || item === void 0 ? void 0 : item.video) === null || _a === void 0 ? void 0 : _a.url) && ((_b = item === null || item === void 0 ? void 0 : item.video) === null || _b === void 0 ? void 0 : _b.imgUrls)) {
440
428
  const startTime = Date.now();
@@ -449,11 +437,18 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
449
437
  contentTags: JSON.stringify((_f = item === null || item === void 0 ? void 0 : item.video.tags) !== null && _f !== void 0 ? _f : []),
450
438
  position: activeIndex + '',
451
439
  contentFormat: 'image',
452
- traceInfo: item === null || item === void 0 ? void 0 : item.video.traceInfo
440
+ traceInfo: item === null || item === void 0 ? void 0 : item.video.traceInfo,
441
+ contentSize: imgInfo === null || imgInfo === void 0 ? void 0 : imgInfo.contentSize,
442
+ loadTime: imgInfo === null || imgInfo === void 0 ? void 0 : imgInfo.loadTime
453
443
  }
454
444
  });
455
445
  bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
456
- eventName: 'ViewContent'
446
+ eventName: 'ViewContent',
447
+ product: (_g = item === null || item === void 0 ? void 0 : item.video) === null || _g === void 0 ? void 0 : _g.bindProduct
448
+ });
449
+ bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
450
+ eventName: 'PageView',
451
+ product: (_h = item === null || item === void 0 ? void 0 : item.video) === null || _h === void 0 ? void 0 : _h.bindProduct
457
452
  });
458
453
  }
459
454
  };
@@ -67,10 +67,8 @@ export interface ISxpDataSourceContext {
67
67
  videoRef?: any;
68
68
  setVideoRef?: React.Dispatch<React.SetStateAction<any>>;
69
69
  bffFbReport?: (body: {
70
- eventName: string;
71
- actionSource?: string;
72
- eventSourceUrl?: string;
73
- externalId?: string;
70
+ eventName: 'PageView' | 'ProductView' | 'ViewContent';
71
+ product?: any;
74
72
  }) => Promise<any> | undefined | boolean;
75
73
  curTime?: any;
76
74
  h5EnterLink?: () => void;
@@ -192,23 +192,65 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
192
192
  type: 'beacon'
193
193
  });
194
194
  }, [bffFetch, curReqInfo, enableReportEvent, globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview]);
195
- const bffFbReport = (0, react_1.useCallback)((_a) => {
196
- var _b, _c, _d;
197
- var { eventName, actionSource = 'website', eventSourceUrl = (_b = window === null || window === void 0 ? void 0 : window.location) === null || _b === void 0 ? void 0 : _b.href, externalId } = _a;
195
+ const bffFbReport = (0, react_1.useCallback)(({ eventName, product }) => {
196
+ var _a, _b, _c, _d;
198
197
  if (!enableReportEvent || !enabledMetaConversionApi || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview)) {
199
198
  return;
200
199
  }
201
- const fakeUserId = (0, localStore_1.storeAndLoadFeUserId)();
200
+ let jsonParams = (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.converApi) === null || _a === void 0 ? void 0 : _a[eventName];
202
201
  const urlParams = new URLSearchParams(window.location.search);
203
- const fbclid = urlParams.get('fbclid');
202
+ const fbclid = urlParams === null || urlParams === void 0 ? void 0 : urlParams.get('fbclid');
203
+ const fix_par = {
204
+ event_source_url: (_b = window === null || window === void 0 ? void 0 : window.location) === null || _b === void 0 ? void 0 : _b.href,
205
+ external_id: (0, localStore_1.storeAndLoadFeUserId)(),
206
+ client_user_agent: (_d = (_c = window === null || window === void 0 ? void 0 : window.navigator) === null || _c === void 0 ? void 0 : _c.userAgent) !== null && _d !== void 0 ? _d : '',
207
+ fbc: fbclid ? `fb.2.${new Date().getTime()}.${fbclid}` : '',
208
+ fbp: (0, tool_1.getCookie)('_fbp') ? `fb.2.${new Date().getTime()}.${(0, tool_1.getCookie)('_fbp')}` : '',
209
+ time: new Date().getTime()
210
+ };
211
+ const regex = /\{\{(.*?)\}\}/g;
212
+ const getEventParams = (obj) => {
213
+ if (!obj)
214
+ return;
215
+ if (obj instanceof Array) {
216
+ obj === null || obj === void 0 ? void 0 : obj.map((item) => getEventParams(item));
217
+ }
218
+ else {
219
+ for (const key in obj) {
220
+ if (obj.hasOwnProperty(key)) {
221
+ const value = obj === null || obj === void 0 ? void 0 : obj[key];
222
+ if (typeof value === 'object') {
223
+ getEventParams(value);
224
+ }
225
+ else if (typeof value === 'string') {
226
+ const matches = value === null || value === void 0 ? void 0 : value.match(regex);
227
+ if (matches) {
228
+ matches.forEach((match) => {
229
+ const prop = match.substring(2, match.length - 2);
230
+ try {
231
+ const replaceValue = new Function('fix_par', 'product', `return ${prop}`)(fix_par, product);
232
+ if (replaceValue) {
233
+ obj[key] = replaceValue;
234
+ }
235
+ else {
236
+ delete obj[key];
237
+ }
238
+ }
239
+ catch (error) {
240
+ delete obj[key];
241
+ console.error('An error occurred:', error === null || error === void 0 ? void 0 : error.message);
242
+ }
243
+ });
244
+ }
245
+ }
246
+ }
247
+ }
248
+ }
249
+ };
250
+ getEventParams(jsonParams);
204
251
  return bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/fb/events', {
205
252
  method: 'POST',
206
- body: {
207
- eventName,
208
- actionSource,
209
- eventSourceUrl,
210
- userData: Object.assign(Object.assign(Object.assign({ externalId: fakeUserId }, (fbclid && { fbc: `fb.2.${new Date().getTime()}.${fbclid}` })), ((0, tool_1.getCookie)('_fbp') && { fbp: `fb.2.${new Date().getTime()}.${(0, tool_1.getCookie)('_fbp')}` })), { clientUserAgent: (_d = (_c = window === null || window === void 0 ? void 0 : window.navigator) === null || _c === void 0 ? void 0 : _c.userAgent) !== null && _d !== void 0 ? _d : '' })
211
- },
253
+ body: jsonParams,
212
254
  type: 'beacon'
213
255
  });
214
256
  }, [bffFetch, enableReportEvent, enabledMetaConversionApi, globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview]);
@@ -11,9 +11,15 @@ export declare const getBgStyleByImg: (data: any) => "" | {
11
11
  backgroundRepeat: string;
12
12
  backgroundSize: string;
13
13
  };
14
- export declare const getPriceText: ({ product, enableFormattedPrice, globalConfig, isHiddenDef }: {
14
+ interface IfontType {
15
+ 'fontFamily-cn': string;
16
+ 'fontFamily-en': string;
17
+ }
18
+ export declare const getPriceText: ({ product, enableFormattedPrice, globalConfig, isHiddenDef, style }: {
15
19
  product: ProductInfoType | undefined | null;
16
20
  enableFormattedPrice: boolean | undefined;
17
21
  globalConfig: ISxpPageRenderProps['globalConfig'];
18
22
  isHiddenDef?: boolean;
23
+ style?: IfontType | any;
19
24
  }) => string | null;
25
+ export {};
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getPriceText = exports.getBgStyleByImg = exports.getBgStyle = exports.getMediaValueByMode = void 0;
4
+ const tool_1 = require("./tool");
4
5
  const getMediaValueByMode = (obj) => {
5
6
  var _a;
6
7
  if (!obj || typeof obj !== 'object') {
@@ -35,8 +36,8 @@ const getBgStyleByImg = (data) => {
35
36
  return (0, exports.getBgStyle)(imgSrc);
36
37
  };
37
38
  exports.getBgStyleByImg = getBgStyleByImg;
38
- const getPriceText = ({ product, enableFormattedPrice, globalConfig, isHiddenDef }) => {
39
- var _a, _b, _c, _d, _e;
39
+ const getPriceText = ({ product, enableFormattedPrice, globalConfig, isHiddenDef, style }) => {
40
+ var _a, _b, _c, _d, _e, _f, _g, _h;
40
41
  if ((!(product === null || product === void 0 ? void 0 : product.currency) || !(product === null || product === void 0 ? void 0 : product.price)) && isHiddenDef)
41
42
  return null;
42
43
  let price = (product === null || product === void 0 ? void 0 : product.currency) && (product === null || product === void 0 ? void 0 : product.price) ? product === null || product === void 0 ? void 0 : product.price : 7000;
@@ -83,6 +84,8 @@ const getPriceText = ({ product, enableFormattedPrice, globalConfig, isHiddenDef
83
84
  }
84
85
  });
85
86
  }
87
+ currency = `<span style="font-family:${(_h = (_g = (_f = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.priceSymbol) === null || _f === void 0 ? void 0 : _f.fontFamily) !== null && _g !== void 0 ? _g : style === null || style === void 0 ? void 0 : style['fontFamily-en']) !== null && _h !== void 0 ? _h : 'inherit'}">${currency}</span>`;
88
+ text = (0, tool_1.setFontForText)(text, style);
86
89
  if ((priceSymbol === null || priceSymbol === void 0 ? void 0 : priceSymbol.currencyPosition) && (priceSymbol === null || priceSymbol === void 0 ? void 0 : priceSymbol.currencyPosition) !== 'none') {
87
90
  text = (priceSymbol === null || priceSymbol === void 0 ? void 0 : priceSymbol.currencyPosition) === 'left' ? currency + text : text + currency;
88
91
  }
@@ -11,4 +11,5 @@ declare function getBrowserInfo(): string | null;
11
11
  declare function getSystem(): string | null;
12
12
  declare function getDevice(): string | null;
13
13
  declare function getCookie(val: string): string;
14
- export { uuid, getIndexByblockType, getBrowserInfo, getDevice, getSystem, getCookie };
14
+ declare const getResFileSizeFromSrc: (imageSrc?: string) => "" | Promise<string>;
15
+ export { uuid, getIndexByblockType, getBrowserInfo, getDevice, getSystem, getCookie, getResFileSizeFromSrc };
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getCookie = exports.getSystem = exports.getDevice = exports.getBrowserInfo = exports.getIndexByblockType = exports.uuid = exports.setFontForText = exports.getUid = exports.generateRandomString = void 0;
3
+ exports.getResFileSizeFromSrc = exports.getCookie = exports.getSystem = exports.getDevice = exports.getBrowserInfo = exports.getIndexByblockType = exports.uuid = exports.setFontForText = exports.getUid = exports.generateRandomString = void 0;
4
4
  const uuid_1 = require("uuid");
5
5
  function uuid(len, radix) {
6
6
  const chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split('');
@@ -168,3 +168,14 @@ function getCookie(val) {
168
168
  return value !== null && value !== void 0 ? value : '';
169
169
  }
170
170
  exports.getCookie = getCookie;
171
+ const getResFileSizeFromSrc = (imageSrc) => {
172
+ if (!imageSrc)
173
+ return '';
174
+ return fetch(imageSrc)
175
+ .then((response) => response.blob())
176
+ .then((blob) => {
177
+ const fileSizeInMB = blob.size / (1024 * 1024);
178
+ return fileSizeInMB.toFixed(2) + '';
179
+ });
180
+ };
181
+ exports.getResFileSizeFromSrc = getResFileSizeFromSrc;
@@ -9,6 +9,7 @@ declare const _default: ({
9
9
  addonAfter: string;
10
10
  }[];
11
11
  name?: undefined;
12
+ addonAfter?: undefined;
12
13
  direction?: undefined;
13
14
  } | {
14
15
  type: string;
@@ -25,12 +26,21 @@ declare const _default: ({
25
26
  max: number;
26
27
  })[];
27
28
  name?: undefined;
29
+ addonAfter?: undefined;
28
30
  direction?: undefined;
29
31
  } | {
30
32
  type: string;
31
33
  label: string;
32
34
  name: string[];
33
35
  child?: undefined;
36
+ addonAfter?: undefined;
37
+ direction?: undefined;
38
+ } | {
39
+ type: string;
40
+ label: string;
41
+ name: string[];
42
+ addonAfter: string;
43
+ child?: undefined;
34
44
  direction?: undefined;
35
45
  } | {
36
46
  type: string;
@@ -38,6 +48,7 @@ declare const _default: ({
38
48
  label: string;
39
49
  direction: string;
40
50
  child?: undefined;
51
+ addonAfter?: undefined;
41
52
  })[];
42
53
  } | {
43
54
  title: string;
@@ -42,6 +42,12 @@ exports.default = [
42
42
  label: '背景色',
43
43
  name: ['style', 'backgroundColor']
44
44
  },
45
+ {
46
+ type: 'Number',
47
+ label: '背景色毛玻璃',
48
+ name: ['style', 'backdropFilter'],
49
+ addonAfter: 'px'
50
+ },
45
51
  {
46
52
  type: 'TextMargin',
47
53
  name: ['style'],
@@ -33,8 +33,8 @@ declare const _default: ({
33
33
  child?: undefined;
34
34
  addonAfter?: undefined;
35
35
  } | {
36
- label: string;
37
36
  type: string;
37
+ label: string;
38
38
  name: string[];
39
39
  addonAfter: string;
40
40
  child?: undefined;
@@ -42,6 +42,12 @@ exports.default = [
42
42
  label: '背景色',
43
43
  name: ['style', 'backgroundColor']
44
44
  },
45
+ {
46
+ type: 'Number',
47
+ label: '背景色毛玻璃',
48
+ name: ['style', 'backdropFilter'],
49
+ addonAfter: 'px'
50
+ },
45
51
  {
46
52
  label: '外边距',
47
53
  type: 'Number',
@@ -52,6 +52,7 @@ export interface ICommodityDetailProps {
52
52
  };
53
53
  isTel?: boolean;
54
54
  iframeBgColor?: string;
55
+ isActive?: boolean;
55
56
  }
56
57
  declare const _default: React.NamedExoticComponent<ICommodityDetailProps>;
57
58
  export default _default;
@@ -16,7 +16,7 @@ const CommodityGroup_1 = tslib_1.__importDefault(require("../../template/compone
16
16
  const materials_1 = require("../../../../core/utils/materials");
17
17
  const CommodityDetail = (_a) => {
18
18
  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;
19
- var { content, style, bgImg, onClick, schema, isDefault, bottom_image, tipText, isPost, viewTime, rec, swiper, commodityStyles, buttonStyle, index, commodityGroup, popupBg, iframeIcon, commodityImgRatio, isTel, iframeBgColor } = _a, props = tslib_1.__rest(_a, ["content", "style", "bgImg", "onClick", "schema", "isDefault", "bottom_image", "tipText", "isPost", "viewTime", "rec", "swiper", "commodityStyles", "buttonStyle", "index", "commodityGroup", "popupBg", "iframeIcon", "commodityImgRatio", "isTel", "iframeBgColor"]);
19
+ var { content, style, bgImg, onClick, schema, isDefault, bottom_image, tipText, isPost, viewTime, rec, swiper, commodityStyles, buttonStyle, index, commodityGroup, popupBg, iframeIcon, commodityImgRatio, isTel, iframeBgColor, isActive = true } = _a, props = tslib_1.__rest(_a, ["content", "style", "bgImg", "onClick", "schema", "isDefault", "bottom_image", "tipText", "isPost", "viewTime", "rec", "swiper", "commodityStyles", "buttonStyle", "index", "commodityGroup", "popupBg", "iframeIcon", "commodityImgRatio", "isTel", "iframeBgColor", "isActive"]);
20
20
  const { sxpParameter, popupDetailData, isPreview, bffFbReport, popupCurTimeRef, checkCommodityIndexRef, globalConfig } = (0, hooks_1.useSxpDataSource)();
21
21
  const { jumpToWeb, productView } = (0, useEventReport_1.useEventReport)();
22
22
  const curTimeRef = (0, react_1.useRef)(null);
@@ -46,12 +46,17 @@ const CommodityDetail = (_a) => {
46
46
  }
47
47
  };
48
48
  (0, react_1.useEffect)(() => {
49
- if (!isPost) {
50
- bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
51
- eventName: 'ProductView'
52
- });
53
- }
54
- }, [isPost, bffFbReport]);
49
+ if (!isActive)
50
+ return;
51
+ bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
52
+ eventName: 'ProductView',
53
+ product
54
+ });
55
+ bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
56
+ eventName: 'PageView',
57
+ product
58
+ });
59
+ }, [isActive, bffFbReport]);
55
60
  (0, react_1.useEffect)(() => {
56
61
  const initTime = () => {
57
62
  curTimeRef.current = new Date();
@@ -65,7 +70,8 @@ const CommodityDetail = (_a) => {
65
70
  const priceText = (0, materials_1.getPriceText)({
66
71
  product: product,
67
72
  enableFormattedPrice: (_t = commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price) === null || _t === void 0 ? void 0 : _t.enableFormattedPrice,
68
- globalConfig
73
+ globalConfig,
74
+ style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price
69
75
  });
70
76
  const width = (isPreview ? 375 : (_u = style === null || style === void 0 ? void 0 : style.width) !== null && _u !== void 0 ? _u : window.innerWidth) - ((_v = popupBg === null || popupBg === void 0 ? void 0 : popupBg.horizontalMargin) !== null && _v !== void 0 ? _v : 0) * 2;
71
77
  const height = commodityImgRatio ? width * (commodityImgRatio.h / commodityImgRatio.w) : width;
@@ -79,7 +85,7 @@ const CommodityDetail = (_a) => {
79
85
  __html: (0, tool_1.setFontForText)((_b = product === null || product === void 0 ? void 0 : product.title) !== null && _b !== void 0 ? _b : 'Pendant in Yellow Gold with Diamonds, Medium', commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.title)
80
86
  } }),
81
87
  react_1.default.createElement("div", { className: 'pb-commondity-content-price', style: getStyle(commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price), hidden: !!product && !(product === null || product === void 0 ? void 0 : product.price), dangerouslySetInnerHTML: {
82
- __html: (0, tool_1.setFontForText)(priceText, commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price)
88
+ __html: priceText !== null && priceText !== void 0 ? priceText : ''
83
89
  } }),
84
90
  react_1.default.createElement("div", { hidden: !!product && !(product === null || product === void 0 ? void 0 : product.taxInfo), style: getStyle(commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.taxInfo), dangerouslySetInnerHTML: {
85
91
  __html: (0, tool_1.setFontForText)((_c = product === null || product === void 0 ? void 0 : product.taxInfo) !== null && _c !== void 0 ? _c : '税费', commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.taxInfo)
@@ -14,6 +14,7 @@ export interface ICommodityDetailDiroProps {
14
14
  isPost?: boolean;
15
15
  bottom_image?: string;
16
16
  index?: number;
17
+ isActive?: boolean;
17
18
  }
18
19
  declare const _default: React.NamedExoticComponent<ICommodityDetailDiroProps>;
19
20
  export default _default;
@@ -12,7 +12,7 @@ const useEventReport_1 = require("../../../../core/hooks/useEventReport");
12
12
  const FormatImage_1 = tslib_1.__importDefault(require("../../../../core/components/SxpPageRender/FormatImage"));
13
13
  const CommodityDetailDiro = (_a) => {
14
14
  var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
15
- var { style, isDefault, rec, viewTime, isPost, bottom_image, index } = _a, props = tslib_1.__rest(_a, ["style", "isDefault", "rec", "viewTime", "isPost", "bottom_image", "index"]);
15
+ var { style, isDefault, rec, viewTime, isPost, bottom_image, index, isActive = true } = _a, props = tslib_1.__rest(_a, ["style", "isDefault", "rec", "viewTime", "isPost", "bottom_image", "index", "isActive"]);
16
16
  const [spread, setSpread] = (0, react_1.useState)(true);
17
17
  const { sxpParameter } = (0, hooks_1.useSxpDataSource)();
18
18
  const { popupDetailData, bffEventReport, isPreview, swiperRef, bffFbReport } = (0, hooks_1.useSxpDataSource)();
@@ -38,14 +38,21 @@ const CommodityDetailDiro = (_a) => {
38
38
  }
39
39
  };
40
40
  (0, react_1.useEffect)(() => {
41
- if (!isPost) {
42
- bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
43
- eventName: 'ProductView'
44
- });
45
- }
46
- }, [isPost, bffFbReport]);
41
+ if (!isActive)
42
+ return;
43
+ bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
44
+ eventName: 'ProductView',
45
+ product
46
+ });
47
+ bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
48
+ eventName: 'PageView',
49
+ product
50
+ });
51
+ }, [isActive, bffFbReport]);
47
52
  (0, react_1.useEffect)(() => {
48
53
  const initTime = () => {
54
+ if (!isActive)
55
+ return;
49
56
  curTimeRef.current = new Date();
50
57
  };
51
58
  initTime();
@@ -53,7 +60,7 @@ const CommodityDetailDiro = (_a) => {
53
60
  return () => {
54
61
  window.removeEventListener('pageshow', initTime);
55
62
  };
56
- }, []);
63
+ }, [isActive]);
57
64
  const priceText = (0, react_1.useMemo)(() => {
58
65
  var _a, _b, _c, _d, _e;
59
66
  if ((product === null || product === void 0 ? void 0 : product.currency) && (product === null || product === void 0 ? void 0 : product.price)) {
@@ -52,6 +52,7 @@ export interface ICommodityDetailDiroNewProps {
52
52
  };
53
53
  isTel?: boolean;
54
54
  iframeBgColor?: string;
55
+ isActive?: boolean;
55
56
  }
56
57
  declare const _default: React.NamedExoticComponent<ICommodityDetailDiroNewProps>;
57
58
  export default _default;
@@ -16,7 +16,7 @@ const CommodityGroup_1 = tslib_1.__importDefault(require("../../template/compone
16
16
  const materials_1 = require("../../../../core/utils/materials");
17
17
  const CommodityDetailDiroNew = (_a) => {
18
18
  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;
19
- var { style, isDefault, rec, viewTime, isPost, bottom_image, tipText, swiper, commodityStyles, buttonStyle, index, commodityGroup, popupBg, iframeIcon, commodityImgRatio, isTel, iframeBgColor } = _a, props = tslib_1.__rest(_a, ["style", "isDefault", "rec", "viewTime", "isPost", "bottom_image", "tipText", "swiper", "commodityStyles", "buttonStyle", "index", "commodityGroup", "popupBg", "iframeIcon", "commodityImgRatio", "isTel", "iframeBgColor"]);
19
+ var { style, isDefault, rec, viewTime, isPost, bottom_image, tipText, swiper, commodityStyles, buttonStyle, index, commodityGroup, popupBg, iframeIcon, commodityImgRatio, isTel, iframeBgColor, isActive = true } = _a, props = tslib_1.__rest(_a, ["style", "isDefault", "rec", "viewTime", "isPost", "bottom_image", "tipText", "swiper", "commodityStyles", "buttonStyle", "index", "commodityGroup", "popupBg", "iframeIcon", "commodityImgRatio", "isTel", "iframeBgColor", "isActive"]);
20
20
  const [spread, setSpread] = (0, react_1.useState)(true);
21
21
  const { sxpParameter, popupCurTimeRef, popupDetailData, isPreview, bffFbReport, checkCommodityIndexRef, globalConfig } = (0, hooks_1.useSxpDataSource)();
22
22
  const { jumpToWeb, productView } = (0, useEventReport_1.useEventReport)();
@@ -50,14 +50,21 @@ const CommodityDetailDiroNew = (_a) => {
50
50
  }
51
51
  };
52
52
  (0, react_1.useEffect)(() => {
53
- if (!isPost) {
54
- bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
55
- eventName: 'ProductView'
56
- });
57
- }
58
- }, [isPost, bffFbReport]);
53
+ if (!isActive)
54
+ return;
55
+ bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
56
+ eventName: 'ProductView',
57
+ product
58
+ });
59
+ bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
60
+ eventName: 'PageView',
61
+ product
62
+ });
63
+ }, [isActive, bffFbReport]);
59
64
  (0, react_1.useEffect)(() => {
60
65
  const initTime = () => {
66
+ if (!isActive)
67
+ return;
61
68
  curTimeRef.current = new Date();
62
69
  };
63
70
  initTime();
@@ -65,11 +72,12 @@ const CommodityDetailDiroNew = (_a) => {
65
72
  return () => {
66
73
  window.removeEventListener('pageshow', initTime);
67
74
  };
68
- }, []);
75
+ }, [isActive]);
69
76
  const priceText = (0, materials_1.getPriceText)({
70
77
  product,
71
78
  enableFormattedPrice: (_t = commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price) === null || _t === void 0 ? void 0 : _t.enableFormattedPrice,
72
- globalConfig
79
+ globalConfig,
80
+ style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price
73
81
  });
74
82
  const width = (isPreview ? 375 : (_u = style === null || style === void 0 ? void 0 : style.width) !== null && _u !== void 0 ? _u : window.innerWidth) - ((_v = popupBg === null || popupBg === void 0 ? void 0 : popupBg.horizontalMargin) !== null && _v !== void 0 ? _v : 0) * 2;
75
83
  const height = commodityImgRatio ? width * (commodityImgRatio.h / commodityImgRatio.w) : width;
@@ -183,7 +191,7 @@ Made in Italy` })));
183
191
  } })),
184
192
  react_1.default.createElement("div", { className: 'pb-commondityDiroNew-content-top-right' },
185
193
  react_1.default.createElement("div", { className: 'pb-commondityDiroNew-content-top-right-price', hidden: !!product && !(product === null || product === void 0 ? void 0 : product.price), style: getStyle(commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price), dangerouslySetInnerHTML: {
186
- __html: (0, tool_1.setFontForText)(priceText, commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price)
194
+ __html: priceText !== null && priceText !== void 0 ? priceText : ''
187
195
  } }),
188
196
  react_1.default.createElement("div", { className: 'pb-commondityDiroNew-content-top-right-price', hidden: !!product && !(product === null || product === void 0 ? void 0 : product.taxInfo), style: getStyle(commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.taxInfo), dangerouslySetInnerHTML: {
189
197
  __html: (0, tool_1.setFontForText)((_2 = product === null || product === void 0 ? void 0 : product.taxInfo) !== null && _2 !== void 0 ? _2 : '税费', commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.taxInfo)