pb-sxp-ui 1.19.5 → 1.19.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.
@@ -16,6 +16,8 @@ const ExpandableText = ({ text, maxStr = 108, style, className, onClick, foldTex
16
16
  if (!realRef.current || !clampRef.current || !isPost || !text || isShowMore)
17
17
  return;
18
18
  requestAnimationFrame(() => {
19
+ if (!realRef.current)
20
+ return;
19
21
  realRef.current.style.position = 'relative';
20
22
  const realHeight = realRef.current.getBoundingClientRect().height;
21
23
  const clampHeight = clampRef.current.getBoundingClientRect().height;
@@ -3,7 +3,7 @@ import './index.less';
3
3
  import { cloneDeep } from 'lodash';
4
4
  import withBindDataSource from '../../../core/hoc/withBindDataSource';
5
5
  import { useEditor } from '../../../core/hooks';
6
- const RenderCard = ({ rec, index, tempMap, resolver, includesCtaType, isActive, isNineProduct }) => {
6
+ const RenderCard = ({ rec, index, tempMap, resolver, includesCtaType = [], isActive, isNineProduct }) => {
7
7
  var _a, _b, _c, _d, _e;
8
8
  const { schema } = useEditor();
9
9
  if (!(rec === null || rec === void 0 ? void 0 : rec.video))
@@ -21,9 +21,9 @@ const RenderCard = ({ rec, index, tempMap, resolver, includesCtaType, isActive,
21
21
  const value = tempMap === null || tempMap === void 0 ? void 0 : tempMap[cta];
22
22
  const renderComp = useMemo(() => {
23
23
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3;
24
- if (includesCtaType && !(includesCtaType === null || includesCtaType === void 0 ? void 0 : includesCtaType.includes((_a = value === null || value === void 0 ? void 0 : value.item) === null || _a === void 0 ? void 0 : _a.type)))
24
+ if ((includesCtaType === null || includesCtaType === void 0 ? void 0 : includesCtaType.length) > 0 && !(includesCtaType === null || includesCtaType === void 0 ? void 0 : includesCtaType.includes((_a = value === null || value === void 0 ? void 0 : value.item) === null || _a === void 0 ? void 0 : _a.type)))
25
25
  return;
26
- if (!includesCtaType && ((_b = value === null || value === void 0 ? void 0 : value.item) === null || _b === void 0 ? void 0 : _b.category) === 'cta')
26
+ if ((!includesCtaType || (includesCtaType === null || includesCtaType === void 0 ? void 0 : includesCtaType.length) === 0) && ((_b = value === null || value === void 0 ? void 0 : value.item) === null || _b === void 0 ? void 0 : _b.category) === 'cta')
27
27
  return;
28
28
  if ((((_c = value === null || value === void 0 ? void 0 : value.item) === null || _c === void 0 ? void 0 : _c.type) === 'CommodityDiro' && !((_d = rec === null || rec === void 0 ? void 0 : rec.video) === null || _d === void 0 ? void 0 : _d.bindProduct)) ||
29
29
  (((_e = value === null || value === void 0 ? void 0 : value.item) === null || _e === void 0 ? void 0 : _e.type) === 'Commodity' && !((_f = rec === null || rec === void 0 ? void 0 : rec.video) === null || _f === void 0 ? void 0 : _f.bindProduct)) ||
@@ -322,7 +322,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
322
322
  React.createElement("div", { className: 'clc-sxp-bottom', style: { marginBottom: `${(_j = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.bottomInfoDist) !== null && _j !== void 0 ? _j : 40}px` } },
323
323
  React.createElement(Nudge, { nudge: nudge }),
324
324
  ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowCTA) === undefined || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowCTA)) && !isNineProduct ? (React.createElement("div", { className: 'clc-sxp-bottom-card' },
325
- React.createElement(RenderCard, { rec: rec, index: index, tempMap: tempMap, resolver: resolver, isActive: index === activeIndex }))) : null,
325
+ React.createElement(RenderCard, { rec: rec, index: index, tempMap: tempMap, resolver: resolver, isActive: index === activeIndex, includesCtaType: [] }))) : null,
326
326
  React.createElement("div", { style: { display: 'flex', flexDirection: 'column' } },
327
327
  React.createElement(ExpandableText, { 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: (_l = (_k = rec === null || rec === void 0 ? void 0 : rec.video) === null || _k === void 0 ? void 0 : _k.title) !== null && _l !== void 0 ? _l : '', 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 }),
328
328
  React.createElement(RenderCard, { rec: rec, index: index, tempMap: tempMap, resolver: resolver, includesCtaType: ['AniLink'], isActive: index === activeIndex }),
@@ -50,6 +50,10 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
50
50
  const [chatlabsId, setChatlabsId] = useState();
51
51
  const finalPageData = useMemo(() => pageData !== null && pageData !== void 0 ? pageData : data, [pageData, data]);
52
52
  const pixelPvStatusRef = useRef(false);
53
+ useEffect(() => {
54
+ var _a, _b;
55
+ setGlobalConfig((_b = (_a = data === null || data === void 0 ? void 0 : data.data) === null || _a === void 0 ? void 0 : _a.sxpPageConf) === null || _b === void 0 ? void 0 : _b.globalConfig);
56
+ }, [data]);
53
57
  const isShowConsent = useMemo(() => {
54
58
  var _a, _b, _c, _d;
55
59
  return (((((_d = (_c = (_b = (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.consent) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.item) === null || _c === void 0 ? void 0 : _c.props) === null || _d === void 0 ? void 0 : _d.privacy_necessity) && !isAgreePolicy && !isEditor) || isOpenConsent) &&
@@ -18,6 +18,8 @@ const ExpandableText = ({ text, maxStr = 108, style, className, onClick, foldTex
18
18
  if (!realRef.current || !clampRef.current || !isPost || !text || isShowMore)
19
19
  return;
20
20
  requestAnimationFrame(() => {
21
+ if (!realRef.current)
22
+ return;
21
23
  realRef.current.style.position = 'relative';
22
24
  const realHeight = realRef.current.getBoundingClientRect().height;
23
25
  const clampHeight = clampRef.current.getBoundingClientRect().height;
@@ -6,7 +6,7 @@ require("./index.less");
6
6
  const lodash_1 = require("lodash");
7
7
  const withBindDataSource_1 = tslib_1.__importDefault(require("../../../core/hoc/withBindDataSource"));
8
8
  const hooks_1 = require("../../../core/hooks");
9
- const RenderCard = ({ rec, index, tempMap, resolver, includesCtaType, isActive, isNineProduct }) => {
9
+ const RenderCard = ({ rec, index, tempMap, resolver, includesCtaType = [], isActive, isNineProduct }) => {
10
10
  var _a, _b, _c, _d, _e;
11
11
  const { schema } = (0, hooks_1.useEditor)();
12
12
  if (!(rec === null || rec === void 0 ? void 0 : rec.video))
@@ -24,9 +24,9 @@ const RenderCard = ({ rec, index, tempMap, resolver, includesCtaType, isActive,
24
24
  const value = tempMap === null || tempMap === void 0 ? void 0 : tempMap[cta];
25
25
  const renderComp = (0, react_1.useMemo)(() => {
26
26
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3;
27
- if (includesCtaType && !(includesCtaType === null || includesCtaType === void 0 ? void 0 : includesCtaType.includes((_a = value === null || value === void 0 ? void 0 : value.item) === null || _a === void 0 ? void 0 : _a.type)))
27
+ if ((includesCtaType === null || includesCtaType === void 0 ? void 0 : includesCtaType.length) > 0 && !(includesCtaType === null || includesCtaType === void 0 ? void 0 : includesCtaType.includes((_a = value === null || value === void 0 ? void 0 : value.item) === null || _a === void 0 ? void 0 : _a.type)))
28
28
  return;
29
- if (!includesCtaType && ((_b = value === null || value === void 0 ? void 0 : value.item) === null || _b === void 0 ? void 0 : _b.category) === 'cta')
29
+ if ((!includesCtaType || (includesCtaType === null || includesCtaType === void 0 ? void 0 : includesCtaType.length) === 0) && ((_b = value === null || value === void 0 ? void 0 : value.item) === null || _b === void 0 ? void 0 : _b.category) === 'cta')
30
30
  return;
31
31
  if ((((_c = value === null || value === void 0 ? void 0 : value.item) === null || _c === void 0 ? void 0 : _c.type) === 'CommodityDiro' && !((_d = rec === null || rec === void 0 ? void 0 : rec.video) === null || _d === void 0 ? void 0 : _d.bindProduct)) ||
32
32
  (((_e = value === null || value === void 0 ? void 0 : value.item) === null || _e === void 0 ? void 0 : _e.type) === 'Commodity' && !((_f = rec === null || rec === void 0 ? void 0 : rec.video) === null || _f === void 0 ? void 0 : _f.bindProduct)) ||
@@ -325,7 +325,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
325
325
  react_1.default.createElement("div", { className: 'clc-sxp-bottom', style: { marginBottom: `${(_j = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.bottomInfoDist) !== null && _j !== void 0 ? _j : 40}px` } },
326
326
  react_1.default.createElement(Nudge_1.default, { nudge: nudge }),
327
327
  ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowCTA) === undefined || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowCTA)) && !isNineProduct ? (react_1.default.createElement("div", { className: 'clc-sxp-bottom-card' },
328
- react_1.default.createElement(RenderCard_1.default, { rec: rec, index: index, tempMap: tempMap, resolver: resolver, isActive: index === activeIndex }))) : null,
328
+ react_1.default.createElement(RenderCard_1.default, { rec: rec, index: index, tempMap: tempMap, resolver: resolver, isActive: index === activeIndex, includesCtaType: [] }))) : null,
329
329
  react_1.default.createElement("div", { style: { display: 'flex', flexDirection: 'column' } },
330
330
  react_1.default.createElement(ExpandableText_1.default, { 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: (_l = (_k = rec === null || rec === void 0 ? void 0 : rec.video) === null || _k === void 0 ? void 0 : _k.title) !== null && _l !== void 0 ? _l : '', 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 }),
331
331
  react_1.default.createElement(RenderCard_1.default, { rec: rec, index: index, tempMap: tempMap, resolver: resolver, includesCtaType: ['AniLink'], isActive: index === activeIndex }),
@@ -53,6 +53,10 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
53
53
  const [chatlabsId, setChatlabsId] = (0, react_1.useState)();
54
54
  const finalPageData = (0, react_1.useMemo)(() => pageData !== null && pageData !== void 0 ? pageData : data, [pageData, data]);
55
55
  const pixelPvStatusRef = (0, react_1.useRef)(false);
56
+ (0, react_1.useEffect)(() => {
57
+ var _a, _b;
58
+ setGlobalConfig((_b = (_a = data === null || data === void 0 ? void 0 : data.data) === null || _a === void 0 ? void 0 : _a.sxpPageConf) === null || _b === void 0 ? void 0 : _b.globalConfig);
59
+ }, [data]);
56
60
  const isShowConsent = (0, react_1.useMemo)(() => {
57
61
  var _a, _b, _c, _d;
58
62
  return (((((_d = (_c = (_b = (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.consent) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.item) === null || _c === void 0 ? void 0 : _c.props) === null || _d === void 0 ? void 0 : _d.privacy_necessity) && !isAgreePolicy && !isEditor) || isOpenConsent) &&
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pb-sxp-ui",
3
- "version": "1.19.5",
3
+ "version": "1.19.6",
4
4
  "description": "React enterprise-class UI components",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",