@uniformdev/canvas-next 18.24.1-alpha.2 → 18.26.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.esm.js +5 -0
- package/dist/index.js +5 -0
- package/dist/index.mjs +5 -0
- package/dist/project-map/index.d.ts +3 -3
- package/dist/project-map/index.js +27 -25
- package/dist/project-map/index.mjs +27 -25
- package/dist/slug/index.js +20 -20
- package/dist/slug/index.mjs +20 -20
- package/package.json +5 -5
package/dist/index.esm.js
CHANGED
|
@@ -91,6 +91,11 @@ var createPreviewHandler = ({ secret, enhance, resolveFullPath } = {}) => async
|
|
|
91
91
|
return createPreviewHandlerGet({ secret, resolveFullPath })(req, res);
|
|
92
92
|
} else if (method === "post") {
|
|
93
93
|
return createPreviewHandlerPost({ secret, enhance })(req, res);
|
|
94
|
+
} else if (method === "options") {
|
|
95
|
+
res.setHeader("Access-Control-Allow-Origin", "*");
|
|
96
|
+
res.setHeader("Access-Control-Allow-Headers", "Origin, Content-Type, Accept");
|
|
97
|
+
res.setHeader("Access-Control-Allow-Methods", "GET");
|
|
98
|
+
return res.status(204);
|
|
94
99
|
}
|
|
95
100
|
return res.status(501).json({ message: `Method "${method}" not implemented` });
|
|
96
101
|
};
|
package/dist/index.js
CHANGED
|
@@ -126,6 +126,11 @@ var createPreviewHandler = ({ secret, enhance, resolveFullPath } = {}) => async
|
|
|
126
126
|
return createPreviewHandlerGet({ secret, resolveFullPath })(req, res);
|
|
127
127
|
} else if (method === "post") {
|
|
128
128
|
return createPreviewHandlerPost({ secret, enhance })(req, res);
|
|
129
|
+
} else if (method === "options") {
|
|
130
|
+
res.setHeader("Access-Control-Allow-Origin", "*");
|
|
131
|
+
res.setHeader("Access-Control-Allow-Headers", "Origin, Content-Type, Accept");
|
|
132
|
+
res.setHeader("Access-Control-Allow-Methods", "GET");
|
|
133
|
+
return res.status(204);
|
|
129
134
|
}
|
|
130
135
|
return res.status(501).json({ message: `Method "${method}" not implemented` });
|
|
131
136
|
};
|
package/dist/index.mjs
CHANGED
|
@@ -91,6 +91,11 @@ var createPreviewHandler = ({ secret, enhance, resolveFullPath } = {}) => async
|
|
|
91
91
|
return createPreviewHandlerGet({ secret, resolveFullPath })(req, res);
|
|
92
92
|
} else if (method === "post") {
|
|
93
93
|
return createPreviewHandlerPost({ secret, enhance })(req, res);
|
|
94
|
+
} else if (method === "options") {
|
|
95
|
+
res.setHeader("Access-Control-Allow-Origin", "*");
|
|
96
|
+
res.setHeader("Access-Control-Allow-Headers", "Origin, Content-Type, Accept");
|
|
97
|
+
res.setHeader("Access-Control-Allow-Methods", "GET");
|
|
98
|
+
return res.status(204);
|
|
94
99
|
}
|
|
95
100
|
return res.status(501).json({ message: `Method "${method}" not implemented` });
|
|
96
101
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { c as UniformGetServerSideProps, a as UniformPreviewData, b as UniformGetStaticProps } from '../models-6ff72d91.js';
|
|
2
1
|
import * as next from 'next';
|
|
3
2
|
import { GetServerSidePropsContext, PreviewData, GetServerSideProps, GetStaticPropsContext, GetStaticProps } from 'next';
|
|
3
|
+
import { c as UniformGetServerSideProps, a as UniformPreviewData, b as UniformGetStaticProps } from '../models-6ff72d91.js';
|
|
4
4
|
import * as querystring from 'querystring';
|
|
5
5
|
import { ParsedUrlQuery } from 'querystring';
|
|
6
6
|
import * as _uniformdev_canvas from '@uniformdev/canvas';
|
|
@@ -34,7 +34,7 @@ declare const withUniformGetServerSideProps: <TProps extends {
|
|
|
34
34
|
} & Required<Pick<_uniformdev_canvas.CompositionGetParameters, "projectMapNodePath">> & _uniformdev_canvas.SpecificProjectMap & DataResolutionOption> | undefined;
|
|
35
35
|
/** Custom handler to specify return value and modify composition - e.g. enhance with CMS data */
|
|
36
36
|
callback?: UniformGetServerSideProps<TProps, ParsedUrlQuery, PreviewData> | undefined;
|
|
37
|
-
} | undefined) => GetServerSideProps<TProps, ParsedUrlQuery,
|
|
37
|
+
} | undefined) => GetServerSideProps<TProps, ParsedUrlQuery, UniformPreviewData>;
|
|
38
38
|
|
|
39
39
|
declare const withUniformGetStaticPaths: (options?: {
|
|
40
40
|
projectMapId?: string | undefined;
|
|
@@ -100,7 +100,7 @@ declare const withUniformGetStaticProps: <TProps extends {
|
|
|
100
100
|
|
|
101
101
|
declare const getServerSideProps: next.GetServerSideProps<{
|
|
102
102
|
[key: string]: any;
|
|
103
|
-
}, querystring.ParsedUrlQuery,
|
|
103
|
+
}, querystring.ParsedUrlQuery, UniformPreviewData>;
|
|
104
104
|
/** Ready to go getStaticProps for dynamic route with 'path' param for [[...path]].jsx */
|
|
105
105
|
declare const getStaticProps: next.GetStaticProps<{
|
|
106
106
|
[key: string]: any;
|
|
@@ -40,25 +40,27 @@ var withUniformGetServerSideProps = (options) => {
|
|
|
40
40
|
projectId: process.env.UNIFORM_PROJECT_ID,
|
|
41
41
|
apiHost: process.env.UNIFORM_CLI_BASE_URL
|
|
42
42
|
});
|
|
43
|
-
const
|
|
43
|
+
const { preview, previewData } = context;
|
|
44
44
|
let composition = void 0;
|
|
45
45
|
let nodePath = (options == null ? void 0 : options.prefix) ? context.resolvedUrl.replace(new RegExp(`^${options.prefix}`), "") : context.resolvedUrl;
|
|
46
46
|
if (options == null ? void 0 : options.modifyPath) {
|
|
47
47
|
nodePath = options.modifyPath(nodePath, context);
|
|
48
48
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
49
|
+
if (!(previewData == null ? void 0 : previewData.isUniformContextualEditing)) {
|
|
50
|
+
try {
|
|
51
|
+
const response = await canvasClient.getCompositionByNodePath({
|
|
52
|
+
...options == null ? void 0 : options.requestOptions,
|
|
53
|
+
projectMapId,
|
|
54
|
+
projectMapNodePath: nodePath,
|
|
55
|
+
state: preview || (options == null ? void 0 : options.preview) ? import_canvas.CANVAS_DRAFT_STATE : import_canvas.CANVAS_PUBLISHED_STATE
|
|
56
|
+
});
|
|
57
|
+
composition = response.composition;
|
|
58
|
+
} catch (e) {
|
|
59
|
+
console.error("[canvas-next] Failed to fetch composition", e);
|
|
60
|
+
return {
|
|
61
|
+
notFound: true
|
|
62
|
+
};
|
|
63
|
+
}
|
|
62
64
|
}
|
|
63
65
|
const ret = (options == null ? void 0 : options.callback) ? await options.callback(context, composition) : { props: {} };
|
|
64
66
|
if (Object.hasOwn(ret, "props")) {
|
|
@@ -131,17 +133,17 @@ var withUniformGetStaticProps = (options) => {
|
|
|
131
133
|
});
|
|
132
134
|
const { preview, previewData } = context;
|
|
133
135
|
let composition = void 0;
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
136
|
+
if (!(previewData == null ? void 0 : previewData.isUniformContextualEditing)) {
|
|
137
|
+
try {
|
|
138
|
+
const response = await canvasClient.getCompositionByNodePath({
|
|
139
|
+
...options == null ? void 0 : options.requestOptions,
|
|
140
|
+
projectMapId,
|
|
141
|
+
projectMapNodePath: pathString,
|
|
142
|
+
state: preview || (options == null ? void 0 : options.preview) ? import_canvas3.CANVAS_DRAFT_STATE : import_canvas3.CANVAS_PUBLISHED_STATE
|
|
143
|
+
});
|
|
144
|
+
composition = response.composition;
|
|
145
|
+
} catch (e) {
|
|
146
|
+
console.error("[canvas-next] Failed to fetch composition", e);
|
|
145
147
|
return {
|
|
146
148
|
notFound: true
|
|
147
149
|
};
|
|
@@ -17,25 +17,27 @@ var withUniformGetServerSideProps = (options) => {
|
|
|
17
17
|
projectId: process.env.UNIFORM_PROJECT_ID,
|
|
18
18
|
apiHost: process.env.UNIFORM_CLI_BASE_URL
|
|
19
19
|
});
|
|
20
|
-
const
|
|
20
|
+
const { preview, previewData } = context;
|
|
21
21
|
let composition = void 0;
|
|
22
22
|
let nodePath = (options == null ? void 0 : options.prefix) ? context.resolvedUrl.replace(new RegExp(`^${options.prefix}`), "") : context.resolvedUrl;
|
|
23
23
|
if (options == null ? void 0 : options.modifyPath) {
|
|
24
24
|
nodePath = options.modifyPath(nodePath, context);
|
|
25
25
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
26
|
+
if (!(previewData == null ? void 0 : previewData.isUniformContextualEditing)) {
|
|
27
|
+
try {
|
|
28
|
+
const response = await canvasClient.getCompositionByNodePath({
|
|
29
|
+
...options == null ? void 0 : options.requestOptions,
|
|
30
|
+
projectMapId,
|
|
31
|
+
projectMapNodePath: nodePath,
|
|
32
|
+
state: preview || (options == null ? void 0 : options.preview) ? CANVAS_DRAFT_STATE : CANVAS_PUBLISHED_STATE
|
|
33
|
+
});
|
|
34
|
+
composition = response.composition;
|
|
35
|
+
} catch (e) {
|
|
36
|
+
console.error("[canvas-next] Failed to fetch composition", e);
|
|
37
|
+
return {
|
|
38
|
+
notFound: true
|
|
39
|
+
};
|
|
40
|
+
}
|
|
39
41
|
}
|
|
40
42
|
const ret = (options == null ? void 0 : options.callback) ? await options.callback(context, composition) : { props: {} };
|
|
41
43
|
if (Object.hasOwn(ret, "props")) {
|
|
@@ -102,17 +104,17 @@ var withUniformGetStaticProps = (options) => {
|
|
|
102
104
|
});
|
|
103
105
|
const { preview, previewData } = context;
|
|
104
106
|
let composition = void 0;
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
107
|
+
if (!(previewData == null ? void 0 : previewData.isUniformContextualEditing)) {
|
|
108
|
+
try {
|
|
109
|
+
const response = await canvasClient.getCompositionByNodePath({
|
|
110
|
+
...options == null ? void 0 : options.requestOptions,
|
|
111
|
+
projectMapId,
|
|
112
|
+
projectMapNodePath: pathString,
|
|
113
|
+
state: preview || (options == null ? void 0 : options.preview) ? CANVAS_DRAFT_STATE3 : CANVAS_PUBLISHED_STATE3
|
|
114
|
+
});
|
|
115
|
+
composition = response.composition;
|
|
116
|
+
} catch (e) {
|
|
117
|
+
console.error("[canvas-next] Failed to fetch composition", e);
|
|
116
118
|
return {
|
|
117
119
|
notFound: true
|
|
118
120
|
};
|
package/dist/slug/index.js
CHANGED
|
@@ -44,16 +44,16 @@ var withUniformGetServerSideProps = (options) => {
|
|
|
44
44
|
if (options == null ? void 0 : options.modifySlug) {
|
|
45
45
|
slug = options.modifySlug(slug, context);
|
|
46
46
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
47
|
+
if (!(previewData == null ? void 0 : previewData.isUniformContextualEditing)) {
|
|
48
|
+
try {
|
|
49
|
+
const response = await canvasClient.getCompositionBySlug({
|
|
50
|
+
...options == null ? void 0 : options.requestOptions,
|
|
51
|
+
slug,
|
|
52
|
+
state: preview || (options == null ? void 0 : options.preview) ? import_canvas.CANVAS_DRAFT_STATE : import_canvas.CANVAS_PUBLISHED_STATE
|
|
53
|
+
});
|
|
54
|
+
composition = response.composition;
|
|
55
|
+
} catch (e) {
|
|
56
|
+
console.error("[canvas-next] Failed to fetch composition", e);
|
|
57
57
|
return {
|
|
58
58
|
notFound: true
|
|
59
59
|
};
|
|
@@ -125,16 +125,16 @@ var withUniformGetStaticProps = (options) => {
|
|
|
125
125
|
});
|
|
126
126
|
const { preview, previewData } = context;
|
|
127
127
|
let composition = void 0;
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
128
|
+
if (!(previewData == null ? void 0 : previewData.isUniformContextualEditing)) {
|
|
129
|
+
try {
|
|
130
|
+
const response = await canvasClient.getCompositionBySlug({
|
|
131
|
+
slug: slugString,
|
|
132
|
+
state: preview || (options == null ? void 0 : options.preview) ? import_canvas3.CANVAS_DRAFT_STATE : import_canvas3.CANVAS_PUBLISHED_STATE,
|
|
133
|
+
...options == null ? void 0 : options.requestOptions
|
|
134
|
+
});
|
|
135
|
+
composition = response.composition;
|
|
136
|
+
} catch (e) {
|
|
137
|
+
console.error("[canvas-next] Failed to fetch composition", e);
|
|
138
138
|
return {
|
|
139
139
|
notFound: true
|
|
140
140
|
};
|
package/dist/slug/index.mjs
CHANGED
|
@@ -21,16 +21,16 @@ var withUniformGetServerSideProps = (options) => {
|
|
|
21
21
|
if (options == null ? void 0 : options.modifySlug) {
|
|
22
22
|
slug = options.modifySlug(slug, context);
|
|
23
23
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
24
|
+
if (!(previewData == null ? void 0 : previewData.isUniformContextualEditing)) {
|
|
25
|
+
try {
|
|
26
|
+
const response = await canvasClient.getCompositionBySlug({
|
|
27
|
+
...options == null ? void 0 : options.requestOptions,
|
|
28
|
+
slug,
|
|
29
|
+
state: preview || (options == null ? void 0 : options.preview) ? CANVAS_DRAFT_STATE : CANVAS_PUBLISHED_STATE
|
|
30
|
+
});
|
|
31
|
+
composition = response.composition;
|
|
32
|
+
} catch (e) {
|
|
33
|
+
console.error("[canvas-next] Failed to fetch composition", e);
|
|
34
34
|
return {
|
|
35
35
|
notFound: true
|
|
36
36
|
};
|
|
@@ -98,16 +98,16 @@ var withUniformGetStaticProps = (options) => {
|
|
|
98
98
|
});
|
|
99
99
|
const { preview, previewData } = context;
|
|
100
100
|
let composition = void 0;
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
101
|
+
if (!(previewData == null ? void 0 : previewData.isUniformContextualEditing)) {
|
|
102
|
+
try {
|
|
103
|
+
const response = await canvasClient.getCompositionBySlug({
|
|
104
|
+
slug: slugString,
|
|
105
|
+
state: preview || (options == null ? void 0 : options.preview) ? CANVAS_DRAFT_STATE3 : CANVAS_PUBLISHED_STATE3,
|
|
106
|
+
...options == null ? void 0 : options.requestOptions
|
|
107
|
+
});
|
|
108
|
+
composition = response.composition;
|
|
109
|
+
} catch (e) {
|
|
110
|
+
console.error("[canvas-next] Failed to fetch composition", e);
|
|
111
111
|
return {
|
|
112
112
|
notFound: true
|
|
113
113
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/canvas-next",
|
|
3
|
-
"version": "18.
|
|
3
|
+
"version": "18.26.0",
|
|
4
4
|
"description": "Next.js SDK for Uniform Canvas",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -53,9 +53,9 @@
|
|
|
53
53
|
"document": "api-extractor run --local"
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@uniformdev/canvas": "18.
|
|
57
|
-
"@uniformdev/canvas-react": "18.
|
|
58
|
-
"@uniformdev/project-map": "18.
|
|
56
|
+
"@uniformdev/canvas": "18.26.0",
|
|
57
|
+
"@uniformdev/canvas-react": "18.26.0",
|
|
58
|
+
"@uniformdev/project-map": "18.26.0"
|
|
59
59
|
},
|
|
60
60
|
"peerDependencies": {
|
|
61
61
|
"next": ">= 12.0.0",
|
|
@@ -74,5 +74,5 @@
|
|
|
74
74
|
"publishConfig": {
|
|
75
75
|
"access": "public"
|
|
76
76
|
},
|
|
77
|
-
"gitHead": "
|
|
77
|
+
"gitHead": "776654d5b12c24cf597acd66cde039d6b0111419"
|
|
78
78
|
}
|