pb-sxp-ui 1.2.4 → 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.
- package/dist/index.cjs +283 -175
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +11 -3
- package/dist/index.js +283 -175
- 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 +283 -175
- 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/LikeButton/index.js +34 -15
- package/es/core/components/SxpPageRender/Popup/index.js +26 -13
- package/es/core/components/SxpPageRender/RenderCard.d.ts +1 -0
- package/es/core/components/SxpPageRender/RenderCard.js +3 -3
- package/es/core/components/SxpPageRender/index.js +4 -4
- 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/core/hooks/useEventReport.js +4 -4
- package/es/materials/sxp/cta/AniLink/index.js +2 -1
- package/es/materials/sxp/cta/AniLinkPopup/index.d.ts +1 -0
- package/es/materials/sxp/cta/AniLinkPopup/index.js +11 -20
- package/es/materials/sxp/popup/CommodityDetail/index.d.ts +1 -0
- package/es/materials/sxp/popup/CommodityDetail/index.js +32 -15
- package/es/materials/sxp/popup/CommodityDetail/material.js +6 -0
- package/es/materials/sxp/popup/CommodityDetail/settingRender.js +4 -0
- package/es/materials/sxp/popup/CommodityDetailDiroNew/index.js +32 -18
- package/es/materials/sxp/popup/CommodityList/index.js +38 -20
- 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 +21 -14
- 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/LikeButton/index.js +34 -15
- package/lib/core/components/SxpPageRender/Popup/index.js +25 -12
- package/lib/core/components/SxpPageRender/RenderCard.d.ts +1 -0
- package/lib/core/components/SxpPageRender/RenderCard.js +3 -3
- package/lib/core/components/SxpPageRender/index.js +4 -4
- 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/core/hooks/useEventReport.js +4 -4
- package/lib/materials/sxp/cta/AniLink/index.js +2 -1
- package/lib/materials/sxp/cta/AniLinkPopup/index.d.ts +1 -0
- package/lib/materials/sxp/cta/AniLinkPopup/index.js +10 -19
- package/lib/materials/sxp/popup/CommodityDetail/index.d.ts +1 -0
- package/lib/materials/sxp/popup/CommodityDetail/index.js +32 -15
- package/lib/materials/sxp/popup/CommodityDetail/material.js +6 -0
- package/lib/materials/sxp/popup/CommodityDetail/settingRender.js +4 -0
- package/lib/materials/sxp/popup/CommodityDetailDiroNew/index.js +32 -18
- package/lib/materials/sxp/popup/CommodityList/index.js +37 -19
- 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 +20 -13
- 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
@@ -14,21 +14,29 @@ const FormatImage_1 = tslib_1.__importDefault(require("../../../../core/componen
|
|
14
14
|
const tool_1 = require("../../../../core/utils/tool");
|
15
15
|
const CommodityGroup_1 = tslib_1.__importDefault(require("../../template/components/CommodityGroup"));
|
16
16
|
const CommodityDetailDiroNew = (_a) => {
|
17
|
-
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
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 } = (0, hooks_1.useSxpDataSource)();
|
21
|
-
const { popupDetailData, bffEventReport, isPreview, swiperRef, bffFbReport } = (0, hooks_1.useSxpDataSource)();
|
20
|
+
const { sxpParameter, popupCurTimeRef, popupDetailData, isPreview, bffFbReport, checkCommodityIndexRef } = (0, hooks_1.useSxpDataSource)();
|
22
21
|
const { jumpToWeb, productView } = (0, useEventReport_1.useEventReport)();
|
23
22
|
const [stopSlide, setStopSlide] = (0, react_1.useState)(false);
|
24
23
|
const [isBottom, setIsBottom] = (0, react_1.useState)(false);
|
25
24
|
const [isTop, setIsTop] = (0, react_1.useState)(true);
|
26
25
|
const [showModal, setShowModal] = (0, react_1.useState)(false);
|
27
26
|
const curTimeRef = (0, react_1.useRef)(null);
|
27
|
+
const [checkCommodityIndex, setCheckCommodityIndex] = (0, react_1.useState)((_b = popupDetailData === null || popupDetailData === void 0 ? void 0 : popupDetailData.multiCheckIndex) !== null && _b !== void 0 ? _b : 0);
|
28
28
|
const data = isPost ? rec : popupDetailData;
|
29
|
-
|
30
|
-
|
29
|
+
let product = isPost ? data === null || data === void 0 ? void 0 : data.product : (_d = (_c = data === null || data === void 0 ? void 0 : data.video) === null || _c === void 0 ? void 0 : _c.bindProduct) !== null && _d !== void 0 ? _d : (_f = (_e = data === null || data === void 0 ? void 0 : data.video) === null || _e === void 0 ? void 0 : _e.bindProducts) === null || _f === void 0 ? void 0 : _f[0];
|
30
|
+
let cta = isPost
|
31
|
+
? (_g = data === null || data === void 0 ? void 0 : data.product) === null || _g === void 0 ? void 0 : _g.bindCta
|
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;
|
31
33
|
const position = isPost ? index : popupDetailData === null || popupDetailData === void 0 ? void 0 : popupDetailData.index;
|
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;
|
36
|
+
const p = (_s = data === null || data === void 0 ? void 0 : data.video) === null || _s === void 0 ? void 0 : _s.bindProducts[checkCommodityIndex];
|
37
|
+
product = p;
|
38
|
+
cta = p === null || p === void 0 ? void 0 : p.bindCta;
|
39
|
+
}
|
32
40
|
const handleLink = () => {
|
33
41
|
if (product === null || product === void 0 ? void 0 : product.link) {
|
34
42
|
jumpToWeb(data, product, cta, position);
|
@@ -66,7 +74,7 @@ const CommodityDetailDiroNew = (_a) => {
|
|
66
74
|
return '£102,300.00';
|
67
75
|
}
|
68
76
|
}, [product === null || product === void 0 ? void 0 : product.price, product === null || product === void 0 ? void 0 : product.currency]);
|
69
|
-
const width = isPreview ? 375 : (
|
77
|
+
const width = isPreview ? 375 : (_t = style === null || style === void 0 ? void 0 : style.width) !== null && _t !== void 0 ? _t : window.innerWidth;
|
70
78
|
const handleClickCollapse = () => {
|
71
79
|
setSpread(!spread);
|
72
80
|
};
|
@@ -82,15 +90,20 @@ Made in Italy` })));
|
|
82
90
|
}
|
83
91
|
return style;
|
84
92
|
}, []);
|
93
|
+
const handleClick = (0, react_1.useCallback)((index) => {
|
94
|
+
popupCurTimeRef.current = new Date();
|
95
|
+
setCheckCommodityIndex(index);
|
96
|
+
checkCommodityIndexRef.current = index;
|
97
|
+
}, []);
|
85
98
|
const renderCommodityGroup = (0, react_1.useCallback)(() => {
|
86
99
|
var _a, _b, _c;
|
87
100
|
if (isPost)
|
88
101
|
return;
|
89
|
-
return (react_1.default.createElement(CommodityGroup_1.default, { products: (_a = data === null || data === void 0 ? void 0 : data.video) === null || _a === void 0 ? void 0 : _a.bindProducts, data: commodityGroup, defImg: (_c = (_b = sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) !== null && _b !== void 0 ? _b : bottom_image) !== null && _c !== void 0 ? _c : '', style: { padding: '0 19px' } }));
|
90
|
-
}, []);
|
102
|
+
return (react_1.default.createElement(CommodityGroup_1.default, { products: (_a = data === null || data === void 0 ? void 0 : data.video) === null || _a === void 0 ? void 0 : _a.bindProducts, data: commodityGroup, defImg: (_c = (_b = sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) !== null && _b !== void 0 ? _b : bottom_image) !== null && _c !== void 0 ? _c : '', style: { padding: '0 19px' }, onCLick: handleClick, popupDetailData: popupDetailData, check: checkCommodityIndex }));
|
103
|
+
}, [checkCommodityIndex]);
|
91
104
|
return (react_1.default.createElement("div", { className: 'pb-commondityDiroNew' },
|
92
|
-
react_1.default.createElement("div", Object.assign({ className: (0, css_1.css)(Object.assign({}, style)) }, props),
|
93
|
-
product && ((
|
105
|
+
react_1.default.createElement("div", Object.assign({ className: (0, css_1.css)(Object.assign(Object.assign({}, style), { transform: 'translate3d(0px, 0px, 0px)' })) }, props),
|
106
|
+
product && ((_u = product === null || product === void 0 ? void 0 : product.homePage) === null || _u === void 0 ? void 0 : _u.length) > 0 && (react_1.default.createElement(react_2.Swiper, { height: width, modules: [modules_1.Pagination, modules_1.Autoplay], pagination: {
|
94
107
|
clickable: true,
|
95
108
|
bulletActiveClass: 'commondityDiroNew-swipe-item-active-bullet',
|
96
109
|
clickableClass: (swiper === null || swiper === void 0 ? void 0 : swiper.dotsAlign) === 'left'
|
@@ -98,7 +111,8 @@ Made in Italy` })));
|
|
98
111
|
: 'commondityDiroNew-swiper-clickable-center'
|
99
112
|
}, loop: true, autoplay: {
|
100
113
|
delay: (swiper === null || swiper === void 0 ? void 0 : swiper.delay) * 1000
|
101
|
-
} }, (
|
114
|
+
} }, (_v = product === null || product === void 0 ? void 0 : product.homePage) === null || _v === void 0 ? void 0 : _v.map((src) => {
|
115
|
+
var _a;
|
102
116
|
return (react_1.default.createElement(react_2.SwiperSlide, { key: src },
|
103
117
|
react_1.default.createElement("div", { style: {
|
104
118
|
overflow: 'hidden',
|
@@ -111,9 +125,9 @@ Made in Italy` })));
|
|
111
125
|
objectFit: 'cover',
|
112
126
|
display: 'block',
|
113
127
|
objectPosition: `50% ${(swiper === null || swiper === void 0 ? void 0 : swiper.translateY) ? (swiper === null || swiper === void 0 ? void 0 : swiper.translateY) + 50 : 50}%`
|
114
|
-
}, 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 }))));
|
115
129
|
}))),
|
116
|
-
!((
|
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)({
|
117
131
|
position: 'relative',
|
118
132
|
height: 0,
|
119
133
|
width: '100%',
|
@@ -126,13 +140,13 @@ Made in Italy` })));
|
|
126
140
|
top: 0,
|
127
141
|
objectFit: 'cover',
|
128
142
|
width: '100%'
|
129
|
-
}), src: (
|
143
|
+
}), src: (_x = sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) !== null && _x !== void 0 ? _x : bottom_image, alt: 'pdp image' }))),
|
130
144
|
renderCommodityGroup(),
|
131
145
|
react_1.default.createElement("div", { className: 'pb-commondityDiroNew-content' },
|
132
146
|
react_1.default.createElement("div", { className: 'pb-commondityDiroNew-content-top' },
|
133
147
|
react_1.default.createElement("div", { className: 'pb-commondityDiroNew-content-top-left' },
|
134
148
|
react_1.default.createElement("div", { className: 'pb-commondityDiroNew-content-top-left-title', style: getStyle(commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.title), dangerouslySetInnerHTML: {
|
135
|
-
__html: (0, tool_1.setFontForText)((
|
149
|
+
__html: (0, tool_1.setFontForText)((_y = product === null || product === void 0 ? void 0 : product.title) !== null && _y !== void 0 ? _y : 'Large Dior Toujours BagLarge', commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.title)
|
136
150
|
} }),
|
137
151
|
react_1.default.createElement("div", { className: 'pb-commondityDiroNew-content-collection', hidden: !!product && (!(product === null || product === void 0 ? void 0 : product.collection) || (product === null || product === void 0 ? void 0 : product.collection) === ''), style: getStyle(commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.collection), dangerouslySetInnerHTML: {
|
138
152
|
__html: (0, tool_1.setFontForText)((product === null || product === void 0 ? void 0 : product.collection) || 'Black Macrocannage CalfskinLarge', commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.collection)
|
@@ -142,11 +156,11 @@ Made in Italy` })));
|
|
142
156
|
__html: (0, tool_1.setFontForText)(priceText, commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price)
|
143
157
|
} }),
|
144
158
|
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: {
|
145
|
-
__html: (0, tool_1.setFontForText)((
|
159
|
+
__html: (0, tool_1.setFontForText)((_z = product === null || product === void 0 ? void 0 : product.taxInfo) !== null && _z !== void 0 ? _z : '税费', commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.taxInfo)
|
146
160
|
} }))),
|
147
|
-
(!product || (product === null || product === void 0 ? void 0 : product.link)) && (react_1.default.createElement("button", { "aria-label": (
|
161
|
+
(!product || (product === null || product === void 0 ? void 0 : product.link)) && (react_1.default.createElement("button", { "aria-label": (_0 = cta === null || cta === void 0 ? void 0 : cta.enTitle) !== null && _0 !== void 0 ? _0 : 'Shop now', onClick: handleLink, className: 'pb-commondityDiroNew-btn', style: buttonStyle },
|
148
162
|
react_1.default.createElement("span", { dangerouslySetInnerHTML: {
|
149
|
-
__html: (0, tool_1.setFontForText)((
|
163
|
+
__html: (0, tool_1.setFontForText)((_1 = cta === null || cta === void 0 ? void 0 : cta.enTitle) !== null && _1 !== void 0 ? _1 : 'Shop now', buttonStyle)
|
150
164
|
} }))),
|
151
165
|
productInfoText({ isPost }))),
|
152
166
|
react_1.default.createElement(Modal_1.default, { visible: showModal, onClose: () => setShowModal(false) }, productInfoText({ isPost: false }))));
|
@@ -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,25 +28,40 @@ const CommodityList = (_a) => {
|
|
26
28
|
return '$7,000';
|
27
29
|
}
|
28
30
|
}, []);
|
29
|
-
|
30
|
-
|
31
|
-
|
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);
|
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
|
+
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
|
-
|
37
|
-
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)`,
|
38
55
|
display: 'flex',
|
39
56
|
flexDirection: 'column',
|
40
57
|
justifyContent: 'space-between'
|
41
58
|
} },
|
42
59
|
react_1.default.createElement("div", null,
|
43
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: {
|
44
|
-
__html: (0, tool_1.setFontForText)((
|
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)
|
45
62
|
} }),
|
46
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: {
|
47
|
-
__html: (0, tool_1.setFontForText)((
|
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)
|
48
65
|
} })),
|
49
66
|
react_1.default.createElement("div", { className: (0, css_1.css)({
|
50
67
|
display: 'flex',
|
@@ -53,12 +70,13 @@ const CommodityList = (_a) => {
|
|
53
70
|
width: '100%',
|
54
71
|
overflow: 'hidden'
|
55
72
|
}) },
|
56
|
-
react_1.default.createElement("div",
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
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
|
+
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)((_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
|
+
} })))))));
|
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;
|
@@ -7,28 +7,35 @@ const FormatImage_1 = tslib_1.__importDefault(require("../../../../core/componen
|
|
7
7
|
const hooks_1 = require("../../../../core/hooks");
|
8
8
|
const react_2 = require("swiper/react");
|
9
9
|
const css_1 = require("@emotion/css");
|
10
|
-
const
|
11
|
-
|
12
|
-
|
13
|
-
const
|
14
|
-
const
|
15
|
-
|
16
|
-
|
17
|
-
|
10
|
+
const useEventReport_1 = require("../../../../core/hooks/useEventReport");
|
11
|
+
const CommodityGroup = ({ products, data, defImg, style, onCLick, popupDetailData, check }) => {
|
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
|
+
};
|
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) => {
|
18
22
|
var _a, _b, _c;
|
19
|
-
return (react_1.default.createElement(react_2.SwiperSlide, { className: (0, css_1.css)({
|
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)({
|
20
24
|
width: '50px',
|
21
25
|
height: '50px',
|
22
26
|
marginRight: '10px'
|
23
|
-
}), onClick: () =>
|
27
|
+
}), onClick: () => {
|
28
|
+
handleClick(item, index);
|
29
|
+
}, key: index },
|
24
30
|
react_1.default.createElement(FormatImage_1.default, { style: {
|
25
31
|
height: '100%',
|
26
32
|
width: '100%',
|
27
33
|
objectFit: 'cover',
|
28
34
|
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
|
-
|
35
|
+
objectPosition: `50% ${(data === null || data === void 0 ? void 0 : data.translateY) ? (data === null || data === void 0 ? void 0 : data.translateY) + 50 : 50}%`,
|
36
|
+
border: check === index ? '1px solid #000' : '1px solid #f2f2f2',
|
37
|
+
boxSizing: 'border-box'
|
38
|
+
}, 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
39
|
})))));
|
33
40
|
};
|
34
41
|
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);
|