@uniformdev/canvas-next-rsc 19.54.2-alpha.3 → 19.54.3-alpha.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/routeClient.js +12 -1
- package/dist/components/UniformComponent.d.ts +2 -0
- package/dist/components/UniformComposition.js +5 -0
- package/dist/components/UniformText.js +1 -3
- package/dist/components/renderComponent.js +2 -1
- package/dist/components/retrieveRoute.js +2 -1
- package/dist/config/models.d.ts +4 -0
- package/dist/config.js +1 -1
- package/package.json +9 -9
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RouteClient } from '@uniformdev/canvas';
|
|
1
|
+
import { CANVAS_EDITOR_STATE, RouteClient } from '@uniformdev/canvas';
|
|
2
2
|
import { isDevelopmentEnvironment } from '../utils/draft';
|
|
3
3
|
import { buildPathTag } from '../utils/tag';
|
|
4
4
|
export const getRouteClient = (options) => {
|
|
@@ -18,10 +18,13 @@ export const getRouteClient = (options) => {
|
|
|
18
18
|
requestedUrl = new URL(req.url);
|
|
19
19
|
}
|
|
20
20
|
const tags = [];
|
|
21
|
+
let state;
|
|
21
22
|
if (requestedUrl) {
|
|
22
23
|
// this is here so this code breaks if parameters change here
|
|
23
24
|
const pathKey = 'path';
|
|
25
|
+
const stateKey = 'state';
|
|
24
26
|
const path = requestedUrl.searchParams.get(pathKey);
|
|
27
|
+
state = parseInt(requestedUrl.searchParams.get(stateKey) || '', 10);
|
|
25
28
|
if (path) {
|
|
26
29
|
// at this point, we do not know if this path is dynamic or not
|
|
27
30
|
// so apply each segment as a tag so we can clear any segment, ie:
|
|
@@ -43,6 +46,10 @@ export const getRouteClient = (options) => {
|
|
|
43
46
|
noCache = true;
|
|
44
47
|
revalidate = undefined;
|
|
45
48
|
}
|
|
49
|
+
const extraHeaders = {};
|
|
50
|
+
if (state === CANVAS_EDITOR_STATE) {
|
|
51
|
+
extraHeaders['x-bypass-cache'] = 'true';
|
|
52
|
+
}
|
|
46
53
|
return fetch(req, {
|
|
47
54
|
...init,
|
|
48
55
|
cache: noCache ? 'no-cache' : 'force-cache',
|
|
@@ -50,6 +57,10 @@ export const getRouteClient = (options) => {
|
|
|
50
57
|
revalidate,
|
|
51
58
|
tags: tags.length ? tags : undefined,
|
|
52
59
|
},
|
|
60
|
+
headers: {
|
|
61
|
+
...((init === null || init === void 0 ? void 0 : init.headers) || {}),
|
|
62
|
+
...extraHeaders,
|
|
63
|
+
},
|
|
53
64
|
});
|
|
54
65
|
},
|
|
55
66
|
});
|
|
@@ -8,6 +8,8 @@ export type CompositionContext = Omit<RouteGetResponseComposition, 'compositionA
|
|
|
8
8
|
[key: string]: string | undefined;
|
|
9
9
|
} | undefined;
|
|
10
10
|
cookieValue: string | undefined;
|
|
11
|
+
isDraftMode: boolean;
|
|
12
|
+
isContextualEditing: boolean;
|
|
11
13
|
};
|
|
12
14
|
export type ComponentProps<TProps = unknown> = TProps & {
|
|
13
15
|
component: ComponentInstance;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Suspense } from 'react';
|
|
3
|
+
import { isDraftModeEnabled, isIncontextEditingEnabled } from '../utils/draft';
|
|
3
4
|
import { resolveComposition } from './retrieveRoute';
|
|
4
5
|
import { UniformComponent } from './UniformComponent';
|
|
5
6
|
import { UniformProvider } from './UniformContext';
|
|
@@ -24,6 +25,10 @@ const UniformCompositionInner = async ({ params, searchParams, update, children,
|
|
|
24
25
|
path,
|
|
25
26
|
searchParams,
|
|
26
27
|
cookieValue,
|
|
28
|
+
isDraftMode: isDraftModeEnabled({ searchParams }),
|
|
29
|
+
isContextualEditing: isIncontextEditingEnabled({
|
|
30
|
+
searchParams,
|
|
31
|
+
}),
|
|
27
32
|
...rest,
|
|
28
33
|
};
|
|
29
34
|
return (_jsxs(UniformProvider, { cookieValue: cookieValue, seenComponents: seenComponents, children: [_jsx(UniformScript, { enabled: isCanvasEditing }), _jsx(UniformComponent, { data: evaluatedComposition, context: context }), Boolean(children) && children] }));
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { PureUniformText } from '@uniformdev/canvas-react/core';
|
|
3
|
-
import { isIncontextEditingEnabled } from '../utils/draft';
|
|
4
3
|
export const UniformText = ({ context, ...rest }) => {
|
|
5
|
-
|
|
6
|
-
return _jsx(PureUniformText, { ...rest, isContextualEditing: isEditing, skipCustomRendering: isEditing });
|
|
4
|
+
return (_jsx(PureUniformText, { ...rest, isContextualEditing: context.isContextualEditing, skipCustomRendering: context.isContextualEditing }));
|
|
7
5
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { CANVAS_LOCALE_TAG_PARAM, CANVAS_PERSONALIZE_SLOT, CANVAS_PERSONALIZE_TYPE, CANVAS_TEST_SLOT, CANVAS_TEST_TYPE, IN_CONTEXT_EDITOR_COMPONENT_START_ROLE, PLACEHOLDER_ID, } from '@uniformdev/canvas';
|
|
3
3
|
import { componentStoreResolver } from '../register/componentStoreResolver';
|
|
4
|
+
import { isIncontextEditingEnabled } from '../utils/draft';
|
|
4
5
|
import { convertComponentToProps } from './convertComponentToProps';
|
|
5
6
|
import { UniformComponent } from './UniformComponent';
|
|
6
7
|
export function renderComponent({ component, context, resolveSystem, key = 0, indexInSlot, slotName, parentComponent, slotChildrenCount, emptyPlaceholder, }) {
|
|
@@ -42,7 +43,7 @@ export function renderComponent({ component, context, resolveSystem, key = 0, in
|
|
|
42
43
|
component,
|
|
43
44
|
context,
|
|
44
45
|
});
|
|
45
|
-
const shouldRenderContextualEditingTags = Boolean(component._id);
|
|
46
|
+
const shouldRenderContextualEditingTags = Boolean(component._id) && isIncontextEditingEnabled(context);
|
|
46
47
|
const isPlaceholder = component._id === PLACEHOLDER_ID;
|
|
47
48
|
const isReadOnly = ((_a = component === null || component === void 0 ? void 0 : component._contextualEditing) === null || _a === void 0 ? void 0 : _a.isEditable)
|
|
48
49
|
? undefined
|
|
@@ -130,6 +130,7 @@ const resolveRouteByEdgeConfig = async (data) => {
|
|
|
130
130
|
return edgeConfig;
|
|
131
131
|
};
|
|
132
132
|
const resolveRouteByRouteApi = async (data) => {
|
|
133
|
+
var _a;
|
|
133
134
|
const routeClient = getRouteClient({
|
|
134
135
|
revalidate: getRouteRevalidateInterval({
|
|
135
136
|
searchParams: data.searchParams,
|
|
@@ -139,7 +140,7 @@ const resolveRouteByRouteApi = async (data) => {
|
|
|
139
140
|
path: data.path,
|
|
140
141
|
state: data.state,
|
|
141
142
|
withComponentIDs: data.state === CANVAS_DRAFT_STATE || data.state === CANVAS_EDITOR_STATE,
|
|
142
|
-
withContentSourceMap: isOnVercelPreviewEnvironment(),
|
|
143
|
+
withContentSourceMap: isOnVercelPreviewEnvironment() && ((_a = getServerConfig().experimental) === null || _a === void 0 ? void 0 : _a.vercelVisualEditing),
|
|
143
144
|
});
|
|
144
145
|
return routeResult;
|
|
145
146
|
};
|
package/dist/config/models.d.ts
CHANGED
package/dist/config.js
CHANGED
|
@@ -21,7 +21,7 @@ module.exports.withUniformConfig = (nextConfig) => ({
|
|
|
21
21
|
config.module.rules.push({
|
|
22
22
|
test: /uniform\.server\.config\.js$/,
|
|
23
23
|
include: uniformConfigPath,
|
|
24
|
-
use: context.defaultLoaders.babel,
|
|
24
|
+
use: context.defaultLoaders.babel,
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
27
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/canvas-next-rsc",
|
|
3
|
-
"version": "19.54.
|
|
3
|
+
"version": "19.54.3-alpha.1+c169f04b0",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"dev": "tsc --watch",
|
|
@@ -55,13 +55,13 @@
|
|
|
55
55
|
"react-dom": "18.2.0"
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {
|
|
58
|
-
"@uniformdev/canvas": "19.54.
|
|
59
|
-
"@uniformdev/canvas-react": "19.54.
|
|
60
|
-
"@uniformdev/context": "19.54.
|
|
61
|
-
"@uniformdev/project-map": "19.54.
|
|
62
|
-
"@uniformdev/redirect": "19.54.
|
|
63
|
-
"@uniformdev/richtext": "19.54.
|
|
64
|
-
"@uniformdev/webhooks": "19.54.
|
|
58
|
+
"@uniformdev/canvas": "19.54.3-alpha.1+c169f04b0",
|
|
59
|
+
"@uniformdev/canvas-react": "19.54.3-alpha.1+c169f04b0",
|
|
60
|
+
"@uniformdev/context": "19.54.3-alpha.1+c169f04b0",
|
|
61
|
+
"@uniformdev/project-map": "19.54.3-alpha.1+c169f04b0",
|
|
62
|
+
"@uniformdev/redirect": "19.54.3-alpha.1+c169f04b0",
|
|
63
|
+
"@uniformdev/richtext": "19.54.3-alpha.1+c169f04b0",
|
|
64
|
+
"@uniformdev/webhooks": "19.54.3-alpha.1+c169f04b0",
|
|
65
65
|
"@vercel/edge-config": "^0.2.0",
|
|
66
66
|
"dequal": "^2.0.3",
|
|
67
67
|
"js-cookie": "^3.0.5",
|
|
@@ -78,5 +78,5 @@
|
|
|
78
78
|
"publishConfig": {
|
|
79
79
|
"access": "public"
|
|
80
80
|
},
|
|
81
|
-
"gitHead": "
|
|
81
|
+
"gitHead": "c169f04b0eaffb4956c91d3ca0a3ab0c44d64dd4"
|
|
82
82
|
}
|