@uniformdev/canvas-next 19.55.1-alpha.8 → 19.55.2-alpha.14
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/{chunk-6IDBHA5X.mjs → chunk-JQWYBVLI.mjs} +1 -2
- package/dist/{chunk-23O4NSDU.mjs → chunk-ZLQ2WCJC.mjs} +1 -1
- package/dist/index.esm.js +42 -15
- package/dist/index.js +42 -16
- package/dist/index.mjs +42 -15
- package/dist/project-map/index.js +1 -2
- package/dist/project-map/index.mjs +2 -2
- package/dist/route/index.js +8 -9
- package/dist/route/index.mjs +11 -11
- package/dist/slug/index.js +1 -2
- package/dist/slug/index.mjs +1 -1
- package/package.json +10 -10
|
@@ -4,11 +4,10 @@ import { white as white2 } from "colorette";
|
|
|
4
4
|
// src/logging/logCompositionIssues.ts
|
|
5
5
|
import { gray, green, italic, red, white, yellow } from "colorette";
|
|
6
6
|
function logCompositionIssues(prefix, issues, colour = "red") {
|
|
7
|
-
const reversedIssues = [...issues].reverse();
|
|
8
7
|
const colours = { red, green, yellow, white };
|
|
9
8
|
console.error(
|
|
10
9
|
`${colours[colour](prefix)}
|
|
11
|
-
${
|
|
10
|
+
${issues.map(
|
|
12
11
|
(issue) => `${colours[colour](">")} ${italic(gray(indent(issue.type.toUpperCase(), 7)))} ${renderIssue(issue)}`
|
|
13
12
|
).join("\n")}`
|
|
14
13
|
);
|
package/dist/index.esm.js
CHANGED
|
@@ -51,9 +51,11 @@ var UniformRichTextNode = ({
|
|
|
51
51
|
// src/preview/previewHandlerGet.ts
|
|
52
52
|
import {
|
|
53
53
|
IN_CONTEXT_EDITOR_PLAYGROUND_QUERY_STRING_PARAM,
|
|
54
|
-
IN_CONTEXT_EDITOR_QUERY_STRING_PARAM
|
|
54
|
+
IN_CONTEXT_EDITOR_QUERY_STRING_PARAM,
|
|
55
|
+
SECRET_QUERY_STRING_PARAM
|
|
55
56
|
} from "@uniformdev/canvas";
|
|
56
|
-
|
|
57
|
+
import { isAllowedReferrer } from "@uniformdev/canvas";
|
|
58
|
+
var BASE_URL_EXAMPLE = "https://example.com";
|
|
57
59
|
var getQueryParam = (req, paramName) => {
|
|
58
60
|
const value = req.query[paramName];
|
|
59
61
|
if (typeof value === "undefined") {
|
|
@@ -61,10 +63,16 @@ var getQueryParam = (req, paramName) => {
|
|
|
61
63
|
}
|
|
62
64
|
return Array.isArray(value) ? value[0] : value;
|
|
63
65
|
};
|
|
64
|
-
var
|
|
66
|
+
var contextualEditingQueryParams = [
|
|
65
67
|
IN_CONTEXT_EDITOR_QUERY_STRING_PARAM,
|
|
66
68
|
IN_CONTEXT_EDITOR_PLAYGROUND_QUERY_STRING_PARAM
|
|
67
69
|
];
|
|
70
|
+
var compositionQueryParam = {
|
|
71
|
+
id: "id",
|
|
72
|
+
slug: "slug",
|
|
73
|
+
path: "path",
|
|
74
|
+
locale: "locale"
|
|
75
|
+
};
|
|
68
76
|
var createPreviewHandlerGet = ({ secret, resolveFullPath = resolveFullPathDefault, playgroundPath } = {}) => async (req, res) => {
|
|
69
77
|
const isConfigCheck = getQueryParam(req, "is_config_check") === "true";
|
|
70
78
|
if (isConfigCheck) {
|
|
@@ -81,10 +89,10 @@ var createPreviewHandlerGet = ({ secret, resolveFullPath = resolveFullPathDefaul
|
|
|
81
89
|
if (isPlayground && playgroundPath) {
|
|
82
90
|
pathToRedirectTo = playgroundPath;
|
|
83
91
|
}
|
|
84
|
-
const id = getQueryParam(req,
|
|
85
|
-
const slug = getQueryParam(req,
|
|
86
|
-
const path = getQueryParam(req,
|
|
87
|
-
const locale = getQueryParam(req,
|
|
92
|
+
const id = getQueryParam(req, compositionQueryParam.id);
|
|
93
|
+
const slug = getQueryParam(req, compositionQueryParam.slug);
|
|
94
|
+
const path = getQueryParam(req, compositionQueryParam.path);
|
|
95
|
+
const locale = getQueryParam(req, compositionQueryParam.locale);
|
|
88
96
|
if (typeof pathToRedirectTo === "undefined") {
|
|
89
97
|
pathToRedirectTo = resolveFullPath({ id, slug, path, locale });
|
|
90
98
|
}
|
|
@@ -99,10 +107,10 @@ var createPreviewHandlerGet = ({ secret, resolveFullPath = resolveFullPathDefaul
|
|
|
99
107
|
}
|
|
100
108
|
const previewSecret = typeof secret === "function" ? secret == null ? void 0 : secret() : secret;
|
|
101
109
|
const isUsingPreviewSecret = Boolean(previewSecret);
|
|
102
|
-
if (isUsingPreviewSecret && req.query
|
|
110
|
+
if (isUsingPreviewSecret && req.query[SECRET_QUERY_STRING_PARAM] !== previewSecret) {
|
|
103
111
|
return res.status(401).json({ message: "Invalid token" });
|
|
104
112
|
}
|
|
105
|
-
const isUniformContextualEditing = req.query[IN_CONTEXT_EDITOR_QUERY_STRING_PARAM] === "true";
|
|
113
|
+
const isUniformContextualEditing = req.query[IN_CONTEXT_EDITOR_QUERY_STRING_PARAM] === "true" && isAllowedReferrer(req.headers.referer);
|
|
106
114
|
res.setPreviewData(
|
|
107
115
|
{
|
|
108
116
|
isUniformContextualEditing,
|
|
@@ -126,12 +134,12 @@ var createPreviewHandlerGet = ({ secret, resolveFullPath = resolveFullPathDefaul
|
|
|
126
134
|
cookies == null ? void 0 : cookies.map((cookie) => cookie.replace("SameSite=Lax", "SameSite=None;Secure"))
|
|
127
135
|
);
|
|
128
136
|
const redirectionUrl = new URL(pathToRedirectTo, BASE_URL_EXAMPLE);
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
redirectionUrl.searchParams.
|
|
133
|
-
}
|
|
134
|
-
}
|
|
137
|
+
assignRequestQueryToSearchParams(redirectionUrl.searchParams, req.query);
|
|
138
|
+
if (!isUniformContextualEditing) {
|
|
139
|
+
contextualEditingQueryParams.forEach((param) => {
|
|
140
|
+
redirectionUrl.searchParams.delete(param);
|
|
141
|
+
});
|
|
142
|
+
}
|
|
135
143
|
const fullPathToRedirectTo = redirectionUrl.href.replace(BASE_URL_EXAMPLE, "");
|
|
136
144
|
res.redirect(fullPathToRedirectTo);
|
|
137
145
|
};
|
|
@@ -143,6 +151,25 @@ function validateLocalRedirectUrl(pathToRedirectTo) {
|
|
|
143
151
|
throw new Error("Tried to redirect to absolute URL with protocol. Disallowing open redirect.");
|
|
144
152
|
}
|
|
145
153
|
}
|
|
154
|
+
var assignRequestQueryToSearchParams = (searchParams, query) => {
|
|
155
|
+
const compositionQueryParamNames = Object.values(compositionQueryParam);
|
|
156
|
+
Object.entries(query).forEach(([name, value]) => {
|
|
157
|
+
if (name === SECRET_QUERY_STRING_PARAM) {
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
if (compositionQueryParamNames.includes(name)) {
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
if (typeof value === "undefined") {
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
if (typeof value === "object") {
|
|
167
|
+
value.forEach((singleValue) => searchParams.append(name, singleValue));
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
searchParams.append(name, value);
|
|
171
|
+
});
|
|
172
|
+
};
|
|
146
173
|
|
|
147
174
|
// src/preview/previewHandlerPost.ts
|
|
148
175
|
import { generateHash } from "@uniformdev/canvas";
|
package/dist/index.js
CHANGED
|
@@ -96,7 +96,8 @@ var resolveSlugFromParams = ({
|
|
|
96
96
|
|
|
97
97
|
// src/preview/previewHandlerGet.ts
|
|
98
98
|
var import_canvas = require("@uniformdev/canvas");
|
|
99
|
-
var
|
|
99
|
+
var import_canvas2 = require("@uniformdev/canvas");
|
|
100
|
+
var BASE_URL_EXAMPLE = "https://example.com";
|
|
100
101
|
var getQueryParam = (req, paramName) => {
|
|
101
102
|
const value = req.query[paramName];
|
|
102
103
|
if (typeof value === "undefined") {
|
|
@@ -104,10 +105,16 @@ var getQueryParam = (req, paramName) => {
|
|
|
104
105
|
}
|
|
105
106
|
return Array.isArray(value) ? value[0] : value;
|
|
106
107
|
};
|
|
107
|
-
var
|
|
108
|
+
var contextualEditingQueryParams = [
|
|
108
109
|
import_canvas.IN_CONTEXT_EDITOR_QUERY_STRING_PARAM,
|
|
109
110
|
import_canvas.IN_CONTEXT_EDITOR_PLAYGROUND_QUERY_STRING_PARAM
|
|
110
111
|
];
|
|
112
|
+
var compositionQueryParam = {
|
|
113
|
+
id: "id",
|
|
114
|
+
slug: "slug",
|
|
115
|
+
path: "path",
|
|
116
|
+
locale: "locale"
|
|
117
|
+
};
|
|
111
118
|
var createPreviewHandlerGet = ({ secret, resolveFullPath = resolveFullPathDefault, playgroundPath } = {}) => async (req, res) => {
|
|
112
119
|
const isConfigCheck = getQueryParam(req, "is_config_check") === "true";
|
|
113
120
|
if (isConfigCheck) {
|
|
@@ -124,10 +131,10 @@ var createPreviewHandlerGet = ({ secret, resolveFullPath = resolveFullPathDefaul
|
|
|
124
131
|
if (isPlayground && playgroundPath) {
|
|
125
132
|
pathToRedirectTo = playgroundPath;
|
|
126
133
|
}
|
|
127
|
-
const id = getQueryParam(req,
|
|
128
|
-
const slug = getQueryParam(req,
|
|
129
|
-
const path = getQueryParam(req,
|
|
130
|
-
const locale = getQueryParam(req,
|
|
134
|
+
const id = getQueryParam(req, compositionQueryParam.id);
|
|
135
|
+
const slug = getQueryParam(req, compositionQueryParam.slug);
|
|
136
|
+
const path = getQueryParam(req, compositionQueryParam.path);
|
|
137
|
+
const locale = getQueryParam(req, compositionQueryParam.locale);
|
|
131
138
|
if (typeof pathToRedirectTo === "undefined") {
|
|
132
139
|
pathToRedirectTo = resolveFullPath({ id, slug, path, locale });
|
|
133
140
|
}
|
|
@@ -142,10 +149,10 @@ var createPreviewHandlerGet = ({ secret, resolveFullPath = resolveFullPathDefaul
|
|
|
142
149
|
}
|
|
143
150
|
const previewSecret = typeof secret === "function" ? secret == null ? void 0 : secret() : secret;
|
|
144
151
|
const isUsingPreviewSecret = Boolean(previewSecret);
|
|
145
|
-
if (isUsingPreviewSecret && req.query.
|
|
152
|
+
if (isUsingPreviewSecret && req.query[import_canvas.SECRET_QUERY_STRING_PARAM] !== previewSecret) {
|
|
146
153
|
return res.status(401).json({ message: "Invalid token" });
|
|
147
154
|
}
|
|
148
|
-
const isUniformContextualEditing = req.query[import_canvas.IN_CONTEXT_EDITOR_QUERY_STRING_PARAM] === "true";
|
|
155
|
+
const isUniformContextualEditing = req.query[import_canvas.IN_CONTEXT_EDITOR_QUERY_STRING_PARAM] === "true" && (0, import_canvas2.isAllowedReferrer)(req.headers.referer);
|
|
149
156
|
res.setPreviewData(
|
|
150
157
|
{
|
|
151
158
|
isUniformContextualEditing,
|
|
@@ -169,12 +176,12 @@ var createPreviewHandlerGet = ({ secret, resolveFullPath = resolveFullPathDefaul
|
|
|
169
176
|
cookies == null ? void 0 : cookies.map((cookie) => cookie.replace("SameSite=Lax", "SameSite=None;Secure"))
|
|
170
177
|
);
|
|
171
178
|
const redirectionUrl = new URL(pathToRedirectTo, BASE_URL_EXAMPLE);
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
redirectionUrl.searchParams.
|
|
176
|
-
}
|
|
177
|
-
}
|
|
179
|
+
assignRequestQueryToSearchParams(redirectionUrl.searchParams, req.query);
|
|
180
|
+
if (!isUniformContextualEditing) {
|
|
181
|
+
contextualEditingQueryParams.forEach((param) => {
|
|
182
|
+
redirectionUrl.searchParams.delete(param);
|
|
183
|
+
});
|
|
184
|
+
}
|
|
178
185
|
const fullPathToRedirectTo = redirectionUrl.href.replace(BASE_URL_EXAMPLE, "");
|
|
179
186
|
res.redirect(fullPathToRedirectTo);
|
|
180
187
|
};
|
|
@@ -186,9 +193,28 @@ function validateLocalRedirectUrl(pathToRedirectTo) {
|
|
|
186
193
|
throw new Error("Tried to redirect to absolute URL with protocol. Disallowing open redirect.");
|
|
187
194
|
}
|
|
188
195
|
}
|
|
196
|
+
var assignRequestQueryToSearchParams = (searchParams, query) => {
|
|
197
|
+
const compositionQueryParamNames = Object.values(compositionQueryParam);
|
|
198
|
+
Object.entries(query).forEach(([name, value]) => {
|
|
199
|
+
if (name === import_canvas.SECRET_QUERY_STRING_PARAM) {
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
if (compositionQueryParamNames.includes(name)) {
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
if (typeof value === "undefined") {
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
if (typeof value === "object") {
|
|
209
|
+
value.forEach((singleValue) => searchParams.append(name, singleValue));
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
searchParams.append(name, value);
|
|
213
|
+
});
|
|
214
|
+
};
|
|
189
215
|
|
|
190
216
|
// src/preview/previewHandlerPost.ts
|
|
191
|
-
var
|
|
217
|
+
var import_canvas3 = require("@uniformdev/canvas");
|
|
192
218
|
var createPreviewHandlerPost = ({ secret, enhance } = {}) => async (req, res) => {
|
|
193
219
|
const { composition, hash } = req.body;
|
|
194
220
|
if (!composition) {
|
|
@@ -198,7 +224,7 @@ var createPreviewHandlerPost = ({ secret, enhance } = {}) => async (req, res) =>
|
|
|
198
224
|
const hasProvidedHash = Boolean(hash);
|
|
199
225
|
const hasConfiguredHash = Boolean(previewSecret);
|
|
200
226
|
if (hasProvidedHash && hasConfiguredHash) {
|
|
201
|
-
const calculatedHash = (0,
|
|
227
|
+
const calculatedHash = (0, import_canvas3.generateHash)({
|
|
202
228
|
composition,
|
|
203
229
|
secret: previewSecret
|
|
204
230
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -51,9 +51,11 @@ var UniformRichTextNode = ({
|
|
|
51
51
|
// src/preview/previewHandlerGet.ts
|
|
52
52
|
import {
|
|
53
53
|
IN_CONTEXT_EDITOR_PLAYGROUND_QUERY_STRING_PARAM,
|
|
54
|
-
IN_CONTEXT_EDITOR_QUERY_STRING_PARAM
|
|
54
|
+
IN_CONTEXT_EDITOR_QUERY_STRING_PARAM,
|
|
55
|
+
SECRET_QUERY_STRING_PARAM
|
|
55
56
|
} from "@uniformdev/canvas";
|
|
56
|
-
|
|
57
|
+
import { isAllowedReferrer } from "@uniformdev/canvas";
|
|
58
|
+
var BASE_URL_EXAMPLE = "https://example.com";
|
|
57
59
|
var getQueryParam = (req, paramName) => {
|
|
58
60
|
const value = req.query[paramName];
|
|
59
61
|
if (typeof value === "undefined") {
|
|
@@ -61,10 +63,16 @@ var getQueryParam = (req, paramName) => {
|
|
|
61
63
|
}
|
|
62
64
|
return Array.isArray(value) ? value[0] : value;
|
|
63
65
|
};
|
|
64
|
-
var
|
|
66
|
+
var contextualEditingQueryParams = [
|
|
65
67
|
IN_CONTEXT_EDITOR_QUERY_STRING_PARAM,
|
|
66
68
|
IN_CONTEXT_EDITOR_PLAYGROUND_QUERY_STRING_PARAM
|
|
67
69
|
];
|
|
70
|
+
var compositionQueryParam = {
|
|
71
|
+
id: "id",
|
|
72
|
+
slug: "slug",
|
|
73
|
+
path: "path",
|
|
74
|
+
locale: "locale"
|
|
75
|
+
};
|
|
68
76
|
var createPreviewHandlerGet = ({ secret, resolveFullPath = resolveFullPathDefault, playgroundPath } = {}) => async (req, res) => {
|
|
69
77
|
const isConfigCheck = getQueryParam(req, "is_config_check") === "true";
|
|
70
78
|
if (isConfigCheck) {
|
|
@@ -81,10 +89,10 @@ var createPreviewHandlerGet = ({ secret, resolveFullPath = resolveFullPathDefaul
|
|
|
81
89
|
if (isPlayground && playgroundPath) {
|
|
82
90
|
pathToRedirectTo = playgroundPath;
|
|
83
91
|
}
|
|
84
|
-
const id = getQueryParam(req,
|
|
85
|
-
const slug = getQueryParam(req,
|
|
86
|
-
const path = getQueryParam(req,
|
|
87
|
-
const locale = getQueryParam(req,
|
|
92
|
+
const id = getQueryParam(req, compositionQueryParam.id);
|
|
93
|
+
const slug = getQueryParam(req, compositionQueryParam.slug);
|
|
94
|
+
const path = getQueryParam(req, compositionQueryParam.path);
|
|
95
|
+
const locale = getQueryParam(req, compositionQueryParam.locale);
|
|
88
96
|
if (typeof pathToRedirectTo === "undefined") {
|
|
89
97
|
pathToRedirectTo = resolveFullPath({ id, slug, path, locale });
|
|
90
98
|
}
|
|
@@ -99,10 +107,10 @@ var createPreviewHandlerGet = ({ secret, resolveFullPath = resolveFullPathDefaul
|
|
|
99
107
|
}
|
|
100
108
|
const previewSecret = typeof secret === "function" ? secret == null ? void 0 : secret() : secret;
|
|
101
109
|
const isUsingPreviewSecret = Boolean(previewSecret);
|
|
102
|
-
if (isUsingPreviewSecret && req.query
|
|
110
|
+
if (isUsingPreviewSecret && req.query[SECRET_QUERY_STRING_PARAM] !== previewSecret) {
|
|
103
111
|
return res.status(401).json({ message: "Invalid token" });
|
|
104
112
|
}
|
|
105
|
-
const isUniformContextualEditing = req.query[IN_CONTEXT_EDITOR_QUERY_STRING_PARAM] === "true";
|
|
113
|
+
const isUniformContextualEditing = req.query[IN_CONTEXT_EDITOR_QUERY_STRING_PARAM] === "true" && isAllowedReferrer(req.headers.referer);
|
|
106
114
|
res.setPreviewData(
|
|
107
115
|
{
|
|
108
116
|
isUniformContextualEditing,
|
|
@@ -126,12 +134,12 @@ var createPreviewHandlerGet = ({ secret, resolveFullPath = resolveFullPathDefaul
|
|
|
126
134
|
cookies == null ? void 0 : cookies.map((cookie) => cookie.replace("SameSite=Lax", "SameSite=None;Secure"))
|
|
127
135
|
);
|
|
128
136
|
const redirectionUrl = new URL(pathToRedirectTo, BASE_URL_EXAMPLE);
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
redirectionUrl.searchParams.
|
|
133
|
-
}
|
|
134
|
-
}
|
|
137
|
+
assignRequestQueryToSearchParams(redirectionUrl.searchParams, req.query);
|
|
138
|
+
if (!isUniformContextualEditing) {
|
|
139
|
+
contextualEditingQueryParams.forEach((param) => {
|
|
140
|
+
redirectionUrl.searchParams.delete(param);
|
|
141
|
+
});
|
|
142
|
+
}
|
|
135
143
|
const fullPathToRedirectTo = redirectionUrl.href.replace(BASE_URL_EXAMPLE, "");
|
|
136
144
|
res.redirect(fullPathToRedirectTo);
|
|
137
145
|
};
|
|
@@ -143,6 +151,25 @@ function validateLocalRedirectUrl(pathToRedirectTo) {
|
|
|
143
151
|
throw new Error("Tried to redirect to absolute URL with protocol. Disallowing open redirect.");
|
|
144
152
|
}
|
|
145
153
|
}
|
|
154
|
+
var assignRequestQueryToSearchParams = (searchParams, query) => {
|
|
155
|
+
const compositionQueryParamNames = Object.values(compositionQueryParam);
|
|
156
|
+
Object.entries(query).forEach(([name, value]) => {
|
|
157
|
+
if (name === SECRET_QUERY_STRING_PARAM) {
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
if (compositionQueryParamNames.includes(name)) {
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
if (typeof value === "undefined") {
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
if (typeof value === "object") {
|
|
167
|
+
value.forEach((singleValue) => searchParams.append(name, singleValue));
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
searchParams.append(name, value);
|
|
171
|
+
});
|
|
172
|
+
};
|
|
146
173
|
|
|
147
174
|
// src/preview/previewHandlerPost.ts
|
|
148
175
|
import { generateHash } from "@uniformdev/canvas";
|
|
@@ -35,11 +35,10 @@ var import_canvas = require("@uniformdev/canvas");
|
|
|
35
35
|
// src/logging/logCompositionIssues.ts
|
|
36
36
|
var import_colorette = require("colorette");
|
|
37
37
|
function logCompositionIssues(prefix, issues, colour = "red") {
|
|
38
|
-
const reversedIssues = [...issues].reverse();
|
|
39
38
|
const colours = { red: import_colorette.red, green: import_colorette.green, yellow: import_colorette.yellow, white: import_colorette.white };
|
|
40
39
|
console.error(
|
|
41
40
|
`${colours[colour](prefix)}
|
|
42
|
-
${
|
|
41
|
+
${issues.map(
|
|
43
42
|
(issue) => `${colours[colour](">")} ${(0, import_colorette.italic)((0, import_colorette.gray)(indent(issue.type.toUpperCase(), 7)))} ${renderIssue(issue)}`
|
|
44
43
|
).join("\n")}`
|
|
45
44
|
);
|
|
@@ -5,8 +5,8 @@ import {
|
|
|
5
5
|
withUniformGetServerSideProps,
|
|
6
6
|
withUniformGetStaticPaths,
|
|
7
7
|
withUniformGetStaticProps
|
|
8
|
-
} from "../chunk-
|
|
9
|
-
import "../chunk-
|
|
8
|
+
} from "../chunk-ZLQ2WCJC.mjs";
|
|
9
|
+
import "../chunk-JQWYBVLI.mjs";
|
|
10
10
|
import "../chunk-TR7V6ABJ.mjs";
|
|
11
11
|
export {
|
|
12
12
|
getServerSideProps,
|
package/dist/route/index.js
CHANGED
|
@@ -35,11 +35,10 @@ var import_canvas = require("@uniformdev/canvas");
|
|
|
35
35
|
// src/logging/logCompositionIssues.ts
|
|
36
36
|
var import_colorette = require("colorette");
|
|
37
37
|
function logCompositionIssues(prefix, issues, colour = "red") {
|
|
38
|
-
const reversedIssues = [...issues].reverse();
|
|
39
38
|
const colours = { red: import_colorette.red, green: import_colorette.green, yellow: import_colorette.yellow, white: import_colorette.white };
|
|
40
39
|
console.error(
|
|
41
40
|
`${colours[colour](prefix)}
|
|
42
|
-
${
|
|
41
|
+
${issues.map(
|
|
43
42
|
(issue) => `${colours[colour](">")} ${(0, import_colorette.italic)((0, import_colorette.gray)(indent(issue.type.toUpperCase(), 7)))} ${renderIssue(issue)}`
|
|
44
43
|
).join("\n")}`
|
|
45
44
|
);
|
|
@@ -481,7 +480,7 @@ var withUniformGetServerSideProps2 = (options) => {
|
|
|
481
480
|
const absoluteUrl = `${context.req.headers["x-forwarded-proto"]}://${context.req.headers.host}${requestUrl}`;
|
|
482
481
|
return {
|
|
483
482
|
redirect: {
|
|
484
|
-
destination: import_redirect.
|
|
483
|
+
destination: (0, import_redirect.getTargetVariableExpandedUrl)(absoluteUrl, matched.redirect),
|
|
485
484
|
statusCode: matched.redirect.targetStatusCode
|
|
486
485
|
}
|
|
487
486
|
};
|
|
@@ -502,9 +501,9 @@ var withUniformGetServerSideProps2 = (options) => {
|
|
|
502
501
|
defaultHandleNotFound,
|
|
503
502
|
defaultHandleRedirect,
|
|
504
503
|
parseContext(context) {
|
|
505
|
-
var _a;
|
|
504
|
+
var _a, _b;
|
|
506
505
|
return {
|
|
507
|
-
contextualEditingCompositionId: (_a = context.previewData) == null ? void 0 : _a.compositionId,
|
|
506
|
+
contextualEditingCompositionId: ((_a = context.previewData) == null ? void 0 : _a.isUniformContextualEditing) ? (_b = context.previewData) == null ? void 0 : _b.compositionId : void 0,
|
|
508
507
|
resolvedUrl: context.resolvedUrl,
|
|
509
508
|
// auto engage draft content when in next preview mode
|
|
510
509
|
// (can override with explicit setting of request options)'
|
|
@@ -522,7 +521,7 @@ var withUniformGetStaticProps2 = (options) => {
|
|
|
522
521
|
const defaultHandleRedirect = (requestUrl, matched) => {
|
|
523
522
|
return {
|
|
524
523
|
redirect: {
|
|
525
|
-
destination: import_redirect2.
|
|
524
|
+
destination: (0, import_redirect2.getTargetVariableExpandedUrl)(requestUrl, matched.redirect),
|
|
526
525
|
statusCode: matched.redirect.targetStatusCode
|
|
527
526
|
}
|
|
528
527
|
};
|
|
@@ -543,12 +542,12 @@ var withUniformGetStaticProps2 = (options) => {
|
|
|
543
542
|
defaultHandleNotFound,
|
|
544
543
|
defaultHandleRedirect,
|
|
545
544
|
parseContext(context) {
|
|
546
|
-
var _a, _b;
|
|
545
|
+
var _a, _b, _c;
|
|
547
546
|
return {
|
|
548
|
-
contextualEditingCompositionId: (_a = context.previewData) == null ? void 0 : _a.compositionId,
|
|
547
|
+
contextualEditingCompositionId: ((_a = context.previewData) == null ? void 0 : _a.isUniformContextualEditing) ? (_b = context.previewData) == null ? void 0 : _b.compositionId : void 0,
|
|
549
548
|
resolvedUrl: resolveSlugFromParams({
|
|
550
549
|
params: context.params,
|
|
551
|
-
param: (
|
|
550
|
+
param: (_c = options == null ? void 0 : options.param) != null ? _c : "route"
|
|
552
551
|
}),
|
|
553
552
|
// auto engage draft content when in next preview mode
|
|
554
553
|
// (can override with explicit setting of request options)
|
package/dist/route/index.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
withUniformGetStaticPaths
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-ZLQ2WCJC.mjs";
|
|
4
4
|
import {
|
|
5
5
|
logCompositionResponse
|
|
6
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-JQWYBVLI.mjs";
|
|
7
7
|
import {
|
|
8
8
|
resolveSlugFromParams
|
|
9
9
|
} from "../chunk-TR7V6ABJ.mjs";
|
|
@@ -58,7 +58,7 @@ function logRouteResponse(response, duration) {
|
|
|
58
58
|
|
|
59
59
|
// src/route/withUniformGetServerSideProps.ts
|
|
60
60
|
import { CANVAS_DRAFT_STATE } from "@uniformdev/canvas";
|
|
61
|
-
import {
|
|
61
|
+
import { getTargetVariableExpandedUrl } from "@uniformdev/redirect";
|
|
62
62
|
|
|
63
63
|
// src/route/createRouteFetcher.ts
|
|
64
64
|
import {
|
|
@@ -208,7 +208,7 @@ var withUniformGetServerSideProps = (options) => {
|
|
|
208
208
|
const absoluteUrl = `${context.req.headers["x-forwarded-proto"]}://${context.req.headers.host}${requestUrl}`;
|
|
209
209
|
return {
|
|
210
210
|
redirect: {
|
|
211
|
-
destination:
|
|
211
|
+
destination: getTargetVariableExpandedUrl(absoluteUrl, matched.redirect),
|
|
212
212
|
statusCode: matched.redirect.targetStatusCode
|
|
213
213
|
}
|
|
214
214
|
};
|
|
@@ -229,9 +229,9 @@ var withUniformGetServerSideProps = (options) => {
|
|
|
229
229
|
defaultHandleNotFound,
|
|
230
230
|
defaultHandleRedirect,
|
|
231
231
|
parseContext(context) {
|
|
232
|
-
var _a;
|
|
232
|
+
var _a, _b;
|
|
233
233
|
return {
|
|
234
|
-
contextualEditingCompositionId: (_a = context.previewData) == null ? void 0 : _a.compositionId,
|
|
234
|
+
contextualEditingCompositionId: ((_a = context.previewData) == null ? void 0 : _a.isUniformContextualEditing) ? (_b = context.previewData) == null ? void 0 : _b.compositionId : void 0,
|
|
235
235
|
resolvedUrl: context.resolvedUrl,
|
|
236
236
|
// auto engage draft content when in next preview mode
|
|
237
237
|
// (can override with explicit setting of request options)'
|
|
@@ -244,12 +244,12 @@ var withUniformGetServerSideProps = (options) => {
|
|
|
244
244
|
|
|
245
245
|
// src/route/withUniformGetStaticProps.ts
|
|
246
246
|
import { CANVAS_DRAFT_STATE as CANVAS_DRAFT_STATE2 } from "@uniformdev/canvas";
|
|
247
|
-
import {
|
|
247
|
+
import { getTargetVariableExpandedUrl as getTargetVariableExpandedUrl2 } from "@uniformdev/redirect";
|
|
248
248
|
var withUniformGetStaticProps = (options) => {
|
|
249
249
|
const defaultHandleRedirect = (requestUrl, matched) => {
|
|
250
250
|
return {
|
|
251
251
|
redirect: {
|
|
252
|
-
destination:
|
|
252
|
+
destination: getTargetVariableExpandedUrl2(requestUrl, matched.redirect),
|
|
253
253
|
statusCode: matched.redirect.targetStatusCode
|
|
254
254
|
}
|
|
255
255
|
};
|
|
@@ -270,12 +270,12 @@ var withUniformGetStaticProps = (options) => {
|
|
|
270
270
|
defaultHandleNotFound,
|
|
271
271
|
defaultHandleRedirect,
|
|
272
272
|
parseContext(context) {
|
|
273
|
-
var _a, _b;
|
|
273
|
+
var _a, _b, _c;
|
|
274
274
|
return {
|
|
275
|
-
contextualEditingCompositionId: (_a = context.previewData) == null ? void 0 : _a.compositionId,
|
|
275
|
+
contextualEditingCompositionId: ((_a = context.previewData) == null ? void 0 : _a.isUniformContextualEditing) ? (_b = context.previewData) == null ? void 0 : _b.compositionId : void 0,
|
|
276
276
|
resolvedUrl: resolveSlugFromParams({
|
|
277
277
|
params: context.params,
|
|
278
|
-
param: (
|
|
278
|
+
param: (_c = options == null ? void 0 : options.param) != null ? _c : "route"
|
|
279
279
|
}),
|
|
280
280
|
// auto engage draft content when in next preview mode
|
|
281
281
|
// (can override with explicit setting of request options)
|
package/dist/slug/index.js
CHANGED
|
@@ -35,11 +35,10 @@ var import_canvas = require("@uniformdev/canvas");
|
|
|
35
35
|
// src/logging/logCompositionIssues.ts
|
|
36
36
|
var import_colorette = require("colorette");
|
|
37
37
|
function logCompositionIssues(prefix, issues, colour = "red") {
|
|
38
|
-
const reversedIssues = [...issues].reverse();
|
|
39
38
|
const colours = { red: import_colorette.red, green: import_colorette.green, yellow: import_colorette.yellow, white: import_colorette.white };
|
|
40
39
|
console.error(
|
|
41
40
|
`${colours[colour](prefix)}
|
|
42
|
-
${
|
|
41
|
+
${issues.map(
|
|
43
42
|
(issue) => `${colours[colour](">")} ${(0, import_colorette.italic)((0, import_colorette.gray)(indent(issue.type.toUpperCase(), 7)))} ${renderIssue(issue)}`
|
|
44
43
|
).join("\n")}`
|
|
45
44
|
);
|
package/dist/slug/index.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/canvas-next",
|
|
3
|
-
"version": "19.55.
|
|
3
|
+
"version": "19.55.2-alpha.14+9b75d5322",
|
|
4
4
|
"description": "Next.js SDK for Uniform Canvas",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
},
|
|
17
17
|
"./slug": {
|
|
18
18
|
"import": {
|
|
19
|
-
"types": "./dist/index.d.mts",
|
|
19
|
+
"types": "./dist/slug/index.d.mts",
|
|
20
20
|
"node": "./dist/slug/index.mjs",
|
|
21
21
|
"default": "./dist/slug/index.esm.js"
|
|
22
22
|
},
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
},
|
|
25
25
|
"./project-map": {
|
|
26
26
|
"import": {
|
|
27
|
-
"types": "./dist/index.d.mts",
|
|
27
|
+
"types": "./dist/project-map/index.d.mts",
|
|
28
28
|
"node": "./dist/project-map/index.mjs",
|
|
29
29
|
"default": "./dist/project-map/index.esm.js"
|
|
30
30
|
},
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
},
|
|
33
33
|
"./route": {
|
|
34
34
|
"import": {
|
|
35
|
-
"types": "./dist/index.d.mts",
|
|
35
|
+
"types": "./dist/route/index.d.mts",
|
|
36
36
|
"node": "./dist/route/index.mjs",
|
|
37
37
|
"default": "./dist/route/index.esm.js"
|
|
38
38
|
},
|
|
@@ -67,11 +67,11 @@
|
|
|
67
67
|
"document": "api-extractor run --local"
|
|
68
68
|
},
|
|
69
69
|
"dependencies": {
|
|
70
|
-
"@uniformdev/canvas": "19.55.
|
|
71
|
-
"@uniformdev/canvas-react": "19.55.
|
|
72
|
-
"@uniformdev/project-map": "19.55.
|
|
73
|
-
"@uniformdev/redirect": "19.55.
|
|
74
|
-
"@uniformdev/richtext": "19.55.
|
|
70
|
+
"@uniformdev/canvas": "19.55.2-alpha.14+9b75d5322",
|
|
71
|
+
"@uniformdev/canvas-react": "19.55.2-alpha.14+9b75d5322",
|
|
72
|
+
"@uniformdev/project-map": "19.55.2-alpha.14+9b75d5322",
|
|
73
|
+
"@uniformdev/redirect": "19.55.2-alpha.14+9b75d5322",
|
|
74
|
+
"@uniformdev/richtext": "19.55.2-alpha.14+9b75d5322",
|
|
75
75
|
"colorette": "2.0.20"
|
|
76
76
|
},
|
|
77
77
|
"peerDependencies": {
|
|
@@ -91,5 +91,5 @@
|
|
|
91
91
|
"publishConfig": {
|
|
92
92
|
"access": "public"
|
|
93
93
|
},
|
|
94
|
-
"gitHead": "
|
|
94
|
+
"gitHead": "9b75d5322988b2a8c59e7e1b641fb0c8cb7ad301"
|
|
95
95
|
}
|