pb-sxp-ui 1.15.3 → 1.15.5
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 +108 -61
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +13 -1
- package/dist/index.js +108 -61
- package/dist/index.js.map +1 -1
- package/dist/index.min.cjs +6 -6
- package/dist/index.min.cjs.map +1 -1
- package/dist/index.min.js +6 -6
- package/dist/index.min.js.map +1 -1
- package/dist/pb-ui.js +108 -61
- package/dist/pb-ui.js.map +1 -1
- package/dist/pb-ui.min.js +6 -6
- package/dist/pb-ui.min.js.map +1 -1
- package/es/core/components/Consent/index.js +0 -1
- package/es/core/components/SxpPageCore/index.js +1 -1
- package/es/core/components/SxpPageRender/ConsentPopup.js +2 -2
- package/es/core/components/SxpPageRender/index.d.ts +1 -0
- package/es/core/components/SxpPageRender/index.js +11 -10
- package/es/core/context/SxpDataSourceProvider.d.ts +2 -0
- package/es/core/context/SxpDataSourceProvider.js +24 -17
- package/es/materials/sxp/consentPopup/Click/index.d.ts +1 -0
- package/es/materials/sxp/consentPopup/Click/index.js +33 -11
- package/es/materials/sxp/consentPopup/Click/settingRender.js +6 -1
- package/es/materials/sxp/consentPopup/Swipe/index.js +25 -12
- package/lib/core/components/Consent/index.js +0 -1
- package/lib/core/components/SxpPageCore/index.js +1 -1
- package/lib/core/components/SxpPageRender/ConsentPopup.js +2 -2
- package/lib/core/components/SxpPageRender/index.d.ts +1 -0
- package/lib/core/components/SxpPageRender/index.js +11 -10
- package/lib/core/context/SxpDataSourceProvider.d.ts +2 -0
- package/lib/core/context/SxpDataSourceProvider.js +24 -17
- package/lib/materials/sxp/consentPopup/Click/index.d.ts +1 -0
- package/lib/materials/sxp/consentPopup/Click/index.js +31 -9
- package/lib/materials/sxp/consentPopup/Click/settingRender.js +6 -1
- package/lib/materials/sxp/consentPopup/Swipe/index.js +23 -10
- 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,
|
@@ -21,7 +21,7 @@ const SxpPageCore = ({ data, maxSize = 10, defaultSize = 10, hashTagSize = 20, l
|
|
21
21
|
React.createElement(SxpDataSourceProvider, { utmVal: utmVal, dataSources: data === null || data === void 0 ? void 0 : data.data_sources, sxpParameter: data === null || data === void 0 ? void 0 : data.sxp_parameter, maxSize: (_b = (_a = data === null || data === void 0 ? void 0 : data.sxp_parameter) === null || _a === void 0 ? void 0 : _a.personalized_recommend) !== null && _b !== void 0 ? _b : maxSize, defaultSize: (_d = (_c = data === null || data === void 0 ? void 0 : data.sxp_parameter) === null || _c === void 0 ? void 0 : _c.default_recommend) !== null && _d !== void 0 ? _d : defaultSize, hashTagSize: (_f = (_e = data === null || data === void 0 ? void 0 : data.sxp_parameter) === null || _e === void 0 ? void 0 : _e.hash_tag_size) !== null && _f !== void 0 ? _f : hashTagSize, loadingImage: loadingImage, appDomain: appDomain, enabledMetaConversionApi: enabledMetaConversionApi, utmParameter: data === null || data === void 0 ? void 0 : data.utm_parameter, data: data, dataList: dataList, onUpdateSchema: (d) => setSchema(d), onUpdateChannel: (d) => setChannel(d), render: ({ rtcList, tagList, pageData }) => {
|
22
22
|
var _a;
|
23
23
|
return (React.createElement(React.Fragment, null,
|
24
|
-
React.createElement(SxpPageRender, Object.assign({ defaultData: data }, (_a = pageData === null || pageData === void 0 ? void 0 : pageData.data) === null || _a === void 0 ? void 0 : _a.sxpPageConf, { tagList: tagList, data: rtcList, resolver: RESOLVER })),
|
24
|
+
React.createElement(SxpPageRender, Object.assign({ defaultData: data }, (_a = pageData === null || pageData === void 0 ? void 0 : pageData.data) === null || _a === void 0 ? void 0 : _a.sxpPageConf, { tagList: tagList, data: rtcList, resolver: RESOLVER, isAbTestPage: dataList && (dataList === null || dataList === void 0 ? void 0 : dataList.length) > 1 })),
|
25
25
|
React.createElement(Popup, null)));
|
26
26
|
} })));
|
27
27
|
};
|
@@ -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);
|
@@ -26,7 +26,7 @@ import ConsentPopup from './ConsentPopup';
|
|
26
26
|
import MultiPosts from '../../../materials/sxp/MultiPosts';
|
27
27
|
import { useEditorDataProvider } from '../../../core/context/EditorDataProvider';
|
28
28
|
import NavBack from './NavBack';
|
29
|
-
const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.innerHeight, containerWidth = window.innerWidth, tempMap, resolver, data = [], ctaType, tipText, nudge, _schema, hashTagStyle, hashTagRightMargin, tagList = [], defaultData }) => {
|
29
|
+
const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.innerHeight, containerWidth = window.innerWidth, tempMap, resolver, data = [], ctaType, tipText, nudge, _schema, hashTagStyle, hashTagRightMargin, tagList = [], defaultData, isAbTestPage }) => {
|
30
30
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
|
31
31
|
const mutedIcon = useIconLink('/pb_static/5beaaa5ce7f3477b99db3838619cc471.png');
|
32
32
|
const unmutedIcon = useIconLink('/pb_static/fea8668a8a894e4aa3a86bcc775e895e.png');
|
@@ -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);
|
@@ -554,7 +554,8 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
554
554
|
isReload,
|
555
555
|
renderToggleButton
|
556
556
|
]);
|
557
|
-
return (React.createElement(
|
557
|
+
return (React.createElement(React.Fragment, null, isAbTestPage && loading ? (React.createElement("div", { style: { height, width: containerWidth, display: 'flex', justifyContent: 'center', alignItems: 'center' } },
|
558
|
+
React.createElement("img", { width: 64, height: 64, src: loadingImage, alt: 'loading...', style: { objectFit: 'contain' } }))) : (React.createElement("div", { id: 'sxp-render', className: 'clc-sxp-container', style: Object.assign({}, ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.textUnderlineOffset) && { textUnderlineOffset: `${globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.textUnderlineOffset}px` })) },
|
558
559
|
waterFallData && (React.createElement(Navbar, { icon: left, styles: { background: 'rgba(0,0,0,.3)', color: '#fff', top: `${minusHeight}px` }, textStyle: Object.assign(Object.assign({}, (_e = (_d = (_c = (_b = (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.hashTag) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.item) === null || _c === void 0 ? void 0 : _c.props) === null || _d === void 0 ? void 0 : _d.textStyles) === null || _e === void 0 ? void 0 : _e.hashTagTitle), { color: '#fff' }), onClose: () => {
|
559
560
|
const isEq = isEqual(rtcList, cacheRtcList);
|
560
561
|
if (!isEq && cacheRtcList && (cacheRtcList === null || cacheRtcList === void 0 ? void 0 : cacheRtcList.length)) {
|
@@ -613,6 +614,6 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
613
614
|
renderToggleButton(!!(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconFixed))),
|
614
615
|
React.createElement(WaterFall, Object.assign({}, (_u = (_t = (_s = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.hashTag) === null || _s === void 0 ? void 0 : _s[0]) === null || _t === void 0 ? void 0 : _t.item) === null || _u === void 0 ? void 0 : _u.props)),
|
615
616
|
React.createElement(ConsentPopup, { resolver: resolver, globalConfig: globalConfig }),
|
616
|
-
openMultiPosts && (React.createElement(MultiPosts, Object.assign({}, (_x = (_w = (_v = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.multiPosts) === null || _v === void 0 ? void 0 : _v[0]) === null || _w === void 0 ? void 0 : _w.item) === null || _x === void 0 ? void 0 : _x.props, (_0 = (_z = (_y = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.multiPosts) === null || _y === void 0 ? void 0 : _y[0]) === null || _z === void 0 ? void 0 : _z.item) === null || _0 === void 0 ? void 0 : _0.event, { style: { position: 'fixed', top: 0, left: 0, right: 0 } })))));
|
617
|
+
openMultiPosts && (React.createElement(MultiPosts, Object.assign({}, (_x = (_w = (_v = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.multiPosts) === null || _v === void 0 ? void 0 : _v[0]) === null || _w === void 0 ? void 0 : _w.item) === null || _x === void 0 ? void 0 : _x.props, (_0 = (_z = (_y = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.multiPosts) === null || _y === void 0 ? void 0 : _y[0]) === null || _z === void 0 ? void 0 : _z.item) === null || _0 === void 0 ? void 0 : _0.event, { style: { position: 'fixed', top: 0, left: 0, right: 0 } })))))));
|
617
618
|
};
|
618
619
|
export default SxpPageRender;
|
@@ -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 {
|
@@ -21,7 +21,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
21
21
|
var _a, _b, _c, _d, _e;
|
22
22
|
const [rtcList, setRtcList] = useState([]);
|
23
23
|
const [tagList, setTagList] = useState([]);
|
24
|
-
const [loading, setLoading] = useState(
|
24
|
+
const [loading, setLoading] = useState(true);
|
25
25
|
const [curReqInfo, setCurReqInfo] = useState({ rtc: '', requestId: '' });
|
26
26
|
const swiperRef = useRef(null);
|
27
27
|
const isInit = useRef(false);
|
@@ -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,41 @@
|
|
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
|
-
var { isTel, open, content, style, consentPopupCate, acceptButton, rejectButton } = _a, props = __rest(_a, ["isTel", "open", "content", "style", "consentPopupCate", "acceptButton", "rejectButton"]);
|
9
|
+
var { isTel, open, content, style, consentPopupCate, acceptButton, rejectButton, showRejectButton } = _a, props = __rest(_a, ["isTel", "open", "content", "style", "consentPopupCate", "acceptButton", "rejectButton", "showRejectButton"]);
|
10
|
+
const { getAccount, accountSonsent } = useSxpDataSource();
|
11
|
+
const [consentResult, setConsentResult] = useState(true);
|
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
|
+
});
|
8
16
|
const visivle = useMemo(() => {
|
9
|
-
return consentPopupCate || (open && style);
|
10
|
-
}, [consentPopupCate, open]);
|
11
|
-
|
12
|
-
|
17
|
+
return consentPopupCate || (open && style && !consentResult);
|
18
|
+
}, [consentPopupCate, open, style, consentResult]);
|
19
|
+
useEffect(() => {
|
20
|
+
!consentPopupCate && open && style && handleGetAccount();
|
21
|
+
}, []);
|
22
|
+
const handleClickAccept = () => __awaiter(void 0, void 0, void 0, function* () {
|
23
|
+
const res = yield (accountSonsent === null || accountSonsent === void 0 ? void 0 : accountSonsent(true));
|
24
|
+
if (res)
|
25
|
+
setConsentResult(true);
|
26
|
+
});
|
27
|
+
const handleClickReject = () => {
|
28
|
+
history === null || history === void 0 ? void 0 : history.back();
|
29
|
+
};
|
13
30
|
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
31
|
React.createElement("div", { className: 'consentPopupClick-container', style: style },
|
15
|
-
React.createElement(
|
16
|
-
|
17
|
-
React.createElement("button", { style:
|
32
|
+
React.createElement("div", { className: 'consentPopupClick-container-content' },
|
33
|
+
React.createElement(ConsentDetail, { content: content, style: { padding: 0 } })),
|
34
|
+
React.createElement("button", { style: acceptButton === null || acceptButton === void 0 ? void 0 : acceptButton.style, onClick: handleClickAccept, dangerouslySetInnerHTML: {
|
35
|
+
__html: setFontForText(acceptButton === null || acceptButton === void 0 ? void 0 : acceptButton.text, acceptButton === null || acceptButton === void 0 ? void 0 : acceptButton.style)
|
36
|
+
} }),
|
37
|
+
React.createElement("button", { hidden: !showRejectButton, style: rejectButton === null || rejectButton === void 0 ? void 0 : rejectButton.style, onClick: handleClickReject, dangerouslySetInnerHTML: {
|
38
|
+
__html: setFontForText(rejectButton === null || rejectButton === void 0 ? void 0 : rejectButton.text, rejectButton === null || rejectButton === void 0 ? void 0 : rejectButton.style)
|
39
|
+
} }))))))));
|
18
40
|
};
|
19
41
|
export default memo(Click);
|
@@ -121,6 +121,11 @@ export default [
|
|
121
121
|
{
|
122
122
|
title: '拒绝按钮样式',
|
123
123
|
child: [
|
124
|
+
{
|
125
|
+
type: 'Switch',
|
126
|
+
label: '开启',
|
127
|
+
name: ['props', 'showRejectButton']
|
128
|
+
},
|
124
129
|
{
|
125
130
|
type: 'Color',
|
126
131
|
label: '背景色',
|
@@ -152,7 +157,7 @@ export default [
|
|
152
157
|
{
|
153
158
|
type: 'TextMargin',
|
154
159
|
label: '边距',
|
155
|
-
name: ['props', '
|
160
|
+
name: ['props', 'rejectButton', 'style']
|
156
161
|
},
|
157
162
|
{
|
158
163
|
type: 'Group',
|
@@ -1,13 +1,30 @@
|
|
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
8
|
var { isTel, open, content, style, consentPopupCate, swipeIcon } = _a, props = __rest(_a, ["isTel", "open", "content", "style", "consentPopupCate", "swipeIcon"]);
|
9
9
|
const touchInfo = useRef();
|
10
10
|
const threshold = 50;
|
11
|
+
const { getAccount, accountSonsent } = useSxpDataSource();
|
12
|
+
const [consentResult, setConsentResult] = useState(true);
|
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
|
+
const visivle = useMemo(() => {
|
18
|
+
return consentPopupCate || (open && style && !consentResult);
|
19
|
+
}, [consentPopupCate, open, style, consentResult]);
|
20
|
+
useEffect(() => {
|
21
|
+
!consentPopupCate && open && style && handleGetAccount();
|
22
|
+
}, []);
|
23
|
+
const handleClickAccept = () => __awaiter(void 0, void 0, void 0, function* () {
|
24
|
+
const res = yield (accountSonsent === null || accountSonsent === void 0 ? void 0 : accountSonsent(true));
|
25
|
+
if (res)
|
26
|
+
setConsentResult(true);
|
27
|
+
});
|
11
28
|
const handleTouchStart = (event) => {
|
12
29
|
const touch = event.touches[0];
|
13
30
|
touchInfo.current = { y: touch.clientY, d: 0 };
|
@@ -26,19 +43,15 @@ const Swipe = (_a) => {
|
|
26
43
|
return;
|
27
44
|
const { d } = touchInfo.current || {};
|
28
45
|
if (d > threshold) {
|
46
|
+
handleClickAccept();
|
29
47
|
}
|
30
48
|
touchInfo.current = {};
|
31
49
|
};
|
32
|
-
const handleClickReject = () => { };
|
33
|
-
const visivle = useMemo(() => {
|
34
|
-
return consentPopupCate || (open && style);
|
35
|
-
}, [consentPopupCate, open]);
|
36
50
|
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
51
|
React.createElement("div", { className: 'consentPopupSwipe-container', style: style },
|
38
|
-
React.createElement(
|
39
|
-
|
40
|
-
|
41
|
-
swipeIcon && (React.createElement("div", { className: 'consentPopupSwipe-container-swipeIcon', onClick: handleClickReject },
|
52
|
+
React.createElement("div", { className: 'consentPopupSwipe-container-content' },
|
53
|
+
React.createElement(ConsentDetail, { content: content, style: { padding: 0 } })),
|
54
|
+
swipeIcon && (React.createElement("div", { className: 'consentPopupSwipe-container-swipeIcon' },
|
42
55
|
React.createElement("img", { src: swipeIcon, alt: 'Swipe Icon' }))))))))));
|
43
56
|
};
|
44
57
|
export default memo(Swipe);
|
@@ -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,
|
@@ -24,7 +24,7 @@ const SxpPageCore = ({ data, maxSize = 10, defaultSize = 10, hashTagSize = 20, l
|
|
24
24
|
react_1.default.createElement(SxpDataSourceProvider_1.default, { utmVal: utmVal, dataSources: data === null || data === void 0 ? void 0 : data.data_sources, sxpParameter: data === null || data === void 0 ? void 0 : data.sxp_parameter, maxSize: (_b = (_a = data === null || data === void 0 ? void 0 : data.sxp_parameter) === null || _a === void 0 ? void 0 : _a.personalized_recommend) !== null && _b !== void 0 ? _b : maxSize, defaultSize: (_d = (_c = data === null || data === void 0 ? void 0 : data.sxp_parameter) === null || _c === void 0 ? void 0 : _c.default_recommend) !== null && _d !== void 0 ? _d : defaultSize, hashTagSize: (_f = (_e = data === null || data === void 0 ? void 0 : data.sxp_parameter) === null || _e === void 0 ? void 0 : _e.hash_tag_size) !== null && _f !== void 0 ? _f : hashTagSize, loadingImage: loadingImage, appDomain: appDomain, enabledMetaConversionApi: enabledMetaConversionApi, utmParameter: data === null || data === void 0 ? void 0 : data.utm_parameter, data: data, dataList: dataList, onUpdateSchema: (d) => setSchema(d), onUpdateChannel: (d) => setChannel(d), render: ({ rtcList, tagList, pageData }) => {
|
25
25
|
var _a;
|
26
26
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
27
|
-
react_1.default.createElement(SxpPageRender_1.default, Object.assign({ defaultData: data }, (_a = pageData === null || pageData === void 0 ? void 0 : pageData.data) === null || _a === void 0 ? void 0 : _a.sxpPageConf, { tagList: tagList, data: rtcList, resolver: RESOLVER })),
|
27
|
+
react_1.default.createElement(SxpPageRender_1.default, Object.assign({ defaultData: data }, (_a = pageData === null || pageData === void 0 ? void 0 : pageData.data) === null || _a === void 0 ? void 0 : _a.sxpPageConf, { tagList: tagList, data: rtcList, resolver: RESOLVER, isAbTestPage: dataList && (dataList === null || dataList === void 0 ? void 0 : dataList.length) > 1 })),
|
28
28
|
react_1.default.createElement(Popup_1.default, null)));
|
29
29
|
} })));
|
30
30
|
};
|
@@ -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);
|
@@ -29,7 +29,7 @@ const ConsentPopup_1 = tslib_1.__importDefault(require("./ConsentPopup"));
|
|
29
29
|
const MultiPosts_1 = tslib_1.__importDefault(require("../../../materials/sxp/MultiPosts"));
|
30
30
|
const EditorDataProvider_1 = require("../../../core/context/EditorDataProvider");
|
31
31
|
const NavBack_1 = tslib_1.__importDefault(require("./NavBack"));
|
32
|
-
const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.innerHeight, containerWidth = window.innerWidth, tempMap, resolver, data = [], ctaType, tipText, nudge, _schema, hashTagStyle, hashTagRightMargin, tagList = [], defaultData }) => {
|
32
|
+
const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.innerHeight, containerWidth = window.innerWidth, tempMap, resolver, data = [], ctaType, tipText, nudge, _schema, hashTagStyle, hashTagRightMargin, tagList = [], defaultData, isAbTestPage }) => {
|
33
33
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
|
34
34
|
const mutedIcon = (0, useIconLink_1.useIconLink)('/pb_static/5beaaa5ce7f3477b99db3838619cc471.png');
|
35
35
|
const unmutedIcon = (0, useIconLink_1.useIconLink)('/pb_static/fea8668a8a894e4aa3a86bcc775e895e.png');
|
@@ -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);
|
@@ -557,7 +557,8 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
557
557
|
isReload,
|
558
558
|
renderToggleButton
|
559
559
|
]);
|
560
|
-
return (react_1.default.createElement(
|
560
|
+
return (react_1.default.createElement(react_1.default.Fragment, null, isAbTestPage && loading ? (react_1.default.createElement("div", { style: { height, width: containerWidth, display: 'flex', justifyContent: 'center', alignItems: 'center' } },
|
561
|
+
react_1.default.createElement("img", { width: 64, height: 64, src: loadingImage, alt: 'loading...', style: { objectFit: 'contain' } }))) : (react_1.default.createElement("div", { id: 'sxp-render', className: 'clc-sxp-container', style: Object.assign({}, ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.textUnderlineOffset) && { textUnderlineOffset: `${globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.textUnderlineOffset}px` })) },
|
561
562
|
waterFallData && (react_1.default.createElement(Navbar_1.default, { icon: left_png_1.default, styles: { background: 'rgba(0,0,0,.3)', color: '#fff', top: `${minusHeight}px` }, textStyle: Object.assign(Object.assign({}, (_e = (_d = (_c = (_b = (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.hashTag) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.item) === null || _c === void 0 ? void 0 : _c.props) === null || _d === void 0 ? void 0 : _d.textStyles) === null || _e === void 0 ? void 0 : _e.hashTagTitle), { color: '#fff' }), onClose: () => {
|
562
563
|
const isEq = (0, lodash_1.isEqual)(rtcList, cacheRtcList);
|
563
564
|
if (!isEq && cacheRtcList && (cacheRtcList === null || cacheRtcList === void 0 ? void 0 : cacheRtcList.length)) {
|
@@ -616,6 +617,6 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
616
617
|
renderToggleButton(!!(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconFixed))),
|
617
618
|
react_1.default.createElement(WaterFall_1.default, Object.assign({}, (_u = (_t = (_s = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.hashTag) === null || _s === void 0 ? void 0 : _s[0]) === null || _t === void 0 ? void 0 : _t.item) === null || _u === void 0 ? void 0 : _u.props)),
|
618
619
|
react_1.default.createElement(ConsentPopup_1.default, { resolver: resolver, globalConfig: globalConfig }),
|
619
|
-
openMultiPosts && (react_1.default.createElement(MultiPosts_1.default, Object.assign({}, (_x = (_w = (_v = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.multiPosts) === null || _v === void 0 ? void 0 : _v[0]) === null || _w === void 0 ? void 0 : _w.item) === null || _x === void 0 ? void 0 : _x.props, (_0 = (_z = (_y = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.multiPosts) === null || _y === void 0 ? void 0 : _y[0]) === null || _z === void 0 ? void 0 : _z.item) === null || _0 === void 0 ? void 0 : _0.event, { style: { position: 'fixed', top: 0, left: 0, right: 0 } })))));
|
620
|
+
openMultiPosts && (react_1.default.createElement(MultiPosts_1.default, Object.assign({}, (_x = (_w = (_v = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.multiPosts) === null || _v === void 0 ? void 0 : _v[0]) === null || _w === void 0 ? void 0 : _w.item) === null || _x === void 0 ? void 0 : _x.props, (_0 = (_z = (_y = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.multiPosts) === null || _y === void 0 ? void 0 : _y[0]) === null || _z === void 0 ? void 0 : _z.item) === null || _0 === void 0 ? void 0 : _0.event, { style: { position: 'fixed', top: 0, left: 0, right: 0 } })))))));
|
620
621
|
};
|
621
622
|
exports.default = SxpPageRender;
|
@@ -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 {
|
@@ -24,7 +24,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
24
24
|
var _a, _b, _c, _d, _e;
|
25
25
|
const [rtcList, setRtcList] = (0, react_1.useState)([]);
|
26
26
|
const [tagList, setTagList] = (0, react_1.useState)([]);
|
27
|
-
const [loading, setLoading] = (0, react_1.useState)(
|
27
|
+
const [loading, setLoading] = (0, react_1.useState)(true);
|
28
28
|
const [curReqInfo, setCurReqInfo] = (0, react_1.useState)({ rtc: '', requestId: '' });
|
29
29
|
const swiperRef = (0, react_1.useRef)(null);
|
30
30
|
const isInit = (0, react_1.useRef)(false);
|
@@ -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,
|