@uniformdev/next-app-router 20.50.1-alpha.2 → 20.50.1-alpha.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -2749,13 +2749,6 @@ var createTestComponentProps = ({
2749
2749
  test
2750
2750
  }) => {
2751
2751
  var _a;
2752
- if (pageState.isPrefetch) {
2753
- return {
2754
- ...common,
2755
- index: void 0,
2756
- test
2757
- };
2758
- }
2759
2752
  const component = resolveComponentFromPageState({
2760
2753
  pageState,
2761
2754
  componentId
@@ -2794,7 +2787,6 @@ var applyEditableParameters = ({
2794
2787
  };
2795
2788
 
2796
2789
  // src/components/Test.tsx
2797
- import { ClientTest } from "@uniformdev/next-app-router-client";
2798
2790
  import { createElement, Fragment } from "react";
2799
2791
 
2800
2792
  // src/components/ContextTestTransfer.tsx
@@ -2807,14 +2799,7 @@ var ContextTestTransfer = ({ event }) => {
2807
2799
  // src/components/Test.tsx
2808
2800
  var Test = ({ index, slots, test, component, context: compositionContext }) => {
2809
2801
  var _a, _b, _c, _d, _e, _f;
2810
- if (typeof index !== "number") {
2811
- return createElement(ClientTest, {
2812
- slots,
2813
- test,
2814
- context: compositionContext
2815
- });
2816
- }
2817
- const indexToShow = (_b = (_a = slots == null ? void 0 : slots[CANVAS_TEST_SLOT]) == null ? void 0 : _a.items[index]) != null ? _b : null;
2802
+ 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;
2818
2803
  const event = {
2819
2804
  name: test.name,
2820
2805
  control: (_d = (_c = test.variations[index]) == null ? void 0 : _c.control) != null ? _d : false,
@@ -3595,8 +3580,7 @@ var generatePossiblePageStates = ({
3595
3580
  defaultConsent: void 0,
3596
3581
  previewMode: void 0,
3597
3582
  rules: void 0,
3598
- locale,
3599
- isPrefetch: void 0
3583
+ locale
3600
3584
  };
3601
3585
  const allStates = generateStatesRecursively(dependencyMap, void 0, initialState);
3602
3586
  return allStates.map((payload) => serializeEvaluationResult({ payload }));
package/dist/index.js CHANGED
@@ -2678,7 +2678,7 @@ var getRouteClient = (options) => {
2678
2678
 
2679
2679
  // src/components/UniformComposition.tsx
2680
2680
  var import_core = require("@uniformdev/canvas-react/core");
2681
- var import_next_app_router_client5 = require("@uniformdev/next-app-router-client");
2681
+ var import_next_app_router_client4 = require("@uniformdev/next-app-router-client");
2682
2682
  var import_next_app_router_shared4 = require("@uniformdev/next-app-router-shared");
2683
2683
  var import_navigation = require("next/navigation");
2684
2684
  var import_react6 = __toESM(require("react"));
@@ -2772,13 +2772,6 @@ var createTestComponentProps = ({
2772
2772
  test
2773
2773
  }) => {
2774
2774
  var _a;
2775
- if (pageState.isPrefetch) {
2776
- return {
2777
- ...common,
2778
- index: void 0,
2779
- test
2780
- };
2781
- }
2782
2775
  const component = (0, import_next_app_router_shared2.resolveComponentFromPageState)({
2783
2776
  pageState,
2784
2777
  componentId
@@ -2817,7 +2810,6 @@ var applyEditableParameters = ({
2817
2810
  };
2818
2811
 
2819
2812
  // src/components/Test.tsx
2820
- var import_next_app_router_client2 = require("@uniformdev/next-app-router-client");
2821
2813
  var import_react2 = require("react");
2822
2814
 
2823
2815
  // src/components/ContextTestTransfer.tsx
@@ -2830,14 +2822,7 @@ var ContextTestTransfer = ({ event }) => {
2830
2822
  // src/components/Test.tsx
2831
2823
  var Test = ({ index, slots, test, component, context: compositionContext }) => {
2832
2824
  var _a, _b, _c, _d, _e, _f;
2833
- if (typeof index !== "number") {
2834
- return (0, import_react2.createElement)(import_next_app_router_client2.ClientTest, {
2835
- slots,
2836
- test,
2837
- context: compositionContext
2838
- });
2839
- }
2840
- const indexToShow = (_b = (_a = slots == null ? void 0 : slots[CANVAS_TEST_SLOT]) == null ? void 0 : _a.items[index]) != null ? _b : null;
2825
+ 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;
2841
2826
  const event = {
2842
2827
  name: test.name,
2843
2828
  control: (_d = (_c = test.variations[index]) == null ? void 0 : _c.control) != null ? _d : false,
@@ -2869,7 +2854,7 @@ var UniformCompositionWrapper = ({
2869
2854
  };
2870
2855
 
2871
2856
  // src/components/UniformContext.tsx
2872
- var import_next_app_router_client3 = require("@uniformdev/next-app-router-client");
2857
+ var import_next_app_router_client2 = require("@uniformdev/next-app-router-client");
2873
2858
  var import_react4 = __toESM(require("react"));
2874
2859
 
2875
2860
  // src/config/helpers.ts
@@ -2922,7 +2907,7 @@ var UniformContext = async ({ clientContextComponent, result }) => {
2922
2907
  dynamicInputs: route.dynamicInputs,
2923
2908
  matchedRoute: route.matchedRoute
2924
2909
  } : void 0;
2925
- const ContextComponent = clientContextComponent || import_next_app_router_client3.DefaultUniformClientContext;
2910
+ const ContextComponent = clientContextComponent || import_next_app_router_client2.DefaultUniformClientContext;
2926
2911
  const disableDevTools = getDisabledDevTools();
2927
2912
  const defaultConsent = (_a = result == null ? void 0 : result.pageState.defaultConsent) != null ? _a : getDefaultConsent();
2928
2913
  const experimentalQuirkSerialization = getQuirkSerialization();
@@ -2939,14 +2924,14 @@ var UniformContext = async ({ clientContextComponent, result }) => {
2939
2924
  };
2940
2925
 
2941
2926
  // src/components/VisibilityRulesWrapper.tsx
2942
- var import_next_app_router_client4 = require("@uniformdev/next-app-router-client");
2927
+ var import_next_app_router_client3 = require("@uniformdev/next-app-router-client");
2943
2928
  var import_react5 = __toESM(require("react"));
2944
2929
  var VisibilityRulesWrapper = ({
2945
2930
  parameter,
2946
2931
  initialIsVisible,
2947
2932
  children
2948
2933
  }) => {
2949
- return /* @__PURE__ */ import_react5.default.createElement(import_next_app_router_client4.VisibilityRulesWrapperClient, { parameter, initialIsVisible }, children);
2934
+ return /* @__PURE__ */ import_react5.default.createElement(import_next_app_router_client3.VisibilityRulesWrapperClient, { parameter, initialIsVisible }, children);
2950
2935
  };
2951
2936
 
2952
2937
  // src/components/UniformComposition.tsx
@@ -3009,7 +2994,7 @@ async function UniformCompositionInner({
3009
2994
  route
3010
2995
  }
3011
2996
  }
3012
- )), (pageState.compositionState === CANVAS_EDITOR_STATE || pageState.compositionState === CANVAS_DRAFT_STATE) && /* @__PURE__ */ import_react6.default.createElement(import_next_app_router_client5.UniformScript, null));
2997
+ )), (pageState.compositionState === CANVAS_EDITOR_STATE || pageState.compositionState === CANVAS_DRAFT_STATE) && /* @__PURE__ */ import_react6.default.createElement(import_next_app_router_client4.UniformScript, null));
3013
2998
  }
3014
2999
  var resolveComponents = ({
3015
3000
  target,
@@ -3105,7 +3090,7 @@ var resolveComponents = ({
3105
3090
  }
3106
3091
  let tagElement = null;
3107
3092
  if (enrichmentTags == null ? void 0 : enrichmentTags.length) {
3108
- tagElement = (0, import_react6.createElement)(import_next_app_router_client5.ContextUpdateTransfer, {
3093
+ tagElement = (0, import_react6.createElement)(import_next_app_router_client4.ContextUpdateTransfer, {
3109
3094
  key: `${slotName}-${componentIndex}-tags`,
3110
3095
  update: {
3111
3096
  enrichments: enrichmentTags
@@ -3180,7 +3165,7 @@ var createResolvedComponent = ({
3180
3165
  componentId: component._id,
3181
3166
  pageState
3182
3167
  });
3183
- return (0, import_react6.createElement)(import_next_app_router_client5.Personalize, { ...personalizeProps, key });
3168
+ return (0, import_react6.createElement)(import_next_app_router_client4.Personalize, { ...personalizeProps, key });
3184
3169
  }
3185
3170
  if (component.type === CANVAS_TEST_TYPE) {
3186
3171
  const extractedTest = extractTest({
@@ -3616,8 +3601,7 @@ var generatePossiblePageStates = ({
3616
3601
  defaultConsent: void 0,
3617
3602
  previewMode: void 0,
3618
3603
  rules: void 0,
3619
- locale,
3620
- isPrefetch: void 0
3604
+ locale
3621
3605
  };
3622
3606
  const allStates = generateStatesRecursively(dependencyMap, void 0, initialState);
3623
3607
  return allStates.map((payload) => (0, import_next_app_router_shared8.serializeEvaluationResult)({ payload }));
package/dist/index.mjs CHANGED
@@ -2749,13 +2749,6 @@ var createTestComponentProps = ({
2749
2749
  test
2750
2750
  }) => {
2751
2751
  var _a;
2752
- if (pageState.isPrefetch) {
2753
- return {
2754
- ...common,
2755
- index: void 0,
2756
- test
2757
- };
2758
- }
2759
2752
  const component = resolveComponentFromPageState({
2760
2753
  pageState,
2761
2754
  componentId
@@ -2794,7 +2787,6 @@ var applyEditableParameters = ({
2794
2787
  };
2795
2788
 
2796
2789
  // src/components/Test.tsx
2797
- import { ClientTest } from "@uniformdev/next-app-router-client";
2798
2790
  import { createElement, Fragment } from "react";
2799
2791
 
2800
2792
  // src/components/ContextTestTransfer.tsx
@@ -2807,14 +2799,7 @@ var ContextTestTransfer = ({ event }) => {
2807
2799
  // src/components/Test.tsx
2808
2800
  var Test = ({ index, slots, test, component, context: compositionContext }) => {
2809
2801
  var _a, _b, _c, _d, _e, _f;
2810
- if (typeof index !== "number") {
2811
- return createElement(ClientTest, {
2812
- slots,
2813
- test,
2814
- context: compositionContext
2815
- });
2816
- }
2817
- const indexToShow = (_b = (_a = slots == null ? void 0 : slots[CANVAS_TEST_SLOT]) == null ? void 0 : _a.items[index]) != null ? _b : null;
2802
+ 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;
2818
2803
  const event = {
2819
2804
  name: test.name,
2820
2805
  control: (_d = (_c = test.variations[index]) == null ? void 0 : _c.control) != null ? _d : false,
@@ -3595,8 +3580,7 @@ var generatePossiblePageStates = ({
3595
3580
  defaultConsent: void 0,
3596
3581
  previewMode: void 0,
3597
3582
  rules: void 0,
3598
- locale,
3599
- isPrefetch: void 0
3583
+ locale
3600
3584
  };
3601
3585
  const allStates = generateStatesRecursively(dependencyMap, void 0, initialState);
3602
3586
  return allStates.map((payload) => serializeEvaluationResult({ payload }));
@@ -3047,8 +3047,7 @@ var import_next_app_router_shared4 = require("@uniformdev/next-app-router-shared
3047
3047
  var evaluateRunnables = async ({
3048
3048
  runnables,
3049
3049
  context,
3050
- compositionContext,
3051
- isPrefetch
3050
+ compositionContext
3052
3051
  }) => {
3053
3052
  var _a;
3054
3053
  const result = {
@@ -3058,9 +3057,6 @@ var evaluateRunnables = async ({
3058
3057
  const runnablesToProcess = runnables.filter((item2) => item2.variantId === void 0);
3059
3058
  let item;
3060
3059
  while (item = runnablesToProcess.shift()) {
3061
- if (item.type === "test" && isPrefetch) {
3062
- continue;
3063
- }
3064
3060
  if (item.type === "test") {
3065
3061
  const testResult = (0, import_next_app_router_shared4.evaluateTest)({
3066
3062
  context,
@@ -5566,8 +5562,7 @@ var handlePlaygroundRequest = async ({
5566
5562
  searchParams: request.nextUrl.searchParams,
5567
5563
  isDraftModeEnabled: true
5568
5564
  // this is checked above
5569
- }),
5570
- isPrefetch: false
5565
+ })
5571
5566
  });
5572
5567
  const pageState = {
5573
5568
  routePath: id,
@@ -5585,8 +5580,7 @@ var handlePlaygroundRequest = async ({
5585
5580
  // this is checked above
5586
5581
  }),
5587
5582
  rules,
5588
- locale: options.locale,
5589
- isPrefetch: void 0
5583
+ locale: options.locale
5590
5584
  };
5591
5585
  const code = (0, import_next_app_router_shared5.serializeEvaluationResult)({
5592
5586
  payload: pageState
@@ -5670,7 +5664,6 @@ var handleRouteRequest = async ({
5670
5664
  searchParams: request.nextUrl.searchParams,
5671
5665
  isDraftModeEnabled: draftModeEnabled
5672
5666
  });
5673
- const isPrefetch = isPrefetchRequest(request);
5674
5667
  const { components, rules } = await extractAndEvaluateRunnables({
5675
5668
  composition: route.compositionApiResponse.composition,
5676
5669
  routePath,
@@ -5688,8 +5681,7 @@ var handleRouteRequest = async ({
5688
5681
  searchParams: request.nextUrl.searchParams,
5689
5682
  isDraftModeEnabled: true
5690
5683
  // this is checked above
5691
- }),
5692
- isPrefetch
5684
+ })
5693
5685
  });
5694
5686
  const pageState = {
5695
5687
  routePath,
@@ -5703,8 +5695,7 @@ var handleRouteRequest = async ({
5703
5695
  }),
5704
5696
  previewMode,
5705
5697
  rules,
5706
- locale: options.locale,
5707
- isPrefetch: isPrefetch || void 0
5698
+ locale: options.locale
5708
5699
  };
5709
5700
  const code = (0, import_next_app_router_shared5.serializeEvaluationResult)({
5710
5701
  payload: pageState
@@ -5724,9 +5715,6 @@ var handleRouteRequest = async ({
5724
5715
  headers
5725
5716
  });
5726
5717
  };
5727
- var isPrefetchRequest = (request) => {
5728
- return request.headers.has("next-url");
5729
- };
5730
5718
  var extractAndEvaluateRunnables = async ({
5731
5719
  composition,
5732
5720
  routePath,
@@ -5737,14 +5725,12 @@ var extractAndEvaluateRunnables = async ({
5737
5725
  releaseId,
5738
5726
  defaultConsent,
5739
5727
  keys,
5740
- previewMode,
5741
- isPrefetch
5728
+ previewMode
5742
5729
  }) => {
5743
5730
  const extracted = extractRunnables(composition);
5744
5731
  const result = await evaluateRunnables({
5745
5732
  runnables: extracted,
5746
5733
  context,
5747
- isPrefetch,
5748
5734
  compositionContext: {
5749
5735
  _id: composition._id,
5750
5736
  type: composition.type,
@@ -5762,8 +5748,7 @@ var extractAndEvaluateRunnables = async ({
5762
5748
  defaultConsent,
5763
5749
  previewMode,
5764
5750
  rules: void 0,
5765
- locale: void 0,
5766
- isPrefetch: isPrefetch || void 0
5751
+ locale: void 0
5767
5752
  }
5768
5753
  }
5769
5754
  });
@@ -3039,8 +3039,7 @@ import {
3039
3039
  var evaluateRunnables = async ({
3040
3040
  runnables,
3041
3041
  context,
3042
- compositionContext,
3043
- isPrefetch
3042
+ compositionContext
3044
3043
  }) => {
3045
3044
  var _a;
3046
3045
  const result = {
@@ -3050,9 +3049,6 @@ var evaluateRunnables = async ({
3050
3049
  const runnablesToProcess = runnables.filter((item2) => item2.variantId === void 0);
3051
3050
  let item;
3052
3051
  while (item = runnablesToProcess.shift()) {
3053
- if (item.type === "test" && isPrefetch) {
3054
- continue;
3055
- }
3056
3052
  if (item.type === "test") {
3057
3053
  const testResult = evaluateTest({
3058
3054
  context,
@@ -5558,8 +5554,7 @@ var handlePlaygroundRequest = async ({
5558
5554
  searchParams: request.nextUrl.searchParams,
5559
5555
  isDraftModeEnabled: true
5560
5556
  // this is checked above
5561
- }),
5562
- isPrefetch: false
5557
+ })
5563
5558
  });
5564
5559
  const pageState = {
5565
5560
  routePath: id,
@@ -5577,8 +5572,7 @@ var handlePlaygroundRequest = async ({
5577
5572
  // this is checked above
5578
5573
  }),
5579
5574
  rules,
5580
- locale: options.locale,
5581
- isPrefetch: void 0
5575
+ locale: options.locale
5582
5576
  };
5583
5577
  const code = serializeEvaluationResult({
5584
5578
  payload: pageState
@@ -5662,7 +5656,6 @@ var handleRouteRequest = async ({
5662
5656
  searchParams: request.nextUrl.searchParams,
5663
5657
  isDraftModeEnabled: draftModeEnabled
5664
5658
  });
5665
- const isPrefetch = isPrefetchRequest(request);
5666
5659
  const { components, rules } = await extractAndEvaluateRunnables({
5667
5660
  composition: route.compositionApiResponse.composition,
5668
5661
  routePath,
@@ -5680,8 +5673,7 @@ var handleRouteRequest = async ({
5680
5673
  searchParams: request.nextUrl.searchParams,
5681
5674
  isDraftModeEnabled: true
5682
5675
  // this is checked above
5683
- }),
5684
- isPrefetch
5676
+ })
5685
5677
  });
5686
5678
  const pageState = {
5687
5679
  routePath,
@@ -5695,8 +5687,7 @@ var handleRouteRequest = async ({
5695
5687
  }),
5696
5688
  previewMode,
5697
5689
  rules,
5698
- locale: options.locale,
5699
- isPrefetch: isPrefetch || void 0
5690
+ locale: options.locale
5700
5691
  };
5701
5692
  const code = serializeEvaluationResult({
5702
5693
  payload: pageState
@@ -5716,9 +5707,6 @@ var handleRouteRequest = async ({
5716
5707
  headers
5717
5708
  });
5718
5709
  };
5719
- var isPrefetchRequest = (request) => {
5720
- return request.headers.has("next-url");
5721
- };
5722
5710
  var extractAndEvaluateRunnables = async ({
5723
5711
  composition,
5724
5712
  routePath,
@@ -5729,14 +5717,12 @@ var extractAndEvaluateRunnables = async ({
5729
5717
  releaseId,
5730
5718
  defaultConsent,
5731
5719
  keys,
5732
- previewMode,
5733
- isPrefetch
5720
+ previewMode
5734
5721
  }) => {
5735
5722
  const extracted = extractRunnables(composition);
5736
5723
  const result = await evaluateRunnables({
5737
5724
  runnables: extracted,
5738
5725
  context,
5739
- isPrefetch,
5740
5726
  compositionContext: {
5741
5727
  _id: composition._id,
5742
5728
  type: composition.type,
@@ -5754,8 +5740,7 @@ var extractAndEvaluateRunnables = async ({
5754
5740
  defaultConsent,
5755
5741
  previewMode,
5756
5742
  rules: void 0,
5757
- locale: void 0,
5758
- isPrefetch: isPrefetch || void 0
5743
+ locale: void 0
5759
5744
  }
5760
5745
  }
5761
5746
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/next-app-router",
3
- "version": "20.50.1-alpha.2+3f336b8aeb",
3
+ "version": "20.50.1-alpha.4+47395e9a74",
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.50.1-alpha.2+3f336b8aeb",
103
- "@uniformdev/next-app-router-client": "20.50.1-alpha.2+3f336b8aeb",
104
- "@uniformdev/next-app-router-shared": "20.50.1-alpha.2+3f336b8aeb",
105
- "@uniformdev/redirect": "20.50.1-alpha.2+3f336b8aeb",
106
- "@uniformdev/richtext": "20.50.1-alpha.2+3f336b8aeb",
107
- "@uniformdev/webhooks": "20.50.1-alpha.2+3f336b8aeb",
102
+ "@uniformdev/canvas-react": "20.50.1-alpha.4+47395e9a74",
103
+ "@uniformdev/next-app-router-client": "20.50.1-alpha.4+47395e9a74",
104
+ "@uniformdev/next-app-router-shared": "20.50.1-alpha.4+47395e9a74",
105
+ "@uniformdev/redirect": "20.50.1-alpha.4+47395e9a74",
106
+ "@uniformdev/richtext": "20.50.1-alpha.4+47395e9a74",
107
+ "@uniformdev/webhooks": "20.50.1-alpha.4+47395e9a74",
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": "3f336b8aeb3f00b54cefee16c3e090e9f952272f"
124
+ "gitHead": "47395e9a74fd4e2a7a5b4cc6488c7326ad906bf9"
125
125
  }