@uniformdev/canvas-next 18.24.0 → 18.24.1-alpha.1
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/{chunk-SH3D2DYY.mjs → chunk-2MI7UYW7.mjs} +2 -3
- package/dist/index.d.ts +1 -2
- package/dist/index.esm.js +1 -1
- package/dist/index.js +2 -3
- package/dist/index.mjs +1 -1
- package/dist/project-map/index.d.ts +16 -14
- package/dist/project-map/index.js +12 -7
- package/dist/project-map/index.mjs +11 -5
- package/dist/slug/index.d.ts +14 -10
- package/dist/slug/index.js +22 -22
- package/dist/slug/index.mjs +11 -10
- package/package.json +5 -5
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
// src/helpers/slug.ts
|
|
2
2
|
var resolveSlugFromParams = ({
|
|
3
3
|
param = "slug",
|
|
4
|
-
params
|
|
5
|
-
prefix
|
|
4
|
+
params
|
|
6
5
|
}) => {
|
|
7
6
|
const slug = (params == null ? void 0 : params[param]) || "";
|
|
8
7
|
const slugString = Array.isArray(slug) ? slug.join("/") : slug;
|
|
9
|
-
return `/${slugString}
|
|
8
|
+
return `/${slugString}`;
|
|
10
9
|
};
|
|
11
10
|
|
|
12
11
|
export {
|
package/dist/index.d.ts
CHANGED
|
@@ -4,10 +4,9 @@ import { NextApiHandler, NextApiRequest } from 'next';
|
|
|
4
4
|
import { RootComponentInstance } from '@uniformdev/canvas';
|
|
5
5
|
import '@uniformdev/canvas-react';
|
|
6
6
|
|
|
7
|
-
declare const resolveSlugFromParams: ({ param, params,
|
|
7
|
+
declare const resolveSlugFromParams: ({ param, params, }: {
|
|
8
8
|
param: string | undefined;
|
|
9
9
|
params: ParsedUrlQuery | undefined;
|
|
10
|
-
prefix?: string | undefined;
|
|
11
10
|
}) => string;
|
|
12
11
|
|
|
13
12
|
type ResolveFullPath = (options: {
|
package/dist/index.esm.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -30,12 +30,11 @@ module.exports = __toCommonJS(src_exports);
|
|
|
30
30
|
// src/helpers/slug.ts
|
|
31
31
|
var resolveSlugFromParams = ({
|
|
32
32
|
param = "slug",
|
|
33
|
-
params
|
|
34
|
-
prefix
|
|
33
|
+
params
|
|
35
34
|
}) => {
|
|
36
35
|
const slug = (params == null ? void 0 : params[param]) || "";
|
|
37
36
|
const slugString = Array.isArray(slug) ? slug.join("/") : slug;
|
|
38
|
-
return `/${slugString}
|
|
37
|
+
return `/${slugString}`;
|
|
39
38
|
};
|
|
40
39
|
|
|
41
40
|
// src/preview/previewHandlerGet.ts
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { c as UniformGetServerSideProps,
|
|
1
|
+
import { c as UniformGetServerSideProps, a as UniformPreviewData, b as UniformGetStaticProps } from '../models-6ff72d91.js';
|
|
2
2
|
import * as next from 'next';
|
|
3
|
-
import { GetServerSideProps, GetStaticProps } from 'next';
|
|
3
|
+
import { GetServerSidePropsContext, PreviewData, GetServerSideProps, GetStaticPropsContext, GetStaticProps } from 'next';
|
|
4
4
|
import * as querystring from 'querystring';
|
|
5
5
|
import { ParsedUrlQuery } from 'querystring';
|
|
6
6
|
import * as _uniformdev_canvas from '@uniformdev/canvas';
|
|
@@ -13,11 +13,13 @@ declare const withUniformGetServerSideProps: <TProps extends {
|
|
|
13
13
|
} = {
|
|
14
14
|
[key: string]: any;
|
|
15
15
|
}>(options?: {
|
|
16
|
-
/**
|
|
16
|
+
/** If you need to override the default client, you can pass it here */
|
|
17
17
|
client?: CanvasClient | undefined;
|
|
18
|
-
/**
|
|
18
|
+
/** 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 */
|
|
19
19
|
prefix?: string | undefined;
|
|
20
|
-
/**
|
|
20
|
+
/** Useful when you need to modify the path passed to the API */
|
|
21
|
+
modifyPath?: ((path: string, context: GetServerSidePropsContext<ParsedUrlQuery, PreviewData>) => string) | undefined;
|
|
22
|
+
/** Set to true if you want to include draft compositions */
|
|
21
23
|
preview?: boolean | undefined;
|
|
22
24
|
projectMapId?: string | undefined;
|
|
23
25
|
/** Way to override getCompositionByNodePath request params */
|
|
@@ -31,16 +33,16 @@ declare const withUniformGetServerSideProps: <TProps extends {
|
|
|
31
33
|
withUIStatus?: boolean | undefined;
|
|
32
34
|
} & Required<Pick<_uniformdev_canvas.CompositionGetParameters, "projectMapNodePath">> & _uniformdev_canvas.SpecificProjectMap & DataResolutionOption> | undefined;
|
|
33
35
|
/** Custom handler to specify return value and modify composition - e.g. enhance with CMS data */
|
|
34
|
-
callback?: UniformGetServerSideProps<TProps,
|
|
35
|
-
} | undefined) => GetServerSideProps<TProps,
|
|
36
|
+
callback?: UniformGetServerSideProps<TProps, ParsedUrlQuery, PreviewData> | undefined;
|
|
37
|
+
} | undefined) => GetServerSideProps<TProps, ParsedUrlQuery, PreviewData>;
|
|
36
38
|
|
|
37
39
|
declare const withUniformGetStaticPaths: (options?: {
|
|
38
40
|
projectMapId?: string | undefined;
|
|
39
41
|
/** Starting path to fetch nodes from */
|
|
40
42
|
rootPath?: string | undefined;
|
|
41
|
-
/**
|
|
43
|
+
/** 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 */
|
|
42
44
|
prefix?: string | undefined;
|
|
43
|
-
/**
|
|
45
|
+
/** Set to true if you want to include draft compositions */
|
|
44
46
|
preview?: boolean | undefined;
|
|
45
47
|
/** Way to override getNodes request params */
|
|
46
48
|
requestOptions?: Partial<{
|
|
@@ -61,7 +63,7 @@ declare const withUniformGetStaticPaths: (options?: {
|
|
|
61
63
|
}> | undefined;
|
|
62
64
|
/** Way to modify list of nodes before building array of paths */
|
|
63
65
|
callback?: ((nodes: ProjectMapNodeGetResponse['nodes']) => Promise<ProjectMapNodeGetResponse['nodes']>) | undefined;
|
|
64
|
-
/**
|
|
66
|
+
/** If you need to override the default client, you can pass it here */
|
|
65
67
|
client?: ProjectMapClient | undefined;
|
|
66
68
|
} | undefined) => () => Promise<{
|
|
67
69
|
paths: string[] | undefined;
|
|
@@ -76,11 +78,11 @@ declare const withUniformGetStaticProps: <TProps extends {
|
|
|
76
78
|
projectMapId?: string | undefined;
|
|
77
79
|
/** Name of dynamic parameter coming from getStaticPath, usually specified in page file name (e.g. [...slug].jsx will have param = 'slug' */
|
|
78
80
|
param: string;
|
|
79
|
-
/**
|
|
80
|
-
|
|
81
|
-
/**
|
|
81
|
+
/** Useful when you need to modify the path passed to the API */
|
|
82
|
+
modifyPath?: ((path: string, context: GetStaticPropsContext<ParsedUrlQuery, UniformPreviewData>) => string) | undefined;
|
|
83
|
+
/** Set to true if you want to include draft compositions */
|
|
82
84
|
preview?: boolean | undefined;
|
|
83
|
-
/**
|
|
85
|
+
/** If you need to override the default client, you can pass it here */
|
|
84
86
|
client?: CanvasClient | undefined;
|
|
85
87
|
/** Way to override getCompositionByNodePath request params */
|
|
86
88
|
requestOptions?: Partial<{
|
|
@@ -42,11 +42,15 @@ var withUniformGetServerSideProps = (options) => {
|
|
|
42
42
|
});
|
|
43
43
|
const preview = context.preview || (options == null ? void 0 : options.preview);
|
|
44
44
|
let composition = void 0;
|
|
45
|
+
let nodePath = (options == null ? void 0 : options.prefix) ? context.resolvedUrl.replace(new RegExp(`^${options.prefix}`), "") : context.resolvedUrl;
|
|
46
|
+
if (options == null ? void 0 : options.modifyPath) {
|
|
47
|
+
nodePath = options.modifyPath(nodePath, context);
|
|
48
|
+
}
|
|
45
49
|
try {
|
|
46
50
|
const response = await canvasClient.getCompositionByNodePath({
|
|
47
51
|
...options == null ? void 0 : options.requestOptions,
|
|
48
52
|
projectMapId,
|
|
49
|
-
projectMapNodePath:
|
|
53
|
+
projectMapNodePath: nodePath,
|
|
50
54
|
state: preview ? import_canvas.CANVAS_DRAFT_STATE : import_canvas.CANVAS_PUBLISHED_STATE
|
|
51
55
|
});
|
|
52
56
|
composition = response.composition;
|
|
@@ -101,12 +105,11 @@ var import_canvas3 = require("@uniformdev/canvas");
|
|
|
101
105
|
// src/helpers/slug.ts
|
|
102
106
|
var resolveSlugFromParams = ({
|
|
103
107
|
param = "slug",
|
|
104
|
-
params
|
|
105
|
-
prefix
|
|
108
|
+
params
|
|
106
109
|
}) => {
|
|
107
110
|
const slug = (params == null ? void 0 : params[param]) || "";
|
|
108
111
|
const slugString = Array.isArray(slug) ? slug.join("/") : slug;
|
|
109
|
-
return `/${slugString}
|
|
112
|
+
return `/${slugString}`;
|
|
110
113
|
};
|
|
111
114
|
|
|
112
115
|
// src/project-map/withUniformGetStaticProps.ts
|
|
@@ -114,11 +117,13 @@ var withUniformGetStaticProps = (options) => {
|
|
|
114
117
|
return async function wrappedGetStaticProps(context) {
|
|
115
118
|
var _a, _b;
|
|
116
119
|
const projectMapId = (_a = options == null ? void 0 : options.projectMapId) != null ? _a : process.env.UNIFORM_PROJECT_MAP_ID;
|
|
117
|
-
|
|
120
|
+
let pathString = resolveSlugFromParams({
|
|
118
121
|
param: options == null ? void 0 : options.param,
|
|
119
|
-
params: context == null ? void 0 : context.params
|
|
120
|
-
prefix: options == null ? void 0 : options.prefix
|
|
122
|
+
params: context == null ? void 0 : context.params
|
|
121
123
|
});
|
|
124
|
+
if (options == null ? void 0 : options.modifyPath) {
|
|
125
|
+
pathString = options.modifyPath(pathString, context);
|
|
126
|
+
}
|
|
122
127
|
const canvasClient = (_b = options == null ? void 0 : options.client) != null ? _b : new import_canvas3.CanvasClient({
|
|
123
128
|
apiKey: process.env.UNIFORM_API_KEY,
|
|
124
129
|
projectId: process.env.UNIFORM_PROJECT_ID,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
resolveSlugFromParams
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-2MI7UYW7.mjs";
|
|
4
4
|
|
|
5
5
|
// src/project-map/withUniformGetServerSideProps.ts
|
|
6
6
|
import {
|
|
@@ -19,11 +19,15 @@ var withUniformGetServerSideProps = (options) => {
|
|
|
19
19
|
});
|
|
20
20
|
const preview = context.preview || (options == null ? void 0 : options.preview);
|
|
21
21
|
let composition = void 0;
|
|
22
|
+
let nodePath = (options == null ? void 0 : options.prefix) ? context.resolvedUrl.replace(new RegExp(`^${options.prefix}`), "") : context.resolvedUrl;
|
|
23
|
+
if (options == null ? void 0 : options.modifyPath) {
|
|
24
|
+
nodePath = options.modifyPath(nodePath, context);
|
|
25
|
+
}
|
|
22
26
|
try {
|
|
23
27
|
const response = await canvasClient.getCompositionByNodePath({
|
|
24
28
|
...options == null ? void 0 : options.requestOptions,
|
|
25
29
|
projectMapId,
|
|
26
|
-
projectMapNodePath:
|
|
30
|
+
projectMapNodePath: nodePath,
|
|
27
31
|
state: preview ? CANVAS_DRAFT_STATE : CANVAS_PUBLISHED_STATE
|
|
28
32
|
});
|
|
29
33
|
composition = response.composition;
|
|
@@ -84,11 +88,13 @@ var withUniformGetStaticProps = (options) => {
|
|
|
84
88
|
return async function wrappedGetStaticProps(context) {
|
|
85
89
|
var _a, _b;
|
|
86
90
|
const projectMapId = (_a = options == null ? void 0 : options.projectMapId) != null ? _a : process.env.UNIFORM_PROJECT_MAP_ID;
|
|
87
|
-
|
|
91
|
+
let pathString = resolveSlugFromParams({
|
|
88
92
|
param: options == null ? void 0 : options.param,
|
|
89
|
-
params: context == null ? void 0 : context.params
|
|
90
|
-
prefix: options == null ? void 0 : options.prefix
|
|
93
|
+
params: context == null ? void 0 : context.params
|
|
91
94
|
});
|
|
95
|
+
if (options == null ? void 0 : options.modifyPath) {
|
|
96
|
+
pathString = options.modifyPath(pathString, context);
|
|
97
|
+
}
|
|
92
98
|
const canvasClient = (_b = options == null ? void 0 : options.client) != null ? _b : new CanvasClient2({
|
|
93
99
|
apiKey: process.env.UNIFORM_API_KEY,
|
|
94
100
|
projectId: process.env.UNIFORM_PROJECT_ID,
|
package/dist/slug/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as next from 'next';
|
|
2
|
-
import { GetServerSideProps, GetStaticProps } from 'next';
|
|
3
|
-
import {
|
|
2
|
+
import { GetServerSidePropsContext, GetServerSideProps, GetStaticPropsContext, GetStaticProps } from 'next';
|
|
3
|
+
import { a as UniformPreviewData, c as UniformGetServerSideProps, b as UniformGetStaticProps } from '../models-6ff72d91.js';
|
|
4
4
|
import * as querystring from 'querystring';
|
|
5
5
|
import { ParsedUrlQuery } from 'querystring';
|
|
6
6
|
import * as _uniformdev_canvas from '@uniformdev/canvas';
|
|
@@ -12,9 +12,13 @@ declare const withUniformGetServerSideProps: <TProps extends {
|
|
|
12
12
|
} = {
|
|
13
13
|
[key: string]: any;
|
|
14
14
|
}>(options?: {
|
|
15
|
-
|
|
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
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 */
|
|
17
20
|
preview?: boolean | undefined;
|
|
21
|
+
/** If you need to override the default client, you can pass it here */
|
|
18
22
|
client?: CanvasClient | undefined;
|
|
19
23
|
requestOptions?: Partial<{
|
|
20
24
|
skipEnhance?: boolean | undefined;
|
|
@@ -30,15 +34,15 @@ declare const withUniformGetServerSideProps: <TProps extends {
|
|
|
30
34
|
|
|
31
35
|
declare const withUniformGetStaticPaths: (options?: {
|
|
32
36
|
projectMapId?: string | undefined;
|
|
33
|
-
/**
|
|
37
|
+
/** 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 */
|
|
34
38
|
prefix?: string | undefined;
|
|
35
|
-
/**
|
|
39
|
+
/** Set to true if you want to include draft compositions */
|
|
36
40
|
preview?: boolean | undefined;
|
|
37
41
|
/** Way to override getCompositionList request params */
|
|
38
42
|
requestOptions?: Partial<CompositionGetParameters> | undefined;
|
|
39
43
|
/** Way to modify list of slugs before building array of paths */
|
|
40
44
|
callback?: ((compositions: CompositionGetResponse[]) => Promise<CompositionGetResponse[]>) | undefined;
|
|
41
|
-
/**
|
|
45
|
+
/** If you need to override the default client, you can pass it here */
|
|
42
46
|
client?: CanvasClient | undefined;
|
|
43
47
|
} | undefined) => () => Promise<{
|
|
44
48
|
paths: string[];
|
|
@@ -52,11 +56,11 @@ declare const withUniformGetStaticProps: <TProps extends {
|
|
|
52
56
|
}>(options: {
|
|
53
57
|
/** Name of dynamic parameter coming from getStaticPath, usually specified in page file name (e.g. [...slug].jsx will have param = 'slug' */
|
|
54
58
|
param: string;
|
|
55
|
-
/**
|
|
56
|
-
|
|
57
|
-
/**
|
|
59
|
+
/** Useful when you need to modify the slug passed to the API */
|
|
60
|
+
modifySlug?: ((slug: string, context: GetStaticPropsContext<ParsedUrlQuery, UniformPreviewData>) => string) | undefined;
|
|
61
|
+
/** Set to true if you want to include draft compositions */
|
|
58
62
|
preview?: boolean | undefined;
|
|
59
|
-
/**
|
|
63
|
+
/** If you need to override the default client, you can pass it here */
|
|
60
64
|
client?: CanvasClient | undefined;
|
|
61
65
|
/** Way to override getCompositionBySlug request params */
|
|
62
66
|
requestOptions?: Partial<{
|
package/dist/slug/index.js
CHANGED
|
@@ -31,26 +31,8 @@ module.exports = __toCommonJS(slug_exports);
|
|
|
31
31
|
|
|
32
32
|
// src/slug/withUniformGetServerSideProps.ts
|
|
33
33
|
var import_canvas = require("@uniformdev/canvas");
|
|
34
|
-
|
|
35
|
-
// src/helpers/slug.ts
|
|
36
|
-
var resolveSlugFromParams = ({
|
|
37
|
-
param = "slug",
|
|
38
|
-
params,
|
|
39
|
-
prefix
|
|
40
|
-
}) => {
|
|
41
|
-
const slug = (params == null ? void 0 : params[param]) || "";
|
|
42
|
-
const slugString = Array.isArray(slug) ? slug.join("/") : slug;
|
|
43
|
-
return `/${slugString}` || prefix || "/";
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
// src/slug/withUniformGetServerSideProps.ts
|
|
47
34
|
var withUniformGetServerSideProps = (options) => {
|
|
48
35
|
return async function wrappedGetServerSideProps(context) {
|
|
49
|
-
const slugString = resolveSlugFromParams({
|
|
50
|
-
param: options == null ? void 0 : options.param,
|
|
51
|
-
params: context == null ? void 0 : context.params,
|
|
52
|
-
prefix: options == null ? void 0 : options.prefix
|
|
53
|
-
});
|
|
54
36
|
const canvasClient = (options == null ? void 0 : options.client) || new import_canvas.CanvasClient({
|
|
55
37
|
apiKey: process.env.UNIFORM_API_KEY,
|
|
56
38
|
projectId: process.env.UNIFORM_PROJECT_ID,
|
|
@@ -58,10 +40,14 @@ var withUniformGetServerSideProps = (options) => {
|
|
|
58
40
|
});
|
|
59
41
|
const { preview, previewData } = context;
|
|
60
42
|
let composition = void 0;
|
|
43
|
+
let slug = (options == null ? void 0 : options.prefix) ? context.resolvedUrl.replace(new RegExp(`^${options.prefix}`), "") : context.resolvedUrl;
|
|
44
|
+
if (options == null ? void 0 : options.modifySlug) {
|
|
45
|
+
slug = options.modifySlug(slug, context);
|
|
46
|
+
}
|
|
61
47
|
try {
|
|
62
48
|
const response = await canvasClient.getCompositionBySlug({
|
|
63
49
|
...options == null ? void 0 : options.requestOptions,
|
|
64
|
-
slug
|
|
50
|
+
slug,
|
|
65
51
|
state: preview || (options == null ? void 0 : options.preview) ? import_canvas.CANVAS_DRAFT_STATE : import_canvas.CANVAS_PUBLISHED_STATE
|
|
66
52
|
});
|
|
67
53
|
composition = response.composition;
|
|
@@ -110,14 +96,28 @@ var withUniformGetStaticPaths = (options) => {
|
|
|
110
96
|
|
|
111
97
|
// src/slug/withUniformGetStaticProps.ts
|
|
112
98
|
var import_canvas3 = require("@uniformdev/canvas");
|
|
99
|
+
|
|
100
|
+
// src/helpers/slug.ts
|
|
101
|
+
var resolveSlugFromParams = ({
|
|
102
|
+
param = "slug",
|
|
103
|
+
params
|
|
104
|
+
}) => {
|
|
105
|
+
const slug = (params == null ? void 0 : params[param]) || "";
|
|
106
|
+
const slugString = Array.isArray(slug) ? slug.join("/") : slug;
|
|
107
|
+
return `/${slugString}`;
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
// src/slug/withUniformGetStaticProps.ts
|
|
113
111
|
var withUniformGetStaticProps = (options) => {
|
|
114
112
|
return async function wrappedGetStaticProps(context) {
|
|
115
113
|
var _a;
|
|
116
|
-
|
|
114
|
+
let slugString = resolveSlugFromParams({
|
|
117
115
|
param: options == null ? void 0 : options.param,
|
|
118
|
-
params: context == null ? void 0 : context.params
|
|
119
|
-
prefix: options == null ? void 0 : options.prefix
|
|
116
|
+
params: context == null ? void 0 : context.params
|
|
120
117
|
});
|
|
118
|
+
if (options == null ? void 0 : options.modifySlug) {
|
|
119
|
+
slugString = options.modifySlug(slugString, context);
|
|
120
|
+
}
|
|
121
121
|
const canvasClient = (_a = options == null ? void 0 : options.client) != null ? _a : new import_canvas3.CanvasClient({
|
|
122
122
|
apiKey: process.env.UNIFORM_API_KEY,
|
|
123
123
|
projectId: process.env.UNIFORM_PROJECT_ID,
|
package/dist/slug/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
resolveSlugFromParams
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-2MI7UYW7.mjs";
|
|
4
4
|
|
|
5
5
|
// src/slug/withUniformGetServerSideProps.ts
|
|
6
6
|
import {
|
|
@@ -10,11 +10,6 @@ import {
|
|
|
10
10
|
} from "@uniformdev/canvas";
|
|
11
11
|
var withUniformGetServerSideProps = (options) => {
|
|
12
12
|
return async function wrappedGetServerSideProps(context) {
|
|
13
|
-
const slugString = resolveSlugFromParams({
|
|
14
|
-
param: options == null ? void 0 : options.param,
|
|
15
|
-
params: context == null ? void 0 : context.params,
|
|
16
|
-
prefix: options == null ? void 0 : options.prefix
|
|
17
|
-
});
|
|
18
13
|
const canvasClient = (options == null ? void 0 : options.client) || new CanvasClient({
|
|
19
14
|
apiKey: process.env.UNIFORM_API_KEY,
|
|
20
15
|
projectId: process.env.UNIFORM_PROJECT_ID,
|
|
@@ -22,10 +17,14 @@ var withUniformGetServerSideProps = (options) => {
|
|
|
22
17
|
});
|
|
23
18
|
const { preview, previewData } = context;
|
|
24
19
|
let composition = void 0;
|
|
20
|
+
let slug = (options == null ? void 0 : options.prefix) ? context.resolvedUrl.replace(new RegExp(`^${options.prefix}`), "") : context.resolvedUrl;
|
|
21
|
+
if (options == null ? void 0 : options.modifySlug) {
|
|
22
|
+
slug = options.modifySlug(slug, context);
|
|
23
|
+
}
|
|
25
24
|
try {
|
|
26
25
|
const response = await canvasClient.getCompositionBySlug({
|
|
27
26
|
...options == null ? void 0 : options.requestOptions,
|
|
28
|
-
slug
|
|
27
|
+
slug,
|
|
29
28
|
state: preview || (options == null ? void 0 : options.preview) ? CANVAS_DRAFT_STATE : CANVAS_PUBLISHED_STATE
|
|
30
29
|
});
|
|
31
30
|
composition = response.composition;
|
|
@@ -85,11 +84,13 @@ import {
|
|
|
85
84
|
var withUniformGetStaticProps = (options) => {
|
|
86
85
|
return async function wrappedGetStaticProps(context) {
|
|
87
86
|
var _a;
|
|
88
|
-
|
|
87
|
+
let slugString = resolveSlugFromParams({
|
|
89
88
|
param: options == null ? void 0 : options.param,
|
|
90
|
-
params: context == null ? void 0 : context.params
|
|
91
|
-
prefix: options == null ? void 0 : options.prefix
|
|
89
|
+
params: context == null ? void 0 : context.params
|
|
92
90
|
});
|
|
91
|
+
if (options == null ? void 0 : options.modifySlug) {
|
|
92
|
+
slugString = options.modifySlug(slugString, context);
|
|
93
|
+
}
|
|
93
94
|
const canvasClient = (_a = options == null ? void 0 : options.client) != null ? _a : new CanvasClient3({
|
|
94
95
|
apiKey: process.env.UNIFORM_API_KEY,
|
|
95
96
|
projectId: process.env.UNIFORM_PROJECT_ID,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/canvas-next",
|
|
3
|
-
"version": "18.24.
|
|
3
|
+
"version": "18.24.1-alpha.1+65e77b560",
|
|
4
4
|
"description": "Next.js SDK for Uniform Canvas",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -53,9 +53,9 @@
|
|
|
53
53
|
"document": "api-extractor run --local"
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@uniformdev/canvas": "18.24.
|
|
57
|
-
"@uniformdev/canvas-react": "18.24.
|
|
58
|
-
"@uniformdev/project-map": "18.24.
|
|
56
|
+
"@uniformdev/canvas": "18.24.1-alpha.1+65e77b560",
|
|
57
|
+
"@uniformdev/canvas-react": "18.24.1-alpha.1+65e77b560",
|
|
58
|
+
"@uniformdev/project-map": "18.24.1-alpha.1+65e77b560"
|
|
59
59
|
},
|
|
60
60
|
"peerDependencies": {
|
|
61
61
|
"next": ">= 12.0.0",
|
|
@@ -74,5 +74,5 @@
|
|
|
74
74
|
"publishConfig": {
|
|
75
75
|
"access": "public"
|
|
76
76
|
},
|
|
77
|
-
"gitHead": "
|
|
77
|
+
"gitHead": "65e77b56039b0c688518358a8402acd84686e9e0"
|
|
78
78
|
}
|