pb-sxp-ui 1.18.1 → 1.19.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +504 -489
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +15 -7
- package/dist/index.js +504 -489
- package/dist/index.js.map +1 -1
- package/dist/index.min.cjs +6 -6
- package/dist/index.min.cjs.map +1 -1
- package/dist/index.min.js +6 -6
- package/dist/index.min.js.map +1 -1
- package/dist/pb-ui.js +504 -489
- package/dist/pb-ui.js.map +1 -1
- package/dist/pb-ui.min.js +6 -6
- package/dist/pb-ui.min.js.map +1 -1
- package/es/core/components/DiyPortalPreview/VideoWidget.js +8 -10
- package/es/core/components/DiyPortalPreview/index.js +5 -3
- package/es/core/components/DiyStoryPreview/index.js +7 -18
- package/es/core/components/SxpPageRender/LikeButton/index.js +16 -18
- package/es/core/components/SxpPageRender/PictureGroup/index.d.ts +0 -5
- package/es/core/components/SxpPageRender/PictureGroup/index.js +13 -39
- package/es/core/components/SxpPageRender/RenderCard.d.ts +0 -1
- package/es/core/components/SxpPageRender/RenderCard.js +14 -2
- package/es/core/components/SxpPageRender/VideoWidget/index.js +45 -32
- package/es/core/components/SxpPageRender/WaterFall/index.js +3 -4
- package/es/core/components/SxpPageRender/index.d.ts +1 -0
- package/es/core/components/SxpPageRender/index.js +102 -115
- package/es/core/context/SxpDataSourceProvider.d.ts +12 -5
- package/es/core/context/SxpDataSourceProvider.js +128 -94
- package/es/core/hooks/useEventReport.js +5 -6
- package/es/core/utils/tool.d.ts +3 -1
- package/es/core/utils/tool.js +29 -1
- package/es/materials/sxp/consentPopup/Display/index.js +1 -1
- package/es/materials/sxp/cta/AniLinkPopup/material.js +2 -3
- package/es/materials/sxp/popup/CommodityDetail/material.js +1 -2
- package/es/materials/sxp/popup/CommodityList/index.js +4 -5
- package/es/materials/sxp/popup/CommodityList/material.js +1 -1
- package/es/materials/sxp/popup/CommodityList/settingRender.js +1 -1
- package/es/materials/sxp/template/Appoint/material.js +1 -2
- package/es/materials/sxp/template/Commodity/material.js +2 -3
- package/es/materials/sxp/template/CommodityDiro/material.js +2 -3
- package/es/materials/sxp/template/CommodityDiroNew/material.js +2 -4
- package/es/materials/sxp/template/Link/material.js +2 -4
- package/es/materials/sxp/template/MultiCommodity/index.js +2 -2
- package/es/materials/sxp/template/MultiCommodity/material.js +1 -2
- package/es/materials/sxp/template/MultiCommodityDiro/index.js +2 -2
- package/es/materials/sxp/template/MultiCommodityDiro/material.js +2 -3
- package/es/materials/sxp/template/MultiCommodityDiroNew/index.js +2 -2
- package/es/materials/sxp/template/MultiCommodityDiroNew/material.js +2 -4
- package/es/materials/sxp/template/NineCommodity/material.js +2 -3
- package/es/materials/sxp/template/components/CommodityGroup.js +1 -1
- package/es/materials/sxp/template/components/settingRender.js +1 -1
- package/lib/core/components/DiyPortalPreview/VideoWidget.js +8 -10
- package/lib/core/components/DiyPortalPreview/index.js +5 -3
- package/lib/core/components/DiyStoryPreview/index.js +7 -18
- package/lib/core/components/SxpPageRender/LikeButton/index.js +16 -18
- package/lib/core/components/SxpPageRender/PictureGroup/index.d.ts +0 -5
- package/lib/core/components/SxpPageRender/PictureGroup/index.js +12 -38
- package/lib/core/components/SxpPageRender/RenderCard.d.ts +0 -1
- package/lib/core/components/SxpPageRender/RenderCard.js +14 -2
- package/lib/core/components/SxpPageRender/VideoWidget/index.js +45 -32
- package/lib/core/components/SxpPageRender/WaterFall/index.js +3 -4
- package/lib/core/components/SxpPageRender/index.d.ts +1 -0
- package/lib/core/components/SxpPageRender/index.js +102 -115
- package/lib/core/context/SxpDataSourceProvider.d.ts +12 -5
- package/lib/core/context/SxpDataSourceProvider.js +127 -93
- package/lib/core/hooks/useEventReport.js +5 -6
- package/lib/core/utils/tool.d.ts +3 -1
- package/lib/core/utils/tool.js +31 -1
- package/lib/materials/sxp/consentPopup/Display/index.js +1 -1
- package/lib/materials/sxp/cta/AniLinkPopup/material.js +1 -2
- package/lib/materials/sxp/popup/CommodityDetail/material.js +1 -2
- package/lib/materials/sxp/popup/CommodityList/index.js +4 -5
- package/lib/materials/sxp/popup/CommodityList/material.js +1 -1
- package/lib/materials/sxp/popup/CommodityList/settingRender.js +1 -1
- package/lib/materials/sxp/template/Appoint/material.js +1 -2
- package/lib/materials/sxp/template/Commodity/material.js +2 -3
- package/lib/materials/sxp/template/CommodityDiro/material.js +2 -3
- package/lib/materials/sxp/template/CommodityDiroNew/material.js +2 -4
- package/lib/materials/sxp/template/Link/material.js +2 -4
- package/lib/materials/sxp/template/MultiCommodity/index.js +2 -2
- package/lib/materials/sxp/template/MultiCommodity/material.js +1 -2
- package/lib/materials/sxp/template/MultiCommodityDiro/index.js +2 -2
- package/lib/materials/sxp/template/MultiCommodityDiro/material.js +2 -3
- package/lib/materials/sxp/template/MultiCommodityDiroNew/index.js +2 -2
- package/lib/materials/sxp/template/MultiCommodityDiroNew/material.js +2 -4
- package/lib/materials/sxp/template/NineCommodity/material.js +2 -3
- package/lib/materials/sxp/template/components/CommodityGroup.js +1 -1
- package/lib/materials/sxp/template/components/settingRender.js +1 -1
- package/package.json +1 -1
|
@@ -23,7 +23,6 @@ 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)([]);
|
|
27
26
|
const [tagList, setTagList] = (0, react_1.useState)([]);
|
|
28
27
|
const [loading, setLoading] = (0, react_1.useState)(true);
|
|
29
28
|
const [curReqInfo, setCurReqInfo] = (0, react_1.useState)({ rtc: '', requestId: '' });
|
|
@@ -54,10 +53,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
54
53
|
const [chatlabsId, setChatlabsId] = (0, react_1.useState)();
|
|
55
54
|
const finalPageData = (0, react_1.useMemo)(() => pageData !== null && pageData !== void 0 ? pageData : data, [pageData, data]);
|
|
56
55
|
const pixelPvStatusRef = (0, react_1.useRef)(false);
|
|
57
|
-
const
|
|
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
|
+
const fbcRef = (0, react_1.useRef)('');
|
|
61
57
|
const isShowConsent = (0, react_1.useMemo)(() => {
|
|
62
58
|
var _a, _b, _c, _d;
|
|
63
59
|
return (((((_d = (_c = (_b = (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.consent) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.item) === null || _c === void 0 ? void 0 : _c.props) === null || _d === void 0 ? void 0 : _d.privacy_necessity) && !isAgreePolicy && !isEditor) || isOpenConsent) &&
|
|
@@ -113,8 +109,55 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
113
109
|
var _a;
|
|
114
110
|
return ((_a = bffDataSource === null || bffDataSource === void 0 ? void 0 : bffDataSource.headers) === null || _a === void 0 ? void 0 : _a['x-app-id']) + (0, localStore_1.storeAndLoadFeUserId)();
|
|
115
111
|
}, [bffDataSource]);
|
|
112
|
+
(0, react_1.useEffect)(() => {
|
|
113
|
+
if (!(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enableCookieSetting))
|
|
114
|
+
return;
|
|
115
|
+
fbcRef.current = (0, tool_1.getCookie)('_fbc');
|
|
116
|
+
window.OptanonWrapper = function () {
|
|
117
|
+
const activeGroups = window === null || window === void 0 ? void 0 : window.OnetrustActiveGroups;
|
|
118
|
+
if (!activeGroups)
|
|
119
|
+
return;
|
|
120
|
+
if (!(activeGroups === null || activeGroups === void 0 ? void 0 : activeGroups.includes('4'))) {
|
|
121
|
+
(0, tool_1.deleteCookie)('_fbc');
|
|
122
|
+
}
|
|
123
|
+
else if (fbcRef.current) {
|
|
124
|
+
(0, tool_1.setCookie)('_fbc', fbcRef.current, 90);
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
}, [globalConfig]);
|
|
128
|
+
const isActiveTargetingCookie = (0, react_1.useMemo)(() => {
|
|
129
|
+
var _a;
|
|
130
|
+
function isTargetingRejected(cookieValue) {
|
|
131
|
+
const groupsMatch = cookieValue.match(/groups=([^&]+)/);
|
|
132
|
+
if (!groupsMatch || !groupsMatch[1]) {
|
|
133
|
+
return false;
|
|
134
|
+
}
|
|
135
|
+
const groupsString = groupsMatch[1];
|
|
136
|
+
const groupsPairs = groupsString.split(',');
|
|
137
|
+
for (const pair of groupsPairs) {
|
|
138
|
+
const [category, status] = pair.split(':');
|
|
139
|
+
if (category === '4') {
|
|
140
|
+
return status === '0';
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
return false;
|
|
144
|
+
}
|
|
145
|
+
function getCookie(name) {
|
|
146
|
+
var _a;
|
|
147
|
+
const value = `; ${document.cookie}`;
|
|
148
|
+
const parts = value.split(`; ${name}=`);
|
|
149
|
+
if (parts.length === 2)
|
|
150
|
+
return (_a = parts.pop()) === null || _a === void 0 ? void 0 : _a.split(';').shift();
|
|
151
|
+
return '';
|
|
152
|
+
}
|
|
153
|
+
const OptanonConsent = decodeURIComponent((_a = getCookie('OptanonConsent')) !== null && _a !== void 0 ? _a : '');
|
|
154
|
+
if (((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enableCookieSetting) && (window === null || window === void 0 ? void 0 : window.OnetrustActiveGroups) && !(window === null || window === void 0 ? void 0 : window.OnetrustActiveGroups.includes('4')))) {
|
|
155
|
+
return true;
|
|
156
|
+
}
|
|
157
|
+
return false;
|
|
158
|
+
}, [globalConfig]);
|
|
116
159
|
const bffFetch = (0, react_1.useCallback)((path, options, isBota = true) => {
|
|
117
|
-
var _a
|
|
160
|
+
var _a;
|
|
118
161
|
if (!bffDataSource)
|
|
119
162
|
return;
|
|
120
163
|
const url = bffDataSource.url;
|
|
@@ -129,9 +172,8 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
129
172
|
const value = val.split('=')[1];
|
|
130
173
|
params[key] = value;
|
|
131
174
|
});
|
|
132
|
-
options.body = Object.assign(Object.assign({}, options.body), { productUserId: fakeUserId });
|
|
133
175
|
return window
|
|
134
|
-
.fetch(`${url}/api/${path}`, Object.assign({ headers: Object.assign({ 'Content-Type': 'application/json', 'x-user-id': fakeUserId
|
|
176
|
+
.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
|
|
135
177
|
? JSON.stringify({
|
|
136
178
|
body: btoa(encodeURIComponent(JSON.stringify(Object.assign(Object.assign(Object.assign({}, options.body), bffDataSource.headers), { 'x-user-id': fakeUserId }))))
|
|
137
179
|
})
|
|
@@ -141,6 +183,8 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
141
183
|
}, [bffDataSource, fakeUserId]);
|
|
142
184
|
const bffCollectEvent = (0, react_1.useCallback)((params) => {
|
|
143
185
|
var _a;
|
|
186
|
+
if (isActiveTargetingCookie)
|
|
187
|
+
return Promise.resolve();
|
|
144
188
|
const body = {
|
|
145
189
|
eventName: params === null || params === void 0 ? void 0 : params.eventName,
|
|
146
190
|
eventSource: params === null || params === void 0 ? void 0 : params.eventSource
|
|
@@ -150,34 +194,35 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
150
194
|
body,
|
|
151
195
|
type: 'beacon'
|
|
152
196
|
}, false);
|
|
153
|
-
}, [bffFetch, bffDataSource]);
|
|
197
|
+
}, [bffFetch, bffDataSource, isActiveTargetingCookie]);
|
|
154
198
|
(0, react_1.useEffect)(() => {
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
if (value.includes('https://www.facebook.com/privacy_sandbox/pixel/register/trigger/')) {
|
|
164
|
-
const url = new URL(value);
|
|
165
|
-
const params = Object.fromEntries(url.searchParams.entries());
|
|
166
|
-
bffCollectEvent({
|
|
167
|
-
eventName: params === null || params === void 0 ? void 0 : params.ev,
|
|
168
|
-
eventSource: 'Meta Pixel'
|
|
169
|
-
});
|
|
170
|
-
}
|
|
171
|
-
;
|
|
172
|
-
},
|
|
173
|
-
get() {
|
|
174
|
-
return originalSrcDescriptor.get.call(this);
|
|
199
|
+
const OriginalImage = window.Image;
|
|
200
|
+
window.Image = function () {
|
|
201
|
+
const img = new OriginalImage();
|
|
202
|
+
const originalSrcDescriptor = Object.getOwnPropertyDescriptor(HTMLImageElement.prototype, 'src');
|
|
203
|
+
Object.defineProperty(img, 'src', {
|
|
204
|
+
set(value) {
|
|
205
|
+
if (isActiveTargetingCookie && (value.includes('https://www.facebook.com/privacy_sandbox/pixel/register/trigger/') || value.includes('https://www.facebook.com/tr'))) {
|
|
206
|
+
return;
|
|
175
207
|
}
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
208
|
+
originalSrcDescriptor.set.call(this, value);
|
|
209
|
+
if (value.includes('https://www.facebook.com/privacy_sandbox/pixel/register/trigger/')) {
|
|
210
|
+
const url = new URL(value);
|
|
211
|
+
const params = Object.fromEntries(url.searchParams.entries());
|
|
212
|
+
bffCollectEvent({
|
|
213
|
+
eventName: params === null || params === void 0 ? void 0 : params.ev,
|
|
214
|
+
eventSource: 'Meta Pixel'
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
;
|
|
218
|
+
},
|
|
219
|
+
get() {
|
|
220
|
+
return originalSrcDescriptor.get.call(this);
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
return img;
|
|
224
|
+
};
|
|
225
|
+
}, [bffCollectEvent, isActiveTargetingCookie]);
|
|
181
226
|
(0, react_1.useEffect)(() => {
|
|
182
227
|
const navigatorWithBeacon = navigator;
|
|
183
228
|
if (!navigatorWithBeacon.sendBeacon) {
|
|
@@ -187,6 +232,9 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
187
232
|
const originalSendBeacon = navigatorWithBeacon.sendBeacon.bind(navigatorWithBeacon);
|
|
188
233
|
navigatorWithBeacon.sendBeacon = function (url, data) {
|
|
189
234
|
const urlString = url instanceof URL ? url.href : url.toString();
|
|
235
|
+
if (isActiveTargetingCookie && (urlString.includes('https://tr.snapchat.com/p') || urlString.includes('https://analytics.tiktok.com/api/v2/pixel'))) {
|
|
236
|
+
return true;
|
|
237
|
+
}
|
|
190
238
|
const success = originalSendBeacon(url, data);
|
|
191
239
|
function parseBeaconData(data) {
|
|
192
240
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
@@ -232,7 +280,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
232
280
|
return () => {
|
|
233
281
|
navigatorWithBeacon.sendBeacon = originalSendBeacon;
|
|
234
282
|
};
|
|
235
|
-
}, [bffCollectEvent]);
|
|
283
|
+
}, [bffCollectEvent, isActiveTargetingCookie]);
|
|
236
284
|
(0, react_1.useEffect)(() => {
|
|
237
285
|
const _originalFetch = window.fetch;
|
|
238
286
|
window.fetch = function (input, init) {
|
|
@@ -252,6 +300,9 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
252
300
|
return _originalFetch.apply(this, arguments_1);
|
|
253
301
|
}
|
|
254
302
|
try {
|
|
303
|
+
if (isActiveTargetingCookie && (url.includes('https://www.google-analytics.com/g/collect') || url.includes('https://arms-retcode.aliyuncs.com/r.png'))) {
|
|
304
|
+
return Promise.resolve(new Response(''));
|
|
305
|
+
}
|
|
255
306
|
const response = _originalFetch.apply(this, arguments_1);
|
|
256
307
|
if (url.includes('https://www.google-analytics.com/g/collect')) {
|
|
257
308
|
const urlObj = new URL(url);
|
|
@@ -293,7 +344,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
293
344
|
}
|
|
294
345
|
});
|
|
295
346
|
};
|
|
296
|
-
}, [bffCollectEvent]);
|
|
347
|
+
}, [bffCollectEvent, isActiveTargetingCookie]);
|
|
297
348
|
(0, react_1.useEffect)(() => {
|
|
298
349
|
const originalOpen = XMLHttpRequest.prototype.open;
|
|
299
350
|
const originalSend = XMLHttpRequest.prototype.send;
|
|
@@ -303,6 +354,9 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
303
354
|
};
|
|
304
355
|
XMLHttpRequest.prototype.send = function (body) {
|
|
305
356
|
var _a;
|
|
357
|
+
if (isActiveTargetingCookie && this._url && typeof this._url === 'string' && (this._url.includes('https://rumcollector.uptime.com') || this._url.includes('https://arms-retcode.aliyuncs.com/r.png') || this._url.includes('https://i.giesswein.com/nb-collector'))) {
|
|
358
|
+
return;
|
|
359
|
+
}
|
|
306
360
|
if (this._url && typeof this._url === 'string' && this._url.includes('https://i.giesswein.com/nb-collector')) {
|
|
307
361
|
if (body && typeof body === 'string') {
|
|
308
362
|
try {
|
|
@@ -328,7 +382,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
328
382
|
XMLHttpRequest.prototype.open = originalOpen;
|
|
329
383
|
XMLHttpRequest.prototype.send = originalSend;
|
|
330
384
|
};
|
|
331
|
-
}, [bffCollectEvent]);
|
|
385
|
+
}, [bffCollectEvent, isActiveTargetingCookie]);
|
|
332
386
|
(0, react_1.useEffect)(() => {
|
|
333
387
|
if (typeof (window === null || window === void 0 ? void 0 : window.fbq) === 'function') {
|
|
334
388
|
window === null || window === void 0 ? void 0 : window.fbq('track', 'PageView');
|
|
@@ -352,8 +406,8 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
352
406
|
.catch((err) => Promise.reject(err));
|
|
353
407
|
}, [bffDataSource]);
|
|
354
408
|
const getRecommendVideos = (0, react_1.useCallback)((query) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
355
|
-
var _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u
|
|
356
|
-
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 })), (
|
|
409
|
+
var _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
|
410
|
+
query = Object.assign(Object.assign({ maxSize: (_f = query === null || query === void 0 ? void 0 : query.maxSize) !== null && _f !== void 0 ? _f : maxSize, defaultSize: (_g = query === null || query === void 0 ? void 0 : query.defaultSize) !== null && _g !== void 0 ? _g : defaultSize, hashTag: query === null || query === void 0 ? void 0 : query.hashTag, traceInfo: query === null || query === void 0 ? void 0 : query.traceInfo, themeTag: query === null || query === void 0 ? void 0 : query.themeTag, pageNum: query === null || query === void 0 ? void 0 : query.pageNum, contentFilter: query === null || query === void 0 ? void 0 : query.contentFilter, productFilter: query === null || query === void 0 ? void 0 : query.productFilter }, (chatlabsId && { chatlabsId })), (isDiyH5 && { type: 'story' }));
|
|
357
411
|
if (channel) {
|
|
358
412
|
query = Object.assign(Object.assign({}, query), { channel: decodeURIComponent(channel) });
|
|
359
413
|
}
|
|
@@ -366,10 +420,9 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
366
420
|
if (val)
|
|
367
421
|
query = Object.assign(Object.assign({}, query), { channel: decodeURIComponent(val) });
|
|
368
422
|
}
|
|
369
|
-
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);
|
|
370
423
|
if (isEditor) {
|
|
371
424
|
let pageNum = 1;
|
|
372
|
-
query = Object.assign(Object.assign(Object.assign(
|
|
425
|
+
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] }));
|
|
373
426
|
if (!(query === null || query === void 0 ? void 0 : query.channel) || isInit.current) {
|
|
374
427
|
return undefined;
|
|
375
428
|
}
|
|
@@ -377,22 +430,19 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
377
430
|
let list = [];
|
|
378
431
|
let result = null;
|
|
379
432
|
const recurveRecList = (query) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
380
|
-
var
|
|
433
|
+
var _v, _w, _x, _y, _z, _0;
|
|
381
434
|
query.pageNum = pageNum;
|
|
382
|
-
result =
|
|
435
|
+
result = yield (bffFetchAdmin === null || bffFetchAdmin === void 0 ? void 0 : bffFetchAdmin('recommend/direct_page', { method: 'POST', body: query }));
|
|
383
436
|
if (!(result === null || result === void 0 ? void 0 : result.success)) {
|
|
384
437
|
return undefined;
|
|
385
438
|
}
|
|
386
439
|
setLoading(false);
|
|
387
|
-
list = list.concat((
|
|
440
|
+
list = list.concat((_y = (_x = (_w = (_v = result === null || result === void 0 ? void 0 : result.data) === null || _v === void 0 ? void 0 : _v.recList) === null || _w === void 0 ? void 0 : _w.filter) === null || _x === void 0 ? void 0 : _x.call(_w, (item) => (item === null || item === void 0 ? void 0 : item.product) || (item === null || item === void 0 ? void 0 : item.video))) !== null && _y !== void 0 ? _y : []);
|
|
388
441
|
if ((rtcList === null || rtcList === void 0 ? void 0 : rtcList.length) === 0) {
|
|
389
442
|
setRtcList(getFilterRecList(Object.assign(Object.assign({}, result === null || result === void 0 ? void 0 : result.data), { recList: list })));
|
|
390
443
|
setCacheRtcList(getFilterRecList(Object.assign(Object.assign({}, result === null || result === void 0 ? void 0 : result.data), { recList: list })));
|
|
391
|
-
if (isDiyPage) {
|
|
392
|
-
setFirstRtcList(getFilterRecList(Object.assign(Object.assign({}, result === null || result === void 0 ? void 0 : result.data), { recList: list })));
|
|
393
|
-
}
|
|
394
444
|
}
|
|
395
|
-
const isNotNullList = (
|
|
445
|
+
const isNotNullList = (_0 = (_z = result === null || result === void 0 ? void 0 : result.data) === null || _z === void 0 ? void 0 : _z.recList) === null || _0 === void 0 ? void 0 : _0.some((item) => (item === null || item === void 0 ? void 0 : item.product) || (item === null || item === void 0 ? void 0 : item.video));
|
|
396
446
|
if (isNotNullList) {
|
|
397
447
|
pageNum = pageNum + 1;
|
|
398
448
|
yield recurveRecList(query);
|
|
@@ -400,13 +450,13 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
400
450
|
});
|
|
401
451
|
yield recurveRecList(query);
|
|
402
452
|
if (!(query === null || query === void 0 ? void 0 : query.hashTag) && result)
|
|
403
|
-
setCurReqInfo({ rtc: (
|
|
453
|
+
setCurReqInfo({ rtc: (_l = result === null || result === void 0 ? void 0 : result.data) === null || _l === void 0 ? void 0 : _l.rtc, requestId: (_m = result === null || result === void 0 ? void 0 : result.data) === null || _m === void 0 ? void 0 : _m.requestId });
|
|
404
454
|
return Object.assign(Object.assign({}, result === null || result === void 0 ? void 0 : result.data), { recList: list });
|
|
405
455
|
}
|
|
406
456
|
if (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview) {
|
|
407
|
-
query = Object.assign(Object.assign(
|
|
457
|
+
query = Object.assign(Object.assign({}, query), { directPage: true, level: 1, pageNum: (_o = query === null || query === void 0 ? void 0 : query.pageNum) !== null && _o !== void 0 ? _o : 1 });
|
|
408
458
|
}
|
|
409
|
-
const result =
|
|
459
|
+
const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/recommend/list', {
|
|
410
460
|
method: 'POST',
|
|
411
461
|
body: query
|
|
412
462
|
}));
|
|
@@ -416,31 +466,26 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
416
466
|
if (!(query === null || query === void 0 ? void 0 : query.hashTag))
|
|
417
467
|
setCurReqInfo({ rtc: result.data.rtc, requestId: result.data.requestId });
|
|
418
468
|
if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview) && !isEditor) {
|
|
419
|
-
const isNotNullList = (
|
|
469
|
+
const isNotNullList = (_q = (_p = result === null || result === void 0 ? void 0 : result.data) === null || _p === void 0 ? void 0 : _p.recList) === null || _q === void 0 ? void 0 : _q.some((item) => (item === null || item === void 0 ? void 0 : item.product) || (item === null || item === void 0 ? void 0 : item.video));
|
|
420
470
|
if (!isNotNullList) {
|
|
421
471
|
setIsNoMoreData(true);
|
|
422
472
|
}
|
|
423
473
|
}
|
|
424
474
|
let list = [];
|
|
425
|
-
list = list.concat((
|
|
475
|
+
list = list.concat((_u = (_t = (_s = (_r = result === null || result === void 0 ? void 0 : result.data) === null || _r === void 0 ? void 0 : _r.recList) === null || _s === void 0 ? void 0 : _s.filter) === null || _t === void 0 ? void 0 : _t.call(_s, (item) => (item === null || item === void 0 ? void 0 : item.product) || (item === null || item === void 0 ? void 0 : item.video))) !== null && _u !== void 0 ? _u : []);
|
|
426
476
|
return Object.assign(Object.assign({}, result.data), { recList: list });
|
|
427
|
-
}), [bffFetch, utmVal, maxSize, defaultSize, channelQueryList, channel, chatlabsId, bffFetchAdmin
|
|
477
|
+
}), [bffFetch, utmVal, maxSize, defaultSize, channelQueryList, channel, chatlabsId, bffFetchAdmin]);
|
|
428
478
|
const loadVideos = (0, react_1.useCallback)((pageNum) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
429
|
-
var
|
|
479
|
+
var _1, _2, _3, _4;
|
|
430
480
|
if (rtcList.length <= 0) {
|
|
431
481
|
return;
|
|
432
482
|
}
|
|
433
|
-
if (isDiyPage && (firstRtcList === null || firstRtcList === void 0 ? void 0 : firstRtcList.length) > 0) {
|
|
434
|
-
setRtcList(rtcList.concat(firstRtcList));
|
|
435
|
-
setCacheRtcList(cacheRtcList.concat(firstRtcList));
|
|
436
|
-
return;
|
|
437
|
-
}
|
|
438
483
|
const lastItem = rtcList === null || rtcList === void 0 ? void 0 : rtcList[(rtcList === null || rtcList === void 0 ? void 0 : rtcList.length) - 1];
|
|
439
|
-
const data = yield getRecommendVideos(Object.assign(Object.assign(Object.assign(Object.assign({ hashTag: waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.hashTag }, (((
|
|
484
|
+
const data = yield getRecommendVideos(Object.assign(Object.assign(Object.assign(Object.assign({ hashTag: waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.hashTag }, (((_1 = lastItem === null || lastItem === void 0 ? void 0 : lastItem.product) === null || _1 === void 0 ? void 0 : _1.itemId) && { productFilter: [(_2 = lastItem === null || lastItem === void 0 ? void 0 : lastItem.product) === null || _2 === void 0 ? void 0 : _2.itemId] })), (((_3 = lastItem === null || lastItem === void 0 ? void 0 : lastItem.video) === null || _3 === void 0 ? void 0 : _3.itemId) && { contentFilter: [(_4 = lastItem === null || lastItem === void 0 ? void 0 : lastItem.video) === null || _4 === void 0 ? void 0 : _4.itemId] })), { themeTag: themeTag.current }), ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview) && !isEditor && { pageNum })));
|
|
440
485
|
setRtcList(rtcList.concat(getFilterRecList(data)));
|
|
441
486
|
setCacheRtcList(cacheRtcList.concat(getFilterRecList(data)));
|
|
442
487
|
return data;
|
|
443
|
-
}), [getRecommendVideos, rtcList, waterFallData, cacheRtcList
|
|
488
|
+
}), [getRecommendVideos, rtcList, waterFallData, cacheRtcList]);
|
|
444
489
|
const refreshFeSession = (0, react_1.useCallback)((enableReSid, event) => {
|
|
445
490
|
var _a, _b, _c, _d, _e;
|
|
446
491
|
let expire = false;
|
|
@@ -464,13 +509,11 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
464
509
|
}, [data]);
|
|
465
510
|
const bffEventReport = (0, react_1.useCallback)(({ userInfo, eventInfo, reportLayId = true }) => {
|
|
466
511
|
var _a, _b;
|
|
467
|
-
if (!enableReportEvent || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview)) {
|
|
512
|
+
if (!enableReportEvent || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview) || isActiveTargetingCookie) {
|
|
468
513
|
return;
|
|
469
514
|
}
|
|
470
515
|
if (!userInfo) {
|
|
471
|
-
userInfo = {
|
|
472
|
-
productUserId: fakeUserId
|
|
473
|
-
};
|
|
516
|
+
userInfo = {};
|
|
474
517
|
}
|
|
475
518
|
const sessionID = (0, sessionStore_1.storeAndLoadFeSessionId)();
|
|
476
519
|
const params = {};
|
|
@@ -504,7 +547,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
504
547
|
globalConfig,
|
|
505
548
|
playbookType,
|
|
506
549
|
bffDataSource,
|
|
507
|
-
|
|
550
|
+
isActiveTargetingCookie
|
|
508
551
|
]);
|
|
509
552
|
const getEventParamsByJson = (0, react_1.useCallback)((json, product) => {
|
|
510
553
|
var _a, _b, _c;
|
|
@@ -569,7 +612,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
569
612
|
}, [fakeUserId]);
|
|
570
613
|
const bffFbReport = (0, react_1.useCallback)(({ eventName, product }) => {
|
|
571
614
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
572
|
-
if (!enableReportEvent || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview)) {
|
|
615
|
+
if (!enableReportEvent || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview) || isActiveTargetingCookie) {
|
|
573
616
|
return;
|
|
574
617
|
}
|
|
575
618
|
let isPushState = false;
|
|
@@ -635,41 +678,39 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
635
678
|
type: 'beacon'
|
|
636
679
|
});
|
|
637
680
|
}
|
|
638
|
-
}, [bffFetch, enableReportEvent, enabledMetaConversionApi, globalConfig, bffDataSource, getEventParamsByJson]);
|
|
681
|
+
}, [bffFetch, enableReportEvent, enabledMetaConversionApi, globalConfig, bffDataSource, getEventParamsByJson, isActiveTargetingCookie]);
|
|
639
682
|
const bffMutateLike = (0, react_1.useCallback)((body) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
640
|
-
body = Object.assign(Object.assign({}, body), { productUserId: fakeUserId });
|
|
641
683
|
const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/recommend/like', { method: 'POST', body }));
|
|
642
684
|
return res === null || res === void 0 ? void 0 : res.success;
|
|
643
|
-
}), [bffFetch
|
|
685
|
+
}), [bffFetch]);
|
|
644
686
|
const bffMutateUnlike = (0, react_1.useCallback)((body) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
645
|
-
body = Object.assign(Object.assign({}, body), { productUserId: fakeUserId });
|
|
646
687
|
const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/recommend/unlike', { method: 'POST', body }));
|
|
647
688
|
return res === null || res === void 0 ? void 0 : res.success;
|
|
648
|
-
}), [bffFetch
|
|
689
|
+
}), [bffFetch]);
|
|
649
690
|
const bffSubmitForm = (0, react_1.useCallback)((body) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
650
691
|
const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/customform', { method: 'POST', body }));
|
|
651
692
|
return res === null || res === void 0 ? void 0 : res.success;
|
|
652
693
|
}), [bffFetch]);
|
|
653
694
|
const bffGetTagList = (0, react_1.useCallback)((data) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
654
|
-
var
|
|
655
|
-
const isShowTag = !!((
|
|
695
|
+
var _5, _6, _7, _8, _9, _10, _11, _12;
|
|
696
|
+
const isShowTag = !!((_7 = (_6 = (_5 = data === null || data === void 0 ? void 0 : data.data) === null || _5 === void 0 ? void 0 : _5.sxpPageConf) === null || _6 === void 0 ? void 0 : _6.globalConfig) === null || _7 === void 0 ? void 0 : _7.isShowTag);
|
|
656
697
|
if (!utmVal || !isShowTag)
|
|
657
698
|
return;
|
|
658
699
|
try {
|
|
659
|
-
const val = (
|
|
700
|
+
const val = (_10 = (_9 = (_8 = (0, tool_1.splitUrlParams)(utmVal)) === null || _8 === void 0 ? void 0 : _8.filter((val) => {
|
|
660
701
|
var _a, _b;
|
|
661
702
|
const key = val.split('=')[0];
|
|
662
703
|
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);
|
|
663
|
-
})) === null ||
|
|
704
|
+
})) === null || _9 === void 0 ? void 0 : _9.join('&')) !== null && _10 !== void 0 ? _10 : '';
|
|
664
705
|
const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/tag/list', { method: 'GET', query: { channel: decodeURIComponent(val) } }));
|
|
665
|
-
setTagList((
|
|
706
|
+
setTagList((_12 = (_11 = result === null || result === void 0 ? void 0 : result.data) === null || _11 === void 0 ? void 0 : _11.tags) !== null && _12 !== void 0 ? _12 : []);
|
|
666
707
|
}
|
|
667
708
|
catch (e) {
|
|
668
709
|
console.log('e', e);
|
|
669
710
|
}
|
|
670
711
|
}), [bffFetch, utmVal]);
|
|
671
712
|
const ctaEvent = (0, react_1.useCallback)((eventInfo, rec, product, position) => {
|
|
672
|
-
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
|
|
713
|
+
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;
|
|
673
714
|
const cta = product === null || product === void 0 ? void 0 : product.bindCta;
|
|
674
715
|
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);
|
|
675
716
|
let fromKName = '';
|
|
@@ -687,7 +728,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
687
728
|
}
|
|
688
729
|
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;
|
|
689
730
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
|
690
|
-
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 : '',
|
|
731
|
+
eventInfo: Object.assign(Object.assign({}, eventInfo), { ctaId: (_r = cta === null || cta === void 0 ? void 0 : cta.itemId) !== null && _r !== void 0 ? _r : '', ctaName: (_s = cta === null || cta === void 0 ? void 0 : cta.title) !== null && _s !== void 0 ? _s : '', contentTags: contentTags ? JSON.stringify(contentTags) : '', position: position + '', contentId: (_u = (_t = rec === null || rec === void 0 ? void 0 : rec.video) === null || _t === void 0 ? void 0 : _t.itemId) !== null && _u !== void 0 ? _u : '', productId: isProd ? product === null || product === void 0 ? void 0 : product.itemId : '', traceInfo: (_10 = (_7 = (_2 = (_y = (_v = cta === null || cta === void 0 ? void 0 : cta.traceInfo) !== null && _v !== void 0 ? _v : (_x = (_w = rec === null || rec === void 0 ? void 0 : rec.video) === null || _w === void 0 ? void 0 : _w.bindCta) === null || _x === void 0 ? void 0 : _x.traceInfo) !== null && _y !== void 0 ? _y : (_1 = (_0 = (_z = rec === null || rec === void 0 ? void 0 : rec.video) === null || _z === void 0 ? void 0 : _z.bindProduct) === null || _0 === void 0 ? void 0 : _0.bindCta) === null || _1 === void 0 ? void 0 : _1.traceInfo) !== null && _2 !== void 0 ? _2 : (_6 = (_5 = (_4 = (_3 = rec === null || rec === void 0 ? void 0 : rec.video) === null || _3 === void 0 ? void 0 : _3.bindProducts) === null || _4 === void 0 ? void 0 : _4[0]) === null || _5 === void 0 ? void 0 : _5.bindCta) === null || _6 === void 0 ? void 0 : _6.traceInfo) !== null && _7 !== void 0 ? _7 : (_9 = (_8 = rec === null || rec === void 0 ? void 0 : rec.product) === null || _8 === void 0 ? void 0 : _8.bindCta) === null || _9 === void 0 ? void 0 : _9.traceInfo) !== null && _10 !== void 0 ? _10 : '', fromKName, fromKPage: (_11 = location === null || location === void 0 ? void 0 : location.href) !== null && _11 !== void 0 ? _11 : '', contentFormat })
|
|
691
732
|
});
|
|
692
733
|
}, [bffEventReport, isFromHashtag]);
|
|
693
734
|
const h5EnterLink = (0, react_1.useCallback)(() => {
|
|
@@ -722,10 +763,10 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
722
763
|
});
|
|
723
764
|
}, [bffEventReport]);
|
|
724
765
|
const getAccount = (0, react_1.useCallback)(() => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
725
|
-
var
|
|
766
|
+
var _13, _14;
|
|
726
767
|
const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/account', { method: 'GET' }));
|
|
727
|
-
setChatlabsId((
|
|
728
|
-
return ((
|
|
768
|
+
setChatlabsId((_13 = res === null || res === void 0 ? void 0 : res.data) === null || _13 === void 0 ? void 0 : _13.chatLabsId);
|
|
769
|
+
return ((_14 = res === null || res === void 0 ? void 0 : res.data) === null || _14 === void 0 ? void 0 : _14.consentResult) === 'true';
|
|
729
770
|
}), [bffFetch]);
|
|
730
771
|
const accountSonsent = (0, react_1.useCallback)((consentResult) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
731
772
|
const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/account/consent', {
|
|
@@ -789,9 +830,6 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
789
830
|
}
|
|
790
831
|
setRtcList(list);
|
|
791
832
|
setCacheRtcList(list);
|
|
792
|
-
if (isDiyPage) {
|
|
793
|
-
setFirstRtcList(list);
|
|
794
|
-
}
|
|
795
833
|
bffGetTagList(curData !== null && curData !== void 0 ? curData : finalPageData);
|
|
796
834
|
if (channel) {
|
|
797
835
|
const item = list === null || list === void 0 ? void 0 : list[0];
|
|
@@ -811,7 +849,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
811
849
|
});
|
|
812
850
|
setLoading(false);
|
|
813
851
|
});
|
|
814
|
-
}, [isShowConsent, channel
|
|
852
|
+
}, [isShowConsent, channel]);
|
|
815
853
|
(0, react_1.useEffect)(() => {
|
|
816
854
|
if (!isPreview)
|
|
817
855
|
return;
|
|
@@ -826,15 +864,12 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
826
864
|
}
|
|
827
865
|
setRtcList(list);
|
|
828
866
|
setCacheRtcList(list);
|
|
829
|
-
if (isDiyPage) {
|
|
830
|
-
setFirstRtcList(list);
|
|
831
|
-
}
|
|
832
867
|
}
|
|
833
868
|
})
|
|
834
869
|
.finally(() => {
|
|
835
870
|
setLoading(false);
|
|
836
871
|
});
|
|
837
|
-
}, [getRecommendVideos, bffGetTagList, channel
|
|
872
|
+
}, [getRecommendVideos, bffGetTagList, channel]);
|
|
838
873
|
const defaultLoadingImage = (0, useIconLink_1.useIconLink)('/pb_static/a65d23c5893c49d7aaaa81681d3179e2.gif', appDomain);
|
|
839
874
|
return (react_1.default.createElement(exports.SxpDataSourceContext.Provider, { value: {
|
|
840
875
|
rtcList,
|
|
@@ -892,8 +927,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
892
927
|
refreshFeSession,
|
|
893
928
|
getAccount,
|
|
894
929
|
accountSonsent,
|
|
895
|
-
isDiyH5
|
|
896
|
-
firstRtcList
|
|
930
|
+
isDiyH5
|
|
897
931
|
} }, 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({
|
|
898
932
|
rtcList,
|
|
899
933
|
mutateLike: bffMutateLike,
|
|
@@ -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 SxpDataSourceProvider_1 = require("../context/SxpDataSourceProvider");
|
|
6
5
|
const useSxpDataSource_1 = require("./useSxpDataSource");
|
|
6
|
+
const SxpDataSourceProvider_1 = require("../context/SxpDataSourceProvider");
|
|
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;
|
|
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 : '', ctatId: (_0 = cta === null || cta === void 0 ? void 0 : cta.itemId) !== null && _0 !== void 0 ? _0 : '', traceInfo: (_13 = (_10 = (_8 = (_4 = (_1 = traceInfo !== null && traceInfo !== void 0 ? traceInfo : product === null || product === void 0 ? void 0 : product.traceInfo) !== null && _1 !== void 0 ? _1 : (_3 = (_2 = data === null || data === void 0 ? void 0 : data.video) === null || _2 === void 0 ? void 0 : _2.bindProduct) === null || _3 === void 0 ? void 0 : _3.traceInfo) !== null && _4 !== void 0 ? _4 : (_7 = (_6 = (_5 = data === null || data === void 0 ? void 0 : data.video) === null || _5 === void 0 ? void 0 : _5.bindProducts) === null || _6 === void 0 ? void 0 : _6[0]) === null || _7 === void 0 ? void 0 : _7.traceInfo) !== null && _8 !== void 0 ? _8 : (_9 = data === null || data === void 0 ? void 0 : data.product) === null || _9 === void 0 ? void 0 : _9.traceInfo) !== null && _10 !== void 0 ? _10 : (_12 = (_11 = data === null || data === void 0 ? void 0 : data.video) === null || _11 === void 0 ? void 0 : _11.bindCta) === null || _12 === void 0 ? void 0 : _12.traceInfo) !== null && _13 !== void 0 ? _13 : '' }, (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;
|
|
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,9 +63,8 @@ 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 : '',
|
|
67
66
|
ctatId: cta === null || cta === void 0 ? void 0 : cta.itemId,
|
|
68
|
-
traceInfo: (
|
|
67
|
+
traceInfo: (_p = (_m = (_h = (_e = product === null || product === void 0 ? void 0 : product.traceInfo) !== null && _e !== void 0 ? _e : (_g = (_f = data === null || data === void 0 ? void 0 : data.video) === null || _f === void 0 ? void 0 : _f.bindProduct) === null || _g === void 0 ? void 0 : _g.traceInfo) !== null && _h !== void 0 ? _h : (_l = (_k = (_j = data === null || data === void 0 ? void 0 : data.video) === null || _j === void 0 ? void 0 : _j.bindProducts) === null || _k === void 0 ? void 0 : _k[0]) === null || _l === void 0 ? void 0 : _l.traceInfo) !== null && _m !== void 0 ? _m : (_o = data === null || data === void 0 ? void 0 : data.product) === null || _o === void 0 ? void 0 : _o.traceInfo) !== null && _p !== void 0 ? _p : '',
|
|
69
68
|
timeOnSite: Math.floor((new Date() - viewTime) / 1000) + '',
|
|
70
69
|
eventSubject: 'productView',
|
|
71
70
|
eventDescription: 'User browsed the product'
|
package/lib/core/utils/tool.d.ts
CHANGED
|
@@ -13,4 +13,6 @@ declare function getDevice(): string | null;
|
|
|
13
13
|
declare function getCookie(val: string): string;
|
|
14
14
|
declare function getScreenReader(): boolean;
|
|
15
15
|
declare function splitUrlParams(urlParams: string): string[] | undefined;
|
|
16
|
-
|
|
16
|
+
declare function deleteCookie(name: string, path?: string, domain?: string): void;
|
|
17
|
+
declare function setCookie(name: string, value: string, days?: number, path?: string, domain?: string, secure?: boolean, sameSite?: string): void;
|
|
18
|
+
export { uuid, getIndexByblockType, getBrowserInfo, getDevice, getSystem, getCookie, getScreenReader, splitUrlParams, deleteCookie, setCookie };
|
package/lib/core/utils/tool.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.splitUrlParams = exports.getScreenReader = exports.getCookie = exports.getSystem = exports.getDevice = exports.getBrowserInfo = exports.getIndexByblockType = exports.uuid = exports.setFontForText = exports.getUid = exports.generateRandomString = void 0;
|
|
3
|
+
exports.setCookie = exports.deleteCookie = exports.splitUrlParams = exports.getScreenReader = exports.getCookie = exports.getSystem = exports.getDevice = exports.getBrowserInfo = exports.getIndexByblockType = exports.uuid = exports.setFontForText = exports.getUid = exports.generateRandomString = void 0;
|
|
4
4
|
const uuid_1 = require("uuid");
|
|
5
5
|
function uuid(len, radix) {
|
|
6
6
|
const chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split('');
|
|
@@ -205,3 +205,33 @@ function splitUrlParams(urlParams) {
|
|
|
205
205
|
return splitList !== null && splitList !== void 0 ? splitList : [];
|
|
206
206
|
}
|
|
207
207
|
exports.splitUrlParams = splitUrlParams;
|
|
208
|
+
function deleteCookie(name, path = '/', domain = '') {
|
|
209
|
+
const expiration = 'expires=Thu, 01 Jan 1970 00:00:00 GMT';
|
|
210
|
+
const pathPart = path ? `; path=${path}` : '';
|
|
211
|
+
const domainPart = domain ? `; domain=${domain}` : '';
|
|
212
|
+
document.cookie = `${name}=; ${expiration}${pathPart}${domainPart}`;
|
|
213
|
+
console.log(`已尝试删除Cookie: ${name}`);
|
|
214
|
+
}
|
|
215
|
+
exports.deleteCookie = deleteCookie;
|
|
216
|
+
function setCookie(name, value, days = 0, path = '/', domain = '', secure = false, sameSite = 'Lax') {
|
|
217
|
+
let cookieString = `${encodeURIComponent(name)}=${encodeURIComponent(value)}`;
|
|
218
|
+
if (days) {
|
|
219
|
+
const date = new Date();
|
|
220
|
+
date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000);
|
|
221
|
+
cookieString += `; expires=${date.toUTCString()}`;
|
|
222
|
+
}
|
|
223
|
+
if (path) {
|
|
224
|
+
cookieString += `; path=${path}`;
|
|
225
|
+
}
|
|
226
|
+
if (domain) {
|
|
227
|
+
cookieString += `; domain=${domain}`;
|
|
228
|
+
}
|
|
229
|
+
if (secure) {
|
|
230
|
+
cookieString += '; secure';
|
|
231
|
+
}
|
|
232
|
+
if (sameSite) {
|
|
233
|
+
cookieString += `; samesite=${sameSite}`;
|
|
234
|
+
}
|
|
235
|
+
document.cookie = cookieString;
|
|
236
|
+
}
|
|
237
|
+
exports.setCookie = setCookie;
|
|
@@ -28,7 +28,7 @@ const Display = (_a) => {
|
|
|
28
28
|
react_1.default.createElement("span", { style: content === null || content === void 0 ? void 0 : content.style, dangerouslySetInnerHTML: {
|
|
29
29
|
__html: (0, tool_1.setFontForText)((_b = content === null || content === void 0 ? void 0 : content.text) === null || _b === void 0 ? void 0 : _b.replace(/\n/g, '</br>'), content === null || content === void 0 ? void 0 : content.style)
|
|
30
30
|
} }),
|
|
31
|
-
react_1.default.createElement("span", { style: Object.assign(Object.assign({}, interaction === null || interaction === void 0 ? void 0 : interaction.style), {
|
|
31
|
+
react_1.default.createElement("span", { style: Object.assign(Object.assign({}, interaction === null || interaction === void 0 ? void 0 : interaction.style), { marginInlineStart: '5px' }), dangerouslySetInnerHTML: {
|
|
32
32
|
__html: (0, tool_1.setFontForText)((_c = interaction === null || interaction === void 0 ? void 0 : interaction.text) === null || _c === void 0 ? void 0 : _c.replace(/\n/g, '</br>'), interaction === null || interaction === void 0 ? void 0 : interaction.style)
|
|
33
33
|
}, onClick: handleClick })),
|
|
34
34
|
isShowClose && (react_1.default.createElement("button", { "aria-label": 'close', className: 'consentPopupDisplay-close', onClick: handleClickClose },
|