pb-sxp-ui 1.7.0 → 1.7.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 (34) hide show
  1. package/dist/index.cjs +44 -43
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.css +1 -0
  4. package/dist/index.js +44 -43
  5. package/dist/index.js.map +1 -1
  6. package/dist/index.min.cjs +3 -3
  7. package/dist/index.min.cjs.map +1 -1
  8. package/dist/index.min.js +3 -3
  9. package/dist/index.min.js.map +1 -1
  10. package/dist/pb-ui.js +44 -43
  11. package/dist/pb-ui.js.map +1 -1
  12. package/dist/pb-ui.min.js +3 -3
  13. package/dist/pb-ui.min.js.map +1 -1
  14. package/es/core/components/SxpPageRender/Modal/index.js +6 -3
  15. package/es/core/components/SxpPageRender/WaterFall/index.js +4 -6
  16. package/es/core/components/SxpPageRender/index.js +7 -10
  17. package/es/core/context/SxpDataSourceProvider.js +1 -0
  18. package/es/materials/sxp/popup/CommodityDetail/index.d.ts +1 -0
  19. package/es/materials/sxp/popup/CommodityDetail/index.js +8 -8
  20. package/es/materials/sxp/popup/CommodityDetailDiro/index.d.ts +1 -0
  21. package/es/materials/sxp/popup/CommodityDetailDiro/index.js +15 -13
  22. package/es/materials/sxp/popup/CommodityDetailDiroNew/index.d.ts +1 -0
  23. package/es/materials/sxp/popup/CommodityDetailDiroNew/index.js +15 -13
  24. package/lib/core/components/SxpPageRender/Modal/index.js +5 -2
  25. package/lib/core/components/SxpPageRender/WaterFall/index.js +4 -6
  26. package/lib/core/components/SxpPageRender/index.js +7 -10
  27. package/lib/core/context/SxpDataSourceProvider.js +1 -0
  28. package/lib/materials/sxp/popup/CommodityDetail/index.d.ts +1 -0
  29. package/lib/materials/sxp/popup/CommodityDetail/index.js +8 -8
  30. package/lib/materials/sxp/popup/CommodityDetailDiro/index.d.ts +1 -0
  31. package/lib/materials/sxp/popup/CommodityDetailDiro/index.js +15 -13
  32. package/lib/materials/sxp/popup/CommodityDetailDiroNew/index.d.ts +1 -0
  33. package/lib/materials/sxp/popup/CommodityDetailDiroNew/index.js +15 -13
  34. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  import { debounce } from 'lodash';
2
- import React, { memo, useEffect, useMemo, useRef, useState } from 'react';
2
+ import React, { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react';
3
3
  import * as ReactDOM from 'react-dom';
4
4
  import { useEditor, useSxpDataSource } from '../../../../core/hooks';
5
5
  const closeIcon = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAjhJREFUWEfFlztOw0AQhmeWiJ4CCmpQ5DiRQsIJyAWg5A0lR0AIChDiCJS8ER0cADgBeRSxt4CCDgkaKiq8i+zYeWx2413HEWmiJJv9v535Z2aN8M8vFPT9z3zETD0aAUChUJjwvPFHAJhBhB3Hqd6OAsK2yyucwykAvP38eJX398Z3AJDLlVYR8ToU9Rhj25TWr9KEsKy5dULIGQCMtfZly45TvwsAstm56UwG6wA4FUFwzrdctxZBDcWSy5XWEPG8I84/GcMipdWPtgcsaz5PCHtKG0IuTiqUvjT9U/WYMG2IOPE+AP+LtCB0xKUAAyA2Xbd2o2OG0NQXvTnvhL17D7EPtH9TRCIWwkRcGYGIQgYBABuqPuHXOQBc6pw80lBGwBQiiXhsBHQhkoprA6iM6acjhDQKu5YJZW6XeOI3XJdpvfsdTu52VfXEekD8owQiXGIubpSCbhDbLu8DwKEAd+A41SOdPpE4BS0viFOtvV2iKWqUgn5x/tmS70xR01GuDSCKc86/OCcLgTyyZ0ScDGNhFAktAJV4NFJ9YyaFiAWIE+9uVkkgBgLoig8DMWAa9ro9ynkUdlW5maZDCmB6clmz0k1HH4Cs1Ezbq2p2yEpUuBOKTSZZex00RUWIrltxuuK6EOGDSbGIOPZicpMx6fny650377qNRgBgWeVFQuA+6UjVgREhGIMlSqsPUQqIbZdOOIdZQmCv2axRnU1N1+TzJYsxOEaEV8ep7frPZ7Gd0FTEdP0ft0/kMNdg0eoAAAAASUVORK5CYII=';
@@ -15,7 +15,7 @@ const Modal = ({ visible, onClose, children, modalStyle, padding, popup, schema,
15
15
  const [isShow, setIsShow] = useState(false);
16
16
  const modalEleRef = useRef(null);
17
17
  const { globalConfig, popupDetailData } = useSxpDataSource();
18
- const { schema: _schema } = useEditor();
18
+ const { schema: _schema, popup: _popup } = useEditor();
19
19
  const [scrollTop, setScrollTop] = useState(15);
20
20
  useEffect(() => {
21
21
  const parentNode = document.getElementById('sxp-render');
@@ -53,6 +53,9 @@ const Modal = ({ visible, onClose, children, modalStyle, padding, popup, schema,
53
53
  }, popup === null || popup === void 0 ? void 0 : popup.duration);
54
54
  }
55
55
  }, [isOpen, popup]);
56
+ const child = useCallback(() => {
57
+ return children;
58
+ }, [_popup]);
56
59
  if (!modalEleRef.current)
57
60
  return null;
58
61
  const handleClose = debounce(() => {
@@ -135,6 +138,6 @@ const Modal = ({ visible, onClose, children, modalStyle, padding, popup, schema,
135
138
  var _a;
136
139
  setScrollTop(15 - ((_a = e === null || e === void 0 ? void 0 : e.target) === null || _a === void 0 ? void 0 : _a.scrollTop));
137
140
  }
138
- })), children)))))), modalEleRef.current);
141
+ })), child())))))), modalEleRef.current);
139
142
  };
140
143
  export default memo(Modal);
@@ -14,11 +14,6 @@ const WaterFall = (props) => {
14
14
  const ref = useRef(null);
15
15
  const modalEleRef = useRef(null);
16
16
  const [viewTime, setViewTime] = useState();
17
- useEffect(() => {
18
- bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
19
- eventName: 'PageView'
20
- });
21
- }, []);
22
17
  useEffect(() => {
23
18
  const parentNode = document.getElementById('sxp-render');
24
19
  const node = document.getElementById('water-fall');
@@ -83,8 +78,11 @@ const WaterFall = (props) => {
83
78
  useEffect(() => {
84
79
  if (openHashtag) {
85
80
  setViewTime(new Date());
81
+ bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
82
+ eventName: 'PageView'
83
+ });
86
84
  }
87
- }, [openHashtag]);
85
+ }, [openHashtag, bffFbReport]);
88
86
  useEffect(() => {
89
87
  const initTime = () => {
90
88
  setViewTime(new Date());
@@ -223,7 +223,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
223
223
  const t = resolver[(_a = value === null || value === void 0 ? void 0 : value.item) === null || _a === void 0 ? void 0 : _a.type];
224
224
  const Component = withBindDataSource(t);
225
225
  const defaulSetting = (_b = t === null || t === void 0 ? void 0 : t.extend) === null || _b === void 0 ? void 0 : _b.defaulSetting;
226
- return (React.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 })));
226
+ return (React.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 })));
227
227
  });
228
228
  }
229
229
  return null;
@@ -359,7 +359,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
359
359
  }
360
360
  };
361
361
  const handleScrollEvent = (swiper) => {
362
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
362
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
363
363
  const item = data[swiper.previousIndex];
364
364
  if (!item)
365
365
  return;
@@ -401,13 +401,6 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
401
401
  handleReportViewImageEnd(item);
402
402
  }
403
403
  handleReportProductView(item);
404
- const curItem = data[swiper.activeIndex];
405
- 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)) {
406
- bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
407
- eventName: 'ProductView',
408
- product: (_t = curItem === null || curItem === void 0 ? void 0 : curItem.video) === null || _t === void 0 ? void 0 : _t.bindProduct
409
- });
410
- }
411
404
  viewTime.current = new Date();
412
405
  };
413
406
  const handleReportProductView = (item) => {
@@ -426,7 +419,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
426
419
  }
427
420
  }, [openHashtag, data, activeIndex]);
428
421
  const handleViewImageStartEvent = (activeIndex) => {
429
- var _a, _b, _c, _d, _e, _f, _g;
422
+ var _a, _b, _c, _d, _e, _f, _g, _h;
430
423
  const item = data[activeIndex];
431
424
  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)) {
432
425
  const startTime = Date.now();
@@ -448,6 +441,10 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
448
441
  eventName: 'ViewContent',
449
442
  product: (_g = item === null || item === void 0 ? void 0 : item.video) === null || _g === void 0 ? void 0 : _g.bindProduct
450
443
  });
444
+ bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
445
+ eventName: 'PageView',
446
+ product: (_h = item === null || item === void 0 ? void 0 : item.video) === null || _h === void 0 ? void 0 : _h.bindProduct
447
+ });
451
448
  }
452
449
  };
453
450
  const renderToggleButton = useCallback((visible) => {
@@ -234,6 +234,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
234
234
  }
235
235
  }
236
236
  catch (error) {
237
+ delete obj[key];
237
238
  console.error('An error occurred:', error === null || error === void 0 ? void 0 : error.message);
238
239
  }
239
240
  });
@@ -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;
@@ -14,7 +14,7 @@ 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;
17
- 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 = __rest(_a, ["content", "style", "bgImg", "onClick", "schema", "isDefault", "bottom_image", "tipText", "isPost", "viewTime", "rec", "swiper", "commodityStyles", "buttonStyle", "index", "commodityGroup", "popupBg", "iframeIcon", "commodityImgRatio", "isTel", "iframeBgColor"]);
17
+ 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 = __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"]);
18
18
  const { sxpParameter, popupDetailData, isPreview, bffFbReport, popupCurTimeRef, checkCommodityIndexRef, globalConfig } = useSxpDataSource();
19
19
  const { jumpToWeb, productView } = useEventReport();
20
20
  const curTimeRef = useRef(null);
@@ -44,17 +44,17 @@ const CommodityDetail = (_a) => {
44
44
  }
45
45
  };
46
46
  useEffect(() => {
47
- if (!isPost) {
48
- bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
49
- eventName: 'ProductView',
50
- product
51
- });
52
- }
47
+ if (!isActive)
48
+ return;
49
+ bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
50
+ eventName: 'ProductView',
51
+ product
52
+ });
53
53
  bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
54
54
  eventName: 'PageView',
55
55
  product
56
56
  });
57
- }, [isPost, bffFbReport]);
57
+ }, [isActive, bffFbReport]);
58
58
  useEffect(() => {
59
59
  const initTime = () => {
60
60
  curTimeRef.current = new Date();
@@ -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;
@@ -10,7 +10,7 @@ import { useEventReport } from '../../../../core/hooks/useEventReport';
10
10
  import FormatImage from '../../../../core/components/SxpPageRender/FormatImage';
11
11
  const CommodityDetailDiro = (_a) => {
12
12
  var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
13
- var { style, isDefault, rec, viewTime, isPost, bottom_image, index } = _a, props = __rest(_a, ["style", "isDefault", "rec", "viewTime", "isPost", "bottom_image", "index"]);
13
+ var { style, isDefault, rec, viewTime, isPost, bottom_image, index, isActive = true } = _a, props = __rest(_a, ["style", "isDefault", "rec", "viewTime", "isPost", "bottom_image", "index", "isActive"]);
14
14
  const [spread, setSpread] = useState(true);
15
15
  const { sxpParameter } = useSxpDataSource();
16
16
  const { popupDetailData, bffEventReport, isPreview, swiperRef, bffFbReport } = useSxpDataSource();
@@ -36,19 +36,21 @@ const CommodityDetailDiro = (_a) => {
36
36
  }
37
37
  };
38
38
  useEffect(() => {
39
- if (!isPost) {
40
- bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
41
- eventName: 'ProductView',
42
- product
43
- });
44
- bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
45
- eventName: 'PageView',
46
- product
47
- });
48
- }
49
- }, [isPost, bffFbReport]);
39
+ if (!isActive)
40
+ return;
41
+ bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
42
+ eventName: 'ProductView',
43
+ product
44
+ });
45
+ bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
46
+ eventName: 'PageView',
47
+ product
48
+ });
49
+ }, [isActive, bffFbReport]);
50
50
  useEffect(() => {
51
51
  const initTime = () => {
52
+ if (!isActive)
53
+ return;
52
54
  curTimeRef.current = new Date();
53
55
  };
54
56
  initTime();
@@ -56,7 +58,7 @@ const CommodityDetailDiro = (_a) => {
56
58
  return () => {
57
59
  window.removeEventListener('pageshow', initTime);
58
60
  };
59
- }, []);
61
+ }, [isActive]);
60
62
  const priceText = useMemo(() => {
61
63
  var _a, _b, _c, _d, _e;
62
64
  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;
@@ -14,7 +14,7 @@ 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;
17
- var { style, isDefault, rec, viewTime, isPost, bottom_image, tipText, swiper, commodityStyles, buttonStyle, index, commodityGroup, popupBg, iframeIcon, commodityImgRatio, isTel, iframeBgColor } = _a, props = __rest(_a, ["style", "isDefault", "rec", "viewTime", "isPost", "bottom_image", "tipText", "swiper", "commodityStyles", "buttonStyle", "index", "commodityGroup", "popupBg", "iframeIcon", "commodityImgRatio", "isTel", "iframeBgColor"]);
17
+ var { style, isDefault, rec, viewTime, isPost, bottom_image, tipText, swiper, commodityStyles, buttonStyle, index, commodityGroup, popupBg, iframeIcon, commodityImgRatio, isTel, iframeBgColor, isActive = true } = _a, props = __rest(_a, ["style", "isDefault", "rec", "viewTime", "isPost", "bottom_image", "tipText", "swiper", "commodityStyles", "buttonStyle", "index", "commodityGroup", "popupBg", "iframeIcon", "commodityImgRatio", "isTel", "iframeBgColor", "isActive"]);
18
18
  const [spread, setSpread] = useState(true);
19
19
  const { sxpParameter, popupCurTimeRef, popupDetailData, isPreview, bffFbReport, checkCommodityIndexRef, globalConfig } = useSxpDataSource();
20
20
  const { jumpToWeb, productView } = useEventReport();
@@ -48,19 +48,21 @@ const CommodityDetailDiroNew = (_a) => {
48
48
  }
49
49
  };
50
50
  useEffect(() => {
51
- if (!isPost) {
52
- bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
53
- eventName: 'ProductView',
54
- product
55
- });
56
- bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
57
- eventName: 'PageView',
58
- product
59
- });
60
- }
61
- }, [isPost, bffFbReport]);
51
+ if (!isActive)
52
+ return;
53
+ bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
54
+ eventName: 'ProductView',
55
+ product
56
+ });
57
+ bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
58
+ eventName: 'PageView',
59
+ product
60
+ });
61
+ }, [isActive, bffFbReport]);
62
62
  useEffect(() => {
63
63
  const initTime = () => {
64
+ if (!isActive)
65
+ return;
64
66
  curTimeRef.current = new Date();
65
67
  };
66
68
  initTime();
@@ -68,7 +70,7 @@ const CommodityDetailDiroNew = (_a) => {
68
70
  return () => {
69
71
  window.removeEventListener('pageshow', initTime);
70
72
  };
71
- }, []);
73
+ }, [isActive]);
72
74
  const priceText = getPriceText({
73
75
  product,
74
76
  enableFormattedPrice: (_t = commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price) === null || _t === void 0 ? void 0 : _t.enableFormattedPrice,
@@ -18,7 +18,7 @@ const Modal = ({ visible, onClose, children, modalStyle, padding, popup, schema,
18
18
  const [isShow, setIsShow] = (0, react_1.useState)(false);
19
19
  const modalEleRef = (0, react_1.useRef)(null);
20
20
  const { globalConfig, popupDetailData } = (0, hooks_1.useSxpDataSource)();
21
- const { schema: _schema } = (0, hooks_1.useEditor)();
21
+ const { schema: _schema, popup: _popup } = (0, hooks_1.useEditor)();
22
22
  const [scrollTop, setScrollTop] = (0, react_1.useState)(15);
23
23
  (0, react_1.useEffect)(() => {
24
24
  const parentNode = document.getElementById('sxp-render');
@@ -56,6 +56,9 @@ const Modal = ({ visible, onClose, children, modalStyle, padding, popup, schema,
56
56
  }, popup === null || popup === void 0 ? void 0 : popup.duration);
57
57
  }
58
58
  }, [isOpen, popup]);
59
+ const child = (0, react_1.useCallback)(() => {
60
+ return children;
61
+ }, [_popup]);
59
62
  if (!modalEleRef.current)
60
63
  return null;
61
64
  const handleClose = (0, lodash_1.debounce)(() => {
@@ -138,6 +141,6 @@ const Modal = ({ visible, onClose, children, modalStyle, padding, popup, schema,
138
141
  var _a;
139
142
  setScrollTop(15 - ((_a = e === null || e === void 0 ? void 0 : e.target) === null || _a === void 0 ? void 0 : _a.scrollTop));
140
143
  }
141
- })), children)))))), modalEleRef.current);
144
+ })), child())))))), modalEleRef.current);
142
145
  };
143
146
  exports.default = (0, react_1.memo)(Modal);
@@ -17,11 +17,6 @@ const WaterFall = (props) => {
17
17
  const ref = (0, react_1.useRef)(null);
18
18
  const modalEleRef = (0, react_1.useRef)(null);
19
19
  const [viewTime, setViewTime] = (0, react_1.useState)();
20
- (0, react_1.useEffect)(() => {
21
- bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
22
- eventName: 'PageView'
23
- });
24
- }, []);
25
20
  (0, react_1.useEffect)(() => {
26
21
  const parentNode = document.getElementById('sxp-render');
27
22
  const node = document.getElementById('water-fall');
@@ -86,8 +81,11 @@ const WaterFall = (props) => {
86
81
  (0, react_1.useEffect)(() => {
87
82
  if (openHashtag) {
88
83
  setViewTime(new Date());
84
+ bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
85
+ eventName: 'PageView'
86
+ });
89
87
  }
90
- }, [openHashtag]);
88
+ }, [openHashtag, bffFbReport]);
91
89
  (0, react_1.useEffect)(() => {
92
90
  const initTime = () => {
93
91
  setViewTime(new Date());
@@ -226,7 +226,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
226
226
  const t = resolver[(_a = value === null || value === void 0 ? void 0 : value.item) === null || _a === void 0 ? void 0 : _a.type];
227
227
  const Component = (0, withBindDataSource_1.default)(t);
228
228
  const defaulSetting = (_b = t === null || t === void 0 ? void 0 : t.extend) === null || _b === void 0 ? void 0 : _b.defaulSetting;
229
- 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 })));
229
+ 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 })));
230
230
  });
231
231
  }
232
232
  return null;
@@ -362,7 +362,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
362
362
  }
363
363
  };
364
364
  const handleScrollEvent = (swiper) => {
365
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
365
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
366
366
  const item = data[swiper.previousIndex];
367
367
  if (!item)
368
368
  return;
@@ -404,13 +404,6 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
404
404
  handleReportViewImageEnd(item);
405
405
  }
406
406
  handleReportProductView(item);
407
- const curItem = data[swiper.activeIndex];
408
- 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)) {
409
- bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
410
- eventName: 'ProductView',
411
- product: (_t = curItem === null || curItem === void 0 ? void 0 : curItem.video) === null || _t === void 0 ? void 0 : _t.bindProduct
412
- });
413
- }
414
407
  viewTime.current = new Date();
415
408
  };
416
409
  const handleReportProductView = (item) => {
@@ -429,7 +422,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
429
422
  }
430
423
  }, [openHashtag, data, activeIndex]);
431
424
  const handleViewImageStartEvent = (activeIndex) => {
432
- var _a, _b, _c, _d, _e, _f, _g;
425
+ var _a, _b, _c, _d, _e, _f, _g, _h;
433
426
  const item = data[activeIndex];
434
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)) {
435
428
  const startTime = Date.now();
@@ -451,6 +444,10 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
451
444
  eventName: 'ViewContent',
452
445
  product: (_g = item === null || item === void 0 ? void 0 : item.video) === null || _g === void 0 ? void 0 : _g.bindProduct
453
446
  });
447
+ bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
448
+ eventName: 'PageView',
449
+ product: (_h = item === null || item === void 0 ? void 0 : item.video) === null || _h === void 0 ? void 0 : _h.bindProduct
450
+ });
454
451
  }
455
452
  };
456
453
  const renderToggleButton = (0, react_1.useCallback)((visible) => {
@@ -237,6 +237,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
237
237
  }
238
238
  }
239
239
  catch (error) {
240
+ delete obj[key];
240
241
  console.error('An error occurred:', error === null || error === void 0 ? void 0 : error.message);
241
242
  }
242
243
  });
@@ -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,17 +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
- product
53
- });
54
- }
49
+ if (!isActive)
50
+ return;
51
+ bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
52
+ eventName: 'ProductView',
53
+ product
54
+ });
55
55
  bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
56
56
  eventName: 'PageView',
57
57
  product
58
58
  });
59
- }, [isPost, bffFbReport]);
59
+ }, [isActive, bffFbReport]);
60
60
  (0, react_1.useEffect)(() => {
61
61
  const initTime = () => {
62
62
  curTimeRef.current = new Date();
@@ -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,19 +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
- product
45
- });
46
- bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
47
- eventName: 'PageView',
48
- product
49
- });
50
- }
51
- }, [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]);
52
52
  (0, react_1.useEffect)(() => {
53
53
  const initTime = () => {
54
+ if (!isActive)
55
+ return;
54
56
  curTimeRef.current = new Date();
55
57
  };
56
58
  initTime();
@@ -58,7 +60,7 @@ const CommodityDetailDiro = (_a) => {
58
60
  return () => {
59
61
  window.removeEventListener('pageshow', initTime);
60
62
  };
61
- }, []);
63
+ }, [isActive]);
62
64
  const priceText = (0, react_1.useMemo)(() => {
63
65
  var _a, _b, _c, _d, _e;
64
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,19 +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
- product
57
- });
58
- bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
59
- eventName: 'PageView',
60
- product
61
- });
62
- }
63
- }, [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]);
64
64
  (0, react_1.useEffect)(() => {
65
65
  const initTime = () => {
66
+ if (!isActive)
67
+ return;
66
68
  curTimeRef.current = new Date();
67
69
  };
68
70
  initTime();
@@ -70,7 +72,7 @@ const CommodityDetailDiroNew = (_a) => {
70
72
  return () => {
71
73
  window.removeEventListener('pageshow', initTime);
72
74
  };
73
- }, []);
75
+ }, [isActive]);
74
76
  const priceText = (0, materials_1.getPriceText)({
75
77
  product,
76
78
  enableFormattedPrice: (_t = commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price) === null || _t === void 0 ? void 0 : _t.enableFormattedPrice,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pb-sxp-ui",
3
- "version": "1.7.0",
3
+ "version": "1.7.2",
4
4
  "description": "React enterprise-class UI components",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",