pb-sxp-ui 1.7.2 → 1.7.3
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 +107 -48
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +107 -48
- 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 +107 -48
- 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/PictureGroup/Picture.d.ts +1 -1
- package/es/core/components/SxpPageRender/PictureGroup/index.d.ts +4 -1
- package/es/core/components/SxpPageRender/PictureGroup/index.js +24 -4
- package/es/core/components/SxpPageRender/RenderCard.js +6 -1
- package/es/core/components/SxpPageRender/VideoWidget/index.js +14 -7
- package/es/core/components/SxpPageRender/WaterFall/List.js +3 -2
- package/es/core/components/SxpPageRender/WaterFall/WaterfallList.js +3 -2
- package/es/core/components/SxpPageRender/index.d.ts +1 -0
- package/es/core/components/SxpPageRender/index.js +12 -10
- package/es/core/utils/materials.d.ts +7 -1
- package/es/core/utils/materials.js +5 -2
- package/es/core/utils/tool.d.ts +2 -1
- package/es/core/utils/tool.js +11 -1
- package/es/materials/sxp/cta/AniLink/settingRender.d.ts +11 -0
- package/es/materials/sxp/cta/AniLink/settingRender.js +6 -0
- package/es/materials/sxp/cta/AniLinkPopup/settingRender.d.ts +1 -1
- package/es/materials/sxp/cta/AniLinkPopup/settingRender.js +6 -0
- package/es/materials/sxp/popup/CommodityDetail/index.js +3 -2
- package/es/materials/sxp/popup/CommodityDetailDiroNew/index.js +3 -2
- package/es/materials/sxp/popup/CommodityList/index.js +5 -4
- package/es/materials/sxp/template/components/settingRender.d.ts +1 -1
- package/es/materials/sxp/template/components/settingRender.js +6 -0
- package/lib/core/components/SxpPageRender/PictureGroup/Picture.d.ts +1 -1
- package/lib/core/components/SxpPageRender/PictureGroup/index.d.ts +4 -1
- package/lib/core/components/SxpPageRender/PictureGroup/index.js +23 -4
- package/lib/core/components/SxpPageRender/RenderCard.js +6 -1
- package/lib/core/components/SxpPageRender/VideoWidget/index.js +13 -7
- package/lib/core/components/SxpPageRender/WaterFall/List.js +3 -2
- package/lib/core/components/SxpPageRender/WaterFall/WaterfallList.js +3 -2
- package/lib/core/components/SxpPageRender/index.d.ts +1 -0
- package/lib/core/components/SxpPageRender/index.js +12 -10
- package/lib/core/utils/materials.d.ts +7 -1
- package/lib/core/utils/materials.js +5 -2
- package/lib/core/utils/tool.d.ts +2 -1
- package/lib/core/utils/tool.js +12 -1
- package/lib/materials/sxp/cta/AniLink/settingRender.d.ts +11 -0
- package/lib/materials/sxp/cta/AniLink/settingRender.js +6 -0
- package/lib/materials/sxp/cta/AniLinkPopup/settingRender.d.ts +1 -1
- package/lib/materials/sxp/cta/AniLinkPopup/settingRender.js +6 -0
- package/lib/materials/sxp/popup/CommodityDetail/index.js +3 -2
- package/lib/materials/sxp/popup/CommodityDetailDiroNew/index.js +3 -2
- package/lib/materials/sxp/popup/CommodityList/index.js +5 -4
- package/lib/materials/sxp/template/components/settingRender.d.ts +1 -1
- package/lib/materials/sxp/template/components/settingRender.js +6 -0
- package/package.json +1 -1
@@ -52,7 +52,12 @@ const RenderCard = ({ rec, index, tempMap, resolver, includesCtaType, isActive }
|
|
52
52
|
const Component = (0, withBindDataSource_1.default)(t);
|
53
53
|
const defaulSetting = (_z = t === null || t === void 0 ? void 0 : t.extend) === null || _z === void 0 ? void 0 : _z.defaulSetting;
|
54
54
|
const isExternalLink = ((_2 = (_1 = (_0 = value === null || value === void 0 ? void 0 : value.item) === null || _0 === void 0 ? void 0 : _0.event) === null || _1 === void 0 ? void 0 : _1.onClick) === null || _2 === void 0 ? void 0 : _2.linkType) === 'externalLink';
|
55
|
-
|
55
|
+
let style = (_3 = value === null || value === void 0 ? void 0 : value.item) === null || _3 === void 0 ? void 0 : _3.style;
|
56
|
+
if (style.hasOwnProperty('backdropFilter')) {
|
57
|
+
let sbf = style['backdropFilter'];
|
58
|
+
style['backdropFilter'] = `blur(${sbf !== null && sbf !== void 0 ? sbf : 0}px)`;
|
59
|
+
}
|
60
|
+
return (react_1.default.createElement(Component, Object.assign({ style: Object.assign(Object.assign(Object.assign({}, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.style), style), { zIndex: 50, marginLeft: '20px', boxSizing: 'border-box', transform: 'translate3d(0px, 0px, 0px)' }), textStyle: Object.assign(Object.assign({}, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.textStyle), (_4 = value === null || value === void 0 ? void 0 : value.item) === null || _4 === void 0 ? void 0 : _4.textStyle), bindDatas: (_6 = (_5 = value === null || value === void 0 ? void 0 : value.item) === null || _5 === void 0 ? void 0 : _5.bindDatas) !== null && _6 !== void 0 ? _6 : [] }, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.props, (_7 = value === null || value === void 0 ? void 0 : value.item) === null || _7 === void 0 ? void 0 : _7.props, { event: ((_8 = value === null || value === void 0 ? void 0 : value.item) === null || _8 === void 0 ? void 0 : _8.event) || {}, schema: schema, id: value === null || value === void 0 ? void 0 : value.id, key: value === null || value === void 0 ? void 0 : value.id, recData: rec, isExternalLink: isExternalLink, index: index, isActive: isActive })));
|
56
61
|
}
|
57
62
|
else {
|
58
63
|
return null;
|
@@ -9,6 +9,7 @@ const hooks_1 = require("../../../../core/hooks");
|
|
9
9
|
const event_1 = tslib_1.__importStar(require("../../../../core/utils/event"));
|
10
10
|
const loading_gif_1 = tslib_1.__importDefault(require("./loading.gif"));
|
11
11
|
const VideoPlayer_1 = require("./VideoPlayer");
|
12
|
+
const tool_1 = require("../../../../core/utils/tool");
|
12
13
|
const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostConfig, videoPlayIcon }) => {
|
13
14
|
const [isPauseVideo, setIsPauseVideo] = (0, react_1.useState)(false);
|
14
15
|
const { bffEventReport, sxpParameter, waterFallData, openHashtag, bffFbReport } = (0, hooks_1.useSxpDataSource)();
|
@@ -23,6 +24,7 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
23
24
|
const videoId = `pb-cache-video-${index}`;
|
24
25
|
const videoEleRef = (0, react_1.useRef)(null);
|
25
26
|
const hlsRef = (0, react_1.useRef)(null);
|
27
|
+
const initTimeRef = (0, react_1.useRef)();
|
26
28
|
const blur = (0, react_1.useMemo)(() => {
|
27
29
|
return (videoPostConfig === null || videoPostConfig === void 0 ? void 0 : videoPostConfig.mode) === '2';
|
28
30
|
}, [videoPostConfig]);
|
@@ -68,8 +70,8 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
68
70
|
setWaiting(false);
|
69
71
|
setIsLoadFinish(true);
|
70
72
|
}, []);
|
71
|
-
const handleStartPlay = (0, react_1.useCallback)(() => {
|
72
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
73
|
+
const handleStartPlay = (0, react_1.useCallback)(() => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
74
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
73
75
|
if (!(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current))
|
74
76
|
return;
|
75
77
|
setIsPauseVideo(false);
|
@@ -79,24 +81,27 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
79
81
|
const videoDuration = ((_d = (_c = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _c === void 0 ? void 0 : _c.duration) !== null && _d !== void 0 ? _d : 0).toFixed(2);
|
80
82
|
const videoCurrentTime = ((_f = (_e = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _e === void 0 ? void 0 : _e.currentTime) !== null && _f !== void 0 ? _f : 0).toFixed(2);
|
81
83
|
const playType = isFirstPlay ? '0' : '1';
|
84
|
+
const contentSize = yield (0, tool_1.getResFileSizeFromSrc)((_g = item === null || item === void 0 ? void 0 : item.video) === null || _g === void 0 ? void 0 : _g.url);
|
82
85
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
83
86
|
eventInfo: {
|
84
87
|
eventSubject: 'playVideo',
|
85
88
|
eventDescription: 'User played the video',
|
86
|
-
contentId: (
|
87
|
-
contentName: (
|
89
|
+
contentId: (_j = (_h = item === null || item === void 0 ? void 0 : item.video) === null || _h === void 0 ? void 0 : _h.itemId) !== null && _j !== void 0 ? _j : '',
|
90
|
+
contentName: (_l = (_k = item === null || item === void 0 ? void 0 : item.video) === null || _k === void 0 ? void 0 : _k.title) !== null && _l !== void 0 ? _l : '',
|
88
91
|
playType,
|
89
92
|
startTime: videoCurrentTime,
|
90
93
|
videoDuration,
|
91
|
-
contentTags: JSON.stringify((
|
94
|
+
contentTags: JSON.stringify((_o = (_m = item === null || item === void 0 ? void 0 : item.video) === null || _m === void 0 ? void 0 : _m.tags) !== null && _o !== void 0 ? _o : []),
|
92
95
|
position: index + '',
|
93
96
|
contentFormat: 'video',
|
94
|
-
traceInfo: (
|
97
|
+
traceInfo: (_p = item === null || item === void 0 ? void 0 : item.video) === null || _p === void 0 ? void 0 : _p.traceInfo,
|
98
|
+
contentSize,
|
99
|
+
loadTime: (new Date() - (initTimeRef === null || initTimeRef === void 0 ? void 0 : initTimeRef.current)).toFixed(2) + ''
|
95
100
|
}
|
96
101
|
});
|
97
102
|
setIsFirstPlay(false);
|
98
103
|
}
|
99
|
-
}, [bffEventReport, data, index, isFirstPlay, videoRef === null || videoRef === void 0 ? void 0 : videoRef.current]);
|
104
|
+
}), [bffEventReport, data, index, isFirstPlay, videoRef === null || videoRef === void 0 ? void 0 : videoRef.current]);
|
100
105
|
const handLoadeddata = (0, react_1.useCallback)(() => {
|
101
106
|
var _a;
|
102
107
|
if (!(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) || firstFrameSrc || !blur)
|
@@ -200,6 +205,7 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
200
205
|
videoRef.current = VideoPlayer_1.mountVideoPlayerAtNode === null || VideoPlayer_1.mountVideoPlayerAtNode === void 0 ? void 0 : (0, VideoPlayer_1.mountVideoPlayerAtNode)(videoPlayerWrapperNode);
|
201
206
|
if (!(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current))
|
202
207
|
return;
|
208
|
+
initTimeRef.current = new Date();
|
203
209
|
const Hls = window === null || window === void 0 ? void 0 : window.Hls;
|
204
210
|
let hls = hlsRef === null || hlsRef === void 0 ? void 0 : hlsRef.current;
|
205
211
|
if (videoSrc.includes('.m3u8') && Hls && Hls.isSupported()) {
|
@@ -43,7 +43,8 @@ const WaterfallFlowItem = (props) => {
|
|
43
43
|
product: rec === null || rec === void 0 ? void 0 : rec.product,
|
44
44
|
enableFormattedPrice: (_a = textStyles === null || textStyles === void 0 ? void 0 : textStyles.price) === null || _a === void 0 ? void 0 : _a.enableFormattedPrice,
|
45
45
|
globalConfig,
|
46
|
-
isHiddenDef: true
|
46
|
+
isHiddenDef: true,
|
47
|
+
style: textStyles === null || textStyles === void 0 ? void 0 : textStyles.price
|
47
48
|
});
|
48
49
|
(0, react_1.useEffect)(() => {
|
49
50
|
const observer = new IntersectionObserver((entries) => {
|
@@ -115,7 +116,7 @@ const WaterfallFlowItem = (props) => {
|
|
115
116
|
__html: (0, tool_1.setFontForText)(title, textStyles === null || textStyles === void 0 ? void 0 : textStyles.title)
|
116
117
|
} }),
|
117
118
|
react_1.default.createElement("div", { className: 'list-content-listItem-info-price', style: textStyles === null || textStyles === void 0 ? void 0 : textStyles.price, hidden: !priceText, dangerouslySetInnerHTML: {
|
118
|
-
__html:
|
119
|
+
__html: priceText !== null && priceText !== void 0 ? priceText : ''
|
119
120
|
} }))));
|
120
121
|
};
|
121
122
|
function WaterfallList(_a) {
|
@@ -66,7 +66,8 @@ const WaterfallFlowItem = (props) => {
|
|
66
66
|
product: rec === null || rec === void 0 ? void 0 : rec.product,
|
67
67
|
enableFormattedPrice: (_a = textStyles === null || textStyles === void 0 ? void 0 : textStyles.price) === null || _a === void 0 ? void 0 : _a.enableFormattedPrice,
|
68
68
|
globalConfig,
|
69
|
-
isHiddenDef: true
|
69
|
+
isHiddenDef: true,
|
70
|
+
style: textStyles === null || textStyles === void 0 ? void 0 : textStyles.price
|
70
71
|
});
|
71
72
|
(0, react_1.useEffect)(() => {
|
72
73
|
if (imgDom.current === null || src === '') {
|
@@ -107,7 +108,7 @@ const WaterfallFlowItem = (props) => {
|
|
107
108
|
__html: (0, tool_1.setFontForText)(title, textStyles === null || textStyles === void 0 ? void 0 : textStyles.title)
|
108
109
|
} }),
|
109
110
|
react_1.default.createElement("div", { className: 'waterFallList-content-listItem-info-price', hidden: !priceText, style: textStyles.price, dangerouslySetInnerHTML: {
|
110
|
-
__html:
|
111
|
+
__html: priceText !== null && priceText !== void 0 ? priceText : ''
|
111
112
|
} }))));
|
112
113
|
};
|
113
114
|
function WaterfallList(_a) {
|
@@ -89,7 +89,6 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
89
89
|
if (document.visibilityState === 'hidden') {
|
90
90
|
if (repCond) {
|
91
91
|
event_1.default.emit(event_1.SXP_EVENT_TYPE.PAGE_DID_HIDE, item);
|
92
|
-
handleReportViewImageEnd(item);
|
93
92
|
handleReportProductView(item);
|
94
93
|
}
|
95
94
|
let fromKName = '';
|
@@ -133,7 +132,6 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
133
132
|
}
|
134
133
|
handleH5EnterLink();
|
135
134
|
if (repCond) {
|
136
|
-
handleViewImageStartEvent(activeIndex);
|
137
135
|
event_1.default.emit(event_1.SXP_EVENT_TYPE.PAGE_DID_SHOW, item);
|
138
136
|
backMainFeed('external', selectTag);
|
139
137
|
}
|
@@ -362,7 +360,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
362
360
|
}
|
363
361
|
};
|
364
362
|
const handleScrollEvent = (swiper) => {
|
365
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
363
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
366
364
|
const item = data[swiper.previousIndex];
|
367
365
|
if (!item)
|
368
366
|
return;
|
@@ -383,7 +381,8 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
383
381
|
productId: (_g = (_f = item === null || item === void 0 ? void 0 : item.product) === null || _f === void 0 ? void 0 : _f.itemId) !== null && _g !== void 0 ? _g : '',
|
384
382
|
requestId: null,
|
385
383
|
traceInfo: (_j = (_h = item === null || item === void 0 ? void 0 : item.video) === null || _h === void 0 ? void 0 : _h.traceInfo) !== null && _j !== void 0 ? _j : '',
|
386
|
-
contentFormat
|
384
|
+
contentFormat,
|
385
|
+
position: ((_k = swiper.previousIndex) !== null && _k !== void 0 ? _k : 0) + ''
|
387
386
|
}
|
388
387
|
});
|
389
388
|
handleReportViewImageEnd(item);
|
@@ -394,11 +393,12 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
394
393
|
eventInfo: {
|
395
394
|
eventSubject: 'scrollUp',
|
396
395
|
eventDescription: 'User scroll up',
|
397
|
-
contentId: (
|
398
|
-
productId: (
|
396
|
+
contentId: (_m = (_l = item === null || item === void 0 ? void 0 : item.video) === null || _l === void 0 ? void 0 : _l.itemId) !== null && _m !== void 0 ? _m : '',
|
397
|
+
productId: (_p = (_o = item.product) === null || _o === void 0 ? void 0 : _o.itemId) !== null && _p !== void 0 ? _p : '',
|
399
398
|
requestId: null,
|
400
|
-
traceInfo: (
|
401
|
-
contentFormat
|
399
|
+
traceInfo: (_r = (_q = item === null || item === void 0 ? void 0 : item.video) === null || _q === void 0 ? void 0 : _q.traceInfo) !== null && _r !== void 0 ? _r : '',
|
400
|
+
contentFormat,
|
401
|
+
position: ((_s = swiper.previousIndex) !== null && _s !== void 0 ? _s : 0) + ''
|
402
402
|
}
|
403
403
|
});
|
404
404
|
handleReportViewImageEnd(item);
|
@@ -421,7 +421,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
421
421
|
viewTime.current = new Date();
|
422
422
|
}
|
423
423
|
}, [openHashtag, data, activeIndex]);
|
424
|
-
const handleViewImageStartEvent = (activeIndex) => {
|
424
|
+
const handleViewImageStartEvent = (activeIndex, imgInfo) => {
|
425
425
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
426
426
|
const item = data[activeIndex];
|
427
427
|
if (!((_a = item === null || item === void 0 ? void 0 : item.video) === null || _a === void 0 ? void 0 : _a.url) && ((_b = item === null || item === void 0 ? void 0 : item.video) === null || _b === void 0 ? void 0 : _b.imgUrls)) {
|
@@ -437,7 +437,9 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
437
437
|
contentTags: JSON.stringify((_f = item === null || item === void 0 ? void 0 : item.video.tags) !== null && _f !== void 0 ? _f : []),
|
438
438
|
position: activeIndex + '',
|
439
439
|
contentFormat: 'image',
|
440
|
-
traceInfo: item === null || item === void 0 ? void 0 : item.video.traceInfo
|
440
|
+
traceInfo: item === null || item === void 0 ? void 0 : item.video.traceInfo,
|
441
|
+
contentSize: imgInfo === null || imgInfo === void 0 ? void 0 : imgInfo.contentSize,
|
442
|
+
loadTime: imgInfo === null || imgInfo === void 0 ? void 0 : imgInfo.loadTime
|
441
443
|
}
|
442
444
|
});
|
443
445
|
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
@@ -11,9 +11,15 @@ export declare const getBgStyleByImg: (data: any) => "" | {
|
|
11
11
|
backgroundRepeat: string;
|
12
12
|
backgroundSize: string;
|
13
13
|
};
|
14
|
-
|
14
|
+
interface IfontType {
|
15
|
+
'fontFamily-cn': string;
|
16
|
+
'fontFamily-en': string;
|
17
|
+
}
|
18
|
+
export declare const getPriceText: ({ product, enableFormattedPrice, globalConfig, isHiddenDef, style }: {
|
15
19
|
product: ProductInfoType | undefined | null;
|
16
20
|
enableFormattedPrice: boolean | undefined;
|
17
21
|
globalConfig: ISxpPageRenderProps['globalConfig'];
|
18
22
|
isHiddenDef?: boolean;
|
23
|
+
style?: IfontType | any;
|
19
24
|
}) => string | null;
|
25
|
+
export {};
|
@@ -1,6 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.getPriceText = exports.getBgStyleByImg = exports.getBgStyle = exports.getMediaValueByMode = void 0;
|
4
|
+
const tool_1 = require("./tool");
|
4
5
|
const getMediaValueByMode = (obj) => {
|
5
6
|
var _a;
|
6
7
|
if (!obj || typeof obj !== 'object') {
|
@@ -35,8 +36,8 @@ const getBgStyleByImg = (data) => {
|
|
35
36
|
return (0, exports.getBgStyle)(imgSrc);
|
36
37
|
};
|
37
38
|
exports.getBgStyleByImg = getBgStyleByImg;
|
38
|
-
const getPriceText = ({ product, enableFormattedPrice, globalConfig, isHiddenDef }) => {
|
39
|
-
var _a, _b, _c, _d, _e;
|
39
|
+
const getPriceText = ({ product, enableFormattedPrice, globalConfig, isHiddenDef, style }) => {
|
40
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
40
41
|
if ((!(product === null || product === void 0 ? void 0 : product.currency) || !(product === null || product === void 0 ? void 0 : product.price)) && isHiddenDef)
|
41
42
|
return null;
|
42
43
|
let price = (product === null || product === void 0 ? void 0 : product.currency) && (product === null || product === void 0 ? void 0 : product.price) ? product === null || product === void 0 ? void 0 : product.price : 7000;
|
@@ -83,6 +84,8 @@ const getPriceText = ({ product, enableFormattedPrice, globalConfig, isHiddenDef
|
|
83
84
|
}
|
84
85
|
});
|
85
86
|
}
|
87
|
+
currency = `<span style="font-family:${(_h = (_g = (_f = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.priceSymbol) === null || _f === void 0 ? void 0 : _f.fontFamily) !== null && _g !== void 0 ? _g : style === null || style === void 0 ? void 0 : style['fontFamily-en']) !== null && _h !== void 0 ? _h : 'inherit'}">${currency}</span>`;
|
88
|
+
text = (0, tool_1.setFontForText)(text, style);
|
86
89
|
if ((priceSymbol === null || priceSymbol === void 0 ? void 0 : priceSymbol.currencyPosition) && (priceSymbol === null || priceSymbol === void 0 ? void 0 : priceSymbol.currencyPosition) !== 'none') {
|
87
90
|
text = (priceSymbol === null || priceSymbol === void 0 ? void 0 : priceSymbol.currencyPosition) === 'left' ? currency + text : text + currency;
|
88
91
|
}
|
package/lib/core/utils/tool.d.ts
CHANGED
@@ -11,4 +11,5 @@ declare function getBrowserInfo(): string | null;
|
|
11
11
|
declare function getSystem(): string | null;
|
12
12
|
declare function getDevice(): string | null;
|
13
13
|
declare function getCookie(val: string): string;
|
14
|
-
|
14
|
+
declare const getResFileSizeFromSrc: (imageSrc?: string) => "" | Promise<string>;
|
15
|
+
export { uuid, getIndexByblockType, getBrowserInfo, getDevice, getSystem, getCookie, getResFileSizeFromSrc };
|
package/lib/core/utils/tool.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.getCookie = exports.getSystem = exports.getDevice = exports.getBrowserInfo = exports.getIndexByblockType = exports.uuid = exports.setFontForText = exports.getUid = exports.generateRandomString = void 0;
|
3
|
+
exports.getResFileSizeFromSrc = exports.getCookie = exports.getSystem = exports.getDevice = exports.getBrowserInfo = exports.getIndexByblockType = exports.uuid = exports.setFontForText = exports.getUid = exports.generateRandomString = void 0;
|
4
4
|
const uuid_1 = require("uuid");
|
5
5
|
function uuid(len, radix) {
|
6
6
|
const chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split('');
|
@@ -168,3 +168,14 @@ function getCookie(val) {
|
|
168
168
|
return value !== null && value !== void 0 ? value : '';
|
169
169
|
}
|
170
170
|
exports.getCookie = getCookie;
|
171
|
+
const getResFileSizeFromSrc = (imageSrc) => {
|
172
|
+
if (!imageSrc)
|
173
|
+
return '';
|
174
|
+
return fetch(imageSrc)
|
175
|
+
.then((response) => response.blob())
|
176
|
+
.then((blob) => {
|
177
|
+
const fileSizeInMB = blob.size / (1024 * 1024);
|
178
|
+
return fileSizeInMB.toFixed(2) + '';
|
179
|
+
});
|
180
|
+
};
|
181
|
+
exports.getResFileSizeFromSrc = getResFileSizeFromSrc;
|
@@ -9,6 +9,7 @@ declare const _default: ({
|
|
9
9
|
addonAfter: string;
|
10
10
|
}[];
|
11
11
|
name?: undefined;
|
12
|
+
addonAfter?: undefined;
|
12
13
|
direction?: undefined;
|
13
14
|
} | {
|
14
15
|
type: string;
|
@@ -25,12 +26,21 @@ declare const _default: ({
|
|
25
26
|
max: number;
|
26
27
|
})[];
|
27
28
|
name?: undefined;
|
29
|
+
addonAfter?: undefined;
|
28
30
|
direction?: undefined;
|
29
31
|
} | {
|
30
32
|
type: string;
|
31
33
|
label: string;
|
32
34
|
name: string[];
|
33
35
|
child?: undefined;
|
36
|
+
addonAfter?: undefined;
|
37
|
+
direction?: undefined;
|
38
|
+
} | {
|
39
|
+
type: string;
|
40
|
+
label: string;
|
41
|
+
name: string[];
|
42
|
+
addonAfter: string;
|
43
|
+
child?: undefined;
|
34
44
|
direction?: undefined;
|
35
45
|
} | {
|
36
46
|
type: string;
|
@@ -38,6 +48,7 @@ declare const _default: ({
|
|
38
48
|
label: string;
|
39
49
|
direction: string;
|
40
50
|
child?: undefined;
|
51
|
+
addonAfter?: undefined;
|
41
52
|
})[];
|
42
53
|
} | {
|
43
54
|
title: string;
|
@@ -70,7 +70,8 @@ const CommodityDetail = (_a) => {
|
|
70
70
|
const priceText = (0, materials_1.getPriceText)({
|
71
71
|
product: product,
|
72
72
|
enableFormattedPrice: (_t = commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price) === null || _t === void 0 ? void 0 : _t.enableFormattedPrice,
|
73
|
-
globalConfig
|
73
|
+
globalConfig,
|
74
|
+
style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price
|
74
75
|
});
|
75
76
|
const width = (isPreview ? 375 : (_u = style === null || style === void 0 ? void 0 : style.width) !== null && _u !== void 0 ? _u : window.innerWidth) - ((_v = popupBg === null || popupBg === void 0 ? void 0 : popupBg.horizontalMargin) !== null && _v !== void 0 ? _v : 0) * 2;
|
76
77
|
const height = commodityImgRatio ? width * (commodityImgRatio.h / commodityImgRatio.w) : width;
|
@@ -84,7 +85,7 @@ const CommodityDetail = (_a) => {
|
|
84
85
|
__html: (0, tool_1.setFontForText)((_b = product === null || product === void 0 ? void 0 : product.title) !== null && _b !== void 0 ? _b : 'Pendant in Yellow Gold with Diamonds, Medium', commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.title)
|
85
86
|
} }),
|
86
87
|
react_1.default.createElement("div", { className: 'pb-commondity-content-price', style: getStyle(commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price), hidden: !!product && !(product === null || product === void 0 ? void 0 : product.price), dangerouslySetInnerHTML: {
|
87
|
-
__html:
|
88
|
+
__html: priceText !== null && priceText !== void 0 ? priceText : ''
|
88
89
|
} }),
|
89
90
|
react_1.default.createElement("div", { hidden: !!product && !(product === null || product === void 0 ? void 0 : product.taxInfo), style: getStyle(commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.taxInfo), dangerouslySetInnerHTML: {
|
90
91
|
__html: (0, tool_1.setFontForText)((_c = product === null || product === void 0 ? void 0 : product.taxInfo) !== null && _c !== void 0 ? _c : '税费', commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.taxInfo)
|
@@ -76,7 +76,8 @@ const CommodityDetailDiroNew = (_a) => {
|
|
76
76
|
const priceText = (0, materials_1.getPriceText)({
|
77
77
|
product,
|
78
78
|
enableFormattedPrice: (_t = commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price) === null || _t === void 0 ? void 0 : _t.enableFormattedPrice,
|
79
|
-
globalConfig
|
79
|
+
globalConfig,
|
80
|
+
style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price
|
80
81
|
});
|
81
82
|
const width = (isPreview ? 375 : (_u = style === null || style === void 0 ? void 0 : style.width) !== null && _u !== void 0 ? _u : window.innerWidth) - ((_v = popupBg === null || popupBg === void 0 ? void 0 : popupBg.horizontalMargin) !== null && _v !== void 0 ? _v : 0) * 2;
|
82
83
|
const height = commodityImgRatio ? width * (commodityImgRatio.h / commodityImgRatio.w) : width;
|
@@ -190,7 +191,7 @@ Made in Italy` })));
|
|
190
191
|
} })),
|
191
192
|
react_1.default.createElement("div", { className: 'pb-commondityDiroNew-content-top-right' },
|
192
193
|
react_1.default.createElement("div", { className: 'pb-commondityDiroNew-content-top-right-price', hidden: !!product && !(product === null || product === void 0 ? void 0 : product.price), style: getStyle(commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price), dangerouslySetInnerHTML: {
|
193
|
-
__html:
|
194
|
+
__html: priceText !== null && priceText !== void 0 ? priceText : ''
|
194
195
|
} }),
|
195
196
|
react_1.default.createElement("div", { className: 'pb-commondityDiroNew-content-top-right-price', hidden: !!product && !(product === null || product === void 0 ? void 0 : product.taxInfo), style: getStyle(commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.taxInfo), dangerouslySetInnerHTML: {
|
196
197
|
__html: (0, tool_1.setFontForText)((_2 = product === null || product === void 0 ? void 0 : product.taxInfo) !== null && _2 !== void 0 ? _2 : '税费', commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.taxInfo)
|
@@ -24,7 +24,8 @@ const CommodityList = (_a) => {
|
|
24
24
|
return (0, materials_1.getPriceText)({
|
25
25
|
product,
|
26
26
|
enableFormattedPrice: (_a = commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price) === null || _a === void 0 ? void 0 : _a.enableFormattedPrice,
|
27
|
-
globalConfig
|
27
|
+
globalConfig,
|
28
|
+
style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price
|
28
29
|
});
|
29
30
|
}, [(_d = commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price) === null || _d === void 0 ? void 0 : _d.enableFormattedPrice, globalConfig]);
|
30
31
|
const handleClick = (0, lodash_1.throttle)((item, multiCheckIndex) => {
|
@@ -49,7 +50,7 @@ const CommodityList = (_a) => {
|
|
49
50
|
});
|
50
51
|
}, []);
|
51
52
|
return (react_1.default.createElement("div", { className: (0, css_1.css)(Object.assign(Object.assign({}, style), { display: 'flex', flexDirection: 'column', gap: '10px', padding: '0 20px', marginTop: '50px', boxSizing: 'border-box' })) }, product === null || product === void 0 ? void 0 : product.map((item, index) => {
|
52
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
53
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
53
54
|
return (react_1.default.createElement(react_1.default.Fragment, null, recData && !(item === null || item === void 0 ? void 0 : item.bindCta) ? null : (react_1.default.createElement("div", Object.assign({ key: index }, props, { className: (0, css_1.css)({
|
54
55
|
display: 'flex'
|
55
56
|
}), onClick: () => handleClick(item, index) }),
|
@@ -76,10 +77,10 @@ const CommodityList = (_a) => {
|
|
76
77
|
}) },
|
77
78
|
react_1.default.createElement("div", null,
|
78
79
|
react_1.default.createElement("div", { style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price, hidden: !!item && !(item === null || item === void 0 ? void 0 : item.price), dangerouslySetInnerHTML: {
|
79
|
-
__html: (
|
80
|
+
__html: (_j = priceText(item)) !== null && _j !== void 0 ? _j : ''
|
80
81
|
} })),
|
81
82
|
react_1.default.createElement("div", { className: 'one-line-ellipsis', style: Object.assign(Object.assign({}, buttonStyle), { padding: '0 15px' }), dangerouslySetInnerHTML: {
|
82
|
-
__html: (0, tool_1.setFontForText)((
|
83
|
+
__html: (0, tool_1.setFontForText)((_l = (_k = item === null || item === void 0 ? void 0 : item.bindCta) === null || _k === void 0 ? void 0 : _k.enTitle) !== null && _l !== void 0 ? _l : 'Shop Now', buttonStyle)
|
83
84
|
} })))))));
|
84
85
|
})));
|
85
86
|
};
|