pb-sxp-ui 14.0.4 → 14.0.6
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 +56 -54
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +56 -54
- package/dist/index.js.map +1 -1
- package/dist/index.min.cjs +4 -4
- package/dist/index.min.cjs.map +1 -1
- package/dist/index.min.js +4 -4
- package/dist/index.min.js.map +1 -1
- package/dist/pb-ui.js +56 -54
- package/dist/pb-ui.js.map +1 -1
- package/dist/pb-ui.min.js +4 -4
- package/dist/pb-ui.min.js.map +1 -1
- package/es/core/components/Consent/index.js +8 -2
- package/es/core/context/SxpDataSourceProvider.js +9 -28
- package/es/core/utils/tool.d.ts +2 -1
- package/es/core/utils/tool.js +38 -14
- 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/components/Consent/index.js +8 -2
- package/lib/core/context/SxpDataSourceProvider.js +10 -29
- package/lib/core/utils/tool.d.ts +2 -1
- package/lib/core/utils/tool.js +39 -14
- 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
package/dist/index.cjs
CHANGED
@@ -157,6 +157,13 @@ const getSxpTokenInfo = (builder, dataId) => __awaiter(void 0, void 0, void 0, f
|
|
157
157
|
return tokenData;
|
158
158
|
});
|
159
159
|
|
160
|
+
/*
|
161
|
+
* @Author : haocanweng@chatlabs.cn
|
162
|
+
* @Date : 2023-08-21 16:58:40
|
163
|
+
* @LastEditors: binruan@chatlabs.com
|
164
|
+
* @LastEditTime: 2024-11-20 18:26:50
|
165
|
+
* @FilePath: \pb-sxp-ui\src\core\utils\tool.ts
|
166
|
+
*/
|
160
167
|
// 生成uuid
|
161
168
|
function uuid(len, radix) {
|
162
169
|
const chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split('');
|
@@ -211,8 +218,8 @@ const setFontForText = (textContent, style) => {
|
|
211
218
|
const cnStyle = `font-family:${cn !== null && cn !== void 0 ? cn : 'inherit'}`;
|
212
219
|
const enStyle = `font-family:${en !== null && en !== void 0 ? en : 'inherit'}`;
|
213
220
|
const fn = (str) => {
|
214
|
-
|
215
|
-
|
221
|
+
const chineseStartIndex = str.search(chineseRegex);
|
222
|
+
const englishStartIndex = str.search(englishRegex);
|
216
223
|
if (chineseStartIndex !== -1 && englishStartIndex !== -1 && chineseStartIndex < englishStartIndex) {
|
217
224
|
content += `<span style="${cnStyle}">${str.substring(chineseStartIndex, englishStartIndex)}</span>`;
|
218
225
|
text = str.substring(englishStartIndex, str === null || str === void 0 ? void 0 : str.length);
|
@@ -257,7 +264,7 @@ function getCookie(val) {
|
|
257
264
|
return value !== null && value !== void 0 ? value : '';
|
258
265
|
}
|
259
266
|
function getScreenReader() {
|
260
|
-
|
267
|
+
const userAgent = self.navigator.userAgent;
|
261
268
|
if (!userAgent)
|
262
269
|
return false;
|
263
270
|
return (/TalkBack/i.test(userAgent) ||
|
@@ -267,6 +274,30 @@ function getScreenReader() {
|
|
267
274
|
/JAWS/i.test(userAgent) ||
|
268
275
|
/ChromeVox/i.test(userAgent));
|
269
276
|
}
|
277
|
+
function splitUrlParams(urlParams) {
|
278
|
+
if (!urlParams)
|
279
|
+
return;
|
280
|
+
const indList = [];
|
281
|
+
for (let i = 0; i < urlParams.length; i++) {
|
282
|
+
const item = urlParams[i];
|
283
|
+
const curStr = urlParams.substring(i + 1, urlParams.length);
|
284
|
+
if (item === '&' &&
|
285
|
+
(curStr === null || curStr === void 0 ? void 0 : curStr.indexOf('=')) !== -1 &&
|
286
|
+
((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)) {
|
287
|
+
indList.push(i);
|
288
|
+
}
|
289
|
+
}
|
290
|
+
const splitList = indList.length > 0 ? [] : [urlParams];
|
291
|
+
let lastIndex = 0;
|
292
|
+
indList === null || indList === void 0 ? void 0 : indList.map((i) => {
|
293
|
+
splitList === null || splitList === void 0 ? void 0 : splitList.push(urlParams.substring(lastIndex, i));
|
294
|
+
lastIndex = i + 1;
|
295
|
+
if (i === indList[indList.length - 1] && i < urlParams.length) {
|
296
|
+
splitList === null || splitList === void 0 ? void 0 : splitList.push(urlParams.substring(lastIndex, urlParams.length));
|
297
|
+
}
|
298
|
+
});
|
299
|
+
return splitList !== null && splitList !== void 0 ? splitList : [];
|
300
|
+
}
|
270
301
|
|
271
302
|
function unzip(b64Data) {
|
272
303
|
const strData = atob(b64Data);
|
@@ -520,15 +551,21 @@ var SXP_EVENT_TYPE;
|
|
520
551
|
* @Author: binruan@chatlabs.com
|
521
552
|
* @Date: 2024-06-13 15:16:53
|
522
553
|
* @LastEditors: binruan@chatlabs.com
|
523
|
-
* @LastEditTime:
|
554
|
+
* @LastEditTime: 2025-01-24 14:56:51
|
524
555
|
* @FilePath: \pb-sxp-ui\src\core\components\Consent\index.tsx
|
525
556
|
*
|
526
557
|
*/
|
527
558
|
const Consent$3 = ({ width = window.innerWidth, height = window.innerHeight, privacy_title, privacy_context, privacy_policy_url, privacy_policy_title }) => {
|
528
559
|
const { setIsAgreePolicy, bffEventReport } = useSxpDataSource();
|
529
560
|
const channelObj = React.useMemo(() => {
|
561
|
+
var _a;
|
530
562
|
const queryString = location.search.slice(1);
|
531
|
-
const params =
|
563
|
+
const params = {};
|
564
|
+
(_a = splitUrlParams(queryString.replace(/\+/g, '%2B'))) === null || _a === void 0 ? void 0 : _a.map((val) => {
|
565
|
+
const key = val.split('=')[0];
|
566
|
+
const value = val.split('=')[1];
|
567
|
+
params[key] = value;
|
568
|
+
});
|
532
569
|
for (const key in params) {
|
533
570
|
params[key] = params[key].replace(/%2B/g, '+');
|
534
571
|
}
|
@@ -703,30 +740,6 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
703
740
|
.then((res) => res.json())
|
704
741
|
.catch((err) => Promise.reject(err));
|
705
742
|
}, [bffDataSource]);
|
706
|
-
function splitUrlParams(urlParams) {
|
707
|
-
if (!urlParams)
|
708
|
-
return;
|
709
|
-
const indList = [];
|
710
|
-
for (let i = 0; i < urlParams.length; i++) {
|
711
|
-
const item = urlParams[i];
|
712
|
-
const curStr = urlParams.substring(i + 1, urlParams.length);
|
713
|
-
if (item === '&' &&
|
714
|
-
(curStr === null || curStr === void 0 ? void 0 : curStr.indexOf('=')) !== -1 &&
|
715
|
-
((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)) {
|
716
|
-
indList.push(i);
|
717
|
-
}
|
718
|
-
}
|
719
|
-
const splitList = indList.length > 0 ? [] : [urlParams];
|
720
|
-
let lastIndex = 0;
|
721
|
-
indList === null || indList === void 0 ? void 0 : indList.map((i) => {
|
722
|
-
splitList === null || splitList === void 0 ? void 0 : splitList.push(urlParams.substring(lastIndex, i));
|
723
|
-
lastIndex = i + 1;
|
724
|
-
if (i === indList[indList.length - 1] && i < urlParams.length) {
|
725
|
-
splitList === null || splitList === void 0 ? void 0 : splitList.push(urlParams.substring(lastIndex, urlParams.length));
|
726
|
-
}
|
727
|
-
});
|
728
|
-
return splitList !== null && splitList !== void 0 ? splitList : [];
|
729
|
-
}
|
730
743
|
// 获取推荐视频数据
|
731
744
|
const getRecommendVideos = React.useCallback((query) => __awaiter(void 0, void 0, void 0, function* () {
|
732
745
|
var _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
@@ -988,9 +1001,14 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
988
1001
|
});
|
989
1002
|
}, [bffEventReport, isFromHashtag]);
|
990
1003
|
const h5EnterLink = React.useCallback(() => {
|
991
|
-
var _a, _b;
|
1004
|
+
var _a, _b, _c;
|
992
1005
|
const queryString = location.search.slice(1);
|
993
|
-
const params =
|
1006
|
+
const params = {};
|
1007
|
+
(_a = splitUrlParams(queryString.replace(/\+/g, '%2B'))) === null || _a === void 0 ? void 0 : _a.map((val) => {
|
1008
|
+
const key = val.split('=')[0];
|
1009
|
+
const value = val.split('=')[1];
|
1010
|
+
params[key] = value;
|
1011
|
+
});
|
994
1012
|
for (const key in params) {
|
995
1013
|
params[key] = params[key].replace(/%2B/g, '+');
|
996
1014
|
}
|
@@ -1008,7 +1026,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
1008
1026
|
utmContent: getVal('utm_content'),
|
1009
1027
|
enterTime: Math.floor(time / 1000) + '',
|
1010
1028
|
requestId: null,
|
1011
|
-
enterUrl: (
|
1029
|
+
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 : '',
|
1012
1030
|
clSource: getVal('cl_source')
|
1013
1031
|
},
|
1014
1032
|
reportLayId: false
|
@@ -11985,7 +12003,7 @@ const CommodityList = createMaterial(CommodityListComponent, {
|
|
11985
12003
|
* @Author: binruan@chatlabs.com
|
11986
12004
|
* @Date: 2023-10-27 14:06:35
|
11987
12005
|
* @LastEditors: binruan@chatlabs.com
|
11988
|
-
* @LastEditTime: 2024-
|
12006
|
+
* @LastEditTime: 2024-08-08 17:32:11
|
11989
12007
|
* @FilePath: \pb-sxp-ui\src\materials\sxp\popup\Iframe\settingRender.tsx
|
11990
12008
|
*
|
11991
12009
|
*/
|
@@ -11999,32 +12017,16 @@ var settingRender$8 = [
|
|
11999
12017
|
name: ['style', 'backgroundColor']
|
12000
12018
|
}
|
12001
12019
|
]
|
12002
|
-
},
|
12003
|
-
{
|
12004
|
-
title: 'iframe',
|
12005
|
-
child: [
|
12006
|
-
{
|
12007
|
-
type: 'TextArea',
|
12008
|
-
label: 'url',
|
12009
|
-
name: ['props', 'iframe', 'src']
|
12010
|
-
},
|
12011
|
-
{
|
12012
|
-
type: 'TextArea',
|
12013
|
-
label: 'allow',
|
12014
|
-
name: ['props', 'iframe', 'allow']
|
12015
|
-
}
|
12016
|
-
]
|
12017
12020
|
}
|
12018
12021
|
];
|
12019
12022
|
|
12020
12023
|
const Iframe$1 = (_a) => {
|
12021
12024
|
var _b, _c;
|
12022
|
-
var { content, btnText, style, icon, isPopup, isExternalLink, onClose, onClick, submitButtonStyle, contentStyle, isTel
|
12025
|
+
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"]);
|
12023
12026
|
const { popupDetailData } = useSxpDataSource();
|
12024
|
-
const
|
12025
|
-
|
12026
|
-
|
12027
|
-
React.createElement("iframe", { src: iframeUrl, allow: allow, scrolling: 'no', style: {
|
12027
|
+
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;
|
12028
|
+
return (React.createElement("div", Object.assign({ className: `${css.css(Object.assign({}, style))}` }, props),
|
12029
|
+
React.createElement("iframe", { src: iframeUrl, style: {
|
12028
12030
|
width: '100%',
|
12029
12031
|
height: 'calc(100% - 50px)',
|
12030
12032
|
marginTop: '50px',
|
@@ -18929,7 +18931,7 @@ var index$1 = React.memo(DiyPortalPreview);
|
|
18929
18931
|
* @Author: binruan@chatlabs.com
|
18930
18932
|
* @Date: 2023-10-31 10:56:01
|
18931
18933
|
* @LastEditors: binruan@chatlabs.com
|
18932
|
-
* @LastEditTime: 2024-
|
18934
|
+
* @LastEditTime: 2024-10-23 15:07:29
|
18933
18935
|
* @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\Popup\index.tsx
|
18934
18936
|
*
|
18935
18937
|
*/
|