@uniformdev/canvas-next 17.4.1-alpha.34 → 17.5.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.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { U as UniformCompositionNextPage, b as UniformGetServerSideProps, a as UniformGetStaticProps
|
|
1
|
+
export { U as UniformCompositionNextPage, b as UniformGetServerSideProps, a as UniformGetStaticProps } from './models-de4a94fb.js';
|
|
2
2
|
import '@uniformdev/canvas-react';
|
|
3
3
|
import '@uniformdev/canvas';
|
|
4
4
|
import 'next';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CompositionProps } from '@uniformdev/canvas-react';
|
|
2
2
|
import { RootComponentInstance } from '@uniformdev/canvas';
|
|
3
|
-
import { NextPage, PreviewData, GetStaticPropsContext, GetStaticPropsResult, GetServerSidePropsContext, GetServerSidePropsResult
|
|
3
|
+
import { NextPage, PreviewData, GetStaticPropsContext, GetStaticPropsResult, GetServerSidePropsContext, GetServerSidePropsResult } from 'next';
|
|
4
4
|
import { ParsedUrlQuery } from 'querystring';
|
|
5
5
|
|
|
6
6
|
declare type UniformCompositionNextPage<TProps = unknown> = NextPage<TProps & CompositionProps>;
|
|
@@ -14,22 +14,5 @@ declare type UniformGetServerSideProps<P extends {
|
|
|
14
14
|
} = {
|
|
15
15
|
[key: string]: any;
|
|
16
16
|
}, Q extends ParsedUrlQuery = ParsedUrlQuery, D extends PreviewData = PreviewData> = (context: GetServerSidePropsContext<Q, D>, composition: RootComponentInstance | undefined) => Promise<GetServerSidePropsResult<P>> | GetServerSidePropsResult<P>;
|
|
17
|
-
declare type WithUniformGetServerSideProps<TProps extends {
|
|
18
|
-
[key: string]: any;
|
|
19
|
-
}, TClient> = (callback?: UniformGetServerSideProps<TProps>, options?: {
|
|
20
|
-
client?: TClient;
|
|
21
|
-
}) => GetServerSideProps<TProps>;
|
|
22
|
-
declare type WithUniformGetStaticPaths<TClient> = (options?: {
|
|
23
|
-
prefix?: string;
|
|
24
|
-
client?: TClient;
|
|
25
|
-
preview?: boolean;
|
|
26
|
-
}) => GetStaticPaths;
|
|
27
|
-
declare type WithUniformGetStaticProps<TProps extends {
|
|
28
|
-
[key: string]: any;
|
|
29
|
-
}, TClient> = (callback?: UniformGetStaticProps<TProps>, options?: {
|
|
30
|
-
param?: string;
|
|
31
|
-
prefix?: string;
|
|
32
|
-
client?: TClient;
|
|
33
|
-
}) => GetStaticProps<TProps>;
|
|
34
17
|
|
|
35
|
-
export { UniformCompositionNextPage as U,
|
|
18
|
+
export { UniformCompositionNextPage as U, UniformGetStaticProps as a, UniformGetServerSideProps as b };
|
package/dist/slug/index.d.ts
CHANGED
|
@@ -1,18 +1,37 @@
|
|
|
1
1
|
import * as next from 'next';
|
|
2
|
+
import { GetServerSideProps, GetStaticProps } from 'next';
|
|
2
3
|
import * as querystring from 'querystring';
|
|
4
|
+
import { ParsedUrlQuery } from 'querystring';
|
|
3
5
|
import { CanvasClient } from '@uniformdev/canvas';
|
|
4
|
-
import {
|
|
6
|
+
import { b as UniformGetServerSideProps, a as UniformGetStaticProps } from '../models-de4a94fb.js';
|
|
5
7
|
import '@uniformdev/canvas-react';
|
|
6
8
|
|
|
7
|
-
declare const withUniformGetServerSideProps:
|
|
9
|
+
declare const withUniformGetServerSideProps: <TProps extends {
|
|
8
10
|
[key: string]: any;
|
|
9
|
-
}
|
|
11
|
+
} = {
|
|
12
|
+
[key: string]: any;
|
|
13
|
+
}>(callback?: UniformGetServerSideProps<TProps, querystring.ParsedUrlQuery, next.PreviewData> | undefined, options?: {
|
|
14
|
+
client?: CanvasClient;
|
|
15
|
+
}) => GetServerSideProps<TProps, querystring.ParsedUrlQuery, next.PreviewData>;
|
|
10
16
|
|
|
11
|
-
declare const withUniformGetStaticPaths:
|
|
17
|
+
declare const withUniformGetStaticPaths: (options?: {
|
|
18
|
+
prefix?: string;
|
|
19
|
+
client?: CanvasClient;
|
|
20
|
+
preview?: boolean;
|
|
21
|
+
}) => () => Promise<{
|
|
22
|
+
paths: string[];
|
|
23
|
+
fallback: boolean;
|
|
24
|
+
}>;
|
|
12
25
|
|
|
13
|
-
declare const withUniformGetStaticProps:
|
|
26
|
+
declare const withUniformGetStaticProps: <TProps extends {
|
|
27
|
+
[key: string]: any;
|
|
28
|
+
} = {
|
|
14
29
|
[key: string]: any;
|
|
15
|
-
},
|
|
30
|
+
}>(callback?: UniformGetStaticProps<TProps, ParsedUrlQuery, next.PreviewData> | undefined, options?: {
|
|
31
|
+
param?: string;
|
|
32
|
+
prefix?: string;
|
|
33
|
+
client?: CanvasClient;
|
|
34
|
+
}) => GetStaticProps<TProps, ParsedUrlQuery, next.PreviewData>;
|
|
16
35
|
|
|
17
36
|
declare const getServerSideProps: next.GetServerSideProps<{
|
|
18
37
|
[key: string]: any;
|
|
@@ -20,6 +39,9 @@ declare const getServerSideProps: next.GetServerSideProps<{
|
|
|
20
39
|
declare const getStaticProps: next.GetStaticProps<{
|
|
21
40
|
[key: string]: any;
|
|
22
41
|
}, querystring.ParsedUrlQuery, next.PreviewData>;
|
|
23
|
-
declare const getStaticPaths:
|
|
42
|
+
declare const getStaticPaths: () => Promise<{
|
|
43
|
+
paths: string[];
|
|
44
|
+
fallback: boolean;
|
|
45
|
+
}>;
|
|
24
46
|
|
|
25
47
|
export { getServerSideProps, getStaticPaths, getStaticProps, withUniformGetServerSideProps, withUniformGetStaticPaths, withUniformGetStaticProps };
|
package/dist/slug/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var P=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var R=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var w=(e,r)=>{for(var n in r)P(e,n,{get:r[n],enumerable:!0})},E=(e,r,n,t)=>{if(r&&typeof r=="object"||typeof r=="function")for(let s of R(r))!l.call(e,s)&&s!==n&&P(e,s,{get:()=>r[s],enumerable:!(t=C(r,s))||t.enumerable});return e};var A=e=>E(P({},"__esModule",{value:!0}),e);var y={};w(y,{getServerSideProps:()=>O,getStaticPaths:()=>T,getStaticProps:()=>g,withUniformGetServerSideProps:()=>m,withUniformGetStaticPaths:()=>I,withUniformGetStaticProps:()=>d});module.exports=A(y);var c=require("@uniformdev/canvas"),m=(e,r)=>async function(t){if(!process.env.UNIFORM_API_KEY)throw new Error("UNIFORM_API_KEY is not defined.");if(!process.env.UNIFORM_PROJECT_ID)throw new Error("UNIFORM_PROJECT_ID is not defined.");let s=(r==null?void 0:r.client)||new c.CanvasClient({apiKey:process.env.UNIFORM_API_KEY,projectId:process.env.UNIFORM_PROJECT_ID,apiHost:process.env.UNIFORM_CLI_BASE_URL}),{preview:a}=t,o=new URL(t.resolvedUrl,`http://${t.req.headers.host}/`),i=await s.getCompositionBySlug({slug:o.pathname,state:a?c.CANVAS_DRAFT_STATE:c.CANVAS_PUBLISHED_STATE});if(!i)return{notFound:!0};let p=e?await e(t,i.composition):{props:{}};if(Object.hasOwn(p,"props")){let f=p;f.props.data=i.composition}return p};var _=require("@uniformdev/canvas"),I=e=>async function(){var a;if(!process.env.UNIFORM_API_KEY)throw new Error("UNIFORM_API_KEY is not defined.");if(!process.env.UNIFORM_PROJECT_ID)throw new Error("UNIFORM_PROJECT_ID is not defined.");return{paths:(await((a=e==null?void 0:e.client)!=null?a:new _.CanvasClient({apiKey:process.env.UNIFORM_API_KEY,projectId:process.env.UNIFORM_PROJECT_ID,apiHost:process.env.UNIFORM_CLI_BASE_URL})).getCompositionList({state:e!=null&&e.preview?_.CANVAS_DRAFT_STATE:_.CANVAS_PUBLISHED_STATE})).compositions.filter(o=>{var i;return!!((i=o.composition._slug)!=null&&i.length)}).map(o=>o.composition._slug),fallback:!1}};var S=require("@uniformdev/canvas"),d=(e,r)=>async function(t){var U;if(!process.env.UNIFORM_API_KEY)throw new Error("UNIFORM_API_KEY is not defined.");if(!process.env.UNIFORM_PROJECT_ID)throw new Error("UNIFORM_PROJECT_ID is not defined.");let s=u({param:r==null?void 0:r.param,params:t==null?void 0:t.params,prefix:r==null?void 0:r.prefix}),a=(U=r==null?void 0:r.client)!=null?U:new S.CanvasClient({apiKey:process.env.UNIFORM_API_KEY,projectId:process.env.UNIFORM_PROJECT_ID,apiHost:process.env.UNIFORM_CLI_BASE_URL}),{preview:o}=t,i=await a.getCompositionBySlug({slug:s,state:o?S.CANVAS_DRAFT_STATE:S.CANVAS_PUBLISHED_STATE});if(!i.composition)return{notFound:!0};let{composition:p}=i,f=e?await e(t,p):{props:{}};if(Object.hasOwn(f,"props")){let v=f;v.props.data=p}return f},u=({param:e="slug",params:r,prefix:n})=>{let t=(r==null?void 0:r[e])||"";return`/${Array.isArray(t)?t.join("/"):t}`||n||"/"};var O=m(),g=d(),T=I();0&&(module.exports={getServerSideProps,getStaticPaths,getStaticProps,withUniformGetServerSideProps,withUniformGetStaticPaths,withUniformGetStaticProps});
|
package/dist/slug/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{CanvasClient as
|
|
1
|
+
import{CanvasClient as I,CANVAS_DRAFT_STATE as d,CANVAS_PUBLISHED_STATE as U}from"@uniformdev/canvas";var S=(t,r)=>async function(e){if(!process.env.UNIFORM_API_KEY)throw new Error("UNIFORM_API_KEY is not defined.");if(!process.env.UNIFORM_PROJECT_ID)throw new Error("UNIFORM_PROJECT_ID is not defined.");let a=(r==null?void 0:r.client)||new I({apiKey:process.env.UNIFORM_API_KEY,projectId:process.env.UNIFORM_PROJECT_ID,apiHost:process.env.UNIFORM_CLI_BASE_URL}),{preview:i}=e,n=new URL(e.resolvedUrl,`http://${e.req.headers.host}/`),s=await a.getCompositionBySlug({slug:n.pathname,state:i?d:U});if(!s)return{notFound:!0};let o=t?await t(e,s.composition):{props:{}};if(Object.hasOwn(o,"props")){let p=o;p.props.data=s.composition}return o};import{CanvasClient as v,CANVAS_DRAFT_STATE as C,CANVAS_PUBLISHED_STATE as R}from"@uniformdev/canvas";var f=t=>async function(){var i;if(!process.env.UNIFORM_API_KEY)throw new Error("UNIFORM_API_KEY is not defined.");if(!process.env.UNIFORM_PROJECT_ID)throw new Error("UNIFORM_PROJECT_ID is not defined.");return{paths:(await((i=t==null?void 0:t.client)!=null?i:new v({apiKey:process.env.UNIFORM_API_KEY,projectId:process.env.UNIFORM_PROJECT_ID,apiHost:process.env.UNIFORM_CLI_BASE_URL})).getCompositionList({state:t!=null&&t.preview?C:R})).compositions.filter(n=>{var s;return!!((s=n.composition._slug)!=null&&s.length)}).map(n=>n.composition._slug),fallback:!1}};import{CanvasClient as l,CANVAS_DRAFT_STATE as w,CANVAS_PUBLISHED_STATE as E}from"@uniformdev/canvas";var P=(t,r)=>async function(e){var _;if(!process.env.UNIFORM_API_KEY)throw new Error("UNIFORM_API_KEY is not defined.");if(!process.env.UNIFORM_PROJECT_ID)throw new Error("UNIFORM_PROJECT_ID is not defined.");let a=A({param:r==null?void 0:r.param,params:e==null?void 0:e.params,prefix:r==null?void 0:r.prefix}),i=(_=r==null?void 0:r.client)!=null?_:new l({apiKey:process.env.UNIFORM_API_KEY,projectId:process.env.UNIFORM_PROJECT_ID,apiHost:process.env.UNIFORM_CLI_BASE_URL}),{preview:n}=e,s=await i.getCompositionBySlug({slug:a,state:n?w:E});if(!s.composition)return{notFound:!0};let{composition:o}=s,p=t?await t(e,o):{props:{}};if(Object.hasOwn(p,"props")){let m=p;m.props.data=o}return p},A=({param:t="slug",params:r,prefix:c})=>{let e=(r==null?void 0:r[t])||"";return`/${Array.isArray(e)?e.join("/"):e}`||c||"/"};var G=S(),D=P(),K=f();export{G as getServerSideProps,K as getStaticPaths,D as getStaticProps,S as withUniformGetServerSideProps,f as withUniformGetStaticPaths,P as withUniformGetStaticProps};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/canvas-next",
|
|
3
|
-
"version": "17.
|
|
3
|
+
"version": "17.5.0",
|
|
4
4
|
"description": "Next.js SDK for Uniform Canvas",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
"format": "prettier --write \"src/**/*.{js,ts,tsx}\""
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@uniformdev/canvas": "^17.
|
|
46
|
-
"@uniformdev/canvas-react": "^17.
|
|
45
|
+
"@uniformdev/canvas": "^17.5.0",
|
|
46
|
+
"@uniformdev/canvas-react": "^17.5.0"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
49
|
"next": ">= 12.0.0",
|
|
@@ -51,8 +51,8 @@
|
|
|
51
51
|
"react-dom": ">=16"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"@types/react": "18.0.
|
|
55
|
-
"next": "12.3.
|
|
54
|
+
"@types/react": "18.0.25",
|
|
55
|
+
"next": "12.3.2",
|
|
56
56
|
"react": "18.2.0",
|
|
57
57
|
"react-dom": "18.2.0"
|
|
58
58
|
},
|
|
@@ -62,5 +62,5 @@
|
|
|
62
62
|
"publishConfig": {
|
|
63
63
|
"access": "public"
|
|
64
64
|
},
|
|
65
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "de1f52defe798010336e1dd3b2732fce359855fb"
|
|
66
66
|
}
|