pb-sxp-ui 1.2.5 → 1.2.6

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 (36) hide show
  1. package/dist/index.cjs +65 -37
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.css +9 -1
  4. package/dist/index.js +65 -37
  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 +65 -37
  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/Popup/index.js +7 -5
  15. package/es/core/components/SxpPageRender/index.js +2 -2
  16. package/es/core/context/SxpDataSourceProvider.js +3 -3
  17. package/es/core/hooks/useEventReport.js +4 -4
  18. package/es/materials/sxp/popup/CommodityDetail/index.d.ts +1 -0
  19. package/es/materials/sxp/popup/CommodityDetail/index.js +11 -6
  20. package/es/materials/sxp/popup/CommodityDetail/material.js +6 -0
  21. package/es/materials/sxp/popup/CommodityDetail/settingRender.js +4 -0
  22. package/es/materials/sxp/popup/CommodityDetailDiroNew/index.js +5 -2
  23. package/es/materials/sxp/popup/CommodityList/index.js +10 -10
  24. package/es/materials/sxp/template/components/CommodityGroup.js +11 -1
  25. package/lib/core/components/SxpPageRender/Popup/index.js +7 -5
  26. package/lib/core/components/SxpPageRender/index.js +2 -2
  27. package/lib/core/context/SxpDataSourceProvider.js +3 -3
  28. package/lib/core/hooks/useEventReport.js +4 -4
  29. package/lib/materials/sxp/popup/CommodityDetail/index.d.ts +1 -0
  30. package/lib/materials/sxp/popup/CommodityDetail/index.js +10 -5
  31. package/lib/materials/sxp/popup/CommodityDetail/material.js +6 -0
  32. package/lib/materials/sxp/popup/CommodityDetail/settingRender.js +4 -0
  33. package/lib/materials/sxp/popup/CommodityDetailDiroNew/index.js +5 -2
  34. package/lib/materials/sxp/popup/CommodityList/index.js +10 -10
  35. package/lib/materials/sxp/template/components/CommodityGroup.js +11 -1
  36. package/package.json +1 -1
@@ -17,7 +17,7 @@ const CommodityDetailDiroNew = (_a) => {
17
17
  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;
18
18
  var { style, isDefault, rec, viewTime, isPost, bottom_image, tipText, swiper, commodityStyles, buttonStyle, index, commodityGroup } = _a, props = tslib_1.__rest(_a, ["style", "isDefault", "rec", "viewTime", "isPost", "bottom_image", "tipText", "swiper", "commodityStyles", "buttonStyle", "index", "commodityGroup"]);
19
19
  const [spread, setSpread] = (0, react_1.useState)(true);
20
- const { sxpParameter, popupCurTimeRef, popupDetailData, isPreview, bffFbReport } = (0, hooks_1.useSxpDataSource)();
20
+ const { sxpParameter, popupCurTimeRef, popupDetailData, isPreview, bffFbReport, checkCommodityIndexRef } = (0, hooks_1.useSxpDataSource)();
21
21
  const { jumpToWeb, productView } = (0, useEventReport_1.useEventReport)();
22
22
  const [stopSlide, setStopSlide] = (0, react_1.useState)(false);
23
23
  const [isBottom, setIsBottom] = (0, react_1.useState)(false);
@@ -32,6 +32,7 @@ const CommodityDetailDiroNew = (_a) => {
32
32
  : (_k = (_j = (_h = data === null || data === void 0 ? void 0 : data.video) === null || _h === void 0 ? void 0 : _h.bindProduct) === null || _j === void 0 ? void 0 : _j.bindCta) !== null && _k !== void 0 ? _k : (_o = (_m = (_l = data === null || data === void 0 ? void 0 : data.video) === null || _l === void 0 ? void 0 : _l.bindProducts) === null || _m === void 0 ? void 0 : _m[0]) === null || _o === void 0 ? void 0 : _o.bindCta;
33
33
  const position = isPost ? index : popupDetailData === null || popupDetailData === void 0 ? void 0 : popupDetailData.index;
34
34
  if (!isPost && (commodityGroup === null || commodityGroup === void 0 ? void 0 : commodityGroup.open) && ((_p = data === null || data === void 0 ? void 0 : data.video) === null || _p === void 0 ? void 0 : _p.bindProducts) && ((_r = (_q = data === null || data === void 0 ? void 0 : data.video) === null || _q === void 0 ? void 0 : _q.bindProducts) === null || _r === void 0 ? void 0 : _r.length) > 0) {
35
+ checkCommodityIndexRef.current = checkCommodityIndex;
35
36
  const p = (_s = data === null || data === void 0 ? void 0 : data.video) === null || _s === void 0 ? void 0 : _s.bindProducts[checkCommodityIndex];
36
37
  product = p;
37
38
  cta = p === null || p === void 0 ? void 0 : p.bindCta;
@@ -92,6 +93,7 @@ Made in Italy` })));
92
93
  const handleClick = (0, react_1.useCallback)((index) => {
93
94
  popupCurTimeRef.current = new Date();
94
95
  setCheckCommodityIndex(index);
96
+ checkCommodityIndexRef.current = index;
95
97
  }, []);
96
98
  const renderCommodityGroup = (0, react_1.useCallback)(() => {
97
99
  var _a, _b, _c;
@@ -110,6 +112,7 @@ Made in Italy` })));
110
112
  }, loop: true, autoplay: {
111
113
  delay: (swiper === null || swiper === void 0 ? void 0 : swiper.delay) * 1000
112
114
  } }, (_v = product === null || product === void 0 ? void 0 : product.homePage) === null || _v === void 0 ? void 0 : _v.map((src) => {
115
+ var _a;
113
116
  return (react_1.default.createElement(react_2.SwiperSlide, { key: src },
114
117
  react_1.default.createElement("div", { style: {
115
118
  overflow: 'hidden',
@@ -122,7 +125,7 @@ Made in Italy` })));
122
125
  objectFit: 'cover',
123
126
  display: 'block',
124
127
  objectPosition: `50% ${(swiper === null || swiper === void 0 ? void 0 : swiper.translateY) ? (swiper === null || swiper === void 0 ? void 0 : swiper.translateY) + 50 : 50}%`
125
- }, src: src }))));
128
+ }, src: (_a = src !== null && src !== void 0 ? src : sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) !== null && _a !== void 0 ? _a : bottom_image }))));
126
129
  }))),
127
130
  !((_w = product === null || product === void 0 ? void 0 : product.homePage) === null || _w === void 0 ? void 0 : _w.length) && (react_1.default.createElement("div", { className: (0, css_1.css)({
128
131
  position: 'relative',
@@ -44,25 +44,24 @@ const CommodityList = (_a) => {
44
44
  onClick === null || onClick === void 0 ? void 0 : onClick();
45
45
  }
46
46
  }, popup === null || popup === void 0 ? void 0 : popup.duration);
47
- return (react_1.default.createElement("div", { className: (0, css_1.css)(Object.assign(Object.assign({}, style), { display: 'flex', flexDirection: 'column', gap: '10px', padding: '0 20px', marginTop: '50px' })) }, product === null || product === void 0 ? void 0 : product.map((item, index) => {
48
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
47
+ return (react_1.default.createElement("div", { className: (0, css_1.css)(Object.assign(Object.assign({}, style), { display: 'flex', flexDirection: 'column', gap: '10px', padding: '0 20px', marginTop: '50px', boxSizing: 'border-box' })) }, product === null || product === void 0 ? void 0 : product.map((item, index) => {
48
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
49
49
  return (react_1.default.createElement(react_1.default.Fragment, null, recData && !(item === null || item === void 0 ? void 0 : item.bindCta) ? null : (react_1.default.createElement("div", Object.assign({ key: index }, props, { className: (0, css_1.css)({
50
50
  display: 'flex'
51
51
  }), onClick: () => handleClick(item, index) }),
52
52
  react_1.default.createElement(Img_1.default, { src: (_d = (_c = (_a = item === null || item === void 0 ? void 0 : item.cover) !== null && _a !== void 0 ? _a : (_b = item === null || item === void 0 ? void 0 : item.homePage) === null || _b === void 0 ? void 0 : _b[0]) !== null && _c !== void 0 ? _c : sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) !== null && _d !== void 0 ? _d : bottom_image, rec: recData, item: item, index: index, translateY: translateY, imgStyle: commodityPicture, enableEventReport: false }),
53
53
  react_1.default.createElement("div", { style: {
54
- flex: 1,
55
- width: `calc(100% - ${(_e = commodityPicture === null || commodityPicture === void 0 ? void 0 : commodityPicture.width) !== null && _e !== void 0 ? _e : 0}px - ${(_f = commodityPicture === null || commodityPicture === void 0 ? void 0 : commodityPicture.marginRight) !== null && _f !== void 0 ? _f : 0}px - ${(_g = style === null || style === void 0 ? void 0 : style.padding) !== null && _g !== void 0 ? _g : 0}px)`,
54
+ width: `calc(100% - ${(_e = commodityPicture === null || commodityPicture === void 0 ? void 0 : commodityPicture.width) !== null && _e !== void 0 ? _e : 0}px - ${(_f = commodityPicture === null || commodityPicture === void 0 ? void 0 : commodityPicture.marginRight) !== null && _f !== void 0 ? _f : 0}px)`,
56
55
  display: 'flex',
57
56
  flexDirection: 'column',
58
57
  justifyContent: 'space-between'
59
58
  } },
60
59
  react_1.default.createElement("div", null,
61
60
  react_1.default.createElement("div", { className: 'one-line-ellipsis', style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.title, hidden: !!item && !(item === null || item === void 0 ? void 0 : item.title), dangerouslySetInnerHTML: {
62
- __html: (0, tool_1.setFontForText)((_h = item === null || item === void 0 ? void 0 : item.title) !== null && _h !== void 0 ? _h : 'Pendant in Yellow Gold with Diamonds, Medium', commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.title)
61
+ __html: (0, tool_1.setFontForText)((_g = item === null || item === void 0 ? void 0 : item.title) !== null && _g !== void 0 ? _g : 'Pendant in Yellow Gold with Diamonds, Medium', commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.title)
63
62
  } }),
64
63
  react_1.default.createElement("div", { className: 'two-line-ellipsis', style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.collection, hidden: !!item && (!(item === null || item === void 0 ? void 0 : item.collection) || (item === null || item === void 0 ? void 0 : item.collection) === ''), dangerouslySetInnerHTML: {
65
- __html: (0, tool_1.setFontForText)((_j = item === null || item === void 0 ? void 0 : item.collection) !== null && _j !== void 0 ? _j : 'Tiffany Lock', commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.collection)
64
+ __html: (0, tool_1.setFontForText)((_h = item === null || item === void 0 ? void 0 : item.collection) !== null && _h !== void 0 ? _h : 'Tiffany Lock', commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.collection)
66
65
  } })),
67
66
  react_1.default.createElement("div", { className: (0, css_1.css)({
68
67
  display: 'flex',
@@ -71,11 +70,12 @@ const CommodityList = (_a) => {
71
70
  width: '100%',
72
71
  overflow: 'hidden'
73
72
  }) },
74
- react_1.default.createElement("div", { style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price, hidden: !!item && !(item === null || item === void 0 ? void 0 : item.price), dangerouslySetInnerHTML: {
75
- __html: (0, tool_1.setFontForText)(priceText(item), commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price)
76
- } }),
73
+ react_1.default.createElement("div", null,
74
+ react_1.default.createElement("div", { style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price, hidden: !!item && !(item === null || item === void 0 ? void 0 : item.price), dangerouslySetInnerHTML: {
75
+ __html: (0, tool_1.setFontForText)(priceText(item), commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price)
76
+ } })),
77
77
  react_1.default.createElement("div", { className: 'one-line-ellipsis', style: Object.assign(Object.assign({}, buttonStyle), { padding: '0 15px' }), dangerouslySetInnerHTML: {
78
- __html: (0, tool_1.setFontForText)((_l = (_k = item === null || item === void 0 ? void 0 : item.bindCta) === null || _k === void 0 ? void 0 : _k.enTitle) !== null && _l !== void 0 ? _l : 'Shop Now', buttonStyle)
78
+ __html: (0, tool_1.setFontForText)((_k = (_j = item === null || item === void 0 ? void 0 : item.bindCta) === null || _j === void 0 ? void 0 : _j.enTitle) !== null && _k !== void 0 ? _k : 'Shop Now', buttonStyle)
79
79
  } })))))));
80
80
  })));
81
81
  };
@@ -4,10 +4,20 @@ const tslib_1 = require("tslib");
4
4
  const react_1 = tslib_1.__importStar(require("react"));
5
5
  const Scroll_1 = tslib_1.__importDefault(require("./Scroll"));
6
6
  const FormatImage_1 = tslib_1.__importDefault(require("../../../../core/components/SxpPageRender/FormatImage"));
7
+ const hooks_1 = require("../../../../core/hooks");
7
8
  const react_2 = require("swiper/react");
8
9
  const css_1 = require("@emotion/css");
10
+ const useEventReport_1 = require("../../../../core/hooks/useEventReport");
9
11
  const CommodityGroup = ({ products, data, defImg, style, onCLick, popupDetailData, check }) => {
10
12
  var _a;
13
+ const { productView } = (0, useEventReport_1.useEventReport)();
14
+ const { popupCurTimeRef } = (0, hooks_1.useSxpDataSource)();
15
+ const handleClick = (item, index) => {
16
+ if (check === index)
17
+ return;
18
+ productView(popupDetailData, item, item === null || item === void 0 ? void 0 : item.bindCta, popupCurTimeRef.current, popupDetailData === null || popupDetailData === void 0 ? void 0 : popupDetailData.index);
19
+ onCLick === null || onCLick === void 0 ? void 0 : onCLick(index);
20
+ };
11
21
  return (react_1.default.createElement(react_1.default.Fragment, null, (data === null || data === void 0 ? void 0 : data.open) && ((products && (products === null || products === void 0 ? void 0 : products.length) > 1) || !popupDetailData) && (react_1.default.createElement(Scroll_1.default, { enableSlideActive: true, isPadding: false, style: Object.assign(Object.assign({}, style), data === null || data === void 0 ? void 0 : data.style) }, (_a = (popupDetailData ? products : [0, 1, 2, 3])) === null || _a === void 0 ? void 0 : _a.map((item, index) => {
12
22
  var _a, _b, _c;
13
23
  return (react_1.default.createElement(react_1.default.Fragment, null, (item === null || item === void 0 ? void 0 : item.bindCta) ? (react_1.default.createElement(react_2.SwiperSlide, { className: (0, css_1.css)({
@@ -15,7 +25,7 @@ const CommodityGroup = ({ products, data, defImg, style, onCLick, popupDetailDat
15
25
  height: '50px',
16
26
  marginRight: '10px'
17
27
  }), onClick: () => {
18
- onCLick === null || onCLick === void 0 ? void 0 : onCLick(index);
28
+ handleClick(item, index);
19
29
  }, key: index },
20
30
  react_1.default.createElement(FormatImage_1.default, { style: {
21
31
  height: '100%',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pb-sxp-ui",
3
- "version": "1.2.5",
3
+ "version": "1.2.6",
4
4
  "description": "React enterprise-class UI components",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",