@uniformdev/canvas-next-rsc 19.207.1-alpha.28 → 19.208.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm.js +33 -11
- package/dist/index.js +63 -41
- package/dist/index.mjs +33 -11
- package/package.json +11 -11
package/dist/index.esm.js
CHANGED
|
@@ -679,6 +679,24 @@ var PersonalizeServer = (props) => {
|
|
|
679
679
|
return createElement(Fragment, void 0, [...components, eventElement]);
|
|
680
680
|
};
|
|
681
681
|
|
|
682
|
+
// src/components/PersonalizeServerHybrid.tsx
|
|
683
|
+
import { PersonalizeClient as PersonalizeClient2 } from "@uniformdev/canvas-next-rsc-client";
|
|
684
|
+
import { runPersonalization as runPersonalization3 } from "@uniformdev/canvas-next-rsc-shared";
|
|
685
|
+
import React5 from "react";
|
|
686
|
+
var PersonalizeServerHybrid = (props) => {
|
|
687
|
+
const { indexes } = runPersonalization3(props);
|
|
688
|
+
return /* @__PURE__ */ React5.createElement(
|
|
689
|
+
PersonalizeClient2,
|
|
690
|
+
{
|
|
691
|
+
component: props.component,
|
|
692
|
+
count: props.count,
|
|
693
|
+
slots: props.slots,
|
|
694
|
+
trackingEventName: props.trackingEventName,
|
|
695
|
+
indexes
|
|
696
|
+
}
|
|
697
|
+
);
|
|
698
|
+
};
|
|
699
|
+
|
|
682
700
|
// src/components/TestServer.ts
|
|
683
701
|
import { CANVAS_TEST_SLOT } from "@uniformdev/canvas";
|
|
684
702
|
import {
|
|
@@ -689,9 +707,9 @@ import { createElement as createElement2, Fragment as Fragment2 } from "react";
|
|
|
689
707
|
|
|
690
708
|
// src/components/ContextTestTransfer.tsx
|
|
691
709
|
import { ClientContextTestTransfer } from "@uniformdev/canvas-next-rsc-client";
|
|
692
|
-
import
|
|
710
|
+
import React6 from "react";
|
|
693
711
|
var ContextTestTransfer = ({ event }) => {
|
|
694
|
-
return /* @__PURE__ */
|
|
712
|
+
return /* @__PURE__ */ React6.createElement(ClientContextTestTransfer, { ts: (/* @__PURE__ */ new Date()).valueOf(), event });
|
|
695
713
|
};
|
|
696
714
|
|
|
697
715
|
// src/components/TestServer.ts
|
|
@@ -718,7 +736,7 @@ import {
|
|
|
718
736
|
evaluateNodeVisibilityParameter
|
|
719
737
|
} from "@uniformdev/canvas";
|
|
720
738
|
import { VisibilityRulesWrapperClient } from "@uniformdev/canvas-next-rsc-client";
|
|
721
|
-
import
|
|
739
|
+
import React7 from "react";
|
|
722
740
|
var VisibilityRulesWrapper = (props) => {
|
|
723
741
|
const { context, ...rest } = props;
|
|
724
742
|
let isVisible = null;
|
|
@@ -729,7 +747,7 @@ var VisibilityRulesWrapper = (props) => {
|
|
|
729
747
|
parameter: props.parameter
|
|
730
748
|
});
|
|
731
749
|
}
|
|
732
|
-
return /* @__PURE__ */
|
|
750
|
+
return /* @__PURE__ */ React7.createElement(VisibilityRulesWrapperClient, { ...rest, initialIsVisible: isVisible });
|
|
733
751
|
};
|
|
734
752
|
|
|
735
753
|
// src/components/UniformComposition.ts
|
|
@@ -842,7 +860,7 @@ var resolveSystemComponent = ({
|
|
|
842
860
|
let resolved = null;
|
|
843
861
|
let suspense = void 0;
|
|
844
862
|
if (component.type === CANVAS_PERSONALIZE_TYPE) {
|
|
845
|
-
resolved = server ?
|
|
863
|
+
resolved = server ? resolveServerPersonalizeComponent({ config }) : PersonalizeClientWrapper;
|
|
846
864
|
suspense = server && ((_a = config.ppr) == null ? void 0 : _a.personalizationSuspense);
|
|
847
865
|
}
|
|
848
866
|
if (component.type === CANVAS_TEST_TYPE) {
|
|
@@ -854,6 +872,10 @@ var resolveSystemComponent = ({
|
|
|
854
872
|
suspense
|
|
855
873
|
};
|
|
856
874
|
};
|
|
875
|
+
var resolveServerPersonalizeComponent = ({ config }) => {
|
|
876
|
+
var _a;
|
|
877
|
+
return ((_a = config.evaluation) == null ? void 0 : _a.personalization) === "hybrid" ? PersonalizeServerHybrid : PersonalizeServer;
|
|
878
|
+
};
|
|
857
879
|
var resolveSlots = ({
|
|
858
880
|
component,
|
|
859
881
|
root,
|
|
@@ -1069,7 +1091,7 @@ import {
|
|
|
1069
1091
|
UniformScript
|
|
1070
1092
|
} from "@uniformdev/canvas-next-rsc-client";
|
|
1071
1093
|
import { Suspense as Suspense2 } from "react";
|
|
1072
|
-
import
|
|
1094
|
+
import React8 from "react";
|
|
1073
1095
|
var UniformContext = async ({
|
|
1074
1096
|
clientContextComponent,
|
|
1075
1097
|
children
|
|
@@ -1083,7 +1105,7 @@ var UniformContext = async ({
|
|
|
1083
1105
|
const disableDevTools = ((_a = serverConfig2.context) == null ? void 0 : _a.disableDevTools) || false;
|
|
1084
1106
|
const defaultConsent = serverConfig2.defaultConsent || false;
|
|
1085
1107
|
const experimentalQuirkSerialization = ((_b = serverConfig2.experimental) == null ? void 0 : _b.quirkSerialization) || false;
|
|
1086
|
-
return /* @__PURE__ */
|
|
1108
|
+
return /* @__PURE__ */ React8.createElement(React8.Fragment, null, children, /* @__PURE__ */ React8.createElement(
|
|
1087
1109
|
ContextComponent,
|
|
1088
1110
|
{
|
|
1089
1111
|
manifest,
|
|
@@ -1091,16 +1113,16 @@ var UniformContext = async ({
|
|
|
1091
1113
|
defaultConsent,
|
|
1092
1114
|
experimentalQuirkSerialization
|
|
1093
1115
|
}
|
|
1094
|
-
), /* @__PURE__ */
|
|
1116
|
+
), /* @__PURE__ */ React8.createElement(Suspense2, { fallback: /* @__PURE__ */ React8.createElement(React8.Fragment, null) }, /* @__PURE__ */ React8.createElement(UniformScript, null)));
|
|
1095
1117
|
};
|
|
1096
1118
|
|
|
1097
1119
|
// src/components/UniformPlayground.tsx
|
|
1098
1120
|
import { CANVAS_DRAFT_STATE as CANVAS_DRAFT_STATE3, CANVAS_EDITOR_STATE as CANVAS_EDITOR_STATE3 } from "@uniformdev/canvas";
|
|
1099
1121
|
import { notFound as notFound2 } from "next/navigation";
|
|
1100
|
-
import
|
|
1122
|
+
import React9 from "react";
|
|
1101
1123
|
var UniformPlayground = async ({ searchParams, ...rest }) => {
|
|
1102
1124
|
if (!isDraftModeEnabled({ searchParams })) {
|
|
1103
|
-
return /* @__PURE__ */
|
|
1125
|
+
return /* @__PURE__ */ React9.createElement("div", null, /* @__PURE__ */ React9.createElement("h1", null, "Playground is only available in draft mode"));
|
|
1104
1126
|
}
|
|
1105
1127
|
const id = searchParams["id"];
|
|
1106
1128
|
if (!id) {
|
|
@@ -1131,7 +1153,7 @@ var UniformPlayground = async ({ searchParams, ...rest }) => {
|
|
|
1131
1153
|
if (!composition) {
|
|
1132
1154
|
notFound2();
|
|
1133
1155
|
}
|
|
1134
|
-
return /* @__PURE__ */
|
|
1156
|
+
return /* @__PURE__ */ React9.createElement(
|
|
1135
1157
|
UniformComposition,
|
|
1136
1158
|
{
|
|
1137
1159
|
mode: "server",
|
package/dist/index.js
CHANGED
|
@@ -472,12 +472,12 @@ async function generateStaticParams() {
|
|
|
472
472
|
|
|
473
473
|
// src/components/UniformComposition.ts
|
|
474
474
|
var import_canvas8 = require("@uniformdev/canvas");
|
|
475
|
-
var
|
|
476
|
-
var
|
|
475
|
+
var import_canvas_next_rsc_client8 = require("@uniformdev/canvas-next-rsc-client");
|
|
476
|
+
var import_canvas_next_rsc_shared7 = require("@uniformdev/canvas-next-rsc-shared");
|
|
477
477
|
var import_core = require("@uniformdev/canvas-react/core");
|
|
478
478
|
var import_headers3 = require("next/headers");
|
|
479
479
|
var import_navigation = require("next/navigation");
|
|
480
|
-
var
|
|
480
|
+
var import_react10 = require("react");
|
|
481
481
|
|
|
482
482
|
// src/context/createServerUniformContext.ts
|
|
483
483
|
var import_canvas_next_rsc_shared = require("@uniformdev/canvas-next-rsc-shared");
|
|
@@ -711,17 +711,35 @@ var PersonalizeServer = (props) => {
|
|
|
711
711
|
return (0, import_react5.createElement)(import_react5.Fragment, void 0, [...components, eventElement]);
|
|
712
712
|
};
|
|
713
713
|
|
|
714
|
+
// src/components/PersonalizeServerHybrid.tsx
|
|
715
|
+
var import_canvas_next_rsc_client5 = require("@uniformdev/canvas-next-rsc-client");
|
|
716
|
+
var import_canvas_next_rsc_shared5 = require("@uniformdev/canvas-next-rsc-shared");
|
|
717
|
+
var import_react6 = __toESM(require("react"));
|
|
718
|
+
var PersonalizeServerHybrid = (props) => {
|
|
719
|
+
const { indexes } = (0, import_canvas_next_rsc_shared5.runPersonalization)(props);
|
|
720
|
+
return /* @__PURE__ */ import_react6.default.createElement(
|
|
721
|
+
import_canvas_next_rsc_client5.PersonalizeClient,
|
|
722
|
+
{
|
|
723
|
+
component: props.component,
|
|
724
|
+
count: props.count,
|
|
725
|
+
slots: props.slots,
|
|
726
|
+
trackingEventName: props.trackingEventName,
|
|
727
|
+
indexes
|
|
728
|
+
}
|
|
729
|
+
);
|
|
730
|
+
};
|
|
731
|
+
|
|
714
732
|
// src/components/TestServer.ts
|
|
715
733
|
var import_canvas6 = require("@uniformdev/canvas");
|
|
716
|
-
var
|
|
734
|
+
var import_canvas_next_rsc_shared6 = require("@uniformdev/canvas-next-rsc-shared");
|
|
717
735
|
var import_cache2 = require("next/cache");
|
|
718
|
-
var
|
|
736
|
+
var import_react8 = require("react");
|
|
719
737
|
|
|
720
738
|
// src/components/ContextTestTransfer.tsx
|
|
721
|
-
var
|
|
722
|
-
var
|
|
739
|
+
var import_canvas_next_rsc_client6 = require("@uniformdev/canvas-next-rsc-client");
|
|
740
|
+
var import_react7 = __toESM(require("react"));
|
|
723
741
|
var ContextTestTransfer = ({ event }) => {
|
|
724
|
-
return /* @__PURE__ */
|
|
742
|
+
return /* @__PURE__ */ import_react7.default.createElement(import_canvas_next_rsc_client6.ClientContextTestTransfer, { ts: (/* @__PURE__ */ new Date()).valueOf(), event });
|
|
725
743
|
};
|
|
726
744
|
|
|
727
745
|
// src/components/TestServer.ts
|
|
@@ -730,22 +748,22 @@ var TestServer = async (props) => {
|
|
|
730
748
|
if ((_a = getServerConfig().ppr) == null ? void 0 : _a.testSuspense) {
|
|
731
749
|
(0, import_cache2.unstable_noStore)();
|
|
732
750
|
}
|
|
733
|
-
const { index, event } = (0,
|
|
751
|
+
const { index, event } = (0, import_canvas_next_rsc_shared6.runTest)(props);
|
|
734
752
|
if (index === null || event === null) {
|
|
735
753
|
return null;
|
|
736
754
|
}
|
|
737
755
|
const component = typeof index === "number" ? (_d = (_c = (_b = props.slots) == null ? void 0 : _b[import_canvas6.CANVAS_TEST_SLOT]) == null ? void 0 : _c.items[index]) != null ? _d : null : null;
|
|
738
|
-
const eventElement = (0,
|
|
756
|
+
const eventElement = (0, import_react8.createElement)(ContextTestTransfer, {
|
|
739
757
|
event,
|
|
740
758
|
key: `${props.slotName}-${props.slotIndex}-server-transfer`
|
|
741
759
|
});
|
|
742
|
-
return (0,
|
|
760
|
+
return (0, import_react8.createElement)(import_react8.Fragment, void 0, [component, eventElement]);
|
|
743
761
|
};
|
|
744
762
|
|
|
745
763
|
// src/components/VisibilityRulesWrapper.tsx
|
|
746
764
|
var import_canvas7 = require("@uniformdev/canvas");
|
|
747
|
-
var
|
|
748
|
-
var
|
|
765
|
+
var import_canvas_next_rsc_client7 = require("@uniformdev/canvas-next-rsc-client");
|
|
766
|
+
var import_react9 = __toESM(require("react"));
|
|
749
767
|
var VisibilityRulesWrapper = (props) => {
|
|
750
768
|
const { context, ...rest } = props;
|
|
751
769
|
let isVisible = null;
|
|
@@ -756,7 +774,7 @@ var VisibilityRulesWrapper = (props) => {
|
|
|
756
774
|
parameter: props.parameter
|
|
757
775
|
});
|
|
758
776
|
}
|
|
759
|
-
return /* @__PURE__ */
|
|
777
|
+
return /* @__PURE__ */ import_react9.default.createElement(import_canvas_next_rsc_client7.VisibilityRulesWrapperClient, { ...rest, initialIsVisible: isVisible });
|
|
760
778
|
};
|
|
761
779
|
|
|
762
780
|
// src/components/UniformComposition.ts
|
|
@@ -775,7 +793,7 @@ var UniformComposition = async ({
|
|
|
775
793
|
});
|
|
776
794
|
searchParams = props.searchParams;
|
|
777
795
|
}
|
|
778
|
-
const { value: path } = (0,
|
|
796
|
+
const { value: path } = (0, import_canvas_next_rsc_shared7.resolvePath)(props);
|
|
779
797
|
if (!route || route.type === "notFound") {
|
|
780
798
|
(0, import_navigation.notFound)();
|
|
781
799
|
}
|
|
@@ -822,7 +840,7 @@ var UniformComposition = async ({
|
|
|
822
840
|
if (props.mode === "server") {
|
|
823
841
|
const headersValue = (0, import_headers3.headers)();
|
|
824
842
|
const missingQuirkValue = "unknown";
|
|
825
|
-
transfer = (0,
|
|
843
|
+
transfer = (0, import_react10.createElement)(ContextUpdateTransfer, {
|
|
826
844
|
serverContext,
|
|
827
845
|
update: {
|
|
828
846
|
params: props.params,
|
|
@@ -842,11 +860,11 @@ var UniformComposition = async ({
|
|
|
842
860
|
}
|
|
843
861
|
});
|
|
844
862
|
} else if (props.mode === "static") {
|
|
845
|
-
transfer = (0,
|
|
863
|
+
transfer = (0, import_react10.createElement)(ContextUpdateTrigger, {
|
|
846
864
|
path
|
|
847
865
|
});
|
|
848
866
|
}
|
|
849
|
-
return (0,
|
|
867
|
+
return (0, import_react10.createElement)(import_react10.Fragment, void 0, transfer, resolved);
|
|
850
868
|
};
|
|
851
869
|
var isServerComponent = ({
|
|
852
870
|
component,
|
|
@@ -869,11 +887,11 @@ var resolveSystemComponent = ({
|
|
|
869
887
|
let resolved = null;
|
|
870
888
|
let suspense = void 0;
|
|
871
889
|
if (component.type === import_canvas8.CANVAS_PERSONALIZE_TYPE) {
|
|
872
|
-
resolved = server ?
|
|
890
|
+
resolved = server ? resolveServerPersonalizeComponent({ config }) : PersonalizeClientWrapper;
|
|
873
891
|
suspense = server && ((_a = config.ppr) == null ? void 0 : _a.personalizationSuspense);
|
|
874
892
|
}
|
|
875
893
|
if (component.type === import_canvas8.CANVAS_TEST_TYPE) {
|
|
876
|
-
resolved = server ? TestServer :
|
|
894
|
+
resolved = server ? TestServer : import_canvas_next_rsc_client8.TestClient;
|
|
877
895
|
suspense = server && ((_b = config.ppr) == null ? void 0 : _b.testSuspense);
|
|
878
896
|
}
|
|
879
897
|
return {
|
|
@@ -881,6 +899,10 @@ var resolveSystemComponent = ({
|
|
|
881
899
|
suspense
|
|
882
900
|
};
|
|
883
901
|
};
|
|
902
|
+
var resolveServerPersonalizeComponent = ({ config }) => {
|
|
903
|
+
var _a;
|
|
904
|
+
return ((_a = config.evaluation) == null ? void 0 : _a.personalization) === "hybrid" ? PersonalizeServerHybrid : PersonalizeServer;
|
|
905
|
+
};
|
|
884
906
|
var resolveSlots = ({
|
|
885
907
|
component,
|
|
886
908
|
root,
|
|
@@ -998,20 +1020,20 @@ var resolveComponents = ({
|
|
|
998
1020
|
};
|
|
999
1021
|
let element = null;
|
|
1000
1022
|
if (wrapInSuspense) {
|
|
1001
|
-
element = (0,
|
|
1002
|
-
|
|
1023
|
+
element = (0, import_react10.createElement)(
|
|
1024
|
+
import_react10.Suspense,
|
|
1003
1025
|
{
|
|
1004
1026
|
key,
|
|
1005
|
-
fallback: typeof wrapInSuspense === "boolean" || typeof (wrapInSuspense == null ? void 0 : wrapInSuspense.fallback) === "undefined" ? void 0 : (0,
|
|
1027
|
+
fallback: typeof wrapInSuspense === "boolean" || typeof (wrapInSuspense == null ? void 0 : wrapInSuspense.fallback) === "undefined" ? void 0 : (0, import_react10.createElement)(wrapInSuspense.fallback)
|
|
1006
1028
|
},
|
|
1007
|
-
(0,
|
|
1029
|
+
(0, import_react10.createElement)(resolvedComponent, componentProps)
|
|
1008
1030
|
);
|
|
1009
1031
|
} else {
|
|
1010
|
-
element = (0,
|
|
1032
|
+
element = (0, import_react10.createElement)(resolvedComponent, { ...componentProps, key });
|
|
1011
1033
|
}
|
|
1012
1034
|
let tagElement = null;
|
|
1013
1035
|
if (enrichmentTags == null ? void 0 : enrichmentTags.length) {
|
|
1014
|
-
tagElement = (0,
|
|
1036
|
+
tagElement = (0, import_react10.createElement)(ContextUpdateTransfer, {
|
|
1015
1037
|
key: `${slotName}-${componentIndex}-tags`,
|
|
1016
1038
|
update: {
|
|
1017
1039
|
enrichments: enrichmentTags
|
|
@@ -1027,7 +1049,7 @@ var resolveComponents = ({
|
|
|
1027
1049
|
}
|
|
1028
1050
|
const isPlaceholder = (0, import_canvas8.isComponentPlaceholderId)(component == null ? void 0 : component._id);
|
|
1029
1051
|
if (!isPlaceholder || compositionContext.previewMode === "editor") {
|
|
1030
|
-
childNode = (0,
|
|
1052
|
+
childNode = (0, import_react10.createElement)(
|
|
1031
1053
|
import_core.PureContextualEditingComponentWrapper,
|
|
1032
1054
|
{
|
|
1033
1055
|
key: `${slotName}-${componentIndex}-wrapper`,
|
|
@@ -1047,8 +1069,8 @@ var resolveComponents = ({
|
|
|
1047
1069
|
if (tagElement) {
|
|
1048
1070
|
elements.push(tagElement);
|
|
1049
1071
|
}
|
|
1050
|
-
childNode = (0,
|
|
1051
|
-
|
|
1072
|
+
childNode = (0, import_react10.createElement)(
|
|
1073
|
+
import_canvas_next_rsc_client8.ClientContextualEditingComponentWrapper,
|
|
1052
1074
|
{
|
|
1053
1075
|
key: `${slotName}-${componentIndex}-wrapper`,
|
|
1054
1076
|
isPlaceholder: false,
|
|
@@ -1069,7 +1091,7 @@ var resolveComponents = ({
|
|
|
1069
1091
|
childNode = elements;
|
|
1070
1092
|
}
|
|
1071
1093
|
if (visibilityRules) {
|
|
1072
|
-
childNode = (0,
|
|
1094
|
+
childNode = (0, import_react10.createElement)(
|
|
1073
1095
|
VisibilityRulesWrapper,
|
|
1074
1096
|
{
|
|
1075
1097
|
key: `${slotName}-${componentIndex}-visibility`,
|
|
@@ -1079,8 +1101,8 @@ var resolveComponents = ({
|
|
|
1079
1101
|
childNode
|
|
1080
1102
|
);
|
|
1081
1103
|
}
|
|
1082
|
-
return (0,
|
|
1083
|
-
|
|
1104
|
+
return (0, import_react10.createElement)(
|
|
1105
|
+
import_react10.Fragment,
|
|
1084
1106
|
{
|
|
1085
1107
|
key: !isRoot ? `${slotName}-${componentIndex}` : void 0
|
|
1086
1108
|
},
|
|
@@ -1091,9 +1113,9 @@ var resolveComponents = ({
|
|
|
1091
1113
|
};
|
|
1092
1114
|
|
|
1093
1115
|
// src/components/UniformContext.tsx
|
|
1094
|
-
var
|
|
1095
|
-
var
|
|
1096
|
-
var
|
|
1116
|
+
var import_canvas_next_rsc_client9 = require("@uniformdev/canvas-next-rsc-client");
|
|
1117
|
+
var import_react11 = require("react");
|
|
1118
|
+
var import_react12 = __toESM(require("react"));
|
|
1097
1119
|
var UniformContext = async ({
|
|
1098
1120
|
clientContextComponent,
|
|
1099
1121
|
children
|
|
@@ -1102,12 +1124,12 @@ var UniformContext = async ({
|
|
|
1102
1124
|
const manifest = await getManifest({
|
|
1103
1125
|
searchParams: {}
|
|
1104
1126
|
});
|
|
1105
|
-
const ContextComponent = clientContextComponent ||
|
|
1127
|
+
const ContextComponent = clientContextComponent || import_canvas_next_rsc_client9.DefaultUniformClientContext;
|
|
1106
1128
|
const serverConfig2 = getServerConfig();
|
|
1107
1129
|
const disableDevTools = ((_a = serverConfig2.context) == null ? void 0 : _a.disableDevTools) || false;
|
|
1108
1130
|
const defaultConsent = serverConfig2.defaultConsent || false;
|
|
1109
1131
|
const experimentalQuirkSerialization = ((_b = serverConfig2.experimental) == null ? void 0 : _b.quirkSerialization) || false;
|
|
1110
|
-
return /* @__PURE__ */
|
|
1132
|
+
return /* @__PURE__ */ import_react12.default.createElement(import_react12.default.Fragment, null, children, /* @__PURE__ */ import_react12.default.createElement(
|
|
1111
1133
|
ContextComponent,
|
|
1112
1134
|
{
|
|
1113
1135
|
manifest,
|
|
@@ -1115,16 +1137,16 @@ var UniformContext = async ({
|
|
|
1115
1137
|
defaultConsent,
|
|
1116
1138
|
experimentalQuirkSerialization
|
|
1117
1139
|
}
|
|
1118
|
-
), /* @__PURE__ */
|
|
1140
|
+
), /* @__PURE__ */ import_react12.default.createElement(import_react11.Suspense, { fallback: /* @__PURE__ */ import_react12.default.createElement(import_react12.default.Fragment, null) }, /* @__PURE__ */ import_react12.default.createElement(import_canvas_next_rsc_client9.UniformScript, null)));
|
|
1119
1141
|
};
|
|
1120
1142
|
|
|
1121
1143
|
// src/components/UniformPlayground.tsx
|
|
1122
1144
|
var import_canvas9 = require("@uniformdev/canvas");
|
|
1123
1145
|
var import_navigation2 = require("next/navigation");
|
|
1124
|
-
var
|
|
1146
|
+
var import_react13 = __toESM(require("react"));
|
|
1125
1147
|
var UniformPlayground = async ({ searchParams, ...rest }) => {
|
|
1126
1148
|
if (!isDraftModeEnabled({ searchParams })) {
|
|
1127
|
-
return /* @__PURE__ */
|
|
1149
|
+
return /* @__PURE__ */ import_react13.default.createElement("div", null, /* @__PURE__ */ import_react13.default.createElement("h1", null, "Playground is only available in draft mode"));
|
|
1128
1150
|
}
|
|
1129
1151
|
const id = searchParams["id"];
|
|
1130
1152
|
if (!id) {
|
|
@@ -1155,7 +1177,7 @@ var UniformPlayground = async ({ searchParams, ...rest }) => {
|
|
|
1155
1177
|
if (!composition) {
|
|
1156
1178
|
(0, import_navigation2.notFound)();
|
|
1157
1179
|
}
|
|
1158
|
-
return /* @__PURE__ */
|
|
1180
|
+
return /* @__PURE__ */ import_react13.default.createElement(
|
|
1159
1181
|
UniformComposition,
|
|
1160
1182
|
{
|
|
1161
1183
|
mode: "server",
|
package/dist/index.mjs
CHANGED
|
@@ -679,6 +679,24 @@ var PersonalizeServer = (props) => {
|
|
|
679
679
|
return createElement(Fragment, void 0, [...components, eventElement]);
|
|
680
680
|
};
|
|
681
681
|
|
|
682
|
+
// src/components/PersonalizeServerHybrid.tsx
|
|
683
|
+
import { PersonalizeClient as PersonalizeClient2 } from "@uniformdev/canvas-next-rsc-client";
|
|
684
|
+
import { runPersonalization as runPersonalization3 } from "@uniformdev/canvas-next-rsc-shared";
|
|
685
|
+
import React5 from "react";
|
|
686
|
+
var PersonalizeServerHybrid = (props) => {
|
|
687
|
+
const { indexes } = runPersonalization3(props);
|
|
688
|
+
return /* @__PURE__ */ React5.createElement(
|
|
689
|
+
PersonalizeClient2,
|
|
690
|
+
{
|
|
691
|
+
component: props.component,
|
|
692
|
+
count: props.count,
|
|
693
|
+
slots: props.slots,
|
|
694
|
+
trackingEventName: props.trackingEventName,
|
|
695
|
+
indexes
|
|
696
|
+
}
|
|
697
|
+
);
|
|
698
|
+
};
|
|
699
|
+
|
|
682
700
|
// src/components/TestServer.ts
|
|
683
701
|
import { CANVAS_TEST_SLOT } from "@uniformdev/canvas";
|
|
684
702
|
import {
|
|
@@ -689,9 +707,9 @@ import { createElement as createElement2, Fragment as Fragment2 } from "react";
|
|
|
689
707
|
|
|
690
708
|
// src/components/ContextTestTransfer.tsx
|
|
691
709
|
import { ClientContextTestTransfer } from "@uniformdev/canvas-next-rsc-client";
|
|
692
|
-
import
|
|
710
|
+
import React6 from "react";
|
|
693
711
|
var ContextTestTransfer = ({ event }) => {
|
|
694
|
-
return /* @__PURE__ */
|
|
712
|
+
return /* @__PURE__ */ React6.createElement(ClientContextTestTransfer, { ts: (/* @__PURE__ */ new Date()).valueOf(), event });
|
|
695
713
|
};
|
|
696
714
|
|
|
697
715
|
// src/components/TestServer.ts
|
|
@@ -718,7 +736,7 @@ import {
|
|
|
718
736
|
evaluateNodeVisibilityParameter
|
|
719
737
|
} from "@uniformdev/canvas";
|
|
720
738
|
import { VisibilityRulesWrapperClient } from "@uniformdev/canvas-next-rsc-client";
|
|
721
|
-
import
|
|
739
|
+
import React7 from "react";
|
|
722
740
|
var VisibilityRulesWrapper = (props) => {
|
|
723
741
|
const { context, ...rest } = props;
|
|
724
742
|
let isVisible = null;
|
|
@@ -729,7 +747,7 @@ var VisibilityRulesWrapper = (props) => {
|
|
|
729
747
|
parameter: props.parameter
|
|
730
748
|
});
|
|
731
749
|
}
|
|
732
|
-
return /* @__PURE__ */
|
|
750
|
+
return /* @__PURE__ */ React7.createElement(VisibilityRulesWrapperClient, { ...rest, initialIsVisible: isVisible });
|
|
733
751
|
};
|
|
734
752
|
|
|
735
753
|
// src/components/UniformComposition.ts
|
|
@@ -842,7 +860,7 @@ var resolveSystemComponent = ({
|
|
|
842
860
|
let resolved = null;
|
|
843
861
|
let suspense = void 0;
|
|
844
862
|
if (component.type === CANVAS_PERSONALIZE_TYPE) {
|
|
845
|
-
resolved = server ?
|
|
863
|
+
resolved = server ? resolveServerPersonalizeComponent({ config }) : PersonalizeClientWrapper;
|
|
846
864
|
suspense = server && ((_a = config.ppr) == null ? void 0 : _a.personalizationSuspense);
|
|
847
865
|
}
|
|
848
866
|
if (component.type === CANVAS_TEST_TYPE) {
|
|
@@ -854,6 +872,10 @@ var resolveSystemComponent = ({
|
|
|
854
872
|
suspense
|
|
855
873
|
};
|
|
856
874
|
};
|
|
875
|
+
var resolveServerPersonalizeComponent = ({ config }) => {
|
|
876
|
+
var _a;
|
|
877
|
+
return ((_a = config.evaluation) == null ? void 0 : _a.personalization) === "hybrid" ? PersonalizeServerHybrid : PersonalizeServer;
|
|
878
|
+
};
|
|
857
879
|
var resolveSlots = ({
|
|
858
880
|
component,
|
|
859
881
|
root,
|
|
@@ -1069,7 +1091,7 @@ import {
|
|
|
1069
1091
|
UniformScript
|
|
1070
1092
|
} from "@uniformdev/canvas-next-rsc-client";
|
|
1071
1093
|
import { Suspense as Suspense2 } from "react";
|
|
1072
|
-
import
|
|
1094
|
+
import React8 from "react";
|
|
1073
1095
|
var UniformContext = async ({
|
|
1074
1096
|
clientContextComponent,
|
|
1075
1097
|
children
|
|
@@ -1083,7 +1105,7 @@ var UniformContext = async ({
|
|
|
1083
1105
|
const disableDevTools = ((_a = serverConfig2.context) == null ? void 0 : _a.disableDevTools) || false;
|
|
1084
1106
|
const defaultConsent = serverConfig2.defaultConsent || false;
|
|
1085
1107
|
const experimentalQuirkSerialization = ((_b = serverConfig2.experimental) == null ? void 0 : _b.quirkSerialization) || false;
|
|
1086
|
-
return /* @__PURE__ */
|
|
1108
|
+
return /* @__PURE__ */ React8.createElement(React8.Fragment, null, children, /* @__PURE__ */ React8.createElement(
|
|
1087
1109
|
ContextComponent,
|
|
1088
1110
|
{
|
|
1089
1111
|
manifest,
|
|
@@ -1091,16 +1113,16 @@ var UniformContext = async ({
|
|
|
1091
1113
|
defaultConsent,
|
|
1092
1114
|
experimentalQuirkSerialization
|
|
1093
1115
|
}
|
|
1094
|
-
), /* @__PURE__ */
|
|
1116
|
+
), /* @__PURE__ */ React8.createElement(Suspense2, { fallback: /* @__PURE__ */ React8.createElement(React8.Fragment, null) }, /* @__PURE__ */ React8.createElement(UniformScript, null)));
|
|
1095
1117
|
};
|
|
1096
1118
|
|
|
1097
1119
|
// src/components/UniformPlayground.tsx
|
|
1098
1120
|
import { CANVAS_DRAFT_STATE as CANVAS_DRAFT_STATE3, CANVAS_EDITOR_STATE as CANVAS_EDITOR_STATE3 } from "@uniformdev/canvas";
|
|
1099
1121
|
import { notFound as notFound2 } from "next/navigation";
|
|
1100
|
-
import
|
|
1122
|
+
import React9 from "react";
|
|
1101
1123
|
var UniformPlayground = async ({ searchParams, ...rest }) => {
|
|
1102
1124
|
if (!isDraftModeEnabled({ searchParams })) {
|
|
1103
|
-
return /* @__PURE__ */
|
|
1125
|
+
return /* @__PURE__ */ React9.createElement("div", null, /* @__PURE__ */ React9.createElement("h1", null, "Playground is only available in draft mode"));
|
|
1104
1126
|
}
|
|
1105
1127
|
const id = searchParams["id"];
|
|
1106
1128
|
if (!id) {
|
|
@@ -1131,7 +1153,7 @@ var UniformPlayground = async ({ searchParams, ...rest }) => {
|
|
|
1131
1153
|
if (!composition) {
|
|
1132
1154
|
notFound2();
|
|
1133
1155
|
}
|
|
1134
|
-
return /* @__PURE__ */
|
|
1156
|
+
return /* @__PURE__ */ React9.createElement(
|
|
1135
1157
|
UniformComposition,
|
|
1136
1158
|
{
|
|
1137
1159
|
mode: "server",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/canvas-next-rsc",
|
|
3
|
-
"version": "19.
|
|
3
|
+
"version": "19.208.0",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "tsup",
|
|
@@ -61,15 +61,15 @@
|
|
|
61
61
|
"react-dom": "18.3.1"
|
|
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.208.0",
|
|
65
|
+
"@uniformdev/canvas-next-rsc-client": "^19.208.0",
|
|
66
|
+
"@uniformdev/canvas-next-rsc-shared": "^19.208.0",
|
|
67
|
+
"@uniformdev/canvas-react": "19.208.0",
|
|
68
|
+
"@uniformdev/context": "19.208.0",
|
|
69
|
+
"@uniformdev/project-map": "19.208.0",
|
|
70
|
+
"@uniformdev/redirect": "19.208.0",
|
|
71
|
+
"@uniformdev/richtext": "19.208.0",
|
|
72
|
+
"@uniformdev/webhooks": "19.208.0",
|
|
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": "9b96344a84cc37c1c54f9164b89ca7697611a2c0"
|
|
90
90
|
}
|