@uniformdev/canvas-next-rsc 19.128.1-alpha.9 → 19.131.1-alpha.2

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/config.js CHANGED
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
+ var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
5
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
8
  var __export = (target, all) => {
7
9
  for (var name in all)
@@ -15,6 +17,14 @@ var __copyProps = (to, from, except, desc) => {
15
17
  }
16
18
  return to;
17
19
  };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
18
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
29
 
20
30
  // src/config.ts
@@ -23,6 +33,7 @@ __export(config_exports, {
23
33
  withUniformConfig: () => withUniformConfig
24
34
  });
25
35
  module.exports = __toCommonJS(config_exports);
36
+ var import_path = __toESM(require("path"));
26
37
  var { existsSync } = require("fs");
27
38
  var { join } = require("path");
28
39
  var getConfigPath = () => {
@@ -42,11 +53,7 @@ var withUniformConfig = (nextConfig) => ({
42
53
  const uniformConfigPath = getConfigPath();
43
54
  if (uniformConfigPath) {
44
55
  console.log("Using Uniform config from", uniformConfigPath);
45
- config.module.rules.push({
46
- test: /uniform\.server\.config\.js$/,
47
- include: uniformConfigPath,
48
- use: context.defaultLoaders.babel
49
- });
56
+ config.resolve.alias["uniform.server.config.js"] = import_path.default.resolve(config.context, uniformConfigPath);
50
57
  }
51
58
  }
52
59
  return config;
package/dist/config.mjs CHANGED
@@ -7,6 +7,7 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
7
7
  });
8
8
 
9
9
  // src/config.ts
10
+ import path from "path";
10
11
  var { existsSync } = __require("fs");
11
12
  var { join } = __require("path");
12
13
  var getConfigPath = () => {
@@ -26,11 +27,7 @@ var withUniformConfig = (nextConfig) => ({
26
27
  const uniformConfigPath = getConfigPath();
27
28
  if (uniformConfigPath) {
28
29
  console.log("Using Uniform config from", uniformConfigPath);
29
- config.module.rules.push({
30
- test: /uniform\.server\.config\.js$/,
31
- include: uniformConfigPath,
32
- use: context.defaultLoaders.babel
33
- });
30
+ config.resolve.alias["uniform.server.config.js"] = path.resolve(config.context, uniformConfigPath);
34
31
  }
35
32
  }
36
33
  return config;
package/dist/handler.js CHANGED
@@ -161,13 +161,25 @@ var import_cache = require("next/cache");
161
161
 
162
162
  // src/handler/helpers.ts
163
163
  var import_canvas4 = require("@uniformdev/canvas");
164
- var import_canvas_next_rsc_shared = require("@uniformdev/canvas-next-rsc-shared");
165
164
  var import_edge_config = require("@vercel/edge-config");
166
165
  var import_svix = require("svix");
167
166
 
168
167
  // src/clients/canvasClient.ts
169
168
  var import_canvas2 = require("@uniformdev/canvas");
170
169
 
170
+ // src/config/helpers.ts
171
+ var getServerConfig = () => {
172
+ let serverConfig;
173
+ try {
174
+ serverConfig = require("uniform.server.config.js");
175
+ } catch (e) {
176
+ serverConfig = {
177
+ defaultConsent: false
178
+ };
179
+ }
180
+ return serverConfig;
181
+ };
182
+
171
183
  // src/env/index.ts
172
184
  var env = {
173
185
  getProjectId: () => {
@@ -447,7 +459,7 @@ var processEdgeConfigChange = async ({ source_url }) => {
447
459
  console.warn("UNIFORM_VERCEL_EDGE_CONFIG_TOKEN is not set, skipping edge redirect upsert");
448
460
  return;
449
461
  }
450
- const config = (0, import_canvas_next_rsc_shared.getServerConfig)();
462
+ const config = getServerConfig();
451
463
  const routeClient = getRouteClient({
452
464
  cache: {
453
465
  type: "no-cache"
@@ -537,7 +549,6 @@ var handleManifestPublished = async (body) => {
537
549
  };
538
550
 
539
551
  // src/handler/messages/handleProjectMapNodeDelete.ts
540
- var import_canvas_next_rsc_shared2 = require("@uniformdev/canvas-next-rsc-shared");
541
552
  var import_webhooks5 = require("@uniformdev/webhooks");
542
553
  var handleProjectMapNodeDelete = async (body) => {
543
554
  var _a;
@@ -547,7 +558,7 @@ var handleProjectMapNodeDelete = async (body) => {
547
558
  }
548
559
  const tags = [];
549
560
  tags.push(...buildProjectMapNodePaths(parsed.data.path));
550
- const config = (0, import_canvas_next_rsc_shared2.getServerConfig)();
561
+ const config = getServerConfig();
551
562
  if ((_a = config.experimental) == null ? void 0 : _a.edgeCompositions) {
552
563
  await processEdgeConfigChange({
553
564
  source_url: parsed.data.path
@@ -559,7 +570,6 @@ var handleProjectMapNodeDelete = async (body) => {
559
570
  };
560
571
 
561
572
  // src/handler/messages/handleProjectMapNodeInsert.ts
562
- var import_canvas_next_rsc_shared3 = require("@uniformdev/canvas-next-rsc-shared");
563
573
  var import_webhooks6 = require("@uniformdev/webhooks");
564
574
  var handleProjectMapNodeInsert = async (body) => {
565
575
  var _a;
@@ -569,7 +579,7 @@ var handleProjectMapNodeInsert = async (body) => {
569
579
  }
570
580
  const tags = [];
571
581
  tags.push(...buildProjectMapNodePaths(parsed.data.path));
572
- const config = (0, import_canvas_next_rsc_shared3.getServerConfig)();
582
+ const config = getServerConfig();
573
583
  if ((_a = config.experimental) == null ? void 0 : _a.edgeCompositions) {
574
584
  await processEdgeConfigChange({
575
585
  source_url: parsed.data.path
@@ -581,7 +591,6 @@ var handleProjectMapNodeInsert = async (body) => {
581
591
  };
582
592
 
583
593
  // src/handler/messages/handleProjectMapNodeUpdate.ts
584
- var import_canvas_next_rsc_shared4 = require("@uniformdev/canvas-next-rsc-shared");
585
594
  var import_webhooks7 = require("@uniformdev/webhooks");
586
595
  var handleProjectMapNodeUpdate = async (body) => {
587
596
  var _a;
@@ -592,7 +601,7 @@ var handleProjectMapNodeUpdate = async (body) => {
592
601
  const tags = [];
593
602
  tags.push(...buildProjectMapNodePaths(parsed.data.path));
594
603
  tags.push(...buildProjectMapNodePaths(parsed.data.previous_path));
595
- const config = (0, import_canvas_next_rsc_shared4.getServerConfig)();
604
+ const config = getServerConfig();
596
605
  if ((_a = config.experimental) == null ? void 0 : _a.edgeCompositions) {
597
606
  await processEdgeConfigChange({
598
607
  source_url: parsed.data.path
@@ -604,7 +613,6 @@ var handleProjectMapNodeUpdate = async (body) => {
604
613
  };
605
614
 
606
615
  // src/handler/messages/handleRedirectDelete.ts
607
- var import_canvas_next_rsc_shared5 = require("@uniformdev/canvas-next-rsc-shared");
608
616
  var import_webhooks8 = require("@uniformdev/webhooks");
609
617
  var handleRedirectDelete = async (body) => {
610
618
  var _a;
@@ -612,7 +620,7 @@ var handleRedirectDelete = async (body) => {
612
620
  if (!parsed.success) {
613
621
  return void 0;
614
622
  }
615
- const config = (0, import_canvas_next_rsc_shared5.getServerConfig)();
623
+ const config = getServerConfig();
616
624
  if ((_a = config.experimental) == null ? void 0 : _a.edgeRedirects) {
617
625
  await processEdgeConfigChange(parsed.data);
618
626
  }
@@ -620,7 +628,6 @@ var handleRedirectDelete = async (body) => {
620
628
  };
621
629
 
622
630
  // src/handler/messages/handleRedirectInsert.ts
623
- var import_canvas_next_rsc_shared6 = require("@uniformdev/canvas-next-rsc-shared");
624
631
  var import_webhooks9 = require("@uniformdev/webhooks");
625
632
  var handleRedirectInsert = async (body) => {
626
633
  var _a;
@@ -628,7 +635,7 @@ var handleRedirectInsert = async (body) => {
628
635
  if (!parsed.success) {
629
636
  return void 0;
630
637
  }
631
- const config = (0, import_canvas_next_rsc_shared6.getServerConfig)();
638
+ const config = getServerConfig();
632
639
  if ((_a = config.experimental) == null ? void 0 : _a.edgeRedirects) {
633
640
  await processEdgeConfigChange(parsed.data);
634
641
  }
@@ -636,7 +643,6 @@ var handleRedirectInsert = async (body) => {
636
643
  };
637
644
 
638
645
  // src/handler/messages/handleRedirectUpdate.ts
639
- var import_canvas_next_rsc_shared7 = require("@uniformdev/canvas-next-rsc-shared");
640
646
  var import_webhooks10 = require("@uniformdev/webhooks");
641
647
  var handleRedirectUpdate = async (body) => {
642
648
  var _a;
@@ -644,7 +650,7 @@ var handleRedirectUpdate = async (body) => {
644
650
  if (!parsed.success) {
645
651
  return void 0;
646
652
  }
647
- const config = (0, import_canvas_next_rsc_shared7.getServerConfig)();
653
+ const config = getServerConfig();
648
654
  if ((_a = config.experimental) == null ? void 0 : _a.edgeRedirects) {
649
655
  await processEdgeConfigChange(parsed.data);
650
656
  }
package/dist/handler.mjs CHANGED
@@ -1,3 +1,11 @@
1
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
2
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
3
+ }) : x)(function(x) {
4
+ if (typeof require !== "undefined")
5
+ return require.apply(this, arguments);
6
+ throw Error('Dynamic require of "' + x + '" is not supported');
7
+ });
8
+
1
9
  // src/handler/createPreviewGETRouteHandler.ts
2
10
  import {
3
11
  IN_CONTEXT_EDITOR_PLAYGROUND_QUERY_STRING_PARAM,
@@ -138,13 +146,25 @@ import { revalidateTag } from "next/cache";
138
146
 
139
147
  // src/handler/helpers.ts
140
148
  import { ApiClientError } from "@uniformdev/canvas";
141
- import { getServerConfig } from "@uniformdev/canvas-next-rsc-shared";
142
149
  import { parseConnectionString } from "@vercel/edge-config";
143
150
  import { Webhook } from "svix";
144
151
 
145
152
  // src/clients/canvasClient.ts
146
153
  import { CanvasClient } from "@uniformdev/canvas";
147
154
 
155
+ // src/config/helpers.ts
156
+ var getServerConfig = () => {
157
+ let serverConfig;
158
+ try {
159
+ serverConfig = __require("uniform.server.config.js");
160
+ } catch (e) {
161
+ serverConfig = {
162
+ defaultConsent: false
163
+ };
164
+ }
165
+ return serverConfig;
166
+ };
167
+
148
168
  // src/env/index.ts
149
169
  var env = {
150
170
  getProjectId: () => {
@@ -514,7 +534,6 @@ var handleManifestPublished = async (body) => {
514
534
  };
515
535
 
516
536
  // src/handler/messages/handleProjectMapNodeDelete.ts
517
- import { getServerConfig as getServerConfig2 } from "@uniformdev/canvas-next-rsc-shared";
518
537
  import { ProjectMapNodeDeleteDefinition } from "@uniformdev/webhooks";
519
538
  var handleProjectMapNodeDelete = async (body) => {
520
539
  var _a;
@@ -524,7 +543,7 @@ var handleProjectMapNodeDelete = async (body) => {
524
543
  }
525
544
  const tags = [];
526
545
  tags.push(...buildProjectMapNodePaths(parsed.data.path));
527
- const config = getServerConfig2();
546
+ const config = getServerConfig();
528
547
  if ((_a = config.experimental) == null ? void 0 : _a.edgeCompositions) {
529
548
  await processEdgeConfigChange({
530
549
  source_url: parsed.data.path
@@ -536,7 +555,6 @@ var handleProjectMapNodeDelete = async (body) => {
536
555
  };
537
556
 
538
557
  // src/handler/messages/handleProjectMapNodeInsert.ts
539
- import { getServerConfig as getServerConfig3 } from "@uniformdev/canvas-next-rsc-shared";
540
558
  import { ProjectMapNodeInsertDefinition } from "@uniformdev/webhooks";
541
559
  var handleProjectMapNodeInsert = async (body) => {
542
560
  var _a;
@@ -546,7 +564,7 @@ var handleProjectMapNodeInsert = async (body) => {
546
564
  }
547
565
  const tags = [];
548
566
  tags.push(...buildProjectMapNodePaths(parsed.data.path));
549
- const config = getServerConfig3();
567
+ const config = getServerConfig();
550
568
  if ((_a = config.experimental) == null ? void 0 : _a.edgeCompositions) {
551
569
  await processEdgeConfigChange({
552
570
  source_url: parsed.data.path
@@ -558,7 +576,6 @@ var handleProjectMapNodeInsert = async (body) => {
558
576
  };
559
577
 
560
578
  // src/handler/messages/handleProjectMapNodeUpdate.ts
561
- import { getServerConfig as getServerConfig4 } from "@uniformdev/canvas-next-rsc-shared";
562
579
  import { ProjectMapNodeUpdateDefinition } from "@uniformdev/webhooks";
563
580
  var handleProjectMapNodeUpdate = async (body) => {
564
581
  var _a;
@@ -569,7 +586,7 @@ var handleProjectMapNodeUpdate = async (body) => {
569
586
  const tags = [];
570
587
  tags.push(...buildProjectMapNodePaths(parsed.data.path));
571
588
  tags.push(...buildProjectMapNodePaths(parsed.data.previous_path));
572
- const config = getServerConfig4();
589
+ const config = getServerConfig();
573
590
  if ((_a = config.experimental) == null ? void 0 : _a.edgeCompositions) {
574
591
  await processEdgeConfigChange({
575
592
  source_url: parsed.data.path
@@ -581,7 +598,6 @@ var handleProjectMapNodeUpdate = async (body) => {
581
598
  };
582
599
 
583
600
  // src/handler/messages/handleRedirectDelete.ts
584
- import { getServerConfig as getServerConfig5 } from "@uniformdev/canvas-next-rsc-shared";
585
601
  import { RedirectDeleteDefinition } from "@uniformdev/webhooks";
586
602
  var handleRedirectDelete = async (body) => {
587
603
  var _a;
@@ -589,7 +605,7 @@ var handleRedirectDelete = async (body) => {
589
605
  if (!parsed.success) {
590
606
  return void 0;
591
607
  }
592
- const config = getServerConfig5();
608
+ const config = getServerConfig();
593
609
  if ((_a = config.experimental) == null ? void 0 : _a.edgeRedirects) {
594
610
  await processEdgeConfigChange(parsed.data);
595
611
  }
@@ -597,7 +613,6 @@ var handleRedirectDelete = async (body) => {
597
613
  };
598
614
 
599
615
  // src/handler/messages/handleRedirectInsert.ts
600
- import { getServerConfig as getServerConfig6 } from "@uniformdev/canvas-next-rsc-shared";
601
616
  import { RedirectInsertDefinition } from "@uniformdev/webhooks";
602
617
  var handleRedirectInsert = async (body) => {
603
618
  var _a;
@@ -605,7 +620,7 @@ var handleRedirectInsert = async (body) => {
605
620
  if (!parsed.success) {
606
621
  return void 0;
607
622
  }
608
- const config = getServerConfig6();
623
+ const config = getServerConfig();
609
624
  if ((_a = config.experimental) == null ? void 0 : _a.edgeRedirects) {
610
625
  await processEdgeConfigChange(parsed.data);
611
626
  }
@@ -613,7 +628,6 @@ var handleRedirectInsert = async (body) => {
613
628
  };
614
629
 
615
630
  // src/handler/messages/handleRedirectUpdate.ts
616
- import { getServerConfig as getServerConfig7 } from "@uniformdev/canvas-next-rsc-shared";
617
631
  import { RedirectUpdateDefinition } from "@uniformdev/webhooks";
618
632
  var handleRedirectUpdate = async (body) => {
619
633
  var _a;
@@ -621,7 +635,7 @@ var handleRedirectUpdate = async (body) => {
621
635
  if (!parsed.success) {
622
636
  return void 0;
623
637
  }
624
- const config = getServerConfig7();
638
+ const config = getServerConfig();
625
639
  if ((_a = config.experimental) == null ? void 0 : _a.edgeRedirects) {
626
640
  await processEdgeConfigChange(parsed.data);
627
641
  }
package/dist/index.esm.js CHANGED
@@ -1,12 +1,17 @@
1
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
2
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
3
+ }) : x)(function(x) {
4
+ if (typeof require !== "undefined")
5
+ return require.apply(this, arguments);
6
+ throw Error('Dynamic require of "' + x + '" is not supported');
7
+ });
8
+
1
9
  // src/index.ts
2
10
  import "server-only";
3
11
 
4
12
  // src/clients/canvasClient.ts
5
13
  import { CanvasClient } from "@uniformdev/canvas";
6
14
 
7
- // src/config/helpers.ts
8
- import { getServerConfig } from "@uniformdev/canvas-next-rsc-shared";
9
-
10
15
  // src/utils/draft.ts
11
16
  import { IN_CONTEXT_EDITOR_QUERY_STRING_PARAM } from "@uniformdev/canvas";
12
17
  import { draftMode } from "next/headers";
@@ -37,6 +42,17 @@ var isDevelopmentEnvironment = () => {
37
42
  };
38
43
 
39
44
  // src/config/helpers.ts
45
+ var getServerConfig = () => {
46
+ let serverConfig;
47
+ try {
48
+ serverConfig = __require("uniform.server.config.js");
49
+ } catch (e) {
50
+ serverConfig = {
51
+ defaultConsent: false
52
+ };
53
+ }
54
+ return serverConfig;
55
+ };
40
56
  var shouldCacheBeDisabled = (options) => {
41
57
  if (isDraftModeEnabled(options)) {
42
58
  return { disabled: true, reason: "DRAFT" };
@@ -399,7 +415,6 @@ import {
399
415
  } from "@uniformdev/canvas";
400
416
  import { ClientContextualEditingComponentWrapper, TestClient } from "@uniformdev/canvas-next-rsc-client";
401
417
  import {
402
- getServerConfig as getServerConfig3,
403
418
  resolvePath as resolvePath2
404
419
  } from "@uniformdev/canvas-next-rsc-shared";
405
420
  import { PureContextualEditingComponentWrapper } from "@uniformdev/canvas-react/core";
@@ -441,7 +456,7 @@ import {
441
456
  CANVAS_EDITOR_STATE,
442
457
  CANVAS_PUBLISHED_STATE
443
458
  } from "@uniformdev/canvas";
444
- import { getBaseUrl, getServerConfig as getServerConfig2, resolvePath } from "@uniformdev/canvas-next-rsc-shared";
459
+ import { getBaseUrl, resolvePath } from "@uniformdev/canvas-next-rsc-shared";
445
460
  import { getTargetVariableExpandedUrl } from "@uniformdev/redirect";
446
461
  var retrieveRoute = async ({ params, searchParams, skipPrefetch }, fetchOptions) => {
447
462
  if (!skipPrefetch) {
@@ -523,7 +538,7 @@ var retrieveRouteByPath = async ({
523
538
  path: queryPath,
524
539
  state,
525
540
  withComponentIDs: true,
526
- withContentSourceMap: isOnVercelPreviewEnvironment() && ((_a = getServerConfig2().experimental) == null ? void 0 : _a.vercelVisualEditing)
541
+ withContentSourceMap: isOnVercelPreviewEnvironment() && ((_a = getServerConfig().experimental) == null ? void 0 : _a.vercelVisualEditing)
527
542
  });
528
543
  };
529
544
  var resolveRedirectHref = (resolveResult, path) => {
@@ -715,10 +730,10 @@ var isServerComponent = ({
715
730
  }) => {
716
731
  var _a, _b;
717
732
  if (component.type === CANVAS_PERSONALIZE_TYPE) {
718
- return serverContext && ((_a = getServerConfig3().evaluation) == null ? void 0 : _a.personalization) !== "client";
733
+ return serverContext && ((_a = getServerConfig().evaluation) == null ? void 0 : _a.personalization) !== "client";
719
734
  }
720
735
  if (component.type === CANVAS_TEST_TYPE) {
721
- return serverContext && ((_b = getServerConfig3().evaluation) == null ? void 0 : _b.testing) !== "client";
736
+ return serverContext && ((_b = getServerConfig().evaluation) == null ? void 0 : _b.testing) !== "client";
722
737
  }
723
738
  };
724
739
  var resolveSystemComponent = ({
@@ -920,7 +935,6 @@ import {
920
935
  DefaultUniformClientContext,
921
936
  UniformScript
922
937
  } from "@uniformdev/canvas-next-rsc-client";
923
- import { getServerConfig as getServerConfig4 } from "@uniformdev/canvas-next-rsc-shared";
924
938
  import { Suspense } from "react";
925
939
  import React6 from "react";
926
940
  var UniformContext = async ({
@@ -932,8 +946,17 @@ var UniformContext = async ({
932
946
  searchParams: {}
933
947
  });
934
948
  const ContextComponent = clientContextComponent || DefaultUniformClientContext;
935
- const disableDevTools = ((_a = getServerConfig4().context) == null ? void 0 : _a.disableDevTools) || false;
936
- 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)));
949
+ const serverConfig = getServerConfig();
950
+ const disableDevTools = ((_a = serverConfig.context) == null ? void 0 : _a.disableDevTools) || false;
951
+ const defaultConsent = serverConfig.defaultConsent || false;
952
+ return /* @__PURE__ */ React6.createElement(React6.Fragment, null, children, /* @__PURE__ */ React6.createElement(
953
+ ContextComponent,
954
+ {
955
+ manifest,
956
+ disableDevTools,
957
+ defaultConsent
958
+ }
959
+ ), /* @__PURE__ */ React6.createElement(Suspense, { fallback: /* @__PURE__ */ React6.createElement(React6.Fragment, null) }, /* @__PURE__ */ React6.createElement(UniformScript, null)));
937
960
  };
938
961
 
939
962
  // src/components/UniformPlayground.tsx
package/dist/index.js CHANGED
@@ -59,9 +59,6 @@ var import_server_only = require("server-only");
59
59
  // src/clients/canvasClient.ts
60
60
  var import_canvas2 = require("@uniformdev/canvas");
61
61
 
62
- // src/config/helpers.ts
63
- var import_canvas_next_rsc_shared = require("@uniformdev/canvas-next-rsc-shared");
64
-
65
62
  // src/utils/draft.ts
66
63
  var import_canvas = require("@uniformdev/canvas");
67
64
  var import_headers = require("next/headers");
@@ -92,6 +89,17 @@ var isDevelopmentEnvironment = () => {
92
89
  };
93
90
 
94
91
  // src/config/helpers.ts
92
+ var getServerConfig = () => {
93
+ let serverConfig;
94
+ try {
95
+ serverConfig = require("uniform.server.config.js");
96
+ } catch (e) {
97
+ serverConfig = {
98
+ defaultConsent: false
99
+ };
100
+ }
101
+ return serverConfig;
102
+ };
95
103
  var shouldCacheBeDisabled = (options) => {
96
104
  if (isDraftModeEnabled(options)) {
97
105
  return { disabled: true, reason: "DRAFT" };
@@ -109,7 +117,7 @@ var shouldCacheBeDisabled = (options) => {
109
117
  };
110
118
  var getCanvasCacheStrategy = (options) => {
111
119
  const { disabled, reason } = shouldCacheBeDisabled(options);
112
- const config = (0, import_canvas_next_rsc_shared.getServerConfig)();
120
+ const config = getServerConfig();
113
121
  if (disabled) {
114
122
  if (reason === "DEV" && config.canvasCache) {
115
123
  console.warn("Canvas cache (disabled) has been overridden by canvasCache config.");
@@ -128,7 +136,7 @@ var getCanvasCacheStrategy = (options) => {
128
136
  };
129
137
  var getManifestCacheStrategy = (options) => {
130
138
  const { disabled, reason } = shouldCacheBeDisabled(options);
131
- const config = (0, import_canvas_next_rsc_shared.getServerConfig)();
139
+ const config = getServerConfig();
132
140
  if (disabled) {
133
141
  if (reason === "DEV" && config.manifestCache) {
134
142
  console.warn("Manifest cache (disabled) has been overridden by manifestCache config.");
@@ -147,7 +155,7 @@ var getManifestCacheStrategy = (options) => {
147
155
  };
148
156
  var getProjectMapCacheStrategy = (options) => {
149
157
  const { disabled, reason } = shouldCacheBeDisabled(options);
150
- const config = (0, import_canvas_next_rsc_shared.getServerConfig)();
158
+ const config = getServerConfig();
151
159
  if (disabled) {
152
160
  if (reason === "DEV" && config.projectMapCache) {
153
161
  console.warn("Project map cache (disabled) has been overridden by projectMapCache config.");
@@ -445,14 +453,14 @@ async function generateStaticParams() {
445
453
  // src/components/UniformComposition.ts
446
454
  var import_canvas7 = require("@uniformdev/canvas");
447
455
  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");
456
+ var import_canvas_next_rsc_shared6 = require("@uniformdev/canvas-next-rsc-shared");
449
457
  var import_core = require("@uniformdev/canvas-react/core");
450
458
  var import_headers3 = require("next/headers");
451
459
  var import_navigation = require("next/navigation");
452
460
  var import_react8 = require("react");
453
461
 
454
462
  // src/context/createServerUniformContext.ts
455
- var import_canvas_next_rsc_shared2 = require("@uniformdev/canvas-next-rsc-shared");
463
+ var import_canvas_next_rsc_shared = require("@uniformdev/canvas-next-rsc-shared");
456
464
  var import_context = require("@uniformdev/context");
457
465
  var import_headers2 = require("next/headers");
458
466
  var createServerUniformContext = async (options) => {
@@ -465,7 +473,7 @@ var createServerUniformContext = async (options) => {
465
473
  };
466
474
  var createServerUniformContextFromManifest = async (options) => {
467
475
  var _a;
468
- const context = (0, import_canvas_next_rsc_shared2.createUniformContext)({
476
+ const context = (0, import_canvas_next_rsc_shared.createUniformContext)({
469
477
  ...options || {},
470
478
  serverCookieValue: (_a = (0, import_headers2.cookies)().get(import_context.UNIFORM_DEFAULT_COOKIE_NAME)) == null ? void 0 : _a.value
471
479
  });
@@ -479,7 +487,7 @@ var createServerUniformContextFromManifest = async (options) => {
479
487
 
480
488
  // src/utils/route.ts
481
489
  var import_canvas4 = require("@uniformdev/canvas");
482
- var import_canvas_next_rsc_shared3 = require("@uniformdev/canvas-next-rsc-shared");
490
+ var import_canvas_next_rsc_shared2 = require("@uniformdev/canvas-next-rsc-shared");
483
491
  var import_redirect = require("@uniformdev/redirect");
484
492
  var retrieveRoute = async ({ params, searchParams, skipPrefetch }, fetchOptions) => {
485
493
  if (!skipPrefetch) {
@@ -487,7 +495,7 @@ var retrieveRoute = async ({ params, searchParams, skipPrefetch }, fetchOptions)
487
495
  searchParams
488
496
  });
489
497
  }
490
- const { type, value } = (0, import_canvas_next_rsc_shared3.resolvePath)({
498
+ const { type, value } = (0, import_canvas_next_rsc_shared2.resolvePath)({
491
499
  params
492
500
  });
493
501
  const states = determineState({
@@ -545,7 +553,7 @@ var retrieveRouteByPath = async ({
545
553
  });
546
554
  let queryPath = path;
547
555
  if (searchParams && Object.keys(searchParams).length > 0) {
548
- const helper = new URL((0, import_canvas_next_rsc_shared3.getBaseUrl)());
556
+ const helper = new URL((0, import_canvas_next_rsc_shared2.getBaseUrl)());
549
557
  helper.pathname = path;
550
558
  Object.entries(searchParams).forEach(([key, value]) => {
551
559
  if (typeof value === "string") {
@@ -561,11 +569,11 @@ var retrieveRouteByPath = async ({
561
569
  path: queryPath,
562
570
  state,
563
571
  withComponentIDs: true,
564
- withContentSourceMap: isOnVercelPreviewEnvironment() && ((_a = (0, import_canvas_next_rsc_shared3.getServerConfig)().experimental) == null ? void 0 : _a.vercelVisualEditing)
572
+ withContentSourceMap: isOnVercelPreviewEnvironment() && ((_a = getServerConfig().experimental) == null ? void 0 : _a.vercelVisualEditing)
565
573
  });
566
574
  };
567
575
  var resolveRedirectHref = (resolveResult, path) => {
568
- const requestUrl = `${(0, import_canvas_next_rsc_shared3.getBaseUrl)()}${path}`;
576
+ const requestUrl = `${(0, import_canvas_next_rsc_shared2.getBaseUrl)()}${path}`;
569
577
  const expandedUrl = (0, import_redirect.getTargetVariableExpandedUrl)(requestUrl, resolveResult.redirect);
570
578
  const url = new URL(expandedUrl);
571
579
  return url.pathname;
@@ -595,10 +603,10 @@ var ContextUpdateTrigger = ({ path }) => {
595
603
 
596
604
  // src/components/PersonalizeClientWrapper.tsx
597
605
  var import_canvas_next_rsc_client3 = require("@uniformdev/canvas-next-rsc-client");
598
- var import_canvas_next_rsc_shared4 = require("@uniformdev/canvas-next-rsc-shared");
606
+ var import_canvas_next_rsc_shared3 = require("@uniformdev/canvas-next-rsc-shared");
599
607
  var import_react3 = __toESM(require("react"));
600
608
  var PersonalizeClientWrapper = (props) => {
601
- const { indexes } = (0, import_canvas_next_rsc_shared4.runPersonalization)({
609
+ const { indexes } = (0, import_canvas_next_rsc_shared3.runPersonalization)({
602
610
  ...props,
603
611
  contextInstance: void 0
604
612
  });
@@ -607,7 +615,7 @@ var PersonalizeClientWrapper = (props) => {
607
615
 
608
616
  // src/components/PersonalizeServer.ts
609
617
  var import_canvas5 = require("@uniformdev/canvas");
610
- var import_canvas_next_rsc_shared5 = require("@uniformdev/canvas-next-rsc-shared");
618
+ var import_canvas_next_rsc_shared4 = require("@uniformdev/canvas-next-rsc-shared");
611
619
  var import_react5 = require("react");
612
620
 
613
621
  // src/components/ContextPersonalizationTransfer.tsx
@@ -620,7 +628,7 @@ var ContextPersonalizationTransfer = ({ event }) => {
620
628
  // src/components/PersonalizeServer.ts
621
629
  var PersonalizeServer = (props) => {
622
630
  var _a;
623
- const { indexes, event } = (0, import_canvas_next_rsc_shared5.runPersonalization)(props);
631
+ const { indexes, event } = (0, import_canvas_next_rsc_shared4.runPersonalization)(props);
624
632
  const slot = (_a = props.slots) == null ? void 0 : _a[import_canvas5.CANVAS_PERSONALIZE_SLOT];
625
633
  const components = indexes.map((index) => {
626
634
  const component = slot.items[index];
@@ -634,7 +642,7 @@ var PersonalizeServer = (props) => {
634
642
 
635
643
  // src/components/TestServer.ts
636
644
  var import_canvas6 = require("@uniformdev/canvas");
637
- var import_canvas_next_rsc_shared6 = require("@uniformdev/canvas-next-rsc-shared");
645
+ var import_canvas_next_rsc_shared5 = require("@uniformdev/canvas-next-rsc-shared");
638
646
  var import_react7 = require("react");
639
647
 
640
648
  // src/components/ContextTestTransfer.tsx
@@ -652,7 +660,7 @@ var TestServer = (props) => {
652
660
  if (!isTestDefined && process.env.NODE_ENV !== "production") {
653
661
  console.warn(`Test "${test}" is not defined in Uniform manifest.`);
654
662
  }
655
- const { index, event } = (0, import_canvas_next_rsc_shared6.runTest)(props);
663
+ const { index, event } = (0, import_canvas_next_rsc_shared5.runTest)(props);
656
664
  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;
657
665
  const eventElement = (0, import_react7.createElement)(ContextTestTransfer, {
658
666
  event
@@ -676,7 +684,7 @@ var UniformComposition = async ({
676
684
  });
677
685
  searchParams = props.searchParams;
678
686
  }
679
- const { value: path } = (0, import_canvas_next_rsc_shared7.resolvePath)(props);
687
+ const { value: path } = (0, import_canvas_next_rsc_shared6.resolvePath)(props);
680
688
  if (!route || route.type === "notFound") {
681
689
  (0, import_navigation.notFound)();
682
690
  }
@@ -751,10 +759,10 @@ var isServerComponent = ({
751
759
  }) => {
752
760
  var _a, _b;
753
761
  if (component.type === import_canvas7.CANVAS_PERSONALIZE_TYPE) {
754
- return serverContext && ((_a = (0, import_canvas_next_rsc_shared7.getServerConfig)().evaluation) == null ? void 0 : _a.personalization) !== "client";
762
+ return serverContext && ((_a = getServerConfig().evaluation) == null ? void 0 : _a.personalization) !== "client";
755
763
  }
756
764
  if (component.type === import_canvas7.CANVAS_TEST_TYPE) {
757
- return serverContext && ((_b = (0, import_canvas_next_rsc_shared7.getServerConfig)().evaluation) == null ? void 0 : _b.testing) !== "client";
765
+ return serverContext && ((_b = getServerConfig().evaluation) == null ? void 0 : _b.testing) !== "client";
758
766
  }
759
767
  };
760
768
  var resolveSystemComponent = ({
@@ -953,7 +961,6 @@ var resolveComponents = ({
953
961
 
954
962
  // src/components/UniformContext.tsx
955
963
  var import_canvas_next_rsc_client7 = require("@uniformdev/canvas-next-rsc-client");
956
- var import_canvas_next_rsc_shared8 = require("@uniformdev/canvas-next-rsc-shared");
957
964
  var import_react9 = require("react");
958
965
  var import_react10 = __toESM(require("react"));
959
966
  var UniformContext = async ({
@@ -965,8 +972,17 @@ var UniformContext = async ({
965
972
  searchParams: {}
966
973
  });
967
974
  const ContextComponent = clientContextComponent || import_canvas_next_rsc_client7.DefaultUniformClientContext;
968
- const disableDevTools = ((_a = (0, import_canvas_next_rsc_shared8.getServerConfig)().context) == null ? void 0 : _a.disableDevTools) || false;
969
- 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)));
975
+ const serverConfig = getServerConfig();
976
+ const disableDevTools = ((_a = serverConfig.context) == null ? void 0 : _a.disableDevTools) || false;
977
+ const defaultConsent = serverConfig.defaultConsent || false;
978
+ return /* @__PURE__ */ import_react10.default.createElement(import_react10.default.Fragment, null, children, /* @__PURE__ */ import_react10.default.createElement(
979
+ ContextComponent,
980
+ {
981
+ manifest,
982
+ disableDevTools,
983
+ defaultConsent
984
+ }
985
+ ), /* @__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)));
970
986
  };
971
987
 
972
988
  // src/components/UniformPlayground.tsx
package/dist/index.mjs CHANGED
@@ -1,12 +1,17 @@
1
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
2
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
3
+ }) : x)(function(x) {
4
+ if (typeof require !== "undefined")
5
+ return require.apply(this, arguments);
6
+ throw Error('Dynamic require of "' + x + '" is not supported');
7
+ });
8
+
1
9
  // src/index.ts
2
10
  import "server-only";
3
11
 
4
12
  // src/clients/canvasClient.ts
5
13
  import { CanvasClient } from "@uniformdev/canvas";
6
14
 
7
- // src/config/helpers.ts
8
- import { getServerConfig } from "@uniformdev/canvas-next-rsc-shared";
9
-
10
15
  // src/utils/draft.ts
11
16
  import { IN_CONTEXT_EDITOR_QUERY_STRING_PARAM } from "@uniformdev/canvas";
12
17
  import { draftMode } from "next/headers";
@@ -37,6 +42,17 @@ var isDevelopmentEnvironment = () => {
37
42
  };
38
43
 
39
44
  // src/config/helpers.ts
45
+ var getServerConfig = () => {
46
+ let serverConfig;
47
+ try {
48
+ serverConfig = __require("uniform.server.config.js");
49
+ } catch (e) {
50
+ serverConfig = {
51
+ defaultConsent: false
52
+ };
53
+ }
54
+ return serverConfig;
55
+ };
40
56
  var shouldCacheBeDisabled = (options) => {
41
57
  if (isDraftModeEnabled(options)) {
42
58
  return { disabled: true, reason: "DRAFT" };
@@ -399,7 +415,6 @@ import {
399
415
  } from "@uniformdev/canvas";
400
416
  import { ClientContextualEditingComponentWrapper, TestClient } from "@uniformdev/canvas-next-rsc-client";
401
417
  import {
402
- getServerConfig as getServerConfig3,
403
418
  resolvePath as resolvePath2
404
419
  } from "@uniformdev/canvas-next-rsc-shared";
405
420
  import { PureContextualEditingComponentWrapper } from "@uniformdev/canvas-react/core";
@@ -441,7 +456,7 @@ import {
441
456
  CANVAS_EDITOR_STATE,
442
457
  CANVAS_PUBLISHED_STATE
443
458
  } from "@uniformdev/canvas";
444
- import { getBaseUrl, getServerConfig as getServerConfig2, resolvePath } from "@uniformdev/canvas-next-rsc-shared";
459
+ import { getBaseUrl, resolvePath } from "@uniformdev/canvas-next-rsc-shared";
445
460
  import { getTargetVariableExpandedUrl } from "@uniformdev/redirect";
446
461
  var retrieveRoute = async ({ params, searchParams, skipPrefetch }, fetchOptions) => {
447
462
  if (!skipPrefetch) {
@@ -523,7 +538,7 @@ var retrieveRouteByPath = async ({
523
538
  path: queryPath,
524
539
  state,
525
540
  withComponentIDs: true,
526
- withContentSourceMap: isOnVercelPreviewEnvironment() && ((_a = getServerConfig2().experimental) == null ? void 0 : _a.vercelVisualEditing)
541
+ withContentSourceMap: isOnVercelPreviewEnvironment() && ((_a = getServerConfig().experimental) == null ? void 0 : _a.vercelVisualEditing)
527
542
  });
528
543
  };
529
544
  var resolveRedirectHref = (resolveResult, path) => {
@@ -715,10 +730,10 @@ var isServerComponent = ({
715
730
  }) => {
716
731
  var _a, _b;
717
732
  if (component.type === CANVAS_PERSONALIZE_TYPE) {
718
- return serverContext && ((_a = getServerConfig3().evaluation) == null ? void 0 : _a.personalization) !== "client";
733
+ return serverContext && ((_a = getServerConfig().evaluation) == null ? void 0 : _a.personalization) !== "client";
719
734
  }
720
735
  if (component.type === CANVAS_TEST_TYPE) {
721
- return serverContext && ((_b = getServerConfig3().evaluation) == null ? void 0 : _b.testing) !== "client";
736
+ return serverContext && ((_b = getServerConfig().evaluation) == null ? void 0 : _b.testing) !== "client";
722
737
  }
723
738
  };
724
739
  var resolveSystemComponent = ({
@@ -920,7 +935,6 @@ import {
920
935
  DefaultUniformClientContext,
921
936
  UniformScript
922
937
  } from "@uniformdev/canvas-next-rsc-client";
923
- import { getServerConfig as getServerConfig4 } from "@uniformdev/canvas-next-rsc-shared";
924
938
  import { Suspense } from "react";
925
939
  import React6 from "react";
926
940
  var UniformContext = async ({
@@ -932,8 +946,17 @@ var UniformContext = async ({
932
946
  searchParams: {}
933
947
  });
934
948
  const ContextComponent = clientContextComponent || DefaultUniformClientContext;
935
- const disableDevTools = ((_a = getServerConfig4().context) == null ? void 0 : _a.disableDevTools) || false;
936
- 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)));
949
+ const serverConfig = getServerConfig();
950
+ const disableDevTools = ((_a = serverConfig.context) == null ? void 0 : _a.disableDevTools) || false;
951
+ const defaultConsent = serverConfig.defaultConsent || false;
952
+ return /* @__PURE__ */ React6.createElement(React6.Fragment, null, children, /* @__PURE__ */ React6.createElement(
953
+ ContextComponent,
954
+ {
955
+ manifest,
956
+ disableDevTools,
957
+ defaultConsent
958
+ }
959
+ ), /* @__PURE__ */ React6.createElement(Suspense, { fallback: /* @__PURE__ */ React6.createElement(React6.Fragment, null) }, /* @__PURE__ */ React6.createElement(UniformScript, null)));
937
960
  };
938
961
 
939
962
  // src/components/UniformPlayground.tsx
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/canvas-next-rsc",
3
- "version": "19.128.1-alpha.9+1af0ad2d62",
3
+ "version": "19.131.1-alpha.2+6efeeccb8b",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "scripts": {
6
6
  "build": "tsup",
@@ -61,15 +61,15 @@
61
61
  "react-dom": "18.2.0"
62
62
  },
63
63
  "dependencies": {
64
- "@uniformdev/canvas": "19.128.1-alpha.9+1af0ad2d62",
65
- "@uniformdev/canvas-next-rsc-client": "^19.128.1-alpha.9+1af0ad2d62",
66
- "@uniformdev/canvas-next-rsc-shared": "^19.128.1-alpha.9+1af0ad2d62",
67
- "@uniformdev/canvas-react": "19.128.1-alpha.9+1af0ad2d62",
68
- "@uniformdev/context": "19.128.1-alpha.9+1af0ad2d62",
69
- "@uniformdev/project-map": "19.128.1-alpha.9+1af0ad2d62",
70
- "@uniformdev/redirect": "19.128.1-alpha.9+1af0ad2d62",
71
- "@uniformdev/richtext": "19.128.1-alpha.9+1af0ad2d62",
72
- "@uniformdev/webhooks": "19.128.1-alpha.9+1af0ad2d62",
64
+ "@uniformdev/canvas": "19.131.1-alpha.2+6efeeccb8b",
65
+ "@uniformdev/canvas-next-rsc-client": "^19.131.1-alpha.2+6efeeccb8b",
66
+ "@uniformdev/canvas-next-rsc-shared": "^19.131.1-alpha.2+6efeeccb8b",
67
+ "@uniformdev/canvas-react": "19.131.1-alpha.2+6efeeccb8b",
68
+ "@uniformdev/context": "19.131.1-alpha.2+6efeeccb8b",
69
+ "@uniformdev/project-map": "19.131.1-alpha.2+6efeeccb8b",
70
+ "@uniformdev/redirect": "19.131.1-alpha.2+6efeeccb8b",
71
+ "@uniformdev/richtext": "19.131.1-alpha.2+6efeeccb8b",
72
+ "@uniformdev/webhooks": "19.131.1-alpha.2+6efeeccb8b",
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": "1af0ad2d62257f3f8d34a8eca337dad8b6025b6e"
89
+ "gitHead": "6efeeccb8b52f103e52aface1e43b3fec577869e"
90
90
  }