@cmssy/react 9.6.0 → 9.6.1

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/client.cjs CHANGED
@@ -522,6 +522,7 @@ function CmssyBlock({
522
522
  patchedContent,
523
523
  patchedStyle,
524
524
  patchedAdvanced,
525
+ schema,
525
526
  editable,
526
527
  editMode,
527
528
  layoutPosition,
@@ -569,6 +570,7 @@ function CmssyBlock({
569
570
  }
570
571
  const base = core.getBlockContentForLanguage(block.content, locale, defaultLocale);
571
572
  const content = patchedContent ? { ...base, ...patchedContent } : base;
573
+ if (schema) core.normalizeRelationContent(content, schema);
572
574
  const style = patchedStyle ? { ...core.asBucket(block.style), ...patchedStyle } : core.asBucket(block.style);
573
575
  const advanced = patchedAdvanced ? { ...core.asBucket(block.advanced), ...patchedAdvanced } : core.asBucket(block.advanced);
574
576
  return wrap(
@@ -680,6 +682,7 @@ function EditableBlocks({
680
682
  patchedContent: patches[block.id],
681
683
  patchedStyle: patchesStyle[block.id],
682
684
  patchedAdvanced: patchesAdvanced[block.id],
685
+ schema: bridgeConfig.schemas?.[block.type],
683
686
  blockMap,
684
687
  editable: true,
685
688
  context,
package/dist/client.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { createContext, useState, useRef, useEffect, useMemo, useContext, useCallback, createElement } from 'react';
3
- import { fields, resolveInitialTarget, buildBlockContext, postToEditor, PROTOCOL_VERSION, parseEditorMessage, getBlockContentForLanguage, asBucket, toMinorUnits, formatPrice } from '@cmssy/core';
3
+ import { fields, resolveInitialTarget, buildBlockContext, postToEditor, PROTOCOL_VERSION, parseEditorMessage, getBlockContentForLanguage, normalizeRelationContent, asBucket, toMinorUnits, formatPrice } from '@cmssy/core';
4
4
  export { formatPrice, fractionDigits, fromMinorUnits, toMinorUnits } from '@cmssy/core';
5
5
  import { BlockErrorBoundary } from '@cmssy/react/block-error-boundary';
6
6
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
@@ -521,6 +521,7 @@ function CmssyBlock({
521
521
  patchedContent,
522
522
  patchedStyle,
523
523
  patchedAdvanced,
524
+ schema,
524
525
  editable,
525
526
  editMode,
526
527
  layoutPosition,
@@ -568,6 +569,7 @@ function CmssyBlock({
568
569
  }
569
570
  const base = getBlockContentForLanguage(block.content, locale, defaultLocale);
570
571
  const content = patchedContent ? { ...base, ...patchedContent } : base;
572
+ if (schema) normalizeRelationContent(content, schema);
571
573
  const style = patchedStyle ? { ...asBucket(block.style), ...patchedStyle } : asBucket(block.style);
572
574
  const advanced = patchedAdvanced ? { ...asBucket(block.advanced), ...patchedAdvanced } : asBucket(block.advanced);
573
575
  return wrap(
@@ -679,6 +681,7 @@ function EditableBlocks({
679
681
  patchedContent: patches[block.id],
680
682
  patchedStyle: patchesStyle[block.id],
681
683
  patchedAdvanced: patchesAdvanced[block.id],
684
+ schema: bridgeConfig.schemas?.[block.type],
682
685
  blockMap,
683
686
  editable: true,
684
687
  context,
package/dist/index.cjs CHANGED
@@ -443,6 +443,7 @@ function CmssyBlock({
443
443
  patchedContent,
444
444
  patchedStyle,
445
445
  patchedAdvanced,
446
+ schema,
446
447
  editable,
447
448
  editMode,
448
449
  layoutPosition,
@@ -490,6 +491,7 @@ function CmssyBlock({
490
491
  }
491
492
  const base = core.getBlockContentForLanguage(block.content, locale, defaultLocale);
492
493
  const content = patchedContent ? { ...base, ...patchedContent } : base;
494
+ if (schema) core.normalizeRelationContent(content, schema);
493
495
  const style = patchedStyle ? { ...core.asBucket(block.style), ...patchedStyle } : core.asBucket(block.style);
494
496
  const advanced = patchedAdvanced ? { ...core.asBucket(block.advanced), ...patchedAdvanced } : core.asBucket(block.advanced);
495
497
  return wrap(
package/dist/index.d.cts CHANGED
@@ -3,6 +3,7 @@ export { AppToEditorMessage, BlockMeta, BlockPropsSchema, BlockRect, BlockSchema
3
3
  import { B as BlockDefinition, a as BlockMap } from './registry-Bfq4Pq18.cjs';
4
4
  export { b as BlockProps, c as blocksToMeta, d as blocksToSchemas, e as buildBlockMap, f as defineBlock } from './registry-Bfq4Pq18.cjs';
5
5
  import * as react_jsx_runtime from 'react/jsx-runtime';
6
+ import { FieldDefinition } from '@cmssy/types';
6
7
  export { FieldCondition, FieldConditionGroup, FieldConditionLogic, evaluateFieldConditionGroup } from '@cmssy/types';
7
8
  import 'react';
8
9
 
@@ -90,13 +91,15 @@ interface CmssyBlockProps {
90
91
  patchedContent?: Record<string, unknown>;
91
92
  patchedStyle?: Record<string, unknown>;
92
93
  patchedAdvanced?: Record<string, unknown>;
94
+ /** The block's field schema; lets the client render coerce raw relation values. */
95
+ schema?: Record<string, FieldDefinition>;
93
96
  editable?: boolean;
94
97
  editMode?: boolean;
95
98
  layoutPosition?: string;
96
99
  context?: CmssyBlockContext;
97
100
  data?: unknown;
98
101
  }
99
- declare function CmssyBlock({ block, locale, defaultLocale, blockMap, patchedContent, patchedStyle, patchedAdvanced, editable, editMode, layoutPosition, context, data, }: CmssyBlockProps): react_jsx_runtime.JSX.Element | null;
102
+ declare function CmssyBlock({ block, locale, defaultLocale, blockMap, patchedContent, patchedStyle, patchedAdvanced, schema, editable, editMode, layoutPosition, context, data, }: CmssyBlockProps): react_jsx_runtime.JSX.Element | null;
100
103
 
101
104
  interface UnknownBlockProps {
102
105
  type: string;
package/dist/index.d.ts CHANGED
@@ -3,6 +3,7 @@ export { AppToEditorMessage, BlockMeta, BlockPropsSchema, BlockRect, BlockSchema
3
3
  import { B as BlockDefinition, a as BlockMap } from './registry-Bfq4Pq18.js';
4
4
  export { b as BlockProps, c as blocksToMeta, d as blocksToSchemas, e as buildBlockMap, f as defineBlock } from './registry-Bfq4Pq18.js';
5
5
  import * as react_jsx_runtime from 'react/jsx-runtime';
6
+ import { FieldDefinition } from '@cmssy/types';
6
7
  export { FieldCondition, FieldConditionGroup, FieldConditionLogic, evaluateFieldConditionGroup } from '@cmssy/types';
7
8
  import 'react';
8
9
 
@@ -90,13 +91,15 @@ interface CmssyBlockProps {
90
91
  patchedContent?: Record<string, unknown>;
91
92
  patchedStyle?: Record<string, unknown>;
92
93
  patchedAdvanced?: Record<string, unknown>;
94
+ /** The block's field schema; lets the client render coerce raw relation values. */
95
+ schema?: Record<string, FieldDefinition>;
93
96
  editable?: boolean;
94
97
  editMode?: boolean;
95
98
  layoutPosition?: string;
96
99
  context?: CmssyBlockContext;
97
100
  data?: unknown;
98
101
  }
99
- declare function CmssyBlock({ block, locale, defaultLocale, blockMap, patchedContent, patchedStyle, patchedAdvanced, editable, editMode, layoutPosition, context, data, }: CmssyBlockProps): react_jsx_runtime.JSX.Element | null;
102
+ declare function CmssyBlock({ block, locale, defaultLocale, blockMap, patchedContent, patchedStyle, patchedAdvanced, schema, editable, editMode, layoutPosition, context, data, }: CmssyBlockProps): react_jsx_runtime.JSX.Element | null;
100
103
 
101
104
  interface UnknownBlockProps {
102
105
  type: string;
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { buildBlockContext, getBlockContentForLanguage, asBucket, resolveSiteLocales, resolveRelationContent } from '@cmssy/core';
1
+ import { buildBlockContext, getBlockContentForLanguage, normalizeRelationContent, asBucket, resolveSiteLocales, resolveRelationContent } from '@cmssy/core';
2
2
  export { CmssyRequestError, DEFAULT_CMSSY_API_URL, FORM_QUERY, MODEL_DEFINITIONS_QUERY, MODEL_RECORDS_QUERY, PROTOCOL_VERSION, SITE_CONFIG_QUERY, SUBMIT_FORM_MUTATION, buildBlockContext, buildLocaleSwitchHref, collectFormIds, createCmssyClient, fetchLayouts, fetchPage, fetchPageById, fetchPageMeta, fetchPages, fetchSiteConfig, fields, getBlockContentForLanguage, graphqlRequest, isProtocolCompatible, localizeHref, localizeHtmlLinks, normalizeOrigin, normalizeSlug, parseEditorMessage, postToEditor, resolveApiUrl, resolveForms, resolvePublicUrl, resolveSiteLocales, resolveWorkspaceId, splitLocaleFromPath } from '@cmssy/core';
3
3
  import { createElement } from 'react';
4
4
  import { BlockErrorBoundary } from '@cmssy/react/block-error-boundary';
@@ -442,6 +442,7 @@ function CmssyBlock({
442
442
  patchedContent,
443
443
  patchedStyle,
444
444
  patchedAdvanced,
445
+ schema,
445
446
  editable,
446
447
  editMode,
447
448
  layoutPosition,
@@ -489,6 +490,7 @@ function CmssyBlock({
489
490
  }
490
491
  const base = getBlockContentForLanguage(block.content, locale, defaultLocale);
491
492
  const content = patchedContent ? { ...base, ...patchedContent } : base;
493
+ if (schema) normalizeRelationContent(content, schema);
492
494
  const style = patchedStyle ? { ...asBucket(block.style), ...patchedStyle } : asBucket(block.style);
493
495
  const advanced = patchedAdvanced ? { ...asBucket(block.advanced), ...patchedAdvanced } : asBucket(block.advanced);
494
496
  return wrap(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cmssy/react",
3
- "version": "9.6.0",
3
+ "version": "9.6.1",
4
4
  "description": "React blocks, renderers, data client and editor bridge for cmssy headless sites",
5
5
  "keywords": [
6
6
  "cmssy",
@@ -62,7 +62,7 @@
62
62
  },
63
63
  "dependencies": {
64
64
  "@cmssy/types": "0.29.0",
65
- "@cmssy/core": "9.6.0"
65
+ "@cmssy/core": "9.6.1"
66
66
  },
67
67
  "scripts": {
68
68
  "build": "tsup",