@uniformdev/next-app-router 20.7.1-alpha.123 → 20.7.1-alpha.136

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.
@@ -0,0 +1,11 @@
1
+ // src/config/default.ts
2
+ var config = {
3
+ defaultConsent: true,
4
+ quirkSerialization: true,
5
+ middlewareRuntimeCache: true,
6
+ playgroundPath: "/uniform/playground"
7
+ };
8
+ var default_default = config;
9
+ export {
10
+ default_default as default
11
+ };
package/dist/config.d.mts CHANGED
@@ -3,7 +3,12 @@ export { UniformServerConfig } from '@uniformdev/next-app-router-shared';
3
3
 
4
4
  /**
5
5
  * Wraps the Next.js config to set up the Uniform server config alias.
6
- * This enables the `uniform.server.config` import to resolve to the project's config file.
6
+ *
7
+ * If a `uniform.server.config.{js,cjs,mjs,ts}` file exists in the project root,
8
+ * this sets up an alias so that `@uniformdev/next-app-router/config/resolved`
9
+ * imports the user's config instead of the default.
10
+ *
11
+ * This wrapper is optional - without it, the default config will be used.
7
12
  *
8
13
  * @param nextConfig - The Next.js configuration object
9
14
  * @returns The modified Next.js configuration with Uniform config alias set up
package/dist/config.d.ts CHANGED
@@ -3,7 +3,12 @@ export { UniformServerConfig } from '@uniformdev/next-app-router-shared';
3
3
 
4
4
  /**
5
5
  * Wraps the Next.js config to set up the Uniform server config alias.
6
- * This enables the `uniform.server.config` import to resolve to the project's config file.
6
+ *
7
+ * If a `uniform.server.config.{js,cjs,mjs,ts}` file exists in the project root,
8
+ * this sets up an alias so that `@uniformdev/next-app-router/config/resolved`
9
+ * imports the user's config instead of the default.
10
+ *
11
+ * This wrapper is optional - without it, the default config will be used.
7
12
  *
8
13
  * @param nextConfig - The Next.js configuration object
9
14
  * @returns The modified Next.js configuration with Uniform config alias set up
package/dist/config.js CHANGED
@@ -25,37 +25,29 @@ __export(config_exports, {
25
25
  module.exports = __toCommonJS(config_exports);
26
26
  var import_fs = require("fs");
27
27
  var import_path = require("path");
28
+ var CONFIG_IMPORT_PATH = "@uniformdev/next-app-router/config/resolved";
28
29
  var getConfigPath = () => {
29
30
  const possibleExtensions = [".js", ".cjs", ".mjs", ".ts"];
30
- let configFilePath;
31
- let configFileName;
32
31
  for (const extension of possibleExtensions) {
33
32
  const fileName = `uniform.server.config${extension}`;
34
33
  const filePath = (0, import_path.join)(process.cwd(), fileName);
35
34
  if ((0, import_fs.existsSync)(filePath)) {
36
- configFilePath = filePath;
37
- configFileName = fileName;
38
- break;
35
+ return { filePath, fileName };
39
36
  }
40
37
  }
41
- if (!configFilePath) {
42
- return void 0;
43
- }
44
- return {
45
- filePath: configFilePath,
46
- fileName: configFileName
47
- };
38
+ return void 0;
48
39
  };
49
40
  var withUniformConfig = (nextConfig) => {
50
41
  var _a;
51
- const { fileName: uniformConfigFileName, filePath: uniformConfigFilePath } = getConfigPath() || {};
42
+ const configPath = getConfigPath();
43
+ if (!configPath) {
44
+ return nextConfig;
45
+ }
46
+ console.log("Using Uniform config from", configPath.fileName);
52
47
  const turbopackResolveAlias = {
53
- ...(_a = nextConfig.turbopack) == null ? void 0 : _a.resolveAlias
48
+ ...(_a = nextConfig.turbopack) == null ? void 0 : _a.resolveAlias,
49
+ [CONFIG_IMPORT_PATH]: `./${configPath.fileName}`
54
50
  };
55
- if (uniformConfigFileName) {
56
- console.log("(Turbopack) Using Uniform config from", uniformConfigFileName);
57
- turbopackResolveAlias["uniform.server.config"] = `./${uniformConfigFileName}`;
58
- }
59
51
  return {
60
52
  ...nextConfig,
61
53
  turbopack: {
@@ -66,9 +58,8 @@ var withUniformConfig = (nextConfig) => {
66
58
  if (nextConfig.webpack) {
67
59
  nextConfig.webpack(config, context);
68
60
  }
69
- if (context.isServer && uniformConfigFilePath) {
70
- console.log("(Webpack) Using Uniform config from", uniformConfigFilePath);
71
- config.resolve.alias["uniform.server.config"] = (0, import_path.resolve)(config.context, uniformConfigFilePath);
61
+ if (context.isServer) {
62
+ config.resolve.alias[CONFIG_IMPORT_PATH] = (0, import_path.resolve)(config.context, configPath.filePath);
72
63
  }
73
64
  return config;
74
65
  }
package/dist/config.mjs CHANGED
@@ -1,37 +1,29 @@
1
1
  // src/config.ts
2
2
  import { existsSync } from "fs";
3
3
  import { join, resolve } from "path";
4
+ var CONFIG_IMPORT_PATH = "@uniformdev/next-app-router/config/resolved";
4
5
  var getConfigPath = () => {
5
6
  const possibleExtensions = [".js", ".cjs", ".mjs", ".ts"];
6
- let configFilePath;
7
- let configFileName;
8
7
  for (const extension of possibleExtensions) {
9
8
  const fileName = `uniform.server.config${extension}`;
10
9
  const filePath = join(process.cwd(), fileName);
11
10
  if (existsSync(filePath)) {
12
- configFilePath = filePath;
13
- configFileName = fileName;
14
- break;
11
+ return { filePath, fileName };
15
12
  }
16
13
  }
17
- if (!configFilePath) {
18
- return void 0;
19
- }
20
- return {
21
- filePath: configFilePath,
22
- fileName: configFileName
23
- };
14
+ return void 0;
24
15
  };
25
16
  var withUniformConfig = (nextConfig) => {
26
17
  var _a;
27
- const { fileName: uniformConfigFileName, filePath: uniformConfigFilePath } = getConfigPath() || {};
18
+ const configPath = getConfigPath();
19
+ if (!configPath) {
20
+ return nextConfig;
21
+ }
22
+ console.log("Using Uniform config from", configPath.fileName);
28
23
  const turbopackResolveAlias = {
29
- ...(_a = nextConfig.turbopack) == null ? void 0 : _a.resolveAlias
24
+ ...(_a = nextConfig.turbopack) == null ? void 0 : _a.resolveAlias,
25
+ [CONFIG_IMPORT_PATH]: `./${configPath.fileName}`
30
26
  };
31
- if (uniformConfigFileName) {
32
- console.log("(Turbopack) Using Uniform config from", uniformConfigFileName);
33
- turbopackResolveAlias["uniform.server.config"] = `./${uniformConfigFileName}`;
34
- }
35
27
  return {
36
28
  ...nextConfig,
37
29
  turbopack: {
@@ -42,9 +34,8 @@ var withUniformConfig = (nextConfig) => {
42
34
  if (nextConfig.webpack) {
43
35
  nextConfig.webpack(config, context);
44
36
  }
45
- if (context.isServer && uniformConfigFilePath) {
46
- console.log("(Webpack) Using Uniform config from", uniformConfigFilePath);
47
- config.resolve.alias["uniform.server.config"] = resolve(config.context, uniformConfigFilePath);
37
+ if (context.isServer) {
38
+ config.resolve.alias[CONFIG_IMPORT_PATH] = resolve(config.context, configPath.filePath);
48
39
  }
49
40
  return config;
50
41
  }
package/dist/handler.js CHANGED
@@ -1378,6 +1378,9 @@ _url8 = /* @__PURE__ */ new WeakMap();
1378
1378
  __privateAdd2(_DataTypeClient, _url8, "/api/v1/data-types");
1379
1379
  var CANVAS_DRAFT_STATE = 0;
1380
1380
  var CANVAS_EDITOR_STATE = 63;
1381
+ var CANVAS_INTERNAL_PARAM_PREFIX = "$internal_";
1382
+ var CANVAS_COMPONENT_DISPLAY_NAME_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}displayName`;
1383
+ var CANVAS_HYPOTHESIS_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}hypothesis`;
1381
1384
  var SECRET_QUERY_STRING_PARAM = "secret";
1382
1385
  var IN_CONTEXT_EDITOR_QUERY_STRING_PARAM = "is_incontext_editing_mode";
1383
1386
  var IN_CONTEXT_EDITOR_PLAYGROUND_QUERY_STRING_PARAM = "is_incontext_editing_playground";
@@ -1533,9 +1536,18 @@ var import_navigation = require("next/navigation");
1533
1536
  var import_server = require("next/server");
1534
1537
 
1535
1538
  // src/config/helpers.ts
1536
- var import_uniform_server = __toESM(require("uniform.server.config"));
1537
- var getServerConfig = () => {
1538
- return import_uniform_server.default;
1539
+ var import_resolved = __toESM(require("@uniformdev/next-app-router/config/resolved"));
1540
+ var getMiddlewareRuntimeCache = () => {
1541
+ if (typeof import_resolved.default.middlewareRuntimeCache === "boolean") {
1542
+ return import_resolved.default.middlewareRuntimeCache;
1543
+ }
1544
+ return true;
1545
+ };
1546
+ var getPlaygroundPath = () => {
1547
+ if (typeof import_resolved.default.playgroundPath === "string") {
1548
+ return import_resolved.default.playgroundPath;
1549
+ }
1550
+ return "/uniform/playground";
1539
1551
  };
1540
1552
 
1541
1553
  // src/handler/createPreviewGETRouteHandler.ts
@@ -1554,7 +1566,7 @@ var contextualEditingQueryParams = [
1554
1566
  var createPreviewGETRouteHandler = (options) => {
1555
1567
  return async (request) => {
1556
1568
  const isConfigCheck = getQueryParam(request, "is_config_check") === "true";
1557
- const { playgroundPath } = getServerConfig();
1569
+ const playgroundPath = getPlaygroundPath();
1558
1570
  if (isConfigCheck) {
1559
1571
  return Response.json(
1560
1572
  {
@@ -1738,7 +1750,13 @@ var isDraftModeEnabled = ({
1738
1750
  }) => {
1739
1751
  return draftModeEnabled;
1740
1752
  };
1741
- var isIncontextEditingEnabled = ({ searchParams }) => {
1753
+ var isIncontextEditingEnabled = ({
1754
+ isDraftModeEnabled: isDraftModeEnabled2,
1755
+ searchParams
1756
+ }) => {
1757
+ if (!isDraftModeEnabled2) {
1758
+ return false;
1759
+ }
1742
1760
  const containsKey = searchParams.has(IN_CONTEXT_EDITOR_QUERY_STRING_PARAM);
1743
1761
  return containsKey;
1744
1762
  };
@@ -1747,9 +1765,6 @@ var isDevelopmentEnvironment = () => {
1747
1765
  };
1748
1766
 
1749
1767
  // src/clients/cache.ts
1750
- var isSpecificCacheMode = (options) => {
1751
- return "cache" in options;
1752
- };
1753
1768
  var isStateCacheMode = (options) => {
1754
1769
  return "state" in options;
1755
1770
  };
@@ -1758,25 +1773,20 @@ var isDetectCacheMode = (options) => {
1758
1773
  };
1759
1774
  var resolveCanvasCache = (options) => {
1760
1775
  return resolveCache({
1761
- options,
1762
- defaultCache: getServerConfig().canvasCache
1776
+ options
1763
1777
  });
1764
1778
  };
1765
1779
  var resolveProjectMapCache = (options) => {
1766
1780
  return resolveCache({
1767
- options,
1768
- defaultCache: getServerConfig().projectMapCache
1781
+ options
1769
1782
  });
1770
1783
  };
1771
1784
  var resolveCache = ({
1772
- options,
1773
- defaultCache
1785
+ options
1774
1786
  }) => {
1775
- let cache = defaultCache;
1787
+ let cache = void 0;
1776
1788
  if (options) {
1777
- if (isSpecificCacheMode(options)) {
1778
- cache = options.cache;
1779
- } else if (isStateCacheMode(options)) {
1789
+ if (isStateCacheMode(options)) {
1780
1790
  if (options.state === CANVAS_DRAFT_STATE || options.state === CANVAS_EDITOR_STATE) {
1781
1791
  cache = {
1782
1792
  type: "no-cache",
@@ -1801,7 +1811,10 @@ var shouldCacheBeDisabled = (options) => {
1801
1811
  if (isDraftModeEnabled(options)) {
1802
1812
  return { disabled: true, reason: "DRAFT" };
1803
1813
  }
1804
- if (isIncontextEditingEnabled(options)) {
1814
+ if (isIncontextEditingEnabled({
1815
+ isDraftModeEnabled: options.draftModeEnabled,
1816
+ searchParams: options.searchParams
1817
+ })) {
1805
1818
  return { disabled: true, reason: "INCONTEXT" };
1806
1819
  }
1807
1820
  if (isDevelopmentEnvironment()) {
@@ -2599,7 +2612,6 @@ var createPreviewPOSTRouteHandler = () => {
2599
2612
  };
2600
2613
  };
2601
2614
  var handleSvixMessage = async (request) => {
2602
- var _a;
2603
2615
  const handlers = [
2604
2616
  handleProjectMapNodeUpdate,
2605
2617
  handleProjectMapNodeInsert,
@@ -2633,7 +2645,7 @@ var handleSvixMessage = async (request) => {
2633
2645
  }
2634
2646
  }
2635
2647
  if (tags == null ? void 0 : tags.length) {
2636
- const cache = ((_a = getServerConfig().experimental) == null ? void 0 : _a.middlewareRuntimeCache) ? (0, import_functions.getCache)() : void 0;
2648
+ const cache = getMiddlewareRuntimeCache() ? (0, import_functions.getCache)() : void 0;
2637
2649
  for (let i = 0; i < tags.length; i++) {
2638
2650
  const tag = tags[i];
2639
2651
  (0, import_cache4.revalidateTag)(tag, "max");
package/dist/handler.mjs CHANGED
@@ -1363,6 +1363,9 @@ _url8 = /* @__PURE__ */ new WeakMap();
1363
1363
  __privateAdd2(_DataTypeClient, _url8, "/api/v1/data-types");
1364
1364
  var CANVAS_DRAFT_STATE = 0;
1365
1365
  var CANVAS_EDITOR_STATE = 63;
1366
+ var CANVAS_INTERNAL_PARAM_PREFIX = "$internal_";
1367
+ var CANVAS_COMPONENT_DISPLAY_NAME_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}displayName`;
1368
+ var CANVAS_HYPOTHESIS_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}hypothesis`;
1366
1369
  var SECRET_QUERY_STRING_PARAM = "secret";
1367
1370
  var IN_CONTEXT_EDITOR_QUERY_STRING_PARAM = "is_incontext_editing_mode";
1368
1371
  var IN_CONTEXT_EDITOR_PLAYGROUND_QUERY_STRING_PARAM = "is_incontext_editing_playground";
@@ -1518,9 +1521,18 @@ import { redirect } from "next/navigation";
1518
1521
  import { NextResponse } from "next/server";
1519
1522
 
1520
1523
  // src/config/helpers.ts
1521
- import serverConfig from "uniform.server.config";
1522
- var getServerConfig = () => {
1523
- return serverConfig;
1524
+ import config from "@uniformdev/next-app-router/config/resolved";
1525
+ var getMiddlewareRuntimeCache = () => {
1526
+ if (typeof config.middlewareRuntimeCache === "boolean") {
1527
+ return config.middlewareRuntimeCache;
1528
+ }
1529
+ return true;
1530
+ };
1531
+ var getPlaygroundPath = () => {
1532
+ if (typeof config.playgroundPath === "string") {
1533
+ return config.playgroundPath;
1534
+ }
1535
+ return "/uniform/playground";
1524
1536
  };
1525
1537
 
1526
1538
  // src/handler/createPreviewGETRouteHandler.ts
@@ -1539,7 +1551,7 @@ var contextualEditingQueryParams = [
1539
1551
  var createPreviewGETRouteHandler = (options) => {
1540
1552
  return async (request) => {
1541
1553
  const isConfigCheck = getQueryParam(request, "is_config_check") === "true";
1542
- const { playgroundPath } = getServerConfig();
1554
+ const playgroundPath = getPlaygroundPath();
1543
1555
  if (isConfigCheck) {
1544
1556
  return Response.json(
1545
1557
  {
@@ -1723,7 +1735,13 @@ var isDraftModeEnabled = ({
1723
1735
  }) => {
1724
1736
  return draftModeEnabled;
1725
1737
  };
1726
- var isIncontextEditingEnabled = ({ searchParams }) => {
1738
+ var isIncontextEditingEnabled = ({
1739
+ isDraftModeEnabled: isDraftModeEnabled2,
1740
+ searchParams
1741
+ }) => {
1742
+ if (!isDraftModeEnabled2) {
1743
+ return false;
1744
+ }
1727
1745
  const containsKey = searchParams.has(IN_CONTEXT_EDITOR_QUERY_STRING_PARAM);
1728
1746
  return containsKey;
1729
1747
  };
@@ -1732,9 +1750,6 @@ var isDevelopmentEnvironment = () => {
1732
1750
  };
1733
1751
 
1734
1752
  // src/clients/cache.ts
1735
- var isSpecificCacheMode = (options) => {
1736
- return "cache" in options;
1737
- };
1738
1753
  var isStateCacheMode = (options) => {
1739
1754
  return "state" in options;
1740
1755
  };
@@ -1743,25 +1758,20 @@ var isDetectCacheMode = (options) => {
1743
1758
  };
1744
1759
  var resolveCanvasCache = (options) => {
1745
1760
  return resolveCache({
1746
- options,
1747
- defaultCache: getServerConfig().canvasCache
1761
+ options
1748
1762
  });
1749
1763
  };
1750
1764
  var resolveProjectMapCache = (options) => {
1751
1765
  return resolveCache({
1752
- options,
1753
- defaultCache: getServerConfig().projectMapCache
1766
+ options
1754
1767
  });
1755
1768
  };
1756
1769
  var resolveCache = ({
1757
- options,
1758
- defaultCache
1770
+ options
1759
1771
  }) => {
1760
- let cache = defaultCache;
1772
+ let cache = void 0;
1761
1773
  if (options) {
1762
- if (isSpecificCacheMode(options)) {
1763
- cache = options.cache;
1764
- } else if (isStateCacheMode(options)) {
1774
+ if (isStateCacheMode(options)) {
1765
1775
  if (options.state === CANVAS_DRAFT_STATE || options.state === CANVAS_EDITOR_STATE) {
1766
1776
  cache = {
1767
1777
  type: "no-cache",
@@ -1786,7 +1796,10 @@ var shouldCacheBeDisabled = (options) => {
1786
1796
  if (isDraftModeEnabled(options)) {
1787
1797
  return { disabled: true, reason: "DRAFT" };
1788
1798
  }
1789
- if (isIncontextEditingEnabled(options)) {
1799
+ if (isIncontextEditingEnabled({
1800
+ isDraftModeEnabled: options.draftModeEnabled,
1801
+ searchParams: options.searchParams
1802
+ })) {
1790
1803
  return { disabled: true, reason: "INCONTEXT" };
1791
1804
  }
1792
1805
  if (isDevelopmentEnvironment()) {
@@ -2584,7 +2597,6 @@ var createPreviewPOSTRouteHandler = () => {
2584
2597
  };
2585
2598
  };
2586
2599
  var handleSvixMessage = async (request) => {
2587
- var _a;
2588
2600
  const handlers = [
2589
2601
  handleProjectMapNodeUpdate,
2590
2602
  handleProjectMapNodeInsert,
@@ -2618,7 +2630,7 @@ var handleSvixMessage = async (request) => {
2618
2630
  }
2619
2631
  }
2620
2632
  if (tags == null ? void 0 : tags.length) {
2621
- const cache = ((_a = getServerConfig().experimental) == null ? void 0 : _a.middlewareRuntimeCache) ? getCache() : void 0;
2633
+ const cache = getMiddlewareRuntimeCache() ? getCache() : void 0;
2622
2634
  for (let i = 0; i < tags.length; i++) {
2623
2635
  const tag = tags[i];
2624
2636
  revalidateTag(tag, "max");
package/dist/index.d.mts CHANGED
@@ -2,8 +2,8 @@ import { CanvasClient, RouteClient, ComponentInstance } from '@uniformdev/canvas
2
2
  import { CacheMode, CanvasCacheMode, ManifestCacheMode, ProjectMapCacheMode, RewriteRequestPathResult } from '@uniformdev/next-app-router-shared';
3
3
  import { ManifestClient } from '@uniformdev/context/api';
4
4
  import { ProjectMapClient } from '@uniformdev/project-map';
5
- import { U as UniformCompositionProps } from './UniformComposition-CHUPULqc.mjs';
6
- export { C as CompositionCache, a as ResolveComponentFunction, R as ResolveComponentResult, b as UniformComposition, c as createCompositionCache } from './UniformComposition-CHUPULqc.mjs';
5
+ import { U as UniformCompositionProps } from './UniformComposition-hhRIBHmn.mjs';
6
+ export { C as CompositionCache, a as ResolveComponentFunction, R as ResolveComponentResult, b as UniformComposition, c as createCompositionCache } from './UniformComposition-hhRIBHmn.mjs';
7
7
  import React from 'react';
8
8
  export { D as DataClient, a as DefaultDataClient, E as EnhanceRouteOptions, G as GetRouteFromMiddlewareOptions, b as GetRouteFromPageStateOptions, c as GetRouteOptions, R as RewriteRouteOptions, d as RewriteRouteResult, e as expireMiddlewareCacheTag } from './client-BCGVjYM-.mjs';
9
9
  import { a as ResolvedRouteResult } from './resolveRouteFromCode-CKaYNXte.mjs';
package/dist/index.d.ts CHANGED
@@ -2,8 +2,8 @@ import { CanvasClient, RouteClient, ComponentInstance } from '@uniformdev/canvas
2
2
  import { CacheMode, CanvasCacheMode, ManifestCacheMode, ProjectMapCacheMode, RewriteRequestPathResult } from '@uniformdev/next-app-router-shared';
3
3
  import { ManifestClient } from '@uniformdev/context/api';
4
4
  import { ProjectMapClient } from '@uniformdev/project-map';
5
- import { U as UniformCompositionProps } from './UniformComposition-r8a9xGZn.js';
6
- export { C as CompositionCache, a as ResolveComponentFunction, R as ResolveComponentResult, b as UniformComposition, c as createCompositionCache } from './UniformComposition-r8a9xGZn.js';
5
+ import { U as UniformCompositionProps } from './UniformComposition-d7_93l3F.js';
6
+ export { C as CompositionCache, a as ResolveComponentFunction, R as ResolveComponentResult, b as UniformComposition, c as createCompositionCache } from './UniformComposition-d7_93l3F.js';
7
7
  import React from 'react';
8
8
  export { D as DataClient, a as DefaultDataClient, E as EnhanceRouteOptions, G as GetRouteFromMiddlewareOptions, b as GetRouteFromPageStateOptions, c as GetRouteOptions, R as RewriteRouteOptions, d as RewriteRouteResult, e as expireMiddlewareCacheTag } from './client-BCGVjYM-.js';
9
9
  import { a as ResolvedRouteResult } from './resolveRouteFromCode-DgTsfMK8.js';
package/dist/index.esm.js CHANGED
@@ -1404,6 +1404,9 @@ var CANVAS_EDITOR_STATE = 63;
1404
1404
  var CANVAS_PERSONALIZATION_PARAM = "$pzCrit";
1405
1405
  var CANVAS_TEST_VARIANT_PARAM = "$tstVrnt";
1406
1406
  var CANVAS_ENRICHMENT_TAG_PARAM = "$enr";
1407
+ var CANVAS_INTERNAL_PARAM_PREFIX = "$internal_";
1408
+ var CANVAS_COMPONENT_DISPLAY_NAME_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}displayName`;
1409
+ var CANVAS_HYPOTHESIS_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}hypothesis`;
1407
1410
  var CANVAS_CONTEXTUAL_EDITING_PARAM = "$contextualEditing";
1408
1411
  var IN_CONTEXT_EDITOR_QUERY_STRING_PARAM = "is_incontext_editing_mode";
1409
1412
  var PLACEHOLDER_ID = "placeholder";
@@ -1951,19 +1954,19 @@ var buildCompositionTag = (compositionId) => {
1951
1954
  return `composition:${compositionId}`.toLowerCase();
1952
1955
  };
1953
1956
 
1954
- // src/config/helpers.ts
1955
- import serverConfig from "uniform.server.config";
1956
- var getServerConfig = () => {
1957
- return serverConfig;
1958
- };
1959
-
1960
1957
  // src/utils/draft.ts
1961
1958
  var isDraftModeEnabled = ({
1962
1959
  draftModeEnabled
1963
1960
  }) => {
1964
1961
  return draftModeEnabled;
1965
1962
  };
1966
- var isIncontextEditingEnabled = ({ searchParams }) => {
1963
+ var isIncontextEditingEnabled = ({
1964
+ isDraftModeEnabled: isDraftModeEnabled2,
1965
+ searchParams
1966
+ }) => {
1967
+ if (!isDraftModeEnabled2) {
1968
+ return false;
1969
+ }
1967
1970
  const containsKey = searchParams.has(IN_CONTEXT_EDITOR_QUERY_STRING_PARAM);
1968
1971
  return containsKey;
1969
1972
  };
@@ -1972,9 +1975,6 @@ var isDevelopmentEnvironment = () => {
1972
1975
  };
1973
1976
 
1974
1977
  // src/clients/cache.ts
1975
- var isSpecificCacheMode = (options) => {
1976
- return "cache" in options;
1977
- };
1978
1978
  var isStateCacheMode = (options) => {
1979
1979
  return "state" in options;
1980
1980
  };
@@ -1983,31 +1983,25 @@ var isDetectCacheMode = (options) => {
1983
1983
  };
1984
1984
  var resolveManifestCache = (options) => {
1985
1985
  return resolveCache({
1986
- options,
1987
- defaultCache: getServerConfig().manifestCache
1986
+ options
1988
1987
  });
1989
1988
  };
1990
1989
  var resolveCanvasCache = (options) => {
1991
1990
  return resolveCache({
1992
- options,
1993
- defaultCache: getServerConfig().canvasCache
1991
+ options
1994
1992
  });
1995
1993
  };
1996
1994
  var resolveProjectMapCache = (options) => {
1997
1995
  return resolveCache({
1998
- options,
1999
- defaultCache: getServerConfig().projectMapCache
1996
+ options
2000
1997
  });
2001
1998
  };
2002
1999
  var resolveCache = ({
2003
- options,
2004
- defaultCache
2000
+ options
2005
2001
  }) => {
2006
- let cache2 = defaultCache;
2002
+ let cache2 = void 0;
2007
2003
  if (options) {
2008
- if (isSpecificCacheMode(options)) {
2009
- cache2 = options.cache;
2010
- } else if (isStateCacheMode(options)) {
2004
+ if (isStateCacheMode(options)) {
2011
2005
  if (options.state === CANVAS_DRAFT_STATE || options.state === CANVAS_EDITOR_STATE) {
2012
2006
  cache2 = {
2013
2007
  type: "no-cache",
@@ -2032,7 +2026,10 @@ var shouldCacheBeDisabled = (options) => {
2032
2026
  if (isDraftModeEnabled(options)) {
2033
2027
  return { disabled: true, reason: "DRAFT" };
2034
2028
  }
2035
- if (isIncontextEditingEnabled(options)) {
2029
+ if (isIncontextEditingEnabled({
2030
+ isDraftModeEnabled: options.draftModeEnabled,
2031
+ searchParams: options.searchParams
2032
+ })) {
2036
2033
  return { disabled: true, reason: "INCONTEXT" };
2037
2034
  }
2038
2035
  if (isDevelopmentEnvironment()) {
@@ -2799,7 +2796,6 @@ var Test = ({ index, slots, test, component, context: compositionContext }) => {
2799
2796
  const indexToShow = typeof index === "number" ? (_b = (_a = slots == null ? void 0 : slots[CANVAS_TEST_SLOT]) == null ? void 0 : _a.items[index]) != null ? _b : null : null;
2800
2797
  const event = {
2801
2798
  name: test.name,
2802
- // todo: add Control Group support
2803
2799
  control: (_d = (_c = test.variations[index]) == null ? void 0 : _c.control) != null ? _d : false,
2804
2800
  variantAssigned: true,
2805
2801
  variantId: (_f = (_e = test.variations[index]) == null ? void 0 : _e.id) != null ? _f : "NO_VARIANTS",
@@ -2831,8 +2827,45 @@ var UniformCompositionWrapper = ({
2831
2827
  // src/components/UniformContext.tsx
2832
2828
  import { DefaultUniformClientContext } from "@uniformdev/next-app-router-client";
2833
2829
  import React3 from "react";
2830
+
2831
+ // src/config/helpers.ts
2832
+ import config from "@uniformdev/next-app-router/config/resolved";
2833
+ var getDisabledDevTools = () => {
2834
+ var _a;
2835
+ if (typeof ((_a = config.context) == null ? void 0 : _a.disableDevTools) === "boolean") {
2836
+ return config.context.disableDevTools;
2837
+ }
2838
+ return false;
2839
+ };
2840
+ var getDefaultConsent = () => {
2841
+ if (typeof config.defaultConsent === "boolean") {
2842
+ return config.defaultConsent;
2843
+ }
2844
+ return false;
2845
+ };
2846
+ var getQuirkSerialization = () => {
2847
+ if (typeof config.quirkSerialization === "boolean") {
2848
+ return config.quirkSerialization;
2849
+ }
2850
+ return true;
2851
+ };
2852
+ var getMiddlewareRuntimeCache = () => {
2853
+ if (typeof config.middlewareRuntimeCache === "boolean") {
2854
+ return config.middlewareRuntimeCache;
2855
+ }
2856
+ return true;
2857
+ };
2858
+ var getDisableSwrMiddlewareCache = () => {
2859
+ var _a;
2860
+ if (typeof ((_a = config.experimental) == null ? void 0 : _a.disableSwrMiddlewareCache) === "boolean") {
2861
+ return config.experimental.disableSwrMiddlewareCache;
2862
+ }
2863
+ return false;
2864
+ };
2865
+
2866
+ // src/components/UniformContext.tsx
2834
2867
  var UniformContext = async ({ clientContextComponent, result }) => {
2835
- var _a, _b, _c, _d;
2868
+ var _a;
2836
2869
  const manifest = await getManifest({
2837
2870
  state: CANVAS_PUBLISHED_STATE
2838
2871
  });
@@ -2843,10 +2876,9 @@ var UniformContext = async ({ clientContextComponent, result }) => {
2843
2876
  matchedRoute: route.matchedRoute
2844
2877
  } : void 0;
2845
2878
  const ContextComponent = clientContextComponent || DefaultUniformClientContext;
2846
- const serverConfig2 = getServerConfig();
2847
- const disableDevTools = ((_a = serverConfig2.context) == null ? void 0 : _a.disableDevTools) || false;
2848
- const defaultConsent = (_c = (_b = result == null ? void 0 : result.pageState.defaultConsent) != null ? _b : serverConfig2.defaultConsent) != null ? _c : false;
2849
- const experimentalQuirkSerialization = ((_d = serverConfig2.experimental) == null ? void 0 : _d.quirkSerialization) || false;
2879
+ const disableDevTools = getDisabledDevTools();
2880
+ const defaultConsent = (_a = result == null ? void 0 : result.pageState.defaultConsent) != null ? _a : getDefaultConsent();
2881
+ const experimentalQuirkSerialization = getQuirkSerialization();
2850
2882
  return /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement(
2851
2883
  ContextComponent,
2852
2884
  {
@@ -2880,11 +2912,13 @@ async function UniformCompositionInner({
2880
2912
  resolveComponent,
2881
2913
  resolveEmptyPlaceholder,
2882
2914
  compositionCache,
2883
- clientContextComponent
2915
+ clientContextComponent,
2916
+ dataClient
2884
2917
  }) {
2885
2918
  var _a, _b;
2886
2919
  const result = await resolveRoute({
2887
- code
2920
+ code,
2921
+ dataClient
2888
2922
  });
2889
2923
  if (!(result == null ? void 0 : result.route) || ((_a = result == null ? void 0 : result.route) == null ? void 0 : _a.type) !== "composition") {
2890
2924
  notFound();
@@ -3567,7 +3601,7 @@ function permutationsWithoutRepetition(options, k) {
3567
3601
  }
3568
3602
  function combineAcrossGroups(perGroupSelections) {
3569
3603
  return perGroupSelections.reduce(
3570
- (acc, group) => acc.flatMap((config) => group.map((selection) => [...config, selection])),
3604
+ (acc, group) => acc.flatMap((config2) => group.map((selection) => [...config2, selection])),
3571
3605
  [[]]
3572
3606
  );
3573
3607
  }
@@ -3581,8 +3615,7 @@ import { getCache, waitUntil } from "@vercel/functions";
3581
3615
  var MANIFEST_CACHE_KEY = "uniform-manifest";
3582
3616
  var DefaultDataClient = class {
3583
3617
  async getManifest(options) {
3584
- var _a, _b;
3585
- const cache2 = options.source === "middleware" && ((_b = (_a = getServerConfig().experimental) == null ? void 0 : _a.middlewareRuntimeCache) != null ? _b : false) ? getCache() : null;
3618
+ const cache2 = options.source === "middleware" && getMiddlewareRuntimeCache() ? getCache() : null;
3586
3619
  if (cache2) {
3587
3620
  const cachedManifest = await cache2.get(MANIFEST_CACHE_KEY);
3588
3621
  if (cachedManifest) {
@@ -3668,18 +3701,16 @@ var DefaultDataClient = class {
3668
3701
  async enhanceRoute(_options) {
3669
3702
  }
3670
3703
  async getRouteMiddleware(options) {
3671
- var _a, _b, _c, _d;
3672
3704
  const routeClient = getRouteClient({
3673
3705
  searchParams: options.searchParams,
3674
3706
  draftModeEnabled: options.draftModeEnabled
3675
3707
  });
3676
- const config = getServerConfig();
3677
3708
  const resolvedRoute = await this.getRouteFromApi({
3678
3709
  source: "middleware",
3679
3710
  route: options.route,
3680
3711
  routeClient,
3681
- enableRuntimeCache: options.route.state === CANVAS_PUBLISHED_STATE && ((_b = (_a = config.experimental) == null ? void 0 : _a.middlewareRuntimeCache) != null ? _b : false),
3682
- disableSwrCache: (_d = (_c = config.experimental) == null ? void 0 : _c.disableSwrMiddlewareCache) != null ? _d : false
3712
+ enableRuntimeCache: options.route.state === CANVAS_PUBLISHED_STATE && getMiddlewareRuntimeCache(),
3713
+ disableSwrCache: getDisableSwrMiddlewareCache()
3683
3714
  });
3684
3715
  if (resolvedRoute.type === "composition") {
3685
3716
  await this.enhanceRoute({
@@ -3695,12 +3726,12 @@ var DefaultDataClient = class {
3695
3726
  };
3696
3727
  }
3697
3728
  async getRoutePageState(options) {
3698
- var _a;
3699
3729
  const routeClient = getRouteClient({
3700
- cache: options.pageState.compositionState === CANVAS_PUBLISHED_STATE ? (_a = getServerConfig().canvasCache) != null ? _a : {
3730
+ cache: options.pageState.compositionState === CANVAS_PUBLISHED_STATE ? {
3701
3731
  type: "force-cache"
3702
3732
  } : {
3703
- type: "no-cache"
3733
+ type: "no-cache",
3734
+ bypassCache: true
3704
3735
  }
3705
3736
  });
3706
3737
  const originalRoute = {
@@ -3732,8 +3763,7 @@ var DefaultDataClient = class {
3732
3763
  }
3733
3764
  };
3734
3765
  var expireMiddlewareCacheTag = async (tag) => {
3735
- var _a;
3736
- const cache2 = ((_a = getServerConfig().experimental) == null ? void 0 : _a.middlewareRuntimeCache) ? getCache() : null;
3766
+ const cache2 = getMiddlewareRuntimeCache() ? getCache() : null;
3737
3767
  if (cache2) {
3738
3768
  await cache2.expireTag(tag);
3739
3769
  } else {