@uniformdev/canvas-next 19.62.0 → 19.62.1-alpha.127

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.
@@ -1,12 +1,13 @@
1
1
  import * as next from 'next';
2
2
  import { GetServerSidePropsContext, GetServerSidePropsResult, GetServerSideProps, GetStaticPropsContext, GetStaticPropsResult, GetStaticProps } from 'next';
3
- import { a as UniformPreviewData } from '../models-f9fd03c4.js';
3
+ import { a as UniformPreviewData } from '../models-IAhm-va2.mjs';
4
4
  import * as querystring from 'querystring';
5
5
  import { ParsedUrlQuery } from 'querystring';
6
- export { w as withUniformGetStaticPaths } from '../withUniformGetStaticPaths-77db0164.js';
7
6
  import { RouteGetResponseEdgehancedComposition, RouteGetResponseNotFound, RouteGetResponseRedirect, RouteClient, RouteGetParameters, RootComponentInstance } from '@uniformdev/canvas';
7
+ import { ProjectMapNodeGetResponse, ProjectMapClient } from '@uniformdev/project-map';
8
+ import { RedirectClient } from '@uniformdev/redirect';
9
+ import { GetStaticPropsContext as GetStaticPropsContext$1, GetServerSidePropsContext as GetServerSidePropsContext$1 } from 'next/types';
8
10
  import '@uniformdev/canvas-react';
9
- import '@uniformdev/project-map';
10
11
 
11
12
  type HandleRouteCompositionFunction<TContext, TResult> = (composition: RouteGetResponseEdgehancedComposition, context: TContext, defaultHandler: (composition: RouteGetResponseEdgehancedComposition) => Promise<TResult | null> | TResult | null, duration: number) => Promise<TResult | null> | TResult | null;
12
13
  type HandleRouteNotFoundFunction<TContext, TResult> = (result: RouteGetResponseNotFound, context: TContext, defaultHandler: (result: RouteGetResponseNotFound) => TResult, duration: number) => TResult;
@@ -46,6 +47,45 @@ declare const withUniformGetServerSideProps: <TProps extends {
46
47
  data: RootComponentInstance;
47
48
  }>(options?: RouteHandlerOptions<GetServerSidePropsContext<ParsedUrlQuery, UniformPreviewData>, GetServerSidePropsResult<never>, GetServerSidePropsResult<TProps>> | undefined) => GetServerSideProps<TProps, ParsedUrlQuery, UniformPreviewData>;
48
49
 
50
+ declare const withUniformGetStaticPaths: (options?: {
51
+ projectMapId?: string | undefined;
52
+ /** Starting path to fetch nodes from */
53
+ rootPath?: string | undefined;
54
+ /** A string that you want prepended to paths returned by your project map. Useful when calling from a nested folder which is not part of your project map structure */
55
+ prefix?: string | undefined;
56
+ /** Set to true if you want to include draft compositions */
57
+ preview?: boolean | undefined;
58
+ /** Way to override getNodes request params */
59
+ requestOptions?: Partial<{
60
+ projectMapId?: string | undefined;
61
+ projectId: string;
62
+ releaseId?: string | undefined;
63
+ id?: string | undefined;
64
+ path?: string | undefined;
65
+ compositionId?: string | undefined;
66
+ limit?: number | undefined;
67
+ offset?: number | undefined;
68
+ depth?: number | undefined;
69
+ state?: number | undefined;
70
+ tree?: boolean | undefined;
71
+ search?: string | undefined;
72
+ includeAncestors?: boolean | undefined;
73
+ expanded?: boolean | undefined;
74
+ withCompositionData?: boolean | undefined;
75
+ withCompositionUIStatus?: boolean | undefined;
76
+ withRedirectData?: boolean | undefined;
77
+ }> | undefined;
78
+ /** Way to modify list of nodes before building array of paths */
79
+ callback?: ((nodes: ProjectMapNodeGetResponse['nodes']) => Promise<ProjectMapNodeGetResponse['nodes']>) | undefined;
80
+ /** If you need to override the default client, you can pass it here */
81
+ client?: ProjectMapClient | undefined;
82
+ /** If you need to override the default redirect client, you can pass it here */
83
+ redirectClient?: RedirectClient | undefined;
84
+ } | undefined) => () => Promise<{
85
+ paths: string[];
86
+ fallback: boolean;
87
+ }>;
88
+
49
89
  /**
50
90
  * Creates an implementation of `getStaticProps` using the Uniform Route API.
51
91
  * Static and dynamic routing as well as redirection is automatically supported.
@@ -60,6 +100,17 @@ declare const withUniformGetStaticProps: <TProps extends {
60
100
  param?: string | undefined;
61
101
  }) | undefined) => GetStaticProps<TProps, ParsedUrlQuery, UniformPreviewData>;
62
102
 
103
+ /**
104
+ * Prepends correct locale to the path before sending it to Uniform Route API.
105
+ *
106
+ * Recommended default callback for `options.modifyPath` in `withUniformGetStaticProps` and `withUniformGetServerSideProps`.
107
+ * Should be used together with Next.js Internationalization Routing.
108
+ *
109
+ * @see https://nextjs.org/docs/pages/building-your-application/routing/internationalization
110
+ * @see https://docs.uniform.app/docs/guides/composition/localization#enable-localization-on-your-frontend-application
111
+ */
112
+ declare const prependLocale: (path: string, { locale, defaultLocale, locales }: GetStaticPropsContext$1 | GetServerSidePropsContext$1) => string;
113
+
63
114
  /**
64
115
  * Default implementation of getServerSideProps with routes
65
116
  * To configure custom behavior, use:
@@ -70,11 +121,17 @@ declare const getServerSideProps: next.GetServerSideProps<{
70
121
  type: string;
71
122
  parameters?: {
72
123
  [key: string]: {
73
- value: unknown;
124
+ value?: unknown;
74
125
  type: string;
75
126
  connectedData?: {
76
127
  pointer: string;
77
128
  syntax: "jptr";
129
+ failureAction?: "t" | "p" | "c" | "a" | undefined;
130
+ failureLogLevel?: "e" | "w" | "i" | undefined;
131
+ failureDefault?: string | undefined;
132
+ } | undefined;
133
+ locales?: {
134
+ [key: string]: unknown;
78
135
  } | undefined;
79
136
  };
80
137
  } | undefined;
@@ -83,17 +140,38 @@ declare const getServerSideProps: next.GetServerSideProps<{
83
140
  id: string;
84
141
  path: string;
85
142
  projectMapId: string;
143
+ data?: {
144
+ isSearchHit?: boolean | undefined;
145
+ queryStrings?: {
146
+ name: string;
147
+ value?: string | undefined;
148
+ helpText?: string | undefined;
149
+ }[] | undefined;
150
+ previewValue?: string | undefined;
151
+ } | undefined;
152
+ locales?: {
153
+ [key: string]: {
154
+ path: string;
155
+ inherited: boolean;
156
+ };
157
+ } | undefined;
86
158
  }[] | undefined;
87
159
  slots?: {
88
160
  [key: string]: {
89
161
  type: string;
90
162
  parameters?: {
91
163
  [key: string]: {
92
- value: unknown;
164
+ value?: unknown;
93
165
  type: string;
94
166
  connectedData?: {
95
167
  pointer: string;
96
168
  syntax: "jptr";
169
+ failureAction?: "t" | "p" | "c" | "a" | undefined;
170
+ failureLogLevel?: "e" | "w" | "i" | undefined;
171
+ failureDefault?: string | undefined;
172
+ } | undefined;
173
+ locales?: {
174
+ [key: string]: unknown;
97
175
  } | undefined;
98
176
  };
99
177
  } | undefined;
@@ -128,28 +206,50 @@ declare const getServerSideProps: next.GetServerSideProps<{
128
206
  [key: string]: {
129
207
  parameters?: {
130
208
  [key: string]: {
131
- value: unknown;
209
+ value?: unknown;
132
210
  type: string;
133
211
  connectedData?: {
134
212
  pointer: string;
135
213
  syntax: "jptr";
214
+ failureAction?: "t" | "p" | "c" | "a" | undefined;
215
+ failureLogLevel?: "e" | "w" | "i" | undefined;
216
+ failureDefault?: string | undefined;
217
+ } | undefined;
218
+ locales?: {
219
+ [key: string]: unknown;
136
220
  } | undefined;
137
221
  };
138
222
  } | undefined;
223
+ slots?: {
224
+ [key: string]: any[];
225
+ } | undefined;
139
226
  variant?: string | undefined;
140
227
  };
141
228
  } | undefined;
142
229
  _overridability?: {
143
230
  parameters?: {
144
- [key: string]: "no" | "yes";
231
+ [key: string]: "yes" | "no";
145
232
  } | undefined;
146
233
  variants?: boolean | undefined;
234
+ hideLockedParameters?: boolean | undefined;
147
235
  } | undefined;
236
+ _locales?: string[] | undefined;
148
237
  }[];
149
238
  } | undefined;
150
239
  _id: string;
151
240
  _slug?: string | null | undefined;
152
241
  _name: string;
242
+ _pattern?: string | undefined;
243
+ _patternDataResources?: {
244
+ [key: string]: {
245
+ type: string;
246
+ isPatternParameter?: boolean | undefined;
247
+ ignorePatternParameterDefault?: boolean | undefined;
248
+ variables?: {
249
+ [key: string]: string;
250
+ } | undefined;
251
+ };
252
+ } | undefined;
153
253
  _dataResources?: {
154
254
  [key: string]: {
155
255
  type: string;
@@ -160,30 +260,41 @@ declare const getServerSideProps: next.GetServerSideProps<{
160
260
  } | undefined;
161
261
  };
162
262
  } | undefined;
263
+ _patternError?: "NOTFOUND" | "CYCLIC" | undefined;
163
264
  _overrides?: {
164
265
  [key: string]: {
165
266
  parameters?: {
166
267
  [key: string]: {
167
- value: unknown;
268
+ value?: unknown;
168
269
  type: string;
169
270
  connectedData?: {
170
271
  pointer: string;
171
272
  syntax: "jptr";
273
+ failureAction?: "t" | "p" | "c" | "a" | undefined;
274
+ failureLogLevel?: "e" | "w" | "i" | undefined;
275
+ failureDefault?: string | undefined;
276
+ } | undefined;
277
+ locales?: {
278
+ [key: string]: unknown;
172
279
  } | undefined;
173
280
  };
174
281
  } | undefined;
282
+ slots?: {
283
+ [key: string]: any[];
284
+ } | undefined;
175
285
  variant?: string | undefined;
176
286
  };
177
287
  } | undefined;
178
288
  _overridability?: {
179
289
  parameters?: {
180
- [key: string]: "no" | "yes";
290
+ [key: string]: "yes" | "no";
181
291
  } | undefined;
182
292
  variants?: boolean | undefined;
293
+ hideLockedParameters?: boolean | undefined;
183
294
  } | undefined;
295
+ _locales?: string[] | undefined;
184
296
  };
185
297
  }, querystring.ParsedUrlQuery, UniformPreviewData>;
186
-
187
298
  /**
188
299
  * Default implementation of getStaticProps with routes
189
300
  * To configure custom behavior, use:
@@ -194,11 +305,17 @@ declare const getStaticProps: next.GetStaticProps<{
194
305
  type: string;
195
306
  parameters?: {
196
307
  [key: string]: {
197
- value: unknown;
308
+ value?: unknown;
198
309
  type: string;
199
310
  connectedData?: {
200
311
  pointer: string;
201
312
  syntax: "jptr";
313
+ failureAction?: "t" | "p" | "c" | "a" | undefined;
314
+ failureLogLevel?: "e" | "w" | "i" | undefined;
315
+ failureDefault?: string | undefined;
316
+ } | undefined;
317
+ locales?: {
318
+ [key: string]: unknown;
202
319
  } | undefined;
203
320
  };
204
321
  } | undefined;
@@ -207,17 +324,38 @@ declare const getStaticProps: next.GetStaticProps<{
207
324
  id: string;
208
325
  path: string;
209
326
  projectMapId: string;
327
+ data?: {
328
+ isSearchHit?: boolean | undefined;
329
+ queryStrings?: {
330
+ name: string;
331
+ value?: string | undefined;
332
+ helpText?: string | undefined;
333
+ }[] | undefined;
334
+ previewValue?: string | undefined;
335
+ } | undefined;
336
+ locales?: {
337
+ [key: string]: {
338
+ path: string;
339
+ inherited: boolean;
340
+ };
341
+ } | undefined;
210
342
  }[] | undefined;
211
343
  slots?: {
212
344
  [key: string]: {
213
345
  type: string;
214
346
  parameters?: {
215
347
  [key: string]: {
216
- value: unknown;
348
+ value?: unknown;
217
349
  type: string;
218
350
  connectedData?: {
219
351
  pointer: string;
220
352
  syntax: "jptr";
353
+ failureAction?: "t" | "p" | "c" | "a" | undefined;
354
+ failureLogLevel?: "e" | "w" | "i" | undefined;
355
+ failureDefault?: string | undefined;
356
+ } | undefined;
357
+ locales?: {
358
+ [key: string]: unknown;
221
359
  } | undefined;
222
360
  };
223
361
  } | undefined;
@@ -252,28 +390,50 @@ declare const getStaticProps: next.GetStaticProps<{
252
390
  [key: string]: {
253
391
  parameters?: {
254
392
  [key: string]: {
255
- value: unknown;
393
+ value?: unknown;
256
394
  type: string;
257
395
  connectedData?: {
258
396
  pointer: string;
259
397
  syntax: "jptr";
398
+ failureAction?: "t" | "p" | "c" | "a" | undefined;
399
+ failureLogLevel?: "e" | "w" | "i" | undefined;
400
+ failureDefault?: string | undefined;
401
+ } | undefined;
402
+ locales?: {
403
+ [key: string]: unknown;
260
404
  } | undefined;
261
405
  };
262
406
  } | undefined;
407
+ slots?: {
408
+ [key: string]: any[];
409
+ } | undefined;
263
410
  variant?: string | undefined;
264
411
  };
265
412
  } | undefined;
266
413
  _overridability?: {
267
414
  parameters?: {
268
- [key: string]: "no" | "yes";
415
+ [key: string]: "yes" | "no";
269
416
  } | undefined;
270
417
  variants?: boolean | undefined;
418
+ hideLockedParameters?: boolean | undefined;
271
419
  } | undefined;
420
+ _locales?: string[] | undefined;
272
421
  }[];
273
422
  } | undefined;
274
423
  _id: string;
275
424
  _slug?: string | null | undefined;
276
425
  _name: string;
426
+ _pattern?: string | undefined;
427
+ _patternDataResources?: {
428
+ [key: string]: {
429
+ type: string;
430
+ isPatternParameter?: boolean | undefined;
431
+ ignorePatternParameterDefault?: boolean | undefined;
432
+ variables?: {
433
+ [key: string]: string;
434
+ } | undefined;
435
+ };
436
+ } | undefined;
277
437
  _dataResources?: {
278
438
  [key: string]: {
279
439
  type: string;
@@ -284,27 +444,39 @@ declare const getStaticProps: next.GetStaticProps<{
284
444
  } | undefined;
285
445
  };
286
446
  } | undefined;
447
+ _patternError?: "NOTFOUND" | "CYCLIC" | undefined;
287
448
  _overrides?: {
288
449
  [key: string]: {
289
450
  parameters?: {
290
451
  [key: string]: {
291
- value: unknown;
452
+ value?: unknown;
292
453
  type: string;
293
454
  connectedData?: {
294
455
  pointer: string;
295
456
  syntax: "jptr";
457
+ failureAction?: "t" | "p" | "c" | "a" | undefined;
458
+ failureLogLevel?: "e" | "w" | "i" | undefined;
459
+ failureDefault?: string | undefined;
460
+ } | undefined;
461
+ locales?: {
462
+ [key: string]: unknown;
296
463
  } | undefined;
297
464
  };
298
465
  } | undefined;
466
+ slots?: {
467
+ [key: string]: any[];
468
+ } | undefined;
299
469
  variant?: string | undefined;
300
470
  };
301
471
  } | undefined;
302
472
  _overridability?: {
303
473
  parameters?: {
304
- [key: string]: "no" | "yes";
474
+ [key: string]: "yes" | "no";
305
475
  } | undefined;
306
476
  variants?: boolean | undefined;
477
+ hideLockedParameters?: boolean | undefined;
307
478
  } | undefined;
479
+ _locales?: string[] | undefined;
308
480
  };
309
481
  }, querystring.ParsedUrlQuery, UniformPreviewData>;
310
482
  /**
@@ -315,8 +487,8 @@ declare const getStaticProps: next.GetStaticProps<{
315
487
  * NOTE: fallback must be supported. You cannot generate static paths for dynamic routes which contain query parameters.
316
488
  */
317
489
  declare const getStaticPaths: () => Promise<{
318
- paths: string[] | undefined;
490
+ paths: string[];
319
491
  fallback: boolean;
320
492
  }>;
321
493
 
322
- export { HandleRouteCompositionFunction, HandleRouteNotFoundFunction, HandleRouteRedirectFunction, RouteHandlerOptions, getServerSideProps, getStaticPaths, getStaticProps, withUniformGetServerSideProps, withUniformGetStaticProps };
494
+ export { type HandleRouteCompositionFunction, type HandleRouteNotFoundFunction, type HandleRouteRedirectFunction, type RouteHandlerOptions, getServerSideProps, getStaticPaths, getStaticProps, prependLocale, withUniformGetServerSideProps, withUniformGetStaticPaths, withUniformGetStaticProps };