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,389 +0,0 @@
1
- import React, { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react';
2
- import { Swiper, SwiperSlide } from 'swiper/react';
3
- import { cloneDeep, debounce } from 'lodash';
4
- import RenderCard from '../SxpPageRender/RenderCard';
5
- import ExpandableText from '../SxpPageRender/ExpandableText';
6
- import LikeButton from '../SxpPageRender/LikeButton';
7
- import { useIconLink } from '../SxpPageRender/useIconLink';
8
- import ToggleButton from '../SxpPageRender/ToggleButton';
9
- import PictureGroup from './PictureGroup';
10
- import VideoWidget from './VideoWidget';
11
- import * as _materials_ from '../../../materials';
12
- import '../SxpPageRender/index.less';
13
- const recData = {
14
- position: 0,
15
- isCollected: false,
16
- product: null,
17
- video: {
18
- appId: null,
19
- itemId: 'VIDEOSsRgI1695278974368',
20
- title: '8张尺寸不一样的图片8张尺寸不一样的图片8张尺寸不一样的图片8张尺寸不一样的图片8张尺寸不一样的图片8张尺寸不一样的图片8张尺寸不一样的图片8张尺寸不一样的图片8张尺寸不一样的图片8张尺寸不一样的图片8张尺寸不一样的图片',
21
- enTitle: null,
22
- icon: null,
23
- cover: 'https://graff-cdn.chatlabs.net/dev/img/8922b5b8-a954-4a61-9ffc-80edebdf02b4/sxp-portal/20231017/fsJFWmW1dGyW7XmDspbJPTn5esL3U1697538777398.png',
24
- link: null,
25
- linkTitle: null,
26
- linkType: null,
27
- menuCategoryId: null,
28
- remark: null,
29
- tags: [
30
- 'Gift-Giving',
31
- 'Daily Wear',
32
- 'Business Formal',
33
- 'Sports/Casual',
34
- 'Anniversary Gifts',
35
- 'Wedding/Engagement',
36
- 'Formal Dinner/Party'
37
- ],
38
- traceInfo: ':VIDEO:VIDEOSsRgI1695278974368:regular:1:VPRHSkRS1697701789894:main::0:EXPMW20250305155940:COMBTh20250305160047:',
39
- value: 385,
40
- weight: null,
41
- bindCta: null,
42
- bindProduct: null,
43
- bindProducts: [
44
- {
45
- appId: 'wx448578f8851f3dce',
46
- itemId: 'test02178888',
47
- title: 'christian dior小包包 新CDN',
48
- enTitle: null,
49
- icon: null,
50
- cover: 'https://graff-cdn.chatlabs.net/dev/img/8922b5b8-a954-4a61-9ffc-80edebdf02b4/sxp-portal/20240913/fs2jqiurjftpoaba67iiwr9jt5sc31726213277754.avif',
51
- link: '/pages/details/index?spu_id=1702262707659534338',
52
- linkTitle: '',
53
- linkType: 'MP',
54
- menuCategoryId: null,
55
- remark: null,
56
- tags: [],
57
- traceInfo: ':PRODUCT:test02178888:regular:1:VPRHSkRS1697701789894:main::0:EXPMW20250305155940:COMBTh20250305160047:',
58
- value: null,
59
- weight: null,
60
- bindCta: {
61
- appId: 'wx448578f8851f3dce',
62
- itemId: 'CTA3KofE1716186622249',
63
- title: 'SHOP NOW 立即购买',
64
- enTitle: 'BUY NOW立即购买,选择你所喜爱的;',
65
- icon: 'https://graff-cdn.chatlabs.net/dev/img/8922b5b8-a954-4a61-9ffc-80edebdf02b4/sxp-portal/20240520/fssfxbmiwghixmgblz9uriwennd2r1716186615574.avif',
66
- cover: null,
67
- link: '/pages/details/index?spu_id=1702262707659534338',
68
- linkTitle: '',
69
- linkType: 'MP',
70
- menuCategoryId: '64b60b202caf0e1c1ce1e17d',
71
- remark: null,
72
- tags: [
73
- "Woman's Perfumes",
74
- 'Plates & Bowls',
75
- 'Glasses',
76
- 'Multicolor',
77
- 'Carafes',
78
- 'Tea & Coffee',
79
- 'Green',
80
- 'Grey',
81
- 'Cutlery'
82
- ],
83
- traceInfo: ':CTA:CTA3KofE1716186622249:regular:1:VPRHSkRS1697701789894:main::0:EXPMW20250305155940:COMBTh20250305160047:',
84
- value: null,
85
- weight: null
86
- },
87
- collection: 'Ricco',
88
- currency: 'INR-₹',
89
- homePage: [
90
- 'https://graff-cdn.chatlabs.net/dev/img/8922b5b8-a954-4a61-9ffc-80edebdf02b4/sxp-portal/20240913/fs2jqiurjftpoaba67iiwr9jt5sc31726213277754.avif',
91
- 'https://graff-cdn.chatlabs.net/dev/img/8922b5b8-a954-4a61-9ffc-80edebdf02b4/sxp-portal/20240913/fsr9ttuzuljs85smqi6lsidovnyoy1726213285994.avif',
92
- 'https://graff-cdn.chatlabs.net/dev/img/8922b5b8-a954-4a61-9ffc-80edebdf02b4/sxp-portal/20240913/fsknmfhx2lxukxews05guwwxr8rju1726213281108.avif',
93
- 'https://graff-cdn.chatlabs.net/dev/img/8922b5b8-a954-4a61-9ffc-80edebdf02b4/sxp-portal/20240913/fs0acnua4f1clamdpwdsrh0v5dgc61726213289247.avif'
94
- ],
95
- info: 'test',
96
- price: 53200,
97
- shippingInfo: null,
98
- taxInfo: null
99
- },
100
- {
101
- appId: null,
102
- itemId: '113J631A0684_C520',
103
- title: 'Sweatshirt à capuche Dior Oblique, coupe relax',
104
- enTitle: null,
105
- icon: null,
106
- cover: 'https://graff-cdn.chatlabs.net/dev/img/8922b5b8-a954-4a61-9ffc-80edebdf02b4/sxp-portal/20241115/fsaf0xq8vx8gkkl30y1h1swpinmbt1731661943891.avif',
107
- link: 'https://www.dior.com/fr_fr/fashion/products/113J631A0684_C520',
108
- linkTitle: null,
109
- linkType: 'WEB',
110
- menuCategoryId: null,
111
- remark: null,
112
- tags: [],
113
- traceInfo: ':PRODUCT:113J631A0684_C520:regular:1:VPRHSkRS1697701789894:main::0:EXPMW20250305155940:COMBTh20250305160047:',
114
- value: null,
115
- weight: null,
116
- bindCta: {
117
- appId: null,
118
- itemId: 'CTAAfaKf1730796437032',
119
- title: 'test',
120
- enTitle: 'test',
121
- icon: 'https://graff-cdn.chatlabs.net/dev/img/8922b5b8-a954-4a61-9ffc-80edebdf02b4/sxp-portal/20241105/fsjblxoud2tmehpiqqomh0oktwqrd1730796431496.avif',
122
- cover: null,
123
- link: null,
124
- linkTitle: null,
125
- linkType: null,
126
- menuCategoryId: '64b60b202caf0e1c1ce1e17d',
127
- remark: '',
128
- tags: [],
129
- traceInfo: ':CTA:CTAAfaKf1730796437032:regular:1:VPRHSkRS1697701789894:main::0:EXPMW20250305155940:COMBTh20250305160047:',
130
- value: null,
131
- weight: null
132
- },
133
- collection: 'Jacquard de coton éponge bleu',
134
- currency: 'EUR-€',
135
- homePage: [
136
- 'https://graff-cdn.chatlabs.net/dev/img/8922b5b8-a954-4a61-9ffc-80edebdf02b4/sxp-portal/20241115/fsaf0xq8vx8gkkl30y1h1swpinmbt1731661943891.avif',
137
- 'https://graff-cdn.chatlabs.net/dev/img/8922b5b8-a954-4a61-9ffc-80edebdf02b4/sxp-portal/20241115/fszxkdcjfjql2oiy90ffbal5tsfd81731661964913.avif',
138
- 'https://graff-cdn.chatlabs.net/dev/img/8922b5b8-a954-4a61-9ffc-80edebdf02b4/sxp-portal/20241115/fs1jhd9jwxvfqmrbjwy5abfzb0fde1731661994996.avif'
139
- ],
140
- 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",
141
- price: 1800,
142
- shippingInfo: null,
143
- taxInfo: null
144
- },
145
- {
146
- appId: null,
147
- itemId: 'S5573CRIW_M928',
148
- title: 'Mini Dior Book Tote',
149
- enTitle: null,
150
- icon: null,
151
- cover: 'https://graff-cdn.chatlabs.net/dev/img/8922b5b8-a954-4a61-9ffc-80edebdf02b4/sxp-portal/20250213/fsvewk9etrawxrzznmvvewgt1bctu1739415576729.avif',
152
- link: 'https://www.dior.com/en_gb/fashion/products/S5573CRIW_M928',
153
- linkTitle: null,
154
- linkType: 'WEB',
155
- menuCategoryId: null,
156
- remark: null,
157
- tags: ['ダイヤモンド'],
158
- traceInfo: ':PRODUCT:S5573CRIW_M928:regular:1:VPRHSkRS1697701789894:main::0:EXPMW20250305155940:COMBTh20250305160047:',
159
- value: null,
160
- weight: null,
161
- bindCta: null,
162
- collection: null,
163
- currency: 'GBP-£',
164
- homePage: [
165
- 'https://graff-cdn.chatlabs.net/dev/img/8922b5b8-a954-4a61-9ffc-80edebdf02b4/sxp-portal/20250213/fsvewk9etrawxrzznmvvewgt1bctu1739415576729.avif',
166
- 'https://graff-cdn.chatlabs.net/dev/img/8922b5b8-a954-4a61-9ffc-80edebdf02b4/sxp-portal/20250213/fsngtlvhid7xwt5if0viw7vqanm831739415582147.avif',
167
- 'https://graff-cdn.chatlabs.net/dev/img/8922b5b8-a954-4a61-9ffc-80edebdf02b4/sxp-portal/20250213/fs4hotdvyzjtnqb9vszlynuzplddc1739415586910.avif',
168
- 'https://graff-cdn.chatlabs.net/dev/img/8922b5b8-a954-4a61-9ffc-80edebdf02b4/sxp-portal/20250213/fswffx9kwexf3z3vcnxisut1qxtez1739415591629.avif',
169
- 'https://graff-cdn.chatlabs.net/dev/img/8922b5b8-a954-4a61-9ffc-80edebdf02b4/sxp-portal/20250213/fsbfsi7tttx1hnzldoiw7eoea7fvh1739415597388.avif'
170
- ],
171
- 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.",
172
- price: 1950,
173
- shippingInfo: null,
174
- taxInfo: null
175
- }
176
- ],
177
- url: null,
178
- blockCta: 1,
179
- blockProduct: 1,
180
- hashTags: [
181
- 'Sports/Casual',
182
- 'Formal Dinner/Party',
183
- 'Business Formal',
184
- 'Wedding/Engagement',
185
- 'Gift-Giving',
186
- 'Daily Wear',
187
- 'Anniversary Gifts'
188
- ]
189
- }
190
- };
191
- const RESOLVER = {};
192
- Object.values(_materials_).forEach((v) => {
193
- RESOLVER[v.extend.type] = v;
194
- });
195
- const defaultUnLikeIconPath = '/pb_static/f71266d2c64446c5ae6a5a7f5489cc0a.png';
196
- const defaultLikeIconPath = '/pb_static/f07900fe3f0f4ae188ea1611d4801a44.png';
197
- const DiyStoryPreview = ({ data = [], globalConfig, tipText, nudge, tempMap, descStyle, hashTagStyle, containerHeight = 664, containerWidth = 375, appDomain, tagList = [], scenes, onActiveChange, activeIndex, loopPlay = false, pointerEvents = 'none', isPlay }) => {
198
- const [loopPlaySwiper, setLooPlaySwiper] = useState(loopPlay);
199
- const swiperRef = useRef(null);
200
- const height = useMemo(() => {
201
- let minusHeight = 0;
202
- if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.logoUrl) && (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowLogo)) {
203
- minusHeight += 45;
204
- }
205
- if (tagList.length > 0) {
206
- minusHeight += 45;
207
- }
208
- return containerHeight - minusHeight;
209
- }, [globalConfig, containerHeight, tagList]);
210
- const isVideoUrl = (url) => {
211
- if (url && url !== '' && typeof url === 'string') {
212
- const imageExtensions = ['.mp4', '.m3u8'];
213
- const lowerCaseUrl = url === null || url === void 0 ? void 0 : url.toLowerCase();
214
- return imageExtensions.some((ext) => lowerCaseUrl === null || lowerCaseUrl === void 0 ? void 0 : lowerCaseUrl.endsWith(ext));
215
- }
216
- else {
217
- return false;
218
- }
219
- };
220
- const renderContent = (rec, index) => {
221
- const isVideo = isVideoUrl(rec === null || rec === void 0 ? void 0 : rec.mediaUrl);
222
- if (isVideo) {
223
- return (React.createElement(VideoWidget, { 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 }));
224
- }
225
- else {
226
- return (React.createElement(PictureGroup, { 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 }));
227
- }
228
- };
229
- const renderLogo = useMemo(() => {
230
- if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.logoUrl) && (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowLogo)) {
231
- return (React.createElement("div", { className: 'clc-sxp-logo-banner', style: { backgroundColor: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.color } },
232
- React.createElement("img", { src: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.logoUrl, alt: 'logo' })));
233
- }
234
- return null;
235
- }, [globalConfig]);
236
- const renderBottom = (rec, index) => {
237
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
238
- if (rec === null || rec === void 0 ? void 0 : rec.video) {
239
- let cta = null;
240
- 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) {
241
- cta = '多商品CTA';
242
- }
243
- else if ((_c = rec === null || rec === void 0 ? void 0 : rec.video) === null || _c === void 0 ? void 0 : _c.bindProduct) {
244
- cta = '商品CTA';
245
- }
246
- else {
247
- 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;
248
- }
249
- const value = tempMap === null || tempMap === void 0 ? void 0 : tempMap[cta];
250
- return (React.createElement(React.Fragment, null,
251
- ((_f = rec === null || rec === void 0 ? void 0 : rec.video) === null || _f === void 0 ? void 0 : _f.title) && (React.createElement("div", { style: {
252
- background: 'repeating-linear-gradient(0deg, rgba(26, 26, 25, 0.7), hsla(0, 0%, 100%, 0))',
253
- height: '130px',
254
- position: 'absolute',
255
- bottom: 0,
256
- width: '100%',
257
- willChange: 'transform',
258
- zIndex: 2,
259
- pointerEvents
260
- } })),
261
- React.createElement("div", { style: {
262
- marginBottom: `${(_g = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.bottomInfoDist) !== null && _g !== void 0 ? _g : 40}px`,
263
- zIndex: 999,
264
- position: 'absolute',
265
- bottom: 0,
266
- left: 0,
267
- right: 0,
268
- paddingTop: '20px'
269
- } },
270
- (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowCTA) === undefined || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowCTA) ? (React.createElement("div", { style: {} },
271
- React.createElement(RenderCard, { rec: rec, index: index, tempMap: tempMap, resolver: RESOLVER, isActive: index === activeIndex, value: value }))) : null,
272
- React.createElement("div", null,
273
- React.createElement(ExpandableText, { 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' }) }),
274
- React.createElement(RenderCard, { rec: rec, index: index, tempMap: tempMap, resolver: RESOLVER, includesCtaType: ['AniLink'], isActive: index === activeIndex, value: value }))),
275
- React.createElement(RenderCard, { rec: rec, index: index, tempMap: tempMap, resolver: RESOLVER, includesCtaType: ['AniLinkPopup'], isActive: index === activeIndex, value: value })));
276
- }
277
- return null;
278
- };
279
- const likeIcon = useIconLink(defaultLikeIconPath, appDomain);
280
- const unlikeIcon = useIconLink(defaultUnLikeIconPath, appDomain);
281
- const renderLikeButton = (rec, index) => {
282
- var _a, _b, _c, _d;
283
- if (!(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowLike))
284
- return;
285
- let top = (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIconY) !== null && _a !== void 0 ? _a : 400;
286
- if (top < 40) {
287
- top += 40;
288
- }
289
- if (rec === null || rec === void 0 ? void 0 : rec.video) {
290
- return (React.createElement(LikeButton, { 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: {
291
- top,
292
- right: (_d = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIconX) !== null && _d !== void 0 ? _d : 0,
293
- position: 'absolute',
294
- zIndex: 999,
295
- backgroundColor: 'transparent',
296
- width: '50px',
297
- height: '50px',
298
- outline: 'none',
299
- border: 'none',
300
- boxSizing: 'content-box',
301
- padding: 0,
302
- transform: 'translate3d(0px, 0px, 0px)'
303
- } }));
304
- }
305
- return null;
306
- };
307
- const mutedIcon = useIconLink('/pb_static/5beaaa5ce7f3477b99db3838619cc471.png', appDomain);
308
- const unmutedIcon = useIconLink('/pb_static/fea8668a8a894e4aa3a86bcc775e895e.png', appDomain);
309
- const renderToggleButton = (visible) => {
310
- var _a, _b, _c, _d;
311
- if (!visible)
312
- return;
313
- let top = (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconY) !== null && _a !== void 0 ? _a : 23;
314
- if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconYPosit) === 'top') {
315
- top += 45;
316
- }
317
- return (((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowMute) === undefined || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowMute) === true) && (React.createElement(ToggleButton, { style: {
318
- position: 'absolute',
319
- visibility: 'visible',
320
- zIndex: 999,
321
- transform: 'translate3d(0px,0px,0px)',
322
- [(_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,
323
- [(_d = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconYPosit) !== null && _d !== void 0 ? _d : 'bottom']: top,
324
- backgroundColor: 'transparent',
325
- width: '50px',
326
- height: '50px',
327
- outline: 'none',
328
- border: 'none',
329
- boxSizing: 'content-box',
330
- padding: 0
331
- }, 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 })));
332
- };
333
- const renderView = (item, index) => {
334
- var _a, _b, _c, _d;
335
- const rec = cloneDeep(recData);
336
- rec.video.bindProducts = item === null || item === void 0 ? void 0 : item.bindProducts;
337
- rec.video.title = (item === null || item === void 0 ? void 0 : item.title) || '';
338
- return (React.createElement("div", { style: { position: 'relative' } },
339
- React.createElement(SwiperSlide, { key: index, virtualIndex: index, style: { overflow: 'hidden', position: 'relative' } },
340
- renderBottom(rec, index),
341
- renderLikeButton(rec, index),
342
- renderToggleButton(!(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconFixed)),
343
- React.createElement(ToggleButton, { style: {
344
- position: 'absolute',
345
- right: (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconX) !== null && _a !== void 0 ? _a : 0,
346
- 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',
347
- bottom: (_d = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconY) !== null && _d !== void 0 ? _d : 23,
348
- zIndex: 999
349
- }, 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 }),
350
- renderContent(item, index))));
351
- };
352
- useEffect(() => {
353
- var _a, _b;
354
- if (!(swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current))
355
- return;
356
- (_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);
357
- }, [activeIndex]);
358
- useEffect(() => {
359
- if (!(swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current))
360
- return;
361
- setLooPlaySwiper(loopPlay);
362
- }, [loopPlay]);
363
- const handleSessionExpire = useCallback(debounce(() => {
364
- setLooPlaySwiper(false);
365
- }, 1000), []);
366
- useEffect(() => {
367
- const events = ['touchstart', 'touchcancel'];
368
- events.forEach((event) => {
369
- window.addEventListener(event, handleSessionExpire);
370
- });
371
- return () => {
372
- events.forEach((event) => {
373
- window.removeEventListener(event, handleSessionExpire);
374
- });
375
- };
376
- }, [handleSessionExpire]);
377
- return (React.createElement("div", { id: 'sxp-render', style: { height: containerHeight, position: 'relative', pointerEvents } },
378
- React.createElement(Swiper, { ref: swiperRef, allowTouchMove: pointerEvents !== 'none', onSlideChange: () => {
379
- swiperRef.current.swiper.allowTouchMove = false;
380
- setTimeout(() => {
381
- swiperRef.current.swiper.allowTouchMove = true;
382
- }, 500);
383
- }, onActiveIndexChange: (swiper) => {
384
- onActiveChange === null || onActiveChange === void 0 ? void 0 : onActiveChange(swiper.activeIndex);
385
- }, direction: 'vertical', style: { overflow: 'hidden', height: containerHeight }, height: containerHeight }, scenes === null || scenes === void 0 ? void 0 : scenes.map((rec, index) => {
386
- return renderView(rec, index);
387
- }))));
388
- };
389
- export default memo(DiyStoryPreview);
@@ -1,16 +0,0 @@
1
- import React from 'react';
2
- import { postConfigType } from '../SxpPageRender';
3
- import { IScene, ScenesType } from '.';
4
- interface IPictureGroupProps {
5
- imgUrls?: string[];
6
- width: number;
7
- height: number;
8
- rec: IScene;
9
- index: number;
10
- imgUrlsPostConfig?: postConfigType;
11
- swiperRef?: any;
12
- data?: ScenesType;
13
- loopPlay?: boolean;
14
- }
15
- declare const _default: React.NamedExoticComponent<IPictureGroupProps>;
16
- export default _default;
@@ -1,37 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const react_1 = tslib_1.__importStar(require("react"));
5
- const modules_1 = require("swiper/modules");
6
- const react_2 = require("swiper/react");
7
- const Picture_1 = tslib_1.__importDefault(require("../SxpPageRender/PictureGroup/Picture"));
8
- const PictureGroup = ({ imgUrls, width, height, imgUrlsPostConfig, rec, index, swiperRef, data = [], loopPlay }) => {
9
- const { isActive } = (0, react_2.useSwiperSlide)();
10
- const [isload, setIsLoad] = (0, react_1.useState)(false);
11
- (0, react_1.useEffect)(() => {
12
- if (isActive && isload && loopPlay) {
13
- setTimeout(() => {
14
- var _a, _b, _c, _d;
15
- if (index === (data === null || data === void 0 ? void 0 : data.length) - 1) {
16
- (_a = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _a === void 0 ? void 0 : _a.swiper.slideTo(0);
17
- }
18
- else {
19
- const i = (_c = (_b = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _b === void 0 ? void 0 : _b.swiper) === null || _c === void 0 ? void 0 : _c.activeIndex;
20
- (_d = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _d === void 0 ? void 0 : _d.swiper.slideTo(i + 1);
21
- }
22
- }, 3000);
23
- }
24
- }, [isActive, isload, data, index, swiperRef, loopPlay]);
25
- const loadFinishImage = () => {
26
- setIsLoad(true);
27
- };
28
- return (react_1.default.createElement(react_2.Swiper, { defaultValue: 0, direction: 'horizontal', modules: [modules_1.Pagination, modules_1.Autoplay], pagination: {
29
- clickable: true,
30
- bulletActiveClass: 'swipe-item-active-bullet',
31
- bulletElement: 'button'
32
- }, height: height, style: { width }, loop: true, autoplay: false }, imgUrls === null || imgUrls === void 0 ? void 0 : imgUrls.map((url) => {
33
- return (react_1.default.createElement(react_2.SwiperSlide, { key: url },
34
- react_1.default.createElement(Picture_1.default, { src: url, height: height, imgUrlsPostConfig: imgUrlsPostConfig, onShowFirstImage: loadFinishImage })));
35
- })));
36
- };
37
- exports.default = (0, react_1.memo)(PictureGroup);
@@ -1,19 +0,0 @@
1
- import React from 'react';
2
- import { postConfigType } from '../SxpPageRender';
3
- import { IScene, ScenesType } from '.';
4
- interface IVideoWidgetProps {
5
- rec: IScene;
6
- index: number;
7
- height: number;
8
- width: number;
9
- data: ScenesType;
10
- muted: boolean;
11
- activeIndex?: number;
12
- videoPostConfig?: postConfigType;
13
- swiperRef?: any;
14
- loopPlay?: boolean;
15
- videoPlayIcon?: string;
16
- isPlay?: boolean;
17
- }
18
- declare const _default: React.NamedExoticComponent<IVideoWidgetProps>;
19
- export default _default;