pb-sxp-ui 14.0.2 → 14.0.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 +441 -795
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +0 -89
- package/dist/index.js +441 -795
- 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 +441 -795
- 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/SxpPageRender/ConsentPopup.js +8 -8
- package/es/core/components/SxpPageRender/Navbar.js +1 -1
- package/es/core/components/SxpPageRender/WaterFall/preview.json +272 -207
- package/es/core/components/SxpPageRender/index.js +2 -5
- package/es/core/context/SxpDataSourceProvider.js +46 -43
- package/es/core/utils/materials.js +3 -5
- package/es/materials/sxp/consentPopup/Display/index.d.ts +2 -2
- package/es/materials/sxp/consentPopup/Display/index.js +5 -7
- package/es/materials/sxp/consentPopup/index.d.ts +0 -2
- package/es/materials/sxp/consentPopup/index.js +0 -2
- 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 +1 -2
- package/es/materials/sxp/popup/ConsentDetail/index.js +2 -2
- package/es/materials/sxp/popup/Iframe/index.d.ts +4 -0
- package/es/materials/sxp/popup/Iframe/index.js +5 -4
- package/es/materials/sxp/popup/Iframe/settingRender.js +15 -0
- package/lib/core/components/SxpPageRender/ConsentPopup.js +7 -7
- package/lib/core/components/SxpPageRender/Navbar.js +1 -1
- package/lib/core/components/SxpPageRender/WaterFall/preview.json +272 -207
- package/lib/core/components/SxpPageRender/index.js +2 -5
- package/lib/core/context/SxpDataSourceProvider.js +46 -43
- package/lib/core/utils/materials.js +3 -5
- package/lib/materials/sxp/consentPopup/Display/index.d.ts +2 -2
- package/lib/materials/sxp/consentPopup/Display/index.js +5 -7
- package/lib/materials/sxp/consentPopup/index.d.ts +0 -2
- package/lib/materials/sxp/consentPopup/index.js +0 -2
- 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 +1 -2
- package/lib/materials/sxp/popup/ConsentDetail/index.js +2 -2
- package/lib/materials/sxp/popup/Iframe/index.d.ts +4 -0
- package/lib/materials/sxp/popup/Iframe/index.js +5 -4
- package/lib/materials/sxp/popup/Iframe/settingRender.js +15 -0
- package/package.json +1 -1
- package/es/materials/sxp/consentPopup/Click/index.d.ts +0 -19
- package/es/materials/sxp/consentPopup/Click/index.js +0 -19
- package/es/materials/sxp/consentPopup/Click/material.d.ts +0 -2
- package/es/materials/sxp/consentPopup/Click/material.js +0 -48
- package/es/materials/sxp/consentPopup/Click/settingRender.d.ts +0 -63
- package/es/materials/sxp/consentPopup/Click/settingRender.js +0 -210
- package/es/materials/sxp/consentPopup/Swipe/index.d.ts +0 -12
- package/es/materials/sxp/consentPopup/Swipe/index.js +0 -44
- package/es/materials/sxp/consentPopup/Swipe/material.d.ts +0 -2
- package/es/materials/sxp/consentPopup/Swipe/material.js +0 -24
- package/es/materials/sxp/consentPopup/Swipe/settingRender.d.ts +0 -29
- package/es/materials/sxp/consentPopup/Swipe/settingRender.js +0 -43
- package/lib/materials/sxp/consentPopup/Click/index.d.ts +0 -19
- package/lib/materials/sxp/consentPopup/Click/index.js +0 -21
- package/lib/materials/sxp/consentPopup/Click/material.d.ts +0 -2
- package/lib/materials/sxp/consentPopup/Click/material.js +0 -52
- package/lib/materials/sxp/consentPopup/Click/settingRender.d.ts +0 -63
- package/lib/materials/sxp/consentPopup/Click/settingRender.js +0 -212
- package/lib/materials/sxp/consentPopup/Swipe/index.d.ts +0 -12
- package/lib/materials/sxp/consentPopup/Swipe/index.js +0 -46
- package/lib/materials/sxp/consentPopup/Swipe/material.d.ts +0 -2
- package/lib/materials/sxp/consentPopup/Swipe/material.js +0 -28
- package/lib/materials/sxp/consentPopup/Swipe/settingRender.d.ts +0 -29
- package/lib/materials/sxp/consentPopup/Swipe/settingRender.js +0 -45
@@ -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 ? 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,12 +144,9 @@ 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);
|
148
147
|
handleH5EnterLink();
|
149
148
|
if (repCond) {
|
150
|
-
|
151
|
-
SXP_EVENT_BUS.emit(SXP_EVENT_TYPE.PAGE_DID_SHOW, item);
|
152
|
-
});
|
149
|
+
SXP_EVENT_BUS.emit(SXP_EVENT_TYPE.PAGE_DID_SHOW, item);
|
153
150
|
backMainFeed('external', selectTag);
|
154
151
|
}
|
155
152
|
}
|
@@ -1,13 +1,13 @@
|
|
1
1
|
import { __awaiter } from "tslib";
|
2
2
|
import React, { createContext, memo, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
3
3
|
import qs from 'qs';
|
4
|
+
import { cloneDeep } from 'lodash';
|
4
5
|
import { refreshFeSessionId, storeAndLoadFeSessionId } from '../utils/sessionStore';
|
5
6
|
import { storeAndLoadFeUserId, AGREE_POLICY } from '../utils/localStore';
|
6
7
|
import { useIconLink } from '../components/SxpPageRender/useIconLink';
|
7
8
|
import SXP_EVENT_BUS, { SXP_EVENT_TYPE } from '../utils/event';
|
8
9
|
import Consent from '../components/Consent';
|
9
10
|
import { getCookie } from '../utils/tool';
|
10
|
-
import { cloneDeep } from 'lodash';
|
11
11
|
export const SxpDataSourceContext = createContext({
|
12
12
|
rtcList: [],
|
13
13
|
tagList: []
|
@@ -99,32 +99,53 @@ 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]);
|
106
102
|
const bffFetch = useCallback((path, options) => {
|
107
103
|
if (!bffDataSource)
|
108
104
|
return;
|
109
105
|
const url = bffDataSource.url;
|
106
|
+
const fakeUserId = storeAndLoadFeUserId();
|
110
107
|
if (options === null || options === void 0 ? void 0 : options.query) {
|
111
108
|
const queryString = qs.stringify(options.query);
|
112
109
|
path = `${path}?${queryString}`;
|
113
110
|
}
|
114
111
|
if (options.type === 'beacon' && navigator.sendBeacon) {
|
115
|
-
return navigator.sendBeacon(`${url}/api
|
112
|
+
return navigator.sendBeacon(`${url}/api/v1${path}`, new Blob([
|
116
113
|
JSON.stringify(Object.assign(Object.assign(Object.assign({}, options.body), bffDataSource.headers), { 'x-user-id': fakeUserId }))
|
117
114
|
], { type: 'application/json;charset=UTF-8' }));
|
118
115
|
}
|
119
116
|
return window
|
120
|
-
.fetch(`${url}/api
|
117
|
+
.fetch(`${url}/api/v1${path}`, {
|
121
118
|
headers: Object.assign({ 'Content-Type': 'application/json', 'x-user-id': fakeUserId }, bffDataSource.headers),
|
122
119
|
method: options.method,
|
123
120
|
body: JSON.stringify(options.body)
|
124
121
|
})
|
125
122
|
.then((res) => res.json())
|
126
123
|
.catch((err) => Promise.reject(err));
|
127
|
-
}, [bffDataSource
|
124
|
+
}, [bffDataSource]);
|
125
|
+
function splitUrlParams(urlParams) {
|
126
|
+
if (!urlParams)
|
127
|
+
return;
|
128
|
+
const indList = [];
|
129
|
+
for (let i = 0; i < urlParams.length; i++) {
|
130
|
+
const item = urlParams[i];
|
131
|
+
const curStr = urlParams.substring(i + 1, urlParams.length);
|
132
|
+
if (item === '&' &&
|
133
|
+
(curStr === null || curStr === void 0 ? void 0 : curStr.indexOf('=')) !== -1 &&
|
134
|
+
((curStr === null || curStr === void 0 ? void 0 : curStr.indexOf('=')) < (curStr === null || curStr === void 0 ? void 0 : curStr.indexOf('&')) || (curStr === null || curStr === void 0 ? void 0 : curStr.indexOf('&')) === -1)) {
|
135
|
+
indList.push(i);
|
136
|
+
}
|
137
|
+
}
|
138
|
+
const splitList = indList.length > 0 ? [] : [urlParams];
|
139
|
+
let lastIndex = 0;
|
140
|
+
indList === null || indList === void 0 ? void 0 : indList.map((i) => {
|
141
|
+
splitList === null || splitList === void 0 ? void 0 : splitList.push(urlParams.substring(lastIndex, i));
|
142
|
+
lastIndex = i + 1;
|
143
|
+
if (i === indList[indList.length - 1] && i < urlParams.length) {
|
144
|
+
splitList === null || splitList === void 0 ? void 0 : splitList.push(urlParams.substring(lastIndex, urlParams.length));
|
145
|
+
}
|
146
|
+
});
|
147
|
+
return splitList !== null && splitList !== void 0 ? splitList : [];
|
148
|
+
}
|
128
149
|
const getRecommendVideos = useCallback((query) => __awaiter(void 0, void 0, void 0, function* () {
|
129
150
|
var _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
130
151
|
query = {
|
@@ -141,7 +162,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
141
162
|
query = Object.assign(Object.assign({}, query), { channel: decodeURIComponent(channel) });
|
142
163
|
}
|
143
164
|
else if (utmVal) {
|
144
|
-
const val = (_k = (_j = (_h = utmVal
|
165
|
+
const val = (_k = (_j = (_h = splitUrlParams(utmVal)) === null || _h === void 0 ? void 0 : _h.filter((val) => {
|
145
166
|
var _a, _b;
|
146
167
|
const key = val.split('=')[0];
|
147
168
|
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);
|
@@ -161,7 +182,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
161
182
|
const recurveRecList = (query) => __awaiter(void 0, void 0, void 0, function* () {
|
162
183
|
var _v, _w, _x, _y, _z, _0;
|
163
184
|
query.pageNum = pageNum;
|
164
|
-
result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('
|
185
|
+
result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/recommend/list', { method: 'POST', body: query }));
|
165
186
|
if (!(result === null || result === void 0 ? void 0 : result.success)) {
|
166
187
|
return undefined;
|
167
188
|
}
|
@@ -183,7 +204,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
183
204
|
if (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview) {
|
184
205
|
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
206
|
}
|
186
|
-
const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('
|
207
|
+
const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/recommend/list', { method: 'POST', body: query }));
|
187
208
|
if (!(result === null || result === void 0 ? void 0 : result.success)) {
|
188
209
|
return undefined;
|
189
210
|
}
|
@@ -233,7 +254,6 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
233
254
|
return expire;
|
234
255
|
}, [data]);
|
235
256
|
const bffEventReport = useCallback(({ userInfo, eventInfo, reportLayId = true }) => {
|
236
|
-
var _a;
|
237
257
|
if (!enableReportEvent || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview)) {
|
238
258
|
return;
|
239
259
|
}
|
@@ -250,35 +270,26 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
250
270
|
console.log('userInfo:', userInfo);
|
251
271
|
console.log('eventInfo:', ef);
|
252
272
|
console.log('========= 结束 =========');
|
253
|
-
return bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch(
|
273
|
+
return bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/event/report', {
|
254
274
|
method: 'POST',
|
255
275
|
body: { userInfo: realUserInfo, eventInfo: realEventInfo },
|
256
276
|
type: 'beacon'
|
257
277
|
});
|
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
|
-
]);
|
278
|
+
}, [bffFetch, curReqInfo, enableReportEvent, globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview, layoutVariantId, globalConfig, playbookType]);
|
268
279
|
const bffFbReport = useCallback(({ eventName, product }) => {
|
269
|
-
var _a, _b, _c, _d, _e
|
280
|
+
var _a, _b, _c, _d, _e;
|
270
281
|
if (!enableReportEvent ||
|
271
282
|
!enabledMetaConversionApi ||
|
272
283
|
(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview) ||
|
273
284
|
!((_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.converApi) === null || _a === void 0 ? void 0 : _a[eventName])) {
|
274
285
|
return;
|
275
286
|
}
|
276
|
-
|
287
|
+
const jsonParams = cloneDeep((_b = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.converApi) === null || _b === void 0 ? void 0 : _b[eventName]);
|
277
288
|
const urlParams = new URLSearchParams(window.location.search);
|
278
289
|
const fbclid = urlParams === null || urlParams === void 0 ? void 0 : urlParams.get('fbclid');
|
279
290
|
const fix_par = {
|
280
291
|
event_source_url: (_c = window === null || window === void 0 ? void 0 : window.location) === null || _c === void 0 ? void 0 : _c.href,
|
281
|
-
external_id:
|
292
|
+
external_id: storeAndLoadFeUserId(),
|
282
293
|
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 : '',
|
283
294
|
fbc: fbclid ? `fb.2.${new Date().getTime()}.${fbclid}` : '',
|
284
295
|
fbp: getCookie('_fbp') ? `fb.2.${new Date().getTime()}.${getCookie('_fbp')}` : '',
|
@@ -330,30 +341,22 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
330
341
|
}
|
331
342
|
};
|
332
343
|
getEventParams(jsonParams);
|
333
|
-
return bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch(
|
344
|
+
return bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/fb/events', {
|
334
345
|
method: 'POST',
|
335
346
|
body: jsonParams,
|
336
347
|
type: 'beacon'
|
337
348
|
});
|
338
|
-
}, [
|
339
|
-
bffFetch,
|
340
|
-
enableReportEvent,
|
341
|
-
enabledMetaConversionApi,
|
342
|
-
globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview,
|
343
|
-
globalConfig,
|
344
|
-
fakeUserId,
|
345
|
-
bffDataSource
|
346
|
-
]);
|
349
|
+
}, [bffFetch, enableReportEvent, enabledMetaConversionApi, globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview, globalConfig]);
|
347
350
|
const bffMutateLike = useCallback((body) => __awaiter(void 0, void 0, void 0, function* () {
|
348
|
-
const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('
|
351
|
+
const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/recommend/like', { method: 'POST', body }));
|
349
352
|
return res === null || res === void 0 ? void 0 : res.success;
|
350
353
|
}), [bffFetch]);
|
351
354
|
const bffMutateUnlike = useCallback((body) => __awaiter(void 0, void 0, void 0, function* () {
|
352
|
-
const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('
|
355
|
+
const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/recommend/unlike', { method: 'POST', body }));
|
353
356
|
return res === null || res === void 0 ? void 0 : res.success;
|
354
357
|
}), [bffFetch]);
|
355
358
|
const bffSubmitForm = useCallback((body) => __awaiter(void 0, void 0, void 0, function* () {
|
356
|
-
const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('
|
359
|
+
const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/customform', { method: 'POST', body }));
|
357
360
|
return res === null || res === void 0 ? void 0 : res.success;
|
358
361
|
}), [bffFetch]);
|
359
362
|
const bffGetTagList = useCallback((data) => __awaiter(void 0, void 0, void 0, function* () {
|
@@ -362,12 +365,12 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
362
365
|
if (!utmVal || !isShowTag)
|
363
366
|
return;
|
364
367
|
try {
|
365
|
-
const val = (_10 = (_9 = (_8 = utmVal
|
368
|
+
const val = (_10 = (_9 = (_8 = splitUrlParams(utmVal)) === null || _8 === void 0 ? void 0 : _8.filter((val) => {
|
366
369
|
var _a, _b;
|
367
370
|
const key = val.split('=')[0];
|
368
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);
|
369
372
|
})) === null || _9 === void 0 ? void 0 : _9.join('&')) !== null && _10 !== void 0 ? _10 : '';
|
370
|
-
const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('
|
373
|
+
const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/tag/list', { method: 'GET', query: { channel: decodeURIComponent(val) } }));
|
371
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 : []);
|
372
375
|
}
|
373
376
|
catch (e) {
|
@@ -441,10 +444,10 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
441
444
|
let curData;
|
442
445
|
let gldata;
|
443
446
|
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);
|
446
447
|
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];
|
447
448
|
if (id) {
|
449
|
+
layId = id;
|
450
|
+
setLayoutVariantId(id);
|
448
451
|
curData = dataList === null || dataList === void 0 ? void 0 : dataList.find((item) => (item === null || item === void 0 ? void 0 : item.id) === id);
|
449
452
|
if (curData) {
|
450
453
|
setPageData(curData);
|
@@ -32,16 +32,14 @@ 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 = '';
|
36
35
|
if ((!(product === null || product === void 0 ? void 0 : product.currency) || !(product === null || product === void 0 ? void 0 : product.price)) && isHiddenDef)
|
37
36
|
return null;
|
38
|
-
let price =
|
39
|
-
|
40
|
-
return text;
|
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
|
+
let text = '';
|
41
39
|
let priceSymbol = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.priceSymbol;
|
42
40
|
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 : '' : '$';
|
43
41
|
const isToLocStr = enableFormattedPrice === undefined || enableFormattedPrice;
|
44
|
-
let decPic = price
|
42
|
+
let decPic = price.toString();
|
45
43
|
if (priceSymbol === null || priceSymbol === void 0 ? void 0 : priceSymbol.showTwoDecimalPoint) {
|
46
44
|
decPic = price === null || price === void 0 ? void 0 : price.toFixed(2);
|
47
45
|
}
|
@@ -13,9 +13,9 @@ export interface IDisplayProps {
|
|
13
13
|
};
|
14
14
|
style?: Record<string, any>;
|
15
15
|
isTel?: boolean;
|
16
|
-
isShowClose?: boolean;
|
17
|
-
consentPopupCate?: string;
|
18
16
|
onClick?: () => void;
|
17
|
+
contsentState?: boolean;
|
18
|
+
isShowClose?: boolean;
|
19
19
|
}
|
20
20
|
declare const _default: React.NamedExoticComponent<IDisplayProps>;
|
21
21
|
export default _default;
|
@@ -1,20 +1,18 @@
|
|
1
1
|
import { __rest } from "tslib";
|
2
2
|
import React, { memo, useCallback, useMemo, useState } from 'react';
|
3
3
|
import './index.less';
|
4
|
+
import { useEditorDataProvider } from '../../../../core/context/EditorDataProvider';
|
4
5
|
import closeSvg from './close.svg';
|
5
6
|
import tel from './tel.png';
|
6
7
|
import { setFontForText } from '../../../../core/utils/tool';
|
7
|
-
import { getContsentState } from '../../../../core/utils/localStore';
|
8
8
|
const Display = (_a) => {
|
9
9
|
var _b, _c;
|
10
|
-
var { isTel, isShowOnce, open, content, interaction, style, onClick,
|
10
|
+
var { isTel, isShowOnce, open, content, interaction, style, onClick, contsentState, isShowClose } = _a, props = __rest(_a, ["isTel", "isShowOnce", "open", "content", "interaction", "style", "onClick", "contsentState", "isShowClose"]);
|
11
|
+
const { consentPopupCate } = useEditorDataProvider();
|
11
12
|
const [isClose, setIsClose] = useState(false);
|
12
|
-
const contsentState = useMemo(() => {
|
13
|
-
return getContsentState();
|
14
|
-
}, []);
|
15
13
|
const visivle = useMemo(() => {
|
16
|
-
return consentPopupCate || (open && (isShowOnce || contsentState) && style && !isClose);
|
17
|
-
}, [consentPopupCate, open, isClose
|
14
|
+
return consentPopupCate === 'Display' || (open && (isShowOnce || contsentState) && style && !isClose);
|
15
|
+
}, [consentPopupCate, open, isClose]);
|
18
16
|
const handleClickClose = useCallback(() => {
|
19
17
|
setIsClose(true);
|
20
18
|
}, []);
|
@@ -35,7 +35,7 @@ const AniLink = (_a) => {
|
|
35
35
|
onClick === null || onClick === void 0 ? void 0 : onClick();
|
36
36
|
}
|
37
37
|
};
|
38
|
-
const title = (cta === null || cta === void 0 ? void 0 : cta.enTitle) || '
|
38
|
+
const title = (cta === null || cta === void 0 ? void 0 : cta.enTitle) || '查看详情';
|
39
39
|
const aniTimStyle = useMemo(() => {
|
40
40
|
var _a, _b;
|
41
41
|
const ani = event === null || event === void 0 ? void 0 : event.animation;
|
@@ -35,7 +35,7 @@ const AniLinkPopup = (_a) => {
|
|
35
35
|
onClick === null || onClick === void 0 ? void 0 : onClick();
|
36
36
|
}
|
37
37
|
};
|
38
|
-
const title = (cta === null || cta === void 0 ? void 0 : cta.enTitle) || '
|
38
|
+
const title = (cta === null || cta === void 0 ? void 0 : cta.enTitle) || '查看详情';
|
39
39
|
const aniTimStyle = useMemo(() => {
|
40
40
|
const ani = event === null || event === void 0 ? void 0 : event.animation;
|
41
41
|
if (ani) {
|
@@ -1,9 +1,8 @@
|
|
1
|
-
import React
|
1
|
+
import React from 'react';
|
2
2
|
import './index.less';
|
3
3
|
export interface IConsentDetailProps {
|
4
4
|
content?: string;
|
5
5
|
isTel?: boolean;
|
6
|
-
style?: CSSProperties;
|
7
6
|
}
|
8
7
|
declare const _default: React.NamedExoticComponent<IConsentDetailProps>;
|
9
8
|
export default _default;
|
@@ -2,11 +2,11 @@ import { __rest } from "tslib";
|
|
2
2
|
import React, { memo } from 'react';
|
3
3
|
import './index.less';
|
4
4
|
const ConsentDetail = (_a) => {
|
5
|
-
var { content, isTel
|
5
|
+
var { content, isTel } = _a, props = __rest(_a, ["content", "isTel"]);
|
6
6
|
return (React.createElement("article", { className: 'consentDetail-article', dangerouslySetInnerHTML: {
|
7
7
|
__html: typeof content === 'string' ? content : ''
|
8
8
|
}, onClick: (e) => {
|
9
9
|
e.stopPropagation();
|
10
|
-
}
|
10
|
+
} }));
|
11
11
|
};
|
12
12
|
export default memo(ConsentDetail);
|
@@ -12,6 +12,10 @@ export interface IIframeProps {
|
|
12
12
|
submitButtonStyle?: CSSProperties;
|
13
13
|
contentStyle?: CSSProperties;
|
14
14
|
isTel?: boolean;
|
15
|
+
iframe?: {
|
16
|
+
src?: string;
|
17
|
+
allow?: string;
|
18
|
+
};
|
15
19
|
}
|
16
20
|
declare const _default: React.NamedExoticComponent<IIframeProps>;
|
17
21
|
export default _default;
|
@@ -5,11 +5,12 @@ 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 } = _a, props = __rest(_a, ["content", "btnText", "style", "icon", "isPopup", "isExternalLink", "onClose", "onClick", "submitButtonStyle", "contentStyle", "isTel"]);
|
8
|
+
var { content, btnText, style, icon, isPopup, isExternalLink, onClose, onClick, submitButtonStyle, contentStyle, isTel, iframe } = _a, props = __rest(_a, ["content", "btnText", "style", "icon", "isPopup", "isExternalLink", "onClose", "onClick", "submitButtonStyle", "contentStyle", "isTel", "iframe"]);
|
9
9
|
const { popupDetailData } = useSxpDataSource();
|
10
|
-
const
|
11
|
-
|
12
|
-
|
10
|
+
const { src, allow } = iframe || {};
|
11
|
+
const iframeUrl = src || ((_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);
|
12
|
+
return (React.createElement("div", Object.assign({ className: `${css(Object.assign(Object.assign({}, style), { overflow: 'hidden' }))}` }, props),
|
13
|
+
React.createElement("iframe", { src: iframeUrl, allow: allow, scrolling: 'no', style: {
|
13
14
|
width: '100%',
|
14
15
|
height: 'calc(100% - 50px)',
|
15
16
|
marginTop: '50px',
|
@@ -8,5 +8,20 @@ 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
|
+
]
|
11
26
|
}
|
12
27
|
];
|
@@ -4,15 +4,15 @@ const tslib_1 = require("tslib");
|
|
4
4
|
const react_1 = tslib_1.__importStar(require("react"));
|
5
5
|
require("./index.less");
|
6
6
|
const withBindDataSource_1 = tslib_1.__importDefault(require("../../../core/hoc/withBindDataSource"));
|
7
|
-
const
|
7
|
+
const localStore_1 = require("../../../core/utils/localStore");
|
8
8
|
const Consent = ({ resolver, globalConfig }) => {
|
9
9
|
var _a, _b;
|
10
|
-
const
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
const t = resolver === null || resolver === void 0 ? void 0 : resolver[value === null || value === void 0 ? void 0 : value.type];
|
10
|
+
const contsentState = (0, react_1.useMemo)(() => {
|
11
|
+
return (0, localStore_1.getContsentState)();
|
12
|
+
}, []);
|
13
|
+
const t = resolver === null || resolver === void 0 ? void 0 : resolver['Display'];
|
15
14
|
const Component = (0, withBindDataSource_1.default)(t);
|
16
|
-
|
15
|
+
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;
|
16
|
+
return react_1.default.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) || {}, contsentState: contsentState }));
|
17
17
|
};
|
18
18
|
exports.default = (0, react_1.memo)(Consent);
|
@@ -11,7 +11,7 @@ const Navbar = ({ icon, styles, textStyle, onClose }) => {
|
|
11
11
|
react_1.default.createElement("button", { className: 'clc-sxp-nav-left', role: 'button', "aria-label": 'back button', onClick: onClose },
|
12
12
|
react_1.default.createElement("img", { src: icon, alt: 'back button' })),
|
13
13
|
react_1.default.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: {
|
14
|
-
__html: (0, tool_1.setFontForText)(`#${(_a = waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.hashTag) !== null && _a !== void 0 ? _a : '
|
14
|
+
__html: (0, tool_1.setFontForText)(`#${(_a = waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.hashTag) !== null && _a !== void 0 ? _a : '标题'}`, textStyle)
|
15
15
|
} })));
|
16
16
|
};
|
17
17
|
exports.default = (0, react_1.memo)(Navbar);
|