pb-sxp-ui 1.0.41 → 1.0.42
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/LICENSE +21 -21
- package/README.md +111 -111
- package/dist/index.cjs +111 -27
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +48 -3
- package/dist/index.js +111 -27
- package/dist/index.js.map +1 -1
- package/dist/index.min.cjs +3 -3
- package/dist/index.min.cjs.map +1 -1
- package/dist/index.min.js +3 -3
- package/dist/index.min.js.map +1 -1
- package/dist/pb-ui.js +111 -27
- package/dist/pb-ui.js.map +1 -1
- package/dist/pb-ui.min.js +3 -3
- package/dist/pb-ui.min.js.map +1 -1
- package/es/core/components/DiyPortalPreview/index.js +21 -6
- package/es/core/components/SxpPageCore/index.js +2 -2
- package/es/core/components/SxpPageRender/Nudge/index.js +6 -5
- package/es/core/components/SxpPageRender/Tagbar.d.ts +7 -0
- package/es/core/components/SxpPageRender/Tagbar.js +37 -0
- package/es/core/components/SxpPageRender/index.d.ts +2 -0
- package/es/core/components/SxpPageRender/index.js +14 -5
- package/es/core/context/SxpDataSourceProvider.d.ts +3 -0
- package/es/core/context/SxpDataSourceProvider.js +28 -4
- package/es/materials/sxp/popup/CommodityDetail/index.js +4 -4
- package/es/materials/sxp/popup/CommodityDetailDiroNew/index.js +1 -1
- package/lib/core/components/DiyPortalPreview/index.js +21 -6
- package/lib/core/components/SxpPageCore/index.js +2 -2
- package/lib/core/components/SxpPageRender/Nudge/index.js +6 -5
- package/lib/core/components/SxpPageRender/Tagbar.d.ts +7 -0
- package/lib/core/components/SxpPageRender/Tagbar.js +40 -0
- package/lib/core/components/SxpPageRender/index.d.ts +2 -0
- package/lib/core/components/SxpPageRender/index.js +14 -5
- package/lib/core/context/SxpDataSourceProvider.d.ts +3 -0
- package/lib/core/context/SxpDataSourceProvider.js +28 -4
- package/lib/materials/sxp/popup/CommodityDetail/index.js +4 -4
- package/lib/materials/sxp/popup/CommodityDetailDiroNew/index.js +1 -1
- package/package.json +115 -115
package/LICENSE
CHANGED
@@ -1,21 +1,21 @@
|
|
1
|
-
MIT License
|
2
|
-
|
3
|
-
Copyright (c) 2023 ChatLabs
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
7
|
-
in the Software without restriction, including without limitation the rights
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
10
|
-
furnished to do so, subject to the following conditions:
|
11
|
-
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
13
|
-
copies or substantial portions of the Software.
|
14
|
-
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
-
SOFTWARE.
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2023 ChatLabs
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
@@ -1,111 +1,111 @@
|
|
1
|
-
<!--
|
2
|
-
* @Author : haocanweng@chatlabs.cn
|
3
|
-
* @Date : 2023-08-23 18:25:31
|
4
|
-
* @LastEditors: binruan@chatlabs.com
|
5
|
-
* @LastEditTime: 2024-03-20 16:26:29
|
6
|
-
* @FilePath: \pb-sxp-ui\README.md
|
7
|
-
-->
|
8
|
-
<h1 align="center">Page Builder SXP UI</h1>
|
9
|
-
|
10
|
-
<div align="center">
|
11
|
-
React enterprise-class UI components
|
12
|
-
</div>
|
13
|
-
|
14
|
-
## 📦 安装
|
15
|
-
|
16
|
-
```bash
|
17
|
-
npm install pb-sxp-ui
|
18
|
-
# or
|
19
|
-
yarn add pb-sxp-ui
|
20
|
-
```
|
21
|
-
|
22
|
-
## 🔨 使用
|
23
|
-
以 Next.js 框架为例子:
|
24
|
-
|
25
|
-
```jsx
|
26
|
-
import { GetServerSideProps } from 'next';
|
27
|
-
import React, { FC } from 'react'
|
28
|
-
import Pagebuilder, { PageView } from 'pb-sxp-ui';
|
29
|
-
|
30
|
-
// 初始化 PageBuilder 配置
|
31
|
-
Pagebuilder.init({
|
32
|
-
tenantId: 'xxxxxxxxxx',
|
33
|
-
appId: 'xxxxxxxxx',
|
34
|
-
env: 'live' // 可选参数,默认是 live 环境
|
35
|
-
});
|
36
|
-
|
37
|
-
|
38
|
-
interface IProps {
|
39
|
-
path: string;
|
40
|
-
data: any
|
41
|
-
}
|
42
|
-
|
43
|
-
const ContentPage: FC<IProps> = ({ data ,path}) => {
|
44
|
-
return (
|
45
|
-
<PageView data={data?.data} isSsr path={path}/>
|
46
|
-
)
|
47
|
-
}
|
48
|
-
|
49
|
-
export const getServerSideProps: GetServerSideProps<IProps> = async (
|
50
|
-
context
|
51
|
-
) => {
|
52
|
-
// 接收传来的路径
|
53
|
-
const path = context.query.path as string;
|
54
|
-
// 获取页面数据
|
55
|
-
const result = await Pagebuilder.getDetail(path)
|
56
|
-
return {
|
57
|
-
props: {
|
58
|
-
path,
|
59
|
-
data: result.data
|
60
|
-
},
|
61
|
-
};
|
62
|
-
};
|
63
|
-
|
64
|
-
export default ContentPage;
|
65
|
-
|
66
|
-
```
|
67
|
-
|
68
|
-
## ⌨️ 本地调试
|
69
|
-
|
70
|
-
### 运行开发环境
|
71
|
-
|
72
|
-
```bash
|
73
|
-
$ npm install
|
74
|
-
$ npm run start
|
75
|
-
```
|
76
|
-
|
77
|
-
### 生成本地开发全局链接
|
78
|
-
|
79
|
-
```bash
|
80
|
-
npm link
|
81
|
-
# or
|
82
|
-
yarn link
|
83
|
-
```
|
84
|
-
|
85
|
-
### 在使用该包的项目中安装调试
|
86
|
-
|
87
|
-
```bash
|
88
|
-
npm link pb-sxp-ui
|
89
|
-
# or
|
90
|
-
yarn link pb-sxp-ui
|
91
|
-
```
|
92
|
-
|
93
|
-
## 👾 发布
|
94
|
-
|
95
|
-
### 打包线上安装包
|
96
|
-
|
97
|
-
```bash
|
98
|
-
npm run package
|
99
|
-
# or
|
100
|
-
yarn package
|
101
|
-
```
|
102
|
-
|
103
|
-
### 发布 npm
|
104
|
-
|
105
|
-
```bash
|
106
|
-
$ npm version patch|minor|major
|
107
|
-
$ npm publish
|
108
|
-
|
109
|
-
# 自动化发布包
|
110
|
-
$ npm run pub patch|minor|major|xx.xx.xx
|
111
|
-
```
|
1
|
+
<!--
|
2
|
+
* @Author : haocanweng@chatlabs.cn
|
3
|
+
* @Date : 2023-08-23 18:25:31
|
4
|
+
* @LastEditors: binruan@chatlabs.com
|
5
|
+
* @LastEditTime: 2024-03-20 16:26:29
|
6
|
+
* @FilePath: \pb-sxp-ui\README.md
|
7
|
+
-->
|
8
|
+
<h1 align="center">Page Builder SXP UI</h1>
|
9
|
+
|
10
|
+
<div align="center">
|
11
|
+
React enterprise-class UI components
|
12
|
+
</div>
|
13
|
+
|
14
|
+
## 📦 安装
|
15
|
+
|
16
|
+
```bash
|
17
|
+
npm install pb-sxp-ui
|
18
|
+
# or
|
19
|
+
yarn add pb-sxp-ui
|
20
|
+
```
|
21
|
+
|
22
|
+
## 🔨 使用
|
23
|
+
以 Next.js 框架为例子:
|
24
|
+
|
25
|
+
```jsx
|
26
|
+
import { GetServerSideProps } from 'next';
|
27
|
+
import React, { FC } from 'react'
|
28
|
+
import Pagebuilder, { PageView } from 'pb-sxp-ui';
|
29
|
+
|
30
|
+
// 初始化 PageBuilder 配置
|
31
|
+
Pagebuilder.init({
|
32
|
+
tenantId: 'xxxxxxxxxx',
|
33
|
+
appId: 'xxxxxxxxx',
|
34
|
+
env: 'live' // 可选参数,默认是 live 环境
|
35
|
+
});
|
36
|
+
|
37
|
+
|
38
|
+
interface IProps {
|
39
|
+
path: string;
|
40
|
+
data: any
|
41
|
+
}
|
42
|
+
|
43
|
+
const ContentPage: FC<IProps> = ({ data ,path}) => {
|
44
|
+
return (
|
45
|
+
<PageView data={data?.data} isSsr path={path}/>
|
46
|
+
)
|
47
|
+
}
|
48
|
+
|
49
|
+
export const getServerSideProps: GetServerSideProps<IProps> = async (
|
50
|
+
context
|
51
|
+
) => {
|
52
|
+
// 接收传来的路径
|
53
|
+
const path = context.query.path as string;
|
54
|
+
// 获取页面数据
|
55
|
+
const result = await Pagebuilder.getDetail(path)
|
56
|
+
return {
|
57
|
+
props: {
|
58
|
+
path,
|
59
|
+
data: result.data
|
60
|
+
},
|
61
|
+
};
|
62
|
+
};
|
63
|
+
|
64
|
+
export default ContentPage;
|
65
|
+
|
66
|
+
```
|
67
|
+
|
68
|
+
## ⌨️ 本地调试
|
69
|
+
|
70
|
+
### 运行开发环境
|
71
|
+
|
72
|
+
```bash
|
73
|
+
$ npm install
|
74
|
+
$ npm run start
|
75
|
+
```
|
76
|
+
|
77
|
+
### 生成本地开发全局链接
|
78
|
+
|
79
|
+
```bash
|
80
|
+
npm link
|
81
|
+
# or
|
82
|
+
yarn link
|
83
|
+
```
|
84
|
+
|
85
|
+
### 在使用该包的项目中安装调试
|
86
|
+
|
87
|
+
```bash
|
88
|
+
npm link pb-sxp-ui
|
89
|
+
# or
|
90
|
+
yarn link pb-sxp-ui
|
91
|
+
```
|
92
|
+
|
93
|
+
## 👾 发布
|
94
|
+
|
95
|
+
### 打包线上安装包
|
96
|
+
|
97
|
+
```bash
|
98
|
+
npm run package
|
99
|
+
# or
|
100
|
+
yarn package
|
101
|
+
```
|
102
|
+
|
103
|
+
### 发布 npm
|
104
|
+
|
105
|
+
```bash
|
106
|
+
$ npm version patch|minor|major
|
107
|
+
$ npm publish
|
108
|
+
|
109
|
+
# 自动化发布包
|
110
|
+
$ npm run pub patch|minor|major|xx.xx.xx
|
111
|
+
```
|
package/dist/index.cjs
CHANGED
@@ -431,7 +431,8 @@ function useIconLink(path, domain) {
|
|
431
431
|
}
|
432
432
|
|
433
433
|
const SxpDataSourceContext = React.createContext({
|
434
|
-
rtcList: []
|
434
|
+
rtcList: [],
|
435
|
+
tagList: []
|
435
436
|
});
|
436
437
|
var DataSourceType;
|
437
438
|
(function (DataSourceType) {
|
@@ -440,6 +441,7 @@ var DataSourceType;
|
|
440
441
|
const UTM_KEYS = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_id', 'utm_content', 'cl_source'];
|
441
442
|
const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent = true, maxSize, defaultSize, isPreview = false, sxpParameter, appDomain, hashTagSize, loadingImage, isOpenHashTag = false }) => {
|
442
443
|
const [rtcList, setRtcList] = React.useState([]);
|
444
|
+
const [tagList, setTagList] = React.useState([]);
|
443
445
|
const [loading, setLoading] = React.useState(false);
|
444
446
|
const [curReqInfo, setCurReqInfo] = React.useState({ rtc: '', requestId: '' });
|
445
447
|
const swiperRef = React.useRef(null);
|
@@ -563,6 +565,19 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
563
565
|
const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/customform', { method: 'POST', body }));
|
564
566
|
return res === null || res === void 0 ? void 0 : res.success;
|
565
567
|
}), [bffFetch]);
|
568
|
+
// 获取 Tag
|
569
|
+
const bffGetTagList = React.useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
570
|
+
var _g, _h;
|
571
|
+
if (!utmVal)
|
572
|
+
return;
|
573
|
+
try {
|
574
|
+
const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/tag/list', { method: 'GET', query: { channel: utmVal } }));
|
575
|
+
setTagList((_h = (_g = result === null || result === void 0 ? void 0 : result.data) === null || _g === void 0 ? void 0 : _g.tags) !== null && _h !== void 0 ? _h : []);
|
576
|
+
}
|
577
|
+
catch (e) {
|
578
|
+
console.log('e', e);
|
579
|
+
}
|
580
|
+
}), [bffFetch, utmVal]);
|
566
581
|
const ctaEvent = React.useCallback((eventInfo, rec, product, position) => {
|
567
582
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
568
583
|
const cta = product === null || product === void 0 ? void 0 : product.bindCta;
|
@@ -583,6 +598,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
583
598
|
}, [bffEventReport, isFromHashtag]);
|
584
599
|
React.useEffect(() => {
|
585
600
|
setLoading(true);
|
601
|
+
bffGetTagList();
|
586
602
|
getRecommendVideos()
|
587
603
|
.then((data) => {
|
588
604
|
var _a, _b;
|
@@ -598,6 +614,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
598
614
|
if (!isInit.current)
|
599
615
|
return;
|
600
616
|
setLoading(true);
|
617
|
+
bffGetTagList();
|
601
618
|
getRecommendVideos()
|
602
619
|
.then((data) => {
|
603
620
|
var _a, _b;
|
@@ -607,7 +624,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
607
624
|
.finally(() => {
|
608
625
|
setLoading(false);
|
609
626
|
});
|
610
|
-
}, [getRecommendVideos]);
|
627
|
+
}, [getRecommendVideos, bffGetTagList]);
|
611
628
|
const defaultLoadingImage = useIconLink('/pb_static/a65d23c5893c49d7aaaa81681d3179e2.gif', appDomain);
|
612
629
|
return (React.createElement(SxpDataSourceContext.Provider, { value: {
|
613
630
|
rtcList,
|
@@ -639,8 +656,16 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
639
656
|
appDomain,
|
640
657
|
hashTagSize,
|
641
658
|
loadingImage: loadingImage !== null && loadingImage !== void 0 ? loadingImage : defaultLoadingImage,
|
642
|
-
isOpenHashTag
|
643
|
-
|
659
|
+
isOpenHashTag,
|
660
|
+
tagList,
|
661
|
+
setLoading
|
662
|
+
} }, render({
|
663
|
+
rtcList,
|
664
|
+
mutateLike: bffMutateLike,
|
665
|
+
mutateUnlike: bffMutateUnlike,
|
666
|
+
submitForm: bffSubmitForm,
|
667
|
+
tagList
|
668
|
+
})));
|
644
669
|
};
|
645
670
|
var SxpDataSourceProvider$1 = React.memo(SxpDataSourceProvider);
|
646
671
|
|
@@ -8389,10 +8414,10 @@ const CommodityDetail$1 = (_a) => {
|
|
8389
8414
|
React.createElement("div", { className: 'pb-commondity-content-title', style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.title, hidden: !!product && !(product === null || product === void 0 ? void 0 : product.title) }, (_b = product === null || product === void 0 ? void 0 : product.title) !== null && _b !== void 0 ? _b : 'Pendant in Yellow Gold with Diamonds, Medium'),
|
8390
8415
|
React.createElement("div", { className: 'pb-commondity-content-price', style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price, hidden: !!product && !(product === null || product === void 0 ? void 0 : product.price) }, priceText),
|
8391
8416
|
React.createElement("div", { hidden: !!product && (!(product === null || product === void 0 ? void 0 : product.info) || (product === null || product === void 0 ? void 0 : product.info) === '') },
|
8392
|
-
React.createElement(ExpandableText$1, { foldText: tipText === null || tipText === void 0 ? void 0 : tipText.foldText, unfoldText: tipText === null || tipText === void 0 ? void 0 : tipText.unfoldText, onClick: () => setShowModal(true), isPost: isPost, text: (_c = product === null || product === void 0 ? void 0 : product.info) !== null && _c !== void 0 ? _c : `The design inspiration of Tiffany Lock series comes from the power of connection and inclusiveness, and the
|
8393
|
-
bold and avant-garde visual design interprets the emotional bond connecting my heart. The Tiffany Lock
|
8394
|
-
collection is unisex and is inspired by the padlock pattern found in the Tiffany Antique Collection. This
|
8395
|
-
necklace features a stylish and eye-catching oval clasp chain decorated with a lock pattern. Crafted from
|
8417
|
+
React.createElement(ExpandableText$1, { foldText: tipText === null || tipText === void 0 ? void 0 : tipText.foldText, unfoldText: tipText === null || tipText === void 0 ? void 0 : tipText.unfoldText, onClick: () => setShowModal(true), isPost: isPost, text: (_c = product === null || product === void 0 ? void 0 : product.info) !== null && _c !== void 0 ? _c : `The design inspiration of Tiffany Lock series comes from the power of connection and inclusiveness, and the
|
8418
|
+
bold and avant-garde visual design interprets the emotional bond connecting my heart. The Tiffany Lock
|
8419
|
+
collection is unisex and is inspired by the padlock pattern found in the Tiffany Antique Collection. This
|
8420
|
+
necklace features a stylish and eye-catching oval clasp chain decorated with a lock pattern. Crafted from
|
8396
8421
|
18-karat gold, this necklace is embellished with hand-set diamonds.`, maxStr: 79, className: 'pb-commondity-content-info', style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.info }))));
|
8397
8422
|
};
|
8398
8423
|
const renderBtn = () => {
|
@@ -8843,7 +8868,7 @@ const CommodityDetailDiroNew$1 = (_a) => {
|
|
8843
8868
|
const productInfoText = ({ isPost }) => {
|
8844
8869
|
return (React.createElement("div", { hidden: !!product && (!(product === null || product === void 0 ? void 0 : product.info) || (product === null || product === void 0 ? void 0 : product.info) === '') },
|
8845
8870
|
React.createElement(ExpandableText$1, { isPost: isPost, onClick: () => setShowModal(true), className: 'pb-commondityDiroNew-info', style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.info, foldText: tipText === null || tipText === void 0 ? void 0 : tipText.foldText, unfoldText: tipText === null || tipText === void 0 ? void 0 : tipText.unfoldText, text: (product === null || product === void 0 ? void 0 : product.info) ||
|
8846
|
-
`Unveiled at the Spring-Summer 2023 fashion show, the Dior Toujours bag is distinguished by a casual and practical design. Crafted in black calfskin with Macrocannage topstitching, it showcases a spacious interior compartment with a matching pouch to organize essentials. Its leather strap closure keeps items secure while the D of the CD Lock closure twists to adjust the sides and enhance the bag's silhouette. The leather handles can be adjusted using the small notches in order to be able to carry the large bag by hand or wear it over the shoulder. CD Lock and strap closures D.I.O.R. charms Removable interior pouch Adjustable leather handles Dust bag included
|
8871
|
+
`Unveiled at the Spring-Summer 2023 fashion show, the Dior Toujours bag is distinguished by a casual and practical design. Crafted in black calfskin with Macrocannage topstitching, it showcases a spacious interior compartment with a matching pouch to organize essentials. Its leather strap closure keeps items secure while the D of the CD Lock closure twists to adjust the sides and enhance the bag's silhouette. The leather handles can be adjusted using the small notches in order to be able to carry the large bag by hand or wear it over the shoulder. CD Lock and strap closures D.I.O.R. charms Removable interior pouch Adjustable leather handles Dust bag included
|
8847
8872
|
Made in Italy` })));
|
8848
8873
|
};
|
8849
8874
|
return (React.createElement("div", { className: 'pb-commondityDiroNew' },
|
@@ -12552,17 +12577,54 @@ var RenderCard$1 = React.memo(RenderCard);
|
|
12552
12577
|
*
|
12553
12578
|
*/
|
12554
12579
|
const Nudge = ({ nudge }) => {
|
12580
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
12555
12581
|
return (React.createElement(React.Fragment, null, (nudge === null || nudge === void 0 ? void 0 : nudge.isOpen) && (React.createElement("div", { className: 'clc-sxp-bottom-nudge', style: {
|
12556
|
-
marginBottom: nudge === null || nudge === void 0 ? void 0 : nudge.marginBottom,
|
12557
|
-
width: nudge === null || nudge === void 0 ? void 0 : nudge.size.width,
|
12558
|
-
height: nudge === null || nudge === void 0 ? void 0 : nudge.size.height,
|
12582
|
+
marginBottom: (_a = nudge === null || nudge === void 0 ? void 0 : nudge.marginBottom) !== null && _a !== void 0 ? _a : 5,
|
12583
|
+
width: (_c = (_b = nudge === null || nudge === void 0 ? void 0 : nudge.size) === null || _b === void 0 ? void 0 : _b.width) !== null && _c !== void 0 ? _c : 212,
|
12584
|
+
height: (_e = (_d = nudge === null || nudge === void 0 ? void 0 : nudge.size) === null || _d === void 0 ? void 0 : _d.height) !== null && _e !== void 0 ? _e : 38,
|
12559
12585
|
backgroundColor: nudge === null || nudge === void 0 ? void 0 : nudge.backgroundColor,
|
12560
|
-
borderRadius: nudge === null || nudge === void 0 ? void 0 : nudge.borderRadius
|
12586
|
+
borderRadius: (_f = nudge === null || nudge === void 0 ? void 0 : nudge.borderRadius) !== null && _f !== void 0 ? _f : 4
|
12561
12587
|
} },
|
12562
12588
|
(nudge === null || nudge === void 0 ? void 0 : nudge.icon) ? React.createElement("img", { src: nudge.icon, style: { height: '100%', objectFit: 'cover' } }) : null,
|
12563
|
-
React.createElement("p", { style: Object.assign({}, nudge === null || nudge === void 0 ? void 0 : nudge.textStyle) }, nudge === null || nudge === void 0 ? void 0 : nudge.content)))));
|
12589
|
+
React.createElement("p", { style: Object.assign({}, nudge === null || nudge === void 0 ? void 0 : nudge.textStyle) }, (_g = nudge === null || nudge === void 0 ? void 0 : nudge.content) !== null && _g !== void 0 ? _g : '')))));
|
12564
12590
|
};
|
12565
12591
|
|
12592
|
+
const DEFAULT_TAG = 'FOR U';
|
12593
|
+
const Tagbar = ({ tagList = [], setActiveIndex }) => {
|
12594
|
+
const [selectTag, setSelectTag] = React.useState(DEFAULT_TAG);
|
12595
|
+
const { getRecommendVideos, setRtcList, setCacheRtcList, setCacheActiveIndex, setLoading, swiperRef } = useSxpDataSource();
|
12596
|
+
const realTagList = React.useMemo(() => {
|
12597
|
+
return [DEFAULT_TAG, ...tagList];
|
12598
|
+
}, [tagList]);
|
12599
|
+
const handleSelectTag = (tag) => () => {
|
12600
|
+
if (tag === selectTag)
|
12601
|
+
return;
|
12602
|
+
let hashTag;
|
12603
|
+
if (tag !== DEFAULT_TAG) {
|
12604
|
+
hashTag = tag;
|
12605
|
+
}
|
12606
|
+
setLoading === null || setLoading === void 0 ? void 0 : setLoading(true);
|
12607
|
+
getRecommendVideos === null || getRecommendVideos === void 0 ? void 0 : getRecommendVideos({ hashTag }).then((res) => {
|
12608
|
+
var _a, _b, _c, _d;
|
12609
|
+
setRtcList === null || setRtcList === void 0 ? void 0 : setRtcList((_a = res === null || res === void 0 ? void 0 : res.recList) !== null && _a !== void 0 ? _a : []);
|
12610
|
+
setCacheRtcList === null || setCacheRtcList === void 0 ? void 0 : setCacheRtcList((_b = res === null || res === void 0 ? void 0 : res.recList) !== null && _b !== void 0 ? _b : []);
|
12611
|
+
setActiveIndex === null || setActiveIndex === void 0 ? void 0 : setActiveIndex(0);
|
12612
|
+
setCacheActiveIndex === null || setCacheActiveIndex === void 0 ? void 0 : setCacheActiveIndex(0);
|
12613
|
+
(_d = (_c = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _c === void 0 ? void 0 : _c.swiper) === null || _d === void 0 ? void 0 : _d.slideTo(0);
|
12614
|
+
}).finally(() => {
|
12615
|
+
setLoading === null || setLoading === void 0 ? void 0 : setLoading(false);
|
12616
|
+
});
|
12617
|
+
setSelectTag(tag);
|
12618
|
+
};
|
12619
|
+
if (tagList.length <= 0)
|
12620
|
+
return null;
|
12621
|
+
return (React.createElement("div", { className: 'clc-sxp-tagbar', style: { height: 45 } },
|
12622
|
+
React.createElement("ul", { className: 'clc-sxp-tagbar-list', style: { margin: 'auto', gap: 24 } }, realTagList.map((tag) => {
|
12623
|
+
return (React.createElement("li", { className: `clc-sxp-tagbar-list-item ${tag === selectTag ? 'clc-sxp-tagbar-list-item-active' : ''}`, key: tag, onClick: handleSelectTag(tag) }, tag));
|
12624
|
+
}))));
|
12625
|
+
};
|
12626
|
+
var Tagbar$1 = React.memo(Tagbar);
|
12627
|
+
|
12566
12628
|
/*
|
12567
12629
|
* @Author: binruan@chatlabs.com
|
12568
12630
|
* @Date: 2024-01-15 19:03:09
|
@@ -12571,7 +12633,7 @@ const Nudge = ({ nudge }) => {
|
|
12571
12633
|
* @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\index.tsx
|
12572
12634
|
*
|
12573
12635
|
*/
|
12574
|
-
const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.innerHeight, containerWidth = window.innerWidth, tempMap, resolver, data = [], ctaType, tipText, nudge, _schema, hashTagStyle }) => {
|
12636
|
+
const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.innerHeight, containerWidth = window.innerWidth, tempMap, resolver, data = [], ctaType, tipText, nudge, _schema, hashTagStyle, tagList = [] }) => {
|
12575
12637
|
var _a, _b, _c, _d, _e, _f, _g;
|
12576
12638
|
const { schema } = useEditor();
|
12577
12639
|
const [activeIndex, setActiveIndex] = React.useState(0);
|
@@ -12716,8 +12778,15 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
12716
12778
|
};
|
12717
12779
|
}, [activeIndex, bffEventReport, curTime, data, handleH5EnterLink, popupDetailData, isFromHashtag, tempMap]);
|
12718
12780
|
const height = React.useMemo(() => {
|
12719
|
-
|
12720
|
-
|
12781
|
+
let minusHeight = 0;
|
12782
|
+
if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.logoUrl) && (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowLogo)) {
|
12783
|
+
minusHeight += 45;
|
12784
|
+
}
|
12785
|
+
if (tagList.length > 0) {
|
12786
|
+
minusHeight += 45;
|
12787
|
+
}
|
12788
|
+
return containerHeight - minusHeight;
|
12789
|
+
}, [globalConfig, containerHeight, tagList]);
|
12721
12790
|
const renderLogo = React.useMemo(() => {
|
12722
12791
|
if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.logoUrl) && (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowLogo)) {
|
12723
12792
|
return (React.createElement("div", { className: 'clc-sxp-logo-banner', style: { backgroundColor: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.color } },
|
@@ -12765,8 +12834,8 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
12765
12834
|
((_a = rec.video) === null || _a === void 0 ? void 0 : _a.title) && !isShowMore && React.createElement("div", { className: 'clc-sxp-bottom-shadow' }),
|
12766
12835
|
React.createElement("div", { className: 'clc-sxp-bottom' },
|
12767
12836
|
React.createElement(Nudge, { nudge: nudge }),
|
12768
|
-
React.createElement("div", { className: 'clc-sxp-bottom-card' },
|
12769
|
-
React.createElement(RenderCard$1, { rec: rec, index: index, tempMap: tempMap, resolver: resolver })),
|
12837
|
+
(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowCTA) === undefined || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowCTA) ? (React.createElement("div", { className: 'clc-sxp-bottom-card' },
|
12838
|
+
React.createElement(RenderCard$1, { rec: rec, index: index, tempMap: tempMap, resolver: resolver }))) : null,
|
12770
12839
|
React.createElement("div", null,
|
12771
12840
|
React.createElement(ExpandableText$1, { className: 'clc-sxp-bottom-text', isPost: true, foldText: tipText === null || tipText === void 0 ? void 0 : tipText.foldText, unfoldText: tipText === null || tipText === void 0 ? void 0 : tipText.unfoldText, text: (_c = (_b = rec.video) === null || _b === void 0 ? void 0 : _b.title) !== null && _c !== void 0 ? _c : '', style: Object.assign(Object.assign({}, descStyle), { textShadow: (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isOpenTextShadow) ? '2px 2px 4px rgba(0, 0, 0, 0.5)' : 'none' }), onChange: onExpandableChange }),
|
12772
12841
|
React.createElement(Hashtag$1, { index: activeIndex, tags: (_e = (_d = rec === null || rec === void 0 ? void 0 : rec.video) === null || _d === void 0 ? void 0 : _d.hashTags) !== null && _e !== void 0 ? _e : [], itemId: (_f = rec === null || rec === void 0 ? void 0 : rec.video) === null || _f === void 0 ? void 0 : _f.itemId, itemType: ((_g = rec.video) === null || _g === void 0 ? void 0 : _g.itemId) ? 'VIDEO' : null, rec: rec, hashTagStyle: hashTagStyle })))));
|
@@ -12927,6 +12996,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
12927
12996
|
setOpenHashtag === null || setOpenHashtag === void 0 ? void 0 : setOpenHashtag(true);
|
12928
12997
|
} })),
|
12929
12998
|
renderLogo,
|
12999
|
+
React.createElement(Tagbar$1, { tagList: tagList, setActiveIndex: setActiveIndex }),
|
12930
13000
|
isShowFingerTip ? React.createElement(FingerSwipeTip, { imageUrl: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.swipeTipIcon }) : null,
|
12931
13001
|
React.createElement(Swiper, { ref: swiperRef, onActiveIndexChange: (swiper) => {
|
12932
13002
|
setActiveIndex(swiper.activeIndex);
|
@@ -13216,10 +13286,17 @@ Object.values(_materials_).forEach((v) => {
|
|
13216
13286
|
});
|
13217
13287
|
const defaultUnLikeIconPath = '/pb_static/f71266d2c64446c5ae6a5a7f5489cc0a.png';
|
13218
13288
|
const defaultLikeIconPath = '/pb_static/f07900fe3f0f4ae188ea1611d4801a44.png';
|
13219
|
-
const DiyPortalPreview = ({ data, globalConfig, tipText, nudge, tempMap, descStyle, hashTagStyle, containerHeight = 664, containerWidth = 375, appDomain }) => {
|
13289
|
+
const DiyPortalPreview = ({ data = [], globalConfig, tipText, nudge, tempMap, descStyle, hashTagStyle, containerHeight = 664, containerWidth = 375, appDomain, tagList = [] }) => {
|
13220
13290
|
const height = React.useMemo(() => {
|
13221
|
-
|
13222
|
-
|
13291
|
+
let minusHeight = 0;
|
13292
|
+
if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.logoUrl) && (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowLogo)) {
|
13293
|
+
minusHeight += 45;
|
13294
|
+
}
|
13295
|
+
if (tagList.length > 0) {
|
13296
|
+
minusHeight += 45;
|
13297
|
+
}
|
13298
|
+
return containerHeight - minusHeight;
|
13299
|
+
}, [globalConfig, containerHeight, tagList]);
|
13223
13300
|
const renderContent = (rec, index) => {
|
13224
13301
|
var _a, _b, _c, _d;
|
13225
13302
|
if ((_a = rec.video) === null || _a === void 0 ? void 0 : _a.url) {
|
@@ -13251,6 +13328,13 @@ const DiyPortalPreview = ({ data, globalConfig, tipText, nudge, tempMap, descSty
|
|
13251
13328
|
}
|
13252
13329
|
return null;
|
13253
13330
|
}, [globalConfig]);
|
13331
|
+
const CTA = (rec, index) => {
|
13332
|
+
if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowCTA) === undefined || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowCTA)) {
|
13333
|
+
return (React.createElement("div", { className: 'clc-sxp-bottom-card' },
|
13334
|
+
React.createElement(RenderCard$1, { rec: rec, index: index, tempMap: tempMap, resolver: RESOLVER$1 })));
|
13335
|
+
}
|
13336
|
+
return null;
|
13337
|
+
};
|
13254
13338
|
const renderBottom = (rec, index) => {
|
13255
13339
|
var _a, _b, _c, _d, _e, _f, _g;
|
13256
13340
|
if (rec.video) {
|
@@ -13258,8 +13342,7 @@ const DiyPortalPreview = ({ data, globalConfig, tipText, nudge, tempMap, descSty
|
|
13258
13342
|
((_a = rec.video) === null || _a === void 0 ? void 0 : _a.title) && React.createElement("div", { className: 'clc-sxp-bottom-shadow' }),
|
13259
13343
|
React.createElement("div", { className: 'clc-sxp-bottom' },
|
13260
13344
|
React.createElement(Nudge, { nudge: nudge }),
|
13261
|
-
|
13262
|
-
React.createElement(RenderCard$1, { rec: rec, index: index, tempMap: tempMap, resolver: RESOLVER$1 })),
|
13345
|
+
CTA(rec, index),
|
13263
13346
|
React.createElement("div", null,
|
13264
13347
|
React.createElement(ExpandableText$1, { className: 'clc-sxp-bottom-text', isPost: true, foldText: tipText === null || tipText === void 0 ? void 0 : tipText.foldText, unfoldText: tipText === null || tipText === void 0 ? void 0 : tipText.unfoldText, text: (_c = (_b = rec.video) === null || _b === void 0 ? void 0 : _b.title) !== null && _c !== void 0 ? _c : '', style: Object.assign(Object.assign({}, descStyle), { textShadow: (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isOpenTextShadow) ? '2px 2px 4px rgba(0, 0, 0, 0.5)' : 'none' }) })),
|
13265
13348
|
React.createElement(Hashtag$1, { index: index, tags: (_e = (_d = rec === null || rec === void 0 ? void 0 : rec.video) === null || _d === void 0 ? void 0 : _d.hashTags) !== null && _e !== void 0 ? _e : [], itemId: (_f = rec === null || rec === void 0 ? void 0 : rec.video) === null || _f === void 0 ? void 0 : _f.itemId, itemType: ((_g = rec.video) === null || _g === void 0 ? void 0 : _g.itemId) ? 'VIDEO' : null, rec: rec, hashTagStyle: hashTagStyle }))));
|
@@ -13288,8 +13371,9 @@ const DiyPortalPreview = ({ data, globalConfig, tipText, nudge, tempMap, descSty
|
|
13288
13371
|
const unmutedIcon = useIconLink('/pb_static/fea8668a8a894e4aa3a86bcc775e895e.png', appDomain);
|
13289
13372
|
const renderView = (rec, index) => {
|
13290
13373
|
var _a, _b, _c, _d;
|
13291
|
-
return (React.createElement("div", { style: { position: 'relative' } },
|
13374
|
+
return (React.createElement("div", { style: { position: 'relative', border: '1px solid #e1e1e1' } },
|
13292
13375
|
renderLogo,
|
13376
|
+
React.createElement(Tagbar$1, { tagList: tagList }),
|
13293
13377
|
React.createElement(ToggleButton$1, { style: {
|
13294
13378
|
position: 'absolute',
|
13295
13379
|
right: (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconX) !== null && _a !== void 0 ? _a : 0,
|
@@ -13408,10 +13492,10 @@ const SxpPageCore = ({ data, maxSize = 10, defaultSize = 10, hashTagSize = 20, l
|
|
13408
13492
|
return searchParams;
|
13409
13493
|
}, []);
|
13410
13494
|
return (React.createElement(EditorCore, { resolver: RESOLVER, enableDataSource: false, schema: data === null || data === void 0 ? void 0 : data.data, utmVal: utmVal },
|
13411
|
-
React.createElement(SxpDataSourceProvider$1, { 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, render: ({ rtcList }) => {
|
13495
|
+
React.createElement(SxpDataSourceProvider$1, { 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, render: ({ rtcList, tagList }) => {
|
13412
13496
|
var _a;
|
13413
13497
|
return (React.createElement(React.Fragment, null,
|
13414
|
-
React.createElement(SxpPageRender, Object.assign({}, (_a = data === null || data === void 0 ? void 0 : data.data) === null || _a === void 0 ? void 0 : _a.sxpPageConf, { data: rtcList, resolver: RESOLVER })),
|
13498
|
+
React.createElement(SxpPageRender, Object.assign({}, (_a = data === null || data === void 0 ? void 0 : data.data) === null || _a === void 0 ? void 0 : _a.sxpPageConf, { tagList: tagList, data: rtcList, resolver: RESOLVER })),
|
13415
13499
|
React.createElement(Popup, null)));
|
13416
13500
|
} })));
|
13417
13501
|
};
|