@uniformdev/canvas-next 20.35.0 → 20.35.1-alpha.210

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.
@@ -3,8 +3,10 @@ import { GetServerSidePropsContext, GetServerSidePropsResult, GetServerSideProps
3
3
  import { a as UniformPreviewData } from '../models-CupnCqnn.mjs';
4
4
  import * as querystring from 'querystring';
5
5
  import { ParsedUrlQuery } from 'querystring';
6
+ import * as _uniformdev_context__ from '@uniformdev/context/*';
6
7
  import * as _uniformdev_canvas from '@uniformdev/canvas';
7
8
  import { RouteGetResponseEdgehancedComposition, RouteGetResponseNotFound, RouteGetResponseRedirect, RouteClient, RouteGetParameters, RootComponentInstance } from '@uniformdev/canvas';
9
+ import { CompositionMetadata } from '@uniformdev/context';
8
10
  import { ProjectMapNodeGetRequest, ProjectMapNodeGetResponse, ProjectMapClient } from '@uniformdev/project-map';
9
11
  import { RedirectClient } from '@uniformdev/redirect';
10
12
  import { GetStaticPropsContext as GetStaticPropsContext$1, GetServerSidePropsContext as GetServerSidePropsContext$1 } from 'next/types';
@@ -36,6 +38,15 @@ type RouteHandlerOptions<TContext, TResult, TSuccessResult> = {
36
38
  */
37
39
  handleNotFound?: HandleRouteNotFoundFunction<TContext, TResult>;
38
40
  };
41
+ /**
42
+ * Schema that comes out of route API handler in case of a composition route response.
43
+ * Should be used together as UniformAppProps<RouteCompositionResult> in Next.js app.
44
+ */
45
+ type RouteCompositionResult<TData = RootComponentInstance> = {
46
+ matchedRoute: string;
47
+ dynamicInputs: Record<string, string>;
48
+ data: TData;
49
+ };
39
50
 
40
51
  /**
41
52
  * Creates an implementation of `getServerSideProps` using the Uniform Route API.
@@ -46,7 +57,7 @@ declare const withUniformGetServerSideProps: <TProps extends {
46
57
  [key: string]: any;
47
58
  } = {
48
59
  data: RootComponentInstance;
49
- }>(options?: RouteHandlerOptions<GetServerSidePropsContext<ParsedUrlQuery, UniformPreviewData>, GetServerSidePropsResult<never>, GetServerSidePropsResult<TProps>>) => GetServerSideProps<TProps, ParsedUrlQuery, UniformPreviewData>;
60
+ } & NonNullable<Omit<CompositionMetadata, "compositionId">>>(options?: RouteHandlerOptions<GetServerSidePropsContext<ParsedUrlQuery, UniformPreviewData>, GetServerSidePropsResult<never>, GetServerSidePropsResult<TProps>>) => GetServerSideProps<TProps, ParsedUrlQuery, UniformPreviewData>;
50
61
 
51
62
  declare const withUniformGetStaticPaths: (options?: {
52
63
  projectMapId?: string;
@@ -78,7 +89,7 @@ declare const withUniformGetStaticProps: <TProps extends {
78
89
  [key: string]: any;
79
90
  } = {
80
91
  data: RootComponentInstance;
81
- }>(options?: RouteHandlerOptions<GetStaticPropsContext<ParsedUrlQuery, UniformPreviewData>, GetStaticPropsResult<never>, GetStaticPropsResult<TProps>> & {
92
+ } & NonNullable<Omit<CompositionMetadata, "compositionId">>>(options?: RouteHandlerOptions<GetStaticPropsContext<ParsedUrlQuery, UniformPreviewData>, GetStaticPropsResult<never>, GetStaticPropsResult<TProps>> & {
82
93
  /** Name of dynamic parameter coming from getStaticPath, usually specified in page file name (e.g. [...slug].jsx will have param = 'slug' */
83
94
  param?: string;
84
95
  }) => GetStaticProps<TProps, ParsedUrlQuery, UniformPreviewData>;
@@ -101,7 +112,7 @@ declare const prependLocale: (path: string, { locale, defaultLocale, locales }:
101
112
  */
102
113
  declare const getServerSideProps: next.GetServerSideProps<{
103
114
  data: _uniformdev_canvas.RootComponentInstance;
104
- }, querystring.ParsedUrlQuery, UniformPreviewData>;
115
+ } & Omit<_uniformdev_context__.CompositionMetadata, "compositionId">, querystring.ParsedUrlQuery, UniformPreviewData>;
105
116
  /**
106
117
  * Default implementation of getStaticProps with routes
107
118
  * To configure custom behavior, use:
@@ -109,7 +120,7 @@ declare const getServerSideProps: next.GetServerSideProps<{
109
120
  */
110
121
  declare const getStaticProps: next.GetStaticProps<{
111
122
  data: _uniformdev_canvas.RootComponentInstance;
112
- }, querystring.ParsedUrlQuery, UniformPreviewData>;
123
+ } & Omit<_uniformdev_context__.CompositionMetadata, "compositionId">, querystring.ParsedUrlQuery, UniformPreviewData>;
113
124
  /**
114
125
  * Default implementation of getStaticPaths with routes
115
126
  * To configure custom behavior, use:
@@ -122,4 +133,4 @@ declare const getStaticPaths: () => Promise<{
122
133
  fallback: boolean;
123
134
  }>;
124
135
 
125
- export { type HandleRouteCompositionFunction, type HandleRouteNotFoundFunction, type HandleRouteRedirectFunction, type RouteHandlerOptions, getServerSideProps, getStaticPaths, getStaticProps, prependLocale, withUniformGetServerSideProps, withUniformGetStaticPaths, withUniformGetStaticProps };
136
+ export { type HandleRouteCompositionFunction, type HandleRouteNotFoundFunction, type HandleRouteRedirectFunction, type RouteCompositionResult, type RouteHandlerOptions, getServerSideProps, getStaticPaths, getStaticProps, prependLocale, withUniformGetServerSideProps, withUniformGetStaticPaths, withUniformGetStaticProps };
@@ -3,8 +3,10 @@ import { GetServerSidePropsContext, GetServerSidePropsResult, GetServerSideProps
3
3
  import { a as UniformPreviewData } from '../models-CupnCqnn.js';
4
4
  import * as querystring from 'querystring';
5
5
  import { ParsedUrlQuery } from 'querystring';
6
+ import * as _uniformdev_context__ from '@uniformdev/context/*';
6
7
  import * as _uniformdev_canvas from '@uniformdev/canvas';
7
8
  import { RouteGetResponseEdgehancedComposition, RouteGetResponseNotFound, RouteGetResponseRedirect, RouteClient, RouteGetParameters, RootComponentInstance } from '@uniformdev/canvas';
9
+ import { CompositionMetadata } from '@uniformdev/context';
8
10
  import { ProjectMapNodeGetRequest, ProjectMapNodeGetResponse, ProjectMapClient } from '@uniformdev/project-map';
9
11
  import { RedirectClient } from '@uniformdev/redirect';
10
12
  import { GetStaticPropsContext as GetStaticPropsContext$1, GetServerSidePropsContext as GetServerSidePropsContext$1 } from 'next/types';
@@ -36,6 +38,15 @@ type RouteHandlerOptions<TContext, TResult, TSuccessResult> = {
36
38
  */
37
39
  handleNotFound?: HandleRouteNotFoundFunction<TContext, TResult>;
38
40
  };
41
+ /**
42
+ * Schema that comes out of route API handler in case of a composition route response.
43
+ * Should be used together as UniformAppProps<RouteCompositionResult> in Next.js app.
44
+ */
45
+ type RouteCompositionResult<TData = RootComponentInstance> = {
46
+ matchedRoute: string;
47
+ dynamicInputs: Record<string, string>;
48
+ data: TData;
49
+ };
39
50
 
40
51
  /**
41
52
  * Creates an implementation of `getServerSideProps` using the Uniform Route API.
@@ -46,7 +57,7 @@ declare const withUniformGetServerSideProps: <TProps extends {
46
57
  [key: string]: any;
47
58
  } = {
48
59
  data: RootComponentInstance;
49
- }>(options?: RouteHandlerOptions<GetServerSidePropsContext<ParsedUrlQuery, UniformPreviewData>, GetServerSidePropsResult<never>, GetServerSidePropsResult<TProps>>) => GetServerSideProps<TProps, ParsedUrlQuery, UniformPreviewData>;
60
+ } & NonNullable<Omit<CompositionMetadata, "compositionId">>>(options?: RouteHandlerOptions<GetServerSidePropsContext<ParsedUrlQuery, UniformPreviewData>, GetServerSidePropsResult<never>, GetServerSidePropsResult<TProps>>) => GetServerSideProps<TProps, ParsedUrlQuery, UniformPreviewData>;
50
61
 
51
62
  declare const withUniformGetStaticPaths: (options?: {
52
63
  projectMapId?: string;
@@ -78,7 +89,7 @@ declare const withUniformGetStaticProps: <TProps extends {
78
89
  [key: string]: any;
79
90
  } = {
80
91
  data: RootComponentInstance;
81
- }>(options?: RouteHandlerOptions<GetStaticPropsContext<ParsedUrlQuery, UniformPreviewData>, GetStaticPropsResult<never>, GetStaticPropsResult<TProps>> & {
92
+ } & NonNullable<Omit<CompositionMetadata, "compositionId">>>(options?: RouteHandlerOptions<GetStaticPropsContext<ParsedUrlQuery, UniformPreviewData>, GetStaticPropsResult<never>, GetStaticPropsResult<TProps>> & {
82
93
  /** Name of dynamic parameter coming from getStaticPath, usually specified in page file name (e.g. [...slug].jsx will have param = 'slug' */
83
94
  param?: string;
84
95
  }) => GetStaticProps<TProps, ParsedUrlQuery, UniformPreviewData>;
@@ -101,7 +112,7 @@ declare const prependLocale: (path: string, { locale, defaultLocale, locales }:
101
112
  */
102
113
  declare const getServerSideProps: next.GetServerSideProps<{
103
114
  data: _uniformdev_canvas.RootComponentInstance;
104
- }, querystring.ParsedUrlQuery, UniformPreviewData>;
115
+ } & Omit<_uniformdev_context__.CompositionMetadata, "compositionId">, querystring.ParsedUrlQuery, UniformPreviewData>;
105
116
  /**
106
117
  * Default implementation of getStaticProps with routes
107
118
  * To configure custom behavior, use:
@@ -109,7 +120,7 @@ declare const getServerSideProps: next.GetServerSideProps<{
109
120
  */
110
121
  declare const getStaticProps: next.GetStaticProps<{
111
122
  data: _uniformdev_canvas.RootComponentInstance;
112
- }, querystring.ParsedUrlQuery, UniformPreviewData>;
123
+ } & Omit<_uniformdev_context__.CompositionMetadata, "compositionId">, querystring.ParsedUrlQuery, UniformPreviewData>;
113
124
  /**
114
125
  * Default implementation of getStaticPaths with routes
115
126
  * To configure custom behavior, use:
@@ -122,4 +133,4 @@ declare const getStaticPaths: () => Promise<{
122
133
  fallback: boolean;
123
134
  }>;
124
135
 
125
- export { type HandleRouteCompositionFunction, type HandleRouteNotFoundFunction, type HandleRouteRedirectFunction, type RouteHandlerOptions, getServerSideProps, getStaticPaths, getStaticProps, prependLocale, withUniformGetServerSideProps, withUniformGetStaticPaths, withUniformGetStaticProps };
136
+ export { type HandleRouteCompositionFunction, type HandleRouteNotFoundFunction, type HandleRouteRedirectFunction, type RouteCompositionResult, type RouteHandlerOptions, getServerSideProps, getStaticPaths, getStaticProps, prependLocale, withUniformGetServerSideProps, withUniformGetStaticPaths, withUniformGetStaticProps };
@@ -267,6 +267,7 @@ function createRouteFetcher(options) {
267
267
  {
268
268
  type: "composition",
269
269
  matchedRoute: "contextual-editing",
270
+ dynamicInputs: {},
270
271
  compositionApiResponse: {
271
272
  composition: {
272
273
  ...import_canvas.EMPTY_COMPOSITION,
@@ -346,7 +347,9 @@ var withUniformGetServerSideProps = (options) => {
346
347
  const defaultHandleComposition = async (matched) => {
347
348
  return {
348
349
  props: {
349
- data: matched.compositionApiResponse.composition
350
+ data: matched.compositionApiResponse.composition,
351
+ matchedRoute: matched.matchedRoute,
352
+ dynamicInputs: matched.dynamicInputs
350
353
  }
351
354
  };
352
355
  };
@@ -453,7 +456,9 @@ var withUniformGetStaticProps = (options) => {
453
456
  const defaultHandleComposition = async (matched) => {
454
457
  return {
455
458
  props: {
456
- data: matched.compositionApiResponse.composition
459
+ data: matched.compositionApiResponse.composition,
460
+ matchedRoute: matched.matchedRoute,
461
+ dynamicInputs: matched.dynamicInputs
457
462
  }
458
463
  };
459
464
  };
@@ -145,6 +145,7 @@ function createRouteFetcher(options) {
145
145
  {
146
146
  type: "composition",
147
147
  matchedRoute: "contextual-editing",
148
+ dynamicInputs: {},
148
149
  compositionApiResponse: {
149
150
  composition: {
150
151
  ...EMPTY_COMPOSITION,
@@ -224,7 +225,9 @@ var withUniformGetServerSideProps = (options) => {
224
225
  const defaultHandleComposition = async (matched) => {
225
226
  return {
226
227
  props: {
227
- data: matched.compositionApiResponse.composition
228
+ data: matched.compositionApiResponse.composition,
229
+ matchedRoute: matched.matchedRoute,
230
+ dynamicInputs: matched.dynamicInputs
228
231
  }
229
232
  };
230
233
  };
@@ -321,7 +324,9 @@ var withUniformGetStaticProps = (options) => {
321
324
  const defaultHandleComposition = async (matched) => {
322
325
  return {
323
326
  props: {
324
- data: matched.compositionApiResponse.composition
327
+ data: matched.compositionApiResponse.composition,
328
+ matchedRoute: matched.matchedRoute,
329
+ dynamicInputs: matched.dynamicInputs
325
330
  }
326
331
  };
327
332
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/canvas-next",
3
- "version": "20.35.0",
3
+ "version": "20.35.1-alpha.210+4fa236da76",
4
4
  "description": "Next.js SDK for Uniform Canvas",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "main": "./dist/index.js",
@@ -67,11 +67,12 @@
67
67
  "document:prebuild": "api-extractor run --local"
68
68
  },
69
69
  "dependencies": {
70
- "@uniformdev/canvas": "20.35.0",
71
- "@uniformdev/canvas-react": "20.35.0",
72
- "@uniformdev/project-map": "20.35.0",
73
- "@uniformdev/redirect": "20.35.0",
74
- "@uniformdev/richtext": "20.35.0",
70
+ "@uniformdev/canvas": "20.35.1-alpha.210+4fa236da76",
71
+ "@uniformdev/canvas-react": "20.35.1-alpha.210+4fa236da76",
72
+ "@uniformdev/context": "20.35.1-alpha.210+4fa236da76",
73
+ "@uniformdev/project-map": "20.35.1-alpha.210+4fa236da76",
74
+ "@uniformdev/redirect": "20.35.1-alpha.210+4fa236da76",
75
+ "@uniformdev/richtext": "20.35.1-alpha.210+4fa236da76",
75
76
  "colorette": "2.0.20"
76
77
  },
77
78
  "peerDependencies": {
@@ -80,10 +81,10 @@
80
81
  "react-dom": ">=16"
81
82
  },
82
83
  "devDependencies": {
83
- "@types/react": "18.3.24",
84
- "next": "14.2.32",
85
- "react": "18.3.1",
86
- "react-dom": "18.3.1"
84
+ "@types/react": "19.2.2",
85
+ "next": "16.0.7",
86
+ "react": "19.2.1",
87
+ "react-dom": "19.2.1"
87
88
  },
88
89
  "files": [
89
90
  "/dist"
@@ -91,5 +92,5 @@
91
92
  "publishConfig": {
92
93
  "access": "public"
93
94
  },
94
- "gitHead": "f228361828ef49a596ca3841e5b79768c64418cf"
95
+ "gitHead": "4fa236da76e057582eae6c2595a2fa763fda886a"
95
96
  }