@uniformdev/canvas-next-rsc 19.50.0 → 19.51.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.
|
@@ -1,14 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
1
|
+
import { type PureUniformTextProps } from '@uniformdev/canvas-react/core';
|
|
2
|
+
import { CompositionContext } from './UniformComponent';
|
|
3
3
|
export type UniformTextProps = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
*/
|
|
8
|
-
as?: React.ElementType;
|
|
9
|
-
/** The ID of the parameter. */
|
|
10
|
-
parameterId: string;
|
|
11
|
-
/** The component instance. */
|
|
12
|
-
component: ComponentInstance;
|
|
13
|
-
} & Omit<React.HTMLAttributes<HTMLSpanElement>, 'children'>;
|
|
14
|
-
export declare const UniformText: ({ as: Tag, parameterId, component, ...rest }: UniformTextProps) => JSX.Element | null;
|
|
4
|
+
context: CompositionContext;
|
|
5
|
+
} & Omit<PureUniformTextProps, 'skipCustomRendering' | 'isContextualEditing'>;
|
|
6
|
+
export declare const UniformText: ({ context, ...rest }: UniformTextProps) => JSX.Element;
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
return _jsx(Tag, { ...rest, children: parameter.value });
|
|
2
|
+
import { PureUniformText } from '@uniformdev/canvas-react/core';
|
|
3
|
+
import { isIncontextEditingEnabled } from '../utils/draft';
|
|
4
|
+
export const UniformText = ({ context, ...rest }) => {
|
|
5
|
+
const isEditing = isIncontextEditingEnabled(context);
|
|
6
|
+
return _jsx(PureUniformText, { ...rest, isContextualEditing: isEditing, skipCustomRendering: isEditing });
|
|
9
7
|
};
|
|
@@ -2,6 +2,7 @@ import { CANVAS_PERSONALIZATION_PARAM, CANVAS_PERSONALIZE_TYPE, CANVAS_TEST_TYPE
|
|
|
2
2
|
import { Context, CookieTransitionDataStore, UNIFORM_DEFAULT_COOKIE_NAME, } from '@uniformdev/context';
|
|
3
3
|
import serverConfig from '../config/uniform.server.config';
|
|
4
4
|
import { serializeCookie } from '../score';
|
|
5
|
+
import { isIncontextEditingEnabled } from '../utils/draft';
|
|
5
6
|
import { getBaseUrl } from '../utils/url';
|
|
6
7
|
import { getEnrichmentTags } from './getEnrichmentTags';
|
|
7
8
|
import { resolvePath } from './resolvePath';
|
|
@@ -137,6 +138,25 @@ export const evaluateComposition = async ({ root, params, searchParams, dynamicI
|
|
|
137
138
|
}
|
|
138
139
|
}
|
|
139
140
|
});
|
|
141
|
+
// when we post compositions to CANVAS_EDITOR_STATE, we have to remove all
|
|
142
|
+
// contextual editing objects that have been attached to parameters in order
|
|
143
|
+
// to pass API validation. walk the composition and add them back in, assume
|
|
144
|
+
// everything is editable.
|
|
145
|
+
if (isIncontextEditingEnabled({ searchParams })) {
|
|
146
|
+
walkComponentTree(composition, (component) => {
|
|
147
|
+
if (component.parameters) {
|
|
148
|
+
const params = Object.keys(component.parameters);
|
|
149
|
+
params.forEach((key) => {
|
|
150
|
+
const param = component.parameters[key];
|
|
151
|
+
if (param.type === 'text' && typeof param._contextualEditing === 'undefined') {
|
|
152
|
+
param._contextualEditing = {
|
|
153
|
+
isEditable: true,
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
}
|
|
140
160
|
// if we've seen any enrichment tags, update the context with them
|
|
141
161
|
if (enrichmentTags.length) {
|
|
142
162
|
await context.update({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/canvas-next-rsc",
|
|
3
|
-
"version": "19.
|
|
3
|
+
"version": "19.51.0",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"dev": "pnpm build --watch",
|
|
@@ -56,13 +56,13 @@
|
|
|
56
56
|
"typescript": "^5.0.4"
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@uniformdev/canvas": "19.
|
|
60
|
-
"@uniformdev/canvas-react": "19.
|
|
61
|
-
"@uniformdev/context": "19.
|
|
62
|
-
"@uniformdev/project-map": "19.
|
|
63
|
-
"@uniformdev/redirect": "19.
|
|
64
|
-
"@uniformdev/richtext": "19.
|
|
65
|
-
"@uniformdev/webhooks": "19.
|
|
59
|
+
"@uniformdev/canvas": "19.51.0",
|
|
60
|
+
"@uniformdev/canvas-react": "19.51.0",
|
|
61
|
+
"@uniformdev/context": "19.51.0",
|
|
62
|
+
"@uniformdev/project-map": "19.51.0",
|
|
63
|
+
"@uniformdev/redirect": "19.51.0",
|
|
64
|
+
"@uniformdev/richtext": "19.51.0",
|
|
65
|
+
"@uniformdev/webhooks": "19.51.0",
|
|
66
66
|
"@vercel/edge-config": "^0.2.0",
|
|
67
67
|
"dequal": "^2.0.3",
|
|
68
68
|
"js-cookie": "^3.0.5",
|
|
@@ -76,5 +76,5 @@
|
|
|
76
76
|
"publishConfig": {
|
|
77
77
|
"access": "public"
|
|
78
78
|
},
|
|
79
|
-
"gitHead": "
|
|
79
|
+
"gitHead": "6169b3df00a64ebb66e4c4434cbf171e5cfbe6e4"
|
|
80
80
|
}
|