pb-sxp-ui 1.3.8 → 1.4.1
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/LICENSE +21 -21
- package/README.md +111 -111
- package/dist/index.cjs +197 -72
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +0 -4
- package/dist/index.js +197 -72
- 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 +197 -72
- 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/Modal/index.js +10 -4
- package/es/core/components/SxpPageRender/PictureGroup/index.js +11 -5
- package/es/core/components/SxpPageRender/index.d.ts +3 -0
- package/es/core/components/SxpPageRender/index.js +14 -9
- package/es/core/context/SxpDataSourceProvider.d.ts +2 -1
- package/es/core/context/SxpDataSourceProvider.js +22 -15
- package/es/core/hooks/useEventReport.js +9 -16
- package/es/materials/sxp/popup/AppointForm/Form.js +1 -1
- package/es/materials/sxp/popup/AppointForm/index.js +31 -8
- package/es/materials/sxp/popup/CommodityDetail/index.d.ts +3 -0
- package/es/materials/sxp/popup/CommodityDetail/index.js +15 -5
- package/es/materials/sxp/popup/CommodityDetail/settingRender.d.ts +13 -0
- package/es/materials/sxp/popup/CommodityDetail/settingRender.js +31 -0
- package/es/materials/sxp/popup/CommodityDetailDiroNew/index.d.ts +3 -0
- package/es/materials/sxp/popup/CommodityDetailDiroNew/index.js +15 -4
- package/es/materials/sxp/popup/CommodityDetailDiroNew/settingRender.d.ts +13 -0
- package/es/materials/sxp/popup/CommodityDetailDiroNew/settingRender.js +31 -0
- package/lib/core/components/SxpPageRender/Modal/index.js +10 -4
- package/lib/core/components/SxpPageRender/PictureGroup/index.js +11 -5
- package/lib/core/components/SxpPageRender/index.d.ts +3 -0
- package/lib/core/components/SxpPageRender/index.js +14 -9
- package/lib/core/context/SxpDataSourceProvider.d.ts +2 -1
- package/lib/core/context/SxpDataSourceProvider.js +22 -15
- package/lib/core/hooks/useEventReport.js +9 -16
- package/lib/materials/sxp/popup/AppointForm/Form.js +1 -1
- package/lib/materials/sxp/popup/AppointForm/index.js +30 -7
- package/lib/materials/sxp/popup/CommodityDetail/index.d.ts +3 -0
- package/lib/materials/sxp/popup/CommodityDetail/index.js +15 -5
- package/lib/materials/sxp/popup/CommodityDetail/settingRender.d.ts +13 -0
- package/lib/materials/sxp/popup/CommodityDetail/settingRender.js +31 -0
- package/lib/materials/sxp/popup/CommodityDetailDiroNew/index.d.ts +3 -0
- package/lib/materials/sxp/popup/CommodityDetailDiroNew/index.js +15 -4
- package/lib/materials/sxp/popup/CommodityDetailDiroNew/settingRender.d.ts +13 -0
- package/lib/materials/sxp/popup/CommodityDetailDiroNew/settingRender.js +31 -0
- package/package.json +111 -111
@@ -85,7 +85,7 @@ const CommodityDetailDiroNew = (_a) => {
|
|
85
85
|
const productInfoText = ({ isPost }) => {
|
86
86
|
return (React.createElement("div", { hidden: !!product && (!(product === null || product === void 0 ? void 0 : product.info) || (product === null || product === void 0 ? void 0 : product.info) === '') },
|
87
87
|
React.createElement(ExpandableText, { isPost: isPost, onClick: () => setShowModal(true), className: 'pb-commondityDiroNew-info', style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.info, foldText: tipText === null || tipText === void 0 ? void 0 : tipText.foldText, unfoldText: tipText === null || tipText === void 0 ? void 0 : tipText.unfoldText, text: (product === null || product === void 0 ? void 0 : product.info) ||
|
88
|
-
`Unveiled at the Spring-Summer 2023 fashion show, the Dior Toujours bag is distinguished by a casual and practical design. Crafted in black calfskin with Macrocannage topstitching, it showcases a spacious interior compartment with a matching pouch to organize essentials. Its leather strap closure keeps items secure while the D of the CD Lock closure twists to adjust the sides and enhance the bag's silhouette. The leather handles can be adjusted using the small notches in order to be able to carry the large bag by hand or wear it over the shoulder. CD Lock and strap closures D.I.O.R. charms Removable interior pouch Adjustable leather handles Dust bag included
|
88
|
+
`Unveiled at the Spring-Summer 2023 fashion show, the Dior Toujours bag is distinguished by a casual and practical design. Crafted in black calfskin with Macrocannage topstitching, it showcases a spacious interior compartment with a matching pouch to organize essentials. Its leather strap closure keeps items secure while the D of the CD Lock closure twists to adjust the sides and enhance the bag's silhouette. The leather handles can be adjusted using the small notches in order to be able to carry the large bag by hand or wear it over the shoulder. CD Lock and strap closures D.I.O.R. charms Removable interior pouch Adjustable leather handles Dust bag included
|
89
89
|
Made in Italy` })));
|
90
90
|
};
|
91
91
|
const getStyle = useCallback((style) => {
|
@@ -123,11 +123,21 @@ Made in Italy` })));
|
|
123
123
|
React.createElement("div", { style: { position: 'relative' } },
|
124
124
|
product && ((_w = product === null || product === void 0 ? void 0 : product.homePage) === null || _w === void 0 ? void 0 : _w.length) > 0 && (React.createElement(Swiper, { height: height, modules: [Pagination, Autoplay], pagination: {
|
125
125
|
clickable: true,
|
126
|
-
bulletActiveClass: '
|
126
|
+
bulletActiveClass: 'swipe-item-active-bullet',
|
127
127
|
clickableClass: getDotsAlign
|
128
128
|
}, loop: true, autoplay: {
|
129
129
|
delay: (swiper === null || swiper === void 0 ? void 0 : swiper.delay) * 1000
|
130
|
-
}, ref: ref }, (
|
130
|
+
}, ref: ref, className: css(Object.assign(Object.assign({ '.swiper-pagination': Object.assign(Object.assign({}, ((swiper === null || swiper === void 0 ? void 0 : swiper.dotsMarginBottom) && { bottom: swiper === null || swiper === void 0 ? void 0 : swiper.dotsMarginBottom })), { fontSize: '14px' }) }, ((swiper === null || swiper === void 0 ? void 0 : swiper.dotsBgColor) && {
|
131
|
+
'.swiper-pagination-bullet': {
|
132
|
+
backgroundColor: swiper === null || swiper === void 0 ? void 0 : swiper.dotsBgColor,
|
133
|
+
opacity: 1
|
134
|
+
}
|
135
|
+
})), ((swiper === null || swiper === void 0 ? void 0 : swiper.dotsActiveColor) && {
|
136
|
+
'.swipe-item-active-bullet': {
|
137
|
+
backgroundColor: `${swiper === null || swiper === void 0 ? void 0 : swiper.dotsActiveColor}!important`,
|
138
|
+
opacity: 1
|
139
|
+
}
|
140
|
+
}))) }, (_x = product === null || product === void 0 ? void 0 : product.homePage) === null || _x === void 0 ? void 0 : _x.map((src) => {
|
131
141
|
var _a;
|
132
142
|
return (React.createElement(SwiperSlide, { key: src },
|
133
143
|
React.createElement("div", { style: {
|
@@ -185,7 +195,8 @@ Made in Italy` })));
|
|
185
195
|
__html: setFontForText((_3 = cta === null || cta === void 0 ? void 0 : cta.enTitle) !== null && _3 !== void 0 ? _3 : 'Shop now', buttonStyle)
|
186
196
|
} }))),
|
187
197
|
productInfoText({ isPost }))),
|
188
|
-
React.createElement(Modal, { visible: showModal, onClose: () => setShowModal(false) },
|
198
|
+
React.createElement(Modal, { visible: showModal, onClose: () => setShowModal(false) },
|
199
|
+
React.createElement("div", { style: { paddingTop: '20px' } }, productInfoText({ isPost: false }))),
|
189
200
|
React.createElement(Modal, { visible: show3DModal, padding: 0, isFullScreen: true, onClose: () => setShow3DModal(false) },
|
190
201
|
React.createElement("div", { style: { backgroundColor: iframeBgColor, height: '100%' } },
|
191
202
|
React.createElement("iframe", { src: iframeUrl, style: {
|
@@ -220,5 +220,18 @@ declare const _default: ({
|
|
220
220
|
name: string[];
|
221
221
|
text?: undefined;
|
222
222
|
})[];
|
223
|
+
} | {
|
224
|
+
title: string;
|
225
|
+
child: ({
|
226
|
+
label: string;
|
227
|
+
name: string[];
|
228
|
+
type: string;
|
229
|
+
addonAfter?: undefined;
|
230
|
+
} | {
|
231
|
+
label: string;
|
232
|
+
name: string[];
|
233
|
+
type: string;
|
234
|
+
addonAfter: string;
|
235
|
+
})[];
|
223
236
|
})[];
|
224
237
|
export default _default;
|
@@ -309,5 +309,36 @@ export default [
|
|
309
309
|
name: ['props', 'iframeBgColor']
|
310
310
|
}
|
311
311
|
]
|
312
|
+
},
|
313
|
+
{
|
314
|
+
title: '轮播指示器',
|
315
|
+
child: [
|
316
|
+
{
|
317
|
+
label: '背景色',
|
318
|
+
name: ['props', 'swiper', 'dotsBgColor'],
|
319
|
+
type: 'Color'
|
320
|
+
},
|
321
|
+
{
|
322
|
+
label: '选中色',
|
323
|
+
name: ['props', 'swiper', 'dotsActiveColor'],
|
324
|
+
type: 'Color'
|
325
|
+
},
|
326
|
+
{
|
327
|
+
label: '底边距',
|
328
|
+
name: ['props', 'swiper', 'dotsMarginBottom'],
|
329
|
+
type: 'Number',
|
330
|
+
addonAfter: 'px'
|
331
|
+
}
|
332
|
+
]
|
333
|
+
},
|
334
|
+
{
|
335
|
+
title: '关闭按钮',
|
336
|
+
child: [
|
337
|
+
{
|
338
|
+
label: '跟随弹窗滚动',
|
339
|
+
type: 'Switch',
|
340
|
+
name: ['props', 'enableFixedCloseButton']
|
341
|
+
}
|
342
|
+
]
|
312
343
|
}
|
313
344
|
];
|
@@ -7,7 +7,7 @@ const ReactDOM = tslib_1.__importStar(require("react-dom"));
|
|
7
7
|
const hooks_1 = require("../../../../core/hooks");
|
8
8
|
const closeIcon = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAjhJREFUWEfFlztOw0AQhmeWiJ4CCmpQ5DiRQsIJyAWg5A0lR0AIChDiCJS8ER0cADgBeRSxt4CCDgkaKiq8i+zYeWx2413HEWmiJJv9v535Z2aN8M8vFPT9z3zETD0aAUChUJjwvPFHAJhBhB3Hqd6OAsK2yyucwykAvP38eJX398Z3AJDLlVYR8ToU9Rhj25TWr9KEsKy5dULIGQCMtfZly45TvwsAstm56UwG6wA4FUFwzrdctxZBDcWSy5XWEPG8I84/GcMipdWPtgcsaz5PCHtKG0IuTiqUvjT9U/WYMG2IOPE+AP+LtCB0xKUAAyA2Xbd2o2OG0NQXvTnvhL17D7EPtH9TRCIWwkRcGYGIQgYBABuqPuHXOQBc6pw80lBGwBQiiXhsBHQhkoprA6iM6acjhDQKu5YJZW6XeOI3XJdpvfsdTu52VfXEekD8owQiXGIubpSCbhDbLu8DwKEAd+A41SOdPpE4BS0viFOtvV2iKWqUgn5x/tmS70xR01GuDSCKc86/OCcLgTyyZ0ScDGNhFAktAJV4NFJ9YyaFiAWIE+9uVkkgBgLoig8DMWAa9ro9ynkUdlW5maZDCmB6clmz0k1HH4Cs1Ezbq2p2yEpUuBOKTSZZex00RUWIrltxuuK6EOGDSbGIOPZicpMx6fny650377qNRgBgWeVFQuA+6UjVgREhGIMlSqsPUQqIbZdOOIdZQmCv2axRnU1N1+TzJYsxOEaEV8ep7frPZ7Gd0FTEdP0ft0/kMNdg0eoAAAAASUVORK5CYII=';
|
9
9
|
const Modal = ({ visible, onClose, children, modalStyle, padding, popup, schema, fullHeight = window.innerHeight, isFullScreen = false }) => {
|
10
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
10
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
|
11
11
|
const touchRef = (0, react_1.useRef)(null);
|
12
12
|
const fTouchRef = (0, react_1.useRef)(null);
|
13
13
|
const touchMoveRef = (0, react_1.useRef)(null);
|
@@ -19,6 +19,7 @@ const Modal = ({ visible, onClose, children, modalStyle, padding, popup, schema,
|
|
19
19
|
const modalEleRef = (0, react_1.useRef)(null);
|
20
20
|
const { globalConfig, popupDetailData } = (0, hooks_1.useSxpDataSource)();
|
21
21
|
const { schema: _schema } = (0, hooks_1.useEditor)();
|
22
|
+
const [scrollTop, setScrollTop] = (0, react_1.useState)(15);
|
22
23
|
(0, react_1.useEffect)(() => {
|
23
24
|
const parentNode = document.getElementById('sxp-render');
|
24
25
|
const node = document.getElementById('pb-modal');
|
@@ -126,11 +127,16 @@ const Modal = ({ visible, onClose, children, modalStyle, padding, popup, schema,
|
|
126
127
|
onTouchStart: handleTouchStart,
|
127
128
|
onTouchEnd: handleTouchEnd
|
128
129
|
})),
|
129
|
-
react_1.default.createElement("div", {
|
130
|
+
react_1.default.createElement("div", { className: 'modal-icon-wrapper', onClick: onClose, style: { top: scrollTop } },
|
130
131
|
react_1.default.createElement("img", { src: (_t = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.popupCloseIcon) !== null && _t !== void 0 ? _t : closeIcon, alt: 'close', className: 'modal-icon' })),
|
131
|
-
react_1.default.createElement("div", { ref: ref, style: {
|
132
|
+
react_1.default.createElement("div", Object.assign({ ref: ref, style: {
|
132
133
|
height: isScrollFullScreen ? fullHeight : MODAL_DEF_CON_H,
|
133
134
|
overflow: (isScrollFullScreen && modalTrans <= 0) || !isScrollFullScreen ? 'auto' : 'hidden'
|
134
|
-
} },
|
135
|
+
} }, (((_v = (_u = getPopupById === null || getPopupById === void 0 ? void 0 : getPopupById.item) === null || _u === void 0 ? void 0 : _u.props) === null || _v === void 0 ? void 0 : _v.enableFixedCloseButton) && {
|
136
|
+
onScroll: (e) => {
|
137
|
+
var _a;
|
138
|
+
setScrollTop(15 - ((_a = e === null || e === void 0 ? void 0 : e.target) === null || _a === void 0 ? void 0 : _a.scrollTop));
|
139
|
+
}
|
140
|
+
})), children)))))), modalEleRef.current);
|
135
141
|
};
|
136
142
|
exports.default = (0, react_1.memo)(Modal);
|
@@ -8,7 +8,7 @@ const Picture_1 = tslib_1.__importDefault(require("./Picture"));
|
|
8
8
|
const hooks_1 = require("../../../../core/hooks");
|
9
9
|
const css_1 = require("@emotion/css");
|
10
10
|
const PictureGroup = ({ imgUrls, width, height, rec, index, onReportViewImageEnd, onViewImageStartEvent, imgUrlsPostConfig }) => {
|
11
|
-
var _a
|
11
|
+
var _a;
|
12
12
|
const ref = (0, react_1.useRef)();
|
13
13
|
const { isActive } = (0, react_2.useSwiperSlide)();
|
14
14
|
const { sxpParameter, openHashtag } = (0, hooks_1.useSxpDataSource)();
|
@@ -35,11 +35,17 @@ const PictureGroup = ({ imgUrls, width, height, rec, index, onReportViewImageEnd
|
|
35
35
|
return (react_1.default.createElement(react_2.Swiper, { ref: ref, defaultValue: 0, direction: 'horizontal', modules: [modules_1.Pagination, modules_1.Autoplay], pagination: {
|
36
36
|
clickable: true,
|
37
37
|
bulletActiveClass: 'swipe-item-active-bullet'
|
38
|
-
}, className: (0, css_1.css)(Object.assign({}, ((imgUrlsPostConfig === null || imgUrlsPostConfig === void 0 ? void 0 : imgUrlsPostConfig.marginBottom) && {
|
39
|
-
'.swiper-pagination': {
|
40
|
-
|
38
|
+
}, className: (0, css_1.css)(Object.assign(Object.assign({ '.swiper-pagination': Object.assign(Object.assign({}, ((imgUrlsPostConfig === null || imgUrlsPostConfig === void 0 ? void 0 : imgUrlsPostConfig.marginBottom) && { bottom: imgUrlsPostConfig === null || imgUrlsPostConfig === void 0 ? void 0 : imgUrlsPostConfig.marginBottom })), { fontSize: '14px' }) }, ((imgUrlsPostConfig === null || imgUrlsPostConfig === void 0 ? void 0 : imgUrlsPostConfig.dotsBgColor) && {
|
39
|
+
'.swiper-pagination-bullet': {
|
40
|
+
backgroundColor: imgUrlsPostConfig === null || imgUrlsPostConfig === void 0 ? void 0 : imgUrlsPostConfig.dotsBgColor,
|
41
|
+
opacity: 1
|
41
42
|
}
|
42
|
-
}))
|
43
|
+
})), ((imgUrlsPostConfig === null || imgUrlsPostConfig === void 0 ? void 0 : imgUrlsPostConfig.dotsActiveColor) && {
|
44
|
+
'.swipe-item-active-bullet': {
|
45
|
+
backgroundColor: `${imgUrlsPostConfig === null || imgUrlsPostConfig === void 0 ? void 0 : imgUrlsPostConfig.dotsActiveColor}!important`,
|
46
|
+
opacity: 1
|
47
|
+
}
|
48
|
+
}))), height: height, loop: true, autoplay: { delay: ((_a = imgUrlsPostConfig === null || imgUrlsPostConfig === void 0 ? void 0 : imgUrlsPostConfig.delay) !== null && _a !== void 0 ? _a : 3) * 1000 } }, imgUrls === null || imgUrls === void 0 ? void 0 : imgUrls.map((url, index) => {
|
43
49
|
return (react_1.default.createElement(react_2.SwiperSlide, { key: index },
|
44
50
|
react_1.default.createElement(Picture_1.default, { src: !isLoad && index > 0 ? '' : url, height: height, imgUrlsPostConfig: imgUrlsPostConfig, onShowFirstImage: showFirstImageFn })));
|
45
51
|
})));
|
@@ -8,6 +8,8 @@ export type postConfigType = {
|
|
8
8
|
bgWay?: '1' | '2';
|
9
9
|
bgColor?: string;
|
10
10
|
marginBottom?: number;
|
11
|
+
dotsActiveColor?: string;
|
12
|
+
dotsBgColor?: string;
|
11
13
|
};
|
12
14
|
export interface ISxpPageRenderProps {
|
13
15
|
globalConfig?: {
|
@@ -48,6 +50,7 @@ export interface ISxpPageRenderProps {
|
|
48
50
|
enablePreview?: boolean;
|
49
51
|
enableSwiperTip?: boolean;
|
50
52
|
logoBar?: any;
|
53
|
+
textUnderlineOffset?: number;
|
51
54
|
};
|
52
55
|
descStyle?: CSSProperties;
|
53
56
|
tipText?: {
|
@@ -26,7 +26,7 @@ const Tagbar_1 = tslib_1.__importDefault(require("./Tagbar"));
|
|
26
26
|
const localStore_1 = require("../../../core/utils/localStore");
|
27
27
|
const lodash_1 = require("lodash");
|
28
28
|
const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.innerHeight, containerWidth = window.innerWidth, tempMap, resolver, data = [], ctaType, tipText, nudge, _schema, hashTagStyle, tagList = [], licenseUrl }) => {
|
29
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
29
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
30
30
|
const mutedIcon = (0, useIconLink_1.useIconLink)('/pb_static/5beaaa5ce7f3477b99db3838619cc471.png');
|
31
31
|
const unmutedIcon = (0, useIconLink_1.useIconLink)('/pb_static/fea8668a8a894e4aa3a86bcc775e895e.png');
|
32
32
|
const { schema } = (0, hooks_1.useEditor)();
|
@@ -38,7 +38,8 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
38
38
|
const [isShowMore, setIsShowMore] = (0, react_1.useState)(false);
|
39
39
|
const [isReload, setIsReload] = (0, react_1.useState)(new Date().getTime());
|
40
40
|
const skipLinkRef = (0, react_1.useRef)(false);
|
41
|
-
const
|
41
|
+
const [pageNum, setPageNum] = (0, react_1.useState)(2);
|
42
|
+
const { loadVideos, bffEventReport, loading, setPopupDetailData, ctaEvent, swiperRef, waterFallData, setOpenHashtag, appDomain, openHashtag, loadingImage, isFromHashtag, popupDetailData, bffFbReport, curTime, h5EnterLink, isShowConsent, selectTag, isPreview, isEditor, cacheRtcList, setRtcList, cacheActiveIndex, rtcList, isNoMoreData } = (0, hooks_1.useSxpDataSource)();
|
42
43
|
const { backMainFeed, productView, jumpToWeb } = (0, useEventReport_1.useEventReport)();
|
43
44
|
const isShowFingerTip = (0, react_1.useMemo)(() => {
|
44
45
|
return data.length > 0 && !loading && ((0, localStore_1.getFeUserId)() || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enableSwiperTip));
|
@@ -194,8 +195,8 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
194
195
|
return null;
|
195
196
|
}
|
196
197
|
});
|
197
|
-
return !waterFallData ? list.concat([{ loading: true }]) : list;
|
198
|
-
}, [data, activeIndex, waterFallData, isEditor]);
|
198
|
+
return !waterFallData && !isNoMoreData ? list.concat([{ loading: true }]) : list;
|
199
|
+
}, [data, activeIndex, waterFallData, isEditor, isNoMoreData]);
|
199
200
|
const renderLogo = (0, react_1.useMemo)(() => {
|
200
201
|
var _a, _b, _c, _d;
|
201
202
|
if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.logoUrl) && (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowLogo)) {
|
@@ -480,8 +481,8 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
480
481
|
isReload,
|
481
482
|
renderToggleButton
|
482
483
|
]);
|
483
|
-
return (react_1.default.createElement("div", { id: 'sxp-render', className: 'clc-sxp-container' },
|
484
|
-
waterFallData && (react_1.default.createElement(Navbar_1.default, { icon: left_png_1.default, styles: { background: 'rgba(0,0,0,.3)', color: '#fff' }, textStyle: Object.assign(Object.assign({}, (_e = (_d = (_c = (_b =
|
484
|
+
return (react_1.default.createElement("div", { id: 'sxp-render', className: 'clc-sxp-container', style: { textUnderlineOffset: `${(_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.textUnderlineOffset) !== null && _a !== void 0 ? _a : 0}px` } },
|
485
|
+
waterFallData && (react_1.default.createElement(Navbar_1.default, { icon: left_png_1.default, styles: { background: 'rgba(0,0,0,.3)', color: '#fff' }, textStyle: Object.assign(Object.assign({}, (_f = (_e = (_d = (_c = (_b = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.hashTag) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.item) === null || _d === void 0 ? void 0 : _d.props) === null || _e === void 0 ? void 0 : _e.textStyles) === null || _f === void 0 ? void 0 : _f.hashTagTitle), { color: '#fff' }), onClose: () => {
|
485
486
|
const isEq = (0, lodash_1.isEqual)(rtcList, cacheRtcList);
|
486
487
|
if (!isEq && cacheRtcList && (cacheRtcList === null || cacheRtcList === void 0 ? void 0 : cacheRtcList.length)) {
|
487
488
|
setRtcList === null || setRtcList === void 0 ? void 0 : setRtcList(cacheRtcList);
|
@@ -492,7 +493,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
492
493
|
react_1.default.createElement(Tagbar_1.default, { tagList: tagList, setActiveIndex: setActiveIndex, style: {
|
493
494
|
top: minusHeight
|
494
495
|
} }),
|
495
|
-
isShowFingerTip ? (react_1.default.createElement(FingerSwipeTip_1.default, { imageUrl: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.swipeTipIcon, style: { top: `${50 - ((
|
496
|
+
isShowFingerTip ? (react_1.default.createElement(FingerSwipeTip_1.default, { imageUrl: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.swipeTipIcon, style: { top: `${50 - ((_g = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.swipeTipOffset) !== null && _g !== void 0 ? _g : 0)}%` }, duration: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.swiperTipAniDur })) : null,
|
496
497
|
react_1.default.createElement(react_2.Swiper, { style: {
|
497
498
|
marginTop: tagHeight
|
498
499
|
}, ref: swiperRef, onSlideChange: () => {
|
@@ -510,8 +511,12 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
510
511
|
if ((swiper === null || swiper === void 0 ? void 0 : swiper.activeIndex) + 1 >= (data === null || data === void 0 ? void 0 : data.length)) {
|
511
512
|
if (!isLoadMore) {
|
512
513
|
setIsLoadMore(true);
|
513
|
-
loadVideos === null || loadVideos === void 0 ? void 0 : loadVideos(
|
514
|
+
loadVideos === null || loadVideos === void 0 ? void 0 : loadVideos(pageNum).then((res) => {
|
515
|
+
var _a;
|
514
516
|
setIsLoadMore(false);
|
517
|
+
if (res && ((_a = res === null || res === void 0 ? void 0 : res.recList) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
518
|
+
setPageNum((pageNum + 1));
|
519
|
+
}
|
515
520
|
});
|
516
521
|
}
|
517
522
|
}
|
@@ -519,6 +524,6 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
519
524
|
renderLikeButton(visList[activeIndex], activeIndex, !!(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIconFixed)),
|
520
525
|
renderToggleButton(!!(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconFixed)),
|
521
526
|
renderView),
|
522
|
-
react_1.default.createElement(WaterFall_1.default, Object.assign({}, (
|
527
|
+
react_1.default.createElement(WaterFall_1.default, Object.assign({}, (_k = (_j = (_h = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.hashTag) === null || _h === void 0 ? void 0 : _h[0]) === null || _j === void 0 ? void 0 : _j.item) === null || _k === void 0 ? void 0 : _k.props))));
|
523
528
|
};
|
524
529
|
exports.default = SxpPageRender;
|
@@ -25,7 +25,7 @@ export interface ISxpDataSourceContext {
|
|
25
25
|
}) => Promise<boolean>;
|
26
26
|
popupDetailData?: RecItemType;
|
27
27
|
setPopupDetailData?: React.Dispatch<React.SetStateAction<any | null>>;
|
28
|
-
loadVideos?: (page: number) => Promise<
|
28
|
+
loadVideos?: (page: number) => Promise<RecommendVideoResultType | undefined>;
|
29
29
|
getRecommendVideos?: (query?: {
|
30
30
|
maxSize?: number;
|
31
31
|
defaultSize?: number;
|
@@ -82,6 +82,7 @@ export interface ISxpDataSourceContext {
|
|
82
82
|
popupCurTimeRef?: any;
|
83
83
|
checkCommodityIndexRef?: any;
|
84
84
|
isEditor?: boolean;
|
85
|
+
isNoMoreData?: boolean;
|
85
86
|
}
|
86
87
|
export declare const SxpDataSourceContext: React.Context<ISxpDataSourceContext>;
|
87
88
|
export interface SxpDataSourceProviderProps {
|
@@ -40,6 +40,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
40
40
|
const [selectTag, setSelectTag] = (0, react_1.useState)(exports.DEFAULT_TAG);
|
41
41
|
const checkCommodityIndexRef = (0, react_1.useRef)(-1);
|
42
42
|
const popupCurTimeRef = (0, react_1.useRef)(null);
|
43
|
+
const [isNoMoreData, setIsNoMoreData] = (0, react_1.useState)(false);
|
43
44
|
const isShowConsent = (0, react_1.useMemo)(() => {
|
44
45
|
var _a, _b, _c, _d;
|
45
46
|
return (((_d = (_c = (_b = (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.consent) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.item) === null || _c === void 0 ? void 0 : _c.props) === null || _d === void 0 ? void 0 : _d.privacy_necessity) && !isAgreePolicy && !isEditor) || isOpenConsent;
|
@@ -96,7 +97,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
96
97
|
.catch((err) => Promise.reject(err));
|
97
98
|
}, [bffDataSource]);
|
98
99
|
const getRecommendVideos = (0, react_1.useCallback)((query) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
99
|
-
var _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
100
|
+
var _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
100
101
|
query = Object.assign(Object.assign(Object.assign({ maxSize: (_d = query === null || query === void 0 ? void 0 : query.maxSize) !== null && _d !== void 0 ? _d : maxSize, defaultSize: (_e = query === null || query === void 0 ? void 0 : query.defaultSize) !== null && _e !== void 0 ? _e : defaultSize, hashTag: query === null || query === void 0 ? void 0 : query.hashTag, traceInfo: query === null || query === void 0 ? void 0 : query.traceInfo, themeTag: query === null || query === void 0 ? void 0 : query.themeTag }, ((query === null || query === void 0 ? void 0 : query.contentFilter) && { contentFilter: `[${query === null || query === void 0 ? void 0 : query.contentFilter}]` })), ((query === null || query === void 0 ? void 0 : query.productFilter) && { productFilter: `[${query === null || query === void 0 ? void 0 : query.productFilter}]` })), { pageNum: query === null || query === void 0 ? void 0 : query.pageNum });
|
101
102
|
if (utmVal) {
|
102
103
|
const val = (_h = (_g = (_f = utmVal === null || utmVal === void 0 ? void 0 : utmVal.split('&')) === null || _f === void 0 ? void 0 : _f.filter((val) => {
|
@@ -106,9 +107,6 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
106
107
|
})) === null || _g === void 0 ? void 0 : _g.join('&')) !== null && _h !== void 0 ? _h : '';
|
107
108
|
query = Object.assign(Object.assign({}, query), { channel: decodeURIComponent(val) });
|
108
109
|
}
|
109
|
-
if (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview) {
|
110
|
-
query = Object.assign(Object.assign({}, query), { directPage: true, level: 1, pageNum: (_j = query === null || query === void 0 ? void 0 : query.pageNum) !== null && _j !== void 0 ? _j : 1 });
|
111
|
-
}
|
112
110
|
if (isEditor) {
|
113
111
|
let pageNum = 1;
|
114
112
|
query = Object.assign(Object.assign(Object.assign({}, query), { directPage: true, level: 1 }), (!utmVal && channelQueryList && (channelQueryList === null || channelQueryList === void 0 ? void 0 : channelQueryList.length) > 0 && { channel: channelQueryList === null || channelQueryList === void 0 ? void 0 : channelQueryList[0] }));
|
@@ -119,15 +117,15 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
119
117
|
let list = [];
|
120
118
|
let result = null;
|
121
119
|
const recurveRecList = (query) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
122
|
-
var
|
120
|
+
var _t, _u, _v, _w, _x, _y;
|
123
121
|
query.pageNum = pageNum;
|
124
122
|
result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/recommend/list', { method: 'GET', query }));
|
125
123
|
if (!(result === null || result === void 0 ? void 0 : result.success)) {
|
126
124
|
return undefined;
|
127
125
|
}
|
128
126
|
setLoading(false);
|
129
|
-
const isNotNullList = (_s = (_r = result === null || result === void 0 ? void 0 : result.data) === null || _r === void 0 ? void 0 : _r.recList) === null || _s === void 0 ? void 0 : _s.every((item) => (item === null || item === void 0 ? void 0 : item.product) || (item === null || item === void 0 ? void 0 : item.video));
|
130
127
|
list = list.concat((_w = (_v = (_u = (_t = result === null || result === void 0 ? void 0 : result.data) === null || _t === void 0 ? void 0 : _t.recList) === null || _u === void 0 ? void 0 : _u.filter) === null || _v === void 0 ? void 0 : _v.call(_u, (item) => (item === null || item === void 0 ? void 0 : item.product) || (item === null || item === void 0 ? void 0 : item.video))) !== null && _w !== void 0 ? _w : []);
|
128
|
+
const isNotNullList = (_y = (_x = result === null || result === void 0 ? void 0 : result.data) === null || _x === void 0 ? void 0 : _x.recList) === null || _y === void 0 ? void 0 : _y.some((item) => (item === null || item === void 0 ? void 0 : item.product) || (item === null || item === void 0 ? void 0 : item.video));
|
131
129
|
if (isNotNullList) {
|
132
130
|
pageNum = pageNum + 1;
|
133
131
|
yield recurveRecList(query);
|
@@ -135,9 +133,12 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
135
133
|
});
|
136
134
|
yield recurveRecList(query);
|
137
135
|
if (!(query === null || query === void 0 ? void 0 : query.hashTag) && result)
|
138
|
-
setCurReqInfo({ rtc: (
|
136
|
+
setCurReqInfo({ rtc: (_j = result === null || result === void 0 ? void 0 : result.data) === null || _j === void 0 ? void 0 : _j.rtc, requestId: (_k = result === null || result === void 0 ? void 0 : result.data) === null || _k === void 0 ? void 0 : _k.requestId });
|
139
137
|
return Object.assign(Object.assign({}, result.data), { recList: list });
|
140
138
|
}
|
139
|
+
if (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview) {
|
140
|
+
query = Object.assign(Object.assign({}, query), { directPage: true, level: 1, pageNum: (_l = query === null || query === void 0 ? void 0 : query.pageNum) !== null && _l !== void 0 ? _l : 1 });
|
141
|
+
}
|
141
142
|
const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/recommend/list', { method: 'GET', query }));
|
142
143
|
if (!(result === null || result === void 0 ? void 0 : result.success)) {
|
143
144
|
return undefined;
|
@@ -147,19 +148,24 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
147
148
|
if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview) && !isEditor) {
|
148
149
|
let list = [];
|
149
150
|
list = list.concat((_q = (_p = (_o = (_m = result === null || result === void 0 ? void 0 : result.data) === null || _m === void 0 ? void 0 : _m.recList) === null || _o === void 0 ? void 0 : _o.filter) === null || _p === void 0 ? void 0 : _p.call(_o, (item) => (item === null || item === void 0 ? void 0 : item.product) || (item === null || item === void 0 ? void 0 : item.video))) !== null && _q !== void 0 ? _q : []);
|
151
|
+
const isNotNullList = (_s = (_r = result === null || result === void 0 ? void 0 : result.data) === null || _r === void 0 ? void 0 : _r.recList) === null || _s === void 0 ? void 0 : _s.some((item) => (item === null || item === void 0 ? void 0 : item.product) || (item === null || item === void 0 ? void 0 : item.video));
|
152
|
+
if (!isNotNullList) {
|
153
|
+
setIsNoMoreData(true);
|
154
|
+
}
|
150
155
|
return Object.assign(Object.assign({}, result.data), { recList: list });
|
151
156
|
}
|
152
157
|
return result === null || result === void 0 ? void 0 : result.data;
|
153
158
|
}), [bffFetch, utmVal, maxSize, defaultSize, channelQueryList]);
|
154
159
|
const loadVideos = (0, react_1.useCallback)((pageNum) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
155
|
-
var
|
160
|
+
var _z, _0, _1, _2;
|
156
161
|
if (rtcList.length <= 0) {
|
157
162
|
return;
|
158
163
|
}
|
159
164
|
const lastItem = rtcList === null || rtcList === void 0 ? void 0 : rtcList[(rtcList === null || rtcList === void 0 ? void 0 : rtcList.length) - 1];
|
160
|
-
const data = yield getRecommendVideos(Object.assign(Object.assign(Object.assign(Object.assign({ hashTag: waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.hashTag }, (((
|
165
|
+
const data = yield getRecommendVideos(Object.assign(Object.assign(Object.assign(Object.assign({ hashTag: waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.hashTag }, (((_z = lastItem === null || lastItem === void 0 ? void 0 : lastItem.product) === null || _z === void 0 ? void 0 : _z.itemId) && { productFilter: (_0 = lastItem === null || lastItem === void 0 ? void 0 : lastItem.product) === null || _0 === void 0 ? void 0 : _0.itemId })), (((_1 = lastItem === null || lastItem === void 0 ? void 0 : lastItem.video) === null || _1 === void 0 ? void 0 : _1.itemId) && { contentFilter: (_2 = lastItem === null || lastItem === void 0 ? void 0 : lastItem.video) === null || _2 === void 0 ? void 0 : _2.itemId })), { themeTag: themeTag.current }), ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview) && !isEditor && { pageNum })));
|
161
166
|
setRtcList(rtcList.concat(getFilterRecList(data)));
|
162
167
|
setCacheRtcList(cacheRtcList.concat(getFilterRecList(data)));
|
168
|
+
return data;
|
163
169
|
}), [getRecommendVideos, rtcList, waterFallData, cacheRtcList]);
|
164
170
|
const bffEventReport = (0, react_1.useCallback)(({ userInfo, eventInfo }) => {
|
165
171
|
if (!enableReportEvent || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview)) {
|
@@ -199,7 +205,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
199
205
|
eventName,
|
200
206
|
actionSource,
|
201
207
|
eventSourceUrl,
|
202
|
-
userData: Object.assign(Object.assign(Object.assign({ externalId: fakeUserId }, (fbclid && { fbc: `fb.2.${new Date().getTime()}.${fbclid}` })), ((0, tool_1.getCookie)('_fbp') && { fbp: `fb.2.${new Date().getTime()}.${(0, tool_1.getCookie)('_fbp')}` })), {
|
208
|
+
userData: Object.assign(Object.assign(Object.assign({ externalId: fakeUserId }, (fbclid && { fbc: `fb.2.${new Date().getTime()}.${fbclid}` })), ((0, tool_1.getCookie)('_fbp') && { fbp: `fb.2.${new Date().getTime()}.${(0, tool_1.getCookie)('_fbp')}` })), { clientUserAgent: (_d = (_c = window === null || window === void 0 ? void 0 : window.navigator) === null || _c === void 0 ? void 0 : _c.userAgent) !== null && _d !== void 0 ? _d : '' })
|
203
209
|
},
|
204
210
|
type: 'beacon'
|
205
211
|
});
|
@@ -217,17 +223,17 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
217
223
|
return res === null || res === void 0 ? void 0 : res.success;
|
218
224
|
}), [bffFetch]);
|
219
225
|
const bffGetTagList = (0, react_1.useCallback)(() => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
220
|
-
var
|
226
|
+
var _3, _4, _5, _6, _7;
|
221
227
|
if (!utmVal || !isShowTag)
|
222
228
|
return;
|
223
229
|
try {
|
224
|
-
const val = (
|
230
|
+
const val = (_5 = (_4 = (_3 = utmVal === null || utmVal === void 0 ? void 0 : utmVal.split('&')) === null || _3 === void 0 ? void 0 : _3.filter((val) => {
|
225
231
|
var _a, _b;
|
226
232
|
const key = val.split('=')[0];
|
227
233
|
return (_b = ((_a = utmParameter === null || utmParameter === void 0 ? void 0 : utmParameter.channels) !== null && _a !== void 0 ? _a : [])) === null || _b === void 0 ? void 0 : _b.includes(key);
|
228
|
-
})) === null ||
|
234
|
+
})) === null || _4 === void 0 ? void 0 : _4.join('&')) !== null && _5 !== void 0 ? _5 : '';
|
229
235
|
const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/tag/list', { method: 'GET', query: { channel: decodeURIComponent(val) } }));
|
230
|
-
setTagList((
|
236
|
+
setTagList((_7 = (_6 = result === null || result === void 0 ? void 0 : result.data) === null || _6 === void 0 ? void 0 : _6.tags) !== null && _7 !== void 0 ? _7 : []);
|
231
237
|
}
|
232
238
|
catch (e) {
|
233
239
|
console.log('e', e);
|
@@ -374,7 +380,8 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
374
380
|
globalConfig,
|
375
381
|
popupCurTimeRef,
|
376
382
|
checkCommodityIndexRef,
|
377
|
-
isEditor
|
383
|
+
isEditor,
|
384
|
+
isNoMoreData
|
378
385
|
} }, isShowConsent ? (react_1.default.createElement(Consent_1.default, Object.assign({}, (_c = (_b = (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.consent) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.item) === null || _c === void 0 ? void 0 : _c.props))) : (render({
|
379
386
|
rtcList,
|
380
387
|
mutateLike: bffMutateLike,
|
@@ -7,7 +7,7 @@ const SxpDataSourceProvider_1 = require("../context/SxpDataSourceProvider");
|
|
7
7
|
function useEventReport() {
|
8
8
|
const { bffEventReport, popupDetailData, waterFallData, isFromHashtag } = (0, useSxpDataSource_1.useSxpDataSource)();
|
9
9
|
const jumpToWeb = (0, react_1.useCallback)((data, product, cta, position, traceInfo) => {
|
10
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9;
|
10
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13;
|
11
11
|
let fromKName = '';
|
12
12
|
if (popupDetailData && (((_b = (_a = data === null || data === void 0 ? void 0 : data.video) === null || _a === void 0 ? void 0 : _a.bindProducts) === null || _b === void 0 ? void 0 : _b.length) || ((_c = data === null || data === void 0 ? void 0 : data.video) === null || _c === void 0 ? void 0 : _c.bindProduct))) {
|
13
13
|
fromKName = 'pdpPage';
|
@@ -25,22 +25,15 @@ function useEventReport() {
|
|
25
25
|
fromKName = 'productPage';
|
26
26
|
}
|
27
27
|
const contentTags = (_p = (_m = (_h = product === null || product === void 0 ? void 0 : product.tags) !== null && _h !== void 0 ? _h : (_l = (_k = (_j = data === null || data === void 0 ? void 0 : data.video) === null || _j === void 0 ? void 0 : _j.bindProducts) === null || _k === void 0 ? void 0 : _k[0]) === null || _l === void 0 ? void 0 : _l.tags) !== null && _m !== void 0 ? _m : (_o = data === null || data === void 0 ? void 0 : data.video) === null || _o === void 0 ? void 0 : _o.tags) !== null && _p !== void 0 ? _p : (_q = data === null || data === void 0 ? void 0 : data.product) === null || _q === void 0 ? void 0 : _q.tags;
|
28
|
+
let contentFormat = null;
|
29
|
+
if ((_r = data === null || data === void 0 ? void 0 : data.video) === null || _r === void 0 ? void 0 : _r.url) {
|
30
|
+
contentFormat = 'video';
|
31
|
+
}
|
32
|
+
else if (((_s = data === null || data === void 0 ? void 0 : data.video) === null || _s === void 0 ? void 0 : _s.imgUrls) && ((_u = (_t = data === null || data === void 0 ? void 0 : data.video) === null || _t === void 0 ? void 0 : _t.imgUrls) === null || _u === void 0 ? void 0 : _u.length)) {
|
33
|
+
contentFormat = 'image';
|
34
|
+
}
|
28
35
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
29
|
-
eventInfo: {
|
30
|
-
eventSubject: 'jumpToWeb',
|
31
|
-
eventDescription: 'User jumped to website',
|
32
|
-
productId: (_r = product === null || product === void 0 ? void 0 : product.itemId) !== null && _r !== void 0 ? _r : '',
|
33
|
-
productName: (_s = product === null || product === void 0 ? void 0 : product.title) !== null && _s !== void 0 ? _s : '',
|
34
|
-
price: (product === null || product === void 0 ? void 0 : product.price) ? (product === null || product === void 0 ? void 0 : product.price) + '' : '0',
|
35
|
-
productCollection: (_t = product === null || product === void 0 ? void 0 : product.collection) !== null && _t !== void 0 ? _t : '',
|
36
|
-
fromKName,
|
37
|
-
fromKPage: location === null || location === void 0 ? void 0 : location.href,
|
38
|
-
contentTags: contentTags ? JSON.stringify(contentTags) : '',
|
39
|
-
position: position + '',
|
40
|
-
contentId: (_v = (_u = data === null || data === void 0 ? void 0 : data.video) === null || _u === void 0 ? void 0 : _u.itemId) !== null && _v !== void 0 ? _v : '',
|
41
|
-
ctatId: (_w = cta === null || cta === void 0 ? void 0 : cta.itemId) !== null && _w !== void 0 ? _w : '',
|
42
|
-
traceInfo: (_9 = (_6 = (_4 = (_0 = (_x = traceInfo !== null && traceInfo !== void 0 ? traceInfo : product === null || product === void 0 ? void 0 : product.traceInfo) !== null && _x !== void 0 ? _x : (_z = (_y = data === null || data === void 0 ? void 0 : data.video) === null || _y === void 0 ? void 0 : _y.bindProduct) === null || _z === void 0 ? void 0 : _z.traceInfo) !== null && _0 !== void 0 ? _0 : (_3 = (_2 = (_1 = data === null || data === void 0 ? void 0 : data.video) === null || _1 === void 0 ? void 0 : _1.bindProducts) === null || _2 === void 0 ? void 0 : _2[0]) === null || _3 === void 0 ? void 0 : _3.traceInfo) !== null && _4 !== void 0 ? _4 : (_5 = data === null || data === void 0 ? void 0 : data.product) === null || _5 === void 0 ? void 0 : _5.traceInfo) !== null && _6 !== void 0 ? _6 : (_8 = (_7 = data === null || data === void 0 ? void 0 : data.video) === null || _7 === void 0 ? void 0 : _7.bindCta) === null || _8 === void 0 ? void 0 : _8.traceInfo) !== null && _9 !== void 0 ? _9 : ''
|
43
|
-
}
|
36
|
+
eventInfo: Object.assign({ eventSubject: 'jumpToWeb', eventDescription: 'User jumped to website', productId: (_v = product === null || product === void 0 ? void 0 : product.itemId) !== null && _v !== void 0 ? _v : '', productName: (_w = product === null || product === void 0 ? void 0 : product.title) !== null && _w !== void 0 ? _w : '', price: (product === null || product === void 0 ? void 0 : product.price) ? (product === null || product === void 0 ? void 0 : product.price) + '' : '0', productCollection: (_x = product === null || product === void 0 ? void 0 : product.collection) !== null && _x !== void 0 ? _x : '', fromKName, fromKPage: location === null || location === void 0 ? void 0 : location.href, contentTags: contentTags ? JSON.stringify(contentTags) : '', position: position + '', contentId: (_z = (_y = data === null || data === void 0 ? void 0 : data.video) === null || _y === void 0 ? void 0 : _y.itemId) !== null && _z !== void 0 ? _z : '', ctatId: (_0 = cta === null || cta === void 0 ? void 0 : cta.itemId) !== null && _0 !== void 0 ? _0 : '', traceInfo: (_13 = (_10 = (_8 = (_4 = (_1 = traceInfo !== null && traceInfo !== void 0 ? traceInfo : product === null || product === void 0 ? void 0 : product.traceInfo) !== null && _1 !== void 0 ? _1 : (_3 = (_2 = data === null || data === void 0 ? void 0 : data.video) === null || _2 === void 0 ? void 0 : _2.bindProduct) === null || _3 === void 0 ? void 0 : _3.traceInfo) !== null && _4 !== void 0 ? _4 : (_7 = (_6 = (_5 = data === null || data === void 0 ? void 0 : data.video) === null || _5 === void 0 ? void 0 : _5.bindProducts) === null || _6 === void 0 ? void 0 : _6[0]) === null || _7 === void 0 ? void 0 : _7.traceInfo) !== null && _8 !== void 0 ? _8 : (_9 = data === null || data === void 0 ? void 0 : data.product) === null || _9 === void 0 ? void 0 : _9.traceInfo) !== null && _10 !== void 0 ? _10 : (_12 = (_11 = data === null || data === void 0 ? void 0 : data.video) === null || _11 === void 0 ? void 0 : _11.bindCta) === null || _12 === void 0 ? void 0 : _12.traceInfo) !== null && _13 !== void 0 ? _13 : '' }, (contentFormat && { contentFormat }))
|
44
37
|
});
|
45
38
|
}, [bffEventReport, popupDetailData, isFromHashtag]);
|
46
39
|
const productView = (0, react_1.useCallback)((data, product, cta, viewTime, position) => {
|
@@ -6,6 +6,6 @@ const react_2 = tslib_1.__importDefault(require("react"));
|
|
6
6
|
const Form = ({ layout, columns, onChange }) => {
|
7
7
|
return (react_2.default.createElement(react_2.default.Fragment, null, columns === null || columns === void 0 ? void 0 : columns.map((item, index) => (react_2.default.createElement("div", { key: index, className: 'pb-appoint-form-container-item', style: { flexDirection: layout === 'horizontal' ? 'row' : 'column' } },
|
8
8
|
layout !== 'inline' && react_2.default.createElement("label", { className: 'pb-appoint-form-container-label' }, item === null || item === void 0 ? void 0 : item.title),
|
9
|
-
(item === null || item === void 0 ? void 0 : item.valueType) === 'text' && (react_2.default.createElement("input", Object.assign({ className: 'pb-appoint-form-container-input', type: 'text', placeholder: layout === 'inline' ? item === null || item === void 0 ? void 0 : item.title : '请输入', name: item === null || item === void 0 ? void 0 : item.dataIndex }, (onChange && { onChange
|
9
|
+
(item === null || item === void 0 ? void 0 : item.valueType) === 'text' && (react_2.default.createElement("input", Object.assign({ className: 'pb-appoint-form-container-input', type: 'text', placeholder: layout === 'inline' ? item === null || item === void 0 ? void 0 : item.title : '请输入', name: item === null || item === void 0 ? void 0 : item.dataIndex }, (onChange && { onChange })))))))));
|
10
10
|
};
|
11
11
|
exports.default = (0, react_1.memo)(Form);
|
@@ -10,10 +10,13 @@ const useEventReport_1 = require("../../../../core/hooks/useEventReport");
|
|
10
10
|
const tool_1 = require("../../../../core/utils/tool");
|
11
11
|
const Form_1 = tslib_1.__importDefault(require("./Form"));
|
12
12
|
const AppointForm = (_a) => {
|
13
|
+
var _b, _c;
|
13
14
|
var { columns, style, title, textStyle, submitBgColor, submitColor, submitText, layoutType = 'inline', isExternalLink, isPopup, onClick, onClose, submitButtonStyle } = _a, props = tslib_1.__rest(_a, ["columns", "style", "title", "textStyle", "submitBgColor", "submitColor", "submitText", "layoutType", "isExternalLink", "isPopup", "onClick", "onClose", "submitButtonStyle"]);
|
14
15
|
const { submitForm, popupDetailData } = (0, hooks_1.useSxpDataSource)();
|
15
16
|
const { jumpToWeb } = (0, useEventReport_1.useEventReport)();
|
16
17
|
const [loading, setLoading] = (0, react_1.useState)(false);
|
18
|
+
const [formData, setFormData] = (0, react_1.useState)({});
|
19
|
+
const [marginTop, setMarginTop] = (0, react_1.useState)(0);
|
17
20
|
const defaultColumns = (0, react_1.useMemo)(() => [
|
18
21
|
{
|
19
22
|
title: '',
|
@@ -40,7 +43,7 @@ const AppointForm = (_a) => {
|
|
40
43
|
key: '4'
|
41
44
|
}
|
42
45
|
], []);
|
43
|
-
const
|
46
|
+
const originalHeight = ((_b = document === null || document === void 0 ? void 0 : document.documentElement) === null || _b === void 0 ? void 0 : _b.clientHeight) || ((_c = document === null || document === void 0 ? void 0 : document.body) === null || _c === void 0 ? void 0 : _c.clientHeight);
|
44
47
|
const columnsData = (0, react_1.useMemo)(() => {
|
45
48
|
return (0, lodash_1.cloneDeep)(columns) || defaultColumns;
|
46
49
|
}, [columns, defaultColumns]);
|
@@ -49,17 +52,17 @@ const AppointForm = (_a) => {
|
|
49
52
|
setFormData(Object.assign(Object.assign({}, formData), { [name]: value }));
|
50
53
|
}, [formData]);
|
51
54
|
const handleSubmit = (0, lodash_1.debounce)(() => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
52
|
-
var
|
55
|
+
var _d, _e, _f, _g, _h;
|
53
56
|
const vals = formData;
|
54
57
|
if (!vals)
|
55
58
|
return;
|
56
|
-
const arr = (
|
59
|
+
const arr = (_e = (_d = Object.keys(vals)) === null || _d === void 0 ? void 0 : _d.map((key) => {
|
57
60
|
var _a;
|
58
61
|
return ({
|
59
62
|
name: key,
|
60
63
|
value: (_a = vals[key]) !== null && _a !== void 0 ? _a : ''
|
61
64
|
});
|
62
|
-
})) === null ||
|
65
|
+
})) === null || _e === void 0 ? void 0 : _e.filter((item) => item === null || item === void 0 ? void 0 : item.value);
|
63
66
|
if (!arr || !(arr === null || arr === void 0 ? void 0 : arr.length))
|
64
67
|
return;
|
65
68
|
setLoading(true);
|
@@ -68,8 +71,8 @@ const AppointForm = (_a) => {
|
|
68
71
|
if (res) {
|
69
72
|
if (isExternalLink) {
|
70
73
|
const data = popupDetailData;
|
71
|
-
const product = (
|
72
|
-
const cta = (
|
74
|
+
const product = (_f = data === null || data === void 0 ? void 0 : data.video) === null || _f === void 0 ? void 0 : _f.bindProduct;
|
75
|
+
const cta = (_h = (_g = data === null || data === void 0 ? void 0 : data.video) === null || _g === void 0 ? void 0 : _g.bindProduct) === null || _h === void 0 ? void 0 : _h.bindCta;
|
73
76
|
const position = popupDetailData === null || popupDetailData === void 0 ? void 0 : popupDetailData.index;
|
74
77
|
jumpToWeb(data, product, cta, position);
|
75
78
|
}
|
@@ -79,11 +82,31 @@ const AppointForm = (_a) => {
|
|
79
82
|
onClick === null || onClick === void 0 ? void 0 : onClick();
|
80
83
|
}
|
81
84
|
}), 1000);
|
85
|
+
(0, react_1.useEffect)(() => {
|
86
|
+
const handleScroll = () => {
|
87
|
+
var _a, _b;
|
88
|
+
const userAgent = navigator.userAgent;
|
89
|
+
const isAndroid = userAgent.toLowerCase().includes('android');
|
90
|
+
if (!isAndroid)
|
91
|
+
return;
|
92
|
+
const resizeHeight = ((_a = document === null || document === void 0 ? void 0 : document.documentElement) === null || _a === void 0 ? void 0 : _a.clientHeight) || ((_b = document === null || document === void 0 ? void 0 : document.body) === null || _b === void 0 ? void 0 : _b.clientHeight);
|
93
|
+
if (resizeHeight < originalHeight) {
|
94
|
+
setMarginTop(50);
|
95
|
+
}
|
96
|
+
else {
|
97
|
+
setMarginTop(0);
|
98
|
+
}
|
99
|
+
};
|
100
|
+
window.addEventListener('resize', handleScroll);
|
101
|
+
return () => {
|
102
|
+
window.removeEventListener('resize', handleScroll);
|
103
|
+
};
|
104
|
+
}, []);
|
82
105
|
return (react_1.default.createElement("div", { className: 'pb-appoint-form' },
|
83
106
|
react_1.default.createElement("div", { className: `pb-appoint-form-title ${(0, css_1.css)(Object.assign({}, textStyle))}`, dangerouslySetInnerHTML: {
|
84
107
|
__html: (0, tool_1.setFontForText)(title, textStyle)
|
85
108
|
} }),
|
86
|
-
react_1.default.createElement("div", Object.assign({ className: (0, css_1.css)(Object.assign({}, style)) }, props),
|
109
|
+
react_1.default.createElement("div", Object.assign({ className: (0, css_1.css)(Object.assign(Object.assign({}, style), { marginTop })) }, props),
|
87
110
|
react_1.default.createElement("div", { className: 'pb-appoint-form-container' },
|
88
111
|
react_1.default.createElement(Form_1.default, { columns: columnsData, layout: layoutType, onChange: handleChange }))),
|
89
112
|
react_1.default.createElement("div", { className: 'pb-appoint-form-btn-wrapper' },
|
@@ -21,6 +21,9 @@ export interface ICommodityDetailProps {
|
|
21
21
|
dotsAlign: 'left' | 'center' | 'right';
|
22
22
|
delay: number;
|
23
23
|
translateY?: number;
|
24
|
+
dotsBgColor?: string;
|
25
|
+
dotsActiveColor?: string;
|
26
|
+
dotsMarginBottom?: number;
|
24
27
|
};
|
25
28
|
commodityStyles?: {
|
26
29
|
title: CSSProperties;
|