@lucrex/storefront-blocks 0.0.0-stage → 0.2.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/README.md +58 -2
- package/dist/index.cjs +2561 -0
- package/dist/index.mjs +2538 -0
- package/dist/server.cjs +2608 -0
- package/dist/server.mjs +2587 -0
- package/dist/types/block.d.ts +244 -0
- package/dist/types/blocks/checkout.d.ts +5 -0
- package/dist/types/blocks/content.d.ts +19 -0
- package/dist/types/blocks/index.d.ts +3 -0
- package/dist/types/blocks/layout.d.ts +9 -0
- package/dist/types/blocks/product.d.ts +13 -0
- package/dist/types/blocks/store.d.ts +75 -0
- package/dist/types/context.d.ts +11 -0
- package/dist/types/data.d.ts +141 -0
- package/dist/types/document.d.ts +29 -0
- package/dist/types/index.d.ts +17 -0
- package/dist/types/json-schema.d.ts +15 -0
- package/dist/types/money.d.ts +2 -0
- package/dist/types/page.d.ts +14 -0
- package/dist/types/server.d.ts +10 -0
- package/dist/types/style.d.ts +188 -0
- package/dist/types/templates/funnels.d.ts +7 -0
- package/dist/types/templates/online-stores.d.ts +10 -0
- package/dist/types/validate.d.ts +18 -0
- package/package.json +57 -5
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
import { ReactElement, ReactNode } from 'react';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { PageData } from './data';
|
|
4
|
+
import { BlockStyle } from './style';
|
|
5
|
+
export type BlockCategory = 'layout' | 'content' | 'product' | 'checkout' | 'store';
|
|
6
|
+
export type FieldDefinition = {
|
|
7
|
+
type: 'text' | 'textarea' | 'number';
|
|
8
|
+
label: string;
|
|
9
|
+
} | {
|
|
10
|
+
type: 'select' | 'radio';
|
|
11
|
+
label: string;
|
|
12
|
+
options: {
|
|
13
|
+
label: string;
|
|
14
|
+
value: string | number | boolean;
|
|
15
|
+
}[];
|
|
16
|
+
} | {
|
|
17
|
+
type: 'slot';
|
|
18
|
+
label: string;
|
|
19
|
+
};
|
|
20
|
+
export declare const BlockIdSchema: z.ZodString;
|
|
21
|
+
export declare const ClassNameSchema: z.ZodString;
|
|
22
|
+
export declare const BlockNodeSchema: z.ZodObject<{
|
|
23
|
+
type: z.ZodString;
|
|
24
|
+
props: z.ZodObject<{
|
|
25
|
+
id: z.ZodString;
|
|
26
|
+
}, z.core.$loose>;
|
|
27
|
+
}, z.core.$strip>;
|
|
28
|
+
export declare const BaseBlockPropsSchema: z.ZodObject<{
|
|
29
|
+
id: z.ZodString;
|
|
30
|
+
className: z.ZodOptional<z.ZodString>;
|
|
31
|
+
style: z.ZodOptional<z.ZodObject<{
|
|
32
|
+
display: z.ZodOptional<z.ZodString>;
|
|
33
|
+
position: z.ZodOptional<z.ZodString>;
|
|
34
|
+
top: z.ZodOptional<z.ZodString>;
|
|
35
|
+
right: z.ZodOptional<z.ZodString>;
|
|
36
|
+
bottom: z.ZodOptional<z.ZodString>;
|
|
37
|
+
left: z.ZodOptional<z.ZodString>;
|
|
38
|
+
zIndex: z.ZodOptional<z.ZodString>;
|
|
39
|
+
width: z.ZodOptional<z.ZodString>;
|
|
40
|
+
minWidth: z.ZodOptional<z.ZodString>;
|
|
41
|
+
maxWidth: z.ZodOptional<z.ZodString>;
|
|
42
|
+
height: z.ZodOptional<z.ZodString>;
|
|
43
|
+
minHeight: z.ZodOptional<z.ZodString>;
|
|
44
|
+
maxHeight: z.ZodOptional<z.ZodString>;
|
|
45
|
+
margin: z.ZodOptional<z.ZodString>;
|
|
46
|
+
marginTop: z.ZodOptional<z.ZodString>;
|
|
47
|
+
marginRight: z.ZodOptional<z.ZodString>;
|
|
48
|
+
marginBottom: z.ZodOptional<z.ZodString>;
|
|
49
|
+
marginLeft: z.ZodOptional<z.ZodString>;
|
|
50
|
+
padding: z.ZodOptional<z.ZodString>;
|
|
51
|
+
paddingTop: z.ZodOptional<z.ZodString>;
|
|
52
|
+
paddingRight: z.ZodOptional<z.ZodString>;
|
|
53
|
+
paddingBottom: z.ZodOptional<z.ZodString>;
|
|
54
|
+
paddingLeft: z.ZodOptional<z.ZodString>;
|
|
55
|
+
flexDirection: z.ZodOptional<z.ZodString>;
|
|
56
|
+
flexWrap: z.ZodOptional<z.ZodString>;
|
|
57
|
+
alignItems: z.ZodOptional<z.ZodString>;
|
|
58
|
+
justifyContent: z.ZodOptional<z.ZodString>;
|
|
59
|
+
gap: z.ZodOptional<z.ZodString>;
|
|
60
|
+
gridTemplateColumns: z.ZodOptional<z.ZodString>;
|
|
61
|
+
color: z.ZodOptional<z.ZodString>;
|
|
62
|
+
background: z.ZodOptional<z.ZodString>;
|
|
63
|
+
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
64
|
+
backgroundImage: z.ZodOptional<z.ZodString>;
|
|
65
|
+
backgroundSize: z.ZodOptional<z.ZodString>;
|
|
66
|
+
backgroundPosition: z.ZodOptional<z.ZodString>;
|
|
67
|
+
fontFamily: z.ZodOptional<z.ZodString>;
|
|
68
|
+
fontSize: z.ZodOptional<z.ZodString>;
|
|
69
|
+
fontWeight: z.ZodOptional<z.ZodString>;
|
|
70
|
+
fontStyle: z.ZodOptional<z.ZodString>;
|
|
71
|
+
lineHeight: z.ZodOptional<z.ZodString>;
|
|
72
|
+
letterSpacing: z.ZodOptional<z.ZodString>;
|
|
73
|
+
textAlign: z.ZodOptional<z.ZodString>;
|
|
74
|
+
textTransform: z.ZodOptional<z.ZodString>;
|
|
75
|
+
textDecoration: z.ZodOptional<z.ZodString>;
|
|
76
|
+
border: z.ZodOptional<z.ZodString>;
|
|
77
|
+
borderTop: z.ZodOptional<z.ZodString>;
|
|
78
|
+
borderBottom: z.ZodOptional<z.ZodString>;
|
|
79
|
+
borderColor: z.ZodOptional<z.ZodString>;
|
|
80
|
+
borderRadius: z.ZodOptional<z.ZodString>;
|
|
81
|
+
boxShadow: z.ZodOptional<z.ZodString>;
|
|
82
|
+
opacity: z.ZodOptional<z.ZodString>;
|
|
83
|
+
overflow: z.ZodOptional<z.ZodString>;
|
|
84
|
+
objectFit: z.ZodOptional<z.ZodString>;
|
|
85
|
+
aspectRatio: z.ZodOptional<z.ZodString>;
|
|
86
|
+
transition: z.ZodOptional<z.ZodString>;
|
|
87
|
+
transform: z.ZodOptional<z.ZodString>;
|
|
88
|
+
tablet: z.ZodOptional<z.ZodObject<{
|
|
89
|
+
display: z.ZodOptional<z.ZodString>;
|
|
90
|
+
position: z.ZodOptional<z.ZodString>;
|
|
91
|
+
top: z.ZodOptional<z.ZodString>;
|
|
92
|
+
right: z.ZodOptional<z.ZodString>;
|
|
93
|
+
bottom: z.ZodOptional<z.ZodString>;
|
|
94
|
+
left: z.ZodOptional<z.ZodString>;
|
|
95
|
+
zIndex: z.ZodOptional<z.ZodString>;
|
|
96
|
+
width: z.ZodOptional<z.ZodString>;
|
|
97
|
+
minWidth: z.ZodOptional<z.ZodString>;
|
|
98
|
+
maxWidth: z.ZodOptional<z.ZodString>;
|
|
99
|
+
height: z.ZodOptional<z.ZodString>;
|
|
100
|
+
minHeight: z.ZodOptional<z.ZodString>;
|
|
101
|
+
maxHeight: z.ZodOptional<z.ZodString>;
|
|
102
|
+
margin: z.ZodOptional<z.ZodString>;
|
|
103
|
+
marginTop: z.ZodOptional<z.ZodString>;
|
|
104
|
+
marginRight: z.ZodOptional<z.ZodString>;
|
|
105
|
+
marginBottom: z.ZodOptional<z.ZodString>;
|
|
106
|
+
marginLeft: z.ZodOptional<z.ZodString>;
|
|
107
|
+
padding: z.ZodOptional<z.ZodString>;
|
|
108
|
+
paddingTop: z.ZodOptional<z.ZodString>;
|
|
109
|
+
paddingRight: z.ZodOptional<z.ZodString>;
|
|
110
|
+
paddingBottom: z.ZodOptional<z.ZodString>;
|
|
111
|
+
paddingLeft: z.ZodOptional<z.ZodString>;
|
|
112
|
+
flexDirection: z.ZodOptional<z.ZodString>;
|
|
113
|
+
flexWrap: z.ZodOptional<z.ZodString>;
|
|
114
|
+
alignItems: z.ZodOptional<z.ZodString>;
|
|
115
|
+
justifyContent: z.ZodOptional<z.ZodString>;
|
|
116
|
+
gap: z.ZodOptional<z.ZodString>;
|
|
117
|
+
gridTemplateColumns: z.ZodOptional<z.ZodString>;
|
|
118
|
+
color: z.ZodOptional<z.ZodString>;
|
|
119
|
+
background: z.ZodOptional<z.ZodString>;
|
|
120
|
+
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
121
|
+
backgroundImage: z.ZodOptional<z.ZodString>;
|
|
122
|
+
backgroundSize: z.ZodOptional<z.ZodString>;
|
|
123
|
+
backgroundPosition: z.ZodOptional<z.ZodString>;
|
|
124
|
+
fontFamily: z.ZodOptional<z.ZodString>;
|
|
125
|
+
fontSize: z.ZodOptional<z.ZodString>;
|
|
126
|
+
fontWeight: z.ZodOptional<z.ZodString>;
|
|
127
|
+
fontStyle: z.ZodOptional<z.ZodString>;
|
|
128
|
+
lineHeight: z.ZodOptional<z.ZodString>;
|
|
129
|
+
letterSpacing: z.ZodOptional<z.ZodString>;
|
|
130
|
+
textAlign: z.ZodOptional<z.ZodString>;
|
|
131
|
+
textTransform: z.ZodOptional<z.ZodString>;
|
|
132
|
+
textDecoration: z.ZodOptional<z.ZodString>;
|
|
133
|
+
border: z.ZodOptional<z.ZodString>;
|
|
134
|
+
borderTop: z.ZodOptional<z.ZodString>;
|
|
135
|
+
borderBottom: z.ZodOptional<z.ZodString>;
|
|
136
|
+
borderColor: z.ZodOptional<z.ZodString>;
|
|
137
|
+
borderRadius: z.ZodOptional<z.ZodString>;
|
|
138
|
+
boxShadow: z.ZodOptional<z.ZodString>;
|
|
139
|
+
opacity: z.ZodOptional<z.ZodString>;
|
|
140
|
+
overflow: z.ZodOptional<z.ZodString>;
|
|
141
|
+
objectFit: z.ZodOptional<z.ZodString>;
|
|
142
|
+
aspectRatio: z.ZodOptional<z.ZodString>;
|
|
143
|
+
transition: z.ZodOptional<z.ZodString>;
|
|
144
|
+
transform: z.ZodOptional<z.ZodString>;
|
|
145
|
+
}, z.core.$strip>>;
|
|
146
|
+
mobile: z.ZodOptional<z.ZodObject<{
|
|
147
|
+
display: z.ZodOptional<z.ZodString>;
|
|
148
|
+
position: z.ZodOptional<z.ZodString>;
|
|
149
|
+
top: z.ZodOptional<z.ZodString>;
|
|
150
|
+
right: z.ZodOptional<z.ZodString>;
|
|
151
|
+
bottom: z.ZodOptional<z.ZodString>;
|
|
152
|
+
left: z.ZodOptional<z.ZodString>;
|
|
153
|
+
zIndex: z.ZodOptional<z.ZodString>;
|
|
154
|
+
width: z.ZodOptional<z.ZodString>;
|
|
155
|
+
minWidth: z.ZodOptional<z.ZodString>;
|
|
156
|
+
maxWidth: z.ZodOptional<z.ZodString>;
|
|
157
|
+
height: z.ZodOptional<z.ZodString>;
|
|
158
|
+
minHeight: z.ZodOptional<z.ZodString>;
|
|
159
|
+
maxHeight: z.ZodOptional<z.ZodString>;
|
|
160
|
+
margin: z.ZodOptional<z.ZodString>;
|
|
161
|
+
marginTop: z.ZodOptional<z.ZodString>;
|
|
162
|
+
marginRight: z.ZodOptional<z.ZodString>;
|
|
163
|
+
marginBottom: z.ZodOptional<z.ZodString>;
|
|
164
|
+
marginLeft: z.ZodOptional<z.ZodString>;
|
|
165
|
+
padding: z.ZodOptional<z.ZodString>;
|
|
166
|
+
paddingTop: z.ZodOptional<z.ZodString>;
|
|
167
|
+
paddingRight: z.ZodOptional<z.ZodString>;
|
|
168
|
+
paddingBottom: z.ZodOptional<z.ZodString>;
|
|
169
|
+
paddingLeft: z.ZodOptional<z.ZodString>;
|
|
170
|
+
flexDirection: z.ZodOptional<z.ZodString>;
|
|
171
|
+
flexWrap: z.ZodOptional<z.ZodString>;
|
|
172
|
+
alignItems: z.ZodOptional<z.ZodString>;
|
|
173
|
+
justifyContent: z.ZodOptional<z.ZodString>;
|
|
174
|
+
gap: z.ZodOptional<z.ZodString>;
|
|
175
|
+
gridTemplateColumns: z.ZodOptional<z.ZodString>;
|
|
176
|
+
color: z.ZodOptional<z.ZodString>;
|
|
177
|
+
background: z.ZodOptional<z.ZodString>;
|
|
178
|
+
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
179
|
+
backgroundImage: z.ZodOptional<z.ZodString>;
|
|
180
|
+
backgroundSize: z.ZodOptional<z.ZodString>;
|
|
181
|
+
backgroundPosition: z.ZodOptional<z.ZodString>;
|
|
182
|
+
fontFamily: z.ZodOptional<z.ZodString>;
|
|
183
|
+
fontSize: z.ZodOptional<z.ZodString>;
|
|
184
|
+
fontWeight: z.ZodOptional<z.ZodString>;
|
|
185
|
+
fontStyle: z.ZodOptional<z.ZodString>;
|
|
186
|
+
lineHeight: z.ZodOptional<z.ZodString>;
|
|
187
|
+
letterSpacing: z.ZodOptional<z.ZodString>;
|
|
188
|
+
textAlign: z.ZodOptional<z.ZodString>;
|
|
189
|
+
textTransform: z.ZodOptional<z.ZodString>;
|
|
190
|
+
textDecoration: z.ZodOptional<z.ZodString>;
|
|
191
|
+
border: z.ZodOptional<z.ZodString>;
|
|
192
|
+
borderTop: z.ZodOptional<z.ZodString>;
|
|
193
|
+
borderBottom: z.ZodOptional<z.ZodString>;
|
|
194
|
+
borderColor: z.ZodOptional<z.ZodString>;
|
|
195
|
+
borderRadius: z.ZodOptional<z.ZodString>;
|
|
196
|
+
boxShadow: z.ZodOptional<z.ZodString>;
|
|
197
|
+
opacity: z.ZodOptional<z.ZodString>;
|
|
198
|
+
overflow: z.ZodOptional<z.ZodString>;
|
|
199
|
+
objectFit: z.ZodOptional<z.ZodString>;
|
|
200
|
+
aspectRatio: z.ZodOptional<z.ZodString>;
|
|
201
|
+
transition: z.ZodOptional<z.ZodString>;
|
|
202
|
+
transform: z.ZodOptional<z.ZodString>;
|
|
203
|
+
}, z.core.$strip>>;
|
|
204
|
+
}, z.core.$strip>>;
|
|
205
|
+
css: z.ZodOptional<z.ZodString>;
|
|
206
|
+
}, z.core.$strip>;
|
|
207
|
+
export interface BaseBlockProps {
|
|
208
|
+
id: string;
|
|
209
|
+
className?: string;
|
|
210
|
+
style?: BlockStyle;
|
|
211
|
+
css?: string;
|
|
212
|
+
}
|
|
213
|
+
export type BlockRenderProps<P> = P & BaseBlockProps & {
|
|
214
|
+
slots: Record<string, ReactNode>;
|
|
215
|
+
};
|
|
216
|
+
export interface BlockDefinition<P extends object = Record<string, unknown>> {
|
|
217
|
+
type: string;
|
|
218
|
+
label: string;
|
|
219
|
+
description: string;
|
|
220
|
+
category: BlockCategory;
|
|
221
|
+
schema: z.ZodObject;
|
|
222
|
+
slots: readonly string[];
|
|
223
|
+
defaultProps: P;
|
|
224
|
+
fields: Partial<Record<keyof P & string, FieldDefinition>>;
|
|
225
|
+
preload?: (props: P, data: PageData) => string[];
|
|
226
|
+
baseCss?: string;
|
|
227
|
+
render: (props: BlockRenderProps<P>) => ReactElement | null;
|
|
228
|
+
}
|
|
229
|
+
export declare function defineBlock<S extends z.ZodObject>(definition: {
|
|
230
|
+
type: string;
|
|
231
|
+
label: string;
|
|
232
|
+
description: string;
|
|
233
|
+
category: BlockCategory;
|
|
234
|
+
schema: S;
|
|
235
|
+
slots?: readonly string[];
|
|
236
|
+
fields: Partial<Record<keyof z.output<S> & string, FieldDefinition>>;
|
|
237
|
+
preload?: (props: z.output<S>, data: PageData) => string[];
|
|
238
|
+
baseCss?: string;
|
|
239
|
+
render: (props: BlockRenderProps<z.output<S>>) => ReactElement | null;
|
|
240
|
+
}): BlockDefinition<z.output<S>>;
|
|
241
|
+
export declare function blockRoot(props: BaseBlockProps, ...classNames: (string | false | undefined)[]): {
|
|
242
|
+
'data-block': string;
|
|
243
|
+
className?: string;
|
|
244
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare const Heading: import("..").BlockDefinition<{
|
|
2
|
+
text: string;
|
|
3
|
+
level: "h1" | "h2" | "h3" | "h4" | "h5" | "h6";
|
|
4
|
+
}>;
|
|
5
|
+
export declare const Text: import("..").BlockDefinition<{
|
|
6
|
+
text: string;
|
|
7
|
+
}>;
|
|
8
|
+
export declare const Image: import("..").BlockDefinition<{
|
|
9
|
+
src: string;
|
|
10
|
+
alt: string;
|
|
11
|
+
href: string;
|
|
12
|
+
loading: "lazy" | "eager";
|
|
13
|
+
}>;
|
|
14
|
+
export declare const Button: import("..").BlockDefinition<{
|
|
15
|
+
label: string;
|
|
16
|
+
href: string;
|
|
17
|
+
newTab: boolean;
|
|
18
|
+
}>;
|
|
19
|
+
export declare const Spacer: import("..").BlockDefinition<Record<string, never>>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const Section: import("..").BlockDefinition<{
|
|
2
|
+
tag: "section" | "div" | "header" | "footer" | "aside" | "nav";
|
|
3
|
+
anchorId: string;
|
|
4
|
+
}>;
|
|
5
|
+
export declare const Stack: import("..").BlockDefinition<Record<string, never>>;
|
|
6
|
+
export declare const Columns: import("..").BlockDefinition<{
|
|
7
|
+
count: 2 | 4 | 3;
|
|
8
|
+
stackOnMobile: boolean;
|
|
9
|
+
}>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const ProductTitle: import("..").BlockDefinition<{
|
|
2
|
+
level: "h1" | "h2" | "h3";
|
|
3
|
+
}>;
|
|
4
|
+
export declare const ProductPrice: import("..").BlockDefinition<Record<string, never>>;
|
|
5
|
+
export declare const ProductTagline: import("..").BlockDefinition<Record<string, never>>;
|
|
6
|
+
export declare const ProductGallery: import("..").BlockDefinition<Record<string, never>>;
|
|
7
|
+
export declare const LandingImages: import("..").BlockDefinition<{
|
|
8
|
+
eagerFirstImage: boolean;
|
|
9
|
+
}>;
|
|
10
|
+
export declare const ProductDescription: import("..").BlockDefinition<{
|
|
11
|
+
onlyWithoutLandingImages: boolean;
|
|
12
|
+
}>;
|
|
13
|
+
export declare const ProductFaq: import("..").BlockDefinition<Record<string, never>>;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
export declare const AnnouncementBar: import("..").BlockDefinition<Record<string, never>>;
|
|
2
|
+
export declare const StoreHeader: import("..").BlockDefinition<{
|
|
3
|
+
navCategories: number;
|
|
4
|
+
}>;
|
|
5
|
+
export declare const StoreFooter: import("..").BlockDefinition<{
|
|
6
|
+
footerCategories: number;
|
|
7
|
+
}>;
|
|
8
|
+
export declare const StoreHeroTitle: import("..").BlockDefinition<{
|
|
9
|
+
text: string;
|
|
10
|
+
}>;
|
|
11
|
+
export declare const StoreHeroSubtitle: import("..").BlockDefinition<{
|
|
12
|
+
text: string;
|
|
13
|
+
}>;
|
|
14
|
+
export declare const StoreHeroButton: import("..").BlockDefinition<{
|
|
15
|
+
label: string;
|
|
16
|
+
href: string;
|
|
17
|
+
}>;
|
|
18
|
+
export declare const StoreHeroImage: import("..").BlockDefinition<{
|
|
19
|
+
frameClassName: string;
|
|
20
|
+
}>;
|
|
21
|
+
export declare const StoreCategories: import("..").BlockDefinition<{
|
|
22
|
+
layout: "section" | "nav";
|
|
23
|
+
listClassName: string;
|
|
24
|
+
itemStyle: "link" | "tag" | "card" | "pill" | "chip" | "room";
|
|
25
|
+
title: string;
|
|
26
|
+
titleLabel: "bestSellers" | "newArrivals" | "shopByCategory" | "youMayAlsoLike" | "categories" | "allProducts" | "cod";
|
|
27
|
+
}>;
|
|
28
|
+
export declare const StoreProductGrid: import("..").BlockDefinition<{
|
|
29
|
+
source: "home" | "related";
|
|
30
|
+
gridClassName: string;
|
|
31
|
+
title: string;
|
|
32
|
+
titleLabel: "bestSellers" | "newArrivals" | "shopByCategory" | "youMayAlsoLike" | "categories" | "allProducts" | "cod";
|
|
33
|
+
viewAll: boolean;
|
|
34
|
+
hideWhenEmpty: boolean;
|
|
35
|
+
}>;
|
|
36
|
+
export declare const StoreTrust: import("..").BlockDefinition<{
|
|
37
|
+
variant: "list" | "bento";
|
|
38
|
+
}>;
|
|
39
|
+
export declare const StoreTagline: import("..").BlockDefinition<Record<string, never>>;
|
|
40
|
+
export declare const StoreTicker: import("..").BlockDefinition<{
|
|
41
|
+
labels: ("bestSellers" | "newArrivals" | "shopByCategory" | "youMayAlsoLike" | "categories" | "allProducts" | "cod")[];
|
|
42
|
+
repeat: number;
|
|
43
|
+
}>;
|
|
44
|
+
export declare const StoreSearch: import("..").BlockDefinition<Record<string, never>>;
|
|
45
|
+
export declare const Ornament: import("..").BlockDefinition<Record<string, never>>;
|
|
46
|
+
export declare const StorePageHeading: import("..").BlockDefinition<{
|
|
47
|
+
source: "article" | "listing" | "contact";
|
|
48
|
+
title: string;
|
|
49
|
+
text: string;
|
|
50
|
+
}>;
|
|
51
|
+
export declare const ListingToolbar: import("..").BlockDefinition<Record<string, never>>;
|
|
52
|
+
export declare const ListingGrid: import("..").BlockDefinition<Record<string, never>>;
|
|
53
|
+
export declare const ListingEmpty: import("..").BlockDefinition<{
|
|
54
|
+
text: string;
|
|
55
|
+
}>;
|
|
56
|
+
export declare const ListingLoadMore: import("..").BlockDefinition<{
|
|
57
|
+
label: string;
|
|
58
|
+
}>;
|
|
59
|
+
export declare const StoreProductGallery: import("..").BlockDefinition<Record<string, never>>;
|
|
60
|
+
export declare const StoreBreadcrumbs: import("..").BlockDefinition<Record<string, never>>;
|
|
61
|
+
export declare const StoreProductTitle: import("..").BlockDefinition<Record<string, never>>;
|
|
62
|
+
export declare const StoreProductPrice: import("..").BlockDefinition<Record<string, never>>;
|
|
63
|
+
export declare const StoreProductDescription: import("..").BlockDefinition<Record<string, never>>;
|
|
64
|
+
export declare const StoreProductFaq: import("..").BlockDefinition<Record<string, never>>;
|
|
65
|
+
export declare const ContactDetails: import("..").BlockDefinition<Record<string, never>>;
|
|
66
|
+
export declare const ContactForm: import("..").BlockDefinition<Record<string, never>>;
|
|
67
|
+
export declare const StoreThankYou: import("..").BlockDefinition<{
|
|
68
|
+
title: string;
|
|
69
|
+
text: string;
|
|
70
|
+
}>;
|
|
71
|
+
export declare const StoreNotFound: import("..").BlockDefinition<{
|
|
72
|
+
title: string;
|
|
73
|
+
text: string;
|
|
74
|
+
}>;
|
|
75
|
+
export declare const StoreArticle: import("..").BlockDefinition<Record<string, never>>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { FunnelPageData, OnlineStorePageData, PageData } from './data';
|
|
3
|
+
export declare function PageDataProvider({ data, children }: {
|
|
4
|
+
data: PageData;
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
}): import("react").JSX.Element;
|
|
7
|
+
export declare function usePageData(): PageData;
|
|
8
|
+
export declare function checkoutData(data: PageData): FunnelPageData;
|
|
9
|
+
export declare function useCheckoutData(): FunnelPageData;
|
|
10
|
+
export declare function storeData(data: PageData): OnlineStorePageData;
|
|
11
|
+
export declare function useStoreData(): OnlineStorePageData;
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
export interface PageVariantDefinition {
|
|
2
|
+
name: string;
|
|
3
|
+
values: string[];
|
|
4
|
+
}
|
|
5
|
+
export interface PageFormField {
|
|
6
|
+
type: string;
|
|
7
|
+
enabled: boolean;
|
|
8
|
+
required: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface PageOffer {
|
|
11
|
+
trackingId: string;
|
|
12
|
+
name: string;
|
|
13
|
+
price: number;
|
|
14
|
+
freeShipping: boolean;
|
|
15
|
+
notes: string | null;
|
|
16
|
+
products: {
|
|
17
|
+
trackingId: string;
|
|
18
|
+
quantity: number;
|
|
19
|
+
}[];
|
|
20
|
+
}
|
|
21
|
+
export interface PageState {
|
|
22
|
+
id: string;
|
|
23
|
+
code: string;
|
|
24
|
+
name: string;
|
|
25
|
+
nameAr: string;
|
|
26
|
+
}
|
|
27
|
+
export interface PageCity extends PageState {
|
|
28
|
+
stateId: string;
|
|
29
|
+
}
|
|
30
|
+
export interface FunnelPageData {
|
|
31
|
+
funnel: {
|
|
32
|
+
language: string;
|
|
33
|
+
form: {
|
|
34
|
+
position: string;
|
|
35
|
+
fields: PageFormField[];
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
landingPage: {
|
|
39
|
+
images: string[];
|
|
40
|
+
leadImages: string[];
|
|
41
|
+
};
|
|
42
|
+
product: {
|
|
43
|
+
name: string;
|
|
44
|
+
tagline: string | null;
|
|
45
|
+
description: string | null;
|
|
46
|
+
images: string[];
|
|
47
|
+
isBundle: boolean;
|
|
48
|
+
variantDefinitions: PageVariantDefinition[];
|
|
49
|
+
bundleProducts: {
|
|
50
|
+
trackingId: string;
|
|
51
|
+
name: string;
|
|
52
|
+
variantDefinitions: PageVariantDefinition[];
|
|
53
|
+
}[];
|
|
54
|
+
faq: {
|
|
55
|
+
question: string;
|
|
56
|
+
answer: string;
|
|
57
|
+
}[];
|
|
58
|
+
};
|
|
59
|
+
offers: PageOffer[];
|
|
60
|
+
deliveryPrices: {
|
|
61
|
+
stopdeskEnabled: boolean;
|
|
62
|
+
} | null;
|
|
63
|
+
geo: {
|
|
64
|
+
states: PageState[];
|
|
65
|
+
cities: PageCity[];
|
|
66
|
+
};
|
|
67
|
+
api: {
|
|
68
|
+
recaptchaSiteKey: string;
|
|
69
|
+
};
|
|
70
|
+
lazyCities?: boolean;
|
|
71
|
+
}
|
|
72
|
+
export interface MoneyFormat {
|
|
73
|
+
language: string;
|
|
74
|
+
iso2: string;
|
|
75
|
+
currency: string;
|
|
76
|
+
}
|
|
77
|
+
export interface StoreCategoryData {
|
|
78
|
+
trackingId: string;
|
|
79
|
+
name: string;
|
|
80
|
+
url: string;
|
|
81
|
+
imageUrl: string;
|
|
82
|
+
}
|
|
83
|
+
export interface StoreProductCardData {
|
|
84
|
+
url: string;
|
|
85
|
+
categoryId: string | null;
|
|
86
|
+
fromPrice: number;
|
|
87
|
+
compareAtPrice: number | null;
|
|
88
|
+
discountPercent: number | null;
|
|
89
|
+
cardImage: string | null;
|
|
90
|
+
cardHoverImage: string | null;
|
|
91
|
+
product: {
|
|
92
|
+
trackingId: string;
|
|
93
|
+
name: string;
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
export interface StoreContactData {
|
|
97
|
+
phone: string | null;
|
|
98
|
+
whatsapp: string | null;
|
|
99
|
+
email: string | null;
|
|
100
|
+
address: string | null;
|
|
101
|
+
facebook: string | null;
|
|
102
|
+
instagram: string | null;
|
|
103
|
+
tiktok: string | null;
|
|
104
|
+
}
|
|
105
|
+
export interface OnlineStorePageData {
|
|
106
|
+
labels: Record<string, string>;
|
|
107
|
+
money: MoneyFormat;
|
|
108
|
+
onlineStore: {
|
|
109
|
+
name: string;
|
|
110
|
+
tagline: string | null;
|
|
111
|
+
logoUrl: string | null;
|
|
112
|
+
hero: {
|
|
113
|
+
title: string | null;
|
|
114
|
+
subtitle: string | null;
|
|
115
|
+
imageUrl: string | null;
|
|
116
|
+
ctaLabel: string | null;
|
|
117
|
+
};
|
|
118
|
+
contact: StoreContactData;
|
|
119
|
+
announcementBarEnabled: boolean;
|
|
120
|
+
announcementBarText: string | null;
|
|
121
|
+
};
|
|
122
|
+
categories: StoreCategoryData[];
|
|
123
|
+
homeProducts: StoreProductCardData[];
|
|
124
|
+
listing?: {
|
|
125
|
+
category: StoreCategoryData | null;
|
|
126
|
+
products: StoreProductCardData[];
|
|
127
|
+
};
|
|
128
|
+
productPage?: {
|
|
129
|
+
price: number;
|
|
130
|
+
gallery: string[];
|
|
131
|
+
categoryName: string | null;
|
|
132
|
+
related: StoreProductCardData[];
|
|
133
|
+
};
|
|
134
|
+
article?: {
|
|
135
|
+
title: string;
|
|
136
|
+
html: string;
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
export type PageData = Partial<FunnelPageData> & {
|
|
140
|
+
store?: OnlineStorePageData;
|
|
141
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export interface BlockNode {
|
|
2
|
+
type: string;
|
|
3
|
+
props: {
|
|
4
|
+
id: string;
|
|
5
|
+
[key: string]: unknown;
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
export interface PageFont {
|
|
9
|
+
family: string;
|
|
10
|
+
weights?: number[];
|
|
11
|
+
}
|
|
12
|
+
export interface PageRootProps {
|
|
13
|
+
css?: string;
|
|
14
|
+
fonts?: PageFont[];
|
|
15
|
+
}
|
|
16
|
+
export interface PageDocument {
|
|
17
|
+
root: {
|
|
18
|
+
props: PageRootProps;
|
|
19
|
+
};
|
|
20
|
+
content: BlockNode[];
|
|
21
|
+
}
|
|
22
|
+
export interface PageIssue {
|
|
23
|
+
path: string;
|
|
24
|
+
message: string;
|
|
25
|
+
}
|
|
26
|
+
export declare class PageDocumentError extends Error {
|
|
27
|
+
readonly issues: PageIssue[];
|
|
28
|
+
constructor(issues: PageIssue[]);
|
|
29
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export type { BlockNode, PageDocument, PageFont, PageIssue, PageRootProps } from './document';
|
|
2
|
+
export { PageDocumentError } from './document';
|
|
3
|
+
export type { FunnelPageData, MoneyFormat, OnlineStorePageData, PageCity, PageData, PageFormField, PageOffer, PageState, PageVariantDefinition, StoreCategoryData, StoreContactData, StoreProductCardData, } from './data';
|
|
4
|
+
export type { BaseBlockProps, BlockCategory, BlockDefinition, BlockRenderProps, FieldDefinition, } from './block';
|
|
5
|
+
export type { BlockStyle, StyleDeclarations, StyleProperty } from './style';
|
|
6
|
+
export { Breakpoints, StyleProperties } from './style';
|
|
7
|
+
export { blocks } from './blocks';
|
|
8
|
+
export { checkoutData, PageDataProvider, storeData, useCheckoutData, usePageData, useStoreData, } from './context';
|
|
9
|
+
export { moneyFormatter } from './money';
|
|
10
|
+
export { BlockList, PageContent, blockSelector, pageCss, pageFontStylesheets, pagePreloadImages, } from './page';
|
|
11
|
+
export { countBlocks, parsePageDocument, walkBlocks } from './validate';
|
|
12
|
+
export { pageJsonSchema } from './json-schema';
|
|
13
|
+
export type { BlockJsonSchema, PageJsonSchema } from './json-schema';
|
|
14
|
+
export { FunnelTemplateIds, funnelTemplate } from './templates/funnels';
|
|
15
|
+
export type { FunnelTemplateId, FunnelTemplateOptions } from './templates/funnels';
|
|
16
|
+
export { OnlineStorePageTypes, OnlineStoreTemplateIds, onlineStorePages, onlineStoreTemplate, } from './templates/online-stores';
|
|
17
|
+
export type { OnlineStorePageType, OnlineStoreTemplateId } from './templates/online-stores';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BlockCategory } from './block';
|
|
2
|
+
export interface BlockJsonSchema {
|
|
3
|
+
type: string;
|
|
4
|
+
label: string;
|
|
5
|
+
description: string;
|
|
6
|
+
category: BlockCategory;
|
|
7
|
+
slots: readonly string[];
|
|
8
|
+
props: Record<string, unknown>;
|
|
9
|
+
}
|
|
10
|
+
export interface PageJsonSchema {
|
|
11
|
+
format: string;
|
|
12
|
+
root: Record<string, unknown>;
|
|
13
|
+
blocks: BlockJsonSchema[];
|
|
14
|
+
}
|
|
15
|
+
export declare function pageJsonSchema(): PageJsonSchema;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import { PageData } from './data';
|
|
3
|
+
import { BlockNode, PageDocument } from './document';
|
|
4
|
+
export declare function BlockList({ nodes }: {
|
|
5
|
+
nodes: BlockNode[];
|
|
6
|
+
}): ReactElement;
|
|
7
|
+
export declare function PageContent({ document, data, }: {
|
|
8
|
+
document: PageDocument;
|
|
9
|
+
data: PageData;
|
|
10
|
+
}): ReactElement;
|
|
11
|
+
export declare function blockSelector(id: string): string;
|
|
12
|
+
export declare function pageCss(document: PageDocument): string;
|
|
13
|
+
export declare function pagePreloadImages(document: PageDocument, data: PageData): string[];
|
|
14
|
+
export declare function pageFontStylesheets(document: PageDocument): string[];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { PageData } from './data';
|
|
2
|
+
export interface RenderedPage {
|
|
3
|
+
html: string;
|
|
4
|
+
css: string;
|
|
5
|
+
fontStylesheets: string[];
|
|
6
|
+
preloadImages: string[];
|
|
7
|
+
}
|
|
8
|
+
export declare function processCss(css: string): string;
|
|
9
|
+
export declare function renderPage(input: unknown, data: PageData): RenderedPage;
|
|
10
|
+
export * from './index';
|