@uniformdev/next-app-router 20.56.1-alpha.5 → 20.56.2-alpha.5

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/cache.js CHANGED
@@ -1412,8 +1412,15 @@ var isIncontextEditingEnabled = ({
1412
1412
  var isDevelopmentEnvironment = () => {
1413
1413
  return process.env.NODE_ENV === "development" || process.env.NODE_ENV === "test";
1414
1414
  };
1415
+ var shouldIgnoreRedirects = ({ state }) => {
1416
+ const isNotPublished = state !== CANVAS_PUBLISHED_STATE;
1417
+ return isNotPublished ? true : void 0;
1418
+ };
1415
1419
 
1416
1420
  // src/clients/cache.ts
1421
+ var isSpecificCacheMode = (options) => {
1422
+ return "cache" in options;
1423
+ };
1417
1424
  var isStateCacheMode = (options) => {
1418
1425
  return "state" in options;
1419
1426
  };
@@ -1435,7 +1442,9 @@ var resolveCache = ({
1435
1442
  }) => {
1436
1443
  let cache = void 0;
1437
1444
  if (options) {
1438
- if (isStateCacheMode(options)) {
1445
+ if (isSpecificCacheMode(options)) {
1446
+ cache = options.cache;
1447
+ } else if (isStateCacheMode(options)) {
1439
1448
  if (options.state === CANVAS_DRAFT_STATE || options.state === CANVAS_EDITOR_STATE) {
1440
1449
  cache = {
1441
1450
  type: "no-cache",
@@ -1755,7 +1764,10 @@ var DefaultDataClient = class {
1755
1764
  }
1756
1765
  }
1757
1766
  const manifest = await getManifest({
1758
- cache: {
1767
+ cache: isDevelopmentEnvironment() ? {
1768
+ type: "no-cache",
1769
+ bypassCache: true
1770
+ } : {
1759
1771
  type: "force-cache"
1760
1772
  }
1761
1773
  });
@@ -1858,12 +1870,13 @@ var DefaultDataClient = class {
1858
1870
  };
1859
1871
  }
1860
1872
  async getRoutePageState(options) {
1873
+ const shouldBypassCache = options.pageState.compositionState !== CANVAS_PUBLISHED_STATE || isDevelopmentEnvironment();
1861
1874
  const routeClient = getRouteClient({
1862
- cache: options.pageState.compositionState === CANVAS_PUBLISHED_STATE ? {
1863
- type: "force-cache"
1864
- } : {
1875
+ cache: shouldBypassCache ? {
1865
1876
  type: "no-cache",
1866
1877
  bypassCache: true
1878
+ } : {
1879
+ type: "force-cache"
1867
1880
  }
1868
1881
  });
1869
1882
  const originalRoute = {
@@ -1871,7 +1884,8 @@ var DefaultDataClient = class {
1871
1884
  state: options.pageState.compositionState,
1872
1885
  withComponentIDs: true,
1873
1886
  releaseId: options.pageState.releaseId,
1874
- locale: options.pageState.locale
1887
+ locale: options.pageState.locale,
1888
+ ignoreRedirects: shouldIgnoreRedirects({ state: options.pageState.compositionState })
1875
1889
  };
1876
1890
  const resolvedRoute = await this.getRouteFromApi({
1877
1891
  source: "pageState",
package/dist/cache.mjs CHANGED
@@ -1399,8 +1399,15 @@ var isIncontextEditingEnabled = ({
1399
1399
  var isDevelopmentEnvironment = () => {
1400
1400
  return process.env.NODE_ENV === "development" || process.env.NODE_ENV === "test";
1401
1401
  };
1402
+ var shouldIgnoreRedirects = ({ state }) => {
1403
+ const isNotPublished = state !== CANVAS_PUBLISHED_STATE;
1404
+ return isNotPublished ? true : void 0;
1405
+ };
1402
1406
 
1403
1407
  // src/clients/cache.ts
1408
+ var isSpecificCacheMode = (options) => {
1409
+ return "cache" in options;
1410
+ };
1404
1411
  var isStateCacheMode = (options) => {
1405
1412
  return "state" in options;
1406
1413
  };
@@ -1422,7 +1429,9 @@ var resolveCache = ({
1422
1429
  }) => {
1423
1430
  let cache = void 0;
1424
1431
  if (options) {
1425
- if (isStateCacheMode(options)) {
1432
+ if (isSpecificCacheMode(options)) {
1433
+ cache = options.cache;
1434
+ } else if (isStateCacheMode(options)) {
1426
1435
  if (options.state === CANVAS_DRAFT_STATE || options.state === CANVAS_EDITOR_STATE) {
1427
1436
  cache = {
1428
1437
  type: "no-cache",
@@ -1742,7 +1751,10 @@ var DefaultDataClient = class {
1742
1751
  }
1743
1752
  }
1744
1753
  const manifest = await getManifest({
1745
- cache: {
1754
+ cache: isDevelopmentEnvironment() ? {
1755
+ type: "no-cache",
1756
+ bypassCache: true
1757
+ } : {
1746
1758
  type: "force-cache"
1747
1759
  }
1748
1760
  });
@@ -1845,12 +1857,13 @@ var DefaultDataClient = class {
1845
1857
  };
1846
1858
  }
1847
1859
  async getRoutePageState(options) {
1860
+ const shouldBypassCache = options.pageState.compositionState !== CANVAS_PUBLISHED_STATE || isDevelopmentEnvironment();
1848
1861
  const routeClient = getRouteClient({
1849
- cache: options.pageState.compositionState === CANVAS_PUBLISHED_STATE ? {
1850
- type: "force-cache"
1851
- } : {
1862
+ cache: shouldBypassCache ? {
1852
1863
  type: "no-cache",
1853
1864
  bypassCache: true
1865
+ } : {
1866
+ type: "force-cache"
1854
1867
  }
1855
1868
  });
1856
1869
  const originalRoute = {
@@ -1858,7 +1871,8 @@ var DefaultDataClient = class {
1858
1871
  state: options.pageState.compositionState,
1859
1872
  withComponentIDs: true,
1860
1873
  releaseId: options.pageState.releaseId,
1861
- locale: options.pageState.locale
1874
+ locale: options.pageState.locale,
1875
+ ignoreRedirects: shouldIgnoreRedirects({ state: options.pageState.compositionState })
1862
1876
  };
1863
1877
  const resolvedRoute = await this.getRouteFromApi({
1864
1878
  source: "pageState",
package/dist/handler.js CHANGED
@@ -1786,6 +1786,9 @@ var isDevelopmentEnvironment = () => {
1786
1786
  };
1787
1787
 
1788
1788
  // src/clients/cache.ts
1789
+ var isSpecificCacheMode = (options) => {
1790
+ return "cache" in options;
1791
+ };
1789
1792
  var isStateCacheMode = (options) => {
1790
1793
  return "state" in options;
1791
1794
  };
@@ -1807,7 +1810,9 @@ var resolveCache = ({
1807
1810
  }) => {
1808
1811
  let cache = void 0;
1809
1812
  if (options) {
1810
- if (isStateCacheMode(options)) {
1813
+ if (isSpecificCacheMode(options)) {
1814
+ cache = options.cache;
1815
+ } else if (isStateCacheMode(options)) {
1811
1816
  if (options.state === CANVAS_DRAFT_STATE || options.state === CANVAS_EDITOR_STATE) {
1812
1817
  cache = {
1813
1818
  type: "no-cache",
package/dist/handler.mjs CHANGED
@@ -1771,6 +1771,9 @@ var isDevelopmentEnvironment = () => {
1771
1771
  };
1772
1772
 
1773
1773
  // src/clients/cache.ts
1774
+ var isSpecificCacheMode = (options) => {
1775
+ return "cache" in options;
1776
+ };
1774
1777
  var isStateCacheMode = (options) => {
1775
1778
  return "state" in options;
1776
1779
  };
@@ -1792,7 +1795,9 @@ var resolveCache = ({
1792
1795
  }) => {
1793
1796
  let cache = void 0;
1794
1797
  if (options) {
1795
- if (isStateCacheMode(options)) {
1798
+ if (isSpecificCacheMode(options)) {
1799
+ cache = options.cache;
1800
+ } else if (isStateCacheMode(options)) {
1796
1801
  if (options.state === CANVAS_DRAFT_STATE || options.state === CANVAS_EDITOR_STATE) {
1797
1802
  cache = {
1798
1803
  type: "no-cache",
package/dist/index.esm.js CHANGED
@@ -1991,8 +1991,15 @@ var isIncontextEditingEnabled = ({
1991
1991
  var isDevelopmentEnvironment = () => {
1992
1992
  return process.env.NODE_ENV === "development" || process.env.NODE_ENV === "test";
1993
1993
  };
1994
+ var shouldIgnoreRedirects = ({ state }) => {
1995
+ const isNotPublished = state !== CANVAS_PUBLISHED_STATE;
1996
+ return isNotPublished ? true : void 0;
1997
+ };
1994
1998
 
1995
1999
  // src/clients/cache.ts
2000
+ var isSpecificCacheMode = (options) => {
2001
+ return "cache" in options;
2002
+ };
1996
2003
  var isStateCacheMode = (options) => {
1997
2004
  return "state" in options;
1998
2005
  };
@@ -2019,7 +2026,9 @@ var resolveCache = ({
2019
2026
  }) => {
2020
2027
  let cache2 = void 0;
2021
2028
  if (options) {
2022
- if (isStateCacheMode(options)) {
2029
+ if (isSpecificCacheMode(options)) {
2030
+ cache2 = options.cache;
2031
+ } else if (isStateCacheMode(options)) {
2023
2032
  if (options.state === CANVAS_DRAFT_STATE || options.state === CANVAS_EDITOR_STATE) {
2024
2033
  cache2 = {
2025
2034
  type: "no-cache",
@@ -2775,7 +2784,7 @@ var createTestComponentProps = ({
2775
2784
  const [testIndex] = (_a = component == null ? void 0 : component.indexes) != null ? _a : [];
2776
2785
  return {
2777
2786
  ...common,
2778
- index: testIndex != null ? testIndex : 0,
2787
+ index: testIndex,
2779
2788
  test
2780
2789
  };
2781
2790
  };
@@ -3610,8 +3619,9 @@ var generatePossiblePageStates = ({
3610
3619
  locale,
3611
3620
  isPrefetch: void 0
3612
3621
  };
3622
+ const allComponentIds = runnables.filter((r) => r.type === "test" || r.type === "personalization").map((r) => r._id);
3613
3623
  const allStates = generateStatesRecursively(dependencyMap, void 0, initialState);
3614
- return allStates.map((payload) => serializeEvaluationResult({ payload }));
3624
+ return allStates.map((payload) => serializeEvaluationResult({ payload, allComponentIds }));
3615
3625
  };
3616
3626
  function permutationsWithoutRepetition(options, k) {
3617
3627
  if (k === 0) return [[]];
@@ -3660,7 +3670,10 @@ var DefaultDataClient = class {
3660
3670
  }
3661
3671
  }
3662
3672
  const manifest = await getManifest({
3663
- cache: {
3673
+ cache: isDevelopmentEnvironment() ? {
3674
+ type: "no-cache",
3675
+ bypassCache: true
3676
+ } : {
3664
3677
  type: "force-cache"
3665
3678
  }
3666
3679
  });
@@ -3763,12 +3776,13 @@ var DefaultDataClient = class {
3763
3776
  };
3764
3777
  }
3765
3778
  async getRoutePageState(options) {
3779
+ const shouldBypassCache = options.pageState.compositionState !== CANVAS_PUBLISHED_STATE || isDevelopmentEnvironment();
3766
3780
  const routeClient = getRouteClient({
3767
- cache: options.pageState.compositionState === CANVAS_PUBLISHED_STATE ? {
3768
- type: "force-cache"
3769
- } : {
3781
+ cache: shouldBypassCache ? {
3770
3782
  type: "no-cache",
3771
3783
  bypassCache: true
3784
+ } : {
3785
+ type: "force-cache"
3772
3786
  }
3773
3787
  });
3774
3788
  const originalRoute = {
@@ -3776,7 +3790,8 @@ var DefaultDataClient = class {
3776
3790
  state: options.pageState.compositionState,
3777
3791
  withComponentIDs: true,
3778
3792
  releaseId: options.pageState.releaseId,
3779
- locale: options.pageState.locale
3793
+ locale: options.pageState.locale,
3794
+ ignoreRedirects: shouldIgnoreRedirects({ state: options.pageState.compositionState })
3780
3795
  };
3781
3796
  const resolvedRoute = await this.getRouteFromApi({
3782
3797
  source: "pageState",
package/dist/index.js CHANGED
@@ -2018,8 +2018,15 @@ var isIncontextEditingEnabled = ({
2018
2018
  var isDevelopmentEnvironment = () => {
2019
2019
  return process.env.NODE_ENV === "development" || process.env.NODE_ENV === "test";
2020
2020
  };
2021
+ var shouldIgnoreRedirects = ({ state }) => {
2022
+ const isNotPublished = state !== CANVAS_PUBLISHED_STATE;
2023
+ return isNotPublished ? true : void 0;
2024
+ };
2021
2025
 
2022
2026
  // src/clients/cache.ts
2027
+ var isSpecificCacheMode = (options) => {
2028
+ return "cache" in options;
2029
+ };
2023
2030
  var isStateCacheMode = (options) => {
2024
2031
  return "state" in options;
2025
2032
  };
@@ -2046,7 +2053,9 @@ var resolveCache = ({
2046
2053
  }) => {
2047
2054
  let cache2 = void 0;
2048
2055
  if (options) {
2049
- if (isStateCacheMode(options)) {
2056
+ if (isSpecificCacheMode(options)) {
2057
+ cache2 = options.cache;
2058
+ } else if (isStateCacheMode(options)) {
2050
2059
  if (options.state === CANVAS_DRAFT_STATE || options.state === CANVAS_EDITOR_STATE) {
2051
2060
  cache2 = {
2052
2061
  type: "no-cache",
@@ -2798,7 +2807,7 @@ var createTestComponentProps = ({
2798
2807
  const [testIndex] = (_a = component == null ? void 0 : component.indexes) != null ? _a : [];
2799
2808
  return {
2800
2809
  ...common,
2801
- index: testIndex != null ? testIndex : 0,
2810
+ index: testIndex,
2802
2811
  test
2803
2812
  };
2804
2813
  };
@@ -3631,8 +3640,9 @@ var generatePossiblePageStates = ({
3631
3640
  locale,
3632
3641
  isPrefetch: void 0
3633
3642
  };
3643
+ const allComponentIds = runnables.filter((r) => r.type === "test" || r.type === "personalization").map((r) => r._id);
3634
3644
  const allStates = generateStatesRecursively(dependencyMap, void 0, initialState);
3635
- return allStates.map((payload) => (0, import_next_app_router_shared8.serializeEvaluationResult)({ payload }));
3645
+ return allStates.map((payload) => (0, import_next_app_router_shared8.serializeEvaluationResult)({ payload, allComponentIds }));
3636
3646
  };
3637
3647
  function permutationsWithoutRepetition(options, k) {
3638
3648
  if (k === 0) return [[]];
@@ -3681,7 +3691,10 @@ var DefaultDataClient = class {
3681
3691
  }
3682
3692
  }
3683
3693
  const manifest = await getManifest({
3684
- cache: {
3694
+ cache: isDevelopmentEnvironment() ? {
3695
+ type: "no-cache",
3696
+ bypassCache: true
3697
+ } : {
3685
3698
  type: "force-cache"
3686
3699
  }
3687
3700
  });
@@ -3784,12 +3797,13 @@ var DefaultDataClient = class {
3784
3797
  };
3785
3798
  }
3786
3799
  async getRoutePageState(options) {
3800
+ const shouldBypassCache = options.pageState.compositionState !== CANVAS_PUBLISHED_STATE || isDevelopmentEnvironment();
3787
3801
  const routeClient = getRouteClient({
3788
- cache: options.pageState.compositionState === CANVAS_PUBLISHED_STATE ? {
3789
- type: "force-cache"
3790
- } : {
3802
+ cache: shouldBypassCache ? {
3791
3803
  type: "no-cache",
3792
3804
  bypassCache: true
3805
+ } : {
3806
+ type: "force-cache"
3793
3807
  }
3794
3808
  });
3795
3809
  const originalRoute = {
@@ -3797,7 +3811,8 @@ var DefaultDataClient = class {
3797
3811
  state: options.pageState.compositionState,
3798
3812
  withComponentIDs: true,
3799
3813
  releaseId: options.pageState.releaseId,
3800
- locale: options.pageState.locale
3814
+ locale: options.pageState.locale,
3815
+ ignoreRedirects: shouldIgnoreRedirects({ state: options.pageState.compositionState })
3801
3816
  };
3802
3817
  const resolvedRoute = await this.getRouteFromApi({
3803
3818
  source: "pageState",
package/dist/index.mjs CHANGED
@@ -1991,8 +1991,15 @@ var isIncontextEditingEnabled = ({
1991
1991
  var isDevelopmentEnvironment = () => {
1992
1992
  return process.env.NODE_ENV === "development" || process.env.NODE_ENV === "test";
1993
1993
  };
1994
+ var shouldIgnoreRedirects = ({ state }) => {
1995
+ const isNotPublished = state !== CANVAS_PUBLISHED_STATE;
1996
+ return isNotPublished ? true : void 0;
1997
+ };
1994
1998
 
1995
1999
  // src/clients/cache.ts
2000
+ var isSpecificCacheMode = (options) => {
2001
+ return "cache" in options;
2002
+ };
1996
2003
  var isStateCacheMode = (options) => {
1997
2004
  return "state" in options;
1998
2005
  };
@@ -2019,7 +2026,9 @@ var resolveCache = ({
2019
2026
  }) => {
2020
2027
  let cache2 = void 0;
2021
2028
  if (options) {
2022
- if (isStateCacheMode(options)) {
2029
+ if (isSpecificCacheMode(options)) {
2030
+ cache2 = options.cache;
2031
+ } else if (isStateCacheMode(options)) {
2023
2032
  if (options.state === CANVAS_DRAFT_STATE || options.state === CANVAS_EDITOR_STATE) {
2024
2033
  cache2 = {
2025
2034
  type: "no-cache",
@@ -2775,7 +2784,7 @@ var createTestComponentProps = ({
2775
2784
  const [testIndex] = (_a = component == null ? void 0 : component.indexes) != null ? _a : [];
2776
2785
  return {
2777
2786
  ...common,
2778
- index: testIndex != null ? testIndex : 0,
2787
+ index: testIndex,
2779
2788
  test
2780
2789
  };
2781
2790
  };
@@ -3610,8 +3619,9 @@ var generatePossiblePageStates = ({
3610
3619
  locale,
3611
3620
  isPrefetch: void 0
3612
3621
  };
3622
+ const allComponentIds = runnables.filter((r) => r.type === "test" || r.type === "personalization").map((r) => r._id);
3613
3623
  const allStates = generateStatesRecursively(dependencyMap, void 0, initialState);
3614
- return allStates.map((payload) => serializeEvaluationResult({ payload }));
3624
+ return allStates.map((payload) => serializeEvaluationResult({ payload, allComponentIds }));
3615
3625
  };
3616
3626
  function permutationsWithoutRepetition(options, k) {
3617
3627
  if (k === 0) return [[]];
@@ -3660,7 +3670,10 @@ var DefaultDataClient = class {
3660
3670
  }
3661
3671
  }
3662
3672
  const manifest = await getManifest({
3663
- cache: {
3673
+ cache: isDevelopmentEnvironment() ? {
3674
+ type: "no-cache",
3675
+ bypassCache: true
3676
+ } : {
3664
3677
  type: "force-cache"
3665
3678
  }
3666
3679
  });
@@ -3763,12 +3776,13 @@ var DefaultDataClient = class {
3763
3776
  };
3764
3777
  }
3765
3778
  async getRoutePageState(options) {
3779
+ const shouldBypassCache = options.pageState.compositionState !== CANVAS_PUBLISHED_STATE || isDevelopmentEnvironment();
3766
3780
  const routeClient = getRouteClient({
3767
- cache: options.pageState.compositionState === CANVAS_PUBLISHED_STATE ? {
3768
- type: "force-cache"
3769
- } : {
3781
+ cache: shouldBypassCache ? {
3770
3782
  type: "no-cache",
3771
3783
  bypassCache: true
3784
+ } : {
3785
+ type: "force-cache"
3772
3786
  }
3773
3787
  });
3774
3788
  const originalRoute = {
@@ -3776,7 +3790,8 @@ var DefaultDataClient = class {
3776
3790
  state: options.pageState.compositionState,
3777
3791
  withComponentIDs: true,
3778
3792
  releaseId: options.pageState.releaseId,
3779
- locale: options.pageState.locale
3793
+ locale: options.pageState.locale,
3794
+ ignoreRedirects: shouldIgnoreRedirects({ state: options.pageState.compositionState })
3780
3795
  };
3781
3796
  const resolvedRoute = await this.getRouteFromApi({
3782
3797
  source: "pageState",
@@ -2351,8 +2351,15 @@ var isIncontextEditingEnabled = ({
2351
2351
  var isDevelopmentEnvironment = () => {
2352
2352
  return process.env.NODE_ENV === "development" || process.env.NODE_ENV === "test";
2353
2353
  };
2354
+ var shouldIgnoreRedirects = ({ state }) => {
2355
+ const isNotPublished = state !== CANVAS_PUBLISHED_STATE;
2356
+ return isNotPublished ? true : void 0;
2357
+ };
2354
2358
 
2355
2359
  // src/clients/cache.ts
2360
+ var isSpecificCacheMode = (options) => {
2361
+ return "cache" in options;
2362
+ };
2356
2363
  var isStateCacheMode = (options) => {
2357
2364
  return "state" in options;
2358
2365
  };
@@ -2374,7 +2381,9 @@ var resolveCache = ({
2374
2381
  }) => {
2375
2382
  let cache = void 0;
2376
2383
  if (options) {
2377
- if (isStateCacheMode(options)) {
2384
+ if (isSpecificCacheMode(options)) {
2385
+ cache = options.cache;
2386
+ } else if (isStateCacheMode(options)) {
2378
2387
  if (options.state === CANVAS_DRAFT_STATE || options.state === CANVAS_EDITOR_STATE) {
2379
2388
  cache = {
2380
2389
  type: "no-cache",
@@ -2769,7 +2778,10 @@ var DefaultDataClient = class {
2769
2778
  }
2770
2779
  }
2771
2780
  const manifest = await getManifest({
2772
- cache: {
2781
+ cache: isDevelopmentEnvironment() ? {
2782
+ type: "no-cache",
2783
+ bypassCache: true
2784
+ } : {
2773
2785
  type: "force-cache"
2774
2786
  }
2775
2787
  });
@@ -2872,12 +2884,13 @@ var DefaultDataClient = class {
2872
2884
  };
2873
2885
  }
2874
2886
  async getRoutePageState(options) {
2887
+ const shouldBypassCache = options.pageState.compositionState !== CANVAS_PUBLISHED_STATE || isDevelopmentEnvironment();
2875
2888
  const routeClient = getRouteClient({
2876
- cache: options.pageState.compositionState === CANVAS_PUBLISHED_STATE ? {
2877
- type: "force-cache"
2878
- } : {
2889
+ cache: shouldBypassCache ? {
2879
2890
  type: "no-cache",
2880
2891
  bypassCache: true
2892
+ } : {
2893
+ type: "force-cache"
2881
2894
  }
2882
2895
  });
2883
2896
  const originalRoute = {
@@ -2885,7 +2898,8 @@ var DefaultDataClient = class {
2885
2898
  state: options.pageState.compositionState,
2886
2899
  withComponentIDs: true,
2887
2900
  releaseId: options.pageState.releaseId,
2888
- locale: options.pageState.locale
2901
+ locale: options.pageState.locale,
2902
+ ignoreRedirects: shouldIgnoreRedirects({ state: options.pageState.compositionState })
2889
2903
  };
2890
2904
  const resolvedRoute = await this.getRouteFromApi({
2891
2905
  source: "pageState",
@@ -5434,7 +5448,8 @@ var retrieveRouteByPath = async ({
5434
5448
  withComponentIDs: true,
5435
5449
  withContentSourceMap: (_a = getServerConfig().experimental) == null ? void 0 : _a.vercelVisualEditing,
5436
5450
  releaseId,
5437
- locale
5451
+ locale,
5452
+ ignoreRedirects: shouldIgnoreRedirects({ state })
5438
5453
  }
5439
5454
  });
5440
5455
  };
@@ -5561,7 +5576,7 @@ var handlePlaygroundRequest = async ({
5561
5576
  })
5562
5577
  });
5563
5578
  const context = await onDemandContext.getContext();
5564
- const { components, rules } = await extractAndEvaluateRunnables({
5579
+ const { components, rules, allComponentIds } = await extractAndEvaluateRunnables({
5565
5580
  composition: composition.composition,
5566
5581
  routePath: id,
5567
5582
  state: composition.state,
@@ -5601,7 +5616,8 @@ var handlePlaygroundRequest = async ({
5601
5616
  isPrefetch: void 0
5602
5617
  };
5603
5618
  const code = (0, import_next_app_router_shared5.serializeEvaluationResult)({
5604
- payload: pageState
5619
+ payload: pageState,
5620
+ allComponentIds
5605
5621
  });
5606
5622
  let pathToRewriteTo = await (options.rewriteDestinationPath ? options.rewriteDestinationPath({ code, pageState, source: "playground" }) : void 0);
5607
5623
  if (!pathToRewriteTo) {
@@ -5615,16 +5631,15 @@ var handleRouteRequest = async ({
5615
5631
  dataClient,
5616
5632
  options
5617
5633
  }) => {
5618
- var _a, _b, _c, _d, _e, _f, _g;
5619
- const releaseId = (_b = (_a = options.release) == null ? void 0 : _a.id) != null ? _b : draftModeEnabled ? request.nextUrl.searchParams.get("releaseId") || void 0 : void 0;
5634
+ var _a, _b, _c, _d, _e, _f, _g, _h;
5620
5635
  const states = await determineState({
5621
5636
  searchParams: request.nextUrl.searchParams,
5622
5637
  draftModeEnabled
5623
5638
  });
5624
- const requestPath = (_d = await ((_c = options.rewriteRequestPath) == null ? void 0 : _c.call(options, {
5639
+ const requestPath = (_b = await ((_a = options.rewriteRequestPath) == null ? void 0 : _a.call(options, {
5625
5640
  request,
5626
5641
  url: new URL(request.url)
5627
- }))) != null ? _d : {
5642
+ }))) != null ? _b : {
5628
5643
  path: `${request.nextUrl.pathname}${request.nextUrl.search}`
5629
5644
  };
5630
5645
  const serverConfig = getServerConfig();
@@ -5635,7 +5650,7 @@ var handleRouteRequest = async ({
5635
5650
  searchParams: request.nextUrl.searchParams,
5636
5651
  draftModeEnabled,
5637
5652
  dataClient,
5638
- releaseId,
5653
+ releaseId: (_c = options.release) == null ? void 0 : _c.id,
5639
5654
  locale: options.locale
5640
5655
  }),
5641
5656
  createOnDemandContext({
@@ -5647,10 +5662,10 @@ var handleRouteRequest = async ({
5647
5662
  })
5648
5663
  })
5649
5664
  ]);
5650
- if (!(routeResult == null ? void 0 : routeResult.route) || ((_e = routeResult == null ? void 0 : routeResult.route) == null ? void 0 : _e.type) === "notFound") {
5665
+ if (!(routeResult == null ? void 0 : routeResult.route) || ((_d = routeResult == null ? void 0 : routeResult.route) == null ? void 0 : _d.type) === "notFound") {
5651
5666
  return import_server.NextResponse.rewrite(new URL("/404", request.url));
5652
5667
  }
5653
- if (((_f = routeResult == null ? void 0 : routeResult.route) == null ? void 0 : _f.type) === "redirect") {
5668
+ if (((_e = routeResult == null ? void 0 : routeResult.route) == null ? void 0 : _e.type) === "redirect") {
5654
5669
  return handleRedirect({ request, route: routeResult.route });
5655
5670
  }
5656
5671
  const { route } = routeResult;
@@ -5684,14 +5699,14 @@ var handleRouteRequest = async ({
5684
5699
  isDraftModeEnabled: draftModeEnabled
5685
5700
  });
5686
5701
  const isPrefetch = isPrefetchRequest(request);
5687
- const { components, rules } = await extractAndEvaluateRunnables({
5702
+ const { components, rules, allComponentIds } = await extractAndEvaluateRunnables({
5688
5703
  composition: route.compositionApiResponse.composition,
5689
5704
  routePath,
5690
5705
  state,
5691
5706
  context,
5692
5707
  matchedRoute: route.matchedRoute,
5693
- dynamicInputs: (_g = route.dynamicInputs) != null ? _g : {},
5694
- releaseId,
5708
+ dynamicInputs: (_f = route.dynamicInputs) != null ? _f : {},
5709
+ releaseId: (_g = options.release) == null ? void 0 : _g.id,
5695
5710
  defaultConsent: determineDefaultConsent({
5696
5711
  serverConfig,
5697
5712
  defaultConsent: options.defaultConsent
@@ -5709,7 +5724,7 @@ var handleRouteRequest = async ({
5709
5724
  compositionState: state,
5710
5725
  components,
5711
5726
  keys: requestPath.keys,
5712
- releaseId,
5727
+ releaseId: (_h = options.release) == null ? void 0 : _h.id,
5713
5728
  defaultConsent: determineDefaultConsent({
5714
5729
  serverConfig,
5715
5730
  defaultConsent: options.defaultConsent
@@ -5720,7 +5735,8 @@ var handleRouteRequest = async ({
5720
5735
  isPrefetch: isPrefetch || void 0
5721
5736
  };
5722
5737
  const code = (0, import_next_app_router_shared5.serializeEvaluationResult)({
5723
- payload: pageState
5738
+ payload: pageState,
5739
+ allComponentIds
5724
5740
  });
5725
5741
  let pathToRewriteTo = await (options.rewriteDestinationPath ? options.rewriteDestinationPath({ code, pageState, source: "route" }) : void 0);
5726
5742
  if (!pathToRewriteTo) {
@@ -5780,7 +5796,8 @@ var extractAndEvaluateRunnables = async ({
5780
5796
  }
5781
5797
  }
5782
5798
  });
5783
- return result;
5799
+ const allComponentIds = extracted.filter((r) => r.type === "test" || r.type === "personalization").map((r) => r._id);
5800
+ return { ...result, allComponentIds };
5784
5801
  };
5785
5802
  var handleRedirect = ({ request, route }) => {
5786
5803
  const href = resolveRedirectHref({
@@ -2338,8 +2338,15 @@ var isIncontextEditingEnabled = ({
2338
2338
  var isDevelopmentEnvironment = () => {
2339
2339
  return process.env.NODE_ENV === "development" || process.env.NODE_ENV === "test";
2340
2340
  };
2341
+ var shouldIgnoreRedirects = ({ state }) => {
2342
+ const isNotPublished = state !== CANVAS_PUBLISHED_STATE;
2343
+ return isNotPublished ? true : void 0;
2344
+ };
2341
2345
 
2342
2346
  // src/clients/cache.ts
2347
+ var isSpecificCacheMode = (options) => {
2348
+ return "cache" in options;
2349
+ };
2343
2350
  var isStateCacheMode = (options) => {
2344
2351
  return "state" in options;
2345
2352
  };
@@ -2361,7 +2368,9 @@ var resolveCache = ({
2361
2368
  }) => {
2362
2369
  let cache = void 0;
2363
2370
  if (options) {
2364
- if (isStateCacheMode(options)) {
2371
+ if (isSpecificCacheMode(options)) {
2372
+ cache = options.cache;
2373
+ } else if (isStateCacheMode(options)) {
2365
2374
  if (options.state === CANVAS_DRAFT_STATE || options.state === CANVAS_EDITOR_STATE) {
2366
2375
  cache = {
2367
2376
  type: "no-cache",
@@ -2756,7 +2765,10 @@ var DefaultDataClient = class {
2756
2765
  }
2757
2766
  }
2758
2767
  const manifest = await getManifest({
2759
- cache: {
2768
+ cache: isDevelopmentEnvironment() ? {
2769
+ type: "no-cache",
2770
+ bypassCache: true
2771
+ } : {
2760
2772
  type: "force-cache"
2761
2773
  }
2762
2774
  });
@@ -2859,12 +2871,13 @@ var DefaultDataClient = class {
2859
2871
  };
2860
2872
  }
2861
2873
  async getRoutePageState(options) {
2874
+ const shouldBypassCache = options.pageState.compositionState !== CANVAS_PUBLISHED_STATE || isDevelopmentEnvironment();
2862
2875
  const routeClient = getRouteClient({
2863
- cache: options.pageState.compositionState === CANVAS_PUBLISHED_STATE ? {
2864
- type: "force-cache"
2865
- } : {
2876
+ cache: shouldBypassCache ? {
2866
2877
  type: "no-cache",
2867
2878
  bypassCache: true
2879
+ } : {
2880
+ type: "force-cache"
2868
2881
  }
2869
2882
  });
2870
2883
  const originalRoute = {
@@ -2872,7 +2885,8 @@ var DefaultDataClient = class {
2872
2885
  state: options.pageState.compositionState,
2873
2886
  withComponentIDs: true,
2874
2887
  releaseId: options.pageState.releaseId,
2875
- locale: options.pageState.locale
2888
+ locale: options.pageState.locale,
2889
+ ignoreRedirects: shouldIgnoreRedirects({ state: options.pageState.compositionState })
2876
2890
  };
2877
2891
  const resolvedRoute = await this.getRouteFromApi({
2878
2892
  source: "pageState",
@@ -5426,7 +5440,8 @@ var retrieveRouteByPath = async ({
5426
5440
  withComponentIDs: true,
5427
5441
  withContentSourceMap: (_a = getServerConfig().experimental) == null ? void 0 : _a.vercelVisualEditing,
5428
5442
  releaseId,
5429
- locale
5443
+ locale,
5444
+ ignoreRedirects: shouldIgnoreRedirects({ state })
5430
5445
  }
5431
5446
  });
5432
5447
  };
@@ -5553,7 +5568,7 @@ var handlePlaygroundRequest = async ({
5553
5568
  })
5554
5569
  });
5555
5570
  const context = await onDemandContext.getContext();
5556
- const { components, rules } = await extractAndEvaluateRunnables({
5571
+ const { components, rules, allComponentIds } = await extractAndEvaluateRunnables({
5557
5572
  composition: composition.composition,
5558
5573
  routePath: id,
5559
5574
  state: composition.state,
@@ -5593,7 +5608,8 @@ var handlePlaygroundRequest = async ({
5593
5608
  isPrefetch: void 0
5594
5609
  };
5595
5610
  const code = serializeEvaluationResult({
5596
- payload: pageState
5611
+ payload: pageState,
5612
+ allComponentIds
5597
5613
  });
5598
5614
  let pathToRewriteTo = await (options.rewriteDestinationPath ? options.rewriteDestinationPath({ code, pageState, source: "playground" }) : void 0);
5599
5615
  if (!pathToRewriteTo) {
@@ -5607,16 +5623,15 @@ var handleRouteRequest = async ({
5607
5623
  dataClient,
5608
5624
  options
5609
5625
  }) => {
5610
- var _a, _b, _c, _d, _e, _f, _g;
5611
- const releaseId = (_b = (_a = options.release) == null ? void 0 : _a.id) != null ? _b : draftModeEnabled ? request.nextUrl.searchParams.get("releaseId") || void 0 : void 0;
5626
+ var _a, _b, _c, _d, _e, _f, _g, _h;
5612
5627
  const states = await determineState({
5613
5628
  searchParams: request.nextUrl.searchParams,
5614
5629
  draftModeEnabled
5615
5630
  });
5616
- const requestPath = (_d = await ((_c = options.rewriteRequestPath) == null ? void 0 : _c.call(options, {
5631
+ const requestPath = (_b = await ((_a = options.rewriteRequestPath) == null ? void 0 : _a.call(options, {
5617
5632
  request,
5618
5633
  url: new URL(request.url)
5619
- }))) != null ? _d : {
5634
+ }))) != null ? _b : {
5620
5635
  path: `${request.nextUrl.pathname}${request.nextUrl.search}`
5621
5636
  };
5622
5637
  const serverConfig = getServerConfig();
@@ -5627,7 +5642,7 @@ var handleRouteRequest = async ({
5627
5642
  searchParams: request.nextUrl.searchParams,
5628
5643
  draftModeEnabled,
5629
5644
  dataClient,
5630
- releaseId,
5645
+ releaseId: (_c = options.release) == null ? void 0 : _c.id,
5631
5646
  locale: options.locale
5632
5647
  }),
5633
5648
  createOnDemandContext({
@@ -5639,10 +5654,10 @@ var handleRouteRequest = async ({
5639
5654
  })
5640
5655
  })
5641
5656
  ]);
5642
- if (!(routeResult == null ? void 0 : routeResult.route) || ((_e = routeResult == null ? void 0 : routeResult.route) == null ? void 0 : _e.type) === "notFound") {
5657
+ if (!(routeResult == null ? void 0 : routeResult.route) || ((_d = routeResult == null ? void 0 : routeResult.route) == null ? void 0 : _d.type) === "notFound") {
5643
5658
  return NextResponse.rewrite(new URL("/404", request.url));
5644
5659
  }
5645
- if (((_f = routeResult == null ? void 0 : routeResult.route) == null ? void 0 : _f.type) === "redirect") {
5660
+ if (((_e = routeResult == null ? void 0 : routeResult.route) == null ? void 0 : _e.type) === "redirect") {
5646
5661
  return handleRedirect({ request, route: routeResult.route });
5647
5662
  }
5648
5663
  const { route } = routeResult;
@@ -5676,14 +5691,14 @@ var handleRouteRequest = async ({
5676
5691
  isDraftModeEnabled: draftModeEnabled
5677
5692
  });
5678
5693
  const isPrefetch = isPrefetchRequest(request);
5679
- const { components, rules } = await extractAndEvaluateRunnables({
5694
+ const { components, rules, allComponentIds } = await extractAndEvaluateRunnables({
5680
5695
  composition: route.compositionApiResponse.composition,
5681
5696
  routePath,
5682
5697
  state,
5683
5698
  context,
5684
5699
  matchedRoute: route.matchedRoute,
5685
- dynamicInputs: (_g = route.dynamicInputs) != null ? _g : {},
5686
- releaseId,
5700
+ dynamicInputs: (_f = route.dynamicInputs) != null ? _f : {},
5701
+ releaseId: (_g = options.release) == null ? void 0 : _g.id,
5687
5702
  defaultConsent: determineDefaultConsent({
5688
5703
  serverConfig,
5689
5704
  defaultConsent: options.defaultConsent
@@ -5701,7 +5716,7 @@ var handleRouteRequest = async ({
5701
5716
  compositionState: state,
5702
5717
  components,
5703
5718
  keys: requestPath.keys,
5704
- releaseId,
5719
+ releaseId: (_h = options.release) == null ? void 0 : _h.id,
5705
5720
  defaultConsent: determineDefaultConsent({
5706
5721
  serverConfig,
5707
5722
  defaultConsent: options.defaultConsent
@@ -5712,7 +5727,8 @@ var handleRouteRequest = async ({
5712
5727
  isPrefetch: isPrefetch || void 0
5713
5728
  };
5714
5729
  const code = serializeEvaluationResult({
5715
- payload: pageState
5730
+ payload: pageState,
5731
+ allComponentIds
5716
5732
  });
5717
5733
  let pathToRewriteTo = await (options.rewriteDestinationPath ? options.rewriteDestinationPath({ code, pageState, source: "route" }) : void 0);
5718
5734
  if (!pathToRewriteTo) {
@@ -5772,7 +5788,8 @@ var extractAndEvaluateRunnables = async ({
5772
5788
  }
5773
5789
  }
5774
5790
  });
5775
- return result;
5791
+ const allComponentIds = extracted.filter((r) => r.type === "test" || r.type === "personalization").map((r) => r._id);
5792
+ return { ...result, allComponentIds };
5776
5793
  };
5777
5794
  var handleRedirect = ({ request, route }) => {
5778
5795
  const href = resolveRedirectHref({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/next-app-router",
3
- "version": "20.56.1-alpha.5+1bce2eca70",
3
+ "version": "20.56.2-alpha.5+ae5a0d2550",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "scripts": {
6
6
  "build": "tsup",
@@ -99,12 +99,12 @@
99
99
  "vitest": "3.2.4"
100
100
  },
101
101
  "dependencies": {
102
- "@uniformdev/canvas-react": "20.56.1-alpha.5+1bce2eca70",
103
- "@uniformdev/next-app-router-client": "20.56.1-alpha.5+1bce2eca70",
104
- "@uniformdev/next-app-router-shared": "20.56.1-alpha.5+1bce2eca70",
105
- "@uniformdev/redirect": "20.56.1-alpha.5+1bce2eca70",
106
- "@uniformdev/richtext": "20.56.1-alpha.5+1bce2eca70",
107
- "@uniformdev/webhooks": "20.56.1-alpha.5+1bce2eca70",
102
+ "@uniformdev/canvas-react": "20.56.2-alpha.5+ae5a0d2550",
103
+ "@uniformdev/next-app-router-client": "20.56.2-alpha.5+ae5a0d2550",
104
+ "@uniformdev/next-app-router-shared": "20.56.2-alpha.5+ae5a0d2550",
105
+ "@uniformdev/redirect": "20.56.2-alpha.5+ae5a0d2550",
106
+ "@uniformdev/richtext": "20.56.2-alpha.5+ae5a0d2550",
107
+ "@uniformdev/webhooks": "20.56.2-alpha.5+ae5a0d2550",
108
108
  "@vercel/functions": "^2.2.2",
109
109
  "encoding": "^0.1.13",
110
110
  "server-only": "^0.0.1",
@@ -121,5 +121,5 @@
121
121
  "publishConfig": {
122
122
  "access": "public"
123
123
  },
124
- "gitHead": "1bce2eca70191de304d93909e5cf08740b01fb5a"
124
+ "gitHead": "ae5a0d255085f10d36ad4f557d393536033eac7f"
125
125
  }