Skip to content

Commit

Permalink
chore: merge in development
Browse files Browse the repository at this point in the history
  • Loading branch information
chasepoirier committed Feb 20, 2025
2 parents 265a3b3 + 53c66f8 commit 3eaa7f6
Show file tree
Hide file tree
Showing 19 changed files with 67 additions and 27 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [1.32.0](https://github.com/contentful/experience-builder/compare/v1.32.0-beta.0...v1.32.0) (2025-02-20)

**Note:** Version bump only for package @contentful/experience

## [1.31.1](https://github.com/contentful/experience-builder/compare/v1.31.1-beta.0...v1.31.1) (2025-02-19)

**Note:** Version bump only for package @contentful/experience
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
"npmClient": "npm",
"version": "1.31.1",
"version": "1.32.0",
"command": {
"version": {
"allowBranch": ["main", "next", "development"],
Expand Down
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [1.32.0](https://github.com/contentful/experience-builder/compare/v1.32.0-beta.0...v1.32.0) (2025-02-20)

**Note:** Version bump only for package @contentful/experiences-components-react

## [1.31.1](https://github.com/contentful/experience-builder/compare/v1.31.1-beta.0...v1.31.1) (2025-02-19)

**Note:** Version bump only for package @contentful/experiences-components-react
Expand Down
2 changes: 1 addition & 1 deletion packages/components/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@contentful/experiences-components-react",
"version": "1.31.1",
"version": "1.32.0",
"description": "A basic set of components to use with Studio Experiences",
"homepage": "https://github.com/contentful/experience-builder/tree/next/packages/components#readme",
"repository": {
Expand Down
4 changes: 4 additions & 0 deletions packages/core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [1.32.0](https://github.com/contentful/experience-builder/compare/v1.32.0-beta.0...v1.32.0) (2025-02-20)

**Note:** Version bump only for package @contentful/experiences-core

## [1.31.1](https://github.com/contentful/experience-builder/compare/v1.31.1-beta.0...v1.31.1) (2025-02-19)

**Note:** Version bump only for package @contentful/experiences-core
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@contentful/experiences-core",
"version": "1.31.1",
"version": "1.32.0",
"description": "",
"main": "dist/index.js",
"module": "dist/index.js",
Expand Down
5 changes: 5 additions & 0 deletions packages/core/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,11 @@ export type ComponentRegistration = {
component: React.ElementType;
definition: ComponentDefinition;
options?: {
/**
* If true, the component receives the optional boolean property `isInExpEditorMode` to
* render different content between editor and delivery mode.
*/
enableCustomEditorView?: boolean;
wrapComponent?: boolean;
/** @deprecated use wrapContainer instead */
wrapContainerTag?: keyof JSX.IntrinsicElements;
Expand Down
4 changes: 4 additions & 0 deletions packages/create-contentful-studio-experiences/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [1.32.0](https://github.com/contentful/experience-builder/compare/v1.32.0-beta.0...v1.32.0) (2025-02-20)

**Note:** Version bump only for package create-contentful-studio-experiences

## [1.31.1](https://github.com/contentful/experience-builder/compare/v1.31.1-beta.0...v1.31.1) (2025-02-19)

**Note:** Version bump only for package create-contentful-studio-experiences
Expand Down
2 changes: 1 addition & 1 deletion packages/create-contentful-studio-experiences/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "create-contentful-studio-experiences",
"version": "1.31.1",
"version": "1.32.0",
"description": "A CLI tool to get up and running with Contentful Studio Experiences quickly",
"homepage": "https://github.com/contentful/experience-builder/tree/next/packages/create-contentful-studio-experiences#readme",
"repository": {
Expand Down
4 changes: 4 additions & 0 deletions packages/experience-builder-sdk/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [1.32.0](https://github.com/contentful/experience-builder/compare/v1.32.0-beta.0...v1.32.0) (2025-02-20)

**Note:** Version bump only for package @contentful/experiences-sdk-react

## [1.31.1](https://github.com/contentful/experience-builder/compare/v1.31.1-beta.0...v1.31.1) (2025-02-19)

**Note:** Version bump only for package @contentful/experiences-sdk-react
Expand Down
2 changes: 1 addition & 1 deletion packages/experience-builder-sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@contentful/experiences-sdk-react",
"version": "1.31.1",
"version": "1.32.0",
"main": "./dist/index.js",
"module": "./dist/index.js",
"typings": "./dist/src/index.d.ts",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,6 @@ describe('withComponentWrapper', () => {
describe('when component is wrapped', () => {
const WrappedButton = withComponentWrapper(MyButton);

it('can wrap a component with a custom tag', () => {
const WrappedButtonSpan = withComponentWrapper(MyButton, { wrapContainerTag: 'span' });

const { container } = render(
<WrappedButtonSpan className="my-span">Click me</WrappedButtonSpan>,
);

expect(container.firstChild).toHaveClass('my-span');
expect(container.firstChild).toHaveTextContent('Click me');
});

it('classes get added to the correct elements', () => {
const { container, getByRole } = render(
<WrappedButton
Expand Down
4 changes: 4 additions & 0 deletions packages/validators/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [1.32.0](https://github.com/contentful/experience-builder/compare/v1.32.0-beta.0...v1.32.0) (2025-02-20)

**Note:** Version bump only for package @contentful/experiences-validators

## [1.31.1](https://github.com/contentful/experience-builder/compare/v1.31.1-beta.0...v1.31.1) (2025-02-19)

**Note:** Version bump only for package @contentful/experiences-validators
Expand Down
2 changes: 1 addition & 1 deletion packages/validators/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@contentful/experiences-validators",
"version": "1.31.1",
"version": "1.32.0",
"main": "./dist/index.js",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
Expand Down
4 changes: 4 additions & 0 deletions packages/visual-editor/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [1.32.0](https://github.com/contentful/experience-builder/compare/v1.32.0-beta.0...v1.32.0) (2025-02-20)

**Note:** Version bump only for package @contentful/experiences-visual-editor-react

## [1.31.1](https://github.com/contentful/experience-builder/compare/v1.31.1-beta.0...v1.31.1) (2025-02-19)

**Note:** Version bump only for package @contentful/experiences-visual-editor-react
Expand Down
2 changes: 1 addition & 1 deletion packages/visual-editor/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@contentful/experiences-visual-editor-react",
"version": "1.31.1",
"version": "1.32.0",
"type": "module",
"main": "./dist/index.js",
"module": "./dist/index.js",
Expand Down
20 changes: 18 additions & 2 deletions packages/visual-editor/src/hooks/useComponentProps.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ describe('useComponentProps', () => {
},
);

it('should return isInExpEditorMode as true for custom components', () => {
it('should return isInExpEditorMode as true for custom components when flag is enabled', () => {
const { result } = renderHook(() =>
useComponentProps({
node,
Expand All @@ -333,13 +333,29 @@ describe('useComponentProps', () => {
renderDropzone,
definition,
userIsDragging,
options: { wrapComponent: false },
options: { wrapComponent: false, enableCustomEditorView: true },
}),
);

expect(result.current.componentProps.isInExpEditorMode).toBe(true);
});

it('should not return isInExpEditorMode when the flag is not enabled', () => {
const { result } = renderHook(() =>
useComponentProps({
node,
areEntitiesFetched,
resolveDesignValue,
renderDropzone,
definition,
userIsDragging,
options: { wrapComponent: false },
}),
);

expect(result.current.componentProps.isInExpEditorMode).toBeUndefined();
});

it('should return unbound values in componentProps for structural components', () => {
vi.mock('@/store/editor', () => ({
useEditorStore: () => ({
Expand Down
4 changes: 3 additions & 1 deletion packages/visual-editor/src/hooks/useComponentProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,9 @@ export const useComponentProps = ({

const customComponentProps: ResolvedComponentProps = {
...sharedProps,
isInExpEditorMode: true,
// Allows custom components to render differently in the editor. This needs to be activated
// through options as the component has to be aware of this prop to not cause any React warnings.
...(options?.enableCustomEditorView ? { isInExpEditorMode: true } : {}),
...sanitizeNodeProps(props),
};

Expand Down

0 comments on commit 3eaa7f6

Please sign in to comment.