@uniformdev/canvas-next-rsc 19.79.1-alpha.11 → 19.79.1-alpha.7
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-d178d865.d.ts → UniformComposition-0pvEHduc.d.mts} +1 -1
- package/dist/UniformComposition-0pvEHduc.d.ts +64 -0
- package/dist/component.d.mts +4 -2
- package/dist/component.d.ts +4 -2
- package/dist/component.js +3 -1
- package/dist/component.mjs +3 -1
- package/dist/handler.d.mts +1 -1
- package/dist/handler.d.ts +1 -1
- package/dist/handler.js +111 -26
- package/dist/handler.mjs +101 -16
- package/dist/index.d.mts +26 -5
- package/dist/index.d.ts +26 -5
- package/dist/index.esm.js +67 -45
- package/dist/index.js +89 -68
- package/dist/index.mjs +67 -45
- package/package.json +13 -13
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { CanvasClient, RouteClient, ResolvedRouteGetResponse } from '@uniformdev/canvas';
|
|
1
|
+
import { CanvasClient, RouteClient, ResolvedRouteGetResponse, RouteGetParameters } from '@uniformdev/canvas';
|
|
2
2
|
import { CacheMode, 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-0pvEHduc.js';
|
|
9
|
+
export { a as UniformComposition, r as resolveComposition } from './UniformComposition-0pvEHduc.js';
|
|
10
10
|
import { ClientContextComponent } from '@uniformdev/canvas-next-rsc-client';
|
|
11
11
|
|
|
12
12
|
type GetCanvasClientOptions = {
|
|
@@ -176,6 +176,26 @@ declare const getManifest: ({ searchParams }: {
|
|
|
176
176
|
wv?: string | undefined;
|
|
177
177
|
};
|
|
178
178
|
} | undefined;
|
|
179
|
+
goal?: {
|
|
180
|
+
[key: string]: {
|
|
181
|
+
type: "sig";
|
|
182
|
+
id: string;
|
|
183
|
+
op: "=" | "!=" | "<" | ">";
|
|
184
|
+
score: number;
|
|
185
|
+
} | {
|
|
186
|
+
type: "enr";
|
|
187
|
+
cat: string;
|
|
188
|
+
value: string;
|
|
189
|
+
op: "=" | "!=" | "<" | ">";
|
|
190
|
+
score: number;
|
|
191
|
+
} | {
|
|
192
|
+
type: "qrk";
|
|
193
|
+
id: string;
|
|
194
|
+
op: "=" | "~" | "//" | "!=" | "!~" | "!//";
|
|
195
|
+
cs?: boolean | undefined;
|
|
196
|
+
value: string;
|
|
197
|
+
};
|
|
198
|
+
} | undefined;
|
|
179
199
|
};
|
|
180
200
|
}>;
|
|
181
201
|
|
|
@@ -248,6 +268,7 @@ type RetrieveRouteOptions = PageParameters & {
|
|
|
248
268
|
*/
|
|
249
269
|
skipPrefetch?: boolean;
|
|
250
270
|
};
|
|
251
|
-
|
|
271
|
+
type RetrieveRouteFetchOptions = Omit<RouteGetParameters, 'projectId' | 'path' | 'withComponentIDs' | 'withContentSourceMap' | 'state'>;
|
|
272
|
+
declare const retrieveRoute: ({ params, searchParams, skipPrefetch }: RetrieveRouteOptions, fetchOptions?: RetrieveRouteFetchOptions) => Promise<ResolvedRouteGetResponse>;
|
|
252
273
|
|
|
253
|
-
export { ContextUpdateTransfer, ContextUpdateTransferProps, CreateServerUniformContextProps, CreateStaticParamsOptions, GetCanvasClientOptions, GetManifestClientOptions, GetProjectMapClientOptions, GetRouteClientOptions, UniformCompositionProps, UniformContext, UniformContextProps, UniformPlayground, UniformPlaygroundProps, createServerUniformContext, createStaticParams, generateStaticParams, getCanvasClient, getDefaultCanvasClient, getDefaultManifestClient, getDefaultProjectMapClient, getDefaultRouteClient, getManifest, getManifestClient, getProjectMapClient, getRouteClient, isDevelopmentEnvironment, isDraftModeEnabled, isIncontextEditingEnabled, isOnVercelPreviewEnvironment, retrieveRoute };
|
|
274
|
+
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 };
|
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";
|
|
@@ -442,11 +443,7 @@ import {
|
|
|
442
443
|
} from "@uniformdev/canvas";
|
|
443
444
|
import { getBaseUrl, getServerConfig as getServerConfig2, resolvePath } from "@uniformdev/canvas-next-rsc-shared";
|
|
444
445
|
import { getTargetVariableExpandedUrl } from "@uniformdev/redirect";
|
|
445
|
-
var retrieveRoute = async ({
|
|
446
|
-
params,
|
|
447
|
-
searchParams,
|
|
448
|
-
skipPrefetch
|
|
449
|
-
}) => {
|
|
446
|
+
var retrieveRoute = async ({ params, searchParams, skipPrefetch }, fetchOptions) => {
|
|
450
447
|
if (!skipPrefetch) {
|
|
451
448
|
void getManifest({
|
|
452
449
|
searchParams
|
|
@@ -466,7 +463,8 @@ var retrieveRoute = async ({
|
|
|
466
463
|
result = await retrieveRouteByPath({
|
|
467
464
|
path: value,
|
|
468
465
|
state,
|
|
469
|
-
searchParams
|
|
466
|
+
searchParams,
|
|
467
|
+
fetchOptions
|
|
470
468
|
});
|
|
471
469
|
} catch (e) {
|
|
472
470
|
console.warn(`Failed to retrieve route by path: ${value} with state ${state}`, e);
|
|
@@ -500,30 +498,39 @@ var retrieveRoute = async ({
|
|
|
500
498
|
var retrieveRouteByPath = async ({
|
|
501
499
|
path,
|
|
502
500
|
state,
|
|
503
|
-
searchParams
|
|
501
|
+
searchParams,
|
|
502
|
+
fetchOptions
|
|
504
503
|
}) => {
|
|
505
504
|
var _a;
|
|
506
505
|
const client = getDefaultRouteClient({
|
|
507
506
|
searchParams
|
|
508
507
|
});
|
|
508
|
+
let queryPath = path;
|
|
509
|
+
if (searchParams && Object.keys(searchParams).length > 0) {
|
|
510
|
+
const helper = new URL(getBaseUrl());
|
|
511
|
+
helper.pathname = path;
|
|
512
|
+
Object.entries(searchParams).forEach(([key, value]) => {
|
|
513
|
+
if (typeof value === "string") {
|
|
514
|
+
helper.searchParams.set(key, value);
|
|
515
|
+
}
|
|
516
|
+
});
|
|
517
|
+
if (helper.searchParams.size > 0) {
|
|
518
|
+
queryPath = `${helper.pathname}${helper.search}`;
|
|
519
|
+
}
|
|
520
|
+
}
|
|
509
521
|
return await client.getRoute({
|
|
510
|
-
|
|
522
|
+
...fetchOptions,
|
|
523
|
+
path: queryPath,
|
|
511
524
|
state,
|
|
512
525
|
withComponentIDs: true,
|
|
513
526
|
withContentSourceMap: isOnVercelPreviewEnvironment() && ((_a = getServerConfig2().experimental) == null ? void 0 : _a.vercelVisualEditing)
|
|
514
527
|
});
|
|
515
528
|
};
|
|
516
529
|
var resolveRedirectHref = (resolveResult, path) => {
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
const url = new URL(expandedUrl);
|
|
522
|
-
href = url.pathname;
|
|
523
|
-
} else {
|
|
524
|
-
href = resolveResult.redirect.targetUrl;
|
|
525
|
-
}
|
|
526
|
-
return href;
|
|
530
|
+
const requestUrl = `${getBaseUrl()}${path}`;
|
|
531
|
+
const expandedUrl = getTargetVariableExpandedUrl(requestUrl, resolveResult.redirect);
|
|
532
|
+
const url = new URL(expandedUrl);
|
|
533
|
+
return url.pathname;
|
|
527
534
|
};
|
|
528
535
|
var determineState = ({ searchParams }) => {
|
|
529
536
|
const draftMode2 = isDraftModeEnabled({ searchParams });
|
|
@@ -564,38 +571,50 @@ var PersonalizeClientWrapper = (props) => {
|
|
|
564
571
|
import { CANVAS_PERSONALIZE_SLOT } from "@uniformdev/canvas";
|
|
565
572
|
import { runPersonalization as runPersonalization2 } from "@uniformdev/canvas-next-rsc-shared";
|
|
566
573
|
import { createElement, Fragment } from "react";
|
|
574
|
+
|
|
575
|
+
// src/components/ContextPersonalizationTransfer.tsx
|
|
576
|
+
import { ClientContextPersonalizationTransfer } from "@uniformdev/canvas-next-rsc-client";
|
|
577
|
+
import React4 from "react";
|
|
578
|
+
var ContextPersonalizationTransfer = ({ event }) => {
|
|
579
|
+
return /* @__PURE__ */ React4.createElement(ClientContextPersonalizationTransfer, { ts: (/* @__PURE__ */ new Date()).valueOf(), event });
|
|
580
|
+
};
|
|
581
|
+
|
|
582
|
+
// src/components/PersonalizeServer.ts
|
|
567
583
|
var PersonalizeServer = (props) => {
|
|
568
584
|
var _a;
|
|
569
|
-
const { indexes } = runPersonalization2(props);
|
|
585
|
+
const { indexes, event } = runPersonalization2(props);
|
|
570
586
|
const slot = (_a = props.slots) == null ? void 0 : _a[CANVAS_PERSONALIZE_SLOT];
|
|
571
587
|
const components = indexes.map((index) => {
|
|
572
588
|
const component = slot.items[index];
|
|
573
589
|
return component;
|
|
574
590
|
});
|
|
575
|
-
|
|
591
|
+
const eventElement = createElement(ContextPersonalizationTransfer, {
|
|
592
|
+
event
|
|
593
|
+
});
|
|
594
|
+
return createElement(Fragment, void 0, [...components, eventElement]);
|
|
576
595
|
};
|
|
577
596
|
|
|
578
597
|
// src/components/TestServer.ts
|
|
579
|
-
import { CANVAS_TEST_SLOT
|
|
598
|
+
import { CANVAS_TEST_SLOT } from "@uniformdev/canvas";
|
|
599
|
+
import { runTest } from "@uniformdev/canvas-next-rsc-shared";
|
|
580
600
|
import { createElement as createElement2, Fragment as Fragment2 } from "react";
|
|
581
|
-
|
|
601
|
+
|
|
602
|
+
// src/components/ContextTestTransfer.tsx
|
|
603
|
+
import { ClientContextTestTransfer } from "@uniformdev/canvas-next-rsc-client";
|
|
604
|
+
import React5 from "react";
|
|
605
|
+
var ContextTestTransfer = ({ event }) => {
|
|
606
|
+
return /* @__PURE__ */ React5.createElement(ClientContextTestTransfer, { ts: (/* @__PURE__ */ new Date()).valueOf(), event });
|
|
607
|
+
};
|
|
608
|
+
|
|
609
|
+
// src/components/TestServer.ts
|
|
610
|
+
var TestServer = (props) => {
|
|
582
611
|
var _a, _b, _c;
|
|
583
|
-
const
|
|
584
|
-
const
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
var _a2, _b2, _c2;
|
|
588
|
-
const contextTag = (_b2 = (_a2 = v.parameters) == null ? void 0 : _a2[CANVAS_TEST_VARIANT_PARAM]) == null ? void 0 : _b2.value;
|
|
589
|
-
const id = (_c2 = contextTag == null ? void 0 : contextTag.id) != null ? _c2 : "testId" in v ? v.testId : `ab-${i}-${v.type}`;
|
|
590
|
-
return {
|
|
591
|
-
id,
|
|
592
|
-
testDistribution: contextTag == null ? void 0 : contextTag.testDistribution,
|
|
593
|
-
index: i
|
|
594
|
-
};
|
|
595
|
-
})
|
|
612
|
+
const { index, event } = runTest(props);
|
|
613
|
+
const component = typeof index === "number" ? (_c = (_b = (_a = props.slots) == null ? void 0 : _a[CANVAS_TEST_SLOT]) == null ? void 0 : _b.items[index]) != null ? _c : null : null;
|
|
614
|
+
const eventElement = createElement2(ContextTestTransfer, {
|
|
615
|
+
event
|
|
596
616
|
});
|
|
597
|
-
|
|
598
|
-
return createElement2(Fragment2, void 0, components);
|
|
617
|
+
return createElement2(Fragment2, void 0, [component, eventElement]);
|
|
599
618
|
};
|
|
600
619
|
|
|
601
620
|
// src/components/UniformComposition.ts
|
|
@@ -814,7 +833,9 @@ var resolveComponents = ({
|
|
|
814
833
|
component,
|
|
815
834
|
slots,
|
|
816
835
|
contextInstance: isServer || includeContext ? serverContext : void 0,
|
|
817
|
-
context: compositionContext
|
|
836
|
+
context: compositionContext,
|
|
837
|
+
slotName,
|
|
838
|
+
slotIndex: isRoot ? void 0 : componentIndex
|
|
818
839
|
};
|
|
819
840
|
const element = createElement3(resolvedComponent, componentProps);
|
|
820
841
|
let tagElement = null;
|
|
@@ -833,11 +854,12 @@ var resolveComponents = ({
|
|
|
833
854
|
if (tagElement) {
|
|
834
855
|
elements.push(tagElement);
|
|
835
856
|
}
|
|
857
|
+
const isPlaceholder = isComponentPlaceholderId(component == null ? void 0 : component._id);
|
|
836
858
|
childNode = createElement3(
|
|
837
859
|
PureContextualEditingComponentWrapper,
|
|
838
860
|
{
|
|
839
861
|
key: `${slotName}-${componentIndex}-wrapper`,
|
|
840
|
-
isPlaceholder
|
|
862
|
+
isPlaceholder,
|
|
841
863
|
parentComponent: parent,
|
|
842
864
|
component,
|
|
843
865
|
slotName,
|
|
@@ -891,7 +913,7 @@ import {
|
|
|
891
913
|
} from "@uniformdev/canvas-next-rsc-client";
|
|
892
914
|
import { getServerConfig as getServerConfig4 } from "@uniformdev/canvas-next-rsc-shared";
|
|
893
915
|
import { Suspense } from "react";
|
|
894
|
-
import
|
|
916
|
+
import React6 from "react";
|
|
895
917
|
var UniformContext = async ({
|
|
896
918
|
clientContextComponent,
|
|
897
919
|
children
|
|
@@ -902,16 +924,16 @@ var UniformContext = async ({
|
|
|
902
924
|
});
|
|
903
925
|
const ContextComponent = clientContextComponent || DefaultUniformClientContext;
|
|
904
926
|
const disableDevTools = ((_a = getServerConfig4().context) == null ? void 0 : _a.disableDevTools) || false;
|
|
905
|
-
return /* @__PURE__ */
|
|
927
|
+
return /* @__PURE__ */ React6.createElement(React6.Fragment, null, children, /* @__PURE__ */ React6.createElement(ContextComponent, { manifest, disableDevTools }), /* @__PURE__ */ React6.createElement(Suspense, { fallback: /* @__PURE__ */ React6.createElement(React6.Fragment, null) }, /* @__PURE__ */ React6.createElement(UniformScript, null)));
|
|
906
928
|
};
|
|
907
929
|
|
|
908
930
|
// src/components/UniformPlayground.tsx
|
|
909
931
|
import { CANVAS_DRAFT_STATE as CANVAS_DRAFT_STATE3, CANVAS_EDITOR_STATE as CANVAS_EDITOR_STATE3 } from "@uniformdev/canvas";
|
|
910
932
|
import { notFound as notFound2 } from "next/navigation";
|
|
911
|
-
import
|
|
933
|
+
import React7 from "react";
|
|
912
934
|
var UniformPlayground = async ({ searchParams, ...rest }) => {
|
|
913
935
|
if (!isDraftModeEnabled({ searchParams })) {
|
|
914
|
-
return /* @__PURE__ */
|
|
936
|
+
return /* @__PURE__ */ React7.createElement("div", null, /* @__PURE__ */ React7.createElement("h1", null, "Playground is only available in draft mode"));
|
|
915
937
|
}
|
|
916
938
|
const id = searchParams["id"];
|
|
917
939
|
if (!id) {
|
|
@@ -942,7 +964,7 @@ var UniformPlayground = async ({ searchParams, ...rest }) => {
|
|
|
942
964
|
if (!composition) {
|
|
943
965
|
notFound2();
|
|
944
966
|
}
|
|
945
|
-
return /* @__PURE__ */
|
|
967
|
+
return /* @__PURE__ */ React7.createElement(
|
|
946
968
|
UniformComposition,
|
|
947
969
|
{
|
|
948
970
|
mode: "server",
|
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);
|
|
@@ -444,12 +444,12 @@ async function generateStaticParams() {
|
|
|
444
444
|
|
|
445
445
|
// src/components/UniformComposition.ts
|
|
446
446
|
var import_canvas7 = require("@uniformdev/canvas");
|
|
447
|
-
var
|
|
448
|
-
var
|
|
447
|
+
var import_canvas_next_rsc_client6 = require("@uniformdev/canvas-next-rsc-client");
|
|
448
|
+
var import_canvas_next_rsc_shared7 = require("@uniformdev/canvas-next-rsc-shared");
|
|
449
449
|
var import_core = require("@uniformdev/canvas-react/core");
|
|
450
450
|
var import_headers3 = require("next/headers");
|
|
451
451
|
var import_navigation = require("next/navigation");
|
|
452
|
-
var
|
|
452
|
+
var import_react8 = require("react");
|
|
453
453
|
|
|
454
454
|
// src/context/createServerUniformContext.ts
|
|
455
455
|
var import_canvas_next_rsc_shared2 = require("@uniformdev/canvas-next-rsc-shared");
|
|
@@ -481,11 +481,7 @@ var createServerUniformContextFromManifest = async (options) => {
|
|
|
481
481
|
var import_canvas4 = require("@uniformdev/canvas");
|
|
482
482
|
var import_canvas_next_rsc_shared3 = require("@uniformdev/canvas-next-rsc-shared");
|
|
483
483
|
var import_redirect = require("@uniformdev/redirect");
|
|
484
|
-
var retrieveRoute = async ({
|
|
485
|
-
params,
|
|
486
|
-
searchParams,
|
|
487
|
-
skipPrefetch
|
|
488
|
-
}) => {
|
|
484
|
+
var retrieveRoute = async ({ params, searchParams, skipPrefetch }, fetchOptions) => {
|
|
489
485
|
if (!skipPrefetch) {
|
|
490
486
|
void getManifest({
|
|
491
487
|
searchParams
|
|
@@ -505,7 +501,8 @@ var retrieveRoute = async ({
|
|
|
505
501
|
result = await retrieveRouteByPath({
|
|
506
502
|
path: value,
|
|
507
503
|
state,
|
|
508
|
-
searchParams
|
|
504
|
+
searchParams,
|
|
505
|
+
fetchOptions
|
|
509
506
|
});
|
|
510
507
|
} catch (e) {
|
|
511
508
|
console.warn(`Failed to retrieve route by path: ${value} with state ${state}`, e);
|
|
@@ -539,30 +536,39 @@ var retrieveRoute = async ({
|
|
|
539
536
|
var retrieveRouteByPath = async ({
|
|
540
537
|
path,
|
|
541
538
|
state,
|
|
542
|
-
searchParams
|
|
539
|
+
searchParams,
|
|
540
|
+
fetchOptions
|
|
543
541
|
}) => {
|
|
544
542
|
var _a;
|
|
545
543
|
const client = getDefaultRouteClient({
|
|
546
544
|
searchParams
|
|
547
545
|
});
|
|
546
|
+
let queryPath = path;
|
|
547
|
+
if (searchParams && Object.keys(searchParams).length > 0) {
|
|
548
|
+
const helper = new URL((0, import_canvas_next_rsc_shared3.getBaseUrl)());
|
|
549
|
+
helper.pathname = path;
|
|
550
|
+
Object.entries(searchParams).forEach(([key, value]) => {
|
|
551
|
+
if (typeof value === "string") {
|
|
552
|
+
helper.searchParams.set(key, value);
|
|
553
|
+
}
|
|
554
|
+
});
|
|
555
|
+
if (helper.searchParams.size > 0) {
|
|
556
|
+
queryPath = `${helper.pathname}${helper.search}`;
|
|
557
|
+
}
|
|
558
|
+
}
|
|
548
559
|
return await client.getRoute({
|
|
549
|
-
|
|
560
|
+
...fetchOptions,
|
|
561
|
+
path: queryPath,
|
|
550
562
|
state,
|
|
551
563
|
withComponentIDs: true,
|
|
552
564
|
withContentSourceMap: isOnVercelPreviewEnvironment() && ((_a = (0, import_canvas_next_rsc_shared3.getServerConfig)().experimental) == null ? void 0 : _a.vercelVisualEditing)
|
|
553
565
|
});
|
|
554
566
|
};
|
|
555
567
|
var resolveRedirectHref = (resolveResult, path) => {
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
const url = new URL(expandedUrl);
|
|
561
|
-
href = url.pathname;
|
|
562
|
-
} else {
|
|
563
|
-
href = resolveResult.redirect.targetUrl;
|
|
564
|
-
}
|
|
565
|
-
return href;
|
|
568
|
+
const requestUrl = `${(0, import_canvas_next_rsc_shared3.getBaseUrl)()}${path}`;
|
|
569
|
+
const expandedUrl = (0, import_redirect.getTargetVariableExpandedUrl)(requestUrl, resolveResult.redirect);
|
|
570
|
+
const url = new URL(expandedUrl);
|
|
571
|
+
return url.pathname;
|
|
566
572
|
};
|
|
567
573
|
var determineState = ({ searchParams }) => {
|
|
568
574
|
const draftMode2 = isDraftModeEnabled({ searchParams });
|
|
@@ -602,39 +608,51 @@ var PersonalizeClientWrapper = (props) => {
|
|
|
602
608
|
// src/components/PersonalizeServer.ts
|
|
603
609
|
var import_canvas5 = require("@uniformdev/canvas");
|
|
604
610
|
var import_canvas_next_rsc_shared5 = require("@uniformdev/canvas-next-rsc-shared");
|
|
605
|
-
var
|
|
611
|
+
var import_react5 = require("react");
|
|
612
|
+
|
|
613
|
+
// src/components/ContextPersonalizationTransfer.tsx
|
|
614
|
+
var import_canvas_next_rsc_client4 = require("@uniformdev/canvas-next-rsc-client");
|
|
615
|
+
var import_react4 = __toESM(require("react"));
|
|
616
|
+
var ContextPersonalizationTransfer = ({ event }) => {
|
|
617
|
+
return /* @__PURE__ */ import_react4.default.createElement(import_canvas_next_rsc_client4.ClientContextPersonalizationTransfer, { ts: (/* @__PURE__ */ new Date()).valueOf(), event });
|
|
618
|
+
};
|
|
619
|
+
|
|
620
|
+
// src/components/PersonalizeServer.ts
|
|
606
621
|
var PersonalizeServer = (props) => {
|
|
607
622
|
var _a;
|
|
608
|
-
const { indexes } = (0, import_canvas_next_rsc_shared5.runPersonalization)(props);
|
|
623
|
+
const { indexes, event } = (0, import_canvas_next_rsc_shared5.runPersonalization)(props);
|
|
609
624
|
const slot = (_a = props.slots) == null ? void 0 : _a[import_canvas5.CANVAS_PERSONALIZE_SLOT];
|
|
610
625
|
const components = indexes.map((index) => {
|
|
611
626
|
const component = slot.items[index];
|
|
612
627
|
return component;
|
|
613
628
|
});
|
|
614
|
-
|
|
629
|
+
const eventElement = (0, import_react5.createElement)(ContextPersonalizationTransfer, {
|
|
630
|
+
event
|
|
631
|
+
});
|
|
632
|
+
return (0, import_react5.createElement)(import_react5.Fragment, void 0, [...components, eventElement]);
|
|
615
633
|
};
|
|
616
634
|
|
|
617
635
|
// src/components/TestServer.ts
|
|
618
636
|
var import_canvas6 = require("@uniformdev/canvas");
|
|
619
|
-
var
|
|
620
|
-
var
|
|
637
|
+
var import_canvas_next_rsc_shared6 = require("@uniformdev/canvas-next-rsc-shared");
|
|
638
|
+
var import_react7 = require("react");
|
|
639
|
+
|
|
640
|
+
// src/components/ContextTestTransfer.tsx
|
|
641
|
+
var import_canvas_next_rsc_client5 = require("@uniformdev/canvas-next-rsc-client");
|
|
642
|
+
var import_react6 = __toESM(require("react"));
|
|
643
|
+
var ContextTestTransfer = ({ event }) => {
|
|
644
|
+
return /* @__PURE__ */ import_react6.default.createElement(import_canvas_next_rsc_client5.ClientContextTestTransfer, { ts: (/* @__PURE__ */ new Date()).valueOf(), event });
|
|
645
|
+
};
|
|
646
|
+
|
|
647
|
+
// src/components/TestServer.ts
|
|
648
|
+
var TestServer = (props) => {
|
|
621
649
|
var _a, _b, _c;
|
|
622
|
-
const
|
|
623
|
-
const
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
var _a2, _b2, _c2;
|
|
627
|
-
const contextTag = (_b2 = (_a2 = v.parameters) == null ? void 0 : _a2[import_canvas6.CANVAS_TEST_VARIANT_PARAM]) == null ? void 0 : _b2.value;
|
|
628
|
-
const id = (_c2 = contextTag == null ? void 0 : contextTag.id) != null ? _c2 : "testId" in v ? v.testId : `ab-${i}-${v.type}`;
|
|
629
|
-
return {
|
|
630
|
-
id,
|
|
631
|
-
testDistribution: contextTag == null ? void 0 : contextTag.testDistribution,
|
|
632
|
-
index: i
|
|
633
|
-
};
|
|
634
|
-
})
|
|
650
|
+
const { index, event } = (0, import_canvas_next_rsc_shared6.runTest)(props);
|
|
651
|
+
const component = typeof index === "number" ? (_c = (_b = (_a = props.slots) == null ? void 0 : _a[import_canvas6.CANVAS_TEST_SLOT]) == null ? void 0 : _b.items[index]) != null ? _c : null : null;
|
|
652
|
+
const eventElement = (0, import_react7.createElement)(ContextTestTransfer, {
|
|
653
|
+
event
|
|
635
654
|
});
|
|
636
|
-
|
|
637
|
-
return (0, import_react5.createElement)(import_react5.Fragment, void 0, components);
|
|
655
|
+
return (0, import_react7.createElement)(import_react7.Fragment, void 0, [component, eventElement]);
|
|
638
656
|
};
|
|
639
657
|
|
|
640
658
|
// src/components/UniformComposition.ts
|
|
@@ -653,7 +671,7 @@ var UniformComposition = async ({
|
|
|
653
671
|
});
|
|
654
672
|
searchParams = props.searchParams;
|
|
655
673
|
}
|
|
656
|
-
const { value: path } = (0,
|
|
674
|
+
const { value: path } = (0, import_canvas_next_rsc_shared7.resolvePath)(props);
|
|
657
675
|
if (!route || route.type === "notFound") {
|
|
658
676
|
(0, import_navigation.notFound)();
|
|
659
677
|
}
|
|
@@ -699,7 +717,7 @@ var UniformComposition = async ({
|
|
|
699
717
|
if (props.mode === "server") {
|
|
700
718
|
const headersValue = (0, import_headers3.headers)();
|
|
701
719
|
const missingQuirkValue = "unknown";
|
|
702
|
-
transfer = (0,
|
|
720
|
+
transfer = (0, import_react8.createElement)(ContextUpdateTransfer, {
|
|
703
721
|
serverContext,
|
|
704
722
|
update: {
|
|
705
723
|
params: props.params,
|
|
@@ -716,9 +734,9 @@ var UniformComposition = async ({
|
|
|
716
734
|
}
|
|
717
735
|
});
|
|
718
736
|
} else if (props.mode === "static") {
|
|
719
|
-
transfer = (0,
|
|
737
|
+
transfer = (0, import_react8.createElement)(ContextUpdateTrigger);
|
|
720
738
|
}
|
|
721
|
-
return (0,
|
|
739
|
+
return (0, import_react8.createElement)(import_react8.Fragment, void 0, transfer, resolved);
|
|
722
740
|
};
|
|
723
741
|
var isServerComponent = ({
|
|
724
742
|
component,
|
|
@@ -726,10 +744,10 @@ var isServerComponent = ({
|
|
|
726
744
|
}) => {
|
|
727
745
|
var _a, _b;
|
|
728
746
|
if (component.type === import_canvas7.CANVAS_PERSONALIZE_TYPE) {
|
|
729
|
-
return serverContext && ((_a = (0,
|
|
747
|
+
return serverContext && ((_a = (0, import_canvas_next_rsc_shared7.getServerConfig)().evaluation) == null ? void 0 : _a.personalization) !== "client";
|
|
730
748
|
}
|
|
731
749
|
if (component.type === import_canvas7.CANVAS_TEST_TYPE) {
|
|
732
|
-
return serverContext && ((_b = (0,
|
|
750
|
+
return serverContext && ((_b = (0, import_canvas_next_rsc_shared7.getServerConfig)().evaluation) == null ? void 0 : _b.testing) !== "client";
|
|
733
751
|
}
|
|
734
752
|
};
|
|
735
753
|
var resolveSystemComponent = ({
|
|
@@ -744,7 +762,7 @@ var resolveSystemComponent = ({
|
|
|
744
762
|
return server ? PersonalizeServer : PersonalizeClientWrapper;
|
|
745
763
|
}
|
|
746
764
|
if (component.type === import_canvas7.CANVAS_TEST_TYPE) {
|
|
747
|
-
return server ? TestServer :
|
|
765
|
+
return server ? TestServer : import_canvas_next_rsc_client6.TestClient;
|
|
748
766
|
}
|
|
749
767
|
return null;
|
|
750
768
|
};
|
|
@@ -853,12 +871,14 @@ var resolveComponents = ({
|
|
|
853
871
|
component,
|
|
854
872
|
slots,
|
|
855
873
|
contextInstance: isServer || includeContext ? serverContext : void 0,
|
|
856
|
-
context: compositionContext
|
|
874
|
+
context: compositionContext,
|
|
875
|
+
slotName,
|
|
876
|
+
slotIndex: isRoot ? void 0 : componentIndex
|
|
857
877
|
};
|
|
858
|
-
const element = (0,
|
|
878
|
+
const element = (0, import_react8.createElement)(resolvedComponent, componentProps);
|
|
859
879
|
let tagElement = null;
|
|
860
880
|
if (enrichmentTags == null ? void 0 : enrichmentTags.length) {
|
|
861
|
-
tagElement = (0,
|
|
881
|
+
tagElement = (0, import_react8.createElement)(ContextUpdateTransfer, {
|
|
862
882
|
key: `${slotName}-${componentIndex}-tags`,
|
|
863
883
|
update: {
|
|
864
884
|
enrichments: enrichmentTags
|
|
@@ -872,11 +892,12 @@ var resolveComponents = ({
|
|
|
872
892
|
if (tagElement) {
|
|
873
893
|
elements.push(tagElement);
|
|
874
894
|
}
|
|
875
|
-
|
|
895
|
+
const isPlaceholder = (0, import_canvas7.isComponentPlaceholderId)(component == null ? void 0 : component._id);
|
|
896
|
+
childNode = (0, import_react8.createElement)(
|
|
876
897
|
import_core.PureContextualEditingComponentWrapper,
|
|
877
898
|
{
|
|
878
899
|
key: `${slotName}-${componentIndex}-wrapper`,
|
|
879
|
-
isPlaceholder
|
|
900
|
+
isPlaceholder,
|
|
880
901
|
parentComponent: parent,
|
|
881
902
|
component,
|
|
882
903
|
slotName,
|
|
@@ -891,8 +912,8 @@ var resolveComponents = ({
|
|
|
891
912
|
if (tagElement) {
|
|
892
913
|
elements.push(tagElement);
|
|
893
914
|
}
|
|
894
|
-
childNode = (0,
|
|
895
|
-
|
|
915
|
+
childNode = (0, import_react8.createElement)(
|
|
916
|
+
import_canvas_next_rsc_client6.ClientContextualEditingComponentWrapper,
|
|
896
917
|
{
|
|
897
918
|
key: `${slotName}-${componentIndex}-wrapper`,
|
|
898
919
|
isPlaceholder: false,
|
|
@@ -912,8 +933,8 @@ var resolveComponents = ({
|
|
|
912
933
|
}
|
|
913
934
|
childNode = elements;
|
|
914
935
|
}
|
|
915
|
-
return (0,
|
|
916
|
-
|
|
936
|
+
return (0, import_react8.createElement)(
|
|
937
|
+
import_react8.Fragment,
|
|
917
938
|
{
|
|
918
939
|
key: !isRoot ? `${slotName}-${componentIndex}` : void 0
|
|
919
940
|
},
|
|
@@ -924,10 +945,10 @@ var resolveComponents = ({
|
|
|
924
945
|
};
|
|
925
946
|
|
|
926
947
|
// src/components/UniformContext.tsx
|
|
927
|
-
var
|
|
928
|
-
var
|
|
929
|
-
var
|
|
930
|
-
var
|
|
948
|
+
var import_canvas_next_rsc_client7 = require("@uniformdev/canvas-next-rsc-client");
|
|
949
|
+
var import_canvas_next_rsc_shared8 = require("@uniformdev/canvas-next-rsc-shared");
|
|
950
|
+
var import_react9 = require("react");
|
|
951
|
+
var import_react10 = __toESM(require("react"));
|
|
931
952
|
var UniformContext = async ({
|
|
932
953
|
clientContextComponent,
|
|
933
954
|
children
|
|
@@ -936,18 +957,18 @@ var UniformContext = async ({
|
|
|
936
957
|
const manifest = await getManifest({
|
|
937
958
|
searchParams: {}
|
|
938
959
|
});
|
|
939
|
-
const ContextComponent = clientContextComponent ||
|
|
940
|
-
const disableDevTools = ((_a = (0,
|
|
941
|
-
return /* @__PURE__ */
|
|
960
|
+
const ContextComponent = clientContextComponent || import_canvas_next_rsc_client7.DefaultUniformClientContext;
|
|
961
|
+
const disableDevTools = ((_a = (0, import_canvas_next_rsc_shared8.getServerConfig)().context) == null ? void 0 : _a.disableDevTools) || false;
|
|
962
|
+
return /* @__PURE__ */ import_react10.default.createElement(import_react10.default.Fragment, null, children, /* @__PURE__ */ import_react10.default.createElement(ContextComponent, { manifest, disableDevTools }), /* @__PURE__ */ import_react10.default.createElement(import_react9.Suspense, { fallback: /* @__PURE__ */ import_react10.default.createElement(import_react10.default.Fragment, null) }, /* @__PURE__ */ import_react10.default.createElement(import_canvas_next_rsc_client7.UniformScript, null)));
|
|
942
963
|
};
|
|
943
964
|
|
|
944
965
|
// src/components/UniformPlayground.tsx
|
|
945
966
|
var import_canvas8 = require("@uniformdev/canvas");
|
|
946
967
|
var import_navigation2 = require("next/navigation");
|
|
947
|
-
var
|
|
968
|
+
var import_react11 = __toESM(require("react"));
|
|
948
969
|
var UniformPlayground = async ({ searchParams, ...rest }) => {
|
|
949
970
|
if (!isDraftModeEnabled({ searchParams })) {
|
|
950
|
-
return /* @__PURE__ */
|
|
971
|
+
return /* @__PURE__ */ import_react11.default.createElement("div", null, /* @__PURE__ */ import_react11.default.createElement("h1", null, "Playground is only available in draft mode"));
|
|
951
972
|
}
|
|
952
973
|
const id = searchParams["id"];
|
|
953
974
|
if (!id) {
|
|
@@ -978,7 +999,7 @@ var UniformPlayground = async ({ searchParams, ...rest }) => {
|
|
|
978
999
|
if (!composition) {
|
|
979
1000
|
(0, import_navigation2.notFound)();
|
|
980
1001
|
}
|
|
981
|
-
return /* @__PURE__ */
|
|
1002
|
+
return /* @__PURE__ */ import_react11.default.createElement(
|
|
982
1003
|
UniformComposition,
|
|
983
1004
|
{
|
|
984
1005
|
mode: "server",
|