pb-sxp-ui 1.0.5 → 1.0.7
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 +98 -83
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +98 -84
- 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 +98 -83
- 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.d.ts +2 -2
- package/es/core/components/SxpPageRender/Modal/index.js +12 -11
- package/es/core/components/SxpPageRender/Popup/index.js +12 -12
- package/es/core/components/SxpPageRender/WaterFall/WaterfallList.js +3 -4
- package/es/core/components/SxpPageRender/WaterFall/index.js +1 -1
- package/es/core/context/EditorContext.d.ts +7 -5
- package/es/core/context/EditorContext.js +10 -25
- package/es/core/hooks/useEventReport.js +1 -1
- package/es/index.d.ts +1 -0
- package/es/index.js +1 -0
- package/es/materials/sxp/HashTag/settingRender.d.ts +4 -1
- package/es/materials/sxp/HashTag/settingRender.js +7 -3
- package/es/materials/sxp/defaultSetting.d.ts +11 -0
- package/es/materials/sxp/defaultSetting.js +7 -0
- package/es/materials/sxp/popup/AppointForm/index.js +1 -2
- package/es/materials/sxp/popup/AppointForm/material.js +0 -1
- package/es/materials/sxp/popup/AppointForm/settingRender.d.ts +3 -0
- package/es/materials/sxp/popup/AppointForm/settingRender.js +4 -1
- package/es/materials/sxp/popup/CommodityDetail/settingRender.d.ts +4 -1
- package/es/materials/sxp/popup/CommodityDetail/settingRender.js +7 -3
- package/es/materials/sxp/popup/CommodityDetailDiroNew/settingRender.d.ts +4 -1
- package/es/materials/sxp/popup/CommodityDetailDiroNew/settingRender.js +7 -3
- package/es/materials/sxp/popup/Prompt/index.js +0 -2
- package/es/materials/sxp/template/MultiCommodity/index.js +2 -2
- package/es/materials/sxp/template/MultiCommodityDiro/index.js +2 -2
- package/es/materials/sxp/template/MultiCommodityDiroNew/index.js +2 -2
- package/es/materials/sxp/template/components/EventProvider.js +2 -2
- package/es/materials/sxp/template/components/settingRender.d.ts +6 -0
- package/es/materials/sxp/template/components/settingRender.js +8 -4
- package/lib/core/components/SxpPageRender/Modal/index.d.ts +2 -2
- package/lib/core/components/SxpPageRender/Modal/index.js +11 -10
- package/lib/core/components/SxpPageRender/Popup/index.js +12 -12
- package/lib/core/components/SxpPageRender/WaterFall/WaterfallList.js +2 -3
- package/lib/core/components/SxpPageRender/WaterFall/index.js +1 -1
- package/lib/core/context/EditorContext.d.ts +7 -5
- package/lib/core/context/EditorContext.js +10 -25
- package/lib/core/hooks/useEventReport.js +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +3 -1
- package/lib/materials/sxp/HashTag/settingRender.d.ts +4 -1
- package/lib/materials/sxp/HashTag/settingRender.js +7 -3
- package/lib/materials/sxp/defaultSetting.d.ts +11 -0
- package/lib/materials/sxp/defaultSetting.js +10 -0
- package/lib/materials/sxp/popup/AppointForm/index.js +0 -1
- package/lib/materials/sxp/popup/AppointForm/material.js +0 -1
- package/lib/materials/sxp/popup/AppointForm/settingRender.d.ts +3 -0
- package/lib/materials/sxp/popup/AppointForm/settingRender.js +4 -1
- package/lib/materials/sxp/popup/CommodityDetail/settingRender.d.ts +4 -1
- package/lib/materials/sxp/popup/CommodityDetail/settingRender.js +7 -3
- package/lib/materials/sxp/popup/CommodityDetailDiroNew/settingRender.d.ts +4 -1
- package/lib/materials/sxp/popup/CommodityDetailDiroNew/settingRender.js +7 -3
- package/lib/materials/sxp/popup/Prompt/index.js +0 -2
- package/lib/materials/sxp/template/MultiCommodity/index.js +2 -2
- package/lib/materials/sxp/template/MultiCommodityDiro/index.js +2 -2
- package/lib/materials/sxp/template/MultiCommodityDiroNew/index.js +2 -2
- package/lib/materials/sxp/template/components/EventProvider.js +2 -2
- package/lib/materials/sxp/template/components/settingRender.d.ts +6 -0
- package/lib/materials/sxp/template/components/settingRender.js +8 -4
- package/package.json +1 -1
- package/es/core/components/SxpPageRender/ProductInfo/index.d.ts +0 -14
- package/es/core/components/SxpPageRender/ProductInfo/index.js +0 -55
- package/lib/core/components/SxpPageRender/ProductInfo/index.d.ts +0 -14
- package/lib/core/components/SxpPageRender/ProductInfo/index.js +0 -58
@@ -1,5 +1,7 @@
|
|
1
1
|
"use strict";
|
2
|
+
var _a, _b;
|
2
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
+
const defaultSetting_1 = require("../../defaultSetting");
|
3
5
|
exports.default = [
|
4
6
|
{
|
5
7
|
title: '商品图片',
|
@@ -71,8 +73,9 @@ exports.default = [
|
|
71
73
|
},
|
72
74
|
{
|
73
75
|
type: 'Select',
|
74
|
-
options:
|
75
|
-
name: ['fontFamily']
|
76
|
+
options: defaultSetting_1.fontOptions,
|
77
|
+
name: ['fontFamily'],
|
78
|
+
initialValue: (_a = defaultSetting_1.fontOptions === null || defaultSetting_1.fontOptions === void 0 ? void 0 : defaultSetting_1.fontOptions[0]) === null || _a === void 0 ? void 0 : _a.value
|
76
79
|
},
|
77
80
|
{
|
78
81
|
type: 'Number',
|
@@ -151,7 +154,8 @@ exports.default = [
|
|
151
154
|
{
|
152
155
|
type: 'Select',
|
153
156
|
name: ['props', 'buttonStyle', 'fontFamily'],
|
154
|
-
options:
|
157
|
+
options: defaultSetting_1.fontOptions,
|
158
|
+
initialValue: (_b = defaultSetting_1.fontOptions === null || defaultSetting_1.fontOptions === void 0 ? void 0 : defaultSetting_1.fontOptions[0]) === null || _b === void 0 ? void 0 : _b.value
|
155
159
|
},
|
156
160
|
{
|
157
161
|
type: 'Number',
|
@@ -5,11 +5,9 @@ const css_1 = require("@emotion/css");
|
|
5
5
|
const react_1 = tslib_1.__importStar(require("react"));
|
6
6
|
const success_png_1 = tslib_1.__importDefault(require("./success.png"));
|
7
7
|
const materials_1 = require("../../../../core/utils/materials");
|
8
|
-
const hooks_1 = require("../../../../core/hooks");
|
9
8
|
require("./index.less");
|
10
9
|
const Prompt = (_a) => {
|
11
10
|
var { content, btnText, style, icon, onClick } = _a, props = tslib_1.__rest(_a, ["content", "btnText", "style", "icon", "onClick"]);
|
12
|
-
const { setPopup } = (0, hooks_1.useEditor)();
|
13
11
|
const iconSrc = typeof icon === 'string' ? icon : (0, materials_1.getMediaValueByMode)(icon);
|
14
12
|
const handleOk = () => {
|
15
13
|
window === null || window === void 0 ? void 0 : window.sxpPopup('');
|
@@ -15,7 +15,7 @@ const MultiCommodity = (_a) => {
|
|
15
15
|
var { content, style, bgImg, recData, onClick, bottom_image, ctaTempStyles, isExternalLink } = _a, props = tslib_1.__rest(_a, ["content", "style", "bgImg", "recData", "onClick", "bottom_image", "ctaTempStyles", "isExternalLink"]);
|
16
16
|
const { sxpParameter } = (0, hooks_1.useSxpDataSource)();
|
17
17
|
const { ctaEvent, setPopupDetailData } = (0, hooks_1.useSxpDataSource)();
|
18
|
-
const {
|
18
|
+
const { popup } = (0, hooks_1.useEditor)();
|
19
19
|
const [products, setProducts] = (0, react_1.useState)((_c = (_b = recData === null || recData === void 0 ? void 0 : recData.video) === null || _b === void 0 ? void 0 : _b.bindProducts) !== null && _c !== void 0 ? _c : [1, 2]);
|
20
20
|
const { jumpToWeb } = (0, useEventReport_1.useEventReport)();
|
21
21
|
const handleClick = (0, lodash_1.throttle)((item) => {
|
@@ -33,7 +33,7 @@ const MultiCommodity = (_a) => {
|
|
33
33
|
else {
|
34
34
|
onClick === null || onClick === void 0 ? void 0 : onClick();
|
35
35
|
}
|
36
|
-
},
|
36
|
+
}, popup === null || popup === void 0 ? void 0 : popup.duration);
|
37
37
|
return (react_1.default.createElement(Scroll_1.default, { isPadding: !!recData }, products === null || products === void 0 ? void 0 : products.map((item) => {
|
38
38
|
var _a, _b, _c, _d, _e, _f;
|
39
39
|
return (react_1.default.createElement(react_2.SwiperSlide, Object.assign({ hidden: recData && !(item === null || item === void 0 ? void 0 : item.bindCta), key: item.itemId, className: (0, css_1.css)(Object.assign(Object.assign({}, style), { display: 'flex', flexShrink: 0, marginLeft: 0, marginRight: '8px' })) }, props, { onClick: () => handleClick(item) }),
|
@@ -14,7 +14,7 @@ const MultiCommodityDiro = (_a) => {
|
|
14
14
|
var _b, _c;
|
15
15
|
var { content, style, bgImg, recData, onClick, bottom_image, ctaTempStyles, isExternalLink } = _a, props = tslib_1.__rest(_a, ["content", "style", "bgImg", "recData", "onClick", "bottom_image", "ctaTempStyles", "isExternalLink"]);
|
16
16
|
const { ctaEvent, setPopupDetailData, sxpParameter } = (0, hooks_1.useSxpDataSource)();
|
17
|
-
const {
|
17
|
+
const { popup } = (0, hooks_1.useEditor)();
|
18
18
|
const { jumpToWeb } = (0, useEventReport_1.useEventReport)();
|
19
19
|
const [products, setProducts] = (0, react_1.useState)((_c = (_b = recData === null || recData === void 0 ? void 0 : recData.video) === null || _b === void 0 ? void 0 : _b.bindProducts) !== null && _c !== void 0 ? _c : [1, 2]);
|
20
20
|
const handleClick = (0, lodash_1.throttle)((item) => {
|
@@ -32,7 +32,7 @@ const MultiCommodityDiro = (_a) => {
|
|
32
32
|
else {
|
33
33
|
onClick === null || onClick === void 0 ? void 0 : onClick();
|
34
34
|
}
|
35
|
-
},
|
35
|
+
}, popup === null || popup === void 0 ? void 0 : popup.duration);
|
36
36
|
return (react_1.default.createElement(Scroll_1.default, { isPadding: !!recData }, products === null || products === void 0 ? void 0 : products.map((item) => {
|
37
37
|
var _a, _b, _c, _d, _e, _f;
|
38
38
|
return (react_1.default.createElement(react_2.SwiperSlide, Object.assign({ hidden: recData && !(item === null || item === void 0 ? void 0 : item.bindCta), key: item === null || item === void 0 ? void 0 : item.itemId, className: (0, css_1.css)(Object.assign(Object.assign({}, style), { display: 'flex', flexShrink: 0, marginLeft: 0, marginRight: '8px' })) }, props, { onClick: () => handleClick(item) }),
|
@@ -14,7 +14,7 @@ const MultiCommodityDiroNew = (_a) => {
|
|
14
14
|
var _b, _c;
|
15
15
|
var { content, style, bgImg, recData, onClick, bottom_image, ctaTempStyles, isExternalLink } = _a, props = tslib_1.__rest(_a, ["content", "style", "bgImg", "recData", "onClick", "bottom_image", "ctaTempStyles", "isExternalLink"]);
|
16
16
|
const { ctaEvent, setPopupDetailData, sxpParameter } = (0, hooks_1.useSxpDataSource)();
|
17
|
-
const {
|
17
|
+
const { popup } = (0, hooks_1.useEditor)();
|
18
18
|
const { jumpToWeb } = (0, useEventReport_1.useEventReport)();
|
19
19
|
const [products, setProducts] = (0, react_1.useState)((_c = (_b = recData === null || recData === void 0 ? void 0 : recData.video) === null || _b === void 0 ? void 0 : _b.bindProducts) !== null && _c !== void 0 ? _c : [1, 2]);
|
20
20
|
const handleClick = (0, lodash_1.throttle)((item) => {
|
@@ -32,7 +32,7 @@ const MultiCommodityDiroNew = (_a) => {
|
|
32
32
|
else {
|
33
33
|
onClick === null || onClick === void 0 ? void 0 : onClick();
|
34
34
|
}
|
35
|
-
},
|
35
|
+
}, popup === null || popup === void 0 ? void 0 : popup.duration);
|
36
36
|
return (react_1.default.createElement(Scroll_1.default, { isPadding: !!recData }, products === null || products === void 0 ? void 0 : products.map((item) => {
|
37
37
|
var _a, _b, _c, _d, _e, _f;
|
38
38
|
return (react_1.default.createElement(react_2.SwiperSlide, Object.assign({ hidden: recData && !(item === null || item === void 0 ? void 0 : item.bindCta), key: item === null || item === void 0 ? void 0 : item.itemId, className: (0, css_1.css)(Object.assign(Object.assign({}, style), { display: 'flex', flexShrink: 0, marginLeft: 0, marginRight: '8px' })) }, props, { onClick: () => handleClick(item) }),
|
@@ -10,7 +10,7 @@ const EventProvider = (_a) => {
|
|
10
10
|
var { rec, children, className, onClick, style, isExternalLink = false } = _a, props = tslib_1.__rest(_a, ["rec", "children", "className", "onClick", "style", "isExternalLink"]);
|
11
11
|
const ref = (0, react_1.useRef)(null);
|
12
12
|
const isOnScreen = (0, useOnScreen_1.default)(ref);
|
13
|
-
const {
|
13
|
+
const { popup } = (0, hooks_1.useEditor)();
|
14
14
|
const { setPopupDetailData, ctaEvent } = (0, hooks_1.useSxpDataSource)();
|
15
15
|
const { jumpToWeb } = (0, useEventReport_1.useEventReport)();
|
16
16
|
(0, react_1.useEffect)(() => {
|
@@ -42,7 +42,7 @@ const EventProvider = (_a) => {
|
|
42
42
|
else {
|
43
43
|
onClick === null || onClick === void 0 ? void 0 : onClick();
|
44
44
|
}
|
45
|
-
},
|
45
|
+
}, popup === null || popup === void 0 ? void 0 : popup.duration);
|
46
46
|
return (react_1.default.createElement("div", { ref: ref, className: className, style: style, onClick: handleClick }, children));
|
47
47
|
};
|
48
48
|
exports.default = (0, react_1.memo)(EventProvider);
|
@@ -50,6 +50,7 @@ declare const _default: ({
|
|
50
50
|
type: string;
|
51
51
|
name: string[];
|
52
52
|
options?: undefined;
|
53
|
+
initialValue?: undefined;
|
53
54
|
addonAfter?: undefined;
|
54
55
|
} | {
|
55
56
|
type: string;
|
@@ -58,12 +59,14 @@ declare const _default: ({
|
|
58
59
|
value: string;
|
59
60
|
}[];
|
60
61
|
name: string[];
|
62
|
+
initialValue: string;
|
61
63
|
addonAfter?: undefined;
|
62
64
|
} | {
|
63
65
|
type: string;
|
64
66
|
addonAfter: string;
|
65
67
|
name: string[];
|
66
68
|
options?: undefined;
|
69
|
+
initialValue?: undefined;
|
67
70
|
})[];
|
68
71
|
name?: undefined;
|
69
72
|
} | {
|
@@ -101,6 +104,7 @@ declare const _default: ({
|
|
101
104
|
type: string;
|
102
105
|
name: string[];
|
103
106
|
options?: undefined;
|
107
|
+
initialValue?: undefined;
|
104
108
|
addonAfter?: undefined;
|
105
109
|
} | {
|
106
110
|
type: string;
|
@@ -109,12 +113,14 @@ declare const _default: ({
|
|
109
113
|
value: string;
|
110
114
|
}[];
|
111
115
|
name: string[];
|
116
|
+
initialValue: string;
|
112
117
|
addonAfter?: undefined;
|
113
118
|
} | {
|
114
119
|
type: string;
|
115
120
|
addonAfter: string;
|
116
121
|
name: string[];
|
117
122
|
options?: undefined;
|
123
|
+
initialValue?: undefined;
|
118
124
|
})[];
|
119
125
|
name?: undefined;
|
120
126
|
})[];
|
@@ -1,5 +1,7 @@
|
|
1
1
|
"use strict";
|
2
|
+
var _a, _b;
|
2
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
+
const defaultSetting_1 = require("../../defaultSetting");
|
3
5
|
exports.default = [
|
4
6
|
{
|
5
7
|
title: '主题样式',
|
@@ -114,8 +116,9 @@ exports.default = [
|
|
114
116
|
},
|
115
117
|
{
|
116
118
|
type: 'Select',
|
117
|
-
options:
|
118
|
-
name: ['props', 'ctaTempStyles', 'title', 'fontFamily']
|
119
|
+
options: defaultSetting_1.fontOptions,
|
120
|
+
name: ['props', 'ctaTempStyles', 'title', 'fontFamily'],
|
121
|
+
initialValue: (_a = defaultSetting_1.fontOptions === null || defaultSetting_1.fontOptions === void 0 ? void 0 : defaultSetting_1.fontOptions[0]) === null || _a === void 0 ? void 0 : _a.value
|
119
122
|
},
|
120
123
|
{
|
121
124
|
type: 'Number',
|
@@ -192,8 +195,9 @@ exports.default = [
|
|
192
195
|
},
|
193
196
|
{
|
194
197
|
type: 'Select',
|
195
|
-
options:
|
196
|
-
name: ['props', 'ctaTempStyles', 'ctaTitle', 'fontFamily']
|
198
|
+
options: defaultSetting_1.fontOptions,
|
199
|
+
name: ['props', 'ctaTempStyles', 'ctaTitle', 'fontFamily'],
|
200
|
+
initialValue: (_b = defaultSetting_1.fontOptions === null || defaultSetting_1.fontOptions === void 0 ? void 0 : defaultSetting_1.fontOptions[0]) === null || _b === void 0 ? void 0 : _b.value
|
197
201
|
},
|
198
202
|
{
|
199
203
|
type: 'Number',
|
package/package.json
CHANGED
@@ -1,14 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
import { RecItemType } from '../typing';
|
3
|
-
interface IProductInfoProps {
|
4
|
-
data: RecItemType;
|
5
|
-
height: number;
|
6
|
-
width: number;
|
7
|
-
viewTime: any;
|
8
|
-
tipText?: {
|
9
|
-
foldText?: string;
|
10
|
-
unfoldText?: string;
|
11
|
-
};
|
12
|
-
}
|
13
|
-
declare const _default: React.NamedExoticComponent<IProductInfoProps>;
|
14
|
-
export default _default;
|
@@ -1,55 +0,0 @@
|
|
1
|
-
import React, { useMemo, useState } from 'react';
|
2
|
-
import { Pagination, Autoplay } from 'swiper/modules';
|
3
|
-
import { SwiperSlide, Swiper } from 'swiper/react';
|
4
|
-
import ExpandableText from '../ExpandableText';
|
5
|
-
import Modal from '../Modal';
|
6
|
-
import { useEventReport } from '../../../../core/hooks/useEventReport';
|
7
|
-
const ProductInfo = ({ data, height, width, viewTime, tipText }) => {
|
8
|
-
var _a, _b;
|
9
|
-
const product = data === null || data === void 0 ? void 0 : data.product;
|
10
|
-
const cta = (_a = data === null || data === void 0 ? void 0 : data.product) === null || _a === void 0 ? void 0 : _a.bindCta;
|
11
|
-
const [showModal, setShowModal] = useState(false);
|
12
|
-
const { jumpToWeb } = useEventReport();
|
13
|
-
const priceText = useMemo(() => {
|
14
|
-
var _a, _b, _c, _d, _e;
|
15
|
-
if ((product === null || product === void 0 ? void 0 : product.currency) && (product === null || product === void 0 ? void 0 : product.price)) {
|
16
|
-
return `${(_c = (_b = (_a = product === null || product === void 0 ? void 0 : product.currency) === null || _a === void 0 ? void 0 : _a.split('-')[1]) === null || _b === void 0 ? void 0 : _b.toUpperCase()) !== null && _c !== void 0 ? _c : ''}${(_e = (_d = product === null || product === void 0 ? void 0 : product.price) === null || _d === void 0 ? void 0 : _d.toLocaleString('zh', {
|
17
|
-
minimumFractionDigits: 0
|
18
|
-
})) !== null && _e !== void 0 ? _e : ''}`;
|
19
|
-
}
|
20
|
-
else {
|
21
|
-
return '$7,000';
|
22
|
-
}
|
23
|
-
}, [product === null || product === void 0 ? void 0 : product.price, product === null || product === void 0 ? void 0 : product.currency]);
|
24
|
-
const handleLInk = (link) => {
|
25
|
-
if (link) {
|
26
|
-
jumpToWeb(data, product, cta);
|
27
|
-
window.location.href = window.getJointUtmLink(link);
|
28
|
-
}
|
29
|
-
};
|
30
|
-
return (React.createElement("div", { style: { height, width: '100%' } },
|
31
|
-
React.createElement(Swiper, { height: height * 0.5, modules: [Pagination, Autoplay], pagination: { clickable: true, bulletActiveClass: 'swipe-item-active-bullet' }, loop: true, autoplay: {
|
32
|
-
delay: 3000
|
33
|
-
} }, (_b = product === null || product === void 0 ? void 0 : product.homePage) === null || _b === void 0 ? void 0 : _b.map((src) => {
|
34
|
-
return (React.createElement(SwiperSlide, { key: src },
|
35
|
-
React.createElement("div", { style: {
|
36
|
-
overflow: 'hidden',
|
37
|
-
width,
|
38
|
-
height: height * 0.5
|
39
|
-
} },
|
40
|
-
React.createElement("img", { src: src, style: { height: '100%', width: '100%', objectFit: 'cover' } }))));
|
41
|
-
})),
|
42
|
-
React.createElement("div", { className: 'product-info' },
|
43
|
-
React.createElement("div", { className: 'collection' }, product === null || product === void 0 ? void 0 : product.collection),
|
44
|
-
React.createElement("div", { className: 'title' }, product === null || product === void 0 ? void 0 : product.title),
|
45
|
-
React.createElement("div", { className: 'price' }, priceText),
|
46
|
-
React.createElement(ExpandableText, { foldText: tipText === null || tipText === void 0 ? void 0 : tipText.foldText, unfoldText: tipText === null || tipText === void 0 ? void 0 : tipText.unfoldText, onClick: () => setShowModal(true), className: 'info', text: (product === null || product === void 0 ? void 0 : product.info) || '', maxStr: 79 }),
|
47
|
-
React.createElement("a", { target: '_blank', className: 'pb-modal-btn', onClick: () => handleLInk(product === null || product === void 0 ? void 0 : product.link) }, cta === null || cta === void 0 ? void 0 : cta.enTitle)),
|
48
|
-
React.createElement(Modal, { visible: showModal, onClose: () => setShowModal(false) },
|
49
|
-
React.createElement("div", { className: 'modal-collection' }, product === null || product === void 0 ? void 0 : product.collection),
|
50
|
-
React.createElement("div", { className: 'modal-title' }, product === null || product === void 0 ? void 0 : product.title),
|
51
|
-
React.createElement("div", { className: 'modal-price' }, priceText),
|
52
|
-
React.createElement("div", { className: 'modal-info' }, product === null || product === void 0 ? void 0 : product.info),
|
53
|
-
(product === null || product === void 0 ? void 0 : product.link) && (React.createElement("a", { target: '_blank', className: 'pb-modal-btn', onClick: () => handleLInk(product === null || product === void 0 ? void 0 : product.link) }, cta === null || cta === void 0 ? void 0 : cta.enTitle)))));
|
54
|
-
};
|
55
|
-
export default React.memo(ProductInfo);
|
@@ -1,14 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
import { RecItemType } from '../typing';
|
3
|
-
interface IProductInfoProps {
|
4
|
-
data: RecItemType;
|
5
|
-
height: number;
|
6
|
-
width: number;
|
7
|
-
viewTime: any;
|
8
|
-
tipText?: {
|
9
|
-
foldText?: string;
|
10
|
-
unfoldText?: string;
|
11
|
-
};
|
12
|
-
}
|
13
|
-
declare const _default: React.NamedExoticComponent<IProductInfoProps>;
|
14
|
-
export default _default;
|
@@ -1,58 +0,0 @@
|
|
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 modules_1 = require("swiper/modules");
|
6
|
-
const react_2 = require("swiper/react");
|
7
|
-
const ExpandableText_1 = tslib_1.__importDefault(require("../ExpandableText"));
|
8
|
-
const Modal_1 = tslib_1.__importDefault(require("../Modal"));
|
9
|
-
const useEventReport_1 = require("../../../../core/hooks/useEventReport");
|
10
|
-
const ProductInfo = ({ data, height, width, viewTime, tipText }) => {
|
11
|
-
var _a, _b;
|
12
|
-
const product = data === null || data === void 0 ? void 0 : data.product;
|
13
|
-
const cta = (_a = data === null || data === void 0 ? void 0 : data.product) === null || _a === void 0 ? void 0 : _a.bindCta;
|
14
|
-
const [showModal, setShowModal] = (0, react_1.useState)(false);
|
15
|
-
const { jumpToWeb } = (0, useEventReport_1.useEventReport)();
|
16
|
-
const priceText = (0, react_1.useMemo)(() => {
|
17
|
-
var _a, _b, _c, _d, _e;
|
18
|
-
if ((product === null || product === void 0 ? void 0 : product.currency) && (product === null || product === void 0 ? void 0 : product.price)) {
|
19
|
-
return `${(_c = (_b = (_a = product === null || product === void 0 ? void 0 : product.currency) === null || _a === void 0 ? void 0 : _a.split('-')[1]) === null || _b === void 0 ? void 0 : _b.toUpperCase()) !== null && _c !== void 0 ? _c : ''}${(_e = (_d = product === null || product === void 0 ? void 0 : product.price) === null || _d === void 0 ? void 0 : _d.toLocaleString('zh', {
|
20
|
-
minimumFractionDigits: 0
|
21
|
-
})) !== null && _e !== void 0 ? _e : ''}`;
|
22
|
-
}
|
23
|
-
else {
|
24
|
-
return '$7,000';
|
25
|
-
}
|
26
|
-
}, [product === null || product === void 0 ? void 0 : product.price, product === null || product === void 0 ? void 0 : product.currency]);
|
27
|
-
const handleLInk = (link) => {
|
28
|
-
if (link) {
|
29
|
-
jumpToWeb(data, product, cta);
|
30
|
-
window.location.href = window.getJointUtmLink(link);
|
31
|
-
}
|
32
|
-
};
|
33
|
-
return (react_1.default.createElement("div", { style: { height, width: '100%' } },
|
34
|
-
react_1.default.createElement(react_2.Swiper, { height: height * 0.5, modules: [modules_1.Pagination, modules_1.Autoplay], pagination: { clickable: true, bulletActiveClass: 'swipe-item-active-bullet' }, loop: true, autoplay: {
|
35
|
-
delay: 3000
|
36
|
-
} }, (_b = product === null || product === void 0 ? void 0 : product.homePage) === null || _b === void 0 ? void 0 : _b.map((src) => {
|
37
|
-
return (react_1.default.createElement(react_2.SwiperSlide, { key: src },
|
38
|
-
react_1.default.createElement("div", { style: {
|
39
|
-
overflow: 'hidden',
|
40
|
-
width,
|
41
|
-
height: height * 0.5
|
42
|
-
} },
|
43
|
-
react_1.default.createElement("img", { src: src, style: { height: '100%', width: '100%', objectFit: 'cover' } }))));
|
44
|
-
})),
|
45
|
-
react_1.default.createElement("div", { className: 'product-info' },
|
46
|
-
react_1.default.createElement("div", { className: 'collection' }, product === null || product === void 0 ? void 0 : product.collection),
|
47
|
-
react_1.default.createElement("div", { className: 'title' }, product === null || product === void 0 ? void 0 : product.title),
|
48
|
-
react_1.default.createElement("div", { className: 'price' }, priceText),
|
49
|
-
react_1.default.createElement(ExpandableText_1.default, { foldText: tipText === null || tipText === void 0 ? void 0 : tipText.foldText, unfoldText: tipText === null || tipText === void 0 ? void 0 : tipText.unfoldText, onClick: () => setShowModal(true), className: 'info', text: (product === null || product === void 0 ? void 0 : product.info) || '', maxStr: 79 }),
|
50
|
-
react_1.default.createElement("a", { target: '_blank', className: 'pb-modal-btn', onClick: () => handleLInk(product === null || product === void 0 ? void 0 : product.link) }, cta === null || cta === void 0 ? void 0 : cta.enTitle)),
|
51
|
-
react_1.default.createElement(Modal_1.default, { visible: showModal, onClose: () => setShowModal(false) },
|
52
|
-
react_1.default.createElement("div", { className: 'modal-collection' }, product === null || product === void 0 ? void 0 : product.collection),
|
53
|
-
react_1.default.createElement("div", { className: 'modal-title' }, product === null || product === void 0 ? void 0 : product.title),
|
54
|
-
react_1.default.createElement("div", { className: 'modal-price' }, priceText),
|
55
|
-
react_1.default.createElement("div", { className: 'modal-info' }, product === null || product === void 0 ? void 0 : product.info),
|
56
|
-
(product === null || product === void 0 ? void 0 : product.link) && (react_1.default.createElement("a", { target: '_blank', className: 'pb-modal-btn', onClick: () => handleLInk(product === null || product === void 0 ? void 0 : product.link) }, cta === null || cta === void 0 ? void 0 : cta.enTitle)))));
|
57
|
-
};
|
58
|
-
exports.default = react_1.default.memo(ProductInfo);
|