pb-sxp-ui 1.20.15 → 1.20.17

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.
@@ -5,15 +5,26 @@ import FormatImage from '../SxpPageRender/FormatImage';
5
5
  const RESOLVER = {};
6
6
  try {
7
7
  const materialsModule = require('../../materials/sxp');
8
- Object.values(materialsModule).forEach((v) => {
9
- var _a;
10
- if ((_a = v === null || v === void 0 ? void 0 : v.extend) === null || _a === void 0 ? void 0 : _a.type) {
11
- RESOLVER[v.extend.type] = v;
8
+ if (materialsModule && typeof materialsModule === 'object') {
9
+ Object.values(materialsModule).forEach((v) => {
10
+ var _a;
11
+ if ((_a = v === null || v === void 0 ? void 0 : v.extend) === null || _a === void 0 ? void 0 : _a.type) {
12
+ RESOLVER[v.extend.type] = v;
13
+ }
14
+ });
15
+ if (Object.keys(RESOLVER).length > 0) {
16
+ console.log('[StructurePage] Successfully loaded materials:', Object.keys(RESOLVER));
17
+ }
18
+ else {
19
+ console.warn('[StructurePage] Materials module loaded but no valid components found');
12
20
  }
13
- });
21
+ }
22
+ else {
23
+ console.warn('[StructurePage] Materials module is not a valid object:', materialsModule);
24
+ }
14
25
  }
15
26
  catch (error) {
16
- console.warn('Failed to load materials for StructurePage:', error);
27
+ console.error('[StructurePage] Failed to load materials for StructurePage:', error);
17
28
  }
18
29
  const baseStyles = {
19
30
  container: {
@@ -444,9 +455,14 @@ const StructurePage = (_a) => {
444
455
  if (editorMode && templateType && RESOLVER[templateType]) {
445
456
  const TemplateComponent = RESOLVER[templateType];
446
457
  const templateExtend = TemplateComponent === null || TemplateComponent === void 0 ? void 0 : TemplateComponent.extend;
447
- if (templateExtend) {
448
- const templateProps = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (_a = templateExtend.defaulSetting) === null || _a === void 0 ? void 0 : _a.props), { style: Object.assign(Object.assign(Object.assign({}, (_b = templateExtend.defaulSetting) === null || _b === void 0 ? void 0 : _b.style), mergeStyles(fallbackStyle || {}, buttonKey)), { marginBottom: 0, width: '100%' }), textStyle: (_c = templateExtend.defaulSetting) === null || _c === void 0 ? void 0 : _c.textStyle }), (productData && { bindProduct: productData })), { isTel: true }), rest);
449
- return React.createElement(TemplateComponent, templateProps);
458
+ if (templateExtend && typeof TemplateComponent === 'function') {
459
+ try {
460
+ const templateProps = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (_a = templateExtend.defaulSetting) === null || _a === void 0 ? void 0 : _a.props), { style: Object.assign(Object.assign(Object.assign({}, (_b = templateExtend.defaulSetting) === null || _b === void 0 ? void 0 : _b.style), mergeStyles(fallbackStyle || {}, buttonKey)), { marginBottom: 0, width: '100%' }), textStyle: (_c = templateExtend.defaulSetting) === null || _c === void 0 ? void 0 : _c.textStyle }), (productData && { bindProduct: productData })), { isTel: true }), rest);
461
+ return React.createElement(TemplateComponent, templateProps);
462
+ }
463
+ catch (error) {
464
+ console.error(`[StructurePage] Failed to render template component ${templateType}:`, error);
465
+ }
450
466
  }
451
467
  }
452
468
  return (React.createElement("button", { style: mergeStyles(fallbackStyle || baseStyles.heroButton, buttonKey), onClick: () => handleCtaClick(ctaData === null || ctaData === void 0 ? void 0 : ctaData.link, interaction, productData, ctaData) }, ctaData.title));
@@ -7,15 +7,26 @@ const FormatImage_1 = tslib_1.__importDefault(require("../SxpPageRender/FormatIm
7
7
  const RESOLVER = {};
8
8
  try {
9
9
  const materialsModule = require('../../materials/sxp');
10
- Object.values(materialsModule).forEach((v) => {
11
- var _a;
12
- if ((_a = v === null || v === void 0 ? void 0 : v.extend) === null || _a === void 0 ? void 0 : _a.type) {
13
- RESOLVER[v.extend.type] = v;
10
+ if (materialsModule && typeof materialsModule === 'object') {
11
+ Object.values(materialsModule).forEach((v) => {
12
+ var _a;
13
+ if ((_a = v === null || v === void 0 ? void 0 : v.extend) === null || _a === void 0 ? void 0 : _a.type) {
14
+ RESOLVER[v.extend.type] = v;
15
+ }
16
+ });
17
+ if (Object.keys(RESOLVER).length > 0) {
18
+ console.log('[StructurePage] Successfully loaded materials:', Object.keys(RESOLVER));
19
+ }
20
+ else {
21
+ console.warn('[StructurePage] Materials module loaded but no valid components found');
14
22
  }
15
- });
23
+ }
24
+ else {
25
+ console.warn('[StructurePage] Materials module is not a valid object:', materialsModule);
26
+ }
16
27
  }
17
28
  catch (error) {
18
- console.warn('Failed to load materials for StructurePage:', error);
29
+ console.error('[StructurePage] Failed to load materials for StructurePage:', error);
19
30
  }
20
31
  const baseStyles = {
21
32
  container: {
@@ -446,9 +457,14 @@ const StructurePage = (_a) => {
446
457
  if (editorMode && templateType && RESOLVER[templateType]) {
447
458
  const TemplateComponent = RESOLVER[templateType];
448
459
  const templateExtend = TemplateComponent === null || TemplateComponent === void 0 ? void 0 : TemplateComponent.extend;
449
- if (templateExtend) {
450
- const templateProps = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (_a = templateExtend.defaulSetting) === null || _a === void 0 ? void 0 : _a.props), { style: Object.assign(Object.assign(Object.assign({}, (_b = templateExtend.defaulSetting) === null || _b === void 0 ? void 0 : _b.style), mergeStyles(fallbackStyle || {}, buttonKey)), { marginBottom: 0, width: '100%' }), textStyle: (_c = templateExtend.defaulSetting) === null || _c === void 0 ? void 0 : _c.textStyle }), (productData && { bindProduct: productData })), { isTel: true }), rest);
451
- return react_1.default.createElement(TemplateComponent, templateProps);
460
+ if (templateExtend && typeof TemplateComponent === 'function') {
461
+ try {
462
+ const templateProps = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (_a = templateExtend.defaulSetting) === null || _a === void 0 ? void 0 : _a.props), { style: Object.assign(Object.assign(Object.assign({}, (_b = templateExtend.defaulSetting) === null || _b === void 0 ? void 0 : _b.style), mergeStyles(fallbackStyle || {}, buttonKey)), { marginBottom: 0, width: '100%' }), textStyle: (_c = templateExtend.defaulSetting) === null || _c === void 0 ? void 0 : _c.textStyle }), (productData && { bindProduct: productData })), { isTel: true }), rest);
463
+ return react_1.default.createElement(TemplateComponent, templateProps);
464
+ }
465
+ catch (error) {
466
+ console.error(`[StructurePage] Failed to render template component ${templateType}:`, error);
467
+ }
452
468
  }
453
469
  }
454
470
  return (react_1.default.createElement("button", { style: mergeStyles(fallbackStyle || baseStyles.heroButton, buttonKey), onClick: () => handleCtaClick(ctaData === null || ctaData === void 0 ? void 0 : ctaData.link, interaction, productData, ctaData) }, ctaData.title));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pb-sxp-ui",
3
- "version": "1.20.15",
3
+ "version": "1.20.17",
4
4
  "description": "React enterprise-class UI components",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",