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
@@ -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,
|
@@ -1,15 +1,15 @@
|
|
1
|
-
import React, { memo
|
1
|
+
import React, { memo } from 'react';
|
2
2
|
import './index.less';
|
3
3
|
import withBindDataSource from '../../../core/hoc/withBindDataSource';
|
4
|
-
import {
|
4
|
+
import { useEditorDataProvider } from '../../../core/context/EditorDataProvider';
|
5
5
|
const Consent = ({ resolver, globalConfig }) => {
|
6
|
-
var _a, _b;
|
7
|
-
const
|
8
|
-
return getContsentState();
|
9
|
-
}, []);
|
10
|
-
const t = resolver === null || resolver === void 0 ? void 0 : resolver['Display'];
|
11
|
-
const Component = withBindDataSource(t);
|
6
|
+
var _a, _b, _c;
|
7
|
+
const { consentPopupCate } = useEditorDataProvider();
|
12
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;
|
13
|
-
|
9
|
+
if (!value || (!consentPopupCate && !((_c = value === null || value === void 0 ? void 0 : value.props) === null || _c === void 0 ? void 0 : _c.open)))
|
10
|
+
return null;
|
11
|
+
const t = resolver === null || resolver === void 0 ? void 0 : resolver[value === null || value === void 0 ? void 0 : value.type];
|
12
|
+
const Component = withBindDataSource(t);
|
13
|
+
return (React.createElement(Component, Object.assign({}, value === null || value === void 0 ? void 0 : value.props, { style: value === null || value === void 0 ? void 0 : value.style, event: (value === null || value === void 0 ? void 0 : value.event) || {}, consentPopupCate: consentPopupCate })));
|
14
14
|
};
|
15
15
|
export default memo(Consent);
|
@@ -8,7 +8,7 @@ const Navbar = ({ icon, styles, textStyle, onClose }) => {
|
|
8
8
|
React.createElement("button", { className: 'clc-sxp-nav-left', role: 'button', "aria-label": 'back button', onClick: onClose },
|
9
9
|
React.createElement("img", { src: icon, alt: 'back button' })),
|
10
10
|
React.createElement("div", { className: 'clc-sxp-nav-title', style: Object.assign(Object.assign({}, textStyle), { paddingLeft: (textStyle === null || textStyle === void 0 ? void 0 : textStyle.textAlign) === 'left' ? '35px' : 0 }), dangerouslySetInnerHTML: {
|
11
|
-
__html: setFontForText(`#${(_a = waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.hashTag) !== null && _a !== void 0 ? _a : '
|
11
|
+
__html: setFontForText(`#${(_a = waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.hashTag) !== null && _a !== void 0 ? _a : 'title'}`, textStyle)
|
12
12
|
} })));
|
13
13
|
};
|
14
14
|
export default memo(Navbar);
|
@@ -117,7 +117,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
117
117
|
contentId: (_m = item === null || item === void 0 ? void 0 : item.video) === null || _m === void 0 ? void 0 : _m.itemId,
|
118
118
|
productId: (_o = item === null || item === void 0 ? void 0 : item.product) === null || _o === void 0 ? void 0 : _o.itemId,
|
119
119
|
position: activeIndex + '',
|
120
|
-
fromKName: fk
|
120
|
+
fromKName: fk || fromKName,
|
121
121
|
fromKPage: location === null || location === void 0 ? void 0 : location.href,
|
122
122
|
ctatId: (_r = (_q = (_p = item === null || item === void 0 ? void 0 : item.video) === null || _p === void 0 ? void 0 : _p.bindCta) === null || _q === void 0 ? void 0 : _q.itemId) !== null && _r !== void 0 ? _r : '',
|
123
123
|
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 : ''
|
@@ -144,9 +144,12 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
144
144
|
setIsReload(new Date().getTime());
|
145
145
|
skipLinkRef.current = false;
|
146
146
|
}
|
147
|
+
refreshFeSession === null || refreshFeSession === void 0 ? void 0 : refreshFeSession(false);
|
147
148
|
handleH5EnterLink();
|
148
149
|
if (repCond) {
|
149
|
-
|
150
|
+
setTimeout(() => {
|
151
|
+
SXP_EVENT_BUS.emit(SXP_EVENT_TYPE.PAGE_DID_SHOW, item);
|
152
|
+
});
|
150
153
|
backMainFeed('external', selectTag);
|
151
154
|
}
|
152
155
|
}
|
@@ -408,7 +411,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
408
411
|
}
|
409
412
|
};
|
410
413
|
const handleScrollEvent = (swiper) => {
|
411
|
-
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;
|
412
415
|
const item = data[swiper.previousIndex];
|
413
416
|
if (!item)
|
414
417
|
return;
|
@@ -427,9 +430,9 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
427
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 : '',
|
428
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 : '',
|
429
432
|
requestId: null,
|
430
|
-
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 : '',
|
431
434
|
contentFormat,
|
432
|
-
position: ((
|
435
|
+
position: ((_m = swiper.previousIndex) !== null && _m !== void 0 ? _m : 0) + ''
|
433
436
|
}
|
434
437
|
});
|
435
438
|
handleViewImageStartEnd(item);
|
@@ -440,12 +443,12 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
440
443
|
eventInfo: {
|
441
444
|
eventSubject: 'scrollUp',
|
442
445
|
eventDescription: 'User scroll up',
|
443
|
-
contentId: (
|
444
|
-
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 : '',
|
445
448
|
requestId: null,
|
446
|
-
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 : '',
|
447
450
|
contentFormat,
|
448
|
-
position: ((
|
451
|
+
position: ((_w = swiper.previousIndex) !== null && _w !== void 0 ? _w : 0) + ''
|
449
452
|
}
|
450
453
|
});
|
451
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;
|
@@ -99,41 +100,35 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
99
100
|
const bffDataSource = useMemo(() => {
|
100
101
|
return dataSources === null || dataSources === void 0 ? void 0 : dataSources.find((d) => d.type === DataSourceType.BFF);
|
101
102
|
}, [dataSources]);
|
103
|
+
const fakeUserId = useMemo(() => {
|
104
|
+
var _a;
|
105
|
+
return ((_a = bffDataSource === null || bffDataSource === void 0 ? void 0 : bffDataSource.headers) === null || _a === void 0 ? void 0 : _a['x-app-id']) + storeAndLoadFeUserId();
|
106
|
+
}, [bffDataSource]);
|
102
107
|
const bffFetch = useCallback((path, options) => {
|
103
108
|
if (!bffDataSource)
|
104
109
|
return;
|
105
110
|
const url = bffDataSource.url;
|
106
|
-
const fakeUserId = storeAndLoadFeUserId();
|
107
111
|
if (options === null || options === void 0 ? void 0 : options.query) {
|
108
112
|
const queryString = qs.stringify(options.query);
|
109
113
|
path = `${path}?${queryString}`;
|
110
114
|
}
|
111
115
|
if (options.type === 'beacon' && navigator.sendBeacon) {
|
112
|
-
return navigator.sendBeacon(`${url}/api
|
116
|
+
return navigator.sendBeacon(`${url}/api/${path}`, new Blob([
|
113
117
|
JSON.stringify(Object.assign(Object.assign(Object.assign({}, options.body), bffDataSource.headers), { 'x-user-id': fakeUserId }))
|
114
118
|
], { type: 'application/json;charset=UTF-8' }));
|
115
119
|
}
|
116
120
|
return window
|
117
|
-
.fetch(`${url}/api
|
121
|
+
.fetch(`${url}/api/${path}`, {
|
118
122
|
headers: Object.assign({ 'Content-Type': 'application/json', 'x-user-id': fakeUserId }, bffDataSource.headers),
|
119
123
|
method: options.method,
|
120
124
|
body: JSON.stringify(options.body)
|
121
125
|
})
|
122
126
|
.then((res) => res.json())
|
123
127
|
.catch((err) => Promise.reject(err));
|
124
|
-
}, [bffDataSource]);
|
128
|
+
}, [bffDataSource, fakeUserId]);
|
125
129
|
const getRecommendVideos = useCallback((query) => __awaiter(void 0, void 0, void 0, function* () {
|
126
130
|
var _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
127
|
-
query = {
|
128
|
-
maxSize: (_f = query === null || query === void 0 ? void 0 : query.maxSize) !== null && _f !== void 0 ? _f : maxSize,
|
129
|
-
defaultSize: (_g = query === null || query === void 0 ? void 0 : query.defaultSize) !== null && _g !== void 0 ? _g : defaultSize,
|
130
|
-
hashTag: query === null || query === void 0 ? void 0 : query.hashTag,
|
131
|
-
traceInfo: query === null || query === void 0 ? void 0 : query.traceInfo,
|
132
|
-
themeTag: query === null || query === void 0 ? void 0 : query.themeTag,
|
133
|
-
pageNum: query === null || query === void 0 ? void 0 : query.pageNum,
|
134
|
-
contentFilter: query === null || query === void 0 ? void 0 : query.contentFilter,
|
135
|
-
productFilter: query === null || query === void 0 ? void 0 : query.productFilter
|
136
|
-
};
|
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 }));
|
137
132
|
if (channel) {
|
138
133
|
query = Object.assign(Object.assign({}, query), { channel: decodeURIComponent(channel) });
|
139
134
|
}
|
@@ -158,14 +153,16 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
158
153
|
const recurveRecList = (query) => __awaiter(void 0, void 0, void 0, function* () {
|
159
154
|
var _v, _w, _x, _y, _z, _0;
|
160
155
|
query.pageNum = pageNum;
|
161
|
-
result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/recommend/list', { method: 'POST', body: query }));
|
156
|
+
result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/recommend/list', { method: 'POST', body: query }));
|
162
157
|
if (!(result === null || result === void 0 ? void 0 : result.success)) {
|
163
158
|
return undefined;
|
164
159
|
}
|
165
160
|
setLoading(false);
|
166
161
|
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 : []);
|
167
|
-
|
168
|
-
|
162
|
+
if ((rtcList === null || rtcList === void 0 ? void 0 : rtcList.length) === 0) {
|
163
|
+
setRtcList(getFilterRecList(Object.assign(Object.assign({}, result === null || result === void 0 ? void 0 : result.data), { recList: list })));
|
164
|
+
setCacheRtcList(getFilterRecList(Object.assign(Object.assign({}, result === null || result === void 0 ? void 0 : result.data), { recList: list })));
|
165
|
+
}
|
169
166
|
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));
|
170
167
|
if (isNotNullList) {
|
171
168
|
pageNum = pageNum + 1;
|
@@ -175,12 +172,12 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
175
172
|
yield recurveRecList(query);
|
176
173
|
if (!(query === null || query === void 0 ? void 0 : query.hashTag) && result)
|
177
174
|
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 });
|
178
|
-
return Object.assign(Object.assign({}, result.data), { recList: list });
|
175
|
+
return Object.assign(Object.assign({}, result === null || result === void 0 ? void 0 : result.data), { recList: list });
|
179
176
|
}
|
180
177
|
if (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview) {
|
181
178
|
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 });
|
182
179
|
}
|
183
|
-
const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/recommend/list', { method: 'POST', body: query }));
|
180
|
+
const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/recommend/list', { method: 'POST', body: query }));
|
184
181
|
if (!(result === null || result === void 0 ? void 0 : result.success)) {
|
185
182
|
return undefined;
|
186
183
|
}
|
@@ -196,7 +193,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
196
193
|
return Object.assign(Object.assign({}, result.data), { recList: list });
|
197
194
|
}
|
198
195
|
return result === null || result === void 0 ? void 0 : result.data;
|
199
|
-
}), [bffFetch, utmVal, maxSize, defaultSize, channelQueryList, channel]);
|
196
|
+
}), [bffFetch, utmVal, maxSize, defaultSize, channelQueryList, channel, chatlabsId]);
|
200
197
|
const loadVideos = useCallback((pageNum) => __awaiter(void 0, void 0, void 0, function* () {
|
201
198
|
var _1, _2, _3, _4;
|
202
199
|
if (rtcList.length <= 0) {
|
@@ -230,6 +227,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
230
227
|
return expire;
|
231
228
|
}, [data]);
|
232
229
|
const bffEventReport = useCallback(({ userInfo, eventInfo, reportLayId = true }) => {
|
230
|
+
var _a, _b;
|
233
231
|
if (!enableReportEvent || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview)) {
|
234
232
|
return;
|
235
233
|
}
|
@@ -237,7 +235,15 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
237
235
|
userInfo = {};
|
238
236
|
}
|
239
237
|
const sessionID = storeAndLoadFeSessionId();
|
240
|
-
const
|
238
|
+
const params = {};
|
239
|
+
const queryString = location.search.slice(1);
|
240
|
+
(_a = splitUrlParams(queryString)) === null || _a === void 0 ? void 0 : _a.map((val) => {
|
241
|
+
const key = val.split('=')[0];
|
242
|
+
const value = val.split('=')[1];
|
243
|
+
params[key] = value;
|
244
|
+
});
|
245
|
+
const cl_source = params === null || params === void 0 ? void 0 : params.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 }));
|
241
247
|
const realUserInfo = Object.entries(userInfo).map(([k, v]) => ({ name: k, value: v }));
|
242
248
|
const realEventInfo = Object.entries(ef)
|
243
249
|
.map(([k, v]) => v && { name: k, value: v })
|
@@ -246,14 +252,23 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
246
252
|
console.log('userInfo:', userInfo);
|
247
253
|
console.log('eventInfo:', ef);
|
248
254
|
console.log('========= 结束 =========');
|
249
|
-
return bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch(
|
255
|
+
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}`, {
|
250
256
|
method: 'POST',
|
251
257
|
body: { userInfo: realUserInfo, eventInfo: realEventInfo },
|
252
258
|
type: 'beacon'
|
253
259
|
});
|
254
|
-
}, [
|
260
|
+
}, [
|
261
|
+
bffFetch,
|
262
|
+
curReqInfo,
|
263
|
+
enableReportEvent,
|
264
|
+
globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview,
|
265
|
+
layoutVariantId,
|
266
|
+
globalConfig,
|
267
|
+
playbookType,
|
268
|
+
bffDataSource
|
269
|
+
]);
|
255
270
|
const bffFbReport = useCallback(({ eventName, product }) => {
|
256
|
-
var _a, _b, _c, _d, _e;
|
271
|
+
var _a, _b, _c, _d, _e, _f;
|
257
272
|
if (!enableReportEvent ||
|
258
273
|
!enabledMetaConversionApi ||
|
259
274
|
(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview) ||
|
@@ -265,7 +280,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
265
280
|
const fbclid = urlParams === null || urlParams === void 0 ? void 0 : urlParams.get('fbclid');
|
266
281
|
const fix_par = {
|
267
282
|
event_source_url: (_c = window === null || window === void 0 ? void 0 : window.location) === null || _c === void 0 ? void 0 : _c.href,
|
268
|
-
external_id:
|
283
|
+
external_id: fakeUserId,
|
269
284
|
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 : '',
|
270
285
|
fbc: fbclid ? `fb.2.${new Date().getTime()}.${fbclid}` : '',
|
271
286
|
fbp: getCookie('_fbp') ? `fb.2.${new Date().getTime()}.${getCookie('_fbp')}` : '',
|
@@ -317,22 +332,30 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
317
332
|
}
|
318
333
|
};
|
319
334
|
getEventParams(jsonParams);
|
320
|
-
return bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch(
|
335
|
+
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}`, {
|
321
336
|
method: 'POST',
|
322
337
|
body: jsonParams,
|
323
338
|
type: 'beacon'
|
324
339
|
});
|
325
|
-
}, [
|
340
|
+
}, [
|
341
|
+
bffFetch,
|
342
|
+
enableReportEvent,
|
343
|
+
enabledMetaConversionApi,
|
344
|
+
globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview,
|
345
|
+
globalConfig,
|
346
|
+
fakeUserId,
|
347
|
+
bffDataSource
|
348
|
+
]);
|
326
349
|
const bffMutateLike = useCallback((body) => __awaiter(void 0, void 0, void 0, function* () {
|
327
|
-
const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/recommend/like', { method: 'POST', body }));
|
350
|
+
const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/recommend/like', { method: 'POST', body }));
|
328
351
|
return res === null || res === void 0 ? void 0 : res.success;
|
329
352
|
}), [bffFetch]);
|
330
353
|
const bffMutateUnlike = useCallback((body) => __awaiter(void 0, void 0, void 0, function* () {
|
331
|
-
const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/recommend/unlike', { method: 'POST', body }));
|
354
|
+
const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/recommend/unlike', { method: 'POST', body }));
|
332
355
|
return res === null || res === void 0 ? void 0 : res.success;
|
333
356
|
}), [bffFetch]);
|
334
357
|
const bffSubmitForm = useCallback((body) => __awaiter(void 0, void 0, void 0, function* () {
|
335
|
-
const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/customform', { method: 'POST', body }));
|
358
|
+
const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/customform', { method: 'POST', body }));
|
336
359
|
return res === null || res === void 0 ? void 0 : res.success;
|
337
360
|
}), [bffFetch]);
|
338
361
|
const bffGetTagList = useCallback((data) => __awaiter(void 0, void 0, void 0, function* () {
|
@@ -346,7 +369,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
346
369
|
const key = val.split('=')[0];
|
347
370
|
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);
|
348
371
|
})) === null || _9 === void 0 ? void 0 : _9.join('&')) !== null && _10 !== void 0 ? _10 : '';
|
349
|
-
const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/tag/list', { method: 'GET', query: { channel: decodeURIComponent(val) } }));
|
372
|
+
const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/tag/list', { method: 'GET', query: { channel: decodeURIComponent(val) } }));
|
350
373
|
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 : []);
|
351
374
|
}
|
352
375
|
catch (e) {
|
@@ -401,12 +424,26 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
401
424
|
utmContent: getVal('utm_content'),
|
402
425
|
enterTime: Math.floor(time / 1000) + '',
|
403
426
|
requestId: null,
|
404
|
-
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 : ''
|
405
|
-
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 : ''
|
406
428
|
},
|
407
429
|
reportLayId: false
|
408
430
|
});
|
409
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]);
|
410
447
|
useEffect(() => {
|
411
448
|
if (!isShowConsent)
|
412
449
|
h5EnterLink();
|
@@ -425,10 +462,10 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
425
462
|
let curData;
|
426
463
|
let gldata;
|
427
464
|
if (data === null || data === void 0 ? void 0 : data.layoutVariantId) {
|
465
|
+
layId = data === null || data === void 0 ? void 0 : data.layoutVariantId;
|
466
|
+
setLayoutVariantId(data === null || data === void 0 ? void 0 : data.layoutVariantId);
|
428
467
|
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];
|
429
468
|
if (id) {
|
430
|
-
layId = id;
|
431
|
-
setLayoutVariantId(id);
|
432
469
|
curData = dataList === null || dataList === void 0 ? void 0 : dataList.find((item) => (item === null || item === void 0 ? void 0 : item.id) === id);
|
433
470
|
if (curData) {
|
434
471
|
setPageData(curData);
|
@@ -554,7 +591,9 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
554
591
|
eventTimeList,
|
555
592
|
setEventTimeList,
|
556
593
|
multiPostTimeRef,
|
557
|
-
refreshFeSession
|
594
|
+
refreshFeSession,
|
595
|
+
getAccount,
|
596
|
+
accountSonsent
|
558
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({
|
559
598
|
rtcList,
|
560
599
|
mutateLike: bffMutateLike,
|
@@ -32,14 +32,16 @@ export const getBgStyleByImg = (data) => {
|
|
32
32
|
};
|
33
33
|
export const getPriceText = ({ product, enableFormattedPrice, globalConfig, isHiddenDef, style }) => {
|
34
34
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
35
|
+
let text = '';
|
35
36
|
if ((!(product === null || product === void 0 ? void 0 : product.currency) || !(product === null || product === void 0 ? void 0 : product.price)) && isHiddenDef)
|
36
37
|
return null;
|
37
|
-
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;
|
38
|
-
|
38
|
+
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);
|
39
|
+
if (typeof price !== 'number')
|
40
|
+
return text;
|
39
41
|
let priceSymbol = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.priceSymbol;
|
40
42
|
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 : '' : '$';
|
41
43
|
const isToLocStr = enableFormattedPrice === undefined || enableFormattedPrice;
|
42
|
-
let decPic = price.toString();
|
44
|
+
let decPic = price === null || price === void 0 ? void 0 : price.toString();
|
43
45
|
if (priceSymbol === null || priceSymbol === void 0 ? void 0 : priceSymbol.showTwoDecimalPoint) {
|
44
46
|
decPic = price === null || price === void 0 ? void 0 : price.toFixed(2);
|
45
47
|
}
|
@@ -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,37 @@
|
|
1
|
+
import { __awaiter, __rest } from "tslib";
|
2
|
+
import React, { memo, useEffect, useMemo, useState } from 'react';
|
3
|
+
import './index.less';
|
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';
|
8
|
+
const Click = (_a) => {
|
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
|
+
}, []);
|
19
|
+
const visivle = useMemo(() => {
|
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
|
+
};
|
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' },
|
27
|
+
React.createElement("div", { className: 'consentPopupClick-container', style: 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
|
+
} }))))))));
|
36
|
+
};
|
37
|
+
export default memo(Click);
|
@@ -0,0 +1,48 @@
|
|
1
|
+
import settingRender from './settingRender';
|
2
|
+
import ClickComponent from '.';
|
3
|
+
import { createMaterial } from '../../../../core/create';
|
4
|
+
const Click = createMaterial(ClickComponent, {
|
5
|
+
displayName: 'Click Consent',
|
6
|
+
icon: '',
|
7
|
+
category: 'consentPopup',
|
8
|
+
type: 'Click',
|
9
|
+
related: {
|
10
|
+
settingRender,
|
11
|
+
bindableProps: []
|
12
|
+
},
|
13
|
+
defaulSetting: {
|
14
|
+
props: {
|
15
|
+
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>',
|
16
|
+
acceptButton: {
|
17
|
+
text: 'Accept all cookies',
|
18
|
+
style: {
|
19
|
+
backgroundColor: '#000',
|
20
|
+
height: 45,
|
21
|
+
color: '#fff',
|
22
|
+
fontSize: 12,
|
23
|
+
textAlign: 'center',
|
24
|
+
marginTop: 5,
|
25
|
+
marginBottom: 5
|
26
|
+
}
|
27
|
+
},
|
28
|
+
rejectButton: {
|
29
|
+
text: 'Reject all cookies',
|
30
|
+
style: {
|
31
|
+
backgroundColor: '#000',
|
32
|
+
height: 45,
|
33
|
+
color: '#fff',
|
34
|
+
fontSize: 12,
|
35
|
+
textAlign: 'center',
|
36
|
+
marginTop: 5,
|
37
|
+
marginBottom: 5
|
38
|
+
}
|
39
|
+
}
|
40
|
+
},
|
41
|
+
style: {
|
42
|
+
backgroundColor: '#fff',
|
43
|
+
padding: 18
|
44
|
+
}
|
45
|
+
},
|
46
|
+
sort: 2
|
47
|
+
});
|
48
|
+
export { 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;
|