pb-sxp-ui 1.20.7 → 1.20.8
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 +290 -188
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +290 -188
- 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 +290 -188
- 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/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/index.js +56 -40
- package/es/core/context/SxpDataSourceProvider.d.ts +5 -12
- package/es/core/context/SxpDataSourceProvider.js +123 -55
- package/es/core/hooks/useEventReport.js +6 -5
- package/lib/core/components/DiyPortalPreview/VideoWidget.js +10 -8
- 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/index.js +56 -40
- package/lib/core/context/SxpDataSourceProvider.d.ts +5 -12
- package/lib/core/context/SxpDataSourceProvider.js +123 -55
- package/lib/core/hooks/useEventReport.js +6 -5
- package/package.json +1 -1
|
@@ -23,6 +23,7 @@ exports.DEFAULT_TAG = 'FOR U';
|
|
|
23
23
|
const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent = true, maxSize, defaultSize, isPreview = false, sxpParameter, appDomain, hashTagSize, loadingImage, isOpenHashTag = false, enabledMetaConversionApi = false, consentHeight, consentWidth, isOpenConsent = false, isEditor = false, utmParameter, channelQueryList, data, dataList, isDiyH5, onUpdateSchema, onUpdateChannel }) => {
|
|
24
24
|
var _a, _b, _c, _d, _e;
|
|
25
25
|
const [rtcList, setRtcList] = (0, react_1.useState)([]);
|
|
26
|
+
const [firstRtcList, setFirstRtcList] = (0, react_1.useState)([]);
|
|
26
27
|
const [tagList, setTagList] = (0, react_1.useState)([]);
|
|
27
28
|
const [loading, setLoading] = (0, react_1.useState)(true);
|
|
28
29
|
const [curReqInfo, setCurReqInfo] = (0, react_1.useState)({ rtc: '', requestId: '' });
|
|
@@ -53,6 +54,10 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
53
54
|
const [chatlabsId, setChatlabsId] = (0, react_1.useState)();
|
|
54
55
|
const finalPageData = (0, react_1.useMemo)(() => pageData !== null && pageData !== void 0 ? pageData : data, [pageData, data]);
|
|
55
56
|
const pixelPvStatusRef = (0, react_1.useRef)(false);
|
|
57
|
+
const isDiyPage = (0, react_1.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]);
|
|
56
61
|
(0, react_1.useEffect)(() => {
|
|
57
62
|
var _a, _b;
|
|
58
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);
|
|
@@ -138,13 +143,16 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
138
143
|
return '';
|
|
139
144
|
}
|
|
140
145
|
const OptanonConsent = decodeURIComponent((_a = getCookie('OptanonConsent')) !== null && _a !== void 0 ? _a : '');
|
|
141
|
-
if ((
|
|
146
|
+
if ((window === null || window === void 0 ? void 0 : window.OnetrustActiveGroups) &&
|
|
147
|
+
((_b = window === null || window === void 0 ? void 0 : window.OnetrustActiveGroups) === null || _b === void 0 ? void 0 : _b.length) > 2 &&
|
|
148
|
+
!(window === null || window === void 0 ? void 0 : window.OnetrustActiveGroups.includes('4')) &&
|
|
149
|
+
isTargetingRejected(OptanonConsent)) {
|
|
142
150
|
return true;
|
|
143
151
|
}
|
|
144
152
|
return false;
|
|
145
153
|
};
|
|
146
154
|
const bffFetch = (0, react_1.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
|
})
|
|
@@ -189,7 +198,9 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
189
198
|
const originalSrcDescriptor = Object.getOwnPropertyDescriptor(HTMLImageElement.prototype, 'src');
|
|
190
199
|
Object.defineProperty(img, 'src', {
|
|
191
200
|
set(value) {
|
|
192
|
-
if (getTargetingCookie() &&
|
|
201
|
+
if (getTargetingCookie() &&
|
|
202
|
+
(value.includes('https://www.facebook.com/privacy_sandbox/pixel/register/trigger/') ||
|
|
203
|
+
value.includes('https://www.facebook.com/tr'))) {
|
|
193
204
|
return;
|
|
194
205
|
}
|
|
195
206
|
originalSrcDescriptor.set.call(this, value);
|
|
@@ -201,7 +212,6 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
201
212
|
eventSource: 'Meta Pixel'
|
|
202
213
|
});
|
|
203
214
|
}
|
|
204
|
-
;
|
|
205
215
|
},
|
|
206
216
|
get() {
|
|
207
217
|
return originalSrcDescriptor.get.call(this);
|
|
@@ -219,7 +229,9 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
219
229
|
const originalSendBeacon = navigatorWithBeacon.sendBeacon.bind(navigatorWithBeacon);
|
|
220
230
|
navigatorWithBeacon.sendBeacon = function (url, data) {
|
|
221
231
|
const urlString = url instanceof URL ? url.href : url.toString();
|
|
222
|
-
if (getTargetingCookie() &&
|
|
232
|
+
if (getTargetingCookie() &&
|
|
233
|
+
(urlString.includes('https://tr.snapchat.com/p') ||
|
|
234
|
+
urlString.includes('https://analytics.tiktok.com/api/v2/pixel'))) {
|
|
223
235
|
return true;
|
|
224
236
|
}
|
|
225
237
|
const success = originalSendBeacon(url, data);
|
|
@@ -295,18 +307,16 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
295
307
|
var _a;
|
|
296
308
|
let url;
|
|
297
309
|
try {
|
|
298
|
-
url = typeof input === 'string'
|
|
299
|
-
? input
|
|
300
|
-
: input instanceof URL
|
|
301
|
-
? input.href
|
|
302
|
-
: input.url;
|
|
310
|
+
url = typeof input === 'string' ? input : input instanceof URL ? input.href : input.url;
|
|
303
311
|
}
|
|
304
312
|
catch (error) {
|
|
305
313
|
console.error('解析请求URL失败:', error);
|
|
306
314
|
return _originalFetch.apply(this, arguments_1);
|
|
307
315
|
}
|
|
308
316
|
try {
|
|
309
|
-
if (getTargetingCookie() &&
|
|
317
|
+
if (getTargetingCookie() &&
|
|
318
|
+
(url.includes('https://www.google-analytics.com/g/collect') ||
|
|
319
|
+
url.includes('https://arms-retcode.aliyuncs.com/r.png'))) {
|
|
310
320
|
return Promise.resolve(new Response(''));
|
|
311
321
|
}
|
|
312
322
|
const response = _originalFetch.apply(this, arguments_1);
|
|
@@ -360,7 +370,12 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
360
370
|
};
|
|
361
371
|
XMLHttpRequest.prototype.send = function (body) {
|
|
362
372
|
var _a;
|
|
363
|
-
if (getTargetingCookie() &&
|
|
373
|
+
if (getTargetingCookie() &&
|
|
374
|
+
this._url &&
|
|
375
|
+
typeof this._url === 'string' &&
|
|
376
|
+
(this._url.includes('https://rumcollector.uptime.com') ||
|
|
377
|
+
this._url.includes('https://arms-retcode.aliyuncs.com/r.png') ||
|
|
378
|
+
this._url.includes('https://i.giesswein.com/nb-collector'))) {
|
|
364
379
|
return;
|
|
365
380
|
}
|
|
366
381
|
if (this._url && typeof this._url === 'string' && this._url.includes('https://i.giesswein.com/nb-collector')) {
|
|
@@ -412,8 +427,8 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
412
427
|
.catch((err) => Promise.reject(err));
|
|
413
428
|
}, [bffDataSource]);
|
|
414
429
|
const getRecommendVideos = (0, react_1.useCallback)((query) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
415
|
-
var _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
|
416
|
-
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' }));
|
|
417
432
|
if (channel) {
|
|
418
433
|
query = Object.assign(Object.assign({}, query), { channel: decodeURIComponent(channel) });
|
|
419
434
|
}
|
|
@@ -426,9 +441,10 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
426
441
|
if (val)
|
|
427
442
|
query = Object.assign(Object.assign({}, query), { channel: decodeURIComponent(val) });
|
|
428
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);
|
|
429
445
|
if (isEditor) {
|
|
430
446
|
let pageNum = 1;
|
|
431
|
-
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 }));
|
|
432
448
|
if (!(query === null || query === void 0 ? void 0 : query.channel) || isInit.current) {
|
|
433
449
|
return undefined;
|
|
434
450
|
}
|
|
@@ -436,19 +452,24 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
436
452
|
let list = [];
|
|
437
453
|
let result = null;
|
|
438
454
|
const recurveRecList = (query) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
439
|
-
var
|
|
455
|
+
var _y, _z, _0, _1, _2, _3;
|
|
440
456
|
query.pageNum = pageNum;
|
|
441
|
-
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('recommend/direct_page', { method: 'POST', body: query }));
|
|
442
460
|
if (!(result === null || result === void 0 ? void 0 : result.success)) {
|
|
443
461
|
return undefined;
|
|
444
462
|
}
|
|
445
463
|
setLoading(false);
|
|
446
|
-
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 : []);
|
|
447
465
|
if ((rtcList === null || rtcList === void 0 ? void 0 : rtcList.length) === 0) {
|
|
448
466
|
setRtcList(getFilterRecList(Object.assign(Object.assign({}, result === null || result === void 0 ? void 0 : result.data), { recList: list })));
|
|
449
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
|
+
}
|
|
450
471
|
}
|
|
451
|
-
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));
|
|
452
473
|
if (isNotNullList) {
|
|
453
474
|
pageNum = pageNum + 1;
|
|
454
475
|
yield recurveRecList(query);
|
|
@@ -456,42 +477,61 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
456
477
|
});
|
|
457
478
|
yield recurveRecList(query);
|
|
458
479
|
if (!(query === null || query === void 0 ? void 0 : query.hashTag) && result)
|
|
459
|
-
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 });
|
|
460
481
|
return Object.assign(Object.assign({}, result === null || result === void 0 ? void 0 : result.data), { recList: list });
|
|
461
482
|
}
|
|
462
483
|
if (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview) {
|
|
463
|
-
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 }));
|
|
464
485
|
}
|
|
465
|
-
const result =
|
|
466
|
-
method: 'POST',
|
|
467
|
-
|
|
468
|
-
|
|
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
|
+
}));
|
|
469
492
|
if (!(result === null || result === void 0 ? void 0 : result.success)) {
|
|
470
493
|
return undefined;
|
|
471
494
|
}
|
|
472
495
|
if (!(query === null || query === void 0 ? void 0 : query.hashTag))
|
|
473
496
|
setCurReqInfo({ rtc: result.data.rtc, requestId: result.data.requestId });
|
|
474
497
|
if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview) && !isEditor) {
|
|
475
|
-
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));
|
|
476
499
|
if (!isNotNullList) {
|
|
477
500
|
setIsNoMoreData(true);
|
|
478
501
|
}
|
|
479
502
|
}
|
|
480
503
|
let list = [];
|
|
481
|
-
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 : []);
|
|
482
505
|
return Object.assign(Object.assign({}, result.data), { recList: list });
|
|
483
|
-
}), [
|
|
506
|
+
}), [
|
|
507
|
+
bffFetch,
|
|
508
|
+
utmVal,
|
|
509
|
+
maxSize,
|
|
510
|
+
defaultSize,
|
|
511
|
+
channelQueryList,
|
|
512
|
+
channel,
|
|
513
|
+
chatlabsId,
|
|
514
|
+
bffFetchAdmin,
|
|
515
|
+
isDiyPage,
|
|
516
|
+
finalPageData,
|
|
517
|
+
isDiyH5
|
|
518
|
+
]);
|
|
484
519
|
const loadVideos = (0, react_1.useCallback)((pageNum) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
485
|
-
var
|
|
520
|
+
var _4, _5, _6, _7;
|
|
486
521
|
if (rtcList.length <= 0) {
|
|
487
522
|
return;
|
|
488
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
|
+
}
|
|
489
529
|
const lastItem = rtcList === null || rtcList === void 0 ? void 0 : rtcList[(rtcList === null || rtcList === void 0 ? void 0 : rtcList.length) - 1];
|
|
490
|
-
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 })));
|
|
491
531
|
setRtcList(rtcList.concat(getFilterRecList(data)));
|
|
492
532
|
setCacheRtcList(cacheRtcList.concat(getFilterRecList(data)));
|
|
493
533
|
return data;
|
|
494
|
-
}), [getRecommendVideos, rtcList, waterFallData, cacheRtcList]);
|
|
534
|
+
}), [getRecommendVideos, rtcList, waterFallData, cacheRtcList, isDiyPage, firstRtcList]);
|
|
495
535
|
const refreshFeSession = (0, react_1.useCallback)((enableReSid, event) => {
|
|
496
536
|
var _a, _b, _c, _d, _e;
|
|
497
537
|
let expire = false;
|
|
@@ -519,7 +559,9 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
519
559
|
return;
|
|
520
560
|
}
|
|
521
561
|
if (!userInfo) {
|
|
522
|
-
userInfo = {
|
|
562
|
+
userInfo = {
|
|
563
|
+
productUserId: fakeUserId
|
|
564
|
+
};
|
|
523
565
|
}
|
|
524
566
|
const sessionID = (0, sessionStore_1.storeAndLoadFeSessionId)();
|
|
525
567
|
const params = {};
|
|
@@ -552,7 +594,8 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
552
594
|
layoutVariantId,
|
|
553
595
|
globalConfig,
|
|
554
596
|
playbookType,
|
|
555
|
-
bffDataSource
|
|
597
|
+
bffDataSource,
|
|
598
|
+
fakeUserId
|
|
556
599
|
]);
|
|
557
600
|
const getEventParamsByJson = (0, react_1.useCallback)((_a) => {
|
|
558
601
|
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
@@ -572,23 +615,37 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
572
615
|
id: item === null || item === void 0 ? void 0 : item.itemId,
|
|
573
616
|
item_price: item === null || item === void 0 ? void 0 : item.price
|
|
574
617
|
}))) !== null && _j !== void 0 ? _j : [], image_urls: (_l = (_k = rec === null || rec === void 0 ? void 0 : rec.video) === null || _k === void 0 ? void 0 : _k.imgUrls) !== null && _l !== void 0 ? _l : [], video_urls: (_m = rec === null || rec === void 0 ? void 0 : rec.video) === null || _m === void 0 ? void 0 : _m.url, headline: (0, tool_1.getUrlParamByKey)('headline'), scene: (0, tool_1.getUrlParamByKey)('scene'), campaign_id: (0, tool_1.getUrlParamByKey)('campaign_id'), ad_id: (0, tool_1.getUrlParamByKey)('ad_id'), utm_source: (0, tool_1.getUrlParamByKey)('utm_source'), utm_medium: (0, tool_1.getUrlParamByKey)('utm_medium'), utm_campaign: (0, tool_1.getUrlParamByKey)('utm_campaign'), utm_content: (0, tool_1.getUrlParamByKey)('utm_content') }, props);
|
|
575
|
-
if (!((_o = rec === null || rec === void 0 ? void 0 : rec.video) === null || _o === void 0 ? void 0 : _o.url) &&
|
|
618
|
+
if (!((_o = rec === null || rec === void 0 ? void 0 : rec.video) === null || _o === void 0 ? void 0 : _o.url) &&
|
|
619
|
+
!((_q = (_p = rec === null || rec === void 0 ? void 0 : rec.video) === null || _p === void 0 ? void 0 : _p.imgUrls) === null || _q === void 0 ? void 0 : _q.length) &&
|
|
620
|
+
(rec === null || rec === void 0 ? void 0 : rec.product) &&
|
|
621
|
+
Array.isArray(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.productPost) &&
|
|
622
|
+
((_r = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.productPost) === null || _r === void 0 ? void 0 : _r.length) > 0) {
|
|
576
623
|
const product = rec === null || rec === void 0 ? void 0 : rec.product;
|
|
577
624
|
const productCustomData = {
|
|
578
625
|
content_ids: [product === null || product === void 0 ? void 0 : product.itemId],
|
|
579
626
|
content_type: 'product',
|
|
580
627
|
content_name: '',
|
|
581
|
-
contents: [
|
|
628
|
+
contents: [
|
|
629
|
+
{
|
|
582
630
|
id: product === null || product === void 0 ? void 0 : product.itemId,
|
|
583
631
|
item_price: product === null || product === void 0 ? void 0 : product.price
|
|
584
|
-
}
|
|
632
|
+
}
|
|
633
|
+
],
|
|
585
634
|
image_urls: (_s = product.homePage) !== null && _s !== void 0 ? _s : []
|
|
586
635
|
};
|
|
587
636
|
customData = Object.assign(Object.assign({}, customData), productCustomData);
|
|
588
637
|
}
|
|
589
638
|
if (eventName === 'ContentSwipe' || eventName === 'Engagement' || eventName === 'ExitFeed') {
|
|
590
|
-
const deleteKeys = [
|
|
591
|
-
|
|
639
|
+
const deleteKeys = [
|
|
640
|
+
'content_ids',
|
|
641
|
+
'content_category',
|
|
642
|
+
'currency',
|
|
643
|
+
'contents',
|
|
644
|
+
'image_urls',
|
|
645
|
+
'video_urls',
|
|
646
|
+
'prompt'
|
|
647
|
+
];
|
|
648
|
+
deleteKeys.forEach((key) => {
|
|
592
649
|
if (customData === null || customData === void 0 ? void 0 : customData[key])
|
|
593
650
|
delete customData[key];
|
|
594
651
|
});
|
|
@@ -694,7 +751,9 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
694
751
|
if ((snapchatPixelEventParamsJson === null || snapchatPixelEventParamsJson === void 0 ? void 0 : snapchatPixelEventParamsJson.event_name) && typeof (window === null || window === void 0 ? void 0 : window.snaptr) === 'function') {
|
|
695
752
|
window === null || window === void 0 ? void 0 : window.snaptr('track', snapchatPixelEventParamsJson === null || snapchatPixelEventParamsJson === void 0 ? void 0 : snapchatPixelEventParamsJson.event_name, getEventParamsByJson(Object.assign({ json: snapchatPixelEventParamsJson, eventName }, props)));
|
|
696
753
|
}
|
|
697
|
-
if (eventName === 'PageView' &&
|
|
754
|
+
if (eventName === 'PageView' &&
|
|
755
|
+
typeof (window === null || window === void 0 ? void 0 : window.Northbeam) === 'object' &&
|
|
756
|
+
typeof ((_g = window === null || window === void 0 ? void 0 : window.Northbeam) === null || _g === void 0 ? void 0 : _g.trackPageView) === 'function') {
|
|
698
757
|
(_h = window === null || window === void 0 ? void 0 : window.Northbeam) === null || _h === void 0 ? void 0 : _h.trackPageView();
|
|
699
758
|
}
|
|
700
759
|
const converApiEventParamsJson = (_j = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.converApi) === null || _j === void 0 ? void 0 : _j[eventName];
|
|
@@ -716,37 +775,39 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
716
775
|
}
|
|
717
776
|
}, [bffFetch, enableReportEvent, enabledMetaConversionApi, globalConfig, bffDataSource, getEventParamsByJson]);
|
|
718
777
|
const bffMutateLike = (0, react_1.useCallback)((body) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
778
|
+
body = Object.assign(Object.assign({}, body), { productUserId: fakeUserId });
|
|
719
779
|
const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/recommend/like', { method: 'POST', body }));
|
|
720
780
|
return res === null || res === void 0 ? void 0 : res.success;
|
|
721
|
-
}), [bffFetch]);
|
|
781
|
+
}), [bffFetch, fakeUserId]);
|
|
722
782
|
const bffMutateUnlike = (0, react_1.useCallback)((body) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
783
|
+
body = Object.assign(Object.assign({}, body), { productUserId: fakeUserId });
|
|
723
784
|
const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/recommend/unlike', { method: 'POST', body }));
|
|
724
785
|
return res === null || res === void 0 ? void 0 : res.success;
|
|
725
|
-
}), [bffFetch]);
|
|
786
|
+
}), [bffFetch, fakeUserId]);
|
|
726
787
|
const bffSubmitForm = (0, react_1.useCallback)((body) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
727
788
|
const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/customform', { method: 'POST', body }));
|
|
728
789
|
return res === null || res === void 0 ? void 0 : res.success;
|
|
729
790
|
}), [bffFetch]);
|
|
730
791
|
const bffGetTagList = (0, react_1.useCallback)((data) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
731
|
-
var
|
|
732
|
-
const isShowTag = !!((
|
|
792
|
+
var _8, _9, _10, _11, _12, _13, _14, _15;
|
|
793
|
+
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);
|
|
733
794
|
if (!utmVal || !isShowTag)
|
|
734
795
|
return;
|
|
735
796
|
try {
|
|
736
|
-
const val = (
|
|
797
|
+
const val = (_13 = (_12 = (_11 = (0, tool_1.splitUrlParams)(utmVal)) === null || _11 === void 0 ? void 0 : _11.filter((val) => {
|
|
737
798
|
var _a, _b;
|
|
738
799
|
const key = val.split('=')[0];
|
|
739
800
|
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);
|
|
740
|
-
})) === null ||
|
|
801
|
+
})) === null || _12 === void 0 ? void 0 : _12.join('&')) !== null && _13 !== void 0 ? _13 : '';
|
|
741
802
|
const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/tag/list', { method: 'GET', query: { channel: decodeURIComponent(val) } }));
|
|
742
|
-
setTagList((
|
|
803
|
+
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 : []);
|
|
743
804
|
}
|
|
744
805
|
catch (e) {
|
|
745
806
|
console.log('e', e);
|
|
746
807
|
}
|
|
747
808
|
}), [bffFetch, utmVal]);
|
|
748
809
|
const ctaEvent = (0, react_1.useCallback)((eventInfo, rec, product, position, ctaActionType, targetUrl, contentType) => {
|
|
749
|
-
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;
|
|
810
|
+
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;
|
|
750
811
|
const cta = product === null || product === void 0 ? void 0 : product.bindCta;
|
|
751
812
|
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);
|
|
752
813
|
let fromKName = '';
|
|
@@ -764,7 +825,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
764
825
|
}
|
|
765
826
|
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;
|
|
766
827
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
|
767
|
-
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: (
|
|
828
|
+
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 })
|
|
768
829
|
});
|
|
769
830
|
}, [bffEventReport, isFromHashtag]);
|
|
770
831
|
const h5EnterLink = (0, react_1.useCallback)(() => {
|
|
@@ -788,10 +849,10 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
788
849
|
});
|
|
789
850
|
}, [bffEventReport]);
|
|
790
851
|
const getAccount = (0, react_1.useCallback)(() => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
791
|
-
var
|
|
852
|
+
var _16, _17;
|
|
792
853
|
const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/account', { method: 'GET' }));
|
|
793
|
-
setChatlabsId((
|
|
794
|
-
return ((
|
|
854
|
+
setChatlabsId((_16 = res === null || res === void 0 ? void 0 : res.data) === null || _16 === void 0 ? void 0 : _16.chatLabsId);
|
|
855
|
+
return ((_17 = res === null || res === void 0 ? void 0 : res.data) === null || _17 === void 0 ? void 0 : _17.consentResult) === 'true';
|
|
795
856
|
}), [bffFetch]);
|
|
796
857
|
const accountSonsent = (0, react_1.useCallback)((consentResult) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
797
858
|
const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/account/consent', {
|
|
@@ -855,6 +916,9 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
855
916
|
}
|
|
856
917
|
setRtcList(list);
|
|
857
918
|
setCacheRtcList(list);
|
|
919
|
+
if (isDiyPage) {
|
|
920
|
+
setFirstRtcList(list);
|
|
921
|
+
}
|
|
858
922
|
bffGetTagList(curData !== null && curData !== void 0 ? curData : finalPageData);
|
|
859
923
|
if (channel) {
|
|
860
924
|
const item = list === null || list === void 0 ? void 0 : list[0];
|
|
@@ -874,7 +938,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
874
938
|
});
|
|
875
939
|
setLoading(false);
|
|
876
940
|
});
|
|
877
|
-
}, [isShowConsent, channel]);
|
|
941
|
+
}, [isShowConsent, channel, isDiyPage]);
|
|
878
942
|
(0, react_1.useEffect)(() => {
|
|
879
943
|
if (!isPreview)
|
|
880
944
|
return;
|
|
@@ -889,12 +953,15 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
889
953
|
}
|
|
890
954
|
setRtcList(list);
|
|
891
955
|
setCacheRtcList(list);
|
|
956
|
+
if (isDiyPage) {
|
|
957
|
+
setFirstRtcList(list);
|
|
958
|
+
}
|
|
892
959
|
}
|
|
893
960
|
})
|
|
894
961
|
.finally(() => {
|
|
895
962
|
setLoading(false);
|
|
896
963
|
});
|
|
897
|
-
}, [getRecommendVideos, bffGetTagList, channel]);
|
|
964
|
+
}, [getRecommendVideos, bffGetTagList, channel, isDiyPage]);
|
|
898
965
|
const defaultLoadingImage = (0, useIconLink_1.useIconLink)('/pb_static/a65d23c5893c49d7aaaa81681d3179e2.gif', appDomain);
|
|
899
966
|
return (react_1.default.createElement(exports.SxpDataSourceContext.Provider, { value: {
|
|
900
967
|
rtcList,
|
|
@@ -952,7 +1019,8 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
952
1019
|
refreshFeSession,
|
|
953
1020
|
getAccount,
|
|
954
1021
|
accountSonsent,
|
|
955
|
-
isDiyH5,
|
|
1022
|
+
isDiyH5: isDiyPage,
|
|
1023
|
+
firstRtcList,
|
|
956
1024
|
pixelPvStatusRef
|
|
957
1025
|
} }, isShowConsent ? (react_1.default.createElement(Consent_1.default, Object.assign({}, (_e = (_d = (_c = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.consent) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.item) === null || _e === void 0 ? void 0 : _e.props))) : (render({
|
|
958
1026
|
rtcList,
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useEventReport = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
|
-
const useSxpDataSource_1 = require("./useSxpDataSource");
|
|
6
5
|
const SxpDataSourceProvider_1 = require("../context/SxpDataSourceProvider");
|
|
6
|
+
const useSxpDataSource_1 = require("./useSxpDataSource");
|
|
7
7
|
function useEventReport() {
|
|
8
8
|
const { bffEventReport, popupDetailData, isFromHashtag, eventTimeList, setEventTimeList } = (0, useSxpDataSource_1.useSxpDataSource)();
|
|
9
9
|
const jumpToWeb = (0, react_1.useCallback)((e, 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, _10, _11, _12, _13;
|
|
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, _10, _11, _12, _13, _14, _15, _16;
|
|
11
11
|
const i = eventTimeList === null || eventTimeList === void 0 ? void 0 : eventTimeList.findIndex((item) => item.target === (e === null || e === void 0 ? void 0 : e.target));
|
|
12
12
|
if (i !== -1) {
|
|
13
13
|
return;
|
|
@@ -40,11 +40,11 @@ function useEventReport() {
|
|
|
40
40
|
contentFormat = 'image';
|
|
41
41
|
}
|
|
42
42
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
|
43
|
-
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 : '',
|
|
43
|
+
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 }))
|
|
44
44
|
});
|
|
45
45
|
}, [bffEventReport, popupDetailData, isFromHashtag, eventTimeList]);
|
|
46
46
|
const productView = (0, react_1.useCallback)((data, product, cta, viewTime, position) => {
|
|
47
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
47
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
48
48
|
let fromKName = '';
|
|
49
49
|
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))) {
|
|
50
50
|
fromKName = 'pdpPage';
|
|
@@ -63,8 +63,9 @@ function useEventReport() {
|
|
|
63
63
|
contentTags: JSON.stringify(product === null || product === void 0 ? void 0 : product.tags),
|
|
64
64
|
position: position + '',
|
|
65
65
|
contentId: (_d = data === null || data === void 0 ? void 0 : data.video) === null || _d === void 0 ? void 0 : _d.itemId,
|
|
66
|
+
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 : '',
|
|
66
67
|
ctatId: cta === null || cta === void 0 ? void 0 : cta.itemId,
|
|
67
|
-
traceInfo: (
|
|
68
|
+
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 : '',
|
|
68
69
|
timeOnSite: Math.floor((new Date() - viewTime) / 1000) + '',
|
|
69
70
|
eventSubject: 'productView',
|
|
70
71
|
eventDescription: 'User browsed the product'
|