pb-sxp-ui 1.20.13 → 1.20.15
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/LICENSE +21 -21
- package/README.md +111 -111
- package/dist/index.cjs +1187 -383
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +73 -72
- package/dist/index.js +1187 -384
- package/dist/index.js.map +1 -1
- package/dist/index.min.cjs +7 -7
- package/dist/index.min.cjs.map +1 -1
- package/dist/index.min.js +7 -7
- package/dist/index.min.js.map +1 -1
- package/dist/pb-ui.js +1187 -383
- package/dist/pb-ui.js.map +1 -1
- package/dist/pb-ui.min.js +7 -7
- package/dist/pb-ui.min.js.map +1 -1
- package/es/core/components/DiyPortalPreview/VideoWidget.js +10 -8
- package/es/core/components/DiyStoryPreview/index.js +10 -4
- package/es/core/components/StructurePage/index.d.ts +89 -0
- package/es/core/components/StructurePage/index.js +700 -0
- package/es/core/components/SxpPageRender/LikeButton/index.js +20 -18
- package/es/core/components/SxpPageRender/PictureGroup/index.d.ts +5 -0
- package/es/core/components/SxpPageRender/PictureGroup/index.js +39 -13
- package/es/core/components/SxpPageRender/VideoWidget/index.js +33 -46
- package/es/core/components/SxpPageRender/WaterFall/index.js +4 -3
- package/es/core/components/SxpPageRender/fakeData.js +1 -1
- package/es/core/components/SxpPageRender/index.js +66 -44
- package/es/core/context/SxpDataSourceProvider.d.ts +5 -12
- package/es/core/context/SxpDataSourceProvider.js +84 -38
- package/es/core/hooks/useEventReport.js +6 -5
- package/es/core/hooks/useVisibleHeight.js +7 -7
- package/es/core/index.d.ts +2 -0
- package/es/core/index.js +1 -0
- package/es/core/utils/materials.d.ts +1 -1
- package/es/index.d.ts +1 -0
- package/es/index.js +1 -0
- package/es/materials/sxp/MultiPosts/index.js +4 -4
- package/es/materials/sxp/popup/CommodityDetail/index.js +4 -4
- package/es/materials/sxp/popup/CommodityDetailDiroNew/index.js +1 -1
- package/lib/core/components/DiyPortalPreview/VideoWidget.js +10 -8
- package/lib/core/components/DiyStoryPreview/index.js +10 -4
- package/lib/core/components/StructurePage/index.d.ts +89 -0
- package/lib/core/components/StructurePage/index.js +702 -0
- package/lib/core/components/SxpPageRender/LikeButton/index.js +20 -18
- package/lib/core/components/SxpPageRender/PictureGroup/index.d.ts +5 -0
- package/lib/core/components/SxpPageRender/PictureGroup/index.js +38 -12
- package/lib/core/components/SxpPageRender/VideoWidget/index.js +33 -46
- package/lib/core/components/SxpPageRender/WaterFall/index.js +4 -3
- package/lib/core/components/SxpPageRender/fakeData.js +1 -1
- package/lib/core/components/SxpPageRender/index.js +66 -44
- package/lib/core/context/SxpDataSourceProvider.d.ts +5 -12
- package/lib/core/context/SxpDataSourceProvider.js +84 -38
- package/lib/core/hooks/useEventReport.js +6 -5
- package/lib/core/hooks/useVisibleHeight.js +7 -7
- package/lib/core/index.d.ts +2 -0
- package/lib/core/index.js +6 -1
- package/lib/core/utils/materials.d.ts +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +3 -1
- package/lib/materials/sxp/MultiPosts/index.js +4 -4
- package/lib/materials/sxp/popup/CommodityDetail/index.js +4 -4
- package/lib/materials/sxp/popup/CommodityDetailDiroNew/index.js +1 -1
- package/package.json +111 -111
|
@@ -20,6 +20,7 @@ export const DEFAULT_TAG = 'FOR U';
|
|
|
20
20
|
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 }) => {
|
|
21
21
|
var _a, _b, _c, _d, _e;
|
|
22
22
|
const [rtcList, setRtcList] = useState([]);
|
|
23
|
+
const [firstRtcList, setFirstRtcList] = useState([]);
|
|
23
24
|
const [tagList, setTagList] = useState([]);
|
|
24
25
|
const [loading, setLoading] = useState(true);
|
|
25
26
|
const [curReqInfo, setCurReqInfo] = useState({ rtc: '', requestId: '' });
|
|
@@ -29,6 +30,9 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
29
30
|
const [popupDetailData, setPopupDetailData] = useState();
|
|
30
31
|
const [waterFallData, setWaterFallData] = useState();
|
|
31
32
|
const [openHashtag, setOpenHashtag] = useState(isOpenHashTag);
|
|
33
|
+
if (typeof window !== 'undefined') {
|
|
34
|
+
window.setPopupDetailData = setPopupDetailData;
|
|
35
|
+
}
|
|
32
36
|
const [cacheRtcList, setCacheRtcList] = useState([]);
|
|
33
37
|
const [cacheActiveIndex, setCacheActiveIndex] = useState(0);
|
|
34
38
|
const [isFromHashtag, setIsFromHashtag] = useState(false);
|
|
@@ -50,6 +54,10 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
50
54
|
const [chatlabsId, setChatlabsId] = useState();
|
|
51
55
|
const finalPageData = useMemo(() => pageData !== null && pageData !== void 0 ? pageData : data, [pageData, data]);
|
|
52
56
|
const pixelPvStatusRef = useRef(false);
|
|
57
|
+
const isDiyPage = useMemo(() => {
|
|
58
|
+
var _a, _b, _c;
|
|
59
|
+
return isDiyH5 && !((_c = (_b = (_a = finalPageData === null || finalPageData === void 0 ? void 0 : finalPageData.data) === null || _a === void 0 ? void 0 : _a.sxpPageConf) === null || _b === void 0 ? void 0 : _b.globalConfig) === null || _c === void 0 ? void 0 : _c.enablePreview);
|
|
60
|
+
}, [isDiyH5, finalPageData]);
|
|
53
61
|
useEffect(() => {
|
|
54
62
|
var _a, _b;
|
|
55
63
|
setGlobalConfig((_b = (_a = data === null || data === void 0 ? void 0 : data.data) === null || _a === void 0 ? void 0 : _a.sxpPageConf) === null || _b === void 0 ? void 0 : _b.globalConfig);
|
|
@@ -144,7 +152,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
144
152
|
return false;
|
|
145
153
|
};
|
|
146
154
|
const bffFetch = useCallback((path, options, isBota = true) => {
|
|
147
|
-
var _a;
|
|
155
|
+
var _a, _b;
|
|
148
156
|
if (!bffDataSource)
|
|
149
157
|
return;
|
|
150
158
|
const url = bffDataSource.url;
|
|
@@ -159,8 +167,9 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
159
167
|
const value = val.split('=')[1];
|
|
160
168
|
params[key] = value;
|
|
161
169
|
});
|
|
170
|
+
options.body = Object.assign(Object.assign({}, options.body), { productUserId: fakeUserId });
|
|
162
171
|
return window
|
|
163
|
-
.fetch(`${url}/api/${path}`, Object.assign({ headers: Object.assign({ 'Content-Type': 'application/json', 'x-user-id': fakeUserId }, bffDataSource.headers), method: options.method, body: options.type === 'beacon' && isBota
|
|
172
|
+
.fetch(`${url}/api/${path}`, Object.assign({ headers: Object.assign({ 'Content-Type': 'application/json', 'x-user-id': fakeUserId, 'tenant-id': (_b = bffDataSource === null || bffDataSource === void 0 ? void 0 : bffDataSource.headers) === null || _b === void 0 ? void 0 : _b['x-app-id'] }, bffDataSource.headers), method: options.method, body: options.type === 'beacon' && isBota
|
|
164
173
|
? JSON.stringify({
|
|
165
174
|
body: btoa(encodeURIComponent(JSON.stringify(Object.assign(Object.assign(Object.assign({}, options.body), bffDataSource.headers), { 'x-user-id': fakeUserId }))))
|
|
166
175
|
})
|
|
@@ -418,8 +427,8 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
418
427
|
.catch((err) => Promise.reject(err));
|
|
419
428
|
}, [bffDataSource]);
|
|
420
429
|
const getRecommendVideos = useCallback((query) => __awaiter(void 0, void 0, void 0, function* () {
|
|
421
|
-
var _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
|
422
|
-
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 })), (
|
|
430
|
+
var _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
|
|
431
|
+
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 })), (isDiyPage && { type: 'story' }));
|
|
423
432
|
if (channel) {
|
|
424
433
|
query = Object.assign(Object.assign({}, query), { channel: decodeURIComponent(channel) });
|
|
425
434
|
}
|
|
@@ -432,9 +441,10 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
432
441
|
if (val)
|
|
433
442
|
query = Object.assign(Object.assign({}, query), { channel: decodeURIComponent(val) });
|
|
434
443
|
}
|
|
444
|
+
const isDiy = isDiyH5 && ((_o = (_m = (_l = finalPageData === null || finalPageData === void 0 ? void 0 : finalPageData.data) === null || _l === void 0 ? void 0 : _l.sxpPageConf) === null || _m === void 0 ? void 0 : _m.globalConfig) === null || _o === void 0 ? void 0 : _o.enablePreview);
|
|
435
445
|
if (isEditor) {
|
|
436
446
|
let pageNum = 1;
|
|
437
|
-
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] }));
|
|
447
|
+
query = Object.assign(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] })), (isDiy && { maxRecs: query === null || query === void 0 ? void 0 : query.maxSize }));
|
|
438
448
|
if (!(query === null || query === void 0 ? void 0 : query.channel) || isInit.current) {
|
|
439
449
|
return undefined;
|
|
440
450
|
}
|
|
@@ -442,19 +452,24 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
442
452
|
let list = [];
|
|
443
453
|
let result = null;
|
|
444
454
|
const recurveRecList = (query) => __awaiter(void 0, void 0, void 0, function* () {
|
|
445
|
-
var
|
|
455
|
+
var _y, _z, _0, _1, _2, _3;
|
|
446
456
|
query.pageNum = pageNum;
|
|
447
|
-
result =
|
|
457
|
+
result = isDiyH5
|
|
458
|
+
? yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v3/recommend/direct/page/view', { method: 'POST', body: query }))
|
|
459
|
+
: yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/recommend/direct_page', { method: 'POST', body: query }));
|
|
448
460
|
if (!(result === null || result === void 0 ? void 0 : result.success)) {
|
|
449
461
|
return undefined;
|
|
450
462
|
}
|
|
451
463
|
setLoading(false);
|
|
452
|
-
list = list.concat((
|
|
464
|
+
list = list.concat((_1 = (_0 = (_z = (_y = result === null || result === void 0 ? void 0 : result.data) === null || _y === void 0 ? void 0 : _y.recList) === null || _z === void 0 ? void 0 : _z.filter) === null || _0 === void 0 ? void 0 : _0.call(_z, (item) => (item === null || item === void 0 ? void 0 : item.product) || (item === null || item === void 0 ? void 0 : item.video))) !== null && _1 !== void 0 ? _1 : []);
|
|
453
465
|
if ((rtcList === null || rtcList === void 0 ? void 0 : rtcList.length) === 0) {
|
|
454
466
|
setRtcList(getFilterRecList(Object.assign(Object.assign({}, result === null || result === void 0 ? void 0 : result.data), { recList: list })));
|
|
455
467
|
setCacheRtcList(getFilterRecList(Object.assign(Object.assign({}, result === null || result === void 0 ? void 0 : result.data), { recList: list })));
|
|
468
|
+
if (isDiyPage) {
|
|
469
|
+
setFirstRtcList(getFilterRecList(Object.assign(Object.assign({}, result === null || result === void 0 ? void 0 : result.data), { recList: list })));
|
|
470
|
+
}
|
|
456
471
|
}
|
|
457
|
-
const isNotNullList = (
|
|
472
|
+
const isNotNullList = (_3 = (_2 = result === null || result === void 0 ? void 0 : result.data) === null || _2 === void 0 ? void 0 : _2.recList) === null || _3 === void 0 ? void 0 : _3.some((item) => (item === null || item === void 0 ? void 0 : item.product) || (item === null || item === void 0 ? void 0 : item.video));
|
|
458
473
|
if (isNotNullList) {
|
|
459
474
|
pageNum = pageNum + 1;
|
|
460
475
|
yield recurveRecList(query);
|
|
@@ -462,42 +477,61 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
462
477
|
});
|
|
463
478
|
yield recurveRecList(query);
|
|
464
479
|
if (!(query === null || query === void 0 ? void 0 : query.hashTag) && result)
|
|
465
|
-
setCurReqInfo({ rtc: (
|
|
480
|
+
setCurReqInfo({ rtc: (_p = result === null || result === void 0 ? void 0 : result.data) === null || _p === void 0 ? void 0 : _p.rtc, requestId: (_q = result === null || result === void 0 ? void 0 : result.data) === null || _q === void 0 ? void 0 : _q.requestId });
|
|
466
481
|
return Object.assign(Object.assign({}, result === null || result === void 0 ? void 0 : result.data), { recList: list });
|
|
467
482
|
}
|
|
468
483
|
if (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview) {
|
|
469
|
-
query = Object.assign(Object.assign({}, query), { directPage: true, level: 1, pageNum: (
|
|
484
|
+
query = Object.assign(Object.assign(Object.assign({}, query), { directPage: true, level: 1, pageNum: (_r = query === null || query === void 0 ? void 0 : query.pageNum) !== null && _r !== void 0 ? _r : 1 }), (isDiy && { maxRecs: query === null || query === void 0 ? void 0 : query.maxSize }));
|
|
470
485
|
}
|
|
471
|
-
const result =
|
|
472
|
-
method: 'POST',
|
|
473
|
-
|
|
474
|
-
|
|
486
|
+
const result = isDiy
|
|
487
|
+
? yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v3/recommend/direct/page/view', { method: 'POST', body: query }))
|
|
488
|
+
: yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/recommend/list', {
|
|
489
|
+
method: 'POST',
|
|
490
|
+
body: query
|
|
491
|
+
}));
|
|
475
492
|
if (!(result === null || result === void 0 ? void 0 : result.success)) {
|
|
476
493
|
return undefined;
|
|
477
494
|
}
|
|
478
495
|
if (!(query === null || query === void 0 ? void 0 : query.hashTag))
|
|
479
496
|
setCurReqInfo({ rtc: result.data.rtc, requestId: result.data.requestId });
|
|
480
497
|
if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview) && !isEditor) {
|
|
481
|
-
const isNotNullList = (
|
|
498
|
+
const isNotNullList = (_t = (_s = result === null || result === void 0 ? void 0 : result.data) === null || _s === void 0 ? void 0 : _s.recList) === null || _t === void 0 ? void 0 : _t.some((item) => (item === null || item === void 0 ? void 0 : item.product) || (item === null || item === void 0 ? void 0 : item.video));
|
|
482
499
|
if (!isNotNullList) {
|
|
483
500
|
setIsNoMoreData(true);
|
|
484
501
|
}
|
|
485
502
|
}
|
|
486
503
|
let list = [];
|
|
487
|
-
list = list.concat((
|
|
504
|
+
list = list.concat((_x = (_w = (_v = (_u = result === null || result === void 0 ? void 0 : result.data) === null || _u === void 0 ? void 0 : _u.recList) === null || _v === void 0 ? void 0 : _v.filter) === null || _w === void 0 ? void 0 : _w.call(_v, (item) => (item === null || item === void 0 ? void 0 : item.product) || (item === null || item === void 0 ? void 0 : item.video))) !== null && _x !== void 0 ? _x : []);
|
|
488
505
|
return Object.assign(Object.assign({}, result.data), { recList: list });
|
|
489
|
-
}), [
|
|
506
|
+
}), [
|
|
507
|
+
bffFetch,
|
|
508
|
+
utmVal,
|
|
509
|
+
maxSize,
|
|
510
|
+
defaultSize,
|
|
511
|
+
channelQueryList,
|
|
512
|
+
channel,
|
|
513
|
+
chatlabsId,
|
|
514
|
+
bffFetchAdmin,
|
|
515
|
+
isDiyPage,
|
|
516
|
+
finalPageData,
|
|
517
|
+
isDiyH5
|
|
518
|
+
]);
|
|
490
519
|
const loadVideos = useCallback((pageNum) => __awaiter(void 0, void 0, void 0, function* () {
|
|
491
|
-
var
|
|
520
|
+
var _4, _5, _6, _7;
|
|
492
521
|
if (rtcList.length <= 0) {
|
|
493
522
|
return;
|
|
494
523
|
}
|
|
524
|
+
if (isDiyPage && (firstRtcList === null || firstRtcList === void 0 ? void 0 : firstRtcList.length) > 0) {
|
|
525
|
+
setRtcList(rtcList.concat(firstRtcList));
|
|
526
|
+
setCacheRtcList(cacheRtcList.concat(firstRtcList));
|
|
527
|
+
return;
|
|
528
|
+
}
|
|
495
529
|
const lastItem = rtcList === null || rtcList === void 0 ? void 0 : rtcList[(rtcList === null || rtcList === void 0 ? void 0 : rtcList.length) - 1];
|
|
496
|
-
const data = yield getRecommendVideos(Object.assign(Object.assign(Object.assign(Object.assign({ hashTag: waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.hashTag }, (((
|
|
530
|
+
const data = yield getRecommendVideos(Object.assign(Object.assign(Object.assign(Object.assign({ hashTag: waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.hashTag }, (((_4 = lastItem === null || lastItem === void 0 ? void 0 : lastItem.product) === null || _4 === void 0 ? void 0 : _4.itemId) && { productFilter: [(_5 = lastItem === null || lastItem === void 0 ? void 0 : lastItem.product) === null || _5 === void 0 ? void 0 : _5.itemId] })), (((_6 = lastItem === null || lastItem === void 0 ? void 0 : lastItem.video) === null || _6 === void 0 ? void 0 : _6.itemId) && { contentFilter: [(_7 = lastItem === null || lastItem === void 0 ? void 0 : lastItem.video) === null || _7 === void 0 ? void 0 : _7.itemId] })), { themeTag: themeTag.current }), ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview) && !isEditor && { pageNum })));
|
|
497
531
|
setRtcList(rtcList.concat(getFilterRecList(data)));
|
|
498
532
|
setCacheRtcList(cacheRtcList.concat(getFilterRecList(data)));
|
|
499
533
|
return data;
|
|
500
|
-
}), [getRecommendVideos, rtcList, waterFallData, cacheRtcList]);
|
|
534
|
+
}), [getRecommendVideos, rtcList, waterFallData, cacheRtcList, isDiyPage, firstRtcList]);
|
|
501
535
|
const refreshFeSession = useCallback((enableReSid, event) => {
|
|
502
536
|
var _a, _b, _c, _d, _e;
|
|
503
537
|
let expire = false;
|
|
@@ -525,7 +559,9 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
525
559
|
return;
|
|
526
560
|
}
|
|
527
561
|
if (!userInfo) {
|
|
528
|
-
userInfo = {
|
|
562
|
+
userInfo = {
|
|
563
|
+
productUserId: fakeUserId
|
|
564
|
+
};
|
|
529
565
|
}
|
|
530
566
|
const sessionID = storeAndLoadFeSessionId();
|
|
531
567
|
const params = {};
|
|
@@ -558,7 +594,8 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
558
594
|
layoutVariantId,
|
|
559
595
|
globalConfig,
|
|
560
596
|
playbookType,
|
|
561
|
-
bffDataSource
|
|
597
|
+
bffDataSource,
|
|
598
|
+
fakeUserId
|
|
562
599
|
]);
|
|
563
600
|
const getEventParamsByJson = useCallback((_a) => {
|
|
564
601
|
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
|
@@ -739,37 +776,39 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
739
776
|
}
|
|
740
777
|
}, [bffFetch, enableReportEvent, enabledMetaConversionApi, globalConfig, bffDataSource, getEventParamsByJson]);
|
|
741
778
|
const bffMutateLike = useCallback((body) => __awaiter(void 0, void 0, void 0, function* () {
|
|
779
|
+
body = Object.assign(Object.assign({}, body), { productUserId: fakeUserId });
|
|
742
780
|
const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/recommend/like', { method: 'POST', body }));
|
|
743
781
|
return res === null || res === void 0 ? void 0 : res.success;
|
|
744
|
-
}), [bffFetch]);
|
|
782
|
+
}), [bffFetch, fakeUserId]);
|
|
745
783
|
const bffMutateUnlike = useCallback((body) => __awaiter(void 0, void 0, void 0, function* () {
|
|
784
|
+
body = Object.assign(Object.assign({}, body), { productUserId: fakeUserId });
|
|
746
785
|
const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/recommend/unlike', { method: 'POST', body }));
|
|
747
786
|
return res === null || res === void 0 ? void 0 : res.success;
|
|
748
|
-
}), [bffFetch]);
|
|
787
|
+
}), [bffFetch, fakeUserId]);
|
|
749
788
|
const bffSubmitForm = useCallback((body) => __awaiter(void 0, void 0, void 0, function* () {
|
|
750
789
|
const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/customform', { method: 'POST', body }));
|
|
751
790
|
return res === null || res === void 0 ? void 0 : res.success;
|
|
752
791
|
}), [bffFetch]);
|
|
753
792
|
const bffGetTagList = useCallback((data) => __awaiter(void 0, void 0, void 0, function* () {
|
|
754
|
-
var
|
|
755
|
-
const isShowTag = !!((
|
|
793
|
+
var _8, _9, _10, _11, _12, _13, _14, _15;
|
|
794
|
+
const isShowTag = !!((_10 = (_9 = (_8 = data === null || data === void 0 ? void 0 : data.data) === null || _8 === void 0 ? void 0 : _8.sxpPageConf) === null || _9 === void 0 ? void 0 : _9.globalConfig) === null || _10 === void 0 ? void 0 : _10.isShowTag);
|
|
756
795
|
if (!utmVal || !isShowTag)
|
|
757
796
|
return;
|
|
758
797
|
try {
|
|
759
|
-
const val = (
|
|
798
|
+
const val = (_13 = (_12 = (_11 = splitUrlParams(utmVal)) === null || _11 === void 0 ? void 0 : _11.filter((val) => {
|
|
760
799
|
var _a, _b;
|
|
761
800
|
const key = val.split('=')[0];
|
|
762
801
|
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);
|
|
763
|
-
})) === null ||
|
|
802
|
+
})) === null || _12 === void 0 ? void 0 : _12.join('&')) !== null && _13 !== void 0 ? _13 : '';
|
|
764
803
|
const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/tag/list', { method: 'GET', query: { channel: decodeURIComponent(val) } }));
|
|
765
|
-
setTagList((
|
|
804
|
+
setTagList((_15 = (_14 = result === null || result === void 0 ? void 0 : result.data) === null || _14 === void 0 ? void 0 : _14.tags) !== null && _15 !== void 0 ? _15 : []);
|
|
766
805
|
}
|
|
767
806
|
catch (e) {
|
|
768
807
|
console.log('e', e);
|
|
769
808
|
}
|
|
770
809
|
}), [bffFetch, utmVal]);
|
|
771
810
|
const ctaEvent = useCallback((eventInfo, rec, product, position, ctaActionType, targetUrl, contentType) => {
|
|
772
|
-
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;
|
|
811
|
+
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, _12, _13, _14;
|
|
773
812
|
const cta = product === null || product === void 0 ? void 0 : product.bindCta;
|
|
774
813
|
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);
|
|
775
814
|
let fromKName = '';
|
|
@@ -787,7 +826,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
787
826
|
}
|
|
788
827
|
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;
|
|
789
828
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
|
790
|
-
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: (
|
|
829
|
+
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 : '', sceneId: (_x = (_w = (_v = rec === null || rec === void 0 ? void 0 : rec.video) === null || _v === void 0 ? void 0 : _v.scene) === null || _w === void 0 ? void 0 : _w.sceneId) !== null && _x !== void 0 ? _x : '', productId: isProd ? product === null || product === void 0 ? void 0 : product.itemId : '', traceInfo: (_13 = (_10 = (_5 = (_1 = (_y = cta === null || cta === void 0 ? void 0 : cta.traceInfo) !== null && _y !== void 0 ? _y : (_0 = (_z = rec === null || rec === void 0 ? void 0 : rec.video) === null || _z === void 0 ? void 0 : _z.bindCta) === null || _0 === void 0 ? void 0 : _0.traceInfo) !== null && _1 !== void 0 ? _1 : (_4 = (_3 = (_2 = rec === null || rec === void 0 ? void 0 : rec.video) === null || _2 === void 0 ? void 0 : _2.bindProduct) === null || _3 === void 0 ? void 0 : _3.bindCta) === null || _4 === void 0 ? void 0 : _4.traceInfo) !== null && _5 !== void 0 ? _5 : (_9 = (_8 = (_7 = (_6 = rec === null || rec === void 0 ? void 0 : rec.video) === null || _6 === void 0 ? void 0 : _6.bindProducts) === null || _7 === void 0 ? void 0 : _7[0]) === null || _8 === void 0 ? void 0 : _8.bindCta) === null || _9 === void 0 ? void 0 : _9.traceInfo) !== null && _10 !== void 0 ? _10 : (_12 = (_11 = rec === null || rec === void 0 ? void 0 : rec.product) === null || _11 === void 0 ? void 0 : _11.bindCta) === null || _12 === void 0 ? void 0 : _12.traceInfo) !== null && _13 !== void 0 ? _13 : '', fromKName, fromKPage: (_14 = location === null || location === void 0 ? void 0 : location.href) !== null && _14 !== void 0 ? _14 : '', contentFormat })
|
|
791
830
|
});
|
|
792
831
|
}, [bffEventReport, isFromHashtag]);
|
|
793
832
|
const h5EnterLink = useCallback(() => {
|
|
@@ -811,10 +850,10 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
811
850
|
});
|
|
812
851
|
}, [bffEventReport]);
|
|
813
852
|
const getAccount = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
814
|
-
var
|
|
853
|
+
var _16, _17;
|
|
815
854
|
const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/account', { method: 'GET' }));
|
|
816
|
-
setChatlabsId((
|
|
817
|
-
return ((
|
|
855
|
+
setChatlabsId((_16 = res === null || res === void 0 ? void 0 : res.data) === null || _16 === void 0 ? void 0 : _16.chatLabsId);
|
|
856
|
+
return ((_17 = res === null || res === void 0 ? void 0 : res.data) === null || _17 === void 0 ? void 0 : _17.consentResult) === 'true';
|
|
818
857
|
}), [bffFetch]);
|
|
819
858
|
const accountSonsent = useCallback((consentResult) => __awaiter(void 0, void 0, void 0, function* () {
|
|
820
859
|
const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/account/consent', {
|
|
@@ -878,6 +917,9 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
878
917
|
}
|
|
879
918
|
setRtcList(list);
|
|
880
919
|
setCacheRtcList(list);
|
|
920
|
+
if (isDiyPage) {
|
|
921
|
+
setFirstRtcList(list);
|
|
922
|
+
}
|
|
881
923
|
bffGetTagList(curData !== null && curData !== void 0 ? curData : finalPageData);
|
|
882
924
|
if (channel) {
|
|
883
925
|
const item = list === null || list === void 0 ? void 0 : list[0];
|
|
@@ -897,7 +939,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
897
939
|
});
|
|
898
940
|
setLoading(false);
|
|
899
941
|
});
|
|
900
|
-
}, [isShowConsent, channel]);
|
|
942
|
+
}, [isShowConsent, channel, isDiyPage]);
|
|
901
943
|
useEffect(() => {
|
|
902
944
|
if (!isPreview)
|
|
903
945
|
return;
|
|
@@ -912,12 +954,15 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
912
954
|
}
|
|
913
955
|
setRtcList(list);
|
|
914
956
|
setCacheRtcList(list);
|
|
957
|
+
if (isDiyPage) {
|
|
958
|
+
setFirstRtcList(list);
|
|
959
|
+
}
|
|
915
960
|
}
|
|
916
961
|
})
|
|
917
962
|
.finally(() => {
|
|
918
963
|
setLoading(false);
|
|
919
964
|
});
|
|
920
|
-
}, [getRecommendVideos, bffGetTagList, channel]);
|
|
965
|
+
}, [getRecommendVideos, bffGetTagList, channel, isDiyPage]);
|
|
921
966
|
const defaultLoadingImage = useIconLink('/pb_static/a65d23c5893c49d7aaaa81681d3179e2.gif', appDomain);
|
|
922
967
|
return (React.createElement(SxpDataSourceContext.Provider, { value: {
|
|
923
968
|
rtcList,
|
|
@@ -975,7 +1020,8 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
975
1020
|
refreshFeSession,
|
|
976
1021
|
getAccount,
|
|
977
1022
|
accountSonsent,
|
|
978
|
-
isDiyH5,
|
|
1023
|
+
isDiyH5: isDiyPage,
|
|
1024
|
+
firstRtcList,
|
|
979
1025
|
pixelPvStatusRef
|
|
980
1026
|
} }, isShowConsent ? (React.createElement(Consent, 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({
|
|
981
1027
|
rtcList,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { useCallback } from 'react';
|
|
2
|
-
import { useSxpDataSource } from './useSxpDataSource';
|
|
3
2
|
import { DEFAULT_TAG } from '../context/SxpDataSourceProvider';
|
|
3
|
+
import { useSxpDataSource } from './useSxpDataSource';
|
|
4
4
|
export function useEventReport() {
|
|
5
5
|
const { bffEventReport, popupDetailData, isFromHashtag, eventTimeList, setEventTimeList } = useSxpDataSource();
|
|
6
6
|
const jumpToWeb = useCallback((e, data, product, cta, position, traceInfo) => {
|
|
7
|
-
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, _12, _13;
|
|
7
|
+
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, _12, _13, _14, _15, _16;
|
|
8
8
|
const i = eventTimeList === null || eventTimeList === void 0 ? void 0 : eventTimeList.findIndex((item) => item.target === (e === null || e === void 0 ? void 0 : e.target));
|
|
9
9
|
if (i !== -1) {
|
|
10
10
|
return;
|
|
@@ -37,11 +37,11 @@ export function useEventReport() {
|
|
|
37
37
|
contentFormat = 'image';
|
|
38
38
|
}
|
|
39
39
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
|
40
|
-
eventInfo: Object.assign({ eventSubject: 'jumpToWeb', eventDescription: 'User jumped to website', productId: (_v = product === null || product === void 0 ? void 0 : product.itemId) !== null && _v !== void 0 ? _v : '', productName: (_w = product === null || product === void 0 ? void 0 : product.title) !== null && _w !== void 0 ? _w : '', price: (product === null || product === void 0 ? void 0 : product.price) ? (product === null || product === void 0 ? void 0 : product.price) + '' : '0', productCollection: (_x = product === null || product === void 0 ? void 0 : product.collection) !== null && _x !== void 0 ? _x : '', fromKName, fromKPage: location === null || location === void 0 ? void 0 : location.href, contentTags: contentTags ? JSON.stringify(contentTags) : '', position: position + '', contentId: (_z = (_y = data === null || data === void 0 ? void 0 : data.video) === null || _y === void 0 ? void 0 : _y.itemId) !== null && _z !== void 0 ? _z : '',
|
|
40
|
+
eventInfo: Object.assign({ eventSubject: 'jumpToWeb', eventDescription: 'User jumped to website', productId: (_v = product === null || product === void 0 ? void 0 : product.itemId) !== null && _v !== void 0 ? _v : '', productName: (_w = product === null || product === void 0 ? void 0 : product.title) !== null && _w !== void 0 ? _w : '', price: (product === null || product === void 0 ? void 0 : product.price) ? (product === null || product === void 0 ? void 0 : product.price) + '' : '0', productCollection: (_x = product === null || product === void 0 ? void 0 : product.collection) !== null && _x !== void 0 ? _x : '', fromKName, fromKPage: location === null || location === void 0 ? void 0 : location.href, contentTags: contentTags ? JSON.stringify(contentTags) : '', position: position + '', contentId: (_z = (_y = data === null || data === void 0 ? void 0 : data.video) === null || _y === void 0 ? void 0 : _y.itemId) !== null && _z !== void 0 ? _z : '', sceneId: (_2 = (_1 = (_0 = data === null || data === void 0 ? void 0 : data.video) === null || _0 === void 0 ? void 0 : _0.scene) === null || _1 === void 0 ? void 0 : _1.sceneId) !== null && _2 !== void 0 ? _2 : '', ctatId: (_3 = cta === null || cta === void 0 ? void 0 : cta.itemId) !== null && _3 !== void 0 ? _3 : '', traceInfo: (_16 = (_13 = (_11 = (_7 = (_4 = traceInfo !== null && traceInfo !== void 0 ? traceInfo : product === null || product === void 0 ? void 0 : product.traceInfo) !== null && _4 !== void 0 ? _4 : (_6 = (_5 = data === null || data === void 0 ? void 0 : data.video) === null || _5 === void 0 ? void 0 : _5.bindProduct) === null || _6 === void 0 ? void 0 : _6.traceInfo) !== null && _7 !== void 0 ? _7 : (_10 = (_9 = (_8 = data === null || data === void 0 ? void 0 : data.video) === null || _8 === void 0 ? void 0 : _8.bindProducts) === null || _9 === void 0 ? void 0 : _9[0]) === null || _10 === void 0 ? void 0 : _10.traceInfo) !== null && _11 !== void 0 ? _11 : (_12 = data === null || data === void 0 ? void 0 : data.product) === null || _12 === void 0 ? void 0 : _12.traceInfo) !== null && _13 !== void 0 ? _13 : (_15 = (_14 = data === null || data === void 0 ? void 0 : data.video) === null || _14 === void 0 ? void 0 : _14.bindCta) === null || _15 === void 0 ? void 0 : _15.traceInfo) !== null && _16 !== void 0 ? _16 : '' }, (contentFormat && { contentFormat }))
|
|
41
41
|
});
|
|
42
42
|
}, [bffEventReport, popupDetailData, isFromHashtag, eventTimeList]);
|
|
43
43
|
const productView = useCallback((data, product, cta, viewTime, position) => {
|
|
44
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
44
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
45
45
|
let fromKName = '';
|
|
46
46
|
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))) {
|
|
47
47
|
fromKName = 'pdpPage';
|
|
@@ -60,8 +60,9 @@ export function useEventReport() {
|
|
|
60
60
|
contentTags: JSON.stringify(product === null || product === void 0 ? void 0 : product.tags),
|
|
61
61
|
position: position + '',
|
|
62
62
|
contentId: (_d = data === null || data === void 0 ? void 0 : data.video) === null || _d === void 0 ? void 0 : _d.itemId,
|
|
63
|
+
sceneId: (_g = (_f = (_e = data === null || data === void 0 ? void 0 : data.video) === null || _e === void 0 ? void 0 : _e.scene) === null || _f === void 0 ? void 0 : _f.sceneId) !== null && _g !== void 0 ? _g : '',
|
|
63
64
|
ctatId: cta === null || cta === void 0 ? void 0 : cta.itemId,
|
|
64
|
-
traceInfo: (
|
|
65
|
+
traceInfo: (_s = (_q = (_l = (_h = product === null || product === void 0 ? void 0 : product.traceInfo) !== null && _h !== void 0 ? _h : (_k = (_j = data === null || data === void 0 ? void 0 : data.video) === null || _j === void 0 ? void 0 : _j.bindProduct) === null || _k === void 0 ? void 0 : _k.traceInfo) !== null && _l !== void 0 ? _l : (_p = (_o = (_m = data === null || data === void 0 ? void 0 : data.video) === null || _m === void 0 ? void 0 : _m.bindProducts) === null || _o === void 0 ? void 0 : _o[0]) === null || _p === void 0 ? void 0 : _p.traceInfo) !== null && _q !== void 0 ? _q : (_r = data === null || data === void 0 ? void 0 : data.product) === null || _r === void 0 ? void 0 : _r.traceInfo) !== null && _s !== void 0 ? _s : '',
|
|
65
66
|
timeOnSite: Math.floor((new Date() - viewTime) / 1000) + '',
|
|
66
67
|
eventSubject: 'productView',
|
|
67
68
|
eventDescription: 'User browsed the product'
|
|
@@ -43,13 +43,13 @@ export function useVisibleHeight() {
|
|
|
43
43
|
styleElement.id = 'onetrust-pc-sdk';
|
|
44
44
|
styleElement.setAttribute('type', 'text/css');
|
|
45
45
|
document.head.appendChild(styleElement);
|
|
46
|
-
const css = `
|
|
47
|
-
#onetrust-pc-sdk {
|
|
48
|
-
height: ${finalHeight}px !important;
|
|
49
|
-
}
|
|
50
|
-
#onetrust-pc-sdk #ot-pc-content{
|
|
51
|
-
bottom: ${b}px !important;
|
|
52
|
-
}
|
|
46
|
+
const css = `
|
|
47
|
+
#onetrust-pc-sdk {
|
|
48
|
+
height: ${finalHeight}px !important;
|
|
49
|
+
}
|
|
50
|
+
#onetrust-pc-sdk #ot-pc-content{
|
|
51
|
+
bottom: ${b}px !important;
|
|
52
|
+
}
|
|
53
53
|
`;
|
|
54
54
|
styleElement.textContent = css;
|
|
55
55
|
}
|
package/es/core/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
export { EditorCore } from './context/EditorContext';
|
|
2
2
|
export type { IEditorCoreRef } from './context/EditorContext';
|
|
3
3
|
export type { MaterialComponet } from './create';
|
|
4
|
+
export { default as StructurePage } from './components/StructurePage';
|
|
5
|
+
export type { IStructurePageProps, IPostData, IProductData, IMultiCtaData, IApiResponse } from './components/StructurePage';
|
package/es/core/index.js
CHANGED
|
@@ -19,7 +19,7 @@ export declare const getPriceText: ({ product, enableFormattedPrice, globalConfi
|
|
|
19
19
|
product: ProductInfoType | undefined | null;
|
|
20
20
|
enableFormattedPrice: boolean | undefined;
|
|
21
21
|
globalConfig: ISxpPageRenderProps['globalConfig'];
|
|
22
|
-
isHiddenDef?: boolean;
|
|
22
|
+
isHiddenDef?: boolean | undefined;
|
|
23
23
|
style?: IfontType | any;
|
|
24
24
|
}) => string | null;
|
|
25
25
|
export {};
|
package/es/index.d.ts
CHANGED
|
@@ -10,4 +10,5 @@ export { default as SxpDataSourceProvider } from './core/context/SxpDataSourcePr
|
|
|
10
10
|
export { default as SxpPageCore } from './core/components/SxpPageCore';
|
|
11
11
|
export { default as EditorDataProvider } from './core/context/EditorDataProvider';
|
|
12
12
|
export { useEditorDataProvider } from './core/context/EditorDataProvider';
|
|
13
|
+
export { default as StructurePage } from './core/components/StructurePage';
|
|
13
14
|
export default Pagebuilder;
|
package/es/index.js
CHANGED
|
@@ -12,4 +12,5 @@ export { default as SxpDataSourceProvider } from './core/context/SxpDataSourcePr
|
|
|
12
12
|
export { default as SxpPageCore } from './core/components/SxpPageCore';
|
|
13
13
|
export { default as EditorDataProvider } from './core/context/EditorDataProvider';
|
|
14
14
|
export { useEditorDataProvider } from './core/context/EditorDataProvider';
|
|
15
|
+
export { default as StructurePage } from './core/components/StructurePage';
|
|
15
16
|
export default Pagebuilder;
|
|
@@ -14,10 +14,10 @@ const MultiPosts = (_a) => {
|
|
|
14
14
|
const traceInfo = ((_b = recData === null || recData === void 0 ? void 0 : recData.video) === null || _b === void 0 ? void 0 : _b.traceInfo) || ((_c = recData === null || recData === void 0 ? void 0 : recData.product) === null || _c === void 0 ? void 0 : _c.traceInfo) || '';
|
|
15
15
|
const getPropsVal = useCallback((index, str) => {
|
|
16
16
|
try {
|
|
17
|
-
return new Function('props', 'str', `if (str) {
|
|
18
|
-
return props?.button${index + 1}${str}
|
|
19
|
-
} else {
|
|
20
|
-
return props?.button${index + 1}
|
|
17
|
+
return new Function('props', 'str', `if (str) {
|
|
18
|
+
return props?.button${index + 1}${str}
|
|
19
|
+
} else {
|
|
20
|
+
return props?.button${index + 1}
|
|
21
21
|
}`)(props, str);
|
|
22
22
|
}
|
|
23
23
|
catch (_a) { }
|
|
@@ -153,10 +153,10 @@ const CommodityDetail = (_a) => {
|
|
|
153
153
|
__html: setFontForText((_c = product === null || product === void 0 ? void 0 : product.taxInfo) !== null && _c !== void 0 ? _c : '税费', commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.taxInfo)
|
|
154
154
|
} }),
|
|
155
155
|
React.createElement("div", { hidden: !!product && (!(product === null || product === void 0 ? void 0 : product.info) || (product === null || product === void 0 ? void 0 : product.info) === '') },
|
|
156
|
-
React.createElement(ExpandableText, { foldText: tipText === null || tipText === void 0 ? void 0 : tipText.foldText, unfoldText: tipText === null || tipText === void 0 ? void 0 : tipText.unfoldText, onClick: () => setShowModal(true), isPost: isPost, text: (_d = product === null || product === void 0 ? void 0 : product.info) !== null && _d !== void 0 ? _d : `The design inspiration of Tiffany Lock series comes from the power of connection and inclusiveness, and the
|
|
157
|
-
bold and avant-garde visual design interprets the emotional bond connecting my heart. The Tiffany Lock
|
|
158
|
-
collection is unisex and is inspired by the padlock pattern found in the Tiffany Antique Collection. This
|
|
159
|
-
necklace features a stylish and eye-catching oval clasp chain decorated with a lock pattern. Crafted from
|
|
156
|
+
React.createElement(ExpandableText, { foldText: tipText === null || tipText === void 0 ? void 0 : tipText.foldText, unfoldText: tipText === null || tipText === void 0 ? void 0 : tipText.unfoldText, onClick: () => setShowModal(true), isPost: isPost, text: (_d = product === null || product === void 0 ? void 0 : product.info) !== null && _d !== void 0 ? _d : `The design inspiration of Tiffany Lock series comes from the power of connection and inclusiveness, and the
|
|
157
|
+
bold and avant-garde visual design interprets the emotional bond connecting my heart. The Tiffany Lock
|
|
158
|
+
collection is unisex and is inspired by the padlock pattern found in the Tiffany Antique Collection. This
|
|
159
|
+
necklace features a stylish and eye-catching oval clasp chain decorated with a lock pattern. Crafted from
|
|
160
160
|
18-karat gold, this necklace is embellished with hand-set diamonds.`, maxStr: 79, className: 'pb-commondity-content-info', style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.info }))));
|
|
161
161
|
};
|
|
162
162
|
const renderBtn = () => {
|
|
@@ -149,7 +149,7 @@ const CommodityDetailDiroNew = (_a) => {
|
|
|
149
149
|
const productInfoText = ({ isPost }) => {
|
|
150
150
|
return (React.createElement("div", { hidden: !!product && (!(product === null || product === void 0 ? void 0 : product.info) || (product === null || product === void 0 ? void 0 : product.info) === '') },
|
|
151
151
|
React.createElement(ExpandableText, { isPost: isPost, onClick: () => setShowModal(true), className: 'pb-commondityDiroNew-info', style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.info, foldText: tipText === null || tipText === void 0 ? void 0 : tipText.foldText, unfoldText: tipText === null || tipText === void 0 ? void 0 : tipText.unfoldText, text: (product === null || product === void 0 ? void 0 : product.info) ||
|
|
152
|
-
`Unveiled at the Spring-Summer 2023 fashion show, the Dior Toujours bag is distinguished by a casual and practical design. Crafted in black calfskin with Macrocannage topstitching, it showcases a spacious interior compartment with a matching pouch to organize essentials. Its leather strap closure keeps items secure while the D of the CD Lock closure twists to adjust the sides and enhance the bag's silhouette. The leather handles can be adjusted using the small notches in order to be able to carry the large bag by hand or wear it over the shoulder. CD Lock and strap closures D.I.O.R. charms Removable interior pouch Adjustable leather handles Dust bag included
|
|
152
|
+
`Unveiled at the Spring-Summer 2023 fashion show, the Dior Toujours bag is distinguished by a casual and practical design. Crafted in black calfskin with Macrocannage topstitching, it showcases a spacious interior compartment with a matching pouch to organize essentials. Its leather strap closure keeps items secure while the D of the CD Lock closure twists to adjust the sides and enhance the bag's silhouette. The leather handles can be adjusted using the small notches in order to be able to carry the large bag by hand or wear it over the shoulder. CD Lock and strap closures D.I.O.R. charms Removable interior pouch Adjustable leather handles Dust bag included
|
|
153
153
|
Made in Italy` })));
|
|
154
154
|
};
|
|
155
155
|
const getStyle = useCallback((style) => {
|
|
@@ -25,7 +25,7 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
|
25
25
|
}, []);
|
|
26
26
|
const PAUSE_ICON = (0, useIconLink_1.useIconLink)('/pb_static/06f28a2025c74c1cb49be6767316d827.png');
|
|
27
27
|
const handlePlaying = (0, react_1.useCallback)(() => {
|
|
28
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
28
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
29
29
|
setIsPauseVideo(false);
|
|
30
30
|
const item = data[index];
|
|
31
31
|
if (item && ((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.duration)) {
|
|
@@ -38,14 +38,15 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
|
38
38
|
eventSubject: 'playVideo',
|
|
39
39
|
eventDescription: 'User played the video',
|
|
40
40
|
contentId: (_h = (_g = item === null || item === void 0 ? void 0 : item.video) === null || _g === void 0 ? void 0 : _g.itemId) !== null && _h !== void 0 ? _h : '',
|
|
41
|
-
|
|
41
|
+
sceneId: (_l = (_k = (_j = item === null || item === void 0 ? void 0 : item.video) === null || _j === void 0 ? void 0 : _j.scene) === null || _k === void 0 ? void 0 : _k.sceneId) !== null && _l !== void 0 ? _l : '',
|
|
42
|
+
contentName: (_o = (_m = item === null || item === void 0 ? void 0 : item.video) === null || _m === void 0 ? void 0 : _m.title) !== null && _o !== void 0 ? _o : '',
|
|
42
43
|
playType,
|
|
43
44
|
startTime: videoCurrentTime,
|
|
44
45
|
videoDuration,
|
|
45
|
-
contentTags: JSON.stringify((
|
|
46
|
+
contentTags: JSON.stringify((_q = (_p = item === null || item === void 0 ? void 0 : item.video) === null || _p === void 0 ? void 0 : _p.tags) !== null && _q !== void 0 ? _q : []),
|
|
46
47
|
position: index + '',
|
|
47
48
|
contentFormat: 'video',
|
|
48
|
-
traceInfo: (
|
|
49
|
+
traceInfo: (_r = item === null || item === void 0 ? void 0 : item.video) === null || _r === void 0 ? void 0 : _r.traceInfo
|
|
49
50
|
}
|
|
50
51
|
});
|
|
51
52
|
setIsFirstPlay(false);
|
|
@@ -84,7 +85,7 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
|
84
85
|
}
|
|
85
86
|
}, [isLoadFinish]);
|
|
86
87
|
const onPause = (0, react_1.useCallback)(() => {
|
|
87
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
88
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
88
89
|
const item = data[index];
|
|
89
90
|
const videoDuration = ((_b = (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.duration) !== null && _b !== void 0 ? _b : 0).toFixed(2);
|
|
90
91
|
const videoCurrentTime = ((_d = (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.currentTime) !== null && _d !== void 0 ? _d : 0).toFixed(2);
|
|
@@ -95,14 +96,15 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
|
95
96
|
eventSubject: 'playOverVideo',
|
|
96
97
|
eventDescription: 'User finished playing the video',
|
|
97
98
|
contentId: (_h = (_g = item === null || item === void 0 ? void 0 : item.video) === null || _g === void 0 ? void 0 : _g.itemId) !== null && _h !== void 0 ? _h : '',
|
|
98
|
-
|
|
99
|
+
sceneId: (_l = (_k = (_j = item === null || item === void 0 ? void 0 : item.video) === null || _j === void 0 ? void 0 : _j.scene) === null || _k === void 0 ? void 0 : _k.sceneId) !== null && _l !== void 0 ? _l : '',
|
|
100
|
+
contentName: (_o = (_m = item === null || item === void 0 ? void 0 : item.video) === null || _m === void 0 ? void 0 : _m.title) !== null && _o !== void 0 ? _o : '',
|
|
99
101
|
endTime: videoCurrentTime,
|
|
100
102
|
videoDuration,
|
|
101
103
|
playDuration,
|
|
102
|
-
contentTags: JSON.stringify((
|
|
104
|
+
contentTags: JSON.stringify((_q = (_p = item === null || item === void 0 ? void 0 : item.video) === null || _p === void 0 ? void 0 : _p.tags) !== null && _q !== void 0 ? _q : []),
|
|
103
105
|
position: index + '',
|
|
104
106
|
contentFormat: 'video',
|
|
105
|
-
traceInfo: (
|
|
107
|
+
traceInfo: (_r = item === null || item === void 0 ? void 0 : item.video) === null || _r === void 0 ? void 0 : _r.traceInfo
|
|
106
108
|
}
|
|
107
109
|
});
|
|
108
110
|
}
|
|
@@ -210,10 +210,16 @@ const DiyStoryPreview = (0, react_1.forwardRef)(({ data = [], globalConfig, tipT
|
|
|
210
210
|
}, [handleSessionExpire, disabledListener]);
|
|
211
211
|
return (react_1.default.createElement("div", { id: 'sxp-render', style: { height: containerHeight, position: 'relative', pointerEvents } },
|
|
212
212
|
react_1.default.createElement(react_2.Swiper, { ref: swiperRef, allowTouchMove: pointerEvents !== 'none', onSlideChange: () => {
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
swiperRef.current.swiper.allowTouchMove =
|
|
216
|
-
|
|
213
|
+
var _a;
|
|
214
|
+
if ((_a = swiperRef.current) === null || _a === void 0 ? void 0 : _a.swiper) {
|
|
215
|
+
swiperRef.current.swiper.allowTouchMove = false;
|
|
216
|
+
setTimeout(() => {
|
|
217
|
+
var _a;
|
|
218
|
+
if ((_a = swiperRef.current) === null || _a === void 0 ? void 0 : _a.swiper) {
|
|
219
|
+
swiperRef.current.swiper.allowTouchMove = true;
|
|
220
|
+
}
|
|
221
|
+
}, 500);
|
|
222
|
+
}
|
|
217
223
|
}, onActiveIndexChange: (swiper) => {
|
|
218
224
|
setCurIndex(swiper === null || swiper === void 0 ? void 0 : swiper.activeIndex);
|
|
219
225
|
onActiveChange === null || onActiveChange === void 0 ? void 0 : onActiveChange(swiper.activeIndex);
|