@uniformdev/next-app-router 20.7.1-alpha.122 → 20.7.1-alpha.134

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.mjs 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,6 +2827,14 @@ 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 serverConfig from "uniform.server.config";
2833
+ var getServerConfig = () => {
2834
+ return serverConfig;
2835
+ };
2836
+
2837
+ // src/components/UniformContext.tsx
2834
2838
  var UniformContext = async ({ clientContextComponent, result }) => {
2835
2839
  var _a, _b, _c, _d;
2836
2840
  const manifest = await getManifest({
@@ -3695,12 +3699,12 @@ var DefaultDataClient = class {
3695
3699
  };
3696
3700
  }
3697
3701
  async getRoutePageState(options) {
3698
- var _a;
3699
3702
  const routeClient = getRouteClient({
3700
- cache: options.pageState.compositionState === CANVAS_PUBLISHED_STATE ? (_a = getServerConfig().canvasCache) != null ? _a : {
3703
+ cache: options.pageState.compositionState === CANVAS_PUBLISHED_STATE ? {
3701
3704
  type: "force-cache"
3702
3705
  } : {
3703
- type: "no-cache"
3706
+ type: "no-cache",
3707
+ bypassCache: true
3704
3708
  }
3705
3709
  });
3706
3710
  const originalRoute = {