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
@@ -12,21 +12,28 @@ import FormatImage from '../../../../core/components/SxpPageRender/FormatImage';
|
|
12
12
|
import { setFontForText } from '../../../../core/utils/tool';
|
13
13
|
import CommodityGroup from '../../template/components/CommodityGroup';
|
14
14
|
const CommodityDetailDiroNew = (_a) => {
|
15
|
-
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
15
|
+
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;
|
16
16
|
var { style, isDefault, rec, viewTime, isPost, bottom_image, tipText, swiper, commodityStyles, buttonStyle, index, commodityGroup } = _a, props = __rest(_a, ["style", "isDefault", "rec", "viewTime", "isPost", "bottom_image", "tipText", "swiper", "commodityStyles", "buttonStyle", "index", "commodityGroup"]);
|
17
17
|
const [spread, setSpread] = useState(true);
|
18
|
-
const { sxpParameter } = useSxpDataSource();
|
19
|
-
const { popupDetailData, bffEventReport, isPreview, swiperRef, bffFbReport } = useSxpDataSource();
|
18
|
+
const { sxpParameter, popupCurTimeRef, popupDetailData, isPreview, bffFbReport } = useSxpDataSource();
|
20
19
|
const { jumpToWeb, productView } = useEventReport();
|
21
20
|
const [stopSlide, setStopSlide] = useState(false);
|
22
21
|
const [isBottom, setIsBottom] = useState(false);
|
23
22
|
const [isTop, setIsTop] = useState(true);
|
24
23
|
const [showModal, setShowModal] = useState(false);
|
25
24
|
const curTimeRef = useRef(null);
|
25
|
+
const [checkCommodityIndex, setCheckCommodityIndex] = useState((_b = popupDetailData === null || popupDetailData === void 0 ? void 0 : popupDetailData.multiCheckIndex) !== null && _b !== void 0 ? _b : 0);
|
26
26
|
const data = isPost ? rec : popupDetailData;
|
27
|
-
|
28
|
-
|
27
|
+
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];
|
28
|
+
let cta = isPost
|
29
|
+
? (_g = data === null || data === void 0 ? void 0 : data.product) === null || _g === void 0 ? void 0 : _g.bindCta
|
30
|
+
: (_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;
|
29
31
|
const position = isPost ? index : popupDetailData === null || popupDetailData === void 0 ? void 0 : popupDetailData.index;
|
32
|
+
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) {
|
33
|
+
const p = (_s = data === null || data === void 0 ? void 0 : data.video) === null || _s === void 0 ? void 0 : _s.bindProducts[checkCommodityIndex];
|
34
|
+
product = p;
|
35
|
+
cta = p === null || p === void 0 ? void 0 : p.bindCta;
|
36
|
+
}
|
30
37
|
const handleLink = () => {
|
31
38
|
if (product === null || product === void 0 ? void 0 : product.link) {
|
32
39
|
jumpToWeb(data, product, cta, position);
|
@@ -64,7 +71,7 @@ const CommodityDetailDiroNew = (_a) => {
|
|
64
71
|
return '£102,300.00';
|
65
72
|
}
|
66
73
|
}, [product === null || product === void 0 ? void 0 : product.price, product === null || product === void 0 ? void 0 : product.currency]);
|
67
|
-
const width = isPreview ? 375 : (
|
74
|
+
const width = isPreview ? 375 : (_t = style === null || style === void 0 ? void 0 : style.width) !== null && _t !== void 0 ? _t : window.innerWidth;
|
68
75
|
const handleClickCollapse = () => {
|
69
76
|
setSpread(!spread);
|
70
77
|
};
|
@@ -80,15 +87,19 @@ Made in Italy` })));
|
|
80
87
|
}
|
81
88
|
return style;
|
82
89
|
}, []);
|
90
|
+
const handleClick = useCallback((index) => {
|
91
|
+
popupCurTimeRef.current = new Date();
|
92
|
+
setCheckCommodityIndex(index);
|
93
|
+
}, []);
|
83
94
|
const renderCommodityGroup = useCallback(() => {
|
84
95
|
var _a, _b, _c;
|
85
96
|
if (isPost)
|
86
97
|
return;
|
87
|
-
return (React.createElement(CommodityGroup, { 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' } }));
|
88
|
-
}, []);
|
98
|
+
return (React.createElement(CommodityGroup, { 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 }));
|
99
|
+
}, [checkCommodityIndex]);
|
89
100
|
return (React.createElement("div", { className: 'pb-commondityDiroNew' },
|
90
|
-
React.createElement("div", Object.assign({ className: css(Object.assign({}, style)) }, props),
|
91
|
-
product && ((
|
101
|
+
React.createElement("div", Object.assign({ className: css(Object.assign(Object.assign({}, style), { transform: 'translate3d(0px, 0px, 0px)' })) }, props),
|
102
|
+
product && ((_u = product === null || product === void 0 ? void 0 : product.homePage) === null || _u === void 0 ? void 0 : _u.length) > 0 && (React.createElement(Swiper, { height: width, modules: [Pagination, Autoplay], pagination: {
|
92
103
|
clickable: true,
|
93
104
|
bulletActiveClass: 'commondityDiroNew-swipe-item-active-bullet',
|
94
105
|
clickableClass: (swiper === null || swiper === void 0 ? void 0 : swiper.dotsAlign) === 'left'
|
@@ -96,7 +107,7 @@ Made in Italy` })));
|
|
96
107
|
: 'commondityDiroNew-swiper-clickable-center'
|
97
108
|
}, loop: true, autoplay: {
|
98
109
|
delay: (swiper === null || swiper === void 0 ? void 0 : swiper.delay) * 1000
|
99
|
-
} }, (
|
110
|
+
} }, (_v = product === null || product === void 0 ? void 0 : product.homePage) === null || _v === void 0 ? void 0 : _v.map((src) => {
|
100
111
|
return (React.createElement(SwiperSlide, { key: src },
|
101
112
|
React.createElement("div", { style: {
|
102
113
|
overflow: 'hidden',
|
@@ -111,7 +122,7 @@ Made in Italy` })));
|
|
111
122
|
objectPosition: `50% ${(swiper === null || swiper === void 0 ? void 0 : swiper.translateY) ? (swiper === null || swiper === void 0 ? void 0 : swiper.translateY) + 50 : 50}%`
|
112
123
|
}, src: src }))));
|
113
124
|
}))),
|
114
|
-
!((
|
125
|
+
!((_w = product === null || product === void 0 ? void 0 : product.homePage) === null || _w === void 0 ? void 0 : _w.length) && (React.createElement("div", { className: css({
|
115
126
|
position: 'relative',
|
116
127
|
height: 0,
|
117
128
|
width: '100%',
|
@@ -124,13 +135,13 @@ Made in Italy` })));
|
|
124
135
|
top: 0,
|
125
136
|
objectFit: 'cover',
|
126
137
|
width: '100%'
|
127
|
-
}), src: (
|
138
|
+
}), src: (_x = sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) !== null && _x !== void 0 ? _x : bottom_image, alt: 'pdp image' }))),
|
128
139
|
renderCommodityGroup(),
|
129
140
|
React.createElement("div", { className: 'pb-commondityDiroNew-content' },
|
130
141
|
React.createElement("div", { className: 'pb-commondityDiroNew-content-top' },
|
131
142
|
React.createElement("div", { className: 'pb-commondityDiroNew-content-top-left' },
|
132
143
|
React.createElement("div", { className: 'pb-commondityDiroNew-content-top-left-title', style: getStyle(commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.title), dangerouslySetInnerHTML: {
|
133
|
-
__html: setFontForText((
|
144
|
+
__html: 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)
|
134
145
|
} }),
|
135
146
|
React.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: {
|
136
147
|
__html: setFontForText((product === null || product === void 0 ? void 0 : product.collection) || 'Black Macrocannage CalfskinLarge', commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.collection)
|
@@ -140,11 +151,11 @@ Made in Italy` })));
|
|
140
151
|
__html: setFontForText(priceText, commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price)
|
141
152
|
} }),
|
142
153
|
React.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: {
|
143
|
-
__html: setFontForText((
|
154
|
+
__html: 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)
|
144
155
|
} }))),
|
145
|
-
(!product || (product === null || product === void 0 ? void 0 : product.link)) && (React.createElement("button", { "aria-label": (
|
156
|
+
(!product || (product === null || product === void 0 ? void 0 : product.link)) && (React.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 },
|
146
157
|
React.createElement("span", { dangerouslySetInnerHTML: {
|
147
|
-
__html: setFontForText((
|
158
|
+
__html: setFontForText((_1 = cta === null || cta === void 0 ? void 0 : cta.enTitle) !== null && _1 !== void 0 ? _1 : 'Shop now', buttonStyle)
|
148
159
|
} }))),
|
149
160
|
productInfoText({ isPost }))),
|
150
161
|
React.createElement(Modal, { visible: showModal, onClose: () => setShowModal(false) }, productInfoText({ isPost: false }))));
|
@@ -1,16 +1,18 @@
|
|
1
1
|
import { __rest } from "tslib";
|
2
2
|
import { css } from '@emotion/css';
|
3
3
|
import React, { memo, useCallback } from 'react';
|
4
|
-
import { useSxpDataSource } from '../../../../core/hooks';
|
4
|
+
import { useEditor, useSxpDataSource } from '../../../../core/hooks';
|
5
5
|
import './index.less';
|
6
|
+
import { useEventReport } from '../../../../core/hooks/useEventReport';
|
6
7
|
import { setFontForText } from '../../../../core/utils/tool';
|
7
8
|
import Img from '../../template/components/Img';
|
8
|
-
import
|
9
|
+
import { throttle } from 'lodash';
|
9
10
|
const CommodityList = (_a) => {
|
10
11
|
var _b, _c;
|
11
|
-
var { style, isDefault, rec, viewTime, isPost, bottom_image, commodityStyles, buttonStyle, index, translateY = 0, commodityPicture, isExternalLink } = _a, props = __rest(_a, ["style", "isDefault", "rec", "viewTime", "isPost", "bottom_image", "commodityStyles", "buttonStyle", "index", "translateY", "commodityPicture", "isExternalLink"]);
|
12
|
-
const { sxpParameter } = useSxpDataSource();
|
13
|
-
const {
|
12
|
+
var { style, isDefault, rec, viewTime, isPost, bottom_image, commodityStyles, buttonStyle, index, translateY = 0, commodityPicture, isExternalLink, onClick } = _a, props = __rest(_a, ["style", "isDefault", "rec", "viewTime", "isPost", "bottom_image", "commodityStyles", "buttonStyle", "index", "translateY", "commodityPicture", "isExternalLink", "onClick"]);
|
13
|
+
const { sxpParameter, popupDetailData, setPopupDetailData, ctaEvent } = useSxpDataSource();
|
14
|
+
const { jumpToWeb } = useEventReport();
|
15
|
+
const { popup } = useEditor();
|
14
16
|
const recData = isPost ? rec : popupDetailData;
|
15
17
|
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];
|
16
18
|
const priceText = useCallback((product) => {
|
@@ -24,12 +26,28 @@ const CommodityList = (_a) => {
|
|
24
26
|
return '$7,000';
|
25
27
|
}
|
26
28
|
}, []);
|
29
|
+
const handleClick = throttle((item, multiCheckIndex) => {
|
30
|
+
ctaEvent === null || ctaEvent === void 0 ? void 0 : ctaEvent({
|
31
|
+
eventSubject: 'clickCta',
|
32
|
+
eventDescription: 'User clicked the CTA'
|
33
|
+
}, recData, item, index);
|
34
|
+
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 }));
|
35
|
+
if (isExternalLink) {
|
36
|
+
if (item === null || item === void 0 ? void 0 : item.link) {
|
37
|
+
jumpToWeb(recData, item, item.bindCta, index);
|
38
|
+
window.location.href = window.getJointUtmLink(item.link);
|
39
|
+
}
|
40
|
+
}
|
41
|
+
else {
|
42
|
+
onClick === null || onClick === void 0 ? void 0 : onClick();
|
43
|
+
}
|
44
|
+
}, popup === null || popup === void 0 ? void 0 : popup.duration);
|
27
45
|
return (React.createElement("div", { className: 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) => {
|
28
46
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
29
|
-
return (React.createElement(
|
47
|
+
return (React.createElement(React.Fragment, null, recData && !(item === null || item === void 0 ? void 0 : item.bindCta) ? null : (React.createElement("div", Object.assign({ key: index }, props, { className: css({
|
30
48
|
display: 'flex'
|
31
|
-
}) }),
|
32
|
-
React.createElement(Img, { 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 }),
|
49
|
+
}), onClick: () => handleClick(item, index) }),
|
50
|
+
React.createElement(Img, { 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 }),
|
33
51
|
React.createElement("div", { style: {
|
34
52
|
flex: 1,
|
35
53
|
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,9 +72,9 @@ const CommodityList = (_a) => {
|
|
54
72
|
React.createElement("div", { style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price, hidden: !!item && !(item === null || item === void 0 ? void 0 : item.price), dangerouslySetInnerHTML: {
|
55
73
|
__html: setFontForText(priceText(item), commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price)
|
56
74
|
} }),
|
57
|
-
React.createElement("div", { className: 'one-line-ellipsis', style: Object.assign(Object.assign({}, buttonStyle), { padding: '0 15px'
|
75
|
+
React.createElement("div", { className: 'one-line-ellipsis', style: Object.assign(Object.assign({}, buttonStyle), { padding: '0 15px' }), dangerouslySetInnerHTML: {
|
58
76
|
__html: 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)
|
59
|
-
} })))));
|
77
|
+
} })))))));
|
60
78
|
})));
|
61
79
|
};
|
62
80
|
export default memo(CommodityList);
|
@@ -17,12 +17,12 @@ const MultiCommodity = (_a) => {
|
|
17
17
|
const { popup } = useEditor();
|
18
18
|
const [products, setProducts] = 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]);
|
19
19
|
const { jumpToWeb } = useEventReport();
|
20
|
-
const handleClick = throttle((item) => {
|
20
|
+
const handleClick = throttle((item, multiCheckIndex) => {
|
21
21
|
ctaEvent === null || ctaEvent === void 0 ? void 0 : ctaEvent({
|
22
22
|
eventSubject: 'clickCta',
|
23
23
|
eventDescription: 'User clicked the CTA'
|
24
24
|
}, recData, item, index);
|
25
|
-
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 }));
|
25
|
+
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 }));
|
26
26
|
if (isExternalLink) {
|
27
27
|
if (item === null || item === void 0 ? void 0 : item.link) {
|
28
28
|
jumpToWeb(recData, item, item.bindCta, index);
|
@@ -35,7 +35,7 @@ const MultiCommodity = (_a) => {
|
|
35
35
|
}, popup === null || popup === void 0 ? void 0 : popup.duration);
|
36
36
|
return (React.createElement(Scroll, { isPadding: !!recData }, products === null || products === void 0 ? void 0 : products.map((item, index) => {
|
37
37
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
38
|
-
return (React.createElement(React.Fragment, null, recData && !(item === null || item === void 0 ? void 0 : item.bindCta) ? null : (React.createElement(SwiperSlide, Object.assign({ key: index, className: css(Object.assign(Object.assign({}, style), { display: 'flex', flexShrink: 0, marginLeft: 0, marginRight: '8px' })) }, props, { onClick: () => handleClick(item) }),
|
38
|
+
return (React.createElement(React.Fragment, null, recData && !(item === null || item === void 0 ? void 0 : item.bindCta) ? null : (React.createElement(SwiperSlide, Object.assign({ key: index, className: css(Object.assign(Object.assign({}, style), { display: 'flex', flexShrink: 0, marginLeft: 0, marginRight: '8px' })) }, props, { onClick: () => handleClick(item, index) }),
|
39
39
|
React.createElement(Img, { 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 }),
|
40
40
|
React.createElement("div", { className: css({
|
41
41
|
color: '#fff',
|
@@ -16,12 +16,12 @@ const MultiCommodityDiro = (_a) => {
|
|
16
16
|
const { popup } = useEditor();
|
17
17
|
const { jumpToWeb } = useEventReport();
|
18
18
|
const [products, setProducts] = 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]);
|
19
|
-
const handleClick = throttle((item) => {
|
19
|
+
const handleClick = throttle((item, multiCheckIndex) => {
|
20
20
|
ctaEvent === null || ctaEvent === void 0 ? void 0 : ctaEvent({
|
21
21
|
eventSubject: 'clickCta',
|
22
22
|
eventDescription: 'User clicked the CTA'
|
23
23
|
}, recData, item, index);
|
24
|
-
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 }));
|
24
|
+
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 }));
|
25
25
|
if (isExternalLink) {
|
26
26
|
if (item === null || item === void 0 ? void 0 : item.link) {
|
27
27
|
jumpToWeb(recData, item, item.bindCta, index);
|
@@ -34,7 +34,7 @@ const MultiCommodityDiro = (_a) => {
|
|
34
34
|
}, popup === null || popup === void 0 ? void 0 : popup.duration);
|
35
35
|
return (React.createElement(Scroll, { isPadding: !!recData }, products === null || products === void 0 ? void 0 : products.map((item, index) => {
|
36
36
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
37
|
-
return (React.createElement(React.Fragment, null, recData && !(item === null || item === void 0 ? void 0 : item.bindCta) ? null : (React.createElement(SwiperSlide, Object.assign({ key: index, className: css(Object.assign(Object.assign({}, style), { display: 'flex', flexShrink: 0, marginLeft: 0, marginRight: '8px' })) }, props, { onClick: () => handleClick(item) }),
|
37
|
+
return (React.createElement(React.Fragment, null, recData && !(item === null || item === void 0 ? void 0 : item.bindCta) ? null : (React.createElement(SwiperSlide, Object.assign({ key: index, className: css(Object.assign(Object.assign({}, style), { display: 'flex', flexShrink: 0, marginLeft: 0, marginRight: '8px' })) }, props, { onClick: () => handleClick(item, index) }),
|
38
38
|
React.createElement(Img, { 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 }),
|
39
39
|
React.createElement("div", { className: css({
|
40
40
|
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;
|
@@ -1,31 +1,28 @@
|
|
1
|
-
import React, { memo
|
1
|
+
import React, { memo } from 'react';
|
2
2
|
import Scroll from './Scroll';
|
3
3
|
import FormatImage from '../../../../core/components/SxpPageRender/FormatImage';
|
4
|
-
import { useSxpDataSource } from '../../../../core/hooks';
|
5
4
|
import { SwiperSlide } from 'swiper/react';
|
6
5
|
import { css } from '@emotion/css';
|
7
|
-
const CommodityGroup = ({ products, data, defImg, style }) => {
|
8
|
-
var _a
|
9
|
-
|
10
|
-
const [check, setCheck] = useState((_a = popupDetailData === null || popupDetailData === void 0 ? void 0 : popupDetailData.multiCheckIndex) !== null && _a !== void 0 ? _a : 0);
|
11
|
-
const handleClick = useCallback((index) => {
|
12
|
-
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 })));
|
13
|
-
}, []);
|
14
|
-
return (React.createElement(React.Fragment, null, (data === null || data === void 0 ? void 0 : data.open) && ((products && (products === null || products === void 0 ? void 0 : products.length) > 0) || !popupDetailData) && (React.createElement(Scroll, { 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) => {
|
6
|
+
const CommodityGroup = ({ products, data, defImg, style, onCLick, popupDetailData, check }) => {
|
7
|
+
var _a;
|
8
|
+
return (React.createElement(React.Fragment, null, (data === null || data === void 0 ? void 0 : data.open) && ((products && (products === null || products === void 0 ? void 0 : products.length) > 1) || !popupDetailData) && (React.createElement(Scroll, { 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) => {
|
15
9
|
var _a, _b, _c;
|
16
|
-
return (React.createElement(SwiperSlide, { className: css({
|
10
|
+
return (React.createElement(React.Fragment, null, (item === null || item === void 0 ? void 0 : item.bindCta) ? (React.createElement(SwiperSlide, { className: css({
|
17
11
|
width: '50px',
|
18
12
|
height: '50px',
|
19
13
|
marginRight: '10px'
|
20
|
-
}), onClick: () =>
|
14
|
+
}), onClick: () => {
|
15
|
+
onCLick === null || onCLick === void 0 ? void 0 : onCLick(index);
|
16
|
+
}, key: index },
|
21
17
|
React.createElement(FormatImage, { style: {
|
22
18
|
height: '100%',
|
23
19
|
width: '100%',
|
24
20
|
objectFit: 'cover',
|
25
21
|
display: 'block',
|
26
|
-
objectPosition: `50% ${(data === null || data === void 0 ? void 0 : data.translateY) ?
|
27
|
-
border: check === index ? '1px solid #000' : '1px solid #f2f2f2'
|
28
|
-
|
22
|
+
objectPosition: `50% ${(data === null || data === void 0 ? void 0 : data.translateY) ? (data === null || data === void 0 ? void 0 : data.translateY) + 50 : 50}%`,
|
23
|
+
border: check === index ? '1px solid #000' : '1px solid #f2f2f2',
|
24
|
+
boxSizing: 'border-box'
|
25
|
+
}, 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));
|
29
26
|
})))));
|
30
27
|
};
|
31
28
|
export default memo(CommodityGroup);
|
@@ -3,18 +3,18 @@ import React, { memo, useEffect, useMemo, useRef } from 'react';
|
|
3
3
|
import useOnScreen from '../../../../core/hooks/useOnScreen';
|
4
4
|
import { useSxpDataSource } from '../../../../core/hooks';
|
5
5
|
import FormatImage from '../../../../core/components/SxpPageRender/FormatImage';
|
6
|
-
const Img = ({ src, rec, item, index, style, translateY, imgStyle }) => {
|
6
|
+
const Img = ({ src, rec, item, index, style, translateY, imgStyle, enableEventReport = true }) => {
|
7
7
|
const ref = useRef(null);
|
8
8
|
const isOnScreen = useOnScreen(ref);
|
9
9
|
const { ctaEvent } = useSxpDataSource();
|
10
10
|
useEffect(() => {
|
11
|
-
if (isOnScreen && src && (ref === null || ref === void 0 ? void 0 : ref.current)) {
|
11
|
+
if (isOnScreen && src && (ref === null || ref === void 0 ? void 0 : ref.current) && enableEventReport) {
|
12
12
|
ctaEvent === null || ctaEvent === void 0 ? void 0 : ctaEvent({
|
13
13
|
eventSubject: 'ctaExposure',
|
14
14
|
eventDescription: 'The cta was shown to the user'
|
15
15
|
}, rec, item, index);
|
16
16
|
}
|
17
|
-
}, [isOnScreen, src, ref, rec, ctaEvent, item, index]);
|
17
|
+
}, [isOnScreen, src, ref, rec, ctaEvent, item, index, enableEventReport]);
|
18
18
|
const imgSrc = useMemo(() => {
|
19
19
|
return (src === null || src === void 0 ? void 0 : src.includes('.avif')) ? src : `${src}?imrquality/rquality/20`;
|
20
20
|
}, [src]);
|
@@ -5,13 +5,14 @@ import 'swiper/css/free-mode';
|
|
5
5
|
import 'swiper/css/scrollbar';
|
6
6
|
import { FreeMode, Scrollbar, Mousewheel } from 'swiper/modules';
|
7
7
|
import { useSxpDataSource } from '../../../../core/hooks';
|
8
|
-
const Scroll = ({ children, isPadding = true, style }) => {
|
8
|
+
const Scroll = ({ children, isPadding = true, style, enableSlideActive = false }) => {
|
9
9
|
const ref = useRef();
|
10
10
|
const { popupDetailData } = useSxpDataSource();
|
11
11
|
useEffect(() => {
|
12
|
-
var _a;
|
13
|
-
|
14
|
-
|
12
|
+
var _a, _b;
|
13
|
+
if (enableSlideActive)
|
14
|
+
(_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);
|
15
|
+
}, [popupDetailData, enableSlideActive]);
|
15
16
|
return (React.createElement(Swiper, { ref: ref, direction: 'horizontal', slidesPerView: 'auto', freeMode: true, mousewheel: true, modules: [FreeMode, Scrollbar, Mousewheel], style: Object.assign({ padding: isPadding ? '0 12px 0 20px' : 0 }, style) }, children));
|
16
17
|
};
|
17
18
|
export default memo(Scroll);
|
@@ -39,7 +39,6 @@ const Hashtag = ({ tags, itemId, itemType, index, rec, hashTagStyle }) => {
|
|
39
39
|
}
|
40
40
|
return (react_1.default.createElement("span", { style: { textDecoration: 'underline', cursor: 'pointer', color: '#fff' }, onClick: () => setIsShowMore(!isShowMore) }, isShowMore ? 'show less' : 'show more'));
|
41
41
|
}, [isShowMore, tags]);
|
42
|
-
console.log(hashTagStyle, '111');
|
43
42
|
return (react_1.default.createElement("div", { className: 'clc-sxp-bottom-hashtag', style: { marginTop: `${(_a = hashTagStyle === null || hashTagStyle === void 0 ? void 0 : hashTagStyle.marginTop) !== null && _a !== void 0 ? _a : 16}px` } },
|
44
43
|
react_1.default.createElement(Scroll_1.default, null, tags === null || tags === void 0 ? void 0 : tags.map((item, index) => (react_1.default.createElement(react_2.SwiperSlide, { key: index, hidden: !isShowMore ? index >= 6 : false, className: 'clc-sxp-bottom-hashtag-item', style: hashTagStyle, onClick: () => handleClickTag(item) },
|
45
44
|
react_1.default.createElement("div", { dangerouslySetInnerHTML: { __html: (0, tool_1.setFontForText)(`#${item}`, hashTagStyle) } })))))));
|
@@ -8,50 +8,69 @@ const hooks_1 = require("../../../../core/hooks");
|
|
8
8
|
const defaultUnLikeIconPath = '/pb_static/f71266d2c64446c5ae6a5a7f5489cc0a.png';
|
9
9
|
const defaultLikeIconPath = '/pb_static/f07900fe3f0f4ae188ea1611d4801a44.png';
|
10
10
|
const LikeButton = (_a) => {
|
11
|
+
var _b;
|
11
12
|
var { active, activeIcon, unActicveIcon, recData, position } = _a, props = tslib_1.__rest(_a, ["active", "activeIcon", "unActicveIcon", "recData", "position"]);
|
12
|
-
const { mutateLike, mutateUnlike, bffEventReport } = (0, hooks_1.useSxpDataSource)();
|
13
|
-
const [state, setState] = (0, react_1.useState)(
|
13
|
+
const { mutateLike, mutateUnlike, bffEventReport, setCacheRtcList, cacheRtcList } = (0, hooks_1.useSxpDataSource)();
|
14
|
+
const [state, setState] = (0, react_1.useState)((_b = cacheRtcList === null || cacheRtcList === void 0 ? void 0 : cacheRtcList[position]) === null || _b === void 0 ? void 0 : _b.isCollected);
|
14
15
|
const likeIcon = (0, useIconLink_1.useIconLink)(defaultLikeIconPath);
|
15
16
|
const unlikeIcon = (0, useIconLink_1.useIconLink)(defaultUnLikeIconPath);
|
16
17
|
const handleClick = (0, lodash_1.debounce)(() => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
17
|
-
var
|
18
|
+
var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
|
18
19
|
if (state) {
|
19
20
|
setState(false);
|
20
|
-
const result = (
|
21
|
+
const result = (_e = (yield (mutateUnlike === null || mutateUnlike === void 0 ? void 0 : mutateUnlike({ videoItemId: (_d = (_c = recData === null || recData === void 0 ? void 0 : recData.video) === null || _c === void 0 ? void 0 : _c.itemId) !== null && _d !== void 0 ? _d : '' })))) !== null && _e !== void 0 ? _e : false;
|
21
22
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
22
23
|
eventInfo: {
|
23
24
|
eventSubject: 'favoriteContentCanceled',
|
24
25
|
eventDescription: 'This content was unfavorite by the user',
|
25
|
-
contentId: (
|
26
|
-
contentName: (
|
27
|
-
contentTags: JSON.stringify((
|
26
|
+
contentId: (_g = (_f = recData === null || recData === void 0 ? void 0 : recData.video) === null || _f === void 0 ? void 0 : _f.itemId) !== null && _g !== void 0 ? _g : '',
|
27
|
+
contentName: (_j = (_h = recData === null || recData === void 0 ? void 0 : recData.video) === null || _h === void 0 ? void 0 : _h.title) !== null && _j !== void 0 ? _j : '',
|
28
|
+
contentTags: JSON.stringify((_l = (_k = recData === null || recData === void 0 ? void 0 : recData.video) === null || _k === void 0 ? void 0 : _k.tags) !== null && _l !== void 0 ? _l : []),
|
28
29
|
position: position + '',
|
29
|
-
contentFormat: ((
|
30
|
-
traceInfo: (
|
30
|
+
contentFormat: ((_m = recData === null || recData === void 0 ? void 0 : recData.video) === null || _m === void 0 ? void 0 : _m.url) ? 'video' : 'image',
|
31
|
+
traceInfo: (_o = recData === null || recData === void 0 ? void 0 : recData.video) === null || _o === void 0 ? void 0 : _o.traceInfo
|
31
32
|
}
|
32
33
|
});
|
33
34
|
if (!result) {
|
34
35
|
setState(true);
|
35
36
|
}
|
37
|
+
else {
|
38
|
+
const nRtcList = (_p = cacheRtcList === null || cacheRtcList === void 0 ? void 0 : cacheRtcList.map((item, index) => {
|
39
|
+
if (index === position) {
|
40
|
+
item.isCollected = false;
|
41
|
+
}
|
42
|
+
return item;
|
43
|
+
})) !== null && _p !== void 0 ? _p : [];
|
44
|
+
setCacheRtcList === null || setCacheRtcList === void 0 ? void 0 : setCacheRtcList(nRtcList);
|
45
|
+
}
|
36
46
|
}
|
37
47
|
else {
|
38
48
|
setState(true);
|
39
|
-
const result = (
|
49
|
+
const result = (_q = (yield (mutateLike === null || mutateLike === void 0 ? void 0 : mutateLike({ content: JSON.stringify(recData) })))) !== null && _q !== void 0 ? _q : false;
|
40
50
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
41
51
|
eventInfo: {
|
42
52
|
eventSubject: 'favoriteContent',
|
43
53
|
eventDescription: 'This content was favorite by the user',
|
44
|
-
contentId: (
|
45
|
-
contentName: (
|
46
|
-
contentTags: JSON.stringify((
|
54
|
+
contentId: (_s = (_r = recData === null || recData === void 0 ? void 0 : recData.video) === null || _r === void 0 ? void 0 : _r.itemId) !== null && _s !== void 0 ? _s : '',
|
55
|
+
contentName: (_u = (_t = recData === null || recData === void 0 ? void 0 : recData.video) === null || _t === void 0 ? void 0 : _t.title) !== null && _u !== void 0 ? _u : '',
|
56
|
+
contentTags: JSON.stringify((_w = (_v = recData === null || recData === void 0 ? void 0 : recData.video) === null || _v === void 0 ? void 0 : _v.tags) !== null && _w !== void 0 ? _w : []),
|
47
57
|
position: position + '',
|
48
|
-
contentFormat: ((
|
49
|
-
traceInfo: (
|
58
|
+
contentFormat: ((_x = recData === null || recData === void 0 ? void 0 : recData.video) === null || _x === void 0 ? void 0 : _x.url) ? 'video' : 'image',
|
59
|
+
traceInfo: (_y = recData === null || recData === void 0 ? void 0 : recData.video) === null || _y === void 0 ? void 0 : _y.traceInfo
|
50
60
|
}
|
51
61
|
});
|
52
62
|
if (!result) {
|
53
63
|
setState(false);
|
54
64
|
}
|
65
|
+
else {
|
66
|
+
const nRtcList = (_z = cacheRtcList === null || cacheRtcList === void 0 ? void 0 : cacheRtcList.map((item, index) => {
|
67
|
+
if (index === position) {
|
68
|
+
item.isCollected = true;
|
69
|
+
}
|
70
|
+
return item;
|
71
|
+
})) !== null && _z !== void 0 ? _z : [];
|
72
|
+
setCacheRtcList === null || setCacheRtcList === void 0 ? void 0 : setCacheRtcList(nRtcList);
|
73
|
+
}
|
55
74
|
}
|
56
75
|
}), 200);
|
57
76
|
return (react_1.default.createElement("button", Object.assign({}, props, { "aria-label": 'like', onClick: handleClick }),
|
@@ -57,19 +57,23 @@ const Modal = ({ visible, onClose, children, modalStyle, padding, popup, schema,
|
|
57
57
|
onClose === null || onClose === void 0 ? void 0 : onClose();
|
58
58
|
}, 300);
|
59
59
|
const handleTouchStart = (event) => {
|
60
|
-
event.
|
61
|
-
|
62
|
-
fTouchRef.current = event.touches[0].clientY;
|
60
|
+
touchRef.current = event.touches[0];
|
61
|
+
fTouchRef.current = event.touches[0];
|
63
62
|
touchMoveRef.current = true;
|
64
63
|
};
|
65
64
|
const handleTouchMove = (event) => {
|
66
|
-
event.stopPropagation();
|
67
65
|
requestAnimationFrame(() => {
|
68
66
|
var _a;
|
69
67
|
if (touchMoveRef.current && ((_a = ref === null || ref === void 0 ? void 0 : ref.current) === null || _a === void 0 ? void 0 : _a.scrollTop) === 0) {
|
70
68
|
const currentY = event.touches[0].clientY;
|
71
|
-
const
|
72
|
-
touchRef.current
|
69
|
+
const currentX = event.touches[0].clientX;
|
70
|
+
const diff = touchRef.current.clientY - currentY;
|
71
|
+
touchRef.current = event.touches[0];
|
72
|
+
const diffY = currentY - fTouchRef.current.clientY;
|
73
|
+
const diffX = currentX - fTouchRef.current.clientX;
|
74
|
+
if (Math.abs(diffX) > Math.abs(diffY)) {
|
75
|
+
return;
|
76
|
+
}
|
73
77
|
const ts = modalTrans - diff;
|
74
78
|
if (ts > 0) {
|
75
79
|
setModalTrans(ts);
|
@@ -79,9 +83,13 @@ const Modal = ({ visible, onClose, children, modalStyle, padding, popup, schema,
|
|
79
83
|
};
|
80
84
|
const handleTouchEnd = (event) => {
|
81
85
|
var _a;
|
82
|
-
event.stopPropagation();
|
83
86
|
if (touchMoveRef.current && ((_a = ref === null || ref === void 0 ? void 0 : ref.current) === null || _a === void 0 ? void 0 : _a.scrollTop) === 0) {
|
84
|
-
const
|
87
|
+
const diffY = event.changedTouches[0].clientY - fTouchRef.current.clientY;
|
88
|
+
const diffX = event.changedTouches[0].clientX - fTouchRef.current.clientX;
|
89
|
+
if (Math.abs(diffX) > Math.abs(diffY)) {
|
90
|
+
return;
|
91
|
+
}
|
92
|
+
const diff = fTouchRef.current.clientY - touchRef.current.clientY;
|
85
93
|
if (diff > 0) {
|
86
94
|
setModalTrans(0);
|
87
95
|
}
|