@uniformdev/canvas-next-rsc 19.154.1-alpha.21 → 19.154.1-alpha.24
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/{UniformComposition-D4tBQ2U4.d.mts → UniformComposition-B-Z17dUt.d.mts} +3 -0
- package/dist/{UniformComposition-D4tBQ2U4.d.ts → UniformComposition-B-Z17dUt.d.ts} +3 -0
- package/dist/component.d.mts +11 -2
- package/dist/component.d.ts +11 -2
- package/dist/component.js +2 -0
- package/dist/component.mjs +1 -0
- package/dist/handler.js +62 -16
- package/dist/handler.mjs +63 -17
- package/dist/index.d.mts +20 -10
- package/dist/index.d.ts +20 -10
- package/dist/index.esm.js +126 -57
- package/dist/index.js +124 -54
- package/dist/index.mjs +126 -57
- package/package.json +12 -12
package/dist/index.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { CanvasClient, RouteClient, ResolvedRouteGetResponse, RouteGetParameters } from '@uniformdev/canvas';
|
|
2
|
-
import {
|
|
1
|
+
import { CanvasClient, RouteClient, ResolvedRouteGetResponse, CompositionGetBySlugParameters, RouteGetParameters } from '@uniformdev/canvas';
|
|
2
|
+
import { UniformServerConfig, PageParameters, AppDirectoryContextState, AppDirectoryServerContext, PlaygroundParameters } from '@uniformdev/canvas-next-rsc-shared';
|
|
3
3
|
export { PageParameters, PlaygroundParameters } from '@uniformdev/canvas-next-rsc-shared';
|
|
4
4
|
import { ManifestClient } from '@uniformdev/context/api';
|
|
5
5
|
import { ProjectMapClient, ProjectMapNode } from '@uniformdev/project-map';
|
|
6
6
|
import { ContextState, ContextOptions } from '@uniformdev/context';
|
|
7
7
|
import React__default, { PropsWithChildren } from 'react';
|
|
8
|
-
import { U as UniformCompositionProps } from './UniformComposition-
|
|
9
|
-
export { a as UniformComposition, r as resolveComposition } from './UniformComposition-
|
|
8
|
+
import { U as UniformCompositionProps } from './UniformComposition-B-Z17dUt.js';
|
|
9
|
+
export { a as UniformComposition, r as resolveComposition } from './UniformComposition-B-Z17dUt.js';
|
|
10
10
|
import { ClientContextComponent } from '@uniformdev/canvas-next-rsc-client';
|
|
11
11
|
|
|
12
12
|
type GetCanvasClientOptions = {
|
|
13
|
-
cache:
|
|
13
|
+
cache: NonNullable<UniformServerConfig['canvasCache']>;
|
|
14
14
|
};
|
|
15
15
|
declare const getCanvasClient: (options: GetCanvasClientOptions) => CanvasClient;
|
|
16
16
|
declare const getDefaultCanvasClient: ({ searchParams, }: {
|
|
@@ -18,7 +18,7 @@ declare const getDefaultCanvasClient: ({ searchParams, }: {
|
|
|
18
18
|
}) => CanvasClient;
|
|
19
19
|
|
|
20
20
|
type GetManifestClientOptions = {
|
|
21
|
-
cache:
|
|
21
|
+
cache: NonNullable<UniformServerConfig['manifestCache']>;
|
|
22
22
|
};
|
|
23
23
|
declare const getManifestClient: (options: GetManifestClientOptions) => ManifestClient;
|
|
24
24
|
declare const getDefaultManifestClient: ({ searchParams, }: {
|
|
@@ -183,7 +183,7 @@ declare const getManifest: ({ searchParams }: {
|
|
|
183
183
|
}>;
|
|
184
184
|
|
|
185
185
|
type GetProjectMapClientOptions = {
|
|
186
|
-
cache:
|
|
186
|
+
cache: NonNullable<UniformServerConfig['projectMapCache']>;
|
|
187
187
|
};
|
|
188
188
|
declare const getProjectMapClient: (options: GetProjectMapClientOptions) => ProjectMapClient;
|
|
189
189
|
declare const getDefaultProjectMapClient: ({ searchParams, }: {
|
|
@@ -191,7 +191,7 @@ declare const getDefaultProjectMapClient: ({ searchParams, }: {
|
|
|
191
191
|
}) => ProjectMapClient;
|
|
192
192
|
|
|
193
193
|
type GetRouteClientOptions = {
|
|
194
|
-
cache:
|
|
194
|
+
cache: NonNullable<UniformServerConfig['canvasCache']>;
|
|
195
195
|
};
|
|
196
196
|
declare const getRouteClient: (options: GetRouteClientOptions) => RouteClient;
|
|
197
197
|
declare const getDefaultRouteClient: ({ searchParams }: {
|
|
@@ -243,7 +243,7 @@ declare const isIncontextEditingEnabled: ({ searchParams, }: {
|
|
|
243
243
|
declare const isOnVercelPreviewEnvironment: () => boolean;
|
|
244
244
|
declare const isDevelopmentEnvironment: () => boolean;
|
|
245
245
|
|
|
246
|
-
type
|
|
246
|
+
type RetrieveCommonOptions = {
|
|
247
247
|
/**
|
|
248
248
|
* If true, the manifest will not be prefetched.
|
|
249
249
|
*
|
|
@@ -251,7 +251,17 @@ type RetrieveRouteOptions = PageParameters & {
|
|
|
251
251
|
*/
|
|
252
252
|
skipPrefetch?: boolean;
|
|
253
253
|
};
|
|
254
|
+
type RetrieveRouteOptions = PageParameters & RetrieveCommonOptions;
|
|
255
|
+
type RetrieveSlugOptions = Pick<CompositionGetBySlugParameters, 'slug' | 'locale' | 'releaseId' | 'versionId'> & {
|
|
256
|
+
/**
|
|
257
|
+
* The searchParams object from Next.js router. Used for signal evaluation.
|
|
258
|
+
*/
|
|
259
|
+
searchParams?: {
|
|
260
|
+
[key: string]: string | undefined;
|
|
261
|
+
};
|
|
262
|
+
} & RetrieveCommonOptions;
|
|
254
263
|
type RetrieveRouteFetchOptions = Omit<RouteGetParameters, 'projectId' | 'path' | 'withComponentIDs' | 'withContentSourceMap' | 'state'>;
|
|
264
|
+
declare const retrieveCompositionBySlug: ({ slug, searchParams, skipPrefetch, locale, releaseId, versionId, }: RetrieveSlugOptions) => Promise<ResolvedRouteGetResponse>;
|
|
255
265
|
declare const retrieveRoute: ({ params, searchParams, skipPrefetch }: RetrieveRouteOptions, fetchOptions?: RetrieveRouteFetchOptions) => Promise<ResolvedRouteGetResponse>;
|
|
256
266
|
|
|
257
|
-
export { ContextUpdateTransfer, type ContextUpdateTransferProps, type CreateServerUniformContextProps, type CreateStaticParamsOptions, type GetCanvasClientOptions, type GetManifestClientOptions, type GetProjectMapClientOptions, type GetRouteClientOptions, UniformCompositionProps, UniformContext, type UniformContextProps, UniformPlayground, type UniformPlaygroundProps, createServerUniformContext, createStaticParams, generateStaticParams, getCanvasClient, getDefaultCanvasClient, getDefaultManifestClient, getDefaultProjectMapClient, getDefaultRouteClient, getManifest, getManifestClient, getProjectMapClient, getRouteClient, isDevelopmentEnvironment, isDraftModeEnabled, isIncontextEditingEnabled, isOnVercelPreviewEnvironment, retrieveRoute };
|
|
267
|
+
export { ContextUpdateTransfer, type ContextUpdateTransferProps, type CreateServerUniformContextProps, type CreateStaticParamsOptions, type GetCanvasClientOptions, type GetManifestClientOptions, type GetProjectMapClientOptions, type GetRouteClientOptions, UniformCompositionProps, UniformContext, type UniformContextProps, UniformPlayground, type UniformPlaygroundProps, createServerUniformContext, createStaticParams, generateStaticParams, getCanvasClient, getDefaultCanvasClient, getDefaultManifestClient, getDefaultProjectMapClient, getDefaultRouteClient, getManifest, getManifestClient, getProjectMapClient, getRouteClient, isDevelopmentEnvironment, isDraftModeEnabled, isIncontextEditingEnabled, isOnVercelPreviewEnvironment, retrieveCompositionBySlug, retrieveRoute };
|
package/dist/index.esm.js
CHANGED
|
@@ -77,7 +77,8 @@ var getCanvasCacheStrategy = (options) => {
|
|
|
77
77
|
return config.canvasCache;
|
|
78
78
|
}
|
|
79
79
|
return {
|
|
80
|
-
type: "no-cache"
|
|
80
|
+
type: "no-cache",
|
|
81
|
+
bypassCache: true
|
|
81
82
|
};
|
|
82
83
|
}
|
|
83
84
|
if (config.canvasCache) {
|
|
@@ -174,6 +175,7 @@ var getCanvasClient = (options) => {
|
|
|
174
175
|
apiHost: env.getApiHost(),
|
|
175
176
|
apiKey: env.getApiKey(),
|
|
176
177
|
edgeApiHost: env.getEdgeApiHost(),
|
|
178
|
+
disableSWR: typeof options.cache.disableSWR !== "undefined" ? options.cache.disableSWR : true,
|
|
177
179
|
fetch: (req, init) => {
|
|
178
180
|
let requestedUrl;
|
|
179
181
|
if (typeof req === "string") {
|
|
@@ -205,7 +207,7 @@ var getCanvasClient = (options) => {
|
|
|
205
207
|
cache,
|
|
206
208
|
headers: {
|
|
207
209
|
...init == null ? void 0 : init.headers,
|
|
208
|
-
"x-bypass-cache": "
|
|
210
|
+
"x-bypass-cache": typeof options.cache.bypassCache !== "undefined" ? options.cache.bypassCache.toString() : "false"
|
|
209
211
|
},
|
|
210
212
|
next: {
|
|
211
213
|
revalidate
|
|
@@ -237,7 +239,7 @@ var getManifestClient = (options) => {
|
|
|
237
239
|
...init,
|
|
238
240
|
headers: {
|
|
239
241
|
...init == null ? void 0 : init.headers,
|
|
240
|
-
"x-bypass-cache": "
|
|
242
|
+
"x-bypass-cache": typeof options.cache.bypassCache !== "undefined" ? options.cache.bypassCache.toString() : "false"
|
|
241
243
|
},
|
|
242
244
|
cache,
|
|
243
245
|
next: {
|
|
@@ -278,7 +280,7 @@ var getProjectMapClient = (options) => {
|
|
|
278
280
|
...init,
|
|
279
281
|
headers: {
|
|
280
282
|
...init == null ? void 0 : init.headers,
|
|
281
|
-
"x-bypass-cache": "
|
|
283
|
+
"x-bypass-cache": typeof options.cache.bypassCache !== "undefined" ? options.cache.bypassCache.toString() : "false"
|
|
282
284
|
},
|
|
283
285
|
cache,
|
|
284
286
|
next: {
|
|
@@ -306,6 +308,7 @@ var getRouteClient = (options) => {
|
|
|
306
308
|
projectId: env.getProjectId(),
|
|
307
309
|
apiKey: env.getApiKey(),
|
|
308
310
|
edgeApiHost: env.getEdgeApiHost(),
|
|
311
|
+
disableSWR: typeof options.cache.disableSWR !== "undefined" ? options.cache.disableSWR : true,
|
|
309
312
|
fetch: (req, init) => {
|
|
310
313
|
let requestedUrl;
|
|
311
314
|
if (typeof req === "string") {
|
|
@@ -333,7 +336,7 @@ var getRouteClient = (options) => {
|
|
|
333
336
|
...init,
|
|
334
337
|
headers: {
|
|
335
338
|
...init == null ? void 0 : init.headers,
|
|
336
|
-
"x-bypass-cache": "
|
|
339
|
+
"x-bypass-cache": typeof options.cache.bypassCache !== "undefined" ? options.cache.bypassCache.toString() : "false"
|
|
337
340
|
},
|
|
338
341
|
cache,
|
|
339
342
|
next: {
|
|
@@ -420,7 +423,7 @@ import {
|
|
|
420
423
|
import { PureContextualEditingComponentWrapper } from "@uniformdev/canvas-react/core";
|
|
421
424
|
import { cookies as cookies2, headers } from "next/headers";
|
|
422
425
|
import { notFound, redirect } from "next/navigation";
|
|
423
|
-
import { createElement as createElement3, Fragment as Fragment3 } from "react";
|
|
426
|
+
import { createElement as createElement3, Fragment as Fragment3, Suspense } from "react";
|
|
424
427
|
|
|
425
428
|
// src/context/createServerUniformContext.ts
|
|
426
429
|
import {
|
|
@@ -458,13 +461,62 @@ import {
|
|
|
458
461
|
} from "@uniformdev/canvas";
|
|
459
462
|
import { getBaseUrl, resolvePath } from "@uniformdev/canvas-next-rsc-shared";
|
|
460
463
|
import { getTargetVariableExpandedUrl } from "@uniformdev/redirect";
|
|
464
|
+
var retrieveCompositionBySlug = async ({
|
|
465
|
+
slug,
|
|
466
|
+
searchParams,
|
|
467
|
+
skipPrefetch,
|
|
468
|
+
locale,
|
|
469
|
+
releaseId,
|
|
470
|
+
versionId
|
|
471
|
+
}) => {
|
|
472
|
+
var _a;
|
|
473
|
+
if (!skipPrefetch) {
|
|
474
|
+
void getManifest({
|
|
475
|
+
searchParams
|
|
476
|
+
});
|
|
477
|
+
}
|
|
478
|
+
let result;
|
|
479
|
+
const states = determineState({
|
|
480
|
+
searchParams
|
|
481
|
+
});
|
|
482
|
+
for (let i = 0; i < states.length; i++) {
|
|
483
|
+
const state = states[i];
|
|
484
|
+
const canvasClient = getDefaultCanvasClient({
|
|
485
|
+
searchParams
|
|
486
|
+
});
|
|
487
|
+
try {
|
|
488
|
+
const composition = await canvasClient.getCompositionBySlug({
|
|
489
|
+
slug,
|
|
490
|
+
state,
|
|
491
|
+
withComponentIDs: true,
|
|
492
|
+
withContentSourceMap: isOnVercelPreviewEnvironment() && ((_a = getServerConfig().experimental) == null ? void 0 : _a.vercelVisualEditing),
|
|
493
|
+
locale,
|
|
494
|
+
releaseId,
|
|
495
|
+
versionId
|
|
496
|
+
});
|
|
497
|
+
result = {
|
|
498
|
+
type: "composition",
|
|
499
|
+
compositionApiResponse: composition,
|
|
500
|
+
matchedRoute: "slug"
|
|
501
|
+
};
|
|
502
|
+
} catch (e) {
|
|
503
|
+
console.warn(`Failed to retrieve composition by slug: ${slug} with state ${state}`, e);
|
|
504
|
+
}
|
|
505
|
+
if ((result == null ? void 0 : result.type) !== "notFound") {
|
|
506
|
+
break;
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
return result || {
|
|
510
|
+
type: "notFound"
|
|
511
|
+
};
|
|
512
|
+
};
|
|
461
513
|
var retrieveRoute = async ({ params, searchParams, skipPrefetch }, fetchOptions) => {
|
|
462
514
|
if (!skipPrefetch) {
|
|
463
515
|
void getManifest({
|
|
464
516
|
searchParams
|
|
465
517
|
});
|
|
466
518
|
}
|
|
467
|
-
const {
|
|
519
|
+
const { value } = resolvePath({
|
|
468
520
|
params
|
|
469
521
|
});
|
|
470
522
|
const states = determineState({
|
|
@@ -473,34 +525,15 @@ var retrieveRoute = async ({ params, searchParams, skipPrefetch }, fetchOptions)
|
|
|
473
525
|
let result;
|
|
474
526
|
for (let i = 0; i < states.length; i++) {
|
|
475
527
|
const state = states[i];
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
fetchOptions
|
|
483
|
-
});
|
|
484
|
-
} catch (e) {
|
|
485
|
-
console.warn(`Failed to retrieve route by path: ${value} with state ${state}`, e);
|
|
486
|
-
}
|
|
487
|
-
} else if (type === "slug") {
|
|
488
|
-
const canvasClient = getDefaultCanvasClient({
|
|
489
|
-
searchParams
|
|
528
|
+
try {
|
|
529
|
+
result = await retrieveRouteByPath({
|
|
530
|
+
path: value,
|
|
531
|
+
state,
|
|
532
|
+
searchParams,
|
|
533
|
+
fetchOptions
|
|
490
534
|
});
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
slug: value,
|
|
494
|
-
state
|
|
495
|
-
});
|
|
496
|
-
result = {
|
|
497
|
-
type: "composition",
|
|
498
|
-
compositionApiResponse: composition,
|
|
499
|
-
matchedRoute: "slug"
|
|
500
|
-
};
|
|
501
|
-
} catch (e) {
|
|
502
|
-
console.warn(`Failed to retrieve composition by slug: ${value} with state ${state}`, e);
|
|
503
|
-
}
|
|
535
|
+
} catch (e) {
|
|
536
|
+
console.warn(`Failed to retrieve route by path: ${value} with state ${state}`, e);
|
|
504
537
|
}
|
|
505
538
|
if ((result == null ? void 0 : result.type) !== "notFound") {
|
|
506
539
|
break;
|
|
@@ -585,6 +618,7 @@ var PersonalizeClientWrapper = (props) => {
|
|
|
585
618
|
// src/components/PersonalizeServer.ts
|
|
586
619
|
import { CANVAS_PERSONALIZE_SLOT } from "@uniformdev/canvas";
|
|
587
620
|
import { runPersonalization as runPersonalization2 } from "@uniformdev/canvas-next-rsc-shared";
|
|
621
|
+
import { unstable_noStore as noStore } from "next/cache";
|
|
588
622
|
import { createElement, Fragment } from "react";
|
|
589
623
|
|
|
590
624
|
// src/components/ContextPersonalizationTransfer.tsx
|
|
@@ -596,15 +630,19 @@ var ContextPersonalizationTransfer = ({ event }) => {
|
|
|
596
630
|
|
|
597
631
|
// src/components/PersonalizeServer.ts
|
|
598
632
|
var PersonalizeServer = (props) => {
|
|
599
|
-
var _a;
|
|
633
|
+
var _a, _b;
|
|
634
|
+
if ((_a = getServerConfig().ppr) == null ? void 0 : _a.personalizationSuspense) {
|
|
635
|
+
noStore();
|
|
636
|
+
}
|
|
600
637
|
const { indexes, event } = runPersonalization2(props);
|
|
601
|
-
const slot = (
|
|
638
|
+
const slot = (_b = props.slots) == null ? void 0 : _b[CANVAS_PERSONALIZE_SLOT];
|
|
602
639
|
const components = indexes.map((index) => {
|
|
603
640
|
const component = slot.items[index];
|
|
604
641
|
return component;
|
|
605
642
|
});
|
|
606
643
|
const eventElement = createElement(ContextPersonalizationTransfer, {
|
|
607
|
-
event
|
|
644
|
+
event,
|
|
645
|
+
key: `${props.slotName}-${props.slotIndex}-personalization-transfer`
|
|
608
646
|
});
|
|
609
647
|
return createElement(Fragment, void 0, [...components, eventElement]);
|
|
610
648
|
};
|
|
@@ -614,6 +652,7 @@ import { CANVAS_TEST_SLOT } from "@uniformdev/canvas";
|
|
|
614
652
|
import {
|
|
615
653
|
runTest
|
|
616
654
|
} from "@uniformdev/canvas-next-rsc-shared";
|
|
655
|
+
import { unstable_noStore as noStore2 } from "next/cache";
|
|
617
656
|
import { createElement as createElement2, Fragment as Fragment2 } from "react";
|
|
618
657
|
|
|
619
658
|
// src/components/ContextTestTransfer.tsx
|
|
@@ -624,17 +663,24 @@ var ContextTestTransfer = ({ event }) => {
|
|
|
624
663
|
};
|
|
625
664
|
|
|
626
665
|
// src/components/TestServer.ts
|
|
627
|
-
var TestServer = (props) => {
|
|
628
|
-
var _a, _b, _c, _d;
|
|
666
|
+
var TestServer = async (props) => {
|
|
667
|
+
var _a, _b, _c, _d, _e;
|
|
668
|
+
if ((_a = getServerConfig().ppr) == null ? void 0 : _a.testSuspense) {
|
|
669
|
+
noStore2();
|
|
670
|
+
}
|
|
629
671
|
const { contextInstance, test } = props;
|
|
630
|
-
const isTestDefined = Boolean((
|
|
672
|
+
const isTestDefined = Boolean((_b = contextInstance.manifest.data.project.test) == null ? void 0 : _b[test]);
|
|
631
673
|
if (!isTestDefined && process.env.NODE_ENV !== "production") {
|
|
632
674
|
console.warn(`Test "${test}" is not defined in Uniform manifest.`);
|
|
633
675
|
}
|
|
634
676
|
const { index, event } = runTest(props);
|
|
635
|
-
|
|
677
|
+
if (index === null || event === null) {
|
|
678
|
+
return null;
|
|
679
|
+
}
|
|
680
|
+
const component = typeof index === "number" ? (_e = (_d = (_c = props.slots) == null ? void 0 : _c[CANVAS_TEST_SLOT]) == null ? void 0 : _d.items[index]) != null ? _e : null : null;
|
|
636
681
|
const eventElement = createElement2(ContextTestTransfer, {
|
|
637
|
-
event
|
|
682
|
+
event,
|
|
683
|
+
key: `${props.slotName}-${props.slotIndex}-server-transfer`
|
|
638
684
|
});
|
|
639
685
|
return createElement2(Fragment2, void 0, [component, eventElement]);
|
|
640
686
|
};
|
|
@@ -738,19 +784,24 @@ var isServerComponent = ({
|
|
|
738
784
|
};
|
|
739
785
|
var resolveSystemComponent = ({
|
|
740
786
|
component,
|
|
741
|
-
|
|
787
|
+
server
|
|
742
788
|
}) => {
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
789
|
+
var _a, _b;
|
|
790
|
+
const config = getServerConfig();
|
|
791
|
+
let resolved = null;
|
|
792
|
+
let suspense = void 0;
|
|
747
793
|
if (component.type === CANVAS_PERSONALIZE_TYPE) {
|
|
748
|
-
|
|
794
|
+
resolved = server ? PersonalizeServer : PersonalizeClientWrapper;
|
|
795
|
+
suspense = server && ((_a = config.ppr) == null ? void 0 : _a.personalizationSuspense);
|
|
749
796
|
}
|
|
750
797
|
if (component.type === CANVAS_TEST_TYPE) {
|
|
751
|
-
|
|
798
|
+
resolved = server ? TestServer : TestClient;
|
|
799
|
+
suspense = server && ((_b = config.ppr) == null ? void 0 : _b.testSuspense);
|
|
752
800
|
}
|
|
753
|
-
return
|
|
801
|
+
return {
|
|
802
|
+
component: resolved,
|
|
803
|
+
suspense
|
|
804
|
+
};
|
|
754
805
|
};
|
|
755
806
|
var resolveSlots = ({
|
|
756
807
|
component,
|
|
@@ -827,11 +878,15 @@ var resolveComponents = ({
|
|
|
827
878
|
component,
|
|
828
879
|
serverContext
|
|
829
880
|
});
|
|
830
|
-
const systemComponent = resolveSystemComponent({
|
|
881
|
+
const { component: systemComponent, suspense: systemSuspense } = resolveSystemComponent({
|
|
831
882
|
component,
|
|
832
|
-
|
|
883
|
+
server: isServer
|
|
833
884
|
});
|
|
834
|
-
const {
|
|
885
|
+
const {
|
|
886
|
+
component: regularComponent,
|
|
887
|
+
includeContext,
|
|
888
|
+
suspense: componentSuspense
|
|
889
|
+
} = resolveComponent({ component }) || {
|
|
835
890
|
component: null
|
|
836
891
|
};
|
|
837
892
|
if (!systemComponent && !regularComponent) {
|
|
@@ -846,10 +901,11 @@ var resolveComponents = ({
|
|
|
846
901
|
mode
|
|
847
902
|
});
|
|
848
903
|
const resolvedComponent = systemComponent || regularComponent;
|
|
904
|
+
const wrapInSuspense = systemSuspense || componentSuspense;
|
|
849
905
|
const parameters = (_a = component.parameters) != null ? _a : {};
|
|
850
906
|
const enrichmentTags = (_b = parameters[CANVAS_ENRICHMENT_TAG_PARAM]) == null ? void 0 : _b.value;
|
|
907
|
+
const key = `${slotName}-${componentIndex}-component`;
|
|
851
908
|
const componentProps = {
|
|
852
|
-
key: `${slotName}-${componentIndex}-component`,
|
|
853
909
|
...Object.keys(parameters).reduce((acc, cur) => {
|
|
854
910
|
acc[cur] = parameters[cur].value;
|
|
855
911
|
return acc;
|
|
@@ -861,7 +917,19 @@ var resolveComponents = ({
|
|
|
861
917
|
slotName,
|
|
862
918
|
slotIndex: isRoot ? void 0 : componentIndex
|
|
863
919
|
};
|
|
864
|
-
|
|
920
|
+
let element = null;
|
|
921
|
+
if (wrapInSuspense) {
|
|
922
|
+
element = createElement3(
|
|
923
|
+
Suspense,
|
|
924
|
+
{
|
|
925
|
+
key,
|
|
926
|
+
fallback: typeof wrapInSuspense === "boolean" || typeof (wrapInSuspense == null ? void 0 : wrapInSuspense.fallback) === "undefined" ? void 0 : createElement3(wrapInSuspense.fallback)
|
|
927
|
+
},
|
|
928
|
+
createElement3(resolvedComponent, componentProps)
|
|
929
|
+
);
|
|
930
|
+
} else {
|
|
931
|
+
element = createElement3(resolvedComponent, { ...componentProps, key });
|
|
932
|
+
}
|
|
865
933
|
let tagElement = null;
|
|
866
934
|
if (enrichmentTags == null ? void 0 : enrichmentTags.length) {
|
|
867
935
|
tagElement = createElement3(ContextUpdateTransfer, {
|
|
@@ -935,7 +1003,7 @@ import {
|
|
|
935
1003
|
DefaultUniformClientContext,
|
|
936
1004
|
UniformScript
|
|
937
1005
|
} from "@uniformdev/canvas-next-rsc-client";
|
|
938
|
-
import { Suspense } from "react";
|
|
1006
|
+
import { Suspense as Suspense2 } from "react";
|
|
939
1007
|
import React6 from "react";
|
|
940
1008
|
var UniformContext = async ({
|
|
941
1009
|
clientContextComponent,
|
|
@@ -956,7 +1024,7 @@ var UniformContext = async ({
|
|
|
956
1024
|
disableDevTools,
|
|
957
1025
|
defaultConsent
|
|
958
1026
|
}
|
|
959
|
-
), /* @__PURE__ */ React6.createElement(
|
|
1027
|
+
), /* @__PURE__ */ React6.createElement(Suspense2, { fallback: /* @__PURE__ */ React6.createElement(React6.Fragment, null) }, /* @__PURE__ */ React6.createElement(UniformScript, null)));
|
|
960
1028
|
};
|
|
961
1029
|
|
|
962
1030
|
// src/components/UniformPlayground.tsx
|
|
@@ -1033,5 +1101,6 @@ export {
|
|
|
1033
1101
|
isIncontextEditingEnabled,
|
|
1034
1102
|
isOnVercelPreviewEnvironment,
|
|
1035
1103
|
resolveComposition,
|
|
1104
|
+
retrieveCompositionBySlug,
|
|
1036
1105
|
retrieveRoute
|
|
1037
1106
|
};
|