pb-sxp-ui 1.2.3 → 1.2.5
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.
- package/dist/index.cjs +276 -172
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +2 -2
- package/dist/index.js +276 -172
- package/dist/index.js.map +1 -1
- package/dist/index.min.cjs +3 -3
- package/dist/index.min.cjs.map +1 -1
- package/dist/index.min.js +3 -3
- package/dist/index.min.js.map +1 -1
- package/dist/pb-ui.js +276 -172
- package/dist/pb-ui.js.map +1 -1
- package/dist/pb-ui.min.js +3 -3
- package/dist/pb-ui.min.js.map +1 -1
- package/es/core/components/SxpPageRender/Hashtag/index.js +0 -1
- package/es/core/components/SxpPageRender/LikeButton/index.js +34 -15
- package/es/core/components/SxpPageRender/Modal/index.js +16 -8
- package/es/core/components/SxpPageRender/Popup/index.js +24 -13
- package/es/core/components/SxpPageRender/RenderCard.d.ts +1 -0
- package/es/core/components/SxpPageRender/RenderCard.js +17 -4
- package/es/core/components/SxpPageRender/index.js +3 -3
- package/es/core/components/SxpPageRender/typing.d.ts +1 -0
- package/es/core/context/SxpDataSourceProvider.d.ts +3 -3
- package/es/core/context/SxpDataSourceProvider.js +7 -3
- package/es/materials/sxp/cta/AniLink/index.js +5 -1
- package/es/materials/sxp/cta/AniLinkPopup/index.d.ts +1 -0
- package/es/materials/sxp/cta/AniLinkPopup/index.js +12 -18
- package/es/materials/sxp/cta/AniLinkPopup/settingRender.js +1 -1
- package/es/materials/sxp/popup/CommodityDetail/index.js +25 -13
- package/es/materials/sxp/popup/CommodityDetailDiroNew/index.js +28 -17
- package/es/materials/sxp/popup/CommodityList/index.js +28 -10
- package/es/materials/sxp/popup/CommodityList/material.js +1 -0
- package/es/materials/sxp/popup/CommodityList/settingRender.js +5 -0
- package/es/materials/sxp/template/MultiCommodity/index.js +3 -3
- package/es/materials/sxp/template/MultiCommodityDiro/index.js +3 -3
- package/es/materials/sxp/template/components/CommodityGroup.d.ts +4 -0
- package/es/materials/sxp/template/components/CommodityGroup.js +12 -15
- package/es/materials/sxp/template/components/Img.d.ts +1 -0
- package/es/materials/sxp/template/components/Img.js +3 -3
- package/es/materials/sxp/template/components/Scroll.d.ts +1 -0
- package/es/materials/sxp/template/components/Scroll.js +5 -4
- package/lib/core/components/SxpPageRender/Hashtag/index.js +0 -1
- package/lib/core/components/SxpPageRender/LikeButton/index.js +34 -15
- package/lib/core/components/SxpPageRender/Modal/index.js +16 -8
- package/lib/core/components/SxpPageRender/Popup/index.js +23 -12
- package/lib/core/components/SxpPageRender/RenderCard.d.ts +1 -0
- package/lib/core/components/SxpPageRender/RenderCard.js +17 -4
- package/lib/core/components/SxpPageRender/index.js +3 -3
- package/lib/core/components/SxpPageRender/typing.d.ts +1 -0
- package/lib/core/context/SxpDataSourceProvider.d.ts +3 -3
- package/lib/core/context/SxpDataSourceProvider.js +7 -3
- package/lib/materials/sxp/cta/AniLink/index.js +5 -1
- package/lib/materials/sxp/cta/AniLinkPopup/index.d.ts +1 -0
- package/lib/materials/sxp/cta/AniLinkPopup/index.js +11 -17
- package/lib/materials/sxp/cta/AniLinkPopup/settingRender.js +1 -1
- package/lib/materials/sxp/popup/CommodityDetail/index.js +24 -12
- package/lib/materials/sxp/popup/CommodityDetailDiroNew/index.js +28 -17
- package/lib/materials/sxp/popup/CommodityList/index.js +27 -9
- package/lib/materials/sxp/popup/CommodityList/material.js +1 -0
- package/lib/materials/sxp/popup/CommodityList/settingRender.js +5 -0
- package/lib/materials/sxp/template/MultiCommodity/index.js +3 -3
- package/lib/materials/sxp/template/MultiCommodityDiro/index.js +3 -3
- package/lib/materials/sxp/template/components/CommodityGroup.d.ts +4 -0
- package/lib/materials/sxp/template/components/CommodityGroup.js +11 -14
- package/lib/materials/sxp/template/components/Img.d.ts +1 -0
- package/lib/materials/sxp/template/components/Img.js +3 -3
- package/lib/materials/sxp/template/components/Scroll.d.ts +1 -0
- package/lib/materials/sxp/template/components/Scroll.js +5 -4
- package/package.json +1 -1
@@ -5,14 +5,16 @@ const css_1 = require("@emotion/css");
|
|
5
5
|
const react_1 = tslib_1.__importStar(require("react"));
|
6
6
|
const hooks_1 = require("../../../../core/hooks");
|
7
7
|
require("./index.less");
|
8
|
+
const useEventReport_1 = require("../../../../core/hooks/useEventReport");
|
8
9
|
const tool_1 = require("../../../../core/utils/tool");
|
9
10
|
const Img_1 = tslib_1.__importDefault(require("../../template/components/Img"));
|
10
|
-
const
|
11
|
+
const lodash_1 = require("lodash");
|
11
12
|
const CommodityList = (_a) => {
|
12
13
|
var _b, _c;
|
13
|
-
var { style, isDefault, rec, viewTime, isPost, bottom_image, commodityStyles, buttonStyle, index, translateY = 0, commodityPicture, isExternalLink } = _a, props = tslib_1.__rest(_a, ["style", "isDefault", "rec", "viewTime", "isPost", "bottom_image", "commodityStyles", "buttonStyle", "index", "translateY", "commodityPicture", "isExternalLink"]);
|
14
|
-
const { sxpParameter } = (0, hooks_1.useSxpDataSource)();
|
15
|
-
const {
|
14
|
+
var { style, isDefault, rec, viewTime, isPost, bottom_image, commodityStyles, buttonStyle, index, translateY = 0, commodityPicture, isExternalLink, onClick } = _a, props = tslib_1.__rest(_a, ["style", "isDefault", "rec", "viewTime", "isPost", "bottom_image", "commodityStyles", "buttonStyle", "index", "translateY", "commodityPicture", "isExternalLink", "onClick"]);
|
15
|
+
const { sxpParameter, popupDetailData, setPopupDetailData, ctaEvent } = (0, hooks_1.useSxpDataSource)();
|
16
|
+
const { jumpToWeb } = (0, useEventReport_1.useEventReport)();
|
17
|
+
const { popup } = (0, hooks_1.useEditor)();
|
16
18
|
const recData = isPost ? rec : popupDetailData;
|
17
19
|
const product = (_c = (_b = recData === null || recData === void 0 ? void 0 : recData.video) === null || _b === void 0 ? void 0 : _b.bindProducts) !== null && _c !== void 0 ? _c : [null, null, null, null];
|
18
20
|
const priceText = (0, react_1.useCallback)((product) => {
|
@@ -26,12 +28,28 @@ const CommodityList = (_a) => {
|
|
26
28
|
return '$7,000';
|
27
29
|
}
|
28
30
|
}, []);
|
31
|
+
const handleClick = (0, lodash_1.throttle)((item, multiCheckIndex) => {
|
32
|
+
ctaEvent === null || ctaEvent === void 0 ? void 0 : ctaEvent({
|
33
|
+
eventSubject: 'clickCta',
|
34
|
+
eventDescription: 'User clicked the CTA'
|
35
|
+
}, recData, item, index);
|
36
|
+
setPopupDetailData === null || setPopupDetailData === void 0 ? void 0 : setPopupDetailData(Object.assign(Object.assign({}, recData), { video: Object.assign(Object.assign({}, recData === null || recData === void 0 ? void 0 : recData.video), { bindProduct: item }), index, multiCheckIndex }));
|
37
|
+
if (isExternalLink) {
|
38
|
+
if (item === null || item === void 0 ? void 0 : item.link) {
|
39
|
+
jumpToWeb(recData, item, item.bindCta, index);
|
40
|
+
window.location.href = window.getJointUtmLink(item.link);
|
41
|
+
}
|
42
|
+
}
|
43
|
+
else {
|
44
|
+
onClick === null || onClick === void 0 ? void 0 : onClick();
|
45
|
+
}
|
46
|
+
}, popup === null || popup === void 0 ? void 0 : popup.duration);
|
29
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) => {
|
30
48
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
31
|
-
return (react_1.default.createElement(
|
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)({
|
32
50
|
display: 'flex'
|
33
|
-
}) }),
|
34
|
-
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 }),
|
51
|
+
}), onClick: () => handleClick(item, index) }),
|
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 }),
|
35
53
|
react_1.default.createElement("div", { style: {
|
36
54
|
flex: 1,
|
37
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)`,
|
@@ -56,9 +74,9 @@ const CommodityList = (_a) => {
|
|
56
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: {
|
57
75
|
__html: (0, tool_1.setFontForText)(priceText(item), commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price)
|
58
76
|
} }),
|
59
|
-
react_1.default.createElement("div", { className: 'one-line-ellipsis', style: Object.assign(Object.assign({}, buttonStyle), { padding: '0 15px'
|
77
|
+
react_1.default.createElement("div", { className: 'one-line-ellipsis', style: Object.assign(Object.assign({}, buttonStyle), { padding: '0 15px' }), dangerouslySetInnerHTML: {
|
60
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)
|
61
|
-
} })))));
|
79
|
+
} })))))));
|
62
80
|
})));
|
63
81
|
};
|
64
82
|
exports.default = (0, react_1.memo)(CommodityList);
|
@@ -19,12 +19,12 @@ const MultiCommodity = (_a) => {
|
|
19
19
|
const { popup } = (0, hooks_1.useEditor)();
|
20
20
|
const [products, setProducts] = (0, react_1.useState)((_c = (_b = recData === null || recData === void 0 ? void 0 : recData.video) === null || _b === void 0 ? void 0 : _b.bindProducts) !== null && _c !== void 0 ? _c : [1, 2]);
|
21
21
|
const { jumpToWeb } = (0, useEventReport_1.useEventReport)();
|
22
|
-
const handleClick = (0, lodash_1.throttle)((item) => {
|
22
|
+
const handleClick = (0, lodash_1.throttle)((item, multiCheckIndex) => {
|
23
23
|
ctaEvent === null || ctaEvent === void 0 ? void 0 : ctaEvent({
|
24
24
|
eventSubject: 'clickCta',
|
25
25
|
eventDescription: 'User clicked the CTA'
|
26
26
|
}, recData, item, index);
|
27
|
-
setPopupDetailData === null || setPopupDetailData === void 0 ? void 0 : setPopupDetailData(Object.assign(Object.assign({}, recData), { video: Object.assign(Object.assign({}, recData === null || recData === void 0 ? void 0 : recData.video), { bindProduct: item }), index }));
|
27
|
+
setPopupDetailData === null || setPopupDetailData === void 0 ? void 0 : setPopupDetailData(Object.assign(Object.assign({}, recData), { video: Object.assign(Object.assign({}, recData === null || recData === void 0 ? void 0 : recData.video), { bindProduct: item }), index, multiCheckIndex }));
|
28
28
|
if (isExternalLink) {
|
29
29
|
if (item === null || item === void 0 ? void 0 : item.link) {
|
30
30
|
jumpToWeb(recData, item, item.bindCta, index);
|
@@ -37,7 +37,7 @@ const MultiCommodity = (_a) => {
|
|
37
37
|
}, popup === null || popup === void 0 ? void 0 : popup.duration);
|
38
38
|
return (react_1.default.createElement(Scroll_1.default, { isPadding: !!recData }, products === null || products === void 0 ? void 0 : products.map((item, index) => {
|
39
39
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
40
|
-
return (react_1.default.createElement(react_1.default.Fragment, null, recData && !(item === null || item === void 0 ? void 0 : item.bindCta) ? null : (react_1.default.createElement(react_2.SwiperSlide, Object.assign({ key: index, className: (0, css_1.css)(Object.assign(Object.assign({}, style), { display: 'flex', flexShrink: 0, marginLeft: 0, marginRight: '8px' })) }, props, { onClick: () => handleClick(item) }),
|
40
|
+
return (react_1.default.createElement(react_1.default.Fragment, null, recData && !(item === null || item === void 0 ? void 0 : item.bindCta) ? null : (react_1.default.createElement(react_2.SwiperSlide, Object.assign({ key: index, className: (0, css_1.css)(Object.assign(Object.assign({}, style), { display: 'flex', flexShrink: 0, marginLeft: 0, marginRight: '8px' })) }, props, { onClick: () => handleClick(item, index) }),
|
41
41
|
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: ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.img }),
|
42
42
|
react_1.default.createElement("div", { className: (0, css_1.css)({
|
43
43
|
color: '#fff',
|
@@ -18,12 +18,12 @@ const MultiCommodityDiro = (_a) => {
|
|
18
18
|
const { popup } = (0, hooks_1.useEditor)();
|
19
19
|
const { jumpToWeb } = (0, useEventReport_1.useEventReport)();
|
20
20
|
const [products, setProducts] = (0, react_1.useState)((_c = (_b = recData === null || recData === void 0 ? void 0 : recData.video) === null || _b === void 0 ? void 0 : _b.bindProducts) !== null && _c !== void 0 ? _c : [1, 2]);
|
21
|
-
const handleClick = (0, lodash_1.throttle)((item) => {
|
21
|
+
const handleClick = (0, lodash_1.throttle)((item, multiCheckIndex) => {
|
22
22
|
ctaEvent === null || ctaEvent === void 0 ? void 0 : ctaEvent({
|
23
23
|
eventSubject: 'clickCta',
|
24
24
|
eventDescription: 'User clicked the CTA'
|
25
25
|
}, recData, item, index);
|
26
|
-
setPopupDetailData === null || setPopupDetailData === void 0 ? void 0 : setPopupDetailData(Object.assign(Object.assign({}, recData), { video: Object.assign(Object.assign({}, recData === null || recData === void 0 ? void 0 : recData.video), { bindProduct: item }), index }));
|
26
|
+
setPopupDetailData === null || setPopupDetailData === void 0 ? void 0 : setPopupDetailData(Object.assign(Object.assign({}, recData), { video: Object.assign(Object.assign({}, recData === null || recData === void 0 ? void 0 : recData.video), { bindProduct: item }), index, multiCheckIndex }));
|
27
27
|
if (isExternalLink) {
|
28
28
|
if (item === null || item === void 0 ? void 0 : item.link) {
|
29
29
|
jumpToWeb(recData, item, item.bindCta, index);
|
@@ -36,7 +36,7 @@ const MultiCommodityDiro = (_a) => {
|
|
36
36
|
}, popup === null || popup === void 0 ? void 0 : popup.duration);
|
37
37
|
return (react_1.default.createElement(Scroll_1.default, { isPadding: !!recData }, products === null || products === void 0 ? void 0 : products.map((item, index) => {
|
38
38
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
39
|
-
return (react_1.default.createElement(react_1.default.Fragment, null, recData && !(item === null || item === void 0 ? void 0 : item.bindCta) ? null : (react_1.default.createElement(react_2.SwiperSlide, Object.assign({ key: index, className: (0, css_1.css)(Object.assign(Object.assign({}, style), { display: 'flex', flexShrink: 0, marginLeft: 0, marginRight: '8px' })) }, props, { onClick: () => handleClick(item) }),
|
39
|
+
return (react_1.default.createElement(react_1.default.Fragment, null, recData && !(item === null || item === void 0 ? void 0 : item.bindCta) ? null : (react_1.default.createElement(react_2.SwiperSlide, Object.assign({ key: index, className: (0, css_1.css)(Object.assign(Object.assign({}, style), { display: 'flex', flexShrink: 0, marginLeft: 0, marginRight: '8px' })) }, props, { onClick: () => handleClick(item, index) }),
|
40
40
|
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: ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.img }),
|
41
41
|
react_1.default.createElement("div", { className: (0, css_1.css)({
|
42
42
|
color: '#000',
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { VideoInfoType } from '../../../../core/components/SxpPageRender/typing';
|
2
2
|
import React, { CSSProperties } from 'react';
|
3
|
+
import { ISxpDataSourceContext } from '../../../../core/context/SxpDataSourceProvider';
|
3
4
|
interface ICommodityGroupProps {
|
4
5
|
products?: VideoInfoType['bindProducts'];
|
5
6
|
data?: {
|
@@ -9,6 +10,9 @@ interface ICommodityGroupProps {
|
|
9
10
|
};
|
10
11
|
defImg: string;
|
11
12
|
style?: CSSProperties;
|
13
|
+
onCLick?: (i: number) => void;
|
14
|
+
popupDetailData?: ISxpDataSourceContext['popupDetailData'];
|
15
|
+
check?: number;
|
12
16
|
}
|
13
17
|
declare const _default: React.NamedExoticComponent<ICommodityGroupProps>;
|
14
18
|
export default _default;
|
@@ -4,31 +4,28 @@ 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");
|
8
7
|
const react_2 = require("swiper/react");
|
9
8
|
const css_1 = require("@emotion/css");
|
10
|
-
const CommodityGroup = ({ products, data, defImg, style }) => {
|
11
|
-
var _a
|
12
|
-
|
13
|
-
const [check, setCheck] = (0, react_1.useState)((_a = popupDetailData === null || popupDetailData === void 0 ? void 0 : popupDetailData.multiCheckIndex) !== null && _a !== void 0 ? _a : 0);
|
14
|
-
const handleClick = (0, react_1.useCallback)((index) => {
|
15
|
-
setPopupDetailData === null || setPopupDetailData === void 0 ? void 0 : setPopupDetailData((val) => (Object.assign(Object.assign({}, val), { video: Object.assign(Object.assign({}, val === null || val === void 0 ? void 0 : val.video), { bindProduct: products === null || products === void 0 ? void 0 : products[index] }), multiCheckIndex: index })));
|
16
|
-
}, []);
|
17
|
-
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) > 0) || !popupDetailData) && (react_1.default.createElement(Scroll_1.default, { isPadding: false, style: Object.assign(Object.assign({}, style), data === null || data === void 0 ? void 0 : data.style) }, (_b = (popupDetailData ? products : [0, 1, 2, 3])) === null || _b === void 0 ? void 0 : _b.map((item, index) => {
|
9
|
+
const CommodityGroup = ({ products, data, defImg, style, onCLick, popupDetailData, check }) => {
|
10
|
+
var _a;
|
11
|
+
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) => {
|
18
12
|
var _a, _b, _c;
|
19
|
-
return (react_1.default.createElement(react_2.SwiperSlide, { className: (0, css_1.css)({
|
13
|
+
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)({
|
20
14
|
width: '50px',
|
21
15
|
height: '50px',
|
22
16
|
marginRight: '10px'
|
23
|
-
}), onClick: () =>
|
17
|
+
}), onClick: () => {
|
18
|
+
onCLick === null || onCLick === void 0 ? void 0 : onCLick(index);
|
19
|
+
}, key: index },
|
24
20
|
react_1.default.createElement(FormatImage_1.default, { style: {
|
25
21
|
height: '100%',
|
26
22
|
width: '100%',
|
27
23
|
objectFit: 'cover',
|
28
24
|
display: 'block',
|
29
|
-
objectPosition: `50% ${(data === null || data === void 0 ? void 0 : data.translateY) ?
|
30
|
-
border: check === index ? '1px solid #000' : '1px solid #f2f2f2'
|
31
|
-
|
25
|
+
objectPosition: `50% ${(data === null || data === void 0 ? void 0 : data.translateY) ? (data === null || data === void 0 ? void 0 : data.translateY) + 50 : 50}%`,
|
26
|
+
border: check === index ? '1px solid #000' : '1px solid #f2f2f2',
|
27
|
+
boxSizing: 'border-box'
|
28
|
+
}, src: (_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 : defImg }))) : null));
|
32
29
|
})))));
|
33
30
|
};
|
34
31
|
exports.default = (0, react_1.memo)(CommodityGroup);
|
@@ -6,18 +6,18 @@ const react_1 = tslib_1.__importStar(require("react"));
|
|
6
6
|
const useOnScreen_1 = tslib_1.__importDefault(require("../../../../core/hooks/useOnScreen"));
|
7
7
|
const hooks_1 = require("../../../../core/hooks");
|
8
8
|
const FormatImage_1 = tslib_1.__importDefault(require("../../../../core/components/SxpPageRender/FormatImage"));
|
9
|
-
const Img = ({ src, rec, item, index, style, translateY, imgStyle }) => {
|
9
|
+
const Img = ({ src, rec, item, index, style, translateY, imgStyle, enableEventReport = true }) => {
|
10
10
|
const ref = (0, react_1.useRef)(null);
|
11
11
|
const isOnScreen = (0, useOnScreen_1.default)(ref);
|
12
12
|
const { ctaEvent } = (0, hooks_1.useSxpDataSource)();
|
13
13
|
(0, react_1.useEffect)(() => {
|
14
|
-
if (isOnScreen && src && (ref === null || ref === void 0 ? void 0 : ref.current)) {
|
14
|
+
if (isOnScreen && src && (ref === null || ref === void 0 ? void 0 : ref.current) && enableEventReport) {
|
15
15
|
ctaEvent === null || ctaEvent === void 0 ? void 0 : ctaEvent({
|
16
16
|
eventSubject: 'ctaExposure',
|
17
17
|
eventDescription: 'The cta was shown to the user'
|
18
18
|
}, rec, item, index);
|
19
19
|
}
|
20
|
-
}, [isOnScreen, src, ref, rec, ctaEvent, item, index]);
|
20
|
+
}, [isOnScreen, src, ref, rec, ctaEvent, item, index, enableEventReport]);
|
21
21
|
const imgSrc = (0, react_1.useMemo)(() => {
|
22
22
|
return (src === null || src === void 0 ? void 0 : src.includes('.avif')) ? src : `${src}?imrquality/rquality/20`;
|
23
23
|
}, [src]);
|
@@ -8,13 +8,14 @@ require("swiper/css/free-mode");
|
|
8
8
|
require("swiper/css/scrollbar");
|
9
9
|
const modules_1 = require("swiper/modules");
|
10
10
|
const hooks_1 = require("../../../../core/hooks");
|
11
|
-
const Scroll = ({ children, isPadding = true, style }) => {
|
11
|
+
const Scroll = ({ children, isPadding = true, style, enableSlideActive = false }) => {
|
12
12
|
const ref = (0, react_1.useRef)();
|
13
13
|
const { popupDetailData } = (0, hooks_1.useSxpDataSource)();
|
14
14
|
(0, react_1.useEffect)(() => {
|
15
|
-
var _a;
|
16
|
-
|
17
|
-
|
15
|
+
var _a, _b;
|
16
|
+
if (enableSlideActive)
|
17
|
+
(_a = ref === null || ref === void 0 ? void 0 : ref.current) === null || _a === void 0 ? void 0 : _a.swiper.slideTo((_b = popupDetailData === null || popupDetailData === void 0 ? void 0 : popupDetailData.multiCheckIndex) !== null && _b !== void 0 ? _b : 0);
|
18
|
+
}, [popupDetailData, enableSlideActive]);
|
18
19
|
return (react_1.default.createElement(react_2.Swiper, { ref: ref, direction: 'horizontal', slidesPerView: 'auto', freeMode: true, mousewheel: true, modules: [modules_1.FreeMode, modules_1.Scrollbar, modules_1.Mousewheel], style: Object.assign({ padding: isPadding ? '0 12px 0 20px' : 0 }, style) }, children));
|
19
20
|
};
|
20
21
|
exports.default = (0, react_1.memo)(Scroll);
|