@uniformdev/canvas-next 17.1.1-alpha.151

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/LICENSE.txt ADDED
@@ -0,0 +1,2 @@
1
+ © 2022 Uniform Systems, Inc. All Rights Reserved.
2
+ See details of Uniform Systems, Inc. Master Subscription Agreement here: https://uniform.dev/eula
package/README.md ADDED
@@ -0,0 +1,3 @@
1
+ Next.js SDK for Uniform Canvas
2
+
3
+ part of the [Uniform Platform](https://uniform.app). See our [documentation](https://docs.uniform.app) for more details.
@@ -0,0 +1,5 @@
1
+ export { U as UniformCompositionNextPage, b as UniformGetServerSideProps, a as UniformGetStaticProps, W as WithUniformGetServerSideProps, c as WithUniformGetStaticPaths, d as WithUniformGetStaticProps } from './models-7b70fd96.js';
2
+ import '@uniformdev/canvas-react';
3
+ import '@uniformdev/canvas';
4
+ import 'next';
5
+ import 'querystring';
File without changes
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";var m=Object.defineProperty;var t=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var a=Object.prototype.hasOwnProperty;var b=(r,o,p,f)=>{if(o&&typeof o=="object"||typeof o=="function")for(let e of x(o))!a.call(r,e)&&e!==p&&m(r,e,{get:()=>o[e],enumerable:!(f=t(o,e))||f.enumerable});return r};var c=r=>b(m({},"__esModule",{value:!0}),r);var d={};module.exports=c(d);
package/dist/index.mjs ADDED
File without changes
@@ -0,0 +1,35 @@
1
+ import { CompositionProps } from '@uniformdev/canvas-react';
2
+ import { RootComponentInstance } from '@uniformdev/canvas';
3
+ import { NextPage, PreviewData, GetStaticPropsContext, GetStaticPropsResult, GetServerSidePropsContext, GetServerSidePropsResult, GetServerSideProps, GetStaticPaths, GetStaticProps } from 'next';
4
+ import { ParsedUrlQuery } from 'querystring';
5
+
6
+ declare type UniformCompositionNextPage<TProps = unknown> = NextPage<TProps & CompositionProps>;
7
+ declare type UniformGetStaticProps<P extends {
8
+ [key: string]: any;
9
+ } = {
10
+ [key: string]: any;
11
+ }, Q extends ParsedUrlQuery = ParsedUrlQuery, D extends PreviewData = PreviewData> = (context: GetStaticPropsContext<Q, D>, composition: RootComponentInstance | undefined) => Promise<GetStaticPropsResult<P>> | GetStaticPropsResult<P>;
12
+ declare type UniformGetServerSideProps<P extends {
13
+ [key: string]: any;
14
+ } = {
15
+ [key: string]: any;
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
+
35
+ export { UniformCompositionNextPage as U, WithUniformGetServerSideProps as W, UniformGetStaticProps as a, UniformGetServerSideProps as b, WithUniformGetStaticPaths as c, WithUniformGetStaticProps as d };
@@ -0,0 +1,25 @@
1
+ import * as next from 'next';
2
+ import * as querystring from 'querystring';
3
+ import { CanvasClient } from '@uniformdev/canvas';
4
+ import { W as WithUniformGetServerSideProps, c as WithUniformGetStaticPaths, d as WithUniformGetStaticProps } from '../models-7b70fd96.js';
5
+ import '@uniformdev/canvas-react';
6
+
7
+ declare const withUniformGetServerSideProps: WithUniformGetServerSideProps<{
8
+ [key: string]: any;
9
+ }, CanvasClient>;
10
+
11
+ declare const withUniformGetStaticPaths: WithUniformGetStaticPaths<CanvasClient>;
12
+
13
+ declare const withUniformGetStaticProps: WithUniformGetStaticProps<{
14
+ [key: string]: any;
15
+ }, CanvasClient>;
16
+
17
+ declare const getServerSideProps: next.GetServerSideProps<{
18
+ [key: string]: any;
19
+ }, querystring.ParsedUrlQuery, next.PreviewData>;
20
+ declare const getStaticProps: next.GetStaticProps<{
21
+ [key: string]: any;
22
+ }, querystring.ParsedUrlQuery, next.PreviewData>;
23
+ declare const getStaticPaths: next.GetStaticPaths<querystring.ParsedUrlQuery>;
24
+
25
+ export { getServerSideProps, getStaticPaths, getStaticProps, withUniformGetServerSideProps, withUniformGetStaticPaths, withUniformGetStaticProps };
@@ -0,0 +1 @@
1
+ "use strict";var f=Object.defineProperty;var O=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var N=(e,r)=>{for(var o in r)f(e,o,{get:r[o],enumerable:!0})},l=(e,r,o,t)=>{if(r&&typeof r=="object"||typeof r=="function")for(let s of h(r))!d.call(e,s)&&s!==o&&f(e,s,{get:()=>r[s],enumerable:!(t=O(r,s))||t.enumerable});return e};var u=e=>l(f({},"__esModule",{value:!0}),e);var g={};N(g,{getServerSideProps:()=>F,getStaticPaths:()=>y,getStaticProps:()=>T,withUniformGetServerSideProps:()=>U,withUniformGetStaticPaths:()=>P,withUniformGetStaticProps:()=>C});module.exports=u(g);var p=require("@uniformdev/canvas"),U=(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 p.CanvasClient({apiKey:process.env.UNIFORM_API_KEY,projectId:process.env.UNIFORM_PROJECT_ID,apiHost:process.env.UNIFORM_CLI_BASE_URL}),{preview:n}=t,a=new URL(t.resolvedUrl,`http://${t.req.headers.host}/`),i=await s.getCompositionBySlug({slug:a.pathname,state:n?p.CANVAS_DRAFT_STATE:p.CANVAS_PUBLISHED_STATE});if(!i)return{notFound:!0};let I=e?await e(t,i.composition):{props:{}};if(Object.hasOwn(I,"props")){let m=I;m.props.data=i.composition}return I};var c=require("@uniformdev/canvas"),P=e=>async function(){var n;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((n=e==null?void 0:e.client)!=null?n:new c.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?c.CANVAS_DRAFT_STATE:c.CANVAS_PUBLISHED_STATE})).compositions.filter(a=>{var i;return!!((i=a.composition._slug)!=null&&i.length)}).map(a=>a.composition._slug),fallback:!1}};var _=require("@uniformdev/canvas"),C=(e,r)=>async function(t){var E,v,w;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=(E=r==null?void 0:r.param)!=null?E:"slug",n=(v=t==null?void 0:t.params)==null?void 0:v[s],a=Array.isArray(n)?n.join("/"):n,i=(w=r==null?void 0:r.client)!=null?w:new _.CanvasClient({apiKey:process.env.UNIFORM_API_KEY,projectId:process.env.UNIFORM_PROJECT_ID,apiHost:process.env.UNIFORM_CLI_BASE_URL}),{preview:I}=t,m=await i.getCompositionBySlug({slug:`/${a}`||(r==null?void 0:r.prefix)||"/",state:I?_.CANVAS_DRAFT_STATE:_.CANVAS_PUBLISHED_STATE});if(!m.composition)return{notFound:!0};let{composition:R}=m,S=e?await e(t,R):{props:{}};if(Object.hasOwn(S,"props")){let A=S;A.props.data=R}return S};var F=U(),T=C(),y=P();0&&(module.exports={getServerSideProps,getStaticPaths,getStaticProps,withUniformGetServerSideProps,withUniformGetStaticPaths,withUniformGetStaticProps});
@@ -0,0 +1 @@
1
+ import{CanvasClient as E,CANVAS_DRAFT_STATE as v,CANVAS_PUBLISHED_STATE as w}from"@uniformdev/canvas";var U=(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 a=(r==null?void 0:r.client)||new E({apiKey:process.env.UNIFORM_API_KEY,projectId:process.env.UNIFORM_PROJECT_ID,apiHost:process.env.UNIFORM_CLI_BASE_URL}),{preview:s}=t,i=new URL(t.resolvedUrl,`http://${t.req.headers.host}/`),n=await a.getCompositionBySlug({slug:i.pathname,state:s?v:w});if(!n)return{notFound:!0};let o=e?await e(t,n.composition):{props:{}};if(Object.hasOwn(o,"props")){let p=o;p.props.data=n.composition}return o};import{CanvasClient as A,CANVAS_DRAFT_STATE as O,CANVAS_PUBLISHED_STATE as h}from"@uniformdev/canvas";var P=e=>async function(){var s;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((s=e==null?void 0:e.client)!=null?s:new A({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?O:h})).compositions.filter(i=>{var n;return!!((n=i.composition._slug)!=null&&n.length)}).map(i=>i.composition._slug),fallback:!1}};import{CanvasClient as d,CANVAS_DRAFT_STATE as N,CANVAS_PUBLISHED_STATE as l}from"@uniformdev/canvas";var C=(e,r)=>async function(t){var m,S,f;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=(m=r==null?void 0:r.param)!=null?m:"slug",s=(S=t==null?void 0:t.params)==null?void 0:S[a],i=Array.isArray(s)?s.join("/"):s,n=(f=r==null?void 0:r.client)!=null?f:new d({apiKey:process.env.UNIFORM_API_KEY,projectId:process.env.UNIFORM_PROJECT_ID,apiHost:process.env.UNIFORM_CLI_BASE_URL}),{preview:o}=t,p=await n.getCompositionBySlug({slug:`/${i}`||(r==null?void 0:r.prefix)||"/",state:o?N:l});if(!p.composition)return{notFound:!0};let{composition:I}=p,c=e?await e(t,I):{props:{}};if(Object.hasOwn(c,"props")){let R=c;R.props.data=I}return c};var L=U(),J=C(),Y=P();export{L as getServerSideProps,Y as getStaticPaths,J as getStaticProps,U as withUniformGetServerSideProps,P as withUniformGetStaticPaths,C as withUniformGetStaticProps};
package/package.json ADDED
@@ -0,0 +1,66 @@
1
+ {
2
+ "name": "@uniformdev/canvas-next",
3
+ "version": "17.1.1-alpha.151+3c57dd245",
4
+ "description": "Next.js SDK for Uniform Canvas",
5
+ "license": "SEE LICENSE IN LICENSE.txt",
6
+ "main": "./dist/index.js",
7
+ "module": "./dist/index.esm.js",
8
+ "exports": {
9
+ ".": {
10
+ "import": {
11
+ "node": "./dist/index.mjs",
12
+ "default": "./dist/index.esm.js"
13
+ },
14
+ "require": "./dist/index.js"
15
+ },
16
+ "./slug": {
17
+ "import": {
18
+ "node": "./dist/slug/index.mjs",
19
+ "default": "./dist/slug/index.esm.js"
20
+ },
21
+ "require": "./dist/slug/index.js"
22
+ }
23
+ },
24
+ "types": "./dist/index.d.ts",
25
+ "typesVersions": {
26
+ "*": {
27
+ ".": [
28
+ "./dist/index.d.ts"
29
+ ],
30
+ "slug": [
31
+ "./dist/slug/index.d.ts"
32
+ ]
33
+ }
34
+ },
35
+ "sideEffects": false,
36
+ "scripts": {
37
+ "build": "tsup --minify",
38
+ "dev": "tsup --watch",
39
+ "clean": "rimraf dist",
40
+ "test": "jest --maxWorkers=1 --passWithNoTests",
41
+ "lint": "eslint \"src/**/*.{js,ts,tsx}\"",
42
+ "format": "prettier --write \"src/**/*.{js,ts,tsx}\""
43
+ },
44
+ "dependencies": {
45
+ "@uniformdev/canvas": "^17.1.1-alpha.151+3c57dd245",
46
+ "@uniformdev/canvas-react": "^17.1.1-alpha.151+3c57dd245"
47
+ },
48
+ "peerDependencies": {
49
+ "next": ">= 12.0.0",
50
+ "react": ">= 16",
51
+ "react-dom": ">=16"
52
+ },
53
+ "devDependencies": {
54
+ "@types/react": "18.0.17",
55
+ "next": "12.2.5",
56
+ "react": "18.2.0",
57
+ "react-dom": "18.2.0"
58
+ },
59
+ "files": [
60
+ "/dist"
61
+ ],
62
+ "publishConfig": {
63
+ "access": "public"
64
+ },
65
+ "gitHead": "3c57dd245b59aa55368da8991d1e39bc633bbed8"
66
+ }