pb-sxp-ui 1.15.13-alpha.4 → 1.15.14

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 (51) hide show
  1. package/dist/index.cjs +129 -774
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.js +128 -772
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.min.cjs +6 -6
  6. package/dist/index.min.cjs.map +1 -1
  7. package/dist/index.min.js +6 -6
  8. package/dist/index.min.js.map +1 -1
  9. package/dist/pb-ui.js +129 -774
  10. package/dist/pb-ui.js.map +1 -1
  11. package/dist/pb-ui.min.js +6 -6
  12. package/dist/pb-ui.min.js.map +1 -1
  13. package/es/core/components/SxpPageCore/index.d.ts +0 -1
  14. package/es/core/components/SxpPageCore/index.js +7 -7
  15. package/es/core/components/SxpPageRender/ExpandableText.js +2 -10
  16. package/es/core/components/SxpPageRender/RenderCard.js +4 -4
  17. package/es/core/context/EditorContext.js +1 -1
  18. package/es/core/context/SxpDataSourceProvider.d.ts +1 -1
  19. package/es/core/context/SxpDataSourceProvider.js +41 -28
  20. package/es/index.d.ts +0 -1
  21. package/es/index.js +0 -1
  22. package/es/materials/sxp/template/MultiCommodity/index.js +1 -1
  23. package/es/materials/sxp/template/MultiCommodityDiro/index.js +1 -2
  24. package/es/materials/sxp/template/MultiCommodityDiroNew/index.js +1 -2
  25. package/es/materials/sxp/template/components/EventProvider.js +2 -2
  26. package/lib/core/components/SxpPageCore/index.d.ts +0 -1
  27. package/lib/core/components/SxpPageCore/index.js +7 -7
  28. package/lib/core/components/SxpPageRender/ExpandableText.js +2 -10
  29. package/lib/core/components/SxpPageRender/RenderCard.js +4 -4
  30. package/lib/core/context/EditorContext.js +1 -1
  31. package/lib/core/context/SxpDataSourceProvider.d.ts +1 -1
  32. package/lib/core/context/SxpDataSourceProvider.js +41 -28
  33. package/lib/index.d.ts +0 -1
  34. package/lib/index.js +1 -3
  35. package/lib/materials/sxp/template/MultiCommodity/index.js +1 -1
  36. package/lib/materials/sxp/template/MultiCommodityDiro/index.js +1 -2
  37. package/lib/materials/sxp/template/MultiCommodityDiroNew/index.js +1 -2
  38. package/lib/materials/sxp/template/components/EventProvider.js +2 -2
  39. package/package.json +1 -1
  40. package/es/core/components/DiyStoryPreview/PictureGroup.d.ts +0 -16
  41. package/es/core/components/DiyStoryPreview/PictureGroup.js +0 -34
  42. package/es/core/components/DiyStoryPreview/VideoWidget.d.ts +0 -19
  43. package/es/core/components/DiyStoryPreview/VideoWidget.js +0 -198
  44. package/es/core/components/DiyStoryPreview/index.d.ts +0 -31
  45. package/es/core/components/DiyStoryPreview/index.js +0 -389
  46. package/lib/core/components/DiyStoryPreview/PictureGroup.d.ts +0 -16
  47. package/lib/core/components/DiyStoryPreview/PictureGroup.js +0 -37
  48. package/lib/core/components/DiyStoryPreview/VideoWidget.d.ts +0 -19
  49. package/lib/core/components/DiyStoryPreview/VideoWidget.js +0 -201
  50. package/lib/core/components/DiyStoryPreview/index.d.ts +0 -31
  51. package/lib/core/components/DiyStoryPreview/index.js +0 -392
@@ -1,201 +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 react_2 = require("swiper/react");
6
- const useIconLink_1 = require("../SxpPageRender/useIconLink");
7
- const VideoPlayer_1 = require("../SxpPageRender/VideoWidget/VideoPlayer");
8
- const FormatImage_1 = tslib_1.__importDefault(require("../SxpPageRender/FormatImage"));
9
- const hooks_1 = require("../../../core/hooks");
10
- const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostConfig, width, swiperRef, loopPlay, videoPlayIcon, isPlay }) => {
11
- const { isActive } = (0, react_2.useSwiperSlide)();
12
- const [isPauseVideo, setIsPauseVideo] = (0, react_1.useState)(false);
13
- const videoRef = (0, react_1.useRef)(null);
14
- const { bffEventReport, sxpParameter, waterFallData, openHashtag } = (0, hooks_1.useSxpDataSource)();
15
- const videoStartTime = (0, react_1.useRef)(0);
16
- const [isLoadFinish, setIsLoadFinish] = (0, react_1.useState)(false);
17
- const [isFirstPlay, setIsFirstPlay] = (0, react_1.useState)(true);
18
- const canvasRef = (0, react_1.useRef)(null);
19
- const [firstFrameSrc, setFirstFrameSrc] = (0, react_1.useState)('');
20
- const videoId = `pb-cache-video-${index}`;
21
- const hlsRef = (0, react_1.useRef)(null);
22
- (0, react_1.useEffect)(() => {
23
- if (!videoRef.current)
24
- return;
25
- videoRef.current.muted = muted;
26
- }, [muted]);
27
- const handleVideoStart = (0, react_1.useCallback)(() => {
28
- var _a;
29
- (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.play();
30
- }, []);
31
- const PAUSE_ICON = (0, useIconLink_1.useIconLink)('/pb_static/06f28a2025c74c1cb49be6767316d827.png');
32
- const handlePlaying = (0, react_1.useCallback)(() => {
33
- var _a, _b, _c, _d, _e, _f;
34
- setIsPauseVideo(false);
35
- const item = data[index];
36
- if (item && ((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.duration)) {
37
- videoStartTime.current = ((_b = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _b === void 0 ? void 0 : _b.currentTime) || 0;
38
- const videoDuration = ((_d = (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.duration) !== null && _d !== void 0 ? _d : 0).toFixed(2);
39
- const videoCurrentTime = ((_f = (_e = videoRef.current) === null || _e === void 0 ? void 0 : _e.currentTime) !== null && _f !== void 0 ? _f : 0).toFixed(2);
40
- const playType = isFirstPlay ? '0' : '1';
41
- setIsFirstPlay(false);
42
- }
43
- }, [bffEventReport, data, index, isFirstPlay]);
44
- const handleLoadedMetadata = (0, react_1.useCallback)(() => {
45
- var _a;
46
- videoRef.current.currentTime = rec === null || rec === void 0 ? void 0 : rec.startTime;
47
- (_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.play();
48
- setIsLoadFinish(true);
49
- }, []);
50
- const handleClickVideo = (0, react_1.useCallback)((type) => () => {
51
- var _a, _b, _c, _d, _e;
52
- if (!isLoadFinish)
53
- return;
54
- const isPause = (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.paused;
55
- switch (type) {
56
- case 'start':
57
- if (!isPause)
58
- return;
59
- (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.play();
60
- setIsPauseVideo(false);
61
- break;
62
- case 'pause':
63
- if (isPause)
64
- return;
65
- (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.pause();
66
- setIsPauseVideo(true);
67
- break;
68
- default:
69
- if (isPause) {
70
- (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.play();
71
- }
72
- else {
73
- (_e = videoRef.current) === null || _e === void 0 ? void 0 : _e.pause();
74
- }
75
- setIsPauseVideo(!isPause);
76
- break;
77
- }
78
- }, [isLoadFinish]);
79
- const onPause = (0, react_1.useCallback)(() => {
80
- var _a, _b, _c, _d, _e, _f;
81
- const item = data[index];
82
- const videoDuration = ((_b = (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.duration) !== null && _b !== void 0 ? _b : 0).toFixed(2);
83
- const videoCurrentTime = ((_d = (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.currentTime) !== null && _d !== void 0 ? _d : 0).toFixed(2);
84
- if ((_e = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _e === void 0 ? void 0 : _e.duration) {
85
- const playDuration = (((_f = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _f === void 0 ? void 0 : _f.currentTime) - videoStartTime.current).toFixed(2);
86
- }
87
- }, [data, index, bffEventReport]);
88
- const blur = (0, react_1.useMemo)(() => {
89
- return (videoPostConfig === null || videoPostConfig === void 0 ? void 0 : videoPostConfig.mode) === '2';
90
- }, [videoPostConfig]);
91
- const translateY = (0, react_1.useMemo)(() => {
92
- var _a;
93
- return (videoPostConfig === null || videoPostConfig === void 0 ? void 0 : videoPostConfig.mode) === '2'
94
- ? `translateY(-${50 + ((_a = videoPostConfig === null || videoPostConfig === void 0 ? void 0 : videoPostConfig.offsetTop) !== null && _a !== void 0 ? _a : 0)}%) translate3d(0px, 0px, 0px)`
95
- : 'translateY(-50%)';
96
- }, [videoPostConfig]);
97
- const handLoadeddata = (0, react_1.useCallback)(() => {
98
- if (!canvasRef || !videoRef || !videoRef.current || !canvasRef.current)
99
- return;
100
- const video = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current;
101
- const canvas = canvasRef === null || canvasRef === void 0 ? void 0 : canvasRef.current;
102
- const ctx = canvas.getContext('2d');
103
- const targetWidth = window === null || window === void 0 ? void 0 : window.innerWidth;
104
- const targetHeight = window === null || window === void 0 ? void 0 : window.innerHeight;
105
- canvas.height = targetHeight;
106
- canvas.width = targetWidth;
107
- ctx === null || ctx === void 0 ? void 0 : ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
108
- setFirstFrameSrc(canvas.toDataURL());
109
- }, []);
110
- const handleTimeUpload = (0, react_1.useCallback)(() => {
111
- var _a, _b, _c;
112
- if (!videoRef.current)
113
- return;
114
- if (((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.currentTime) >= ((_b = rec === null || rec === void 0 ? void 0 : rec.endTime) !== null && _b !== void 0 ? _b : 0)) {
115
- (_c = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _c === void 0 ? void 0 : _c.pause();
116
- }
117
- }, []);
118
- const handlePause = () => {
119
- var _a, _b, _c, _d, _e, _f;
120
- if (!videoRef.current || !isActive)
121
- return;
122
- if (!loopPlay)
123
- return;
124
- if (index === (data === null || data === void 0 ? void 0 : data.length) - 1) {
125
- (_b = (_a = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _a === void 0 ? void 0 : _a.swiper) === null || _b === void 0 ? void 0 : _b.slideTo(0);
126
- }
127
- else {
128
- const i = (_d = (_c = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _c === void 0 ? void 0 : _c.swiper) === null || _d === void 0 ? void 0 : _d.activeIndex;
129
- (_f = (_e = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _e === void 0 ? void 0 : _e.swiper) === null || _f === void 0 ? void 0 : _f.slideTo(i + 1);
130
- }
131
- };
132
- (0, react_1.useEffect)(() => {
133
- var _a, _b, _c;
134
- if (!isActive)
135
- return;
136
- const videoSrc = rec === null || rec === void 0 ? void 0 : rec.mediaUrl;
137
- if (!videoSrc)
138
- return;
139
- setIsPauseVideo(false);
140
- const videoPlayerWrapperNode = document.querySelector(`#${videoId}`);
141
- if (!videoPlayerWrapperNode)
142
- return;
143
- videoRef.current = VideoPlayer_1.mountVideoPlayerAtNode === null || VideoPlayer_1.mountVideoPlayerAtNode === void 0 ? void 0 : (0, VideoPlayer_1.mountVideoPlayerAtNode)(videoPlayerWrapperNode);
144
- if (!(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current))
145
- return;
146
- const Hls = window === null || window === void 0 ? void 0 : window.Hls;
147
- let hls = hlsRef === null || hlsRef === void 0 ? void 0 : hlsRef.current;
148
- if (videoSrc.includes('.m3u8') && Hls && Hls.isSupported()) {
149
- hls = new Hls();
150
- hls === null || hls === void 0 ? void 0 : hls.loadSource(videoSrc);
151
- hls === null || hls === void 0 ? void 0 : hls.attachMedia(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current);
152
- hls === null || hls === void 0 ? void 0 : hls.on(Hls.Events.MANIFEST_PARSED, function () {
153
- var _a;
154
- videoRef.current.currentTime = rec === null || rec === void 0 ? void 0 : rec.startTime;
155
- (_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.play();
156
- });
157
- }
158
- else {
159
- videoRef.current.src = videoSrc;
160
- }
161
- (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.addEventListener('loadedmetadata', handleLoadedMetadata);
162
- (_b = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _b === void 0 ? void 0 : _b.addEventListener('pause', handlePause);
163
- (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.addEventListener('timeupdate', handleTimeUpload);
164
- return () => {
165
- var _a, _b, _c, _d;
166
- if (hlsRef === null || hlsRef === void 0 ? void 0 : hlsRef.current)
167
- (_a = hlsRef === null || hlsRef === void 0 ? void 0 : hlsRef.current) === null || _a === void 0 ? void 0 : _a.destroy();
168
- setIsLoadFinish(false);
169
- (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.removeEventListener('loadedmetadata', handleLoadedMetadata);
170
- (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.removeEventListener('pause', handlePause);
171
- (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.removeEventListener('timeupdate', handleTimeUpload);
172
- };
173
- }, [handleLoadedMetadata, handlePlaying, rec, handLoadeddata, isActive, loopPlay]);
174
- const renderPoster = (0, react_1.useMemo)(() => {
175
- if (!(sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.placeholder_image) || isLoadFinish) {
176
- return null;
177
- }
178
- return (react_1.default.createElement("img", { style: { position: 'absolute', left: 0, top: 0, width: '100%', height: '100%', objectFit: 'cover' }, src: sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.placeholder_image, alt: 'video poster' }));
179
- }, [isLoadFinish, sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.placeholder_image]);
180
- const blurStyle = (0, react_1.useMemo)(() => {
181
- return blur
182
- ? {
183
- filter: 'blur(10px)',
184
- transform: 'translate3d(0px, 0px, 0px) scale(1.2)'
185
- }
186
- : {};
187
- }, [blur]);
188
- if (!(rec === null || rec === void 0 ? void 0 : rec.mediaUrl)) {
189
- return null;
190
- }
191
- return (react_1.default.createElement("div", { className: 'video-container', key: rec.itemId, style: {
192
- position: 'relative',
193
- width: '100%',
194
- height,
195
- overflow: 'hidden'
196
- } },
197
- react_1.default.createElement("div", { className: 'n-full-screen', id: videoId, style: { width: '100%', height: '100%' } }),
198
- renderPoster,
199
- isPauseVideo && react_1.default.createElement(FormatImage_1.default, { className: 'clc-pb-video-pause', src: videoPlayIcon !== null && videoPlayIcon !== void 0 ? videoPlayIcon : PAUSE_ICON, alt: 'pause' })));
200
- };
201
- exports.default = (0, react_1.memo)(VideoWidget);
@@ -1,31 +0,0 @@
1
- import React from 'react';
2
- import { ISxpPageRenderProps } from '../SxpPageRender';
3
- import '../SxpPageRender/index.less';
4
- export interface IScene {
5
- blueprintStep: number;
6
- endTime: number;
7
- itemId: string;
8
- mediaFileNo: string;
9
- mediaUrl: string;
10
- position: number;
11
- postId: string;
12
- sceneId: string;
13
- sceneInfo: string;
14
- sceneTag: string;
15
- startTime: number;
16
- traceInfo: string;
17
- bindProducts?: any[];
18
- title?: string;
19
- }
20
- export type ScenesType = IScene[];
21
- export type DiyStoryPreviewType = ISxpPageRenderProps & {
22
- appDomain?: string;
23
- scenes?: ScenesType;
24
- activeIndex?: number;
25
- onActiveChange?: (v: number) => void;
26
- loopPlay?: boolean;
27
- pointerEvents?: any;
28
- isPlay?: boolean;
29
- };
30
- declare const _default: React.NamedExoticComponent<DiyStoryPreviewType>;
31
- export default _default;
@@ -1,392 +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 react_2 = require("swiper/react");
6
- const lodash_1 = require("lodash");
7
- const RenderCard_1 = tslib_1.__importDefault(require("../SxpPageRender/RenderCard"));
8
- const ExpandableText_1 = tslib_1.__importDefault(require("../SxpPageRender/ExpandableText"));
9
- const LikeButton_1 = tslib_1.__importDefault(require("../SxpPageRender/LikeButton"));
10
- const useIconLink_1 = require("../SxpPageRender/useIconLink");
11
- const ToggleButton_1 = tslib_1.__importDefault(require("../SxpPageRender/ToggleButton"));
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
- require("../SxpPageRender/index.less");
16
- const recData = {
17
- position: 0,
18
- isCollected: false,
19
- product: null,
20
- video: {
21
- appId: null,
22
- itemId: 'VIDEOSsRgI1695278974368',
23
- title: '8张尺寸不一样的图片8张尺寸不一样的图片8张尺寸不一样的图片8张尺寸不一样的图片8张尺寸不一样的图片8张尺寸不一样的图片8张尺寸不一样的图片8张尺寸不一样的图片8张尺寸不一样的图片8张尺寸不一样的图片8张尺寸不一样的图片',
24
- enTitle: null,
25
- icon: null,
26
- cover: 'https://graff-cdn.chatlabs.net/dev/img/8922b5b8-a954-4a61-9ffc-80edebdf02b4/sxp-portal/20231017/fsJFWmW1dGyW7XmDspbJPTn5esL3U1697538777398.png',
27
- link: null,
28
- linkTitle: null,
29
- linkType: null,
30
- menuCategoryId: null,
31
- remark: null,
32
- tags: [
33
- 'Gift-Giving',
34
- 'Daily Wear',
35
- 'Business Formal',
36
- 'Sports/Casual',
37
- 'Anniversary Gifts',
38
- 'Wedding/Engagement',
39
- 'Formal Dinner/Party'
40
- ],
41
- traceInfo: ':VIDEO:VIDEOSsRgI1695278974368:regular:1:VPRHSkRS1697701789894:main::0:EXPMW20250305155940:COMBTh20250305160047:',
42
- value: 385,
43
- weight: null,
44
- bindCta: null,
45
- bindProduct: null,
46
- bindProducts: [
47
- {
48
- appId: 'wx448578f8851f3dce',
49
- itemId: 'test02178888',
50
- title: 'christian dior小包包 新CDN',
51
- enTitle: null,
52
- icon: null,
53
- cover: 'https://graff-cdn.chatlabs.net/dev/img/8922b5b8-a954-4a61-9ffc-80edebdf02b4/sxp-portal/20240913/fs2jqiurjftpoaba67iiwr9jt5sc31726213277754.avif',
54
- link: '/pages/details/index?spu_id=1702262707659534338',
55
- linkTitle: '',
56
- linkType: 'MP',
57
- menuCategoryId: null,
58
- remark: null,
59
- tags: [],
60
- traceInfo: ':PRODUCT:test02178888:regular:1:VPRHSkRS1697701789894:main::0:EXPMW20250305155940:COMBTh20250305160047:',
61
- value: null,
62
- weight: null,
63
- bindCta: {
64
- appId: 'wx448578f8851f3dce',
65
- itemId: 'CTA3KofE1716186622249',
66
- title: 'SHOP NOW 立即购买',
67
- enTitle: 'BUY NOW立即购买,选择你所喜爱的;',
68
- icon: 'https://graff-cdn.chatlabs.net/dev/img/8922b5b8-a954-4a61-9ffc-80edebdf02b4/sxp-portal/20240520/fssfxbmiwghixmgblz9uriwennd2r1716186615574.avif',
69
- cover: null,
70
- link: '/pages/details/index?spu_id=1702262707659534338',
71
- linkTitle: '',
72
- linkType: 'MP',
73
- menuCategoryId: '64b60b202caf0e1c1ce1e17d',
74
- remark: null,
75
- tags: [
76
- "Woman's Perfumes",
77
- 'Plates & Bowls',
78
- 'Glasses',
79
- 'Multicolor',
80
- 'Carafes',
81
- 'Tea & Coffee',
82
- 'Green',
83
- 'Grey',
84
- 'Cutlery'
85
- ],
86
- traceInfo: ':CTA:CTA3KofE1716186622249:regular:1:VPRHSkRS1697701789894:main::0:EXPMW20250305155940:COMBTh20250305160047:',
87
- value: null,
88
- weight: null
89
- },
90
- collection: 'Ricco',
91
- currency: 'INR-₹',
92
- homePage: [
93
- 'https://graff-cdn.chatlabs.net/dev/img/8922b5b8-a954-4a61-9ffc-80edebdf02b4/sxp-portal/20240913/fs2jqiurjftpoaba67iiwr9jt5sc31726213277754.avif',
94
- 'https://graff-cdn.chatlabs.net/dev/img/8922b5b8-a954-4a61-9ffc-80edebdf02b4/sxp-portal/20240913/fsr9ttuzuljs85smqi6lsidovnyoy1726213285994.avif',
95
- 'https://graff-cdn.chatlabs.net/dev/img/8922b5b8-a954-4a61-9ffc-80edebdf02b4/sxp-portal/20240913/fsknmfhx2lxukxews05guwwxr8rju1726213281108.avif',
96
- 'https://graff-cdn.chatlabs.net/dev/img/8922b5b8-a954-4a61-9ffc-80edebdf02b4/sxp-portal/20240913/fs0acnua4f1clamdpwdsrh0v5dgc61726213289247.avif'
97
- ],
98
- info: 'test',
99
- price: 53200,
100
- shippingInfo: null,
101
- taxInfo: null
102
- },
103
- {
104
- appId: null,
105
- itemId: '113J631A0684_C520',
106
- title: 'Sweatshirt à capuche Dior Oblique, coupe relax',
107
- enTitle: null,
108
- icon: null,
109
- cover: 'https://graff-cdn.chatlabs.net/dev/img/8922b5b8-a954-4a61-9ffc-80edebdf02b4/sxp-portal/20241115/fsaf0xq8vx8gkkl30y1h1swpinmbt1731661943891.avif',
110
- link: 'https://www.dior.com/fr_fr/fashion/products/113J631A0684_C520',
111
- linkTitle: null,
112
- linkType: 'WEB',
113
- menuCategoryId: null,
114
- remark: null,
115
- tags: [],
116
- traceInfo: ':PRODUCT:113J631A0684_C520:regular:1:VPRHSkRS1697701789894:main::0:EXPMW20250305155940:COMBTh20250305160047:',
117
- value: null,
118
- weight: null,
119
- bindCta: {
120
- appId: null,
121
- itemId: 'CTAAfaKf1730796437032',
122
- title: 'test',
123
- enTitle: 'test',
124
- icon: 'https://graff-cdn.chatlabs.net/dev/img/8922b5b8-a954-4a61-9ffc-80edebdf02b4/sxp-portal/20241105/fsjblxoud2tmehpiqqomh0oktwqrd1730796431496.avif',
125
- cover: null,
126
- link: null,
127
- linkTitle: null,
128
- linkType: null,
129
- menuCategoryId: '64b60b202caf0e1c1ce1e17d',
130
- remark: '',
131
- tags: [],
132
- traceInfo: ':CTA:CTAAfaKf1730796437032:regular:1:VPRHSkRS1697701789894:main::0:EXPMW20250305155940:COMBTh20250305160047:',
133
- value: null,
134
- weight: null
135
- },
136
- collection: 'Jacquard de coton éponge bleu',
137
- currency: 'EUR-€',
138
- homePage: [
139
- 'https://graff-cdn.chatlabs.net/dev/img/8922b5b8-a954-4a61-9ffc-80edebdf02b4/sxp-portal/20241115/fsaf0xq8vx8gkkl30y1h1swpinmbt1731661943891.avif',
140
- 'https://graff-cdn.chatlabs.net/dev/img/8922b5b8-a954-4a61-9ffc-80edebdf02b4/sxp-portal/20241115/fszxkdcjfjql2oiy90ffbal5tsfd81731661964913.avif',
141
- 'https://graff-cdn.chatlabs.net/dev/img/8922b5b8-a954-4a61-9ffc-80edebdf02b4/sxp-portal/20241115/fs1jhd9jwxvfqmrbjwy5abfzb0fde1731661994996.avif'
142
- ],
143
- info: "Le sweatshirt à capuche bleu met à l'honneur l'emblématique motif dior oblique. Confectionné en jacquard de coton éponge bleu, il présente une coupe relax très confortable. Doté de poches latérales fendues, ce sweatshirt à capuche s'associera à tous vos jeans ou pantalons de survêtement pour un look décontracté.. Sweatshirt à capuche dior oblique, coupe relax Jacquard de coton éponge bleu",
144
- price: 1800,
145
- shippingInfo: null,
146
- taxInfo: null
147
- },
148
- {
149
- appId: null,
150
- itemId: 'S5573CRIW_M928',
151
- title: 'Mini Dior Book Tote',
152
- enTitle: null,
153
- icon: null,
154
- cover: 'https://graff-cdn.chatlabs.net/dev/img/8922b5b8-a954-4a61-9ffc-80edebdf02b4/sxp-portal/20250213/fsvewk9etrawxrzznmvvewgt1bctu1739415576729.avif',
155
- link: 'https://www.dior.com/en_gb/fashion/products/S5573CRIW_M928',
156
- linkTitle: null,
157
- linkType: 'WEB',
158
- menuCategoryId: null,
159
- remark: null,
160
- tags: ['ダイヤモンド'],
161
- traceInfo: ':PRODUCT:S5573CRIW_M928:regular:1:VPRHSkRS1697701789894:main::0:EXPMW20250305155940:COMBTh20250305160047:',
162
- value: null,
163
- weight: null,
164
- bindCta: null,
165
- collection: null,
166
- currency: 'GBP-£',
167
- homePage: [
168
- 'https://graff-cdn.chatlabs.net/dev/img/8922b5b8-a954-4a61-9ffc-80edebdf02b4/sxp-portal/20250213/fsvewk9etrawxrzznmvvewgt1bctu1739415576729.avif',
169
- 'https://graff-cdn.chatlabs.net/dev/img/8922b5b8-a954-4a61-9ffc-80edebdf02b4/sxp-portal/20250213/fsngtlvhid7xwt5if0viw7vqanm831739415582147.avif',
170
- 'https://graff-cdn.chatlabs.net/dev/img/8922b5b8-a954-4a61-9ffc-80edebdf02b4/sxp-portal/20250213/fs4hotdvyzjtnqb9vszlynuzplddc1739415586910.avif',
171
- 'https://graff-cdn.chatlabs.net/dev/img/8922b5b8-a954-4a61-9ffc-80edebdf02b4/sxp-portal/20250213/fswffx9kwexf3z3vcnxisut1qxtez1739415591629.avif',
172
- 'https://graff-cdn.chatlabs.net/dev/img/8922b5b8-a954-4a61-9ffc-80edebdf02b4/sxp-portal/20250213/fsbfsi7tttx1hnzldoiw7eoea7fvh1739415597388.avif'
173
- ],
174
- info: "The Dior Book Tote is a House classic and original design by Maria Grazia Chiuri, Creative Director of Christian Dior. The style is fully embroidered with the House's hallmark blue Dior Oblique motif and showcases the Christian Dior Paris signature. Exemplifying House savoir-faire, the miniature style features an adjustable and removable strap that allows it to be carried by hand, worn over the shoulder or crossbody.",
175
- price: 1950,
176
- shippingInfo: null,
177
- taxInfo: null
178
- }
179
- ],
180
- url: null,
181
- blockCta: 1,
182
- blockProduct: 1,
183
- hashTags: [
184
- 'Sports/Casual',
185
- 'Formal Dinner/Party',
186
- 'Business Formal',
187
- 'Wedding/Engagement',
188
- 'Gift-Giving',
189
- 'Daily Wear',
190
- 'Anniversary Gifts'
191
- ]
192
- }
193
- };
194
- const RESOLVER = {};
195
- Object.values(_materials_).forEach((v) => {
196
- RESOLVER[v.extend.type] = v;
197
- });
198
- const defaultUnLikeIconPath = '/pb_static/f71266d2c64446c5ae6a5a7f5489cc0a.png';
199
- const defaultLikeIconPath = '/pb_static/f07900fe3f0f4ae188ea1611d4801a44.png';
200
- const DiyStoryPreview = ({ data = [], globalConfig, tipText, nudge, tempMap, descStyle, hashTagStyle, containerHeight = 664, containerWidth = 375, appDomain, tagList = [], scenes, onActiveChange, activeIndex, loopPlay = false, pointerEvents = 'none', isPlay }) => {
201
- const [loopPlaySwiper, setLooPlaySwiper] = (0, react_1.useState)(loopPlay);
202
- const swiperRef = (0, react_1.useRef)(null);
203
- const height = (0, react_1.useMemo)(() => {
204
- let minusHeight = 0;
205
- if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.logoUrl) && (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowLogo)) {
206
- minusHeight += 45;
207
- }
208
- if (tagList.length > 0) {
209
- minusHeight += 45;
210
- }
211
- return containerHeight - minusHeight;
212
- }, [globalConfig, containerHeight, tagList]);
213
- const isVideoUrl = (url) => {
214
- if (url && url !== '' && typeof url === 'string') {
215
- const imageExtensions = ['.mp4', '.m3u8'];
216
- const lowerCaseUrl = url === null || url === void 0 ? void 0 : url.toLowerCase();
217
- return imageExtensions.some((ext) => lowerCaseUrl === null || lowerCaseUrl === void 0 ? void 0 : lowerCaseUrl.endsWith(ext));
218
- }
219
- else {
220
- return false;
221
- }
222
- };
223
- const renderContent = (rec, index) => {
224
- const isVideo = isVideoUrl(rec === null || rec === void 0 ? void 0 : rec.mediaUrl);
225
- if (isVideo) {
226
- return (react_1.default.createElement(VideoWidget_1.default, { isPlay: isPlay, rec: rec, index: index, muted: true, width: containerWidth, data: scenes !== null && scenes !== void 0 ? scenes : [], height: containerHeight, activeIndex: index, videoPostConfig: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.videoPost, videoPlayIcon: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.videoPlayIcon, swiperRef: swiperRef, loopPlay: loopPlaySwiper }));
227
- }
228
- else {
229
- return (react_1.default.createElement(PictureGroup_1.default, { key: rec.itemId, imgUrls: [rec === null || rec === void 0 ? void 0 : rec.mediaUrl], width: containerWidth, height: containerHeight, rec: rec, index: index, imgUrlsPostConfig: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.imgUrlsPost, data: scenes !== null && scenes !== void 0 ? scenes : [], swiperRef: swiperRef, loopPlay: loopPlaySwiper }));
230
- }
231
- };
232
- const renderLogo = (0, react_1.useMemo)(() => {
233
- if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.logoUrl) && (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowLogo)) {
234
- return (react_1.default.createElement("div", { className: 'clc-sxp-logo-banner', style: { backgroundColor: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.color } },
235
- react_1.default.createElement("img", { src: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.logoUrl, alt: 'logo' })));
236
- }
237
- return null;
238
- }, [globalConfig]);
239
- const renderBottom = (rec, index) => {
240
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
241
- if (rec === null || rec === void 0 ? void 0 : rec.video) {
242
- let cta = null;
243
- if ((_b = (_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.bindProducts) === null || _b === void 0 ? void 0 : _b.length) {
244
- cta = '多商品CTA';
245
- }
246
- else if ((_c = rec === null || rec === void 0 ? void 0 : rec.video) === null || _c === void 0 ? void 0 : _c.bindProduct) {
247
- cta = '商品CTA';
248
- }
249
- else {
250
- cta = (_e = (_d = rec === null || rec === void 0 ? void 0 : rec.video) === null || _d === void 0 ? void 0 : _d.bindCta) === null || _e === void 0 ? void 0 : _e.itemId;
251
- }
252
- const value = tempMap === null || tempMap === void 0 ? void 0 : tempMap[cta];
253
- return (react_1.default.createElement(react_1.default.Fragment, null,
254
- ((_f = rec === null || rec === void 0 ? void 0 : rec.video) === null || _f === void 0 ? void 0 : _f.title) && (react_1.default.createElement("div", { style: {
255
- background: 'repeating-linear-gradient(0deg, rgba(26, 26, 25, 0.7), hsla(0, 0%, 100%, 0))',
256
- height: '130px',
257
- position: 'absolute',
258
- bottom: 0,
259
- width: '100%',
260
- willChange: 'transform',
261
- zIndex: 2,
262
- pointerEvents
263
- } })),
264
- react_1.default.createElement("div", { style: {
265
- marginBottom: `${(_g = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.bottomInfoDist) !== null && _g !== void 0 ? _g : 40}px`,
266
- zIndex: 999,
267
- position: 'absolute',
268
- bottom: 0,
269
- left: 0,
270
- right: 0,
271
- paddingTop: '20px'
272
- } },
273
- (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowCTA) === undefined || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowCTA) ? (react_1.default.createElement("div", { style: {} },
274
- react_1.default.createElement(RenderCard_1.default, { rec: rec, index: index, tempMap: tempMap, resolver: RESOLVER, isActive: index === activeIndex, value: value }))) : null,
275
- react_1.default.createElement("div", null,
276
- react_1.default.createElement(ExpandableText_1.default, { isPost: true, foldText: tipText === null || tipText === void 0 ? void 0 : tipText.foldText, unfoldText: tipText === null || tipText === void 0 ? void 0 : tipText.unfoldText, text: (_j = (_h = rec === null || rec === void 0 ? void 0 : rec.video) === null || _h === void 0 ? void 0 : _h.title) !== null && _j !== void 0 ? _j : '', 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', padding: '0 20px', fontSize: '12px' }) }),
277
- react_1.default.createElement(RenderCard_1.default, { rec: rec, index: index, tempMap: tempMap, resolver: RESOLVER, includesCtaType: ['AniLink'], isActive: index === activeIndex, value: value }))),
278
- react_1.default.createElement(RenderCard_1.default, { rec: rec, index: index, tempMap: tempMap, resolver: RESOLVER, includesCtaType: ['AniLinkPopup'], isActive: index === activeIndex, value: value })));
279
- }
280
- return null;
281
- };
282
- const likeIcon = (0, useIconLink_1.useIconLink)(defaultLikeIconPath, appDomain);
283
- const unlikeIcon = (0, useIconLink_1.useIconLink)(defaultUnLikeIconPath, appDomain);
284
- const renderLikeButton = (rec, index) => {
285
- var _a, _b, _c, _d;
286
- if (!(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowLike))
287
- return;
288
- let top = (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIconY) !== null && _a !== void 0 ? _a : 400;
289
- if (top < 40) {
290
- top += 40;
291
- }
292
- if (rec === null || rec === void 0 ? void 0 : rec.video) {
293
- 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, style: {
294
- top,
295
- right: (_d = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIconX) !== null && _d !== void 0 ? _d : 0,
296
- position: 'absolute',
297
- zIndex: 999,
298
- backgroundColor: 'transparent',
299
- width: '50px',
300
- height: '50px',
301
- outline: 'none',
302
- border: 'none',
303
- boxSizing: 'content-box',
304
- padding: 0,
305
- transform: 'translate3d(0px, 0px, 0px)'
306
- } }));
307
- }
308
- return null;
309
- };
310
- const mutedIcon = (0, useIconLink_1.useIconLink)('/pb_static/5beaaa5ce7f3477b99db3838619cc471.png', appDomain);
311
- const unmutedIcon = (0, useIconLink_1.useIconLink)('/pb_static/fea8668a8a894e4aa3a86bcc775e895e.png', appDomain);
312
- const renderToggleButton = (visible) => {
313
- var _a, _b, _c, _d;
314
- if (!visible)
315
- return;
316
- let top = (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconY) !== null && _a !== void 0 ? _a : 23;
317
- if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconYPosit) === 'top') {
318
- top += 45;
319
- }
320
- return (((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowMute) === undefined || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowMute) === true) && (react_1.default.createElement(ToggleButton_1.default, { style: {
321
- position: 'absolute',
322
- visibility: 'visible',
323
- zIndex: 999,
324
- transform: 'translate3d(0px,0px,0px)',
325
- [(_b = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconXPosit) !== null && _b !== void 0 ? _b : 'right']: (_c = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconX) !== null && _c !== void 0 ? _c : 0,
326
- [(_d = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconYPosit) !== null && _d !== void 0 ? _d : 'bottom']: top,
327
- backgroundColor: 'transparent',
328
- width: '50px',
329
- height: '50px',
330
- outline: 'none',
331
- border: 'none',
332
- boxSizing: 'content-box',
333
- padding: 0
334
- }, 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 })));
335
- };
336
- const renderView = (item, index) => {
337
- var _a, _b, _c, _d;
338
- const rec = (0, lodash_1.cloneDeep)(recData);
339
- rec.video.bindProducts = item === null || item === void 0 ? void 0 : item.bindProducts;
340
- rec.video.title = (item === null || item === void 0 ? void 0 : item.title) || '';
341
- return (react_1.default.createElement("div", { style: { position: 'relative' } },
342
- react_1.default.createElement(react_2.SwiperSlide, { key: index, virtualIndex: index, style: { overflow: 'hidden', position: 'relative' } },
343
- renderBottom(rec, index),
344
- renderLikeButton(rec, index),
345
- renderToggleButton(!(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconFixed)),
346
- react_1.default.createElement(ToggleButton_1.default, { style: {
347
- position: 'absolute',
348
- right: (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconX) !== null && _a !== void 0 ? _a : 0,
349
- 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',
350
- bottom: (_d = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconY) !== null && _d !== void 0 ? _d : 23,
351
- zIndex: 999
352
- }, 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 }),
353
- renderContent(item, index))));
354
- };
355
- (0, react_1.useEffect)(() => {
356
- var _a, _b;
357
- if (!(swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current))
358
- return;
359
- (_b = (_a = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _a === void 0 ? void 0 : _a.swiper) === null || _b === void 0 ? void 0 : _b.slideTo(activeIndex);
360
- }, [activeIndex]);
361
- (0, react_1.useEffect)(() => {
362
- if (!(swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current))
363
- return;
364
- setLooPlaySwiper(loopPlay);
365
- }, [loopPlay]);
366
- const handleSessionExpire = (0, react_1.useCallback)((0, lodash_1.debounce)(() => {
367
- setLooPlaySwiper(false);
368
- }, 1000), []);
369
- (0, react_1.useEffect)(() => {
370
- const events = ['touchstart', 'touchcancel'];
371
- events.forEach((event) => {
372
- window.addEventListener(event, handleSessionExpire);
373
- });
374
- return () => {
375
- events.forEach((event) => {
376
- window.removeEventListener(event, handleSessionExpire);
377
- });
378
- };
379
- }, [handleSessionExpire]);
380
- return (react_1.default.createElement("div", { id: 'sxp-render', style: { height: containerHeight, position: 'relative', pointerEvents } },
381
- react_1.default.createElement(react_2.Swiper, { ref: swiperRef, allowTouchMove: pointerEvents !== 'none', onSlideChange: () => {
382
- swiperRef.current.swiper.allowTouchMove = false;
383
- setTimeout(() => {
384
- swiperRef.current.swiper.allowTouchMove = true;
385
- }, 500);
386
- }, onActiveIndexChange: (swiper) => {
387
- onActiveChange === null || onActiveChange === void 0 ? void 0 : onActiveChange(swiper.activeIndex);
388
- }, direction: 'vertical', style: { overflow: 'hidden', height: containerHeight }, height: containerHeight }, scenes === null || scenes === void 0 ? void 0 : scenes.map((rec, index) => {
389
- return renderView(rec, index);
390
- }))));
391
- };
392
- exports.default = (0, react_1.memo)(DiyStoryPreview);