pb-sxp-ui 1.0.43 → 1.0.45
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 +490 -58
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +56 -4
- package/dist/index.js +489 -58
- package/dist/index.js.map +1 -1
- package/dist/index.min.cjs +4 -3
- package/dist/index.min.cjs.map +1 -1
- package/dist/index.min.js +4 -3
- package/dist/index.min.js.map +1 -1
- package/dist/pb-ui.js +493 -62
- package/dist/pb-ui.js.map +1 -1
- package/dist/pb-ui.min.js +4 -3
- package/dist/pb-ui.min.js.map +1 -1
- package/es/core/components/DiyPortalPreview/PictureGroup.d.ts +13 -0
- package/es/core/components/DiyPortalPreview/PictureGroup.js +11 -0
- package/es/core/components/DiyPortalPreview/VideoWidget.d.ts +15 -0
- package/es/core/components/DiyPortalPreview/VideoWidget.js +236 -0
- package/es/core/components/DiyPortalPreview/index.d.ts +6 -0
- package/es/core/components/DiyPortalPreview/index.js +127 -0
- package/es/core/components/SxpPageCore/index.js +2 -2
- package/es/core/components/SxpPageRender/Nudge/index.js +6 -5
- package/es/core/components/SxpPageRender/Tagbar.d.ts +7 -0
- package/es/core/components/SxpPageRender/Tagbar.js +37 -0
- package/es/core/components/SxpPageRender/WaterFall/index.js +1 -1
- package/es/core/components/SxpPageRender/index.d.ts +2 -0
- package/es/core/components/SxpPageRender/index.js +21 -12
- package/es/core/context/SxpDataSourceProvider.d.ts +3 -0
- package/es/core/context/SxpDataSourceProvider.js +28 -4
- package/es/core/hooks/useEventReport.js +4 -4
- package/es/index.d.ts +1 -0
- package/es/index.js +1 -0
- package/es/materials/sxp/popup/CommodityDetail/index.js +6 -6
- package/es/materials/sxp/popup/CommodityDetailDiroNew/index.js +9 -9
- package/lib/core/components/DiyPortalPreview/PictureGroup.d.ts +13 -0
- package/lib/core/components/DiyPortalPreview/PictureGroup.js +14 -0
- package/lib/core/components/DiyPortalPreview/VideoWidget.d.ts +15 -0
- package/lib/core/components/DiyPortalPreview/VideoWidget.js +239 -0
- package/lib/core/components/DiyPortalPreview/index.d.ts +6 -0
- package/lib/core/components/DiyPortalPreview/index.js +130 -0
- package/lib/core/components/SxpPageCore/index.js +2 -2
- package/lib/core/components/SxpPageRender/Nudge/index.js +6 -5
- package/lib/core/components/SxpPageRender/Tagbar.d.ts +7 -0
- package/lib/core/components/SxpPageRender/Tagbar.js +40 -0
- package/lib/core/components/SxpPageRender/WaterFall/index.js +1 -1
- package/lib/core/components/SxpPageRender/index.d.ts +2 -0
- package/lib/core/components/SxpPageRender/index.js +21 -12
- package/lib/core/context/SxpDataSourceProvider.d.ts +3 -0
- package/lib/core/context/SxpDataSourceProvider.js +28 -4
- package/lib/core/hooks/useEventReport.js +4 -4
- package/lib/index.d.ts +1 -0
- package/lib/index.js +3 -1
- package/lib/materials/sxp/popup/CommodityDetail/index.js +6 -6
- package/lib/materials/sxp/popup/CommodityDetailDiroNew/index.js +9 -9
- package/package.json +2 -1
@@ -0,0 +1,130 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
const tslib_1 = require("tslib");
|
4
|
+
const react_1 = tslib_1.__importStar(require("react"));
|
5
|
+
const Nudge_1 = tslib_1.__importDefault(require("../SxpPageRender/Nudge"));
|
6
|
+
const RenderCard_1 = tslib_1.__importDefault(require("../SxpPageRender/RenderCard"));
|
7
|
+
const ExpandableText_1 = tslib_1.__importDefault(require("../SxpPageRender/ExpandableText"));
|
8
|
+
const Hashtag_1 = tslib_1.__importDefault(require("../SxpPageRender/Hashtag"));
|
9
|
+
const LikeButton_1 = tslib_1.__importDefault(require("../SxpPageRender/LikeButton"));
|
10
|
+
const ToggleButton_1 = tslib_1.__importDefault(require("../SxpPageRender/ToggleButton"));
|
11
|
+
const useIconLink_1 = require("../SxpPageRender/useIconLink");
|
12
|
+
const Tagbar_1 = tslib_1.__importDefault(require("../SxpPageRender/Tagbar"));
|
13
|
+
const PictureGroup_1 = tslib_1.__importDefault(require("./PictureGroup"));
|
14
|
+
const VideoWidget_1 = tslib_1.__importDefault(require("./VideoWidget"));
|
15
|
+
const _materials_ = tslib_1.__importStar(require("../../../materials"));
|
16
|
+
const withBindDataSource_1 = tslib_1.__importDefault(require("../../../core/hoc/withBindDataSource"));
|
17
|
+
const RESOLVER = {};
|
18
|
+
Object.values(_materials_).forEach((v) => {
|
19
|
+
RESOLVER[v.extend.type] = v;
|
20
|
+
});
|
21
|
+
const defaultUnLikeIconPath = '/pb_static/f71266d2c64446c5ae6a5a7f5489cc0a.png';
|
22
|
+
const defaultLikeIconPath = '/pb_static/f07900fe3f0f4ae188ea1611d4801a44.png';
|
23
|
+
const DiyPortalPreview = ({ data = [], globalConfig, tipText, nudge, tempMap, descStyle, hashTagStyle, containerHeight = 664, containerWidth = 375, appDomain, tagList = [] }) => {
|
24
|
+
const height = (0, react_1.useMemo)(() => {
|
25
|
+
let minusHeight = 0;
|
26
|
+
if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.logoUrl) && (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowLogo)) {
|
27
|
+
minusHeight += 45;
|
28
|
+
}
|
29
|
+
if (tagList.length > 0) {
|
30
|
+
minusHeight += 45;
|
31
|
+
}
|
32
|
+
return containerHeight - minusHeight;
|
33
|
+
}, [globalConfig, containerHeight, tagList]);
|
34
|
+
const renderContent = (rec, index) => {
|
35
|
+
var _a, _b, _c, _d;
|
36
|
+
if ((_a = rec.video) === null || _a === void 0 ? void 0 : _a.url) {
|
37
|
+
return (react_1.default.createElement(VideoWidget_1.default, { rec: rec, index: index, muted: true, width: containerWidth, data: data !== null && data !== void 0 ? data : [], height: height, activeIndex: index, videoPostConfig: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.videoPost }));
|
38
|
+
}
|
39
|
+
if ((_b = rec.video) === null || _b === void 0 ? void 0 : _b.imgUrls) {
|
40
|
+
return (react_1.default.createElement(PictureGroup_1.default, { key: rec.video.itemId, imgUrls: rec.video.imgUrls, width: containerWidth, height: height, rec: rec, index: index, imgUrlsPostConfig: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.imgUrlsPost }));
|
41
|
+
}
|
42
|
+
if (rec.product) {
|
43
|
+
if (rec.product && Array.isArray(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.productPost) && ((_c = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.productPost) === null || _c === void 0 ? void 0 : _c.length) > 0) {
|
44
|
+
return (_d = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.productPost) === null || _d === void 0 ? void 0 : _d.map((value, idx) => {
|
45
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
46
|
+
const t = RESOLVER[(_a = value === null || value === void 0 ? void 0 : value.item) === null || _a === void 0 ? void 0 : _a.type];
|
47
|
+
const Component = (0, withBindDataSource_1.default)(t);
|
48
|
+
const defaulSetting = (_b = t === null || t === void 0 ? void 0 : t.extend) === null || _b === void 0 ? void 0 : _b.defaulSetting;
|
49
|
+
return (react_1.default.createElement(Component, Object.assign({ key: `${index}${idx}`, textStyle: Object.assign(Object.assign({}, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.textStyle), (_c = value === null || value === void 0 ? void 0 : value.item) === null || _c === void 0 ? void 0 : _c.textStyle), bindDatas: (_e = (_d = value === null || value === void 0 ? void 0 : value.item) === null || _d === void 0 ? void 0 : _d.bindDatas) !== null && _e !== void 0 ? _e : [] }, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.props, (_f = value === null || value === void 0 ? void 0 : value.item) === null || _f === void 0 ? void 0 : _f.props, { event: ((_g = value === null || value === void 0 ? void 0 : value.item) === null || _g === void 0 ? void 0 : _g.event) || {}, id: value === null || value === void 0 ? void 0 : value.id, rec: rec, isPost: true, tipText: tipText, style: Object.assign(Object.assign(Object.assign({}, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.style), (_h = value === null || value === void 0 ? void 0 : value.item) === null || _h === void 0 ? void 0 : _h.style), { width: containerWidth, height, overflow: 'auto' }), index: index })));
|
50
|
+
});
|
51
|
+
}
|
52
|
+
}
|
53
|
+
};
|
54
|
+
const renderLogo = (0, react_1.useMemo)(() => {
|
55
|
+
if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.logoUrl) && (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowLogo)) {
|
56
|
+
return (react_1.default.createElement("div", { className: 'clc-sxp-logo-banner', style: { backgroundColor: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.color } },
|
57
|
+
react_1.default.createElement("img", { src: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.logoUrl, alt: 'logo' })));
|
58
|
+
}
|
59
|
+
return null;
|
60
|
+
}, [globalConfig]);
|
61
|
+
const CTA = (rec, index) => {
|
62
|
+
if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowCTA) === undefined || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowCTA)) {
|
63
|
+
return (react_1.default.createElement("div", { className: 'clc-sxp-bottom-card' },
|
64
|
+
react_1.default.createElement(RenderCard_1.default, { rec: rec, index: index, tempMap: tempMap, resolver: RESOLVER })));
|
65
|
+
}
|
66
|
+
return null;
|
67
|
+
};
|
68
|
+
const renderBottom = (rec, index) => {
|
69
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
70
|
+
if (rec.video) {
|
71
|
+
return (react_1.default.createElement(react_1.default.Fragment, null,
|
72
|
+
((_a = rec.video) === null || _a === void 0 ? void 0 : _a.title) && react_1.default.createElement("div", { className: 'clc-sxp-bottom-shadow' }),
|
73
|
+
react_1.default.createElement("div", { className: 'clc-sxp-bottom' },
|
74
|
+
react_1.default.createElement(Nudge_1.default, { nudge: nudge }),
|
75
|
+
CTA(rec, index),
|
76
|
+
react_1.default.createElement("div", null,
|
77
|
+
react_1.default.createElement(ExpandableText_1.default, { className: 'clc-sxp-bottom-text', isPost: true, foldText: tipText === null || tipText === void 0 ? void 0 : tipText.foldText, unfoldText: tipText === null || tipText === void 0 ? void 0 : tipText.unfoldText, text: (_c = (_b = rec.video) === null || _b === void 0 ? void 0 : _b.title) !== null && _c !== void 0 ? _c : '', style: Object.assign(Object.assign({}, descStyle), { textShadow: (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isOpenTextShadow) ? '2px 2px 4px rgba(0, 0, 0, 0.5)' : 'none' }) })),
|
78
|
+
react_1.default.createElement(Hashtag_1.default, { index: index, tags: (_e = (_d = rec === null || rec === void 0 ? void 0 : rec.video) === null || _d === void 0 ? void 0 : _d.hashTags) !== null && _e !== void 0 ? _e : [], itemId: (_f = rec === null || rec === void 0 ? void 0 : rec.video) === null || _f === void 0 ? void 0 : _f.itemId, itemType: ((_g = rec.video) === null || _g === void 0 ? void 0 : _g.itemId) ? 'VIDEO' : null, rec: rec, hashTagStyle: hashTagStyle }))));
|
79
|
+
}
|
80
|
+
return null;
|
81
|
+
};
|
82
|
+
const likeIcon = (0, useIconLink_1.useIconLink)(defaultLikeIconPath, appDomain);
|
83
|
+
const unlikeIcon = (0, useIconLink_1.useIconLink)(defaultUnLikeIconPath, appDomain);
|
84
|
+
const renderLikeButton = (rec, index) => {
|
85
|
+
var _a, _b, _c, _d;
|
86
|
+
if (!(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowLike))
|
87
|
+
return;
|
88
|
+
let top = (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIconY) !== null && _a !== void 0 ? _a : 400;
|
89
|
+
if (top < 40) {
|
90
|
+
top += 40;
|
91
|
+
}
|
92
|
+
if (rec.video) {
|
93
|
+
return (react_1.default.createElement(LikeButton_1.default, { key: rec.position, activeIcon: (_b = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIcon) !== null && _b !== void 0 ? _b : likeIcon, unActicveIcon: (_c = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.unlikeIcon) !== null && _c !== void 0 ? _c : unlikeIcon, position: index, active: rec.isCollected, recData: rec, className: 'clc-sxp-like-button', style: {
|
94
|
+
top,
|
95
|
+
right: (_d = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIconX) !== null && _d !== void 0 ? _d : 0
|
96
|
+
} }));
|
97
|
+
}
|
98
|
+
return null;
|
99
|
+
};
|
100
|
+
const mutedIcon = (0, useIconLink_1.useIconLink)('/pb_static/5beaaa5ce7f3477b99db3838619cc471.png', appDomain);
|
101
|
+
const unmutedIcon = (0, useIconLink_1.useIconLink)('/pb_static/fea8668a8a894e4aa3a86bcc775e895e.png', appDomain);
|
102
|
+
const renderView = (rec, index) => {
|
103
|
+
var _a, _b, _c, _d;
|
104
|
+
return (react_1.default.createElement("div", { style: { position: 'relative', border: '1px solid #e1e1e1' } },
|
105
|
+
renderLogo,
|
106
|
+
react_1.default.createElement(Tagbar_1.default, { tagList: tagList }),
|
107
|
+
react_1.default.createElement(ToggleButton_1.default, { style: {
|
108
|
+
position: 'absolute',
|
109
|
+
right: (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconX) !== null && _a !== void 0 ? _a : 0,
|
110
|
+
visibility: ((_c = (_b = data === null || data === void 0 ? void 0 : data[index]) === null || _b === void 0 ? void 0 : _b.video) === null || _c === void 0 ? void 0 : _c.url) ? 'visible' : 'hidden',
|
111
|
+
bottom: (_d = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconY) !== null && _d !== void 0 ? _d : 23,
|
112
|
+
zIndex: 999
|
113
|
+
}, defaultValue: true, activeIcon: (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.unMuteIcon) ? globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.unMuteIcon : mutedIcon, unactiveIcon: (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIcon) ? globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIcon : unmutedIcon }),
|
114
|
+
renderContent(rec, index),
|
115
|
+
renderBottom(rec, index),
|
116
|
+
renderLikeButton(rec, index)));
|
117
|
+
};
|
118
|
+
return (react_1.default.createElement("div", { style: {
|
119
|
+
width: '100%',
|
120
|
+
height: containerHeight,
|
121
|
+
display: 'flex',
|
122
|
+
boxSizing: 'border-box',
|
123
|
+
gap: 16,
|
124
|
+
pointerEvents: 'none',
|
125
|
+
userSelect: 'none'
|
126
|
+
} }, data === null || data === void 0 ? void 0 : data.map((rec, index) => {
|
127
|
+
return renderView(rec, index);
|
128
|
+
})));
|
129
|
+
};
|
130
|
+
exports.default = (0, react_1.memo)(DiyPortalPreview);
|
@@ -19,10 +19,10 @@ const SxpPageCore = ({ data, maxSize = 10, defaultSize = 10, hashTagSize = 20, l
|
|
19
19
|
return searchParams;
|
20
20
|
}, []);
|
21
21
|
return (react_1.default.createElement(core_1.EditorCore, { resolver: RESOLVER, enableDataSource: false, schema: data === null || data === void 0 ? void 0 : data.data, utmVal: utmVal },
|
22
|
-
react_1.default.createElement(SxpDataSourceProvider_1.default, { utmVal: utmVal, dataSources: data === null || data === void 0 ? void 0 : data.data_sources, sxpParameter: data === null || data === void 0 ? void 0 : data.sxp_parameter, maxSize: (_b = (_a = data === null || data === void 0 ? void 0 : data.sxp_parameter) === null || _a === void 0 ? void 0 : _a.personalized_recommend) !== null && _b !== void 0 ? _b : maxSize, defaultSize: (_d = (_c = data === null || data === void 0 ? void 0 : data.sxp_parameter) === null || _c === void 0 ? void 0 : _c.default_recommend) !== null && _d !== void 0 ? _d : defaultSize, hashTagSize: (_f = (_e = data === null || data === void 0 ? void 0 : data.sxp_parameter) === null || _e === void 0 ? void 0 : _e.hash_tag_size) !== null && _f !== void 0 ? _f : hashTagSize, loadingImage: loadingImage, appDomain: appDomain, render: ({ rtcList }) => {
|
22
|
+
react_1.default.createElement(SxpDataSourceProvider_1.default, { utmVal: utmVal, dataSources: data === null || data === void 0 ? void 0 : data.data_sources, sxpParameter: data === null || data === void 0 ? void 0 : data.sxp_parameter, maxSize: (_b = (_a = data === null || data === void 0 ? void 0 : data.sxp_parameter) === null || _a === void 0 ? void 0 : _a.personalized_recommend) !== null && _b !== void 0 ? _b : maxSize, defaultSize: (_d = (_c = data === null || data === void 0 ? void 0 : data.sxp_parameter) === null || _c === void 0 ? void 0 : _c.default_recommend) !== null && _d !== void 0 ? _d : defaultSize, hashTagSize: (_f = (_e = data === null || data === void 0 ? void 0 : data.sxp_parameter) === null || _e === void 0 ? void 0 : _e.hash_tag_size) !== null && _f !== void 0 ? _f : hashTagSize, loadingImage: loadingImage, appDomain: appDomain, render: ({ rtcList, tagList }) => {
|
23
23
|
var _a;
|
24
24
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
25
|
-
react_1.default.createElement(SxpPageRender_1.default, Object.assign({}, (_a = data === null || data === void 0 ? void 0 : data.data) === null || _a === void 0 ? void 0 : _a.sxpPageConf, { data: rtcList, resolver: RESOLVER })),
|
25
|
+
react_1.default.createElement(SxpPageRender_1.default, Object.assign({}, (_a = data === null || data === void 0 ? void 0 : data.data) === null || _a === void 0 ? void 0 : _a.sxpPageConf, { tagList: tagList, data: rtcList, resolver: RESOLVER })),
|
26
26
|
react_1.default.createElement(Popup_1.default, null)));
|
27
27
|
} })));
|
28
28
|
};
|
@@ -3,14 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
4
4
|
const react_1 = tslib_1.__importDefault(require("react"));
|
5
5
|
const Nudge = ({ nudge }) => {
|
6
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
6
7
|
return (react_1.default.createElement(react_1.default.Fragment, null, (nudge === null || nudge === void 0 ? void 0 : nudge.isOpen) && (react_1.default.createElement("div", { className: 'clc-sxp-bottom-nudge', style: {
|
7
|
-
marginBottom: nudge === null || nudge === void 0 ? void 0 : nudge.marginBottom,
|
8
|
-
width: nudge === null || nudge === void 0 ? void 0 : nudge.size.width,
|
9
|
-
height: nudge === null || nudge === void 0 ? void 0 : nudge.size.height,
|
8
|
+
marginBottom: (_a = nudge === null || nudge === void 0 ? void 0 : nudge.marginBottom) !== null && _a !== void 0 ? _a : 5,
|
9
|
+
width: (_c = (_b = nudge === null || nudge === void 0 ? void 0 : nudge.size) === null || _b === void 0 ? void 0 : _b.width) !== null && _c !== void 0 ? _c : 212,
|
10
|
+
height: (_e = (_d = nudge === null || nudge === void 0 ? void 0 : nudge.size) === null || _d === void 0 ? void 0 : _d.height) !== null && _e !== void 0 ? _e : 38,
|
10
11
|
backgroundColor: nudge === null || nudge === void 0 ? void 0 : nudge.backgroundColor,
|
11
|
-
borderRadius: nudge === null || nudge === void 0 ? void 0 : nudge.borderRadius
|
12
|
+
borderRadius: (_f = nudge === null || nudge === void 0 ? void 0 : nudge.borderRadius) !== null && _f !== void 0 ? _f : 4
|
12
13
|
} },
|
13
14
|
(nudge === null || nudge === void 0 ? void 0 : nudge.icon) ? react_1.default.createElement("img", { src: nudge.icon, style: { height: '100%', objectFit: 'cover' } }) : null,
|
14
|
-
react_1.default.createElement("p", { style: Object.assign({}, nudge === null || nudge === void 0 ? void 0 : nudge.textStyle) }, nudge === null || nudge === void 0 ? void 0 : nudge.content)))));
|
15
|
+
react_1.default.createElement("p", { style: Object.assign({}, nudge === null || nudge === void 0 ? void 0 : nudge.textStyle) }, (_g = nudge === null || nudge === void 0 ? void 0 : nudge.content) !== null && _g !== void 0 ? _g : '')))));
|
15
16
|
};
|
16
17
|
exports.default = Nudge;
|
@@ -0,0 +1,40 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
const tslib_1 = require("tslib");
|
4
|
+
const react_1 = tslib_1.__importStar(require("react"));
|
5
|
+
const hooks_1 = require("../../../core/hooks");
|
6
|
+
const DEFAULT_TAG = 'FOR U';
|
7
|
+
const Tagbar = ({ tagList = [], setActiveIndex }) => {
|
8
|
+
const [selectTag, setSelectTag] = (0, react_1.useState)(DEFAULT_TAG);
|
9
|
+
const { getRecommendVideos, setRtcList, setCacheRtcList, setCacheActiveIndex, setLoading, swiperRef } = (0, hooks_1.useSxpDataSource)();
|
10
|
+
const realTagList = (0, react_1.useMemo)(() => {
|
11
|
+
return [DEFAULT_TAG, ...tagList];
|
12
|
+
}, [tagList]);
|
13
|
+
const handleSelectTag = (tag) => () => {
|
14
|
+
if (tag === selectTag)
|
15
|
+
return;
|
16
|
+
let hashTag;
|
17
|
+
if (tag !== DEFAULT_TAG) {
|
18
|
+
hashTag = tag;
|
19
|
+
}
|
20
|
+
setLoading === null || setLoading === void 0 ? void 0 : setLoading(true);
|
21
|
+
getRecommendVideos === null || getRecommendVideos === void 0 ? void 0 : getRecommendVideos({ hashTag }).then((res) => {
|
22
|
+
var _a, _b, _c, _d;
|
23
|
+
setRtcList === null || setRtcList === void 0 ? void 0 : setRtcList((_a = res === null || res === void 0 ? void 0 : res.recList) !== null && _a !== void 0 ? _a : []);
|
24
|
+
setCacheRtcList === null || setCacheRtcList === void 0 ? void 0 : setCacheRtcList((_b = res === null || res === void 0 ? void 0 : res.recList) !== null && _b !== void 0 ? _b : []);
|
25
|
+
setActiveIndex === null || setActiveIndex === void 0 ? void 0 : setActiveIndex(0);
|
26
|
+
setCacheActiveIndex === null || setCacheActiveIndex === void 0 ? void 0 : setCacheActiveIndex(0);
|
27
|
+
(_d = (_c = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _c === void 0 ? void 0 : _c.swiper) === null || _d === void 0 ? void 0 : _d.slideTo(0);
|
28
|
+
}).finally(() => {
|
29
|
+
setLoading === null || setLoading === void 0 ? void 0 : setLoading(false);
|
30
|
+
});
|
31
|
+
setSelectTag(tag);
|
32
|
+
};
|
33
|
+
if (tagList.length <= 0)
|
34
|
+
return null;
|
35
|
+
return (react_1.default.createElement("div", { className: 'clc-sxp-tagbar' },
|
36
|
+
react_1.default.createElement("ul", { className: 'clc-sxp-tagbar-list', style: { margin: 'auto', gap: 24 } }, realTagList.map((tag) => {
|
37
|
+
return (react_1.default.createElement("li", { className: `clc-sxp-tagbar-list-item ${tag === selectTag ? 'clc-sxp-tagbar-list-item-active' : ''}`, key: tag, onClick: handleSelectTag(tag) }, tag));
|
38
|
+
}))));
|
39
|
+
};
|
40
|
+
exports.default = (0, react_1.memo)(Tagbar);
|
@@ -66,7 +66,7 @@ const WaterFall = (props) => {
|
|
66
66
|
}
|
67
67
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
68
68
|
eventInfo: {
|
69
|
-
|
69
|
+
contentId: (_d = rec === null || rec === void 0 ? void 0 : rec.video) === null || _d === void 0 ? void 0 : _d.itemId,
|
70
70
|
position: cacheActiveIndex + '',
|
71
71
|
contentTags: JSON.stringify((_e = rec === null || rec === void 0 ? void 0 : rec.video) === null || _e === void 0 ? void 0 : _e.tags),
|
72
72
|
traceInfo: (_f = rec === null || rec === void 0 ? void 0 : rec.video) === null || _f === void 0 ? void 0 : _f.traceInfo,
|
@@ -9,6 +9,7 @@ export type postConfigType = {
|
|
9
9
|
export interface ISxpPageRenderProps {
|
10
10
|
globalConfig?: {
|
11
11
|
isShowLogo?: boolean;
|
12
|
+
isShowCTA?: boolean;
|
12
13
|
logoUrl?: string;
|
13
14
|
muteIcon?: string;
|
14
15
|
unMuteIcon?: string;
|
@@ -55,6 +56,7 @@ export interface ISxpPageRenderProps {
|
|
55
56
|
containerWidth?: number;
|
56
57
|
tempMap?: Record<string, any>;
|
57
58
|
data?: RecItemType[];
|
59
|
+
tagList?: string[];
|
58
60
|
resolver: any;
|
59
61
|
ctaType?: string;
|
60
62
|
_schema?: any;
|
@@ -24,7 +24,8 @@ require("./index.less");
|
|
24
24
|
const useEventReport_1 = require("../../../core/hooks/useEventReport");
|
25
25
|
const withBindDataSource_1 = tslib_1.__importDefault(require("../../../core/hoc/withBindDataSource"));
|
26
26
|
const localStore_1 = require("../../../core/utils/localStore");
|
27
|
-
const
|
27
|
+
const Tagbar_1 = tslib_1.__importDefault(require("./Tagbar"));
|
28
|
+
const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.innerHeight, containerWidth = window.innerWidth, tempMap, resolver, data = [], ctaType, tipText, nudge, _schema, hashTagStyle, tagList = [] }) => {
|
28
29
|
var _a, _b, _c, _d, _e, _f, _g;
|
29
30
|
const { schema } = (0, hooks_1.useEditor)();
|
30
31
|
const [activeIndex, setActiveIndex] = (0, react_1.useState)(0);
|
@@ -144,12 +145,12 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
144
145
|
sessionDuration: Math.floor((new Date() - curTime.current) / 1000) + '',
|
145
146
|
eventSubject: 'sessionCompleted',
|
146
147
|
eventDescription: 'Session completed',
|
147
|
-
|
148
|
-
|
148
|
+
contentId: (_l = item === null || item === void 0 ? void 0 : item.video) === null || _l === void 0 ? void 0 : _l.itemId,
|
149
|
+
productId: (_m = item === null || item === void 0 ? void 0 : item.product) === null || _m === void 0 ? void 0 : _m.itemId,
|
149
150
|
position: activeIndex + '',
|
150
151
|
fromKName,
|
151
152
|
fromKPage: location === null || location === void 0 ? void 0 : location.href,
|
152
|
-
|
153
|
+
ctatId: (_q = (_p = (_o = item.video) === null || _o === void 0 ? void 0 : _o.bindCta) === null || _p === void 0 ? void 0 : _p.itemId) !== null && _q !== void 0 ? _q : ''
|
153
154
|
}
|
154
155
|
});
|
155
156
|
}
|
@@ -165,8 +166,15 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
165
166
|
};
|
166
167
|
}, [activeIndex, bffEventReport, curTime, data, handleH5EnterLink, popupDetailData, isFromHashtag, tempMap]);
|
167
168
|
const height = (0, react_1.useMemo)(() => {
|
168
|
-
|
169
|
-
|
169
|
+
let minusHeight = 0;
|
170
|
+
if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.logoUrl) && (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowLogo)) {
|
171
|
+
minusHeight += 45;
|
172
|
+
}
|
173
|
+
if (tagList.length > 0) {
|
174
|
+
minusHeight += 45;
|
175
|
+
}
|
176
|
+
return containerHeight - minusHeight;
|
177
|
+
}, [globalConfig, containerHeight, tagList]);
|
170
178
|
const renderLogo = (0, react_1.useMemo)(() => {
|
171
179
|
if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.logoUrl) && (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowLogo)) {
|
172
180
|
return (react_1.default.createElement("div", { className: 'clc-sxp-logo-banner', style: { backgroundColor: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.color } },
|
@@ -226,8 +234,8 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
226
234
|
((_a = rec.video) === null || _a === void 0 ? void 0 : _a.title) && !isShowMore && react_1.default.createElement("div", { className: 'clc-sxp-bottom-shadow' }),
|
227
235
|
react_1.default.createElement("div", { className: 'clc-sxp-bottom' },
|
228
236
|
react_1.default.createElement(Nudge_1.default, { nudge: nudge }),
|
229
|
-
react_1.default.createElement("div", { className: 'clc-sxp-bottom-card' },
|
230
|
-
react_1.default.createElement(RenderCard_1.default, { rec: rec, index: index, tempMap: tempMap, resolver: resolver })),
|
237
|
+
(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowCTA) === undefined || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowCTA) ? (react_1.default.createElement("div", { className: 'clc-sxp-bottom-card' },
|
238
|
+
react_1.default.createElement(RenderCard_1.default, { rec: rec, index: index, tempMap: tempMap, resolver: resolver }))) : null,
|
231
239
|
react_1.default.createElement("div", null,
|
232
240
|
react_1.default.createElement(ExpandableText_1.default, { className: 'clc-sxp-bottom-text', isPost: true, foldText: tipText === null || tipText === void 0 ? void 0 : tipText.foldText, unfoldText: tipText === null || tipText === void 0 ? void 0 : tipText.unfoldText, text: (_c = (_b = rec.video) === null || _b === void 0 ? void 0 : _b.title) !== null && _c !== void 0 ? _c : '', style: Object.assign(Object.assign({}, descStyle), { textShadow: (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isOpenTextShadow) ? '2px 2px 4px rgba(0, 0, 0, 0.5)' : 'none' }), onChange: onExpandableChange }),
|
233
241
|
react_1.default.createElement(Hashtag_1.default, { index: activeIndex, tags: (_e = (_d = rec === null || rec === void 0 ? void 0 : rec.video) === null || _d === void 0 ? void 0 : _d.hashTags) !== null && _e !== void 0 ? _e : [], itemId: (_f = rec === null || rec === void 0 ? void 0 : rec.video) === null || _f === void 0 ? void 0 : _f.itemId, itemType: ((_g = rec.video) === null || _g === void 0 ? void 0 : _g.itemId) ? 'VIDEO' : null, rec: rec, hashTagStyle: hashTagStyle })))));
|
@@ -294,8 +302,8 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
294
302
|
eventInfo: {
|
295
303
|
eventSubject: 'scrollDown',
|
296
304
|
eventDescription: 'User scroll down',
|
297
|
-
|
298
|
-
|
305
|
+
contentId: (_b = (_a = item.video) === null || _a === void 0 ? void 0 : _a.itemId) !== null && _b !== void 0 ? _b : '',
|
306
|
+
productId: (_d = (_c = item.product) === null || _c === void 0 ? void 0 : _c.itemId) !== null && _d !== void 0 ? _d : '',
|
299
307
|
requestId: null
|
300
308
|
}
|
301
309
|
});
|
@@ -306,8 +314,8 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
306
314
|
eventInfo: {
|
307
315
|
eventSubject: 'scrollUp',
|
308
316
|
eventDescription: 'User scroll up',
|
309
|
-
|
310
|
-
|
317
|
+
contentId: (_f = (_e = item.video) === null || _e === void 0 ? void 0 : _e.itemId) !== null && _f !== void 0 ? _f : '',
|
318
|
+
productId: (_h = (_g = item.product) === null || _g === void 0 ? void 0 : _g.itemId) !== null && _h !== void 0 ? _h : '',
|
311
319
|
requestId: null
|
312
320
|
}
|
313
321
|
});
|
@@ -384,6 +392,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
384
392
|
setOpenHashtag === null || setOpenHashtag === void 0 ? void 0 : setOpenHashtag(true);
|
385
393
|
} })),
|
386
394
|
renderLogo,
|
395
|
+
react_1.default.createElement(Tagbar_1.default, { tagList: tagList, setActiveIndex: setActiveIndex }),
|
387
396
|
isShowFingerTip ? react_1.default.createElement(FingerSwipeTip_1.default, { imageUrl: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.swipeTipIcon }) : null,
|
388
397
|
react_1.default.createElement(react_2.Swiper, { ref: swiperRef, onSlideChange: () => {
|
389
398
|
swiperRef.current.swiper.allowTouchMove = false;
|
@@ -60,6 +60,8 @@ export interface ISxpDataSourceContext {
|
|
60
60
|
hashTagSize?: number;
|
61
61
|
loadingImage?: string;
|
62
62
|
isOpenHashTag?: boolean;
|
63
|
+
tagList: string[];
|
64
|
+
setLoading?: React.Dispatch<React.SetStateAction<boolean>>;
|
63
65
|
videoRef?: any;
|
64
66
|
setVideoRef?: React.Dispatch<React.SetStateAction<any>>;
|
65
67
|
}
|
@@ -68,6 +70,7 @@ export interface SxpDataSourceProviderProps {
|
|
68
70
|
dataSources?: DataSource[];
|
69
71
|
render: (data: {
|
70
72
|
rtcList: RecItemType[];
|
73
|
+
tagList: string[];
|
71
74
|
submitForm: (body: {
|
72
75
|
attributes: Array<{
|
73
76
|
name: string;
|
@@ -8,7 +8,8 @@ const sessionStore_1 = require("../utils/sessionStore");
|
|
8
8
|
const localStore_1 = require("../utils/localStore");
|
9
9
|
const useIconLink_1 = require("../components/SxpPageRender/useIconLink");
|
10
10
|
exports.SxpDataSourceContext = (0, react_1.createContext)({
|
11
|
-
rtcList: []
|
11
|
+
rtcList: [],
|
12
|
+
tagList: []
|
12
13
|
});
|
13
14
|
var DataSourceType;
|
14
15
|
(function (DataSourceType) {
|
@@ -17,6 +18,7 @@ var DataSourceType;
|
|
17
18
|
const UTM_KEYS = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_id', 'utm_content', 'cl_source'];
|
18
19
|
const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent = true, maxSize, defaultSize, isPreview = false, sxpParameter, appDomain, hashTagSize, loadingImage, isOpenHashTag = false }) => {
|
19
20
|
const [rtcList, setRtcList] = (0, react_1.useState)([]);
|
21
|
+
const [tagList, setTagList] = (0, react_1.useState)([]);
|
20
22
|
const [loading, setLoading] = (0, react_1.useState)(false);
|
21
23
|
const [curReqInfo, setCurReqInfo] = (0, react_1.useState)({ rtc: '', requestId: '' });
|
22
24
|
const swiperRef = (0, react_1.useRef)(null);
|
@@ -130,6 +132,18 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
130
132
|
const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/customform', { method: 'POST', body }));
|
131
133
|
return res === null || res === void 0 ? void 0 : res.success;
|
132
134
|
}), [bffFetch]);
|
135
|
+
const bffGetTagList = (0, react_1.useCallback)(() => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
136
|
+
var _g, _h;
|
137
|
+
if (!utmVal)
|
138
|
+
return;
|
139
|
+
try {
|
140
|
+
const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/tag/list', { method: 'GET', query: { channel: utmVal } }));
|
141
|
+
setTagList((_h = (_g = result === null || result === void 0 ? void 0 : result.data) === null || _g === void 0 ? void 0 : _g.tags) !== null && _h !== void 0 ? _h : []);
|
142
|
+
}
|
143
|
+
catch (e) {
|
144
|
+
console.log('e', e);
|
145
|
+
}
|
146
|
+
}), [bffFetch, utmVal]);
|
133
147
|
const ctaEvent = (0, react_1.useCallback)((eventInfo, rec, product, position) => {
|
134
148
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
135
149
|
const cta = product === null || product === void 0 ? void 0 : product.bindCta;
|
@@ -145,11 +159,12 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
145
159
|
fromKName = 'imagePage';
|
146
160
|
}
|
147
161
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
148
|
-
eventInfo: Object.assign(Object.assign({}, eventInfo), { ctaId: (_h = cta === null || cta === void 0 ? void 0 : cta.itemId) !== null && _h !== void 0 ? _h : '', ctaName: (_j = cta === null || cta === void 0 ? void 0 : cta.title) !== null && _j !== void 0 ? _j : '', contentTags: JSON.stringify(cta === null || cta === void 0 ? void 0 : cta.tags), position: position + '',
|
162
|
+
eventInfo: Object.assign(Object.assign({}, eventInfo), { ctaId: (_h = cta === null || cta === void 0 ? void 0 : cta.itemId) !== null && _h !== void 0 ? _h : '', ctaName: (_j = cta === null || cta === void 0 ? void 0 : cta.title) !== null && _j !== void 0 ? _j : '', contentTags: JSON.stringify(cta === null || cta === void 0 ? void 0 : cta.tags), position: position + '', contentId: (_l = (_k = rec === null || rec === void 0 ? void 0 : rec.video) === null || _k === void 0 ? void 0 : _k.itemId) !== null && _l !== void 0 ? _l : '', productId: isProd ? product === null || product === void 0 ? void 0 : product.itemId : '', traceInfo: (_m = cta === null || cta === void 0 ? void 0 : cta.traceInfo) !== null && _m !== void 0 ? _m : '', fromKName })
|
149
163
|
});
|
150
164
|
}, [bffEventReport, isFromHashtag]);
|
151
165
|
(0, react_1.useEffect)(() => {
|
152
166
|
setLoading(true);
|
167
|
+
bffGetTagList();
|
153
168
|
getRecommendVideos()
|
154
169
|
.then((data) => {
|
155
170
|
var _a, _b;
|
@@ -165,6 +180,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
165
180
|
if (!isInit.current)
|
166
181
|
return;
|
167
182
|
setLoading(true);
|
183
|
+
bffGetTagList();
|
168
184
|
getRecommendVideos()
|
169
185
|
.then((data) => {
|
170
186
|
var _a, _b;
|
@@ -174,7 +190,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
174
190
|
.finally(() => {
|
175
191
|
setLoading(false);
|
176
192
|
});
|
177
|
-
}, [getRecommendVideos]);
|
193
|
+
}, [getRecommendVideos, bffGetTagList]);
|
178
194
|
const defaultLoadingImage = (0, useIconLink_1.useIconLink)('/pb_static/a65d23c5893c49d7aaaa81681d3179e2.gif', appDomain);
|
179
195
|
return (react_1.default.createElement(exports.SxpDataSourceContext.Provider, { value: {
|
180
196
|
rtcList,
|
@@ -207,8 +223,16 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
207
223
|
hashTagSize,
|
208
224
|
loadingImage: loadingImage !== null && loadingImage !== void 0 ? loadingImage : defaultLoadingImage,
|
209
225
|
isOpenHashTag,
|
226
|
+
tagList,
|
227
|
+
setLoading,
|
210
228
|
videoRef,
|
211
229
|
setVideoRef
|
212
|
-
} }, render({
|
230
|
+
} }, render({
|
231
|
+
rtcList,
|
232
|
+
mutateLike: bffMutateLike,
|
233
|
+
mutateUnlike: bffMutateUnlike,
|
234
|
+
submitForm: bffSubmitForm,
|
235
|
+
tagList
|
236
|
+
})));
|
213
237
|
};
|
214
238
|
exports.default = (0, react_1.memo)(SxpDataSourceProvider);
|
@@ -35,8 +35,8 @@ function useEventReport() {
|
|
35
35
|
fromKPage: location === null || location === void 0 ? void 0 : location.href,
|
36
36
|
contentTags: (product === null || product === void 0 ? void 0 : product.tags) ? JSON.stringify(product === null || product === void 0 ? void 0 : product.tags) : '',
|
37
37
|
position: position + '',
|
38
|
-
|
39
|
-
|
38
|
+
contentId: (_m = (_l = data === null || data === void 0 ? void 0 : data.video) === null || _l === void 0 ? void 0 : _l.itemId) !== null && _m !== void 0 ? _m : '',
|
39
|
+
ctatId: (_o = cta === null || cta === void 0 ? void 0 : cta.itemId) !== null && _o !== void 0 ? _o : '',
|
40
40
|
traceInfo: (_p = product === null || product === void 0 ? void 0 : product.traceInfo) !== null && _p !== void 0 ? _p : ''
|
41
41
|
}
|
42
42
|
});
|
@@ -60,8 +60,8 @@ function useEventReport() {
|
|
60
60
|
fromKPage: location === null || location === void 0 ? void 0 : location.href,
|
61
61
|
contentTags: JSON.stringify(product === null || product === void 0 ? void 0 : product.tags),
|
62
62
|
position: position + '',
|
63
|
-
|
64
|
-
|
63
|
+
contentId: (_d = data === null || data === void 0 ? void 0 : data.video) === null || _d === void 0 ? void 0 : _d.itemId,
|
64
|
+
ctatId: cta === null || cta === void 0 ? void 0 : cta.itemId,
|
65
65
|
traceInfo: product === null || product === void 0 ? void 0 : product.traceInfo,
|
66
66
|
timeOnSite: Math.floor((new Date() - viewTime) / 1000) + '',
|
67
67
|
eventSubject: 'productView',
|
package/lib/index.d.ts
CHANGED
@@ -2,6 +2,7 @@ import { Pagebuilder } from './core/Pagebuilder';
|
|
2
2
|
export * as core from './core';
|
3
3
|
export * as materials from './materials';
|
4
4
|
export { default as SxpPageRender } from './core/components/SxpPageRender';
|
5
|
+
export { default as DiyPortalPreview } from './core/components/DiyPortalPreview';
|
5
6
|
export { default as Modal } from './core/components/SxpPageRender/Modal';
|
6
7
|
export { default as SxpDataSourceProvider } from './core/context/SxpDataSourceProvider';
|
7
8
|
export { default as SxpPageCore } from './core/components/SxpPageCore';
|
package/lib/index.js
CHANGED
@@ -1,12 +1,14 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.defaultSetting = exports.useEditorDataProvider = exports.EditorDataProvider = exports.SxpPageCore = exports.SxpDataSourceProvider = exports.Modal = exports.SxpPageRender = exports.materials = exports.core = void 0;
|
3
|
+
exports.defaultSetting = exports.useEditorDataProvider = exports.EditorDataProvider = exports.SxpPageCore = exports.SxpDataSourceProvider = exports.Modal = exports.DiyPortalPreview = exports.SxpPageRender = exports.materials = exports.core = void 0;
|
4
4
|
const tslib_1 = require("tslib");
|
5
5
|
const Pagebuilder_1 = require("./core/Pagebuilder");
|
6
6
|
exports.core = tslib_1.__importStar(require("./core"));
|
7
7
|
exports.materials = tslib_1.__importStar(require("./materials"));
|
8
8
|
var SxpPageRender_1 = require("./core/components/SxpPageRender");
|
9
9
|
Object.defineProperty(exports, "SxpPageRender", { enumerable: true, get: function () { return tslib_1.__importDefault(SxpPageRender_1).default; } });
|
10
|
+
var DiyPortalPreview_1 = require("./core/components/DiyPortalPreview");
|
11
|
+
Object.defineProperty(exports, "DiyPortalPreview", { enumerable: true, get: function () { return tslib_1.__importDefault(DiyPortalPreview_1).default; } });
|
10
12
|
var Modal_1 = require("./core/components/SxpPageRender/Modal");
|
11
13
|
Object.defineProperty(exports, "Modal", { enumerable: true, get: function () { return tslib_1.__importDefault(Modal_1).default; } });
|
12
14
|
var SxpDataSourceProvider_1 = require("./core/context/SxpDataSourceProvider");
|
@@ -12,7 +12,7 @@ const Modal_1 = tslib_1.__importDefault(require("../../../../core/components/Sxp
|
|
12
12
|
const ExpandableText_1 = tslib_1.__importDefault(require("../../../../core/components/SxpPageRender/ExpandableText"));
|
13
13
|
const FormatImage_1 = tslib_1.__importDefault(require("../../../../core/components/SxpPageRender/FormatImage"));
|
14
14
|
const CommodityDetail = (_a) => {
|
15
|
-
var _b, _c, _d, _e, _f, _g, _h, _j;
|
15
|
+
var _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
16
16
|
var { content, style, bgImg, onClick, schema, isDefault, bottom_image, tipText, isPost, viewTime, rec, swiper, commodityStyles, buttonStyle, index } = _a, props = tslib_1.__rest(_a, ["content", "style", "bgImg", "onClick", "schema", "isDefault", "bottom_image", "tipText", "isPost", "viewTime", "rec", "swiper", "commodityStyles", "buttonStyle", "index"]);
|
17
17
|
const { sxpParameter } = (0, hooks_1.useSxpDataSource)();
|
18
18
|
const { popupDetailData, bffEventReport, isPreview, waterFallData } = (0, hooks_1.useSxpDataSource)();
|
@@ -53,7 +53,7 @@ const CommodityDetail = (_a) => {
|
|
53
53
|
return '$7,000';
|
54
54
|
}
|
55
55
|
}, [product === null || product === void 0 ? void 0 : product.price, product === null || product === void 0 ? void 0 : product.currency]);
|
56
|
-
const width = isPreview ? 375 : window.innerWidth;
|
56
|
+
const width = isPreview ? 375 : (_f = style === null || style === void 0 ? void 0 : style.width) !== null && _f !== void 0 ? _f : window.innerWidth;
|
57
57
|
const renderContent = ({ isPost }) => {
|
58
58
|
var _a, _b, _c;
|
59
59
|
return (react_1.default.createElement("div", null,
|
@@ -73,7 +73,7 @@ const CommodityDetail = (_a) => {
|
|
73
73
|
};
|
74
74
|
return (react_1.default.createElement("div", { className: 'pb-commondity' },
|
75
75
|
react_1.default.createElement("div", Object.assign({ className: (0, css_1.css)(Object.assign({}, style)) }, props),
|
76
|
-
product && ((
|
76
|
+
product && ((_g = product === null || product === void 0 ? void 0 : product.homePage) === null || _g === void 0 ? void 0 : _g.length) > 0 && (react_1.default.createElement(react_2.Swiper, { height: width, modules: [modules_1.Pagination, modules_1.Autoplay], pagination: {
|
77
77
|
clickable: true,
|
78
78
|
bulletActiveClass: 'swipe-item-active-bullet',
|
79
79
|
clickableClass: (swiper === null || swiper === void 0 ? void 0 : swiper.dotsAlign) === 'left'
|
@@ -81,7 +81,7 @@ const CommodityDetail = (_a) => {
|
|
81
81
|
: 'commondityDetail-swiper-clickable-center'
|
82
82
|
}, loop: true, autoplay: {
|
83
83
|
delay: (swiper === null || swiper === void 0 ? void 0 : swiper.delay) * 1000
|
84
|
-
} }, (
|
84
|
+
} }, (_h = product === null || product === void 0 ? void 0 : product.homePage) === null || _h === void 0 ? void 0 : _h.map((src) => {
|
85
85
|
return (react_1.default.createElement(react_2.SwiperSlide, { key: src },
|
86
86
|
react_1.default.createElement("div", { style: {
|
87
87
|
overflow: 'hidden',
|
@@ -90,7 +90,7 @@ const CommodityDetail = (_a) => {
|
|
90
90
|
} },
|
91
91
|
react_1.default.createElement(FormatImage_1.default, { style: { height: '100%', width: '100%', objectFit: 'cover', display: 'block' }, src: src }))));
|
92
92
|
}))),
|
93
|
-
!((
|
93
|
+
!((_j = product === null || product === void 0 ? void 0 : product.homePage) === null || _j === void 0 ? void 0 : _j.length) && (react_1.default.createElement("div", { className: (0, css_1.css)({
|
94
94
|
position: 'relative',
|
95
95
|
height: 0,
|
96
96
|
width: '100%',
|
@@ -103,7 +103,7 @@ const CommodityDetail = (_a) => {
|
|
103
103
|
top: 0,
|
104
104
|
objectFit: 'cover',
|
105
105
|
width: '100%'
|
106
|
-
}), src: (
|
106
|
+
}), src: (_k = sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) !== null && _k !== void 0 ? _k : bottom_image, alt: '' }))),
|
107
107
|
react_1.default.createElement("div", { className: 'pb-commondity-content' }, renderContent({ isPost }))),
|
108
108
|
renderBtn(),
|
109
109
|
react_1.default.createElement(Modal_1.default, { visible: showModal, onClose: () => setShowModal(false) },
|