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
|
@@ -7,7 +7,7 @@ import { storeAndLoadFeUserId, AGREE_POLICY } from '../utils/localStore';
|
|
|
7
7
|
import { useIconLink } from '../components/SxpPageRender/useIconLink';
|
|
8
8
|
import SXP_EVENT_BUS, { SXP_EVENT_TYPE } from '../utils/event';
|
|
9
9
|
import Consent from '../components/Consent';
|
|
10
|
-
import { getCookie, splitUrlParams } from '../utils/tool';
|
|
10
|
+
import { deleteCookie, getCookie, setCookie, splitUrlParams } from '../utils/tool';
|
|
11
11
|
export const SxpDataSourceContext = createContext({
|
|
12
12
|
rtcList: [],
|
|
13
13
|
tagList: []
|
|
@@ -20,7 +20,6 @@ export const DEFAULT_TAG = 'FOR U';
|
|
|
20
20
|
const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent = true, maxSize, defaultSize, isPreview = false, sxpParameter, appDomain, hashTagSize, loadingImage, isOpenHashTag = false, enabledMetaConversionApi = false, consentHeight, consentWidth, isOpenConsent = false, isEditor = false, utmParameter, channelQueryList, data, dataList, isDiyH5, onUpdateSchema, onUpdateChannel }) => {
|
|
21
21
|
var _a, _b, _c, _d, _e;
|
|
22
22
|
const [rtcList, setRtcList] = useState([]);
|
|
23
|
-
const [firstRtcList, setFirstRtcList] = useState([]);
|
|
24
23
|
const [tagList, setTagList] = useState([]);
|
|
25
24
|
const [loading, setLoading] = useState(true);
|
|
26
25
|
const [curReqInfo, setCurReqInfo] = useState({ rtc: '', requestId: '' });
|
|
@@ -51,10 +50,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
51
50
|
const [chatlabsId, setChatlabsId] = useState();
|
|
52
51
|
const finalPageData = useMemo(() => pageData !== null && pageData !== void 0 ? pageData : data, [pageData, data]);
|
|
53
52
|
const pixelPvStatusRef = useRef(false);
|
|
54
|
-
const
|
|
55
|
-
var _a, _b, _c;
|
|
56
|
-
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);
|
|
57
|
-
}, [isDiyH5, finalPageData]);
|
|
53
|
+
const fbcRef = useRef('');
|
|
58
54
|
const isShowConsent = useMemo(() => {
|
|
59
55
|
var _a, _b, _c, _d;
|
|
60
56
|
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) &&
|
|
@@ -110,8 +106,55 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
110
106
|
var _a;
|
|
111
107
|
return ((_a = bffDataSource === null || bffDataSource === void 0 ? void 0 : bffDataSource.headers) === null || _a === void 0 ? void 0 : _a['x-app-id']) + storeAndLoadFeUserId();
|
|
112
108
|
}, [bffDataSource]);
|
|
109
|
+
useEffect(() => {
|
|
110
|
+
if (!(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enableCookieSetting))
|
|
111
|
+
return;
|
|
112
|
+
fbcRef.current = getCookie('_fbc');
|
|
113
|
+
window.OptanonWrapper = function () {
|
|
114
|
+
const activeGroups = window === null || window === void 0 ? void 0 : window.OnetrustActiveGroups;
|
|
115
|
+
if (!activeGroups)
|
|
116
|
+
return;
|
|
117
|
+
if (!(activeGroups === null || activeGroups === void 0 ? void 0 : activeGroups.includes('4'))) {
|
|
118
|
+
deleteCookie('_fbc');
|
|
119
|
+
}
|
|
120
|
+
else if (fbcRef.current) {
|
|
121
|
+
setCookie('_fbc', fbcRef.current, 90);
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
}, [globalConfig]);
|
|
125
|
+
const isActiveTargetingCookie = useMemo(() => {
|
|
126
|
+
var _a;
|
|
127
|
+
function isTargetingRejected(cookieValue) {
|
|
128
|
+
const groupsMatch = cookieValue.match(/groups=([^&]+)/);
|
|
129
|
+
if (!groupsMatch || !groupsMatch[1]) {
|
|
130
|
+
return false;
|
|
131
|
+
}
|
|
132
|
+
const groupsString = groupsMatch[1];
|
|
133
|
+
const groupsPairs = groupsString.split(',');
|
|
134
|
+
for (const pair of groupsPairs) {
|
|
135
|
+
const [category, status] = pair.split(':');
|
|
136
|
+
if (category === '4') {
|
|
137
|
+
return status === '0';
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
return false;
|
|
141
|
+
}
|
|
142
|
+
function getCookie(name) {
|
|
143
|
+
var _a;
|
|
144
|
+
const value = `; ${document.cookie}`;
|
|
145
|
+
const parts = value.split(`; ${name}=`);
|
|
146
|
+
if (parts.length === 2)
|
|
147
|
+
return (_a = parts.pop()) === null || _a === void 0 ? void 0 : _a.split(';').shift();
|
|
148
|
+
return '';
|
|
149
|
+
}
|
|
150
|
+
const OptanonConsent = decodeURIComponent((_a = getCookie('OptanonConsent')) !== null && _a !== void 0 ? _a : '');
|
|
151
|
+
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')))) {
|
|
152
|
+
return true;
|
|
153
|
+
}
|
|
154
|
+
return false;
|
|
155
|
+
}, [globalConfig]);
|
|
113
156
|
const bffFetch = useCallback((path, options, isBota = true) => {
|
|
114
|
-
var _a
|
|
157
|
+
var _a;
|
|
115
158
|
if (!bffDataSource)
|
|
116
159
|
return;
|
|
117
160
|
const url = bffDataSource.url;
|
|
@@ -126,9 +169,8 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
126
169
|
const value = val.split('=')[1];
|
|
127
170
|
params[key] = value;
|
|
128
171
|
});
|
|
129
|
-
options.body = Object.assign(Object.assign({}, options.body), { productUserId: fakeUserId });
|
|
130
172
|
return window
|
|
131
|
-
.fetch(`${url}/api/${path}`, Object.assign({ headers: Object.assign({ 'Content-Type': 'application/json', 'x-user-id': fakeUserId
|
|
173
|
+
.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
|
|
132
174
|
? JSON.stringify({
|
|
133
175
|
body: btoa(encodeURIComponent(JSON.stringify(Object.assign(Object.assign(Object.assign({}, options.body), bffDataSource.headers), { 'x-user-id': fakeUserId }))))
|
|
134
176
|
})
|
|
@@ -138,6 +180,8 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
138
180
|
}, [bffDataSource, fakeUserId]);
|
|
139
181
|
const bffCollectEvent = useCallback((params) => {
|
|
140
182
|
var _a;
|
|
183
|
+
if (isActiveTargetingCookie)
|
|
184
|
+
return Promise.resolve();
|
|
141
185
|
const body = {
|
|
142
186
|
eventName: params === null || params === void 0 ? void 0 : params.eventName,
|
|
143
187
|
eventSource: params === null || params === void 0 ? void 0 : params.eventSource
|
|
@@ -147,34 +191,35 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
147
191
|
body,
|
|
148
192
|
type: 'beacon'
|
|
149
193
|
}, false);
|
|
150
|
-
}, [bffFetch, bffDataSource]);
|
|
194
|
+
}, [bffFetch, bffDataSource, isActiveTargetingCookie]);
|
|
151
195
|
useEffect(() => {
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
if (value.includes('https://www.facebook.com/privacy_sandbox/pixel/register/trigger/')) {
|
|
161
|
-
const url = new URL(value);
|
|
162
|
-
const params = Object.fromEntries(url.searchParams.entries());
|
|
163
|
-
bffCollectEvent({
|
|
164
|
-
eventName: params === null || params === void 0 ? void 0 : params.ev,
|
|
165
|
-
eventSource: 'Meta Pixel'
|
|
166
|
-
});
|
|
167
|
-
}
|
|
168
|
-
;
|
|
169
|
-
},
|
|
170
|
-
get() {
|
|
171
|
-
return originalSrcDescriptor.get.call(this);
|
|
196
|
+
const OriginalImage = window.Image;
|
|
197
|
+
window.Image = function () {
|
|
198
|
+
const img = new OriginalImage();
|
|
199
|
+
const originalSrcDescriptor = Object.getOwnPropertyDescriptor(HTMLImageElement.prototype, 'src');
|
|
200
|
+
Object.defineProperty(img, 'src', {
|
|
201
|
+
set(value) {
|
|
202
|
+
if (isActiveTargetingCookie && (value.includes('https://www.facebook.com/privacy_sandbox/pixel/register/trigger/') || value.includes('https://www.facebook.com/tr'))) {
|
|
203
|
+
return;
|
|
172
204
|
}
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
205
|
+
originalSrcDescriptor.set.call(this, value);
|
|
206
|
+
if (value.includes('https://www.facebook.com/privacy_sandbox/pixel/register/trigger/')) {
|
|
207
|
+
const url = new URL(value);
|
|
208
|
+
const params = Object.fromEntries(url.searchParams.entries());
|
|
209
|
+
bffCollectEvent({
|
|
210
|
+
eventName: params === null || params === void 0 ? void 0 : params.ev,
|
|
211
|
+
eventSource: 'Meta Pixel'
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
;
|
|
215
|
+
},
|
|
216
|
+
get() {
|
|
217
|
+
return originalSrcDescriptor.get.call(this);
|
|
218
|
+
}
|
|
219
|
+
});
|
|
220
|
+
return img;
|
|
221
|
+
};
|
|
222
|
+
}, [bffCollectEvent, isActiveTargetingCookie]);
|
|
178
223
|
useEffect(() => {
|
|
179
224
|
const navigatorWithBeacon = navigator;
|
|
180
225
|
if (!navigatorWithBeacon.sendBeacon) {
|
|
@@ -184,6 +229,9 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
184
229
|
const originalSendBeacon = navigatorWithBeacon.sendBeacon.bind(navigatorWithBeacon);
|
|
185
230
|
navigatorWithBeacon.sendBeacon = function (url, data) {
|
|
186
231
|
const urlString = url instanceof URL ? url.href : url.toString();
|
|
232
|
+
if (isActiveTargetingCookie && (urlString.includes('https://tr.snapchat.com/p') || urlString.includes('https://analytics.tiktok.com/api/v2/pixel'))) {
|
|
233
|
+
return true;
|
|
234
|
+
}
|
|
187
235
|
const success = originalSendBeacon(url, data);
|
|
188
236
|
function parseBeaconData(data) {
|
|
189
237
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -229,7 +277,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
229
277
|
return () => {
|
|
230
278
|
navigatorWithBeacon.sendBeacon = originalSendBeacon;
|
|
231
279
|
};
|
|
232
|
-
}, [bffCollectEvent]);
|
|
280
|
+
}, [bffCollectEvent, isActiveTargetingCookie]);
|
|
233
281
|
useEffect(() => {
|
|
234
282
|
const _originalFetch = window.fetch;
|
|
235
283
|
window.fetch = function (input, init) {
|
|
@@ -249,6 +297,9 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
249
297
|
return _originalFetch.apply(this, arguments_1);
|
|
250
298
|
}
|
|
251
299
|
try {
|
|
300
|
+
if (isActiveTargetingCookie && (url.includes('https://www.google-analytics.com/g/collect') || url.includes('https://arms-retcode.aliyuncs.com/r.png'))) {
|
|
301
|
+
return Promise.resolve(new Response(''));
|
|
302
|
+
}
|
|
252
303
|
const response = _originalFetch.apply(this, arguments_1);
|
|
253
304
|
if (url.includes('https://www.google-analytics.com/g/collect')) {
|
|
254
305
|
const urlObj = new URL(url);
|
|
@@ -290,7 +341,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
290
341
|
}
|
|
291
342
|
});
|
|
292
343
|
};
|
|
293
|
-
}, [bffCollectEvent]);
|
|
344
|
+
}, [bffCollectEvent, isActiveTargetingCookie]);
|
|
294
345
|
useEffect(() => {
|
|
295
346
|
const originalOpen = XMLHttpRequest.prototype.open;
|
|
296
347
|
const originalSend = XMLHttpRequest.prototype.send;
|
|
@@ -300,6 +351,9 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
300
351
|
};
|
|
301
352
|
XMLHttpRequest.prototype.send = function (body) {
|
|
302
353
|
var _a;
|
|
354
|
+
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'))) {
|
|
355
|
+
return;
|
|
356
|
+
}
|
|
303
357
|
if (this._url && typeof this._url === 'string' && this._url.includes('https://i.giesswein.com/nb-collector')) {
|
|
304
358
|
if (body && typeof body === 'string') {
|
|
305
359
|
try {
|
|
@@ -325,7 +379,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
325
379
|
XMLHttpRequest.prototype.open = originalOpen;
|
|
326
380
|
XMLHttpRequest.prototype.send = originalSend;
|
|
327
381
|
};
|
|
328
|
-
}, [bffCollectEvent]);
|
|
382
|
+
}, [bffCollectEvent, isActiveTargetingCookie]);
|
|
329
383
|
useEffect(() => {
|
|
330
384
|
if (typeof (window === null || window === void 0 ? void 0 : window.fbq) === 'function') {
|
|
331
385
|
window === null || window === void 0 ? void 0 : window.fbq('track', 'PageView');
|
|
@@ -349,8 +403,8 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
349
403
|
.catch((err) => Promise.reject(err));
|
|
350
404
|
}, [bffDataSource]);
|
|
351
405
|
const getRecommendVideos = useCallback((query) => __awaiter(void 0, void 0, void 0, function* () {
|
|
352
|
-
var _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u
|
|
353
|
-
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 })), (
|
|
406
|
+
var _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
|
407
|
+
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' }));
|
|
354
408
|
if (channel) {
|
|
355
409
|
query = Object.assign(Object.assign({}, query), { channel: decodeURIComponent(channel) });
|
|
356
410
|
}
|
|
@@ -363,10 +417,9 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
363
417
|
if (val)
|
|
364
418
|
query = Object.assign(Object.assign({}, query), { channel: decodeURIComponent(val) });
|
|
365
419
|
}
|
|
366
|
-
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);
|
|
367
420
|
if (isEditor) {
|
|
368
421
|
let pageNum = 1;
|
|
369
|
-
query = Object.assign(Object.assign(Object.assign(
|
|
422
|
+
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] }));
|
|
370
423
|
if (!(query === null || query === void 0 ? void 0 : query.channel) || isInit.current) {
|
|
371
424
|
return undefined;
|
|
372
425
|
}
|
|
@@ -374,22 +427,19 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
374
427
|
let list = [];
|
|
375
428
|
let result = null;
|
|
376
429
|
const recurveRecList = (query) => __awaiter(void 0, void 0, void 0, function* () {
|
|
377
|
-
var
|
|
430
|
+
var _v, _w, _x, _y, _z, _0;
|
|
378
431
|
query.pageNum = pageNum;
|
|
379
|
-
result =
|
|
432
|
+
result = yield (bffFetchAdmin === null || bffFetchAdmin === void 0 ? void 0 : bffFetchAdmin('recommend/direct_page', { method: 'POST', body: query }));
|
|
380
433
|
if (!(result === null || result === void 0 ? void 0 : result.success)) {
|
|
381
434
|
return undefined;
|
|
382
435
|
}
|
|
383
436
|
setLoading(false);
|
|
384
|
-
list = list.concat((
|
|
437
|
+
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 : []);
|
|
385
438
|
if ((rtcList === null || rtcList === void 0 ? void 0 : rtcList.length) === 0) {
|
|
386
439
|
setRtcList(getFilterRecList(Object.assign(Object.assign({}, result === null || result === void 0 ? void 0 : result.data), { recList: list })));
|
|
387
440
|
setCacheRtcList(getFilterRecList(Object.assign(Object.assign({}, result === null || result === void 0 ? void 0 : result.data), { recList: list })));
|
|
388
|
-
if (isDiyPage) {
|
|
389
|
-
setFirstRtcList(getFilterRecList(Object.assign(Object.assign({}, result === null || result === void 0 ? void 0 : result.data), { recList: list })));
|
|
390
|
-
}
|
|
391
441
|
}
|
|
392
|
-
const isNotNullList = (
|
|
442
|
+
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));
|
|
393
443
|
if (isNotNullList) {
|
|
394
444
|
pageNum = pageNum + 1;
|
|
395
445
|
yield recurveRecList(query);
|
|
@@ -397,13 +447,13 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
397
447
|
});
|
|
398
448
|
yield recurveRecList(query);
|
|
399
449
|
if (!(query === null || query === void 0 ? void 0 : query.hashTag) && result)
|
|
400
|
-
setCurReqInfo({ rtc: (
|
|
450
|
+
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 });
|
|
401
451
|
return Object.assign(Object.assign({}, result === null || result === void 0 ? void 0 : result.data), { recList: list });
|
|
402
452
|
}
|
|
403
453
|
if (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview) {
|
|
404
|
-
query = Object.assign(Object.assign(
|
|
454
|
+
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 });
|
|
405
455
|
}
|
|
406
|
-
const result =
|
|
456
|
+
const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/recommend/list', {
|
|
407
457
|
method: 'POST',
|
|
408
458
|
body: query
|
|
409
459
|
}));
|
|
@@ -413,31 +463,26 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
413
463
|
if (!(query === null || query === void 0 ? void 0 : query.hashTag))
|
|
414
464
|
setCurReqInfo({ rtc: result.data.rtc, requestId: result.data.requestId });
|
|
415
465
|
if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview) && !isEditor) {
|
|
416
|
-
const isNotNullList = (
|
|
466
|
+
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));
|
|
417
467
|
if (!isNotNullList) {
|
|
418
468
|
setIsNoMoreData(true);
|
|
419
469
|
}
|
|
420
470
|
}
|
|
421
471
|
let list = [];
|
|
422
|
-
list = list.concat((
|
|
472
|
+
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 : []);
|
|
423
473
|
return Object.assign(Object.assign({}, result.data), { recList: list });
|
|
424
|
-
}), [bffFetch, utmVal, maxSize, defaultSize, channelQueryList, channel, chatlabsId, bffFetchAdmin
|
|
474
|
+
}), [bffFetch, utmVal, maxSize, defaultSize, channelQueryList, channel, chatlabsId, bffFetchAdmin]);
|
|
425
475
|
const loadVideos = useCallback((pageNum) => __awaiter(void 0, void 0, void 0, function* () {
|
|
426
|
-
var
|
|
476
|
+
var _1, _2, _3, _4;
|
|
427
477
|
if (rtcList.length <= 0) {
|
|
428
478
|
return;
|
|
429
479
|
}
|
|
430
|
-
if (isDiyPage && (firstRtcList === null || firstRtcList === void 0 ? void 0 : firstRtcList.length) > 0) {
|
|
431
|
-
setRtcList(rtcList.concat(firstRtcList));
|
|
432
|
-
setCacheRtcList(cacheRtcList.concat(firstRtcList));
|
|
433
|
-
return;
|
|
434
|
-
}
|
|
435
480
|
const lastItem = rtcList === null || rtcList === void 0 ? void 0 : rtcList[(rtcList === null || rtcList === void 0 ? void 0 : rtcList.length) - 1];
|
|
436
|
-
const data = yield getRecommendVideos(Object.assign(Object.assign(Object.assign(Object.assign({ hashTag: waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.hashTag }, (((
|
|
481
|
+
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 })));
|
|
437
482
|
setRtcList(rtcList.concat(getFilterRecList(data)));
|
|
438
483
|
setCacheRtcList(cacheRtcList.concat(getFilterRecList(data)));
|
|
439
484
|
return data;
|
|
440
|
-
}), [getRecommendVideos, rtcList, waterFallData, cacheRtcList
|
|
485
|
+
}), [getRecommendVideos, rtcList, waterFallData, cacheRtcList]);
|
|
441
486
|
const refreshFeSession = useCallback((enableReSid, event) => {
|
|
442
487
|
var _a, _b, _c, _d, _e;
|
|
443
488
|
let expire = false;
|
|
@@ -461,13 +506,11 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
461
506
|
}, [data]);
|
|
462
507
|
const bffEventReport = useCallback(({ userInfo, eventInfo, reportLayId = true }) => {
|
|
463
508
|
var _a, _b;
|
|
464
|
-
if (!enableReportEvent || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview)) {
|
|
509
|
+
if (!enableReportEvent || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview) || isActiveTargetingCookie) {
|
|
465
510
|
return;
|
|
466
511
|
}
|
|
467
512
|
if (!userInfo) {
|
|
468
|
-
userInfo = {
|
|
469
|
-
productUserId: fakeUserId
|
|
470
|
-
};
|
|
513
|
+
userInfo = {};
|
|
471
514
|
}
|
|
472
515
|
const sessionID = storeAndLoadFeSessionId();
|
|
473
516
|
const params = {};
|
|
@@ -501,7 +544,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
501
544
|
globalConfig,
|
|
502
545
|
playbookType,
|
|
503
546
|
bffDataSource,
|
|
504
|
-
|
|
547
|
+
isActiveTargetingCookie
|
|
505
548
|
]);
|
|
506
549
|
const getEventParamsByJson = useCallback((json, product) => {
|
|
507
550
|
var _a, _b, _c;
|
|
@@ -566,7 +609,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
566
609
|
}, [fakeUserId]);
|
|
567
610
|
const bffFbReport = useCallback(({ eventName, product }) => {
|
|
568
611
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
569
|
-
if (!enableReportEvent || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview)) {
|
|
612
|
+
if (!enableReportEvent || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview) || isActiveTargetingCookie) {
|
|
570
613
|
return;
|
|
571
614
|
}
|
|
572
615
|
let isPushState = false;
|
|
@@ -632,41 +675,39 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
632
675
|
type: 'beacon'
|
|
633
676
|
});
|
|
634
677
|
}
|
|
635
|
-
}, [bffFetch, enableReportEvent, enabledMetaConversionApi, globalConfig, bffDataSource, getEventParamsByJson]);
|
|
678
|
+
}, [bffFetch, enableReportEvent, enabledMetaConversionApi, globalConfig, bffDataSource, getEventParamsByJson, isActiveTargetingCookie]);
|
|
636
679
|
const bffMutateLike = useCallback((body) => __awaiter(void 0, void 0, void 0, function* () {
|
|
637
|
-
body = Object.assign(Object.assign({}, body), { productUserId: fakeUserId });
|
|
638
680
|
const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/recommend/like', { method: 'POST', body }));
|
|
639
681
|
return res === null || res === void 0 ? void 0 : res.success;
|
|
640
|
-
}), [bffFetch
|
|
682
|
+
}), [bffFetch]);
|
|
641
683
|
const bffMutateUnlike = useCallback((body) => __awaiter(void 0, void 0, void 0, function* () {
|
|
642
|
-
body = Object.assign(Object.assign({}, body), { productUserId: fakeUserId });
|
|
643
684
|
const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/recommend/unlike', { method: 'POST', body }));
|
|
644
685
|
return res === null || res === void 0 ? void 0 : res.success;
|
|
645
|
-
}), [bffFetch
|
|
686
|
+
}), [bffFetch]);
|
|
646
687
|
const bffSubmitForm = useCallback((body) => __awaiter(void 0, void 0, void 0, function* () {
|
|
647
688
|
const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/customform', { method: 'POST', body }));
|
|
648
689
|
return res === null || res === void 0 ? void 0 : res.success;
|
|
649
690
|
}), [bffFetch]);
|
|
650
691
|
const bffGetTagList = useCallback((data) => __awaiter(void 0, void 0, void 0, function* () {
|
|
651
|
-
var
|
|
652
|
-
const isShowTag = !!((
|
|
692
|
+
var _5, _6, _7, _8, _9, _10, _11, _12;
|
|
693
|
+
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);
|
|
653
694
|
if (!utmVal || !isShowTag)
|
|
654
695
|
return;
|
|
655
696
|
try {
|
|
656
|
-
const val = (
|
|
697
|
+
const val = (_10 = (_9 = (_8 = splitUrlParams(utmVal)) === null || _8 === void 0 ? void 0 : _8.filter((val) => {
|
|
657
698
|
var _a, _b;
|
|
658
699
|
const key = val.split('=')[0];
|
|
659
700
|
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);
|
|
660
|
-
})) === null ||
|
|
701
|
+
})) === null || _9 === void 0 ? void 0 : _9.join('&')) !== null && _10 !== void 0 ? _10 : '';
|
|
661
702
|
const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/tag/list', { method: 'GET', query: { channel: decodeURIComponent(val) } }));
|
|
662
|
-
setTagList((
|
|
703
|
+
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 : []);
|
|
663
704
|
}
|
|
664
705
|
catch (e) {
|
|
665
706
|
console.log('e', e);
|
|
666
707
|
}
|
|
667
708
|
}), [bffFetch, utmVal]);
|
|
668
709
|
const ctaEvent = useCallback((eventInfo, rec, product, position) => {
|
|
669
|
-
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
|
|
710
|
+
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;
|
|
670
711
|
const cta = product === null || product === void 0 ? void 0 : product.bindCta;
|
|
671
712
|
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);
|
|
672
713
|
let fromKName = '';
|
|
@@ -684,7 +725,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
684
725
|
}
|
|
685
726
|
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;
|
|
686
727
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
|
687
|
-
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 : '',
|
|
728
|
+
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 })
|
|
688
729
|
});
|
|
689
730
|
}, [bffEventReport, isFromHashtag]);
|
|
690
731
|
const h5EnterLink = useCallback(() => {
|
|
@@ -719,10 +760,10 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
719
760
|
});
|
|
720
761
|
}, [bffEventReport]);
|
|
721
762
|
const getAccount = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
722
|
-
var
|
|
763
|
+
var _13, _14;
|
|
723
764
|
const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/account', { method: 'GET' }));
|
|
724
|
-
setChatlabsId((
|
|
725
|
-
return ((
|
|
765
|
+
setChatlabsId((_13 = res === null || res === void 0 ? void 0 : res.data) === null || _13 === void 0 ? void 0 : _13.chatLabsId);
|
|
766
|
+
return ((_14 = res === null || res === void 0 ? void 0 : res.data) === null || _14 === void 0 ? void 0 : _14.consentResult) === 'true';
|
|
726
767
|
}), [bffFetch]);
|
|
727
768
|
const accountSonsent = useCallback((consentResult) => __awaiter(void 0, void 0, void 0, function* () {
|
|
728
769
|
const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/account/consent', {
|
|
@@ -786,9 +827,6 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
786
827
|
}
|
|
787
828
|
setRtcList(list);
|
|
788
829
|
setCacheRtcList(list);
|
|
789
|
-
if (isDiyPage) {
|
|
790
|
-
setFirstRtcList(list);
|
|
791
|
-
}
|
|
792
830
|
bffGetTagList(curData !== null && curData !== void 0 ? curData : finalPageData);
|
|
793
831
|
if (channel) {
|
|
794
832
|
const item = list === null || list === void 0 ? void 0 : list[0];
|
|
@@ -808,7 +846,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
808
846
|
});
|
|
809
847
|
setLoading(false);
|
|
810
848
|
});
|
|
811
|
-
}, [isShowConsent, channel
|
|
849
|
+
}, [isShowConsent, channel]);
|
|
812
850
|
useEffect(() => {
|
|
813
851
|
if (!isPreview)
|
|
814
852
|
return;
|
|
@@ -823,15 +861,12 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
823
861
|
}
|
|
824
862
|
setRtcList(list);
|
|
825
863
|
setCacheRtcList(list);
|
|
826
|
-
if (isDiyPage) {
|
|
827
|
-
setFirstRtcList(list);
|
|
828
|
-
}
|
|
829
864
|
}
|
|
830
865
|
})
|
|
831
866
|
.finally(() => {
|
|
832
867
|
setLoading(false);
|
|
833
868
|
});
|
|
834
|
-
}, [getRecommendVideos, bffGetTagList, channel
|
|
869
|
+
}, [getRecommendVideos, bffGetTagList, channel]);
|
|
835
870
|
const defaultLoadingImage = useIconLink('/pb_static/a65d23c5893c49d7aaaa81681d3179e2.gif', appDomain);
|
|
836
871
|
return (React.createElement(SxpDataSourceContext.Provider, { value: {
|
|
837
872
|
rtcList,
|
|
@@ -889,8 +924,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
889
924
|
refreshFeSession,
|
|
890
925
|
getAccount,
|
|
891
926
|
accountSonsent,
|
|
892
|
-
isDiyH5
|
|
893
|
-
firstRtcList
|
|
927
|
+
isDiyH5
|
|
894
928
|
} }, isShowConsent ? (React.createElement(Consent, Object.assign({}, (_e = (_d = (_c = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.consent) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.item) === null || _e === void 0 ? void 0 : _e.props))) : (render({
|
|
895
929
|
rtcList,
|
|
896
930
|
mutateLike: bffMutateLike,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { useCallback } from 'react';
|
|
2
|
-
import { DEFAULT_TAG } from '../context/SxpDataSourceProvider';
|
|
3
2
|
import { useSxpDataSource } from './useSxpDataSource';
|
|
3
|
+
import { DEFAULT_TAG } from '../context/SxpDataSourceProvider';
|
|
4
4
|
export function useEventReport() {
|
|
5
5
|
const { bffEventReport, popupDetailData, isFromHashtag, eventTimeList, setEventTimeList } = useSxpDataSource();
|
|
6
6
|
const jumpToWeb = useCallback((e, data, product, cta, position, traceInfo) => {
|
|
7
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13
|
|
7
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13;
|
|
8
8
|
const i = eventTimeList === null || eventTimeList === void 0 ? void 0 : eventTimeList.findIndex((item) => item.target === (e === null || e === void 0 ? void 0 : e.target));
|
|
9
9
|
if (i !== -1) {
|
|
10
10
|
return;
|
|
@@ -37,11 +37,11 @@ export function useEventReport() {
|
|
|
37
37
|
contentFormat = 'image';
|
|
38
38
|
}
|
|
39
39
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
|
40
|
-
eventInfo: Object.assign({ eventSubject: 'jumpToWeb', eventDescription: 'User jumped to website', productId: (_v = product === null || product === void 0 ? void 0 : product.itemId) !== null && _v !== void 0 ? _v : '', productName: (_w = product === null || product === void 0 ? void 0 : product.title) !== null && _w !== void 0 ? _w : '', price: (product === null || product === void 0 ? void 0 : product.price) ? (product === null || product === void 0 ? void 0 : product.price) + '' : '0', productCollection: (_x = product === null || product === void 0 ? void 0 : product.collection) !== null && _x !== void 0 ? _x : '', fromKName, fromKPage: location === null || location === void 0 ? void 0 : location.href, contentTags: contentTags ? JSON.stringify(contentTags) : '', position: position + '', contentId: (_z = (_y = data === null || data === void 0 ? void 0 : data.video) === null || _y === void 0 ? void 0 : _y.itemId) !== null && _z !== void 0 ? _z : '',
|
|
40
|
+
eventInfo: Object.assign({ eventSubject: 'jumpToWeb', eventDescription: 'User jumped to website', productId: (_v = product === null || product === void 0 ? void 0 : product.itemId) !== null && _v !== void 0 ? _v : '', productName: (_w = product === null || product === void 0 ? void 0 : product.title) !== null && _w !== void 0 ? _w : '', price: (product === null || product === void 0 ? void 0 : product.price) ? (product === null || product === void 0 ? void 0 : product.price) + '' : '0', productCollection: (_x = product === null || product === void 0 ? void 0 : product.collection) !== null && _x !== void 0 ? _x : '', fromKName, fromKPage: location === null || location === void 0 ? void 0 : location.href, contentTags: contentTags ? JSON.stringify(contentTags) : '', position: position + '', contentId: (_z = (_y = data === null || data === void 0 ? void 0 : data.video) === null || _y === void 0 ? void 0 : _y.itemId) !== null && _z !== void 0 ? _z : '', 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 }))
|
|
41
41
|
});
|
|
42
42
|
}, [bffEventReport, popupDetailData, isFromHashtag, eventTimeList]);
|
|
43
43
|
const productView = useCallback((data, product, cta, viewTime, position) => {
|
|
44
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p
|
|
44
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
45
45
|
let fromKName = '';
|
|
46
46
|
if (popupDetailData && (((_b = (_a = data === null || data === void 0 ? void 0 : data.video) === null || _a === void 0 ? void 0 : _a.bindProducts) === null || _b === void 0 ? void 0 : _b.length) || ((_c = data === null || data === void 0 ? void 0 : data.video) === null || _c === void 0 ? void 0 : _c.bindProduct))) {
|
|
47
47
|
fromKName = 'pdpPage';
|
|
@@ -60,9 +60,8 @@ export function useEventReport() {
|
|
|
60
60
|
contentTags: JSON.stringify(product === null || product === void 0 ? void 0 : product.tags),
|
|
61
61
|
position: position + '',
|
|
62
62
|
contentId: (_d = data === null || data === void 0 ? void 0 : data.video) === null || _d === void 0 ? void 0 : _d.itemId,
|
|
63
|
-
sceneId: (_g = (_f = (_e = data === null || data === void 0 ? void 0 : data.video) === null || _e === void 0 ? void 0 : _e.scene) === null || _f === void 0 ? void 0 : _f.sceneId) !== null && _g !== void 0 ? _g : '',
|
|
64
63
|
ctatId: cta === null || cta === void 0 ? void 0 : cta.itemId,
|
|
65
|
-
traceInfo: (
|
|
64
|
+
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 : '',
|
|
66
65
|
timeOnSite: Math.floor((new Date() - viewTime) / 1000) + '',
|
|
67
66
|
eventSubject: 'productView',
|
|
68
67
|
eventDescription: 'User browsed the product'
|
package/es/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/es/core/utils/tool.js
CHANGED
|
@@ -191,4 +191,32 @@ function splitUrlParams(urlParams) {
|
|
|
191
191
|
});
|
|
192
192
|
return splitList !== null && splitList !== void 0 ? splitList : [];
|
|
193
193
|
}
|
|
194
|
-
|
|
194
|
+
function deleteCookie(name, path = '/', domain = '') {
|
|
195
|
+
const expiration = 'expires=Thu, 01 Jan 1970 00:00:00 GMT';
|
|
196
|
+
const pathPart = path ? `; path=${path}` : '';
|
|
197
|
+
const domainPart = domain ? `; domain=${domain}` : '';
|
|
198
|
+
document.cookie = `${name}=; ${expiration}${pathPart}${domainPart}`;
|
|
199
|
+
console.log(`已尝试删除Cookie: ${name}`);
|
|
200
|
+
}
|
|
201
|
+
function setCookie(name, value, days = 0, path = '/', domain = '', secure = false, sameSite = 'Lax') {
|
|
202
|
+
let cookieString = `${encodeURIComponent(name)}=${encodeURIComponent(value)}`;
|
|
203
|
+
if (days) {
|
|
204
|
+
const date = new Date();
|
|
205
|
+
date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000);
|
|
206
|
+
cookieString += `; expires=${date.toUTCString()}`;
|
|
207
|
+
}
|
|
208
|
+
if (path) {
|
|
209
|
+
cookieString += `; path=${path}`;
|
|
210
|
+
}
|
|
211
|
+
if (domain) {
|
|
212
|
+
cookieString += `; domain=${domain}`;
|
|
213
|
+
}
|
|
214
|
+
if (secure) {
|
|
215
|
+
cookieString += '; secure';
|
|
216
|
+
}
|
|
217
|
+
if (sameSite) {
|
|
218
|
+
cookieString += `; samesite=${sameSite}`;
|
|
219
|
+
}
|
|
220
|
+
document.cookie = cookieString;
|
|
221
|
+
}
|
|
222
|
+
export { uuid, getIndexByblockType, getBrowserInfo, getDevice, getSystem, getCookie, getScreenReader, splitUrlParams, deleteCookie, setCookie };
|
|
@@ -26,7 +26,7 @@ const Display = (_a) => {
|
|
|
26
26
|
React.createElement("span", { style: content === null || content === void 0 ? void 0 : content.style, dangerouslySetInnerHTML: {
|
|
27
27
|
__html: 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)
|
|
28
28
|
} }),
|
|
29
|
-
React.createElement("span", { style: Object.assign(Object.assign({}, interaction === null || interaction === void 0 ? void 0 : interaction.style), {
|
|
29
|
+
React.createElement("span", { style: Object.assign(Object.assign({}, interaction === null || interaction === void 0 ? void 0 : interaction.style), { marginInlineStart: '5px' }), dangerouslySetInnerHTML: {
|
|
30
30
|
__html: 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)
|
|
31
31
|
}, onClick: handleClick })),
|
|
32
32
|
isShowClose && (React.createElement("button", { "aria-label": 'close', className: 'consentPopupDisplay-close', onClick: handleClickClose },
|