pb-sxp-ui 1.2.10 → 1.3.1
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 +700 -284
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +62 -2
- package/dist/index.js +700 -284
- package/dist/index.js.map +1 -1
- package/dist/index.min.cjs +3 -3
- package/dist/index.min.cjs.map +1 -1
- package/dist/index.min.js +3 -3
- package/dist/index.min.js.map +1 -1
- package/dist/pb-ui.js +700 -284
- package/dist/pb-ui.js.map +1 -1
- package/dist/pb-ui.min.js +3 -3
- package/dist/pb-ui.min.js.map +1 -1
- package/es/core/components/SxpPageRender/FormatImage.js +1 -1
- package/es/core/components/SxpPageRender/Modal/index.js +34 -20
- package/es/core/components/SxpPageRender/Popup/index.js +2 -2
- package/es/core/components/SxpPageRender/ToggleButton/index.js +4 -1
- package/es/core/components/SxpPageRender/WaterFall/List.js +13 -18
- package/es/core/components/SxpPageRender/WaterFall/WaterfallList.js +12 -17
- package/es/core/components/SxpPageRender/index.d.ts +6 -1
- package/es/core/components/SxpPageRender/index.js +73 -42
- package/es/core/components/SxpPageRender/typing.d.ts +2 -0
- package/es/core/context/EditorContext.js +2 -0
- package/es/core/context/SxpDataSourceProvider.d.ts +3 -2
- package/es/core/context/SxpDataSourceProvider.js +53 -33
- package/es/core/hooks/useEventReport.d.ts +1 -1
- package/es/core/hooks/useEventReport.js +10 -9
- package/es/core/utils/tool.d.ts +5 -1
- package/es/core/utils/tool.js +69 -1
- package/es/materials/sxp/popup/AppointForm/settingRender.js +15 -0
- package/es/materials/sxp/popup/CommodityDetail/index.d.ts +13 -2
- package/es/materials/sxp/popup/CommodityDetail/index.js +60 -34
- package/es/materials/sxp/popup/CommodityDetail/material.js +4 -0
- package/es/materials/sxp/popup/CommodityDetail/settingRender.d.ts +28 -2
- package/es/materials/sxp/popup/CommodityDetail/settingRender.js +52 -0
- package/es/materials/sxp/popup/CommodityDetailDiroNew/index.d.ts +13 -2
- package/es/materials/sxp/popup/CommodityDetailDiroNew/index.js +85 -51
- package/es/materials/sxp/popup/CommodityDetailDiroNew/material.js +4 -0
- package/es/materials/sxp/popup/CommodityDetailDiroNew/settingRender.d.ts +28 -2
- package/es/materials/sxp/popup/CommodityDetailDiroNew/settingRender.js +52 -0
- package/es/materials/sxp/popup/CommodityList/settingRender.js +15 -0
- package/es/materials/sxp/popup/Iframe/index.d.ts +16 -0
- package/es/materials/sxp/popup/Iframe/index.js +18 -0
- package/es/materials/sxp/popup/Iframe/material.d.ts +2 -0
- package/es/materials/sxp/popup/Iframe/material.js +21 -0
- package/es/materials/sxp/popup/Iframe/settingRender.d.ts +9 -0
- package/es/materials/sxp/popup/Iframe/settingRender.js +12 -0
- package/es/materials/sxp/popup/Prompt/settingRender.js +16 -1
- package/es/materials/sxp/popup/index.d.ts +1 -0
- package/es/materials/sxp/popup/index.js +1 -0
- package/es/materials/sxp/template/Link/index.js +5 -11
- package/es/materials/sxp/template/Link/interactionRender.d.ts +8 -0
- package/es/materials/sxp/template/Link/interactionRender.js +11 -0
- package/es/materials/sxp/template/Link/material.js +3 -1
- package/es/materials/sxp/template/components/EventProvider.d.ts +3 -2
- package/es/materials/sxp/template/components/EventProvider.js +3 -3
- package/lib/core/components/SxpPageRender/FormatImage.js +1 -1
- package/lib/core/components/SxpPageRender/Modal/index.js +34 -20
- package/lib/core/components/SxpPageRender/Popup/index.js +2 -2
- package/lib/core/components/SxpPageRender/ToggleButton/index.js +3 -0
- package/lib/core/components/SxpPageRender/WaterFall/List.js +13 -18
- package/lib/core/components/SxpPageRender/WaterFall/WaterfallList.js +12 -17
- package/lib/core/components/SxpPageRender/index.d.ts +6 -1
- package/lib/core/components/SxpPageRender/index.js +72 -41
- package/lib/core/components/SxpPageRender/typing.d.ts +2 -0
- package/lib/core/context/EditorContext.js +2 -0
- package/lib/core/context/SxpDataSourceProvider.d.ts +3 -2
- package/lib/core/context/SxpDataSourceProvider.js +53 -33
- package/lib/core/hooks/useEventReport.d.ts +1 -1
- package/lib/core/hooks/useEventReport.js +10 -9
- package/lib/core/utils/tool.d.ts +5 -1
- package/lib/core/utils/tool.js +73 -1
- package/lib/materials/sxp/popup/AppointForm/settingRender.js +15 -0
- package/lib/materials/sxp/popup/CommodityDetail/index.d.ts +13 -2
- package/lib/materials/sxp/popup/CommodityDetail/index.js +60 -34
- package/lib/materials/sxp/popup/CommodityDetail/material.js +4 -0
- package/lib/materials/sxp/popup/CommodityDetail/settingRender.d.ts +28 -2
- package/lib/materials/sxp/popup/CommodityDetail/settingRender.js +52 -0
- package/lib/materials/sxp/popup/CommodityDetailDiroNew/index.d.ts +13 -2
- package/lib/materials/sxp/popup/CommodityDetailDiroNew/index.js +85 -51
- package/lib/materials/sxp/popup/CommodityDetailDiroNew/material.js +4 -0
- package/lib/materials/sxp/popup/CommodityDetailDiroNew/settingRender.d.ts +28 -2
- package/lib/materials/sxp/popup/CommodityDetailDiroNew/settingRender.js +52 -0
- package/lib/materials/sxp/popup/CommodityList/settingRender.js +15 -0
- package/lib/materials/sxp/popup/Iframe/index.d.ts +16 -0
- package/lib/materials/sxp/popup/Iframe/index.js +20 -0
- package/lib/materials/sxp/popup/Iframe/material.d.ts +2 -0
- package/lib/materials/sxp/popup/Iframe/material.js +25 -0
- package/lib/materials/sxp/popup/Iframe/settingRender.d.ts +9 -0
- package/lib/materials/sxp/popup/Iframe/settingRender.js +14 -0
- package/lib/materials/sxp/popup/Prompt/settingRender.js +16 -1
- package/lib/materials/sxp/popup/index.d.ts +1 -0
- package/lib/materials/sxp/popup/index.js +1 -0
- package/lib/materials/sxp/template/Link/index.js +5 -11
- package/lib/materials/sxp/template/Link/interactionRender.d.ts +8 -0
- package/lib/materials/sxp/template/Link/interactionRender.js +13 -0
- package/lib/materials/sxp/template/Link/material.js +3 -1
- package/lib/materials/sxp/template/components/EventProvider.d.ts +3 -2
- package/lib/materials/sxp/template/components/EventProvider.js +3 -3
- package/package.json +1 -1
@@ -25,7 +25,9 @@ const withBindDataSource_1 = tslib_1.__importDefault(require("../../../core/hoc/
|
|
25
25
|
const Tagbar_1 = tslib_1.__importDefault(require("./Tagbar"));
|
26
26
|
const localStore_1 = require("../../../core/utils/localStore");
|
27
27
|
const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.innerHeight, containerWidth = window.innerWidth, tempMap, resolver, data = [], ctaType, tipText, nudge, _schema, hashTagStyle, tagList = [], licenseUrl }) => {
|
28
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j
|
28
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
29
|
+
const mutedIcon = (0, useIconLink_1.useIconLink)('/pb_static/5beaaa5ce7f3477b99db3838619cc471.png');
|
30
|
+
const unmutedIcon = (0, useIconLink_1.useIconLink)('/pb_static/fea8668a8a894e4aa3a86bcc775e895e.png');
|
29
31
|
const { schema } = (0, hooks_1.useEditor)();
|
30
32
|
const [activeIndex, setActiveIndex] = (0, react_1.useState)(0);
|
31
33
|
const viewImageStartTime = (0, react_1.useRef)(0);
|
@@ -36,11 +38,10 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
36
38
|
const [isReload, setIsReload] = (0, react_1.useState)(new Date().getTime());
|
37
39
|
const skipLinkRef = (0, react_1.useRef)(false);
|
38
40
|
const { loadVideos, bffEventReport, loading, setPopupDetailData, ctaEvent, swiperRef, waterFallData, setOpenHashtag, appDomain, openHashtag, loadingImage, isFromHashtag, popupDetailData, bffFbReport, curTime, h5EnterLink, isShowConsent, selectTag, isPreview } = (0, hooks_1.useSxpDataSource)();
|
39
|
-
const { backMainFeed } = (0, useEventReport_1.useEventReport)();
|
40
|
-
const { productView } = (0, useEventReport_1.useEventReport)();
|
41
|
+
const { backMainFeed, productView, jumpToWeb } = (0, useEventReport_1.useEventReport)();
|
41
42
|
const isShowFingerTip = (0, react_1.useMemo)(() => {
|
42
|
-
return data.length > 0 && !loading && (0, localStore_1.getFeUserId)();
|
43
|
-
}, [data, loading]);
|
43
|
+
return data.length > 0 && !loading && ((0, localStore_1.getFeUserId)() || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enableSwiperTip));
|
44
|
+
}, [data, loading, globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enableSwiperTip]);
|
44
45
|
(0, react_1.useEffect)(() => {
|
45
46
|
(0, sessionStore_1.refreshFeSessionId)();
|
46
47
|
}, []);
|
@@ -68,14 +69,15 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
68
69
|
var _a;
|
69
70
|
const index = (data === null || data === void 0 ? void 0 : data.findIndex((item) => {
|
70
71
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
71
|
-
|
72
|
+
const ctaType0 = ctaType === null || ctaType === void 0 ? void 0 : ctaType[0];
|
73
|
+
if (ctaType0 === '多商品CTA') {
|
72
74
|
return ((_a = item === null || item === void 0 ? void 0 : item.video) === null || _a === void 0 ? void 0 : _a.bindProducts) && ((_c = (_b = item === null || item === void 0 ? void 0 : item.video) === null || _b === void 0 ? void 0 : _b.bindProducts) === null || _c === void 0 ? void 0 : _c.length) > 0;
|
73
75
|
}
|
74
|
-
else if (
|
76
|
+
else if (ctaType0 === '商品CTA') {
|
75
77
|
return (_d = item === null || item === void 0 ? void 0 : item.video) === null || _d === void 0 ? void 0 : _d.bindProduct;
|
76
78
|
}
|
77
79
|
else {
|
78
|
-
return ((_f = (_e = item === null || item === void 0 ? void 0 : item.video) === null || _e === void 0 ? void 0 : _e.bindCta) === null || _f === void 0 ? void 0 : _f.itemId) ===
|
80
|
+
return ((_f = (_e = item === null || item === void 0 ? void 0 : item.video) === null || _e === void 0 ? void 0 : _e.bindCta) === null || _f === void 0 ? void 0 : _f.itemId) === ctaType0 && (((_g = item === null || item === void 0 ? void 0 : item.video) === null || _g === void 0 ? void 0 : _g.url) || ((_j = (_h = item === null || item === void 0 ? void 0 : item.video) === null || _h === void 0 ? void 0 : _h.imgUrls) === null || _j === void 0 ? void 0 : _j.length));
|
79
81
|
}
|
80
82
|
})) || 0;
|
81
83
|
(_a = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _a === void 0 ? void 0 : _a.swiper.slideTo(index);
|
@@ -176,13 +178,39 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
176
178
|
const height = (0, react_1.useMemo)(() => {
|
177
179
|
return containerHeight - minusHeight - tagHeight;
|
178
180
|
}, [globalConfig, containerHeight, tagHeight]);
|
181
|
+
const visList = (0, react_1.useMemo)(() => {
|
182
|
+
var _a;
|
183
|
+
const list = activeIndex === 0 && !waterFallData
|
184
|
+
? [(_a = data === null || data === void 0 ? void 0 : data[0]) !== null && _a !== void 0 ? _a : null]
|
185
|
+
: data === null || data === void 0 ? void 0 : data.map((item, index) => {
|
186
|
+
if (activeIndex === index || index - 1 === activeIndex || index + 1 === activeIndex) {
|
187
|
+
return item;
|
188
|
+
}
|
189
|
+
else {
|
190
|
+
return null;
|
191
|
+
}
|
192
|
+
});
|
193
|
+
return !waterFallData ? list.concat([{ loading: true }]) : list;
|
194
|
+
}, [data, activeIndex, waterFallData]);
|
179
195
|
const renderLogo = (0, react_1.useMemo)(() => {
|
196
|
+
var _a, _b, _c, _d;
|
180
197
|
if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.logoUrl) && (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowLogo)) {
|
181
|
-
|
198
|
+
const link = (_b = (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.logoBar) === null || _a === void 0 ? void 0 : _a.onClick) === null || _b === void 0 ? void 0 : _b.value;
|
199
|
+
const isExternalLink = ((_d = (_c = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.logoBar) === null || _c === void 0 ? void 0 : _c.onClick) === null || _d === void 0 ? void 0 : _d.linkType) === 'externalLink';
|
200
|
+
const rec = visList[activeIndex];
|
201
|
+
return (react_1.default.createElement("div", Object.assign({ className: 'clc-sxp-logo-banner', style: { backgroundColor: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.color } }, (link && {
|
202
|
+
onClick: () => {
|
203
|
+
var _a, _b, _c, _d;
|
204
|
+
if (isExternalLink) {
|
205
|
+
jumpToWeb(rec, (_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.bindProduct, (_b = rec === null || rec === void 0 ? void 0 : rec.video) === null || _b === void 0 ? void 0 : _b.bindCta, activeIndex, ((_c = rec === null || rec === void 0 ? void 0 : rec.product) === null || _c === void 0 ? void 0 : _c.traceInfo) || ((_d = rec === null || rec === void 0 ? void 0 : rec.video) === null || _d === void 0 ? void 0 : _d.traceInfo));
|
206
|
+
}
|
207
|
+
new Function(link)();
|
208
|
+
}
|
209
|
+
})),
|
182
210
|
react_1.default.createElement("img", { src: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.logoUrl, alt: 'logo' })));
|
183
211
|
}
|
184
212
|
return null;
|
185
|
-
}, [globalConfig]);
|
213
|
+
}, [globalConfig, activeIndex, visList]);
|
186
214
|
const renderContent = (0, react_1.useCallback)((rec, index) => {
|
187
215
|
var _a, _b, _c, _d;
|
188
216
|
if ((_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.url) {
|
@@ -258,9 +286,9 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
258
286
|
isShowMore,
|
259
287
|
lineGradStyle
|
260
288
|
]);
|
261
|
-
const renderLikeButton = (0, react_1.useCallback)((rec, index) => {
|
289
|
+
const renderLikeButton = (0, react_1.useCallback)((rec, index, visible) => {
|
262
290
|
var _a, _b, _c, _d;
|
263
|
-
if (!(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowLike))
|
291
|
+
if (!(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowLike) || !visible)
|
264
292
|
return;
|
265
293
|
let top = (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIconY) !== null && _a !== void 0 ? _a : 400;
|
266
294
|
if (waterFallData && top < 40) {
|
@@ -268,6 +296,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
268
296
|
}
|
269
297
|
if (rec === null || rec === void 0 ? void 0 : rec.video) {
|
270
298
|
return (react_1.default.createElement(LikeButton_1.default, { key: rec.position, activeIcon: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIcon, unActicveIcon: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.unlikeIcon, active: rec.isCollected, recData: rec, className: 'clc-sxp-like-button', style: {
|
299
|
+
position: (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIconFixed) ? 'fixed' : 'absolute',
|
271
300
|
[(_b = globalConfig.likeIconXPosit) !== null && _b !== void 0 ? _b : 'right']: (_c = globalConfig.likeIconX) !== null && _c !== void 0 ? _c : 0,
|
272
301
|
[(_d = globalConfig.likeIconYPosit) !== null && _d !== void 0 ? _d : 'bottom']: top
|
273
302
|
}, position: index }));
|
@@ -318,7 +347,6 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
318
347
|
traceInfo: (_u = (_s = (_r = item === null || item === void 0 ? void 0 : item.video) === null || _r === void 0 ? void 0 : _r.traceInfo) !== null && _s !== void 0 ? _s : (_t = item === null || item === void 0 ? void 0 : item.product) === null || _t === void 0 ? void 0 : _t.traceInfo) !== null && _u !== void 0 ? _u : ''
|
319
348
|
}
|
320
349
|
});
|
321
|
-
(0, localStore_1.setSlideSkipState)();
|
322
350
|
skipLinkRef.current = true;
|
323
351
|
window.location.href = window.getJointUtmLink(link);
|
324
352
|
}
|
@@ -400,20 +428,18 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
400
428
|
});
|
401
429
|
}
|
402
430
|
};
|
403
|
-
const
|
404
|
-
var _a;
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
return !waterFallData ? list.concat([{ loading: true }]) : list;
|
416
|
-
}, [data, activeIndex, waterFallData]);
|
431
|
+
const renderToggleButton = (0, react_1.useCallback)((visible) => {
|
432
|
+
var _a, _b, _c, _d, _e, _f;
|
433
|
+
if (!visible)
|
434
|
+
return;
|
435
|
+
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: {
|
436
|
+
position: (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconFixed) ? 'fixed' : 'absolute',
|
437
|
+
visibility: ((_b = (_a = visList === null || visList === void 0 ? void 0 : visList[activeIndex]) === null || _a === void 0 ? void 0 : _a.video) === null || _b === void 0 ? void 0 : _b.url) ? 'visible' : 'hidden',
|
438
|
+
zIndex: 999,
|
439
|
+
[(_c = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconXPosit) !== null && _c !== void 0 ? _c : 'right']: (_d = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconX) !== null && _d !== void 0 ? _d : 0,
|
440
|
+
[(_e = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconYPosit) !== null && _e !== void 0 ? _e : 'bottom']: (_f = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconY) !== null && _f !== void 0 ? _f : 23
|
441
|
+
}, defaultValue: isMuted, 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, onChange: setIsMuted })));
|
442
|
+
}, [globalConfig, visList, activeIndex, isMuted]);
|
417
443
|
const renderView = (0, react_1.useMemo)(() => {
|
418
444
|
if (loading) {
|
419
445
|
return (react_1.default.createElement("div", { style: { height, width: containerWidth, display: 'flex', justifyContent: 'center', alignItems: 'center' } },
|
@@ -430,20 +456,30 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
430
456
|
react_1.default.createElement("img", { width: 64, height: 64, src: loadingImage, alt: 'loading...', style: { objectFit: 'contain' } }))) : (react_1.default.createElement(react_1.default.Fragment, null,
|
431
457
|
renderContent(rec, index),
|
432
458
|
renderBottom(rec, index),
|
433
|
-
renderLikeButton(rec, index))
|
459
|
+
renderLikeButton(rec, index, !(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIconFixed)),
|
460
|
+
renderToggleButton(!(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconFixed))))))));
|
434
461
|
});
|
435
|
-
}, [
|
436
|
-
|
437
|
-
|
462
|
+
}, [
|
463
|
+
containerWidth,
|
464
|
+
data,
|
465
|
+
height,
|
466
|
+
loading,
|
467
|
+
renderBottom,
|
468
|
+
renderContent,
|
469
|
+
visList,
|
470
|
+
loadingImage,
|
471
|
+
isReload,
|
472
|
+
renderToggleButton
|
473
|
+
]);
|
438
474
|
return (react_1.default.createElement("div", { id: 'sxp-render', className: 'clc-sxp-container' },
|
439
|
-
waterFallData && (react_1.default.createElement(Navbar_1.default, { icon: left_png_1.default, styles: { background: 'rgba(0,0,0,.3)', color: '#fff' }, onClose: () => {
|
475
|
+
waterFallData && (react_1.default.createElement(Navbar_1.default, { icon: left_png_1.default, styles: { background: 'rgba(0,0,0,.3)', color: '#fff' }, textStyle: Object.assign(Object.assign({}, (_e = (_d = (_c = (_b = (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.hashTag) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.item) === null || _c === void 0 ? void 0 : _c.props) === null || _d === void 0 ? void 0 : _d.textStyles) === null || _e === void 0 ? void 0 : _e.hashTagTitle), { color: '#fff' }), onClose: () => {
|
440
476
|
setOpenHashtag === null || setOpenHashtag === void 0 ? void 0 : setOpenHashtag(true);
|
441
477
|
} })),
|
442
478
|
renderLogo,
|
443
479
|
react_1.default.createElement(Tagbar_1.default, { tagList: tagList, setActiveIndex: setActiveIndex, style: {
|
444
480
|
top: minusHeight
|
445
481
|
} }),
|
446
|
-
isShowFingerTip ? (react_1.default.createElement(FingerSwipeTip_1.default, { imageUrl: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.swipeTipIcon, style: { top: `${50 - ((
|
482
|
+
isShowFingerTip ? (react_1.default.createElement(FingerSwipeTip_1.default, { imageUrl: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.swipeTipIcon, style: { top: `${50 - ((_f = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.swipeTipOffset) !== null && _f !== void 0 ? _f : 0)}%` }, duration: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.swiperTipAniDur })) : null,
|
447
483
|
react_1.default.createElement(react_2.Swiper, { style: {
|
448
484
|
marginTop: tagHeight
|
449
485
|
}, ref: swiperRef, onSlideChange: () => {
|
@@ -467,14 +503,9 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
467
503
|
}
|
468
504
|
}
|
469
505
|
}, direction: 'vertical', height: height },
|
470
|
-
(
|
471
|
-
|
472
|
-
visibility: ((_c = (_b = data === null || data === void 0 ? void 0 : data[activeIndex]) === null || _b === void 0 ? void 0 : _b.video) === null || _c === void 0 ? void 0 : _c.url) ? 'visible' : 'hidden',
|
473
|
-
zIndex: 999,
|
474
|
-
[(_d = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconXPosit) !== null && _d !== void 0 ? _d : 'right']: (_e = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconX) !== null && _e !== void 0 ? _e : 0,
|
475
|
-
[(_f = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconYPosit) !== null && _f !== void 0 ? _f : 'bottom']: (_g = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconY) !== null && _g !== void 0 ? _g : 23
|
476
|
-
}, defaultValue: isMuted, 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, onChange: setIsMuted })),
|
506
|
+
renderLikeButton(visList[activeIndex], activeIndex, !!(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIconFixed)),
|
507
|
+
renderToggleButton(!!(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconFixed)),
|
477
508
|
renderView),
|
478
|
-
react_1.default.createElement(WaterFall_1.default, Object.assign({}, (
|
509
|
+
react_1.default.createElement(WaterFall_1.default, Object.assign({}, (_j = (_h = (_g = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.hashTag) === null || _g === void 0 ? void 0 : _g[0]) === null || _h === void 0 ? void 0 : _h.item) === null || _j === void 0 ? void 0 : _j.props))));
|
479
510
|
};
|
480
511
|
exports.default = SxpPageRender;
|
@@ -27,6 +27,7 @@ export type CTAInfoType = {
|
|
27
27
|
weight: number | null;
|
28
28
|
enTitle: string;
|
29
29
|
link: string | null;
|
30
|
+
remark?: string;
|
30
31
|
};
|
31
32
|
export type ProductInfoType = {
|
32
33
|
traceInfo?: string | null;
|
@@ -44,6 +45,7 @@ export type ProductInfoType = {
|
|
44
45
|
bindCta?: CTAInfoType;
|
45
46
|
taxInfo?: string;
|
46
47
|
cover?: string;
|
48
|
+
remark?: string;
|
47
49
|
};
|
48
50
|
export type VideoInfoType = {
|
49
51
|
bindCtaId: string;
|
@@ -6,6 +6,7 @@ const react_1 = tslib_1.__importStar(require("react"));
|
|
6
6
|
const lodash_1 = require("lodash");
|
7
7
|
const DataSourceProvider_1 = tslib_1.__importDefault(require("./DataSourceProvider"));
|
8
8
|
const tool_1 = require("../../core/utils/tool");
|
9
|
+
const localStore_1 = require("../utils/localStore");
|
9
10
|
const item = {
|
10
11
|
id: (0, tool_1.uuid)(6, 10),
|
11
12
|
item: {
|
@@ -79,6 +80,7 @@ const EditorCore = (0, react_1.forwardRef)(({ children, resolver, isSsr, schema,
|
|
79
80
|
});
|
80
81
|
typeof window !== 'undefined' &&
|
81
82
|
(window.getJointUtmLink = (url) => {
|
83
|
+
(0, localStore_1.setSlideSkipState)();
|
82
84
|
if ((url === null || url === void 0 ? void 0 : url.indexOf('?')) !== -1) {
|
83
85
|
return url + (utmVal ? '&' + utmVal : '');
|
84
86
|
}
|
@@ -31,10 +31,10 @@ export interface ISxpDataSourceContext {
|
|
31
31
|
defaultSize?: number;
|
32
32
|
channel?: string;
|
33
33
|
hashTag?: string;
|
34
|
-
'itemFilter.itemId'?: string;
|
35
|
-
'itemFilter.itemType'?: 'VIDEO' | 'PRODUCT' | null | undefined;
|
36
34
|
traceInfo?: string;
|
37
35
|
themeTag?: string;
|
36
|
+
contentFilter?: string;
|
37
|
+
productFilter?: string;
|
38
38
|
}) => Promise<RecommendVideoResultType | undefined>;
|
39
39
|
utmVal?: string;
|
40
40
|
bffEventReport?: (body: {
|
@@ -119,6 +119,7 @@ export interface SxpDataSourceProviderProps {
|
|
119
119
|
globalConfig?: ISxpPageRenderProps['globalConfig'];
|
120
120
|
isEditor?: boolean;
|
121
121
|
utmParameter?: PageData['utm_parameter'];
|
122
|
+
channelQueryList?: any[];
|
122
123
|
}
|
123
124
|
export declare const DEFAULT_TAG = "FOR U";
|
124
125
|
declare const _default: React.NamedExoticComponent<SxpDataSourceProviderProps>;
|
@@ -9,6 +9,7 @@ const localStore_1 = require("../utils/localStore");
|
|
9
9
|
const useIconLink_1 = require("../components/SxpPageRender/useIconLink");
|
10
10
|
const event_1 = tslib_1.__importStar(require("../utils/event"));
|
11
11
|
const Consent_1 = tslib_1.__importDefault(require("../components/Consent"));
|
12
|
+
const tool_1 = require("../utils/tool");
|
12
13
|
exports.SxpDataSourceContext = (0, react_1.createContext)({
|
13
14
|
rtcList: [],
|
14
15
|
tagList: []
|
@@ -18,7 +19,7 @@ var DataSourceType;
|
|
18
19
|
DataSourceType[DataSourceType["BFF"] = 5] = "BFF";
|
19
20
|
})(DataSourceType || (DataSourceType = {}));
|
20
21
|
exports.DEFAULT_TAG = 'FOR U';
|
21
|
-
const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent = true, maxSize, defaultSize, isPreview = false, sxpParameter, appDomain, hashTagSize, loadingImage, isOpenHashTag = false, enabledMetaConversionApi = false, consentHeight, consentWidth, isShowTag = true, isOpenConsent = false, globalConfig, isEditor = false, utmParameter }) => {
|
22
|
+
const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent = true, maxSize, defaultSize, isPreview = false, sxpParameter, appDomain, hashTagSize, loadingImage, isOpenHashTag = false, enabledMetaConversionApi = false, consentHeight, consentWidth, isShowTag = true, isOpenConsent = false, globalConfig, isEditor = false, utmParameter, channelQueryList }) => {
|
22
23
|
var _a, _b, _c;
|
23
24
|
const [rtcList, setRtcList] = (0, react_1.useState)([]);
|
24
25
|
const [tagList, setTagList] = (0, react_1.useState)([]);
|
@@ -95,16 +96,8 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
95
96
|
.catch((err) => Promise.reject(err));
|
96
97
|
}, [bffDataSource]);
|
97
98
|
const getRecommendVideos = (0, react_1.useCallback)((query) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
98
|
-
var _d, _e, _f, _g, _h;
|
99
|
-
query = {
|
100
|
-
maxSize: (_d = query === null || query === void 0 ? void 0 : query.maxSize) !== null && _d !== void 0 ? _d : maxSize,
|
101
|
-
defaultSize: (_e = query === null || query === void 0 ? void 0 : query.defaultSize) !== null && _e !== void 0 ? _e : defaultSize,
|
102
|
-
'itemFilter.itemId': query === null || query === void 0 ? void 0 : query['itemFilter.itemId'],
|
103
|
-
'itemFilter.itemType': query === null || query === void 0 ? void 0 : query['itemFilter.itemType'],
|
104
|
-
hashTag: query === null || query === void 0 ? void 0 : query.hashTag,
|
105
|
-
traceInfo: query === null || query === void 0 ? void 0 : query.traceInfo,
|
106
|
-
themeTag: query === null || query === void 0 ? void 0 : query.themeTag
|
107
|
-
};
|
99
|
+
var _d, _e, _f, _g, _h, _j, _k;
|
100
|
+
query = Object.assign(Object.assign({ maxSize: (_d = query === null || query === void 0 ? void 0 : query.maxSize) !== null && _d !== void 0 ? _d : maxSize, defaultSize: (_e = query === null || query === void 0 ? void 0 : query.defaultSize) !== null && _e !== void 0 ? _e : 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 }, ((query === null || query === void 0 ? void 0 : query.contentFilter) && { contentFilter: `[${query === null || query === void 0 ? void 0 : query.contentFilter}]` })), ((query === null || query === void 0 ? void 0 : query.productFilter) && { productFilter: `[${query === null || query === void 0 ? void 0 : query.productFilter}]` }));
|
108
101
|
if (utmVal) {
|
109
102
|
const val = (_h = (_g = (_f = utmVal === null || utmVal === void 0 ? void 0 : utmVal.split('&')) === null || _f === void 0 ? void 0 : _f.filter((val) => {
|
110
103
|
var _a, _b;
|
@@ -113,6 +106,32 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
113
106
|
})) === null || _g === void 0 ? void 0 : _g.join('&')) !== null && _h !== void 0 ? _h : '';
|
114
107
|
query = Object.assign(Object.assign({}, query), { channel: decodeURIComponent(val) });
|
115
108
|
}
|
109
|
+
if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview) || isEditor) {
|
110
|
+
query = Object.assign(Object.assign(Object.assign({}, query), { directPage: true, level: 1 }), (!utmVal && channelQueryList && (channelQueryList === null || channelQueryList === void 0 ? void 0 : channelQueryList.length) > 0 && { channel: channelQueryList === null || channelQueryList === void 0 ? void 0 : channelQueryList[0] }));
|
111
|
+
if (!(query === null || query === void 0 ? void 0 : query.channel))
|
112
|
+
return;
|
113
|
+
let list = [];
|
114
|
+
let result = null;
|
115
|
+
let pageNum = 1;
|
116
|
+
const recurveRecList = (query) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
117
|
+
var _l, _m, _o, _p;
|
118
|
+
query.pageNum = pageNum;
|
119
|
+
result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/recommend/list', { method: 'GET', query }));
|
120
|
+
if (!(result === null || result === void 0 ? void 0 : result.success)) {
|
121
|
+
return undefined;
|
122
|
+
}
|
123
|
+
const rec = (_m = (_l = result === null || result === void 0 ? void 0 : result.data) === null || _l === void 0 ? void 0 : _l.recList) === null || _m === void 0 ? void 0 : _m[0];
|
124
|
+
list = list.concat((_p = (_o = result === null || result === void 0 ? void 0 : result.data) === null || _o === void 0 ? void 0 : _o.recList) !== null && _p !== void 0 ? _p : []);
|
125
|
+
if ((rec === null || rec === void 0 ? void 0 : rec.product) || (rec === null || rec === void 0 ? void 0 : rec.video)) {
|
126
|
+
pageNum = pageNum + 1;
|
127
|
+
yield recurveRecList(query);
|
128
|
+
}
|
129
|
+
});
|
130
|
+
yield recurveRecList(query);
|
131
|
+
if (!(query === null || query === void 0 ? void 0 : query.hashTag) && result)
|
132
|
+
setCurReqInfo({ rtc: (_j = result === null || result === void 0 ? void 0 : result.data) === null || _j === void 0 ? void 0 : _j.rtc, requestId: (_k = result === null || result === void 0 ? void 0 : result.data) === null || _k === void 0 ? void 0 : _k.requestId });
|
133
|
+
return Object.assign(Object.assign({}, result.data), { recList: list });
|
134
|
+
}
|
116
135
|
const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/recommend/list', { method: 'GET', query }));
|
117
136
|
if (!(result === null || result === void 0 ? void 0 : result.success)) {
|
118
137
|
return undefined;
|
@@ -120,29 +139,26 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
120
139
|
if (!(query === null || query === void 0 ? void 0 : query.hashTag))
|
121
140
|
setCurReqInfo({ rtc: result.data.rtc, requestId: result.data.requestId });
|
122
141
|
return result === null || result === void 0 ? void 0 : result.data;
|
123
|
-
}), [bffFetch, utmVal, maxSize, defaultSize]);
|
142
|
+
}), [bffFetch, utmVal, maxSize, defaultSize, globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview, channelQueryList, isEditor]);
|
124
143
|
const loadVideos = (0, react_1.useCallback)(() => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
144
|
+
var _q, _r, _s, _t;
|
125
145
|
if (rtcList.length <= 0) {
|
126
146
|
return;
|
127
147
|
}
|
128
|
-
const
|
129
|
-
|
130
|
-
'itemFilter.itemId': waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.itemId,
|
131
|
-
'itemFilter.itemType': waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.itemType,
|
132
|
-
themeTag: themeTag.current
|
133
|
-
});
|
148
|
+
const lastItem = rtcList === null || rtcList === void 0 ? void 0 : rtcList[(rtcList === null || rtcList === void 0 ? void 0 : rtcList.length) - 1];
|
149
|
+
const data = yield getRecommendVideos(Object.assign(Object.assign(Object.assign({ hashTag: waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.hashTag }, (((_q = lastItem === null || lastItem === void 0 ? void 0 : lastItem.product) === null || _q === void 0 ? void 0 : _q.itemId) && { productFilter: (_r = lastItem === null || lastItem === void 0 ? void 0 : lastItem.product) === null || _r === void 0 ? void 0 : _r.itemId })), (((_s = lastItem === null || lastItem === void 0 ? void 0 : lastItem.video) === null || _s === void 0 ? void 0 : _s.itemId) && { contentFilter: (_t = lastItem === null || lastItem === void 0 ? void 0 : lastItem.video) === null || _t === void 0 ? void 0 : _t.itemId })), { themeTag: themeTag.current }));
|
134
150
|
setRtcList(rtcList.concat(getFilterRecList(data)));
|
135
151
|
setCacheRtcList(cacheRtcList.concat(getFilterRecList(data)));
|
136
152
|
}), [getRecommendVideos, rtcList, waterFallData, cacheRtcList]);
|
137
153
|
const bffEventReport = (0, react_1.useCallback)(({ userInfo, eventInfo }) => {
|
138
|
-
if (!enableReportEvent) {
|
154
|
+
if (!enableReportEvent || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview)) {
|
139
155
|
return;
|
140
156
|
}
|
141
157
|
if (!userInfo) {
|
142
158
|
userInfo = {};
|
143
159
|
}
|
144
160
|
const sessionID = (0, sessionStore_1.storeAndLoadFeSessionId)();
|
145
|
-
const ef = Object.assign({ sessionID, rtc: curReqInfo.rtc, requestId: curReqInfo.requestId }, eventInfo);
|
161
|
+
const ef = Object.assign(Object.assign({ sessionID, rtc: curReqInfo.rtc, requestId: curReqInfo.requestId }, eventInfo), { sxpDevice: (0, tool_1.getDevice)(), sxpSystem: (0, tool_1.getSystem)(), sxpBrowser: (0, tool_1.getBrowserInfo)() });
|
146
162
|
const realUserInfo = Object.entries(userInfo).map(([k, v]) => ({ name: k, value: v }));
|
147
163
|
const realEventInfo = Object.entries(ef)
|
148
164
|
.map(([k, v]) => v && { name: k, value: v })
|
@@ -156,11 +172,11 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
156
172
|
body: { userInfo: realUserInfo, eventInfo: realEventInfo },
|
157
173
|
type: 'beacon'
|
158
174
|
});
|
159
|
-
}, [bffFetch, curReqInfo, enableReportEvent]);
|
175
|
+
}, [bffFetch, curReqInfo, enableReportEvent, globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview]);
|
160
176
|
const bffFbReport = (0, react_1.useCallback)((_a) => {
|
161
|
-
var _b;
|
177
|
+
var _b, _c;
|
162
178
|
var { eventName, actionSource = 'website', eventSourceUrl = (_b = window === null || window === void 0 ? void 0 : window.location) === null || _b === void 0 ? void 0 : _b.href, externalId } = _a;
|
163
|
-
if (!enableReportEvent || !enabledMetaConversionApi) {
|
179
|
+
if (!enableReportEvent || !enabledMetaConversionApi || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview)) {
|
164
180
|
return;
|
165
181
|
}
|
166
182
|
const fakeUserId = (0, localStore_1.storeAndLoadFeUserId)();
|
@@ -171,12 +187,15 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
171
187
|
actionSource,
|
172
188
|
eventSourceUrl,
|
173
189
|
userData: {
|
174
|
-
externalId: fakeUserId
|
190
|
+
externalId: fakeUserId,
|
191
|
+
fbc: `fb.2.${new Date().getTime()}.${(0, tool_1.getCookie)('_fbc')}`,
|
192
|
+
fbp: `fb.2.${new Date().getTime()}.${(0, tool_1.getCookie)('_fbp')}`,
|
193
|
+
client_user_agent: (_c = window === null || window === void 0 ? void 0 : window.navigator) === null || _c === void 0 ? void 0 : _c.userAgent
|
175
194
|
}
|
176
195
|
},
|
177
196
|
type: 'beacon'
|
178
197
|
});
|
179
|
-
}, [bffFetch, enableReportEvent, enabledMetaConversionApi]);
|
198
|
+
}, [bffFetch, enableReportEvent, enabledMetaConversionApi, globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview]);
|
180
199
|
const bffMutateLike = (0, react_1.useCallback)((body) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
181
200
|
const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/recommend/like', { method: 'POST', body }));
|
182
201
|
return res === null || res === void 0 ? void 0 : res.success;
|
@@ -190,24 +209,24 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
190
209
|
return res === null || res === void 0 ? void 0 : res.success;
|
191
210
|
}), [bffFetch]);
|
192
211
|
const bffGetTagList = (0, react_1.useCallback)(() => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
193
|
-
var
|
212
|
+
var _u, _v, _w, _x, _y;
|
194
213
|
if (!utmVal || !isShowTag)
|
195
214
|
return;
|
196
215
|
try {
|
197
|
-
const val = (
|
216
|
+
const val = (_w = (_v = (_u = utmVal === null || utmVal === void 0 ? void 0 : utmVal.split('&')) === null || _u === void 0 ? void 0 : _u.filter((val) => {
|
198
217
|
var _a, _b;
|
199
218
|
const key = val.split('=')[0];
|
200
219
|
return (_b = ((_a = utmParameter === null || utmParameter === void 0 ? void 0 : utmParameter.channels) !== null && _a !== void 0 ? _a : [])) === null || _b === void 0 ? void 0 : _b.includes(key);
|
201
|
-
})) === null ||
|
220
|
+
})) === null || _v === void 0 ? void 0 : _v.join('&')) !== null && _w !== void 0 ? _w : '';
|
202
221
|
const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/tag/list', { method: 'GET', query: { channel: decodeURIComponent(val) } }));
|
203
|
-
setTagList((
|
222
|
+
setTagList((_y = (_x = result === null || result === void 0 ? void 0 : result.data) === null || _x === void 0 ? void 0 : _x.tags) !== null && _y !== void 0 ? _y : []);
|
204
223
|
}
|
205
224
|
catch (e) {
|
206
225
|
console.log('e', e);
|
207
226
|
}
|
208
227
|
}), [bffFetch, utmVal, isShowTag]);
|
209
228
|
const ctaEvent = (0, react_1.useCallback)((eventInfo, rec, product, position) => {
|
210
|
-
var _a, _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;
|
229
|
+
var _a, _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, _5, _6, _7, _8, _9, _10, _11;
|
211
230
|
const cta = product === null || product === void 0 ? void 0 : product.bindCta;
|
212
231
|
const isProd = ((_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.bindProduct) || (((_b = rec === null || rec === void 0 ? void 0 : rec.video) === null || _b === void 0 ? void 0 : _b.bindProducts) && ((_d = (_c = rec === null || rec === void 0 ? void 0 : rec.video) === null || _c === void 0 ? void 0 : _c.bindProducts) === null || _d === void 0 ? void 0 : _d.length) > 0);
|
213
232
|
let fromKName = '';
|
@@ -220,8 +239,9 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
220
239
|
else if ((_g = (_f = rec === null || rec === void 0 ? void 0 : rec.video) === null || _f === void 0 ? void 0 : _f.imgUrls) === null || _g === void 0 ? void 0 : _g.length) {
|
221
240
|
fromKName = 'imagePage';
|
222
241
|
}
|
242
|
+
const contentTags = (_p = (_m = (_h = product === null || product === void 0 ? void 0 : product.tags) !== null && _h !== void 0 ? _h : (_l = (_k = (_j = rec === null || rec === void 0 ? void 0 : rec.video) === null || _j === void 0 ? void 0 : _j.bindProducts) === null || _k === void 0 ? void 0 : _k[0]) === null || _l === void 0 ? void 0 : _l.tags) !== null && _m !== void 0 ? _m : (_o = rec === null || rec === void 0 ? void 0 : rec.video) === null || _o === void 0 ? void 0 : _o.tags) !== null && _p !== void 0 ? _p : (_q = rec === null || rec === void 0 ? void 0 : rec.product) === null || _q === void 0 ? void 0 : _q.tags;
|
223
243
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
224
|
-
eventInfo: Object.assign(Object.assign({}, eventInfo), { ctaId: (
|
244
|
+
eventInfo: Object.assign(Object.assign({}, eventInfo), { ctaId: (_r = cta === null || cta === void 0 ? void 0 : cta.itemId) !== null && _r !== void 0 ? _r : '', ctaName: (_s = cta === null || cta === void 0 ? void 0 : cta.title) !== null && _s !== void 0 ? _s : '', contentTags: contentTags ? JSON.stringify(contentTags) : '', position: position + '', contentId: (_u = (_t = rec === null || rec === void 0 ? void 0 : rec.video) === null || _t === void 0 ? void 0 : _t.itemId) !== null && _u !== void 0 ? _u : '', productId: isProd ? product === null || product === void 0 ? void 0 : product.itemId : '', traceInfo: (_10 = (_7 = (_2 = (_y = (_v = cta === null || cta === void 0 ? void 0 : cta.traceInfo) !== null && _v !== void 0 ? _v : (_x = (_w = rec === null || rec === void 0 ? void 0 : rec.video) === null || _w === void 0 ? void 0 : _w.bindCta) === null || _x === void 0 ? void 0 : _x.traceInfo) !== null && _y !== void 0 ? _y : (_1 = (_0 = (_z = rec === null || rec === void 0 ? void 0 : rec.video) === null || _z === void 0 ? void 0 : _z.bindProduct) === null || _0 === void 0 ? void 0 : _0.bindCta) === null || _1 === void 0 ? void 0 : _1.traceInfo) !== null && _2 !== void 0 ? _2 : (_6 = (_5 = (_4 = (_3 = rec === null || rec === void 0 ? void 0 : rec.video) === null || _3 === void 0 ? void 0 : _3.bindProducts) === null || _4 === void 0 ? void 0 : _4[0]) === null || _5 === void 0 ? void 0 : _5.bindCta) === null || _6 === void 0 ? void 0 : _6.traceInfo) !== null && _7 !== void 0 ? _7 : (_9 = (_8 = rec === null || rec === void 0 ? void 0 : rec.product) === null || _8 === void 0 ? void 0 : _8.bindCta) === null || _9 === void 0 ? void 0 : _9.traceInfo) !== null && _10 !== void 0 ? _10 : '', fromKName, fromKPage: (_11 = location === null || location === void 0 ? void 0 : location.href) !== null && _11 !== void 0 ? _11 : '' })
|
225
245
|
});
|
226
246
|
}, [bffEventReport, isFromHashtag]);
|
227
247
|
const h5EnterLink = (0, react_1.useCallback)(() => {
|
@@ -276,7 +296,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
276
296
|
});
|
277
297
|
}, [isShowConsent]);
|
278
298
|
(0, react_1.useEffect)(() => {
|
279
|
-
if (!isInit.current)
|
299
|
+
if (!isInit.current && !isEditor)
|
280
300
|
return;
|
281
301
|
setLoading(true);
|
282
302
|
bffGetTagList();
|
@@ -288,7 +308,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
288
308
|
.finally(() => {
|
289
309
|
setLoading(false);
|
290
310
|
});
|
291
|
-
}, [
|
311
|
+
}, [bffGetTagList, isEditor, getRecommendVideos]);
|
292
312
|
const defaultLoadingImage = (0, useIconLink_1.useIconLink)('/pb_static/a65d23c5893c49d7aaaa81681d3179e2.gif', appDomain);
|
293
313
|
return (react_1.default.createElement(exports.SxpDataSourceContext.Provider, { value: {
|
294
314
|
rtcList,
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { RecItemType } from '../components/SxpPageRender/typing';
|
2
2
|
export declare function useEventReport(): {
|
3
|
-
jumpToWeb: (data?: RecItemType, product?: RecItemType['product'], cta?: RecItemType['cta'], position?: number) => void;
|
3
|
+
jumpToWeb: (data?: RecItemType, product?: RecItemType['product'], cta?: RecItemType['cta'], position?: number, traceInfo?: string) => void;
|
4
4
|
productView: (data?: RecItemType, product?: RecItemType['product'], cta?: RecItemType['cta'], viewTime?: any, position?: number) => void;
|
5
5
|
backMainFeed: (lastFeed: 'theme' | 'branch' | 'external', selectTag?: string, themeTag?: string, hashTag?: string) => void;
|
6
6
|
};
|
@@ -6,8 +6,8 @@ const useSxpDataSource_1 = require("./useSxpDataSource");
|
|
6
6
|
const SxpDataSourceProvider_1 = require("../context/SxpDataSourceProvider");
|
7
7
|
function useEventReport() {
|
8
8
|
const { bffEventReport, popupDetailData, waterFallData, isFromHashtag } = (0, useSxpDataSource_1.useSxpDataSource)();
|
9
|
-
const jumpToWeb = (0, react_1.useCallback)((data, product, cta, position) => {
|
10
|
-
var _a, _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;
|
9
|
+
const jumpToWeb = (0, react_1.useCallback)((data, product, cta, position, traceInfo) => {
|
10
|
+
var _a, _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, _5, _6, _7, _8, _9;
|
11
11
|
let fromKName = '';
|
12
12
|
if (popupDetailData && (((_b = (_a = data === null || data === void 0 ? void 0 : data.video) === null || _a === void 0 ? void 0 : _a.bindProducts) === null || _b === void 0 ? void 0 : _b.length) || ((_c = data === null || data === void 0 ? void 0 : data.video) === null || _c === void 0 ? void 0 : _c.bindProduct))) {
|
13
13
|
fromKName = 'pdpPage';
|
@@ -24,21 +24,22 @@ function useEventReport() {
|
|
24
24
|
else if (data === null || data === void 0 ? void 0 : data.product) {
|
25
25
|
fromKName = 'productPage';
|
26
26
|
}
|
27
|
+
const contentTags = (_p = (_m = (_h = product === null || product === void 0 ? void 0 : product.tags) !== null && _h !== void 0 ? _h : (_l = (_k = (_j = data === null || data === void 0 ? void 0 : data.video) === null || _j === void 0 ? void 0 : _j.bindProducts) === null || _k === void 0 ? void 0 : _k[0]) === null || _l === void 0 ? void 0 : _l.tags) !== null && _m !== void 0 ? _m : (_o = data === null || data === void 0 ? void 0 : data.video) === null || _o === void 0 ? void 0 : _o.tags) !== null && _p !== void 0 ? _p : (_q = data === null || data === void 0 ? void 0 : data.product) === null || _q === void 0 ? void 0 : _q.tags;
|
27
28
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
28
29
|
eventInfo: {
|
29
30
|
eventSubject: 'jumpToWeb',
|
30
31
|
eventDescription: 'User jumped to website',
|
31
|
-
productId: (
|
32
|
-
productName: (
|
32
|
+
productId: (_r = product === null || product === void 0 ? void 0 : product.itemId) !== null && _r !== void 0 ? _r : '',
|
33
|
+
productName: (_s = product === null || product === void 0 ? void 0 : product.title) !== null && _s !== void 0 ? _s : '',
|
33
34
|
price: (product === null || product === void 0 ? void 0 : product.price) ? (product === null || product === void 0 ? void 0 : product.price) + '' : '0',
|
34
|
-
productCollection: (
|
35
|
+
productCollection: (_t = product === null || product === void 0 ? void 0 : product.collection) !== null && _t !== void 0 ? _t : '',
|
35
36
|
fromKName,
|
36
37
|
fromKPage: location === null || location === void 0 ? void 0 : location.href,
|
37
|
-
contentTags:
|
38
|
+
contentTags: contentTags ? JSON.stringify(contentTags) : '',
|
38
39
|
position: position + '',
|
39
|
-
contentId: (
|
40
|
-
ctatId: (
|
41
|
-
traceInfo: (
|
40
|
+
contentId: (_v = (_u = data === null || data === void 0 ? void 0 : data.video) === null || _u === void 0 ? void 0 : _u.itemId) !== null && _v !== void 0 ? _v : '',
|
41
|
+
ctatId: (_w = cta === null || cta === void 0 ? void 0 : cta.itemId) !== null && _w !== void 0 ? _w : '',
|
42
|
+
traceInfo: (_9 = (_6 = (_4 = (_0 = (_x = traceInfo !== null && traceInfo !== void 0 ? traceInfo : product === null || product === void 0 ? void 0 : product.traceInfo) !== null && _x !== void 0 ? _x : (_z = (_y = data === null || data === void 0 ? void 0 : data.video) === null || _y === void 0 ? void 0 : _y.bindProduct) === null || _z === void 0 ? void 0 : _z.traceInfo) !== null && _0 !== void 0 ? _0 : (_3 = (_2 = (_1 = data === null || data === void 0 ? void 0 : data.video) === null || _1 === void 0 ? void 0 : _1.bindProducts) === null || _2 === void 0 ? void 0 : _2[0]) === null || _3 === void 0 ? void 0 : _3.traceInfo) !== null && _4 !== void 0 ? _4 : (_5 = data === null || data === void 0 ? void 0 : data.product) === null || _5 === void 0 ? void 0 : _5.traceInfo) !== null && _6 !== void 0 ? _6 : (_8 = (_7 = data === null || data === void 0 ? void 0 : data.video) === null || _7 === void 0 ? void 0 : _7.bindCta) === null || _8 === void 0 ? void 0 : _8.traceInfo) !== null && _9 !== void 0 ? _9 : ''
|
42
43
|
}
|
43
44
|
});
|
44
45
|
}, [bffEventReport, popupDetailData, isFromHashtag]);
|
package/lib/core/utils/tool.d.ts
CHANGED
@@ -7,4 +7,8 @@ interface IfontType {
|
|
7
7
|
'fontFamily-en': string;
|
8
8
|
}
|
9
9
|
export declare const setFontForText: (textContent?: string | null, style?: IfontType | any) => string;
|
10
|
-
|
10
|
+
declare function getBrowserInfo(): string;
|
11
|
+
declare function getSystem(): string;
|
12
|
+
declare function getDevice(): string;
|
13
|
+
declare function getCookie(val: string): string;
|
14
|
+
export { uuid, getIndexByblockType, getBrowserInfo, getDevice, getSystem, getCookie };
|