@uniformdev/canvas-next-rsc 19.84.0 → 19.85.1-alpha.13
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/component.d.mts +2 -0
- package/dist/component.d.ts +2 -0
- package/dist/component.js +3 -1
- package/dist/component.mjs +3 -1
- package/dist/handler.js +104 -15
- package/dist/handler.mjs +94 -5
- package/dist/index.esm.js +21 -4
- package/dist/index.js +20 -4
- package/dist/index.mjs +21 -4
- package/package.json +12 -12
package/dist/component.d.mts
CHANGED
package/dist/component.d.ts
CHANGED
package/dist/component.js
CHANGED
|
@@ -181,7 +181,9 @@ var UniformSlot = ({ data, slot, children }) => {
|
|
|
181
181
|
const result = children({
|
|
182
182
|
child,
|
|
183
183
|
component: targetSlotData[i],
|
|
184
|
-
key: `inner-${i}
|
|
184
|
+
key: `inner-${i}`,
|
|
185
|
+
slotName: slot.name,
|
|
186
|
+
slotIndex: i
|
|
185
187
|
});
|
|
186
188
|
resolved.push(result);
|
|
187
189
|
}
|
package/dist/component.mjs
CHANGED
|
@@ -142,7 +142,9 @@ var UniformSlot = ({ data, slot, children }) => {
|
|
|
142
142
|
const result = children({
|
|
143
143
|
child,
|
|
144
144
|
component: targetSlotData[i],
|
|
145
|
-
key: `inner-${i}
|
|
145
|
+
key: `inner-${i}`,
|
|
146
|
+
slotName: slot.name,
|
|
147
|
+
slotIndex: i
|
|
146
148
|
});
|
|
147
149
|
resolved.push(result);
|
|
148
150
|
}
|
package/dist/handler.js
CHANGED
|
@@ -27,15 +27,18 @@ __export(handler_exports, {
|
|
|
27
27
|
module.exports = __toCommonJS(handler_exports);
|
|
28
28
|
|
|
29
29
|
// src/handler/createPreviewGETRouteHandler.ts
|
|
30
|
-
var
|
|
30
|
+
var import_canvas5 = require("@uniformdev/canvas");
|
|
31
31
|
var import_headers2 = require("next/headers");
|
|
32
32
|
var import_navigation = require("next/navigation");
|
|
33
33
|
|
|
34
34
|
// src/utils/route.ts
|
|
35
|
-
var
|
|
35
|
+
var import_canvas4 = require("@uniformdev/canvas");
|
|
36
36
|
var import_canvas_next_rsc_shared2 = require("@uniformdev/canvas-next-rsc-shared");
|
|
37
37
|
var import_redirect = require("@uniformdev/redirect");
|
|
38
38
|
|
|
39
|
+
// src/clients/canvasClient.ts
|
|
40
|
+
var import_canvas2 = require("@uniformdev/canvas");
|
|
41
|
+
|
|
39
42
|
// src/config/helpers.ts
|
|
40
43
|
var import_canvas_next_rsc_shared = require("@uniformdev/canvas-next-rsc-shared");
|
|
41
44
|
|
|
@@ -145,10 +148,58 @@ var determineFetchCacheOptions = (mode) => {
|
|
|
145
148
|
};
|
|
146
149
|
};
|
|
147
150
|
|
|
151
|
+
// src/clients/canvasClient.ts
|
|
152
|
+
var getCanvasClient = (options) => {
|
|
153
|
+
return new import_canvas2.CanvasClient({
|
|
154
|
+
projectId: env.getProjectId(),
|
|
155
|
+
apiHost: env.getApiHost(),
|
|
156
|
+
apiKey: env.getApiKey(),
|
|
157
|
+
edgeApiHost: env.getEdgeApiHost(),
|
|
158
|
+
fetch: (req, init) => {
|
|
159
|
+
let requestedUrl;
|
|
160
|
+
if (typeof req === "string") {
|
|
161
|
+
requestedUrl = new URL(req);
|
|
162
|
+
} else if (req instanceof URL) {
|
|
163
|
+
requestedUrl = req;
|
|
164
|
+
} else {
|
|
165
|
+
requestedUrl = new URL(req.url);
|
|
166
|
+
}
|
|
167
|
+
const tags = [];
|
|
168
|
+
if (requestedUrl) {
|
|
169
|
+
const compositionIdKey = "compositionId";
|
|
170
|
+
const compositionIdsKey = "compositionIDs";
|
|
171
|
+
const compositionId = requestedUrl.searchParams.get(compositionIdKey);
|
|
172
|
+
const compositionIds = requestedUrl.searchParams.get(compositionIdsKey);
|
|
173
|
+
if (compositionId) {
|
|
174
|
+
tags.push(buildCompositionTag(compositionId));
|
|
175
|
+
}
|
|
176
|
+
if (compositionIds) {
|
|
177
|
+
const ids = compositionIds.split(",");
|
|
178
|
+
for (let i = 0; i < ids.length; i++) {
|
|
179
|
+
tags.push(buildCompositionTag(ids[i]));
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
const { cache, revalidate } = determineFetchCacheOptions(options.cache);
|
|
184
|
+
return fetch(req, {
|
|
185
|
+
...init,
|
|
186
|
+
cache,
|
|
187
|
+
headers: {
|
|
188
|
+
...init == null ? void 0 : init.headers,
|
|
189
|
+
"x-bypass-cache": "true"
|
|
190
|
+
},
|
|
191
|
+
next: {
|
|
192
|
+
revalidate
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
};
|
|
198
|
+
|
|
148
199
|
// src/clients/routeClient.ts
|
|
149
|
-
var
|
|
200
|
+
var import_canvas3 = require("@uniformdev/canvas");
|
|
150
201
|
var getRouteClient = (options) => {
|
|
151
|
-
const client = new
|
|
202
|
+
const client = new import_canvas3.RouteClient({
|
|
152
203
|
projectId: env.getProjectId(),
|
|
153
204
|
apiKey: env.getApiKey(),
|
|
154
205
|
edgeApiHost: env.getEdgeApiHost(),
|
|
@@ -161,7 +212,7 @@ var getRouteClient = (options) => {
|
|
|
161
212
|
} else {
|
|
162
213
|
requestedUrl = new URL(req.url);
|
|
163
214
|
}
|
|
164
|
-
const tags = [];
|
|
215
|
+
const tags = ["route"];
|
|
165
216
|
if (requestedUrl) {
|
|
166
217
|
const pathKey = "path";
|
|
167
218
|
const path = requestedUrl.searchParams.get(pathKey);
|
|
@@ -209,8 +260,21 @@ var retrieveRouteByPath = async ({
|
|
|
209
260
|
const client = getDefaultRouteClient({
|
|
210
261
|
searchParams
|
|
211
262
|
});
|
|
263
|
+
let queryPath = path;
|
|
264
|
+
if (searchParams && Object.keys(searchParams).length > 0) {
|
|
265
|
+
const helper = new URL((0, import_canvas_next_rsc_shared2.getBaseUrl)());
|
|
266
|
+
helper.pathname = path;
|
|
267
|
+
Object.entries(searchParams).forEach(([key, value]) => {
|
|
268
|
+
if (typeof value === "string") {
|
|
269
|
+
helper.searchParams.set(key, value);
|
|
270
|
+
}
|
|
271
|
+
});
|
|
272
|
+
if (helper.searchParams.size > 0) {
|
|
273
|
+
queryPath = `${helper.pathname}${helper.search}`;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
212
276
|
return await client.getRoute({
|
|
213
|
-
path,
|
|
277
|
+
path: queryPath,
|
|
214
278
|
state,
|
|
215
279
|
withComponentIDs: true,
|
|
216
280
|
withContentSourceMap: isOnVercelPreviewEnvironment() && ((_a = (0, import_canvas_next_rsc_shared2.getServerConfig)().experimental) == null ? void 0 : _a.vercelVisualEditing)
|
|
@@ -262,7 +326,7 @@ var createPreviewGETRouteHandler = (options) => {
|
|
|
262
326
|
const { searchParams } = new URL(request.url);
|
|
263
327
|
const secret = searchParams.get("secret");
|
|
264
328
|
const path = searchParams.get("path");
|
|
265
|
-
const isPlayground = searchParams.get(
|
|
329
|
+
const isPlayground = searchParams.get(import_canvas5.IN_CONTEXT_EDITOR_PLAYGROUND_QUERY_STRING_PARAM) === "true";
|
|
266
330
|
const id = searchParams.get("id");
|
|
267
331
|
if (secret !== process.env.UNIFORM_PREVIEW_SECRET) {
|
|
268
332
|
return new Response("Invalid preview secret", { status: 401 });
|
|
@@ -273,17 +337,17 @@ var createPreviewGETRouteHandler = (options) => {
|
|
|
273
337
|
}
|
|
274
338
|
const resolveResult = await retrieveRouteByPath({
|
|
275
339
|
path,
|
|
276
|
-
state:
|
|
340
|
+
state: import_canvas5.CANVAS_DRAFT_STATE,
|
|
277
341
|
searchParams: {
|
|
278
342
|
// about to be in draft mode so pretend for now.
|
|
279
|
-
[
|
|
343
|
+
[import_canvas5.IN_CONTEXT_EDITOR_QUERY_STRING_PARAM]: "true"
|
|
280
344
|
}
|
|
281
345
|
});
|
|
282
346
|
(0, import_headers2.draftMode)().enable();
|
|
283
347
|
if (resolveResult.type === "redirect") {
|
|
284
348
|
const href = resolveRedirectHref(resolveResult, path);
|
|
285
349
|
if (resolveResult.redirect.targetProjectMapNodeId) {
|
|
286
|
-
(0, import_navigation.redirect)(`${href}?${
|
|
350
|
+
(0, import_navigation.redirect)(`${href}?${import_canvas5.IN_CONTEXT_EDITOR_QUERY_STRING_PARAM}=true`);
|
|
287
351
|
} else {
|
|
288
352
|
(0, import_navigation.redirect)(href);
|
|
289
353
|
}
|
|
@@ -291,13 +355,13 @@ var createPreviewGETRouteHandler = (options) => {
|
|
|
291
355
|
if (resolveResult.type === "notFound") {
|
|
292
356
|
return new Response("Invalid path", { status: 401 });
|
|
293
357
|
}
|
|
294
|
-
(0, import_navigation.redirect)(`${path}?${
|
|
358
|
+
(0, import_navigation.redirect)(`${path}?${import_canvas5.IN_CONTEXT_EDITOR_QUERY_STRING_PARAM}=true`);
|
|
295
359
|
} else {
|
|
296
360
|
if (!(options == null ? void 0 : options.playgroundPath)) {
|
|
297
361
|
return new Response("No playground path is configured", { status: 401 });
|
|
298
362
|
}
|
|
299
363
|
(0, import_headers2.draftMode)().enable();
|
|
300
|
-
(0, import_navigation.redirect)(`${options.playgroundPath}?id=${id}&${
|
|
364
|
+
(0, import_navigation.redirect)(`${options.playgroundPath}?id=${id}&${import_canvas5.IN_CONTEXT_EDITOR_QUERY_STRING_PARAM}=true`);
|
|
301
365
|
}
|
|
302
366
|
};
|
|
303
367
|
};
|
|
@@ -319,6 +383,7 @@ var createPreviewOPTIONSRouteHandler = () => {
|
|
|
319
383
|
var import_cache = require("next/cache");
|
|
320
384
|
|
|
321
385
|
// src/handler/helpers.ts
|
|
386
|
+
var import_canvas6 = require("@uniformdev/canvas");
|
|
322
387
|
var import_canvas_next_rsc_shared3 = require("@uniformdev/canvas-next-rsc-shared");
|
|
323
388
|
var import_edge_config = require("@vercel/edge-config");
|
|
324
389
|
var import_svix = require("svix");
|
|
@@ -382,10 +447,16 @@ var processCompositionChange = async (compositionId) => {
|
|
|
382
447
|
type: "no-cache"
|
|
383
448
|
}
|
|
384
449
|
});
|
|
385
|
-
const { nodes } = await
|
|
386
|
-
|
|
387
|
-
|
|
450
|
+
const [{ nodes }, composition] = await Promise.all([
|
|
451
|
+
projectMapClient.getNodes({
|
|
452
|
+
compositionId
|
|
453
|
+
}),
|
|
454
|
+
getComposition({ compositionId })
|
|
455
|
+
]);
|
|
388
456
|
const tags = [];
|
|
457
|
+
if (composition == null ? void 0 : composition.pattern) {
|
|
458
|
+
tags.push("route");
|
|
459
|
+
}
|
|
389
460
|
if (nodes) {
|
|
390
461
|
for (let i = 0; i < nodes.length; i++) {
|
|
391
462
|
const node = nodes[i];
|
|
@@ -400,6 +471,24 @@ var processCompositionChange = async (compositionId) => {
|
|
|
400
471
|
tags
|
|
401
472
|
};
|
|
402
473
|
};
|
|
474
|
+
var getComposition = async ({ compositionId }) => {
|
|
475
|
+
const canvasClient = getCanvasClient({
|
|
476
|
+
cache: {
|
|
477
|
+
type: "no-cache"
|
|
478
|
+
}
|
|
479
|
+
});
|
|
480
|
+
try {
|
|
481
|
+
const composition = await canvasClient.getCompositionById({
|
|
482
|
+
compositionId
|
|
483
|
+
});
|
|
484
|
+
return composition;
|
|
485
|
+
} catch (err) {
|
|
486
|
+
if (err instanceof import_canvas6.ApiClientError && err.statusCode === 404) {
|
|
487
|
+
return null;
|
|
488
|
+
}
|
|
489
|
+
throw err;
|
|
490
|
+
}
|
|
491
|
+
};
|
|
403
492
|
var buildProjectMapNodePaths = (path) => {
|
|
404
493
|
const tags = [];
|
|
405
494
|
const isDynamic = path.includes(":");
|
package/dist/handler.mjs
CHANGED
|
@@ -16,6 +16,9 @@ import {
|
|
|
16
16
|
import { getBaseUrl, getServerConfig as getServerConfig2, resolvePath } from "@uniformdev/canvas-next-rsc-shared";
|
|
17
17
|
import { getTargetVariableExpandedUrl } from "@uniformdev/redirect";
|
|
18
18
|
|
|
19
|
+
// src/clients/canvasClient.ts
|
|
20
|
+
import { CanvasClient } from "@uniformdev/canvas";
|
|
21
|
+
|
|
19
22
|
// src/config/helpers.ts
|
|
20
23
|
import { getServerConfig } from "@uniformdev/canvas-next-rsc-shared";
|
|
21
24
|
|
|
@@ -125,6 +128,54 @@ var determineFetchCacheOptions = (mode) => {
|
|
|
125
128
|
};
|
|
126
129
|
};
|
|
127
130
|
|
|
131
|
+
// src/clients/canvasClient.ts
|
|
132
|
+
var getCanvasClient = (options) => {
|
|
133
|
+
return new CanvasClient({
|
|
134
|
+
projectId: env.getProjectId(),
|
|
135
|
+
apiHost: env.getApiHost(),
|
|
136
|
+
apiKey: env.getApiKey(),
|
|
137
|
+
edgeApiHost: env.getEdgeApiHost(),
|
|
138
|
+
fetch: (req, init) => {
|
|
139
|
+
let requestedUrl;
|
|
140
|
+
if (typeof req === "string") {
|
|
141
|
+
requestedUrl = new URL(req);
|
|
142
|
+
} else if (req instanceof URL) {
|
|
143
|
+
requestedUrl = req;
|
|
144
|
+
} else {
|
|
145
|
+
requestedUrl = new URL(req.url);
|
|
146
|
+
}
|
|
147
|
+
const tags = [];
|
|
148
|
+
if (requestedUrl) {
|
|
149
|
+
const compositionIdKey = "compositionId";
|
|
150
|
+
const compositionIdsKey = "compositionIDs";
|
|
151
|
+
const compositionId = requestedUrl.searchParams.get(compositionIdKey);
|
|
152
|
+
const compositionIds = requestedUrl.searchParams.get(compositionIdsKey);
|
|
153
|
+
if (compositionId) {
|
|
154
|
+
tags.push(buildCompositionTag(compositionId));
|
|
155
|
+
}
|
|
156
|
+
if (compositionIds) {
|
|
157
|
+
const ids = compositionIds.split(",");
|
|
158
|
+
for (let i = 0; i < ids.length; i++) {
|
|
159
|
+
tags.push(buildCompositionTag(ids[i]));
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
const { cache, revalidate } = determineFetchCacheOptions(options.cache);
|
|
164
|
+
return fetch(req, {
|
|
165
|
+
...init,
|
|
166
|
+
cache,
|
|
167
|
+
headers: {
|
|
168
|
+
...init == null ? void 0 : init.headers,
|
|
169
|
+
"x-bypass-cache": "true"
|
|
170
|
+
},
|
|
171
|
+
next: {
|
|
172
|
+
revalidate
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
};
|
|
178
|
+
|
|
128
179
|
// src/clients/routeClient.ts
|
|
129
180
|
import { RouteClient } from "@uniformdev/canvas";
|
|
130
181
|
var getRouteClient = (options) => {
|
|
@@ -141,7 +192,7 @@ var getRouteClient = (options) => {
|
|
|
141
192
|
} else {
|
|
142
193
|
requestedUrl = new URL(req.url);
|
|
143
194
|
}
|
|
144
|
-
const tags = [];
|
|
195
|
+
const tags = ["route"];
|
|
145
196
|
if (requestedUrl) {
|
|
146
197
|
const pathKey = "path";
|
|
147
198
|
const path = requestedUrl.searchParams.get(pathKey);
|
|
@@ -189,8 +240,21 @@ var retrieveRouteByPath = async ({
|
|
|
189
240
|
const client = getDefaultRouteClient({
|
|
190
241
|
searchParams
|
|
191
242
|
});
|
|
243
|
+
let queryPath = path;
|
|
244
|
+
if (searchParams && Object.keys(searchParams).length > 0) {
|
|
245
|
+
const helper = new URL(getBaseUrl());
|
|
246
|
+
helper.pathname = path;
|
|
247
|
+
Object.entries(searchParams).forEach(([key, value]) => {
|
|
248
|
+
if (typeof value === "string") {
|
|
249
|
+
helper.searchParams.set(key, value);
|
|
250
|
+
}
|
|
251
|
+
});
|
|
252
|
+
if (helper.searchParams.size > 0) {
|
|
253
|
+
queryPath = `${helper.pathname}${helper.search}`;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
192
256
|
return await client.getRoute({
|
|
193
|
-
path,
|
|
257
|
+
path: queryPath,
|
|
194
258
|
state,
|
|
195
259
|
withComponentIDs: true,
|
|
196
260
|
withContentSourceMap: isOnVercelPreviewEnvironment() && ((_a = getServerConfig2().experimental) == null ? void 0 : _a.vercelVisualEditing)
|
|
@@ -299,6 +363,7 @@ var createPreviewOPTIONSRouteHandler = () => {
|
|
|
299
363
|
import { revalidateTag } from "next/cache";
|
|
300
364
|
|
|
301
365
|
// src/handler/helpers.ts
|
|
366
|
+
import { ApiClientError } from "@uniformdev/canvas";
|
|
302
367
|
import { getServerConfig as getServerConfig3 } from "@uniformdev/canvas-next-rsc-shared";
|
|
303
368
|
import { parseConnectionString } from "@vercel/edge-config";
|
|
304
369
|
import { Webhook } from "svix";
|
|
@@ -362,10 +427,16 @@ var processCompositionChange = async (compositionId) => {
|
|
|
362
427
|
type: "no-cache"
|
|
363
428
|
}
|
|
364
429
|
});
|
|
365
|
-
const { nodes } = await
|
|
366
|
-
|
|
367
|
-
|
|
430
|
+
const [{ nodes }, composition] = await Promise.all([
|
|
431
|
+
projectMapClient.getNodes({
|
|
432
|
+
compositionId
|
|
433
|
+
}),
|
|
434
|
+
getComposition({ compositionId })
|
|
435
|
+
]);
|
|
368
436
|
const tags = [];
|
|
437
|
+
if (composition == null ? void 0 : composition.pattern) {
|
|
438
|
+
tags.push("route");
|
|
439
|
+
}
|
|
369
440
|
if (nodes) {
|
|
370
441
|
for (let i = 0; i < nodes.length; i++) {
|
|
371
442
|
const node = nodes[i];
|
|
@@ -380,6 +451,24 @@ var processCompositionChange = async (compositionId) => {
|
|
|
380
451
|
tags
|
|
381
452
|
};
|
|
382
453
|
};
|
|
454
|
+
var getComposition = async ({ compositionId }) => {
|
|
455
|
+
const canvasClient = getCanvasClient({
|
|
456
|
+
cache: {
|
|
457
|
+
type: "no-cache"
|
|
458
|
+
}
|
|
459
|
+
});
|
|
460
|
+
try {
|
|
461
|
+
const composition = await canvasClient.getCompositionById({
|
|
462
|
+
compositionId
|
|
463
|
+
});
|
|
464
|
+
return composition;
|
|
465
|
+
} catch (err) {
|
|
466
|
+
if (err instanceof ApiClientError && err.statusCode === 404) {
|
|
467
|
+
return null;
|
|
468
|
+
}
|
|
469
|
+
throw err;
|
|
470
|
+
}
|
|
471
|
+
};
|
|
383
472
|
var buildProjectMapNodePaths = (path) => {
|
|
384
473
|
const tags = [];
|
|
385
474
|
const isDynamic = path.includes(":");
|
package/dist/index.esm.js
CHANGED
|
@@ -299,7 +299,7 @@ var getRouteClient = (options) => {
|
|
|
299
299
|
} else {
|
|
300
300
|
requestedUrl = new URL(req.url);
|
|
301
301
|
}
|
|
302
|
-
const tags = [];
|
|
302
|
+
const tags = ["route"];
|
|
303
303
|
if (requestedUrl) {
|
|
304
304
|
const pathKey = "path";
|
|
305
305
|
const path = requestedUrl.searchParams.get(pathKey);
|
|
@@ -394,6 +394,7 @@ import {
|
|
|
394
394
|
CANVAS_ENRICHMENT_TAG_PARAM,
|
|
395
395
|
CANVAS_PERSONALIZE_TYPE,
|
|
396
396
|
CANVAS_TEST_TYPE,
|
|
397
|
+
isComponentPlaceholderId,
|
|
397
398
|
walkNodeTree
|
|
398
399
|
} from "@uniformdev/canvas";
|
|
399
400
|
import { ClientContextualEditingComponentWrapper, TestClient } from "@uniformdev/canvas-next-rsc-client";
|
|
@@ -506,8 +507,21 @@ var retrieveRouteByPath = async ({
|
|
|
506
507
|
const client = getDefaultRouteClient({
|
|
507
508
|
searchParams
|
|
508
509
|
});
|
|
510
|
+
let queryPath = path;
|
|
511
|
+
if (searchParams && Object.keys(searchParams).length > 0) {
|
|
512
|
+
const helper = new URL(getBaseUrl());
|
|
513
|
+
helper.pathname = path;
|
|
514
|
+
Object.entries(searchParams).forEach(([key, value]) => {
|
|
515
|
+
if (typeof value === "string") {
|
|
516
|
+
helper.searchParams.set(key, value);
|
|
517
|
+
}
|
|
518
|
+
});
|
|
519
|
+
if (helper.searchParams.size > 0) {
|
|
520
|
+
queryPath = `${helper.pathname}${helper.search}`;
|
|
521
|
+
}
|
|
522
|
+
}
|
|
509
523
|
return await client.getRoute({
|
|
510
|
-
path,
|
|
524
|
+
path: queryPath,
|
|
511
525
|
state,
|
|
512
526
|
withComponentIDs: true,
|
|
513
527
|
withContentSourceMap: isOnVercelPreviewEnvironment() && ((_a = getServerConfig2().experimental) == null ? void 0 : _a.vercelVisualEditing)
|
|
@@ -814,7 +828,9 @@ var resolveComponents = ({
|
|
|
814
828
|
component,
|
|
815
829
|
slots,
|
|
816
830
|
contextInstance: isServer || includeContext ? serverContext : void 0,
|
|
817
|
-
context: compositionContext
|
|
831
|
+
context: compositionContext,
|
|
832
|
+
slotName,
|
|
833
|
+
slotIndex: isRoot ? void 0 : componentIndex
|
|
818
834
|
};
|
|
819
835
|
const element = createElement3(resolvedComponent, componentProps);
|
|
820
836
|
let tagElement = null;
|
|
@@ -833,11 +849,12 @@ var resolveComponents = ({
|
|
|
833
849
|
if (tagElement) {
|
|
834
850
|
elements.push(tagElement);
|
|
835
851
|
}
|
|
852
|
+
const isPlaceholder = isComponentPlaceholderId(component == null ? void 0 : component._id);
|
|
836
853
|
childNode = createElement3(
|
|
837
854
|
PureContextualEditingComponentWrapper,
|
|
838
855
|
{
|
|
839
856
|
key: `${slotName}-${componentIndex}-wrapper`,
|
|
840
|
-
isPlaceholder
|
|
857
|
+
isPlaceholder,
|
|
841
858
|
parentComponent: parent,
|
|
842
859
|
component,
|
|
843
860
|
slotName,
|
package/dist/index.js
CHANGED
|
@@ -354,7 +354,7 @@ var getRouteClient = (options) => {
|
|
|
354
354
|
} else {
|
|
355
355
|
requestedUrl = new URL(req.url);
|
|
356
356
|
}
|
|
357
|
-
const tags = [];
|
|
357
|
+
const tags = ["route"];
|
|
358
358
|
if (requestedUrl) {
|
|
359
359
|
const pathKey = "path";
|
|
360
360
|
const path = requestedUrl.searchParams.get(pathKey);
|
|
@@ -545,8 +545,21 @@ var retrieveRouteByPath = async ({
|
|
|
545
545
|
const client = getDefaultRouteClient({
|
|
546
546
|
searchParams
|
|
547
547
|
});
|
|
548
|
+
let queryPath = path;
|
|
549
|
+
if (searchParams && Object.keys(searchParams).length > 0) {
|
|
550
|
+
const helper = new URL((0, import_canvas_next_rsc_shared3.getBaseUrl)());
|
|
551
|
+
helper.pathname = path;
|
|
552
|
+
Object.entries(searchParams).forEach(([key, value]) => {
|
|
553
|
+
if (typeof value === "string") {
|
|
554
|
+
helper.searchParams.set(key, value);
|
|
555
|
+
}
|
|
556
|
+
});
|
|
557
|
+
if (helper.searchParams.size > 0) {
|
|
558
|
+
queryPath = `${helper.pathname}${helper.search}`;
|
|
559
|
+
}
|
|
560
|
+
}
|
|
548
561
|
return await client.getRoute({
|
|
549
|
-
path,
|
|
562
|
+
path: queryPath,
|
|
550
563
|
state,
|
|
551
564
|
withComponentIDs: true,
|
|
552
565
|
withContentSourceMap: isOnVercelPreviewEnvironment() && ((_a = (0, import_canvas_next_rsc_shared3.getServerConfig)().experimental) == null ? void 0 : _a.vercelVisualEditing)
|
|
@@ -853,7 +866,9 @@ var resolveComponents = ({
|
|
|
853
866
|
component,
|
|
854
867
|
slots,
|
|
855
868
|
contextInstance: isServer || includeContext ? serverContext : void 0,
|
|
856
|
-
context: compositionContext
|
|
869
|
+
context: compositionContext,
|
|
870
|
+
slotName,
|
|
871
|
+
slotIndex: isRoot ? void 0 : componentIndex
|
|
857
872
|
};
|
|
858
873
|
const element = (0, import_react6.createElement)(resolvedComponent, componentProps);
|
|
859
874
|
let tagElement = null;
|
|
@@ -872,11 +887,12 @@ var resolveComponents = ({
|
|
|
872
887
|
if (tagElement) {
|
|
873
888
|
elements.push(tagElement);
|
|
874
889
|
}
|
|
890
|
+
const isPlaceholder = (0, import_canvas7.isComponentPlaceholderId)(component == null ? void 0 : component._id);
|
|
875
891
|
childNode = (0, import_react6.createElement)(
|
|
876
892
|
import_core.PureContextualEditingComponentWrapper,
|
|
877
893
|
{
|
|
878
894
|
key: `${slotName}-${componentIndex}-wrapper`,
|
|
879
|
-
isPlaceholder
|
|
895
|
+
isPlaceholder,
|
|
880
896
|
parentComponent: parent,
|
|
881
897
|
component,
|
|
882
898
|
slotName,
|
package/dist/index.mjs
CHANGED
|
@@ -299,7 +299,7 @@ var getRouteClient = (options) => {
|
|
|
299
299
|
} else {
|
|
300
300
|
requestedUrl = new URL(req.url);
|
|
301
301
|
}
|
|
302
|
-
const tags = [];
|
|
302
|
+
const tags = ["route"];
|
|
303
303
|
if (requestedUrl) {
|
|
304
304
|
const pathKey = "path";
|
|
305
305
|
const path = requestedUrl.searchParams.get(pathKey);
|
|
@@ -394,6 +394,7 @@ import {
|
|
|
394
394
|
CANVAS_ENRICHMENT_TAG_PARAM,
|
|
395
395
|
CANVAS_PERSONALIZE_TYPE,
|
|
396
396
|
CANVAS_TEST_TYPE,
|
|
397
|
+
isComponentPlaceholderId,
|
|
397
398
|
walkNodeTree
|
|
398
399
|
} from "@uniformdev/canvas";
|
|
399
400
|
import { ClientContextualEditingComponentWrapper, TestClient } from "@uniformdev/canvas-next-rsc-client";
|
|
@@ -506,8 +507,21 @@ var retrieveRouteByPath = async ({
|
|
|
506
507
|
const client = getDefaultRouteClient({
|
|
507
508
|
searchParams
|
|
508
509
|
});
|
|
510
|
+
let queryPath = path;
|
|
511
|
+
if (searchParams && Object.keys(searchParams).length > 0) {
|
|
512
|
+
const helper = new URL(getBaseUrl());
|
|
513
|
+
helper.pathname = path;
|
|
514
|
+
Object.entries(searchParams).forEach(([key, value]) => {
|
|
515
|
+
if (typeof value === "string") {
|
|
516
|
+
helper.searchParams.set(key, value);
|
|
517
|
+
}
|
|
518
|
+
});
|
|
519
|
+
if (helper.searchParams.size > 0) {
|
|
520
|
+
queryPath = `${helper.pathname}${helper.search}`;
|
|
521
|
+
}
|
|
522
|
+
}
|
|
509
523
|
return await client.getRoute({
|
|
510
|
-
path,
|
|
524
|
+
path: queryPath,
|
|
511
525
|
state,
|
|
512
526
|
withComponentIDs: true,
|
|
513
527
|
withContentSourceMap: isOnVercelPreviewEnvironment() && ((_a = getServerConfig2().experimental) == null ? void 0 : _a.vercelVisualEditing)
|
|
@@ -814,7 +828,9 @@ var resolveComponents = ({
|
|
|
814
828
|
component,
|
|
815
829
|
slots,
|
|
816
830
|
contextInstance: isServer || includeContext ? serverContext : void 0,
|
|
817
|
-
context: compositionContext
|
|
831
|
+
context: compositionContext,
|
|
832
|
+
slotName,
|
|
833
|
+
slotIndex: isRoot ? void 0 : componentIndex
|
|
818
834
|
};
|
|
819
835
|
const element = createElement3(resolvedComponent, componentProps);
|
|
820
836
|
let tagElement = null;
|
|
@@ -833,11 +849,12 @@ var resolveComponents = ({
|
|
|
833
849
|
if (tagElement) {
|
|
834
850
|
elements.push(tagElement);
|
|
835
851
|
}
|
|
852
|
+
const isPlaceholder = isComponentPlaceholderId(component == null ? void 0 : component._id);
|
|
836
853
|
childNode = createElement3(
|
|
837
854
|
PureContextualEditingComponentWrapper,
|
|
838
855
|
{
|
|
839
856
|
key: `${slotName}-${componentIndex}-wrapper`,
|
|
840
|
-
isPlaceholder
|
|
857
|
+
isPlaceholder,
|
|
841
858
|
parentComponent: parent,
|
|
842
859
|
component,
|
|
843
860
|
slotName,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/canvas-next-rsc",
|
|
3
|
-
"version": "19.
|
|
3
|
+
"version": "19.85.1-alpha.13+642f68468",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "tsup",
|
|
@@ -54,22 +54,22 @@
|
|
|
54
54
|
],
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@types/node": "^18.0.0",
|
|
57
|
-
"@types/react": "18.2.
|
|
57
|
+
"@types/react": "18.2.39",
|
|
58
58
|
"eslint": "8.54.0",
|
|
59
59
|
"next": "^13.4.12",
|
|
60
60
|
"react": "18.2.0",
|
|
61
61
|
"react-dom": "18.2.0"
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@uniformdev/canvas": "19.
|
|
65
|
-
"@uniformdev/canvas-next-rsc-client": "^19.
|
|
66
|
-
"@uniformdev/canvas-next-rsc-shared": "^19.
|
|
67
|
-
"@uniformdev/canvas-react": "19.
|
|
68
|
-
"@uniformdev/context": "19.
|
|
69
|
-
"@uniformdev/project-map": "19.
|
|
70
|
-
"@uniformdev/redirect": "19.
|
|
71
|
-
"@uniformdev/richtext": "19.
|
|
72
|
-
"@uniformdev/webhooks": "19.
|
|
64
|
+
"@uniformdev/canvas": "19.85.1-alpha.13+642f68468",
|
|
65
|
+
"@uniformdev/canvas-next-rsc-client": "^19.85.1-alpha.13+642f68468",
|
|
66
|
+
"@uniformdev/canvas-next-rsc-shared": "^19.85.1-alpha.13+642f68468",
|
|
67
|
+
"@uniformdev/canvas-react": "19.85.1-alpha.13+642f68468",
|
|
68
|
+
"@uniformdev/context": "19.85.1-alpha.13+642f68468",
|
|
69
|
+
"@uniformdev/project-map": "19.85.1-alpha.13+642f68468",
|
|
70
|
+
"@uniformdev/redirect": "19.85.1-alpha.13+642f68468",
|
|
71
|
+
"@uniformdev/richtext": "19.85.1-alpha.13+642f68468",
|
|
72
|
+
"@uniformdev/webhooks": "19.85.1-alpha.13+642f68468",
|
|
73
73
|
"@vercel/edge-config": "^0.4.0",
|
|
74
74
|
"encoding": "^0.1.13",
|
|
75
75
|
"server-only": "^0.0.1",
|
|
@@ -86,5 +86,5 @@
|
|
|
86
86
|
"publishConfig": {
|
|
87
87
|
"access": "public"
|
|
88
88
|
},
|
|
89
|
-
"gitHead": "
|
|
89
|
+
"gitHead": "642f684682fa3d0166b58e5ddc7548cfa18f21f3"
|
|
90
90
|
}
|