pb-sxp-ui 1.20.32 → 1.20.34

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 CHANGED
@@ -489,13 +489,23 @@ var tool = /*#__PURE__*/Object.freeze({
489
489
  });
490
490
 
491
491
  function unzip(b64Data) {
492
- const strData = atob(b64Data);
493
- const charData = strData.split('').map(function (x) {
494
- return x.charCodeAt(0);
495
- });
496
- const binData = new Uint8Array(charData);
497
- const data = pako.inflate(binData, { to: 'string' });
498
- return JSON.parse(data);
492
+ try {
493
+ // 检查输入是否有效
494
+ if (!b64Data || typeof b64Data !== 'string') {
495
+ return null;
496
+ }
497
+ const strData = atob(b64Data);
498
+ const charData = strData.split('').map(function (x) {
499
+ return x.charCodeAt(0);
500
+ });
501
+ const binData = new Uint8Array(charData);
502
+ const data = pako.inflate(binData, { to: 'string' });
503
+ return JSON.parse(data);
504
+ }
505
+ catch (error) {
506
+ console.error('Failed to unzip data:', error);
507
+ return null;
508
+ }
499
509
  }
500
510
 
501
511
  /*
@@ -10779,7 +10789,7 @@ const Modal = ({ visible, onClose, children, modalStyle, padding, popup, schema,
10779
10789
  const { schema: _schema, popup: _popup } = useEditor();
10780
10790
  const [scrollTop, setScrollTop] = React.useState(15);
10781
10791
  React.useEffect(() => {
10782
- const parentNode = document.getElementById('sxp-render');
10792
+ const parentNode = document.getElementById('sxp-render') || document.body;
10783
10793
  const node = document.getElementById('pb-modal');
10784
10794
  if (node) {
10785
10795
  modalEleRef.current = node;
@@ -19658,6 +19668,14 @@ const StructurePage = (_a) => {
19658
19668
  // 视频暂停状态管理
19659
19669
  const [isHeroVideoPaused, setIsHeroVideoPaused] = React.useState(false);
19660
19670
  const [carouselVideoPausedStates, setCarouselVideoPausedStates] = React.useState([]);
19671
+ // 调试日志
19672
+ console.log('[StructurePage] Props:', {
19673
+ editorMode,
19674
+ isCmsMode,
19675
+ hasMultiCTAConfig: !!propMultiCTAConfig,
19676
+ multiCTAConfigKeys: propMultiCTAConfig ? Object.keys(propMultiCTAConfig) : [],
19677
+ storyId
19678
+ });
19661
19679
  // 从 schema 中获取 multiCTAConfig(优先使用 props 传入的)
19662
19680
  const { schema } = useEditor();
19663
19681
  const multiCTAConfig = React.useMemo(() => {
@@ -19726,7 +19744,8 @@ const StructurePage = (_a) => {
19726
19744
  }, []);
19727
19745
  // 合并基础样式和编辑器配置的样式
19728
19746
  const mergeStyles = React.useCallback((baseStyle, configKey) => {
19729
- if (!editorMode || !multiCTAConfig[configKey]) {
19747
+ // 修改:只要有 multiCTAConfig 就应用样式,不再限制必须 editorMode=true
19748
+ if (!multiCTAConfig || !multiCTAConfig[configKey]) {
19730
19749
  return baseStyle;
19731
19750
  }
19732
19751
  const config = multiCTAConfig[configKey];
@@ -19798,7 +19817,8 @@ const StructurePage = (_a) => {
19798
19817
  if (styleConfig.buttonHeight && typeof styleConfig.buttonHeight === 'number') {
19799
19818
  customStyle.height = `${styleConfig.buttonHeight}px`;
19800
19819
  }
19801
- return Object.assign(Object.assign({}, baseStyle), customStyle);
19820
+ const finalStyle = Object.assign(Object.assign({}, baseStyle), customStyle);
19821
+ return finalStyle;
19802
19822
  }, [editorMode, multiCTAConfig]);
19803
19823
  // 渲染 CTA 按钮或模版组件
19804
19824
  const renderCTA = React.useCallback((buttonKey, ctaData, productData, fallbackStyle) => {
@@ -19810,7 +19830,8 @@ const StructurePage = (_a) => {
19810
19830
  const templateType = config === null || config === void 0 ? void 0 : config.templateType;
19811
19831
  const interaction = config === null || config === void 0 ? void 0 : config.interaction;
19812
19832
  // 如果配置了模版类型,渲染对应的模版组件
19813
- if (editorMode && templateType && RESOLVER$3[templateType]) {
19833
+ // 修改:移除 editorMode 限制,只要有 templateType 就使用模板组件
19834
+ if (templateType && RESOLVER$3[templateType]) {
19814
19835
  const TemplateComponent = RESOLVER$3[templateType];
19815
19836
  const templateExtend = TemplateComponent === null || TemplateComponent === void 0 ? void 0 : TemplateComponent.extend;
19816
19837
  // 严格检查组件是否有效
@@ -22972,6 +22993,7 @@ exports.DiyPortalPreview = index$2;
22972
22993
  exports.DiyStoryPreview = index$1;
22973
22994
  exports.EditorDataProvider = EditorDataProvider;
22974
22995
  exports.Modal = Modal$1;
22996
+ exports.Popup = Popup;
22975
22997
  exports.StructurePage = StructurePage;
22976
22998
  exports.SxpDataSourceProvider = SxpDataSourceProvider$1;
22977
22999
  exports.SxpPageCore = index;