pb-sxp-ui 1.0.33 → 1.0.35

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.
Files changed (46) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +111 -111
  3. package/dist/index.cjs +449 -104
  4. package/dist/index.cjs.map +1 -1
  5. package/dist/index.css +6 -1
  6. package/dist/index.js +448 -104
  7. package/dist/index.js.map +1 -1
  8. package/dist/index.min.cjs +3 -3
  9. package/dist/index.min.cjs.map +1 -1
  10. package/dist/index.min.js +3 -3
  11. package/dist/index.min.js.map +1 -1
  12. package/dist/pb-ui.js +452 -108
  13. package/dist/pb-ui.js.map +1 -1
  14. package/dist/pb-ui.min.js +3 -3
  15. package/dist/pb-ui.min.js.map +1 -1
  16. package/es/core/components/DiyPortalPreview/PictureGroup.d.ts +13 -0
  17. package/es/core/components/DiyPortalPreview/PictureGroup.js +11 -0
  18. package/es/core/components/DiyPortalPreview/VideoWidget.d.ts +15 -0
  19. package/es/core/components/DiyPortalPreview/VideoWidget.js +236 -0
  20. package/es/core/components/DiyPortalPreview/index.d.ts +6 -0
  21. package/es/core/components/DiyPortalPreview/index.js +112 -0
  22. package/es/core/components/SxpPageRender/VideoWidget/index.js +55 -56
  23. package/es/core/components/SxpPageRender/WaterFall/index.js +1 -1
  24. package/es/core/components/SxpPageRender/index.js +7 -7
  25. package/es/core/context/SxpDataSourceProvider.js +1 -1
  26. package/es/core/hooks/useEventReport.js +4 -4
  27. package/es/index.d.ts +1 -0
  28. package/es/index.js +1 -0
  29. package/es/materials/sxp/popup/CommodityDetail/index.js +10 -10
  30. package/es/materials/sxp/popup/CommodityDetailDiroNew/index.js +10 -10
  31. package/lib/core/components/DiyPortalPreview/PictureGroup.d.ts +13 -0
  32. package/lib/core/components/DiyPortalPreview/PictureGroup.js +14 -0
  33. package/lib/core/components/DiyPortalPreview/VideoWidget.d.ts +15 -0
  34. package/lib/core/components/DiyPortalPreview/VideoWidget.js +239 -0
  35. package/lib/core/components/DiyPortalPreview/index.d.ts +6 -0
  36. package/lib/core/components/DiyPortalPreview/index.js +115 -0
  37. package/lib/core/components/SxpPageRender/VideoWidget/index.js +55 -56
  38. package/lib/core/components/SxpPageRender/WaterFall/index.js +1 -1
  39. package/lib/core/components/SxpPageRender/index.js +7 -7
  40. package/lib/core/context/SxpDataSourceProvider.js +1 -1
  41. package/lib/core/hooks/useEventReport.js +4 -4
  42. package/lib/index.d.ts +1 -0
  43. package/lib/index.js +3 -1
  44. package/lib/materials/sxp/popup/CommodityDetail/index.js +10 -10
  45. package/lib/materials/sxp/popup/CommodityDetailDiroNew/index.js +10 -10
  46. package/package.json +115 -114
@@ -0,0 +1,115 @@
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 PictureGroup_1 = tslib_1.__importDefault(require("./PictureGroup"));
13
+ const VideoWidget_1 = tslib_1.__importDefault(require("./VideoWidget"));
14
+ const _materials_ = tslib_1.__importStar(require("../../../materials"));
15
+ const withBindDataSource_1 = tslib_1.__importDefault(require("../../../core/hoc/withBindDataSource"));
16
+ const RESOLVER = {};
17
+ Object.values(_materials_).forEach((v) => {
18
+ RESOLVER[v.extend.type] = v;
19
+ });
20
+ const defaultUnLikeIconPath = '/pb_static/f71266d2c64446c5ae6a5a7f5489cc0a.png';
21
+ const defaultLikeIconPath = '/pb_static/f07900fe3f0f4ae188ea1611d4801a44.png';
22
+ const DiyPortalPreview = ({ data, globalConfig, tipText, nudge, tempMap, descStyle, hashTagStyle, containerHeight = 664, containerWidth = 375, appDomain }) => {
23
+ const height = (0, react_1.useMemo)(() => {
24
+ return (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.logoUrl) && (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowLogo) ? containerHeight - 45 : containerHeight;
25
+ }, [globalConfig, containerHeight]);
26
+ const renderContent = (rec, index) => {
27
+ var _a, _b, _c, _d;
28
+ if ((_a = rec.video) === null || _a === void 0 ? void 0 : _a.url) {
29
+ 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 }));
30
+ }
31
+ if ((_b = rec.video) === null || _b === void 0 ? void 0 : _b.imgUrls) {
32
+ 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 }));
33
+ }
34
+ if (rec.product) {
35
+ 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) {
36
+ return (_d = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.productPost) === null || _d === void 0 ? void 0 : _d.map((value, idx) => {
37
+ var _a, _b, _c, _d, _e, _f, _g, _h;
38
+ const t = RESOLVER[(_a = value === null || value === void 0 ? void 0 : value.item) === null || _a === void 0 ? void 0 : _a.type];
39
+ const Component = (0, withBindDataSource_1.default)(t);
40
+ const defaulSetting = (_b = t === null || t === void 0 ? void 0 : t.extend) === null || _b === void 0 ? void 0 : _b.defaulSetting;
41
+ 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 })));
42
+ });
43
+ }
44
+ }
45
+ };
46
+ const renderLogo = (0, react_1.useMemo)(() => {
47
+ if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.logoUrl) && (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowLogo)) {
48
+ return (react_1.default.createElement("div", { className: 'clc-sxp-logo-banner', style: { backgroundColor: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.color } },
49
+ react_1.default.createElement("img", { src: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.logoUrl, alt: 'logo' })));
50
+ }
51
+ return null;
52
+ }, [globalConfig]);
53
+ const renderBottom = (rec, index) => {
54
+ var _a, _b, _c, _d, _e, _f, _g;
55
+ if (rec.video) {
56
+ return (react_1.default.createElement(react_1.default.Fragment, null,
57
+ ((_a = rec.video) === null || _a === void 0 ? void 0 : _a.title) && react_1.default.createElement("div", { className: 'clc-sxp-bottom-shadow' }),
58
+ react_1.default.createElement("div", { className: 'clc-sxp-bottom' },
59
+ react_1.default.createElement(Nudge_1.default, { nudge: nudge }),
60
+ react_1.default.createElement("div", { className: 'clc-sxp-bottom-card' },
61
+ react_1.default.createElement(RenderCard_1.default, { rec: rec, index: index, tempMap: tempMap, resolver: RESOLVER })),
62
+ react_1.default.createElement("div", null,
63
+ 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' }) })),
64
+ 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 }))));
65
+ }
66
+ return null;
67
+ };
68
+ const likeIcon = (0, useIconLink_1.useIconLink)(defaultLikeIconPath, appDomain);
69
+ const unlikeIcon = (0, useIconLink_1.useIconLink)(defaultUnLikeIconPath, appDomain);
70
+ const renderLikeButton = (rec, index) => {
71
+ var _a, _b, _c, _d;
72
+ if (!(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowLike))
73
+ return;
74
+ let top = (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIconY) !== null && _a !== void 0 ? _a : 400;
75
+ if (top < 40) {
76
+ top += 40;
77
+ }
78
+ if (rec.video) {
79
+ 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: {
80
+ top,
81
+ right: (_d = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIconX) !== null && _d !== void 0 ? _d : 0
82
+ } }));
83
+ }
84
+ return null;
85
+ };
86
+ const mutedIcon = (0, useIconLink_1.useIconLink)('/pb_static/5beaaa5ce7f3477b99db3838619cc471.png', appDomain);
87
+ const unmutedIcon = (0, useIconLink_1.useIconLink)('/pb_static/fea8668a8a894e4aa3a86bcc775e895e.png', appDomain);
88
+ const renderView = (rec, index) => {
89
+ var _a, _b, _c, _d;
90
+ return (react_1.default.createElement("div", { style: { position: 'relative' } },
91
+ renderLogo,
92
+ react_1.default.createElement(ToggleButton_1.default, { style: {
93
+ position: 'absolute',
94
+ right: (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconX) !== null && _a !== void 0 ? _a : 0,
95
+ 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',
96
+ bottom: (_d = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconY) !== null && _d !== void 0 ? _d : 23,
97
+ zIndex: 999
98
+ }, 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 }),
99
+ renderContent(rec, index),
100
+ renderBottom(rec, index),
101
+ renderLikeButton(rec, index)));
102
+ };
103
+ return (react_1.default.createElement("div", { style: {
104
+ width: '100%',
105
+ height: containerHeight,
106
+ display: 'flex',
107
+ boxSizing: 'border-box',
108
+ gap: 16,
109
+ pointerEvents: 'none',
110
+ userSelect: 'none'
111
+ } }, data === null || data === void 0 ? void 0 : data.map((rec, index) => {
112
+ return renderView(rec, index);
113
+ })));
114
+ };
115
+ exports.default = (0, react_1.memo)(DiyPortalPreview);
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  const react_1 = tslib_1.__importStar(require("react"));
5
5
  const react_2 = require("swiper/react");
6
+ const hls_js_1 = tslib_1.__importDefault(require("hls.js"));
6
7
  const useIconLink_1 = require("../useIconLink");
7
8
  const FormatImage_1 = tslib_1.__importDefault(require("../FormatImage"));
8
9
  const hooks_1 = require("../../../../core/hooks");
@@ -17,13 +18,12 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
17
18
  const { isActive } = (0, react_2.useSwiperSlide)();
18
19
  const canvasRef = (0, react_1.useRef)(null);
19
20
  const [firstFrameSrc, setFirstFrameSrc] = (0, react_1.useState)('');
20
- const videoId = `pb-video-${index}`;
21
21
  (0, react_1.useEffect)(() => {
22
22
  if (!videoRef.current)
23
23
  return;
24
- videoRef.current.muted(muted);
24
+ videoRef.current.muted = muted;
25
25
  }, [muted]);
26
- const handleEnded = (0, react_1.useCallback)(() => {
26
+ const handleVideoStart = (0, react_1.useCallback)(() => {
27
27
  var _a;
28
28
  (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.play();
29
29
  }, []);
@@ -32,10 +32,10 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
32
32
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
33
33
  setIsPauseVideo(false);
34
34
  const item = data[index];
35
- if (item && ((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.duration())) {
36
- videoStartTime.current = ((_b = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _b === void 0 ? void 0 : _b.currentTime()) || 0;
37
- const videoDuration = ((_d = (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.duration()) !== null && _d !== void 0 ? _d : 0).toFixed(2);
38
- const videoCurrentTime = ((_f = (_e = videoRef.current) === null || _e === void 0 ? void 0 : _e.currentTime()) !== null && _f !== void 0 ? _f : 0).toFixed(2);
35
+ if (item && ((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.duration)) {
36
+ videoStartTime.current = ((_b = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _b === void 0 ? void 0 : _b.currentTime) || 0;
37
+ const videoDuration = ((_d = (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.duration) !== null && _d !== void 0 ? _d : 0).toFixed(2);
38
+ const videoCurrentTime = ((_f = (_e = videoRef.current) === null || _e === void 0 ? void 0 : _e.currentTime) !== null && _f !== void 0 ? _f : 0).toFixed(2);
39
39
  const playType = isFirstPlay ? '0' : '1';
40
40
  bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
41
41
  eventInfo: {
@@ -55,14 +55,14 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
55
55
  setIsFirstPlay(false);
56
56
  }
57
57
  }, [bffEventReport, data, index, isFirstPlay]);
58
- const handleCanplay = (0, react_1.useCallback)(() => {
58
+ const handleLoadedMetadata = (0, react_1.useCallback)(() => {
59
59
  setIsLoadFinish(true);
60
60
  }, []);
61
61
  const handleClickVideo = (0, react_1.useCallback)((type) => () => {
62
62
  var _a, _b, _c, _d, _e;
63
63
  if (!isLoadFinish)
64
64
  return;
65
- const isPause = (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.paused();
65
+ const isPause = (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.paused;
66
66
  switch (type) {
67
67
  case 'start':
68
68
  if (!isPause)
@@ -87,13 +87,13 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
87
87
  break;
88
88
  }
89
89
  }, [isLoadFinish]);
90
- const handlePause = (0, react_1.useCallback)(() => {
90
+ const onPause = (0, react_1.useCallback)(() => {
91
91
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
92
92
  const item = data[index];
93
- const videoDuration = ((_b = (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.duration()) !== null && _b !== void 0 ? _b : 0).toFixed(2);
94
- const videoCurrentTime = ((_d = (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.currentTime()) !== null && _d !== void 0 ? _d : 0).toFixed(2);
95
- if ((_e = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _e === void 0 ? void 0 : _e.duration()) {
96
- const playDuration = (((_f = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _f === void 0 ? void 0 : _f.currentTime()) - videoStartTime.current).toFixed(2);
93
+ const videoDuration = ((_b = (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.duration) !== null && _b !== void 0 ? _b : 0).toFixed(2);
94
+ const videoCurrentTime = ((_d = (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.currentTime) !== null && _d !== void 0 ? _d : 0).toFixed(2);
95
+ if ((_e = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _e === void 0 ? void 0 : _e.duration) {
96
+ const playDuration = (((_f = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _f === void 0 ? void 0 : _f.currentTime) - videoStartTime.current).toFixed(2);
97
97
  bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
98
98
  eventInfo: {
99
99
  eventSubject: 'playOverVideo',
@@ -125,10 +125,9 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
125
125
  return ((_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.cover) || firstFrameSrc;
126
126
  }, [firstFrameSrc, rec]);
127
127
  const handLoadeddata = (0, react_1.useCallback)(() => {
128
- const videoDomRef = document.getElementById(`${videoId}_html5_api`);
129
- if (!canvasRef || !videoDomRef || !canvasRef.current)
128
+ if (!canvasRef || !videoRef || !videoRef.current || !canvasRef.current)
130
129
  return;
131
- const video = videoDomRef;
130
+ const video = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current;
132
131
  const canvas = canvasRef === null || canvasRef === void 0 ? void 0 : canvasRef.current;
133
132
  const ctx = canvas.getContext('2d');
134
133
  const targetWidth = window === null || window === void 0 ? void 0 : window.innerWidth;
@@ -139,35 +138,43 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
139
138
  setFirstFrameSrc(canvas.toDataURL());
140
139
  }, []);
141
140
  (0, react_1.useEffect)(() => {
142
- var _a, _b, _c, _d, _e, _f;
143
- if (videoRef.current)
141
+ var _a, _b, _c, _d;
142
+ if (!videoRef.current)
144
143
  return;
145
144
  setIsPauseVideo(false);
146
- const videoSrc = rec.video.url;
147
- if (videoSrc && typeof TCPlayer === 'function') {
148
- videoRef.current = TCPlayer(videoId, {
149
- sources: [
150
- {
151
- src: videoSrc
152
- }
153
- ],
154
- licenseUrl: 'https://license.vod2.myqcloud.com/license/v2/1325816236_1/v_cube.license',
155
- controls: false,
156
- autoplay: false,
157
- loop: false,
158
- muted: true,
159
- preload: 'meta',
160
- posterImage: false,
161
- bigPlayButton: true
162
- });
145
+ if (!videoRef.current.src) {
146
+ const videoSrc = rec.video.url;
147
+ if (videoSrc.includes('.m3u8')) {
148
+ if (hls_js_1.default.isSupported()) {
149
+ const hls = new hls_js_1.default();
150
+ hls.loadSource(videoSrc);
151
+ hls.attachMedia(videoRef.current);
152
+ }
153
+ else if (videoRef.current.canPlayType('application/vnd.apple.mpegurl')) {
154
+ videoRef.current.src = videoSrc;
155
+ }
156
+ else {
157
+ videoRef.current.src = videoSrc;
158
+ }
159
+ }
160
+ else {
161
+ videoRef.current.src = videoSrc;
162
+ }
163
+ videoRef.current.setAttribute('x5-playsinline', 'true');
164
+ videoRef.current.setAttribute('webkit-playsinline', 'true');
163
165
  }
164
- (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.on('loadedmetadata', handleCanplay);
165
- (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.on('canplay', handleCanplay);
166
- (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.on('playing', handlePlaying);
167
- (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.on('loadeddata', handLoadeddata);
168
- (_e = videoRef.current) === null || _e === void 0 ? void 0 : _e.on('pause', handlePause);
169
- (_f = videoRef.current) === null || _f === void 0 ? void 0 : _f.on('ended', handleEnded);
170
- }, [handleCanplay, handlePlaying, rec.video, handLoadeddata, index, handlePause, handleEnded, videoId]);
166
+ (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.addEventListener('loadedmetadata', handleLoadedMetadata);
167
+ (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.addEventListener('canplay', handleLoadedMetadata);
168
+ (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.addEventListener('playing', handlePlaying);
169
+ (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.addEventListener('loadeddata', handLoadeddata);
170
+ return () => {
171
+ var _a, _b, _c, _d;
172
+ (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('loadedmetadata', handleLoadedMetadata);
173
+ (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.removeEventListener('canplay', handleLoadedMetadata);
174
+ (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.removeEventListener('playing', handlePlaying);
175
+ (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.removeEventListener('loadeddata', handLoadeddata);
176
+ };
177
+ }, [handleLoadedMetadata, handlePlaying, rec.video, handLoadeddata]);
171
178
  (0, react_1.useEffect)(() => {
172
179
  var _a;
173
180
  if (!(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) || !isLoadFinish)
@@ -250,27 +257,19 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
250
257
  right: 0
251
258
  } },
252
259
  react_1.default.createElement("div", { style: { position: 'relative', width: '100%', height: '100%' } },
253
- react_1.default.createElement("video", { id: `pb-video-${index}`, playsInline: true, crossOrigin: 'anonymous', style: {
260
+ react_1.default.createElement("video", { id: `pb-video-${index}`, className: 'clc-pb-video', ref: videoRef, crossOrigin: 'anonymous', muted: true, controls: false, playsInline: true, preload: 'auto', onPause: onPause, onEnded: handleVideoStart, style: {
254
261
  width: '100%',
255
262
  height: '100%',
256
- objectFit: 'contain',
257
- backgroundColor: 'transparent',
258
- pointerEvents: 'none'
263
+ objectFit: 'contain'
259
264
  } }),
260
265
  react_1.default.createElement("img", { hidden: !isPauseVideo, className: 'clc-pb-video-pause', src: PAUSE_ICON }))),
261
- renderPoster)) : (react_1.default.createElement("div", { className: 'video-container', key: rec.video.itemId, style: {
266
+ renderPoster)) : (react_1.default.createElement("div", { className: 'video-container', key: rec.video.itemId, onClick: handleClickVideo(), style: {
262
267
  position: 'relative',
263
268
  width: '100%',
264
269
  height,
265
270
  overflow: 'hidden'
266
- }, onClick: handleClickVideo() },
267
- react_1.default.createElement("video", { id: `pb-video-${index}`, playsInline: true, crossOrigin: 'anonymous', style: {
268
- backgroundColor: 'transparent',
269
- width: '100%',
270
- height: '100%',
271
- objectFit: 'cover',
272
- pointerEvents: 'none'
273
- } }),
271
+ } },
272
+ react_1.default.createElement("video", { id: `pb-video-${index}`, className: 'clc-pb-video', ref: videoRef, crossOrigin: 'anonymous', muted: true, controls: false, playsInline: true, preload: 'auto', onPause: onPause, onEnded: handleVideoStart }),
274
273
  renderPoster,
275
274
  react_1.default.createElement("img", { hidden: !isPauseVideo, className: 'clc-pb-video-pause', src: PAUSE_ICON })))));
276
275
  };
@@ -66,7 +66,7 @@ const WaterFall = (props) => {
66
66
  }
67
67
  bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
68
68
  eventInfo: {
69
- relatedContentId: (_d = rec === null || rec === void 0 ? void 0 : rec.video) === null || _d === void 0 ? void 0 : _d.itemId,
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,
@@ -123,12 +123,12 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
123
123
  sessionDuration: Math.floor((new Date() - curTime.current) / 1000) + '',
124
124
  eventSubject: 'sessionCompleted',
125
125
  eventDescription: 'Session completed',
126
- relatedContentId: (_l = item === null || item === void 0 ? void 0 : item.video) === null || _l === void 0 ? void 0 : _l.itemId,
127
- relatedProductId: (_m = item === null || item === void 0 ? void 0 : item.product) === null || _m === void 0 ? void 0 : _m.itemId,
126
+ contentId: (_l = item === null || item === void 0 ? void 0 : item.video) === null || _l === void 0 ? void 0 : _l.itemId,
127
+ productId: (_m = item === null || item === void 0 ? void 0 : item.product) === null || _m === void 0 ? void 0 : _m.itemId,
128
128
  position: activeIndex + '',
129
129
  fromKName,
130
130
  fromKPage: location === null || location === void 0 ? void 0 : location.href,
131
- relatedCtatId: (_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 : ''
131
+ 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 : ''
132
132
  }
133
133
  });
134
134
  }
@@ -261,8 +261,8 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
261
261
  eventInfo: {
262
262
  eventSubject: 'scrollDown',
263
263
  eventDescription: 'User scroll down',
264
- relatedContentId: (_b = (_a = item.video) === null || _a === void 0 ? void 0 : _a.itemId) !== null && _b !== void 0 ? _b : '',
265
- relatedProductId: (_d = (_c = item.product) === null || _c === void 0 ? void 0 : _c.itemId) !== null && _d !== void 0 ? _d : '',
264
+ contentId: (_b = (_a = item.video) === null || _a === void 0 ? void 0 : _a.itemId) !== null && _b !== void 0 ? _b : '',
265
+ productId: (_d = (_c = item.product) === null || _c === void 0 ? void 0 : _c.itemId) !== null && _d !== void 0 ? _d : '',
266
266
  requestId: null
267
267
  }
268
268
  });
@@ -273,8 +273,8 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
273
273
  eventInfo: {
274
274
  eventSubject: 'scrollUp',
275
275
  eventDescription: 'User scroll up',
276
- relatedContentId: (_f = (_e = item.video) === null || _e === void 0 ? void 0 : _e.itemId) !== null && _f !== void 0 ? _f : '',
277
- relatedProductId: (_h = (_g = item.product) === null || _g === void 0 ? void 0 : _g.itemId) !== null && _h !== void 0 ? _h : '',
276
+ contentId: (_f = (_e = item.video) === null || _e === void 0 ? void 0 : _e.itemId) !== null && _f !== void 0 ? _f : '',
277
+ productId: (_h = (_g = item.product) === null || _g === void 0 ? void 0 : _g.itemId) !== null && _h !== void 0 ? _h : '',
278
278
  requestId: null
279
279
  }
280
280
  });
@@ -144,7 +144,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
144
144
  fromKName = 'imagePage';
145
145
  }
146
146
  bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
147
- 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 + '', relatedContentId: (_l = (_k = rec === null || rec === void 0 ? void 0 : rec.video) === null || _k === void 0 ? void 0 : _k.itemId) !== null && _l !== void 0 ? _l : '', relatedProductId: 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 })
147
+ 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 })
148
148
  });
149
149
  }, [bffEventReport, isFromHashtag]);
150
150
  (0, react_1.useEffect)(() => {
@@ -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
- relatedContentId: (_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
- relatedCtatId: (_o = cta === null || cta === void 0 ? void 0 : cta.itemId) !== null && _o !== void 0 ? _o : '',
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
- relatedContentId: (_d = data === null || data === void 0 ? void 0 : data.video) === null || _d === void 0 ? void 0 : _d.itemId,
64
- relatedCtatId: cta === null || cta === void 0 ? void 0 : cta.itemId,
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,
@@ -61,10 +61,10 @@ const CommodityDetail = (_a) => {
61
61
  react_1.default.createElement("div", { className: 'pb-commondity-content-title', style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.title, hidden: !!product && !(product === null || product === void 0 ? void 0 : product.title) }, (_b = product === null || product === void 0 ? void 0 : product.title) !== null && _b !== void 0 ? _b : 'Pendant in Yellow Gold with Diamonds, Medium'),
62
62
  react_1.default.createElement("div", { className: 'pb-commondity-content-price', style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price, hidden: !!product && !(product === null || product === void 0 ? void 0 : product.price) }, priceText),
63
63
  react_1.default.createElement("div", { hidden: !!product && (!(product === null || product === void 0 ? void 0 : product.info) || (product === null || product === void 0 ? void 0 : product.info) === '') },
64
- 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), isPost: isPost, text: (_c = product === null || product === void 0 ? void 0 : product.info) !== null && _c !== void 0 ? _c : `The design inspiration of Tiffany Lock series comes from the power of connection and inclusiveness, and the
65
- bold and avant-garde visual design interprets the emotional bond connecting my heart. The Tiffany Lock
66
- collection is unisex and is inspired by the padlock pattern found in the Tiffany Antique Collection. This
67
- necklace features a stylish and eye-catching oval clasp chain decorated with a lock pattern. Crafted from
64
+ 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), isPost: isPost, text: (_c = product === null || product === void 0 ? void 0 : product.info) !== null && _c !== void 0 ? _c : `The design inspiration of Tiffany Lock series comes from the power of connection and inclusiveness, and the
65
+ bold and avant-garde visual design interprets the emotional bond connecting my heart. The Tiffany Lock
66
+ collection is unisex and is inspired by the padlock pattern found in the Tiffany Antique Collection. This
67
+ necklace features a stylish and eye-catching oval clasp chain decorated with a lock pattern. Crafted from
68
68
  18-karat gold, this necklace is embellished with hand-set diamonds.`, maxStr: 79, className: 'pb-commondity-content-info', style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.info }))));
69
69
  };
70
70
  const renderBtn = () => {
@@ -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 && ((_f = product === null || product === void 0 ? void 0 : product.homePage) === null || _f === void 0 ? void 0 : _f.length) > 0 && (react_1.default.createElement(react_2.Swiper, { height: width, modules: [modules_1.Pagination, modules_1.Autoplay], pagination: {
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
- } }, (_g = product === null || product === void 0 ? void 0 : product.homePage) === null || _g === void 0 ? void 0 : _g.map((src) => {
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
- !((_h = product === null || product === void 0 ? void 0 : product.homePage) === null || _h === void 0 ? void 0 : _h.length) && (react_1.default.createElement("div", { className: (0, css_1.css)({
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: (_j = sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) !== null && _j !== void 0 ? _j : bottom_image, alt: '' }))),
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) },
@@ -12,7 +12,7 @@ const ExpandableText_1 = tslib_1.__importDefault(require("../../../../core/compo
12
12
  const useEventReport_1 = require("../../../../core/hooks/useEventReport");
13
13
  const FormatImage_1 = tslib_1.__importDefault(require("../../../../core/components/SxpPageRender/FormatImage"));
14
14
  const CommodityDetailDiroNew = (_a) => {
15
- var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
15
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
16
16
  var { style, isDefault, rec, viewTime, isPost, bottom_image, tipText, swiper, commodityStyles, buttonStyle, index } = _a, props = tslib_1.__rest(_a, ["style", "isDefault", "rec", "viewTime", "isPost", "bottom_image", "tipText", "swiper", "commodityStyles", "buttonStyle", "index"]);
17
17
  const [spread, setSpread] = (0, react_1.useState)(true);
18
18
  const { sxpParameter } = (0, hooks_1.useSxpDataSource)();
@@ -60,7 +60,7 @@ const CommodityDetailDiroNew = (_a) => {
60
60
  return '£102,300.00';
61
61
  }
62
62
  }, [product === null || product === void 0 ? void 0 : product.price, product === null || product === void 0 ? void 0 : product.currency]);
63
- const width = isPreview ? 375 : window.innerWidth;
63
+ const width = isPreview ? 375 : (_f = style === null || style === void 0 ? void 0 : style.width) !== null && _f !== void 0 ? _f : window.innerWidth;
64
64
  const handleClickCollapse = () => {
65
65
  setSpread(!spread);
66
66
  };
@@ -86,12 +86,12 @@ const CommodityDetailDiroNew = (_a) => {
86
86
  const productInfoText = ({ isPost }) => {
87
87
  return (react_1.default.createElement("div", { hidden: !!product && (!(product === null || product === void 0 ? void 0 : product.info) || (product === null || product === void 0 ? void 0 : product.info) === '') },
88
88
  react_1.default.createElement(ExpandableText_1.default, { isPost: isPost, onClick: () => setShowModal(true), className: 'pb-commondityDiroNew-info', style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.info, foldText: tipText === null || tipText === void 0 ? void 0 : tipText.foldText, unfoldText: tipText === null || tipText === void 0 ? void 0 : tipText.unfoldText, text: (product === null || product === void 0 ? void 0 : product.info) ||
89
- `Unveiled at the Spring-Summer 2023 fashion show, the Dior Toujours bag is distinguished by a casual and practical design. Crafted in black calfskin with Macrocannage topstitching, it showcases a spacious interior compartment with a matching pouch to organize essentials. Its leather strap closure keeps items secure while the D of the CD Lock closure twists to adjust the sides and enhance the bag's silhouette. The leather handles can be adjusted using the small notches in order to be able to carry the large bag by hand or wear it over the shoulder. CD Lock and strap closures D.I.O.R. charms Removable interior pouch Adjustable leather handles Dust bag included
89
+ `Unveiled at the Spring-Summer 2023 fashion show, the Dior Toujours bag is distinguished by a casual and practical design. Crafted in black calfskin with Macrocannage topstitching, it showcases a spacious interior compartment with a matching pouch to organize essentials. Its leather strap closure keeps items secure while the D of the CD Lock closure twists to adjust the sides and enhance the bag's silhouette. The leather handles can be adjusted using the small notches in order to be able to carry the large bag by hand or wear it over the shoulder. CD Lock and strap closures D.I.O.R. charms Removable interior pouch Adjustable leather handles Dust bag included
90
90
  Made in Italy` })));
91
91
  };
92
92
  return (react_1.default.createElement("div", { className: 'pb-commondityDiroNew' },
93
93
  react_1.default.createElement("div", Object.assign({ ref: scrollRef, className: (0, css_1.css)(Object.assign({}, style)) }, props),
94
- product && ((_f = product === null || product === void 0 ? void 0 : product.homePage) === null || _f === void 0 ? void 0 : _f.length) > 0 && (react_1.default.createElement(react_2.Swiper, { height: width, modules: [modules_1.Pagination, modules_1.Autoplay], pagination: {
94
+ 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: {
95
95
  clickable: true,
96
96
  bulletActiveClass: 'commondityDiroNew-swipe-item-active-bullet',
97
97
  clickableClass: (swiper === null || swiper === void 0 ? void 0 : swiper.dotsAlign) === 'left'
@@ -99,7 +99,7 @@ Made in Italy` })));
99
99
  : 'commondityDiroNew-swiper-clickable-center'
100
100
  }, loop: true, autoplay: {
101
101
  delay: (swiper === null || swiper === void 0 ? void 0 : swiper.delay) * 1000
102
- } }, (_g = product === null || product === void 0 ? void 0 : product.homePage) === null || _g === void 0 ? void 0 : _g.map((src) => {
102
+ } }, (_h = product === null || product === void 0 ? void 0 : product.homePage) === null || _h === void 0 ? void 0 : _h.map((src) => {
103
103
  return (react_1.default.createElement(react_2.SwiperSlide, { key: src },
104
104
  react_1.default.createElement("div", { style: {
105
105
  overflow: 'hidden',
@@ -108,7 +108,7 @@ Made in Italy` })));
108
108
  } },
109
109
  react_1.default.createElement(FormatImage_1.default, { style: { height: '100%', width: '100%', objectFit: 'cover', display: 'block' }, src: src }))));
110
110
  }))),
111
- !((_h = product === null || product === void 0 ? void 0 : product.homePage) === null || _h === void 0 ? void 0 : _h.length) && (react_1.default.createElement("div", { className: (0, css_1.css)({
111
+ !((_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)({
112
112
  position: 'relative',
113
113
  height: 0,
114
114
  width: '100%',
@@ -121,16 +121,16 @@ Made in Italy` })));
121
121
  top: 0,
122
122
  objectFit: 'cover',
123
123
  width: '100%'
124
- }), src: (_j = sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) !== null && _j !== void 0 ? _j : bottom_image, alt: '' }))),
124
+ }), src: (_k = sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) !== null && _k !== void 0 ? _k : bottom_image, alt: '' }))),
125
125
  react_1.default.createElement("div", { className: 'pb-commondityDiroNew-content' },
126
126
  react_1.default.createElement("div", { className: 'pb-commondityDiroNew-content-top' },
127
127
  react_1.default.createElement("div", { className: 'pb-commondityDiroNew-content-top-left' },
128
- react_1.default.createElement("div", { className: 'pb-commondityDiroNew-content-top-left-title', style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.title }, (_k = product === null || product === void 0 ? void 0 : product.title) !== null && _k !== void 0 ? _k : 'Large Dior Toujours Bag'),
128
+ react_1.default.createElement("div", { className: 'pb-commondityDiroNew-content-top-left-title', style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.title }, (_l = product === null || product === void 0 ? void 0 : product.title) !== null && _l !== void 0 ? _l : 'Large Dior Toujours Bag'),
129
129
  react_1.default.createElement("div", { className: 'pb-commondityDiroNew-content-collection', hidden: !!product && (!(product === null || product === void 0 ? void 0 : product.collection) || (product === null || product === void 0 ? void 0 : product.collection) === ''), style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.collection }, (product === null || product === void 0 ? void 0 : product.collection) || 'Black Macrocannage Calfskin')),
130
130
  react_1.default.createElement("div", { className: 'pb-commondityDiroNew-content-top-right' },
131
131
  react_1.default.createElement("div", { className: 'pb-commondityDiroNew-content-top-right-price', hidden: !!product && !(product === null || product === void 0 ? void 0 : product.price), style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price }, priceText),
132
- react_1.default.createElement("div", { className: 'pb-commondityDiroNew-content-top-right-price', hidden: !!product && !(product === null || product === void 0 ? void 0 : product.taxInfo), style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.taxInfo }, (_l = product === null || product === void 0 ? void 0 : product.taxInfo) !== null && _l !== void 0 ? _l : '税费'))),
133
- (!product || (product === null || product === void 0 ? void 0 : product.link)) && (react_1.default.createElement("button", { onClick: handleLink, className: 'pb-commondityDiroNew-btn', style: buttonStyle }, (_m = cta === null || cta === void 0 ? void 0 : cta.enTitle) !== null && _m !== void 0 ? _m : 'Shop now')),
132
+ react_1.default.createElement("div", { className: 'pb-commondityDiroNew-content-top-right-price', hidden: !!product && !(product === null || product === void 0 ? void 0 : product.taxInfo), style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.taxInfo }, (_m = product === null || product === void 0 ? void 0 : product.taxInfo) !== null && _m !== void 0 ? _m : '税费'))),
133
+ (!product || (product === null || product === void 0 ? void 0 : product.link)) && (react_1.default.createElement("button", { onClick: handleLink, className: 'pb-commondityDiroNew-btn', style: buttonStyle }, (_o = cta === null || cta === void 0 ? void 0 : cta.enTitle) !== null && _o !== void 0 ? _o : 'Shop now')),
134
134
  productInfoText({ isPost }))),
135
135
  react_1.default.createElement(Modal_1.default, { visible: showModal, onClose: () => setShowModal(false) }, productInfoText({ isPost: false }))));
136
136
  };