pb-sxp-ui 1.15.3 → 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 +98 -54
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +13 -1
- package/dist/index.js +98 -54
- 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 +98 -54
- 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 +2 -2
- package/es/core/components/SxpPageRender/index.js +7 -7
- package/es/core/context/SxpDataSourceProvider.d.ts +2 -0
- package/es/core/context/SxpDataSourceProvider.js +23 -16
- package/es/materials/sxp/consentPopup/Click/index.js +28 -10
- package/es/materials/sxp/consentPopup/Click/settingRender.js +1 -1
- package/es/materials/sxp/consentPopup/Swipe/index.d.ts +1 -0
- package/es/materials/sxp/consentPopup/Swipe/index.js +26 -12
- package/es/materials/sxp/consentPopup/Swipe/material.js +2 -1
- package/es/materials/sxp/consentPopup/Swipe/settingRender.js +5 -0
- package/lib/core/components/Consent/index.js +0 -1
- package/lib/core/components/SxpPageRender/ConsentPopup.js +2 -2
- package/lib/core/components/SxpPageRender/index.js +7 -7
- package/lib/core/context/SxpDataSourceProvider.d.ts +2 -0
- package/lib/core/context/SxpDataSourceProvider.js +23 -16
- package/lib/materials/sxp/consentPopup/Click/index.js +26 -8
- package/lib/materials/sxp/consentPopup/Click/settingRender.js +1 -1
- package/lib/materials/sxp/consentPopup/Swipe/index.d.ts +1 -0
- package/lib/materials/sxp/consentPopup/Swipe/index.js +24 -10
- package/lib/materials/sxp/consentPopup/Swipe/material.js +2 -1
- package/lib/materials/sxp/consentPopup/Swipe/settingRender.js +5 -0
- package/package.json +1 -1
@@ -29,7 +29,6 @@ const Consent = ({ width = window.innerWidth, height = window.innerHeight, priva
|
|
29
29
|
utmCampaign: getUtmValue('utm_campaign'),
|
30
30
|
utmId: getUtmValue('utm_id'),
|
31
31
|
utmContent: getUtmValue('utm_content'),
|
32
|
-
clSource: getUtmValue('cl_source'),
|
33
32
|
enterTime: `${Date.now()}`,
|
34
33
|
enterUrl: window.location.href,
|
35
34
|
rtc: null,
|
@@ -3,10 +3,10 @@ import './index.less';
|
|
3
3
|
import withBindDataSource from '../../../core/hoc/withBindDataSource';
|
4
4
|
import { useEditorDataProvider } from '../../../core/context/EditorDataProvider';
|
5
5
|
const Consent = ({ resolver, globalConfig }) => {
|
6
|
-
var _a, _b;
|
6
|
+
var _a, _b, _c;
|
7
7
|
const { consentPopupCate } = useEditorDataProvider();
|
8
8
|
const value = (_b = (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.consentPopup) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.item;
|
9
|
-
if (!value)
|
9
|
+
if (!value || (!consentPopupCate && !((_c = value === null || value === void 0 ? void 0 : value.props) === null || _c === void 0 ? void 0 : _c.open)))
|
10
10
|
return null;
|
11
11
|
const t = resolver === null || resolver === void 0 ? void 0 : resolver[value === null || value === void 0 ? void 0 : value.type];
|
12
12
|
const Component = withBindDataSource(t);
|
@@ -411,7 +411,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
411
411
|
}
|
412
412
|
};
|
413
413
|
const handleScrollEvent = (swiper) => {
|
414
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
414
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
|
415
415
|
const item = data[swiper.previousIndex];
|
416
416
|
if (!item)
|
417
417
|
return;
|
@@ -430,9 +430,9 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
430
430
|
contentId: (_e = (_d = item === null || item === void 0 ? void 0 : item.video) === null || _d === void 0 ? void 0 : _d.itemId) !== null && _e !== void 0 ? _e : '',
|
431
431
|
productId: (_g = (_f = item === null || item === void 0 ? void 0 : item.product) === null || _f === void 0 ? void 0 : _f.itemId) !== null && _g !== void 0 ? _g : '',
|
432
432
|
requestId: null,
|
433
|
-
traceInfo: (_j = (_h = item === null || item === void 0 ? void 0 : item.video) === null || _h === void 0 ? void 0 : _h.traceInfo) !== null && _j !== void 0 ? _j : '',
|
433
|
+
traceInfo: (_l = (_j = (_h = item === null || item === void 0 ? void 0 : item.video) === null || _h === void 0 ? void 0 : _h.traceInfo) !== null && _j !== void 0 ? _j : (_k = item === null || item === void 0 ? void 0 : item.product) === null || _k === void 0 ? void 0 : _k.traceInfo) !== null && _l !== void 0 ? _l : '',
|
434
434
|
contentFormat,
|
435
|
-
position: ((
|
435
|
+
position: ((_m = swiper.previousIndex) !== null && _m !== void 0 ? _m : 0) + ''
|
436
436
|
}
|
437
437
|
});
|
438
438
|
handleViewImageStartEnd(item);
|
@@ -443,12 +443,12 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
443
443
|
eventInfo: {
|
444
444
|
eventSubject: 'scrollUp',
|
445
445
|
eventDescription: 'User scroll up',
|
446
|
-
contentId: (
|
447
|
-
productId: (
|
446
|
+
contentId: (_p = (_o = item === null || item === void 0 ? void 0 : item.video) === null || _o === void 0 ? void 0 : _o.itemId) !== null && _p !== void 0 ? _p : '',
|
447
|
+
productId: (_r = (_q = item.product) === null || _q === void 0 ? void 0 : _q.itemId) !== null && _r !== void 0 ? _r : '',
|
448
448
|
requestId: null,
|
449
|
-
traceInfo: (
|
449
|
+
traceInfo: (_v = (_t = (_s = item === null || item === void 0 ? void 0 : item.video) === null || _s === void 0 ? void 0 : _s.traceInfo) !== null && _t !== void 0 ? _t : (_u = item === null || item === void 0 ? void 0 : item.product) === null || _u === void 0 ? void 0 : _u.traceInfo) !== null && _v !== void 0 ? _v : '',
|
450
450
|
contentFormat,
|
451
|
-
position: ((
|
451
|
+
position: ((_w = swiper.previousIndex) !== null && _w !== void 0 ? _w : 0) + ''
|
452
452
|
}
|
453
453
|
});
|
454
454
|
handleViewImageStartEnd(item);
|
@@ -90,6 +90,8 @@ export interface ISxpDataSourceContext {
|
|
90
90
|
setEventTimeList?: React.Dispatch<React.SetStateAction<Array<IEventTimeType>>>;
|
91
91
|
multiPostTimeRef?: any;
|
92
92
|
refreshFeSession?: (enableReSid?: boolean, event?: (fk: string) => void) => void;
|
93
|
+
getAccount?: () => Promise<any>;
|
94
|
+
accountSonsent?: (v: boolean) => Promise<boolean>;
|
93
95
|
}
|
94
96
|
export declare const SxpDataSourceContext: React.Context<ISxpDataSourceContext>;
|
95
97
|
export interface SxpDataSourceProviderProps {
|
@@ -47,6 +47,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
47
47
|
const [channel, setChannel] = useState();
|
48
48
|
const [eventTimeList, setEventTimeList] = useState([]);
|
49
49
|
const [playbookType, setPlaybookType] = useState();
|
50
|
+
const [chatlabsId, setChatlabsId] = useState();
|
50
51
|
const finalPageData = useMemo(() => pageData !== null && pageData !== void 0 ? pageData : data, [pageData, data]);
|
51
52
|
const isShowConsent = useMemo(() => {
|
52
53
|
var _a, _b, _c, _d;
|
@@ -127,16 +128,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
127
128
|
}, [bffDataSource, fakeUserId]);
|
128
129
|
const getRecommendVideos = useCallback((query) => __awaiter(void 0, void 0, void 0, function* () {
|
129
130
|
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
|
-
};
|
131
|
+
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
132
|
if (channel) {
|
141
133
|
query = Object.assign(Object.assign({}, query), { channel: decodeURIComponent(channel) });
|
142
134
|
}
|
@@ -201,7 +193,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
201
193
|
return Object.assign(Object.assign({}, result.data), { recList: list });
|
202
194
|
}
|
203
195
|
return result === null || result === void 0 ? void 0 : result.data;
|
204
|
-
}), [bffFetch, utmVal, maxSize, defaultSize, channelQueryList, channel]);
|
196
|
+
}), [bffFetch, utmVal, maxSize, defaultSize, channelQueryList, channel, chatlabsId]);
|
205
197
|
const loadVideos = useCallback((pageNum) => __awaiter(void 0, void 0, void 0, function* () {
|
206
198
|
var _1, _2, _3, _4;
|
207
199
|
if (rtcList.length <= 0) {
|
@@ -250,9 +242,8 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
250
242
|
const value = val.split('=')[1];
|
251
243
|
params[key] = value;
|
252
244
|
});
|
253
|
-
console.log(params, '111');
|
254
245
|
const cl_source = params === null || params === void 0 ? void 0 : params.cl_source;
|
255
|
-
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 && { cl_source }));
|
246
|
+
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 }));
|
256
247
|
const realUserInfo = Object.entries(userInfo).map(([k, v]) => ({ name: k, value: v }));
|
257
248
|
const realEventInfo = Object.entries(ef)
|
258
249
|
.map(([k, v]) => v && { name: k, value: v })
|
@@ -433,12 +424,26 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
433
424
|
utmContent: getVal('utm_content'),
|
434
425
|
enterTime: Math.floor(time / 1000) + '',
|
435
426
|
requestId: null,
|
436
|
-
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 : ''
|
437
|
-
clSource: getVal('cl_source')
|
427
|
+
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 : ''
|
438
428
|
},
|
439
429
|
reportLayId: false
|
440
430
|
});
|
441
431
|
}, [bffEventReport]);
|
432
|
+
const getAccount = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
433
|
+
var _13, _14;
|
434
|
+
const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/account', { method: 'GET' }));
|
435
|
+
setChatlabsId((_13 = res === null || res === void 0 ? void 0 : res.data) === null || _13 === void 0 ? void 0 : _13.chatLabsId);
|
436
|
+
return ((_14 = res === null || res === void 0 ? void 0 : res.data) === null || _14 === void 0 ? void 0 : _14.consentResult) === 'true';
|
437
|
+
}), [bffFetch]);
|
438
|
+
const accountSonsent = useCallback((consentResult) => __awaiter(void 0, void 0, void 0, function* () {
|
439
|
+
const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/account/consent', {
|
440
|
+
method: 'POST',
|
441
|
+
body: {
|
442
|
+
consentResult
|
443
|
+
}
|
444
|
+
}));
|
445
|
+
return res === null || res === void 0 ? void 0 : res.success;
|
446
|
+
}), [bffFetch]);
|
442
447
|
useEffect(() => {
|
443
448
|
if (!isShowConsent)
|
444
449
|
h5EnterLink();
|
@@ -586,7 +591,9 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
586
591
|
eventTimeList,
|
587
592
|
setEventTimeList,
|
588
593
|
multiPostTimeRef,
|
589
|
-
refreshFeSession
|
594
|
+
refreshFeSession,
|
595
|
+
getAccount,
|
596
|
+
accountSonsent
|
590
597
|
} }, 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({
|
591
598
|
rtcList,
|
592
599
|
mutateLike: bffMutateLike,
|
@@ -1,19 +1,37 @@
|
|
1
|
-
import { __rest } from "tslib";
|
2
|
-
import React, { memo, useMemo } from 'react';
|
1
|
+
import { __awaiter, __rest } from "tslib";
|
2
|
+
import React, { memo, useEffect, useMemo, useState } from 'react';
|
3
3
|
import './index.less';
|
4
|
-
import tel from './tel.png';
|
5
4
|
import ConsentDetail from '../../popup/ConsentDetail';
|
5
|
+
import tel from './tel.png';
|
6
|
+
import { setFontForText } from '../../../../core/utils/tool';
|
7
|
+
import { useSxpDataSource } from '../../../../core/hooks';
|
6
8
|
const Click = (_a) => {
|
7
9
|
var { isTel, open, content, style, consentPopupCate, acceptButton, rejectButton } = _a, props = __rest(_a, ["isTel", "open", "content", "style", "consentPopupCate", "acceptButton", "rejectButton"]);
|
10
|
+
const { getAccount, accountSonsent } = useSxpDataSource();
|
11
|
+
const [consentResult, setConsentResult] = useState(false);
|
12
|
+
const handleGetAccount = () => __awaiter(void 0, void 0, void 0, function* () {
|
13
|
+
const res = yield (getAccount === null || getAccount === void 0 ? void 0 : getAccount());
|
14
|
+
setConsentResult(res);
|
15
|
+
});
|
16
|
+
useEffect(() => {
|
17
|
+
handleGetAccount();
|
18
|
+
}, []);
|
8
19
|
const visivle = useMemo(() => {
|
9
|
-
return consentPopupCate || (open && style);
|
10
|
-
}, [consentPopupCate, open]);
|
11
|
-
const
|
12
|
-
|
20
|
+
return consentPopupCate || (open && style && !consentResult);
|
21
|
+
}, [consentPopupCate, open, style, consentResult]);
|
22
|
+
const handleClick = (v) => {
|
23
|
+
accountSonsent === null || accountSonsent === void 0 ? void 0 : accountSonsent(v);
|
24
|
+
setConsentResult(true);
|
25
|
+
};
|
13
26
|
return (React.createElement(React.Fragment, null, isTel ? (React.createElement("img", { src: tel, style: { objectFit: 'cover', width: '100%', height: '100%' } })) : (React.createElement(React.Fragment, null, visivle && (React.createElement("div", { className: 'consentPopupClick' },
|
14
27
|
React.createElement("div", { className: 'consentPopupClick-container', style: style },
|
15
|
-
React.createElement(
|
16
|
-
|
17
|
-
React.createElement("button", { style:
|
28
|
+
React.createElement("div", { className: 'consentPopupClick-container-content' },
|
29
|
+
React.createElement(ConsentDetail, { content: content, style: { padding: 0 } })),
|
30
|
+
React.createElement("button", { style: acceptButton === null || acceptButton === void 0 ? void 0 : acceptButton.style, onClick: () => handleClick(true), dangerouslySetInnerHTML: {
|
31
|
+
__html: setFontForText(acceptButton === null || acceptButton === void 0 ? void 0 : acceptButton.text, acceptButton === null || acceptButton === void 0 ? void 0 : acceptButton.style)
|
32
|
+
} }),
|
33
|
+
React.createElement("button", { style: rejectButton === null || rejectButton === void 0 ? void 0 : rejectButton.style, onClick: () => handleClick(false), dangerouslySetInnerHTML: {
|
34
|
+
__html: setFontForText(rejectButton === null || rejectButton === void 0 ? void 0 : rejectButton.text, rejectButton === null || rejectButton === void 0 ? void 0 : rejectButton.style)
|
35
|
+
} }))))))));
|
18
36
|
};
|
19
37
|
export default memo(Click);
|
@@ -1,13 +1,29 @@
|
|
1
|
-
import { __rest } from "tslib";
|
2
|
-
import React, { memo, useMemo, useRef } from 'react';
|
1
|
+
import { __awaiter, __rest } from "tslib";
|
2
|
+
import React, { memo, useEffect, useMemo, useRef, useState } from 'react';
|
3
3
|
import './index.less';
|
4
|
-
import tel from './tel.png';
|
5
4
|
import ConsentDetail from '../../popup/ConsentDetail';
|
6
|
-
|
5
|
+
import tel from './tel.png';
|
6
|
+
import { useSxpDataSource } from '../../../../core/hooks';
|
7
7
|
const Swipe = (_a) => {
|
8
|
-
var { isTel, open, content, style, consentPopupCate, swipeIcon } = _a, props = __rest(_a, ["isTel", "open", "content", "style", "consentPopupCate", "swipeIcon"]);
|
8
|
+
var { isTel, open, content, style, consentPopupCate, swipeIcon, closeIcon } = _a, props = __rest(_a, ["isTel", "open", "content", "style", "consentPopupCate", "swipeIcon", "closeIcon"]);
|
9
9
|
const touchInfo = useRef();
|
10
10
|
const threshold = 50;
|
11
|
+
const { getAccount, accountSonsent } = useSxpDataSource();
|
12
|
+
const [consentResult, setConsentResult] = useState(false);
|
13
|
+
const handleGetAccount = () => __awaiter(void 0, void 0, void 0, function* () {
|
14
|
+
const res = yield (getAccount === null || getAccount === void 0 ? void 0 : getAccount());
|
15
|
+
setConsentResult(res);
|
16
|
+
});
|
17
|
+
useEffect(() => {
|
18
|
+
handleGetAccount();
|
19
|
+
}, []);
|
20
|
+
const visivle = useMemo(() => {
|
21
|
+
return consentPopupCate || (open && style && !consentResult);
|
22
|
+
}, [consentPopupCate, open, style, consentResult]);
|
23
|
+
const handleClick = (v) => {
|
24
|
+
accountSonsent === null || accountSonsent === void 0 ? void 0 : accountSonsent(v);
|
25
|
+
setConsentResult(true);
|
26
|
+
};
|
11
27
|
const handleTouchStart = (event) => {
|
12
28
|
const touch = event.touches[0];
|
13
29
|
touchInfo.current = { y: touch.clientY, d: 0 };
|
@@ -26,19 +42,17 @@ const Swipe = (_a) => {
|
|
26
42
|
return;
|
27
43
|
const { d } = touchInfo.current || {};
|
28
44
|
if (d > threshold) {
|
45
|
+
handleClick(true);
|
29
46
|
}
|
30
47
|
touchInfo.current = {};
|
31
48
|
};
|
32
|
-
const handleClickReject = () => { };
|
33
|
-
const visivle = useMemo(() => {
|
34
|
-
return consentPopupCate || (open && style);
|
35
|
-
}, [consentPopupCate, open]);
|
36
49
|
return (React.createElement(React.Fragment, null, isTel ? (React.createElement("img", { src: tel, style: { objectFit: 'cover', width: '100%', height: '100%' } })) : (React.createElement(React.Fragment, null, visivle && (React.createElement("div", { className: 'consentPopupSwipe', onTouchStart: handleTouchStart, onTouchMove: handleTouchMove, onTouchEnd: handleTouchEnd },
|
37
50
|
React.createElement("div", { className: 'consentPopupSwipe-container', style: style },
|
38
|
-
React.createElement(
|
39
|
-
|
51
|
+
React.createElement("div", { className: 'consentPopupSwipe-container-content' },
|
52
|
+
React.createElement(ConsentDetail, { content: content, style: { padding: 0 } })),
|
53
|
+
React.createElement("button", { "aria-label": 'close', className: 'consentPopupSwipe-container-close', onClick: () => handleClick(false) },
|
40
54
|
React.createElement("img", { src: closeIcon, alt: 'close' })),
|
41
|
-
swipeIcon && (React.createElement("div", { className: 'consentPopupSwipe-container-swipeIcon', onClick:
|
55
|
+
swipeIcon && (React.createElement("div", { className: 'consentPopupSwipe-container-swipeIcon', onClick: () => handleClick(false) },
|
42
56
|
React.createElement("img", { src: swipeIcon, alt: 'Swipe Icon' }))))))))));
|
43
57
|
};
|
44
58
|
export default memo(Swipe);
|
@@ -12,7 +12,8 @@ const Swipe = createMaterial(SwipeComponent, {
|
|
12
12
|
},
|
13
13
|
defaulSetting: {
|
14
14
|
props: {
|
15
|
-
content: '<p><span style="font- size: 14px"><strong><span style="line - height: 3">Your Cookie Preferences</span></strong></span></p><p><span style="line- height: 1"><span style="font- size: 12px">We use cookie, including third-party cookies, to</span></span></p><p><span style="line - height: 1"><span style="font - size: 12px">ensure the proper functioning and security of</span></span></p><p><span style="line - height: 1"><span style="font - size: 12px">this site, to analyse its use, and to show you</span></span></p><p><span style="line - height: 1"><span style="font - size: 12px">personalised content.</span></span></p><p><span style="line - height: 1"><span style="font - size: 12px">You can authorise the use of all cookies by</span></span></p><p><span style="line - height: 1"><span style="font - size: 12px">clicking on 'Accept all cookies'. If you click on</span></span></p><p><span style="line - height: 1"><span style="font - size: 12px">'Reject all cookies', we will only use cookies</span></span></p><p><span style="line - height: 1"><span style="font - size: 12px">necessary for the proper functioning and </span></span></p><p><span style="line - height: 1"><span style="font - size: 12px">security of this site. To personalise or adjust</span></span></p><p><span style="line - height: 1"><span style="font - size: 12px">your preferences at any time, click on 'Cookies</span></span></p><p><span style="line - height: 1"><span style="font - size: 12px">Settings' below or at the bottom of any</span></span></p><p><span style="line - height: 1"><span style="font - size: 12px">Fendi.com webpage.</span></span></p><p><span style="line - height: 1"><span style="font - size: 12px">For more information, <u>read our Cookie Policy</u>.</span></span></p>'
|
15
|
+
content: '<p><span style="font- size: 14px"><strong><span style="line - height: 3">Your Cookie Preferences</span></strong></span></p><p><span style="line- height: 1"><span style="font- size: 12px">We use cookie, including third-party cookies, to</span></span></p><p><span style="line - height: 1"><span style="font - size: 12px">ensure the proper functioning and security of</span></span></p><p><span style="line - height: 1"><span style="font - size: 12px">this site, to analyse its use, and to show you</span></span></p><p><span style="line - height: 1"><span style="font - size: 12px">personalised content.</span></span></p><p><span style="line - height: 1"><span style="font - size: 12px">You can authorise the use of all cookies by</span></span></p><p><span style="line - height: 1"><span style="font - size: 12px">clicking on 'Accept all cookies'. If you click on</span></span></p><p><span style="line - height: 1"><span style="font - size: 12px">'Reject all cookies', we will only use cookies</span></span></p><p><span style="line - height: 1"><span style="font - size: 12px">necessary for the proper functioning and </span></span></p><p><span style="line - height: 1"><span style="font - size: 12px">security of this site. To personalise or adjust</span></span></p><p><span style="line - height: 1"><span style="font - size: 12px">your preferences at any time, click on 'Cookies</span></span></p><p><span style="line - height: 1"><span style="font - size: 12px">Settings' below or at the bottom of any</span></span></p><p><span style="line - height: 1"><span style="font - size: 12px">Fendi.com webpage.</span></span></p><p><span style="line - height: 1"><span style="font - size: 12px">For more information, <u>read our Cookie Policy</u>.</span></span></p>',
|
16
|
+
closeIcon: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAjhJREFUWEfFlztOw0AQhmeWiJ4CCmpQ5DiRQsIJyAWg5A0lR0AIChDiCJS8ER0cADgBeRSxt4CCDgkaKiq8i+zYeWx2413HEWmiJJv9v535Z2aN8M8vFPT9z3zETD0aAUChUJjwvPFHAJhBhB3Hqd6OAsK2yyucwykAvP38eJX398Z3AJDLlVYR8ToU9Rhj25TWr9KEsKy5dULIGQCMtfZly45TvwsAstm56UwG6wA4FUFwzrdctxZBDcWSy5XWEPG8I84/GcMipdWPtgcsaz5PCHtKG0IuTiqUvjT9U/WYMG2IOPE+AP+LtCB0xKUAAyA2Xbd2o2OG0NQXvTnvhL17D7EPtH9TRCIWwkRcGYGIQgYBABuqPuHXOQBc6pw80lBGwBQiiXhsBHQhkoprA6iM6acjhDQKu5YJZW6XeOI3XJdpvfsdTu52VfXEekD8owQiXGIubpSCbhDbLu8DwKEAd+A41SOdPpE4BS0viFOtvV2iKWqUgn5x/tmS70xR01GuDSCKc86/OCcLgTyyZ0ScDGNhFAktAJV4NFJ9YyaFiAWIE+9uVkkgBgLoig8DMWAa9ro9ynkUdlW5maZDCmB6clmz0k1HH4Cs1Ezbq2p2yEpUuBOKTSZZex00RUWIrltxuuK6EOGDSbGIOPZicpMx6fny650377qNRgBgWeVFQuA+6UjVgREhGIMlSqsPUQqIbZdOOIdZQmCv2axRnU1N1+TzJYsxOEaEV8ep7frPZ7Gd0FTEdP0ft0/kMNdg0eoAAAAASUVORK5CYII='
|
16
17
|
},
|
17
18
|
style: {
|
18
19
|
backgroundColor: '#fff',
|
@@ -32,7 +32,6 @@ const Consent = ({ width = window.innerWidth, height = window.innerHeight, priva
|
|
32
32
|
utmCampaign: getUtmValue('utm_campaign'),
|
33
33
|
utmId: getUtmValue('utm_id'),
|
34
34
|
utmContent: getUtmValue('utm_content'),
|
35
|
-
clSource: getUtmValue('cl_source'),
|
36
35
|
enterTime: `${Date.now()}`,
|
37
36
|
enterUrl: window.location.href,
|
38
37
|
rtc: null,
|
@@ -6,10 +6,10 @@ require("./index.less");
|
|
6
6
|
const withBindDataSource_1 = tslib_1.__importDefault(require("../../../core/hoc/withBindDataSource"));
|
7
7
|
const EditorDataProvider_1 = require("../../../core/context/EditorDataProvider");
|
8
8
|
const Consent = ({ resolver, globalConfig }) => {
|
9
|
-
var _a, _b;
|
9
|
+
var _a, _b, _c;
|
10
10
|
const { consentPopupCate } = (0, EditorDataProvider_1.useEditorDataProvider)();
|
11
11
|
const value = (_b = (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.consentPopup) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.item;
|
12
|
-
if (!value)
|
12
|
+
if (!value || (!consentPopupCate && !((_c = value === null || value === void 0 ? void 0 : value.props) === null || _c === void 0 ? void 0 : _c.open)))
|
13
13
|
return null;
|
14
14
|
const t = resolver === null || resolver === void 0 ? void 0 : resolver[value === null || value === void 0 ? void 0 : value.type];
|
15
15
|
const Component = (0, withBindDataSource_1.default)(t);
|
@@ -414,7 +414,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
414
414
|
}
|
415
415
|
};
|
416
416
|
const handleScrollEvent = (swiper) => {
|
417
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
417
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
|
418
418
|
const item = data[swiper.previousIndex];
|
419
419
|
if (!item)
|
420
420
|
return;
|
@@ -433,9 +433,9 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
433
433
|
contentId: (_e = (_d = item === null || item === void 0 ? void 0 : item.video) === null || _d === void 0 ? void 0 : _d.itemId) !== null && _e !== void 0 ? _e : '',
|
434
434
|
productId: (_g = (_f = item === null || item === void 0 ? void 0 : item.product) === null || _f === void 0 ? void 0 : _f.itemId) !== null && _g !== void 0 ? _g : '',
|
435
435
|
requestId: null,
|
436
|
-
traceInfo: (_j = (_h = item === null || item === void 0 ? void 0 : item.video) === null || _h === void 0 ? void 0 : _h.traceInfo) !== null && _j !== void 0 ? _j : '',
|
436
|
+
traceInfo: (_l = (_j = (_h = item === null || item === void 0 ? void 0 : item.video) === null || _h === void 0 ? void 0 : _h.traceInfo) !== null && _j !== void 0 ? _j : (_k = item === null || item === void 0 ? void 0 : item.product) === null || _k === void 0 ? void 0 : _k.traceInfo) !== null && _l !== void 0 ? _l : '',
|
437
437
|
contentFormat,
|
438
|
-
position: ((
|
438
|
+
position: ((_m = swiper.previousIndex) !== null && _m !== void 0 ? _m : 0) + ''
|
439
439
|
}
|
440
440
|
});
|
441
441
|
handleViewImageStartEnd(item);
|
@@ -446,12 +446,12 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
446
446
|
eventInfo: {
|
447
447
|
eventSubject: 'scrollUp',
|
448
448
|
eventDescription: 'User scroll up',
|
449
|
-
contentId: (
|
450
|
-
productId: (
|
449
|
+
contentId: (_p = (_o = item === null || item === void 0 ? void 0 : item.video) === null || _o === void 0 ? void 0 : _o.itemId) !== null && _p !== void 0 ? _p : '',
|
450
|
+
productId: (_r = (_q = item.product) === null || _q === void 0 ? void 0 : _q.itemId) !== null && _r !== void 0 ? _r : '',
|
451
451
|
requestId: null,
|
452
|
-
traceInfo: (
|
452
|
+
traceInfo: (_v = (_t = (_s = item === null || item === void 0 ? void 0 : item.video) === null || _s === void 0 ? void 0 : _s.traceInfo) !== null && _t !== void 0 ? _t : (_u = item === null || item === void 0 ? void 0 : item.product) === null || _u === void 0 ? void 0 : _u.traceInfo) !== null && _v !== void 0 ? _v : '',
|
453
453
|
contentFormat,
|
454
|
-
position: ((
|
454
|
+
position: ((_w = swiper.previousIndex) !== null && _w !== void 0 ? _w : 0) + ''
|
455
455
|
}
|
456
456
|
});
|
457
457
|
handleViewImageStartEnd(item);
|
@@ -90,6 +90,8 @@ export interface ISxpDataSourceContext {
|
|
90
90
|
setEventTimeList?: React.Dispatch<React.SetStateAction<Array<IEventTimeType>>>;
|
91
91
|
multiPostTimeRef?: any;
|
92
92
|
refreshFeSession?: (enableReSid?: boolean, event?: (fk: string) => void) => void;
|
93
|
+
getAccount?: () => Promise<any>;
|
94
|
+
accountSonsent?: (v: boolean) => Promise<boolean>;
|
93
95
|
}
|
94
96
|
export declare const SxpDataSourceContext: React.Context<ISxpDataSourceContext>;
|
95
97
|
export interface SxpDataSourceProviderProps {
|
@@ -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;
|
@@ -130,16 +131,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
130
131
|
}, [bffDataSource, fakeUserId]);
|
131
132
|
const getRecommendVideos = (0, react_1.useCallback)((query) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
132
133
|
var _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
133
|
-
query = {
|
134
|
-
maxSize: (_f = query === null || query === void 0 ? void 0 : query.maxSize) !== null && _f !== void 0 ? _f : maxSize,
|
135
|
-
defaultSize: (_g = query === null || query === void 0 ? void 0 : query.defaultSize) !== null && _g !== void 0 ? _g : defaultSize,
|
136
|
-
hashTag: query === null || query === void 0 ? void 0 : query.hashTag,
|
137
|
-
traceInfo: query === null || query === void 0 ? void 0 : query.traceInfo,
|
138
|
-
themeTag: query === null || query === void 0 ? void 0 : query.themeTag,
|
139
|
-
pageNum: query === null || query === void 0 ? void 0 : query.pageNum,
|
140
|
-
contentFilter: query === null || query === void 0 ? void 0 : query.contentFilter,
|
141
|
-
productFilter: query === null || query === void 0 ? void 0 : query.productFilter
|
142
|
-
};
|
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 }));
|
143
135
|
if (channel) {
|
144
136
|
query = Object.assign(Object.assign({}, query), { channel: decodeURIComponent(channel) });
|
145
137
|
}
|
@@ -204,7 +196,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
204
196
|
return Object.assign(Object.assign({}, result.data), { recList: list });
|
205
197
|
}
|
206
198
|
return result === null || result === void 0 ? void 0 : result.data;
|
207
|
-
}), [bffFetch, utmVal, maxSize, defaultSize, channelQueryList, channel]);
|
199
|
+
}), [bffFetch, utmVal, maxSize, defaultSize, channelQueryList, channel, chatlabsId]);
|
208
200
|
const loadVideos = (0, react_1.useCallback)((pageNum) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
209
201
|
var _1, _2, _3, _4;
|
210
202
|
if (rtcList.length <= 0) {
|
@@ -253,9 +245,8 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
253
245
|
const value = val.split('=')[1];
|
254
246
|
params[key] = value;
|
255
247
|
});
|
256
|
-
console.log(params, '111');
|
257
248
|
const cl_source = params === null || params === void 0 ? void 0 : params.cl_source;
|
258
|
-
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 && { 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 }));
|
259
250
|
const realUserInfo = Object.entries(userInfo).map(([k, v]) => ({ name: k, value: v }));
|
260
251
|
const realEventInfo = Object.entries(ef)
|
261
252
|
.map(([k, v]) => v && { name: k, value: v })
|
@@ -436,12 +427,26 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
436
427
|
utmContent: getVal('utm_content'),
|
437
428
|
enterTime: Math.floor(time / 1000) + '',
|
438
429
|
requestId: null,
|
439
|
-
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 : ''
|
440
|
-
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 : ''
|
441
431
|
},
|
442
432
|
reportLayId: false
|
443
433
|
});
|
444
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]);
|
445
450
|
(0, react_1.useEffect)(() => {
|
446
451
|
if (!isShowConsent)
|
447
452
|
h5EnterLink();
|
@@ -589,7 +594,9 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
589
594
|
eventTimeList,
|
590
595
|
setEventTimeList,
|
591
596
|
multiPostTimeRef,
|
592
|
-
refreshFeSession
|
597
|
+
refreshFeSession,
|
598
|
+
getAccount,
|
599
|
+
accountSonsent
|
593
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({
|
594
601
|
rtcList,
|
595
602
|
mutateLike: bffMutateLike,
|
@@ -3,19 +3,37 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
4
4
|
const react_1 = tslib_1.__importStar(require("react"));
|
5
5
|
require("./index.less");
|
6
|
-
const tel_png_1 = tslib_1.__importDefault(require("./tel.png"));
|
7
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");
|
8
10
|
const Click = (_a) => {
|
9
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
|
+
}, []);
|
10
21
|
const visivle = (0, react_1.useMemo)(() => {
|
11
|
-
return consentPopupCate || (open && style);
|
12
|
-
}, [consentPopupCate, open]);
|
13
|
-
const
|
14
|
-
|
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
|
+
};
|
15
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' },
|
16
29
|
react_1.default.createElement("div", { className: 'consentPopupClick-container', style: style },
|
17
|
-
react_1.default.createElement(
|
18
|
-
|
19
|
-
react_1.default.createElement("button", { 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
|
+
} }))))))));
|
20
38
|
};
|
21
39
|
exports.default = (0, react_1.memo)(Click);
|