forked from zesty-io/nextjs-starter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
types.ts
114 lines (106 loc) · 2.13 KB
/
types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
export type Article = {
title: string;
subtitle: string;
image: string;
date: string;
content: string;
author: {
data: {
name: string;
image: {
data: {
url: string;
}[];
};
}[];
};
};
export type Locale = {
id: string;
name: string;
code: string;
default: string;
active: string;
enabled: string;
};
export type Model = {
type: string;
zuid: string;
name: string;
label: string;
resourceURI: string;
};
export type Web = {
url: string;
uri: string;
fragment: string;
canonical_tag_mode: string;
sitemap_priority: string;
sitemap_last_updated: string;
canonical_query_param_whitelist: null;
canonical_tag_custom_value: null;
seo_link_text: string;
seo_meta_title: string;
seo_meta_description: string;
seo_meta_keywords: string;
};
export type LayoutChild = {
icon?: string;
name: string;
type: string;
html: string;
description?: string;
draggable?: boolean;
model?: string;
position: number;
fullName: string;
primarytype: string;
uid?: string;
preview?: string;
classes?: string;
droppable?: boolean;
};
interface LayoutJson {
[key: string]: {
name: string;
html: string;
children: LayoutChild[];
};
}
// TODO: Remove is layout is not important to this starter
export type Layout = {
html: string;
json: LayoutJson;
};
export type Meta = {
type: string;
model_name: string;
model_alternate_name: string;
zuid: string;
createdAt: string;
updatedAt: string;
listed: string;
version: string;
locale: Locale;
model: Model;
web: Web;
layout?: Layout;
};
export type NavigationTreeItem = {
url: string;
title: string;
zuid: string;
};
export type ContentItem<T extends Record<string, any> = Record<string, any>> = {
// Any fields in the content model, using the generic type parameter T
[K in keyof T]: T[K];
} & {
// Meta data about the content item
meta: Meta;
zestyProductionMode: boolean;
// The ZUID of the current instance
zestyInstanceZUID: string;
zestyBaseURL: string;
// The navigation tree for the current instance
zestyNavigationTree: NavigationTreeItem[];
};