pb-sxp-ui 1.15.2 → 1.15.4
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 +658 -164
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +101 -0
- package/dist/index.js +658 -164
- package/dist/index.js.map +1 -1
- package/dist/index.min.cjs +4 -4
- package/dist/index.min.cjs.map +1 -1
- package/dist/index.min.js +4 -4
- package/dist/index.min.js.map +1 -1
- package/dist/pb-ui.js +658 -164
- package/dist/pb-ui.js.map +1 -1
- package/dist/pb-ui.min.js +4 -4
- package/dist/pb-ui.min.js.map +1 -1
- package/es/core/components/Consent/index.js +0 -1
- package/es/core/components/SxpPageRender/ConsentPopup.js +9 -9
- package/es/core/components/SxpPageRender/Navbar.js +1 -1
- package/es/core/components/SxpPageRender/index.js +12 -9
- package/es/core/context/SxpDataSourceProvider.d.ts +2 -0
- package/es/core/context/SxpDataSourceProvider.js +75 -36
- package/es/core/utils/materials.js +5 -3
- package/es/materials/sxp/consentPopup/Click/index.d.ts +19 -0
- package/es/materials/sxp/consentPopup/Click/index.js +37 -0
- package/es/materials/sxp/consentPopup/Click/material.d.ts +2 -0
- package/es/materials/sxp/consentPopup/Click/material.js +48 -0
- package/es/materials/sxp/consentPopup/Click/settingRender.d.ts +63 -0
- package/es/materials/sxp/consentPopup/Click/settingRender.js +210 -0
- package/es/materials/sxp/consentPopup/Display/index.d.ts +2 -2
- package/es/materials/sxp/consentPopup/Display/index.js +7 -5
- package/es/materials/sxp/consentPopup/Swipe/index.d.ts +13 -0
- package/es/materials/sxp/consentPopup/Swipe/index.js +58 -0
- package/es/materials/sxp/consentPopup/Swipe/material.d.ts +2 -0
- package/es/materials/sxp/consentPopup/Swipe/material.js +25 -0
- package/es/materials/sxp/consentPopup/Swipe/settingRender.d.ts +29 -0
- package/es/materials/sxp/consentPopup/Swipe/settingRender.js +48 -0
- package/es/materials/sxp/consentPopup/index.d.ts +2 -0
- package/es/materials/sxp/consentPopup/index.js +2 -0
- package/es/materials/sxp/cta/AniLink/index.js +1 -1
- package/es/materials/sxp/cta/AniLinkPopup/index.js +1 -1
- package/es/materials/sxp/popup/ConsentDetail/index.d.ts +2 -1
- package/es/materials/sxp/popup/ConsentDetail/index.js +2 -2
- package/lib/core/components/Consent/index.js +0 -1
- package/lib/core/components/SxpPageRender/ConsentPopup.js +8 -8
- package/lib/core/components/SxpPageRender/Navbar.js +1 -1
- package/lib/core/components/SxpPageRender/index.js +12 -9
- package/lib/core/context/SxpDataSourceProvider.d.ts +2 -0
- package/lib/core/context/SxpDataSourceProvider.js +75 -36
- package/lib/core/utils/materials.js +5 -3
- package/lib/materials/sxp/consentPopup/Click/index.d.ts +19 -0
- package/lib/materials/sxp/consentPopup/Click/index.js +39 -0
- package/lib/materials/sxp/consentPopup/Click/material.d.ts +2 -0
- package/lib/materials/sxp/consentPopup/Click/material.js +52 -0
- package/lib/materials/sxp/consentPopup/Click/settingRender.d.ts +63 -0
- package/lib/materials/sxp/consentPopup/Click/settingRender.js +212 -0
- package/lib/materials/sxp/consentPopup/Display/index.d.ts +2 -2
- package/lib/materials/sxp/consentPopup/Display/index.js +7 -5
- package/lib/materials/sxp/consentPopup/Swipe/index.d.ts +13 -0
- package/lib/materials/sxp/consentPopup/Swipe/index.js +60 -0
- package/lib/materials/sxp/consentPopup/Swipe/material.d.ts +2 -0
- package/lib/materials/sxp/consentPopup/Swipe/material.js +29 -0
- package/lib/materials/sxp/consentPopup/Swipe/settingRender.d.ts +29 -0
- package/lib/materials/sxp/consentPopup/Swipe/settingRender.js +50 -0
- package/lib/materials/sxp/consentPopup/index.d.ts +2 -0
- package/lib/materials/sxp/consentPopup/index.js +2 -0
- package/lib/materials/sxp/cta/AniLink/index.js +1 -1
- package/lib/materials/sxp/cta/AniLinkPopup/index.js +1 -1
- package/lib/materials/sxp/popup/ConsentDetail/index.d.ts +2 -1
- package/lib/materials/sxp/popup/ConsentDetail/index.js +2 -2
- package/package.json +1 -1
@@ -50,6 +50,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
50
50
|
const [channel, setChannel] = (0, react_1.useState)();
|
51
51
|
const [eventTimeList, setEventTimeList] = (0, react_1.useState)([]);
|
52
52
|
const [playbookType, setPlaybookType] = (0, react_1.useState)();
|
53
|
+
const [chatlabsId, setChatlabsId] = (0, react_1.useState)();
|
53
54
|
const finalPageData = (0, react_1.useMemo)(() => pageData !== null && pageData !== void 0 ? pageData : data, [pageData, data]);
|
54
55
|
const isShowConsent = (0, react_1.useMemo)(() => {
|
55
56
|
var _a, _b, _c, _d;
|
@@ -102,41 +103,35 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
102
103
|
const bffDataSource = (0, react_1.useMemo)(() => {
|
103
104
|
return dataSources === null || dataSources === void 0 ? void 0 : dataSources.find((d) => d.type === DataSourceType.BFF);
|
104
105
|
}, [dataSources]);
|
106
|
+
const fakeUserId = (0, react_1.useMemo)(() => {
|
107
|
+
var _a;
|
108
|
+
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)();
|
109
|
+
}, [bffDataSource]);
|
105
110
|
const bffFetch = (0, react_1.useCallback)((path, options) => {
|
106
111
|
if (!bffDataSource)
|
107
112
|
return;
|
108
113
|
const url = bffDataSource.url;
|
109
|
-
const fakeUserId = (0, localStore_1.storeAndLoadFeUserId)();
|
110
114
|
if (options === null || options === void 0 ? void 0 : options.query) {
|
111
115
|
const queryString = qs_1.default.stringify(options.query);
|
112
116
|
path = `${path}?${queryString}`;
|
113
117
|
}
|
114
118
|
if (options.type === 'beacon' && navigator.sendBeacon) {
|
115
|
-
return navigator.sendBeacon(`${url}/api
|
119
|
+
return navigator.sendBeacon(`${url}/api/${path}`, new Blob([
|
116
120
|
JSON.stringify(Object.assign(Object.assign(Object.assign({}, options.body), bffDataSource.headers), { 'x-user-id': fakeUserId }))
|
117
121
|
], { type: 'application/json;charset=UTF-8' }));
|
118
122
|
}
|
119
123
|
return window
|
120
|
-
.fetch(`${url}/api
|
124
|
+
.fetch(`${url}/api/${path}`, {
|
121
125
|
headers: Object.assign({ 'Content-Type': 'application/json', 'x-user-id': fakeUserId }, bffDataSource.headers),
|
122
126
|
method: options.method,
|
123
127
|
body: JSON.stringify(options.body)
|
124
128
|
})
|
125
129
|
.then((res) => res.json())
|
126
130
|
.catch((err) => Promise.reject(err));
|
127
|
-
}, [bffDataSource]);
|
131
|
+
}, [bffDataSource, fakeUserId]);
|
128
132
|
const getRecommendVideos = (0, react_1.useCallback)((query) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
129
133
|
var _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
130
|
-
query = {
|
131
|
-
maxSize: (_f = query === null || query === void 0 ? void 0 : query.maxSize) !== null && _f !== void 0 ? _f : maxSize,
|
132
|
-
defaultSize: (_g = query === null || query === void 0 ? void 0 : query.defaultSize) !== null && _g !== void 0 ? _g : defaultSize,
|
133
|
-
hashTag: query === null || query === void 0 ? void 0 : query.hashTag,
|
134
|
-
traceInfo: query === null || query === void 0 ? void 0 : query.traceInfo,
|
135
|
-
themeTag: query === null || query === void 0 ? void 0 : query.themeTag,
|
136
|
-
pageNum: query === null || query === void 0 ? void 0 : query.pageNum,
|
137
|
-
contentFilter: query === null || query === void 0 ? void 0 : query.contentFilter,
|
138
|
-
productFilter: query === null || query === void 0 ? void 0 : query.productFilter
|
139
|
-
};
|
134
|
+
query = 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 }));
|
140
135
|
if (channel) {
|
141
136
|
query = Object.assign(Object.assign({}, query), { channel: decodeURIComponent(channel) });
|
142
137
|
}
|
@@ -161,14 +156,16 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
161
156
|
const recurveRecList = (query) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
162
157
|
var _v, _w, _x, _y, _z, _0;
|
163
158
|
query.pageNum = pageNum;
|
164
|
-
result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/recommend/list', { method: 'POST', body: query }));
|
159
|
+
result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/recommend/list', { method: 'POST', body: query }));
|
165
160
|
if (!(result === null || result === void 0 ? void 0 : result.success)) {
|
166
161
|
return undefined;
|
167
162
|
}
|
168
163
|
setLoading(false);
|
169
164
|
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 : []);
|
170
|
-
|
171
|
-
|
165
|
+
if ((rtcList === null || rtcList === void 0 ? void 0 : rtcList.length) === 0) {
|
166
|
+
setRtcList(getFilterRecList(Object.assign(Object.assign({}, result === null || result === void 0 ? void 0 : result.data), { recList: list })));
|
167
|
+
setCacheRtcList(getFilterRecList(Object.assign(Object.assign({}, result === null || result === void 0 ? void 0 : result.data), { recList: list })));
|
168
|
+
}
|
172
169
|
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));
|
173
170
|
if (isNotNullList) {
|
174
171
|
pageNum = pageNum + 1;
|
@@ -178,12 +175,12 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
178
175
|
yield recurveRecList(query);
|
179
176
|
if (!(query === null || query === void 0 ? void 0 : query.hashTag) && result)
|
180
177
|
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 });
|
181
|
-
return Object.assign(Object.assign({}, result.data), { recList: list });
|
178
|
+
return Object.assign(Object.assign({}, result === null || result === void 0 ? void 0 : result.data), { recList: list });
|
182
179
|
}
|
183
180
|
if (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview) {
|
184
181
|
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 });
|
185
182
|
}
|
186
|
-
const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/recommend/list', { method: 'POST', body: query }));
|
183
|
+
const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/recommend/list', { method: 'POST', body: query }));
|
187
184
|
if (!(result === null || result === void 0 ? void 0 : result.success)) {
|
188
185
|
return undefined;
|
189
186
|
}
|
@@ -199,7 +196,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
199
196
|
return Object.assign(Object.assign({}, result.data), { recList: list });
|
200
197
|
}
|
201
198
|
return result === null || result === void 0 ? void 0 : result.data;
|
202
|
-
}), [bffFetch, utmVal, maxSize, defaultSize, channelQueryList, channel]);
|
199
|
+
}), [bffFetch, utmVal, maxSize, defaultSize, channelQueryList, channel, chatlabsId]);
|
203
200
|
const loadVideos = (0, react_1.useCallback)((pageNum) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
204
201
|
var _1, _2, _3, _4;
|
205
202
|
if (rtcList.length <= 0) {
|
@@ -233,6 +230,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
233
230
|
return expire;
|
234
231
|
}, [data]);
|
235
232
|
const bffEventReport = (0, react_1.useCallback)(({ userInfo, eventInfo, reportLayId = true }) => {
|
233
|
+
var _a, _b;
|
236
234
|
if (!enableReportEvent || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview)) {
|
237
235
|
return;
|
238
236
|
}
|
@@ -240,7 +238,15 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
240
238
|
userInfo = {};
|
241
239
|
}
|
242
240
|
const sessionID = (0, sessionStore_1.storeAndLoadFeSessionId)();
|
243
|
-
const
|
241
|
+
const params = {};
|
242
|
+
const queryString = location.search.slice(1);
|
243
|
+
(_a = (0, tool_1.splitUrlParams)(queryString)) === null || _a === void 0 ? void 0 : _a.map((val) => {
|
244
|
+
const key = val.split('=')[0];
|
245
|
+
const value = val.split('=')[1];
|
246
|
+
params[key] = value;
|
247
|
+
});
|
248
|
+
const cl_source = params === null || params === void 0 ? void 0 : params.cl_source;
|
249
|
+
const ef = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ sessionID, rtc: curReqInfo.rtc, requestId: curReqInfo.requestId }, { playbookType }), (layoutVariantId && reportLayId && { layoutVariantId })), eventInfo), ((eventInfo === null || eventInfo === void 0 ? void 0 : eventInfo.position) && channel && { position: Number(eventInfo === null || eventInfo === void 0 ? void 0 : eventInfo.position) + 1 + '' })), (cl_source && { clSource: cl_source }));
|
244
250
|
const realUserInfo = Object.entries(userInfo).map(([k, v]) => ({ name: k, value: v }));
|
245
251
|
const realEventInfo = Object.entries(ef)
|
246
252
|
.map(([k, v]) => v && { name: k, value: v })
|
@@ -249,14 +255,23 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
249
255
|
console.log('userInfo:', userInfo);
|
250
256
|
console.log('eventInfo:', ef);
|
251
257
|
console.log('========= 结束 =========');
|
252
|
-
return bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch(
|
258
|
+
return bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch(`v2/event/report/CLD/${(_b = bffDataSource === null || bffDataSource === void 0 ? void 0 : bffDataSource.headers) === null || _b === void 0 ? void 0 : _b['x-app-id']}/${eventInfo === null || eventInfo === void 0 ? void 0 : eventInfo.eventSubject}`, {
|
253
259
|
method: 'POST',
|
254
260
|
body: { userInfo: realUserInfo, eventInfo: realEventInfo },
|
255
261
|
type: 'beacon'
|
256
262
|
});
|
257
|
-
}, [
|
263
|
+
}, [
|
264
|
+
bffFetch,
|
265
|
+
curReqInfo,
|
266
|
+
enableReportEvent,
|
267
|
+
globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview,
|
268
|
+
layoutVariantId,
|
269
|
+
globalConfig,
|
270
|
+
playbookType,
|
271
|
+
bffDataSource
|
272
|
+
]);
|
258
273
|
const bffFbReport = (0, react_1.useCallback)(({ eventName, product }) => {
|
259
|
-
var _a, _b, _c, _d, _e;
|
274
|
+
var _a, _b, _c, _d, _e, _f;
|
260
275
|
if (!enableReportEvent ||
|
261
276
|
!enabledMetaConversionApi ||
|
262
277
|
(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview) ||
|
@@ -268,7 +283,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
268
283
|
const fbclid = urlParams === null || urlParams === void 0 ? void 0 : urlParams.get('fbclid');
|
269
284
|
const fix_par = {
|
270
285
|
event_source_url: (_c = window === null || window === void 0 ? void 0 : window.location) === null || _c === void 0 ? void 0 : _c.href,
|
271
|
-
external_id:
|
286
|
+
external_id: fakeUserId,
|
272
287
|
client_user_agent: (_e = (_d = window === null || window === void 0 ? void 0 : window.navigator) === null || _d === void 0 ? void 0 : _d.userAgent) !== null && _e !== void 0 ? _e : '',
|
273
288
|
fbc: fbclid ? `fb.2.${new Date().getTime()}.${fbclid}` : '',
|
274
289
|
fbp: (0, tool_1.getCookie)('_fbp') ? `fb.2.${new Date().getTime()}.${(0, tool_1.getCookie)('_fbp')}` : '',
|
@@ -320,22 +335,30 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
320
335
|
}
|
321
336
|
};
|
322
337
|
getEventParams(jsonParams);
|
323
|
-
return bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch(
|
338
|
+
return bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch(`v2/event/report/FB/${(_f = bffDataSource === null || bffDataSource === void 0 ? void 0 : bffDataSource.headers) === null || _f === void 0 ? void 0 : _f['x-app-id']}/${eventName}`, {
|
324
339
|
method: 'POST',
|
325
340
|
body: jsonParams,
|
326
341
|
type: 'beacon'
|
327
342
|
});
|
328
|
-
}, [
|
343
|
+
}, [
|
344
|
+
bffFetch,
|
345
|
+
enableReportEvent,
|
346
|
+
enabledMetaConversionApi,
|
347
|
+
globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview,
|
348
|
+
globalConfig,
|
349
|
+
fakeUserId,
|
350
|
+
bffDataSource
|
351
|
+
]);
|
329
352
|
const bffMutateLike = (0, react_1.useCallback)((body) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
330
|
-
const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/recommend/like', { method: 'POST', body }));
|
353
|
+
const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/recommend/like', { method: 'POST', body }));
|
331
354
|
return res === null || res === void 0 ? void 0 : res.success;
|
332
355
|
}), [bffFetch]);
|
333
356
|
const bffMutateUnlike = (0, react_1.useCallback)((body) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
334
|
-
const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/recommend/unlike', { method: 'POST', body }));
|
357
|
+
const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/recommend/unlike', { method: 'POST', body }));
|
335
358
|
return res === null || res === void 0 ? void 0 : res.success;
|
336
359
|
}), [bffFetch]);
|
337
360
|
const bffSubmitForm = (0, react_1.useCallback)((body) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
338
|
-
const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/customform', { method: 'POST', body }));
|
361
|
+
const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/customform', { method: 'POST', body }));
|
339
362
|
return res === null || res === void 0 ? void 0 : res.success;
|
340
363
|
}), [bffFetch]);
|
341
364
|
const bffGetTagList = (0, react_1.useCallback)((data) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
@@ -349,7 +372,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
349
372
|
const key = val.split('=')[0];
|
350
373
|
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);
|
351
374
|
})) === null || _9 === void 0 ? void 0 : _9.join('&')) !== null && _10 !== void 0 ? _10 : '';
|
352
|
-
const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/tag/list', { method: 'GET', query: { channel: decodeURIComponent(val) } }));
|
375
|
+
const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/tag/list', { method: 'GET', query: { channel: decodeURIComponent(val) } }));
|
353
376
|
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 : []);
|
354
377
|
}
|
355
378
|
catch (e) {
|
@@ -404,12 +427,26 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
404
427
|
utmContent: getVal('utm_content'),
|
405
428
|
enterTime: Math.floor(time / 1000) + '',
|
406
429
|
requestId: null,
|
407
|
-
enterUrl: (_c = (_b = window === null || window === void 0 ? void 0 : window.location) === null || _b === void 0 ? void 0 : _b.href) !== null && _c !== void 0 ? _c : ''
|
408
|
-
clSource: getVal('cl_source')
|
430
|
+
enterUrl: (_c = (_b = window === null || window === void 0 ? void 0 : window.location) === null || _b === void 0 ? void 0 : _b.href) !== null && _c !== void 0 ? _c : ''
|
409
431
|
},
|
410
432
|
reportLayId: false
|
411
433
|
});
|
412
434
|
}, [bffEventReport]);
|
435
|
+
const getAccount = (0, react_1.useCallback)(() => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
436
|
+
var _13, _14;
|
437
|
+
const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/account', { method: 'GET' }));
|
438
|
+
setChatlabsId((_13 = res === null || res === void 0 ? void 0 : res.data) === null || _13 === void 0 ? void 0 : _13.chatLabsId);
|
439
|
+
return ((_14 = res === null || res === void 0 ? void 0 : res.data) === null || _14 === void 0 ? void 0 : _14.consentResult) === 'true';
|
440
|
+
}), [bffFetch]);
|
441
|
+
const accountSonsent = (0, react_1.useCallback)((consentResult) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
442
|
+
const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/account/consent', {
|
443
|
+
method: 'POST',
|
444
|
+
body: {
|
445
|
+
consentResult
|
446
|
+
}
|
447
|
+
}));
|
448
|
+
return res === null || res === void 0 ? void 0 : res.success;
|
449
|
+
}), [bffFetch]);
|
413
450
|
(0, react_1.useEffect)(() => {
|
414
451
|
if (!isShowConsent)
|
415
452
|
h5EnterLink();
|
@@ -428,10 +465,10 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
428
465
|
let curData;
|
429
466
|
let gldata;
|
430
467
|
if (data === null || data === void 0 ? void 0 : data.layoutVariantId) {
|
468
|
+
layId = data === null || data === void 0 ? void 0 : data.layoutVariantId;
|
469
|
+
setLayoutVariantId(data === null || data === void 0 ? void 0 : data.layoutVariantId);
|
431
470
|
const id = (_b = (_a = data === null || data === void 0 ? void 0 : data.layoutVariantId) === null || _a === void 0 ? void 0 : _a.split('-')) === null || _b === void 0 ? void 0 : _b[1];
|
432
471
|
if (id) {
|
433
|
-
layId = id;
|
434
|
-
setLayoutVariantId(id);
|
435
472
|
curData = dataList === null || dataList === void 0 ? void 0 : dataList.find((item) => (item === null || item === void 0 ? void 0 : item.id) === id);
|
436
473
|
if (curData) {
|
437
474
|
setPageData(curData);
|
@@ -557,7 +594,9 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
557
594
|
eventTimeList,
|
558
595
|
setEventTimeList,
|
559
596
|
multiPostTimeRef,
|
560
|
-
refreshFeSession
|
597
|
+
refreshFeSession,
|
598
|
+
getAccount,
|
599
|
+
accountSonsent
|
561
600
|
} }, 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({
|
562
601
|
rtcList,
|
563
602
|
mutateLike: bffMutateLike,
|
@@ -38,14 +38,16 @@ const getBgStyleByImg = (data) => {
|
|
38
38
|
exports.getBgStyleByImg = getBgStyleByImg;
|
39
39
|
const getPriceText = ({ product, enableFormattedPrice, globalConfig, isHiddenDef, style }) => {
|
40
40
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
41
|
+
let text = '';
|
41
42
|
if ((!(product === null || product === void 0 ? void 0 : product.currency) || !(product === null || product === void 0 ? void 0 : product.price)) && isHiddenDef)
|
42
43
|
return null;
|
43
|
-
let price = (product === null || product === void 0 ? void 0 : product.currency) && (product === null || product === void 0 ? void 0 : product.price) ? product === null || product === void 0 ? void 0 : product.price : 7000;
|
44
|
-
|
44
|
+
let price = Number((product === null || product === void 0 ? void 0 : product.currency) && (product === null || product === void 0 ? void 0 : product.price) ? product === null || product === void 0 ? void 0 : product.price : 7000);
|
45
|
+
if (typeof price !== 'number')
|
46
|
+
return text;
|
45
47
|
let priceSymbol = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.priceSymbol;
|
46
48
|
let currency = (product === null || product === void 0 ? void 0 : product.currency) ? (_c = (_b = (_a = product === null || product === void 0 ? void 0 : product.currency) === null || _a === void 0 ? void 0 : _a.split('-')[1]) === null || _b === void 0 ? void 0 : _b.toUpperCase()) !== null && _c !== void 0 ? _c : '' : '$';
|
47
49
|
const isToLocStr = enableFormattedPrice === undefined || enableFormattedPrice;
|
48
|
-
let decPic = price.toString();
|
50
|
+
let decPic = price === null || price === void 0 ? void 0 : price.toString();
|
49
51
|
if (priceSymbol === null || priceSymbol === void 0 ? void 0 : priceSymbol.showTwoDecimalPoint) {
|
50
52
|
decPic = price === null || price === void 0 ? void 0 : price.toFixed(2);
|
51
53
|
}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
import React, { CSSProperties } from 'react';
|
2
|
+
import './index.less';
|
3
|
+
export interface IClickProps {
|
4
|
+
open?: boolean;
|
5
|
+
content?: string;
|
6
|
+
style?: Record<string, any>;
|
7
|
+
isTel?: boolean;
|
8
|
+
acceptButton?: {
|
9
|
+
text?: string;
|
10
|
+
style?: CSSProperties;
|
11
|
+
};
|
12
|
+
rejectButton?: {
|
13
|
+
text?: string;
|
14
|
+
style?: CSSProperties;
|
15
|
+
};
|
16
|
+
consentPopupCate?: string;
|
17
|
+
}
|
18
|
+
declare const _default: React.NamedExoticComponent<IClickProps>;
|
19
|
+
export default _default;
|
@@ -0,0 +1,39 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
const tslib_1 = require("tslib");
|
4
|
+
const react_1 = tslib_1.__importStar(require("react"));
|
5
|
+
require("./index.less");
|
6
|
+
const ConsentDetail_1 = tslib_1.__importDefault(require("../../popup/ConsentDetail"));
|
7
|
+
const tel_png_1 = tslib_1.__importDefault(require("./tel.png"));
|
8
|
+
const tool_1 = require("../../../../core/utils/tool");
|
9
|
+
const hooks_1 = require("../../../../core/hooks");
|
10
|
+
const Click = (_a) => {
|
11
|
+
var { isTel, open, content, style, consentPopupCate, acceptButton, rejectButton } = _a, props = tslib_1.__rest(_a, ["isTel", "open", "content", "style", "consentPopupCate", "acceptButton", "rejectButton"]);
|
12
|
+
const { getAccount, accountSonsent } = (0, hooks_1.useSxpDataSource)();
|
13
|
+
const [consentResult, setConsentResult] = (0, react_1.useState)(false);
|
14
|
+
const handleGetAccount = () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
15
|
+
const res = yield (getAccount === null || getAccount === void 0 ? void 0 : getAccount());
|
16
|
+
setConsentResult(res);
|
17
|
+
});
|
18
|
+
(0, react_1.useEffect)(() => {
|
19
|
+
handleGetAccount();
|
20
|
+
}, []);
|
21
|
+
const visivle = (0, react_1.useMemo)(() => {
|
22
|
+
return consentPopupCate || (open && style && !consentResult);
|
23
|
+
}, [consentPopupCate, open, style, consentResult]);
|
24
|
+
const handleClick = (v) => {
|
25
|
+
accountSonsent === null || accountSonsent === void 0 ? void 0 : accountSonsent(v);
|
26
|
+
setConsentResult(true);
|
27
|
+
};
|
28
|
+
return (react_1.default.createElement(react_1.default.Fragment, null, isTel ? (react_1.default.createElement("img", { src: tel_png_1.default, style: { objectFit: 'cover', width: '100%', height: '100%' } })) : (react_1.default.createElement(react_1.default.Fragment, null, visivle && (react_1.default.createElement("div", { className: 'consentPopupClick' },
|
29
|
+
react_1.default.createElement("div", { className: 'consentPopupClick-container', style: style },
|
30
|
+
react_1.default.createElement("div", { className: 'consentPopupClick-container-content' },
|
31
|
+
react_1.default.createElement(ConsentDetail_1.default, { content: content, style: { padding: 0 } })),
|
32
|
+
react_1.default.createElement("button", { style: acceptButton === null || acceptButton === void 0 ? void 0 : acceptButton.style, onClick: () => handleClick(true), dangerouslySetInnerHTML: {
|
33
|
+
__html: (0, tool_1.setFontForText)(acceptButton === null || acceptButton === void 0 ? void 0 : acceptButton.text, acceptButton === null || acceptButton === void 0 ? void 0 : acceptButton.style)
|
34
|
+
} }),
|
35
|
+
react_1.default.createElement("button", { style: rejectButton === null || rejectButton === void 0 ? void 0 : rejectButton.style, onClick: () => handleClick(false), dangerouslySetInnerHTML: {
|
36
|
+
__html: (0, tool_1.setFontForText)(rejectButton === null || rejectButton === void 0 ? void 0 : rejectButton.text, rejectButton === null || rejectButton === void 0 ? void 0 : rejectButton.style)
|
37
|
+
} }))))))));
|
38
|
+
};
|
39
|
+
exports.default = (0, react_1.memo)(Click);
|
@@ -0,0 +1,52 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.Click = void 0;
|
4
|
+
const tslib_1 = require("tslib");
|
5
|
+
const settingRender_1 = tslib_1.__importDefault(require("./settingRender"));
|
6
|
+
const _1 = tslib_1.__importDefault(require("."));
|
7
|
+
const create_1 = require("../../../../core/create");
|
8
|
+
const Click = (0, create_1.createMaterial)(_1.default, {
|
9
|
+
displayName: 'Click Consent',
|
10
|
+
icon: '',
|
11
|
+
category: 'consentPopup',
|
12
|
+
type: 'Click',
|
13
|
+
related: {
|
14
|
+
settingRender: settingRender_1.default,
|
15
|
+
bindableProps: []
|
16
|
+
},
|
17
|
+
defaulSetting: {
|
18
|
+
props: {
|
19
|
+
content: '<p><strong><span style="font-size:14px"><span style="line-height:3">Your Cookie Preferences</span></span></strong></p><p>We use cookie, including third-party cookies, to ensure the proper functioning and security of this site, to analyse its use, and to show you personalised content. You can authorise the use of all cookies by clicking on "Accept all cookies". If you click on "Reject all cookies", we will only use cookies necessary for the proper functioning and security of this site. To personalise on adjust your preferences at any time, click on "Cookies Settings" below or at the bottom of any Fendi.com webpage. For more information, read our Cookie Policy.</p><p></p>',
|
20
|
+
acceptButton: {
|
21
|
+
text: 'Accept all cookies',
|
22
|
+
style: {
|
23
|
+
backgroundColor: '#000',
|
24
|
+
height: 45,
|
25
|
+
color: '#fff',
|
26
|
+
fontSize: 12,
|
27
|
+
textAlign: 'center',
|
28
|
+
marginTop: 5,
|
29
|
+
marginBottom: 5
|
30
|
+
}
|
31
|
+
},
|
32
|
+
rejectButton: {
|
33
|
+
text: 'Reject all cookies',
|
34
|
+
style: {
|
35
|
+
backgroundColor: '#000',
|
36
|
+
height: 45,
|
37
|
+
color: '#fff',
|
38
|
+
fontSize: 12,
|
39
|
+
textAlign: 'center',
|
40
|
+
marginTop: 5,
|
41
|
+
marginBottom: 5
|
42
|
+
}
|
43
|
+
}
|
44
|
+
},
|
45
|
+
style: {
|
46
|
+
backgroundColor: '#fff',
|
47
|
+
padding: 18
|
48
|
+
}
|
49
|
+
},
|
50
|
+
sort: 2
|
51
|
+
});
|
52
|
+
exports.Click = Click;
|
@@ -0,0 +1,63 @@
|
|
1
|
+
declare const _default: ({
|
2
|
+
title: string;
|
3
|
+
child: {
|
4
|
+
type: string;
|
5
|
+
name: string[];
|
6
|
+
}[];
|
7
|
+
} | {
|
8
|
+
title: string;
|
9
|
+
child: ({
|
10
|
+
type: string;
|
11
|
+
label: string;
|
12
|
+
name: string[];
|
13
|
+
addonAfter?: undefined;
|
14
|
+
child?: undefined;
|
15
|
+
} | {
|
16
|
+
type: string;
|
17
|
+
label: string;
|
18
|
+
name: string[];
|
19
|
+
addonAfter: string;
|
20
|
+
child?: undefined;
|
21
|
+
} | {
|
22
|
+
type: string;
|
23
|
+
label: string;
|
24
|
+
child: ({
|
25
|
+
type: string;
|
26
|
+
name: string[];
|
27
|
+
max: number;
|
28
|
+
addonAfter?: undefined;
|
29
|
+
} | {
|
30
|
+
type: string;
|
31
|
+
name: string[];
|
32
|
+
addonAfter: string;
|
33
|
+
max: number;
|
34
|
+
})[];
|
35
|
+
name?: undefined;
|
36
|
+
addonAfter?: undefined;
|
37
|
+
} | {
|
38
|
+
type: string;
|
39
|
+
label: string;
|
40
|
+
child: {
|
41
|
+
type: string;
|
42
|
+
name: string[];
|
43
|
+
bottomText: string;
|
44
|
+
}[];
|
45
|
+
name?: undefined;
|
46
|
+
addonAfter?: undefined;
|
47
|
+
} | {
|
48
|
+
type: string;
|
49
|
+
label: string;
|
50
|
+
child: ({
|
51
|
+
type: string;
|
52
|
+
name: string[];
|
53
|
+
addonAfter?: undefined;
|
54
|
+
} | {
|
55
|
+
type: string;
|
56
|
+
name: string[];
|
57
|
+
addonAfter: string;
|
58
|
+
})[];
|
59
|
+
name?: undefined;
|
60
|
+
addonAfter?: undefined;
|
61
|
+
})[];
|
62
|
+
})[];
|
63
|
+
export default _default;
|