pb-sxp-ui 1.12.3 → 1.13.0
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 +52 -109
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +52 -109
- 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 +52 -109
- 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/context/SxpDataSourceProvider.js +41 -20
- package/es/core/utils/materials.js +5 -3
- package/es/materials/sxp/popup/Iframe/index.d.ts +0 -4
- package/es/materials/sxp/popup/Iframe/index.js +4 -5
- package/es/materials/sxp/popup/Iframe/settingRender.js +0 -15
- package/lib/core/context/SxpDataSourceProvider.js +40 -19
- package/lib/core/utils/materials.js +5 -3
- package/lib/materials/sxp/popup/Iframe/index.d.ts +0 -4
- package/lib/materials/sxp/popup/Iframe/index.js +4 -5
- package/lib/materials/sxp/popup/Iframe/settingRender.js +0 -15
- package/package.json +1 -1
@@ -6,7 +6,7 @@ import { storeAndLoadFeUserId, AGREE_POLICY } from '../utils/localStore';
|
|
6
6
|
import { useIconLink } from '../components/SxpPageRender/useIconLink';
|
7
7
|
import SXP_EVENT_BUS, { SXP_EVENT_TYPE } from '../utils/event';
|
8
8
|
import Consent from '../components/Consent';
|
9
|
-
import {
|
9
|
+
import { getCookie } from '../utils/tool';
|
10
10
|
import { cloneDeep } from 'lodash';
|
11
11
|
export const SxpDataSourceContext = createContext({
|
12
12
|
rtcList: [],
|
@@ -99,29 +99,32 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
99
99
|
const bffDataSource = useMemo(() => {
|
100
100
|
return dataSources === null || dataSources === void 0 ? void 0 : dataSources.find((d) => d.type === DataSourceType.BFF);
|
101
101
|
}, [dataSources]);
|
102
|
+
const fakeUserId = useMemo(() => {
|
103
|
+
var _a;
|
104
|
+
return ((_a = bffDataSource === null || bffDataSource === void 0 ? void 0 : bffDataSource.headers) === null || _a === void 0 ? void 0 : _a['x-app-id']) + storeAndLoadFeUserId();
|
105
|
+
}, [bffDataSource]);
|
102
106
|
const bffFetch = useCallback((path, options) => {
|
103
107
|
if (!bffDataSource)
|
104
108
|
return;
|
105
109
|
const url = bffDataSource.url;
|
106
|
-
const fakeUserId = storeAndLoadFeUserId();
|
107
110
|
if (options === null || options === void 0 ? void 0 : options.query) {
|
108
111
|
const queryString = qs.stringify(options.query);
|
109
112
|
path = `${path}?${queryString}`;
|
110
113
|
}
|
111
114
|
if (options.type === 'beacon' && navigator.sendBeacon) {
|
112
|
-
return navigator.sendBeacon(`${url}/api
|
115
|
+
return navigator.sendBeacon(`${url}/api/${path}`, new Blob([
|
113
116
|
JSON.stringify(Object.assign(Object.assign(Object.assign({}, options.body), bffDataSource.headers), { 'x-user-id': fakeUserId }))
|
114
117
|
], { type: 'application/json;charset=UTF-8' }));
|
115
118
|
}
|
116
119
|
return window
|
117
|
-
.fetch(`${url}/api
|
120
|
+
.fetch(`${url}/api/${path}`, {
|
118
121
|
headers: Object.assign({ 'Content-Type': 'application/json', 'x-user-id': fakeUserId }, bffDataSource.headers),
|
119
122
|
method: options.method,
|
120
123
|
body: JSON.stringify(options.body)
|
121
124
|
})
|
122
125
|
.then((res) => res.json())
|
123
126
|
.catch((err) => Promise.reject(err));
|
124
|
-
}, [bffDataSource]);
|
127
|
+
}, [bffDataSource, fakeUserId]);
|
125
128
|
const getRecommendVideos = useCallback((query) => __awaiter(void 0, void 0, void 0, function* () {
|
126
129
|
var _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
127
130
|
query = {
|
@@ -158,7 +161,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
158
161
|
const recurveRecList = (query) => __awaiter(void 0, void 0, void 0, function* () {
|
159
162
|
var _v, _w, _x, _y, _z, _0;
|
160
163
|
query.pageNum = pageNum;
|
161
|
-
result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/recommend/list', { method: 'POST', body: query }));
|
164
|
+
result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/recommend/list', { method: 'POST', body: query }));
|
162
165
|
if (!(result === null || result === void 0 ? void 0 : result.success)) {
|
163
166
|
return undefined;
|
164
167
|
}
|
@@ -180,7 +183,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
180
183
|
if (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview) {
|
181
184
|
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
185
|
}
|
183
|
-
const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/recommend/list', { method: 'POST', body: query }));
|
186
|
+
const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/recommend/list', { method: 'POST', body: query }));
|
184
187
|
if (!(result === null || result === void 0 ? void 0 : result.success)) {
|
185
188
|
return undefined;
|
186
189
|
}
|
@@ -230,6 +233,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
230
233
|
return expire;
|
231
234
|
}, [data]);
|
232
235
|
const bffEventReport = useCallback(({ userInfo, eventInfo, reportLayId = true }) => {
|
236
|
+
var _a;
|
233
237
|
if (!enableReportEvent || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview)) {
|
234
238
|
return;
|
235
239
|
}
|
@@ -237,7 +241,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
237
241
|
userInfo = {};
|
238
242
|
}
|
239
243
|
const sessionID = storeAndLoadFeSessionId();
|
240
|
-
const ef = Object.assign(Object.assign(Object.assign(Object.assign(
|
244
|
+
const ef = 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 + '' }));
|
241
245
|
const realUserInfo = Object.entries(userInfo).map(([k, v]) => ({ name: k, value: v }));
|
242
246
|
const realEventInfo = Object.entries(ef)
|
243
247
|
.map(([k, v]) => v && { name: k, value: v })
|
@@ -246,14 +250,23 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
246
250
|
console.log('userInfo:', userInfo);
|
247
251
|
console.log('eventInfo:', ef);
|
248
252
|
console.log('========= 结束 =========');
|
249
|
-
return bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch(
|
253
|
+
return bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch(`v2/event/report/CLD/${(_a = bffDataSource === null || bffDataSource === void 0 ? void 0 : bffDataSource.headers) === null || _a === void 0 ? void 0 : _a['x-app-id']}/${eventInfo === null || eventInfo === void 0 ? void 0 : eventInfo.eventSubject}`, {
|
250
254
|
method: 'POST',
|
251
255
|
body: { userInfo: realUserInfo, eventInfo: realEventInfo },
|
252
256
|
type: 'beacon'
|
253
257
|
});
|
254
|
-
}, [
|
258
|
+
}, [
|
259
|
+
bffFetch,
|
260
|
+
curReqInfo,
|
261
|
+
enableReportEvent,
|
262
|
+
globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview,
|
263
|
+
layoutVariantId,
|
264
|
+
globalConfig,
|
265
|
+
playbookType,
|
266
|
+
bffDataSource
|
267
|
+
]);
|
255
268
|
const bffFbReport = useCallback(({ eventName, product }) => {
|
256
|
-
var _a, _b, _c, _d, _e;
|
269
|
+
var _a, _b, _c, _d, _e, _f;
|
257
270
|
if (!enableReportEvent ||
|
258
271
|
!enabledMetaConversionApi ||
|
259
272
|
(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview) ||
|
@@ -265,7 +278,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
265
278
|
const fbclid = urlParams === null || urlParams === void 0 ? void 0 : urlParams.get('fbclid');
|
266
279
|
const fix_par = {
|
267
280
|
event_source_url: (_c = window === null || window === void 0 ? void 0 : window.location) === null || _c === void 0 ? void 0 : _c.href,
|
268
|
-
external_id:
|
281
|
+
external_id: fakeUserId,
|
269
282
|
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
283
|
fbc: fbclid ? `fb.2.${new Date().getTime()}.${fbclid}` : '',
|
271
284
|
fbp: getCookie('_fbp') ? `fb.2.${new Date().getTime()}.${getCookie('_fbp')}` : '',
|
@@ -317,22 +330,30 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
317
330
|
}
|
318
331
|
};
|
319
332
|
getEventParams(jsonParams);
|
320
|
-
return bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch(
|
333
|
+
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
334
|
method: 'POST',
|
322
335
|
body: jsonParams,
|
323
336
|
type: 'beacon'
|
324
337
|
});
|
325
|
-
}, [
|
338
|
+
}, [
|
339
|
+
bffFetch,
|
340
|
+
enableReportEvent,
|
341
|
+
enabledMetaConversionApi,
|
342
|
+
globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview,
|
343
|
+
globalConfig,
|
344
|
+
fakeUserId,
|
345
|
+
bffDataSource
|
346
|
+
]);
|
326
347
|
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 }));
|
348
|
+
const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/recommend/like', { method: 'POST', body }));
|
328
349
|
return res === null || res === void 0 ? void 0 : res.success;
|
329
350
|
}), [bffFetch]);
|
330
351
|
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 }));
|
352
|
+
const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/recommend/unlike', { method: 'POST', body }));
|
332
353
|
return res === null || res === void 0 ? void 0 : res.success;
|
333
354
|
}), [bffFetch]);
|
334
355
|
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 }));
|
356
|
+
const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/customform', { method: 'POST', body }));
|
336
357
|
return res === null || res === void 0 ? void 0 : res.success;
|
337
358
|
}), [bffFetch]);
|
338
359
|
const bffGetTagList = useCallback((data) => __awaiter(void 0, void 0, void 0, function* () {
|
@@ -346,7 +367,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
346
367
|
const key = val.split('=')[0];
|
347
368
|
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
369
|
})) === 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) } }));
|
370
|
+
const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/tag/list', { method: 'GET', query: { channel: decodeURIComponent(val) } }));
|
350
371
|
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
372
|
}
|
352
373
|
catch (e) {
|
@@ -420,10 +441,10 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
420
441
|
let curData;
|
421
442
|
let gldata;
|
422
443
|
if (data === null || data === void 0 ? void 0 : data.layoutVariantId) {
|
444
|
+
layId = data === null || data === void 0 ? void 0 : data.layoutVariantId;
|
445
|
+
setLayoutVariantId(data === null || data === void 0 ? void 0 : data.layoutVariantId);
|
423
446
|
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];
|
424
447
|
if (id) {
|
425
|
-
layId = id;
|
426
|
-
setLayoutVariantId(id);
|
427
448
|
curData = dataList === null || dataList === void 0 ? void 0 : dataList.find((item) => (item === null || item === void 0 ? void 0 : item.id) === id);
|
428
449
|
if (curData) {
|
429
450
|
setPageData(curData);
|
@@ -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
|
}
|
@@ -12,10 +12,6 @@ export interface IIframeProps {
|
|
12
12
|
submitButtonStyle?: CSSProperties;
|
13
13
|
contentStyle?: CSSProperties;
|
14
14
|
isTel?: boolean;
|
15
|
-
iframe?: {
|
16
|
-
src?: string;
|
17
|
-
allow?: string;
|
18
|
-
};
|
19
15
|
}
|
20
16
|
declare const _default: React.NamedExoticComponent<IIframeProps>;
|
21
17
|
export default _default;
|
@@ -5,12 +5,11 @@ import './index.less';
|
|
5
5
|
import { useSxpDataSource } from '../../../../core/hooks';
|
6
6
|
const Iframe = (_a) => {
|
7
7
|
var _b, _c;
|
8
|
-
var { content, btnText, style, icon, isPopup, isExternalLink, onClose, onClick, submitButtonStyle, contentStyle, isTel
|
8
|
+
var { content, btnText, style, icon, isPopup, isExternalLink, onClose, onClick, submitButtonStyle, contentStyle, isTel } = _a, props = __rest(_a, ["content", "btnText", "style", "icon", "isPopup", "isExternalLink", "onClose", "onClick", "submitButtonStyle", "contentStyle", "isTel"]);
|
9
9
|
const { popupDetailData } = useSxpDataSource();
|
10
|
-
const
|
11
|
-
|
12
|
-
|
13
|
-
React.createElement("iframe", { src: iframeUrl, allow: allow, scrolling: 'no', style: {
|
10
|
+
const iframeUrl = (_c = (_b = popupDetailData === null || popupDetailData === void 0 ? void 0 : popupDetailData.video) === null || _b === void 0 ? void 0 : _b.bindCta) === null || _c === void 0 ? void 0 : _c.remark;
|
11
|
+
return (React.createElement("div", Object.assign({ className: `${css(Object.assign({}, style))}` }, props),
|
12
|
+
React.createElement("iframe", { src: iframeUrl, style: {
|
14
13
|
width: '100%',
|
15
14
|
height: 'calc(100% - 50px)',
|
16
15
|
marginTop: '50px',
|
@@ -8,20 +8,5 @@ export default [
|
|
8
8
|
name: ['style', 'backgroundColor']
|
9
9
|
}
|
10
10
|
]
|
11
|
-
},
|
12
|
-
{
|
13
|
-
title: 'iframe',
|
14
|
-
child: [
|
15
|
-
{
|
16
|
-
type: 'TextArea',
|
17
|
-
label: 'url',
|
18
|
-
name: ['props', 'iframe', 'src']
|
19
|
-
},
|
20
|
-
{
|
21
|
-
type: 'TextArea',
|
22
|
-
label: 'allow',
|
23
|
-
name: ['props', 'iframe', 'allow']
|
24
|
-
}
|
25
|
-
]
|
26
11
|
}
|
27
12
|
];
|
@@ -102,29 +102,32 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
102
102
|
const bffDataSource = (0, react_1.useMemo)(() => {
|
103
103
|
return dataSources === null || dataSources === void 0 ? void 0 : dataSources.find((d) => d.type === DataSourceType.BFF);
|
104
104
|
}, [dataSources]);
|
105
|
+
const fakeUserId = (0, react_1.useMemo)(() => {
|
106
|
+
var _a;
|
107
|
+
return ((_a = bffDataSource === null || bffDataSource === void 0 ? void 0 : bffDataSource.headers) === null || _a === void 0 ? void 0 : _a['x-app-id']) + (0, localStore_1.storeAndLoadFeUserId)();
|
108
|
+
}, [bffDataSource]);
|
105
109
|
const bffFetch = (0, react_1.useCallback)((path, options) => {
|
106
110
|
if (!bffDataSource)
|
107
111
|
return;
|
108
112
|
const url = bffDataSource.url;
|
109
|
-
const fakeUserId = (0, localStore_1.storeAndLoadFeUserId)();
|
110
113
|
if (options === null || options === void 0 ? void 0 : options.query) {
|
111
114
|
const queryString = qs_1.default.stringify(options.query);
|
112
115
|
path = `${path}?${queryString}`;
|
113
116
|
}
|
114
117
|
if (options.type === 'beacon' && navigator.sendBeacon) {
|
115
|
-
return navigator.sendBeacon(`${url}/api
|
118
|
+
return navigator.sendBeacon(`${url}/api/${path}`, new Blob([
|
116
119
|
JSON.stringify(Object.assign(Object.assign(Object.assign({}, options.body), bffDataSource.headers), { 'x-user-id': fakeUserId }))
|
117
120
|
], { type: 'application/json;charset=UTF-8' }));
|
118
121
|
}
|
119
122
|
return window
|
120
|
-
.fetch(`${url}/api
|
123
|
+
.fetch(`${url}/api/${path}`, {
|
121
124
|
headers: Object.assign({ 'Content-Type': 'application/json', 'x-user-id': fakeUserId }, bffDataSource.headers),
|
122
125
|
method: options.method,
|
123
126
|
body: JSON.stringify(options.body)
|
124
127
|
})
|
125
128
|
.then((res) => res.json())
|
126
129
|
.catch((err) => Promise.reject(err));
|
127
|
-
}, [bffDataSource]);
|
130
|
+
}, [bffDataSource, fakeUserId]);
|
128
131
|
const getRecommendVideos = (0, react_1.useCallback)((query) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
129
132
|
var _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
130
133
|
query = {
|
@@ -161,7 +164,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
161
164
|
const recurveRecList = (query) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
162
165
|
var _v, _w, _x, _y, _z, _0;
|
163
166
|
query.pageNum = pageNum;
|
164
|
-
result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/recommend/list', { method: 'POST', body: query }));
|
167
|
+
result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/recommend/list', { method: 'POST', body: query }));
|
165
168
|
if (!(result === null || result === void 0 ? void 0 : result.success)) {
|
166
169
|
return undefined;
|
167
170
|
}
|
@@ -183,7 +186,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
183
186
|
if (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview) {
|
184
187
|
query = Object.assign(Object.assign({}, query), { directPage: true, level: 1, pageNum: (_o = query === null || query === void 0 ? void 0 : query.pageNum) !== null && _o !== void 0 ? _o : 1 });
|
185
188
|
}
|
186
|
-
const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/recommend/list', { method: 'POST', body: query }));
|
189
|
+
const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/recommend/list', { method: 'POST', body: query }));
|
187
190
|
if (!(result === null || result === void 0 ? void 0 : result.success)) {
|
188
191
|
return undefined;
|
189
192
|
}
|
@@ -233,6 +236,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
233
236
|
return expire;
|
234
237
|
}, [data]);
|
235
238
|
const bffEventReport = (0, react_1.useCallback)(({ userInfo, eventInfo, reportLayId = true }) => {
|
239
|
+
var _a;
|
236
240
|
if (!enableReportEvent || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview)) {
|
237
241
|
return;
|
238
242
|
}
|
@@ -240,7 +244,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
240
244
|
userInfo = {};
|
241
245
|
}
|
242
246
|
const sessionID = (0, sessionStore_1.storeAndLoadFeSessionId)();
|
243
|
-
const ef = Object.assign(Object.assign(Object.assign(Object.assign(
|
247
|
+
const ef = 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 + '' }));
|
244
248
|
const realUserInfo = Object.entries(userInfo).map(([k, v]) => ({ name: k, value: v }));
|
245
249
|
const realEventInfo = Object.entries(ef)
|
246
250
|
.map(([k, v]) => v && { name: k, value: v })
|
@@ -249,14 +253,23 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
249
253
|
console.log('userInfo:', userInfo);
|
250
254
|
console.log('eventInfo:', ef);
|
251
255
|
console.log('========= 结束 =========');
|
252
|
-
return bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch(
|
256
|
+
return bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch(`v2/event/report/CLD/${(_a = bffDataSource === null || bffDataSource === void 0 ? void 0 : bffDataSource.headers) === null || _a === void 0 ? void 0 : _a['x-app-id']}/${eventInfo === null || eventInfo === void 0 ? void 0 : eventInfo.eventSubject}`, {
|
253
257
|
method: 'POST',
|
254
258
|
body: { userInfo: realUserInfo, eventInfo: realEventInfo },
|
255
259
|
type: 'beacon'
|
256
260
|
});
|
257
|
-
}, [
|
261
|
+
}, [
|
262
|
+
bffFetch,
|
263
|
+
curReqInfo,
|
264
|
+
enableReportEvent,
|
265
|
+
globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview,
|
266
|
+
layoutVariantId,
|
267
|
+
globalConfig,
|
268
|
+
playbookType,
|
269
|
+
bffDataSource
|
270
|
+
]);
|
258
271
|
const bffFbReport = (0, react_1.useCallback)(({ eventName, product }) => {
|
259
|
-
var _a, _b, _c, _d, _e;
|
272
|
+
var _a, _b, _c, _d, _e, _f;
|
260
273
|
if (!enableReportEvent ||
|
261
274
|
!enabledMetaConversionApi ||
|
262
275
|
(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview) ||
|
@@ -268,7 +281,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
268
281
|
const fbclid = urlParams === null || urlParams === void 0 ? void 0 : urlParams.get('fbclid');
|
269
282
|
const fix_par = {
|
270
283
|
event_source_url: (_c = window === null || window === void 0 ? void 0 : window.location) === null || _c === void 0 ? void 0 : _c.href,
|
271
|
-
external_id:
|
284
|
+
external_id: fakeUserId,
|
272
285
|
client_user_agent: (_e = (_d = window === null || window === void 0 ? void 0 : window.navigator) === null || _d === void 0 ? void 0 : _d.userAgent) !== null && _e !== void 0 ? _e : '',
|
273
286
|
fbc: fbclid ? `fb.2.${new Date().getTime()}.${fbclid}` : '',
|
274
287
|
fbp: (0, tool_1.getCookie)('_fbp') ? `fb.2.${new Date().getTime()}.${(0, tool_1.getCookie)('_fbp')}` : '',
|
@@ -320,22 +333,30 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
320
333
|
}
|
321
334
|
};
|
322
335
|
getEventParams(jsonParams);
|
323
|
-
return bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch(
|
336
|
+
return bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch(`v2/event/report/FB/${(_f = bffDataSource === null || bffDataSource === void 0 ? void 0 : bffDataSource.headers) === null || _f === void 0 ? void 0 : _f['x-app-id']}/${eventName}`, {
|
324
337
|
method: 'POST',
|
325
338
|
body: jsonParams,
|
326
339
|
type: 'beacon'
|
327
340
|
});
|
328
|
-
}, [
|
341
|
+
}, [
|
342
|
+
bffFetch,
|
343
|
+
enableReportEvent,
|
344
|
+
enabledMetaConversionApi,
|
345
|
+
globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview,
|
346
|
+
globalConfig,
|
347
|
+
fakeUserId,
|
348
|
+
bffDataSource
|
349
|
+
]);
|
329
350
|
const bffMutateLike = (0, react_1.useCallback)((body) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
330
|
-
const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/recommend/like', { method: 'POST', body }));
|
351
|
+
const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/recommend/like', { method: 'POST', body }));
|
331
352
|
return res === null || res === void 0 ? void 0 : res.success;
|
332
353
|
}), [bffFetch]);
|
333
354
|
const bffMutateUnlike = (0, react_1.useCallback)((body) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
334
|
-
const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/recommend/unlike', { method: 'POST', body }));
|
355
|
+
const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/recommend/unlike', { method: 'POST', body }));
|
335
356
|
return res === null || res === void 0 ? void 0 : res.success;
|
336
357
|
}), [bffFetch]);
|
337
358
|
const bffSubmitForm = (0, react_1.useCallback)((body) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
338
|
-
const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/customform', { method: 'POST', body }));
|
359
|
+
const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/customform', { method: 'POST', body }));
|
339
360
|
return res === null || res === void 0 ? void 0 : res.success;
|
340
361
|
}), [bffFetch]);
|
341
362
|
const bffGetTagList = (0, react_1.useCallback)((data) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
@@ -349,7 +370,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
349
370
|
const key = val.split('=')[0];
|
350
371
|
return (_b = ((_a = utmParameter === null || utmParameter === void 0 ? void 0 : utmParameter.channels) !== null && _a !== void 0 ? _a : [])) === null || _b === void 0 ? void 0 : _b.includes(key);
|
351
372
|
})) === null || _9 === void 0 ? void 0 : _9.join('&')) !== null && _10 !== void 0 ? _10 : '';
|
352
|
-
const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/tag/list', { method: 'GET', query: { channel: decodeURIComponent(val) } }));
|
373
|
+
const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/tag/list', { method: 'GET', query: { channel: decodeURIComponent(val) } }));
|
353
374
|
setTagList((_12 = (_11 = result === null || result === void 0 ? void 0 : result.data) === null || _11 === void 0 ? void 0 : _11.tags) !== null && _12 !== void 0 ? _12 : []);
|
354
375
|
}
|
355
376
|
catch (e) {
|
@@ -423,10 +444,10 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
423
444
|
let curData;
|
424
445
|
let gldata;
|
425
446
|
if (data === null || data === void 0 ? void 0 : data.layoutVariantId) {
|
447
|
+
layId = data === null || data === void 0 ? void 0 : data.layoutVariantId;
|
448
|
+
setLayoutVariantId(data === null || data === void 0 ? void 0 : data.layoutVariantId);
|
426
449
|
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];
|
427
450
|
if (id) {
|
428
|
-
layId = id;
|
429
|
-
setLayoutVariantId(id);
|
430
451
|
curData = dataList === null || dataList === void 0 ? void 0 : dataList.find((item) => (item === null || item === void 0 ? void 0 : item.id) === id);
|
431
452
|
if (curData) {
|
432
453
|
setPageData(curData);
|
@@ -38,14 +38,16 @@ const getBgStyleByImg = (data) => {
|
|
38
38
|
exports.getBgStyleByImg = getBgStyleByImg;
|
39
39
|
const getPriceText = ({ product, enableFormattedPrice, globalConfig, isHiddenDef, style }) => {
|
40
40
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
41
|
+
let text = '';
|
41
42
|
if ((!(product === null || product === void 0 ? void 0 : product.currency) || !(product === null || product === void 0 ? void 0 : product.price)) && isHiddenDef)
|
42
43
|
return null;
|
43
|
-
let price = (product === null || product === void 0 ? void 0 : product.currency) && (product === null || product === void 0 ? void 0 : product.price) ? product === null || product === void 0 ? void 0 : product.price : 7000;
|
44
|
-
|
44
|
+
let price = Number((product === null || product === void 0 ? void 0 : product.currency) && (product === null || product === void 0 ? void 0 : product.price) ? product === null || product === void 0 ? void 0 : product.price : 7000);
|
45
|
+
if (typeof price !== 'number')
|
46
|
+
return text;
|
45
47
|
let priceSymbol = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.priceSymbol;
|
46
48
|
let currency = (product === null || product === void 0 ? void 0 : product.currency) ? (_c = (_b = (_a = product === null || product === void 0 ? void 0 : product.currency) === null || _a === void 0 ? void 0 : _a.split('-')[1]) === null || _b === void 0 ? void 0 : _b.toUpperCase()) !== null && _c !== void 0 ? _c : '' : '$';
|
47
49
|
const isToLocStr = enableFormattedPrice === undefined || enableFormattedPrice;
|
48
|
-
let decPic = price.toString();
|
50
|
+
let decPic = price === null || price === void 0 ? void 0 : price.toString();
|
49
51
|
if (priceSymbol === null || priceSymbol === void 0 ? void 0 : priceSymbol.showTwoDecimalPoint) {
|
50
52
|
decPic = price === null || price === void 0 ? void 0 : price.toFixed(2);
|
51
53
|
}
|
@@ -12,10 +12,6 @@ export interface IIframeProps {
|
|
12
12
|
submitButtonStyle?: CSSProperties;
|
13
13
|
contentStyle?: CSSProperties;
|
14
14
|
isTel?: boolean;
|
15
|
-
iframe?: {
|
16
|
-
src?: string;
|
17
|
-
allow?: string;
|
18
|
-
};
|
19
15
|
}
|
20
16
|
declare const _default: React.NamedExoticComponent<IIframeProps>;
|
21
17
|
export default _default;
|
@@ -7,12 +7,11 @@ require("./index.less");
|
|
7
7
|
const hooks_1 = require("../../../../core/hooks");
|
8
8
|
const Iframe = (_a) => {
|
9
9
|
var _b, _c;
|
10
|
-
var { content, btnText, style, icon, isPopup, isExternalLink, onClose, onClick, submitButtonStyle, contentStyle, isTel
|
10
|
+
var { content, btnText, style, icon, isPopup, isExternalLink, onClose, onClick, submitButtonStyle, contentStyle, isTel } = _a, props = tslib_1.__rest(_a, ["content", "btnText", "style", "icon", "isPopup", "isExternalLink", "onClose", "onClick", "submitButtonStyle", "contentStyle", "isTel"]);
|
11
11
|
const { popupDetailData } = (0, hooks_1.useSxpDataSource)();
|
12
|
-
const
|
13
|
-
|
14
|
-
|
15
|
-
react_1.default.createElement("iframe", { src: iframeUrl, allow: allow, scrolling: 'no', style: {
|
12
|
+
const iframeUrl = (_c = (_b = popupDetailData === null || popupDetailData === void 0 ? void 0 : popupDetailData.video) === null || _b === void 0 ? void 0 : _b.bindCta) === null || _c === void 0 ? void 0 : _c.remark;
|
13
|
+
return (react_1.default.createElement("div", Object.assign({ className: `${(0, css_1.css)(Object.assign({}, style))}` }, props),
|
14
|
+
react_1.default.createElement("iframe", { src: iframeUrl, style: {
|
16
15
|
width: '100%',
|
17
16
|
height: 'calc(100% - 50px)',
|
18
17
|
marginTop: '50px',
|
@@ -10,20 +10,5 @@ exports.default = [
|
|
10
10
|
name: ['style', 'backgroundColor']
|
11
11
|
}
|
12
12
|
]
|
13
|
-
},
|
14
|
-
{
|
15
|
-
title: 'iframe',
|
16
|
-
child: [
|
17
|
-
{
|
18
|
-
type: 'TextArea',
|
19
|
-
label: 'url',
|
20
|
-
name: ['props', 'iframe', 'src']
|
21
|
-
},
|
22
|
-
{
|
23
|
-
type: 'TextArea',
|
24
|
-
label: 'allow',
|
25
|
-
name: ['props', 'iframe', 'allow']
|
26
|
-
}
|
27
|
-
]
|
28
13
|
}
|
29
14
|
];
|