@uniformdev/canvas-next 19.35.2 → 19.36.0
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 +50 -0
- package/dist/project-map/index.d.mts +88 -0
- package/dist/route/index.d.mts +322 -0
- package/dist/slug/index.d.mts +99 -0
- package/package.json +7 -7
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { RichTextRendererComponent, RenderRichTextComponentResolver, UniformRichText as UniformRichText$1, UniformRichTextNode as UniformRichTextNode$1 } from '@uniformdev/canvas-react';
|
|
2
|
+
import { ParsedUrlQuery } from 'querystring';
|
|
3
|
+
export { U as UniformCompositionNextPage, c as UniformGetServerSideProps, b as UniformGetStaticProps, a as UniformPreviewData } from './models-092c0912.js';
|
|
4
|
+
import { NextApiHandler, NextApiRequest } from 'next';
|
|
5
|
+
import { RootComponentInstance } from '@uniformdev/canvas';
|
|
6
|
+
|
|
7
|
+
declare const NextLinkRichTextNode: RichTextRendererComponent;
|
|
8
|
+
declare function useResolveNextRichTextRenderer(resolveRichTextRenderer?: RenderRichTextComponentResolver): RenderRichTextComponentResolver;
|
|
9
|
+
declare const UniformRichText: typeof UniformRichText$1;
|
|
10
|
+
declare const UniformRichTextNode: typeof UniformRichTextNode$1;
|
|
11
|
+
|
|
12
|
+
declare const resolveSlugFromParams: ({ param, params, }: {
|
|
13
|
+
param: string | undefined;
|
|
14
|
+
params: ParsedUrlQuery | undefined;
|
|
15
|
+
}) => string;
|
|
16
|
+
|
|
17
|
+
type ResolveFullPath = (options: {
|
|
18
|
+
/** The ID of the composition */
|
|
19
|
+
id?: string;
|
|
20
|
+
/** The slug of the composition */
|
|
21
|
+
slug?: string;
|
|
22
|
+
/** The path of the project map node attached to the composition, if there is one */
|
|
23
|
+
path?: string;
|
|
24
|
+
/** The preview locale selected in Visual Canvas, available only if Localization is set up */
|
|
25
|
+
locale?: string;
|
|
26
|
+
}) => string | undefined;
|
|
27
|
+
type CreatePreviewHandlerGetOptions = {
|
|
28
|
+
secret?: () => string;
|
|
29
|
+
/**
|
|
30
|
+
* Should return the full path to redirect to. Will respond with `400` error if `undefined` is returned.
|
|
31
|
+
* defaults to a function that returns the `path` if truthy, otherwise returns `slug`.
|
|
32
|
+
*/
|
|
33
|
+
resolveFullPath?: ResolveFullPath;
|
|
34
|
+
};
|
|
35
|
+
type CreatePreviewHandlerGet = (options?: CreatePreviewHandlerGetOptions) => NextApiHandler;
|
|
36
|
+
declare const createPreviewHandlerGet: CreatePreviewHandlerGet;
|
|
37
|
+
|
|
38
|
+
type CreatePreviewHandlerPostOptions = {
|
|
39
|
+
secret?: () => string;
|
|
40
|
+
enhance?: (composition: RootComponentInstance, context: {
|
|
41
|
+
req: NextApiRequest;
|
|
42
|
+
}) => Promise<void>;
|
|
43
|
+
};
|
|
44
|
+
type CreatePreviewHandlerPost = (options?: CreatePreviewHandlerPostOptions) => NextApiHandler;
|
|
45
|
+
declare const createPreviewHandlerPost: CreatePreviewHandlerPost;
|
|
46
|
+
|
|
47
|
+
type CreatePreviewHandler = (options?: CreatePreviewHandlerGetOptions & CreatePreviewHandlerPostOptions) => NextApiHandler;
|
|
48
|
+
declare const createPreviewHandler: CreatePreviewHandler;
|
|
49
|
+
|
|
50
|
+
export { CreatePreviewHandler, CreatePreviewHandlerGet, CreatePreviewHandlerGetOptions, CreatePreviewHandlerPost, CreatePreviewHandlerPostOptions, NextLinkRichTextNode, ResolveFullPath, UniformRichText, UniformRichTextNode, createPreviewHandler, createPreviewHandlerGet, createPreviewHandlerPost, resolveSlugFromParams, useResolveNextRichTextRenderer };
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import * as next from 'next';
|
|
2
|
+
import { GetServerSidePropsContext, PreviewData, GetServerSideProps, GetStaticPropsContext, GetStaticProps } from 'next';
|
|
3
|
+
import { c as UniformGetServerSideProps, a as UniformPreviewData, b as UniformGetStaticProps } from '../models-092c0912.js';
|
|
4
|
+
import * as querystring from 'querystring';
|
|
5
|
+
import { ParsedUrlQuery } from 'querystring';
|
|
6
|
+
import * as _uniformdev_canvas from '@uniformdev/canvas';
|
|
7
|
+
import { CanvasClient, DataResolutionOption } from '@uniformdev/canvas';
|
|
8
|
+
export { w as withUniformGetStaticPaths } from '../withUniformGetStaticPaths-6a31a8f8.js';
|
|
9
|
+
import '@uniformdev/canvas-react';
|
|
10
|
+
import '@uniformdev/project-map';
|
|
11
|
+
|
|
12
|
+
declare const withUniformGetServerSideProps: <TProps extends {
|
|
13
|
+
[key: string]: any;
|
|
14
|
+
} = {
|
|
15
|
+
[key: string]: any;
|
|
16
|
+
}>(options?: {
|
|
17
|
+
/** If you need to override the default client, you can pass it here */
|
|
18
|
+
client?: CanvasClient | undefined;
|
|
19
|
+
/** A string that you want to strip from the resolved context.resolvedUrl. Useful when calling from a nested folder which is not part of your project map structure */
|
|
20
|
+
prefix?: string | undefined;
|
|
21
|
+
/** Useful when you need to modify the path passed to the API */
|
|
22
|
+
modifyPath?: ((path: string, context: GetServerSidePropsContext<ParsedUrlQuery, PreviewData>) => string) | undefined;
|
|
23
|
+
/** Set to true if you want to include draft compositions */
|
|
24
|
+
preview?: boolean | undefined;
|
|
25
|
+
projectMapId?: string | undefined;
|
|
26
|
+
/** Way to override getCompositionByNodePath request params */
|
|
27
|
+
requestOptions?: Omit<Partial<{
|
|
28
|
+
versionId?: string | undefined;
|
|
29
|
+
skipEnhance?: boolean | undefined;
|
|
30
|
+
skipPatternResolution?: boolean | undefined;
|
|
31
|
+
skipOverridesResolution?: boolean | undefined;
|
|
32
|
+
state?: number | undefined;
|
|
33
|
+
withComponentIDs?: boolean | undefined;
|
|
34
|
+
withTotalCount?: boolean | undefined;
|
|
35
|
+
withUIStatus?: boolean | undefined;
|
|
36
|
+
withContentSourceMap?: boolean | undefined;
|
|
37
|
+
} & Required<Pick<_uniformdev_canvas.CompositionGetParameters, "projectMapNodePath">> & _uniformdev_canvas.SpecificProjectMap & DataResolutionOption>, "state"> | undefined;
|
|
38
|
+
/** Custom handler to specify return value and modify composition - e.g. enhance with CMS data */
|
|
39
|
+
callback?: UniformGetServerSideProps<TProps> | undefined;
|
|
40
|
+
/** Disables logging of response information and timings */
|
|
41
|
+
silent?: boolean | undefined;
|
|
42
|
+
} | undefined) => GetServerSideProps<TProps, ParsedUrlQuery, UniformPreviewData>;
|
|
43
|
+
|
|
44
|
+
declare const withUniformGetStaticProps: <TProps extends {
|
|
45
|
+
[key: string]: any;
|
|
46
|
+
} = {
|
|
47
|
+
[key: string]: any;
|
|
48
|
+
}>(options: {
|
|
49
|
+
projectMapId?: string | undefined;
|
|
50
|
+
/** Name of dynamic parameter coming from getStaticPath, usually specified in page file name (e.g. [...slug].jsx will have param = 'slug' */
|
|
51
|
+
param: string;
|
|
52
|
+
/** Useful when you need to modify the path passed to the API */
|
|
53
|
+
modifyPath?: ((path: string, context: GetStaticPropsContext<ParsedUrlQuery, UniformPreviewData>) => string) | undefined;
|
|
54
|
+
/** Set to true if you want to include draft compositions */
|
|
55
|
+
preview?: boolean | undefined;
|
|
56
|
+
/** If you need to override the default client, you can pass it here */
|
|
57
|
+
client?: CanvasClient | undefined;
|
|
58
|
+
/** Way to override getCompositionByNodePath request params */
|
|
59
|
+
requestOptions?: Omit<Partial<{
|
|
60
|
+
versionId?: string | undefined;
|
|
61
|
+
skipEnhance?: boolean | undefined;
|
|
62
|
+
skipPatternResolution?: boolean | undefined;
|
|
63
|
+
skipOverridesResolution?: boolean | undefined;
|
|
64
|
+
state?: number | undefined;
|
|
65
|
+
withComponentIDs?: boolean | undefined;
|
|
66
|
+
withTotalCount?: boolean | undefined;
|
|
67
|
+
withUIStatus?: boolean | undefined;
|
|
68
|
+
withContentSourceMap?: boolean | undefined;
|
|
69
|
+
} & Required<Pick<_uniformdev_canvas.CompositionGetParameters, "projectMapNodePath">> & _uniformdev_canvas.SpecificProjectMap & DataResolutionOption>, "state"> | undefined;
|
|
70
|
+
/** Custom handler to specify return value and modify composition - e.g. enhance with CMS data */
|
|
71
|
+
callback?: UniformGetStaticProps<TProps> | undefined;
|
|
72
|
+
/** Disables logging of response information and timings */
|
|
73
|
+
silent?: boolean | undefined;
|
|
74
|
+
}) => GetStaticProps<TProps, ParsedUrlQuery, UniformPreviewData>;
|
|
75
|
+
|
|
76
|
+
declare const getServerSideProps: next.GetServerSideProps<{
|
|
77
|
+
[key: string]: any;
|
|
78
|
+
}, querystring.ParsedUrlQuery, UniformPreviewData>;
|
|
79
|
+
/** Ready to go getStaticProps for dynamic route with 'path' param for [[...path]].jsx */
|
|
80
|
+
declare const getStaticProps: next.GetStaticProps<{
|
|
81
|
+
[key: string]: any;
|
|
82
|
+
}, querystring.ParsedUrlQuery, UniformPreviewData>;
|
|
83
|
+
declare const getStaticPaths: () => Promise<{
|
|
84
|
+
paths: string[] | undefined;
|
|
85
|
+
fallback: boolean;
|
|
86
|
+
}>;
|
|
87
|
+
|
|
88
|
+
export { getServerSideProps, getStaticPaths, getStaticProps, withUniformGetServerSideProps, withUniformGetStaticProps };
|
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
import * as next from 'next';
|
|
2
|
+
import { GetServerSidePropsContext, GetServerSidePropsResult, GetServerSideProps, GetStaticPropsContext, GetStaticPropsResult, GetStaticProps } from 'next';
|
|
3
|
+
import { a as UniformPreviewData } from '../models-092c0912.js';
|
|
4
|
+
import * as querystring from 'querystring';
|
|
5
|
+
import { ParsedUrlQuery } from 'querystring';
|
|
6
|
+
export { w as withUniformGetStaticPaths } from '../withUniformGetStaticPaths-6a31a8f8.js';
|
|
7
|
+
import { RouteGetResponseEdgehancedComposition, RouteGetResponseNotFound, RouteGetResponseRedirect, RouteClient, RouteGetParameters, RootComponentInstance } from '@uniformdev/canvas';
|
|
8
|
+
import '@uniformdev/canvas-react';
|
|
9
|
+
import '@uniformdev/project-map';
|
|
10
|
+
|
|
11
|
+
type HandleRouteCompositionFunction<TContext, TResult> = (composition: RouteGetResponseEdgehancedComposition, context: TContext, defaultHandler: (composition: RouteGetResponseEdgehancedComposition) => Promise<TResult | null> | TResult | null, duration: number) => Promise<TResult | null> | TResult | null;
|
|
12
|
+
type HandleRouteNotFoundFunction<TContext, TResult> = (result: RouteGetResponseNotFound, context: TContext, defaultHandler: (result: RouteGetResponseNotFound) => TResult, duration: number) => TResult;
|
|
13
|
+
type HandleRouteRedirectFunction<TContext, TResult> = (requestUrl: string, redirect: RouteGetResponseRedirect, context: TContext, defaultHandler: (redirect: RouteGetResponseRedirect) => TResult, duration: number) => TResult;
|
|
14
|
+
type RouteHandlerOptions<TContext, TResult, TSuccessResult> = {
|
|
15
|
+
/** If you need to override the default client, you can pass it here */
|
|
16
|
+
client?: RouteClient;
|
|
17
|
+
/** A string that you want to strip from the resolved context.resolvedUrl. Useful when calling from a nested folder which is not part of your project map structure */
|
|
18
|
+
prefix?: string;
|
|
19
|
+
/** Useful when you need to modify the path passed to the API */
|
|
20
|
+
modifyPath?: (path: string, context: TContext) => string;
|
|
21
|
+
/** The project map ID to connect to. If not set, the default project map for the configured project will be used. */
|
|
22
|
+
projectMapId?: string;
|
|
23
|
+
/** Way to override getRoute request params. Can also be a function to compute options based on context values. */
|
|
24
|
+
requestOptions?: Partial<RouteGetParameters> | ((context: TContext) => Partial<RouteGetParameters>);
|
|
25
|
+
/** Disables logging of response information and timings */
|
|
26
|
+
silent?: boolean;
|
|
27
|
+
/** Override handling of a composition route response. Return null to signal not found. */
|
|
28
|
+
handleComposition?: HandleRouteCompositionFunction<TContext, TSuccessResult>;
|
|
29
|
+
/** Override default handling of a redirect route response */
|
|
30
|
+
handleRedirect?: HandleRouteRedirectFunction<TContext, TResult>;
|
|
31
|
+
/**
|
|
32
|
+
* Override default handling of a not found route response
|
|
33
|
+
* NOTE: not called when the API returns a 404 error (project map not found), only when the route result is not found
|
|
34
|
+
*/
|
|
35
|
+
handleNotFound?: HandleRouteNotFoundFunction<TContext, TResult>;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Creates an implementation of `getServerSideProps` using the Uniform Route API.
|
|
40
|
+
* Static and dynamic routing as well as redirection is automatically supported.
|
|
41
|
+
* Custom behavior can be added by passing in options to hook to specific processing events.
|
|
42
|
+
*/
|
|
43
|
+
declare const withUniformGetServerSideProps: <TProps extends {
|
|
44
|
+
[key: string]: any;
|
|
45
|
+
} = {
|
|
46
|
+
data: RootComponentInstance;
|
|
47
|
+
}>(options?: RouteHandlerOptions<GetServerSidePropsContext<ParsedUrlQuery, UniformPreviewData>, GetServerSidePropsResult<never>, GetServerSidePropsResult<TProps>> | undefined) => GetServerSideProps<TProps, ParsedUrlQuery, UniformPreviewData>;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Creates an implementation of `getStaticProps` using the Uniform Route API.
|
|
51
|
+
* Static and dynamic routing as well as redirection is automatically supported.
|
|
52
|
+
* Custom behavior can be added by passing in options to hook to specific processing events.
|
|
53
|
+
*/
|
|
54
|
+
declare const withUniformGetStaticProps: <TProps extends {
|
|
55
|
+
[key: string]: any;
|
|
56
|
+
} = {
|
|
57
|
+
data: RootComponentInstance;
|
|
58
|
+
}>(options?: (RouteHandlerOptions<GetStaticPropsContext<ParsedUrlQuery, UniformPreviewData>, GetStaticPropsResult<never>, GetStaticPropsResult<TProps>> & {
|
|
59
|
+
/** Name of dynamic parameter coming from getStaticPath, usually specified in page file name (e.g. [...slug].jsx will have param = 'slug' */
|
|
60
|
+
param?: string | undefined;
|
|
61
|
+
}) | undefined) => GetStaticProps<TProps, ParsedUrlQuery, UniformPreviewData>;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Default implementation of getServerSideProps with routes
|
|
65
|
+
* To configure custom behavior, use:
|
|
66
|
+
* export getServerSideProps = withUniformGetServerSideProps({ ... });
|
|
67
|
+
*/
|
|
68
|
+
declare const getServerSideProps: next.GetServerSideProps<{
|
|
69
|
+
data: {
|
|
70
|
+
type: string;
|
|
71
|
+
parameters?: {
|
|
72
|
+
[key: string]: {
|
|
73
|
+
value: unknown;
|
|
74
|
+
type: string;
|
|
75
|
+
connectedData?: {
|
|
76
|
+
pointer: string;
|
|
77
|
+
syntax: "jptr";
|
|
78
|
+
} | undefined;
|
|
79
|
+
};
|
|
80
|
+
} | undefined;
|
|
81
|
+
variant?: string | undefined;
|
|
82
|
+
projectMapNodes?: {
|
|
83
|
+
id: string;
|
|
84
|
+
path: string;
|
|
85
|
+
projectMapId: string;
|
|
86
|
+
}[] | undefined;
|
|
87
|
+
slots?: {
|
|
88
|
+
[key: string]: {
|
|
89
|
+
type: string;
|
|
90
|
+
parameters?: {
|
|
91
|
+
[key: string]: {
|
|
92
|
+
value: unknown;
|
|
93
|
+
type: string;
|
|
94
|
+
connectedData?: {
|
|
95
|
+
pointer: string;
|
|
96
|
+
syntax: "jptr";
|
|
97
|
+
} | undefined;
|
|
98
|
+
};
|
|
99
|
+
} | undefined;
|
|
100
|
+
variant?: string | undefined;
|
|
101
|
+
slots?: {
|
|
102
|
+
[key: string]: any[];
|
|
103
|
+
} | undefined;
|
|
104
|
+
_id?: string | undefined;
|
|
105
|
+
_pattern?: string | undefined;
|
|
106
|
+
_dataResources?: {
|
|
107
|
+
[key: string]: {
|
|
108
|
+
type: string;
|
|
109
|
+
isPatternParameter?: boolean | undefined;
|
|
110
|
+
ignorePatternParameterDefault?: boolean | undefined;
|
|
111
|
+
variables?: {
|
|
112
|
+
[key: string]: string;
|
|
113
|
+
} | undefined;
|
|
114
|
+
};
|
|
115
|
+
} | undefined;
|
|
116
|
+
_patternDataResources?: {
|
|
117
|
+
[key: string]: {
|
|
118
|
+
type: string;
|
|
119
|
+
isPatternParameter?: boolean | undefined;
|
|
120
|
+
ignorePatternParameterDefault?: boolean | undefined;
|
|
121
|
+
variables?: {
|
|
122
|
+
[key: string]: string;
|
|
123
|
+
} | undefined;
|
|
124
|
+
};
|
|
125
|
+
} | undefined;
|
|
126
|
+
_patternError?: "NOTFOUND" | "CYCLIC" | undefined;
|
|
127
|
+
_overrides?: {
|
|
128
|
+
[key: string]: {
|
|
129
|
+
parameters?: {
|
|
130
|
+
[key: string]: {
|
|
131
|
+
value: unknown;
|
|
132
|
+
type: string;
|
|
133
|
+
connectedData?: {
|
|
134
|
+
pointer: string;
|
|
135
|
+
syntax: "jptr";
|
|
136
|
+
} | undefined;
|
|
137
|
+
};
|
|
138
|
+
} | undefined;
|
|
139
|
+
variant?: string | undefined;
|
|
140
|
+
};
|
|
141
|
+
} | undefined;
|
|
142
|
+
_overridability?: {
|
|
143
|
+
parameters?: {
|
|
144
|
+
[key: string]: "no" | "yes";
|
|
145
|
+
} | undefined;
|
|
146
|
+
variants?: boolean | undefined;
|
|
147
|
+
} | undefined;
|
|
148
|
+
}[];
|
|
149
|
+
} | undefined;
|
|
150
|
+
_id: string;
|
|
151
|
+
_slug?: string | null | undefined;
|
|
152
|
+
_name: string;
|
|
153
|
+
_dataResources?: {
|
|
154
|
+
[key: string]: {
|
|
155
|
+
type: string;
|
|
156
|
+
isPatternParameter?: boolean | undefined;
|
|
157
|
+
ignorePatternParameterDefault?: boolean | undefined;
|
|
158
|
+
variables?: {
|
|
159
|
+
[key: string]: string;
|
|
160
|
+
} | undefined;
|
|
161
|
+
};
|
|
162
|
+
} | undefined;
|
|
163
|
+
_overrides?: {
|
|
164
|
+
[key: string]: {
|
|
165
|
+
parameters?: {
|
|
166
|
+
[key: string]: {
|
|
167
|
+
value: unknown;
|
|
168
|
+
type: string;
|
|
169
|
+
connectedData?: {
|
|
170
|
+
pointer: string;
|
|
171
|
+
syntax: "jptr";
|
|
172
|
+
} | undefined;
|
|
173
|
+
};
|
|
174
|
+
} | undefined;
|
|
175
|
+
variant?: string | undefined;
|
|
176
|
+
};
|
|
177
|
+
} | undefined;
|
|
178
|
+
_overridability?: {
|
|
179
|
+
parameters?: {
|
|
180
|
+
[key: string]: "no" | "yes";
|
|
181
|
+
} | undefined;
|
|
182
|
+
variants?: boolean | undefined;
|
|
183
|
+
} | undefined;
|
|
184
|
+
};
|
|
185
|
+
}, querystring.ParsedUrlQuery, UniformPreviewData>;
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Default implementation of getStaticProps with routes
|
|
189
|
+
* To configure custom behavior, use:
|
|
190
|
+
* export getStaticProps = withUniformGetStaticProps({ ... });
|
|
191
|
+
*/
|
|
192
|
+
declare const getStaticProps: next.GetStaticProps<{
|
|
193
|
+
data: {
|
|
194
|
+
type: string;
|
|
195
|
+
parameters?: {
|
|
196
|
+
[key: string]: {
|
|
197
|
+
value: unknown;
|
|
198
|
+
type: string;
|
|
199
|
+
connectedData?: {
|
|
200
|
+
pointer: string;
|
|
201
|
+
syntax: "jptr";
|
|
202
|
+
} | undefined;
|
|
203
|
+
};
|
|
204
|
+
} | undefined;
|
|
205
|
+
variant?: string | undefined;
|
|
206
|
+
projectMapNodes?: {
|
|
207
|
+
id: string;
|
|
208
|
+
path: string;
|
|
209
|
+
projectMapId: string;
|
|
210
|
+
}[] | undefined;
|
|
211
|
+
slots?: {
|
|
212
|
+
[key: string]: {
|
|
213
|
+
type: string;
|
|
214
|
+
parameters?: {
|
|
215
|
+
[key: string]: {
|
|
216
|
+
value: unknown;
|
|
217
|
+
type: string;
|
|
218
|
+
connectedData?: {
|
|
219
|
+
pointer: string;
|
|
220
|
+
syntax: "jptr";
|
|
221
|
+
} | undefined;
|
|
222
|
+
};
|
|
223
|
+
} | undefined;
|
|
224
|
+
variant?: string | undefined;
|
|
225
|
+
slots?: {
|
|
226
|
+
[key: string]: any[];
|
|
227
|
+
} | undefined;
|
|
228
|
+
_id?: string | undefined;
|
|
229
|
+
_pattern?: string | undefined;
|
|
230
|
+
_dataResources?: {
|
|
231
|
+
[key: string]: {
|
|
232
|
+
type: string;
|
|
233
|
+
isPatternParameter?: boolean | undefined;
|
|
234
|
+
ignorePatternParameterDefault?: boolean | undefined;
|
|
235
|
+
variables?: {
|
|
236
|
+
[key: string]: string;
|
|
237
|
+
} | undefined;
|
|
238
|
+
};
|
|
239
|
+
} | undefined;
|
|
240
|
+
_patternDataResources?: {
|
|
241
|
+
[key: string]: {
|
|
242
|
+
type: string;
|
|
243
|
+
isPatternParameter?: boolean | undefined;
|
|
244
|
+
ignorePatternParameterDefault?: boolean | undefined;
|
|
245
|
+
variables?: {
|
|
246
|
+
[key: string]: string;
|
|
247
|
+
} | undefined;
|
|
248
|
+
};
|
|
249
|
+
} | undefined;
|
|
250
|
+
_patternError?: "NOTFOUND" | "CYCLIC" | undefined;
|
|
251
|
+
_overrides?: {
|
|
252
|
+
[key: string]: {
|
|
253
|
+
parameters?: {
|
|
254
|
+
[key: string]: {
|
|
255
|
+
value: unknown;
|
|
256
|
+
type: string;
|
|
257
|
+
connectedData?: {
|
|
258
|
+
pointer: string;
|
|
259
|
+
syntax: "jptr";
|
|
260
|
+
} | undefined;
|
|
261
|
+
};
|
|
262
|
+
} | undefined;
|
|
263
|
+
variant?: string | undefined;
|
|
264
|
+
};
|
|
265
|
+
} | undefined;
|
|
266
|
+
_overridability?: {
|
|
267
|
+
parameters?: {
|
|
268
|
+
[key: string]: "no" | "yes";
|
|
269
|
+
} | undefined;
|
|
270
|
+
variants?: boolean | undefined;
|
|
271
|
+
} | undefined;
|
|
272
|
+
}[];
|
|
273
|
+
} | undefined;
|
|
274
|
+
_id: string;
|
|
275
|
+
_slug?: string | null | undefined;
|
|
276
|
+
_name: string;
|
|
277
|
+
_dataResources?: {
|
|
278
|
+
[key: string]: {
|
|
279
|
+
type: string;
|
|
280
|
+
isPatternParameter?: boolean | undefined;
|
|
281
|
+
ignorePatternParameterDefault?: boolean | undefined;
|
|
282
|
+
variables?: {
|
|
283
|
+
[key: string]: string;
|
|
284
|
+
} | undefined;
|
|
285
|
+
};
|
|
286
|
+
} | undefined;
|
|
287
|
+
_overrides?: {
|
|
288
|
+
[key: string]: {
|
|
289
|
+
parameters?: {
|
|
290
|
+
[key: string]: {
|
|
291
|
+
value: unknown;
|
|
292
|
+
type: string;
|
|
293
|
+
connectedData?: {
|
|
294
|
+
pointer: string;
|
|
295
|
+
syntax: "jptr";
|
|
296
|
+
} | undefined;
|
|
297
|
+
};
|
|
298
|
+
} | undefined;
|
|
299
|
+
variant?: string | undefined;
|
|
300
|
+
};
|
|
301
|
+
} | undefined;
|
|
302
|
+
_overridability?: {
|
|
303
|
+
parameters?: {
|
|
304
|
+
[key: string]: "no" | "yes";
|
|
305
|
+
} | undefined;
|
|
306
|
+
variants?: boolean | undefined;
|
|
307
|
+
} | undefined;
|
|
308
|
+
};
|
|
309
|
+
}, querystring.ParsedUrlQuery, UniformPreviewData>;
|
|
310
|
+
/**
|
|
311
|
+
* Default implementation of getStaticPaths with routes
|
|
312
|
+
* To configure custom behavior, use:
|
|
313
|
+
* export getStaticPaths = withUniformGetStaticProps({ ... });
|
|
314
|
+
*
|
|
315
|
+
* NOTE: fallback must be supported. You cannot generate static paths for dynamic routes which contain query parameters.
|
|
316
|
+
*/
|
|
317
|
+
declare const getStaticPaths: () => Promise<{
|
|
318
|
+
paths: string[] | undefined;
|
|
319
|
+
fallback: boolean;
|
|
320
|
+
}>;
|
|
321
|
+
|
|
322
|
+
export { HandleRouteCompositionFunction, HandleRouteNotFoundFunction, HandleRouteRedirectFunction, RouteHandlerOptions, getServerSideProps, getStaticPaths, getStaticProps, withUniformGetServerSideProps, withUniformGetStaticProps };
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import * as next from 'next';
|
|
2
|
+
import { GetServerSidePropsContext, GetServerSideProps, GetStaticPropsContext, GetStaticProps } from 'next';
|
|
3
|
+
import { a as UniformPreviewData, c as UniformGetServerSideProps, b as UniformGetStaticProps } from '../models-092c0912.js';
|
|
4
|
+
import * as querystring from 'querystring';
|
|
5
|
+
import { ParsedUrlQuery } from 'querystring';
|
|
6
|
+
import * as _uniformdev_canvas from '@uniformdev/canvas';
|
|
7
|
+
import { CanvasClient, DataResolutionOption, CompositionGetParameters, CompositionGetResponse } from '@uniformdev/canvas';
|
|
8
|
+
import '@uniformdev/canvas-react';
|
|
9
|
+
|
|
10
|
+
declare const withUniformGetServerSideProps: <TProps extends {
|
|
11
|
+
[key: string]: any;
|
|
12
|
+
} = {
|
|
13
|
+
[key: string]: any;
|
|
14
|
+
}>(options?: {
|
|
15
|
+
/** A string that you want to strip from the resolved context.resolvedUrl. Useful when calling from a nested folder which is not part of your slug structure */
|
|
16
|
+
prefix?: string | undefined;
|
|
17
|
+
/** Useful when you need to modify the slug passed to the API */
|
|
18
|
+
modifySlug?: ((slug: string, context: GetServerSidePropsContext<ParsedUrlQuery, UniformPreviewData>) => string) | undefined;
|
|
19
|
+
/** Set to true if you want to include draft compositions */
|
|
20
|
+
preview?: boolean | undefined;
|
|
21
|
+
/** If you need to override the default client, you can pass it here */
|
|
22
|
+
client?: CanvasClient | undefined;
|
|
23
|
+
requestOptions?: Omit<Partial<{
|
|
24
|
+
versionId?: string | undefined;
|
|
25
|
+
skipEnhance?: boolean | undefined;
|
|
26
|
+
skipPatternResolution?: boolean | undefined;
|
|
27
|
+
skipOverridesResolution?: boolean | undefined;
|
|
28
|
+
state?: number | undefined;
|
|
29
|
+
withComponentIDs?: boolean | undefined;
|
|
30
|
+
withTotalCount?: boolean | undefined;
|
|
31
|
+
withUIStatus?: boolean | undefined;
|
|
32
|
+
withContentSourceMap?: boolean | undefined;
|
|
33
|
+
} & Required<Pick<_uniformdev_canvas.CompositionGetParameters, "slug">> & DataResolutionOption>, "state"> | undefined;
|
|
34
|
+
callback?: UniformGetServerSideProps<TProps> | undefined;
|
|
35
|
+
/** Disables logging of response information and timings */
|
|
36
|
+
silent?: boolean | undefined;
|
|
37
|
+
} | undefined) => GetServerSideProps<TProps, ParsedUrlQuery, UniformPreviewData>;
|
|
38
|
+
|
|
39
|
+
declare const withUniformGetStaticPaths: (options?: {
|
|
40
|
+
projectMapId?: string | undefined;
|
|
41
|
+
/** A string that you want prepended to slugs returned by Canvas. Useful when calling from a nested folder which is not part of your slug structure */
|
|
42
|
+
prefix?: string | undefined;
|
|
43
|
+
/** Set to true if you want to include draft compositions */
|
|
44
|
+
preview?: boolean | undefined;
|
|
45
|
+
/** Way to override getCompositionList request params */
|
|
46
|
+
requestOptions?: Partial<CompositionGetParameters> | undefined;
|
|
47
|
+
/** Way to modify list of slugs before building array of paths */
|
|
48
|
+
callback?: ((compositions: CompositionGetResponse[]) => Promise<CompositionGetResponse[]>) | undefined;
|
|
49
|
+
/** If you need to override the default client, you can pass it here */
|
|
50
|
+
client?: CanvasClient | undefined;
|
|
51
|
+
} | undefined) => () => Promise<{
|
|
52
|
+
paths: string[];
|
|
53
|
+
fallback: boolean;
|
|
54
|
+
}>;
|
|
55
|
+
|
|
56
|
+
declare const withUniformGetStaticProps: <TProps extends {
|
|
57
|
+
[key: string]: any;
|
|
58
|
+
} = {
|
|
59
|
+
[key: string]: any;
|
|
60
|
+
}>(options: {
|
|
61
|
+
/** Name of dynamic parameter coming from getStaticPath, usually specified in page file name (e.g. [...slug].jsx will have param = 'slug' */
|
|
62
|
+
param: string;
|
|
63
|
+
/** Useful when you need to modify the slug passed to the API */
|
|
64
|
+
modifySlug?: ((slug: string, context: GetStaticPropsContext<ParsedUrlQuery, UniformPreviewData>) => string) | undefined;
|
|
65
|
+
/** Set to true if you want to include draft compositions */
|
|
66
|
+
preview?: boolean | undefined;
|
|
67
|
+
/** If you need to override the default client, you can pass it here */
|
|
68
|
+
client?: CanvasClient | undefined;
|
|
69
|
+
/** Way to override getCompositionBySlug request params */
|
|
70
|
+
requestOptions?: Omit<Partial<{
|
|
71
|
+
versionId?: string | undefined;
|
|
72
|
+
skipEnhance?: boolean | undefined;
|
|
73
|
+
skipPatternResolution?: boolean | undefined;
|
|
74
|
+
skipOverridesResolution?: boolean | undefined;
|
|
75
|
+
state?: number | undefined;
|
|
76
|
+
withComponentIDs?: boolean | undefined;
|
|
77
|
+
withTotalCount?: boolean | undefined;
|
|
78
|
+
withUIStatus?: boolean | undefined;
|
|
79
|
+
withContentSourceMap?: boolean | undefined;
|
|
80
|
+
} & Required<Pick<_uniformdev_canvas.CompositionGetParameters, "slug">> & DataResolutionOption>, "state"> | undefined;
|
|
81
|
+
/** Custom handler to specify return value and modify composition - e.g. enhance with CMS data */
|
|
82
|
+
callback?: UniformGetStaticProps<TProps> | undefined;
|
|
83
|
+
/** Disables logging of response information and timings */
|
|
84
|
+
silent?: boolean | undefined;
|
|
85
|
+
}) => GetStaticProps<TProps, ParsedUrlQuery, UniformPreviewData>;
|
|
86
|
+
|
|
87
|
+
declare const getServerSideProps: next.GetServerSideProps<{
|
|
88
|
+
[key: string]: any;
|
|
89
|
+
}, querystring.ParsedUrlQuery, UniformPreviewData>;
|
|
90
|
+
/** Ready to go getStaticProps for dynamic route with 'slug' param for [[...slug]].jsx */
|
|
91
|
+
declare const getStaticProps: next.GetStaticProps<{
|
|
92
|
+
[key: string]: any;
|
|
93
|
+
}, querystring.ParsedUrlQuery, UniformPreviewData>;
|
|
94
|
+
declare const getStaticPaths: () => Promise<{
|
|
95
|
+
paths: string[];
|
|
96
|
+
fallback: boolean;
|
|
97
|
+
}>;
|
|
98
|
+
|
|
99
|
+
export { getServerSideProps, getStaticPaths, getStaticProps, withUniformGetServerSideProps, withUniformGetStaticPaths, withUniformGetStaticProps };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/canvas-next",
|
|
3
|
-
"version": "19.
|
|
3
|
+
"version": "19.36.0",
|
|
4
4
|
"description": "Next.js SDK for Uniform Canvas",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -63,11 +63,11 @@
|
|
|
63
63
|
"document": "api-extractor run --local"
|
|
64
64
|
},
|
|
65
65
|
"dependencies": {
|
|
66
|
-
"@uniformdev/canvas": "19.
|
|
67
|
-
"@uniformdev/canvas-react": "19.
|
|
68
|
-
"@uniformdev/project-map": "19.
|
|
69
|
-
"@uniformdev/redirect": "19.
|
|
70
|
-
"@uniformdev/richtext": "19.
|
|
66
|
+
"@uniformdev/canvas": "19.36.0",
|
|
67
|
+
"@uniformdev/canvas-react": "19.36.0",
|
|
68
|
+
"@uniformdev/project-map": "19.36.0",
|
|
69
|
+
"@uniformdev/redirect": "19.36.0",
|
|
70
|
+
"@uniformdev/richtext": "19.36.0",
|
|
71
71
|
"colorette": "2.0.20"
|
|
72
72
|
},
|
|
73
73
|
"peerDependencies": {
|
|
@@ -87,5 +87,5 @@
|
|
|
87
87
|
"publishConfig": {
|
|
88
88
|
"access": "public"
|
|
89
89
|
},
|
|
90
|
-
"gitHead": "
|
|
90
|
+
"gitHead": "3ae246a7f0f39adeaf04ecba4c7e48c478c019ad"
|
|
91
91
|
}
|