@uniformdev/next-app-router 20.80.2 → 20.81.1-alpha.4.sha-de16ebeee7

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.d.mts CHANGED
@@ -1,15 +1,13 @@
1
- import { CanvasClient, CompositionDeliveryClient, RouteClient, ComponentInstance } from '@uniformdev/canvas';
1
+ import { CanvasClient, CompositionDeliveryClient, RouteClient } 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-le6UEB_r.mjs';
6
- export { C as CompositionCache, a as ResolveComponentFunction, R as ResolveComponentResult, b as UniformComposition, c as createCompositionCache } from './UniformComposition-le6UEB_r.mjs';
5
+ import { U as UniformCompositionProps } from './UniformComposition-fq7Qfhvp.mjs';
6
+ export { C as CompositionCache, a as ResolveComponentFunction, R as ResolveComponentResult, b as UniformComposition, c as createCompositionCache } from './UniformComposition-fq7Qfhvp.mjs';
7
7
  import React from 'react';
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-BElN_CWD.mjs';
9
- import { a as ResolvedRouteResult } from './resolveRouteFromCode-CuJ4JHeb.mjs';
10
- export { R as ResolveRouteFunction, r as resolveRouteFromCode } from './resolveRouteFromCode-CuJ4JHeb.mjs';
8
+ import { a as ResolvedRouteResult } from './resolveRouteFromCode-CId7aItt.mjs';
9
+ export { D as DataClient, b as DefaultDataClient, E as EnhanceRouteOptions, G as GetRouteOptions, c as GetRouteResult, R as ResolveRouteFunction, r as resolveRouteFromCode } from './resolveRouteFromCode-CId7aItt.mjs';
11
10
  import '@uniformdev/next-app-router-client';
12
- import '@uniformdev/context';
13
11
 
14
12
  type SpecificCacheMode<TCacheMode extends CacheMode> = {
15
13
  cache: TCacheMode;
@@ -222,44 +220,25 @@ type CreateStaticParamsOptions = {
222
220
  locale?: string;
223
221
  };
224
222
  /**
225
- * Function to generate all possible page states for the given paths in playground mode.
226
- * @param options
227
- * @returns
223
+ * Generates the playground code for the first of the given paths. Playground requests are drafts,
224
+ * which evaluate while the page renders, so there is one code per composition.
228
225
  */
229
226
  declare const createUniformPlaygroundStaticParams: (options: CreateStaticParamsOptions) => Promise<{
230
227
  code: string;
231
228
  }[]>;
232
229
  /**
233
- * Function to generate all possible page states for the given paths.
234
- * @param options
235
- * @returns
230
+ * Generates one code per published composition among the given paths, for `generateStaticParams`
231
+ * of the `[code]` route. Codes carry the route, not an evaluation, so each path has one static page
232
+ * whose variants are chosen in the browser or at the edge.
236
233
  */
237
234
  declare const createUniformStaticParams: (options: CreateStaticParamsOptions) => Promise<{
238
235
  code: string;
239
236
  }[]>;
240
237
 
241
- type EvaluateTestsFunction = (test: {
242
- name: string;
243
- component: ComponentInstance;
244
- }) => boolean;
245
- type EvaluatePersonalizationsFunction = (personalization: {
246
- name: string;
247
- component: ComponentInstance;
248
- }) => boolean;
249
- type PrecomputeCompositionOptions = Pick<ResolvedRouteResult, 'pageState' | 'route'> & {
250
- /**
251
- * Whether to evaluate tests
252
- * @defaultValue true
253
- */
254
- evaluateTests?: boolean | EvaluateTestsFunction;
255
- /**
256
- * Whether to evaluate personalizations
257
- * @defaultValue true
258
- */
259
- evaluatePersonalizations?: boolean | EvaluatePersonalizationsFunction;
260
- };
261
- declare const precomputeComposition: ({ pageState, route, evaluatePersonalizations, evaluateTests, }: PrecomputeCompositionOptions) => Promise<void>;
262
-
238
+ /**
239
+ * Resolves the composition of a playground code. The code carries the composition id, and the
240
+ * composition resolves in the editor state, falling back to the draft state.
241
+ */
263
242
  declare const resolvePlaygroundRoute: ({ code }: {
264
243
  code: string;
265
244
  }) => Promise<ResolvedRouteResult>;
@@ -276,4 +255,4 @@ declare const findRouteMatch: (routes: CustomRoute[], path: string) => RouteMatc
276
255
 
277
256
  declare const serverContext: <T>(defaultValue?: T) => [() => T | undefined, (v: T) => void];
278
257
 
279
- export { type AwaitedUniformPageParameters, type CreateStaticParamsOptions, type CustomRoute, type GetCanvasClientOptions, type GetCompositionDeliveryClientOptions, type GetManifestClientOptions, type GetProjectMapClientOptions, type GetRouteClientOptions, type PlaygroundParameters, type RouteMatch, UniformCompositionProps, type UniformPageParameters, UniformPlayground, createUniformPlaygroundStaticParams, createUniformStaticParams, findRouteMatch, getCanvasClient, getCompositionDeliveryClient, getManifest, getManifestClient, getProjectMapClient, getRouteClient, precomputeComposition, resolvePlaygroundRoute, serverContext };
258
+ export { type AwaitedUniformPageParameters, type CreateStaticParamsOptions, type CustomRoute, type GetCanvasClientOptions, type GetCompositionDeliveryClientOptions, type GetManifestClientOptions, type GetProjectMapClientOptions, type GetRouteClientOptions, type PlaygroundParameters, type RouteMatch, UniformCompositionProps, type UniformPageParameters, UniformPlayground, createUniformPlaygroundStaticParams, createUniformStaticParams, findRouteMatch, getCanvasClient, getCompositionDeliveryClient, getManifest, getManifestClient, getProjectMapClient, getRouteClient, resolvePlaygroundRoute, serverContext };
package/dist/index.d.ts CHANGED
@@ -1,15 +1,13 @@
1
- import { CanvasClient, CompositionDeliveryClient, RouteClient, ComponentInstance } from '@uniformdev/canvas';
1
+ import { CanvasClient, CompositionDeliveryClient, RouteClient } 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-DBO-oo7J.js';
6
- export { C as CompositionCache, a as ResolveComponentFunction, R as ResolveComponentResult, b as UniformComposition, c as createCompositionCache } from './UniformComposition-DBO-oo7J.js';
5
+ import { U as UniformCompositionProps } from './UniformComposition-T7CRvU1H.js';
6
+ export { C as CompositionCache, a as ResolveComponentFunction, R as ResolveComponentResult, b as UniformComposition, c as createCompositionCache } from './UniformComposition-T7CRvU1H.js';
7
7
  import React from 'react';
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-BElN_CWD.js';
9
- import { a as ResolvedRouteResult } from './resolveRouteFromCode-BOvjIvM2.js';
10
- export { R as ResolveRouteFunction, r as resolveRouteFromCode } from './resolveRouteFromCode-BOvjIvM2.js';
8
+ import { a as ResolvedRouteResult } from './resolveRouteFromCode-CId7aItt.js';
9
+ export { D as DataClient, b as DefaultDataClient, E as EnhanceRouteOptions, G as GetRouteOptions, c as GetRouteResult, R as ResolveRouteFunction, r as resolveRouteFromCode } from './resolveRouteFromCode-CId7aItt.js';
11
10
  import '@uniformdev/next-app-router-client';
12
- import '@uniformdev/context';
13
11
 
14
12
  type SpecificCacheMode<TCacheMode extends CacheMode> = {
15
13
  cache: TCacheMode;
@@ -222,44 +220,25 @@ type CreateStaticParamsOptions = {
222
220
  locale?: string;
223
221
  };
224
222
  /**
225
- * Function to generate all possible page states for the given paths in playground mode.
226
- * @param options
227
- * @returns
223
+ * Generates the playground code for the first of the given paths. Playground requests are drafts,
224
+ * which evaluate while the page renders, so there is one code per composition.
228
225
  */
229
226
  declare const createUniformPlaygroundStaticParams: (options: CreateStaticParamsOptions) => Promise<{
230
227
  code: string;
231
228
  }[]>;
232
229
  /**
233
- * Function to generate all possible page states for the given paths.
234
- * @param options
235
- * @returns
230
+ * Generates one code per published composition among the given paths, for `generateStaticParams`
231
+ * of the `[code]` route. Codes carry the route, not an evaluation, so each path has one static page
232
+ * whose variants are chosen in the browser or at the edge.
236
233
  */
237
234
  declare const createUniformStaticParams: (options: CreateStaticParamsOptions) => Promise<{
238
235
  code: string;
239
236
  }[]>;
240
237
 
241
- type EvaluateTestsFunction = (test: {
242
- name: string;
243
- component: ComponentInstance;
244
- }) => boolean;
245
- type EvaluatePersonalizationsFunction = (personalization: {
246
- name: string;
247
- component: ComponentInstance;
248
- }) => boolean;
249
- type PrecomputeCompositionOptions = Pick<ResolvedRouteResult, 'pageState' | 'route'> & {
250
- /**
251
- * Whether to evaluate tests
252
- * @defaultValue true
253
- */
254
- evaluateTests?: boolean | EvaluateTestsFunction;
255
- /**
256
- * Whether to evaluate personalizations
257
- * @defaultValue true
258
- */
259
- evaluatePersonalizations?: boolean | EvaluatePersonalizationsFunction;
260
- };
261
- declare const precomputeComposition: ({ pageState, route, evaluatePersonalizations, evaluateTests, }: PrecomputeCompositionOptions) => Promise<void>;
262
-
238
+ /**
239
+ * Resolves the composition of a playground code. The code carries the composition id, and the
240
+ * composition resolves in the editor state, falling back to the draft state.
241
+ */
263
242
  declare const resolvePlaygroundRoute: ({ code }: {
264
243
  code: string;
265
244
  }) => Promise<ResolvedRouteResult>;
@@ -276,4 +255,4 @@ declare const findRouteMatch: (routes: CustomRoute[], path: string) => RouteMatc
276
255
 
277
256
  declare const serverContext: <T>(defaultValue?: T) => [() => T | undefined, (v: T) => void];
278
257
 
279
- export { type AwaitedUniformPageParameters, type CreateStaticParamsOptions, type CustomRoute, type GetCanvasClientOptions, type GetCompositionDeliveryClientOptions, type GetManifestClientOptions, type GetProjectMapClientOptions, type GetRouteClientOptions, type PlaygroundParameters, type RouteMatch, UniformCompositionProps, type UniformPageParameters, UniformPlayground, createUniformPlaygroundStaticParams, createUniformStaticParams, findRouteMatch, getCanvasClient, getCompositionDeliveryClient, getManifest, getManifestClient, getProjectMapClient, getRouteClient, precomputeComposition, resolvePlaygroundRoute, serverContext };
258
+ export { type AwaitedUniformPageParameters, type CreateStaticParamsOptions, type CustomRoute, type GetCanvasClientOptions, type GetCompositionDeliveryClientOptions, type GetManifestClientOptions, type GetProjectMapClientOptions, type GetRouteClientOptions, type PlaygroundParameters, type RouteMatch, UniformCompositionProps, type UniformPageParameters, UniformPlayground, createUniformPlaygroundStaticParams, createUniformStaticParams, findRouteMatch, getCanvasClient, getCompositionDeliveryClient, getManifest, getManifestClient, getProjectMapClient, getRouteClient, resolvePlaygroundRoute, serverContext };