@contentful/experiences-core 1.27.0-prerelease-20241213T0010-0475c78.0 → 1.27.1-beta.0

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.js CHANGED
@@ -565,7 +565,7 @@ const builtInStyles = {
565
565
  defaultValue: '0px',
566
566
  },
567
567
  cfHyperlink: {
568
- displayName: 'Hyperlink',
568
+ displayName: 'URL',
569
569
  type: 'Hyperlink',
570
570
  defaultValue: '',
571
571
  validations: {
@@ -574,7 +574,7 @@ const builtInStyles = {
574
574
  description: 'hyperlink for section or container',
575
575
  },
576
576
  cfOpenInNewTab: {
577
- displayName: 'Hyperlink behaviour',
577
+ displayName: 'URL behaviour',
578
578
  type: 'Boolean',
579
579
  defaultValue: false,
580
580
  description: 'Open in new tab',
@@ -2024,31 +2024,21 @@ const transformRichText = (entryOrAsset, entityStore, path) => {
2024
2024
  };
2025
2025
  }
2026
2026
  if (typeof value === 'object' && value.nodeType === BLOCKS.DOCUMENT) {
2027
- // resolve any links to assets/entries/hyperlinks
2027
+ //resolve any embedded links - we currently only support resolving embedded in the first entry
2028
2028
  const richTextDocument = value;
2029
- resolveLinks(richTextDocument, entityStore);
2030
- return richTextDocument;
2029
+ richTextDocument.content.forEach((node) => {
2030
+ if ((node.nodeType === BLOCKS.EMBEDDED_ENTRY || node.nodeType === BLOCKS.EMBEDDED_ASSET) &&
2031
+ node.data.target.sys.type === 'Link') {
2032
+ const entity = entityStore.getEntityFromLink(node.data.target);
2033
+ if (entity) {
2034
+ node.data.target = entity;
2035
+ }
2036
+ }
2037
+ });
2038
+ return value;
2031
2039
  }
2032
2040
  return undefined;
2033
2041
  };
2034
- const isLinkTarget = (node) => {
2035
- return node?.data?.target?.sys?.type === 'Link';
2036
- };
2037
- const resolveLinks = (node, entityStore) => {
2038
- if (!node)
2039
- return;
2040
- // Resolve link if current node has one
2041
- if (isLinkTarget(node)) {
2042
- const entity = entityStore.getEntityFromLink(node.data.target);
2043
- if (entity) {
2044
- node.data.target = entity;
2045
- }
2046
- }
2047
- // Process content array if it exists
2048
- if ('content' in node && Array.isArray(node.content)) {
2049
- node.content.forEach((childNode) => resolveLinks(childNode, entityStore));
2050
- }
2051
- };
2052
2042
 
2053
2043
  function getOptimizedImageUrl(url, width, quality, format) {
2054
2044
  if (url.startsWith('//')) {
@@ -2527,7 +2517,6 @@ const getValueForBreakpoint = (valuesByBreakpoint, breakpoints, activeBreakpoint
2527
2517
  // Old design properties did not support breakpoints, keep for backward compatibility
2528
2518
  return valuesByBreakpoint;
2529
2519
  }
2530
- return undefined;
2531
2520
  };
2532
2521
 
2533
2522
  // eslint-disable-next-line @typescript-eslint/no-explicit-any