@uniformdev/next-app-router 20.50.2-alpha.1 → 20.50.2-alpha.39

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.
@@ -530,6 +530,20 @@ async function handleRateLimits(callApi) {
530
530
  }
531
531
  return response;
532
532
  }
533
+ var isPlainObject = (obj) => typeof obj === "object" && obj !== null && !Array.isArray(obj);
534
+ function rewriteFiltersForApi(filters) {
535
+ return Object.entries(filters != null ? filters : {}).reduce(
536
+ (acc, [key, value]) => {
537
+ const lhs = `filters.${key}` + (isPlainObject(value) ? `[${Object.keys(value)[0]}]` : "");
538
+ const rhs = isPlainObject(value) ? Object.values(value)[0] : value;
539
+ return {
540
+ ...acc,
541
+ [lhs]: Array.isArray(rhs) ? rhs.map((v) => `${v}`.trim()).join(",") : `${rhs}`.trim()
542
+ };
543
+ },
544
+ {}
545
+ );
546
+ }
533
547
  var _url;
534
548
  var _AggregateClient = class _AggregateClient2 extends ApiClient {
535
549
  constructor(options) {
@@ -1313,20 +1327,6 @@ function createLimitPolicy({
1313
1327
  return currentFunc();
1314
1328
  };
1315
1329
  }
1316
- var isPlainObject = (obj) => typeof obj === "object" && obj !== null && !Array.isArray(obj);
1317
- function rewriteFilters(filters) {
1318
- return Object.entries(filters != null ? filters : {}).reduce(
1319
- (acc, [key, value]) => {
1320
- const lhs = `filters.${key}` + (isPlainObject(value) ? `[${Object.keys(value)[0]}]` : "");
1321
- const rhs = isPlainObject(value) ? Object.values(value)[0] : value;
1322
- return {
1323
- ...acc,
1324
- [lhs]: Array.isArray(rhs) ? rhs.map((v) => `${v}`.trim()).join(",") : `${rhs}`.trim()
1325
- };
1326
- },
1327
- {}
1328
- );
1329
- }
1330
1330
  var CANVAS_URL = "/api/v1/canvas";
1331
1331
  var CanvasClient = class extends ApiClient {
1332
1332
  constructor(options) {
@@ -1342,7 +1342,7 @@ var CanvasClient = class extends ApiClient {
1342
1342
  async getCompositionList(params = {}) {
1343
1343
  const { projectId } = this.options;
1344
1344
  const { resolveData, filters, ...originParams } = params;
1345
- const rewrittenFilters = rewriteFilters(filters);
1345
+ const rewrittenFilters = rewriteFiltersForApi(filters);
1346
1346
  if (!resolveData) {
1347
1347
  const fetchUri = this.createUrl(CANVAS_URL, { ...originParams, projectId, ...rewrittenFilters });
1348
1348
  return this.apiClient(fetchUri);
@@ -1462,7 +1462,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
1462
1462
  getEntries(options) {
1463
1463
  const { projectId } = this.options;
1464
1464
  const { skipDataResolution, filters, ...params } = options;
1465
- const rewrittenFilters = rewriteFilters(filters);
1465
+ const rewrittenFilters = rewriteFiltersForApi(filters);
1466
1466
  if (skipDataResolution) {
1467
1467
  const url = this.createUrl(__privateGet3(_ContentClient2, _entriesUrl), { ...params, ...rewrittenFilters, projectId });
1468
1468
  return this.apiClient(url);
@@ -2197,6 +2197,7 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
2197
2197
  _baseUrl = /* @__PURE__ */ new WeakMap();
2198
2198
  __privateAdd3(_IntegrationPropertyEditorsClient, _baseUrl, "/api/v1/integration-property-editors");
2199
2199
  var _url22;
2200
+ var _projectsUrl;
2200
2201
  var _ProjectClient = class _ProjectClient2 extends ApiClient {
2201
2202
  constructor(options) {
2202
2203
  super({ ...options, bypassCache: true });
@@ -2206,6 +2207,15 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
2206
2207
  const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _url22), { ...options });
2207
2208
  return await this.apiClient(fetchUri);
2208
2209
  }
2210
+ /**
2211
+ * Fetches projects grouped by team.
2212
+ * When teamId is provided, returns a single team with its projects.
2213
+ * When omitted, returns all accessible teams and their projects.
2214
+ */
2215
+ async getProjects(options) {
2216
+ const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _projectsUrl), options ? { ...options } : {});
2217
+ return await this.apiClient(fetchUri);
2218
+ }
2209
2219
  /** Updates or creates (based on id) a Project */
2210
2220
  async upsert(body) {
2211
2221
  const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _url22));
@@ -2225,7 +2235,9 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
2225
2235
  }
2226
2236
  };
2227
2237
  _url22 = /* @__PURE__ */ new WeakMap();
2238
+ _projectsUrl = /* @__PURE__ */ new WeakMap();
2228
2239
  __privateAdd3(_ProjectClient, _url22, "/api/v1/project");
2240
+ __privateAdd3(_ProjectClient, _projectsUrl, "/api/v1/projects");
2229
2241
  var ROUTE_URL = "/api/v1/route";
2230
2242
  var RouteClient = class extends ApiClient {
2231
2243
  constructor(options) {
@@ -2339,8 +2351,15 @@ var isIncontextEditingEnabled = ({
2339
2351
  var isDevelopmentEnvironment = () => {
2340
2352
  return process.env.NODE_ENV === "development" || process.env.NODE_ENV === "test";
2341
2353
  };
2354
+ var shouldIgnoreRedirects = ({ state }) => {
2355
+ const isNotPublished = state !== CANVAS_PUBLISHED_STATE;
2356
+ return isNotPublished ? true : void 0;
2357
+ };
2342
2358
 
2343
2359
  // src/clients/cache.ts
2360
+ var isSpecificCacheMode = (options) => {
2361
+ return "cache" in options;
2362
+ };
2344
2363
  var isStateCacheMode = (options) => {
2345
2364
  return "state" in options;
2346
2365
  };
@@ -2362,7 +2381,9 @@ var resolveCache = ({
2362
2381
  }) => {
2363
2382
  let cache = void 0;
2364
2383
  if (options) {
2365
- if (isStateCacheMode(options)) {
2384
+ if (isSpecificCacheMode(options)) {
2385
+ cache = options.cache;
2386
+ } else if (isStateCacheMode(options)) {
2366
2387
  if (options.state === CANVAS_DRAFT_STATE || options.state === CANVAS_EDITOR_STATE) {
2367
2388
  cache = {
2368
2389
  type: "no-cache",
@@ -2757,7 +2778,10 @@ var DefaultDataClient = class {
2757
2778
  }
2758
2779
  }
2759
2780
  const manifest = await getManifest({
2760
- cache: {
2781
+ cache: isDevelopmentEnvironment() ? {
2782
+ type: "no-cache",
2783
+ bypassCache: true
2784
+ } : {
2761
2785
  type: "force-cache"
2762
2786
  }
2763
2787
  });
@@ -2860,12 +2884,13 @@ var DefaultDataClient = class {
2860
2884
  };
2861
2885
  }
2862
2886
  async getRoutePageState(options) {
2887
+ const shouldBypassCache = options.pageState.compositionState !== CANVAS_PUBLISHED_STATE || isDevelopmentEnvironment();
2863
2888
  const routeClient = getRouteClient({
2864
- cache: options.pageState.compositionState === CANVAS_PUBLISHED_STATE ? {
2865
- type: "force-cache"
2866
- } : {
2889
+ cache: shouldBypassCache ? {
2867
2890
  type: "no-cache",
2868
2891
  bypassCache: true
2892
+ } : {
2893
+ type: "force-cache"
2869
2894
  }
2870
2895
  });
2871
2896
  const originalRoute = {
@@ -2873,7 +2898,8 @@ var DefaultDataClient = class {
2873
2898
  state: options.pageState.compositionState,
2874
2899
  withComponentIDs: true,
2875
2900
  releaseId: options.pageState.releaseId,
2876
- locale: options.pageState.locale
2901
+ locale: options.pageState.locale,
2902
+ ignoreRedirects: shouldIgnoreRedirects({ state: options.pageState.compositionState })
2877
2903
  };
2878
2904
  const resolvedRoute = await this.getRouteFromApi({
2879
2905
  source: "pageState",
@@ -5422,7 +5448,8 @@ var retrieveRouteByPath = async ({
5422
5448
  withComponentIDs: true,
5423
5449
  withContentSourceMap: (_a = getServerConfig().experimental) == null ? void 0 : _a.vercelVisualEditing,
5424
5450
  releaseId,
5425
- locale
5451
+ locale,
5452
+ ignoreRedirects: shouldIgnoreRedirects({ state })
5426
5453
  }
5427
5454
  });
5428
5455
  };
@@ -5549,7 +5576,7 @@ var handlePlaygroundRequest = async ({
5549
5576
  })
5550
5577
  });
5551
5578
  const context = await onDemandContext.getContext();
5552
- const { components, rules } = await extractAndEvaluateRunnables({
5579
+ const { components, rules, allComponentIds } = await extractAndEvaluateRunnables({
5553
5580
  composition: composition.composition,
5554
5581
  routePath: id,
5555
5582
  state: composition.state,
@@ -5589,7 +5616,8 @@ var handlePlaygroundRequest = async ({
5589
5616
  isPrefetch: void 0
5590
5617
  };
5591
5618
  const code = (0, import_next_app_router_shared5.serializeEvaluationResult)({
5592
- payload: pageState
5619
+ payload: pageState,
5620
+ allComponentIds
5593
5621
  });
5594
5622
  let pathToRewriteTo = await (options.rewriteDestinationPath ? options.rewriteDestinationPath({ code, pageState, source: "playground" }) : void 0);
5595
5623
  if (!pathToRewriteTo) {
@@ -5603,15 +5631,16 @@ var handleRouteRequest = async ({
5603
5631
  dataClient,
5604
5632
  options
5605
5633
  }) => {
5606
- var _a, _b, _c, _d, _e, _f, _g, _h;
5634
+ var _a, _b, _c, _d, _e, _f, _g;
5635
+ const releaseId = (_b = (_a = options.release) == null ? void 0 : _a.id) != null ? _b : draftModeEnabled ? request.nextUrl.searchParams.get("releaseId") || void 0 : void 0;
5607
5636
  const states = await determineState({
5608
5637
  searchParams: request.nextUrl.searchParams,
5609
5638
  draftModeEnabled
5610
5639
  });
5611
- const requestPath = (_b = await ((_a = options.rewriteRequestPath) == null ? void 0 : _a.call(options, {
5640
+ const requestPath = (_d = await ((_c = options.rewriteRequestPath) == null ? void 0 : _c.call(options, {
5612
5641
  request,
5613
5642
  url: new URL(request.url)
5614
- }))) != null ? _b : {
5643
+ }))) != null ? _d : {
5615
5644
  path: `${request.nextUrl.pathname}${request.nextUrl.search}`
5616
5645
  };
5617
5646
  const serverConfig = getServerConfig();
@@ -5622,7 +5651,7 @@ var handleRouteRequest = async ({
5622
5651
  searchParams: request.nextUrl.searchParams,
5623
5652
  draftModeEnabled,
5624
5653
  dataClient,
5625
- releaseId: (_c = options.release) == null ? void 0 : _c.id,
5654
+ releaseId,
5626
5655
  locale: options.locale
5627
5656
  }),
5628
5657
  createOnDemandContext({
@@ -5634,10 +5663,10 @@ var handleRouteRequest = async ({
5634
5663
  })
5635
5664
  })
5636
5665
  ]);
5637
- if (!(routeResult == null ? void 0 : routeResult.route) || ((_d = routeResult == null ? void 0 : routeResult.route) == null ? void 0 : _d.type) === "notFound") {
5666
+ if (!(routeResult == null ? void 0 : routeResult.route) || ((_e = routeResult == null ? void 0 : routeResult.route) == null ? void 0 : _e.type) === "notFound") {
5638
5667
  return import_server.NextResponse.rewrite(new URL("/404", request.url));
5639
5668
  }
5640
- if (((_e = routeResult == null ? void 0 : routeResult.route) == null ? void 0 : _e.type) === "redirect") {
5669
+ if (((_f = routeResult == null ? void 0 : routeResult.route) == null ? void 0 : _f.type) === "redirect") {
5641
5670
  return handleRedirect({ request, route: routeResult.route });
5642
5671
  }
5643
5672
  const { route } = routeResult;
@@ -5671,14 +5700,14 @@ var handleRouteRequest = async ({
5671
5700
  isDraftModeEnabled: draftModeEnabled
5672
5701
  });
5673
5702
  const isPrefetch = isPrefetchRequest(request);
5674
- const { components, rules } = await extractAndEvaluateRunnables({
5703
+ const { components, rules, allComponentIds } = await extractAndEvaluateRunnables({
5675
5704
  composition: route.compositionApiResponse.composition,
5676
5705
  routePath,
5677
5706
  state,
5678
5707
  context,
5679
5708
  matchedRoute: route.matchedRoute,
5680
- dynamicInputs: (_f = route.dynamicInputs) != null ? _f : {},
5681
- releaseId: (_g = options.release) == null ? void 0 : _g.id,
5709
+ dynamicInputs: (_g = route.dynamicInputs) != null ? _g : {},
5710
+ releaseId,
5682
5711
  defaultConsent: determineDefaultConsent({
5683
5712
  serverConfig,
5684
5713
  defaultConsent: options.defaultConsent
@@ -5696,7 +5725,7 @@ var handleRouteRequest = async ({
5696
5725
  compositionState: state,
5697
5726
  components,
5698
5727
  keys: requestPath.keys,
5699
- releaseId: (_h = options.release) == null ? void 0 : _h.id,
5728
+ releaseId,
5700
5729
  defaultConsent: determineDefaultConsent({
5701
5730
  serverConfig,
5702
5731
  defaultConsent: options.defaultConsent
@@ -5707,7 +5736,8 @@ var handleRouteRequest = async ({
5707
5736
  isPrefetch: isPrefetch || void 0
5708
5737
  };
5709
5738
  const code = (0, import_next_app_router_shared5.serializeEvaluationResult)({
5710
- payload: pageState
5739
+ payload: pageState,
5740
+ allComponentIds
5711
5741
  });
5712
5742
  let pathToRewriteTo = await (options.rewriteDestinationPath ? options.rewriteDestinationPath({ code, pageState, source: "route" }) : void 0);
5713
5743
  if (!pathToRewriteTo) {
@@ -5767,7 +5797,8 @@ var extractAndEvaluateRunnables = async ({
5767
5797
  }
5768
5798
  }
5769
5799
  });
5770
- return result;
5800
+ const allComponentIds = extracted.filter((r) => r.type === "test" || r.type === "personalization").map((r) => r._id);
5801
+ return { ...result, allComponentIds };
5771
5802
  };
5772
5803
  var handleRedirect = ({ request, route }) => {
5773
5804
  const href = resolveRedirectHref({
@@ -515,6 +515,20 @@ async function handleRateLimits(callApi) {
515
515
  }
516
516
  return response;
517
517
  }
518
+ var isPlainObject = (obj) => typeof obj === "object" && obj !== null && !Array.isArray(obj);
519
+ function rewriteFiltersForApi(filters) {
520
+ return Object.entries(filters != null ? filters : {}).reduce(
521
+ (acc, [key, value]) => {
522
+ const lhs = `filters.${key}` + (isPlainObject(value) ? `[${Object.keys(value)[0]}]` : "");
523
+ const rhs = isPlainObject(value) ? Object.values(value)[0] : value;
524
+ return {
525
+ ...acc,
526
+ [lhs]: Array.isArray(rhs) ? rhs.map((v) => `${v}`.trim()).join(",") : `${rhs}`.trim()
527
+ };
528
+ },
529
+ {}
530
+ );
531
+ }
518
532
  var _url;
519
533
  var _AggregateClient = class _AggregateClient2 extends ApiClient {
520
534
  constructor(options) {
@@ -1298,20 +1312,6 @@ function createLimitPolicy({
1298
1312
  return currentFunc();
1299
1313
  };
1300
1314
  }
1301
- var isPlainObject = (obj) => typeof obj === "object" && obj !== null && !Array.isArray(obj);
1302
- function rewriteFilters(filters) {
1303
- return Object.entries(filters != null ? filters : {}).reduce(
1304
- (acc, [key, value]) => {
1305
- const lhs = `filters.${key}` + (isPlainObject(value) ? `[${Object.keys(value)[0]}]` : "");
1306
- const rhs = isPlainObject(value) ? Object.values(value)[0] : value;
1307
- return {
1308
- ...acc,
1309
- [lhs]: Array.isArray(rhs) ? rhs.map((v) => `${v}`.trim()).join(",") : `${rhs}`.trim()
1310
- };
1311
- },
1312
- {}
1313
- );
1314
- }
1315
1315
  var CANVAS_URL = "/api/v1/canvas";
1316
1316
  var CanvasClient = class extends ApiClient {
1317
1317
  constructor(options) {
@@ -1327,7 +1327,7 @@ var CanvasClient = class extends ApiClient {
1327
1327
  async getCompositionList(params = {}) {
1328
1328
  const { projectId } = this.options;
1329
1329
  const { resolveData, filters, ...originParams } = params;
1330
- const rewrittenFilters = rewriteFilters(filters);
1330
+ const rewrittenFilters = rewriteFiltersForApi(filters);
1331
1331
  if (!resolveData) {
1332
1332
  const fetchUri = this.createUrl(CANVAS_URL, { ...originParams, projectId, ...rewrittenFilters });
1333
1333
  return this.apiClient(fetchUri);
@@ -1447,7 +1447,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
1447
1447
  getEntries(options) {
1448
1448
  const { projectId } = this.options;
1449
1449
  const { skipDataResolution, filters, ...params } = options;
1450
- const rewrittenFilters = rewriteFilters(filters);
1450
+ const rewrittenFilters = rewriteFiltersForApi(filters);
1451
1451
  if (skipDataResolution) {
1452
1452
  const url = this.createUrl(__privateGet3(_ContentClient2, _entriesUrl), { ...params, ...rewrittenFilters, projectId });
1453
1453
  return this.apiClient(url);
@@ -2182,6 +2182,7 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
2182
2182
  _baseUrl = /* @__PURE__ */ new WeakMap();
2183
2183
  __privateAdd3(_IntegrationPropertyEditorsClient, _baseUrl, "/api/v1/integration-property-editors");
2184
2184
  var _url22;
2185
+ var _projectsUrl;
2185
2186
  var _ProjectClient = class _ProjectClient2 extends ApiClient {
2186
2187
  constructor(options) {
2187
2188
  super({ ...options, bypassCache: true });
@@ -2191,6 +2192,15 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
2191
2192
  const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _url22), { ...options });
2192
2193
  return await this.apiClient(fetchUri);
2193
2194
  }
2195
+ /**
2196
+ * Fetches projects grouped by team.
2197
+ * When teamId is provided, returns a single team with its projects.
2198
+ * When omitted, returns all accessible teams and their projects.
2199
+ */
2200
+ async getProjects(options) {
2201
+ const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _projectsUrl), options ? { ...options } : {});
2202
+ return await this.apiClient(fetchUri);
2203
+ }
2194
2204
  /** Updates or creates (based on id) a Project */
2195
2205
  async upsert(body) {
2196
2206
  const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _url22));
@@ -2210,7 +2220,9 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
2210
2220
  }
2211
2221
  };
2212
2222
  _url22 = /* @__PURE__ */ new WeakMap();
2223
+ _projectsUrl = /* @__PURE__ */ new WeakMap();
2213
2224
  __privateAdd3(_ProjectClient, _url22, "/api/v1/project");
2225
+ __privateAdd3(_ProjectClient, _projectsUrl, "/api/v1/projects");
2214
2226
  var ROUTE_URL = "/api/v1/route";
2215
2227
  var RouteClient = class extends ApiClient {
2216
2228
  constructor(options) {
@@ -2326,8 +2338,15 @@ var isIncontextEditingEnabled = ({
2326
2338
  var isDevelopmentEnvironment = () => {
2327
2339
  return process.env.NODE_ENV === "development" || process.env.NODE_ENV === "test";
2328
2340
  };
2341
+ var shouldIgnoreRedirects = ({ state }) => {
2342
+ const isNotPublished = state !== CANVAS_PUBLISHED_STATE;
2343
+ return isNotPublished ? true : void 0;
2344
+ };
2329
2345
 
2330
2346
  // src/clients/cache.ts
2347
+ var isSpecificCacheMode = (options) => {
2348
+ return "cache" in options;
2349
+ };
2331
2350
  var isStateCacheMode = (options) => {
2332
2351
  return "state" in options;
2333
2352
  };
@@ -2349,7 +2368,9 @@ var resolveCache = ({
2349
2368
  }) => {
2350
2369
  let cache = void 0;
2351
2370
  if (options) {
2352
- if (isStateCacheMode(options)) {
2371
+ if (isSpecificCacheMode(options)) {
2372
+ cache = options.cache;
2373
+ } else if (isStateCacheMode(options)) {
2353
2374
  if (options.state === CANVAS_DRAFT_STATE || options.state === CANVAS_EDITOR_STATE) {
2354
2375
  cache = {
2355
2376
  type: "no-cache",
@@ -2744,7 +2765,10 @@ var DefaultDataClient = class {
2744
2765
  }
2745
2766
  }
2746
2767
  const manifest = await getManifest({
2747
- cache: {
2768
+ cache: isDevelopmentEnvironment() ? {
2769
+ type: "no-cache",
2770
+ bypassCache: true
2771
+ } : {
2748
2772
  type: "force-cache"
2749
2773
  }
2750
2774
  });
@@ -2847,12 +2871,13 @@ var DefaultDataClient = class {
2847
2871
  };
2848
2872
  }
2849
2873
  async getRoutePageState(options) {
2874
+ const shouldBypassCache = options.pageState.compositionState !== CANVAS_PUBLISHED_STATE || isDevelopmentEnvironment();
2850
2875
  const routeClient = getRouteClient({
2851
- cache: options.pageState.compositionState === CANVAS_PUBLISHED_STATE ? {
2852
- type: "force-cache"
2853
- } : {
2876
+ cache: shouldBypassCache ? {
2854
2877
  type: "no-cache",
2855
2878
  bypassCache: true
2879
+ } : {
2880
+ type: "force-cache"
2856
2881
  }
2857
2882
  });
2858
2883
  const originalRoute = {
@@ -2860,7 +2885,8 @@ var DefaultDataClient = class {
2860
2885
  state: options.pageState.compositionState,
2861
2886
  withComponentIDs: true,
2862
2887
  releaseId: options.pageState.releaseId,
2863
- locale: options.pageState.locale
2888
+ locale: options.pageState.locale,
2889
+ ignoreRedirects: shouldIgnoreRedirects({ state: options.pageState.compositionState })
2864
2890
  };
2865
2891
  const resolvedRoute = await this.getRouteFromApi({
2866
2892
  source: "pageState",
@@ -5414,7 +5440,8 @@ var retrieveRouteByPath = async ({
5414
5440
  withComponentIDs: true,
5415
5441
  withContentSourceMap: (_a = getServerConfig().experimental) == null ? void 0 : _a.vercelVisualEditing,
5416
5442
  releaseId,
5417
- locale
5443
+ locale,
5444
+ ignoreRedirects: shouldIgnoreRedirects({ state })
5418
5445
  }
5419
5446
  });
5420
5447
  };
@@ -5541,7 +5568,7 @@ var handlePlaygroundRequest = async ({
5541
5568
  })
5542
5569
  });
5543
5570
  const context = await onDemandContext.getContext();
5544
- const { components, rules } = await extractAndEvaluateRunnables({
5571
+ const { components, rules, allComponentIds } = await extractAndEvaluateRunnables({
5545
5572
  composition: composition.composition,
5546
5573
  routePath: id,
5547
5574
  state: composition.state,
@@ -5581,7 +5608,8 @@ var handlePlaygroundRequest = async ({
5581
5608
  isPrefetch: void 0
5582
5609
  };
5583
5610
  const code = serializeEvaluationResult({
5584
- payload: pageState
5611
+ payload: pageState,
5612
+ allComponentIds
5585
5613
  });
5586
5614
  let pathToRewriteTo = await (options.rewriteDestinationPath ? options.rewriteDestinationPath({ code, pageState, source: "playground" }) : void 0);
5587
5615
  if (!pathToRewriteTo) {
@@ -5595,15 +5623,16 @@ var handleRouteRequest = async ({
5595
5623
  dataClient,
5596
5624
  options
5597
5625
  }) => {
5598
- var _a, _b, _c, _d, _e, _f, _g, _h;
5626
+ var _a, _b, _c, _d, _e, _f, _g;
5627
+ const releaseId = (_b = (_a = options.release) == null ? void 0 : _a.id) != null ? _b : draftModeEnabled ? request.nextUrl.searchParams.get("releaseId") || void 0 : void 0;
5599
5628
  const states = await determineState({
5600
5629
  searchParams: request.nextUrl.searchParams,
5601
5630
  draftModeEnabled
5602
5631
  });
5603
- const requestPath = (_b = await ((_a = options.rewriteRequestPath) == null ? void 0 : _a.call(options, {
5632
+ const requestPath = (_d = await ((_c = options.rewriteRequestPath) == null ? void 0 : _c.call(options, {
5604
5633
  request,
5605
5634
  url: new URL(request.url)
5606
- }))) != null ? _b : {
5635
+ }))) != null ? _d : {
5607
5636
  path: `${request.nextUrl.pathname}${request.nextUrl.search}`
5608
5637
  };
5609
5638
  const serverConfig = getServerConfig();
@@ -5614,7 +5643,7 @@ var handleRouteRequest = async ({
5614
5643
  searchParams: request.nextUrl.searchParams,
5615
5644
  draftModeEnabled,
5616
5645
  dataClient,
5617
- releaseId: (_c = options.release) == null ? void 0 : _c.id,
5646
+ releaseId,
5618
5647
  locale: options.locale
5619
5648
  }),
5620
5649
  createOnDemandContext({
@@ -5626,10 +5655,10 @@ var handleRouteRequest = async ({
5626
5655
  })
5627
5656
  })
5628
5657
  ]);
5629
- if (!(routeResult == null ? void 0 : routeResult.route) || ((_d = routeResult == null ? void 0 : routeResult.route) == null ? void 0 : _d.type) === "notFound") {
5658
+ if (!(routeResult == null ? void 0 : routeResult.route) || ((_e = routeResult == null ? void 0 : routeResult.route) == null ? void 0 : _e.type) === "notFound") {
5630
5659
  return NextResponse.rewrite(new URL("/404", request.url));
5631
5660
  }
5632
- if (((_e = routeResult == null ? void 0 : routeResult.route) == null ? void 0 : _e.type) === "redirect") {
5661
+ if (((_f = routeResult == null ? void 0 : routeResult.route) == null ? void 0 : _f.type) === "redirect") {
5633
5662
  return handleRedirect({ request, route: routeResult.route });
5634
5663
  }
5635
5664
  const { route } = routeResult;
@@ -5663,14 +5692,14 @@ var handleRouteRequest = async ({
5663
5692
  isDraftModeEnabled: draftModeEnabled
5664
5693
  });
5665
5694
  const isPrefetch = isPrefetchRequest(request);
5666
- const { components, rules } = await extractAndEvaluateRunnables({
5695
+ const { components, rules, allComponentIds } = await extractAndEvaluateRunnables({
5667
5696
  composition: route.compositionApiResponse.composition,
5668
5697
  routePath,
5669
5698
  state,
5670
5699
  context,
5671
5700
  matchedRoute: route.matchedRoute,
5672
- dynamicInputs: (_f = route.dynamicInputs) != null ? _f : {},
5673
- releaseId: (_g = options.release) == null ? void 0 : _g.id,
5701
+ dynamicInputs: (_g = route.dynamicInputs) != null ? _g : {},
5702
+ releaseId,
5674
5703
  defaultConsent: determineDefaultConsent({
5675
5704
  serverConfig,
5676
5705
  defaultConsent: options.defaultConsent
@@ -5688,7 +5717,7 @@ var handleRouteRequest = async ({
5688
5717
  compositionState: state,
5689
5718
  components,
5690
5719
  keys: requestPath.keys,
5691
- releaseId: (_h = options.release) == null ? void 0 : _h.id,
5720
+ releaseId,
5692
5721
  defaultConsent: determineDefaultConsent({
5693
5722
  serverConfig,
5694
5723
  defaultConsent: options.defaultConsent
@@ -5699,7 +5728,8 @@ var handleRouteRequest = async ({
5699
5728
  isPrefetch: isPrefetch || void 0
5700
5729
  };
5701
5730
  const code = serializeEvaluationResult({
5702
- payload: pageState
5731
+ payload: pageState,
5732
+ allComponentIds
5703
5733
  });
5704
5734
  let pathToRewriteTo = await (options.rewriteDestinationPath ? options.rewriteDestinationPath({ code, pageState, source: "route" }) : void 0);
5705
5735
  if (!pathToRewriteTo) {
@@ -5759,7 +5789,8 @@ var extractAndEvaluateRunnables = async ({
5759
5789
  }
5760
5790
  }
5761
5791
  });
5762
- return result;
5792
+ const allComponentIds = extracted.filter((r) => r.type === "test" || r.type === "personalization").map((r) => r._id);
5793
+ return { ...result, allComponentIds };
5763
5794
  };
5764
5795
  var handleRedirect = ({ request, route }) => {
5765
5796
  const href = resolveRedirectHref({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/next-app-router",
3
- "version": "20.50.2-alpha.1+8798ffc32d",
3
+ "version": "20.50.2-alpha.39+83d081969c",
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.2-alpha.1+8798ffc32d",
103
- "@uniformdev/next-app-router-client": "20.50.2-alpha.1+8798ffc32d",
104
- "@uniformdev/next-app-router-shared": "20.50.2-alpha.1+8798ffc32d",
105
- "@uniformdev/redirect": "20.50.2-alpha.1+8798ffc32d",
106
- "@uniformdev/richtext": "20.50.2-alpha.1+8798ffc32d",
107
- "@uniformdev/webhooks": "20.50.2-alpha.1+8798ffc32d",
102
+ "@uniformdev/canvas-react": "20.50.2-alpha.39+83d081969c",
103
+ "@uniformdev/next-app-router-client": "20.50.2-alpha.39+83d081969c",
104
+ "@uniformdev/next-app-router-shared": "20.50.2-alpha.39+83d081969c",
105
+ "@uniformdev/redirect": "20.50.2-alpha.39+83d081969c",
106
+ "@uniformdev/richtext": "20.50.2-alpha.39+83d081969c",
107
+ "@uniformdev/webhooks": "20.50.2-alpha.39+83d081969c",
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": "8798ffc32d405a5d357628861a40cd964e3ea6f0"
124
+ "gitHead": "83d081969cac03a901e60d5c78bad66eef78de80"
125
125
  }