pb-sxp-ui 1.15.21 → 1.15.22-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +7737 -7247
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +46 -46
- package/dist/index.js +7735 -7246
- package/dist/index.js.map +1 -1
- package/dist/index.min.cjs +6 -6
- package/dist/index.min.cjs.map +1 -1
- package/dist/index.min.js +6 -6
- package/dist/index.min.js.map +1 -1
- package/dist/pb-ui.js +7737 -7247
- package/dist/pb-ui.js.map +1 -1
- package/dist/pb-ui.min.js +6 -6
- package/dist/pb-ui.min.js.map +1 -1
- package/es/core/Pagebuilder/type.d.ts +10 -5
- package/es/core/components/DiyStoryPreview/PictureGroup.d.ts +16 -0
- package/es/core/components/DiyStoryPreview/PictureGroup.js +34 -0
- package/es/core/components/DiyStoryPreview/VideoWidget.d.ts +27 -0
- package/es/core/components/DiyStoryPreview/VideoWidget.js +197 -0
- package/es/core/components/DiyStoryPreview/index.d.ts +32 -0
- package/es/core/components/DiyStoryPreview/index.js +232 -0
- package/es/core/components/SxpPageCore/index.js +3 -2
- package/es/core/components/SxpPageRender/VideoWidget/index.d.ts +6 -1
- package/es/core/components/SxpPageRender/VideoWidget/index.js +52 -12
- package/es/core/components/SxpPageRender/index.d.ts +0 -1
- package/es/core/components/SxpPageRender/index.js +6 -3
- package/es/core/components/SxpPageRender/typing.d.ts +19 -0
- package/es/core/context/SxpDataSourceProvider.d.ts +3 -1
- package/es/core/context/SxpDataSourceProvider.js +50 -98
- package/es/index.d.ts +1 -0
- package/es/index.js +1 -0
- package/es/materials/sxp/popup/CommodityDetail/index.js +2 -2
- package/es/materials/sxp/popup/CommodityDetailDiroNew/index.js +1 -1
- package/lib/core/Pagebuilder/type.d.ts +10 -5
- package/lib/core/components/DiyStoryPreview/PictureGroup.d.ts +16 -0
- package/lib/core/components/DiyStoryPreview/PictureGroup.js +37 -0
- package/lib/core/components/DiyStoryPreview/VideoWidget.d.ts +27 -0
- package/lib/core/components/DiyStoryPreview/VideoWidget.js +200 -0
- package/lib/core/components/DiyStoryPreview/index.d.ts +32 -0
- package/lib/core/components/DiyStoryPreview/index.js +235 -0
- package/lib/core/components/SxpPageCore/index.js +3 -2
- package/lib/core/components/SxpPageRender/VideoWidget/index.d.ts +6 -1
- package/lib/core/components/SxpPageRender/VideoWidget/index.js +51 -11
- package/lib/core/components/SxpPageRender/index.d.ts +0 -1
- package/lib/core/components/SxpPageRender/index.js +6 -3
- package/lib/core/components/SxpPageRender/typing.d.ts +19 -0
- package/lib/core/context/SxpDataSourceProvider.d.ts +3 -1
- package/lib/core/context/SxpDataSourceProvider.js +50 -98
- package/lib/index.d.ts +1 -0
- package/lib/index.js +3 -1
- package/lib/materials/sxp/popup/CommodityDetail/index.js +2 -2
- package/lib/materials/sxp/popup/CommodityDetailDiroNew/index.js +1 -1
- package/package.json +1 -1
@@ -5,13 +5,13 @@ const react_1 = tslib_1.__importStar(require("react"));
|
|
5
5
|
const react_2 = require("swiper/react");
|
6
6
|
const useIconLink_1 = require("../useIconLink");
|
7
7
|
const FormatImage_1 = tslib_1.__importDefault(require("../FormatImage"));
|
8
|
-
const hooks_1 = require("../../../../core/hooks");
|
9
|
-
const event_1 = tslib_1.__importStar(require("../../../../core/utils/event"));
|
10
8
|
const loading_gif_1 = tslib_1.__importDefault(require("./loading.gif"));
|
11
9
|
const VideoPlayer_1 = require("./VideoPlayer");
|
12
|
-
const
|
10
|
+
const hooks_1 = require("../../../../core/hooks");
|
11
|
+
const event_1 = tslib_1.__importStar(require("../../../../core/utils/event"));
|
12
|
+
const VideoWidget = (0, react_1.forwardRef)(({ rec, index, height, data, muted, activeIndex, videoPostConfig, videoPlayIcon, loopPlay, swiperRef }, ref) => {
|
13
13
|
const [isPauseVideo, setIsPauseVideo] = (0, react_1.useState)(false);
|
14
|
-
const { bffEventReport, sxpParameter, waterFallData, openHashtag, bffFbReport } = (0, hooks_1.useSxpDataSource)();
|
14
|
+
const { bffEventReport, sxpParameter, waterFallData, openHashtag, bffFbReport, isDiyH5 } = (0, hooks_1.useSxpDataSource)();
|
15
15
|
const videoStartTime = (0, react_1.useRef)(0);
|
16
16
|
const [isLoadFinish, setIsLoadFinish] = (0, react_1.useState)(false);
|
17
17
|
const { isActive } = (0, react_2.useSwiperSlide)();
|
@@ -25,6 +25,18 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
25
25
|
const initTimeRef = (0, react_1.useRef)();
|
26
26
|
const loadedTimeRef = (0, react_1.useRef)();
|
27
27
|
const isFirstPlayRef = (0, react_1.useRef)(true);
|
28
|
+
const loopPlayRef = (0, react_1.useRef)(loopPlay);
|
29
|
+
const scene = rec.video.scene;
|
30
|
+
(0, react_1.useImperativeHandle)(ref, () => {
|
31
|
+
return {
|
32
|
+
setLoopPlay(v) {
|
33
|
+
loopPlayRef.current = v;
|
34
|
+
}
|
35
|
+
};
|
36
|
+
});
|
37
|
+
(0, react_1.useEffect)(() => {
|
38
|
+
loopPlayRef.current = loopPlay;
|
39
|
+
}, [loopPlay]);
|
28
40
|
const blur = (0, react_1.useMemo)(() => {
|
29
41
|
return (videoPostConfig === null || videoPostConfig === void 0 ? void 0 : videoPostConfig.mode) === '2';
|
30
42
|
}, [videoPostConfig]);
|
@@ -112,12 +124,15 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
112
124
|
const handleLoadedmetadata = (0, react_1.useCallback)(() => {
|
113
125
|
if (!videoRef.current)
|
114
126
|
return;
|
127
|
+
if (isDiyH5) {
|
128
|
+
videoRef.current.currentTime = scene === null || scene === void 0 ? void 0 : scene.startTime;
|
129
|
+
}
|
115
130
|
loadedTimeRef.current = new Date();
|
116
131
|
handleStartPlay();
|
117
132
|
handLoadeddata();
|
118
133
|
}, [videoRef.current, handLoadeddata, handleStartPlay]);
|
119
134
|
const handleClickVideo = (0, react_1.useCallback)((type) => () => {
|
120
|
-
var _a, _b, _c, _d, _e;
|
135
|
+
var _a, _b, _c, _d, _e, _f;
|
121
136
|
if (!videoRef.current)
|
122
137
|
return;
|
123
138
|
if (!isLoadFinish)
|
@@ -138,10 +153,13 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
138
153
|
break;
|
139
154
|
default:
|
140
155
|
if (isPause) {
|
141
|
-
(_d = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _d === void 0 ? void 0 : _d.
|
156
|
+
if (isDiyH5 && Math.round((_d = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _d === void 0 ? void 0 : _d.currentTime) >= (scene === null || scene === void 0 ? void 0 : scene.endTime)) {
|
157
|
+
videoRef.current.currentTime = scene === null || scene === void 0 ? void 0 : scene.startTime;
|
158
|
+
}
|
159
|
+
(_e = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _e === void 0 ? void 0 : _e.play();
|
142
160
|
}
|
143
161
|
else {
|
144
|
-
(
|
162
|
+
(_f = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _f === void 0 ? void 0 : _f.pause();
|
145
163
|
}
|
146
164
|
setIsPauseVideo(!isPause);
|
147
165
|
break;
|
@@ -178,8 +196,27 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
178
196
|
const handleWaiting = (0, react_1.useCallback)(() => {
|
179
197
|
setWaiting(true);
|
180
198
|
}, []);
|
199
|
+
const handleTimeUpload = () => {
|
200
|
+
if (!videoRef.current || !isDiyH5)
|
201
|
+
return;
|
202
|
+
setTimeout(() => {
|
203
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
204
|
+
if (Math.round((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.currentTime) >= ((_b = scene === null || scene === void 0 ? void 0 : scene.endTime) !== null && _b !== void 0 ? _b : 0)) {
|
205
|
+
(_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.pause();
|
206
|
+
if (!loopPlayRef.current)
|
207
|
+
return;
|
208
|
+
if (index === (data === null || data === void 0 ? void 0 : data.length) - 1) {
|
209
|
+
(_e = (_d = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _d === void 0 ? void 0 : _d.swiper) === null || _e === void 0 ? void 0 : _e.slideTo(0);
|
210
|
+
}
|
211
|
+
else {
|
212
|
+
const i = (_g = (_f = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _f === void 0 ? void 0 : _f.swiper) === null || _g === void 0 ? void 0 : _g.activeIndex;
|
213
|
+
(_j = (_h = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _h === void 0 ? void 0 : _h.swiper) === null || _j === void 0 ? void 0 : _j.slideTo(i + 1);
|
214
|
+
}
|
215
|
+
}
|
216
|
+
});
|
217
|
+
};
|
181
218
|
(0, react_1.useEffect)(() => {
|
182
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
219
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
183
220
|
if (!isActive)
|
184
221
|
return;
|
185
222
|
const videoSrc = rec === null || rec === void 0 ? void 0 : rec.video.url;
|
@@ -200,6 +237,7 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
200
237
|
hls === null || hls === void 0 ? void 0 : hls.attachMedia(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current);
|
201
238
|
hls === null || hls === void 0 ? void 0 : hls.on(Hls.Events.MANIFEST_PARSED, function () {
|
202
239
|
var _a;
|
240
|
+
videoRef.current.currentTime = scene === null || scene === void 0 ? void 0 : scene.startTime;
|
203
241
|
(_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.play();
|
204
242
|
});
|
205
243
|
}
|
@@ -216,8 +254,9 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
216
254
|
(_h = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _h === void 0 ? void 0 : _h.addEventListener('ended', handlePlay);
|
217
255
|
(_j = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _j === void 0 ? void 0 : _j.addEventListener('canplay', handlePlay);
|
218
256
|
(_k = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _k === void 0 ? void 0 : _k.addEventListener('waiting', handleWaiting);
|
257
|
+
(_l = videoRef.current) === null || _l === void 0 ? void 0 : _l.addEventListener('timeupdate', handleTimeUpload);
|
219
258
|
return () => {
|
220
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
259
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
221
260
|
const isPause = (_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.paused;
|
222
261
|
if (!isPause)
|
223
262
|
handlePause();
|
@@ -232,6 +271,7 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
232
271
|
(_h = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _h === void 0 ? void 0 : _h.removeEventListener('ended', handlePlay);
|
233
272
|
(_j = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _j === void 0 ? void 0 : _j.removeEventListener('canplay', handlePlay);
|
234
273
|
(_k = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _k === void 0 ? void 0 : _k.removeEventListener('waiting', handleWaiting);
|
274
|
+
(_l = videoRef.current) === null || _l === void 0 ? void 0 : _l.removeEventListener('timeupdate', handleTimeUpload);
|
235
275
|
};
|
236
276
|
}, [isActive]);
|
237
277
|
(0, react_1.useEffect)(() => {
|
@@ -349,6 +389,6 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
349
389
|
react_1.default.createElement("div", { className: 'n-full-screen', ref: videoEleRef, id: videoId, style: { width: '100%', height: '100%' } }),
|
350
390
|
renderPoster,
|
351
391
|
renderLoading,
|
352
|
-
isPauseVideo && react_1.default.createElement(FormatImage_1.default, { className: 'clc-pb-video-pause', src: videoPlayIcon !== null && videoPlayIcon !== void 0 ? videoPlayIcon : PAUSE_ICON, alt: 'pause' })))));
|
353
|
-
};
|
392
|
+
isPauseVideo && (react_1.default.createElement(FormatImage_1.default, { className: 'clc-pb-video-pause', src: videoPlayIcon !== null && videoPlayIcon !== void 0 ? videoPlayIcon : PAUSE_ICON, alt: 'pause' }))))));
|
393
|
+
});
|
354
394
|
exports.default = (0, react_1.memo)(VideoWidget);
|
@@ -44,7 +44,8 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
44
44
|
const [isReload, setIsReload] = (0, react_1.useState)(new Date().getTime());
|
45
45
|
const skipLinkRef = (0, react_1.useRef)(false);
|
46
46
|
const [pageNum, setPageNum] = (0, react_1.useState)(2);
|
47
|
-
const
|
47
|
+
const videoWidgetRef = (0, react_1.useRef)(null);
|
48
|
+
const { loadVideos, bffEventReport, loading, setPopupDetailData, ctaEvent, swiperRef, waterFallData, setOpenHashtag, appDomain, openHashtag, loadingImage, isFromHashtag, popupDetailData, bffFbReport, curTime, h5EnterLink, isShowConsent, selectTag, isPreview, isEditor, cacheRtcList, setRtcList, cacheActiveIndex, rtcList, isNoMoreData, channel, refreshFeSession, isDiyH5 } = (0, hooks_1.useSxpDataSource)();
|
48
49
|
const { backMainFeed, productView, jumpToWeb } = (0, useEventReport_1.useEventReport)();
|
49
50
|
const isShowFingerTip = (0, react_1.useMemo)(() => {
|
50
51
|
return data.length > 0 && !loading && ((0, localStore_1.getFeUserState)() || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enableSwiperTip));
|
@@ -179,6 +180,8 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
179
180
|
refreshFeSession
|
180
181
|
]);
|
181
182
|
const handleSessionExpire = (0, react_1.useCallback)((0, lodash_1.debounce)(() => {
|
183
|
+
var _a;
|
184
|
+
(_a = videoWidgetRef.current) === null || _a === void 0 ? void 0 : _a.setLoopPlay(false);
|
182
185
|
refreshFeSession === null || refreshFeSession === void 0 ? void 0 : refreshFeSession(false, handleSessionCompleted);
|
183
186
|
}, 1000), [handleSessionCompleted, refreshFeSession]);
|
184
187
|
(0, react_1.useEffect)(() => {
|
@@ -253,7 +256,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
253
256
|
return (react_1.default.createElement(MultiPosts_1.default, Object.assign({ recData: data === null || data === void 0 ? void 0 : data[1] }, (_c = (_b = (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.multiPosts) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.item) === null || _c === void 0 ? void 0 : _c.props, (_f = (_e = (_d = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.multiPosts) === null || _d === void 0 ? void 0 : _d[0]) === null || _e === void 0 ? void 0 : _e.item) === null || _f === void 0 ? void 0 : _f.event)));
|
254
257
|
}
|
255
258
|
if ((_g = rec === null || rec === void 0 ? void 0 : rec.video) === null || _g === void 0 ? void 0 : _g.url) {
|
256
|
-
return (react_1.default.createElement(VideoWidget_1.default, { key: isReload, rec: rec, index: index, muted: isMuted, data: data, height: height, activeIndex: activeIndex, videoPostConfig: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.videoPost, videoPlayIcon: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.videoPlayIcon }));
|
259
|
+
return (react_1.default.createElement(VideoWidget_1.default, Object.assign({ key: isReload }, (activeIndex === index && { ref: videoWidgetRef }), { rec: rec, index: index, muted: isMuted, data: data, height: height, activeIndex: activeIndex, videoPostConfig: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.videoPost, videoPlayIcon: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.videoPlayIcon, loopPlay: true, swiperRef: swiperRef })));
|
257
260
|
}
|
258
261
|
if ((_h = rec === null || rec === void 0 ? void 0 : rec.video) === null || _h === void 0 ? void 0 : _h.imgUrls) {
|
259
262
|
return (react_1.default.createElement(PictureGroup_1.default, { key: rec === null || rec === void 0 ? void 0 : rec.video.itemId, imgUrls: rec === null || rec === void 0 ? void 0 : rec.video.imgUrls, width: containerWidth, height: height, rec: rec, index: index, onViewImageEndEvent: handleViewImageStartEnd, onViewImageStartEvent: handleViewImageStartEvent, imgUrlsPostConfig: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.imgUrlsPost }));
|
@@ -597,7 +600,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
597
600
|
if (openHashtag)
|
598
601
|
return;
|
599
602
|
handleScrollEvent(swiper);
|
600
|
-
if (waterFallData || isEditor)
|
603
|
+
if (waterFallData || isEditor || isDiyH5)
|
601
604
|
return;
|
602
605
|
if ((swiper === null || swiper === void 0 ? void 0 : swiper.activeIndex) + 1 >= (data === null || data === void 0 ? void 0 : data.length)) {
|
603
606
|
if (!isLoadMore) {
|
@@ -47,6 +47,24 @@ export type ProductInfoType = {
|
|
47
47
|
cover?: string;
|
48
48
|
remark?: string;
|
49
49
|
};
|
50
|
+
export interface IScene {
|
51
|
+
blueprintStep: number;
|
52
|
+
endTime: number;
|
53
|
+
itemId: string;
|
54
|
+
mediaFileNo: string;
|
55
|
+
mediaUrl: string;
|
56
|
+
position: number;
|
57
|
+
postId: string;
|
58
|
+
sceneId: string;
|
59
|
+
sceneInfo: string;
|
60
|
+
sceneTag: string;
|
61
|
+
startTime: number;
|
62
|
+
traceInfo: string;
|
63
|
+
cover: string;
|
64
|
+
bindProducts?: any[];
|
65
|
+
title?: string;
|
66
|
+
}
|
67
|
+
export type ScenesType = IScene[];
|
50
68
|
export type VideoInfoType = {
|
51
69
|
bindCtaId: string;
|
52
70
|
bindProductId: string;
|
@@ -65,6 +83,7 @@ export type VideoInfoType = {
|
|
65
83
|
bindProduct: ProductInfoType;
|
66
84
|
bindCta: CTAInfoType;
|
67
85
|
hashTags: string[];
|
86
|
+
scene: IScene;
|
68
87
|
};
|
69
88
|
export type RecommendVideoResultType = {
|
70
89
|
recList: Array<RecItemType>;
|
@@ -72,7 +72,7 @@ export interface ISxpDataSourceContext {
|
|
72
72
|
bffFbReport?: (body: {
|
73
73
|
eventName: 'PageView' | 'ProductView' | 'ViewContent';
|
74
74
|
product?: any;
|
75
|
-
}) =>
|
75
|
+
}) => Promise<any> | undefined | boolean;
|
76
76
|
curTime?: any;
|
77
77
|
h5EnterLink?: () => void;
|
78
78
|
themeTag?: any;
|
@@ -92,6 +92,7 @@ export interface ISxpDataSourceContext {
|
|
92
92
|
refreshFeSession?: (enableReSid?: boolean, event?: (fk: string) => void) => void;
|
93
93
|
getAccount?: () => Promise<any>;
|
94
94
|
accountSonsent?: (v: boolean) => Promise<boolean>;
|
95
|
+
isDiyH5?: boolean;
|
95
96
|
}
|
96
97
|
export declare const SxpDataSourceContext: React.Context<ISxpDataSourceContext>;
|
97
98
|
export interface SxpDataSourceProviderProps {
|
@@ -133,6 +134,7 @@ export interface SxpDataSourceProviderProps {
|
|
133
134
|
channelQueryList?: any[];
|
134
135
|
data?: PageData;
|
135
136
|
dataList?: PageData[];
|
137
|
+
isDiyH5?: boolean;
|
136
138
|
onUpdateSchema?: (d: PageData['data']) => void;
|
137
139
|
onUpdateChannel?: (d: string) => void;
|
138
140
|
}
|
@@ -20,7 +20,7 @@ var DataSourceType;
|
|
20
20
|
DataSourceType[DataSourceType["BFF"] = 5] = "BFF";
|
21
21
|
})(DataSourceType || (DataSourceType = {}));
|
22
22
|
exports.DEFAULT_TAG = 'FOR U';
|
23
|
-
const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent = true, maxSize, defaultSize, isPreview = false, sxpParameter, appDomain, hashTagSize, loadingImage, isOpenHashTag = false, enabledMetaConversionApi = false, consentHeight, consentWidth, isOpenConsent = false, isEditor = false, utmParameter, channelQueryList, data, dataList, onUpdateSchema, onUpdateChannel }) => {
|
23
|
+
const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent = true, maxSize, defaultSize, isPreview = false, sxpParameter, appDomain, hashTagSize, loadingImage, isOpenHashTag = false, enabledMetaConversionApi = false, consentHeight, consentWidth, isOpenConsent = false, isEditor = false, utmParameter, channelQueryList, data, dataList, isDiyH5, onUpdateSchema, onUpdateChannel }) => {
|
24
24
|
var _a, _b, _c, _d, _e;
|
25
25
|
const [rtcList, setRtcList] = (0, react_1.useState)([]);
|
26
26
|
const [tagList, setTagList] = (0, react_1.useState)([]);
|
@@ -108,7 +108,6 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
108
108
|
return ((_a = bffDataSource === null || bffDataSource === void 0 ? void 0 : bffDataSource.headers) === null || _a === void 0 ? void 0 : _a['x-app-id']) + (0, localStore_1.storeAndLoadFeUserId)();
|
109
109
|
}, [bffDataSource]);
|
110
110
|
const bffFetch = (0, react_1.useCallback)((path, options) => {
|
111
|
-
var _a, _b;
|
112
111
|
if (!bffDataSource)
|
113
112
|
return;
|
114
113
|
const url = bffDataSource.url;
|
@@ -116,33 +115,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
116
115
|
const queryString = qs_1.default.stringify(options.query);
|
117
116
|
path = `${path}?${queryString}`;
|
118
117
|
}
|
119
|
-
|
120
|
-
const params = {};
|
121
|
-
const queryString = location.search.slice(1);
|
122
|
-
(_a = (0, tool_1.splitUrlParams)(queryString)) === null || _a === void 0 ? void 0 : _a.forEach((val) => {
|
123
|
-
const key = val.split('=')[0];
|
124
|
-
const value = val.split('=')[1];
|
125
|
-
params[key] = value;
|
126
|
-
});
|
127
|
-
const cl_source = params === null || params === void 0 ? void 0 : params.cl_source;
|
128
|
-
if (cl_source &&
|
129
|
-
((_b = [
|
130
|
-
'40A-SPRK--DRESS_EYEWEAR-',
|
131
|
-
'41A-SPRK--MADRAGUE-',
|
132
|
-
'42A-SPRK--MOOD-',
|
133
|
-
'43A-SPRK--SUMMER-',
|
134
|
-
'44A-SPRK--DRESS_EYEWEAR-',
|
135
|
-
'45A-SPRK--MADRAGUE-',
|
136
|
-
'46A-SPRK--MOOD-',
|
137
|
-
'47A-SPRK--SUMMER-',
|
138
|
-
'48A-SPRK--DRESS_EYEWEAR-',
|
139
|
-
'49A-SPRK--MADRAGUE-',
|
140
|
-
'50A-SPRK--MOOD-',
|
141
|
-
'51A-SPRK--SUMMER-'
|
142
|
-
]) === null || _b === void 0 ? void 0 : _b.includes(cl_source))) {
|
143
|
-
isTikTokChannel = true;
|
144
|
-
}
|
145
|
-
if (options.type === 'beacon' && navigator.sendBeacon && !isTikTokChannel) {
|
118
|
+
if (options.type === 'beacon' && navigator.sendBeacon) {
|
146
119
|
return navigator.sendBeacon(`${url}/api/${path}`, new Blob([
|
147
120
|
JSON.stringify({
|
148
121
|
body: btoa(encodeURIComponent(JSON.stringify(Object.assign(Object.assign(Object.assign({}, options.body), bffDataSource.headers), { 'x-user-id': fakeUserId }))))
|
@@ -152,11 +125,11 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
152
125
|
}));
|
153
126
|
}
|
154
127
|
return window
|
155
|
-
.fetch(`${url}/api/${path}`,
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
128
|
+
.fetch(`${url}/api/${path}`, {
|
129
|
+
headers: Object.assign({ 'Content-Type': 'application/json', 'x-user-id': fakeUserId }, bffDataSource.headers),
|
130
|
+
method: options.method,
|
131
|
+
body: JSON.stringify(options.body)
|
132
|
+
})
|
160
133
|
.then((res) => res.json())
|
161
134
|
.catch((err) => Promise.reject(err));
|
162
135
|
}, [bffDataSource, fakeUserId]);
|
@@ -179,7 +152,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
179
152
|
}, [bffDataSource]);
|
180
153
|
const getRecommendVideos = (0, react_1.useCallback)((query) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
181
154
|
var _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
182
|
-
query = Object.assign({ maxSize: (_f = query === null || query === void 0 ? void 0 : query.maxSize) !== null && _f !== void 0 ? _f : maxSize, defaultSize: (_g = query === null || query === void 0 ? void 0 : query.defaultSize) !== null && _g !== void 0 ? _g : defaultSize, hashTag: query === null || query === void 0 ? void 0 : query.hashTag, traceInfo: query === null || query === void 0 ? void 0 : query.traceInfo, themeTag: query === null || query === void 0 ? void 0 : query.themeTag, pageNum: query === null || query === void 0 ? void 0 : query.pageNum, contentFilter: query === null || query === void 0 ? void 0 : query.contentFilter, productFilter: query === null || query === void 0 ? void 0 : query.productFilter }, (chatlabsId && { chatlabsId }));
|
155
|
+
query = Object.assign(Object.assign({ maxSize: (_f = query === null || query === void 0 ? void 0 : query.maxSize) !== null && _f !== void 0 ? _f : maxSize, defaultSize: (_g = query === null || query === void 0 ? void 0 : query.defaultSize) !== null && _g !== void 0 ? _g : defaultSize, hashTag: query === null || query === void 0 ? void 0 : query.hashTag, traceInfo: query === null || query === void 0 ? void 0 : query.traceInfo, themeTag: query === null || query === void 0 ? void 0 : query.themeTag, pageNum: query === null || query === void 0 ? void 0 : query.pageNum, contentFilter: query === null || query === void 0 ? void 0 : query.contentFilter, productFilter: query === null || query === void 0 ? void 0 : query.productFilter }, (chatlabsId && { chatlabsId })), (isDiyH5 && { type: 'story' }));
|
183
156
|
if (channel) {
|
184
157
|
query = Object.assign(Object.assign({}, query), { channel: decodeURIComponent(channel) });
|
185
158
|
}
|
@@ -228,7 +201,10 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
228
201
|
if (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview) {
|
229
202
|
query = Object.assign(Object.assign({}, query), { directPage: true, level: 1, pageNum: (_o = query === null || query === void 0 ? void 0 : query.pageNum) !== null && _o !== void 0 ? _o : 1 });
|
230
203
|
}
|
231
|
-
const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/recommend/list', {
|
204
|
+
const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/recommend/list', {
|
205
|
+
method: 'POST',
|
206
|
+
body: query
|
207
|
+
}));
|
232
208
|
if (!(result === null || result === void 0 ? void 0 : result.success)) {
|
233
209
|
return undefined;
|
234
210
|
}
|
@@ -288,7 +264,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
288
264
|
const sessionID = (0, sessionStore_1.storeAndLoadFeSessionId)();
|
289
265
|
const params = {};
|
290
266
|
const queryString = location.search.slice(1);
|
291
|
-
(_a = (0, tool_1.splitUrlParams)(queryString)) === null || _a === void 0 ? void 0 : _a.
|
267
|
+
(_a = (0, tool_1.splitUrlParams)(queryString)) === null || _a === void 0 ? void 0 : _a.forEach((val) => {
|
292
268
|
const key = val.split('=')[0];
|
293
269
|
const value = val.split('=')[1];
|
294
270
|
params[key] = value;
|
@@ -318,17 +294,23 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
318
294
|
playbookType,
|
319
295
|
bffDataSource
|
320
296
|
]);
|
321
|
-
const
|
322
|
-
var _a, _b, _c;
|
323
|
-
|
297
|
+
const bffFbReport = (0, react_1.useCallback)(({ eventName, product }) => {
|
298
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
299
|
+
if (!enableReportEvent ||
|
300
|
+
!enabledMetaConversionApi ||
|
301
|
+
(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview) ||
|
302
|
+
!((_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.converApi) === null || _a === void 0 ? void 0 : _a[eventName])) {
|
303
|
+
return;
|
304
|
+
}
|
305
|
+
const jsonParams = (0, lodash_1.cloneDeep)((_b = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.converApi) === null || _b === void 0 ? void 0 : _b[eventName]);
|
324
306
|
const urlParams = new URLSearchParams(window.location.search);
|
325
307
|
const fbclid = urlParams === null || urlParams === void 0 ? void 0 : urlParams.get('fbclid');
|
326
308
|
const fix_par = {
|
327
|
-
event_source_url: (
|
309
|
+
event_source_url: (_c = window === null || window === void 0 ? void 0 : window.location) === null || _c === void 0 ? void 0 : _c.href,
|
328
310
|
external_id: fakeUserId,
|
329
|
-
client_user_agent: (
|
311
|
+
client_user_agent: (_e = (_d = window === null || window === void 0 ? void 0 : window.navigator) === null || _d === void 0 ? void 0 : _d.userAgent) !== null && _e !== void 0 ? _e : '',
|
330
312
|
fbc: fbclid ? `fb.2.${new Date().getTime()}.${fbclid}` : '',
|
331
|
-
fbp: (0, tool_1.getCookie)('_fbp') ?
|
313
|
+
fbp: (0, tool_1.getCookie)('_fbp') ? `fb.2.${new Date().getTime()}.${(0, tool_1.getCookie)('_fbp')}` : '',
|
332
314
|
time: Math.floor(Date.now() / 1000)
|
333
315
|
};
|
334
316
|
const regex = /\{\{(.*?)\}\}/g;
|
@@ -340,7 +322,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
340
322
|
}
|
341
323
|
else {
|
342
324
|
for (const key in obj) {
|
343
|
-
if (
|
325
|
+
if (obj.hasOwnProperty(key)) {
|
344
326
|
const value = obj === null || obj === void 0 ? void 0 : obj[key];
|
345
327
|
if (typeof value === 'object') {
|
346
328
|
getEventParams(value);
|
@@ -377,59 +359,28 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
377
359
|
}
|
378
360
|
};
|
379
361
|
getEventParams(jsonParams);
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
}
|
387
|
-
const
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
history.pushState({ path: newUrl }, '', newUrl);
|
403
|
-
}
|
404
|
-
else {
|
405
|
-
const body = getEventParamsByJson(pixelEventParamsJson);
|
406
|
-
window === null || window === void 0 ? void 0 : window.fbq('track', pixelEventParamsJson === null || pixelEventParamsJson === void 0 ? void 0 : pixelEventParamsJson.event_name, body);
|
407
|
-
if (eventName === 'PageView' && typeof (window === null || window === void 0 ? void 0 : window.gtag) === 'function') {
|
408
|
-
window === null || window === void 0 ? void 0 : window.gtag('event', 'page_view');
|
409
|
-
}
|
410
|
-
}
|
411
|
-
}
|
412
|
-
else if (eventName === 'PageView' && typeof (window === null || window === void 0 ? void 0 : window.gtag) === 'function') {
|
413
|
-
window === null || window === void 0 ? void 0 : window.gtag('event', 'page_view');
|
414
|
-
}
|
415
|
-
const converApiEventParamsJson = (_b = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.converApi) === null || _b === void 0 ? void 0 : _b[eventName];
|
416
|
-
if (enabledMetaConversionApi && converApiEventParamsJson) {
|
417
|
-
const body = getEventParamsByJson(converApiEventParamsJson, product);
|
418
|
-
const params = {};
|
419
|
-
const queryString = location.search.slice(1);
|
420
|
-
(_c = (0, tool_1.splitUrlParams)(queryString)) === null || _c === void 0 ? void 0 : _c.forEach((val) => {
|
421
|
-
const key = val.split('=')[0];
|
422
|
-
const value = val.split('=')[1];
|
423
|
-
params[key] = value;
|
424
|
-
});
|
425
|
-
const cl_source = params === null || params === void 0 ? void 0 : params.cl_source;
|
426
|
-
bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch(`v2/fb/${(_d = bffDataSource === null || bffDataSource === void 0 ? void 0 : bffDataSource.headers) === null || _d === void 0 ? void 0 : _d['x-app-id']}/${eventName}${cl_source ? `/${decodeURIComponent(cl_source)}` : ''}`, {
|
427
|
-
method: 'POST',
|
428
|
-
body,
|
429
|
-
type: 'beacon'
|
430
|
-
});
|
431
|
-
}
|
432
|
-
}, [bffFetch, enableReportEvent, enabledMetaConversionApi, globalConfig, bffDataSource, getEventParamsByJson]);
|
362
|
+
const params = {};
|
363
|
+
const queryString = location.search.slice(1);
|
364
|
+
(_f = (0, tool_1.splitUrlParams)(queryString)) === null || _f === void 0 ? void 0 : _f.map((val) => {
|
365
|
+
const key = val.split('=')[0];
|
366
|
+
const value = val.split('=')[1];
|
367
|
+
params[key] = value;
|
368
|
+
});
|
369
|
+
const cl_source = params === null || params === void 0 ? void 0 : params.cl_source;
|
370
|
+
return bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch(`v2/fb/${(_g = bffDataSource === null || bffDataSource === void 0 ? void 0 : bffDataSource.headers) === null || _g === void 0 ? void 0 : _g['x-app-id']}/${eventName}${cl_source ? `/${decodeURIComponent(cl_source)}` : ''}`, {
|
371
|
+
method: 'POST',
|
372
|
+
body: jsonParams,
|
373
|
+
type: 'beacon'
|
374
|
+
});
|
375
|
+
}, [
|
376
|
+
bffFetch,
|
377
|
+
enableReportEvent,
|
378
|
+
enabledMetaConversionApi,
|
379
|
+
globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview,
|
380
|
+
globalConfig,
|
381
|
+
fakeUserId,
|
382
|
+
bffDataSource
|
383
|
+
]);
|
433
384
|
const bffMutateLike = (0, react_1.useCallback)((body) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
434
385
|
const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/recommend/like', { method: 'POST', body }));
|
435
386
|
return res === null || res === void 0 ? void 0 : res.success;
|
@@ -677,7 +628,8 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
677
628
|
multiPostTimeRef,
|
678
629
|
refreshFeSession,
|
679
630
|
getAccount,
|
680
|
-
accountSonsent
|
631
|
+
accountSonsent,
|
632
|
+
isDiyH5
|
681
633
|
} }, isShowConsent ? (react_1.default.createElement(Consent_1.default, Object.assign({}, (_e = (_d = (_c = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.consent) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.item) === null || _e === void 0 ? void 0 : _e.props))) : (render({
|
682
634
|
rtcList,
|
683
635
|
mutateLike: bffMutateLike,
|
package/lib/index.d.ts
CHANGED
@@ -4,6 +4,7 @@ export * as core from './core';
|
|
4
4
|
export * as materials from './materials';
|
5
5
|
export { default as SxpPageRender } from './core/components/SxpPageRender';
|
6
6
|
export { default as DiyPortalPreview } from './core/components/DiyPortalPreview';
|
7
|
+
export { default as DiyStoryPreview } from './core/components/DiyStoryPreview';
|
7
8
|
export { default as Modal } from './core/components/SxpPageRender/Modal';
|
8
9
|
export { default as SxpDataSourceProvider } from './core/context/SxpDataSourceProvider';
|
9
10
|
export { default as SxpPageCore } from './core/components/SxpPageCore';
|
package/lib/index.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.useEditorDataProvider = exports.EditorDataProvider = exports.SxpPageCore = exports.SxpDataSourceProvider = exports.Modal = exports.DiyPortalPreview = exports.SxpPageRender = exports.materials = exports.core = void 0;
|
3
|
+
exports.useEditorDataProvider = exports.EditorDataProvider = exports.SxpPageCore = exports.SxpDataSourceProvider = exports.Modal = exports.DiyStoryPreview = 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
|
require("./index.css");
|
@@ -10,6 +10,8 @@ var SxpPageRender_1 = require("./core/components/SxpPageRender");
|
|
10
10
|
Object.defineProperty(exports, "SxpPageRender", { enumerable: true, get: function () { return tslib_1.__importDefault(SxpPageRender_1).default; } });
|
11
11
|
var DiyPortalPreview_1 = require("./core/components/DiyPortalPreview");
|
12
12
|
Object.defineProperty(exports, "DiyPortalPreview", { enumerable: true, get: function () { return tslib_1.__importDefault(DiyPortalPreview_1).default; } });
|
13
|
+
var DiyStoryPreview_1 = require("./core/components/DiyStoryPreview");
|
14
|
+
Object.defineProperty(exports, "DiyStoryPreview", { enumerable: true, get: function () { return tslib_1.__importDefault(DiyStoryPreview_1).default; } });
|
13
15
|
var Modal_1 = require("./core/components/SxpPageRender/Modal");
|
14
16
|
Object.defineProperty(exports, "Modal", { enumerable: true, get: function () { return tslib_1.__importDefault(Modal_1).default; } });
|
15
17
|
var SxpDataSourceProvider_1 = require("./core/context/SxpDataSourceProvider");
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
4
4
|
const css_1 = require("@emotion/css");
|
5
5
|
const react_1 = tslib_1.__importStar(require("react"));
|
6
|
-
const CommodityGroup_1 = tslib_1.__importDefault(require("../../template/components/CommodityGroup"));
|
7
6
|
const hooks_1 = require("../../../../core/hooks");
|
8
7
|
require("./index.less");
|
9
8
|
const modules_1 = require("swiper/modules");
|
@@ -13,6 +12,7 @@ const Modal_1 = tslib_1.__importDefault(require("../../../../core/components/Sxp
|
|
13
12
|
const ExpandableText_1 = tslib_1.__importDefault(require("../../../../core/components/SxpPageRender/ExpandableText"));
|
14
13
|
const FormatImage_1 = tslib_1.__importDefault(require("../../../../core/components/SxpPageRender/FormatImage"));
|
15
14
|
const tool_1 = require("../../../../core/utils/tool");
|
15
|
+
const CommodityGroup_1 = tslib_1.__importDefault(require("../../template/components/CommodityGroup"));
|
16
16
|
const materials_1 = require("../../../../core/utils/materials");
|
17
17
|
const CommodityDetail = (_a) => {
|
18
18
|
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
|
@@ -69,7 +69,7 @@ const CommodityDetail = (_a) => {
|
|
69
69
|
};
|
70
70
|
}, []);
|
71
71
|
const priceText = (0, materials_1.getPriceText)({
|
72
|
-
product,
|
72
|
+
product: product,
|
73
73
|
enableFormattedPrice: (_t = commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price) === null || _t === void 0 ? void 0 : _t.enableFormattedPrice,
|
74
74
|
globalConfig,
|
75
75
|
style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
4
4
|
const css_1 = require("@emotion/css");
|
5
5
|
const react_1 = tslib_1.__importStar(require("react"));
|
6
|
-
const CommodityGroup_1 = tslib_1.__importDefault(require("../../template/components/CommodityGroup"));
|
7
6
|
const hooks_1 = require("../../../../core/hooks");
|
8
7
|
require("./index.less");
|
9
8
|
const modules_1 = require("swiper/modules");
|
@@ -13,6 +12,7 @@ const ExpandableText_1 = tslib_1.__importDefault(require("../../../../core/compo
|
|
13
12
|
const useEventReport_1 = require("../../../../core/hooks/useEventReport");
|
14
13
|
const FormatImage_1 = tslib_1.__importDefault(require("../../../../core/components/SxpPageRender/FormatImage"));
|
15
14
|
const tool_1 = require("../../../../core/utils/tool");
|
15
|
+
const CommodityGroup_1 = tslib_1.__importDefault(require("../../template/components/CommodityGroup"));
|
16
16
|
const materials_1 = require("../../../../core/utils/materials");
|
17
17
|
const CommodityDetailDiroNew = (_a) => {
|
18
18
|
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4;
|